@open-mercato/core 0.11.1-develop.8557.1.e615240a3e → 0.11.1-develop.8567.1.a167594505
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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/modules/api_keys/di.js +6 -2
- package/dist/modules/api_keys/di.js.map +2 -2
- package/dist/modules/api_keys/services/oneTimeIssuerService.js +47 -0
- package/dist/modules/api_keys/services/oneTimeIssuerService.js.map +7 -0
- package/dist/modules/audit_logs/di.js +2 -1
- package/dist/modules/audit_logs/di.js.map +2 -2
- package/dist/modules/audit_logs/services/actionLogService.js +65 -1
- package/dist/modules/audit_logs/services/actionLogService.js.map +2 -2
- package/dist/modules/auth/cli.js +1 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/commands/users.js +10 -2
- package/dist/modules/auth/commands/users.js.map +2 -2
- package/dist/modules/auth/lib/setup-app.js +19 -5
- package/dist/modules/auth/lib/setup-app.js.map +2 -2
- package/dist/modules/configs/cli.js +26 -29
- package/dist/modules/configs/cli.js.map +2 -2
- package/dist/modules/configs/di.js +3 -1
- package/dist/modules/configs/di.js.map +2 -2
- package/dist/modules/configs/lib/instance-config-initializer.js +44 -0
- package/dist/modules/configs/lib/instance-config-initializer.js.map +7 -0
- package/dist/modules/configs/lib/instance-defaults.js +204 -0
- package/dist/modules/configs/lib/instance-defaults.js.map +7 -0
- package/dist/modules/configs/lib/module-config-service.js +115 -1
- package/dist/modules/configs/lib/module-config-service.js.map +2 -2
- package/dist/modules/entities/api/definitions.batch.js +55 -25
- package/dist/modules/entities/api/definitions.batch.js.map +2 -2
- package/dist/modules/entities/api/definitions.js +35 -8
- package/dist/modules/entities/api/definitions.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js +14 -8
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
- package/dist/modules/notifications/lib/deliveryConfig.js +19 -12
- package/dist/modules/notifications/lib/deliveryConfig.js.map +2 -2
- package/dist/modules/notifications/setup.js +10 -0
- package/dist/modules/notifications/setup.js.map +2 -2
- package/dist/modules/translations/components/TranslationManager.js +47 -10
- package/dist/modules/translations/components/TranslationManager.js.map +2 -2
- package/dist/modules/wms/components/backend/CompletePutawayTaskDialog.js +8 -1
- package/dist/modules/wms/components/backend/CompletePutawayTaskDialog.js.map +2 -2
- package/dist/modules/workflows/ai-tools/authoring-pack.js +1 -1
- package/dist/modules/workflows/ai-tools/authoring-pack.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/advance/route.js +1 -0
- package/dist/modules/workflows/api/instances/[id]/advance/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/route.js +1 -1
- package/dist/modules/workflows/api/instances/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/validate-start/route.js +3 -1
- package/dist/modules/workflows/api/instances/validate-start/route.js.map +2 -2
- package/dist/modules/workflows/di.js +3 -1
- package/dist/modules/workflows/di.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +35 -7
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/condition-handler.js +1 -1
- package/dist/modules/workflows/lib/condition-handler.js.map +2 -2
- package/dist/modules/workflows/lib/error-handler.js +1 -1
- package/dist/modules/workflows/lib/error-handler.js.map +2 -2
- package/dist/modules/workflows/lib/event-trigger-service.js +1 -1
- package/dist/modules/workflows/lib/event-trigger-service.js.map +2 -2
- package/dist/modules/workflows/lib/example-definition-authoring.js +90 -0
- package/dist/modules/workflows/lib/example-definition-authoring.js.map +7 -0
- package/dist/modules/workflows/lib/named-rules.js +42 -0
- package/dist/modules/workflows/lib/named-rules.js.map +7 -0
- package/dist/modules/workflows/lib/owned-definition.js +2 -0
- package/dist/modules/workflows/lib/owned-definition.js.map +2 -2
- package/dist/modules/workflows/lib/parallel-handler.js +1 -1
- package/dist/modules/workflows/lib/parallel-handler.js.map +2 -2
- package/dist/modules/workflows/lib/signal-handler.js +1 -0
- package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
- package/dist/modules/workflows/lib/start-validator.js +87 -85
- package/dist/modules/workflows/lib/start-validator.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +1 -1
- package/dist/modules/workflows/lib/step-handler.js.map +2 -2
- package/dist/modules/workflows/lib/task-handler.js +1 -0
- package/dist/modules/workflows/lib/task-handler.js.map +2 -2
- package/dist/modules/workflows/lib/timer-handler.js +1 -0
- package/dist/modules/workflows/lib/timer-handler.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +48 -166
- package/dist/modules/workflows/lib/transition-handler.js.map +3 -3
- package/dist/modules/workflows/lib/workflow-executor.js +3 -2
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/package.json +8 -8
- package/src/modules/api_keys/di.ts +7 -2
- package/src/modules/api_keys/services/oneTimeIssuerService.ts +61 -0
- package/src/modules/audit_logs/di.ts +1 -0
- package/src/modules/audit_logs/services/actionLogService.ts +132 -1
- package/src/modules/auth/cli.ts +1 -0
- package/src/modules/auth/commands/users.ts +10 -2
- package/src/modules/auth/i18n/de.json +2 -0
- package/src/modules/auth/i18n/en.json +2 -0
- package/src/modules/auth/i18n/es.json +2 -0
- package/src/modules/auth/i18n/ko.json +2 -0
- package/src/modules/auth/i18n/pl.json +2 -0
- package/src/modules/auth/lib/setup-app.ts +30 -7
- package/src/modules/configs/cli.ts +39 -37
- package/src/modules/configs/di.ts +2 -0
- package/src/modules/configs/lib/instance-config-initializer.ts +56 -0
- package/src/modules/configs/lib/instance-defaults.ts +262 -0
- package/src/modules/configs/lib/module-config-service.ts +156 -0
- package/src/modules/entities/api/definitions.batch.ts +65 -27
- package/src/modules/entities/api/definitions.ts +40 -11
- package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +14 -7
- package/src/modules/notifications/lib/deliveryConfig.ts +20 -11
- package/src/modules/notifications/setup.ts +11 -0
- package/src/modules/translations/components/TranslationManager.tsx +49 -10
- package/src/modules/translations/i18n/de.json +1 -0
- package/src/modules/translations/i18n/en.json +1 -0
- package/src/modules/translations/i18n/es.json +1 -0
- package/src/modules/translations/i18n/ko.json +1 -0
- package/src/modules/translations/i18n/pl.json +1 -0
- package/src/modules/wms/components/backend/CompletePutawayTaskDialog.tsx +8 -1
- package/src/modules/wms/i18n/de.json +1 -0
- package/src/modules/wms/i18n/en.json +1 -0
- package/src/modules/wms/i18n/es.json +1 -0
- package/src/modules/wms/i18n/ko.json +1 -0
- package/src/modules/wms/i18n/pl.json +1 -0
- package/src/modules/workflows/ai-tools/authoring-pack.ts +3 -1
- package/src/modules/workflows/api/instances/[id]/advance/route.ts +1 -0
- package/src/modules/workflows/api/instances/route.ts +1 -1
- package/src/modules/workflows/api/instances/validate-start/route.ts +3 -1
- package/src/modules/workflows/di.ts +2 -0
- package/src/modules/workflows/lib/activity-executor.ts +48 -30
- package/src/modules/workflows/lib/condition-handler.ts +1 -1
- package/src/modules/workflows/lib/error-handler.ts +1 -1
- package/src/modules/workflows/lib/event-trigger-service.ts +1 -1
- package/src/modules/workflows/lib/example-definition-authoring.ts +114 -0
- package/src/modules/workflows/lib/named-rules.ts +54 -0
- package/src/modules/workflows/lib/owned-definition.ts +4 -1
- package/src/modules/workflows/lib/parallel-handler.ts +1 -1
- package/src/modules/workflows/lib/signal-handler.ts +1 -0
- package/src/modules/workflows/lib/start-validator.ts +96 -94
- package/src/modules/workflows/lib/step-handler.ts +1 -1
- package/src/modules/workflows/lib/task-handler.ts +1 -0
- package/src/modules/workflows/lib/timer-handler.ts +1 -0
- package/src/modules/workflows/lib/transition-handler.ts +74 -238
- package/src/modules/workflows/lib/workflow-executor.ts +7 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isApiKeysModuleEnabled } from "./optional-modules.js";
|
|
2
1
|
import { createModuleQueue } from "@open-mercato/queue";
|
|
3
2
|
import {
|
|
4
3
|
safeOutboundFetch,
|
|
@@ -958,6 +957,36 @@ async function executeInvokeAgent(config, context, container) {
|
|
|
958
957
|
__park: { signalName: INVOKE_AGENT_SIGNAL_NAME }
|
|
959
958
|
};
|
|
960
959
|
}
|
|
960
|
+
function isMissingApiKeyOneTimeIssuerError(error) {
|
|
961
|
+
if (!error || typeof error !== "object") return false;
|
|
962
|
+
const candidate = error;
|
|
963
|
+
if (candidate.name !== "AwilixResolutionError") return false;
|
|
964
|
+
const message = typeof candidate.message === "string" ? candidate.message : "";
|
|
965
|
+
return /Could not resolve ['"]apiKeyOneTimeIssuer['"]/.test(message);
|
|
966
|
+
}
|
|
967
|
+
function resolveApiKeyOneTimeIssuer(container) {
|
|
968
|
+
if (typeof container.hasRegistration === "function" && !container.hasRegistration("apiKeyOneTimeIssuer")) {
|
|
969
|
+
return null;
|
|
970
|
+
}
|
|
971
|
+
let candidate;
|
|
972
|
+
try {
|
|
973
|
+
candidate = container.resolve("apiKeyOneTimeIssuer");
|
|
974
|
+
} catch (error) {
|
|
975
|
+
if (isMissingApiKeyOneTimeIssuerError(error)) {
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
throw error;
|
|
979
|
+
}
|
|
980
|
+
if (candidate === null || candidate === void 0) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
if (typeof candidate.withOneTimeApiKey !== "function") {
|
|
984
|
+
throw new Error(
|
|
985
|
+
"[CALL_API] Registered apiKeyOneTimeIssuer service is invalid: missing withOneTimeApiKey()."
|
|
986
|
+
);
|
|
987
|
+
}
|
|
988
|
+
return candidate;
|
|
989
|
+
}
|
|
961
990
|
async function executeCallApi(em, config, context, container, signal) {
|
|
962
991
|
assertTrustedEventTriggerIdentity(context.workflowInstance);
|
|
963
992
|
const interpolatedConfig = interpolateActivityConfig(config, context, "CALL_API");
|
|
@@ -972,22 +1001,21 @@ async function executeCallApi(em, config, context, container, signal) {
|
|
|
972
1001
|
throw new Error('CALL_API requires "endpoint" field');
|
|
973
1002
|
}
|
|
974
1003
|
const requestUrl = await resolveCallApiUrl(endpoint);
|
|
975
|
-
|
|
1004
|
+
const apiKeyOneTimeIssuer = resolveApiKeyOneTimeIssuer(container);
|
|
1005
|
+
if (!apiKeyOneTimeIssuer) {
|
|
976
1006
|
throw await createCallApiError(
|
|
977
1007
|
"workflows.errors.callApi.apiKeysModuleDisabled",
|
|
978
1008
|
"CALL_API needs the api_keys module to authenticate internal calls"
|
|
979
1009
|
);
|
|
980
1010
|
}
|
|
981
|
-
const
|
|
982
|
-
const
|
|
983
|
-
const resolvedRoleIds = await resolveCallApiRoleIds(apiKeyEm, context.workflowInstance);
|
|
1011
|
+
const roleResolutionEm = container.resolve("em").fork({ clear: true, freshEventManager: true, useContext: false });
|
|
1012
|
+
const resolvedRoleIds = await resolveCallApiRoleIds(roleResolutionEm, context.workflowInstance);
|
|
984
1013
|
if (resolvedRoleIds.length === 0) {
|
|
985
1014
|
throw new Error(
|
|
986
1015
|
`[CALL_API] Refusing to execute CALL_API for workflow instance ${context.workflowInstance.id}: no traceable user roles could be resolved from the workflow instance or definition. CALL_API activities must run under the identity of the user who triggered them.`
|
|
987
1016
|
);
|
|
988
1017
|
}
|
|
989
|
-
return await
|
|
990
|
-
apiKeyEm,
|
|
1018
|
+
return await apiKeyOneTimeIssuer.withOneTimeApiKey(
|
|
991
1019
|
{
|
|
992
1020
|
name: `__workflow_${context.workflowInstance.id}__`,
|
|
993
1021
|
description: `One-time key for workflow ${context.workflowInstance.workflowId} instance ${context.workflowInstance.id}`,
|