@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/dist/pack.mjs
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
2
|
+
//#region package.json
|
|
3
|
+
var version = "0.12.0";
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region src/contract/contract.json
|
|
6
|
+
var contract_default = {
|
|
7
|
+
schemaVersion: "1",
|
|
8
|
+
targetFamily: "sql",
|
|
9
|
+
target: "postgres",
|
|
10
|
+
profileHash: "sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb",
|
|
11
|
+
roots: {
|
|
12
|
+
"buckets": {
|
|
13
|
+
"model": "StorageBucket",
|
|
14
|
+
"namespace": "storage"
|
|
15
|
+
},
|
|
16
|
+
"identities": {
|
|
17
|
+
"model": "AuthIdentity",
|
|
18
|
+
"namespace": "auth"
|
|
19
|
+
},
|
|
20
|
+
"objects": {
|
|
21
|
+
"model": "StorageObject",
|
|
22
|
+
"namespace": "storage"
|
|
23
|
+
},
|
|
24
|
+
"users": {
|
|
25
|
+
"model": "AuthUser",
|
|
26
|
+
"namespace": "auth"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
domain: { "namespaces": {
|
|
30
|
+
"auth": { "models": {
|
|
31
|
+
"AuthIdentity": {
|
|
32
|
+
"fields": {
|
|
33
|
+
"created_at": {
|
|
34
|
+
"nullable": false,
|
|
35
|
+
"type": {
|
|
36
|
+
"codecId": "pg/timestamptz@1",
|
|
37
|
+
"kind": "scalar"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"id": {
|
|
41
|
+
"nullable": false,
|
|
42
|
+
"type": {
|
|
43
|
+
"codecId": "pg/text@1",
|
|
44
|
+
"kind": "scalar"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"provider": {
|
|
48
|
+
"nullable": false,
|
|
49
|
+
"type": {
|
|
50
|
+
"codecId": "pg/text@1",
|
|
51
|
+
"kind": "scalar"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"updated_at": {
|
|
55
|
+
"nullable": false,
|
|
56
|
+
"type": {
|
|
57
|
+
"codecId": "pg/timestamptz@1",
|
|
58
|
+
"kind": "scalar"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"user_id": {
|
|
62
|
+
"nullable": false,
|
|
63
|
+
"type": {
|
|
64
|
+
"codecId": "pg/text@1",
|
|
65
|
+
"kind": "scalar"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"relations": {},
|
|
70
|
+
"storage": {
|
|
71
|
+
"fields": {
|
|
72
|
+
"created_at": { "column": "created_at" },
|
|
73
|
+
"id": { "column": "id" },
|
|
74
|
+
"provider": { "column": "provider" },
|
|
75
|
+
"updated_at": { "column": "updated_at" },
|
|
76
|
+
"user_id": { "column": "user_id" }
|
|
77
|
+
},
|
|
78
|
+
"namespaceId": "auth",
|
|
79
|
+
"table": "identities"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"AuthUser": {
|
|
83
|
+
"fields": {
|
|
84
|
+
"created_at": {
|
|
85
|
+
"nullable": false,
|
|
86
|
+
"type": {
|
|
87
|
+
"codecId": "pg/timestamptz@1",
|
|
88
|
+
"kind": "scalar"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"email": {
|
|
92
|
+
"nullable": false,
|
|
93
|
+
"type": {
|
|
94
|
+
"codecId": "pg/text@1",
|
|
95
|
+
"kind": "scalar"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"id": {
|
|
99
|
+
"nullable": false,
|
|
100
|
+
"type": {
|
|
101
|
+
"codecId": "pg/text@1",
|
|
102
|
+
"kind": "scalar"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"updated_at": {
|
|
106
|
+
"nullable": false,
|
|
107
|
+
"type": {
|
|
108
|
+
"codecId": "pg/timestamptz@1",
|
|
109
|
+
"kind": "scalar"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"relations": {},
|
|
114
|
+
"storage": {
|
|
115
|
+
"fields": {
|
|
116
|
+
"created_at": { "column": "created_at" },
|
|
117
|
+
"email": { "column": "email" },
|
|
118
|
+
"id": { "column": "id" },
|
|
119
|
+
"updated_at": { "column": "updated_at" }
|
|
120
|
+
},
|
|
121
|
+
"namespaceId": "auth",
|
|
122
|
+
"table": "users"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} },
|
|
126
|
+
"storage": { "models": {
|
|
127
|
+
"StorageBucket": {
|
|
128
|
+
"fields": {
|
|
129
|
+
"created_at": {
|
|
130
|
+
"nullable": false,
|
|
131
|
+
"type": {
|
|
132
|
+
"codecId": "pg/timestamptz@1",
|
|
133
|
+
"kind": "scalar"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"id": {
|
|
137
|
+
"nullable": false,
|
|
138
|
+
"type": {
|
|
139
|
+
"codecId": "pg/text@1",
|
|
140
|
+
"kind": "scalar"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"name": {
|
|
144
|
+
"nullable": false,
|
|
145
|
+
"type": {
|
|
146
|
+
"codecId": "pg/text@1",
|
|
147
|
+
"kind": "scalar"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"updated_at": {
|
|
151
|
+
"nullable": false,
|
|
152
|
+
"type": {
|
|
153
|
+
"codecId": "pg/timestamptz@1",
|
|
154
|
+
"kind": "scalar"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"relations": {},
|
|
159
|
+
"storage": {
|
|
160
|
+
"fields": {
|
|
161
|
+
"created_at": { "column": "created_at" },
|
|
162
|
+
"id": { "column": "id" },
|
|
163
|
+
"name": { "column": "name" },
|
|
164
|
+
"updated_at": { "column": "updated_at" }
|
|
165
|
+
},
|
|
166
|
+
"namespaceId": "storage",
|
|
167
|
+
"table": "buckets"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"StorageObject": {
|
|
171
|
+
"fields": {
|
|
172
|
+
"bucket_id": {
|
|
173
|
+
"nullable": false,
|
|
174
|
+
"type": {
|
|
175
|
+
"codecId": "pg/text@1",
|
|
176
|
+
"kind": "scalar"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"created_at": {
|
|
180
|
+
"nullable": false,
|
|
181
|
+
"type": {
|
|
182
|
+
"codecId": "pg/timestamptz@1",
|
|
183
|
+
"kind": "scalar"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"id": {
|
|
187
|
+
"nullable": false,
|
|
188
|
+
"type": {
|
|
189
|
+
"codecId": "pg/text@1",
|
|
190
|
+
"kind": "scalar"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"name": {
|
|
194
|
+
"nullable": false,
|
|
195
|
+
"type": {
|
|
196
|
+
"codecId": "pg/text@1",
|
|
197
|
+
"kind": "scalar"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"updated_at": {
|
|
201
|
+
"nullable": false,
|
|
202
|
+
"type": {
|
|
203
|
+
"codecId": "pg/timestamptz@1",
|
|
204
|
+
"kind": "scalar"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"relations": {},
|
|
209
|
+
"storage": {
|
|
210
|
+
"fields": {
|
|
211
|
+
"bucket_id": { "column": "bucket_id" },
|
|
212
|
+
"created_at": { "column": "created_at" },
|
|
213
|
+
"id": { "column": "id" },
|
|
214
|
+
"name": { "column": "name" },
|
|
215
|
+
"updated_at": { "column": "updated_at" }
|
|
216
|
+
},
|
|
217
|
+
"namespaceId": "storage",
|
|
218
|
+
"table": "objects"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
} }
|
|
222
|
+
} },
|
|
223
|
+
storage: {
|
|
224
|
+
"namespaces": {
|
|
225
|
+
"__unbound__": {
|
|
226
|
+
"entries": { "table": {} },
|
|
227
|
+
"id": "__unbound__",
|
|
228
|
+
"kind": "postgres-unbound-schema"
|
|
229
|
+
},
|
|
230
|
+
"auth": {
|
|
231
|
+
"entries": { "table": {
|
|
232
|
+
"identities": {
|
|
233
|
+
"columns": {
|
|
234
|
+
"created_at": {
|
|
235
|
+
"codecId": "pg/timestamptz@1",
|
|
236
|
+
"nativeType": "timestamptz",
|
|
237
|
+
"nullable": false,
|
|
238
|
+
"typeRef": "Timestamptz"
|
|
239
|
+
},
|
|
240
|
+
"id": {
|
|
241
|
+
"codecId": "pg/text@1",
|
|
242
|
+
"nativeType": "uuid",
|
|
243
|
+
"nullable": false,
|
|
244
|
+
"typeRef": "Uuid"
|
|
245
|
+
},
|
|
246
|
+
"provider": {
|
|
247
|
+
"codecId": "pg/text@1",
|
|
248
|
+
"nativeType": "text",
|
|
249
|
+
"nullable": false
|
|
250
|
+
},
|
|
251
|
+
"updated_at": {
|
|
252
|
+
"codecId": "pg/timestamptz@1",
|
|
253
|
+
"nativeType": "timestamptz",
|
|
254
|
+
"nullable": false,
|
|
255
|
+
"typeRef": "Timestamptz"
|
|
256
|
+
},
|
|
257
|
+
"user_id": {
|
|
258
|
+
"codecId": "pg/text@1",
|
|
259
|
+
"nativeType": "uuid",
|
|
260
|
+
"nullable": false,
|
|
261
|
+
"typeRef": "Uuid"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"foreignKeys": [],
|
|
265
|
+
"indexes": [],
|
|
266
|
+
"primaryKey": { "columns": ["id"] },
|
|
267
|
+
"uniques": []
|
|
268
|
+
},
|
|
269
|
+
"users": {
|
|
270
|
+
"columns": {
|
|
271
|
+
"created_at": {
|
|
272
|
+
"codecId": "pg/timestamptz@1",
|
|
273
|
+
"nativeType": "timestamptz",
|
|
274
|
+
"nullable": false,
|
|
275
|
+
"typeRef": "Timestamptz"
|
|
276
|
+
},
|
|
277
|
+
"email": {
|
|
278
|
+
"codecId": "pg/text@1",
|
|
279
|
+
"nativeType": "text",
|
|
280
|
+
"nullable": false
|
|
281
|
+
},
|
|
282
|
+
"id": {
|
|
283
|
+
"codecId": "pg/text@1",
|
|
284
|
+
"nativeType": "uuid",
|
|
285
|
+
"nullable": false,
|
|
286
|
+
"typeRef": "Uuid"
|
|
287
|
+
},
|
|
288
|
+
"updated_at": {
|
|
289
|
+
"codecId": "pg/timestamptz@1",
|
|
290
|
+
"nativeType": "timestamptz",
|
|
291
|
+
"nullable": false,
|
|
292
|
+
"typeRef": "Timestamptz"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"foreignKeys": [],
|
|
296
|
+
"indexes": [],
|
|
297
|
+
"primaryKey": { "columns": ["id"] },
|
|
298
|
+
"uniques": []
|
|
299
|
+
}
|
|
300
|
+
} },
|
|
301
|
+
"id": "auth",
|
|
302
|
+
"kind": "postgres-schema"
|
|
303
|
+
},
|
|
304
|
+
"public": {
|
|
305
|
+
"entries": { "table": {} },
|
|
306
|
+
"id": "public",
|
|
307
|
+
"kind": "postgres-schema"
|
|
308
|
+
},
|
|
309
|
+
"storage": {
|
|
310
|
+
"entries": { "table": {
|
|
311
|
+
"buckets": {
|
|
312
|
+
"columns": {
|
|
313
|
+
"created_at": {
|
|
314
|
+
"codecId": "pg/timestamptz@1",
|
|
315
|
+
"nativeType": "timestamptz",
|
|
316
|
+
"nullable": false,
|
|
317
|
+
"typeRef": "Timestamptz"
|
|
318
|
+
},
|
|
319
|
+
"id": {
|
|
320
|
+
"codecId": "pg/text@1",
|
|
321
|
+
"nativeType": "text",
|
|
322
|
+
"nullable": false
|
|
323
|
+
},
|
|
324
|
+
"name": {
|
|
325
|
+
"codecId": "pg/text@1",
|
|
326
|
+
"nativeType": "text",
|
|
327
|
+
"nullable": false
|
|
328
|
+
},
|
|
329
|
+
"updated_at": {
|
|
330
|
+
"codecId": "pg/timestamptz@1",
|
|
331
|
+
"nativeType": "timestamptz",
|
|
332
|
+
"nullable": false,
|
|
333
|
+
"typeRef": "Timestamptz"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
"foreignKeys": [],
|
|
337
|
+
"indexes": [],
|
|
338
|
+
"primaryKey": { "columns": ["id"] },
|
|
339
|
+
"uniques": []
|
|
340
|
+
},
|
|
341
|
+
"objects": {
|
|
342
|
+
"columns": {
|
|
343
|
+
"bucket_id": {
|
|
344
|
+
"codecId": "pg/text@1",
|
|
345
|
+
"nativeType": "text",
|
|
346
|
+
"nullable": false
|
|
347
|
+
},
|
|
348
|
+
"created_at": {
|
|
349
|
+
"codecId": "pg/timestamptz@1",
|
|
350
|
+
"nativeType": "timestamptz",
|
|
351
|
+
"nullable": false,
|
|
352
|
+
"typeRef": "Timestamptz"
|
|
353
|
+
},
|
|
354
|
+
"id": {
|
|
355
|
+
"codecId": "pg/text@1",
|
|
356
|
+
"nativeType": "uuid",
|
|
357
|
+
"nullable": false,
|
|
358
|
+
"typeRef": "Uuid"
|
|
359
|
+
},
|
|
360
|
+
"name": {
|
|
361
|
+
"codecId": "pg/text@1",
|
|
362
|
+
"nativeType": "text",
|
|
363
|
+
"nullable": false
|
|
364
|
+
},
|
|
365
|
+
"updated_at": {
|
|
366
|
+
"codecId": "pg/timestamptz@1",
|
|
367
|
+
"nativeType": "timestamptz",
|
|
368
|
+
"nullable": false,
|
|
369
|
+
"typeRef": "Timestamptz"
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"foreignKeys": [],
|
|
373
|
+
"indexes": [],
|
|
374
|
+
"primaryKey": { "columns": ["id"] },
|
|
375
|
+
"uniques": []
|
|
376
|
+
}
|
|
377
|
+
} },
|
|
378
|
+
"id": "storage",
|
|
379
|
+
"kind": "postgres-schema"
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"storageHash": "sha256:13b530a9c9fb26912d97f8a05dea26634242de75fb4af6b29337e4e7c7712876",
|
|
383
|
+
"types": {
|
|
384
|
+
"Timestamptz": {
|
|
385
|
+
"codecId": "pg/timestamptz@1",
|
|
386
|
+
"kind": "codec-instance",
|
|
387
|
+
"nativeType": "timestamptz",
|
|
388
|
+
"typeParams": {}
|
|
389
|
+
},
|
|
390
|
+
"Uuid": {
|
|
391
|
+
"codecId": "pg/text@1",
|
|
392
|
+
"kind": "codec-instance",
|
|
393
|
+
"nativeType": "uuid",
|
|
394
|
+
"typeParams": {}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
capabilities: {
|
|
399
|
+
"postgres": {
|
|
400
|
+
"distinctOn": true,
|
|
401
|
+
"jsonAgg": true,
|
|
402
|
+
"lateral": true,
|
|
403
|
+
"limit": true,
|
|
404
|
+
"orderBy": true,
|
|
405
|
+
"returning": true
|
|
406
|
+
},
|
|
407
|
+
"sql": {
|
|
408
|
+
"defaultInInsert": true,
|
|
409
|
+
"enums": true,
|
|
410
|
+
"lateral": true,
|
|
411
|
+
"returning": true
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
extensionPacks: {},
|
|
415
|
+
defaultControlPolicy: "external",
|
|
416
|
+
meta: {},
|
|
417
|
+
_generated: {
|
|
418
|
+
"warning": "⚠️ GENERATED FILE - DO NOT EDIT",
|
|
419
|
+
"message": "This file is automatically generated by \"prisma-next contract emit\".",
|
|
420
|
+
"regenerate": "To regenerate, run: prisma-next contract emit"
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/pack/index.ts
|
|
425
|
+
const SUPABASE_SPACE_ID = "supabase";
|
|
426
|
+
function buildContractSpace(contractOverride) {
|
|
427
|
+
const contract = blindCast(contractOverride ?? contract_default);
|
|
428
|
+
return {
|
|
429
|
+
contractJson: contract,
|
|
430
|
+
migrations: [],
|
|
431
|
+
headRef: {
|
|
432
|
+
hash: contract.storage.storageHash,
|
|
433
|
+
invariants: []
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
const supabasePackBase = {
|
|
438
|
+
kind: "extension",
|
|
439
|
+
id: SUPABASE_SPACE_ID,
|
|
440
|
+
familyId: "sql",
|
|
441
|
+
targetId: "postgres",
|
|
442
|
+
version,
|
|
443
|
+
contractSpace: buildContractSpace(),
|
|
444
|
+
create: () => ({
|
|
445
|
+
familyId: "sql",
|
|
446
|
+
targetId: "postgres"
|
|
447
|
+
})
|
|
448
|
+
};
|
|
449
|
+
const supabasePack = supabasePackBase;
|
|
450
|
+
/**
|
|
451
|
+
* Returns a pack using `contractOverride` in place of the shipped
|
|
452
|
+
* `contract.json` when provided, otherwise returns the default pack.
|
|
453
|
+
*
|
|
454
|
+
* Intended for tests that need to drive the framework with a synthetic
|
|
455
|
+
* contract while still exercising the full descriptor wiring.
|
|
456
|
+
*/
|
|
457
|
+
function supabasePackWith(options) {
|
|
458
|
+
if (options?.contractOverride === void 0) return supabasePack;
|
|
459
|
+
return {
|
|
460
|
+
...supabasePackBase,
|
|
461
|
+
contractSpace: buildContractSpace(options.contractOverride)
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
export { supabasePack as default, supabasePackWith };
|
|
466
|
+
|
|
467
|
+
//# sourceMappingURL=pack.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.mjs","names":["contractJson","packageJson.version"],"sources":["../package.json","../src/contract/contract.json","../src/pack/index.ts"],"sourcesContent":["","","import type { SqlControlExtensionDescriptor } from '@prisma-next/family-sql/control';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport type { Contract } from '../contract/contract.d';\nimport contractJson from '../contract/contract.json' with { type: 'json' };\n\nconst SUPABASE_SPACE_ID = 'supabase' as const;\n\nfunction buildContractSpace(contractOverride?: unknown) {\n const contract = blindCast<\n Contract,\n 'JSON import narrowed to emitted Contract type; assertDescriptorSelfConsistency verifies the storageHash at load time'\n >(contractOverride ?? contractJson);\n return {\n contractJson: contract,\n migrations: [] as const,\n headRef: { hash: contract.storage.storageHash, invariants: [] as const },\n };\n}\n\nconst supabaseContractSpace = buildContractSpace();\n\nconst supabasePackBase = {\n kind: 'extension' as const,\n id: SUPABASE_SPACE_ID,\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n version: packageJson.version,\n contractSpace: supabaseContractSpace,\n create: () => ({\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n }),\n} satisfies SqlControlExtensionDescriptor<'postgres'>;\n\nexport const supabasePack: SqlControlExtensionDescriptor<'postgres'> = supabasePackBase;\n\n/**\n * Returns a pack using `contractOverride` in place of the shipped\n * `contract.json` when provided, otherwise returns the default pack.\n *\n * Intended for tests that need to drive the framework with a synthetic\n * contract while still exercising the full descriptor wiring.\n */\nexport function supabasePackWith(options?: {\n contractOverride?: unknown;\n}): SqlControlExtensionDescriptor<'postgres'> {\n if (options?.contractOverride === undefined) return supabasePack;\n return {\n ...supabasePackBase,\n contractSpace: buildContractSpace(options.contractOverride),\n };\n}\n\nexport default supabasePack;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEMA,MAAM,oBAAoB;AAE1B,SAAS,mBAAmB,kBAA4B;CACtD,MAAM,WAAW,UAGf,oBAAoBA,gBAAY;CAClC,OAAO;EACL,cAAc;EACd,YAAY,CAAC;EACb,SAAS;GAAE,MAAM,SAAS,QAAQ;GAAa,YAAY,CAAC;EAAW;CACzE;AACF;AAIA,MAAM,mBAAmB;CACvB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,UAAU;CACDC;CACT,eAR4B,mBAQb;CACf,eAAe;EACb,UAAU;EACV,UAAU;CACZ;AACF;AAEA,MAAa,eAA0D;;;;;;;;AASvE,SAAgB,iBAAiB,SAEa;CAC5C,IAAI,SAAS,qBAAqB,KAAA,GAAW,OAAO;CACpD,OAAO;EACL,GAAG;EACH,eAAe,mBAAmB,QAAQ,gBAAgB;CAC5D;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SqlRuntimeExtensionDescriptor } from "@prisma-next/sql-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/exports/runtime.d.ts
|
|
4
|
+
declare const supabaseRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { supabaseRuntimeDescriptor as default };
|
|
7
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/exports/runtime.ts"],"mappings":";;;cAeM,yBAAA,EAA2B,6BAA6B"}
|
package/dist/runtime.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/exports/runtime.ts
|
|
2
|
+
const supabaseRuntimeDescriptor = {
|
|
3
|
+
kind: "extension",
|
|
4
|
+
id: "supabase",
|
|
5
|
+
version: "0.12.0",
|
|
6
|
+
familyId: "sql",
|
|
7
|
+
targetId: "postgres",
|
|
8
|
+
codecs: () => [],
|
|
9
|
+
create() {
|
|
10
|
+
return {
|
|
11
|
+
familyId: "sql",
|
|
12
|
+
targetId: "postgres"
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { supabaseRuntimeDescriptor as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/exports/runtime.ts"],"sourcesContent":["/**\n * Minimal M1 runtime descriptor for the Supabase extension.\n *\n * The Supabase pack contributes no runtime codec types or query operations in\n * M1 — `auth.*`/`storage.*` are external tables accessed via the stock\n * postgres runtime, not through a custom codec or operation surface. This\n * descriptor exists so the postgres runtime's contract-requirements check\n * (which verifies every `extensionPacks` entry in the emitted `contract.json`\n * has a matching runtime component) passes.\n *\n * TODO(M2): Replace with the real SupabaseRuntime that adds\n * `asUser()`/`asAnon()` role-binding and the Supabase auth surface.\n */\nimport type { SqlRuntimeExtensionDescriptor } from '@prisma-next/sql-runtime';\n\nconst supabaseRuntimeDescriptor: SqlRuntimeExtensionDescriptor<'postgres'> = {\n kind: 'extension' as const,\n id: 'supabase',\n version: '0.12.0',\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n codecs: () => [],\n create() {\n return {\n familyId: 'sql' as const,\n targetId: 'postgres' as const,\n };\n },\n};\n\nexport default supabaseRuntimeDescriptor;\n"],"mappings":";AAeA,MAAM,4BAAuE;CAC3E,MAAM;CACN,IAAI;CACJ,SAAS;CACT,UAAU;CACV,UAAU;CACV,cAAc,CAAC;CACf,SAAS;EACP,OAAO;GACL,UAAU;GACV,UAAU;EACZ;CACF;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Client } from "pg";
|
|
2
|
+
|
|
3
|
+
//#region test/supabase-bootstrap.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Seeds the database with the external Supabase schemas and tables. The
|
|
6
|
+
* caller passes an already-connected `pg.Client` — this function does not
|
|
7
|
+
* open or close connections, so the same client can be reused across the
|
|
8
|
+
* test's other setup steps.
|
|
9
|
+
*
|
|
10
|
+
* Creates two schemas (`auth`, `storage`) and four tables whose columns
|
|
11
|
+
* exactly match the `@prisma-next/extension-supabase` contract:
|
|
12
|
+
*
|
|
13
|
+
* - `auth.users` — id uuid PK, email text, created_at timestamptz, updated_at timestamptz
|
|
14
|
+
* - `auth.identities` — id uuid PK, user_id uuid, provider text, created_at timestamptz, updated_at timestamptz
|
|
15
|
+
* - `storage.buckets` — id text PK, name text, created_at timestamptz, updated_at timestamptz
|
|
16
|
+
* - `storage.objects` — id uuid PK, bucket_id text, name text, created_at timestamptz, updated_at timestamptz
|
|
17
|
+
*
|
|
18
|
+
* Does NOT create Postgres roles or `auth.*` functions — those are added by
|
|
19
|
+
* the `postgres-rls` constituent.
|
|
20
|
+
*/
|
|
21
|
+
declare function bootstrapSupabaseShim(client: Client): Promise<void>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { bootstrapSupabaseShim };
|
|
24
|
+
//# sourceMappingURL=utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../test/supabase-bootstrap.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAoDsB,qBAAA,CAAsB,MAAA,EAAQ,MAAA,GAAS,OAAO"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region test/supabase-bootstrap.ts
|
|
2
|
+
/**
|
|
3
|
+
* Seeds the database with the external Supabase schemas and tables. The
|
|
4
|
+
* caller passes an already-connected `pg.Client` — this function does not
|
|
5
|
+
* open or close connections, so the same client can be reused across the
|
|
6
|
+
* test's other setup steps.
|
|
7
|
+
*
|
|
8
|
+
* Creates two schemas (`auth`, `storage`) and four tables whose columns
|
|
9
|
+
* exactly match the `@prisma-next/extension-supabase` contract:
|
|
10
|
+
*
|
|
11
|
+
* - `auth.users` — id uuid PK, email text, created_at timestamptz, updated_at timestamptz
|
|
12
|
+
* - `auth.identities` — id uuid PK, user_id uuid, provider text, created_at timestamptz, updated_at timestamptz
|
|
13
|
+
* - `storage.buckets` — id text PK, name text, created_at timestamptz, updated_at timestamptz
|
|
14
|
+
* - `storage.objects` — id uuid PK, bucket_id text, name text, created_at timestamptz, updated_at timestamptz
|
|
15
|
+
*
|
|
16
|
+
* Does NOT create Postgres roles or `auth.*` functions — those are added by
|
|
17
|
+
* the `postgres-rls` constituent.
|
|
18
|
+
*/
|
|
19
|
+
async function bootstrapSupabaseShim(client) {
|
|
20
|
+
await client.query("CREATE SCHEMA IF NOT EXISTS auth");
|
|
21
|
+
await client.query("CREATE SCHEMA IF NOT EXISTS storage");
|
|
22
|
+
await client.query(`
|
|
23
|
+
CREATE TABLE IF NOT EXISTS auth.users (
|
|
24
|
+
id uuid NOT NULL,
|
|
25
|
+
email text NOT NULL,
|
|
26
|
+
created_at timestamptz NOT NULL,
|
|
27
|
+
updated_at timestamptz NOT NULL,
|
|
28
|
+
PRIMARY KEY (id)
|
|
29
|
+
)
|
|
30
|
+
`);
|
|
31
|
+
await client.query(`
|
|
32
|
+
CREATE TABLE IF NOT EXISTS auth.identities (
|
|
33
|
+
id uuid NOT NULL,
|
|
34
|
+
user_id uuid NOT NULL,
|
|
35
|
+
provider text NOT NULL,
|
|
36
|
+
created_at timestamptz NOT NULL,
|
|
37
|
+
updated_at timestamptz NOT NULL,
|
|
38
|
+
PRIMARY KEY (id)
|
|
39
|
+
)
|
|
40
|
+
`);
|
|
41
|
+
await client.query(`
|
|
42
|
+
CREATE TABLE IF NOT EXISTS storage.buckets (
|
|
43
|
+
id text NOT NULL,
|
|
44
|
+
name text NOT NULL,
|
|
45
|
+
created_at timestamptz NOT NULL,
|
|
46
|
+
updated_at timestamptz NOT NULL,
|
|
47
|
+
PRIMARY KEY (id)
|
|
48
|
+
)
|
|
49
|
+
`);
|
|
50
|
+
await client.query(`
|
|
51
|
+
CREATE TABLE IF NOT EXISTS storage.objects (
|
|
52
|
+
id uuid NOT NULL,
|
|
53
|
+
bucket_id text NOT NULL,
|
|
54
|
+
name text NOT NULL,
|
|
55
|
+
created_at timestamptz NOT NULL,
|
|
56
|
+
updated_at timestamptz NOT NULL,
|
|
57
|
+
PRIMARY KEY (id)
|
|
58
|
+
)
|
|
59
|
+
`);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { bootstrapSupabaseShim };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../test/supabase-bootstrap.ts"],"sourcesContent":["/**\n * Shared Supabase test fixture — seeds the external schemas and tables.\n *\n * Seeds a Postgres/PGlite database with the external Supabase schemas and\n * tables that the framework verifier expects when a composed contract declares\n * `auth.*` and `storage.*` tables as `external`. Without these tables present,\n * `db init`/`db update` will fail at the verify step because the framework\n * confirms declared `external` tables exist.\n *\n * **M1 scope:** `CREATE SCHEMA auth, storage` + the four tables\n * (`auth.users`, `auth.identities`, `storage.buckets`, `storage.objects`) with\n * columns matching the Supabase extension contract's pinned model table.\n *\n * **Future increments:**\n * - `postgres-rls` constituent adds Postgres roles (`anon`, `authenticated`,\n * `service_role`) and the `auth.uid()`, `auth.jwt()`, `auth.role()` functions.\n * - `cross-contract-refs` constituent seeds `auth.users` rows for FK tests.\n *\n * The caller owns the client lifecycle — pass any already-connected `pg.Client`\n * (e.g. one the test is sharing across setup steps, or one bound to a\n * transaction for isolation). Convenience wrapper for tests that don't already\n * have one:\n *\n * @example\n * ```ts\n * import { withClient } from '@prisma-next/test-utils';\n * import { bootstrapSupabaseShim } from '@prisma-next/extension-supabase/test/utils';\n *\n * await withClient(connectionString, async (client) => {\n * await bootstrapSupabaseShim(client);\n * });\n * ```\n */\nimport type { Client } from 'pg';\n\n/**\n * Seeds the database with the external Supabase schemas and tables. The\n * caller passes an already-connected `pg.Client` — this function does not\n * open or close connections, so the same client can be reused across the\n * test's other setup steps.\n *\n * Creates two schemas (`auth`, `storage`) and four tables whose columns\n * exactly match the `@prisma-next/extension-supabase` contract:\n *\n * - `auth.users` — id uuid PK, email text, created_at timestamptz, updated_at timestamptz\n * - `auth.identities` — id uuid PK, user_id uuid, provider text, created_at timestamptz, updated_at timestamptz\n * - `storage.buckets` — id text PK, name text, created_at timestamptz, updated_at timestamptz\n * - `storage.objects` — id uuid PK, bucket_id text, name text, created_at timestamptz, updated_at timestamptz\n *\n * Does NOT create Postgres roles or `auth.*` functions — those are added by\n * the `postgres-rls` constituent.\n */\nexport async function bootstrapSupabaseShim(client: Client): Promise<void> {\n await client.query('CREATE SCHEMA IF NOT EXISTS auth');\n await client.query('CREATE SCHEMA IF NOT EXISTS storage');\n\n await client.query(`\n CREATE TABLE IF NOT EXISTS auth.users (\n id uuid NOT NULL,\n email text NOT NULL,\n created_at timestamptz NOT NULL,\n updated_at timestamptz NOT NULL,\n PRIMARY KEY (id)\n )\n `);\n\n await client.query(`\n CREATE TABLE IF NOT EXISTS auth.identities (\n id uuid NOT NULL,\n user_id uuid NOT NULL,\n provider text NOT NULL,\n created_at timestamptz NOT NULL,\n updated_at timestamptz NOT NULL,\n PRIMARY KEY (id)\n )\n `);\n\n await client.query(`\n CREATE TABLE IF NOT EXISTS storage.buckets (\n id text NOT NULL,\n name text NOT NULL,\n created_at timestamptz NOT NULL,\n updated_at timestamptz NOT NULL,\n PRIMARY KEY (id)\n )\n `);\n\n await client.query(`\n CREATE TABLE IF NOT EXISTS storage.objects (\n id uuid NOT NULL,\n bucket_id text NOT NULL,\n name text NOT NULL,\n created_at timestamptz NOT NULL,\n updated_at timestamptz NOT NULL,\n PRIMARY KEY (id)\n )\n `);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoDA,eAAsB,sBAAsB,QAA+B;CACzE,MAAM,OAAO,MAAM,kCAAkC;CACrD,MAAM,OAAO,MAAM,qCAAqC;CAExD,MAAM,OAAO,MAAM;;;;;;;;GAQlB;CAED,MAAM,OAAO,MAAM;;;;;;;;;GASlB;CAED,MAAM,OAAO,MAAM;;;;;;;;GAQlB;CAED,MAAM,OAAO,MAAM;;;;;;;;;GASlB;AACH"}
|