@reventlessdev/reventless-aws 3.0.0-alpha.278 → 3.0.0-alpha.280
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 +19 -0
- package/package.json +5 -5
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res +58 -35
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res.mjs +21 -16
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res +46 -20
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res.mjs +20 -8
- package/src/adapter/QueryDb/QueryInterceptor_Lambda.res +21 -0
- package/src/adapter/QueryDb/QueryInterceptor_Lambda.res.mjs +6 -1
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res +23 -7
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res.mjs +9 -3
- package/src/adapter/Runtime/HandlerFactoryHelpers.mjs +5 -47
- package/src/adapter/Runtime/RuntimeExtensionsReady.mjs +59 -0
- package/src/adapter/StateTopic/StateTopic_AppSync.res +82 -7
- package/src/adapter/StateTopic/StateTopic_AppSync.res.mjs +17 -5
- package/src/adapter/StateTopic/StateTopic_AppSync_Helpers.res +36 -0
- package/src/adapter/StateTopic/StateTopic_AppSync_Helpers.res.mjs +17 -0
- package/tests/EventCollectorConnectLambdaPreviewTest.res +143 -0
- package/tests/EventCollectorConnectLambdaPreviewTest.res.mjs +101 -0
- package/tests/QueryInterceptor_LambdaTest.res +87 -0
- package/tests/QueryInterceptor_LambdaTest.res.mjs +103 -0
- package/tests/StateTopicKeySchemaTest.res +49 -0
- package/tests/StateTopicKeySchemaTest.res.mjs +40 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
open JestGlobals
|
|
2
|
+
|
|
3
|
+
// Guards the key-schema check that stands between a self-provisioned table and
|
|
4
|
+
// the state-topic relay. The relay derives a change descriptor's entity key from
|
|
5
|
+
// the record's `Keys` on one convention — the partition attribute is named `id`.
|
|
6
|
+
// A table that breaks it does not fail at runtime; it publishes descriptors whose
|
|
7
|
+
// id does not match the row, which surfaces as clients refetching the wrong
|
|
8
|
+
// entity long after the deploy. So the check must fail the BUILD, and it must
|
|
9
|
+
// name the offending table — otherwise it sends the reader hunting.
|
|
10
|
+
|
|
11
|
+
let capture = f =>
|
|
12
|
+
switch f() {
|
|
13
|
+
| () => None
|
|
14
|
+
| exception JsExn(e) => e->JsExn.message
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe("StateTopic_AppSync_Helpers.checkPartitionKeyName", () => {
|
|
18
|
+
testSync("accepts the framework convention", () => {
|
|
19
|
+
let thrown = capture(() =>
|
|
20
|
+
StateTopic_AppSync_Helpers.checkPartitionKeyName(
|
|
21
|
+
~tableName="PlatformUsageLedger-1a2b3c4",
|
|
22
|
+
~partitionKeyName="id",
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
expect(thrown)->toEqual(None)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
testSync("rejects a table keyed on anything else", () => {
|
|
29
|
+
let thrown = capture(() =>
|
|
30
|
+
StateTopic_AppSync_Helpers.checkPartitionKeyName(
|
|
31
|
+
~tableName="PlatformUsageLedger-1a2b3c4",
|
|
32
|
+
~partitionKeyName="pluginId",
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
expect(thrown->Option.isSome)->toBe(true)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
testSync("names the table and its actual key in the message", () => {
|
|
39
|
+
let message =
|
|
40
|
+
capture(() =>
|
|
41
|
+
StateTopic_AppSync_Helpers.checkPartitionKeyName(
|
|
42
|
+
~tableName="PlatformUsageLedger-1a2b3c4",
|
|
43
|
+
~partitionKeyName="pluginId",
|
|
44
|
+
)
|
|
45
|
+
)->Option.getOr("")
|
|
46
|
+
expect(message->String.includes("PlatformUsageLedger-1a2b3c4"))->toBe(true)
|
|
47
|
+
expect(message->String.includes("pluginId"))->toBe(true)
|
|
48
|
+
})
|
|
49
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_JsExn from "@rescript/runtime/lib/es6/Stdlib_JsExn.js";
|
|
4
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
5
|
+
import * as Primitive_exceptions from "@rescript/runtime/lib/es6/Primitive_exceptions.js";
|
|
6
|
+
import * as StateTopic_AppSync_Helpers$ReventlessAws from "../src/adapter/StateTopic/StateTopic_AppSync_Helpers.res.mjs";
|
|
7
|
+
|
|
8
|
+
function capture(f) {
|
|
9
|
+
try {
|
|
10
|
+
f();
|
|
11
|
+
return;
|
|
12
|
+
} catch (raw_e) {
|
|
13
|
+
let e = Primitive_exceptions.internalToException(raw_e);
|
|
14
|
+
if (e.RE_EXN_ID === "JsExn") {
|
|
15
|
+
return Stdlib_JsExn.message(e._1);
|
|
16
|
+
}
|
|
17
|
+
throw e;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
globalThis.describe("StateTopic_AppSync_Helpers.checkPartitionKeyName", () => {
|
|
22
|
+
globalThis.test("accepts the framework convention", () => {
|
|
23
|
+
let thrown = capture(() => StateTopic_AppSync_Helpers$ReventlessAws.checkPartitionKeyName("PlatformUsageLedger-1a2b3c4", "id"));
|
|
24
|
+
globalThis.expect(thrown).toEqual(undefined);
|
|
25
|
+
});
|
|
26
|
+
globalThis.test("rejects a table keyed on anything else", () => {
|
|
27
|
+
let thrown = capture(() => StateTopic_AppSync_Helpers$ReventlessAws.checkPartitionKeyName("PlatformUsageLedger-1a2b3c4", "pluginId"));
|
|
28
|
+
globalThis.expect(Stdlib_Option.isSome(thrown)).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
globalThis.test("names the table and its actual key in the message", () => {
|
|
31
|
+
let message = Stdlib_Option.getOr(capture(() => StateTopic_AppSync_Helpers$ReventlessAws.checkPartitionKeyName("PlatformUsageLedger-1a2b3c4", "pluginId")), "");
|
|
32
|
+
globalThis.expect(message.includes("PlatformUsageLedger-1a2b3c4")).toBe(true);
|
|
33
|
+
globalThis.expect(message.includes("pluginId")).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
capture,
|
|
39
|
+
}
|
|
40
|
+
/* Not a pure module */
|