@m4l/gclick-realtime 1.10.0 → 1.11.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 (197) hide show
  1. package/consumer/RealTimeConsumerContext.d.ts +10 -0
  2. package/consumer/RealTimeConsumerContext.d.ts.map +1 -0
  3. package/consumer/RealTimeConsumerContext.js +128 -0
  4. package/consumer/index.d.ts +4 -0
  5. package/consumer/index.d.ts.map +1 -0
  6. package/consumer/index.js +7 -0
  7. package/consumer/types.d.ts +47 -0
  8. package/consumer/types.d.ts.map +1 -0
  9. package/consumer/useRealTimeConsumer.d.ts.map +1 -0
  10. package/{web/consumer → consumer}/useRealTimeConsumer.js +2 -2
  11. package/contracts/deviceData.d.ts +19 -22
  12. package/contracts/deviceData.d.ts.map +1 -1
  13. package/contracts/deviceDetail.d.ts +0 -2
  14. package/contracts/deviceDetail.d.ts.map +1 -1
  15. package/contracts/index.d.ts +1 -1
  16. package/contracts/index.d.ts.map +1 -1
  17. package/dummy/catalogs/baseDeviceTemplate.d.ts.map +1 -1
  18. package/dummy/catalogs/baseDeviceTemplate.js +4 -35
  19. package/dummy/catalogs/blueprints.d.ts +9 -54
  20. package/dummy/catalogs/blueprints.d.ts.map +1 -1
  21. package/dummy/catalogs/blueprints.js +25 -42
  22. package/dummy/catalogs/departments.d.ts +10 -0
  23. package/dummy/catalogs/departments.d.ts.map +1 -0
  24. package/dummy/catalogs/departments.js +43 -0
  25. package/dummy/index.d.ts +3 -3
  26. package/dummy/index.d.ts.map +1 -1
  27. package/dummy/index.js +28 -28
  28. package/dummy/shared/types.d.ts +2 -4
  29. package/dummy/shared/types.d.ts.map +1 -1
  30. package/dummy/{runtime → simulation}/simulation.d.ts +1 -1
  31. package/dummy/simulation/simulation.d.ts.map +1 -0
  32. package/dummy/{runtime → simulation}/simulation.js +333 -423
  33. package/dummy/{runtime/dummy.d.ts → source-data/SourceDataDummy.d.ts} +8 -3
  34. package/dummy/source-data/SourceDataDummy.d.ts.map +1 -0
  35. package/dummy/{runtime/dummy.js → source-data/SourceDataDummy.js} +117 -128
  36. package/mobile/index.d.ts +4 -0
  37. package/mobile/index.d.ts.map +1 -0
  38. package/mobile/index.js +23 -0
  39. package/mobile/resourceTypes.d.ts +48 -0
  40. package/mobile/resourceTypes.d.ts.map +1 -0
  41. package/mobile/resourceTypes.js +54 -0
  42. package/mobile/runtime/atmosphere.d.ts +10 -0
  43. package/mobile/runtime/atmosphere.d.ts.map +1 -0
  44. package/mobile/runtime/atmosphere.js +16 -0
  45. package/mobile/runtime/dummy.d.ts +11 -0
  46. package/mobile/runtime/dummy.d.ts.map +1 -0
  47. package/mobile/runtime/dummy.js +16 -0
  48. package/mobile/runtime/index.d.ts +11 -0
  49. package/mobile/runtime/index.d.ts.map +1 -0
  50. package/mobile/runtime/runtimeRegistry.d.ts +17 -0
  51. package/mobile/runtime/runtimeRegistry.d.ts.map +1 -0
  52. package/mobile/runtime/runtimeRegistry.js +24 -0
  53. package/mobile/runtime/sourceDataFactory.d.ts +6 -0
  54. package/mobile/runtime/sourceDataFactory.d.ts.map +1 -0
  55. package/mobile/runtime/sourceDataFactory.js +29 -0
  56. package/mobile/runtime/types.d.ts +8 -0
  57. package/mobile/runtime/types.d.ts.map +1 -0
  58. package/package.json +37 -1
  59. package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts +1 -1
  60. package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts.map +1 -1
  61. package/rt_alarms/constants.d.ts +6 -0
  62. package/rt_alarms/constants.d.ts.map +1 -0
  63. package/rt_alarms/constants.js +7 -0
  64. package/rt_alarms/index.d.ts +15 -0
  65. package/rt_alarms/index.d.ts.map +1 -0
  66. package/rt_alarms/index.js +18 -0
  67. package/rt_devices/constants.d.ts +4 -0
  68. package/rt_devices/constants.d.ts.map +1 -0
  69. package/rt_devices/constants.js +5 -0
  70. package/rt_devices/index.d.ts +22 -0
  71. package/rt_devices/index.d.ts.map +1 -0
  72. package/rt_devices/index.js +150 -0
  73. package/rt_devices/resourceTypeMergeStrategies.d.ts +12 -0
  74. package/rt_devices/resourceTypeMergeStrategies.d.ts.map +1 -0
  75. package/rt_devices/resourceTypeMergeStrategies.js +19 -0
  76. package/shared/atmosphereHost.d.ts +5 -0
  77. package/shared/atmosphereHost.d.ts.map +1 -0
  78. package/shared/atmosphereHost.js +7 -0
  79. package/shared/index.d.ts +5 -0
  80. package/shared/index.d.ts.map +1 -0
  81. package/shared/index.js +11 -0
  82. package/shared/performanceMetrics.d.ts +64 -0
  83. package/shared/performanceMetrics.d.ts.map +1 -0
  84. package/shared/performanceMetrics.js +73 -0
  85. package/shared/runtimeRegistry.d.ts +17 -0
  86. package/shared/runtimeRegistry.d.ts.map +1 -0
  87. package/shared/runtimeRegistry.js +27 -0
  88. package/shared/runtimeResourceTypesKey.d.ts +14 -0
  89. package/shared/runtimeResourceTypesKey.d.ts.map +1 -0
  90. package/shared/runtimeResourceTypesKey.js +18 -0
  91. package/shared/startupSnapshots.d.ts +28 -0
  92. package/shared/startupSnapshots.d.ts.map +1 -0
  93. package/shared/startupSnapshots.js +29 -0
  94. package/web/diagnostics/performanceMetrics.d.ts +34 -0
  95. package/web/diagnostics/performanceMetrics.d.ts.map +1 -0
  96. package/web/diagnostics/performanceMetrics.js +61 -0
  97. package/web/host/devicesResourceType.d.ts +3 -11
  98. package/web/host/devicesResourceType.d.ts.map +1 -1
  99. package/web/host/devicesResourceType.js +58 -171
  100. package/web/host/hostRuntime.d.ts +6 -8
  101. package/web/host/hostRuntime.d.ts.map +1 -1
  102. package/web/host/hostRuntime.js +29 -38
  103. package/web/host/index.d.ts +2 -2
  104. package/web/host/index.d.ts.map +1 -1
  105. package/web/host/launchContract.d.ts +19 -13
  106. package/web/host/launchContract.d.ts.map +1 -1
  107. package/web/host/launchContract.js +82 -76
  108. package/web/index.d.ts +2 -7
  109. package/web/index.d.ts.map +1 -1
  110. package/web/index.js +34 -62
  111. package/web/runtime/atmosphere.d.ts +12 -0
  112. package/web/runtime/atmosphere.d.ts.map +1 -0
  113. package/web/runtime/atmosphere.js +22 -0
  114. package/web/runtime/dummy.d.ts +11 -0
  115. package/web/runtime/dummy.d.ts.map +1 -0
  116. package/web/runtime/dummy.js +22 -0
  117. package/web/runtime/index.d.ts +8 -9
  118. package/web/runtime/index.d.ts.map +1 -1
  119. package/web/runtime/performanceMetricReporter.d.ts +8 -0
  120. package/web/runtime/performanceMetricReporter.d.ts.map +1 -0
  121. package/web/runtime/performanceMetricReporter.js +10 -0
  122. package/web/runtime/runtimeRegistry.d.ts +21 -5
  123. package/web/runtime/runtimeRegistry.d.ts.map +1 -1
  124. package/web/runtime/runtimeRegistry.js +22 -7
  125. package/web/runtime/sourceDataFactory.d.ts +7 -0
  126. package/web/runtime/sourceDataFactory.d.ts.map +1 -0
  127. package/web/runtime/sourceDataFactory.js +26 -0
  128. package/web/{producer → runtime}/types.d.ts +2 -7
  129. package/web/runtime/types.d.ts.map +1 -0
  130. package/dummy/catalogs/group.d.ts +0 -10
  131. package/dummy/catalogs/group.d.ts.map +0 -1
  132. package/dummy/catalogs/group.js +0 -46
  133. package/dummy/runtime/dummy.d.ts.map +0 -1
  134. package/dummy/runtime/simulation.d.ts.map +0 -1
  135. package/libs/observability/mf/src/browserRuntimeHandles.js +0 -350
  136. package/libs/observability/mf/src/diagnosticPolicies/catalog.js +0 -12
  137. package/libs/observability/mf/src/diagnosticPolicies/contracts.js +0 -8
  138. package/libs/observability/mf/src/diagnosticPolicies/host.js +0 -127
  139. package/libs/observability/mf/src/diagnosticPolicies/operativeMyGpsDevices.js +0 -79
  140. package/web/consumer/RealTimeConsumerContext.d.ts +0 -10
  141. package/web/consumer/RealTimeConsumerContext.d.ts.map +0 -1
  142. package/web/consumer/RealTimeConsumerContext.js +0 -156
  143. package/web/consumer/index.d.ts +0 -6
  144. package/web/consumer/index.d.ts.map +0 -1
  145. package/web/consumer/store.d.ts +0 -10
  146. package/web/consumer/store.d.ts.map +0 -1
  147. package/web/consumer/store.helpers.d.ts +0 -62
  148. package/web/consumer/store.helpers.d.ts.map +0 -1
  149. package/web/consumer/store.helpers.js +0 -141
  150. package/web/consumer/store.js +0 -227
  151. package/web/consumer/types.d.ts +0 -161
  152. package/web/consumer/types.d.ts.map +0 -1
  153. package/web/consumer/useRealTimeConsumer.d.ts.map +0 -1
  154. package/web/host/startupSnapshots.d.ts +0 -45
  155. package/web/host/startupSnapshots.d.ts.map +0 -1
  156. package/web/host/startupSnapshots.js +0 -103
  157. package/web/producer/RealTimeProducerContext.d.ts +0 -9
  158. package/web/producer/RealTimeProducerContext.d.ts.map +0 -1
  159. package/web/producer/RealTimeProducerContext.js +0 -16
  160. package/web/producer/index.d.ts +0 -7
  161. package/web/producer/index.d.ts.map +0 -1
  162. package/web/producer/sourceDataFactory.d.ts +0 -13
  163. package/web/producer/sourceDataFactory.d.ts.map +0 -1
  164. package/web/producer/sourceDataFactory.js +0 -32
  165. package/web/producer/store.d.ts +0 -7
  166. package/web/producer/store.d.ts.map +0 -1
  167. package/web/producer/store.js +0 -5
  168. package/web/producer/types.d.ts.map +0 -1
  169. package/web/producer/useRealTimeProducer.d.ts +0 -7
  170. package/web/producer/useRealTimeProducer.d.ts.map +0 -1
  171. package/web/producer/useRealTimeProducer.js +0 -15
  172. package/web/runtime/resourceTypeMergeStrategies.d.ts +0 -10
  173. package/web/runtime/resourceTypeMergeStrategies.d.ts.map +0 -1
  174. package/web/runtime/resourceTypeMergeStrategies.js +0 -19
  175. package/web/runtime/runtime.d.ts +0 -16
  176. package/web/runtime/runtime.d.ts.map +0 -1
  177. package/web/runtime/runtime.js +0 -28
  178. package/web/runtime/runtimeAtmosphereOnly.d.ts +0 -11
  179. package/web/runtime/runtimeAtmosphereOnly.d.ts.map +0 -1
  180. package/web/runtime/runtimeAtmosphereOnly.js +0 -28
  181. package/web/runtime/runtimeRegistry.shared.d.ts +0 -23
  182. package/web/runtime/runtimeRegistry.shared.d.ts.map +0 -1
  183. package/web/runtime/runtimeRegistry.shared.js +0 -47
  184. package/web/runtime/runtimeRegistryAtmosphereOnly.d.ts +0 -9
  185. package/web/runtime/runtimeRegistryAtmosphereOnly.d.ts.map +0 -1
  186. package/web/runtime/runtimeRegistryAtmosphereOnly.js +0 -13
  187. package/web/shared/constants.d.ts +0 -11
  188. package/web/shared/constants.d.ts.map +0 -1
  189. package/web/shared/constants.js +0 -11
  190. package/web/shared/index.d.ts +0 -3
  191. package/web/shared/index.d.ts.map +0 -1
  192. package/web/shared/performanceMetrics.d.ts +0 -48
  193. package/web/shared/performanceMetrics.d.ts.map +0 -1
  194. package/web/shared/performanceMetrics.js +0 -70
  195. package/web/shared/runtimeTypes.d.ts +0 -4
  196. package/web/shared/runtimeTypes.d.ts.map +0 -1
  197. /package/{web/consumer → consumer}/useRealTimeConsumer.d.ts +0 -0
