@reventlessdev/reventless-aws 3.0.0-alpha.344 → 3.0.0-alpha.345
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 +8 -0
- package/package.json +11 -11
- package/scripts/ProvisionIdentity.res +8 -3
- package/src/Platform.res +327 -328
- package/src/Platform.res.mjs +4 -2
- package/src/Platform_Casts.res +13 -4
- package/src/adapter/Api/AppSyncEventsSigner_Ops.res +8 -4
- package/src/adapter/Api/AppSync_EventsApi.res +12 -14
- package/src/adapter/Api/AppSync_Resolver_Native.res +3 -4
- package/src/adapter/Api/AppSync_Resolver_Retrying.res +78 -70
- package/src/adapter/Api/AppSync_SourceApiAssociation_Retrying.res +11 -8
- package/src/adapter/Api/Platform_AdminScan_Ops.res +15 -14
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res +10 -2
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda_Ops.res +40 -50
- package/src/adapter/Api/Platform_UIFragments_Lambda.res +39 -32
- package/src/adapter/Api/Platform_UIFragments_Lambda_Ops.res +5 -2
- package/src/adapter/Auth/Auth_ActiveRolePoolAttachment.res +0 -1
- package/src/adapter/Auth/Auth_ActiveRoleStore.res +1 -2
- package/src/adapter/Auth/Auth_ActiveRoleStore_Schema.res +1 -4
- package/src/adapter/Auth/Auth_ActiveRoleTrigger_Ops.res +5 -2
- package/src/adapter/Auth/Auth_Cognito.res +3 -9
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync.res +1 -4
- package/src/adapter/CommandGenerator/CommandGeneratorResolvers_AppSync_NoOp.res +3 -1
- package/src/adapter/CommandGenerator/InboundTranslationResolvers_AppSync.res +1 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS.res +7 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Async.res +6 -1
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_FIFO.res +7 -4
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Runtime.res +24 -18
- package/src/adapter/CommandTopic/CommandTopicChannel_SQS_Sync.res +9 -4
- package/src/adapter/CommandTopic/CommandTopicRegistry.res +1 -4
- package/src/adapter/Counter/CounterHandler_DynamoDbStream.res +15 -15
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb.res +9 -5
- package/src/adapter/DcbEventLog/DcbEventLogStorage_DynamoDb_Runtime.res +179 -213
- package/src/adapter/EventCollector/EventCollectorChannel_DynamoDbStream.res +5 -5
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res +6 -2
- package/src/adapter/EventCollector/EventCollectorChannel_SQS.res +14 -7
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_FIFO.res +14 -7
- package/src/adapter/EventCollector/EventCollectorChannel_SQS_Runtime.res +6 -3
- package/src/adapter/EventLog/EventLogStorage_DynamoDbStream.res +6 -1
- package/src/adapter/EventLog/EventLogStorage_DynamoDb_Runtime.res +13 -17
- package/src/adapter/EventLog/EventLogStorage_Postgres.res +7 -4
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync.res +12 -7
- package/src/adapter/EventLogSubscription/EventLogSubscription_AppSync_Ops.res +4 -2
- package/src/adapter/EventTopic/EventTopicPublisher_DynamoDbStream.res +3 -2
- package/src/adapter/EventTopic/EventTopicPublisher_SNS.res +20 -12
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_FIFO.res +21 -9
- package/src/adapter/EventTopic/EventTopicPublisher_SNS_Runtime.res +5 -3
- package/src/adapter/Geocoder/Geocoder_AwsLocation_Resolver.res +6 -3
- package/src/adapter/Mcp/MCP_Lambda.res +31 -46
- package/src/adapter/Messaging/Messaging_Ses_Backend.res +11 -7
- package/src/adapter/Messaging/Messaging_Ses_Backend.res.mjs +2 -4
- package/src/adapter/Monitoring/Monitoring_CloudWatch.res +16 -16
- package/src/adapter/Postgres/PgChangeFeedRelay_Builder.res +5 -10
- package/src/adapter/Postgres/PgChangeFeedRelay_Runtime.res +4 -2
- package/src/adapter/Postgres/PgConnection.res +6 -5
- package/src/adapter/Postgres/PgMigration_Builder.res +4 -8
- package/src/adapter/Postgres/PgRuntime.res +4 -7
- package/src/adapter/QueryDb/PgQueryResolver_Builder.res +9 -11
- package/src/adapter/QueryDb/PgQueryResolver_Lambda.res +22 -21
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res +114 -111
- package/src/adapter/QueryDb/QueryDbResolvers_Lambda.res +1 -7
- package/src/adapter/QueryDb/QueryDbStorage.res +4 -2
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb.res +23 -24
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDbStream.res +8 -2
- package/src/adapter/QueryDb/QueryDbStorage_DynamoDb_Runtime.res +71 -73
- package/src/adapter/QueryDb/QueryDbStorage_Postgres.res +5 -2
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res +1 -4
- package/src/adapter/QueryEngine/QueryEngine_DynamoDb.res +8 -2
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro.res +73 -81
- package/src/adapter/Runtime/AggregateRuntime_Builder_Micro_Async.res +72 -78
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate.res +44 -67
- package/src/adapter/Runtime/AggregateRuntime_Builder_PerAggregate_Async.res +44 -67
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single.res +53 -82
- package/src/adapter/Runtime/AggregateRuntime_Builder_Single_Async.res +47 -77
- package/src/adapter/Runtime/AutomationSliceEntryPoint_Ops.res +18 -11
- package/src/adapter/Runtime/AutomationSliceRuntime_Builder_Single.res +80 -97
- package/src/adapter/Runtime/CounterEntryPoint_Ops.res +2 -7
- package/src/adapter/Runtime/DcbCommandTopicEntryPoint_Ops.res +16 -10
- package/src/adapter/Runtime/EventCollectorEntryPoint_Ops.res +24 -15
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_PerEventCollector.res +17 -37
- package/src/adapter/Runtime/EventCollectorRuntime_Builder_Single.res +31 -57
- package/src/adapter/Runtime/EventMapperEntryPoint_Ops.res +18 -24
- package/src/adapter/Runtime/ExtensionPointEntryPoint_Ops.res +1 -5
- package/src/adapter/Runtime/ExtensionPointRuntime_Builder_PerExtensionPoint.res +4 -3
- package/src/adapter/Runtime/HeartbeatEntryPoint.res +0 -1
- package/src/adapter/Runtime/PgChangeFeedRelayEntryPoint.res +4 -2
- package/src/adapter/Runtime/PgMigrationEntryPoint.res +0 -1
- package/src/adapter/Runtime/PgQueryResolverEntryPoint_Ops.res +3 -2
- package/src/adapter/Runtime/PluginExtensionPointEntryPoint.res +1 -2
- package/src/adapter/Runtime/ProjectionEntryPoint_Ops.res +4 -5
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res +22 -10
- package/src/adapter/Runtime/RuntimeExtensionEntryPoint_Ops.res +8 -2
- package/src/adapter/Runtime/SideEffectHandlerRuntime_Builder_Single.res +14 -31
- package/src/adapter/Runtime/StateChangeSliceRuntime_Builder_Single.res +16 -17
- package/src/adapter/Runtime/StateViewSliceEntryPoint_Ops.res +10 -9
- package/src/adapter/Runtime/StateViewSliceRuntime_Builder_Single.res +46 -52
- package/src/adapter/Runtime/StreamRoutedEntryPoint_Ops.res +36 -41
- package/src/adapter/Runtime/TaskBucketEntryPoint_Ops.res +31 -37
- package/src/adapter/Runtime/TaskRuntime_Builder_PerBucket.res +6 -7
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents.res +4 -6
- package/src/adapter/ScheduledPublisher/ScheduledPublisher_CloudWatchEvents_Runtime.res +2 -6
- package/src/adapter/StateTopic/StateTopic_AppSync.res +21 -16
- package/src/adapter/StateTopic/StateTopic_AppSync_Ops.res +36 -32
- package/src/adapter/Task/TaskBucket_S3.res +6 -1
- package/src/adapter/Upload/Upload_Claim_S3.res +17 -20
- package/src/adapter/Upload/Upload_Claim_S3_Ops.res +5 -2
- package/src/adapter/Upload/Upload_Presign_S3.res +51 -49
- package/src/capability/Capability_Geocoding_AwsLocation.res +4 -1
- package/src/capability/Capability_Messaging.res +4 -5
- package/src/capability/Capability_Messaging_Ses.res +3 -1
- package/src/capability/Capability_ObjectStore_S3.res +1 -7
- package/src/components/Api/AppSync_Adapter.res +28 -41
- package/src/components/Api/AppSync_SdlDecorate.res +38 -30
- package/src/components/AutomationSlice_Builder.res +6 -4
- package/src/components/ExtensionPoint_Builder.res +9 -10
- package/src/components/InboundTranslationSlice_Builder.res +7 -8
- package/src/components/OutboundTranslationSlice_Builder.res +14 -8
- package/src/components/OutboundTranslationSlice_Builder.res.mjs +1 -1
- package/src/components/SideEffectHandler_Single.res +4 -4
- package/src/components/StateViewSlice_Builder.res +6 -4
- package/src/components/StateViewSlice_Builder_Stream.res +6 -4
- package/src/components/Task_Builder_PerBucket.res +10 -11
- package/src/plugin/cloner/ClonerRunner_Fargate.res +3 -10
- package/src/plugin/cloner/ClonerRunner_Fargate_Runtime.res +1 -4
- package/src/plugin/heartbeat/HeartbeatRunner_CloudWatchEvents.res +5 -5
- package/src/plugin/runtime/PluginExtensionPointRuntime_Builder.res +19 -21
- package/src/plugin/runtime/PluginRuntime_Builder.res +167 -188
- package/src/plugin/runtime/Util_PluginMessage_Runtime.res +6 -5
- package/src/plugin/stack/Plugin_Stack.res +104 -103
- package/src/util/Util_AlarmSpec.res +2 -1
- package/src/util/Util_AppSync.res +8 -2
- package/src/util/Util_AppSync_Caller.res +15 -14
- package/src/util/Util_Bundle.res +46 -42
- package/src/util/Util_CognitoGroupUser_Runtime.res +32 -34
- package/src/util/Util_Cognito_Runtime.res +11 -7
- package/src/util/Util_DeadLetterQueue.res +12 -2
- package/src/util/Util_DynamoDb.res +5 -3
- package/src/util/Util_DynamoDbStream.res +7 -3
- package/src/util/Util_DynamoDbStream_Runtime.res +1 -2
- package/src/util/Util_DynamoDb_Runtime.res +23 -41
- package/src/util/Util_HostUiDomain.res +6 -1
- package/src/util/Util_Kinesis_Runtime.res +10 -11
- package/src/util/Util_Lambda.res +12 -5
- package/src/util/Util_LambdaEnvBudget.res +5 -5
- package/src/util/Util_LambdaLogging.res +1 -2
- package/src/util/Util_LogGroup_Adopting.res +1 -4
- package/src/util/Util_ResourceNaming.res +1 -2
- package/src/util/Util_SNS.res +8 -3
- package/src/util/Util_SNS_FIFO.res +1 -1
- package/src/util/Util_SNS_Runtime.res +11 -10
- package/src/util/Util_SQS.res +4 -2
- package/src/util/Util_SQS_FIFO.res +5 -2
- package/src/util/Util_SQS_Runtime.res +37 -36
- package/src/util/Util_ShellConfig.res +3 -2
- package/src/util/Util_StaticBundle.res +1 -3
- package/src/util/Util_StoreLayout.res +4 -1
- package/tests/AWS_TagsTest.res +16 -5
- package/tests/AppSyncEventsSigner_OpsTest.res +11 -2
- package/tests/AppSync_AdapterTest.res +203 -224
- package/tests/AppSync_Resolver_RetryingTest.res +64 -44
- package/tests/AppSync_RetirementNarrowingTest.res +59 -46
- package/tests/AppSync_SdlDecorateTest.res +22 -20
- package/tests/AppSync_SourceApiAssociation_RetryingTest.res +40 -22
- package/tests/Auth_ActiveRolePoolAttachmentTest.res +114 -107
- package/tests/Auth_ActiveRoleStoreTest.res +12 -9
- package/tests/Auth_ActiveRoleStore_SchemaTest.res +2 -1
- package/tests/Auth_ActiveRoleTrigger_OpsTest.res +20 -16
- package/tests/Auth_CognitoTest.res +31 -46
- package/tests/AutomationSliceEntryPoint_OpsTest.res +69 -67
- package/tests/BakeConvergenceTest.res +22 -25
- package/tests/Capability_MessagingTest.res +28 -12
- package/tests/CommandTopicQueuePolicyTest.res +1 -2
- package/tests/CounterEntryPoint_OpsTest.res +3 -7
- package/tests/DcbEventLogStorage_DynamoDb_RuntimeTest.res +306 -210
- package/tests/EventCollectorConnectLambdaPreviewTest.res +14 -7
- package/tests/EventCollectorEntryPoint_OpsTest.res +12 -4
- package/tests/EventCollectorPluginDefinitionAssetTest.res +18 -11
- package/tests/EventCollectorReadyGateTest.res +5 -4
- package/tests/EventLogStorage_DynamoDb_RuntimeTest.res +1 -2
- package/tests/EventMapperEntryPoint_OpsTest.res +1 -3
- package/tests/ExtensionPointEntryPoint_OpsTest.res +1 -4
- package/tests/HandlerFactoryDispatchTest.res +97 -70
- package/tests/MCP_LambdaTest.res +16 -27
- package/tests/PgChangeFeedRelay_IntegrationTest.res +123 -93
- package/tests/PgChangeFeedRelay_RuntimeTest.res +13 -10
- package/tests/PgMigrationEntryPoint_IntegrationTest.res +0 -1
- package/tests/PgPipeline_IntegrationTest.res +80 -66
- package/tests/PgQueryDbUnion_IntegrationTest.res +1 -2
- package/tests/PgQueryResolverEntryPoint_OpsTest.res +2 -6
- package/tests/PgQueryResolver_LambdaTest.res +41 -24
- package/tests/Platform_AdminScan_OpsTest.res +4 -1
- package/tests/Platform_ComponentDefinitions_Lambda_OpsTest.res +137 -129
- package/tests/ProjectionEntryPoint_DisplayNameTest.res +7 -3
- package/tests/ProjectionEntryPoint_UnionStampTest.res +3 -2
- package/tests/ProvisionIdentityTest.res +2 -6
- package/tests/QueryDbOwnerIndexTableTest.res +6 -4
- package/tests/QueryDbResolvers_AppSyncTest.res +23 -16
- package/tests/QueryInterceptor_LambdaTest.res +11 -13
- package/tests/ReadModelEntryPoint_OpsTest.res +43 -41
- package/tests/RuntimeExtensionEntryPoint_OpsTest.res +4 -3
- package/tests/SideEffectEntryPoint_OpsTest.res +23 -18
- package/tests/StateChangeDescriptorParityTest.res +28 -26
- package/tests/StateTopicKeySchemaTest.res +18 -15
- package/tests/StateViewSliceEntryPoint_OpsTest.res +55 -44
- package/tests/TaskBucketEntryPoint_OpsTest.res +13 -13
- package/tests/Upload_ClaimTest.res +3 -3
- package/tests/Util_AwsErrorTest.res +4 -7
- package/tests/Util_BundleDependencyClosureTest.res +15 -3
- package/tests/Util_BundleEsmLoaderTest.res +3 -3
- package/tests/Util_BundleResolveTest.res +4 -6
- package/tests/Util_BundleRuntimeExtensionTest.res +17 -18
- package/tests/Util_DcbMetricsTest.res +6 -6
- package/tests/Util_DynamoDbStreamTest.res +4 -5
- package/tests/Util_DynamoDbTest.res +3 -2
- package/tests/Util_LambdaEnvBudgetTest.res +22 -18
- package/tests/Util_LambdaLoggingTest.res +9 -8
- package/tests/Util_LogGroup_AdoptingTest.res +10 -5
- package/tests/Util_LogRetentionTest.res +6 -2
- package/tests/Util_OwnerScopeEnvTest.res +10 -8
- package/tests/Util_SQS_RuntimeTest.res +5 -7
- package/tests/Util_ShellConfigTest.res +7 -17
- package/tests/Util_StaticBundleTest.res +3 -8
- package/tests/Util_StoreLayoutTest.res +17 -12
- package/tests/integration/AggregateEntryPoint_IntegrationTest.res +1 -4
- package/tests/integration/DcbCommandTopicEntryPoint_IntegrationTest.res +15 -15
- package/tests/integration/DcbEventLogStorage_DynamoDb_IntegrationTest.res +296 -232
- package/tests/integration/DcbIntegrationHarness.res +8 -8
- package/tests/integration/EpCompositeSlice.res +16 -8
- package/tests/integration/QueryDbUnion_DynamoDb_IntegrationTest.res +8 -10
- package/tests/integration/StateViewSliceEntryPoint_IntegrationTest.res +10 -10
- package/tests/integration/SvsTestSlice_Projection.res +1 -3
- package/tests/util/Util_AlarmSpecTest.res +62 -49
|
@@ -36,8 +36,9 @@ let keyEl = (name, keyType) =>
|
|
|
36
36
|
// full (ALL) projection; per-tag `tag_<key>` GSIs are KEYS_ONLY. Uses the same
|
|
37
37
|
// predicate as the deploy-time `make` so the two never drift.
|
|
38
38
|
let gsi = indexName => {
|
|
39
|
-
let projection =
|
|
40
|
-
|
|
39
|
+
let projection = DcbEventLogStorage_DynamoDb_Runtime.indexKeepsFullProjection(indexName)
|
|
40
|
+
? "ALL"
|
|
41
|
+
: "KEYS_ONLY"
|
|
41
42
|
Dict.fromArray([
|
|
42
43
|
("IndexName", s(indexName)),
|
|
43
44
|
("KeySchema", [keyEl(indexName, "HASH"), keyEl("position", "RANGE")]->JSON.Encode.array),
|
|
@@ -81,8 +82,7 @@ let createDcbTableWithTagKeys = async (
|
|
|
81
82
|
tableName,
|
|
82
83
|
tagKeys: array<string>,
|
|
83
84
|
): Util_DynamoDb_Runtime.resolvedTable => {
|
|
84
|
-
let indexNames =
|
|
85
|
-
tagKeys->Array.map(k => `tag_${k}`)->Array.concat(["tag_composite"])
|
|
85
|
+
let indexNames = tagKeys->Array.map(k => `tag_${k}`)->Array.concat(["tag_composite"])
|
|
86
86
|
let attributeDefinitions = Array.concat(
|
|
87
87
|
[attrDef("id"), attrDef("position")],
|
|
88
88
|
indexNames->Array.map(attrDef),
|
|
@@ -110,8 +110,8 @@ let createDcbTableWithTagKeys = async (
|
|
|
110
110
|
// entity) rather than per-member `fence#<member>:…` rows.
|
|
111
111
|
let scanFenceIds = async (table: Util_DynamoDb_Runtime.resolvedTable): array<string> => {
|
|
112
112
|
let items = await Util_DynamoDb_Runtime.scanStream({tableName: table.name})
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
->Stream.runCollect
|
|
114
|
+
->Effect.runPromise
|
|
115
115
|
items->Array.filterMap(item =>
|
|
116
116
|
item
|
|
117
117
|
->JSON.Decode.object
|
|
@@ -126,8 +126,8 @@ let scanFenceIds = async (table: Util_DynamoDb_Runtime.resolvedTable): array<str
|
|
|
126
126
|
// persisted — the signal that a composite slice could read back its own state.
|
|
127
127
|
let scanEventTypes = async (table: Util_DynamoDb_Runtime.resolvedTable): array<string> => {
|
|
128
128
|
let items = await Util_DynamoDb_Runtime.scanStream({tableName: table.name})
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
->Stream.runCollect
|
|
130
|
+
->Effect.runPromise
|
|
131
131
|
items->Array.filterMap(item =>
|
|
132
132
|
item
|
|
133
133
|
->JSON.Decode.object
|
|
@@ -29,12 +29,16 @@ type consumedEvent =
|
|
|
29
29
|
@schema
|
|
30
30
|
type command =
|
|
31
31
|
| AddResource({
|
|
32
|
-
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
33
|
-
|
|
32
|
+
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
33
|
+
string,
|
|
34
|
+
resourceName: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=1, ~sep="/"))
|
|
35
|
+
string,
|
|
34
36
|
})
|
|
35
37
|
| TouchResource({
|
|
36
|
-
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
37
|
-
|
|
38
|
+
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
39
|
+
string,
|
|
40
|
+
resourceName: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=1, ~sep="/"))
|
|
41
|
+
string,
|
|
38
42
|
})
|
|
39
43
|
|
|
40
44
|
@schema
|
|
@@ -45,12 +49,16 @@ type error =
|
|
|
45
49
|
@schema
|
|
46
50
|
type event =
|
|
47
51
|
| ResourceAdded({
|
|
48
|
-
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
49
|
-
|
|
52
|
+
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
53
|
+
string,
|
|
54
|
+
resourceName: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=1, ~sep="/"))
|
|
55
|
+
string,
|
|
50
56
|
})
|
|
51
57
|
| ResourceTouched({
|
|
52
|
-
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
53
|
-
|
|
58
|
+
environment: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=0, ~sep="/"))
|
|
59
|
+
string,
|
|
60
|
+
resourceName: @s.matches(Reventless.DcbTag.compositePartitionMember(~position=1, ~sep="/"))
|
|
61
|
+
string,
|
|
54
62
|
})
|
|
55
63
|
|
|
56
64
|
let name = "EpCompositeSlice"
|
|
@@ -57,11 +57,10 @@ describe("QueryDb (DynamoDB) round-trips a union field", () => {
|
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
// The item as a read door hands it back.
|
|
60
|
-
let stored =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
->Effect.runPromise
|
|
60
|
+
let stored = await jsonOps.loadStream("c-1")
|
|
61
|
+
->Stream.runCollect
|
|
62
|
+
->Effect.catchAll(_ => Effect.succeed([]))
|
|
63
|
+
->Effect.runPromise
|
|
65
64
|
let typename =
|
|
66
65
|
stored
|
|
67
66
|
->Array.get(0)
|
|
@@ -72,11 +71,10 @@ describe("QueryDb (DynamoDB) round-trips a union field", () => {
|
|
|
72
71
|
->Option.flatMap(JSON.Decode.string)
|
|
73
72
|
expect(typename)->toEqual(Some("GeolocationLocated"))
|
|
74
73
|
|
|
75
|
-
let items =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
->Effect.runPromise
|
|
74
|
+
let items = await Ops.loadStream("c-1"->CustomersSpec.Id.makeFromString)
|
|
75
|
+
->Stream.runCollect
|
|
76
|
+
->Effect.catchAll(_ => Effect.succeed([]))
|
|
77
|
+
->Effect.runPromise
|
|
80
78
|
switch items {
|
|
81
79
|
| [{geolocation: Located({lat, lng})}] => expect((lat, lng))->toEqual((48.2082, 16.3738))
|
|
82
80
|
| _ => expect("round trip")->toBe("Located with its point intact")
|
|
@@ -138,11 +138,12 @@ describe("StateViewSliceEntryPoint integration", () => {
|
|
|
138
138
|
|
|
139
139
|
let productIds =
|
|
140
140
|
rows
|
|
141
|
-
->Array.filterMap(
|
|
142
|
-
row
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
->Array.filterMap(
|
|
142
|
+
row =>
|
|
143
|
+
row
|
|
144
|
+
->JSON.Decode.object
|
|
145
|
+
->Option.flatMap(o => o->Dict.get("productId"))
|
|
146
|
+
->Option.flatMap(JSON.Decode.string),
|
|
146
147
|
)
|
|
147
148
|
->Array.toSorted(String.compare)
|
|
148
149
|
expect(productIds)->toEqual(["prod-a", "prod-b"])
|
|
@@ -150,16 +151,15 @@ describe("StateViewSliceEntryPoint integration", () => {
|
|
|
150
151
|
// The runtime path's union stamp, against real DynamoDB. The deployed
|
|
151
152
|
// Lambdas assemble JSON-level ops and skipped it entirely, so a member
|
|
152
153
|
// resolved to null and took its non-nullable parent with it.
|
|
153
|
-
let members =
|
|
154
|
-
|
|
155
|
-
->Array.filterMap(row =>
|
|
154
|
+
let members = rows->Array.filterMap(
|
|
155
|
+
row =>
|
|
156
156
|
row
|
|
157
157
|
->JSON.Decode.object
|
|
158
158
|
->Option.flatMap(o => o->Dict.get("fulfilment"))
|
|
159
159
|
->Option.flatMap(JSON.Decode.object)
|
|
160
160
|
->Option.flatMap(o => o->Dict.get("__typename"))
|
|
161
|
-
->Option.flatMap(JSON.Decode.string)
|
|
162
|
-
|
|
161
|
+
->Option.flatMap(JSON.Decode.string),
|
|
162
|
+
)
|
|
163
163
|
expect(members)->toEqual(["FulfilmentShipped", "FulfilmentShipped"])
|
|
164
164
|
|
|
165
165
|
await H.deleteTable(table)
|
|
@@ -17,9 +17,7 @@ let project = ({event}: Reventless.StateViewSlice.consumed<consumedEvent>) =>
|
|
|
17
17
|
cartId,
|
|
18
18
|
states => {
|
|
19
19
|
let others = states->Array.filter(s => s.productId != productId)
|
|
20
|
-
others->Array.concat([
|
|
21
|
-
{cartId, productId, qty, fulfilment: Shipped({carrier: "dhl"})},
|
|
22
|
-
])
|
|
20
|
+
others->Array.concat([{cartId, productId, qty, fulfilment: Shipped({carrier: "dhl"})}])
|
|
23
21
|
},
|
|
24
22
|
),
|
|
25
23
|
]
|
|
@@ -29,45 +29,51 @@ describe("Util_AlarmSpec", () => {
|
|
|
29
29
|
|
|
30
30
|
// The case that went unnoticed on a deployed estate: a heartbeat that stops
|
|
31
31
|
// emits no errors AND no invocations, so nothing an Errors alarm can see.
|
|
32
|
-
testSync(
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
testSync(
|
|
33
|
+
"a scheduler also alarms on its own silence, and that alarm treats missing data as breaching",
|
|
34
|
+
() => {
|
|
35
|
+
let specs = A.forKind(~kind=Scheduler, ~silenceWindowSeconds=1800)
|
|
36
|
+
expect(specs->Array.length)->toBe(2)
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
let silence = specs->Array.getUnsafe(1)
|
|
39
|
+
expect(silence.metricName)->toBe("Invocations")
|
|
40
|
+
expect(silence.comparisonOperator)->toBe("LessThanThreshold")
|
|
41
|
+
expect(silence.period)->toBe(1800)
|
|
42
|
+
expect(silence.treatMissingData)->toBe("breaching")
|
|
43
|
+
// Distinct suffix, or the two alarms would collide on one resource name.
|
|
44
|
+
expect(silence.suffix)->toBe("Silent")
|
|
45
|
+
expect(silence.meaning)->toBe("has not run for 30 minutes")
|
|
46
|
+
},
|
|
47
|
+
)
|
|
45
48
|
|
|
46
49
|
testSync("the silence window defaults to an hour — twelve missed heartbeats", () => {
|
|
47
50
|
let silence = A.forKind(~kind=Scheduler)->Array.getUnsafe(1)
|
|
48
51
|
expect(silence.period)->toBe(3600)
|
|
49
52
|
})
|
|
50
53
|
|
|
51
|
-
testSync(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
A.
|
|
54
|
+
testSync(
|
|
55
|
+
"resource names separate a unit's alarms, and like-named components of different plugins",
|
|
56
|
+
() => {
|
|
57
|
+
let specs = A.forKind(~kind=Scheduler)
|
|
58
|
+
let nameFor = (spec: A.t, ~plugin) =>
|
|
59
|
+
A.resourceName(~kind=Scheduler, ~name="Heartbeat", ~plugin, ~suffix=spec.suffix)
|
|
55
60
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
expect(nameFor(specs->Array.getUnsafe(0), ~plugin=Some("Catalog")))->toBe(
|
|
62
|
+
"alarm-scheduler-Catalog-Heartbeat",
|
|
63
|
+
)
|
|
64
|
+
expect(nameFor(specs->Array.getUnsafe(1), ~plugin=Some("Catalog")))->toBe(
|
|
65
|
+
"alarm-scheduler-Catalog-HeartbeatSilent",
|
|
66
|
+
)
|
|
67
|
+
// Two plugins can own like-named components; without the plugin these collide.
|
|
68
|
+
expect(nameFor(specs->Array.getUnsafe(0), ~plugin=Some("Ordering")))->toBe(
|
|
69
|
+
"alarm-scheduler-Ordering-Heartbeat",
|
|
70
|
+
)
|
|
71
|
+
// Platform substrate belongs to no plugin.
|
|
72
|
+
expect(
|
|
73
|
+
A.resourceName(~kind=DeadLetterSink, ~name="DeadLetterQueue", ~plugin=None, ~suffix=""),
|
|
74
|
+
)->toBe("alarm-deadlettersink-DeadLetterQueue")
|
|
75
|
+
},
|
|
76
|
+
)
|
|
71
77
|
|
|
72
78
|
// A state-change message carries the description and neither the tags nor the
|
|
73
79
|
// name, so everything a reader or a parser needs has to be in this one string.
|
|
@@ -81,8 +87,12 @@ describe("Util_AlarmSpec", () => {
|
|
|
81
87
|
~spec,
|
|
82
88
|
~logs=Some("/aws/lambda/online-shop-AllAggregatesCmdHandler"),
|
|
83
89
|
)
|
|
84
|
-
expect(
|
|
85
|
-
|
|
90
|
+
expect(
|
|
91
|
+
desc->String.includes("'AllAggregatesCmdHandler' (plugin Ordering, platform online-shop)"),
|
|
92
|
+
)->toBe(true)
|
|
93
|
+
expect(desc->String.includes("Logs: /aws/lambda/online-shop-AllAggregatesCmdHandler."))->toBe(
|
|
94
|
+
true,
|
|
95
|
+
)
|
|
86
96
|
expect(
|
|
87
97
|
desc->String.includes(
|
|
88
98
|
"[reventless plugin=Ordering platform=online-shop component=AllAggregatesCmdHandler kind=commandhandler]",
|
|
@@ -90,20 +100,23 @@ describe("Util_AlarmSpec", () => {
|
|
|
90
100
|
)->toBe(true)
|
|
91
101
|
})
|
|
92
102
|
|
|
93
|
-
testSync(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
~kind=DeadLetterSink
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
testSync(
|
|
104
|
+
"a unit owned by no plugin claims none, and one with no logs promises no address",
|
|
105
|
+
() => {
|
|
106
|
+
let spec = A.forKind(~kind=DeadLetterSink)->Array.getUnsafe(0)
|
|
107
|
+
let desc = A.description(
|
|
108
|
+
~kind=DeadLetterSink,
|
|
109
|
+
~name="DeadLetterQueue",
|
|
110
|
+
~plugin=None,
|
|
111
|
+
~platform=None,
|
|
112
|
+
~spec,
|
|
113
|
+
~logs=None,
|
|
114
|
+
)
|
|
115
|
+
// A dead-letter queue is shared by every plugin in the estate — naming one
|
|
116
|
+
// would be a lie, and an empty parenthesis is noise.
|
|
117
|
+
expect(desc->String.includes("(plugin"))->toBe(false)
|
|
118
|
+
expect(desc->String.includes("Logs:"))->toBe(false)
|
|
119
|
+
expect(desc->String.includes("kind=deadlettersink"))->toBe(true)
|
|
120
|
+
},
|
|
121
|
+
)
|
|
109
122
|
})
|