@comake/skl-js-engine 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,6 +100,7 @@ export declare class SKLEngine implements SKLEngineInterface {
100
100
  private getIntegrationInterface;
101
101
  private findSecurityCredentialsForAccountIfDefined;
102
102
  private findgetOpenApiRuntimeAuthorizationCapabilityIfDefined;
103
+ private findRefreshCapabilityForIntegration;
103
104
  private getRuntimeCredentialsWithSecurityCredentials;
104
105
  private createOpenApiOperationExecutorWithSpec;
105
106
  private findCapabilityObjectMapping;
@@ -1 +1 @@
1
- {"version":3,"file":"SklEngine.d.ts","sourceRoot":"","sources":["../src/SklEngine.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAqB,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAgBhD,OAAO,EAAE,WAAW,EAAyB,MAAM,qBAAqB,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EAAuD,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEhH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAQlF,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAKzF,OAAO,KAAK,EAEV,UAAU,EACV,gBAAgB,EAEhB,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,EAOP,OAAO,EAGP,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAItB,oBAAY,iBAAiB,GAAG,CAAC,CAAC,SAAS,OAAO,CAAC,UAA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AO,CAAC,4CAA4C;YAOtC,kDAAkD;YAgElD,qCAAqC;YAUrC,8CAA8C;YAuC9C,qBAAqB;IAYnC,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,0BAA0B;IAgBlC,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,gBAAgB;IAwCxB,OAAO,CAAC,gBAAgB;YA2DV,iBAAiB;YAqBjB,wBAAwB;IA8CtC,IAAI,KAAK,IAAI,OAAO,WAAW,CAE9B;IAEY,qBAAqB,CAAC,YAAY,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CA+BpF"}
package/dist/SklEngine.js CHANGED
@@ -963,6 +963,22 @@ class SKLEngine {
963
963
  [constants_1.EngineConstants.prop.label]: constants_1.OPEN_API_RUNTIME_AUTHORIZATION
964
964
  }));
965
965
  }
