@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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turning pg_graphql's `JSON` scalar strings back into the values they encode.
|
|
3
|
+
*
|
|
4
|
+
* pg_graphql types every json and jsonb column (rich text, blocks, json fields, and any function or
|
|
5
|
+
* view returning one) as its `JSON` scalar, "a Javascript Object Notation value serialized as a
|
|
6
|
+
* string". The scalar is the only reliable marker: the generated field kinds know a model's columns
|
|
7
|
+
* but not the names pg_graphql gives its connection, edge and relation types, so the schema itself
|
|
8
|
+
* is asked, once per role, and each answer is walked against the query that produced it.
|
|
9
|
+
*
|
|
10
|
+
* A key is decoded only when every field selected under it is a `JSON` scalar. A key the schema
|
|
11
|
+
* does not know, a document with more than one operation, or a string that does not parse is left
|
|
12
|
+
* as the server sent it.
|
|
13
|
+
*/
|
|
14
|
+
import { parseGraphqlDocument } from "./graphql-document.js";
|
|
15
|
+
import { isArrayOf, isJsonObject, isShape, isString } from "./json.js";
|
|
16
|
+
/** pg_graphql's name for the scalar it gives json and jsonb. */
|
|
17
|
+
const JSON_SCALAR = "JSON";
|
|
18
|
+
const TYPE_REF = "kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } }";
|
|
19
|
+
/** The introspection query whose `data` {@link readGraphqlSchema} reads. */
|
|
20
|
+
export const GRAPHQL_SCHEMA_QUERY = "query SupatypeSchemaFields { __schema { queryType { name } mutationType { name } subscriptionType { name } " +
|
|
21
|
+
`types { name kind fields(includeDeprecated: true) { name type { ${TYPE_REF} } } } } }`;
|
|
22
|
+
function isTypeRef(value) {
|
|
23
|
+
if (!isJsonObject(value) || !isString(value["kind"]))
|
|
24
|
+
return false;
|
|
25
|
+
const name = value["name"];
|
|
26
|
+
const ofType = value["ofType"];
|
|
27
|
+
return (name === null || isString(name)) && (ofType === undefined || ofType === null || isTypeRef(ofType));
|
|
28
|
+
}
|
|
29
|
+
const isField = isShape({ name: isString, type: isTypeRef });
|
|
30
|
+
const isType = isShape({ name: isString, kind: isString });
|
|
31
|
+
function namedType(ref) {
|
|
32
|
+
return ref.ofType === undefined || ref.ofType === null ? ref.name : namedType(ref.ofType);
|
|
33
|
+
}
|
|
34
|
+
function rootName(value) {
|
|
35
|
+
return isJsonObject(value) && isString(value["name"]) ? value["name"] : null;
|
|
36
|
+
}
|
|
37
|
+
/** The fields of one introspected type, or none for a scalar, enum or input. */
|
|
38
|
+
function fieldsOf(type) {
|
|
39
|
+
const fields = new Map();
|
|
40
|
+
const declared = type["fields"];
|
|
41
|
+
if (!Array.isArray(declared))
|
|
42
|
+
return fields;
|
|
43
|
+
for (const field of declared) {
|
|
44
|
+
if (!isField(field))
|
|
45
|
+
continue;
|
|
46
|
+
const returns = namedType(field.type);
|
|
47
|
+
if (returns !== null)
|
|
48
|
+
fields.set(field.name, returns);
|
|
49
|
+
}
|
|
50
|
+
return fields;
|
|
51
|
+
}
|
|
52
|
+
function rootsOf(schema) {
|
|
53
|
+
const roots = {};
|
|
54
|
+
const entries = [["query", "queryType"], ["mutation", "mutationType"], ["subscription", "subscriptionType"]];
|
|
55
|
+
for (const [kind, key] of entries) {
|
|
56
|
+
const name = rootName(schema[key]);
|
|
57
|
+
if (name !== null)
|
|
58
|
+
roots[kind] = name;
|
|
59
|
+
}
|
|
60
|
+
return roots;
|
|
61
|
+
}
|
|
62
|
+
/** The schema in the `data` of a {@link GRAPHQL_SCHEMA_QUERY} answer, or null when it is not one. */
|
|
63
|
+
export function readGraphqlSchema(data) {
|
|
64
|
+
const schema = isJsonObject(data) ? data["__schema"] : undefined;
|
|
65
|
+
if (!isJsonObject(schema))
|
|
66
|
+
return null;
|
|
67
|
+
const types = schema["types"];
|
|
68
|
+
if (!isArrayOf(isType)(types))
|
|
69
|
+
return null;
|
|
70
|
+
const fields = new Map();
|
|
71
|
+
const jsonScalars = new Set();
|
|
72
|
+
for (const type of types) {
|
|
73
|
+
if (type.kind === "SCALAR" && type.name === JSON_SCALAR)
|
|
74
|
+
jsonScalars.add(type.name);
|
|
75
|
+
fields.set(type.name, fieldsOf(type));
|
|
76
|
+
}
|
|
77
|
+
return { roots: rootsOf(schema), types: fields, jsonScalars };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* `data` with every `JSON` scalar field of `query` decoded, following aliases, fragments, nested
|
|
81
|
+
* selections and lists. For a GraphQL client other than this one, given the schema it introspected.
|
|
82
|
+
*/
|
|
83
|
+
export function decodeGraphqlJsonFields(query, data, schema) {
|
|
84
|
+
const document = parseGraphqlDocument(query);
|
|
85
|
+
const operation = document?.operations.length === 1 ? document.operations[0] : undefined;
|
|
86
|
+
const root = operation === undefined ? undefined : schema.roots[operation.kind];
|
|
87
|
+
if (document === null || operation === undefined || root === undefined)
|
|
88
|
+
return { data, schemaIsStale: false };
|
|
89
|
+
const walk = { schema, document, stale: false };
|
|
90
|
+
const decoded = decodeWith(data, entriesFor([{ selections: operation.selections, type: root }], walk), walk);
|
|
91
|
+
return { data: decoded, schemaIsStale: walk.stale };
|
|
92
|
+
}
|
|
93
|
+
function entriesFor(scopes, walk) {
|
|
94
|
+
const entries = new Map();
|
|
95
|
+
for (const scope of scopes)
|
|
96
|
+
collect(entries, scope, walk, new Set());
|
|
97
|
+
return entries;
|
|
98
|
+
}
|
|
99
|
+
function collect(entries, scope, walk, fragmentsSeen) {
|
|
100
|
+
for (const selection of scope.selections) {
|
|
101
|
+
if (selection.kind === "field") {
|
|
102
|
+
addField(entries, selection, scope.type, walk);
|
|
103
|
+
}
|
|
104
|
+
else if (selection.kind === "inline") {
|
|
105
|
+
collect(entries, { selections: selection.selections, type: selection.typeCondition ?? scope.type }, walk, fragmentsSeen);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const fragment = walk.document.fragments.get(selection.fragment);
|
|
109
|
+
if (fragment === undefined || fragmentsSeen.has(selection.fragment))
|
|
110
|
+
continue;
|
|
111
|
+
const seen = new Set([...fragmentsSeen, selection.fragment]);
|
|
112
|
+
collect(entries, { selections: fragment.selections, type: fragment.typeCondition }, walk, seen);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function addField(entries, field, type, walk) {
|
|
117
|
+
const entry = entries.get(field.key) ?? { json: false, other: false, children: [] };
|
|
118
|
+
entries.set(field.key, entry);
|
|
119
|
+
if (field.name.startsWith("__")) {
|
|
120
|
+
entry.other = true;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const returns = walk.schema.types.get(type)?.get(field.name);
|
|
124
|
+
if (returns === undefined) {
|
|
125
|
+
entry.other = true;
|
|
126
|
+
walk.stale = true;
|
|
127
|
+
}
|
|
128
|
+
else if (walk.schema.jsonScalars.has(returns)) {
|
|
129
|
+
entry.json = true;
|
|
130
|
+
}
|
|
131
|
+
else if (field.selections.length > 0) {
|
|
132
|
+
entry.children.push({ selections: field.selections, type: returns });
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
entry.other = true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** `value` with `entries` applied to it, or to each item when it is a list. */
|
|
139
|
+
function decodeWith(value, entries, walk) {
|
|
140
|
+
if (Array.isArray(value))
|
|
141
|
+
return value.map((item) => decodeWith(item, entries, walk));
|
|
142
|
+
if (!isJsonObject(value))
|
|
143
|
+
return value;
|
|
144
|
+
const decoded = { ...value };
|
|
145
|
+
for (const [key, entry] of entries) {
|
|
146
|
+
if (key in value)
|
|
147
|
+
decoded[key] = decodeEntry(value[key], entry, walk);
|
|
148
|
+
}
|
|
149
|
+
return decoded;
|
|
150
|
+
}
|
|
151
|
+
function decodeEntry(value, entry, walk) {
|
|
152
|
+
if (entry.other)
|
|
153
|
+
return value;
|
|
154
|
+
if (entry.json && entry.children.length === 0)
|
|
155
|
+
return decodeJson(value);
|
|
156
|
+
if (entry.json || entry.children.length === 0)
|
|
157
|
+
return value;
|
|
158
|
+
// Collected once per entry, not once per object: `edges { node }` visits `node` for every edge.
|
|
159
|
+
entry.childEntries ??= entriesFor(entry.children, walk);
|
|
160
|
+
return decodeWith(value, entry.childEntries, walk);
|
|
161
|
+
}
|
|
162
|
+
/** The value a `JSON` scalar string encodes, through lists; anything else as it is. */
|
|
163
|
+
function decodeJson(value) {
|
|
164
|
+
if (Array.isArray(value))
|
|
165
|
+
return value.map(decodeJson);
|
|
166
|
+
if (typeof value !== "string")
|
|
167
|
+
return value;
|
|
168
|
+
try {
|
|
169
|
+
const parsed = JSON.parse(value);
|
|
170
|
+
return parsed;
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return value;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** True when `value` holds a string anywhere: an answer without one has nothing to decode. */
|
|
177
|
+
function containsString(value) {
|
|
178
|
+
if (typeof value === "string")
|
|
179
|
+
return true;
|
|
180
|
+
if (Array.isArray(value))
|
|
181
|
+
return value.some(containsString);
|
|
182
|
+
return isJsonObject(value) && Object.values(value).some(containsString);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Schemas by whoever reads them. pg_graphql shows each Postgres role only what it may use, so an
|
|
186
|
+
* anonymous caller's schema can lack types a signed-in one has. A failed read is not kept, and
|
|
187
|
+
* neither is a schema an answer showed to be stale: the next call reads it again.
|
|
188
|
+
*/
|
|
189
|
+
export class GraphqlSchemaCache {
|
|
190
|
+
schemas = new Map();
|
|
191
|
+
get(key, load) {
|
|
192
|
+
const cached = this.schemas.get(key);
|
|
193
|
+
if (cached !== undefined)
|
|
194
|
+
return cached;
|
|
195
|
+
const loading = load().catch(() => null).then((schema) => {
|
|
196
|
+
if (schema === null)
|
|
197
|
+
this.schemas.delete(key);
|
|
198
|
+
return schema;
|
|
199
|
+
});
|
|
200
|
+
this.schemas.set(key, loading);
|
|
201
|
+
return loading;
|
|
202
|
+
}
|
|
203
|
+
forget(key) {
|
|
204
|
+
this.schemas.delete(key);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** `data` decoded against the schema `source` names, read once when an answer first needs it. */
|
|
208
|
+
export async function decodeGraphqlAnswer(answer, schemas, source) {
|
|
209
|
+
if (!containsString(answer.data))
|
|
210
|
+
return answer.data;
|
|
211
|
+
const key = await source.key();
|
|
212
|
+
const schema = await schemas.get(key, source.load);
|
|
213
|
+
if (schema === null)
|
|
214
|
+
return answer.data;
|
|
215
|
+
const { data, schemaIsStale } = decodeGraphqlJsonFields(answer.query, answer.data, schema);
|
|
216
|
+
if (schemaIsStale)
|
|
217
|
+
schemas.forget(key);
|
|
218
|
+
return data;
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=graphql-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-json.js","sourceRoot":"","sources":["../src/graphql-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,oBAAoB,EAA0E,MAAM,uBAAuB,CAAA;AACpI,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAatE,gEAAgE;AAChE,MAAM,WAAW,GAAG,MAAM,CAAA;AAE1B,MAAM,QAAQ,GAAG,oHAAoH,CAAA;AAErI,4EAA4E;AAC5E,MAAM,CAAC,MAAM,oBAAoB,GAC/B,6GAA6G;IAC7G,mEAAmE,QAAQ,YAAY,CAAA;AAIzF,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IAClE,MAAM,IAAI,GAAG,KAAK,CAA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AO,OAAO,CAAA;IAChB,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;CACF;AAQD,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAA0D,EAC1D,OAA2B,EAC3B,MAA2B;IAE3B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAA;IACpD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,CAAA;IAC9B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAClD,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,IAAI,CAAA;IACvC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,uBAAuB,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC1F,IAAI,aAAa;QAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACtC,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RequestTransport } from "./fetch-with-retry.js";
|
|
2
|
+
import { GraphqlSchemaCache } from "./graphql-json.js";
|
|
3
|
+
import { type HeadersProvider } from "./query.js";
|
|
4
|
+
import type { SupatypeError } from "./types.js";
|
|
5
|
+
/** Where GraphQL requests go and what they carry. Studio builds one per send-as choice. */
|
|
6
|
+
export type GraphqlTransport = {
|
|
7
|
+
/** The `/graphql/v1` URL. */
|
|
8
|
+
readonly endpoint: string;
|
|
9
|
+
readonly send: RequestTransport;
|
|
10
|
+
readonly headers: HeadersProvider;
|
|
11
|
+
readonly onUnauthorized?: (() => Promise<void>) | undefined;
|
|
12
|
+
/** Whose schema a request reads, from its headers. Defaults to the bearer token's role. */
|
|
13
|
+
readonly schemaKey?: ((headers: Record<string, string>) => string) | undefined;
|
|
14
|
+
};
|
|
15
|
+
type GraphqlAnswer = {
|
|
16
|
+
data: unknown;
|
|
17
|
+
error: SupatypeError | null;
|
|
18
|
+
};
|
|
19
|
+
type GraphqlRunner = (query: string, variables?: Record<string, unknown> | undefined, options?: {
|
|
20
|
+
idempotent?: boolean | undefined;
|
|
21
|
+
} | undefined) => Promise<GraphqlAnswer>;
|
|
22
|
+
/**
|
|
23
|
+
* Runs GraphQL requests over `transport`, decoding `JSON` scalar fields against a schema cached in
|
|
24
|
+
* `schemas`. Pass a long-lived cache when the runner itself is short-lived.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createGraphqlRunner(transport: GraphqlTransport, schemas?: GraphqlSchemaCache): GraphqlRunner;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=graphql-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-transport.d.ts","sourceRoot":"","sources":["../src/graphql-transport.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAwB,kBAAkB,EAA8D,MAAM,mBAAmB,CAAA;AAGxI,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,2FAA2F;AAC3F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;IAC3D,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;CAC/E,CAAA;AAED,KAAK,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAAA;AACnE,KAAK,aAAa,GAAG,CACnB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,KACvD,OAAO,CAAC,aAAa,CAAC,CAAA;AAG3B;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,qBAA2B,GAAG,aAAa,CAalH"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `supatype.graphql()`: the request, what the answer means, and the decoding of its `JSON` fields.
|
|
3
|
+
*
|
|
4
|
+
* The schema the decoding needs is read through the same transport as the query, carrying the same
|
|
5
|
+
* credential, because pg_graphql shows each role only what it may use. It is cached per role, so a
|
|
6
|
+
* refreshed token for the same role reuses it.
|
|
7
|
+
*/
|
|
8
|
+
import { transportFailure } from "./errors.js";
|
|
9
|
+
import { GRAPHQL_SCHEMA_QUERY, GraphqlSchemaCache, decodeGraphqlAnswer, readGraphqlSchema } from "./graphql-json.js";
|
|
10
|
+
import { isJsonObject, refusalText } from "./json.js";
|
|
11
|
+
import { bearerRole } from "./jwt.js";
|
|
12
|
+
import { fetchWithOptional401Retry } from "./query.js";
|
|
13
|
+
/**
|
|
14
|
+
* Runs GraphQL requests over `transport`, decoding `JSON` scalar fields against a schema cached in
|
|
15
|
+
* `schemas`. Pass a long-lived cache when the runner itself is short-lived.
|
|
16
|
+
*/
|
|
17
|
+
export function createGraphqlRunner(transport, schemas = new GraphqlSchemaCache()) {
|
|
18
|
+
const keyOf = transport.schemaKey ?? schemaKey;
|
|
19
|
+
const source = {
|
|
20
|
+
key: async () => keyOf(await transport.headers()),
|
|
21
|
+
load: () => loadSchema(transport),
|
|
22
|
+
};
|
|
23
|
+
return async (query, variables, options) => {
|
|
24
|
+
const body = { query, ...(variables !== undefined && { variables }) };
|
|
25
|
+
const reply = await post(transport, body, options?.idempotent === true);
|
|
26
|
+
if ("failure" in reply)
|
|
27
|
+
return { data: null, error: reply.failure };
|
|
28
|
+
const result = graphqlResult(reply.json, reply.res);
|
|
29
|
+
return { data: await decodeGraphqlAnswer({ query, data: result.data }, schemas, source), error: result.error };
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async function post(transport, body, idempotent) {
|
|
33
|
+
const init = { method: "POST", body: JSON.stringify(body), ...(idempotent && { idempotent: true }) };
|
|
34
|
+
let res;
|
|
35
|
+
try {
|
|
36
|
+
res = await fetchWithOptional401Retry(transport.send, transport.endpoint, init, transport.headers, transport.onUnauthorized);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return { failure: transportFailure(e) };
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
const json = await res.json();
|
|
43
|
+
return { json, res };
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return { failure: { message: `GraphQL endpoint returned a non-JSON response (HTTP ${res.status} ${res.statusText})` } };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function loadSchema(transport) {
|
|
50
|
+
const reply = await post(transport, { query: GRAPHQL_SCHEMA_QUERY }, true);
|
|
51
|
+
if ("failure" in reply || !reply.res.ok || !isJsonObject(reply.json))
|
|
52
|
+
return null;
|
|
53
|
+
return readGraphqlSchema(reply.json["data"]);
|
|
54
|
+
}
|
|
55
|
+
/** Who a schema is read as: the token's role when it names one, otherwise the credential itself. */
|
|
56
|
+
function schemaKey(headers) {
|
|
57
|
+
const role = bearerRole(headers);
|
|
58
|
+
return role !== null ? `role:${role}` : `credential:${headers["Authorization"] ?? headers["apikey"] ?? ""}`;
|
|
59
|
+
}
|
|
60
|
+
/** What a GraphQL endpoint's JSON answer means: its data, and the first error it reports. */
|
|
61
|
+
function graphqlResult(json, res) {
|
|
62
|
+
if (!isJsonObject(json)) {
|
|
63
|
+
return { data: null, error: { message: `GraphQL endpoint returned JSON that is not an object (HTTP ${res.status})`, status: res.status } };
|
|
64
|
+
}
|
|
65
|
+
const data = json["data"] ?? null;
|
|
66
|
+
if (!res.ok) {
|
|
67
|
+
const message = refusalText(json) ?? `GraphQL request failed (HTTP ${res.status})`;
|
|
68
|
+
return { data, error: { message, status: res.status } };
|
|
69
|
+
}
|
|
70
|
+
const errors = json["errors"];
|
|
71
|
+
if (errors === undefined)
|
|
72
|
+
return { data, error: null };
|
|
73
|
+
const first = Array.isArray(errors) ? errors[0] : undefined;
|
|
74
|
+
const message = isJsonObject(first) && typeof first["message"] === "string" ? first["message"] : "GraphQL error";
|
|
75
|
+
return { data, error: { message } };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=graphql-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-transport.js","sourceRoot":"","sources":["../src/graphql-transport.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB,EAAsB,MAAM,mBAAmB,CAAA;AACxI,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,yBAAyB,EAAwB,MAAM,YAAY,CAAA;AAsB5E;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAA2B,EAAE,OAAO,GAAG,IAAI,kBAAkB,E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./auth.js";
|
|
2
2
|
import { QueryBuilder, MutationBuilder, type HeadersProvider } from "./query.js";
|
|
3
|
+
import type { RequestTransport } from "./fetch-with-retry.js";
|
|
3
4
|
import { type QueryCache } from "./query-cache.js";
|
|
4
5
|
import { StorageClient } from "./storage.js";
|
|
5
6
|
import { RealtimeClient } from "./realtime.js";
|
|
6
|
-
import type {
|
|
7
|
-
import
|
|
8
|
-
|
|
7
|
+
import type { RealtimePayload } from "./realtime.js";
|
|
8
|
+
import { type TableSubscribeOptions, type TableSubscription } from "./table-subscription.js";
|
|
9
|
+
import type { AnyDatabase, AugmentedDatabase, FunctionDef, RpcResult, SupatypeFunctions, SupatypeClientConfig, SupatypeError, RpcOptions, SelectQueryOptions, TableDef, UpdateOptions } from "./types.js";
|
|
10
|
+
import type { SelectRow } from "./select-types.js";
|
|
11
|
+
export type { User, Session, AuthChangeEvent, AuthFlowType, SupatypeError, AuthRedirectError, QueryResult, MaskedField, RpcResult, AnyDatabase, SupatypeClientConfig, FunctionDef, AuthStorage, RpcOptions, SelectQueryOptions, TableDef, TableInsert, TableRow, TableUpdate, SupatypeModels, SupatypeBuckets, SupatypeFunctions, AugmentedDatabase, DraftUpdateOptions, UpdateOptions, } from "./types.js";
|
|
9
12
|
export { generateCodeVerifier, createCodeChallengeS256, PKCE_METHOD_S256, } from "./pkce.js";
|
|
10
|
-
export { DRAFT_SCHEMA } from "./types.js";
|
|
13
|
+
export { DRAFT_SCHEMA, PUBLISHING_SCHEMA } from "./types.js";
|
|
14
|
+
export type { SelectRow, SelectError, TableRelationship } from "./select-types.js";
|
|
11
15
|
/**
|
|
12
16
|
* A client whose database type the holder does not know.
|
|
13
17
|
*
|
|
@@ -25,14 +29,16 @@ export type AnyClient = SupatypeClient<AnyDatabase>;
|
|
|
25
29
|
export type { QueryCacheOptions, CacheStatus } from "./query-cache.js";
|
|
26
30
|
export { AuthClient } from "./auth.js";
|
|
27
31
|
export { onIdentityChange, type IdentitySource } from "./identity.js";
|
|
28
|
-
export { QueryBuilder, MutationBuilder, type HeadersProvider } from "./query.js";
|
|
32
|
+
export { QueryBuilder, MutationBuilder, type HeadersProvider, type RequestTransport } from "./query.js";
|
|
29
33
|
export { QueryCache, defaultQueryCache } from "./query-cache.js";
|
|
30
34
|
export { StorageClient, BucketClient } from "./storage.js";
|
|
31
|
-
export type { StorageObject, TransformOptions } from "./storage.js";
|
|
35
|
+
export type { StorageObject, StorageFolder, StorageListEntry, ListOptions, RemovedObject, StorageReference, TransformOptions } from "./storage.js";
|
|
32
36
|
export { RealtimeClient } from "./realtime.js";
|
|
33
37
|
export type { RealtimeEvent, RealtimePayload, ChannelStatus, PresenceEntry } from "./realtime.js";
|
|
38
|
+
export type { TableSubscribeOptions, TableSubscription } from "./table-subscription.js";
|
|
34
39
|
export * from "./errors.js";
|
|
35
|
-
export { registerFieldKinds, fieldKindsAreRegistered, forgetRegisteredFieldKinds, type FieldKindsDocument, } from "./field-kinds-registry.js";
|
|
40
|
+
export { registerFieldKinds, fieldKindsAreRegistered, forgetRegisteredFieldKinds, type FieldKindsDocument, type UnrecognisedFieldKindsDocument, } from "./field-kinds-registry.js";
|
|
41
|
+
export { registerDraftModels, forgetRegisteredDraftModels, type DraftModel, type DraftModelsDocument, type UnrecognisedDraftModelsDocument, } from "./draft-models-registry.js";
|
|
36
42
|
export { fetchWithRetry, detectServerlessEnvironment, warnIfServerlessDirectConnection } from "./fetch-with-retry.js";
|
|
37
43
|
export type { FetchOptions, ServerlessDetectionResult } from "./fetch-with-retry.js";
|
|
38
44
|
export { createRetryFetch } from "./retry.js";
|
|
@@ -42,28 +48,31 @@ export type { ErrorCodeEntry } from "./error-codes-doc.js";
|
|
|
42
48
|
export { CONNECTION_MODES, SERVERLESS_CONNECTION_WARNING, CONNECTION_FAQ } from "./serverless-docs.js";
|
|
43
49
|
export type { ConnectionModeDoc } from "./serverless-docs.js";
|
|
44
50
|
export { PreviewLinkError } from "./preview.js";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
export { GRAPHQL_SCHEMA_QUERY, GraphqlSchemaCache, decodeGraphqlJsonFields, readGraphqlSchema, type GraphqlJsonDecoding, type GraphqlSchema, } from "./graphql-json.js";
|
|
52
|
+
export { createGraphqlRunner, type GraphqlTransport } from "./graphql-transport.js";
|
|
53
|
+
/**
|
|
54
|
+
* One table, typed by its definition and by every table beside it: an embedded select is resolved
|
|
55
|
+
* against the other tables' rows and the relationships between them.
|
|
56
|
+
*/
|
|
57
|
+
declare class TableClient<TDef extends TableDef, TTables extends Record<string, TableDef> = Record<string, TableDef>, TName extends string = string> {
|
|
51
58
|
private readonly baseUrl;
|
|
52
59
|
private readonly table;
|
|
53
60
|
private readonly path;
|
|
54
61
|
private readonly getHeaders;
|
|
55
62
|
private readonly onUnauthorized;
|
|
63
|
+
/** The client's retry-aware fetch, so `timeout` and `retry` reach table requests too. */
|
|
64
|
+
private readonly send;
|
|
56
65
|
private readonly queryCache;
|
|
57
66
|
private readonly realtime;
|
|
58
67
|
/**
|
|
59
68
|
* The schema this table's reads come from, set by `draft()`.
|
|
60
69
|
*
|
|
61
70
|
* Mutable, and safe to be: `from()` builds a fresh client per call, so nothing is shared between
|
|
62
|
-
* two queries. Reads only
|
|
63
|
-
*
|
|
71
|
+
* two queries. Reads only: a draft view is not writable, and `update` on a model with drafts
|
|
72
|
+
* saves a new version through the publishing functions instead.
|
|
64
73
|
*/
|
|
65
74
|
private profile;
|
|
66
|
-
constructor(baseUrl: string, table: string, getHeaders: HeadersProvider, realtime: RealtimeClient, queryCache
|
|
75
|
+
constructor(baseUrl: string, table: string, getHeaders: HeadersProvider, realtime: RealtimeClient, queryCache: QueryCache | undefined, onUnauthorized: (() => Promise<void>) | undefined, send: RequestTransport);
|
|
67
76
|
/**
|
|
68
77
|
* Read the pending draft instead of what is published.
|
|
69
78
|
*
|
|
@@ -78,35 +87,70 @@ declare class TableClient<TDef extends TableDef> {
|
|
|
78
87
|
* **Read-only, and permission is not the read rule.** A draft is visible to the record's creator
|
|
79
88
|
* and to the project's elevated Studio roles, or to a caller holding a signed preview link. A
|
|
80
89
|
* caller who may read published content is not thereby entitled to read what has not been
|
|
81
|
-
* published. Write with the ordinary `update`, which
|
|
82
|
-
* `
|
|
90
|
+
* published. Write with the ordinary `update`, which on a model with drafts saves a new draft of
|
|
91
|
+
* each record it matches and leaves the live rows alone; pass `{ publish: true }` to publish in the
|
|
92
|
+
* same call. A saved draft is published later by the generated `publish` database function in the
|
|
93
|
+
* `supatype` schema:
|
|
94
|
+
* `rpc("publish", { model_table: "posts", record_id: id }, { schema: "supatype" })`.
|
|
83
95
|
*/
|
|
84
96
|
draft(): this;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Read rows, typed from the select string.
|
|
99
|
+
*
|
|
100
|
+
* `select("id, author:authors(name)")` resolves to `{ id: string; author: { name: string } | null }`
|
|
101
|
+
* from the generated schema: columns, aliases and embedded relations are read from the string, so
|
|
102
|
+
* the joined shape is not declared a second time by hand. See `select-types.ts` for the grammar.
|
|
103
|
+
* A string only known at run time types as the whole row.
|
|
104
|
+
*/
|
|
105
|
+
select<TColumns extends string = "*">(columns?: TColumns | undefined, options?: SelectQueryOptions | undefined): QueryBuilder<SelectRow<TTables, TName, TColumns>>;
|
|
106
|
+
/** Read rows typed as `TResult`, for a shape the select string cannot describe. */
|
|
107
|
+
select<TResult>(columns?: string | undefined, options?: SelectQueryOptions | undefined): QueryBuilder<TResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Insert one row or several.
|
|
110
|
+
*
|
|
111
|
+
* **On a model that keeps drafts**, one record is created through `supatype.create_record`, as
|
|
112
|
+
* Studio creates it, and several through `supatype.create_records`, all or none in one call: each
|
|
113
|
+
* record starts as its first draft, and the rows come back read from the draft view in the shape
|
|
114
|
+
* and order a plain insert returns. A plain insert asking for the row back is refused there by a
|
|
115
|
+
* read rule that hides unpublished records, because Postgres checks the returned row against it
|
|
116
|
+
* before anything has made the new row visible to its author. The generated `supatype/generated/client.ts`
|
|
117
|
+
* says which models keep drafts; a client without it inserts as before.
|
|
118
|
+
*/
|
|
119
|
+
insert(data: TDef["Insert"] | TDef["Insert"][]): MutationBuilder<TDef["Row"], TTables, TName>;
|
|
120
|
+
/** Where an insert of `data` is created through the publishing functions: any rows, on a drafts model. */
|
|
121
|
+
private draftCreate;
|
|
122
|
+
/**
|
|
123
|
+
* Insert, or update the row a key or unique column already names.
|
|
124
|
+
*
|
|
125
|
+
* Never sent through `create_record`, on a drafts model or not: it cannot say what happens on a
|
|
126
|
+
* conflict, and an upsert that met an existing record would make a second one rather than update
|
|
127
|
+
* it. On a drafts model whose read rule hides unpublished records, create through `insert`.
|
|
128
|
+
*/
|
|
129
|
+
upsert(data: TDef["Insert"] | TDef["Insert"][]): MutationBuilder<TDef["Row"], TTables, TName>;
|
|
130
|
+
/**
|
|
131
|
+
* Change the rows the filters match.
|
|
132
|
+
*
|
|
133
|
+
* **On a model that keeps drafts** the live rows do not change: each matched record gets a new
|
|
134
|
+
* draft through `supatype.save_drafts`, merged onto its newest version as Studio saves one, all or
|
|
135
|
+
* none in one call, and the drafts come back read from the draft view. Pass `{ publish: true }` to
|
|
136
|
+
* publish them in the same call, so the history records the version that went live. The generated
|
|
137
|
+
* `supatype/generated/client.ts` says which models keep drafts; elsewhere this is a plain `PATCH`, and
|
|
138
|
+
* `{ publish: true }` is refused, since there is nothing to publish.
|
|
139
|
+
*/
|
|
140
|
+
update(data: TDef["Update"], options?: UpdateOptions<TDef>): MutationBuilder<TDef["Row"], TTables, TName>;
|
|
141
|
+
/** How an update is made: as drafts on a drafts model, else a plain `PATCH`, or refused. */
|
|
142
|
+
private draftEdit;
|
|
143
|
+
delete(): MutationBuilder<TDef["Row"], TTables, TName>;
|
|
90
144
|
/**
|
|
91
145
|
* Subscribe to postgres_changes for this table (typed to Row), and join.
|
|
92
146
|
*
|
|
93
147
|
* Phase 10.6 F11: preferred over raw `client.realtime.channel(...)`. The returned `channel` is
|
|
94
148
|
* already subscribed; call `channel.subscribe(cb)` only to watch its status.
|
|
95
149
|
*
|
|
96
|
-
* Each call gets a channel of its own
|
|
97
|
-
*
|
|
98
|
-
* unsubscribe removed the channel out from under the second. The name still reads as
|
|
99
|
-
* `schema:table` to anything that splits it, which is what a server predating `table` in the
|
|
100
|
-
* subscribe frame falls back to.
|
|
150
|
+
* Each call gets a channel of its own; `subscribeToTable` says why. The framework bindings join
|
|
151
|
+
* through the same function, so a table subscribed either way behaves the same.
|
|
101
152
|
*/
|
|
102
|
-
subscribe(callback: (payload: RealtimePayload<TDef["Row"]>) => void, opts?:
|
|
103
|
-
event?: RealtimeEvent | undefined;
|
|
104
|
-
filter?: string | undefined;
|
|
105
|
-
schema?: string | undefined;
|
|
106
|
-
} | undefined): {
|
|
107
|
-
unsubscribe: () => void;
|
|
108
|
-
channel: ReturnType<RealtimeClient["channel"]>;
|
|
109
|
-
};
|
|
153
|
+
subscribe(callback: (payload: RealtimePayload<TDef["Row"]>) => void, opts?: TableSubscribeOptions | undefined): TableSubscription;
|
|
110
154
|
}
|
|
111
155
|
export interface GlobalClient<TRow extends Record<string, unknown> = Record<string, unknown>> {
|
|
112
156
|
get(): Promise<{
|
|
@@ -155,13 +199,21 @@ export interface FunctionInvokeOptions {
|
|
|
155
199
|
headers?: Record<string, string> | undefined;
|
|
156
200
|
/** Request body (JSON-serialisable) */
|
|
157
201
|
body?: unknown | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Retry this call on a transient failure although it is not a GET. Default: false.
|
|
204
|
+
*
|
|
205
|
+
* Only GET calls are retried otherwise: a POST that failed in flight may already have run the
|
|
206
|
+
* function, and running it again could charge a card or send an email twice. Set this when a
|
|
207
|
+
* second run is harmless.
|
|
208
|
+
*/
|
|
209
|
+
idempotent?: boolean | undefined;
|
|
158
210
|
}
|
|
159
211
|
declare class FunctionsClient {
|
|
160
212
|
private readonly baseUrl;
|
|
161
213
|
private readonly getHeaders;
|
|
162
214
|
private readonly onUnauthorized;
|
|
163
215
|
private readonly doFetch;
|
|
164
|
-
constructor(baseUrl: string, getHeaders: HeadersProvider, doFetch:
|
|
216
|
+
constructor(baseUrl: string, getHeaders: HeadersProvider, doFetch: RequestTransport, onUnauthorized?: (() => Promise<void>) | undefined);
|
|
165
217
|
/**
|
|
166
218
|
* Invoke an edge function by name.
|
|
167
219
|
*
|
|
@@ -184,14 +236,25 @@ export interface SupatypeClient<TDatabase extends AnyDatabase = AugmentedDatabas
|
|
|
184
236
|
url: string;
|
|
185
237
|
/** Service role key, if provided at construction time. Used by developer tools for admin API calls. */
|
|
186
238
|
serviceRoleKey: string | undefined;
|
|
187
|
-
from<TTable extends keyof TDatabase["public"]["Tables"] & string>(table: TTable): TableClient<TDatabase["public"]["Tables"][TTable]>;
|
|
239
|
+
from<TTable extends keyof TDatabase["public"]["Tables"] & string>(table: TTable): TableClient<TDatabase["public"]["Tables"][TTable], TDatabase["public"]["Tables"], TTable>;
|
|
188
240
|
global<TRow extends Record<string, unknown> = Record<string, unknown>>(name: string): GlobalClient<TRow>;
|
|
189
241
|
auth: AuthClient;
|
|
190
242
|
storage: StorageClient;
|
|
191
243
|
realtime: RealtimeClient;
|
|
192
244
|
functions: FunctionsClient;
|
|
193
|
-
|
|
194
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Run a GraphQL query. `options.idempotent`: retry on a transient failure, for a query that is not
|
|
247
|
+
* a mutation.
|
|
248
|
+
*
|
|
249
|
+
* Rich text, blocks and json fields come back as values, not as the JSON strings pg_graphql sends:
|
|
250
|
+
* the client reads the schema once and decodes every field typed with its `JSON` scalar, through
|
|
251
|
+
* aliases, fragments, relations and lists. `TData` names the answer's shape, typically from
|
|
252
|
+
* `TableRow<"post">`; nothing checks it at runtime.
|
|
253
|
+
*/
|
|
254
|
+
graphql<TData = unknown>(query: string, variables?: Record<string, unknown> | undefined, options?: {
|
|
255
|
+
idempotent?: boolean | undefined;
|
|
256
|
+
} | undefined): Promise<{
|
|
257
|
+
data: TData | null;
|
|
195
258
|
error: SupatypeError | null;
|
|
196
259
|
}>;
|
|
197
260
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAGtC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAGtC,OAAO,EACL,YAAY,EACZ,eAAe,EAGf,KAAK,eAAe,EACrB,MAAM,YAAY,CAAA;AAGnB,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAoB,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAO9G,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACd,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGlD,YAAY,EACV,IAAI,EACJ,OAAO,EACP,eAAe,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,WAA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