@genesislcap/foundation-comms 15.84.0 → 15.84.1
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/dist/dts/connect/socket.d.ts.map +1 -1
- package/dist/dts/datasource/datasource.d.ts +6 -0
- package/dist/dts/datasource/datasource.d.ts.map +1 -1
- package/dist/esm/connect/socket.js +17 -3
- package/dist/esm/datasource/datasource.js +75 -22
- package/dist/foundation-comms.api.json +1 -1
- package/dist/foundation-comms.d.ts +6 -0
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/connect/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAsB,cAAc,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGzF,OAAO,EAAQ,UAAU,EAAgB,OAAO,EAAE,YAAY,EAAc,MAAM,MAAM,CAAC;AAKzF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAEL,OAAO,EACP,cAAc,EAIf,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,sBAAsB,EAEvB,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;CAI/C;AAED;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;gBACxC,GAAG,IAAI,EAAE,G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AG,GAAG,CAAC;IAkClB,aAAa,CAAC,CAAC,EACpB,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,EACjB,UAAU,CAAC,EAAE,QAAQ,GACpB,UAAU,CAAC,OAAO,CAAC;IAyDf,4BAA4B,CAAC,CAAC,EACnC,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,GAChB,UAAU,CAAC,OAAO,CAAC;IAef,cAAc,QAAO,aAAa,CAAC,OAAO,CAAC,CAAoB;IAEtE,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,oBAAoB;IAI5B;;;OAGG;IACH,wBAAwB,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;IAI5F;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,kBAAkB;CAkB3B;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,8DAAgE,CAAC;AAEpF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
|
|
@@ -66,6 +66,8 @@ export interface Datasource extends DatasourceMetadata {
|
|
|
66
66
|
* @param fetchMeta - Optional flag to fetch metadata for the datasource. Defaults to true.
|
|
67
67
|
* @param startStream - Optional flag to start the data stream. Defaults to true.
|
|
68
68
|
* @returns A promise that resolves with a boolean indicating whether the initialization was successful.
|
|
69
|
+
* When another `init()` or `destroy()` is called before it finishes, it sends nothing more and resolves with the
|
|
70
|
+
* result of the latest `init()`, or false when `destroy()` was called last, even if one of its requests then fails.
|
|
69
71
|
*/
|
|
70
72
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
71
73
|
/**
|
|
@@ -221,6 +223,8 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
221
223
|
resourceType: ResourceType;
|
|
222
224
|
stream: SocketObservable<FilteredDataServerResult | RequestServerResult>;
|
|
223
225
|
private _allParams;
|
|
226
|
+
private generation;
|
|
227
|
+
private latestInit?;
|
|
224
228
|
constructor(connect: Connect, auth: Auth, resources: GenesisResources, config: DatasourceConfig, connectEvents: ConnectEvents);
|
|
225
229
|
private pollTrigger$;
|
|
226
230
|
private commitResponseUnsubscribe?;
|
|
@@ -230,6 +234,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
230
234
|
*/
|
|
231
235
|
validResourceName(resourceName: string): boolean;
|
|
232
236
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
237
|
+
private initialise;
|
|
233
238
|
startStream(): Promise<void>;
|
|
234
239
|
/** {@inheritDoc Datasource.destroy} */
|
|
235
240
|
destroy(): void;
|
|
@@ -270,6 +275,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
270
275
|
*/
|
|
271
276
|
protected normaliseStatus(status: Partial<DatasourceStatus>): DatasourceStatus;
|
|
272
277
|
private invalidateCache;
|
|
278
|
+
private interruptedInit;
|
|
273
279
|
}
|
|
274
280
|
/**
|
|
275
281
|
* The DI token for the Datasource interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../../src/datasource/datasource.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EACL,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,gBAAgB,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,WAAW,EACX,cAAc,EAEd,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,gBAAgB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AAI,aAAa,CAerC;IAED;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAqB1B;;;OAGG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIlC,QAAQ,CAAC,cAAc,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBhD,gBAAgB,CAAC,KAAK,GAAE,MAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAYjE,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,kBAAkB;cA8CV,qBAAqB,CAAC,YAAY,EAAE,MAAM;IAuC1D;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,MAAM,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAa7D;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;IAa9E,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;CAKxB;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,kEAAwE,CAAC;AAEhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAE1C"}
|
|
@@ -546,8 +546,18 @@ let DefaultSocket = class DefaultSocket {
|
|
|
546
546
|
* We need to queue these outgoing messages to allow the consumers to subscribe in time. We should review the entire
|
|
547
547
|
* setup with late subscribers in mind, as we can't say when they will actually subscribe. The impact is grids and
|
|
548
548
|
* other components remaining stuck on Loading screens, as they miss the first `onMessage` reply.
|
|
549
|
+
*
|
|
550
|
+
* A stream torn down before its turn (subscribed and unsubscribed in one task) sends neither message: its
|
|
551
|
+
* DATA_LOGOFF would reach the server ahead of the DATA_LOGON, which would then open a subscription nothing handles.
|
|
549
552
|
*/
|
|
550
|
-
|
|
553
|
+
let logonSent = false;
|
|
554
|
+
let tornDown = false;
|
|
555
|
+
DOM.queueUpdate(() => {
|
|
556
|
+
if (tornDown)
|
|
557
|
+
return;
|
|
558
|
+
logonSent = true;
|
|
559
|
+
this.websocket.next(message);
|
|
560
|
+
});
|
|
551
561
|
/**
|
|
552
562
|
* @privateRemarks
|
|
553
563
|
* Running the data logoff from here makes more sense given the network monitor actor is optionally added.
|
|
@@ -567,8 +577,11 @@ let DefaultSocket = class DefaultSocket {
|
|
|
567
577
|
},
|
|
568
578
|
});
|
|
569
579
|
return () => {
|
|
580
|
+
tornDown = true;
|
|
570
581
|
messagesSubscription.unsubscribe();
|
|
571
|
-
|
|
582
|
+
if (logonSent) {
|
|
583
|
+
this.sendDataLogoff(message.SOURCE_REF);
|
|
584
|
+
}
|
|
572
585
|
this.removeMessageHandler(message.SOURCE_REF);
|
|
573
586
|
onComplete && onComplete();
|
|
574
587
|
};
|
|
@@ -591,7 +604,8 @@ let DefaultSocket = class DefaultSocket {
|
|
|
591
604
|
this.wsMessageHandlers.set(message.SOURCE_REF, new SocketMessageHandler(message, onMessage, onError, isSubscription));
|
|
592
605
|
}
|
|
593
606
|
sendDataLogoff(sourceRef) {
|
|
594
|
-
|
|
607
|
+
// Nothing awaits a logoff, and a closed socket has no server subscription left to end.
|
|
608
|
+
this.send(this.messageBuilder.createDataLogoffMessage(sourceRef), false).catch((error) => logger.debug(`DATA_LOGOFF not sent for SourceRef: ${sourceRef}`, error));
|
|
595
609
|
}
|
|
596
610
|
removeMessageHandler(sourceRef) {
|
|
597
611
|
this.wsMessageHandlers.delete(sourceRef);
|
|
@@ -51,6 +51,9 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
51
51
|
this.loadMoreCount = 0;
|
|
52
52
|
this.readOnly = true;
|
|
53
53
|
this._allParams = null;
|
|
54
|
+
// Counts init() and destroy() calls, so an init() or metadata fetch still waiting on the server
|
|
55
|
+
// when a later one runs can tell, and stop.
|
|
56
|
+
this.generation = 0;
|
|
54
57
|
this.pollTrigger$ = new Subject();
|
|
55
58
|
}
|
|
56
59
|
triggerPoll() {
|
|
@@ -70,31 +73,61 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
70
73
|
}
|
|
71
74
|
init(options_1) {
|
|
72
75
|
return __awaiter(this, arguments, void 0, function* (options, fetchMeta = this.fetchMetadataRequired, startStream = this.startStreamRequired) {
|
|
76
|
+
// The latest init() wins: one still waiting on the server stops, and takes this one's result.
|
|
77
|
+
const generation = (this.generation += 1);
|
|
78
|
+
const result = this.initialise(generation, options, fetchMeta, startStream).catch((error) => {
|
|
79
|
+
if (generation === this.generation)
|
|
80
|
+
throw error;
|
|
81
|
+
// A request that failed once this was superseded is not its failure any more: a socket that
|
|
82
|
+
// closes rejects every request still waiting for a reply.
|
|
83
|
+
logger.debug(`${options === null || options === void 0 ? void 0 : options.resourceName} datasource initialisation failed after it was superseded:`, error);
|
|
84
|
+
return this.interruptedInit(options === null || options === void 0 ? void 0 : options.resourceName);
|
|
85
|
+
});
|
|
86
|
+
this.latestInit = { generation, result };
|
|
87
|
+
return result;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
initialise(generation, options, fetchMeta, startStream) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
92
|
this.fetchMetadataRequired = fetchMeta;
|
|
74
93
|
this.options = Object.assign(Object.assign({}, this.config.options), options);
|
|
75
94
|
// Invalidate parameter cache when options change
|
|
76
95
|
this.invalidateCache();
|
|
77
|
-
|
|
96
|
+
// A destroy() or another init() may run while this waits on the server (an element leaving the
|
|
97
|
+
// document, a grid restarting or reloading): destroy() clears the options, init() replaces
|
|
98
|
+
// them. Read the name once, and stop once either has run, rather than go on to send requests
|
|
99
|
+
// and a DATA_LOGON with no resource name, or with another init()'s options.
|
|
100
|
+
const { resourceName } = this.options;
|
|
101
|
+
const superseded = () => generation !== this.generation;
|
|
78
102
|
const connected = this.connect.isConnected || (yield this.connect.connect());
|
|
103
|
+
if (superseded())
|
|
104
|
+
return this.interruptedInit(resourceName);
|
|
79
105
|
if (!connected) {
|
|
80
106
|
logger.error(`Unable to connect to ${this.connect.host} to get ${resourceName} datasource`);
|
|
81
107
|
this.reportStatus();
|
|
82
108
|
return false;
|
|
83
109
|
}
|
|
84
110
|
const isValidResource = yield this.resources.isValidResource(resourceName);
|
|
111
|
+
if (superseded())
|
|
112
|
+
return this.interruptedInit(resourceName);
|
|
85
113
|
if (!isValidResource) {
|
|
86
114
|
logger.error(`${resourceName} datasource does not exist on ${this.connect.host}`);
|
|
87
115
|
this.reportStatus();
|
|
88
116
|
return false;
|
|
89
117
|
}
|
|
90
|
-
|
|
118
|
+
const resourceType = yield this.resources.getResourceTypeFor(resourceName);
|
|
119
|
+
if (superseded())
|
|
120
|
+
return this.interruptedInit(resourceName);
|
|
121
|
+
this.resourceType = resourceType;
|
|
91
122
|
if (!this.resourceType) {
|
|
92
123
|
logger.error(`Unable to get the resource type for ${resourceName} datasource from ${this.connect.host}`);
|
|
93
124
|
this.reportStatus();
|
|
94
125
|
return false;
|
|
95
126
|
}
|
|
96
127
|
if (this.fetchMetadataRequired) {
|
|
97
|
-
yield this.fetchAndApplyMetadata(
|
|
128
|
+
yield this.fetchAndApplyMetadata(resourceName);
|
|
129
|
+
if (superseded())
|
|
130
|
+
return this.interruptedInit(resourceName);
|
|
98
131
|
// Invalidate cache again after metadata fetch as availableIndexes may have changed
|
|
99
132
|
this._allParams = null;
|
|
100
133
|
}
|
|
@@ -103,7 +136,9 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
103
136
|
// Recreate pollTrigger$ so pollTriggerEvents work after destroy/reinit.
|
|
104
137
|
// A completed Subject ignores next(), so we need a fresh one each init.
|
|
105
138
|
this.pollTrigger$ = new Subject();
|
|
106
|
-
|
|
139
|
+
// Synchronously: opening the stream queues its DATA_LOGON, and nothing may come between that
|
|
140
|
+
// and this datasource holding the stream.
|
|
141
|
+
this.stream = this.createStream();
|
|
107
142
|
}
|
|
108
143
|
logger.debug(`${resourceName} datasource initialization ${this.initialized ? `was successful.` : 'has failed.'}`);
|
|
109
144
|
this.reportStatus();
|
|
@@ -113,7 +148,7 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
113
148
|
startStream() {
|
|
114
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
150
|
if (!this.options.isSnapshot && this.stream === undefined) {
|
|
116
|
-
this.stream =
|
|
151
|
+
this.stream = this.createStream();
|
|
117
152
|
}
|
|
118
153
|
});
|
|
119
154
|
}
|
|
@@ -121,6 +156,7 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
121
156
|
destroy() {
|
|
122
157
|
var _a, _b;
|
|
123
158
|
logger.debug('Datasource.destroy', (_a = this.options) === null || _a === void 0 ? void 0 : _a.resourceName);
|
|
159
|
+
this.generation += 1;
|
|
124
160
|
if (this.commitResponseUnsubscribe) {
|
|
125
161
|
this.commitResponseUnsubscribe();
|
|
126
162
|
this.commitResponseUnsubscribe = undefined;
|
|
@@ -266,23 +302,21 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
266
302
|
});
|
|
267
303
|
}
|
|
268
304
|
createStream() {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return this.createReqRepStream();
|
|
278
|
-
});
|
|
305
|
+
if (![ResourceType.DATASERVER, ResourceType.REQUEST_SERVER].includes(this.resourceType)) {
|
|
306
|
+
throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);
|
|
307
|
+
}
|
|
308
|
+
if (this.resourceType === ResourceType.DATASERVER) {
|
|
309
|
+
return this.createDataserverStream();
|
|
310
|
+
}
|
|
311
|
+
logger.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`);
|
|
312
|
+
return this.createReqRepStream();
|
|
279
313
|
}
|
|
280
314
|
createDataserverStream() {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
315
|
+
// Named now: the stream can outlive the options, which destroy() clears.
|
|
316
|
+
const { resourceName } = this.options;
|
|
317
|
+
const onMessage = (message) => { };
|
|
318
|
+
const onError = (error) => logger.error(withErrorCode(`${resourceName} stream failed`, error), error);
|
|
319
|
+
return this.connect.stream(resourceName, onMessage, onError, this.dataserverOnlyParams);
|
|
286
320
|
}
|
|
287
321
|
createReqRepStream() {
|
|
288
322
|
this.commitResponseUnsubscribe = this.connectEvents.addCommitResponseListener((event) => {
|
|
@@ -319,9 +353,13 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
319
353
|
fetchAndApplyMetadata(resourceName) {
|
|
320
354
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
355
|
var _a, _b, _c, _d;
|
|
356
|
+
const generation = this.generation;
|
|
322
357
|
try {
|
|
323
|
-
logger.debug(`Requesting metadata for ${
|
|
324
|
-
const meta = yield this.connect.getMetadata(
|
|
358
|
+
logger.debug(`Requesting metadata for ${resourceName} Datasource`);
|
|
359
|
+
const meta = yield this.connect.getMetadata(resourceName);
|
|
360
|
+
// Superseded while the request was out: the metadata is no longer this datasource's.
|
|
361
|
+
if (generation !== this.generation)
|
|
362
|
+
return;
|
|
325
363
|
if (meta) {
|
|
326
364
|
this.availableIndexes = (_a = meta.INDEXES) !== null && _a !== void 0 ? _a : [];
|
|
327
365
|
this.availableSortableFields = (_b = meta.SORTABLE_FIELDS) !== null && _b !== void 0 ? _b : [];
|
|
@@ -340,6 +378,12 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
340
378
|
});
|
|
341
379
|
}
|
|
342
380
|
catch (e) {
|
|
381
|
+
// Nor is a failure: the request may have failed only because of the teardown (its socket
|
|
382
|
+
// closing on a reconnect, say).
|
|
383
|
+
if (generation !== this.generation) {
|
|
384
|
+
logger.debug(`Metadata Fetch for ${resourceName} failed after it was superseded:`, e);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
343
387
|
logger.error(withErrorCode(`Metadata Fetch failed for ${resourceName}:`, e), e);
|
|
344
388
|
this.status = this.normaliseStatus({
|
|
345
389
|
isInitialized: false,
|
|
@@ -382,6 +426,15 @@ let DefaultDatasource = class DefaultDatasource {
|
|
|
382
426
|
invalidateCache() {
|
|
383
427
|
this._allParams = null;
|
|
384
428
|
}
|
|
429
|
+
// What an init() that a later init() or destroy() interrupted resolves with: the result of the
|
|
430
|
+
// init() that has the datasource now, or false when destroy() came last, even after a later
|
|
431
|
+
// init() finished. A grid restarting destroys and initialises again straight away, and its
|
|
432
|
+
// first init() still waits on the server.
|
|
433
|
+
interruptedInit(resourceName) {
|
|
434
|
+
logger.debug(`${resourceName} datasource initialisation was superseded`);
|
|
435
|
+
const latest = this.latestInit;
|
|
436
|
+
return latest && latest.generation === this.generation ? latest.result : false;
|
|
437
|
+
}
|
|
385
438
|
};
|
|
386
439
|
__decorate([
|
|
387
440
|
observable
|
|
@@ -7053,7 +7053,7 @@
|
|
|
7053
7053
|
{
|
|
7054
7054
|
"kind": "MethodSignature",
|
|
7055
7055
|
"canonicalReference": "@genesislcap/foundation-comms!Datasource#init:member(1)",
|
|
7056
|
-
"docComment": "/**\n * Initializes the datasource with the given options and fetches metadata if specified.\n *\n * @param options - The options to initialize the datasource with.\n *\n * @param fetchMeta - Optional flag to fetch metadata for the datasource. Defaults to true.\n *\n * @param startStream - Optional flag to start the data stream. Defaults to true.\n *\n * @returns A promise that resolves with a boolean indicating whether the initialization was successful.\n *\n * @public\n */\n",
|
|
7056
|
+
"docComment": "/**\n * Initializes the datasource with the given options and fetches metadata if specified.\n *\n * @param options - The options to initialize the datasource with.\n *\n * @param fetchMeta - Optional flag to fetch metadata for the datasource. Defaults to true.\n *\n * @param startStream - Optional flag to start the data stream. Defaults to true.\n *\n * @returns A promise that resolves with a boolean indicating whether the initialization was successful. When another `init()` or `destroy()` is called before it finishes, it sends nothing more and resolves with the result of the latest `init()`, or false when `destroy()` was called last, even if one of its requests then fails.\n *\n * @public\n */\n",
|
|
7057
7057
|
"excerptTokens": [
|
|
7058
7058
|
{
|
|
7059
7059
|
"kind": "Content",
|
|
@@ -1217,6 +1217,8 @@ export declare interface Datasource extends DatasourceMetadata {
|
|
|
1217
1217
|
* @param fetchMeta - Optional flag to fetch metadata for the datasource. Defaults to true.
|
|
1218
1218
|
* @param startStream - Optional flag to start the data stream. Defaults to true.
|
|
1219
1219
|
* @returns A promise that resolves with a boolean indicating whether the initialization was successful.
|
|
1220
|
+
* When another `init()` or `destroy()` is called before it finishes, it sends nothing more and resolves with the
|
|
1221
|
+
* result of the latest `init()`, or false when `destroy()` was called last, even if one of its requests then fails.
|
|
1220
1222
|
*/
|
|
1221
1223
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
1222
1224
|
/**
|
|
@@ -2299,6 +2301,8 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2299
2301
|
resourceType: ResourceType;
|
|
2300
2302
|
stream: SocketObservable<FilteredDataServerResult | RequestServerResult>;
|
|
2301
2303
|
private _allParams;
|
|
2304
|
+
private generation;
|
|
2305
|
+
private latestInit?;
|
|
2302
2306
|
constructor(connect: Connect, auth: Auth, resources: GenesisResources, config: DatasourceConfig, connectEvents: ConnectEvents);
|
|
2303
2307
|
private pollTrigger$;
|
|
2304
2308
|
private commitResponseUnsubscribe?;
|
|
@@ -2308,6 +2312,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2308
2312
|
*/
|
|
2309
2313
|
validResourceName(resourceName: string): boolean;
|
|
2310
2314
|
init(options: DatasourceOptions, fetchMeta?: boolean, startStream?: boolean): Promise<boolean>;
|
|
2315
|
+
private initialise;
|
|
2311
2316
|
startStream(): Promise<void>;
|
|
2312
2317
|
/** {@inheritDoc Datasource.destroy} */
|
|
2313
2318
|
destroy(): void;
|
|
@@ -2348,6 +2353,7 @@ export declare class DefaultDatasource implements Datasource {
|
|
|
2348
2353
|
*/
|
|
2349
2354
|
protected normaliseStatus(status: Partial<DatasourceStatus>): DatasourceStatus;
|
|
2350
2355
|
private invalidateCache;
|
|
2356
|
+
private interruptedInit;
|
|
2351
2357
|
}
|
|
2352
2358
|
|
|
2353
2359
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-comms",
|
|
3
3
|
"description": "Genesis Foundation UI Comms",
|
|
4
|
-
"version": "15.84.
|
|
4
|
+
"version": "15.84.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@genesislcap/foundation-testing": "15.84.
|
|
79
|
-
"@genesislcap/genx": "15.84.
|
|
80
|
-
"@genesislcap/ts-builder": "15.84.
|
|
81
|
-
"@genesislcap/uvu-playwright-builder": "15.84.
|
|
82
|
-
"@genesislcap/vite-builder": "15.84.
|
|
83
|
-
"@genesislcap/webpack-builder": "15.84.
|
|
78
|
+
"@genesislcap/foundation-testing": "15.84.1",
|
|
79
|
+
"@genesislcap/genx": "15.84.1",
|
|
80
|
+
"@genesislcap/ts-builder": "15.84.1",
|
|
81
|
+
"@genesislcap/uvu-playwright-builder": "15.84.1",
|
|
82
|
+
"@genesislcap/vite-builder": "15.84.1",
|
|
83
|
+
"@genesislcap/webpack-builder": "15.84.1",
|
|
84
84
|
"@types/js-cookie": "^3.0.2",
|
|
85
85
|
"@types/json-schema": "^7.0.11",
|
|
86
86
|
"@types/webappsec-credential-management": "^0.6.2",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"sinon": "^17.0.1"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@genesislcap/foundation-broadcast-channel": "15.84.
|
|
92
|
-
"@genesislcap/foundation-logger": "15.84.
|
|
93
|
-
"@genesislcap/foundation-user": "15.84.
|
|
94
|
-
"@genesislcap/foundation-utils": "15.84.
|
|
95
|
-
"@genesislcap/web-core": "15.84.
|
|
91
|
+
"@genesislcap/foundation-broadcast-channel": "15.84.1",
|
|
92
|
+
"@genesislcap/foundation-logger": "15.84.1",
|
|
93
|
+
"@genesislcap/foundation-user": "15.84.1",
|
|
94
|
+
"@genesislcap/foundation-utils": "15.84.1",
|
|
95
|
+
"@genesislcap/web-core": "15.84.1",
|
|
96
96
|
"@microsoft/fast-element": "1.14.0",
|
|
97
97
|
"@microsoft/fast-foundation": "2.50.0",
|
|
98
98
|
"bowser": "^2.11.0",
|