@coffre/db 0.4.5 → 0.5.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/connect.d.ts +1 -1
- package/dist/{database-edkMkG02.d.ts → database-C63WjCrC.d.ts} +1 -1
- package/dist/dialect.d.ts +7 -1
- package/dist/dialect.js +12 -1
- package/dist/grants.d.ts +105 -10
- package/dist/grants.js +207 -7
- package/dist/hyperdrive.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/log.d.ts +392 -2
- package/dist/log.js +53 -1
- package/dist/migrations/postgres/0002_instance_roles.sql +4 -0
- package/dist/migrations/postgres/0003_credential_scopes.sql +4 -0
- package/dist/migrations/postgres/meta/0002_snapshot.json +2860 -0
- package/dist/migrations/postgres/meta/0003_snapshot.json +2872 -0
- package/dist/migrations/postgres/meta/_journal.json +14 -0
- package/dist/migrations/sqlite/0002_instance_roles.sql +2 -0
- package/dist/migrations/sqlite/0003_credential_scopes.sql +2 -0
- package/dist/migrations/sqlite/meta/0002_snapshot.json +2594 -0
- package/dist/migrations/sqlite/meta/0003_snapshot.json +2608 -0
- package/dist/migrations/sqlite/meta/_journal.json +14 -0
- package/dist/portable.d.ts +2 -2
- package/dist/{schema-BqCB3XFm.d.ts → schema-a7PkFgea.d.ts} +68 -0
- package/dist/schema-sqlite.d.ts +76 -0
- package/dist/schema-sqlite.js +4 -0
- package/dist/schema-version.d.ts +1 -1
- package/dist/schema-version.js +60 -26
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +4 -0
- package/package.json +2 -2
- package/src/dialect.ts +14 -0
- package/src/grants.ts +272 -11
- package/src/log.ts +66 -2
- package/src/migrations/postgres/0002_instance_roles.sql +4 -0
- package/src/migrations/postgres/0003_credential_scopes.sql +4 -0
- package/src/migrations/postgres/meta/0002_snapshot.json +2860 -0
- package/src/migrations/postgres/meta/0003_snapshot.json +2872 -0
- package/src/migrations/postgres/meta/_journal.json +14 -0
- package/src/migrations/sqlite/0002_instance_roles.sql +2 -0
- package/src/migrations/sqlite/0003_credential_scopes.sql +2 -0
- package/src/migrations/sqlite/meta/0002_snapshot.json +2594 -0
- package/src/migrations/sqlite/meta/0003_snapshot.json +2608 -0
- package/src/migrations/sqlite/meta/_journal.json +14 -0
- package/src/schema.sqlite.ts +6 -0
- package/src/schema.ts +11 -1
|
@@ -15,6 +15,20 @@
|
|
|
15
15
|
"when": 1791242675074,
|
|
16
16
|
"tag": "0001_mcp_approvals",
|
|
17
17
|
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "6",
|
|
22
|
+
"when": 1791619334012,
|
|
23
|
+
"tag": "0002_instance_roles",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1791676487593,
|
|
30
|
+
"tag": "0003_credential_scopes",
|
|
31
|
+
"breakpoints": true
|
|
18
32
|
}
|
|
19
33
|
]
|
|
20
34
|
}
|
package/src/schema.sqlite.ts
CHANGED
|
@@ -204,6 +204,8 @@ export const vaultMembers = sqliteTable(
|
|
|
204
204
|
principal: text().primaryKey(),
|
|
205
205
|
status: text().notNull(),
|
|
206
206
|
owner: flag('owner').notNull().default(false),
|
|
207
|
+
role: text(),
|
|
208
|
+
scope: text(),
|
|
207
209
|
generation: integer().notNull().default(0),
|
|
208
210
|
createdAt: integer('created_at', { mode: 'number' }).notNull(),
|
|
209
211
|
createdBy: text('created_by').notNull(),
|
|
@@ -478,6 +480,8 @@ export const serviceBindings = sqliteTable(
|
|
|
478
480
|
jwksUri: text('jwks_uri').notNull(),
|
|
479
481
|
// JSON, sorted by claim name.
|
|
480
482
|
claims: text().notNull(),
|
|
483
|
+
// What the credentials it issues reach (`CredentialScope`), JSON; null on a binding of 0.4 the app has not sealed yet.
|
|
484
|
+
scope: text(),
|
|
481
485
|
label: text(),
|
|
482
486
|
createdAt: createdAt(),
|
|
483
487
|
createdBy: text('created_by').notNull(),
|
|
@@ -637,6 +641,8 @@ export const credentials = sqliteTable(
|
|
|
637
641
|
// The member it acts as, `user:<email>` or `token:<id>`, under the generation it was issued in.
|
|
638
642
|
principal: text().notNull(),
|
|
639
643
|
identityId: text('identity_id'),
|
|
644
|
+
// What a service token reaches (`CredentialScope`), JSON: null for a session, one a binding issued (its binding's), or one of 0.4 the app has not sealed yet.
|
|
645
|
+
scope: text(),
|
|
640
646
|
label: text(),
|
|
641
647
|
createdAt: createdAt(),
|
|
642
648
|
createdBy: text('created_by').notNull(),
|
package/src/schema.ts
CHANGED
|
@@ -204,9 +204,15 @@ export const vaultMembers = pgTable(
|
|
|
204
204
|
{
|
|
205
205
|
principal: text().primaryKey(),
|
|
206
206
|
status: text().notNull(),
|
|
207
|
-
// An
|
|
207
|
+
// An owner of 0.4: an Admin, unless `role` says otherwise. Written as
|
|
208
|
+
// whether `role` administers, for a vault of 0.4 to read. Root admins
|
|
208
209
|
// come from the vault's configuration, never from a row.
|
|
209
210
|
owner: boolean().notNull().default(false),
|
|
211
|
+
// A person's instance role (`INSTANCE_ROLES` in @coffre/core/access),
|
|
212
|
+
// and where it applies, as JSON (`Scope`, projects by id); null on a row
|
|
213
|
+
// no vault of 0.5 has written, which `owner` says all of.
|
|
214
|
+
role: text(),
|
|
215
|
+
scope: text(),
|
|
210
216
|
// Advanced by each removal. A session, token or linked account issued
|
|
211
217
|
// under an older generation is dead, whatever its own row says.
|
|
212
218
|
generation: integer().notNull().default(0),
|
|
@@ -519,6 +525,8 @@ export const serviceBindings = pgTable(
|
|
|
519
525
|
jwksUri: text('jwks_uri').notNull(),
|
|
520
526
|
// JSON, sorted by claim name.
|
|
521
527
|
claims: text().notNull(),
|
|
528
|
+
// What the credentials it issues reach (`CredentialScope`), JSON; null on a binding of 0.4 the app has not sealed yet.
|
|
529
|
+
scope: text(),
|
|
522
530
|
label: text(),
|
|
523
531
|
createdAt: createdAt(),
|
|
524
532
|
createdBy: text('created_by').notNull(),
|
|
@@ -702,6 +710,8 @@ export const credentials = pgTable(
|
|
|
702
710
|
// The member it acts as, `user:<email>` or `token:<id>`, under the generation it was issued in.
|
|
703
711
|
principal: text().notNull(),
|
|
704
712
|
identityId: uuid('identity_id'),
|
|
713
|
+
// What a service token reaches (`CredentialScope`), JSON: null for a session, one a binding issued (its binding's), or one of 0.4 the app has not sealed yet.
|
|
714
|
+
scope: text(),
|
|
705
715
|
label: text(),
|
|
706
716
|
createdAt: createdAt(),
|
|
707
717
|
createdBy: text('created_by').notNull(),
|