quidproquo-core 0.0.243 → 0.0.245

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.
Files changed (31) hide show
  1. package/lib/commonjs/config/settings/actionProcessors.js +2 -1
  2. package/lib/commonjs/qpqCoreUtils.d.ts +0 -5
  3. package/lib/commonjs/qpqCoreUtils.js +8 -37
  4. package/lib/commonjs/stories/askProcessEvent.js +12 -5
  5. package/lib/commonjs/types/QpqFunctionRuntime.d.ts +9 -5
  6. package/lib/commonjs/utils/path/getUniqueKeyFromQpqFunctionRuntime.d.ts +2 -0
  7. package/lib/commonjs/utils/path/getUniqueKeyFromQpqFunctionRuntime.js +11 -0
  8. package/lib/commonjs/utils/path/index.d.ts +3 -1
  9. package/lib/commonjs/utils/path/index.js +3 -1
  10. package/lib/commonjs/utils/path/isQpqFunctionRuntimeAbsolutePath.d.ts +2 -0
  11. package/lib/commonjs/utils/path/isQpqFunctionRuntimeAbsolutePath.js +7 -0
  12. package/lib/commonjs/utils/path/isQpqFunctionRuntimeRelativePath.d.ts +2 -0
  13. package/lib/commonjs/utils/path/isQpqFunctionRuntimeRelativePath.js +7 -0
  14. package/lib/esm/config/settings/actionProcessors.js +2 -1
  15. package/lib/esm/qpqCoreUtils.d.ts +0 -5
  16. package/lib/esm/qpqCoreUtils.js +7 -31
  17. package/lib/esm/stories/askProcessEvent.js +8 -1
  18. package/lib/esm/types/QpqFunctionRuntime.d.ts +9 -5
  19. package/lib/esm/utils/path/getUniqueKeyFromQpqFunctionRuntime.d.ts +2 -0
  20. package/lib/esm/utils/path/getUniqueKeyFromQpqFunctionRuntime.js +7 -0
  21. package/lib/esm/utils/path/index.d.ts +3 -1
  22. package/lib/esm/utils/path/index.js +3 -1
  23. package/lib/esm/utils/path/isQpqFunctionRuntimeAbsolutePath.d.ts +2 -0
  24. package/lib/esm/utils/path/isQpqFunctionRuntimeAbsolutePath.js +3 -0
  25. package/lib/esm/utils/path/isQpqFunctionRuntimeRelativePath.d.ts +2 -0
  26. package/lib/esm/utils/path/isQpqFunctionRuntimeRelativePath.js +3 -0
  27. package/package.json +3 -4
  28. package/lib/commonjs/utils/path/joinPaths.d.ts +0 -1
  29. package/lib/commonjs/utils/path/joinPaths.js +0 -8
  30. package/lib/esm/utils/path/joinPaths.d.ts +0 -1
  31. package/lib/esm/utils/path/joinPaths.js +0 -4
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defineActionProcessors = void 0;
4
+ const utils_1 = require("../../utils");
4
5
  const QPQConfig_1 = require("../QPQConfig");
5
6
  const defineActionProcessors = (getActionProcessors) => ({
6
7
  configSettingType: QPQConfig_1.QPQCoreConfigSettingType.actionProcessors,
7
- uniqueKey: getActionProcessors,
8
+ uniqueKey: (0, utils_1.getUniqueKeyFromQpqFunctionRuntime)(getActionProcessors),
8
9
  runtime: getActionProcessors,
9
10
  });
10
11
  exports.defineActionProcessors = defineActionProcessors;
@@ -68,9 +68,6 @@ export declare const getQueueSrcEntries: (configs: QPQConfig) => QpqFunctionRunt
68
68
  export declare const getUserDirectorySrcEntries: (qpqConfig: QPQConfig) => QpqFunctionRuntime[];
69
69
  export declare const getAllSrcEntries: (qpqConfig: QPQConfig) => QpqFunctionRuntime[];
70
70
  export declare const getApiBuildPath: (qpqConfig: QPQConfig) => string;
71
- export declare const getSrcPathFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
72
- export declare function getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash(runtime: QpqFunctionRuntime): string;
73
- export declare const getFullSrcPathFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime, qpqConfig: QPQConfig, configRootOverride?: string) => string;
74
71
  export declare const getStoryNameFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
