@m4l/gclick-realtime 1.1.0 → 1.2.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 (62) hide show
  1. package/contracts/deviceData.d.ts +1 -1
  2. package/contracts/deviceData.d.ts.map +1 -1
  3. package/contracts/deviceDetail.d.ts +0 -1
  4. package/contracts/deviceDetail.d.ts.map +1 -1
  5. package/dummy/catalogs/baseDeviceTemplate.d.ts +1 -1
  6. package/dummy/catalogs/baseDeviceTemplate.d.ts.map +1 -1
  7. package/dummy/catalogs/scenarios.d.ts +46 -46
  8. package/dummy/catalogs/scenarios.js +46 -46
  9. package/dummy/runtime/dummy.d.ts.map +1 -1
  10. package/dummy/runtime/dummy.js +11 -10
  11. package/dummy/runtime/simulation.d.ts +2 -1
  12. package/dummy/runtime/simulation.d.ts.map +1 -1
  13. package/dummy/runtime/simulation.js +384 -361
  14. package/dummy/shared/types.d.ts +1 -1
  15. package/dummy/shared/types.d.ts.map +1 -1
  16. package/package.json +1 -1
  17. package/payload/index.d.ts +1 -0
  18. package/payload/index.d.ts.map +1 -1
  19. package/payload/index.js +7 -4
  20. package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts +10 -0
  21. package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts.map +1 -0
  22. package/payload/mergeDevicePayloadWithUpdatedAtGuard.js +50 -0
  23. package/web/consumer/RealTimeConsumerContext.d.ts.map +1 -1
  24. package/web/consumer/RealTimeConsumerContext.js +59 -30
  25. package/web/consumer/store.d.ts +1 -0
  26. package/web/consumer/store.d.ts.map +1 -1
  27. package/web/consumer/store.helpers.d.ts +24 -2
  28. package/web/consumer/store.helpers.d.ts.map +1 -1
  29. package/web/consumer/store.helpers.js +61 -33
  30. package/web/consumer/store.js +176 -60
  31. package/web/consumer/types.d.ts +3 -2
  32. package/web/consumer/types.d.ts.map +1 -1
  33. package/web/host/devicesResourceType.d.ts +70 -0
  34. package/web/host/devicesResourceType.d.ts.map +1 -0
  35. package/web/host/devicesResourceType.js +196 -0
  36. package/web/host/hostRuntime.d.ts +7 -0
  37. package/web/host/hostRuntime.d.ts.map +1 -1
  38. package/web/host/hostRuntime.js +44 -28
  39. package/web/host/index.d.ts +5 -2
  40. package/web/host/index.d.ts.map +1 -1
  41. package/web/host/launchContract.d.ts +25 -5
  42. package/web/host/launchContract.d.ts.map +1 -1
  43. package/web/host/launchContract.js +78 -41
  44. package/web/host/startupSnapshots.d.ts +32 -0
  45. package/web/host/startupSnapshots.d.ts.map +1 -0
  46. package/web/host/startupSnapshots.js +50 -0
  47. package/web/index.js +53 -47
  48. package/web/producer/sourceDataFactory.d.ts +3 -3
  49. package/web/producer/sourceDataFactory.d.ts.map +1 -1
  50. package/web/producer/sourceDataFactory.js +25 -21
  51. package/web/runtime/resourceTypeMergeStrategies.d.ts +10 -0
  52. package/web/runtime/resourceTypeMergeStrategies.d.ts.map +1 -0
  53. package/web/runtime/resourceTypeMergeStrategies.js +19 -0
  54. package/web/runtime/runtime.d.ts.map +1 -1
  55. package/web/runtime/runtime.js +15 -9
  56. package/web/runtime/runtimeAtmosphereOnly.d.ts.map +1 -1
  57. package/web/runtime/runtimeAtmosphereOnly.js +18 -12
  58. package/web/shared/performanceMetrics.d.ts +18 -2
  59. package/web/shared/performanceMetrics.d.ts.map +1 -1
  60. package/web/shared/performanceMetrics.js +35 -20
  61. package/web/shared/runtimeTypes.d.ts +2 -2
  62. package/web/shared/runtimeTypes.d.ts.map +1 -1
@@ -1,47 +1,63 @@
1
- import { getOrCreateGClickRealtimeRuntime as s } from "../runtime/runtimeRegistry.js";
2
- import { getOrCreateGClickAtmosphereRealtimeRuntime as u } from "../runtime/runtimeRegistryAtmosphereOnly.js";
3
- import { createRealTimeDummyResourceTypeConfigFromPreset as m } from "../../dummy/runtime/simulation.js";
4
- function f(o) {
1
+ import { getOrCreateGClickRealtimeRuntime as m } from "../runtime/runtimeRegistry.js";
2
+ import { getOrCreateGClickAtmosphereRealtimeRuntime as c } from "../runtime/runtimeRegistryAtmosphereOnly.js";
3
+ import { createRealTimeDummyResourceTypeConfigFromPreset as l } from "../../dummy/runtime/simulation.js";
4
+ import { replayGClickRealtimeStartupSnapshotsOnce as p } from "./startupSnapshots.js";
5
+ import { disposeGClickRealtimeRuntime as s } from "../runtime/runtimeRegistry.shared.js";
6
+ function T(o) {
5
7
  const {
6
8
  presetId: e,
7
- resourceTypeId: t,
8
- storeDevtoolsEnabled: r = !1,
9
- storeId: i,
10
- runtimeKey: n
11
- } = o;
9
+ resourceTypeId: r,
10
+ storeDevtoolsEnabled: t = !1,
11
+ storeId: n,
12
+ runtimeKey: i
13
+ } = o, u = m({
14
+ runtimeKey: i,
15
+ storeId: n,
16
+ storeDevtoolsEnabled: t,
17
+ resourceTypesConfig: [
18
+ l({
19
+ presetId: e,
20
+ resourceTypeId: r
21
+ })
22
+ ]
23
+ });
12
24
  return {
25
+ dispose: () => {
26
+ s(i);
27
+ },
13
28
  realtime: {
14
- producerTools: s({
15
- runtimeKey: n,
16
- storeId: i,
17
- storeDevtoolsEnabled: r,
18
- resourceTypesConfig: [
19
- m({
20
- presetId: e,
21
- resourceTypeId: t
22
- })
23
- ]
24
- }).tools
29
+ producerTools: u.tools
25
30
  }
26
31
  };
27
32
  }
