@kosdev-code/kos-ddk-models 0.1.0-dev.5171 → 0.1.0-dev.5179

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.
@@ -1,4 +1,7 @@
1
+ /**
2
+ * (C) Copyright 2024, TCCC, All rights reserved.
3
+ */
4
+ export { TroubleAction as TroubleActionManager } from './trouble-action-model';
1
5
  export type { TroubleActionModel as TroubleActionManagerModel } from './trouble-action-model';
2
- export { TroubleAction as TroubleActionManager } from './trouble-action-registration';
3
6
  export type { TroubleActionData as TroubleActionManagerData, TroubleActionOptions as TroubleActionManagerOptions, } from './types';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/trouble-action/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACtF,YAAY,EACV,iBAAiB,IAAI,wBAAwB,EAC7C,oBAAoB,IAAI,2BAA2B,GACpD,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/trouble-action/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,YAAY,EACV,iBAAiB,IAAI,wBAAwB,EAC7C,oBAAoB,IAAI,2BAA2B,GACpD,MAAM,SAAS,CAAC"}
@@ -1,20 +1,277 @@
1
1
  import { TroubleActionOptions } from './types';
2
- import { IKosDataModel, IKosIdentifiable, KosCreationContext, KosData, PublicModelInterface } from '../../../../../sdk/kos-ui-sdk/src/index.ts';
2
+ import { IKosDataModel, IKosIdentifiable, KosCreationContext, KosData, KosLoggerAware, PublicModelInterface, SingletonKosModelRegistrationFactory } from '../../../../../sdk/kos-ui-sdk/src/index.ts';
3
3
 
4
+ /**
5
+ * Model type identifier for the TroubleAction singleton model.
6
+ *
7
+ * This constant is used for model registration and identification within
8
+ * the KOS framework. As a singleton model, only one instance exists per
9
+ * application lifecycle.
10
+ *
11
+ * @category Model Configuration
12
+ */
4
13
  export declare const MODEL_TYPE = "trouble-action-model";
14
+ /**
15
+ * Public interface type for the TroubleActionModel.
16
+ *
17
+ * This type represents the publicly accessible interface of the TroubleActionModel,
18
+ * exposing only the methods and properties intended for external consumption.
19
+ * Use this type when declaring dependencies on the TroubleActionModel.
20
+ *
21
+ * @category Model Types
22
+ * @see {@link TroubleActionModelImpl} for the implementation details
23
+ */
5
24
  export type TroubleActionModel = PublicModelInterface<TroubleActionModelImpl>;