75
72
  export declare const getSrcFilenameFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
76
73
  export declare const getSecretByName: (secretName: string, qpqConfig: QPQConfig) => SecretQPQConfigSetting;
@@ -84,8 +81,6 @@ export declare const getAllParameterConfigs: (qpqConfig: QPQConfig) => Parameter
84
81
  export declare const getParameterConfig: (name: string, qpqConfig: QPQConfig) => ParameterQPQConfigSetting;
85
82
  export declare const getOwnedParameterConfigs: (qpqConfig: QPQConfig) => ParameterQPQConfigSetting[];
86
83
  export declare const getUniqueKeyForSetting: (setting: QPQConfigSetting) => string;
87
- export declare const getStorageDriveUploadFullPath: (qpqConfig: QPQConfig, storageDriveConfig: StorageDriveQPQConfigSetting) => string;
88
- export declare const getApiBuildPathFullPath: (qpqConfig: QPQConfig) => string;
89
84
  export declare const getQueueQueueProcessors: (name: string, qpqConfig: QPQConfig) => QpqQueueProcessors;
90
85
  export declare const convertCrossModuleOwnerToGenericResourceNameOverride: <T extends string>(owner?: CrossModuleOwner<T> | undefined) => CrossModuleOwner<'resourceNameOverride'> | undefined;
91
86
  export declare const convertCustomFullyQualifiedResourceToGeneric: <T extends string>(resource: CustomFullyQualifiedResource<T>) => FullyQualifiedResource;
@@ -11,8 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getAllParameterConfigs = exports.getUserDirectoryByName = exports.getOwnedUserDirectories = exports.getUserDirectories = exports.getGlobalConfigValue = exports.getOwnedSecrets = exports.getAllSecretConfigs = exports.getSecretByName = exports.getSrcFilenameFromQpqFunctionRuntime = exports.getStoryNameFromQpqFunctionRuntime = exports.getFullSrcPathFromQpqFunctionRuntime = exports.getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash = exports.getSrcPathFromQpqFunctionRuntime = exports.getApiBuildPath = exports.getAllSrcEntries = exports.getUserDirectorySrcEntries = exports.getQueueSrcEntries = exports.getScheduleEvents = exports.getUserDirectoryEmailTemplates = exports.getActionProcessorSources = exports.getKeyValueStoreByName = exports.resolveCrossServiceResourceName = exports.getOwnedStorageDrives = exports.getOwnedGraphDatabases = exports.getOwnedKeyValueStores = exports.getVirualNetworkConfigs = exports.getDeployEventConfigs = exports.getAllGraphDatabaseConfigs = exports.getAllKeyValueStores = exports.getOwnedItems = exports.getEventBusConfigByName = exports.getOwnedEventBusConfigs = exports.getAllClaudeAiConfigs = exports.getAllEventBusConfigs = exports.getStorageDriveNames = exports.getQueueByName = exports.getNotifyErrorConfigs = exports.getQueues = exports.getStorageDriveByName = exports.getStorageDrives = exports.getApplicationModuleEnvironment = exports.getConfigRoot = exports.getApplicationModuleFeature = exports.getApplicationName = exports.getApplicationConfigRoot = exports.getApplicationModuleName = exports.getApplicationConfigSetting = exports.getConfigSetting = exports.getConfigSettings = exports.flattenQpqConfig = void 0;
15
- exports.getFullUrlFromConfigUrl = exports.isSameResource = exports.getKeyValueStoreFullyQualifiedResourceName = exports.getFullyQualifiedResourceName = exports.convertCustomFullyQualifiedResourceToGeneric = exports.convertCrossModuleOwnerToGenericResourceNameOverride = exports.getQueueQueueProcessors = exports.getApiBuildPathFullPath = exports.getStorageDriveUploadFullPath = exports.getUniqueKeyForSetting = exports.getOwnedParameterConfigs = exports.getParameterConfig = void 0;
14
+ exports.getUniqueKeyForSetting = exports.getOwnedParameterConfigs = exports.getParameterConfig = exports.getAllParameterConfigs = exports.getUserDirectoryByName = exports.getOwnedUserDirectories = exports.getUserDirectories = exports.getGlobalConfigValue = exports.getOwnedSecrets = exports.getAllSecretConfigs = exports.getSecretByName = exports.getSrcFilenameFromQpqFunctionRuntime = exports.getStoryNameFromQpqFunctionRuntime = exports.getApiBuildPath = exports.getAllSrcEntries = exports.getUserDirectorySrcEntries = exports.getQueueSrcEntries = exports.getScheduleEvents = exports.getUserDirectoryEmailTemplates = exports.getActionProcessorSources = exports.getKeyValueStoreByName = exports.resolveCrossServiceResourceName = exports.getOwnedStorageDrives = exports.getOwnedGraphDatabases = exports.getOwnedKeyValueStores = exports.getVirualNetworkConfigs = exports.getDeployEventConfigs = exports.getAllGraphDatabaseConfigs = exports.getAllKeyValueStores = exports.getOwnedItems = exports.getEventBusConfigByName = exports.getOwnedEventBusConfigs = exports.getAllClaudeAiConfigs = exports.getAllEventBusConfigs = exports.getStorageDriveNames = exports.getQueueByName = exports.getNotifyErrorConfigs = exports.getQueues = exports.getStorageDriveByName = exports.getStorageDrives = exports.getApplicationModuleEnvironment = exports.getConfigRoot = exports.getApplicationModuleFeature = exports.getApplicationName = exports.getApplicationConfigRoot = exports.getApplicationModuleName = exports.getApplicationConfigSetting = exports.getConfigSetting = exports.getConfigSettings = exports.flattenQpqConfig = void 0;
15
+ exports.getFullUrlFromConfigUrl = exports.isSameResource = exports.getKeyValueStoreFullyQualifiedResourceName = exports.getFullyQualifiedResourceName = exports.convertCustomFullyQualifiedResourceToGeneric = exports.convertCrossModuleOwnerToGenericResourceNameOverride = exports.getQueueQueueProcessors = void 0;
16
16
  const config_1 = require("./config");