@@ -0,0 +1,73 @@
1
+ const S = 1e3;
2
+ function d(t) {
3
+ return {
4
+ metrics: {},
5
+ updatedAt: t
6
+ };
7
+ }
8
+ function r(t) {
9
+ return Number.isFinite(t) ? Math.max(0, t) : 1;
10
+ }
11
+ function c(t, n = 1e3) {
12
+ return {
13
+ lastBatchSize: 0,
14
+ lastEventAt: t,
15
+ lastValue: 0,
16
+ lastWindowDurationMs: n,
17
+ perSecondCount: 0,
18
+ perSecondItems: 0,
19
+ perSecondMaxBatchSize: 0,
20
+ perSecondMaxValue: 0,
21
+ perSecondValue: 0,
22
+ totalCount: 0,
23
+ totalItems: 0,
24
+ totalMaxBatchSize: 0,
25
+ totalMaxValue: 0,
26
+ totalValue: 0,
27
+ windowCount: 0,
28
+ windowItems: 0,
29
+ windowMaxBatchSize: 0,
30
+ windowMaxValue: 0,
31
+ windowStartedAt: t,
32
+ windowValue: 0
33
+ };
34
+ }
35
+ function s(t, n, l = 1e3) {
36
+ const e = n - t.windowStartedAt;
37
+ e < l || (t.perSecondCount = t.windowCount, t.perSecondItems = t.windowItems, t.perSecondMaxBatchSize = t.windowMaxBatchSize, t.perSecondValue = t.windowValue, t.perSecondMaxValue = t.windowMaxValue, t.lastWindowDurationMs = e, t.windowCount = 0, t.windowItems = 0, t.windowMaxBatchSize = 0, t.windowValue = 0, t.windowMaxValue = 0, t.windowStartedAt = n);
38
+ }
39
+ function x(t = {}) {
40
+ const n = t.now ?? Date.now, l = t.windowMs ?? 1e3;
41
+ let e = t.initialState ?? d(
42
+ n()
43
+ );
44
+ return {
45
+ getState() {
46
+ return e;
47
+ },
48
+ recordMetric(w, M = 1) {
49
+ const u = n(), o = r(M), i = Math.floor(Math.max(1, o)), a = e.metrics[w] ?? (e.metrics[w] = c(
50
+ u,
51
+ l
52
+ ));
53
+ return s(a, u, l), a.windowCount += 1, a.windowItems += i, a.windowMaxBatchSize = Math.max(
54
+ a.windowMaxBatchSize,
55
+ i
56
+ ), a.windowValue += o, a.windowMaxValue = Math.max(a.windowMaxValue, o), a.totalCount += 1, a.totalItems += i, a.totalMaxBatchSize = Math.max(
57
+ a.totalMaxBatchSize,
58
+ i
59
+ ), a.totalValue += o, a.totalMaxValue = Math.max(a.totalMaxValue, o), a.lastBatchSize = i, a.lastValue = o, a.lastEventAt = u, e.updatedAt = u, t.onChange?.(e, w), e;
60
+ },
61
+ reset(w) {
62
+ return e = d(n()), (w?.notify ?? !0) && t.onChange?.(e), e;
63
+ }
64
+ };
65
+ }
66
+ export {
67
+ S as REALTIME_PERFORMANCE_WINDOW_MS,
68
+ c as createRealtimePerformanceMetric,
69
+ x as createRealtimePerformanceMetricsAccumulator,
70
+ d as createRealtimePerformanceMetricsState,
71
+ r as normalizeRealtimePerformanceMetricValue,
72
+ s as rollRealtimePerformanceWindow
73
+ };
@@ -0,0 +1,17 @@
1
+ import { RealtimeRuntime } from '@m4l/realtime-runtime/shared';
2
+ export interface GClickRealtimeRuntimeKeyProps {
3
+ runtimeKey: string;
4
+ }
5
+ export interface CreateGClickRealtimeRuntimeRegistryGetterProps<TPublicProps extends GClickRealtimeRuntimeKeyProps, TCreateProps, TRuntime extends RealtimeRuntime> {
6
+ createRuntime: (props: TCreateProps) => TRuntime;
7
+ resolveCreateProps: (props: TPublicProps, runtimeKey: string) => TCreateProps;
8
+ }
9
+ /**
10
+ * Create one typed registry getter for one GClick runtime factory.
11
+ */
12
+ export declare function createGClickRealtimeRuntimeRegistryGetter<TPublicProps extends GClickRealtimeRuntimeKeyProps, TCreateProps, TRuntime extends RealtimeRuntime>(props: CreateGClickRealtimeRuntimeRegistryGetterProps<TPublicProps, TCreateProps, TRuntime>): (publicProps: TPublicProps) => TRuntime;
13
+ /**
14
+ * Dispose one cached GClick runtime associated with the provided public runtime key.
15
+ */
16
+ export declare function disposeGClickRealtimeRuntimeByKey(runtimeKey: string): void;
17
+ //# sourceMappingURL=runtimeRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeRegistry.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick-realtime/src/shared/runtimeRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAItC,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,8CAA8C,CAC7D,YAAY,SAAS,6BAA6B,EAClD,YAAY,EACZ,QAAQ,SAAS,eAAe;IAEhC,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,QAAQ,CAAC;IACjD,kBAAkB,EAAE,CAClB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,KACf,YAAY,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CACvD,YAAY,SAAS,6BAA6B,EAClD,YAAY,EACZ,QAAQ,SAAS,eAAe,EAEhC,KAAK,EAAE,8CAA8C,CACnD,YAAY,EACZ,YAAY,EACZ,QAAQ,CACT,IAQC,aAAa,YAAY,KACxB,QAAQ,CAeZ;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,QAUnE"}
@@ -0,0 +1,27 @@
1
+ import { createGetOrCreateRuntime as m, disposeRealtimeRuntime as u } from "@m4l/realtime-runtime/shared";
2
+ const n = "gclick-realtime";
3
+ function o(e) {
4
+ const t = m(e.createRuntime);
5
+ return function(i) {
6
+ const r = i.runtimeKey.trim();
7
+ if (!r)
8
+ throw new Error("GClick realtime runtime requires a non-empty runtimeKey.");
9
+ return t({
10
+ createProps: e.resolveCreateProps(
11
+ i,
12
+ r
13
+ ),
14
+ runtimeKey: `${n}:${r}`
15
+ });
16
+ };
17
+ }
18
+ function a(e) {
19
+ const t = e.trim();
20
+ t && u(
21
+ `${n}:${t}`
22
+ );
23
+ }
24
+ export {
25
+ o as createGClickRealtimeRuntimeRegistryGetter,
26
+ a as disposeGClickRealtimeRuntimeByKey
27
+ };
@@ -0,0 +1,14 @@
1
+ import { RealTimeResourceSerialId, RealTimeResourceTypeId } from '@m4l/realtime-runtime/shared';
2
+ export interface GClickRealtimeRuntimeResourceTypeKeyInput {
3
+ consumerType?: string;
4
+ publishParams?: Record<string, unknown>;
5
+ rateLimit?: number;
6
+ resourceTypeId: RealTimeResourceTypeId;
7
+ resourcesId?: Array<RealTimeResourceSerialId | 'all'>;
8
+ sizeLimit?: number | null;
9
+ }
10
+ /**
11
+ * Build a stable resource-types signature for runtime-cache partitioning.
12
+ */
13
+ export declare function createGClickRealtimeResourceTypesKeySegment(resourceTypes: GClickRealtimeRuntimeResourceTypeKeyInput[]): string;
14
+ //# sourceMappingURL=runtimeResourceTypesKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeResourceTypesKey.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick-realtime/src/shared/runtimeResourceTypesKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,yCAAyC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,sBAAsB,CAAC;IACvC,WAAW,CAAC,EAAE,KAAK,CAAC,wBAAwB,GAAG,KAAK,CAAC,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,2CAA2C,CACzD,aAAa,EAAE,yCAAyC,EAAE,UAkB3D"}
@@ -0,0 +1,18 @@
1
+ function t(i) {
2
+ const r = i.map((e) => ({
3
+ consumerType: e.consumerType ?? "batch",
4
+ publishParams: e.publishParams ?? {},
5
+ rateLimit: e.rateLimit ?? 3,
6
+ resourceTypeId: e.resourceTypeId,
7
+ resourcesId: e.resourcesId ?? ["all"],
8
+ sizeLimit: e.sizeLimit ?? null
9
+ })).sort(
10
+ (e, s) => e.resourceTypeId.localeCompare(
11
+ s.resourceTypeId
12
+ )
13
+ );
14
+ return JSON.stringify(r);
15
+ }
16
+ export {
17
+ t as createGClickRealtimeResourceTypesKeySegment
18
+ };
@@ -0,0 +1,28 @@
1
+ import { RealTimeProducerTools, RealTimeStartupSnapshotConfig, RealTimeStartupSnapshotLoadContext, RealTimeStartupSnapshotMessagesLoader } from '@m4l/realtime-runtime/shared';
2
+ /** Host-facing alias for the shared startup snapshot loader contract. */
3
+ export type GClickRealtimeStartupSnapshotMessagesLoader = RealTimeStartupSnapshotMessagesLoader;
4
+ /** GClick-facing alias for the shared startup snapshot load context. */
5
+ export type GClickRealtimeStartupSnapshotLoadContext = RealTimeStartupSnapshotLoadContext;
6
+ /** Resource-owned snapshot definition before the host assigns its resource type. */
7
+ export type GClickRealtimeResourceStartupSnapshotConfig = Omit<RealTimeStartupSnapshotConfig, 'resourceTypeId'>;
8
+ /** Host-facing alias for the shared runtime startup snapshot definition. */
9
+ export type GClickRealtimeStartupSnapshotConfig = RealTimeStartupSnapshotConfig;
10
+ export interface ReplayGClickRealtimeStartupSnapshotsOnceProps {
11
+ producerTools: RealTimeProducerTools;
12
+ runtimeKey: string;
13
+ startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
14
+ }
15
+ export interface ReplayGClickRealtimeStartupSnapshotsOnReconnectProps {
16
+ producerTools: RealTimeProducerTools;
17
+ runtimeKey: string;
18
+ startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
19
+ }
20
+ /** Replay all configured startup snapshots once for one host runtime instance. */
21
+ export declare function replayGClickRealtimeStartupSnapshotsOnce(props: ReplayGClickRealtimeStartupSnapshotsOnceProps): void;
22
+ /** Replay configured authoritative snapshots after one transport recovery. */
23
+ export declare function replayGClickRealtimeStartupSnapshotsOnReconnect(props: ReplayGClickRealtimeStartupSnapshotsOnReconnectProps): void;
24
+ /** Dispose replay state owned by one host runtime key. */
25
+ export declare function disposeGClickRealtimeStartupSnapshots(runtimeKey: string): void;
26
+ /** Dispose all replay controllers between focused host unit tests. */
27
+ export declare function resetGClickRealtimeStartupSnapshotsForTesting(): void;
28
+ //# sourceMappingURL=startupSnapshots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startupSnapshots.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick-realtime/src/shared/startupSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,EAE3C,MAAM,8BAA8B,CAAC;AAEtC,yEAAyE;AACzE,MAAM,MAAM,2CAA2C,GACrD,qCAAqC,CAAC;AAExC,wEAAwE;AACxE,MAAM,MAAM,wCAAwC,GAClD,kCAAkC,CAAC;AAErC,oFAAoF;AACpF,MAAM,MAAM,2CAA2C,GAAG,IAAI,CAC5D,6BAA6B,EAC7B,gBAAgB,CACjB,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,mCAAmC,GAC7C,6BAA6B,CAAC;AAEhC,MAAM,WAAW,6CAA6C;IAC5D,aAAa,EAAE,qBAAqB,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,mCAAmC,EAAE,CAAC;CAC1D;AAED,MAAM,WAAW,oDAAoD;IACnE,aAAa,EAAE,qBAAqB,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,mCAAmC,EAAE,CAAC;CAC1D;AA8BD,kFAAkF;AAClF,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,6CAA6C,GACnD,IAAI,CAEN;AAED,8EAA8E;AAC9E,wBAAgB,+CAA+C,CAC7D,KAAK,EAAE,oDAAoD,GAC1D,IAAI,CAEN;AAED,0DAA0D;AAC1D,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAG9E;AAED,sEAAsE;AACtE,wBAAgB,6CAA6C,IAAI,IAAI,CAKpE"}
@@ -0,0 +1,29 @@
1
+ import { createRealTimeStartupSnapshotReplayController as l } from "@m4l/realtime-runtime/shared";
2
+ const e = /* @__PURE__ */ new Map();
3
+ function n(t) {
4
+ const r = e.get(t.runtimeKey);
5
+ if (r)
6
+ return r;
7
+ const o = l({
8
+ onReplayError: (a) => {
9
+ console.warn("GClick realtime startup snapshot replay failed.", a);
10
+ },
11
+ producerTools: t.producerTools,
12
+ startupSnapshots: t.startupSnapshots
13
+ });
14
+ return e.set(t.runtimeKey, o), o;
15
+ }
16
+ function p(t) {
17
+ n(t).replayOnce();
18
+ }
19
+ function c(t) {
20
+ n(t).replayOnReconnect();
21
+ }
22
+ function i(t) {
23
+ e.get(t)?.dispose(), e.delete(t);
24
+ }
25
+ export {
26
+ i as disposeGClickRealtimeStartupSnapshots,
27
+ c as replayGClickRealtimeStartupSnapshotsOnReconnect,
28
+ p as replayGClickRealtimeStartupSnapshotsOnce
29
+ };
@@ -0,0 +1,34 @@
1
+ import { RealtimePerformanceMetricsState, RealtimePerformanceMetric, RealtimePerformanceMetricId } from '../../shared/performanceMetrics';
2
+ declare const realtimePerformanceDebugHandle: Readonly<{
3
+ readonly id: "realtime.performance-debug";
4
+ readonly key: "globalThis.__M4L_REALTIME_PERFORMANCE__";
5
+ readonly property: "__M4L_REALTIME_PERFORMANCE__";
6
+ readonly purpose: "Publish shared realtime performance counters and motion metrics for browser inspection.";
7
+ }>;
8
+ declare global {
9
+ interface globalThis {
10
+ [realtimePerformanceDebugHandle.property]?: RealtimePerformanceMetricsState;
11
+ }
12
+ }
13
+ /**
14
+ * Return whether browser-readable realtime debug metrics are enabled for this build.
15
+ */
16
+ export declare function isRealtimePerformanceMetricsEnabled(): boolean;
17
+ /**
18
+ * Read a monotonic timestamp for local duration metrics.
19
+ */
20
+ export declare function getRealtimePerformanceNowMs(): number;
21
+ /**
22
+ * Record one browser realtime performance sample for console inspection.
23
+ */
24
+ export declare function recordWebRealtimePerformanceMetric(metricId: RealtimePerformanceMetricId, value?: number): void;
25
+ /**
26
+ * Record the active web consumer store count for fan-out diagnostics.
27
+ */
28
+ export declare function recordActiveRealtimeConsumerStoreCount(delta: 1 | -1): void;
29
+ /**
30
+ * Record the active producer subscription count owned by web consumers.
31
+ */
32
+ export declare function recordActiveRealtimeConsumerSubscriptionCount(delta: 1 | -1): void;
33
+ export type { RealtimePerformanceMetric, RealtimePerformanceMetricId, RealtimePerformanceMetricsState, };
34
+ //# sourceMappingURL=performanceMetrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performanceMetrics.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/diagnostics/performanceMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,+BAA+B,EACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AASzC,QAAA,MAAM,8BAA8B;;;;;EAK4C,CAAC;AAIjF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC,EACxC,+BAA+B,CAAC;KACnC;CACF;AAwBD;;GAEG;AACH,wBAAgB,mCAAmC,YAElD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,WAI1C;AA8DD;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,2BAA2B,EACrC,KAAK,SAAI,QAMV;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QASnE;AAED;;GAEG;AACH,wBAAgB,6CAA6C,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAS1E;AAED,YAAY,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,GAChC,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { createRealtimePerformanceMetricsAccumulator as s } from "../../shared/performanceMetrics.js";
2
+ const o = Object.freeze({
3
+ id: "realtime.performance-debug",
4
+ key: "globalThis.__M4L_REALTIME_PERFORMANCE__",
5
+ property: "__M4L_REALTIME_PERFORMANCE__",
6
+ purpose: "Publish shared realtime performance counters and motion metrics for browser inspection."
7
+ }), i = globalThis, u = typeof M4L_ENABLE_REALTIME_DEBUG_METRICS < "u" ? M4L_ENABLE_REALTIME_DEBUG_METRICS : !1;
8
+ let n = 0, c = 0, r, a;
9
+ function M() {
10
+ return u;
11
+ }
12
+ function l() {
13
+ if (!u)
14
+ return;
15
+ const e = Date.now();
16
+ i[o.property] || (i[o.property] = {
17
+ metrics: {},
18
+ updatedAt: e
19
+ });
20
+ const t = i[o.property];
21
+ if (t)
22
+ return t.metrics = t.metrics ?? {}, t;
23
+ }
24
+ function f() {
25
+ const e = l();
26
+ if (e)
27
+ return r && a === e || (a = e, r = s({
28
+ initialState: e,
29
+ now: Date.now
30
+ })), r;
31
+ }
32
+ function m(e, t = 1) {
33
+ f()?.recordMetric(
34
+ e,
35
+ t
36
+ );
37
+ }
38
+ function _(e) {
39
+ n = Math.max(
40
+ 0,
41
+ n + e
42
+ ), m(
43
+ "consumerActiveStoreCount",
44
+ n
45
+ );
46
+ }
47
+ function R(e) {
48
+ c = Math.max(
49
+ 0,
50
+ c + e
51
+ ), m(
52
+ "consumerActiveSubscriptionCount",
53
+ c
54
+ );
55
+ }
56
+ export {
57
+ M as isRealtimePerformanceMetricsEnabled,
58
+ _ as recordActiveRealtimeConsumerStoreCount,
59
+ R as recordActiveRealtimeConsumerSubscriptionCount,
60
+ m as recordWebRealtimePerformanceMetric
61
+ };
@@ -1,6 +1,7 @@
1
- import { RealTimeMessage, RealTimeResourceMessageNormalizeStrategy, RealTimeResourceTypeId } from '../shared/runtimeTypes';
2
- import { GClickRealtimeResourceStartupSnapshotConfig } from './startupSnapshots';
1
+ import { RealTimeResourceTypeId } from '@m4l/realtime-runtime/shared';
2
+ import { GClickRealtimeResourceStartupSnapshotConfig } from '../../shared/startupSnapshots';
3
3
  import { GClickRealtimeAtmosphereResourceTypeLaunchConfig } from './launchContract';