25
+ /**
26
+ * Interface definition for TroubleActionModel implementation.
27
+ *
28
+ * Manages trouble action state by monitoring active troubles and mapping them
29
+ * to configurable state key-value pairs. This singleton model acts as a centralized
30
+ * coordinator between the trouble system and UI state management.
31
+ *
32
+ * @author Mark Pomerant (mark@matrica.ca)
33
+ * @version 2.1.1
34
+ * @category Model Interface
35
+ */
36
+ export interface TroubleActionModelImpl extends KosLoggerAware {
37
+ }
38
+ /**
39
+ * Singleton model that manages trouble action state for beverage dispensing systems.
40
+ *
41
+ * The TroubleActionModel monitors active troubles in the system and maintains a
42
+ * reactive state object that maps trouble types to configured state values. This
43
+ * enables UI components to respond to trouble conditions without directly coupling
44
+ * to the trouble system.
45
+ *
46
+ * **Key Features:**
47
+ * - Singleton model ensuring single source of truth for trouble action state
48
+ * - Automatic synchronization with TroubleContainer changes
49
+ * - Configurable mapping between trouble types and state representations
50
+ * - Reactive state updates via KosData observables
51
+ * - Support for custom state keys and values per trouble type
52
+ *
53
+ * **Architecture:**
54
+ * - Depends on TroubleContainerModel for trouble data
55
+ * - Uses @kosModelEffect for reactive trouble monitoring
56
+ * - Maintains internal mapping of trouble definitions to state values
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * // Register and create the singleton TroubleActionModel
61
+ * import { TroubleAction } from '@kosdev-code/kos-ddk-models';
62
+ *
63
+ * const troubleActionModel = TroubleAction.instance().options({
64
+ * definitions: [
65
+ * {
66
+ * troubleType: 'InsufficientAgitationTrouble',
67
+ * stateKey: 'agitationRequired',
68
+ * stateValue: 'true'
69
+ * },
70
+ * {
71
+ * troubleType: 'CartridgeEmptyTrouble',
72
+ * stateKey: 'cartridgeStatus',
73
+ * stateValue: 'empty'
74
+ * }
75
+ * ]
76
+ * }).build();
77
+ *
78
+ * // Access state in React components
79
+ * const agitationRequired = troubleActionModel.state.agitationRequired;
80
+ * ```
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // Monitor active trouble in a React component
85
+ * import { useKosModel } from '@kosdev-code/kos-ui-sdk';
86
+ * import { TroubleAction } from '@kosdev-code/kos-ddk-models';
87
+ *
88
+ * function TroubleIndicator() {
89
+ * const troubleAction = useKosModel(TroubleAction);
90
+ * const activeTroubleType = troubleAction.activeTroubleType;
91
+ *
92
+ * if (!activeTroubleType) {
93
+ * return <div>No active troubles</div>;
94
+ * }
95
+ *
96
+ * return <div>Active: {activeTroubleType}</div>;
97
+ * }
98
+ * ```
99
+ *
100
+ * @category DDK Models
101
+ * @see {@link TroubleContainerModel} for the underlying trouble data source
102
+ * @see {@link TroubleActionOptions} for configuration options
103
+ * @see {@link TroubleActionData} for trouble definition structure
104
+ */
6
105
  export declare class TroubleActionModelImpl implements IKosDataModel, IKosIdentifiable {
106
+ /**
107
+ * Registration factory for creating TroubleActionModel instances.
108
+ *
109
+ * This static property is automatically populated by the @kosModel decorator
110
+ * and provides the registration interface for creating and configuring the
111
+ * singleton TroubleActionModel instance.
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * const troubleAction = TroubleActionModelImpl.Registration
116
+ * .instance()
117
+ * .options({ definitions: [...] })
118
+ * .build();
119
+ * ```
120
+ *
121
+ * @category Model Registration
122
+ */
123
+ static Registration: SingletonKosModelRegistrationFactory<TroubleActionModel, TroubleActionOptions>;
124
+ /**
125
+ * Unique identifier for this model instance.
126
+ *
127
+ * Set during construction and used for model lifecycle management
128
+ * and debugging purposes.
129
+ *
130
+ * @category Model Properties
131
+ */
7
132
  id: string;
8
- private logger;
133
+ /**
134
+ * Dependency on the TroubleContainer singleton model.
135
+ *
136
+ * Provides access to the system's active troubles collection. Changes to
137
+ * the trouble container automatically trigger state updates via the
138
+ * handleTroubleActions effect.
139
+ *
140
+ * @category Dependencies
141
+ * @see {@link TroubleContainerModel}
142
+ */
9
143
  private troubleContainer;
10
- private disposer?;
144
+ /**
145
+ * Observable state object mapping trouble state keys to values.
146
+ *
147
+ * This reactive state object is automatically updated when troubles are
148
+ * added or removed from the system. Keys and values are determined by
149
+ * the trouble action definitions provided during model initialization.
150
+ *
151
+ * State keys that no longer have associated active troubles are set to
152
+ * undefined.
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * // Access state values
157
+ * const isAgitationRequired = troubleActionModel.state.agitationRequired;
158
+ *
159
+ * // State is reactive - updates automatically propagate to React components
160
+ * ```
161
+ *
162
+ * @category Model State
163
+ */
11
164
  state: KosData<Record<string, string | undefined>>;
165
+ /**
166
+ * Internal mapping of trouble types to their action definitions.
167
+ *
168
+ * Built from the definitions array provided in TroubleActionOptions during
169
+ * construction. Used for efficient lookup when processing trouble changes.
170
+ *
171
+ * @category Internal State
172
+ */
12
173
  private troubleActionData;
174
+ /**
175
+ * Creates a new TroubleActionModel instance.
176
+ *
177
+ * Initializes the model with trouble action definitions that map trouble
178
+ * types to state key-value pairs. The model begins monitoring the trouble
179
+ * container immediately upon creation.
180
+ *
181
+ * @param modelId - Unique identifier for this model instance
182
+ * @param options - Configuration options containing trouble action definitions
183
+ * @param context - KOS creation context providing logger and framework services
184
+ *
185
+ * @category Lifecycle
186
+ */
13
187
  constructor(modelId: string, options: TroubleActionOptions, context: KosCreationContext);
188
+ /**
189
+ * Gets the first active trouble that has an associated action definition.
190
+ *
191
+ * Returns the first trouble found that matches any of the configured trouble
192
+ * action definitions. If multiple troubles are active, priority is determined
193
+ * by the order of trouble type keys in the troubleActionData object.
194
+ *
195
+ * @returns The active trouble model, or undefined if no matching troubles exist
196
+ *
197
+ * @example
198
+ * ```typescript
199
+ * const trouble = troubleActionModel.activeTrouble;
200
+ * if (trouble) {
201
+ * console.log(`Active trouble: ${trouble.type}`);
202
+ * console.log(`Resolvable: ${trouble.resolvable}`);
203
+ * }
204
+ * ```
205
+ *
206
+ * @category Trouble Access
207
+ * @see {@link TroubleContainerModel} for trouble data structure
208
+ */
14
209
  get activeTrouble(): import('../../../../../sdk/kos-ui-sdk/src/index.ts').TroubleModel<any> | undefined;
210
+ /**
211
+ * Gets the type of the first active trouble with an associated action definition.
212
+ *
213
+ * Convenience getter that extracts the trouble type from the active trouble.
214
+ * Commonly used for conditional UI rendering based on trouble type.
215
+ *
216
+ * @returns The active trouble type string, or undefined if no troubles are active
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * const troubleType = troubleActionModel.activeTroubleType;
221
+ * if (troubleType === 'InsufficientAgitationTrouble') {
222
+ * // Show agitation required UI
223
+ * }
224
+ * ```
225
+ *
226
+ * @category Trouble Access
227
+ */
15
228
  get activeTroubleType(): string | undefined;
16
- init(): Promise<void>;
17
- unload(): void;
18
- load(): Promise<void>;
229
+ /**
230
+ * Reactive effect that synchronizes trouble action state with active troubles.
231
+ *
232
+ * Automatically called when the trouble container's data changes. Updates the
233
+ * model's state object to reflect current trouble conditions:
234
+ * - Adds state entries for newly active troubles
235
+ * - Removes state entries (sets to undefined) for resolved troubles
236
+ * - Uses configured stateKey and stateValue from trouble definitions
237
+ *
238
+ * The effect dependencies ensure this method runs whenever troubles are added
239
+ * or removed from the system.
240
+ *
241
+ * @remarks
242
+ * This method is decorated with @kosModelEffect to establish reactive dependencies
243
+ * on the trouble container's data. It should not be called directly.
244
+ *
245
+ * @category Effects
246
+ * @see {@link kosModelEffect} for reactive effect pattern documentation
247
+ */
248
+ handleTroubleActions(): void;
19
249
  }