17
17
  const utils_1 = require("./utils");
18
18
  /**
@@ -284,37 +284,18 @@ const getApiBuildPath = (qpqConfig) => {
284
284
  return apiBuildPathConfig.apiBuildPath;
285
285
  };
286
286
  exports.getApiBuildPath = getApiBuildPath;
287
- const getSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
288
- const [srcPath, _method] = qpqFunctionRuntime.split('::');
289
- if (srcPath.startsWith('full@')) {
290
- return srcPath.slice(5);
291
- }
292
- return srcPath;
293
- };
294
- exports.getSrcPathFromQpqFunctionRuntime = getSrcPathFromQpqFunctionRuntime;
295
- function getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash(runtime) {
296
- const srcPath = (0, exports.getSrcPathFromQpqFunctionRuntime)(runtime);
297
- if (srcPath.startsWith('/')) {
298
- return srcPath.slice(1);
299
- }
300
- return srcPath;
301
- }
302
- exports.getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash = getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash;
303
- const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig, configRootOverride) => {
304
- const [srcPath, _method] = qpqFunctionRuntime.split('::');
305
- if (srcPath.startsWith('full@')) {
306
- return srcPath.slice(5);
307
- }
308
- const configRoot = configRootOverride !== null && configRootOverride !== void 0 ? configRootOverride : (0, exports.getApplicationConfigRoot)(qpqConfig);
309
- return (0, utils_1.joinPaths)(configRoot, srcPath);
310
- };
311
- exports.getFullSrcPathFromQpqFunctionRuntime = getFullSrcPathFromQpqFunctionRuntime;
312
287
  const getStoryNameFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
288
+ if ((0, utils_1.isQpqFunctionRuntimeAbsolutePath)(qpqFunctionRuntime)) {
289
+ return qpqFunctionRuntime.functionName;
290
+ }
313
291
  const [_srcPath, method] = qpqFunctionRuntime.split('::');
314
292
  return method;
315
293
  };
316
294
  exports.getStoryNameFromQpqFunctionRuntime = getStoryNameFromQpqFunctionRuntime;
317
295
  const getSrcFilenameFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
296
+ if ((0, utils_1.isQpqFunctionRuntimeAbsolutePath)(qpqFunctionRuntime)) {
297
+ return qpqFunctionRuntime.relativePath.split('/').pop() || '';
298
+ }
318
299
  const [srcPath] = qpqFunctionRuntime.split('::');
319
300
  return srcPath.split('/').pop() || '';
320
301
  };
@@ -389,16 +370,6 @@ const getUniqueKeyForSetting = (setting) => {
389
370
  return `${type}${key}`;
390
371
  };
391
372
  exports.getUniqueKeyForSetting = getUniqueKeyForSetting;
392
- const getStorageDriveUploadFullPath = (qpqConfig, storageDriveConfig) => {
393
- return (0, utils_1.joinPaths)((0, exports.getConfigRoot)(qpqConfig), storageDriveConfig.copyPath || '');
394
- };
395
- exports.getStorageDriveUploadFullPath = getStorageDriveUploadFullPath;
396
- const getApiBuildPathFullPath = (qpqConfig) => {
397
- const configRoot = (0, exports.getConfigRoot)(qpqConfig);
398
- const apiBuildPath = (0, exports.getApiBuildPath)(qpqConfig);
399
- return (0, utils_1.joinPaths)(configRoot, apiBuildPath);
400
- };
401
- exports.getApiBuildPathFullPath = getApiBuildPathFullPath;
402
373
  const getQueueQueueProcessors = (name, qpqConfig) => {
403
374
  const seoConfigs = (0, exports.getConfigSettings)(qpqConfig, config_1.QPQCoreConfigSettingType.queue);
404
375
  const queueConfig = seoConfigs.find((c) => c.name === name);
@@ -2,25 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.askProcessEvent = void 0;
4
4
  const actions_1 = require("../actions");
5
+ const actions_2 = require("../actions");
5
6
  const system_1 = require("../actions/system");
6
7
  const actionLogic_1 = require("../logic/actionLogic");
8
+ const types_1 = require("../types");
7
9
  const askCatch_1 = require("./system/askCatch");
8
10
  const array_1 = require("./array");
9
11
  const askGetApplicationVersion_1 = require("./askGetApplicationVersion");
10
12
  function* askProcessEventRecord(qpqEventRecord, eventArguments) {
11
13
  // Try and match a story to execute
12
- const matchResultResult = yield* (0, askCatch_1.askCatch)((0, actions_1.askEventMatchStory)(qpqEventRecord, eventArguments));
14
+ const matchResultResult = yield* (0, askCatch_1.askCatch)((0, actions_2.askEventMatchStory)(qpqEventRecord, eventArguments));
13
15
  if (!matchResultResult.success) {
14
16
  return (0, actionLogic_1.getUnsuccessfulEitherActionResult)(matchResultResult.error);
15
17
  }
16
18
  // See if we want to exit early (validation / auth etc)
17
- const earlyExitQpqEventRecordResponse = yield* (0, actions_1.askEventAutoRespond)(qpqEventRecord, matchResultResult.result);
19
+ const earlyExitQpqEventRecordResponse = yield* (0, actions_2.askEventAutoRespond)(qpqEventRecord, matchResultResult.result);
18
20
  // Return
19
21
  if (earlyExitQpqEventRecordResponse != null) {
20
22
  // return the result
21
23
  return (0, actionLogic_1.getSuccessfulEitherActionResult)(earlyExitQpqEventRecordResponse);
22
24
  }
23
- const messageSession = yield* (0, actions_1.askEventGetStorySession)(eventArguments, qpqEventRecord, matchResultResult.result);
25
+ const messageSession = yield* (0, actions_2.askEventGetStorySession)(eventArguments, qpqEventRecord, matchResultResult.result);
24
26
  // Execute the story
25
27
  const executeStoryResponse = yield* (0, askCatch_1.askCatch)((0, system_1.askExecuteStory)(matchResultResult.result.runtime, [qpqEventRecord, matchResultResult.result.runtimeOptions], messageSession));
26
28
  if (executeStoryResponse.success) {
@@ -34,10 +36,15 @@ function* askProcessEvent(...eventArguments) {
34
36
  // This should be something the developer knows how to get to the code version
35
37
  // like the git sha, we don't need to do anything with the global, it will be in the logs
36
38
  yield* (0, askGetApplicationVersion_1.askGetApplicationVersion)();
37
- const records = yield* (0, actions_1.askEventGetRecords)(...eventArguments);
39
+ const records = yield* (0, actions_2.askEventGetRecords)(...eventArguments);
38
40
  const processedRecords = yield* (0, array_1.askMapParallel)(records, function* askProcessEventRecordWithEvent(record) {
39
41
  return yield* askProcessEventRecord(record, eventArguments);
40
42
  });
41
- return yield* (0, actions_1.askEventTransformResponseResult)(processedRecords, ...eventArguments);
43
+ const transformedResponse = yield* (0, askCatch_1.askCatch)((0, actions_2.askEventTransformResponseResult)(processedRecords, ...eventArguments));
44
+ if (!transformedResponse.success) {
45
+ yield* (0, actions_1.askLogCreate)(types_1.LogLevelEnum.Fatal, transformedResponse.error.errorText);
46
+ return yield* (0, actions_1.askThrowError)(transformedResponse.error.errorType, transformedResponse.error.errorText, transformedResponse.error.errorStack);
47
+ }
48
+ return transformedResponse.result;
42
49
  }
43
50
  exports.askProcessEvent = askProcessEvent;
@@ -1,10 +1,14 @@
1
1
  /**
2
- * Represents a service function definition that can be either relative or absolute.
3
- * - Use the `full@` prefix for absolute paths.
4
- * - Omit the prefix for relative paths.
2
+ * Represents a runtime function definition that can be either relative or absolute.
5
3
  *
6
4
  * Example:
7
- * - Absolute: `full@E:/repo/project/src/service/entry/controller/admin::onAuthUpdate`
5
+ * - Absolute: { basePath: `E:/repo/project/src`, relativePath: `/service/entry/controller/admin::onAuthUpdate` }
8
6
  * - Relative: `/entry/controller/admin::onAuthUpdate`
9
7
  */
