@kosdev-code/kos-ui-sdk 2.1.17 → 2.1.19
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/companion-instantiator.d.ts +71 -0
- package/core/core/companion-instantiator.d.ts.map +1 -0
- package/core/core/decorators/fsm-injection-utils.d.ts +16 -0
- package/core/core/decorators/fsm-injection-utils.d.ts.map +1 -0
- package/core/core/decorators/index.d.ts +4 -0
- package/core/core/decorators/index.d.ts.map +1 -1
- package/core/core/decorators/kos-companion.d.ts +19 -0
- package/core/core/decorators/kos-companion.d.ts.map +1 -1
- package/core/core/decorators/kos-execution-context.d.ts +60 -0
- package/core/core/decorators/kos-execution-context.d.ts.map +1 -0
- package/core/core/decorators/kos-service-request.d.ts +381 -0
- package/core/core/decorators/kos-service-request.d.ts.map +1 -0
- package/core/core/decorators/kos-state-machine.d.ts +466 -0
- package/core/core/decorators/kos-state-machine.d.ts.map +1 -0
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/decorators/kosTopicHandler.d.ts +33 -5
- package/core/core/decorators/kosTopicHandler.d.ts.map +1 -1
- package/core/core/decorators/propKeys.d.ts +4 -0
- package/core/core/decorators/propKeys.d.ts.map +1 -1
- package/core/core/kos-registration.d.ts.map +1 -1
- package/core/core/kos-singleton-registration.d.ts.map +1 -1
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/kosModel.d.ts +14 -0
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/kosModelManager.d.ts +11 -1
- package/core/core/kosModelManager.d.ts.map +1 -1
- package/core/core/model/kos-model-component-factory.d.ts +4 -0
- package/core/core/model/kos-model-component-factory.d.ts.map +1 -1
- package/core/core/model/kos-offline-queue.d.ts +78 -1
- package/core/core/model/kos-offline-queue.d.ts.map +1 -1
- package/core/core/model/kos-service-request-manager.d.ts +102 -0
- package/core/core/model/kos-service-request-manager.d.ts.map +1 -0
- package/core/core/model/kos-subscription-manager.d.ts +18 -0
- package/core/core/model/kos-subscription-manager.d.ts.map +1 -1
- package/core/core/model/model-introspection-utils.d.ts +1 -0
- package/core/core/model/model-introspection-utils.d.ts.map +1 -1
- package/core/core/model/service-response-store.d.ts +164 -0
- package/core/core/model/service-response-store.d.ts.map +1 -0
- package/core/core/model-instantiator.d.ts +19 -0
- package/core/core/model-instantiator.d.ts.map +1 -1
- package/core/core/types/registration.d.ts +7 -0
- package/core/core/types/registration.d.ts.map +1 -1
- package/core/types/index.d.ts +1 -0
- package/core/types/index.d.ts.map +1 -1
- package/core/types/service-response-store.d.ts +152 -0
- package/core/types/service-response-store.d.ts.map +1 -0
- package/core/util/index.d.ts +1 -0
- package/core/util/index.d.ts.map +1 -1
- package/core/util/kos-service-request.d.ts +8 -0
- package/core/util/kos-service-request.d.ts.map +1 -1
- package/core/util/observable-proxy-map.d.ts.map +1 -1
- package/core/util/service-response.d.ts +110 -0
- package/core/util/service-response.d.ts.map +1 -0
- package/index.cjs +79 -79
- package/index.cjs.map +1 -1
- package/index.js +8226 -6847
- package/index.js.map +1 -1
- package/models/decorators/future-service.d.ts +7 -0
- package/models/decorators/future-service.d.ts.map +1 -1
- package/models/models/translation/translation-model.d.ts.map +1 -1
- package/models/utils/client.d.ts +8 -8
- package/models/utils/service.d.ts +66 -10
- package/models/utils/service.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response retention policies for ServiceResponseStore
|
|
3
|
+
* Controls how long service responses are cached and when they're cleaned up
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ResponseRetention {
|
|
6
|
+
/**
|
|
7
|
+
* Clear immediately after handler completes
|
|
8
|
+
* Use for one-time operations with no caching needs
|
|
9
|
+
*
|
|
10
|
+
* Note: Response remains available during handler execution (including async handlers).
|
|
11
|
+
* Cleanup happens AFTER the handler returns/resolves via ServiceRequestManager.
|
|
12
|
+
*/
|
|
13
|
+
IMMEDIATE = "immediate",
|
|
14
|
+
/**
|
|
15
|
+
* Keep until next response for same path
|
|
16
|
+
* Default behavior - previous response replaced on new request
|
|
17
|
+
*/
|
|
18
|
+
SINGLE = "single",
|
|
19
|
+
/**
|
|
20
|
+
* Keep for specified duration (ms)
|
|
21
|
+
* Automatic cleanup after TTL expires
|
|
22
|
+
*/
|
|
23
|
+
TTL = "ttl",
|
|
24
|
+
/**
|
|
25
|
+
* Keep until model is destroyed
|
|
26
|
+
* Use for data needed throughout model lifetime
|
|
27
|
+
*/
|
|
28
|
+
PERMANENT = "permanent",
|
|
29
|
+
/**
|
|
30
|
+
* Keep until explicitly cleared
|
|
31
|
+
* Manual cleanup required via clearServiceResponse()
|
|
32
|
+
*/
|
|
33
|
+
MANUAL = "manual"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for response caching behavior
|
|
37
|
+
*/
|
|
38
|
+
export interface ResponseCacheConfig {
|
|
39
|
+
/**
|
|
40
|
+
* Retention policy determining when response is cleaned up
|
|
41
|
+
*/
|
|
42
|
+
retention: ResponseRetention;
|
|
43
|
+
/**
|
|
44
|
+
* Time-to-live in milliseconds (required for TTL retention)
|
|
45
|
+
*/
|
|
46
|
+
ttl?: number;
|
|
47
|
+
/**
|
|
48
|
+
* For TTL retention: extend TTL instead of replacing data on new request
|
|
49
|
+
*
|
|
50
|
+
* When false (default): New request clears old data and stores new data with fresh TTL
|
|
51
|
+
* When true: If cached data exists and hasn't expired, extend TTL without replacing data
|
|
52
|
+
*
|
|
53
|
+
* Use extendOnRefresh=true to avoid re-running expensive operations when cached data is still valid.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Replace on each request (default)
|
|
59
|
+
* cache: { retention: ResponseRetention.TTL, ttl: 5 * 60 * 1000 }
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Extend TTL on refresh - avoid re-fetching if cache valid
|
|
63
|
+
* cache: { retention: ResponseRetention.TTL, ttl: 5 * 60 * 1000, extendOnRefresh: true }
|
|
64
|
+
*/
|
|
65
|
+
extendOnRefresh?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum number of responses to cache per path (future use)
|
|
68
|
+
*/
|
|
69
|
+
maxSize?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Replay strategy for baseline-delta race condition handling
|
|
73
|
+
* Determines which queued events to replay after baseline loads
|
|
74
|
+
*/
|
|
75
|
+
export declare enum ReplayStrategy {
|
|
76
|
+
/**
|
|
77
|
+
* Replay all queued events
|
|
78
|
+
* Use for: State machines, audit trails requiring complete event history
|
|
79
|
+
*/
|
|
80
|
+
ALL = "all",
|
|
81
|
+
/**
|
|
82
|
+
* Replay events received at or after baseline request was sent
|
|
83
|
+
* Use for: High-frequency idempotent updates (quantities, sensor readings, status)
|
|
84
|
+
*/
|
|
85
|
+
AFTER_REQUEST = "after-request",
|
|
86
|
+
/**
|
|
87
|
+
* Replay events received at or after baseline response was received
|
|
88
|
+
* Use for: Low-frequency config where baseline likely includes recent changes
|
|
89
|
+
*/
|
|
90
|
+
AFTER_RESPONSE = "after-response",
|
|
91
|
+
/**
|
|
92
|
+
* Discard all queued events
|
|
93
|
+
* Use for: Baseline is always complete source of truth
|
|
94
|
+
*/
|
|
95
|
+
NONE = "none"
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Baseline dependency configuration for topic handlers
|
|
99
|
+
*/
|
|
100
|
+
export interface BaselineDependency {
|
|
101
|
+
/**
|
|
102
|
+
* API path of the baseline request this handler depends on
|
|
103
|
+
*/
|
|
104
|
+
path: string;
|
|
105
|
+
/**
|
|
106
|
+
* HTTP method of the baseline request
|
|
107
|
+
* @default 'get'
|
|
108
|
+
*/
|
|
109
|
+
method?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Strategy for replaying queued events after baseline loads
|
|
112
|
+
* @default ReplayStrategy.AFTER_REQUEST
|
|
113
|
+
*/
|
|
114
|
+
replayStrategy?: ReplayStrategy;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Cached response with metadata
|
|
118
|
+
*/
|
|
119
|
+
export interface CachedResponse<T = unknown> {
|
|
120
|
+
/**
|
|
121
|
+
* The response data
|
|
122
|
+
*/
|
|
123
|
+
data: T;
|
|
124
|
+
/**
|
|
125
|
+
* When the response was cached (timestamp)
|
|
126
|
+
* @deprecated Use requestedAt or receivedAt for temporal comparisons
|
|
127
|
+
*/
|
|
128
|
+
timestamp: number;
|
|
129
|
+
/**
|
|
130
|
+
* When the HTTP request was sent (timestamp)
|
|
131
|
+
* Used for baseline-delta temporal filtering
|
|
132
|
+
*/
|
|
133
|
+
requestedAt: number;
|
|
134
|
+
/**
|
|
135
|
+
* When the HTTP response was received (timestamp)
|
|
136
|
+
* Used for baseline-delta temporal filtering
|
|
137
|
+
*/
|
|
138
|
+
receivedAt: number;
|
|
139
|
+
/**
|
|
140
|
+
* The API path this response came from
|
|
141
|
+
*/
|
|
142
|
+
path: string;
|
|
143
|
+
/**
|
|
144
|
+
* The HTTP method used
|
|
145
|
+
*/
|
|
146
|
+
method: string;
|
|
147
|
+
/**
|
|
148
|
+
* When this response expires (for TTL retention)
|
|
149
|
+
*/
|
|
150
|
+
expiresAt?: number;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=service-response-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-response-store.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/types/service-response-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B;;;;;;OAMG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,MAAM,WAAW;IAEjB;;;OAGG;IACH,GAAG,QAAQ;IAEX;;;OAGG;IACH,SAAS,cAAc;IAEvB;;;OAGG;IACH,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,SAAS,EAAE,iBAAiB,CAAC;IAE7B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB;;;OAGG;IACH,GAAG,QAAQ;IAEX;;;OAGG;IACH,aAAa,kBAAkB;IAE/B;;;OAGG;IACH,cAAc,mBAAmB;IAEjC;;;OAGG;IACH,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/core/util/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './paired-client-heartbeat';
|
|
|
26
26
|
export * from './pipe';
|
|
27
27
|
export * from './retry-with-exponential-backoff';
|
|
28
28
|
export * from './service-factory';
|
|
29
|
+
export * from './service-response';
|
|
29
30
|
export * from './session-utils';
|
|
30
31
|
export * from './wait-for-request';
|
|
31
32
|
export * from './when-ready';
|
package/core/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,QAAQ,CAAC;AACvB,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,QAAQ,CAAC;AACvB,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
@@ -49,6 +49,14 @@ export type ClientResponse<Paths extends Record<string, any>, K extends keyof Pa
|
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
} ? R[keyof R] : unknown;
|
|
52
|
+
export type ClientParams<Paths extends Record<string, any>, K extends keyof Paths, M extends AvailableMethods<Paths[K]> | string> = Paths[K][M] extends {
|
|
53
|
+
parameters: infer P;
|
|
54
|
+
} ? P : never;
|
|
55
|
+
export type ClientBody<Paths extends Record<string, any>, K extends keyof Paths, M extends AvailableMethods<Paths[K]> | string> = Paths[K][M] extends {
|
|
56
|
+
requestBody: {
|
|
57
|
+
content: infer B;
|
|
58
|
+
};
|
|
59
|
+
} ? B[keyof B] : never;
|
|
52
60
|
export type ServiceResponse<T> = [string, null] | [null, T];
|
|
53
61
|
export type DeepRequired<T> = {
|
|
54
62
|
[K in keyof T]-?: T[K] extends object ? DeepRequired<T[K]> : T[K];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-service-request.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/kos-service-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;CAI1B,CAAC;AAIF,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,CAAC;CAC7D,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,OAAO,CACvC,YAAY,CAAC,CAAC,CAAC,EACf,YAAY,GAAG,aAAa,CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;KAC5B,MAAM,IAAI,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;SAC5C,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,SAAS,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;KAClE,CAAC,MAAM,CAAC,GAAG,MAAM;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,SAAS,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;KAAE,CAAC;CAC7E,CAAC;AAEF,KAAK,eAAe,CAClB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,CAAC,SAAS,MAAM,KAAK,IACnB,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS;IAAE,UAAU,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAEhE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CAAC,GACV,KAAK,CAAC;AASV,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,CAAC,SAAS,MAAM,KAAK,EACrB,CAAC,SAAS,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAC3C,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IAAE,SAAS,EAAE;QAAE,GAAG,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC,CAAA;SAAE,CAAA;KAAE,CAAA;CAAE,GAChE,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"kos-service-request.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/kos-service-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;CAI1B,CAAC;AAIF,KAAK,YAAY,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,CAAC;CAC7D,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,OAAO,CACvC,YAAY,CAAC,CAAC,CAAC,EACf,YAAY,GAAG,aAAa,CAC7B,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;KAC5B,MAAM,IAAI,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG;SAC5C,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,SAAS,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;KAClE,CAAC,MAAM,CAAC,GAAG,MAAM;SAAG,CAAC,IAAI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CAAC,CAAC,GAAG,MAAM,IAC3C,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IAAE,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;CAAE,GACzD,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,KAAK,CAAC;AAEV,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAE5D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClE,CAAC;AACF,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAmD/D,KAAK,cAAc,GAAG,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC;AAC/D,wBAAgB,YAAY,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;sRAQ9C,cAAc;qVAOd,cAAc;gVAQd,cAAc;4VAOd,cAAc;EAU7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable-proxy-map.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/observable-proxy-map.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,eAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"observable-proxy-map.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/observable-proxy-map.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AA+G7D,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG;IACpD,SAAS,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;IACrC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAClB,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IACrB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,cAAc,gDACX,CAAC,KACd,QAAQ,CAAC,CAGX,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { IKosDataModel } from '../core/kosModel';
|
|
2
|
+
import { ApiPath, HttpMethod } from '../core/decorators/kos-service-request';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Utility functions for accessing cached service responses from ServiceResponseStore
|
|
6
|
+
*
|
|
7
|
+
* These functions provide type-safe access to responses stored by @kosServiceRequest
|
|
8
|
+
* decorated methods, eliminating the need for "magic last parameter" patterns.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* @kosServiceRequest({
|
|
13
|
+
* path: PATH_INGREDIENTS,
|
|
14
|
+
* method: 'get',
|
|
15
|
+
* lifecycle: DependencyLifecycle.LOAD
|
|
16
|
+
* })
|
|
17
|
+
* private onIngredientsLoaded(): void {
|
|
18
|
+
* const response = getServiceResponse(this, PATH_INGREDIENTS, 'get');
|
|
19
|
+
* this.processIngredients(response.data.ingredients);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Get cached service response by path and method
|
|
25
|
+
*
|
|
26
|
+
* Returns the response data cached by @kosServiceRequest decorated methods.
|
|
27
|
+
* TypeScript will infer types from your OpenAPI schema when using typed path constants.
|
|
28
|
+
*
|
|
29
|
+
* For cross-package scenarios where OpenAPI specs differ, you can optionally
|
|
30
|
+
* provide an explicit type parameter.
|
|
31
|
+
*
|
|
32
|
+
* @param model - The KOS model instance
|
|
33
|
+
* @param path - The API path constant
|
|
34
|
+
* @param method - The HTTP method (defaults to 'get')
|
|
35
|
+
* @returns The cached response data, or undefined if not found/expired
|
|
36
|
+
*
|
|
37
|
+
* @example Standard usage (types inferred from OpenAPI)
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const status = getServiceResponse(this, PATH_DEVICE_STATUS, 'get');
|
|
40
|
+
* // TypeScript infers the type from PATH_DEVICE_STATUS
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example Cross-package usage with explicit type (when OpenAPI schemas differ)
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // Studio models using different OpenAPI than main SDK
|
|
46
|
+
* const vms = getServiceResponse<StudioVMResponse>(this, PATH_VMS, 'get');
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function getServiceResponse<T = any>(model: IKosDataModel, path: ApiPath, method?: HttpMethod): T | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a cached response exists for the given path and method
|
|
52
|
+
*
|
|
53
|
+
* @param model - The KOS model instance
|
|
54
|
+
* @param path - The API path constant
|
|
55
|
+
* @param method - The HTTP method (defaults to 'get')
|
|
56
|
+
* @returns true if a valid cached response exists
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* if (hasCachedResponse(this, PATH_DEVICE_STATUS, 'get')) {
|
|
61
|
+
* // Use cached data
|
|
62
|
+
* const status = getServiceResponse(this, PATH_DEVICE_STATUS, 'get');
|
|
63
|
+
* } else {
|
|
64
|
+
* // Fetch fresh data
|
|
65
|
+
* await this.refreshStatus();
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function hasCachedResponse(model: IKosDataModel, path: ApiPath, method?: HttpMethod): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Manually clear a cached service response
|
|
72
|
+
*
|
|
73
|
+
* @param model - The KOS model instance
|
|
74
|
+
* @param path - The API path constant
|
|
75
|
+
* @param method - The HTTP method (defaults to 'get')
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // Clear cached response to force refresh on next request
|
|
80
|
+
* clearServiceResponse(this, PATH_TEMP_DATA, 'post');
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function clearServiceResponse(model: IKosDataModel, path: ApiPath, method?: HttpMethod): void;
|
|
84
|
+
/**
|
|
85
|
+
* Clear all cached responses for a specific path (all methods)
|
|
86
|
+
*
|
|
87
|
+
* @param model - The KOS model instance
|
|
88
|
+
* @param path - The API path constant
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // Clear all cached responses for this endpoint
|
|
93
|
+
* clearPath(this, PATH_INGREDIENTS);
|
|
94
|
+
* // Clears GET, POST, PUT, DELETE responses for this path
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare function clearPath(model: IKosDataModel, path: ApiPath): void;
|
|
98
|
+
/**
|
|
99
|
+
* Clear all cached service responses in the model
|
|
100
|
+
*
|
|
101
|
+
* @param model - The KOS model instance
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Clear all cached responses (typically during model cleanup)
|
|
106
|
+
* clearAllServiceResponses(this);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function clearAllServiceResponses(model: IKosDataModel): void;
|
|
110
|
+
//# sourceMappingURL=service-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-response.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/core/util/service-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,UAAU,EACX,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,GAAG,EACxC,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,UAAkB,GACzB,CAAC,GAAG,SAAS,CAOf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,UAAkB,GACzB,OAAO,CAOT;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,UAAkB,GACzB,IAAI,CAON;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAOnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAOnE"}
|