@kosdev-code/kos-ui-sdk 2.0.3 → 2.0.6
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/core/core/api/wrapPromise.d.ts +1 -1
- package/core/core/decorators/kos-child.d.ts +1 -1
- package/core/core/decorators/kos-model-effect.d.ts +4 -1
- package/core/core/decorators/kos-model-effect.d.ts.map +1 -1
- package/core/core/decorators/kosDependency.d.ts +1 -1
- package/core/core/decorators/kosModel.d.ts +3 -3
- package/core/core/decorators/kosTopicHandler.d.ts +1 -1
- package/core/core/dependency-manager.d.ts +9 -0
- package/core/core/dependency-manager.d.ts.map +1 -0
- package/core/core/extension/initialize-extension.d.ts +1 -1
- package/core/core/kosModel.d.ts +2 -4
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/kosModelManager.d.ts +181 -32
- package/core/core/kosModelManager.d.ts.map +1 -1
- package/core/core/model-cache.d.ts +28 -0
- package/core/core/model-cache.d.ts.map +1 -0
- package/core/core/model-instantiator.d.ts +15 -0
- package/core/core/model-instantiator.d.ts.map +1 -0
- package/core/core/model-registry.d.ts +16 -0
- package/core/core/model-registry.d.ts.map +1 -0
- package/core/types/model.d.ts +1 -1
- package/core/util/date-utils.d.ts +102 -0
- package/core/util/date-utils.d.ts.map +1 -1
- package/core/util/index.d.ts +1 -0
- package/core/util/index.d.ts.map +1 -1
- package/core/util/kos-model-utils.d.ts +27 -27
- package/core/util/model-attribute-utils.d.ts +1 -1
- package/core/util/service-factory.d.ts +1 -1
- package/index.cjs +47 -46
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3065 -2726
- package/index.js.map +1 -1
- package/models/models/studio-properties/index.d.ts +5 -0
- package/models/models/studio-properties/index.d.ts.map +1 -0
- package/models/models/studio-properties/services/index.d.ts +2 -0
- package/models/models/studio-properties/services/index.d.ts.map +1 -0
- package/models/models/studio-properties/services/studio-properties-services.d.ts +15 -0
- package/models/models/studio-properties/services/studio-properties-services.d.ts.map +1 -0
- package/models/models/studio-properties/studio-properties-model.d.ts +20 -0
- package/models/models/studio-properties/studio-properties-model.d.ts.map +1 -0
- package/models/models/studio-properties/studio-properties-registration.d.ts +87 -0
- package/models/models/studio-properties/studio-properties-registration.d.ts.map +1 -0
- package/models/models/studio-properties/types/index.d.ts +3 -0
- package/models/utils/client.d.ts +3 -3
- package/models/utils/openapi.d.ts +1441 -6928
- package/models/utils/persistence-store.d.ts +1 -1
- package/models/utils/service.d.ts +3 -3
- package/models/utils/types.d.ts +3 -3
- package/models/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/ui/components/loading-message/index.d.ts +2 -1
- package/ui/components/loading-message/index.d.ts.map +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Utility function that will wrap an arbitrary promise in order for it to
|
|
3
3
|
* conform to the React Suspense API. By utilizing this higher order function
|
|
4
4
|
* React components can participate in the Suspense workflow and enable the application
|
|
5
|
-
* to display fallback behaviour while
|
|
5
|
+
* to display fallback behaviour while KOS data models or APIs are being fetched.
|
|
6
6
|
*
|
|
7
7
|
* @param promise The promise to be resolved
|
|
8
8
|
* @returns an Object with a single `read` function that will be used to broadcast
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @param target - The target object or class.
|
|
14
14
|
* @param name - The name of the property to be marked as a child model.
|
|
15
15
|
* @returns A decorator function that marks the property as a child model.
|
|
16
|
-
* @category
|
|
16
|
+
* @category KOS Model Decorator
|
|
17
17
|
*/
|
|
18
18
|
export declare const kosChild: (target: {} | any, name: PropertyKey) => any;
|
|
19
19
|
//# sourceMappingURL=kos-child.d.ts.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
interface KosModelEffectProps<T = any> {
|
|
2
2
|
dependencies: (model: T) => any[];
|
|
3
|
+
options?: {
|
|
4
|
+
fireImmediately?: boolean;
|
|
5
|
+
};
|
|
3
6
|
}
|
|
4
7
|
/**
|
|
5
8
|
* Decorator for defining a Kos model effect function within a Kos Data Model class.
|
|
@@ -18,7 +21,7 @@ interface KosModelEffectProps<T = any> {
|
|
|
18
21
|
* }
|
|
19
22
|
* }
|
|
20
23
|
* ```
|
|
21
|
-
* @category
|
|
24
|
+
* @category KOS Model Decorator
|
|
22
25
|
*/
|
|
23
26
|
export declare function kosModelEffect<T = any>(props?: KosModelEffectProps<T>): (target: T, _propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
24
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-model-effect.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/core/core/decorators/kos-model-effect.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB,CAAC,CAAC,GAAG,GAAG;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"kos-model-effect.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/core/core/decorators/kos-model-effect.ts"],"names":[],"mappings":"AAGA,UAAU,mBAAmB,CAAC,CAAC,GAAG,GAAG;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE;QACR,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;CACH;AACD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,YACpD,CAAC,gBAAgB,MAAM,cAAc,kBAAkB,UAWxE"}
|
|
@@ -10,7 +10,7 @@ export * as KosDependencyTypes from '../../types/kos-dependency';
|
|
|
10
10
|
* @param params.options The options to be passed to the model constructor.
|
|
11
11
|
* @param params.lifecycle The lifecycle at which the dependency should be injected.
|
|
12
12
|
*
|
|
13
|
-
* @category
|
|
13
|
+
* @category KOS Model Decorator
|
|
14
14
|
* */
|
|
15
15
|
export declare const kosDependency: <Options = unknown>({ modelType, id, options, lifecycle, }: KosDependencyParams<Options>) => (target: {} | any, name: PropertyKey) => any;
|
|
16
16
|
//# sourceMappingURL=kosDependency.d.ts.map
|
|
@@ -6,9 +6,9 @@ interface DecoratedKosModel<T extends IKosDataModel = IKosDataModel> {
|
|
|
6
6
|
/**
|
|
7
7
|
* Decorator for defining a Kos Data Model class.
|
|
8
8
|
*
|
|
9
|
-
* The decorator will prepare the class instance to use as a
|
|
9
|
+
* The decorator will prepare the class instance to use as a KOS Data Model meaning:
|
|
10
10
|
* 1. The properties on the class will be observable meaning that any changes to them will be tracked and trigger updates to any subscribers.
|
|
11
|
-
* 2. Methods will be treated as
|
|
11
|
+
* 2. Methods will be treated as KOS Actions meaning that they will encapsulate any model mutations and will result in atomic updates to the model.
|
|
12
12
|
* 3. The class will be able to register topic handlers to receive messages from the backend and from other models.
|
|
13
13
|
* 4. The model will participate in the model lifecycle and will be initialized, activated, and disposed at the appropriate times.
|
|
14
14
|
*
|
|
@@ -16,7 +16,7 @@ interface DecoratedKosModel<T extends IKosDataModel = IKosDataModel> {
|
|
|
16
16
|
* @param id - The unique identifier for the data model.
|
|
17
17
|
* @returns A decorator function that defines a Kos Data Model class.
|
|
18
18
|
*
|
|
19
|
-
* @category
|
|
19
|
+
* @category KOS Model Decorator
|
|
20
20
|
*/
|
|
21
21
|
export declare const kosModel: <T extends IKosDataModel = any, O extends object = Record<string, any>>(id: string) => (constructor: DecoratedKosModel<T>) => any;
|
|
22
22
|
export {};
|
|
@@ -72,7 +72,7 @@ export interface IKosTopicHandlerParams<Response = any, Model extends IKosDataMo
|
|
|
72
72
|
* }
|
|
73
73
|
* }
|
|
74
74
|
* ```
|
|
75
|
-
* @category
|
|
75
|
+
* @category KOS Model Decorator
|
|
76
76
|
*/
|
|
77
77
|
export declare function kosTopicHandler<Response = any, Model extends IKosDataModel = any, TransformedResponse = Response>({ topic, condition, transform, websocket, fos, bridge, skipParse, lifecycle, }: IKosTopicHandlerParams<Response, Model, TransformedResponse>): (target: any, _propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
78
78
|
//# sourceMappingURL=kosTopicHandler.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class KosDependencyManager {
|
|
2
|
+
private _usedByCache;
|
|
3
|
+
private _usesCache;
|
|
4
|
+
add(modelId: string, dependencyId: string): void;
|
|
5
|
+
remove(modelId: string, dependencyId: string): void;
|
|
6
|
+
canDestroy(modelId: string): boolean;
|
|
7
|
+
clear(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dependency-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/dependency-manager.ts"],"names":[],"mappings":"AAOA,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,UAAU,CAA+B;IAEjD,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAYzC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAc5C,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IASpC,KAAK;CAIN"}
|
|
@@ -13,7 +13,7 @@ export interface ContextDataExtensionPoint<D extends object, T extends object> e
|
|
|
13
13
|
/**
|
|
14
14
|
* Executes an extension point and adds the value to the specified context
|
|
15
15
|
* @param options The options for the extension point
|
|
16
|
-
* @param options.context The
|
|
16
|
+
* @param options.context The KOS model context to add the value to. If not specified, the value will not be added to any context.
|
|
17
17
|
* @param options.extension The extension point to execute
|
|
18
18
|
*
|
|
19
19
|
* @returns The value returned from the extension point
|
package/core/core/kosModel.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IKosModelManager } from './types/kos-model-manager-types';
|
|
2
1
|
import { IKosIdentifiable, KosParentAware } from './types';
|
|
3
2
|
import { KosLog } from './log';
|
|
4
3
|
import { fsm } from './lifecycle/kosModelLifecycle';
|
|
@@ -77,7 +76,6 @@ interface KosModelParameters<DataType extends IKosDataModel> {
|
|
|
77
76
|
modelTypeName: string;
|
|
78
77
|
id?: string | number;
|
|
79
78
|
modelData: DataType;
|
|
80
|
-
modelManager: IKosModelManager;
|
|
81
79
|
}
|
|
82
80
|
interface IKosCreateParam<Options extends object = Record<string, any>> {
|
|
83
81
|
id?: string;
|
|
@@ -109,9 +107,8 @@ export declare class KosModel<DataDef extends IKosDataModel = IKosDataModel> imp
|
|
|
109
107
|
_offlineQueue: any[];
|
|
110
108
|
fsmService: ReturnType<typeof fsm>;
|
|
111
109
|
private disposers;
|
|
112
|
-
private modelManager;
|
|
113
110
|
private _companionModels;
|
|
114
|
-
constructor({ modelTypeName, id, modelData
|
|
111
|
+
constructor({ modelTypeName, id, modelData }: KosModelParameters<DataDef>);
|
|
115
112
|
get companionModels(): Map<string, IKosModel<IKosDataModel>>;
|
|
116
113
|
set status(status: KosModelState);
|
|
117
114
|
get status(): KosModelState;
|
|
@@ -121,6 +118,7 @@ export declare class KosModel<DataDef extends IKosDataModel = IKosDataModel> imp
|
|
|
121
118
|
set activeStatus(activeStatus: KosModelState);
|
|
122
119
|
get onlineStatus(): KosModelState;
|
|
123
120
|
set onlineStatus(onlineStatus: KosModelState);
|
|
121
|
+
get modelManager(): any;
|
|
124
122
|
isActive(): boolean;
|
|
125
123
|
isOnline(): boolean;
|
|
126
124
|
isReady(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kosModel.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/kosModel.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAQ9D,OAAO,EACL,UAAU,EACV,cAAc,EAEf,MAAM,+BAA+B,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AAO,CAAC,IAAI,CAAC;IA0BzB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IA0BhC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA2B1B,KAAK;IAsCL,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA8DrB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyC3B,qBAAqB,CAAC,aAAa,KAAA,EAAE,aAAa,KAAA,EAAE,OAAO,KAAA;IAgBrD,mBAAmB,CAAC,SAAS,CAAC,EAAE,mBAAmB;IA+BnD,MAAM;IAON,OAAO;IAUb,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC;IAGtC,WAAW,IAAI,SAAS,EAAE;IAgB1B,oBAAoB;IAIpB,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC;IAIjD,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI3C,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,aAAa,EAAE;IAO5E,qBAAqB,IAAI,aAAa,EAAE;IAIxC,oBAAoB,CAAC,cAAc,EAAE,gBAAgB,EAAE,GAAG,SAAS,EAAE;CAetE"}
|
|
@@ -1,58 +1,207 @@
|
|
|
1
1
|
import { IKosRegistry, KosCompanionModelType } from './types/registration';
|
|
2
2
|
import { IKosModelManager } from './types/kos-model-manager-types';
|
|
3
3
|
import { IKosDataModel, IKosDataModelBuilder, IKosModel } from './kosModel';
|
|
4
|
-
import {
|
|
4
|
+
import { BaseKosModelRegistrationBean } from '../types';
|
|
5
5
|
|
|
6
6
|
export declare const MODEL_DELETION_DELAY = 10;
|
|
7
7
|
export declare class KosModelManager implements IKosModelManager {
|
|
8
|
-
private
|
|
8
|
+
private cache;
|
|
9
|
+
private instantiator;
|
|
10
|
+
private dependencies;
|
|
9
11
|
private _registry;
|
|
10
|
-
private _usesCache;
|
|
11
|
-
private _isPreloaded;
|
|
12
|
-
private _preloaded;
|
|
13
|
-
private _usedByCache;
|
|
14
|
-
private _toDelete;
|
|
15
12
|
private constructor();
|
|
13
|
+
static create(registry: IKosRegistry, reset?: boolean): KosModelManager;
|
|
14
|
+
static getInstance(reset?: boolean): KosModelManager;
|
|
16
15
|
get registry(): IKosRegistry;
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves the preloaded models from the registry. If the models have already been
|
|
18
|
+
* preloaded, it returns the cached preloaded models. Otherwise, it initializes and
|
|
19
|
+
* preloads the models based on the registry's `preloadModels` configuration.
|
|
20
|
+
*
|
|
21
|
+
* @returns An array of preloaded model instances.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* - Logs debug information during the preloading process.
|
|
25
|
+
* - Logs an error if returning cached preloaded models.
|
|
26
|
+
* - Supports both string-based model keys and object-based model configurations.
|
|
27
|
+
*/
|
|
18
28
|
get preloadedModels(): IKosModel<IKosDataModel>[];
|
|
19
29
|
get models(): IKosModel<IKosDataModel>[];
|
|
20
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves a model by its unique identifier.
|
|
32
|
+
*
|
|
33
|
+
* @template T - The type of the data model extending `IKosDataModel`.
|
|
34
|
+
* @param id - The unique identifier of the model to retrieve.
|
|
35
|
+
* @returns The model associated with the given ID as `IKosModel<T>`, or `undefined` if the model is marked for deletion.
|
|
36
|
+
*/
|
|
37
|
+
getModelById<T extends IKosDataModel>(id: string): IKosModel<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a model to the manager. If a model with the same ID already exists,
|
|
40
|
+
* it returns the existing model instead of adding the new one.
|
|
41
|
+
*
|
|
42
|
+
* @template T - The type of the data model extending `IKosDataModel`.
|
|
43
|
+
* @param model - The model to be added, implementing `IKosModel<T>`.
|
|
44
|
+
* @returns The active model, either the existing one with the same ID or the newly added model.
|
|
45
|
+
*/
|
|
21
46
|
addModel<T extends IKosDataModel>(model: IKosModel<T>): IKosModel<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Removes a model from the manager and performs cleanup operations.
|
|
49
|
+
*
|
|
50
|
+
* This method traverses the model hierarchy, invoking the `accept` method
|
|
51
|
+
* on each child model to allow for recursive processing. During traversal,
|
|
52
|
+
* it performs the following actions:
|
|
53
|
+
* - Calls the `offline` method on the model, if defined.
|
|
54
|
+
* - Clears any companion models associated with the model.
|
|
55
|
+
* - Deletes the model's context from the `KosContextManager`.
|
|
56
|
+
* - Removes the model from the internal `_modelsById` and `_toDelete` maps.
|
|
57
|
+
*
|
|
58
|
+
* @param model - The model to be removed. Must implement the `IKosModel` interface.
|
|
59
|
+
*/
|
|
60
|
+
removeModel(model: IKosModel): void;
|
|
61
|
+
/**
|
|
62
|
+
* Checks if a model with the specified ID exists.
|
|
63
|
+
*
|
|
64
|
+
* @param modelId - The unique identifier of the model to check. Optional.
|
|
65
|
+
* @returns `true` if the model ID is provided and a model with the given ID exists; otherwise, `false`.
|
|
66
|
+
*/
|
|
22
67
|
hasModel(modelId?: string): boolean;
|
|
23
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves a list of models of a specific type that satisfy the provided filter criteria.
|
|
70
|
+
*
|
|
71
|
+
* @template T - The type of the data model extending `IKosDataModel`.
|
|
72
|
+
* @param typeId - The identifier of the model type to filter by.
|
|
73
|
+
* @param modelFilter - A callback function used to filter models. It receives a model of type `T` and should return `true` if the model passes the filter, or `false` otherwise.
|
|
74
|
+
* @returns An array of models of type `T` that match the specified type and filter criteria.
|
|
75
|
+
*/
|
|
24
76
|
getModelsByType<T extends IKosDataModel>(typeId: string, modelFilter: (model: T) => boolean): T[];
|
|
25
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Retrieves the subscriptions associated with a specific model type.
|
|
79
|
+
*
|
|
80
|
+
* @param typeId - The unique identifier of the model type.
|
|
81
|
+
* @returns An object containing the subscriptions for the specified model type,
|
|
82
|
+
* or an empty object if the model type is not registered.
|
|
83
|
+
*/
|
|
26
84
|
getModelSubscriptions(typeId: string): Record<string, import('./types/registration').IKosSubscriptionSpecification>;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves the data model builder for a specified model type.
|
|
87
|
+
*
|
|
88
|
+
* @template D - The type of the data used by the model.
|
|
89
|
+
* @template M - The type of the data model that extends `IKosDataModel`.
|
|
90
|
+
* @param typeId - The unique identifier for the model type.
|
|
91
|
+
* @returns An instance of `IKosDataModelBuilder` for the specified model type,
|
|
92
|
+
* or `undefined` if the model type is not registered.
|
|
93
|
+
*/
|
|
94
|
+
getDataModelBuilder<D, M extends IKosDataModel>(typeId: string): IKosDataModelBuilder<D, M>;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves a model factory function for the specified model type.
|
|
97
|
+
*
|
|
98
|
+
* @template T - The type of the data model that extends `IKosDataModel`.
|
|
99
|
+
* @param modelType - A string representing the type of the model.
|
|
100
|
+
* @returns A factory function for creating instances of the specified model type.
|
|
101
|
+
*/
|
|
102
|
+
getModelFactory<T extends IKosDataModel>(modelType: string): import('../types').ModelFactory<T, {}>;
|
|
103
|
+
/**
|
|
104
|
+
* Adds a dependency relationship between two models.
|
|
105
|
+
*
|
|
106
|
+
* This method establishes a "uses" relationship where the model identified
|
|
107
|
+
* by `modelId` depends on the model identified by `dependencyId`. It ensures
|
|
108
|
+
* that the dependency is not marked for deletion and restores it from the
|
|
109
|
+
* delete cache if necessary. The relationship is then recorded in both the
|
|
110
|
+
* `_usedByCache` and `_usesCache` for efficient lookup.
|
|
111
|
+
*
|
|
112
|
+
* @param modelId - The identifier of the model that depends on the dependency.
|
|
113
|
+
* @param dependencyId - The identifier of the model being depended upon.
|
|
114
|
+
*/
|
|
30
115
|
addDependency(modelId: string, dependencyId: string): void;
|
|
116
|
+
/**
|
|
117
|
+
* Removes a dependency relationship between two models.
|
|
118
|
+
*
|
|
119
|
+
* This method updates the internal caches to reflect that the specified
|
|
120
|
+
* `modelId` no longer depends on the `dependencyId`. It removes the
|
|
121
|
+
* `modelId` from the list of models that use the `dependencyId` and
|
|
122
|
+
* removes the `dependencyId` from the list of dependencies used by the
|
|
123
|
+
* `modelId`.
|
|
124
|
+
*
|
|
125
|
+
* @param modelId - The ID of the model that has the dependency.
|
|
126
|
+
* @param dependencyId - The ID of the dependency to be removed.
|
|
127
|
+
*/
|
|
31
128
|
removeDependency(modelId: string, dependencyId: string): void;
|
|
129
|
+
/**
|
|
130
|
+
* Reloads the specified model by its ID. If the model exists and is found
|
|
131
|
+
* by its ID, it transitions the model to the RESETTING state using the
|
|
132
|
+
* RESET event.
|
|
133
|
+
*
|
|
134
|
+
* @param model - The data model to be reloaded. Must implement the `IKosDataModel` interface.
|
|
135
|
+
* The `id` property of the model is used to locate the corresponding model.
|
|
136
|
+
*
|
|
137
|
+
* @returns A promise that resolves once the model has been transitioned, or does nothing
|
|
138
|
+
* if the model ID is not provided or the model is not found.
|
|
139
|
+
*/
|
|
32
140
|
reloadModel(model: IKosDataModel): Promise<void>;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
141
|
+
/**
|
|
142
|
+
* Initiates the destruction process for a given model.
|
|
143
|
+
*
|
|
144
|
+
* This method checks if the model can be destroyed and, if so, schedules it for deletion.
|
|
145
|
+
* The model is removed from the internal `_modelsById` map and added to the `_toDelete` map.
|
|
146
|
+
* A deletion task is then queued with a delay, during which the model will be destroyed.
|
|
147
|
+
*
|
|
148
|
+
* @param model - The model to be destroyed. Must implement the `IKosDataModel` interface.
|
|
149
|
+
* @throws {Error} If the model does not have a valid `id`.
|
|
150
|
+
*/
|
|
41
151
|
initiateDestroyModel(model: IKosDataModel): Promise<void>;
|
|
42
|
-
registerCompanionModel(typeId: string, companionRegistration: KosCompanionModelType<any>): void;
|
|
43
|
-
registerModel<T extends BaseKosModelRegistrationBean<any, any>>(modelRegistration: T): void;
|
|
44
152
|
/**
|
|
45
|
-
* Destroys
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
*
|
|
153
|
+
* Destroys the specified model if it meets the criteria for destruction.
|
|
154
|
+
*
|
|
155
|
+
* @param model - The model to be destroyed, implementing the `IKosModel` interface.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* This method checks if the model has a valid `modelId` and if it can be destroyed
|
|
159
|
+
* by invoking the `canDestroyModel` method. If the conditions are met, it performs
|
|
160
|
+
* the following actions:
|
|
161
|
+
* 1. Calls the `unload` method on the model, if it exists.
|
|
162
|
+
* 2. Removes the model from the manager using the `removeModel` method.
|
|
163
|
+
*
|
|
164
|
+
* @throws This method does not explicitly throw errors, but any errors occurring
|
|
165
|
+
* during the `unload` or `removeModel` operations will propagate to the caller.
|
|
166
|
+
*/
|
|
50
167
|
destroyModel(model: IKosModel): Promise<void>;
|
|
51
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Creates an instance of a model based on the specified type ID and optional model ID.
|
|
170
|
+
* If the model already exists, it retrieves the existing instance; otherwise, it creates a new one.
|
|
171
|
+
*
|
|
172
|
+
* @template DataDef - The type of the data model, extending `IKosDataModel`.
|
|
173
|
+
* @param typeId - The unique identifier for the type of model to create.
|
|
174
|
+
* @param id - An optional unique identifier for the specific model instance. If not provided,
|
|
175
|
+
* the `typeId` is used for singleton models.
|
|
176
|
+
* @param options - An optional record of additional options to pass to the model creation process.
|
|
177
|
+
* @returns An object containing the created or retrieved model instance and its associated data.
|
|
178
|
+
*/
|
|
179
|
+
createModelInstance<DataDef extends IKosDataModel>(typeId: string, id?: string, options?: Record<string, any>): {
|
|
52
180
|
model: IKosModel<DataDef>;
|
|
53
181
|
data: DataDef;
|
|
54
182
|
};
|
|
55
|
-
|
|
56
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Registers a companion model for a specific type identifier.
|
|
185
|
+
*
|
|
186
|
+
* This method ensures that the companion model is added to the registry
|
|
187
|
+
* for the given `typeId`. If a companion model of the same type already
|
|
188
|
+
* exists for the `typeId`, it will not be added again.
|
|
189
|
+
*
|
|
190
|
+
* @param typeId - The unique identifier for the type to which the companion model belongs.
|
|
191
|
+
* @param companionRegistration - The companion model type to register.
|
|
192
|
+
*/
|
|
193
|
+
registerCompanionModel(typeId: string, companionRegistration: KosCompanionModelType<any>): void;
|
|
194
|
+
/**
|
|
195
|
+
* Registers a new model type in the model manager if it is not already registered.
|
|
196
|
+
*
|
|
197
|
+
* @template T - A type that extends `BaseKosModelRegistrationBean` with specific type and registration details.
|
|
198
|
+
* @param reg - The registration object containing the type identifier and registration details for the model.
|
|
199
|
+
*
|
|
200
|
+
* @remarks
|
|
201
|
+
* - If the model type is not already present in the registry, it logs the registration
|
|
202
|
+
* and updates the registry with the new model type.
|
|
203
|
+
* - The `type` property of the registration object is used as the unique identifier for the model type.
|
|
204
|
+
*/
|
|
205
|
+
registerModel<T extends BaseKosModelRegistrationBean<any, any>>(reg: T): void;
|
|
57
206
|
}
|
|
58
207
|
//# sourceMappingURL=kosModelManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kosModelManager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/kosModelManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kosModelManager.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/kosModelManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAI7D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,eAAO,MAAM,oBAAoB,KAAK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aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAKnD;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAItD;;;;;;;;;;OAUG;IACG,WAAW,CAAC,KAAK,EAAE,aAAa;IAYtC;;;;;;;;;OASG;IACG,oBAAoB,CAAC,KAAK,EAAE,aAAa;IAc/C;;;;;;;;;;;;;;OAcG;IACG,YAAY,CAAC,KAAK,EAAE,SAAS;IAOnC;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,OAAO,SAAS,aAAa,EAC/C,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;;;;IAKnC;;;;;;;;;OASG;IACH,sBAAsB,CACpB,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE,qBAAqB,CAAC,GAAG,CAAC;IAKnD;;;;;;;;;;OAUG;IACH,aAAa,CAAC,CAAC,SAAS,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;CAGvE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IKosDataModel, IKosModel } from './kosModel';
|
|
2
|
+
|
|
3
|
+
export type KosModelCacheHandler = Pick<KosModelCache, "hasModel" | "restoreFromDeleteCache" | "addModel" | "getModelById">;
|
|
4
|
+
export declare class KosModelCache {
|
|
5
|
+
private preloadKeys;
|
|
6
|
+
private _modelsById;
|
|
7
|
+
private _toDelete;
|
|
8
|
+
private _preloaded;
|
|
9
|
+
private _isPreloaded;
|
|
10
|
+
constructor(preloadKeys?: (string | {
|
|
11
|
+
modelType: string;
|
|
12
|
+
modelId?: string;
|
|
13
|
+
options?: Record<string, any>;
|
|
14
|
+
})[]);
|
|
15
|
+
get models(): IKosModel[];
|
|
16
|
+
getModelById<T extends IKosDataModel = IKosDataModel>(id: string): IKosModel<T> | undefined;
|
|
17
|
+
addModel<T extends IKosModel>(model: T): T;
|
|
18
|
+
removeModel(modelId: string): void;
|
|
19
|
+
hasModel(modelId?: string): boolean;
|
|
20
|
+
restoreFromDeleteCache(modelId?: string): void;
|
|
21
|
+
markForDeletion(model: IKosModel): void;
|
|
22
|
+
preload(createFn: (key: string | {
|
|
23
|
+
modelType: string;
|
|
24
|
+
modelId?: string;
|
|
25
|
+
options?: Record<string, any>;
|
|
26
|
+
}) => IKosModel | undefined): IKosModel[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=model-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-cache.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/model-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK3D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,UAAU,GAAG,wBAAwB,GAAG,UAAU,GAAG,cAAc,CACpE,CAAC;AAEF,qBAAa,aAAa;IAOtB,OAAO,CAAC,WAAW;IANrB,OAAO,CAAC,WAAW,CAAgD;IACnE,OAAO,CAAC,SAAS,CAAgC;IACjD,OAAO,CAAC,UAAU,CAAmB;IACrC,OAAO,CAAC,YAAY,CAAS;gBAGnB,WAAW,GAAE,CACjB,MAAM,GACN;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CACzE,EAAO;IAGV,IAAI,MAAM,IAAI,SAAS,EAAE,CAIxB;IACD,YAAY,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,EAClD,EAAE,EAAE,MAAM,GACT,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS;IAM3B,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC;IAM1C,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKlC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAMnC,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ9C,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAKvC,OAAO,CACL,QAAQ,EAAE,CACR,GAAG,EACC,MAAM,GACN;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,KACvE,SAAS,GAAG,SAAS,GACzB,SAAS,EAAE;CAgBf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IKosRegistry } from './types';
|
|
2
|
+
import { KosModelCacheHandler } from './model-cache';
|
|
3
|
+
import { IKosDataModel, IKosModel } from './kosModel';
|
|
4
|
+
|
|
5
|
+
export declare class KosModelInstantiator {
|
|
6
|
+
private registry;
|
|
7
|
+
private cache;
|
|
8
|
+
constructor(registry: IKosRegistry, cache: KosModelCacheHandler);
|
|
9
|
+
createModelInstance<DataDef extends IKosDataModel>(typeId: string, id?: string, options?: Record<string, any>): {
|
|
10
|
+
model: IKosModel<DataDef>;
|
|
11
|
+
data: DataDef;
|
|
12
|
+
};
|
|
13
|
+
private _createCompanionModels;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=model-instantiator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-instantiator.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/model-instantiator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvE,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,KAAK;gBADL,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,oBAAoB;IAGrC,mBAAmB,CAAC,OAAO,SAAS,aAAa,EAC/C,MAAM,EAAE,MAAM,EACd,EAAE,CAAC,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAChC;QAAE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE;IAkC/C,OAAO,CAAC,sBAAsB;CAwB/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IKosRegistry, KosCompanionModelType } from './types/registration';
|
|
2
|
+
import { IKosDataModel, IKosDataModelBuilder } from './kosModel';
|
|
3
|
+
import { BaseKosModelRegistrationBean, ModelFactory } from '../types';
|
|
4
|
+
|
|
5
|
+
export declare class KosModelRegistry {
|
|
6
|
+
private _registry;
|
|
7
|
+
constructor(_registry: IKosRegistry);
|
|
8
|
+
get registry(): IKosRegistry;
|
|
9
|
+
getModelTypeRegistry(typeId: string): import('./types/registration').IKosModelRegistration;
|
|
10
|
+
registerModel<T extends BaseKosModelRegistrationBean<any, any>>(reg: T): void;
|
|
11
|
+
registerCompanionModel(typeId: string, companion: KosCompanionModelType<any>): void;
|
|
12
|
+
getModelSubscriptions(typeId: string): Record<string, import('./types/registration').IKosSubscriptionSpecification>;
|
|
13
|
+
getDataModelBuilder<D, M extends IKosDataModel>(typeId: string): IKosDataModelBuilder<D, M>;
|
|
14
|
+
getModelFactory<T extends IKosDataModel>(modelType: string): ModelFactory<T>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=model-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/core/model-registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,qBAAa,gBAAgB;IACf,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,YAAY;IAE3C,IAAI,QAAQ,IAAI,YAAY,CAE3B;IACD,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAOnC,aAAa,CAAC,CAAC,SAAS,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;IAOtE,sBAAsB,CACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,qBAAqB,CAAC,GAAG,CAAC;IAWvC,qBAAqB,CAAC,MAAM,EAAE,MAAM;IAIpC,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,aAAa,EAC5C,MAAM,EAAE,MAAM,GACb,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC;IAQ7B,eAAe,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC;CAG7E"}
|
package/core/types/model.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export interface BaseKosModelRegistrationBean<T extends IKosDataModel, O extends
|
|
|
59
59
|
* model.updateAvailability(false);
|
|
60
60
|
* }
|
|
61
61
|
* ```
|
|
62
|
-
* @typeParam T the type of the
|
|
62
|
+
* @typeParam T the type of the KOS Model
|
|
63
63
|
* **/
|
|
64
64
|
predicate: (model: IKosDataModel) => model is T;
|
|
65
65
|
factory: ModelFactoryRegistration<T, O>;
|
|
@@ -1,2 +1,104 @@
|
|
|
1
1
|
export declare function formatDateSince(date: Date): string;
|
|
2
|
+
export declare const isLeapYear: (year: number) => boolean;
|
|
3
|
+
export declare const getDaysInMonth: (year: number, month: number) => number;
|
|
4
|
+
export declare const addMonthsToDate: (date: Date, value: number) => Date;
|
|
5
|
+
export declare const addDaysToDate: (date: Date, value: number) => Date;
|
|
6
|
+
interface FormatDateOptions {
|
|
7
|
+
dateStyle?: "short" | "medium" | "long" | "full";
|
|
8
|
+
locales?: string | string[];
|
|
9
|
+
}
|
|
10
|
+
interface FormatTimeOptions {
|
|
11
|
+
timeStyle?: "short" | "medium" | "long" | "full";
|
|
12
|
+
locales?: string | string[];
|
|
13
|
+
}
|
|
14
|
+
interface FormatDateTimeOptions extends FormatDateOptions, FormatTimeOptions {
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats a date according to the specified `dateStyle` and locale.
|
|
18
|
+
*
|
|
19
|
+
* Uses `Intl.DateTimeFormat` internally.
|
|
20
|
+
*
|
|
21
|
+
* - `"short"` uses a custom format: `dd/mm/yyyy` (e.g., `31/12/2025`)
|
|
22
|
+
* - Other styles use built-in `Intl` formatting
|
|
23
|
+
*
|
|
24
|
+
* ### Example Output
|
|
25
|
+
* ```ts
|
|
26
|
+
* formatDate(new Date("2025-12-31"), { dateStyle: "short" }); // "31/12/2025"
|
|
27
|
+
* formatDate(new Date("2025-12-31"), { dateStyle: "medium" }); // "Dec 31, 2025"
|
|
28
|
+
* formatDate(new Date("2025-12-31"), { dateStyle: "long" }); // "December 31, 2025"
|
|
29
|
+
* formatDate(new Date("2025-12-31"), { dateStyle: "full" }); // "Wednesday, December 31, 2025"
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param date - The date object or timestamp to format.
|
|
33
|
+
* @param options - Options to customize formatting.
|
|
34
|
+
* @param options.dateStyle - One of `"short"`, `"medium"`, `"long"`, or `"full"`.
|
|
35
|
+
* @param options.locales - Optional locale string or array of locale strings.
|
|
36
|
+
* @returns A formatted date string.
|
|
37
|
+
*/
|
|
38
|
+
export declare const formatDate: (date?: Date | number, { dateStyle, locales }?: FormatDateOptions) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Formats a time according to the specified `timeStyle` and locale.
|
|
41
|
+
*
|
|
42
|
+
* Uses `Intl.DateTimeFormat` internally.
|
|
43
|
+
*
|
|
44
|
+
* ### Example Output
|
|
45
|
+
* ```ts
|
|
46
|
+
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "short" }); // "11:59 PM"
|
|
47
|
+
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "medium" }); // "11:59:59 PM"
|
|
48
|
+
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "long" }); // "11:59:59 PM EST"
|
|
49
|
+
* formatTime(new Date("2025-12-31T23:59:59"), { timeStyle: "full" }); // "11:59 PM Eastern Standard Time"
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param date - The date object or timestamp to extract the time from.
|
|
53
|
+
* @param options - Options to customize time formatting.
|
|
54
|
+
* @param options.timeStyle - One of `"short"`, `"medium"`, `"long"`, or `"full"`.
|
|
55
|
+
* @param options.locales - Optional locale string or locale array.
|
|
56
|
+
* @returns A formatted time string.
|
|
57
|
+
*/
|
|
58
|
+
export declare const formatTime: (date?: Date | number, { locales, timeStyle }?: FormatTimeOptions) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Formats a date and/or time using custom formatting logic based on `dateStyle` and `timeStyle`.
|
|
61
|
+
*
|
|
62
|
+
* Uses explicit `Intl.DateTimeFormat` options for full control over the output format.
|
|
63
|
+
*
|
|
64
|
+
* - `"short"` date is always `dd/mm/yyyy`
|
|
65
|
+
* - `"short"` time is always 12-hour format (e.g., `11:59 PM`)
|
|
66
|
+
* - Supports combining both formats into a single string
|
|
67
|
+
*
|
|
68
|
+
* ### Example Output
|
|
69
|
+
* ```ts
|
|
70
|
+
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
71
|
+
* dateStyle: "short",
|
|
72
|
+
* timeStyle: "short"
|
|
73
|
+
* }); // "31/12/2025, 11:59 PM"
|
|
74
|
+
*
|
|
75
|
+
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
76
|
+
* dateStyle: "medium",
|
|
77
|
+
* timeStyle: "medium"
|
|
78
|
+
* }); // "Dec 31, 2025, 11:59:59 PM"
|
|
79
|
+
*
|
|
80
|
+
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
81
|
+
* dateStyle: "long",
|
|
82
|
+
* timeStyle: "long"
|
|
83
|
+
* }); // "December 31, 2025, 11:59:59 PM EST"
|
|
84
|
+
*
|
|
85
|
+
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
86
|
+
* dateStyle: "full",
|
|
87
|
+
* timeStyle: "full"
|
|
88
|
+
* }); // "Wednesday, December 31, 2025, 11:59 PM Eastern Standard Time"
|
|
89
|
+
*
|
|
90
|
+
* formatDateTime(new Date("2025-12-31T23:59:59"), {
|
|
91
|
+
* timeStyle: "short"
|
|
92
|
+
* }); // "11:59 PM"
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @param date - The `Date` object or timestamp to format.
|
|
96
|
+
* @param options - Formatting options.
|
|
97
|
+
* @param options.dateStyle - Custom date format: `"short"`, `"medium"`, `"long"`, or `"full"`.
|
|
98
|
+
* @param options.timeStyle - Custom time format: `"short"`, `"medium"`, `"long"`, or `"full"`.
|
|
99
|
+
* @param options.locales - Optional locale string or locale array.
|
|
100
|
+
* @returns A string representing the formatted date and/or time.
|
|
101
|
+
*/
|
|
102
|
+
export declare const formatDateTime: (date?: Date | number, { dateStyle, locales, timeStyle, }?: FormatDateTimeOptions) => string;
|
|
103
|
+
export {};
|
|
2
104
|
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/date-utils.ts"],"names":[],"mappings":"AAcA,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,UAWzC"}
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/date-utils.ts"],"names":[],"mappings":"AAcA,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,UAWzC;AAED,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG,OACgB,CAAC;AAE3D,eAAO,MAAM,cAAc,SAAU,MAAM,SAAS,MAAM,KAAG,MAG1D,CAAC;AAEJ,eAAO,MAAM,eAAe,SAAU,IAAI,SAAS,MAAM,SAOxD,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,IAAI,SAAS,MAAM,SAItD,CAAC;AAIF,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,UAAU,qBAAsB,SAAQ,iBAAiB,EAAE,iBAAiB;CAAG;AA6D/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,UAAU,UACd,IAAI,GAAG,MAAM,2BAC+B,iBAAiB,WAOrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,eAAO,MAAM,UAAU,UACd,IAAI,GAAG,MAAM,2BAC+B,iBAAiB,WAOrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,eAAO,MAAM,cAAc,UAClB,IAAI,GAAG,MAAM,uCAKjB,qBAAqB,WAWzB,CAAC"}
|