10
- export type QpqFunctionRuntime = `full@${string}::${string}` | `/${string}::${string}`;
8
+ export type QpqFunctionRuntimeRelativePath = `/${string}::${string}`;
9
+ export type QpqFunctionRuntimeAbsolutePath = {
10
+ basePath: string;
11
+ relativePath: string;
12
+ functionName: string;
13
+ };
14
+ export type QpqFunctionRuntime = QpqFunctionRuntimeAbsolutePath | QpqFunctionRuntimeRelativePath;
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime } from '../../types';
2
+ export declare function getUniqueKeyFromQpqFunctionRuntime(qpqFunctionRuntime: QpqFunctionRuntime): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUniqueKeyFromQpqFunctionRuntime = void 0;
4
+ const isQpqFunctionRuntimeAbsolutePath_1 = require("./isQpqFunctionRuntimeAbsolutePath");
5
+ function getUniqueKeyFromQpqFunctionRuntime(qpqFunctionRuntime) {
6
+ if ((0, isQpqFunctionRuntimeAbsolutePath_1.isQpqFunctionRuntimeAbsolutePath)(qpqFunctionRuntime)) {
7
+ return `${qpqFunctionRuntime.basePath}/${qpqFunctionRuntime.relativePath}::${qpqFunctionRuntime.functionName}`;
8
+ }
9
+ return qpqFunctionRuntime;
10
+ }
11
+ exports.getUniqueKeyFromQpqFunctionRuntime = getUniqueKeyFromQpqFunctionRuntime;
@@ -1 +1,3 @@
1
- export * from './joinPaths';
1
+ export * from './getUniqueKeyFromQpqFunctionRuntime';
2
+ export * from './isQpqFunctionRuntimeAbsolutePath';
3
+ export * from './isQpqFunctionRuntimeRelativePath';
@@ -14,4 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./joinPaths"), exports);
17
+ __exportStar(require("./getUniqueKeyFromQpqFunctionRuntime"), exports);
18
+ __exportStar(require("./isQpqFunctionRuntimeAbsolutePath"), exports);
19
+ __exportStar(require("./isQpqFunctionRuntimeRelativePath"), exports);
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime, QpqFunctionRuntimeAbsolutePath } from '../../types';
2
+ export declare function isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime: QpqFunctionRuntime): qpqFunctionRuntime is QpqFunctionRuntimeAbsolutePath;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isQpqFunctionRuntimeAbsolutePath = void 0;
4
+ function isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime) {
5
+ return typeof qpqFunctionRuntime === 'object';
6
+ }
7
+ exports.isQpqFunctionRuntimeAbsolutePath = isQpqFunctionRuntimeAbsolutePath;
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime, QpqFunctionRuntimeRelativePath } from '../../types';
2
+ export declare function isQpqFunctionRuntimeRelativePath(qpqFunctionRuntime: QpqFunctionRuntime): qpqFunctionRuntime is QpqFunctionRuntimeRelativePath;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isQpqFunctionRuntimeRelativePath = void 0;
4
+ function isQpqFunctionRuntimeRelativePath(qpqFunctionRuntime) {
5
+ return typeof qpqFunctionRuntime !== 'object';
6
+ }
7
+ exports.isQpqFunctionRuntimeRelativePath = isQpqFunctionRuntimeRelativePath;
@@ -1,6 +1,7 @@
1
+ import { getUniqueKeyFromQpqFunctionRuntime } from '../../utils';
1
2
  import { QPQCoreConfigSettingType } from '../QPQConfig';
