@bluelibs/runner 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.cjs +452 -249
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +452 -249
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +452 -249
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +452 -249
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +4047 -3842
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +4047 -3842
- package/dist/node/node.mjs.map +1 -1
- package/dist/types/definers/assertDefinitionId.d.ts +1 -0
- package/dist/types/definers/builders/resource/index.d.ts +1 -3
- package/dist/types/definers/builders/resource/types.d.ts +0 -1
- package/dist/types/errors/domain-error-ids.d.ts +0 -2
- package/dist/types/errors/domain-runtime.errors.d.ts +0 -6
- package/dist/types/globals/globalResources.d.ts +4 -4
- package/dist/types/globals/middleware/keyBuilder.shared.d.ts +2 -0
- package/dist/types/globals/middleware/rateLimit.middleware.d.ts +8 -2
- package/dist/types/globals/middleware/temporal.middleware.d.ts +7 -26
- package/dist/types/globals/middleware/temporal.shared.d.ts +28 -0
- package/dist/types/models/Store.d.ts +1 -1
- package/dist/types/models/StoreRegistry.d.ts +3 -0
- package/dist/types/models/createFrameworkRootGateway.d.ts +3 -1
- package/dist/types/models/store-registry/CanonicalIdCompiler.d.ts +8 -0
- package/dist/types/models/store-registry/OwnerScope.d.ts +5 -0
- package/dist/types/models/store-registry/StoreRegistryWriter.d.ts +6 -3
- package/dist/types/models/store-registry/registerableKind.d.ts +19 -0
- package/dist/types/node/node.d.ts +2 -2
- package/dist/types/node/rpc-lanes/rpcLanes.resource.d.ts +1 -0
- package/dist/types/public.d.ts +10 -189
- package/dist/types/types/resource.d.ts +0 -9
- package/dist/types/types/subtree.d.ts +4 -2
- package/dist/universal/index.cjs +452 -249
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs +452 -249
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readmes/AI.md +21 -18
package/dist/edge/index.mjs
CHANGED
|
@@ -290,6 +290,9 @@ var init_isSameDefinition = __esm({
|
|
|
290
290
|
function isReservedDefinitionLocalName(name) {
|
|
291
291
|
return reservedDefinitionLocalNameSet.has(name);
|
|
292
292
|
}
|
|
293
|
+
function isReservedInternalDefinitionId(id3) {
|
|
294
|
+
return reservedInternalDefinitionIdSet.has(id3);
|
|
295
|
+
}
|
|
293
296
|
function canUseFrameworkDottedId(definitionId, allowReservedDottedNamespace) {
|
|
294
297
|
if (!allowReservedDottedNamespace) {
|
|
295
298
|
return false;
|
|
@@ -298,6 +301,9 @@ function canUseFrameworkDottedId(definitionId, allowReservedDottedNamespace) {
|
|
|
298
301
|
(prefix) => definitionId.startsWith(prefix)
|
|
299
302
|
);
|
|
300
303
|
}
|
|
304
|
+
function canUseReservedInternalDefinitionId(allowReservedInternalId) {
|
|
305
|
+
return allowReservedInternalId === true;
|
|
306
|
+
}
|
|
301
307
|
function toDisplayId(value) {
|
|
302
308
|
if (typeof value === "string") {
|
|
303
309
|
return value.length > 0 ? value : "<empty>";
|
|
@@ -340,8 +346,15 @@ function assertDefinitionId(definitionType, id3, options) {
|
|
|
340
346
|
originalError: `${definitionType} id "${definitionId}" is reserved by Runner and cannot be used as a standalone id.`
|
|
341
347
|
});
|
|
342
348
|
}
|
|
349
|
+
if (isReservedInternalDefinitionId(definitionId) && !canUseReservedInternalDefinitionId(options?.allowReservedInternalId)) {
|
|
350
|
+
validationError.throw({
|
|
351
|
+
subject: `${definitionType} id`,
|
|
352
|
+
id: definitionId,
|
|
353
|
+
originalError: `${definitionType} id "${definitionId}" is reserved for internal Runner resources.`
|
|
354
|
+
});
|
|
355
|
+
}
|
|
343
356
|
}
|
|
344
|
-
var RESERVED_DEFINITION_LOCAL_NAMES, FRAMEWORK_DOTTED_ID_PREFIXES, reservedDefinitionLocalNameSet;
|
|
357
|
+
var RESERVED_DEFINITION_LOCAL_NAMES, RESERVED_INTERNAL_DEFINITION_IDS, FRAMEWORK_DOTTED_ID_PREFIXES, reservedDefinitionLocalNameSet, reservedInternalDefinitionIdSet;
|
|
345
358
|
var init_assertDefinitionId = __esm({
|
|
346
359
|
"src/definers/assertDefinitionId.ts"() {
|
|
347
360
|
init_errors2();
|
|
@@ -354,6 +367,9 @@ var init_assertDefinitionId = __esm({
|
|
|
354
367
|
"errors",
|
|
355
368
|
"asyncContexts"
|
|
356
369
|
]);
|
|
370
|
+
RESERVED_INTERNAL_DEFINITION_IDS = Object.freeze([
|
|
371
|
+
"runtime-framework-root"
|
|
372
|
+
]);
|
|
357
373
|
FRAMEWORK_DOTTED_ID_PREFIXES = Object.freeze([
|
|
358
374
|
"runner.",
|
|
359
375
|
"system."
|
|
@@ -361,8 +377,13 @@ var init_assertDefinitionId = __esm({
|
|
|
361
377
|
reservedDefinitionLocalNameSet = new Set(
|
|
362
378
|
RESERVED_DEFINITION_LOCAL_NAMES
|
|
363
379
|
);
|
|
380
|
+
reservedInternalDefinitionIdSet = new Set(
|
|
381
|
+
RESERVED_INTERNAL_DEFINITION_IDS
|
|
382
|
+
);
|
|
364
383
|
__name(isReservedDefinitionLocalName, "isReservedDefinitionLocalName");
|
|
384
|
+
__name(isReservedInternalDefinitionId, "isReservedInternalDefinitionId");
|
|
365
385
|
__name(canUseFrameworkDottedId, "canUseFrameworkDottedId");
|
|
386
|
+
__name(canUseReservedInternalDefinitionId, "canUseReservedInternalDefinitionId");
|
|
366
387
|
__name(toDisplayId, "toDisplayId");
|
|
367
388
|
__name(requireStringId, "requireStringId");
|
|
368
389
|
__name(assertDefinitionId, "assertDefinitionId");
|
|
@@ -3516,8 +3537,6 @@ var init_domain_error_ids = __esm({
|
|
|
3516
3537
|
RunnerErrorId2["RpcLaneOwnershipConflict"] = "runner.errors.rpcLane.ownershipConflict";
|
|
3517
3538
|
RunnerErrorId2["RpcLaneExposureOwnerInvalid"] = "runner.errors.rpcLane.exposureOwnerInvalid";
|
|
3518
3539
|
RunnerErrorId2["ResourceForkNonLeafUnsupported"] = "runner.errors.resourceFork.nonLeafUnsupported";
|
|
3519
|
-
RunnerErrorId2["ResourceForkGatewayUnsupported"] = "runner.errors.resourceFork.gatewayUnsupported";
|
|
3520
|
-
RunnerErrorId2["RunRootGatewayUnsupported"] = "runner.errors.run.rootGatewayUnsupported";
|
|
3521
3540
|
RunnerErrorId2["BuilderInvalidHttpCode"] = "runner.errors.builder.invalidHttpCode";
|
|
3522
3541
|
RunnerErrorId2["OverrideUnsupportedBase"] = "runner.errors.override.unsupportedBase";
|
|
3523
3542
|
RunnerErrorId2["OverrideDefinitionRequired"] = "runner.errors.overrideDefinitionRequired";
|
|
@@ -3551,7 +3570,7 @@ var init_domain_error_ids = __esm({
|
|
|
3551
3570
|
});
|
|
3552
3571
|
|
|
3553
3572
|
// src/errors/domain-runtime.errors.ts
|
|
3554
|
-
var httpBaseUrlRequiredError, httpFetchUnavailableError, httpContextSerializationError, httpEventWithResultUnavailableError, httpClientInputUnsupportedError, middlewareConcurrencyConflictError, middlewareContextRequiredError, middlewareTimeoutError, middlewareCircuitBreakerOpenError, middlewareRateLimitExceededError, middlewareTemporalDisposedError, rpcLaneHttpClientPresetNotFoundError, rpcLaneCommunicatorContractError, rpcLaneInvalidIdError, rpcLaneProfileNotFoundError, rpcLaneBindingNotFoundError, rpcLaneDuplicateBindingError, rpcLaneTaskAssignmentConflictError, rpcLaneEventAssignmentConflictError, rpcLaneApplyToInvalidTargetError, rpcLaneApplyToTargetTypeError, rpcLaneApplyToTargetNotFoundError, rpcLaneAssignmentEventLaneConflictError, rpcLaneCommunicatorResourceInvalidError, rpcLanesExposureModeError, rpcLanesExposureOwnerInvalidError, remoteLaneAuthSignerMissingError, remoteLaneAuthVerifierMissingError, remoteLaneAuthUnauthorizedError, resourceForkNonLeafUnsupportedError,
|
|
3573
|
+
var httpBaseUrlRequiredError, httpFetchUnavailableError, httpContextSerializationError, httpEventWithResultUnavailableError, httpClientInputUnsupportedError, middlewareConcurrencyConflictError, middlewareContextRequiredError, middlewareTimeoutError, middlewareCircuitBreakerOpenError, middlewareRateLimitExceededError, middlewareTemporalDisposedError, rpcLaneHttpClientPresetNotFoundError, rpcLaneCommunicatorContractError, rpcLaneInvalidIdError, rpcLaneProfileNotFoundError, rpcLaneBindingNotFoundError, rpcLaneDuplicateBindingError, rpcLaneTaskAssignmentConflictError, rpcLaneEventAssignmentConflictError, rpcLaneApplyToInvalidTargetError, rpcLaneApplyToTargetTypeError, rpcLaneApplyToTargetNotFoundError, rpcLaneAssignmentEventLaneConflictError, rpcLaneCommunicatorResourceInvalidError, rpcLanesExposureModeError, rpcLanesExposureOwnerInvalidError, remoteLaneAuthSignerMissingError, remoteLaneAuthVerifierMissingError, remoteLaneAuthUnauthorizedError, resourceForkNonLeafUnsupportedError, builderInvalidHttpCodeError, overrideUnsupportedBaseError, platformUnreachableError, platformInvariantError, serializerInvalidPayloadError, serializerValidationError, serializerPayloadValidationError, serializerDepthExceededError, serializerReferenceResolutionError, serializerUnsupportedFeatureError, serializerTypeRegistryError, serializerSymbolPolicyError, nodeInputFileConsumedError, nodeInputFileUnavailableError, nodeExposureMultipartLimitExceededError, optionalDependencyInvalidExportError, optionalDependencyMissingError, durableStoreShapeError, durableQueueNotInitializedError, eventLaneQueueNotInitializedError, eventLaneInvalidIdError, eventLaneProfileNotFoundError, eventLaneBindingNotFoundError, eventLaneDuplicateBindingError, eventLaneRetryPolicyInvalidError, eventLaneQueueReferenceInvalidError, eventLaneAssignmentConflictError, eventLaneApplyToInvalidTargetError, eventLaneApplyToTargetTypeError, eventLaneApplyToTargetNotFoundError, eventLaneAssignmentRpcLaneConflictError, eventLaneEventNotRegisteredError, eventLaneMessageMalformedError, durableContextCancelledError, durableStepDefinitionError, durableDeterminismViolationError, durableSignalTimeoutError, durableScheduleConfigError, durableExecutionError, durableExecutionInvariantError, durableOperatorUnsupportedStoreCapabilityError, lockableMapLockedError;
|
|
3555
3574
|
var init_domain_runtime_errors = __esm({
|
|
3556
3575
|
"src/errors/domain-runtime.errors.ts"() {
|
|
3557
3576
|
init_error2();
|
|
@@ -3667,7 +3686,7 @@ var init_domain_runtime_errors = __esm({
|
|
|
3667
3686
|
'Use mode: "network" when enabling exposure.http, or remove exposure.http for transparent/local-simulated modes.'
|
|
3668
3687
|
).build();
|
|
3669
3688
|
rpcLanesExposureOwnerInvalidError = frameworkError("runner.errors.rpcLane.exposureOwnerInvalid" /* RpcLaneExposureOwnerInvalid */).format(
|
|
3670
|
-
({ ownerResourceId }) => `RPC HTTP exposure can only be owned by "
|
|
3689
|
+
({ ownerResourceId }) => `RPC HTTP exposure can only be owned by "runner.node.rpcLanes". Received owner "${ownerResourceId}".`
|
|
3671
3690
|
).remediation(
|
|
3672
3691
|
"Start RPC HTTP exposure only through rpcLanesResource.with({ exposure: { http: ... } }) in network mode."
|
|
3673
3692
|
).build();
|
|
@@ -3691,16 +3710,6 @@ var init_domain_runtime_errors = __esm({
|
|
|
3691
3710
|
).remediation(
|
|
3692
3711
|
({ id: id3 }) => `Do not call .fork() on non-leaf resource "${id3}". Compose a distinct parent resource and register distinct children explicitly. Use a dedicated factory API when the template owns a registered subtree.`
|
|
3693
3712
|
).build();
|
|
3694
|
-
resourceForkGatewayUnsupportedError = frameworkError("runner.errors.resourceFork.gatewayUnsupported" /* ResourceForkGatewayUnsupported */).format(
|
|
3695
|
-
({ id: id3 }) => `Resource "${id3}" cannot be forked because gateway resources suppress their own namespace segment.`
|
|
3696
|
-
).remediation(
|
|
3697
|
-
({ id: id3 }) => `Do not call .fork() on gateway resource "${id3}". Register a distinct non-gateway resource, or compose separate gateway resources with unique registered children instead.`
|
|
3698
|
-
).build();
|
|
3699
|
-
runRootGatewayUnsupportedError = frameworkError("runner.errors.run.rootGatewayUnsupported" /* RunRootGatewayUnsupported */).format(
|
|
3700
|
-
({ id: id3 }) => `Resource "${id3}" cannot be passed to run() because gateway resources are structural-only.`
|
|
3701
|
-
).remediation(
|
|
3702
|
-
({ id: id3 }) => `Wrap gateway resource "${id3}" in a distinct non-gateway root resource, then call run(root) instead.`
|
|
3703
|
-
).build();
|
|
3704
3713
|
builderInvalidHttpCodeError = frameworkError("runner.errors.builder.invalidHttpCode" /* BuilderInvalidHttpCode */).format(
|
|
3705
3714
|
({ value }) => `Error httpCode must be an integer between 100 and 599. Received: ${value}`
|
|
3706
3715
|
).remediation(
|
|
@@ -3967,7 +3976,6 @@ __export(errors_exports, {
|
|
|
3967
3976
|
remoteLaneAuthUnauthorizedError: () => remoteLaneAuthUnauthorizedError,
|
|
3968
3977
|
remoteLaneAuthVerifierMissingError: () => remoteLaneAuthVerifierMissingError,
|
|
3969
3978
|
resourceCooldownAdmissionTargetInvalidError: () => resourceCooldownAdmissionTargetInvalidError,
|
|
3970
|
-
resourceForkGatewayUnsupportedError: () => resourceForkGatewayUnsupportedError,
|
|
3971
3979
|
resourceForkNonLeafUnsupportedError: () => resourceForkNonLeafUnsupportedError,
|
|
3972
3980
|
resourceNotFoundError: () => resourceNotFoundError,
|
|
3973
3981
|
resultSchemaValidationError: () => resultSchemaValidationError,
|
|
@@ -3989,7 +3997,6 @@ __export(errors_exports, {
|
|
|
3989
3997
|
rpcLanesExposureOwnerInvalidError: () => rpcLanesExposureOwnerInvalidError,
|
|
3990
3998
|
runResultDisposeDuringBootstrapError: () => runResultDisposeDuringBootstrapError,
|
|
3991
3999
|
runResultDisposedError: () => runResultDisposedError,
|
|
3992
|
-
runRootGatewayUnsupportedError: () => runRootGatewayUnsupportedError,
|
|
3993
4000
|
runtimeAccessViolationError: () => runtimeAccessViolationError,
|
|
3994
4001
|
runtimeAdmissionControlDuringBootstrapError: () => runtimeAdmissionControlDuringBootstrapError,
|
|
3995
4002
|
runtimeAdmissionsPausedError: () => runtimeAdmissionsPausedError,
|
|
@@ -4610,6 +4617,21 @@ function normalizeResourceSubtreePolicy(policy) {
|
|
|
4610
4617
|
return normalized;
|
|
4611
4618
|
}
|
|
4612
4619
|
__name(normalizeResourceSubtreePolicy, "normalizeResourceSubtreePolicy");
|
|
4620
|
+
function toSubtreePolicyArray(policy) {
|
|
4621
|
+
if (policy === void 0) {
|
|
4622
|
+
return [];
|
|
4623
|
+
}
|
|
4624
|
+
return Array.isArray(policy) ? [...policy] : [policy];
|
|
4625
|
+
}
|
|
4626
|
+
__name(toSubtreePolicyArray, "toSubtreePolicyArray");
|
|
4627
|
+
function mergeSubtreePolicyList(existing, incoming, options) {
|
|
4628
|
+
let merged = cloneNormalizedSubtreePolicy(existing);
|
|
4629
|
+
for (const policy of toSubtreePolicyArray(incoming)) {
|
|
4630
|
+
merged = mergeResourceSubtreePolicy(merged, policy, options);
|
|
4631
|
+
}
|
|
4632
|
+
return merged;
|
|
4633
|
+
}
|
|
4634
|
+
__name(mergeSubtreePolicyList, "mergeSubtreePolicyList");
|
|
4613
4635
|
function mergeSubtreeMiddlewareBranch(existing, incoming, override) {
|
|
4614
4636
|
if (!existing || override) {
|
|
4615
4637
|
return {
|
|
@@ -4729,8 +4751,8 @@ __name(mergeResourceSubtreeDeclarations, "mergeResourceSubtreeDeclarations");
|
|
|
4729
4751
|
function resolveResourceSubtreeDeclarations(declarations, config) {
|
|
4730
4752
|
let merged;
|
|
4731
4753
|
for (const declaration of declarations ?? []) {
|
|
4732
|
-
const
|
|
4733
|
-
merged =
|
|
4754
|
+
const policyList = typeof declaration.policy === "function" ? declaration.policy(config) : declaration.policy;
|
|
4755
|
+
merged = mergeSubtreePolicyList(merged, policyList, declaration.options);
|
|
4734
4756
|
}
|
|
4735
4757
|
return merged;
|
|
4736
4758
|
}
|
|
@@ -4745,7 +4767,7 @@ function createDisplaySubtreePolicy(declarations) {
|
|
|
4745
4767
|
if (!hasDynamic) {
|
|
4746
4768
|
let merged;
|
|
4747
4769
|
for (const declaration of declarations) {
|
|
4748
|
-
merged =
|
|
4770
|
+
merged = mergeSubtreePolicyList(
|
|
4749
4771
|
merged,
|
|
4750
4772
|
declaration.policy,
|
|
4751
4773
|
declaration.options
|
|
@@ -4909,7 +4931,8 @@ function defineResource(constConfig) {
|
|
|
4909
4931
|
const filePath = constConfig[symbolFilePath] || getCallerFile();
|
|
4910
4932
|
const id3 = constConfig.id;
|
|
4911
4933
|
assertDefinitionId("Resource", id3, {
|
|
4912
|
-
allowReservedDottedNamespace: isFrameworkDefinitionMarked(constConfig)
|
|
4934
|
+
allowReservedDottedNamespace: isFrameworkDefinitionMarked(constConfig),
|
|
4935
|
+
allowReservedInternalId: isFrameworkDefinitionMarked(constConfig)
|
|
4913
4936
|
});
|
|
4914
4937
|
const configSchema = normalizeOptionalValidationSchema(
|
|
4915
4938
|
constConfig.configSchema,
|
|
@@ -4935,7 +4958,6 @@ function defineResource(constConfig) {
|
|
|
4935
4958
|
[symbolResourceRegistersChildren]: constConfig.register !== void 0 ? true : void 0,
|
|
4936
4959
|
[symbolFilePath]: filePath,
|
|
4937
4960
|
id: id3,
|
|
4938
|
-
gateway: constConfig.gateway === true,
|
|
4939
4961
|
dependencies: constConfig.dependencies,
|
|
4940
4962
|
dispose: constConfig.dispose,
|
|
4941
4963
|
ready: constConfig.ready,
|
|
@@ -4982,8 +5004,7 @@ function defineResource(constConfig) {
|
|
|
4982
5004
|
isolate: current.isolate,
|
|
4983
5005
|
subtree: current.subtree,
|
|
4984
5006
|
[symbolResourceIsolateDeclarations]: current[symbolResourceIsolateDeclarations],
|
|
4985
|
-
[symbolResourceSubtreeDeclarations]: current[symbolResourceSubtreeDeclarations]
|
|
4986
|
-
gateway: current.gateway
|
|
5007
|
+
[symbolResourceSubtreeDeclarations]: current[symbolResourceSubtreeDeclarations]
|
|
4987
5008
|
}), "buildDefinition");
|
|
4988
5009
|
base.with = function(config) {
|
|
4989
5010
|
const current = resolveCurrent(this);
|
|
@@ -5020,9 +5041,6 @@ function defineResource(constConfig) {
|
|
|
5020
5041
|
if (current[symbolResourceRegistersChildren] === true) {
|
|
5021
5042
|
resourceForkNonLeafUnsupportedError.throw({ id: current.id });
|
|
5022
5043
|
}
|
|
5023
|
-
if (current.gateway === true) {
|
|
5024
|
-
resourceForkGatewayUnsupportedError.throw({ id: current.id });
|
|
5025
|
-
}
|
|
5026
5044
|
const forkCallerFilePath = getCallerFile();
|
|
5027
5045
|
const forked = defineResource({
|
|
5028
5046
|
...buildDefinition(current),
|
|
@@ -10157,9 +10175,15 @@ init_defineError();
|
|
|
10157
10175
|
init_errors2();
|
|
10158
10176
|
init_check();
|
|
10159
10177
|
init_symbols();
|
|
10178
|
+
|
|
10179
|
+
// src/globals/middleware/keyBuilder.shared.ts
|
|
10180
|
+
var defaultTaskKeyBuilder = /* @__PURE__ */ __name((taskId) => taskId, "defaultTaskKeyBuilder");
|
|
10181
|
+
|
|
10182
|
+
// src/globals/middleware/rateLimit.middleware.ts
|
|
10160
10183
|
var rateLimitConfigPattern = Match.ObjectIncluding({
|
|
10161
10184
|
windowMs: Match.PositiveInteger,
|
|
10162
|
-
max: Match.PositiveInteger
|
|
10185
|
+
max: Match.PositiveInteger,
|
|
10186
|
+
keyBuilder: Match.Optional(Function)
|
|
10163
10187
|
});
|
|
10164
10188
|
var RateLimitError = class extends RunnerError {
|
|
10165
10189
|
static {
|
|
@@ -10176,6 +10200,7 @@ var RateLimitError = class extends RunnerError {
|
|
|
10176
10200
|
);
|
|
10177
10201
|
}
|
|
10178
10202
|
};
|
|
10203
|
+
var RATE_LIMIT_STATE_PRUNE_THRESHOLD = 1e3;
|
|
10179
10204
|
var journalKeys3 = {
|
|
10180
10205
|
/** Number of remaining requests in the current window */
|
|
10181
10206
|
remaining: journal.createKey(
|
|
@@ -10201,6 +10226,17 @@ var rateLimitResource = defineResource(
|
|
|
10201
10226
|
}, "init")
|
|
10202
10227
|
})
|
|
10203
10228
|
);
|
|
10229
|
+
function pruneExpiredRateLimitStates(keyedStates, now) {
|
|
10230
|
+
if (keyedStates.size < RATE_LIMIT_STATE_PRUNE_THRESHOLD) {
|
|
10231
|
+
return;
|
|
10232
|
+
}
|
|
10233
|
+
for (const [key, keyedState] of keyedStates) {
|
|
10234
|
+
if (now >= keyedState.resetTime) {
|
|
10235
|
+
keyedStates.delete(key);
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
}
|
|
10239
|
+
__name(pruneExpiredRateLimitStates, "pruneExpiredRateLimitStates");
|
|
10204
10240
|
var rateLimitTaskMiddleware = defineTaskMiddleware(
|
|
10205
10241
|
markFrameworkDefinition({
|
|
10206
10242
|
id: "runner.middleware.task.rateLimit",
|
|
@@ -10208,15 +10244,24 @@ var rateLimitTaskMiddleware = defineTaskMiddleware(
|
|
|
10208
10244
|
configSchema: rateLimitConfigPattern,
|
|
10209
10245
|
dependencies: { state: rateLimitResource },
|
|
10210
10246
|
async run({ task: task2, next, journal: journal2 }, { state }, config) {
|
|
10247
|
+
const taskId = task2.definition.id;
|
|
10248
|
+
const keyBuilder = config.keyBuilder ?? defaultTaskKeyBuilder;
|
|
10249
|
+
const key = keyBuilder(taskId, task2.input);
|
|
10211
10250
|
const { states } = state;
|
|
10212
|
-
let limitState = states.get(config);
|
|
10213
10251
|
const now = Date.now();
|
|
10252
|
+
let keyedStates = states.get(config);
|
|
10253
|
+
if (!keyedStates) {
|
|
10254
|
+
keyedStates = /* @__PURE__ */ new Map();
|
|
10255
|
+
states.set(config, keyedStates);
|
|
10256
|
+
}
|
|
10257
|
+
pruneExpiredRateLimitStates(keyedStates, now);
|
|
10258
|
+
let limitState = keyedStates.get(key);
|
|
10214
10259
|
if (!limitState || now >= limitState.resetTime) {
|
|
10215
10260
|
limitState = {
|
|
10216
10261
|
count: 0,
|
|
10217
10262
|
resetTime: now + config.windowMs
|
|
10218
10263
|
};
|
|
10219
|
-
|
|
10264
|
+
keyedStates.set(key, limitState);
|
|
10220
10265
|
}
|
|
10221
10266
|
const remaining = Math.max(0, config.max - limitState.count);
|
|
10222
10267
|
journal2.set(journalKeys3.remaining, remaining, { override: true });
|
|
@@ -10244,16 +10289,9 @@ var rateLimitTaskMiddleware = defineTaskMiddleware(
|
|
|
10244
10289
|
init_markFrameworkDefinition();
|
|
10245
10290
|
init_errors2();
|
|
10246
10291
|
init_check();
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
var TEMPORAL_DISPOSED_ERROR_MESSAGE = "Temporal middleware resource has been disposed.";
|
|
10251
|
-
function createTemporalDisposedError() {
|
|
10252
|
-
return middlewareTemporalDisposedError.new({
|
|
10253
|
-
message: TEMPORAL_DISPOSED_ERROR_MESSAGE
|
|
10254
|
-
});
|
|
10255
|
-
}
|
|
10256
|
-
__name(createTemporalDisposedError, "createTemporalDisposedError");
|
|
10292
|
+
|
|
10293
|
+
// src/globals/middleware/temporal.shared.ts
|
|
10294
|
+
var TEMPORAL_STATE_PRUNE_THRESHOLD = 1e3;
|
|
10257
10295
|
function rejectDebounceState(state, error2) {
|
|
10258
10296
|
if (state.timeoutId) {
|
|
10259
10297
|
clearTimeout(state.timeoutId);
|
|
@@ -10283,6 +10321,62 @@ function rejectThrottleState(state, error2) {
|
|
|
10283
10321
|
});
|
|
10284
10322
|
}
|
|
10285
10323
|
__name(rejectThrottleState, "rejectThrottleState");
|
|
10324
|
+
function pruneIdleThrottleStates(keyedStates, trackedStates, now, windowMs) {
|
|
10325
|
+
if (keyedStates.size < TEMPORAL_STATE_PRUNE_THRESHOLD) {
|
|
10326
|
+
return;
|
|
10327
|
+
}
|
|
10328
|
+
for (const [key, throttleState] of keyedStates) {
|
|
10329
|
+
const isIdle = throttleState.timeoutId === void 0 && throttleState.currentPromise === void 0 && throttleState.resolveList.length === 0 && throttleState.rejectList.length === 0 && now - throttleState.lastExecution >= windowMs;
|
|
10330
|
+
if (isIdle) {
|
|
10331
|
+
trackedStates.delete(throttleState);
|
|
10332
|
+
keyedStates.delete(key);
|
|
10333
|
+
}
|
|
10334
|
+
}
|
|
10335
|
+
}
|
|
10336
|
+
__name(pruneIdleThrottleStates, "pruneIdleThrottleStates");
|
|
10337
|
+
|
|
10338
|
+
// src/globals/middleware/temporal.middleware.ts
|
|
10339
|
+
var temporalConfigPattern = Match.ObjectIncluding({
|
|
10340
|
+
ms: Match.PositiveInteger,
|
|
10341
|
+
keyBuilder: Match.Optional(Function)
|
|
10342
|
+
});
|
|
10343
|
+
var TEMPORAL_DISPOSED_ERROR_MESSAGE = "Temporal middleware resource has been disposed.";
|
|
10344
|
+
function createTemporalDisposedError() {
|
|
10345
|
+
return middlewareTemporalDisposedError.new({
|
|
10346
|
+
message: TEMPORAL_DISPOSED_ERROR_MESSAGE
|
|
10347
|
+
});
|
|
10348
|
+
}
|
|
10349
|
+
__name(createTemporalDisposedError, "createTemporalDisposedError");
|
|
10350
|
+
function buildTemporalMiddlewareKey(config, taskId, input) {
|
|
10351
|
+
const key = (config.keyBuilder ?? defaultTaskKeyBuilder)(taskId, input);
|
|
10352
|
+
if (typeof key !== "string") {
|
|
10353
|
+
validationError.throw({
|
|
10354
|
+
subject: "Middleware config",
|
|
10355
|
+
id: taskId,
|
|
10356
|
+
originalError: `Temporal middleware keyBuilder must return a string. Received ${typeof key}.`
|
|
10357
|
+
});
|
|
10358
|
+
}
|
|
10359
|
+
return key;
|
|
10360
|
+
}
|
|
10361
|
+
__name(buildTemporalMiddlewareKey, "buildTemporalMiddlewareKey");
|
|
10362
|
+
function getDebounceStatesForConfig(state, config) {
|
|
10363
|
+
let keyedStates = state.debounceStates.get(config);
|
|
10364
|
+
if (!keyedStates) {
|
|
10365
|
+
keyedStates = /* @__PURE__ */ new Map();
|
|
10366
|
+
state.debounceStates.set(config, keyedStates);
|
|
10367
|
+
}
|
|
10368
|
+
return keyedStates;
|
|
10369
|
+
}
|
|
10370
|
+
__name(getDebounceStatesForConfig, "getDebounceStatesForConfig");
|
|
10371
|
+
function getThrottleStatesForConfig(state, config) {
|
|
10372
|
+
let keyedStates = state.throttleStates.get(config);
|
|
10373
|
+
if (!keyedStates) {
|
|
10374
|
+
keyedStates = /* @__PURE__ */ new Map();
|
|
10375
|
+
state.throttleStates.set(config, keyedStates);
|
|
10376
|
+
}
|
|
10377
|
+
return keyedStates;
|
|
10378
|
+
}
|
|
10379
|
+
__name(getThrottleStatesForConfig, "getThrottleStatesForConfig");
|
|
10286
10380
|
var temporalResource = defineResource(
|
|
10287
10381
|
markFrameworkDefinition({
|
|
10288
10382
|
id: "runner.temporal",
|
|
@@ -10322,15 +10416,18 @@ var debounceTaskMiddleware = defineTaskMiddleware(
|
|
|
10322
10416
|
if (state.isDisposed === true) {
|
|
10323
10417
|
throw createTemporalDisposedError();
|
|
10324
10418
|
}
|
|
10325
|
-
const
|
|
10419
|
+
const taskId = task2.definition.id;
|
|
10420
|
+
const key = buildTemporalMiddlewareKey(config, taskId, task2.input);
|
|
10421
|
+
const debounceStates = getDebounceStatesForConfig(state, config);
|
|
10326
10422
|
const trackedDebounceStates = state.trackedDebounceStates;
|
|
10327
|
-
let debounceState = debounceStates.get(
|
|
10423
|
+
let debounceState = debounceStates.get(key);
|
|
10328
10424
|
if (!debounceState) {
|
|
10329
10425
|
debounceState = {
|
|
10426
|
+
key,
|
|
10330
10427
|
resolveList: [],
|
|
10331
10428
|
rejectList: []
|
|
10332
10429
|
};
|
|
10333
|
-
debounceStates.set(
|
|
10430
|
+
debounceStates.set(key, debounceState);
|
|
10334
10431
|
trackedDebounceStates.add(debounceState);
|
|
10335
10432
|
}
|
|
10336
10433
|
debounceState.latestInput = task2.input;
|
|
@@ -10347,6 +10444,8 @@ var debounceTaskMiddleware = defineTaskMiddleware(
|
|
|
10347
10444
|
debounceState.resolveList = [];
|
|
10348
10445
|
debounceState.rejectList = [];
|
|
10349
10446
|
debounceState.latestInput = void 0;
|
|
10447
|
+
debounceStates.delete(debounceState.key);
|
|
10448
|
+
trackedDebounceStates.delete(debounceState);
|
|
10350
10449
|
if (state.isDisposed === true) {
|
|
10351
10450
|
const disposeError = createTemporalDisposedError();
|
|
10352
10451
|
rejectList.forEach((reject) => {
|
|
@@ -10379,16 +10478,25 @@ var throttleTaskMiddleware = defineTaskMiddleware(
|
|
|
10379
10478
|
if (state.isDisposed === true) {
|
|
10380
10479
|
throw createTemporalDisposedError();
|
|
10381
10480
|
}
|
|
10382
|
-
const
|
|
10481
|
+
const taskId = task2.definition.id;
|
|
10482
|
+
const key = buildTemporalMiddlewareKey(config, taskId, task2.input);
|
|
10483
|
+
const throttleStates = getThrottleStatesForConfig(state, config);
|
|
10383
10484
|
const trackedThrottleStates = state.trackedThrottleStates;
|
|
10384
|
-
|
|
10485
|
+
pruneIdleThrottleStates(
|
|
10486
|
+
throttleStates,
|
|
10487
|
+
trackedThrottleStates,
|
|
10488
|
+
Date.now(),
|
|
10489
|
+
config.ms
|
|
10490
|
+
);
|
|
10491
|
+
let throttleState = throttleStates.get(key);
|
|
10385
10492
|
if (!throttleState) {
|
|
10386
10493
|
throttleState = {
|
|
10494
|
+
key,
|
|
10387
10495
|
lastExecution: 0,
|
|
10388
10496
|
resolveList: [],
|
|
10389
10497
|
rejectList: []
|
|
10390
10498
|
};
|
|
10391
|
-
throttleStates.set(
|
|
10499
|
+
throttleStates.set(key, throttleState);
|
|
10392
10500
|
trackedThrottleStates.add(throttleState);
|
|
10393
10501
|
}
|
|
10394
10502
|
const now = Date.now();
|
|
@@ -17886,8 +17994,9 @@ var StoreRegistryTagIndex = class {
|
|
|
17886
17994
|
|
|
17887
17995
|
// src/models/store-registry/StoreRegistryWriter.ts
|
|
17888
17996
|
init_errors2();
|
|
17997
|
+
|
|
17998
|
+
// src/models/store-registry/registerableKind.ts
|
|
17889
17999
|
init_symbols();
|
|
17890
|
-
init_assertDefinitionId();
|
|
17891
18000
|
function hasSymbolBrand(item, symbolKey) {
|
|
17892
18001
|
if (item === null || item === void 0) {
|
|
17893
18002
|
return false;
|
|
@@ -17933,6 +18042,190 @@ function resolveRegisterableKind(item) {
|
|
|
17933
18042
|
return null;
|
|
17934
18043
|
}
|
|
17935
18044
|
__name(resolveRegisterableKind, "resolveRegisterableKind");
|
|
18045
|
+
|
|
18046
|
+
// src/models/store-registry/CanonicalIdCompiler.ts
|
|
18047
|
+
init_errors2();
|
|
18048
|
+
init_assertDefinitionId();
|
|
18049
|
+
var CanonicalIdCompiler = class {
|
|
18050
|
+
static {
|
|
18051
|
+
__name(this, "CanonicalIdCompiler");
|
|
18052
|
+
}
|
|
18053
|
+
compute(ownerScope, kind, currentId) {
|
|
18054
|
+
this.assertLocalName(ownerScope.resourceId, kind, currentId);
|
|
18055
|
+
if (currentId.startsWith(`${ownerScope.resourceId}.`)) {
|
|
18056
|
+
return currentId;
|
|
18057
|
+
}
|
|
18058
|
+
if (ownerScope.usesFrameworkRootIds) {
|
|
18059
|
+
return this.computeFrameworkRootId(kind, currentId);
|
|
18060
|
+
}
|
|
18061
|
+
return this.computeOwnedId(ownerScope.resourceId, kind, currentId);
|
|
18062
|
+
}
|
|
18063
|
+
computeFrameworkRootId(kind, currentId) {
|
|
18064
|
+
switch (kind) {
|
|
18065
|
+
case "resource" /* Resource */:
|
|
18066
|
+
return currentId;
|
|
18067
|
+
case "task" /* Task */:
|
|
18068
|
+
return `tasks.${currentId}`;
|
|
18069
|
+
case "event" /* Event */:
|
|
18070
|
+
return `events.${currentId}`;
|
|
18071
|
+
case "hook" /* Hook */:
|
|
18072
|
+
return `hooks.${currentId}`;
|
|
18073
|
+
case "taskMiddleware" /* TaskMiddleware */:
|
|
18074
|
+
return `middleware.task.${currentId}`;
|
|
18075
|
+
case "resourceMiddleware" /* ResourceMiddleware */:
|
|
18076
|
+
return `middleware.resource.${currentId}`;
|
|
18077
|
+
case "tag" /* Tag */:
|
|
18078
|
+
return `tags.${currentId}`;
|
|
18079
|
+
case "error" /* Error */:
|
|
18080
|
+
return `errors.${currentId}`;
|
|
18081
|
+
case "asyncContext" /* AsyncContext */:
|
|
18082
|
+
return `asyncContexts.${currentId}`;
|
|
18083
|
+
default:
|
|
18084
|
+
return currentId;
|
|
18085
|
+
}
|
|
18086
|
+
}
|
|
18087
|
+
computeOwnedId(ownerResourceId, kind, currentId) {
|
|
18088
|
+
switch (kind) {
|
|
18089
|
+
case "resource" /* Resource */:
|
|
18090
|
+
return `${ownerResourceId}.${currentId}`;
|
|
18091
|
+
case "task" /* Task */:
|
|
18092
|
+
return `${ownerResourceId}.tasks.${currentId}`;
|
|
18093
|
+
case "event" /* Event */:
|
|
18094
|
+
return `${ownerResourceId}.events.${currentId}`;
|
|
18095
|
+
case "hook" /* Hook */:
|
|
18096
|
+
return `${ownerResourceId}.hooks.${currentId}`;
|
|
18097
|
+
case "taskMiddleware" /* TaskMiddleware */:
|
|
18098
|
+
return `${ownerResourceId}.middleware.task.${currentId}`;
|
|
18099
|
+
case "resourceMiddleware" /* ResourceMiddleware */:
|
|
18100
|
+
return `${ownerResourceId}.middleware.resource.${currentId}`;
|
|
18101
|
+
case "tag" /* Tag */:
|
|
18102
|
+
return `${ownerResourceId}.tags.${currentId}`;
|
|
18103
|
+
case "error" /* Error */:
|
|
18104
|
+
return `${ownerResourceId}.errors.${currentId}`;
|
|
18105
|
+
case "asyncContext" /* AsyncContext */:
|
|
18106
|
+
return `${ownerResourceId}.asyncContexts.${currentId}`;
|
|
18107
|
+
default:
|
|
18108
|
+
return `${ownerResourceId}.${currentId}`;
|
|
18109
|
+
}
|
|
18110
|
+
}
|
|
18111
|
+
assertLocalName(ownerResourceId, kind, currentId) {
|
|
18112
|
+
if (currentId.trim().length === 0) {
|
|
18113
|
+
validationError.throw({
|
|
18114
|
+
subject: "Definition local name",
|
|
18115
|
+
id: `${ownerResourceId}.${kind}`,
|
|
18116
|
+
originalError: "Definition local names must be non-empty strings when using scoped registration."
|
|
18117
|
+
});
|
|
18118
|
+
}
|
|
18119
|
+
if (isReservedDefinitionLocalName(currentId)) {
|
|
18120
|
+
validationError.throw({
|
|
18121
|
+
subject: "Definition local name",
|
|
18122
|
+
id: `${ownerResourceId}.${kind}.${currentId}`,
|
|
18123
|
+
originalError: `Local name "${currentId}" is reserved by Runner and cannot be used.`
|
|
18124
|
+
});
|
|
18125
|
+
}
|
|
18126
|
+
}
|
|
18127
|
+
};
|
|
18128
|
+
|
|
18129
|
+
// src/models/createFrameworkRootGateway.ts
|
|
18130
|
+
init_markFrameworkDefinition();
|
|
18131
|
+
|
|
18132
|
+
// src/models/BuiltinsRegistry.ts
|
|
18133
|
+
init_errors2();
|
|
18134
|
+
function collectUniqueTags() {
|
|
18135
|
+
const uniqueTags = [];
|
|
18136
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
18137
|
+
for (const tag2 of Object.values(globalTags)) {
|
|
18138
|
+
if (seenIds.has(tag2.id)) {
|
|
18139
|
+
continue;
|
|
18140
|
+
}
|
|
18141
|
+
seenIds.add(tag2.id);
|
|
18142
|
+
uniqueTags.push(tag2);
|
|
18143
|
+
}
|
|
18144
|
+
return uniqueTags;
|
|
18145
|
+
}
|
|
18146
|
+
__name(collectUniqueTags, "collectUniqueTags");
|
|
18147
|
+
var SYSTEM_FRAMEWORK_ITEMS = Object.freeze([
|
|
18148
|
+
globalResources.store,
|
|
18149
|
+
globalResources.eventManager,
|
|
18150
|
+
globalResources.taskRunner,
|
|
18151
|
+
globalResources.middlewareManager,
|
|
18152
|
+
globalResources.runtime,
|
|
18153
|
+
...collectUniqueTags().filter((tag2) => tag2.id.startsWith("system.")),
|
|
18154
|
+
...globalEventsArray
|
|
18155
|
+
]);
|
|
18156
|
+
var RUNNER_FRAMEWORK_ITEMS = Object.freeze([
|
|
18157
|
+
globalResources.health,
|
|
18158
|
+
globalResources.timers,
|
|
18159
|
+
globalResources.logger,
|
|
18160
|
+
globalResources.serializer,
|
|
18161
|
+
globalResources.queue,
|
|
18162
|
+
...collectUniqueTags().filter((tag2) => tag2.id.startsWith("runner.")),
|
|
18163
|
+
requireContextTaskMiddleware,
|
|
18164
|
+
retryTaskMiddleware,
|
|
18165
|
+
timeoutTaskMiddleware,
|
|
18166
|
+
concurrencyTaskMiddleware,
|
|
18167
|
+
debounceTaskMiddleware,
|
|
18168
|
+
throttleTaskMiddleware,
|
|
18169
|
+
fallbackTaskMiddleware,
|
|
18170
|
+
rateLimitTaskMiddleware,
|
|
18171
|
+
circuitBreakerMiddleware,
|
|
18172
|
+
retryResourceMiddleware,
|
|
18173
|
+
timeoutResourceMiddleware,
|
|
18174
|
+
rateLimitResource,
|
|
18175
|
+
circuitBreakerResource,
|
|
18176
|
+
temporalResource,
|
|
18177
|
+
concurrencyResource,
|
|
18178
|
+
middlewareTimeoutError,
|
|
18179
|
+
middlewareCircuitBreakerOpenError,
|
|
18180
|
+
middlewareRateLimitExceededError,
|
|
18181
|
+
durableExecutionError
|
|
18182
|
+
]);
|
|
18183
|
+
|
|
18184
|
+
// src/models/createFrameworkRootGateway.ts
|
|
18185
|
+
var FRAMEWORK_RUNNER_RESOURCE_ID = "runner";
|
|
18186
|
+
var FRAMEWORK_SYSTEM_RESOURCE_ID = "system";
|
|
18187
|
+
var FRAMEWORK_ROOT_RESOURCE_ID = "runtime-framework-root";
|
|
18188
|
+
function createFrameworkNamespaceResource(resourceId, register) {
|
|
18189
|
+
return defineResource(
|
|
18190
|
+
markFrameworkDefinition({
|
|
18191
|
+
id: resourceId,
|
|
18192
|
+
register: [...register]
|
|
18193
|
+
})
|
|
18194
|
+
);
|
|
18195
|
+
}
|
|
18196
|
+
__name(createFrameworkNamespaceResource, "createFrameworkNamespaceResource");
|
|
18197
|
+
function createFrameworkRootResource({
|
|
18198
|
+
rootItem,
|
|
18199
|
+
debug: debug3
|
|
18200
|
+
}) {
|
|
18201
|
+
const runnerRegister = debug3 ? [...RUNNER_FRAMEWORK_ITEMS, debugResource.with(debug3)] : [...RUNNER_FRAMEWORK_ITEMS];
|
|
18202
|
+
const systemResource = createFrameworkNamespaceResource(
|
|
18203
|
+
FRAMEWORK_SYSTEM_RESOURCE_ID,
|
|
18204
|
+
SYSTEM_FRAMEWORK_ITEMS
|
|
18205
|
+
);
|
|
18206
|
+
const runnerResource = createFrameworkNamespaceResource(
|
|
18207
|
+
FRAMEWORK_RUNNER_RESOURCE_ID,
|
|
18208
|
+
runnerRegister
|
|
18209
|
+
);
|
|
18210
|
+
return defineResource(
|
|
18211
|
+
markFrameworkDefinition({
|
|
18212
|
+
id: FRAMEWORK_ROOT_RESOURCE_ID,
|
|
18213
|
+
register: [systemResource, runnerResource, rootItem]
|
|
18214
|
+
})
|
|
18215
|
+
);
|
|
18216
|
+
}
|
|
18217
|
+
__name(createFrameworkRootResource, "createFrameworkRootResource");
|
|
18218
|
+
|
|
18219
|
+
// src/models/store-registry/OwnerScope.ts
|
|
18220
|
+
function createOwnerScope(resourceId) {
|
|
18221
|
+
return {
|
|
18222
|
+
resourceId,
|
|
18223
|
+
usesFrameworkRootIds: resourceId === FRAMEWORK_ROOT_RESOURCE_ID
|
|
18224
|
+
};
|
|
18225
|
+
}
|
|
18226
|
+
__name(createOwnerScope, "createOwnerScope");
|
|
18227
|
+
|
|
18228
|
+
// src/models/store-registry/StoreRegistryWriter.ts
|
|
17936
18229
|
var StoreRegistryWriter = class {
|
|
17937
18230
|
constructor(collections, validator, visibilityTracker, tagIndex, definitionPreparer, aliasResolver) {
|
|
17938
18231
|
this.collections = collections;
|
|
@@ -17941,6 +18234,7 @@ var StoreRegistryWriter = class {
|
|
|
17941
18234
|
this.tagIndex = tagIndex;
|
|
17942
18235
|
this.definitionPreparer = definitionPreparer;
|
|
17943
18236
|
this.aliasResolver = aliasResolver;
|
|
18237
|
+
this.canonicalIdCompiler = new CanonicalIdCompiler();
|
|
17944
18238
|
}
|
|
17945
18239
|
static {
|
|
17946
18240
|
__name(this, "StoreRegistryWriter");
|
|
@@ -18143,8 +18437,9 @@ var StoreRegistryWriter = class {
|
|
|
18143
18437
|
const registerEntries = typeof element.register === "function" ? element.register(config) : element.register;
|
|
18144
18438
|
const items = registerEntries ?? [];
|
|
18145
18439
|
this.assignNormalizedRegisterEntries(element, items);
|
|
18440
|
+
const ownerScope = createOwnerScope(element.id);
|
|
18146
18441
|
const scopedItems = items.map(
|
|
18147
|
-
(item) => this.compileOwnedItem(
|
|
18442
|
+
(item) => this.compileOwnedItem(ownerScope, item)
|
|
18148
18443
|
);
|
|
18149
18444
|
for (const item of scopedItems) {
|
|
18150
18445
|
this.visibilityTracker.recordOwnership(element.id, item);
|
|
@@ -18166,16 +18461,15 @@ var StoreRegistryWriter = class {
|
|
|
18166
18461
|
}
|
|
18167
18462
|
element.register = items;
|
|
18168
18463
|
}
|
|
18169
|
-
compileOwnedItem(
|
|
18464
|
+
compileOwnedItem(ownerScope, item) {
|
|
18170
18465
|
const kind = resolveRegisterableKind(item);
|
|
18171
18466
|
if (!kind) {
|
|
18172
18467
|
return item;
|
|
18173
18468
|
}
|
|
18174
18469
|
if (kind === "resourceWithConfig" /* ResourceWithConfig */) {
|
|
18175
18470
|
const withConfig = item;
|
|
18176
|
-
const compiledResource = this.
|
|
18177
|
-
|
|
18178
|
-
ownerIsGateway,
|
|
18471
|
+
const compiledResource = this.compileOwnedDefinitionWithScope(
|
|
18472
|
+
ownerScope,
|
|
18179
18473
|
withConfig.resource,
|
|
18180
18474
|
"resource" /* Resource */
|
|
18181
18475
|
);
|
|
@@ -18199,9 +18493,8 @@ var StoreRegistryWriter = class {
|
|
|
18199
18493
|
);
|
|
18200
18494
|
return compiledWithConfig;
|
|
18201
18495
|
}
|
|
18202
|
-
const compiled = this.
|
|
18203
|
-
|
|
18204
|
-
ownerIsGateway,
|
|
18496
|
+
const compiled = this.compileOwnedDefinitionWithScope(
|
|
18497
|
+
ownerScope,
|
|
18205
18498
|
item,
|
|
18206
18499
|
kind
|
|
18207
18500
|
);
|
|
@@ -18210,11 +18503,10 @@ var StoreRegistryWriter = class {
|
|
|
18210
18503
|
this.aliasResolver.registerDefinitionAlias(compiled, resolvedId);
|
|
18211
18504
|
return compiled;
|
|
18212
18505
|
}
|
|
18213
|
-
|
|
18506
|
+
compileOwnedDefinitionWithScope(ownerScope, item, kind) {
|
|
18214
18507
|
const currentId = item.id;
|
|
18215
|
-
const nextId = this.
|
|
18216
|
-
|
|
18217
|
-
ownerIsGateway,
|
|
18508
|
+
const nextId = this.canonicalIdCompiler.compute(
|
|
18509
|
+
ownerScope,
|
|
18218
18510
|
kind,
|
|
18219
18511
|
currentId
|
|
18220
18512
|
);
|
|
@@ -18226,6 +18518,26 @@ var StoreRegistryWriter = class {
|
|
|
18226
18518
|
nextId
|
|
18227
18519
|
);
|
|
18228
18520
|
}
|
|
18521
|
+
computeCanonicalId(ownerResourceId, ownerUsesFrameworkRootIds, kind, currentId) {
|
|
18522
|
+
return this.canonicalIdCompiler.compute(
|
|
18523
|
+
{
|
|
18524
|
+
resourceId: ownerResourceId,
|
|
18525
|
+
usesFrameworkRootIds: ownerUsesFrameworkRootIds
|
|
18526
|
+
},
|
|
18527
|
+
kind,
|
|
18528
|
+
currentId
|
|
18529
|
+
);
|
|
18530
|
+
}
|
|
18531
|
+
compileOwnedDefinition(ownerResourceId, ownerUsesFrameworkRootIds, item, kind) {
|
|
18532
|
+
return this.compileOwnedDefinitionWithScope(
|
|
18533
|
+
{
|
|
18534
|
+
resourceId: ownerResourceId,
|
|
18535
|
+
usesFrameworkRootIds: ownerUsesFrameworkRootIds
|
|
18536
|
+
},
|
|
18537
|
+
item,
|
|
18538
|
+
kind
|
|
18539
|
+
);
|
|
18540
|
+
}
|
|
18229
18541
|
cloneDefinitionWithId(definition, id3) {
|
|
18230
18542
|
const clone10 = Object.create(
|
|
18231
18543
|
Object.getPrototypeOf(definition)
|
|
@@ -18255,79 +18567,11 @@ var StoreRegistryWriter = class {
|
|
|
18255
18567
|
configurable: true
|
|
18256
18568
|
});
|
|
18257
18569
|
}
|
|
18258
|
-
computeCanonicalId(ownerResourceId, ownerIsGateway, kind, currentId) {
|
|
18259
|
-
this.assertLocalName(ownerResourceId, kind, currentId);
|
|
18260
|
-
if (currentId.startsWith(`${ownerResourceId}.`)) {
|
|
18261
|
-
return currentId;
|
|
18262
|
-
}
|
|
18263
|
-
if (ownerIsGateway) {
|
|
18264
|
-
switch (kind) {
|
|
18265
|
-
case "resource" /* Resource */:
|
|
18266
|
-
return currentId;
|
|
18267
|
-
case "task" /* Task */:
|
|
18268
|
-
return `tasks.${currentId}`;
|
|
18269
|
-
case "event" /* Event */:
|
|
18270
|
-
return `events.${currentId}`;
|
|
18271
|
-
case "hook" /* Hook */:
|
|
18272
|
-
return `hooks.${currentId}`;
|
|
18273
|
-
case "taskMiddleware" /* TaskMiddleware */:
|
|
18274
|
-
return `middleware.task.${currentId}`;
|
|
18275
|
-
case "resourceMiddleware" /* ResourceMiddleware */:
|
|
18276
|
-
return `middleware.resource.${currentId}`;
|
|
18277
|
-
case "tag" /* Tag */:
|
|
18278
|
-
return `tags.${currentId}`;
|
|
18279
|
-
case "error" /* Error */:
|
|
18280
|
-
return `errors.${currentId}`;
|
|
18281
|
-
case "asyncContext" /* AsyncContext */:
|
|
18282
|
-
return `asyncContexts.${currentId}`;
|
|
18283
|
-
default:
|
|
18284
|
-
return currentId;
|
|
18285
|
-
}
|
|
18286
|
-
}
|
|
18287
|
-
switch (kind) {
|
|
18288
|
-
case "resource" /* Resource */:
|
|
18289
|
-
return `${ownerResourceId}.${currentId}`;
|
|
18290
|
-
case "task" /* Task */:
|
|
18291
|
-
return `${ownerResourceId}.tasks.${currentId}`;
|
|
18292
|
-
case "event" /* Event */:
|
|
18293
|
-
return `${ownerResourceId}.events.${currentId}`;
|
|
18294
|
-
case "hook" /* Hook */:
|
|
18295
|
-
return `${ownerResourceId}.hooks.${currentId}`;
|
|
18296
|
-
case "taskMiddleware" /* TaskMiddleware */:
|
|
18297
|
-
return `${ownerResourceId}.middleware.task.${currentId}`;
|
|
18298
|
-
case "resourceMiddleware" /* ResourceMiddleware */:
|
|
18299
|
-
return `${ownerResourceId}.middleware.resource.${currentId}`;
|
|
18300
|
-
case "tag" /* Tag */:
|
|
18301
|
-
return `${ownerResourceId}.tags.${currentId}`;
|
|
18302
|
-
case "error" /* Error */:
|
|
18303
|
-
return `${ownerResourceId}.errors.${currentId}`;
|
|
18304
|
-
case "asyncContext" /* AsyncContext */:
|
|
18305
|
-
return `${ownerResourceId}.asyncContexts.${currentId}`;
|
|
18306
|
-
default:
|
|
18307
|
-
return `${ownerResourceId}.${currentId}`;
|
|
18308
|
-
}
|
|
18309
|
-
}
|
|
18310
|
-
assertLocalName(ownerResourceId, kind, currentId) {
|
|
18311
|
-
if (currentId.trim().length === 0) {
|
|
18312
|
-
validationError.throw({
|
|
18313
|
-
subject: "Definition local name",
|
|
18314
|
-
id: `${ownerResourceId}.${kind}`,
|
|
18315
|
-
originalError: "Definition local names must be non-empty strings when using scoped registration."
|
|
18316
|
-
});
|
|
18317
|
-
}
|
|
18318
|
-
if (isReservedDefinitionLocalName(currentId)) {
|
|
18319
|
-
validationError.throw({
|
|
18320
|
-
subject: "Definition local name",
|
|
18321
|
-
id: `${ownerResourceId}.${kind}.${currentId}`,
|
|
18322
|
-
originalError: `Local name "${currentId}" is reserved by Runner and cannot be used.`
|
|
18323
|
-
});
|
|
18324
|
-
}
|
|
18325
|
-
}
|
|
18326
18570
|
resolveRegisterableId(item) {
|
|
18327
18571
|
if (item === null || item === void 0) {
|
|
18328
18572
|
return void 0;
|
|
18329
18573
|
}
|
|
18330
|
-
if (
|
|
18574
|
+
if (resolveRegisterableKind(item) === "resourceWithConfig" /* ResourceWithConfig */) {
|
|
18331
18575
|
return item.resource.id;
|
|
18332
18576
|
}
|
|
18333
18577
|
if (typeof item === "object" && "id" in item) {
|
|
@@ -18406,15 +18650,16 @@ var StoreRegistryWriter = class {
|
|
|
18406
18650
|
this.visibilityTracker.recordDefinitionTags(task2.id, tags2);
|
|
18407
18651
|
}
|
|
18408
18652
|
normalizeTaskMiddlewareAttachments(task2) {
|
|
18653
|
+
const ownerResourceId = this.resolveOwnerResourceIdFromTaskId(task2.id);
|
|
18409
18654
|
return this.normalizeMiddlewareAttachments(
|
|
18410
|
-
|
|
18655
|
+
ownerResourceId ? createOwnerScope(ownerResourceId) : null,
|
|
18411
18656
|
"taskMiddleware" /* TaskMiddleware */,
|
|
18412
18657
|
task2.middleware
|
|
18413
18658
|
);
|
|
18414
18659
|
}
|
|
18415
18660
|
normalizeResourceMiddlewareAttachments(resource2) {
|
|
18416
18661
|
return this.normalizeMiddlewareAttachments(
|
|
18417
|
-
resource2.id,
|
|
18662
|
+
createOwnerScope(resource2.id),
|
|
18418
18663
|
"resourceMiddleware" /* ResourceMiddleware */,
|
|
18419
18664
|
resource2.middleware
|
|
18420
18665
|
);
|
|
@@ -18432,7 +18677,10 @@ var StoreRegistryWriter = class {
|
|
|
18432
18677
|
let normalizedResourcePolicy = subtree.resources;
|
|
18433
18678
|
if (subtree.tasks?.middleware?.length) {
|
|
18434
18679
|
const middleware2 = subtree.tasks.middleware.map(
|
|
18435
|
-
(entry) => this.normalizeSubtreeTaskMiddlewareEntry(
|
|
18680
|
+
(entry) => this.normalizeSubtreeTaskMiddlewareEntry(
|
|
18681
|
+
createOwnerScope(resource2.id),
|
|
18682
|
+
entry
|
|
18683
|
+
)
|
|
18436
18684
|
);
|
|
18437
18685
|
if (this.didArrayChange(subtree.tasks.middleware, middleware2)) {
|
|
18438
18686
|
normalizedTaskPolicy = {
|
|
@@ -18444,7 +18692,10 @@ var StoreRegistryWriter = class {
|
|
|
18444
18692
|
}
|
|
18445
18693
|
if (subtree.resources?.middleware?.length) {
|
|
18446
18694
|
const middleware2 = subtree.resources.middleware.map(
|
|
18447
|
-
(entry) => this.normalizeSubtreeResourceMiddlewareEntry(
|
|
18695
|
+
(entry) => this.normalizeSubtreeResourceMiddlewareEntry(
|
|
18696
|
+
createOwnerScope(resource2.id),
|
|
18697
|
+
entry
|
|
18698
|
+
)
|
|
18448
18699
|
);
|
|
18449
18700
|
if (this.didArrayChange(subtree.resources.middleware, middleware2)) {
|
|
18450
18701
|
normalizedResourcePolicy = {
|
|
@@ -18463,37 +18714,47 @@ var StoreRegistryWriter = class {
|
|
|
18463
18714
|
...normalizedResourcePolicy ? { resources: normalizedResourcePolicy } : {}
|
|
18464
18715
|
};
|
|
18465
18716
|
}
|
|
18466
|
-
normalizeSubtreeTaskMiddlewareEntry(
|
|
18717
|
+
normalizeSubtreeTaskMiddlewareEntry(ownerScopeOrResourceId, entryOrUsesFrameworkRootIds, maybeEntry) {
|
|
18718
|
+
const ownerScope = this.normalizeOwnerScopeArg(
|
|
18719
|
+
ownerScopeOrResourceId,
|
|
18720
|
+
entryOrUsesFrameworkRootIds
|
|
18721
|
+
);
|
|
18722
|
+
const entry = maybeEntry ?? entryOrUsesFrameworkRootIds;
|
|
18467
18723
|
return this.normalizeSubtreeMiddlewareEntry(
|
|
18468
|
-
|
|
18724
|
+
ownerScope,
|
|
18469
18725
|
"taskMiddleware" /* TaskMiddleware */,
|
|
18470
18726
|
entry,
|
|
18471
18727
|
getSubtreeTaskMiddlewareAttachment
|
|
18472
18728
|
);
|
|
18473
18729
|
}
|
|
18474
|
-
normalizeSubtreeResourceMiddlewareEntry(
|
|
18730
|
+
normalizeSubtreeResourceMiddlewareEntry(ownerScopeOrResourceId, entryOrUsesFrameworkRootIds, maybeEntry) {
|
|
18731
|
+
const ownerScope = this.normalizeOwnerScopeArg(
|
|
18732
|
+
ownerScopeOrResourceId,
|
|
18733
|
+
entryOrUsesFrameworkRootIds
|
|
18734
|
+
);
|
|
18735
|
+
const entry = maybeEntry ?? entryOrUsesFrameworkRootIds;
|
|
18475
18736
|
return this.normalizeSubtreeMiddlewareEntry(
|
|
18476
|
-
|
|
18737
|
+
ownerScope,
|
|
18477
18738
|
"resourceMiddleware" /* ResourceMiddleware */,
|
|
18478
18739
|
entry,
|
|
18479
18740
|
getSubtreeResourceMiddlewareAttachment
|
|
18480
18741
|
);
|
|
18481
18742
|
}
|
|
18482
|
-
normalizeMiddlewareAttachments(
|
|
18743
|
+
normalizeMiddlewareAttachments(ownerScope, kind, attachments) {
|
|
18483
18744
|
if (!Array.isArray(attachments) || attachments.length === 0) {
|
|
18484
18745
|
return attachments;
|
|
18485
18746
|
}
|
|
18486
|
-
if (!
|
|
18747
|
+
if (!ownerScope) {
|
|
18487
18748
|
return attachments;
|
|
18488
18749
|
}
|
|
18489
18750
|
return attachments.map(
|
|
18490
|
-
(attachment) => this.normalizeMiddlewareAttachment(
|
|
18751
|
+
(attachment) => this.normalizeMiddlewareAttachment(ownerScope, kind, attachment)
|
|
18491
18752
|
);
|
|
18492
18753
|
}
|
|
18493
|
-
normalizeSubtreeMiddlewareEntry(
|
|
18754
|
+
normalizeSubtreeMiddlewareEntry(ownerScope, kind, entry, getAttachment) {
|
|
18494
18755
|
const attachment = getAttachment(entry);
|
|
18495
18756
|
const normalizedAttachment = this.normalizeMiddlewareAttachment(
|
|
18496
|
-
|
|
18757
|
+
ownerScope,
|
|
18497
18758
|
kind,
|
|
18498
18759
|
attachment
|
|
18499
18760
|
);
|
|
@@ -18508,17 +18769,11 @@ var StoreRegistryWriter = class {
|
|
|
18508
18769
|
}
|
|
18509
18770
|
return normalizedAttachment;
|
|
18510
18771
|
}
|
|
18511
|
-
normalizeMiddlewareAttachment(
|
|
18512
|
-
const ownerIsGateway = this.collections.resources.get(ownerResourceId)?.resource.gateway === true;
|
|
18772
|
+
normalizeMiddlewareAttachment(ownerScope, kind, attachment) {
|
|
18513
18773
|
const isRegisteredMiddlewareId = /* @__PURE__ */ __name((candidateId) => kind === "taskMiddleware" /* TaskMiddleware */ ? this.collections.taskMiddlewares.has(candidateId) : this.collections.resourceMiddlewares.has(candidateId), "isRegisteredMiddlewareId");
|
|
18514
18774
|
const resolvedByAliasCandidate = this.aliasResolver.resolveDefinitionId(attachment);
|
|
18515
18775
|
const resolvedByAlias = typeof resolvedByAliasCandidate === "string" && isRegisteredMiddlewareId(resolvedByAliasCandidate) ? resolvedByAliasCandidate : void 0;
|
|
18516
|
-
const resolvedId = resolvedByAlias ?? this.
|
|
18517
|
-
ownerResourceId,
|
|
18518
|
-
ownerIsGateway,
|
|
18519
|
-
kind,
|
|
18520
|
-
attachment.id
|
|
18521
|
-
);
|
|
18776
|
+
const resolvedId = resolvedByAlias ?? this.canonicalIdCompiler.compute(ownerScope, kind, attachment.id);
|
|
18522
18777
|
if (resolvedId === attachment.id) {
|
|
18523
18778
|
return attachment;
|
|
18524
18779
|
}
|
|
@@ -18549,6 +18804,15 @@ var StoreRegistryWriter = class {
|
|
|
18549
18804
|
}
|
|
18550
18805
|
return false;
|
|
18551
18806
|
}
|
|
18807
|
+
normalizeOwnerScopeArg(ownerScopeOrResourceId, entryOrUsesFrameworkRootIds) {
|
|
18808
|
+
if (typeof ownerScopeOrResourceId !== "string") {
|
|
18809
|
+
return ownerScopeOrResourceId;
|
|
18810
|
+
}
|
|
18811
|
+
return {
|
|
18812
|
+
resourceId: ownerScopeOrResourceId,
|
|
18813
|
+
usesFrameworkRootIds: typeof entryOrUsesFrameworkRootIds === "boolean" ? entryOrUsesFrameworkRootIds : false
|
|
18814
|
+
};
|
|
18815
|
+
}
|
|
18552
18816
|
normalizeDefinitionTags(tags2) {
|
|
18553
18817
|
return normalizeTags(tags2).map((tag2) => {
|
|
18554
18818
|
const resolvedId = this.aliasResolver.resolveDefinitionId(tag2);
|
|
@@ -18604,6 +18868,7 @@ var StoreRegistry = class {
|
|
|
18604
18868
|
this.definitionIdentityAliases = /* @__PURE__ */ new WeakMap();
|
|
18605
18869
|
this.definitionAliasesBySourceId = /* @__PURE__ */ new Map();
|
|
18606
18870
|
this.sourceIdsByCanonicalId = /* @__PURE__ */ new Map();
|
|
18871
|
+
this.displayIdsByCanonicalId = /* @__PURE__ */ new Map();
|
|
18607
18872
|
const lookupResolver = /* @__PURE__ */ __name((key) => this.resolveDefinitionId(key), "lookupResolver");
|
|
18608
18873
|
this.tasks.setLookupResolver(lookupResolver);
|
|
18609
18874
|
this.resources.setLookupResolver(lookupResolver);
|
|
@@ -18674,6 +18939,7 @@ var StoreRegistry = class {
|
|
|
18674
18939
|
this.recordDefinitionIdentityAlias(reference, canonicalId);
|
|
18675
18940
|
this.recordSourceIdAlias(reference, canonicalId);
|
|
18676
18941
|
this.recordCanonicalSourceId(reference, canonicalId);
|
|
18942
|
+
this.computeAndStoreDisplayId(canonicalId);
|
|
18677
18943
|
}
|
|
18678
18944
|
resolveDefinitionId(reference) {
|
|
18679
18945
|
if (typeof reference === "string") {
|
|
@@ -18760,16 +19026,35 @@ var StoreRegistry = class {
|
|
|
18760
19026
|
return candidates.values().next().value;
|
|
18761
19027
|
}
|
|
18762
19028
|
getDisplayId(id3) {
|
|
18763
|
-
|
|
19029
|
+
return this.displayIdsByCanonicalId.get(id3) ?? id3;
|
|
19030
|
+
}
|
|
19031
|
+
stripFrameworkRootPrefix(id3) {
|
|
19032
|
+
const prefix = `${FRAMEWORK_ROOT_RESOURCE_ID}.`;
|
|
19033
|
+
return id3.startsWith(prefix) ? id3.slice(prefix.length) : id3;
|
|
19034
|
+
}
|
|
19035
|
+
computeAndStoreDisplayId(canonicalId) {
|
|
19036
|
+
if (canonicalId === FRAMEWORK_ROOT_RESOURCE_ID || canonicalId.startsWith(`${FRAMEWORK_ROOT_RESOURCE_ID}.`)) {
|
|
19037
|
+
this.displayIdsByCanonicalId.set(
|
|
19038
|
+
canonicalId,
|
|
19039
|
+
this.stripFrameworkRootPrefix(canonicalId)
|
|
19040
|
+
);
|
|
19041
|
+
return;
|
|
19042
|
+
}
|
|
19043
|
+
const sourceIds = this.sourceIdsByCanonicalId.get(canonicalId);
|
|
18764
19044
|
if (!sourceIds || sourceIds.size === 0) {
|
|
18765
|
-
|
|
19045
|
+
this.displayIdsByCanonicalId.set(canonicalId, canonicalId);
|
|
19046
|
+
return;
|
|
18766
19047
|
}
|
|
18767
19048
|
for (const sourceId of sourceIds) {
|
|
18768
|
-
if (sourceId !==
|
|
18769
|
-
|
|
19049
|
+
if (sourceId !== canonicalId) {
|
|
19050
|
+
this.displayIdsByCanonicalId.set(canonicalId, sourceId);
|
|
19051
|
+
return;
|
|
18770
19052
|
}
|
|
18771
19053
|
}
|
|
18772
|
-
|
|
19054
|
+
this.displayIdsByCanonicalId.set(
|
|
19055
|
+
canonicalId,
|
|
19056
|
+
sourceIds.values().next().value
|
|
19057
|
+
);
|
|
18773
19058
|
}
|
|
18774
19059
|
/** Lock every map in the registry, preventing further mutations. */
|
|
18775
19060
|
lockAll() {
|
|
@@ -19979,90 +20264,6 @@ function getTopologicalInitOrder(resources2, initializedResources) {
|
|
|
19979
20264
|
}
|
|
19980
20265
|
__name(getTopologicalInitOrder, "getTopologicalInitOrder");
|
|
19981
20266
|
|
|
19982
|
-
// src/models/BuiltinsRegistry.ts
|
|
19983
|
-
init_errors2();
|
|
19984
|
-
function collectUniqueTags() {
|
|
19985
|
-
const uniqueTags = [];
|
|
19986
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
19987
|
-
for (const tag2 of Object.values(globalTags)) {
|
|
19988
|
-
if (seenIds.has(tag2.id)) {
|
|
19989
|
-
continue;
|
|
19990
|
-
}
|
|
19991
|
-
seenIds.add(tag2.id);
|
|
19992
|
-
uniqueTags.push(tag2);
|
|
19993
|
-
}
|
|
19994
|
-
return uniqueTags;
|
|
19995
|
-
}
|
|
19996
|
-
__name(collectUniqueTags, "collectUniqueTags");
|
|
19997
|
-
var SYSTEM_FRAMEWORK_ITEMS = Object.freeze([
|
|
19998
|
-
globalResources.store,
|
|
19999
|
-
globalResources.eventManager,
|
|
20000
|
-
globalResources.taskRunner,
|
|
20001
|
-
globalResources.middlewareManager,
|
|
20002
|
-
globalResources.runtime,
|
|
20003
|
-
...collectUniqueTags().filter((tag2) => tag2.id.startsWith("system.")),
|
|
20004
|
-
...globalEventsArray
|
|
20005
|
-
]);
|
|
20006
|
-
var RUNNER_FRAMEWORK_ITEMS = Object.freeze([
|
|
20007
|
-
globalResources.health,
|
|
20008
|
-
globalResources.timers,
|
|
20009
|
-
globalResources.logger,
|
|
20010
|
-
globalResources.serializer,
|
|
20011
|
-
globalResources.queue,
|
|
20012
|
-
...collectUniqueTags().filter((tag2) => tag2.id.startsWith("runner.")),
|
|
20013
|
-
requireContextTaskMiddleware,
|
|
20014
|
-
retryTaskMiddleware,
|
|
20015
|
-
timeoutTaskMiddleware,
|
|
20016
|
-
concurrencyTaskMiddleware,
|
|
20017
|
-
debounceTaskMiddleware,
|
|
20018
|
-
throttleTaskMiddleware,
|
|
20019
|
-
fallbackTaskMiddleware,
|
|
20020
|
-
rateLimitTaskMiddleware,
|
|
20021
|
-
circuitBreakerMiddleware,
|
|
20022
|
-
retryResourceMiddleware,
|
|
20023
|
-
timeoutResourceMiddleware,
|
|
20024
|
-
rateLimitResource,
|
|
20025
|
-
circuitBreakerResource,
|
|
20026
|
-
temporalResource,
|
|
20027
|
-
concurrencyResource,
|
|
20028
|
-
middlewareTimeoutError,
|
|
20029
|
-
middlewareCircuitBreakerOpenError,
|
|
20030
|
-
middlewareRateLimitExceededError,
|
|
20031
|
-
durableExecutionError
|
|
20032
|
-
]);
|
|
20033
|
-
|
|
20034
|
-
// src/models/createFrameworkRootGateway.ts
|
|
20035
|
-
var FRAMEWORK_RUNNER_RESOURCE_ID = "runner";
|
|
20036
|
-
var FRAMEWORK_SYSTEM_RESOURCE_ID = "system";
|
|
20037
|
-
var FRAMEWORK_ROOT_GATEWAY_ID = "runtime-framework-root";
|
|
20038
|
-
function createFrameworkNamespaceResource(resourceId, register) {
|
|
20039
|
-
return defineResource({
|
|
20040
|
-
id: resourceId,
|
|
20041
|
-
register: [...register]
|
|
20042
|
-
});
|
|
20043
|
-
}
|
|
20044
|
-
__name(createFrameworkNamespaceResource, "createFrameworkNamespaceResource");
|
|
20045
|
-
function createFrameworkRootGateway({
|
|
20046
|
-
rootItem,
|
|
20047
|
-
debug: debug3
|
|
20048
|
-
}) {
|
|
20049
|
-
const runnerRegister = debug3 ? [...RUNNER_FRAMEWORK_ITEMS, debugResource.with(debug3)] : [...RUNNER_FRAMEWORK_ITEMS];
|
|
20050
|
-
const systemResource = createFrameworkNamespaceResource(
|
|
20051
|
-
FRAMEWORK_SYSTEM_RESOURCE_ID,
|
|
20052
|
-
SYSTEM_FRAMEWORK_ITEMS
|
|
20053
|
-
);
|
|
20054
|
-
const runnerResource = createFrameworkNamespaceResource(
|
|
20055
|
-
FRAMEWORK_RUNNER_RESOURCE_ID,
|
|
20056
|
-
runnerRegister
|
|
20057
|
-
);
|
|
20058
|
-
return defineResource({
|
|
20059
|
-
id: FRAMEWORK_ROOT_GATEWAY_ID,
|
|
20060
|
-
gateway: true,
|
|
20061
|
-
register: [systemResource, runnerResource, rootItem]
|
|
20062
|
-
});
|
|
20063
|
-
}
|
|
20064
|
-
__name(createFrameworkRootGateway, "createFrameworkRootGateway");
|
|
20065
|
-
|
|
20066
20267
|
// src/models/Store.ts
|
|
20067
20268
|
init_symbols();
|
|
20068
20269
|
var Store = class {
|
|
@@ -20324,7 +20525,7 @@ var Store = class {
|
|
|
20324
20525
|
if (this.#isInitialized) {
|
|
20325
20526
|
storeAlreadyInitializedError.throw();
|
|
20326
20527
|
}
|
|
20327
|
-
const frameworkRoot =
|
|
20528
|
+
const frameworkRoot = createFrameworkRootResource({
|
|
20328
20529
|
rootItem: root.with(config),
|
|
20329
20530
|
debug: options?.debug
|
|
20330
20531
|
});
|
|
@@ -20696,7 +20897,6 @@ function resolveExecutionContextConfig(executionContext) {
|
|
|
20696
20897
|
__name(resolveExecutionContextConfig, "resolveExecutionContextConfig");
|
|
20697
20898
|
|
|
20698
20899
|
// src/run.ts
|
|
20699
|
-
init_errors2();
|
|
20700
20900
|
var activeRunResults = /* @__PURE__ */ new Set();
|
|
20701
20901
|
function normalizeRunOptions(options) {
|
|
20702
20902
|
const debug3 = options?.debug;
|
|
@@ -20743,9 +20943,6 @@ async function run(resourceOrResourceWithConfig, options) {
|
|
|
20743
20943
|
const { resource: resource2, config } = extractResourceAndConfig(
|
|
20744
20944
|
resourceOrResourceWithConfig
|
|
20745
20945
|
);
|
|
20746
|
-
if (resource2.gateway === true) {
|
|
20747
|
-
runRootGatewayUnsupportedError.throw({ id: resource2.id });
|
|
20748
|
-
}
|
|
20749
20946
|
const services = createRuntimeServices({
|
|
20750
20947
|
mode: normalizedOptions.mode,
|
|
20751
20948
|
lifecycleMode: normalizedOptions.lifecycleMode,
|
|
@@ -21055,7 +21252,6 @@ function makeResourceBuilder(state) {
|
|
|
21055
21252
|
build() {
|
|
21056
21253
|
const definition = {
|
|
21057
21254
|
id: state.id,
|
|
21058
|
-
gateway: state.gateway,
|
|
21059
21255
|
dependencies: state.dependencies,
|
|
21060
21256
|
register: state.register,
|
|
21061
21257
|
middleware: state.middleware,
|
|
@@ -21094,7 +21290,6 @@ __name(makeResourceBuilder, "makeResourceBuilder");
|
|
|
21094
21290
|
function createResourceBuilder(id3, options) {
|
|
21095
21291
|
const initial = Object.freeze({
|
|
21096
21292
|
id: id3,
|
|
21097
|
-
gateway: options?.gateway === true,
|
|
21098
21293
|
filePath: options.filePath,
|
|
21099
21294
|
dependencies: void 0,
|
|
21100
21295
|
register: void 0,
|
|
@@ -22616,10 +22811,18 @@ init_errors2();
|
|
|
22616
22811
|
init_platform();
|
|
22617
22812
|
init_defineError();
|
|
22618
22813
|
init_check();
|
|
22619
|
-
var resources = Object.freeze({
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
var
|
|
22814
|
+
var resources = Object.freeze({
|
|
22815
|
+
...globalResources
|
|
22816
|
+
});
|
|
22817
|
+
var events = Object.freeze({
|
|
22818
|
+
...globalEvents
|
|
22819
|
+
});
|
|
22820
|
+
var middleware = Object.freeze({
|
|
22821
|
+
...globalMiddlewares
|
|
22822
|
+
});
|
|
22823
|
+
var tags = Object.freeze({
|
|
22824
|
+
...globalTags
|
|
22825
|
+
});
|
|
22623
22826
|
var debug2 = Object.freeze({ levels: debug.levels });
|
|
22624
22827
|
var r = Object.freeze({
|
|
22625
22828
|
resource,
|