@byok-sdk/cloud-dataplane 0.17.0 → 0.19.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.
@@ -0,0 +1,31 @@
1
+ -- Replay-key schema discriminator segment (contract §8.2(2), disposition R2-B09).
2
+ --
3
+ -- `byok-task-assertion-v1` shares this single-use ledger with
4
+ -- `byok-device-assertion-v1` rather than getting a second table: one replay
5
+ -- authority, one atomicity story, one retention sweep. What the two lanes must
6
+ -- NOT share is a key slot — the same `jti` presented under both envelope kinds
7
+ -- has to be consumable exactly once per kind, and the two consumption ledgers
8
+ -- have to stay distinguishable for audit. So the primary key gains a `schema`
9
+ -- segment and becomes
10
+ -- `(tenant_id, issuer, product_id, device_id, audience, schema, jti)`.
11
+ --
12
+ -- The DEFAULT here is a one-shot backfill, not a steady-state fallback: every
13
+ -- row that exists when this runs is a device assertion (the task envelope has
14
+ -- no writer before this migration), and the default is dropped in the same
15
+ -- transaction so every subsequent INSERT must state its lane explicitly. A
16
+ -- writer that forgets now fails; it does not silently land in the device lane.
17
+
18
+ ALTER TABLE device_assertion_replay
19
+ ADD COLUMN schema TEXT NOT NULL DEFAULT 'byok-device-assertion-v1';
20
+
21
+ ALTER TABLE device_assertion_replay
22
+ ALTER COLUMN schema DROP DEFAULT;
23
+
24
+ ALTER TABLE device_assertion_replay
25
+ ADD CONSTRAINT device_assertion_replay_schema_shape CHECK (
26
+ schema IN ('byok-device-assertion-v1', 'byok-task-assertion-v1')
27
+ );
28
+
29
+ ALTER TABLE device_assertion_replay DROP CONSTRAINT device_assertion_replay_pkey;
30
+ ALTER TABLE device_assertion_replay
31
+ ADD PRIMARY KEY (tenant_id, issuer, product_id, device_id, audience, schema, jti);
@@ -59,6 +59,10 @@ export declare class PostgresTaskAttemptStore implements TaskAttemptStore {
59
59
  readonly messageId: string;
60
60
  readonly payloadBody: string;
61
61
  }): Promise<'reserved' | 'pending' | 'rejected'>;
62
+ readTaskAgentMessage(tenant: TenantId, input: {
63
+ readonly taskId: string;
64
+ readonly deviceId: string;
65
+ }): Promise<AgentMessageAdmission | undefined>;
62
66
  readAgentMessage(tenant: TenantId, input: {
63
67
  readonly taskId: string;
64
68
  readonly deviceId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/cloud-dataplane",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "BYOK SDK hosted data plane: canonical Postgres + R2 stores, migrations, truth transactions, and maintenance",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,9 +49,9 @@
49
49
  "clean": "rm -rf dist"
50
50
  },
51
51
  "dependencies": {
52
- "@byok-sdk/cloud": "0.17.0",
53
- "@byok-sdk/core": "0.17.0",
54
- "@byok-sdk/protocol": "0.17.0",
52
+ "@byok-sdk/cloud": "0.19.0",
53
+ "@byok-sdk/core": "0.19.0",
54
+ "@byok-sdk/protocol": "0.19.0",
55
55
  "aws4fetch": "1.0.20",
56
56
  "fast-xml-parser": "^5.10.1",
57
57
  "pg": "^8.22.0"