2
3
  export const defineActionProcessors = (getActionProcessors) => ({
3
4
  configSettingType: QPQCoreConfigSettingType.actionProcessors,
4
- uniqueKey: getActionProcessors,
5
+ uniqueKey: getUniqueKeyFromQpqFunctionRuntime(getActionProcessors),
5
6
  runtime: getActionProcessors,
6
7
  });
@@ -68,9 +68,6 @@ export declare const getQueueSrcEntries: (configs: QPQConfig) => QpqFunctionRunt
68
68
  export declare const getUserDirectorySrcEntries: (qpqConfig: QPQConfig) => QpqFunctionRuntime[];
69
69
  export declare const getAllSrcEntries: (qpqConfig: QPQConfig) => QpqFunctionRuntime[];
70
70
  export declare const getApiBuildPath: (qpqConfig: QPQConfig) => string;
71
- export declare const getSrcPathFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
72
- export declare function getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash(runtime: QpqFunctionRuntime): string;
73
- export declare const getFullSrcPathFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime, qpqConfig: QPQConfig, configRootOverride?: string) => string;
74
71
  export declare const getStoryNameFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
75
72
  export declare const getSrcFilenameFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
76
73
  export declare const getSecretByName: (secretName: string, qpqConfig: QPQConfig) => SecretQPQConfigSetting;
