@supatype/client 0.3.5 → 0.7.0
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +58 -31
- package/.turbo/turbo-typecheck.log +2 -2
- package/LICENSE +1 -1
- package/dist/auth-redirect.d.ts +48 -0
- package/dist/auth-redirect.d.ts.map +1 -0
- package/dist/auth-redirect.js +70 -0
- package/dist/auth-redirect.js.map +1 -0
- package/dist/auth.d.ts +78 -4
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +373 -274
- package/dist/auth.js.map +1 -1
- package/dist/bindings.d.ts +16 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +13 -0
- package/dist/bindings.js.map +1 -0
- package/dist/caller-types.d.ts +18 -0
- package/dist/caller-types.d.ts.map +1 -0
- package/dist/caller-types.js +22 -0
- package/dist/caller-types.js.map +1 -0
- package/dist/draft-create.d.ts +12 -0
- package/dist/draft-create.d.ts.map +1 -0
- package/dist/draft-create.js +47 -0
- package/dist/draft-create.js.map +1 -0
- package/dist/draft-models-registry.d.ts +27 -0
- package/dist/draft-models-registry.d.ts.map +1 -0
- package/dist/draft-models-registry.js +61 -0
- package/dist/draft-models-registry.js.map +1 -0
- package/dist/error-codes-doc.d.ts +1 -1
- package/dist/error-codes-doc.d.ts.map +1 -1
- package/dist/error-codes-doc.js +42 -34
- package/dist/error-codes-doc.js.map +1 -1
- package/dist/errors.d.ts +102 -60
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +69 -28
- package/dist/errors.js.map +1 -1
- package/dist/exact-response.d.ts.map +1 -1
- package/dist/exact-response.js +2 -1
- package/dist/exact-response.js.map +1 -1
- package/dist/exact-values.d.ts +2 -0
- package/dist/exact-values.d.ts.map +1 -1
- package/dist/exact-values.js +12 -10
- package/dist/exact-values.js.map +1 -1
- package/dist/fetch-with-retry.d.ts +21 -6
- package/dist/fetch-with-retry.d.ts.map +1 -1
- package/dist/fetch-with-retry.js +67 -53
- package/dist/fetch-with-retry.js.map +1 -1
- package/dist/field-kinds-registry.d.ts +11 -3
- package/dist/field-kinds-registry.d.ts.map +1 -1
- package/dist/field-kinds-registry.js +10 -6
- package/dist/field-kinds-registry.js.map +1 -1
- package/dist/filters.d.ts +51 -0
- package/dist/filters.d.ts.map +1 -0
- package/dist/filters.js +117 -0
- package/dist/filters.js.map +1 -0
- package/dist/generated-client.d.ts +7 -0
- package/dist/generated-client.d.ts.map +1 -0
- package/dist/generated-client.js +7 -0
- package/dist/generated-client.js.map +1 -0
- package/dist/graphql-document.d.ts +39 -0
- package/dist/graphql-document.d.ts.map +1 -0
- package/dist/graphql-document.js +228 -0
- package/dist/graphql-document.js.map +1 -0
- package/dist/graphql-json.d.ts +56 -0
- package/dist/graphql-json.d.ts.map +1 -0
- package/dist/graphql-json.js +220 -0
- package/dist/graphql-json.js.map +1 -0
- package/dist/graphql-transport.d.ts +28 -0
- package/dist/graphql-transport.d.ts.map +1 -0
- package/dist/graphql-transport.js +77 -0
- package/dist/graphql-transport.js.map +1 -0
- package/dist/index.d.ts +103 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +153 -157
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +61 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +83 -0
- package/dist/json.js.map +1 -0
- package/dist/jwt.d.ts +16 -0
- package/dist/jwt.d.ts.map +1 -0
- package/dist/jwt.js +37 -0
- package/dist/jwt.js.map +1 -0
- package/dist/live-preview.d.ts +23 -0
- package/dist/live-preview.d.ts.map +1 -0
- package/dist/live-preview.js +28 -0
- package/dist/live-preview.js.map +1 -0
- package/dist/mutation-request.d.ts +17 -0
- package/dist/mutation-request.d.ts.map +1 -0
- package/dist/mutation-request.js +41 -0
- package/dist/mutation-request.js.map +1 -0
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +8 -6
- package/dist/preview.js.map +1 -1
- package/dist/query-cache.d.ts.map +1 -1
- package/dist/query-cache.js +19 -13
- package/dist/query-cache.js.map +1 -1
- package/dist/query.d.ts +108 -29
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +294 -224
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.ts +20 -2
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +105 -12
- package/dist/realtime.js.map +1 -1
- package/dist/select-types.d.ts +99 -0
- package/dist/select-types.d.ts.map +1 -0
- package/dist/select-types.js +2 -0
- package/dist/select-types.js.map +1 -0
- package/dist/storage.d.ts +81 -11
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +129 -37
- package/dist/storage.js.map +1 -1
- package/dist/table-subscription.d.ts +69 -0
- package/dist/table-subscription.d.ts.map +1 -0
- package/dist/table-subscription.js +93 -0
- package/dist/table-subscription.js.map +1 -0
- package/dist/types.d.ts +84 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -2
- package/src/auth-redirect.ts +90 -0
- package/src/auth.ts +421 -280
- package/src/bindings.ts +22 -0
- package/src/caller-types.ts +27 -0
- package/src/draft-create.ts +51 -0
- package/src/draft-models-registry.ts +81 -0
- package/src/error-codes-doc.ts +44 -35
- package/src/errors.ts +72 -28
- package/src/exact-response.ts +2 -1
- package/src/exact-values.ts +16 -9
- package/src/fetch-with-retry.ts +80 -70
- package/src/field-kinds-registry.ts +22 -9
- package/src/filters.ts +133 -0
- package/src/generated-client.ts +6 -0
- package/src/graphql-document.ts +234 -0
- package/src/graphql-json.ts +243 -0
- package/src/graphql-transport.ts +97 -0
- package/src/index.ts +272 -201
- package/src/json.ts +117 -0
- package/src/jwt.ts +37 -0
- package/src/live-preview.ts +37 -0
- package/src/mutation-request.ts +66 -0
- package/src/preview.ts +9 -11
- package/src/query-cache.ts +19 -16
- package/src/query.ts +389 -270
- package/src/realtime.ts +116 -13
- package/src/select-types.ts +184 -0
- package/src/storage.ts +214 -43
- package/src/table-subscription.ts +160 -0
- package/src/types.ts +90 -5
- package/tests/auth-error-codes.test.ts +53 -0
- package/tests/auth-errors.test.ts +84 -0
- package/tests/auth-events.test.ts +136 -0
- package/tests/auth-url-session.test.ts +204 -0
- package/tests/auth.test.ts +122 -26
- package/tests/count.test.ts +60 -0
- package/tests/data-plane-auth.test.ts +21 -46
- package/tests/draft-insert.integration.test.ts +118 -0
- package/tests/draft-insert.test.ts +225 -0
- package/tests/draft-profile.test.ts +55 -84
- package/tests/draft-update.integration.test.ts +122 -0
- package/tests/draft-update.test.ts +174 -0
- package/tests/dynamic-headers.test.ts +45 -0
- package/tests/entry-points.test.ts +42 -0
- package/tests/exact-response.test.ts +4 -4
- package/tests/exact-values.test.ts +14 -25
- package/tests/field-kinds-registry.test.ts +3 -3
- package/tests/filters.test.ts +146 -0
- package/tests/graphql-json.test.ts +199 -0
- package/tests/helpers/mock-websocket.ts +44 -11
- package/tests/helpers/oauth-binding.ts +92 -0
- package/tests/helpers/signup-binding.ts +73 -0
- package/tests/helpers/socket-swap.ts +139 -0
- package/tests/mfa-totp-integration.test.ts +13 -20
- package/tests/postgrest-error-codes.test.ts +85 -0
- package/tests/query-cache.test.ts +116 -117
- package/tests/query.test.ts +29 -31
- package/tests/rate-limit-integration.test.ts +4 -12
- package/tests/realtime-exact-values.test.ts +2 -4
- package/tests/realtime-presence.test.ts +75 -0
- package/tests/realtime-session-auth.test.ts +2 -4
- package/tests/realtime-swap-status.test.ts +62 -0
- package/tests/retry-integration.test.ts +3 -8
- package/tests/retry-policy.test.ts +166 -0
- package/tests/rpc-resend.test.ts +24 -0
- package/tests/server-bodies.test.ts +139 -0
- package/tests/serverless.test.ts +2 -2
- package/tests/signed-url-absolute.test.ts +2 -5
- package/tests/storage-object-shape.test.ts +101 -0
- package/tests/storage-quota-integration.test.ts +3 -2
- package/tests/storage-reference-url.test.ts +51 -0
- package/tests/storage-upload-browser.test.ts +71 -0
- package/tests/storage-upload-limit-integration.test.ts +12 -22
- package/tests/subscribe-frame.test.ts +5 -11
- package/tests/support/fetch-mock.ts +64 -0
- package/tests/support/storage-object.ts +37 -0
- package/tests/table-subscribe.test.ts +13 -13
- package/tests/table-subscription.test.ts +105 -0
- package/tests/table-transport.test.ts +94 -0
- package/tests/tsconfig.json +1 -1
- package/tests/types.test.ts +153 -1
- package/tsconfig.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,39 +1,66 @@
|
|
|
1
1
|
|
|
2
|
-
> @supatype/client@0.
|
|
2
|
+
> @supatype/client@0.7.0 test /home/runner/work/supatype/supatype/packages/client
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/home/runner/work/supatype/supatype/packages/client[39m
|
|
7
7
|
|
|
8
|
-
[32m✓[39m tests/auth.test.ts [2m([22m[
|
|
9
|
-
[32m✓[39m tests/query.test.ts [2m([22m[
|
|
10
|
-
[32m✓[39m tests/
|
|
11
|
-
[32m✓[39m tests/mfa-totp-integration.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m
|
|
12
|
-
[32m✓[39m tests/
|
|
13
|
-
[32m✓[39m tests/
|
|
14
|
-
[32m✓[39m tests/
|
|
15
|
-
[32m✓[39m tests/table-subscribe.test.ts [2m([22m[2m11 tests[22m[2m)[22m[
|
|
16
|
-
[32m✓[39m tests/
|
|
17
|
-
[32m✓[39m tests/
|
|
18
|
-
[32m✓[39m tests/
|
|
19
|
-
|
|
20
|
-
[32m✓[39m tests/
|
|
21
|
-
[32m✓[39m tests/
|
|
22
|
-
[32m✓[39m tests/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[32m✓[39m tests/
|
|
26
|
-
|
|
27
|
-
[32m✓[39m tests/
|
|
28
|
-
[32m✓[39m tests/exact-
|
|
29
|
-
[32m✓[39m tests/
|
|
30
|
-
[
|
|
31
|
-
[32m✓[39m tests/
|
|
32
|
-
[32m✓[39m tests/
|
|
33
|
-
[
|
|
8
|
+
[32m✓[39m tests/auth.test.ts [2m([22m[2m43 tests[22m[2m)[22m[32m 299[2mms[22m[39m
|
|
9
|
+
[32m✓[39m tests/query.test.ts [2m([22m[2m36 tests[22m[2m)[22m[33m 453[2mms[22m[39m
|
|
10
|
+
[32m✓[39m tests/types.test.ts [2m([22m[2m30 tests[22m[2m)[22m[33m 380[2mms[22m[39m
|
|
11
|
+
[32m✓[39m tests/mfa-totp-integration.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 279[2mms[22m[39m
|
|
12
|
+
[32m✓[39m tests/draft-profile.test.ts [2m([22m[2m18 tests[22m[2m)[22m[33m 397[2mms[22m[39m
|
|
13
|
+
[32m✓[39m tests/realtime-multi-tenant-integration.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 434[2mms[22m[39m
|
|
14
|
+
[32m✓[39m tests/draft-insert.test.ts [2m([22m[2m18 tests[22m[2m)[22m[33m 356[2mms[22m[39m
|
|
15
|
+
[32m✓[39m tests/table-subscribe.test.ts [2m([22m[2m11 tests[22m[2m)[22m[33m 368[2mms[22m[39m
|
|
16
|
+
[32m✓[39m tests/graphql-json.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 299[2mms[22m[39m
|
|
17
|
+
[32m✓[39m tests/auth-url-session.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 273[2mms[22m[39m
|
|
18
|
+
[32m✓[39m tests/draft-update.test.ts [2m([22m[2m11 tests[22m[2m)[22m[33m 320[2mms[22m[39m
|
|
19
|
+
[32m✓[39m tests/retry-integration.test.ts [2m([22m[2m12 tests[22m[2m)[22m[33m 321[2mms[22m[39m
|
|
20
|
+
[32m✓[39m tests/exact-values.test.ts [2m([22m[2m24 tests[22m[2m)[22m[32m 51[2mms[22m[39m
|
|
21
|
+
[32m✓[39m tests/rate-limit-integration.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 475[2mms[22m[39m
|
|
22
|
+
[32m✓[39m tests/storage-quota-integration.test.ts [2m([22m[2m10 tests[22m[2m)[22m[33m 1916[2mms[22m[39m
|
|
23
|
+
[33m[2m✓[22m[39m returns 507 Insufficient Storage with clear message [33m 340[2mms[22m[39m
|
|
24
|
+
[33m[2m✓[22m[39m first upload succeeds, second hits quota [33m 1486[2mms[22m[39m
|
|
25
|
+
[32m✓[39m tests/storage-upload-limit-integration.test.ts [2m([22m[2m11 tests[22m[2m)[22m[33m 1164[2mms[22m[39m
|
|
26
|
+
[33m[2m✓[22m[39m error message mentions the size limit [33m 382[2mms[22m[39m
|
|
27
|
+
[32m✓[39m tests/realtime-session-auth.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 303[2mms[22m[39m
|
|
28
|
+
[32m✓[39m tests/realtime-exact-values.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 364[2mms[22m[39m
|
|
29
|
+
[32m✓[39m tests/retry-policy.test.ts [2m([22m[2m17 tests[22m[2m)[22m[33m 1823[2mms[22m[39m
|
|
30
|
+
[2m[90m↓[39m[22m tests/draft-update.integration.test.ts [2m([22m[2m3 tests[22m[2m | [22m[33m3 skipped[39m[2m)[22m
|
|
31
|
+
[32m✓[39m tests/server-bodies.test.ts [2m([22m[2m13 tests[22m[2m)[22m[33m 364[2mms[22m[39m
|
|
32
|
+
[32m✓[39m tests/subscribe-frame.test.ts [2m([22m[2m6 tests[22m[2m)[22m[33m 342[2mms[22m[39m
|
|
33
|
+
[2m[90m↓[39m[22m tests/draft-insert.integration.test.ts [2m([22m[2m4 tests[22m[2m | [22m[33m4 skipped[39m[2m)[22m
|
|
34
|
+
[32m✓[39m tests/filters.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 142[2mms[22m[39m
|
|
35
|
+
[32m✓[39m tests/storage-object-shape.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 244[2mms[22m[39m
|
|
36
|
+
[32m✓[39m tests/postgrest-error-codes.test.ts [2m([22m[2m28 tests[22m[2m)[22m[32m 170[2mms[22m[39m
|
|
37
|
+
[32m✓[39m tests/auth-events.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 138[2mms[22m[39m
|
|
38
|
+
[32m✓[39m tests/data-plane-auth.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 104[2mms[22m[39m
|
|
39
|
+
[32m✓[39m tests/exact-response.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 39[2mms[22m[39m
|
|
40
|
+
[32m✓[39m tests/serverless.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
41
|
+
[32m✓[39m tests/auth-errors.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 183[2mms[22m[39m
|
|
42
|
+
[32m✓[39m tests/query-cache.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 208[2mms[22m[39m
|
|
43
|
+
[32m✓[39m tests/table-subscription.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 137[2mms[22m[39m
|
|
44
|
+
[32m✓[39m tests/identity-change.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
45
|
+
[32m✓[39m tests/signed-url-absolute.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 168[2mms[22m[39m
|
|
46
|
+
[32m✓[39m tests/storage-upload-browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 127[2mms[22m[39m
|
|
47
|
+
[32m✓[39m tests/table-transport.test.ts [2m([22m[2m8 tests[22m[2m)[22m[33m 516[2mms[22m[39m
|
|
48
|
+
[33m[2m✓[22m[39m a select retries a transient 503 and returns the rows [33m 316[2mms[22m[39m
|
|
49
|
+
[32m✓[39m tests/field-kinds-registry.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
50
|
+
[32m✓[39m tests/storage-reference-url.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 17[2mms[22m[39m
|
|
51
|
+
[32m✓[39m tests/auth-error-codes.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 68[2mms[22m[39m
|
|
52
|
+
[32m✓[39m tests/realtime-presence.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 228[2mms[22m[39m
|
|
53
|
+
[32m✓[39m tests/masked-fields.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 24[2mms[22m[39m
|
|
54
|
+
[32m✓[39m tests/realtime-swap-status.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 207[2mms[22m[39m
|
|
55
|
+
[32m✓[39m tests/count.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
56
|
+
[32m✓[39m tests/dynamic-headers.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 66[2mms[22m[39m
|
|
57
|
+
[32m✓[39m tests/entry-points.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
58
|
+
[32m✓[39m tests/rpc-resend.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 86[2mms[22m[39m
|
|
59
|
+
[32m✓[39m tests/pkce.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
60
|
+
[32m✓[39m tests/sha256-hex.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
34
61
|
|
|
35
|
-
[2m Test Files [22m [1m[
|
|
36
|
-
[2m Tests [22m [1m[
|
|
37
|
-
[2m Start at [22m
|
|
38
|
-
[2m Duration [22m
|
|
62
|
+
[2m Test Files [22m [1m[32m47 passed[39m[22m[2m | [22m[33m2 skipped[39m[90m (49)[39m
|
|
63
|
+
[2m Tests [22m [1m[32m521 passed[39m[22m[2m | [22m[33m7 skipped[39m[90m (528)[39m
|
|
64
|
+
[2m Start at [22m 12:11:44
|
|
65
|
+
[2m Duration [22m 23.74s[2m (transform 7.06s, setup 0ms, import 18.63s, tests 13.95s, environment 37ms)[22m
|
|
39
66
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @supatype/client@0.
|
|
3
|
-
> tsc --project
|
|
2
|
+
> @supatype/client@0.7.0 typecheck /home/runner/work/supatype/supatype/packages/client
|
|
3
|
+
> tsc --project tests/tsconfig.json --noEmit
|
|
4
4
|
|
package/LICENSE
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the auth server's redirect back to the app.
|
|
3
|
+
*
|
|
4
|
+
* The server returns a browser with the outcome in the URL: implicit-grant tokens in the fragment
|
|
5
|
+
* (`#access_token=...&refresh_token=...`), a PKCE `code` in the query, or a refusal as `error`,
|
|
6
|
+
* `error_code` and `error_description` in both. These helpers follow supabase-js: a URL is an auth
|
|
7
|
+
* redirect when it carries `access_token` or `error_description`, or a `code` this client is
|
|
8
|
+
* waiting for, and once read it loses those parameters so a reload or a shared link does not replay
|
|
9
|
+
* them.
|
|
10
|
+
*/
|
|
11
|
+
import type { SupatypeError } from "./types.js";
|
|
12
|
+
export interface RedirectParams {
|
|
13
|
+
query: URLSearchParams;
|
|
14
|
+
fragment: URLSearchParams;
|
|
15
|
+
}
|
|
16
|
+
/** The redirect's query and fragment parameters, or null when `href` is not a URL. */
|
|
17
|
+
export declare function redirectParams(href: string): RedirectParams | null;
|
|
18
|
+
/** A parameter from the fragment or the query, as the server may put it in either. */
|
|
19
|
+
export declare function redirectParam(params: RedirectParams, key: string): string | null;
|
|
20
|
+
/** True when the URL carries implicit-grant tokens or the server's refusal. */
|
|
21
|
+
export declare function carriesImplicitResult(params: RedirectParams): boolean;
|
|
22
|
+
/** `href` without the parameters the server added, ready for `history.replaceState`. */
|
|
23
|
+
export declare function withoutAuthParams(href: string): string;
|
|
24
|
+
/** The page's URL when running in a browser, else null (a server, a worker, React Native). */
|
|
25
|
+
export declare function browserHref(): string | null;
|
|
26
|
+
/** Take the auth parameters out of the address bar without a navigation. */
|
|
27
|
+
export declare function cleanBrowserUrl(href: string): void;
|
|
28
|
+
/** The part of `AuthClient` a binding starts an OAuth sign-in through. */
|
|
29
|
+
interface OAuthStarter {
|
|
30
|
+
signInWithOAuth(opts: {
|
|
31
|
+
provider: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
data: {
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
36
|
+
error: SupatypeError | null;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Start an OAuth sign-in for a framework binding: ask the client for the provider's URL and send
|
|
41
|
+
* the browser there, as supabase-js's `signInWithOAuth` does. A refusal (a provider the project has
|
|
42
|
+
* not enabled) is returned and the page stays put.
|
|
43
|
+
*/
|
|
44
|
+
export declare function startOAuthRedirect(auth: OAuthStarter, provider: string): Promise<{
|
|
45
|
+
error: SupatypeError | null;
|
|
46
|
+
}>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=auth-redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-redirect.d.ts","sourceRoot":"","sources":["../src/auth-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAQ/C,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,eAAe,CAAA;IACtB,QAAQ,EAAE,eAAe,CAAA;CAC1B;AAED,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CASlE;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhF;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAErE;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,IAAI,MAAM,GAAG,IAAI,CAI3C;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAGlD;AAED,0EAA0E;AAC1E,UAAU,YAAY;IACpB,eAAe,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QACnD,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;QACrB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;KAC5B,CAAC,CAAA;CACH;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAAC,CAI1C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading the auth server's redirect back to the app.
|
|
3
|
+
*
|
|
4
|
+
* The server returns a browser with the outcome in the URL: implicit-grant tokens in the fragment
|
|
5
|
+
* (`#access_token=...&refresh_token=...`), a PKCE `code` in the query, or a refusal as `error`,
|
|
6
|
+
* `error_code` and `error_description` in both. These helpers follow supabase-js: a URL is an auth
|
|
7
|
+
* redirect when it carries `access_token` or `error_description`, or a `code` this client is
|
|
8
|
+
* waiting for, and once read it loses those parameters so a reload or a shared link does not replay
|
|
9
|
+
* them.
|
|
10
|
+
*/
|
|
11
|
+
/** Query parameters the server adds to the redirect; anything else is the app's own and is kept. */
|
|
12
|
+
const QUERY_KEYS = ["code", "error", "error_code", "error_description", "sb"];
|
|
13
|
+
/** Fragment parameters that mark the fragment as the server's rather than the app's (a hash route). */
|
|
14
|
+
const FRAGMENT_KEYS = ["access_token", "refresh_token", "error", "error_description", "sb"];
|
|
15
|
+
/** The redirect's query and fragment parameters, or null when `href` is not a URL. */
|
|
16
|
+
export function redirectParams(href) {
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(href);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
const hash = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
|
|
25
|
+
return { query: url.searchParams, fragment: new URLSearchParams(hash) };
|
|
26
|
+
}
|
|
27
|
+
/** A parameter from the fragment or the query, as the server may put it in either. */
|
|
28
|
+
export function redirectParam(params, key) {
|
|
29
|
+
const value = params.fragment.get(key) ?? params.query.get(key);
|
|
30
|
+
return value === null || value === "" ? null : value;
|
|
31
|
+
}
|
|
32
|
+
/** True when the URL carries implicit-grant tokens or the server's refusal. */
|
|
33
|
+
export function carriesImplicitResult(params) {
|
|
34
|
+
return redirectParam(params, "access_token") !== null || redirectParam(params, "error_description") !== null;
|
|
35
|
+
}
|
|
36
|
+
/** `href` without the parameters the server added, ready for `history.replaceState`. */
|
|
37
|
+
export function withoutAuthParams(href) {
|
|
38
|
+
const url = new URL(href);
|
|
39
|
+
for (const key of QUERY_KEYS)
|
|
40
|
+
url.searchParams.delete(key);
|
|
41
|
+
const fragment = new URLSearchParams(url.hash.slice(1));
|
|
42
|
+
if (FRAGMENT_KEYS.some((key) => fragment.has(key)))
|
|
43
|
+
url.hash = "";
|
|
44
|
+
return url.toString();
|
|
45
|
+
}
|
|
46
|
+
/** The page's URL when running in a browser, else null (a server, a worker, React Native). */
|
|
47
|
+
export function browserHref() {
|
|
48
|
+
if (typeof window === "undefined")
|
|
49
|
+
return null;
|
|
50
|
+
const href = window.location?.href;
|
|
51
|
+
return typeof href === "string" ? href : null;
|
|
52
|
+
}
|
|
53
|
+
/** Take the auth parameters out of the address bar without a navigation. */
|
|
54
|
+
export function cleanBrowserUrl(href) {
|
|
55
|
+
if (typeof window === "undefined" || typeof window.history?.replaceState !== "function")
|
|
56
|
+
return;
|
|
57
|
+
window.history.replaceState(window.history.state, "", withoutAuthParams(href));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Start an OAuth sign-in for a framework binding: ask the client for the provider's URL and send
|
|
61
|
+
* the browser there, as supabase-js's `signInWithOAuth` does. A refusal (a provider the project has
|
|
62
|
+
* not enabled) is returned and the page stays put.
|
|
63
|
+
*/
|
|
64
|
+
export async function startOAuthRedirect(auth, provider) {
|
|
65
|
+
const { data, error } = await auth.signInWithOAuth({ provider });
|
|
66
|
+
if (error === null && data.url !== "" && typeof window !== "undefined")
|
|
67
|
+
window.location.assign(data.url);
|
|
68
|
+
return { error };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=auth-redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-redirect.js","sourceRoot":"","sources":["../src/auth-redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,oGAAoG;AACpG,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,CAAU,CAAA;AAEtF,uGAAuG;AACvG,MAAM,aAAa,GAAG,CAAC,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,CAAU,CAAA;AAOpG,sFAAsF;AACtF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAI,GAAQ,CAAA;IACZ,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAA;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAA;IACpE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAA;AACzE,CAAC;AAED,sFAAsF;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AC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/C,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,OAAO,EAAE,YAAY,KAAK,UAAU;QAAE,OAAM;IAC/F,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAA;AAChF,CAAC;AAUD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAkB,EAClB,QAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;IAChE,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACxG,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC"}
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AuthChangeEvent, AuthFlowType, AuthMFAChallengeResponse, AuthMFAEnrollResponse, AuthMFAListFactorsResponse, AuthStorage, OtpType, Session, SupatypeError, User } from "./types.js";
|
|
1
|
+
import type { AuthChangeEvent, AuthFlowType, AuthRedirectError, AuthMFAChallengeResponse, AuthMFAEnrollResponse, AuthMFAListFactorsResponse, AuthStorage, OtpType, Session, SupatypeError, User } from "./types.js";
|
|
2
|
+
import { type RequestTransport } from "./fetch-with-retry.js";
|
|
2
3
|
export type AuthListener = (event: AuthChangeEvent, session: Session | null) => void;
|
|
3
4
|
interface AuthClientOptions {
|
|
4
5
|
initialSession?: Session | undefined;
|
|
@@ -7,6 +8,10 @@ interface AuthClientOptions {
|
|
|
7
8
|
cookiePrefix?: string | undefined;
|
|
8
9
|
/** Custom session store (replaces browser localStorage/cookies when set). */
|
|
9
10
|
storage?: AuthStorage | undefined;
|
|
11
|
+
/** How requests are sent. `createClient` passes its fetch, so `timeout` and `retry` apply here too. */
|
|
12
|
+
transport?: RequestTransport | undefined;
|
|
13
|
+
/** Finish a sign-in carried by the page's URL on start (browser only). Default: true. */
|
|
14
|
+
detectSessionInUrl?: boolean | undefined;
|
|
10
15
|
}
|
|
11
16
|
export declare class AuthClient {
|
|
12
17
|
private readonly url;
|
|
@@ -18,10 +23,14 @@ export declare class AuthClient {
|
|
|
18
23
|
private readonly storageKey;
|
|
19
24
|
private readonly cookieName;
|
|
20
25
|
private readonly storage;
|
|
26
|
+
/** The client's fetch, with its timeout; only reads are retried. */
|
|
27
|
+
private readonly send;
|
|
21
28
|
/** When true, session is also mirrored to document.cookie (browser default path only). */
|
|
22
29
|
private readonly useCookies;
|
|
23
|
-
/** Resolves when async storage hydration
|
|
30
|
+
/** Resolves when async storage hydration and any sign-in carried by the page's URL complete. */
|
|
24
31
|
private readonly ready;
|
|
32
|
+
/** What `ready` settles with: the refusal the page's URL reported, if any. */
|
|
33
|
+
private readonly initialized;
|
|
25
34
|
/** Pending auto-refresh timer; refreshes the access token shortly before it expires. */
|
|
26
35
|
private refreshTimer;
|
|
27
36
|
/** Dedupes concurrent refresh attempts (getSession + auto-refresh). */
|
|
@@ -29,8 +38,28 @@ export declare class AuthClient {
|
|
|
29
38
|
/** In-memory PKCE code_verifier for the in-flight OAuth / OTP redirect. */
|
|
30
39
|
private codeVerifier;
|
|
31
40
|
constructor(url: string, baseHeaders: Record<string, string>, opts?: AuthClientOptions);
|
|
32
|
-
/**
|
|
41
|
+
/** The session the client starts with: the one passed in, else the persisted one. */
|
|
42
|
+
private loadInitialSession;
|
|
43
|
+
/** Resolves when the client has its starting session (storage hydrated, any URL sign-in done). */
|
|
33
44
|
whenReady(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Wait for the client's start, and learn whether a sign-in in the page's URL was refused.
|
|
47
|
+
*
|
|
48
|
+
* The same shape as supabase-js's `initialize()`. A refused OAuth sign-in comes back as
|
|
49
|
+
* `?error=...&error_description=...`; this is where an app (or `useAuth`) reads it.
|
|
50
|
+
*/
|
|
51
|
+
initialize(): Promise<{
|
|
52
|
+
error: AuthRedirectError | null;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Finish the sign-in the page's URL carries, as supabase-js's `detectSessionInUrl` does.
|
|
56
|
+
*
|
|
57
|
+
* Whatever session was stored is set aside first, so a new sign-in is announced as `SIGNED_IN`
|
|
58
|
+
* and a refused one leaves the browser signed out, as supabase-js does after a failed attempt.
|
|
59
|
+
*/
|
|
60
|
+
private completeRedirect;
|
|
61
|
+
/** A URL with tokens or a refusal, or with a `code` for a PKCE flow this client started. */
|
|
62
|
+
private isAuthRedirect;
|
|
34
63
|
private hydrateFromStorage;
|
|
35
64
|
/** Milliseconds since epoch when the access token expires (with optional skew). */
|
|
36
65
|
private sessionExpiresAtMs;
|
|
@@ -80,6 +109,12 @@ export declare class AuthClient {
|
|
|
80
109
|
};
|
|
81
110
|
error: SupatypeError | null;
|
|
82
111
|
}>;
|
|
112
|
+
/**
|
|
113
|
+
* An auth endpoint, carrying the caller's redirect as `redirect_to` in the query string. The
|
|
114
|
+
* server reads it from there (or a header) and never from a JSON body, so a redirect sent in the
|
|
115
|
+
* body is dropped in silence and the email links to SITE_URL instead.
|
|
116
|
+
*/
|
|
117
|
+
private endpoint;
|
|
83
118
|
signInWithOAuth(opts: {
|
|
84
119
|
provider: string;
|
|
85
120
|
options?: {
|
|
@@ -87,6 +122,11 @@ export declare class AuthClient {
|
|
|
87
122
|
/** Default: `implicit` (web-compatible). Pass `pkce` for mobile / RN. */
|
|
88
123
|
flowType?: AuthFlowType | undefined;
|
|
89
124
|
scopes?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Extra `/authorize` query parameters, sent as given. The flow's own (`provider`,
|
|
127
|
+
* `redirect_to`, `scopes`, the PKCE challenge) are set after these and cannot be replaced.
|
|
128
|
+
*/
|
|
129
|
+
queryParams?: Record<string, string> | undefined;
|
|
90
130
|
} | undefined;
|
|
91
131
|
}): Promise<{
|
|
92
132
|
data: {
|
|
@@ -95,6 +135,12 @@ export declare class AuthClient {
|
|
|
95
135
|
};
|
|
96
136
|
error: SupatypeError | null;
|
|
97
137
|
}>;
|
|
138
|
+
/**
|
|
139
|
+
* True only when the server's `/settings` list the provider as off. A provider they do not list
|
|
140
|
+
* (a `custom:` one) or settings that cannot be read leave the decision to `/authorize`. Looked up
|
|
141
|
+
* in lower case, as `/authorize` resolves it, so `GitHub` is refused exactly when `github` is.
|
|
142
|
+
*/
|
|
143
|
+
private providerDisabled;
|
|
98
144
|
/**
|
|
99
145
|
* Apply tokens from an OAuth / deep-link redirect (implicit grant) or restore a session.
|
|
100
146
|
* Fetches `/user` to hydrate the user object, then persists via the configured storage.
|
|
@@ -132,6 +178,15 @@ export declare class AuthClient {
|
|
|
132
178
|
};
|
|
133
179
|
error: SupatypeError | null;
|
|
134
180
|
}>;
|
|
181
|
+
/** The session a redirect carries: a PKCE code to exchange, or implicit-grant tokens. */
|
|
182
|
+
private sessionFromRedirect;
|
|
183
|
+
/**
|
|
184
|
+
* Emit `PASSWORD_RECOVERY` once a recovery link or code has produced a session.
|
|
185
|
+
*
|
|
186
|
+
* After the `SIGNED_IN` that establishing the session already emitted, as `MFA_CHALLENGE_VERIFIED`
|
|
187
|
+
* follows it, so a listener keyed on sign-in still sees one and a reset page can key on this.
|
|
188
|
+
*/
|
|
189
|
+
private announceRecovery;
|
|
135
190
|
signInWithOtp(opts: {
|
|
136
191
|
email?: string | undefined;
|
|
137
192
|
phone?: string | undefined;
|
|
@@ -183,6 +238,13 @@ export declare class AuthClient {
|
|
|
183
238
|
};
|
|
184
239
|
error: SupatypeError | null;
|
|
185
240
|
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Put the server's updated user on the session, persist it, and tell listeners.
|
|
243
|
+
*
|
|
244
|
+
* The tokens are unchanged, so this neither reschedules the refresh nor emits `TOKEN_REFRESHED`;
|
|
245
|
+
* without it the session kept the old email and metadata until the next refresh.
|
|
246
|
+
*/
|
|
247
|
+
private applyUpdatedUser;
|
|
186
248
|
/**
|
|
187
249
|
* Verify an OTP token received via email or phone.
|
|
188
250
|
* Completes email confirmation, magic link, recovery, or phone OTP flows.
|
|
@@ -326,7 +388,15 @@ export declare class AuthClient {
|
|
|
326
388
|
/** Returns the current session's access token, or null when signed out. */
|
|
327
389
|
get currentAccessToken(): string | null;
|
|
328
390
|
private getBrowserStorage;
|
|
329
|
-
|
|
391
|
+
/**
|
|
392
|
+
* Keep a value for the OAuth redirect to find on the way back (a new page load, so not memory).
|
|
393
|
+
* A write that fails is ignored: same-process flows still have the in-memory copy.
|
|
394
|
+
*/
|
|
395
|
+
private writeFlowItem;
|
|
396
|
+
private readFlowItem;
|
|
397
|
+
private removeFlowItem;
|
|
398
|
+
/** Read a flow value once: the redirect it was kept for has now arrived. */
|
|
399
|
+
private takeFlowItem;
|
|
330
400
|
private beginPkce;
|
|
331
401
|
private readCodeVerifier;
|
|
332
402
|
private clearCodeVerifier;
|
|
@@ -336,6 +406,7 @@ export declare class AuthClient {
|
|
|
336
406
|
private loadPersistedSessionAsync;
|
|
337
407
|
private loadPersistedSession;
|
|
338
408
|
private parsePersistedSession;
|
|
409
|
+
/** A stored session, written by this client (camelCase) or by a server-side helper (snake_case). */
|
|
339
410
|
private normalizePersistedSession;
|
|
340
411
|
private syncPersistedSession;
|
|
341
412
|
private writePersistedSession;
|
|
@@ -344,7 +415,10 @@ export declare class AuthClient {
|
|
|
344
415
|
private writeCookie;
|
|
345
416
|
_setSession(session: Session | null): void;
|
|
346
417
|
private _emitEvent;
|
|
418
|
+
/** Every refusal from the auth server goes through here, so none of them drops the code. */
|
|
347
419
|
private _parseError;
|
|
420
|
+
/** The user a `/user` response describes. Throws on a body that is not a JSON object. */
|
|
421
|
+
private _readUser;
|
|
348
422
|
private _parseAuthResponse;
|
|
349
423
|
private _parseUser;
|
|
350
424
|
}
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,WAAW,EAEX,OAAO,EACP,OAAO,EACP,aAAa,EACb,IAAI,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,0BAA0B,EAC1B,WAAW,EAEX,OAAO,EACP,OAAO,EACP,aAAa,EACb,IAAI,EAEL,MAAM,YAAY,CAAA;AAMnB,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAqBzE,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;AAEpF,UAAU,iBAAiB;IACzB,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACpC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IACjC,uGAAuG;IACvG,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAA;IACxC,yFAAyF;IACzF,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACzC;AA8ED,qBAA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