966
+ async findRefreshCapabilityForIntegration(integrationId) {
967
+ const integration = await this.findByIfExists({ id: integrationId });
968
+ const configuredRefreshCapability = integration?.[constants_1.EngineConstants.prop.refreshCapability];
969
+ if (configuredRefreshCapability) {
970
+ const refreshCapabilityId = (0, rmlmapper_js_1.getIdFromNodeObjectIfDefined)(configuredRefreshCapability);
971
+ if (!refreshCapabilityId) {
972
+ throw new Error(`Integration ${integrationId} has an invalid refresh capability reference.`);
973
+ }
974
+ const refreshCapability = (await this.findByIfExists({ id: refreshCapabilityId }));
975
+ if (!refreshCapability) {
976
+ throw new Error(`Refresh capability ${refreshCapabilityId} configured for integration ${integrationId} was not found.`);
977
+ }
978
+ return refreshCapability;
979
+ }
980
+ return await this.findCapabilityWithName('getOauthTokens');
981
+ }
966
982
  async getRuntimeCredentialsWithSecurityCredentials(securityCredentials, integrationId, openApiOperationInformation, operationArgs) {
967
983
  const getOpenApiRuntimeAuthorizationCapability = await this.findgetOpenApiRuntimeAuthorizationCapabilityIfDefined();
968
984
  if (!getOpenApiRuntimeAuthorizationCapability) {
@@ -1081,7 +1097,7 @@ class SKLEngine {
1081
1097
  if (axios_1.default.isAxiosError(error) &&
1082
1098
  await this.isInvalidTokenError(error, integratedProductId) &&
1083
1099
  securityCredentials) {
1084
- const refreshedConfiguration = await this.refreshSecurityCredentials(securityCredentials, integratedProductId, account);
1100
+ const refreshedConfiguration = await this.refreshSecurityCredentials(securityCredentials, integratedProductId, account, capabilityConfig);
1085
1101
  response = await openApiExecutor.executeOperation(operationId, refreshedConfiguration, operationArgs, executeOperationOptions);
1086
1102
  }
1087
1103
  else {
@@ -1130,23 +1146,23 @@ class SKLEngine {
1130
1146
  return false;
1131
1147
  }
1132
1148
  async refreshSecurityCredentials(securityCredentials, integrationId, account, capabilityConfig) {
1133
- const getOauthTokenCapability = (await this.findBy({
1134
- type: constants_1.EngineConstants.spec.capability,
1135
- [constants_1.EngineConstants.prop.label]: 'getOauthTokens'
1136
- }));
1137
- const mapping = await this.findCapabilityIntegrationMapping(getOauthTokenCapability[constants_1.PROP_ENTITY_ID], integrationId);
1149
+ const refreshCapability = await this.findRefreshCapabilityForIntegration(integrationId);
1150
+ const mapping = await this.findCapabilityIntegrationMapping(refreshCapability[constants_1.PROP_ENTITY_ID], integrationId);
1138
1151
  if (!mapping) {
1139
- throw new Error(`No mapping found for capability ${getOauthTokenCapability[constants_1.PROP_ENTITY_ID]} and integration ${integrationId}`);
1152
+ throw new Error(`No mapping found for capability ${refreshCapability[constants_1.PROP_ENTITY_ID]} and integration ${integrationId}`);
1140
1153
  }
1141
1154
  const args = {
1142
1155
  refreshToken: (0, Util_1.getValueIfDefined)(securityCredentials[constants_1.EngineConstants.prop.refreshToken]),
1143
- jwtBearerOptions: (0, Util_1.getValueIfDefined)(securityCredentials[constants_1.EngineConstants.prop.jwtBearerOptions])
1156
+ jwtBearerOptions: (0, Util_1.getValueIfDefined)(securityCredentials[constants_1.EngineConstants.prop.jwtBearerOptions]),
1157
+ securityCredentials: securityCredentials,
1158
+ account: account,
1159
+ integrationId
1144
1160
  };
1145
1161
  const operationArgs = await this.performParameterMappingOnArgsIfDefined(args, mapping, capabilityConfig, true);
1146
1162
  const operationInfoJsonLd = await this.performOperationMappingWithArgs({}, mapping, capabilityConfig);
1147
1163
  const rawReturnValue = await this.performOperation(operationInfoJsonLd, operationArgs, args, account, capabilityConfig, securityCredentials);
1148
1164
  const mappedReturnValue = await this.performReturnValueMappingWithFrameIfDefined(rawReturnValue, mapping, capabilityConfig);
1149
- await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, getOauthTokenCapability);
1165
+ await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, refreshCapability);
1150
1166
  const bearerToken = (0, Util_1.getValueIfDefined)(mappedReturnValue[constants_1.EngineConstants.prop.bearerToken]);
1151
1167
  const accessToken = (0, Util_1.getValueIfDefined)(mappedReturnValue[constants_1.EngineConstants.prop.accessToken]);
1152
1168
  const refreshToken = (0, Util_1.getValueIfDefined)(mappedReturnValue[constants_1.EngineConstants.prop.refreshToken]);
@@ -1 +1 @@
1
- {"version":3,"file":"SklEngine.js","sourceRoot":"","sources":["../src/SklEngine.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,0CAA0C;;;;;;AAS1C,mFAA8E;AAC9E,uDAAmG;AAEnG,kDAA0B;AAG1B,iDAAyC;AACzC,4EAAgD;AAEhD,2CAUqB;AACrB,6DAAgE;AAChE,qDAAyE;AAGzE,qCAAkC;AAClC,6CAA0C;AAK1C,sDAAmD;AACnD,8CAA2C;AAC3C,gEAA6D;AAC7D,gDAA6C;AAC7C,oEAAiE;AACjE,kEAA+D;AAC/D,sEAAmE;AAEnE,0FAAuF;AACvF,gEAA6D;AAC7D,4DAAkF;AAuBlF,sCAA2F;AAC3F,sDAAwE;AAWxE,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAM9D,MAAa,S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C;QAExC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClD,KAAK,MAAM,QAAQ,IAAI,IAAA,kBAAW,EAAC,UAAU,CAAC,EAAE;gBAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBACnD,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC3C,IAAI,QAAQ,KAAK,iBAAK,CAAC,GAAG,EAAE;oBAC1B,OAAO,CAAC,IAAI,CAAC,GAAG;wBACd,OAAO,EAAE,KAAK;qBACf,CAAC;iBACH;qBAAM;oBACL,OAAO,CAAC,IAAI,CAAC,GAAG;wBACd,OAAO,EAAE,QAAQ;qBAClB,CAAC;iBACH;aACF;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAx3DD,8BAw3DC","sourcesContent":["/* eslint-disable no-div-regex */\n/* eslint-disable line-comment-position */\n\n/* eslint-disable no-inline-comments */\n/* eslint-disable require-unicode-regexp */\n \n \n \n/* eslint-disable @typescript-eslint/naming-convention */\nimport type { OpenApi, OpenApiClientConfiguration, OperationWithPathInfo } from '@comake/openapi-operation-executor';\nimport { OpenApiOperationExecutor } from '@comake/openapi-operation-executor';\nimport { getIdFromNodeObjectIfDefined, XSD, type ReferenceNodeObject } from '@comake/rmlmapper-js';\nimport type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport axios from 'axios';\nimport type { ContextDefinition, GraphObject, NodeObject } from 'jsonld';\nimport type { Frame } from 'jsonld/jsonld-spec';\nimport { JSONPath } from 'jsonpath-plus';\nimport SHACLValidator from 'rdf-validate-shacl';\nimport type ValidationReport from 'rdf-validate-shacl/src/validation-report';\nimport {\n EngineConstants,\n OPEN_API_RUNTIME_AUTHORIZATION,\n PROP_ENTITY_ID,\n PROP_ENTITY_TYPE,\n PROP_ENTITY_VALUE,\n RDF,\n RDFS,\n RML_LIST,\n SHACL\n} from './constants';\nimport { globalCustomCapabilities } from './customCapabilities';\nimport { globalHooks, HookStages, HookTypes } from './hooks/globalHooks';\nimport type { ExecutionOptions } from './JsExecutor';\nimport type { ICodeExecutor } from './JsExecutor/types';\nimport { Logger } from './logger';\nimport { Mapper } from './mapping/Mapper';\nimport type { ReadCacheOperation, ReadCachePolicy, ReadCacheStore, SklEngineOptions } from './SklEngineOptions';\nimport type { FindOperator } from './storage/FindOperator';\nimport type { FindAllOptions, FindOneOptions, FindOptionsWhere } from './storage/FindOptionsTypes';\nimport type { GroupByOptions, GroupByResponse } from './storage/GroupOptionTypes';\nimport { Exists } from './storage/operator/Exists';\nimport { In } from './storage/operator/In';\nimport { InversePath } from './storage/operator/InversePath';\nimport { Not } from './storage/operator/Not';\nimport { OneOrMorePath } from './storage/operator/OneOrMorePath';\nimport { SequencePath } from './storage/operator/SequencePath';\nimport { ZeroOrMorePath } from './storage/operator/ZeroOrMorePath';\nimport type { QueryAdapter, RawQueryResult } from './storage/query-adapter/QueryAdapter';\nimport { SparqlQueryAdapter } from './storage/query-adapter/sparql/SparqlQueryAdapter';\nimport { PerformanceLogger } from './util/PerformanceLogger';\nimport { buildReadCacheKey, ReadCacheSingleflight } from './util/ReadCacheHelper';\n// Import './util/safeJsonStringify';\nimport type {\n Callbacks,\n Capability,\n CapabilityConfig,\n CapabilityMapping,\n Entity,\n JSONObject,\n JSONValue,\n Mapping,\n MappingWithInputs,\n MappingWithInputsReference,\n MappingWithOutputsMapping,\n MappingWithParallel,\n MappingWithSeries,\n OperationResponse,\n OrArray,\n RdfList,\n SeriesCapabilityArgs,\n SKLEngineInterface,\n TriggerMapping\n} from './util/Types';\nimport { convertJsonLdToQuads, ensureArray, getValueIfDefined, toJSON } from './util/Util';\nimport { SKL_DATA_NAMESPACE, SKL_NAMESPACE } from './util/Vocabularies';\n\nexport type CapabilityHandler = <T extends OrArray<NodeObject> = OrArray<NodeObject>>(\n params: JSONObject,\n capabilityConfig?: CapabilityConfig\n) => Promise<T>;\nexport type CapabilityInterface = Record<string, CapabilityHandler>;\n\nexport type MappingResponseOption<T extends boolean> = T extends true ? JSONObject : NodeObject;\n\nexport type WriteOptions = { bypassHooks?: boolean };\nconst DEFAULT_READ_CACHE_TTL_MS = 60_000;\nconst READ_CACHE_ENVELOPE_MARKER = '__sklReadCacheEnvelopeV1';\ntype ReadCacheEnvelope<T> = {\n [READ_CACHE_ENVELOPE_MARKER]: true;\n value: T;\n};\n\nexport class SKLEngine implements SKLEngineInterface {\n private readonly queryAdapter: QueryAdapter;\n private readonly functions?: Record<string, (args: any | any[]) => any>;\n private readonly inputFiles?: Record<string, string>;\n private readonly globalCallbacks?: Callbacks;\n private readonly disableValidation?: boolean;\n public readonly capability: CapabilityInterface;\n private codeExecutor: ICodeExecutor | undefined;\n private readonly skdsEndpointUrl: string;\n private readonly scriptPath: string;\n private readonly logger: Logger;\n private readonly readCache?: ReadCacheStore;\n private readonly readCachePolicy?: ReadCachePolicy;\n private readonly readCacheNamespace?: string;\n private readonly readCacheSingleflight = new ReadCacheSingleflight();\n public constructor(options: SklEngineOptions) {\n this.queryAdapter = new SparqlQueryAdapter(options);\n this.disableValidation = options.disableValidation;\n this.globalCallbacks = options.callbacks;\n this.inputFiles = options.inputFiles;\n this.skdsEndpointUrl = (options as any).endpointUrl;\n this.scriptPath = (options as any).scriptPath;\n this.readCache = options.readCache;\n this.readCachePolicy = options.readCachePolicy;\n this.readCacheNamespace = options.readCacheNamespace;\n if (options.functions) {\n this.functions = Object.fromEntries(\n Object.entries(options.functions).map(([key, func]) => [\n key,\n (data: Record<string | number, any> = {}) => {\n // Add the SKL instance to the data object\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n data.skl = this;\n\n // Call the original function\n return func(data);\n }\n ])\n );\n }\n this.logger = Logger.getInstance(options.debugMode);\n\n // eslint-disable-next-line func-style\n const getCapabilityHandler =\n (getTarget: CapabilityInterface, property: string): CapabilityHandler =>\n async <T extends OrArray<NodeObject> = OrArray<NodeObject>>(\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<T> =>\n this.executeCapabilityByName(property, capabilityArgs, capabilityConfig) as Promise<T>;\n this.capability = new Proxy({} as CapabilityInterface, { get: getCapabilityHandler });\n }\n\n public setCodeExecutor(codeExecutor: ICodeExecutor): void {\n this.codeExecutor = codeExecutor;\n }\n\n public async executeRawQuery<T extends RawQueryResult>(query: string): Promise<T[]> {\n return await this.queryAdapter.executeRawQuery<T>(query);\n }\n\n public async executeRawUpdate(query: string): Promise<void> {\n return await this.queryAdapter.executeRawUpdate(query);\n }\n\n public async executeRawConstructQuery(query: string, frame?: Frame): Promise<GraphObject> {\n return await this.queryAdapter.executeRawConstructQuery(query, frame);\n }\n\n private cloneForReadCache<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return value;\n }\n }\n\n private wrapReadCacheValue<T>(value: T): ReadCacheEnvelope<T> {\n return {\n [READ_CACHE_ENVELOPE_MARKER]: true,\n value\n };\n }\n\n private isReadCacheEnvelope<T>(value: unknown): value is ReadCacheEnvelope<T> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n return (value as Record<string, unknown>)[READ_CACHE_ENVELOPE_MARKER] === true;\n }\n\n private stripBypassCacheFromFindOneOptions(options?: FindOneOptions): FindOneOptions | undefined {\n if (!options) {\n return options;\n }\n const { bypassCache, ...rest } = options;\n return rest;\n }\n\n private stripBypassCacheFromFindAllOptions(options?: FindAllOptions): FindAllOptions | undefined {\n if (!options) {\n return options;\n }\n const { bypassCache, ...rest } = options;\n return rest;\n }\n\n private stripBypassCacheFromWhere(where?: FindOptionsWhere): FindOptionsWhere | undefined {\n if (!where) {\n return where;\n }\n const { bypassCache, ...rest } = where;\n return rest;\n }\n\n private async runReadWithCache<T>(params: {\n operation: ReadCacheOperation;\n args: readonly unknown[];\n bypassCache?: boolean;\n execute: () => Promise<T>;\n }): Promise<T> {\n if (params.bypassCache) {\n return await params.execute();\n }\n\n if (!this.readCache || !this.readCachePolicy) {\n return await params.execute();\n }\n\n const policyDecision = this.readCachePolicy({\n operation: params.operation,\n args: params.args,\n endpointUrl: this.skdsEndpointUrl,\n namespace: this.readCacheNamespace\n });\n if (!policyDecision.cache) {\n return await params.execute();\n }\n\n const ttlMs = policyDecision.ttlMs ?? DEFAULT_READ_CACHE_TTL_MS;\n if (ttlMs <= 0) {\n return await params.execute();\n }\n\n const cacheKey = buildReadCacheKey({\n operation: params.operation,\n args: params.args,\n endpointUrl: this.skdsEndpointUrl,\n namespace: this.readCacheNamespace,\n keyHint: policyDecision.keyHint\n });\n\n return await this.readCacheSingleflight.do(cacheKey, async() => {\n try {\n const cached = await this.readCache?.get(cacheKey);\n if (cached !== undefined) {\n if (this.isReadCacheEnvelope<T>(cached)) {\n return this.cloneForReadCache(cached.value);\n }\n return this.cloneForReadCache(cached as T);\n }\n } catch (error) {\n this.logger.debug('Read cache lookup failed; continuing without cache', error as any);\n }\n\n const result = await params.execute();\n\n try {\n await this.readCache?.set(cacheKey, this.wrapReadCacheValue(this.cloneForReadCache(result)), ttlMs);\n } catch (error) {\n this.logger.debug('Read cache write failed; continuing without cache', error as any);\n }\n\n return result;\n });\n }\n\n public async find(options?: FindOneOptions): Promise<Entity> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindOneOptions(options);\n\n return PerformanceLogger.withSpanRoot('SklEngine.find', async() => {\n const context = {\n entities: [],\n operation: 'find',\n operationParameters: { options: optionsWithoutBypass },\n sklEngine: this\n };\n\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n\n try {\n const entity = await this.runReadWithCache({\n operation: 'find',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.find(optionsWithoutBypass)\n });\n if (!entity) {\n throw new Error(`No schema found with fields matching ${JSON.stringify(optionsWithoutBypass)}`);\n }\n\n const updatedContext = { ...context, entities: [entity]};\n const afterHookResult = await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entity);\n\n return afterHookResult || entity;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options: optionsWithoutBypass });\n }\n\n public async findBy(where: FindOptionsWhere, notFoundErrorMessage?: string): Promise<Entity> {\n const bypassCache = where?.bypassCache;\n const whereWithoutBypass = this.stripBypassCacheFromWhere(where)!;\n\n return PerformanceLogger.withSpanRoot('SklEngine.findBy', async() => {\n const context = {\n entities: [],\n operation: 'findBy',\n operationParameters: { where: whereWithoutBypass },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entity = await this.runReadWithCache({\n operation: 'findBy',\n args: [whereWithoutBypass, notFoundErrorMessage],\n bypassCache,\n execute: async() => await this.queryAdapter.findBy(whereWithoutBypass)\n });\n if (entity) {\n const updatedContext = { ...context, entities: [entity]};\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entity);\n return entity;\n }\n throw new Error(notFoundErrorMessage ?? `No schema found with fields matching ${JSON.stringify(whereWithoutBypass)}`);\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { where: whereWithoutBypass });\n }\n\n public async findByIfExists(options: FindOptionsWhere): Promise<Entity | undefined> {\n try {\n const entity = await this.findBy(options);\n return entity;\n } catch {\n return undefined;\n }\n }\n\n public async findAll(options?: FindAllOptions): Promise<Entity[]> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);\n\n return PerformanceLogger.withSpanRoot('SklEngine.findAll', async() => {\n const context = {\n entities: [],\n operation: 'findAll',\n operationParameters: { options: optionsWithoutBypass },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entities = await this.runReadWithCache({\n operation: 'findAll',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.findAll(optionsWithoutBypass)\n });\n const updatedContext = { ...context, entities };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entities);\n return entities;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options: optionsWithoutBypass });\n }\n\n public async groupBy(options: GroupByOptions): Promise<GroupByResponse> {\n return PerformanceLogger.withSpanRoot('SklEngine.groupBy', async() => {\n const context = {\n entities: [],\n operation: 'groupBy',\n operationParameters: { options },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const result = await this.queryAdapter.groupBy(options);\n const updatedContext = { ...context, result };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, result);\n return result;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options });\n }\n\n public async findAllBy(where: FindOptionsWhere): Promise<Entity[]> {\n return PerformanceLogger.withSpanRoot('SklEngine.findAllBy', async() => {\n const context = {\n entities: [],\n operation: 'findAllBy',\n operationParameters: { where },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entities = await this.queryAdapter.findAllBy(where);\n const updatedContext = { ...context, entities };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entities);\n return entities;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { where });\n }\n\n public async exists(options?: FindAllOptions): Promise<boolean> {\n return PerformanceLogger.withSpanRoot('SklEngine.exists', async() => this.queryAdapter.exists(options), { options });\n }\n\n public async count(options?: FindAllOptions): Promise<number> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);\n\n return PerformanceLogger.withSpanRoot(\n 'SklEngine.count',\n async() =>\n await this.runReadWithCache({\n operation: 'count',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.count(optionsWithoutBypass)\n }),\n { options: optionsWithoutBypass }\n );\n }\n\n public async save(entity: Entity, options?: WriteOptions): Promise<Entity>;\n public async save(entities: Entity[], options?: WriteOptions): Promise<Entity[]>;\n public async save(entityOrEntities: Entity | Entity[], options?: WriteOptions): Promise<Entity | Entity[]> {\n return PerformanceLogger.withSpanRoot('SklEngine.save', async() => {\n const entityArray = Array.isArray(entityOrEntities) ? entityOrEntities : [entityOrEntities];\n const isSingleEntity = !Array.isArray(entityOrEntities);\n\n await globalHooks.executeBeforeCreate(entityArray, { sklEngine: this, bypassHooks: options?.bypassHooks });\n\n try {\n await this.validateEntitiesConformToObjectSchema(entityArray);\n const savedEntities = await this.queryAdapter.save(entityArray);\n await globalHooks.executeAfterCreate(savedEntities, { sklEngine: this, bypassHooks: options?.bypassHooks });\n return isSingleEntity ? savedEntities[0] : savedEntities;\n } catch (error) {\n await globalHooks.executeErrorCreate(entityArray, error as Error, { sklEngine: this, bypassHooks: options?.bypassHooks });\n throw error;\n }\n }, { entityCount: Array.isArray(entityOrEntities) ? entityOrEntities.length : 1 });\n }\n\n public async update(id: string, attributes: Partial<Entity>, options?: WriteOptions): Promise<void>;\n public async update(ids: string[], attributes: Partial<Entity>, options?: WriteOptions): Promise<void>;\n public async update(idOrIds: string | string[], attributes: Partial<Entity>, options?: WriteOptions): Promise<void> {\n return PerformanceLogger.withSpanRoot('SklEngine.update', async() => {\n const idArray = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n const isSingleEntity = !Array.isArray(idOrIds);\n\n await globalHooks.execute(HookTypes.UPDATE, HookStages.BEFORE, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n\n try {\n if (idArray.length > 1) {\n await this.validateEntitiesWithIdsConformsToObjectSchemaForAttributes(idArray, attributes);\n } else {\n await this.validateEntityWithIdConformsToObjectSchemaForAttributes(idArray[0], attributes);\n }\n await this.queryAdapter.update(isSingleEntity ? idArray[0] : (idArray as any), attributes);\n\n await globalHooks.execute(HookTypes.UPDATE, HookStages.AFTER, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.UPDATE, HookStages.ERROR, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n }, error);\n throw error;\n }\n }, { idCount: Array.isArray(idOrIds) ? idOrIds.length : 1 });\n }\n\n public async validateEntitiesConformToObjectSchema(entities: Entity[]): Promise<void> {\n const entitiesByType = this.groupEntitiesByType(entities);\n for (const type of Object.keys(entitiesByType)) {\n const object = await this.findByIfExists({ id: type });\n if (object) {\n const parentObjects = await this.getSuperClassesOfObject(type);\n for (const currentObject of [object, ...parentObjects]) {\n const entitiesOfType = entitiesByType[type];\n const nounSchemaWithTarget = {\n ...currentObject,\n [SHACL.targetNode]: entitiesOfType.map(\n (entity): ReferenceNodeObject => ({ [PROP_ENTITY_ID]: entity[PROP_ENTITY_ID] })\n )\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(entitiesOfType, nounSchemaWithTarget);\n if (!report.conforms) {\n const entityIds = entitiesOfType.map((entity): string => entity[PROP_ENTITY_ID]);\n this.throwValidationReportError(\n report,\n `Entity ${entityIds.join(', ')} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n }\n\n private groupEntitiesByType(entities: Entity[]): Record<string, Entity[]> {\n return entities.reduce((groupedEntities: Record<string, Entity[]>, entity): Record<string, Entity[]> => {\n const entityTypes = Array.isArray(entity[PROP_ENTITY_TYPE])\n ? entity[PROP_ENTITY_TYPE]\n : [entity[PROP_ENTITY_TYPE]];\n for (const type of entityTypes) {\n if (!groupedEntities[type]) {\n groupedEntities[type] = [];\n }\n groupedEntities[type].push(entity);\n }\n return groupedEntities;\n }, {});\n }\n\n private async getSuperClassesOfObject(object: string): Promise<Entity[]> {\n return await this.getParentsOfSelector(object);\n }\n\n private async getSuperClassesOfObjects(nouns: string[]): Promise<Entity[]> {\n return await this.getParentsOfSelector(In(nouns));\n }\n\n private async getParentsOfSelector(selector: string | FindOperator<any, any>): Promise<Entity[]> {\n return await this.findAll({\n where: {\n id: InversePath({\n subPath: OneOrMorePath({ subPath: RDFS.subClassOf as string }),\n value: selector\n })\n }\n });\n }\n\n private async validateEntityConformsToObjectSchema(entity: Entity): Promise<void> {\n const nounIds = Array.isArray(entity[PROP_ENTITY_TYPE]) ? entity[PROP_ENTITY_TYPE] : [entity[PROP_ENTITY_TYPE]];\n const directObjects = await this.findAllBy({ id: In(nounIds) });\n if (directObjects.length > 0) {\n const existingObjectIds = directObjects.map((object): string => object[PROP_ENTITY_ID]);\n const parentObjects = await this.getSuperClassesOfObjects(existingObjectIds);\n for (const currentObject of [...directObjects, ...parentObjects]) {\n const nounSchemaWithTarget = {\n ...currentObject,\n [SHACL.targetNode]: { [PROP_ENTITY_ID]: entity[PROP_ENTITY_ID] }\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(entity, nounSchemaWithTarget);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `Entity ${entity[PROP_ENTITY_ID]} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n\n private async validateEntitiesWithIdsConformsToObjectSchemaForAttributes(\n ids: string[],\n attributes: Partial<Entity>\n ): Promise<void> {\n for (const id of ids) {\n await this.validateEntityWithIdConformsToObjectSchemaForAttributes(id, attributes);\n }\n }\n\n private async getObjectsAndParentObjectsOfEntity(id: string): Promise<Entity[]> {\n return await this.findAllBy({\n id: InversePath({\n subPath: SequencePath({\n subPath: [RDF.type, ZeroOrMorePath({ subPath: RDFS.subClassOf as string })]\n }),\n value: id\n })\n });\n }\n\n private async validateEntityWithIdConformsToObjectSchemaForAttributes(\n id: string,\n attributes: Partial<Entity>\n ): Promise<void> {\n const nouns = await this.getObjectsAndParentObjectsOfEntity(id);\n for (const currentObject of nouns) {\n if (SHACL.property in currentObject) {\n const nounProperties = ensureArray(currentObject[SHACL.property] as OrArray<NodeObject>).filter(\n (property): boolean => {\n const path = property[SHACL.path];\n if (typeof path === 'string' && path in attributes) {\n return true;\n }\n if (typeof path === 'object' && PROP_ENTITY_ID in path! && (path[PROP_ENTITY_ID] as string) in attributes) {\n return true;\n }\n return false;\n }\n );\n if (nounProperties.length > 0) {\n const nounSchemaWithTarget = {\n [PROP_ENTITY_TYPE]: SHACL.NodeShape,\n [SHACL.targetNode]: { [PROP_ENTITY_ID]: id },\n [SHACL.property]: nounProperties\n };\n const attributesWithId = { ...attributes, [PROP_ENTITY_ID]: id };\n const report = await this.convertToQuadsAndValidateAgainstShape(attributesWithId, nounSchemaWithTarget);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `Entity ${id} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n }\n\n public async delete(id: string, options?: WriteOptions): Promise<void>;\n public async delete(ids: string[], options?: WriteOptions): Promise<void>;\n public async delete(idOrIds: string | string[], options?: WriteOptions): Promise<void> {\n return PerformanceLogger.withSpanRoot('SklEngine.delete', async() => {\n const idArray = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n\n await globalHooks.execute(HookTypes.DELETE, HookStages.BEFORE, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n\n try {\n await this.queryAdapter.delete(idArray);\n\n await globalHooks.execute(HookTypes.DELETE, HookStages.AFTER, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n } catch (error) {\n await globalHooks.execute(HookTypes.DELETE, HookStages.ERROR, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n }, error);\n throw error;\n }\n }, { idCount: Array.isArray(idOrIds) ? idOrIds.length : 1 });\n }\n\n public async destroy(entity: Entity): Promise<Entity>;\n public async destroy(entities: Entity[]): Promise<Entity[]>;\n public async destroy(entityOrEntities: Entity | Entity[]): Promise<Entity | Entity[]> {\n if (Array.isArray(entityOrEntities)) {\n return await this.queryAdapter.destroy(entityOrEntities);\n }\n return await this.queryAdapter.destroy(entityOrEntities);\n }\n\n public async destroyAll(): Promise<void> {\n return await this.queryAdapter.destroyAll();\n }\n\n public async performMapping(\n args: JSONValue,\n mapping: OrArray<NodeObject>,\n frame?: Record<string, any>,\n capabilityConfig?: CapabilityConfig,\n jsExecutionOptions?: ExecutionOptions\n ): Promise<NodeObject> {\n const mappingArray = ensureArray(mapping);\n const codeBlocks = mappingArray.filter(\n (mappingItem: NodeObject): boolean =>\n mappingItem[PROP_ENTITY_TYPE] === EngineConstants.spec.codeBlock &&\n this.isJavaScriptCode(getValueIfDefined(mappingItem[EngineConstants.prop.codeBody])!)\n );\n // FIXME: Handle if we can combine the codeb blocks with triples map.\n // As of now if there is any code block, triples map does not get executed.\n if (codeBlocks.length > 0) {\n return await this.executeCodeBlocks(codeBlocks, args, jsExecutionOptions ?? {});\n }\n\n const functions = {\n ...this.functions,\n ...capabilityConfig?.functions\n };\n const mapper = new Mapper({ functions });\n return await mapper.apply(args, mapping, frame ?? {});\n }\n\n public async executeTrigger(integration: string, payload: any): Promise<void> {\n const triggerToCapabilityMapping = await this.findTriggerCapabilityMapping(integration);\n const capabilityArgs = await this.performParameterMappingOnArgsIfDefined(\n payload,\n triggerToCapabilityMapping as Partial<MappingWithInputs> | Partial<MappingWithInputsReference>\n );\n const capabilityId = await this.performCapabilityMappingWithArgs(payload, triggerToCapabilityMapping);\n if (capabilityId) {\n const mappedCapability = (await this.findBy({ id: capabilityId })) as Capability;\n await this.executeCapability(mappedCapability, capabilityArgs);\n }\n }\n\n private async findTriggerCapabilityMapping(integration: string): Promise<TriggerMapping> {\n const triggerCapabilityMappingNew = (await this.findBy(\n {\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: integration,\n [EngineConstants.prop.capabilityType]: EngineConstants.spec.triggerCapabilityMapping\n },\n `Failed to find a Trigger Capability mapping for integration ${integration}`\n )) as TriggerMapping;\n if (triggerCapabilityMappingNew) {\n return triggerCapabilityMappingNew;\n }\n throw new Error(`Failed to find a Trigger Capability mapping for integration ${integration}`);\n }\n\n private async executeCapabilityByName(\n capabilityName: string,\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capability = await this.findCapabilityWithName(capabilityName);\n return await this.executeCapability(capability, capabilityArgs, capabilityConfig);\n }\n\n private async findCapabilityWithName(capabilityName: string): Promise<Capability> {\n return (await this.findBy(\n { type: EngineConstants.spec.capability, [EngineConstants.prop.label]: capabilityName },\n `Failed to find the capability ${capabilityName} in the schema.`\n )) as Capability;\n }\n\n public async executeCapability(\n capability: Capability,\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n this.globalCallbacks?.onCapabilityStart?.(capability[PROP_ENTITY_ID], capabilityArgs);\n if (capabilityConfig?.callbacks?.onCapabilityStart) {\n this.logger.debug('Capability arguments', capabilityArgs);\n capabilityConfig.callbacks.onCapabilityStart(capability[PROP_ENTITY_ID], capabilityArgs);\n }\n const { mapping, account } = await this.findMappingForCapabilityContextually(\n capability[PROP_ENTITY_ID],\n capabilityArgs\n );\n this.logger.debug('Mapping', JSON.stringify(mapping));\n const shouldValidate = this.shouldValidate(capabilityConfig);\n if (shouldValidate) {\n await this.assertCapabilityParamsMatchParameterSchemas(capabilityArgs, capability);\n }\n\n try {\n // Execute capability mapping before hook if appropriate -\n // works for any mapping that can be used as a verb mapping\n if (mapping) {\n await globalHooks.executeBeforeExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, { sklEngine: this });\n }\n\n const verbReturnValue = await this.executeMapping(mapping, capabilityArgs, capabilityConfig, account);\n\n if (shouldValidate) {\n await this.assertCapabilityReturnValueMatchesReturnTypeSchema(verbReturnValue, capability);\n }\n\n // Execute capability mapping after hook if appropriate\n if (mapping) {\n await globalHooks.executeAfterExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, verbReturnValue, { sklEngine: this });\n }\n\n this.globalCallbacks?.onCapabilityEnd?.(capability[PROP_ENTITY_ID], verbReturnValue);\n if (capabilityConfig?.callbacks?.onCapabilityEnd) {\n capabilityConfig.callbacks.onCapabilityEnd(capability[PROP_ENTITY_ID], verbReturnValue);\n }\n\n return verbReturnValue;\n } catch (error) {\n // Execute capability mapping error hook if appropriate\n if (mapping) {\n await globalHooks.executeErrorExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, error as Error, { sklEngine: this });\n }\n throw error;\n }\n }\n\n private async findMappingForCapabilityContextually(\n capabilityId: string,\n args: JSONObject\n ): Promise<{ mapping: CapabilityMapping; account?: Entity }> {\n if (args.mapping) {\n const mapping = await this.findByIfExists({ id: args.mapping as string });\n if (!mapping) {\n throw new Error(`Mapping ${args.mapping as string} not found.`);\n }\n return { mapping: mapping as CapabilityMapping };\n }\n if (args.object) {\n const mapping = await this.findCapabilityObjectMapping(capabilityId, args.object as string);\n if (mapping) {\n return { mapping };\n }\n }\n if (args.account) {\n const account = await this.findBy({ id: args.account as string });\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const mapping = await this.findCapabilityIntegrationMapping(capabilityId, integratedProductId);\n if (mapping) {\n return { mapping, account };\n }\n }\n\n const mappings = await this.findAllBy({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.integration]: Not(Exists()),\n [EngineConstants.prop.object]: Not(Exists())\n });\n if (mappings.length === 1) {\n return { mapping: mappings[0] as CapabilityMapping };\n }\n if (mappings.length > 1) {\n throw new Error('Multiple mappings found for capability, please specify one.');\n }\n if (args.object) {\n throw new Error(`Mapping between object ${args.object as string} and capability ${capabilityId} not found.`);\n }\n if (args.account) {\n throw new Error(`Mapping between account ${args.account as string} and capability ${capabilityId} not found.`);\n }\n throw new Error(`No mapping found.`);\n }\n\n public async executeMapping(\n mapping: Mapping,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig,\n account?: Entity\n ): Promise<OrArray<NodeObject>> {\n args = await this.addPreProcessingMappingToArgs(mapping, args, capabilityConfig);\n let returnValue: OrArray<NodeObject>;\n // If (EngineConstants.prop.capability in mapping || EngineConstants.prop.capabilityMapping in mapping) {\n // const capabilityId = await this.performCapabilityMappingWithArgs(args, mapping, capabilityConfig);\n // const mappedArgs = await this.performParameterMappingOnArgsIfDefined(\n // { ...args, capabilityId },\n // mapping as MappingWithInputs,\n // capabilityConfig\n // );\n // Logger.getInstance().log('Mapped args', mappedArgs);\n // returnValue = await this.executeCapabilityMapping(mapping, args, mappedArgs, capabilityConfig);\n // } else {\n const mappedArgs = await this.performParameterMappingOnArgsIfDefined(\n args,\n mapping as MappingWithInputs,\n capabilityConfig\n );\n this.logger.debug('Mapped args', mappedArgs);\n if (EngineConstants.prop.operationId in mapping || EngineConstants.prop.operationMapping in mapping) {\n returnValue = (await this.executeOperationMapping(\n mapping,\n mappedArgs,\n args,\n account!,\n capabilityConfig\n )) as NodeObject;\n } else if (EngineConstants.prop.series in mapping) {\n returnValue = await this.executeSeriesMapping(mapping as MappingWithSeries, mappedArgs, capabilityConfig);\n } else if (EngineConstants.prop.parallel in mapping) {\n returnValue = await this.executeParallelMapping(mapping as MappingWithParallel, mappedArgs, capabilityConfig);\n } else {\n returnValue = mappedArgs;\n }\n // }\n return await this.performReturnValueMappingWithFrameIfDefined(\n returnValue as JSONValue,\n mapping as MappingWithOutputsMapping,\n capabilityConfig\n );\n }\n\n private shouldValidate(capabilityConfig?: CapabilityConfig): boolean {\n return capabilityConfig?.disableValidation === undefined\n ? this.disableValidation !== true\n : !capabilityConfig.disableValidation;\n }\n\n private async executeOperationMapping(\n mapping: Mapping,\n mappedArgs: JSONObject,\n originalArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<OperationResponse | OrArray<NodeObject>> {\n const integration = (mapping as CapabilityMapping)[EngineConstants.prop.integration]?.[PROP_ENTITY_ID];\n\n // If the mapping has an integration, it means that the operation is an integration operation\n if (integration) {\n const operationInfo = await this.performOperationMappingWithArgs(originalArgs, mapping, capabilityConfig);\n const response = await this.performOperation(operationInfo, mappedArgs, originalArgs, account, capabilityConfig);\n if (!this.ifCapabilityStreaming(capabilityConfig)) {\n this.logger.debug('Original response', JSON.stringify(response));\n }\n return response;\n }\n // If the mapping does not have an integration, it means that the operation is a capability operation\n return await this.executeCapabilityMapping(mapping, originalArgs, mappedArgs, capabilityConfig);\n }\n\n private async executeSeriesMapping(\n mapping: MappingWithSeries,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const seriesCapabilityMappingsList = this.rdfListToArray(mapping[EngineConstants.prop.series]!);\n const seriesCapabilityArgs = {\n originalCapabilityParameters: args,\n previousCapabilityReturnValue: {},\n allStepsResults: []\n };\n\n return await this.executeSeriesFromList(seriesCapabilityMappingsList, seriesCapabilityArgs, capabilityConfig);\n }\n\n private rdfListToArray(list: { [RML_LIST]: CapabilityMapping[] } | RdfList<CapabilityMapping>): CapabilityMapping[] {\n if (!(RML_LIST in list)) {\n return [\n list[RDF.first],\n ...getIdFromNodeObjectIfDefined(list[RDF.rest] as ReferenceNodeObject) === RDF.nil\n ? []\n : this.rdfListToArray(list[RDF.rest] as RdfList<CapabilityMapping>)\n ];\n }\n return list[RML_LIST];\n }\n\n private async executeSeriesFromList(\n list: Mapping[],\n args: SeriesCapabilityArgs,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const nextCapabilityMapping = list[0];\n const returnValue = await this.executeMapping(nextCapabilityMapping, args, capabilityConfig);\n if (list.length > 1) {\n return await this.executeSeriesFromList(\n list.slice(1),\n {\n ...args,\n previousCapabilityReturnValue: returnValue as JSONObject,\n allStepsResults: [...args.allStepsResults ?? [], returnValue as JSONObject]\n },\n capabilityConfig\n );\n }\n return returnValue;\n }\n\n private async executeCapabilityMapping(\n capabilityMapping: Mapping,\n originalArgs: JSONObject,\n mappedArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capabilityId = await this.performCapabilityMappingWithArgs(originalArgs, capabilityMapping, capabilityConfig);\n if (capabilityId) {\n if (capabilityId === EngineConstants.dataSource.update) {\n await this.updateEntityFromcapabilityArgs(mappedArgs);\n return {};\n }\n if (capabilityId === EngineConstants.dataSource.save) {\n return await this.saveEntityOrEntitiesFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.destroy) {\n return await this.destroyEntityOrEntitiesFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.findAll) {\n return await this.findAll(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.find) {\n return await this.find(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.count) {\n return await this.countAndWrapValueFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.exists) {\n return await this.existsAndWrapValueFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === 'https://skl.ai/capability/execute-code') {\n const codeBlocks = ensureArray((capabilityMapping[EngineConstants.prop.codeBlocks] as any[]) ?? []).filter(\n (mappingItem: any): boolean =>\n mappingItem[PROP_ENTITY_TYPE] === EngineConstants.spec.codeBlock &&\n this.isJavaScriptCode(getValueIfDefined(mappingItem[EngineConstants.prop.codeBody])!)\n );\n return await this.executeCodeBlocks(codeBlocks, mappedArgs, {});\n }\n\n // Check for custom capabilities\n if (globalCustomCapabilities.has(capabilityId)) {\n return await globalCustomCapabilities.execute(capabilityId, mappedArgs, this, capabilityConfig);\n }\n\n return await this.findAndExecuteCapability(capabilityId, mappedArgs, capabilityConfig);\n }\n return {};\n }\n\n private async addPreProcessingMappingToArgs(\n capabilityMapping: Mapping,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<JSONObject> {\n if (EngineConstants.prop.preProcessingMapping in capabilityMapping) {\n const preMappingArgs = await this.performMapping(\n args,\n capabilityMapping[EngineConstants.prop.preProcessingMapping] as NodeObject,\n getValueIfDefined(capabilityMapping[EngineConstants.prop.preProcessingMappingFrame]),\n capabilityConfig\n );\n return { ...args, preProcessedParameters: preMappingArgs as JSONObject };\n }\n return args;\n }\n\n private replaceTypeAndId(entity: Record<string, any>): Record<string, any> {\n if (typeof entity !== 'object') {\n throw new Error('Entity is not an object');\n }\n const clonedEntity = structuredClone(entity);\n if (clonedEntity[EngineConstants.prop.type]) {\n clonedEntity[PROP_ENTITY_TYPE] = clonedEntity[EngineConstants.prop.type];\n }\n if (clonedEntity[EngineConstants.prop.identifier]) {\n clonedEntity[PROP_ENTITY_ID] = SKL_DATA_NAMESPACE + (clonedEntity[EngineConstants.prop.identifier] as string);\n }\n return clonedEntity;\n }\n\n private async updateEntityFromcapabilityArgs(args: Record<string, any>): Promise<void> {\n let ids = args.id ?? args.ids;\n if (!Array.isArray(ids)) {\n ids = [ids];\n }\n // FIX: Temporary fix for the issue where the id always getting prefixed with the namespace\n ids = ids.map((id: string) => (id.startsWith('http') ? id : `${SKL_DATA_NAMESPACE}${id}`));\n await this.update(ids, args.attributes);\n }\n\n private async saveEntityOrEntitiesFromcapabilityArgs(args: Record<string, any>): Promise<OrArray<Entity>> {\n if (args.entity && typeof args.entity === 'object') {\n args.entity = this.replaceTypeAndId(args.entity);\n }\n if (args.entities && Array.isArray(args.entities)) {\n args.entities = args.entities.map(this.replaceTypeAndId);\n }\n return await this.save(args.entity ?? args.entities);\n }\n\n private async destroyEntityOrEntitiesFromcapabilityArgs(args: Record<string, any>): Promise<OrArray<Entity>> {\n if (args.entity && typeof args.entity === 'object') {\n args.entity = this.replaceTypeAndId(args.entity);\n }\n if (args.entities && Array.isArray(args.entities)) {\n args.entities = args.entities.map(this.replaceTypeAndId);\n }\n return await this.destroy(args.entity ?? args.entities);\n }\n\n private async countAndWrapValueFromcapabilityArgs(args: Record<string, any>): Promise<NodeObject> {\n const count = await this.count(args);\n return {\n [EngineConstants.dataSource.countResult]: {\n [PROP_ENTITY_VALUE]: count,\n [PROP_ENTITY_TYPE]: XSD.integer\n }\n };\n }\n\n private async existsAndWrapValueFromcapabilityArgs(args: Record<string, any>): Promise<NodeObject> {\n const exists = await this.exists(args);\n return {\n [EngineConstants.dataSource.existsResult]: {\n [PROP_ENTITY_VALUE]: exists,\n [PROP_ENTITY_TYPE]: XSD.boolean\n }\n };\n }\n\n public async findAndExecuteCapability(\n capabilityId: string,\n args: Record<string, any>,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capability = (await this.findBy({ id: capabilityId })) as Capability;\n return await this.executeCapability(capability, args, capabilityConfig);\n }\n\n private async executeParallelMapping(\n mapping: MappingWithParallel,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject[]> {\n const parallelCapabilityMappings = ensureArray(\n mapping[EngineConstants.prop.parallel] as unknown as OrArray<CapabilityMapping>\n );\n const nestedReturnValues = await Promise.all<Promise<OrArray<NodeObject>>>(\n parallelCapabilityMappings.map(\n (capabilityMapping): Promise<OrArray<NodeObject>> =>\n this.executeMapping(capabilityMapping, args, capabilityConfig)\n )\n );\n return nestedReturnValues.flat();\n }\n\n private async findCapabilityIntegrationMapping(\n capabilityId: string,\n integratedProductId: string\n ): Promise<CapabilityMapping | undefined> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.integration]: integratedProductId\n })) as CapabilityMapping;\n }\n\n private async performOperationMappingWithArgs(\n args: JSONValue,\n mapping: Mapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject> {\n if (mapping[EngineConstants.prop.operationId]) {\n return { [EngineConstants.prop.operationId]: mapping[EngineConstants.prop.operationId] };\n }\n if (mapping[EngineConstants.prop.dataSource]) {\n return { [EngineConstants.prop.dataSource]: mapping[EngineConstants.prop.dataSource] };\n }\n return await this.performMapping(\n args,\n mapping[EngineConstants.prop.operationMapping] as OrArray<NodeObject>,\n undefined,\n capabilityConfig\n );\n }\n\n private async performOperation(\n operationInfo: NodeObject,\n operationArgs: JSONObject,\n originalArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig,\n securityCredentials?: Entity\n ): Promise<OperationResponse> {\n if (operationInfo[EngineConstants.prop.schemeName]) {\n return await this.performOauthSecuritySchemeStageWithCredentials(\n operationInfo,\n operationArgs,\n account,\n securityCredentials\n );\n }\n if (operationInfo[EngineConstants.prop.dataSource]) {\n return await this.getDataFromDataSource(\n getIdFromNodeObjectIfDefined(operationInfo[EngineConstants.prop.dataSource] as string | ReferenceNodeObject)!,\n capabilityConfig\n );\n }\n if (operationInfo[EngineConstants.prop.operationId]) {\n const response = await this.performOpenapiOperationWithCredentials(\n getValueIfDefined(operationInfo[EngineConstants.prop.operationId])!,\n operationArgs,\n account,\n capabilityConfig\n );\n return this.axiosResponseAndParamsToOperationResponse(response, operationArgs, originalArgs);\n }\n throw new Error('Operation not supported.');\n }\n\n private axiosResponseAndParamsToOperationResponse(\n response: AxiosResponse,\n operationParameters: JSONObject,\n originalArgs: JSONObject\n ): OperationResponse {\n return {\n operationParameters,\n originalCapabilityParameters: originalArgs,\n data: response.data,\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n config: {\n headers: response.config.headers,\n method: response.config.method,\n url: response.config.url,\n data: response.config.data\n } as JSONObject\n };\n }\n\n private async performReturnValueMappingWithFrameIfDefined(\n returnValue: JSONValue,\n mapping: MappingWithOutputsMapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject> {\n if (EngineConstants.prop.outputsMapping in mapping) {\n return await this.performMapping(\n returnValue,\n mapping[EngineConstants.prop.outputsMapping],\n getValueIfDefined<JSONObject>(mapping[EngineConstants.prop.outputsMappingFrame]),\n capabilityConfig\n );\n }\n return returnValue as NodeObject;\n }\n\n private async performParameterMappingOnArgsIfDefined(\n args: JSONObject,\n mapping: Partial<MappingWithInputs> | Partial<MappingWithInputsReference>,\n capabilityConfig?: CapabilityConfig,\n convertToJsonDeep = false\n ): Promise<Record<string, any>> {\n if (EngineConstants.prop.inputsReference in mapping) {\n const reference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsReference])!;\n return this.getDataAtReference(reference, args);\n }\n\n if (EngineConstants.prop.inputsMappingRef in mapping) {\n const reference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsMappingRef])!;\n const referencedMapping = this.getDataAtReference(reference, args);\n\n if (!referencedMapping || referencedMapping?.length === 0) {\n return args;\n }\n\n // Handle inputsMappingFrameRef if present\n let frame;\n if (EngineConstants.prop.inputsMappingFrameRef in mapping) {\n const frameReference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsMappingFrameRef])!;\n frame = this.getDataAtReference(frameReference, args);\n } else {\n // Use direct frame if provided\n frame = getValueIfDefined(mapping[EngineConstants.prop.inputsMappingFrame]);\n }\n\n // Perform mapping with the referenced mapping and frame\n const mappedData = await this.performMapping(args, referencedMapping, frame, capabilityConfig);\n return toJSON(mappedData, convertToJsonDeep);\n }\n\n if (EngineConstants.prop.inputsMapping in mapping) {\n const mappedData = await this.performMapping(\n args,\n (mapping as MappingWithInputs)[EngineConstants.prop.inputsMapping]!,\n getValueIfDefined(mapping[EngineConstants.prop.inputsMappingFrame]),\n capabilityConfig\n );\n return toJSON(mappedData, convertToJsonDeep);\n }\n return args;\n }\n\n private getDataAtReference(reference: string, data: JSONObject): any {\n const results = JSONPath({\n path: reference,\n json: data,\n resultType: 'value'\n });\n const isArrayOfLengthOne = Array.isArray(results) && results.length === 1;\n let result = isArrayOfLengthOne ? results[0] : results;\n if (result && typeof result === 'object' && PROP_ENTITY_VALUE in result) {\n result = result[PROP_ENTITY_VALUE];\n }\n return result;\n }\n\n private async getIntegrationInterface(\n integratedProductId: string,\n integrationType = EngineConstants.spec.integrationInterface\n ): Promise<Entity | null> {\n if (integrationType === EngineConstants.spec.integrationInterface) {\n const integrationInterface = await this.findBy({\n type: integrationType,\n [EngineConstants.prop.type]: EngineConstants.spec.openApi,\n [EngineConstants.prop.integration]: integratedProductId\n });\n return integrationInterface;\n }\n // Add support for other integration types\n return null;\n }\n\n private async findSecurityCredentialsForAccountIfDefined(accountId: string): Promise<Entity | undefined> {\n return await this.findByIfExists({\n type: EngineConstants.spec.integrationAuthenticationCredential,\n [EngineConstants.prop.accountOrUser]: accountId\n });\n }\n\n private async findgetOpenApiRuntimeAuthorizationCapabilityIfDefined(): Promise<Capability | undefined> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capability,\n [EngineConstants.prop.label]: OPEN_API_RUNTIME_AUTHORIZATION\n })) as Capability;\n }\n\n private async getRuntimeCredentialsWithSecurityCredentials(\n securityCredentials: Entity,\n integrationId: string,\n openApiOperationInformation: OperationWithPathInfo,\n operationArgs: JSONObject\n ): Promise<JSONObject> {\n const getOpenApiRuntimeAuthorizationCapability = await this.findgetOpenApiRuntimeAuthorizationCapabilityIfDefined();\n if (!getOpenApiRuntimeAuthorizationCapability) {\n return {};\n }\n const mapping = await this.findCapabilityIntegrationMapping(\n getOpenApiRuntimeAuthorizationCapability[PROP_ENTITY_ID],\n integrationId\n );\n if (!mapping) {\n return {};\n }\n const args = {\n securityCredentials,\n openApiExecutorOperationWithPathInfo: openApiOperationInformation,\n operationArgs\n } as JSONObject;\n const operationInfoJsonLd = await this.performParameterMappingOnArgsIfDefined(args, mapping, undefined, true);\n const headers = getValueIfDefined<JSONObject>(operationInfoJsonLd[EngineConstants.prop.headers]);\n return headers ?? {};\n }\n\n private async createOpenApiOperationExecutorWithSpec(openApiDescription: OpenApi): Promise<OpenApiOperationExecutor> {\n const executor = new OpenApiOperationExecutor();\n await executor.setOpenapiSpec(openApiDescription);\n return executor;\n }\n\n private async findCapabilityObjectMapping(capabilityId: string, object: string): Promise<CapabilityMapping> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.object]: InversePath({\n subPath: ZeroOrMorePath({ subPath: RDFS.subClassOf as string }),\n value: object\n })\n })) as CapabilityMapping;\n }\n\n private async performCapabilityMappingWithArgs(\n args: JSONValue,\n mapping: Mapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<string | undefined> {\n if (mapping[EngineConstants.prop.operationId]) {\n return getValueIfDefined<string>(mapping[EngineConstants.prop.operationId])!;\n }\n if (mapping[EngineConstants.prop.operationId]) {\n return getValueIfDefined<string>(mapping[EngineConstants.prop.operationId])!;\n }\n const capabilityInfoJsonLd = await this.performMapping(\n args,\n mapping[EngineConstants.prop.operationMapping] as NodeObject,\n undefined,\n capabilityConfig\n );\n return getValueIfDefined<string>(capabilityInfoJsonLd[EngineConstants.prop.operationId])!;\n }\n\n private async assertCapabilityParamsMatchParameterSchemas(\n capabilityParams: any,\n capability: Capability\n ): Promise<void> {\n let parametersSchemaObject = capability[EngineConstants.prop.inputs];\n if (parametersSchemaObject?.[PROP_ENTITY_ID] && Object.keys(parametersSchemaObject).length === 1) {\n parametersSchemaObject = await this.findBy({ id: parametersSchemaObject[PROP_ENTITY_ID] });\n }\n if (capabilityParams && parametersSchemaObject) {\n const capabilityParamsAsJsonLd = {\n '@context': getValueIfDefined<ContextDefinition>(capability[EngineConstants.prop.inputsContext]),\n [PROP_ENTITY_TYPE]: EngineConstants.spec.inputs,\n ...capabilityParams\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(capabilityParamsAsJsonLd, parametersSchemaObject);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `${getValueIfDefined(capability[EngineConstants.prop.label])} parameters do not conform to the schema`\n );\n }\n }\n }\n\n private async performOpenapiOperationWithCredentials(\n operationId: string,\n operationArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<AxiosResponse> {\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const restAPIInterface = await this.getIntegrationInterface(integratedProductId);\n if (!restAPIInterface) {\n throw new Error(`No integration interface found for integrated product ${integratedProductId}`);\n }\n const openApiDescription = getValueIfDefined<OpenApi>(\n restAPIInterface[EngineConstants.prop.declarativeApiDescription]\n )!;\n const openApiExecutor = await this.createOpenApiOperationExecutorWithSpec(openApiDescription);\n // eslint-disable-next-line @typescript-eslint/await-thenable\n const openApiOperationInformation = await openApiExecutor.getOperationWithPathInfoMatchingOperationId(operationId);\n const securityCredentials = await this.findSecurityCredentialsForAccountIfDefined(account[PROP_ENTITY_ID]);\n let runtimeAuthorization: JSONObject = {};\n if (securityCredentials) {\n const generatedRuntimeCredentials = await this.getRuntimeCredentialsWithSecurityCredentials(\n securityCredentials,\n integratedProductId,\n openApiOperationInformation,\n operationArgs\n );\n if (generatedRuntimeCredentials && Object.keys(generatedRuntimeCredentials).length > 0) {\n runtimeAuthorization = generatedRuntimeCredentials;\n }\n }\n const apiKey = [\n getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.apiKey]),\n this.getAuthorizationHeaderFromRuntimeCredentials(runtimeAuthorization)\n ].find(Boolean);\n const configuration = {\n accessToken: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.accessToken]),\n bearerToken: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.bearerToken]),\n apiKey,\n basePath: getValueIfDefined<string>(account[EngineConstants.prop.overrideBasePath]),\n username: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.username]),\n password: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.password])\n };\n let response;\n let executeOperationOptions: AxiosRequestConfig | undefined;\n try {\n const additionalHeaders = this.getHeadersFromRuntimeCredentials(runtimeAuthorization) as any;\n if (\n additionalHeaders &&\n typeof additionalHeaders === 'object' &&\n !Array.isArray(additionalHeaders) &&\n Object.keys(additionalHeaders).length > 0\n ) {\n executeOperationOptions = { headers: additionalHeaders };\n }\n if (this.ifCapabilityStreaming(capabilityConfig)) {\n executeOperationOptions = {\n ...executeOperationOptions,\n responseType: 'stream'\n };\n } else if (this.ifCapabilityBuffering(capabilityConfig)) {\n executeOperationOptions = {\n ...executeOperationOptions,\n responseType: 'arraybuffer'\n };\n }\n response = await openApiExecutor.executeOperation(\n operationId,\n configuration,\n operationArgs,\n executeOperationOptions\n );\n } catch (error: unknown) {\n if (\n axios.isAxiosError(error) &&\n await this.isInvalidTokenError(error, integratedProductId) &&\n securityCredentials\n ) {\n const refreshedConfiguration = await this.refreshSecurityCredentials(\n securityCredentials,\n integratedProductId,\n account\n );\n response = await openApiExecutor.executeOperation(\n operationId,\n refreshedConfiguration,\n operationArgs,\n executeOperationOptions\n );\n } else {\n throw error;\n }\n }\n return response;\n }\n\n private getHeadersFromRuntimeCredentials(runtimeCredentials: JSONObject): JSONObject {\n let returnValue: JSONObject = {};\n if (\n runtimeCredentials.headers &&\n typeof runtimeCredentials.headers === 'object' &&\n Object.keys(runtimeCredentials.headers).length > 0 &&\n !Array.isArray(runtimeCredentials.headers)\n ) {\n returnValue = runtimeCredentials.headers;\n }\n return returnValue;\n }\n\n private getAuthorizationHeaderFromRuntimeCredentials(runtimeCredentials: JSONObject): string | undefined {\n const headers = this.getHeadersFromRuntimeCredentials(runtimeCredentials);\n if (headers && 'Authorization' in headers) {\n const authorizationHeader = headers.Authorization;\n if (typeof authorizationHeader === 'string') {\n return authorizationHeader;\n }\n }\n return undefined;\n }\n\n private async isInvalidTokenError(error: AxiosError, integratedProductId: string): Promise<boolean> {\n const integrationInterface = await this.getIntegrationInterface(integratedProductId);\n if (!integrationInterface) {\n return false;\n }\n\n const errorMatcher = integrationInterface[EngineConstants.prop.invalidTokenErrorMatcher] as NodeObject;\n const errorMatcherStatus =\n errorMatcher && getValueIfDefined<string>(errorMatcher[EngineConstants.prop.invalidTokenErrorMatcherStatus]);\n const errorMatcherRegex =\n errorMatcher &&\n getValueIfDefined<string>(errorMatcher[EngineConstants.prop.invalidTokenErrorMatcherMessageRegex])!;\n if (errorMatcher && error.response?.status === errorMatcherStatus) {\n if (!errorMatcherRegex) {\n return true;\n }\n if (error.response?.statusText && new RegExp(errorMatcherRegex, 'u').test(error.response?.statusText)) {\n return true;\n }\n }\n\n return false;\n }\n\n private async refreshSecurityCredentials(\n securityCredentials: Entity,\n integrationId: string,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<OpenApiClientConfiguration> {\n const getOauthTokenCapability = (await this.findBy({\n type: EngineConstants.spec.capability,\n [EngineConstants.prop.label]: 'getOauthTokens'\n })) as Capability;\n const mapping = await this.findCapabilityIntegrationMapping(getOauthTokenCapability[PROP_ENTITY_ID], integrationId);\n if (!mapping) {\n throw new Error(\n `No mapping found for capability ${getOauthTokenCapability[PROP_ENTITY_ID]} and integration ${integrationId}`\n );\n }\n const args = {\n refreshToken: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.refreshToken])!,\n jwtBearerOptions: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.jwtBearerOptions])!\n };\n const operationArgs = await this.performParameterMappingOnArgsIfDefined(args, mapping, capabilityConfig, true);\n const operationInfoJsonLd = await this.performOperationMappingWithArgs({}, mapping, capabilityConfig);\n const rawReturnValue = await this.performOperation(\n operationInfoJsonLd,\n operationArgs,\n args,\n account,\n capabilityConfig,\n securityCredentials\n );\n const mappedReturnValue = await this.performReturnValueMappingWithFrameIfDefined(\n rawReturnValue,\n mapping as MappingWithOutputsMapping,\n capabilityConfig\n );\n await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, getOauthTokenCapability);\n const bearerToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.bearerToken]);\n const accessToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.accessToken]);\n const refreshToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.refreshToken]);\n if (bearerToken) {\n securityCredentials[EngineConstants.prop.bearerToken] = bearerToken;\n }\n if (accessToken) {\n securityCredentials[EngineConstants.prop.accessToken] = accessToken;\n }\n if (refreshToken) {\n securityCredentials[EngineConstants.prop.refreshToken] = refreshToken;\n }\n await this.save(securityCredentials);\n return { accessToken, bearerToken };\n }\n\n private getOauthConfigurationFromSecurityCredentials(securityCredentialsSchema: Entity): OpenApiClientConfiguration {\n const username = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.username]);\n const password = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.password]);\n const accessToken = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.accessToken]);\n return { username, password, accessToken };\n }\n\n private async assertCapabilityReturnValueMatchesReturnTypeSchema(\n returnValue: OrArray<NodeObject>,\n capability: Capability\n ): Promise<void> {\n let returnTypeSchemaObject = capability[EngineConstants.prop.outputs];\n if (returnTypeSchemaObject?.[PROP_ENTITY_ID] && Object.keys(returnTypeSchemaObject).length === 1) {\n returnTypeSchemaObject = await this.findBy({ id: returnTypeSchemaObject[PROP_ENTITY_ID] });\n }\n let report: ValidationReport | undefined;\n if (returnValue && returnTypeSchemaObject) {\n if (Array.isArray(returnValue)) {\n if (returnValue.some((valueItem): boolean => PROP_ENTITY_ID in valueItem)) {\n returnTypeSchemaObject[SHACL.targetNode] = returnValue.reduce(\n (nodes: ReferenceNodeObject[], outputItem): ReferenceNodeObject[] => {\n if (outputItem[PROP_ENTITY_ID]) {\n nodes.push({ [PROP_ENTITY_ID]: outputItem[PROP_ENTITY_ID] });\n }\n return nodes;\n },\n []\n );\n } else {\n const targetClasses = returnValue.reduce(\n (nodes: ReferenceNodeObject[], outputItem): ReferenceNodeObject[] => {\n if (outputItem[PROP_ENTITY_TYPE]) {\n const type = Array.isArray(outputItem[PROP_ENTITY_TYPE])\n ? outputItem[PROP_ENTITY_TYPE][0]\n : outputItem[PROP_ENTITY_TYPE];\n if (!nodes.includes({ [PROP_ENTITY_ID]: type })) {\n nodes.push({ [PROP_ENTITY_ID]: type });\n }\n }\n return nodes;\n },\n []\n );\n if (targetClasses.length > 0) {\n returnTypeSchemaObject[SHACL.targetClass] = targetClasses;\n }\n }\n report = await this.convertToQuadsAndValidateAgainstShape(returnValue, returnTypeSchemaObject);\n } else if (Object.keys(returnValue).length > 0) {\n if (returnValue[PROP_ENTITY_ID]) {\n returnTypeSchemaObject[SHACL.targetNode] = { [PROP_ENTITY_ID]: returnValue[PROP_ENTITY_ID] };\n } else if (returnValue[PROP_ENTITY_TYPE]) {\n returnTypeSchemaObject[SHACL.targetClass] = {\n [PROP_ENTITY_ID]: Array.isArray(returnValue[PROP_ENTITY_TYPE])\n ? returnValue[PROP_ENTITY_TYPE][0]\n : returnValue[PROP_ENTITY_TYPE]!\n };\n }\n report = await this.convertToQuadsAndValidateAgainstShape(returnValue, returnTypeSchemaObject);\n }\n }\n\n if (report && !report?.conforms) {\n throw new Error(\n `Return value ${\n Array.isArray(returnValue) ? 'array' : returnValue[PROP_ENTITY_ID]\n } does not conform to the schema`\n );\n }\n }\n\n private async convertToQuadsAndValidateAgainstShape(\n value: OrArray<NodeObject>,\n shape: NodeObject\n ): Promise<ValidationReport> {\n const valueAsQuads = await convertJsonLdToQuads(Array.isArray(value) ? value : [value]);\n const shapeQuads = await convertJsonLdToQuads(shape);\n const validator = new SHACLValidator(shapeQuads);\n return validator.validate(valueAsQuads);\n }\n\n private async performOauthSecuritySchemeStageWithCredentials(\n operationInfo: NodeObject,\n operationParameters: JSONObject,\n account: Entity,\n securityCredentials?: Entity\n ): Promise<OperationResponse> {\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const restAPIInterface = await this.getIntegrationInterface(integratedProductId);\n if (!restAPIInterface) {\n throw new Error(`No integration interface found for integrated product ${integratedProductId}`);\n }\n const openApiDescription = getValueIfDefined<OpenApi>(\n restAPIInterface[EngineConstants.prop.declarativeApiDescription]\n )!;\n securityCredentials ||= await this.findSecurityCredentialsForAccountIfDefined(account[PROP_ENTITY_ID]);\n let configuration: OpenApiClientConfiguration;\n if (securityCredentials) {\n configuration = this.getOauthConfigurationFromSecurityCredentials(securityCredentials);\n operationParameters.client_id = getValueIfDefined<string>(securityCredentials[EngineConstants.prop.username])!;\n } else {\n configuration = {};\n }\n const openApiExecutor = await this.createOpenApiOperationExecutorWithSpec(openApiDescription);\n const response = await openApiExecutor.executeSecuritySchemeStage(\n getValueIfDefined(operationInfo[EngineConstants.prop.schemeName])!,\n getValueIfDefined(operationInfo[EngineConstants.prop.oauthFlow])!,\n getValueIfDefined(operationInfo[EngineConstants.prop.stage])!,\n configuration,\n operationParameters\n );\n if ('codeVerifier' in response && 'authorizationUrl' in response) {\n return {\n data: response as unknown as JSONObject,\n operationParameters\n };\n }\n return this.axiosResponseAndParamsToOperationResponse(response, operationParameters, operationParameters);\n }\n\n private async getDataFromDataSource(\n dataSourceId: string,\n capabilityConfig?: CapabilityConfig\n ): Promise<OperationResponse> {\n const dataSource = await this.findBy({ id: dataSourceId });\n if (dataSource[PROP_ENTITY_TYPE] === EngineConstants.spec.jsonDataSource) {\n const data = this.getDataFromJsonDataSource(dataSource, capabilityConfig);\n return { data, operationParameters: {}};\n }\n throw new Error(`DataSource type ${dataSource[PROP_ENTITY_TYPE]} is not supported.`);\n }\n\n private getDataFromJsonDataSource(dataSource: NodeObject, capabilityConfig?: CapabilityConfig): JSONObject {\n if (dataSource[EngineConstants.prop.source]) {\n const sourceValue = getValueIfDefined<string>(dataSource[EngineConstants.prop.source])!;\n return this.getJsonDataFromSource(sourceValue, capabilityConfig);\n }\n return getValueIfDefined<JSONObject>(dataSource[EngineConstants.prop.data])!;\n }\n\n private getJsonDataFromSource(source: string, capabilityConfig?: CapabilityConfig): JSONObject {\n const inputFiles = {\n ...this.inputFiles,\n ...capabilityConfig?.inputFiles\n };\n if (source in inputFiles) {\n const file = inputFiles[source];\n if (typeof file === 'string') {\n return JSON.parse(file);\n }\n return file;\n }\n // eslint-disable-next-line unicorn/expiring-todo-comments\n // TODO add support for remote sources\n throw new Error(`Failed to get data from source ${source}`);\n }\n\n private throwValidationReportError(report: ValidationReport, errorMessage: string): void {\n const reportMessages = this.validationReportToMessages(report);\n throw new Error(`${errorMessage}\\n\\n${reportMessages.join('\\n')}`);\n }\n\n private validationReportToMessages(report: ValidationReport): string[] {\n const reportMessages = [];\n for (const result of report.results) {\n const pathValue = result.path?.value;\n if (result.message.length === 0) {\n const message = `${pathValue}: Invalid due to ${result.sourceConstraintComponent?.value}`;\n reportMessages.push(message);\n } else {\n const resultMessages = result.message.map((message): string => `${message.value}`).join(', ');\n const message = `${pathValue}: ${resultMessages}`;\n reportMessages.push(message);\n }\n }\n return reportMessages;\n }\n\n private ifCapabilityStreaming(capabilityConfig?: CapabilityConfig): boolean {\n return Boolean(capabilityConfig && 'stream' in capabilityConfig && capabilityConfig.stream);\n }\n\n private ifCapabilityBuffering(capabilityConfig?: CapabilityConfig): boolean {\n return Boolean(capabilityConfig && 'buffer' in capabilityConfig && capabilityConfig.buffer);\n }\n\n private isJavaScriptCode(text: string): boolean {\n if (!text) {\n return false;\n }\n // Trim the text to handle leading/trailing whitespace\n const trimmed = text.trim();\n\n // First, quickly check if it looks like JSON (starts with { or [)\n const looksLikeJson = /^\\s*[[{]/.test(trimmed) && /[\\]}]\\s*$/.test(trimmed);\n\n if (looksLikeJson) {\n try {\n // If it can be parsed as JSON, it's likely an RML mapping\n JSON.parse(trimmed);\n return false;\n } catch {\n // If it looks like JSON but can't be parsed, it might be code\n // Continue with other checks\n }\n }\n\n // Check for common JavaScript patterns that wouldn't appear in JSON\n const jsPatterns = [\n /function\\s+[$A-Z_a-z][\\w$]*\\s*\\(/, // Function declaration\n /const\\s+[$A-Z_a-z][\\w$]*/, // Const declaration\n /let\\s+[$A-Z_a-z][\\w$]*/, // Let declaration\n /var\\s+[$A-Z_a-z][\\w$]*/, // Var declaration\n /if\\s*\\(/, // If statement\n /for\\s*\\(/, // For loop\n /while\\s*\\(/, // While loop\n /=>|return |console\\./, // Arrow functions, return statements, console usage\n /import\\s+|export\\s+/, // ES6 imports/exports\n /class\\s+[$A-Z_a-z][\\w$]*/, // Class declaration\n /\\/\\/|\\/\\*|\\*\\// // Comments\n ];\n\n // If it matches any JS pattern, it's likely code\n return jsPatterns.some(pattern => pattern.test(trimmed));\n }\n\n private ensureNodeObject(result: any): NodeObject {\n // Handle null/undefined results\n if (result === null || result === undefined) {\n return {};\n }\n\n // If it's already a NodeObject with proper formatting, return as is\n if (\n typeof result === 'object' &&\n !Array.isArray(result) &&\n (result[PROP_ENTITY_ID] !== undefined ||\n result[PROP_ENTITY_TYPE] !== undefined ||\n result['@context'] !== undefined ||\n result['@graph'] !== undefined)\n ) {\n return result as NodeObject;\n }\n\n // Handle arrays - convert to @graph\n if (Array.isArray(result)) {\n // Check if items in array are already objects\n const convertedItems = result.map(item => {\n if (typeof item === 'object' && item !== null) {\n // Already object, but ensure it has @type if not present\n if (!item[PROP_ENTITY_TYPE] && !item[PROP_ENTITY_ID] && !item[PROP_ENTITY_VALUE]) {\n return { [PROP_ENTITY_TYPE]: 'skl:Result', ...item };\n }\n return item;\n }\n // Convert primitives to objects with @value\n return { [PROP_ENTITY_VALUE]: item };\n });\n\n return {\n '@context': {\n skl: SKL_NAMESPACE\n },\n '@graph': convertedItems\n };\n }\n\n // Handle primitive values (string, number, boolean)\n if (typeof result !== 'object') {\n return {\n [PROP_ENTITY_VALUE]: result\n };\n }\n\n // Handle plain objects (not arrays, not null)\n // If it's a plain object but not in NodeObject format, add @type\n return {\n [PROP_ENTITY_TYPE]: 'skl:Result',\n '@context': {\n skl: SKL_NAMESPACE\n },\n ...result\n };\n }\n\n private async executeCodeBlocks(\n codeBlocks: NodeObject[],\n args: JSONValue,\n executionOptions: ExecutionOptions\n ): Promise<NodeObject> {\n const results = [];\n let updatedArgs = (args as Record<string, any>) || {};\n for (const codeBlock of codeBlocks) {\n const code = getValueIfDefined(codeBlock[EngineConstants.prop.codeBody])!;\n if (code) {\n const result = await this.executeJavaScriptMapping(updatedArgs, code as string, executionOptions);\n updatedArgs = {\n ...updatedArgs,\n ...result\n };\n results.push(result);\n }\n }\n return results.length > 0 ? results[results.length - 1] : {};\n }\n\n private async executeJavaScriptMapping(\n args: JSONValue,\n code: string,\n _executionOptions: ExecutionOptions\n ): Promise<NodeObject> {\n try {\n // Configure execution options\n const executionOptions: ExecutionOptions = {\n timeout: 60 * 60 * 1000, // 1 hour\n functionName: 'main',\n allowNetwork: true,\n allowedDomains: [],\n allowEnv: true,\n debugMode: true,\n allowRead: true,\n ..._executionOptions\n };\n\n if (!this.codeExecutor) {\n throw new Error('Code executor not set. Please set a code executor using setCodeExecutor()');\n }\n\n // Execute the code\n const executionResult = await this.codeExecutor.execute(code, args as Record<string, any>, executionOptions);\n\n // Handle execution errors\n if (executionResult?.error) {\n throw new Error(`Code execution error: ${executionResult.error?.message ?? 'Unknown error'}`);\n }\n\n // This is a patch to return the output as it is without converting to NodeObject\n // This is needed for some api inputs. We can try doing this using the frame.\n if (executionResult?.result?.rawOutput) {\n return executionResult?.result?.rawOutput;\n }\n // Convert the result to a NodeObject\n return this.ensureNodeObject(executionResult?.result ?? executionResult);\n } catch (error: unknown) {\n throw new Error(\n `Failed to execute JavaScript mapping: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n // Expose global hooks to users\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n get hooks(): typeof globalHooks {\n return globalHooks;\n }\n\n public async prepareContextForType(typeSpecOrId: any): Promise<Record<string, any>> {\n const typeSpecs = [];\n if (typeof typeSpecOrId === 'string') {\n typeSpecs.push(\n await this.getSuperClassesOfObject(typeSpecOrId),\n await this.findBy({ id: typeSpecOrId })\n );\n } else {\n typeSpecs.push(typeSpecOrId);\n }\n const context: Record<string, any> = {};\n\n for (const typeSpec of typeSpecs) {\n const properties = typeSpec[SHACL.property] ?? [];\n for (const property of ensureArray(properties)) {\n const dataType = property[SHACL.datatype]?.['@id'];\n const nodeKind = property[SHACL.nodeKind]?.['@id'];\n const path = property[SHACL.path]?.['@id'];\n if (nodeKind === SHACL.IRI) {\n context[path] = {\n '@type': '@id'\n };\n } else {\n context[path] = {\n '@type': dataType\n };\n }\n }\n }\n return context;\n }\n}\n"]}
1
+ {"version":3,"file":"SklEngine.js","sourceRoot":"","sources":["../src/SklEngine.ts"],"names":[],"mappings":";AAAA,iCAAiC;AACjC,0CAA0C;;;;;;AAS1C,mFAA8E;AAC9E,uDAAmG;AAEnG,kDAA0B;AAG1B,iDAAyC;AACzC,4EAAgD;AAEhD,2CAUqB;AACrB,6DAAgE;AAChE,qDAAyE;AAGzE,qCAAkC;AAClC,6CAA0C;AAK1C,sDAAmD;AACnD,8CAA2C;AAC3C,gEAA6D;AAC7D,gDAA6C;AAC7C,oEAAiE;AACjE,kEAA+D;AAC/D,sEAAmE;AAEnE,0FAAuF;AACvF,gEAA6D;AAC7D,4DAAkF;AAuBlF,sCAA2F;AAC3F,sDAAwE;AAWxE,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAM9D,MAAa,SAAS;IAepB,YAAmB,OAAyB;QAD3B,0BAAqB,GAAG,IAAI,uCAAqB,EAAE,CAAC;QAEnE,IAAI,CAAC,YAAY,GAAG,IAAI,uCAAkB,CAAC,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,eAAe,GAAI,OAAe,CAAC,WAAW,CAAC;QACpD,IAAI,CAAC,UAAU,GAAI,OAAe,CAAC,UAAU,CAAC;QAC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;QACrB,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE;YACpC,SAAS,CAAC,IAAI,CACZ,MAAM,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,EAChD,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,CACxC,CAAC;SACH;aAAM;YACL,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SAC9B;QACD,MAAM,OAAO,GAAwB,EAAE,CAAC;QAExC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;YAChC,MAAM,UAAU,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClD,KAAK,MAAM,QAAQ,IAAI,IAAA,kBAAW,EAAC,UAAU,CAAC,EAAE;gBAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBACnD,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBACnD,MAAM,IAAI,GAAG,QAAQ,CAAC,iBAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC3C,IAAI,QAAQ,KAAK,iBAAK,CAAC,GAAG,EAAE;oBAC1B,OAAO,CAAC,IAAI,CAAC,GAAG;wBACd,OAAO,EAAE,KAAK;qBACf,CAAC;iBACH;qBAAM;oBACL,OAAO,CAAC,IAAI,CAAC,GAAG;wBACd,OAAO,EAAE,QAAQ;qBAClB,CAAC;iBACH;aACF;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA94DD,8BA84DC","sourcesContent":["/* eslint-disable no-div-regex */\n/* eslint-disable line-comment-position */\n\n/* eslint-disable no-inline-comments */\n/* eslint-disable require-unicode-regexp */\n \n \n \n/* eslint-disable @typescript-eslint/naming-convention */\nimport type { OpenApi, OpenApiClientConfiguration, OperationWithPathInfo } from '@comake/openapi-operation-executor';\nimport { OpenApiOperationExecutor } from '@comake/openapi-operation-executor';\nimport { getIdFromNodeObjectIfDefined, XSD, type ReferenceNodeObject } from '@comake/rmlmapper-js';\nimport type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport axios from 'axios';\nimport type { ContextDefinition, GraphObject, NodeObject } from 'jsonld';\nimport type { Frame } from 'jsonld/jsonld-spec';\nimport { JSONPath } from 'jsonpath-plus';\nimport SHACLValidator from 'rdf-validate-shacl';\nimport type ValidationReport from 'rdf-validate-shacl/src/validation-report';\nimport {\n EngineConstants,\n OPEN_API_RUNTIME_AUTHORIZATION,\n PROP_ENTITY_ID,\n PROP_ENTITY_TYPE,\n PROP_ENTITY_VALUE,\n RDF,\n RDFS,\n RML_LIST,\n SHACL\n} from './constants';\nimport { globalCustomCapabilities } from './customCapabilities';\nimport { globalHooks, HookStages, HookTypes } from './hooks/globalHooks';\nimport type { ExecutionOptions } from './JsExecutor';\nimport type { ICodeExecutor } from './JsExecutor/types';\nimport { Logger } from './logger';\nimport { Mapper } from './mapping/Mapper';\nimport type { ReadCacheOperation, ReadCachePolicy, ReadCacheStore, SklEngineOptions } from './SklEngineOptions';\nimport type { FindOperator } from './storage/FindOperator';\nimport type { FindAllOptions, FindOneOptions, FindOptionsWhere } from './storage/FindOptionsTypes';\nimport type { GroupByOptions, GroupByResponse } from './storage/GroupOptionTypes';\nimport { Exists } from './storage/operator/Exists';\nimport { In } from './storage/operator/In';\nimport { InversePath } from './storage/operator/InversePath';\nimport { Not } from './storage/operator/Not';\nimport { OneOrMorePath } from './storage/operator/OneOrMorePath';\nimport { SequencePath } from './storage/operator/SequencePath';\nimport { ZeroOrMorePath } from './storage/operator/ZeroOrMorePath';\nimport type { QueryAdapter, RawQueryResult } from './storage/query-adapter/QueryAdapter';\nimport { SparqlQueryAdapter } from './storage/query-adapter/sparql/SparqlQueryAdapter';\nimport { PerformanceLogger } from './util/PerformanceLogger';\nimport { buildReadCacheKey, ReadCacheSingleflight } from './util/ReadCacheHelper';\n// Import './util/safeJsonStringify';\nimport type {\n Callbacks,\n Capability,\n CapabilityConfig,\n CapabilityMapping,\n Entity,\n JSONObject,\n JSONValue,\n Mapping,\n MappingWithInputs,\n MappingWithInputsReference,\n MappingWithOutputsMapping,\n MappingWithParallel,\n MappingWithSeries,\n OperationResponse,\n OrArray,\n RdfList,\n SeriesCapabilityArgs,\n SKLEngineInterface,\n TriggerMapping\n} from './util/Types';\nimport { convertJsonLdToQuads, ensureArray, getValueIfDefined, toJSON } from './util/Util';\nimport { SKL_DATA_NAMESPACE, SKL_NAMESPACE } from './util/Vocabularies';\n\nexport type CapabilityHandler = <T extends OrArray<NodeObject> = OrArray<NodeObject>>(\n params: JSONObject,\n capabilityConfig?: CapabilityConfig\n) => Promise<T>;\nexport type CapabilityInterface = Record<string, CapabilityHandler>;\n\nexport type MappingResponseOption<T extends boolean> = T extends true ? JSONObject : NodeObject;\n\nexport type WriteOptions = { bypassHooks?: boolean };\nconst DEFAULT_READ_CACHE_TTL_MS = 60_000;\nconst READ_CACHE_ENVELOPE_MARKER = '__sklReadCacheEnvelopeV1';\ntype ReadCacheEnvelope<T> = {\n [READ_CACHE_ENVELOPE_MARKER]: true;\n value: T;\n};\n\nexport class SKLEngine implements SKLEngineInterface {\n private readonly queryAdapter: QueryAdapter;\n private readonly functions?: Record<string, (args: any | any[]) => any>;\n private readonly inputFiles?: Record<string, string>;\n private readonly globalCallbacks?: Callbacks;\n private readonly disableValidation?: boolean;\n public readonly capability: CapabilityInterface;\n private codeExecutor: ICodeExecutor | undefined;\n private readonly skdsEndpointUrl: string;\n private readonly scriptPath: string;\n private readonly logger: Logger;\n private readonly readCache?: ReadCacheStore;\n private readonly readCachePolicy?: ReadCachePolicy;\n private readonly readCacheNamespace?: string;\n private readonly readCacheSingleflight = new ReadCacheSingleflight();\n public constructor(options: SklEngineOptions) {\n this.queryAdapter = new SparqlQueryAdapter(options);\n this.disableValidation = options.disableValidation;\n this.globalCallbacks = options.callbacks;\n this.inputFiles = options.inputFiles;\n this.skdsEndpointUrl = (options as any).endpointUrl;\n this.scriptPath = (options as any).scriptPath;\n this.readCache = options.readCache;\n this.readCachePolicy = options.readCachePolicy;\n this.readCacheNamespace = options.readCacheNamespace;\n if (options.functions) {\n this.functions = Object.fromEntries(\n Object.entries(options.functions).map(([key, func]) => [\n key,\n (data: Record<string | number, any> = {}) => {\n // Add the SKL instance to the data object\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n data.skl = this;\n\n // Call the original function\n return func(data);\n }\n ])\n );\n }\n this.logger = Logger.getInstance(options.debugMode);\n\n // eslint-disable-next-line func-style\n const getCapabilityHandler =\n (getTarget: CapabilityInterface, property: string): CapabilityHandler =>\n async <T extends OrArray<NodeObject> = OrArray<NodeObject>>(\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<T> =>\n this.executeCapabilityByName(property, capabilityArgs, capabilityConfig) as Promise<T>;\n this.capability = new Proxy({} as CapabilityInterface, { get: getCapabilityHandler });\n }\n\n public setCodeExecutor(codeExecutor: ICodeExecutor): void {\n this.codeExecutor = codeExecutor;\n }\n\n public async executeRawQuery<T extends RawQueryResult>(query: string): Promise<T[]> {\n return await this.queryAdapter.executeRawQuery<T>(query);\n }\n\n public async executeRawUpdate(query: string): Promise<void> {\n return await this.queryAdapter.executeRawUpdate(query);\n }\n\n public async executeRawConstructQuery(query: string, frame?: Frame): Promise<GraphObject> {\n return await this.queryAdapter.executeRawConstructQuery(query, frame);\n }\n\n private cloneForReadCache<T>(value: T): T {\n try {\n return structuredClone(value);\n } catch {\n return value;\n }\n }\n\n private wrapReadCacheValue<T>(value: T): ReadCacheEnvelope<T> {\n return {\n [READ_CACHE_ENVELOPE_MARKER]: true,\n value\n };\n }\n\n private isReadCacheEnvelope<T>(value: unknown): value is ReadCacheEnvelope<T> {\n if (!value || typeof value !== 'object') {\n return false;\n }\n return (value as Record<string, unknown>)[READ_CACHE_ENVELOPE_MARKER] === true;\n }\n\n private stripBypassCacheFromFindOneOptions(options?: FindOneOptions): FindOneOptions | undefined {\n if (!options) {\n return options;\n }\n const { bypassCache, ...rest } = options;\n return rest;\n }\n\n private stripBypassCacheFromFindAllOptions(options?: FindAllOptions): FindAllOptions | undefined {\n if (!options) {\n return options;\n }\n const { bypassCache, ...rest } = options;\n return rest;\n }\n\n private stripBypassCacheFromWhere(where?: FindOptionsWhere): FindOptionsWhere | undefined {\n if (!where) {\n return where;\n }\n const { bypassCache, ...rest } = where;\n return rest;\n }\n\n private async runReadWithCache<T>(params: {\n operation: ReadCacheOperation;\n args: readonly unknown[];\n bypassCache?: boolean;\n execute: () => Promise<T>;\n }): Promise<T> {\n if (params.bypassCache) {\n return await params.execute();\n }\n\n if (!this.readCache || !this.readCachePolicy) {\n return await params.execute();\n }\n\n const policyDecision = this.readCachePolicy({\n operation: params.operation,\n args: params.args,\n endpointUrl: this.skdsEndpointUrl,\n namespace: this.readCacheNamespace\n });\n if (!policyDecision.cache) {\n return await params.execute();\n }\n\n const ttlMs = policyDecision.ttlMs ?? DEFAULT_READ_CACHE_TTL_MS;\n if (ttlMs <= 0) {\n return await params.execute();\n }\n\n const cacheKey = buildReadCacheKey({\n operation: params.operation,\n args: params.args,\n endpointUrl: this.skdsEndpointUrl,\n namespace: this.readCacheNamespace,\n keyHint: policyDecision.keyHint\n });\n\n return await this.readCacheSingleflight.do(cacheKey, async() => {\n try {\n const cached = await this.readCache?.get(cacheKey);\n if (cached !== undefined) {\n if (this.isReadCacheEnvelope<T>(cached)) {\n return this.cloneForReadCache(cached.value);\n }\n return this.cloneForReadCache(cached as T);\n }\n } catch (error) {\n this.logger.debug('Read cache lookup failed; continuing without cache', error as any);\n }\n\n const result = await params.execute();\n\n try {\n await this.readCache?.set(cacheKey, this.wrapReadCacheValue(this.cloneForReadCache(result)), ttlMs);\n } catch (error) {\n this.logger.debug('Read cache write failed; continuing without cache', error as any);\n }\n\n return result;\n });\n }\n\n public async find(options?: FindOneOptions): Promise<Entity> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindOneOptions(options);\n\n return PerformanceLogger.withSpanRoot('SklEngine.find', async() => {\n const context = {\n entities: [],\n operation: 'find',\n operationParameters: { options: optionsWithoutBypass },\n sklEngine: this\n };\n\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n\n try {\n const entity = await this.runReadWithCache({\n operation: 'find',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.find(optionsWithoutBypass)\n });\n if (!entity) {\n throw new Error(`No schema found with fields matching ${JSON.stringify(optionsWithoutBypass)}`);\n }\n\n const updatedContext = { ...context, entities: [entity]};\n const afterHookResult = await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entity);\n\n return afterHookResult || entity;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options: optionsWithoutBypass });\n }\n\n public async findBy(where: FindOptionsWhere, notFoundErrorMessage?: string): Promise<Entity> {\n const bypassCache = where?.bypassCache;\n const whereWithoutBypass = this.stripBypassCacheFromWhere(where)!;\n\n return PerformanceLogger.withSpanRoot('SklEngine.findBy', async() => {\n const context = {\n entities: [],\n operation: 'findBy',\n operationParameters: { where: whereWithoutBypass },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entity = await this.runReadWithCache({\n operation: 'findBy',\n args: [whereWithoutBypass, notFoundErrorMessage],\n bypassCache,\n execute: async() => await this.queryAdapter.findBy(whereWithoutBypass)\n });\n if (entity) {\n const updatedContext = { ...context, entities: [entity]};\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entity);\n return entity;\n }\n throw new Error(notFoundErrorMessage ?? `No schema found with fields matching ${JSON.stringify(whereWithoutBypass)}`);\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { where: whereWithoutBypass });\n }\n\n public async findByIfExists(options: FindOptionsWhere): Promise<Entity | undefined> {\n try {\n const entity = await this.findBy(options);\n return entity;\n } catch {\n return undefined;\n }\n }\n\n public async findAll(options?: FindAllOptions): Promise<Entity[]> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);\n\n return PerformanceLogger.withSpanRoot('SklEngine.findAll', async() => {\n const context = {\n entities: [],\n operation: 'findAll',\n operationParameters: { options: optionsWithoutBypass },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entities = await this.runReadWithCache({\n operation: 'findAll',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.findAll(optionsWithoutBypass)\n });\n const updatedContext = { ...context, entities };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entities);\n return entities;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options: optionsWithoutBypass });\n }\n\n public async groupBy(options: GroupByOptions): Promise<GroupByResponse> {\n return PerformanceLogger.withSpanRoot('SklEngine.groupBy', async() => {\n const context = {\n entities: [],\n operation: 'groupBy',\n operationParameters: { options },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const result = await this.queryAdapter.groupBy(options);\n const updatedContext = { ...context, result };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, result);\n return result;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { options });\n }\n\n public async findAllBy(where: FindOptionsWhere): Promise<Entity[]> {\n return PerformanceLogger.withSpanRoot('SklEngine.findAllBy', async() => {\n const context = {\n entities: [],\n operation: 'findAllBy',\n operationParameters: { where },\n sklEngine: this\n };\n await globalHooks.execute(HookTypes.READ, HookStages.BEFORE, context);\n try {\n const entities = await this.queryAdapter.findAllBy(where);\n const updatedContext = { ...context, entities };\n await globalHooks.execute(HookTypes.READ, HookStages.AFTER, updatedContext, entities);\n return entities;\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.READ, HookStages.ERROR, context, error);\n throw error;\n }\n }, { where });\n }\n\n public async exists(options?: FindAllOptions): Promise<boolean> {\n return PerformanceLogger.withSpanRoot('SklEngine.exists', async() => this.queryAdapter.exists(options), { options });\n }\n\n public async count(options?: FindAllOptions): Promise<number> {\n const bypassCache = options?.bypassCache;\n const optionsWithoutBypass = this.stripBypassCacheFromFindAllOptions(options);\n\n return PerformanceLogger.withSpanRoot(\n 'SklEngine.count',\n async() =>\n await this.runReadWithCache({\n operation: 'count',\n args: [optionsWithoutBypass],\n bypassCache,\n execute: async() => await this.queryAdapter.count(optionsWithoutBypass)\n }),\n { options: optionsWithoutBypass }\n );\n }\n\n public async save(entity: Entity, options?: WriteOptions): Promise<Entity>;\n public async save(entities: Entity[], options?: WriteOptions): Promise<Entity[]>;\n public async save(entityOrEntities: Entity | Entity[], options?: WriteOptions): Promise<Entity | Entity[]> {\n return PerformanceLogger.withSpanRoot('SklEngine.save', async() => {\n const entityArray = Array.isArray(entityOrEntities) ? entityOrEntities : [entityOrEntities];\n const isSingleEntity = !Array.isArray(entityOrEntities);\n\n await globalHooks.executeBeforeCreate(entityArray, { sklEngine: this, bypassHooks: options?.bypassHooks });\n\n try {\n await this.validateEntitiesConformToObjectSchema(entityArray);\n const savedEntities = await this.queryAdapter.save(entityArray);\n await globalHooks.executeAfterCreate(savedEntities, { sklEngine: this, bypassHooks: options?.bypassHooks });\n return isSingleEntity ? savedEntities[0] : savedEntities;\n } catch (error) {\n await globalHooks.executeErrorCreate(entityArray, error as Error, { sklEngine: this, bypassHooks: options?.bypassHooks });\n throw error;\n }\n }, { entityCount: Array.isArray(entityOrEntities) ? entityOrEntities.length : 1 });\n }\n\n public async update(id: string, attributes: Partial<Entity>, options?: WriteOptions): Promise<void>;\n public async update(ids: string[], attributes: Partial<Entity>, options?: WriteOptions): Promise<void>;\n public async update(idOrIds: string | string[], attributes: Partial<Entity>, options?: WriteOptions): Promise<void> {\n return PerformanceLogger.withSpanRoot('SklEngine.update', async() => {\n const idArray = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n const isSingleEntity = !Array.isArray(idOrIds);\n\n await globalHooks.execute(HookTypes.UPDATE, HookStages.BEFORE, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n\n try {\n if (idArray.length > 1) {\n await this.validateEntitiesWithIdsConformsToObjectSchemaForAttributes(idArray, attributes);\n } else {\n await this.validateEntityWithIdConformsToObjectSchemaForAttributes(idArray[0], attributes);\n }\n await this.queryAdapter.update(isSingleEntity ? idArray[0] : (idArray as any), attributes);\n\n await globalHooks.execute(HookTypes.UPDATE, HookStages.AFTER, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n } catch (error: unknown) {\n await globalHooks.execute(HookTypes.UPDATE, HookStages.ERROR, {\n entities: [],\n operation: 'update',\n operationParameters: { idArray, attributes },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n }, error);\n throw error;\n }\n }, { idCount: Array.isArray(idOrIds) ? idOrIds.length : 1 });\n }\n\n public async validateEntitiesConformToObjectSchema(entities: Entity[]): Promise<void> {\n const entitiesByType = this.groupEntitiesByType(entities);\n for (const type of Object.keys(entitiesByType)) {\n const object = await this.findByIfExists({ id: type });\n if (object) {\n const parentObjects = await this.getSuperClassesOfObject(type);\n for (const currentObject of [object, ...parentObjects]) {\n const entitiesOfType = entitiesByType[type];\n const nounSchemaWithTarget = {\n ...currentObject,\n [SHACL.targetNode]: entitiesOfType.map(\n (entity): ReferenceNodeObject => ({ [PROP_ENTITY_ID]: entity[PROP_ENTITY_ID] })\n )\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(entitiesOfType, nounSchemaWithTarget);\n if (!report.conforms) {\n const entityIds = entitiesOfType.map((entity): string => entity[PROP_ENTITY_ID]);\n this.throwValidationReportError(\n report,\n `Entity ${entityIds.join(', ')} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n }\n\n private groupEntitiesByType(entities: Entity[]): Record<string, Entity[]> {\n return entities.reduce((groupedEntities: Record<string, Entity[]>, entity): Record<string, Entity[]> => {\n const entityTypes = Array.isArray(entity[PROP_ENTITY_TYPE])\n ? entity[PROP_ENTITY_TYPE]\n : [entity[PROP_ENTITY_TYPE]];\n for (const type of entityTypes) {\n if (!groupedEntities[type]) {\n groupedEntities[type] = [];\n }\n groupedEntities[type].push(entity);\n }\n return groupedEntities;\n }, {});\n }\n\n private async getSuperClassesOfObject(object: string): Promise<Entity[]> {\n return await this.getParentsOfSelector(object);\n }\n\n private async getSuperClassesOfObjects(nouns: string[]): Promise<Entity[]> {\n return await this.getParentsOfSelector(In(nouns));\n }\n\n private async getParentsOfSelector(selector: string | FindOperator<any, any>): Promise<Entity[]> {\n return await this.findAll({\n where: {\n id: InversePath({\n subPath: OneOrMorePath({ subPath: RDFS.subClassOf as string }),\n value: selector\n })\n }\n });\n }\n\n private async validateEntityConformsToObjectSchema(entity: Entity): Promise<void> {\n const nounIds = Array.isArray(entity[PROP_ENTITY_TYPE]) ? entity[PROP_ENTITY_TYPE] : [entity[PROP_ENTITY_TYPE]];\n const directObjects = await this.findAllBy({ id: In(nounIds) });\n if (directObjects.length > 0) {\n const existingObjectIds = directObjects.map((object): string => object[PROP_ENTITY_ID]);\n const parentObjects = await this.getSuperClassesOfObjects(existingObjectIds);\n for (const currentObject of [...directObjects, ...parentObjects]) {\n const nounSchemaWithTarget = {\n ...currentObject,\n [SHACL.targetNode]: { [PROP_ENTITY_ID]: entity[PROP_ENTITY_ID] }\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(entity, nounSchemaWithTarget);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `Entity ${entity[PROP_ENTITY_ID]} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n\n private async validateEntitiesWithIdsConformsToObjectSchemaForAttributes(\n ids: string[],\n attributes: Partial<Entity>\n ): Promise<void> {\n for (const id of ids) {\n await this.validateEntityWithIdConformsToObjectSchemaForAttributes(id, attributes);\n }\n }\n\n private async getObjectsAndParentObjectsOfEntity(id: string): Promise<Entity[]> {\n return await this.findAllBy({\n id: InversePath({\n subPath: SequencePath({\n subPath: [RDF.type, ZeroOrMorePath({ subPath: RDFS.subClassOf as string })]\n }),\n value: id\n })\n });\n }\n\n private async validateEntityWithIdConformsToObjectSchemaForAttributes(\n id: string,\n attributes: Partial<Entity>\n ): Promise<void> {\n const nouns = await this.getObjectsAndParentObjectsOfEntity(id);\n for (const currentObject of nouns) {\n if (SHACL.property in currentObject) {\n const nounProperties = ensureArray(currentObject[SHACL.property] as OrArray<NodeObject>).filter(\n (property): boolean => {\n const path = property[SHACL.path];\n if (typeof path === 'string' && path in attributes) {\n return true;\n }\n if (typeof path === 'object' && PROP_ENTITY_ID in path! && (path[PROP_ENTITY_ID] as string) in attributes) {\n return true;\n }\n return false;\n }\n );\n if (nounProperties.length > 0) {\n const nounSchemaWithTarget = {\n [PROP_ENTITY_TYPE]: SHACL.NodeShape,\n [SHACL.targetNode]: { [PROP_ENTITY_ID]: id },\n [SHACL.property]: nounProperties\n };\n const attributesWithId = { ...attributes, [PROP_ENTITY_ID]: id };\n const report = await this.convertToQuadsAndValidateAgainstShape(attributesWithId, nounSchemaWithTarget);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `Entity ${id} does not conform to the ${currentObject[PROP_ENTITY_ID]} schema.`\n );\n }\n }\n }\n }\n }\n\n public async delete(id: string, options?: WriteOptions): Promise<void>;\n public async delete(ids: string[], options?: WriteOptions): Promise<void>;\n public async delete(idOrIds: string | string[], options?: WriteOptions): Promise<void> {\n return PerformanceLogger.withSpanRoot('SklEngine.delete', async() => {\n const idArray = Array.isArray(idOrIds) ? idOrIds : [idOrIds];\n\n await globalHooks.execute(HookTypes.DELETE, HookStages.BEFORE, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n\n try {\n await this.queryAdapter.delete(idArray);\n\n await globalHooks.execute(HookTypes.DELETE, HookStages.AFTER, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n });\n } catch (error) {\n await globalHooks.execute(HookTypes.DELETE, HookStages.ERROR, {\n entities: [],\n operation: 'delete',\n operationParameters: { idArray },\n sklEngine: this,\n bypassHooks: options?.bypassHooks\n }, error);\n throw error;\n }\n }, { idCount: Array.isArray(idOrIds) ? idOrIds.length : 1 });\n }\n\n public async destroy(entity: Entity): Promise<Entity>;\n public async destroy(entities: Entity[]): Promise<Entity[]>;\n public async destroy(entityOrEntities: Entity | Entity[]): Promise<Entity | Entity[]> {\n if (Array.isArray(entityOrEntities)) {\n return await this.queryAdapter.destroy(entityOrEntities);\n }\n return await this.queryAdapter.destroy(entityOrEntities);\n }\n\n public async destroyAll(): Promise<void> {\n return await this.queryAdapter.destroyAll();\n }\n\n public async performMapping(\n args: JSONValue,\n mapping: OrArray<NodeObject>,\n frame?: Record<string, any>,\n capabilityConfig?: CapabilityConfig,\n jsExecutionOptions?: ExecutionOptions\n ): Promise<NodeObject> {\n const mappingArray = ensureArray(mapping);\n const codeBlocks = mappingArray.filter(\n (mappingItem: NodeObject): boolean =>\n mappingItem[PROP_ENTITY_TYPE] === EngineConstants.spec.codeBlock &&\n this.isJavaScriptCode(getValueIfDefined(mappingItem[EngineConstants.prop.codeBody])!)\n );\n // FIXME: Handle if we can combine the codeb blocks with triples map.\n // As of now if there is any code block, triples map does not get executed.\n if (codeBlocks.length > 0) {\n return await this.executeCodeBlocks(codeBlocks, args, jsExecutionOptions ?? {});\n }\n\n const functions = {\n ...this.functions,\n ...capabilityConfig?.functions\n };\n const mapper = new Mapper({ functions });\n return await mapper.apply(args, mapping, frame ?? {});\n }\n\n public async executeTrigger(integration: string, payload: any): Promise<void> {\n const triggerToCapabilityMapping = await this.findTriggerCapabilityMapping(integration);\n const capabilityArgs = await this.performParameterMappingOnArgsIfDefined(\n payload,\n triggerToCapabilityMapping as Partial<MappingWithInputs> | Partial<MappingWithInputsReference>\n );\n const capabilityId = await this.performCapabilityMappingWithArgs(payload, triggerToCapabilityMapping);\n if (capabilityId) {\n const mappedCapability = (await this.findBy({ id: capabilityId })) as Capability;\n await this.executeCapability(mappedCapability, capabilityArgs);\n }\n }\n\n private async findTriggerCapabilityMapping(integration: string): Promise<TriggerMapping> {\n const triggerCapabilityMappingNew = (await this.findBy(\n {\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: integration,\n [EngineConstants.prop.capabilityType]: EngineConstants.spec.triggerCapabilityMapping\n },\n `Failed to find a Trigger Capability mapping for integration ${integration}`\n )) as TriggerMapping;\n if (triggerCapabilityMappingNew) {\n return triggerCapabilityMappingNew;\n }\n throw new Error(`Failed to find a Trigger Capability mapping for integration ${integration}`);\n }\n\n private async executeCapabilityByName(\n capabilityName: string,\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capability = await this.findCapabilityWithName(capabilityName);\n return await this.executeCapability(capability, capabilityArgs, capabilityConfig);\n }\n\n private async findCapabilityWithName(capabilityName: string): Promise<Capability> {\n return (await this.findBy(\n { type: EngineConstants.spec.capability, [EngineConstants.prop.label]: capabilityName },\n `Failed to find the capability ${capabilityName} in the schema.`\n )) as Capability;\n }\n\n public async executeCapability(\n capability: Capability,\n capabilityArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n this.globalCallbacks?.onCapabilityStart?.(capability[PROP_ENTITY_ID], capabilityArgs);\n if (capabilityConfig?.callbacks?.onCapabilityStart) {\n this.logger.debug('Capability arguments', capabilityArgs);\n capabilityConfig.callbacks.onCapabilityStart(capability[PROP_ENTITY_ID], capabilityArgs);\n }\n const { mapping, account } = await this.findMappingForCapabilityContextually(\n capability[PROP_ENTITY_ID],\n capabilityArgs\n );\n this.logger.debug('Mapping', JSON.stringify(mapping));\n const shouldValidate = this.shouldValidate(capabilityConfig);\n if (shouldValidate) {\n await this.assertCapabilityParamsMatchParameterSchemas(capabilityArgs, capability);\n }\n\n try {\n // Execute capability mapping before hook if appropriate -\n // works for any mapping that can be used as a verb mapping\n if (mapping) {\n await globalHooks.executeBeforeExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, { sklEngine: this });\n }\n\n const verbReturnValue = await this.executeMapping(mapping, capabilityArgs, capabilityConfig, account);\n\n if (shouldValidate) {\n await this.assertCapabilityReturnValueMatchesReturnTypeSchema(verbReturnValue, capability);\n }\n\n // Execute capability mapping after hook if appropriate\n if (mapping) {\n await globalHooks.executeAfterExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, verbReturnValue, { sklEngine: this });\n }\n\n this.globalCallbacks?.onCapabilityEnd?.(capability[PROP_ENTITY_ID], verbReturnValue);\n if (capabilityConfig?.callbacks?.onCapabilityEnd) {\n capabilityConfig.callbacks.onCapabilityEnd(capability[PROP_ENTITY_ID], verbReturnValue);\n }\n\n return verbReturnValue;\n } catch (error) {\n // Execute capability mapping error hook if appropriate\n if (mapping) {\n await globalHooks.executeErrorExecuteCapabilityMapping([capabilityArgs] as Entity[], mapping, error as Error, { sklEngine: this });\n }\n throw error;\n }\n }\n\n private async findMappingForCapabilityContextually(\n capabilityId: string,\n args: JSONObject\n ): Promise<{ mapping: CapabilityMapping; account?: Entity }> {\n if (args.mapping) {\n const mapping = await this.findByIfExists({ id: args.mapping as string });\n if (!mapping) {\n throw new Error(`Mapping ${args.mapping as string} not found.`);\n }\n return { mapping: mapping as CapabilityMapping };\n }\n if (args.object) {\n const mapping = await this.findCapabilityObjectMapping(capabilityId, args.object as string);\n if (mapping) {\n return { mapping };\n }\n }\n if (args.account) {\n const account = await this.findBy({ id: args.account as string });\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const mapping = await this.findCapabilityIntegrationMapping(capabilityId, integratedProductId);\n if (mapping) {\n return { mapping, account };\n }\n }\n\n const mappings = await this.findAllBy({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.integration]: Not(Exists()),\n [EngineConstants.prop.object]: Not(Exists())\n });\n if (mappings.length === 1) {\n return { mapping: mappings[0] as CapabilityMapping };\n }\n if (mappings.length > 1) {\n throw new Error('Multiple mappings found for capability, please specify one.');\n }\n if (args.object) {\n throw new Error(`Mapping between object ${args.object as string} and capability ${capabilityId} not found.`);\n }\n if (args.account) {\n throw new Error(`Mapping between account ${args.account as string} and capability ${capabilityId} not found.`);\n }\n throw new Error(`No mapping found.`);\n }\n\n public async executeMapping(\n mapping: Mapping,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig,\n account?: Entity\n ): Promise<OrArray<NodeObject>> {\n args = await this.addPreProcessingMappingToArgs(mapping, args, capabilityConfig);\n let returnValue: OrArray<NodeObject>;\n // If (EngineConstants.prop.capability in mapping || EngineConstants.prop.capabilityMapping in mapping) {\n // const capabilityId = await this.performCapabilityMappingWithArgs(args, mapping, capabilityConfig);\n // const mappedArgs = await this.performParameterMappingOnArgsIfDefined(\n // { ...args, capabilityId },\n // mapping as MappingWithInputs,\n // capabilityConfig\n // );\n // Logger.getInstance().log('Mapped args', mappedArgs);\n // returnValue = await this.executeCapabilityMapping(mapping, args, mappedArgs, capabilityConfig);\n // } else {\n const mappedArgs = await this.performParameterMappingOnArgsIfDefined(\n args,\n mapping as MappingWithInputs,\n capabilityConfig\n );\n this.logger.debug('Mapped args', mappedArgs);\n if (EngineConstants.prop.operationId in mapping || EngineConstants.prop.operationMapping in mapping) {\n returnValue = (await this.executeOperationMapping(\n mapping,\n mappedArgs,\n args,\n account!,\n capabilityConfig\n )) as NodeObject;\n } else if (EngineConstants.prop.series in mapping) {\n returnValue = await this.executeSeriesMapping(mapping as MappingWithSeries, mappedArgs, capabilityConfig);\n } else if (EngineConstants.prop.parallel in mapping) {\n returnValue = await this.executeParallelMapping(mapping as MappingWithParallel, mappedArgs, capabilityConfig);\n } else {\n returnValue = mappedArgs;\n }\n // }\n return await this.performReturnValueMappingWithFrameIfDefined(\n returnValue as JSONValue,\n mapping as MappingWithOutputsMapping,\n capabilityConfig\n );\n }\n\n private shouldValidate(capabilityConfig?: CapabilityConfig): boolean {\n return capabilityConfig?.disableValidation === undefined\n ? this.disableValidation !== true\n : !capabilityConfig.disableValidation;\n }\n\n private async executeOperationMapping(\n mapping: Mapping,\n mappedArgs: JSONObject,\n originalArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<OperationResponse | OrArray<NodeObject>> {\n const integration = (mapping as CapabilityMapping)[EngineConstants.prop.integration]?.[PROP_ENTITY_ID];\n\n // If the mapping has an integration, it means that the operation is an integration operation\n if (integration) {\n const operationInfo = await this.performOperationMappingWithArgs(originalArgs, mapping, capabilityConfig);\n const response = await this.performOperation(operationInfo, mappedArgs, originalArgs, account, capabilityConfig);\n if (!this.ifCapabilityStreaming(capabilityConfig)) {\n this.logger.debug('Original response', JSON.stringify(response));\n }\n return response;\n }\n // If the mapping does not have an integration, it means that the operation is a capability operation\n return await this.executeCapabilityMapping(mapping, originalArgs, mappedArgs, capabilityConfig);\n }\n\n private async executeSeriesMapping(\n mapping: MappingWithSeries,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const seriesCapabilityMappingsList = this.rdfListToArray(mapping[EngineConstants.prop.series]!);\n const seriesCapabilityArgs = {\n originalCapabilityParameters: args,\n previousCapabilityReturnValue: {},\n allStepsResults: []\n };\n\n return await this.executeSeriesFromList(seriesCapabilityMappingsList, seriesCapabilityArgs, capabilityConfig);\n }\n\n private rdfListToArray(list: { [RML_LIST]: CapabilityMapping[] } | RdfList<CapabilityMapping>): CapabilityMapping[] {\n if (!(RML_LIST in list)) {\n return [\n list[RDF.first],\n ...getIdFromNodeObjectIfDefined(list[RDF.rest] as ReferenceNodeObject) === RDF.nil\n ? []\n : this.rdfListToArray(list[RDF.rest] as RdfList<CapabilityMapping>)\n ];\n }\n return list[RML_LIST];\n }\n\n private async executeSeriesFromList(\n list: Mapping[],\n args: SeriesCapabilityArgs,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const nextCapabilityMapping = list[0];\n const returnValue = await this.executeMapping(nextCapabilityMapping, args, capabilityConfig);\n if (list.length > 1) {\n return await this.executeSeriesFromList(\n list.slice(1),\n {\n ...args,\n previousCapabilityReturnValue: returnValue as JSONObject,\n allStepsResults: [...args.allStepsResults ?? [], returnValue as JSONObject]\n },\n capabilityConfig\n );\n }\n return returnValue;\n }\n\n private async executeCapabilityMapping(\n capabilityMapping: Mapping,\n originalArgs: JSONObject,\n mappedArgs: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capabilityId = await this.performCapabilityMappingWithArgs(originalArgs, capabilityMapping, capabilityConfig);\n if (capabilityId) {\n if (capabilityId === EngineConstants.dataSource.update) {\n await this.updateEntityFromcapabilityArgs(mappedArgs);\n return {};\n }\n if (capabilityId === EngineConstants.dataSource.save) {\n return await this.saveEntityOrEntitiesFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.destroy) {\n return await this.destroyEntityOrEntitiesFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.findAll) {\n return await this.findAll(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.find) {\n return await this.find(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.count) {\n return await this.countAndWrapValueFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === EngineConstants.dataSource.exists) {\n return await this.existsAndWrapValueFromcapabilityArgs(mappedArgs);\n }\n if (capabilityId === 'https://skl.ai/capability/execute-code') {\n const codeBlocks = ensureArray((capabilityMapping[EngineConstants.prop.codeBlocks] as any[]) ?? []).filter(\n (mappingItem: any): boolean =>\n mappingItem[PROP_ENTITY_TYPE] === EngineConstants.spec.codeBlock &&\n this.isJavaScriptCode(getValueIfDefined(mappingItem[EngineConstants.prop.codeBody])!)\n );\n return await this.executeCodeBlocks(codeBlocks, mappedArgs, {});\n }\n\n // Check for custom capabilities\n if (globalCustomCapabilities.has(capabilityId)) {\n return await globalCustomCapabilities.execute(capabilityId, mappedArgs, this, capabilityConfig);\n }\n\n return await this.findAndExecuteCapability(capabilityId, mappedArgs, capabilityConfig);\n }\n return {};\n }\n\n private async addPreProcessingMappingToArgs(\n capabilityMapping: Mapping,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<JSONObject> {\n if (EngineConstants.prop.preProcessingMapping in capabilityMapping) {\n const preMappingArgs = await this.performMapping(\n args,\n capabilityMapping[EngineConstants.prop.preProcessingMapping] as NodeObject,\n getValueIfDefined(capabilityMapping[EngineConstants.prop.preProcessingMappingFrame]),\n capabilityConfig\n );\n return { ...args, preProcessedParameters: preMappingArgs as JSONObject };\n }\n return args;\n }\n\n private replaceTypeAndId(entity: Record<string, any>): Record<string, any> {\n if (typeof entity !== 'object') {\n throw new Error('Entity is not an object');\n }\n const clonedEntity = structuredClone(entity);\n if (clonedEntity[EngineConstants.prop.type]) {\n clonedEntity[PROP_ENTITY_TYPE] = clonedEntity[EngineConstants.prop.type];\n }\n if (clonedEntity[EngineConstants.prop.identifier]) {\n clonedEntity[PROP_ENTITY_ID] = SKL_DATA_NAMESPACE + (clonedEntity[EngineConstants.prop.identifier] as string);\n }\n return clonedEntity;\n }\n\n private async updateEntityFromcapabilityArgs(args: Record<string, any>): Promise<void> {\n let ids = args.id ?? args.ids;\n if (!Array.isArray(ids)) {\n ids = [ids];\n }\n // FIX: Temporary fix for the issue where the id always getting prefixed with the namespace\n ids = ids.map((id: string) => (id.startsWith('http') ? id : `${SKL_DATA_NAMESPACE}${id}`));\n await this.update(ids, args.attributes);\n }\n\n private async saveEntityOrEntitiesFromcapabilityArgs(args: Record<string, any>): Promise<OrArray<Entity>> {\n if (args.entity && typeof args.entity === 'object') {\n args.entity = this.replaceTypeAndId(args.entity);\n }\n if (args.entities && Array.isArray(args.entities)) {\n args.entities = args.entities.map(this.replaceTypeAndId);\n }\n return await this.save(args.entity ?? args.entities);\n }\n\n private async destroyEntityOrEntitiesFromcapabilityArgs(args: Record<string, any>): Promise<OrArray<Entity>> {\n if (args.entity && typeof args.entity === 'object') {\n args.entity = this.replaceTypeAndId(args.entity);\n }\n if (args.entities && Array.isArray(args.entities)) {\n args.entities = args.entities.map(this.replaceTypeAndId);\n }\n return await this.destroy(args.entity ?? args.entities);\n }\n\n private async countAndWrapValueFromcapabilityArgs(args: Record<string, any>): Promise<NodeObject> {\n const count = await this.count(args);\n return {\n [EngineConstants.dataSource.countResult]: {\n [PROP_ENTITY_VALUE]: count,\n [PROP_ENTITY_TYPE]: XSD.integer\n }\n };\n }\n\n private async existsAndWrapValueFromcapabilityArgs(args: Record<string, any>): Promise<NodeObject> {\n const exists = await this.exists(args);\n return {\n [EngineConstants.dataSource.existsResult]: {\n [PROP_ENTITY_VALUE]: exists,\n [PROP_ENTITY_TYPE]: XSD.boolean\n }\n };\n }\n\n public async findAndExecuteCapability(\n capabilityId: string,\n args: Record<string, any>,\n capabilityConfig?: CapabilityConfig\n ): Promise<OrArray<NodeObject>> {\n const capability = (await this.findBy({ id: capabilityId })) as Capability;\n return await this.executeCapability(capability, args, capabilityConfig);\n }\n\n private async executeParallelMapping(\n mapping: MappingWithParallel,\n args: JSONObject,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject[]> {\n const parallelCapabilityMappings = ensureArray(\n mapping[EngineConstants.prop.parallel] as unknown as OrArray<CapabilityMapping>\n );\n const nestedReturnValues = await Promise.all<Promise<OrArray<NodeObject>>>(\n parallelCapabilityMappings.map(\n (capabilityMapping): Promise<OrArray<NodeObject>> =>\n this.executeMapping(capabilityMapping, args, capabilityConfig)\n )\n );\n return nestedReturnValues.flat();\n }\n\n private async findCapabilityIntegrationMapping(\n capabilityId: string,\n integratedProductId: string\n ): Promise<CapabilityMapping | undefined> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.integration]: integratedProductId\n })) as CapabilityMapping;\n }\n\n private async performOperationMappingWithArgs(\n args: JSONValue,\n mapping: Mapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject> {\n if (mapping[EngineConstants.prop.operationId]) {\n return { [EngineConstants.prop.operationId]: mapping[EngineConstants.prop.operationId] };\n }\n if (mapping[EngineConstants.prop.dataSource]) {\n return { [EngineConstants.prop.dataSource]: mapping[EngineConstants.prop.dataSource] };\n }\n return await this.performMapping(\n args,\n mapping[EngineConstants.prop.operationMapping] as OrArray<NodeObject>,\n undefined,\n capabilityConfig\n );\n }\n\n private async performOperation(\n operationInfo: NodeObject,\n operationArgs: JSONObject,\n originalArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig,\n securityCredentials?: Entity\n ): Promise<OperationResponse> {\n if (operationInfo[EngineConstants.prop.schemeName]) {\n return await this.performOauthSecuritySchemeStageWithCredentials(\n operationInfo,\n operationArgs,\n account,\n securityCredentials\n );\n }\n if (operationInfo[EngineConstants.prop.dataSource]) {\n return await this.getDataFromDataSource(\n getIdFromNodeObjectIfDefined(operationInfo[EngineConstants.prop.dataSource] as string | ReferenceNodeObject)!,\n capabilityConfig\n );\n }\n if (operationInfo[EngineConstants.prop.operationId]) {\n const response = await this.performOpenapiOperationWithCredentials(\n getValueIfDefined(operationInfo[EngineConstants.prop.operationId])!,\n operationArgs,\n account,\n capabilityConfig\n );\n return this.axiosResponseAndParamsToOperationResponse(response, operationArgs, originalArgs);\n }\n throw new Error('Operation not supported.');\n }\n\n private axiosResponseAndParamsToOperationResponse(\n response: AxiosResponse,\n operationParameters: JSONObject,\n originalArgs: JSONObject\n ): OperationResponse {\n return {\n operationParameters,\n originalCapabilityParameters: originalArgs,\n data: response.data,\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n config: {\n headers: response.config.headers,\n method: response.config.method,\n url: response.config.url,\n data: response.config.data\n } as JSONObject\n };\n }\n\n private async performReturnValueMappingWithFrameIfDefined(\n returnValue: JSONValue,\n mapping: MappingWithOutputsMapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<NodeObject> {\n if (EngineConstants.prop.outputsMapping in mapping) {\n return await this.performMapping(\n returnValue,\n mapping[EngineConstants.prop.outputsMapping],\n getValueIfDefined<JSONObject>(mapping[EngineConstants.prop.outputsMappingFrame]),\n capabilityConfig\n );\n }\n return returnValue as NodeObject;\n }\n\n private async performParameterMappingOnArgsIfDefined(\n args: JSONObject,\n mapping: Partial<MappingWithInputs> | Partial<MappingWithInputsReference>,\n capabilityConfig?: CapabilityConfig,\n convertToJsonDeep = false\n ): Promise<Record<string, any>> {\n if (EngineConstants.prop.inputsReference in mapping) {\n const reference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsReference])!;\n return this.getDataAtReference(reference, args);\n }\n\n if (EngineConstants.prop.inputsMappingRef in mapping) {\n const reference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsMappingRef])!;\n const referencedMapping = this.getDataAtReference(reference, args);\n\n if (!referencedMapping || referencedMapping?.length === 0) {\n return args;\n }\n\n // Handle inputsMappingFrameRef if present\n let frame;\n if (EngineConstants.prop.inputsMappingFrameRef in mapping) {\n const frameReference = getValueIfDefined<string>(mapping[EngineConstants.prop.inputsMappingFrameRef])!;\n frame = this.getDataAtReference(frameReference, args);\n } else {\n // Use direct frame if provided\n frame = getValueIfDefined(mapping[EngineConstants.prop.inputsMappingFrame]);\n }\n\n // Perform mapping with the referenced mapping and frame\n const mappedData = await this.performMapping(args, referencedMapping, frame, capabilityConfig);\n return toJSON(mappedData, convertToJsonDeep);\n }\n\n if (EngineConstants.prop.inputsMapping in mapping) {\n const mappedData = await this.performMapping(\n args,\n (mapping as MappingWithInputs)[EngineConstants.prop.inputsMapping]!,\n getValueIfDefined(mapping[EngineConstants.prop.inputsMappingFrame]),\n capabilityConfig\n );\n return toJSON(mappedData, convertToJsonDeep);\n }\n return args;\n }\n\n private getDataAtReference(reference: string, data: JSONObject): any {\n const results = JSONPath({\n path: reference,\n json: data,\n resultType: 'value'\n });\n const isArrayOfLengthOne = Array.isArray(results) && results.length === 1;\n let result = isArrayOfLengthOne ? results[0] : results;\n if (result && typeof result === 'object' && PROP_ENTITY_VALUE in result) {\n result = result[PROP_ENTITY_VALUE];\n }\n return result;\n }\n\n private async getIntegrationInterface(\n integratedProductId: string,\n integrationType = EngineConstants.spec.integrationInterface\n ): Promise<Entity | null> {\n if (integrationType === EngineConstants.spec.integrationInterface) {\n const integrationInterface = await this.findBy({\n type: integrationType,\n [EngineConstants.prop.type]: EngineConstants.spec.openApi,\n [EngineConstants.prop.integration]: integratedProductId\n });\n return integrationInterface;\n }\n // Add support for other integration types\n return null;\n }\n\n private async findSecurityCredentialsForAccountIfDefined(accountId: string): Promise<Entity | undefined> {\n return await this.findByIfExists({\n type: EngineConstants.spec.integrationAuthenticationCredential,\n [EngineConstants.prop.accountOrUser]: accountId\n });\n }\n\n private async findgetOpenApiRuntimeAuthorizationCapabilityIfDefined(): Promise<Capability | undefined> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capability,\n [EngineConstants.prop.label]: OPEN_API_RUNTIME_AUTHORIZATION\n })) as Capability;\n }\n\n private async findRefreshCapabilityForIntegration(integrationId: string): Promise<Capability> {\n const integration = await this.findByIfExists({ id: integrationId });\n const configuredRefreshCapability = integration?.[EngineConstants.prop.refreshCapability];\n if (configuredRefreshCapability) {\n const refreshCapabilityId = getIdFromNodeObjectIfDefined(\n configuredRefreshCapability as string | ReferenceNodeObject\n );\n if (!refreshCapabilityId) {\n throw new Error(`Integration ${integrationId} has an invalid refresh capability reference.`);\n }\n const refreshCapability = (await this.findByIfExists({ id: refreshCapabilityId })) as Capability | undefined;\n if (!refreshCapability) {\n throw new Error(\n `Refresh capability ${refreshCapabilityId} configured for integration ${integrationId} was not found.`\n );\n }\n return refreshCapability;\n }\n return await this.findCapabilityWithName('getOauthTokens');\n }\n\n private async getRuntimeCredentialsWithSecurityCredentials(\n securityCredentials: Entity,\n integrationId: string,\n openApiOperationInformation: OperationWithPathInfo,\n operationArgs: JSONObject\n ): Promise<JSONObject> {\n const getOpenApiRuntimeAuthorizationCapability = await this.findgetOpenApiRuntimeAuthorizationCapabilityIfDefined();\n if (!getOpenApiRuntimeAuthorizationCapability) {\n return {};\n }\n const mapping = await this.findCapabilityIntegrationMapping(\n getOpenApiRuntimeAuthorizationCapability[PROP_ENTITY_ID],\n integrationId\n );\n if (!mapping) {\n return {};\n }\n const args = {\n securityCredentials,\n openApiExecutorOperationWithPathInfo: openApiOperationInformation,\n operationArgs\n } as JSONObject;\n const operationInfoJsonLd = await this.performParameterMappingOnArgsIfDefined(args, mapping, undefined, true);\n const headers = getValueIfDefined<JSONObject>(operationInfoJsonLd[EngineConstants.prop.headers]);\n return headers ?? {};\n }\n\n private async createOpenApiOperationExecutorWithSpec(openApiDescription: OpenApi): Promise<OpenApiOperationExecutor> {\n const executor = new OpenApiOperationExecutor();\n await executor.setOpenapiSpec(openApiDescription);\n return executor;\n }\n\n private async findCapabilityObjectMapping(capabilityId: string, object: string): Promise<CapabilityMapping> {\n return (await this.findByIfExists({\n type: EngineConstants.spec.capabilityMapping,\n [EngineConstants.prop.capability]: capabilityId,\n [EngineConstants.prop.object]: InversePath({\n subPath: ZeroOrMorePath({ subPath: RDFS.subClassOf as string }),\n value: object\n })\n })) as CapabilityMapping;\n }\n\n private async performCapabilityMappingWithArgs(\n args: JSONValue,\n mapping: Mapping,\n capabilityConfig?: CapabilityConfig\n ): Promise<string | undefined> {\n if (mapping[EngineConstants.prop.operationId]) {\n return getValueIfDefined<string>(mapping[EngineConstants.prop.operationId])!;\n }\n if (mapping[EngineConstants.prop.operationId]) {\n return getValueIfDefined<string>(mapping[EngineConstants.prop.operationId])!;\n }\n const capabilityInfoJsonLd = await this.performMapping(\n args,\n mapping[EngineConstants.prop.operationMapping] as NodeObject,\n undefined,\n capabilityConfig\n );\n return getValueIfDefined<string>(capabilityInfoJsonLd[EngineConstants.prop.operationId])!;\n }\n\n private async assertCapabilityParamsMatchParameterSchemas(\n capabilityParams: any,\n capability: Capability\n ): Promise<void> {\n let parametersSchemaObject = capability[EngineConstants.prop.inputs];\n if (parametersSchemaObject?.[PROP_ENTITY_ID] && Object.keys(parametersSchemaObject).length === 1) {\n parametersSchemaObject = await this.findBy({ id: parametersSchemaObject[PROP_ENTITY_ID] });\n }\n if (capabilityParams && parametersSchemaObject) {\n const capabilityParamsAsJsonLd = {\n '@context': getValueIfDefined<ContextDefinition>(capability[EngineConstants.prop.inputsContext]),\n [PROP_ENTITY_TYPE]: EngineConstants.spec.inputs,\n ...capabilityParams\n };\n const report = await this.convertToQuadsAndValidateAgainstShape(capabilityParamsAsJsonLd, parametersSchemaObject);\n if (!report.conforms) {\n this.throwValidationReportError(\n report,\n `${getValueIfDefined(capability[EngineConstants.prop.label])} parameters do not conform to the schema`\n );\n }\n }\n }\n\n private async performOpenapiOperationWithCredentials(\n operationId: string,\n operationArgs: JSONObject,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<AxiosResponse> {\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const restAPIInterface = await this.getIntegrationInterface(integratedProductId);\n if (!restAPIInterface) {\n throw new Error(`No integration interface found for integrated product ${integratedProductId}`);\n }\n const openApiDescription = getValueIfDefined<OpenApi>(\n restAPIInterface[EngineConstants.prop.declarativeApiDescription]\n )!;\n const openApiExecutor = await this.createOpenApiOperationExecutorWithSpec(openApiDescription);\n // eslint-disable-next-line @typescript-eslint/await-thenable\n const openApiOperationInformation = await openApiExecutor.getOperationWithPathInfoMatchingOperationId(operationId);\n const securityCredentials = await this.findSecurityCredentialsForAccountIfDefined(account[PROP_ENTITY_ID]);\n let runtimeAuthorization: JSONObject = {};\n if (securityCredentials) {\n const generatedRuntimeCredentials = await this.getRuntimeCredentialsWithSecurityCredentials(\n securityCredentials,\n integratedProductId,\n openApiOperationInformation,\n operationArgs\n );\n if (generatedRuntimeCredentials && Object.keys(generatedRuntimeCredentials).length > 0) {\n runtimeAuthorization = generatedRuntimeCredentials;\n }\n }\n const apiKey = [\n getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.apiKey]),\n this.getAuthorizationHeaderFromRuntimeCredentials(runtimeAuthorization)\n ].find(Boolean);\n const configuration = {\n accessToken: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.accessToken]),\n bearerToken: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.bearerToken]),\n apiKey,\n basePath: getValueIfDefined<string>(account[EngineConstants.prop.overrideBasePath]),\n username: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.username]),\n password: getValueIfDefined<string>(securityCredentials?.[EngineConstants.prop.password])\n };\n let response;\n let executeOperationOptions: AxiosRequestConfig | undefined;\n try {\n const additionalHeaders = this.getHeadersFromRuntimeCredentials(runtimeAuthorization) as any;\n if (\n additionalHeaders &&\n typeof additionalHeaders === 'object' &&\n !Array.isArray(additionalHeaders) &&\n Object.keys(additionalHeaders).length > 0\n ) {\n executeOperationOptions = { headers: additionalHeaders };\n }\n if (this.ifCapabilityStreaming(capabilityConfig)) {\n executeOperationOptions = {\n ...executeOperationOptions,\n responseType: 'stream'\n };\n } else if (this.ifCapabilityBuffering(capabilityConfig)) {\n executeOperationOptions = {\n ...executeOperationOptions,\n responseType: 'arraybuffer'\n };\n }\n response = await openApiExecutor.executeOperation(\n operationId,\n configuration,\n operationArgs,\n executeOperationOptions\n );\n } catch (error: unknown) {\n if (\n axios.isAxiosError(error) &&\n await this.isInvalidTokenError(error, integratedProductId) &&\n securityCredentials\n ) {\n const refreshedConfiguration = await this.refreshSecurityCredentials(\n securityCredentials,\n integratedProductId,\n account,\n capabilityConfig\n );\n response = await openApiExecutor.executeOperation(\n operationId,\n refreshedConfiguration,\n operationArgs,\n executeOperationOptions\n );\n } else {\n throw error;\n }\n }\n return response;\n }\n\n private getHeadersFromRuntimeCredentials(runtimeCredentials: JSONObject): JSONObject {\n let returnValue: JSONObject = {};\n if (\n runtimeCredentials.headers &&\n typeof runtimeCredentials.headers === 'object' &&\n Object.keys(runtimeCredentials.headers).length > 0 &&\n !Array.isArray(runtimeCredentials.headers)\n ) {\n returnValue = runtimeCredentials.headers;\n }\n return returnValue;\n }\n\n private getAuthorizationHeaderFromRuntimeCredentials(runtimeCredentials: JSONObject): string | undefined {\n const headers = this.getHeadersFromRuntimeCredentials(runtimeCredentials);\n if (headers && 'Authorization' in headers) {\n const authorizationHeader = headers.Authorization;\n if (typeof authorizationHeader === 'string') {\n return authorizationHeader;\n }\n }\n return undefined;\n }\n\n private async isInvalidTokenError(error: AxiosError, integratedProductId: string): Promise<boolean> {\n const integrationInterface = await this.getIntegrationInterface(integratedProductId);\n if (!integrationInterface) {\n return false;\n }\n\n const errorMatcher = integrationInterface[EngineConstants.prop.invalidTokenErrorMatcher] as NodeObject;\n const errorMatcherStatus =\n errorMatcher && getValueIfDefined<string>(errorMatcher[EngineConstants.prop.invalidTokenErrorMatcherStatus]);\n const errorMatcherRegex =\n errorMatcher &&\n getValueIfDefined<string>(errorMatcher[EngineConstants.prop.invalidTokenErrorMatcherMessageRegex])!;\n if (errorMatcher && error.response?.status === errorMatcherStatus) {\n if (!errorMatcherRegex) {\n return true;\n }\n if (error.response?.statusText && new RegExp(errorMatcherRegex, 'u').test(error.response?.statusText)) {\n return true;\n }\n }\n\n return false;\n }\n\n private async refreshSecurityCredentials(\n securityCredentials: Entity,\n integrationId: string,\n account: Entity,\n capabilityConfig?: CapabilityConfig\n ): Promise<OpenApiClientConfiguration> {\n const refreshCapability = await this.findRefreshCapabilityForIntegration(integrationId);\n const mapping = await this.findCapabilityIntegrationMapping(refreshCapability[PROP_ENTITY_ID], integrationId);\n if (!mapping) {\n throw new Error(\n `No mapping found for capability ${refreshCapability[PROP_ENTITY_ID]} and integration ${integrationId}`\n );\n }\n const args = {\n refreshToken: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.refreshToken])!,\n jwtBearerOptions: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.jwtBearerOptions])!,\n securityCredentials: securityCredentials as unknown as JSONValue,\n account: account as unknown as JSONValue,\n integrationId\n } as JSONObject;\n const operationArgs = await this.performParameterMappingOnArgsIfDefined(args, mapping, capabilityConfig, true);\n const operationInfoJsonLd = await this.performOperationMappingWithArgs({}, mapping, capabilityConfig);\n const rawReturnValue = await this.performOperation(\n operationInfoJsonLd,\n operationArgs,\n args,\n account,\n capabilityConfig,\n securityCredentials\n );\n const mappedReturnValue = await this.performReturnValueMappingWithFrameIfDefined(\n rawReturnValue,\n mapping as MappingWithOutputsMapping,\n capabilityConfig\n );\n await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, refreshCapability);\n const bearerToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.bearerToken]);\n const accessToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.accessToken]);\n const refreshToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.refreshToken]);\n if (bearerToken) {\n securityCredentials[EngineConstants.prop.bearerToken] = bearerToken;\n }\n if (accessToken) {\n securityCredentials[EngineConstants.prop.accessToken] = accessToken;\n }\n if (refreshToken) {\n securityCredentials[EngineConstants.prop.refreshToken] = refreshToken;\n }\n await this.save(securityCredentials);\n return { accessToken, bearerToken };\n }\n\n private getOauthConfigurationFromSecurityCredentials(securityCredentialsSchema: Entity): OpenApiClientConfiguration {\n const username = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.username]);\n const password = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.password]);\n const accessToken = getValueIfDefined<string>(securityCredentialsSchema[EngineConstants.prop.accessToken]);\n return { username, password, accessToken };\n }\n\n private async assertCapabilityReturnValueMatchesReturnTypeSchema(\n returnValue: OrArray<NodeObject>,\n capability: Capability\n ): Promise<void> {\n let returnTypeSchemaObject = capability[EngineConstants.prop.outputs];\n if (returnTypeSchemaObject?.[PROP_ENTITY_ID] && Object.keys(returnTypeSchemaObject).length === 1) {\n returnTypeSchemaObject = await this.findBy({ id: returnTypeSchemaObject[PROP_ENTITY_ID] });\n }\n let report: ValidationReport | undefined;\n if (returnValue && returnTypeSchemaObject) {\n if (Array.isArray(returnValue)) {\n if (returnValue.some((valueItem): boolean => PROP_ENTITY_ID in valueItem)) {\n returnTypeSchemaObject[SHACL.targetNode] = returnValue.reduce(\n (nodes: ReferenceNodeObject[], outputItem): ReferenceNodeObject[] => {\n if (outputItem[PROP_ENTITY_ID]) {\n nodes.push({ [PROP_ENTITY_ID]: outputItem[PROP_ENTITY_ID] });\n }\n return nodes;\n },\n []\n );\n } else {\n const targetClasses = returnValue.reduce(\n (nodes: ReferenceNodeObject[], outputItem): ReferenceNodeObject[] => {\n if (outputItem[PROP_ENTITY_TYPE]) {\n const type = Array.isArray(outputItem[PROP_ENTITY_TYPE])\n ? outputItem[PROP_ENTITY_TYPE][0]\n : outputItem[PROP_ENTITY_TYPE];\n if (!nodes.includes({ [PROP_ENTITY_ID]: type })) {\n nodes.push({ [PROP_ENTITY_ID]: type });\n }\n }\n return nodes;\n },\n []\n );\n if (targetClasses.length > 0) {\n returnTypeSchemaObject[SHACL.targetClass] = targetClasses;\n }\n }\n report = await this.convertToQuadsAndValidateAgainstShape(returnValue, returnTypeSchemaObject);\n } else if (Object.keys(returnValue).length > 0) {\n if (returnValue[PROP_ENTITY_ID]) {\n returnTypeSchemaObject[SHACL.targetNode] = { [PROP_ENTITY_ID]: returnValue[PROP_ENTITY_ID] };\n } else if (returnValue[PROP_ENTITY_TYPE]) {\n returnTypeSchemaObject[SHACL.targetClass] = {\n [PROP_ENTITY_ID]: Array.isArray(returnValue[PROP_ENTITY_TYPE])\n ? returnValue[PROP_ENTITY_TYPE][0]\n : returnValue[PROP_ENTITY_TYPE]!\n };\n }\n report = await this.convertToQuadsAndValidateAgainstShape(returnValue, returnTypeSchemaObject);\n }\n }\n\n if (report && !report?.conforms) {\n throw new Error(\n `Return value ${\n Array.isArray(returnValue) ? 'array' : returnValue[PROP_ENTITY_ID]\n } does not conform to the schema`\n );\n }\n }\n\n private async convertToQuadsAndValidateAgainstShape(\n value: OrArray<NodeObject>,\n shape: NodeObject\n ): Promise<ValidationReport> {\n const valueAsQuads = await convertJsonLdToQuads(Array.isArray(value) ? value : [value]);\n const shapeQuads = await convertJsonLdToQuads(shape);\n const validator = new SHACLValidator(shapeQuads);\n return validator.validate(valueAsQuads);\n }\n\n private async performOauthSecuritySchemeStageWithCredentials(\n operationInfo: NodeObject,\n operationParameters: JSONObject,\n account: Entity,\n securityCredentials?: Entity\n ): Promise<OperationResponse> {\n const integratedProductId = (account[EngineConstants.prop.integration] as ReferenceNodeObject)[PROP_ENTITY_ID];\n const restAPIInterface = await this.getIntegrationInterface(integratedProductId);\n if (!restAPIInterface) {\n throw new Error(`No integration interface found for integrated product ${integratedProductId}`);\n }\n const openApiDescription = getValueIfDefined<OpenApi>(\n restAPIInterface[EngineConstants.prop.declarativeApiDescription]\n )!;\n securityCredentials ||= await this.findSecurityCredentialsForAccountIfDefined(account[PROP_ENTITY_ID]);\n let configuration: OpenApiClientConfiguration;\n if (securityCredentials) {\n configuration = this.getOauthConfigurationFromSecurityCredentials(securityCredentials);\n operationParameters.client_id = getValueIfDefined<string>(securityCredentials[EngineConstants.prop.username])!;\n } else {\n configuration = {};\n }\n const openApiExecutor = await this.createOpenApiOperationExecutorWithSpec(openApiDescription);\n const response = await openApiExecutor.executeSecuritySchemeStage(\n getValueIfDefined(operationInfo[EngineConstants.prop.schemeName])!,\n getValueIfDefined(operationInfo[EngineConstants.prop.oauthFlow])!,\n getValueIfDefined(operationInfo[EngineConstants.prop.stage])!,\n configuration,\n operationParameters\n );\n if ('codeVerifier' in response && 'authorizationUrl' in response) {\n return {\n data: response as unknown as JSONObject,\n operationParameters\n };\n }\n return this.axiosResponseAndParamsToOperationResponse(response, operationParameters, operationParameters);\n }\n\n private async getDataFromDataSource(\n dataSourceId: string,\n capabilityConfig?: CapabilityConfig\n ): Promise<OperationResponse> {\n const dataSource = await this.findBy({ id: dataSourceId });\n if (dataSource[PROP_ENTITY_TYPE] === EngineConstants.spec.jsonDataSource) {\n const data = this.getDataFromJsonDataSource(dataSource, capabilityConfig);\n return { data, operationParameters: {}};\n }\n throw new Error(`DataSource type ${dataSource[PROP_ENTITY_TYPE]} is not supported.`);\n }\n\n private getDataFromJsonDataSource(dataSource: NodeObject, capabilityConfig?: CapabilityConfig): JSONObject {\n if (dataSource[EngineConstants.prop.source]) {\n const sourceValue = getValueIfDefined<string>(dataSource[EngineConstants.prop.source])!;\n return this.getJsonDataFromSource(sourceValue, capabilityConfig);\n }\n return getValueIfDefined<JSONObject>(dataSource[EngineConstants.prop.data])!;\n }\n\n private getJsonDataFromSource(source: string, capabilityConfig?: CapabilityConfig): JSONObject {\n const inputFiles = {\n ...this.inputFiles,\n ...capabilityConfig?.inputFiles\n };\n if (source in inputFiles) {\n const file = inputFiles[source];\n if (typeof file === 'string') {\n return JSON.parse(file);\n }\n return file;\n }\n // eslint-disable-next-line unicorn/expiring-todo-comments\n // TODO add support for remote sources\n throw new Error(`Failed to get data from source ${source}`);\n }\n\n private throwValidationReportError(report: ValidationReport, errorMessage: string): void {\n const reportMessages = this.validationReportToMessages(report);\n throw new Error(`${errorMessage}\\n\\n${reportMessages.join('\\n')}`);\n }\n\n private validationReportToMessages(report: ValidationReport): string[] {\n const reportMessages = [];\n for (const result of report.results) {\n const pathValue = result.path?.value;\n if (result.message.length === 0) {\n const message = `${pathValue}: Invalid due to ${result.sourceConstraintComponent?.value}`;\n reportMessages.push(message);\n } else {\n const resultMessages = result.message.map((message): string => `${message.value}`).join(', ');\n const message = `${pathValue}: ${resultMessages}`;\n reportMessages.push(message);\n }\n }\n return reportMessages;\n }\n\n private ifCapabilityStreaming(capabilityConfig?: CapabilityConfig): boolean {\n return Boolean(capabilityConfig && 'stream' in capabilityConfig && capabilityConfig.stream);\n }\n\n private ifCapabilityBuffering(capabilityConfig?: CapabilityConfig): boolean {\n return Boolean(capabilityConfig && 'buffer' in capabilityConfig && capabilityConfig.buffer);\n }\n\n private isJavaScriptCode(text: string): boolean {\n if (!text) {\n return false;\n }\n // Trim the text to handle leading/trailing whitespace\n const trimmed = text.trim();\n\n // First, quickly check if it looks like JSON (starts with { or [)\n const looksLikeJson = /^\\s*[[{]/.test(trimmed) && /[\\]}]\\s*$/.test(trimmed);\n\n if (looksLikeJson) {\n try {\n // If it can be parsed as JSON, it's likely an RML mapping\n JSON.parse(trimmed);\n return false;\n } catch {\n // If it looks like JSON but can't be parsed, it might be code\n // Continue with other checks\n }\n }\n\n // Check for common JavaScript patterns that wouldn't appear in JSON\n const jsPatterns = [\n /function\\s+[$A-Z_a-z][\\w$]*\\s*\\(/, // Function declaration\n /const\\s+[$A-Z_a-z][\\w$]*/, // Const declaration\n /let\\s+[$A-Z_a-z][\\w$]*/, // Let declaration\n /var\\s+[$A-Z_a-z][\\w$]*/, // Var declaration\n /if\\s*\\(/, // If statement\n /for\\s*\\(/, // For loop\n /while\\s*\\(/, // While loop\n /=>|return |console\\./, // Arrow functions, return statements, console usage\n /import\\s+|export\\s+/, // ES6 imports/exports\n /class\\s+[$A-Z_a-z][\\w$]*/, // Class declaration\n /\\/\\/|\\/\\*|\\*\\// // Comments\n ];\n\n // If it matches any JS pattern, it's likely code\n return jsPatterns.some(pattern => pattern.test(trimmed));\n }\n\n private ensureNodeObject(result: any): NodeObject {\n // Handle null/undefined results\n if (result === null || result === undefined) {\n return {};\n }\n\n // If it's already a NodeObject with proper formatting, return as is\n if (\n typeof result === 'object' &&\n !Array.isArray(result) &&\n (result[PROP_ENTITY_ID] !== undefined ||\n result[PROP_ENTITY_TYPE] !== undefined ||\n result['@context'] !== undefined ||\n result['@graph'] !== undefined)\n ) {\n return result as NodeObject;\n }\n\n // Handle arrays - convert to @graph\n if (Array.isArray(result)) {\n // Check if items in array are already objects\n const convertedItems = result.map(item => {\n if (typeof item === 'object' && item !== null) {\n // Already object, but ensure it has @type if not present\n if (!item[PROP_ENTITY_TYPE] && !item[PROP_ENTITY_ID] && !item[PROP_ENTITY_VALUE]) {\n return { [PROP_ENTITY_TYPE]: 'skl:Result', ...item };\n }\n return item;\n }\n // Convert primitives to objects with @value\n return { [PROP_ENTITY_VALUE]: item };\n });\n\n return {\n '@context': {\n skl: SKL_NAMESPACE\n },\n '@graph': convertedItems\n };\n }\n\n // Handle primitive values (string, number, boolean)\n if (typeof result !== 'object') {\n return {\n [PROP_ENTITY_VALUE]: result\n };\n }\n\n // Handle plain objects (not arrays, not null)\n // If it's a plain object but not in NodeObject format, add @type\n return {\n [PROP_ENTITY_TYPE]: 'skl:Result',\n '@context': {\n skl: SKL_NAMESPACE\n },\n ...result\n };\n }\n\n private async executeCodeBlocks(\n codeBlocks: NodeObject[],\n args: JSONValue,\n executionOptions: ExecutionOptions\n ): Promise<NodeObject> {\n const results = [];\n let updatedArgs = (args as Record<string, any>) || {};\n for (const codeBlock of codeBlocks) {\n const code = getValueIfDefined(codeBlock[EngineConstants.prop.codeBody])!;\n if (code) {\n const result = await this.executeJavaScriptMapping(updatedArgs, code as string, executionOptions);\n updatedArgs = {\n ...updatedArgs,\n ...result\n };\n results.push(result);\n }\n }\n return results.length > 0 ? results[results.length - 1] : {};\n }\n\n private async executeJavaScriptMapping(\n args: JSONValue,\n code: string,\n _executionOptions: ExecutionOptions\n ): Promise<NodeObject> {\n try {\n // Configure execution options\n const executionOptions: ExecutionOptions = {\n timeout: 60 * 60 * 1000, // 1 hour\n functionName: 'main',\n allowNetwork: true,\n allowedDomains: [],\n allowEnv: true,\n debugMode: true,\n allowRead: true,\n ..._executionOptions\n };\n\n if (!this.codeExecutor) {\n throw new Error('Code executor not set. Please set a code executor using setCodeExecutor()');\n }\n\n // Execute the code\n const executionResult = await this.codeExecutor.execute(code, args as Record<string, any>, executionOptions);\n\n // Handle execution errors\n if (executionResult?.error) {\n throw new Error(`Code execution error: ${executionResult.error?.message ?? 'Unknown error'}`);\n }\n\n // This is a patch to return the output as it is without converting to NodeObject\n // This is needed for some api inputs. We can try doing this using the frame.\n if (executionResult?.result?.rawOutput) {\n return executionResult?.result?.rawOutput;\n }\n // Convert the result to a NodeObject\n return this.ensureNodeObject(executionResult?.result ?? executionResult);\n } catch (error: unknown) {\n throw new Error(\n `Failed to execute JavaScript mapping: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n // Expose global hooks to users\n // eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n get hooks(): typeof globalHooks {\n return globalHooks;\n }\n\n public async prepareContextForType(typeSpecOrId: any): Promise<Record<string, any>> {\n const typeSpecs = [];\n if (typeof typeSpecOrId === 'string') {\n typeSpecs.push(\n await this.getSuperClassesOfObject(typeSpecOrId),\n await this.findBy({ id: typeSpecOrId })\n );\n } else {\n typeSpecs.push(typeSpecOrId);\n }\n const context: Record<string, any> = {};\n\n for (const typeSpec of typeSpecs) {\n const properties = typeSpec[SHACL.property] ?? [];\n for (const property of ensureArray(properties)) {\n const dataType = property[SHACL.datatype]?.['@id'];\n const nodeKind = property[SHACL.nodeKind]?.['@id'];\n const path = property[SHACL.path]?.['@id'];\n if (nodeKind === SHACL.IRI) {\n context[path] = {\n '@type': '@id'\n };\n } else {\n context[path] = {\n '@type': dataType\n };\n }\n }\n }\n return context;\n }\n}\n"]}
@@ -36,6 +36,7 @@ export declare const EngineConstants: {
36
36
  invalidTokenErrorMatcher: "https://skl.ai/integration/invalidTokenErrorMatcher";
37
37
  invalidTokenErrorMatcherStatus: "https://skl.ai/integration/invalidTokenErrorMatcherStatus";
38
38
  invalidTokenErrorMatcherMessageRegex: "https://skl.ai/integration/invalidTokenErrorMatcherMessageRegex";
39
+ refreshCapability: "https://skl.ai/integration/refreshCapability";
39
40
  refreshToken: "https://skl.ai/integration/credential/refreshToken";
40
41
  jwtBearerOptions: "https://skl.ai/integration/credential/jwtBearerOptions";
41
42
  accessToken: "https://skl.ai/integration/credential/accessToken";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,oBAAsB,CAAC;AACjD,eAAO,MAAM,kBAAkB,sBAA2B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,+BAA6B,CAAC;AAE/D,eAAO,MAAM,GAAG,6KAAY,CAAC;AAC7B,eAAO,MAAM,GAAG,4IAAY,CAAC;AAC7B,eAAO,MAAM,IAAI,6GAAa,CAAC;AAC/B,eAAO,MAAM,KAAK,oEAAc,CAAC;AACjC,eAAO,MAAM,GAAG,wNAAY,CAAC;AAC7B,eAAO,MAAM,KAAK,s2BAAc,CAAC;AACjC,eAAO,MAAM,eAAe,gCAAwB,CAAC;AACrD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAI1C,eAAO,MAAM,QAAQ,UAAU,CAAC;AAEhC,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAG/E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkF3B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa,oBAAsB,CAAC;AACjD,eAAO,MAAM,kBAAkB,sBAA2B,CAAC;AAC3D,eAAO,MAAM,oBAAoB,+BAA6B,CAAC;AAE/D,eAAO,MAAM,GAAG,6KAAY,CAAC;AAC7B,eAAO,MAAM,GAAG,4IAAY,CAAC;AAC7B,eAAO,MAAM,IAAI,6GAAa,CAAC;AAC/B,eAAO,MAAM,KAAK,oEAAc,CAAC;AACjC,eAAO,MAAM,GAAG,wNAAY,CAAC;AAC7B,eAAO,MAAM,KAAK,s2BAAc,CAAC;AACjC,eAAO,MAAM,eAAe,gCAAwB,CAAC;AACrD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAI1C,eAAO,MAAM,QAAQ,UAAU,CAAC;AAEhC,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAG/E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmF3B,CAAC"}
package/dist/constants.js CHANGED
@@ -43,6 +43,7 @@ exports.EngineConstants = {
43
43
  invalidTokenErrorMatcher: Vocabularies_1.SKL_PROPERTY['integration/invalidTokenErrorMatcher'],
44
44
  invalidTokenErrorMatcherStatus: Vocabularies_1.SKL_PROPERTY['integration/invalidTokenErrorMatcherStatus'],
45
45
  invalidTokenErrorMatcherMessageRegex: Vocabularies_1.SKL_PROPERTY['integration/invalidTokenErrorMatcherMessageRegex'],
46
+ refreshCapability: Vocabularies_1.SKL_PROPERTY['integration/refreshCapability'],
46
47
  refreshToken: Vocabularies_1.SKL_PROPERTY['integration/credential/refreshToken'],
47
48
  jwtBearerOptions: Vocabularies_1.SKL_PROPERTY['integration/credential/jwtBearerOptions'],
48
49
  accessToken: Vocabularies_1.SKL_PROPERTY['integration/credential/accessToken'],
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,sDAO6B;AAC7B,uDAKoC;AAEvB,QAAA,aAAa,GAAG,4BAAmB,CAAC;AACpC,QAAA,kBAAkB,GAAG,i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_NAMESPACE as SKL_DATA_NAMESPACE_VOCAB,\n SKL_ENGINE,\n SKL_ENGINE_NAMESPACE as SKL_ENGINE_NAMESPACE_VOCAB,\n SKL_NAMESPACE as SKL_NAMESPACE_VOCAB,\n SKL_PROPERTY,\n SKL_SPECS\n} from './util/Vocabularies';\nimport {\n OWL as OWL_VOCAB,\n R2RML as R2RML_VOCAB,\n RDF as RDF_VOCAB,\n RDFS as RDFS_VOCAB, SHACL as SHACL_VOCAB, SHACL_NAMESPACE as SHACL_NAMESPACE_VOCAB, XSD as XSD_VOCAB\n} from './util/Vocabularies/Shared';\n\nexport const SKL_NAMESPACE = SKL_NAMESPACE_VOCAB;\nexport const SKL_DATA_NAMESPACE = SKL_DATA_NAMESPACE_VOCAB;\nexport const SKL_ENGINE_NAMESPACE = SKL_ENGINE_NAMESPACE_VOCAB;\n\nexport const OWL = OWL_VOCAB;\nexport const RDF = RDF_VOCAB;\nexport const RDFS = RDFS_VOCAB;\nexport const R2RML = R2RML_VOCAB;\nexport const XSD = XSD_VOCAB;\nexport const SHACL = SHACL_VOCAB;\nexport const SHACL_NAMESPACE = SHACL_NAMESPACE_VOCAB;\nexport const PROP_ENTITY_ID = '@id';\nexport const PROP_ENTITY_TYPE = '@type';\nexport const PROP_ENTITY_VALUE = '@value';\n\n// RML constants\n\nexport const RML_LIST = '@list';\n\nexport const OPEN_API_RUNTIME_AUTHORIZATION = 'getOpenApiRuntimeAuthorization';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const EngineConstants = {\n spec: {\n capability: SKL_SPECS.Capability,\n capabilityMapping: SKL_SPECS.CapabilityMapping,\n triggerCapabilityMapping: SKL_SPECS.TriggerCapabilityMapping,\n invalidTokenErrorMatcher: SKL_SPECS['integration/InvalidTokenErrorMatcher'],\n jsonDataSource: SKL_SPECS.JsonDataSource,\n mapping: SKL_SPECS.Mapping,\n inputs: SKL_SPECS.Inputs,\n openApi: SKL_SPECS.OpenAPI,\n codeBlock: SKL_SPECS.CodeBlock,\n integrationAuthenticationCredential: SKL_SPECS['integration/AuthenticationCredential'],\n integrationInterface: SKL_SPECS['integration/IntegrationInterface']\n },\n prop: {\n capability: SKL_PROPERTY.capability,\n inputs: SKL_PROPERTY.inputs,\n outputs: SKL_PROPERTY.outputs,\n inputsContext: SKL_PROPERTY.inputsContext,\n outputsContext: SKL_PROPERTY.outputsContext,\n invalidTokenErrorMatcher: SKL_PROPERTY['integration/invalidTokenErrorMatcher'],\n invalidTokenErrorMatcherStatus: SKL_PROPERTY['integration/invalidTokenErrorMatcherStatus'],\n invalidTokenErrorMatcherMessageRegex: SKL_PROPERTY['integration/invalidTokenErrorMatcherMessageRegex'],\n refreshToken: SKL_PROPERTY['integration/credential/refreshToken'],\n jwtBearerOptions: SKL_PROPERTY['integration/credential/jwtBearerOptions'],\n accessToken: SKL_PROPERTY['integration/credential/accessToken'],\n bearerToken: SKL_PROPERTY['integration/credential/bearerToken'],\n username: SKL_PROPERTY['integration/username'],\n password: SKL_PROPERTY['integration/password'],\n oneTimePassword: SKL_PROPERTY['integration/oneTimePassword'],\n apiKey: SKL_PROPERTY['integration/apiKey'],\n declarativeApiDescription: SKL_PROPERTY['integration/declarativeApiDescription'],\n overrideBasePath: SKL_PROPERTY['integration/overrideBasePath'],\n schemeName: SKL_PROPERTY['integration/schemeName'],\n oauthFlow: SKL_PROPERTY['integration/oauthFlow'],\n stage: SKL_PROPERTY['integration/stage'],\n operationId: SKL_PROPERTY.operationId,\n\n data: SKL_PROPERTY.data,\n source: SKL_PROPERTY.source,\n headers: SKL_PROPERTY.headers,\n object: SKL_PROPERTY.object,\n dataSource: SKL_PROPERTY.dataSource,\n\n series: SKL_PROPERTY['mapping/series'],\n parallel: SKL_PROPERTY['mapping/parallel'],\n inputsReference: SKL_PROPERTY['mapping/inputsReference'],\n inputsMapping: SKL_PROPERTY['mapping/inputsMapping'],\n inputsMappingFrame: SKL_PROPERTY['mapping/inputsMappingFrame'],\n inputsMappingRef: SKL_PROPERTY['mapping/inputsMappingRef'],\n inputsMappingFrameRef: SKL_PROPERTY['mapping/inputsMappingFrameRef'],\n outputsMapping: SKL_PROPERTY['mapping/outputsMapping'],\n outputsMappingFrame: SKL_PROPERTY['mapping/outputsMappingFrame'],\n preProcessingMapping: SKL_PROPERTY['mapping/preProcessingMapping'],\n preProcessingMappingFrame: SKL_PROPERTY['mapping/preProcessingMappingFrame'],\n operationMapping: SKL_PROPERTY['mapping/operationMapping'],\n\n type: SKL_PROPERTY.type,\n dateCreated: SKL_PROPERTY.dateTimeCreated,\n dateModified: SKL_PROPERTY.dateTimeModified,\n label: SKL_PROPERTY.label,\n identifier: SKL_PROPERTY.identifier,\n codeBody: SKL_PROPERTY['content/codeBody'],\n codeBlocks: SKL_PROPERTY['content/codeBlocks'],\n integration: SKL_PROPERTY['integration/integration'],\n accountOrUser: SKL_PROPERTY.accountOrUser,\n\n capabilityType: SKL_PROPERTY.capabilityType\n },\n dataSource: {\n update: SKL_ENGINE.update,\n findAll: SKL_ENGINE.findAll,\n findAllBy: SKL_ENGINE.findAllBy,\n find: SKL_ENGINE.find,\n findBy: SKL_ENGINE.findBy,\n exists: SKL_ENGINE.exists,\n existsResult: SKL_ENGINE.existsResult,\n count: SKL_ENGINE.count,\n countResult: SKL_ENGINE.countResult,\n save: SKL_ENGINE.save,\n destroy: SKL_ENGINE.destroy\n }\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,sDAO6B;AAC7B,uDAKoC;AAEvB,QAAA,aAAa,GAAG,4BAAmB,CAAC;AACpC,QAAA,kBAAkB,GAAG,iCAAwB,CAAC;AAC9C,QAAA,oBAAoB,GAAG,mCAA0B,CAAC;AAElD,QAAA,GAAG,GAAG,YAAS,CAAC;AAChB,QAAA,GAAG,GAAG,YAAS,CAAC;AAChB,QAAA,IAAI,GAAG,aAAU,CAAC;AAClB,QAAA,KAAK,GAAG,cAAW,CAAC;AACpB,QAAA,GAAG,GAAG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from './util/Vocabularies';\nimport {\n OWL as OWL_VOCAB,\n R2RML as R2RML_VOCAB,\n RDF as RDF_VOCAB,\n RDFS as RDFS_VOCAB, SHACL as SHACL_VOCAB, SHACL_NAMESPACE as SHACL_NAMESPACE_VOCAB, XSD as XSD_VOCAB\n} from './util/Vocabularies/Shared';\n\nexport const SKL_NAMESPACE = SKL_NAMESPACE_VOCAB;\nexport const SKL_DATA_NAMESPACE = SKL_DATA_NAMESPACE_VOCAB;\nexport const SKL_ENGINE_NAMESPACE = SKL_ENGINE_NAMESPACE_VOCAB;\n\nexport const OWL = OWL_VOCAB;\nexport const RDF = RDF_VOCAB;\nexport const RDFS = RDFS_VOCAB;\nexport const R2RML = R2RML_VOCAB;\nexport const XSD = XSD_VOCAB;\nexport const SHACL = SHACL_VOCAB;\nexport const SHACL_NAMESPACE = SHACL_NAMESPACE_VOCAB;\nexport const PROP_ENTITY_ID = '@id';\nexport const PROP_ENTITY_TYPE = '@type';\nexport const PROP_ENTITY_VALUE = '@value';\n\n// RML constants\n\nexport const RML_LIST = '@list';\n\nexport const OPEN_API_RUNTIME_AUTHORIZATION = 'getOpenApiRuntimeAuthorization';\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const EngineConstants = {\n spec: {\n capability: SKL_SPECS.Capability,\n capabilityMapping: SKL_SPECS.CapabilityMapping,\n triggerCapabilityMapping: SKL_SPECS.TriggerCapabilityMapping,\n invalidTokenErrorMatcher: SKL_SPECS['integration/InvalidTokenErrorMatcher'],\n jsonDataSource: SKL_SPECS.JsonDataSource,\n mapping: SKL_SPECS.Mapping,\n inputs: SKL_SPECS.Inputs,\n openApi: SKL_SPECS.OpenAPI,\n codeBlock: SKL_SPECS.CodeBlock,\n integrationAuthenticationCredential: SKL_SPECS['integration/AuthenticationCredential'],\n integrationInterface: SKL_SPECS['integration/IntegrationInterface']\n },\n prop: {\n capability: SKL_PROPERTY.capability,\n inputs: SKL_PROPERTY.inputs,\n outputs: SKL_PROPERTY.outputs,\n inputsContext: SKL_PROPERTY.inputsContext,\n outputsContext: SKL_PROPERTY.outputsContext,\n invalidTokenErrorMatcher: SKL_PROPERTY['integration/invalidTokenErrorMatcher'],\n invalidTokenErrorMatcherStatus: SKL_PROPERTY['integration/invalidTokenErrorMatcherStatus'],\n invalidTokenErrorMatcherMessageRegex: SKL_PROPERTY['integration/invalidTokenErrorMatcherMessageRegex'],\n refreshCapability: SKL_PROPERTY['integration/refreshCapability'],\n refreshToken: SKL_PROPERTY['integration/credential/refreshToken'],\n jwtBearerOptions: SKL_PROPERTY['integration/credential/jwtBearerOptions'],\n accessToken: SKL_PROPERTY['integration/credential/accessToken'],\n bearerToken: SKL_PROPERTY['integration/credential/bearerToken'],\n username: SKL_PROPERTY['integration/username'],\n password: SKL_PROPERTY['integration/password'],\n oneTimePassword: SKL_PROPERTY['integration/oneTimePassword'],\n apiKey: SKL_PROPERTY['integration/apiKey'],\n declarativeApiDescription: SKL_PROPERTY['integration/declarativeApiDescription'],\n overrideBasePath: SKL_PROPERTY['integration/overrideBasePath'],\n schemeName: SKL_PROPERTY['integration/schemeName'],\n oauthFlow: SKL_PROPERTY['integration/oauthFlow'],\n stage: SKL_PROPERTY['integration/stage'],\n operationId: SKL_PROPERTY.operationId,\n\n data: SKL_PROPERTY.data,\n source: SKL_PROPERTY.source,\n headers: SKL_PROPERTY.headers,\n object: SKL_PROPERTY.object,\n dataSource: SKL_PROPERTY.dataSource,\n\n series: SKL_PROPERTY['mapping/series'],\n parallel: SKL_PROPERTY['mapping/parallel'],\n inputsReference: SKL_PROPERTY['mapping/inputsReference'],\n inputsMapping: SKL_PROPERTY['mapping/inputsMapping'],\n inputsMappingFrame: SKL_PROPERTY['mapping/inputsMappingFrame'],\n inputsMappingRef: SKL_PROPERTY['mapping/inputsMappingRef'],\n inputsMappingFrameRef: SKL_PROPERTY['mapping/inputsMappingFrameRef'],\n outputsMapping: SKL_PROPERTY['mapping/outputsMapping'],\n outputsMappingFrame: SKL_PROPERTY['mapping/outputsMappingFrame'],\n preProcessingMapping: SKL_PROPERTY['mapping/preProcessingMapping'],\n preProcessingMappingFrame: SKL_PROPERTY['mapping/preProcessingMappingFrame'],\n operationMapping: SKL_PROPERTY['mapping/operationMapping'],\n\n type: SKL_PROPERTY.type,\n dateCreated: SKL_PROPERTY.dateTimeCreated,\n dateModified: SKL_PROPERTY.dateTimeModified,\n label: SKL_PROPERTY.label,\n identifier: SKL_PROPERTY.identifier,\n codeBody: SKL_PROPERTY['content/codeBody'],\n codeBlocks: SKL_PROPERTY['content/codeBlocks'],\n integration: SKL_PROPERTY['integration/integration'],\n accountOrUser: SKL_PROPERTY.accountOrUser,\n\n capabilityType: SKL_PROPERTY.capabilityType\n },\n dataSource: {\n update: SKL_ENGINE.update,\n findAll: SKL_ENGINE.findAll,\n findAllBy: SKL_ENGINE.findAllBy,\n find: SKL_ENGINE.find,\n findBy: SKL_ENGINE.findBy,\n exists: SKL_ENGINE.exists,\n existsResult: SKL_ENGINE.existsResult,\n count: SKL_ENGINE.count,\n countResult: SKL_ENGINE.countResult,\n save: SKL_ENGINE.save,\n destroy: SKL_ENGINE.destroy\n }\n};\n"]}
@@ -3,6 +3,6 @@ export declare const SKL_NAMESPACE = "https://skl.ai/";
3
3
  export declare const SKL_DATA_NAMESPACE = "https://skl.ai/d/";
4
4
  export declare const SKL_ENGINE_NAMESPACE = "https://skl.ai/skl-engine/";
5
5
  export declare const SKL_SPECS: import("./helper").Namespace<"Capability" | "CapabilityMapping" | "TriggerCapabilityMapping" | "integration/InvalidTokenErrorMatcher" | "JsonDataSource" | "Mapping" | "Inputs" | "OpenAPI" | "CodeBlock" | "integration/AuthenticationCredential" | "integration/IntegrationInterface", "https://skl.ai/">;
6
- export declare const SKL_PROPERTY: import("./helper").Namespace<"object" | "type" | "label" | "capabilityType" | "capability" | "inputs" | "outputs" | "inputsContext" | "outputsContext" | "integration/invalidTokenErrorMatcher" | "integration/invalidTokenErrorMatcherStatus" | "integration/invalidTokenErrorMatcherMessageRegex" | "integration/credential/refreshToken" | "integration/credential/jwtBearerOptions" | "integration/credential/accessToken" | "integration/credential/bearerToken" | "integration/username" | "integration/password" | "integration/oneTimePassword" | "integration/apiKey" | "integration/declarativeApiDescription" | "integration/overrideBasePath" | "integration/schemeName" | "integration/oauthFlow" | "integration/stage" | "operationId" | "data" | "source" | "dataSource" | "headers" | "mapping/series" | "mapping/parallel" | "mapping/inputsReference" | "mapping/inputsMapping" | "mapping/inputsMappingFrame" | "mapping/inputsMappingRef" | "mapping/inputsMappingFrameRef" | "mapping/outputsMapping" | "mapping/outputsMappingFrame" | "mapping/preProcessingMapping" | "mapping/preProcessingMappingFrame" | "mapping/operationMapping" | "dateTimeCreated" | "dateTimeModified" | "identifier" | "content/codeBody" | "integration/integration" | "accountOrUser" | "content/codeBlocks", "https://skl.ai/">;
6
+ export declare const SKL_PROPERTY: import("./helper").Namespace<"object" | "type" | "label" | "capabilityType" | "capability" | "inputs" | "outputs" | "inputsContext" | "outputsContext" | "integration/invalidTokenErrorMatcher" | "integration/invalidTokenErrorMatcherStatus" | "integration/invalidTokenErrorMatcherMessageRegex" | "integration/refreshCapability" | "integration/credential/refreshToken" | "integration/credential/jwtBearerOptions" | "integration/credential/accessToken" | "integration/credential/bearerToken" | "integration/username" | "integration/password" | "integration/oneTimePassword" | "integration/apiKey" | "integration/declarativeApiDescription" | "integration/overrideBasePath" | "integration/schemeName" | "integration/oauthFlow" | "integration/stage" | "operationId" | "data" | "source" | "dataSource" | "headers" | "mapping/series" | "mapping/parallel" | "mapping/inputsReference" | "mapping/inputsMapping" | "mapping/inputsMappingFrame" | "mapping/inputsMappingRef" | "mapping/inputsMappingFrameRef" | "mapping/outputsMapping" | "mapping/outputsMappingFrame" | "mapping/preProcessingMapping" | "mapping/preProcessingMappingFrame" | "mapping/operationMapping" | "dateTimeCreated" | "dateTimeModified" | "identifier" | "content/codeBody" | "integration/integration" | "accountOrUser" | "content/codeBlocks", "https://skl.ai/">;
7
7
  export declare const SKL_ENGINE: import("./helper").Namespace<"update" | "findAll" | "findAllBy" | "find" | "findBy" | "exists" | "existsResult" | "count" | "countResult" | "save" | "destroy", "https://skl.ai/skl-engine/">;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/Vocabularies/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAEjE,eAAO,MAAM,SAAS,6SAYpB,CAAC;AAEH,eAAO,MAAM,YAAY,swCA0DvB,CAAC;AAeH,eAAO,MAAM,UAAU,+LAYrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/Vocabularies/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAEjE,eAAO,MAAM,SAAS,6SAYpB,CAAC;AAEH,eAAO,MAAM,YAAY,wyCA2DvB,CAAC;AAeH,eAAO,MAAM,UAAU,+LAYrB,CAAC"}
@@ -45,6 +45,7 @@ exports.SKL_PROPERTY = (0, helper_1.createNamespace)(exports.SKL_NAMESPACE, [
45
45
  'integration/invalidTokenErrorMatcher',
46
46
  'integration/invalidTokenErrorMatcherStatus',
47
47
  'integration/invalidTokenErrorMatcherMessageRegex',
48
+ 'integration/refreshCapability',
48
49
  'integration/credential/refreshToken',
49
50
  'integration/credential/jwtBearerOptions',
50
51
  'integration/credential/accessToken',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/Vocabularies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA2C;AAE3C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;AAC9B,MAAM;AAEN,gGAAgG;AAChG,qHAAqH;AAExG,QAAA,UAAU,GAAG,IAAA,wBAAe,EAAC,4BAAoB,EAAE;IAC9D,QAAQ;IACR,SAAS;IACT,WAAW;IACX,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,OAAO;IACP,aAAa;IACb,MAAM;IACN,SAAS;CACV,CAAC,CAAC","sourcesContent":["import { createNamespace } from './helper';\n\nexport * from './Shared';\n\nexport const SKL_NAMESPACE = 'https://skl.ai/';\nexport const SKL_DATA_NAMESPACE = 'https://skl.ai/d/';\nexport const SKL_ENGINE_NAMESPACE = 'https://skl.ai/skl-engine/';\n\nexport const SKL_SPECS = createNamespace(SKL_NAMESPACE, [\n 'Capability',\n 'CapabilityMapping',\n 'TriggerCapabilityMapping',\n 'integration/InvalidTokenErrorMatcher',\n 'JsonDataSource',\n 'Mapping',\n 'Inputs',\n 'OpenAPI',\n 'CodeBlock',\n 'integration/AuthenticationCredential',\n 'integration/IntegrationInterface'\n]);\n\nexport const SKL_PROPERTY = createNamespace(SKL_NAMESPACE, [\n\n // Review\n 'capabilityType',\n\n // Updated\n 'capability',\n 'inputs',\n 'outputs',\n 'inputsContext',\n 'outputsContext',\n\n 'integration/invalidTokenErrorMatcher',\n 'integration/invalidTokenErrorMatcherStatus',\n 'integration/invalidTokenErrorMatcherMessageRegex',\n 'integration/credential/refreshToken',\n 'integration/credential/jwtBearerOptions',\n 'integration/credential/accessToken',\n 'integration/credential/bearerToken',\n 'integration/username',\n 'integration/password',\n 'integration/oneTimePassword',\n 'integration/apiKey',\n 'integration/declarativeApiDescription',\n 'integration/overrideBasePath',\n 'integration/schemeName',\n 'integration/oauthFlow',\n 'integration/stage',\n 'operationId',\n\n 'data',\n 'source',\n 'dataSource',\n 'headers',\n 'object',\n\n 'mapping/series',\n 'mapping/parallel',\n 'mapping/inputsReference',\n 'mapping/inputsMapping',\n 'mapping/inputsMappingFrame',\n 'mapping/inputsMappingRef',\n 'mapping/inputsMappingFrameRef',\n 'mapping/outputsMapping',\n 'mapping/outputsMappingFrame',\n 'mapping/preProcessingMapping',\n 'mapping/preProcessingMappingFrame',\n 'mapping/operationMapping',\n\n 'type',\n 'dateTimeCreated',\n 'dateTimeModified',\n 'label',\n 'identifier',\n 'content/codeBody',\n 'integration/integration',\n 'accountOrUser',\n 'content/codeBlocks'\n]);\n\n// Export const SKLSO_INTEGRATION_NAMESPACE = 'https://skl.so/integration/';\n// Export const SKLSO_INTEGRATION = createNamespace(SKLSO_INTEGRATION_NAMESPACE, [\n// 'integration',\n// 'account',\n// 'credential',\n// 'interface',\n// 'username',\n// 'AuthenticationCredential',\n// ]);\n\n// export const SKLSO_INTEGRATION_INTERFACE_NAMESPACE = 'https://skl.so/integration/interface/';\n// export const SKLSO_INTEGRATION_INTERFACE = createNamespace(SKLSO_INTEGRATION_INTERFACE_NAMESPACE, ['RESTfulApi']);\n\nexport const SKL_ENGINE = createNamespace(SKL_ENGINE_NAMESPACE, [\n 'update',\n 'findAll',\n 'findAllBy',\n 'find',\n 'findBy',\n 'exists',\n 'existsResult',\n 'count',\n 'countResult',\n 'save',\n 'destroy'\n]);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/Vocabularies/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA2C;AAE3C,2CAAyB;AAEZ,QAAA,aAAa,GAAG,iBAAiB,CAAC;AAClC,QAAA,kBAAkB,GAAG,mBAAmB,CAAC;AACzC,QAAA,oBAAoB,GAAG,4BAA4B,CAAC;AAEpD,QAAA,SAAS,GAAG,IAAA,wBAAe,EAAC,qBAAa,EAAE;IACtD,YAAY;IACZ,mBAAmB;IACnB,0BAA0B;IAC1B,sCAAsC;IACtC,gBAAgB;IAChB,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;IACX,sCAAsC;IACtC,kCAAkC;CACnC,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,IAAA,wBAAe,EAAC,qBAAa,EAAE;IAEzD,SAAS;IACT,gBAAgB;IAEhB,UAAU;IACV,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,eAAe;IACf,gBAAgB;IAEhB,sCAAsC;IACtC,4CAA4C;IAC5C,kDAAkD;IAClD,+BAA+B;IAC/B,qCAAqC;IACrC,yCAAyC;IACzC,oCAAoC;IACpC,oCAAoC;IACpC,sBAAsB;IACtB,sBAAsB;IACtB,6BAA6B;IAC7B,oBAAoB;IACpB,uCAAuC;IACvC,8BAA8B;IAC9B,wBAAwB;IACxB,uBAAuB;IACvB,mBAAmB;IACnB,aAAa;IAEb,MAAM;IACN,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,QAAQ;IAER,gBAAgB;IAChB,kBAAkB;IAClB,yBAAyB;IACzB,uBAAuB;IACvB,4BAA4B;IAC5B,0BAA0B;IAC1B,+BAA+B;IAC/B,wBAAwB;IACxB,6BAA6B;IAC7B,8BAA8B;IAC9B,mCAAmC;IACnC,0BAA0B;IAE1B,MAAM;IACN,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,YAAY;IACZ,kBAAkB;IAClB,yBAAyB;IACzB,eAAe;IACf,oBAAoB;CACrB,CAAC,CAAC;AAEH,4EAA4E;AAC5E,kFAAkF;AAClF,iBAAiB;AACjB,aAAa;AACb,gBAAgB;AAChB,eAAe;AACf,cAAc;AACd,8BAA8B;AAC9B,MAAM;AAEN,gGAAgG;AAChG,qHAAqH;AAExG,QAAA,UAAU,GAAG,IAAA,wBAAe,EAAC,4BAAoB,EAAE;IAC9D,QAAQ;IACR,SAAS;IACT,WAAW;IACX,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,OAAO;IACP,aAAa;IACb,MAAM;IACN,SAAS;CACV,CAAC,CAAC","sourcesContent":["import { createNamespace } from './helper';\n\nexport * from './Shared';\n\nexport const SKL_NAMESPACE = 'https://skl.ai/';\nexport const SKL_DATA_NAMESPACE = 'https://skl.ai/d/';\nexport const SKL_ENGINE_NAMESPACE = 'https://skl.ai/skl-engine/';\n\nexport const SKL_SPECS = createNamespace(SKL_NAMESPACE, [\n 'Capability',\n 'CapabilityMapping',\n 'TriggerCapabilityMapping',\n 'integration/InvalidTokenErrorMatcher',\n 'JsonDataSource',\n 'Mapping',\n 'Inputs',\n 'OpenAPI',\n 'CodeBlock',\n 'integration/AuthenticationCredential',\n 'integration/IntegrationInterface'\n]);\n\nexport const SKL_PROPERTY = createNamespace(SKL_NAMESPACE, [\n\n // Review\n 'capabilityType',\n\n // Updated\n 'capability',\n 'inputs',\n 'outputs',\n 'inputsContext',\n 'outputsContext',\n\n 'integration/invalidTokenErrorMatcher',\n 'integration/invalidTokenErrorMatcherStatus',\n 'integration/invalidTokenErrorMatcherMessageRegex',\n 'integration/refreshCapability',\n 'integration/credential/refreshToken',\n 'integration/credential/jwtBearerOptions',\n 'integration/credential/accessToken',\n 'integration/credential/bearerToken',\n 'integration/username',\n 'integration/password',\n 'integration/oneTimePassword',\n 'integration/apiKey',\n 'integration/declarativeApiDescription',\n 'integration/overrideBasePath',\n 'integration/schemeName',\n 'integration/oauthFlow',\n 'integration/stage',\n 'operationId',\n\n 'data',\n 'source',\n 'dataSource',\n 'headers',\n 'object',\n\n 'mapping/series',\n 'mapping/parallel',\n 'mapping/inputsReference',\n 'mapping/inputsMapping',\n 'mapping/inputsMappingFrame',\n 'mapping/inputsMappingRef',\n 'mapping/inputsMappingFrameRef',\n 'mapping/outputsMapping',\n 'mapping/outputsMappingFrame',\n 'mapping/preProcessingMapping',\n 'mapping/preProcessingMappingFrame',\n 'mapping/operationMapping',\n\n 'type',\n 'dateTimeCreated',\n 'dateTimeModified',\n 'label',\n 'identifier',\n 'content/codeBody',\n 'integration/integration',\n 'accountOrUser',\n 'content/codeBlocks'\n]);\n\n// Export const SKLSO_INTEGRATION_NAMESPACE = 'https://skl.so/integration/';\n// Export const SKLSO_INTEGRATION = createNamespace(SKLSO_INTEGRATION_NAMESPACE, [\n// 'integration',\n// 'account',\n// 'credential',\n// 'interface',\n// 'username',\n// 'AuthenticationCredential',\n// ]);\n\n// export const SKLSO_INTEGRATION_INTERFACE_NAMESPACE = 'https://skl.so/integration/interface/';\n// export const SKLSO_INTEGRATION_INTERFACE = createNamespace(SKLSO_INTEGRATION_INTERFACE_NAMESPACE, ['RESTfulApi']);\n\nexport const SKL_ENGINE = createNamespace(SKL_ENGINE_NAMESPACE, [\n 'update',\n 'findAll',\n 'findAllBy',\n 'find',\n 'findBy',\n 'exists',\n 'existsResult',\n 'count',\n 'countResult',\n 'save',\n 'destroy'\n]);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comake/skl-js-engine",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Standard Knowledge Language Javascript Engine",
5
5
  "keywords": [
6
6
  "skl",
package/src/SklEngine.ts CHANGED
@@ -1332,6 +1332,27 @@ export class SKLEngine implements SKLEngineInterface {
1332
1332
  })) as Capability;
1333
1333
  }
1334
1334
 
1335
+ private async findRefreshCapabilityForIntegration(integrationId: string): Promise<Capability> {
1336
+ const integration = await this.findByIfExists({ id: integrationId });
1337
+ const configuredRefreshCapability = integration?.[EngineConstants.prop.refreshCapability];
1338
+ if (configuredRefreshCapability) {
1339
+ const refreshCapabilityId = getIdFromNodeObjectIfDefined(
1340
+ configuredRefreshCapability as string | ReferenceNodeObject
1341
+ );
1342
+ if (!refreshCapabilityId) {
1343
+ throw new Error(`Integration ${integrationId} has an invalid refresh capability reference.`);
1344
+ }
1345
+ const refreshCapability = (await this.findByIfExists({ id: refreshCapabilityId })) as Capability | undefined;
1346
+ if (!refreshCapability) {
1347
+ throw new Error(
1348
+ `Refresh capability ${refreshCapabilityId} configured for integration ${integrationId} was not found.`
1349
+ );
1350
+ }
1351
+ return refreshCapability;
1352
+ }
1353
+ return await this.findCapabilityWithName('getOauthTokens');
1354
+ }
1355
+
1335
1356
  private async getRuntimeCredentialsWithSecurityCredentials(
1336
1357
  securityCredentials: Entity,
1337
1358
  integrationId: string,
@@ -1500,7 +1521,8 @@ export class SKLEngine implements SKLEngineInterface {
1500
1521
  const refreshedConfiguration = await this.refreshSecurityCredentials(
1501
1522
  securityCredentials,
1502
1523
  integratedProductId,
1503
- account
1524
+ account,
1525
+ capabilityConfig
1504
1526
  );
1505
1527
  response = await openApiExecutor.executeOperation(
1506
1528
  operationId,
@@ -1569,20 +1591,20 @@ export class SKLEngine implements SKLEngineInterface {
1569
1591
  account: Entity,
1570
1592
  capabilityConfig?: CapabilityConfig
1571
1593
  ): Promise<OpenApiClientConfiguration> {
1572
- const getOauthTokenCapability = (await this.findBy({
1573
- type: EngineConstants.spec.capability,
1574
- [EngineConstants.prop.label]: 'getOauthTokens'
1575
- })) as Capability;
1576
- const mapping = await this.findCapabilityIntegrationMapping(getOauthTokenCapability[PROP_ENTITY_ID], integrationId);
1594
+ const refreshCapability = await this.findRefreshCapabilityForIntegration(integrationId);
1595
+ const mapping = await this.findCapabilityIntegrationMapping(refreshCapability[PROP_ENTITY_ID], integrationId);
1577
1596
  if (!mapping) {
1578
1597
  throw new Error(
1579
- `No mapping found for capability ${getOauthTokenCapability[PROP_ENTITY_ID]} and integration ${integrationId}`
1598
+ `No mapping found for capability ${refreshCapability[PROP_ENTITY_ID]} and integration ${integrationId}`
1580
1599
  );
1581
1600
  }
1582
1601
  const args = {
1583
1602
  refreshToken: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.refreshToken])!,
1584
- jwtBearerOptions: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.jwtBearerOptions])!
1585
- };
1603
+ jwtBearerOptions: getValueIfDefined<string>(securityCredentials[EngineConstants.prop.jwtBearerOptions])!,
1604
+ securityCredentials: securityCredentials as unknown as JSONValue,
1605
+ account: account as unknown as JSONValue,
1606
+ integrationId
1607
+ } as JSONObject;
1586
1608
  const operationArgs = await this.performParameterMappingOnArgsIfDefined(args, mapping, capabilityConfig, true);
1587
1609
  const operationInfoJsonLd = await this.performOperationMappingWithArgs({}, mapping, capabilityConfig);
1588
1610
  const rawReturnValue = await this.performOperation(
@@ -1598,7 +1620,7 @@ export class SKLEngine implements SKLEngineInterface {
1598
1620
  mapping as MappingWithOutputsMapping,
1599
1621
  capabilityConfig
1600
1622
  );
1601
- await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, getOauthTokenCapability);
1623
+ await this.assertCapabilityReturnValueMatchesReturnTypeSchema(mappedReturnValue, refreshCapability);
1602
1624
  const bearerToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.bearerToken]);
1603
1625
  const accessToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.accessToken]);
1604
1626
  const refreshToken = getValueIfDefined<string>(mappedReturnValue[EngineConstants.prop.refreshToken]);
package/src/constants.ts CHANGED
@@ -58,6 +58,7 @@ export const EngineConstants = {
58
58
  invalidTokenErrorMatcher: SKL_PROPERTY['integration/invalidTokenErrorMatcher'],
59
59
  invalidTokenErrorMatcherStatus: SKL_PROPERTY['integration/invalidTokenErrorMatcherStatus'],
60
60
  invalidTokenErrorMatcherMessageRegex: SKL_PROPERTY['integration/invalidTokenErrorMatcherMessageRegex'],
61
+ refreshCapability: SKL_PROPERTY['integration/refreshCapability'],
61
62
  refreshToken: SKL_PROPERTY['integration/credential/refreshToken'],
62
63
  jwtBearerOptions: SKL_PROPERTY['integration/credential/jwtBearerOptions'],
63
64
  accessToken: SKL_PROPERTY['integration/credential/accessToken'],
@@ -35,6 +35,7 @@ export const SKL_PROPERTY = createNamespace(SKL_NAMESPACE, [
35
35
  'integration/invalidTokenErrorMatcher',
36
36
  'integration/invalidTokenErrorMatcherStatus',
37
37
  'integration/invalidTokenErrorMatcherMessageRegex',
38
+ 'integration/refreshCapability',
38
39
  'integration/credential/refreshToken',
39
40
  'integration/credential/jwtBearerOptions',
40
41
  'integration/credential/accessToken',