mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 22:42:54 +00:00
feat: migrate to esm
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018, 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
@@ -18,8 +16,8 @@ import {Logger} from '@openstapps/logger';
|
||||
import {Command} from 'commander';
|
||||
import {readFileSync} from 'fs';
|
||||
import {join} from 'path';
|
||||
import {executeConnector, isValidSCNamespace} from './common';
|
||||
import {MinimalConnector} from './minimal-connector';
|
||||
import {executeConnector, isValidSCNamespace} from './common.js';
|
||||
import {MinimalConnector} from './minimal-connector.js';
|
||||
|
||||
process.on('unhandledRejection', (error) => {
|
||||
throw error;
|
||||
@@ -34,7 +32,7 @@ const commander = new Command();
|
||||
|
||||
/**
|
||||
* Uses arguments to paramtrize the connector execution
|
||||
*
|
||||
*
|
||||
* backendURL - URL of the StApps backend deployment e.g. http://localhost:3000
|
||||
* origin - Origin, where the data comes from. Typically the name of the connector e.g. minimal-connector
|
||||
* licensePlate - The license plate of your school. Must be matched to a SCNamespace e.g. f-u
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ConnectorClient} from '@openstapps/api/lib/connector-client';
|
||||
import {HttpClient} from '@openstapps/api/lib/http-client';
|
||||
import {ConnectorClient} from '@openstapps/api/lib/connector-client.js';
|
||||
import {HttpClient} from '@openstapps/api/lib/http-client.js';
|
||||
import {
|
||||
SCLicensePlate,
|
||||
SCNamespaces,
|
||||
SCThings,
|
||||
} from '@openstapps/core';
|
||||
import {Connector} from './connector';
|
||||
import {Connector} from './connector.js';
|
||||
|
||||
/**
|
||||
* Checks if the input is a valid SCNamespace
|
||||
@@ -33,10 +33,10 @@ export function isValidSCNamespace(input: string): input is SCLicensePlate {
|
||||
|
||||
/**
|
||||
* Creates a uuid from a JSON stringified item identifier
|
||||
*
|
||||
*
|
||||
* You may create custom itemIdentifier-Interfaces to generate UIDs consistently
|
||||
*
|
||||
* @param itemIdentifier Identifying representation of the item
|
||||
* @param itemIdentifier Identifying representation of the item
|
||||
* @param licensePlate License plate of the school
|
||||
*/
|
||||
export function createUUID(itemIdentifier: unknown, licensePlate: SCLicensePlate): string {
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLicensePlate, SCThingOriginType, SCThingRemoteOrigin, SCThings} from '@openstapps/core';
|
||||
import {createUUID} from './common';
|
||||
import {createUUID} from './common.js';
|
||||
|
||||
/**
|
||||
* Provides abstracted methods for the connector execution process
|
||||
*
|
||||
* Provides abstracted methods for the connector execution process
|
||||
*
|
||||
* By extending this class connector-developers only need to implement load and transform of the data
|
||||
* Pushing the data to the backend will be handled automatically
|
||||
*
|
||||
@@ -34,8 +34,8 @@ export abstract class Connector<T extends SCThings> {
|
||||
public origin: string;
|
||||
|
||||
/**
|
||||
* Abstract constructor for a connector
|
||||
*
|
||||
* Abstract constructor for a connector
|
||||
*
|
||||
* @param licensePlate License plate of the school
|
||||
* @param origin Name of the connector
|
||||
*/
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCLicensePlate, SCMessage, SCThingRemoteOrigin, SCThingType} from '@openstapps/core';
|
||||
import {createUUID} from './common';
|
||||
import {Connector} from './connector';
|
||||
import {createUUID} from './common.js';
|
||||
import {Connector} from './connector.js';
|
||||
|
||||
/**
|
||||
* Example connector
|
||||
@@ -27,7 +27,7 @@ export class MinimalConnector extends Connector<SCMessage> {
|
||||
|
||||
/**
|
||||
* Constructor for the MinimalConnector
|
||||
*
|
||||
*
|
||||
* @param licensePlate License plate of the school
|
||||
* @param origin Name of the connector
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user