@kosdev-code/kos-ui-sdk 3.0.35 → 3.0.36
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/model/kos-subscription-manager.d.ts.map +1 -1
- package/core/util/index.d.ts +2 -0
- package/core/util/index.d.ts.map +1 -1
- package/core/util/kos-local-topic.d.ts +73 -0
- package/core/util/kos-local-topic.d.ts.map +1 -0
- package/core/util/kos-topic-client.d.ts +79 -0
- package/core/util/kos-topic-client.d.ts.map +1 -0
- package/index.cjs +77 -7
- package/index.cjs.map +1 -1
- package/index.js +286 -216
- package/index.js.map +1 -1
- package/models/models/storage-device/storage-device-container-model.d.ts +4 -3
- package/models/models/storage-device/storage-device-container-model.d.ts.map +1 -1
- package/models/utils/index.d.ts +1 -0
- package/models/utils/index.d.ts.map +1 -1
- package/models/utils/topics/kos/daily/topic.d.ts +74 -0
- package/models/utils/topics/kos/daily/topic.d.ts.map +1 -0
- package/models/utils/topics/kos/daily/topics.d.ts +1026 -0
- package/models/utils/topics-index.d.ts +8 -0
- package/models/utils/topics-index.d.ts.map +1 -0
- package/package.json +2 -2
- package/{software-info-registration-Co9Wq_-n.js → software-info-registration-BhOmDkag.js} +311 -311
- package/software-info-registration-BhOmDkag.js.map +1 -0
- package/{software-info-registration-C-fplY8u.cjs → software-info-registration-JdgonknE.cjs} +10 -10
- package/software-info-registration-JdgonknE.cjs.map +1 -0
- package/testing.cjs +1 -1
- package/testing.js +1 -1
- package/software-info-registration-C-fplY8u.cjs.map +0 -1
- package/software-info-registration-Co9Wq_-n.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kos-subscription-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/model/kos-subscription-manager.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,qBAAa,sBAAsB;IAS/B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,GAAG;IAZb,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,UAAU,CAAqB;gBAG7B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,eAAe,EAC7B,GAAG,EAAE,qBAAqB;IAGpC,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAuErC,UAAU,IAAI,IAAI;IAsBlB,UAAU,IAAI,IAAI;IAwBlB,OAAO,CAAC,SAAS;IAkCjB,OAAO,CAAC,aAAa;IA4DrB,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,uBAAuB;IAgC/B,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"kos-subscription-manager.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ui-sdk/src/core/core/model/kos-subscription-manager.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,qBAAa,sBAAsB;IAS/B,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,GAAG;IAZb,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,UAAU,CAAqB;gBAG7B,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,eAAe,EAC7B,GAAG,EAAE,qBAAqB;IAGpC,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAuErC,UAAU,IAAI,IAAI;IAsBlB,UAAU,IAAI,IAAI;IAwBlB,OAAO,CAAC,SAAS;IAkCjB,OAAO,CAAC,aAAa;IA4DrB,OAAO,CAAC,sBAAsB;IAkB9B,OAAO,CAAC,uBAAuB;IAgC/B,OAAO,CAAC,kBAAkB;IAsB1B,OAAO,CAAC,cAAc;YAaR,wBAAwB;YAsCxB,mBAAmB;IAiEjC,OAAO,CAAC,wBAAwB;YAyDlB,YAAY;IA+B1B;;OAEG;IACI,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAYjD;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAkBvB;;;;;OAKG;IACI,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CA2CjD"}
|
package/core/util/index.d.ts
CHANGED
|
@@ -12,10 +12,12 @@ export * from './hsl-to-hex';
|
|
|
12
12
|
export * from './kos-config-init';
|
|
13
13
|
export * from './kos-data-mapper-utils';
|
|
14
14
|
export * from './kos-fetch';
|
|
15
|
+
export * from './kos-local-topic';
|
|
15
16
|
export * from './kos-message-utils';
|
|
16
17
|
export * from './kos-model-utils';
|
|
17
18
|
export * from './kos-model-visitor';
|
|
18
19
|
export * from './kos-service-request';
|
|
20
|
+
export * from './kos-topic-client';
|
|
19
21
|
export * from './log-utils';
|
|
20
22
|
export * from './middleware';
|
|
21
23
|
export * from './model-attribute-utils';
|
package/core/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,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,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,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,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,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,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { IKosTopicHandlerParams } from '../core/decorators/kosTopicHandler';
|
|
2
|
+
import { DeclaredTopic } from './kos-topic-client';
|
|
3
|
+
/**
|
|
4
|
+
* Prefix every local topic carries. It keeps a topic the UI declares apart
|
|
5
|
+
* from the topics the backend publishes.
|
|
6
|
+
*
|
|
7
|
+
* @kosService core.topic-handler
|
|
8
|
+
* @kosApiLevel 28
|
|
9
|
+
*/
|
|
10
|
+
export declare const LOCAL_TOPIC_PREFIX = "/ui/";
|
|
11
|
+
/**
|
|
12
|
+
* @kosService core.topic-handler
|
|
13
|
+
* @kosApiLevel 28
|
|
14
|
+
*/
|
|
15
|
+
export type LocalTopicPath = `/ui/${string}`;
|
|
16
|
+
/**
|
|
17
|
+
* A topic the UI declares for messages between models in the same client. It
|
|
18
|
+
* never reaches the backend or another client.
|
|
19
|
+
*
|
|
20
|
+
* @kosService core.topic-handler
|
|
21
|
+
* @kosApiLevel 28
|
|
22
|
+
*/
|
|
23
|
+
export interface LocalTopic<Payload = unknown> extends DeclaredTopic<LocalTopicPath> {
|
|
24
|
+
readonly local: true;
|
|
25
|
+
/** Carries the payload type only; never set. */
|
|
26
|
+
readonly payload?: Payload;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Message type of a local topic.
|
|
30
|
+
*
|
|
31
|
+
* @kosService core.topic-handler
|
|
32
|
+
* @kosApiLevel 28
|
|
33
|
+
*/
|
|
34
|
+
export type LocalTopicPayload<T extends LocalTopic<any>> = T extends LocalTopic<infer Payload> ? Payload : never;
|
|
35
|
+
/**
|
|
36
|
+
* Declare a local topic and its message type. The model that publishes the
|
|
37
|
+
* topic owns the declaration; a model that listens imports it.
|
|
38
|
+
*
|
|
39
|
+
* The path is fixed: it starts with `/ui/` and takes no `{variable}` segments.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* export const PumpTopics = {
|
|
44
|
+
* poured: localTopic<{ volume: number }>("/ui/pump/poured"),
|
|
45
|
+
* } as const;
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @kosService core.topic-handler
|
|
49
|
+
* @kosApiLevel 28
|
|
50
|
+
*/
|
|
51
|
+
export declare function localTopic<Payload = unknown>(path: LocalTopicPath): LocalTopic<Payload>;
|
|
52
|
+
/**
|
|
53
|
+
* Publish a message on a local topic to the models listening in this client.
|
|
54
|
+
*
|
|
55
|
+
* @kosService core.topic-handler
|
|
56
|
+
* @kosApiLevel 28
|
|
57
|
+
*/
|
|
58
|
+
export declare function publishLocalTopic<T extends LocalTopic<any>>(declared: T, payload: LocalTopicPayload<T>): void;
|
|
59
|
+
/**
|
|
60
|
+
* @kosTopicHandler preconfigured from a local topic. Pass overrides (lifecycle,
|
|
61
|
+
* transform, condition, …) as the second argument.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* @localTopicHandler(PumpTopics.poured, { lifecycle: DependencyLifecycle.INIT })
|
|
66
|
+
* handlePoured(event: LocalTopicPayload<typeof PumpTopics.poured>) {}
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @kosService core.topic-handler
|
|
70
|
+
* @kosApiLevel 28
|
|
71
|
+
*/
|
|
72
|
+
export declare function localTopicHandler<T extends LocalTopic<any>, Transformed = LocalTopicPayload<T>>(declared: T, opts?: Omit<IKosTopicHandlerParams<LocalTopicPayload<T>, any, Transformed>, "topic" | "websocket" | "skipParse">): (target: any, _propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
73
|
+
//# sourceMappingURL=kos-local-topic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kos-local-topic.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-local-topic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAEjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,MAAM,EAAE,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,OAAO,CAC3C,SAAQ,aAAa,CAAC,cAAc,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,gDAAgD;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,UAAU,CAC7E,MAAM,OAAO,CACd,GACG,OAAO,GACP,KAAK,CAAC;AAEV;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAG,OAAO,EAC1C,IAAI,EAAE,cAAc,GACnB,UAAU,CAAC,OAAO,CAAC,CAOrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,EACzD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC5B,IAAI,CAEN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,SAAS,UAAU,CAAC,GAAG,CAAC,EACzB,WAAW,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAElC,QAAQ,EAAE,CAAC,EACX,IAAI,CAAC,EAAE,IAAI,CACT,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,CAAC,EAC9D,OAAO,GAAG,WAAW,GAAG,WAAW,CACpC,+EASF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ClientResponse } from './kos-service-request';
|
|
2
|
+
/**
|
|
3
|
+
* A declared topic: the declaration it is typed by and the topic to subscribe
|
|
4
|
+
* to. The `topic()` helper of a generated topic module builds one.
|
|
5
|
+
*
|
|
6
|
+
* @kosService core.topic-handler
|
|
7
|
+
* @kosApiLevel 28
|
|
8
|
+
*/
|
|
9
|
+
export interface DeclaredTopic<Path extends PropertyKey = string> {
|
|
10
|
+
/** The topic as declared, with its `{variable}` segments. */
|
|
11
|
+
readonly path: Path;
|
|
12
|
+
/** The topic to subscribe to: `path` with its variables filled in. */
|
|
13
|
+
readonly topic: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The broker message a topic client hands its listener after the payload.
|
|
17
|
+
*
|
|
18
|
+
* @kosService core.topic-handler
|
|
19
|
+
* @kosApiLevel 28
|
|
20
|
+
*/
|
|
21
|
+
export interface TopicClientMessage {
|
|
22
|
+
headers?: Record<string, any>;
|
|
23
|
+
body?: unknown;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @kosService core.topic-handler
|
|
28
|
+
* @kosApiLevel 28
|
|
29
|
+
*/
|
|
30
|
+
export interface TopicSubscribeOptions {
|
|
31
|
+
/** Subscribe on the FOS socket. */
|
|
32
|
+
fos?: boolean;
|
|
33
|
+
/** Subscribe through the bridge. */
|
|
34
|
+
bridge?: boolean;
|
|
35
|
+
/** Connection the subscription is addressed to. */
|
|
36
|
+
destinationAddress?: string;
|
|
37
|
+
/** Hand the listener the message body as received, without parsing it. */
|
|
38
|
+
skipParse?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @kosService core.topic-handler
|
|
42
|
+
* @kosApiLevel 28
|
|
43
|
+
*/
|
|
44
|
+
export type TopicListener<Payload> = (payload: Payload, message: TopicClientMessage) => void;
|
|
45
|
+
/**
|
|
46
|
+
* @kosService core.topic-handler
|
|
47
|
+
* @kosApiLevel 28
|
|
48
|
+
*/
|
|
49
|
+
export interface TopicClient<Paths extends Record<string, any>> {
|
|
50
|
+
/**
|
|
51
|
+
* Subscribe to a declared topic over the websocket.
|
|
52
|
+
*
|
|
53
|
+
* The payload is typed from the declaration, and is `unknown` when the
|
|
54
|
+
* declaration names no message type.
|
|
55
|
+
*
|
|
56
|
+
* @returns a function that ends the subscription
|
|
57
|
+
* @throws when the topic still holds a `{placeholder}`; only a model can
|
|
58
|
+
* resolve `{MODEL_ID}` and prop keys, so use a topic handler for those
|
|
59
|
+
*/
|
|
60
|
+
subscribe<Path extends keyof Paths>(declared: DeclaredTopic<Path>, listener: TopicListener<ClientResponse<Paths, Path, "get">>, options?: TopicSubscribeOptions): VoidFunction;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a typed subscriber for the topics a generated `paths` type declares.
|
|
64
|
+
* It is for code that is not a model: a model subscribes with a topic handler,
|
|
65
|
+
* which follows the model's lifecycle.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const stop = topics.subscribe(topic("/kos/trouble/add"), (trouble) => {
|
|
70
|
+
* console.log(trouble);
|
|
71
|
+
* });
|
|
72
|
+
* stop();
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @kosService core.topic-handler
|
|
76
|
+
* @kosApiLevel 28
|
|
77
|
+
*/
|
|
78
|
+
export declare function createTopicClient<Paths extends Record<string, any>>(): TopicClient<Paths>;
|
|
79
|
+
//# sourceMappingURL=kos-topic-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kos-topic-client.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/core/util/kos-topic-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,IAAI,SAAS,WAAW,GAAG,MAAM;IAC9D,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,oCAAoC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0EAA0E;IAC1E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,OAAO,IAAI,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,kBAAkB,KACxB,IAAI,CAAC;AAEV;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC5D;;;;;;;;;OASG;IACH,SAAS,CAAC,IAAI,SAAS,MAAM,KAAK,EAChC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,EAC7B,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,EAC3D,OAAO,CAAC,EAAE,qBAAqB,GAC9B,YAAY,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC9B,WAAW,CAAC,KAAK,CAAC,CAsBtB"}
|
package/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const service$8 = require("./software-info-registration-
|
|
3
|
+
const service$8 = require("./software-info-registration-JdgonknE.cjs");
|
|
4
4
|
const mobx = require("mobx");
|
|
5
5
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
6
6
|
const styled = require("@emotion/styled");
|
|
@@ -521,15 +521,15 @@ function debounce(context, func, timeout = 300) {
|
|
|
521
521
|
};
|
|
522
522
|
}
|
|
523
523
|
const kosSubscribe = ({
|
|
524
|
-
topic,
|
|
524
|
+
topic: topic2,
|
|
525
525
|
handler,
|
|
526
526
|
websocket = false,
|
|
527
527
|
condition = () => true
|
|
528
528
|
}) => (target) => {
|
|
529
529
|
warnDeprecated("@kosSubscribe", "core.subscribe", 1, "@kosTopicHandler", 3);
|
|
530
530
|
target[service$8.SubscriptionHandlers] = target[service$8.SubscriptionHandlers] || {};
|
|
531
|
-
if (Array.isArray(
|
|
532
|
-
|
|
531
|
+
if (Array.isArray(topic2)) {
|
|
532
|
+
topic2.forEach((t) => {
|
|
533
533
|
target[service$8.SubscriptionHandlers][t] = {
|
|
534
534
|
websocket,
|
|
535
535
|
handler,
|
|
@@ -537,7 +537,7 @@ const kosSubscribe = ({
|
|
|
537
537
|
};
|
|
538
538
|
});
|
|
539
539
|
} else {
|
|
540
|
-
target[service$8.SubscriptionHandlers][
|
|
540
|
+
target[service$8.SubscriptionHandlers][topic2] = {
|
|
541
541
|
websocket,
|
|
542
542
|
handler: debounce(target, mobx.action(handler), 200),
|
|
543
543
|
condition
|
|
@@ -901,6 +901,47 @@ const hslStringToHex = (hsl) => {
|
|
|
901
901
|
};
|
|
902
902
|
const resolveVariable = (element, variable) => getComputedStyle(element).getPropertyValue(variable);
|
|
903
903
|
const variableToHex = (element, variable) => hslStringToHex(resolveVariable(element, variable));
|
|
904
|
+
const LOCAL_TOPIC_PREFIX = "/ui/";
|
|
905
|
+
function localTopic(path) {
|
|
906
|
+
if (!path.startsWith(LOCAL_TOPIC_PREFIX) || /[{}*]/.test(path)) {
|
|
907
|
+
throw new Error(
|
|
908
|
+
`"${path}" is not a local topic: it must start with ${LOCAL_TOPIC_PREFIX} and hold no {variable} or wildcard.`
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
return { path, topic: path, local: true };
|
|
912
|
+
}
|
|
913
|
+
function publishLocalTopic(declared, payload) {
|
|
914
|
+
service$8.publish(declared.topic, payload);
|
|
915
|
+
}
|
|
916
|
+
function localTopicHandler(declared, opts) {
|
|
917
|
+
return service$8.kosTopicHandler({
|
|
918
|
+
...opts,
|
|
919
|
+
topic: declared.topic,
|
|
920
|
+
websocket: false,
|
|
921
|
+
skipParse: true
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function createTopicClient() {
|
|
925
|
+
return {
|
|
926
|
+
subscribe(declared, listener, options = {}) {
|
|
927
|
+
const { topic: topic2 } = declared;
|
|
928
|
+
if (/\{[^}]+\}/.test(topic2)) {
|
|
929
|
+
throw new Error(
|
|
930
|
+
`Cannot subscribe to "${topic2}": every {placeholder} needs a value outside a model.`
|
|
931
|
+
);
|
|
932
|
+
}
|
|
933
|
+
const { skipParse, ...transportOptions } = options;
|
|
934
|
+
return service$8.WebSocketTransport.getInstance().subscribeTopic({
|
|
935
|
+
...transportOptions,
|
|
936
|
+
topic: topic2,
|
|
937
|
+
callback: (message2) => listener(
|
|
938
|
+
service$8.getMessageBody(message2, skipParse),
|
|
939
|
+
message2
|
|
940
|
+
)
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
}
|
|
904
945
|
class MiddlewareChain {
|
|
905
946
|
middlewares = [];
|
|
906
947
|
use(middleware) {
|
|
@@ -1541,7 +1582,7 @@ const updateRegion = async (region) => {
|
|
|
1541
1582
|
regionInfo.updateProperty(region);
|
|
1542
1583
|
};
|
|
1543
1584
|
async function getKosServiceApi() {
|
|
1544
|
-
const { default: API } = await Promise.resolve().then(() => require("./software-info-registration-
|
|
1585
|
+
const { default: API } = await Promise.resolve().then(() => require("./software-info-registration-JdgonknE.cjs")).then((n) => n.service);
|
|
1545
1586
|
return API;
|
|
1546
1587
|
}
|
|
1547
1588
|
function kosServiceRequest$7(params) {
|
|
@@ -1650,6 +1691,29 @@ const service = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
1650
1691
|
default: api,
|
|
1651
1692
|
kosServiceRequest
|
|
1652
1693
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1694
|
+
function topic(path, ...vars) {
|
|
1695
|
+
const values = vars[0] ?? {};
|
|
1696
|
+
const resolved = String(path).replace(
|
|
1697
|
+
/\{([^}]+)\}/g,
|
|
1698
|
+
(segment, name) => values[name] ?? segment
|
|
1699
|
+
);
|
|
1700
|
+
return { path, topic: resolved };
|
|
1701
|
+
}
|
|
1702
|
+
function topicHandler(declared, opts) {
|
|
1703
|
+
return service$8.kosTopicHandler({
|
|
1704
|
+
websocket: true,
|
|
1705
|
+
...opts,
|
|
1706
|
+
topic: declared.topic
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
const topics = createTopicClient();
|
|
1710
|
+
const topic$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1711
|
+
__proto__: null,
|
|
1712
|
+
default: topics,
|
|
1713
|
+
topic,
|
|
1714
|
+
topicHandler,
|
|
1715
|
+
topics
|
|
1716
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1653
1717
|
const REGION_SETTINGS_PATH$1 = "kos:service:region:settings";
|
|
1654
1718
|
const TIMEZONE_ATTRIBUTE$1 = "timeZone";
|
|
1655
1719
|
const REGION_TIMEZONE_ID$1 = `${REGION_SETTINGS_PATH$1}-${TIMEZONE_ATTRIBUTE$1}`;
|
|
@@ -4898,7 +4962,7 @@ function withProjectReloading(WrappedComponent) {
|
|
|
4898
4962
|
return reloading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingMessage, { message: "Wait a moment while your project reloads..." }) : /* @__PURE__ */ jsxRuntime.jsx(WrappedComponent, { ...props });
|
|
4899
4963
|
};
|
|
4900
4964
|
}
|
|
4901
|
-
registerApiLevels({ "kos-ui-sdk":
|
|
4965
|
+
registerApiLevels({ "kos-ui-sdk": 28 });
|
|
4902
4966
|
exports.AuthState = service$8.AuthState;
|
|
4903
4967
|
Object.defineProperty(exports, "BASE_URL", {
|
|
4904
4968
|
enumerable: true,
|
|
@@ -5281,6 +5345,7 @@ exports.KOS_SERVICE = service$7;
|
|
|
5281
5345
|
exports.KOS_SERVICE_1_6_5 = service$6;
|
|
5282
5346
|
exports.KOS_SERVICE_1_8_1 = service$5;
|
|
5283
5347
|
exports.KOS_SERVICE_1_9_X = service$4;
|
|
5348
|
+
exports.KOS_TOPICS = topic$1;
|
|
5284
5349
|
exports.KeyValueServices = index$c;
|
|
5285
5350
|
exports.KosExtensionUtils = initializeExtension;
|
|
5286
5351
|
exports.KosFetchMethods = KosFetchMethods;
|
|
@@ -5298,6 +5363,7 @@ exports.KosTimeServices = index$a;
|
|
|
5298
5363
|
exports.KosToken = KosToken;
|
|
5299
5364
|
exports.KosTranslationProvider = KosTranslationProvider;
|
|
5300
5365
|
exports.KosTranslations = KosTranslations;
|
|
5366
|
+
exports.LOCAL_TOPIC_PREFIX = LOCAL_TOPIC_PREFIX;
|
|
5301
5367
|
exports.LoadingMessage = LoadingMessage;
|
|
5302
5368
|
exports.LogStreamServices = index$9;
|
|
5303
5369
|
exports.MiddlewareChain = MiddlewareChain;
|
|
@@ -5339,6 +5405,7 @@ exports.clearPath = clearPath;
|
|
|
5339
5405
|
exports.clearServiceResponse = clearServiceResponse;
|
|
5340
5406
|
exports.collectLocaleOptions = collectLocaleOptions;
|
|
5341
5407
|
exports.convertFileSizeRaw = convertFileSizeRaw;
|
|
5408
|
+
exports.createTopicClient = createTopicClient;
|
|
5342
5409
|
exports.debounce = debounce;
|
|
5343
5410
|
exports.ensureKosMockBoot = ensureKosMockBoot;
|
|
5344
5411
|
exports.executeServiceRequest = executeServiceRequest;
|
|
@@ -5385,10 +5452,13 @@ exports.kosStateProp = kosStateProp;
|
|
|
5385
5452
|
exports.kosSubscribe = kosSubscribe;
|
|
5386
5453
|
exports.kosTroubleAware = kosTroubleAware;
|
|
5387
5454
|
exports.kosViewModel = kosViewModel;
|
|
5455
|
+
exports.localTopic = localTopic;
|
|
5456
|
+
exports.localTopicHandler = localTopicHandler;
|
|
5388
5457
|
exports.login = login;
|
|
5389
5458
|
exports.mergeLocalizationDescriptors = mergeLocalizationDescriptors;
|
|
5390
5459
|
exports.pairedClientHeartbeat = pairedClientHeartbeat;
|
|
5391
5460
|
exports.processMiddleware = processMiddleware;
|
|
5461
|
+
exports.publishLocalTopic = publishLocalTopic;
|
|
5392
5462
|
exports.readModelHookEntry = readModelHookEntry;
|
|
5393
5463
|
exports.resetPassword = resetPassword;
|
|
5394
5464
|
exports.resolveVariable = resolveVariable;
|