@m4l/gclick-realtime 1.4.0 → 1.5.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.
- package/contracts/deviceData.d.ts +2 -2
- package/contracts/vpts.d.ts +11 -6
- package/contracts/vpts.d.ts.map +1 -1
- package/dummy/catalogs/baseDeviceTemplate.d.ts.map +1 -1
- package/dummy/catalogs/baseDeviceTemplate.js +41 -11
- package/dummy/runtime/dummy.d.ts.map +1 -1
- package/dummy/runtime/dummy.js +109 -82
- package/dummy/runtime/simulation.d.ts.map +1 -1
- package/dummy/runtime/simulation.js +487 -418
- package/package.json +1 -1
- package/payload/types.d.ts +2 -1
- package/payload/types.d.ts.map +1 -1
- package/web/host/devicesResourceType.d.ts.map +1 -1
- package/web/host/devicesResourceType.js +7 -6
- package/web/host/hostRuntime.d.ts.map +1 -1
- package/web/host/hostRuntime.js +39 -28
- package/web/host/startupSnapshots.d.ts +13 -0
- package/web/host/startupSnapshots.d.ts.map +1 -1
- package/web/host/startupSnapshots.js +85 -32
package/package.json
CHANGED
package/payload/types.d.ts
CHANGED
|
@@ -8,9 +8,10 @@ export type PayloadValue<T> = Maybe<T> | Maybe<{
|
|
|
8
8
|
}>;
|
|
9
9
|
/**
|
|
10
10
|
* Payload fields that carry tracked timestamps expose the camelized
|
|
11
|
-
* `updatedAt`
|
|
11
|
+
* `updatedAt` and `state` keys after ingress normalization.
|
|
12
12
|
*/
|
|
13
13
|
export type PayloadValueWithUpdatedAt<TValue = unknown, TUpdatedAt = string> = Maybe<TValue> | Maybe<{
|
|
14
|
+
state?: string;
|
|
14
15
|
value?: TValue;
|
|
15
16
|
updatedAt?: TUpdatedAt;
|
|
16
17
|
}>;
|
package/payload/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick-realtime/src/payload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CACnC,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,MAAM,IACjB,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/gclick-realtime/src/payload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,yBAAyB,CACnC,MAAM,GAAG,OAAO,EAChB,UAAU,GAAG,MAAM,IACjB,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,CAAC,CAAC"}
|
|
@@ -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,oB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+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,
|
|
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,G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D,CAyBlD"}
|
|
@@ -32,7 +32,7 @@ function d(e) {
|
|
|
32
32
|
function P(e) {
|
|
33
33
|
return typeof e == "string" && !!e.trim();
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function v(e) {
|
|
36
36
|
const r = Number(e);
|
|
37
37
|
return Number.isSafeInteger(r) ? r : null;
|
|
38
38
|
}
|
|
@@ -41,19 +41,19 @@ function p(e, r) {
|
|
|
41
41
|
e.resourceSerialId ?? e.serialId ?? r
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function E(e, r) {
|
|
45
45
|
if ("id" in e && !d(e.id))
|
|
46
46
|
return null;
|
|
47
47
|
const t = { ...e };
|
|
48
48
|
if (delete t.resourceId, delete t.resourceSerialId, delete t.serialId, !("id" in t)) {
|
|
49
|
-
const n =
|
|
49
|
+
const n = v(r);
|
|
50
50
|
if (n === null)
|
|
51
51
|
return null;
|
|
52
52
|
t.id = n;
|
|
53
53
|
}
|
|
54
54
|
return t;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function T(e) {
|
|
57
57
|
if (!d(e.id) || !P(e.serialId))
|
|
58
58
|
return null;
|
|
59
59
|
const r = { ...e };
|
|
@@ -70,7 +70,7 @@ const R = (e) => {
|
|
|
70
70
|
};
|
|
71
71
|
if (!a(e.payload))
|
|
72
72
|
return null;
|
|
73
|
-
const t =
|
|
73
|
+
const t = E(
|
|
74
74
|
e.payload,
|
|
75
75
|
r
|
|
76
76
|
);
|
|
@@ -115,7 +115,7 @@ function _(e, r = c.devices) {
|
|
|
115
115
|
);
|
|
116
116
|
if (o === null)
|
|
117
117
|
return [];
|
|
118
|
-
const i =
|
|
118
|
+
const i = T(t);
|
|
119
119
|
return i === null ? [] : [
|
|
120
120
|
{
|
|
121
121
|
payload: i,
|
|
@@ -132,6 +132,7 @@ function N(e) {
|
|
|
132
132
|
resourceTypeId: t = c.devices
|
|
133
133
|
} = e;
|
|
134
134
|
return {
|
|
135
|
+
authoritativeResourceSet: !0,
|
|
135
136
|
loadMessages: async () => _(
|
|
136
137
|
await r(),
|
|
137
138
|
t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostRuntime.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/hostRuntime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,oCAAoC,EACpC,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,+CAA+C,EAC/C,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"hostRuntime.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/hostRuntime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,oCAAoC,EACpC,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,+CAA+C,EAC/C,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,KAAK,mCAAmC,EACzC,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,qBAAqB,CAAC;KACvC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,cAAc,EAAE,sBAAsB,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD;;OAEG;IACH,oBAAoB,CAAC,EAAE,oCAAoC,CAAC;IAC5D,mBAAmB,EAAE,+CAA+C,EAAE,CAAC;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,mCAAmC,EAAE,CAAC;CAC1D;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,iCAAiC,GACvC,yBAAyB,CA4B3B;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,sCAAsC,GAC5C,yBAAyB,CAyC3B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,CAAC,EAAE,yBAAyB,GACtC,qBAAqB,CAiBvB"}
|
package/web/host/hostRuntime.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { getOrCreateGClickRealtimeRuntime as
|
|
2
|
-
import { getOrCreateGClickAtmosphereRealtimeRuntime as
|
|
3
|
-
import { createRealTimeDummyResourceTypeConfigFromPreset as
|
|
4
|
-
import { replayGClickRealtimeStartupSnapshotsOnce as p } from "./startupSnapshots.js";
|
|
5
|
-
import { disposeGClickRealtimeRuntime as
|
|
6
|
-
function
|
|
1
|
+
import { getOrCreateGClickRealtimeRuntime as c } from "../runtime/runtimeRegistry.js";
|
|
2
|
+
import { getOrCreateGClickAtmosphereRealtimeRuntime as l } from "../runtime/runtimeRegistryAtmosphereOnly.js";
|
|
3
|
+
import { createRealTimeDummyResourceTypeConfigFromPreset as m } from "../../dummy/runtime/simulation.js";
|
|
4
|
+
import { replayGClickRealtimeStartupSnapshotsOnce as p, replayGClickRealtimeStartupSnapshotsOnReconnect as a } from "./startupSnapshots.js";
|
|
5
|
+
import { disposeGClickRealtimeRuntime as u } from "../runtime/runtimeRegistry.shared.js";
|
|
6
|
+
function h(t) {
|
|
7
7
|
const {
|
|
8
8
|
presetId: e,
|
|
9
9
|
resourceTypeId: r,
|
|
10
|
-
storeDevtoolsEnabled:
|
|
11
|
-
storeId:
|
|
12
|
-
runtimeKey:
|
|
13
|
-
} =
|
|
14
|
-
runtimeKey:
|
|
15
|
-
storeId:
|
|
16
|
-
storeDevtoolsEnabled:
|
|
10
|
+
storeDevtoolsEnabled: i = !1,
|
|
11
|
+
storeId: o,
|
|
12
|
+
runtimeKey: n
|
|
13
|
+
} = t, s = c({
|
|
14
|
+
runtimeKey: n,
|
|
15
|
+
storeId: o,
|
|
16
|
+
storeDevtoolsEnabled: i,
|
|
17
17
|
resourceTypesConfig: [
|
|
18
|
-
|
|
18
|
+
m({
|
|
19
19
|
presetId: e,
|
|
20
20
|
resourceTypeId: r
|
|
21
21
|
})
|
|
@@ -23,30 +23,41 @@ function T(o) {
|
|
|
23
23
|
});
|
|
24
24
|
return {
|
|
25
25
|
dispose: () => {
|
|
26
|
-
|
|
26
|
+
u(n);
|
|
27
27
|
},
|
|
28
28
|
realtime: {
|
|
29
|
-
producerTools:
|
|
29
|
+
producerTools: s.tools
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function C(
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
function C(t) {
|
|
34
|
+
const { onTransportReconnect: e, startupSnapshots: r, ...i } = t;
|
|
35
|
+
let o = null;
|
|
36
|
+
const n = r?.length || e ? (s) => {
|
|
37
|
+
e?.(s), !(!o || !r?.length) && a({
|
|
38
|
+
producerTools: o.tools,
|
|
39
|
+
runtimeKey: t.runtimeKey,
|
|
40
|
+
startupSnapshots: r
|
|
41
|
+
});
|
|
42
|
+
} : void 0;
|
|
43
|
+
return o = l({
|
|
44
|
+
...i,
|
|
45
|
+
onTransportReconnect: n
|
|
46
|
+
}), p({
|
|
47
|
+
producerTools: o.tools,
|
|
48
|
+
runtimeKey: t.runtimeKey,
|
|
49
|
+
startupSnapshots: r
|
|
39
50
|
}), {
|
|
40
51
|
dispose: () => {
|
|
41
|
-
|
|
52
|
+
u(t.runtimeKey);
|
|
42
53
|
},
|
|
43
54
|
realtime: {
|
|
44
|
-
producerTools:
|
|
55
|
+
producerTools: o.tools
|
|
45
56
|
}
|
|
46
57
|
};
|
|
47
58
|
}
|
|
48
|
-
function
|
|
49
|
-
const e =
|
|
59
|
+
function g(t) {
|
|
60
|
+
const e = t?.realtime?.producerTools;
|
|
50
61
|
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")
|
|
51
62
|
throw new Error(
|
|
52
63
|
"GClick realtime host runtime requires host-owned realtime producerTools."
|
|
@@ -55,6 +66,6 @@ function h(o) {
|
|
|
55
66
|
}
|
|
56
67
|
export {
|
|
57
68
|
C as launchGClickAtmosphereHostRuntime,
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
h as launchGClickDummyHostRuntime,
|
|
70
|
+
g as resolveGClickRealtimeTools
|
|
60
71
|
};
|
|
@@ -8,6 +8,10 @@ export type GClickRealtimeStartupSnapshotMessagesLoader = () => Promise<RealTime
|
|
|
8
8
|
* Startup snapshot definition owned by one resource-type launch entry.
|
|
9
9
|
*/
|
|
10
10
|
export interface GClickRealtimeResourceStartupSnapshotConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Marks the loader as a full authoritative resource set so replay can synthesize deletes for missing resources.
|
|
13
|
+
*/
|
|
14
|
+
authoritativeResourceSet?: boolean;
|
|
11
15
|
loadMessages: GClickRealtimeStartupSnapshotMessagesLoader;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
@@ -21,10 +25,19 @@ export interface ReplayGClickRealtimeStartupSnapshotsOnceProps {
|
|
|
21
25
|
runtimeKey: string;
|
|
22
26
|
startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
|
|
23
27
|
}
|
|
28
|
+
export interface ReplayGClickRealtimeStartupSnapshotsOnReconnectProps {
|
|
29
|
+
producerTools: RealTimeProducerTools;
|
|
30
|
+
runtimeKey: string;
|
|
31
|
+
startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
|
|
32
|
+
}
|
|
24
33
|
/**
|
|
25
34
|
* Replay all configured startup snapshots without blocking host-runtime creation.
|
|
26
35
|
*/
|
|
27
36
|
export declare function replayGClickRealtimeStartupSnapshotsOnce(props: ReplayGClickRealtimeStartupSnapshotsOnceProps): void;
|
|
37
|
+
/**
|
|
38
|
+
* Replay startup snapshots again after one successful transport reconnect.
|
|
39
|
+
*/
|
|
40
|
+
export declare function replayGClickRealtimeStartupSnapshotsOnReconnect(props: ReplayGClickRealtimeStartupSnapshotsOnReconnectProps): void;
|
|
28
41
|
/**
|
|
29
42
|
* Clear startup snapshot idempotency state between focused unit tests.
|
|
30
43
|
*/
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"startupSnapshots.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/host/startupSnapshots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,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;;OAEG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,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;AAED,MAAM,WAAW,oDAAoD;IACnE,aAAa,EAAE,qBAAqB,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,mCAAmC,EAAE,CAAC;CAC1D;AAmHD;;GAEG;AACH,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,6CAA6C,GACnD,IAAI,CA6BN;AAED;;GAEG;AACH,wBAAgB,+CAA+C,CAC7D,KAAK,EAAE,oDAAoD,GAC1D,IAAI,CA0BN;AAED;;GAEG;AACH,wBAAgB,6CAA6C,IAAI,IAAI,CAGpE"}
|
|
@@ -1,50 +1,103 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
return `${
|
|
1
|
+
const c = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set();
|
|
2
|
+
function u(a, o) {
|
|
3
|
+
return `${a}:${o}`;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
function d(a, o, s) {
|
|
6
|
+
if (!o.authoritativeResourceSet)
|
|
7
|
+
return s;
|
|
8
|
+
const n = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
9
|
+
s.forEach((r) => {
|
|
10
|
+
if (r.type === "delete") {
|
|
11
|
+
t.add(r.resourceSerialId);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
n.add(r.resourceSerialId);
|
|
15
|
+
});
|
|
16
|
+
const e = Object.keys(
|
|
17
|
+
a.getResourceTypeSnapshot(o.resourceTypeId)
|
|
18
|
+
).filter(
|
|
19
|
+
(r) => !n.has(r) && !t.has(r)
|
|
20
|
+
).map((r) => ({
|
|
21
|
+
payload: {},
|
|
22
|
+
resourceSerialId: r,
|
|
23
|
+
resourceTypeId: o.resourceTypeId,
|
|
24
|
+
type: "delete"
|
|
25
|
+
}));
|
|
26
|
+
return e.length ? [...s, ...e] : s;
|
|
27
|
+
}
|
|
28
|
+
async function l(a) {
|
|
6
29
|
const {
|
|
7
|
-
producerTools:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
30
|
+
producerTools: o,
|
|
31
|
+
replayReason: s,
|
|
32
|
+
shouldMarkReplayCompleted: n,
|
|
33
|
+
startupSnapshot: t,
|
|
34
|
+
startupSnapshotKey: e
|
|
35
|
+
} = a;
|
|
11
36
|
try {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
37
|
+
const r = d(
|
|
38
|
+
o,
|
|
39
|
+
t,
|
|
40
|
+
await t.loadMessages()
|
|
41
|
+
);
|
|
42
|
+
r.length && o.publishMessages(
|
|
43
|
+
t.resourceTypeId,
|
|
44
|
+
r,
|
|
45
|
+
s
|
|
46
|
+
), n && c.add(e);
|
|
47
|
+
} catch (r) {
|
|
19
48
|
console.warn(
|
|
20
49
|
"GClick realtime startup snapshot replay failed.",
|
|
21
50
|
{
|
|
22
|
-
error:
|
|
23
|
-
|
|
51
|
+
error: r,
|
|
52
|
+
replayReason: s,
|
|
53
|
+
resourceTypeId: t.resourceTypeId
|
|
24
54
|
}
|
|
25
55
|
);
|
|
26
56
|
} finally {
|
|
27
|
-
|
|
57
|
+
p.delete(e);
|
|
28
58
|
}
|
|
29
59
|
}
|
|
30
|
-
function
|
|
60
|
+
function i(a) {
|
|
61
|
+
const {
|
|
62
|
+
producerTools: o,
|
|
63
|
+
runtimeKey: s,
|
|
64
|
+
startupSnapshots: n = []
|
|
65
|
+
} = a;
|
|
66
|
+
n.forEach((t) => {
|
|
67
|
+
const e = u(
|
|
68
|
+
s,
|
|
69
|
+
t.resourceTypeId
|
|
70
|
+
);
|
|
71
|
+
c.has(e) || p.has(e) || (p.add(e), l({
|
|
72
|
+
producerTools: o,
|
|
73
|
+
replayReason: "first_snapshot",
|
|
74
|
+
shouldMarkReplayCompleted: !0,
|
|
75
|
+
startupSnapshot: t,
|
|
76
|
+
startupSnapshotKey: e
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function y(a) {
|
|
31
81
|
const {
|
|
32
|
-
producerTools:
|
|
33
|
-
runtimeKey:
|
|
34
|
-
startupSnapshots:
|
|
35
|
-
} =
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
82
|
+
producerTools: o,
|
|
83
|
+
runtimeKey: s,
|
|
84
|
+
startupSnapshots: n = []
|
|
85
|
+
} = a;
|
|
86
|
+
n.forEach((t) => {
|
|
87
|
+
const e = u(
|
|
88
|
+
s,
|
|
89
|
+
t.resourceTypeId
|
|
40
90
|
);
|
|
41
|
-
p.has(
|
|
42
|
-
producerTools:
|
|
43
|
-
|
|
44
|
-
|
|
91
|
+
p.has(e) || (p.add(e), l({
|
|
92
|
+
producerTools: o,
|
|
93
|
+
replayReason: "reconnect_snapshot",
|
|
94
|
+
shouldMarkReplayCompleted: !1,
|
|
95
|
+
startupSnapshot: t,
|
|
96
|
+
startupSnapshotKey: e
|
|
45
97
|
}));
|
|
46
98
|
});
|
|
47
99
|
}
|
|
48
100
|
export {
|
|
49
|
-
|
|
101
|
+
y as replayGClickRealtimeStartupSnapshotsOnReconnect,
|
|
102
|
+
i as replayGClickRealtimeStartupSnapshotsOnce
|
|
50
103
|
};
|