UNPKG

@comake/skl-js-engine

Version:

Standard Knowledge Language Javascript Engine

120 lines 6.57 kB
import type { GraphObject, NodeObject } from 'jsonld'; import type { Frame } from 'jsonld/jsonld-spec'; import { globalHooks } from './hooks/globalHooks'; import type { ExecutionOptions } from './JsExecutor'; import type { ICodeExecutor } from './JsExecutor/types'; import type { SklEngineOptions } from './SklEngineOptions'; import type { FindAllOptions, FindOneOptions, FindOptionsWhere } from './storage/FindOptionsTypes'; import type { GroupByOptions, GroupByResponse } from './storage/GroupOptionTypes'; import type { RawQueryResult } from './storage/query-adapter/QueryAdapter'; import type { Capability, CapabilityConfig, Entity, JSONObject, JSONValue, Mapping, OrArray, SKLEngineInterface } from './util/Types'; export declare type CapabilityHandler = <T extends OrArray<NodeObject> = OrArray<NodeObject>>(params: JSONObject, capabilityConfig?: CapabilityConfig) => Promise<T>; export declare type CapabilityInterface = Record<string, CapabilityHandler>; export declare type MappingResponseOption<T extends boolean> = T extends true ? JSONObject : NodeObject; export declare type WriteOptions = { bypassHooks?: boolean; }; export declare class SKLEngine implements SKLEngineInterface { private readonly queryAdapter; private readonly functions?; private readonly inputFiles?; private readonly globalCallbacks?; private readonly disableValidation?; readonly capability: CapabilityInterface; private readonly isDebugMode; private codeExecutor; private readonly skdsEndpointUrl; private readonly scriptPath; constructor(options: SklEngineOptions); setCodeExecutor(codeExecutor: ICodeExecutor): void; executeRawQuery<T extends RawQueryResult>(query: string): Promise<T[]>; executeRawUpdate(query: string): Promise<void>; executeRawConstructQuery(query: string, frame?: Frame): Promise<GraphObject>; find(options?: FindOneOptions): Promise<Entity>; findBy(where: FindOptionsWhere, notFoundErrorMessage?: string): Promise<Entity>; findByIfExists(options: FindOptionsWhere): Promise<Entity | undefined>; findAll(options?: FindAllOptions): Promise<Entity[]>; groupBy(options: GroupByOptions): Promise<GroupByResponse>; findAllBy(where: FindOptionsWhere): Promise<Entity[]>; exists(options?: FindAllOptions): Promise<boolean>; count(options?: FindAllOptions): Promise<number>; save(entity: Entity, options?: WriteOptions): Promise<Entity>; save(entities: Entity[], options?: WriteOptions): Promise<Entity[]>; update(id: string, attributes: Partial<Entity>, options?: WriteOptions): Promise<void>; update(ids: string[], attributes: Partial<Entity>, options?: WriteOptions): Promise<void>; validateEntitiesConformToObjectSchema(entities: Entity[]): Promise<void>; private groupEntitiesByType; private getSuperClassesOfObject; private getSuperClassesOfObjects; private getParentsOfSelector; private validateEntityConformsToObjectSchema; private validateEntitiesWithIdsConformsToObjectSchemaForAttributes; private getObjectsAndParentObjectsOfEntity; private validateEntityWithIdConformsToObjectSchemaForAttributes; delete(id: string, options?: WriteOptions): Promise<void>; delete(ids: string[], options?: WriteOptions): Promise<void>; destroy(entity: Entity): Promise<Entity>; destroy(entities: Entity[]): Promise<Entity[]>; destroyAll(): Promise<void>; performMapping(args: JSONValue, mapping: OrArray<NodeObject>, frame?: Record<string, any>, capabilityConfig?: CapabilityConfig, jsExecutionOptions?: ExecutionOptions): Promise<NodeObject>; executeTrigger(integration: string, payload: any): Promise<void>; private findTriggerCapabilityMapping; private executeCapabilityByName; private findCapabilityWithName; executeCapability(capability: Capability, capabilityArgs: JSONObject, capabilityConfig?: CapabilityConfig): Promise<OrArray<NodeObject>>; private findMappingForCapabilityContextually; executeMapping(mapping: Mapping, args: JSONObject, capabilityConfig?: CapabilityConfig, account?: Entity): Promise<OrArray<NodeObject>>; private shouldValidate; private executeOperationMapping; private executeSeriesMapping; private rdfListToArray; private executeSeriesFromList; private executeCapabilityMapping; private addPreProcessingMappingToArgs; private replaceTypeAndId; private updateEntityFromcapabilityArgs; private saveEntityOrEntitiesFromcapabilityArgs; private destroyEntityOrEntitiesFromcapabilityArgs; private countAndWrapValueFromcapabilityArgs; private existsAndWrapValueFromcapabilityArgs; findAndExecuteCapability(capabilityId: string, args: Record<string, any>, capabilityConfig?: CapabilityConfig): Promise<OrArray<NodeObject>>; private executeParallelMapping; private findCapabilityIntegrationMapping; private performOperationMappingWithArgs; private performOperation; private axiosResponseAndParamsToOperationResponse; private performReturnValueMappingWithFrameIfDefined; private performParameterMappingOnArgsIfDefined; private getDataAtReference; private getIntegrationInterface; private findSecurityCredentialsForAccountIfDefined; private findgetOpenApiRuntimeAuthorizationCapabilityIfDefined; private getRuntimeCredentialsWithSecurityCredentials; private createOpenApiOperationExecutorWithSpec; private findCapabilityObjectMapping; private performCapabilityMappingWithArgs; private assertCapabilityParamsMatchParameterSchemas; private performOpenapiOperationWithCredentials; private getHeadersFromRuntimeCredentials; private getAuthorizationHeaderFromRuntimeCredentials; private isInvalidTokenError; private refreshSecurityCredentials; private getOauthConfigurationFromSecurityCredentials; private assertCapabilityReturnValueMatchesReturnTypeSchema; private convertToQuadsAndValidateAgainstShape; private performOauthSecuritySchemeStageWithCredentials; private getDataFromDataSource; private getDataFromJsonDataSource; private getJsonDataFromSource; private throwValidationReportError; private validationReportToMessages; private ifCapabilityStreaming; private ifCapabilityBuffering; private isJavaScriptCode; private ensureNodeObject; private executeCodeBlocks; private executeJavaScriptMapping; get hooks(): typeof globalHooks; prepareContextForType(typeSpecOrId: any): Promise<Record<string, any>>; } //# sourceMappingURL=SklEngine.d.ts.map