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