@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102
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/dist/_virtual/rolldown_runtime.js +22 -1
- package/dist/adapters/ai.js +82 -1
- package/dist/adapters/factory.js +36 -1
- package/dist/adapters/fs.js +118 -1
- package/dist/adapters/git.js +54 -1
- package/dist/adapters/index.js +7 -1
- package/dist/adapters/logger.js +80 -1
- package/dist/adapters/watcher.js +69 -1
- package/dist/adapters/workspace.js +190 -2
- package/dist/ai/agents/claude-code-agent.js +146 -9
- package/dist/ai/agents/cursor-agent.js +286 -17
- package/dist/ai/agents/index.js +5 -1
- package/dist/ai/agents/openai-codex-agent.js +140 -8
- package/dist/ai/agents/orchestrator.js +142 -1
- package/dist/ai/agents/simple-agent.js +80 -4
- package/dist/ai/client.js +162 -1
- package/dist/ai/index.js +27 -1
- package/dist/ai/prompts/code-generation.js +55 -13
- package/dist/ai/prompts/index.js +12 -1
- package/dist/ai/prompts/spec-creation.js +61 -20
- package/dist/ai/providers.js +40 -1
- package/dist/formatters/index.js +18 -1
- package/dist/formatters/json.js +71 -1
- package/dist/formatters/sarif.js +163 -1
- package/dist/formatters/text.js +208 -2
- package/dist/index.js +81 -1
- package/dist/libs/ai-providers/dist/factory.js +154 -1
- package/dist/libs/ai-providers/dist/index.js +4 -1
- package/dist/libs/ai-providers/dist/legacy.js +72 -1
- package/dist/libs/ai-providers/dist/models.js +287 -1
- package/dist/libs/ai-providers/dist/validation.js +1 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +8 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +72 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +24 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +352 -4
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +143 -7
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +75 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +2 -1
- package/dist/libs/contracts/dist/regenerator/service.js +92 -1
- package/dist/libs/contracts/dist/regenerator/utils.js +51 -1
- package/dist/libs/contracts/dist/registry.js +208 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +34 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +35 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +150 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/contracts-transformers/dist/common/utils.js +47 -1
- package/dist/libs/contracts-transformers/dist/openapi/exporter.js +1 -1
- package/dist/libs/contracts-transformers/dist/openapi/importer.js +255 -2
- package/dist/libs/contracts-transformers/dist/openapi/index.js +4 -1
- package/dist/libs/contracts-transformers/dist/openapi/parser.js +231 -1
- package/dist/libs/contracts-transformers/dist/openapi/schema-converter.js +201 -4
- package/dist/modules/contractspec-workspace/dist/ai/code-generation.js +50 -13
- package/dist/modules/contractspec-workspace/dist/ai/spec-creation.js +50 -18
- package/dist/modules/contractspec-workspace/dist/analysis/deps/graph.js +84 -2
- package/dist/modules/contractspec-workspace/dist/analysis/deps/parse-imports.js +30 -1
- package/dist/modules/contractspec-workspace/dist/analysis/diff/semantic.js +96 -1
- package/dist/modules/contractspec-workspace/dist/analysis/feature-scan.js +151 -1
- package/dist/modules/contractspec-workspace/dist/analysis/spec-scan.js +344 -1
- package/dist/modules/contractspec-workspace/dist/analysis/validate/spec-structure.js +122 -1
- package/dist/modules/contractspec-workspace/dist/templates/app-config.js +100 -28
- package/dist/modules/contractspec-workspace/dist/templates/data-view.js +41 -27
- package/dist/modules/contractspec-workspace/dist/templates/event.js +28 -14
- package/dist/modules/contractspec-workspace/dist/templates/experiment.js +76 -51
- package/dist/modules/contractspec-workspace/dist/templates/handler.js +49 -17
- package/dist/modules/contractspec-workspace/dist/templates/integration-utils.js +97 -26
- package/dist/modules/contractspec-workspace/dist/templates/integration.js +46 -23
- package/dist/modules/contractspec-workspace/dist/templates/knowledge.js +59 -19
- package/dist/modules/contractspec-workspace/dist/templates/migration.js +49 -26
- package/dist/modules/contractspec-workspace/dist/templates/operation.js +40 -28
- package/dist/modules/contractspec-workspace/dist/templates/presentation.js +45 -20
- package/dist/modules/contractspec-workspace/dist/templates/telemetry.js +73 -53
- package/dist/modules/contractspec-workspace/dist/templates/utils.js +38 -1
- package/dist/modules/contractspec-workspace/dist/templates/workflow-runner.js +12 -6
- package/dist/modules/contractspec-workspace/dist/templates/workflow.js +50 -24
- package/dist/modules/contractspec-workspace/dist/types/generation-types.js +20 -1
- package/dist/services/agent-guide/adapters/claude-code.js +144 -3
- package/dist/services/agent-guide/adapters/cursor-cli.js +135 -3
- package/dist/services/agent-guide/adapters/generic-mcp.js +159 -3
- package/dist/services/agent-guide/adapters/index.js +30 -1
- package/dist/services/agent-guide/agent-guide-service.js +148 -1
- package/dist/services/agent-guide/index.js +5 -1
- package/dist/services/build.js +140 -1
- package/dist/services/ci-check/ci-check-service.js +393 -1
- package/dist/services/ci-check/index.js +2 -1
- package/dist/services/ci-check/types.js +28 -1
- package/dist/services/clean.js +71 -1
- package/dist/services/config.js +76 -1
- package/dist/services/deps.js +62 -1
- package/dist/services/diff.js +33 -1
- package/dist/services/doctor/checks/ai.js +118 -2
- package/dist/services/doctor/checks/cli.js +146 -1
- package/dist/services/doctor/checks/config.js +170 -1
- package/dist/services/doctor/checks/deps.js +180 -1
- package/dist/services/doctor/checks/index.js +6 -1
- package/dist/services/doctor/checks/mcp.js +144 -1
- package/dist/services/doctor/checks/workspace.js +243 -1
- package/dist/services/doctor/doctor-service.js +115 -2
- package/dist/services/doctor/index.js +2 -1
- package/dist/services/doctor/types.js +26 -1
- package/dist/services/implementation/discovery.js +143 -2
- package/dist/services/implementation/index.js +2 -1
- package/dist/services/implementation/resolver.js +223 -1
- package/dist/services/index.js +53 -1
- package/dist/services/integrity-diagram.js +274 -6
- package/dist/services/integrity.js +272 -1
- package/dist/services/list.js +35 -1
- package/dist/services/openapi/export-service.js +51 -2
- package/dist/services/openapi/import-service.js +75 -1
- package/dist/services/openapi/index.js +4 -1
- package/dist/services/openapi/sync-service.js +121 -1
- package/dist/services/openapi/validate-service.js +130 -1
- package/dist/services/regenerator.js +23 -1
- package/dist/services/registry.js +73 -1
- package/dist/services/setup/config-generators.js +113 -26
- package/dist/services/setup/file-merger.js +60 -2
- package/dist/services/setup/index.js +4 -1
- package/dist/services/setup/setup-service.js +95 -1
- package/dist/services/setup/targets/agents-md.js +46 -1
- package/dist/services/setup/targets/cli-config.js +59 -1
- package/dist/services/setup/targets/cursor-rules.js +47 -1
- package/dist/services/setup/targets/mcp-claude.js +59 -1
- package/dist/services/setup/targets/mcp-cursor.js +58 -1
- package/dist/services/setup/targets/vscode-settings.js +62 -1
- package/dist/services/setup/types.js +26 -1
- package/dist/services/sync.js +62 -1
- package/dist/services/test.js +30 -1
- package/dist/services/validate-implementation.js +69 -1
- package/dist/services/validate.js +47 -1
- package/dist/services/verification-cache/adapters/filesystem.js +121 -1
- package/dist/services/verification-cache/adapters/in-memory.js +45 -1
- package/dist/services/verification-cache/adapters/index.js +3 -1
- package/dist/services/verification-cache/adapters/workspace-state.js +90 -1
- package/dist/services/verification-cache/cache-service.js +255 -1
- package/dist/services/verification-cache/index.js +6 -1
- package/dist/services/verification-cache/types.js +15 -1
- package/dist/services/verify/ai-verifier.js +336 -9
- package/dist/services/verify/behavior-verifier.js +185 -1
- package/dist/services/verify/index.js +4 -1
- package/dist/services/verify/structure-verifier.js +195 -2
- package/dist/services/verify/verify-service.js +203 -3
- package/dist/services/watch.js +31 -1
- package/dist/services/workspace-info.js +102 -2
- package/dist/templates/app-config.template.js +101 -28
- package/dist/templates/data-view.template.js +42 -27
- package/dist/templates/event.template.js +29 -14
- package/dist/templates/experiment.template.js +77 -51
- package/dist/templates/handler.template.js +53 -17
- package/dist/templates/index.js +36 -1
- package/dist/templates/integration.template.js +134 -50
- package/dist/templates/knowledge.template.js +62 -21
- package/dist/templates/migration.template.js +50 -26
- package/dist/templates/operation.template.js +44 -28
- package/dist/templates/presentation.template.js +46 -20
- package/dist/templates/telemetry.template.js +74 -53
- package/dist/templates/workflow-runner.template.js +12 -6
- package/dist/templates/workflow.template.js +51 -24
- package/package.json +13 -9
|
@@ -1,28 +1,68 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { escapeString, toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/templates/knowledge.js
|
|
4
|
+
function generateKnowledgeSpaceSpec(data) {
|
|
5
|
+
const specName = toPascalCase(data.name.split(".").pop() ?? "KnowledgeSpace");
|
|
6
|
+
const varName = `${specName}KnowledgeSpace`;
|
|
7
|
+
const registerFn = `register${specName}KnowledgeSpace`;
|
|
8
|
+
const retention = renderRetention(data);
|
|
9
|
+
const access = renderAccess(data);
|
|
10
|
+
const indexing = renderIndexing(data);
|
|
11
|
+
const policyComment = data.policyName && !data.policyVersion ? ` // defaults to latest version` : "";
|
|
12
|
+
return `import { StabilityEnum } from '@lssm/lib.contracts/ownership';
|
|
2
13
|
import type { KnowledgeSpaceSpec } from '@lssm/lib.contracts/knowledge/spec';
|
|
3
14
|
import type { KnowledgeSpaceRegistry } from '@lssm/lib.contracts/knowledge/spec';
|
|
4
15
|
|
|
5
|
-
export const ${
|
|
16
|
+
export const ${varName}: KnowledgeSpaceSpec = {
|
|
6
17
|
meta: {
|
|
7
|
-
key: '${
|
|
8
|
-
version: ${
|
|
9
|
-
category: '${
|
|
10
|
-
displayName: '${
|
|
11
|
-
title: '${
|
|
12
|
-
description: '${
|
|
13
|
-
domain: '${
|
|
14
|
-
owners: [${
|
|
15
|
-
tags: [${
|
|
16
|
-
stability: StabilityEnum.${
|
|
18
|
+
key: '${escapeString(data.name)}',
|
|
19
|
+
version: ${data.version},
|
|
20
|
+
category: '${data.category}',
|
|
21
|
+
displayName: '${escape(data.displayName)}',
|
|
22
|
+
title: '${escape(data.title)}',
|
|
23
|
+
description: '${escape(data.description)}',
|
|
24
|
+
domain: '${escape(data.domain)}',
|
|
25
|
+
owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(", ")}],
|
|
26
|
+
tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],
|
|
27
|
+
stability: StabilityEnum.${stabilityToEnum(data.stability)},
|
|
17
28
|
},
|
|
18
|
-
retention: ${
|
|
29
|
+
retention: ${retention},
|
|
19
30
|
access: {
|
|
20
|
-
${
|
|
21
|
-
${
|
|
31
|
+
${access}${data.policyName ? ` policy: { name: '${escapeString(data.policyName)}',${data.policyVersion ? ` version: ${data.policyVersion}` : ""} },${policyComment}\n` : ""} },
|
|
32
|
+
${indexing} description: '${escape(data.description || data.displayName)}',
|
|
22
33
|
};
|
|
23
34
|
|
|
24
|
-
export function ${
|
|
25
|
-
return registry.register(${
|
|
35
|
+
export function ${registerFn}(registry: KnowledgeSpaceRegistry): KnowledgeSpaceRegistry {
|
|
36
|
+
return registry.register(${varName});
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
function renderRetention(data) {
|
|
41
|
+
return `{ ttlDays: ${data.retention.ttlDays === null ? "null" : typeof data.retention.ttlDays === "number" ? String(data.retention.ttlDays) : "null"}${typeof data.retention.archiveAfterDays === "number" ? `, archiveAfterDays: ${data.retention.archiveAfterDays}` : ""} }`;
|
|
42
|
+
}
|
|
43
|
+
function renderAccess(data) {
|
|
44
|
+
return `${` trustLevel: '${data.trustLevel}',\n`}${` automationWritable: ${data.automationWritable},\n`}`;
|
|
26
45
|
}
|
|
27
|
-
|
|
28
|
-
|
|
46
|
+
function renderIndexing(data) {
|
|
47
|
+
const entries = [];
|
|
48
|
+
if (data.embeddingModel) entries.push(` embeddingModel: '${escape(data.embeddingModel)}'`);
|
|
49
|
+
if (typeof data.chunkSize === "number") entries.push(` chunkSize: ${data.chunkSize}`);
|
|
50
|
+
if (data.vectorDbIntegration) entries.push(` vectorDbIntegration: '${escape(data.vectorDbIntegration)}'`);
|
|
51
|
+
if (entries.length === 0) return "";
|
|
52
|
+
return ` indexing: {\n${entries.join(",\n")}\n },\n`;
|
|
53
|
+
}
|
|
54
|
+
function stabilityToEnum(stability) {
|
|
55
|
+
switch (stability) {
|
|
56
|
+
case "beta": return "Beta";
|
|
57
|
+
case "stable": return "Stable";
|
|
58
|
+
case "deprecated": return "Deprecated";
|
|
59
|
+
case "experimental":
|
|
60
|
+
default: return "Experimental";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function escape(value) {
|
|
64
|
+
return value.replace(/`/g, "\\`").replace(/'/g, "\\'");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { generateKnowledgeSpaceSpec };
|
|
@@ -1,37 +1,60 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { escapeString, toPascalCase } from "./utils.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/templates/migration.js
|
|
4
|
+
function generateMigrationSpec(data) {
|
|
5
|
+
const migrationVar = `${toPascalCase(data.name.split(".").pop() ?? "Migration")}Migration`;
|
|
6
|
+
const dependencies = data.dependencies.length > 0 ? `dependencies: [${data.dependencies.map((dep) => `'${escapeString(dep)}'`).join(", ")}],` : "";
|
|
7
|
+
return `import type { MigrationSpec } from '@lssm/lib.contracts/migrations';
|
|
8
|
+
|
|
9
|
+
export const ${migrationVar}: MigrationSpec = {
|
|
4
10
|
meta: {
|
|
5
|
-
name: '${
|
|
6
|
-
version: ${
|
|
7
|
-
title: '${
|
|
8
|
-
description: '${
|
|
9
|
-
domain: '${
|
|
10
|
-
owners: [${
|
|
11
|
-
tags: [${
|
|
12
|
-
stability: '${
|
|
11
|
+
name: '${escapeString(data.name)}',
|
|
12
|
+
version: ${data.version},
|
|
13
|
+
title: '${escape(data.title)}',
|
|
14
|
+
description: '${escape(data.description ?? "")}',
|
|
15
|
+
domain: '${escape(data.domain)}',
|
|
16
|
+
owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(", ")}],
|
|
17
|
+
tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],
|
|
18
|
+
stability: '${data.stability}',
|
|
13
19
|
},
|
|
14
20
|
plan: {
|
|
15
21
|
up: [
|
|
16
|
-
${
|
|
17
|
-
],${
|
|
22
|
+
${renderSteps(data.up)}
|
|
23
|
+
],${data.down && data.down.length ? `
|
|
18
24
|
down: [
|
|
19
|
-
${
|
|
20
|
-
]
|
|
25
|
+
${renderSteps(data.down)}
|
|
26
|
+
],` : ""}
|
|
21
27
|
},
|
|
22
|
-
${
|
|
28
|
+
${dependencies}
|
|
23
29
|
};
|
|
24
|
-
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
function renderSteps(steps) {
|
|
33
|
+
return steps.map((step) => {
|
|
34
|
+
const description = step.description ? `description: '${escape(step.description)}',` : "";
|
|
35
|
+
switch (step.kind) {
|
|
36
|
+
case "schema": return ` {
|
|
25
37
|
kind: 'schema',
|
|
26
|
-
${
|
|
27
|
-
sql: \`${
|
|
28
|
-
}`;
|
|
38
|
+
${description}
|
|
39
|
+
sql: \`${escape(step.sql ?? "")}\`,
|
|
40
|
+
}`;
|
|
41
|
+
case "data": return ` {
|
|
29
42
|
kind: 'data',
|
|
30
|
-
${
|
|
31
|
-
script: \`${
|
|
32
|
-
}`;
|
|
43
|
+
${description}
|
|
44
|
+
script: \`${escape(step.script ?? "")}\`,
|
|
45
|
+
}`;
|
|
46
|
+
case "validation":
|
|
47
|
+
default: return ` {
|
|
33
48
|
kind: 'validation',
|
|
34
|
-
${
|
|
35
|
-
assertion: \`${
|
|
36
|
-
}
|
|
37
|
-
|
|
49
|
+
${description}
|
|
50
|
+
assertion: \`${escape(step.assertion ?? "")}\`,
|
|
51
|
+
}`;
|
|
52
|
+
}
|
|
53
|
+
}).join(",\n");
|
|
54
|
+
}
|
|
55
|
+
function escape(value) {
|
|
56
|
+
return value.replace(/`/g, "\\`").replace(/'/g, "\\'");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { generateMigrationSpec };
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { capitalize, toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/templates/operation.js
|
|
4
|
+
/**
|
|
5
|
+
* Generate operation spec TypeScript code.
|
|
6
|
+
*/
|
|
7
|
+
function generateOperationSpec(data) {
|
|
8
|
+
const { name, version, kind, description, goal, context, stability, owners, tags, auth, flags } = data;
|
|
9
|
+
const specVarName = toPascalCase(name.split(".").pop() ?? "Unknown") + "Spec";
|
|
10
|
+
const inputSchemaName = specVarName.replace("Spec", "Input");
|
|
11
|
+
const outputSchemaName = specVarName.replace("Spec", "Output");
|
|
12
|
+
return `import { define${capitalize(kind)} } from '@lssm/lib.contracts';
|
|
2
13
|
import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';
|
|
3
14
|
|
|
4
15
|
// TODO: Define input schema
|
|
5
|
-
export const ${
|
|
6
|
-
name: '${
|
|
7
|
-
description: 'Input for ${
|
|
16
|
+
export const ${inputSchemaName} = new SchemaModel({
|
|
17
|
+
name: '${inputSchemaName}',
|
|
18
|
+
description: 'Input for ${name}',
|
|
8
19
|
fields: {
|
|
9
20
|
// Add your fields here
|
|
10
21
|
// example: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
@@ -12,30 +23,30 @@ export const ${h} = new SchemaModel({
|
|
|
12
23
|
});
|
|
13
24
|
|
|
14
25
|
// TODO: Define output schema
|
|
15
|
-
export const ${
|
|
16
|
-
name: '${
|
|
17
|
-
description: 'Output for ${
|
|
26
|
+
export const ${outputSchemaName} = new SchemaModel({
|
|
27
|
+
name: '${outputSchemaName}',
|
|
28
|
+
description: 'Output for ${name}',
|
|
18
29
|
fields: {
|
|
19
30
|
// Add your fields here
|
|
20
31
|
ok: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
21
32
|
},
|
|
22
33
|
});
|
|
23
34
|
|
|
24
|
-
export const ${
|
|
35
|
+
export const ${specVarName} = define${capitalize(kind)}({
|
|
25
36
|
meta: {
|
|
26
|
-
name: '${
|
|
27
|
-
version: ${
|
|
28
|
-
stability: '${
|
|
29
|
-
owners: [${
|
|
30
|
-
tags: [${
|
|
31
|
-
description: '${
|
|
32
|
-
goal: '${
|
|
33
|
-
context: '${
|
|
37
|
+
name: '${name}',
|
|
38
|
+
version: ${version},
|
|
39
|
+
stability: '${stability}',
|
|
40
|
+
owners: [${owners.map((o) => `'${o}'`).join(", ")}],
|
|
41
|
+
tags: [${tags.map((t) => `'${t}'`).join(", ")}],
|
|
42
|
+
description: '${description}',
|
|
43
|
+
goal: '${goal}',
|
|
44
|
+
context: '${context}',
|
|
34
45
|
},
|
|
35
46
|
|
|
36
47
|
io: {
|
|
37
|
-
input: ${
|
|
38
|
-
output: ${
|
|
48
|
+
input: ${inputSchemaName},
|
|
49
|
+
output: ${outputSchemaName},
|
|
39
50
|
errors: {
|
|
40
51
|
// Define possible errors
|
|
41
52
|
// EXAMPLE_ERROR: {
|
|
@@ -47,24 +58,21 @@ export const ${m} = define${e(a)}({
|
|
|
47
58
|
},
|
|
48
59
|
|
|
49
60
|
policy: {
|
|
50
|
-
auth: '${
|
|
51
|
-
${
|
|
61
|
+
auth: '${auth}',
|
|
62
|
+
${flags.length > 0 ? `flags: [${flags.map((f) => `'${f}'`).join(", ")}],` : "// flags: [],"}
|
|
52
63
|
},
|
|
53
64
|
|
|
54
65
|
sideEffects: {
|
|
55
|
-
${
|
|
56
|
-
// Define events to emit
|
|
57
|
-
// { ref: SomeEventSpec, when: 'always' }
|
|
58
|
-
],`:`// emits: [],`}
|
|
66
|
+
${data.emitsEvents ? "emits: [\n // Define events to emit\n // { ref: SomeEventSpec, when: 'always' }\n ]," : "// emits: [],"}
|
|
59
67
|
analytics: [
|
|
60
68
|
// Define analytics events
|
|
61
69
|
],
|
|
62
70
|
},
|
|
63
71
|
|
|
64
72
|
transport: {
|
|
65
|
-
rest: { method: '${
|
|
66
|
-
gql: { field: '${
|
|
67
|
-
mcp: { toolName: '${
|
|
73
|
+
rest: { method: '${kind === "command" ? "POST" : "GET"}' },
|
|
74
|
+
gql: { field: '${name.replace(/\./g, "_")}' },
|
|
75
|
+
mcp: { toolName: '${name}.v${version}' },
|
|
68
76
|
},
|
|
69
77
|
|
|
70
78
|
acceptance: {
|
|
@@ -85,4 +93,8 @@ export const ${m} = define${e(a)}({
|
|
|
85
93
|
],
|
|
86
94
|
},
|
|
87
95
|
});
|
|
88
|
-
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { generateOperationSpec };
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/templates/presentation.js
|
|
4
|
+
/**
|
|
5
|
+
* Generate presentation spec TypeScript code.
|
|
6
|
+
*/
|
|
7
|
+
function generatePresentationSpec(data) {
|
|
8
|
+
const { name, version, description, stability, owners, tags, presentationKind } = data;
|
|
9
|
+
const varName = toPascalCase(name.replace(/\./g, "_")) + "Presentation";
|
|
10
|
+
let contentBlock = "";
|
|
11
|
+
switch (presentationKind) {
|
|
12
|
+
case "web_component":
|
|
13
|
+
contentBlock = ` content: {
|
|
2
14
|
kind: 'web_component',
|
|
3
15
|
framework: 'react',
|
|
4
|
-
componentKey: '${
|
|
16
|
+
componentKey: '${name.replace(/\./g, "_")}',
|
|
5
17
|
props: new SchemaModel({
|
|
6
|
-
name: '${
|
|
7
|
-
description: 'Props for ${
|
|
18
|
+
name: '${varName}Props',
|
|
19
|
+
description: 'Props for ${name}',
|
|
8
20
|
fields: {
|
|
9
21
|
// TODO: Define component props
|
|
10
22
|
},
|
|
@@ -12,35 +24,44 @@ import{t as e}from"./utils.js";function t(t){let{name:n,version:r,description:i,
|
|
|
12
24
|
analytics: [
|
|
13
25
|
// TODO: Define analytics events
|
|
14
26
|
],
|
|
15
|
-
},`;
|
|
27
|
+
},`;
|
|
28
|
+
break;
|
|
29
|
+
case "markdown":
|
|
30
|
+
contentBlock = ` content: {
|
|
16
31
|
kind: 'markdown',
|
|
17
32
|
content: \`
|
|
18
|
-
# ${
|
|
33
|
+
# ${description}
|
|
19
34
|
|
|
20
35
|
TODO: Add markdown content here
|
|
21
36
|
\`,
|
|
22
|
-
// Or use resourceUri: 'feature://${
|
|
23
|
-
},`;
|
|
37
|
+
// Or use resourceUri: 'feature://${name}/guide.md'
|
|
38
|
+
},`;
|
|
39
|
+
break;
|
|
40
|
+
case "data":
|
|
41
|
+
contentBlock = ` content: {
|
|
24
42
|
kind: 'data',
|
|
25
43
|
mimeType: 'application/json',
|
|
26
44
|
model: new SchemaModel({
|
|
27
|
-
name: '${
|
|
28
|
-
description: 'Data structure for ${
|
|
45
|
+
name: '${varName}Data',
|
|
46
|
+
description: 'Data structure for ${name}',
|
|
29
47
|
fields: {
|
|
30
48
|
// TODO: Define data structure
|
|
31
49
|
},
|
|
32
50
|
}),
|
|
33
|
-
},`;
|
|
51
|
+
},`;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
return `import type { PresentationSpec } from '@lssm/lib.contracts/presentations';
|
|
34
55
|
import { SchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';
|
|
35
56
|
|
|
36
|
-
export const ${
|
|
57
|
+
export const ${varName}: PresentationSpec = {
|
|
37
58
|
meta: {
|
|
38
|
-
name: '${
|
|
39
|
-
version: ${
|
|
40
|
-
stability: '${
|
|
41
|
-
owners: [${
|
|
42
|
-
tags: [${
|
|
43
|
-
description: '${
|
|
59
|
+
name: '${name}',
|
|
60
|
+
version: ${version},
|
|
61
|
+
stability: '${stability}',
|
|
62
|
+
owners: [${owners.map((o) => `'${o}'`).join(", ")}],
|
|
63
|
+
tags: [${tags.map((t) => `'${t}'`).join(", ")}],
|
|
64
|
+
description: '${description}',
|
|
44
65
|
},
|
|
45
66
|
|
|
46
67
|
policy: {
|
|
@@ -48,6 +69,10 @@ export const ${l}: PresentationSpec = {
|
|
|
48
69
|
// pii: [],
|
|
49
70
|
},
|
|
50
71
|
|
|
51
|
-
${
|
|
72
|
+
${contentBlock}
|
|
52
73
|
};
|
|
53
|
-
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { generatePresentationSpec };
|
|
@@ -1,69 +1,89 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
type: '${
|
|
9
|
-
${
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
import { toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../modules/contractspec-workspace/dist/templates/telemetry.js
|
|
4
|
+
function generateTelemetrySpec(data) {
|
|
5
|
+
const specVar = toPascalCase(data.name.split(".").pop() ?? "Telemetry") + "Telemetry";
|
|
6
|
+
const providers = data.providers?.length ? `providers: [
|
|
7
|
+
${data.providers.map((provider) => ` {
|
|
8
|
+
type: '${provider.type}',
|
|
9
|
+
config: ${formatConfigValue(provider.config)},
|
|
10
|
+
}`).join(",\n")}
|
|
11
|
+
],` : "";
|
|
12
|
+
const events = data.events.map((event) => {
|
|
13
|
+
const properties = event.properties.map((prop) => ` '${prop.name}': {
|
|
14
|
+
type: '${prop.type}',
|
|
15
|
+
${prop.required ? "required: true," : ""}
|
|
16
|
+
${prop.pii ? "pii: true," : ""}
|
|
17
|
+
${prop.redact ? "redact: true," : ""}
|
|
18
|
+
${prop.description ? `description: '${escapeString(prop.description)}',` : ""}
|
|
19
|
+
}`).join(",\n");
|
|
20
|
+
const anomalyRules = event.anomalyRules?.length ? ` anomalyDetection: {
|
|
15
21
|
enabled: true,
|
|
16
|
-
${typeof
|
|
22
|
+
${typeof event.anomalyMinimumSample === "number" ? `minimumSample: ${event.anomalyMinimumSample},` : ""}
|
|
17
23
|
thresholds: [
|
|
18
|
-
${
|
|
19
|
-
metric: '${
|
|
20
|
-
${typeof
|
|
21
|
-
${typeof
|
|
22
|
-
}`).join(
|
|
23
|
-
`)}
|
|
24
|
+
${event.anomalyRules.map((rule) => ` {
|
|
25
|
+
metric: '${escapeString(rule.metric)}',
|
|
26
|
+
${typeof rule.min === "number" ? `min: ${rule.min},` : ""}
|
|
27
|
+
${typeof rule.max === "number" ? `max: ${rule.max},` : ""}
|
|
28
|
+
}`).join(",\n")}
|
|
24
29
|
],
|
|
25
|
-
actions: [${(
|
|
26
|
-
}
|
|
30
|
+
actions: [${(event.anomalyActions ?? []).map((action) => `'${action}'`).join(", ")}],
|
|
31
|
+
},` : event.anomalyEnabled ? ` anomalyDetection: {
|
|
27
32
|
enabled: true,
|
|
28
|
-
${typeof
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
${typeof event.anomalyMinimumSample === "number" ? `minimumSample: ${event.anomalyMinimumSample},` : ""}
|
|
34
|
+
},` : "";
|
|
35
|
+
return ` {
|
|
36
|
+
name: '${escapeString(event.name)}',
|
|
37
|
+
version: ${event.version},
|
|
32
38
|
semantics: {
|
|
33
|
-
what: '${
|
|
34
|
-
${
|
|
35
|
-
${
|
|
39
|
+
what: '${escapeString(event.what)}',
|
|
40
|
+
${event.who ? `who: '${escapeString(event.who)}',` : ""}
|
|
41
|
+
${event.why ? `why: '${escapeString(event.why)}',` : ""}
|
|
36
42
|
},
|
|
37
|
-
privacy: '${
|
|
43
|
+
privacy: '${event.privacy}',
|
|
38
44
|
properties: {
|
|
39
|
-
${
|
|
45
|
+
${properties}
|
|
40
46
|
},
|
|
41
|
-
${typeof
|
|
42
|
-
${typeof
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
+
${typeof event.retentionDays === "number" ? `retention: { days: ${event.retentionDays}, ${event.retentionPolicy ? `policy: '${event.retentionPolicy}'` : ""} },` : ""}
|
|
48
|
+
${typeof event.samplingRate === "number" ? `sampling: { rate: ${event.samplingRate}${event.samplingConditions ? `, conditions: ['${escapeString(event.samplingConditions)}']` : ""} },` : ""}
|
|
49
|
+
${anomalyRules}
|
|
50
|
+
${event.tags?.length ? `tags: [${event.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],` : ""}
|
|
51
|
+
}`;
|
|
52
|
+
}).join(",\n");
|
|
53
|
+
return `import type { TelemetrySpec } from '@lssm/lib.contracts/telemetry';
|
|
47
54
|
|
|
48
|
-
export const ${
|
|
55
|
+
export const ${specVar}: TelemetrySpec = {
|
|
49
56
|
meta: {
|
|
50
|
-
name: '${
|
|
51
|
-
version: ${
|
|
52
|
-
title: '${
|
|
53
|
-
description: '${
|
|
54
|
-
domain: '${
|
|
55
|
-
owners: [${
|
|
56
|
-
tags: [${
|
|
57
|
-
stability: '${
|
|
57
|
+
name: '${escapeString(data.name)}',
|
|
58
|
+
version: ${data.version},
|
|
59
|
+
title: '${escapeString(data.name)} telemetry',
|
|
60
|
+
description: '${escapeString(data.description || "Describe the purpose of this telemetry spec.")}',
|
|
61
|
+
domain: '${escapeString(data.domain)}',
|
|
62
|
+
owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(", ")}],
|
|
63
|
+
tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(", ")}],
|
|
64
|
+
stability: '${data.stability}',
|
|
58
65
|
},
|
|
59
66
|
config: {
|
|
60
|
-
${typeof
|
|
61
|
-
${typeof
|
|
62
|
-
${
|
|
63
|
-
${
|
|
67
|
+
${typeof data.defaultRetentionDays === "number" ? `defaultRetentionDays: ${data.defaultRetentionDays},` : ""}
|
|
68
|
+
${typeof data.defaultSamplingRate === "number" ? `defaultSamplingRate: ${data.defaultSamplingRate},` : ""}
|
|
69
|
+
${data.anomalyEnabled ? `anomalyDetection: { enabled: true${typeof data.anomalyCheckIntervalMs === "number" ? `, checkIntervalMs: ${data.anomalyCheckIntervalMs}` : ""} },` : ""}
|
|
70
|
+
${providers}
|
|
64
71
|
},
|
|
65
72
|
events: [
|
|
66
|
-
${
|
|
73
|
+
${events}
|
|
67
74
|
],
|
|
68
75
|
};
|
|
69
|
-
|
|
76
|
+
`;
|
|
77
|
+
}
|
|
78
|
+
function escapeString(value) {
|
|
79
|
+
return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
80
|
+
}
|
|
81
|
+
function formatConfigValue(value) {
|
|
82
|
+
const trimmed = value.trim();
|
|
83
|
+
if (!trimmed) return "{}";
|
|
84
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) return trimmed;
|
|
85
|
+
return `'${escapeString(trimmed)}'`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { generateTelemetrySpec };
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../modules/contractspec-workspace/dist/templates/utils.js
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for template generation.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Convert string to camelCase.
|
|
7
|
+
*/
|
|
8
|
+
function toCamelCase(str) {
|
|
9
|
+
const pascal = toPascalCase(str);
|
|
10
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Convert string to PascalCase.
|
|
14
|
+
*/
|
|
15
|
+
function toPascalCase(str) {
|
|
16
|
+
return str.split(/[-_.]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert string to kebab-case.
|
|
20
|
+
*/
|
|
21
|
+
function toKebabCase(str) {
|
|
22
|
+
return str.replace(/\./g, "-").replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Capitalize first letter.
|
|
26
|
+
*/
|
|
27
|
+
function capitalize(str) {
|
|
28
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Escape single quotes in string.
|
|
32
|
+
*/
|
|
33
|
+
function escapeString(value) {
|
|
34
|
+
return value.replace(/'/g, "\\'");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { capitalize, escapeString, toCamelCase, toKebabCase, toPascalCase };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../modules/contractspec-workspace/dist/templates/workflow-runner.js
|
|
2
|
+
function generateWorkflowRunnerTemplate({ exportName, specImportPath, runnerName, workflowName }) {
|
|
3
|
+
return `import {
|
|
2
4
|
InMemoryStateStore,
|
|
3
5
|
WorkflowRegistry,
|
|
4
6
|
WorkflowRunner,
|
|
5
7
|
} from '@lssm/lib.contracts/workflow';
|
|
6
|
-
import { ${
|
|
8
|
+
import { ${exportName} } from '${specImportPath}';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Runner wiring for ${
|
|
11
|
+
* Runner wiring for ${workflowName}.
|
|
10
12
|
*
|
|
11
13
|
* TODO:
|
|
12
14
|
* - Replace the in-memory state store with a persistent adapter if needed.
|
|
@@ -14,11 +16,11 @@ import { ${e} } from '${t}';
|
|
|
14
16
|
* - Wire eventEmitter to telemetry sinks.
|
|
15
17
|
*/
|
|
16
18
|
const registry = new WorkflowRegistry();
|
|
17
|
-
registry.register(${
|
|
19
|
+
registry.register(${exportName});
|
|
18
20
|
|
|
19
21
|
const stateStore = new InMemoryStateStore();
|
|
20
22
|
|
|
21
|
-
export const ${
|
|
23
|
+
export const ${runnerName} = new WorkflowRunner({
|
|
22
24
|
registry,
|
|
23
25
|
stateStore,
|
|
24
26
|
opExecutor: async (operation, input, ctx) => {
|
|
@@ -39,4 +41,8 @@ export const ${n} = new WorkflowRunner({
|
|
|
39
41
|
// TODO: forward workflow events to telemetry or logging sinks
|
|
40
42
|
},
|
|
41
43
|
});
|
|
42
|
-
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { generateWorkflowRunnerTemplate };
|