4
+ export { createGClickRtDevicesStartupSnapshotMessages as createGClickDevicesStartupSnapshotMessages, normalizeGClickRtDevicesRealtimeMessage as normalizeGClickDevicesRealtimeMessage, } from '../../rt_devices/index';
4
5
  /**
5
6
  * Snapshot loader used by host shells to fetch a full devices startup payload.
6
7
  */
@@ -46,14 +47,6 @@ export type CreateGClickDevicesAtmosphereResourceTypeProps = CreateGClickDevices
46
47
  networkOperation?: never;
47
48
  startupSnapshot: GClickRealtimeResourceStartupSnapshotConfig;
48
49
  };
49
- /**
50
- * Normalize one live `rt_devices` realtime message to the shared hash-key and payload identity contract.
51
- */
52
- export declare const normalizeGClickDevicesRealtimeMessage: RealTimeResourceMessageNormalizeStrategy;
53
- /**
54
- * Convert a backend devices snapshot response into replayable `rt_devices` realtime messages.
55
- */
56
- export declare function createGClickDevicesStartupSnapshotMessages(response: unknown, resourceTypeId?: RealTimeResourceTypeId): RealTimeMessage[];
57
50
  /**
58
51
  * Create one `rt_devices` startup snapshot from a shell-owned snapshot loader.
59
52
  */
