@kosdev-code/kos-ui-sdk 2.0.18 → 2.0.20
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/common/events/eventBus.d.ts +1 -0
- package/common/events/eventBus.d.ts.map +1 -1
- package/core/core/services/intent-service.d.ts +54 -7
- package/core/core/services/intent-service.d.ts.map +1 -1
- package/index.cjs +23 -23
- package/index.cjs.map +1 -1
- package/index.js +1150 -1137
- package/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/common/events/eventBus.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,MAAM;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC;CACT;AACD,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,WAAW,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,WAAW,EACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;;;;;EAmC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,eAAe,CAuCjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,SAGpB"}
|
|
1
|
+
{"version":3,"file":"eventBus.d.ts","sourceRoot":"","sources":["../../../../../../packages/sdk/kos-ui-sdk/src/common/events/eventBus.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,MAAM;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC;CACT;AACD,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,WAAW,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAKhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,WAAW,EACvC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;;;;;EAmC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,eAAe,CAuCjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,SAGpB"}
|
|
@@ -1,8 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ServiceResponse } from '../../util';
|
|
2
|
+
import { ApiCallback } from '../../../common/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents an intent message.
|
|
6
|
+
* @template T - The payload/options type for the intent.
|
|
7
|
+
* @property {string} type - The intent type (e.g., "studio.start.vm").
|
|
8
|
+
* @property {T} options - The payload/options for the intent.
|
|
9
|
+
*/
|
|
10
|
+
export interface Intent<T extends Record<string, any> = Record<string, any>> {
|
|
11
|
+
type: string;
|
|
12
|
+
options: T;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sends an intent as a fire-and-forget event.
|
|
16
|
+
* If there are subscribers for the intent type, the event is published; otherwise, a log message is emitted.
|
|
17
|
+
*
|
|
18
|
+
* @param {Intent} intent - The intent to send.
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* sendIntent({
|
|
23
|
+
* type: "studio.start.vm",
|
|
24
|
+
* options: { imageId: id },
|
|
25
|
+
* });
|
|
26
|
+
*/
|
|
27
|
+
declare const sendIntent: (intent: Intent) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Sends an intent and waits for a response. Returns a promise that resolves with the response or a timeout error after 1 second.
|
|
30
|
+
*
|
|
31
|
+
* - If there are subscribers, a unique request ID is generated and used for the response channel.
|
|
32
|
+
* - If no subscribers, resolves with `body: undefined`.
|
|
33
|
+
*
|
|
34
|
+
* @template R - The expected response body type.
|
|
35
|
+
* @param {Intent} intent - The intent to send.
|
|
36
|
+
* @returns {Promise<ServiceResponse<{ body: R | undefined; payload: ApiCallback<R> | undefined }>>}
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* sendAsyncIntent({
|
|
40
|
+
* type: "studio.start.vm",
|
|
41
|
+
* options: { imageId: id },
|
|
42
|
+
* }).then(([error, data]) => {
|
|
43
|
+
* if (error) {
|
|
44
|
+
* log.error(`Error starting VM: ${error}`);
|
|
45
|
+
* } else if (data) {
|
|
46
|
+
* log.warn(`result: ${JSON.stringify(data, null, 2)}`);
|
|
47
|
+
* }
|
|
48
|
+
* });
|
|
49
|
+
*/
|
|
50
|
+
declare const sendAsyncIntent: <R = any>(intent: Intent) => Promise<ServiceResponse<{
|
|
51
|
+
body: R | undefined;
|
|
52
|
+
payload: ApiCallback<R> | undefined;
|
|
53
|
+
}>>;
|
|
54
|
+
export { sendAsyncIntent, sendIntent };
|
|
8
55
|
//# sourceMappingURL=intent-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent-service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/core/core/services/intent-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intent-service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/sdk/kos-ui-sdk/src/core/core/services/intent-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAQ,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAKxD;;;;;GAKG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,CAAC;CACZ;AAED;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,UAAU,WAAY,MAAM,KAAG,IAQpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,eAAe,oBACX,MAAM,KACb,QACD,gBAAgB;IAAE,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC,CAAC,GAAG,SAAS,CAAA;CAAE,CAAC,CAkC3E,CAAC;AAEL,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
|