@softomnitel/omnicall-kit 0.1.0-rc.0

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.
Files changed (183) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +34 -0
  3. package/dist/index.d.ts +21 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +16 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/internal/account-activate-commands.d.ts +30 -0
  8. package/dist/internal/account-activate-commands.d.ts.map +1 -0
  9. package/dist/internal/account-activate-commands.js +94 -0
  10. package/dist/internal/account-activate-commands.js.map +1 -0
  11. package/dist/internal/account-activate-wire.d.ts +16 -0
  12. package/dist/internal/account-activate-wire.d.ts.map +1 -0
  13. package/dist/internal/account-activate-wire.js +22 -0
  14. package/dist/internal/account-activate-wire.js.map +1 -0
  15. package/dist/internal/account-logout-commands.d.ts +23 -0
  16. package/dist/internal/account-logout-commands.d.ts.map +1 -0
  17. package/dist/internal/account-logout-commands.js +51 -0
  18. package/dist/internal/account-logout-commands.js.map +1 -0
  19. package/dist/internal/account-logout-wire.d.ts +15 -0
  20. package/dist/internal/account-logout-wire.d.ts.map +1 -0
  21. package/dist/internal/account-logout-wire.js +24 -0
  22. package/dist/internal/account-logout-wire.js.map +1 -0
  23. package/dist/internal/auth-grants.d.ts +6 -0
  24. package/dist/internal/auth-grants.d.ts.map +1 -0
  25. package/dist/internal/auth-grants.js +16 -0
  26. package/dist/internal/auth-grants.js.map +1 -0
  27. package/dist/internal/auth-inbound.d.ts +35 -0
  28. package/dist/internal/auth-inbound.d.ts.map +1 -0
  29. package/dist/internal/auth-inbound.js +86 -0
  30. package/dist/internal/auth-inbound.js.map +1 -0
  31. package/dist/internal/auth-orchestrator.d.ts +36 -0
  32. package/dist/internal/auth-orchestrator.d.ts.map +1 -0
  33. package/dist/internal/auth-orchestrator.js +217 -0
  34. package/dist/internal/auth-orchestrator.js.map +1 -0
  35. package/dist/internal/auth-pop-flow.d.ts +38 -0
  36. package/dist/internal/auth-pop-flow.d.ts.map +1 -0
  37. package/dist/internal/auth-pop-flow.js +80 -0
  38. package/dist/internal/auth-pop-flow.js.map +1 -0
  39. package/dist/internal/auth-wire.d.ts +37 -0
  40. package/dist/internal/auth-wire.d.ts.map +1 -0
  41. package/dist/internal/auth-wire.js +62 -0
  42. package/dist/internal/auth-wire.js.map +1 -0
  43. package/dist/internal/base64url.d.ts +7 -0
  44. package/dist/internal/base64url.d.ts.map +1 -0
  45. package/dist/internal/base64url.js +28 -0
  46. package/dist/internal/base64url.js.map +1 -0
  47. package/dist/internal/browser-websocket-transport.d.ts +36 -0
  48. package/dist/internal/browser-websocket-transport.d.ts.map +1 -0
  49. package/dist/internal/browser-websocket-transport.js +131 -0
  50. package/dist/internal/browser-websocket-transport.js.map +1 -0
  51. package/dist/internal/call-commands.d.ts +32 -0
  52. package/dist/internal/call-commands.d.ts.map +1 -0
  53. package/dist/internal/call-commands.js +60 -0
  54. package/dist/internal/call-commands.js.map +1 -0
  55. package/dist/internal/call-wire.d.ts +24 -0
  56. package/dist/internal/call-wire.d.ts.map +1 -0
  57. package/dist/internal/call-wire.js +37 -0
  58. package/dist/internal/call-wire.js.map +1 -0
  59. package/dist/internal/client-error-details.d.ts +60 -0
  60. package/dist/internal/client-error-details.d.ts.map +1 -0
  61. package/dist/internal/client-error-details.js +98 -0
  62. package/dist/internal/client-error-details.js.map +1 -0
  63. package/dist/internal/client-errors.d.ts +38 -0
  64. package/dist/internal/client-errors.d.ts.map +1 -0
  65. package/dist/internal/client-errors.js +37 -0
  66. package/dist/internal/client-errors.js.map +1 -0
  67. package/dist/internal/command-classification.d.ts +7 -0
  68. package/dist/internal/command-classification.d.ts.map +1 -0
  69. package/dist/internal/command-classification.js +14 -0
  70. package/dist/internal/command-classification.js.map +1 -0
  71. package/dist/internal/connection-session.d.ts +61 -0
  72. package/dist/internal/connection-session.d.ts.map +1 -0
  73. package/dist/internal/connection-session.js +333 -0
  74. package/dist/internal/connection-session.js.map +1 -0
  75. package/dist/internal/connection-state.d.ts +13 -0
  76. package/dist/internal/connection-state.d.ts.map +1 -0
  77. package/dist/internal/connection-state.js +75 -0
  78. package/dist/internal/connection-state.js.map +1 -0
  79. package/dist/internal/diagnostics.d.ts +36 -0
  80. package/dist/internal/diagnostics.d.ts.map +1 -0
  81. package/dist/internal/diagnostics.js +51 -0
  82. package/dist/internal/diagnostics.js.map +1 -0
  83. package/dist/internal/event-subscription.d.ts +23 -0
  84. package/dist/internal/event-subscription.d.ts.map +1 -0
  85. package/dist/internal/event-subscription.js +62 -0
  86. package/dist/internal/event-subscription.js.map +1 -0
  87. package/dist/internal/heartbeat-controller.d.ts +27 -0
  88. package/dist/internal/heartbeat-controller.d.ts.map +1 -0
  89. package/dist/internal/heartbeat-controller.js +58 -0
  90. package/dist/internal/heartbeat-controller.js.map +1 -0
  91. package/dist/internal/operator-commands.d.ts +46 -0
  92. package/dist/internal/operator-commands.d.ts.map +1 -0
  93. package/dist/internal/operator-commands.js +93 -0
  94. package/dist/internal/operator-commands.js.map +1 -0
  95. package/dist/internal/operator-wire.d.ts +20 -0
  96. package/dist/internal/operator-wire.d.ts.map +1 -0
  97. package/dist/internal/operator-wire.js +33 -0
  98. package/dist/internal/operator-wire.js.map +1 -0
  99. package/dist/internal/origin-policy-errors.d.ts +22 -0
  100. package/dist/internal/origin-policy-errors.d.ts.map +1 -0
  101. package/dist/internal/origin-policy-errors.js +67 -0
  102. package/dist/internal/origin-policy-errors.js.map +1 -0
  103. package/dist/internal/pop-crypto.d.ts +23 -0
  104. package/dist/internal/pop-crypto.d.ts.map +1 -0
  105. package/dist/internal/pop-crypto.js +48 -0
  106. package/dist/internal/pop-crypto.js.map +1 -0
  107. package/dist/internal/pop-key-store.d.ts +28 -0
  108. package/dist/internal/pop-key-store.d.ts.map +1 -0
  109. package/dist/internal/pop-key-store.js +153 -0
  110. package/dist/internal/pop-key-store.js.map +1 -0
  111. package/dist/internal/product-commands.d.ts +33 -0
  112. package/dist/internal/product-commands.d.ts.map +1 -0
  113. package/dist/internal/product-commands.js +70 -0
  114. package/dist/internal/product-commands.js.map +1 -0
  115. package/dist/internal/product-inbound.d.ts +15 -0
  116. package/dist/internal/product-inbound.d.ts.map +1 -0
  117. package/dist/internal/product-inbound.js +31 -0
  118. package/dist/internal/product-inbound.js.map +1 -0
  119. package/dist/internal/product-orchestrator.d.ts +46 -0
  120. package/dist/internal/product-orchestrator.d.ts.map +1 -0
  121. package/dist/internal/product-orchestrator.js +188 -0
  122. package/dist/internal/product-orchestrator.js.map +1 -0
  123. package/dist/internal/product-wire.d.ts +29 -0
  124. package/dist/internal/product-wire.d.ts.map +1 -0
  125. package/dist/internal/product-wire.js +54 -0
  126. package/dist/internal/product-wire.js.map +1 -0
  127. package/dist/internal/public-event-map.d.ts +27 -0
  128. package/dist/internal/public-event-map.d.ts.map +1 -0
  129. package/dist/internal/public-event-map.js +38 -0
  130. package/dist/internal/public-event-map.js.map +1 -0
  131. package/dist/internal/reconnect-policy.d.ts +16 -0
  132. package/dist/internal/reconnect-policy.d.ts.map +1 -0
  133. package/dist/internal/reconnect-policy.js +23 -0
  134. package/dist/internal/reconnect-policy.js.map +1 -0
  135. package/dist/internal/request-correlator.d.ts +41 -0
  136. package/dist/internal/request-correlator.d.ts.map +1 -0
  137. package/dist/internal/request-correlator.js +130 -0
  138. package/dist/internal/request-correlator.js.map +1 -0
  139. package/dist/internal/requested-capabilities.d.ts +10 -0
  140. package/dist/internal/requested-capabilities.d.ts.map +1 -0
  141. package/dist/internal/requested-capabilities.js +25 -0
  142. package/dist/internal/requested-capabilities.js.map +1 -0
  143. package/dist/internal/scheduler.d.ts +41 -0
  144. package/dist/internal/scheduler.d.ts.map +1 -0
  145. package/dist/internal/scheduler.js +104 -0
  146. package/dist/internal/scheduler.js.map +1 -0
  147. package/dist/internal/session-identity.d.ts +16 -0
  148. package/dist/internal/session-identity.d.ts.map +1 -0
  149. package/dist/internal/session-identity.js +13 -0
  150. package/dist/internal/session-identity.js.map +1 -0
  151. package/dist/internal/snapshot-acquisition.d.ts +21 -0
  152. package/dist/internal/snapshot-acquisition.d.ts.map +1 -0
  153. package/dist/internal/snapshot-acquisition.js +40 -0
  154. package/dist/internal/snapshot-acquisition.js.map +1 -0
  155. package/dist/internal/snapshot-cache.d.ts +13 -0
  156. package/dist/internal/snapshot-cache.d.ts.map +1 -0
  157. package/dist/internal/snapshot-cache.js +18 -0
  158. package/dist/internal/snapshot-cache.js.map +1 -0
  159. package/dist/internal/transport-port.d.ts +34 -0
  160. package/dist/internal/transport-port.d.ts.map +1 -0
  161. package/dist/internal/transport-port.js +7 -0
  162. package/dist/internal/transport-port.js.map +1 -0
  163. package/dist/internal/window-commands.d.ts +23 -0
  164. package/dist/internal/window-commands.d.ts.map +1 -0
  165. package/dist/internal/window-commands.js +76 -0
  166. package/dist/internal/window-commands.js.map +1 -0
  167. package/dist/public/auth-client.d.ts +87 -0
  168. package/dist/public/auth-client.d.ts.map +1 -0
  169. package/dist/public/auth-client.js +116 -0
  170. package/dist/public/auth-client.js.map +1 -0
  171. package/dist/public/omnicall-client-api.d.ts +159 -0
  172. package/dist/public/omnicall-client-api.d.ts.map +1 -0
  173. package/dist/public/omnicall-client-api.js +5 -0
  174. package/dist/public/omnicall-client-api.js.map +1 -0
  175. package/dist/public/omnicall-client.d.ts +22 -0
  176. package/dist/public/omnicall-client.d.ts.map +1 -0
  177. package/dist/public/omnicall-client.js +171 -0
  178. package/dist/public/omnicall-client.js.map +1 -0
  179. package/dist/public/protocol-reexports.d.ts +41 -0
  180. package/dist/public/protocol-reexports.d.ts.map +1 -0
  181. package/dist/public/protocol-reexports.js +7 -0
  182. package/dist/public/protocol-reexports.js.map +1 -0
  183. package/package.json +46 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * PoP private-key persistence (ADR-0016): IndexedDB only in browsers.
