@kosdev-code/kos-codegen-core 3.0.20 → 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 +1266 -379
- package/index.js.map +1 -1
- package/index.mjs +1267 -380
- 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-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/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 +26 -1
- package/lib/generators/augment/ts-toolkit.d.ts.map +1 -1
- package/lib/generators/generate-container-model.d.ts +7 -0
- package/lib/generators/generate-container-model.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-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 +71 -0
- 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/types/index.d.ts.template +2 -2
- 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
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -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";
|