@reventlessdev/reventless-aws 3.0.0-alpha.272 → 3.0.0-alpha.274
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 +8 -7
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res +15 -13
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda.res.mjs +3 -2
- package/src/adapter/Api/Platform_UIFragments_Lambda.res +15 -13
- package/src/adapter/Api/Platform_UIFragments_Lambda.res.mjs +3 -2
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res +8 -1
- package/src/adapter/EventCollector/EventCollectorChannel_Helpers.res.mjs +3 -2
- package/src/adapter/Geocoder/Geocoder_AwsLocation_Resolver.res +15 -13
- package/src/adapter/Geocoder/Geocoder_AwsLocation_Resolver.res.mjs +3 -2
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res +6 -12
- package/src/adapter/QueryDb/QueryDbResolvers_AppSync.res.mjs +4 -8
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res +155 -0
- package/src/adapter/QueryDb/QueryInterceptor_Provisioning.res.mjs +92 -0
- package/src/adapter/Runtime/EventCollectorEntryPoint_Ops.res +4 -9
- package/src/adapter/Runtime/EventCollectorEntryPoint_Ops.res.mjs +8 -2
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res +32 -62
- package/src/adapter/Runtime/RuntimeEnvironment_Lambda.res.mjs +7 -20
- package/src/adapter/StateTopic/StateTopic_AppSync.res +15 -13
- package/src/adapter/StateTopic/StateTopic_AppSync.res.mjs +3 -2
- package/src/adapter/Upload/Upload_Claim_S3.res +15 -13
- package/src/adapter/Upload/Upload_Claim_S3.res.mjs +3 -2
- package/src/adapter/Upload/Upload_Presign_S3.res +15 -13
- package/src/adapter/Upload/Upload_Presign_S3.res.mjs +3 -2
- package/src/components/Api/AppSync_Adapter.res +13 -9
- package/src/components/Api/AppSync_Adapter.res.mjs +4 -3
- package/src/util/Util_LambdaLogging.res +83 -21
- package/src/util/Util_LambdaLogging.res.mjs +21 -8
- package/src/util/Util_LogGroup_Adopting.res +480 -0
- package/src/util/Util_LogGroup_Adopting.res.mjs +365 -0
- package/src/util/Util_LogGroup_Adopting_Js.mjs +20 -0
- package/src/util/Util_LogRetention.res +11 -12
- package/tests/Util_LambdaLoggingTest.res +48 -0
- package/tests/Util_LambdaLoggingTest.res.mjs +30 -0
- package/tests/Util_LogGroup_AdoptingTest.res +169 -0
- package/tests/Util_LogGroup_AdoptingTest.res.mjs +208 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Util_LogGroup_Adopting$ReventlessAws from "../src/util/Util_LogGroup_Adopting.res.mjs";
|
|
4
|
+
|
|
5
|
+
function mkErr(name, message) {
|
|
6
|
+
return {
|
|
7
|
+
name: name,
|
|
8
|
+
message: message
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let tags = Object.fromEntries([
|
|
13
|
+
[
|
|
14
|
+
"Name",
|
|
15
|
+
"PlatformApiAppSyncLogGroup"
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"reventless:role",
|
|
19
|
+
"Logs"
|
|
20
|
+
]
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
let normalisedOuts = {
|
|
24
|
+
logGroupName: "/aws/appsync/apis/abc123",
|
|
25
|
+
arn: "arn:aws:logs:eu-west-1:1:log-group:/aws/appsync/apis/abc123:*",
|
|
26
|
+
retentionInDays: 7,
|
|
27
|
+
tags: tags,
|
|
28
|
+
managedBy: Util_LogGroup_Adopting$ReventlessAws.marker
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let inputs = {
|
|
32
|
+
logGroupName: "/aws/appsync/apis/abc123",
|
|
33
|
+
retentionInDays: 7,
|
|
34
|
+
tags: tags
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
globalThis.describe("Util_LogGroup_Adopting.isAlreadyExistsError", () => {
|
|
38
|
+
globalThis.test("true for the error this provider exists to absorb", () => {
|
|
39
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.isAlreadyExistsError({
|
|
40
|
+
name: "ResourceAlreadyExistsException",
|
|
41
|
+
message: "The specified log group already exists"
|
|
42
|
+
})).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
globalThis.test("true when the code rides in the message", () => {
|
|
45
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.isAlreadyExistsError({
|
|
46
|
+
name: "InvalidParameterException",
|
|
47
|
+
message: "ResourceAlreadyExistsException: exists"
|
|
48
|
+
})).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
globalThis.test("false for a permission failure, which must still fail loudly", () => {
|
|
51
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.isAlreadyExistsError({
|
|
52
|
+
name: "AccessDeniedException",
|
|
53
|
+
message: "not authorized"
|
|
54
|
+
})).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
globalThis.describe("Util_LogGroup_Adopting.isRetryableError", () => {
|
|
59
|
+
globalThis.test("true for the concurrent-write rejection on one group", () => {
|
|
60
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.isRetryableError({
|
|
61
|
+
name: "OperationAbortedException",
|
|
62
|
+
message: "x"
|
|
63
|
+
})).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
globalThis.test("false for an already-exists error — that is absorbed, not retried", () => {
|
|
66
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.isRetryableError({
|
|
67
|
+
name: "ResourceAlreadyExistsException",
|
|
68
|
+
message: "x"
|
|
69
|
+
})).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
globalThis.describe("Util_LogGroup_Adopting.taggableArn", () => {
|
|
74
|
+
globalThis.test("strips the trailing `:*` TagResource rejects", () => {
|
|
75
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.taggableArn("arn:aws:logs:eu-west-1:1:log-group:/aws/appsync/apis/abc123:*")).toBe("arn:aws:logs:eu-west-1:1:log-group:/aws/appsync/apis/abc123");
|
|
76
|
+
});
|
|
77
|
+
globalThis.test("leaves an already-taggable arn alone", () => {
|
|
78
|
+
let arn = "arn:aws:logs:eu-west-1:1:log-group:/aws/appsync/apis/abc123";
|
|
79
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.taggableArn(arn)).toBe(arn);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
globalThis.describe("Util_LogGroup_Adopting.sameTags", () => {
|
|
84
|
+
globalThis.test("is insensitive to key order", () => {
|
|
85
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.sameTags(Object.fromEntries([
|
|
86
|
+
[
|
|
87
|
+
"a",
|
|
88
|
+
"1"
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"b",
|
|
92
|
+
"2"
|
|
93
|
+
]
|
|
94
|
+
]), Object.fromEntries([
|
|
95
|
+
[
|
|
96
|
+
"b",
|
|
97
|
+
"2"
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"a",
|
|
101
|
+
"1"
|
|
102
|
+
]
|
|
103
|
+
]))).toBe(true);
|
|
104
|
+
});
|
|
105
|
+
globalThis.test("sees a changed value", () => {
|
|
106
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.sameTags(Object.fromEntries([[
|
|
107
|
+
"a",
|
|
108
|
+
"1"
|
|
109
|
+
]]), Object.fromEntries([[
|
|
110
|
+
"a",
|
|
111
|
+
"2"
|
|
112
|
+
]]))).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
globalThis.test("sees an added key", () => {
|
|
115
|
+
globalThis.expect(Util_LogGroup_Adopting$ReventlessAws.sameTags(Object.fromEntries([[
|
|
116
|
+
"a",
|
|
117
|
+
"1"
|
|
118
|
+
]]), Object.fromEntries([
|
|
119
|
+
[
|
|
120
|
+
"a",
|
|
121
|
+
"1"
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
"b",
|
|
125
|
+
"2"
|
|
126
|
+
]
|
|
127
|
+
]))).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
globalThis.describe("Util_LogGroup_Adopting.diff_", () => {
|
|
132
|
+
globalThis.test("no change when the live state already matches", () => {
|
|
133
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", normalisedOuts, inputs);
|
|
134
|
+
globalThis.expect(result.changes).toBe(false);
|
|
135
|
+
globalThis.expect(result.replaces).toEqual([]);
|
|
136
|
+
});
|
|
137
|
+
globalThis.test("a retention change is an update, not a replace", () => {
|
|
138
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", normalisedOuts, {
|
|
139
|
+
logGroupName: "/aws/appsync/apis/abc123",
|
|
140
|
+
retentionInDays: 30,
|
|
141
|
+
tags: tags
|
|
142
|
+
});
|
|
143
|
+
globalThis.expect(result.changes).toBe(true);
|
|
144
|
+
globalThis.expect(result.replaces).toEqual([]);
|
|
145
|
+
});
|
|
146
|
+
globalThis.test("a tag change is an update, not a replace", () => {
|
|
147
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", normalisedOuts, {
|
|
148
|
+
logGroupName: "/aws/appsync/apis/abc123",
|
|
149
|
+
retentionInDays: 7,
|
|
150
|
+
tags: Object.fromEntries([[
|
|
151
|
+
"Name",
|
|
152
|
+
"renamed"
|
|
153
|
+
]])
|
|
154
|
+
});
|
|
155
|
+
globalThis.expect(result.changes).toBe(true);
|
|
156
|
+
globalThis.expect(result.replaces).toEqual([]);
|
|
157
|
+
});
|
|
158
|
+
globalThis.test("a name change replaces — CloudWatch cannot rename a group in place", () => {
|
|
159
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", normalisedOuts, {
|
|
160
|
+
logGroupName: "/aws/appsync/apis/def456",
|
|
161
|
+
retentionInDays: 7,
|
|
162
|
+
tags: tags
|
|
163
|
+
});
|
|
164
|
+
globalThis.expect(result.changes).toBe(true);
|
|
165
|
+
globalThis.expect(result.replaces).toEqual(["logGroupName"]);
|
|
166
|
+
});
|
|
167
|
+
globalThis.test("replacing creates before deleting, so the old group stays readable", () => {
|
|
168
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", normalisedOuts, {
|
|
169
|
+
logGroupName: "/aws/appsync/apis/def456",
|
|
170
|
+
retentionInDays: 7,
|
|
171
|
+
tags: tags
|
|
172
|
+
});
|
|
173
|
+
globalThis.expect(result.deleteBeforeReplace).toBe(false);
|
|
174
|
+
});
|
|
175
|
+
globalThis.test("adopted classic state is always a change, so the update normalises it", () => {
|
|
176
|
+
let classicOuts = {
|
|
177
|
+
logGroupName: undefined,
|
|
178
|
+
arn: undefined,
|
|
179
|
+
retentionInDays: undefined,
|
|
180
|
+
tags: undefined,
|
|
181
|
+
managedBy: undefined
|
|
182
|
+
};
|
|
183
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", classicOuts, inputs);
|
|
184
|
+
globalThis.expect(result.changes).toBe(true);
|
|
185
|
+
});
|
|
186
|
+
globalThis.test("adopted classic state never replaces on a field it does not carry", () => {
|
|
187
|
+
let classicOuts = {
|
|
188
|
+
logGroupName: undefined,
|
|
189
|
+
arn: undefined,
|
|
190
|
+
retentionInDays: undefined,
|
|
191
|
+
tags: undefined,
|
|
192
|
+
managedBy: undefined
|
|
193
|
+
};
|
|
194
|
+
let result = Util_LogGroup_Adopting$ReventlessAws.diff_("id", classicOuts, inputs);
|
|
195
|
+
globalThis.expect(result.replaces).toEqual([]);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
let Adopting;
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
mkErr,
|
|
203
|
+
Adopting,
|
|
204
|
+
tags,
|
|
205
|
+
normalisedOuts,
|
|
206
|
+
inputs,
|
|
207
|
+
}
|
|
208
|
+
/* tags Not a pure module */
|