@reventlessdev/reventless-core 3.0.0-alpha.170 → 3.0.0-alpha.171
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 +7 -0
- package/package.json +14 -14
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res +5 -2
- package/src/components/ExtensionPoint/ExtensionPoint_Builder.res.mjs +3 -3
- package/src/components/Task/Task_Builder.res +6 -4
- package/src/components/Task/Task_Builder.res.mjs +4 -4
- package/src/plugin/connect/PluginExtensionPoint_Builder.res +2 -0
- package/src/plugin/connect/PluginExtensionPoint_Builder.res.mjs +3 -3
- package/tests/IdentityTest.res.mjs +0 -174
- package/tests/adapter/MonitoringTest.res.mjs +0 -82
- package/tests/admin/Platform_ComponentDefinitionsApiTest.res.mjs +0 -356
- package/tests/admin/Platform_UIFragmentsApiTest.res.mjs +0 -101
- package/tests/aggregate/AggregateCacheTest.res.mjs +0 -433
- package/tests/aggregate/AggregateCallbackTest.res.mjs +0 -143
- package/tests/aggregate/AggregateCausationTest.res.mjs +0 -47
- package/tests/aggregate/AggregateConflictTest.res.mjs +0 -386
- package/tests/aggregate/AggregateFixtures.res.mjs +0 -308
- package/tests/aggregate/AggregateRejectionTest.res.mjs +0 -166
- package/tests/aggregate/AggregateSnapshotTest.res.mjs +0 -645
- package/tests/api/ApiNoApiTest.res.mjs +0 -90
- package/tests/api/GraphQL_StitcherTest.res.mjs +0 -112
- package/tests/api/SimpleTest.res.mjs +0 -10
- package/tests/api/SuryToJsonSchemaTest.res.mjs +0 -674
- package/tests/commandgenerator/CommandGeneratorCallbackTest.res.mjs +0 -160
- package/tests/commandgenerator/CommandGeneratorFixtures.res.mjs +0 -197
- package/tests/commandtopic/CommandTopicCallbackFixtures.res.mjs +0 -152
- package/tests/commandtopic/CommandTopicCallbackTest.res.mjs +0 -106
- package/tests/commandtopic/CommandTopicHelpersRejectionTest.res.mjs +0 -109
- package/tests/counter/CounterCallbackTest.res.mjs +0 -140
- package/tests/counter/CounterFixtures.res.mjs +0 -67
- package/tests/dcb/DcbDecodeTest.res.mjs +0 -194
- package/tests/dcb/DcbEventLogOperationsTest.res.mjs +0 -268
- package/tests/dcb/DcbFixtures.res.mjs +0 -534
- package/tests/dcb/DcbScopeInferenceTest.res.mjs +0 -480
- package/tests/dcb/DcbStateChangeSliceTest.res.mjs +0 -540
- package/tests/dcb/DcbTagTest.res.mjs +0 -867
- package/tests/dcb/DcbValidationTest.res.mjs +0 -476
- package/tests/eventlog/EventLogFixtures.res.mjs +0 -196
- package/tests/eventlog/EventLogOperationsTest.res.mjs +0 -192
- package/tests/eventlog/EventLogRetryTest.res.mjs +0 -195
- package/tests/eventmapper/EventMapperCallbackTest.res.mjs +0 -141
- package/tests/eventmapper/EventMapperFixtures.res.mjs +0 -440
- package/tests/eventmapper/EventMapperTest.res.mjs +0 -83
- package/tests/eventtopic/EventTopicFixtures.res.mjs +0 -65
- package/tests/eventtopic/EventTopicOperationsTest.res.mjs +0 -71
- package/tests/extensionpoint/ExtensionPointCallbackTest.res.mjs +0 -94
- package/tests/extensionpoint/ExtensionPointFixtures.res.mjs +0 -205
- package/tests/extensionpoint/ExtensionPointOperationsTest.res.mjs +0 -304
- package/tests/ftp/FTPTest.res.mjs +0 -88
- package/tests/logger/LogFormatTest.res.mjs +0 -309
- package/tests/logger/LoggerLazyTest.res.mjs +0 -40
- package/tests/message/MessageTest.res.mjs +0 -218
- package/tests/message/MetaEnvelopeTest.res.mjs +0 -188
- package/tests/plugin/ManifestVisibilityTest.res.mjs +0 -215
- package/tests/plugin/PluginSpecExperiment.res.mjs +0 -31
- package/tests/plugin/PluginStructureTest.res.mjs +0 -419
- package/tests/plugin/PluginVersionTest.res.mjs +0 -30
- package/tests/plugin/SchemaWalkerTest.res.mjs +0 -160
- package/tests/plugin/StateChangeSlice/PsPlaceOrder.res.mjs +0 -62
- package/tests/plugin/StateChangeSlice/PsShipOrder.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsAnnotatedView.res.mjs +0 -95
- package/tests/plugin/StateViewSlice/PsAvailableProductsView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsCustomersView.res.mjs +0 -69
- package/tests/plugin/StateViewSlice/PsOrdersView.res.mjs +0 -81
- package/tests/poc/StructuralSubtypingPoc.res.mjs +0 -61
- package/tests/projection/ProjectionOptimizeTest.res.mjs +0 -75
- package/tests/querydb/QueryDbFixtures.res.mjs +0 -135
- package/tests/querydb/QueryDbOperationsTest.res.mjs +0 -168
- package/tests/sideeffecthandler/SideEffectHandlerCallbackTest.res.mjs +0 -77
- package/tests/sideeffecthandler/SideEffectHandlerFixtures.res.mjs +0 -139
- package/tests/util/CommandPublisherTest.res.mjs +0 -78
- package/tests/util/CsvStreamTest.res.mjs +0 -51
- package/tests/util/LruTest.res.mjs +0 -105
- package/tests/util/MetricsTest.res.mjs +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.171 (2026-07-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **runtime:** platform-supplied EP/task pod runtime floors ([37544d0](https://github.com/ReventlessDev/reventless-core/commit/37544d029d278bbcae6eeb0f583da07d6ce70f04))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.170 (2026-07-16)
|
|
7
14
|
|
|
8
15
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.171",
|
|
4
4
|
"description": "Core package for Reventless framework",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"jest": {
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"sury": "11.0.0-alpha.4",
|
|
30
30
|
"uuid": "^13.0.0",
|
|
31
|
-
"@reventlessdev/rescript-effect": "0.1.0-alpha.
|
|
32
|
-
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.
|
|
33
|
-
"@reventlessdev/rescript-
|
|
34
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.
|
|
35
|
-
"@reventlessdev/rescript-
|
|
36
|
-
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.
|
|
37
|
-
"@reventlessdev/rescript-
|
|
38
|
-
"@reventlessdev/reventless-
|
|
39
|
-
"@reventlessdev/reventless-interop": "3.0.0-alpha.
|
|
40
|
-
"@reventlessdev/
|
|
41
|
-
"@reventlessdev/
|
|
31
|
+
"@reventlessdev/rescript-effect": "0.1.0-alpha.29",
|
|
32
|
+
"@reventlessdev/rescript-hash-object": "1.2.0-alpha.13",
|
|
33
|
+
"@reventlessdev/rescript-node-streams": "1.1.0-alpha.13",
|
|
34
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.9",
|
|
35
|
+
"@reventlessdev/rescript-fast-csv": "1.2.0-alpha.14",
|
|
36
|
+
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.17",
|
|
37
|
+
"@reventlessdev/rescript-ssh2": "1.1.0-alpha.14",
|
|
38
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.102",
|
|
39
|
+
"@reventlessdev/reventless-interop": "3.0.0-alpha.28",
|
|
40
|
+
"@reventlessdev/rescript-uuid": "1.1.0-alpha.17",
|
|
41
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.79"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"rescript": "12.3.0",
|
|
45
45
|
"sury-ppx": "11.0.0-alpha.2",
|
|
46
|
-
"@reventlessdev/reventless-ppx": "1.0.0-alpha.
|
|
46
|
+
"@reventlessdev/reventless-ppx": "1.0.0-alpha.54"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"rescript": "12.3.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|
|
57
57
|
"url": "git+https://github.com/ReventlessDev/reventless-core.git",
|
|
58
|
-
"directory": "reventless/
|
|
58
|
+
"directory": "reventless/core"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "rescript build",
|
|
@@ -7,6 +7,7 @@ module Make = (
|
|
|
7
7
|
EventTopicAdapter: EventTopic_Adapter.Publisher,
|
|
8
8
|
ExtensionPointRuntimeBuilder: ExtensionPointRuntime_Builder.T
|
|
9
9
|
with module CommandTopicChannel := CommandTopicChannel,
|
|
10
|
+
Defaults: ReventlessInfra.RuntimeDefaults.T,
|
|
10
11
|
): ExtensionPoint.T => {
|
|
11
12
|
module Spec = Spec
|
|
12
13
|
|
|
@@ -92,8 +93,10 @@ module Make = (
|
|
|
92
93
|
commandTopic->ExtensionPointRuntimeBuilder.forCommandTopic(
|
|
93
94
|
~handler,
|
|
94
95
|
~connect=SpecificCommandTopic.connect(commandTopic, ~resources, ...),
|
|
95
|
-
~memorySize=runtime->ReventlessInfra.RuntimeHints.resolveMemory(
|
|
96
|
-
|
|
96
|
+
~memorySize=runtime->ReventlessInfra.RuntimeHints.resolveMemory(
|
|
97
|
+
~default=Defaults.memorySize,
|
|
98
|
+
),
|
|
99
|
+
~timeout=runtime->ReventlessInfra.RuntimeHints.resolveTimeout(~default=Defaults.timeout),
|
|
97
100
|
~specModulePath=Spec.moduleUrl,
|
|
98
101
|
~mappingsModulePath=Mappings.moduleUrl,
|
|
99
102
|
~publishToAggregatesQueueUrls,
|
|
@@ -17,7 +17,7 @@ import * as ExtensionPoint_Callback$ReventlessCore from "./ExtensionPoint_Callba
|
|
|
17
17
|
import * as ExtensionPoint_Operations$ReventlessCore from "./ExtensionPoint_Operations.res.mjs";
|
|
18
18
|
|
|
19
19
|
function Make(Spec) {
|
|
20
|
-
return Mappings => (RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => {
|
|
20
|
+
return Mappings => (RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => (Defaults => {
|
|
21
21
|
let name = Spec.name;
|
|
22
22
|
let commandSchema = Spec.commandSchema;
|
|
23
23
|
let eventSchema = Spec.eventSchema;
|
|
@@ -59,7 +59,7 @@ function Make(Spec) {
|
|
|
59
59
|
return Pulumi.output("");
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
ExtensionPointRuntimeBuilder.forCommandTopic(handler, none => SpecificCommandTopic.connect(none, resources, commandTopic), RuntimeHints$ReventlessInfra.resolveMemory(runtime,
|
|
62
|
+
ExtensionPointRuntimeBuilder.forCommandTopic(handler, none => SpecificCommandTopic.connect(none, resources, commandTopic), RuntimeHints$ReventlessInfra.resolveMemory(runtime, Defaults.memorySize), RuntimeHints$ReventlessInfra.resolveTimeout(runtime, Defaults.timeout), Spec.moduleUrl, Mappings.moduleUrl, publishToAggregatesQueueUrls, commandTopic);
|
|
63
63
|
let SpecificEventTopic = EventTopic_Builder$ReventlessCore.Make({
|
|
64
64
|
Id: Id$Reventless.$$String,
|
|
65
65
|
name: name,
|
|
@@ -106,7 +106,7 @@ function Make(Spec) {
|
|
|
106
106
|
outputs: Component$ReventlessCore.outputs,
|
|
107
107
|
operations: Component$ReventlessCore.operations
|
|
108
108
|
};
|
|
109
|
-
}))));
|
|
109
|
+
})))));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
export {
|
|
@@ -28,6 +28,7 @@ module Make = (
|
|
|
28
28
|
and type runtimeParts = RuntimeEnvironment.parts
|
|
29
29
|
and type context = TaskRuntimeBuilder.context,
|
|
30
30
|
SpecificSideEffectHandler: SideEffectHandler.T,
|
|
31
|
+
Defaults: ReventlessInfra.RuntimeDefaults.T,
|
|
31
32
|
): Task.T => {
|
|
32
33
|
module Spec = Spec
|
|
33
34
|
type component = Task.component
|
|
@@ -50,10 +51,11 @@ module Make = (
|
|
|
50
51
|
taskName,
|
|
51
52
|
) => {
|
|
52
53
|
let opts = {Pulumi.ComponentResource.parent: self->Component.toPulumiResource}
|
|
53
|
-
// Task bucket callbacks default to
|
|
54
|
-
// a plugin.json `runtime`
|
|
55
|
-
|
|
56
|
-
let
|
|
54
|
+
// Task bucket callbacks default to the platform-supplied task-pod floor (a
|
|
55
|
+
// large envelope for bulk import/export work); a plugin.json `runtime`
|
|
56
|
+
// override raises memory above it and replaces timeout.
|
|
57
|
+
let memorySize = ReventlessInfra.RuntimeHints.resolveMemory(runtime, ~default=Defaults.memorySize)
|
|
58
|
+
let timeout = ReventlessInfra.RuntimeHints.resolveTimeout(runtime, ~default=Defaults.timeout)
|
|
57
59
|
let allCommandTopics = allAggregates->Aggregate.allCommandTopics
|
|
58
60
|
|
|
59
61
|
// Each adapter chooses what string the Task runtime should treat as the
|
|
@@ -20,14 +20,14 @@ function pascalCase(s) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function Make(Spec) {
|
|
23
|
-
return RuntimeEnvironment => (EventCollectorChannel => (EventCollectorRuntimeBuilder => (TaskRuntimeBuilder => (TaskBucket => (SpecificSideEffectHandler => {
|
|
23
|
+
return RuntimeEnvironment => (EventCollectorChannel => (EventCollectorRuntimeBuilder => (TaskRuntimeBuilder => (TaskBucket => (SpecificSideEffectHandler => (Defaults => {
|
|
24
24
|
let make = (queryBucketName, scheduler, schedulerRoleUrn, publishToAggregates, queryEngine, resourceNaming, allAggregates, runtime, opts) => Component$ReventlessCore.make(ComponentType$ReventlessCore.toString(Task$ReventlessCore.componentType), Spec.name, (extra, extra$1) => {
|
|
25
25
|
let opts_parent = Component$ReventlessCore.toPulumiResource(extra);
|
|
26
26
|
let opts = {
|
|
27
27
|
parent: opts_parent
|
|
28
28
|
};
|
|
29
|
-
let memorySize = RuntimeHints$ReventlessInfra.resolveMemory(runtime,
|
|
30
|
-
let timeout = RuntimeHints$ReventlessInfra.resolveTimeout(runtime,
|
|
29
|
+
let memorySize = RuntimeHints$ReventlessInfra.resolveMemory(runtime, Defaults.memorySize);
|
|
30
|
+
let timeout = RuntimeHints$ReventlessInfra.resolveTimeout(runtime, Defaults.timeout);
|
|
31
31
|
let allCommandTopics = Aggregate$ReventlessCore.allCommandTopics(allAggregates);
|
|
32
32
|
let publishToAggregatesQueueUrls = Stdlib_Dict.mapValues(allAggregates, agg => Output$Pulumi.flatMap(agg.commandTopic, ct => {
|
|
33
33
|
let r = ct.resources[0];
|
|
@@ -107,7 +107,7 @@ function Make(Spec) {
|
|
|
107
107
|
make: make,
|
|
108
108
|
outputs: Component$ReventlessCore.outputs
|
|
109
109
|
};
|
|
110
|
-
})))));
|
|
110
|
+
}))))));
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export {
|
|
@@ -17,6 +17,7 @@ module Make = (
|
|
|
17
17
|
EventTopicAdapter: EventTopic_Adapter.Publisher,
|
|
18
18
|
ExtensionPointRuntimeBuilder: ExtensionPointRuntime_Builder.T
|
|
19
19
|
with module CommandTopicChannel := CommandTopicChannel,
|
|
20
|
+
Defaults: ReventlessInfra.RuntimeDefaults.T,
|
|
20
21
|
): ExtensionPoint.T => {
|
|
21
22
|
module PluginMappingInstance = PluginExtensionPoint_Plugin.Make(Spec)
|
|
22
23
|
|
|
@@ -41,5 +42,6 @@ module Make = (
|
|
|
41
42
|
CommandTopicChannel,
|
|
42
43
|
EventTopicAdapter,
|
|
43
44
|
ExtensionPointRuntimeBuilder,
|
|
45
|
+
Defaults,
|
|
44
46
|
)
|
|
45
47
|
}
|
|
@@ -6,7 +6,7 @@ import * as PluginExtensionPoint_Plugin$ReventlessCore from "./PluginExtensionPo
|
|
|
6
6
|
import * as PluginExtensionPoint_UiFragment$ReventlessCore from "./PluginExtensionPoint_UiFragment.res.mjs";
|
|
7
7
|
|
|
8
8
|
function Make(Spec) {
|
|
9
|
-
return RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => {
|
|
9
|
+
return RuntimeEnvironment => (CommandTopicChannel => (EventTopicAdapter => (ExtensionPointRuntimeBuilder => (Defaults => {
|
|
10
10
|
let PluginMappingInstance = PluginExtensionPoint_Plugin$ReventlessCore.Make(Spec);
|
|
11
11
|
let name = PluginMappingInstance.Mapping.delegateName;
|
|
12
12
|
let mappings = [
|
|
@@ -24,8 +24,8 @@ function Make(Spec) {
|
|
|
24
24
|
commandSchema: PluginExtensionPointSpec$ReventlessInfra.commandSchema,
|
|
25
25
|
eventSchema: PluginExtensionPointSpec$ReventlessInfra.eventSchema,
|
|
26
26
|
directiveSchema: PluginExtensionPointSpec$ReventlessInfra.directiveSchema
|
|
27
|
-
})(Mappings)(RuntimeEnvironment)(CommandTopicChannel)(EventTopicAdapter)(ExtensionPointRuntimeBuilder);
|
|
28
|
-
})));
|
|
27
|
+
})(Mappings)(RuntimeEnvironment)(CommandTopicChannel)(EventTopicAdapter)(ExtensionPointRuntimeBuilder)(Defaults);
|
|
28
|
+
}))));
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
let PluginExtensionPointSpec;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as S from "sury/src/S.res.mjs";
|
|
4
|
-
import * as Identity$Reventless from "@reventlessdev/reventless-spec/src/types/Identity.res.mjs";
|
|
5
|
-
import * as RequestContext$ReventlessCore from "../src/RequestContext.res.mjs";
|
|
6
|
-
|
|
7
|
-
S.enableJson();
|
|
8
|
-
|
|
9
|
-
globalThis.describe("Identity", () => {
|
|
10
|
-
globalThis.describe("anonymous", () => {
|
|
11
|
-
globalThis.test("has userId 'anonymous'", () => {
|
|
12
|
-
globalThis.expect(Identity$Reventless.anonymous.userId).toBe("anonymous");
|
|
13
|
-
});
|
|
14
|
-
globalThis.test("has empty groups", () => {
|
|
15
|
-
globalThis.expect(Identity$Reventless.anonymous.groups).toEqual([]);
|
|
16
|
-
});
|
|
17
|
-
globalThis.test("has InMemory provider", () => {
|
|
18
|
-
globalThis.expect(Identity$Reventless.anonymous.provider).toEqual("InMemory");
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
globalThis.describe("hasGroup", () => {
|
|
22
|
-
let identity_groups = [
|
|
23
|
-
"admin",
|
|
24
|
-
"editors"
|
|
25
|
-
];
|
|
26
|
-
let identity = {
|
|
27
|
-
userId: "user-1",
|
|
28
|
-
username: "alice",
|
|
29
|
-
groups: identity_groups,
|
|
30
|
-
provider: "Cognito"
|
|
31
|
-
};
|
|
32
|
-
globalThis.test("returns true when group is present", () => {
|
|
33
|
-
globalThis.expect(Identity$Reventless.hasGroup(identity, "admin")).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
globalThis.test("returns false when group is absent", () => {
|
|
36
|
-
globalThis.expect(Identity$Reventless.hasGroup(identity, "viewers")).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
globalThis.describe("getClaim", () => {
|
|
40
|
-
let identity_groups = [];
|
|
41
|
-
let identity_claims = Object.fromEntries([
|
|
42
|
-
[
|
|
43
|
-
"tenant",
|
|
44
|
-
"acme"
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
"role",
|
|
48
|
-
"manager"
|
|
49
|
-
]
|
|
50
|
-
]);
|
|
51
|
-
let identity = {
|
|
52
|
-
userId: "user-1",
|
|
53
|
-
username: "alice",
|
|
54
|
-
groups: identity_groups,
|
|
55
|
-
claims: identity_claims,
|
|
56
|
-
provider: "InMemory"
|
|
57
|
-
};
|
|
58
|
-
globalThis.test("returns Some for existing claim", () => {
|
|
59
|
-
globalThis.expect(Identity$Reventless.getClaim(identity, "tenant")).toEqual("acme");
|
|
60
|
-
});
|
|
61
|
-
globalThis.test("returns None for missing claim", () => {
|
|
62
|
-
globalThis.expect(Identity$Reventless.getClaim(identity, "missing")).toEqual(undefined);
|
|
63
|
-
});
|
|
64
|
-
globalThis.test("returns None when claims are absent", () => {
|
|
65
|
-
let noClaims_groups = [];
|
|
66
|
-
let noClaims = {
|
|
67
|
-
userId: "user-2",
|
|
68
|
-
username: "bob",
|
|
69
|
-
groups: noClaims_groups,
|
|
70
|
-
provider: "InMemory"
|
|
71
|
-
};
|
|
72
|
-
globalThis.expect(Identity$Reventless.getClaim(noClaims, "tenant")).toEqual(undefined);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
globalThis.describe("schema roundtrip", () => {
|
|
76
|
-
globalThis.test("encode then decode preserves identity", () => {
|
|
77
|
-
let identity_groups = ["admin"];
|
|
78
|
-
let identity_claims = Object.fromEntries([[
|
|
79
|
-
"tenant",
|
|
80
|
-
"acme"
|
|
81
|
-
]]);
|
|
82
|
-
let identity = {
|
|
83
|
-
userId: "user-1",
|
|
84
|
-
username: "alice",
|
|
85
|
-
groups: identity_groups,
|
|
86
|
-
claims: identity_claims,
|
|
87
|
-
provider: "Cognito"
|
|
88
|
-
};
|
|
89
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
90
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
91
|
-
globalThis.expect(decoded).toEqual(identity);
|
|
92
|
-
});
|
|
93
|
-
globalThis.test("roundtrip with Custom provider", () => {
|
|
94
|
-
let identity_groups = [];
|
|
95
|
-
let identity_provider = {
|
|
96
|
-
TAG: "Custom",
|
|
97
|
-
_0: "oauth2"
|
|
98
|
-
};
|
|
99
|
-
let identity = {
|
|
100
|
-
userId: "ext-1",
|
|
101
|
-
username: "external",
|
|
102
|
-
groups: identity_groups,
|
|
103
|
-
provider: identity_provider
|
|
104
|
-
};
|
|
105
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
106
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
107
|
-
globalThis.expect(decoded).toEqual(identity);
|
|
108
|
-
});
|
|
109
|
-
globalThis.test("roundtrip without optional claims", () => {
|
|
110
|
-
let identity_groups = [];
|
|
111
|
-
let identity = {
|
|
112
|
-
userId: "user-3",
|
|
113
|
-
username: "charlie",
|
|
114
|
-
groups: identity_groups,
|
|
115
|
-
provider: "InMemory"
|
|
116
|
-
};
|
|
117
|
-
let json = S.reverseConvertToJsonOrThrow(identity, Identity$Reventless.schema);
|
|
118
|
-
let decoded = S.parseJsonOrThrow(json, Identity$Reventless.schema);
|
|
119
|
-
globalThis.expect(decoded.userId).toBe("user-3");
|
|
120
|
-
globalThis.expect(decoded.provider).toEqual("InMemory");
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
globalThis.describe("RequestContext", () => {
|
|
126
|
-
globalThis.describe("test() constructor", () => {
|
|
127
|
-
globalThis.test("defaults to anonymous identity", () => {
|
|
128
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
129
|
-
globalThis.expect(ctx.identity.userId).toBe("anonymous");
|
|
130
|
-
});
|
|
131
|
-
globalThis.test("accepts custom identity", () => {
|
|
132
|
-
let identity_groups = ["admin"];
|
|
133
|
-
let identity = {
|
|
134
|
-
userId: "user-1",
|
|
135
|
-
username: "alice",
|
|
136
|
-
groups: identity_groups,
|
|
137
|
-
provider: "Cognito"
|
|
138
|
-
};
|
|
139
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, identity, undefined);
|
|
140
|
-
globalThis.expect(ctx.identity.userId).toBe("user-1");
|
|
141
|
-
});
|
|
142
|
-
globalThis.test("defaults to empty claims", () => {
|
|
143
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
144
|
-
globalThis.expect(Object.keys(ctx.claims)).toEqual([]);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
globalThis.describe("getClaim", () => {
|
|
148
|
-
globalThis.test("returns claim value when present", () => {
|
|
149
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, Object.fromEntries([[
|
|
150
|
-
"tenant",
|
|
151
|
-
"acme"
|
|
152
|
-
]]));
|
|
153
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "tenant")).toEqual("acme");
|
|
154
|
-
});
|
|
155
|
-
globalThis.test("returns None when absent", () => {
|
|
156
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
157
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "missing")).toEqual(undefined);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
globalThis.describe("withClaim", () => {
|
|
161
|
-
globalThis.test("adds a claim to the context", () => {
|
|
162
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
163
|
-
let updated = RequestContext$ReventlessCore.withClaim(ctx, "tenant", "acme");
|
|
164
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(updated, "tenant")).toEqual("acme");
|
|
165
|
-
});
|
|
166
|
-
globalThis.test("does not mutate the original context", () => {
|
|
167
|
-
let ctx = RequestContext$ReventlessCore.test(undefined, undefined, undefined);
|
|
168
|
-
RequestContext$ReventlessCore.withClaim(ctx, "tenant", "acme");
|
|
169
|
-
globalThis.expect(RequestContext$ReventlessCore.getClaim(ctx, "tenant")).toEqual(undefined);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
/* Not a pure module */
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
3
|
-
import * as Monitoring$ReventlessCore from "../../src/adapter/Monitoring/Monitoring.res.mjs";
|
|
4
|
-
|
|
5
|
-
let stubResource = {};
|
|
6
|
-
|
|
7
|
-
globalThis.describe("Monitoring", () => {
|
|
8
|
-
globalThis.test("Noop default: notify is silent and does not throw", () => {
|
|
9
|
-
Monitoring$ReventlessCore.notify("CommandHandler", "before", stubResource);
|
|
10
|
-
globalThis.expect(true).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
globalThis.test("use registers a backend that receives every notify, role and name", () => {
|
|
13
|
-
let recorded = [];
|
|
14
|
-
let onProvisioned = (kind, name, param) => {
|
|
15
|
-
recorded.push([
|
|
16
|
-
kind,
|
|
17
|
-
name
|
|
18
|
-
]);
|
|
19
|
-
};
|
|
20
|
-
let Recorder = {
|
|
21
|
-
onProvisioned: onProvisioned
|
|
22
|
-
};
|
|
23
|
-
Monitoring$ReventlessCore.use(Recorder);
|
|
24
|
-
Monitoring$ReventlessCore.notify("CommandHandler", "AllAggregatesCmdHandler", stubResource);
|
|
25
|
-
Monitoring$ReventlessCore.notify("Projection", "AllStateViewSlices", stubResource);
|
|
26
|
-
Monitoring$ReventlessCore.notify("DeadLetterSink", "DeadLetterQueue", stubResource);
|
|
27
|
-
Monitoring$ReventlessCore.notify({
|
|
28
|
-
TAG: "Other",
|
|
29
|
-
_0: "Counter"
|
|
30
|
-
}, "ProductCounter", stubResource);
|
|
31
|
-
globalThis.expect(recorded).toEqual([
|
|
32
|
-
[
|
|
33
|
-
"CommandHandler",
|
|
34
|
-
"AllAggregatesCmdHandler"
|
|
35
|
-
],
|
|
36
|
-
[
|
|
37
|
-
"Projection",
|
|
38
|
-
"AllStateViewSlices"
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
"DeadLetterSink",
|
|
42
|
-
"DeadLetterQueue"
|
|
43
|
-
],
|
|
44
|
-
[
|
|
45
|
-
{
|
|
46
|
-
TAG: "Other",
|
|
47
|
-
_0: "Counter"
|
|
48
|
-
},
|
|
49
|
-
"ProductCounter"
|
|
50
|
-
]
|
|
51
|
-
]);
|
|
52
|
-
Monitoring$ReventlessCore.use(Monitoring$ReventlessCore.Noop);
|
|
53
|
-
});
|
|
54
|
-
globalThis.test("notify forwards the static name and component resource to the backend", () => {
|
|
55
|
-
let seen = {
|
|
56
|
-
contents: undefined
|
|
57
|
-
};
|
|
58
|
-
let onProvisioned = (param, name, component) => {
|
|
59
|
-
seen.contents = [
|
|
60
|
-
name,
|
|
61
|
-
component
|
|
62
|
-
];
|
|
63
|
-
};
|
|
64
|
-
let Capture = {
|
|
65
|
-
onProvisioned: onProvisioned
|
|
66
|
-
};
|
|
67
|
-
Monitoring$ReventlessCore.use(Capture);
|
|
68
|
-
Monitoring$ReventlessCore.notify("Scheduler", "HeartbeatUnit", stubResource);
|
|
69
|
-
let match = seen.contents;
|
|
70
|
-
if (match !== undefined) {
|
|
71
|
-
globalThis.expect(match[0]).toBe("HeartbeatUnit");
|
|
72
|
-
} else {
|
|
73
|
-
globalThis.expect("no notify received").toBe("a notify");
|
|
74
|
-
}
|
|
75
|
-
Monitoring$ReventlessCore.use(Monitoring$ReventlessCore.Noop);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
stubResource,
|
|
81
|
-
}
|
|
82
|
-
/* Not a pure module */
|