@@ -84,8 +81,6 @@ export declare const getAllParameterConfigs: (qpqConfig: QPQConfig) => Parameter
84
81
  export declare const getParameterConfig: (name: string, qpqConfig: QPQConfig) => ParameterQPQConfigSetting;
85
82
  export declare const getOwnedParameterConfigs: (qpqConfig: QPQConfig) => ParameterQPQConfigSetting[];
86
83
  export declare const getUniqueKeyForSetting: (setting: QPQConfigSetting) => string;
87
- export declare const getStorageDriveUploadFullPath: (qpqConfig: QPQConfig, storageDriveConfig: StorageDriveQPQConfigSetting) => string;
88
- export declare const getApiBuildPathFullPath: (qpqConfig: QPQConfig) => string;
89
84
  export declare const getQueueQueueProcessors: (name: string, qpqConfig: QPQConfig) => QpqQueueProcessors;
90
85
  export declare const convertCrossModuleOwnerToGenericResourceNameOverride: <T extends string>(owner?: CrossModuleOwner<T> | undefined) => CrossModuleOwner<'resourceNameOverride'> | undefined;
91
86
  export declare const convertCustomFullyQualifiedResourceToGeneric: <T extends string>(resource: CustomFullyQualifiedResource<T>) => FullyQualifiedResource;
@@ -1,5 +1,5 @@
1
1
  import { QPQCoreConfigSettingType, } from './config';
