@coffre/db 0.8.1 → 0.9.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-BEnexh-3.d.ts → database-hd1hAll-.d.ts} +1 -1
- package/dist/dialect.d.ts +1 -1
- package/dist/grants.d.ts +1 -1
- package/dist/hyperdrive.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/log.d.ts +1 -1
- package/dist/migrations/postgres/0010_handle_places.sql +2 -0
- package/dist/migrations/postgres/0011_plain_values.sql +19 -0
- package/dist/migrations/postgres/meta/0010_snapshot.json +2991 -0
- package/dist/migrations/postgres/meta/0011_snapshot.json +2997 -0
- package/dist/migrations/postgres/meta/_journal.json +14 -0
- package/dist/migrations/sqlite/0010_handle_places.sql +2 -0
- package/dist/migrations/sqlite/0011_plain_values.sql +14 -0
- package/dist/migrations/sqlite/meta/0010_snapshot.json +2711 -0
- package/dist/migrations/sqlite/meta/0011_snapshot.json +2718 -0
- package/dist/migrations/sqlite/meta/_journal.json +14 -0
- package/dist/portable.d.ts +2 -2
- package/dist/{schema-BZRkBJQZ.d.ts → schema-CCYKTG-E.d.ts} +34 -0
- package/dist/schema-sqlite.d.ts +38 -0
- package/dist/schema-sqlite.js +3 -1
- package/dist/schema-version.d.ts +1 -1
- package/dist/schema-version.js +28 -0
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +3 -1
- package/package.json +2 -2
- package/src/migrations/postgres/0010_handle_places.sql +2 -0
- package/src/migrations/postgres/0011_plain_values.sql +19 -0
- package/src/migrations/postgres/meta/0010_snapshot.json +2991 -0
- package/src/migrations/postgres/meta/0011_snapshot.json +2997 -0
- package/src/migrations/postgres/meta/_journal.json +14 -0
- package/src/migrations/sqlite/0010_handle_places.sql +2 -0
- package/src/migrations/sqlite/0011_plain_values.sql +14 -0
- package/src/migrations/sqlite/meta/0010_snapshot.json +2711 -0
- package/src/migrations/sqlite/meta/0011_snapshot.json +2718 -0
- package/src/migrations/sqlite/meta/_journal.json +14 -0
- package/src/schema.sqlite.ts +7 -0
- package/src/schema.ts +7 -0
package/dist/connect.d.ts
CHANGED
package/dist/dialect.d.ts
CHANGED
package/dist/grants.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Queryable } from "./database-
|
|
1
|
+
import { i as Queryable } from "./database-hd1hAll-.js";
|
|
2
2
|
import { Authenticity, Newest } from "./log.js";
|
|
3
3
|
import { Conversion, ConversionInput, InstanceRole, Scope } from "@coffre/core/access";
|
|
4
4
|
import { StoredEntry } from "@coffre/core/audit";
|
package/dist/hyperdrive.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { m as schema_d_exports } from "./schema-
|
|
2
|
-
import { a as Transaction, c as tablesOf, i as Queryable, n as PoolLike, o as createDatabase, r as QueryOutsideTransaction, s as own, t as Database } from "./database-
|
|
1
|
+
import { m as schema_d_exports } from "./schema-CCYKTG-E.js";
|
|
2
|
+
import { a as Transaction, c as tablesOf, i as Queryable, n as PoolLike, o as createDatabase, r as QueryOutsideTransaction, s as own, t as Database } from "./database-hd1hAll-.js";
|
|
3
3
|
export { Database, PoolLike, QueryOutsideTransaction, Queryable, Transaction, createDatabase, own, schema_d_exports as schema, tablesOf };
|
package/dist/log.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Transaction, i as Queryable } from "./database-
|
|
1
|
+
import { a as Transaction, i as Queryable } from "./database-hd1hAll-.js";
|
|
2
2
|
import { SQL } from "drizzle-orm";
|
|
3
3
|
import { LogKey, StoredEntry } from "@coffre/core/audit";
|
|
4
4
|
//#region src/log.d.ts
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
-- A handle's places (0.9): the environments it was made for, by id and whether as @me, which the proxy's stable URL resolves to. A nullable column the release before neither reads nor writes; the app sets it when it makes a handle, and never after (no UPDATE grant).
|
|
2
|
+
ALTER TABLE "credentials" ADD COLUMN "places" text;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Plain values (0.9): a version of a key marked not secret holds its value in the clear too. Nullable, so the release before writes on as it did.
|
|
2
|
+
ALTER TABLE "secret_versions" ADD COLUMN "plaintext" text;--> statement-breakpoint
|
|
3
|
+
-- A version is still only ever erased, and an erased one holds no value, in the clear or not.
|
|
4
|
+
CREATE OR REPLACE FUNCTION secret_versions_erase_only() RETURNS trigger LANGUAGE plpgsql AS $$
|
|
5
|
+
BEGIN
|
|
6
|
+
IF octet_length(NEW.ciphertext) <> 0 OR octet_length(NEW.wrapped_dek) <> 0 OR NEW.plaintext IS NOT NULL
|
|
7
|
+
OR (NEW.id, NEW.secret_id, NEW.version, NEW.envelope_version, NEW.iv, NEW.auth_tag,
|
|
8
|
+
NEW.kek_provider, NEW.kek_id, NEW.kek_version, NEW.created_at, NEW.created_by,
|
|
9
|
+
NEW.recipe, NEW.pair_id, NEW.pair_half)
|
|
10
|
+
IS DISTINCT FROM
|
|
11
|
+
(OLD.id, OLD.secret_id, OLD.version, OLD.envelope_version, OLD.iv, OLD.auth_tag,
|
|
12
|
+
OLD.kek_provider, OLD.kek_id, OLD.kek_version, OLD.created_at, OLD.created_by,
|
|
13
|
+
OLD.recipe, OLD.pair_id, OLD.pair_half) THEN
|
|
14
|
+
RAISE EXCEPTION 'a secret version is only ever erased' USING ERRCODE = 'insufficient_privilege';
|
|
15
|
+
END IF;
|
|
16
|
+
RETURN NEW;
|
|
17
|
+
END
|
|
18
|
+
$$;--> statement-breakpoint
|
|
19
|
+
GRANT UPDATE (plaintext) ON secret_versions TO coffre_app;
|