@cadenza.io/service 2.20.1 → 2.21.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/README.md +17 -0
- package/dist/{Cadenza-Duj65Skt.d.mts → Cadenza-gGtFW_Y-.d.mts} +117 -2
- package/dist/{Cadenza-Duj65Skt.d.ts → Cadenza-gGtFW_Y-.d.ts} +117 -2
- package/dist/browser/index.js +2902 -886
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +2898 -880
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +2902 -861
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2898 -861
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt/index.d.mts +2 -2
- package/dist/nuxt/index.d.ts +2 -2
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/vue/index.d.mts +2 -2
- package/dist/vue/index.d.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -103,6 +103,23 @@ await browserRuntime.waitUntilReady();
|
|
|
103
103
|
|
|
104
104
|
Use `createCadenzaService(..., { isFrontend: true })` directly when you only need the lower-level frontend transport/bootstrap behavior. Use `createBrowserRuntimeActor(...)` when the frontend also needs actor-owned readiness and projected browser runtime state.
|
|
105
105
|
|
|
106
|
+
### Layer-scoped tools in distributed manifests
|
|
107
|
+
|
|
108
|
+
`@cadenza.io/service` treats helpers and globals as structural sync material.
|
|
109
|
+
|
|
110
|
+
- `service_manifest` now includes `helpers`, `globals`, `taskToHelperMaps`, `helperToHelperMaps`, `taskToGlobalMaps`, and `helperToGlobalMaps`
|
|
111
|
+
- helper/global rows are structural catalog data, not live remote execution membership
|
|
112
|
+
- local `GraphMetadataController` fans out direct helper/global events as:
|
|
113
|
+
- `global.meta.graph_metadata.helper_created`
|
|
114
|
+
- `global.meta.graph_metadata.helper_updated`
|
|
115
|
+
- `global.meta.graph_metadata.global_created`
|
|
116
|
+
- `global.meta.graph_metadata.global_updated`
|
|
117
|
+
- `global.meta.graph_metadata.task_helper_associated`
|
|
118
|
+
- `global.meta.graph_metadata.helper_helper_associated`
|
|
119
|
+
- `global.meta.graph_metadata.task_global_associated`
|
|
120
|
+
- `global.meta.graph_metadata.helper_global_associated`
|
|
121
|
+
- bootstrap full sync carries these rows so authority can rebuild persistence, but remote helper/global definitions are not exposed as executable local `tools`
|
|
122
|
+
|
|
106
123
|
### Creating a Nuxt runtime wrapper
|
|
107
124
|
If your frontend is Nuxt, use `@cadenza.io/service/nuxt` on top of the shared browser actor. The Nuxt layer keeps the core runtime framework agnostic while hiding `useState`, plugin injection, and subscription wiring.
|
|
108
125
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, Actor, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, CadenzaMode, EmitOptions, Intent, RuntimeValidationPolicy, RuntimeValidationScope, TaskOptions, ActorSpec, ActorFactoryOptions, ActorDefinition, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
1
|
+
import _cadenza_io_core__default, { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, Actor, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, CadenzaMode, EmitOptions, Intent, RuntimeValidationPolicy, RuntimeValidationScope, TaskOptions, ActorSpec, ActorFactoryOptions, ActorDefinition, TaskFunction, HelperFunction, HelperDefinition, GlobalDefinition, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a task that delegates execution of a routine to a remote system or service.
|
|
@@ -38,6 +38,7 @@ declare class DeputyTask extends Task {
|
|
|
38
38
|
* @return {void} This constructor does not return a value.
|
|
39
39
|
*/
|
|
40
40
|
constructor(name: string, remoteRoutineName: string, serviceName?: string | undefined, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: Schema | undefined, validateInputContext?: boolean, outputSchema?: Schema | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
41
|
+
clone(): never;
|
|
41
42
|
/**
|
|
42
43
|
* Executes the specified task function within the provided execution context.
|
|
43
44
|
*
|
|
@@ -142,6 +143,7 @@ declare class DatabaseTask extends DeputyTask {
|
|
|
142
143
|
* @return {void}
|
|
143
144
|
*/
|
|
144
145
|
constructor(name: string, taskName: string, serviceName: string | undefined, description: string | undefined, queryData: DbOperationPayload, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: Schema | undefined, validateInputContext?: boolean, outputSchema?: Schema | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
146
|
+
clone(): never;
|
|
145
147
|
/**
|
|
146
148
|
* Executes the specified task within the given context.
|
|
147
149
|
*
|
|
@@ -235,6 +237,14 @@ interface ServiceInstanceDescriptor {
|
|
|
235
237
|
serviceName: string;
|
|
236
238
|
numberOfRunningGraphs?: number;
|
|
237
239
|
isPrimary: boolean;
|
|
240
|
+
leaseStatus?: "active" | "non_responsive" | "inactive" | "deleted";
|
|
241
|
+
leaseExpiresAt?: string;
|
|
242
|
+
lastLeaseRenewedAt?: string;
|
|
243
|
+
isReady?: boolean;
|
|
244
|
+
readinessReason?: string | null;
|
|
245
|
+
lastReadyAt?: string | null;
|
|
246
|
+
lastObservedTransportAt?: string | null;
|
|
247
|
+
shutdownRequestedAt?: string | null;
|
|
238
248
|
isActive: boolean;
|
|
239
249
|
isNonResponsive: boolean;
|
|
240
250
|
isBlocked: boolean;
|
|
@@ -331,6 +341,7 @@ declare class ServiceRegistry {
|
|
|
331
341
|
private readonly runtimeStatusHeartbeatIntervalMs;
|
|
332
342
|
private readonly runtimeMetricsSampleIntervalMs;
|
|
333
343
|
private readonly runtimeStatusRestRefreshIntervalMs;
|
|
344
|
+
private readonly runtimeStatusLoopJitterRatio;
|
|
334
345
|
private readonly runtimeStatusMissThreshold;
|
|
335
346
|
private readonly runtimeStatusFallbackTimeoutMs;
|
|
336
347
|
private readonly runtimeStatusAuthorityReportTimeoutMs;
|
|
@@ -343,6 +354,8 @@ declare class ServiceRegistry {
|
|
|
343
354
|
private readonly routeFailurePenaltyMs;
|
|
344
355
|
private readonly degradedGraphThreshold;
|
|
345
356
|
private readonly overloadedGraphThreshold;
|
|
357
|
+
private readonly bootstrapFullSyncRetryJitterRatio;
|
|
358
|
+
private readonly serviceCommunicationRetryJitterRatio;
|
|
346
359
|
serviceName: string | null;
|
|
347
360
|
serviceInstanceId: string | null;
|
|
348
361
|
numberOfRunningGraphs: number;
|
|
@@ -358,6 +371,10 @@ declare class ServiceRegistry {
|
|
|
358
371
|
private knownGlobalSignalMaps;
|
|
359
372
|
private authorityBootstrapRoute;
|
|
360
373
|
private authorityBootstrapHandshakeInFlight;
|
|
374
|
+
private authorityBootstrapHandshakeRetryTimer;
|
|
375
|
+
private authorityBootstrapHandshakeRetryIndex;
|
|
376
|
+
private authorityBootstrapHandshakeRetryGeneration;
|
|
377
|
+
private authorityBootstrapHandshakeRetryReason;
|
|
361
378
|
handleInstanceUpdateTask: Task;
|
|
362
379
|
handleTransportUpdateTask: Task;
|
|
363
380
|
handleGlobalSignalRegistrationTask: Task;
|
|
@@ -400,6 +417,13 @@ declare class ServiceRegistry {
|
|
|
400
417
|
private getAuthorityBootstrapRestTarget;
|
|
401
418
|
hasAuthorityBootstrapHandshakeEstablished(): boolean;
|
|
402
419
|
private invalidateAuthorityBootstrapHandshake;
|
|
420
|
+
private clearAuthorityBootstrapHandshakeRetryTimer;
|
|
421
|
+
private invalidateAuthorityBootstrapHandshakeRetryState;
|
|
422
|
+
private markAuthorityBootstrapHandshakeSatisfied;
|
|
423
|
+
private buildJitteredAuthorityBootstrapHandshakeRetryDelayMs;
|
|
424
|
+
private scheduleAuthorityBootstrapHandshakeRetry;
|
|
425
|
+
private restartAuthorityBootstrapHandshakeRetryChain;
|
|
426
|
+
private restartAuthorityBootstrapRecovery;
|
|
403
427
|
private requestAuthorityBootstrapHandshake;
|
|
404
428
|
private invokeAuthorityBootstrapRoutine;
|
|
405
429
|
private registerRemoteIntentDeputy;
|
|
@@ -410,6 +434,9 @@ declare class ServiceRegistry {
|
|
|
410
434
|
ensureBootstrapAuthorityControlPlaneForInquiry(intentName: string, ctx?: AnyObject): boolean;
|
|
411
435
|
private ensureBootstrapAuthorityControlPlane;
|
|
412
436
|
private hasBootstrapFullSyncDeputies;
|
|
437
|
+
private buildDeterministicInstanceJitterKey;
|
|
438
|
+
private buildJitteredIntervalStartDate;
|
|
439
|
+
private buildJitteredBootstrapRetryDelayMs;
|
|
413
440
|
private ensureAuthorityBootstrapSignalTransmissions;
|
|
414
441
|
private clearBootstrapFullSyncRetryTimer;
|
|
415
442
|
private invalidateBootstrapFullSyncRetryState;
|
|
@@ -466,6 +493,8 @@ declare class ServiceRegistry {
|
|
|
466
493
|
private recordRoutingFailure;
|
|
467
494
|
private clearRoutingCooldown;
|
|
468
495
|
private hasRouteableInstanceForRouting;
|
|
496
|
+
private hasPendingRouteableInstanceForSelection;
|
|
497
|
+
private maybeSchedulePendingRouteSelectionRetry;
|
|
469
498
|
private refreshRoutingCooldownsForService;
|
|
470
499
|
private buildTransportFailureKey;
|
|
471
500
|
private clearTransportFailureState;
|
|
@@ -968,6 +997,23 @@ type ServiceManifestRoutineDefinition = {
|
|
|
968
997
|
service_name: string;
|
|
969
998
|
is_meta: boolean;
|
|
970
999
|
};
|
|
1000
|
+
type ServiceManifestHelperDefinition = {
|
|
1001
|
+
name: string;
|
|
1002
|
+
version: number;
|
|
1003
|
+
description: string;
|
|
1004
|
+
service_name: string;
|
|
1005
|
+
is_meta: boolean;
|
|
1006
|
+
handler_source: string;
|
|
1007
|
+
language: "js" | "ts";
|
|
1008
|
+
};
|
|
1009
|
+
type ServiceManifestGlobalDefinition = {
|
|
1010
|
+
name: string;
|
|
1011
|
+
version: number;
|
|
1012
|
+
description: string;
|
|
1013
|
+
service_name: string;
|
|
1014
|
+
is_meta: boolean;
|
|
1015
|
+
value: unknown;
|
|
1016
|
+
};
|
|
971
1017
|
type ServiceManifestDirectionalTaskMap = {
|
|
972
1018
|
task_name: string;
|
|
973
1019
|
task_version: number;
|
|
@@ -1006,6 +1052,38 @@ type ServiceManifestTaskRoutineMap = {
|
|
|
1006
1052
|
routine_version: number;
|
|
1007
1053
|
service_name: string;
|
|
1008
1054
|
};
|
|
1055
|
+
type ServiceManifestTaskHelperMap = {
|
|
1056
|
+
task_name: string;
|
|
1057
|
+
task_version: number;
|
|
1058
|
+
service_name: string;
|
|
1059
|
+
alias: string;
|
|
1060
|
+
helper_name: string;
|
|
1061
|
+
helper_version: number;
|
|
1062
|
+
};
|
|
1063
|
+
type ServiceManifestHelperHelperMap = {
|
|
1064
|
+
helper_name: string;
|
|
1065
|
+
helper_version: number;
|
|
1066
|
+
service_name: string;
|
|
1067
|
+
alias: string;
|
|
1068
|
+
dependency_helper_name: string;
|
|
1069
|
+
dependency_helper_version: number;
|
|
1070
|
+
};
|
|
1071
|
+
type ServiceManifestTaskGlobalMap = {
|
|
1072
|
+
task_name: string;
|
|
1073
|
+
task_version: number;
|
|
1074
|
+
service_name: string;
|
|
1075
|
+
alias: string;
|
|
1076
|
+
global_name: string;
|
|
1077
|
+
global_version: number;
|
|
1078
|
+
};
|
|
1079
|
+
type ServiceManifestHelperGlobalMap = {
|
|
1080
|
+
helper_name: string;
|
|
1081
|
+
helper_version: number;
|
|
1082
|
+
service_name: string;
|
|
1083
|
+
alias: string;
|
|
1084
|
+
global_name: string;
|
|
1085
|
+
global_version: number;
|
|
1086
|
+
};
|
|
1009
1087
|
type ServiceManifestSnapshot = {
|
|
1010
1088
|
serviceName: string;
|
|
1011
1089
|
serviceInstanceId: string;
|
|
@@ -1018,11 +1096,17 @@ type ServiceManifestSnapshot = {
|
|
|
1018
1096
|
intents: ServiceManifestIntentDefinition[];
|
|
1019
1097
|
actors: ServiceManifestActorDefinition[];
|
|
1020
1098
|
routines: ServiceManifestRoutineDefinition[];
|
|
1099
|
+
helpers: ServiceManifestHelperDefinition[];
|
|
1100
|
+
globals: ServiceManifestGlobalDefinition[];
|
|
1021
1101
|
directionalTaskMaps: ServiceManifestDirectionalTaskMap[];
|
|
1022
1102
|
signalToTaskMaps: ServiceManifestSignalTaskMap[];
|
|
1023
1103
|
intentToTaskMaps: ServiceManifestIntentTaskMap[];
|
|
1024
1104
|
actorTaskMaps: ServiceManifestActorTaskMap[];
|
|
1025
1105
|
taskToRoutineMaps: ServiceManifestTaskRoutineMap[];
|
|
1106
|
+
taskToHelperMaps: ServiceManifestTaskHelperMap[];
|
|
1107
|
+
helperToHelperMaps: ServiceManifestHelperHelperMap[];
|
|
1108
|
+
taskToGlobalMaps: ServiceManifestTaskGlobalMap[];
|
|
1109
|
+
helperToGlobalMaps: ServiceManifestHelperGlobalMap[];
|
|
1026
1110
|
};
|
|
1027
1111
|
|
|
1028
1112
|
type SecurityProfile = "low" | "medium" | "high";
|
|
@@ -1070,6 +1154,7 @@ declare class CadenzaService {
|
|
|
1070
1154
|
protected static isBootstrapped: boolean;
|
|
1071
1155
|
protected static serviceCreated: boolean;
|
|
1072
1156
|
protected static bootstrapSyncCompleted: boolean;
|
|
1157
|
+
protected static bootstrapSyncCompletedAt: number;
|
|
1073
1158
|
protected static bootstrapSignalRegistrationsCompleted: boolean;
|
|
1074
1159
|
protected static bootstrapIntentRegistrationsCompleted: boolean;
|
|
1075
1160
|
protected static defaultDatabaseServiceName: string | null;
|
|
@@ -1078,9 +1163,17 @@ declare class CadenzaService {
|
|
|
1078
1163
|
protected static frontendSyncScheduled: boolean;
|
|
1079
1164
|
protected static serviceManifestRevision: number;
|
|
1080
1165
|
protected static lastPublishedServiceManifestHashes: Partial<Record<ServiceManifestPublicationLayer, string>>;
|
|
1166
|
+
protected static serviceManifestPublishedAt: Partial<Record<ServiceManifestPublicationLayer, number>>;
|
|
1081
1167
|
protected static serviceManifestPublicationInFlight: boolean;
|
|
1082
1168
|
protected static serviceManifestPublicationPendingReason: string | null;
|
|
1083
1169
|
protected static serviceManifestPublicationPendingLayer: ServiceManifestPublicationLayer | null;
|
|
1170
|
+
protected static serviceManifestPublicationRetryReason: string | null;
|
|
1171
|
+
protected static serviceManifestPublicationRetryLayer: ServiceManifestPublicationLayer | null;
|
|
1172
|
+
protected static serviceManifestPublicationRetryTimer: ReturnType<typeof setTimeout> | null;
|
|
1173
|
+
protected static serviceManifestPublicationRetryCount: number;
|
|
1174
|
+
protected static localServiceManifestDefinitionInserted: boolean;
|
|
1175
|
+
protected static localServiceManifestInstanceInserted: boolean;
|
|
1176
|
+
protected static initialServiceManifestPublicationRequested: boolean;
|
|
1084
1177
|
private static shutdownHandlersRegistered;
|
|
1085
1178
|
private static shutdownInFlight;
|
|
1086
1179
|
private static shutdownHandlerCleanup;
|
|
@@ -1090,11 +1183,27 @@ declare class CadenzaService {
|
|
|
1090
1183
|
private static replayRegisteredTaskSignalObservations;
|
|
1091
1184
|
private static replayRegisteredTaskGraphMetadata;
|
|
1092
1185
|
private static normalizeServiceManifestPublicationLayer;
|
|
1186
|
+
private static clampServiceManifestPublicationLayer;
|
|
1093
1187
|
private static mergeServiceManifestPublicationRequest;
|
|
1188
|
+
private static getServiceManifestPublicationGate;
|
|
1094
1189
|
private static requestServiceManifestPublication;
|
|
1095
1190
|
private static scheduleServiceManifestPublicationRetry;
|
|
1191
|
+
private static shouldPublishBusinessManifestForTaskContext;
|
|
1192
|
+
private static isRoutingCriticalManifestSignalName;
|
|
1193
|
+
private static isRoutingCriticalManifestIntentName;
|
|
1194
|
+
private static isRoutingCriticalManifestTask;
|
|
1195
|
+
private static hasRoutingCriticalManifestBindingInContext;
|
|
1196
|
+
private static shouldPublishBusinessManifestForHelperContext;
|
|
1197
|
+
private static shouldPublishBusinessManifestForGlobalContext;
|
|
1198
|
+
private static shouldPublishBusinessManifestForRoutineContext;
|
|
1199
|
+
private static shouldRequestServiceManifestPublicationForSignal;
|
|
1200
|
+
private static maybeRequestInitialServiceManifestPublication;
|
|
1201
|
+
private static scheduleInitialServiceManifestPublicationFallback;
|
|
1096
1202
|
private static publishServiceManifestIfNeeded;
|
|
1097
1203
|
private static ensureServiceManifestPublicationTasks;
|
|
1204
|
+
private static isLocalAuthorityService;
|
|
1205
|
+
private static canPublishServiceManifestToAuthority;
|
|
1206
|
+
private static shouldRequireAuthorityBootstrapHandshakeForManifestPublication;
|
|
1098
1207
|
private static buildLegacyLocalCadenzaDBTaskName;
|
|
1099
1208
|
private static buildGeneratedLocalCadenzaDBTaskName;
|
|
1100
1209
|
/**
|
|
@@ -1521,6 +1630,12 @@ declare class CadenzaService {
|
|
|
1521
1630
|
* ```
|
|
1522
1631
|
*/
|
|
1523
1632
|
static createTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
1633
|
+
static createHelper(name: string, func: HelperFunction, description?: string): HelperDefinition;
|
|
1634
|
+
static createMetaHelper(name: string, func: HelperFunction, description?: string): HelperDefinition;
|
|
1635
|
+
static createHelperFromDefinition(definition: Parameters<typeof _cadenza_io_core__default.createHelperFromDefinition>[0]): HelperDefinition;
|
|
1636
|
+
static createGlobal(name: string, value: unknown, description?: string): GlobalDefinition;
|
|
1637
|
+
static createMetaGlobal(name: string, value: unknown, description?: string): GlobalDefinition;
|
|
1638
|
+
static createGlobalFromDefinition(definition: Parameters<typeof _cadenza_io_core__default.createGlobalFromDefinition>[0]): GlobalDefinition;
|
|
1524
1639
|
/**
|
|
1525
1640
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
1526
1641
|
* This is used for creating tasks that lives on the meta layer.
|
|
@@ -1796,4 +1911,4 @@ declare class CadenzaService {
|
|
|
1796
1911
|
static reset(): void;
|
|
1797
1912
|
}
|
|
1798
1913
|
|
|
1799
|
-
export {
|
|
1914
|
+
export { RUNTIME_STATUS_AUTHORITY_SYNC_REQUESTED_SIGNAL as $, AUTHORITY_RUNTIME_STATUS_REPORT_INTENT as A, type BootstrapOptions as B, CadenzaService as C, type DatabaseSchemaDefinition as D, type BrowserRuntimeActorHandle as E, type BrowserRuntimeActorOptions as F, type BrowserRuntimeActorRuntimeState as G, type HydrationOptions as H, type BrowserRuntimeProjectionBinding as I, type JoinDefinition as J, type BrowserRuntimeServiceOptions as K, type DatabaseMigrationConstraintDefinition as L, type DatabaseMigrationDefinition as M, type DatabaseMigrationPolicy as N, type DatabaseMigrationStep as O, DatabaseTask as P, type DbOperationType$1 as Q, type DeputyDescriptor as R, type ServerOptions as S, DeputyTask as T, type DistributedInquiryMeta as U, type FieldDefinition as V, type InquiryResponderDescriptor as W, type InquiryResponderStatus as X, type NetworkMode as Y, type OpEffect as Z, type QueryMode as _, type DatabaseOptions as a, type ResolvedBootstrapEndpoint as a0, type RuntimeMetricsHealthDetail as a1, type SecurityProfile as a2, type ServiceInstanceDescriptor as a3, type ServiceTransportConfig as a4, type ServiceTransportDescriptor as a5, type ServiceTransportProtocol as a6, type ServiceTransportRole as a7, type ServiceTransportSecurityProfile as a8, SignalTransmissionTask as a9, type SortDirection as aa, type SubOperationType as ab, type TableDefinition as ac, type ValueOrSubOp as ad, buildAuthorityRuntimeStatusSignature as ae, normalizeAuthorityRuntimeStatusReport as af, type DbOperationPayload as b, type SubOperation as c, type DistributedInquiryOptions as d, type ServiceManifestSnapshot as e, type ServiceManifestPublicationLayer as f, type ServiceManifestTaskDefinition as g, type ServiceManifestSignalDefinition as h, type ServiceManifestIntentDefinition as i, type ServiceManifestActorDefinition as j, type ServiceManifestRoutineDefinition as k, type ServiceManifestHelperDefinition as l, type ServiceManifestGlobalDefinition as m, type ServiceManifestDirectionalTaskMap as n, type ServiceManifestSignalTaskMap as o, type ServiceManifestIntentTaskMap as p, type ServiceManifestActorTaskMap as q, type ServiceManifestTaskRoutineMap as r, type ServiceManifestTaskHelperMap as s, type ServiceManifestHelperHelperMap as t, type ServiceManifestTaskGlobalMap as u, type ServiceManifestHelperGlobalMap as v, ServiceRegistry as w, type AggregateDefinition as x, type AggregateFunction as y, type AuthorityRuntimeStatusReport as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, Actor, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, CadenzaMode, EmitOptions, Intent, RuntimeValidationPolicy, RuntimeValidationScope, TaskOptions, ActorSpec, ActorFactoryOptions, ActorDefinition, TaskFunction, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
1
|
+
import _cadenza_io_core__default, { Task, ThrottleTagGetter, Schema, GraphContext, AnyObject, InquiryOptions, TaskResult, GraphRoutine, SchemaDefinition, Actor, SignalBroker, InquiryBroker, GraphRunner, GraphRegistry, CadenzaMode, EmitOptions, Intent, RuntimeValidationPolicy, RuntimeValidationScope, TaskOptions, ActorSpec, ActorFactoryOptions, ActorDefinition, TaskFunction, HelperFunction, HelperDefinition, GlobalDefinition, DebounceOptions, DebounceTask, EphemeralTaskOptions, EphemeralTask } from '@cadenza.io/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a task that delegates execution of a routine to a remote system or service.
|
|
@@ -38,6 +38,7 @@ declare class DeputyTask extends Task {
|
|
|
38
38
|
* @return {void} This constructor does not return a value.
|
|
39
39
|
*/
|
|
40
40
|
constructor(name: string, remoteRoutineName: string, serviceName?: string | undefined, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: Schema | undefined, validateInputContext?: boolean, outputSchema?: Schema | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
41
|
+
clone(): never;
|
|
41
42
|
/**
|
|
42
43
|
* Executes the specified task function within the provided execution context.
|
|
43
44
|
*
|
|
@@ -142,6 +143,7 @@ declare class DatabaseTask extends DeputyTask {
|
|
|
142
143
|
* @return {void}
|
|
143
144
|
*/
|
|
144
145
|
constructor(name: string, taskName: string, serviceName: string | undefined, description: string | undefined, queryData: DbOperationPayload, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: Schema | undefined, validateInputContext?: boolean, outputSchema?: Schema | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
146
|
+
clone(): never;
|
|
145
147
|
/**
|
|
146
148
|
* Executes the specified task within the given context.
|
|
147
149
|
*
|
|
@@ -235,6 +237,14 @@ interface ServiceInstanceDescriptor {
|
|
|
235
237
|
serviceName: string;
|
|
236
238
|
numberOfRunningGraphs?: number;
|
|
237
239
|
isPrimary: boolean;
|
|
240
|
+
leaseStatus?: "active" | "non_responsive" | "inactive" | "deleted";
|
|
241
|
+
leaseExpiresAt?: string;
|
|
242
|
+
lastLeaseRenewedAt?: string;
|
|
243
|
+
isReady?: boolean;
|
|
244
|
+
readinessReason?: string | null;
|
|
245
|
+
lastReadyAt?: string | null;
|
|
246
|
+
lastObservedTransportAt?: string | null;
|
|
247
|
+
shutdownRequestedAt?: string | null;
|
|
238
248
|
isActive: boolean;
|
|
239
249
|
isNonResponsive: boolean;
|
|
240
250
|
isBlocked: boolean;
|
|
@@ -331,6 +341,7 @@ declare class ServiceRegistry {
|
|
|
331
341
|
private readonly runtimeStatusHeartbeatIntervalMs;
|
|
332
342
|
private readonly runtimeMetricsSampleIntervalMs;
|
|
333
343
|
private readonly runtimeStatusRestRefreshIntervalMs;
|
|
344
|
+
private readonly runtimeStatusLoopJitterRatio;
|
|
334
345
|
private readonly runtimeStatusMissThreshold;
|
|
335
346
|
private readonly runtimeStatusFallbackTimeoutMs;
|
|
336
347
|
private readonly runtimeStatusAuthorityReportTimeoutMs;
|
|
@@ -343,6 +354,8 @@ declare class ServiceRegistry {
|
|
|
343
354
|
private readonly routeFailurePenaltyMs;
|
|
344
355
|
private readonly degradedGraphThreshold;
|
|
345
356
|
private readonly overloadedGraphThreshold;
|
|
357
|
+
private readonly bootstrapFullSyncRetryJitterRatio;
|
|
358
|
+
private readonly serviceCommunicationRetryJitterRatio;
|
|
346
359
|
serviceName: string | null;
|
|
347
360
|
serviceInstanceId: string | null;
|
|
348
361
|
numberOfRunningGraphs: number;
|
|
@@ -358,6 +371,10 @@ declare class ServiceRegistry {
|
|
|
358
371
|
private knownGlobalSignalMaps;
|
|
359
372
|
private authorityBootstrapRoute;
|
|
360
373
|
private authorityBootstrapHandshakeInFlight;
|
|
374
|
+
private authorityBootstrapHandshakeRetryTimer;
|
|
375
|
+
private authorityBootstrapHandshakeRetryIndex;
|
|
376
|
+
private authorityBootstrapHandshakeRetryGeneration;
|
|
377
|
+
private authorityBootstrapHandshakeRetryReason;
|
|
361
378
|
handleInstanceUpdateTask: Task;
|
|
362
379
|
handleTransportUpdateTask: Task;
|
|
363
380
|
handleGlobalSignalRegistrationTask: Task;
|
|
@@ -400,6 +417,13 @@ declare class ServiceRegistry {
|
|
|
400
417
|
private getAuthorityBootstrapRestTarget;
|
|
401
418
|
hasAuthorityBootstrapHandshakeEstablished(): boolean;
|
|
402
419
|
private invalidateAuthorityBootstrapHandshake;
|
|
420
|
+
private clearAuthorityBootstrapHandshakeRetryTimer;
|
|
421
|
+
private invalidateAuthorityBootstrapHandshakeRetryState;
|
|
422
|
+
private markAuthorityBootstrapHandshakeSatisfied;
|
|
423
|
+
private buildJitteredAuthorityBootstrapHandshakeRetryDelayMs;
|
|
424
|
+
private scheduleAuthorityBootstrapHandshakeRetry;
|
|
425
|
+
private restartAuthorityBootstrapHandshakeRetryChain;
|
|
426
|
+
private restartAuthorityBootstrapRecovery;
|
|
403
427
|
private requestAuthorityBootstrapHandshake;
|
|
404
428
|
private invokeAuthorityBootstrapRoutine;
|
|
405
429
|
private registerRemoteIntentDeputy;
|
|
@@ -410,6 +434,9 @@ declare class ServiceRegistry {
|
|
|
410
434
|
ensureBootstrapAuthorityControlPlaneForInquiry(intentName: string, ctx?: AnyObject): boolean;
|
|
411
435
|
private ensureBootstrapAuthorityControlPlane;
|
|
412
436
|
private hasBootstrapFullSyncDeputies;
|
|
437
|
+
private buildDeterministicInstanceJitterKey;
|
|
438
|
+
private buildJitteredIntervalStartDate;
|
|
439
|
+
private buildJitteredBootstrapRetryDelayMs;
|
|
413
440
|
private ensureAuthorityBootstrapSignalTransmissions;
|
|
414
441
|
private clearBootstrapFullSyncRetryTimer;
|
|
415
442
|
private invalidateBootstrapFullSyncRetryState;
|
|
@@ -466,6 +493,8 @@ declare class ServiceRegistry {
|
|
|
466
493
|
private recordRoutingFailure;
|
|
467
494
|
private clearRoutingCooldown;
|
|
468
495
|
private hasRouteableInstanceForRouting;
|
|
496
|
+
private hasPendingRouteableInstanceForSelection;
|
|
497
|
+
private maybeSchedulePendingRouteSelectionRetry;
|
|
469
498
|
private refreshRoutingCooldownsForService;
|
|
470
499
|
private buildTransportFailureKey;
|
|
471
500
|
private clearTransportFailureState;
|
|
@@ -968,6 +997,23 @@ type ServiceManifestRoutineDefinition = {
|
|
|
968
997
|
service_name: string;
|
|
969
998
|
is_meta: boolean;
|
|
970
999
|
};
|
|
1000
|
+
type ServiceManifestHelperDefinition = {
|
|
1001
|
+
name: string;
|
|
1002
|
+
version: number;
|
|
1003
|
+
description: string;
|
|
1004
|
+
service_name: string;
|
|
1005
|
+
is_meta: boolean;
|
|
1006
|
+
handler_source: string;
|
|
1007
|
+
language: "js" | "ts";
|
|
1008
|
+
};
|
|
1009
|
+
type ServiceManifestGlobalDefinition = {
|
|
1010
|
+
name: string;
|
|
1011
|
+
version: number;
|
|
1012
|
+
description: string;
|
|
1013
|
+
service_name: string;
|
|
1014
|
+
is_meta: boolean;
|
|
1015
|
+
value: unknown;
|
|
1016
|
+
};
|
|
971
1017
|
type ServiceManifestDirectionalTaskMap = {
|
|
972
1018
|
task_name: string;
|
|
973
1019
|
task_version: number;
|
|
@@ -1006,6 +1052,38 @@ type ServiceManifestTaskRoutineMap = {
|
|
|
1006
1052
|
routine_version: number;
|
|
1007
1053
|
service_name: string;
|
|
1008
1054
|
};
|
|
1055
|
+
type ServiceManifestTaskHelperMap = {
|
|
1056
|
+
task_name: string;
|
|
1057
|
+
task_version: number;
|
|
1058
|
+
service_name: string;
|
|
1059
|
+
alias: string;
|
|
1060
|
+
helper_name: string;
|
|
1061
|
+
helper_version: number;
|
|
1062
|
+
};
|
|
1063
|
+
type ServiceManifestHelperHelperMap = {
|
|
1064
|
+
helper_name: string;
|
|
1065
|
+
helper_version: number;
|
|
1066
|
+
service_name: string;
|
|
1067
|
+
alias: string;
|
|
1068
|
+
dependency_helper_name: string;
|
|
1069
|
+
dependency_helper_version: number;
|
|
1070
|
+
};
|
|
1071
|
+
type ServiceManifestTaskGlobalMap = {
|
|
1072
|
+
task_name: string;
|
|
1073
|
+
task_version: number;
|
|
1074
|
+
service_name: string;
|
|
1075
|
+
alias: string;
|
|
1076
|
+
global_name: string;
|
|
1077
|
+
global_version: number;
|
|
1078
|
+
};
|
|
1079
|
+
type ServiceManifestHelperGlobalMap = {
|
|
1080
|
+
helper_name: string;
|
|
1081
|
+
helper_version: number;
|
|
1082
|
+
service_name: string;
|
|
1083
|
+
alias: string;
|
|
1084
|
+
global_name: string;
|
|
1085
|
+
global_version: number;
|
|
1086
|
+
};
|
|
1009
1087
|
type ServiceManifestSnapshot = {
|
|
1010
1088
|
serviceName: string;
|
|
1011
1089
|
serviceInstanceId: string;
|
|
@@ -1018,11 +1096,17 @@ type ServiceManifestSnapshot = {
|
|
|
1018
1096
|
intents: ServiceManifestIntentDefinition[];
|
|
1019
1097
|
actors: ServiceManifestActorDefinition[];
|
|
1020
1098
|
routines: ServiceManifestRoutineDefinition[];
|
|
1099
|
+
helpers: ServiceManifestHelperDefinition[];
|
|
1100
|
+
globals: ServiceManifestGlobalDefinition[];
|
|
1021
1101
|
directionalTaskMaps: ServiceManifestDirectionalTaskMap[];
|
|
1022
1102
|
signalToTaskMaps: ServiceManifestSignalTaskMap[];
|
|
1023
1103
|
intentToTaskMaps: ServiceManifestIntentTaskMap[];
|
|
1024
1104
|
actorTaskMaps: ServiceManifestActorTaskMap[];
|
|
1025
1105
|
taskToRoutineMaps: ServiceManifestTaskRoutineMap[];
|
|
1106
|
+
taskToHelperMaps: ServiceManifestTaskHelperMap[];
|
|
1107
|
+
helperToHelperMaps: ServiceManifestHelperHelperMap[];
|
|
1108
|
+
taskToGlobalMaps: ServiceManifestTaskGlobalMap[];
|
|
1109
|
+
helperToGlobalMaps: ServiceManifestHelperGlobalMap[];
|
|
1026
1110
|
};
|
|
1027
1111
|
|
|
1028
1112
|
type SecurityProfile = "low" | "medium" | "high";
|
|
@@ -1070,6 +1154,7 @@ declare class CadenzaService {
|
|
|
1070
1154
|
protected static isBootstrapped: boolean;
|
|
1071
1155
|
protected static serviceCreated: boolean;
|
|
1072
1156
|
protected static bootstrapSyncCompleted: boolean;
|
|
1157
|
+
protected static bootstrapSyncCompletedAt: number;
|
|
1073
1158
|
protected static bootstrapSignalRegistrationsCompleted: boolean;
|
|
1074
1159
|
protected static bootstrapIntentRegistrationsCompleted: boolean;
|
|
1075
1160
|
protected static defaultDatabaseServiceName: string | null;
|
|
@@ -1078,9 +1163,17 @@ declare class CadenzaService {
|
|
|
1078
1163
|
protected static frontendSyncScheduled: boolean;
|
|
1079
1164
|
protected static serviceManifestRevision: number;
|
|
1080
1165
|
protected static lastPublishedServiceManifestHashes: Partial<Record<ServiceManifestPublicationLayer, string>>;
|
|
1166
|
+
protected static serviceManifestPublishedAt: Partial<Record<ServiceManifestPublicationLayer, number>>;
|
|
1081
1167
|
protected static serviceManifestPublicationInFlight: boolean;
|
|
1082
1168
|
protected static serviceManifestPublicationPendingReason: string | null;
|
|
1083
1169
|
protected static serviceManifestPublicationPendingLayer: ServiceManifestPublicationLayer | null;
|
|
1170
|
+
protected static serviceManifestPublicationRetryReason: string | null;
|
|
1171
|
+
protected static serviceManifestPublicationRetryLayer: ServiceManifestPublicationLayer | null;
|
|
1172
|
+
protected static serviceManifestPublicationRetryTimer: ReturnType<typeof setTimeout> | null;
|
|
1173
|
+
protected static serviceManifestPublicationRetryCount: number;
|
|
1174
|
+
protected static localServiceManifestDefinitionInserted: boolean;
|
|
1175
|
+
protected static localServiceManifestInstanceInserted: boolean;
|
|
1176
|
+
protected static initialServiceManifestPublicationRequested: boolean;
|
|
1084
1177
|
private static shutdownHandlersRegistered;
|
|
1085
1178
|
private static shutdownInFlight;
|
|
1086
1179
|
private static shutdownHandlerCleanup;
|
|
@@ -1090,11 +1183,27 @@ declare class CadenzaService {
|
|
|
1090
1183
|
private static replayRegisteredTaskSignalObservations;
|
|
1091
1184
|
private static replayRegisteredTaskGraphMetadata;
|
|
1092
1185
|
private static normalizeServiceManifestPublicationLayer;
|
|
1186
|
+
private static clampServiceManifestPublicationLayer;
|
|
1093
1187
|
private static mergeServiceManifestPublicationRequest;
|
|
1188
|
+
private static getServiceManifestPublicationGate;
|
|
1094
1189
|
private static requestServiceManifestPublication;
|
|
1095
1190
|
private static scheduleServiceManifestPublicationRetry;
|
|
1191
|
+
private static shouldPublishBusinessManifestForTaskContext;
|
|
1192
|
+
private static isRoutingCriticalManifestSignalName;
|
|
1193
|
+
private static isRoutingCriticalManifestIntentName;
|
|
1194
|
+
private static isRoutingCriticalManifestTask;
|
|
1195
|
+
private static hasRoutingCriticalManifestBindingInContext;
|
|
1196
|
+
private static shouldPublishBusinessManifestForHelperContext;
|
|
1197
|
+
private static shouldPublishBusinessManifestForGlobalContext;
|
|
1198
|
+
private static shouldPublishBusinessManifestForRoutineContext;
|
|
1199
|
+
private static shouldRequestServiceManifestPublicationForSignal;
|
|
1200
|
+
private static maybeRequestInitialServiceManifestPublication;
|
|
1201
|
+
private static scheduleInitialServiceManifestPublicationFallback;
|
|
1096
1202
|
private static publishServiceManifestIfNeeded;
|
|
1097
1203
|
private static ensureServiceManifestPublicationTasks;
|
|
1204
|
+
private static isLocalAuthorityService;
|
|
1205
|
+
private static canPublishServiceManifestToAuthority;
|
|
1206
|
+
private static shouldRequireAuthorityBootstrapHandshakeForManifestPublication;
|
|
1098
1207
|
private static buildLegacyLocalCadenzaDBTaskName;
|
|
1099
1208
|
private static buildGeneratedLocalCadenzaDBTaskName;
|
|
1100
1209
|
/**
|
|
@@ -1521,6 +1630,12 @@ declare class CadenzaService {
|
|
|
1521
1630
|
* ```
|
|
1522
1631
|
*/
|
|
1523
1632
|
static createTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
1633
|
+
static createHelper(name: string, func: HelperFunction, description?: string): HelperDefinition;
|
|
1634
|
+
static createMetaHelper(name: string, func: HelperFunction, description?: string): HelperDefinition;
|
|
1635
|
+
static createHelperFromDefinition(definition: Parameters<typeof _cadenza_io_core__default.createHelperFromDefinition>[0]): HelperDefinition;
|
|
1636
|
+
static createGlobal(name: string, value: unknown, description?: string): GlobalDefinition;
|
|
1637
|
+
static createMetaGlobal(name: string, value: unknown, description?: string): GlobalDefinition;
|
|
1638
|
+
static createGlobalFromDefinition(definition: Parameters<typeof _cadenza_io_core__default.createGlobalFromDefinition>[0]): GlobalDefinition;
|
|
1524
1639
|
/**
|
|
1525
1640
|
* Creates a meta task with the specified name, functionality, description, and options.
|
|
1526
1641
|
* This is used for creating tasks that lives on the meta layer.
|
|
@@ -1796,4 +1911,4 @@ declare class CadenzaService {
|
|
|
1796
1911
|
static reset(): void;
|
|
1797
1912
|
}
|
|
1798
1913
|
|
|
1799
|
-
export {
|
|
1914
|
+
export { RUNTIME_STATUS_AUTHORITY_SYNC_REQUESTED_SIGNAL as $, AUTHORITY_RUNTIME_STATUS_REPORT_INTENT as A, type BootstrapOptions as B, CadenzaService as C, type DatabaseSchemaDefinition as D, type BrowserRuntimeActorHandle as E, type BrowserRuntimeActorOptions as F, type BrowserRuntimeActorRuntimeState as G, type HydrationOptions as H, type BrowserRuntimeProjectionBinding as I, type JoinDefinition as J, type BrowserRuntimeServiceOptions as K, type DatabaseMigrationConstraintDefinition as L, type DatabaseMigrationDefinition as M, type DatabaseMigrationPolicy as N, type DatabaseMigrationStep as O, DatabaseTask as P, type DbOperationType$1 as Q, type DeputyDescriptor as R, type ServerOptions as S, DeputyTask as T, type DistributedInquiryMeta as U, type FieldDefinition as V, type InquiryResponderDescriptor as W, type InquiryResponderStatus as X, type NetworkMode as Y, type OpEffect as Z, type QueryMode as _, type DatabaseOptions as a, type ResolvedBootstrapEndpoint as a0, type RuntimeMetricsHealthDetail as a1, type SecurityProfile as a2, type ServiceInstanceDescriptor as a3, type ServiceTransportConfig as a4, type ServiceTransportDescriptor as a5, type ServiceTransportProtocol as a6, type ServiceTransportRole as a7, type ServiceTransportSecurityProfile as a8, SignalTransmissionTask as a9, type SortDirection as aa, type SubOperationType as ab, type TableDefinition as ac, type ValueOrSubOp as ad, buildAuthorityRuntimeStatusSignature as ae, normalizeAuthorityRuntimeStatusReport as af, type DbOperationPayload as b, type SubOperation as c, type DistributedInquiryOptions as d, type ServiceManifestSnapshot as e, type ServiceManifestPublicationLayer as f, type ServiceManifestTaskDefinition as g, type ServiceManifestSignalDefinition as h, type ServiceManifestIntentDefinition as i, type ServiceManifestActorDefinition as j, type ServiceManifestRoutineDefinition as k, type ServiceManifestHelperDefinition as l, type ServiceManifestGlobalDefinition as m, type ServiceManifestDirectionalTaskMap as n, type ServiceManifestSignalTaskMap as o, type ServiceManifestIntentTaskMap as p, type ServiceManifestActorTaskMap as q, type ServiceManifestTaskRoutineMap as r, type ServiceManifestTaskHelperMap as s, type ServiceManifestHelperHelperMap as t, type ServiceManifestTaskGlobalMap as u, type ServiceManifestHelperGlobalMap as v, ServiceRegistry as w, type AggregateDefinition as x, type AggregateFunction as y, type AuthorityRuntimeStatusReport as z };
|