@prisma-next/extension-supabase 0.12.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/README.md +74 -0
- package/dist/contract.d.mts +290 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.mjs +68 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/pack.d.mts +17 -0
- package/dist/pack.d.mts.map +1 -0
- package/dist/pack.mjs +467 -0
- package/dist/pack.mjs.map +1 -0
- package/dist/runtime.d.mts +7 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +19 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/test/utils.d.mts +24 -0
- package/dist/test/utils.d.mts.map +1 -0
- package/dist/test/utils.mjs +64 -0
- package/dist/test/utils.mjs.map +1 -0
- package/package.json +88 -0
- package/src/contract/contract.d.ts +618 -0
- package/src/contract/contract.json +483 -0
- package/src/contract/contract.prisma +48 -0
- package/src/contract/handles.ts +78 -0
- package/src/exports/contract.ts +1 -0
- package/src/exports/pack.ts +1 -0
- package/src/exports/runtime.ts +31 -0
- package/src/pack/index.ts +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @prisma-next/extension-supabase
|
|
2
|
+
|
|
3
|
+
Supabase extension pack for Prisma Next.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This extension pack ships a Supabase-shaped contract — the `auth.*` and `storage.*` namespaces as `external` tables — so an application contract can compose them via `extensionPacks: [supabasePack]` and have the framework treat them correctly: the migration planner emits no DDL for them (they're Supabase-managed), and the verifier confirms they exist in the live database.
|
|
8
|
+
|
|
9
|
+
This is **M1 of the Supabase integration** — the walking-skeleton starter. Later milestones add the role-binding runtime (`asUser()` / `asAnon()` / `asServiceRole()`); RLS, cross-contract foreign keys into `auth.users`, and explicit `auth.*` queries arrive with their respective sibling projects. See [`projects/supabase-integration/README.md`](../../../projects/supabase-integration/README.md) for the integration's full delivery plan.
|
|
10
|
+
|
|
11
|
+
## Responsibilities
|
|
12
|
+
|
|
13
|
+
- **Supabase contract**: ships a PSL-authored contract describing the `auth.*` (`AuthUser`, `AuthIdentity`) and `storage.*` (`StorageBucket`, `StorageObject`) tables with `defaultControlPolicy: 'external'`, so the framework verifies them as present without managing their DDL.
|
|
14
|
+
- **`/pack` subpath**: an `ExtensionPack` value (`supabasePack` default + `supabasePackWith(options)` factory) that an app composes into its config via `extensionPacks`. Tree-shaking-clean — `/pack` imports no runtime code.
|
|
15
|
+
- **`/runtime` subpath**: a minimal runtime descriptor so the stock Postgres runtime's pack-requirements check passes when an app composes this pack. This is **not** the role-binding `SupabaseRuntime` yet — that lands in M2.
|
|
16
|
+
- **`/test/utils` subpath**: exports `bootstrapSupabaseShim(connectionString)` — the shared PGlite test fixture that seeds the external `auth`/`storage` schemas + their tables. Used by this package's classification e2e and by `examples/supabase`; downstream constituents (`postgres-rls`, `cross-contract-refs`) extend it.
|
|
17
|
+
|
|
18
|
+
## Dependencies
|
|
19
|
+
|
|
20
|
+
- **`@prisma-next/contract`**: contract types the `/pack` descriptor and emitted artefacts depend on.
|
|
21
|
+
- **`@prisma-next/family-sql`**: SQL family pack ref + `SqlControlExtensionDescriptor` type the `/pack` descriptor satisfies.
|
|
22
|
+
- **`@prisma-next/framework-components`**: shared component / pack-ref type shapes the descriptor consumes.
|
|
23
|
+
- **`@prisma-next/sql-runtime`**: `SqlRuntimeExtensionDescriptor` the `/runtime` minimal descriptor satisfies.
|
|
24
|
+
- **`@prisma-next/sql-contract-psl`**: `prismaContract` provider used by `prisma-next.config.ts` to emit the PSL-authored contract.
|
|
25
|
+
- **`@prisma-next/utils`**: `blindCast` helper for narrowing the imported `contract.json` to the emitted `Contract` type.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @prisma-next/extension-supabase
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
|
|
35
|
+
Compose the pack into your application contract via `extensionPacks`. The pack's contract space (the `auth` and `storage` namespaces) joins the app's aggregate at emit time:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// prisma-next.config.ts
|
|
39
|
+
import { defineConfig } from '@prisma-next/cli/config-types';
|
|
40
|
+
import postgresAdapter from '@prisma-next/adapter-postgres/control';
|
|
41
|
+
import sql from '@prisma-next/family-sql/control';
|
|
42
|
+
import postgres from '@prisma-next/target-postgres/control';
|
|
43
|
+
import postgresPackRef from '@prisma-next/target-postgres/pack';
|
|
44
|
+
import { prismaContract } from '@prisma-next/sql-contract-psl/provider';
|
|
45
|
+
import supabasePack from '@prisma-next/extension-supabase/pack';
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
family: sql,
|
|
49
|
+
target: postgres,
|
|
50
|
+
adapter: postgresAdapter,
|
|
51
|
+
contract: prismaContract('./src/contract.prisma', { target: postgresPackRef }),
|
|
52
|
+
extensionPacks: [supabasePack],
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See [`examples/supabase`](../../../examples/supabase) for the full runnable walking-skeleton app.
|
|
57
|
+
|
|
58
|
+
## What this pack does *not* ship (yet)
|
|
59
|
+
|
|
60
|
+
These belong to sibling Supabase-integration projects:
|
|
61
|
+
|
|
62
|
+
- **Role-binding runtime** (`asUser(jwt)` / `asAnon()` / `asServiceRole()`) — `extension-supabase` M2 (real `SupabaseRuntime` extends `PostgresRuntime`; issues `SET LOCAL role` below user middleware).
|
|
63
|
+
- **RLS authoring + policies** — [`postgres-rls`](../../../projects/postgres-rls/spec.md) (`.rls(...)` builder, PSL `policy { … }` blocks, content-addressed wire names, `pg_policies` verifier).
|
|
64
|
+
- **Cross-contract FK to `auth.users`** — [`cross-contract-refs`](../../../projects/cross-contract-refs/spec.md) (`supabase:auth.User` PSL grammar; cross-space references in the TS builder).
|
|
65
|
+
- **Explicit namespace-qualified queries** (`db.sql.auth.users`) — [`explicit-namespace-dsl`](../../../projects/explicit-namespace-dsl/spec.md).
|
|
66
|
+
- **Roles as first-class IR** (`anon` / `authenticated` / `service_role` / `authenticator`) — `postgres-rls` (`PostgresRole`).
|
|
67
|
+
- **`auth.uid()` / `auth.jwt()` / `auth.role()` session-GUC functions** — `postgres-rls` extends `bootstrapSupabaseShim` to seed them when its RLS tests need them.
|
|
68
|
+
|
|
69
|
+
## References
|
|
70
|
+
|
|
71
|
+
- [Supabase integration umbrella](../../../projects/supabase-integration/README.md) — § "Walking skeleton" + the canonical decisions log.
|
|
72
|
+
- [`extension-supabase` project spec](../../../projects/extension-supabase/spec.md) — full design (M1–M4).
|
|
73
|
+
- [ADR 212 — Contract spaces](../../../docs/architecture%20docs/adrs/ADR%20212%20-%20Contract%20spaces.md) — the package layout this extension follows.
|
|
74
|
+
- [ADR 224 — Control Policy](../../../docs/architecture%20docs/adrs/ADR%20224%20-%20Control%20Policy%20—%20framework-locked%20vocabulary%20and%20family-owned%20dispatch.md) — `external` dispatch.
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
//#region src/contract/handles.d.ts
|
|
2
|
+
declare const AuthUser: import("@prisma-next/sql-contract-ts/contract-builder").ContractModelBuilder<"AuthUser", {
|
|
3
|
+
id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
4
|
+
readonly kind: "scalar";
|
|
5
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
6
|
+
readonly codecId: "pg/text@1";
|
|
7
|
+
}) | undefined;
|
|
8
|
+
readonly typeRef?: undefined;
|
|
9
|
+
readonly nullable: false;
|
|
10
|
+
readonly columnName?: undefined;
|
|
11
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
12
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
13
|
+
} & {
|
|
14
|
+
readonly id: {
|
|
15
|
+
readonly name?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
} & {
|
|
18
|
+
readonly unique?: undefined;
|
|
19
|
+
}>;
|
|
20
|
+
email: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
21
|
+
readonly kind: "scalar";
|
|
22
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
23
|
+
readonly codecId: "pg/text@1";
|
|
24
|
+
}) | undefined;
|
|
25
|
+
readonly typeRef?: undefined;
|
|
26
|
+
readonly nullable: false;
|
|
27
|
+
readonly columnName?: undefined;
|
|
28
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
29
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
30
|
+
} & {
|
|
31
|
+
readonly id?: undefined;
|
|
32
|
+
} & {
|
|
33
|
+
readonly unique?: undefined;
|
|
34
|
+
}>;
|
|
35
|
+
created_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
36
|
+
readonly kind: "scalar";
|
|
37
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
38
|
+
readonly codecId: "pg/timestamptz@1";
|
|
39
|
+
}) | undefined;
|
|
40
|
+
readonly typeRef?: undefined;
|
|
41
|
+
readonly nullable: false;
|
|
42
|
+
readonly columnName?: undefined;
|
|
43
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
44
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
45
|
+
} & {
|
|
46
|
+
readonly id?: undefined;
|
|
47
|
+
} & {
|
|
48
|
+
readonly unique?: undefined;
|
|
49
|
+
}>;
|
|
50
|
+
updated_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
51
|
+
readonly kind: "scalar";
|
|
52
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
53
|
+
readonly codecId: "pg/timestamptz@1";
|
|
54
|
+
}) | undefined;
|
|
55
|
+
readonly typeRef?: undefined;
|
|
56
|
+
readonly nullable: false;
|
|
57
|
+
readonly columnName?: undefined;
|
|
58
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
59
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
60
|
+
} & {
|
|
61
|
+
readonly id?: undefined;
|
|
62
|
+
} & {
|
|
63
|
+
readonly unique?: undefined;
|
|
64
|
+
}>;
|
|
65
|
+
}, Record<never, never>, undefined, undefined, Record<never, never>, "supabase">;
|
|
66
|
+
declare const AuthIdentity: import("@prisma-next/sql-contract-ts/contract-builder").ContractModelBuilder<"AuthIdentity", {
|
|
67
|
+
id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
68
|
+
readonly kind: "scalar";
|
|
69
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
70
|
+
readonly codecId: "pg/text@1";
|
|
71
|
+
}) | undefined;
|
|
72
|
+
readonly typeRef?: undefined;
|
|
73
|
+
readonly nullable: false;
|
|
74
|
+
readonly columnName?: undefined;
|
|
75
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
76
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
77
|
+
} & {
|
|
78
|
+
readonly id: {
|
|
79
|
+
readonly name?: string | undefined;
|
|
80
|
+
};
|
|
81
|
+
} & {
|
|
82
|
+
readonly unique?: undefined;
|
|
83
|
+
}>;
|
|
84
|
+
user_id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
85
|
+
readonly kind: "scalar";
|
|
86
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
87
|
+
readonly codecId: "pg/text@1";
|
|
88
|
+
}) | undefined;
|
|
89
|
+
readonly typeRef?: undefined;
|
|
90
|
+
readonly nullable: false;
|
|
91
|
+
readonly columnName?: undefined;
|
|
92
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
93
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
94
|
+
} & {
|
|
95
|
+
readonly id?: undefined;
|
|
96
|
+
} & {
|
|
97
|
+
readonly unique?: undefined;
|
|
98
|
+
}>;
|
|
99
|
+
provider: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
100
|
+
readonly kind: "scalar";
|
|
101
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
102
|
+
readonly codecId: "pg/text@1";
|
|
103
|
+
}) | undefined;
|
|
104
|
+
readonly typeRef?: undefined;
|
|
105
|
+
readonly nullable: false;
|
|
106
|
+
readonly columnName?: undefined;
|
|
107
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
108
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
109
|
+
} & {
|
|
110
|
+
readonly id?: undefined;
|
|
111
|
+
} & {
|
|
112
|
+
readonly unique?: undefined;
|
|
113
|
+
}>;
|
|
114
|
+
created_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
115
|
+
readonly kind: "scalar";
|
|
116
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
117
|
+
readonly codecId: "pg/timestamptz@1";
|
|
118
|
+
}) | undefined;
|
|
119
|
+
readonly typeRef?: undefined;
|
|
120
|
+
readonly nullable: false;
|
|
121
|
+
readonly columnName?: undefined;
|
|
122
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
123
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
124
|
+
} & {
|
|
125
|
+
readonly id?: undefined;
|
|
126
|
+
} & {
|
|
127
|
+
readonly unique?: undefined;
|
|
128
|
+
}>;
|
|
129
|
+
updated_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
130
|
+
readonly kind: "scalar";
|
|
131
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
132
|
+
readonly codecId: "pg/timestamptz@1";
|
|
133
|
+
}) | undefined;
|
|
134
|
+
readonly typeRef?: undefined;
|
|
135
|
+
readonly nullable: false;
|
|
136
|
+
readonly columnName?: undefined;
|
|
137
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
138
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
139
|
+
} & {
|
|
140
|
+
readonly id?: undefined;
|
|
141
|
+
} & {
|
|
142
|
+
readonly unique?: undefined;
|
|
143
|
+
}>;
|
|
144
|
+
}, Record<never, never>, undefined, undefined, Record<never, never>, "supabase">;
|
|
145
|
+
declare const StorageBucket: import("@prisma-next/sql-contract-ts/contract-builder").ContractModelBuilder<"StorageBucket", {
|
|
146
|
+
id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
147
|
+
readonly kind: "scalar";
|
|
148
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
149
|
+
readonly codecId: "pg/text@1";
|
|
150
|
+
}) | undefined;
|
|
151
|
+
readonly typeRef?: undefined;
|
|
152
|
+
readonly nullable: false;
|
|
153
|
+
readonly columnName?: undefined;
|
|
154
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
155
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
156
|
+
} & {
|
|
157
|
+
readonly id: {
|
|
158
|
+
readonly name?: string | undefined;
|
|
159
|
+
};
|
|
160
|
+
} & {
|
|
161
|
+
readonly unique?: undefined;
|
|
162
|
+
}>;
|
|
163
|
+
name: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
164
|
+
readonly kind: "scalar";
|
|
165
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
166
|
+
readonly codecId: "pg/text@1";
|
|
167
|
+
}) | undefined;
|
|
168
|
+
readonly typeRef?: undefined;
|
|
169
|
+
readonly nullable: false;
|
|
170
|
+
readonly columnName?: undefined;
|
|
171
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
172
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
173
|
+
} & {
|
|
174
|
+
readonly id?: undefined;
|
|
175
|
+
} & {
|
|
176
|
+
readonly unique?: undefined;
|
|
177
|
+
}>;
|
|
178
|
+
created_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
179
|
+
readonly kind: "scalar";
|
|
180
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
181
|
+
readonly codecId: "pg/timestamptz@1";
|
|
182
|
+
}) | undefined;
|
|
183
|
+
readonly typeRef?: undefined;
|
|
184
|
+
readonly nullable: false;
|
|
185
|
+
readonly columnName?: undefined;
|
|
186
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
187
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
188
|
+
} & {
|
|
189
|
+
readonly id?: undefined;
|
|
190
|
+
} & {
|
|
191
|
+
readonly unique?: undefined;
|
|
192
|
+
}>;
|
|
193
|
+
updated_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
194
|
+
readonly kind: "scalar";
|
|
195
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
196
|
+
readonly codecId: "pg/timestamptz@1";
|
|
197
|
+
}) | undefined;
|
|
198
|
+
readonly typeRef?: undefined;
|
|
199
|
+
readonly nullable: false;
|
|
200
|
+
readonly columnName?: undefined;
|
|
201
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
202
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
203
|
+
} & {
|
|
204
|
+
readonly id?: undefined;
|
|
205
|
+
} & {
|
|
206
|
+
readonly unique?: undefined;
|
|
207
|
+
}>;
|
|
208
|
+
}, Record<never, never>, undefined, undefined, Record<never, never>, "supabase">;
|
|
209
|
+
declare const StorageObject: import("@prisma-next/sql-contract-ts/contract-builder").ContractModelBuilder<"StorageObject", {
|
|
210
|
+
id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
211
|
+
readonly kind: "scalar";
|
|
212
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
213
|
+
readonly codecId: "pg/text@1";
|
|
214
|
+
}) | undefined;
|
|
215
|
+
readonly typeRef?: undefined;
|
|
216
|
+
readonly nullable: false;
|
|
217
|
+
readonly columnName?: undefined;
|
|
218
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
219
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
220
|
+
} & {
|
|
221
|
+
readonly id: {
|
|
222
|
+
readonly name?: string | undefined;
|
|
223
|
+
};
|
|
224
|
+
} & {
|
|
225
|
+
readonly unique?: undefined;
|
|
226
|
+
}>;
|
|
227
|
+
bucket_id: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
228
|
+
readonly kind: "scalar";
|
|
229
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
230
|
+
readonly codecId: "pg/text@1";
|
|
231
|
+
}) | undefined;
|
|
232
|
+
readonly typeRef?: undefined;
|
|
233
|
+
readonly nullable: false;
|
|
234
|
+
readonly columnName?: undefined;
|
|
235
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
236
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
237
|
+
} & {
|
|
238
|
+
readonly id?: undefined;
|
|
239
|
+
} & {
|
|
240
|
+
readonly unique?: undefined;
|
|
241
|
+
}>;
|
|
242
|
+
name: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
243
|
+
readonly kind: "scalar";
|
|
244
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
245
|
+
readonly codecId: "pg/text@1";
|
|
246
|
+
}) | undefined;
|
|
247
|
+
readonly typeRef?: undefined;
|
|
248
|
+
readonly nullable: false;
|
|
249
|
+
readonly columnName?: undefined;
|
|
250
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
251
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
252
|
+
} & {
|
|
253
|
+
readonly id?: undefined;
|
|
254
|
+
} & {
|
|
255
|
+
readonly unique?: undefined;
|
|
256
|
+
}>;
|
|
257
|
+
created_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
258
|
+
readonly kind: "scalar";
|
|
259
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
260
|
+
readonly codecId: "pg/timestamptz@1";
|
|
261
|
+
}) | undefined;
|
|
262
|
+
readonly typeRef?: undefined;
|
|
263
|
+
readonly nullable: false;
|
|
264
|
+
readonly columnName?: undefined;
|
|
265
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
266
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
267
|
+
} & {
|
|
268
|
+
readonly id?: undefined;
|
|
269
|
+
} & {
|
|
270
|
+
readonly unique?: undefined;
|
|
271
|
+
}>;
|
|
272
|
+
updated_at: import("@prisma-next/sql-contract-ts/contract-builder").ScalarFieldBuilder<{
|
|
273
|
+
readonly kind: "scalar";
|
|
274
|
+
readonly descriptor?: (import("@prisma-next/framework-components/codec").ColumnTypeDescriptor & {
|
|
275
|
+
readonly codecId: "pg/timestamptz@1";
|
|
276
|
+
}) | undefined;
|
|
277
|
+
readonly typeRef?: undefined;
|
|
278
|
+
readonly nullable: false;
|
|
279
|
+
readonly columnName?: undefined;
|
|
280
|
+
readonly default?: import("@prisma-next/contract/types").ColumnDefault | undefined;
|
|
281
|
+
readonly executionDefaults?: import("@prisma-next/contract/types").ExecutionMutationDefaultPhases | undefined;
|
|
282
|
+
} & {
|
|
283
|
+
readonly id?: undefined;
|
|
284
|
+
} & {
|
|
285
|
+
readonly unique?: undefined;
|
|
286
|
+
}>;
|
|
287
|
+
}, Record<never, never>, undefined, undefined, Record<never, never>, "supabase">;
|
|
288
|
+
//#endregion
|
|
289
|
+
export { AuthIdentity, AuthUser, StorageBucket, StorageObject };
|
|
290
|
+
//# sourceMappingURL=contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.mts","names":[],"sources":["../src/contract/handles.ts"],"mappings":";cAiBa,QAAA,0DAAQ,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAapB,MAAA,sCAAA,MAAA;AAAA,cAEY,YAAA,0DAAY,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcxB,MAAA,sCAAA,MAAA;AAAA,cAEY,aAAA,0DAAa,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAazB,MAAA,sCAAA,MAAA;AAAA,cAEY,aAAA,0DAAa,oBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAczB,MAAA,sCAAA,MAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { extensionModel, field } from "@prisma-next/sql-contract-ts/contract-builder";
|
|
2
|
+
//#region src/contract/handles.ts
|
|
3
|
+
/**
|
|
4
|
+
* Branded model handles for the Supabase contract space.
|
|
5
|
+
*
|
|
6
|
+
* Each handle is built via `extensionModel` branded `spaceId: 'supabase'` with
|
|
7
|
+
* its real domain model name, namespace, table name, and columns — so
|
|
8
|
+
* `AuthUser.refs.id` is a cross-space `TargetFieldRef` carrying
|
|
9
|
+
* `spaceId:'supabase'`, `namespaceId:'auth'`, `tableName:'users'`.
|
|
10
|
+
*
|
|
11
|
+
* Columns mirror the shipped contract (`src/contract/contract.json`); the
|
|
12
|
+
* handle↔contract consistency test (`test/contract-handles.test.ts`) asserts
|
|
13
|
+
* they agree so any drift is caught at test time.
|
|
14
|
+
*/
|
|
15
|
+
const pgText = {
|
|
16
|
+
codecId: "pg/text@1",
|
|
17
|
+
nativeType: "text"
|
|
18
|
+
};
|
|
19
|
+
const pgTimestamptz = {
|
|
20
|
+
codecId: "pg/timestamptz@1",
|
|
21
|
+
nativeType: "timestamptz"
|
|
22
|
+
};
|
|
23
|
+
const AuthUser = extensionModel("AuthUser", {
|
|
24
|
+
namespace: "auth",
|
|
25
|
+
fields: {
|
|
26
|
+
id: field.column(pgText).id(),
|
|
27
|
+
email: field.column(pgText),
|
|
28
|
+
created_at: field.column(pgTimestamptz),
|
|
29
|
+
updated_at: field.column(pgTimestamptz)
|
|
30
|
+
},
|
|
31
|
+
table: "users"
|
|
32
|
+
}, "supabase");
|
|
33
|
+
const AuthIdentity = extensionModel("AuthIdentity", {
|
|
34
|
+
namespace: "auth",
|
|
35
|
+
fields: {
|
|
36
|
+
id: field.column(pgText).id(),
|
|
37
|
+
user_id: field.column(pgText),
|
|
38
|
+
provider: field.column(pgText),
|
|
39
|
+
created_at: field.column(pgTimestamptz),
|
|
40
|
+
updated_at: field.column(pgTimestamptz)
|
|
41
|
+
},
|
|
42
|
+
table: "identities"
|
|
43
|
+
}, "supabase");
|
|
44
|
+
const StorageBucket = extensionModel("StorageBucket", {
|
|
45
|
+
namespace: "storage",
|
|
46
|
+
fields: {
|
|
47
|
+
id: field.column(pgText).id(),
|
|
48
|
+
name: field.column(pgText),
|
|
49
|
+
created_at: field.column(pgTimestamptz),
|
|
50
|
+
updated_at: field.column(pgTimestamptz)
|
|
51
|
+
},
|
|
52
|
+
table: "buckets"
|
|
53
|
+
}, "supabase");
|
|
54
|
+
const StorageObject = extensionModel("StorageObject", {
|
|
55
|
+
namespace: "storage",
|
|
56
|
+
fields: {
|
|
57
|
+
id: field.column(pgText).id(),
|
|
58
|
+
bucket_id: field.column(pgText),
|
|
59
|
+
name: field.column(pgText),
|
|
60
|
+
created_at: field.column(pgTimestamptz),
|
|
61
|
+
updated_at: field.column(pgTimestamptz)
|
|
62
|
+
},
|
|
63
|
+
table: "objects"
|
|
64
|
+
}, "supabase");
|
|
65
|
+
//#endregion
|
|
66
|
+
export { AuthIdentity, AuthUser, StorageBucket, StorageObject };
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.mjs","names":[],"sources":["../src/contract/handles.ts"],"sourcesContent":["/**\n * Branded model handles for the Supabase contract space.\n *\n * Each handle is built via `extensionModel` branded `spaceId: 'supabase'` with\n * its real domain model name, namespace, table name, and columns — so\n * `AuthUser.refs.id` is a cross-space `TargetFieldRef` carrying\n * `spaceId:'supabase'`, `namespaceId:'auth'`, `tableName:'users'`.\n *\n * Columns mirror the shipped contract (`src/contract/contract.json`); the\n * handle↔contract consistency test (`test/contract-handles.test.ts`) asserts\n * they agree so any drift is caught at test time.\n */\nimport { extensionModel, field } from '@prisma-next/sql-contract-ts/contract-builder';\n\nconst pgText = { codecId: 'pg/text@1', nativeType: 'text' } as const;\nconst pgTimestamptz = { codecId: 'pg/timestamptz@1', nativeType: 'timestamptz' } as const;\n\nexport const AuthUser = extensionModel(\n 'AuthUser',\n {\n namespace: 'auth',\n fields: {\n id: field.column(pgText).id(),\n email: field.column(pgText),\n created_at: field.column(pgTimestamptz),\n updated_at: field.column(pgTimestamptz),\n },\n table: 'users',\n },\n 'supabase' as const,\n);\n\nexport const AuthIdentity = extensionModel(\n 'AuthIdentity',\n {\n namespace: 'auth',\n fields: {\n id: field.column(pgText).id(),\n user_id: field.column(pgText),\n provider: field.column(pgText),\n created_at: field.column(pgTimestamptz),\n updated_at: field.column(pgTimestamptz),\n },\n table: 'identities',\n },\n 'supabase' as const,\n);\n\nexport const StorageBucket = extensionModel(\n 'StorageBucket',\n {\n namespace: 'storage',\n fields: {\n id: field.column(pgText).id(),\n name: field.column(pgText),\n created_at: field.column(pgTimestamptz),\n updated_at: field.column(pgTimestamptz),\n },\n table: 'buckets',\n },\n 'supabase' as const,\n);\n\nexport const StorageObject = extensionModel(\n 'StorageObject',\n {\n namespace: 'storage',\n fields: {\n id: field.column(pgText).id(),\n bucket_id: field.column(pgText),\n name: field.column(pgText),\n created_at: field.column(pgTimestamptz),\n updated_at: field.column(pgTimestamptz),\n },\n table: 'objects',\n },\n 'supabase' as const,\n);\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,SAAS;CAAE,SAAS;CAAa,YAAY;AAAO;AAC1D,MAAM,gBAAgB;CAAE,SAAS;CAAoB,YAAY;AAAc;AAE/E,MAAa,WAAW,eACtB,YACA;CACE,WAAW;CACX,QAAQ;EACN,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG;EAC5B,OAAO,MAAM,OAAO,MAAM;EAC1B,YAAY,MAAM,OAAO,aAAa;EACtC,YAAY,MAAM,OAAO,aAAa;CACxC;CACA,OAAO;AACT,GACA,UACF;AAEA,MAAa,eAAe,eAC1B,gBACA;CACE,WAAW;CACX,QAAQ;EACN,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG;EAC5B,SAAS,MAAM,OAAO,MAAM;EAC5B,UAAU,MAAM,OAAO,MAAM;EAC7B,YAAY,MAAM,OAAO,aAAa;EACtC,YAAY,MAAM,OAAO,aAAa;CACxC;CACA,OAAO;AACT,GACA,UACF;AAEA,MAAa,gBAAgB,eAC3B,iBACA;CACE,WAAW;CACX,QAAQ;EACN,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG;EAC5B,MAAM,MAAM,OAAO,MAAM;EACzB,YAAY,MAAM,OAAO,aAAa;EACtC,YAAY,MAAM,OAAO,aAAa;CACxC;CACA,OAAO;AACT,GACA,UACF;AAEA,MAAa,gBAAgB,eAC3B,iBACA;CACE,WAAW;CACX,QAAQ;EACN,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG;EAC5B,WAAW,MAAM,OAAO,MAAM;EAC9B,MAAM,MAAM,OAAO,MAAM;EACzB,YAAY,MAAM,OAAO,aAAa;EACtC,YAAY,MAAM,OAAO,aAAa;CACxC;CACA,OAAO;AACT,GACA,UACF"}
|
package/dist/pack.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SqlControlExtensionDescriptor } from "@prisma-next/family-sql/control";
|
|
2
|
+
|
|
3
|
+
//#region src/pack/index.d.ts
|
|
4
|
+
declare const supabasePack: SqlControlExtensionDescriptor<'postgres'>;
|
|
5
|
+
/**
|
|
6
|
+
* Returns a pack using `contractOverride` in place of the shipped
|
|
7
|
+
* `contract.json` when provided, otherwise returns the default pack.
|
|
8
|
+
*
|
|
9
|
+
* Intended for tests that need to drive the framework with a synthetic
|
|
10
|
+
* contract while still exercising the full descriptor wiring.
|
|
11
|
+
*/
|
|
12
|
+
declare function supabasePackWith(options?: {
|
|
13
|
+
contractOverride?: unknown;
|
|
14
|
+
}): SqlControlExtensionDescriptor<'postgres'>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { supabasePack as default, supabasePackWith };
|
|
17
|
+
//# sourceMappingURL=pack.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/pack/index.ts"],"mappings":";;;cAmCa,YAAA,EAAc,6BAA6B;;AAAxD;;;;AAAwD;AASxD;iBAAgB,gBAAA,CAAiB,OAAA;EAC/B,gBAAA;AAAA,IACE,6BAA6B"}
|