@kosdev-code/kos-codegen-core 0.1.0-next.781 → 0.1.0-next.782

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.
@@ -5,6 +5,7 @@ export interface ContainerModelOptions extends KosBaseGeneratorOptions {
5
5
  modelName?: string;
6
6
  singleton?: boolean;
7
7
  dataServices?: boolean;
8
+ autoRegister?: boolean;
8
9
  }
9
10
  /**
10
11
  * Generate a container model.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-container-model.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/generate-container-model.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAUjE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,qBAAqB,EAC9B,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC3C,IAAI,CAwFN"}
1
+ {"version":3,"file":"generate-container-model.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/generate-container-model.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAUjE,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,iBAAiB,EAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,qBAAqB,EAC9B,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAC3C,IAAI,CAwFN"}
@@ -1 +1 @@
1
- {"version":3,"file":"update-model-index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/update-model-index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAoCN"}
1
+ {"version":3,"file":"update-model-index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-codegen-core/src/lib/generators/update-model-index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAkDN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-codegen-core",
3
- "version": "0.1.0-next.781",
3
+ "version": "0.1.0-next.782",
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": "8c65da6d46c2a4da09632ff48ab242deb2ce2d85"
28
+ "gitHash": "7a6c5babc652e51e59b83d4ee09fc1d4e1817199"
29
29
  }
30
30
  }
31
31
  }
@@ -11,15 +11,16 @@
11
11
  import type {
12
12
  IKosDataModel
13
13
  } from "../../../core/core/kosModel";
14
- import type { KosModelRegistrationType } from "../../../core/core/registration/model-registration";
15
- import type { IKosIdentifiable } from "../../../core/core/types";
14
+ <% if (singleton === false) { %>import type { KosModelRegistrationType } from "../../../core/core/registration/model-registration";
15
+ <% } else { %>import type { SingletonKosModelRegistrationFactory } from "../../../core/core/registration/singleton-kos-model-registration-factory";
16
+ <% } %>import type { IKosIdentifiable } from "../../../core/core/types";
16
17
  import type { PublicModelInterface } from "../../../core/types";
17
18
  <% } else { %>import { kosModel, kosContainerAware, type KosContainerAware } from "@kosdev-code/kos-ui-sdk";
18
- import { type KosModelRegistrationType, IKosDataModel, IKosIdentifiable, PublicModelInterface, kosLoggerAware, type KosLoggerAware } from "@kosdev-code/kos-ui-sdk";<% } %>
19
+ import { type <%= singleton === false ? "KosModelRegistrationType" : "SingletonKosModelRegistrationFactory" %>, IKosDataModel, IKosIdentifiable, PublicModelInterface, kosLoggerAware, type KosLoggerAware } from "@kosdev-code/kos-ui-sdk";<% } %>
19
20
 
20
21
 
21
22
  import type { <%= nameProperCase %>Options } from "./types";
22
- import type { <%= modelNameProperCase %>Model } from "./<%= modelNameDashCase %>-model";
23
+ import { <%= modelNameProperCase %>, type <%= modelNameProperCase %>Model } from "./<%= modelNameDashCase %>-model";
23
24
 
24
25
 
25
26
  export const MODEL_TYPE = "<%= nameDashCase %>-model";
@@ -29,13 +30,19 @@ export type <%= nameProperCase %>Model = PublicModelInterface<<%= nameProperCase
29
30
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
30
31
  export interface <%= nameProperCase %>ModelImpl extends KosLoggerAware, KosContainerAware<<%= modelNameProperCase %>Model> {}
31
32
 
32
- @kosModel({ modelTypeId: MODEL_TYPE, singleton: true<% if (autoRegister) { %>, autoRegister: true<% } %> })
33
+ @kosModel({ modelTypeId: MODEL_TYPE, singleton: <%= singleton === false ? "false" : "true" %><% if (autoRegister) { %>, autoRegister: true<% } %> })
33
34
  @kosContainerAware<<%= modelNameProperCase %>Model>()
34
35
  @kosLoggerAware()
35
36
  export class <%= nameProperCase %>ModelImpl implements IKosIdentifiable, IKosDataModel {
36
37
 
37
- // Registration property for type safety - actual value injected by @kosModel decorator
38
- static Registration: KosModelRegistrationType<<%= nameProperCase %>Model, <%= nameProperCase %>Options>;
38
+ // Registration property for type safety - actual value injected by @kosModel
39
+ // decorator; the annotation must match the decorator's singleton flag (the
40
+ // decorator injects SingletonKosModelRegistrationFactory when singleton: true,
41
+ // KosModelRegistrationFactory when false).
42
+ static Registration: <%= singleton === false ? "KosModelRegistrationType" : "SingletonKosModelRegistrationFactory" %><
43
+ <%= nameProperCase %>Model,
44
+ <%= nameProperCase %>Options
45
+ >;
39
46
 
40
47
 
41
48
  id: string;