better-supabase 0.4.0 → 0.5.1
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 +135 -16
- package/dist/actor-DaJjqD5R.d.ts +43 -0
- package/dist/channel-FQW-CnGR.d.ts +70 -0
- package/dist/cli/bin.js +1 -1
- package/dist/cli/codemod-DqV7612m.js +388 -0
- package/dist/cli/{config-D9R0o1LH.js → config-CPVpXP5I.js} +78 -8
- package/dist/cli/{config-SSKSTUl2.js → config-dtoekM0v.js} +1 -1
- package/dist/cli/{read-sets-CMa29t9a.js → diff-SjkO5rNr.js} +1 -220
- package/dist/cli/{dist-CFgGknmZ.js → dist-DBPdlPYK.js} +4 -4
- package/dist/cli/{dist-B1MvLv-M.js → dist-DreZ24Sz.js} +1 -1
- package/dist/cli/{dist-Du7VnEUG.js → dist-xn4wlboc.js} +112 -1
- package/dist/cli/{doctor-BOym3mbL.js → doctor-C_A-KEAz.js} +533 -50
- package/dist/cli/{env-BZ0uy8XK.js → env-DmKv_G4A.js} +1 -1
- package/dist/cli/gen-CIdSQZad.js +2 -0
- package/dist/cli/{gen-Ccn_p90L.js → gen-CjElD1Vw.js} +321 -88
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +4 -4
- package/dist/cli/{init-ClnxRYBF.js → init-DMa6M7hV.js} +2 -2
- package/dist/cli/{introspect-DxqfkVIv.js → introspect-BKlaIu_M.js} +2 -2
- package/dist/cli/{openapi-8WHjxiTJ.js → openapi-Cp5Fyta-.js} +1 -1
- package/dist/cli/read-sets-VQcPgxU9.js +436 -0
- package/dist/cli/{run-CP20LKk_.js → run-Bo_NLT5n.js} +16 -12
- package/dist/cli/{seed-5J6eu_Xg.js → seed-CUlqWh-8.js} +1 -1
- package/dist/cli/sql-CVx-1O8G.js +373 -0
- package/dist/cli/{version-5mW_8sY1.js → version-BCtlgDQx.js} +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +3 -10
- package/dist/clone-BfgmLU90.js +21 -0
- package/dist/{compiler-DB3aSFOA.d.ts → compiler-BXH_aZ7N.d.ts} +2 -2
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.js +4 -4
- package/dist/{config-C1CYcm6o.d.ts → config-Bv7gvfzC.d.ts} +185 -11
- package/dist/{config-CbvFmGD8.js → config-DreERlKo.js} +1 -1
- package/dist/{define-CRS2MRV3.d.ts → define-Bp_BZa5h.d.ts} +11 -7
- package/dist/{define-Bh0AqTik.js → define-cNKzqwL_.js} +202 -16
- package/dist/edge/index.d.ts +16 -5
- package/dist/edge/index.js +10 -7
- package/dist/{entitlements-Dm-FHpNH.d.ts → entitlements-BiJZ4t49.d.ts} +1 -1
- package/dist/env/index.d.ts +2 -2
- package/dist/env/index.js +34 -1
- package/dist/{errors-L0xK41y_.js → errors-DtwXa6b8.js} +1 -0
- package/dist/events/index.d.ts +3 -2
- package/dist/events/index.js +65 -12
- package/dist/events-aIO7vsIk.d.ts +230 -0
- package/dist/{result-CqEsbgYs.d.ts → executor-BunPOO-k.d.ts} +200 -1
- package/dist/{executor-CZ7ImRiD.d.ts → executor-Cghdstwu.d.ts} +1 -2
- package/dist/{executor-CVt6dD0B.js → executor-XycESQPH.js} +3 -3
- package/dist/hono/index.d.ts +17 -6
- package/dist/hono/index.js +40 -5
- package/dist/impersonation-BgSHAYLf.js +133 -0
- package/dist/{resolve-BAqQcwMW.d.ts → impersonation-BmePsuxz.d.ts} +36 -6
- package/dist/{index-BhHEC04r.d.ts → index-C7f8cOBM.d.ts} +2 -2
- package/dist/{index-Dy6kuF0P.d.ts → index-CLg87OBW.d.ts} +6 -1
- package/dist/{index-Cf-D2jk1.d.ts → index-CWMDdEr4.d.ts} +2 -2
- package/dist/{index-D5IfUIDh.d.ts → index-DOESKG27.d.ts} +33 -8
- package/dist/{index-DFmOpBGC.d.ts → index-DgILJRXj.d.ts} +35 -9
- package/dist/{index-RlLXd8dL.d.ts → index-DmXSxbLi.d.ts} +4 -4
- package/dist/{index-BBdvo-5d.d.ts → index-Dp2VDwog.d.ts} +49 -6
- package/dist/{index-528Ugmyp.d.ts → index-SaTsEfGP.d.ts} +76 -8
- package/dist/{index-BAy4tsAP.d.ts → index-fag8VJZ2.d.ts} +3 -4
- package/dist/index.d.ts +30 -13
- package/dist/index.js +10 -9
- package/dist/jobs/index.d.ts +147 -101
- package/dist/jobs/index.js +744 -237
- package/dist/{json-schema-DP6V7cbr.js → json-schema-m1fiwKgN.js} +22 -1
- package/dist/kit-events-CTFDfSwb.js +60 -0
- package/dist/kit-transport-B82k1djG.d.ts +33 -0
- package/dist/kit-transport-DJlHQUBU.js +55 -0
- package/dist/{config-BpxDfnbg.js → kits-CGLLrNPd.js} +37 -9
- package/dist/list/index.d.ts +1 -1
- package/dist/{live-BHakSWWo.d.ts → live-D9W2M5aO.d.ts} +6 -5
- package/dist/mcp/index.d.ts +25 -8
- package/dist/mcp/index.js +23 -14
- package/dist/{mfa-C7MNQ1Ob.d.ts → mfa-Cu96oJdw.d.ts} +2 -16
- package/dist/next/index.d.ts +31 -10
- package/dist/next/index.js +136 -27
- package/dist/notifications/index.d.ts +162 -0
- package/dist/notifications/index.js +264 -0
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +2 -2
- package/dist/orgs/index.d.ts +132 -0
- package/dist/orgs/index.js +245 -0
- package/dist/orpc/index.d.ts +28 -8
- package/dist/orpc/index.js +16 -3
- package/dist/otel/index.d.ts +21 -2
- package/dist/otel/index.js +50 -9
- package/dist/permdock-sql-C2Inc6Xc.d.ts +29 -0
- package/dist/permdock-sql-DgOfeixi.js +51 -0
- package/dist/plugin-DwARMuQp.js +59 -0
- package/dist/{plugin-bNhvJwRh.d.ts → plugin-o144f322.d.ts} +17 -5
- package/dist/plugins/actor/index.d.ts +5 -2
- package/dist/plugins/actor/index.js +22 -8
- package/dist/plugins/rules/index.d.ts +2 -2
- package/dist/plugins/rules/index.js +15 -10
- package/dist/plugins/soft-delete/index.d.ts +3 -3
- package/dist/plugins/soft-delete/index.js +14 -5
- package/dist/plugins/tenant/index.d.ts +2 -2
- package/dist/plugins/tenant/index.js +38 -20
- package/dist/plugins/timestamps/index.d.ts +1 -1
- package/dist/plugins/timestamps/index.js +4 -3
- package/dist/plugins/validation/index.d.ts +2 -2
- package/dist/plugins/validation/index.js +26 -6
- package/dist/{pool-DFwEQwmN.d.ts → pool-C9voM4Kw.d.ts} +17 -6
- package/dist/postgres/index.d.ts +5 -5
- package/dist/postgres/index.js +20 -11
- package/dist/{postgrest-Bc-0Xw62.d.ts → postgrest-CruYKAvV.d.ts} +1 -1
- package/dist/{problem-BihjPR0t.js → problem-BW1KhzSG.js} +2 -1
- package/dist/{problem-U8UEKccv.d.ts → problem-Blxe8S31.d.ts} +1 -1
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +3 -3
- package/dist/{query-BMMSWbI7.js → query-CCbo44lG.js} +2 -2
- package/dist/queue-BYUCjr59.d.ts +252 -0
- package/dist/react/index.d.ts +8 -7
- package/dist/react/index.js +4 -3
- package/dist/react/server.d.ts +14 -3
- package/dist/react/server.js +10 -2
- package/dist/react/session.d.ts +7 -1
- package/dist/react/session.js +9 -1
- package/dist/{react-CQHMaESR.js → react-C_s7kiNz.js} +103 -11
- package/dist/{read-set-FWK8qQ58.js → read-set-DQFt1N_Y.js} +22 -1
- package/dist/realtime/index.d.ts +3 -3
- package/dist/realtime/index.js +5 -4
- package/dist/{refresh-BwYkyNOQ.d.ts → refresh-CFPX0Qft.d.ts} +1 -1
- package/dist/{resource-BJcaIfxi.d.ts → resource-DNRFP7KR.d.ts} +5 -5
- package/dist/{resource-My_y-Syh.js → resource-mqfJW4YF.js} +22 -7
- package/dist/respond-BR1fJWOB.d.ts +377 -0
- package/dist/{result-Bj6yt33D.js → result-BKiliPY7.js} +1 -1
- package/dist/server/index.d.ts +15 -12
- package/dist/server/index.js +11 -17
- package/dist/{server-BA75B0mT.js → server-B1mZ7CgQ.js} +259 -37
- package/dist/{shared-DnoCdMDr.js → shared-D1dRUrAg.js} +16 -2
- package/dist/signers-Cc6r98SW.d.ts +162 -0
- package/dist/{simplify-Cqvfr9dj.js → simplify-_0oUKqCd.js} +4 -115
- package/dist/sql/index.d.ts +283 -11
- package/dist/sql/index.js +8705 -775
- package/dist/{sql-B34HU2DI.js → sql-Coh6n4cC.js} +9 -2
- package/dist/ssr/index.d.ts +4 -4
- package/dist/ssr/index.js +1 -2
- package/dist/{standard-BRyBGTtp.js → standard-D7r6dMUu.js} +6 -3
- package/dist/{standard-BsaCYQJc.d.ts → standard-J4YgMOLm.d.ts} +1 -1
- package/dist/{stats-C_YxA2r1.js → stats-Bqob3WqT.js} +4 -4
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.js +155 -26
- package/dist/support-CEPwlw2G.d.ts +89 -0
- package/dist/support-view-B8SlToQX.d.ts +17 -0
- package/dist/support-view-g4YLBeqX.js +18 -0
- package/dist/support-wHnK6zp-.js +293 -0
- package/dist/{permdock-sql-C4KFzLc9.js → template-TxrGI5jR.js} +2 -31
- package/dist/{temporal-BwshQk0W.js → temporal-CVlIV2DZ.js} +17 -4
- package/dist/{temporal-required-CBNHT6ni.js → temporal-required-CAt4Dc9Z.js} +2 -2
- package/dist/testing/index.d.ts +132 -10
- package/dist/testing/index.js +476 -8
- package/dist/{types-DONv9SHN.d.ts → types-Dnf_wRDz.d.ts} +26 -3
- package/dist/user-change-CHFEUro1.js +49 -0
- package/dist/{webhooks-Bh_Jf_-l.js → verify-Ce49ETPz.js} +5 -5
- package/dist/{version-Bmf7_FzM.js → version-DOYTYwHP.js} +1 -1
- package/dist/{mfa-byfjruR9.js → view-Bn6HNKUe.js} +97 -98
- package/dist/{view-B64o81wp.d.ts → view-CbgObAeb.d.ts} +22 -31
- package/dist/webhooks/index.d.ts +135 -4
- package/dist/webhooks/index.js +588 -2
- package/dist/wire-D2dT86vi.js +35 -0
- package/package.json +27 -19
- package/schemas/config-v1.json +131 -1
- package/schemas/doctor-report-v1.json +11 -0
- package/skills/better-supabase/SKILL.md +9 -6
- package/skills/better-supabase/references/plugins.md +6 -3
- package/skills/better-supabase/references/troubleshooting.md +1 -0
- package/skills/better-supabase-api/SKILL.md +9 -2
- package/skills/better-supabase-api/references/adapters.md +11 -8
- package/skills/better-supabase-auth/SKILL.md +18 -7
- package/skills/better-supabase-auth/references/permdock.md +78 -11
- package/dist/cli/gen-D5cLCULx.js +0 -2
- package/dist/cli/sql-D4VbqmXi.js +0 -199
- package/dist/events-B21UOhvP.d.ts +0 -84
- package/dist/executor-B5IoUxLE.d.ts +0 -195
- package/dist/invalidate-CgxmRamI.js +0 -24
- package/dist/permdock-sql-DImJULY-.d.ts +0 -17
- package/dist/plugin-BqR6wKMB.js +0 -23
- package/dist/respond-DgIbdrt8.d.ts +0 -194
- package/dist/view-BrJI2LKp.js +0 -45
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
3
|
-
import { a as EventHub, s as MutationNotice } from "./events-
|
|
4
|
-
import { l as
|
|
2
|
+
import { j as SchemaMeta } from "./types-Dnf_wRDz.js";
|
|
3
|
+
import { a as EventHub, g as KitEventPattern, p as KitEvent, s as MutationNotice } from "./events-aIO7vsIk.js";
|
|
4
|
+
import { l as MutationIntent } from "./plugin-o144f322.js";
|
|
5
5
|
//#region src/events/index.d.ts
|
|
6
6
|
/** A CloudEvents 1.0 event. Extension attributes are lowercase alphanumerics. */
|
|
7
7
|
interface CloudEvent<T = unknown> {
|
|
@@ -16,10 +16,11 @@ interface CloudEvent<T = unknown> {
|
|
|
16
16
|
readonly data?: T;
|
|
17
17
|
readonly [extension: string]: unknown;
|
|
18
18
|
}
|
|
19
|
-
declare const ROW_EVENT_TYPES: { readonly [K in
|
|
19
|
+
declare const ROW_EVENT_TYPES: { readonly [K in MutationIntent]: string; };
|
|
20
20
|
interface RowEventData {
|
|
21
21
|
readonly table: string;
|
|
22
22
|
readonly row: Readonly<Record<string, unknown>>;
|
|
23
|
+
readonly actorId?: string;
|
|
23
24
|
}
|
|
24
25
|
interface CloudEventOptions {
|
|
25
26
|
/** URI-reference of the producer, e.g. `https://crm.example.com` or `/crm`. */
|
|
@@ -35,8 +36,10 @@ interface EventSink {
|
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* One CloudEvent per mutated row: `dev.better-supabase.row.created` with the
|
|
38
|
-
* app-cased row
|
|
39
|
-
* `partitionkey
|
|
39
|
+
* app-cased row and the actor in `data`, the primary key as `subject` and the
|
|
40
|
+
* tenant as `partitionkey`. Writes that return no rows (soft
|
|
41
|
+
* deletes, `returning: false`) send one event per known primary key, with the
|
|
42
|
+
* key as `row`.
|
|
40
43
|
*/
|
|
41
44
|
declare function toCloudEvents(notice: MutationNotice, options: CloudEventOptions & {
|
|
42
45
|
readonly meta?: SchemaMeta;
|
|
@@ -49,12 +52,34 @@ interface ForwardOptions extends CloudEventOptions {
|
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Sends a CloudEvent for every mutation to `sink`. Returns a function that
|
|
52
|
-
* stops forwarding.
|
|
55
|
+
* stops forwarding. Sends in flight are tracked on `betterSupabase.events`
|
|
56
|
+
* (`settled()`), which the Next adapter hands to `after()` and the edge
|
|
57
|
+
* entry to `waitUntil`. Use an outbox (SQL kit) when events must not be lost.
|
|
53
58
|
*/
|
|
54
59
|
declare function forwardMutations(betterSupabase: {
|
|
55
60
|
readonly events: EventHub;
|
|
56
61
|
readonly meta: SchemaMeta;
|
|
57
62
|
}, sink: EventSink, options: ForwardOptions): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* A kit event as a CloudEvent: `dev.better-supabase.support.started` with
|
|
65
|
+
* the event data and the actor (`actorId`) as `data` and the tenant as
|
|
66
|
+
* `partitionkey`.
|
|
67
|
+
*/
|
|
68
|
+
declare function kitCloudEvent(event: KitEvent, options: CloudEventOptions): CloudEvent;
|
|
69
|
+
interface ForwardKitOptions extends CloudEventOptions {
|
|
70
|
+
/** Only forward events that match, e.g. `support.*`. Defaults to all. */
|
|
71
|
+
readonly types?: readonly KitEventPattern[];
|
|
72
|
+
/** Sink failures never fail the kit call. Defaults to the `Logger`. */
|
|
73
|
+
readonly onError?: (error: unknown, events: readonly CloudEvent[]) => void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Sends a CloudEvent for every kit event (`support.*`, `org.*`, ...) to
|
|
77
|
+
* `sink`. Returns a function that stops forwarding. Like
|
|
78
|
+
* `forwardMutations`, sends are tracked on `betterSupabase.events`.
|
|
79
|
+
*/
|
|
80
|
+
declare function forwardKitEvents(betterSupabase: {
|
|
81
|
+
readonly events: EventHub;
|
|
82
|
+
}, sink: EventSink, options: ForwardKitOptions): () => void;
|
|
58
83
|
type HttpMode = "structured" | "binary" | "batch";
|
|
59
84
|
/** The HTTP protocol binding: headers and body for one event (or a batch). */
|
|
60
85
|
declare function toHttp(events: CloudEvent | readonly CloudEvent[], mode?: HttpMode): {
|
|
@@ -72,4 +97,4 @@ interface HttpSinkOptions {
|
|
|
72
97
|
/** POSTs events to `url`. Non-2xx responses reject. */
|
|
73
98
|
declare function httpSink(url: string | URL, options?: HttpSinkOptions): EventSink;
|
|
74
99
|
//#endregion
|
|
75
|
-
export {
|
|
100
|
+
export { toHttp as _, ForwardOptions as a, ROW_EVENT_TYPES as c, forwardMutations as d, fromHttp as f, toCloudEvents as g, kitCloudEvent as h, ForwardKitOptions as i, RowEventData as l, isCloudEvent as m, CloudEventOptions as n, HttpMode as o, httpSink as p, EventSink as r, HttpSinkOptions as s, CloudEvent as t, forwardKitEvents as u };
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as FindExt, Ct as WhereInput, M as UpsertArgs, N as WriteArgs, S as DeleteExt, T as OffsetPageArgs, X as InferResult, Z as QuerySpec, _ as CursorPage, it as AggregateResult, j as UpdateArgs, k as Returned, l as CacheAdapter, lt as FindFirstArgs, rt as AggregateArgs, st as CountArgs, t as BetterSupabase, ut as FindManyArgs, v as CursorPageArgs, vt as Payload, w as OffsetPage, x as DeleteArgs, y as Db, yt as ReadArgs } from "./define-
|
|
4
|
-
import { DataTag, InfiniteData, QueryClient, SkipToken } from "@tanstack/query-core";
|
|
1
|
+
import { P as TableKey, R as UniqueWhere, _ as Insert, n as AnyFunctions, r as AnyModels, w as PrimaryKeyValue, z as Update } from "./types-Dnf_wRDz.js";
|
|
2
|
+
import { x as DbException } from "./executor-BunPOO-k.js";
|
|
3
|
+
import { C as FindExt, Ct as WhereInput, M as UpsertArgs, N as WriteArgs, S as DeleteExt, T as OffsetPageArgs, X as InferResult, Z as QuerySpec, _ as CursorPage, it as AggregateResult, j as UpdateArgs, k as Returned, l as CacheAdapter, lt as FindFirstArgs, rt as AggregateArgs, st as CountArgs, t as BetterSupabase, ut as FindManyArgs, v as CursorPageArgs, vt as Payload, w as OffsetPage, x as DeleteArgs, y as Db, yt as ReadArgs } from "./define-Bp_BZa5h.js";
|
|
4
|
+
import { DataTag, InfiniteData, QueryClient, QueryMeta, SkipToken } from "@tanstack/query-core";
|
|
5
5
|
//#region src/query/invalidate.d.ts
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Carried by every better-supabase query: the tables whose changes make it
|
|
8
|
+
* stale, on top of the app's `Register['queryMeta']`, so the options stay
|
|
9
|
+
* assignable to `useQuery` when the app narrows its query meta.
|
|
10
|
+
*/
|
|
11
|
+
type BetterQueryMeta = QueryMeta & {
|
|
8
12
|
readonly bsTables: readonly string[];
|
|
9
|
-
|
|
10
|
-
}
|
|
13
|
+
};
|
|
11
14
|
/**
|
|
12
15
|
* Invalidates every query that read one of `tables`: better-supabase queries
|
|
13
16
|
* by their `meta.bsTables`, and other `['bs', table, ...]` keys by prefix.
|
|
@@ -114,4 +117,27 @@ declare function queryCache(client: QueryClient): CacheAdapter;
|
|
|
114
117
|
/** Invalidates affected queries for every mutation and declared RPC `betterSupabase` performs in this runtime. */
|
|
115
118
|
declare function invalidateOnMutation<M extends AnyModels, D, F extends AnyFunctions, E>(betterSupabase: BetterSupabase<M, D, F, E>, client: QueryClient): () => void;
|
|
116
119
|
//#endregion
|
|
117
|
-
|
|
120
|
+
//#region src/query/user-change.d.ts
|
|
121
|
+
/** The part of `createClient().auth` that `clearOnUserChange` reads. */
|
|
122
|
+
interface UserChangeSource {
|
|
123
|
+
subscribe(listener: () => void): () => void;
|
|
124
|
+
current(): {
|
|
125
|
+
readonly status: string;
|
|
126
|
+
readonly user: {
|
|
127
|
+
readonly id: string;
|
|
128
|
+
} | null;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Removes every `['bs', ...]` query when the signed-in user changes or signs
|
|
133
|
+
* out, so the next user never sees the previous user's rows. Returns the
|
|
134
|
+
* function that stops listening. `BetterSupabaseProvider` calls it for React;
|
|
135
|
+
* call it yourself with Vue, Solid, Svelte or Angular Query.
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* const stop = clearOnUserChange(queryClient, bs.auth);
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare function clearOnUserChange(queryClient: Pick<QueryClient, "removeQueries">, auth: UserChangeSource): () => void;
|
|
142
|
+
//#endregion
|
|
143
|
+
export { MutationOptionsOf as a, QueryKeyOf as c, createQueries as d, invalidateOnMutation as f, invalidateTables as h, InfiniteOptionsOf as i, QueryOptionsOf as l, BetterQueryMeta as m, clearOnUserChange as n, QueriesOptions as o, queryCache as p, BetterQueries as r, QueryHelpers as s, UserChangeSource as t, TableQueries as u };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { t as BetterSupabase, y as Db } from "./define-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as AnyFunctions, r as AnyModels } from "./types-Dnf_wRDz.js";
|
|
2
|
+
import { t as BetterSupabase, y as Db } from "./define-Bp_BZa5h.js";
|
|
3
|
+
import { l as PublicEnv } from "./index-CLg87OBW.js";
|
|
4
|
+
import { r as BetterQueries } from "./index-DgILJRXj.js";
|
|
5
5
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
6
6
|
//#region src/client/index.d.ts
|
|
7
7
|
interface ClientOptions {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Z as QuerySpec } from "./define-
|
|
3
|
-
import { i as ClientAuth, t as AuthSnapshot } from "./index-
|
|
1
|
+
import { _ as DbError } from "./executor-BunPOO-k.js";
|
|
2
|
+
import { Z as QuerySpec } from "./define-Bp_BZa5h.js";
|
|
3
|
+
import { i as ClientAuth, t as AuthSnapshot } from "./index-DmXSxbLi.js";
|
|
4
4
|
import { n as TemplateValues } from "./template-mbvlysOo.js";
|
|
5
|
-
import { t as AuthSession } from "./view-
|
|
6
|
-
import { a as LiveSource, g as Topic, h as SubscriptionStatus, p as SubscribeOptions, r as LiveCountSeed, u as EventSchemas, v as TopicHandlers, y as TopicMessage } from "./live-
|
|
5
|
+
import { t as AuthSession } from "./view-CbgObAeb.js";
|
|
6
|
+
import { a as LiveSource, g as Topic, h as SubscriptionStatus, p as SubscribeOptions, r as LiveCountSeed, u as EventSchemas, v as TopicHandlers, y as TopicMessage } from "./live-D9W2M5aO.js";
|
|
7
7
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
8
8
|
import { ReactNode } from "react";
|
|
9
9
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -115,4 +115,47 @@ interface LiveCount {
|
|
|
115
115
|
*/
|
|
116
116
|
declare function useLiveCount(source: QuerySpec<string, "count", number> | LiveCountSeed | null | undefined, options?: LiveCountHookOptions): LiveCount;
|
|
117
117
|
//#endregion
|
|
118
|
-
|
|
118
|
+
//#region src/react/notifications.d.ts
|
|
119
|
+
/** Loads one list of items, e.g. a server action that calls `notifications.list()`. */
|
|
120
|
+
type NotificationSource<T> = () => Promise<readonly T[]>;
|
|
121
|
+
interface UseNotificationsOptions<T> {
|
|
122
|
+
/**
|
|
123
|
+
* The private topic the `notifications` module broadcasts to, e.g.
|
|
124
|
+
* `notifications:${userId}` (`kits.notifications.options.topic`). `null`
|
|
125
|
+
* loads once without realtime.
|
|
126
|
+
*/
|
|
127
|
+
readonly topic: string | null;
|
|
128
|
+
/** The notifications, newest first. */
|
|
129
|
+
readonly load: NotificationSource<T>;
|
|
130
|
+
/** More items merged in, such as running jobs or pending approvals. */
|
|
131
|
+
readonly sources?: readonly NotificationSource<T>[];
|
|
132
|
+
/** Orders the merged list. Defaults to the order the sources return. */
|
|
133
|
+
readonly sort?: (a: T, b: T) => number;
|
|
134
|
+
/** The badge number. Defaults to the items without a `readAt`. */
|
|
135
|
+
readonly count?: (items: readonly T[]) => number;
|
|
136
|
+
/** Runs for each broadcast, e.g. to show a toast for `notification_created`. */
|
|
137
|
+
readonly onMessage?: (event: string, payload: unknown) => void;
|
|
138
|
+
}
|
|
139
|
+
interface NotificationsState<T> {
|
|
140
|
+
/** `undefined` until the first load. */
|
|
141
|
+
readonly items: readonly T[] | undefined;
|
|
142
|
+
readonly count: number;
|
|
143
|
+
readonly status: SubscriptionStatus;
|
|
144
|
+
readonly error: unknown;
|
|
145
|
+
/** Loads again, e.g. after marking items read. */
|
|
146
|
+
readonly refresh: () => Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The signed-in user's notifications, kept current: loads them, then loads
|
|
150
|
+
* again after each broadcast on `topic` and after the channel rejoins.
|
|
151
|
+
*
|
|
152
|
+
* ```tsx
|
|
153
|
+
* const { items, count } = useNotifications({
|
|
154
|
+
* topic: `org:${orgId}:notifications:${userId}`,
|
|
155
|
+
* load: () => listNotifications(orgId),
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare function useNotifications<T>(options: UseNotificationsOptions<T>): NotificationsState<T>;
|
|
160
|
+
//#endregion
|
|
161
|
+
export { useBroadcast as _, BetterHooks as a, useSupabase as b, BroadcastOptions as c, LiveCount as d, LiveCountHookOptions as f, useAuth as g, createHooks as h, useNotifications as i, ClaimsOf as l, ProfileOf as m, NotificationsState as n, BetterSupabaseProvider as o, LiveQueryHookOptions as p, UseNotificationsOptions as r, BetterSupabaseProviderProps as s, NotificationSource as t, ClientLike as u, useLiveCount as v, useLiveQuery as y };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { a as BucketPolicyName, t as AccessBucketPolicy, x as PermdockBucketPolicy } from "./types-Dnf_wRDz.js";
|
|
3
|
+
import { _ as DbError, a as AsyncResult, u as Result } from "./executor-BunPOO-k.js";
|
|
4
|
+
import { g as RequestContext } from "./plugin-o144f322.js";
|
|
5
|
+
import { n as PermdockCatalog } from "./permdock-sql-C2Inc6Xc.js";
|
|
4
6
|
import { n as StoragePath, t as PathIn } from "./path-Cv__-OTj.js";
|
|
5
|
-
import { t as PermdockCatalog } from "./permdock-sql-DImJULY-.js";
|
|
6
7
|
import { n as TemplateValues, t as TemplateParams } from "./template-mbvlysOo.js";
|
|
7
8
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
8
9
|
//#region src/storage/bucket.d.ts
|
|
9
|
-
type BucketPolicy = BucketPolicyName | PermdockBucketPolicy;
|
|
10
|
+
type BucketPolicy = BucketPolicyName | PermdockBucketPolicy | AccessBucketPolicy;
|
|
10
11
|
interface BucketConfig<P extends string = string, Id extends string = string> {
|
|
11
12
|
/** Bucket id, e.g. `customer-logos`. */
|
|
12
13
|
readonly id: Id;
|
|
@@ -15,8 +16,11 @@ interface BucketConfig<P extends string = string, Id extends string = string> {
|
|
|
15
16
|
readonly public?: boolean;
|
|
16
17
|
/**
|
|
17
18
|
* Generated `storage.objects` policies. `tenant` and `owner` match a path
|
|
18
|
-
* segment against the JWT; `public` allows reads
|
|
19
|
-
* the
|
|
19
|
+
* segment against the JWT; `public` allows reads (on a `public: true`
|
|
20
|
+
* bucket the public URLs need no policy, so none is written and nobody can
|
|
21
|
+
* list the objects); `none` leaves access to
|
|
22
|
+
* the secret key; `{ permdock, scope }` calls PermDock's SQL helpers;
|
|
23
|
+
* `{ access }` calls the SQL kit's access contract (`tenant_ids_with`).
|
|
20
24
|
* Defaults to `none`.
|
|
21
25
|
*
|
|
22
26
|
* The helpers check role and scope only. Use `permdock` just for
|
|
@@ -29,13 +33,19 @@ interface BucketConfig<P extends string = string, Id extends string = string> {
|
|
|
29
33
|
readonly policy?: BucketPolicy;
|
|
30
34
|
/**
|
|
31
35
|
* PermDock's `permissions.catalog.json`. With it, a `permdock` policy
|
|
32
|
-
* naming a permission
|
|
36
|
+
* naming a permission without `rowConditions: false` (including one the
|
|
37
|
+
* catalog doesn't list) throws.
|
|
33
38
|
*/
|
|
34
39
|
readonly catalog?: PermdockCatalog;
|
|
35
40
|
/** `'5MiB'`, `'500KB'` or bytes. */
|
|
36
41
|
readonly fileSizeLimit?: string | number;
|
|
37
42
|
/** `['image/png', 'image/*']`. */
|
|
38
43
|
readonly allowedMimeTypes?: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* The tenant segment. Set it and connected clients only touch paths whose
|
|
46
|
+
* `param` holds the caller's tenant: pass `{ context }` or `{ tenant }` to
|
|
47
|
+
* `connect()`, or `{ allTenants: true }` for cross-tenant admin work.
|
|
48
|
+
*/
|
|
39
49
|
readonly tenant?: {
|
|
40
50
|
/** Placeholder holding the tenant id. Defaults to `orgId`. */
|
|
41
51
|
readonly param?: string;
|
|
@@ -145,6 +155,8 @@ interface ActualBucket {
|
|
|
145
155
|
type StorageClient = Pick<SupabaseClient, "storage">;
|
|
146
156
|
interface BucketClient<P extends string, Id extends string = string> {
|
|
147
157
|
readonly bucket: Bucket<P, Id>;
|
|
158
|
+
/** The object path, checked against the template and, with `tenant`, the caller's tenant. */
|
|
159
|
+
path(target: ObjectTarget<P, Id>): Result<StoragePath<Id>>;
|
|
148
160
|
upload(target: ObjectTarget<P, Id>, body: UploadBody, options?: UploadOptions): AsyncResult<{
|
|
149
161
|
path: StoragePath<Id>;
|
|
150
162
|
}>;
|
|
@@ -186,6 +198,8 @@ interface Bucket<P extends string, Id extends string = string> {
|
|
|
186
198
|
* removes the objects it fills.
|
|
187
199
|
*/
|
|
188
200
|
readonly owner: string | undefined;
|
|
201
|
+
/** Placeholder connected clients check against the caller's tenant; set by `tenant`. */
|
|
202
|
+
readonly tenant: string | undefined;
|
|
189
203
|
readonly fileSizeLimit: number | undefined;
|
|
190
204
|
readonly allowedMimeTypes: readonly string[] | undefined;
|
|
191
205
|
path(values: TemplateValues<P>): StoragePath<Id>;
|
|
@@ -212,6 +226,17 @@ interface BucketConnectOptions {
|
|
|
212
226
|
* never cross users.
|
|
213
227
|
*/
|
|
214
228
|
readonly cacheSignedUrls?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* The request context (`db.$context`, or what an adapter passes to
|
|
231
|
+
* `connect`). For a bucket with `tenant`, its tenant (`context.tenant`, the
|
|
232
|
+
* one `tenant()` resolved, or the `tenant.claim` claims) must fill the
|
|
233
|
+
* tenant segment of every path.
|
|
234
|
+
*/
|
|
235
|
+
readonly context?: RequestContext;
|
|
236
|
+
/** The tenant every path must hold, instead of reading it from `context`. */
|
|
237
|
+
readonly tenant?: string;
|
|
238
|
+
/** Skip the tenant check, for admin jobs that work across tenants. */
|
|
239
|
+
readonly allTenants?: boolean;
|
|
215
240
|
}
|
|
216
241
|
declare function parseSize(value: string | number): number;
|
|
217
242
|
/** Maps a Storage error (`StorageApiError`, fetch failures) to a `DbError`. */
|
|
@@ -233,4 +258,47 @@ declare function fromStorageError(raw: unknown, table?: string): DbError;
|
|
|
233
258
|
*/
|
|
234
259
|
declare function defineBucket<const P extends string, const Id extends string = string>(config: BucketConfig<P, Id>): Bucket<P, Id>;
|
|
235
260
|
//#endregion
|
|
236
|
-
|
|
261
|
+
//#region src/storage/presets.d.ts
|
|
262
|
+
/** The image types browsers display everywhere. */
|
|
263
|
+
declare const IMAGE_TYPES: readonly string[];
|
|
264
|
+
interface ImageBucketOptions<P extends string, Id extends string> {
|
|
265
|
+
readonly id?: Id;
|
|
266
|
+
/** The path template; keep the preset's placeholders the policy relies on. */
|
|
267
|
+
readonly path?: P;
|
|
268
|
+
/** Defaults to `true`: images load from their public URL without signing. */
|
|
269
|
+
readonly public?: boolean;
|
|
270
|
+
readonly fileSizeLimit?: string | number;
|
|
271
|
+
readonly allowedMimeTypes?: readonly string[];
|
|
272
|
+
/** Replaces the preset's policy. */
|
|
273
|
+
readonly policy?: BucketPolicy;
|
|
274
|
+
}
|
|
275
|
+
type AvatarBucketOptions<P extends string, Id extends string> = ImageBucketOptions<P, Id>;
|
|
276
|
+
interface OrgLogoBucketOptions<P extends string, Id extends string> extends ImageBucketOptions<P, Id> {
|
|
277
|
+
/**
|
|
278
|
+
* The permission that may upload, replace and delete a logo, checked
|
|
279
|
+
* through the access contract. Defaults to `organization.update`, the
|
|
280
|
+
* `organizations` module's update permission.
|
|
281
|
+
*/
|
|
282
|
+
readonly permission?: string;
|
|
283
|
+
/**
|
|
284
|
+
* The tenant segment connected clients are held to. `false` lets one
|
|
285
|
+
* client upload for any organization the policy allows. Defaults to
|
|
286
|
+
* `{ param: 'orgId' }`.
|
|
287
|
+
*/
|
|
288
|
+
readonly tenant?: BucketConfig["tenant"] | false;
|
|
289
|
+
}
|
|
290
|
+
declare const AVATAR_PATH = "{userId}/avatar-{version}.{ext}";
|
|
291
|
+
declare const LOGO_PATH = "{orgId}/logo-{version}.{ext}";
|
|
292
|
+
/**
|
|
293
|
+
* A bucket for profile pictures: `{userId}/avatar-{version}.{ext}`, public,
|
|
294
|
+
* 2 MiB of images, written only by their owner (the `owner` policy).
|
|
295
|
+
*/
|
|
296
|
+
declare function avatarBucket<const P extends string = typeof AVATAR_PATH, const Id extends string = "avatars">(options?: AvatarBucketOptions<P, Id>): Bucket<P, Id>;
|
|
297
|
+
/**
|
|
298
|
+
* A bucket for organization logos: `{orgId}/logo-{version}.{ext}`, public,
|
|
299
|
+
* 2 MiB of images, written by members with the update permission through
|
|
300
|
+
* the access contract (`tenant_ids_with`), so it follows the app's roles.
|
|
301
|
+
*/
|
|
302
|
+
declare function orgLogoBucket<const P extends string = typeof LOGO_PATH, const Id extends string = "organization-logos">(options?: OrgLogoBucketOptions<P, Id>): Bucket<P, Id>;
|
|
303
|
+
//#endregion
|
|
304
|
+
export { parseSize as A, TransformOptions as C, UrlOptions as D, UploadOptions as E, defineBucket as O, TTL as S, UploadBody as T, Reservation as _, avatarBucket as a, SweepOptions as b, Bucket as c, BucketConnectOptions as d, BucketDrift as f, ReplaceResult as g, ReplaceOptions as h, OrgLogoBucketOptions as i, fromStorageError as k, BucketClient as l, ObjectTarget as m, IMAGE_TYPES as n, orgLogoBucket as o, BucketPolicy as p, ImageBucketOptions as r, ActualBucket as s, AvatarBucketOptions as t, BucketConfig as u, StorageClient as v, TtlPreset as w, SweepResult as x, StoredObject as y };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { C as FindExt, Ct as WhereInput, O as RepositoryOf, T as OffsetPageArgs, _ as CursorPage, dt as IncludeArg, gt as OrderByArg, t as BetterSupabase, v as CursorPageArgs, vt as Payload, w as OffsetPage, xt as SelectArg } from "./define-CRS2MRV3.js";
|
|
1
|
+
import { P as TableKey, k as Row, n as AnyFunctions, r as AnyModels } from "./types-Dnf_wRDz.js";
|
|
2
|
+
import { I as CountMode, a as AsyncResult, w as ValidationIssue } from "./executor-BunPOO-k.js";
|
|
3
|
+
import { C as FindExt, Ct as WhereInput, O as RepositoryOf, T as OffsetPageArgs, _ as CursorPage, dt as IncludeArg, gt as OrderByArg, t as BetterSupabase, v as CursorPageArgs, vt as Payload, w as OffsetPage, xt as SelectArg } from "./define-Bp_BZa5h.js";
|
|
5
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
5
|
//#region src/list/list-query.d.ts
|
|
7
6
|
/** Facet value meaning "not set": filters with `is null`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { C as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { a as compilePostgrest, i as PostgrestPlan, n as PlanLimit, r as PlanOrder, t as PlanFilter } from "./postgrest-Bc-0Xw62.js";
|
|
1
|
+
import { A as Schema, C as PrimaryKeyColumn, D as RelationTypes, E as RelationMeta, F as TableMeta, I as UniqueConstraint, L as UniqueKeyName, M as Simplify, N as TableFlags, O as Relations, P as TableKey, R as UniqueWhere, S as PermdockTopicPolicy, T as RealtimeTableMeta, _ as Insert, a as BucketPolicyName, b as ModelsOf, c as ClaimsMeta, d as DatabaseOf, f as Flags, g as FunctionsOf, h as FunctionTypes, i as BucketMeta, j as SchemaMeta, k as Row, l as Codec, m as FunctionMeta, n as AnyFunctions, o as Casing, p as ForeignKeyConstraint, r as AnyModels, s as CheckConstraint, t as AccessBucketPolicy, u as ColumnMeta, v as ModelFlags, w as PrimaryKeyValue, x as PermdockBucketPolicy, y as ModelTypes, z as Update } from "./types-Dnf_wRDz.js";
|
|
2
|
+
import { $ as or, A as mapDbError, B as InsertOp, C as RawDbError, D as isConflict, E as isCheck, F as Condition, G as Quantifier, H as MutationOp, I as CountMode, J as Selection, K as SelectColumn, L as DeleteOp, M as AggregateFn, N as Aggregation, O as isDbError, P as ColumnOp, Q as not, R as FunctionSource, S as ErrorMapper, T as dbError, U as Operation, V as Measure, W as OrderTerm, X as and, Y as UpdateOp, Z as column, _ as DbError, a as AsyncResult, b as DbErrorOf, c as Err, f as err, g as toDbError, h as toBetterResult, i as RpcContext, j as statusOf, k as isForeignKey, l as Ok, m as ok, n as ExecuteResult, o as BetterResultApi, p as fromBetterResult, q as SelectOp, r as Executor, s as BetterResultValue, t as ExecuteContext, u as Result, v as DbErrorKind, w as ValidationIssue, x as DbException, y as DbErrorKinds, z as Include } from "./executor-BunPOO-k.js";
|
|
3
|
+
import { D as consoleLogger, E as Logger, O as silentLogger, T as LogFields, _ as KitEventType, a as EventHub, c as QueryEvent, i as EventHandler, l as RefreshEvent, m as KitEventMap, n as BetterSupabaseEvents, o as EventName, p as KitEvent, r as ErrorEvent, s as MutationNotice, t as AuthEvent, u as RpcNotice } from "./events-aIO7vsIk.js";
|
|
4
|
+
import { $ as Specs, A as RpcOptions, B as ReadSet, C as FindExt, Ct as WhereInput, D as Repository, E as PageOf, F as EMPTY_STATS, G as ReadSetParams, H as ReadSetParamType, I as StatsRecorder, J as isReadSet, K as ReadSetResult, L as recordStats, M as UpsertArgs, N as WriteArgs, O as RepositoryOf, P as DbStats, Q as ReadMethod, R as SearchArgs, S as DeleteExt, St as SortDirection, T as OffsetPageArgs, U as ReadSetParamTypes, V as ReadSetOptions, W as ReadSetParamValue, X as InferResult, Y as readSetTables, Z as QuerySpec, _ as CursorPage, _t as OrderByInput, a as defineSupabase, at as AggregateRow, b as DbHelpers, bt as RelationMeasureArg, c as postgrestExecutor, ct as FieldFilter, d as MemoryCache, dt as IncludeArg, et as TableSpecs, f as cacheTargetOf, ft as IncludeArgs, g as ConflictTarget, gt as OrderByArg, h as rpcCacheTargets, ht as NumericMeasureArg, i as SupabaseOptions, it as AggregateResult, j as UpdateArgs, k as Returned, l as CacheAdapter, lt as FindFirstArgs, m as rowKey, mt as MeasureKey, n as ConnectOptions, nt as specTables, o as PostgrestClientLike, ot as CountArg, p as memoryCache, pt as MeasureArg, q as defineReadSet, r as RpcDefinition, rt as AggregateArgs, s as explainPostgrest, st as CountArgs, t as BetterSupabase, tt as isQuerySpec, u as CacheTarget, ut as FindManyArgs, v as CursorPageArgs, vt as Payload, w as OffsetPage, x as DeleteArgs, xt as SelectArg, y as Db, yt as ReadArgs, z as InferReadSetParams } from "./define-Bp_BZa5h.js";
|
|
5
|
+
import { _ as WithExtension, a as ExtensionOf, c as MutationEvent, d as NoExtension, f as PLUGIN_API_VERSION, g as RequestContext, h as RepositoryExtension, i as CallOptions, l as MutationIntent, m as RepositoryApi, n as AnyPlugin, o as HasFlag, p as Plugin, r as ApplyExtension, s as HookArgs, t as Actor, u as MutationKind, v as definePlugin } from "./plugin-o144f322.js";
|
|
6
|
+
import { n as validate, t as StandardSchemaV1 } from "./standard-J4YgMOLm.js";
|
|
7
|
+
import { a as compilePostgrest, i as PostgrestPlan, n as PlanLimit, r as PlanOrder, t as PlanFilter } from "./postgrest-CruYKAvV.js";
|
|
9
8
|
import { n as StoragePath } from "./path-Cv__-OTj.js";
|
|
10
|
-
import { n as postgrestCompiler, t as Compiler } from "./compiler-
|
|
11
|
-
import { a as ProblemResponseOptions, c as problemResponse, i as ProblemOptions, l as toProblem, n as PROBLEM_TYPE_BASE, o as fromProblem, r as ProblemDetails, s as isProblem, t as PROBLEM_CONTENT_TYPE } from "./problem-
|
|
9
|
+
import { n as postgrestCompiler, t as Compiler } from "./compiler-BXH_aZ7N.js";
|
|
10
|
+
import { a as ProblemResponseOptions, c as problemResponse, i as ProblemOptions, l as toProblem, n as PROBLEM_TYPE_BASE, o as fromProblem, r as ProblemDetails, s as isProblem, t as PROBLEM_CONTENT_TYPE } from "./problem-Blxe8S31.js";
|
|
12
11
|
import { t as SPEC_PINS } from "./spec-pins-CqorWDnO.js";
|
|
13
12
|
//#region src/core/define-repository.d.ts
|
|
14
13
|
/** Adds `Methods` to the repository of `Table` only. */
|
|
@@ -43,6 +42,22 @@ export declare function touchedTables(op: Operation): string[];
|
|
|
43
42
|
*/
|
|
44
43
|
export declare function invalidationTargets(meta: SchemaMeta, table: string): readonly string[];
|
|
45
44
|
//#endregion
|
|
45
|
+
//#region src/core/policy.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* A callback that decides something a kit would otherwise allow or refuse
|
|
48
|
+
* by default: `authorize`, `canInvite`, `shouldDeliver`, `allowUrl`. Only
|
|
49
|
+
* `true` allows; `false`, any other value, a throw or a rejection denies.
|
|
50
|
+
*/
|
|
51
|
+
type Policy<A extends readonly unknown[]> = (...args: A) => boolean | PromiseLike<boolean>;
|
|
52
|
+
type PolicyDecision = {
|
|
53
|
+
readonly allowed: true;
|
|
54
|
+
} | {
|
|
55
|
+
readonly allowed: false;
|
|
56
|
+
/** `denied`: the policy returned something other than `true`. `threw`: it threw or rejected. */
|
|
57
|
+
readonly reason: "denied" | "threw";
|
|
58
|
+
readonly cause?: unknown;
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
46
61
|
//#region src/core/cursor.d.ts
|
|
47
62
|
/** Opaque, URL-safe keyset cursor. */
|
|
48
63
|
export declare function encodeCursor(values: readonly unknown[]): string;
|
|
@@ -71,11 +86,13 @@ type EnrichDatabase<D, O> = { [S in keyof D]: S extends keyof O ? EnrichSchema<D
|
|
|
71
86
|
export declare function escapeLike(value: string): string;
|
|
72
87
|
//#endregion
|
|
73
88
|
//#region src/ir/codec.d.ts
|
|
74
|
-
/** Wire form of an app value: Temporal values to ISO text, `bigint` to decimal text. */
|
|
75
|
-
export declare function encodeValue(value: unknown): unknown;
|
|
76
89
|
/** Applies column codecs to returned rows, including embedded relations. */
|
|
77
90
|
export declare function decodeRows(selection: Selection | undefined, rows: readonly Record<string, unknown>[], checked?: boolean): Record<string, unknown>[];
|
|
78
91
|
//#endregion
|
|
92
|
+
//#region src/ir/wire.d.ts
|
|
93
|
+
/** Wire form of an app value: Temporal values to ISO text, `bigint` to decimal text. */
|
|
94
|
+
export declare function encodeValue(value: unknown): unknown;
|
|
95
|
+
//#endregion
|
|
79
96
|
//#region src/ir/scope.d.ts
|
|
80
97
|
/** Returns the filter that always applies to rows of `table`, if any. */
|
|
81
98
|
type ScopeFor = (table: TableMeta) => Condition | undefined;
|
|
@@ -107,4 +124,4 @@ export declare function toCamel(name: string): string;
|
|
|
107
124
|
/** `firstName` to `first_name`. */
|
|
108
125
|
export declare function toSnake(name: string): string;
|
|
109
126
|
//#endregion
|
|
110
|
-
export { type Actor, type AggregateArgs, type AggregateFn, type AggregateResult, type AggregateRow, type Aggregation, type AnyFunctions, type AnyModels, type AnyPlugin, type ApplyExtension, AsyncResult, type AuthEvent, type BetterResultApi, type BetterResultValue, BetterSupabase, type BetterSupabaseEvents, type BucketMeta, type BucketPolicyName, type CacheAdapter, type CacheTarget, type CallOptions, type Casing, type CheckConstraint, type ClaimsMeta, type Codec, type ColumnMeta, type ColumnOp, type Compiler, type Condition, type ConflictTarget, type ConnectOptions, type CountArg, type CountArgs, type CountMode, type CursorPage, type CursorPageArgs, type DatabaseOf, type Db, type DbError, type DbErrorKind, type DbErrorKinds, type DbErrorOf, DbException, type DbHelpers, type DbStats, type DeleteArgs, type DeleteExt, type DeleteOp, EMPTY_STATS, type EnrichDatabase, type Err, type ErrorEvent, type ErrorMapper, type EventHandler, EventHub, type EventName, type ExecuteContext, type ExecuteResult, type Executor, type ExtensionOf, type FieldFilter, type FindExt, type FindFirstArgs, type FindManyArgs, type Flags, type ForeignKeyConstraint, type FunctionMeta, type FunctionSource, type FunctionTypes, type FunctionsOf, type HasFlag, type HookArgs, type Include, type IncludeArg, type IncludeArgs, type InferReadSetParams, type InferResult, type Insert, type InsertOp, type LogFields, type Logger, type Measure, type MeasureArg, type MeasureKey, type MemoryCache, type ModelFlags, type ModelTypes, type ModelsOf, type MutationEvent, type MutationKind, type MutationNotice, type MutationOp, type NoExtension, type NumericMeasureArg, type OffsetPage, type OffsetPageArgs, type Ok, type Operation, type OrderByArg, type OrderByInput, type OrderTerm, PLUGIN_API_VERSION, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, type PageOf, type Payload, type PermdockBucketPolicy, type PermdockTopicPolicy, type PlanFilter, type PlanLimit, type PlanOrder, type Plugin, type PostgrestClientLike, type PostgrestPlan, type PrimaryKeyColumn, type PrimaryKeyValue, type ProblemDetails, type ProblemOptions, type ProblemResponseOptions, type Quantifier, type QueryEvent, type QuerySpec, type RawDbError, type ReadArgs, type ReadMethod, type ReadSet, type ReadSetOptions, type ReadSetParamType, type ReadSetParamTypes, type ReadSetParamValue, type ReadSetParams, type ReadSetResult, type RealtimeTableMeta, type RefreshEvent, type RelationMeasureArg, type RelationMeta, type RelationTypes, type Relations, type Repository, type RepositoryApi, type RepositoryExtension, type RepositoryOf, type RequestContext, type Result, type Returned, type Row, type RpcContext, type RpcDefinition, type RpcNotice, type RpcOptions, SPEC_PINS, type Schema, type SchemaMeta, type ScopeFor, type SearchArgs, type SelectArg, type SelectColumn, type SelectOp, type Selection, type Simplify, type SortDirection, type Specs, type StandardSchemaV1, StatsRecorder, type StoragePath, type SupabaseOptions, type TableFlags, type TableKey, type TableMeta, type TableRepositoryExtension, type TableSpecs, type UniqueConstraint, type UniqueKeyName, type UniqueWhere, type Update, type UpdateArgs, type UpdateOp, type UpsertArgs, type ValidationIssue, type WhereInput, type WithExtension, type WriteArgs, and, cacheTargetOf, column, compilePostgrest, consoleLogger, dbError, definePlugin, defineReadSet, defineSupabase, err, explainPostgrest, fromBetterResult, fromProblem, isCheck, isConflict, isDbError, isForeignKey, isProblem, isQuerySpec, isReadSet, mapDbError, memoryCache, not, ok, or, postgrestCompiler, postgrestExecutor, problemResponse, readSetTables, recordStats, rowKey, rpcCacheTargets, silentLogger, specTables, statusOf, toBetterResult, toDbError, toProblem, validate };
|
|
127
|
+
export { type AccessBucketPolicy, type Actor, type AggregateArgs, type AggregateFn, type AggregateResult, type AggregateRow, type Aggregation, type AnyFunctions, type AnyModels, type AnyPlugin, type ApplyExtension, AsyncResult, type AuthEvent, type BetterResultApi, type BetterResultValue, BetterSupabase, type BetterSupabaseEvents, type BucketMeta, type BucketPolicyName, type CacheAdapter, type CacheTarget, type CallOptions, type Casing, type CheckConstraint, type ClaimsMeta, type Codec, type ColumnMeta, type ColumnOp, type Compiler, type Condition, type ConflictTarget, type ConnectOptions, type CountArg, type CountArgs, type CountMode, type CursorPage, type CursorPageArgs, type DatabaseOf, type Db, type DbError, type DbErrorKind, type DbErrorKinds, type DbErrorOf, DbException, type DbHelpers, type DbStats, type DeleteArgs, type DeleteExt, type DeleteOp, EMPTY_STATS, type EnrichDatabase, type Err, type ErrorEvent, type ErrorMapper, type EventHandler, EventHub, type EventName, type ExecuteContext, type ExecuteResult, type Executor, type ExtensionOf, type FieldFilter, type FindExt, type FindFirstArgs, type FindManyArgs, type Flags, type ForeignKeyConstraint, type FunctionMeta, type FunctionSource, type FunctionTypes, type FunctionsOf, type HasFlag, type HookArgs, type Include, type IncludeArg, type IncludeArgs, type InferReadSetParams, type InferResult, type Insert, type InsertOp, type KitEvent, type KitEventMap, type KitEventType, type LogFields, type Logger, type Measure, type MeasureArg, type MeasureKey, type MemoryCache, type ModelFlags, type ModelTypes, type ModelsOf, type MutationEvent, type MutationIntent, type MutationKind, type MutationNotice, type MutationOp, type NoExtension, type NumericMeasureArg, type OffsetPage, type OffsetPageArgs, type Ok, type Operation, type OrderByArg, type OrderByInput, type OrderTerm, PLUGIN_API_VERSION, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, type PageOf, type Payload, type PermdockBucketPolicy, type PermdockTopicPolicy, type PlanFilter, type PlanLimit, type PlanOrder, type Plugin, type Policy, type PolicyDecision, type PostgrestClientLike, type PostgrestPlan, type PrimaryKeyColumn, type PrimaryKeyValue, type ProblemDetails, type ProblemOptions, type ProblemResponseOptions, type Quantifier, type QueryEvent, type QuerySpec, type RawDbError, type ReadArgs, type ReadMethod, type ReadSet, type ReadSetOptions, type ReadSetParamType, type ReadSetParamTypes, type ReadSetParamValue, type ReadSetParams, type ReadSetResult, type RealtimeTableMeta, type RefreshEvent, type RelationMeasureArg, type RelationMeta, type RelationTypes, type Relations, type Repository, type RepositoryApi, type RepositoryExtension, type RepositoryOf, type RequestContext, type Result, type Returned, type Row, type RpcContext, type RpcDefinition, type RpcNotice, type RpcOptions, SPEC_PINS, type Schema, type SchemaMeta, type ScopeFor, type SearchArgs, type SelectArg, type SelectColumn, type SelectOp, type Selection, type Simplify, type SortDirection, type Specs, type StandardSchemaV1, StatsRecorder, type StoragePath, type SupabaseOptions, type TableFlags, type TableKey, type TableMeta, type TableRepositoryExtension, type TableSpecs, type UniqueConstraint, type UniqueKeyName, type UniqueWhere, type Update, type UpdateArgs, type UpdateOp, type UpsertArgs, type ValidationIssue, type WhereInput, type WithExtension, type WriteArgs, and, cacheTargetOf, column, compilePostgrest, consoleLogger, dbError, definePlugin, defineReadSet, defineSupabase, err, explainPostgrest, fromBetterResult, fromProblem, isCheck, isConflict, isDbError, isForeignKey, isProblem, isQuerySpec, isReadSet, mapDbError, memoryCache, not, ok, or, postgrestCompiler, postgrestExecutor, problemResponse, readSetTables, recordStats, rowKey, rpcCacheTargets, silentLogger, specTables, statusOf, toBetterResult, toDbError, toProblem, validate };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { a as isConflict, c as mapDbError, i as isCheck, l as statusOf, n as dbError, o as isDbError, s as isForeignKey, t as DbException } from "./errors-
|
|
2
|
-
import { i as escapeLike,
|
|
1
|
+
import { a as isConflict, c as mapDbError, i as isCheck, l as statusOf, n as dbError, o as isDbError, s as isForeignKey, t as DbException } from "./errors-DtwXa6b8.js";
|
|
2
|
+
import { i as escapeLike, o as defineSchema, s as tableMeta, t as simplify } from "./simplify-_0oUKqCd.js";
|
|
3
3
|
import { i as or, n as column, r as not, t as and } from "./types-6cYK9pbJ.js";
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
4
|
+
import { r as encodeValue } from "./wire-D2dT86vi.js";
|
|
5
|
+
import { a as toBetterResult, i as ok, n as err, o as toDbError, r as fromBetterResult, t as AsyncResult } from "./result-BKiliPY7.js";
|
|
6
|
+
import { a as decodeRows, c as memoryCache, i as encodeCursor, l as rowKey, n as defineSupabase, o as EventHub, r as decodeCursor, s as cacheTargetOf, t as BetterSupabase, u as rpcCacheTargets } from "./define-cNKzqwL_.js";
|
|
6
7
|
import { n as touchedTables, t as invalidationTargets } from "./tables-Cb-3_VWc.js";
|
|
7
8
|
import { n as silentLogger, t as consoleLogger } from "./logger-glM28NVN.js";
|
|
8
|
-
import {
|
|
9
|
-
import { a as postgrestExecutor, i as explainPostgrest, n as StatsRecorder, o as compilePostgrest, r as recordStats, t as EMPTY_STATS } from "./stats-
|
|
10
|
-
import { c as readSetTables, d as isQuerySpec, f as specTables, i as defineReadSet, o as isReadSet } from "./read-set-
|
|
11
|
-
import { t as validate } from "./standard-
|
|
12
|
-
import { a as problemResponse, i as isProblem, n as PROBLEM_TYPE_BASE, o as toProblem, r as fromProblem, t as PROBLEM_CONTENT_TYPE } from "./problem-
|
|
9
|
+
import { r as definePlugin, t as PLUGIN_API_VERSION } from "./plugin-DwARMuQp.js";
|
|
10
|
+
import { a as postgrestExecutor, i as explainPostgrest, n as StatsRecorder, o as compilePostgrest, r as recordStats, t as EMPTY_STATS } from "./stats-Bqob3WqT.js";
|
|
11
|
+
import { c as readSetTables, d as isQuerySpec, f as specTables, i as defineReadSet, o as isReadSet } from "./read-set-DQFt1N_Y.js";
|
|
12
|
+
import { t as validate } from "./standard-D7r6dMUu.js";
|
|
13
|
+
import { a as problemResponse, i as isProblem, n as PROBLEM_TYPE_BASE, o as toProblem, r as fromProblem, t as PROBLEM_CONTENT_TYPE } from "./problem-BW1KhzSG.js";
|
|
13
14
|
import { t as SPEC_PINS } from "./spec-pins-C3oc-Tdp.js";
|
|
14
15
|
import { n as scopeOperation, r as scopeSelection, t as scopeCondition } from "./scope-CDHcS7dE.js";
|
|
15
16
|
//#region src/core/define-repository.ts
|