@kosdev-code/kos-codegen-core 3.0.19 → 3.0.21
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/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +1527 -569
- package/index.js.map +1 -1
- package/index.mjs +1523 -565
- package/index.mjs.map +1 -1
- package/lib/generators/add-container-support/generate-add-container-support.d.ts +14 -0
- package/lib/generators/add-container-support/generate-add-container-support.d.ts.map +1 -1
- package/lib/generators/add-future-to-model/normalize-options.d.ts.map +1 -1
- package/lib/generators/add-future-to-model/service-transformer.d.ts +1 -3
- package/lib/generators/add-future-to-model/service-transformer.d.ts.map +1 -1
- package/lib/generators/add-parent-aware/generate-add-parent-aware.d.ts +15 -0
- package/lib/generators/add-parent-aware/generate-add-parent-aware.d.ts.map +1 -0
- package/lib/generators/add-parent-aware/index.d.ts +2 -0
- package/lib/generators/add-parent-aware/index.d.ts.map +1 -0
- package/lib/generators/augment/find-model-declaration.d.ts +11 -0
- package/lib/generators/augment/find-model-declaration.d.ts.map +1 -0
- package/lib/generators/augment/model-mocks.d.ts +47 -0
- package/lib/generators/augment/model-mocks.d.ts.map +1 -0
- package/lib/generators/augment/model-services.d.ts +11 -0
- package/lib/generators/augment/model-services.d.ts.map +1 -0
- package/lib/generators/augment/resolve-child-model.d.ts +16 -0
- package/lib/generators/augment/resolve-child-model.d.ts.map +1 -0
- package/lib/generators/augment/resolve-model-file.d.ts.map +1 -1
- package/lib/generators/augment/ts-toolkit.d.ts +61 -1
- package/lib/generators/augment/ts-toolkit.d.ts.map +1 -1
- package/lib/generators/generate-container-model.d.ts +7 -1
- package/lib/generators/generate-container-model.d.ts.map +1 -1
- package/lib/generators/generate-init.d.ts.map +1 -1
- package/lib/generators/generate-model-project.d.ts +36 -0
- package/lib/generators/generate-model-project.d.ts.map +1 -0
- package/lib/generators/generate-model.d.ts +0 -1
- package/lib/generators/generate-model.d.ts.map +1 -1
- package/lib/generators/generate-view-model.d.ts +35 -0
- package/lib/generators/generate-view-model.d.ts.map +1 -0
- package/lib/generators/index.d.ts +21 -16
- package/lib/generators/index.d.ts.map +1 -1
- package/lib/generators/member-mutators/add-child.d.ts +10 -2
- package/lib/generators/member-mutators/add-child.d.ts.map +1 -1
- package/lib/generators/member-mutators/add-service-request.d.ts +80 -2
- package/lib/generators/member-mutators/add-service-request.d.ts.map +1 -1
- package/lib/generators/member-mutators/index.d.ts +1 -1
- package/lib/generators/member-mutators/index.d.ts.map +1 -1
- package/lib/generators/registration/upsert-chain-entry.d.ts +13 -0
- package/lib/generators/registration/upsert-chain-entry.d.ts.map +1 -0
- package/lib/generators/service-catalog.d.ts +12 -0
- package/lib/generators/service-catalog.d.ts.map +1 -1
- package/package.json +2 -2
- package/templates/kos-container-model/model/index.ts.template +0 -2
- package/templates/kos-container-model/model/types/index.d.ts.template +2 -2
- package/templates/kos-model/model/index.ts__template__ +0 -3
- package/templates/kos-model-project/project/.eslintrc.json.template +33 -0
- package/templates/kos-model-project/project/.kos.json.template +14 -0
- package/templates/kos-model-project/project/README.md.template +7 -0
- package/templates/kos-model-project/project/package.json.template +9 -0
- package/templates/kos-model-project/project/project.json.template +35 -0
- package/templates/kos-model-project/project/src/index.ts.template +1 -0
- package/templates/kos-model-project/project/src/lib/__projectName__.ts.template +3 -0
- package/templates/kos-model-project/project/tsconfig.json.template +20 -0
- package/templates/kos-model-project/project/tsconfig.lib.json.template +10 -0
- package/templates/kos-model-project/project/vite.config.ts.template +47 -0
- package/templates/kos-view-model/__nameDashCase__-view-model.ts.template +30 -0
- package/templates/kos-view-model/index.ts.template +1 -0
- package/templates/kos-container-model/services/__modelNameDashCase__-services.ts.template +0 -22
- package/templates/kos-container-model/services/index.ts.template +0 -1
- package/templates/kos-model/services/__nameDashCase__-services.ts.template +0 -58
- package/templates/kos-model/services/index.ts.template +0 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { CodegenFileSystem } from '../../codegen-filesystem';
|
|
2
2
|
import { ProjectConfiguration } from '../../project-discovery';
|
|
3
3
|
export type ServiceRequestMode = "lifecycle" | "method";
|
|
4
|
+
/**
|
|
5
|
+
* What to do when the generated types do not declare the requested endpoint.
|
|
6
|
+
*
|
|
7
|
+
* `auto` never silently substitutes mocking for a real request — the result says
|
|
8
|
+
* plainly that it did, and why, so the caller reports a missing endpoint rather
|
|
9
|
+
* than a finished feature.
|
|
10
|
+
*/
|
|
11
|
+
export type ServiceRequestMockMode = "auto" | "always" | "never";
|
|
4
12
|
export interface AddServiceRequestOptions {
|
|
5
13
|
modelName: string;
|
|
6
14
|
modelProject: string;
|
|
@@ -20,6 +28,31 @@ export interface AddServiceRequestOptions {
|
|
|
20
28
|
* `lifecycle` mode; defaults to `LOAD` there.
|
|
21
29
|
*/
|
|
22
30
|
lifecycle?: string;
|
|
31
|
+
/**
|
|
32
|
+
* What to do about an endpoint the generated types do not declare.
|
|
33
|
+
*
|
|
34
|
+
* `never` — a hard error; nothing is written.
|
|
35
|
+
* `auto` — (default) emit the provisional, mock-backed form and say so.
|
|
36
|
+
* `always` — emit a KosMock route even for an endpoint that IS typed, for
|
|
37
|
+
* developing against something the spec declares but the device does not
|
|
38
|
+
* serve yet. A typed endpoint keeps its typed request; only the mock is added.
|
|
39
|
+
*/
|
|
40
|
+
mock?: ServiceRequestMockMode;
|
|
41
|
+
/**
|
|
42
|
+
* The raw wire shape a PROVISIONAL endpoint is expected to serve, as TypeScript
|
|
43
|
+
* type text (`DeviceGrantSyncBean[]`, `{ id: string; label: string }`). This is
|
|
44
|
+
* the UNWRAPPED `data` payload: the client strips the `{status, data}` envelope
|
|
45
|
+
* before the transform runs. Defaults to `unknown`, which compiles but leaves
|
|
46
|
+
* the response boundary undescribed.
|
|
47
|
+
*/
|
|
48
|
+
rawType?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Sample payload for the mock route, as TypeScript expression text. Typed
|
|
51
|
+
* against the raw wire shape, so a sample that does not match it fails the
|
|
52
|
+
* build rather than the demo. Without one the route answers with a placeholder
|
|
53
|
+
* and the transform is never exercised.
|
|
54
|
+
*/
|
|
55
|
+
sample?: string;
|
|
23
56
|
/** Import specifier for the generated typed service module (relative to the model
|
|
24
57
|
* file). If omitted, auto-resolved when the project has exactly one. */
|
|
25
58
|
serviceModule?: string;
|
|
@@ -32,9 +65,54 @@ export interface AddServiceRequestOptions {
|
|
|
32
65
|
serviceModulePath?: string;
|
|
33
66
|
modelPath?: string;
|
|
34
67
|
}
|
|
35
|
-
export
|
|
68
|
+
export interface AddServiceRequestResult {
|
|
36
69
|
modelFilePath: string;
|
|
70
|
+
/** The model's services module the descriptor was written to. */
|
|
71
|
+
servicesFilePath: string;
|
|
37
72
|
serviceModule: string;
|
|
38
73
|
mode: ServiceRequestMode;
|
|
39
|
-
|
|
74
|
+
/** Catalog entry the method points at — reused when the endpoint was known. */
|
|
75
|
+
endpointKey: string;
|
|
76
|
+
/** False when an existing catalog entry for this (path, method) was reused. */
|
|
77
|
+
endpointCreated: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the path was actually checked. False when the generated module
|
|
80
|
+
* exposes no `paths` this can read — which is not evidence the endpoint exists.
|
|
81
|
+
*/
|
|
82
|
+
pathValidated: boolean;
|
|
83
|
+
/** True when the endpoint is absent from the generated types and was mocked. */
|
|
84
|
+
provisional: boolean;
|
|
85
|
+
/** The mock module, when one was written. */
|
|
86
|
+
mocksFilePath?: string;
|
|
87
|
+
/** Function the app must call to arm the routes, when one was written. */
|
|
88
|
+
mockRegisterFunction?: string;
|
|
89
|
+
/** `GET /api/board/grants`, when a route was registered. */
|
|
90
|
+
mockRoute?: string;
|
|
91
|
+
/** True when no sample was supplied, so the mock serves a placeholder. */
|
|
92
|
+
mockSamplePlaceholder?: boolean;
|
|
93
|
+
/** Exactly what to undo when the endpoint lands, in order. */
|
|
94
|
+
removalSteps?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Everything needed to report a rejected path, carried on the error rather than
|
|
98
|
+
* flattened into its message — so a tool surface can present the alternatives
|
|
99
|
+
* with their warning attached instead of as a list of corrections.
|
|
100
|
+
*/
|
|
101
|
+
export interface UntypedEndpointDetails {
|
|
102
|
+
servicePath: string;
|
|
103
|
+
method: string;
|
|
104
|
+
/** True when the path is typed, but not for this method. */
|
|
105
|
+
pathTypedForOtherMethods: boolean;
|
|
106
|
+
/** Methods this path DOES support, when it is typed at all. */
|
|
107
|
+
methodsForPath: string[];
|
|
108
|
+
/** Nearest paths in the same API — alternatives to rule out, not to adopt. */
|
|
109
|
+
otherEndpointsInThisApi: string[];
|
|
110
|
+
warning: string;
|
|
111
|
+
waysForward: string[];
|
|
112
|
+
}
|
|
113
|
+
/** A rejected path, with the alternatives kept apart from the verdict. */
|
|
114
|
+
export interface UntypedEndpointError extends Error {
|
|
115
|
+
details: UntypedEndpointDetails;
|
|
116
|
+
}
|
|
117
|
+
export declare function addServiceRequestToModel(codegenFs: CodegenFileSystem, options: AddServiceRequestOptions, projects?: Map<string, ProjectConfiguration>): AddServiceRequestResult;
|
|
40
118
|
//# sourceMappingURL=add-service-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-service-request.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-codegen-core/src/lib/generators/member-mutators/add-service-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-service-request.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-codegen-core/src/lib/generators/member-mutators/add-service-request.ts"],"names":[],"mappings":"AA+CA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA6BpE,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;6EACyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,kBAAkB,CAAC;IACzB,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,wBAAwB,EAAE,OAAO,CAAC;IAClC,+DAA+D;IAC/D,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,8EAA8E;IAC9E,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,0EAA0E;AAC1E,MAAM,WAAW,oBAAqB,SAAQ,KAAK;IACjD,OAAO,EAAE,sBAAsB,CAAC;CACjC;AA6RD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,wBAAwB,EACjC,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC3C,uBAAuB,CAqXzB"}
|
|
@@ -5,5 +5,5 @@ export { addTopicHandlerToModel, type AddTopicHandlerOptions, } from './add-topi
|
|
|
5
5
|
export { addConfigPropertyToModel, type AddConfigPropertyOptions, } from './add-config-property';
|
|
6
6
|
export { addPropertyToModel, type AddPropertyOptions } from './add-property';
|
|
7
7
|
export { addComputedToModel, type AddComputedOptions } from './add-computed';
|
|
8
|
-
export { addServiceRequestToModel, type AddServiceRequestOptions, } from './add-service-request';
|
|
8
|
+
export { addServiceRequestToModel, type AddServiceRequestOptions, type AddServiceRequestResult, type ServiceRequestMockMode, type UntypedEndpointDetails, type UntypedEndpointError, } from './add-service-request';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-codegen-core/src/lib/generators/member-mutators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-codegen-core/src/lib/generators/member-mutators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,GAC1B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UpsertChainEntryResult {
|
|
2
|
+
changed: boolean;
|
|
3
|
+
/** The full file text after the edit (only when `changed`). */
|
|
4
|
+
content?: string;
|
|
5
|
+
/** Whether an import for the bean had to be added (only when `changed`). */
|
|
6
|
+
importAdded?: boolean;
|
|
7
|
+
note?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Number of `.model(...)` entries in a chain file. */
|
|
11
|
+
export declare function countChainEntries(content: string): number;
|
|
12
|
+
export declare function upsertChainEntry(content: string, bean: string, importSpec: string): UpsertChainEntryResult;
|
|
13
|
+
//# sourceMappingURL=upsert-chain-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-chain-entry.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-codegen-core/src/lib/generators/registration/upsert-chain-entry.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwCD,uDAAuD;AACvD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,sBAAsB,CA4CxB"}
|
|
@@ -35,5 +35,17 @@ export interface ServiceCatalogQuery {
|
|
|
35
35
|
* should tell the user to run `api:generate`, not treat it as "no endpoints".
|
|
36
36
|
*/
|
|
37
37
|
export declare function listServiceCatalog(codegenFs: CodegenFileSystem, query: ServiceCatalogQuery, projects?: Map<string, ProjectConfiguration>): ServiceCatalogEntry[];
|
|
38
|
+
/**
|
|
39
|
+
* The operations a generated service module types, for callers that hold the
|
|
40
|
+
* module rather than a project name — path validation, above all.
|
|
41
|
+
*
|
|
42
|
+
* `paths` normally lives in the `openapi.d.ts` beside the module, but the module
|
|
43
|
+
* may declare it inline instead. Returns null when NEITHER does: that is "these
|
|
44
|
+
* types cannot answer the question", which a caller must not read as "the
|
|
45
|
+
* endpoint does not exist".
|
|
46
|
+
*
|
|
47
|
+
* @param serviceModuleFile Root-relative path of the module, with or without `.ts`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function readServiceModuleOperations(codegenFs: CodegenFileSystem, serviceModuleFile: string): ServiceOperation[] | null;
|
|
38
50
|
export {};
|
|
39
51
|
//# sourceMappingURL=service-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-catalog.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/service-catalog.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIjE,8EAA8E;AAC9E,QAAA,MAAM,eAAe,oDAAqD,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAID,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC3C,mBAAmB,EAAE,CAiCvB"}
|
|
1
|
+
{"version":3,"file":"service-catalog.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/service-catalog.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIjE,8EAA8E;AAC9E,QAAA,MAAM,eAAe,oDAAqD,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAID,MAAM,WAAW,mBAAmB;IAClC,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC3C,mBAAmB,EAAE,CAiCvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,iBAAiB,EAC5B,iBAAiB,EAAE,MAAM,GACxB,gBAAgB,EAAE,GAAG,IAAI,CAa3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-codegen-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.21",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"kos": {
|
|
27
27
|
"build": {
|
|
28
|
-
"gitHash": "
|
|
28
|
+
"gitHash": "a5481c29ff5f1e4f0c89ed967aea9b0f0b9ee171"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -8,6 +8,4 @@ export type { <%= nameProperCase %>Model } from "./<%= nameDashCase %>-model";
|
|
|
8
8
|
export type { <%= modelNameProperCase %>Model } from "./<%= modelNameDashCase %>-model";
|
|
9
9
|
export type * from "./types";
|
|
10
10
|
|
|
11
|
-
<% if (dataServices) { %>// Export services if configured
|
|
12
|
-
export * as <%= modelNameProperCase %>Services from "./services";<% } %>
|
|
13
11
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
<% if (parentAware) { %>import type {KosParentAware} from "@kosdev-code/kos-ui-sdk";<% } %>
|
|
2
|
+
<% if (locals.parentAware) { %>import type {KosParentAware} from "@kosdev-code/kos-ui-sdk";<% } %>
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
// --------------- <%= modelNameProperCase %> ---------------
|
|
6
6
|
|
|
7
|
-
export interface <%= modelNameProperCase %>Options <% if (parentAware) { %>extends KosParentAware<% } %> {
|
|
7
|
+
export interface <%= modelNameProperCase %>Options <% if (locals.parentAware) { %>extends KosParentAware<% } %> {
|
|
8
8
|
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -4,6 +4,3 @@ export { <%= nameProperCase %> } from "./<%= nameDashCase %>-model";
|
|
|
4
4
|
// Export types
|
|
5
5
|
export type { <%= nameProperCase %>Model } from "./<%= nameDashCase %>-model";
|
|
6
6
|
export type * from "./types";
|
|
7
|
-
|
|
8
|
-
<% if (dataServices) { %>// Export services if configured
|
|
9
|
-
export * as <%= nameProperCase %>Services from "./services";<% } %>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["<%= offsetFromRoot %>.eslintrc.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
+
"rules": {}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.js", "*.jsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"files": ["*.json"],
|
|
19
|
+
"parser": "jsonc-eslint-parser",
|
|
20
|
+
"rules": {
|
|
21
|
+
"@nx/dependency-checks": [
|
|
22
|
+
"error",
|
|
23
|
+
{
|
|
24
|
+
"ignoredFiles": [
|
|
25
|
+
"{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}",
|
|
26
|
+
"{projectRoot}/vite.config.{js,ts,mjs,mts}"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= projectName %>",
|
|
3
|
+
"$schema": "<%= offsetFromRoot %>node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "<%= projectRoot %>/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/vite:build",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"defaultConfiguration": "production",
|
|
12
|
+
"options": {
|
|
13
|
+
"outputPath": "dist/<%= projectRoot %>"
|
|
14
|
+
},
|
|
15
|
+
"configurations": {
|
|
16
|
+
"development": {
|
|
17
|
+
"mode": "development"
|
|
18
|
+
},
|
|
19
|
+
"production": {
|
|
20
|
+
"mode": "production"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"lint": {
|
|
25
|
+
"executor": "@nx/eslint:lint"
|
|
26
|
+
},
|
|
27
|
+
"api": {
|
|
28
|
+
"command": "kosui api:generate --project=<%= projectName %>",
|
|
29
|
+
"options": {
|
|
30
|
+
"host": "http://127.0.0.1:8081",
|
|
31
|
+
"defaultVersion": "snapshot"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/<%= projectName %>';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "<%= offsetFromRoot %>tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"importHelpers": true,
|
|
8
|
+
"noImplicitOverride": true,
|
|
9
|
+
"noImplicitReturns": true,
|
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
|
11
|
+
"noPropertyAccessFromIndexSignature": true
|
|
12
|
+
},
|
|
13
|
+
"files": [],
|
|
14
|
+
"include": [],
|
|
15
|
+
"references": [
|
|
16
|
+
{
|
|
17
|
+
"path": "./tsconfig.lib.json"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types='vitest' />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import dts from 'vite-plugin-dts';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
6
|
+
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
7
|
+
|
|
8
|
+
export default defineConfig(() => ({
|
|
9
|
+
root: __dirname,
|
|
10
|
+
cacheDir: '<%= offsetFromRoot %>node_modules/.vite/<%= projectRoot %>',
|
|
11
|
+
plugins: [
|
|
12
|
+
nxViteTsPaths(),
|
|
13
|
+
nxCopyAssetsPlugin(['*.md']),
|
|
14
|
+
dts({
|
|
15
|
+
entryRoot: 'src',
|
|
16
|
+
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
17
|
+
pathsToAliases: false,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
// Uncomment this if you are using workers.
|
|
21
|
+
// worker: {
|
|
22
|
+
// plugins: [ nxViteTsPaths() ],
|
|
23
|
+
// },
|
|
24
|
+
// Configuration for building your library.
|
|
25
|
+
// See: https://vitejs.dev/guide/build.html#library-mode
|
|
26
|
+
build: {
|
|
27
|
+
outDir: '<%= offsetFromRoot %>dist/<%= projectRoot %>',
|
|
28
|
+
emptyOutDir: true,
|
|
29
|
+
reportCompressedSize: true,
|
|
30
|
+
commonjsOptions: {
|
|
31
|
+
transformMixedEsModules: true,
|
|
32
|
+
},
|
|
33
|
+
lib: {
|
|
34
|
+
// Could also be a dictionary or array of multiple entry points.
|
|
35
|
+
entry: 'src/index.ts',
|
|
36
|
+
name: '<%= projectName %>',
|
|
37
|
+
fileName: 'index',
|
|
38
|
+
// Change this to the formats you want to support.
|
|
39
|
+
// Don't forget to update your package.json as well.
|
|
40
|
+
formats: ['es' as const],
|
|
41
|
+
},
|
|
42
|
+
rollupOptions: {
|
|
43
|
+
// External packages that should not be bundled into your library.
|
|
44
|
+
external: [],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI-only state for the <%= nameProperCase %> view, held <% if (constructorParams.length) { %>beside the KOS data models it
|
|
3
|
+
* reads rather than inside them<% } else { %>outside the KOS data models<% } %>. A ViewModel is not registered and is
|
|
4
|
+
* not part of the model graph; create one per component with
|
|
5
|
+
* `useViewModel(() => new <%= nameProperCase %>ViewModel(<%= constructorArgs %>))`.
|
|
6
|
+
*/
|
|
7
|
+
<% if (internal) { %>import {
|
|
8
|
+
kosViewModel,
|
|
9
|
+
kosLoggerAware,
|
|
10
|
+
type KosViewModelLoggerAware,
|
|
11
|
+
} from "../../../core/core/decorators";
|
|
12
|
+
<% } else { %>import {
|
|
13
|
+
kosViewModel,
|
|
14
|
+
kosLoggerAware,
|
|
15
|
+
type KosViewModelLoggerAware,
|
|
16
|
+
} from "@kosdev-code/kos-ui-sdk";
|
|
17
|
+
<% } %><% modelImports.forEach(function (imp) { %>import type { <%= imp.types.join(", ") %> } from "<%= imp.module %>";
|
|
18
|
+
<% }); %>
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
20
|
+
export interface <%= nameProperCase %>ViewModel extends KosViewModelLoggerAware {}
|
|
21
|
+
|
|
22
|
+
@kosViewModel({ typeId: "<%= typeId %>"<% if (devToolsEnabled) { %>, devToolsEnabled: true<% } %> })
|
|
23
|
+
@kosLoggerAware()
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
25
|
+
export class <%= nameProperCase %>ViewModel {
|
|
26
|
+
<% if (constructorParams.length === 0) { %> constructor() {}
|
|
27
|
+
<% } else { %> constructor(
|
|
28
|
+
<% constructorParams.forEach(function (param, index) { %> private readonly <%= param.name %>: <%= param.type %><% if (index < constructorParams.length - 1) { %>,<% } %>
|
|
29
|
+
<% }); %> ) {}
|
|
30
|
+
<% } %>}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { <%= nameProperCase %>ViewModel } from "./<%= nameDashCase %>-view-model";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
KosLog,
|
|
3
|
-
type ElementType,
|
|
4
|
-
type ServiceResponse
|
|
5
|
-
} from '@kosdev-code/kos-ui-sdk';
|
|
6
|
-
|
|
7
|
-
import API, { type KosApi, type ApiPath, type ApiResponse } from '../../../utils/service';
|
|
8
|
-
|
|
9
|
-
const log = KosLog.createLogger({name: "<%= nameDashCase %>-service", group: "Services"});
|
|
10
|
-
|
|
11
|
-
const SERVICE_PATH: ApiPath = "ENTER_SERVICE_PATH"
|
|
12
|
-
export type <%= nameProperCase %>Response = ApiResponse<typeof SERVICE_PATH,'get'>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @category Service
|
|
17
|
-
* Retrieves the initial list of <%= name %> data.
|
|
18
|
-
*/
|
|
19
|
-
export const get<%= nameProperCase %> = async (): Promise<ServiceResponse<<%= nameProperCase %>ClientResponse>> => {
|
|
20
|
-
log.debug('sending GET for <%= name %>');
|
|
21
|
-
return await API.get(SERVICE_PATH);
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./<%= modelNameDashCase %>-services";
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<% const hasFutureSupport = futureAware && futureAware !== 'none'; %>
|
|
2
|
-
import {
|
|
3
|
-
KosLog,
|
|
4
|
-
type ElementType,
|
|
5
|
-
type ServiceResponse<% if (hasFutureSupport) { %>,
|
|
6
|
-
type FutureResponse<% } %>
|
|
7
|
-
} from '@kosdev-code/kos-ui-sdk';
|
|
8
|
-
|
|
9
|
-
import API, { type ApiPath, type ApiResponse } from '../../../utils/service';
|
|
10
|
-
|
|
11
|
-
const log = KosLog.createLogger({name: "<%= nameDashCase %>-service", group: "Services"});
|
|
12
|
-
|
|
13
|
-
const SERVICE_PATH: ApiPath = "ENTER_SERVICE_PATH"
|
|
14
|
-
export type <%= nameProperCase %>Response = ApiResponse<typeof SERVICE_PATH, 'get'>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @category Service
|
|
19
|
-
* Retrieves the initial <%= name %> data.
|
|
20
|
-
*/
|
|
21
|
-
export const get<%= nameProperCase %> = async (): Promise<ServiceResponse<<%= nameProperCase %>Response>> => {
|
|
22
|
-
log.debug('sending GET for <%= name %>');
|
|
23
|
-
return await API.get(SERVICE_PATH);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
<% if (hasFutureSupport) { %>
|
|
27
|
-
/**
|
|
28
|
-
* @category Service - Future Operation
|
|
29
|
-
* Placeholder for a long-running operation that returns a Future for progress tracking
|
|
30
|
-
*
|
|
31
|
-
* Replace this with your actual long-running service operation
|
|
32
|
-
*/
|
|
33
|
-
export const perform<%= nameProperCase %>Operation = async (): Promise<FutureResponse> => {
|
|
34
|
-
// TODO: Implement your long-running service operation here
|
|
35
|
-
// This should return a Future that can be tracked for progress
|
|
36
|
-
|
|
37
|
-
log.debug('starting long-running <%= name %> operation');
|
|
38
|
-
|
|
39
|
-
// Example pattern:
|
|
40
|
-
// return API.post(OPERATION_SERVICE_PATH, {
|
|
41
|
-
// // operation parameters
|
|
42
|
-
// });
|
|
43
|
-
|
|
44
|
-
// Placeholder - replace with actual implementation
|
|
45
|
-
throw new Error('perform<%= nameProperCase %>Operation not yet implemented');
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// Additional Future-aware service types (add as needed)
|
|
49
|
-
export type <%= nameProperCase %>OperationProgress = {
|
|
50
|
-
// Define your progress data structure here
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type <%= nameProperCase %>OperationResult = {
|
|
55
|
-
// Define your operation result structure here
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
<% } %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./<%= nameDashCase %>-services";
|