2
- import { joinPaths } from './utils';
2
+ import { isQpqFunctionRuntimeAbsolutePath } from './utils';
3
3
  /**
4
4
  * Flattens a QPQConfig array into a single array of QPQConfigSetting objects.
5
5
  * If a QPQConfigItem has a configSettingType of QPQCoreConfigSettingType.environmentSettings,
@@ -235,33 +235,17 @@ export const getApiBuildPath = (qpqConfig) => {
235
235
  }
236
236
  return apiBuildPathConfig.apiBuildPath;
237
237
  };
238
- export const getSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
239
- const [srcPath, _method] = qpqFunctionRuntime.split('::');
240
- if (srcPath.startsWith('full@')) {
241
- return srcPath.slice(5);
242
- }
243
- return srcPath;
244
- };
245
- export function getSrcPathFromQpqFunctionRuntimeWithoutLeadingSlash(runtime) {
246
- const srcPath = getSrcPathFromQpqFunctionRuntime(runtime);
247
- if (srcPath.startsWith('/')) {
248
- return srcPath.slice(1);
249
- }
250
- return srcPath;
251
- }
252
- export const getFullSrcPathFromQpqFunctionRuntime = (qpqFunctionRuntime, qpqConfig, configRootOverride) => {
253
- const [srcPath, _method] = qpqFunctionRuntime.split('::');
254
- if (srcPath.startsWith('full@')) {
255
- return srcPath.slice(5);
256
- }
257
- const configRoot = configRootOverride ?? getApplicationConfigRoot(qpqConfig);
258
- return joinPaths(configRoot, srcPath);
259
- };
260
238
  export const getStoryNameFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
239
+ if (isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime)) {
240
+ return qpqFunctionRuntime.functionName;
241
+ }
261
242
  const [_srcPath, method] = qpqFunctionRuntime.split('::');
262
243
  return method;
263
244
  };
264
245
  export const getSrcFilenameFromQpqFunctionRuntime = (qpqFunctionRuntime) => {
246
+ if (isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime)) {
247
+ return qpqFunctionRuntime.relativePath.split('/').pop() || '';
248
+ }
265
249
  const [srcPath] = qpqFunctionRuntime.split('::');
266
250
  return srcPath.split('/').pop() || '';
267
251
  };
@@ -324,14 +308,6 @@ export const getUniqueKeyForSetting = (setting) => {
324
308
  const key = setting.uniqueKey;
325
309
  return `${type}${key}`;
326
310
  };
327
- export const getStorageDriveUploadFullPath = (qpqConfig, storageDriveConfig) => {
328
- return joinPaths(getConfigRoot(qpqConfig), storageDriveConfig.copyPath || '');
329
- };
330
- export const getApiBuildPathFullPath = (qpqConfig) => {
331
- const configRoot = getConfigRoot(qpqConfig);
332
- const apiBuildPath = getApiBuildPath(qpqConfig);
333
- return joinPaths(configRoot, apiBuildPath);
334
- };
335
311
  export const getQueueQueueProcessors = (name, qpqConfig) => {
336
312
  const seoConfigs = getConfigSettings(qpqConfig, QPQCoreConfigSettingType.queue);
337
313
  const queueConfig = seoConfigs.find((c) => c.name === name);
@@ -1,6 +1,8 @@
1
+ import { askLogCreate, askThrowError } from '../actions';
1
2
  import { askEventAutoRespond, askEventGetRecords, askEventGetStorySession, askEventMatchStory, askEventTransformResponseResult, } from '../actions';
2
3
  import { askExecuteStory } from '../actions/system';
3
4
  import { getSuccessfulEitherActionResult, getUnsuccessfulEitherActionResult } from '../logic/actionLogic';
5
+ import { LogLevelEnum } from '../types';
4
6
  import { askCatch } from './system/askCatch';
5
7
  import { askMapParallel } from './array';
6
8
  import { askGetApplicationVersion } from './askGetApplicationVersion';
@@ -35,5 +37,10 @@ export function* askProcessEvent(...eventArguments) {
35
37
  const processedRecords = yield* askMapParallel(records, function* askProcessEventRecordWithEvent(record) {
36
38
  return yield* askProcessEventRecord(record, eventArguments);
37
39
  });
38
- return yield* askEventTransformResponseResult(processedRecords, ...eventArguments);
40
+ const transformedResponse = yield* askCatch(askEventTransformResponseResult(processedRecords, ...eventArguments));
41
+ if (!transformedResponse.success) {
42
+ yield* askLogCreate(LogLevelEnum.Fatal, transformedResponse.error.errorText);
43
+ return yield* askThrowError(transformedResponse.error.errorType, transformedResponse.error.errorText, transformedResponse.error.errorStack);
44
+ }
45
+ return transformedResponse.result;
39
46
  }
@@ -1,10 +1,14 @@
1
1
  /**
2
- * Represents a service function definition that can be either relative or absolute.
3
- * - Use the `full@` prefix for absolute paths.
4
- * - Omit the prefix for relative paths.
2
+ * Represents a runtime function definition that can be either relative or absolute.
5
3
  *
6
4
  * Example:
7
- * - Absolute: `full@E:/repo/project/src/service/entry/controller/admin::onAuthUpdate`
5
+ * - Absolute: { basePath: `E:/repo/project/src`, relativePath: `/service/entry/controller/admin::onAuthUpdate` }
8
6
  * - Relative: `/entry/controller/admin::onAuthUpdate`
9
7
  */