28
- function R(o) {
29
- return {
33
+ function C(o) {
34
+ const {
35
+ startupSnapshots: e,
36
+ ...r
37
+ } = o, t = c(r);
38
+ return p({
39
+ producerTools: t.tools,
40
+ runtimeKey: o.runtimeKey,
41
+ startupSnapshots: e
42
+ }), {
43
+ dispose: () => {
44
+ s(o.runtimeKey);
45
+ },
30
46
  realtime: {
31
- producerTools: u(o).tools
47
+ producerTools: t.tools
32
48
  }
33
49
  };
34
50
  }
35
- function d(o) {
51
+ function h(o) {
36
52
  const e = o?.realtime?.producerTools;
37
- if (typeof e?.getResourceRuntimeMeta != "function" || typeof e?.publishMessages != "function" || typeof e?.subscribe != "function" || typeof e?.unsubscribe != "function")
53
+ if (typeof e?.getResourceRuntimeMeta != "function" || typeof e?.getResourceTypeSnapshot != "function" || typeof e?.publishMessages != "function" || typeof e?.subscribe != "function" || typeof e?.subscribeResourceType != "function" || typeof e?.unsubscribe != "function")
38
54
  throw new Error(
39
55
  "GClick realtime host runtime requires host-owned realtime producerTools."
40
56
  );
41
57
  return e;
42
58
  }
43
59
  export {
44
- R as launchGClickAtmosphereHostRuntime,
45
- f as launchGClickDummyHostRuntime,
46
- d as resolveGClickRealtimeTools
60
+ C as launchGClickAtmosphereHostRuntime,
61
+ T as launchGClickDummyHostRuntime,
62
+ h as resolveGClickRealtimeTools
47
63
  };
@@ -1,5 +1,8 @@
1
+ export { createGClickDevicesStartupSnapshot, createGClickDevicesStartupSnapshotMessages, createGClickDevicesAtmosphereResourceType, createGClickDevicesHotStartupSnapshot, } from './devicesResourceType';
2
+ export type { CreateGClickDevicesStartupSnapshotProps, CreateGClickDevicesAtmosphereResourceTypeProps, CreateGClickDevicesHotStartupSnapshotProps, GClickDevicesStartupSnapshotLoader, GClickDevicesHotStartupSnapshotNetworkOperation, GClickDevicesHotStartupSnapshotRequest, } from './devicesResourceType';
1
3
  export { launchGClickAtmosphereHostRuntime, launchGClickDummyHostRuntime, resolveGClickRealtimeTools, } from './hostRuntime';
4
+ export type { GClickRealtimeResourceStartupSnapshotConfig, GClickRealtimeStartupSnapshotConfig, GClickRealtimeStartupSnapshotMessagesLoader, } from './startupSnapshots';
2
5
  export type { GClickRealtimeHostRuntime, LaunchGClickAtmosphereHostRuntimeProps, LaunchGClickDummyHostRuntimeProps, } from './hostRuntime';
3
- export { createGClickAtmosphereRuntimeConfig, createGClickAtmosphereRuntimeKey, createGClickDummyRuntimeKey, launchGClickRealtimeHostRuntime, normalizeGClickRealtimeFallbackTransport, normalizeGClickRealtimeSessionId, resolveGClickRealtimeAtmosphereHost, } from './launchContract';
4
- export type { GClickRealtimeAtmosphereFallbackTransport, GClickRealtimeAtmosphereHostLaunchContract, GClickRealtimeDummyHostLaunchContract, GClickRealtimeHostLaunchContract, } from './launchContract';
6
+ export { createGClickAtmosphereRuntimeConfigs, createGClickAtmosphereRuntimeKey, createGClickAtmosphereStartupSnapshots, createGClickDummyRuntimeKey, launchGClickRealtimeHostRuntime, normalizeGClickRealtimeFallbackTransport, normalizeGClickRealtimeSessionId, resolveGClickRealtimeAtmosphereHost, } from './launchContract';
7
+ export type { GClickRealtimeAtmosphereFallbackTransport, GClickRealtimeAtmosphereHostLaunchContract, GClickRealtimeAtmosphereResourceTypeLaunchConfig, GClickRealtimeDummyHostLaunchContract, GClickRealtimeHostLaunchContract, } from './launchContract';
5
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,yBAAyB,EACzB,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,2BAA2B,EAC3B,+BAA+B,EAC/B,wCAAwC,EACxC,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,yCAAyC,EACzC,0CAA0C,EAC1C,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,0CAA0C,EAC1C,yCAAyC,EACzC,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,uCAAuC,EACvC,8CAA8C,EAC9C,0CAA0C,EAC1C,kCAAkC,EAClC,+CAA+C,EAC/C,sCAAsC,GACvC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iCAAiC,EACjC,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,2CAA2C,EAC3C,mCAAmC,EACnC,2CAA2C,GAC5C,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,yBAAyB,EACzB,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oCAAoC,EACpC,gCAAgC,EAChC,sCAAsC,EACtC,2BAA2B,EAC3B,+BAA+B,EAC/B,wCAAwC,EACxC,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,yCAAyC,EACzC,0CAA0C,EAC1C,gDAAgD,EAChD,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,kBAAkB,CAAC"}
@@ -1,10 +1,25 @@
1
1
  import { RealTimeDummySimulationPresetId } from '../../fixtures/index';
2
- import { RealTimeResourceSourceMechanismConfigAtmosphere, RealTimeResourceTypeId } from '../shared/runtimeTypes';
2
+ import { RealTimeResourcePayloadMergeStrategy, RealTimeResourceMessageNormalizeStrategy, RealTimeResourceSourceMechanismConfigAtmosphere, RealTimeResourceSerialId, RealTimeResourceTypeId } from '../shared/runtimeTypes';
3
+ import { GClickRealtimeResourceStartupSnapshotConfig, GClickRealtimeStartupSnapshotConfig } from './startupSnapshots';
3
4
  import { GClickRealtimeHostRuntime } from './hostRuntime';
4
5
  /**
5
6
  * Supported fallback transports for the shared Atmosphere launch contract.
6
7
  */
7
8
  export type GClickRealtimeAtmosphereFallbackTransport = 'long-polling' | 'websocket';
9
+ /**
10
+ * Resource-type entry requested by one shell-owned Atmosphere subscription.
11
+ */
12
+ export interface GClickRealtimeAtmosphereResourceTypeLaunchConfig {
13
+ consumerType?: string;
14
+ mergePayloadStrategy?: RealTimeResourcePayloadMergeStrategy;
15
+ normalizeMessageStrategy?: RealTimeResourceMessageNormalizeStrategy;
16
+ publishParams?: Record<string, unknown>;
17
+ rateLimit?: number;
18
+ resourceTypeId: RealTimeResourceTypeId;
19
+ resourcesId?: Array<RealTimeResourceSerialId | 'all'>;
20
+ sizeLimit?: number;
21
+ startupSnapshot?: GClickRealtimeResourceStartupSnapshotConfig;
22
+ }
8
23
  /**
9
24
  * Shared shell-to-runtime contract used when one shell boots a deterministic dummy runtime.
10
25
  */
@@ -24,9 +39,10 @@ export interface GClickRealtimeAtmosphereHostLaunchContract {
24
39
  fallbackTransport?: GClickRealtimeAtmosphereFallbackTransport;
25
40
  hostApiRemote?: string;
26
41
  path: string;
27
- resourceTypeId: RealTimeResourceTypeId;
42
+ resourceTypes: GClickRealtimeAtmosphereResourceTypeLaunchConfig[];
28
43
  sessionId?: string;
29
44
  sessionIdFallback?: string;
45
+ snapshotOnly?: boolean;
30
46
  storeDevtoolsEnabled?: boolean;
31
47
  runtimeKeyPrefix: string;
32
48
  topic: string;
@@ -54,11 +70,15 @@ export declare function createGClickDummyRuntimeKey(props: Pick<GClickRealtimeDu
54
70
  /**
55
71
  * Build the runtime key for one Atmosphere-backed launch contract.
56
72
  */
57
- export declare function createGClickAtmosphereRuntimeKey(props: Pick<GClickRealtimeAtmosphereHostLaunchContract, 'fallbackTransport' | 'hostApiRemote' | 'sessionId' | 'sessionIdFallback' | 'runtimeKeyPrefix'>): string;
73
+ export declare function createGClickAtmosphereRuntimeKey(props: Pick<GClickRealtimeAtmosphereHostLaunchContract, 'fallbackTransport' | 'hostApiRemote' | 'resourceTypes' | 'sessionId' | 'sessionIdFallback' | 'snapshotOnly' | 'runtimeKeyPrefix'>): string;
74
+ /**
75
+ * Build the Atmosphere runtime configs derived from one shared shell launch contract.
76
+ */
77
+ export declare function createGClickAtmosphereRuntimeConfigs(contract: GClickRealtimeAtmosphereHostLaunchContract): RealTimeResourceSourceMechanismConfigAtmosphere[] | undefined;
58
78
  /**
59
- * Build the Atmosphere runtime config derived from one shared shell launch contract.
79
+ * Resolve resource-owned startup snapshots into runtime replay registrations.
60
80
  */
61
- export declare function createGClickAtmosphereRuntimeConfig(contract: GClickRealtimeAtmosphereHostLaunchContract): RealTimeResourceSourceMechanismConfigAtmosphere | undefined;
81
+ export declare function createGClickAtmosphereStartupSnapshots(contract: GClickRealtimeAtmosphereHostLaunchContract): GClickRealtimeStartupSnapshotConfig[] | undefined;
62
82
  /**
63
83
  * Boot one host-runtime bag from the shared shell launch contract.
64
84
  */
@@ -1 +1 @@
1
- {"version":3,"file":"launchContract.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/launchContract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EACV,+CAA+C,EAC/C,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAM/D;;GAEG;AACH,MAAM,MAAM,yCAAyC,GAAG,cAAc,GAAG,WAAW,CAAC;AAErF;;GAEG;AACH,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,cAAc,EAAE,sBAAsB,CAAC;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,0CAA0C;IACzD,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,yCAAyC,CAAC;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,sBAAsB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,gCAAgC,GACxC,qCAAqC,GACrC,0CAA0C,CAAC;AAK/C;;GAEG;AACH,wBAAgB,wCAAwC,CACtD,iBAAiB,CAAC,EAAE,yCAAyC,GAC5D,yCAAyC,CAI3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,SAAuC,UAGzD;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,aAAa,EAAE,MAAM,UAKxE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,IAAI,CAAC,qCAAqC,EAAE,UAAU,GAAG,kBAAkB,CAAC,UAGpF;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,IAAI,CACT,0CAA0C,EAC1C,mBAAmB,GAAG,eAAe,GAAG,WAAW,GAAG,mBAAmB,GAAG,kBAAkB,CAC/F,UAWF;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,0CAA0C,GACnD,+CAA+C,GAAG,SAAS,CAmB7D;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,gCAAgC,GACzC,yBAAyB,CA2B3B"}
1
+ {"version":3,"file":"launchContract.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/launchContract.ts"],"names":[],"mappings":"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"}
@@ -1,72 +1,109 @@
1
- import { launchGClickDummyHostRuntime as r, launchGClickAtmosphereHostRuntime as l } from "./hostRuntime.js";
2
- const u = "long-polling", a = "no-session-id";
3
- function t(e) {
4
- return e === "websocket" ? "websocket" : u;
1
+ import { launchGClickDummyHostRuntime as a, launchGClickAtmosphereHostRuntime as l } from "./hostRuntime.js";
2
+ const m = "long-polling", u = "no-session-id";
3
+ function r(e) {
4
+ return e === "websocket" ? "websocket" : m;
5
5
  }
6
- function n(e, s = a) {
7
- return e?.trim() || s;
8
- }
9
- function m(e) {
10
- const s = new URL(e), o = s.pathname.replace(/\/+$/u, "");
11
- return `${s.host}${o}/wss`;
6
+ function i(e, t = u) {
7
+ return e?.trim() || t;
12
8
  }
13
9
  function d(e) {
14
- return `${e.runtimeKeyPrefix}:${e.presetId}`;
10
+ const t = e.map((s) => ({
11
+ consumerType: s.consumerType ?? "batch",
12
+ publishParams: s.publishParams ?? {},
13
+ rateLimit: s.rateLimit ?? 3,
14
+ resourceTypeId: s.resourceTypeId,
15
+ resourcesId: s.resourcesId ?? ["all"],
16
+ sizeLimit: s.sizeLimit ?? null
17
+ })).sort(
18
+ (s, o) => s.resourceTypeId.localeCompare(
19
+ o.resourceTypeId
20
+ )
21
+ );
22
+ return JSON.stringify(t);
15
23
  }
16
24
  function p(e) {
17
- const s = t(
25
+ const t = new URL(e), s = t.pathname.replace(/\/+$/u, ""), o = `${t.host}${s}/wss`;
26
+ return t.protocol === "http:" ? `ws://${o}` : o;
27
+ }
28
+ function h(e) {
29
+ return `${e.runtimeKeyPrefix}:${e.presetId}`;
30
+ }
31
+ function c(e) {
32
+ const t = r(
18
33
  e.fallbackTransport
19
- ), o = n(
34
+ ), s = i(
20
35
  e.sessionId,
21
36
  e.sessionIdFallback
22
- );
23
- return `${e.runtimeKeyPrefix}:${e.hostApiRemote}:${o}:${s}`;
37
+ ), o = d(
38
+ e.resourceTypes
39
+ ), n = e.snapshotOnly ? "snapshot-only" : "live";
40
+ return `${e.runtimeKeyPrefix}:${n}:${e.hostApiRemote}:${s}:${t}:${o}`;
24
41
  }
25
- function f(e) {
26
- if (e.hostApiRemote)
27
- return {
42
+ function y(e) {
43
+ const { hostApiRemote: t } = e;
44
+ if (!(!t || e.resourceTypes.length === 0))
45
+ return e.resourceTypes.map((s) => ({
28
46
  sourceDataMechanism: "atmosphere",
29
- resourceTypeId: e.resourceTypeId,
47
+ resourceTypeId: s.resourceTypeId,
48
+ consumerType: s.consumerType,
30
49
  database: e.database,
31
- fallbackTransport: t(e.fallbackTransport),
32
- host: m(e.hostApiRemote),
50
+ fallbackTransport: r(e.fallbackTransport),
51
+ host: p(t),
33
52
  port: "wss",
34
53
  path: e.path,
54
+ ...s.mergePayloadStrategy ? { mergePayloadStrategy: s.mergePayloadStrategy } : {},
55
+ ...s.normalizeMessageStrategy ? { normalizeMessageStrategy: s.normalizeMessageStrategy } : {},
56
+ publishParams: s.publishParams,
57
+ rateLimit: s.rateLimit,
58
+ resourcesId: s.resourcesId,
59
+ sizeLimit: s.sizeLimit,
35
60
  topic: e.topic,
36
- sessionId: n(
61
+ sessionId: i(
37
62
  e.sessionId,
38
63
  e.sessionIdFallback
39
64
  )
40
- };
65
+ }));
41
66
  }
42
- function c(e) {
67
+ function I(e) {
68
+ const t = e.resourceTypes.flatMap((s) => s.startupSnapshot ? [
69
+ {
70
+ ...s.startupSnapshot,
71
+ resourceTypeId: s.resourceTypeId
72
+ }
73
+ ] : []);
74
+ return t.length ? t : void 0;
75
+ }
76
+ function g(e) {
43
77
  if (e.mode === "dummy") {
44
- const i = d(e);
45
- return r({
78
+ const o = h(e);
79
+ return a({
46
80
  presetId: e.presetId,
47
81
  resourceTypeId: e.resourceTypeId,
48
- runtimeKey: i,
49
- storeId: i,
82
+ runtimeKey: o,
83
+ storeId: o,
50
84
  storeDevtoolsEnabled: e.storeDevtoolsEnabled ?? !1
51
85
  });
52
86
  }
53
- const s = f(e);
54
- if (!s || !e.hostApiRemote)
87
+ const t = y(e);
88
+ if (!t || !e.hostApiRemote)
55
89
  return {};
56
- const o = p(e);
90
+ const s = c(e);
57
91
  return l({
58
- runtimeKey: o,
59
- storeId: o,
92
+ runtimeKey: s,
93
+ storeId: s,
60
94
  storeDevtoolsEnabled: e.storeDevtoolsEnabled ?? !1,
61
- resourceTypesConfig: [s]
95
+ resourceTypesConfig: t,
96
+ startSourceData: !e.snapshotOnly,
97
+ startupSnapshots: I(e)
62
98
  });
63
99
  }
64
100
  export {
65
- f as createGClickAtmosphereRuntimeConfig,
66
- p as createGClickAtmosphereRuntimeKey,
67
- d as createGClickDummyRuntimeKey,
68
- c as launchGClickRealtimeHostRuntime,
69
- t as normalizeGClickRealtimeFallbackTransport,
70
- n as normalizeGClickRealtimeSessionId,
71
- m as resolveGClickRealtimeAtmosphereHost
101
+ y as createGClickAtmosphereRuntimeConfigs,
102
+ c as createGClickAtmosphereRuntimeKey,
103
+ I as createGClickAtmosphereStartupSnapshots,
104
+ h as createGClickDummyRuntimeKey,
105
+ g as launchGClickRealtimeHostRuntime,
106
+ r as normalizeGClickRealtimeFallbackTransport,
107
+ i as normalizeGClickRealtimeSessionId,
108
+ p as resolveGClickRealtimeAtmosphereHost
72
109
  };
@@ -0,0 +1,32 @@
1
+ import { RealTimeMessage, RealTimeResourceTypeId } from '../shared/runtimeTypes';
2
+ import { RealTimeProducerTools } from '@m4l/realtime-runtime';
3
+ /**
4
+ * Loader contract used by a shell to fetch one startup snapshot for a resource type.
5
+ */
6
+ export type GClickRealtimeStartupSnapshotMessagesLoader = () => Promise<RealTimeMessage[]> | RealTimeMessage[];
7
+ /**
8
+ * Startup snapshot definition owned by one resource-type launch entry.
9
+ */
10
+ export interface GClickRealtimeResourceStartupSnapshotConfig {
11
+ loadMessages: GClickRealtimeStartupSnapshotMessagesLoader;
12
+ }
13
+ /**
14
+ * Runtime-level startup snapshot definition after the resource type owns its target id.
15
+ */
16
+ export interface GClickRealtimeStartupSnapshotConfig extends GClickRealtimeResourceStartupSnapshotConfig {
17
+ resourceTypeId: RealTimeResourceTypeId;
18
+ }
19
+ export interface ReplayGClickRealtimeStartupSnapshotsOnceProps {
20
+ producerTools: RealTimeProducerTools;
21
+ runtimeKey: string;
22
+ startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
23
+ }
24
+ /**
25
+ * Replay all configured startup snapshots without blocking host-runtime creation.
26
+ */
27
+ export declare function replayGClickRealtimeStartupSnapshotsOnce(props: ReplayGClickRealtimeStartupSnapshotsOnceProps): void;
28
+ /**
29
+ * Clear startup snapshot idempotency state between focused unit tests.
30
+ */
31
+ export declare function resetGClickRealtimeStartupSnapshotsForTesting(): void;
32
+ //# sourceMappingURL=startupSnapshots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startupSnapshots.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/startupSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,2CAA2C,GAAG,MACxD,OAAO,CAAC,eAAe,EAAE,CAAC,GAAG,eAAe,EAAE,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,2CAA2C;IAC1D,YAAY,EAAE,2CAA2C,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,mCACf,SAAQ,2CAA2C;IACnD,cAAc,EAAE,sBAAsB,CAAC;CACxC;AAED,MAAM,WAAW,6CAA6C;IAC5D,aAAa,EAAE,qBAAqB,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,mCAAmC,EAAE,CAAC;CAC1D;AAwDD;;GAEG;AACH,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,6CAA6C,GACnD,IAAI,CA2BN;AAED;;GAEG;AACH,wBAAgB,6CAA6C,IAAI,IAAI,CAGpE"}
@@ -0,0 +1,50 @@
1
+ const p = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2
+ function c(t, s) {
3
+ return `${t}:${s}`;
4
+ }
5
+ async function u(t) {
6
+ const {
7
+ producerTools: s,
8
+ startupSnapshot: a,
9
+ startupSnapshotKey: r
10
+ } = t;
11
+ try {
12
+ const e = await a.loadMessages();
13
+ e.length && s.publishMessages(
14
+ a.resourceTypeId,
15
+ e,
16
+ "bootstrap"
17
+ ), p.add(r);
18
+ } catch (e) {
19
+ console.warn(
20
+ "GClick realtime startup snapshot replay failed.",
21
+ {
22
+ error: e,
23
+ resourceTypeId: a.resourceTypeId
24
+ }
25
+ );
26
+ } finally {
27
+ n.delete(r);
28
+ }
29
+ }
30
+ function l(t) {
31
+ const {
32
+ producerTools: s,
33
+ runtimeKey: a,
34
+ startupSnapshots: r = []
35
+ } = t;
36
+ r.forEach((e) => {
37
+ const o = c(
38
+ a,
39
+ e.resourceTypeId
40
+ );
41
+ p.has(o) || n.has(o) || (n.add(o), u({
42
+ producerTools: s,
43
+ startupSnapshot: e,
44
+ startupSnapshotKey: o
45
+ }));
46
+ });
47
+ }
48
+ export {
49
+ l as replayGClickRealtimeStartupSnapshotsOnce
50
+ };
package/web/index.js CHANGED
@@ -1,57 +1,63 @@
1
- import { createRealTimeProducerTools as o } from "@m4l/realtime-runtime/web";
2
- import { REAL_TIME_DUMMY_DEFAULT_PRESET_ID as m, REAL_TIME_DUMMY_SIMULATION_PRESETS as i, createRealTimeDummySimulationConfigFromPreset as R } from "../dummy/catalogs/presets.js";
3
- import { createRealTimeDummyResourceTypeConfigFromPreset as l } from "../dummy/runtime/simulation.js";
4
- import { RealTimeDummySimulationPresetId as u } from "../fixtures/types.js";
5
- import { RealTimeProducerContext as C, RealTimeProducerProvider as n } from "./producer/RealTimeProducerContext.js";
1
+ import { createRealTimeProducerTools as t } from "@m4l/realtime-runtime/web";
2
+ import { REAL_TIME_DUMMY_DEFAULT_PRESET_ID as m, REAL_TIME_DUMMY_SIMULATION_PRESETS as i, createRealTimeDummySimulationConfigFromPreset as a } from "../dummy/catalogs/presets.js";
3
+ import { createRealTimeDummyResourceTypeConfigFromPreset as c } from "../dummy/runtime/simulation.js";
4
+ import { RealTimeDummySimulationPresetId as s } from "../fixtures/types.js";
5
+ import { RealTimeProducerContext as p, RealTimeProducerProvider as C } from "./producer/RealTimeProducerContext.js";
6
6
  import { useRealTimeProducer as T } from "./producer/useRealTimeProducer.js";
7
- import { createRealTimeProducerStore as f } from "./producer/store.js";
8
- import { SourceDataFactory as S } from "./producer/sourceDataFactory.js";
9
- import { RealTimeConsumerContext as G, RealTimeConsumerProvider as k } from "./consumer/RealTimeConsumerContext.js";
7
+ import { createRealTimeProducerStore as E } from "./producer/store.js";
8
+ import { SourceDataFactory as x } from "./producer/sourceDataFactory.js";
9
+ import { RealTimeConsumerContext as k, RealTimeConsumerProvider as _ } from "./consumer/RealTimeConsumerContext.js";
10
10
  import { useRealTimeConsumer as A } from "./consumer/useRealTimeConsumer.js";
11
- import { createRealTimeConsumerStore as I } from "./consumer/store.js";
12
- import { createRealtimeRuntime as d } from "./runtime/runtime.js";
13
- import { createAtmosphereRealtimeRuntime as y } from "./runtime/runtimeAtmosphereOnly.js";
14
- import { getOrCreateGClickRealtimeRuntime as L } from "./runtime/runtimeRegistry.js";
15
- import { createGetOrCreateGClickRealtimeRuntime as g, disposeGClickRealtimeRuntime as F } from "./runtime/runtimeRegistry.shared.js";
11
+ import { createRealTimeConsumerStore as P } from "./consumer/store.js";
12
+ import { createRealtimeRuntime as M } from "./runtime/runtime.js";
13
+ import { createAtmosphereRealtimeRuntime as d } from "./runtime/runtimeAtmosphereOnly.js";
14
+ import { getOrCreateGClickRealtimeRuntime as v } from "./runtime/runtimeRegistry.js";
15
+ import { createGetOrCreateGClickRealtimeRuntime as U, disposeGClickRealtimeRuntime as g } from "./runtime/runtimeRegistry.shared.js";
16
16
  import { getOrCreateGClickAtmosphereRealtimeRuntime as H } from "./runtime/runtimeRegistryAtmosphereOnly.js";
17
- import { launchGClickAtmosphereHostRuntime as Y, launchGClickDummyHostRuntime as z, resolveGClickRealtimeTools as K } from "./host/hostRuntime.js";
18
- import { createGClickAtmosphereRuntimeConfig as b, createGClickAtmosphereRuntimeKey as j, createGClickDummyRuntimeKey as q, launchGClickRealtimeHostRuntime as w, normalizeGClickRealtimeFallbackTransport as B, normalizeGClickRealtimeSessionId as J, resolveGClickRealtimeAtmosphereHost as Q } from "./host/launchContract.js";
19
- import { EnumResourceTypesIds as X, PROCCESS_MESSAGES_INTERVAL as Z, REALTIME_CONSUMER_SOTORE_ID as $, REALTIME_PRODUCER_SOTORE_ID as ee, RESOURCE_TYPE_DEVICES as re } from "./shared/constants.js";
17
+ import { createGClickDevicesAtmosphereResourceType as Y, createGClickDevicesHotStartupSnapshot as z, createGClickDevicesStartupSnapshot as K, createGClickDevicesStartupSnapshotMessages as V } from "./host/devicesResourceType.js";
18
+ import { launchGClickAtmosphereHostRuntime as j, launchGClickDummyHostRuntime as q, resolveGClickRealtimeTools as w } from "./host/hostRuntime.js";
19
+ import { createGClickAtmosphereRuntimeConfigs as J, createGClickAtmosphereRuntimeKey as Q, createGClickAtmosphereStartupSnapshots as W, createGClickDummyRuntimeKey as X, launchGClickRealtimeHostRuntime as Z, normalizeGClickRealtimeFallbackTransport as $, normalizeGClickRealtimeSessionId as ee, resolveGClickRealtimeAtmosphereHost as re } from "./host/launchContract.js";
20
+ import { EnumResourceTypesIds as oe, PROCCESS_MESSAGES_INTERVAL as me, REALTIME_CONSUMER_SOTORE_ID as ie, REALTIME_PRODUCER_SOTORE_ID as ae, RESOURCE_TYPE_DEVICES as le } from "./shared/constants.js";
20
21
  export {
21
- X as EnumResourceTypesIds,
22
- Z as PROCCESS_MESSAGES_INTERVAL,
23
- $ as REALTIME_CONSUMER_SOTORE_ID,
24
- ee as REALTIME_PRODUCER_SOTORE_ID,
22
+ oe as EnumResourceTypesIds,
23
+ me as PROCCESS_MESSAGES_INTERVAL,
24
+ ie as REALTIME_CONSUMER_SOTORE_ID,
25
+ ae as REALTIME_PRODUCER_SOTORE_ID,
25
26
  m as REAL_TIME_DUMMY_DEFAULT_PRESET_ID,
26
27
  i as REAL_TIME_DUMMY_SIMULATION_PRESETS,
27
- re as RESOURCE_TYPE_DEVICES,
28
- G as RealTimeConsumerContext,
29
- k as RealTimeConsumerProvider,
30
- u as RealTimeDummySimulationPresetId,
31
- C as RealTimeProducerContext,
32
- n as RealTimeProducerProvider,
33
- S as SourceDataFactory,
34
- y as createAtmosphereRealtimeRuntime,
35
- b as createGClickAtmosphereRuntimeConfig,
36
- j as createGClickAtmosphereRuntimeKey,
37
- q as createGClickDummyRuntimeKey,
38
- g as createGetOrCreateGClickRealtimeRuntime,
39
- I as createRealTimeConsumerStore,
40
- l as createRealTimeDummyResourceTypeConfigFromPreset,
41
- R as createRealTimeDummySimulationConfigFromPreset,
42
- f as createRealTimeProducerStore,
43
- o as createRealTimeProducerTools,
44
- d as createRealtimeRuntime,
45
- F as disposeGClickRealtimeRuntime,
28
+ le as RESOURCE_TYPE_DEVICES,
29
+ k as RealTimeConsumerContext,
30
+ _ as RealTimeConsumerProvider,
31
+ s as RealTimeDummySimulationPresetId,
32
+ p as RealTimeProducerContext,
33
+ C as RealTimeProducerProvider,
34
+ x as SourceDataFactory,
35
+ d as createAtmosphereRealtimeRuntime,
36
+ J as createGClickAtmosphereRuntimeConfigs,
37
+ Q as createGClickAtmosphereRuntimeKey,
38
+ W as createGClickAtmosphereStartupSnapshots,
39
+ Y as createGClickDevicesAtmosphereResourceType,
40
+ z as createGClickDevicesHotStartupSnapshot,
41
+ K as createGClickDevicesStartupSnapshot,
42
+ V as createGClickDevicesStartupSnapshotMessages,
43
+ X as createGClickDummyRuntimeKey,
44
+ U as createGetOrCreateGClickRealtimeRuntime,
45
+ P as createRealTimeConsumerStore,
46
+ c as createRealTimeDummyResourceTypeConfigFromPreset,
47
+ a as createRealTimeDummySimulationConfigFromPreset,
48
+ E as createRealTimeProducerStore,
49
+ t as createRealTimeProducerTools,
50
+ M as createRealtimeRuntime,
51
+ g as disposeGClickRealtimeRuntime,
46
52
  H as getOrCreateGClickAtmosphereRealtimeRuntime,
47
- L as getOrCreateGClickRealtimeRuntime,
48
- Y as launchGClickAtmosphereHostRuntime,
49
- z as launchGClickDummyHostRuntime,
50
- w as launchGClickRealtimeHostRuntime,
51
- B as normalizeGClickRealtimeFallbackTransport,
52
- J as normalizeGClickRealtimeSessionId,
53
- Q as resolveGClickRealtimeAtmosphereHost,
54
- K as resolveGClickRealtimeTools,
53
+ v as getOrCreateGClickRealtimeRuntime,
54
+ j as launchGClickAtmosphereHostRuntime,
55
+ q as launchGClickDummyHostRuntime,
56
+ Z as launchGClickRealtimeHostRuntime,
57
+ $ as normalizeGClickRealtimeFallbackTransport,
58
+ ee as normalizeGClickRealtimeSessionId,
59
+ re as resolveGClickRealtimeAtmosphereHost,
60
+ w as resolveGClickRealtimeTools,
55
61
  A as useRealTimeConsumer,
56
62
  T as useRealTimeProducer
57
63
  };
@@ -1,13 +1,13 @@
1
- import { OnMessagesStoreCallback, SourceDataBase } from '@m4l/realtime-runtime';
1
+ import { OnMessagesStoreCallback, OnRealTimeProducerMetricCallback, SourceDataBase } from '@m4l/realtime-runtime';
2
2
  import { RealTimeResourceSourceMechanismConfigBase } from '../shared/runtimeTypes';
3
3
  /**
4
4
  * Source data factory.
5
5
  */
6
6
  export declare class SourceDataFactory {
7
7
  /**
8
- * Create a source data object.
8
+ * Create a runtime-scoped source-data factory that reuses one Atmosphere transport per app/runtime.
9
9
  */
10
- static createSourceData(config: RealTimeResourceSourceMechanismConfigBase, onMessages: OnMessagesStoreCallback): SourceDataBase;
10
+ static createSourceDataFactory(): (config: RealTimeResourceSourceMechanismConfigBase, onMessages: OnMessagesStoreCallback, onPerformanceMetric?: OnRealTimeProducerMetricCallback) => SourceDataBase;
11
11
  }
12
12
  export default SourceDataFactory;
13
13
  //# sourceMappingURL=sourceDataFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sourceDataFactory.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/sourceDataFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,yCAAyC,EACjD,UAAU,EAAE,uBAAuB,GAClC,cAAc;CAgBlB;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"sourceDataFactory.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/sourceDataFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,gCAAgC,EAChC,cAAc,EACf,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAEV,yCAAyC,EAC1C,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,MAAM,CAAC,uBAAuB,KAI1B,QAAQ,yCAAyC,EACjD,YAAY,uBAAuB,EACnC,sBAAsB,gCAAgC,KACrD,cAAc;CAkBpB;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,27 +1,31 @@
1
- import { SourceDataAtmosphere as t } from "@m4l/realtime-runtime";
2
- import { SourceDataDummy as a } from "../../dummy/runtime/dummy.js";
3
- class m {
1
+ import { createAtmosphereSourceDataFactory as c } from "@m4l/realtime-runtime";
2
+ import { SourceDataDummy as o } from "../../dummy/runtime/dummy.js";
3
+ class D {
4
4
  /**
5
- * Create a source data object.
5
+ * Create a runtime-scoped source-data factory that reuses one Atmosphere transport per app/runtime.
6
6
  */
7
- static createSourceData(r, e) {
8
- switch (r.sourceDataMechanism) {
9
- case "dummy":
10
- return new a(
11
- r,
12
- e
13
- );
14
- case "atmosphere":
15
- return new t(
16
- r,
17
- e
18
- );
19
- default:
20
- throw new Error("Unknown resource type");
21
- }
7
+ static createSourceDataFactory() {
8
+ const t = c();
9
+ return function(r, e, a) {
10
+ switch (r.sourceDataMechanism) {
11
+ case "dummy":
12
+ return new o(
13
+ r,
14
+ e
15
+ );
16
+ case "atmosphere":
17
+ return t(
18
+ r,
19
+ e,
20
+ a
21
+ );
22
+ default:
23
+ throw new Error("Unknown resource type");
24
+ }
25
+ };
22
26
  }
23
27
  }
24
28
  export {
25
- m as SourceDataFactory,
26
- m as default
29
+ D as SourceDataFactory,
30
+ D as default
27
31
  };
@@ -0,0 +1,10 @@
1
+ import { RealTimeResourceSourceMechanismConfigBase } from '../shared/runtimeTypes';
2
+ /**
3
+ * Attach the default GClick merge strategy for one resource type when the caller did not provide one.
4
+ */
5
+ export declare function withGClickResourceTypeMergeStrategy<TConfig extends RealTimeResourceSourceMechanismConfigBase>(config: TConfig): TConfig;
6
+ /**
7
+ * Attach default GClick merge strategies to all configured realtime resource types.
8
+ */
9
+ export declare function withGClickResourceTypeMergeStrategies<TConfig extends RealTimeResourceSourceMechanismConfigBase>(resourceTypesConfig: TConfig[]): TConfig[];
10
+ //# sourceMappingURL=resourceTypeMergeStrategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceTypeMergeStrategies.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/runtime/resourceTypeMergeStrategies.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,yCAAyC,EAE1C,MAAM,wBAAwB,CAAC;AAShC;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,SAAS,yCAAyC,EACzD,MAAM,EAAE,OAAO,GAAG,OAAO,CAY1B;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,SAAS,yCAAyC,EACzD,mBAAmB,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAE3C"}