250
+ /**
251
+ * Singleton registration factory for the TroubleActionModel.
252
+ *
253
+ * Use this export to create and configure the TroubleAction singleton model
254
+ * in your application. The factory provides a fluent interface for instance
255
+ * creation and configuration.
256
+ *
257
+ * @example
258
+ * ```typescript
259
+ * import { TroubleAction } from '@kosdev-code/kos-ddk-models';
260
+ *
261
+ * const troubleAction = TroubleAction.instance().options({
262
+ * definitions: [
263
+ * {
264
+ * troubleType: 'InsufficientAgitationTrouble',
265
+ * stateKey: 'agitationRequired',
266
+ * stateValue: 'true'
267
+ * }
268
+ * ]
269
+ * }).build();
270
+ * ```
271
+ *
272
+ * @category Model Registration
273
+ * @see {@link TroubleActionModel} for the model interface
274
+ * @see {@link TroubleActionOptions} for configuration options
275
+ */
276
+ export declare const TroubleAction: SingletonKosModelRegistrationFactory<TroubleActionModel, TroubleActionOptions>;
20
277
  //# sourceMappingURL=trouble-action-model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trouble-action-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/trouble-action/trouble-action-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAEhB,kBAAkB,EAClB,OAAO,EACP,oBAAoB,EAErB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEvE,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;AAE9E,qBACa,sBAAuB,YAAW,aAAa,EAAE,gBAAgB;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,CAAmB;IAGjC,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACnD,OAAO,CAAC,iBAAiB,CAAoC;gBAE3D,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,kBAAkB;IAa7B,IAAI,aAAa,oEAgBhB;IAED,IAAI,iBAAiB,uBAEpB;IACK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B3B,MAAM,IAAI,IAAI;IAGR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5B"}
