@kosdev-code/kos-codegen-core 0.1.0-next.898 → 0.1.0-next.899

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-codegen-core",
3
- "version": "0.1.0-next.898",
3
+ "version": "0.1.0-next.899",
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": "b64d9a0431aa83daea7eba6b84d7b39db7d47ea9"
28
+ "gitHash": "b8878a98f4225c7538607ea6354cc32f798bba0c"
29
29
  }
30
30
  }
31
31
  }
@@ -11,12 +11,11 @@
11
11
  import type {
12
12
  IKosDataModel
13
13
  } from "../../../core/core/kosModel";
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";
14
+ import type { KosRegistrationFor } from "../../../core/core/registration/model-registration";
15
+ import type { IKosIdentifiable } from "../../../core/core/types";
17
16
  import type { PublicModelInterface } from "../../../core/types";
18
17
  <% } else { %>import { kosModel, kosContainerAware, type KosContainerAware } 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";<% } %>
18
+ import { type KosRegistrationFor, IKosDataModel, IKosIdentifiable, PublicModelInterface, kosLoggerAware, type KosLoggerAware } from "@kosdev-code/kos-ui-sdk";<% } %>
20
19
 
21
20
 
22
21
  import type { <%= nameProperCase %>Options } from "./types";
@@ -30,19 +29,16 @@ export type <%= nameProperCase %>Model = PublicModelInterface<<%= nameProperCase
30
29
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
31
30
  export interface <%= nameProperCase %>ModelImpl extends KosLoggerAware, KosContainerAware<<%= modelNameProperCase %>Model> {}
32
31
 
33
- @kosModel({ modelTypeId: MODEL_TYPE, singleton: <%= singleton === false ? "false" : "true" %><% if (autoRegister) { %>, autoRegister: true<% } %> })
32
+ // Flipping `singleton` here moves the Registration type with it.
33
+ export const MODEL_CONFIG = { modelTypeId: MODEL_TYPE, singleton: <%= singleton === false ? "false" : "true" %><% if (autoRegister) { %>, autoRegister: true<% } %> } as const;
34
+
35
+ @kosModel(MODEL_CONFIG)
34
36
  @kosContainerAware<<%= modelNameProperCase %>Model>()
35
37
  @kosLoggerAware()
36
38
  export class <%= nameProperCase %>ModelImpl implements IKosIdentifiable, IKosDataModel {
37
39
 
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
- >;
40
+ // Registration property for type safety - actual value injected by @kosModel decorator
41
+ static Registration: KosRegistrationFor<typeof MODEL_CONFIG, <%= nameProperCase %>Model, <%= nameProperCase %>Options>;
46
42
 
47
43
 
48
44
  id: string;