@fabricorg/platform-host 7.3.0 → 7.4.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/CHANGELOG.md +35 -0
- package/README.md +22 -0
- package/dist/index.cjs +32 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +29 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ActorType, ActionId, ActionStatus, EvidencePacketReference, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ModuleRegistry, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
1
|
+
import { ActorType, ActionId, ActionStatus, EvidencePacketReference, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ModuleRegistry, ActionDefinition, AdapterImplementation, AdapterCircuitBreakerProvider, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
2
|
+
export { canonicalJson } from '@fabricorg/platform';
|
|
2
3
|
import { AssemblyLockfile } from '@fabricorg/assembly';
|
|
3
4
|
|
|
4
5
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
@@ -971,6 +972,15 @@ interface PlatformHostOptions<TDb> {
|
|
|
971
972
|
/** Resolve vertical- or runtime-local actions without mutating the process-wide registry. */
|
|
972
973
|
resolveAction?: (actionId: ActionId) => ActionDefinition<TDb> | undefined;
|
|
973
974
|
adapters?: readonly AdapterImplementation[];
|
|
975
|
+
/**
|
|
976
|
+
* Supplies the circuit breaker for each adapter call. Defaults to a new
|
|
977
|
+
* `AdapterCircuitBreakerRegistry` per Host instance, which creates one
|
|
978
|
+
* in-process breaker per `adapterType:operation` from that adapter's own
|
|
979
|
+
* `circuitBreaker` config, on first use, and none for adapters without one.
|
|
980
|
+
* Pass a shared registry or a custom provider to share breakers between
|
|
981
|
+
* Host instances, receive breaker telemetry, or set manual overrides.
|
|
982
|
+
*/
|
|
983
|
+
adapterCircuitBreakers?: AdapterCircuitBreakerProvider;
|
|
974
984
|
dispatcher?: PlatformActionDispatcher;
|
|
975
985
|
services?: FabricRuntimeServices;
|
|
976
986
|
idempotency?: {
|
|
@@ -1352,7 +1362,7 @@ interface PostgresMigration {
|
|
|
1352
1362
|
declare function applyPostgresMigrations(client: PlatformHostSqlClient, migrations: readonly PostgresMigration[]): Promise<void>;
|
|
1353
1363
|
|
|
1354
1364
|
declare const PARAMETER_DIGEST_ALGORITHM: "fabric-canonical-json-sha256-v1";
|
|
1355
|
-
|
|
1365
|
+
|
|
1356
1366
|
declare function digestParameters(parameters: unknown): string;
|
|
1357
1367
|
|
|
1358
1368
|
/**
|
|
@@ -1515,4 +1525,4 @@ declare function tenantIsolationChecks(): readonly TenantIsolationCheck[];
|
|
|
1515
1525
|
/** Run every check, returning each result rather than throwing on the first. */
|
|
1516
1526
|
declare function runTenantIsolationChecks(subject: TenantIsolationSubject): Promise<TenantIsolationResult>;
|
|
1517
1527
|
|
|
1518
|
-
export { ActionAdmissionError, type ActionAdmissionRefusal, type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventActorDisclosure, type EnterpriseEventEnvelope, type EnterpriseEventPublishContext, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxActorDisclosure, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxRequeueAuthorizationInput, type OutboxRequeueHost, type OutboxRequeuePlatformHostStore, type OutboxRequeueRecord, type OutboxRequeueRefusal, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type RequeueOutboxDeadLetterInput, type RequeueOutboxDeadLetterRefusal, type RequeueOutboxDeadLetterResult, type RequeueOutboxDeadLetterStoreInput, type RequeueOutboxDeadLetterStoreResult, type ResolvePoliciesInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations,
|
|
1528
|
+
export { ActionAdmissionError, type ActionAdmissionRefusal, type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventActorDisclosure, type EnterpriseEventEnvelope, type EnterpriseEventPublishContext, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxActorDisclosure, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxRequeueAuthorizationInput, type OutboxRequeueHost, type OutboxRequeuePlatformHostStore, type OutboxRequeueRecord, type OutboxRequeueRefusal, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type RequeueOutboxDeadLetterInput, type RequeueOutboxDeadLetterRefusal, type RequeueOutboxDeadLetterResult, type RequeueOutboxDeadLetterStoreInput, type RequeueOutboxDeadLetterStoreResult, type ResolvePoliciesInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations, cloneOutboxRecord, createDurableSagaParentLifecycle, createGovernedActionHost, createStoreBackedActionDispatcher, digestParameters, emitPlatformHostTelemetry, getPlatformHostHealthSnapshot, outboxActorDisclosure, runOutboxRelayCycle, runPlatformActionWorker, runPlatformActionWorkerCycle, runTenantIsolationChecks, tenantIsolationChecks, toEnterpriseEventEnvelope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ActorType, ActionId, ActionStatus, EvidencePacketReference, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ModuleRegistry, ActionDefinition, AdapterImplementation, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
1
|
+
import { ActorType, ActionId, ActionStatus, EvidencePacketReference, AgentActionRoute, AgentActionRiskTier, MutationFootprint, ExecutionPrincipal, GovernanceRuntimeEvidence, PolicyOutcome, AssetEventEnvelope, ExecutionAttestation, ExternalReconciliation, PolicyObligation, PolicyObligationStatus, ModuleRegistry, ActionDefinition, AdapterImplementation, AdapterCircuitBreakerProvider, FabricRuntimeServices, AgentActionPolicyEvaluator, MutationGovernanceResolver, RuntimePolicyDefinition } from '@fabricorg/platform';
|
|
2
|
+
export { canonicalJson } from '@fabricorg/platform';
|
|
2
3
|
import { AssemblyLockfile } from '@fabricorg/assembly';
|
|
3
4
|
|
|
4
5
|
/** Version of the vendor-neutral health/readiness contract. */
|
|
@@ -971,6 +972,15 @@ interface PlatformHostOptions<TDb> {
|
|
|
971
972
|
/** Resolve vertical- or runtime-local actions without mutating the process-wide registry. */
|
|
972
973
|
resolveAction?: (actionId: ActionId) => ActionDefinition<TDb> | undefined;
|
|
973
974
|
adapters?: readonly AdapterImplementation[];
|
|
975
|
+
/**
|
|
976
|
+
* Supplies the circuit breaker for each adapter call. Defaults to a new
|
|
977
|
+
* `AdapterCircuitBreakerRegistry` per Host instance, which creates one
|
|
978
|
+
* in-process breaker per `adapterType:operation` from that adapter's own
|
|
979
|
+
* `circuitBreaker` config, on first use, and none for adapters without one.
|
|
980
|
+
* Pass a shared registry or a custom provider to share breakers between
|
|
981
|
+
* Host instances, receive breaker telemetry, or set manual overrides.
|
|
982
|
+
*/
|
|
983
|
+
adapterCircuitBreakers?: AdapterCircuitBreakerProvider;
|
|
974
984
|
dispatcher?: PlatformActionDispatcher;
|
|
975
985
|
services?: FabricRuntimeServices;
|
|
976
986
|
idempotency?: {
|
|
@@ -1352,7 +1362,7 @@ interface PostgresMigration {
|
|
|
1352
1362
|
declare function applyPostgresMigrations(client: PlatformHostSqlClient, migrations: readonly PostgresMigration[]): Promise<void>;
|
|
1353
1363
|
|
|
1354
1364
|
declare const PARAMETER_DIGEST_ALGORITHM: "fabric-canonical-json-sha256-v1";
|
|
1355
|
-
|
|
1365
|
+
|
|
1356
1366
|
declare function digestParameters(parameters: unknown): string;
|
|
1357
1367
|
|
|
1358
1368
|
/**
|
|
@@ -1515,4 +1525,4 @@ declare function tenantIsolationChecks(): readonly TenantIsolationCheck[];
|
|
|
1515
1525
|
/** Run every check, returning each result rather than throwing on the first. */
|
|
1516
1526
|
declare function runTenantIsolationChecks(subject: TenantIsolationSubject): Promise<TenantIsolationResult>;
|
|
1517
1527
|
|
|
1518
|
-
export { ActionAdmissionError, type ActionAdmissionRefusal, type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventActorDisclosure, type EnterpriseEventEnvelope, type EnterpriseEventPublishContext, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxActorDisclosure, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxRequeueAuthorizationInput, type OutboxRequeueHost, type OutboxRequeuePlatformHostStore, type OutboxRequeueRecord, type OutboxRequeueRefusal, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type RequeueOutboxDeadLetterInput, type RequeueOutboxDeadLetterRefusal, type RequeueOutboxDeadLetterResult, type RequeueOutboxDeadLetterStoreInput, type RequeueOutboxDeadLetterStoreResult, type ResolvePoliciesInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations,
|
|
1528
|
+
export { ActionAdmissionError, type ActionAdmissionRefusal, type ActionApprovalDecision, type ActionAuthorizationInput, type ActionExecutionAuthorizationInput, type ActionExecutionReason, type ActionInvocationPatch, type ActionInvocationRecord, type AdapterInvocationRecord, type AdapterInvocationStatus, type AdapterReconciliationOutcome, type ApprovalDecisionTransitionResult, type ApprovalPlatformHostStore, type AtomicMutationPlatformHostStore, type AuthorizationBinding, type AuthorizationGoverningMoment, type AuthorizationReconciliationOutcome, type BeginApprovalDecisionInput, type ClaimActionInvocationsInput, type ClaimOutboxInput, type CreateActionInvocationInput, type CreateDurableSagaParentLifecycleOptions, type DispatchActionInput, type DispatchActionResult, type EnterpriseEventActorDisclosure, type EnterpriseEventEnvelope, type EnterpriseEventPublishContext, type EnterpriseEventPublisher, type EventPayloadClassification, type ExecuteActionResult, type ExecuteInvocationOptions, type ExecutionAttestationRecord, type ExternalCompletion, ExternalCompletionError, type ExternalCompletionRefusal, type ExternalReconciliationRecord, type GovernancePlatformHostStore, type GovernedActionHost, type HitlDecisionEvidence, type HostCompensationRecord, type HostSagaParentApprovalInput, type HostSagaParentCancellationInput, type HostSagaParentCompletionInput, type HostSagaParentFailureInput, type HostSagaParentLifecycle, type HostSagaParentProgressInput, type HostSagaParentProgressRecord, type IdempotencyConflict, IdempotencyConflictError, type InvocationProvenance, type InvocationSource, type KnownActionExecutionReason, type ListActionInvocationsInput, MemoryPlatformHostStore, type MemoryPlatformHostTransactionProvider, type NamespacedAttributes, type OutboxActorDisclosure, type OutboxEventMetadata, type OutboxPlatformHostStore, type OutboxRecord, type OutboxRelayOptions, type OutboxRelayResult, type OutboxRequeueAuthorizationInput, type OutboxRequeueHost, type OutboxRequeuePlatformHostStore, type OutboxRequeueRecord, type OutboxRequeueRefusal, type OutboxStatus, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, type PendingAssetEvent, type PendingExternalCompletion, type PersistedActionApprovalDecision, type PlatformActionDispatcher, type PlatformActionWorkerCycleResult, type PlatformActionWorkerOptions, type PlatformHostAuthorization, type PlatformHostHealthCounts, type PlatformHostHealthOptions, type PlatformHostHealthQuery, type PlatformHostHealthSnapshot, type PlatformHostHealthStatus, type PlatformHostHealthStore, type PlatformHostLifecycleTelemetry, type PlatformHostMetricName, type PlatformHostMetricTelemetry, type PlatformHostMetricType, type PlatformHostMutationTransaction, type PlatformHostOptions, type PlatformHostReadinessReason, type PlatformHostSqlClient, type PlatformHostSqlResult, type PlatformHostStore, type PlatformHostTelemetry, type PlatformHostTelemetryAttribute, type PlatformHostTelemetryEventName, type PlatformHostTelemetryHook, type PlatformHostTelemetryInput, type PlatformHostTelemetryRecord, type PlatformHostWorkerHealthInput, type PolicyEvaluationRecord, type PolicyObligationRecord, type PostgresMigration, PostgresPlatformHostStore, type PostgresPlatformHostTransactionContext, type PostgresPlatformHostTransactionProvider, type ReconcileOverdueCompletionsInput, type RecordedExternalCompletion, type RecoverablePlatformHostStore, type RenewActionInvocationLeaseInput, type RequeueOutboxDeadLetterInput, type RequeueOutboxDeadLetterRefusal, type RequeueOutboxDeadLetterResult, type RequeueOutboxDeadLetterStoreInput, type RequeueOutboxDeadLetterStoreResult, type ResolvePoliciesInput, type SubmitActionInput, type SubmitActionResult, type TenantIsolationCheck, type TenantIsolationResult, type TenantIsolationScope, type TenantIsolationSubject, type UpdateLeasedActionInvocationInput, applyPostgresMigrations, cloneOutboxRecord, createDurableSagaParentLifecycle, createGovernedActionHost, createStoreBackedActionDispatcher, digestParameters, emitPlatformHostTelemetry, getPlatformHostHealthSnapshot, outboxActorDisclosure, runOutboxRelayCycle, runPlatformActionWorker, runPlatformActionWorkerCycle, runTenantIsolationChecks, tenantIsolationChecks, toEnterpriseEventEnvelope };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AdapterRegistry, createFabricId, assertGovernanceRuntimeEvidence, FABRIC_GOVERNANCE_CONTRACT_VERSION, assertMutationGovernanceContext, evaluatePolicyDefinitions, aggregatePolicyOutcomes, evaluateStateMachineTransition, executeWithAdapterRetry, assertAdapterOutcomeConsistency } from '@fabricorg/platform';
|
|
1
|
+
import { canonicalJson, AdapterRegistry, assertAdapterCircuitBreakerConfig, AdapterCircuitBreakerRegistry, createFabricId, assertGovernanceRuntimeEvidence, FABRIC_GOVERNANCE_CONTRACT_VERSION, assertMutationGovernanceContext, evaluatePolicyDefinitions, aggregatePolicyOutcomes, evaluateStateMachineTransition, executeWithAdapterRetry, isAdapterCircuitOpenError, assertAdapterOutcomeConsistency } from '@fabricorg/platform';
|
|
2
|
+
export { canonicalJson } from '@fabricorg/platform';
|
|
2
3
|
import { performance } from 'perf_hooks';
|
|
3
4
|
import { assertAssemblyRuntimeCompatible } from '@fabricorg/assembly';
|
|
4
5
|
import { createHash } from 'crypto';
|
|
@@ -43,16 +44,6 @@ var ExternalCompletionError = class extends Error {
|
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
var PARAMETER_DIGEST_ALGORITHM = "fabric-canonical-json-sha256-v1";
|
|
46
|
-
function canonicalJson(value) {
|
|
47
|
-
return JSON.stringify(sort(value));
|
|
48
|
-
}
|
|
49
|
-
function sort(value) {
|
|
50
|
-
if (Array.isArray(value)) return value.map(sort);
|
|
51
|
-
if (value && typeof value === "object") {
|
|
52
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, child]) => [key, sort(child)]));
|
|
53
|
-
}
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
47
|
function digestParameters(parameters) {
|
|
57
48
|
return createHash("sha256").update(canonicalJson(parameters)).digest("hex");
|
|
58
49
|
}
|
|
@@ -884,8 +875,12 @@ function createGovernedActionHost(options) {
|
|
|
884
875
|
}
|
|
885
876
|
}
|
|
886
877
|
const adapters = new AdapterRegistry();
|
|
887
|
-
for (const adapter of options.adapters ?? [])
|
|
878
|
+
for (const adapter of options.adapters ?? []) {
|
|
879
|
+
if (adapter.circuitBreaker) assertAdapterCircuitBreakerConfig(adapter.circuitBreaker);
|
|
880
|
+
adapters.register(adapter);
|
|
881
|
+
}
|
|
888
882
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
883
|
+
const circuitBreakers = options.adapterCircuitBreakers ?? new AdapterCircuitBreakerRegistry({ now: () => now().getTime() });
|
|
889
884
|
const extractEvents = options.extractEvents ?? DEFAULT_EXTRACT_EVENTS;
|
|
890
885
|
const configuredActionResolver = options.resolveAction ?? options.registry?.resolveAction;
|
|
891
886
|
if (!configuredActionResolver) throw new Error("Platform Host requires an explicit module registry or resolveAction function.");
|
|
@@ -1567,14 +1562,20 @@ function createGovernedActionHost(options) {
|
|
|
1567
1562
|
);
|
|
1568
1563
|
adapterDeadlineTimer.unref?.();
|
|
1569
1564
|
}
|
|
1565
|
+
const circuitBreaker = circuitBreakers.forAdapter(adapter);
|
|
1570
1566
|
const result2 = await executeWithAdapterRetry({
|
|
1567
|
+
...circuitBreaker ? { circuitBreaker } : {},
|
|
1571
1568
|
policy: step.retryPolicy ?? adapter.retryPolicy,
|
|
1572
1569
|
defaultIdempotent: adapter.idempotent,
|
|
1573
|
-
|
|
1570
|
+
// Every await before the call happens here, before breaker
|
|
1571
|
+
// admission, so nothing awaits between admission and the adapter.
|
|
1572
|
+
prepareAttempt: async (attempt) => {
|
|
1574
1573
|
await options.store.updateAdapterInvocation(adapterInvocationId, {
|
|
1575
1574
|
attempt,
|
|
1576
1575
|
updatedAt: now()
|
|
1577
1576
|
});
|
|
1577
|
+
},
|
|
1578
|
+
execute: (attempt, maxAttempts) => {
|
|
1578
1579
|
return adapter.execute(input, {
|
|
1579
1580
|
tenantId,
|
|
1580
1581
|
spaceId,
|
|
@@ -1592,6 +1593,7 @@ function createGovernedActionHost(options) {
|
|
|
1592
1593
|
getError: (result3) => result3.error,
|
|
1593
1594
|
classifyOutcome: (result3) => result3.outcome ?? "transient_failure",
|
|
1594
1595
|
classifyThrownError: (error) => {
|
|
1596
|
+
if (isAdapterCircuitOpenError(error)) return "transient_failure";
|
|
1595
1597
|
if (adapterController?.signal.aborted) return "timeout";
|
|
1596
1598
|
const message = error instanceof Error ? error.message : String(error);
|
|
1597
1599
|
if (/timeout|deadline|timed?\s*out/i.test(message)) return "timeout";
|
|
@@ -1769,6 +1771,19 @@ function createGovernedActionHost(options) {
|
|
|
1769
1771
|
error: message,
|
|
1770
1772
|
updatedAt: now()
|
|
1771
1773
|
});
|
|
1774
|
+
if (isAdapterCircuitOpenError(error)) {
|
|
1775
|
+
await appendEvent(invocation, {
|
|
1776
|
+
eventType: "AdapterInvocationFailed",
|
|
1777
|
+
subjectType: adapterEventSubject.subjectType,
|
|
1778
|
+
subjectId: adapterEventSubject.subjectId,
|
|
1779
|
+
payload: {
|
|
1780
|
+
adapterType: step.adapterType,
|
|
1781
|
+
operation: step.operation,
|
|
1782
|
+
reason: "circuit_open",
|
|
1783
|
+
...error.retryAfterMs !== void 0 ? { retryAfterMs: error.retryAfterMs } : {}
|
|
1784
|
+
}
|
|
1785
|
+
}, `adapter:${stepIndex}:failed`);
|
|
1786
|
+
}
|
|
1772
1787
|
return fail2(invocation, "failed", message);
|
|
1773
1788
|
} finally {
|
|
1774
1789
|
if (adapterDeadlineTimer) clearTimeout(adapterDeadlineTimer);
|
|
@@ -4447,6 +4462,6 @@ async function runTenantIsolationChecks(subject) {
|
|
|
4447
4462
|
return { passed: checks.every((check) => check.status !== "failed"), checks };
|
|
4448
4463
|
}
|
|
4449
4464
|
|
|
4450
|
-
export { ActionAdmissionError, ExternalCompletionError, IdempotencyConflictError, MemoryPlatformHostStore, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, PostgresPlatformHostStore, applyPostgresMigrations,
|
|
4465
|
+
export { ActionAdmissionError, ExternalCompletionError, IdempotencyConflictError, MemoryPlatformHostStore, PARAMETER_DIGEST_ALGORITHM, PLATFORM_HOST_CONTRACT_VERSION, PLATFORM_HOST_HEALTH_CONTRACT_VERSION, PLATFORM_HOST_METRIC_NAMES, PostgresPlatformHostStore, applyPostgresMigrations, cloneOutboxRecord, createDurableSagaParentLifecycle, createGovernedActionHost, createStoreBackedActionDispatcher, digestParameters, emitPlatformHostTelemetry, getPlatformHostHealthSnapshot, outboxActorDisclosure, runOutboxRelayCycle, runPlatformActionWorker, runPlatformActionWorkerCycle, runTenantIsolationChecks, tenantIsolationChecks, toEnterpriseEventEnvelope };
|
|
4451
4466
|
//# sourceMappingURL=index.js.map
|
|
4452
4467
|
//# sourceMappingURL=index.js.map
|