10
- export type QpqFunctionRuntime = `full@${string}::${string}` | `/${string}::${string}`;
8
+ export type QpqFunctionRuntimeRelativePath = `/${string}::${string}`;
9
+ export type QpqFunctionRuntimeAbsolutePath = {
10
+ basePath: string;
11
+ relativePath: string;
12
+ functionName: string;
13
+ };
14
+ export type QpqFunctionRuntime = QpqFunctionRuntimeAbsolutePath | QpqFunctionRuntimeRelativePath;
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime } from '../../types';
2
+ export declare function getUniqueKeyFromQpqFunctionRuntime(qpqFunctionRuntime: QpqFunctionRuntime): string;
@@ -0,0 +1,7 @@
1
+ import { isQpqFunctionRuntimeAbsolutePath } from './isQpqFunctionRuntimeAbsolutePath';
2
+ export function getUniqueKeyFromQpqFunctionRuntime(qpqFunctionRuntime) {
3
+ if (isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime)) {
4
+ return `${qpqFunctionRuntime.basePath}/${qpqFunctionRuntime.relativePath}::${qpqFunctionRuntime.functionName}`;
5
+ }
6
+ return qpqFunctionRuntime;
7
+ }
@@ -1 +1,3 @@
1
- export * from './joinPaths';
1
+ export * from './getUniqueKeyFromQpqFunctionRuntime';
2
+ export * from './isQpqFunctionRuntimeAbsolutePath';
3
+ export * from './isQpqFunctionRuntimeRelativePath';
@@ -1 +1,3 @@
1
- export * from './joinPaths';
1
+ export * from './getUniqueKeyFromQpqFunctionRuntime';
2
+ export * from './isQpqFunctionRuntimeAbsolutePath';
3
+ export * from './isQpqFunctionRuntimeRelativePath';
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime, QpqFunctionRuntimeAbsolutePath } from '../../types';
2
+ export declare function isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime: QpqFunctionRuntime): qpqFunctionRuntime is QpqFunctionRuntimeAbsolutePath;
@@ -0,0 +1,3 @@
1
+ export function isQpqFunctionRuntimeAbsolutePath(qpqFunctionRuntime) {
2
+ return typeof qpqFunctionRuntime === 'object';
3
+ }
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime, QpqFunctionRuntimeRelativePath } from '../../types';
2
+ export declare function isQpqFunctionRuntimeRelativePath(qpqFunctionRuntime: QpqFunctionRuntime): qpqFunctionRuntime is QpqFunctionRuntimeRelativePath;
@@ -0,0 +1,3 @@
1
+ export function isQpqFunctionRuntimeRelativePath(qpqFunctionRuntime) {
2
+ return typeof qpqFunctionRuntime !== 'object';
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-core",
3
- "version": "0.0.243",
3
+ "version": "0.0.245",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -32,11 +32,10 @@
32
32
  },
33
33
  "homepage": "https://github.com/joe-coady/quidproquo#readme",
34
34
  "devDependencies": {
35
- "quidproquo-tsconfig": "0.0.243",
35
+ "quidproquo-tsconfig": "0.0.245",
36
36
  "typescript": "^4.9.3"
37
37
  },
38
38
  "dependencies": {
39
- "@anthropic-ai/sdk": "^0.19.1",
40
- "upath": "^2.0.1"
39
+ "@anthropic-ai/sdk": "^0.19.1"
41
40
  }
42
41
  }
@@ -1 +0,0 @@
1
- export declare function joinPaths(...parts: string[]): string;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joinPaths = void 0;
4
- const upath_1 = require("upath");
5
- function joinPaths(...parts) {
6
- return (0, upath_1.join)(...parts);
7
- }
8
- exports.joinPaths = joinPaths;
@@ -1 +0,0 @@
1
- export declare function joinPaths(...parts: string[]): string;
@@ -1,4 +0,0 @@
1
- import { join } from 'upath';
2
- export function joinPaths(...parts) {
3
- return join(...parts);
4
- }