@lssm/module.contractspec-workspace 1.41.1 → 1.42.1
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/ai/code-generation.d.ts +28 -0
- package/dist/ai/code-generation.d.ts.map +1 -0
- package/dist/ai/code-generation.js +51 -13
- package/dist/ai/code-generation.js.map +1 -0
- package/dist/ai/spec-creation.d.ts +27 -0
- package/dist/ai/spec-creation.d.ts.map +1 -0
- package/dist/ai/spec-creation.js +51 -18
- package/dist/ai/spec-creation.js.map +1 -0
- package/dist/analysis/deps/graph.d.ts +34 -0
- package/dist/analysis/deps/graph.d.ts.map +1 -0
- package/dist/analysis/deps/graph.js +85 -2
- package/dist/analysis/deps/graph.js.map +1 -0
- package/dist/analysis/deps/parse-imports.d.ts +17 -0
- package/dist/analysis/deps/parse-imports.d.ts.map +1 -0
- package/dist/analysis/deps/parse-imports.js +31 -1
- package/dist/analysis/deps/parse-imports.js.map +1 -0
- package/dist/analysis/diff/deep-diff.d.ts +33 -0
- package/dist/analysis/diff/deep-diff.d.ts.map +1 -0
- package/dist/analysis/diff/deep-diff.js +114 -0
- package/dist/analysis/diff/deep-diff.js.map +1 -0
- package/dist/analysis/diff/semantic.d.ts +11 -0
- package/dist/analysis/diff/semantic.d.ts.map +1 -0
- package/dist/analysis/diff/semantic.js +97 -1
- package/dist/analysis/diff/semantic.js.map +1 -0
- package/dist/analysis/feature-scan.d.ts +15 -0
- package/dist/analysis/feature-scan.d.ts.map +1 -0
- package/dist/analysis/feature-scan.js +152 -1
- package/dist/analysis/feature-scan.js.map +1 -0
- package/dist/analysis/grouping.d.ts +79 -0
- package/dist/analysis/grouping.d.ts.map +1 -0
- package/dist/analysis/grouping.js +115 -0
- package/dist/analysis/grouping.js.map +1 -0
- package/dist/analysis/impact/classifier.d.ts +19 -0
- package/dist/analysis/impact/classifier.d.ts.map +1 -0
- package/dist/analysis/impact/classifier.js +135 -0
- package/dist/analysis/impact/classifier.js.map +1 -0
- package/dist/analysis/impact/index.js +2 -0
- package/dist/analysis/impact/rules.d.ts +35 -0
- package/dist/analysis/impact/rules.d.ts.map +1 -0
- package/dist/analysis/impact/rules.js +154 -0
- package/dist/analysis/impact/rules.js.map +1 -0
- package/dist/analysis/impact/types.d.ts +95 -0
- package/dist/analysis/impact/types.d.ts.map +1 -0
- package/dist/analysis/index.js +14 -0
- package/dist/analysis/snapshot/index.js +2 -0
- package/dist/analysis/snapshot/normalizer.d.ts +36 -0
- package/dist/analysis/snapshot/normalizer.d.ts.map +1 -0
- package/dist/analysis/snapshot/normalizer.js +66 -0
- package/dist/analysis/snapshot/normalizer.js.map +1 -0
- package/dist/analysis/snapshot/snapshot.d.ts +18 -0
- package/dist/analysis/snapshot/snapshot.d.ts.map +1 -0
- package/dist/analysis/snapshot/snapshot.js +163 -0
- package/dist/analysis/snapshot/snapshot.js.map +1 -0
- package/dist/analysis/snapshot/types.d.ts +80 -0
- package/dist/analysis/snapshot/types.d.ts.map +1 -0
- package/dist/analysis/spec-scan.d.ts +34 -0
- package/dist/analysis/spec-scan.d.ts.map +1 -0
- package/dist/analysis/spec-scan.js +349 -1
- package/dist/analysis/spec-scan.js.map +1 -0
- package/dist/analysis/validate/spec-structure.d.ts +29 -0
- package/dist/analysis/validate/spec-structure.d.ts.map +1 -0
- package/dist/analysis/validate/spec-structure.js +139 -1
- package/dist/analysis/validate/spec-structure.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +32 -1
- package/dist/templates/app-config.d.ts +7 -0
- package/dist/templates/app-config.d.ts.map +1 -0
- package/dist/templates/app-config.js +101 -28
- package/dist/templates/app-config.js.map +1 -0
- package/dist/templates/data-view.d.ts +7 -0
- package/dist/templates/data-view.d.ts.map +1 -0
- package/dist/templates/data-view.js +42 -27
- package/dist/templates/data-view.js.map +1 -0
- package/dist/templates/event.d.ts +11 -0
- package/dist/templates/event.d.ts.map +1 -0
- package/dist/templates/event.js +31 -14
- package/dist/templates/event.js.map +1 -0
- package/dist/templates/experiment.d.ts +7 -0
- package/dist/templates/experiment.d.ts.map +1 -0
- package/dist/templates/experiment.js +77 -51
- package/dist/templates/experiment.js.map +1 -0
- package/dist/templates/handler.d.ts +20 -0
- package/dist/templates/handler.d.ts.map +1 -0
- package/dist/templates/handler.js +50 -17
- package/dist/templates/handler.js.map +1 -0
- package/dist/templates/integration-utils.js +98 -26
- package/dist/templates/integration-utils.js.map +1 -0
- package/dist/templates/integration.d.ts +7 -0
- package/dist/templates/integration.d.ts.map +1 -0
- package/dist/templates/integration.js +47 -23
- package/dist/templates/integration.js.map +1 -0
- package/dist/templates/knowledge.d.ts +7 -0
- package/dist/templates/knowledge.d.ts.map +1 -0
- package/dist/templates/knowledge.js +60 -19
- package/dist/templates/knowledge.js.map +1 -0
- package/dist/templates/migration.d.ts +7 -0
- package/dist/templates/migration.d.ts.map +1 -0
- package/dist/templates/migration.js +50 -26
- package/dist/templates/migration.js.map +1 -0
- package/dist/templates/operation.d.ts +11 -0
- package/dist/templates/operation.d.ts.map +1 -0
- package/dist/templates/operation.js +41 -28
- package/dist/templates/operation.js.map +1 -0
- package/dist/templates/presentation.d.ts +11 -0
- package/dist/templates/presentation.d.ts.map +1 -0
- package/dist/templates/presentation.js +46 -20
- package/dist/templates/presentation.js.map +1 -0
- package/dist/templates/telemetry.d.ts +7 -0
- package/dist/templates/telemetry.d.ts.map +1 -0
- package/dist/templates/telemetry.js +74 -53
- package/dist/templates/telemetry.js.map +1 -0
- package/dist/templates/utils.d.ts +27 -0
- package/dist/templates/utils.d.ts.map +1 -0
- package/dist/templates/utils.js +39 -1
- package/dist/templates/utils.js.map +1 -0
- package/dist/templates/workflow-runner.d.ts +16 -0
- package/dist/templates/workflow-runner.d.ts.map +1 -0
- package/dist/templates/workflow-runner.js +13 -6
- package/dist/templates/workflow-runner.js.map +1 -0
- package/dist/templates/workflow.d.ts +11 -0
- package/dist/templates/workflow.d.ts.map +1 -0
- package/dist/templates/workflow.js +51 -24
- package/dist/templates/workflow.js.map +1 -0
- package/dist/types/analysis-types.d.ts +126 -0
- package/dist/types/analysis-types.d.ts.map +1 -0
- package/dist/types/generation-types.d.ts +84 -0
- package/dist/types/generation-types.d.ts.map +1 -0
- package/dist/types/generation-types.js +21 -1
- package/dist/types/generation-types.js.map +1 -0
- package/dist/types/spec-types.d.ts +345 -0
- package/dist/types/spec-types.d.ts.map +1 -0
- package/package.json +16 -9
|
@@ -1,28 +1,69 @@
|
|
|
1
|
-
import{escapeString
|
|
1
|
+
import { escapeString, toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/knowledge.ts
|
|
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 };
|
|
69
|
+
//# sourceMappingURL=knowledge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge.js","names":["entries: string[]"],"sources":["../../src/templates/knowledge.ts"],"sourcesContent":["import type { KnowledgeSpaceSpecData, Stability } from '../types/spec-types';\nimport { toPascalCase, escapeString } from './utils';\n\nexport function generateKnowledgeSpaceSpec(\n data: KnowledgeSpaceSpecData\n): string {\n const specName = toPascalCase(data.name.split('.').pop() ?? 'KnowledgeSpace');\n const varName = `${specName}KnowledgeSpace`;\n const registerFn = `register${specName}KnowledgeSpace`;\n\n const retention = renderRetention(data);\n const access = renderAccess(data);\n const indexing = renderIndexing(data);\n const policyComment =\n data.policyName && !data.policyVersion\n ? ` // defaults to latest version`\n : '';\n\n return `import { StabilityEnum } from '@lssm/lib.contracts/ownership';\nimport type { KnowledgeSpaceSpec } from '@lssm/lib.contracts/knowledge/spec';\nimport type { KnowledgeSpaceRegistry } from '@lssm/lib.contracts/knowledge/spec';\n\nexport const ${varName}: KnowledgeSpaceSpec = {\n meta: {\n key: '${escapeString(data.name)}',\n version: ${data.version},\n category: '${data.category}',\n displayName: '${escape(data.displayName)}',\n title: '${escape(data.title)}',\n description: '${escape(data.description)}',\n domain: '${escape(data.domain)}',\n owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(', ')}],\n tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(', ')}],\n stability: StabilityEnum.${stabilityToEnum(data.stability)},\n },\n retention: ${retention},\n access: {\n${access}${data.policyName ? ` policy: { name: '${escapeString(data.policyName)}',${data.policyVersion ? ` version: ${data.policyVersion}` : ''} },${policyComment}\\n` : ''} },\n${indexing} description: '${escape(data.description || data.displayName)}',\n};\n\nexport function ${registerFn}(registry: KnowledgeSpaceRegistry): KnowledgeSpaceRegistry {\n return registry.register(${varName});\n}\n`;\n}\n\nfunction renderRetention(data: KnowledgeSpaceSpecData): string {\n const ttl =\n data.retention.ttlDays === null\n ? 'null'\n : typeof data.retention.ttlDays === 'number'\n ? String(data.retention.ttlDays)\n : 'null';\n const archive =\n typeof data.retention.archiveAfterDays === 'number'\n ? `, archiveAfterDays: ${data.retention.archiveAfterDays}`\n : '';\n return `{ ttlDays: ${ttl}${archive} }`;\n}\n\nfunction renderAccess(data: KnowledgeSpaceSpecData): string {\n const trustLine = ` trustLevel: '${data.trustLevel}',\\n`;\n const automationLine = ` automationWritable: ${data.automationWritable},\\n`;\n return `${trustLine}${automationLine}`;\n}\n\nfunction renderIndexing(data: KnowledgeSpaceSpecData): string {\n const entries: string[] = [];\n if (data.embeddingModel) {\n entries.push(` embeddingModel: '${escape(data.embeddingModel)}'`);\n }\n if (typeof data.chunkSize === 'number') {\n entries.push(` chunkSize: ${data.chunkSize}`);\n }\n if (data.vectorDbIntegration) {\n entries.push(\n ` vectorDbIntegration: '${escape(data.vectorDbIntegration)}'`\n );\n }\n if (entries.length === 0) {\n return '';\n }\n return ` indexing: {\\n${entries.join(',\\n')}\\n },\\n`;\n}\n\nfunction stabilityToEnum(stability: Stability): string {\n switch (stability) {\n case 'beta':\n return 'Beta';\n case 'stable':\n return 'Stable';\n case 'deprecated':\n return 'Deprecated';\n case 'experimental':\n default:\n return 'Experimental';\n }\n}\n\nfunction escape(value: string): string {\n return value.replace(/`/g, '\\\\`').replace(/'/g, \"\\\\'\");\n}\n"],"mappings":";;;AAGA,SAAgB,2BACd,MACQ;CACR,MAAM,WAAW,aAAa,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,iBAAiB;CAC7E,MAAM,UAAU,GAAG,SAAS;CAC5B,MAAM,aAAa,WAAW,SAAS;CAEvC,MAAM,YAAY,gBAAgB,KAAK;CACvC,MAAM,SAAS,aAAa,KAAK;CACjC,MAAM,WAAW,eAAe,KAAK;CACrC,MAAM,gBACJ,KAAK,cAAc,CAAC,KAAK,gBACrB,mCACA;AAEN,QAAO;;;;eAIM,QAAQ;;YAEX,aAAa,KAAK,KAAK,CAAC;eACrB,KAAK,QAAQ;iBACX,KAAK,SAAS;oBACX,OAAO,KAAK,YAAY,CAAC;cAC/B,OAAO,KAAK,MAAM,CAAC;oBACb,OAAO,KAAK,YAAY,CAAC;eAC9B,OAAO,KAAK,OAAO,CAAC;eACpB,KAAK,OAAO,KAAK,UAAU,IAAI,aAAa,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;aACpE,KAAK,KAAK,KAAK,QAAQ,IAAI,aAAa,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;+BAC1C,gBAAgB,KAAK,UAAU,CAAC;;eAEhD,UAAU;;EAEvB,SAAS,KAAK,aAAa,wBAAwB,aAAa,KAAK,WAAW,CAAC,IAAI,KAAK,gBAAgB,aAAa,KAAK,kBAAkB,GAAG,KAAK,cAAc,MAAM,GAAG;EAC7K,SAAS,kBAAkB,OAAO,KAAK,eAAe,KAAK,YAAY,CAAC;;;kBAGxD,WAAW;6BACA,QAAQ;;;;AAKrC,SAAS,gBAAgB,MAAsC;AAW7D,QAAO,cATL,KAAK,UAAU,YAAY,OACvB,SACA,OAAO,KAAK,UAAU,YAAY,WAChC,OAAO,KAAK,UAAU,QAAQ,GAC9B,SAEN,OAAO,KAAK,UAAU,qBAAqB,WACvC,uBAAuB,KAAK,UAAU,qBACtC,GAC6B;;AAGrC,SAAS,aAAa,MAAsC;AAG1D,QAAO,GAFW,oBAAoB,KAAK,WAAW,QAC/B,2BAA2B,KAAK,mBAAmB;;AAI5E,SAAS,eAAe,MAAsC;CAC5D,MAAMA,UAAoB,EAAE;AAC5B,KAAI,KAAK,eACP,SAAQ,KAAK,wBAAwB,OAAO,KAAK,eAAe,CAAC,GAAG;AAEtE,KAAI,OAAO,KAAK,cAAc,SAC5B,SAAQ,KAAK,kBAAkB,KAAK,YAAY;AAElD,KAAI,KAAK,oBACP,SAAQ,KACN,6BAA6B,OAAO,KAAK,oBAAoB,CAAC,GAC/D;AAEH,KAAI,QAAQ,WAAW,EACrB,QAAO;AAET,QAAO,kBAAkB,QAAQ,KAAK,MAAM,CAAC;;AAG/C,SAAS,gBAAgB,WAA8B;AACrD,SAAQ,WAAR;EACE,KAAK,OACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,aACH,QAAO;EACT,KAAK;EACL,QACE,QAAO;;;AAIb,SAAS,OAAO,OAAuB;AACrC,QAAO,MAAM,QAAQ,MAAM,MAAM,CAAC,QAAQ,MAAM,MAAM"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationSpecData } from "../types/spec-types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/migration.d.ts
|
|
4
|
+
declare function generateMigrationSpec(data: MigrationSpecData): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { generateMigrationSpec };
|
|
7
|
+
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.ts","names":[],"sources":["../../src/templates/migration.ts"],"sourcesContent":[],"mappings":";;;iBAGgB,qBAAA,OAA4B"}
|
|
@@ -1,37 +1,61 @@
|
|
|
1
|
-
import{escapeString
|
|
1
|
+
import { escapeString, toPascalCase } from "./utils.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
//#region src/templates/migration.ts
|
|
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
|
-
|
|
6
|
-
version: ${
|
|
7
|
-
title: '${
|
|
8
|
-
description: '${
|
|
9
|
-
domain: '${
|
|
10
|
-
owners: [${
|
|
11
|
-
tags: [${
|
|
12
|
-
stability: '${
|
|
11
|
+
key: '${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 };
|
|
61
|
+
//# sourceMappingURL=migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.js","names":[],"sources":["../../src/templates/migration.ts"],"sourcesContent":["import type { MigrationSpecData } from '../types/spec-types';\nimport { toPascalCase, escapeString } from './utils';\n\nexport function generateMigrationSpec(data: MigrationSpecData): string {\n const specName = toPascalCase(data.name.split('.').pop() ?? 'Migration');\n const migrationVar = `${specName}Migration`;\n\n const dependencies =\n data.dependencies.length > 0\n ? `dependencies: [${data.dependencies\n .map((dep) => `'${escapeString(dep)}'`)\n .join(', ')}],`\n : '';\n\n return `import type { MigrationSpec } from '@lssm/lib.contracts/migrations';\n\nexport const ${migrationVar}: MigrationSpec = {\n meta: {\n key: '${escapeString(data.name)}',\n version: ${data.version},\n title: '${escape(data.title)}',\n description: '${escape(data.description ?? '')}',\n domain: '${escape(data.domain)}',\n owners: [${data.owners.map((owner) => `'${escapeString(owner)}'`).join(', ')}],\n tags: [${data.tags.map((tag) => `'${escapeString(tag)}'`).join(', ')}],\n stability: '${data.stability}',\n },\n plan: {\n up: [\n${renderSteps(data.up)}\n ],${\n data.down && data.down.length\n ? `\n down: [\n${renderSteps(data.down)}\n ],`\n : ''\n }\n },\n ${dependencies}\n};\n`;\n}\n\nfunction renderSteps(steps: MigrationSpecData['up']) {\n return steps\n .map((step) => {\n const description = step.description\n ? `description: '${escape(step.description)}',`\n : '';\n switch (step.kind) {\n case 'schema':\n return ` {\n kind: 'schema',\n ${description}\n sql: \\`${escape(step.sql ?? '')}\\`,\n }`;\n case 'data':\n return ` {\n kind: 'data',\n ${description}\n script: \\`${escape(step.script ?? '')}\\`,\n }`;\n case 'validation':\n default:\n return ` {\n kind: 'validation',\n ${description}\n assertion: \\`${escape(step.assertion ?? '')}\\`,\n }`;\n }\n })\n .join(',\\n');\n}\n\nfunction escape(value: string): string {\n return value.replace(/`/g, '\\\\`').replace(/'/g, \"\\\\'\");\n}\n"],"mappings":";;;AAGA,SAAgB,sBAAsB,MAAiC;CAErE,MAAM,eAAe,GADJ,aAAa,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,YAAY,CACvC;CAEjC,MAAM,eACJ,KAAK,aAAa,SAAS,IACvB,kBAAkB,KAAK,aACpB,KAAK,QAAQ,IAAI,aAAa,IAAI,CAAC,GAAG,CACtC,KAAK,KAAK,CAAC,MACd;AAEN,QAAO;;eAEM,aAAa;;YAEhB,aAAa,KAAK,KAAK,CAAC;eACrB,KAAK,QAAQ;cACd,OAAO,KAAK,MAAM,CAAC;oBACb,OAAO,KAAK,eAAe,GAAG,CAAC;eACpC,OAAO,KAAK,OAAO,CAAC;eACpB,KAAK,OAAO,KAAK,UAAU,IAAI,aAAa,MAAM,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;aACpE,KAAK,KAAK,KAAK,QAAQ,IAAI,aAAa,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;kBACvD,KAAK,UAAU;;;;EAI/B,YAAY,KAAK,GAAG,CAAC;QAEjB,KAAK,QAAQ,KAAK,KAAK,SACnB;;EAER,YAAY,KAAK,KAAK,CAAC;UAEf,GACL;;IAED,aAAa;;;;AAKjB,SAAS,YAAY,OAAgC;AACnD,QAAO,MACJ,KAAK,SAAS;EACb,MAAM,cAAc,KAAK,cACrB,iBAAiB,OAAO,KAAK,YAAY,CAAC,MAC1C;AACJ,UAAQ,KAAK,MAAb;GACE,KAAK,SACH,QAAO;;UAEP,YAAY;iBACL,OAAO,KAAK,OAAO,GAAG,CAAC;;GAEhC,KAAK,OACH,QAAO;;UAEP,YAAY;oBACF,OAAO,KAAK,UAAU,GAAG,CAAC;;GAEtC,KAAK;GACL,QACE,QAAO;;UAEP,YAAY;uBACC,OAAO,KAAK,aAAa,GAAG,CAAC;;;GAG9C,CACD,KAAK,MAAM;;AAGhB,SAAS,OAAO,OAAuB;AACrC,QAAO,MAAM,QAAQ,MAAM,MAAM,CAAC,QAAQ,MAAM,MAAM"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OperationSpecData } from "../types/spec-types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/operation.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generate operation spec TypeScript code.
|
|
7
|
+
*/
|
|
8
|
+
declare function generateOperationSpec(data: OperationSpecData): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { generateOperationSpec };
|
|
11
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","names":[],"sources":["../../src/templates/operation.ts"],"sourcesContent":[],"mappings":";;;;;;;iBAWgB,qBAAA,OAA4B"}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import{capitalize
|
|
1
|
+
import { capitalize, toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/operation.ts
|
|
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
|
-
|
|
27
|
-
version: ${
|
|
28
|
-
stability: '${
|
|
29
|
-
owners: [${
|
|
30
|
-
tags: [${
|
|
31
|
-
description: '${
|
|
32
|
-
goal: '${
|
|
33
|
-
context: '${
|
|
37
|
+
key: '${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,9 @@ export const ${m} = define${e(a)}({
|
|
|
85
93
|
],
|
|
86
94
|
},
|
|
87
95
|
});
|
|
88
|
-
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { generateOperationSpec };
|
|
101
|
+
//# sourceMappingURL=operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","names":[],"sources":["../../src/templates/operation.ts"],"sourcesContent":["/**\n * Operation spec template generation.\n * Extracted from cli-contractspec/src/templates/operation.template.ts\n */\n\nimport type { OperationSpecData } from '../types/spec-types';\nimport { toPascalCase, capitalize } from './utils';\n\n/**\n * Generate operation spec TypeScript code.\n */\nexport function generateOperationSpec(data: OperationSpecData): string {\n const {\n name,\n version,\n kind,\n description,\n goal,\n context,\n stability,\n owners,\n tags,\n auth,\n flags,\n } = data;\n\n const specVarName = toPascalCase(name.split('.').pop() ?? 'Unknown') + 'Spec';\n const inputSchemaName = specVarName.replace('Spec', 'Input');\n const outputSchemaName = specVarName.replace('Spec', 'Output');\n\n return `import { define${capitalize(kind)} } from '@lssm/lib.contracts';\nimport { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';\n\n// TODO: Define input schema\nexport const ${inputSchemaName} = new SchemaModel({\n name: '${inputSchemaName}',\n description: 'Input for ${name}',\n fields: {\n // Add your fields here\n // example: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\n// TODO: Define output schema\nexport const ${outputSchemaName} = new SchemaModel({\n name: '${outputSchemaName}',\n description: 'Output for ${name}',\n fields: {\n // Add your fields here\n ok: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n },\n});\n\nexport const ${specVarName} = define${capitalize(kind)}({\n meta: {\n key: '${name}',\n version: ${version},\n stability: '${stability}',\n owners: [${owners.map((o) => `'${o}'`).join(', ')}],\n tags: [${tags.map((t) => `'${t}'`).join(', ')}],\n description: '${description}',\n goal: '${goal}',\n context: '${context}',\n },\n\n io: {\n input: ${inputSchemaName},\n output: ${outputSchemaName},\n errors: {\n // Define possible errors\n // EXAMPLE_ERROR: {\n // description: 'Example error description',\n // http: 400,\n // when: 'When this error occurs',\n // },\n },\n },\n\n policy: {\n auth: '${auth}',\n ${flags.length > 0 ? `flags: [${flags.map((f) => `'${f}'`).join(', ')}],` : '// flags: [],'}\n },\n\n sideEffects: {\n ${data.emitsEvents ? \"emits: [\\n // Define events to emit\\n // { ref: SomeEventSpec, when: 'always' }\\n ],\" : '// emits: [],'}\n analytics: [\n // Define analytics events\n ],\n },\n\n transport: {\n rest: { method: '${kind === 'command' ? 'POST' : 'GET'}' },\n gql: { field: '${name.replace(/\\./g, '_')}' },\n mcp: { toolName: '${name}.v${version}' },\n },\n\n acceptance: {\n scenarios: [\n {\n name: 'Happy path',\n given: ['preconditions'],\n when: ['action taken'],\n then: ['expected outcome'],\n },\n ],\n examples: [\n {\n name: 'Example usage',\n input: { /* example input */ },\n output: { ok: true },\n },\n ],\n },\n});\n`;\n}\n"],"mappings":";;;;;;AAWA,SAAgB,sBAAsB,MAAiC;CACrE,MAAM,EACJ,MACA,SACA,MACA,aACA,MACA,SACA,WACA,QACA,MACA,MACA,UACE;CAEJ,MAAM,cAAc,aAAa,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,UAAU,GAAG;CACvE,MAAM,kBAAkB,YAAY,QAAQ,QAAQ,QAAQ;CAC5D,MAAM,mBAAmB,YAAY,QAAQ,QAAQ,SAAS;AAE9D,QAAO,kBAAkB,WAAW,KAAK,CAAC;;;;eAI7B,gBAAgB;WACpB,gBAAgB;4BACC,KAAK;;;;;;;;eAQlB,iBAAiB;WACrB,iBAAiB;6BACC,KAAK;;;;;;;eAOnB,YAAY,WAAW,WAAW,KAAK,CAAC;;YAE3C,KAAK;eACF,QAAQ;kBACL,UAAU;eACb,OAAO,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;aACzC,KAAK,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;oBAC9B,YAAY;aACnB,KAAK;gBACF,QAAQ;;;;aAIX,gBAAgB;cACf,iBAAiB;;;;;;;;;;;;aAYlB,KAAK;MACZ,MAAM,SAAS,IAAI,WAAW,MAAM,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC,MAAM,gBAAgB;;;;MAI1F,KAAK,cAAc,sGAAsG,gBAAgB;;;;;;;uBAOxH,SAAS,YAAY,SAAS,MAAM;qBACtC,KAAK,QAAQ,OAAO,IAAI,CAAC;wBACtB,KAAK,IAAI,QAAQ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PresentationSpecData } from "../types/spec-types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/presentation.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generate presentation spec TypeScript code.
|
|
7
|
+
*/
|
|
8
|
+
declare function generatePresentationSpec(data: PresentationSpecData): string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { generatePresentationSpec };
|
|
11
|
+
//# sourceMappingURL=presentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","names":[],"sources":["../../src/templates/presentation.ts"],"sourcesContent":[],"mappings":";;;;;;;iBAWgB,wBAAA,OAA+B"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import{toPascalCase
|
|
1
|
+
import { toPascalCase } from "./utils.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/presentation.ts
|
|
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{toPascalCase as e}from"./utils.js";function t(t){let{name:n,version:r,des
|
|
|
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
|
-
|
|
39
|
-
version: ${
|
|
40
|
-
stability: '${
|
|
41
|
-
owners: [${
|
|
42
|
-
tags: [${
|
|
43
|
-
description: '${
|
|
59
|
+
key: '${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,11 @@ 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 };
|
|
79
|
+
//# sourceMappingURL=presentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.js","names":[],"sources":["../../src/templates/presentation.ts"],"sourcesContent":["/**\n * Presentation spec template generation.\n * Extracted from cli-contractspec/src/templates/presentation.template.ts\n */\n\nimport type { PresentationSpecData } from '../types/spec-types';\nimport { toPascalCase } from './utils';\n\n/**\n * Generate presentation spec TypeScript code.\n */\nexport function generatePresentationSpec(data: PresentationSpecData): string {\n const {\n name,\n version,\n description,\n stability,\n owners,\n tags,\n presentationKind,\n } = data;\n\n const varName = toPascalCase(name.replace(/\\./g, '_')) + 'Presentation';\n\n let contentBlock = '';\n\n switch (presentationKind) {\n case 'web_component':\n contentBlock = ` content: {\n kind: 'web_component',\n framework: 'react',\n componentKey: '${name.replace(/\\./g, '_')}',\n props: new SchemaModel({\n name: '${varName}Props',\n description: 'Props for ${name}',\n fields: {\n // TODO: Define component props\n },\n }),\n analytics: [\n // TODO: Define analytics events\n ],\n },`;\n break;\n\n case 'markdown':\n contentBlock = ` content: {\n kind: 'markdown',\n content: \\`\n# ${description}\n\nTODO: Add markdown content here\n \\`,\n // Or use resourceUri: 'feature://${name}/guide.md'\n },`;\n break;\n\n case 'data':\n contentBlock = ` content: {\n kind: 'data',\n mimeType: 'application/json',\n model: new SchemaModel({\n name: '${varName}Data',\n description: 'Data structure for ${name}',\n fields: {\n // TODO: Define data structure\n },\n }),\n },`;\n break;\n }\n\n return `import type { PresentationSpec } from '@lssm/lib.contracts/presentations';\nimport { SchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';\n\nexport const ${varName}: PresentationSpec = {\n meta: {\n key: '${name}',\n version: ${version},\n stability: '${stability}',\n owners: [${owners.map((o) => `'${o}'`).join(', ')}],\n tags: [${tags.map((t) => `'${t}'`).join(', ')}],\n description: '${description}',\n },\n \n policy: {\n // flags: [],\n // pii: [],\n },\n \n${contentBlock}\n};\n`;\n}\n"],"mappings":";;;;;;AAWA,SAAgB,yBAAyB,MAAoC;CAC3E,MAAM,EACJ,MACA,SACA,aACA,WACA,QACA,MACA,qBACE;CAEJ,MAAM,UAAU,aAAa,KAAK,QAAQ,OAAO,IAAI,CAAC,GAAG;CAEzD,IAAI,eAAe;AAEnB,SAAQ,kBAAR;EACE,KAAK;AACH,kBAAe;;;qBAGA,KAAK,QAAQ,OAAO,IAAI,CAAC;;eAE/B,QAAQ;gCACS,KAAK;;;;;;;;;AAS/B;EAEF,KAAK;AACH,kBAAe;;;IAGjB,YAAY;;;;wCAIwB,KAAK;;AAEvC;EAEF,KAAK;AACH,kBAAe;;;;eAIN,QAAQ;yCACkB,KAAK;;;;;;AAMxC;;AAGJ,QAAO;;;eAGM,QAAQ;;YAEX,KAAK;eACF,QAAQ;kBACL,UAAU;eACb,OAAO,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;aACzC,KAAK,KAAK,MAAM,IAAI,EAAE,GAAG,CAAC,KAAK,KAAK,CAAC;oBAC9B,YAAY;;;;;;;;EAQ9B,aAAa"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TelemetrySpecData } from "../types/spec-types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/templates/telemetry.d.ts
|
|
4
|
+
declare function generateTelemetrySpec(data: TelemetrySpecData): string;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { generateTelemetrySpec };
|
|
7
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","names":[],"sources":["../../src/templates/telemetry.ts"],"sourcesContent":[],"mappings":";;;iBAGgB,qBAAA,OAA4B"}
|