@@ -66,5 +59,4 @@ export declare function createGClickDevicesHotStartupSnapshot(props: CreateGClic
66
59
  * Create the Atmosphere launch config for the devices resource type with its own merge and snapshot policy.
67
60
  */
68
61
  export declare function createGClickDevicesAtmosphereResourceType(props: CreateGClickDevicesAtmosphereResourceTypeProps): GClickRealtimeAtmosphereResourceTypeLaunchConfig;
69
- export {};
70
62
  //# sourceMappingURL=devicesResourceType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"devicesResourceType.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/devicesResourceType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,wCAAwC,EAGxC,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EACV,gDAAgD,EACjD,MAAM,kBAAkB,CAAC;AAS1B;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,MAC/C,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAE7B,MAAM,WAAW,uCAAuC;IACtD,YAAY,EAAE,kCAAkC,CAAC;IACjD,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE;QACL,GAAG,EAAE,IAAI,CAAC;KACX,CAAC;IACF,mBAAmB,EAAE,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,+CAA+C,GAAG,CAAC,CAAC,GAAG,OAAO,EACxE,OAAO,EAAE,sCAAsC,KAC5C,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,WAAW,0CAA0C;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,+CAA+C,CAAC;IAClE,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,KAAK,kDAAkD,GACrD,IAAI,CACF,OAAO,CAAC,gDAAgD,CAAC,EACzD,sBAAsB,GAAG,gBAAgB,GAAG,iBAAiB,CAC9D,GAAG;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,sBAAsB,CAAC;IACvC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEJ,MAAM,MAAM,8CAA8C,GACtD,kDAAkD,GAAG;IACrD,gBAAgB,EAAE,+CAA+C,CAAC;IAClE,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB,GACC,kDAAkD,GAAG;IACrD,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,eAAe,EAAE,2CAA2C,CAAC;CAC9D,CAAC;AAwKJ;;GAEG;AACH,eAAO,MAAM,qCAAqC,EAAE,wCAwCnD,CAAC;AAwCF;;GAEG;AACH,wBAAgB,0CAA0C,CACxD,QAAQ,EAAE,OAAO,EACjB,cAAc,GAAE,sBAAqD,GACpE,eAAe,EAAE,CAiCnB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,uCAAuC,GAC7C,2CAA2C,CAa7C;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,0CAA0C,GAChD,2CAA2C,CA2B7C;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,gDAAgD,CAyBlD"}
1
+ {"version":3,"file":"devicesResourceType.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/devicesResourceType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACvB,MAAM,8BAA8B,CAAC;AAStC,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,KAAK,EACV,gDAAgD,EACjD,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,4CAA4C,IAAI,0CAA0C,EAC1F,uCAAuC,IAAI,qCAAqC,GACjF,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,MAC/C,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAE7B,MAAM,WAAW,uCAAuC;IACtD,YAAY,EAAE,kCAAkC,CAAC;IACjD,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,IAAI,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE;QACL,GAAG,EAAE,IAAI,CAAC;KACX,CAAC;IACF,mBAAmB,EAAE,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,+CAA+C,GAAG,CAAC,CAAC,GAAG,OAAO,EACxE,OAAO,EAAE,sCAAsC,KAC5C,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,WAAW,0CAA0C;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,+CAA+C,CAAC;IAClE,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC;AAED,KAAK,kDAAkD,GACrD,IAAI,CACF,OAAO,CAAC,gDAAgD,CAAC,EACzD,sBAAsB,GAAG,gBAAgB,GAAG,iBAAiB,CAC9D,GAAG;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,sBAAsB,CAAC;IACvC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEJ,MAAM,MAAM,8CAA8C,GACtD,kDAAkD,GAAG;IACrD,gBAAgB,EAAE,+CAA+C,CAAC;IAClE,eAAe,CAAC,EAAE,KAAK,CAAC;CACzB,GACC,kDAAkD,GAAG;IACrD,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,eAAe,EAAE,2CAA2C,CAAC;CAC9D,CAAC;AAsCJ;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,uCAAuC,GAC7C,2CAA2C,CAa7C;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,0CAA0C,GAChD,2CAA2C,CA2B7C;AAED;;GAEG;AACH,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,8CAA8C,GACpD,gDAAgD,CAyBlD"}
@@ -1,160 +1,47 @@
1
- import { EnumResourceTypesIds as c } from "../shared/constants.js";
2
- import { mergeDevicePayloadWithUpdatedAtGuard as f } from "../../payload/mergeDevicePayloadWithUpdatedAtGuard.js";
3
- const I = [
4
- "devices",
5
- "resources",
6
- "items",
7
- "results"
8
- ], y = "operative", m = "devices/";
9
- function D(...e) {
10
- const [r = "", ...t] = e, n = r.replace(/\/+$/u, ""), o = t.map((i) => i.replace(/^\/+|\/+$/gu, "")).filter(Boolean);
11
- return [n, ...o].join("/");
12
- }
13
- function h(e) {
14
- return e.startupSnapshotHostApiRemote?.trim() ? D(
15
- e.startupSnapshotHostApiRemote,
16
- e.database,
17
- e.endPoint
18
- ) : e.endPoint;
19
- }
20
- function a(e) {
21
- return typeof e == "object" && e !== null && !Array.isArray(e);
22
- }
23
- function A(e) {
24
- return a(e) && "data" in e ? e.data : e;
25
- }
26
- function l(e) {
27
- return typeof e == "string" && e.trim() ? e : null;
28
- }
29
- function d(e) {
30
- return typeof e == "number" && Number.isSafeInteger(e);
31
- }
32
- function P(e) {
33
- return typeof e == "string" && !!e.trim();
34
- }
35
- function v(e) {
36
- const r = Number(e);
37
- return Number.isSafeInteger(r) ? r : null;
38
- }
39
- function p(e, r) {
40
- return l(
41
- e.resourceSerialId ?? e.serialId ?? r
42
- );
43
- }
44
- function E(e, r) {
45
- if ("id" in e && !d(e.id))
46
- return null;
47
- const t = { ...e };
48
- if (delete t.resourceId, delete t.resourceSerialId, delete t.serialId, !("id" in t)) {
49
- const n = v(r);
50
- if (n === null)
51
- return null;
52
- t.id = n;
53
- }
54
- return t;
55
- }
56
- function T(e) {
57
- if (!d(e.id) || !P(e.serialId))
58
- return null;
59
- const r = { ...e };
60
- return delete r.resourceId, delete r.resourceSerialId, delete r.serialId, r.alias === null && delete r.alias, r;
61
- }
62
- const R = (e) => {
63
- const r = l(e.resourceSerialId);
64
- if (!r)
65
- return null;
66
- if (e.type === "delete")
67
- return e.resourceSerialId === r ? e : {
68
- ...e,
69
- resourceSerialId: r
70
- };
71
- if (!a(e.payload))
72
- return null;
73
- const t = E(
74
- e.payload,
75
- r
76
- );
77
- return t ? r === e.resourceSerialId && t === e.payload ? e : {
78
- ...e,
79
- payload: t,
80
- resourceSerialId: r
81
- } : null;
82
- };
83
- function C(e) {
84
- const r = A(e);
85
- if (Array.isArray(r))
86
- return r.map((t) => ({
87
- deviceCandidate: t
88
- }));
89
- if (!a(r))
90
- return [];
91
- if (p(r))
92
- return [{ deviceCandidate: r }];
93
- for (const t of I) {
94
- const n = r[t];
95
- if (Array.isArray(n))
96
- return n.map((o) => ({
97
- deviceCandidate: o
98
- }));
99
- }
100
- return Object.entries(r).map(([t, n]) => ({
101
- deviceCandidate: n,
102
- resourceSerialId: t
103
- }));
104
- }
105
- function _(e, r = c.devices) {
106
- return C(e).flatMap(({
107
- deviceCandidate: t,
108
- resourceSerialId: n
109
- }) => {
110
- if (!a(t))
111
- return [];
112
- const o = p(
113
- t,
114
- n
115
- );
116
- if (o === null)
117
- return [];
118
- const i = T(t);
119
- return i === null ? [] : [
120
- {
121
- payload: i,
122
- resourceSerialId: o,
123
- resourceTypeId: r,
124
- type: "update"
125
- }
126
- ];
127
- });
128
- }
129
- function N(e) {
1
+ import { createGClickRtDevicesStartupSnapshotMessages as u, normalizeGClickRtDevicesRealtimeMessage as S } from "../../rt_devices/index.js";
2
+ import { mergeDevicePayloadWithUpdatedAtGuard as l } from "../../payload/mergeDevicePayloadWithUpdatedAtGuard.js";
3
+ import { GCLICK_RT_DEVICES_RESOURCE_TYPE_ID as c } from "../../rt_devices/constants.js";
4
+ const d = "operative", m = "devices/";
5
+ function h(...t) {
6
+ const [e = "", ...a] = t, s = e.replace(/\/+$/u, ""), o = a.map((r) => r.replace(/^\/+|\/+$/gu, "")).filter(Boolean);
7
+ return [s, ...o].join("/");
8
+ }
9
+ function C(t) {
10
+ return t.startupSnapshotHostApiRemote?.trim() ? h(
11
+ t.startupSnapshotHostApiRemote,
12
+ t.database,
13
+ t.endPoint
14
+ ) : t.endPoint;
15
+ }
16
+ function P(t) {
130
17
  const {
131
- loadSnapshot: r,
132
- resourceTypeId: t = c.devices
133
- } = e;
18
+ loadSnapshot: e,
19
+ resourceTypeId: a = c
20
+ } = t;
134
21
  return {
135
22
  authoritativeResourceSet: !0,
136
- loadMessages: async () => _(
137
- await r(),
138
- t
23
+ loadMessages: async () => u(
24
+ await e(),
25
+ a
139
26
  )
140
27
  };
141
28
  }
142
- function b(e) {
29
+ function T(t) {
143
30
  const {
144
- database: r = y,
145
- endPoint: t = m,
146
- networkOperation: n,
147
- resourceTypeId: o = c.devices,
148
- startupSnapshotHostApiRemote: i
149
- } = e, s = h({
150
- database: r,
151
- endPoint: t,
152
- startupSnapshotHostApiRemote: i
153
- }), u = !!i?.trim();
154
- return N({
155
- loadSnapshot: () => n({
156
- ...u ? { isExternalUrl: !0 } : { database: r },
157
- endPoint: s,
31
+ database: e = d,
32
+ endPoint: a = m,
33
+ networkOperation: s,
34
+ resourceTypeId: o = c,
35
+ startupSnapshotHostApiRemote: r
36
+ } = t, n = C({
37
+ database: e,
38
+ endPoint: a,
39
+ startupSnapshotHostApiRemote: r
40
+ }), i = !!r?.trim();
41
+ return P({
42
+ loadSnapshot: () => s({
43
+ ...i ? { isExternalUrl: !0 } : { database: e },
44
+ endPoint: n,
158
45
  method: "GET",
159
46
  parms: {
160
47
  hot: !0
@@ -164,34 +51,34 @@ function b(e) {
164
51
  resourceTypeId: o
165
52
  });
166
53
  }
167
- function H(e) {
54
+ function A(t) {
168
55
  const {
169
- database: r,
170
- endPoint: t,
171
- networkOperation: n,
56
+ database: e,
57
+ endPoint: a,
58
+ networkOperation: s,
172
59
  resourceTypeId: o,
173
- startupSnapshot: i,
174
- startupSnapshotHostApiRemote: s,
175
- ...u
176
- } = e, S = i ?? b({
177
- database: r,
178
- endPoint: t,
179
- networkOperation: n,
60
+ startupSnapshot: r,
61
+ startupSnapshotHostApiRemote: n,
62
+ ...i
63
+ } = t, p = r ?? T({
64
+ database: e,
65
+ endPoint: a,
66
+ networkOperation: s,
180
67
  resourceTypeId: o,
181
- startupSnapshotHostApiRemote: s
68
+ startupSnapshotHostApiRemote: n
182
69
  });
183
70
  return {
184
- ...u,
185
- normalizeMessageStrategy: R,
186
- startupSnapshot: S,
71
+ ...i,
72
+ normalizeMessageStrategy: S,
73
+ startupSnapshot: p,
187
74
  resourceTypeId: o,
188
- mergePayloadStrategy: f
75
+ mergePayloadStrategy: l
189
76
  };
190
77
  }
191
78
  export {
192
- H as createGClickDevicesAtmosphereResourceType,
193
- b as createGClickDevicesHotStartupSnapshot,
194
- N as createGClickDevicesStartupSnapshot,
195
- _ as createGClickDevicesStartupSnapshotMessages,
196
- R as normalizeGClickDevicesRealtimeMessage
79
+ A as createGClickDevicesAtmosphereResourceType,
80
+ T as createGClickDevicesHotStartupSnapshot,
81
+ P as createGClickDevicesStartupSnapshot,
82
+ u as createGClickDevicesStartupSnapshotMessages,
83
+ S as normalizeGClickDevicesRealtimeMessage
197
84
  };
@@ -1,7 +1,7 @@
1
1
  import { OnRealTimeTransportReconnectCallback, RealTimeProducerTools } from '@m4l/realtime-runtime';
2
- import { RealTimeDummySimulationPresetId } from '../../dummy/index';
3
- import { RealTimeResourceSourceMechanismConfigAtmosphere, RealTimeResourceTypeId } from '../shared/runtimeTypes';
4
- import { GClickRealtimeStartupSnapshotConfig } from './startupSnapshots';
2
+ import { RealTimeResourceSourceMechanismConfigDummy } from '../../dummy/index';
3
+ import { RealTimeResourceSourceMechanismConfigAtmosphere } from '@m4l/realtime-runtime/shared';
4
+ import { GClickRealtimeStartupSnapshotConfig } from '../../shared/startupSnapshots';
5
5
  /**
6
6
  * Host-runtime realtime payload forwarded from the host into one gclick MF instance.
7
7
  *
@@ -21,15 +21,13 @@ export interface GClickRealtimeHostRuntime {
21
21
  * Input contract used to create one host runtime directly from a shared dummy preset.
22
22
  */
23
23
  export interface LaunchGClickDummyHostRuntimeProps {
24
- presetId: RealTimeDummySimulationPresetId;
25
- resourceTypeId: RealTimeResourceTypeId;
24
+ resourceTypesConfig: RealTimeResourceSourceMechanismConfigDummy[];
26
25
  runtimeKey: string;
27
26
  storeId?: string;
28
27
  storeDevtoolsEnabled?: boolean;
29
28
  }
30
29
  /**
31
- * Input contract used to create one host runtime from Atmosphere-only
32
- * resource configs without registering the dummy source-data mechanism.
30
+ * Input contract used to create one host runtime from Atmosphere-backed resource configs.
33
31
  */
34
32
  export interface LaunchGClickAtmosphereHostRuntimeProps {
35
33
  /**
@@ -48,7 +46,7 @@ export interface LaunchGClickAtmosphereHostRuntimeProps {
48
46
  */
49
47
  export declare function launchGClickDummyHostRuntime(props: LaunchGClickDummyHostRuntimeProps): GClickRealtimeHostRuntime;
50
48
  /**
51
- * Create one host-runtime bag from Atmosphere-only realtime resource configs.
49
+ * Create one host-runtime bag from Atmosphere-backed realtime resource configs.
52
50
  */
53
51
  export declare function launchGClickAtmosphereHostRuntime(props: LaunchGClickAtmosphereHostRuntimeProps): GClickRealtimeHostRuntime;
54
52
  /**