quidproquo-core 0.1.17 → 0.1.18

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 (53) hide show
  1. package/lib/commonjs/qpqCoreUtils.d.ts +1 -0
  2. package/lib/commonjs/qpqCoreUtils.js +9 -3
  3. package/lib/commonjs/qpqCoreUtils.js.map +1 -1
  4. package/lib/commonjs/qpqCoreUtilsLib.d.ts +1 -0
  5. package/lib/commonjs/runtime/index.d.ts +2 -0
  6. package/lib/commonjs/runtime/index.js +2 -0
  7. package/lib/commonjs/runtime/index.js.map +1 -1
  8. package/lib/commonjs/runtime/loadRuntimeActionProcessors.d.ts +5 -0
  9. package/lib/commonjs/runtime/loadRuntimeActionProcessors.js +57 -0
  10. package/lib/commonjs/runtime/loadRuntimeActionProcessors.js.map +1 -0
  11. package/lib/commonjs/runtime/mergeRuntimeActionProcessors.d.ts +5 -0
  12. package/lib/commonjs/runtime/mergeRuntimeActionProcessors.js +30 -0
  13. package/lib/commonjs/runtime/mergeRuntimeActionProcessors.js.map +1 -0
  14. package/lib/commonjs/runtime/resolveStory.js +8 -2
  15. package/lib/commonjs/runtime/resolveStory.js.map +1 -1
  16. package/lib/commonjs/types/QpqFunctionRuntime.d.ts +1 -0
  17. package/lib/commonjs/types/QpqFunctionRuntime.js.map +1 -1
  18. package/lib/commonjs/utils/path/getActionProcessorsFromQpqFunctionRuntime.d.ts +2 -0
  19. package/lib/commonjs/utils/path/getActionProcessorsFromQpqFunctionRuntime.js +11 -0
  20. package/lib/commonjs/utils/path/getActionProcessorsFromQpqFunctionRuntime.js.map +1 -0
  21. package/lib/commonjs/utils/path/getGlobalsFromQpqFunctionRuntime.d.ts +2 -0
  22. package/lib/commonjs/utils/path/getGlobalsFromQpqFunctionRuntime.js +11 -0
  23. package/lib/commonjs/utils/path/getGlobalsFromQpqFunctionRuntime.js.map +1 -0
  24. package/lib/commonjs/utils/path/index.d.ts +2 -0
  25. package/lib/commonjs/utils/path/index.js +2 -0
  26. package/lib/commonjs/utils/path/index.js.map +1 -1
  27. package/lib/esm/qpqCoreUtils.d.ts +1 -0
  28. package/lib/esm/qpqCoreUtils.js +6 -1
  29. package/lib/esm/qpqCoreUtils.js.map +1 -1
  30. package/lib/esm/qpqCoreUtilsLib.d.ts +1 -0
  31. package/lib/esm/runtime/index.d.ts +2 -0
  32. package/lib/esm/runtime/index.js +2 -0
  33. package/lib/esm/runtime/index.js.map +1 -1
  34. package/lib/esm/runtime/loadRuntimeActionProcessors.d.ts +5 -0
  35. package/lib/esm/runtime/loadRuntimeActionProcessors.js +44 -0
  36. package/lib/esm/runtime/loadRuntimeActionProcessors.js.map +1 -0
  37. package/lib/esm/runtime/mergeRuntimeActionProcessors.d.ts +5 -0
  38. package/lib/esm/runtime/mergeRuntimeActionProcessors.js +20 -0
  39. package/lib/esm/runtime/mergeRuntimeActionProcessors.js.map +1 -0
  40. package/lib/esm/runtime/resolveStory.js +9 -3
  41. package/lib/esm/runtime/resolveStory.js.map +1 -1
  42. package/lib/esm/types/QpqFunctionRuntime.d.ts +1 -0
  43. package/lib/esm/types/QpqFunctionRuntime.js.map +1 -1
  44. package/lib/esm/utils/path/getActionProcessorsFromQpqFunctionRuntime.d.ts +2 -0
  45. package/lib/esm/utils/path/getActionProcessorsFromQpqFunctionRuntime.js +7 -0
  46. package/lib/esm/utils/path/getActionProcessorsFromQpqFunctionRuntime.js.map +1 -0
  47. package/lib/esm/utils/path/getGlobalsFromQpqFunctionRuntime.d.ts +2 -0
  48. package/lib/esm/utils/path/getGlobalsFromQpqFunctionRuntime.js +7 -0
  49. package/lib/esm/utils/path/getGlobalsFromQpqFunctionRuntime.js.map +1 -0
  50. package/lib/esm/utils/path/index.d.ts +2 -0
  51. package/lib/esm/utils/path/index.js +2 -0
  52. package/lib/esm/utils/path/index.js.map +1 -1
  53. package/package.json +2 -2
@@ -75,6 +75,7 @@ export declare const getAllInlineFunctions: (qpqConfig: QPQConfig) => InlineFunc
75
75
  export declare const getOwnedInlineFunctions: (qpqConfig: QPQConfig) => InlineFunctionQPQConfigSetting[];
76
76
  export declare const getAllDynamicFunctions: (qpqConfig: QPQConfig) => DynamicFunctionsQPQConfigSetting[];
77
77
  export declare const getOwnedDynamicFunctions: (qpqConfig: QPQConfig) => DynamicFunctionsQPQConfigSetting[];
78
+ export declare const expandSrcEntriesWithActionProcessors: (runtimes: QpqFunctionRuntime[]) => QpqFunctionRuntime[];
78
79
  export declare const getAllSrcEntries: (qpqConfig: QPQConfig) => QpqFunctionRuntime[];
79
80
  export declare const getApiBuildPath: (qpqConfig: QPQConfig) => string;
80
81
  export declare const getSrcFilenameFromQpqFunctionRuntime: (qpqFunctionRuntime: QpqFunctionRuntime) => string;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOwnedSecrets = exports.getAllSecretConfigs = exports.getSecretByName = exports.getSrcFilenameFromQpqFunctionRuntime = exports.getApiBuildPath = exports.getAllSrcEntries = exports.getOwnedDynamicFunctions = exports.getAllDynamicFunctions = exports.getOwnedInlineFunctions = exports.getAllInlineFunctions = exports.getUserDirectorySrcEntries = exports.getQueueSrcEntries = exports.getOwnedScheduleEvents = 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.getJavascriptRuntimeConfig = exports.getAllAiConfigs = exports.getAllEventBusConfigs = exports.getStorageDriveNames = exports.assertFifoQueueEventBusSubscriptionsAreValid = exports.getQueueByName = exports.getNotifyErrorConfigs = exports.getOwnedQueues = exports.getQueues = exports.getFederatedModuleStore = 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;
4
- exports.getFullUrlFromConfigUrl = exports.isSameResource = exports.getKeyValueStoreFullyQualifiedResourceName = exports.getFullyQualifiedResourceName = exports.convertCustomFullyQualifiedResourceToGeneric = exports.getQueueQueueProcessors = exports.getQueueConfigSettingByName = exports.getUniqueKeyForSetting = exports.getFrontendBundleOptions = exports.getBackendBundleOptions = exports.getOwnedParameterConfigs = exports.getParameterConfig = exports.getAllParameterConfigs = exports.getUserDirectoryByName = exports.getOwnedUserDirectories = exports.getUserDirectories = exports.resolveGlobalValue = exports.getGlobalConfigValue = exports.getOwnedCryptoKeys = exports.getAllCryptoKeyConfigs = exports.getCryptoKeyByName = void 0;
3
+ exports.getAllSecretConfigs = exports.getSecretByName = exports.getSrcFilenameFromQpqFunctionRuntime = exports.getApiBuildPath = exports.getAllSrcEntries = exports.expandSrcEntriesWithActionProcessors = exports.getOwnedDynamicFunctions = exports.getAllDynamicFunctions = exports.getOwnedInlineFunctions = exports.getAllInlineFunctions = exports.getUserDirectorySrcEntries = exports.getQueueSrcEntries = exports.getOwnedScheduleEvents = 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.getJavascriptRuntimeConfig = exports.getAllAiConfigs = exports.getAllEventBusConfigs = exports.getStorageDriveNames = exports.assertFifoQueueEventBusSubscriptionsAreValid = exports.getQueueByName = exports.getNotifyErrorConfigs = exports.getOwnedQueues = exports.getQueues = exports.getFederatedModuleStore = 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;
4
+ exports.getFullUrlFromConfigUrl = exports.isSameResource = exports.getKeyValueStoreFullyQualifiedResourceName = exports.getFullyQualifiedResourceName = exports.convertCustomFullyQualifiedResourceToGeneric = exports.getQueueQueueProcessors = exports.getQueueConfigSettingByName = exports.getUniqueKeyForSetting = exports.getFrontendBundleOptions = exports.getBackendBundleOptions = exports.getOwnedParameterConfigs = exports.getParameterConfig = exports.getAllParameterConfigs = exports.getUserDirectoryByName = exports.getOwnedUserDirectories = exports.getUserDirectories = exports.resolveGlobalValue = exports.getGlobalConfigValue = exports.getOwnedCryptoKeys = exports.getAllCryptoKeyConfigs = exports.getCryptoKeyByName = exports.getOwnedSecrets = void 0;
5
5
  const config_1 = require("./config");
6
6
  const utils_1 = require("./utils");
