@open-mercato/core 0.11.1-develop.8557.1.e615240a3e → 0.11.1-develop.8572.1.85986dc508
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/catalog/lib/productScopeReindex.js +1 -1
- package/dist/modules/catalog/lib/productScopeReindex.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/payment_gateways/lib/gateway-service.js +1 -1
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/query_index/api/purge.js +1 -1
- package/dist/modules/query_index/api/purge.js.map +2 -2
- package/dist/modules/query_index/api/reindex.js +1 -1
- package/dist/modules/query_index/api/reindex.js.map +2 -2
- package/dist/modules/query_index/cli.js +2 -2
- package/dist/modules/query_index/cli.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +5 -1
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/subscribers/purge.js +3 -3
- package/dist/modules/query_index/subscribers/purge.js.map +2 -2
- package/dist/modules/query_index/subscribers/reindex.js +11 -13
- package/dist/modules/query_index/subscribers/reindex.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/components/fields/ActivityConfigFields.js +2 -0
- package/dist/modules/workflows/components/fields/ActivityConfigFields.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/events.js +13 -0
- package/dist/modules/workflows/events.js.map +2 -2
- package/dist/modules/workflows/lib/activity-executor.js +48 -15
- 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/catalog/lib/productScopeReindex.ts +1 -1
- 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/payment_gateways/lib/gateway-service.ts +2 -2
- package/src/modules/query_index/api/purge.ts +1 -1
- package/src/modules/query_index/api/reindex.ts +1 -1
- package/src/modules/query_index/cli.ts +2 -2
- package/src/modules/query_index/lib/engine.ts +5 -1
- package/src/modules/query_index/subscribers/purge.ts +5 -4
- package/src/modules/query_index/subscribers/reindex.ts +14 -15
- 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/components/fields/ActivityConfigFields.tsx +2 -0
- package/src/modules/workflows/di.ts +2 -0
- package/src/modules/workflows/events.ts +14 -0
- package/src/modules/workflows/lib/activity-executor.ts +64 -40
- 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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../../openapi.js";
|
|
14
14
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
15
15
|
import { isCrudHttpError } from "@open-mercato/shared/lib/crud/errors";
|
|
16
|
+
import { reportError } from "@open-mercato/telemetry";
|
|
16
17
|
const logger = createLogger("workflows");
|
|
17
18
|
const metadata = {
|
|
18
19
|
requireAuth: true,
|
|
@@ -57,7 +58,7 @@ async function POST(request) {
|
|
|
57
58
|
locale,
|
|
58
59
|
tenantId,
|
|
59
60
|
organizationId
|
|
60
|
-
});
|
|
61
|
+
}, { container });
|
|
61
62
|
return NextResponse.json({
|
|
62
63
|
canStart: result.canStart,
|
|
63
64
|
workflowId,
|
|
@@ -67,6 +68,7 @@ async function POST(request) {
|
|
|
67
68
|
} catch (error) {
|
|
68
69
|
if (isCrudHttpError(error)) return NextResponse.json(error.body, { status: error.status });
|
|
69
70
|
logger.error("Error validating workflow start", { err: error });
|
|
71
|
+
reportError(error, { module: "workflows", code: "workflows.start_validation_failed" });
|
|
70
72
|
return NextResponse.json(
|
|
71
73
|
{ error: "Failed to validate workflow start" },
|
|
72
74
|
{ status: 500 }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/modules/workflows/api/instances/validate-start/route.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Workflow Start Validation API\n *\n * POST /api/workflows/instances/validate-start\n *\n * Validates if a workflow can be started with the given context.\n * Evaluates pre-conditions defined on the START step and returns\n * validation errors with localized messages if any fail.\n */\n\nimport { NextRequest, NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'\nimport { resolveSingleOrganizationIdOrDeny } from '@open-mercato/core/modules/directory/utils/organizationScopeFilter'\nimport * as startValidator from '../../../lib/start-validator'\nimport {\n workflowsTag,\n validateStartRequestSchema,\n validateStartResponseSchema,\n workflowErrorSchema,\n} from '../../openapi'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'\n\nconst logger = createLogger('workflows')\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['workflows.instances.view'],\n}\n\n// Input schema for validation request\nconst validateStartInputSchema = z.object({\n workflowId: z.string().min(1),\n version: z.number().int().positive().optional(),\n context: z.record(z.string(), z.any()).optional().default({}),\n locale: z.string().default('en'),\n})\n\n/**\n * POST /api/workflows/instances/validate-start\n *\n * Validates if a workflow can be started with the given context.\n * Returns 200 with validation result (canStart: true/false, errors, validatedRules)\n */\nexport async function POST(request: NextRequest) {\n try {\n const container = await createRequestContainer()\n const em = container.resolve('em')\n const auth = await getAuthFromRequest(request)\n\n if (!auth) {\n return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n }\n\n const scope = await resolveOrganizationScopeForRequest({ container, auth, request })\n const tenantId = auth.tenantId\n const organizationId = resolveSingleOrganizationIdOrDeny(scope, auth)\n\n if (!tenantId || !organizationId) {\n return NextResponse.json(\n { error: 'Missing tenant or organization context' },\n { status: 400 }\n )\n }\n\n const body = await request.json()\n const validation = validateStartInputSchema.safeParse(body)\n\n if (!validation.success) {\n return NextResponse.json(\n { error: 'Validation failed', details: validation.error.issues },\n { status: 400 }\n )\n }\n\n const { workflowId, version, context, locale } = validation.data\n\n // Validate start pre-conditions\n const result = await startValidator.validateWorkflowStart(em, {\n workflowId,\n version,\n context,\n locale,\n tenantId,\n organizationId,\n })\n\n // Always return 200 with the validation result\n // The client can check canStart to determine if workflow can proceed\n return NextResponse.json({\n canStart: result.canStart,\n workflowId,\n errors: result.errors.length > 0 ? result.errors : undefined,\n validatedRules: result.validatedRules.length > 0 ? result.validatedRules : undefined,\n })\n } catch (error) {\n if (isCrudHttpError(error)) return NextResponse.json(error.body, { status: error.status })\n logger.error('Error validating workflow start', { err: error })\n return NextResponse.json(\n { error: 'Failed to validate workflow start' },\n { status: 500 }\n )\n }\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: workflowsTag,\n summary: 'Validate workflow start',\n methods: {\n POST: {\n summary: 'Validate if workflow can be started',\n description: 'Evaluates pre-conditions defined on the START step and returns validation errors with localized messages if any fail. Returns canStart: true/false with details.',\n requestBody: {\n contentType: 'application/json',\n schema: validateStartRequestSchema,\n },\n responses: [\n { status: 200, description: 'Validation result (canStart, errors, validatedRules)', schema: validateStartResponseSchema },\n ],\n errors: [\n { status: 400, description: 'Invalid request body or missing context', schema: workflowErrorSchema },\n { status: 401, description: 'Unauthorized', schema: workflowErrorSchema },\n { status: 500, description: 'Internal server error', schema: workflowErrorSchema },\n ],\n },\n },\n}\n"],
|
|
5
|
-
"mappings": "AAUA,SAAsB,oBAAoB;AAC1C,SAAS,SAAS;AAElB,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,0CAA0C;AACnD,SAAS,yCAAyC;AAClD,YAAY,oBAAoB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * Workflow Start Validation API\n *\n * POST /api/workflows/instances/validate-start\n *\n * Validates if a workflow can be started with the given context.\n * Evaluates pre-conditions defined on the START step and returns\n * validation errors with localized messages if any fail.\n */\n\nimport { NextRequest, NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'\nimport { resolveSingleOrganizationIdOrDeny } from '@open-mercato/core/modules/directory/utils/organizationScopeFilter'\nimport * as startValidator from '../../../lib/start-validator'\nimport {\n workflowsTag,\n validateStartRequestSchema,\n validateStartResponseSchema,\n workflowErrorSchema,\n} from '../../openapi'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { reportError } from '@open-mercato/telemetry'\n\nconst logger = createLogger('workflows')\n\nexport const metadata = {\n requireAuth: true,\n requireFeatures: ['workflows.instances.view'],\n}\n\n// Input schema for validation request\nconst validateStartInputSchema = z.object({\n workflowId: z.string().min(1),\n version: z.number().int().positive().optional(),\n context: z.record(z.string(), z.any()).optional().default({}),\n locale: z.string().default('en'),\n})\n\n/**\n * POST /api/workflows/instances/validate-start\n *\n * Validates if a workflow can be started with the given context.\n * Returns 200 with validation result (canStart: true/false, errors, validatedRules)\n */\nexport async function POST(request: NextRequest) {\n try {\n const container = await createRequestContainer()\n const em = container.resolve('em')\n const auth = await getAuthFromRequest(request)\n\n if (!auth) {\n return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n }\n\n const scope = await resolveOrganizationScopeForRequest({ container, auth, request })\n const tenantId = auth.tenantId\n const organizationId = resolveSingleOrganizationIdOrDeny(scope, auth)\n\n if (!tenantId || !organizationId) {\n return NextResponse.json(\n { error: 'Missing tenant or organization context' },\n { status: 400 }\n )\n }\n\n const body = await request.json()\n const validation = validateStartInputSchema.safeParse(body)\n\n if (!validation.success) {\n return NextResponse.json(\n { error: 'Validation failed', details: validation.error.issues },\n { status: 400 }\n )\n }\n\n const { workflowId, version, context, locale } = validation.data\n\n // Validate start pre-conditions\n const result = await startValidator.validateWorkflowStart(em, {\n workflowId,\n version,\n context,\n locale,\n tenantId,\n organizationId,\n }, { container })\n\n // Always return 200 with the validation result\n // The client can check canStart to determine if workflow can proceed\n return NextResponse.json({\n canStart: result.canStart,\n workflowId,\n errors: result.errors.length > 0 ? result.errors : undefined,\n validatedRules: result.validatedRules.length > 0 ? result.validatedRules : undefined,\n })\n } catch (error) {\n if (isCrudHttpError(error)) return NextResponse.json(error.body, { status: error.status })\n logger.error('Error validating workflow start', { err: error })\n reportError(error, { module: 'workflows', code: 'workflows.start_validation_failed' })\n return NextResponse.json(\n { error: 'Failed to validate workflow start' },\n { status: 500 }\n )\n }\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: workflowsTag,\n summary: 'Validate workflow start',\n methods: {\n POST: {\n summary: 'Validate if workflow can be started',\n description: 'Evaluates pre-conditions defined on the START step and returns validation errors with localized messages if any fail. Returns canStart: true/false with details.',\n requestBody: {\n contentType: 'application/json',\n schema: validateStartRequestSchema,\n },\n responses: [\n { status: 200, description: 'Validation result (canStart, errors, validatedRules)', schema: validateStartResponseSchema },\n ],\n errors: [\n { status: 400, description: 'Invalid request body or missing context', schema: workflowErrorSchema },\n { status: 401, description: 'Unauthorized', schema: workflowErrorSchema },\n { status: 500, description: 'Internal server error', schema: workflowErrorSchema },\n ],\n },\n },\n}\n"],
|
|
5
|
+
"mappings": "AAUA,SAAsB,oBAAoB;AAC1C,SAAS,SAAS;AAElB,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,0CAA0C;AACnD,SAAS,yCAAyC;AAClD,YAAY,oBAAoB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAE5B,MAAM,SAAS,aAAa,WAAW;AAEhC,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,0BAA0B;AAC9C;AAGA,MAAM,2BAA2B,EAAE,OAAO;AAAA,EACxC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EAC5B,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAC9C,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAAA,EAC5D,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI;AACjC,CAAC;AAQD,eAAsB,KAAK,SAAsB;AAC/C,MAAI;AACF,UAAM,YAAY,MAAM,uBAAuB;AAC/C,UAAM,KAAK,UAAU,QAAQ,IAAI;AACjC,UAAM,OAAO,MAAM,mBAAmB,OAAO;AAE7C,QAAI,CAAC,MAAM;AACT,aAAO,aAAa,KAAK,EAAE,OAAO,eAAe,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IACrE;AAEA,UAAM,QAAQ,MAAM,mCAAmC,EAAE,WAAW,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AK;AAAA,EACL,SAAS;AAAA,EACT,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,QACX,aAAa;AAAA,QACb,QAAQ;AAAA,MACV;AAAA,MACA,WAAW;AAAA,QACT,EAAE,QAAQ,KAAK,aAAa,wDAAwD,QAAQ,4BAA4B;AAAA,MAC1H;AAAA,MACA,QAAQ;AAAA,QACN,EAAE,QAAQ,KAAK,aAAa,2CAA2C,QAAQ,oBAAoB;AAAA,QACnG,EAAE,QAAQ,KAAK,aAAa,gBAAgB,QAAQ,oBAAoB;AAAA,QACxE,EAAE,QAAQ,KAAK,aAAa,yBAAyB,QAAQ,oBAAoB;AAAA,MACnF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -459,6 +459,8 @@ function ActivityConfigFields({ activityType, idPrefix, config, onChange, ledger
|
|
|
459
459
|
return /* @__PURE__ */ jsx(
|
|
460
460
|
EventPatternInput,
|
|
461
461
|
{
|
|
462
|
+
workflowEmittableOnly: true,
|
|
463
|
+
placeholder: t("ui.inputs.eventSelect.placeholder", "Select an event..."),
|
|
462
464
|
value: stringValue(rawValue),
|
|
463
465
|
onChange: (nextValue) => setField(spec, nextValue),
|
|
464
466
|
disabled
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/modules/workflows/components/fields/ActivityConfigFields.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Checkbox } from '@open-mercato/ui/primitives/checkbox'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { DurationInput } from '@open-mercato/ui/backend/inputs/DurationInput'\nimport { EventPatternInput } from '@open-mercato/ui/backend/inputs/EventPatternInput'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport '../../lib/activity-registry-bootstrap'\nimport { getActivityType, type ActivityFormFieldSpec } from '../../lib/activity-registry'\nimport type { LedgerEntry } from '../../lib/context-ledger'\nimport { CommandPicker } from './CommandPicker'\nimport { EndpointPicker } from './EndpointPicker'\nimport { FunctionPicker } from './FunctionPicker'\nimport { VariablePickerButton } from './VariablePickerButton'\nimport { ledgerDropTargetProps } from './ledgerDropTarget'\n\n/**\n * Registry-driven config form for workflow activities (spec\n * 2026-07-26-workflows-ux-redesign.md section 3.2, step 4.2).\n *\n * Renders an activity's `config` object from the registry entry's\n * `form: ActivityFormFieldSpec[]` via a component-hint map. Unknown hints\n * fall back to a plain text input.\n */\n\nconst TYPES_WITH_CONFIG_FORM = new Set(['WAIT', 'SEND_EMAIL', 'CALL_WEBHOOK', 'CALL_API', 'EMIT_EVENT', 'UPDATE_ENTITY', 'EXECUTE_FUNCTION', 'SET_VARIABLE', 'INVOKE_AGENT'])\n\nexport function hasActivityConfigForm(activityType: string): boolean {\n return TYPES_WITH_CONFIG_FORM.has(activityType) && getActivityType(activityType) != null\n}\n\nconst XOR_FIELD_GROUPS: Record<string, string[][]> = {\n WAIT: [['duration', 'until']],\n}\n\nconst containsTemplate = (value: string) => value.includes('{{')\n\nfunction stringValue(value: unknown): string {\n return typeof value === 'string' ? value : ''\n}\n\nfunction toDatetimeLocal(value: string): string {\n if (!value) return ''\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n const pad = (part: number) => String(part).padStart(2, '0')\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`\n}\n\nfunction fromDatetimeLocal(value: string): string {\n if (!value) return ''\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return value\n return date.toISOString()\n}\n\ntype KeyValueRow = { key: string; value: string }\n\nfunction objectToRows(value: unknown): KeyValueRow[] {\n if (value == null || typeof value !== 'object' || Array.isArray(value)) return []\n return Object.entries(value as Record<string, unknown>).map(([key, entryValue]) => ({\n key,\n value: typeof entryValue === 'string' ? entryValue : JSON.stringify(entryValue),\n }))\n}\n\nfunction rowsToObject(rows: KeyValueRow[]): Record<string, string> | undefined {\n const result: Record<string, string> = {}\n for (const row of rows) {\n if (row.key.trim().length === 0) continue\n result[row.key] = row.value\n }\n return Object.keys(result).length > 0 ? result : undefined\n}\n\ninterface KeyValueRowsEditorProps {\n idPrefix: string\n label: string\n value: unknown\n onChange: (value: Record<string, string> | undefined) => void\n disabled?: boolean\n}\n\nfunction KeyValueRowsEditor({ idPrefix, label, value, onChange, disabled }: KeyValueRowsEditorProps) {\n const t = useT()\n const [rows, setRows] = React.useState<KeyValueRow[]>(() => objectToRows(value))\n const emittedRef = React.useRef(JSON.stringify(rowsToObject(objectToRows(value)) ?? {}))\n\n React.useEffect(() => {\n const external = value != null && typeof value === 'object' && !Array.isArray(value) ? value : {}\n const serialized = JSON.stringify(external)\n if (serialized === emittedRef.current) return\n emittedRef.current = serialized\n setRows(objectToRows(value))\n }, [value])\n\n const commit = (nextRows: KeyValueRow[]) => {\n setRows(nextRows)\n const nextObject = rowsToObject(nextRows)\n emittedRef.current = JSON.stringify(nextObject ?? {})\n onChange(nextObject)\n }\n\n return (\n <div className=\"space-y-2\">\n {rows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"flex items-center gap-2\">\n <Input\n id={`${idPrefix}-${rowIndex}-key`}\n type=\"text\"\n value={row.key}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, key: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.keyValueKey')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.keyValueKey')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <Input\n id={`${idPrefix}-${rowIndex}-value`}\n type=\"text\"\n value={row.value}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, value: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.keyValueValue')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.keyValueValue')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <IconButton\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => commit(rows.filter((_, entryIndex) => entryIndex !== rowIndex))}\n aria-label={t('workflows.fieldEditors.activities.keyValueRemoveRow')}\n disabled={disabled}\n >\n <Trash2 className=\"size-3.5\" />\n </IconButton>\n </div>\n ))}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setRows([...rows, { key: '', value: '' }])}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.activities.keyValueAddRow')}\n </Button>\n </div>\n )\n}\n\ntype AssignmentValue = { path: string; value: unknown }\n\ntype AssignmentRow = { path: string; jsonMode: boolean; text: string; invalid: boolean }\n\nfunction assignmentsToRows(value: unknown): AssignmentRow[] {\n if (!Array.isArray(value)) return []\n return value.map((entry) => {\n const record = entry != null && typeof entry === 'object' && !Array.isArray(entry) ? (entry as Record<string, unknown>) : {}\n const path = typeof record.path === 'string' ? record.path : ''\n const rawValue = record.value\n if (typeof rawValue === 'string') return { path, jsonMode: false, text: rawValue, invalid: false }\n return {\n path,\n jsonMode: true,\n text: rawValue === undefined ? '' : JSON.stringify(rawValue, null, 2),\n invalid: false,\n }\n })\n}\n\nfunction parseAssignmentRowValue(row: AssignmentRow): { value: unknown; invalid: boolean } {\n if (!row.jsonMode) return { value: row.text, invalid: false }\n if (row.text.trim().length === 0) return { value: undefined, invalid: false }\n try {\n return { value: JSON.parse(row.text) as unknown, invalid: false }\n } catch {\n return { value: undefined, invalid: true }\n }\n}\n\ninterface AssignmentRowsEditorProps {\n idPrefix: string\n label: string\n value: unknown\n onChange: (value: AssignmentValue[] | undefined) => void\n disabled?: boolean\n}\n\nfunction AssignmentRowsEditor({ idPrefix, label, value, onChange, disabled }: AssignmentRowsEditorProps) {\n const t = useT()\n const [rows, setRows] = React.useState<AssignmentRow[]>(() => assignmentsToRows(value))\n const emittedRef = React.useRef(JSON.stringify(Array.isArray(value) ? value : []))\n\n React.useEffect(() => {\n const serialized = JSON.stringify(Array.isArray(value) ? value : [])\n if (serialized === emittedRef.current) return\n emittedRef.current = serialized\n setRows(assignmentsToRows(value))\n }, [value])\n\n const commit = (nextRows: AssignmentRow[]) => {\n const markedRows = nextRows.map((row) => ({ ...row, invalid: parseAssignmentRowValue(row).invalid }))\n setRows(markedRows)\n if (markedRows.some((row) => row.invalid)) return\n const assignments: AssignmentValue[] = []\n for (const row of markedRows) {\n if (row.path.trim().length === 0) continue\n assignments.push({ path: row.path, value: parseAssignmentRowValue(row).value })\n }\n const next = assignments.length > 0 ? assignments : undefined\n emittedRef.current = JSON.stringify(next ?? [])\n onChange(next)\n }\n\n const toggleJsonMode = (rowIndex: number) => {\n commit(\n rows.map((row, entryIndex) => {\n if (entryIndex !== rowIndex) return row\n if (row.jsonMode) {\n let nextText = row.text\n try {\n const parsed = JSON.parse(row.text) as unknown\n if (typeof parsed === 'string') nextText = parsed\n } catch {\n nextText = row.text\n }\n return { ...row, jsonMode: false, text: nextText }\n }\n let nextText = row.text\n if (row.text.trim().length > 0) {\n try {\n JSON.parse(row.text)\n } catch {\n nextText = JSON.stringify(row.text)\n }\n }\n return { ...row, jsonMode: true, text: nextText }\n }),\n )\n }\n\n return (\n <div className=\"space-y-2\">\n {rows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"flex items-start gap-2\">\n <Input\n id={`${idPrefix}-${rowIndex}-path`}\n type=\"text\"\n value={row.path}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, path: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.assignmentPathPlaceholder')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentPath')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <div className=\"flex-1 min-w-0\">\n {row.jsonMode ? (\n <Textarea\n id={`${idPrefix}-${rowIndex}-value`}\n value={row.text}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, text: event.target.value } : entry)))\n }\n rows={3}\n placeholder='{\"key\": \"value\"}'\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentValue')}`}\n aria-invalid={row.invalid || undefined}\n className=\"text-xs font-mono\"\n disabled={disabled}\n />\n ) : (\n <Input\n id={`${idPrefix}-${rowIndex}-value`}\n type=\"text\"\n value={row.text}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, text: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.assignmentValuePlaceholder')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentValue')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n )}\n {row.invalid && (\n <p className=\"text-xs text-status-error-text mt-1\">\n {t('workflows.fieldEditors.activities.invalidJson')}\n </p>\n )}\n </div>\n <Button\n type=\"button\"\n variant={row.jsonMode ? 'secondary' : 'ghost'}\n size=\"sm\"\n onClick={() => toggleJsonMode(rowIndex)}\n aria-pressed={row.jsonMode}\n aria-label={t('workflows.fieldEditors.activities.assignmentJsonToggle')}\n disabled={disabled}\n >\n {t('workflows.fieldEditors.activities.assignmentJsonToggle')}\n </Button>\n <IconButton\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => commit(rows.filter((_, entryIndex) => entryIndex !== rowIndex))}\n aria-label={t('workflows.fieldEditors.activities.assignmentRemoveRow')}\n disabled={disabled}\n >\n <Trash2 className=\"size-3.5\" />\n </IconButton>\n </div>\n ))}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setRows([...rows, { path: '', jsonMode: false, text: '', invalid: false }])}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.activities.assignmentAddRow')}\n </Button>\n </div>\n )\n}\n\ninterface JsonValueTextareaProps {\n id: string\n value: unknown\n onChange: (value: unknown) => void\n disabled?: boolean\n}\n\nfunction JsonValueTextarea({ id, value, onChange, disabled }: JsonValueTextareaProps) {\n const t = useT()\n const serialized = React.useMemo(\n () => (value === undefined ? '' : JSON.stringify(value, null, 2)),\n [value]\n )\n const [text, setText] = React.useState(serialized)\n const [isInvalid, setIsInvalid] = React.useState(false)\n const isFocusedRef = React.useRef(false)\n const lastSerializedRef = React.useRef(serialized)\n\n React.useEffect(() => {\n if (serialized === lastSerializedRef.current) return\n lastSerializedRef.current = serialized\n if (isFocusedRef.current) return\n setText(serialized)\n setIsInvalid(false)\n }, [serialized])\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const nextText = event.target.value\n setText(nextText)\n if (nextText.trim().length === 0) {\n setIsInvalid(false)\n onChange(undefined)\n return\n }\n try {\n const parsed = JSON.parse(nextText) as unknown\n setIsInvalid(false)\n onChange(parsed)\n } catch {\n setIsInvalid(true)\n }\n }\n\n return (\n <div>\n <Textarea\n id={id}\n value={text}\n onChange={handleChange}\n onFocus={() => {\n isFocusedRef.current = true\n }}\n onBlur={() => {\n isFocusedRef.current = false\n if (!isInvalid) setText(serialized)\n }}\n placeholder='{\"key\": \"value\"}'\n rows={3}\n className=\"text-xs font-mono\"\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n />\n {isInvalid && (\n <p className=\"text-xs text-status-error-text mt-1\">\n {t('workflows.fieldEditors.activities.invalidJson')}\n </p>\n )}\n </div>\n )\n}\n\nexport interface ActivityConfigFieldsProps {\n activityType: string\n idPrefix: string\n config: Record<string, unknown>\n onChange: (config: Record<string, unknown>) => void\n ledgerEntries?: LedgerEntry[]\n disabled?: boolean\n}\n\nexport function ActivityConfigFields({ activityType, idPrefix, config, onChange, ledgerEntries, disabled }: ActivityConfigFieldsProps) {\n const t = useT()\n const entry = getActivityType(activityType)\n if (!entry || entry.form.length === 0) return null\n\n const setField = (spec: ActivityFormFieldSpec, nextValue: unknown) => {\n const next: Record<string, unknown> = { ...config }\n const isEmpty = nextValue === '' || nextValue === undefined\n if (isEmpty) {\n delete next[spec.id]\n } else {\n next[spec.id] = nextValue\n for (const group of XOR_FIELD_GROUPS[activityType] ?? []) {\n if (!group.includes(spec.id)) continue\n for (const sibling of group) {\n if (sibling !== spec.id) delete next[sibling]\n }\n }\n }\n onChange(next)\n }\n\n const labelFor = (spec: ActivityFormFieldSpec): string =>\n t(spec.labelKey ?? `workflows.activityConfig.${activityType}.${spec.id}`)\n\n const renderControl = (spec: ActivityFormFieldSpec) => {\n const fieldId = `${idPrefix}-${spec.id}`\n const label = labelFor(spec)\n const rawValue = config[spec.id]\n switch (spec.component) {\n case 'duration':\n return (\n <DurationInput\n id={fieldId}\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n aria-label={label}\n disabled={disabled}\n />\n )\n case 'datetime': {\n const current = stringValue(rawValue)\n if (containsTemplate(current)) {\n return (\n <div className=\"flex items-center gap-1\">\n <Input\n id={fieldId}\n type=\"text\"\n value={current}\n onChange={(event) => setField(spec, event.target.value)}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: current,\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={current}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n }\n return (\n <Input\n id={fieldId}\n type=\"datetime-local\"\n value={toDatetimeLocal(current)}\n onChange={(event) => setField(spec, fromDatetimeLocal(event.target.value))}\n className=\"text-xs\"\n disabled={disabled}\n />\n )\n }\n case 'textarea':\n return (\n <div className=\"flex items-start gap-1\">\n <Textarea\n id={fieldId}\n value={stringValue(rawValue)}\n onChange={(event) => setField(spec, event.target.value)}\n rows={4}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: stringValue(rawValue),\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={stringValue(rawValue)}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n case 'eventName':\n return (\n <EventPatternInput\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'endpoint':\n return (\n <EndpointPicker\n id={fieldId}\n endpoint={stringValue(rawValue)}\n method={stringValue(config.method)}\n onApply={(patch) => {\n const next: Record<string, unknown> = { ...config }\n for (const [patchKey, patchValue] of Object.entries(patch)) {\n if (patchValue === '' || patchValue === undefined) {\n delete next[patchKey]\n } else {\n next[patchKey] = patchValue\n }\n }\n onChange(next)\n }}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n )\n case 'commandId':\n return (\n <CommandPicker\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'functionName':\n return (\n <FunctionPicker\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'assignments':\n return (\n <AssignmentRowsEditor\n idPrefix={fieldId}\n label={label}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'keyValue':\n return (\n <KeyValueRowsEditor\n idPrefix={fieldId}\n label={label}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'json':\n return (\n <JsonValueTextarea\n id={fieldId}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'checkbox':\n return (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={fieldId}\n checked={rawValue === true}\n onCheckedChange={(checked) => setField(spec, checked === true)}\n disabled={disabled}\n />\n <Label htmlFor={fieldId} className=\"text-xs cursor-pointer\">\n {label}\n </Label>\n </div>\n )\n default:\n return (\n <div className=\"flex items-center gap-1\">\n <Input\n id={fieldId}\n type=\"text\"\n value={stringValue(rawValue)}\n onChange={(event) => setField(spec, event.target.value)}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: stringValue(rawValue),\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={stringValue(rawValue)}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n }\n }\n\n const xorHintKey = XOR_FIELD_GROUPS[activityType]\n ? `workflows.activityConfig.${activityType}.xorHint`\n : null\n\n return (\n <div className=\"space-y-3\">\n {entry.form.map((spec) => (\n <div\n key={spec.id}\n {...(spec.component === 'commandId' || spec.component === 'functionName'\n ? { role: 'group', 'aria-labelledby': `${idPrefix}-${spec.id}-label` }\n : {})}\n >\n {spec.component !== 'checkbox' && (\n <Label\n id={`${idPrefix}-${spec.id}-label`}\n {...(spec.component === 'commandId' || spec.component === 'functionName'\n ? {}\n : { htmlFor: `${idPrefix}-${spec.id}` })}\n className=\"text-xs font-medium mb-1\"\n >\n {labelFor(spec)}\n {spec.required ? ' *' : ''}\n </Label>\n )}\n {renderControl(spec)}\n {spec.descriptionKey && (\n <p className=\"text-xs text-muted-foreground mt-1\">{t(spec.descriptionKey)}</p>\n )}\n </div>\n ))}\n {xorHintKey && <p className=\"text-xs text-muted-foreground\">{t(xorHintKey)}</p>}\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAgHQ,SACE,KADF;AA9GR,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SA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AAY,aACxC;AAEJ,SACE,qBAAC,SAAI,WAAU,aACZ;AAAA,UAAM,KAAK,IAAI,CAAC,SACf;AAAA,MAAC;AAAA;AAAA,QAEE,GAAI,KAAK,cAAc,eAAe,KAAK,cAAc,iBACtD,EAAE,MAAM,SAAS,mBAAmB,GAAG,QAAQ,IAAI,KAAK,EAAE,SAAS,IACnE,CAAC;AAAA,QAEJ;AAAA,eAAK,cAAc,cAClB;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,GAAG,QAAQ,IAAI,KAAK,EAAE;AAAA,cACzB,GAAI,KAAK,cAAc,eAAe,KAAK,cAAc,iBACtD,CAAC,IACD,EAAE,SAAS,GAAG,QAAQ,IAAI,KAAK,EAAE,GAAG;AAAA,cACxC,WAAU;AAAA,cAET;AAAA,yBAAS,IAAI;AAAA,gBACb,KAAK,WAAW,OAAO;AAAA;AAAA;AAAA,UAC1B;AAAA,UAED,cAAc,IAAI;AAAA,UAClB,KAAK,kBACJ,oBAAC,OAAE,WAAU,sCAAsC,YAAE,KAAK,cAAc,GAAE;AAAA;AAAA;AAAA,MAnBvE,KAAK;AAAA,IAqBZ,CACD;AAAA,IACA,cAAc,oBAAC,OAAE,WAAU,iCAAiC,YAAE,UAAU,GAAE;AAAA,KAC7E;AAEJ;",
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Checkbox } from '@open-mercato/ui/primitives/checkbox'\nimport { IconButton } from '@open-mercato/ui/primitives/icon-button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { DurationInput } from '@open-mercato/ui/backend/inputs/DurationInput'\nimport { EventPatternInput } from '@open-mercato/ui/backend/inputs/EventPatternInput'\nimport { Plus, Trash2 } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport '../../lib/activity-registry-bootstrap'\nimport { getActivityType, type ActivityFormFieldSpec } from '../../lib/activity-registry'\nimport type { LedgerEntry } from '../../lib/context-ledger'\nimport { CommandPicker } from './CommandPicker'\nimport { EndpointPicker } from './EndpointPicker'\nimport { FunctionPicker } from './FunctionPicker'\nimport { VariablePickerButton } from './VariablePickerButton'\nimport { ledgerDropTargetProps } from './ledgerDropTarget'\n\n/**\n * Registry-driven config form for workflow activities (spec\n * 2026-07-26-workflows-ux-redesign.md section 3.2, step 4.2).\n *\n * Renders an activity's `config` object from the registry entry's\n * `form: ActivityFormFieldSpec[]` via a component-hint map. Unknown hints\n * fall back to a plain text input.\n */\n\nconst TYPES_WITH_CONFIG_FORM = new Set(['WAIT', 'SEND_EMAIL', 'CALL_WEBHOOK', 'CALL_API', 'EMIT_EVENT', 'UPDATE_ENTITY', 'EXECUTE_FUNCTION', 'SET_VARIABLE', 'INVOKE_AGENT'])\n\nexport function hasActivityConfigForm(activityType: string): boolean {\n return TYPES_WITH_CONFIG_FORM.has(activityType) && getActivityType(activityType) != null\n}\n\nconst XOR_FIELD_GROUPS: Record<string, string[][]> = {\n WAIT: [['duration', 'until']],\n}\n\nconst containsTemplate = (value: string) => value.includes('{{')\n\nfunction stringValue(value: unknown): string {\n return typeof value === 'string' ? value : ''\n}\n\nfunction toDatetimeLocal(value: string): string {\n if (!value) return ''\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return ''\n const pad = (part: number) => String(part).padStart(2, '0')\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`\n}\n\nfunction fromDatetimeLocal(value: string): string {\n if (!value) return ''\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return value\n return date.toISOString()\n}\n\ntype KeyValueRow = { key: string; value: string }\n\nfunction objectToRows(value: unknown): KeyValueRow[] {\n if (value == null || typeof value !== 'object' || Array.isArray(value)) return []\n return Object.entries(value as Record<string, unknown>).map(([key, entryValue]) => ({\n key,\n value: typeof entryValue === 'string' ? entryValue : JSON.stringify(entryValue),\n }))\n}\n\nfunction rowsToObject(rows: KeyValueRow[]): Record<string, string> | undefined {\n const result: Record<string, string> = {}\n for (const row of rows) {\n if (row.key.trim().length === 0) continue\n result[row.key] = row.value\n }\n return Object.keys(result).length > 0 ? result : undefined\n}\n\ninterface KeyValueRowsEditorProps {\n idPrefix: string\n label: string\n value: unknown\n onChange: (value: Record<string, string> | undefined) => void\n disabled?: boolean\n}\n\nfunction KeyValueRowsEditor({ idPrefix, label, value, onChange, disabled }: KeyValueRowsEditorProps) {\n const t = useT()\n const [rows, setRows] = React.useState<KeyValueRow[]>(() => objectToRows(value))\n const emittedRef = React.useRef(JSON.stringify(rowsToObject(objectToRows(value)) ?? {}))\n\n React.useEffect(() => {\n const external = value != null && typeof value === 'object' && !Array.isArray(value) ? value : {}\n const serialized = JSON.stringify(external)\n if (serialized === emittedRef.current) return\n emittedRef.current = serialized\n setRows(objectToRows(value))\n }, [value])\n\n const commit = (nextRows: KeyValueRow[]) => {\n setRows(nextRows)\n const nextObject = rowsToObject(nextRows)\n emittedRef.current = JSON.stringify(nextObject ?? {})\n onChange(nextObject)\n }\n\n return (\n <div className=\"space-y-2\">\n {rows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"flex items-center gap-2\">\n <Input\n id={`${idPrefix}-${rowIndex}-key`}\n type=\"text\"\n value={row.key}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, key: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.keyValueKey')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.keyValueKey')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <Input\n id={`${idPrefix}-${rowIndex}-value`}\n type=\"text\"\n value={row.value}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, value: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.keyValueValue')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.keyValueValue')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <IconButton\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => commit(rows.filter((_, entryIndex) => entryIndex !== rowIndex))}\n aria-label={t('workflows.fieldEditors.activities.keyValueRemoveRow')}\n disabled={disabled}\n >\n <Trash2 className=\"size-3.5\" />\n </IconButton>\n </div>\n ))}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setRows([...rows, { key: '', value: '' }])}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.activities.keyValueAddRow')}\n </Button>\n </div>\n )\n}\n\ntype AssignmentValue = { path: string; value: unknown }\n\ntype AssignmentRow = { path: string; jsonMode: boolean; text: string; invalid: boolean }\n\nfunction assignmentsToRows(value: unknown): AssignmentRow[] {\n if (!Array.isArray(value)) return []\n return value.map((entry) => {\n const record = entry != null && typeof entry === 'object' && !Array.isArray(entry) ? (entry as Record<string, unknown>) : {}\n const path = typeof record.path === 'string' ? record.path : ''\n const rawValue = record.value\n if (typeof rawValue === 'string') return { path, jsonMode: false, text: rawValue, invalid: false }\n return {\n path,\n jsonMode: true,\n text: rawValue === undefined ? '' : JSON.stringify(rawValue, null, 2),\n invalid: false,\n }\n })\n}\n\nfunction parseAssignmentRowValue(row: AssignmentRow): { value: unknown; invalid: boolean } {\n if (!row.jsonMode) return { value: row.text, invalid: false }\n if (row.text.trim().length === 0) return { value: undefined, invalid: false }\n try {\n return { value: JSON.parse(row.text) as unknown, invalid: false }\n } catch {\n return { value: undefined, invalid: true }\n }\n}\n\ninterface AssignmentRowsEditorProps {\n idPrefix: string\n label: string\n value: unknown\n onChange: (value: AssignmentValue[] | undefined) => void\n disabled?: boolean\n}\n\nfunction AssignmentRowsEditor({ idPrefix, label, value, onChange, disabled }: AssignmentRowsEditorProps) {\n const t = useT()\n const [rows, setRows] = React.useState<AssignmentRow[]>(() => assignmentsToRows(value))\n const emittedRef = React.useRef(JSON.stringify(Array.isArray(value) ? value : []))\n\n React.useEffect(() => {\n const serialized = JSON.stringify(Array.isArray(value) ? value : [])\n if (serialized === emittedRef.current) return\n emittedRef.current = serialized\n setRows(assignmentsToRows(value))\n }, [value])\n\n const commit = (nextRows: AssignmentRow[]) => {\n const markedRows = nextRows.map((row) => ({ ...row, invalid: parseAssignmentRowValue(row).invalid }))\n setRows(markedRows)\n if (markedRows.some((row) => row.invalid)) return\n const assignments: AssignmentValue[] = []\n for (const row of markedRows) {\n if (row.path.trim().length === 0) continue\n assignments.push({ path: row.path, value: parseAssignmentRowValue(row).value })\n }\n const next = assignments.length > 0 ? assignments : undefined\n emittedRef.current = JSON.stringify(next ?? [])\n onChange(next)\n }\n\n const toggleJsonMode = (rowIndex: number) => {\n commit(\n rows.map((row, entryIndex) => {\n if (entryIndex !== rowIndex) return row\n if (row.jsonMode) {\n let nextText = row.text\n try {\n const parsed = JSON.parse(row.text) as unknown\n if (typeof parsed === 'string') nextText = parsed\n } catch {\n nextText = row.text\n }\n return { ...row, jsonMode: false, text: nextText }\n }\n let nextText = row.text\n if (row.text.trim().length > 0) {\n try {\n JSON.parse(row.text)\n } catch {\n nextText = JSON.stringify(row.text)\n }\n }\n return { ...row, jsonMode: true, text: nextText }\n }),\n )\n }\n\n return (\n <div className=\"space-y-2\">\n {rows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"flex items-start gap-2\">\n <Input\n id={`${idPrefix}-${rowIndex}-path`}\n type=\"text\"\n value={row.path}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, path: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.assignmentPathPlaceholder')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentPath')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n <div className=\"flex-1 min-w-0\">\n {row.jsonMode ? (\n <Textarea\n id={`${idPrefix}-${rowIndex}-value`}\n value={row.text}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, text: event.target.value } : entry)))\n }\n rows={3}\n placeholder='{\"key\": \"value\"}'\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentValue')}`}\n aria-invalid={row.invalid || undefined}\n className=\"text-xs font-mono\"\n disabled={disabled}\n />\n ) : (\n <Input\n id={`${idPrefix}-${rowIndex}-value`}\n type=\"text\"\n value={row.text}\n onChange={(event) =>\n commit(rows.map((entry, entryIndex) => (entryIndex === rowIndex ? { ...entry, text: event.target.value } : entry)))\n }\n placeholder={t('workflows.fieldEditors.activities.assignmentValuePlaceholder')}\n aria-label={`${label} \u2014 ${t('workflows.fieldEditors.activities.assignmentValue')}`}\n className=\"text-xs\"\n disabled={disabled}\n />\n )}\n {row.invalid && (\n <p className=\"text-xs text-status-error-text mt-1\">\n {t('workflows.fieldEditors.activities.invalidJson')}\n </p>\n )}\n </div>\n <Button\n type=\"button\"\n variant={row.jsonMode ? 'secondary' : 'ghost'}\n size=\"sm\"\n onClick={() => toggleJsonMode(rowIndex)}\n aria-pressed={row.jsonMode}\n aria-label={t('workflows.fieldEditors.activities.assignmentJsonToggle')}\n disabled={disabled}\n >\n {t('workflows.fieldEditors.activities.assignmentJsonToggle')}\n </Button>\n <IconButton\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => commit(rows.filter((_, entryIndex) => entryIndex !== rowIndex))}\n aria-label={t('workflows.fieldEditors.activities.assignmentRemoveRow')}\n disabled={disabled}\n >\n <Trash2 className=\"size-3.5\" />\n </IconButton>\n </div>\n ))}\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setRows([...rows, { path: '', jsonMode: false, text: '', invalid: false }])}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.activities.assignmentAddRow')}\n </Button>\n </div>\n )\n}\n\ninterface JsonValueTextareaProps {\n id: string\n value: unknown\n onChange: (value: unknown) => void\n disabled?: boolean\n}\n\nfunction JsonValueTextarea({ id, value, onChange, disabled }: JsonValueTextareaProps) {\n const t = useT()\n const serialized = React.useMemo(\n () => (value === undefined ? '' : JSON.stringify(value, null, 2)),\n [value]\n )\n const [text, setText] = React.useState(serialized)\n const [isInvalid, setIsInvalid] = React.useState(false)\n const isFocusedRef = React.useRef(false)\n const lastSerializedRef = React.useRef(serialized)\n\n React.useEffect(() => {\n if (serialized === lastSerializedRef.current) return\n lastSerializedRef.current = serialized\n if (isFocusedRef.current) return\n setText(serialized)\n setIsInvalid(false)\n }, [serialized])\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n const nextText = event.target.value\n setText(nextText)\n if (nextText.trim().length === 0) {\n setIsInvalid(false)\n onChange(undefined)\n return\n }\n try {\n const parsed = JSON.parse(nextText) as unknown\n setIsInvalid(false)\n onChange(parsed)\n } catch {\n setIsInvalid(true)\n }\n }\n\n return (\n <div>\n <Textarea\n id={id}\n value={text}\n onChange={handleChange}\n onFocus={() => {\n isFocusedRef.current = true\n }}\n onBlur={() => {\n isFocusedRef.current = false\n if (!isInvalid) setText(serialized)\n }}\n placeholder='{\"key\": \"value\"}'\n rows={3}\n className=\"text-xs font-mono\"\n aria-invalid={isInvalid || undefined}\n disabled={disabled}\n />\n {isInvalid && (\n <p className=\"text-xs text-status-error-text mt-1\">\n {t('workflows.fieldEditors.activities.invalidJson')}\n </p>\n )}\n </div>\n )\n}\n\nexport interface ActivityConfigFieldsProps {\n activityType: string\n idPrefix: string\n config: Record<string, unknown>\n onChange: (config: Record<string, unknown>) => void\n ledgerEntries?: LedgerEntry[]\n disabled?: boolean\n}\n\nexport function ActivityConfigFields({ activityType, idPrefix, config, onChange, ledgerEntries, disabled }: ActivityConfigFieldsProps) {\n const t = useT()\n const entry = getActivityType(activityType)\n if (!entry || entry.form.length === 0) return null\n\n const setField = (spec: ActivityFormFieldSpec, nextValue: unknown) => {\n const next: Record<string, unknown> = { ...config }\n const isEmpty = nextValue === '' || nextValue === undefined\n if (isEmpty) {\n delete next[spec.id]\n } else {\n next[spec.id] = nextValue\n for (const group of XOR_FIELD_GROUPS[activityType] ?? []) {\n if (!group.includes(spec.id)) continue\n for (const sibling of group) {\n if (sibling !== spec.id) delete next[sibling]\n }\n }\n }\n onChange(next)\n }\n\n const labelFor = (spec: ActivityFormFieldSpec): string =>\n t(spec.labelKey ?? `workflows.activityConfig.${activityType}.${spec.id}`)\n\n const renderControl = (spec: ActivityFormFieldSpec) => {\n const fieldId = `${idPrefix}-${spec.id}`\n const label = labelFor(spec)\n const rawValue = config[spec.id]\n switch (spec.component) {\n case 'duration':\n return (\n <DurationInput\n id={fieldId}\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n aria-label={label}\n disabled={disabled}\n />\n )\n case 'datetime': {\n const current = stringValue(rawValue)\n if (containsTemplate(current)) {\n return (\n <div className=\"flex items-center gap-1\">\n <Input\n id={fieldId}\n type=\"text\"\n value={current}\n onChange={(event) => setField(spec, event.target.value)}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: current,\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={current}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n }\n return (\n <Input\n id={fieldId}\n type=\"datetime-local\"\n value={toDatetimeLocal(current)}\n onChange={(event) => setField(spec, fromDatetimeLocal(event.target.value))}\n className=\"text-xs\"\n disabled={disabled}\n />\n )\n }\n case 'textarea':\n return (\n <div className=\"flex items-start gap-1\">\n <Textarea\n id={fieldId}\n value={stringValue(rawValue)}\n onChange={(event) => setField(spec, event.target.value)}\n rows={4}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: stringValue(rawValue),\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={stringValue(rawValue)}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n case 'eventName':\n return (\n <EventPatternInput\n workflowEmittableOnly\n placeholder={t('ui.inputs.eventSelect.placeholder', 'Select an event...')}\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'endpoint':\n return (\n <EndpointPicker\n id={fieldId}\n endpoint={stringValue(rawValue)}\n method={stringValue(config.method)}\n onApply={(patch) => {\n const next: Record<string, unknown> = { ...config }\n for (const [patchKey, patchValue] of Object.entries(patch)) {\n if (patchValue === '' || patchValue === undefined) {\n delete next[patchKey]\n } else {\n next[patchKey] = patchValue\n }\n }\n onChange(next)\n }}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n )\n case 'commandId':\n return (\n <CommandPicker\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'functionName':\n return (\n <FunctionPicker\n value={stringValue(rawValue)}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'assignments':\n return (\n <AssignmentRowsEditor\n idPrefix={fieldId}\n label={label}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'keyValue':\n return (\n <KeyValueRowsEditor\n idPrefix={fieldId}\n label={label}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'json':\n return (\n <JsonValueTextarea\n id={fieldId}\n value={rawValue}\n onChange={(nextValue) => setField(spec, nextValue)}\n disabled={disabled}\n />\n )\n case 'checkbox':\n return (\n <div className=\"flex items-center gap-2\">\n <Checkbox\n id={fieldId}\n checked={rawValue === true}\n onCheckedChange={(checked) => setField(spec, checked === true)}\n disabled={disabled}\n />\n <Label htmlFor={fieldId} className=\"text-xs cursor-pointer\">\n {label}\n </Label>\n </div>\n )\n default:\n return (\n <div className=\"flex items-center gap-1\">\n <Input\n id={fieldId}\n type=\"text\"\n value={stringValue(rawValue)}\n onChange={(event) => setField(spec, event.target.value)}\n className=\"flex-1 text-xs\"\n disabled={disabled}\n {...ledgerDropTargetProps({\n value: stringValue(rawValue),\n onValueChange: (nextValue) => setField(spec, nextValue),\n disabled,\n })}\n />\n <VariablePickerButton\n targetId={fieldId}\n value={stringValue(rawValue)}\n onValueChange={(nextValue) => setField(spec, nextValue)}\n ledgerEntries={ledgerEntries}\n disabled={disabled}\n />\n </div>\n )\n }\n }\n\n const xorHintKey = XOR_FIELD_GROUPS[activityType]\n ? `workflows.activityConfig.${activityType}.xorHint`\n : null\n\n return (\n <div className=\"space-y-3\">\n {entry.form.map((spec) => (\n <div\n key={spec.id}\n {...(spec.component === 'commandId' || spec.component === 'functionName'\n ? { role: 'group', 'aria-labelledby': `${idPrefix}-${spec.id}-label` }\n : {})}\n >\n {spec.component !== 'checkbox' && (\n <Label\n id={`${idPrefix}-${spec.id}-label`}\n {...(spec.component === 'commandId' || spec.component === 'functionName'\n ? {}\n : { htmlFor: `${idPrefix}-${spec.id}` })}\n className=\"text-xs font-medium mb-1\"\n >\n {labelFor(spec)}\n {spec.required ? ' *' : ''}\n </Label>\n )}\n {renderControl(spec)}\n {spec.descriptionKey && (\n <p className=\"text-xs text-muted-foreground mt-1\">{t(spec.descriptionKey)}</p>\n )}\n </div>\n ))}\n {xorHintKey && <p className=\"text-xs text-muted-foreground\">{t(xorHintKey)}</p>}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAgHQ,SACE,KADF;AA9GR,YAAY,WAAW;AACvB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,yBAAyB;AAClC,SAAS,MAAM,cAAc;AAC7B,SAAS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,SAAI,WAAU,aACZ;AAAA,UAAM,KAAK,IAAI,CAAC,SACf;AAAA,MAAC;AAAA;AAAA,QAEE,GAAI,KAAK,cAAc,eAAe,KAAK,cAAc,iBACtD,EAAE,MAAM,SAAS,mBAAmB,GAAG,QAAQ,IAAI,KAAK,EAAE,SAAS,IACnE,CAAC;AAAA,QAEJ;AAAA,eAAK,cAAc,cAClB;AAAA,YAAC;AAAA;AAAA,cACC,IAAI,GAAG,QAAQ,IAAI,KAAK,EAAE;AAAA,cACzB,GAAI,KAAK,cAAc,eAAe,KAAK,cAAc,iBACtD,CAAC,IACD,EAAE,SAAS,GAAG,QAAQ,IAAI,KAAK,EAAE,GAAG;AAAA,cACxC,WAAU;AAAA,cAET;AAAA,yBAAS,IAAI;AAAA,gBACb,KAAK,WAAW,OAAO;AAAA;AAAA;AAAA,UAC1B;AAAA,UAED,cAAc,IAAI;AAAA,UAClB,KAAK,kBACJ,oBAAC,OAAE,WAAU,sCAAsC,YAAE,KAAK,cAAc,GAAE;AAAA;AAAA;AAAA,MAnBvE,KAAK;AAAA,IAqBZ,CACD;AAAA,IACA,cAAc,oBAAC,OAAE,WAAU,iCAAiC,YAAE,UAAU,GAAE;AAAA,KAC7E;AAEJ;",
|
|
6
6
|
"names": ["nextText"]
|
|
7
7
|
}
|
|
@@ -14,6 +14,7 @@ import * as conditionHandler from "./lib/condition-handler.js";
|
|
|
14
14
|
import * as taskHandler from "./lib/task-handler.js";
|
|
15
15
|
import * as workInboxService from "./lib/work-inbox/service.js";
|
|
16
16
|
import { createWorkflowDefinitionAuthoring } from "./lib/owned-definition.js";
|
|
17
|
+
import { createWorkflowExampleAuthoring } from "./lib/example-definition-authoring.js";
|
|
17
18
|
import { registerWorkInboxSources } from "./lib/work-inbox/provider.js";
|
|
18
19
|
import { userTaskWorkInboxSource, WORKFLOWS_MODULE_ID } from "./lib/work-inbox/user-task-source.js";
|
|
19
20
|
registerOptimisticLockReaders({
|
|
@@ -42,7 +43,8 @@ function register(container) {
|
|
|
42
43
|
workInboxService: asFunction(() => workInboxService).scoped(),
|
|
43
44
|
// Lets another module own a real workflow definition instead of building a
|
|
44
45
|
// second executor for its simple case — see lib/owned-definition.ts.
|
|
45
|
-
workflowDefinitionAuthoring: asScopedService((scope) => createWorkflowDefinitionAuthoring(scope))
|
|
46
|
+
workflowDefinitionAuthoring: asScopedService((scope) => createWorkflowDefinitionAuthoring(scope)),
|
|
47
|
+
workflowExampleAuthoring: asScopedService((scope) => createWorkflowExampleAuthoring(scope))
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
defineProcessDiRegistrar(register);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/modules/workflows/di.ts"],
|
|
4
|
-
"sourcesContent": ["import { defineProcessDiRegistrar, asScopedService } from '@open-mercato/shared/lib/di/process-registrar'\n/**\n * Workflows Module - Dependency Injection\n *\n * Register workflow engine services in the DI container.\n */\n\nimport type { AwilixContainer } from 'awilix'\nimport { asFunction } from 'awilix'\nimport { createGenericOptimisticLockReader } from '@open-mercato/shared/lib/crud/optimistic-lock'\nimport { registerOptimisticLockReaders } from '@open-mercato/shared/lib/crud/optimistic-lock-store'\nimport { WorkflowDefinition } from './data/entities'\nimport * as workflowExecutor from './lib/workflow-executor'\nimport * as stepHandler from './lib/step-handler'\nimport * as transitionHandler from './lib/transition-handler'\nimport * as activityExecutor from './lib/activity-executor'\nimport * as eventLogger from './lib/event-logger'\nimport * as signalHandler from './lib/signal-handler'\nimport * as timerHandler from './lib/timer-handler'\nimport * as conditionHandler from './lib/condition-handler'\nimport * as taskHandler from './lib/task-handler'\nimport * as workInboxService from './lib/work-inbox/service'\nimport { createWorkflowDefinitionAuthoring } from './lib/owned-definition'\nimport { registerWorkInboxSources } from './lib/work-inbox/provider'\nimport { userTaskWorkInboxSource, WORKFLOWS_MODULE_ID } from './lib/work-inbox/user-task-source'\n\n// Register the `workflows.definition` optimistic-lock reader at module-DI load\n// time (top-level, like sales/customers) so it is present in the global reader\n// store before any request-scoped `crudMutationGuardService` snapshots\n// `getAllOptimisticLockReaders()`. Registering it only as a side-effect of\n// importing the definition route module left it absent from that snapshot, so\n// the guard short-circuited and the visual editor's stale saves overwrote with\n// no 409 and no conflict bar.\nregisterOptimisticLockReaders({\n 'workflows.definition': createGenericOptimisticLockReader({\n entity: WorkflowDefinition,\n idField: 'id',\n tenantField: 'tenantId',\n orgField: 'organizationId',\n softDeleteField: 'deletedAt',\n }),\n})\n\n// Registered at module-DI load time (top-level, like the optimistic-lock reader\n// above) so the `user_task` source is present before the first work-inbox\n// request resolves `workInboxService`. Registration merges by module id, so\n// `agent_orchestrator` registering `agent_disposition` from its own `di.ts` adds\n// to this set regardless of which module loads first \u2014 and when enterprise is\n// absent the inbox simply lists workflow tasks (spec \u00A72.3).\nregisterWorkInboxSources([\n { moduleId: WORKFLOWS_MODULE_ID, sources: [userTaskWorkInboxSource] },\n])\n\nexport function register(container: AwilixContainer): void {\n container.register({\n workflowExecutor: asFunction(() => workflowExecutor).scoped(),\n stepHandler: asFunction(() => stepHandler).scoped(),\n transitionHandler: asFunction(() => transitionHandler).scoped(),\n activityExecutor: asFunction(() => activityExecutor).scoped(),\n eventLogger: asFunction(() => eventLogger).scoped(),\n signalHandler: asFunction(() => signalHandler).scoped(),\n timerHandler: asFunction(() => timerHandler).scoped(),\n conditionHandler: asFunction(() => conditionHandler).scoped(),\n taskHandler: asFunction(() => taskHandler).scoped(),\n workInboxService: asFunction(() => workInboxService).scoped(),\n // Lets another module own a real workflow definition instead of building a\n // second executor for its simple case \u2014 see lib/owned-definition.ts.\n workflowDefinitionAuthoring: asScopedService((scope) => createWorkflowDefinitionAuthoring(scope)),\n })\n}\n\ndefineProcessDiRegistrar(register)\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,0BAA0B,uBAAuB;AAQ1D,SAAS,kBAAkB;AAC3B,SAAS,yCAAyC;AAClD,SAAS,qCAAqC;AAC9C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@open-mercato/shared/lib/di/process-registrar'\n/**\n * Workflows Module - Dependency Injection\n *\n * Register workflow engine services in the DI container.\n */\n\nimport type { AwilixContainer } from 'awilix'\nimport { asFunction } from 'awilix'\nimport { createGenericOptimisticLockReader } from '@open-mercato/shared/lib/crud/optimistic-lock'\nimport { registerOptimisticLockReaders } from '@open-mercato/shared/lib/crud/optimistic-lock-store'\nimport { WorkflowDefinition } from './data/entities'\nimport * as workflowExecutor from './lib/workflow-executor'\nimport * as stepHandler from './lib/step-handler'\nimport * as transitionHandler from './lib/transition-handler'\nimport * as activityExecutor from './lib/activity-executor'\nimport * as eventLogger from './lib/event-logger'\nimport * as signalHandler from './lib/signal-handler'\nimport * as timerHandler from './lib/timer-handler'\nimport * as conditionHandler from './lib/condition-handler'\nimport * as taskHandler from './lib/task-handler'\nimport * as workInboxService from './lib/work-inbox/service'\nimport { createWorkflowDefinitionAuthoring } from './lib/owned-definition'\nimport { createWorkflowExampleAuthoring } from './lib/example-definition-authoring'\nimport { registerWorkInboxSources } from './lib/work-inbox/provider'\nimport { userTaskWorkInboxSource, WORKFLOWS_MODULE_ID } from './lib/work-inbox/user-task-source'\n\n// Register the `workflows.definition` optimistic-lock reader at module-DI load\n// time (top-level, like sales/customers) so it is present in the global reader\n// store before any request-scoped `crudMutationGuardService` snapshots\n// `getAllOptimisticLockReaders()`. Registering it only as a side-effect of\n// importing the definition route module left it absent from that snapshot, so\n// the guard short-circuited and the visual editor's stale saves overwrote with\n// no 409 and no conflict bar.\nregisterOptimisticLockReaders({\n 'workflows.definition': createGenericOptimisticLockReader({\n entity: WorkflowDefinition,\n idField: 'id',\n tenantField: 'tenantId',\n orgField: 'organizationId',\n softDeleteField: 'deletedAt',\n }),\n})\n\n// Registered at module-DI load time (top-level, like the optimistic-lock reader\n// above) so the `user_task` source is present before the first work-inbox\n// request resolves `workInboxService`. Registration merges by module id, so\n// `agent_orchestrator` registering `agent_disposition` from its own `di.ts` adds\n// to this set regardless of which module loads first \u2014 and when enterprise is\n// absent the inbox simply lists workflow tasks (spec \u00A72.3).\nregisterWorkInboxSources([\n { moduleId: WORKFLOWS_MODULE_ID, sources: [userTaskWorkInboxSource] },\n])\n\nexport function register(container: AwilixContainer): void {\n container.register({\n workflowExecutor: asFunction(() => workflowExecutor).scoped(),\n stepHandler: asFunction(() => stepHandler).scoped(),\n transitionHandler: asFunction(() => transitionHandler).scoped(),\n activityExecutor: asFunction(() => activityExecutor).scoped(),\n eventLogger: asFunction(() => eventLogger).scoped(),\n signalHandler: asFunction(() => signalHandler).scoped(),\n timerHandler: asFunction(() => timerHandler).scoped(),\n conditionHandler: asFunction(() => conditionHandler).scoped(),\n taskHandler: asFunction(() => taskHandler).scoped(),\n workInboxService: asFunction(() => workInboxService).scoped(),\n // Lets another module own a real workflow definition instead of building a\n // second executor for its simple case \u2014 see lib/owned-definition.ts.\n workflowDefinitionAuthoring: asScopedService((scope) => createWorkflowDefinitionAuthoring(scope)),\n workflowExampleAuthoring: asScopedService((scope) => createWorkflowExampleAuthoring(scope)),\n })\n}\n\ndefineProcessDiRegistrar(register)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B,uBAAuB;AAQ1D,SAAS,kBAAkB;AAC3B,SAAS,yCAAyC;AAClD,SAAS,qCAAqC;AAC9C,SAAS,0BAA0B;AACnC,YAAY,sBAAsB;AAClC,YAAY,iBAAiB;AAC7B,YAAY,uBAAuB;AACnC,YAAY,sBAAsB;AAClC,YAAY,iBAAiB;AAC7B,YAAY,mBAAmB;AAC/B,YAAY,kBAAkB;AAC9B,YAAY,sBAAsB;AAClC,YAAY,iBAAiB;AAC7B,YAAY,sBAAsB;AAClC,SAAS,yCAAyC;AAClD,SAAS,sCAAsC;AAC/C,SAAS,gCAAgC;AACzC,SAAS,yBAAyB,2BAA2B;AAS7D,8BAA8B;AAAA,EAC5B,wBAAwB,kCAAkC;AAAA,IACxD,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,IACb,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB,CAAC;AACH,CAAC;AAQD,yBAAyB;AAAA,EACvB,EAAE,UAAU,qBAAqB,SAAS,CAAC,uBAAuB,EAAE;AACtE,CAAC;AAEM,SAAS,SAAS,WAAkC;AACzD,YAAU,SAAS;AAAA,IACjB,kBAAkB,WAAW,MAAM,gBAAgB,EAAE,OAAO;AAAA,IAC5D,aAAa,WAAW,MAAM,WAAW,EAAE,OAAO;AAAA,IAClD,mBAAmB,WAAW,MAAM,iBAAiB,EAAE,OAAO;AAAA,IAC9D,kBAAkB,WAAW,MAAM,gBAAgB,EAAE,OAAO;AAAA,IAC5D,aAAa,WAAW,MAAM,WAAW,EAAE,OAAO;AAAA,IAClD,eAAe,WAAW,MAAM,aAAa,EAAE,OAAO;AAAA,IACtD,cAAc,WAAW,MAAM,YAAY,EAAE,OAAO;AAAA,IACpD,kBAAkB,WAAW,MAAM,gBAAgB,EAAE,OAAO;AAAA,IAC5D,aAAa,WAAW,MAAM,WAAW,EAAE,OAAO;AAAA,IAClD,kBAAkB,WAAW,MAAM,gBAAgB,EAAE,OAAO;AAAA;AAAA;AAAA,IAG5D,6BAA6B,gBAAgB,CAAC,UAAU,kCAAkC,KAAK,CAAC;AAAA,IAChG,0BAA0B,gBAAgB,CAAC,UAAU,+BAA+B,KAAK,CAAC;AAAA,EAC5F,CAAC;AACH;AAEA,yBAAyB,QAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { createModuleEvents } from "@open-mercato/shared/modules/events";
|
|
2
2
|
const events = [
|
|
3
|
+
{ id: "approval.completed", label: "Approval Completed", category: "lifecycle", workflowEmittable: true },
|
|
4
|
+
{ id: "approval.requested", label: "Approval Requested", category: "lifecycle", workflowEmittable: true },
|
|
5
|
+
{ id: "checkout.started", label: "Checkout Started", category: "lifecycle", workflowEmittable: true },
|
|
6
|
+
{ id: "fulfillment.ready", label: "Fulfillment Ready", category: "lifecycle", workflowEmittable: true },
|
|
7
|
+
{ id: "order.approved", label: "Order Approved", category: "lifecycle", workflowEmittable: true },
|
|
8
|
+
{ id: "order.created", label: "Order Created", category: "lifecycle", workflowEmittable: true },
|
|
9
|
+
{ id: "oze.install.failed", label: "Oze Install Failed", category: "lifecycle", workflowEmittable: true },
|
|
10
|
+
{ id: "oze.quote.sent", label: "Oze Quote Sent", category: "lifecycle", workflowEmittable: true },
|
|
11
|
+
{ id: "sales.order.approval.approved", label: "Sales Order Approval Approved", category: "lifecycle", workflowEmittable: true },
|
|
12
|
+
{ id: "sales.order.approval.rejected", label: "Sales Order Approval Rejected", category: "lifecycle", workflowEmittable: true },
|
|
13
|
+
{ id: "sales.order.approval.requested", label: "Sales Order Approval Requested", category: "lifecycle", workflowEmittable: true },
|
|
14
|
+
{ id: "sales.pipeline.completed", label: "Sales Pipeline Completed", category: "lifecycle", workflowEmittable: true },
|
|
15
|
+
{ id: "workflows.task.escalated", label: "Workflows Task Escalated", category: "lifecycle", workflowEmittable: true },
|
|
3
16
|
// Workflow Definitions
|
|
4
17
|
{ id: "workflows.definition.created", label: "Workflow Definition Created", entity: "definition", category: "crud" },
|
|
5
18
|
{ id: "workflows.definition.updated", label: "Workflow Definition Updated", entity: "definition", category: "crud" },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/modules/workflows/events.ts"],
|
|
4
|
-
"sourcesContent": ["import { createModuleEvents } from '@open-mercato/shared/modules/events'\n\n/**\n * Workflows Module Events\n *\n * Declares all events that can be emitted by the workflows module.\n */\nconst events = [\n // Workflow Definitions\n { id: 'workflows.definition.created', label: 'Workflow Definition Created', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.updated', label: 'Workflow Definition Updated', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.deleted', label: 'Workflow Definition Deleted', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.customized', label: 'Workflow Definition Customized', entity: 'definition', category: 'lifecycle' },\n { id: 'workflows.definition.reset_to_code', label: 'Workflow Definition Reset to Code', entity: 'definition', category: 'lifecycle' },\n { id: 'workflows.definition.published', label: 'Workflow Definition Published', entity: 'definition', category: 'lifecycle' },\n\n // Workflow Instances\n { id: 'workflows.instance.created', label: 'Workflow Instance Created', entity: 'instance', category: 'crud' },\n { id: 'workflows.instance.updated', label: 'Workflow Instance Updated', entity: 'instance', category: 'crud' },\n { id: 'workflows.instance.deleted', label: 'Workflow Instance Deleted', entity: 'instance', category: 'crud' },\n\n /**\n * Workflow lifecycle. All six carry `clientBroadcast: true` so the run views\n * update live through the DOM Event Bridge (spec \u00A78.3).\n *\n * Safe to broadcast: the payload `emitInstanceLifecycleEvent` publishes is\n * instance identity and state \u2014 id, tenant, organization, workflowId,\n * version, status, current stepId \u2014 and carries no authored content, no task\n * name and no run context. It is also already tenant + organization scoped by\n * the bridge, which refuses to deliver a payload with no `tenantId` at all.\n *\n * `paused` and `resumed` are declared but have never had an emit site (see\n * `InstanceLifecycleEventId` in `lib/workflow-executor.ts`); the flag is\n * declared on them anyway so that whoever wires the emit does not have to\n * revisit the contract.\n */\n { id: 'workflows.instance.started', label: 'Workflow Started', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.completed', label: 'Workflow Completed', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.failed', label: 'Workflow Failed', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.cancelled', label: 'Workflow Cancelled', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.paused', label: 'Workflow Paused', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.resumed', label: 'Workflow Resumed', category: 'lifecycle', clientBroadcast: true },\n /**\n * A BUSINESS milestone the run announced \u2014 emitted when a step carrying a\n * `milestone` annotation completes.\n *\n * It is deliberately not a step event. A milestone can be announced after a\n * parallel join, after a retry, or after ten steps, and a consumer reading the\n * business narrative must never have to know which. `milestoneKey` is the\n * business vocabulary; `stepId` rides along for the trace, not for matching.\n */\n { id: 'workflows.instance.milestone_reached', label: 'Workflow Milestone Reached', category: 'lifecycle', clientBroadcast: true },\n\n // User Task Events\n { id: 'workflows.task.assigned', label: 'Task Assigned', entity: 'task', category: 'lifecycle' },\n { id: 'workflows.task.reminder_due', label: 'Task Reminder Due', entity: 'task', category: 'lifecycle' },\n { id: 'workflows.task.deadline_breached', label: 'Task Deadline Breached', entity: 'task', category: 'lifecycle' },\n /**\n * A task addressed to a PORTAL principal, bridged to that principal's browser\n * so it appears without a reload.\n *\n * A separate event rather than `portalBroadcast` on `workflows.task.assigned`,\n * and the difference is a leak. The portal SSE bridge scopes a payload by\n * tenant + organization and narrows to one user ONLY when the payload carries\n * `recipientUserId`; `workflows.task.assigned` carries none, plus the task\n * name and its entity bindings \u2014 broadcasting it would hand every portal user\n * in the organization the name of every other customer's task. This one is\n * addressed to exactly one principal and carries an ID and nothing else, so\n * the receiver has to ask the (authorized) API what it is.\n */\n { id: 'workflows.task.portal_assigned', label: 'Portal Task Assigned', entity: 'task', category: 'lifecycle', portalBroadcast: true, excludeFromTriggers: true },\n\n // Activity Events\n { id: 'workflows.activity.started', label: 'Activity Started', category: 'lifecycle' },\n { id: 'workflows.activity.completed', label: 'Activity Completed', category: 'lifecycle' },\n { id: 'workflows.activity.failed', label: 'Activity Failed', category: 'lifecycle' },\n\n /**\n * Live agent-action telemetry for an INVOKE_AGENT step (spec \u00A7Phase 2). Emitted\n * per AI-SDK step by the optional `agent_orchestrator` peer's native runner so\n * the run view can show what the agent is doing WHILE it runs, instead of only\n * refetching on `instance.*` lifecycle changes. `clientBroadcast` so it reaches\n * the browser via the DOM Event Bridge; `excludeFromTriggers` because it is UI\n * telemetry, not a business signal a workflow should react to.\n *\n * Ephemeral and safe to broadcast: the payload is instance/step identity plus\n * a coarse action descriptor (`kind`: step_finish | tool_call, an optional tool\n * `name`, step index, tool-call count) \u2014 NO token text, NO model output, NO\n * authored content \u2014 and is tenant + organization scoped like the lifecycle\n * events. Low-frequency (a handful per agent run), so it fits the bridge's\n * dedup/heartbeat envelope where a token stream never could.\n */\n { id: 'workflows.agent.action', label: 'Workflow Agent Action', category: 'lifecycle', clientBroadcast: true, excludeFromTriggers: true },\n\n // Event Triggers\n { id: 'workflows.trigger.created', label: 'Trigger Created', entity: 'trigger', category: 'crud' },\n { id: 'workflows.trigger.updated', label: 'Trigger Updated', entity: 'trigger', category: 'crud' },\n { id: 'workflows.trigger.deleted', label: 'Trigger Deleted', entity: 'trigger', category: 'crud' },\n\n // Parallel Fork / Join (branch lifecycle)\n { id: 'workflows.branch.opened', label: 'Parallel Branch Opened', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.completed', label: 'Parallel Branch Completed', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.cancelled', label: 'Parallel Branch Cancelled', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.failed', label: 'Parallel Branch Failed', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.join.completed', label: 'Parallel Join Completed', entity: 'branch', category: 'lifecycle' },\n] as const\n\nexport const eventsConfig = createModuleEvents({\n moduleId: 'workflows',\n events,\n})\n\n/** Type-safe event emitter for workflows module */\nexport const emitWorkflowsEvent = eventsConfig.emit\n\n/** Event IDs that can be emitted by the workflows module */\nexport type WorkflowsEventId = typeof events[number]['id']\n\nexport default eventsConfig\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,0BAA0B;AAOnC,MAAM,SAAS;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import { createModuleEvents } from '@open-mercato/shared/modules/events'\n\n/**\n * Workflows Module Events\n *\n * Declares all events that can be emitted by the workflows module.\n */\nconst events = [\n { id: 'approval.completed', label: 'Approval Completed', category: 'lifecycle', workflowEmittable: true },\n { id: 'approval.requested', label: 'Approval Requested', category: 'lifecycle', workflowEmittable: true },\n { id: 'checkout.started', label: 'Checkout Started', category: 'lifecycle', workflowEmittable: true },\n { id: 'fulfillment.ready', label: 'Fulfillment Ready', category: 'lifecycle', workflowEmittable: true },\n { id: 'order.approved', label: 'Order Approved', category: 'lifecycle', workflowEmittable: true },\n { id: 'order.created', label: 'Order Created', category: 'lifecycle', workflowEmittable: true },\n { id: 'oze.install.failed', label: 'Oze Install Failed', category: 'lifecycle', workflowEmittable: true },\n { id: 'oze.quote.sent', label: 'Oze Quote Sent', category: 'lifecycle', workflowEmittable: true },\n { id: 'sales.order.approval.approved', label: 'Sales Order Approval Approved', category: 'lifecycle', workflowEmittable: true },\n { id: 'sales.order.approval.rejected', label: 'Sales Order Approval Rejected', category: 'lifecycle', workflowEmittable: true },\n { id: 'sales.order.approval.requested', label: 'Sales Order Approval Requested', category: 'lifecycle', workflowEmittable: true },\n { id: 'sales.pipeline.completed', label: 'Sales Pipeline Completed', category: 'lifecycle', workflowEmittable: true },\n { id: 'workflows.task.escalated', label: 'Workflows Task Escalated', category: 'lifecycle', workflowEmittable: true },\n\n // Workflow Definitions\n { id: 'workflows.definition.created', label: 'Workflow Definition Created', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.updated', label: 'Workflow Definition Updated', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.deleted', label: 'Workflow Definition Deleted', entity: 'definition', category: 'crud' },\n { id: 'workflows.definition.customized', label: 'Workflow Definition Customized', entity: 'definition', category: 'lifecycle' },\n { id: 'workflows.definition.reset_to_code', label: 'Workflow Definition Reset to Code', entity: 'definition', category: 'lifecycle' },\n { id: 'workflows.definition.published', label: 'Workflow Definition Published', entity: 'definition', category: 'lifecycle' },\n\n // Workflow Instances\n { id: 'workflows.instance.created', label: 'Workflow Instance Created', entity: 'instance', category: 'crud' },\n { id: 'workflows.instance.updated', label: 'Workflow Instance Updated', entity: 'instance', category: 'crud' },\n { id: 'workflows.instance.deleted', label: 'Workflow Instance Deleted', entity: 'instance', category: 'crud' },\n\n /**\n * Workflow lifecycle. All six carry `clientBroadcast: true` so the run views\n * update live through the DOM Event Bridge (spec \u00A78.3).\n *\n * Safe to broadcast: the payload `emitInstanceLifecycleEvent` publishes is\n * instance identity and state \u2014 id, tenant, organization, workflowId,\n * version, status, current stepId \u2014 and carries no authored content, no task\n * name and no run context. It is also already tenant + organization scoped by\n * the bridge, which refuses to deliver a payload with no `tenantId` at all.\n *\n * `paused` and `resumed` are declared but have never had an emit site (see\n * `InstanceLifecycleEventId` in `lib/workflow-executor.ts`); the flag is\n * declared on them anyway so that whoever wires the emit does not have to\n * revisit the contract.\n */\n { id: 'workflows.instance.started', label: 'Workflow Started', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.completed', label: 'Workflow Completed', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.failed', label: 'Workflow Failed', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.cancelled', label: 'Workflow Cancelled', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.paused', label: 'Workflow Paused', category: 'lifecycle', clientBroadcast: true },\n { id: 'workflows.instance.resumed', label: 'Workflow Resumed', category: 'lifecycle', clientBroadcast: true },\n /**\n * A BUSINESS milestone the run announced \u2014 emitted when a step carrying a\n * `milestone` annotation completes.\n *\n * It is deliberately not a step event. A milestone can be announced after a\n * parallel join, after a retry, or after ten steps, and a consumer reading the\n * business narrative must never have to know which. `milestoneKey` is the\n * business vocabulary; `stepId` rides along for the trace, not for matching.\n */\n { id: 'workflows.instance.milestone_reached', label: 'Workflow Milestone Reached', category: 'lifecycle', clientBroadcast: true },\n\n // User Task Events\n { id: 'workflows.task.assigned', label: 'Task Assigned', entity: 'task', category: 'lifecycle' },\n { id: 'workflows.task.reminder_due', label: 'Task Reminder Due', entity: 'task', category: 'lifecycle' },\n { id: 'workflows.task.deadline_breached', label: 'Task Deadline Breached', entity: 'task', category: 'lifecycle' },\n /**\n * A task addressed to a PORTAL principal, bridged to that principal's browser\n * so it appears without a reload.\n *\n * A separate event rather than `portalBroadcast` on `workflows.task.assigned`,\n * and the difference is a leak. The portal SSE bridge scopes a payload by\n * tenant + organization and narrows to one user ONLY when the payload carries\n * `recipientUserId`; `workflows.task.assigned` carries none, plus the task\n * name and its entity bindings \u2014 broadcasting it would hand every portal user\n * in the organization the name of every other customer's task. This one is\n * addressed to exactly one principal and carries an ID and nothing else, so\n * the receiver has to ask the (authorized) API what it is.\n */\n { id: 'workflows.task.portal_assigned', label: 'Portal Task Assigned', entity: 'task', category: 'lifecycle', portalBroadcast: true, excludeFromTriggers: true },\n\n // Activity Events\n { id: 'workflows.activity.started', label: 'Activity Started', category: 'lifecycle' },\n { id: 'workflows.activity.completed', label: 'Activity Completed', category: 'lifecycle' },\n { id: 'workflows.activity.failed', label: 'Activity Failed', category: 'lifecycle' },\n\n /**\n * Live agent-action telemetry for an INVOKE_AGENT step (spec \u00A7Phase 2). Emitted\n * per AI-SDK step by the optional `agent_orchestrator` peer's native runner so\n * the run view can show what the agent is doing WHILE it runs, instead of only\n * refetching on `instance.*` lifecycle changes. `clientBroadcast` so it reaches\n * the browser via the DOM Event Bridge; `excludeFromTriggers` because it is UI\n * telemetry, not a business signal a workflow should react to.\n *\n * Ephemeral and safe to broadcast: the payload is instance/step identity plus\n * a coarse action descriptor (`kind`: step_finish | tool_call, an optional tool\n * `name`, step index, tool-call count) \u2014 NO token text, NO model output, NO\n * authored content \u2014 and is tenant + organization scoped like the lifecycle\n * events. Low-frequency (a handful per agent run), so it fits the bridge's\n * dedup/heartbeat envelope where a token stream never could.\n */\n { id: 'workflows.agent.action', label: 'Workflow Agent Action', category: 'lifecycle', clientBroadcast: true, excludeFromTriggers: true },\n\n // Event Triggers\n { id: 'workflows.trigger.created', label: 'Trigger Created', entity: 'trigger', category: 'crud' },\n { id: 'workflows.trigger.updated', label: 'Trigger Updated', entity: 'trigger', category: 'crud' },\n { id: 'workflows.trigger.deleted', label: 'Trigger Deleted', entity: 'trigger', category: 'crud' },\n\n // Parallel Fork / Join (branch lifecycle)\n { id: 'workflows.branch.opened', label: 'Parallel Branch Opened', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.completed', label: 'Parallel Branch Completed', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.cancelled', label: 'Parallel Branch Cancelled', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.branch.failed', label: 'Parallel Branch Failed', entity: 'branch', category: 'lifecycle' },\n { id: 'workflows.join.completed', label: 'Parallel Join Completed', entity: 'branch', category: 'lifecycle' },\n] as const\n\nexport const eventsConfig = createModuleEvents({\n moduleId: 'workflows',\n events,\n})\n\n/** Type-safe event emitter for workflows module */\nexport const emitWorkflowsEvent = eventsConfig.emit\n\n/** Event IDs that can be emitted by the workflows module */\nexport type WorkflowsEventId = typeof events[number]['id']\n\nexport default eventsConfig\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B;AAOnC,MAAM,SAAS;AAAA,EACb,EAAE,IAAI,sBAAsB,OAAO,sBAAsB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EACxG,EAAE,IAAI,sBAAsB,OAAO,sBAAsB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EACxG,EAAE,IAAI,oBAAoB,OAAO,oBAAoB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EACpG,EAAE,IAAI,qBAAqB,OAAO,qBAAqB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EACtG,EAAE,IAAI,kBAAkB,OAAO,kBAAkB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EAChG,EAAE,IAAI,iBAAiB,OAAO,iBAAiB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EAC9F,EAAE,IAAI,sBAAsB,OAAO,sBAAsB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EACxG,EAAE,IAAI,kBAAkB,OAAO,kBAAkB,UAAU,aAAa,mBAAmB,KAAK;AAAA,EAChG,EAAE,IAAI,iCAAiC,OAAO,iCAAiC,UAAU,aAAa,mBAAmB,KAAK;AAAA,EAC9H,EAAE,IAAI,iCAAiC,OAAO,iCAAiC,UAAU,aAAa,mBAAmB,KAAK;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AAW,UAAU,OAAO;AAAA,EACjG,EAAE,IAAI,6BAA6B,OAAO,mBAAmB,QAAQ,WAAW,UAAU,OAAO;AAAA;AAAA,EAGjG,EAAE,IAAI,2BAA2B,OAAO,0BAA0B,QAAQ,UAAU,UAAU,YAAY;AAAA,EAC1G,EAAE,IAAI,8BAA8B,OAAO,6BAA6B,QAAQ,UAAU,UAAU,YAAY;AAAA,EAChH,EAAE,IAAI,8BAA8B,OAAO,6BAA6B,QAAQ,UAAU,UAAU,YAAY;AAAA,EAChH,EAAE,IAAI,2BAA2B,OAAO,0BAA0B,QAAQ,UAAU,UAAU,YAAY;AAAA,EAC1G,EAAE,IAAI,4BAA4B,OAAO,2BAA2B,QAAQ,UAAU,UAAU,YAAY;AAC9G;AAEO,MAAM,eAAe,mBAAmB;AAAA,EAC7C,UAAU;AAAA,EACV;AACF,CAAC;AAGM,MAAM,qBAAqB,aAAa;AAK/C,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { isApiKeysModuleEnabled } from "./optional-modules.js";
|
|
2
1
|
import { createModuleQueue } from "@open-mercato/queue";
|
|
3
2
|
import {
|
|
4
3
|
safeOutboundFetch,
|
|
5
4
|
UnsafeOutboundUrlError
|
|
6
5
|
} from "@open-mercato/shared/lib/url-safety";
|
|
7
6
|
import { parseBooleanWithDefault } from "@open-mercato/shared/lib/boolean";
|
|
8
|
-
import { isPrivateCrossProcessBroadcastEvent } from "@open-mercato/shared/modules/events";
|
|
7
|
+
import { getDeclaredEvents, isPrivateCrossProcessBroadcastEvent } from "@open-mercato/shared/modules/events";
|
|
9
8
|
import {
|
|
10
9
|
definitionDeclaresGrant,
|
|
11
10
|
resolveWorkflowDefinitionExecutionUserId
|
|
@@ -515,12 +514,16 @@ async function executeSendEmail(config, context, container, signal) {
|
|
|
515
514
|
}
|
|
516
515
|
async function executeEmitEvent(config, context, container, signal) {
|
|
517
516
|
const { eventName, payload } = config;
|
|
518
|
-
if (!eventName) {
|
|
517
|
+
if (typeof eventName !== "string" || !eventName) {
|
|
519
518
|
throw new Error('EMIT_EVENT requires "eventName" field');
|
|
520
519
|
}
|
|
521
520
|
if (isPrivateCrossProcessBroadcastEvent(eventName)) {
|
|
522
521
|
throw new Error(`EMIT_EVENT cannot emit private cross-process event "${eventName}"`);
|
|
523
522
|
}
|
|
523
|
+
const declaration = getDeclaredEvents().find((event) => event.id === eventName);
|
|
524
|
+
if (declaration?.workflowEmittable !== true || declaration.portalBroadcast || declaration.crossProcessBroadcast) {
|
|
525
|
+
throw new Error(`EMIT_EVENT cannot emit event "${eventName}" from a workflow`);
|
|
526
|
+
}
|
|
524
527
|
const unresolvedPayloadKeys = findUnresolvedTemplateKeys(payload);
|
|
525
528
|
if (unresolvedPayloadKeys.length > 0) {
|
|
526
529
|
throw new Error(
|
|
@@ -532,21 +535,22 @@ async function executeEmitEvent(config, context, container, signal) {
|
|
|
532
535
|
if (!eventBus || typeof eventBus.emitEvent !== "function") {
|
|
533
536
|
throw new Error("Event bus not available in container");
|
|
534
537
|
}
|
|
538
|
+
const { tenantId, organizationId } = context.workflowInstance;
|
|
535
539
|
const enrichedPayload = {
|
|
536
540
|
...payload,
|
|
541
|
+
tenantId,
|
|
542
|
+
organizationId,
|
|
537
543
|
_workflow: {
|
|
538
544
|
workflowInstanceId: context.workflowInstance.id,
|
|
539
545
|
workflowId: context.workflowInstance.workflowId,
|
|
540
|
-
tenantId
|
|
541
|
-
organizationId
|
|
546
|
+
tenantId,
|
|
547
|
+
organizationId
|
|
542
548
|
}
|
|
543
549
|
};
|
|
550
|
+
delete enrichedPayload.organizationIds;
|
|
544
551
|
await raceAbortable(
|
|
545
552
|
Promise.resolve(
|
|
546
|
-
eventBus.emitEvent(eventName, enrichedPayload, {
|
|
547
|
-
tenantId: context.workflowInstance.tenantId,
|
|
548
|
-
organizationId: context.workflowInstance.organizationId
|
|
549
|
-
})
|
|
553
|
+
eventBus.emitEvent(eventName, enrichedPayload, { tenantId, organizationId })
|
|
550
554
|
),
|
|
551
555
|
signal
|
|
552
556
|
);
|
|
@@ -958,6 +962,36 @@ async function executeInvokeAgent(config, context, container) {
|
|
|
958
962
|
__park: { signalName: INVOKE_AGENT_SIGNAL_NAME }
|
|
959
963
|
};
|
|
960
964
|
}
|
|
965
|
+
function isMissingApiKeyOneTimeIssuerError(error) {
|
|
966
|
+
if (!error || typeof error !== "object") return false;
|
|
967
|
+
const candidate = error;
|
|
968
|
+
if (candidate.name !== "AwilixResolutionError") return false;
|
|
969
|
+
const message = typeof candidate.message === "string" ? candidate.message : "";
|
|
970
|
+
return /Could not resolve ['"]apiKeyOneTimeIssuer['"]/.test(message);
|
|
971
|
+
}
|
|
972
|
+
function resolveApiKeyOneTimeIssuer(container) {
|
|
973
|
+
if (typeof container.hasRegistration === "function" && !container.hasRegistration("apiKeyOneTimeIssuer")) {
|
|
974
|
+
return null;
|
|
975
|
+
}
|
|
976
|
+
let candidate;
|
|
977
|
+
try {
|
|
978
|
+
candidate = container.resolve("apiKeyOneTimeIssuer");
|
|
979
|
+
} catch (error) {
|
|
980
|
+
if (isMissingApiKeyOneTimeIssuerError(error)) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
throw error;
|
|
984
|
+
}
|
|
985
|
+
if (candidate === null || candidate === void 0) {
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
if (typeof candidate.withOneTimeApiKey !== "function") {
|
|
989
|
+
throw new Error(
|
|
990
|
+
"[CALL_API] Registered apiKeyOneTimeIssuer service is invalid: missing withOneTimeApiKey()."
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
return candidate;
|
|
994
|
+
}
|
|
961
995
|
async function executeCallApi(em, config, context, container, signal) {
|
|
962
996
|
assertTrustedEventTriggerIdentity(context.workflowInstance);
|
|
963
997
|
const interpolatedConfig = interpolateActivityConfig(config, context, "CALL_API");
|
|
@@ -972,22 +1006,21 @@ async function executeCallApi(em, config, context, container, signal) {
|
|
|
972
1006
|
throw new Error('CALL_API requires "endpoint" field');
|
|
973
1007
|
}
|
|
974
1008
|
const requestUrl = await resolveCallApiUrl(endpoint);
|
|
975
|
-
|
|
1009
|
+
const apiKeyOneTimeIssuer = resolveApiKeyOneTimeIssuer(container);
|
|
1010
|
+
if (!apiKeyOneTimeIssuer) {
|
|
976
1011
|
throw await createCallApiError(
|
|
977
1012
|
"workflows.errors.callApi.apiKeysModuleDisabled",
|
|
978
1013
|
"CALL_API needs the api_keys module to authenticate internal calls"
|
|
979
1014
|
);
|
|
980
1015
|
}
|
|
981
|
-
const
|
|
982
|
-
const
|
|
983
|
-
const resolvedRoleIds = await resolveCallApiRoleIds(apiKeyEm, context.workflowInstance);
|
|
1016
|
+
const roleResolutionEm = container.resolve("em").fork({ clear: true, freshEventManager: true, useContext: false });
|
|
1017
|
+
const resolvedRoleIds = await resolveCallApiRoleIds(roleResolutionEm, context.workflowInstance);
|
|
984
1018
|
if (resolvedRoleIds.length === 0) {
|
|
985
1019
|
throw new Error(
|
|
986
1020
|
`[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
1021
|
);
|
|
988
1022
|
}
|
|
989
|
-
return await
|
|
990
|
-
apiKeyEm,
|
|
1023
|
+
return await apiKeyOneTimeIssuer.withOneTimeApiKey(
|
|
991
1024
|
{
|
|
992
1025
|
name: `__workflow_${context.workflowInstance.id}__`,
|
|
993
1026
|
description: `One-time key for workflow ${context.workflowInstance.workflowId} instance ${context.workflowInstance.id}`,
|