@secondlayer/shared 6.3.5 → 6.4.1

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.
Files changed (31) hide show
  1. package/dist/src/crypto/secrets.js +2 -5
  2. package/dist/src/crypto/secrets.js.map +3 -3
  3. package/dist/src/db/index.d.ts +3 -1
  4. package/dist/src/db/queries/account-spend-caps.d.ts +3 -1
  5. package/dist/src/db/queries/account-usage.d.ts +3 -1
  6. package/dist/src/db/queries/accounts.d.ts +3 -1
  7. package/dist/src/db/queries/chain-reorgs.d.ts +3 -1
  8. package/dist/src/db/queries/integrity.d.ts +3 -1
  9. package/dist/src/db/queries/projects.d.ts +3 -1
  10. package/dist/src/db/queries/provisioning-audit.d.ts +3 -1
  11. package/dist/src/db/queries/subgraph-gaps.d.ts +3 -1
  12. package/dist/src/db/queries/subgraph-operations.d.ts +3 -1
  13. package/dist/src/db/queries/subgraphs.d.ts +3 -1
  14. package/dist/src/db/queries/subscriptions.d.ts +3 -1
  15. package/dist/src/db/queries/subscriptions.js +2 -5
  16. package/dist/src/db/queries/subscriptions.js.map +3 -3
  17. package/dist/src/db/queries/tenant-compute-addons.d.ts +3 -1
  18. package/dist/src/db/queries/usage.d.ts +3 -1
  19. package/dist/src/db/schema.d.ts +3 -1
  20. package/dist/src/index.d.ts +3 -1
  21. package/dist/src/mode.d.ts +6 -12
  22. package/dist/src/mode.js +2 -6
  23. package/dist/src/mode.js.map +3 -3
  24. package/dist/src/node/local-client.d.ts +3 -1
  25. package/migrations/0075_restore_subgraphs_on_platform.ts +166 -0
  26. package/migrations/0076_deprecate_tenants.ts +19 -0
  27. package/migrations/0077_subscription_deliveries_outbox_set_null.ts +50 -0
  28. package/package.json +1 -1
  29. package/dist/src/db/queries/tenants.d.ts +0 -800
  30. package/dist/src/db/queries/tenants.js +0 -308
  31. package/dist/src/db/queries/tenants.js.map +0 -12
@@ -0,0 +1,19 @@
1
+ import { type Kysely, sql } from "kysely";
2
+
3
+ /**
4
+ * Mark the `tenants` table deprecated. The 2026-05-14 shared-rip pivot
5
+ * collapsed the dedicated per-tenant model — no live writers remain. Rows
6
+ * are preserved here for post-pivot reconciliation. A follow-up migration
7
+ * will `DROP TABLE` after a 2-cycle observation window when we're sure no
8
+ * Stripe-dormant reader references `tenants.plan`.
9
+ */
10
+ export async function up(db: Kysely<unknown>): Promise<void> {
11
+ await sql`
12
+ COMMENT ON TABLE tenants IS
13
+ 'DEPRECATED 2026-05-16: post shared-rip, no live writers. Drop after observation window.'
14
+ `.execute(db);
15
+ }
16
+
17
+ export async function down(_db: Kysely<unknown>): Promise<void> {
18
+ // No-op — restoring the comment to nothing on rollback is not useful.
19
+ }
@@ -0,0 +1,50 @@
1
+ import { type Kysely, sql } from "kysely";
2
+
3
+ /**
4
+ * Loosen `subscription_deliveries.outbox_id` FK from `ON DELETE CASCADE` to
5
+ * `ON DELETE SET NULL` so phantom outbox deletes (cleanup races, manual
6
+ * requeue, subscription delete mid-dispatch) don't 23503 the delivery
7
+ * insert and snowball into auto-paused subscriptions via the circuit
8
+ * breaker.
9
+ *
10
+ * Delivery rows are append-only telemetry; the subscription_id column is
11
+ * the load-bearing reference. Losing the outbox link on a small minority of
12
+ * rows is preferable to losing the entire delivery record.
13
+ */
14
+ export async function up(db: Kysely<unknown>): Promise<void> {
15
+ await sql`
16
+ ALTER TABLE subscription_deliveries
17
+ ALTER COLUMN outbox_id DROP NOT NULL
18
+ `.execute(db);
19
+
20
+ await sql`
21
+ ALTER TABLE subscription_deliveries
22
+ DROP CONSTRAINT IF EXISTS subscription_deliveries_outbox_id_fkey
23
+ `.execute(db);
24
+
25
+ await sql`
26
+ ALTER TABLE subscription_deliveries
27
+ ADD CONSTRAINT subscription_deliveries_outbox_id_fkey
28
+ FOREIGN KEY (outbox_id) REFERENCES subscription_outbox(id)
29
+ ON DELETE SET NULL
30
+ `.execute(db);
31
+ }
32
+
33
+ export async function down(db: Kysely<unknown>): Promise<void> {
34
+ await sql`
35
+ ALTER TABLE subscription_deliveries
36
+ DROP CONSTRAINT IF EXISTS subscription_deliveries_outbox_id_fkey
37
+ `.execute(db);
38
+
39
+ await sql`
40
+ ALTER TABLE subscription_deliveries
41
+ ADD CONSTRAINT subscription_deliveries_outbox_id_fkey
42
+ FOREIGN KEY (outbox_id) REFERENCES subscription_outbox(id)
43
+ ON DELETE CASCADE
44
+ `.execute(db);
45
+
46
+ await sql`
47
+ ALTER TABLE subscription_deliveries
48
+ ALTER COLUMN outbox_id SET NOT NULL
49
+ `.execute(db);
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "6.3.5",
3
+ "version": "6.4.1",
4
4
  "type": "module",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",