1
+ {"version":3,"file":"trouble-action-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/trouble-action/trouble-action-model.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,oCAAoC,EAErC,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EAAqB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;AAE9E;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;CAAG;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,qBAEa,sBAAuB,YAAW,aAAa,EAAE,gBAAgB;IAC5E;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,YAAY,EAAE,oCAAoC,CACvD,kBAAkB,EAClB,oBAAoB,CACrB,CAAC;IAEF;;;;;;;OAOG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;;;OASG;IAEH,OAAO,CAAC,gBAAgB,CAAyB;IAEjD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAEnD;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB,CAAoC;IAE7D;;;;;;;;;;;;OAYG;gBAED,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,kBAAkB;IAa7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,aAAa,oEAgBhB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,iBAAiB,uBAEpB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IAIH,oBAAoB;CAsBrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,gFAAsC,CAAC"}
@@ -1,8 +1,103 @@
1
+ /**
2
+ * Definition for a single trouble action mapping.
3
+ *
4
+ * Describes how a specific trouble type should be represented in the
5
+ * TroubleActionModel's state object. Each definition maps a trouble type
6
+ * to a state key-value pair that UI components can observe.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const agitationTroubleAction: TroubleActionData = {
11
+ * troubleType: 'InsufficientAgitationTrouble',
12
+ * stateKey: 'agitationRequired',
13
+ * stateValue: 'true'
14
+ * };
15
+ * ```
16
+ *
17
+ * @category Trouble Configuration
18
+ * @see {@link TroubleActionOptions} for how definitions are provided to the model
19
+ */
1
20
  export interface TroubleActionData {
21
+ /**
22
+ * The trouble type identifier to monitor.
23
+ *
24
+ * Must match the type property of trouble objects in the TroubleContainer.
25
+ * When a trouble of this type becomes active, the associated state entry
26
+ * will be created.
27
+ *
28
+ * @example "InsufficientAgitationTrouble"
29
+ * @example "CartridgeEmptyTrouble"
30
+ */
2
31
  troubleType: string;
32
+
33
+ /**
34
+ * The key to use in the state object for this trouble.
35
+ *
36
+ * Defines the property name in the TroubleActionModel's state object.
37
+ * UI components will observe this key to react to the trouble condition.
38
+ *
39
+ * @example "agitationRequired"
40
+ * @example "cartridgeStatus"
41
+ */
3
42
  stateKey: string;
43
+
44
+ /**
45
+ * The value to set in the state object when this trouble is active.
46
+ *
47
+ * When the trouble becomes active, this value is assigned to the stateKey.
48
+ * When the trouble is resolved, the stateKey is set to undefined.
49
+ *
50
+ * @example "true"
51
+ * @example "empty"
52
+ * @example "maintenance_required"
53
+ */
4
54
  stateValue: string;
5
55
  }
