@coffre/db 0.7.0 → 0.8.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.
@@ -64,6 +64,13 @@
64
64
  "when": 1792255560312,
65
65
  "tag": "0008_recipes",
66
66
  "breakpoints": true
67
+ },
68
+ {
69
+ "idx": 9,
70
+ "version": "6",
71
+ "when": 1792281880190,
72
+ "tag": "0009_handles",
73
+ "breakpoints": true
67
74
  }
68
75
  ]
69
76
  }
@@ -497,7 +497,7 @@ const credentials = sqliteTable("credentials", {
497
497
  revokedBy: text("revoked_by")
498
498
  }, (table) => [
499
499
  unique("credentials_token_hash_key").on(table.tokenHash),
500
- check("credentials_kind_check", sql`${table.kind} IN ('browser', 'cli', 'service', 'personal')`),
500
+ check("credentials_kind_check", sql`${table.kind} IN ('browser', 'cli', 'service', 'personal', 'handle')`),
501
501
  check("credentials_principal_check", sql`${table.principal} LIKE 'user:%' OR ${table.principal} LIKE 'token:%'`),
502
502
  check("credentials_kind_matches_principal", sql`(${table.kind} = 'service') = (${table.principal} LIKE 'token:%')`),
503
503
  check("credentials_token_hash_check", sql`octet_length(${table.tokenHash}) = 32`),
@@ -71,6 +71,13 @@ const KNOWN_MIGRATIONS = {
71
71
  "when": 1792255559691,
72
72
  "tag": "0008_recipes",
73
73
  "breakpoints": true
74
+ },
75
+ {
76
+ "idx": 9,
77
+ "version": "7",
78
+ "when": 1792281879553,
79
+ "tag": "0009_handles",
80
+ "breakpoints": true
74
81
  }
75
82
  ].map((entry) => entry.tag),
76
83
  sqlite: [
@@ -136,6 +143,13 @@ const KNOWN_MIGRATIONS = {
136
143
  "when": 1792255560312,
137
144
  "tag": "0008_recipes",
138
145
  "breakpoints": true
146
+ },
147
+ {
148
+ "idx": 9,
149
+ "version": "6",
150
+ "when": 1792281880190,
151
+ "tag": "0009_handles",
152
+ "breakpoints": true
139
153
  }
140
154
  ].map((entry) => entry.tag)
141
155
  };
package/dist/schema.js CHANGED
@@ -563,7 +563,7 @@ const credentials = pgTable("credentials", {
563
563
  revokedBy: text("revoked_by")
564
564
  }, (table) => [
565
565
  unique("credentials_token_hash_key").on(table.tokenHash),
566
- check("credentials_kind_check", sql`${table.kind} IN ('browser', 'cli', 'service', 'personal')`),
566
+ check("credentials_kind_check", sql`${table.kind} IN ('browser', 'cli', 'service', 'personal', 'handle')`),
567
567
  check("credentials_principal_check", sql`${table.principal} LIKE 'user:%' OR ${table.principal} LIKE 'token:%'`),
568
568
  check("credentials_kind_matches_principal", sql`(${table.kind} = 'service') = (${table.principal} LIKE 'token:%')`),
569
569
  check("credentials_token_hash_check", sql`octet_length(${table.tokenHash}) = 32`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffre/db",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "coffre's database: the schema, its migrations and the connections, on Postgres or SQLite.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -79,7 +79,7 @@
79
79
  "drizzle-orm": "0.45.2",
80
80
  "pg": "8.16.3",
81
81
  "pg-connection-string": "2.14.0",
82
- "@coffre/core": "0.7.0"
82
+ "@coffre/core": "0.8.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/node": "26.1.1",
@@ -0,0 +1,3 @@
1
+ -- Handles (0.8): the stand-ins a person's app holds, which reach only the credential proxy. The check widens to their kind: the release before makes none, and refuses one, whose prefix, coffre_use_, it does not take for a token.
2
+ ALTER TABLE "credentials" DROP CONSTRAINT "credentials_kind_check";--> statement-breakpoint
3
+ ALTER TABLE "credentials" ADD CONSTRAINT "credentials_kind_check" CHECK ("credentials"."kind" IN ('browser', 'cli', 'service', 'personal', 'handle'));