@memberjunction/core 6.2.2 → 6.3.0-edge.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/generic/JSONType-interfaces/IEntityConfiguration.d.ts +94 -0
- package/dist/generic/JSONType-interfaces/IEntityConfiguration.d.ts.map +1 -1
- package/dist/generic/JSONType-interfaces/IEntitySubtypeSelectorConfig.d.ts +77 -4
- package/dist/generic/JSONType-interfaces/IEntitySubtypeSelectorConfig.d.ts.map +1 -1
- package/dist/generic/appCapabilityRegistry.d.ts +106 -0
- package/dist/generic/appCapabilityRegistry.d.ts.map +1 -0
- package/dist/generic/appCapabilityRegistry.js +212 -0
- package/dist/generic/appCapabilityRegistry.js.map +1 -0
- package/dist/generic/baseEngine.d.ts +108 -3
- package/dist/generic/baseEngine.d.ts.map +1 -1
- package/dist/generic/baseEngine.js +891 -122
- package/dist/generic/baseEngine.js.map +1 -1
- package/dist/generic/baseEngineRegistry.d.ts +8 -0
- package/dist/generic/baseEngineRegistry.d.ts.map +1 -1
- package/dist/generic/baseEngineRegistry.js +36 -11
- package/dist/generic/baseEngineRegistry.js.map +1 -1
- package/dist/generic/baseEntity.d.ts +155 -3
- package/dist/generic/baseEntity.d.ts.map +1 -1
- package/dist/generic/baseEntity.js +1146 -74
- package/dist/generic/baseEntity.js.map +1 -1
- package/dist/generic/baseRemotableOperation.d.ts +32 -0
- package/dist/generic/baseRemotableOperation.d.ts.map +1 -1
- package/dist/generic/baseRemotableOperation.js +29 -0
- package/dist/generic/baseRemotableOperation.js.map +1 -1
- package/dist/generic/compositeKey.d.ts.map +1 -1
- package/dist/generic/compositeKey.js +3 -1
- package/dist/generic/compositeKey.js.map +1 -1
- package/dist/generic/constraintErrorRedaction.d.ts +26 -0
- package/dist/generic/constraintErrorRedaction.d.ts.map +1 -0
- package/dist/generic/constraintErrorRedaction.js +166 -0
- package/dist/generic/constraintErrorRedaction.js.map +1 -0
- package/dist/generic/crossEntityPolicyEngine.d.ts +172 -0
- package/dist/generic/crossEntityPolicyEngine.d.ts.map +1 -0
- package/dist/generic/crossEntityPolicyEngine.js +667 -0
- package/dist/generic/crossEntityPolicyEngine.js.map +1 -0
- package/dist/generic/dataHooks.d.ts +41 -4
- package/dist/generic/dataHooks.d.ts.map +1 -1
- package/dist/generic/dataHooks.js +82 -0
- package/dist/generic/dataHooks.js.map +1 -1
- package/dist/generic/databaseProviderBase.d.ts +96 -1
- package/dist/generic/databaseProviderBase.d.ts.map +1 -1
- package/dist/generic/databaseProviderBase.js +414 -44
- package/dist/generic/databaseProviderBase.js.map +1 -1
- package/dist/generic/documentNumberingEngine.d.ts +190 -0
- package/dist/generic/documentNumberingEngine.d.ts.map +1 -0
- package/dist/generic/documentNumberingEngine.js +739 -0
- package/dist/generic/documentNumberingEngine.js.map +1 -0
- package/dist/generic/entityInfo.d.ts +152 -8
- package/dist/generic/entityInfo.d.ts.map +1 -1
- package/dist/generic/entityInfo.js +507 -71
- package/dist/generic/entityInfo.js.map +1 -1
- package/dist/generic/entityLifecyclePolicy.d.ts +214 -0
- package/dist/generic/entityLifecyclePolicy.d.ts.map +1 -0
- package/dist/generic/entityLifecyclePolicy.js +708 -0
- package/dist/generic/entityLifecyclePolicy.js.map +1 -0
- package/dist/generic/entitySavePlan.d.ts +6 -0
- package/dist/generic/entitySavePlan.d.ts.map +1 -1
- package/dist/generic/entitySavePlan.js +145 -1
- package/dist/generic/entitySavePlan.js.map +1 -1
- package/dist/generic/entitySubtypeDriver.d.ts +49 -0
- package/dist/generic/entitySubtypeDriver.d.ts.map +1 -0
- package/dist/generic/entitySubtypeDriver.js +26 -0
- package/dist/generic/entitySubtypeDriver.js.map +1 -0
- package/dist/generic/fieldSecuritySQLGate.d.ts +17 -0
- package/dist/generic/fieldSecuritySQLGate.d.ts.map +1 -1
- package/dist/generic/fieldSecuritySQLGate.js +41 -1
- package/dist/generic/fieldSecuritySQLGate.js.map +1 -1
- package/dist/generic/filters/compositeFilter.d.ts +5 -1
- package/dist/generic/filters/compositeFilter.d.ts.map +1 -1
- package/dist/generic/filters/compositeFilter.js +127 -12
- package/dist/generic/filters/compositeFilter.js.map +1 -1
- package/dist/generic/filters/compositeFilterSQL.d.ts +121 -0
- package/dist/generic/filters/compositeFilterSQL.d.ts.map +1 -0
- package/dist/generic/filters/compositeFilterSQL.js +489 -0
- package/dist/generic/filters/compositeFilterSQL.js.map +1 -0
- package/dist/generic/filters/filter.types.d.ts +5 -2
- package/dist/generic/filters/filter.types.d.ts.map +1 -1
- package/dist/generic/filters/filter.types.js +4 -1
- package/dist/generic/filters/filter.types.js.map +1 -1
- package/dist/generic/filters/filterBuilder.d.ts +75 -0
- package/dist/generic/filters/filterBuilder.d.ts.map +1 -0
- package/dist/generic/filters/filterBuilder.js +104 -0
- package/dist/generic/filters/filterBuilder.js.map +1 -0
- package/dist/generic/filters/index.d.ts +2 -0
- package/dist/generic/filters/index.d.ts.map +1 -1
- package/dist/generic/filters/index.js +2 -0
- package/dist/generic/filters/index.js.map +1 -1
- package/dist/generic/interfaces.d.ts +125 -19
- package/dist/generic/interfaces.d.ts.map +1 -1
- package/dist/generic/interfaces.js +9 -10
- package/dist/generic/interfaces.js.map +1 -1
- package/dist/generic/localCacheManager.d.ts +54 -14
- package/dist/generic/localCacheManager.d.ts.map +1 -1
- package/dist/generic/localCacheManager.js +450 -106
- package/dist/generic/localCacheManager.js.map +1 -1
- package/dist/generic/metadata.d.ts +7 -5
- package/dist/generic/metadata.d.ts.map +1 -1
- package/dist/generic/metadata.js +29 -10
- package/dist/generic/metadata.js.map +1 -1
- package/dist/generic/providerBase.d.ts +405 -45
- package/dist/generic/providerBase.d.ts.map +1 -1
- package/dist/generic/providerBase.js +1107 -200
- package/dist/generic/providerBase.js.map +1 -1
- package/dist/generic/queryInfo.d.ts +5 -0
- package/dist/generic/queryInfo.d.ts.map +1 -1
- package/dist/generic/queryInfo.js +5 -0
- package/dist/generic/queryInfo.js.map +1 -1
- package/dist/generic/queryInfoInterfaces.d.ts +5 -0
- package/dist/generic/queryInfoInterfaces.d.ts.map +1 -1
- package/dist/generic/queryResultEnricher.d.ts +4 -1
- package/dist/generic/queryResultEnricher.d.ts.map +1 -1
- package/dist/generic/queryResultEnricher.js.map +1 -1
- package/dist/generic/queryTemplateContext.d.ts.map +1 -1
- package/dist/generic/queryTemplateContext.js +38 -3
- package/dist/generic/queryTemplateContext.js.map +1 -1
- package/dist/generic/relatedRecordCollection.d.ts +20 -0
- package/dist/generic/relatedRecordCollection.d.ts.map +1 -1
- package/dist/generic/relatedRecordCollection.js +257 -22
- package/dist/generic/relatedRecordCollection.js.map +1 -1
- package/dist/generic/remoteOperationDispatch.d.ts.map +1 -1
- package/dist/generic/remoteOperationDispatch.js +13 -1
- package/dist/generic/remoteOperationDispatch.js.map +1 -1
- package/dist/generic/saveEntityGraphOperation.d.ts +6 -0
- package/dist/generic/saveEntityGraphOperation.d.ts.map +1 -1
- package/dist/generic/saveEntityGraphOperation.js +8 -0
- package/dist/generic/saveEntityGraphOperation.js.map +1 -1
- package/dist/generic/securityInfo.d.ts +49 -2
- package/dist/generic/securityInfo.d.ts.map +1 -1
- package/dist/generic/securityInfo.js +139 -12
- package/dist/generic/securityInfo.js.map +1 -1
- package/dist/generic/telemetryManager.d.ts +40 -4
- package/dist/generic/telemetryManager.d.ts.map +1 -1
- package/dist/generic/telemetryManager.js +68 -15
- package/dist/generic/telemetryManager.js.map +1 -1
- package/dist/generic/transactionGroup.d.ts +66 -23
- package/dist/generic/transactionGroup.d.ts.map +1 -1
- package/dist/generic/transactionGroup.js +225 -57
- package/dist/generic/transactionGroup.js.map +1 -1
- package/dist/generic/util.d.ts.map +1 -1
- package/dist/generic/util.js +9 -3
- package/dist/generic/util.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/views/runView.d.ts +61 -0
- package/dist/views/runView.d.ts.map +1 -1
- package/dist/views/runView.js +154 -3
- package/dist/views/runView.js.map +1 -1
- package/package.json +3 -3
- package/readme.md +6 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEntity, BaseEntityEvent } from "./baseEntity.js";
|
|
2
2
|
import { EntityDependency, EntityDocumentTypeInfo, EntityInfo, RecordDependency, RecordMergeRequest, RecordMergeResult } from "./entityInfo.js";
|
|
3
|
-
import { IMetadataProvider, MetadataSweepResult, ProviderConfigDataBase, MetadataInfo, ILocalStorageProvider, IFileSystemProvider, DatasetResultType, DatasetStatusResultType, DatasetItemFilterType, EntityRecordNameInput, EntityRecordNameResult, ProviderType, PotentialDuplicateRequest, PotentialDuplicateResponse, EntityMergeOptions, GetRecordDependenciesOptions, AllMetadata, IRunViewProvider, RunViewResult, IRunQueryProvider, RunQueryResult, RunViewWithCacheCheckParams, FullTextSearchParams, FullTextSearchResult, SearchEntityParams, EntitySearchResult, IRemoteOperationProvider, RemoteOpInvokeOptions, RemoteOpResult } from "./interfaces.js";
|
|
3
|
+
import { IMetadataProvider, MetadataSweepResult, ProviderConfigDataBase, MetadataInfo, ILocalStorageProvider, IFileSystemProvider, DatasetResultType, DatasetStatusResultType, DatasetItemFilterType, EntityRecordNameInput, EntityRecordNameResult, ProviderType, PotentialDuplicateRequest, PotentialDuplicateResponse, EntityMergeOptions, GetEntityObjectOptions, GetRecordDependenciesOptions, AllMetadata, IRunViewProvider, RunViewResult, IRunQueryProvider, RunQueryResult, RunViewWithCacheCheckParams, FullTextSearchParams, FullTextSearchResult, SearchEntityParams, EntitySearchResult, IRemoteOperationProvider, RemoteOpInvokeOptions, RemoteOpResult } from "./interfaces.js";
|
|
4
4
|
import { ScoredCandidate } from "./scoring/ReciprocalRankFusion.js";
|
|
5
5
|
import { RunQueryParams } from "./runQuery.js";
|
|
6
6
|
import { CachedRunViewResult } from "./localCacheManager.js";
|
|
@@ -137,6 +137,7 @@ export type EntityMetadataRow = BaseMetadataRow & {
|
|
|
137
137
|
EntitySettings?: unknown[];
|
|
138
138
|
EntityOrganicKeys?: unknown[];
|
|
139
139
|
EntityAlternateBaseViews?: unknown[];
|
|
140
|
+
EntityUniqueKeys?: unknown[];
|
|
140
141
|
};
|
|
141
142
|
export type EntityFieldMetadataRow = BaseMetadataRow & {
|
|
142
143
|
ID: string;
|
|
@@ -164,6 +165,26 @@ export type OrganicKeyMetadataRow = BaseMetadataRow & {
|
|
|
164
165
|
export type OrganicKeyRelatedEntityMetadataRow = BaseMetadataRow & {
|
|
165
166
|
EntityOrganicKeyID: string;
|
|
166
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Options controlling mutability vs. frozen-reference preservation in {@link ProjectRowsToFields}.
|
|
170
|
+
*/
|
|
171
|
+
export interface ProjectRowsToFieldsOptions {
|
|
172
|
+
/**
|
|
173
|
+
* When `true`, callers that treat returned rows as read-only (e.g. server GraphQL wire
|
|
174
|
+
* serialization) allow frozen cached inputs (including L1 CoW cached arrays) to be returned
|
|
175
|
+
* untouched when `requestedFields` covers 100% of row keys, and allow subset projections of
|
|
176
|
+
* frozen rows to be memoized as frozen objects so downstream serialization caches
|
|
177
|
+
* (`FrozenRowSerializationCache`) stay warm. Defaults to `false` so direct callers receive
|
|
178
|
+
* mutable unfrozen copies.
|
|
179
|
+
*/
|
|
180
|
+
PreserveFrozen?: boolean;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Produces a canonical, order- and case-insensitive key for a requested `Fields` list, suitable
|
|
184
|
+
* for keying memoized row projections and wire-serialization caches. Returns `''` when no field
|
|
185
|
+
* list is provided.
|
|
186
|
+
*/
|
|
187
|
+
export declare function CanonicalFieldsKey(fields: string[] | null | undefined): string;
|
|
167
188
|
/**
|
|
168
189
|
* Projects plain-object rows down to a caller-requested field subset, matching
|
|
169
190
|
* field names case-insensitively (and ignoring surrounding whitespace).
|
|
@@ -180,8 +201,26 @@ export type OrganicKeyRelatedEntityMetadataRow = BaseMetadataRow & {
|
|
|
180
201
|
*
|
|
181
202
|
* @param rows - Plain-object result rows (NOT BaseEntity objects)
|
|
182
203
|
* @param requestedFields - The caller's original Fields list, or null for "all fields"
|
|
204
|
+
* @param options - Optional mutability/freeze preservation controls
|
|
183
205
|
*/
|
|
184
|
-
export declare function ProjectRowsToFields<T = Record<string, unknown>>(rows: T[], requestedFields: string[] | null | undefined): T[];
|
|
206
|
+
export declare function ProjectRowsToFields<T = Record<string, unknown>>(rows: T[], requestedFields: string[] | null | undefined, options?: ProjectRowsToFieldsOptions): T[];
|
|
207
|
+
/**
|
|
208
|
+
* What a metadata refresh must reload, as {@link ProviderBase.MetadataRefreshScope} decides it from
|
|
209
|
+
* the local and remote timestamps: nothing, the saved-query family (`Codes`), or everything (with
|
|
210
|
+
* the `Reason`, for the log).
|
|
211
|
+
*/
|
|
212
|
+
export type MetadataRefreshScopeResult =
|
|
213
|
+
/** Nothing to reload. `AnyItemMoved`: some item's timestamp did move, but none the build reads. */
|
|
214
|
+
{
|
|
215
|
+
Kind: 'none';
|
|
216
|
+
AnyItemMoved: boolean;
|
|
217
|
+
} | {
|
|
218
|
+
Kind: 'scoped';
|
|
219
|
+
Codes: ReadonlyArray<string>;
|
|
220
|
+
} | {
|
|
221
|
+
Kind: 'full';
|
|
222
|
+
Reason: string;
|
|
223
|
+
};
|
|
185
224
|
/**
|
|
186
225
|
* Base class for all metadata providers in MemberJunction.
|
|
187
226
|
* Implements common functionality for metadata caching, refresh, and dataset management.
|
|
@@ -237,6 +276,14 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
237
276
|
* acts on its answer. Held as the promise (not a flag) so only its owner clears it.
|
|
238
277
|
*/
|
|
239
278
|
private _refreshCheckInFlight;
|
|
279
|
+
/**
|
|
280
|
+
* The remote timestamps stored by the last refresh check whose status read succeeded; null after
|
|
281
|
+
* a check whose read failed. {@link RefreshIfNeeded} reuses the stored remote timestamps for its
|
|
282
|
+
* scoped reload only while they are this array, so a check whose read failed is followed by a
|
|
283
|
+
* fresh read. This prefers fresher stamps; it is not needed for correctness, because any stored
|
|
284
|
+
* stamps were read before the scoped dataset read starts.
|
|
285
|
+
*/
|
|
286
|
+
private _checkedRemoteMetadataTimestamps;
|
|
240
287
|
/**
|
|
241
288
|
* Set when Config() adopts a snapshot it loaded from the server (which fetched the current user
|
|
242
289
|
* with it); consumed by the next {@link preValidateAndRefresh}, which then has nothing to check.
|
|
@@ -277,14 +324,27 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
277
324
|
* all engines that fire in the same tick, without adding perceptible delay.
|
|
278
325
|
*/
|
|
279
326
|
static CoalesceWindowMs: number;
|
|
327
|
+
/**
|
|
328
|
+
* Controls whether `RunViews` coalescing drains via microtasks (`queueMicrotask`) instead
|
|
329
|
+
* of a wall-clock `setTimeout(..., CoalesceWindowMs)` timer when `CoalesceWindowMs > 0`.
|
|
330
|
+
*
|
|
331
|
+
* When `true` (default), concurrent calls in the same synchronous turn or immediate
|
|
332
|
+
* `Promise` / `BaseEngine.Load` microtask hops coalesce into one mega-batch and flush as
|
|
333
|
+
* soon as the microtask queue stabilizes (bounded at 8 hops), eliminating the 10–16ms timer
|
|
334
|
+
* floor (and ~1,000ms background-tab timer throttling) on isolated queries. Set to `false`
|
|
335
|
+
* to use the fixed `setTimeout(..., CoalesceWindowMs)` timer window.
|
|
336
|
+
*/
|
|
337
|
+
static CoalesceUseMicrotask: boolean;
|
|
280
338
|
/**
|
|
281
339
|
* Pending coalesced requests waiting to be flushed.
|
|
282
340
|
* Each entry tracks the original params, contextUser, and a resolver
|
|
283
341
|
* so the caller's promise resolves with only their slice of results.
|
|
284
342
|
*/
|
|
285
343
|
private _coalesceQueue;
|
|
286
|
-
/** Timer handle for the coalesce flush */
|
|
344
|
+
/** Timer handle for the coalesce flush (when `CoalesceUseMicrotask === false`) */
|
|
287
345
|
private _coalesceTimer;
|
|
346
|
+
/** True while a microtask-drain coalesce flush is scheduled */
|
|
347
|
+
private _coalesceMicrotaskScheduled;
|
|
288
348
|
/**
|
|
289
349
|
* How long (ms) a resolved RunViews result stays available for instant
|
|
290
350
|
* replay. Set to 0 to disable the linger window (in-flight dedup
|
|
@@ -364,7 +424,20 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
364
424
|
* data; the original caller still gets its own result, and the orphaned promise's stash
|
|
365
425
|
* step no-ops safely.
|
|
366
426
|
*/
|
|
367
|
-
private
|
|
427
|
+
private _invalidationTargetRef;
|
|
428
|
+
/**
|
|
429
|
+
* Number of live/uncollected `ProviderBase` instances currently registered for in-flight
|
|
430
|
+
* view invalidation callbacks.
|
|
431
|
+
*/
|
|
432
|
+
static get ActiveInvalidationTargetCount(): number;
|
|
433
|
+
/**
|
|
434
|
+
* Immediately removes this provider instance from the global in-flight invalidation target set
|
|
435
|
+
* and clears per-instance mutation state. Call on short-lived per-request server providers
|
|
436
|
+
* when the HTTP response closes so `_invalidationTargets` does not accumulate thousands of
|
|
437
|
+
* `WeakRef`s between major garbage collections.
|
|
438
|
+
*/
|
|
439
|
+
DetachInvalidationListeners(): void;
|
|
440
|
+
protected ensureInflightViewInvalidation(): void;
|
|
368
441
|
/**
|
|
369
442
|
* Per-entity monotonic mutation counter incremented whenever an entity receives a
|
|
370
443
|
* BaseEntity save/delete/remote-invalidate or an explicit {@link InvalidateRunViewDedupCache}
|
|
@@ -439,11 +512,12 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
439
512
|
*/
|
|
440
513
|
private _metadataReadsJoinTransaction;
|
|
441
514
|
/**
|
|
442
|
-
* The MJ_Metadata dataset items (code + entity name + row count) as of the last load
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
515
|
+
* The MJ_Metadata dataset items (code + entity name + row count) as of the last load, or as
|
|
516
|
+
* stored beside the snapshot a warm boot restored. The remote timestamps
|
|
517
|
+
* ({@link GetLatestMetadataUpdates}) are keyed by entity name while a dataset read is scoped by
|
|
518
|
+
* item code, so this is the bridge that lets a staleness check be turned into a scoped reload
|
|
519
|
+
* (see {@link MetadataRefreshScope}) and lets {@link adoptServerMetadata} verify that the
|
|
520
|
+
* received dataset items' row counts match `_latestRemoteMetadataTimestamps`.
|
|
447
521
|
*/
|
|
448
522
|
private _metadataDatasetItems;
|
|
449
523
|
/**
|
|
@@ -464,9 +538,34 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
464
538
|
*/
|
|
465
539
|
static get PartialRefreshMetadataItemCodes(): ReadonlyArray<string>;
|
|
466
540
|
private static readonly _queryFamilyItemCodes;
|
|
541
|
+
/**
|
|
542
|
+
* MJ_Metadata item codes that {@link GetAllMetadata} reads to build the metadata: every
|
|
543
|
+
* {@link AllMetadataArrays} item, plus the items it folds into entities and applications. The
|
|
544
|
+
* shipped dataset also carries items the build never reads (`Dashboards`,
|
|
545
|
+
* `Dashboard_Categories`); a change to one of those cannot change the built metadata, so it
|
|
546
|
+
* needs no reload (see {@link MetadataRefreshScope}).
|
|
547
|
+
*/
|
|
548
|
+
static get MetadataBuildItemCodes(): ReadonlySet<string>;
|
|
549
|
+
/** The items {@link GetAllMetadata} folds into entities (PostProcessEntityMetadata) and applications. */
|
|
550
|
+
private static readonly _metadataFoldedItemCodes;
|
|
551
|
+
private static readonly _metadataBuildItemCodes;
|
|
552
|
+
/**
|
|
553
|
+
* Delays, in milliseconds, before each retry of a metadata refresh that failed; the last one
|
|
554
|
+
* repeats. A failed timestamp read, a failed scoped reload and a failed full reload all keep
|
|
555
|
+
* the metadata already loaded and try again later. None of them escalates to a full reload:
|
|
556
|
+
* that is the most expensive read the provider makes, and these failures come when the server
|
|
557
|
+
* is busiest (an exhausted connection pool, a timed-out status query).
|
|
558
|
+
*/
|
|
559
|
+
static MetadataRefreshRetryDelaysMs: ReadonlyArray<number>;
|
|
560
|
+
/** Failed scoped reloads in a row before the full reload is used instead. */
|
|
561
|
+
static MetadataScopedReloadAttempts: number;
|
|
562
|
+
/** Failed refresh attempts in a row; picks the next delay from {@link MetadataRefreshRetryDelaysMs}. */
|
|
563
|
+
private _metadataRefreshRetries;
|
|
564
|
+
/** Failed scoped reloads in a row; see {@link MetadataScopedReloadAttempts}. */
|
|
565
|
+
private _metadataScopedReloadFailures;
|
|
467
566
|
/** The synthetic roll-up row {@link GetLatestMetadataUpdates} appends to the per-entity timestamps. */
|
|
468
567
|
private static readonly _allMetadataTypeName;
|
|
469
|
-
/** Debounce timer for {@link scheduleMetadataMemberRefresh}. */
|
|
568
|
+
/** Debounce timer for {@link scheduleMetadataMemberRefresh}, and for {@link scheduleMetadataRefreshRetry}. */
|
|
470
569
|
private _metadataMemberRefreshTimer;
|
|
471
570
|
/**
|
|
472
571
|
* Records which entities compose this provider's metadata, from the loaded MJ_Metadata
|
|
@@ -475,6 +574,52 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
475
574
|
* successful load, so the set tracks the dataset definition as it changes.
|
|
476
575
|
*/
|
|
477
576
|
protected registerMetadataDatasetMembership(dataset: DatasetResultType): void;
|
|
577
|
+
/**
|
|
578
|
+
* The MJ_Metadata item codes that hold the saved-query metadata: the saved-query family (see
|
|
579
|
+
* {@link PartialRefreshMetadataItemCodes}) and the SQL dialects. They are read only when the
|
|
580
|
+
* provider is configured with {@link ProviderConfigDataBase.LoadQueryMetadata}.
|
|
581
|
+
*/
|
|
582
|
+
static get QueryMetadataItemCodes(): ReadonlyArray<string>;
|
|
583
|
+
/**
|
|
584
|
+
* Whether this provider loads the saved-query metadata into its metadata object (see
|
|
585
|
+
* {@link ProviderConfigDataBase.LoadQueryMetadata}). False unless the configuration says true.
|
|
586
|
+
* A provider that adopted the global provider's metadata reports the global provider's
|
|
587
|
+
* setting instead, since that is what decided whether the adopted metadata holds queries.
|
|
588
|
+
*/
|
|
589
|
+
get LoadsQueryMetadata(): boolean;
|
|
590
|
+
/**
|
|
591
|
+
* The global provider's {@link LoadsQueryMetadata}, recorded when this provider adopts its
|
|
592
|
+
* metadata; undefined while this provider's metadata is its own.
|
|
593
|
+
*/
|
|
594
|
+
private _adoptedLoadsQueryMetadata;
|
|
595
|
+
/**
|
|
596
|
+
* The item filters every read of the MJ_Metadata dataset uses — the data, its status, and the
|
|
597
|
+
* local dataset cache — so all of them describe the same row set. Null when every item is read.
|
|
598
|
+
* Otherwise each item this provider does not load gets a `1=0` filter: the server runs no SQL
|
|
599
|
+
* for it, and its status is constant, so writes to it never make the metadata look stale.
|
|
600
|
+
*/
|
|
601
|
+
protected get MetadataDatasetItemFilters(): DatasetItemFilterType[] | null;
|
|
602
|
+
/**
|
|
603
|
+
* The MJ_Metadata item codes THIS provider builds its metadata from: {@link MetadataBuildItemCodes}
|
|
604
|
+
* without the items it does not read (see {@link MetadataDatasetItemFilters}). A change only to
|
|
605
|
+
* the others needs no reload, as for any item the build never reads.
|
|
606
|
+
*/
|
|
607
|
+
protected get BuiltMetadataItemCodes(): ReadonlySet<string>;
|
|
608
|
+
/**
|
|
609
|
+
* Empties the query-metadata arrays of `metadata` when this provider does not load them. A stored
|
|
610
|
+
* snapshot written by a process that did load them would otherwise hold those rows in memory for
|
|
611
|
+
* the life of this process, behind getters that return nothing.
|
|
612
|
+
*/
|
|
613
|
+
private dropUnloadedQueryMetadata;
|
|
614
|
+
/** Whether `code` is an MJ_Metadata item this provider does not read (see {@link MetadataDatasetItemFilters}). */
|
|
615
|
+
private isSkippedMetadataItem;
|
|
616
|
+
/**
|
|
617
|
+
* Lowercased names of the entities that back only items this provider does not read. A write to
|
|
618
|
+
* one of them cannot change this provider's metadata, so they are left out of the membership set
|
|
619
|
+
* — otherwise each such write would schedule a refresh that finds no timestamp moved and falls
|
|
620
|
+
* back to a full reload.
|
|
621
|
+
*/
|
|
622
|
+
private skippedMetadataEntityNames;
|
|
478
623
|
/**
|
|
479
624
|
* Result of {@link SweepMetadataAgainstDatabase}.
|
|
480
625
|
*/
|
|
@@ -628,14 +773,64 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
628
773
|
*/
|
|
629
774
|
private handlePeerMetadataNoticeRetry;
|
|
630
775
|
/**
|
|
631
|
-
* How this provider refreshes after a metadata member entity changed. The base behavior
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
776
|
+
* How this provider refreshes after a metadata member entity changed. The base behavior
|
|
777
|
+
* re-reads the authoritative timestamps once (the status query is read from the database
|
|
778
|
+
* every time, never from a cache layer) and reloads only what they show changed — see
|
|
779
|
+
* {@link MetadataRefreshScope}: nothing, the saved-query family (through
|
|
780
|
+
* {@link ReloadMetadata}, which reuses that read instead of reading the timestamps again), or
|
|
781
|
+
* everything (a hard {@link Refresh}, which bypasses every cache layer).
|
|
782
|
+
*
|
|
783
|
+
* The caller holds positive evidence that a member entity was written, so "no item moved" is
|
|
784
|
+
* NOT taken as "nothing changed" here: a write committed with a stamp older than the item's
|
|
785
|
+
* current max — on PostgreSQL `NOW()` is the transaction start, so any in-place edit inside a
|
|
786
|
+
* transaction that outlived a peer's later write; on SQL Server the statement-to-commit
|
|
787
|
+
* window — leaves both the max stamp and the row count where they were. Only a change the
|
|
788
|
+
* timestamps positively attribute to items the metadata build never reads (`Dashboards`) is
|
|
789
|
+
* answered without a reload. The same rule governs the follow-up pass that a write arriving
|
|
790
|
+
* mid-reload queues (see `_metadataWriteEventPending`).
|
|
791
|
+
*
|
|
792
|
+
* A timestamp read that fails while metadata is loaded is retried on
|
|
793
|
+
* {@link MetadataRefreshRetryDelaysMs}; it is not a reason for a full reload. With nothing
|
|
794
|
+
* loaded there is nothing to keep serving, so the full load runs. Transport providers
|
|
795
|
+
* (GraphQL) override this with a staleness check so a browser doesn't re-pull the full
|
|
796
|
+
* metadata graph for a change the server-side timestamp comparison can disconfirm.
|
|
637
797
|
*/
|
|
638
798
|
protected RefreshAfterMetadataMemberChange(): Promise<boolean>;
|
|
799
|
+
/**
|
|
800
|
+
* Set by a write-event refresh that found a reload in flight and queued a follow-up pass; that
|
|
801
|
+
* pass consumes it and applies {@link applyWriteEventRule}. Without it the follow-up would take
|
|
802
|
+
* "no item moved" as "nothing changed", and the writer could miss its own write.
|
|
803
|
+
*/
|
|
804
|
+
private _metadataWriteEventPending;
|
|
805
|
+
/**
|
|
806
|
+
* Set by an explicit full reload (a `Refresh()`) that found a reload in flight and queued a
|
|
807
|
+
* follow-up pass; that pass consumes it and runs in full, so the promise of a full reload holds.
|
|
808
|
+
*/
|
|
809
|
+
private _metadataFullReloadRequested;
|
|
810
|
+
/**
|
|
811
|
+
* The write-event rule: a refresh prompted by a member-entity write knows something changed, so
|
|
812
|
+
* a `none` scope in which no item moved at all becomes a full reload. A `none` in which only
|
|
813
|
+
* items the build never reads moved stands — the timestamps positively attribute the change.
|
|
814
|
+
*/
|
|
815
|
+
private static applyWriteEventRule;
|
|
816
|
+
/** True when this provider holds metadata it can keep serving while a refresh is retried. */
|
|
817
|
+
private get holdsMetadata();
|
|
818
|
+
/**
|
|
819
|
+
* Runs {@link RefreshAfterMetadataMemberChange} again after the next delay in
|
|
820
|
+
* {@link MetadataRefreshRetryDelaysMs}. The retry shares the member-change timer: a refresh
|
|
821
|
+
* that is already pending covers it, a new write re-arms it with the short debounce, and
|
|
822
|
+
* {@link CancelPendingMetadataMemberRefresh} cancels it. The timer does not keep a Node
|
|
823
|
+
* process alive.
|
|
824
|
+
*/
|
|
825
|
+
private scheduleMetadataRefreshRetry;
|
|
826
|
+
/**
|
|
827
|
+
* The timestamps show nothing the metadata build reads has changed: stamp the held snapshot
|
|
828
|
+
* with them, so the next check agrees. Only the in-memory stamp moves; re-saving the snapshot
|
|
829
|
+
* would serialize the whole graph for a change it does not contain.
|
|
830
|
+
*/
|
|
831
|
+
private markMetadataCurrent;
|
|
832
|
+
/** The metadata is current again: the next failure starts at the first retry delay. */
|
|
833
|
+
private resetMetadataRefreshFailures;
|
|
639
834
|
/**
|
|
640
835
|
* How many consecutive windows a member-change refresh may wait on
|
|
641
836
|
* {@link MetadataMemberRefreshMustWait} before it is dropped. At the default 500ms window
|
|
@@ -892,6 +1087,13 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
892
1087
|
* each caller receives only their slice of the results.
|
|
893
1088
|
*/
|
|
894
1089
|
private enqueueCoalescedRunViews;
|
|
1090
|
+
/**
|
|
1091
|
+
* Drains the coalesce queue via `queueMicrotask`. Yields a minimum of 6 microtask hops
|
|
1092
|
+
* (~4µs) so sibling `StartupManager` engines finishing their initial `ResolveContextUser`
|
|
1093
|
+
* and `PreRunViews` awaits reach the queue, and continues yielding (bounded at 16 hops)
|
|
1094
|
+
* while queue length is still growing; flushes immediately once queue growth settles.
|
|
1095
|
+
*/
|
|
1096
|
+
private scheduleMicrotaskCoalesceDrain;
|
|
895
1097
|
/**
|
|
896
1098
|
* Flushes the coalesce queue: merges all pending RunViews params into one
|
|
897
1099
|
* mega-batch, executes it, then splits results back to each original caller.
|
|
@@ -1207,7 +1409,10 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
1207
1409
|
* `resolvable` is true.
|
|
1208
1410
|
*
|
|
1209
1411
|
* The BASE implementation resolves from the metadata `Queries` cache and enforces the
|
|
1210
|
-
* ROLES-ONLY `QueryInfo.UserCanRun` — the strongest check available at this layer.
|
|
1412
|
+
* ROLES-ONLY `QueryInfo.UserCanRun` — the strongest check available at this layer. That cache
|
|
1413
|
+
* is loaded only when the provider is configured with `LoadQueryMetadata`; otherwise every
|
|
1414
|
+
* request is unresolvable here, so a provider that executes or caches saved queries overrides
|
|
1415
|
+
* this to resolve from `QueryEngine`.
|
|
1211
1416
|
* Providers with richer query metadata MUST override this to enforce the SAME authorization
|
|
1212
1417
|
* their miss path enforces (`GenericDatabaseProvider` overrides with
|
|
1213
1418
|
* `MJQueryEntityExtended.UserCanRun`, which adds entity CanRead + recursive composition
|
|
@@ -1281,6 +1486,11 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
1281
1486
|
* projection eligible to populate the Fields-agnostic cache slot in PostRunView.
|
|
1282
1487
|
*/
|
|
1283
1488
|
populateCache?: boolean;
|
|
1489
|
+
/**
|
|
1490
|
+
* The effective RunViewParams after PreRunView hooks (which may return a shallow-copied
|
|
1491
|
+
* replacement object) so RunView passes hook mutations to InternalRunView and PostRunView.
|
|
1492
|
+
*/
|
|
1493
|
+
effectiveParams?: RunViewParams;
|
|
1284
1494
|
};
|
|
1285
1495
|
/**
|
|
1286
1496
|
* Result from PreRunViews hook containing cache status for batch operations
|
|
@@ -1549,7 +1759,7 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
1549
1759
|
* The shared entry point for every clause slot a provider runs: RunView parameters, a saved
|
|
1550
1760
|
* view's stored clauses, dataset item filters, user-search text spliced as SQL.
|
|
1551
1761
|
*/
|
|
1552
|
-
protected AssertClausesRespectFieldSecurityForEntity(entity: EntityInfo, clauses: Iterable<unknown>, user: UserInfo): void;
|
|
1762
|
+
protected AssertClausesRespectFieldSecurityForEntity(entity: EntityInfo, clauses: Iterable<unknown>, user: UserInfo, parameterNames?: ReadonlySet<string>): void;
|
|
1553
1763
|
/**
|
|
1554
1764
|
* {@link AssertClausesRespectFieldSecurityForEntity} for ORDER BY fragments, which also refuses
|
|
1555
1765
|
* a sort by column position for a user denied a field on `entity`
|
|
@@ -2018,16 +2228,41 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2018
2228
|
* @param data - Configuration including schema filters and connection info
|
|
2019
2229
|
* @returns True if configuration was successful
|
|
2020
2230
|
*/
|
|
2231
|
+
/**
|
|
2232
|
+
* Synchronously configures this provider from an already-initialized global `Metadata.Provider`
|
|
2233
|
+
* without allocating promises or awaiting async cache initialization. Returns `false` if global
|
|
2234
|
+
* metadata or `LocalCacheManager` has not finished initializing yet.
|
|
2235
|
+
*/
|
|
2236
|
+
protected ConfigureFromGlobalMetadataSync(data: ProviderConfigDataBase): boolean;
|
|
2021
2237
|
Config(data: ProviderConfigDataBase, providerToUse?: IMetadataProvider): Promise<boolean>;
|
|
2022
2238
|
/**
|
|
2023
2239
|
* Reloads this provider's metadata. Single-flight: at most one reload runs at a time, and a
|
|
2024
2240
|
* request arriving mid-reload queues exactly one follow-up pass.
|
|
2025
|
-
* @param hardRefresh - re-read the remote timestamps first and bypass
|
|
2026
|
-
*
|
|
2027
|
-
*
|
|
2028
|
-
*
|
|
2241
|
+
* @param hardRefresh - re-read the remote timestamps first (unless `stampsFresh`) and bypass
|
|
2242
|
+
* every cache layer
|
|
2243
|
+
* @param scopedFirst - reload only what the timestamps show changed (see
|
|
2244
|
+
* {@link MetadataRefreshScope}): nothing, the saved-query family (see
|
|
2245
|
+
* {@link PartialRefreshMetadataItemCodes}), or everything. Defaults to true unless
|
|
2246
|
+
* hardRefresh: an explicit Refresh() is always a full reload, and so is one that joins a
|
|
2247
|
+
* reload already in flight — the follow-up pass it queues runs in full. A pass that may be
|
|
2248
|
+
* scoped but cannot read the timestamps keeps the metadata loaded and is retried later.
|
|
2249
|
+
* @param stampsFresh - the caller read the remote timestamps just before this call. The first
|
|
2250
|
+
* hard pass then uses them instead of reading them again; a queued follow-up pass still reads.
|
|
2251
|
+
*/
|
|
2252
|
+
protected ReloadMetadata(hardRefresh: boolean, providerToUse?: IMetadataProvider, scopedFirst?: boolean, stampsFresh?: boolean): Promise<boolean>;
|
|
2253
|
+
/**
|
|
2254
|
+
* Carries out one reload pass for `scope`. A failed scoped reload is retried later; only the
|
|
2255
|
+
* {@link MetadataScopedReloadAttempts}-th failure in a row runs the full reload instead.
|
|
2256
|
+
* @returns true when a full snapshot was loaded from the server and adopted
|
|
2029
2257
|
*/
|
|
2030
|
-
|
|
2258
|
+
private applyMetadataRefreshScope;
|
|
2259
|
+
/**
|
|
2260
|
+
* The full reload: fetches all metadata and adopts it. Readers keep the current metadata until
|
|
2261
|
+
* the new snapshot is ready, and keep it if the fetch fails; a failure while metadata is loaded
|
|
2262
|
+
* is retried later. Every full reload is logged with its reason and duration.
|
|
2263
|
+
* @returns true when the snapshot was loaded and adopted
|
|
2264
|
+
*/
|
|
2265
|
+
private reloadAllMetadata;
|
|
2031
2266
|
/**
|
|
2032
2267
|
* Adopts a metadata snapshot just loaded from the server: swaps it in, records that the
|
|
2033
2268
|
* local copy now matches the server's timestamps (verified per item against the received
|
|
@@ -2048,12 +2283,24 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2048
2283
|
*/
|
|
2049
2284
|
private reconcileAdoptedMetadataTimestamps;
|
|
2050
2285
|
/**
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2053
|
-
*
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2056
|
-
*
|
|
2286
|
+
* What a metadata refresh must reload, from the local and remote timestamps. Compares them
|
|
2287
|
+
* item by item (the same test as {@link LocalMetadataObsolete}) and maps each stale entity
|
|
2288
|
+
* back to its MJ_Metadata item code:
|
|
2289
|
+
*
|
|
2290
|
+
* - `none` — nothing {@link MetadataBuildItemCodes} names has changed. Either nothing moved,
|
|
2291
|
+
* or only items the metadata build never reads did (`Dashboards`).
|
|
2292
|
+
* - `scoped` — every change the build reads is in the saved-query family (see
|
|
2293
|
+
* {@link PartialRefreshMetadataItemCodes}); `Codes` is the whole family, since the query
|
|
2294
|
+
* classes are swapped as a set.
|
|
2295
|
+
* - `full` — anything else changed, or the change cannot be attributed (an unknown item, an
|
|
2296
|
+
* item that left the dataset, the roll-up moving with no item, or the inputs to compare are
|
|
2297
|
+
* missing). `Reason` says which, for the log.
|
|
2298
|
+
*/
|
|
2299
|
+
protected MetadataRefreshScope(): MetadataRefreshScopeResult;
|
|
2300
|
+
/**
|
|
2301
|
+
* The saved-query family's item codes when the current staleness can be served by a scoped
|
|
2302
|
+
* reload; null otherwise.
|
|
2303
|
+
* @deprecated Use {@link MetadataRefreshScope}, which also says when nothing needs reloading.
|
|
2057
2304
|
*/
|
|
2058
2305
|
protected PartialRefreshItemCodes(): string[] | null;
|
|
2059
2306
|
private static metadataStampChanged;
|
|
@@ -2064,14 +2311,16 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2064
2311
|
* requested with a `1=0` filter, so it reads nothing. Always bypasses cache layers — the read
|
|
2065
2312
|
* is small, and a cached answer is exactly what a staleness check cannot trust.
|
|
2066
2313
|
* @returns true when the scoped reload was applied; false when it does not apply or any part
|
|
2067
|
-
* of it failed — the caller then
|
|
2314
|
+
* of it failed — the caller then retries it later, and after
|
|
2315
|
+
* {@link MetadataScopedReloadAttempts} failures in a row runs the full reload, so a failure
|
|
2316
|
+
* never leaves stale queries for good.
|
|
2068
2317
|
*/
|
|
2069
2318
|
protected TryPartialMetadataReload(providerToUse?: IMetadataProvider): Promise<boolean>;
|
|
2070
2319
|
/**
|
|
2071
2320
|
* Background validation for the stale-while-revalidate fast-start pattern.
|
|
2072
|
-
* Checks if local metadata is still current; if stale,
|
|
2073
|
-
* and atomically swaps it in. The app continues operating on
|
|
2074
|
-
* during this process — no blocking.
|
|
2321
|
+
* Checks if local metadata is still current; if stale, reloads only what changed (see
|
|
2322
|
+
* {@link MetadataRefreshScope}) and atomically swaps it in. The app continues operating on
|
|
2323
|
+
* cached data during this process — no blocking.
|
|
2075
2324
|
*/
|
|
2076
2325
|
backgroundValidateAndRefresh(providerToUse?: IMetadataProvider): Promise<void>;
|
|
2077
2326
|
/**
|
|
@@ -2088,8 +2337,9 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2088
2337
|
* engines start, then proceed normally.
|
|
2089
2338
|
*
|
|
2090
2339
|
* Cost on the warm-current path is one batched timestamp fetch (~50–200 ms depending
|
|
2091
|
-
* on RTT). On the warm-stale path we additionally
|
|
2092
|
-
*
|
|
2340
|
+
* on RTT). On the warm-stale path we additionally reload what changed — the saved-query
|
|
2341
|
+
* family alone when only saved queries moved, everything otherwise — but avoid serving
|
|
2342
|
+
* stale data to the UI in the first place.
|
|
2093
2343
|
*
|
|
2094
2344
|
* On a cold boot, where Config() just loaded the graph (and the current user) from the
|
|
2095
2345
|
* server, the first call after that load returns immediately — no check, no current-user
|
|
@@ -2098,6 +2348,15 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2098
2348
|
* Caller contract: invoke this before `StartupManager.Startup()`.
|
|
2099
2349
|
*/
|
|
2100
2350
|
preValidateAndRefresh(providerToUse?: IMetadataProvider): Promise<void>;
|
|
2351
|
+
/**
|
|
2352
|
+
* Brings cached metadata that a staleness check just found stale up to date, reloading only
|
|
2353
|
+
* what changed (see {@link MetadataRefreshScope}). The full reload replaces the snapshot
|
|
2354
|
+
* wholesale and fetches the current user with it; it is not {@link Config}'s load, so it does
|
|
2355
|
+
* not claim the cold-boot pre-validation skip. A scoped reload merges into the current
|
|
2356
|
+
* snapshot, so it runs inside {@link ReloadMetadata}'s single flight, where no other reload can
|
|
2357
|
+
* swap the snapshot out from under it; it fetches no user, so `refreshCurrentUser` asks for one.
|
|
2358
|
+
*/
|
|
2359
|
+
private reloadStaleCachedMetadata;
|
|
2101
2360
|
/**
|
|
2102
2361
|
* @deprecated The reuse-global fast path now builds a shared shell instead — see
|
|
2103
2362
|
* {@link CreateSharedMetadataShell}. The metadata graph is immutable after Config,
|
|
@@ -2196,6 +2455,22 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2196
2455
|
* @returns Complete metadata collection with all relationships
|
|
2197
2456
|
*/
|
|
2198
2457
|
protected GetAllMetadata(providerToUse?: IMetadataProvider, forceRefresh?: boolean): Promise<AllMetadata>;
|
|
2458
|
+
/**
|
|
2459
|
+
* The MJ_Metadata item codes whose rows the metadata assembly writes to: entity rows get their
|
|
2460
|
+
* fields, permissions, relationships, settings, organic keys, alternate views and unique keys;
|
|
2461
|
+
* field rows their values and field permissions; organic keys their related entities;
|
|
2462
|
+
* applications their entities and settings. The entity array is also sorted.
|
|
2463
|
+
*/
|
|
2464
|
+
private static readonly _assemblyWrittenItemCodes;
|
|
2465
|
+
/**
|
|
2466
|
+
* The MJ_Metadata rows keyed by item code, as {@link GetAllMetadata} assembles them: the items
|
|
2467
|
+
* the assembly writes to are shallow copies (a new array of new row objects), the rest are the
|
|
2468
|
+
* dataset's own arrays. The dataset's rows are the ones the dataset cache holds and serves to
|
|
2469
|
+
* every later reader — on a server, every client's metadata request — so writing child
|
|
2470
|
+
* collections onto them would send each entity's fields, permissions and relationships a second
|
|
2471
|
+
* time, nested inside the entity rows, with every response.
|
|
2472
|
+
*/
|
|
2473
|
+
private static metadataAssemblyInput;
|
|
2199
2474
|
/** Logs a failed metadata download and keeps it for {@link LastMetadataLoadError}. */
|
|
2200
2475
|
private recordMetadataLoadFailure;
|
|
2201
2476
|
/**
|
|
@@ -2227,7 +2502,7 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2227
2502
|
* metadata post-processing, replacing repeated O(N*M) filter scans.
|
|
2228
2503
|
*/
|
|
2229
2504
|
private groupByNormalizedUUID;
|
|
2230
|
-
protected PostProcessEntityMetadata(entities: EntityMetadataRow[], fields: EntityFieldMetadataRow[], fieldValues: EntityFieldValueMetadataRow[], permissions: EntityChildMetadataRow[], relationships: EntityChildMetadataRow[], settings: EntityChildMetadataRow[], organicKeys?: OrganicKeyMetadataRow[], organicKeyRelatedEntities?: OrganicKeyRelatedEntityMetadataRow[], fieldPermissions?: EntityFieldPermissionMetadataRow[], alternateBaseViews?: EntityChildMetadataRow[]): EntityInfo[];
|
|
2505
|
+
protected PostProcessEntityMetadata(entities: EntityMetadataRow[], fields: EntityFieldMetadataRow[], fieldValues: EntityFieldValueMetadataRow[], permissions: EntityChildMetadataRow[], relationships: EntityChildMetadataRow[], settings: EntityChildMetadataRow[], organicKeys?: OrganicKeyMetadataRow[], organicKeyRelatedEntities?: OrganicKeyRelatedEntityMetadataRow[], fieldPermissions?: EntityFieldPermissionMetadataRow[], alternateBaseViews?: EntityChildMetadataRow[], uniqueKeys?: EntityChildMetadataRow[]): EntityInfo[];
|
|
2231
2506
|
/**
|
|
2232
2507
|
* Gets the configuration data that was provided to the provider.
|
|
2233
2508
|
* @returns The provider configuration including schema filters
|
|
@@ -2278,23 +2553,58 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2278
2553
|
* @returns Array of AuthorizationRoleInfo join-table objects
|
|
2279
2554
|
*/
|
|
2280
2555
|
get AuthorizationRoles(): AuthorizationRoleInfo[];
|
|
2281
|
-
/** @
|
|
2556
|
+
/** Whether {@link deprecatedQueryMetadata} has logged its warning in this process. */
|
|
2557
|
+
private static _queryMetadataWarningLogged;
|
|
2558
|
+
/**
|
|
2559
|
+
* What a deprecated query-metadata getter returns: the loaded array when the provider loads query
|
|
2560
|
+
* metadata, otherwise an empty array and a warning, logged once per process, naming the
|
|
2561
|
+
* replacement.
|
|
2562
|
+
*/
|
|
2563
|
+
private deprecatedQueryMetadata;
|
|
2564
|
+
/**
|
|
2565
|
+
* @deprecated Use `QueryEngine.Instance.Queries` from `@memberjunction/core-entities`. Empty unless the
|
|
2566
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2567
|
+
*/
|
|
2282
2568
|
get Queries(): QueryInfo[];
|
|
2283
|
-
/**
|
|
2569
|
+
/**
|
|
2570
|
+
* @deprecated Use `QueryEngine.Instance.Categories` from `@memberjunction/core-entities`. Empty unless the
|
|
2571
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2572
|
+
*/
|
|
2284
2573
|
get QueryCategories(): QueryCategoryInfo[];
|
|
2285
|
-
/**
|
|
2574
|
+
/**
|
|
2575
|
+
* @deprecated Use `QueryEngine.Instance.Fields` from `@memberjunction/core-entities`. Empty unless the
|
|
2576
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2577
|
+
*/
|
|
2286
2578
|
get QueryFields(): QueryFieldInfo[];
|
|
2287
|
-
/**
|
|
2579
|
+
/**
|
|
2580
|
+
* @deprecated Use `QueryEngine.Instance.Permissions` from `@memberjunction/core-entities`. Empty unless the
|
|
2581
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2582
|
+
*/
|
|
2288
2583
|
get QueryPermissions(): QueryPermissionInfo[];
|
|
2289
|
-
/**
|
|
2584
|
+
/**
|
|
2585
|
+
* @deprecated Use `QueryEngine.Instance.QueryEntities` from `@memberjunction/core-entities`. Empty unless the
|
|
2586
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2587
|
+
*/
|
|
2290
2588
|
get QueryEntities(): QueryEntityInfo[];
|
|
2291
|
-
/**
|
|
2589
|
+
/**
|
|
2590
|
+
* @deprecated Use `QueryEngine.Instance.Parameters` from `@memberjunction/core-entities`. Empty unless the
|
|
2591
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2592
|
+
*/
|
|
2292
2593
|
get QueryParameters(): QueryParameterInfo[];
|
|
2293
|
-
/**
|
|
2594
|
+
/**
|
|
2595
|
+
* @deprecated Use `QueryEngine.Instance.Dependencies` from `@memberjunction/core-entities`. Empty unless the
|
|
2596
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2597
|
+
*/
|
|
2294
2598
|
get QueryDependencies(): QueryDependencyInfo[];
|
|
2295
|
-
/**
|
|
2599
|
+
/**
|
|
2600
|
+
* @deprecated Use `QueryEngine.Instance.SQLDialects` from `@memberjunction/core-entities`. Empty unless the
|
|
2601
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2602
|
+
*/
|
|
2296
2603
|
get SQLDialects(): SQLDialectInfo[];
|
|
2297
|
-
/**
|
|
2604
|
+
/**
|
|
2605
|
+
* @deprecated Use `QueryEngine.Instance.QuerySQLs` from `@memberjunction/core-entities`. Empty unless the
|
|
2606
|
+
* provider is configured with `LoadQueryMetadata`; removed in 7.0.
|
|
2607
|
+
*/
|
|
2298
2608
|
get QuerySQLs(): QuerySQLInfo[];
|
|
2299
2609
|
/**
|
|
2300
2610
|
* Gets all library definitions in the system.
|
|
@@ -2401,6 +2711,7 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2401
2711
|
* @returns True if refresh was successful or not needed
|
|
2402
2712
|
*/
|
|
2403
2713
|
RefreshIfNeeded(providerToUse?: IMetadataProvider, bypassMinCheckInterval?: boolean): Promise<boolean>;
|
|
2714
|
+
private static isGetEntityObjectOptions;
|
|
2404
2715
|
/**
|
|
2405
2716
|
* Creates a new instance of a BaseEntity subclass for the specified entity and automatically calls NewRecord() to initialize it.
|
|
2406
2717
|
* This method serves as the core implementation for entity instantiation in the MemberJunction framework.
|
|
@@ -2421,7 +2732,13 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2421
2732
|
* @returns Promise resolving to the entity instance with the specified record loaded
|
|
2422
2733
|
* @throws Error if entity name is not found, instantiation fails, or record cannot be loaded
|
|
2423
2734
|
*/
|
|
2735
|
+
GetEntityObject<T extends BaseEntity>(entityName: string, options: GetEntityObjectOptions, contextUser?: UserInfo): Promise<T>;
|
|
2424
2736
|
GetEntityObject<T extends BaseEntity>(entityName: string, loadKey: CompositeKey, contextUser?: UserInfo): Promise<T>;
|
|
2737
|
+
/**
|
|
2738
|
+
* Instantiates a `BaseEntity` subclass using explicit {@link GetEntityObjectOptions}
|
|
2739
|
+
* (for example `{ SkipNewRecord: true }` prior to `LoadFromData`).
|
|
2740
|
+
*/
|
|
2741
|
+
GetEntityObjectWithOptions<T extends BaseEntity>(entityName: string, options: GetEntityObjectOptions, contextUser?: UserInfo): Promise<T>;
|
|
2425
2742
|
/**
|
|
2426
2743
|
* Returns a list of dependencies - records that are linked to the specified Entity/RecordID combination. A dependency is as defined by the relationships in the database. The MemberJunction metadata that is used
|
|
2427
2744
|
* for this simply reflects the foreign key relationships that exist in the database. The CodeGen tool is what detects all of the relationships and generates the metadata that is used by MemberJunction. The metadata in question
|
|
@@ -2729,7 +3046,20 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2729
3046
|
private static localStorageAllMetadataKey;
|
|
2730
3047
|
private static localStorageFormatKey;
|
|
2731
3048
|
private static localStorageDatasetMembershipKey;
|
|
3049
|
+
/** The MJ_Metadata dataset items (see `_metadataDatasetItems`) of the stored snapshot. */
|
|
3050
|
+
private static localStorageDatasetItemsKey;
|
|
2732
3051
|
private static localStorageKeys;
|
|
3052
|
+
/**
|
|
3053
|
+
* Adopts a stored metadata-member entity set. The entities that back only items this provider
|
|
3054
|
+
* does not read are removed, so a snapshot saved by a process configured to read them cannot
|
|
3055
|
+
* make writes to them schedule refreshes here.
|
|
3056
|
+
*/
|
|
3057
|
+
private restoreMetadataDatasetMembership;
|
|
3058
|
+
/**
|
|
3059
|
+
* Adopts a stored dataset item list. Only a well-formed list replaces the one held: a damaged or
|
|
3060
|
+
* empty value must not erase the list a load already recorded.
|
|
3061
|
+
*/
|
|
3062
|
+
private restoreMetadataDatasetItems;
|
|
2733
3063
|
/**
|
|
2734
3064
|
* Converts a base64-encoded string to an ArrayBuffer.
|
|
2735
3065
|
* Used for compressed metadata storage/retrieval.
|
|
@@ -2768,6 +3098,36 @@ export declare abstract class ProviderBase implements IMetadataProvider, IRunVie
|
|
|
2768
3098
|
private logMetadataSnapshotDisabledOnce;
|
|
2769
3099
|
/** Guard for {@link logMetadataSnapshotDisabledOnce}. */
|
|
2770
3100
|
private _metadataSnapshotSkipLogged;
|
|
3101
|
+
/** Default debounce duration in milliseconds for coalesced metadata snapshot writes to local storage. */
|
|
3102
|
+
static MetadataSnapshotSaveDebounceMs: number;
|
|
3103
|
+
private _metadataSaveTimer;
|
|
3104
|
+
private _inFlightMetadataSave;
|
|
3105
|
+
private _hasPendingMetadataSaveWhileInFlight;
|
|
3106
|
+
/**
|
|
3107
|
+
* Schedules a trailing-edge coalesced background call to `SaveLocalMetadataToStorage()`,
|
|
3108
|
+
* deduplicating rapid back-to-back calls within the window and serializing execution if an
|
|
3109
|
+
* in-flight save is already running.
|
|
3110
|
+
*
|
|
3111
|
+
* @param delayMs - Debounce window duration in milliseconds (defaults to `ProviderBase.MetadataSnapshotSaveDebounceMs`)
|
|
3112
|
+
*/
|
|
3113
|
+
ScheduleSaveLocalMetadataToStorage(delayMs?: number): void;
|
|
3114
|
+
/**
|
|
3115
|
+
* Cancels any pending debounce timer and awaits `SaveLocalMetadataToStorage()` immediately
|
|
3116
|
+
* (or awaits any in-flight save plus trailing save), so tests and shutdown hooks can
|
|
3117
|
+
* deterministically flush pending writes.
|
|
3118
|
+
*/
|
|
3119
|
+
FlushPendingMetadataStorageSave(): Promise<void>;
|
|
3120
|
+
/**
|
|
3121
|
+
* Clears any pending metadata snapshot save timer without saving.
|
|
3122
|
+
*/
|
|
3123
|
+
CancelPendingMetadataStorageSave(): void;
|
|
3124
|
+
private triggerSerializedMetadataSave;
|
|
3125
|
+
private executeSerializedMetadataSave;
|
|
3126
|
+
/**
|
|
3127
|
+
* Converts BaseInfo instances and nested objects into plain structured-cloneable
|
|
3128
|
+
* objects without JSON.stringify/JSON.parse, stripping functions and WeakRefs.
|
|
3129
|
+
*/
|
|
3130
|
+
private static toCloneableValue;
|
|
2771
3131
|
/**
|
|
2772
3132
|
* Saves current metadata to local storage for caching.
|
|
2773
3133
|
* Serializes both timestamps and full metadata collections.
|