@pithy-sh/core 0.15.1 → 0.16.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.
- package/dist/controlPlane/capability.d.ts.map +1 -1
- package/dist/controlPlane/capability.js +6 -4
- package/dist/controlPlane/data/connection.d.ts +10 -0
- package/dist/controlPlane/data/connection.d.ts.map +1 -1
- package/dist/controlPlane/data/connection.js +34 -1
- package/dist/controlPlane/data/connections.d.ts.map +1 -1
- package/dist/controlPlane/data/connections.js +4 -4
- package/dist/controlPlane/evidence/pack.js +2 -2
- package/dist/controlPlane/migrations/0006_connection_nulls.d.ts +14 -0
- package/dist/controlPlane/migrations/0006_connection_nulls.d.ts.map +1 -0
- package/dist/controlPlane/migrations/0006_connection_nulls.js +28 -0
- package/dist/error/http.d.ts +24 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +48 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +17 -2
- package/dist/logger/record.d.ts +14 -0
- package/dist/logger/record.d.ts.map +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +1 -1
- package/src/controlPlane/capability.ts +5 -3
- package/src/controlPlane/data/connection.ts +36 -0
- package/src/controlPlane/data/connections.ts +9 -4
- package/src/controlPlane/evidence/pack.ts +2 -2
- package/src/controlPlane/migrations/0006_connection_nulls.ts +32 -0
- package/src/error/payload.ts +35 -2
- package/src/version.generated.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/controlPlane/capability.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,0BAA0B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,kBAAkB,CAAC;AAWvE,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../../src/controlPlane/capability.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,0BAA0B,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,kBAAkB,CAAC;AAWvE,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAsBnF,OAAO,EACL,wBAAwB,EAIzB,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,+GAA+G;AAC/G,eAAO,MAAM,uBAAuB;aAClC,GAAG,EAAE,aAAa;aAClB,IAAI,EAAE,OAAO;aACb,MAAM;aACN,KAAK;aACL,IAAI,EAAE,SAAS;aACf,OAAO,EAAE,qGAAqG;aAC9G,OAAO;CACC,CAAC;AAEX,uEAAuE;AACvE,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,cAAc,CAAC;IAC7G,gCAAgC;IAChC,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,sBAAsB,CAErG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,sBAAsB,CAuPtF;AAED,4GAA4G;AAC5G,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { describePresenceRooms } from "../presence/http/routes.js";
|
|
|
8
8
|
import { readRetirement } from "../privacy/fieldRotation.js";
|
|
9
9
|
import { lazyPrivacyInventory } from "../privacy/inventory.js";
|
|
10
10
|
import { composedRetention } from "../retention/composed.js";
|
|
11
|
-
import {
|
|
11
|
+
import { parseConnectionRow } from "./data/connection.js";
|
|
12
12
|
import { CONTROL_PLANE_CONNECTIONS_TABLE, controlPlaneTables } from "./data/tables.js";
|
|
13
13
|
import { standingHolds } from "../retention/holds.js";
|
|
14
14
|
import { holdsUserPurge } from "../retention/holdsPurge.js";
|
|
@@ -25,6 +25,7 @@ import { controlplane_0002_management_origin } from "./migrations/0002_managemen
|
|
|
25
25
|
import { controlplane_0003_connection_principal } from "./migrations/0003_connection_principal.js";
|
|
26
26
|
import { controlplane_0004_connection_trusts } from "./migrations/0004_connection_trusts.js";
|
|
27
27
|
import { controlplane_0005_holds } from "./migrations/0005_holds.js";
|
|
28
|
+
import { controlplane_0006_connection_nulls } from "./migrations/0006_connection_nulls.js";
|
|
28
29
|
import { d1ReplayGuard } from "./replay/d1Guard.js";
|
|
29
30
|
import { CONTROL_PLANE_KV_BINDING, controlPlaneKvNamespaces, kvReplayGuard } from "./replay/kvGuard.js";
|
|
30
31
|
//#region src/controlPlane/capability.ts
|
|
@@ -79,7 +80,8 @@ function controlplane(options = {}) {
|
|
|
79
80
|
"0002_management_origin": controlplane_0002_management_origin,
|
|
80
81
|
"0003_connection_principal": controlplane_0003_connection_principal,
|
|
81
82
|
"0004_connection_trusts": controlplane_0004_connection_trusts,
|
|
82
|
-
"0005_holds": controlplane_0005_holds
|
|
83
|
+
"0005_holds": controlplane_0005_holds,
|
|
84
|
+
"0006_connection_nulls": controlplane_0006_connection_nulls
|
|
83
85
|
};
|
|
84
86
|
const requiredBindings = [{
|
|
85
87
|
type: "d1",
|
|
@@ -165,7 +167,7 @@ function controlplane(options = {}) {
|
|
|
165
167
|
c.set("controlPlaneVerifier", createControlPlaneVerifier({
|
|
166
168
|
loadConnection: async (connectionId) => {
|
|
167
169
|
const row = await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().where("id", "=", connectionId).executeTakeFirst();
|
|
168
|
-
return row ?
|
|
170
|
+
return row ? parseConnectionRow(row) : null;
|
|
169
171
|
},
|
|
170
172
|
countConnections: async () => {
|
|
171
173
|
return (await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).select("id").limit(1).execute()).length;
|
|
@@ -177,7 +179,7 @@ function controlplane(options = {}) {
|
|
|
177
179
|
}, {
|
|
178
180
|
loadEnvironmentConnection: async () => {
|
|
179
181
|
const row = await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().where("environment", "=", environment).executeTakeFirst();
|
|
180
|
-
return row ?
|
|
182
|
+
return row ? parseConnectionRow(row) : null;
|
|
181
183
|
},
|
|
182
184
|
environment,
|
|
183
185
|
now,
|
|
@@ -135,4 +135,14 @@ export declare const ControlPlaneConnection: z.ZodObject<{
|
|
|
135
135
|
}, z.core.$strip>;
|
|
136
136
|
export type ControlPlaneConnection = z.output<typeof ControlPlaneConnection>;
|
|
137
137
|
export type ControlPlaneConnectionRow = z.input<typeof ControlPlaneConnection>;
|
|
138
|
+
/** The nullable columns a NULL in which means "not recorded", and which `pithy migrate` repairs when they hold `''`. */
|
|
139
|
+
export declare const CONNECTION_NULLABLE_COLUMNS: readonly ["managementOrigin", "authorizedBy", "actorKind", "purpose"];
|
|
140
|
+
/**
|
|
141
|
+
* Decode one stored connection row, or refuse it with the columns that would not parse.
|
|
142
|
+
*
|
|
143
|
+
* Every reader of the table goes through this, the Worker's verifier and the CLI's registry alike, so a row
|
|
144
|
+
* nobody can read is named the same way wherever it is met, never surfaced as a bare `ZodError`. The message is
|
|
145
|
+
* the default, because the verifier answers before a caller is authenticated.
|
|
146
|
+
*/
|
|
147
|
+
export declare function parseConnectionRow(row: unknown): ControlPlaneConnection;
|
|
138
148
|
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/data/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/data/connection.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;;;;;;;;GASG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB;;;;iBAgBoF,CAAC;AAClH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;iBAoBoF,CAAC;AAC/G,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;;;;EAI/B,CAAC;AACJ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,YAK7B,CAAC;AACJ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE,8GAA8G;AAC9G,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAiB1C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,aAW3B,CAAC;AACJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB;;;;;EAIlC,CAAC;AACJ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuEhC,CAAC;AACJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC7E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAQ/E,wHAAwH;AACxH,eAAO,MAAM,2BAA2B,YAAI,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,CAAU,CAAC;AAEjH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,sBAAsB,CAgBvE"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import { InternalError } from "../../error/pithyError.js";
|
|
4
|
+
import { commandName } from "../../cli/command.js";
|
|
3
5
|
import { ControlPlaneScope } from "../scope/scope.js";
|
|
4
6
|
import { JsonDate, SQLiteDate, sqliteJson } from "../../data/codecs.js";
|
|
5
7
|
import { OidcTrust } from "./oidcTrust.js";
|
|
@@ -117,5 +119,36 @@ const ControlPlaneConnection = z.object({
|
|
|
117
119
|
createdAt: SQLiteDate.describe("When the connection was registered. Ms-epoch in SQLite, a Date in TypeScript."),
|
|
118
120
|
updatedAt: SQLiteDate.describe("When the row last changed — a key registered or expired, or the Worker URL re-pointed.")
|
|
119
121
|
}).describe("One management-client connection: its identity, the environment and URL it is bound to, the operations it was granted, and its versioned public keys.");
|
|
122
|
+
/** The SQLite column a schema path names: `authorizedBy` → `authorized_by`, or `row` for the row itself. */
|
|
123
|
+
function columnOf(path) {
|
|
124
|
+
const field = path[0];
|
|
125
|
+
return field === void 0 ? "row" : String(field).replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
126
|
+
}
|
|
127
|
+
/** The nullable columns a NULL in which means "not recorded", and which `pithy migrate` repairs when they hold `''`. */
|
|
128
|
+
const CONNECTION_NULLABLE_COLUMNS = [
|
|
129
|
+
"managementOrigin",
|
|
130
|
+
"authorizedBy",
|
|
131
|
+
"actorKind",
|
|
132
|
+
"purpose"
|
|
133
|
+
];
|
|
134
|
+
/**
|
|
135
|
+
* Decode one stored connection row, or refuse it with the columns that would not parse.
|
|
136
|
+
*
|
|
137
|
+
* Every reader of the table goes through this, the Worker's verifier and the CLI's registry alike, so a row
|
|
138
|
+
* nobody can read is named the same way wherever it is met, never surfaced as a bare `ZodError`. The message is
|
|
139
|
+
* the default, because the verifier answers before a caller is authenticated.
|
|
140
|
+
*/
|
|
141
|
+
function parseConnectionRow(row) {
|
|
142
|
+
const parsed = ControlPlaneConnection.safeParse(row);
|
|
143
|
+
if (parsed.success) return parsed.data;
|
|
144
|
+
const columns = [...new Set(parsed.error.issues.map((issue) => columnOf(issue.path)))];
|
|
145
|
+
const repairable = CONNECTION_NULLABLE_COLUMNS.map((column) => columnOf([column]));
|
|
146
|
+
const id = typeof row === "object" && row !== null && "id" in row ? String(row.id) : "unknown";
|
|
147
|
+
const repair = columns.some((column) => repairable.includes(column)) ? ` ${repairable.join(", ")} read NULL as not recorded, and an empty string in one is not NULL. Run ${commandName("migrate")} for its environment, which puts it back.` : "";
|
|
148
|
+
throw new InternalError({
|
|
149
|
+
action: `${columns.join(", ")} in pithy_controlplane_connections ${columns.length === 1 ? "holds a value" : "hold values"} this release cannot read.${repair}`,
|
|
150
|
+
detail: `Connection ${id}: ${parsed.error.issues.map((issue) => `${columnOf(issue.path)}: ${issue.message}`).join("; ")}`
|
|
151
|
+
}, { cause: parsed.error });
|
|
152
|
+
}
|
|
120
153
|
//#endregion
|
|
121
|
-
export { ConnectionCredentialKind, ConnectionPrincipal, ConnectionPurpose, ControlPlaneActorKind, ControlPlaneConnection, Ed25519PublicJwk, MAX_CONNECTION_PURPOSE, RegisteredKey };
|
|
154
|
+
export { CONNECTION_NULLABLE_COLUMNS, ConnectionCredentialKind, ConnectionPrincipal, ConnectionPurpose, ControlPlaneActorKind, ControlPlaneConnection, Ed25519PublicJwk, MAX_CONNECTION_PURPOSE, RegisteredKey, parseConnectionRow };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/data/connections.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/data/connections.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,wBAAwB,EAC7B,sBAAsB,EAEtB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAmC,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEtF;;;;;GAKG;AAEH,8DAA8D;AAC9D,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,sBAAsB,GAAG,wBAAwB,CAOrG;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,UAAU,EAAE,sBAAsB,EAAE,GAAG,EAAE,IAAI,GAAG,OAAO,CAErF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,sBAAsB,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAU9F;AAED,8CAA8C;AAC9C,MAAM,WAAW,kBAAkB;IACjC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,sBAAsB,EAAE,GAAG,EAAE,IAAI,GAAG,kBAAkB,CAenG;AAED,qGAAqG;AACrG,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,EAAE,SAAS,EAAE,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EAAE,EAC9B,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,CAAC;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAAC;CACpD;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,oBAAoB,EACxB,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,OAAO,CAAC,CAelB;AAKD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,oBAAoB,EACxB,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,IAAI,EACT,OAAO,GAAE;IAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAO,GAC1D,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAcpC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { ConflictError } from "../../error/pithyError.js";
|
|
4
4
|
import { activeTrusts } from "./oidcTrust.js";
|
|
5
|
-
import { ControlPlaneConnection } from "./connection.js";
|
|
5
|
+
import { ControlPlaneConnection, parseConnectionRow } from "./connection.js";
|
|
6
6
|
import { CONTROL_PLANE_CONNECTIONS_TABLE } from "./tables.js";
|
|
7
7
|
import { activeKeys } from "./keyLifecycle.js";
|
|
8
8
|
import { sql } from "kysely";
|
|
@@ -74,7 +74,7 @@ function authorizedByPrincipal(connection, principal) {
|
|
|
74
74
|
async function listConnections(db, filter = {}) {
|
|
75
75
|
let query = db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().orderBy("createdAt").orderBy("id");
|
|
76
76
|
if (filter.environment !== void 0) query = query.where("environment", "=", filter.environment);
|
|
77
|
-
const rows = (await query.execute()).map((row) =>
|
|
77
|
+
const rows = (await query.execute()).map((row) => parseConnectionRow(row));
|
|
78
78
|
const { principal } = filter;
|
|
79
79
|
return {
|
|
80
80
|
connections: rows.filter((row) => row.authorizedBy !== null && (principal === void 0 || authorizedByPrincipal(row, principal))),
|
|
@@ -84,7 +84,7 @@ async function listConnections(db, filter = {}) {
|
|
|
84
84
|
/** Read one connection by id, or null. */
|
|
85
85
|
async function readConnection(db, id) {
|
|
86
86
|
const row = await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().where("id", "=", id).executeTakeFirst();
|
|
87
|
-
return row ?
|
|
87
|
+
return row ? parseConnectionRow(row) : null;
|
|
88
88
|
}
|
|
89
89
|
/** Read one connection by id for a write, or null. With `environment`, null for a connection bound to another. */
|
|
90
90
|
async function readConnectionForWrite(db, id, options = {}) {
|
|
@@ -93,7 +93,7 @@ async function readConnectionForWrite(db, id, options = {}) {
|
|
|
93
93
|
const row = await query.executeTakeFirst();
|
|
94
94
|
if (!row) return null;
|
|
95
95
|
return {
|
|
96
|
-
connection:
|
|
96
|
+
connection: parseConnectionRow(row),
|
|
97
97
|
storedKeys: row.keys,
|
|
98
98
|
storedTrusts: row.trusts
|
|
99
99
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { noopEmit } from "../../audit/recorder.js";
|
|
4
4
|
import { MIGRATIONS_READ_SCOPE } from "../scope/scope.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parseConnectionRow } from "../data/connection.js";
|
|
6
6
|
import { CONTROL_PLANE_CONNECTIONS_TABLE } from "../data/tables.js";
|
|
7
7
|
import { workerVersionMetadata } from "../../worker/identity.js";
|
|
8
8
|
import { readCapabilityHealth } from "../discovery/health.js";
|
|
@@ -17,7 +17,7 @@ import { deriveAuditLogging, deriveChangeHistory, deriveCsrf, deriveDataProtecti
|
|
|
17
17
|
async function readConnections(c, sources, environment) {
|
|
18
18
|
try {
|
|
19
19
|
return (await sources.database(c).selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().where("environment", "=", environment).orderBy("createdAt").execute()).map((row) => {
|
|
20
|
-
const connection =
|
|
20
|
+
const connection = parseConnectionRow(row);
|
|
21
21
|
return {
|
|
22
22
|
id: connection.id,
|
|
23
23
|
authorizedBy: connection.authorizedBy,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
import type { Migration } from "kysely/migration";
|
|
4
|
+
/**
|
|
5
|
+
* An empty nullable column reads as NULL again.
|
|
6
|
+
*
|
|
7
|
+
* `''` is not a value any of them accepts: not a URL, not an email, not an actor kind, shorter than a purpose.
|
|
8
|
+
* A connection holding one cannot be read, so every call on it is refused, and the only writer of one bound NULL
|
|
9
|
+
* as an empty string. So `''` in any of them is NULL, put back.
|
|
10
|
+
*
|
|
11
|
+
* `down` writes nothing. An empty string is not a state to return to: it is the one that refuses every call.
|
|
12
|
+
*/
|
|
13
|
+
export declare const controlplane_0006_connection_nulls: Migration;
|
|
14
|
+
//# sourceMappingURL=0006_connection_nulls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0006_connection_nulls.d.ts","sourceRoot":"","sources":["../../../src/controlPlane/migrations/0006_connection_nulls.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,EAAE,SAahD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
//#region src/controlPlane/migrations/0006_connection_nulls.ts
|
|
4
|
+
/** The nullable columns `''` cannot satisfy, as they stood when this migration was written. */
|
|
5
|
+
const NULLABLE_COLUMNS = [
|
|
6
|
+
"managementOrigin",
|
|
7
|
+
"authorizedBy",
|
|
8
|
+
"actorKind",
|
|
9
|
+
"purpose"
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* An empty nullable column reads as NULL again.
|
|
13
|
+
*
|
|
14
|
+
* `''` is not a value any of them accepts: not a URL, not an email, not an actor kind, shorter than a purpose.
|
|
15
|
+
* A connection holding one cannot be read, so every call on it is refused, and the only writer of one bound NULL
|
|
16
|
+
* as an empty string. So `''` in any of them is NULL, put back.
|
|
17
|
+
*
|
|
18
|
+
* `down` writes nothing. An empty string is not a state to return to: it is the one that refuses every call.
|
|
19
|
+
*/
|
|
20
|
+
const controlplane_0006_connection_nulls = {
|
|
21
|
+
up: async (db) => {
|
|
22
|
+
const table = db;
|
|
23
|
+
for (const column of NULLABLE_COLUMNS) await table.updateTable("pithyControlplaneConnections").set({ [column]: null }).where(column, "=", "").execute();
|
|
24
|
+
},
|
|
25
|
+
down: async () => {}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { controlplane_0006_connection_nulls };
|
package/dist/error/http.d.ts
CHANGED
|
@@ -248,6 +248,11 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
248
248
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
249
249
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
250
250
|
status: z.ZodLiteral<409>;
|
|
251
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
message: z.ZodString;
|
|
253
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
254
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
255
|
+
status: z.ZodLiteral<409>;
|
|
251
256
|
}, z.core.$strip>, z.ZodObject<{
|
|
252
257
|
message: z.ZodString;
|
|
253
258
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -293,6 +298,11 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
293
298
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
294
299
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
295
300
|
status: z.ZodLiteral<409>;
|
|
301
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
302
|
+
message: z.ZodString;
|
|
303
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
304
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
305
|
+
status: z.ZodLiteral<409>;
|
|
296
306
|
}, z.core.$strip>, z.ZodObject<{
|
|
297
307
|
message: z.ZodString;
|
|
298
308
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1173,6 +1183,13 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
1173
1183
|
detail: z.ZodOptional<z.ZodString>;
|
|
1174
1184
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
1175
1185
|
status: z.ZodLiteral<409>;
|
|
1186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1187
|
+
message: z.ZodString;
|
|
1188
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1189
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1190
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1191
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
1192
|
+
status: z.ZodLiteral<409>;
|
|
1176
1193
|
}, z.core.$strip>, z.ZodObject<{
|
|
1177
1194
|
message: z.ZodString;
|
|
1178
1195
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1236,6 +1253,13 @@ export declare const HttpError: z.ZodCodec<z.ZodUnion<readonly [z.ZodDiscriminat
|
|
|
1236
1253
|
detail: z.ZodOptional<z.ZodString>;
|
|
1237
1254
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
1238
1255
|
status: z.ZodLiteral<409>;
|
|
1256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1257
|
+
message: z.ZodString;
|
|
1258
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1259
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1260
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1261
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
1262
|
+
status: z.ZodLiteral<409>;
|
|
1239
1263
|
}, z.core.$strip>, z.ZodObject<{
|
|
1240
1264
|
message: z.ZodString;
|
|
1241
1265
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
package/dist/error/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/error/http.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAA4B,UAAU,EAAmB,MAAM,cAAc,CAAC;AAErF;;;;;;;;;;;;;;;;;GAiBG;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA8BpB,CAAC;AAeH;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,CAInD;AAED,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAKxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,GAAG,QAAQ,CAElE"}
|
package/dist/error/payload.d.ts
CHANGED
|
@@ -250,6 +250,11 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
250
250
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
251
251
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
252
252
|
status: z.ZodLiteral<409>;
|
|
253
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
254
|
+
message: z.ZodString;
|
|
255
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
256
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
257
|
+
status: z.ZodLiteral<409>;
|
|
253
258
|
}, z.core.$strip>, z.ZodObject<{
|
|
254
259
|
message: z.ZodString;
|
|
255
260
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -295,6 +300,11 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
295
300
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
296
301
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
297
302
|
status: z.ZodLiteral<409>;
|
|
303
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
304
|
+
message: z.ZodString;
|
|
305
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
306
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
307
|
+
status: z.ZodLiteral<409>;
|
|
298
308
|
}, z.core.$strip>, z.ZodObject<{
|
|
299
309
|
message: z.ZodString;
|
|
300
310
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1176,6 +1186,13 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1176
1186
|
detail: z.ZodOptional<z.ZodString>;
|
|
1177
1187
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
1178
1188
|
status: z.ZodLiteral<409>;
|
|
1189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1190
|
+
message: z.ZodString;
|
|
1191
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1192
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1193
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1194
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
1195
|
+
status: z.ZodLiteral<409>;
|
|
1179
1196
|
}, z.core.$strip>, z.ZodObject<{
|
|
1180
1197
|
message: z.ZodString;
|
|
1181
1198
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1239,6 +1256,13 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1239
1256
|
detail: z.ZodOptional<z.ZodString>;
|
|
1240
1257
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
1241
1258
|
status: z.ZodLiteral<409>;
|
|
1259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1260
|
+
message: z.ZodString;
|
|
1261
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1262
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1263
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1264
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
1265
|
+
status: z.ZodLiteral<409>;
|
|
1242
1266
|
}, z.core.$strip>, z.ZodObject<{
|
|
1243
1267
|
message: z.ZodString;
|
|
1244
1268
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -2273,6 +2297,11 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
|
|
|
2273
2297
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2274
2298
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
2275
2299
|
status: z.ZodLiteral<409>;
|
|
2300
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2301
|
+
message: z.ZodString;
|
|
2302
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2303
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
2304
|
+
status: z.ZodLiteral<409>;
|
|
2276
2305
|
}, z.core.$strip>, z.ZodObject<{
|
|
2277
2306
|
message: z.ZodString;
|
|
2278
2307
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -2318,6 +2347,11 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
|
|
|
2318
2347
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2319
2348
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
2320
2349
|
status: z.ZodLiteral<409>;
|
|
2350
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2351
|
+
message: z.ZodString;
|
|
2352
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2353
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
2354
|
+
status: z.ZodLiteral<409>;
|
|
2321
2355
|
}, z.core.$strip>, z.ZodObject<{
|
|
2322
2356
|
message: z.ZodString;
|
|
2323
2357
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -3215,6 +3249,13 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
|
|
|
3215
3249
|
detail: z.ZodOptional<z.ZodString>;
|
|
3216
3250
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
3217
3251
|
status: z.ZodLiteral<409>;
|
|
3252
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3253
|
+
message: z.ZodString;
|
|
3254
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3255
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3256
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3257
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
3258
|
+
status: z.ZodLiteral<409>;
|
|
3218
3259
|
}, z.core.$strip>, z.ZodObject<{
|
|
3219
3260
|
message: z.ZodString;
|
|
3220
3261
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -3278,6 +3319,13 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
|
|
|
3278
3319
|
detail: z.ZodOptional<z.ZodString>;
|
|
3279
3320
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
3280
3321
|
status: z.ZodLiteral<409>;
|
|
3322
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3323
|
+
message: z.ZodString;
|
|
3324
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3325
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3326
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3327
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
3328
|
+
status: z.ZodLiteral<409>;
|
|
3281
3329
|
}, z.core.$strip>, z.ZodObject<{
|
|
3282
3330
|
message: z.ZodString;
|
|
3283
3331
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AAEH,uFAAuF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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/error/payload.js
CHANGED
|
@@ -277,6 +277,11 @@ const TurnstileAnalyticsUnavailablePublic = z.object({
|
|
|
277
277
|
status: z.literal(409).describe("Conflict — the account's configuration rules the read out."),
|
|
278
278
|
...publicFields
|
|
279
279
|
}).describe("Turnstile analytics are not served to this account (409).");
|
|
280
|
+
const TurnstileAnalyticsForbiddenPublic = z.object({
|
|
281
|
+
code: z.literal("turnstile/analytics_forbidden").describe("Cloudflare refused the Turnstile analytics read because this Worker's `runtime` token lacks the permission it needs. `params.permission` names it, and `message` names the rotate that re-scopes the token."),
|
|
282
|
+
status: z.literal(409).describe("Conflict — the account's token configuration rules the read out."),
|
|
283
|
+
...publicFields
|
|
284
|
+
}).describe("The runtime token lacks the permission Turnstile analytics need (409).");
|
|
280
285
|
const AuditInvalidEventPublic = z.object({
|
|
281
286
|
code: z.literal("audit/invalid_event").describe("An audit event failed validation against the AuditEvent schema (bad action, outcome, or actor)."),
|
|
282
287
|
status: z.literal(400).describe("Bad Request — the event did not match its schema."),
|
|
@@ -322,6 +327,11 @@ const MediaAnalyticsUnavailablePublic = z.object({
|
|
|
322
327
|
status: z.literal(409).describe("Conflict — the account's configuration rules the read out."),
|
|
323
328
|
...publicFields
|
|
324
329
|
}).describe("Delivery analytics are not served to this account (409).");
|
|
330
|
+
const MediaAnalyticsForbiddenPublic = z.object({
|
|
331
|
+
code: z.literal("media/analytics_forbidden").describe("Cloudflare refused the delivery analytics read because this Worker's `runtime` token lacks the permission it needs. `params.permission` names it, and `message` names the rotate that re-scopes the token."),
|
|
332
|
+
status: z.literal(409).describe("Conflict — the account's token configuration rules the read out."),
|
|
333
|
+
...publicFields
|
|
334
|
+
}).describe("The runtime token lacks the permission delivery analytics need (409).");
|
|
325
335
|
const LeaderboardBoardNotFoundPublic = z.object({
|
|
326
336
|
code: z.literal("leaderboard/board_not_found").describe("No board with that key is configured. Board keys come from `pithy.config.ts`, not from the database."),
|
|
327
337
|
status: z.literal(404).describe("Not Found."),
|
|
@@ -933,6 +943,7 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
|
933
943
|
TurnstileConfigPublic,
|
|
934
944
|
TurnstileAnalyticsWindowPublic,
|
|
935
945
|
TurnstileAnalyticsUnavailablePublic,
|
|
946
|
+
TurnstileAnalyticsForbiddenPublic,
|
|
936
947
|
AuditInvalidEventPublic,
|
|
937
948
|
AuditWriteFailedPublic,
|
|
938
949
|
MediaNotFoundPublic,
|
|
@@ -942,6 +953,7 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
|
942
953
|
MediaEnrichmentFailedPublic,
|
|
943
954
|
MediaAnalyticsWindowPublic,
|
|
944
955
|
MediaAnalyticsUnavailablePublic,
|
|
956
|
+
MediaAnalyticsForbiddenPublic,
|
|
945
957
|
LeaderboardBoardNotFoundPublic,
|
|
946
958
|
LeaderboardEntryNotFoundPublic,
|
|
947
959
|
LeaderboardScoreRejectedPublic,
|
|
@@ -1099,6 +1111,7 @@ const TurnstileFailed = TurnstileFailedPublic.extend(internalFields).describe(Tu
|
|
|
1099
1111
|
const TurnstileConfig = TurnstileConfigPublic.extend(internalFields).describe(TurnstileConfigPublic.description ?? "");
|
|
1100
1112
|
const TurnstileAnalyticsWindow = TurnstileAnalyticsWindowPublic.extend(internalFields).describe(TurnstileAnalyticsWindowPublic.description ?? "");
|
|
1101
1113
|
const TurnstileAnalyticsUnavailable = TurnstileAnalyticsUnavailablePublic.extend(internalFields).describe(TurnstileAnalyticsUnavailablePublic.description ?? "");
|
|
1114
|
+
const TurnstileAnalyticsForbidden = TurnstileAnalyticsForbiddenPublic.extend(internalFields).describe(TurnstileAnalyticsForbiddenPublic.description ?? "");
|
|
1102
1115
|
const AuditInvalidEvent = AuditInvalidEventPublic.extend(internalFields).describe(AuditInvalidEventPublic.description ?? "");
|
|
1103
1116
|
const AuditWriteFailed = AuditWriteFailedPublic.extend(internalFields).describe(AuditWriteFailedPublic.description ?? "");
|
|
1104
1117
|
const MediaNotFound = MediaNotFoundPublic.extend(internalFields).describe(MediaNotFoundPublic.description ?? "");
|
|
@@ -1108,6 +1121,7 @@ const MediaStorageFailed = MediaStorageFailedPublic.extend(internalFields).descr
|
|
|
1108
1121
|
const MediaEnrichmentFailed = MediaEnrichmentFailedPublic.extend(internalFields).describe(MediaEnrichmentFailedPublic.description ?? "");
|
|
1109
1122
|
const MediaAnalyticsWindow = MediaAnalyticsWindowPublic.extend(internalFields).describe(MediaAnalyticsWindowPublic.description ?? "");
|
|
1110
1123
|
const MediaAnalyticsUnavailable = MediaAnalyticsUnavailablePublic.extend(internalFields).describe(MediaAnalyticsUnavailablePublic.description ?? "");
|
|
1124
|
+
const MediaAnalyticsForbidden = MediaAnalyticsForbiddenPublic.extend(internalFields).describe(MediaAnalyticsForbiddenPublic.description ?? "");
|
|
1111
1125
|
const LeaderboardBoardNotFound = LeaderboardBoardNotFoundPublic.extend(internalFields).describe(LeaderboardBoardNotFoundPublic.description ?? "");
|
|
1112
1126
|
const LeaderboardEntryNotFound = LeaderboardEntryNotFoundPublic.extend(internalFields).describe(LeaderboardEntryNotFoundPublic.description ?? "");
|
|
1113
1127
|
const LeaderboardScoreRejected = LeaderboardScoreRejectedPublic.extend(internalFields).describe(LeaderboardScoreRejectedPublic.description ?? "");
|
|
@@ -1270,6 +1284,7 @@ const KitErrorPayload = z.discriminatedUnion("code", [
|
|
|
1270
1284
|
TurnstileConfig,
|
|
1271
1285
|
TurnstileAnalyticsWindow,
|
|
1272
1286
|
TurnstileAnalyticsUnavailable,
|
|
1287
|
+
TurnstileAnalyticsForbidden,
|
|
1273
1288
|
AuditInvalidEvent,
|
|
1274
1289
|
AuditWriteFailed,
|
|
1275
1290
|
MediaNotFound,
|
|
@@ -1279,6 +1294,7 @@ const KitErrorPayload = z.discriminatedUnion("code", [
|
|
|
1279
1294
|
MediaEnrichmentFailed,
|
|
1280
1295
|
MediaAnalyticsWindow,
|
|
1281
1296
|
MediaAnalyticsUnavailable,
|
|
1297
|
+
MediaAnalyticsForbidden,
|
|
1282
1298
|
LeaderboardBoardNotFound,
|
|
1283
1299
|
LeaderboardEntryNotFound,
|
|
1284
1300
|
LeaderboardScoreRejected,
|
|
@@ -1399,8 +1415,7 @@ const KitErrorPayload = z.discriminatedUnion("code", [
|
|
|
1399
1415
|
* with it** — that is what this reads. It exists for the one place a code arrives without the payload
|
|
1400
1416
|
* it came from: a `PithyError` raised inside a durable Workflow step, whose only channel out is the
|
|
1401
1417
|
* text the engine records (`../workflow/stepMessage`). Nothing but `code`, `message` and `action`
|
|
1402
|
-
* survives that boundary,
|
|
1403
|
-
* operator to retry a request that was delivered and terminally answered (pithy-sh/pithy#365).
|
|
1418
|
+
* survives that boundary, so the status has to come back from the code.
|
|
1404
1419
|
*
|
|
1405
1420
|
* **The status is recovered, never invented.** A code this does not know — an adopter's own, a
|
|
1406
1421
|
* `d1/*` fault class, a typo — answers `undefined`, and the caller says so with a code of its own
|
package/dist/logger/record.d.ts
CHANGED
|
@@ -359,6 +359,13 @@ export declare const LogRecord: z.ZodObject<{
|
|
|
359
359
|
detail: z.ZodOptional<z.ZodString>;
|
|
360
360
|
code: z.ZodLiteral<"turnstile/analytics_unavailable">;
|
|
361
361
|
status: z.ZodLiteral<409>;
|
|
362
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
363
|
+
message: z.ZodString;
|
|
364
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
365
|
+
action: z.ZodOptional<z.ZodString>;
|
|
366
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
367
|
+
code: z.ZodLiteral<"turnstile/analytics_forbidden">;
|
|
368
|
+
status: z.ZodLiteral<409>;
|
|
362
369
|
}, z.core.$strip>, z.ZodObject<{
|
|
363
370
|
message: z.ZodString;
|
|
364
371
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -422,6 +429,13 @@ export declare const LogRecord: z.ZodObject<{
|
|
|
422
429
|
detail: z.ZodOptional<z.ZodString>;
|
|
423
430
|
code: z.ZodLiteral<"media/analytics_unavailable">;
|
|
424
431
|
status: z.ZodLiteral<409>;
|
|
432
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
433
|
+
message: z.ZodString;
|
|
434
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
435
|
+
action: z.ZodOptional<z.ZodString>;
|
|
436
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
437
|
+
code: z.ZodLiteral<"media/analytics_forbidden">;
|
|
438
|
+
status: z.ZodLiteral<409>;
|
|
425
439
|
}, z.core.$strip>, z.ZodObject<{
|
|
426
440
|
message: z.ZodString;
|
|
427
441
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/logger/record.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AAEH,4GAA4G;AAC5G,eAAO,MAAM,QAAQ;;;;;EAE4F,CAAC;AAClH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAgD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version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.16.1";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/core";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.
|
|
7
|
+
const PACKAGE_VERSION = "0.16.1";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ import { holdsUserPurge } from "../retention/holdsPurge";
|
|
|
19
19
|
import { PACKAGE_NAME, PACKAGE_VERSION } from "../version.generated";
|
|
20
20
|
import { ENVIRONMENT_VAR } from "../worker/identity";
|
|
21
21
|
import { ControlPlaneConfig, type ControlPlaneConfigInput } from "./config/config";
|
|
22
|
-
import {
|
|
22
|
+
import { parseConnectionRow } from "./data/connection";
|
|
23
23
|
import { CONTROL_PLANE_CONNECTIONS_TABLE, type ControlPlaneDatabase, controlPlaneTables } from "./data/tables";
|
|
24
24
|
import { recordTrustFirstCall } from "./data/trustFirstCall";
|
|
25
25
|
import type { CapabilityDeclaration } from "./discovery/adminRoute";
|
|
@@ -37,6 +37,7 @@ import { controlplane_0002_management_origin } from "./migrations/0002_managemen
|
|
|
37
37
|
import { controlplane_0003_connection_principal } from "./migrations/0003_connection_principal";
|
|
38
38
|
import { controlplane_0004_connection_trusts } from "./migrations/0004_connection_trusts";
|
|
39
39
|
import { controlplane_0005_holds } from "./migrations/0005_holds";
|
|
40
|
+
import { controlplane_0006_connection_nulls } from "./migrations/0006_connection_nulls";
|
|
40
41
|
import { d1ReplayGuard } from "./replay/d1Guard";
|
|
41
42
|
import type { ReplayGuard } from "./replay/guard";
|
|
42
43
|
import {
|
|
@@ -113,6 +114,7 @@ export function controlplane(options: ControlPlaneOptions = {}): ControlPlaneCap
|
|
|
113
114
|
"0003_connection_principal": controlplane_0003_connection_principal,
|
|
114
115
|
"0004_connection_trusts": controlplane_0004_connection_trusts,
|
|
115
116
|
"0005_holds": controlplane_0005_holds,
|
|
117
|
+
"0006_connection_nulls": controlplane_0006_connection_nulls,
|
|
116
118
|
};
|
|
117
119
|
const requiredBindings: BindingSpecInput[] = [
|
|
118
120
|
// The app database — the connections table lives here, beside auth's and audit's. Not the secrets
|
|
@@ -291,7 +293,7 @@ export function controlplane(options: ControlPlaneOptions = {}): ControlPlaneCap
|
|
|
291
293
|
.selectAll()
|
|
292
294
|
.where("id", "=", connectionId)
|
|
293
295
|
.executeTakeFirst();
|
|
294
|
-
return row ?
|
|
296
|
+
return row ? parseConnectionRow(row) : null;
|
|
295
297
|
},
|
|
296
298
|
countConnections: async () => {
|
|
297
299
|
const rows = await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).select("id").limit(1).execute();
|
|
@@ -313,7 +315,7 @@ export function controlplane(options: ControlPlaneOptions = {}): ControlPlaneCap
|
|
|
313
315
|
.selectAll()
|
|
314
316
|
.where("environment", "=", environment)
|
|
315
317
|
.executeTakeFirst();
|
|
316
|
-
return row ?
|
|
318
|
+
return row ? parseConnectionRow(row) : null;
|
|
317
319
|
},
|
|
318
320
|
environment,
|
|
319
321
|
now,
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { commandName } from "../../cli/command";
|
|
5
6
|
import { JsonDate, SQLiteDate, sqliteJson } from "../../data/codecs";
|
|
7
|
+
import { InternalError } from "../../error/pithyError";
|
|
6
8
|
import { ControlPlaneScope } from "../scope/scope";
|
|
7
9
|
import { OidcTrust } from "./oidcTrust";
|
|
8
10
|
|
|
@@ -232,3 +234,37 @@ export const ControlPlaneConnection = z
|
|
|
232
234
|
);
|
|
233
235
|
export type ControlPlaneConnection = z.output<typeof ControlPlaneConnection>;
|
|
234
236
|
export type ControlPlaneConnectionRow = z.input<typeof ControlPlaneConnection>;
|
|
237
|
+
|
|
238
|
+
/** The SQLite column a schema path names: `authorizedBy` → `authorized_by`, or `row` for the row itself. */
|
|
239
|
+
function columnOf(path: readonly PropertyKey[]): string {
|
|
240
|
+
const field = path[0];
|
|
241
|
+
return field === undefined ? "row" : String(field).replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** The nullable columns a NULL in which means "not recorded", and which `pithy migrate` repairs when they hold `''`. */
|
|
245
|
+
export const CONNECTION_NULLABLE_COLUMNS = ["managementOrigin", "authorizedBy", "actorKind", "purpose"] as const;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Decode one stored connection row, or refuse it with the columns that would not parse.
|
|
249
|
+
*
|
|
250
|
+
* Every reader of the table goes through this, the Worker's verifier and the CLI's registry alike, so a row
|
|
251
|
+
* nobody can read is named the same way wherever it is met, never surfaced as a bare `ZodError`. The message is
|
|
252
|
+
* the default, because the verifier answers before a caller is authenticated.
|
|
253
|
+
*/
|
|
254
|
+
export function parseConnectionRow(row: unknown): ControlPlaneConnection {
|
|
255
|
+
const parsed = ControlPlaneConnection.safeParse(row);
|
|
256
|
+
if (parsed.success) return parsed.data;
|
|
257
|
+
const columns = [...new Set(parsed.error.issues.map((issue) => columnOf(issue.path)))];
|
|
258
|
+
const repairable = CONNECTION_NULLABLE_COLUMNS.map((column) => columnOf([column]));
|
|
259
|
+
const id = typeof row === "object" && row !== null && "id" in row ? String(row.id) : "unknown";
|
|
260
|
+
const repair = columns.some((column) => repairable.includes(column))
|
|
261
|
+
? ` ${repairable.join(", ")} read NULL as not recorded, and an empty string in one is not NULL. Run ${commandName("migrate")} for its environment, which puts it back.`
|
|
262
|
+
: "";
|
|
263
|
+
throw new InternalError(
|
|
264
|
+
{
|
|
265
|
+
action: `${columns.join(", ")} in pithy_controlplane_connections ${columns.length === 1 ? "holds a value" : "hold values"} this release cannot read.${repair}`,
|
|
266
|
+
detail: `Connection ${id}: ${parsed.error.issues.map((issue) => `${columnOf(issue.path)}: ${issue.message}`).join("; ")}`,
|
|
267
|
+
},
|
|
268
|
+
{ cause: parsed.error },
|
|
269
|
+
);
|
|
270
|
+
}
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
import { sql } from "kysely";
|
|
5
5
|
import { ConflictError } from "../../error/pithyError";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type ConnectionCredentialKind,
|
|
8
|
+
ControlPlaneConnection,
|
|
9
|
+
parseConnectionRow,
|
|
10
|
+
type RegisteredKey,
|
|
11
|
+
} from "./connection";
|
|
7
12
|
import { activeKeys } from "./keyLifecycle";
|
|
8
13
|
import { activeTrusts, type OidcTrust } from "./oidcTrust";
|
|
9
14
|
import { CONTROL_PLANE_CONNECTIONS_TABLE, type ControlPlaneDatabase } from "./tables";
|
|
@@ -104,7 +109,7 @@ export async function listConnections(
|
|
|
104
109
|
): Promise<ConnectionListing> {
|
|
105
110
|
let query = db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().orderBy("createdAt").orderBy("id");
|
|
106
111
|
if (filter.environment !== undefined) query = query.where("environment", "=", filter.environment);
|
|
107
|
-
const rows = (await query.execute()).map((row) =>
|
|
112
|
+
const rows = (await query.execute()).map((row) => parseConnectionRow(row));
|
|
108
113
|
const { principal } = filter;
|
|
109
114
|
return {
|
|
110
115
|
connections: rows.filter(
|
|
@@ -117,7 +122,7 @@ export async function listConnections(
|
|
|
117
122
|
/** Read one connection by id, or null. */
|
|
118
123
|
export async function readConnection(db: ControlPlaneDatabase, id: string): Promise<ControlPlaneConnection | null> {
|
|
119
124
|
const row = await db.selectFrom(CONTROL_PLANE_CONNECTIONS_TABLE).selectAll().where("id", "=", id).executeTakeFirst();
|
|
120
|
-
return row ?
|
|
125
|
+
return row ? parseConnectionRow(row) : null;
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
/**
|
|
@@ -142,7 +147,7 @@ export async function readConnectionForWrite(
|
|
|
142
147
|
if (options.environment !== undefined) query = query.where("environment", "=", options.environment);
|
|
143
148
|
const row = await query.executeTakeFirst();
|
|
144
149
|
if (!row) return null;
|
|
145
|
-
return { connection:
|
|
150
|
+
return { connection: parseConnectionRow(row), storedKeys: row.keys, storedTrusts: row.trusts };
|
|
146
151
|
}
|
|
147
152
|
|
|
148
153
|
/**
|
|
@@ -12,7 +12,7 @@ import type { PrivacyInventory } from "../../privacy/report";
|
|
|
12
12
|
import type { RetirementVerdict } from "../../privacy/retirement";
|
|
13
13
|
import { workerVersionMetadata } from "../../worker/identity";
|
|
14
14
|
import type { ControlPlaneContext } from "../context";
|
|
15
|
-
import {
|
|
15
|
+
import { parseConnectionRow } from "../data/connection";
|
|
16
16
|
import { CONTROL_PLANE_CONNECTIONS_TABLE, type ControlPlaneDatabase } from "../data/tables";
|
|
17
17
|
import { type CapabilityHealthSource, readCapabilityHealth } from "../discovery/health";
|
|
18
18
|
import type { ControlPlaneEvidenceResponse } from "../http/responses";
|
|
@@ -82,7 +82,7 @@ async function readConnections(
|
|
|
82
82
|
.execute();
|
|
83
83
|
return rows.map((row) => {
|
|
84
84
|
// Only the fields the pack reports and the key windows it ages. The public halves stay in the row.
|
|
85
|
-
const connection =
|
|
85
|
+
const connection = parseConnectionRow(row);
|
|
86
86
|
return {
|
|
87
87
|
id: connection.id,
|
|
88
88
|
authorizedBy: connection.authorizedBy,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import type { Kysely } from "kysely";
|
|
5
|
+
import type { Migration } from "kysely/migration";
|
|
6
|
+
|
|
7
|
+
/** The nullable columns `''` cannot satisfy, as they stood when this migration was written. */
|
|
8
|
+
const NULLABLE_COLUMNS = ["managementOrigin", "authorizedBy", "actorKind", "purpose"] as const;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An empty nullable column reads as NULL again.
|
|
12
|
+
*
|
|
13
|
+
* `''` is not a value any of them accepts: not a URL, not an email, not an actor kind, shorter than a purpose.
|
|
14
|
+
* A connection holding one cannot be read, so every call on it is refused, and the only writer of one bound NULL
|
|
15
|
+
* as an empty string. So `''` in any of them is NULL, put back.
|
|
16
|
+
*
|
|
17
|
+
* `down` writes nothing. An empty string is not a state to return to: it is the one that refuses every call.
|
|
18
|
+
*/
|
|
19
|
+
export const controlplane_0006_connection_nulls: Migration = {
|
|
20
|
+
up: async (db: Kysely<unknown>): Promise<void> => {
|
|
21
|
+
const table = db as unknown as Kysely<{ pithyControlplaneConnections: Record<string, string | null> }>;
|
|
22
|
+
for (const column of NULLABLE_COLUMNS) {
|
|
23
|
+
await table
|
|
24
|
+
.updateTable("pithyControlplaneConnections")
|
|
25
|
+
.set({ [column]: null })
|
|
26
|
+
.where(column, "=", "")
|
|
27
|
+
.execute();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
down: async (): Promise<void> => {},
|
|
32
|
+
};
|
package/src/error/payload.ts
CHANGED
|
@@ -593,6 +593,18 @@ const TurnstileAnalyticsUnavailablePublic = z
|
|
|
593
593
|
})
|
|
594
594
|
.describe("Turnstile analytics are not served to this account (409).");
|
|
595
595
|
|
|
596
|
+
const TurnstileAnalyticsForbiddenPublic = z
|
|
597
|
+
.object({
|
|
598
|
+
code: z
|
|
599
|
+
.literal("turnstile/analytics_forbidden")
|
|
600
|
+
.describe(
|
|
601
|
+
"Cloudflare refused the Turnstile analytics read because this Worker's `runtime` token lacks the permission it needs. `params.permission` names it, and `message` names the rotate that re-scopes the token.",
|
|
602
|
+
),
|
|
603
|
+
status: z.literal(409).describe("Conflict — the account's token configuration rules the read out."),
|
|
604
|
+
...publicFields,
|
|
605
|
+
})
|
|
606
|
+
.describe("The runtime token lacks the permission Turnstile analytics need (409).");
|
|
607
|
+
|
|
596
608
|
// --- @pithy-sh/audit: audit-trail recorder codes ---
|
|
597
609
|
|
|
598
610
|
const AuditInvalidEventPublic = z
|
|
@@ -693,6 +705,18 @@ const MediaAnalyticsUnavailablePublic = z
|
|
|
693
705
|
})
|
|
694
706
|
.describe("Delivery analytics are not served to this account (409).");
|
|
695
707
|
|
|
708
|
+
const MediaAnalyticsForbiddenPublic = z
|
|
709
|
+
.object({
|
|
710
|
+
code: z
|
|
711
|
+
.literal("media/analytics_forbidden")
|
|
712
|
+
.describe(
|
|
713
|
+
"Cloudflare refused the delivery analytics read because this Worker's `runtime` token lacks the permission it needs. `params.permission` names it, and `message` names the rotate that re-scopes the token.",
|
|
714
|
+
),
|
|
715
|
+
status: z.literal(409).describe("Conflict — the account's token configuration rules the read out."),
|
|
716
|
+
...publicFields,
|
|
717
|
+
})
|
|
718
|
+
.describe("The runtime token lacks the permission delivery analytics need (409).");
|
|
719
|
+
|
|
696
720
|
// --- @pithy-sh/leaderboard: optional ranking capability codes ---
|
|
697
721
|
|
|
698
722
|
const LeaderboardBoardNotFoundPublic = z
|
|
@@ -2038,6 +2062,7 @@ export const KitPublicErrorPayload = z
|
|
|
2038
2062
|
TurnstileConfigPublic,
|
|
2039
2063
|
TurnstileAnalyticsWindowPublic,
|
|
2040
2064
|
TurnstileAnalyticsUnavailablePublic,
|
|
2065
|
+
TurnstileAnalyticsForbiddenPublic,
|
|
2041
2066
|
AuditInvalidEventPublic,
|
|
2042
2067
|
AuditWriteFailedPublic,
|
|
2043
2068
|
MediaNotFoundPublic,
|
|
@@ -2047,6 +2072,7 @@ export const KitPublicErrorPayload = z
|
|
|
2047
2072
|
MediaEnrichmentFailedPublic,
|
|
2048
2073
|
MediaAnalyticsWindowPublic,
|
|
2049
2074
|
MediaAnalyticsUnavailablePublic,
|
|
2075
|
+
MediaAnalyticsForbiddenPublic,
|
|
2050
2076
|
LeaderboardBoardNotFoundPublic,
|
|
2051
2077
|
LeaderboardEntryNotFoundPublic,
|
|
2052
2078
|
LeaderboardScoreRejectedPublic,
|
|
@@ -2260,6 +2286,9 @@ const TurnstileAnalyticsWindow = TurnstileAnalyticsWindowPublic.extend(internalF
|
|
|
2260
2286
|
const TurnstileAnalyticsUnavailable = TurnstileAnalyticsUnavailablePublic.extend(internalFields).describe(
|
|
2261
2287
|
TurnstileAnalyticsUnavailablePublic.description ?? "",
|
|
2262
2288
|
);
|
|
2289
|
+
const TurnstileAnalyticsForbidden = TurnstileAnalyticsForbiddenPublic.extend(internalFields).describe(
|
|
2290
|
+
TurnstileAnalyticsForbiddenPublic.description ?? "",
|
|
2291
|
+
);
|
|
2263
2292
|
const AuditInvalidEvent = AuditInvalidEventPublic.extend(internalFields).describe(
|
|
2264
2293
|
AuditInvalidEventPublic.description ?? "",
|
|
2265
2294
|
);
|
|
@@ -2283,6 +2312,9 @@ const MediaAnalyticsWindow = MediaAnalyticsWindowPublic.extend(internalFields).d
|
|
|
2283
2312
|
const MediaAnalyticsUnavailable = MediaAnalyticsUnavailablePublic.extend(internalFields).describe(
|
|
2284
2313
|
MediaAnalyticsUnavailablePublic.description ?? "",
|
|
2285
2314
|
);
|
|
2315
|
+
const MediaAnalyticsForbidden = MediaAnalyticsForbiddenPublic.extend(internalFields).describe(
|
|
2316
|
+
MediaAnalyticsForbiddenPublic.description ?? "",
|
|
2317
|
+
);
|
|
2286
2318
|
const LeaderboardBoardNotFound = LeaderboardBoardNotFoundPublic.extend(internalFields).describe(
|
|
2287
2319
|
LeaderboardBoardNotFoundPublic.description ?? "",
|
|
2288
2320
|
);
|
|
@@ -2671,6 +2703,7 @@ export const KitErrorPayload = z
|
|
|
2671
2703
|
TurnstileConfig,
|
|
2672
2704
|
TurnstileAnalyticsWindow,
|
|
2673
2705
|
TurnstileAnalyticsUnavailable,
|
|
2706
|
+
TurnstileAnalyticsForbidden,
|
|
2674
2707
|
AuditInvalidEvent,
|
|
2675
2708
|
AuditWriteFailed,
|
|
2676
2709
|
MediaNotFound,
|
|
@@ -2680,6 +2713,7 @@ export const KitErrorPayload = z
|
|
|
2680
2713
|
MediaEnrichmentFailed,
|
|
2681
2714
|
MediaAnalyticsWindow,
|
|
2682
2715
|
MediaAnalyticsUnavailable,
|
|
2716
|
+
MediaAnalyticsForbidden,
|
|
2683
2717
|
LeaderboardBoardNotFound,
|
|
2684
2718
|
LeaderboardEntryNotFound,
|
|
2685
2719
|
LeaderboardScoreRejected,
|
|
@@ -2810,8 +2844,7 @@ export type KitErrorCode = KitErrorPayload["code"];
|
|
|
2810
2844
|
* with it** — that is what this reads. It exists for the one place a code arrives without the payload
|
|
2811
2845
|
* it came from: a `PithyError` raised inside a durable Workflow step, whose only channel out is the
|
|
2812
2846
|
* text the engine records (`../workflow/stepMessage`). Nothing but `code`, `message` and `action`
|
|
2813
|
-
* survives that boundary,
|
|
2814
|
-
* operator to retry a request that was delivered and terminally answered (pithy-sh/pithy#365).
|
|
2847
|
+
* survives that boundary, so the status has to come back from the code.
|
|
2815
2848
|
*
|
|
2816
2849
|
* **The status is recovered, never invented.** A code this does not know — an adopter's own, a
|
|
2817
2850
|
* `d1/*` fault class, a typo — answers `undefined`, and the caller says so with a code of its own
|
package/src/version.generated.ts
CHANGED