@distilled.cloud/expo-eas 1.0.0-rc.13 → 1.0.0-rc.15
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/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/protocol.d.ts +2 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +26 -15
- package/lib/protocol.js.map +1 -1
- package/lib/protocol.test.d.ts +2 -0
- package/lib/protocol.test.d.ts.map +1 -0
- package/lib/protocol.test.js +267 -0
- package/lib/protocol.test.js.map +1 -0
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +1 -1
- package/lib/retry.js.map +1 -1
- package/lib/services/eas.d.ts +5840 -2078
- package/lib/services/eas.d.ts.map +1 -1
- package/lib/services/eas.js +8323 -7210
- package/lib/services/eas.js.map +1 -1
- package/lib/traits.d.ts.map +1 -1
- package/lib/traits.js.map +1 -1
- package/package.json +13 -11
- package/src/credentials.ts +3 -4
- package/src/errors.ts +14 -27
- package/src/index.ts +1 -5
- package/src/protocol.test.ts +362 -0
- package/src/protocol.ts +37 -38
- package/src/retry.ts +2 -8
- package/src/services/eas.ts +50589 -50427
- package/src/traits.ts +5 -12
- package/lib/response-validation.test.d.ts +0 -4
- package/lib/response-validation.test.d.ts.map +0 -1
- package/lib/response-validation.test.js +0 -39
- package/lib/response-validation.test.js.map +0 -1
- package/src/response-validation.test.ts +0 -59
package/src/traits.ts
CHANGED
|
@@ -52,20 +52,15 @@ export interface GraphQLOpTrait {
|
|
|
52
52
|
readonly type: "query" | "mutation";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export const graphqlOpSymbol = Symbol.for(
|
|
56
|
-
"@distilled.cloud/expo-eas/graphql-op",
|
|
57
|
-
);
|
|
55
|
+
export const graphqlOpSymbol = Symbol.for("@distilled.cloud/expo-eas/graphql-op");
|
|
58
56
|
|
|
59
57
|
/**
|
|
60
58
|
* Marks an operation's input schema with its GraphQL document. Mirrors
|
|
61
59
|
* `com.expo.graphql#operation` in the Smithy model.
|
|
62
60
|
*/
|
|
63
|
-
export const GraphQLOp = (op: GraphQLOpTrait) =>
|
|
64
|
-
makeAnnotation(graphqlOpSymbol, op);
|
|
61
|
+
export const GraphQLOp = (op: GraphQLOpTrait) => makeAnnotation(graphqlOpSymbol, op);
|
|
65
62
|
|
|
66
|
-
export const responsePathSymbol = Symbol.for(
|
|
67
|
-
"@distilled.cloud/expo-eas/response-path",
|
|
68
|
-
);
|
|
63
|
+
export const responsePathSymbol = Symbol.for("@distilled.cloud/expo-eas/response-path");
|
|
69
64
|
|
|
70
65
|
/**
|
|
71
66
|
* The dotted path under the GraphQL `data` envelope that holds this
|
|
@@ -73,8 +68,7 @@ export const responsePathSymbol = Symbol.for(
|
|
|
73
68
|
* decode and returns the value found there. Mirrors
|
|
74
69
|
* `com.expo.graphql#responsePath` in the Smithy model.
|
|
75
70
|
*/
|
|
76
|
-
export const ResponsePath = (path: string) =>
|
|
77
|
-
makeAnnotation(responsePathSymbol, path);
|
|
71
|
+
export const ResponsePath = (path: string) => makeAnnotation(responsePathSymbol, path);
|
|
78
72
|
|
|
79
73
|
export const graphqlPayloadRootSymbol = Symbol.for(
|
|
80
74
|
"@distilled.cloud/expo-eas/graphql-payload-root",
|
|
@@ -86,5 +80,4 @@ export const graphqlPayloadRootSymbol = Symbol.for(
|
|
|
86
80
|
* `runtimes` returns a bare connection-less array). Documentation-only at
|
|
87
81
|
* runtime: the protocol always returns `data.<responsePath>` verbatim.
|
|
88
82
|
*/
|
|
89
|
-
export const GraphQLPayloadRoot = () =>
|
|
90
|
-
makeAnnotation(graphqlPayloadRootSymbol, true);
|
|
83
|
+
export const GraphQLPayloadRoot = () => makeAnnotation(graphqlPayloadRootSymbol, true);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.test.d.ts","sourceRoot":"","sources":["../src/response-validation.test.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA+CpD,eAAO,MAAM,oBAAoB,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,GACvE,IAAI,GACJ,KAAY,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { runValidationModes } from "@distilled.cloud/core/testing";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Layer from "effect/Layer";
|
|
5
|
-
import * as Redacted from "effect/Redacted";
|
|
6
|
-
import { Credentials, DEFAULT_API_BASE_URL } from "./credentials.js";
|
|
7
|
-
import { EasParseError } from "./errors.js";
|
|
8
|
-
import * as Retry from "./retry.js";
|
|
9
|
-
import { accessTokenDeleteAccessToken } from "./services/eas.js";
|
|
10
|
-
const TestCredentials = Layer.succeed(Credentials, Effect.succeed({
|
|
11
|
-
accessToken: Redacted.make("test"),
|
|
12
|
-
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
13
|
-
}));
|
|
14
|
-
// accessTokenDeleteAccessToken declares `{ id: string }`, unwrapped from
|
|
15
|
-
// `data.accessToken.deleteAccessToken`.
|
|
16
|
-
const run = (body) => runValidationModes(accessTokenDeleteAccessToken({ id: "tok_1" }).pipe(Retry.none, Effect.provide(TestCredentials)), { body });
|
|
17
|
-
const envelope = (payload) => JSON.stringify({ data: { accessToken: { deleteAccessToken: payload } } });
|
|
18
|
-
describe("EAS response validation", () => {
|
|
19
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
20
|
-
const payload = { id: "tok_1" };
|
|
21
|
-
const { lenient, strict } = await run(envelope(payload));
|
|
22
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: payload });
|
|
23
|
-
expect(strict).toMatchObject({ _tag: "Success", success: payload });
|
|
24
|
-
});
|
|
25
|
-
test("a body missing required members: lenient returns it, strict fails", async () => {
|
|
26
|
-
const { lenient, strict } = await run(envelope({}));
|
|
27
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: {} });
|
|
28
|
-
expect(strict._tag).toBe("Failure");
|
|
29
|
-
expect(strict.failure).toBeInstanceOf(EasParseError);
|
|
30
|
-
});
|
|
31
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
32
|
-
const { lenient, strict } = await run("not json");
|
|
33
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
34
|
-
expect(strict.failure).toBeInstanceOf(EasParseError);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
// EasParseError is part of every operation's declared error type.
|
|
38
|
-
export const parseErrorIsDeclared = true;
|
|
39
|
-
//# sourceMappingURL=response-validation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.test.js","sourceRoot":"","sources":["../src/response-validation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAGjE,M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MAAM,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAChE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpC,MAAM,CAAE,MAAc,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yDAAyD,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;QACxE,MAAM,CAAE,MAAc,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAErB,IAAI,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { runValidationModes } from "@distilled.cloud/core/testing";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Layer from "effect/Layer";
|
|
5
|
-
import * as Redacted from "effect/Redacted";
|
|
6
|
-
import { Credentials, DEFAULT_API_BASE_URL } from "./credentials.ts";
|
|
7
|
-
import { EasParseError } from "./errors.ts";
|
|
8
|
-
import * as Retry from "./retry.ts";
|
|
9
|
-
import { accessTokenDeleteAccessToken } from "./services/eas.ts";
|
|
10
|
-
import type { ExpoEasOpError } from "./protocol.ts";
|
|
11
|
-
|
|
12
|
-
const TestCredentials = Layer.succeed(
|
|
13
|
-
Credentials,
|
|
14
|
-
Effect.succeed({
|
|
15
|
-
accessToken: Redacted.make("test"),
|
|
16
|
-
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// accessTokenDeleteAccessToken declares `{ id: string }`, unwrapped from
|
|
21
|
-
// `data.accessToken.deleteAccessToken`.
|
|
22
|
-
const run = (body: string) =>
|
|
23
|
-
runValidationModes(
|
|
24
|
-
accessTokenDeleteAccessToken({ id: "tok_1" }).pipe(
|
|
25
|
-
Retry.none,
|
|
26
|
-
Effect.provide(TestCredentials),
|
|
27
|
-
),
|
|
28
|
-
{ body },
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const envelope = (payload: unknown) =>
|
|
32
|
-
JSON.stringify({ data: { accessToken: { deleteAccessToken: payload } } });
|
|
33
|
-
|
|
34
|
-
describe("EAS response validation", () => {
|
|
35
|
-
test("a matching body succeeds unchanged in both modes", async () => {
|
|
36
|
-
const payload = { id: "tok_1" };
|
|
37
|
-
const { lenient, strict } = await run(envelope(payload));
|
|
38
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: payload });
|
|
39
|
-
expect(strict).toMatchObject({ _tag: "Success", success: payload });
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("a body missing required members: lenient returns it, strict fails", async () => {
|
|
43
|
-
const { lenient, strict } = await run(envelope({}));
|
|
44
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: {} });
|
|
45
|
-
expect(strict._tag).toBe("Failure");
|
|
46
|
-
expect((strict as any).failure).toBeInstanceOf(EasParseError);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test("a non-JSON body: lenient returns the text, strict fails", async () => {
|
|
50
|
-
const { lenient, strict } = await run("not json");
|
|
51
|
-
expect(lenient).toMatchObject({ _tag: "Success", success: "not json" });
|
|
52
|
-
expect((strict as any).failure).toBeInstanceOf(EasParseError);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// EasParseError is part of every operation's declared error type.
|
|
57
|
-
export const parseErrorIsDeclared: [EasParseError] extends [ExpoEasOpError]
|
|
58
|
-
? true
|
|
59
|
-
: false = true;
|