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