@lssm/lib.contracts-transformers 0.0.0-canary-20251221114240 → 0.0.0-canary-20251221132705
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/common/types.d.ts +2 -0
- package/dist/common/types.d.ts.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +10 -2
- package/dist/openapi/exporter/data-views.d.ts +38 -0
- package/dist/openapi/exporter/data-views.d.ts.map +1 -0
- package/dist/openapi/exporter/data-views.js +47 -0
- package/dist/openapi/exporter/data-views.js.map +1 -0
- package/dist/openapi/exporter/events.d.ts +28 -0
- package/dist/openapi/exporter/events.d.ts.map +1 -0
- package/dist/openapi/exporter/events.js +39 -0
- package/dist/openapi/exporter/events.js.map +1 -0
- package/dist/openapi/exporter/features.d.ts +37 -0
- package/dist/openapi/exporter/features.d.ts.map +1 -0
- package/dist/openapi/exporter/features.js +46 -0
- package/dist/openapi/exporter/features.js.map +1 -0
- package/dist/openapi/exporter/forms.d.ts +30 -0
- package/dist/openapi/exporter/forms.d.ts.map +1 -0
- package/dist/openapi/exporter/forms.js +49 -0
- package/dist/openapi/exporter/forms.js.map +1 -0
- package/dist/openapi/exporter/index.js +8 -0
- package/dist/openapi/exporter/operations.d.ts +65 -0
- package/dist/openapi/exporter/operations.d.ts.map +1 -0
- package/dist/openapi/exporter/operations.js +142 -0
- package/dist/openapi/exporter/operations.js.map +1 -0
- package/dist/openapi/exporter/presentations.d.ts +48 -0
- package/dist/openapi/exporter/presentations.d.ts.map +1 -0
- package/dist/openapi/exporter/presentations.js +66 -0
- package/dist/openapi/exporter/presentations.js.map +1 -0
- package/dist/openapi/exporter/registries.d.ts +23 -0
- package/dist/openapi/exporter/registries.d.ts.map +1 -0
- package/dist/openapi/exporter/registries.js +29 -0
- package/dist/openapi/exporter/registries.js.map +1 -0
- package/dist/openapi/exporter/workflows.d.ts +36 -0
- package/dist/openapi/exporter/workflows.d.ts.map +1 -0
- package/dist/openapi/exporter/workflows.js +54 -0
- package/dist/openapi/exporter/workflows.js.map +1 -0
- package/dist/openapi/exporter.d.ts +29 -9
- package/dist/openapi/exporter.d.ts.map +1 -1
- package/dist/openapi/exporter.js +76 -102
- package/dist/openapi/exporter.js.map +1 -1
- package/dist/openapi/importer/grouping.js +73 -0
- package/dist/openapi/importer/grouping.js.map +1 -0
- package/dist/openapi/importer/index.d.ts.map +1 -1
- package/dist/openapi/importer/index.js +7 -0
- package/dist/openapi/importer/index.js.map +1 -1
- package/dist/openapi/index.d.ts +10 -2
- package/dist/openapi/index.js +11 -2
- package/dist/openapi/schema-converter.d.ts.map +1 -1
- package/dist/openapi/schema-converter.js.map +1 -1
- package/dist/openapi/types.d.ts +62 -1
- package/dist/openapi/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/common/types.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ interface ImportedOperationSpec {
|
|
|
51
51
|
code: string;
|
|
52
52
|
/** Suggested file name for the spec */
|
|
53
53
|
fileName: string;
|
|
54
|
+
/** Group folder for organizing the file (based on grouping config) */
|
|
55
|
+
groupFolder?: string;
|
|
54
56
|
/** Source information for provenance tracking */
|
|
55
57
|
source: SpecSource;
|
|
56
58
|
/** Transport hints for accurate round-trips */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/common/types.ts"],"sourcesContent":[],"mappings":";;;;AA0BA;AAoBA;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/common/types.ts"],"sourcesContent":[],"mappings":";;;;AA0BA;AAoBA;;AAcU,UAnDO,UAAA,CAmDP;EAEQ;EAAc,IAAA,EAAA,SAAA,GAAA,UAAA,GAAA,SAAA,GAAA,UAAA;EAMf;EAyBL,GAAA,CAAA,EAAA,MAAA;EAUK;EAgBA,IAAA,CAAA,EAAA,MAAQ;EAIZ;EAED,QAAA,EAAA,MAAA;EAED;EAAU,UAAA,EA5GP,IA4GO;AAUrB;;;;;AAWqB,UA1HJ,cAAA,CA0HI;EAaJ,IAAA,CAAA,EAAA;;;;;;;;;;;;;;;;;;UAnHA,qBAAA;;;;;;kBAMC;;;;;;;;UAQR;;kBAEQ;;;;;UAMD,YAAA;;kBAEC;;;;;;;;;;;;;;;;;;;;;;KAuBN,cAAA;;;;UAUK,UAAA;;;;QAIT;;;;;;;;;;;UAYS,QAAA;;;;aAIJ;;YAED;;WAED;;;;;;;;;UAUM,UAAA;;SAER;;;UAGC;aACG;;;;;aAKA;;;;;;;;;;;;UAaI,gBAAA;;;;SAIR"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,16 @@ import { deepEqual, extractPathParams, getByPath, normalizePath, toCamelCase, to
|
|
|
3
3
|
import { ContractSpecOpenApiDocument, HttpMethod, OpenApiDocument, OpenApiExportOptions, OpenApiOperation, OpenApiParameter, OpenApiParseOptions, OpenApiSchema, OpenApiServer, OpenApiSource, OpenApiTransportHints, OpenApiVersion, ParameterLocation, ParseResult, ParsedOperation, ParsedParameter } from "./openapi/types.js";
|
|
4
4
|
import { detectFormat, detectVersion, parseOpenApiString } from "./openapi/parser/utils.js";
|
|
5
5
|
import { parseOpenApi, parseOpenApiDocument } from "./openapi/parser/document.js";
|
|
6
|
-
import { defaultRestPath,
|
|
6
|
+
import { OperationsExportResult, defaultRestPath, exportOperations, generateOperationsRegistry, jsonSchemaForSpec, schemaModelToJsonSchema, toHttpMethod, toOperationId, toRestPath, toSchemaName } from "./openapi/exporter/operations.js";
|
|
7
|
+
import { ContractSpecRegistries, contractSpecToJson, contractSpecToYaml, exportContractSpec, openApiForRegistry, openApiToJson, openApiToYaml } from "./openapi/exporter.js";
|
|
8
|
+
import { ExportedEvent, exportEvents, generateEventsExports } from "./openapi/exporter/events.js";
|
|
9
|
+
import { ExportedFeature, exportFeatures, generateFeaturesRegistry } from "./openapi/exporter/features.js";
|
|
10
|
+
import { ExportedPresentation, ExportedPresentationV2, exportPresentations, exportPresentationsV1, exportPresentationsV2, generatePresentationsRegistry } from "./openapi/exporter/presentations.js";
|
|
11
|
+
import { ExportedForm, exportForms, generateFormsRegistry } from "./openapi/exporter/forms.js";
|
|
12
|
+
import { ExportedDataView, exportDataViews, generateDataViewsRegistry } from "./openapi/exporter/data-views.js";
|
|
13
|
+
import { ExportedWorkflow, exportWorkflows, generateWorkflowsRegistry } from "./openapi/exporter/workflows.js";
|
|
14
|
+
import { RegistryGenerationOptions, generateRegistryIndex } from "./openapi/exporter/registries.js";
|
|
7
15
|
import { GeneratedModel, SchemaField, TypescriptType, generateImports, generateSchemaModelCode, getScalarType, jsonSchemaToField, jsonSchemaToType } from "./openapi/schema-converter.js";
|
|
8
16
|
import { importFromOpenApi, importOperation } from "./openapi/importer/index.js";
|
|
9
17
|
import { DiffOptions, createSpecDiff, diffAll, diffSpecVsOperation, diffSpecs, formatDiffChanges } from "./openapi/differ.js";
|
|
10
|
-
export { ContractSpecOpenApiDocument, DiffChange, DiffChangeType, DiffOptions, GeneratedModel, HttpMethod, ImportResult, ImportedOperationSpec, OpenApiDocument, OpenApiExportOptions, OpenApiOperation, OpenApiParameter, OpenApiParseOptions, OpenApiSchema, OpenApiServer, OpenApiSource, OpenApiTransportHints, OpenApiVersion, ParameterLocation, ParseResult, ParsedOperation, ParsedParameter, SchemaField, SpecDiff, SpecSource, SyncResult, TransportHints, TypescriptType, ValidationResult, createSpecDiff, deepEqual, defaultRestPath, detectFormat, detectVersion, diffAll, diffSpecVsOperation, diffSpecs, extractPathParams, formatDiffChanges, generateImports, generateSchemaModelCode, getByPath, getScalarType, importFromOpenApi, importOperation, jsonSchemaToField, jsonSchemaToType, normalizePath, openApiForRegistry, openApiToJson, openApiToYaml, parseOpenApi, parseOpenApiDocument, parseOpenApiString, toCamelCase, toFileName, toKebabCase, toPascalCase, toSnakeCase, toSpecName, toValidIdentifier };
|
|
18
|
+
export { ContractSpecOpenApiDocument, ContractSpecRegistries, DiffChange, DiffChangeType, DiffOptions, ExportedDataView, ExportedEvent, ExportedFeature, ExportedForm, ExportedPresentation, ExportedPresentationV2, ExportedWorkflow, GeneratedModel, HttpMethod, ImportResult, ImportedOperationSpec, OpenApiDocument, OpenApiExportOptions, OpenApiOperation, OpenApiParameter, OpenApiParseOptions, OpenApiSchema, OpenApiServer, OpenApiSource, OpenApiTransportHints, OpenApiVersion, OperationsExportResult, ParameterLocation, ParseResult, ParsedOperation, ParsedParameter, RegistryGenerationOptions, SchemaField, SpecDiff, SpecSource, SyncResult, TransportHints, TypescriptType, ValidationResult, contractSpecToJson, contractSpecToYaml, createSpecDiff, deepEqual, defaultRestPath, detectFormat, detectVersion, diffAll, diffSpecVsOperation, diffSpecs, exportContractSpec, exportDataViews, exportEvents, exportFeatures, exportForms, exportOperations, exportPresentations, exportPresentationsV1, exportPresentationsV2, exportWorkflows, extractPathParams, formatDiffChanges, generateDataViewsRegistry, generateEventsExports, generateFeaturesRegistry, generateFormsRegistry, generateImports, generateOperationsRegistry, generatePresentationsRegistry, generateRegistryIndex, generateSchemaModelCode, generateWorkflowsRegistry, getByPath, getScalarType, importFromOpenApi, importOperation, jsonSchemaForSpec, jsonSchemaToField, jsonSchemaToType, normalizePath, openApiForRegistry, openApiToJson, openApiToYaml, parseOpenApi, parseOpenApiDocument, parseOpenApiString, schemaModelToJsonSchema, toCamelCase, toFileName, toHttpMethod, toKebabCase, toOperationId, toPascalCase, toRestPath, toSchemaName, toSnakeCase, toSpecName, toValidIdentifier };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { detectFormat, detectVersion, parseOpenApiString } from "./openapi/parser/utils.js";
|
|
2
2
|
import { parseOpenApi, parseOpenApiDocument } from "./openapi/parser/document.js";
|
|
3
|
-
import { defaultRestPath,
|
|
3
|
+
import { defaultRestPath, exportOperations, generateOperationsRegistry, jsonSchemaForSpec, schemaModelToJsonSchema, toHttpMethod, toOperationId, toRestPath, toSchemaName } from "./openapi/exporter/operations.js";
|
|
4
|
+
import { exportEvents, generateEventsExports } from "./openapi/exporter/events.js";
|
|
5
|
+
import { exportFeatures, generateFeaturesRegistry } from "./openapi/exporter/features.js";
|
|
6
|
+
import { exportPresentations, exportPresentationsV1, exportPresentationsV2, generatePresentationsRegistry } from "./openapi/exporter/presentations.js";
|
|
7
|
+
import { exportForms, generateFormsRegistry } from "./openapi/exporter/forms.js";
|
|
8
|
+
import { exportDataViews, generateDataViewsRegistry } from "./openapi/exporter/data-views.js";
|
|
9
|
+
import { exportWorkflows, generateWorkflowsRegistry } from "./openapi/exporter/workflows.js";
|
|
10
|
+
import { generateRegistryIndex } from "./openapi/exporter/registries.js";
|
|
11
|
+
import { contractSpecToJson, contractSpecToYaml, exportContractSpec, openApiForRegistry, openApiToJson, openApiToYaml } from "./openapi/exporter.js";
|
|
4
12
|
import { deepEqual, extractPathParams, getByPath, normalizePath, toCamelCase, toFileName, toKebabCase, toPascalCase, toSnakeCase, toSpecName, toValidIdentifier } from "./common/utils.js";
|
|
5
13
|
import { generateImports, generateSchemaModelCode, getScalarType, jsonSchemaToField, jsonSchemaToType } from "./openapi/schema-converter.js";
|
|
6
14
|
import { importFromOpenApi, importOperation } from "./openapi/importer/index.js";
|
|
7
15
|
import { createSpecDiff, diffAll, diffSpecVsOperation, diffSpecs, formatDiffChanges } from "./openapi/differ.js";
|
|
8
16
|
import "./openapi/index.js";
|
|
9
17
|
|
|
10
|
-
export { createSpecDiff, deepEqual, defaultRestPath, detectFormat, detectVersion, diffAll, diffSpecVsOperation, diffSpecs, extractPathParams, formatDiffChanges, generateImports, generateSchemaModelCode, getByPath, getScalarType, importFromOpenApi, importOperation, jsonSchemaToField, jsonSchemaToType, normalizePath, openApiForRegistry, openApiToJson, openApiToYaml, parseOpenApi, parseOpenApiDocument, parseOpenApiString, toCamelCase, toFileName, toKebabCase, toPascalCase, toSnakeCase, toSpecName, toValidIdentifier };
|
|
18
|
+
export { contractSpecToJson, contractSpecToYaml, createSpecDiff, deepEqual, defaultRestPath, detectFormat, detectVersion, diffAll, diffSpecVsOperation, diffSpecs, exportContractSpec, exportDataViews, exportEvents, exportFeatures, exportForms, exportOperations, exportPresentations, exportPresentationsV1, exportPresentationsV2, exportWorkflows, extractPathParams, formatDiffChanges, generateDataViewsRegistry, generateEventsExports, generateFeaturesRegistry, generateFormsRegistry, generateImports, generateOperationsRegistry, generatePresentationsRegistry, generateRegistryIndex, generateSchemaModelCode, generateWorkflowsRegistry, getByPath, getScalarType, importFromOpenApi, importOperation, jsonSchemaForSpec, jsonSchemaToField, jsonSchemaToType, normalizePath, openApiForRegistry, openApiToJson, openApiToYaml, parseOpenApi, parseOpenApiDocument, parseOpenApiString, schemaModelToJsonSchema, toCamelCase, toFileName, toHttpMethod, toKebabCase, toOperationId, toPascalCase, toRestPath, toSchemaName, toSnakeCase, toSpecName, toValidIdentifier };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GeneratedRegistryCode } from "../types.js";
|
|
2
|
+
import { DataViewRegistry } from "@lssm/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/openapi/exporter/data-views.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exported data view structure for OpenAPI extensions.
|
|
8
|
+
*/
|
|
9
|
+
interface ExportedDataView {
|
|
10
|
+
name: string;
|
|
11
|
+
version: number;
|
|
12
|
+
description?: string;
|
|
13
|
+
stability?: string;
|
|
14
|
+
entity: string;
|
|
15
|
+
kind: 'list' | 'detail' | 'table' | 'grid';
|
|
16
|
+
source: {
|
|
17
|
+
primary: {
|
|
18
|
+
name: string;
|
|
19
|
+
version: number;
|
|
20
|
+
};
|
|
21
|
+
item?: {
|
|
22
|
+
name: string;
|
|
23
|
+
version: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
fields: unknown[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Export data views to OpenAPI extension format.
|
|
30
|
+
*/
|
|
31
|
+
declare function exportDataViews(registry: DataViewRegistry): ExportedDataView[];
|
|
32
|
+
/**
|
|
33
|
+
* Generate TypeScript code for data views registry.
|
|
34
|
+
*/
|
|
35
|
+
declare function generateDataViewsRegistry(registry: DataViewRegistry): GeneratedRegistryCode;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ExportedDataView, exportDataViews, generateDataViewsRegistry };
|
|
38
|
+
//# sourceMappingURL=data-views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-views.d.ts","names":[],"sources":["../../../src/openapi/exporter/data-views.ts"],"sourcesContent":[],"mappings":";;;;;AA0BA;AAkBA;;UAnCiB,gBAAA;;;;;;;;;;;;;;;;;;;;;;iBAiBD,eAAA,WACJ,mBACT;;;;iBAgBa,yBAAA,WACJ,mBACT"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/openapi/exporter/data-views.ts
|
|
2
|
+
/**
|
|
3
|
+
* Export data views to OpenAPI extension format.
|
|
4
|
+
*/
|
|
5
|
+
function exportDataViews(registry) {
|
|
6
|
+
return registry.list().map((dv) => ({
|
|
7
|
+
name: dv.meta.name,
|
|
8
|
+
version: dv.meta.version,
|
|
9
|
+
description: dv.meta.description,
|
|
10
|
+
stability: dv.meta.stability,
|
|
11
|
+
entity: dv.meta.entity,
|
|
12
|
+
kind: dv.view.kind,
|
|
13
|
+
source: dv.source,
|
|
14
|
+
fields: dv.view.fields
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generate TypeScript code for data views registry.
|
|
19
|
+
*/
|
|
20
|
+
function generateDataViewsRegistry(registry) {
|
|
21
|
+
const dataViews = registry.list();
|
|
22
|
+
const imports = /* @__PURE__ */ new Set();
|
|
23
|
+
const registrations = [];
|
|
24
|
+
for (const dv of dataViews) {
|
|
25
|
+
const dvVarName = dv.meta.name.replace(/\./g, "_") + `_v${dv.meta.version}`;
|
|
26
|
+
imports.add(`import { ${dvVarName} } from './${dv.meta.name.split(".")[0]}';`);
|
|
27
|
+
registrations.push(` .register(${dvVarName})`);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
code: `/**
|
|
31
|
+
* Auto-generated data views registry.
|
|
32
|
+
* DO NOT EDIT - This file is generated by ContractSpec exporter.
|
|
33
|
+
*/
|
|
34
|
+
import { DataViewRegistry } from '@lssm/lib.contracts';
|
|
35
|
+
|
|
36
|
+
${Array.from(imports).join("\n")}
|
|
37
|
+
|
|
38
|
+
export const dataViewsRegistry = new DataViewRegistry()
|
|
39
|
+
${registrations.join("\n")};
|
|
40
|
+
`,
|
|
41
|
+
fileName: "dataviews-registry.ts"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { exportDataViews, generateDataViewsRegistry };
|
|
47
|
+
//# sourceMappingURL=data-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-views.js","names":["registrations: string[]"],"sources":["../../../src/openapi/exporter/data-views.ts"],"sourcesContent":["/**\n * Data views exporter - exports DataViewSpec to OpenAPI extensions.\n */\nimport type { DataViewRegistry, DataViewSpec } from '@lssm/lib.contracts';\nimport type { GeneratedRegistryCode } from '../types';\n\n/**\n * Exported data view structure for OpenAPI extensions.\n */\nexport interface ExportedDataView {\n name: string;\n version: number;\n description?: string;\n stability?: string;\n entity: string;\n kind: 'list' | 'detail' | 'table' | 'grid';\n source: {\n primary: { name: string; version: number };\n item?: { name: string; version: number };\n };\n fields: unknown[];\n}\n\n/**\n * Export data views to OpenAPI extension format.\n */\nexport function exportDataViews(\n registry: DataViewRegistry\n): ExportedDataView[] {\n return registry.list().map((dv) => ({\n name: dv.meta.name,\n version: dv.meta.version,\n description: dv.meta.description,\n stability: dv.meta.stability,\n entity: dv.meta.entity,\n kind: dv.view.kind,\n source: dv.source,\n fields: dv.view.fields,\n }));\n}\n\n/**\n * Generate TypeScript code for data views registry.\n */\nexport function generateDataViewsRegistry(\n registry: DataViewRegistry\n): GeneratedRegistryCode {\n const dataViews = registry.list();\n const imports = new Set<string>();\n const registrations: string[] = [];\n\n for (const dv of dataViews) {\n const dvVarName = dv.meta.name.replace(/\\./g, '_') + `_v${dv.meta.version}`;\n imports.add(\n `import { ${dvVarName} } from './${dv.meta.name.split('.')[0]}';`\n );\n registrations.push(` .register(${dvVarName})`);\n }\n\n const code = `/**\n * Auto-generated data views registry.\n * DO NOT EDIT - This file is generated by ContractSpec exporter.\n */\nimport { DataViewRegistry } from '@lssm/lib.contracts';\n\n${Array.from(imports).join('\\n')}\n\nexport const dataViewsRegistry = new DataViewRegistry()\n${registrations.join('\\n')};\n`;\n\n return {\n code,\n fileName: 'dataviews-registry.ts',\n };\n}\n"],"mappings":";;;;AA0BA,SAAgB,gBACd,UACoB;AACpB,QAAO,SAAS,MAAM,CAAC,KAAK,QAAQ;EAClC,MAAM,GAAG,KAAK;EACd,SAAS,GAAG,KAAK;EACjB,aAAa,GAAG,KAAK;EACrB,WAAW,GAAG,KAAK;EACnB,QAAQ,GAAG,KAAK;EAChB,MAAM,GAAG,KAAK;EACd,QAAQ,GAAG;EACX,QAAQ,GAAG,KAAK;EACjB,EAAE;;;;;AAML,SAAgB,0BACd,UACuB;CACvB,MAAM,YAAY,SAAS,MAAM;CACjC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAMA,gBAA0B,EAAE;AAElC,MAAK,MAAM,MAAM,WAAW;EAC1B,MAAM,YAAY,GAAG,KAAK,KAAK,QAAQ,OAAO,IAAI,GAAG,KAAK,GAAG,KAAK;AAClE,UAAQ,IACN,YAAY,UAAU,aAAa,GAAG,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,IAC/D;AACD,gBAAc,KAAK,eAAe,UAAU,GAAG;;AAejD,QAAO;EACL,MAbW;;;;;;EAMb,MAAM,KAAK,QAAQ,CAAC,KAAK,KAAK,CAAC;;;EAG/B,cAAc,KAAK,KAAK,CAAC;;EAKvB,UAAU;EACX"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GeneratedRegistryCode } from "../types.js";
|
|
2
|
+
import { EventSpec } from "@lssm/lib.contracts";
|
|
3
|
+
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
4
|
+
|
|
5
|
+
//#region src/openapi/exporter/events.d.ts
|
|
6
|
+
|
|
7
|
+
type OpenApiSchemaObject = Record<string, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* Exported event structure for OpenAPI extensions.
|
|
10
|
+
*/
|
|
11
|
+
interface ExportedEvent {
|
|
12
|
+
name: string;
|
|
13
|
+
version: number;
|
|
14
|
+
description?: string;
|
|
15
|
+
payload: OpenApiSchemaObject | null;
|
|
16
|
+
pii?: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Export events to OpenAPI extension format.
|
|
20
|
+
*/
|
|
21
|
+
declare function exportEvents(events: EventSpec<AnySchemaModel>[]): ExportedEvent[];
|
|
22
|
+
/**
|
|
23
|
+
* Generate TypeScript code for events exports.
|
|
24
|
+
*/
|
|
25
|
+
declare function generateEventsExports(events: EventSpec<AnySchemaModel>[]): GeneratedRegistryCode;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ExportedEvent, exportEvents, generateEventsExports };
|
|
28
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../../../src/openapi/exporter/events.ts"],"sourcesContent":[],"mappings":";;;;;;AAaA,KALK,mBAAA,GAAsB,MAShB,CAAA,MAAA,EAAA,OAAA,CAAA;AAOX;;;AAEG,UAbc,aAAA,CAad;EAAa,IAAA,EAAA,MAAA;EAeA,OAAA,EAAA,MAAA;EACI,WAAA,CAAA,EAAA,MAAA;EAAV,OAAA,EAzBC,mBAyBD,GAAA,IAAA;EACP,GAAA,CAAA,EAAA,MAAA,EAAA;;;;;iBAnBa,YAAA,SACN,UAAU,oBACjB;;;;iBAea,qBAAA,SACN,UAAU,oBACjB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/openapi/exporter/events.ts
|
|
4
|
+
/**
|
|
5
|
+
* Export events to OpenAPI extension format.
|
|
6
|
+
*/
|
|
7
|
+
function exportEvents(events) {
|
|
8
|
+
return events.map((event) => ({
|
|
9
|
+
name: event.name,
|
|
10
|
+
version: event.version,
|
|
11
|
+
description: event.description,
|
|
12
|
+
payload: event.payload ? z.toJSONSchema(event.payload.getZod()) : null,
|
|
13
|
+
pii: event.pii
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate TypeScript code for events exports.
|
|
18
|
+
*/
|
|
19
|
+
function generateEventsExports(events) {
|
|
20
|
+
const eventExports = [];
|
|
21
|
+
for (const event of events) {
|
|
22
|
+
const eventVarName = event.name.replace(/\./g, "_") + `_v${event.version}`;
|
|
23
|
+
eventExports.push(`export { ${eventVarName} } from './${event.name.split(".")[0]}';`);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
code: `/**
|
|
27
|
+
* Auto-generated events exports.
|
|
28
|
+
* DO NOT EDIT - This file is generated by ContractSpec exporter.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
${eventExports.join("\n")}
|
|
32
|
+
`,
|
|
33
|
+
fileName: "events-exports.ts"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { exportEvents, generateEventsExports };
|
|
39
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":["eventExports: string[]"],"sources":["../../../src/openapi/exporter/events.ts"],"sourcesContent":["/**\n * Events exporter - exports EventSpec to OpenAPI extensions.\n */\nimport type { EventSpec } from '@lssm/lib.contracts';\nimport type { AnySchemaModel } from '@lssm/lib.schema';\nimport { z } from 'zod';\nimport type { GeneratedRegistryCode } from '../types';\n\ntype OpenApiSchemaObject = Record<string, unknown>;\n\n/**\n * Exported event structure for OpenAPI extensions.\n */\nexport interface ExportedEvent {\n name: string;\n version: number;\n description?: string;\n payload: OpenApiSchemaObject | null;\n pii?: string[];\n}\n\n/**\n * Export events to OpenAPI extension format.\n */\nexport function exportEvents(\n events: EventSpec<AnySchemaModel>[]\n): ExportedEvent[] {\n return events.map((event) => ({\n name: event.name,\n version: event.version,\n description: event.description,\n payload: event.payload\n ? (z.toJSONSchema(event.payload.getZod()) as OpenApiSchemaObject)\n : null,\n pii: event.pii,\n }));\n}\n\n/**\n * Generate TypeScript code for events exports.\n */\nexport function generateEventsExports(\n events: EventSpec<AnySchemaModel>[]\n): GeneratedRegistryCode {\n const eventExports: string[] = [];\n\n for (const event of events) {\n const eventVarName = event.name.replace(/\\./g, '_') + `_v${event.version}`;\n eventExports.push(`export { ${eventVarName} } from './${event.name.split('.')[0]}';`);\n }\n\n const code = `/**\n * Auto-generated events exports.\n * DO NOT EDIT - This file is generated by ContractSpec exporter.\n */\n\n${eventExports.join('\\n')}\n`;\n\n return {\n code,\n fileName: 'events-exports.ts',\n };\n}\n"],"mappings":";;;;;;AAwBA,SAAgB,aACd,QACiB;AACjB,QAAO,OAAO,KAAK,WAAW;EAC5B,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,aAAa,MAAM;EACnB,SAAS,MAAM,UACV,EAAE,aAAa,MAAM,QAAQ,QAAQ,CAAC,GACvC;EACJ,KAAK,MAAM;EACZ,EAAE;;;;;AAML,SAAgB,sBACd,QACuB;CACvB,MAAMA,eAAyB,EAAE;AAEjC,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,eAAe,MAAM,KAAK,QAAQ,OAAO,IAAI,GAAG,KAAK,MAAM;AACjE,eAAa,KAAK,YAAY,aAAa,aAAa,MAAM,KAAK,MAAM,IAAI,CAAC,GAAG,IAAI;;AAWvF,QAAO;EACL,MATW;;;;;EAKb,aAAa,KAAK,KAAK,CAAC;;EAKtB,UAAU;EACX"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GeneratedRegistryCode } from "../types.js";
|
|
2
|
+
import { FeatureRegistry } from "@lssm/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/openapi/exporter/features.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Exported feature structure for OpenAPI extensions.
|
|
8
|
+
*/
|
|
9
|
+
interface ExportedFeature {
|
|
10
|
+
key: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
owners?: string[];
|
|
13
|
+
stability?: string;
|
|
14
|
+
operations?: {
|
|
15
|
+
name: string;
|
|
16
|
+
version: number;
|
|
17
|
+
}[];
|
|
18
|
+
events?: {
|
|
19
|
+
name: string;
|
|
20
|
+
version: number;
|
|
21
|
+
}[];
|
|
22
|
+
presentations?: {
|
|
23
|
+
name: string;
|
|
24
|
+
version: number;
|
|
25
|
+
}[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Export features to OpenAPI extension format.
|
|
29
|
+
*/
|
|
30
|
+
declare function exportFeatures(registry: FeatureRegistry): ExportedFeature[];
|
|
31
|
+
/**
|
|
32
|
+
* Generate TypeScript code for features registry.
|
|
33
|
+
*/
|
|
34
|
+
declare function generateFeaturesRegistry(registry: FeatureRegistry): GeneratedRegistryCode;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ExportedFeature, exportFeatures, generateFeaturesRegistry };
|
|
37
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.d.ts","names":[],"sources":["../../../src/openapi/exporter/features.ts"],"sourcesContent":[],"mappings":";;;;;AAsBA;AAeA;;UA5BiB,eAAA;;;;;;;;;;;;;;;;;;;;;iBAaD,cAAA,WAAyB,kBAAkB;;;;iBAe3C,wBAAA,WACJ,kBACT"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/openapi/exporter/features.ts
|
|
2
|
+
/**
|
|
3
|
+
* Export features to OpenAPI extension format.
|
|
4
|
+
*/
|
|
5
|
+
function exportFeatures(registry) {
|
|
6
|
+
return registry.list().map((feature) => ({
|
|
7
|
+
key: feature.meta.key,
|
|
8
|
+
description: feature.meta.description,
|
|
9
|
+
owners: feature.meta.owners,
|
|
10
|
+
stability: feature.meta.stability,
|
|
11
|
+
operations: feature.operations,
|
|
12
|
+
events: feature.events,
|
|
13
|
+
presentations: feature.presentations
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate TypeScript code for features registry.
|
|
18
|
+
*/
|
|
19
|
+
function generateFeaturesRegistry(registry) {
|
|
20
|
+
const features = registry.list();
|
|
21
|
+
const imports = /* @__PURE__ */ new Set();
|
|
22
|
+
const registrations = [];
|
|
23
|
+
for (const feature of features) {
|
|
24
|
+
const featureVarName = feature.meta.key.replace(/-/g, "_");
|
|
25
|
+
imports.add(`import { ${featureVarName} } from './${feature.meta.key}';`);
|
|
26
|
+
registrations.push(` .register(${featureVarName})`);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
code: `/**
|
|
30
|
+
* Auto-generated features registry.
|
|
31
|
+
* DO NOT EDIT - This file is generated by ContractSpec exporter.
|
|
32
|
+
*/
|
|
33
|
+
import { FeatureRegistry } from '@lssm/lib.contracts';
|
|
34
|
+
|
|
35
|
+
${Array.from(imports).join("\n")}
|
|
36
|
+
|
|
37
|
+
export const featuresRegistry = new FeatureRegistry()
|
|
38
|
+
${registrations.join("\n")};
|
|
39
|
+
`,
|
|
40
|
+
fileName: "features-registry.ts"
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { exportFeatures, generateFeaturesRegistry };
|
|
46
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","names":["registrations: string[]"],"sources":["../../../src/openapi/exporter/features.ts"],"sourcesContent":["/**\n * Features exporter - exports FeatureModuleSpec to OpenAPI extensions.\n */\nimport type { FeatureModuleSpec, FeatureRegistry } from '@lssm/lib.contracts';\nimport type { GeneratedRegistryCode } from '../types';\n\n/**\n * Exported feature structure for OpenAPI extensions.\n */\nexport interface ExportedFeature {\n key: string;\n description?: string;\n owners?: string[];\n stability?: string;\n operations?: { name: string; version: number }[];\n events?: { name: string; version: number }[];\n presentations?: { name: string; version: number }[];\n}\n\n/**\n * Export features to OpenAPI extension format.\n */\nexport function exportFeatures(registry: FeatureRegistry): ExportedFeature[] {\n return registry.list().map((feature) => ({\n key: feature.meta.key,\n description: feature.meta.description,\n owners: feature.meta.owners,\n stability: feature.meta.stability,\n operations: feature.operations,\n events: feature.events,\n presentations: feature.presentations,\n }));\n}\n\n/**\n * Generate TypeScript code for features registry.\n */\nexport function generateFeaturesRegistry(\n registry: FeatureRegistry\n): GeneratedRegistryCode {\n const features = registry.list();\n const imports = new Set<string>();\n const registrations: string[] = [];\n\n for (const feature of features) {\n const featureVarName = feature.meta.key.replace(/-/g, '_');\n imports.add(\n `import { ${featureVarName} } from './${feature.meta.key}';`\n );\n registrations.push(` .register(${featureVarName})`);\n }\n\n const code = `/**\n * Auto-generated features registry.\n * DO NOT EDIT - This file is generated by ContractSpec exporter.\n */\nimport { FeatureRegistry } from '@lssm/lib.contracts';\n\n${Array.from(imports).join('\\n')}\n\nexport const featuresRegistry = new FeatureRegistry()\n${registrations.join('\\n')};\n`;\n\n return {\n code,\n fileName: 'features-registry.ts',\n };\n}\n"],"mappings":";;;;AAsBA,SAAgB,eAAe,UAA8C;AAC3E,QAAO,SAAS,MAAM,CAAC,KAAK,aAAa;EACvC,KAAK,QAAQ,KAAK;EAClB,aAAa,QAAQ,KAAK;EAC1B,QAAQ,QAAQ,KAAK;EACrB,WAAW,QAAQ,KAAK;EACxB,YAAY,QAAQ;EACpB,QAAQ,QAAQ;EAChB,eAAe,QAAQ;EACxB,EAAE;;;;;AAML,SAAgB,yBACd,UACuB;CACvB,MAAM,WAAW,SAAS,MAAM;CAChC,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAMA,gBAA0B,EAAE;AAElC,MAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,iBAAiB,QAAQ,KAAK,IAAI,QAAQ,MAAM,IAAI;AAC1D,UAAQ,IACN,YAAY,eAAe,aAAa,QAAQ,KAAK,IAAI,IAC1D;AACD,gBAAc,KAAK,eAAe,eAAe,GAAG;;AAetD,QAAO;EACL,MAbW;;;;;;EAMb,MAAM,KAAK,QAAQ,CAAC,KAAK,KAAK,CAAC;;;EAG/B,cAAc,KAAK,KAAK,CAAC;;EAKvB,UAAU;EACX"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GeneratedRegistryCode } from "../types.js";
|
|
2
|
+
import { FormRegistry } from "@lssm/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/openapi/exporter/forms.d.ts
|
|
5
|
+
|
|
6
|
+
type OpenApiSchemaObject = Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Exported form structure for OpenAPI extensions.
|
|
9
|
+
*/
|
|
10
|
+
interface ExportedForm {
|
|
11
|
+
key: string;
|
|
12
|
+
version: number;
|
|
13
|
+
description?: string;
|
|
14
|
+
stability?: string;
|
|
15
|
+
owners?: string[];
|
|
16
|
+
fields: unknown[];
|
|
17
|
+
model: OpenApiSchemaObject | null;
|
|
18
|
+
actions?: unknown[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Export forms to OpenAPI extension format.
|
|
22
|
+
*/
|
|
23
|
+
declare function exportForms(registry: FormRegistry): ExportedForm[];
|
|
24
|
+
/**
|
|
25
|
+
* Generate TypeScript code for forms registry.
|
|
26
|
+
*/
|
|
27
|
+
declare function generateFormsRegistry(registry: FormRegistry): GeneratedRegistryCode;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ExportedForm, exportForms, generateFormsRegistry };
|
|
30
|
+
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","names":[],"sources":["../../../src/openapi/exporter/forms.ts"],"sourcesContent":[],"mappings":";;;;;AAaA,KALK,mBAAA,GAAsB,MAYlB,CAAA,MAAA,EAAA,OAAA,CAAA;AAOT;AAoBA;;UAlCiB,YAAA;;;;;;;SAOR;;;;;;iBAOO,WAAA,WAAsB,eAAe;;;;iBAoBrC,qBAAA,WACJ,eACT"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/openapi/exporter/forms.ts
|
|
4
|
+
/**
|
|
5
|
+
* Export forms to OpenAPI extension format.
|
|
6
|
+
*/
|
|
7
|
+
function exportForms(registry) {
|
|
8
|
+
return registry.list().map((form) => ({
|
|
9
|
+
key: form.meta.key,
|
|
10
|
+
version: form.meta.version,
|
|
11
|
+
description: form.meta.description,
|
|
12
|
+
stability: form.meta.stability,
|
|
13
|
+
owners: form.meta.owners,
|
|
14
|
+
fields: form.fields,
|
|
15
|
+
model: form.model ? z.toJSONSchema(form.model.getZod()) : null,
|
|
16
|
+
actions: form.actions
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Generate TypeScript code for forms registry.
|
|
21
|
+
*/
|
|
22
|
+
function generateFormsRegistry(registry) {
|
|
23
|
+
const forms = registry.list();
|
|
24
|
+
const imports = /* @__PURE__ */ new Set();
|
|
25
|
+
const registrations = [];
|
|
26
|
+
for (const form of forms) {
|
|
27
|
+
const formVarName = form.meta.key.replace(/-/g, "_") + `_v${form.meta.version}`;
|
|
28
|
+
imports.add(`import { ${formVarName} } from './${form.meta.key}';`);
|
|
29
|
+
registrations.push(` .register(${formVarName})`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
code: `/**
|
|
33
|
+
* Auto-generated forms registry.
|
|
34
|
+
* DO NOT EDIT - This file is generated by ContractSpec exporter.
|
|
35
|
+
*/
|
|
36
|
+
import { FormRegistry } from '@lssm/lib.contracts';
|
|
37
|
+
|
|
38
|
+
${Array.from(imports).join("\n")}
|
|
39
|
+
|
|
40
|
+
export const formsRegistry = new FormRegistry()
|
|
41
|
+
${registrations.join("\n")};
|
|
42
|
+
`,
|
|
43
|
+
fileName: "forms-registry.ts"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { exportForms, generateFormsRegistry };
|
|
49
|
+
//# sourceMappingURL=forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.js","names":["registrations: string[]"],"sources":["../../../src/openapi/exporter/forms.ts"],"sourcesContent":["/**\n * Forms exporter - exports FormSpec to OpenAPI extensions.\n */\nimport type { FormRegistry, FormSpec } from '@lssm/lib.contracts';\nimport type { AnySchemaModel } from '@lssm/lib.schema';\nimport { z } from 'zod';\nimport type { GeneratedRegistryCode } from '../types';\n\ntype OpenApiSchemaObject = Record<string, unknown>;\n\n/**\n * Exported form structure for OpenAPI extensions.\n */\nexport interface ExportedForm {\n key: string;\n version: number;\n description?: string;\n stability?: string;\n owners?: string[];\n fields: unknown[];\n model: OpenApiSchemaObject | null;\n actions?: unknown[];\n}\n\n/**\n * Export forms to OpenAPI extension format.\n */\nexport function exportForms(registry: FormRegistry): ExportedForm[] {\n return registry.list().map((form) => ({\n key: form.meta.key,\n version: form.meta.version,\n description: form.meta.description,\n stability: form.meta.stability,\n owners: form.meta.owners,\n fields: form.fields,\n model: form.model\n ? (z.toJSONSchema(\n (form.model as AnySchemaModel).getZod()\n ) as OpenApiSchemaObject)\n : null,\n actions: form.actions,\n }));\n}\n\n/**\n * Generate TypeScript code for forms registry.\n */\nexport function generateFormsRegistry(\n registry: FormRegistry\n): GeneratedRegistryCode {\n const forms = registry.list();\n const imports = new Set<string>();\n const registrations: string[] = [];\n\n for (const form of forms) {\n const formVarName = form.meta.key.replace(/-/g, '_') + `_v${form.meta.version}`;\n imports.add(\n `import { ${formVarName} } from './${form.meta.key}';`\n );\n registrations.push(` .register(${formVarName})`);\n }\n\n const code = `/**\n * Auto-generated forms registry.\n * DO NOT EDIT - This file is generated by ContractSpec exporter.\n */\nimport { FormRegistry } from '@lssm/lib.contracts';\n\n${Array.from(imports).join('\\n')}\n\nexport const formsRegistry = new FormRegistry()\n${registrations.join('\\n')};\n`;\n\n return {\n code,\n fileName: 'forms-registry.ts',\n };\n}\n"],"mappings":";;;;;;AA2BA,SAAgB,YAAY,UAAwC;AAClE,QAAO,SAAS,MAAM,CAAC,KAAK,UAAU;EACpC,KAAK,KAAK,KAAK;EACf,SAAS,KAAK,KAAK;EACnB,aAAa,KAAK,KAAK;EACvB,WAAW,KAAK,KAAK;EACrB,QAAQ,KAAK,KAAK;EAClB,QAAQ,KAAK;EACb,OAAO,KAAK,QACP,EAAE,aACA,KAAK,MAAyB,QAAQ,CACxC,GACD;EACJ,SAAS,KAAK;EACf,EAAE;;;;;AAML,SAAgB,sBACd,UACuB;CACvB,MAAM,QAAQ,SAAS,MAAM;CAC7B,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAMA,gBAA0B,EAAE;AAElC,MAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,cAAc,KAAK,KAAK,IAAI,QAAQ,MAAM,IAAI,GAAG,KAAK,KAAK,KAAK;AACtE,UAAQ,IACN,YAAY,YAAY,aAAa,KAAK,KAAK,IAAI,IACpD;AACD,gBAAc,KAAK,eAAe,YAAY,GAAG;;AAenD,QAAO;EACL,MAbW;;;;;;EAMb,MAAM,KAAK,QAAQ,CAAC,KAAK,KAAK,CAAC;;;EAG/B,cAAc,KAAK,KAAK,CAAC;;EAKvB,UAAU;EACX"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defaultRestPath, exportOperations, generateOperationsRegistry, jsonSchemaForSpec, schemaModelToJsonSchema, toHttpMethod, toOperationId, toRestPath, toSchemaName } from "./operations.js";
|
|
2
|
+
import { exportEvents, generateEventsExports } from "./events.js";
|
|
3
|
+
import { exportFeatures, generateFeaturesRegistry } from "./features.js";
|
|
4
|
+
import { exportPresentations, exportPresentationsV1, exportPresentationsV2, generatePresentationsRegistry } from "./presentations.js";
|
|
5
|
+
import { exportForms, generateFormsRegistry } from "./forms.js";
|
|
6
|
+
import { exportDataViews, generateDataViewsRegistry } from "./data-views.js";
|
|
7
|
+
import { exportWorkflows, generateWorkflowsRegistry } from "./workflows.js";
|
|
8
|
+
import { generateRegistryIndex } from "./registries.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { GeneratedRegistryCode } from "../types.js";
|
|
2
|
+
import { AnyOperationSpec, OperationSpec, OperationSpecRegistry } from "@lssm/lib.contracts";
|
|
3
|
+
import { AnySchemaModel } from "@lssm/lib.schema";
|
|
4
|
+
|
|
5
|
+
//#region src/openapi/exporter/operations.d.ts
|
|
6
|
+
|
|
7
|
+
type OpenApiSchemaObject = Record<string, unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* Convert a spec name and version to an operationId.
|
|
10
|
+
*/
|
|
11
|
+
declare function toOperationId(name: string, version: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Convert a spec name and version to a schema name.
|
|
14
|
+
*/
|
|
15
|
+
declare function toSchemaName(prefix: 'Input' | 'Output', name: string, version: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Determine HTTP method from spec kind and override.
|
|
18
|
+
*/
|
|
19
|
+
declare function toHttpMethod(kind: 'command' | 'query', override?: 'GET' | 'POST'): string;
|
|
20
|
+
/**
|
|
21
|
+
* Generate default REST path from spec name and version.
|
|
22
|
+
*/
|
|
23
|
+
declare function defaultRestPath(name: string, version: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get REST path from spec, using transport override or default.
|
|
26
|
+
*/
|
|
27
|
+
declare function toRestPath(spec: AnyOperationSpec): string;
|
|
28
|
+
/**
|
|
29
|
+
* Convert a SchemaModel to JSON Schema using Zod.
|
|
30
|
+
*/
|
|
31
|
+
declare function schemaModelToJsonSchema(schema: AnySchemaModel | null): OpenApiSchemaObject | null;
|
|
32
|
+
interface SpecJsonSchema {
|
|
33
|
+
input: OpenApiSchemaObject | null;
|
|
34
|
+
output: OpenApiSchemaObject | null;
|
|
35
|
+
meta: {
|
|
36
|
+
name: string;
|
|
37
|
+
version: number;
|
|
38
|
+
kind: 'command' | 'query';
|
|
39
|
+
description: string;
|
|
40
|
+
tags: string[];
|
|
41
|
+
stability: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract JSON Schema for a spec's input and output.
|
|
46
|
+
*/
|
|
47
|
+
declare function jsonSchemaForSpec(spec: OperationSpec<AnySchemaModel, AnySchemaModel>): SpecJsonSchema;
|
|
48
|
+
/**
|
|
49
|
+
* Result of exporting operations to OpenAPI format.
|
|
50
|
+
*/
|
|
51
|
+
interface OperationsExportResult {
|
|
52
|
+
paths: Record<string, Record<string, unknown>>;
|
|
53
|
+
schemas: Record<string, OpenApiSchemaObject>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Export operations from a registry to OpenAPI paths and schemas.
|
|
57
|
+
*/
|
|
58
|
+
declare function exportOperations(registry: OperationSpecRegistry): OperationsExportResult;
|
|
59
|
+
/**
|
|
60
|
+
* Generate TypeScript code for operations registry.
|
|
61
|
+
*/
|
|
62
|
+
declare function generateOperationsRegistry(registry: OperationSpecRegistry): GeneratedRegistryCode;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { OperationsExportResult, defaultRestPath, exportOperations, generateOperationsRegistry, jsonSchemaForSpec, schemaModelToJsonSchema, toHttpMethod, toOperationId, toRestPath, toSchemaName };
|
|
65
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","names":[],"sources":["../../../src/openapi/exporter/operations.ts"],"sourcesContent":[],"mappings":";;;;;;AAiBA,KALK,mBAAA,GAAsB,MAKE,CAAA,MAAA,EAAA,OAAA,CAAA;AAO7B;AAWA;AAWA;AAOgB,iBApCA,aAAA,CAoCiB,IAAA,EAAA,MAAgB,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;AAUjD;AAKC;AAkBD;AACsB,iBA/DN,YAAA,CA+DM,MAAA,EAAA,OAAA,GAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;;AACL,iBArDD,YAAA,CAqDC,IAAA,EAAA,SAAA,GAAA,OAAA,EAAA,QAAA,CAAA,EAAA,KAAA,GAAA,MAAA,CAAA,EAAA,MAAA;AAkBjB;;;AAE0B,iBA9DV,eAAA,CA8DU,IAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;;;AAM1B;AAoFgB,iBAjJA,UAAA,CAiJ0B,IAAA,EAjJT,gBAkJrB,CAAA,EAAA,MAAA;;;;iBAxII,uBAAA,SACN,wBACP;UAKO,cAAA;SACD;UACC;;;;;;;;;;;;;iBAcM,iBAAA,OACR,cAAc,gBAAgB,kBACnC;;;;UAkBc,sBAAA;SACR,eAAe;WACb,eAAe;;;;;iBAMV,gBAAA,WACJ,wBACT;;;;iBAkFa,0BAAA,WACJ,wBACT"}
|