56
+
57
+ /**
58
+ * Configuration options for the TroubleActionModel.
59
+ *
60
+ * Provides the trouble action definitions that configure how the model
61
+ * maps active troubles to state values. These definitions are processed
62
+ * during model initialization to establish the trouble monitoring behavior.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const options: TroubleActionOptions = {
67
+ * definitions: [
68
+ * {
69
+ * troubleType: 'InsufficientAgitationTrouble',
70
+ * stateKey: 'agitationRequired',
71
+ * stateValue: 'true'
72
+ * },
73
+ * {
74
+ * troubleType: 'CartridgeEmptyTrouble',
75
+ * stateKey: 'cartridgeStatus',
76
+ * stateValue: 'empty'
77
+ * },
78
+ * {
79
+ * troubleType: 'MaintenanceRequiredTrouble',
80
+ * stateKey: 'systemStatus',
81
+ * stateValue: 'maintenance'
82
+ * }
83
+ * ]
84
+ * };
85
+ * ```
86
+ *
87
+ * @category Model Configuration
88
+ * @see {@link TroubleActionData} for individual definition structure
89
+ * @see {@link TroubleActionModel} for how options are used during initialization
90
+ */
6
91
  export interface TroubleActionOptions {
92
+ /**
93
+ * Array of trouble action definitions to monitor.
94
+ *
95
+ * Each definition maps a specific trouble type to a state representation.
96
+ * The model will monitor all defined trouble types and update its state
97
+ * object accordingly when troubles become active or are resolved.
98
+ *
99
+ * The order of definitions affects priority when accessing the activeTrouble
100
+ * getter - the first matching trouble in the array will be returned.
101
+ */
7
102
  definitions: TroubleActionData[];
8
103
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ddk-models",
3
- "version": "0.1.0-dev.5171",
3
+ "version": "0.1.0-dev.5179",
4
4
  "dependencies": {
5
- "@kosdev-code/kos-ui-sdk": "0.1.0-dev.5171",
6
- "@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5171",
7
- "@kosdev-code/kos-freestyle-sdk": "0.1.0-dev.5171"
5
+ "@kosdev-code/kos-ui-sdk": "0.1.0-dev.5179",
6
+ "@kosdev-code/kos-dispense-sdk": "0.1.0-dev.5179",
7
+ "@kosdev-code/kos-freestyle-sdk": "0.1.0-dev.5179"
8
8
  },
9
9
  "main": "./index.js",
10
10
  "module": "./index.mjs",
11
11
  "typings": "./index.d.ts",
12
12
  "kos": {
13
13
  "build": {
14
- "gitHash": "1d786a161cc932e527dcb745658df6d6a1c836e5"
14
+ "gitHash": "3cccaa001498c93157d1c1ba3d006f453b0c061a"
15
15
  }
16
16
  },
17
17
  "publishConfig": {
@@ -1,89 +0,0 @@
1
- import { TroubleActionModel } from './trouble-action-model';
2
- import { TroubleActionOptions } from './types';
3
- import { SingletonKosModelRegistrationFactory } from '../../../../../sdk/kos-ui-sdk/src/index.ts';
4
-
5
- /**
6
- * # TroubleAction
7
- *
8
- * The registration bean includes convenience methods for creating and working with TroubleActionModel instances.
9
- *
10
- * ## type
11
- * The type property is a string that identifies the model type.
12
- * The type is used to identify the model type in the model registry and to narrow down the model type in type predicates. It's most frequently
13
- * used when declaring dependencies on models.
14
- *
15
- * @example
16
- * ```typescript
17
- *
18
- * @kosDependency({modelType: TroubleAction.type, id: "troubleActionId"})
19
- * private troubleActionModel: TroubleActionModel;
20
- * ```
21
- *
22
- *
23
- * ## factory
24
- *
25
- * The factory method creates a factory function that can be used to create new TroubleActionModel instances.
26
- *
27
-
28
- * As this is a singleton model, the factory function accepts the model options as its argument.
29
- *
30
- * If a model with the same model type already exists, the factory function will return the existing model. The options will be ignored
31
- * in this case and the existing model will be returned in its current state.
32
- *
33
- * @example
34
- * ```typescript
35
- * const model = TroubleAction.factory({
36
- * // Add option data
37
- * });
38
- * ```
39
-
40
-
41
- *
42
- * ## predicate
43
- *
44
- * [Typescript type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function that will identify and narrow down a model to a TroubleActionModel.
45
- *
46
- * @example
47
- * ```typescript
48
- *
49
- * const model: IKosDataModel = ...; // some model
50
- *
51
- * if (TroubleAction.predicate(model)) {
52
- * // if the function evaluates to true, the model is narrowed down to TroubleActionModel
53
- * // and the compiler will know that the model has the TroubleActionModel interface
54
- * model.updateAvailability(false);
55
- * }
56
- * ```
57
- *
58
- * ## registration
59
- *
60
- * The registration property is an object that can be used to simplify registration of the model with the model registry. The registration object
61
- * can be spread into the model registration and provides all of the required information to register the model implementation class against the model type.
62
- *
63
- *
64
- * @example
65
- *
66
- * In an application registration file you can declare the model registration as follows:
67
- *
68
- * **registration.ts**
69
- * ```typescript
70
- * import { TroubleAction } from "@kos-ui/project-models";
71
- * import { KosModelRegistry } from "@kosdev-code/kos-dispense-sdk";
72
- *
73
- * import { initKosProvider } from "@kosdev-code/kos-ui-sdk";
74
- *
75
- * KosModelRegistry.dispense
76
- * .models()
77
- * .model(TroubleAction);
78
- * ```
79
- *
80
- * ## registration.singleton
81
-
82
- * The troubleAction model is a singleton model. This means that each time the factory function is called , the same instance will be returned.
83
- * If the model does not yet exist, it will be created passing in the provided options to initialize it.
84
- *
85
- * Singleton models don't require an ID as they will use the model type as their ID to guarantee uniqueness throughout the system.
86
-
87
- * */
88
- export declare const TroubleAction: SingletonKosModelRegistrationFactory<TroubleActionModel, TroubleActionOptions>;
89
- //# sourceMappingURL=trouble-action-registration.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trouble-action-registration.d.ts","sourceRoot":"","sources":["../../../../../../packages/ddk/kos-ddk-models/src/lib/trouble-action/trouble-action-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkFK;AACL,eAAO,MAAM,aAAa,gFAMxB,CAAC"}