@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.
- package/consumer/RealTimeConsumerContext.d.ts +10 -0
- package/consumer/RealTimeConsumerContext.d.ts.map +1 -0
- package/consumer/RealTimeConsumerContext.js +128 -0
- package/consumer/index.d.ts +4 -0
- package/consumer/index.d.ts.map +1 -0
- package/consumer/index.js +7 -0
- package/consumer/types.d.ts +47 -0
- package/consumer/types.d.ts.map +1 -0
- package/consumer/useRealTimeConsumer.d.ts.map +1 -0
- package/{web/consumer → consumer}/useRealTimeConsumer.js +2 -2
- package/contracts/deviceData.d.ts +19 -22
- package/contracts/deviceData.d.ts.map +1 -1
- package/contracts/deviceDetail.d.ts +0 -2
- package/contracts/deviceDetail.d.ts.map +1 -1
- package/contracts/index.d.ts +1 -1
- package/contracts/index.d.ts.map +1 -1
- package/dummy/catalogs/baseDeviceTemplate.d.ts.map +1 -1
- package/dummy/catalogs/baseDeviceTemplate.js +4 -35
- package/dummy/catalogs/blueprints.d.ts +9 -54
- package/dummy/catalogs/blueprints.d.ts.map +1 -1
- package/dummy/catalogs/blueprints.js +25 -42
- package/dummy/catalogs/departments.d.ts +10 -0
- package/dummy/catalogs/departments.d.ts.map +1 -0
- package/dummy/catalogs/departments.js +43 -0
- package/dummy/index.d.ts +3 -3
- package/dummy/index.d.ts.map +1 -1
- package/dummy/index.js +28 -28
- package/dummy/shared/types.d.ts +2 -4
- package/dummy/shared/types.d.ts.map +1 -1
- package/dummy/{runtime → simulation}/simulation.d.ts +1 -1
- package/dummy/simulation/simulation.d.ts.map +1 -0
- package/dummy/{runtime → simulation}/simulation.js +333 -423
- package/dummy/{runtime/dummy.d.ts → source-data/SourceDataDummy.d.ts} +8 -3
- package/dummy/source-data/SourceDataDummy.d.ts.map +1 -0
- package/dummy/{runtime/dummy.js → source-data/SourceDataDummy.js} +117 -128
- package/mobile/index.d.ts +4 -0
- package/mobile/index.d.ts.map +1 -0
- package/mobile/index.js +23 -0
- package/mobile/resourceTypes.d.ts +48 -0
- package/mobile/resourceTypes.d.ts.map +1 -0
- package/mobile/resourceTypes.js +54 -0
- package/mobile/runtime/atmosphere.d.ts +10 -0
- package/mobile/runtime/atmosphere.d.ts.map +1 -0
- package/mobile/runtime/atmosphere.js +16 -0
- package/mobile/runtime/dummy.d.ts +11 -0
- package/mobile/runtime/dummy.d.ts.map +1 -0
- package/mobile/runtime/dummy.js +16 -0
- package/mobile/runtime/index.d.ts +11 -0
- package/mobile/runtime/index.d.ts.map +1 -0
- package/mobile/runtime/runtimeRegistry.d.ts +17 -0
- package/mobile/runtime/runtimeRegistry.d.ts.map +1 -0
- package/mobile/runtime/runtimeRegistry.js +24 -0
- package/mobile/runtime/sourceDataFactory.d.ts +6 -0
- package/mobile/runtime/sourceDataFactory.d.ts.map +1 -0
- package/mobile/runtime/sourceDataFactory.js +29 -0
- package/mobile/runtime/types.d.ts +8 -0
- package/mobile/runtime/types.d.ts.map +1 -0
- package/package.json +37 -1
- package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts +1 -1
- package/payload/mergeDevicePayloadWithUpdatedAtGuard.d.ts.map +1 -1
- package/rt_alarms/constants.d.ts +6 -0
- package/rt_alarms/constants.d.ts.map +1 -0
- package/rt_alarms/constants.js +7 -0
- package/rt_alarms/index.d.ts +15 -0
- package/rt_alarms/index.d.ts.map +1 -0
- package/rt_alarms/index.js +18 -0
- package/rt_devices/constants.d.ts +4 -0
- package/rt_devices/constants.d.ts.map +1 -0
- package/rt_devices/constants.js +5 -0
- package/rt_devices/index.d.ts +22 -0
- package/rt_devices/index.d.ts.map +1 -0
- package/rt_devices/index.js +150 -0
- package/rt_devices/resourceTypeMergeStrategies.d.ts +12 -0
- package/rt_devices/resourceTypeMergeStrategies.d.ts.map +1 -0
- package/rt_devices/resourceTypeMergeStrategies.js +19 -0
- package/shared/atmosphereHost.d.ts +5 -0
- package/shared/atmosphereHost.d.ts.map +1 -0
- package/shared/atmosphereHost.js +7 -0
- package/shared/index.d.ts +5 -0
- package/shared/index.d.ts.map +1 -0
- package/shared/index.js +11 -0
- package/shared/performanceMetrics.d.ts +64 -0
- package/shared/performanceMetrics.d.ts.map +1 -0
- package/shared/performanceMetrics.js +73 -0
- package/shared/runtimeRegistry.d.ts +17 -0
- package/shared/runtimeRegistry.d.ts.map +1 -0
- package/shared/runtimeRegistry.js +27 -0
- package/shared/runtimeResourceTypesKey.d.ts +14 -0
- package/shared/runtimeResourceTypesKey.d.ts.map +1 -0
- package/shared/runtimeResourceTypesKey.js +18 -0
- package/shared/startupSnapshots.d.ts +28 -0
- package/shared/startupSnapshots.d.ts.map +1 -0
- package/shared/startupSnapshots.js +29 -0
- package/web/diagnostics/performanceMetrics.d.ts +34 -0
- package/web/diagnostics/performanceMetrics.d.ts.map +1 -0
- package/web/diagnostics/performanceMetrics.js +61 -0
- package/web/host/devicesResourceType.d.ts +3 -11
- package/web/host/devicesResourceType.d.ts.map +1 -1
- package/web/host/devicesResourceType.js +58 -171
- package/web/host/hostRuntime.d.ts +6 -8
- package/web/host/hostRuntime.d.ts.map +1 -1
- package/web/host/hostRuntime.js +29 -38
- package/web/host/index.d.ts +2 -2
- package/web/host/index.d.ts.map +1 -1
- package/web/host/launchContract.d.ts +19 -13
- package/web/host/launchContract.d.ts.map +1 -1
- package/web/host/launchContract.js +82 -76
- package/web/index.d.ts +2 -7
- package/web/index.d.ts.map +1 -1
- package/web/index.js +34 -62
- package/web/runtime/atmosphere.d.ts +12 -0
- package/web/runtime/atmosphere.d.ts.map +1 -0
- package/web/runtime/atmosphere.js +22 -0
- package/web/runtime/dummy.d.ts +11 -0
- package/web/runtime/dummy.d.ts.map +1 -0
- package/web/runtime/dummy.js +22 -0
- package/web/runtime/index.d.ts +8 -9
- package/web/runtime/index.d.ts.map +1 -1
- package/web/runtime/performanceMetricReporter.d.ts +8 -0
- package/web/runtime/performanceMetricReporter.d.ts.map +1 -0
- package/web/runtime/performanceMetricReporter.js +10 -0
- package/web/runtime/runtimeRegistry.d.ts +21 -5
- package/web/runtime/runtimeRegistry.d.ts.map +1 -1
- package/web/runtime/runtimeRegistry.js +22 -7
- package/web/runtime/sourceDataFactory.d.ts +7 -0
- package/web/runtime/sourceDataFactory.d.ts.map +1 -0
- package/web/runtime/sourceDataFactory.js +26 -0
- package/web/{producer → runtime}/types.d.ts +2 -7
- package/web/runtime/types.d.ts.map +1 -0
- package/dummy/catalogs/group.d.ts +0 -10
- package/dummy/catalogs/group.d.ts.map +0 -1
- package/dummy/catalogs/group.js +0 -46
- package/dummy/runtime/dummy.d.ts.map +0 -1
- package/dummy/runtime/simulation.d.ts.map +0 -1
- package/libs/observability/mf/src/browserRuntimeHandles.js +0 -350
- package/libs/observability/mf/src/diagnosticPolicies/catalog.js +0 -12
- package/libs/observability/mf/src/diagnosticPolicies/contracts.js +0 -8
- package/libs/observability/mf/src/diagnosticPolicies/host.js +0 -127
- package/libs/observability/mf/src/diagnosticPolicies/operativeMyGpsDevices.js +0 -79
- package/web/consumer/RealTimeConsumerContext.d.ts +0 -10
- package/web/consumer/RealTimeConsumerContext.d.ts.map +0 -1
- package/web/consumer/RealTimeConsumerContext.js +0 -156
- package/web/consumer/index.d.ts +0 -6
- package/web/consumer/index.d.ts.map +0 -1
- package/web/consumer/store.d.ts +0 -10
- package/web/consumer/store.d.ts.map +0 -1
- package/web/consumer/store.helpers.d.ts +0 -62
- package/web/consumer/store.helpers.d.ts.map +0 -1
- package/web/consumer/store.helpers.js +0 -141
- package/web/consumer/store.js +0 -227
- package/web/consumer/types.d.ts +0 -161
- package/web/consumer/types.d.ts.map +0 -1
- package/web/consumer/useRealTimeConsumer.d.ts.map +0 -1
- package/web/host/startupSnapshots.d.ts +0 -45
- package/web/host/startupSnapshots.d.ts.map +0 -1
- package/web/host/startupSnapshots.js +0 -103
- package/web/producer/RealTimeProducerContext.d.ts +0 -9
- package/web/producer/RealTimeProducerContext.d.ts.map +0 -1
- package/web/producer/RealTimeProducerContext.js +0 -16
- package/web/producer/index.d.ts +0 -7
- package/web/producer/index.d.ts.map +0 -1
- package/web/producer/sourceDataFactory.d.ts +0 -13
- package/web/producer/sourceDataFactory.d.ts.map +0 -1
- package/web/producer/sourceDataFactory.js +0 -32
- package/web/producer/store.d.ts +0 -7
- package/web/producer/store.d.ts.map +0 -1
- package/web/producer/store.js +0 -5
- package/web/producer/types.d.ts.map +0 -1
- package/web/producer/useRealTimeProducer.d.ts +0 -7
- package/web/producer/useRealTimeProducer.d.ts.map +0 -1
- package/web/producer/useRealTimeProducer.js +0 -15
- package/web/runtime/resourceTypeMergeStrategies.d.ts +0 -10
- package/web/runtime/resourceTypeMergeStrategies.d.ts.map +0 -1
- package/web/runtime/resourceTypeMergeStrategies.js +0 -19
- package/web/runtime/runtime.d.ts +0 -16
- package/web/runtime/runtime.d.ts.map +0 -1
- package/web/runtime/runtime.js +0 -28
- package/web/runtime/runtimeAtmosphereOnly.d.ts +0 -11
- package/web/runtime/runtimeAtmosphereOnly.d.ts.map +0 -1
- package/web/runtime/runtimeAtmosphereOnly.js +0 -28
- package/web/runtime/runtimeRegistry.shared.d.ts +0 -23
- package/web/runtime/runtimeRegistry.shared.d.ts.map +0 -1
- package/web/runtime/runtimeRegistry.shared.js +0 -47
- package/web/runtime/runtimeRegistryAtmosphereOnly.d.ts +0 -9
- package/web/runtime/runtimeRegistryAtmosphereOnly.d.ts.map +0 -1
- package/web/runtime/runtimeRegistryAtmosphereOnly.js +0 -13
- package/web/shared/constants.d.ts +0 -11
- package/web/shared/constants.d.ts.map +0 -1
- package/web/shared/constants.js +0 -11
- package/web/shared/index.d.ts +0 -3
- package/web/shared/index.d.ts.map +0 -1
- package/web/shared/performanceMetrics.d.ts +0 -48
- package/web/shared/performanceMetrics.d.ts.map +0 -1
- package/web/shared/performanceMetrics.js +0 -70
- package/web/shared/runtimeTypes.d.ts +0 -4
- package/web/shared/runtimeTypes.d.ts.map +0 -1
- /package/{web/consumer → consumer}/useRealTimeConsumer.d.ts +0 -0
package/web/consumer/store.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { immer as T } from "../../node_modules/zustand/esm/middleware/immer.js";
|
|
2
|
-
import b from "../../node_modules/lodash-es/merge.js";
|
|
3
|
-
import { REALTIME_CONSUMER_SOTORE_ID as v } from "../shared/constants.js";
|
|
4
|
-
import { recordRealtimePerformanceMetric as i, getRealtimePerformanceNowMs as P, isRealtimePerformanceMetricsEnabled as E } from "../shared/performanceMetrics.js";
|
|
5
|
-
import { createConsumerDevtools as x, drainQueuedMessages as y, applyConsumerMessage as H, createConsumerMessageManager as N, createConsumerResourceKey as K, createConsumerSnapshotEntries as U, buildConsumerSnapshotResources as w, applyConsumerSnapshotEntriesChunk as z } from "./store.helpers.js";
|
|
6
|
-
import { createStore as B } from "../../node_modules/zustand/esm/vanilla.js";
|
|
7
|
-
const _ = 200, Y = 250;
|
|
8
|
-
function M() {
|
|
9
|
-
return E() ? P() : 0;
|
|
10
|
-
}
|
|
11
|
-
function p(c, m) {
|
|
12
|
-
E() && i(
|
|
13
|
-
c,
|
|
14
|
-
Math.max(0, P() - m)
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
function $(c) {
|
|
18
|
-
globalThis.setTimeout(c, 0);
|
|
19
|
-
}
|
|
20
|
-
function g(c, m) {
|
|
21
|
-
E() && i(
|
|
22
|
-
"consumerResourceCount",
|
|
23
|
-
Object.keys(m().hasResourcesTypes[c]?.hasResources ?? {}).length
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
function J(c, m = !1) {
|
|
27
|
-
const L = {
|
|
28
|
-
...c,
|
|
29
|
-
hasResourcesTypes: {},
|
|
30
|
-
customData: {}
|
|
31
|
-
}, h = {}, S = {}, f = {};
|
|
32
|
-
function O(e) {
|
|
33
|
-
const n = (S[e] ?? 0) + 1;
|
|
34
|
-
return S[e] = n, f[e] = /* @__PURE__ */ new Set(), n;
|
|
35
|
-
}
|
|
36
|
-
function C(e, n) {
|
|
37
|
-
return S[e] === n;
|
|
38
|
-
}
|
|
39
|
-
function D(e, n) {
|
|
40
|
-
C(e, n) && (f[e] = void 0);
|
|
41
|
-
}
|
|
42
|
-
function k(e, n) {
|
|
43
|
-
const s = f[e];
|
|
44
|
-
s && n.forEach((o) => {
|
|
45
|
-
s.add(K(o));
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function A(e, n, s, o, t, a) {
|
|
49
|
-
if (!C(s, a))
|
|
50
|
-
return;
|
|
51
|
-
const r = Math.min(
|
|
52
|
-
t + _,
|
|
53
|
-
o.length
|
|
54
|
-
), u = M();
|
|
55
|
-
if (e((R) => {
|
|
56
|
-
if (!C(s, a))
|
|
57
|
-
return;
|
|
58
|
-
const l = R.hasResourcesTypes[s];
|
|
59
|
-
l && z(
|
|
60
|
-
l.hasResources,
|
|
61
|
-
o,
|
|
62
|
-
t,
|
|
63
|
-
r,
|
|
64
|
-
R.hasResourcesTypesDecorators?.[s],
|
|
65
|
-
R.hasResourcesTypesStoreConfig?.[s],
|
|
66
|
-
f[s]
|
|
67
|
-
);
|
|
68
|
-
}), p(
|
|
69
|
-
"consumerSnapshotApplyDurationMs",
|
|
70
|
-
u
|
|
71
|
-
), i(
|
|
72
|
-
"consumerSnapshotChunkSize",
|
|
73
|
-
r - t
|
|
74
|
-
), g(s, n), r >= o.length) {
|
|
75
|
-
D(s, a);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
i("consumerSnapshotYieldCount"), $(() => {
|
|
79
|
-
A(
|
|
80
|
-
e,
|
|
81
|
-
n,
|
|
82
|
-
s,
|
|
83
|
-
o,
|
|
84
|
-
r,
|
|
85
|
-
a
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function Q(e, n, s, o) {
|
|
90
|
-
const t = O(s), a = U(o);
|
|
91
|
-
if (h[s] ??= N(), i(
|
|
92
|
-
"consumerSnapshotChunkCount",
|
|
93
|
-
Math.max(
|
|
94
|
-
1,
|
|
95
|
-
Math.ceil(
|
|
96
|
-
a.length / _
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
), a.length <= Y) {
|
|
100
|
-
const r = w(
|
|
101
|
-
o,
|
|
102
|
-
n().hasResourcesTypesDecorators?.[s],
|
|
103
|
-
n().hasResourcesTypesStoreConfig?.[s]
|
|
104
|
-
);
|
|
105
|
-
e((u) => {
|
|
106
|
-
u.hasResourcesTypes[s] = {
|
|
107
|
-
hasResources: r
|
|
108
|
-
};
|
|
109
|
-
}), g(s, n), D(s, t);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
e((r) => {
|
|
113
|
-
r.hasResourcesTypes[s] = {
|
|
114
|
-
hasResources: {}
|
|
115
|
-
};
|
|
116
|
-
}), A(
|
|
117
|
-
e,
|
|
118
|
-
n,
|
|
119
|
-
s,
|
|
120
|
-
a,
|
|
121
|
-
0,
|
|
122
|
-
t
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return B(
|
|
126
|
-
x(
|
|
127
|
-
T((e, n) => ({
|
|
128
|
-
...L,
|
|
129
|
-
realTimeConsumerActions: {
|
|
130
|
-
/**
|
|
131
|
-
* Seed one resource type with the current producer-side hash.
|
|
132
|
-
*/
|
|
133
|
-
loadResourceType: (s, o) => {
|
|
134
|
-
Q(
|
|
135
|
-
e,
|
|
136
|
-
n,
|
|
137
|
-
s,
|
|
138
|
-
o
|
|
139
|
-
);
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* Enqueue one incoming realtime batch and start draining the queue.
|
|
143
|
-
*/
|
|
144
|
-
onMessages: (s, o) => {
|
|
145
|
-
i(
|
|
146
|
-
"consumerIncomingBatch",
|
|
147
|
-
o.length
|
|
148
|
-
), h[s] ??= N(), o.forEach((t) => {
|
|
149
|
-
h[s].messagesQueue.enqueue(
|
|
150
|
-
t
|
|
151
|
-
);
|
|
152
|
-
}), i(
|
|
153
|
-
"consumerQueueLength",
|
|
154
|
-
h[s].messagesQueue.size()
|
|
155
|
-
), n().realTimeConsumerActions.processMessages(s);
|
|
156
|
-
},
|
|
157
|
-
/**
|
|
158
|
-
* Drain the queued messages in one store transaction while preserving order.
|
|
159
|
-
*/
|
|
160
|
-
processMessages: (s) => {
|
|
161
|
-
const o = M(), t = h[s];
|
|
162
|
-
if (t.statusProccesing)
|
|
163
|
-
return;
|
|
164
|
-
t.statusProccesing = !0;
|
|
165
|
-
const a = y(
|
|
166
|
-
t.messagesQueue
|
|
167
|
-
);
|
|
168
|
-
if (!a.length) {
|
|
169
|
-
t.statusProccesing = !1;
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
i(
|
|
173
|
-
"consumerDrainSet",
|
|
174
|
-
a.length
|
|
175
|
-
), k(
|
|
176
|
-
s,
|
|
177
|
-
a.map((r) => r.resourceSerialId)
|
|
178
|
-
);
|
|
179
|
-
try {
|
|
180
|
-
const r = M();
|
|
181
|
-
e((u) => {
|
|
182
|
-
u.hasResourcesTypes[s] || (u.hasResourcesTypes[s] = {
|
|
183
|
-
hasResources: {}
|
|
184
|
-
});
|
|
185
|
-
const R = u.hasResourcesTypes[s].hasResources;
|
|
186
|
-
a.forEach((l) => {
|
|
187
|
-
H(
|
|
188
|
-
R,
|
|
189
|
-
s,
|
|
190
|
-
l,
|
|
191
|
-
u.hasResourcesTypesDecorators,
|
|
192
|
-
u.hasResourcesTypesStoreConfig
|
|
193
|
-
);
|
|
194
|
-
});
|
|
195
|
-
}), p(
|
|
196
|
-
"consumerApplyNotifyDurationMs",
|
|
197
|
-
r
|
|
198
|
-
), g(s, n);
|
|
199
|
-
} finally {
|
|
200
|
-
p(
|
|
201
|
-
"consumerProcessDurationMs",
|
|
202
|
-
o
|
|
203
|
-
), t.statusProccesing = !1;
|
|
204
|
-
}
|
|
205
|
-
t.messagesQueue.isEmpty() || n().realTimeConsumerActions.processMessages(s);
|
|
206
|
-
},
|
|
207
|
-
/**
|
|
208
|
-
* Merge partial custom data into the consumer store.
|
|
209
|
-
*/
|
|
210
|
-
setCustomData: (s) => {
|
|
211
|
-
e((o) => {
|
|
212
|
-
b(o.customData, s);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
})),
|
|
217
|
-
{
|
|
218
|
-
name: `${v}: ${c.storeId}`,
|
|
219
|
-
enabled: m
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
export {
|
|
225
|
-
_ as REALTIME_CONSUMER_SNAPSHOT_CHUNK_SIZE,
|
|
226
|
-
J as createRealTimeConsumerStore
|
|
227
|
-
};
|
package/web/consumer/types.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { RealTimeProducerTools } from '@m4l/realtime-runtime';
|
|
3
|
-
import { OnRealTimeTransportReconnectCallback, RealTimeMessage, OnRealTimeConsumerMessageCallback, OnRealtimeConsumerSubscribeCallback, RealTimeMessagePayload, RealTimeReadonlyResourceHash, RealTimeResourceSerialId, RealTimeResourceTypeId } from '../shared/runtimeTypes';
|
|
4
|
-
/**
|
|
5
|
-
* Realtime message decorator. Only the payload is decorated.
|
|
6
|
-
*/
|
|
7
|
-
export type RealTimeMessageDecorator = (resourceSerialId: RealTimeResourceSerialId, message: RealTimeMessagePayload) => RealTimeMessagePayload;
|
|
8
|
-
/**
|
|
9
|
-
* Consumer-side store ownership mode for one realtime resource type.
|
|
10
|
-
*/
|
|
11
|
-
export type RealTimeConsumerStoreMode = 'callbacks-only' | 'full' | 'projected';
|
|
12
|
-
/**
|
|
13
|
-
* Project one startup snapshot resource into the MF-local consumer store shape.
|
|
14
|
-
* Returning `null` or `undefined` skips that resource from the local store.
|
|
15
|
-
*/
|
|
16
|
-
export type RealTimeConsumerSnapshotProjector = (resourceSerialId: RealTimeResourceSerialId, resource: RealTimeMessagePayload) => RealTimeMessagePayload | null | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Context passed to projected message reducers so they can keep only the fields they need.
|
|
19
|
-
*/
|
|
20
|
-
export interface RealTimeConsumerMessageProjectorContext {
|
|
21
|
-
/**
|
|
22
|
-
* Current projected resource already stored in the consumer hash, if any.
|
|
23
|
-
*/
|
|
24
|
-
currentResource?: RealTimeMessagePayload;
|
|
25
|
-
/**
|
|
26
|
-
* Incoming realtime message with its payload already decorated for this resource type.
|
|
27
|
-
*/
|
|
28
|
-
message: RealTimeMessage;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Project one live realtime message into the MF-local consumer store shape.
|
|
32
|
-
* Returning `undefined` keeps the previous local resource unchanged, while
|
|
33
|
-
* returning `null` removes it from the consumer hash.
|
|
34
|
-
*/
|
|
35
|
-
export type RealTimeConsumerMessageProjector = (resourceSerialId: RealTimeResourceSerialId, context: RealTimeConsumerMessageProjectorContext) => RealTimeMessagePayload | null | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Configure how one realtime resource type should be represented in the MF-local store.
|
|
38
|
-
*/
|
|
39
|
-
export interface RealTimeConsumerResourceStoreConfig {
|
|
40
|
-
/**
|
|
41
|
-
* `full` keeps the decorated payload merge semantics, `projected` lets the
|
|
42
|
-
* consumer keep only a reduced shape, and `callbacks-only` skips the local
|
|
43
|
-
* consumer store entirely.
|
|
44
|
-
*/
|
|
45
|
-
mode?: RealTimeConsumerStoreMode;
|
|
46
|
-
/**
|
|
47
|
-
* Optional reducer used when the local store runs in `projected` mode.
|
|
48
|
-
*/
|
|
49
|
-
messageProjector?: RealTimeConsumerMessageProjector;
|
|
50
|
-
/**
|
|
51
|
-
* Optional snapshot projector used when the local store runs in `projected` mode.
|
|
52
|
-
*/
|
|
53
|
-
snapshotProjector?: RealTimeConsumerSnapshotProjector;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Declarative subscription contract for one realtime resource type.
|
|
57
|
-
*/
|
|
58
|
-
export interface RealTimeConsumerResourceSubscription extends Omit<RealTimeConsumerResourceStoreConfig, 'mode'> {
|
|
59
|
-
/**
|
|
60
|
-
* Realtime resource type handled by this MF-local subscription.
|
|
61
|
-
*/
|
|
62
|
-
resourceTypeId: RealTimeResourceTypeId;
|
|
63
|
-
/**
|
|
64
|
-
* Controls whether this subscription hydrates the MF-local consumer store.
|
|
65
|
-
*/
|
|
66
|
-
storeMode?: RealTimeConsumerStoreMode;
|
|
67
|
-
/**
|
|
68
|
-
* Decorators applied before the local store keeps snapshot resources or
|
|
69
|
-
* incoming message payloads for this resource type.
|
|
70
|
-
*/
|
|
71
|
-
hasResourcesDecorators?: RealTimeMessageDecorator[];
|
|
72
|
-
/**
|
|
73
|
-
* Optional MF-local side effects for live batches of this resource type.
|
|
74
|
-
*/
|
|
75
|
-
onMessagesCallbacks?: OnRealTimeConsumerMessageCallback[];
|
|
76
|
-
/**
|
|
77
|
-
* Optional MF-local side effects for the initial snapshot of this resource type.
|
|
78
|
-
*/
|
|
79
|
-
onSubscribeCallbacks?: OnRealtimeConsumerSubscribeCallback[];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Consumer-side realtime resource bucket.
|
|
83
|
-
*/
|
|
84
|
-
export interface RealTimeConsumer {
|
|
85
|
-
/**
|
|
86
|
-
* Consumer-side resource hash.
|
|
87
|
-
*/
|
|
88
|
-
hasResources: Record<RealTimeResourceSerialId, RealTimeMessagePayload>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Consumer-side realtime store state.
|
|
92
|
-
*/
|
|
93
|
-
export interface RealTimeConsumerStoreState {
|
|
94
|
-
/**
|
|
95
|
-
* Store identifier.
|
|
96
|
-
*/
|
|
97
|
-
storeId: string;
|
|
98
|
-
/**
|
|
99
|
-
* Consumer-side realtime data grouped by resource type.
|
|
100
|
-
*/
|
|
101
|
-
hasResourcesTypes: Record<RealTimeResourceTypeId, RealTimeConsumer>;
|
|
102
|
-
/**
|
|
103
|
-
* Decorators applied to initial resources and incoming payloads.
|
|
104
|
-
*/
|
|
105
|
-
hasResourcesTypesDecorators?: Record<RealTimeResourceTypeId, RealTimeMessageDecorator[]>;
|
|
106
|
-
/**
|
|
107
|
-
* Per-resource store behavior for explicit consumer subscriptions.
|
|
108
|
-
*/
|
|
109
|
-
hasResourcesTypesStoreConfig?: Record<RealTimeResourceTypeId, RealTimeConsumerResourceStoreConfig>;
|
|
110
|
-
/**
|
|
111
|
-
* Additional arbitrary data associated with the realtime consumer.
|
|
112
|
-
*/
|
|
113
|
-
customData: Record<string, unknown>;
|
|
114
|
-
}
|
|
115
|
-
export interface RealTimeConsumerStoreStateWithActions extends RealTimeConsumerStoreState {
|
|
116
|
-
realTimeConsumerActions: {
|
|
117
|
-
/**
|
|
118
|
-
* Seed one resource type with the current producer-side hash.
|
|
119
|
-
* Large snapshots may load incrementally so the UI can keep responding.
|
|
120
|
-
*/
|
|
121
|
-
loadResourceType(resourceTypeId: RealTimeResourceTypeId, hasResources: RealTimeReadonlyResourceHash): void;
|
|
122
|
-
/**
|
|
123
|
-
* Accept a raw incoming batch and enqueue it for consumer-side processing.
|
|
124
|
-
*/
|
|
125
|
-
onMessages: OnRealTimeConsumerMessageCallback;
|
|
126
|
-
/**
|
|
127
|
-
* Drain the queued messages for one resource type in arrival order.
|
|
128
|
-
*/
|
|
129
|
-
processMessages: (resourceTypeId: RealTimeResourceTypeId) => void;
|
|
130
|
-
/**
|
|
131
|
-
* Merge partial custom data into the current consumer state.
|
|
132
|
-
*/
|
|
133
|
-
setCustomData: (customData: Record<string, unknown>) => void;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
export type InitialRealTimeStoreProps = Omit<RealTimeConsumerStoreState, 'customData' | 'hasResourcesTypes'>;
|
|
137
|
-
export interface RealTimeProviderProps extends Omit<InitialRealTimeStoreProps, 'storeId'> {
|
|
138
|
-
/**
|
|
139
|
-
* MF-owned window identifier used to scope the local consumer store and
|
|
140
|
-
* producer subscription without coupling this package to shell hooks.
|
|
141
|
-
*/
|
|
142
|
-
windowId: string;
|
|
143
|
-
/**
|
|
144
|
-
* Host-owned producer tools used to subscribe and unsubscribe without producer React context.
|
|
145
|
-
*/
|
|
146
|
-
producerTools: RealTimeProducerTools;
|
|
147
|
-
/**
|
|
148
|
-
* Declarative resource subscriptions for this MF-local consumer.
|
|
149
|
-
* When omitted, the provider keeps the legacy `rt_devices` subscription path.
|
|
150
|
-
*/
|
|
151
|
-
resourceSubscriptions?: RealTimeConsumerResourceSubscription[];
|
|
152
|
-
storeDevtoolsEnabled?: boolean;
|
|
153
|
-
onMessagesCallbacks?: OnRealTimeConsumerMessageCallback[];
|
|
154
|
-
onSubscribeCallbacks?: OnRealtimeConsumerSubscribeCallback[];
|
|
155
|
-
/**
|
|
156
|
-
* Optional MF-local side effects fired when the shared transport recovers after a reconnect.
|
|
157
|
-
*/
|
|
158
|
-
onTransportReconnectCallbacks?: OnRealTimeTransportReconnectCallback[];
|
|
159
|
-
children: ReactNode;
|
|
160
|
-
}
|
|
161
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/consumer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EACV,oCAAoC,EACpC,eAAe,EACf,iCAAiC,EACjC,mCAAmC,EACnC,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,CACrC,gBAAgB,EAAE,wBAAwB,EAC1C,OAAO,EAAE,sBAAsB,KAC5B,sBAAsB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,MAAM,GACN,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,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+0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRealTimeConsumer.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/consumer/useRealTimeConsumer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAErE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,qCAAqC,KAAK,CAAC,EAC7D,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,GAC1C,CAAC,CAUH;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
/**
|
|
12
|
-
* Marks the loader as a full authoritative resource set so replay can synthesize deletes for missing resources.
|
|
13
|
-
*/
|
|
14
|
-
authoritativeResourceSet?: boolean;
|
|
15
|
-
loadMessages: GClickRealtimeStartupSnapshotMessagesLoader;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Runtime-level startup snapshot definition after the resource type owns its target id.
|
|
19
|
-
*/
|
|
20
|
-
export interface GClickRealtimeStartupSnapshotConfig extends GClickRealtimeResourceStartupSnapshotConfig {
|
|
21
|
-
resourceTypeId: RealTimeResourceTypeId;
|
|
22
|
-
}
|
|
23
|
-
export interface ReplayGClickRealtimeStartupSnapshotsOnceProps {
|
|
24
|
-
producerTools: RealTimeProducerTools;
|
|
25
|
-
runtimeKey: string;
|
|
26
|
-
startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
|
|
27
|
-
}
|
|
28
|
-
export interface ReplayGClickRealtimeStartupSnapshotsOnReconnectProps {
|
|
29
|
-
producerTools: RealTimeProducerTools;
|
|
30
|
-
runtimeKey: string;
|
|
31
|
-
startupSnapshots?: GClickRealtimeStartupSnapshotConfig[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Replay all configured startup snapshots without blocking host-runtime creation.
|
|
35
|
-
*/
|
|
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;
|
|
41
|
-
/**
|
|
42
|
-
* Clear startup snapshot idempotency state between focused unit tests.
|
|
43
|
-
*/
|
|
44
|
-
export declare function resetGClickRealtimeStartupSnapshotsForTesting(): void;
|
|
45
|
-
//# sourceMappingURL=startupSnapshots.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,103 +0,0 @@
|
|
|
1
|
-
const c = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set();
|
|
2
|
-
function u(a, o) {
|
|
3
|
-
return `${a}:${o}`;
|
|
4
|
-
}
|
|
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) {
|
|
29
|
-
const {
|
|
30
|
-
producerTools: o,
|
|
31
|
-
replayReason: s,
|
|
32
|
-
shouldMarkReplayCompleted: n,
|
|
33
|
-
startupSnapshot: t,
|
|
34
|
-
startupSnapshotKey: e
|
|
35
|
-
} = a;
|
|
36
|
-
try {
|
|
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) {
|
|
48
|
-
console.warn(
|
|
49
|
-
"GClick realtime startup snapshot replay failed.",
|
|
50
|
-
{
|
|
51
|
-
error: r,
|
|
52
|
-
replayReason: s,
|
|
53
|
-
resourceTypeId: t.resourceTypeId
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
} finally {
|
|
57
|
-
p.delete(e);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
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) {
|
|
81
|
-
const {
|
|
82
|
-
producerTools: o,
|
|
83
|
-
runtimeKey: s,
|
|
84
|
-
startupSnapshots: n = []
|
|
85
|
-
} = a;
|
|
86
|
-
n.forEach((t) => {
|
|
87
|
-
const e = u(
|
|
88
|
-
s,
|
|
89
|
-
t.resourceTypeId
|
|
90
|
-
);
|
|
91
|
-
p.has(e) || (p.add(e), l({
|
|
92
|
-
producerTools: o,
|
|
93
|
-
replayReason: "reconnect_snapshot",
|
|
94
|
-
shouldMarkReplayCompleted: !1,
|
|
95
|
-
startupSnapshot: t,
|
|
96
|
-
startupSnapshotKey: e
|
|
97
|
-
}));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
export {
|
|
101
|
-
y as replayGClickRealtimeStartupSnapshotsOnReconnect,
|
|
102
|
-
i as replayGClickRealtimeStartupSnapshotsOnce
|
|
103
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RealTimeProducerProviderProps } from './types';
|
|
2
|
-
import { RealTimeProducerStoreType } from './store';
|
|
3
|
-
declare const RealTimeProducerContext: import('react').Context<RealTimeProducerStoreType | null>;
|
|
4
|
-
/**
|
|
5
|
-
* Mount one producer store inside React while delegating its lifecycle to the shared runtime helper.
|
|
6
|
-
*/
|
|
7
|
-
declare function RealTimeProducerProvider(props: RealTimeProducerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export { RealTimeProducerProvider, RealTimeProducerContext };
|
|
9
|
-
//# sourceMappingURL=RealTimeProducerContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RealTimeProducerContext.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/RealTimeProducerContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAMzD,QAAA,MAAM,uBAAuB,2DAE5B,CAAC;AAEF;;GAEG;AACH,iBAAS,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,2CAmBrE;AAED,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { j as u } from "../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { r } from "../../_virtual/index.js";
|
|
3
|
-
import { createRealtimeRuntime as c } from "../runtime/runtime.js";
|
|
4
|
-
const i = r.createContext(
|
|
5
|
-
null
|
|
6
|
-
);
|
|
7
|
-
function f(t) {
|
|
8
|
-
const { children: o, ...n } = t, e = r.useRef(null);
|
|
9
|
-
return e.current || (e.current = c(n)), r.useEffect(() => () => {
|
|
10
|
-
e.current?.dispose();
|
|
11
|
-
}, []), /* @__PURE__ */ u.jsx(i.Provider, { value: e.current.store, children: o });
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
i as RealTimeProducerContext,
|
|
15
|
-
f as RealTimeProducerProvider
|
|
16
|
-
};
|
package/web/producer/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { RealTimeProducerContext, RealTimeProducerProvider, } from './RealTimeProducerContext';
|
|
2
|
-
export { useRealTimeProducer } from './useRealTimeProducer';
|
|
3
|
-
export { createRealTimeProducerStore } from './store';
|
|
4
|
-
export type { CreateRealTimeSourceData, CreateRealTimeStoreProps, RealTimeProducerStoreType, } from './store';
|
|
5
|
-
export { SourceDataFactory } from './sourceDataFactory';
|
|
6
|
-
export type { InitialRealTimeProducerStoreProps, RealTimeProducerProviderProps, RealTimeProducerStoreState, RealTimeProducerStoreStateWithActions, RealTimeResourceSourceMechanismConfig, RealTimeResourceSourceMechanismConfigDummy, RealTimeResourceType, ResourceTypeSourceDataMechanism, } from './types';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EACV,iCAAiC,EACjC,6BAA6B,EAC7B,0BAA0B,EAC1B,qCAAqC,EACrC,qCAAqC,EACrC,0CAA0C,EAC1C,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,SAAS,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { OnMessagesStoreCallback, OnRealTimeProducerMetricCallback, OnRealTimeTransportReconnectCallback, SourceDataBase } from '@m4l/realtime-runtime';
|
|
2
|
-
import { RealTimeResourceSourceMechanismConfigBase } from '../shared/runtimeTypes';
|
|
3
|
-
/**
|
|
4
|
-
* Source data factory.
|
|
5
|
-
*/
|
|
6
|
-
export declare class SourceDataFactory {
|
|
7
|
-
/**
|
|
8
|
-
* Create a runtime-scoped source-data factory that reuses one Atmosphere transport per app/runtime.
|
|
9
|
-
*/
|
|
10
|
-
static createSourceDataFactory(): (config: RealTimeResourceSourceMechanismConfigBase, onMessages: OnMessagesStoreCallback, onPerformanceMetric?: OnRealTimeProducerMetricCallback, onTransportReconnect?: OnRealTimeTransportReconnectCallback) => SourceDataBase;
|
|
11
|
-
}
|
|
12
|
-
export default SourceDataFactory;
|
|
13
|
-
//# sourceMappingURL=sourceDataFactory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,oCAAoC,EACpC,cAAc,EACf,MAAM,uBAAuB,CAAC;AAI/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,EACtD,uBAAuB,oCAAoC,KAC1D,cAAc;CAmBpB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createAtmosphereSourceDataFactory as o } from "@m4l/realtime-runtime";
|
|
2
|
-
import { SourceDataDummy as u } from "../../dummy/runtime/dummy.js";
|
|
3
|
-
class p {
|
|
4
|
-
/**
|
|
5
|
-
* Create a runtime-scoped source-data factory that reuses one Atmosphere transport per app/runtime.
|
|
6
|
-
*/
|
|
7
|
-
static createSourceDataFactory() {
|
|
8
|
-
const t = o();
|
|
9
|
-
return function(r, e, a, c) {
|
|
10
|
-
switch (r.sourceDataMechanism) {
|
|
11
|
-
case "dummy":
|
|
12
|
-
return new u(
|
|
13
|
-
r,
|
|
14
|
-
e
|
|
15
|
-
);
|
|
16
|
-
case "atmosphere":
|
|
17
|
-
return t(
|
|
18
|
-
r,
|
|
19
|
-
e,
|
|
20
|
-
a,
|
|
21
|
-
c
|
|
22
|
-
);
|
|
23
|
-
default:
|
|
24
|
-
throw new Error("Unknown resource type");
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
p as SourceDataFactory,
|
|
31
|
-
p as default
|
|
32
|
-
};
|
package/web/producer/store.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRealTimeStore as createRealtimeRuntimeStore } from '../../../../../dist/packages/@m4l/realtime-runtime/web';
|
|
2
|
-
import { StoreApi } from 'zustand';
|
|
3
|
-
import { RealTimeProducerStoreStateWithActions } from './types';
|
|
4
|
-
export declare const createRealTimeProducerStore: typeof createRealtimeRuntimeStore;
|
|
5
|
-
export type { CreateRealTimeSourceData, CreateRealTimeStoreProps, } from '../../../../../dist/packages/@m4l/realtime-runtime/web';
|
|
6
|
-
export type RealTimeProducerStoreType = StoreApi<RealTimeProducerStoreStateWithActions>;
|
|
7
|
-
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,IAAI,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,SAAS,CAAC;AAErE,eAAO,MAAM,2BAA2B,mCAA6B,CAAC;AAEtE,YAAY,EACV,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,yBAAyB,GACnC,QAAQ,CAAC,qCAAqC,CAAC,CAAC"}
|
package/web/producer/store.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick-realtime/src/web/producer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,iCAAiC,IAAI,qCAAqC,EAC1E,0BAA0B,IAAI,8BAA8B,EAC5D,qCAAqC,IAAI,yCAAyC,EACnF,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,uBA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