better-supabase 0.30.0 → 0.31.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/dist/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/{app-tables-yyVncXEt.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
- package/dist/astro/index.js +2 -2
- package/dist/{authorization-CDU9tYA_.d.ts → authorization-DfEkyFt_.d.ts} +10 -3
- package/dist/{bind-p7asfI6H.d.ts → bind-DAx0bMSi.d.ts} +2 -2
- package/dist/{block-env-B8wG3xeh.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
- package/dist/blocks/ai-chat/index.d.ts +3 -3
- package/dist/blocks/announcements/index.d.ts +3 -3
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/attachments/index.d.ts +1 -1
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/automations/index.d.ts +1 -1
- package/dist/blocks/billing/index.d.ts +1 -1
- package/dist/blocks/bookings/index.d.ts +1 -1
- package/dist/blocks/calendar/index.d.ts +7 -3
- package/dist/blocks/calendar/index.js +5 -1
- package/dist/blocks/comments/index.d.ts +4 -4
- package/dist/blocks/employees/index.js +1 -4
- package/dist/blocks/entitlements/index.d.ts +2 -2
- package/dist/blocks/forms/index.d.ts +1 -1
- package/dist/blocks/inbox/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/messaging/index.d.ts +4 -4
- package/dist/blocks/mfa/index.d.ts +1 -1
- package/dist/blocks/notifications/index.d.ts +3 -3
- package/dist/blocks/notifications/index.js +5 -43
- package/dist/blocks/onboarding/index.d.ts +1 -1
- package/dist/blocks/organizations/index.d.ts +34 -21
- package/dist/blocks/organizations/index.js +5 -1
- package/dist/blocks/permissions/index.d.ts +32 -3
- package/dist/blocks/permissions/index.js +23 -2
- package/dist/blocks/push/index.d.ts +10 -2
- package/dist/blocks/push/index.js +23 -7
- package/dist/blocks/reactions/index.d.ts +3 -3
- package/dist/blocks/saved-views/index.d.ts +1 -1
- package/dist/blocks/search/index.d.ts +2 -2
- package/dist/blocks/sessions/index.d.ts +1 -1
- package/dist/blocks/settings/index.d.ts +1 -1
- package/dist/blocks/subjects/index.d.ts +1 -1
- package/dist/blocks/tags/index.d.ts +1 -1
- package/dist/blocks/tasks/index.js +1 -1
- package/dist/blocks/teams/index.d.ts +7 -1
- package/dist/blocks/teams/index.js +8 -7
- package/dist/blocks/undo/index.d.ts +1 -1
- package/dist/blocks/usage/index.d.ts +1 -1
- package/dist/blocks/workflow-editor/index.d.ts +3 -3
- package/dist/blocks/workflows/index.d.ts +3 -3
- package/dist/cli/{add-Dggyehsy.js → add-B9wP0YGU.js} +2 -2
- package/dist/cli/{add-D4w-Axib.js → add-DjZXKd7X.js} +10 -10
- package/dist/cli/add-ZcEOEK23.js +1 -0
- package/dist/cli/{app-table-files-CiGuwLkO.js → app-table-files-mtvjHa48.js} +2 -2
- package/dist/cli/{backfill-DjVjXW_P.js → backfill-Coshdvh_.js} +2 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-jRL9K1R8.js → blocks-BWCuA0nq.js} +2 -2
- package/dist/cli/{blocks-Bbmb6W_F.js → blocks-hiSazThw.js} +1 -1
- package/dist/cli/{cache-BuoIFlUJ.js → cache-x2wWAy0h.js} +1 -1
- package/dist/cli/{codemod-DRavXBCb.js → codemod-BnjV7BpC.js} +210 -11
- package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
- package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
- package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
- package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
- package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
- package/dist/cli/{content-mapper-BCtyfKXl.js → content-mapper-DvOSOdTE.js} +2 -2
- package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
- package/dist/cli/{doctor-Di2ZekfN.js → doctor-Ywy8oJEU.js} +41 -16
- package/dist/cli/env-CNjT_uOV.js +1 -0
- package/dist/cli/{env-B2CbnbzD.js → env-XMiKvhtV.js} +1 -1
- package/dist/cli/{gen-STKC9vkK.js → gen-B-FbQmG1.js} +14 -14
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-DW6_nIwj.js → init-fb9e1BKX.js} +9 -9
- package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
- package/dist/cli/{live-0G4Plw3K.js → live-DIt7TP-N.js} +2 -2
- package/dist/cli/{mcp-flKS8iU5.js → mcp-CVWwraga.js} +3 -3
- package/dist/cli/{metadata-VARUbXEe.js → metadata-CannIjel.js} +3 -3
- package/dist/cli/{migrate-Bkq07XcT.js → migrate-Ht2TzIQF.js} +2 -2
- package/dist/cli/{migration-safety-BfVeza5j.js → migration-safety-nNyB05I-.js} +1 -1
- package/dist/cli/{migrations-BCq7Zs2E.js → migrations-bAd7dpk1.js} +2 -2
- package/dist/cli/{module-migration-lbeUrsYv.js → module-migration-CkNux8dr.js} +2 -2
- package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
- package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
- package/dist/cli/{powersync-B15CfH5Y.js → powersync-B2v0tDwp.js} +100 -7
- package/dist/cli/powersync-D3mAQ6QE.js +1 -0
- package/dist/cli/{print-DjxpBRnv.js → print-CxQ0rBKT.js} +2 -2
- package/dist/cli/{providers-dyxcHQY3.js → providers-DtI90lSw.js} +1 -1
- package/dist/cli/{remove-BLq5gbal.js → remove-DYtE4IZ4.js} +6 -6
- package/dist/cli/{render-CizUf3RW.js → render-QGWfEoiB.js} +3 -3
- package/dist/cli/{run-ChEjR7yw.js → run-B5aMwErM.js} +2 -2
- package/dist/cli/{run-MwM__teL.js → run-BNoJKf5I.js} +40 -39
- package/dist/cli/{run-ChOY6s4o.js → run-DiYX1XEa.js} +8 -8
- package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
- package/dist/cli/seed-Cm-c0BDd.js +1 -0
- package/dist/cli/{shared-DV5wIv-7.js → shared-D_CFi5di.js} +1 -1
- package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
- package/dist/cli/{snapshot-B5LXkVMC.js → snapshot-BlQ4DDcJ.js} +9 -4
- package/dist/cli/{source-BoLNG_2A.js → source-CelMBQMj.js} +1 -1
- package/dist/cli/{spec-D6QeE2Zx.js → spec-BxcoGE0h.js} +1 -1
- package/dist/cli/{spec-Dz-PGCaM.js → spec-iBx1LcYO.js} +3 -3
- package/dist/cli/{sql-layout-zo02f3Dm.js → sql-layout-Dp4Rottt.js} +2 -2
- package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
- package/dist/cli/{sync-m-oZ_SyI.js → sync-BnORI43S.js} +4 -4
- package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
- package/dist/cli/{upgrade-C9sgVZ5z.js → upgrade-CR6-WmIc.js} +5 -5
- package/dist/cli/{upgrade-WwEJaX3i.js → upgrade-fz92aCnh.js} +3 -3
- package/dist/cli/{version-D2BQuqta.js → version-Dz8ZlOuh.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +4 -4
- package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
- package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
- package/dist/{context-nbYYjv7U.d.ts → context-DWWoP1wK.d.ts} +1 -1
- package/dist/{controller-TRocodqG.d.ts → controller-Br9dGKGe.d.ts} +1 -1
- package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +3 -3
- package/dist/create/lite/index.js +3 -3
- package/dist/delivery-events-DbL8IHIY.js +53 -0
- package/dist/edge/index.js +3 -3
- package/dist/{entitlements-B1i1-wfe.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
- package/dist/eve/index.js +1 -1
- package/dist/expo/index.js +3 -2
- package/dist/{field-errors-tJvehEFc.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
- package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/{index-BkzXwuIN.d.ts → index-Clyd2Goi.d.ts} +1 -1
- package/dist/{index-zsgNmE8m.d.ts → index-D98bQs8a.d.ts} +7 -7
- package/dist/{index-BKrxynq9.d.ts → index-DIdPoQtO.d.ts} +2 -2
- package/dist/{index-CWAQRWY8.d.ts → index-I8YLxKq8.d.ts} +2 -2
- package/dist/{index-8US7qlvW.d.ts → index-eRBuKtMt.d.ts} +2 -2
- package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
- package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/next/index.d.ts +73 -6
- package/dist/next/index.js +88 -35
- package/dist/{operations-CB9atU2e.d.ts → operations-hm1Isvvs.d.ts} +1 -1
- package/dist/{options-BKBy5wM_.js → options-CF6EVF_G.js} +2 -1
- package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
- package/dist/orpc/index.js +2 -1
- package/dist/otel/index.js +4 -4
- package/dist/{ports-hpbyMySO.d.ts → ports-DOrPTJzl.d.ts} +1 -1
- package/dist/powersync/index.d.ts +204 -4
- package/dist/powersync/index.js +361 -4
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
- package/dist/{project-B32wb5J6.js → project-DJ9Uo0sT.js} +5 -5
- package/dist/{push-token-DQ1ycFPU.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
- package/dist/react-router/index.js +2 -2
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
- package/dist/records/index.d.ts +5 -5
- package/dist/records/index.js +3 -3
- package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
- package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
- package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -4
- package/dist/{sign-in-Cyj3ZlFX.js → sign-in-CuZ1Ag7O.js} +17 -2
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.js +1 -1
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +3 -3
- package/dist/{sql-CyeDg3Yh.js → sql-DHp0L7zK.js} +404 -165
- package/dist/ssr/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-C9YE_kqK.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
- package/dist/testing/index.d.ts +13 -4
- package/dist/testing/index.js +17 -15
- package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
- package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
- package/dist/{topic-breZqx_4.d.ts → topic-BaUElNw2.d.ts} +1 -1
- package/dist/{types-C3I7S51U.d.ts → types-CMN0h_Ix.d.ts} +2 -2
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-ItO3dz8m.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
- package/dist/workflow-sdk/world/index.js +2 -2
- package/dist/{workflow-sdk-BWPsdzVK.js → workflow-sdk-DJJkP0dT.js} +12 -1
- package/dist/yjs/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +9 -1
- package/schemas/doctor-report-v1.json +1 -0
- package/skills/better-supabase/references/ui-recipes.md +524 -295
- package/skills/better-supabase-api/references/powersync.md +16 -0
- package/skills/better-supabase-auth/SKILL.md +4 -1
- package/dist/cli/add-BdhGOwkB.js +0 -1
- package/dist/cli/env-CynGCICL.js +0 -1
- package/dist/cli/powersync-DnBsDchT.js +0 -1
- package/dist/cli/seed-BOun22-k.js +0 -1
package/dist/powersync/index.js
CHANGED
|
@@ -394,7 +394,7 @@ function attachmentQueueRoute(repository, options = {}) {
|
|
|
394
394
|
}
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/powersync/notifications.ts
|
|
397
|
-
const FUNCTIONS = [
|
|
397
|
+
const FUNCTIONS$3 = [
|
|
398
398
|
"get_notification",
|
|
399
399
|
"list_notifications",
|
|
400
400
|
"notification_page",
|
|
@@ -442,7 +442,7 @@ function powersyncNotificationsTransport(database, options) {
|
|
|
442
442
|
const events = quoteSqliteIdent(options.tables?.events ?? "notification_events");
|
|
443
443
|
const tenant = options.tenantColumn ?? "organization_id";
|
|
444
444
|
const tenantColumn = quoteSqliteIdent(tenant);
|
|
445
|
-
const byName = new Map(FUNCTIONS.map((fn) => [options.functions?.[fn] ?? fn, fn]));
|
|
445
|
+
const byName = new Map(FUNCTIONS$3.map((fn) => [options.functions?.[fn] ?? fn, fn]));
|
|
446
446
|
const toItem = (recipient, event) => {
|
|
447
447
|
const fields = {};
|
|
448
448
|
for (const [key, value] of Object.entries(event)) if (!EVENT_COLUMNS.has(key) && key !== tenant) fields[key] = value;
|
|
@@ -593,7 +593,7 @@ function counts(all, args) {
|
|
|
593
593
|
*
|
|
594
594
|
* ```ts
|
|
595
595
|
* createUploadConnector({
|
|
596
|
-
*
|
|
596
|
+
* tables: {
|
|
597
597
|
* notification_recipients: notificationRecipientsRoute(
|
|
598
598
|
* serverNotifications,
|
|
599
599
|
* ),
|
|
@@ -673,4 +673,361 @@ function newestFirst(left, right) {
|
|
|
673
673
|
return String(right["id"]).localeCompare(String(left["id"]));
|
|
674
674
|
}
|
|
675
675
|
//#endregion
|
|
676
|
-
|
|
676
|
+
//#region src/powersync/memberships.ts
|
|
677
|
+
const FUNCTIONS$2 = ["list_my_organizations", "leave_organization"];
|
|
678
|
+
/**
|
|
679
|
+
* A block transport for the organizations block on PowerSync: the organization
|
|
680
|
+
* switcher's list (`organizations.mine()`) and leaving an organization run on
|
|
681
|
+
* the synced `memberships` and `organizations` tables, so the switcher works
|
|
682
|
+
* offline. A leave goes into PowerSync's upload queue, which `membershipsRoute`
|
|
683
|
+
* replays on the server. Every other function (switching, members, invitations)
|
|
684
|
+
* goes to `server`.
|
|
685
|
+
*
|
|
686
|
+
* ```ts
|
|
687
|
+
* const organizations = createOrganizations({
|
|
688
|
+
* transport: powersyncMembershipsTransport(powersync, {
|
|
689
|
+
* server: rpcTransport(supabase),
|
|
690
|
+
* }),
|
|
691
|
+
* });
|
|
692
|
+
* ```
|
|
693
|
+
*
|
|
694
|
+
* The synced memberships are the signed-in user's only (the `powersync streams`
|
|
695
|
+
* query filters by `auth.user_id()`). A row has its `role`; with
|
|
696
|
+
* `blocks.memberships.options.roles.many` the other roles and the
|
|
697
|
+
* organization's attribute columns come from the server.
|
|
698
|
+
*/
|
|
699
|
+
function powersyncMembershipsTransport(database, options) {
|
|
700
|
+
const memberships = quoteSqliteIdent(options.tables?.memberships ?? "memberships");
|
|
701
|
+
const organizations = quoteSqliteIdent(options.tables?.organizations ?? "organizations");
|
|
702
|
+
const tenant = quoteSqliteIdent(options.tenantColumn ?? "organization_id");
|
|
703
|
+
const byName = new Map(FUNCTIONS$2.map((fn) => [options.functions?.[fn] ?? fn, fn]));
|
|
704
|
+
const local = async (fn, args) => {
|
|
705
|
+
switch (fn) {
|
|
706
|
+
case "list_my_organizations": return (await database.getAll(`SELECT o.*, m.role AS role FROM ${memberships} m JOIN ${organizations} o ON o.id = m.${tenant}`)).filter((row) => (row["deleted_at"] ?? null) === null && (row["disabled_at"] ?? null) === null).map(({ deleted_at: _deleted, disabled_at: _disabled, ...row }) => row).toSorted((left, right) => String(left["name"]).localeCompare(String(right["name"])));
|
|
707
|
+
case "leave_organization":
|
|
708
|
+
await database.execute(`DELETE FROM ${memberships} WHERE ${tenant} = ?`, [args["organization"]]);
|
|
709
|
+
return null;
|
|
710
|
+
default: throw new TypeError(`Unhandled membership function ${String(fn)}`);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
return { call(schema, fn, args) {
|
|
714
|
+
const handled = byName.get(fn);
|
|
715
|
+
return handled === void 0 ? options.server.call(schema, fn, args) : local(handled, args);
|
|
716
|
+
} };
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* The two keys a synced row's `id` joins: `powersync streams` keys a row
|
|
720
|
+
* without an `id` column as `<first>:<second>`, such as
|
|
721
|
+
* `<organization>:<user>`.
|
|
722
|
+
*/
|
|
723
|
+
function compositeKey(id) {
|
|
724
|
+
const at = id.lastIndexOf(":");
|
|
725
|
+
return at <= 0 || at === id.length - 1 ? void 0 : [id.slice(0, at), id.slice(at + 1)];
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* The upload route for `memberships`: replays a local leave (a `DELETE`) with
|
|
729
|
+
* `leave` and a role change (a `PATCH` to `role`) with `updateMemberRole`,
|
|
730
|
+
* whose server functions check the caller may make them. A `PUT` is refused: a
|
|
731
|
+
* user joins through an invitation. Pass an organizations client on
|
|
732
|
+
* `rpcTransport(supabase)`; one on `powersyncMembershipsTransport` would write
|
|
733
|
+
* the change locally again.
|
|
734
|
+
*
|
|
735
|
+
* ```ts
|
|
736
|
+
* createUploadConnector({
|
|
737
|
+
* tables: { memberships: membershipsRoute(serverOrganizations) },
|
|
738
|
+
* });
|
|
739
|
+
* ```
|
|
740
|
+
*/
|
|
741
|
+
function membershipsRoute(organizations) {
|
|
742
|
+
return async (entry) => {
|
|
743
|
+
const key = compositeKey(entry.id);
|
|
744
|
+
if (key === void 0) return err(dbError("unsupported", `memberships row ${entry.id} is not keyed <organization>:<user>`));
|
|
745
|
+
const [organizationId, userId] = key;
|
|
746
|
+
switch (entry.op) {
|
|
747
|
+
case "DELETE": return organizations.leave(organizationId);
|
|
748
|
+
case "PATCH": {
|
|
749
|
+
const role = entry.opData?.["role"];
|
|
750
|
+
return typeof role === "string" ? organizations.updateMemberRole(organizationId, userId, role) : ok(null);
|
|
751
|
+
}
|
|
752
|
+
default: return err(dbError("unsupported", `memberships takes role changes and leaves only, not ${entry.op}`));
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/powersync/teams.ts
|
|
758
|
+
const FUNCTIONS$1 = [
|
|
759
|
+
"list_teams",
|
|
760
|
+
"update_team",
|
|
761
|
+
"archive_team",
|
|
762
|
+
"restore_team",
|
|
763
|
+
"add_team_member",
|
|
764
|
+
"remove_team_member"
|
|
765
|
+
];
|
|
766
|
+
/** `json_group_array` comes back as JSON text. */
|
|
767
|
+
function memberIdsOf(value) {
|
|
768
|
+
if (typeof value !== "string") return [];
|
|
769
|
+
try {
|
|
770
|
+
const parsed = JSON.parse(value);
|
|
771
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
772
|
+
} catch {
|
|
773
|
+
return [];
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
const isRow$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
777
|
+
/**
|
|
778
|
+
* A block transport for the teams block on PowerSync: listing teams, renaming,
|
|
779
|
+
* archiving and restoring them, and adding and removing members run on the
|
|
780
|
+
* synced `teams` and `team_members` tables, so they work offline. The writes go
|
|
781
|
+
* into PowerSync's upload queue, which `teamsRoute` and `teamMembersRoute`
|
|
782
|
+
* replay on the server. Creating and deleting a team go to `server`, which
|
|
783
|
+
* picks the id and slug and checks the permission.
|
|
784
|
+
*
|
|
785
|
+
* ```ts
|
|
786
|
+
* const teams = createTeams({
|
|
787
|
+
* transport: powersyncTeamsTransport(powersync, {
|
|
788
|
+
* server: rpcTransport(supabase),
|
|
789
|
+
* }),
|
|
790
|
+
* });
|
|
791
|
+
* ```
|
|
792
|
+
*
|
|
793
|
+
* The synced teams are the ones the signed-in user belongs to (the `powersync
|
|
794
|
+
* streams` query filters by `auth.user_id()`), so `list` offline returns those,
|
|
795
|
+
* not every team the user may read, and each team's `memberIds` holds only the
|
|
796
|
+
* synced member rows.
|
|
797
|
+
*/
|
|
798
|
+
function powersyncTeamsTransport(database, options) {
|
|
799
|
+
const teams = quoteSqliteIdent(options.tables?.teams ?? "teams");
|
|
800
|
+
const members = quoteSqliteIdent(options.tables?.members ?? "team_members");
|
|
801
|
+
const tenant = quoteSqliteIdent(options.tenantColumn ?? "tenant_id");
|
|
802
|
+
const byName = new Map(FUNCTIONS$1.map((fn) => [options.functions?.[fn] ?? fn, fn]));
|
|
803
|
+
const status = async (team, value) => {
|
|
804
|
+
await database.execute(`UPDATE ${teams} SET status = ?, updated_at = ? WHERE id = ?`, [
|
|
805
|
+
value,
|
|
806
|
+
(/* @__PURE__ */ new Date()).toISOString(),
|
|
807
|
+
team
|
|
808
|
+
]);
|
|
809
|
+
return true;
|
|
810
|
+
};
|
|
811
|
+
const local = async (fn, args) => {
|
|
812
|
+
switch (fn) {
|
|
813
|
+
case "list_teams": return (await database.getAll(`SELECT t.id, t.name, t.slug, t.description, t.status, (SELECT json_group_array(m.user_id) FROM ${members} m WHERE m.team_id = t.id) AS member_ids FROM ${teams} t WHERE t.${tenant} = ? ORDER BY t.name`, [args["tenant"]])).map((row) => ({
|
|
814
|
+
...row,
|
|
815
|
+
member_ids: memberIdsOf(row["member_ids"])
|
|
816
|
+
}));
|
|
817
|
+
case "update_team": {
|
|
818
|
+
const patch = isRow$1(args["patch"]) ? args["patch"] : {};
|
|
819
|
+
const sets = [];
|
|
820
|
+
const values = [];
|
|
821
|
+
const set = (column, value) => {
|
|
822
|
+
sets.push(`${quoteSqliteIdent(column)} = ?`);
|
|
823
|
+
values.push(value);
|
|
824
|
+
};
|
|
825
|
+
const name = patch["name"] ?? args["name"];
|
|
826
|
+
if (typeof name === "string") set("name", name);
|
|
827
|
+
if ("slug" in patch) set("slug", patch["slug"]);
|
|
828
|
+
if ("description" in patch) set("description", patch["description"]);
|
|
829
|
+
else if (typeof args["description"] === "string") set("description", args["description"]);
|
|
830
|
+
set("updated_at", (/* @__PURE__ */ new Date()).toISOString());
|
|
831
|
+
await database.execute(`UPDATE ${teams} SET ${sets.join(", ")} WHERE id = ?`, [...values, args["team"]]);
|
|
832
|
+
const [row] = await database.getAll(`SELECT id, name, slug, description, status FROM ${teams} WHERE id = ?`, [args["team"]]);
|
|
833
|
+
return row ?? { id: args["team"] };
|
|
834
|
+
}
|
|
835
|
+
case "archive_team": return status(args["team"], "archived");
|
|
836
|
+
case "restore_team": return status(args["team"], "active");
|
|
837
|
+
case "add_team_member": {
|
|
838
|
+
const [team] = await database.getAll(`SELECT ${tenant} AS tenant FROM ${teams} WHERE id = ?`, [args["team"]]);
|
|
839
|
+
await database.execute(`INSERT OR IGNORE INTO ${members} (id, team_id, user_id, ${tenant}, created_at) VALUES (?, ?, ?, ?, ?)`, [
|
|
840
|
+
`${String(args["team"])}:${String(args["member"])}`,
|
|
841
|
+
args["team"],
|
|
842
|
+
args["member"],
|
|
843
|
+
team?.["tenant"] ?? null,
|
|
844
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
845
|
+
]);
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
case "remove_team_member":
|
|
849
|
+
await database.execute(`DELETE FROM ${members} WHERE team_id = ? AND user_id = ?`, [args["team"], args["member"]]);
|
|
850
|
+
return true;
|
|
851
|
+
default: throw new TypeError(`Unhandled team function ${String(fn)}`);
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
return { call(schema, fn, args) {
|
|
855
|
+
const handled = byName.get(fn);
|
|
856
|
+
return handled === void 0 ? options.server.call(schema, fn, args) : local(handled, args);
|
|
857
|
+
} };
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* The upload route for `teams`: replays a local rename, slug or description
|
|
861
|
+
* change with `update`, a `status` change with `archive` or `restore`, and a
|
|
862
|
+
* `DELETE` with `delete`. A `PATCH` carries only the changed columns, so the
|
|
863
|
+
* route reads the team's current name from `database` when the name stayed. A
|
|
864
|
+
* `PUT` is refused: create teams on the server.
|
|
865
|
+
*
|
|
866
|
+
* ```ts
|
|
867
|
+
* createUploadConnector({
|
|
868
|
+
* tables: {
|
|
869
|
+
* teams: teamsRoute(serverTeams, powersync),
|
|
870
|
+
* team_members: teamMembersRoute(serverTeams),
|
|
871
|
+
* },
|
|
872
|
+
* });
|
|
873
|
+
* ```
|
|
874
|
+
*/
|
|
875
|
+
function teamsRoute(teams, database, table = "teams") {
|
|
876
|
+
return async (entry) => {
|
|
877
|
+
switch (entry.op) {
|
|
878
|
+
case "DELETE": return teams.delete(entry.id);
|
|
879
|
+
case "PATCH": {
|
|
880
|
+
const data = entry.opData ?? {};
|
|
881
|
+
if (data["status"] === "archived" || data["status"] === "active") {
|
|
882
|
+
const changed = data["status"] === "archived" ? await teams.archive(entry.id) : await teams.restore(entry.id);
|
|
883
|
+
if (!changed.ok) return changed;
|
|
884
|
+
}
|
|
885
|
+
if ([
|
|
886
|
+
"name",
|
|
887
|
+
"slug",
|
|
888
|
+
"description"
|
|
889
|
+
].filter((column) => data[column] !== void 0).length === 0) return ok(null);
|
|
890
|
+
const name = typeof data["name"] === "string" ? data["name"] : (await database.getAll(`SELECT name FROM ${quoteSqliteIdent(table)} WHERE id = ?`, [entry.id]))[0]?.name;
|
|
891
|
+
if (typeof name !== "string") return err(dbError("not_found", `team ${entry.id} is not in the local database`));
|
|
892
|
+
return teams.update(entry.id, name, void 0, void 0, {
|
|
893
|
+
...typeof data["slug"] === "string" ? { slug: data["slug"] } : {},
|
|
894
|
+
...data["description"] === void 0 ? {} : { description: typeof data["description"] === "string" ? data["description"] : null }
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
default: return err(dbError("unsupported", `teams takes updates and deletes only, not ${entry.op}; create teams on the server`));
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* The upload route for `team_members`: replays a local add (a `PUT`) with
|
|
903
|
+
* `addMember` and a removal (a `DELETE`) with `removeMember`. `powersync
|
|
904
|
+
* streams` keys a row as `<team>:<user>`.
|
|
905
|
+
*/
|
|
906
|
+
function teamMembersRoute(teams) {
|
|
907
|
+
return async (entry) => {
|
|
908
|
+
const key = compositeKey(entry.id);
|
|
909
|
+
if (key === void 0) return err(dbError("unsupported", `team_members row ${entry.id} is not keyed <team>:<user>`));
|
|
910
|
+
const [teamId, userId] = key;
|
|
911
|
+
switch (entry.op) {
|
|
912
|
+
case "PUT": return teams.addMember(teamId, userId);
|
|
913
|
+
case "DELETE": return teams.removeMember(teamId, userId);
|
|
914
|
+
default: return ok(null);
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region src/powersync/profiles.ts
|
|
920
|
+
const FUNCTIONS = ["my_profile", "update_my_profile"];
|
|
921
|
+
/**
|
|
922
|
+
* Columns a user can't set on their own profile: the key, the email from Auth,
|
|
923
|
+
* the active organization and team (set by switching) and the stamps.
|
|
924
|
+
*/
|
|
925
|
+
const PROTECTED = /* @__PURE__ */ new Set([
|
|
926
|
+
"id",
|
|
927
|
+
"email",
|
|
928
|
+
"active_organization_id",
|
|
929
|
+
"active_team_id",
|
|
930
|
+
"disabled_at",
|
|
931
|
+
"created_at",
|
|
932
|
+
"updated_at"
|
|
933
|
+
]);
|
|
934
|
+
const JSON_COLUMNS = /* @__PURE__ */ new Set(["onboarding"]);
|
|
935
|
+
const TIMESTAMP_COLUMNS = /* @__PURE__ */ new Set([
|
|
936
|
+
"disabled_at",
|
|
937
|
+
"created_at",
|
|
938
|
+
"updated_at"
|
|
939
|
+
]);
|
|
940
|
+
const isRow = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
941
|
+
/**
|
|
942
|
+
* A block transport for the profiles block on PowerSync: `profiles.mine()` and
|
|
943
|
+
* `profiles.updateMine()` run on the synced `profiles` row, so the user's
|
|
944
|
+
* profile reads and edits work offline. An edit goes into PowerSync's upload
|
|
945
|
+
* queue, which `profilesRoute` replays on the server.
|
|
946
|
+
*
|
|
947
|
+
* ```ts
|
|
948
|
+
* const profiles = createProfiles({
|
|
949
|
+
* transport: powersyncProfilesTransport(powersync, {
|
|
950
|
+
* server: rpcTransport(supabase),
|
|
951
|
+
* }),
|
|
952
|
+
* });
|
|
953
|
+
* ```
|
|
954
|
+
*
|
|
955
|
+
* The synced row is the signed-in user's only (the `powersync streams` query
|
|
956
|
+
* filters by `auth.user_id()`). `updateMine` writes the columns the local row
|
|
957
|
+
* has, except the ones only the server sets (`email`, the active organization
|
|
958
|
+
* and team, and the stamps).
|
|
959
|
+
*/
|
|
960
|
+
function powersyncProfilesTransport(database, options) {
|
|
961
|
+
const table = quoteSqliteIdent(options.table ?? "profiles");
|
|
962
|
+
const byName = new Map(FUNCTIONS.map((fn) => [options.functions?.[fn] ?? fn, fn]));
|
|
963
|
+
const mine = async () => (await database.getAll(`SELECT * FROM ${table} LIMIT 1`))[0];
|
|
964
|
+
const local = async (fn, args) => {
|
|
965
|
+
switch (fn) {
|
|
966
|
+
case "my_profile": {
|
|
967
|
+
const row = await mine();
|
|
968
|
+
return row === void 0 ? null : fromSqlite(row);
|
|
969
|
+
}
|
|
970
|
+
case "update_my_profile": {
|
|
971
|
+
const row = await mine();
|
|
972
|
+
const attrs = isRow(args["attrs"]) ? args["attrs"] : {};
|
|
973
|
+
if (row === void 0) return false;
|
|
974
|
+
const columns = Object.keys(attrs).filter((column) => column in row && !PROTECTED.has(column));
|
|
975
|
+
if (columns.length === 0) return true;
|
|
976
|
+
const stamped = "updated_at" in row;
|
|
977
|
+
await database.execute(`UPDATE ${table} SET ${[...columns, ...stamped ? ["updated_at"] : []].map((column) => `${quoteSqliteIdent(column)} = ?`).join(", ")} WHERE id = ?`, [
|
|
978
|
+
...columns.map((column) => toSqlite(column, attrs[column])),
|
|
979
|
+
...stamped ? [(/* @__PURE__ */ new Date()).toISOString()] : [],
|
|
980
|
+
row["id"]
|
|
981
|
+
]);
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
default: throw new TypeError(`Unhandled profile function ${String(fn)}`);
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
return { call(schema, fn, args) {
|
|
988
|
+
const handled = byName.get(fn);
|
|
989
|
+
return handled === void 0 ? options.server.call(schema, fn, args) : local(handled, args);
|
|
990
|
+
} };
|
|
991
|
+
}
|
|
992
|
+
function fromSqlite(row) {
|
|
993
|
+
return Object.fromEntries(Object.entries(row).map(([column, value]) => {
|
|
994
|
+
if (typeof value !== "string") return [column, value];
|
|
995
|
+
if (JSON_COLUMNS.has(column)) try {
|
|
996
|
+
return [column, JSON.parse(value)];
|
|
997
|
+
} catch {
|
|
998
|
+
return [column, value];
|
|
999
|
+
}
|
|
1000
|
+
return [column, TIMESTAMP_COLUMNS.has(column) ? postgrestTimestamp(value) : value];
|
|
1001
|
+
}));
|
|
1002
|
+
}
|
|
1003
|
+
function toSqlite(column, value) {
|
|
1004
|
+
return JSON_COLUMNS.has(column) && value !== null && value !== void 0 ? JSON.stringify(value) : value ?? null;
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* The upload route for `profiles`: replays a local edit (a `PATCH`) with
|
|
1008
|
+
* `updateMine`, which writes only the columns the profiles block lets a user
|
|
1009
|
+
* change. A `PUT` or `DELETE` is refused: the server creates and removes
|
|
1010
|
+
* profiles with the user.
|
|
1011
|
+
*
|
|
1012
|
+
* ```ts
|
|
1013
|
+
* createUploadConnector({
|
|
1014
|
+
* tables: { profiles: profilesRoute(serverProfiles) },
|
|
1015
|
+
* });
|
|
1016
|
+
* ```
|
|
1017
|
+
*/
|
|
1018
|
+
function profilesRoute(profiles) {
|
|
1019
|
+
return async (entry) => {
|
|
1020
|
+
if (entry.op !== "PATCH") return err(dbError("unsupported", `profiles takes updates only, not ${entry.op}`));
|
|
1021
|
+
const attrs = Object.fromEntries(Object.entries(entry.opData ?? {}).filter(([column]) => !PROTECTED.has(column)).map(([column, value]) => [column, JSON_COLUMNS.has(column) && typeof value === "string" ? parsed(value) : value]));
|
|
1022
|
+
return Object.keys(attrs).length === 0 ? ok(null) : profiles.updateMine(attrs);
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
function parsed(value) {
|
|
1026
|
+
try {
|
|
1027
|
+
return JSON.parse(value);
|
|
1028
|
+
} catch {
|
|
1029
|
+
return value;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
//#endregion
|
|
1033
|
+
export { attachmentQueueRoute, checkSqlite, compileSqlite, createUploadConnector, fromSqliteError, likeToGlob, membershipsRoute, notificationRecipientsRoute, postgrestTimestamp, powersyncEngine, powersyncExecutor, powersyncMembershipsTransport, powersyncNotificationsTransport, powersyncProfilesTransport, powersyncTeamsTransport, powersyncTopicPort, profilesRoute, quoteSqliteIdent, sqliteCompiler, sqliteValue, syncWithAuth, teamMembersRoute, teamsRoute, uploadOutcome, uploadRoute };
|
package/dist/preset/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as PresetGroup, Ai as PresetValueInfo, At as PresetConflict, Ci as PresetConventions, Ct as ConfigConventions, Di as PresetFramework, Dt as expandPreset, Ei as PresetFieldValue, Et as conventionConfig, Ft as presetBlockConflict, Gn as presetFromSpec, It as resolvePreset, Jn as DEFAULT_PRESET_NAME, Kn as presetOfSpec, Mi as presetField, Mt as ResolvedPreset, Ni as presetValueLabel, Nt as ResolvedPresetBlock, Oi as PresetPlatforms, Ot as presetConfig, Pt as listNames, Qn as PRESET_NAMES, Si as PresetAccess, Ti as PresetFieldKey, Tt as PresetInput, Wn as PresetSpec, Xn as PRESETS, Yn as NamedPreset, Zn as PRESET_GROUPS, _i as CONVENTION_FIELDS, _r as AppColumnFormat, bi as PRESET_TENANT_NAMES, di as INSTANCE_NAME, er as PresetName, fi as instancePrefix, gi as PresetGlueItem, hi as PresetCatalogManifest, ji as integrationsForFramework, jt as PresetIntegration, ki as PresetScope, kt as presetOf, mi as PresetCatalogBlock, nr as isPresetName, pi as PresetCatalog, qn as presetSpec, rr as namedPreset, tr as defaultPreset, ui as CORE_BLOCKS, ur as APP_COLUMN_FORMATS, vi as DEFAULT_CONVENTIONS, wi as PresetField, wt as ExpandedConfig, xi as Preset, yi as PRESET_FRAMEWORKS } from "../context-
|
|
2
|
-
import { $ as readDesignFile, A as DesignFile, B as designFileSource, C as diffAppTables, D as DESIGN_FILE, E as CreateDesign, F as MAX_DESIGN_CODE_LENGTH, G as isDesignCode, H as designOf, I as createQuery, J as presetApplyCommand, K as parseDesign, L as createUrl, M as DesignParseIssue, N as DesignParseResult, O as DESIGN_FORMAT, P as DesignTooLongError, Q as presetKey, R as decodeDesign, S as DiffOptions, T as CREATE_URL, U as designSchema, V as designFormat, W as encodeDesign, X as presetConfigSource, Y as presetArgumentOf, Z as presetInstallCommand, _ as glueCommand, a as blockRequires, b as DesignChange, c as installedBlocks, d as instancesOf, et as safeDesignFileSource, f as presetInstances, g as PROVIDER_COMMENT, h as withoutInstance, i as blockEntities, it as PRESET_CATALOG, j as DesignParseError, k as DesignErrorCode, l as instanceBlock, m as withInstance, n as BlockInstance, nt as appDefaultError, o as canAddInstance, p as withEntityName, q as presetAndDesignOf, r as PresetInstance, rt as isAppDefault, s as entityName, t as BlockEntity, tt as safeParseDesign, u as instanceNameProblem, v as presetBlocksSource, w as diffDesigns, x as DesignChangeKind, y as presetGlue, z as designConfig } from "../index-
|
|
3
|
-
import { i as appReservedColumns, n as appIdentifierError, r as appNameLengthError, t as APP_NAME_MAX } from "../app-tables-
|
|
1
|
+
import { $n as PresetGroup, Ai as PresetValueInfo, At as PresetConflict, Ci as PresetConventions, Ct as ConfigConventions, Di as PresetFramework, Dt as expandPreset, Ei as PresetFieldValue, Et as conventionConfig, Ft as presetBlockConflict, Gn as presetFromSpec, It as resolvePreset, Jn as DEFAULT_PRESET_NAME, Kn as presetOfSpec, Mi as presetField, Mt as ResolvedPreset, Ni as presetValueLabel, Nt as ResolvedPresetBlock, Oi as PresetPlatforms, Ot as presetConfig, Pt as listNames, Qn as PRESET_NAMES, Si as PresetAccess, Ti as PresetFieldKey, Tt as PresetInput, Wn as PresetSpec, Xn as PRESETS, Yn as NamedPreset, Zn as PRESET_GROUPS, _i as CONVENTION_FIELDS, _r as AppColumnFormat, bi as PRESET_TENANT_NAMES, di as INSTANCE_NAME, er as PresetName, fi as instancePrefix, gi as PresetGlueItem, hi as PresetCatalogManifest, ji as integrationsForFramework, jt as PresetIntegration, ki as PresetScope, kt as presetOf, mi as PresetCatalogBlock, nr as isPresetName, pi as PresetCatalog, qn as presetSpec, rr as namedPreset, tr as defaultPreset, ui as CORE_BLOCKS, ur as APP_COLUMN_FORMATS, vi as DEFAULT_CONVENTIONS, wi as PresetField, wt as ExpandedConfig, xi as Preset, yi as PRESET_FRAMEWORKS } from "../context-DWWoP1wK.js";
|
|
2
|
+
import { $ as readDesignFile, A as DesignFile, B as designFileSource, C as diffAppTables, D as DESIGN_FILE, E as CreateDesign, F as MAX_DESIGN_CODE_LENGTH, G as isDesignCode, H as designOf, I as createQuery, J as presetApplyCommand, K as parseDesign, L as createUrl, M as DesignParseIssue, N as DesignParseResult, O as DESIGN_FORMAT, P as DesignTooLongError, Q as presetKey, R as decodeDesign, S as DiffOptions, T as CREATE_URL, U as designSchema, V as designFormat, W as encodeDesign, X as presetConfigSource, Y as presetArgumentOf, Z as presetInstallCommand, _ as glueCommand, a as blockRequires, b as DesignChange, c as installedBlocks, d as instancesOf, et as safeDesignFileSource, f as presetInstances, g as PROVIDER_COMMENT, h as withoutInstance, i as blockEntities, it as PRESET_CATALOG, j as DesignParseError, k as DesignErrorCode, l as instanceBlock, m as withInstance, n as BlockInstance, nt as appDefaultError, o as canAddInstance, p as withEntityName, q as presetAndDesignOf, r as PresetInstance, rt as isAppDefault, s as entityName, t as BlockEntity, tt as safeParseDesign, u as instanceNameProblem, v as presetBlocksSource, w as diffDesigns, x as DesignChangeKind, y as presetGlue, z as designConfig } from "../index-Clyd2Goi.js";
|
|
3
|
+
import { i as appReservedColumns, n as appIdentifierError, r as appNameLengthError, t as APP_NAME_MAX } from "../app-tables-B2mKMNRQ.js";
|
|
4
4
|
export { APP_COLUMN_FORMATS, APP_NAME_MAX, type AppColumnFormat, type BlockEntity, type BlockInstance, CONVENTION_FIELDS, CREATE_URL, type ConfigConventions, type CreateDesign, DEFAULT_CONVENTIONS, DEFAULT_PRESET_NAME, DESIGN_FILE, DESIGN_FORMAT, type DesignChange, type DesignChangeKind, type DesignErrorCode, type DesignFile, DesignParseError, type DesignParseIssue, type DesignParseResult, DesignTooLongError, type DiffOptions, type ExpandedConfig, INSTANCE_NAME, MAX_DESIGN_CODE_LENGTH, type NamedPreset, PRESETS, PRESET_CATALOG, PRESET_FRAMEWORKS, PRESET_GROUPS, PRESET_NAMES, PRESET_TENANT_NAMES, PROVIDER_COMMENT, type Preset, type PresetAccess, type PresetCatalog, type PresetCatalogBlock, type PresetCatalogManifest, type PresetConflict, type PresetConventions, type PresetField, type PresetFieldKey, type PresetFieldValue, type PresetFramework, type PresetGlueItem, type PresetGroup, type PresetInput, type PresetInstance, type PresetIntegration, type PresetName, type PresetPlatforms, type PresetScope, type PresetSpec, type PresetValueInfo, type ResolvedPreset, type ResolvedPresetBlock, CORE_BLOCKS as SINGLE_INSTANCE_BLOCKS, appDefaultError, appIdentifierError, appNameLengthError, appReservedColumns, blockEntities, blockRequires, canAddInstance, conventionConfig, createQuery, createUrl, decodeDesign, defaultPreset, designConfig, designFileSource, designFormat, designOf, designSchema, diffAppTables, diffDesigns, encodeDesign, entityName, expandPreset, glueCommand, installedBlocks, instanceBlock, instanceNameProblem, instancePrefix, instancesOf, integrationsForFramework, isAppDefault, isDesignCode, isPresetName, listNames, namedPreset, parseDesign, presetAndDesignOf, presetApplyCommand, presetArgumentOf, presetBlockConflict, presetBlocksSource, presetConfig, presetConfigSource, presetField, presetFromSpec, presetGlue, presetInstallCommand, presetInstances, presetKey, presetOf, presetOfSpec, presetSpec, presetValueLabel, readDesignFile, resolvePreset, safeDesignFileSource, safeParseDesign, withEntityName, withInstance, withoutInstance };
|
package/dist/preset/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as integrationsForFramework, S as PRESET_TENANT_NAMES, T as presetValueLabel, _ as isPresetName, a as presetOf, b as DEFAULT_CONVENTIONS, c as presetSpec, d as resolvePreset, f as DEFAULT_PRESET_NAME, g as defaultPreset, h as PRESET_NAMES, i as presetConfig, l as listNames, m as PRESET_GROUPS, o as presetFromSpec, p as PRESETS, r as expandPreset, s as presetOfSpec, t as conventionConfig, u as presetBlockConflict, v as namedPreset, w as presetField, x as PRESET_FRAMEWORKS, y as CONVENTION_FIELDS } from "../config-
|
|
2
|
-
import { D as APP_COLUMN_FORMATS, M as PRESET_CATALOG, b as isAppDefault, c as APP_NAME_MAX, d as appIdentifierError, f as appNameLengthError, i as instancePrefix, n as INSTANCE_NAME, p as appReservedColumns, t as CORE_BLOCKS, y as appDefaultError } from "../instances-
|
|
3
|
-
import { A as isDesignCode, B as safeDesignFileSource, C as decodeDesign, D as designOf, E as designFormat, F as presetArgumentOf, G as presetGlue, H as PROVIDER_COMMENT, I as presetConfigSource, L as presetInstallCommand, M as parseDesign, N as presetAndDesignOf, O as designSchema, P as presetApplyCommand, R as presetKey, S as createUrl, T as designFileSource, U as glueCommand, V as safeParseDesign, W as presetBlocksSource, _ as DESIGN_FORMAT, a as installedBlocks, b as MAX_DESIGN_CODE_LENGTH, c as instancesOf, d as withInstance, f as withoutInstance, g as DESIGN_FILE, h as CREATE_URL, i as entityName, k as encodeDesign, l as presetInstances, m as diffDesigns, n as blockRequires, o as instanceBlock, p as diffAppTables, r as canAddInstance, s as instanceNameProblem, t as blockEntities, u as withEntityName, v as DesignParseError, w as designConfig, x as createQuery, y as DesignTooLongError, z as readDesignFile } from "../preset-
|
|
1
|
+
import { C as integrationsForFramework, S as PRESET_TENANT_NAMES, T as presetValueLabel, _ as isPresetName, a as presetOf, b as DEFAULT_CONVENTIONS, c as presetSpec, d as resolvePreset, f as DEFAULT_PRESET_NAME, g as defaultPreset, h as PRESET_NAMES, i as presetConfig, l as listNames, m as PRESET_GROUPS, o as presetFromSpec, p as PRESETS, r as expandPreset, s as presetOfSpec, t as conventionConfig, u as presetBlockConflict, v as namedPreset, w as presetField, x as PRESET_FRAMEWORKS, y as CONVENTION_FIELDS } from "../config-R0m0fBiD.js";
|
|
2
|
+
import { D as APP_COLUMN_FORMATS, M as PRESET_CATALOG, b as isAppDefault, c as APP_NAME_MAX, d as appIdentifierError, f as appNameLengthError, i as instancePrefix, n as INSTANCE_NAME, p as appReservedColumns, t as CORE_BLOCKS, y as appDefaultError } from "../instances-DY_ORk5g.js";
|
|
3
|
+
import { A as isDesignCode, B as safeDesignFileSource, C as decodeDesign, D as designOf, E as designFormat, F as presetArgumentOf, G as presetGlue, H as PROVIDER_COMMENT, I as presetConfigSource, L as presetInstallCommand, M as parseDesign, N as presetAndDesignOf, O as designSchema, P as presetApplyCommand, R as presetKey, S as createUrl, T as designFileSource, U as glueCommand, V as safeParseDesign, W as presetBlocksSource, _ as DESIGN_FORMAT, a as installedBlocks, b as MAX_DESIGN_CODE_LENGTH, c as instancesOf, d as withInstance, f as withoutInstance, g as DESIGN_FILE, h as CREATE_URL, i as entityName, k as encodeDesign, l as presetInstances, m as diffDesigns, n as blockRequires, o as instanceBlock, p as diffAppTables, r as canAddInstance, s as instanceNameProblem, t as blockEntities, u as withEntityName, v as DesignParseError, w as designConfig, x as createQuery, y as DesignTooLongError, z as readDesignFile } from "../preset-CXhpPmPV.js";
|
|
4
4
|
export { APP_COLUMN_FORMATS, APP_NAME_MAX, CONVENTION_FIELDS, CREATE_URL, DEFAULT_CONVENTIONS, DEFAULT_PRESET_NAME, DESIGN_FILE, DESIGN_FORMAT, DesignParseError, DesignTooLongError, INSTANCE_NAME, MAX_DESIGN_CODE_LENGTH, PRESETS, PRESET_CATALOG, PRESET_FRAMEWORKS, PRESET_GROUPS, PRESET_NAMES, PRESET_TENANT_NAMES, PROVIDER_COMMENT, CORE_BLOCKS as SINGLE_INSTANCE_BLOCKS, appDefaultError, appIdentifierError, appNameLengthError, appReservedColumns, blockEntities, blockRequires, canAddInstance, conventionConfig, createQuery, createUrl, decodeDesign, defaultPreset, designConfig, designFileSource, designFormat, designOf, designSchema, diffAppTables, diffDesigns, encodeDesign, entityName, expandPreset, glueCommand, installedBlocks, instanceBlock, instanceNameProblem, instancePrefix, instancesOf, integrationsForFramework, isAppDefault, isDesignCode, isPresetName, listNames, namedPreset, parseDesign, presetAndDesignOf, presetApplyCommand, presetArgumentOf, presetBlockConflict, presetBlocksSource, presetConfig, presetConfigSource, presetField, presetFromSpec, presetGlue, presetInstallCommand, presetInstances, presetKey, presetOf, presetOfSpec, presetSpec, presetValueLabel, readDesignFile, resolvePreset, safeDesignFileSource, safeParseDesign, withEntityName, withInstance, withoutInstance };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as groupEntries, a as presetOf, c as presetSpec, d as resolvePreset, g as defaultPreset, i as presetConfig, s as presetOfSpec } from "./config-
|
|
2
|
-
import { F as asBlocksConfig, M as PRESET_CATALOG, _ as appTablesOf, n as INSTANCE_NAME, t as CORE_BLOCKS } from "./instances-
|
|
1
|
+
import { M as groupEntries, a as presetOf, c as presetSpec, d as resolvePreset, g as defaultPreset, i as presetConfig, s as presetOfSpec } from "./config-R0m0fBiD.js";
|
|
2
|
+
import { F as asBlocksConfig, M as PRESET_CATALOG, _ as appTablesOf, n as INSTANCE_NAME, t as CORE_BLOCKS } from "./instances-DY_ORk5g.js";
|
|
3
3
|
import { r as FIELD_FORMATS } from "./field-formats-C6QKA3UR.js";
|
|
4
4
|
import { t as isSqlType } from "./sql-type-iUSZpaUu.js";
|
|
5
5
|
//#region src/preset/render.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as presetOf, d as resolvePreset } from "./config-
|
|
2
|
-
import { M as PRESET_CATALOG, b as isAppDefault, d as appIdentifierError, f as appNameLengthError, p as appReservedColumns, y as appDefaultError } from "./instances-
|
|
3
|
-
import { c as resolveConfig } from "./config-
|
|
4
|
-
import { D as designOf, M as parseDesign, j as jsonPointer, k as encodeDesign, v as DesignParseError, w as designConfig, y as DesignTooLongError } from "./preset-
|
|
5
|
-
import { F as renderBlocks, S as moduleLayout, nt as SQL_MODULES } from "./sql-
|
|
1
|
+
import { a as presetOf, d as resolvePreset } from "./config-R0m0fBiD.js";
|
|
2
|
+
import { M as PRESET_CATALOG, b as isAppDefault, d as appIdentifierError, f as appNameLengthError, p as appReservedColumns, y as appDefaultError } from "./instances-DY_ORk5g.js";
|
|
3
|
+
import { c as resolveConfig } from "./config-B7g-HDis.js";
|
|
4
|
+
import { D as designOf, M as parseDesign, j as jsonPointer, k as encodeDesign, v as DesignParseError, w as designConfig, y as DesignTooLongError } from "./preset-CXhpPmPV.js";
|
|
5
|
+
import { F as renderBlocks, S as moduleLayout, nt as SQL_MODULES } from "./sql-DHp0L7zK.js";
|
|
6
6
|
//#region src/create/column-keys.ts
|
|
7
7
|
/** The most options a select takes, and the longest option. */
|
|
8
8
|
const MAX_OPTIONS = 100;
|
package/dist/query/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as escapeLike } from "../escape-like-PReMbEEU.js";
|
|
2
2
|
import { n as invalidateTables, t as BetterQueryMeta } from "../invalidate-DMp4eqfF.js";
|
|
3
|
-
import { $ as invalidateOnBlockEvents, G as BLOCK_READ_PREFIXES, J as BlockInvalidation, K as BlockClientQueries, Q as blockQueries, X as BlockQueries, Y as BlockMethodQuery, Z as BlockVariablesOf, a as RecordBindingQueries, at as InfiniteOptionsOf, c as RecordWriteMutations, ct as QueryHelpers, dt as TableQueries, et as queryEngine, ft as createQueries, i as optimistic, it as InfiniteExtras, l as invalidateOnRecordEvents, lt as QueryKeyOf, mt as queryCache, n as OptimisticSnapshot, nt as clearOnUserChange, o as RecordQueries, ot as MutationOptionsOf, pt as invalidateOnMutation, q as BlockClients, r as OptimisticTarget, rt as BetterQueries, s as RecordQueriesOptions, st as QueriesOptions, t as OptimisticHandlers, tt as UserChangeSource, u as recordQueries, ut as QueryOptionsOf } from "../index-
|
|
3
|
+
import { $ as invalidateOnBlockEvents, G as BLOCK_READ_PREFIXES, J as BlockInvalidation, K as BlockClientQueries, Q as blockQueries, X as BlockQueries, Y as BlockMethodQuery, Z as BlockVariablesOf, a as RecordBindingQueries, at as InfiniteOptionsOf, c as RecordWriteMutations, ct as QueryHelpers, dt as TableQueries, et as queryEngine, ft as createQueries, i as optimistic, it as InfiniteExtras, l as invalidateOnRecordEvents, lt as QueryKeyOf, mt as queryCache, n as OptimisticSnapshot, nt as clearOnUserChange, o as RecordQueries, ot as MutationOptionsOf, pt as invalidateOnMutation, q as BlockClients, r as OptimisticTarget, rt as BetterQueries, s as RecordQueriesOptions, st as QueriesOptions, t as OptimisticHandlers, tt as UserChangeSource, u as recordQueries, ut as QueryOptionsOf } from "../index-uIU65iEn.js";
|
|
4
4
|
export { BLOCK_READ_PREFIXES, type BetterQueries, type BetterQueryMeta, type BlockClientQueries, type BlockClients, type BlockInvalidation, type BlockMethodQuery, type BlockQueries, type BlockVariablesOf, type InfiniteExtras, type InfiniteOptionsOf, type MutationOptionsOf, type OptimisticHandlers, type OptimisticSnapshot, type OptimisticTarget, type QueriesOptions, type QueryHelpers, type QueryKeyOf, type QueryOptionsOf, type RecordBindingQueries, type RecordQueries, type RecordQueriesOptions, type RecordWriteMutations, type TableQueries, type UserChangeSource, blockQueries, clearOnUserChange, createQueries, escapeLike, invalidateOnBlockEvents, invalidateOnMutation, invalidateOnRecordEvents, invalidateTables, optimistic, queryCache, queryEngine, recordQueries };
|
package/dist/query/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { r as invalidateTables, t as clearOnUserChange } from "../user-change-Dg
|
|
|
4
4
|
import { i as queryCache, n as invalidateOnMutation, r as keyPart, t as createQueries } from "../queries-BWYYS9um.js";
|
|
5
5
|
import { n as liveEngine, r as loadError } from "../data-engine-D1BkmBoR.js";
|
|
6
6
|
import { r as recordEventMatches } from "../record-bindings-Z51mGfhB.js";
|
|
7
|
-
import { a as recordCan, f as findBinding, l as runBindingWrite, o as recordPermissionKeys, p as loadBindings, s as recordSubject, t as bindingWrites } from "../record-type-
|
|
7
|
+
import { a as recordCan, f as findBinding, l as runBindingWrite, o as recordPermissionKeys, p as loadBindings, s as recordSubject, t as bindingWrites } from "../record-type-BEUyEsFx.js";
|
|
8
8
|
import { QueryObserver } from "@tanstack/query-core";
|
|
9
9
|
//#region src/query/engine.ts
|
|
10
10
|
const IDLE = {
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as escapeLike } from "../escape-like-PReMbEEU.js";
|
|
2
2
|
import { n as Impersonator } from "../impersonation-YTa9dZUv.js";
|
|
3
3
|
import { i as DataEntry, m as RejectedChange, n as DataEngine, o as DataSyncState } from "../data-engine-rvbR2C4F.js";
|
|
4
|
-
import { t as tenantOf } from "../tenant-
|
|
4
|
+
import { t as tenantOf } from "../tenant-FfgNhd5x.js";
|
|
5
5
|
import { t as AuthSession } from "../view-C8_xvD-j.js";
|
|
6
|
-
import { r as LiveCountSeed } from "../index-
|
|
7
|
-
import { r as MembershipClaim } from "../entitlements-
|
|
8
|
-
import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, l as BlockEventSource, m as BlockQueryState, o as DataSource, p as BlockQueryOptions, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-
|
|
6
|
+
import { r as LiveCountSeed } from "../index-DIdPoQtO.js";
|
|
7
|
+
import { r as MembershipClaim } from "../entitlements-CBjm2lvD.js";
|
|
8
|
+
import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, l as BlockEventSource, m as BlockQueryState, o as DataSource, p as BlockQueryOptions, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-CEjsMAgd.js";
|
|
9
9
|
import { n as supportOf, t as SupportView } from "../support-view-nqUWKHEs.js";
|
|
10
|
-
import { $ as UseActionFormOptions, A as useController, B as RecordListUrl, C as useConflicts, D as defineDataHooks, E as DataView, F as RecordFormState, G as RecordInitial, H as useRecordListState, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm, M as useBlockEvent, N as useBlockMutation, O as useBlockEnv, P as useBlockQuery, Q as ActionHandle, R as RecordListQueryStates, S as Conflicts, T as DataHooks, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl, dt as useSupabase, et as useAction, f as useUpload, g as UseRealtimeRelayOptions, h as useDebouncedSearch, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest, k as useBlockTenant, l as UseUploadOptions, lt as useLiveCount, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, ot as createHooks, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, tt as useActionForm, u as useImage, ut as useLiveQuery, v as Presence, w as useSyncStatus, x as usePresence, y as PresenceHookOptions, z as RecordListState } from "../index-
|
|
10
|
+
import { $ as UseActionFormOptions, A as useController, B as RecordListUrl, C as useConflicts, D as defineDataHooks, E as DataView, F as RecordFormState, G as RecordInitial, H as useRecordListState, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm, M as useBlockEvent, N as useBlockMutation, O as useBlockEnv, P as useBlockQuery, Q as ActionHandle, R as RecordListQueryStates, S as Conflicts, T as DataHooks, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl, dt as useSupabase, et as useAction, f as useUpload, g as UseRealtimeRelayOptions, h as useDebouncedSearch, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest, k as useBlockTenant, l as UseUploadOptions, lt as useLiveCount, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, ot as createHooks, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, tt as useActionForm, u as useImage, ut as useLiveQuery, v as Presence, w as useSyncStatus, x as usePresence, y as PresenceHookOptions, z as RecordListState } from "../index-D98bQs8a.js";
|
|
11
11
|
import { SessionProvider, SessionProviderProps, useSession, useSupportSession } from "./session.js";
|
|
12
12
|
import { a as useSignIn, i as SignOut, n as PendingState, o as useSignOut, r as SignIn, t as AuthHookOptions } from "../sign-in-D54FLMQy.js";
|
|
13
13
|
export { type ActionForm, type ActionHandle, type ActionInputOf, type ActionResultOf, type AuthHookOptions, type AuthSession, type BetterHooks, BetterSupabaseProvider, type BetterSupabaseProviderProps, type BlockEventSource, type BlockMutationActions, type BlockMutationState, type BlockQueryActions, type BlockQueryOptions, type BlockQueryState, type BlockRefetchOn, type BroadcastOptions, type ClaimsOf, type ClientLike, type Conflicts, type DataEngine, type DataEntry, type DataHooks, type DataSource, type DataState, type DataSyncState, type DataView, type DataWrites, type DebouncedSearch, type DebouncedSearchOptions, type ImageSource, type Impersonator, type LiveCount, type LiveCountHookOptions, type LiveCountSeed, type LiveQueryHookOptions, type MembershipClaim, type PendingState, type Presence, type PresenceHookOptions, type PresenceTopic, type ProfileOf, type RecordActionsOf, type RecordContextValue, type RecordFormState, type RecordInitial, type RecordListQueryStates, type RecordListState, type RecordListUrl, type RecordListUrlState, type RecordProviderKit, type RecordProviderProps, type RecordState, type RecordWriteHandlers, type RejectedChange, SessionProvider, type SessionProviderProps, type SignIn, type SignOut, type SignedUrl, type SignedUrlSource, type StorageImage, type SupportView, type Upload, type UploadStatus, type UploadTarget, type UseActionFormOptions, type UseActionOptions, type UseImageOptions, type UseRealtimeRelayOptions, type UseRecordFormOptions, type UseUploadOptions, createHooks, createRecordProvider, defineDataHooks, escapeLike, fieldErrorsOf, supportOf, tenantOf, useAction, useActionForm, useAuth, useBlockEnv, useBlockEvent, useBlockMutation, useBlockQuery, useBlockTenant, useBroadcast, useConflicts, useController, useDebouncedSearch, useImage, useLatest, useLiveCount, useLiveQuery, usePresence, useRealtimeRelay, useRecordForm, useRecordListState, useSession, useSignIn, useSignOut, useSignedUrl, useSupabase, useSupportSession, useSyncStatus, useUpload };
|
package/dist/react/index.js
CHANGED
|
@@ -4,6 +4,6 @@ import { a as createHooks, d as useSupabase, i as BetterSupabaseProvider, l as u
|
|
|
4
4
|
import { t as supportOf } from "../support-view-g4YLBeqX.js";
|
|
5
5
|
import { SessionProvider, useSession, useSupportSession } from "./session.js";
|
|
6
6
|
import { d as fieldErrorsOf } from "../data-hooks-CdcZfVS1.js";
|
|
7
|
-
import { _ as useBlockTenant, a as useRealtimeRelay, b as useAction, c as useSyncStatus, d as useBlockMutation, f as useBlockQuery, g as useBlockEnv, h as createRecordProvider, i as useDebouncedSearch, l as defineDataHooks, m as useRecordListState, n as useSignedUrl, o as usePresence, p as useRecordForm, r as useUpload, s as useConflicts, t as useImage, u as useBlockEvent, v as useController, x as useActionForm, y as useLatest } from "../react-
|
|
7
|
+
import { _ as useBlockTenant, a as useRealtimeRelay, b as useAction, c as useSyncStatus, d as useBlockMutation, f as useBlockQuery, g as useBlockEnv, h as createRecordProvider, i as useDebouncedSearch, l as defineDataHooks, m as useRecordListState, n as useSignedUrl, o as usePresence, p as useRecordForm, r as useUpload, s as useConflicts, t as useImage, u as useBlockEvent, v as useController, x as useActionForm, y as useLatest } from "../react-mdVjpewL.js";
|
|
8
8
|
import { t as tenantOf } from "../tenant-BgIiMQpo.js";
|
|
9
9
|
export { BetterSupabaseProvider, SessionProvider, createHooks, createRecordProvider, defineDataHooks, escapeLike, fieldErrorsOf, supportOf, tenantOf, useAction, useActionForm, useAuth, useBlockEnv, useBlockEvent, useBlockMutation, useBlockQuery, useBlockTenant, useBroadcast, useConflicts, useController, useDebouncedSearch, useImage, useLatest, useLiveCount, useLiveQuery, usePresence, useRealtimeRelay, useRecordForm, useRecordListState, useSession, useSignIn, useSignOut, useSignedUrl, useSupabase, useSupportSession, useSyncStatus, useUpload };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AuthSnapshot } from "../../bind-
|
|
1
|
+
import { t as AuthSnapshot } from "../../bind-DAx0bMSi.js";
|
|
2
2
|
import { a as OAuthSignInOptions, i as OAuthClient, n as AuthLinkClient, o as WebBrowserLike, r as AuthLinkResult, t as AuthFailure } from "../../auth-link-B4NL84XU.js";
|
|
3
3
|
import { n as PendingState } from "../../sign-in-D54FLMQy.js";
|
|
4
4
|
import { Provider } from "@supabase/supabase-js";
|
package/dist/react/server.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as escapeLike } from "../escape-like-PReMbEEU.js";
|
|
2
2
|
import { mt as QuerySpec } from "../define-D8_9X5fZ.js";
|
|
3
3
|
import { n as Impersonator } from "../impersonation-YTa9dZUv.js";
|
|
4
|
-
import { t as tenantOf } from "../tenant-
|
|
4
|
+
import { t as tenantOf } from "../tenant-FfgNhd5x.js";
|
|
5
5
|
import { t as AuthSession } from "../view-C8_xvD-j.js";
|
|
6
|
-
import { r as LiveCountSeed } from "../index-
|
|
7
|
-
import { r as MembershipClaim } from "../entitlements-
|
|
8
|
-
import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, g as ActionInputOf, t as fieldErrorsOf, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-
|
|
6
|
+
import { r as LiveCountSeed } from "../index-DIdPoQtO.js";
|
|
7
|
+
import { r as MembershipClaim } from "../entitlements-CBjm2lvD.js";
|
|
8
|
+
import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, g as ActionInputOf, t as fieldErrorsOf, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-CEjsMAgd.js";
|
|
9
9
|
import { n as supportOf, t as SupportView } from "../support-view-nqUWKHEs.js";
|
|
10
|
-
import { $ as UseActionFormOptions, A as useController$1, B as RecordListUrl, C as useConflicts$1, D as defineDataHooks$1, F as RecordFormState, G as RecordInitial, H as useRecordListState$1, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm$1, M as useBlockEvent$1, N as useBlockMutation$1, O as useBlockEnv$1, P as useBlockQuery$1, Q as ActionHandle, R as RecordListQueryStates, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider$1, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay$1, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl$1, dt as useSupabase, f as useUpload$1, g as UseRealtimeRelayOptions, h as useDebouncedSearch$1, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest$1, k as useBlockTenant$1, l as UseUploadOptions, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, u as useImage$1, ut as useLiveQuery, v as Presence, w as useSyncStatus$1, x as usePresence$1, y as PresenceHookOptions, z as RecordListState } from "../index-
|
|
10
|
+
import { $ as UseActionFormOptions, A as useController$1, B as RecordListUrl, C as useConflicts$1, D as defineDataHooks$1, F as RecordFormState, G as RecordInitial, H as useRecordListState$1, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm$1, M as useBlockEvent$1, N as useBlockMutation$1, O as useBlockEnv$1, P as useBlockQuery$1, Q as ActionHandle, R as RecordListQueryStates, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider$1, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay$1, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl$1, dt as useSupabase, f as useUpload$1, g as UseRealtimeRelayOptions, h as useDebouncedSearch$1, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest$1, k as useBlockTenant$1, l as UseUploadOptions, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, u as useImage$1, ut as useLiveQuery, v as Presence, w as useSyncStatus$1, x as usePresence$1, y as PresenceHookOptions, z as RecordListState } from "../index-D98bQs8a.js";
|
|
11
11
|
import { SessionProvider, SessionProviderProps } from "./session.js";
|
|
12
12
|
import { a as useSignIn$1, i as SignOut, n as PendingState, o as useSignOut$1, r as SignIn, t as AuthHookOptions } from "../sign-in-D54FLMQy.js";
|
|
13
13
|
//#region src/react/server.d.ts
|
package/dist/react/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { t as escapeLike } from "../escape-like-DHfx6jRr.js";
|
|
|
2
2
|
import { d as useSupabase, i as BetterSupabaseProvider, o as useAuth, s as useBroadcast, u as useLiveQuery } from "../sign-in-CmPK1AgM.js";
|
|
3
3
|
import { t as supportOf } from "../support-view-g4YLBeqX.js";
|
|
4
4
|
import { d as fieldErrorsOf } from "../data-hooks-CdcZfVS1.js";
|
|
5
|
-
import "../react-
|
|
5
|
+
import "../react-mdVjpewL.js";
|
|
6
6
|
import { t as tenantOf } from "../tenant-BgIiMQpo.js";
|
|
7
7
|
import { SessionProvider } from "./session.js";
|
|
8
8
|
//#region src/react/server.ts
|
|
@@ -6,8 +6,8 @@ import { useOptionalSupportSession } from "./react/session.js";
|
|
|
6
6
|
import { a as blockArgsKey, c as listenToBlockEvents, d as fieldErrorsOf, i as dataTarget, l as blockEnv, n as createDataOne, o as createBlockMutation, r as dataArgsKey, s as createBlockQuery, t as createDataList } from "./data-hooks-CdcZfVS1.js";
|
|
7
7
|
import { U as rpcTransport } from "./block-helpers-B0f0ZVb5.js";
|
|
8
8
|
import { r as createBlocks } from "./create-blocks-BfrDUSM6.js";
|
|
9
|
-
import { a as recordCan, i as plainData, l as runBindingWrite, s as recordSubject } from "./record-type-
|
|
10
|
-
import { t as createRecordController } from "./controller-
|
|
9
|
+
import { a as recordCan, i as plainData, l as runBindingWrite, s as recordSubject } from "./record-type-BEUyEsFx.js";
|
|
10
|
+
import { t as createRecordController } from "./controller-W97g2WGG.js";
|
|
11
11
|
import { t as relayRealtimeClient } from "./relay-CIKcAVjf.js";
|
|
12
12
|
import { a as ttlSeconds, n as scaleTransform, r as transformFor } from "./variants-Cy--Ub-a.js";
|
|
13
13
|
import { createContext, createElement, use, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as problemResponse } from "../problem-Bf0cJ7tk.js";
|
|
2
|
-
import { c as extendServer, o as withFlush, s as createServer } from "../adapter-
|
|
2
|
+
import { c as extendServer, o as withFlush, s as createServer } from "../adapter-BTbj5N9C.js";
|
|
3
3
|
import { n as defaultExpose, s as settle } from "../respond-CZMWbUs3.js";
|
|
4
4
|
import { i as requireCaller, o as runAction } from "../kit-Bcd9wYCV.js";
|
|
5
5
|
import { n as bufferInPlace, t as around } from "../shared-Bf-I13Ht.js";
|
|
6
|
-
import { i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-
|
|
6
|
+
import { i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-CqiZk89W.js";
|
|
7
7
|
import { r as refusalResponse } from "../refusal-DDlInPff.js";
|
|
8
8
|
//#region src/bridges/react-router.ts
|
|
9
9
|
/**
|
package/dist/realtime/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as AccessTopicPolicy, E as AccessPolicySql } from "../types-CPl9uJ0G.js";
|
|
2
2
|
import { et as TemplateParams, tt as TemplateValues } from "../bucket-SvRQwYS4.js";
|
|
3
3
|
import { t as RealtimeStatus } from "../realtime-status-BhNkb-Ow.js";
|
|
4
|
-
import { A as TriggerTopic, C as TopicSubscription, D as TriggerLookup, E as TopicTriggerValue, F as FanOutResult, I as TopicFanOutOptions, M as defineTopic, N as rowChange, O as TriggerOptions, P as rowKeys, S as TopicSubscribeOptions, T as TopicTriggerOptions, _ as TopicMessage, a as PresenceOutput, b as TopicPermission, c as RealtimeClient, d as SubscribeOptions, f as Subscription, g as TopicHandlers, h as TopicEvent, i as PresenceOptions, j as TriggerValue, k as TriggerPayloadMode, l as RowChange, m as Topic, n as PresenceInput, o as PresenceSchema, p as SubscriptionStatus, r as PresenceMember, s as PresenceSubscription, t as EventSchemas, u as RowKeys, v as TopicOptions, w as TopicTriggerLookup, x as TopicSqlOptions, y as TopicPayload } from "../topic-
|
|
5
|
-
import { a as watchTopic, i as topicPort, n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-
|
|
6
|
-
import { S as relayTopicPort, _ as subjectPresenceValues, a as LiveSource, b as RelayEventSourceConstructor, c as liveCount, d as realtimeChanges, f as SUBJECT_PRESENCE_TEMPLATE, g as subjectPresenceTopic, h as subjectPresence, i as LiveQueryOptions, l as liveQuery, m as SubjectPresenceValues, n as LiveCountOptions, o as LiveSubscription, p as SubjectPresenceTopic, r as LiveCountSeed, s as RealtimeChangesOptions, t as CountRunner, u as liveTopic, v as RelayClientOptions, x as relayRealtimeClient, y as RelayEventSource } from "../index-
|
|
4
|
+
import { A as TriggerTopic, C as TopicSubscription, D as TriggerLookup, E as TopicTriggerValue, F as FanOutResult, I as TopicFanOutOptions, M as defineTopic, N as rowChange, O as TriggerOptions, P as rowKeys, S as TopicSubscribeOptions, T as TopicTriggerOptions, _ as TopicMessage, a as PresenceOutput, b as TopicPermission, c as RealtimeClient, d as SubscribeOptions, f as Subscription, g as TopicHandlers, h as TopicEvent, i as PresenceOptions, j as TriggerValue, k as TriggerPayloadMode, l as RowChange, m as Topic, n as PresenceInput, o as PresenceSchema, p as SubscriptionStatus, r as PresenceMember, s as PresenceSubscription, t as EventSchemas, u as RowKeys, v as TopicOptions, w as TopicTriggerLookup, x as TopicSqlOptions, y as TopicPayload } from "../topic-BaUElNw2.js";
|
|
5
|
+
import { a as watchTopic, i as topicPort, n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-BabDTZ-L.js";
|
|
6
|
+
import { S as relayTopicPort, _ as subjectPresenceValues, a as LiveSource, b as RelayEventSourceConstructor, c as liveCount, d as realtimeChanges, f as SUBJECT_PRESENCE_TEMPLATE, g as subjectPresenceTopic, h as subjectPresence, i as LiveQueryOptions, l as liveQuery, m as SubjectPresenceValues, n as LiveCountOptions, o as LiveSubscription, p as SubjectPresenceTopic, r as LiveCountSeed, s as RealtimeChangesOptions, t as CountRunner, u as liveTopic, v as RelayClientOptions, x as relayRealtimeClient, y as RelayEventSource } from "../index-DIdPoQtO.js";
|
|
7
7
|
import { n as subjectReaders, t as SubjectReadersOptions } from "../subject-readers-CB5Te02u.js";
|
|
8
8
|
export { type AccessPolicySql, type AccessTopicPolicy, type CountRunner, type EventSchemas, type FanOutResult, type LiveCountOptions, type LiveCountSeed, type LiveQueryOptions, type LiveSource, type LiveSubscription, type PresenceInput, type PresenceMember, type PresenceOptions, type PresenceOutput, type PresenceSchema, type PresenceSubscription, type RealtimeChangesOptions, type RealtimeClient, type RealtimeStatus, type RelayClientOptions, type RelayEventSource, type RelayEventSourceConstructor, type RowChange, type RowKeys, SUBJECT_PRESENCE_TEMPLATE, type SubjectPresenceTopic, type SubjectPresenceValues, type SubjectReadersOptions, type SubscribeOptions, type Subscription, type SubscriptionStatus, type TemplateParams, type TemplateValues, type Topic, type TopicEvent, type TopicFanOutOptions, type TopicHandle, type TopicHandlers, type TopicMessage, type TopicOptions, type TopicPayload, type TopicPermission, type TopicPort, type TopicSqlOptions, type TopicSubscribeOptions, type TopicSubscription, type TopicTriggerLookup, type TopicTriggerOptions, type TopicTriggerValue, type TopicWatch, type TriggerLookup, type TriggerOptions, type TriggerPayloadMode, type TriggerTopic, type TriggerValue, defineTopic, liveCount, liveQuery, liveTopic, realtimeChanges, relayRealtimeClient, relayTopicPort, rowChange, rowKeys, subjectPresence, subjectPresenceTopic, subjectPresenceValues, subjectReaders, topicPort, watchTopic };
|
|
@@ -137,8 +137,8 @@ function recordPermissionKeys(feature) {
|
|
|
137
137
|
/**
|
|
138
138
|
* What the caller may do on each of a record type's bindings, from its
|
|
139
139
|
* `PermissionSet`. A binding action with no key in `permissions` is allowed,
|
|
140
|
-
* and so is everything when `set` is `undefined` (no
|
|
141
|
-
* each function's checks decide.
|
|
140
|
+
* and so is everything when `set` is `undefined` (no permissions block): RLS
|
|
141
|
+
* and each function's checks decide.
|
|
142
142
|
*/
|
|
143
143
|
function recordCan(feature, set) {
|
|
144
144
|
const allowed = (module, action) => {
|