@motherbase/client 1.5.0 → 1.5.2
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/README.md +25 -1
- package/dist/admin.d.ts +131 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +121 -0
- package/dist/admin.js.map +1 -0
- package/dist/auth.d.ts +463 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +884 -0
- package/dist/auth.js.map +1 -0
- package/dist/channel.d.ts +129 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +215 -0
- package/dist/channel.js.map +1 -0
- package/dist/compat.d.ts +40 -0
- package/dist/compat.d.ts.map +1 -0
- package/dist/compat.js +100 -0
- package/dist/compat.js.map +1 -0
- package/dist/cookie.d.ts +68 -0
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cookie.js +152 -0
- package/dist/cookie.js.map +1 -0
- package/dist/database.d.ts +188 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +2 -0
- package/dist/database.js.map +1 -0
- package/dist/functions.d.ts +60 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +75 -0
- package/dist/functions.js.map +1 -0
- package/dist/http.d.ts +122 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +206 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +215 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +365 -0
- package/dist/index.js.map +1 -0
- package/dist/mfa.d.ts +126 -0
- package/dist/mfa.d.ts.map +1 -0
- package/dist/mfa.js +167 -0
- package/dist/mfa.js.map +1 -0
- package/dist/organization.d.ts +234 -0
- package/dist/organization.d.ts.map +1 -0
- package/dist/organization.js +157 -0
- package/dist/organization.js.map +1 -0
- package/dist/passkey.d.ts +59 -0
- package/dist/passkey.d.ts.map +1 -0
- package/dist/passkey.js +87 -0
- package/dist/passkey.js.map +1 -0
- package/dist/pkce.d.ts +13 -0
- package/dist/pkce.d.ts.map +1 -0
- package/dist/pkce.js +52 -0
- package/dist/pkce.js.map +1 -0
- package/dist/plugin-endpoint.d.ts +20 -0
- package/dist/plugin-endpoint.d.ts.map +1 -0
- package/dist/plugin-endpoint.js +24 -0
- package/dist/plugin-endpoint.js.map +1 -0
- package/dist/postgrest.d.ts +326 -0
- package/dist/postgrest.d.ts.map +1 -0
- package/dist/postgrest.js +625 -0
- package/dist/postgrest.js.map +1 -0
- package/dist/query.d.ts +97 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +94 -0
- package/dist/query.js.map +1 -0
- package/dist/realtime.d.ts +114 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +376 -0
- package/dist/realtime.js.map +1 -0
- package/dist/session.d.ts +47 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +136 -0
- package/dist/session.js.map +1 -0
- package/dist/sso.d.ts +147 -0
- package/dist/sso.d.ts.map +1 -0
- package/dist/sso.js +35 -0
- package/dist/sso.js.map +1 -0
- package/dist/storage.d.ts +268 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +441 -0
- package/dist/storage.js.map +1 -0
- package/dist/testing.d.ts +38 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +50 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +353 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/warn.d.ts +2 -0
- package/dist/warn.d.ts.map +1 -0
- package/dist/warn.js +23 -0
- package/dist/warn.js.map +1 -0
- package/package.json +4 -2
package/dist/passkey.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { toError } from './http.js';
|
|
2
|
+
import { pluginGet, pluginPost } from './plugin-endpoint.js';
|
|
3
|
+
const R = {
|
|
4
|
+
registerOptions: '/api/auth/passkey/generate-register-options',
|
|
5
|
+
verifyRegistration: '/api/auth/passkey/verify-registration',
|
|
6
|
+
authenticateOptions: '/api/auth/passkey/generate-authenticate-options',
|
|
7
|
+
verifyAuthentication: '/api/auth/passkey/verify-authentication',
|
|
8
|
+
list: '/api/auth/passkey/list-user-passkeys',
|
|
9
|
+
update: '/api/auth/passkey/update-passkey',
|
|
10
|
+
delete: '/api/auth/passkey/delete-passkey',
|
|
11
|
+
};
|
|
12
|
+
// The plugin keeps the WebAuthn challenge in a signed cookie between the options
|
|
13
|
+
// call and the verify call; cross-origin, fetch only stores and resends it with
|
|
14
|
+
// `include` (the same constraint as the OAuth state cookie).
|
|
15
|
+
const CEREMONY = { credentials: 'include' };
|
|
16
|
+
export class PasskeyClient {
|
|
17
|
+
constructor(http) {
|
|
18
|
+
this.http = http;
|
|
19
|
+
}
|
|
20
|
+
/** Create a passkey on this device for the signed-in user. Prompts the browser's passkey UI. */
|
|
21
|
+
async register(params = {}) {
|
|
22
|
+
const unsupported = webAuthnUnsupported();
|
|
23
|
+
if (unsupported)
|
|
24
|
+
return unsupported;
|
|
25
|
+
const options = await pluginGet(this.http, R.registerOptions, params, CEREMONY);
|
|
26
|
+
if (options.error)
|
|
27
|
+
return { data: null, error: options.error };
|
|
28
|
+
const credential = await runCeremony(() => navigator.credentials.create({ publicKey: PublicKeyCredential.parseCreationOptionsFromJSON(options.data) }));
|
|
29
|
+
if (credential.error)
|
|
30
|
+
return { data: null, error: credential.error };
|
|
31
|
+
return pluginPost(this.http, R.verifyRegistration, { response: credential.data, name: params.name }, CEREMONY);
|
|
32
|
+
}
|
|
33
|
+
list() {
|
|
34
|
+
return pluginGet(this.http, R.list);
|
|
35
|
+
}
|
|
36
|
+
/** Rename a passkey. */
|
|
37
|
+
update(params) {
|
|
38
|
+
return pluginPost(this.http, R.update, params);
|
|
39
|
+
}
|
|
40
|
+
delete(params) {
|
|
41
|
+
return pluginPost(this.http, R.delete, params);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The sign-in half of the ceremony, for `AuthClient.signInWithPasskey`, which
|
|
46
|
+
* owns persisting the session. Resolves with the Better Auth session token.
|
|
47
|
+
*/
|
|
48
|
+
export async function authenticateWithPasskey(http) {
|
|
49
|
+
const unsupported = webAuthnUnsupported();
|
|
50
|
+
if (unsupported)
|
|
51
|
+
return unsupported;
|
|
52
|
+
// Anonymous on purpose: with a session attached, the server narrows the
|
|
53
|
+
// allowed credentials to that user's, which is a re-authentication, not a sign-in.
|
|
54
|
+
const ceremony = { ...CEREMONY, anonymous: true };
|
|
55
|
+
const options = await pluginGet(http, R.authenticateOptions, {}, ceremony);
|
|
56
|
+
if (options.error)
|
|
57
|
+
return { data: null, error: options.error };
|
|
58
|
+
const credential = await runCeremony(() => navigator.credentials.get({ publicKey: PublicKeyCredential.parseRequestOptionsFromJSON(options.data) }));
|
|
59
|
+
if (credential.error)
|
|
60
|
+
return { data: null, error: credential.error };
|
|
61
|
+
const verified = await pluginPost(http, R.verifyAuthentication, { response: credential.data }, ceremony);
|
|
62
|
+
if (verified.error)
|
|
63
|
+
return { data: null, error: verified.error };
|
|
64
|
+
return { data: { token: verified.data.session.token, user: verified.data.user }, error: null };
|
|
65
|
+
}
|
|
66
|
+
function webAuthnUnsupported() {
|
|
67
|
+
const supported = typeof navigator !== 'undefined' &&
|
|
68
|
+
typeof navigator.credentials !== 'undefined' &&
|
|
69
|
+
typeof PublicKeyCredential !== 'undefined' &&
|
|
70
|
+
typeof PublicKeyCredential.parseCreationOptionsFromJSON === 'function';
|
|
71
|
+
return supported
|
|
72
|
+
? null
|
|
73
|
+
: { data: null, error: { message: 'Passkeys need a browser with WebAuthn JSON support.' } };
|
|
74
|
+
}
|
|
75
|
+
/** Run the browser prompt. A dismissed prompt is a `NotAllowedError`, reported as the error result. */
|
|
76
|
+
async function runCeremony(prompt) {
|
|
77
|
+
try {
|
|
78
|
+
const credential = (await prompt());
|
|
79
|
+
if (!credential)
|
|
80
|
+
return { data: null, error: { message: 'No passkey was selected.' } };
|
|
81
|
+
return { data: credential.toJSON(), error: null };
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
return { data: null, error: toError(err) };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=passkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkey.js","sourceRoot":"","sources":["../src/passkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAgC7D,MAAM,CAAC,GAAG;IACR,eAAe,EAAE,6CAA6C;IAC9D,kBAAkB,EAAE,uCAAuC;IAC3D,mBAAmB,EAAE,iDAAiD;IACtE,oBAAoB,EAAE,yCAAyC;IAC/D,IAAI,EAAE,sCAAsC;IAC5C,MAAM,EAAE,kCAAkC;IAC1C,MAAM,EAAE,kCAAkC;CAClC,CAAC;AAEX,iFAAiF;AACjF,gFAAgF;AAChF,6DAA6D;AAC7D,MAAM,QAAQ,GAAG,EAAE,WAAW,EAAE,SAAS,EAAW,CAAC;AAErD,MAAM,OAAO,aAAa;IACxB,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,gGAAgG;IAChG,KAAK,CAAC,QAAQ,CACZ,SAAqF,EAAE;QAEvF,MAAM,WAAW,GAAG,mBAAmB,EAAE,CAAC;QAC1C,IAAI,WAAW;YAAE,OAAO,WAAW,CAAC;QAEpC,MAAM,OAAO,GAAG,MAAM,SAAS,CAC7B,IAAI,CAAC,IAAI,EACT,CAAC,CAAC,eAAe,EACjB,MAAM,EACN,QAAQ,CACT,CAAC;QACF,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAE/D,MAAM,UAAU,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CACxC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,E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GAAG,CAAC,MAAM,MAAM,EAAE,CAA+B,CAAC;QAClE,IAAI,CAAC,UAAU;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,0BAA0B,EAAE,EAAE,CAAC;QACvF,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACpD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
package/dist/pkce.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KeyValueStorageAdapter } from './types.js';
|
|
2
|
+
/** 56 unreserved characters (RFC 7636 allows 43 to 128). */
|
|
3
|
+
export declare function generateCodeVerifier(): string;
|
|
4
|
+
export declare function codeChallengeFor(verifier: string): Promise<string>;
|
|
5
|
+
/** Append the challenge to the redirect URL, which is where the server looks for it. */
|
|
6
|
+
export declare function withCodeChallenge(redirectTo: string, challenge: string): string;
|
|
7
|
+
export interface VerifierStore {
|
|
8
|
+
get(): Promise<string | null>;
|
|
9
|
+
set(verifier: string): Promise<void>;
|
|
10
|
+
clear(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare function verifierStore(storageKey: string, storage?: KeyValueStorageAdapter): VerifierStore;
|
|
13
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../src/pkce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAqBzD,4DAA4D;AAC5D,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGxE;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9B,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAWD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,aAAa,CASjG"}
|
package/dist/pkce.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client half of the PKCE flow (`flowType: 'pkce'`).
|
|
3
|
+
*
|
|
4
|
+
* `signInWithOAuth` makes a verifier, keeps it, and sends only its SHA-256
|
|
5
|
+
* challenge on the redirect URL. The provider callback comes back with
|
|
6
|
+
* `?code=`, and `exchangeCodeForSession(code)` proves possession of the
|
|
7
|
+
* verifier to get the session. The verifier has to outlive a full-page
|
|
8
|
+
* navigation, so it lives in the key/value storage the app passed, or in
|
|
9
|
+
* localStorage, the way supabase-js keeps `<storageKey>-code-verifier`.
|
|
10
|
+
*/
|
|
11
|
+
const VERIFIER_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';
|
|
12
|
+
function base64Url(bytes) {
|
|
13
|
+
let binary = '';
|
|
14
|
+
for (const byte of bytes)
|
|
15
|
+
binary += String.fromCharCode(byte);
|
|
16
|
+
return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
17
|
+
}
|
|
18
|
+
/** 56 unreserved characters (RFC 7636 allows 43 to 128). */
|
|
19
|
+
export function generateCodeVerifier() {
|
|
20
|
+
const bytes = crypto.getRandomValues(new Uint8Array(56));
|
|
21
|
+
return Array.from(bytes, b => VERIFIER_ALPHABET[b % VERIFIER_ALPHABET.length]).join('');
|
|
22
|
+
}
|
|
23
|
+
export async function codeChallengeFor(verifier) {
|
|
24
|
+
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
|
|
25
|
+
return base64Url(new Uint8Array(digest));
|
|
26
|
+
}
|
|
27
|
+
/** Append the challenge to the redirect URL, which is where the server looks for it. */
|
|
28
|
+
export function withCodeChallenge(redirectTo, challenge) {
|
|
29
|
+
const hash = redirectTo.indexOf('#');
|
|
30
|
+
const base = hash === -1 ? redirectTo : redirectTo.slice(0, hash);
|
|
31
|
+
const fragment = hash === -1 ? '' : redirectTo.slice(hash);
|
|
32
|
+
const separator = base.includes('?') ? '&' : '?';
|
|
33
|
+
return `${base}${separator}code_challenge=${encodeURIComponent(challenge)}&code_challenge_method=s256${fragment}`;
|
|
34
|
+
}
|
|
35
|
+
function inMemory() {
|
|
36
|
+
const values = new Map();
|
|
37
|
+
return {
|
|
38
|
+
getItem: key => values.get(key) ?? null,
|
|
39
|
+
setItem: (key, value) => void values.set(key, value),
|
|
40
|
+
removeItem: key => void values.delete(key),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export function verifierStore(storageKey, storage) {
|
|
44
|
+
const backing = storage ?? globalThis.localStorage ?? inMemory();
|
|
45
|
+
const key = `${storageKey}-code-verifier`;
|
|
46
|
+
return {
|
|
47
|
+
get: async () => (await backing.getItem(key)) ?? null,
|
|
48
|
+
set: async (verifier) => { await backing.setItem(key, verifier); },
|
|
49
|
+
clear: async () => { await backing.removeItem(key); },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=pkce.js.map
|
package/dist/pkce.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.js","sourceRoot":"","sources":["../src/pkce.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,iBAAiB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AC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HttpClient, RequestOptions } from './http.js';
|
|
2
|
+
import type { MotherbaseResponse } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Transport for the Better Auth plugin namespaces: `auth.organization`,
|
|
5
|
+
* `auth.passkey` and `auth.sso`.
|
|
6
|
+
*
|
|
7
|
+
* Those namespaces are thin on purpose. Their methods and parameters keep Better
|
|
8
|
+
* Auth's own names, so its plugin documentation stays accurate for them, and
|
|
9
|
+
* the SDK adds only what an app would otherwise have to wire itself: the
|
|
10
|
+
* session's bearer token, and the `{ data, error }` result every other SDK call
|
|
11
|
+
* returns. supabase-js has no equivalent for any of them, so there is no shape
|
|
12
|
+
* to be compatible with beyond that result.
|
|
13
|
+
*/
|
|
14
|
+
type PluginRequestOptions = Pick<RequestOptions, 'anonymous' | 'credentials'>;
|
|
15
|
+
export declare function pluginGet<T>(http: HttpClient, path: string,
|
|
16
|
+
/** Scalar values only. `undefined` and `null` are left out rather than sent as text. */
|
|
17
|
+
query?: object, options?: PluginRequestOptions): Promise<MotherbaseResponse<T>>;
|
|
18
|
+
export declare function pluginPost<T>(http: HttpClient, path: string, body?: object, options?: PluginRequestOptions): Promise<MotherbaseResponse<T>>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=plugin-endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-endpoint.d.ts","sourceRoot":"","sources":["../src/plugin-endpoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;GAUG;AAEH,KAAK,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,aAAa,CAAC,CAAC;AAE9E,wBAAgB,SAAS,CAAC,CAAC,EACzB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM;AACZ,wFAAwF;AACxF,KAAK,GAAE,MAAW,EAClB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAOhC;AAED,wBAAgB,UAAU,CAAC,CAAC,EAC1B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAW,EACjB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAEhC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toError } from './http.js';
|
|
2
|
+
export function pluginGet(http, path,
|
|
3
|
+
/** Scalar values only. `undefined` and `null` are left out rather than sent as text. */
|
|
4
|
+
query = {}, options = {}) {
|
|
5
|
+
const search = new URLSearchParams();
|
|
6
|
+
for (const [key, value] of Object.entries(query)) {
|
|
7
|
+
if (value !== undefined && value !== null)
|
|
8
|
+
search.set(key, String(value));
|
|
9
|
+
}
|
|
10
|
+
const suffix = search.toString();
|
|
11
|
+
return send(http, suffix ? `${path}?${suffix}` : path, options);
|
|
12
|
+
}
|
|
13
|
+
export function pluginPost(http, path, body = {}, options = {}) {
|
|
14
|
+
return send(http, path, { ...options, method: 'POST', body });
|
|
15
|
+
}
|
|
16
|
+
async function send(http, path, options) {
|
|
17
|
+
try {
|
|
18
|
+
return { data: await http.request(path, { ...options, raw: true }), error: null };
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
return { data: null, error: toError(err) };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=plugin-endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-endpoint.js","sourceRoot":"","sources":["../src/plugin-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,E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AACH,CAAC"}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { HttpClient } from './http.js';
|
|
2
|
+
import type { MotherbaseResponse } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* PostgREST query builder, supabase-js shaped.
|
|
5
|
+
*
|
|
6
|
+
* Everything in this file is about ONE thing: emitting the query string
|
|
7
|
+
* PostgREST (and the Motherbase REST dialect that mirrors it) reads. The
|
|
8
|
+
* builder is awaitable, resolves `{ data, error, count }` and never rejects for
|
|
9
|
+
* an expected API error. It has no runtime dependencies.
|
|
10
|
+
*
|
|
11
|
+
* Value encoding is the part that is easy to get wrong, so it lives in one
|
|
12
|
+
* place (`encodeLiteral` / `encodeArrayLiteral`) and every method routes
|
|
13
|
+
* through it:
|
|
14
|
+
*
|
|
15
|
+
* - A string value containing `,` `.` `:` `(` `)` `{` `}` `"` `\` or
|
|
16
|
+
* whitespace, or the empty string, is double quoted, with inner `"` and `\`
|
|
17
|
+
* backslash escaped. That is what makes `in.("a,b",c)` a two element list
|
|
18
|
+
* instead of three, and it is why a value containing a double quote is
|
|
19
|
+
* expressible at all.
|
|
20
|
+
* - Numbers and booleans are never quoted: their string form cannot contain a
|
|
21
|
+
* reserved character, and quoting them would make every `eq.3.14` read as a
|
|
22
|
+
* quoted literal for no gain.
|
|
23
|
+
* - `not()` and `filter()` take their value verbatim when it is a string.
|
|
24
|
+
* They are the escape hatches, so `not('id', 'in', '(1,2)')` has to reach
|
|
25
|
+
* the server as written, exactly as in supabase-js.
|
|
26
|
+
*/
|
|
27
|
+
export type PostgrestPrimitive = string | number | boolean | null;
|
|
28
|
+
/** Value accepted by the array/range operators (`cs`, `cd`, `ov`). */
|
|
29
|
+
export type PostgrestArrayOperand = string | readonly PostgrestPrimitive[] | Record<string, unknown>;
|
|
30
|
+
/** PostgREST's operator names. `filter()` also accepts modifier forms like `like(any)`. */
|
|
31
|
+
export type PostgrestFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'match' | 'imatch' | 'in' | 'is' | 'isdistinct' | 'fts' | 'plfts' | 'phfts' | 'wfts' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'adj';
|
|
32
|
+
/** `is` reaches SQL NULL and the three-valued booleans, and nothing else. */
|
|
33
|
+
export type PostgrestIsValue = null | boolean | 'null' | 'true' | 'false' | 'unknown';
|
|
34
|
+
export type PostgrestCount = 'exact' | 'planned' | 'estimated';
|
|
35
|
+
export type TextSearchType = 'plain' | 'phrase' | 'websearch';
|
|
36
|
+
export interface ReferencedTableOption {
|
|
37
|
+
/** Scope the modifier to an embedded resource: `comments.limit=5`. */
|
|
38
|
+
referencedTable?: string;
|
|
39
|
+
/** supabase-js's pre-2.x name for `referencedTable`. Accepted for parity. */
|
|
40
|
+
foreignTable?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface OrderOptions extends ReferencedTableOption {
|
|
43
|
+
ascending?: boolean;
|
|
44
|
+
nullsFirst?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface PaginateOptions {
|
|
47
|
+
/** Rows per request. Capped server side by `api.rest.maxRows`. Default 1000. */
|
|
48
|
+
pageSize?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface SelectOptions {
|
|
51
|
+
count?: PostgrestCount;
|
|
52
|
+
/** Send the request as HEAD: no rows come back, only the count. */
|
|
53
|
+
head?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface InsertOptions {
|
|
56
|
+
count?: PostgrestCount;
|
|
57
|
+
/**
|
|
58
|
+
* `false` sends `Prefer: missing=default`, so columns absent from a row take
|
|
59
|
+
* their column default instead of NULL.
|
|
60
|
+
*/
|
|
61
|
+
defaultToNull?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface UpsertOptions extends InsertOptions {
|
|
64
|
+
/** Conflict target, defaulting server side to the primary key. */
|
|
65
|
+
onConflict?: string;
|
|
66
|
+
/** `true` sends `Prefer: resolution=ignore-duplicates`. */
|
|
67
|
+
ignoreDuplicates?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface MutateOptions {
|
|
70
|
+
count?: PostgrestCount;
|
|
71
|
+
}
|
|
72
|
+
export interface ExplainOptions {
|
|
73
|
+
analyze?: boolean;
|
|
74
|
+
verbose?: boolean;
|
|
75
|
+
settings?: boolean;
|
|
76
|
+
buffers?: boolean;
|
|
77
|
+
wal?: boolean;
|
|
78
|
+
format?: 'text' | 'json';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The result a query resolves to. `count` is `null` unless `{ count }` was
|
|
82
|
+
* requested and the server answered with a `Content-Range` total.
|
|
83
|
+
*/
|
|
84
|
+
export interface PostgrestResponse<T> extends MotherbaseResponse<T> {
|
|
85
|
+
count: number | null;
|
|
86
|
+
}
|
|
87
|
+
/** One scalar value: quoted only when it has to be. */
|
|
88
|
+
export declare function encodeLiteral(value: PostgrestPrimitive): string;
|
|
89
|
+
/**
|
|
90
|
+
* PostgREST-style, chainable, thenable query builder mapping onto the backend's
|
|
91
|
+
* `/rest/v1/:model` query-param dialect. Awaiting it resolves to
|
|
92
|
+
* `{ data, error, count }` and never rejects for expected API errors (only for
|
|
93
|
+
* programmer misuse).
|
|
94
|
+
*
|
|
95
|
+
* @internal This is the implementation behind `client.from()`, not a surface to
|
|
96
|
+
* construct directly. The public, typed entry point is `client.from(table)`,
|
|
97
|
+
* whose return type (`TypedQuery`, from `database.ts`) is what user code should
|
|
98
|
+
* name. It is exported only so the type can be referenced where inference needs
|
|
99
|
+
* a name for it.
|
|
100
|
+
*/
|
|
101
|
+
export declare class PostgrestQueryBuilder<Row extends object = Record<string, unknown>> implements PromiseLike<PostgrestResponse<Row[]>> {
|
|
102
|
+
private readonly http;
|
|
103
|
+
private readonly model;
|
|
104
|
+
/** supabase-js semantic parity, from `createClient(..., { compat: 'supabase' })`. */
|
|
105
|
+
private readonly compat;
|
|
106
|
+
private method;
|
|
107
|
+
private columns;
|
|
108
|
+
/**
|
|
109
|
+
* Repeated filters on one column must all survive: `?price=gt.10&price=lt.20`
|
|
110
|
+
* is two conditions ANDed together, which is why every filter is `append`ed
|
|
111
|
+
* and never `set`. Using `set` here (as this builder once did) silently
|
|
112
|
+
* dropped the first of the two.
|
|
113
|
+
*/
|
|
114
|
+
private readonly filters;
|
|
115
|
+
/** Reserved params that are replaced rather than repeated (`columns`, `on_conflict`). */
|
|
116
|
+
private readonly extras;
|
|
117
|
+
/** Keyed by referenced table (`''` for the base relation). */
|
|
118
|
+
private readonly orderParts;
|
|
119
|
+
private readonly limits;
|
|
120
|
+
private readonly offsets;
|
|
121
|
+
private readonly prefer;
|
|
122
|
+
private accept?;
|
|
123
|
+
private responseKind;
|
|
124
|
+
private countOption?;
|
|
125
|
+
private headOnly;
|
|
126
|
+
private signal?;
|
|
127
|
+
private body?;
|
|
128
|
+
private rowMode;
|
|
129
|
+
private shouldThrow;
|
|
130
|
+
/** Set by `select()`, so a write can tell "rows asked for" from "no rows requested". */
|
|
131
|
+
private selectCalled;
|
|
132
|
+
constructor(http: HttpClient, model: string,
|
|
133
|
+
/** supabase-js semantic parity, from `createClient(..., { compat: 'supabase' })`. */
|
|
134
|
+
compat?: boolean);
|
|
135
|
+
/**
|
|
136
|
+
* Choose the columns, and optionally ask for a row count.
|
|
137
|
+
*
|
|
138
|
+
* After a write, `.select()` is the supabase-js way of asking for the rows
|
|
139
|
+
* back, so it also sends `Prefer: return=representation`.
|
|
140
|
+
*/
|
|
141
|
+
select(columns?: string, options?: SelectOptions): this;
|
|
142
|
+
insert(values: Partial<Row> | Array<Partial<Row>>, options?: InsertOptions): this;
|
|
143
|
+
/**
|
|
144
|
+
* `INSERT .. ON CONFLICT DO UPDATE`. The conflict target defaults to the
|
|
145
|
+
* primary key server side; `onConflict` names another unique constraint.
|
|
146
|
+
*/
|
|
147
|
+
upsert(values: Partial<Row> | Array<Partial<Row>>, options?: UpsertOptions): this;
|
|
148
|
+
update(values: Partial<Row>, options?: MutateOptions): this;
|
|
149
|
+
delete(options?: MutateOptions): this;
|
|
150
|
+
/**
|
|
151
|
+
* A bulk write states its column set explicitly, so a key missing from one
|
|
152
|
+
* row is still written (as NULL, or as the column default under
|
|
153
|
+
* `missing=default`) instead of being inferred from the first row alone.
|
|
154
|
+
*/
|
|
155
|
+
private applyColumns;
|
|
156
|
+
eq(column: string, value: PostgrestPrimitive): this;
|
|
157
|
+
neq(column: string, value: PostgrestPrimitive): this;
|
|
158
|
+
gt(column: string, value: PostgrestPrimitive): this;
|
|
159
|
+
gte(column: string, value: PostgrestPrimitive): this;
|
|
160
|
+
lt(column: string, value: PostgrestPrimitive): this;
|
|
161
|
+
lte(column: string, value: PostgrestPrimitive): this;
|
|
162
|
+
/** Case-sensitive LIKE. `*` is PostgREST's URL-friendly `%`. */
|
|
163
|
+
like(column: string, pattern: string): this;
|
|
164
|
+
ilike(column: string, pattern: string): this;
|
|
165
|
+
likeAllOf(column: string, patterns: readonly string[]): this;
|
|
166
|
+
likeAnyOf(column: string, patterns: readonly string[]): this;
|
|
167
|
+
ilikeAllOf(column: string, patterns: readonly string[]): this;
|
|
168
|
+
ilikeAnyOf(column: string, patterns: readonly string[]): this;
|
|
169
|
+
in(column: string, values: readonly PostgrestPrimitive[]): this;
|
|
170
|
+
is(column: string, value: PostgrestIsValue): this;
|
|
171
|
+
/** Every key equal to its value, ANDed together. */
|
|
172
|
+
match(query: Record<string, PostgrestPrimitive>): this;
|
|
173
|
+
/**
|
|
174
|
+
* Negate any operator: `not('status', 'eq', 'live')` emits
|
|
175
|
+
* `status=not.eq.live`. The value is passed through verbatim for a string, so
|
|
176
|
+
* composite operands (`not('id', 'in', '(1,2)')`) reach the server as written.
|
|
177
|
+
*/
|
|
178
|
+
not(column: string, operator: PostgrestFilterOperator | (string & {}), value: PostgrestPrimitive | readonly PostgrestPrimitive[]): this;
|
|
179
|
+
/**
|
|
180
|
+
* The escape hatch: any operator, including the ones with no dedicated method
|
|
181
|
+
* (`match`, `imatch`, `isdistinct`) and the modifier forms (`like(any)`).
|
|
182
|
+
*/
|
|
183
|
+
filter(column: string, operator: PostgrestFilterOperator | (string & {}), value: PostgrestPrimitive | readonly PostgrestPrimitive[]): this;
|
|
184
|
+
/**
|
|
185
|
+
* A disjunction, written in PostgREST's own syntax and nestable:
|
|
186
|
+
* `or('status.eq.live,and(price.gt.10,price.lt.20)')`.
|
|
187
|
+
*/
|
|
188
|
+
or(filters: string, options?: ReferencedTableOption): this;
|
|
189
|
+
/** Full-text search. `type` picks the tsquery parser, `config` the dictionary. */
|
|
190
|
+
textSearch(column: string, query: string, options?: {
|
|
191
|
+
type?: TextSearchType;
|
|
192
|
+
config?: string;
|
|
193
|
+
}): this;
|
|
194
|
+
/** `@>`: the column contains the operand (array, range or jsonb). */
|
|
195
|
+
contains(column: string, value: PostgrestArrayOperand): this;
|
|
196
|
+
/** `<@`: the column is contained by the operand. */
|
|
197
|
+
containedBy(column: string, value: PostgrestArrayOperand): this;
|
|
198
|
+
/** `&&`: the column and the operand have an element (or a point) in common. */
|
|
199
|
+
overlaps(column: string, value: PostgrestArrayOperand): this;
|
|
200
|
+
/** `>>`: strictly right of the range. */
|
|
201
|
+
rangeGt(column: string, range: string): this;
|
|
202
|
+
/** `&>`: does not extend to the left of the range. */
|
|
203
|
+
rangeGte(column: string, range: string): this;
|
|
204
|
+
/** `<<`: strictly left of the range. */
|
|
205
|
+
rangeLt(column: string, range: string): this;
|
|
206
|
+
/** `&<`: does not extend to the right of the range. */
|
|
207
|
+
rangeLte(column: string, range: string): this;
|
|
208
|
+
/** `-|-`: adjacent to the range. */
|
|
209
|
+
rangeAdjacent(column: string, range: string): this;
|
|
210
|
+
private push;
|
|
211
|
+
order(column: string, options?: OrderOptions): this;
|
|
212
|
+
limit(count: number, options?: ReferencedTableOption): this;
|
|
213
|
+
/** Inclusive range -> offset/limit. `range(0, 9)` fetches 10 rows from offset 0. */
|
|
214
|
+
range(from: number, to: number, options?: ReferencedTableOption): this;
|
|
215
|
+
/**
|
|
216
|
+
* Every matching row, one page at a time.
|
|
217
|
+
*
|
|
218
|
+
* An unbounded `select()` stops at the server's `api.rest.maxRows` (1000 by
|
|
219
|
+
* default) and says nothing about it: the caller gets a full-looking array
|
|
220
|
+
* that is missing everything past the cap. This walks the result instead, so
|
|
221
|
+
* "give me all of them" is expressible without knowing the cap exists.
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* for await (const row of client.from('events').select('*').stream()) { ... }
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* The pages are separate requests, so rows inserted while the walk is running
|
|
228
|
+
* may be seen or missed depending on when they land. Order by a stable column
|
|
229
|
+
* if that matters.
|
|
230
|
+
*/
|
|
231
|
+
stream(options?: PaginateOptions): AsyncGenerator<Row, void, undefined>;
|
|
232
|
+
/**
|
|
233
|
+
* Like `stream()`, a page at a time rather than a row at a time, with the
|
|
234
|
+
* total from `Content-Range` when the server sent one.
|
|
235
|
+
*
|
|
236
|
+
* An error ends the walk by throwing, unlike awaiting the builder, which
|
|
237
|
+
* resolves `{ data, error }`. A `for await` loop has nowhere to put an error
|
|
238
|
+
* value, and silently ending the iteration early would look exactly like
|
|
239
|
+
* reaching the last page.
|
|
240
|
+
*/
|
|
241
|
+
paginate(options?: PaginateOptions): AsyncGenerator<{
|
|
242
|
+
rows: Row[];
|
|
243
|
+
from: number;
|
|
244
|
+
count: number | null;
|
|
245
|
+
}, void, undefined>;
|
|
246
|
+
/** Cancel the in-flight request when the signal aborts. */
|
|
247
|
+
abortSignal(signal: AbortSignal): this;
|
|
248
|
+
/**
|
|
249
|
+
* Re-type the rows. Purely a compile-time cast, for cases the generated
|
|
250
|
+
* `Database` cannot express (a computed column, an embedded shape).
|
|
251
|
+
*/
|
|
252
|
+
returns<T extends object>(): PostgrestQueryBuilder<T>;
|
|
253
|
+
/** supabase-js's newer name for `returns()`. Also a compile-time cast only. */
|
|
254
|
+
overrideTypes<T extends object>(): PostgrestQueryBuilder<T>;
|
|
255
|
+
/**
|
|
256
|
+
* Reject the query instead of resolving `{ data: null, error }`.
|
|
257
|
+
*
|
|
258
|
+
* The `{ data, error }` envelope is the default in both SDKs because it makes
|
|
259
|
+
* a failure impossible to skip by accident. `throwOnError()` is the opt-out
|
|
260
|
+
* for code that would rather use try/catch, and ported Supabase code uses it
|
|
261
|
+
* widely enough that its absence is a `TypeError: … is not a function` on the
|
|
262
|
+
* first query.
|
|
263
|
+
*/
|
|
264
|
+
throwOnError(): this;
|
|
265
|
+
/**
|
|
266
|
+
* Fail the write if it would touch more than `count` rows.
|
|
267
|
+
*
|
|
268
|
+
* A guard against the missing-filter class of accident (`update()` with a
|
|
269
|
+
* typo'd `.eq()`), sent as `Prefer: max-affected`. A server that does not
|
|
270
|
+
* implement it ignores the preference, so treat this as a safety net rather
|
|
271
|
+
* than a guarantee, and keep the filter correct.
|
|
272
|
+
*/
|
|
273
|
+
maxAffected(count: number): this;
|
|
274
|
+
/**
|
|
275
|
+
* Roll the transaction back after running the query, so nothing is persisted.
|
|
276
|
+
* Useful for validating a write, or previewing what it would return.
|
|
277
|
+
*/
|
|
278
|
+
rollback(): this;
|
|
279
|
+
/** Ask for GeoJSON instead of rows. The result resolves to the parsed object. */
|
|
280
|
+
geojson(): PostgrestExplainBuilder;
|
|
281
|
+
/** Ask for `text/csv` instead of JSON. The result resolves to a string. */
|
|
282
|
+
csv(): PostgrestTextBuilder;
|
|
283
|
+
/** Ask the server for the query plan. Admin-only, and off by default. */
|
|
284
|
+
explain(options?: ExplainOptions): PostgrestExplainBuilder;
|
|
285
|
+
single(): PostgrestSingleBuilder<Row>;
|
|
286
|
+
maybeSingle(): PostgrestSingleBuilder<Row>;
|
|
287
|
+
/** The URL path (with query string) this builder targets. Exposed for tests. */
|
|
288
|
+
toPath(): string;
|
|
289
|
+
/**
|
|
290
|
+
* The request this builder would send, as data.
|
|
291
|
+
*
|
|
292
|
+
* `client.transaction()` needs to describe several writes without issuing
|
|
293
|
+
* them, and the method and body are otherwise private. Exposed rather than
|
|
294
|
+
* reached into: a batch built from `(builder as any).method` would break the
|
|
295
|
+
* first time this class was refactored.
|
|
296
|
+
*/
|
|
297
|
+
toRequest(): {
|
|
298
|
+
method: string;
|
|
299
|
+
model: string;
|
|
300
|
+
query: Record<string, string[]>;
|
|
301
|
+
body: unknown;
|
|
302
|
+
};
|
|
303
|
+
/** The headers this builder sends. Exposed for tests alongside `toPath()`. */
|
|
304
|
+
toHeaders(): Record<string, string>;
|
|
305
|
+
private execute;
|
|
306
|
+
private isWrite;
|
|
307
|
+
/** Apply `single()` / `maybeSingle()` to a row list. The one place row mode is read. */
|
|
308
|
+
private finish;
|
|
309
|
+
then<TResult1 = PostgrestResponse<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
310
|
+
}
|
|
311
|
+
/** Same builder, typed to resolve a single row (from `.single()` / `.maybeSingle()`). */
|
|
312
|
+
export interface PostgrestSingleBuilder<Row extends object> extends Omit<PostgrestQueryBuilder<Row>, 'then' | 'single' | 'maybeSingle' | 'returns'>, PromiseLike<PostgrestResponse<Row>> {
|
|
313
|
+
returns<T extends object>(): PostgrestSingleBuilder<T>;
|
|
314
|
+
then<TResult1 = PostgrestResponse<Row>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<Row>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
315
|
+
}
|
|
316
|
+
/** The builder after `.csv()`: the body is text, not rows. */
|
|
317
|
+
export interface PostgrestTextBuilder extends PromiseLike<PostgrestResponse<string>> {
|
|
318
|
+
toPath(): string;
|
|
319
|
+
toHeaders(): Record<string, string>;
|
|
320
|
+
}
|
|
321
|
+
/** The builder after `.explain()`: text, or the parsed plan for `format: 'json'`. */
|
|
322
|
+
export interface PostgrestExplainBuilder extends PromiseLike<PostgrestResponse<unknown>> {
|
|
323
|
+
toPath(): string;
|
|
324
|
+
toHeaders(): Record<string, string>;
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=postgrest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgrest.d.ts","sourceRoot":"","sources":["../src/postgrest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,WAAW,CAAC;AAEhD,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAElE,sEAAsE;AACtE,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,SAAS,kBAAkB,EAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B,2FAA2F;AAC3F,MAAM,MAAM,uBAAuB,GAC/B,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,IAAI,GACJ,IAAI,GACJ,YAAY,GACZ,KAAK,GACL,OAAO,GACP,OAAO,GACP,MAAM,GACN,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEtF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE9D,MAAM,WAAW,qBAAqB;IACpC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