mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: build system
This commit is contained in:
@@ -14,11 +14,7 @@
|
||||
*/
|
||||
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 {SCLicensePlate, SCNamespaces, SCThings} from '@openstapps/core';
|
||||
import {Connector} from './connector.js';
|
||||
|
||||
/**
|
||||
@@ -27,8 +23,7 @@ import {Connector} from './connector.js';
|
||||
* @param input Name of the potential SCNamespace
|
||||
*/
|
||||
export function isValidSCNamespace(input: string): input is SCLicensePlate {
|
||||
return Object.keys(SCNamespaces)
|
||||
.indexOf(input) > 0;
|
||||
return Object.keys(SCNamespaces).indexOf(input) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,15 +45,9 @@ export function createUUID(itemIdentifier: unknown, licensePlate: SCLicensePlate
|
||||
* @param backend URL of the StApps backend eployment
|
||||
* @param connector Connector to be executed
|
||||
*/
|
||||
export async function executeConnector<T extends SCThings>(
|
||||
backend: string,
|
||||
connector: Connector<T>,
|
||||
) {
|
||||
export async function executeConnector<T extends SCThings>(backend: string, connector: Connector<T>) {
|
||||
const items: T[] = await connector.getItems();
|
||||
const client: ConnectorClient = new ConnectorClient(
|
||||
new HttpClient(),
|
||||
backend,
|
||||
);
|
||||
const client: ConnectorClient = new ConnectorClient(new HttpClient(), backend);
|
||||
try {
|
||||
await client.index<T>(items, connector.origin);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user