@reventlessdev/reventless-aws 3.0.0-alpha.392 → 3.0.0-alpha.393
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
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.393 (2026-10-21)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **aws:** a failed AppSync schema push names the API and AWS's message ([01f662a](https://github.com/ReventlessDev/reventless-core/commit/01f662a7c664807808c15933f6234b6b6588addd))
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
# 3.0.0-alpha.392 (2026-10-21)
|
|
7
14
|
|
|
8
15
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-aws",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.393",
|
|
4
4
|
"description": "AWS adapters for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
"uuid": "^13.0.0",
|
|
24
24
|
"yaml": "^2.8.3",
|
|
25
25
|
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.33",
|
|
26
|
-
"@reventlessdev/rescript-
|
|
26
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
27
27
|
"@reventlessdev/rescript-node": "2.0.0-alpha.23",
|
|
28
|
+
"@reventlessdev/rescript-effect": "1.0.0-alpha.1",
|
|
28
29
|
"@reventlessdev/rescript-pulumi-aws": "3.0.0-alpha.31",
|
|
29
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.13",
|
|
30
|
-
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
31
30
|
"@reventlessdev/rescript-pulumi-pulumi": "3.0.0-alpha.0",
|
|
32
|
-
"@reventlessdev/
|
|
33
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.200",
|
|
31
|
+
"@reventlessdev/rescript-uuid": "2.0.0-alpha.1",
|
|
34
32
|
"@reventlessdev/rescript-web": "1.0.0-alpha.8",
|
|
33
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.201",
|
|
34
|
+
"@reventlessdev/reventless-postgres": "3.0.0-alpha.168",
|
|
35
35
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.42",
|
|
36
|
-
"@reventlessdev/reventless-
|
|
37
|
-
"@reventlessdev/reventless-
|
|
36
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.173",
|
|
37
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.304"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"rescript": "12.3.1",
|
|
@@ -45,6 +45,15 @@ let startSchemaCreation = (client: appSyncClient, input: startSchemaCreationInpu
|
|
|
45
45
|
// jittered exponential backoff so a losing call can wait for the in-progress
|
|
46
46
|
// schema to finish and try again. Permanent errors (e.g. invalid SDL) are not
|
|
47
47
|
// retried — see AppSync_Error.classify.
|
|
48
|
+
// What the deploy reports when the push gives up. Carries AWS's own message: the classified
|
|
49
|
+
// error is a variant, which a rejected promise prints as `[object Object]`.
|
|
50
|
+
let schemaPushFailure = (~apiId: string, err: AppSync_Error.t): string =>
|
|
51
|
+
switch err {
|
|
52
|
+
| Transient(msg) =>
|
|
53
|
+
`StartSchemaCreation for AppSync API ${apiId} still failed after its retries: ${msg}`
|
|
54
|
+
| Permanent(msg) => `StartSchemaCreation for AppSync API ${apiId} failed: ${msg}`
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
let startSchemaCreationRetrying = (client: appSyncClient, input: startSchemaCreationInput): promise<
|
|
49
58
|
unit,
|
|
50
59
|
> => {
|
|
@@ -52,6 +61,7 @@ let startSchemaCreationRetrying = (client: appSyncClient, input: startSchemaCrea
|
|
|
52
61
|
startSchemaCreation(client, input)->Promise.then(_ => Promise.resolve())
|
|
53
62
|
)
|
|
54
63
|
->Effect.retry(AppSync_Error.retrySchedule)
|
|
64
|
+
->Effect.catchAll(err => Effect.fail(schemaPushFailure(~apiId=input.apiId, err)))
|
|
55
65
|
->Effect.runPromise
|
|
56
66
|
}
|
|
57
67
|
|
|
@@ -33,8 +33,16 @@ function startSchemaCreation(client, input) {
|
|
|
33
33
|
return client.send(new ClientAppsync.StartSchemaCreationCommand(input));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
function schemaPushFailure(apiId, err) {
|
|
37
|
+
if (err.TAG === "Transient") {
|
|
38
|
+
return `StartSchemaCreation for AppSync API ` + apiId + ` still failed after its retries: ` + err._0;
|
|
39
|
+
} else {
|
|
40
|
+
return `StartSchemaCreation for AppSync API ` + apiId + ` failed: ` + err._0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
function startSchemaCreationRetrying(client, input) {
|
|
37
|
-
return Effect$1.runPromise(Effect$1.retry(Effect.tryPromise(AppSync_Error$ReventlessAws.classify, () => client.send(new ClientAppsync.StartSchemaCreationCommand(input)).then(param => Promise.resolve())), AppSync_Error$ReventlessAws.retrySchedule));
|
|
45
|
+
return Effect$1.runPromise(Effect$1.catchAll(Effect$1.retry(Effect.tryPromise(AppSync_Error$ReventlessAws.classify, () => client.send(new ClientAppsync.StartSchemaCreationCommand(input)).then(param => Promise.resolve())), AppSync_Error$ReventlessAws.retrySchedule), err => Effect$1.fail(schemaPushFailure(input.apiId, err))));
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
async function waitForSchemaActive(client, apiId, maxAttemptsOpt, attemptOpt) {
|
|
@@ -326,6 +334,7 @@ export {
|
|
|
326
334
|
log,
|
|
327
335
|
sha256Hex,
|
|
328
336
|
startSchemaCreation,
|
|
337
|
+
schemaPushFailure,
|
|
329
338
|
startSchemaCreationRetrying,
|
|
330
339
|
waitForSchemaActive,
|
|
331
340
|
_client,
|
|
@@ -1080,3 +1080,36 @@ describe("AppSync_Adapter.injectAwsAuth — subscriptions", () => {
|
|
|
1080
1080
|
expect(decodeFragment(aug).subscriptions->Array.length)->toBe(2)
|
|
1081
1081
|
})
|
|
1082
1082
|
})
|
|
1083
|
+
|
|
1084
|
+
// ── A failed schema push says why ────────────────────────────────────────────
|
|
1085
|
+
|
|
1086
|
+
describe("AppSync_Adapter.startSchemaCreationRetrying", () => {
|
|
1087
|
+
// A client whose every call rejects the way the SDK does, with an Error.
|
|
1088
|
+
let rejectingClient: string => AppSync_Adapter.appSyncClient = %raw(`
|
|
1089
|
+
message => ({send: () => Promise.reject(new Error(message))})
|
|
1090
|
+
`)
|
|
1091
|
+
|
|
1092
|
+
test("fails with the API and AWS's message, not [object Object]", async () => {
|
|
1093
|
+
let message = ref("")
|
|
1094
|
+
try {
|
|
1095
|
+
await AppSync_Adapter.startSchemaCreationRetrying(
|
|
1096
|
+
rejectingClient("BadRequestException: Failed to parse schema document"),
|
|
1097
|
+
{apiId: "api-1", definition: "type Query"},
|
|
1098
|
+
)
|
|
1099
|
+
} catch {
|
|
1100
|
+
| exn => message := exn->JsExn.fromException->Option.flatMap(JsExn.message)->Option.getOr("")
|
|
1101
|
+
}
|
|
1102
|
+
expect(message.contents)->toContain("api-1")
|
|
1103
|
+
expect(message.contents)->toContain("Failed to parse schema document")
|
|
1104
|
+
expect(message.contents)->not_->toContain("[object Object]")
|
|
1105
|
+
})
|
|
1106
|
+
|
|
1107
|
+
testSync("says when the retries ran out", () =>
|
|
1108
|
+
expect(
|
|
1109
|
+
AppSync_Adapter.schemaPushFailure(
|
|
1110
|
+
~apiId="api-1",
|
|
1111
|
+
Transient("ConcurrentModificationException: Schema is currently being altered"),
|
|
1112
|
+
),
|
|
1113
|
+
)->toContain("still failed after its retries")
|
|
1114
|
+
)
|
|
1115
|
+
})
|
|
@@ -953,6 +953,31 @@ globalThis.describe("AppSync_Adapter.injectAwsAuth — subscriptions", () => {
|
|
|
953
953
|
});
|
|
954
954
|
});
|
|
955
955
|
|
|
956
|
+
globalThis.describe("AppSync_Adapter.startSchemaCreationRetrying", () => {
|
|
957
|
+
let rejectingClient = (message => ({send: () => Promise.reject(new Error(message))}));
|
|
958
|
+
globalThis.test("fails with the API and AWS's message, not [object Object]", async () => {
|
|
959
|
+
let message = "";
|
|
960
|
+
try {
|
|
961
|
+
await AppSync_Adapter$ReventlessAws.startSchemaCreationRetrying(rejectingClient("BadRequestException: Failed to parse schema document"), {
|
|
962
|
+
apiId: "api-1",
|
|
963
|
+
definition: "type Query"
|
|
964
|
+
});
|
|
965
|
+
} catch (raw_exn) {
|
|
966
|
+
let exn = Primitive_exceptions.internalToException(raw_exn);
|
|
967
|
+
message = Stdlib_Option.getOr(Stdlib_Option.flatMap(Stdlib_JsExn.fromException(exn), Stdlib_JsExn.message), "");
|
|
968
|
+
}
|
|
969
|
+
globalThis.expect(message).toContain("api-1");
|
|
970
|
+
globalThis.expect(message).toContain("Failed to parse schema document");
|
|
971
|
+
globalThis.expect(message).not.toContain("[object Object]");
|
|
972
|
+
});
|
|
973
|
+
globalThis.test("says when the retries ran out", () => {
|
|
974
|
+
globalThis.expect(AppSync_Adapter$ReventlessAws.schemaPushFailure("api-1", {
|
|
975
|
+
TAG: "Transient",
|
|
976
|
+
_0: "ConcurrentModificationException: Schema is currently being altered"
|
|
977
|
+
})).toContain("still failed after its retries");
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
|
|
956
981
|
export {
|
|
957
982
|
decodeFragment,
|
|
958
983
|
TwoRuleFeed,
|