7
7
  /**
@@ -316,6 +316,12 @@ const getOwnedDynamicFunctions = (qpqConfig) => {
316
316
  return (0, exports.getOwnedItems)((0, exports.getAllDynamicFunctions)(qpqConfig), qpqConfig);
317
317
  };
318
318
  exports.getOwnedDynamicFunctions = getOwnedDynamicFunctions;
319
+ // Runtime-attached action processor override sources must join the bundler sweep,
320
+ // or the deployed bundle omits them and the dynamic load fails at runtime.
321
+ const expandSrcEntriesWithActionProcessors = (runtimes) => {
322
+ return runtimes.flatMap((runtime) => [runtime, ...(((0, utils_1.isQpqFunctionRuntimeAdvanced)(runtime) && runtime.actionProcessors) || [])]);
323
+ };
324
+ exports.expandSrcEntriesWithActionProcessors = expandSrcEntriesWithActionProcessors;
319
325
  // Used in bundlers to know where and what to build and index
320
326
  const getAllSrcEntries = (qpqConfig) => {
321
327
  const result = [
@@ -335,7 +341,7 @@ const getAllSrcEntries = (qpqConfig) => {
335
341
  ...(0, exports.getAllInlineFunctions)(qpqConfig).map((f) => f.runtime),
336
342
  ...(0, exports.getAllDynamicFunctions)(qpqConfig).map((f) => f.runtime),
337
343
  ];
338
- return result;
344
+ return (0, exports.expandSrcEntriesWithActionProcessors)(result);
339
345
  };
340
346
  exports.getAllSrcEntries = getAllSrcEntries;
341
347
  const getApiBuildPath = (qpqConfig) => {
@@ -1 +1 @@
1
- {"version":3,"file":"qpqCoreUtils.js","sourceRoot":"","sources":["../../src/qpqCoreUtils.ts"],"names":[],"mappings":";;;;AAAA,qCAqCkB;AAWlB,mCAAuD;AAEvD;;;;;;;GAOG;AACI,MAAM,gBAAgB,GAAG,CAAC,SAAoB,EAAsB,EAAE;IAC3E,IAAI,WAAW,GAAG,aAAa,CAAC;IAChC,IAAI,OAA2B,CAAC;IAEhC;;;;;;OAMG;IACH,MAAM,OAAO,GAAG,CAAC,WAA4B,EAAE,cAAkC,EAAE,EAAsB,EAAE;QACzG,OAAO,WAAW,CAAC,MAAM,CAAqB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;;YAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,OAAO,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,gEAAgE;gBAChE,IAAI,IAAI,CAAC,iBAAiB,KAAK,iCAAwB,CAAC,OAAO,EAAE,CAAC;oBAChE,WAAW,GAAI,IAAoC,CAAC,WAAW,IAAI,aAAa,CAAC;gBACnF,CAAC;gBAED,+DAA+D;qBAC1D,IAAI,IAAI,CAAC,iBAAiB,KAAK,iCAAwB,CAAC,UAAU,EAAE,CAAC;oBACxE,OAAO,GAAI,IAA+B,CAAC,UAAU,CAAC;gBACxD,CAAC;gBAED,sFAAsF;gBACtF,uEAAuE;qBAClE,IAAI,IAAI,CAAC,iBAAiB,KAAK,iCAAwB,CAAC,mBAAmB,EAAE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AAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,GAAG,GAAG,SAAS,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,GAAG,SAAS,CAAC,QAAQ,MAAM,OAAO,EAAE,CAAC;IAE/C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA7BW,QAAA,uBAAuB,2BA6BlC","sourcesContent":["import {\n ActionProcessorsQPQConfigSetting,\n AiQPQConfigSetting,\n ApiBuildPathQPQConfigSetting,\n ApplicationQPQConfigSetting,\n BackendBundleOptions,\n BackendBundleOptionsQPQConfigSetting,\n CryptoKeyQPQConfigSetting,\n defineJavascriptRuntime,\n DeployEventsQPQConfigSetting,\n DynamicFunctionsQPQConfigSetting,\n EmailTemplates,\n EnvironmentSettingsQPQConfigSetting,\n EventBusQPQConfigSetting,\n FederatedModuleStoreQPQConfigSetting,\n FrontendBundleOptions,\n FrontendBundleOptionsQPQConfigSetting,\n GlobalQPQConfigSetting,\n GraphDatabaseQPQConfigSetting,\n InlineFunctionQPQConfigSetting,\n JavascriptRuntimeQPQConfigSetting,\n KeyValueStoreQPQConfigSetting,\n ModuleQPQConfigSetting,\n NotifyErrorQPQConfigSetting,\n ParameterQPQConfigSetting,\n QPQConfig,\n QPQConfigItem,\n QPQConfigSetting,\n QPQCoreConfigSettingType,\n QpqQueueProcessors,\n QueueQPQConfigSetting,\n ScheduleQPQConfigSetting,\n SecretQPQConfigSetting,\n ServiceSettingsQPQConfigSetting,\n StorageDriveQPQConfigSetting,\n UserDirectoryQPQConfigSetting,\n VirtualNetworkQPQConfigSetting,\n} from './config';\nimport {\n ConfigUrl,\n CrossModuleOwner,\n CrossServiceResourceName,\n CustomFullyQualifiedResource,\n FullyQualifiedResource,\n KeyOf,\n QpqFunctionRuntime,\n ResourceName,\n} from './types';\nimport { isQpqFunctionRuntimeAdvanced } from './utils';\n\n/**\n * Flattens a QPQConfig array into a single array of QPQConfigSetting objects.\n * If a QPQConfigItem has a configSettingType of QPQCoreConfigSettingType.environmentSettings,\n * and its environment matches the current environment, its settings will be added to the flattened array.\n * @function\n * @param {QPQConfig} qpqConfig - The input QPQConfig array to be flattened.\n * @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects\n */\nexport const flattenQpqConfig = (qpqConfig: QPQConfig): QPQConfigSetting[] => {\n let environment = 'development';\n let service: string | undefined;\n\n /**\n * A recursive helper function that flattens an array of QPQConfigItem objects.\n * @function\n * @param {QPQConfigItem[]} configItems - An array of QPQConfigItem objects to be flattened.\n * @param {QPQConfigSetting[]} accumulator - An accumulator array for storing the flattened QPQConfigSetting objects.\n * @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects.\n */\n const flatten = (configItems: QPQConfigItem[], accumulator: QPQConfigSetting[] = []): QPQConfigSetting[] => {\n return configItems.reduce<QPQConfigSetting[]>((acc, item) => {\n if (Array.isArray(item)) {\n return flatten(item, acc);\n } else {\n // If its a appName config item, update the environment variable\n if (item.configSettingType === QPQCoreConfigSettingType.appName) {\n environment = (item as ApplicationQPQConfigSetting).environment || 'development';\n }\n\n // If its a moduleName config item, update the service variable\n else if (item.configSettingType === QPQCoreConfigSettingType.moduleName) {\n service = (item as ModuleQPQConfigSetting).moduleName;\n }\n\n // Otherwise if its an environmentSettings config item, flatten out the child settings\n // for the current environment, falling back to the '*' key if present.\n else if (item.configSettingType === QPQCoreConfigSettingType.environmentSettings) {\n const envSetting = item as EnvironmentSettingsQPQConfigSetting;\n const settings = envSetting.settingsByEnvironment[environment] ?? envSetting.settingsByEnvironment['*'] ?? [];\n\n return flatten(settings, acc);\n }\n\n // Otherwise if its a serviceSettings config item, flatten out the child settings\n // for the current service, falling back to the '*' key if present.\n else if (item.configSettingType === QPQCoreConfigSettingType.serviceSettings) {\n if (!service) {\n throw new Error('defineServiceSettings requires a module to be set first via defineModule (usually through defineApplicationModule)');\n }\n\n const svcSetting = item as ServiceSettingsQPQConfigSetting;\n const settings = svcSetting.settingsByService[service] ?? svcSetting.settingsByService['*'] ?? [];\n\n return flatten(settings, acc);\n }\n\n // Otherwise its just a regular config item, add it to the list\n return [...acc, item];\n }\n }, accumulator);\n };\n\n return flatten(qpqConfig);\n};\n\n/**\n * Filters and returns the config settings of a specific type from a QPQConfig array.\n * @function\n * @template T - The specific type of QPQConfigSetting to filter.\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @param {string} configSettingType - The specific config setting type to filter.\n * @returns {T[]} - An array of filtered config settings of the specified type.\n */\nexport const getConfigSettings = <T extends QPQConfigSetting>(qpqConfig: QPQConfig, configSettingType: string): T[] => {\n const flatConfig = flattenQpqConfig(qpqConfig);\n return flatConfig.filter((c) => c.configSettingType === configSettingType) as T[];\n};\n\n/**\n * Retrieves a single config setting of a specific type from a QPQConfig array.\n * @function\n * @template T - The specific type of QPQConfigSetting to retrieve.\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @param {string} serviceInfrastructureConfigType - The specific config setting type to retrieve.\n * @returns {T | undefined} - The found config setting of the specified type or undefined if not found.\n */\nexport const getConfigSetting = <T extends QPQConfigSetting>(qpqConfig: QPQConfig, serviceInfrastructureConfigType: string): T | undefined => {\n const [setting] = getConfigSettings<T>(qpqConfig, serviceInfrastructureConfigType);\n return setting;\n};\n\n/**\n * Retrieves the ApplicationModuleSetting from a QPQConfig array.\n * @function\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @returns {ApplicationQPQConfigSetting} - The ApplicationQPQConfigSetting from the QPQConfig array.\n * @throws {Error} - If the ApplicationQPQConfigSetting is not found in the QPQConfig array.\n */\nexport const getApplicationConfigSetting = (qpqConfig: QPQConfig): ApplicationQPQConfigSetting => {\n const applicationModuleSetting = getConfigSetting<ApplicationQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.appName);\n\n if (!applicationModuleSetting) {\n throw new Error('please use defineApplication in your QPQ config');\n }\n\n return applicationModuleSetting;\n};\n\nexport const getApplicationModuleName = (qpqConfig: QPQConfig): string => {\n const moduleSetting = getConfigSetting<ModuleQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.moduleName);\n\n if (!moduleSetting) {\n throw new Error('please use defineModule in your QPQ config');\n }\n\n return moduleSetting.moduleName;\n};\n\nexport const getApplicationConfigRoot = (qpqConfig: QPQConfig): string => {\n const moduleSetting = getConfigSetting<ApplicationQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.appName);\n\n if (!moduleSetting) {\n throw new Error('please use defineApplication in your QPQ config');\n }\n\n return moduleSetting.configRoot;\n};\n\nexport const getApplicationName = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).applicationName;\n};\n\nexport const getApplicationModuleFeature = (qpqConfig: QPQConfig): string | undefined => {\n return getApplicationConfigSetting(qpqConfig).feature;\n};\n\nexport const getConfigRoot = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).configRoot;\n};\n\nexport const getApplicationModuleEnvironment = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).environment || 'production';\n};\n\nexport const getStorageDrives = (configs: QPQConfig): StorageDriveQPQConfigSetting[] => {\n return getConfigSettings<StorageDriveQPQConfigSetting>(configs, QPQCoreConfigSettingType.storageDrive);\n};\n\nexport const getStorageDriveByName = (storageDriveName: string, configs: QPQConfig): StorageDriveQPQConfigSetting | undefined => {\n return getStorageDrives(configs).find((sd) => sd.storageDrive === storageDriveName);\n};\n\nexport const getFederatedModuleStore = (qpqConfig: QPQConfig): FederatedModuleStoreQPQConfigSetting | undefined => {\n return getConfigSetting<FederatedModuleStoreQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.federatedModuleStore);\n};\n\nexport const getQueues = (configs: QPQConfig): QueueQPQConfigSetting[] => {\n return getConfigSettings<QueueQPQConfigSetting>(configs, QPQCoreConfigSettingType.queue);\n};\n\nexport const getOwnedQueues = (configs: QPQConfig): QueueQPQConfigSetting[] => {\n return getOwnedItems(getQueues(configs), configs);\n};\n\nexport const getNotifyErrorConfigs = (configs: QPQConfig): NotifyErrorQPQConfigSetting[] => {\n return getConfigSettings<NotifyErrorQPQConfigSetting>(configs, QPQCoreConfigSettingType.notifyError);\n};\n\nexport const getQueueByName = (configs: QPQConfig, name: string): QueueQPQConfigSetting | undefined => {\n return getQueues(configs).find((q) => q.name === name);\n};\n\n// A FIFO queue can only be fed by a FIFO event bus - standard SNS topics cannot deliver\n// to FIFO SQS queues at all. Called at deploy/startup time (the queue and bus are separate\n// settings, so defineQueue can't validate this on its own).\nexport const assertFifoQueueEventBusSubscriptionsAreValid = (qpqConfig: QPQConfig): void => {\n const invalidSubscriptions = getQueues(qpqConfig)\n .filter((queue) => queue.isFifo)\n .flatMap((queue) =>\n queue.eventBusSubscriptions\n .filter((eventBusName) => !getEventBusConfigByName(eventBusName, qpqConfig)?.isFifo)\n .map((eventBusName) => `queue [${queue.name}] -> event bus [${eventBusName}]`),\n );\n\n if (invalidSubscriptions.length > 0) {\n throw new Error(\n `FIFO queues can only subscribe to FIFO event buses (standard SNS topics cannot deliver to FIFO SQS queues): ${invalidSubscriptions.join(', ')}`,\n );\n }\n};\n\nexport const getStorageDriveNames = (configs: QPQConfig): string[] => {\n const storageDriveNames = getConfigSettings<StorageDriveQPQConfigSetting>(configs, QPQCoreConfigSettingType.storageDrive).map(\n (sd) => sd.storageDrive,\n );\n\n return storageDriveNames;\n};\n\nexport const getAllEventBusConfigs = (qpqConfig: QPQConfig): EventBusQPQConfigSetting[] => {\n const eventBuses = getConfigSettings<EventBusQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.eventBus);\n\n return eventBuses;\n};\n\nexport const getAllAiConfigs = (qpqConfig: QPQConfig): AiQPQConfigSetting[] => {\n return getConfigSettings<AiQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.ai);\n};\n\n// Always resolves - falls back to the defineJavascriptRuntime defaults when no setting is present\nexport const getJavascriptRuntimeConfig = (qpqConfig: QPQConfig): JavascriptRuntimeQPQConfigSetting => {\n return getConfigSetting<JavascriptRuntimeQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.javascriptRuntime) ?? defineJavascriptRuntime();\n};\n\nexport const getOwnedEventBusConfigs = (qpqConfig: QPQConfig): EventBusQPQConfigSetting[] => {\n const ownedEventBusConfigs = getOwnedItems(getAllEventBusConfigs(qpqConfig), qpqConfig);\n\n return ownedEventBusConfigs;\n};\n\nexport const getEventBusConfigByName = (eventBusName: string, qpqConfig: QPQConfig): EventBusQPQConfigSetting | undefined => {\n const allConfigs = getAllEventBusConfigs(qpqConfig);\n\n const eventBusConfig = allConfigs.find((eb) => eb.owner?.resourceNameOverride === eventBusName);\n\n if (eventBusConfig) {\n return eventBusConfig;\n }\n\n return allConfigs.find((eb) => eb.name === eventBusName);\n};\n\nexport const getOwnedItems = <T extends QPQConfigSetting>(settings: T[], qpqConfig: QPQConfig): T[] => {\n const appModuleName = getApplicationModuleName(qpqConfig);\n const appName = getApplicationName(qpqConfig);\n const appFeature = getApplicationModuleFeature(qpqConfig);\n const appEnvironment = getApplicationModuleEnvironment(qpqConfig);\n\n return settings.filter(\n (s) =>\n !s.owner ||\n ((!s.owner.module || s.owner.module === appModuleName) &&\n (!s.owner.application || s.owner.application === appName) &&\n (s.owner.feature === undefined || (!s.owner.feature && !appFeature) || s.owner.feature === appFeature) &&\n (!s.owner.environment || s.owner.environment === appEnvironment)),\n );\n};\n\nexport const getAllKeyValueStores = <T extends object = any>(qpqConfig: QPQConfig): KeyValueStoreQPQConfigSetting<T>[] => {\n const keyValueStores = getConfigSettings<KeyValueStoreQPQConfigSetting<T>>(qpqConfig, QPQCoreConfigSettingType.keyValueStore);\n\n return keyValueStores;\n};\n\nexport const getAllGraphDatabaseConfigs = (qpqConfig: QPQConfig): GraphDatabaseQPQConfigSetting[] => {\n const graphDatabases = getConfigSettings<GraphDatabaseQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.graphDatabase);\n\n return graphDatabases;\n};\n\nexport const getDeployEventConfigs = (qpqConfig: QPQConfig): DeployEventsQPQConfigSetting[] => {\n const deployEvents = getConfigSettings<DeployEventsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.deployEvent);\n\n return deployEvents;\n};\n\nexport const getVirualNetworkConfigs = (qpqConfig: QPQConfig): VirtualNetworkQPQConfigSetting[] => {\n return getConfigSettings<VirtualNetworkQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.virtualNetwork);\n};\n\nexport const getOwnedKeyValueStores = <T extends object = any>(qpqConfig: QPQConfig): KeyValueStoreQPQConfigSetting<T>[] => {\n return getOwnedItems(getAllKeyValueStores(qpqConfig), qpqConfig);\n};\n\nexport const getOwnedGraphDatabases = (qpqConfig: QPQConfig): GraphDatabaseQPQConfigSetting[] => {\n return getOwnedItems(getAllGraphDatabaseConfigs(qpqConfig), qpqConfig);\n};\n\nexport const getOwnedStorageDrives = (qpqConfig: QPQConfig): StorageDriveQPQConfigSetting[] => {\n return getOwnedItems(getStorageDrives(qpqConfig), qpqConfig);\n};\n\nexport const resolveCrossServiceResourceName = (resourceName: ResourceName): CrossServiceResourceName => {\n if (typeof resourceName === 'string') {\n return {\n name: resourceName,\n };\n }\n\n return resourceName;\n};\n\nexport const getKeyValueStoreByName = <T extends object = any>(\n qpqConfig: QPQConfig,\n kvsName: string,\n): KeyValueStoreQPQConfigSetting<T> | undefined => {\n const keyValueStore = getAllKeyValueStores<T>(qpqConfig).find((kvs) => kvs.keyValueStoreName === kvsName);\n\n return keyValueStore;\n};\n\nexport const getActionProcessorSources = (configs: QPQConfig): QpqFunctionRuntime[] => {\n const sources = getConfigSettings<ActionProcessorsQPQConfigSetting>(configs, QPQCoreConfigSettingType.actionProcessors).map((ap) => ap.runtime);\n\n return sources;\n};\n\nexport const getUserDirectoryEmailTemplates = (qpqConfig: QPQConfig): Record<string, EmailTemplates> => {\n const userDirectories = getConfigSettings<UserDirectoryQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.userDirectory);\n\n const record = userDirectories.reduce(\n (acc, ud) => ({\n ...acc,\n [ud.name]: ud.emailTemplates,\n }),\n {} as Record<string, EmailTemplates>,\n );\n\n return record;\n};\n\nexport const getScheduleEvents = (configs: QPQConfig): ScheduleQPQConfigSetting[] => {\n return getConfigSettings<ScheduleQPQConfigSetting>(configs, QPQCoreConfigSettingType.schedule);\n};\n\nexport const getOwnedScheduleEvents = (qpqConfig: QPQConfig): ScheduleQPQConfigSetting[] => {\n return getOwnedItems(getScheduleEvents(qpqConfig), qpqConfig);\n};\n\nexport const getQueueSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n const queueConfigs = getConfigSettings<QueueQPQConfigSetting>(configs, QPQCoreConfigSettingType.queue);\n\n return queueConfigs.reduce((acc, qc) => [...acc, ...Object.values(qc.qpqQueueProcessors)], [] as QpqFunctionRuntime[]);\n};\n\nexport const getUserDirectorySrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n // We just want the ones this service owns.\n const userConfigs = getOwnedUserDirectories(qpqConfig);\n\n return userConfigs\n .reduce((acc, ud) => [...acc, ...Object.values(ud.emailTemplates), ...Object.values(ud.customAuthRuntime || {})], [] as QpqFunctionRuntime[])\n .filter((se) => !!se);\n};\n\nexport const getAllInlineFunctions = (qpqConfig: QPQConfig): InlineFunctionQPQConfigSetting[] => {\n return getConfigSettings<InlineFunctionQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.inlineFunction);\n};\n\nexport const getOwnedInlineFunctions = (qpqConfig: QPQConfig): InlineFunctionQPQConfigSetting[] => {\n return getOwnedItems(getAllInlineFunctions(qpqConfig), qpqConfig);\n};\n\nexport const getAllDynamicFunctions = (qpqConfig: QPQConfig): DynamicFunctionsQPQConfigSetting[] => {\n return getConfigSettings<DynamicFunctionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.dynamicFunctions);\n};\n\nexport const getOwnedDynamicFunctions = (qpqConfig: QPQConfig): DynamicFunctionsQPQConfigSetting[] => {\n return getOwnedItems(getAllDynamicFunctions(qpqConfig), qpqConfig);\n};\n\n// Used in bundlers to know where and what to build and index\nexport const getAllSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n const result = [\n ...getActionProcessorSources(qpqConfig),\n ...getScheduleEvents(qpqConfig).map((r) => r.runtime),\n ...getQueueSrcEntries(qpqConfig),\n ...getUserDirectorySrcEntries(qpqConfig),\n ...getDeployEventConfigs(qpqConfig).map((r) => r.runtime),\n ...getStorageDrives(qpqConfig).flatMap((sd) => [sd.onEvent?.create, sd.onEvent?.delete].filter((r) => !!r) as QpqFunctionRuntime[]),\n // A store's change-stream handler. Missing here, the bundler never sees it: the lambda\n // zip omits it and the dev server's dynamic loader has nothing to resolve, so the handler\n // simply never runs — and since nothing throws, the only symptom is a projection that\n // silently stops updating.\n ...(getAllKeyValueStores(qpqConfig)\n .map((kvs) => kvs.onStream?.runtime)\n .filter((runtime) => !!runtime) as QpqFunctionRuntime[]),\n ...getAllInlineFunctions(qpqConfig).map((f) => f.runtime),\n ...getAllDynamicFunctions(qpqConfig).map((f) => f.runtime),\n ];\n\n return result;\n};\n\nexport const getApiBuildPath = (qpqConfig: QPQConfig): string => {\n const [apiBuildPathConfig] = getConfigSettings<ApiBuildPathQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.apiBuildPath);\n\n if (!apiBuildPathConfig) {\n throw new Error(`Can not find app base path use defineApiBuildPath or defineApplicationModule`);\n }\n\n return apiBuildPathConfig.apiBuildPath;\n};\n\nexport const getSrcFilenameFromQpqFunctionRuntime = (qpqFunctionRuntime: QpqFunctionRuntime): string => {\n if (isQpqFunctionRuntimeAdvanced(qpqFunctionRuntime)) {\n return qpqFunctionRuntime.relativePath.split('/').pop() || '';\n }\n\n const [srcPath] = qpqFunctionRuntime.split('::');\n return srcPath.split('/').pop() || '';\n};\n\nexport const getSecretByName = (secretName: string, qpqConfig: QPQConfig): SecretQPQConfigSetting => {\n const secrets = getConfigSettings<SecretQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.secret);\n\n const secret = secrets.find((s) => s.key === secretName);\n\n if (!secret) {\n throw new Error(`Can not find secret [${secretName}]`);\n }\n\n return secret;\n};\n\nexport const getAllSecretConfigs = (qpqConfig: QPQConfig): SecretQPQConfigSetting[] => {\n const secrets = getConfigSettings<SecretQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.secret);\n\n return secrets;\n};\n\nexport const getOwnedSecrets = (qpqConfig: QPQConfig): SecretQPQConfigSetting[] => {\n const secrets = getAllSecretConfigs(qpqConfig);\n\n return getOwnedItems(secrets, qpqConfig);\n};\n\nexport const getCryptoKeyByName = (cryptoKeyName: string, qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting => {\n const cryptoKeys = getConfigSettings<CryptoKeyQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.cryptoKey);\n\n const cryptoKey = cryptoKeys.find((k) => k.keyName === cryptoKeyName);\n\n if (!cryptoKey) {\n throw new Error(`Can not find crypto key [${cryptoKeyName}]`);\n }\n\n return cryptoKey;\n};\n\nexport const getAllCryptoKeyConfigs = (qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting[] => {\n const cryptoKeys = getConfigSettings<CryptoKeyQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.cryptoKey);\n\n return cryptoKeys;\n};\n\nexport const getOwnedCryptoKeys = (qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting[] => {\n const cryptoKeys = getAllCryptoKeyConfigs(qpqConfig);\n\n return getOwnedItems(cryptoKeys, qpqConfig);\n};\n\nexport const getGlobalConfigValue = <T>(qpqConfig: QPQConfig, name: string): T => {\n const global = getConfigSettings<GlobalQPQConfigSetting<T>>(qpqConfig, QPQCoreConfigSettingType.global).find((g) => g.key === name);\n\n if (!global) {\n throw new Error(`Global config ${name} not found`);\n }\n\n return global.value;\n};\n\n// Resolves a global by name, giving precedence to globals declared on the\n// executing function (functionGlobals) before falling back to the service-wide\n// config global. Throws (via getGlobalConfigValue) if the name is found in neither.\nexport const resolveGlobalValue = <T>(qpqConfig: QPQConfig, functionGlobals: Record<string, unknown> | undefined, name: string): T => {\n if (functionGlobals && Object.prototype.hasOwnProperty.call(functionGlobals, name)) {\n return functionGlobals[name] as T;\n }\n\n return getGlobalConfigValue<T>(qpqConfig, name);\n};\n\nexport const getUserDirectories = (configs: QPQConfig): UserDirectoryQPQConfigSetting[] => {\n const userDirectories = getConfigSettings<UserDirectoryQPQConfigSetting>(configs, QPQCoreConfigSettingType.userDirectory);\n\n return userDirectories;\n};\n\nexport const getOwnedUserDirectories = (qpqConifg: QPQConfig): UserDirectoryQPQConfigSetting[] => {\n const userDirectories = getUserDirectories(qpqConifg);\n\n return getOwnedItems(userDirectories, qpqConifg);\n};\n\nexport const getUserDirectoryByName = (userDirectoryName: string, qpqConifg: QPQConfig): UserDirectoryQPQConfigSetting => {\n const userDirectory = getUserDirectories(qpqConifg).find((ud) => ud.name === userDirectoryName);\n\n if (!userDirectory) {\n throw new Error(`UserDirectory not found: ${userDirectoryName}`);\n }\n\n return userDirectory;\n};\n\nexport const getAllParameterConfigs = (qpqConfig: QPQConfig): ParameterQPQConfigSetting[] => {\n const parameters = getConfigSettings<ParameterQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.parameter);\n\n return parameters;\n};\n\nexport const getParameterConfig = (name: string, qpqConfig: QPQConfig): ParameterQPQConfigSetting => {\n const parameters = getConfigSettings<ParameterQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.parameter);\n\n const param = parameters.find((p) => p.key === name);\n\n if (!param) {\n throw new Error(`Parameter ${name} not found`);\n }\n\n return param;\n};\n\nexport const getOwnedParameterConfigs = (qpqConfig: QPQConfig): ParameterQPQConfigSetting[] => {\n const parameters = getAllParameterConfigs(qpqConfig);\n\n return getOwnedItems(parameters, qpqConfig);\n};\n\n/**\n * Merges every `defineBackendBundleOptions` in the config into a single set of\n * bundler directives. Services compose config from many fragments, so each\n * fragment can declare the build quirks of its own dependencies.\n */\nexport const getBackendBundleOptions = (qpqConfig: QPQConfig): Required<BackendBundleOptions> => {\n const settings = getConfigSettings<BackendBundleOptionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.backendBundleOptions);\n\n return {\n externals: settings.flatMap((setting) => setting.externals),\n ignoreModules: settings.flatMap((setting) => setting.ignoreModules),\n ignoreWarnings: settings.flatMap((setting) => setting.ignoreWarnings),\n };\n};\n\n/**\n * Merges every `defineFrontendBundleOptions` in the config into a single set\n * of views-bundler directives.\n */\nexport const getFrontendBundleOptions = (qpqConfig: QPQConfig): Required<FrontendBundleOptions> => {\n const settings = getConfigSettings<FrontendBundleOptionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.frontendBundleOptions);\n\n return {\n sharedSingletons: settings.flatMap((setting) => setting.sharedSingletons),\n };\n};\n\nexport const getUniqueKeyForSetting = (setting: QPQConfigSetting) => {\n const type = setting.configSettingType.split('/').pop();\n const key = setting.uniqueKey;\n\n return `${type}${key}`;\n};\n\nexport const getQueueConfigSettingByName = (name: string, qpqConfig: QPQConfig): QueueQPQConfigSetting | undefined => {\n const queueConfigs = getConfigSettings<QueueQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.queue);\n\n return queueConfigs.find((c) => c.name === name);\n};\n\nexport const getQueueQueueProcessors = (name: string, qpqConfig: QPQConfig): QpqQueueProcessors => {\n return getQueueConfigSettingByName(name, qpqConfig)?.qpqQueueProcessors || {};\n};\n\nexport const convertCustomFullyQualifiedResourceToGeneric = <T extends string>(resource: CustomFullyQualifiedResource<T>): FullyQualifiedResource => {\n type KeyType = KeyOf<CustomFullyQualifiedResource<T>>;\n const key: KeyType = Array.from(Object.keys(resource)).find(\n (k) => k !== 'module' && k !== 'application' && k !== 'feature' && k !== 'environment',\n ) as any as KeyType;\n\n const resourceName = resource[key as T];\n\n return {\n module: resource.module,\n application: resource.application,\n feature: resource.feature,\n environment: resource.environment,\n resourceName: resourceName,\n };\n};\n\nexport const getFullyQualifiedResourceName = (qpqConfig: QPQConfig, resourceName: string, config?: QPQConfigSetting): FullyQualifiedResource => {\n const confApplication = getApplicationName(qpqConfig);\n const confEnvironment = getApplicationModuleEnvironment(qpqConfig);\n const confFeature = getApplicationModuleFeature(qpqConfig);\n const confModule = getApplicationModuleName(qpqConfig);\n\n return {\n resourceName: config?.owner?.resourceNameOverride || resourceName,\n\n application: config?.owner?.application || confApplication,\n environment: config?.owner?.environment || confEnvironment,\n module: config?.owner?.module || confModule,\n feature: config?.owner?.feature || confFeature || '',\n };\n};\n\n// Fully Qualified Resource Names\nexport const getKeyValueStoreFullyQualifiedResourceName = (kvsName: string, qpqConfig: QPQConfig): FullyQualifiedResource => {\n const storeConfig = getKeyValueStoreByName(qpqConfig, kvsName);\n\n return getFullyQualifiedResourceName(qpqConfig, kvsName, storeConfig);\n};\n\nexport const isSameResource = (resourceA: FullyQualifiedResource, resourceB: FullyQualifiedResource): boolean => {\n return (\n resourceA.application === resourceB.application &&\n resourceA.environment === resourceB.environment &&\n resourceA.feature === resourceB.feature &&\n resourceA.module === resourceB.module &&\n resourceA.resourceName === resourceB.resourceName\n );\n};\n\nexport const getFullUrlFromConfigUrl = (configUrl: ConfigUrl, qpqConfig: QPQConfig): string => {\n if (typeof configUrl === 'string') {\n return configUrl;\n }\n\n const confEnvironment = getApplicationModuleEnvironment(qpqConfig);\n const confFeature = getApplicationModuleFeature(qpqConfig);\n\n let fullUrl = `${configUrl.domain}`;\n\n if (confEnvironment !== 'production') {\n fullUrl = `${confEnvironment}.${fullUrl}`;\n }\n\n if (confFeature) {\n fullUrl = `${confFeature}.${fullUrl}`;\n }\n\n if (configUrl.module) {\n fullUrl = `${configUrl.module}.${fullUrl}`;\n }\n\n if (configUrl.path) {\n fullUrl = `${fullUrl}${configUrl.path}`;\n }\n\n fullUrl = `${configUrl.protocol}://${fullUrl}`;\n\n return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C;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,GAAG,GAAG,WAAW,IAAI,OAAO,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,GAAG,GAAG,SAAS,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,GAAG,SAAS,CAAC,QAAQ,MAAM,OAAO,EAAE,CAAC;IAE/C,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AA7BW,QAAA,uBAAuB,2BA6BlC","sourcesContent":["import {\n ActionProcessorsQPQConfigSetting,\n AiQPQConfigSetting,\n ApiBuildPathQPQConfigSetting,\n ApplicationQPQConfigSetting,\n BackendBundleOptions,\n BackendBundleOptionsQPQConfigSetting,\n CryptoKeyQPQConfigSetting,\n defineJavascriptRuntime,\n DeployEventsQPQConfigSetting,\n DynamicFunctionsQPQConfigSetting,\n EmailTemplates,\n EnvironmentSettingsQPQConfigSetting,\n EventBusQPQConfigSetting,\n FederatedModuleStoreQPQConfigSetting,\n FrontendBundleOptions,\n FrontendBundleOptionsQPQConfigSetting,\n GlobalQPQConfigSetting,\n GraphDatabaseQPQConfigSetting,\n InlineFunctionQPQConfigSetting,\n JavascriptRuntimeQPQConfigSetting,\n KeyValueStoreQPQConfigSetting,\n ModuleQPQConfigSetting,\n NotifyErrorQPQConfigSetting,\n ParameterQPQConfigSetting,\n QPQConfig,\n QPQConfigItem,\n QPQConfigSetting,\n QPQCoreConfigSettingType,\n QpqQueueProcessors,\n QueueQPQConfigSetting,\n ScheduleQPQConfigSetting,\n SecretQPQConfigSetting,\n ServiceSettingsQPQConfigSetting,\n StorageDriveQPQConfigSetting,\n UserDirectoryQPQConfigSetting,\n VirtualNetworkQPQConfigSetting,\n} from './config';\nimport {\n ConfigUrl,\n CrossModuleOwner,\n CrossServiceResourceName,\n CustomFullyQualifiedResource,\n FullyQualifiedResource,\n KeyOf,\n QpqFunctionRuntime,\n ResourceName,\n} from './types';\nimport { isQpqFunctionRuntimeAdvanced } from './utils';\n\n/**\n * Flattens a QPQConfig array into a single array of QPQConfigSetting objects.\n * If a QPQConfigItem has a configSettingType of QPQCoreConfigSettingType.environmentSettings,\n * and its environment matches the current environment, its settings will be added to the flattened array.\n * @function\n * @param {QPQConfig} qpqConfig - The input QPQConfig array to be flattened.\n * @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects\n */\nexport const flattenQpqConfig = (qpqConfig: QPQConfig): QPQConfigSetting[] => {\n let environment = 'development';\n let service: string | undefined;\n\n /**\n * A recursive helper function that flattens an array of QPQConfigItem objects.\n * @function\n * @param {QPQConfigItem[]} configItems - An array of QPQConfigItem objects to be flattened.\n * @param {QPQConfigSetting[]} accumulator - An accumulator array for storing the flattened QPQConfigSetting objects.\n * @returns {QPQConfigSetting[]} - The flattened array of QPQConfigSetting objects.\n */\n const flatten = (configItems: QPQConfigItem[], accumulator: QPQConfigSetting[] = []): QPQConfigSetting[] => {\n return configItems.reduce<QPQConfigSetting[]>((acc, item) => {\n if (Array.isArray(item)) {\n return flatten(item, acc);\n } else {\n // If its a appName config item, update the environment variable\n if (item.configSettingType === QPQCoreConfigSettingType.appName) {\n environment = (item as ApplicationQPQConfigSetting).environment || 'development';\n }\n\n // If its a moduleName config item, update the service variable\n else if (item.configSettingType === QPQCoreConfigSettingType.moduleName) {\n service = (item as ModuleQPQConfigSetting).moduleName;\n }\n\n // Otherwise if its an environmentSettings config item, flatten out the child settings\n // for the current environment, falling back to the '*' key if present.\n else if (item.configSettingType === QPQCoreConfigSettingType.environmentSettings) {\n const envSetting = item as EnvironmentSettingsQPQConfigSetting;\n const settings = envSetting.settingsByEnvironment[environment] ?? envSetting.settingsByEnvironment['*'] ?? [];\n\n return flatten(settings, acc);\n }\n\n // Otherwise if its a serviceSettings config item, flatten out the child settings\n // for the current service, falling back to the '*' key if present.\n else if (item.configSettingType === QPQCoreConfigSettingType.serviceSettings) {\n if (!service) {\n throw new Error('defineServiceSettings requires a module to be set first via defineModule (usually through defineApplicationModule)');\n }\n\n const svcSetting = item as ServiceSettingsQPQConfigSetting;\n const settings = svcSetting.settingsByService[service] ?? svcSetting.settingsByService['*'] ?? [];\n\n return flatten(settings, acc);\n }\n\n // Otherwise its just a regular config item, add it to the list\n return [...acc, item];\n }\n }, accumulator);\n };\n\n return flatten(qpqConfig);\n};\n\n/**\n * Filters and returns the config settings of a specific type from a QPQConfig array.\n * @function\n * @template T - The specific type of QPQConfigSetting to filter.\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @param {string} configSettingType - The specific config setting type to filter.\n * @returns {T[]} - An array of filtered config settings of the specified type.\n */\nexport const getConfigSettings = <T extends QPQConfigSetting>(qpqConfig: QPQConfig, configSettingType: string): T[] => {\n const flatConfig = flattenQpqConfig(qpqConfig);\n return flatConfig.filter((c) => c.configSettingType === configSettingType) as T[];\n};\n\n/**\n * Retrieves a single config setting of a specific type from a QPQConfig array.\n * @function\n * @template T - The specific type of QPQConfigSetting to retrieve.\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @param {string} serviceInfrastructureConfigType - The specific config setting type to retrieve.\n * @returns {T | undefined} - The found config setting of the specified type or undefined if not found.\n */\nexport const getConfigSetting = <T extends QPQConfigSetting>(qpqConfig: QPQConfig, serviceInfrastructureConfigType: string): T | undefined => {\n const [setting] = getConfigSettings<T>(qpqConfig, serviceInfrastructureConfigType);\n return setting;\n};\n\n/**\n * Retrieves the ApplicationModuleSetting from a QPQConfig array.\n * @function\n * @param {QPQConfig} qpqConfig - The input QPQConfig array.\n * @returns {ApplicationQPQConfigSetting} - The ApplicationQPQConfigSetting from the QPQConfig array.\n * @throws {Error} - If the ApplicationQPQConfigSetting is not found in the QPQConfig array.\n */\nexport const getApplicationConfigSetting = (qpqConfig: QPQConfig): ApplicationQPQConfigSetting => {\n const applicationModuleSetting = getConfigSetting<ApplicationQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.appName);\n\n if (!applicationModuleSetting) {\n throw new Error('please use defineApplication in your QPQ config');\n }\n\n return applicationModuleSetting;\n};\n\nexport const getApplicationModuleName = (qpqConfig: QPQConfig): string => {\n const moduleSetting = getConfigSetting<ModuleQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.moduleName);\n\n if (!moduleSetting) {\n throw new Error('please use defineModule in your QPQ config');\n }\n\n return moduleSetting.moduleName;\n};\n\nexport const getApplicationConfigRoot = (qpqConfig: QPQConfig): string => {\n const moduleSetting = getConfigSetting<ApplicationQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.appName);\n\n if (!moduleSetting) {\n throw new Error('please use defineApplication in your QPQ config');\n }\n\n return moduleSetting.configRoot;\n};\n\nexport const getApplicationName = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).applicationName;\n};\n\nexport const getApplicationModuleFeature = (qpqConfig: QPQConfig): string | undefined => {\n return getApplicationConfigSetting(qpqConfig).feature;\n};\n\nexport const getConfigRoot = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).configRoot;\n};\n\nexport const getApplicationModuleEnvironment = (qpqConfig: QPQConfig): string => {\n return getApplicationConfigSetting(qpqConfig).environment || 'production';\n};\n\nexport const getStorageDrives = (configs: QPQConfig): StorageDriveQPQConfigSetting[] => {\n return getConfigSettings<StorageDriveQPQConfigSetting>(configs, QPQCoreConfigSettingType.storageDrive);\n};\n\nexport const getStorageDriveByName = (storageDriveName: string, configs: QPQConfig): StorageDriveQPQConfigSetting | undefined => {\n return getStorageDrives(configs).find((sd) => sd.storageDrive === storageDriveName);\n};\n\nexport const getFederatedModuleStore = (qpqConfig: QPQConfig): FederatedModuleStoreQPQConfigSetting | undefined => {\n return getConfigSetting<FederatedModuleStoreQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.federatedModuleStore);\n};\n\nexport const getQueues = (configs: QPQConfig): QueueQPQConfigSetting[] => {\n return getConfigSettings<QueueQPQConfigSetting>(configs, QPQCoreConfigSettingType.queue);\n};\n\nexport const getOwnedQueues = (configs: QPQConfig): QueueQPQConfigSetting[] => {\n return getOwnedItems(getQueues(configs), configs);\n};\n\nexport const getNotifyErrorConfigs = (configs: QPQConfig): NotifyErrorQPQConfigSetting[] => {\n return getConfigSettings<NotifyErrorQPQConfigSetting>(configs, QPQCoreConfigSettingType.notifyError);\n};\n\nexport const getQueueByName = (configs: QPQConfig, name: string): QueueQPQConfigSetting | undefined => {\n return getQueues(configs).find((q) => q.name === name);\n};\n\n// A FIFO queue can only be fed by a FIFO event bus - standard SNS topics cannot deliver\n// to FIFO SQS queues at all. Called at deploy/startup time (the queue and bus are separate\n// settings, so defineQueue can't validate this on its own).\nexport const assertFifoQueueEventBusSubscriptionsAreValid = (qpqConfig: QPQConfig): void => {\n const invalidSubscriptions = getQueues(qpqConfig)\n .filter((queue) => queue.isFifo)\n .flatMap((queue) =>\n queue.eventBusSubscriptions\n .filter((eventBusName) => !getEventBusConfigByName(eventBusName, qpqConfig)?.isFifo)\n .map((eventBusName) => `queue [${queue.name}] -> event bus [${eventBusName}]`),\n );\n\n if (invalidSubscriptions.length > 0) {\n throw new Error(\n `FIFO queues can only subscribe to FIFO event buses (standard SNS topics cannot deliver to FIFO SQS queues): ${invalidSubscriptions.join(', ')}`,\n );\n }\n};\n\nexport const getStorageDriveNames = (configs: QPQConfig): string[] => {\n const storageDriveNames = getConfigSettings<StorageDriveQPQConfigSetting>(configs, QPQCoreConfigSettingType.storageDrive).map(\n (sd) => sd.storageDrive,\n );\n\n return storageDriveNames;\n};\n\nexport const getAllEventBusConfigs = (qpqConfig: QPQConfig): EventBusQPQConfigSetting[] => {\n const eventBuses = getConfigSettings<EventBusQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.eventBus);\n\n return eventBuses;\n};\n\nexport const getAllAiConfigs = (qpqConfig: QPQConfig): AiQPQConfigSetting[] => {\n return getConfigSettings<AiQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.ai);\n};\n\n// Always resolves - falls back to the defineJavascriptRuntime defaults when no setting is present\nexport const getJavascriptRuntimeConfig = (qpqConfig: QPQConfig): JavascriptRuntimeQPQConfigSetting => {\n return getConfigSetting<JavascriptRuntimeQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.javascriptRuntime) ?? defineJavascriptRuntime();\n};\n\nexport const getOwnedEventBusConfigs = (qpqConfig: QPQConfig): EventBusQPQConfigSetting[] => {\n const ownedEventBusConfigs = getOwnedItems(getAllEventBusConfigs(qpqConfig), qpqConfig);\n\n return ownedEventBusConfigs;\n};\n\nexport const getEventBusConfigByName = (eventBusName: string, qpqConfig: QPQConfig): EventBusQPQConfigSetting | undefined => {\n const allConfigs = getAllEventBusConfigs(qpqConfig);\n\n const eventBusConfig = allConfigs.find((eb) => eb.owner?.resourceNameOverride === eventBusName);\n\n if (eventBusConfig) {\n return eventBusConfig;\n }\n\n return allConfigs.find((eb) => eb.name === eventBusName);\n};\n\nexport const getOwnedItems = <T extends QPQConfigSetting>(settings: T[], qpqConfig: QPQConfig): T[] => {\n const appModuleName = getApplicationModuleName(qpqConfig);\n const appName = getApplicationName(qpqConfig);\n const appFeature = getApplicationModuleFeature(qpqConfig);\n const appEnvironment = getApplicationModuleEnvironment(qpqConfig);\n\n return settings.filter(\n (s) =>\n !s.owner ||\n ((!s.owner.module || s.owner.module === appModuleName) &&\n (!s.owner.application || s.owner.application === appName) &&\n (s.owner.feature === undefined || (!s.owner.feature && !appFeature) || s.owner.feature === appFeature) &&\n (!s.owner.environment || s.owner.environment === appEnvironment)),\n );\n};\n\nexport const getAllKeyValueStores = <T extends object = any>(qpqConfig: QPQConfig): KeyValueStoreQPQConfigSetting<T>[] => {\n const keyValueStores = getConfigSettings<KeyValueStoreQPQConfigSetting<T>>(qpqConfig, QPQCoreConfigSettingType.keyValueStore);\n\n return keyValueStores;\n};\n\nexport const getAllGraphDatabaseConfigs = (qpqConfig: QPQConfig): GraphDatabaseQPQConfigSetting[] => {\n const graphDatabases = getConfigSettings<GraphDatabaseQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.graphDatabase);\n\n return graphDatabases;\n};\n\nexport const getDeployEventConfigs = (qpqConfig: QPQConfig): DeployEventsQPQConfigSetting[] => {\n const deployEvents = getConfigSettings<DeployEventsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.deployEvent);\n\n return deployEvents;\n};\n\nexport const getVirualNetworkConfigs = (qpqConfig: QPQConfig): VirtualNetworkQPQConfigSetting[] => {\n return getConfigSettings<VirtualNetworkQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.virtualNetwork);\n};\n\nexport const getOwnedKeyValueStores = <T extends object = any>(qpqConfig: QPQConfig): KeyValueStoreQPQConfigSetting<T>[] => {\n return getOwnedItems(getAllKeyValueStores(qpqConfig), qpqConfig);\n};\n\nexport const getOwnedGraphDatabases = (qpqConfig: QPQConfig): GraphDatabaseQPQConfigSetting[] => {\n return getOwnedItems(getAllGraphDatabaseConfigs(qpqConfig), qpqConfig);\n};\n\nexport const getOwnedStorageDrives = (qpqConfig: QPQConfig): StorageDriveQPQConfigSetting[] => {\n return getOwnedItems(getStorageDrives(qpqConfig), qpqConfig);\n};\n\nexport const resolveCrossServiceResourceName = (resourceName: ResourceName): CrossServiceResourceName => {\n if (typeof resourceName === 'string') {\n return {\n name: resourceName,\n };\n }\n\n return resourceName;\n};\n\nexport const getKeyValueStoreByName = <T extends object = any>(\n qpqConfig: QPQConfig,\n kvsName: string,\n): KeyValueStoreQPQConfigSetting<T> | undefined => {\n const keyValueStore = getAllKeyValueStores<T>(qpqConfig).find((kvs) => kvs.keyValueStoreName === kvsName);\n\n return keyValueStore;\n};\n\nexport const getActionProcessorSources = (configs: QPQConfig): QpqFunctionRuntime[] => {\n const sources = getConfigSettings<ActionProcessorsQPQConfigSetting>(configs, QPQCoreConfigSettingType.actionProcessors).map((ap) => ap.runtime);\n\n return sources;\n};\n\nexport const getUserDirectoryEmailTemplates = (qpqConfig: QPQConfig): Record<string, EmailTemplates> => {\n const userDirectories = getConfigSettings<UserDirectoryQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.userDirectory);\n\n const record = userDirectories.reduce(\n (acc, ud) => ({\n ...acc,\n [ud.name]: ud.emailTemplates,\n }),\n {} as Record<string, EmailTemplates>,\n );\n\n return record;\n};\n\nexport const getScheduleEvents = (configs: QPQConfig): ScheduleQPQConfigSetting[] => {\n return getConfigSettings<ScheduleQPQConfigSetting>(configs, QPQCoreConfigSettingType.schedule);\n};\n\nexport const getOwnedScheduleEvents = (qpqConfig: QPQConfig): ScheduleQPQConfigSetting[] => {\n return getOwnedItems(getScheduleEvents(qpqConfig), qpqConfig);\n};\n\nexport const getQueueSrcEntries = (configs: QPQConfig): QpqFunctionRuntime[] => {\n const queueConfigs = getConfigSettings<QueueQPQConfigSetting>(configs, QPQCoreConfigSettingType.queue);\n\n return queueConfigs.reduce((acc, qc) => [...acc, ...Object.values(qc.qpqQueueProcessors)], [] as QpqFunctionRuntime[]);\n};\n\nexport const getUserDirectorySrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n // We just want the ones this service owns.\n const userConfigs = getOwnedUserDirectories(qpqConfig);\n\n return userConfigs\n .reduce((acc, ud) => [...acc, ...Object.values(ud.emailTemplates), ...Object.values(ud.customAuthRuntime || {})], [] as QpqFunctionRuntime[])\n .filter((se) => !!se);\n};\n\nexport const getAllInlineFunctions = (qpqConfig: QPQConfig): InlineFunctionQPQConfigSetting[] => {\n return getConfigSettings<InlineFunctionQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.inlineFunction);\n};\n\nexport const getOwnedInlineFunctions = (qpqConfig: QPQConfig): InlineFunctionQPQConfigSetting[] => {\n return getOwnedItems(getAllInlineFunctions(qpqConfig), qpqConfig);\n};\n\nexport const getAllDynamicFunctions = (qpqConfig: QPQConfig): DynamicFunctionsQPQConfigSetting[] => {\n return getConfigSettings<DynamicFunctionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.dynamicFunctions);\n};\n\nexport const getOwnedDynamicFunctions = (qpqConfig: QPQConfig): DynamicFunctionsQPQConfigSetting[] => {\n return getOwnedItems(getAllDynamicFunctions(qpqConfig), qpqConfig);\n};\n\n// Runtime-attached action processor override sources must join the bundler sweep,\n// or the deployed bundle omits them and the dynamic load fails at runtime.\nexport const expandSrcEntriesWithActionProcessors = (runtimes: QpqFunctionRuntime[]): QpqFunctionRuntime[] => {\n return runtimes.flatMap((runtime) => [runtime, ...((isQpqFunctionRuntimeAdvanced(runtime) && runtime.actionProcessors) || [])]);\n};\n\n// Used in bundlers to know where and what to build and index\nexport const getAllSrcEntries = (qpqConfig: QPQConfig): QpqFunctionRuntime[] => {\n const result = [\n ...getActionProcessorSources(qpqConfig),\n ...getScheduleEvents(qpqConfig).map((r) => r.runtime),\n ...getQueueSrcEntries(qpqConfig),\n ...getUserDirectorySrcEntries(qpqConfig),\n ...getDeployEventConfigs(qpqConfig).map((r) => r.runtime),\n ...getStorageDrives(qpqConfig).flatMap((sd) => [sd.onEvent?.create, sd.onEvent?.delete].filter((r) => !!r) as QpqFunctionRuntime[]),\n // A store's change-stream handler. Missing here, the bundler never sees it: the lambda\n // zip omits it and the dev server's dynamic loader has nothing to resolve, so the handler\n // simply never runs — and since nothing throws, the only symptom is a projection that\n // silently stops updating.\n ...(getAllKeyValueStores(qpqConfig)\n .map((kvs) => kvs.onStream?.runtime)\n .filter((runtime) => !!runtime) as QpqFunctionRuntime[]),\n ...getAllInlineFunctions(qpqConfig).map((f) => f.runtime),\n ...getAllDynamicFunctions(qpqConfig).map((f) => f.runtime),\n ];\n\n return expandSrcEntriesWithActionProcessors(result);\n};\n\nexport const getApiBuildPath = (qpqConfig: QPQConfig): string => {\n const [apiBuildPathConfig] = getConfigSettings<ApiBuildPathQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.apiBuildPath);\n\n if (!apiBuildPathConfig) {\n throw new Error(`Can not find app base path use defineApiBuildPath or defineApplicationModule`);\n }\n\n return apiBuildPathConfig.apiBuildPath;\n};\n\nexport const getSrcFilenameFromQpqFunctionRuntime = (qpqFunctionRuntime: QpqFunctionRuntime): string => {\n if (isQpqFunctionRuntimeAdvanced(qpqFunctionRuntime)) {\n return qpqFunctionRuntime.relativePath.split('/').pop() || '';\n }\n\n const [srcPath] = qpqFunctionRuntime.split('::');\n return srcPath.split('/').pop() || '';\n};\n\nexport const getSecretByName = (secretName: string, qpqConfig: QPQConfig): SecretQPQConfigSetting => {\n const secrets = getConfigSettings<SecretQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.secret);\n\n const secret = secrets.find((s) => s.key === secretName);\n\n if (!secret) {\n throw new Error(`Can not find secret [${secretName}]`);\n }\n\n return secret;\n};\n\nexport const getAllSecretConfigs = (qpqConfig: QPQConfig): SecretQPQConfigSetting[] => {\n const secrets = getConfigSettings<SecretQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.secret);\n\n return secrets;\n};\n\nexport const getOwnedSecrets = (qpqConfig: QPQConfig): SecretQPQConfigSetting[] => {\n const secrets = getAllSecretConfigs(qpqConfig);\n\n return getOwnedItems(secrets, qpqConfig);\n};\n\nexport const getCryptoKeyByName = (cryptoKeyName: string, qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting => {\n const cryptoKeys = getConfigSettings<CryptoKeyQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.cryptoKey);\n\n const cryptoKey = cryptoKeys.find((k) => k.keyName === cryptoKeyName);\n\n if (!cryptoKey) {\n throw new Error(`Can not find crypto key [${cryptoKeyName}]`);\n }\n\n return cryptoKey;\n};\n\nexport const getAllCryptoKeyConfigs = (qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting[] => {\n const cryptoKeys = getConfigSettings<CryptoKeyQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.cryptoKey);\n\n return cryptoKeys;\n};\n\nexport const getOwnedCryptoKeys = (qpqConfig: QPQConfig): CryptoKeyQPQConfigSetting[] => {\n const cryptoKeys = getAllCryptoKeyConfigs(qpqConfig);\n\n return getOwnedItems(cryptoKeys, qpqConfig);\n};\n\nexport const getGlobalConfigValue = <T>(qpqConfig: QPQConfig, name: string): T => {\n const global = getConfigSettings<GlobalQPQConfigSetting<T>>(qpqConfig, QPQCoreConfigSettingType.global).find((g) => g.key === name);\n\n if (!global) {\n throw new Error(`Global config ${name} not found`);\n }\n\n return global.value;\n};\n\n// Resolves a global by name, giving precedence to globals declared on the\n// executing function (functionGlobals) before falling back to the service-wide\n// config global. Throws (via getGlobalConfigValue) if the name is found in neither.\nexport const resolveGlobalValue = <T>(qpqConfig: QPQConfig, functionGlobals: Record<string, unknown> | undefined, name: string): T => {\n if (functionGlobals && Object.prototype.hasOwnProperty.call(functionGlobals, name)) {\n return functionGlobals[name] as T;\n }\n\n return getGlobalConfigValue<T>(qpqConfig, name);\n};\n\nexport const getUserDirectories = (configs: QPQConfig): UserDirectoryQPQConfigSetting[] => {\n const userDirectories = getConfigSettings<UserDirectoryQPQConfigSetting>(configs, QPQCoreConfigSettingType.userDirectory);\n\n return userDirectories;\n};\n\nexport const getOwnedUserDirectories = (qpqConifg: QPQConfig): UserDirectoryQPQConfigSetting[] => {\n const userDirectories = getUserDirectories(qpqConifg);\n\n return getOwnedItems(userDirectories, qpqConifg);\n};\n\nexport const getUserDirectoryByName = (userDirectoryName: string, qpqConifg: QPQConfig): UserDirectoryQPQConfigSetting => {\n const userDirectory = getUserDirectories(qpqConifg).find((ud) => ud.name === userDirectoryName);\n\n if (!userDirectory) {\n throw new Error(`UserDirectory not found: ${userDirectoryName}`);\n }\n\n return userDirectory;\n};\n\nexport const getAllParameterConfigs = (qpqConfig: QPQConfig): ParameterQPQConfigSetting[] => {\n const parameters = getConfigSettings<ParameterQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.parameter);\n\n return parameters;\n};\n\nexport const getParameterConfig = (name: string, qpqConfig: QPQConfig): ParameterQPQConfigSetting => {\n const parameters = getConfigSettings<ParameterQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.parameter);\n\n const param = parameters.find((p) => p.key === name);\n\n if (!param) {\n throw new Error(`Parameter ${name} not found`);\n }\n\n return param;\n};\n\nexport const getOwnedParameterConfigs = (qpqConfig: QPQConfig): ParameterQPQConfigSetting[] => {\n const parameters = getAllParameterConfigs(qpqConfig);\n\n return getOwnedItems(parameters, qpqConfig);\n};\n\n/**\n * Merges every `defineBackendBundleOptions` in the config into a single set of\n * bundler directives. Services compose config from many fragments, so each\n * fragment can declare the build quirks of its own dependencies.\n */\nexport const getBackendBundleOptions = (qpqConfig: QPQConfig): Required<BackendBundleOptions> => {\n const settings = getConfigSettings<BackendBundleOptionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.backendBundleOptions);\n\n return {\n externals: settings.flatMap((setting) => setting.externals),\n ignoreModules: settings.flatMap((setting) => setting.ignoreModules),\n ignoreWarnings: settings.flatMap((setting) => setting.ignoreWarnings),\n };\n};\n\n/**\n * Merges every `defineFrontendBundleOptions` in the config into a single set\n * of views-bundler directives.\n */\nexport const getFrontendBundleOptions = (qpqConfig: QPQConfig): Required<FrontendBundleOptions> => {\n const settings = getConfigSettings<FrontendBundleOptionsQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.frontendBundleOptions);\n\n return {\n sharedSingletons: settings.flatMap((setting) => setting.sharedSingletons),\n };\n};\n\nexport const getUniqueKeyForSetting = (setting: QPQConfigSetting) => {\n const type = setting.configSettingType.split('/').pop();\n const key = setting.uniqueKey;\n\n return `${type}${key}`;\n};\n\nexport const getQueueConfigSettingByName = (name: string, qpqConfig: QPQConfig): QueueQPQConfigSetting | undefined => {\n const queueConfigs = getConfigSettings<QueueQPQConfigSetting>(qpqConfig, QPQCoreConfigSettingType.queue);\n\n return queueConfigs.find((c) => c.name === name);\n};\n\nexport const getQueueQueueProcessors = (name: string, qpqConfig: QPQConfig): QpqQueueProcessors => {\n return getQueueConfigSettingByName(name, qpqConfig)?.qpqQueueProcessors || {};\n};\n\nexport const convertCustomFullyQualifiedResourceToGeneric = <T extends string>(resource: CustomFullyQualifiedResource<T>): FullyQualifiedResource => {\n type KeyType = KeyOf<CustomFullyQualifiedResource<T>>;\n const key: KeyType = Array.from(Object.keys(resource)).find(\n (k) => k !== 'module' && k !== 'application' && k !== 'feature' && k !== 'environment',\n ) as any as KeyType;\n\n const resourceName = resource[key as T];\n\n return {\n module: resource.module,\n application: resource.application,\n feature: resource.feature,\n environment: resource.environment,\n resourceName: resourceName,\n };\n};\n\nexport const getFullyQualifiedResourceName = (qpqConfig: QPQConfig, resourceName: string, config?: QPQConfigSetting): FullyQualifiedResource => {\n const confApplication = getApplicationName(qpqConfig);\n const confEnvironment = getApplicationModuleEnvironment(qpqConfig);\n const confFeature = getApplicationModuleFeature(qpqConfig);\n const confModule = getApplicationModuleName(qpqConfig);\n\n return {\n resourceName: config?.owner?.resourceNameOverride || resourceName,\n\n application: config?.owner?.application || confApplication,\n environment: config?.owner?.environment || confEnvironment,\n module: config?.owner?.module || confModule,\n feature: config?.owner?.feature || confFeature || '',\n };\n};\n\n// Fully Qualified Resource Names\nexport const getKeyValueStoreFullyQualifiedResourceName = (kvsName: string, qpqConfig: QPQConfig): FullyQualifiedResource => {\n const storeConfig = getKeyValueStoreByName(qpqConfig, kvsName);\n\n return getFullyQualifiedResourceName(qpqConfig, kvsName, storeConfig);\n};\n\nexport const isSameResource = (resourceA: FullyQualifiedResource, resourceB: FullyQualifiedResource): boolean => {\n return (\n resourceA.application === resourceB.application &&\n resourceA.environment === resourceB.environment &&\n resourceA.feature === resourceB.feature &&\n resourceA.module === resourceB.module &&\n resourceA.resourceName === resourceB.resourceName\n );\n};\n\nexport const getFullUrlFromConfigUrl = (configUrl: ConfigUrl, qpqConfig: QPQConfig): string => {\n if (typeof configUrl === 'string') {\n return configUrl;\n }\n\n const confEnvironment = getApplicationModuleEnvironment(qpqConfig);\n const confFeature = getApplicationModuleFeature(qpqConfig);\n\n let fullUrl = `${configUrl.domain}`;\n\n if (confEnvironment !== 'production') {\n fullUrl = `${confEnvironment}.${fullUrl}`;\n }\n\n if (confFeature) {\n fullUrl = `${confFeature}.${fullUrl}`;\n }\n\n if (configUrl.module) {\n fullUrl = `${configUrl.module}.${fullUrl}`;\n }\n\n if (configUrl.path) {\n fullUrl = `${fullUrl}${configUrl.path}`;\n }\n\n fullUrl = `${configUrl.protocol}://${fullUrl}`;\n\n return fullUrl;\n};\n"]}
@@ -49,6 +49,7 @@ export declare const qpqCoreUtils: {
49
49
  getOwnedInlineFunctions: (qpqConfig: import("./config").QPQConfig) => import("./config").InlineFunctionQPQConfigSetting[];
50
50
  getAllDynamicFunctions: (qpqConfig: import("./config").QPQConfig) => import("./config").DynamicFunctionsQPQConfigSetting[];
51
51
  getOwnedDynamicFunctions: (qpqConfig: import("./config").QPQConfig) => import("./config").DynamicFunctionsQPQConfigSetting[];
52
+ expandSrcEntriesWithActionProcessors: (runtimes: import("./types").QpqFunctionRuntime[]) => import("./types").QpqFunctionRuntime[];
52
53
  getAllSrcEntries: (qpqConfig: import("./config").QPQConfig) => import("./types").QpqFunctionRuntime[];
53
54
  getApiBuildPath: (qpqConfig: import("./config").QPQConfig) => string;
54
55
  getSrcFilenameFromQpqFunctionRuntime: (qpqFunctionRuntime: import("./types").QpqFunctionRuntime) => string;
@@ -1,2 +1,4 @@
1
1
  export * from './createRuntime';
2
+ export * from './loadRuntimeActionProcessors';
3
+ export * from './mergeRuntimeActionProcessors';
2
4
  export * from './processAction';
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./createRuntime"), exports);
18
+ __exportStar(require("./loadRuntimeActionProcessors"), exports);
19
+ __exportStar(require("./mergeRuntimeActionProcessors"), exports);
18
20
  __exportStar(require("./processAction"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,kDAAgC","sourcesContent":["export * from './createRuntime';\nexport * from './processAction';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,gEAA8C;AAC9C,iEAA+C;AAC/C,kDAAgC","sourcesContent":["export * from './createRuntime';\nexport * from './loadRuntimeActionProcessors';\nexport * from './mergeRuntimeActionProcessors';\nexport * from './processAction';\n"]}
@@ -0,0 +1,5 @@
1
+ import { QPQConfig } from '../config';
2
+ import { ActionProcessorList } from '../types/Action';
3
+ import { DynamicModuleLoader } from '../types/DynamicModuleLoader';
4
+ import { QpqFunctionRuntime } from '../types/QpqFunctionRuntime';
5
+ export declare const loadRuntimeActionProcessors: (qpqConfig: QPQConfig, runtimes: QpqFunctionRuntime[] | undefined, dynamicModuleLoader: DynamicModuleLoader) => Promise<ActionProcessorList>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.loadRuntimeActionProcessors = void 0;
13
+ const getUniqueKeyFromQpqFunctionRuntime_1 = require("../utils/path/getUniqueKeyFromQpqFunctionRuntime");
14
+ // Keyed on the loader instance so cache lifetime follows the host: a lambda keeps
15
+ // one loader for the sandbox's life (cache hits across invocations), a dev server
16
+ // that rebuilds its loader on hot reload invalidates the cache with it.
17
+ const cachedListsByLoader = new WeakMap();
18
+ // Unlike service-wide custom processor sources (skipped on load failure), a
19
+ // runtime-attached override that fails to load throws: silently falling back to
20
+ // the default processors would, for example, run a route under the wrong auth.
21
+ const loadActionProcessorList = (runtime, qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
22
+ const resolver = yield dynamicModuleLoader(runtime);
23
+ if (typeof resolver !== 'function') {
24
+ throw new Error(`Expected action processor source to be a function, but got ${typeof resolver}: ${JSON.stringify(runtime)}`);
25
+ }
26
+ const actionProcessorList = yield resolver(qpqConfig, dynamicModuleLoader);
27
+ if (typeof actionProcessorList !== 'object' || actionProcessorList === null) {
28
+ throw new Error(`Expected action processor list to be an object, but got ${typeof actionProcessorList}: ${JSON.stringify(runtime)}`);
29
+ }
30
+ if (Object.values(actionProcessorList).some((processor) => typeof processor !== 'function')) {
31
+ throw new Error(`Expected all action processors to be functions: ${JSON.stringify(runtime)}`);
32
+ }
33
+ return actionProcessorList;
34
+ });
35
+ const loadRuntimeActionProcessors = (qpqConfig, runtimes, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
36
+ const merged = {};
37
+ for (const runtime of runtimes || []) {
38
+ let cachedLists = cachedListsByLoader.get(dynamicModuleLoader);
39
+ if (!cachedLists) {
40
+ cachedLists = new Map();
41
+ cachedListsByLoader.set(dynamicModuleLoader, cachedLists);
42
+ }
43
+ const cacheKey = (0, getUniqueKeyFromQpqFunctionRuntime_1.getUniqueKeyFromQpqFunctionRuntime)(runtime);
44
+ let listPromise = cachedLists.get(cacheKey);
45
+ if (!listPromise) {
46
+ listPromise = loadActionProcessorList(runtime, qpqConfig, dynamicModuleLoader);
47
+ cachedLists.set(cacheKey, listPromise);
48
+ // A failure must not stick in the cache, or one bad load 500s forever.
49
+ const evictOnFailure = () => cachedLists === null || cachedLists === void 0 ? void 0 : cachedLists.delete(cacheKey);
50
+ listPromise.catch(evictOnFailure);
51
+ }
52
+ Object.assign(merged, yield listPromise);
53
+ }
54
+ return merged;
55
+ });
56
+ exports.loadRuntimeActionProcessors = loadRuntimeActionProcessors;
57
+ //# sourceMappingURL=loadRuntimeActionProcessors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadRuntimeActionProcessors.js","sourceRoot":"","sources":["../../../src/runtime/loadRuntimeActionProcessors.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,yGAAsG;AAEtG,kFAAkF;AAClF,kFAAkF;AAClF,wEAAwE;AACxE,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAkE,CAAC;AAE1G,4EAA4E;AAC5E,gFAAgF;AAChF,+EAA+E;AAC/E,MAAM,uBAAuB,GAAG,CAC9B,OAA2B,EAC3B,SAAoB,EACpB,mBAAwC,EACV,EAAE;IAChC,MAAM,QAAQ,GAAgC,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAEjF,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,8DAA8D,OAAO,QAAQ,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/H,CAAC;IAED,MAAM,mBAAmB,GAAG,MAAM,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAE3E,IAAI,OAAO,mBAAmB,KAAK,QAAQ,IAAI,mBAAmB,KAAK,IAAI,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,2DAA2D,OAAO,mBAAmB,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvI,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,SAAS,KAAK,UA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8BtC","sourcesContent":["import { QPQConfig } from '../config';\nimport { ActionProcessorList, ActionProcessorListResolver } from '../types/Action';\nimport { DynamicModuleLoader } from '../types/DynamicModuleLoader';\nimport { QpqFunctionRuntime } from '../types/QpqFunctionRuntime';\nimport { getUniqueKeyFromQpqFunctionRuntime } from '../utils/path/getUniqueKeyFromQpqFunctionRuntime';\n\n// Keyed on the loader instance so cache lifetime follows the host: a lambda keeps\n// one loader for the sandbox's life (cache hits across invocations), a dev server\n// that rebuilds its loader on hot reload invalidates the cache with it.\nconst cachedListsByLoader = new WeakMap<DynamicModuleLoader, Map<string, Promise<ActionProcessorList>>>();\n\n// Unlike service-wide custom processor sources (skipped on load failure), a\n// runtime-attached override that fails to load throws: silently falling back to\n// the default processors would, for example, run a route under the wrong auth.\nconst loadActionProcessorList = async (\n runtime: QpqFunctionRuntime,\n qpqConfig: QPQConfig,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => {\n const resolver: ActionProcessorListResolver = await dynamicModuleLoader(runtime);\n\n if (typeof resolver !== 'function') {\n throw new Error(`Expected action processor source to be a function, but got ${typeof resolver}: ${JSON.stringify(runtime)}`);\n }\n\n const actionProcessorList = await resolver(qpqConfig, dynamicModuleLoader);\n\n if (typeof actionProcessorList !== 'object' || actionProcessorList === null) {\n throw new Error(`Expected action processor list to be an object, but got ${typeof actionProcessorList}: ${JSON.stringify(runtime)}`);\n }\n\n if (Object.values(actionProcessorList).some((processor) => typeof processor !== 'function')) {\n throw new Error(`Expected all action processors to be functions: ${JSON.stringify(runtime)}`);\n }\n\n return actionProcessorList;\n};\n\nexport const loadRuntimeActionProcessors = async (\n qpqConfig: QPQConfig,\n runtimes: QpqFunctionRuntime[] | undefined,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => {\n const merged: ActionProcessorList = {};\n\n for (const runtime of runtimes || []) {\n let cachedLists = cachedListsByLoader.get(dynamicModuleLoader);\n if (!cachedLists) {\n cachedLists = new Map();\n cachedListsByLoader.set(dynamicModuleLoader, cachedLists);\n }\n\n const cacheKey = getUniqueKeyFromQpqFunctionRuntime(runtime);\n\n let listPromise = cachedLists.get(cacheKey);\n if (!listPromise) {\n listPromise = loadActionProcessorList(runtime, qpqConfig, dynamicModuleLoader);\n cachedLists.set(cacheKey, listPromise);\n\n // A failure must not stick in the cache, or one bad load 500s forever.\n const evictOnFailure = () => cachedLists?.delete(cacheKey);\n listPromise.catch(evictOnFailure);\n }\n\n Object.assign(merged, await listPromise);\n }\n\n return merged;\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import { QPQConfig } from '../config';
2
+ import { ActionProcessorList } from '../types/Action';
3
+ import { DynamicModuleLoader } from '../types/DynamicModuleLoader';
4
+ import { QpqFunctionRuntime } from '../types/QpqFunctionRuntime';
5
+ export declare const mergeRuntimeActionProcessors: (qpqConfig: QPQConfig, qpqFunctionRuntimeInfo: QpqFunctionRuntime | undefined, baseActionProcessors: ActionProcessorList, dynamicModuleLoader: DynamicModuleLoader) => Promise<ActionProcessorList>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.mergeRuntimeActionProcessors = void 0;
13
+ const getActionProcessorsFromQpqFunctionRuntime_1 = require("../utils/path/getActionProcessorsFromQpqFunctionRuntime");
14
+ const loadRuntimeActionProcessors_1 = require("./loadRuntimeActionProcessors");
15
+ // Merges a runtime's attached action processor overrides over a base list, last
16
+ // wins. The single merge implementation for every merge point: resolveStory for
17
+ // the story execution, and the http event processors that must see a matched
18
+ // route's overrides during the framework preamble (auth decode, session seeding).
19
+ const mergeRuntimeActionProcessors = (qpqConfig, qpqFunctionRuntimeInfo, baseActionProcessors, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
20
+ const attachedSources = (0, getActionProcessorsFromQpqFunctionRuntime_1.getActionProcessorsFromQpqFunctionRuntime)(qpqFunctionRuntimeInfo);
21
+ // The base list is returned as-is when nothing is attached: it may not be a plain
22
+ // object (qpqExecuteLog replays through a Proxy, which a spread would flatten to
23
+ // nothing).
24
+ if (!(attachedSources === null || attachedSources === void 0 ? void 0 : attachedSources.length)) {
25
+ return baseActionProcessors;
26
+ }
27
+ return Object.assign(Object.assign({}, baseActionProcessors), (yield (0, loadRuntimeActionProcessors_1.loadRuntimeActionProcessors)(qpqConfig, attachedSources, dynamicModuleLoader)));
28
+ });
29
+ exports.mergeRuntimeActionProcessors = mergeRuntimeActionProcessors;
30
+ //# sourceMappingURL=mergeRuntimeActionProcessors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeRuntimeActionProcessors.js","sourceRoot":"","sources":["../../../src/runtime/mergeRuntimeActionProcessors.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,uHAAoH;AACpH,+EAA4E;AAE5E,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,kFAAkF;AAC3E,MAAM,4BAA4B,GAAG,CAC1C,SAAoB,EACpB,sBAAsD,EACtD,oBAAyC,EACzC,mBAAwC,EACV,EAAE;IAChC,MAAM,eAAe,GAAG,IAAA,qFAAyC,EAAC,sBAAsB,CAAC,CAAC;IAE1F,kFAAkF;IAClF,iFAAiF;IACjF,YAAY;IACZ,IAAI,CAAC,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAA,EAAE,CAAC;QAC7B,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,uCACK,oBAAoB,GACpB,CAAC,MAAM,IAAA,yDAA2B,EAAC,SAAS,EAAE,eAAe,EAAE,mBAAmB,CAAC,CAAC,EACvF;AACJ,CAAC,CAAA,CAAC;AAnBW,QAAA,4BAA4B,gCAmBvC","sourcesContent":["import { QPQConfig } from '../config';\nimport { ActionProcessorList } from '../types/Action';\nimport { DynamicModuleLoader } from '../types/DynamicModuleLoader';\nimport { QpqFunctionRuntime } from '../types/QpqFunctionRuntime';\nimport { getActionProcessorsFromQpqFunctionRuntime } from '../utils/path/getActionProcessorsFromQpqFunctionRuntime';\nimport { loadRuntimeActionProcessors } from './loadRuntimeActionProcessors';\n\n// Merges a runtime's attached action processor overrides over a base list, last\n// wins. The single merge implementation for every merge point: resolveStory for\n// the story execution, and the http event processors that must see a matched\n// route's overrides during the framework preamble (auth decode, session seeding).\nexport const mergeRuntimeActionProcessors = async (\n qpqConfig: QPQConfig,\n qpqFunctionRuntimeInfo: QpqFunctionRuntime | undefined,\n baseActionProcessors: ActionProcessorList,\n dynamicModuleLoader: DynamicModuleLoader,\n): Promise<ActionProcessorList> => {\n const attachedSources = getActionProcessorsFromQpqFunctionRuntime(qpqFunctionRuntimeInfo);\n\n // The base list is returned as-is when nothing is attached: it may not be a plain\n // object (qpqExecuteLog replays through a Proxy, which a spread would flatten to\n // nothing).\n if (!attachedSources?.length) {\n return baseActionProcessors;\n }\n\n return {\n ...baseActionProcessors,\n ...(await loadRuntimeActionProcessors(qpqConfig, attachedSources, dynamicModuleLoader)),\n };\n};\n"]}
@@ -16,14 +16,20 @@ const qpqCoreUtils_1 = require("../qpqCoreUtils");
16
16
  const ErrorTypeEnum_1 = require("../types/ErrorTypeEnum");
17
17
  const StorySession_1 = require("../types/StorySession");
18
18
  const utils_1 = require("../utils");
19
+ const mergeRuntimeActionProcessors_1 = require("./mergeRuntimeActionProcessors");
19
20
  const processAction_1 = require("./processAction");
20
21
  function resolveStory(story, args, qpqConfig, callerSession, getActionProcessors, getTimeNow, logger, runtimeCorrelation, runtimeType, dynamicModuleLoader, qpqFunctionRuntimeInfo, initialTags, streamRegistry) {
21
22
  return __awaiter(this, void 0, void 0, function* () {
22
23
  var _a, _b, _c;
23
- const actionProcessors = yield getActionProcessors(qpqConfig, dynamicModuleLoader);
24
+ // Runtime-attached action processor overrides merge over the base list, last
25
+ // wins. In-process nested executions (EXECUTE_STORY, EXECUTE_IMPLEMENTATION_STORY)
26
+ // inherit the caller's merged list for free: their processors pass it through as
27
+ // this call's getActionProcessors. Transport boundaries build the base list fresh
28
+ // from their own runtime's registration.
29
+ const actionProcessors = yield (0, mergeRuntimeActionProcessors_1.mergeRuntimeActionProcessors)(qpqConfig, qpqFunctionRuntimeInfo, yield getActionProcessors(qpqConfig, dynamicModuleLoader), dynamicModuleLoader);
24
30
  const registry = streamRegistry !== null && streamRegistry !== void 0 ? streamRegistry : (0, stream_1.createStreamRegistry)();
25
31
  const reader = story(...args);
26
- const runtimeGlobals = qpqFunctionRuntimeInfo && (0, utils_1.isQpqFunctionRuntimeAdvanced)(qpqFunctionRuntimeInfo) ? qpqFunctionRuntimeInfo.globals : undefined;
32
+ const runtimeGlobals = (0, utils_1.getGlobalsFromQpqFunctionRuntime)(qpqFunctionRuntimeInfo);
27
33
  let storyProgress = null;
28
34
  let storySession = {
29
35
  correlation: runtimeCorrelation,
@@ -1 +1 @@
1
- {"version":3,"file":"resolveStory.js","sourceRoot":"","sources":["../../../src/runtime/resolveStory.ts"],"names":[],"mappings":";;;;;;;;;;;AAWA,oCAmJC;AA7JD,sDAA4G;AAC5G,4CAAuD;AACvD,kDAA2D;AAG3D,0DAAuD;AACvD,wDAA8G;AAC9G,oCAAwD;AACxD,mDAAgD;AAEhD,SAAsB,YAAY,CAChC,KAAwB,EACxB,IAAW,EACX,SAAoB,EACpB,aAA2B,EAC3B,mBAAkG,EAClG,UAAwB,EACxB,MAAiB,EACjB,kBAA0B,EAC1B,WAA2B,EAC3B,mBAAwB,EACxB,sBAA2C,EAC3C,WAAsB,EACtB,c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,KACX,UAAU,EAAE,UAAU,EAAE,EACxB,KAAK,EAAE;oBACL,SAAS,EAAE,6BAA6B;oBACxC,SAAS,EAAE,6BAAa,CAAC,YAAY;oBACrC,UAAU,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,0CAAE,IAAI;iBACvC,IACD;QACJ,CAAC;QAED,MAAM,WAAW,mCACZ,QAAQ,KACX,UAAU,EAAE,UAAU,EAAE,EACxB,MAAM,EAAE,aAAa,CAAC,KAAK,GAC5B,CAAC;QAEF,yHAAyH;QACzH,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA","sourcesContent":["import { QPQConfig } from '../config';\nimport { isErroredActionResult, resolveActionResult, resolveActionResultError } from '../logic/actionLogic';\nimport { createStreamRegistry } from '../logic/stream';\nimport { getApplicationModuleName } from '../qpqCoreUtils';\nimport { QpqFunctionRuntime, QpqLogger, StreamRegistry } from '../types';\nimport { Action, ActionProcessorList } from '../types/Action';\nimport { ErrorTypeEnum } from '../types/ErrorTypeEnum';\nimport { QpqRuntimeType, Story, StoryResult, StorySession, StorySessionUpdater } from '../types/StorySession';\nimport { isQpqFunctionRuntimeAdvanced } from '../utils';\nimport { processAction } from './processAction';\n\nexport async function resolveStory<TArgs extends Array<any>>(\n story: Story<TArgs, any>,\n args: TArgs,\n qpqConfig: QPQConfig,\n callerSession: StorySession,\n getActionProcessors: (config: QPQConfig, dynamicModuleLoader: any) => Promise<ActionProcessorList>,\n getTimeNow: () => string,\n logger: QpqLogger,\n runtimeCorrelation: string,\n runtimeType: QpqRuntimeType,\n dynamicModuleLoader: any,\n qpqFunctionRuntimeInfo?: QpqFunctionRuntime,\n initialTags?: string[],\n streamRegistry?: StreamRegistry,\n): Promise<StoryResult<any>> {\n const actionProcessors: ActionProcessorList = await getActionProcessors(qpqConfig, dynamicModuleLoader);\n const registry = streamRegistry ?? createStreamRegistry();\n const reader = story(...args);\n\n const runtimeGlobals = qpqFunctionRuntimeInfo && isQpqFunctionRuntimeAdvanced(qpqFunctionRuntimeInfo) ? qpqFunctionRuntimeInfo.globals : undefined;\n\n let storyProgress: IteratorResult<Action<any>, any> | null = null;\n let storySession: StorySession = {\n correlation: runtimeCorrelation,\n depth: callerSession.depth + 1,\n decodedAccessToken: callerSession.decodedAccessToken,\n context: callerSession.context,\n localContext: callerSession.localContext,\n // In-process story executions run WITHIN the caller's function, so they\n // inherit its globals - their own registration wins on collision. This\n // covers inline functions (EXECUTE_STORY) AND implementation stories\n // (EXECUTE_IMPLEMENTATION_STORY: tool executors, drive file resolvers,\n // custom implementations) - both are nested, not transport boundaries, so\n // an AI tool executor can read the queue/route globals (e.g. the eventDoc\n // user-directory global needed to resolve the actor). Transport entries\n // (http/queue/ws) start fresh from their own runtime registration only.\n functionGlobals:\n runtimeType === QpqRuntimeType.EXECUTE_STORY || runtimeType === QpqRuntimeType.EXECUTE_IMPLEMENTATION_STORY\n ? {\n ...callerSession.functionGlobals,\n ...runtimeGlobals,\n }\n : runtimeGlobals,\n };\n\n const updateSession: StorySessionUpdater = (newSession: Partial<StorySession>): void => {\n storySession = { ...storySession, ...newSession };\n };\n\n const response: StoryResult<any> = {\n input: args,\n session: { ...storySession },\n history: [],\n startedAt: getTimeNow(),\n finishedAt: getTimeNow(),\n tags: initialTags || [],\n moduleName: getApplicationModuleName(qpqConfig),\n correlation: storySession.correlation!,\n fromCorrelation: callerSession.correlation,\n runtimeType: runtimeType,\n logs: [],\n qpqFunctionRuntimeInfo,\n };\n\n // Enforce maximum depth\n if (storySession.depth > 100) {\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: `Story depth exceeded [${storySession.depth}]!`,\n errorType: ErrorTypeEnum.GenericError,\n },\n };\n }\n\n try {\n storyProgress = reader.next();\n\n while (!storyProgress.done) {\n const action = storyProgress.value;\n const executionTime = getTimeNow();\n\n const actionResult = await processAction(action, actionProcessors, storySession, logger, updateSession, dynamicModuleLoader, registry);\n\n const historyEntry = {\n act: action,\n res: actionResult,\n startedAt: executionTime,\n finishedAt: getTimeNow(),\n };\n\n // console.log(`${action.type}: took ${new Date(historyEntry.finishedAt).getTime() - new Date(historyEntry.startedAt).getTime()}ms`);\n response.history.push(historyEntry);\n\n if (isErroredActionResult(actionResult) && !action.returnErrors) {\n console.log('Caught Error:', JSON.stringify(resolveActionResultError(actionResult)));\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: resolveActionResultError(actionResult),\n };\n }\n\n // Feed the result back to the story generator\n if (action.returnErrors) {\n const isSuccess = !isErroredActionResult(actionResult);\n const result = isSuccess\n ? { success: true, result: resolveActionResult(actionResult) }\n : { success: false, error: resolveActionResultError(actionResult) };\n storyProgress = reader.next(result);\n } else {\n storyProgress = reader.next(resolveActionResult(actionResult));\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n console.log(`Uncaught Error: [${JSON.stringify(storyProgress?.value?.type)}] ${err.message}`);\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: err.message,\n errorType: ErrorTypeEnum.GenericError,\n errorStack: storyProgress?.value?.type,\n },\n };\n }\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: 'Unknown error has occurred!',\n errorType: ErrorTypeEnum.GenericError,\n errorStack: storyProgress?.value?.type,\n },\n };\n }\n\n const storyResult = {\n ...response,\n finishedAt: getTimeNow(),\n result: storyProgress.value,\n };\n\n // console.log(`story took ${new Date(storyResult.finishedAt).getTime() - new Date(storyResult.startedAt).getTime()}ms`);\n return storyResult;\n}\n"]}
1
+ {"version":3,"file":"resolveStory.js","sourceRoot":"","sources":["../../../src/runtime/resolveStory.ts"],"names":[],"mappings":";;;;;;;;;;;AAYA,oCA6JC;AAxKD,sDAA4G;AAC5G,4CAAuD;AACvD,kDAA2D;AAG3D,0DAAuD;AACvD,wDAA8G;AAC9G,oCAA4D;AAC5D,iFAA8E;AAC9E,mDAAgD;AAEhD,SAAsB,YAAY,CAChC,KAAwB,EACxB,IAAW,EACX,SAAoB,EACpB,aAA2B,EAC3B,mBAA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AAG,CAAC,OAAO;wBACtB,SAAS,EAAE,6BAAa,CAAC,YAAY;wBACrC,UAAU,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,0CAAE,IAAI;qBACvC,IACD;YACJ,CAAC;YACD,uCACK,QAAQ,KACX,UAAU,EAAE,UAAU,EAAE,EACxB,KAAK,EAAE;oBACL,SAAS,EAAE,6BAA6B;oBACxC,SAAS,EAAE,6BAAa,CAAC,YAAY;oBACrC,UAAU,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,0CAAE,IAAI;iBACvC,IACD;QACJ,CAAC;QAED,MAAM,WAAW,mCACZ,QAAQ,KACX,UAAU,EAAE,UAAU,EAAE,EACxB,MAAM,EAAE,aAAa,CAAC,KAAK,GAC5B,CAAC;QAEF,yHAAyH;QACzH,OAAO,WAAW,CAAC;IACrB,CAAC;CAAA","sourcesContent":["import { QPQConfig } from '../config';\nimport { isErroredActionResult, resolveActionResult, resolveActionResultError } from '../logic/actionLogic';\nimport { createStreamRegistry } from '../logic/stream';\nimport { getApplicationModuleName } from '../qpqCoreUtils';\nimport { QpqFunctionRuntime, QpqLogger, StreamRegistry } from '../types';\nimport { Action, ActionProcessorList } from '../types/Action';\nimport { ErrorTypeEnum } from '../types/ErrorTypeEnum';\nimport { QpqRuntimeType, Story, StoryResult, StorySession, StorySessionUpdater } from '../types/StorySession';\nimport { getGlobalsFromQpqFunctionRuntime } from '../utils';\nimport { mergeRuntimeActionProcessors } from './mergeRuntimeActionProcessors';\nimport { processAction } from './processAction';\n\nexport async function resolveStory<TArgs extends Array<any>>(\n story: Story<TArgs, any>,\n args: TArgs,\n qpqConfig: QPQConfig,\n callerSession: StorySession,\n getActionProcessors: (config: QPQConfig, dynamicModuleLoader: any) => Promise<ActionProcessorList>,\n getTimeNow: () => string,\n logger: QpqLogger,\n runtimeCorrelation: string,\n runtimeType: QpqRuntimeType,\n dynamicModuleLoader: any,\n qpqFunctionRuntimeInfo?: QpqFunctionRuntime,\n initialTags?: string[],\n streamRegistry?: StreamRegistry,\n): Promise<StoryResult<any>> {\n // Runtime-attached action processor overrides merge over the base list, last\n // wins. In-process nested executions (EXECUTE_STORY, EXECUTE_IMPLEMENTATION_STORY)\n // inherit the caller's merged list for free: their processors pass it through as\n // this call's getActionProcessors. Transport boundaries build the base list fresh\n // from their own runtime's registration.\n const actionProcessors: ActionProcessorList = await mergeRuntimeActionProcessors(\n qpqConfig,\n qpqFunctionRuntimeInfo,\n await getActionProcessors(qpqConfig, dynamicModuleLoader),\n dynamicModuleLoader,\n );\n const registry = streamRegistry ?? createStreamRegistry();\n const reader = story(...args);\n\n const runtimeGlobals = getGlobalsFromQpqFunctionRuntime(qpqFunctionRuntimeInfo);\n\n let storyProgress: IteratorResult<Action<any>, any> | null = null;\n let storySession: StorySession = {\n correlation: runtimeCorrelation,\n depth: callerSession.depth + 1,\n decodedAccessToken: callerSession.decodedAccessToken,\n context: callerSession.context,\n localContext: callerSession.localContext,\n // In-process story executions run WITHIN the caller's function, so they\n // inherit its globals - their own registration wins on collision. This\n // covers inline functions (EXECUTE_STORY) AND implementation stories\n // (EXECUTE_IMPLEMENTATION_STORY: tool executors, drive file resolvers,\n // custom implementations) - both are nested, not transport boundaries, so\n // an AI tool executor can read the queue/route globals (e.g. the eventDoc\n // user-directory global needed to resolve the actor). Transport entries\n // (http/queue/ws) start fresh from their own runtime registration only.\n functionGlobals:\n runtimeType === QpqRuntimeType.EXECUTE_STORY || runtimeType === QpqRuntimeType.EXECUTE_IMPLEMENTATION_STORY\n ? {\n ...callerSession.functionGlobals,\n ...runtimeGlobals,\n }\n : runtimeGlobals,\n };\n\n const updateSession: StorySessionUpdater = (newSession: Partial<StorySession>): void => {\n storySession = { ...storySession, ...newSession };\n };\n\n const response: StoryResult<any> = {\n input: args,\n session: { ...storySession },\n history: [],\n startedAt: getTimeNow(),\n finishedAt: getTimeNow(),\n tags: initialTags || [],\n moduleName: getApplicationModuleName(qpqConfig),\n correlation: storySession.correlation!,\n fromCorrelation: callerSession.correlation,\n runtimeType: runtimeType,\n logs: [],\n qpqFunctionRuntimeInfo,\n };\n\n // Enforce maximum depth\n if (storySession.depth > 100) {\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: `Story depth exceeded [${storySession.depth}]!`,\n errorType: ErrorTypeEnum.GenericError,\n },\n };\n }\n\n try {\n storyProgress = reader.next();\n\n while (!storyProgress.done) {\n const action = storyProgress.value;\n const executionTime = getTimeNow();\n\n const actionResult = await processAction(action, actionProcessors, storySession, logger, updateSession, dynamicModuleLoader, registry);\n\n const historyEntry = {\n act: action,\n res: actionResult,\n startedAt: executionTime,\n finishedAt: getTimeNow(),\n };\n\n // console.log(`${action.type}: took ${new Date(historyEntry.finishedAt).getTime() - new Date(historyEntry.startedAt).getTime()}ms`);\n response.history.push(historyEntry);\n\n if (isErroredActionResult(actionResult) && !action.returnErrors) {\n console.log('Caught Error:', JSON.stringify(resolveActionResultError(actionResult)));\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: resolveActionResultError(actionResult),\n };\n }\n\n // Feed the result back to the story generator\n if (action.returnErrors) {\n const isSuccess = !isErroredActionResult(actionResult);\n const result = isSuccess\n ? { success: true, result: resolveActionResult(actionResult) }\n : { success: false, error: resolveActionResultError(actionResult) };\n storyProgress = reader.next(result);\n } else {\n storyProgress = reader.next(resolveActionResult(actionResult));\n }\n }\n } catch (err) {\n if (err instanceof Error) {\n console.log(`Uncaught Error: [${JSON.stringify(storyProgress?.value?.type)}] ${err.message}`);\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: err.message,\n errorType: ErrorTypeEnum.GenericError,\n errorStack: storyProgress?.value?.type,\n },\n };\n }\n return {\n ...response,\n finishedAt: getTimeNow(),\n error: {\n errorText: 'Unknown error has occurred!',\n errorType: ErrorTypeEnum.GenericError,\n errorStack: storyProgress?.value?.type,\n },\n };\n }\n\n const storyResult = {\n ...response,\n finishedAt: getTimeNow(),\n result: storyProgress.value,\n };\n\n // console.log(`story took ${new Date(storyResult.finishedAt).getTime() - new Date(storyResult.startedAt).getTime()}ms`);\n return storyResult;\n}\n"]}
@@ -11,5 +11,6 @@ export type QpqFunctionRuntimeAdvanced = {
11
11
  relativePath: string;
12
12
  functionName: string;
13
13
  globals?: Record<string, unknown>;
14
+ actionProcessors?: QpqFunctionRuntime[];
14
15
  };
15
16
  export type QpqFunctionRuntime = QpqFunctionRuntimeAdvanced | QpqFunctionRuntimeRelativePath;
@@ -1 +1 @@
1
- {"version":3,"file":"QpqFunctionRuntime.js","sourceRoot":"","sources":["../../../src/types/QpqFunctionRuntime.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a runtime function definition that can be either relative or advanced.\n *\n * Example:\n * - Advanced: { basePath: `E:/repo/project/src`, relativePath: `/service/entry/controller/admin::onAuthUpdate` }\n * - Relative: `/entry/controller/admin::onAuthUpdate`\n */\nexport type QpqFunctionRuntimeRelativePath = `/${string}::${string}`;\nexport type QpqFunctionRuntimeAdvanced = {\n basePath: string;\n relativePath: string;\n functionName: string;\n\n // Globals scoped to this function, keyed by global name. When the function's\n // story reads a global via askConfigGetGlobal, a value here takes precedence\n // over the service-wide global of the same name.\n globals?: Record<string, unknown>;\n};\n\nexport type QpqFunctionRuntime = QpqFunctionRuntimeAdvanced | QpqFunctionRuntimeRelativePath;\n"]}
1
+ {"version":3,"file":"QpqFunctionRuntime.js","sourceRoot":"","sources":["../../../src/types/QpqFunctionRuntime.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a runtime function definition that can be either relative or advanced.\n *\n * Example:\n * - Advanced: { basePath: `E:/repo/project/src`, relativePath: `/service/entry/controller/admin::onAuthUpdate` }\n * - Relative: `/entry/controller/admin::onAuthUpdate`\n */\nexport type QpqFunctionRuntimeRelativePath = `/${string}::${string}`;\nexport type QpqFunctionRuntimeAdvanced = {\n basePath: string;\n relativePath: string;\n functionName: string;\n\n // Globals scoped to this function, keyed by global name. When the function's\n // story reads a global via askConfigGetGlobal, a value here takes precedence\n // over the service-wide global of the same name.\n globals?: Record<string, unknown>;\n\n // Action processor overrides scoped to this function. Each entry points at a\n // getActionProcessors-style function (same contract as a defineActionProcessors\n // source); the returned processors are merged over the platform and service-wide\n // ones for this function's whole execution, last wins. That includes the\n // framework preamble (e.g. route auth decode) and in-process nested executions,\n // which inherit the caller's merged list; transport boundaries (http, queue, ws)\n // start fresh from their own runtime's registration. Footgun: an override can\n // shadow framework-internal actions for that execution, not just app-level ones.\n actionProcessors?: QpqFunctionRuntime[];\n};\n\nexport type QpqFunctionRuntime = QpqFunctionRuntimeAdvanced | QpqFunctionRuntimeRelativePath;\n"]}
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime } from '../../types/QpqFunctionRuntime';
2
+ export declare const getActionProcessorsFromQpqFunctionRuntime: (runtime?: QpqFunctionRuntime) => QpqFunctionRuntime[] | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActionProcessorsFromQpqFunctionRuntime = void 0;
4
+ const isQpqFunctionRuntimeAdvanced_1 = require("./isQpqFunctionRuntimeAdvanced");
5
+ // The action processor override sources attached to a runtime, if any. Only
6
+ // advanced runtimes can carry them; a relative-path runtime resolves to undefined.
7
+ const getActionProcessorsFromQpqFunctionRuntime = (runtime) => {
8
+ return runtime && (0, isQpqFunctionRuntimeAdvanced_1.isQpqFunctionRuntimeAdvanced)(runtime) ? runtime.actionProcessors : undefined;
9
+ };
10
+ exports.getActionProcessorsFromQpqFunctionRuntime = getActionProcessorsFromQpqFunctionRuntime;
11
+ //# sourceMappingURL=getActionProcessorsFromQpqFunctionRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getActionProcessorsFromQpqFunctionRuntime.js","sourceRoot":"","sources":["../../../../src/utils/path/getActionProcessorsFromQpqFunctionRuntime.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E,4EAA4E;AAC5E,mFAAmF;AAC5E,MAAM,yCAAyC,GAAG,CAAC,OAA4B,EAAoC,EAAE;IAC1H,OAAO,OAAO,IAAI,IAAA,2DAA4B,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;AACjG,CAAC,CAAC;AAFW,QAAA,yCAAyC,6CAEpD","sourcesContent":["import { QpqFunctionRuntime } from '../../types/QpqFunctionRuntime';\nimport { isQpqFunctionRuntimeAdvanced } from './isQpqFunctionRuntimeAdvanced';\n\n// The action processor override sources attached to a runtime, if any. Only\n// advanced runtimes can carry them; a relative-path runtime resolves to undefined.\nexport const getActionProcessorsFromQpqFunctionRuntime = (runtime?: QpqFunctionRuntime): QpqFunctionRuntime[] | undefined => {\n return runtime && isQpqFunctionRuntimeAdvanced(runtime) ? runtime.actionProcessors : undefined;\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import { QpqFunctionRuntime } from '../../types/QpqFunctionRuntime';
2
+ export declare const getGlobalsFromQpqFunctionRuntime: (runtime?: QpqFunctionRuntime) => Record<string, unknown> | undefined;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobalsFromQpqFunctionRuntime = void 0;
4
+ const isQpqFunctionRuntimeAdvanced_1 = require("./isQpqFunctionRuntimeAdvanced");
5
+ // The function-scoped globals attached to a runtime, if any. Only advanced
6
+ // runtimes can carry them; a relative-path runtime resolves to undefined.
7
+ const getGlobalsFromQpqFunctionRuntime = (runtime) => {
8
+ return runtime && (0, isQpqFunctionRuntimeAdvanced_1.isQpqFunctionRuntimeAdvanced)(runtime) ? runtime.globals : undefined;
9
+ };
10
+ exports.getGlobalsFromQpqFunctionRuntime = getGlobalsFromQpqFunctionRuntime;
11
+ //# sourceMappingURL=getGlobalsFromQpqFunctionRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGlobalsFromQpqFunctionRuntime.js","sourceRoot":"","sources":["../../../../src/utils/path/getGlobalsFromQpqFunctionRuntime.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E,2EAA2E;AAC3E,0EAA0E;AACnE,MAAM,gCAAgC,GAAG,CAAC,OAA4B,EAAuC,EAAE;IACpH,OAAO,OAAO,IAAI,IAAA,2DAA4B,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC,CAAC;AAFW,QAAA,gCAAgC,oCAE3C","sourcesContent":["import { QpqFunctionRuntime } from '../../types/QpqFunctionRuntime';\nimport { isQpqFunctionRuntimeAdvanced } from './isQpqFunctionRuntimeAdvanced';\n\n// The function-scoped globals attached to a runtime, if any. Only advanced\n// runtimes can carry them; a relative-path runtime resolves to undefined.\nexport const getGlobalsFromQpqFunctionRuntime = (runtime?: QpqFunctionRuntime): Record<string, unknown> | undefined => {\n return runtime && isQpqFunctionRuntimeAdvanced(runtime) ? runtime.globals : undefined;\n};\n"]}