3
+ * Never localStorage / sessionStorage. Tests use an in-memory store.
4
+ */
5
+ const DB_NAME_PREFIX = 'omnicall-kit-pop';
6
+ const STORE_NAME = 'identities';
7
+ const RECORD_KEY = 'primary';
8
+ /** In-memory key store for tests and non-browser runners. @public */
9
+ export function createMemoryPopKeyStore(initial) {
10
+ let current = initial;
11
+ return {
12
+ peek: () => current,
13
+ load: () => Promise.resolve(current),
14
+ save: (identity) => {
15
+ current = identity;
16
+ return Promise.resolve();
17
+ },
18
+ clear: () => {
19
+ current = undefined;
20
+ return Promise.resolve();
21
+ }
22
+ };
23
+ }
24
+ /** IndexedDB-backed PoP store (never localStorage/sessionStorage). @public */
25
+ export function createIndexedDbPopKeyStore(input) {
26
+ const dbName = `${DB_NAME_PREFIX}:${input.installId}`;
27
+ const openDb = () => new Promise((resolve, reject) => {
28
+ const request = indexedDB.open(dbName, 1);
29
+ request.onerror = () => {
30
+ reject(request.error ?? new Error('IndexedDB open failed'));
31
+ };
32
+ request.onupgradeneeded = () => {
33
+ const db = request.result;
34
+ if (!db.objectStoreNames.contains(STORE_NAME)) {
35
+ db.createObjectStore(STORE_NAME);
36
+ }
37
+ };
38
+ request.onsuccess = () => {
39
+ resolve(request.result);
40
+ };
41
+ });
42
+ return {
43
+ load: async () => {
44
+ const db = await openDb();
45
+ try {
46
+ const record = await idbGet(db, RECORD_KEY);
47
+ if (record === undefined) {
48
+ return undefined;
49
+ }
50
+ return Object.freeze({
51
+ clientId: record.clientId,
52
+ publicKeySpkiBase64Url: record.publicKeySpkiBase64Url,
53
+ privateKey: record.privateKey,
54
+ profile: record.profile,
55
+ grantedCapabilities: Object.freeze([...record.grantedCapabilities])
56
+ });
57
+ }
58
+ finally {
59
+ db.close();
60
+ }
61
+ },
62
+ save: async (identity) => {
63
+ const db = await openDb();
64
+ try {
65
+ const record = {
66
+ clientId: identity.clientId,
67
+ publicKeySpkiBase64Url: identity.publicKeySpkiBase64Url,
68
+ privateKey: identity.privateKey,
69
+ ...(identity.profile !== undefined ? { profile: identity.profile } : {}),
70
+ grantedCapabilities: [...identity.grantedCapabilities]
71
+ };
72
+ await idbPut(db, RECORD_KEY, record);
73
+ }
74
+ finally {
75
+ db.close();
76
+ }
77
+ },
78
+ clear: async () => {
79
+ const db = await openDb();
80
+ try {
81
+ await idbDelete(db, RECORD_KEY);
82
+ }
83
+ finally {
84
+ db.close();
85
+ }
86
+ }
87
+ };
88
+ }
89
+ function isStoredRecord(value) {
90
+ if (typeof value !== 'object' || value === null) {
91
+ return false;
92
+ }
93
+ if (!('clientId' in value) || typeof value.clientId !== 'string') {
94
+ return false;
95
+ }
96
+ if (!('publicKeySpkiBase64Url' in value) ||
97
+ typeof value.publicKeySpkiBase64Url !== 'string') {
98
+ return false;
99
+ }
100
+ if (!('privateKey' in value) || !(value.privateKey instanceof CryptoKey)) {
101
+ return false;
102
+ }
103
+ if (!('grantedCapabilities' in value) || !Array.isArray(value.grantedCapabilities)) {
104
+ return false;
105
+ }
106
+ return true;
107
+ }
108
+ function idbGet(db, key) {
109
+ return new Promise((resolve, reject) => {
110
+ const tx = db.transaction(STORE_NAME, 'readonly');
111
+ const request = tx.objectStore(STORE_NAME).get(key);
112
+ request.onerror = () => {
113
+ reject(request.error ?? new Error('IndexedDB get failed'));
114
+ };
115
+ request.onsuccess = () => {
116
+ const value = request.result;
117
+ if (value === undefined || value === null) {
118
+ resolve(undefined);
119
+ return;
120
+ }
121
+ if (!isStoredRecord(value)) {
122
+ reject(new Error('IndexedDB record shape invalid'));
123
+ return;
124
+ }
125
+ resolve(value);
126
+ };
127
+ });
128
+ }
129
+ function idbPut(db, key, value) {
130
+ return new Promise((resolve, reject) => {
131
+ const tx = db.transaction(STORE_NAME, 'readwrite');
132
+ const request = tx.objectStore(STORE_NAME).put(value, key);
133
+ request.onerror = () => {
134
+ reject(request.error ?? new Error('IndexedDB put failed'));
135
+ };
136
+ request.onsuccess = () => {
137
+ resolve();
138
+ };
139
+ });
140
+ }
141
+ function idbDelete(db, key) {
142
+ return new Promise((resolve, reject) => {
143
+ const tx = db.transaction(STORE_NAME, 'readwrite');
144
+ const request = tx.objectStore(STORE_NAME).delete(key);
145
+ request.onerror = () => {
146
+ reject(request.error ?? new Error('IndexedDB delete failed'));
147
+ };
148
+ request.onsuccess = () => {
149
+ resolve();
150
+ };
151
+ });
152
+ }
153
+ //# sourceMappingURL=pop-key-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pop-key-store.js","sourceRoot":"","sources":["../../src/internal/pop-key-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAC1C,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,UAAU,GAAG,SAAS,CAAC;AAU7B,qEAAqE;AACrE,MAAM,UAAU,uBAAuB,CACrC,OAA2B;IAE3B,IAAI,OAAO,GAAkC,OAAO,CAAC;IACrD,OAAO;QACL,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO;QACnB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QACpC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;YACjB,OAAO,GAAG,QAAQ,CAAC;YACnB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACV,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,0BAA0B,CAAC,KAE1C;IACC,MAAM,MAAM,GAAG,GAAG,cAAc,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;IAEtD,MAAM,MAAM,GAAG,GAAyB,EAAE,CACxC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1C,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE;YACrB,MAAM,CAAC,OAAO,C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,KAAmB;IAC/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC3D,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE;YACrB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE;YACvB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,SAAS,CAAC,EAAe,EAAE,GAAW;IAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACvD,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE;YACrB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,OAAO,CAAC,SAAS,GAAG,GAAG,EAAE;YACvB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Capability-gated product command helpers (snapshot / window).
3
+ */
4
+ import type { CapabilityId, ProtocolErrorCode } from '@softomnitel/omnicall-protocol';
5
+ import { type OmniCallClientError } from './client-errors.js';
6
+ import type { ConnectionSession } from './connection-session.js';
7
+ import type { PendingRequestResult } from './request-correlator.js';
8
+ export declare function guardReady(connection: ConnectionSession): OmniCallClientError | undefined;
9
+ export declare function guardCapability(granted: readonly CapabilityId[], capability: CapabilityId): OmniCallClientError | undefined;
10
+ export declare function requireWireIdentity(connection: ConnectionSession): {
11
+ readonly serverInstanceId: string;
12
+ readonly sessionEpoch: string;
13
+ } | OmniCallClientError;
14
+ export declare function mapPendingFailure(result: {
15
+ readonly ok: false;
16
+ readonly errorCode: ProtocolErrorCode;
17
+ }): OmniCallClientError;
18
+ export declare function mapReplyFailure(result: PendingRequestResult): OmniCallClientError;
19
+ export declare function readWindowState(reply: {
20
+ readonly revision: number;
21
+ readonly result: Readonly<Record<string, unknown>>;
22
+ }): {
23
+ readonly visible: boolean;
24
+ readonly revision: number;
25
+ };
26
+ export declare function readCallMutationResult(reply: {
27
+ readonly revision: number;
28
+ readonly result: Readonly<Record<string, unknown>>;
29
+ }): {
30
+ readonly callId: string;
31
+ readonly revision: number;
32
+ };
33
+ //# sourceMappingURL=product-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-commands.d.ts","sourceRoot":"","sources":["../../src/internal/product-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEtF,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,wBAAgB,UAAU,CACxB,UAAU,EAAE,iBAAiB,GAC5B,mBAAmB,GAAG,SAAS,CAKjC;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,UAAU,EAAE,YAAY,GACvB,mBAAmB,GAAG,SAAS,CAKjC;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,iBAAiB,GAE3B;IAAE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACpE,mBAAmB,CAMtB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;CACvC,GAAG,mBAAmB,CAQtB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,mBAAmB,CAiBjF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAS3D;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACpD,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CASzD"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Capability-gated product command helpers (snapshot / window).
3
+ */
4
+ import { createClientError } from './client-errors.js';
5
+ export function guardReady(connection) {
6
+ if (connection.getState() !== 'ready') {
7
+ return createClientError({ code: 'not_ready', retryable: true });
8
+ }
9
+ return undefined;
10
+ }
11
+ export function guardCapability(granted, capability) {
12
+ if (!granted.includes(capability)) {
13
+ return createClientError({ code: 'forbidden', retryable: false });
14
+ }
15
+ return undefined;
16
+ }
17
+ export function requireWireIdentity(connection) {
18
+ const identity = connection.getWireIdentity();
19
+ if (identity === undefined) {
20
+ return createClientError({ code: 'unauthenticated', retryable: true });
21
+ }
22
+ return identity;
23
+ }
24
+ export function mapPendingFailure(result) {
25
+ return createClientError({
26
+ code: result.errorCode,
27
+ retryable: result.errorCode === 'timeout' ||
28
+ result.errorCode === 'not_ready' ||
29
+ result.errorCode === 'rate_limited'
30
+ });
31
+ }
32
+ export function mapReplyFailure(result) {
33
+ if (!result.ok) {
34
+ return mapPendingFailure(result);
35
+ }
36
+ if (result.reply.ok) {
37
+ return createClientError({ code: 'operation_failed', retryable: false });
38
+ }
39
+ return createClientError({
40
+ code: result.reply.error.code,
41
+ retryable: result.reply.error.retryable,
42
+ ...(result.reply.error.currentRevision !== undefined
43
+ ? { currentRevision: result.reply.error.currentRevision }
44
+ : {}),
45
+ ...(result.reply.error.details !== undefined
46
+ ? { details: result.reply.error.details }
47
+ : {})
48
+ });
49
+ }
50
+ export function readWindowState(reply) {
51
+ const visible = reply.result['visible'];
52
+ if (typeof visible !== 'boolean') {
53
+ throw createClientError({ code: 'invalid_payload', retryable: false });
54
+ }
55
+ return {
56
+ visible,
57
+ revision: reply.revision
58
+ };
59
+ }
60
+ export function readCallMutationResult(reply) {
61
+ const callId = reply.result['callId'];
62
+ if (typeof callId !== 'string' || callId.length === 0) {
63
+ throw createClientError({ code: 'invalid_payload', retryable: false });
64
+ }
65
+ return {
66
+ callId,
67
+ revision: reply.revision
68
+ };
69
+ }
70
+ //# sourceMappingURL=product-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-commands.js","sourceRoot":"","sources":["../../src/internal/product-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,iBAAiB,EAA4B,MAAM,oBAAoB,CAAC;AAIjF,MAAM,UAAU,UAAU,CACxB,UAA6B;IAE7B,IAAI,UAAU,CAAC,QAAQ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AAM;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Parse product inbound frames (snapshot / public events) from unknown.
3
+ */
4
+ import { type EventMessage, type SnapshotMessage } from '@softomnitel/omnicall-protocol';
5
+ export type ProductInbound = {
6
+ readonly kind: 'snapshot';
7
+ readonly message: SnapshotMessage;
8
+ } | {
9
+ readonly kind: 'event';
10
+ readonly message: EventMessage;
11
+ } | {
12
+ readonly kind: 'ignored';
13
+ };
14
+ export declare function parseProductInbound(raw: string): ProductInbound;
15
+ //# sourceMappingURL=product-inbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-inbound.d.ts","sourceRoot":"","sources":["../../src/internal/product-inbound.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEjC,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAwB/D"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Parse product inbound frames (snapshot / public events) from unknown.
3
+ */
4
+ import { EventMessageSchema, SnapshotMessageSchema, validateWithSchema } from '@softomnitel/omnicall-protocol';
5
+ export function parseProductInbound(raw) {
6
+ let parsed;
7
+ try {
8
+ parsed = JSON.parse(raw);
9
+ }
10
+ catch {
11
+ return { kind: 'ignored' };
12
+ }
13
+ if (typeof parsed !== 'object' || parsed === null) {
14
+ return { kind: 'ignored' };
15
+ }
16
+ const kind = 'kind' in parsed ? parsed.kind : undefined;
17
+ if (kind === 'snapshot') {
18
+ const result = validateWithSchema(SnapshotMessageSchema, parsed);
19
+ return result.success
20
+ ? { kind: 'snapshot', message: result.data }
21
+ : { kind: 'ignored' };
22
+ }
23
+ if (kind === 'event') {
24
+ const result = validateWithSchema(EventMessageSchema, parsed);
25
+ return result.success
26
+ ? { kind: 'event', message: result.data }
27
+ : { kind: 'ignored' };
28
+ }
29
+ return { kind: 'ignored' };
30
+ }
31
+ //# sourceMappingURL=product-inbound.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-inbound.js","sourceRoot":"","sources":["../../src/internal/product-inbound.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAGnB,MAAM,gCAAgC,CAAC;AAOxC,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC7B,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,kBAAkB,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QACjE,OAAO,MAAM,CAAC,OAAO;YACnB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE;YAC5C,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC,OAAO;YACnB,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE;YACzC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Product orchestration: snapshot, events, window, calls, operator, account.
3
+ */
4
+ import type { CapabilityId, SnapshotMessage } from '@softomnitel/omnicall-protocol';
5
+ import { type AccountActivateCommandApi } from './account-activate-commands.js';
6
+ import { type AccountLogoutCommandApi } from './account-logout-commands.js';
7
+ import { type CallCommandApi, type CallMutationResult } from './call-commands.js';
8
+ import type { ConnectionSession } from './connection-session.js';
9
+ import type { DiagnosticsSink } from './diagnostics.js';
10
+ import { type OperatorCommandApi } from './operator-commands.js';
11
+ import type { OmniCallEvent, PublicEventType } from './public-event-map.js';
12
+ import type { Scheduler } from './scheduler.js';
13
+ import { type WindowStateResult } from './window-commands.js';
14
+ export type { CallMutationResult, WindowStateResult };
15
+ export type ProductOrchestrator = {
16
+ readonly onUnhandledMessage: (raw: string) => boolean;
17
+ readonly invalidate: () => void;
18
+ readonly getCachedSnapshot: () => SnapshotMessage | undefined;
19
+ readonly getRevision: () => number | undefined;
20
+ readonly getSnapshot: () => Promise<SnapshotMessage>;
21
+ readonly subscribe: <T extends PublicEventType>(type: T, listener: (event: Extract<OmniCallEvent, {
22
+ type: T;
23
+ }>) => void) => () => void;
24
+ readonly showWindow: () => Promise<WindowStateResult>;
25
+ readonly hideWindow: (input: {
26
+ readonly expectedRevision: number;
27
+ }) => Promise<WindowStateResult>;
28
+ readonly getWindowState: () => Promise<WindowStateResult>;
29
+ readonly originateCall: CallCommandApi['originateCall'];
30
+ readonly controlCall: CallCommandApi['controlCall'];
31
+ readonly sendDtmf: CallCommandApi['sendDtmf'];
32
+ readonly getOperatorReasons: OperatorCommandApi['getReasons'];
33
+ readonly changeOperatorStatus: OperatorCommandApi['changeStatus'];
34
+ readonly finishOperatorAppeal: OperatorCommandApi['finishAppeal'];
35
+ readonly logout: AccountLogoutCommandApi['logout'];
36
+ readonly activateProfile: AccountActivateCommandApi['activateProfile'];
37
+ readonly dispose: () => void;
38
+ };
39
+ export declare function createProductOrchestrator(deps: {
40
+ readonly connection: ConnectionSession;
41
+ readonly scheduler: Scheduler;
42
+ readonly getGrantedCapabilities: () => readonly CapabilityId[];
43
+ readonly diagnostics?: DiagnosticsSink;
44
+ readonly snapshotWaitTimeoutMs?: number;
45
+ }): ProductOrchestrator;
46
+ //# sourceMappingURL=product-orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-orchestrator.d.ts","sourceRoot":"","sources":["../../src/internal/product-orchestrator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEpF,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAUhC,OAAO,KAAK,EAAE,aAAa,EAAE,eAA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AC,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClE,QAAQ,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACnD,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,SAAS,YAAY,EAAE,CAAC;IAC/D,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC,GAAG,mBAAmB,CAkMtB"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Product orchestration: snapshot, events, window, calls, operator, account.
3
+ */
4
+ import { createAccountActivateCommandApi } from './account-activate-commands.js';
5
+ import { createAccountLogoutCommandApi } from './account-logout-commands.js';
6
+ import { createCallCommandApi } from './call-commands.js';
7
+ import { createEventSubscriptionHub } from './event-subscription.js';
8
+ import { createOperatorCommandApi } from './operator-commands.js';
9
+ import { guardCapability, guardReady, mapPendingFailure, mapReplyFailure, requireWireIdentity } from './product-commands.js';
10
+ import { parseProductInbound } from './product-inbound.js';
11
+ import { buildGetSnapshotBody } from './product-wire.js';
12
+ import { invalidateErrorForState, matchSnapshotRevision, rejectAllAcquisitions, settleReject, settleResolve, timeoutSnapshotError } from './snapshot-acquisition.js';
13
+ import { createSnapshotCache } from './snapshot-cache.js';
14
+ import { createWindowCommandApi } from './window-commands.js';
15
+ export function createProductOrchestrator(deps) {
16
+ const cache = createSnapshotCache();
17
+ const waitTimeoutMs = deps.snapshotWaitTimeoutMs ?? 5_000;
18
+ let resyncInFlight = false;
19
+ let pendingAcquisitions = [];
20
+ const commandDeps = {
21
+ connection: deps.connection,
22
+ scheduler: deps.scheduler,
23
+ getGrantedCapabilities: deps.getGrantedCapabilities
24
+ };
25
+ const calls = createCallCommandApi(commandDeps);
26
+ const windowApi = createWindowCommandApi(commandDeps);
27
+ const operator = createOperatorCommandApi(commandDeps);
28
+ const accountLogout = createAccountLogoutCommandApi(commandDeps);
29
+ const accountActivate = createAccountActivateCommandApi(commandDeps);
30
+ const removeAcquisition = (acquisition) => {
31
+ pendingAcquisitions = pendingAcquisitions.filter((item) => item !== acquisition);
32
+ };
33
+ const invalidate = () => {
34
+ cache.clear();
35
+ hub.clearSequence();
36
+ const error = invalidateErrorForState(deps.connection.getState());
37
+ const waiters = pendingAcquisitions;
38
+ pendingAcquisitions = [];
39
+ rejectAllAcquisitions(waiters, error);
40
+ };
41
+ const notifyMatchingWaiters = (snapshot) => {
42
+ const remaining = [];
43
+ for (const acquisition of pendingAcquisitions) {
44
+ if (acquisition.expectedRevision !== undefined &&
45
+ matchSnapshotRevision(snapshot, acquisition.expectedRevision)) {
46
+ settleResolve(acquisition, snapshot);
47
+ }
48
+ else {
49
+ remaining.push(acquisition);
50
+ }
51
+ }
52
+ pendingAcquisitions = remaining;
53
+ };
54
+ const getSnapshotInternal = () => {
55
+ const notReady = guardReady(deps.connection);
56
+ if (notReady !== undefined) {
57
+ return Promise.reject(notReady);
58
+ }
59
+ const missingCap = guardCapability(deps.getGrantedCapabilities(), 'session.read.redacted');
60
+ if (missingCap !== undefined) {
61
+ return Promise.reject(missingCap);
62
+ }
63
+ const identity = requireWireIdentity(deps.connection);
64
+ if ('code' in identity) {
65
+ return Promise.reject(identity);
66
+ }
67
+ const requestId = crypto.randomUUID();
68
+ return new Promise((resolve, reject) => {
69
+ const acquisition = {
70
+ requestId,
71
+ expectedRevision: undefined,
72
+ settled: false,
73
+ timer: undefined,
74
+ resolve,
75
+ reject
76
+ };
77
+ pendingAcquisitions.push(acquisition);
78
+ void (async () => {
79
+ const result = await deps.connection.request({
80
+ requestId,
81
+ commandType: 'sdk:get-snapshot',
82
+ body: buildGetSnapshotBody({
83
+ requestId,
84
+ serverInstanceId: identity.serverInstanceId,
85
+ sessionEpoch: identity.sessionEpoch,
86
+ occurredAtMs: deps.scheduler.now()
87
+ })
88
+ });
89
+ if (acquisition.settled) {
90
+ return;
91
+ }
92
+ if (!result.ok) {
93
+ removeAcquisition(acquisition);
94
+ settleReject(acquisition, mapPendingFailure(result));
95
+ return;
96
+ }
97
+ if (!result.reply.ok) {
98
+ removeAcquisition(acquisition);
99
+ settleReject(acquisition, mapReplyFailure(result));
100
+ return;
101
+ }
102
+ const replyRevision = result.reply.revision;
103
+ acquisition.expectedRevision = replyRevision;
104
+ const cached = cache.get();
105
+ if (cached !== undefined &&
106
+ matchSnapshotRevision(cached, replyRevision)) {
107
+ removeAcquisition(acquisition);
108
+ settleResolve(acquisition, cached);
109
+ return;
110
+ }
111
+ acquisition.timer = deps.scheduler.setTimeout(() => {
112
+ removeAcquisition(acquisition);
113
+ settleReject(acquisition, timeoutSnapshotError());
114
+ }, waitTimeoutMs);
115
+ })();
116
+ });
117
+ };
118
+ const requestResync = () => {
119
+ if (resyncInFlight) {
120
+ return;
121
+ }
122
+ resyncInFlight = true;
123
+ void getSnapshotInternal()
124
+ .catch(() => undefined)
125
+ .finally(() => {
126
+ resyncInFlight = false;
127
+ });
128
+ };
129
+ const hub = createEventSubscriptionHub({
130
+ ...(deps.diagnostics !== undefined
131
+ ? { diagnostics: deps.diagnostics }
132
+ : {}),
133
+ onSequenceGap: () => {
134
+ requestResync();
135
+ }
136
+ });
137
+ const onUnhandledMessage = (raw) => {
138
+ if (deps.connection.getState() !== 'ready') {
139
+ return false;
140
+ }
141
+ const inbound = parseProductInbound(raw);
142
+ if (inbound.kind === 'ignored') {
143
+ return false;
144
+ }
145
+ if (inbound.kind === 'snapshot') {
146
+ cache.set(inbound.message);
147
+ notifyMatchingWaiters(inbound.message);
148
+ return true;
149
+ }
150
+ if (inbound.message.type === 'sdk:permission-changed' ||
151
+ inbound.message.type === 'sdk:revoked') {
152
+ // Auth lifecycle events share the per-connection wire sequence with product
153
+ // events. Advance hub sequence (no public listeners) so the next public
154
+ // event does not false-trigger event.sequence_gap / snapshot storms.
155
+ hub.handleEvent(inbound.message, deps.connection.getState());
156
+ if (inbound.message.type === 'sdk:revoked') {
157
+ invalidate();
158
+ }
159
+ return false;
160
+ }
161
+ hub.handleEvent(inbound.message, deps.connection.getState());
162
+ return true;
163
+ };
164
+ return {
165
+ onUnhandledMessage,
166
+ invalidate,
167
+ getCachedSnapshot: () => cache.get(),
168
+ getRevision: () => cache.getRevision(),
169
+ getSnapshot: () => getSnapshotInternal(),
170
+ subscribe: hub.subscribe,
171
+ showWindow: windowApi.showWindow,
172
+ hideWindow: windowApi.hideWindow,
173
+ getWindowState: windowApi.getWindowState,
174
+ originateCall: calls.originateCall,
175
+ controlCall: calls.controlCall,
176
+ sendDtmf: calls.sendDtmf,
177
+ getOperatorReasons: operator.getReasons,
178
+ changeOperatorStatus: operator.changeStatus,
179
+ finishOperatorAppeal: operator.finishAppeal,
180
+ logout: accountLogout.logout,
181
+ activateProfile: accountActivate.activateProfile,
182
+ dispose: () => {
183
+ invalidate();
184
+ hub.clearListeners();
185
+ }
186
+ };
187
+ }
188
+ //# sourceMappingURL=product-orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-orchestrator.js","sourceRoot":"","sources":["../../src/internal/product-orchestrator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EACL,+BAA+B,EAEhC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,EAE9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAA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,CAAC;IACd,CAAC,CAAC;IAEF,OAAO;QACL,kBAAkB;QAClB,UAAU;QACV,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QACpC,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;QACtC,WAAW,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE;QACxC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,cAAc,EAAE,SAAS,CAAC,cAAc;QACxC,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,kBAAkB,EAAE,QAAQ,CAAC,UAAU;QACvC,oBAAoB,EAAE,QAAQ,CAAC,YAAY;QAC3C,oBAAoB,EAAE,QAAQ,CAAC,YAAY;QAC3C,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,eAAe,EAAE,eAAe,CAAC,eAAe;QAChD,OAAO,EAAE,GAAG,EAAE;YACZ,UAAU,EAAE,CAAC;YACb,GAAG,CAAC,cAAc,EAAE,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Product command wire builders (SDK-05 read path + window.show).
3
+ */
4
+ export declare function buildGetSnapshotBody(input: {
5
+ readonly requestId: string;
6
+ readonly serverInstanceId: string;
7
+ readonly sessionEpoch: string;
8
+ readonly occurredAtMs: number;
9
+ }): string;
10
+ export declare function buildWindowShowBody(input: {
11
+ readonly requestId: string;
12
+ readonly serverInstanceId: string;
13
+ readonly sessionEpoch: string;
14
+ readonly occurredAtMs: number;
15
+ }): string;
16
+ export declare function buildWindowGetStateBody(input: {
17
+ readonly requestId: string;
18
+ readonly serverInstanceId: string;
19
+ readonly sessionEpoch: string;
20
+ readonly occurredAtMs: number;
21
+ }): string;
22
+ export declare function buildWindowHideBody(input: {
23
+ readonly requestId: string;
24
+ readonly serverInstanceId: string;
25
+ readonly sessionEpoch: string;
26
+ readonly occurredAtMs: number;
27
+ readonly expectedRevision: number;
28
+ }): string;
29
+ //# sourceMappingURL=product-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-wire.d.ts","sourceRoot":"","sources":["../../src/internal/product-wire.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CAWT;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CAWT;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B,GAAG,MAAM,CAWT;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,GAAG,MAAM,CAWT"}