@fleetless/sdk 5.2.1 → 5.3.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +1243 -1087
- package/dist/index.d.cts +148 -5
- package/dist/index.d.ts +148 -5
- package/dist/index.js +1241 -1087
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -413,16 +413,16 @@ function createAssetsApi(http) {
|
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
416
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-restore.js
|
|
417
417
|
import { z as z6 } from "zod";
|
|
418
418
|
|
|
419
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
419
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-intents.js
|
|
420
420
|
import { z as z5 } from "zod";
|
|
421
421
|
|
|
422
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
422
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/app-users.js
|
|
423
423
|
import { z as z4 } from "zod";
|
|
424
424
|
|
|
425
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
425
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/identity.js
|
|
426
426
|
import { z } from "zod";
|
|
427
427
|
var password = z.string().min(12).max(256);
|
|
428
428
|
var USER_DISPLAY_NAME_MAX = 120;
|
|
@@ -645,7 +645,7 @@ var recoveryCodesResponse = z.object({
|
|
|
645
645
|
recovery_codes: recoveryCodesList.meta({ description: "The ten new recovery codes, lowercase, shown once. Every earlier code is void." })
|
|
646
646
|
});
|
|
647
647
|
|
|
648
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
648
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/app-mail-html.js
|
|
649
649
|
var DEFAULT_MAIL_HTML = {
|
|
650
650
|
"invite": `<!doctype html>
|
|
651
651
|
<html lang="en">
|
|
@@ -733,7 +733,7 @@ var DEFAULT_MAIL_HTML = {
|
|
|
733
733
|
`
|
|
734
734
|
};
|
|
735
735
|
|
|
736
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
736
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/legal.js
|
|
737
737
|
import { z as z2 } from "zod";
|
|
738
738
|
var httpsLegalUrl = z2.url().max(2048).regex(/^https:\/\/(?=[A-Za-z0-9.-]{1,253}(?::[0-9]{1,5})?(?:[/?#]|$))[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*(?::(?:[0-5]?[0-9]{1,4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?(?:[/?#]|$)/).refine((value) => {
|
|
739
739
|
try {
|
|
@@ -753,7 +753,7 @@ var legalTextReferences = z2.object({
|
|
|
753
753
|
dpa: legalDocumentReference.nullable()
|
|
754
754
|
}).strict();
|
|
755
755
|
|
|
756
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
756
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/rights.js
|
|
757
757
|
import { z as z3 } from "zod";
|
|
758
758
|
var ROLE_KEY_PATTERN = /^(?!defaults$)[a-z][a-z0-9_]{0,62}$/;
|
|
759
759
|
var ROLE_KEY_RULE = "A role key is lower-case: it starts with a letter and continues with letters, digits and underscores, up to 63 characters in all \u2014 `operate`, `night_shift`. A capital, a dash, a dot, a space or a leading digit is refused, and `defaults` is reserved.";
|
|
@@ -791,7 +791,7 @@ var ENTRY_KIND_OF = {
|
|
|
791
791
|
};
|
|
792
792
|
var SECTIONS = Object.keys(ENTRY_KIND_OF);
|
|
793
793
|
|
|
794
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
794
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/app-users.js
|
|
795
795
|
var APP_USER_DISPLAY_NAME_MAX = 120;
|
|
796
796
|
var providerSlug = z4.string().max(40).regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, "must be lowercase and hyphen-separated, starting with a letter");
|
|
797
797
|
var appUserStatus = z4.enum(["pending_verification", "active", "blocked"]);
|
|
@@ -1179,7 +1179,7 @@ var mailOutcome = z4.object({
|
|
|
1179
1179
|
})
|
|
1180
1180
|
});
|
|
1181
1181
|
|
|
1182
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
1182
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-intents.js
|
|
1183
1183
|
var hash = z5.string().regex(/^[0-9a-f]{64}$/);
|
|
1184
1184
|
var uuid = z5.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
1185
1185
|
var opaqueId = z5.string().min(1);
|
|
@@ -1277,7 +1277,7 @@ var journalIntentV2 = z5.discriminatedUnion("kind", [
|
|
|
1277
1277
|
...branches.slice(1).map((branch) => branch.extend(envelope))
|
|
1278
1278
|
]);
|
|
1279
1279
|
|
|
1280
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
1280
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-restore.js
|
|
1281
1281
|
var hash2 = z6.string().regex(/^[0-9a-f]{64}$/);
|
|
1282
1282
|
var uuid2 = z6.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
1283
1283
|
var opaqueId2 = z6.string().min(1);
|
|
@@ -1697,7 +1697,7 @@ var journalReplayReceiptBody = z6.strictObject(receiptFields).superRefine((value
|
|
|
1697
1697
|
}).describe("JSON Schema consumers must also verify counts, exact erase-proof set, reference bindings, kind/registry surface applicability and pass outcomes, signatures and protected-version readbacks.");
|
|
1698
1698
|
var journalReplayReceipt = journalReplayReceiptBody.safeExtend({ receipt_hash: hash2, signature: signature2 });
|
|
1699
1699
|
|
|
1700
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
1700
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-manifests.js
|
|
1701
1701
|
import { z as z7 } from "zod";
|
|
1702
1702
|
var uuid3 = z7.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
1703
1703
|
var hash3 = z7.string().regex(/^[0-9a-f]{64}$/);
|
|
@@ -2053,7 +2053,7 @@ var journalManifestBinding = z7.strictObject({
|
|
|
2053
2053
|
problem("Unexpected batch", ["manifest", "batches"]);
|
|
2054
2054
|
}).describe("JSON Schema consumers must also verify exact intent/scope/batch binding, sorted physical membership, original bytes and protected readbacks.");
|
|
2055
2055
|
|
|
2056
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2056
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-seals.js
|
|
2057
2057
|
import { z as z8 } from "zod";
|
|
2058
2058
|
var hash4 = z8.string().regex(/^[0-9a-f]{64}$/);
|
|
2059
2059
|
var uuid4 = z8.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
@@ -2135,7 +2135,7 @@ var journalFinalSealBody = z8.strictObject({
|
|
|
2135
2135
|
}, { path: ["cutoff_utc"], message: "Must equal max(ceil_to_second(T + E_max + W_max), previous C + 1 second)" }).describe("JSON Schema consumers must also verify C = max(ceil_to_second(T + E_max + W_max), previous C + 1 second), original signatures and complete drain/admission evidence.");
|
|
2136
2136
|
var journalFinalSeal = journalFinalSealBody.safeExtend({ seal_hash: hash4, signature: signature3 });
|
|
2137
2137
|
|
|
2138
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2138
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/journal-controls.js
|
|
2139
2139
|
import { z as z9 } from "zod";
|
|
2140
2140
|
var hash5 = z9.string().regex(/^[0-9a-f]{64}$/);
|
|
2141
2141
|
var zeroHash = z9.literal("0".repeat(64));
|
|
@@ -2238,23 +2238,23 @@ var journalRegistryActivationReceipt = z9.union([
|
|
|
2238
2238
|
laterActivationBody.extend({ receipt_hash: hash5, signature: signature4 })
|
|
2239
2239
|
]);
|
|
2240
2240
|
|
|
2241
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2241
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/legal-offers.js
|
|
2242
2242
|
import { z as z13 } from "zod";
|
|
2243
2243
|
|
|
2244
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2244
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/plans.js
|
|
2245
2245
|
import { z as z12 } from "zod";
|
|
2246
2246
|
|
|
2247
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2247
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/purchase-operation-key.js
|
|
2248
2248
|
import { z as z10 } from "zod";
|
|
2249
2249
|
var purchaseOperationKey = z10.uuid().meta({ description: "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input." });
|
|
2250
2250
|
|
|
2251
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2251
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/confirmation-proof.js
|
|
2252
2252
|
import { z as z11 } from "zod";
|
|
2253
2253
|
var confirmationProof = z11.string().regex(/^[A-Za-z0-9_-]{43}$/).meta({
|
|
2254
2254
|
description: "Opaque 32-byte Cloud proof, unpadded base64url. Syntax alone is not evidence."
|
|
2255
2255
|
});
|
|
2256
2256
|
|
|
2257
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2257
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/plans.js
|
|
2258
2258
|
var planId = z12.enum(["basic", "plus", "pro", "enterprise"]);
|
|
2259
2259
|
var PLAN_ORDER = ["basic", "plus", "pro", "enterprise"];
|
|
2260
2260
|
var planLimitKey = z12.enum([
|
|
@@ -2563,7 +2563,7 @@ var adminPlanChangeRequest = z12.object({
|
|
|
2563
2563
|
})
|
|
2564
2564
|
}).strict();
|
|
2565
2565
|
|
|
2566
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2566
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/legal-offers.js
|
|
2567
2567
|
var utc = z13.iso.datetime().regex(/Z$/);
|
|
2568
2568
|
var text = z13.string().min(1).regex(/\S/);
|
|
2569
2569
|
var cents2 = z13.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
@@ -2699,7 +2699,7 @@ var legalOfferConflictDetails = z13.strictObject({
|
|
|
2699
2699
|
rule: z13.enum(["withdrawn", "stale", "expired", "reused", "boundary_changed", "deadline_unavailable"])
|
|
2700
2700
|
});
|
|
2701
2701
|
|
|
2702
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2702
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/common.js
|
|
2703
2703
|
import { z as z14 } from "zod";
|
|
2704
2704
|
var SLUG_RULE = "A name is lower-case: it starts with a letter, continues with letters and digits, and joins further words with a single underscore \u2014 `battery_voltage`. Capitals, dashes, dots, spaces, a leading digit and a doubled or trailing underscore are all refused.";
|
|
2705
2705
|
var slug = z14.string().min(2).max(63).regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/, SLUG_RULE);
|
|
@@ -2730,7 +2730,7 @@ var applyError = z14.object({
|
|
|
2730
2730
|
details: z14.record(z14.string(), z14.unknown()).optional()
|
|
2731
2731
|
});
|
|
2732
2732
|
|
|
2733
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2733
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/mcp.js
|
|
2734
2734
|
import { z as z15 } from "zod";
|
|
2735
2735
|
function mcpAppEndpointPath(appIdentifier2) {
|
|
2736
2736
|
return `/mcp/${appIdentifier2}`;
|
|
@@ -2775,13 +2775,13 @@ var mcpRobotDatasheet = z15.object({
|
|
|
2775
2775
|
});
|
|
2776
2776
|
var MCP_ASSET_LINK_TTL_MS = 15 * 60 * 1e3;
|
|
2777
2777
|
|
|
2778
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2778
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/protocol.js
|
|
2779
2779
|
import { z as z22 } from "zod";
|
|
2780
2780
|
|
|
2781
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2781
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/assets.js
|
|
2782
2782
|
import { z as z17 } from "zod";
|
|
2783
2783
|
|
|
2784
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2784
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/file-too-large-details.js
|
|
2785
2785
|
import { z as z16 } from "zod";
|
|
2786
2786
|
var fileTooLargeDetails = z16.object({
|
|
2787
2787
|
max_bytes: z16.number().int().positive().meta({
|
|
@@ -2792,7 +2792,7 @@ var fileTooLargeDetails = z16.object({
|
|
|
2792
2792
|
})
|
|
2793
2793
|
});
|
|
2794
2794
|
|
|
2795
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2795
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/assets.js
|
|
2796
2796
|
var assetKind = z17.enum(["urdf", "mesh", "texture"]);
|
|
2797
2797
|
var asset = z17.object({
|
|
2798
2798
|
id: z17.uuid().meta({ description: "The asset's id in the store." }),
|
|
@@ -3132,10 +3132,10 @@ var assetSyncBusyDetails = z17.object({
|
|
|
3132
3132
|
started_at_ms: z17.number().int().nonnegative()
|
|
3133
3133
|
});
|
|
3134
3134
|
|
|
3135
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3135
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/config.js
|
|
3136
3136
|
import { z as z19 } from "zod";
|
|
3137
3137
|
|
|
3138
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3138
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/alerts.js
|
|
3139
3139
|
import { z as z18 } from "zod";
|
|
3140
3140
|
var alertRowCondition = z18.discriminatedUnion("kind", [
|
|
3141
3141
|
z18.strictObject({
|
|
@@ -3205,7 +3205,7 @@ var putDatapointDisplayRequest = z18.object({
|
|
|
3205
3205
|
y_max: z18.number().finite().nullable()
|
|
3206
3206
|
}).strict();
|
|
3207
3207
|
|
|
3208
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3208
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/config.js
|
|
3209
3209
|
var RTSP_URL_RULE = "The URL has to begin with `rtsp://` or `rtsps://` \u2014 `rtsp://cam-1.plant.local/stream1`. No other scheme is accepted: the bridge opens this with a library that would equally honour `file:`.";
|
|
3210
3210
|
var MJPEG_URL_RULE = "The URL has to begin with `http://` or `https://` \u2014 `http://cam-1.plant.local/video.mjpg`. No other scheme is accepted: the bridge opens this with a library that would equally serve `file:`.";
|
|
3211
3211
|
var DEVICE_PATH_RULE = "A capture device is a path under `/dev/`, and the character straight after it is a letter or a digit \u2014 `/dev/video0`, or a stable `/dev/v4l/by-id/...` symlink. Nothing outside `/dev/` is accepted: the string reaches OpenCV, which would as happily open an ordinary file.";
|
|
@@ -3511,14 +3511,14 @@ var datapointNumeric = strictObject({
|
|
|
3511
3511
|
});
|
|
3512
3512
|
var datapointRetention = strictObject({
|
|
3513
3513
|
enabled: z19.boolean().meta({
|
|
3514
|
-
description: "Whether values are written to the time series and become queryable. Off by default: without it the value is live only, and nobody who was not watching will ever see it."
|
|
3514
|
+
description: "Whether values are written to the time series and become queryable. Off by default: without it the value is live only, and nobody who was not watching will ever see it. It also switches the robot's buffer: with it off, the robot holds nothing for this datapoint, and switching it off drops what the robot held."
|
|
3515
3515
|
}).optional(),
|
|
3516
3516
|
interval_seconds: z19.number().int().min(1).max(3600).meta({
|
|
3517
3517
|
description: "How often a value is written to history, in seconds; absent means `300`. **Not** how often it is sent \u2014 that is `rate_throttle_hz`. Stored points are billed, so this is the direct lever on what a robot costs, and a bumper that is true for 200 ms does not appear unless a write falls inside it.",
|
|
3518
3518
|
examples: [300, 60]
|
|
3519
3519
|
}).optional(),
|
|
3520
3520
|
max_buffer_values: z19.number().int().min(1).max(1e5).meta({
|
|
3521
|
-
description: "How many values the robot holds while the bridge is disconnected, to be pushed once it reconnects. The catch-up runs behind live telemetry and job results at a limited rate, so closing a gap never delays the present; without it the series simply has a gap, which is an honest answer.",
|
|
3521
|
+
description: "How many values the robot holds while the bridge is disconnected, to be pushed once it reconnects. The catch-up runs behind live telemetry and job results at a limited rate, so closing a gap never delays the present; without it the series simply has a gap, which is an honest answer. It needs `enabled`, and it also holds the values low-bandwidth mode's rate cap holds back.",
|
|
3522
3522
|
examples: [5e3]
|
|
3523
3523
|
}).optional()
|
|
3524
3524
|
});
|
|
@@ -4428,7 +4428,7 @@ var configState = z19.object({
|
|
|
4428
4428
|
applied_errors: z19.array(applyError).nullable()
|
|
4429
4429
|
});
|
|
4430
4430
|
|
|
4431
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4431
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/introspection.js
|
|
4432
4432
|
import { z as z20 } from "zod";
|
|
4433
4433
|
var rosGraphEntry = z20.object({
|
|
4434
4434
|
name: rosName,
|
|
@@ -4482,7 +4482,7 @@ var typeDefinition = z20.discriminatedUnion("kind", [
|
|
|
4482
4482
|
})
|
|
4483
4483
|
]);
|
|
4484
4484
|
|
|
4485
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4485
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/jobs.js
|
|
4486
4486
|
import { z as z21 } from "zod";
|
|
4487
4487
|
var jobState = z21.enum(["running", "unknown", "succeeded", "failed", "cancelled", "lost"]);
|
|
4488
4488
|
var reportedJobState = jobState.exclude(["unknown"]);
|
|
@@ -4541,7 +4541,7 @@ var job = z21.object({
|
|
|
4541
4541
|
description: "A monotonic counter ascending in mint order, and the named tiebreaker for any listing that claims one \u2014 `started_at` alone is not a total order. Scoped per cloud process and per run: job state lives in memory, so this restarts with the registry it orders."
|
|
4542
4542
|
}),
|
|
4543
4543
|
result: z21.unknown().nullable().meta({
|
|
4544
|
-
description: "What the call returned
|
|
4544
|
+
description: "What the call returned, shaped by the ROS action or service itself: on `succeeded`, and on `failed` or `cancelled` when the action sent a result. `null` while running, when nothing was returned, and when it was too large to send (`result_omitted`)."
|
|
4545
4545
|
}),
|
|
4546
4546
|
result_omitted: resultOmitted.optional().meta({ description: RESULT_OMITTED_DESCRIPTION }),
|
|
4547
4547
|
/**
|
|
@@ -4655,7 +4655,7 @@ var jobRun = z21.object({
|
|
|
4655
4655
|
description: 'How long the run took, in milliseconds. `null` while it is still `running` or `unknown`, never `0` standing in for "nothing so far".'
|
|
4656
4656
|
}),
|
|
4657
4657
|
result: z21.unknown().nullable().meta({
|
|
4658
|
-
description: "What the action or service
|
|
4658
|
+
description: "What the call returned, shaped by the ROS action or service itself: on `succeeded`, and on `failed` or `cancelled` when the action sent a result. `null` while running, when nothing was returned, and when it was too large to send (`result_omitted`)."
|
|
4659
4659
|
}),
|
|
4660
4660
|
result_omitted: resultOmitted.optional().meta({ description: RESULT_OMITTED_DESCRIPTION }),
|
|
4661
4661
|
error: z21.object({
|
|
@@ -4737,7 +4737,7 @@ var jobRunSummary = z21.object({
|
|
|
4737
4737
|
since_ms: z21.number().int().nonnegative()
|
|
4738
4738
|
});
|
|
4739
4739
|
|
|
4740
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4740
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/protocol.js
|
|
4741
4741
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4742
4742
|
var MAX_PATIENCE_MS = 12e4;
|
|
4743
4743
|
var MIN_PATIENCE_MS = 1e3;
|
|
@@ -4826,6 +4826,14 @@ var bridgeLinkMode = z22.object({
|
|
|
4826
4826
|
reason: z22.enum(["lag", "dwell", "forced", "recovered"]).meta({ description: "`lag`: the cloud-measured lag crossed the threshold; `dwell`: the bridge-measured queue dwell did; `forced`: `mode: on` or `off`; `recovered`: both measures stayed at or below the exit threshold." }),
|
|
4827
4827
|
at_ms: z22.number().int().nonnegative().meta({ description: "Bridge time of the transition, epoch milliseconds." })
|
|
4828
4828
|
});
|
|
4829
|
+
var failsafeWatchdogReason = z22.enum(["self_test", "late_fire", "not_alive", "crashed"]);
|
|
4830
|
+
var bridgeFailsafeWatchdog = z22.object({
|
|
4831
|
+
type: z22.literal("failsafe_watchdog"),
|
|
4832
|
+
state: z22.enum(["ok", "failed"]).meta({ description: "`ok`: the watchdog passed its self-test and holds its bound, and the bridge takes publishes; `failed`: it does not, and the bridge refuses every publish until it recovers." }),
|
|
4833
|
+
reason: failsafeWatchdogReason.nullable().meta({ description: "Why the state is `failed`; `null` with `ok`. `self_test`: the failsafe process did not start, did not answer its self-test, or its start-up self-test ran past the 10 ms bound (only then with `lateness_ms`); `late_fire`: a failsafe went out more than 10 ms after its deadline (with `lateness_ms`); `not_alive`: a second without a word from the failsafe process; `crashed`: the process ended, or it reported two errors within 60 s." }),
|
|
4834
|
+
lateness_ms: z22.number().nonnegative().nullable().meta({ description: "The lateness that decided the state, in milliseconds after the deadline: with `ok` the self-test's it passed; with `failed` the self-test's that ran late, or the late failsafe's. `null` for `not_alive`, `crashed`, and a `self_test` whose process did not start or did not answer." }),
|
|
4835
|
+
at_ms: z22.number().int().nonnegative().meta({ description: "Bridge time of the state change, epoch milliseconds." })
|
|
4836
|
+
});
|
|
4829
4837
|
var cloudConfig = z22.object({
|
|
4830
4838
|
type: z22.literal("config"),
|
|
4831
4839
|
version: z22.number().int().nonnegative(),
|
|
@@ -4987,7 +4995,10 @@ var bridgeState = z22.object({
|
|
|
4987
4995
|
online: z22.boolean(),
|
|
4988
4996
|
latency_ms: z22.number().nonnegative().nullable(),
|
|
4989
4997
|
low_bandwidth: z22.boolean().meta({ description: "Whether the bridge is in its low-bandwidth mode: datapoints capped, cameras reduced or stopped. Bridge-reported." }),
|
|
4990
|
-
health_reason: z22.enum(["job_query_unanswered"]).nullable().optional().meta({ description: "Cloud-observed connection health: `job_query_unanswered` after a bridge ignores held-job queries; `null` on an ordinary connect or disconnect. Optional for older observations." })
|
|
4998
|
+
health_reason: z22.enum(["job_query_unanswered"]).nullable().optional().meta({ description: "Cloud-observed connection health: `job_query_unanswered` after a bridge ignores held-job queries; `null` on an ordinary connect or disconnect. Optional for older observations." }),
|
|
4999
|
+
failsafe: z22.enum(["ok", "failed"]).nullable().optional().meta({ description: "The bridge's failsafe watchdog: `failed` while the bridge takes no publishes because it cannot promise a failsafe on time; `null` until the bridge states it. Bridge-reported. Optional for older observations." }),
|
|
5000
|
+
failsafe_reason: failsafeWatchdogReason.nullable().optional().meta({ description: "Why `failsafe` is `failed`, as the bridge stated it: `self_test`, `late_fire`, `not_alive` or `crashed`; `null` otherwise. Bridge-reported. Optional for older observations." }),
|
|
5001
|
+
failsafe_lateness_ms: z22.number().nonnegative().nullable().optional().meta({ description: "The lateness that made `failsafe` `failed`, in milliseconds after the deadline, where the bridge knows it (`late_fire`, and a `self_test` that ran late); `null` otherwise. Bridge-reported. Optional for older observations." })
|
|
4991
5002
|
});
|
|
4992
5003
|
var snapshotHeader = z22.object({
|
|
4993
5004
|
type: z22.literal("snapshot"),
|
|
@@ -5151,11 +5162,11 @@ var bridgeCameraState = z22.object({
|
|
|
5151
5162
|
request_id: z22.string().min(1).max(64).nullable()
|
|
5152
5163
|
});
|
|
5153
5164
|
|
|
5154
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5165
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/config-issues.js
|
|
5155
5166
|
var EXPOSURE_SECTIONS = ["datapoints", "actions", "services", "publishers", "cameras"];
|
|
5156
5167
|
var EXPOSURE_SECTION_NAMES = new Set(EXPOSURE_SECTIONS);
|
|
5157
5168
|
|
|
5158
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5169
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/org-roles.js
|
|
5159
5170
|
import { z as z23 } from "zod";
|
|
5160
5171
|
var roleName = z23.string().trim().min(1).max(ROLE_NAME_MAX);
|
|
5161
5172
|
var referencePlace = z23.object({
|
|
@@ -5294,7 +5305,7 @@ var putRoleDefaultsRequest = z23.object({
|
|
|
5294
5305
|
})
|
|
5295
5306
|
}).strict();
|
|
5296
5307
|
|
|
5297
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5308
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/rest.js
|
|
5298
5309
|
import { z as z24 } from "zod";
|
|
5299
5310
|
var robot2 = z24.object({
|
|
5300
5311
|
id: z24.uuid().meta({
|
|
@@ -5432,7 +5443,16 @@ var configVersionResponse = z24.object({
|
|
|
5432
5443
|
var introspectionResponse = z24.object({
|
|
5433
5444
|
graph: rosGraph,
|
|
5434
5445
|
fetched_at: z24.iso.datetime(),
|
|
5435
|
-
stale: z24.boolean()
|
|
5446
|
+
stale: z24.boolean(),
|
|
5447
|
+
bridge_version: z24.string().nullable().optional().meta({
|
|
5448
|
+
description: "The bridge version the graph was read under. `null` for a snapshot older than this field. Absent when the server predates this field."
|
|
5449
|
+
}),
|
|
5450
|
+
types_fetched_at: z24.iso.datetime().nullable().optional().meta({
|
|
5451
|
+
description: "When the types of this snapshot were read and replaced the stored definitions. `null` while they have not been, or when reading them failed: the stored definitions are then the older ones. Absent when the server predates this field."
|
|
5452
|
+
}),
|
|
5453
|
+
unresolved_types: z24.array(z24.string()).optional().meta({
|
|
5454
|
+
description: "The type names the robot could not resolve when the types of this snapshot were read, sorted; empty when every one resolved, or when they have not been read. Absent when the server predates this field."
|
|
5455
|
+
})
|
|
5436
5456
|
});
|
|
5437
5457
|
var typesResponse = z24.object({
|
|
5438
5458
|
types: z24.array(typeDefinition)
|
|
@@ -5939,6 +5959,13 @@ var RESOURCE_HEALTH_STATES = [
|
|
|
5939
5959
|
* `reason` names the size and the limit, built from numbers only.
|
|
5940
5960
|
*/
|
|
5941
5961
|
"too_large",
|
|
5962
|
+
/**
|
|
5963
|
+
* A camera's live video is paused because the bridge is in low-bandwidth
|
|
5964
|
+
* mode: a new stream is refused and a running one may have been ended
|
|
5965
|
+
* (fleetless/fleetless#1126). Not an error; snapshots go on. `reason` is
|
|
5966
|
+
* the cloud's fixed sentence.
|
|
5967
|
+
*/
|
|
5968
|
+
"low_bandwidth",
|
|
5942
5969
|
/**
|
|
5943
5970
|
* Something is wrong and this platform cannot say what.
|
|
5944
5971
|
*
|
|
@@ -6118,20 +6145,30 @@ var slugUsageResponse = z24.object({
|
|
|
6118
6145
|
alert_count: z24.number().int().nonnegative()
|
|
6119
6146
|
});
|
|
6120
6147
|
|
|
6121
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6122
|
-
import { z as
|
|
6148
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/realtime.js
|
|
6149
|
+
import { z as z31 } from "zod";
|
|
6150
|
+
|
|
6151
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/live-start-refusal.js
|
|
6152
|
+
import { z as z25 } from "zod";
|
|
6153
|
+
var LIVE_START_REFUSALS = ["low_bandwidth", "source_auth", "source_unreachable", "not_startable", "unknown"];
|
|
6154
|
+
var liveStartRefusal = z25.enum(LIVE_START_REFUSALS).meta({
|
|
6155
|
+
description: "Why the robot refused to start live video: `low_bandwidth` (the link is weak; snapshots go on), `source_auth` (the source refused the credentials), `source_unreachable` (the source could not be reached), `not_startable` (the bridge could not start it; its log says why), `unknown` (a reason this cloud does not know yet)."
|
|
6156
|
+
});
|
|
6157
|
+
var cameraOfflineDetails = z25.object({
|
|
6158
|
+
refusal: liveStartRefusal
|
|
6159
|
+
});
|
|
6160
|
+
|
|
6161
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/client-auth.js
|
|
6162
|
+
import { z as z29 } from "zod";
|
|
6123
6163
|
|
|
6124
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6164
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/apps.js
|
|
6125
6165
|
import { z as z28 } from "zod";
|
|
6126
6166
|
|
|
6127
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6167
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-rights.js
|
|
6128
6168
|
import { z as z27 } from "zod";
|
|
6129
6169
|
|
|
6130
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6170
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections.js
|
|
6131
6171
|
import { z as z26 } from "zod";
|
|
6132
|
-
|
|
6133
|
-
// node_modules/.pnpm/@fleetless+contracts@18.2.0/node_modules/@fleetless/contracts/dist/collections.js
|
|
6134
|
-
import { z as z25 } from "zod";
|
|
6135
6172
|
var COLLECTIONS_FORMAT_VERSION = 1;
|
|
6136
6173
|
var COLLECTION_LIMITS = {
|
|
6137
6174
|
/** Collections in one document. */
|
|
@@ -6188,13 +6225,13 @@ var COLLECTION_LIMITS = {
|
|
|
6188
6225
|
importErrorText: 200
|
|
6189
6226
|
};
|
|
6190
6227
|
var KEY_RULE = /^[a-z][a-z0-9_]{0,62}$/;
|
|
6191
|
-
var collectionKey =
|
|
6228
|
+
var collectionKey = z26.string().regex(KEY_RULE, {
|
|
6192
6229
|
message: "A key starts with a lowercase letter and continues with lowercase letters, digits or underscores, up to 63 characters in all."
|
|
6193
6230
|
}).meta({ description: "A collection key or a field key: `^[a-z][a-z0-9_]{0,62}$`. Keys appear in URLs, filters and record bodies; `label` is the text people read." });
|
|
6194
|
-
var collectionBinding =
|
|
6231
|
+
var collectionBinding = z26.enum(["global", "per_robot", "one_per_robot"]).meta({
|
|
6195
6232
|
description: "`global`: records belong to the app and no robot. `per_robot`: every record belongs to one robot (system field `robot_id`, fixed when the record is created). `one_per_robot`: every robot of the app has exactly one record, which Fleetless creates itself."
|
|
6196
6233
|
});
|
|
6197
|
-
var collectionFieldType =
|
|
6234
|
+
var collectionFieldType = z26.enum([
|
|
6198
6235
|
"text",
|
|
6199
6236
|
"long_text",
|
|
6200
6237
|
"number",
|
|
@@ -6205,70 +6242,70 @@ var collectionFieldType = z25.enum([
|
|
|
6205
6242
|
"json",
|
|
6206
6243
|
"reference"
|
|
6207
6244
|
]);
|
|
6208
|
-
var label =
|
|
6209
|
-
var description =
|
|
6245
|
+
var label = z26.string().max(120).meta({ description: "A short name for people to read. It may change at any time; the key is what code uses." });
|
|
6246
|
+
var description = z26.string().max(1e3).meta({ description: "Free text that explains the field to the people who fill it in." });
|
|
6210
6247
|
var common2 = {
|
|
6211
6248
|
label: label.optional(),
|
|
6212
6249
|
description: description.optional(),
|
|
6213
|
-
required:
|
|
6214
|
-
unique:
|
|
6250
|
+
required: z26.boolean().meta({ description: "A new record must set this field, and an update may not clear it." }).optional(),
|
|
6251
|
+
unique: z26.union([z26.boolean(), z26.literal("collection")]).meta({
|
|
6215
6252
|
description: "`true`: no two records hold the same value, within the collection (`global`) or within one robot (`per_robot`, `one_per_robot`). `collection`: on a robot-bound collection, across all robots. Empty values never collide. Not allowed on `boolean` and `json` fields."
|
|
6216
6253
|
}).optional(),
|
|
6217
|
-
default:
|
|
6254
|
+
default: z26.unknown().meta({ description: "The value a record gets when it does not set this field. It must itself be a valid value of the field." }).optional()
|
|
6218
6255
|
};
|
|
6219
|
-
var textField =
|
|
6220
|
-
type:
|
|
6256
|
+
var textField = z26.object({
|
|
6257
|
+
type: z26.literal("text"),
|
|
6221
6258
|
...common2,
|
|
6222
|
-
max_length:
|
|
6223
|
-
pattern:
|
|
6259
|
+
max_length: z26.number().int().min(1).max(COLLECTION_LIMITS.textMax).meta({ description: `Longest value in characters. Default ${COLLECTION_LIMITS.textDefault}, at most ${COLLECTION_LIMITS.textMax}.` }).optional(),
|
|
6260
|
+
pattern: z26.string().max(COLLECTION_LIMITS.patternMax).meta({
|
|
6224
6261
|
description: `A regular expression in the RE2 subset, checked in unicode mode: lookahead, lookbehind and backreferences are not supported. At most ${COLLECTION_LIMITS.patternMax.toLocaleString("en-US")} characters, and the cloud may also refuse a pattern as too complex (its compiled size is bounded; counted repeats such as \`{n}\` multiply it), which a document reports as an invalid pattern. The value must match somewhere in it; anchor it with \`^\` and \`$\` to match the whole value.`
|
|
6225
6262
|
}).optional(),
|
|
6226
|
-
searchable:
|
|
6263
|
+
searchable: z26.boolean().meta({ description: "Include this field in the `search` of record lists." }).optional()
|
|
6227
6264
|
}).strict();
|
|
6228
|
-
var longTextField =
|
|
6229
|
-
type:
|
|
6265
|
+
var longTextField = z26.object({
|
|
6266
|
+
type: z26.literal("long_text"),
|
|
6230
6267
|
...common2,
|
|
6231
|
-
max_length:
|
|
6232
|
-
searchable:
|
|
6268
|
+
max_length: z26.number().int().min(1).max(COLLECTION_LIMITS.longTextMax).meta({ description: `Longest value in characters. Default ${COLLECTION_LIMITS.longTextDefault}, at most ${COLLECTION_LIMITS.longTextMax}.` }).optional(),
|
|
6269
|
+
searchable: z26.boolean().meta({ description: "Include this field in the `search` of record lists." }).optional()
|
|
6233
6270
|
}).strict();
|
|
6234
|
-
var numberField =
|
|
6235
|
-
type:
|
|
6271
|
+
var numberField = z26.object({
|
|
6272
|
+
type: z26.literal("number"),
|
|
6236
6273
|
...common2,
|
|
6237
|
-
integer:
|
|
6238
|
-
min:
|
|
6239
|
-
max:
|
|
6240
|
-
unit:
|
|
6274
|
+
integer: z26.boolean().meta({ description: "Accept whole numbers only." }).optional(),
|
|
6275
|
+
min: z26.number().meta({ description: "Smallest accepted value." }).optional(),
|
|
6276
|
+
max: z26.number().meta({ description: "Largest accepted value." }).optional(),
|
|
6277
|
+
unit: z26.string().meta({ description: "A unit to show next to the value, such as `m` or `rad/s`. Display only; nothing converts values." }).optional()
|
|
6241
6278
|
}).strict();
|
|
6242
|
-
var booleanField =
|
|
6243
|
-
var selectOption =
|
|
6244
|
-
value:
|
|
6245
|
-
label:
|
|
6279
|
+
var booleanField = z26.object({ type: z26.literal("boolean"), ...common2 }).strict();
|
|
6280
|
+
var selectOption = z26.object({
|
|
6281
|
+
value: z26.string().min(1).max(200).meta({ description: "What is stored in records and used in filters." }),
|
|
6282
|
+
label: z26.string().meta({ description: "What people see instead of the value." }).optional()
|
|
6246
6283
|
}).strict();
|
|
6247
|
-
var selectField =
|
|
6248
|
-
type:
|
|
6284
|
+
var selectField = z26.object({
|
|
6285
|
+
type: z26.literal("select"),
|
|
6249
6286
|
...common2,
|
|
6250
|
-
options:
|
|
6251
|
-
multiple:
|
|
6252
|
-
searchable:
|
|
6287
|
+
options: z26.array(selectOption).min(1).max(COLLECTION_LIMITS.selectOptions).meta({ description: `The accepted values, 1 to ${COLLECTION_LIMITS.selectOptions}. Two options may not share a value.` }),
|
|
6288
|
+
multiple: z26.boolean().meta({ description: "Hold a list of distinct options instead of one." }).optional(),
|
|
6289
|
+
searchable: z26.boolean().meta({ description: "Include the values and labels of the chosen options in the `search` of record lists." }).optional()
|
|
6253
6290
|
}).strict();
|
|
6254
|
-
var dateField =
|
|
6255
|
-
var datetimeField =
|
|
6256
|
-
var jsonField =
|
|
6257
|
-
type:
|
|
6291
|
+
var dateField = z26.object({ type: z26.literal("date"), ...common2 }).strict();
|
|
6292
|
+
var datetimeField = z26.object({ type: z26.literal("datetime"), ...common2 }).strict();
|
|
6293
|
+
var jsonField = z26.object({
|
|
6294
|
+
type: z26.literal("json"),
|
|
6258
6295
|
...common2,
|
|
6259
|
-
schema:
|
|
6296
|
+
schema: z26.union([z26.string(), z26.record(z26.string(), z26.unknown())]).meta({
|
|
6260
6297
|
description: "What the value must look like: the name of a built-in template (`pose2d`, `point2d`, `polygon2d`, `range1d`) or an inline JSON Schema (draft 2020-12). Without it any JSON value is accepted."
|
|
6261
6298
|
}).optional()
|
|
6262
6299
|
}).strict();
|
|
6263
|
-
var referenceField =
|
|
6264
|
-
type:
|
|
6300
|
+
var referenceField = z26.object({
|
|
6301
|
+
type: z26.literal("reference"),
|
|
6265
6302
|
...common2,
|
|
6266
6303
|
to: collectionKey.meta({ description: "The key of the collection whose records this field points at. It must be a collection of the same document." }),
|
|
6267
|
-
on_delete:
|
|
6304
|
+
on_delete: z26.enum(["prevent", "clear"]).meta({
|
|
6268
6305
|
description: "`prevent` (the default): a record that other records point at cannot be deleted. `clear`: deleting it clears the reference in the records that pointed at it."
|
|
6269
6306
|
}).optional()
|
|
6270
6307
|
}).strict();
|
|
6271
|
-
var collectionField =
|
|
6308
|
+
var collectionField = z26.discriminatedUnion("type", [
|
|
6272
6309
|
textField,
|
|
6273
6310
|
longTextField,
|
|
6274
6311
|
numberField,
|
|
@@ -6279,71 +6316,71 @@ var collectionField = z25.discriminatedUnion("type", [
|
|
|
6279
6316
|
jsonField,
|
|
6280
6317
|
referenceField
|
|
6281
6318
|
]);
|
|
6282
|
-
var collectionAccessValue =
|
|
6283
|
-
var allOwn =
|
|
6319
|
+
var collectionAccessValue = z26.union([z26.string().min(1).max(63), z26.array(z26.string().min(1).max(63))]).meta({ description: "The key of an organization role, or a list of keys. A key that names no role grants nothing." });
|
|
6320
|
+
var allOwn = z26.object({
|
|
6284
6321
|
all: collectionAccessValue.meta({ description: "Roles that may do this to every record." }).optional(),
|
|
6285
6322
|
own: collectionAccessValue.meta({ description: "Roles that may do this only to records they created themselves." }).optional()
|
|
6286
6323
|
}).strict();
|
|
6287
|
-
var collectionAccess =
|
|
6324
|
+
var collectionAccess = z26.object({
|
|
6288
6325
|
read: collectionAccessValue.meta({ description: "Roles that may read records." }).optional(),
|
|
6289
6326
|
create: collectionAccessValue.meta({ description: "Roles that may create records. Has no effect on `one_per_robot` collections, whose records Fleetless creates." }).optional(),
|
|
6290
|
-
update:
|
|
6291
|
-
delete:
|
|
6327
|
+
update: z26.union([collectionAccessValue, allOwn]).meta({ description: "Roles that may change records: a role key, a list, or `{ all, own }` to tell every record from the ones a role created itself." }).optional(),
|
|
6328
|
+
delete: z26.union([collectionAccessValue, allOwn]).meta({ description: "Roles that may delete records: a role key, a list, or `{ all, own }`. Has no effect on `one_per_robot` collections, whose records are never deleted through the API." }).optional()
|
|
6292
6329
|
}).strict().meta({ description: "Which roles may read, create, update and delete the records of this collection. A missing key grants that action to nobody; developers and server keys can always do everything." });
|
|
6293
|
-
var collectionDefinition =
|
|
6294
|
-
label:
|
|
6295
|
-
description:
|
|
6330
|
+
var collectionDefinition = z26.object({
|
|
6331
|
+
label: z26.string().meta({ description: "A name for people to read. It may change at any time; the key is what code uses." }).optional(),
|
|
6332
|
+
description: z26.string().meta({ description: "Free text that explains the collection to people." }).optional(),
|
|
6296
6333
|
binding: collectionBinding,
|
|
6297
|
-
display:
|
|
6334
|
+
display: z26.string().meta({
|
|
6298
6335
|
description: "A template that names a record in lists, references and titles, for example `{{name}} ({{location.name}})`. A placeholder is a field of this collection, a system field (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `revision`, and `robot_id` on robot-bound collections), `robot.name` on robot-bound collections, or `<reference field>.<field of the target>`."
|
|
6299
6336
|
}).optional(),
|
|
6300
6337
|
access: collectionAccess.optional(),
|
|
6301
|
-
fields:
|
|
6338
|
+
fields: z26.record(collectionKey, collectionField).meta({ description: `The fields of a record, at most ${COLLECTION_LIMITS.fields}. Their order is the order of the record form.` })
|
|
6302
6339
|
}).strict();
|
|
6303
|
-
var collectionsMap =
|
|
6304
|
-
var collectionsDocument =
|
|
6305
|
-
format:
|
|
6340
|
+
var collectionsMap = z26.record(collectionKey, collectionDefinition);
|
|
6341
|
+
var collectionsDocument = z26.object({
|
|
6342
|
+
format: z26.literal(COLLECTIONS_FORMAT_VERSION).meta({ description: `The document format version. Always ${COLLECTIONS_FORMAT_VERSION}.` }),
|
|
6306
6343
|
// A codec on the property and not a preprocess on the document: the published JSON Schema then says `object | null` and still lists
|
|
6307
6344
|
// `collections` as required, and the parsed value (and the output schema) is the plain map.
|
|
6308
|
-
collections:
|
|
6345
|
+
collections: z26.codec(collectionsMap.nullable(), collectionsMap, { decode: (value) => value ?? {}, encode: (value) => value }).meta({ description: `The collections of the app by key, at most ${COLLECTION_LIMITS.collections}. Nothing under \`collections:\` (null) means none.` })
|
|
6309
6346
|
}).strict().meta({ description: "The data model of an app: its collections, their fields, and who may use them." });
|
|
6310
6347
|
|
|
6311
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6312
|
-
var records =
|
|
6313
|
-
var roleCollectionRights =
|
|
6348
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-rights.js
|
|
6349
|
+
var records = z27.union([z27.literal("all"), z27.literal("own"), z27.literal(false)]);
|
|
6350
|
+
var roleCollectionRights = z27.object({
|
|
6314
6351
|
collection: collectionKey.meta({ description: "The collection's key." }),
|
|
6315
|
-
label:
|
|
6352
|
+
label: z27.string().meta({ description: "The collection's label for people to read; its key when the schema gives none." }),
|
|
6316
6353
|
binding: collectionBinding,
|
|
6317
|
-
read:
|
|
6318
|
-
create:
|
|
6354
|
+
read: z27.boolean().meta({ description: "Whether the role may read the records." }),
|
|
6355
|
+
create: z27.boolean().meta({ description: "Whether the role may create records." }),
|
|
6319
6356
|
update: records.meta({
|
|
6320
6357
|
description: "`all`: the role may change every record. `own`: only records its user created. `false`: none."
|
|
6321
6358
|
}),
|
|
6322
6359
|
delete: records.meta({
|
|
6323
6360
|
description: "`all`: the role may delete every record. `own`: only records its user created. `false`: none."
|
|
6324
6361
|
}),
|
|
6325
|
-
robot_filter:
|
|
6362
|
+
robot_filter: z27.boolean().meta({
|
|
6326
6363
|
description: "`true` on a collection that belongs to robots (`per_robot`, `one_per_robot`): the role sees and writes only the records of robots a session of the role reaches, whatever the rights above say. `false` on a `global` collection."
|
|
6327
6364
|
})
|
|
6328
6365
|
}).meta({ description: "What one role may do with the records of one collection." });
|
|
6329
6366
|
|
|
6330
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6367
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/apps.js
|
|
6331
6368
|
var appIdentifier = slug;
|
|
6332
|
-
var app2 =
|
|
6333
|
-
id:
|
|
6369
|
+
var app2 = z28.object({
|
|
6370
|
+
id: z28.uuid().meta({
|
|
6334
6371
|
description: "The app in the API, assigned by the cloud and stable for the life of the app. Everything app-scoped takes this as its `:id`."
|
|
6335
6372
|
}),
|
|
6336
|
-
org_id:
|
|
6373
|
+
org_id: z28.uuid().meta({
|
|
6337
6374
|
description: "The organisation that owns this app. Every developer route is already scoped to the caller's org, so this confirms what a client is looking at rather than being a filter it applies."
|
|
6338
6375
|
}),
|
|
6339
|
-
name:
|
|
6376
|
+
name: z28.string().min(1).max(120).meta({
|
|
6340
6377
|
description: "The display name, shown in the console and available to the developer's own pages through the `app.name` mail-template variable. Free text, changed through `PATCH /api/apps/:id`."
|
|
6341
6378
|
}),
|
|
6342
6379
|
identifier: appIdentifier.meta({
|
|
6343
6380
|
description: "The stable handle a client sends at login, lowercase and underscore-separated. **Globally unique, not per organisation** \u2014 `clientLoginRequest` carries no org context, so a collision is refused with `identifier_taken`."
|
|
6344
6381
|
}),
|
|
6345
6382
|
/** Robots are referenced individually; tags never grant rights. */
|
|
6346
|
-
robot_ids:
|
|
6383
|
+
robot_ids: z28.array(z28.uuid()).meta({
|
|
6347
6384
|
description: "The robots this app may reach, each referenced individually. Tags never grant rights, and a robot absent from this list is invisible to the app. What a user of the app may use on an attached robot follows that robot's `fleetless.yaml` and the organization's defaults, less what the app locks."
|
|
6348
6385
|
}),
|
|
6349
6386
|
/**
|
|
@@ -6365,83 +6402,83 @@ var app2 = z27.object({
|
|
|
6365
6402
|
default_role: roleKey.nullable().meta({
|
|
6366
6403
|
description: "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means this app has not chosen a default, the normal state of an app until someone picks one, and then a create or invite that names no role is refused. An invitation resolves the role when issued, so changing this never re-aims an outstanding one. The key is shown as stored and may name no role, which grants nothing; `GET /api/apps/:id/access` warns about it. It is set by `PUT /api/apps/:id/access`, not by `PATCH /api/apps/:id`."
|
|
6367
6404
|
}),
|
|
6368
|
-
created_at:
|
|
6405
|
+
created_at: z28.iso.datetime().meta({
|
|
6369
6406
|
description: "When the app was created, as an ISO 8601 timestamp. `GET /api/apps` orders by this field."
|
|
6370
6407
|
})
|
|
6371
6408
|
});
|
|
6372
|
-
var appListResponse =
|
|
6373
|
-
apps:
|
|
6409
|
+
var appListResponse = z28.object({
|
|
6410
|
+
apps: z28.array(app2).meta({
|
|
6374
6411
|
description: "Every app of the caller's organisation, oldest first by `created_at`. The org scope is the whole filter \u2014 there is no id to narrow by and nothing to refuse."
|
|
6375
6412
|
})
|
|
6376
6413
|
});
|
|
6377
|
-
var appDeletionSummary =
|
|
6378
|
-
user_count:
|
|
6414
|
+
var appDeletionSummary = z28.object({
|
|
6415
|
+
user_count: z28.number().int().nonnegative().meta({
|
|
6379
6416
|
description: "App users deleted with the app. They are the developer's own customers, not Fleetless users, and exist in no other app."
|
|
6380
6417
|
}),
|
|
6381
|
-
server_key_count:
|
|
6418
|
+
server_key_count: z28.number().int().nonnegative().meta({
|
|
6382
6419
|
description: "Server keys deleted with the app. A client still holding one is refused at its next request."
|
|
6383
6420
|
}),
|
|
6384
|
-
invitation_count:
|
|
6421
|
+
invitation_count: z28.number().int().nonnegative().meta({
|
|
6385
6422
|
description: "Outstanding invitations \u2014 unspent and unexpired \u2014 that will never be accepted."
|
|
6386
6423
|
}),
|
|
6387
|
-
oidc_provider_count:
|
|
6424
|
+
oidc_provider_count: z28.number().int().nonnegative().meta({
|
|
6388
6425
|
description: "Identity providers configured for this app. The providers themselves are somebody else's; only this app's configuration of them goes."
|
|
6389
6426
|
}),
|
|
6390
|
-
mail_template_count:
|
|
6427
|
+
mail_template_count: z28.number().int().nonnegative().meta({
|
|
6391
6428
|
description: "Custom mail templates, of at most three. A kind using the Fleetless default text is not counted \u2014 there is no row to lose."
|
|
6392
6429
|
}),
|
|
6393
|
-
collection_count:
|
|
6430
|
+
collection_count: z28.number().int().nonnegative().meta({
|
|
6394
6431
|
description: "Collections of the app's latest published schema. They go with the app, together with their records and history."
|
|
6395
6432
|
}),
|
|
6396
|
-
record_count:
|
|
6433
|
+
record_count: z28.number().int().nonnegative().meta({
|
|
6397
6434
|
description: "Records of the app's collections, deleted with the app."
|
|
6398
6435
|
})
|
|
6399
6436
|
});
|
|
6400
|
-
var createAppRequest =
|
|
6401
|
-
name:
|
|
6437
|
+
var createAppRequest = z28.object({
|
|
6438
|
+
name: z28.string().min(1).max(120),
|
|
6402
6439
|
identifier: appIdentifier,
|
|
6403
|
-
robot_ids:
|
|
6440
|
+
robot_ids: z28.array(z28.uuid()).optional()
|
|
6404
6441
|
}).strict();
|
|
6405
|
-
var updateAppRequest =
|
|
6406
|
-
name:
|
|
6407
|
-
robot_ids:
|
|
6442
|
+
var updateAppRequest = z28.object({
|
|
6443
|
+
name: z28.string().min(1).max(120).optional(),
|
|
6444
|
+
robot_ids: z28.array(z28.uuid()).optional()
|
|
6408
6445
|
}).strict();
|
|
6409
|
-
var serverKeyToken =
|
|
6410
|
-
var serverKey =
|
|
6411
|
-
id:
|
|
6446
|
+
var serverKeyToken = z28.string().regex(/^flk_[0-9a-f]{32}$/);
|
|
6447
|
+
var serverKey = z28.object({
|
|
6448
|
+
id: z28.uuid().meta({
|
|
6412
6449
|
description: "The key row, and what the rotate and delete routes address. It is not the key: this shape never carries the secret."
|
|
6413
6450
|
}),
|
|
6414
|
-
app_id:
|
|
6451
|
+
app_id: z28.uuid().meta({
|
|
6415
6452
|
description: "The app whose full rights this key carries. A key is never shared between apps."
|
|
6416
6453
|
}),
|
|
6417
|
-
name:
|
|
6454
|
+
name: z28.string().min(1).max(120).meta({
|
|
6418
6455
|
description: "A label the developer chose, so a key can be recognised before it is rotated or deleted."
|
|
6419
6456
|
}),
|
|
6420
|
-
created_at:
|
|
6457
|
+
created_at: z28.iso.datetime().meta({
|
|
6421
6458
|
description: "When the key was minted, as an ISO 8601 timestamp. `GET /api/apps/:id/server-keys` orders by this field."
|
|
6422
6459
|
}),
|
|
6423
6460
|
/** Null until first use — the cheapest way to spot a key nobody needs. */
|
|
6424
|
-
last_used_at:
|
|
6461
|
+
last_used_at: z28.iso.datetime().nullable().meta({
|
|
6425
6462
|
description: "When this key last authenticated a request, or `null` if it never has \u2014 the cheapest way to spot a key nobody needs."
|
|
6426
6463
|
})
|
|
6427
6464
|
});
|
|
6428
|
-
var serverKeyListResponse =
|
|
6429
|
-
server_keys:
|
|
6465
|
+
var serverKeyListResponse = z28.object({
|
|
6466
|
+
server_keys: z28.array(serverKey).meta({
|
|
6430
6467
|
description: "The app's server keys as metadata, oldest first by `created_at`. The raw secret is not here and never will be: it exists once, in the response that created or rotated the key."
|
|
6431
6468
|
})
|
|
6432
6469
|
});
|
|
6433
|
-
var createServerKeyResponse =
|
|
6470
|
+
var createServerKeyResponse = z28.object({
|
|
6434
6471
|
server_key: serverKey,
|
|
6435
6472
|
key: serverKeyToken
|
|
6436
6473
|
});
|
|
6437
6474
|
var MAX_LOCK_SLUGS = 2e3;
|
|
6438
6475
|
var MAX_APP_LOCKS = 1e3;
|
|
6439
6476
|
var namedOnce = (items) => new Set(items).size === items.length;
|
|
6440
|
-
var appLock =
|
|
6441
|
-
robot_id:
|
|
6477
|
+
var appLock = z28.object({
|
|
6478
|
+
robot_id: z28.uuid().meta({
|
|
6442
6479
|
description: "The robot whose capabilities are locked for this app."
|
|
6443
6480
|
}),
|
|
6444
|
-
slugs:
|
|
6481
|
+
slugs: z28.array(slug).min(1).max(MAX_LOCK_SLUGS).refine(namedOnce, { message: "Name each slug once." }).meta({
|
|
6445
6482
|
uniqueItems: true,
|
|
6446
6483
|
description: `The slugs of that robot's exposures to lock, at least one and each named once, at most ${MAX_LOCK_SLUGS}. A slug the robot has no exposure for is accepted and warns, and locks nothing.`
|
|
6447
6484
|
})
|
|
@@ -6450,245 +6487,245 @@ var appAccessFields = {
|
|
|
6450
6487
|
default_role: roleKey.nullable().meta({
|
|
6451
6488
|
description: "The role, by key, that an app user gets when created, invited or self-registered without an explicit one. `null` means the app has none, and a create or invite that names no role is refused. A key that names no role is accepted and warns; it grants nothing."
|
|
6452
6489
|
}),
|
|
6453
|
-
locked_kinds:
|
|
6490
|
+
locked_kinds: z28.array(accessKind).max(ACCESS_KINDS.length).refine(namedOnce, { message: "Name each kind once." }).meta({
|
|
6454
6491
|
uniqueItems: true,
|
|
6455
6492
|
description: "Kinds of access locked for every user and server key of the app, on every robot it reaches: `read`, `invoke`, `publish`, `assets` or `job_history`, each at most once. The only way to lock `assets` or `job_history`, which belong to the robot as a whole."
|
|
6456
6493
|
}),
|
|
6457
|
-
locked:
|
|
6494
|
+
locked: z28.array(appLock).max(MAX_APP_LOCKS).refine((locks) => namedOnce(locks.map((lock) => lock.robot_id)), { message: "Give each robot one entry; list all of its slugs in it." }).meta({
|
|
6458
6495
|
description: `Single exposures locked on single robots, one entry per robot and at most ${MAX_APP_LOCKS}. A lock never grants anything: it only takes away what a role would give.`
|
|
6459
6496
|
})
|
|
6460
6497
|
};
|
|
6461
|
-
var appAccessRevision =
|
|
6498
|
+
var appAccessRevision = z28.string().regex(/^[0-9a-f]{64}$/).meta({
|
|
6462
6499
|
description: "A fingerprint of the stored access, 64 lower-case hexadecimal characters. It changes whenever the stored access changes, by whichever route (a write here, a slug rename that adds the new name to a lock, a robot detached from the app). Treat it as opaque: send back the one you read."
|
|
6463
6500
|
});
|
|
6464
|
-
var appAccess =
|
|
6501
|
+
var appAccess = z28.object({
|
|
6465
6502
|
...appAccessFields,
|
|
6466
6503
|
revision: appAccessRevision.optional().meta({
|
|
6467
6504
|
description: "The `revision` of the access this body was composed from, as `GET` or `PUT /api/apps/:id/access` answered it. When it is sent and the stored access has changed since, the write is refused with `409 target_state_conflict` naming `revision` (rule `stale`) and nothing is written; read the access again and compose the body anew. Left out, the body replaces whatever is stored: the last writer wins."
|
|
6468
6505
|
})
|
|
6469
6506
|
}).strict();
|
|
6470
|
-
var accessWarning =
|
|
6471
|
-
code:
|
|
6507
|
+
var accessWarning = z28.object({
|
|
6508
|
+
code: z28.enum(["unknown_default_role", "unknown_lock_slug", "lock_robot_not_attached"]).meta({
|
|
6472
6509
|
description: "`unknown_default_role`: the default role names no role of the organization. `unknown_lock_slug`: a lock names a slug the robot has no published exposure for. `lock_robot_not_attached`: a lock names a robot that is not attached to the app."
|
|
6473
6510
|
}),
|
|
6474
|
-
message:
|
|
6511
|
+
message: z28.string().min(1).meta({
|
|
6475
6512
|
description: "A sentence a person can read, naming the key, robot or slug."
|
|
6476
6513
|
}),
|
|
6477
|
-
robot_id:
|
|
6514
|
+
robot_id: z28.uuid().nullable().meta({
|
|
6478
6515
|
description: "The robot a lock warning is about; `null` for `unknown_default_role`."
|
|
6479
6516
|
}),
|
|
6480
|
-
slug:
|
|
6517
|
+
slug: z28.string().nullable().meta({
|
|
6481
6518
|
description: "The slug an `unknown_lock_slug` warning is about; `null` for the other warnings."
|
|
6482
6519
|
})
|
|
6483
6520
|
});
|
|
6484
|
-
var appAccessResponse =
|
|
6521
|
+
var appAccessResponse = z28.object({
|
|
6485
6522
|
...appAccessFields,
|
|
6486
6523
|
revision: appAccessRevision.meta({
|
|
6487
6524
|
description: "The revision of the access as it stands. Send it back as `revision` of the next `PUT` to have that write refused when the access has changed in between."
|
|
6488
6525
|
}),
|
|
6489
|
-
warnings:
|
|
6526
|
+
warnings: z28.array(accessWarning).meta({
|
|
6490
6527
|
description: "What the access names that does not exist as written. Empty when nothing is out of step."
|
|
6491
6528
|
})
|
|
6492
6529
|
});
|
|
6493
|
-
var effectiveRightsQuery =
|
|
6530
|
+
var effectiveRightsQuery = z28.object({
|
|
6494
6531
|
role: roleKey.optional().meta({
|
|
6495
6532
|
description: "A role key to look at the app as. A key that names no role is not an error: the answer says `role_known: false` and grants nothing."
|
|
6496
6533
|
}),
|
|
6497
|
-
user:
|
|
6534
|
+
user: z28.uuid().optional().meta({
|
|
6498
6535
|
description: "An app user of this app, to look at the app as that user's role. A user of another app answers `404`."
|
|
6499
6536
|
})
|
|
6500
6537
|
}).strict().refine((query) => query.role === void 0 !== (query.user === void 0), {
|
|
6501
6538
|
message: "Name exactly one of role and user."
|
|
6502
6539
|
});
|
|
6503
|
-
var effectiveCapability =
|
|
6540
|
+
var effectiveCapability = z28.object({
|
|
6504
6541
|
name: slug.meta({
|
|
6505
6542
|
description: "The exposure's slug, or `assets` or `job_history` for the capabilities that belong to the robot as a whole."
|
|
6506
6543
|
}),
|
|
6507
6544
|
kind: accessKind.meta({
|
|
6508
6545
|
description: "The kind of access the capability needs."
|
|
6509
6546
|
}),
|
|
6510
|
-
granted:
|
|
6547
|
+
granted: z28.boolean().meta({
|
|
6511
6548
|
description: "Whether the role may use it: its requirement is met and the app has not locked it."
|
|
6512
6549
|
}),
|
|
6513
|
-
requirement:
|
|
6550
|
+
requirement: z28.array(z28.string()).meta({
|
|
6514
6551
|
description: "The role keys that qualify, from the entry, the rule or the default that decided. Holding one of them, or inheriting from one, is enough. Empty when nobody qualifies."
|
|
6515
6552
|
}),
|
|
6516
|
-
source:
|
|
6553
|
+
source: z28.enum(["entry", "rule", "robot", "org_default"]).meta({
|
|
6517
6554
|
description: "Where the requirement came from: `entry` is the entry's own `role`, `rule` the first matching rule of `access.rules`, `robot` the robot's `access.assets` or `access.job_history`, and `org_default` the organization's default for the kind."
|
|
6518
6555
|
}),
|
|
6519
|
-
rule_index:
|
|
6556
|
+
rule_index: z28.number().int().nonnegative().nullable().meta({
|
|
6520
6557
|
description: "For `rule`, the position of the deciding rule in `access.rules`, counted from zero; `null` otherwise."
|
|
6521
6558
|
}),
|
|
6522
|
-
rule_match:
|
|
6559
|
+
rule_match: z28.string().nullable().meta({
|
|
6523
6560
|
description: "For `rule`, that rule's `match` glob; `null` otherwise."
|
|
6524
6561
|
}),
|
|
6525
|
-
satisfied_by:
|
|
6562
|
+
satisfied_by: z28.string().nullable().meta({
|
|
6526
6563
|
description: "The key from `requirement` that the role holds through inheritance. `null` when the role is named in the requirement itself, and when it does not meet the requirement at all. Independent of locks."
|
|
6527
6564
|
}),
|
|
6528
|
-
locked:
|
|
6565
|
+
locked: z28.boolean().meta({
|
|
6529
6566
|
description: "Whether the app locks this capability, as a kind or as a single lock. A lock wins over the requirement."
|
|
6530
6567
|
}),
|
|
6531
|
-
unknown_roles:
|
|
6568
|
+
unknown_roles: z28.array(z28.string()).meta({
|
|
6532
6569
|
description: "Keys in the requirement that name no role of the organization. They grant nothing."
|
|
6533
6570
|
})
|
|
6534
6571
|
});
|
|
6535
|
-
var effectiveRobotRights =
|
|
6536
|
-
robot_id:
|
|
6537
|
-
robot_name:
|
|
6538
|
-
published_version:
|
|
6572
|
+
var effectiveRobotRights = z28.object({
|
|
6573
|
+
robot_id: z28.uuid().meta({ description: "The robot, one that is attached to the app." }),
|
|
6574
|
+
robot_name: z28.string().min(1).max(200).meta({ description: "The robot's name." }),
|
|
6575
|
+
published_version: z28.number().int().positive().nullable().meta({
|
|
6539
6576
|
description: "The version of the robot's published `fleetless.yaml` that the answer was computed from; `null` when nothing is published."
|
|
6540
6577
|
}),
|
|
6541
|
-
reachable:
|
|
6578
|
+
reachable: z28.boolean().meta({
|
|
6542
6579
|
description: "Whether a session of this role reaches the robot at all: at least one slug or one capability is granted once the locks are applied. When `false`, `robots.describe` answers `not_found` for the robot and `robots.list` leaves it out; `capabilities` says why, and `datasheet` is the empty one."
|
|
6543
6580
|
}),
|
|
6544
|
-
capabilities:
|
|
6581
|
+
capabilities: z28.array(effectiveCapability).meta({
|
|
6545
6582
|
description: "Every capability of the published configuration, and `assets` and `job_history`, each granted or not."
|
|
6546
6583
|
}),
|
|
6547
6584
|
datasheet: mcpRobotDatasheet.meta({
|
|
6548
6585
|
description: "The datasheet an MCP session of this role would get for the robot."
|
|
6549
6586
|
})
|
|
6550
6587
|
});
|
|
6551
|
-
var effectiveRightsResponse =
|
|
6552
|
-
role:
|
|
6588
|
+
var effectiveRightsResponse = z28.object({
|
|
6589
|
+
role: z28.string().nullable().meta({
|
|
6553
6590
|
description: "The role key the answer is for: the one asked about, or the app user's own. `null` when the app user holds none."
|
|
6554
6591
|
}),
|
|
6555
|
-
role_known:
|
|
6592
|
+
role_known: z28.boolean().meta({
|
|
6556
6593
|
description: "Whether the key names a role of the organization. `false` means every capability below is not granted."
|
|
6557
6594
|
}),
|
|
6558
|
-
user_id:
|
|
6595
|
+
user_id: z28.uuid().nullable().meta({
|
|
6559
6596
|
description: "The app user asked about; `null` when a role was asked about. A user who is not `active` reaches nothing, whatever role they hold: every capability below is not granted."
|
|
6560
6597
|
}),
|
|
6561
|
-
robots:
|
|
6598
|
+
robots: z28.array(effectiveRobotRights).meta({
|
|
6562
6599
|
description: "The robots attached to the app, each with what the role may use."
|
|
6563
6600
|
}),
|
|
6564
|
-
collections:
|
|
6601
|
+
collections: z28.array(roleCollectionRights).meta({
|
|
6565
6602
|
description: "What the role may do with the records of each collection of the app's latest published schema, in the schema's order. Empty when the app has no published schema. A role that is no role, and a user who is not `active`, are granted nothing in any row."
|
|
6566
6603
|
})
|
|
6567
6604
|
});
|
|
6568
6605
|
|
|
6569
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6570
|
-
var clientLoginRequest =
|
|
6606
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/client-auth.js
|
|
6607
|
+
var clientLoginRequest = z29.object({
|
|
6571
6608
|
app_identifier: appIdentifier.meta({
|
|
6572
6609
|
description: "The app being logged in to: its globally unique, lowercase, underscore-separated identifier, chosen by the developer at creation. There is no organisation context at login, so this is what decides which app the credentials are checked for."
|
|
6573
6610
|
}),
|
|
6574
|
-
email:
|
|
6611
|
+
email: z29.email().meta({
|
|
6575
6612
|
description: "The app user's address. Addresses are unique **per app**, not across Fleetless: the same address may be an unrelated account in another app of the same organisation, so this pair is what identifies a person here."
|
|
6576
6613
|
}),
|
|
6577
|
-
password:
|
|
6614
|
+
password: z29.string().min(1).meta({
|
|
6578
6615
|
description: "The app user's password. A wrong pair is refused without saying which half was wrong \u2014 and a `blocked` or not-yet-verified account is refused identically, so a failed login is not an account-enumeration oracle in any of its three forms."
|
|
6579
6616
|
})
|
|
6580
6617
|
});
|
|
6581
|
-
var clientRefreshRequest =
|
|
6582
|
-
refresh_token:
|
|
6618
|
+
var clientRefreshRequest = z29.object({
|
|
6619
|
+
refresh_token: z29.string().min(1).meta({
|
|
6583
6620
|
description: "The refresh token from the last login or refresh. Refresh tokens rotate on every use, so the value sent here is spent \u2014 keep the one that comes back, and presenting a spent one is treated as theft and ends the whole family."
|
|
6584
6621
|
})
|
|
6585
6622
|
});
|
|
6586
|
-
var clientLogoutRequest =
|
|
6587
|
-
refresh_token:
|
|
6623
|
+
var clientLogoutRequest = z29.object({
|
|
6624
|
+
refresh_token: z29.string().min(1).meta({
|
|
6588
6625
|
description: "Any refresh token of the session to end. The whole token family is revoked server-side, so a token stolen before this call stops working too \u2014 clearing a client-side store is a gesture, not a revocation. The answer is `204`: a token the server does not recognise gets it too, since that is the end state being asked for."
|
|
6589
6626
|
})
|
|
6590
6627
|
});
|
|
6591
|
-
var clientLoginCodeRequest =
|
|
6628
|
+
var clientLoginCodeRequest = z29.object({
|
|
6592
6629
|
app_identifier: appIdentifier.meta({ description: "The app to sign in to. An identifier no app carries is `404 not_found`; the address is never the subject of a refusal." }),
|
|
6593
|
-
email:
|
|
6630
|
+
email: z29.email().meta({
|
|
6594
6631
|
description: "The address to mail the code to, trimmed and compared case-insensitively. `202` whether or not it names an account of this app."
|
|
6595
6632
|
})
|
|
6596
6633
|
}).strict();
|
|
6597
|
-
var clientLoginCodeVerifyRequest =
|
|
6634
|
+
var clientLoginCodeVerifyRequest = z29.object({
|
|
6598
6635
|
app_identifier: appIdentifier.meta({ description: "The app the code was requested for." }),
|
|
6599
|
-
email:
|
|
6636
|
+
email: z29.email().meta({ description: "The address the code was mailed to, as typed when it was requested; trimmed and compared case-insensitively." }),
|
|
6600
6637
|
code: loginCode.meta({ description: "The six digits from the mail, exactly \u2014 leading zeros included, no spaces." })
|
|
6601
6638
|
}).strict();
|
|
6602
|
-
var twoFactorChallenge =
|
|
6603
|
-
status:
|
|
6639
|
+
var twoFactorChallenge = z29.object({
|
|
6640
|
+
status: z29.enum(["two_factor_required", "two_factor_setup_required"]).meta({
|
|
6604
6641
|
description: "`two_factor_required`: ask for the authenticator code. `two_factor_setup_required`: the app requires two-factor and the person has none yet, so set one up before any session exists."
|
|
6605
6642
|
}),
|
|
6606
|
-
challenge:
|
|
6643
|
+
challenge: z29.string().min(1).meta({
|
|
6607
6644
|
description: "The handle the next step spends. Valid five minutes; afterwards it answers `410 token_spent` and the sign-in starts over."
|
|
6608
6645
|
})
|
|
6609
6646
|
});
|
|
6610
|
-
var clientSignInResult =
|
|
6611
|
-
var clientTwoFactorVerifyRequest =
|
|
6612
|
-
challenge:
|
|
6647
|
+
var clientSignInResult = z29.union([sessionTokens, twoFactorChallenge]);
|
|
6648
|
+
var clientTwoFactorVerifyRequest = z29.object({
|
|
6649
|
+
challenge: z29.string().min(1).meta({ description: "The challenge the sign-in step answered." }),
|
|
6613
6650
|
code: totpCode.optional().meta({ description: "The six-digit code the authenticator shows now. A code already accepted once is refused, so a replay of a seen code does not sign anybody in." }),
|
|
6614
6651
|
recovery_code: recoveryCode.optional().meta({ description: "One of the ten recovery codes, `xxxxx-xxxxx`, in either case. Spent by its use." })
|
|
6615
6652
|
}).strict().refine((b) => b.code === void 0 !== (b.recovery_code === void 0), { message: "Send exactly one of code and recovery_code." });
|
|
6616
|
-
var clientTwoFactorSetupRequest =
|
|
6617
|
-
challenge:
|
|
6653
|
+
var clientTwoFactorSetupRequest = z29.object({
|
|
6654
|
+
challenge: z29.string().min(1).optional().meta({
|
|
6618
6655
|
description: "The `two_factor_setup_required` challenge, during sign-in. Absent when the call carries the app user's bearer instead."
|
|
6619
6656
|
})
|
|
6620
6657
|
}).strict();
|
|
6621
|
-
var clientTwoFactorSetupConfirmRequest =
|
|
6622
|
-
challenge:
|
|
6658
|
+
var clientTwoFactorSetupConfirmRequest = z29.object({
|
|
6659
|
+
challenge: z29.string().min(1).optional().meta({ description: "The same challenge as at `setup`, during sign-in; absent with a bearer." }),
|
|
6623
6660
|
code: totpCode.meta({ description: "A code the new authenticator shows now. It proves the secret was copied correctly before anything depends on it." })
|
|
6624
6661
|
}).strict();
|
|
6625
|
-
var clientTwoFactorSetupConfirmResponse =
|
|
6662
|
+
var clientTwoFactorSetupConfirmResponse = z29.object({
|
|
6626
6663
|
recovery_codes: recoveryCodesList.meta({
|
|
6627
6664
|
description: "The ten single-use recovery codes, lowercase, shown once. Any earlier set is void."
|
|
6628
6665
|
}),
|
|
6629
6666
|
session: sessionTokens.meta({ description: "The session the sign-in was waiting for, or a fresh one for the account settings." })
|
|
6630
6667
|
});
|
|
6631
|
-
var clientTwoFactorDisableRequest =
|
|
6668
|
+
var clientTwoFactorDisableRequest = z29.object({
|
|
6632
6669
|
code: totpCode.meta({ description: "A code the authenticator shows now." })
|
|
6633
6670
|
}).strict();
|
|
6634
|
-
var clientRegisterRequest =
|
|
6671
|
+
var clientRegisterRequest = z29.object({
|
|
6635
6672
|
app_identifier: appIdentifier.meta({
|
|
6636
6673
|
description: "The app to register with. An identifier no app carries is `404 not_found` \u2014 an identifier is public, so naming it is no disclosure, and collapsing it into `registration_closed` sent a developer who mistyped their own identifier hunting a configuration bug that was not there. The **address** is never the subject of a refusal."
|
|
6637
6674
|
}),
|
|
6638
|
-
email:
|
|
6675
|
+
email: z29.email().meta({
|
|
6639
6676
|
description: "The address to register. Unique per app, case-insensitively. An address this app already knows still answers `202`, without a mail \u2014 the answer may not say whether an account exists."
|
|
6640
6677
|
}),
|
|
6641
6678
|
password: password.optional().meta({
|
|
6642
6679
|
description: "The password for the new account, at least 12 characters. **Required while the app's password method is on, refused while it is off** \u2014 both as `400 validation_error` naming `password`. An email-code-only app registers people without one."
|
|
6643
6680
|
}),
|
|
6644
|
-
display_name:
|
|
6681
|
+
display_name: z29.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
6645
6682
|
description: "An optional human name for the account. The developer's own UI decides whether to ask for it."
|
|
6646
6683
|
})
|
|
6647
6684
|
}).strict();
|
|
6648
|
-
var clientVerifyEmailRequest =
|
|
6649
|
-
token:
|
|
6685
|
+
var clientVerifyEmailRequest = z29.object({
|
|
6686
|
+
token: z29.string().min(1).meta({
|
|
6650
6687
|
description: "The opaque token from the verification link, valid 24 hours. Unknown, expired and already-spent all answer `410 token_spent` \u2014 telling them apart would say whether a token ever existed."
|
|
6651
6688
|
})
|
|
6652
6689
|
}).strict();
|
|
6653
|
-
var clientResendVerificationRequest =
|
|
6690
|
+
var clientResendVerificationRequest = z29.object({
|
|
6654
6691
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
6655
|
-
email:
|
|
6692
|
+
email: z29.email().meta({
|
|
6656
6693
|
description: "The address to re-send to. The answer is `202` whether or not it names an account, and whether or not that account is already verified."
|
|
6657
6694
|
})
|
|
6658
6695
|
}).strict();
|
|
6659
|
-
var clientPasswordResetRequest =
|
|
6696
|
+
var clientPasswordResetRequest = z29.object({
|
|
6660
6697
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
6661
|
-
email:
|
|
6698
|
+
email: z29.email().meta({
|
|
6662
6699
|
description: "The address to mail a reset link to. The answer is `202` for a known address and an unknown one alike, in status, body and timing. An app identifier no app carries is `404 not_found`; the address is never the subject of a refusal."
|
|
6663
6700
|
})
|
|
6664
6701
|
}).strict();
|
|
6665
|
-
var clientPasswordResetConfirmRequest =
|
|
6666
|
-
token:
|
|
6702
|
+
var clientPasswordResetConfirmRequest = z29.object({
|
|
6703
|
+
token: z29.string().min(1).meta({
|
|
6667
6704
|
description: "The opaque token from the reset link, valid one hour. Single-use; unknown, expired and spent all answer `410 token_spent`."
|
|
6668
6705
|
}),
|
|
6669
6706
|
new_password: password.meta({
|
|
6670
6707
|
description: "The replacement password. Accepting it revokes every refresh family the account holds \u2014 the answer carries a fresh pair, so the person is signed in on the device that completed the reset and nowhere else."
|
|
6671
6708
|
})
|
|
6672
6709
|
}).strict();
|
|
6673
|
-
var clientAcceptInvitationRequest =
|
|
6674
|
-
token:
|
|
6710
|
+
var clientAcceptInvitationRequest = z29.object({
|
|
6711
|
+
token: z29.string().min(1).meta({
|
|
6675
6712
|
description: "The opaque token from the invitation link, valid seven days. Unknown, expired, revoked and already-accepted all answer `410 token_spent`."
|
|
6676
6713
|
}),
|
|
6677
6714
|
password: password.optional().meta({
|
|
6678
6715
|
description: "The password the new account will use, at least 12 characters. **Required while the app's password method is on, refused while it is off** \u2014 both as `400 validation_error` naming `password`. An email-code-only app accepts invitations without one."
|
|
6679
6716
|
}),
|
|
6680
|
-
display_name:
|
|
6717
|
+
display_name: z29.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
6681
6718
|
description: "An optional name, overriding whatever the invitation pre-filled."
|
|
6682
6719
|
})
|
|
6683
6720
|
}).strict();
|
|
6684
6721
|
var CLIENT_OIDC_CALLBACK_PATH = "/api/client/oidc/callback";
|
|
6685
|
-
var clientProviderListQuery =
|
|
6722
|
+
var clientProviderListQuery = z29.object({
|
|
6686
6723
|
app_identifier: appIdentifier.meta({ description: "The app whose enabled providers to list." })
|
|
6687
6724
|
}).meta({ description: "The one parameter of the public provider listing." });
|
|
6688
|
-
var clientProviderListResponse =
|
|
6689
|
-
providers:
|
|
6725
|
+
var clientProviderListResponse = z29.object({
|
|
6726
|
+
providers: z29.array(z29.object({
|
|
6690
6727
|
slug: providerSlug.meta({ description: "The handle to put in the start URL: `GET /api/client/oidc/<slug>/start`." }),
|
|
6691
|
-
name:
|
|
6728
|
+
name: z29.string().meta({ description: "What to write on the button, as the developer configured it." })
|
|
6692
6729
|
})).meta({
|
|
6693
6730
|
description: "The app's **enabled** providers, slug and display name only. An app with none answers an empty array, which is the state of an app that offers password or code sign-in alone."
|
|
6694
6731
|
}),
|
|
@@ -6699,41 +6736,41 @@ var clientProviderListResponse = z28.object({
|
|
|
6699
6736
|
description: "The app's off, optional or required two-factor policy; not the caller's enrollment state."
|
|
6700
6737
|
})
|
|
6701
6738
|
});
|
|
6702
|
-
var clientOidcStartQuery =
|
|
6739
|
+
var clientOidcStartQuery = z29.object({
|
|
6703
6740
|
app_identifier: appIdentifier.meta({ description: "The app being signed in to." }),
|
|
6704
|
-
redirect_uri:
|
|
6741
|
+
redirect_uri: z29.url().max(2e3).meta({
|
|
6705
6742
|
description: "Where to send the browser when the flow finishes, with `code` and `state` or with `error` and `state`. **Its origin must be one of the app's `allowed_origins`**; a failure here is refused flat, with no redirect, because until the target is confirmed there is nowhere trusted to bounce a browser to."
|
|
6706
6743
|
}),
|
|
6707
|
-
state:
|
|
6744
|
+
state: z29.string().min(8).max(512).meta({
|
|
6708
6745
|
description: "Returned unchanged on the callback, and on the error redirect too, so the app can bind either answer to the request it started. At least eight characters: this is what ties the callback to the browser that began the flow, and a guessable value defends nothing."
|
|
6709
6746
|
}),
|
|
6710
|
-
code_challenge:
|
|
6747
|
+
code_challenge: z29.string().regex(/^[A-Za-z0-9_-]{43,128}$/).meta({
|
|
6711
6748
|
description: "The app's own PKCE challenge (RFC 7636, S256 base64url). The verifier is presented at `oidc/exchange`, so the one-time code is worth nothing to whoever intercepts the redirect. `plain` is not accepted: a challenge equal to its verifier defends against nothing."
|
|
6712
6749
|
})
|
|
6713
6750
|
});
|
|
6714
|
-
var clientOidcCallbackQuery =
|
|
6715
|
-
state:
|
|
6751
|
+
var clientOidcCallbackQuery = z29.object({
|
|
6752
|
+
state: z29.string().min(1).meta({
|
|
6716
6753
|
description: "The opaque state Fleetless sent to the provider, which resolves the pending interaction \u2014 and with it the app's `redirect_uri`. Not the app's own `state` from `start`: that one is stored on the interaction and put back on the redirect to the app. A callback whose state resolves to nothing has no confirmed target to answer, and is the one case Fleetless renders a page for."
|
|
6717
6754
|
}),
|
|
6718
|
-
code:
|
|
6755
|
+
code: z29.string().min(1).optional().meta({
|
|
6719
6756
|
description: "The provider's authorization code, present when the sign-in succeeded. Exchanged server-side by the cloud, so it never reaches the app \u2014 the app gets its own one-time code, bound to the PKCE challenge it sent at `start`."
|
|
6720
6757
|
}),
|
|
6721
|
-
error:
|
|
6758
|
+
error: z29.string().min(1).optional().meta({
|
|
6722
6759
|
description: "The provider's own refusal, present instead of `code` when the person declined or the provider would not issue one. It is carried back to the app as a `clientOidcErrorCode`, not passed through: the provider's vocabulary is its own, and an app branching on it would be branching on a string nobody here controls."
|
|
6723
6760
|
}),
|
|
6724
|
-
error_description:
|
|
6761
|
+
error_description: z29.string().optional().meta({
|
|
6725
6762
|
description: "The provider's human-readable note about `error`, when it sends one. Logged, never rendered to an app user and never put on the redirect \u2014 it is text from a system Fleetless does not run."
|
|
6726
6763
|
})
|
|
6727
6764
|
});
|
|
6728
|
-
var clientOidcExchangeRequest =
|
|
6729
|
-
code:
|
|
6765
|
+
var clientOidcExchangeRequest = z29.object({
|
|
6766
|
+
code: z29.string().min(1).meta({
|
|
6730
6767
|
description: "The one-time code from the callback redirect. Valid 60 seconds, single-use, and bound to the PKCE challenge the start step carried."
|
|
6731
6768
|
}),
|
|
6732
|
-
code_verifier:
|
|
6769
|
+
code_verifier: z29.string().regex(/^[A-Za-z0-9_.~-]{43,128}$/).meta({
|
|
6733
6770
|
description: "The verifier for the challenge sent at `start`. RFC 7636 \xA74.1's alphabet and length."
|
|
6734
6771
|
})
|
|
6735
6772
|
}).strict();
|
|
6736
|
-
var clientOidcErrorCode =
|
|
6773
|
+
var clientOidcErrorCode = z29.enum([
|
|
6737
6774
|
"no_access",
|
|
6738
6775
|
"email_taken",
|
|
6739
6776
|
"email_unverified",
|
|
@@ -6748,255 +6785,255 @@ var clientOidcErrorCode = z28.enum([
|
|
|
6748
6785
|
"quota_exceeded",
|
|
6749
6786
|
"plan_limit"
|
|
6750
6787
|
]);
|
|
6751
|
-
var clientMcpInteraction =
|
|
6752
|
-
id:
|
|
6753
|
-
app_id:
|
|
6754
|
-
client_name:
|
|
6755
|
-
client_name_verified:
|
|
6788
|
+
var clientMcpInteraction = z29.object({
|
|
6789
|
+
id: z29.string().meta({ description: "The interaction, as it arrived in the app's `mcp_login_url`. Not a credential: it names a pending request the server already holds, and approving it needs the app user's own access token." }),
|
|
6790
|
+
app_id: z29.uuid().meta({ description: "The app this authorization is for. The approving token's `app_id` must match it \u2014 an interaction of one app cannot be approved with a session from another." }),
|
|
6791
|
+
client_name: z29.string().nullable().meta({ description: "What the MCP client calls itself, or `null` if it named nothing. **Unverified** \u2014 see `client_name_verified`." }),
|
|
6792
|
+
client_name_verified: z29.literal(false).meta({
|
|
6756
6793
|
description: "Always `false`. The client named itself \u2014 in an unauthenticated dynamic registration or in its own Client ID Metadata Document \u2014 so the name must be rendered as a claim and never as an identity. Only `client_id_host` was checked, by fetching the document from it. There is no verified case, which is why this is a literal and not a boolean: a `true` branch would be dead code that looked like a safeguard."
|
|
6757
6794
|
}),
|
|
6758
|
-
client_id_host:
|
|
6795
|
+
client_id_host: z29.string().nullable().meta({
|
|
6759
6796
|
description: "The hostname of the client's `client_id` when that id is the HTTPS URL of a Client ID Metadata Document, which the authorization server fetched from this host; `null` for a client that registered itself by dynamic registration. Show it beside the name: it is the one part of the client's description somebody checked."
|
|
6760
6797
|
}),
|
|
6761
|
-
redirect_uri_host:
|
|
6798
|
+
redirect_uri_host: z29.string().meta({
|
|
6762
6799
|
description: "The hostname of the redirect URI this authorization will answer to \u2014 where the authorization code is sent. Show it on the consent screen (MCP 2026-07-28 requires it). An IPv6 literal keeps its brackets."
|
|
6763
6800
|
}),
|
|
6764
|
-
redirect_uri_loopback:
|
|
6801
|
+
redirect_uri_loopback: z29.boolean().meta({
|
|
6765
6802
|
description: '`true` when the redirect URI is `http` on a loopback address (`localhost`, `127.0.0.1`, `[::1]`): the answer goes to a program on the person\'s own computer, on any port it chose. Warn about it, for example: "This client receives the answer on this computer (127.0.0.1). Approve only if you started it here."'
|
|
6766
6803
|
}),
|
|
6767
|
-
scopes:
|
|
6768
|
-
already_granted:
|
|
6769
|
-
expires_at:
|
|
6804
|
+
scopes: z29.array(z29.string()).meta({ description: "The scopes the client asked for, to show the person before they approve." }),
|
|
6805
|
+
already_granted: z29.boolean().meta({ description: "Whether this user has already approved this client. It is a record of what they answered last time, and **this route makes no second use of it**: an app that skips its own consent screen when this is `true` is the only thing deciding that, and approve succeeds identically for a user who holds no grant at all. The standing grant is read elsewhere, on every request to the app's MCP endpoint. Withdrawing it is `DELETE /api/client/mcp/grants/:clientId` for the person themselves and `DELETE /api/apps/:id/users/:userId/mcp-grants/:clientId` for the developer. A withdrawal makes this `false` again at the next authorization **and stops the client at its very next MCP call**, unexpired access token and all \u2014 up to fifteen minutes of it \u2014 because the endpoint keys that check on the `client_id` the token carries." }),
|
|
6806
|
+
expires_at: z29.iso.datetime().meta({ description: "When the interaction stops being approvable. Ten minutes from the authorize step; afterwards both approve and deny answer `interaction_expired`." })
|
|
6770
6807
|
});
|
|
6771
|
-
var clientMcpInteractionDecisionResponse =
|
|
6772
|
-
redirect_to:
|
|
6808
|
+
var clientMcpInteractionDecisionResponse = z29.object({
|
|
6809
|
+
redirect_to: z29.url().meta({
|
|
6773
6810
|
description: "Send the browser here. It is the MCP client's own callback, carrying either the authorization code or `error=access_denied` \u2014 a denial redirects as well, so the client learns the outcome from the place it is waiting."
|
|
6774
6811
|
})
|
|
6775
6812
|
});
|
|
6776
|
-
var mcpConsentGrant =
|
|
6777
|
-
client_id:
|
|
6813
|
+
var mcpConsentGrant = z29.object({
|
|
6814
|
+
client_id: z29.string().meta({
|
|
6778
6815
|
description: "The MCP client this consent is for: the id its dynamic registration was issued, or the HTTPS URL of its Client ID Metadata Document. It is the value the withdrawal routes take in their path, percent-encoded, and it is the only stable handle on a client \u2014 the name beside it is not one."
|
|
6779
6816
|
}),
|
|
6780
|
-
client_id_host:
|
|
6817
|
+
client_id_host: z29.string().nullable().meta({
|
|
6781
6818
|
description: "The hostname of `client_id` when it is a Client ID Metadata Document URL; `null` for a self-registered client. The grant is to whoever controls that domain."
|
|
6782
6819
|
}),
|
|
6783
|
-
client_name:
|
|
6820
|
+
client_name: z29.string().nullable().meta({
|
|
6784
6821
|
description: "What the client calls itself, or `null` once its registration or cached metadata document is gone. **Unverified** \u2014 see `client_name_verified`."
|
|
6785
6822
|
}),
|
|
6786
|
-
client_name_verified:
|
|
6823
|
+
client_name_verified: z29.literal(false).meta({
|
|
6787
6824
|
description: "Always `false`. The client named itself \u2014 in an unauthenticated dynamic registration or in its own Client ID Metadata Document \u2014 so the name must be rendered as a claim and never as an identity. Only `client_id_host` was checked, by fetching the document from it. There is no verified case, which is why this is a literal and not a boolean: a `true` branch would be dead code that looked like a safeguard."
|
|
6788
6825
|
}),
|
|
6789
|
-
granted_at:
|
|
6826
|
+
granted_at: z29.iso.datetime().meta({
|
|
6790
6827
|
description: "When the consent was last given. A withdrawal followed by a fresh approval moves it, because the second approval is the agreement that stands \u2014 it is not a record of the first time anybody ever said yes."
|
|
6791
6828
|
})
|
|
6792
6829
|
});
|
|
6793
|
-
var mcpConsentGrantListResponse =
|
|
6794
|
-
grants:
|
|
6830
|
+
var mcpConsentGrantListResponse = z29.object({
|
|
6831
|
+
grants: z29.array(mcpConsentGrant).meta({
|
|
6795
6832
|
description: "Every standing consent this app user holds, newest first. Withdrawn ones are absent rather than listed as withdrawn; an app user who has connected no MCP client answers an empty array."
|
|
6796
6833
|
})
|
|
6797
6834
|
});
|
|
6798
|
-
var clientIdentity =
|
|
6799
|
-
kind:
|
|
6835
|
+
var clientIdentity = z29.object({
|
|
6836
|
+
kind: z29.enum(["developer", "app_user", "server_key"]).meta({
|
|
6800
6837
|
description: "Which of the three kinds of caller this is: a `developer` working through the console, an `app_user` holding a token from a client login, or a `server_key` used by server-side code. Stated outright, not inferred from which id is set."
|
|
6801
6838
|
}),
|
|
6802
|
-
developer_id:
|
|
6839
|
+
developer_id: z29.uuid().nullable().meta({
|
|
6803
6840
|
description: "The Fleetless user behind this session, or `null` when `kind` is not `developer`."
|
|
6804
6841
|
}),
|
|
6805
|
-
app_user_id:
|
|
6842
|
+
app_user_id: z29.uuid().nullable().meta({
|
|
6806
6843
|
description: "The app user behind this session, or `null` when `kind` is not `app_user`. An app user belongs to exactly one app and is unrelated to any Fleetless user with the same address."
|
|
6807
6844
|
}),
|
|
6808
|
-
server_key_id:
|
|
6845
|
+
server_key_id: z29.uuid().nullable().meta({
|
|
6809
6846
|
description: "The server key this session was authenticated with, or `null` when `kind` is not `server_key`."
|
|
6810
6847
|
}),
|
|
6811
|
-
app_id:
|
|
6848
|
+
app_id: z29.uuid().nullable().meta({
|
|
6812
6849
|
description: "The app this session belongs to, and `null` for a developer \u2014 a developer is organisation-scoped and owns the configuration of every robot in the organisation rather than reaching one through an app."
|
|
6813
6850
|
}),
|
|
6814
|
-
role:
|
|
6851
|
+
role: z29.object({
|
|
6815
6852
|
key: roleKey.meta({
|
|
6816
6853
|
description: "The role's key, the same string `fleetless.yaml` and the organization's role list write."
|
|
6817
6854
|
}),
|
|
6818
|
-
name:
|
|
6855
|
+
name: z29.string().meta({
|
|
6819
6856
|
description: "The role's display name, for showing the caller what they hold. Changing it changes nothing about rights."
|
|
6820
6857
|
})
|
|
6821
6858
|
}).nullable().meta({
|
|
6822
6859
|
description: "The organization role that decides what this caller may reach: its key and display name. `null` when there is no role to name: for a developer and for a server key, which are not filtered by a role, and for an app user whose key names no role (the role was deleted), who then reaches nothing."
|
|
6823
6860
|
}),
|
|
6824
|
-
email:
|
|
6861
|
+
email: z29.email().nullable().meta({
|
|
6825
6862
|
description: "The address of the Fleetless user or app user behind this session, and `null` for a server key, which is not a person."
|
|
6826
6863
|
}),
|
|
6827
|
-
two_factor_enabled:
|
|
6864
|
+
two_factor_enabled: z29.boolean().nullable().meta({
|
|
6828
6865
|
description: "Whether the app user has a confirmed authenticator, so the app's account settings can offer to turn it on or off. `null` unless `kind` is `app_user`."
|
|
6829
6866
|
})
|
|
6830
6867
|
});
|
|
6831
6868
|
|
|
6832
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6833
|
-
import { z as
|
|
6834
|
-
var timestamp =
|
|
6835
|
-
var count3 =
|
|
6836
|
-
var schemaVersion =
|
|
6837
|
-
var collectionActor =
|
|
6838
|
-
kind:
|
|
6869
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-records.js
|
|
6870
|
+
import { z as z30 } from "zod";
|
|
6871
|
+
var timestamp = z30.iso.datetime();
|
|
6872
|
+
var count3 = z30.number().int().min(0);
|
|
6873
|
+
var schemaVersion = z30.number().int().min(1);
|
|
6874
|
+
var collectionActor = z30.object({
|
|
6875
|
+
kind: z30.enum(["developer", "app_user", "server_key", "fleetless"]).meta({
|
|
6839
6876
|
description: "What made the change: a developer, a user of the app, a server key of the app, or the platform itself."
|
|
6840
6877
|
}),
|
|
6841
|
-
id:
|
|
6842
|
-
label:
|
|
6878
|
+
id: z30.uuid().meta({ description: "The id of the developer, app user or server key. The nil id for the platform." }),
|
|
6879
|
+
label: z30.string().min(1).max(200).meta({
|
|
6843
6880
|
description: "A name to show: the person's display name, the name of a server key, `Fleetless`, `Deleted user` when the user no longer exists, or `Deleted key` when the key does. A person without a display name reads as their email address to a developer or a server key and to themselves, and to an app user reading someone else as `Team member` (a developer) or `User` (an app user): an app user never learns another person's address."
|
|
6844
6881
|
})
|
|
6845
6882
|
}).meta({ description: "Who or what made a change to a record." });
|
|
6846
|
-
var collectionRecord =
|
|
6847
|
-
id:
|
|
6848
|
-
robot_id:
|
|
6883
|
+
var collectionRecord = z30.object({
|
|
6884
|
+
id: z30.uuid(),
|
|
6885
|
+
robot_id: z30.uuid().nullable().meta({
|
|
6849
6886
|
description: "The robot a record of a `per_robot` or `one_per_robot` collection belongs to; null in a `global` collection."
|
|
6850
6887
|
}),
|
|
6851
6888
|
created_at: timestamp,
|
|
6852
6889
|
created_by: collectionActor,
|
|
6853
6890
|
updated_at: timestamp,
|
|
6854
6891
|
updated_by: collectionActor,
|
|
6855
|
-
revision:
|
|
6856
|
-
display:
|
|
6857
|
-
missing_required:
|
|
6892
|
+
revision: z30.number().int().min(1).meta({ description: "Starts at 1 and grows by one with every change. Send it as `expected_revision` to refuse a write that would overwrite a newer one." }),
|
|
6893
|
+
display: z30.string().meta({ description: "The collection's display template filled in for this record." }),
|
|
6894
|
+
missing_required: z30.array(z30.string()).meta({
|
|
6858
6895
|
description: "Required fields that are empty because the schema changed after the record was written. The record can still be updated in its other fields. Absent when nothing is missing."
|
|
6859
6896
|
}).optional(),
|
|
6860
|
-
values:
|
|
6897
|
+
values: z30.record(z30.string(), z30.unknown()).meta({
|
|
6861
6898
|
description: "The record's fields by key. A field without a value is absent. With `expand`, a reference field holds the referenced record in this same shape instead of its id, when the caller may read that collection."
|
|
6862
6899
|
}),
|
|
6863
6900
|
deleted_at: timestamp.meta({ description: "When the record was deleted. Present only in the list of deleted records (`deleted=true`); absent on a live record." }).optional(),
|
|
6864
6901
|
deleted_by: collectionActor.meta({ description: "Who deleted the record. Present only in the list of deleted records (`deleted=true`); absent on a live record." }).optional()
|
|
6865
6902
|
}).meta({ description: "A record of a collection: its system fields and its values." });
|
|
6866
|
-
var collectionFilter =
|
|
6903
|
+
var collectionFilter = z30.record(z30.string(), z30.unknown()).meta({
|
|
6867
6904
|
description: 'A filter is a JSON object. A condition names a field and one operator: `{ "location.name": { "eq": "XTD1" } }`. The operators are `eq`, `ne`, `lt`, `lte`, `gt`, `gte`, `contains` (case-insensitive text search), `in` (a list of at most 100 values) and `empty` (`true` or `false`). Conditions are combined with `{ "and": [ ... ] }` and `{ "or": [ ... ] }`, nested at most 3 levels deep, 50 conditions in all. A field is a field key, `reference.field` to go one hop through a reference field, or one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`.'
|
|
6868
6905
|
});
|
|
6869
|
-
var pageLimit =
|
|
6870
|
-
var wireBoolean =
|
|
6871
|
-
var expandParam =
|
|
6906
|
+
var pageLimit = z30.union([z30.string().regex(/^\d{1,4}$/), z30.number().int()]).transform((v) => Number(v)).pipe(z30.number().int().positive().max(COLLECTION_LIMITS.pageMax));
|
|
6907
|
+
var wireBoolean = z30.enum(["true", "false"]);
|
|
6908
|
+
var expandParam = z30.string().min(1).meta({
|
|
6872
6909
|
description: "Reference fields to embed as records, separated by commas. Only one hop is followed. The embedded records are not counted in the size of a page."
|
|
6873
6910
|
});
|
|
6874
|
-
var collectionRecordListQuery =
|
|
6875
|
-
filter:
|
|
6911
|
+
var collectionRecordListQuery = z30.object({
|
|
6912
|
+
filter: z30.string().min(1).meta({
|
|
6876
6913
|
description: 'A filter as JSON text, for example `{"location.name":{"eq":"XTD1"}}`. A condition names a field of the collection, one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`, or a field of a referenced record written `reference.field`. `created_by` is compared with the id of the developer, user or key that created the record.'
|
|
6877
6914
|
}).optional(),
|
|
6878
|
-
search:
|
|
6915
|
+
search: z30.string().meta({
|
|
6879
6916
|
description: "Words that must all occur, in any letter case, in at least one searchable field of the record. At most 10 words, separated by whitespace."
|
|
6880
6917
|
}).optional(),
|
|
6881
|
-
sort:
|
|
6918
|
+
sort: z30.string().min(1).meta({
|
|
6882
6919
|
description: "Up to 3 fields separated by commas; a leading `-` sorts descending, for example `-position_m,name`. A field is named as in `filter`: a field of the collection, one of the system fields `id`, `robot_id`, `created_at`, `updated_at` and `created_by`, or `reference.field`. Ties are broken by `id`."
|
|
6883
6920
|
}).optional(),
|
|
6884
6921
|
expand: expandParam.optional(),
|
|
6885
6922
|
limit: pageLimit.meta({
|
|
6886
6923
|
description: `The most records to return, 1 to ${COLLECTION_LIMITS.pageMax}. Default ${COLLECTION_LIMITS.pageDefault}. A page can hold fewer: see \`next_cursor\`.`
|
|
6887
6924
|
}).optional(),
|
|
6888
|
-
cursor:
|
|
6925
|
+
cursor: z30.string().min(1).meta({ description: "The `next_cursor` of the previous page." }).optional(),
|
|
6889
6926
|
count: wireBoolean.meta({ description: "`true` adds `total`, the number of records that match." }).optional(),
|
|
6890
6927
|
deleted: wireBoolean.meta({ description: "`true` lists deleted records instead, newest deletion first. Needs the right to create records." }).optional(),
|
|
6891
|
-
robot:
|
|
6928
|
+
robot: z30.uuid().meta({ description: "Only the records of this robot, in a collection that belongs to robots." }).optional()
|
|
6892
6929
|
}).strict();
|
|
6893
|
-
var collectionRecordGetQuery =
|
|
6894
|
-
var collectionRecordListResponse =
|
|
6895
|
-
records:
|
|
6930
|
+
var collectionRecordGetQuery = z30.object({ expand: expandParam.optional() }).strict();
|
|
6931
|
+
var collectionRecordListResponse = z30.object({
|
|
6932
|
+
records: z30.array(collectionRecord).meta({
|
|
6896
6933
|
description: "The records of the page. A page is cut short at 4 MiB of stored record values (for the list of deleted records, of the revisions that deleted them), so it can hold fewer than `limit` records while more follow. It always holds at least one record when there is one, and a list of ordinary size is never cut."
|
|
6897
6934
|
}),
|
|
6898
|
-
next_cursor:
|
|
6935
|
+
next_cursor: z30.string().nullable().meta({
|
|
6899
6936
|
description: "Send it as `cursor` to read the next page; it continues after the last record this page holds. Null when this is the last page, which a short page does not say on its own: only `null` says the list is at its end."
|
|
6900
6937
|
}),
|
|
6901
6938
|
total: count3.meta({ description: "The number of records that match, sent only when `count=true` was asked for. A page cut short does not change it." }).optional()
|
|
6902
6939
|
}).meta({ description: "One page of records." });
|
|
6903
|
-
var collectionRecordWrite =
|
|
6904
|
-
values:
|
|
6940
|
+
var collectionRecordWrite = z30.object({
|
|
6941
|
+
values: z30.record(z30.string(), z30.unknown()).meta({
|
|
6905
6942
|
description: `The fields to set by key. A \`null\` clears a field. On an update, fields that are left out keep their value. A record may hold ${COLLECTION_LIMITS.recordBytes.toLocaleString("en-US")} bytes of values as JSON; more is \`400 validation_error\`, field \`values\`, rule \`record_too_large\`, and so is a request body of more than 2 MiB.`
|
|
6906
6943
|
}),
|
|
6907
|
-
robot_id:
|
|
6908
|
-
expected_revision:
|
|
6944
|
+
robot_id: z30.uuid().meta({ description: "The robot of a new record in a collection that belongs to robots. Fixed once the record exists." }).optional(),
|
|
6945
|
+
expected_revision: z30.number().int().min(1).meta({ description: "The revision you last read. The write is refused with `record_changed` if the record has moved on." }).optional()
|
|
6909
6946
|
}).strict().meta({ description: "The body of a record create or update." });
|
|
6910
|
-
var collectionRevision =
|
|
6911
|
-
seq:
|
|
6912
|
-
op:
|
|
6947
|
+
var collectionRevision = z30.object({
|
|
6948
|
+
seq: z30.number().int().positive().meta({ description: "The position of this revision in the history. Use it to page (`before_seq`) and to restore (`seq`)." }),
|
|
6949
|
+
op: z30.enum(["create", "update", "delete", "restore"]),
|
|
6913
6950
|
at: timestamp,
|
|
6914
6951
|
actor: collectionActor,
|
|
6915
|
-
reason:
|
|
6916
|
-
revision:
|
|
6917
|
-
changes:
|
|
6952
|
+
reason: z30.string().nullable().meta({ description: "Why a change was made when it was not an ordinary write: `schema v5`, `import`, `restore v4`. Null otherwise." }),
|
|
6953
|
+
revision: z30.number().int().min(1).meta({ description: "The record's revision number after this change." }),
|
|
6954
|
+
changes: z30.record(z30.string(), z30.object({ old: z30.unknown(), new: z30.unknown() })).meta({
|
|
6918
6955
|
description: "The fields this change touched by key, each with its value before and after. `null` means no value."
|
|
6919
6956
|
}),
|
|
6920
6957
|
record: collectionRecord.nullable().meta({ description: "The whole record, on a `delete` revision. Null on every other operation." })
|
|
6921
6958
|
}).meta({ description: "One change in the history of a record." });
|
|
6922
|
-
var collectionRecordHistoryQuery =
|
|
6959
|
+
var collectionRecordHistoryQuery = z30.object({
|
|
6923
6960
|
limit: pageLimit.meta({ description: `The most revisions to return, 1 to ${COLLECTION_LIMITS.pageMax}. A page can hold fewer: see \`next_before_seq\`.` }).optional(),
|
|
6924
6961
|
before_seq: wireSeqCursor.meta({ description: "Only revisions older than this `seq`: the next page, since the history is read newest first." }).optional()
|
|
6925
6962
|
}).strict();
|
|
6926
|
-
var collectionRecordHistoryResponse =
|
|
6927
|
-
revisions:
|
|
6963
|
+
var collectionRecordHistoryResponse = z30.object({
|
|
6964
|
+
revisions: z30.array(collectionRevision).meta({
|
|
6928
6965
|
description: "The revisions of the page, newest first. A page is cut short at 4 MiB of stored revisions, since the changes of a revision keep the old and the new value and a `delete` the whole record. It always holds at least one revision, and a history of ordinary size is never cut."
|
|
6929
6966
|
}),
|
|
6930
|
-
next_before_seq:
|
|
6967
|
+
next_before_seq: z30.number().int().positive().nullable().meta({
|
|
6931
6968
|
description: "Send it as `before_seq` to read older revisions; it names the last revision this page holds, also when the page was cut short. Null when there are none."
|
|
6932
6969
|
}),
|
|
6933
|
-
purged:
|
|
6970
|
+
purged: z30.object({
|
|
6934
6971
|
before: timestamp.meta({ description: "Revisions older than this were removed." }),
|
|
6935
6972
|
by: collectionActor,
|
|
6936
6973
|
at: timestamp.meta({ description: "When they were removed." })
|
|
6937
6974
|
}).nullable().meta({ description: "Set when an organization owner removed the older part of this history: the history then starts with that note." })
|
|
6938
6975
|
}).meta({ description: "A page of a record's history, newest first." });
|
|
6939
|
-
var collectionRecordRestoreRequest =
|
|
6940
|
-
seq:
|
|
6976
|
+
var collectionRecordRestoreRequest = z30.object({
|
|
6977
|
+
seq: z30.number().int().positive().meta({ description: "Put the record back to its state after this revision. Leave it out to restore a deleted record." }).optional()
|
|
6941
6978
|
}).strict().meta({ description: "The body of a record restore." });
|
|
6942
|
-
var collectionSummary =
|
|
6979
|
+
var collectionSummary = z30.object({
|
|
6943
6980
|
key: collectionKey,
|
|
6944
|
-
label:
|
|
6981
|
+
label: z30.string(),
|
|
6945
6982
|
binding: collectionBinding,
|
|
6946
6983
|
records: count3.meta({ description: "Records the collection holds now." }),
|
|
6947
6984
|
fields: count3,
|
|
6948
|
-
read_roles:
|
|
6949
|
-
warnings:
|
|
6985
|
+
read_roles: z30.array(z30.string()).meta({ description: "The roles that may read the records." }),
|
|
6986
|
+
warnings: z30.array(z30.enum(["no_role_access", "history_growing", "unknown_role"])).meta({
|
|
6950
6987
|
description: "`no_role_access`: no role may read these records. `unknown_role`: `access` names a role the organization does not have. `history_growing`: the history is far larger than the records, which often means a client writing in a loop."
|
|
6951
6988
|
}),
|
|
6952
6989
|
revisions: count3.meta({ description: "Entries in the history of all the collection's records." }),
|
|
6953
6990
|
history_bytes: count3.meta({ description: "The size of that history in bytes." }),
|
|
6954
6991
|
updated_at: timestamp.nullable().meta({ description: "When a record of the collection last changed. Null if it never held one." })
|
|
6955
6992
|
}).meta({ description: "A collection as the developer's overview shows it." });
|
|
6956
|
-
var collectionListResponse =
|
|
6993
|
+
var collectionListResponse = z30.object({
|
|
6957
6994
|
version: schemaVersion.nullable().meta({ description: "The published schema version. Null before anything was published." }),
|
|
6958
|
-
collections:
|
|
6995
|
+
collections: z30.array(collectionSummary)
|
|
6959
6996
|
}).meta({ description: "The collections of an app." });
|
|
6960
|
-
var collectionCan =
|
|
6961
|
-
read:
|
|
6962
|
-
create:
|
|
6963
|
-
update:
|
|
6964
|
-
delete:
|
|
6997
|
+
var collectionCan = z30.object({
|
|
6998
|
+
read: z30.boolean(),
|
|
6999
|
+
create: z30.boolean(),
|
|
7000
|
+
update: z30.union([z30.enum(["all", "own"]), z30.literal(false)]).meta({ description: "`all`: any record. `own`: only records the caller created. `false`: none." }),
|
|
7001
|
+
delete: z30.union([z30.enum(["all", "own"]), z30.literal(false)]).meta({ description: "`all`: any record. `own`: only records the caller created. `false`: none." })
|
|
6965
7002
|
}).meta({ description: "What the caller may do with the records of this collection." });
|
|
6966
|
-
var collectionDefinitionsResponse =
|
|
7003
|
+
var collectionDefinitionsResponse = z30.object({
|
|
6967
7004
|
version: schemaVersion.nullable().meta({ description: "The published schema version. Null before anything was published." }),
|
|
6968
|
-
collections:
|
|
7005
|
+
collections: z30.array(z30.object({
|
|
6969
7006
|
key: collectionKey,
|
|
6970
|
-
label:
|
|
6971
|
-
description:
|
|
7007
|
+
label: z30.string(),
|
|
7008
|
+
description: z30.string(),
|
|
6972
7009
|
binding: collectionBinding,
|
|
6973
|
-
display:
|
|
6974
|
-
fields:
|
|
7010
|
+
display: z30.string().meta({ description: "The template that names a record of this collection." }),
|
|
7011
|
+
fields: z30.record(collectionKey, collectionField),
|
|
6975
7012
|
can: collectionCan
|
|
6976
7013
|
}))
|
|
6977
7014
|
}).meta({ description: "The collections the caller may read, with their field definitions and the caller's rights." });
|
|
6978
7015
|
|
|
6979
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6980
|
-
var clientAuth =
|
|
6981
|
-
type:
|
|
6982
|
-
token:
|
|
7016
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/realtime.js
|
|
7017
|
+
var clientAuth = z31.object({
|
|
7018
|
+
type: z31.literal("auth"),
|
|
7019
|
+
token: z31.string().min(1)
|
|
6983
7020
|
});
|
|
6984
|
-
var authOk =
|
|
6985
|
-
type:
|
|
7021
|
+
var authOk = z31.object({
|
|
7022
|
+
type: z31.literal("auth_ok"),
|
|
6986
7023
|
identity: clientIdentity
|
|
6987
7024
|
});
|
|
6988
|
-
var authError =
|
|
6989
|
-
type:
|
|
6990
|
-
code:
|
|
6991
|
-
message:
|
|
7025
|
+
var authError = z31.object({
|
|
7026
|
+
type: z31.literal("auth_error"),
|
|
7027
|
+
code: z31.string().min(1),
|
|
7028
|
+
message: z31.string().min(1)
|
|
6992
7029
|
});
|
|
6993
|
-
var clientInvoke =
|
|
6994
|
-
type:
|
|
6995
|
-
request_id:
|
|
6996
|
-
robot_id:
|
|
7030
|
+
var clientInvoke = z31.object({
|
|
7031
|
+
type: z31.literal("invoke"),
|
|
7032
|
+
request_id: z31.string().min(1).max(64),
|
|
7033
|
+
robot_id: z31.uuid(),
|
|
6997
7034
|
slug,
|
|
6998
7035
|
/** Parameters by field path, validated against the configuration's rules. */
|
|
6999
|
-
params:
|
|
7036
|
+
params: z31.record(z31.string(), z31.unknown()),
|
|
7000
7037
|
/**
|
|
7001
7038
|
* How long this one call is worth waiting for — the same field, meaning and
|
|
7002
7039
|
* cap as `invokeRequest.patience_ms`; absent means `DEFAULT_PATIENCE_MS`.
|
|
@@ -7006,12 +7043,12 @@ var clientInvoke = z30.object({
|
|
|
7006
7043
|
* unreachable to every caller that invokes over the realtime channel, while
|
|
7007
7044
|
* still appearing in the documentation.
|
|
7008
7045
|
*/
|
|
7009
|
-
patience_ms:
|
|
7046
|
+
patience_ms: z31.number().int().min(MIN_PATIENCE_MS).max(MAX_PATIENCE_MS).optional()
|
|
7010
7047
|
});
|
|
7011
|
-
var clientCancel =
|
|
7012
|
-
type:
|
|
7013
|
-
request_id:
|
|
7014
|
-
robot_id:
|
|
7048
|
+
var clientCancel = z31.object({
|
|
7049
|
+
type: z31.literal("cancel"),
|
|
7050
|
+
request_id: z31.string().min(1).max(64),
|
|
7051
|
+
robot_id: z31.uuid(),
|
|
7015
7052
|
/** Which slug — required, and the coarse address of a cancel. */
|
|
7016
7053
|
slug,
|
|
7017
7054
|
/**
|
|
@@ -7029,19 +7066,19 @@ var clientCancel = z30.object({
|
|
|
7029
7066
|
* back to the slug. Falling back would be the platform deciding that the
|
|
7030
7067
|
* caller did not really mean the id they typed.
|
|
7031
7068
|
*/
|
|
7032
|
-
job_id:
|
|
7069
|
+
job_id: z31.uuid().nullable()
|
|
7033
7070
|
});
|
|
7034
|
-
var clientPublish =
|
|
7035
|
-
type:
|
|
7036
|
-
request_id:
|
|
7037
|
-
robot_id:
|
|
7071
|
+
var clientPublish = z31.object({
|
|
7072
|
+
type: z31.literal("publish"),
|
|
7073
|
+
request_id: z31.string().min(1).max(64),
|
|
7074
|
+
robot_id: z31.uuid(),
|
|
7038
7075
|
slug,
|
|
7039
|
-
message:
|
|
7076
|
+
message: z31.record(z31.string(), z31.unknown())
|
|
7040
7077
|
});
|
|
7041
|
-
var commandResult =
|
|
7042
|
-
type:
|
|
7043
|
-
request_id:
|
|
7044
|
-
ok:
|
|
7078
|
+
var commandResult = z31.object({
|
|
7079
|
+
type: z31.literal("command_result"),
|
|
7080
|
+
request_id: z31.string().min(1).max(64),
|
|
7081
|
+
ok: z31.boolean(),
|
|
7045
7082
|
/**
|
|
7046
7083
|
* The job this reply is *about* — which is not always the caller's own.
|
|
7047
7084
|
*
|
|
@@ -7065,9 +7102,9 @@ var commandResult = z30.object({
|
|
|
7065
7102
|
* later. Returning the kind lets a client refuse its own mistake at once,
|
|
7066
7103
|
* instead of reporting it as the machine's.
|
|
7067
7104
|
*/
|
|
7068
|
-
kind:
|
|
7069
|
-
code:
|
|
7070
|
-
message:
|
|
7105
|
+
kind: z31.enum(["datapoint", "action", "service", "publisher", "camera"]).nullable(),
|
|
7106
|
+
code: z31.string().nullable(),
|
|
7107
|
+
message: z31.string().nullable(),
|
|
7071
7108
|
/**
|
|
7072
7109
|
* The same payload the REST envelope carries in `apiError.details` — for
|
|
7073
7110
|
* `parameter_invalid`, a `parameterInvalidDetails`.
|
|
@@ -7078,16 +7115,16 @@ var commandResult = z30.object({
|
|
|
7078
7115
|
* socket. A client cannot bind an error to the input that caused it from a
|
|
7079
7116
|
* code alone, which is the entire point of the flat parameter shape.
|
|
7080
7117
|
*/
|
|
7081
|
-
details:
|
|
7118
|
+
details: z31.unknown().optional()
|
|
7082
7119
|
});
|
|
7083
|
-
var errorFrame =
|
|
7084
|
-
type:
|
|
7085
|
-
code:
|
|
7086
|
-
message:
|
|
7120
|
+
var errorFrame = z31.object({
|
|
7121
|
+
type: z31.literal("error"),
|
|
7122
|
+
code: z31.string().min(1),
|
|
7123
|
+
message: z31.string().min(1)
|
|
7087
7124
|
});
|
|
7088
|
-
var clientSubscribe =
|
|
7089
|
-
type:
|
|
7090
|
-
robot_id:
|
|
7125
|
+
var clientSubscribe = z31.object({
|
|
7126
|
+
type: z31.literal("subscribe"),
|
|
7127
|
+
robot_id: z31.uuid(),
|
|
7091
7128
|
slug,
|
|
7092
7129
|
/**
|
|
7093
7130
|
* What the subscriber expects, and how it wants it.
|
|
@@ -7107,35 +7144,45 @@ var clientSubscribe = z30.object({
|
|
|
7107
7144
|
* request was the same mistake as the silent wrong-verb subscribe this
|
|
7108
7145
|
* field was added to fix.
|
|
7109
7146
|
*/
|
|
7110
|
-
kind:
|
|
7111
|
-
options:
|
|
7147
|
+
kind: z31.enum(["datapoint", "action", "service", "publisher", "camera"]).optional(),
|
|
7148
|
+
options: z31.record(z31.string(), z31.unknown()).optional()
|
|
7112
7149
|
});
|
|
7113
|
-
var clientUnsubscribe =
|
|
7114
|
-
type:
|
|
7115
|
-
robot_id:
|
|
7150
|
+
var clientUnsubscribe = z31.object({
|
|
7151
|
+
type: z31.literal("unsubscribe"),
|
|
7152
|
+
robot_id: z31.uuid(),
|
|
7116
7153
|
slug
|
|
7117
7154
|
});
|
|
7118
|
-
var subscribeError =
|
|
7119
|
-
type:
|
|
7120
|
-
robot_id:
|
|
7121
|
-
slug:
|
|
7122
|
-
code:
|
|
7123
|
-
message:
|
|
7155
|
+
var subscribeError = z31.object({
|
|
7156
|
+
type: z31.literal("subscribe_error"),
|
|
7157
|
+
robot_id: z31.string(),
|
|
7158
|
+
slug: z31.string(),
|
|
7159
|
+
code: z31.string().min(1),
|
|
7160
|
+
message: z31.string().min(1)
|
|
7124
7161
|
});
|
|
7125
|
-
var datapointEvent =
|
|
7126
|
-
type:
|
|
7127
|
-
robot_id:
|
|
7162
|
+
var datapointEvent = z31.object({
|
|
7163
|
+
type: z31.literal("datapoint"),
|
|
7164
|
+
robot_id: z31.uuid(),
|
|
7128
7165
|
slug,
|
|
7129
|
-
value:
|
|
7130
|
-
timestamp_ms:
|
|
7166
|
+
value: z31.unknown(),
|
|
7167
|
+
timestamp_ms: z31.number().int().nonnegative()
|
|
7131
7168
|
});
|
|
7132
|
-
var liveSessionEndReason =
|
|
7169
|
+
var liveSessionEndReason = z31.enum([
|
|
7133
7170
|
/** Another holder of this camera released it — another tab, or another client. */
|
|
7134
7171
|
"released_by_peer",
|
|
7135
7172
|
/** The robot's configuration was published and this camera changed with it. */
|
|
7136
7173
|
"config_changed",
|
|
7137
|
-
/**
|
|
7174
|
+
/**
|
|
7175
|
+
* The robot said publishing died after it had started. `detail` is `null`:
|
|
7176
|
+
* the robot's own words never travel here (see `detail`).
|
|
7177
|
+
*/
|
|
7138
7178
|
"publish_failed",
|
|
7179
|
+
/**
|
|
7180
|
+
* The robot refused to start this camera's live video: the first start,
|
|
7181
|
+
* or the restart after a bridge reconnect (fleetless/fleetless#1126).
|
|
7182
|
+
* Distinct from `publish_failed`, which means a running stream stopped. `detail` is the
|
|
7183
|
+
* cloud's fixed sentence for the refusal and `refusal` names its class.
|
|
7184
|
+
*/
|
|
7185
|
+
"start_refused",
|
|
7139
7186
|
/** The bridge stopped answering. */
|
|
7140
7187
|
"robot_offline",
|
|
7141
7188
|
/** The grant this session was minted under was withdrawn. */
|
|
@@ -7158,12 +7205,12 @@ var liveSessionEndReason = z30.enum([
|
|
|
7158
7205
|
*/
|
|
7159
7206
|
"unknown"
|
|
7160
7207
|
]);
|
|
7161
|
-
var liveSessionEvent =
|
|
7162
|
-
type:
|
|
7163
|
-
robot_id:
|
|
7208
|
+
var liveSessionEvent = z31.object({
|
|
7209
|
+
type: z31.literal("live_session"),
|
|
7210
|
+
robot_id: z31.uuid(),
|
|
7164
7211
|
slug,
|
|
7165
|
-
session_id:
|
|
7166
|
-
state:
|
|
7212
|
+
session_id: z31.uuid(),
|
|
7213
|
+
state: z31.literal("ended"),
|
|
7167
7214
|
reason: liveSessionEndReason,
|
|
7168
7215
|
/**
|
|
7169
7216
|
* **Classified text the cloud produced, never text the robot sent.**
|
|
@@ -7178,47 +7225,53 @@ var liveSessionEvent = z30.object({
|
|
|
7178
7225
|
* code with fixed text, the way camera health already does it — not as
|
|
7179
7226
|
* forwarded foreign text on a channel a client reads.
|
|
7180
7227
|
*/
|
|
7181
|
-
detail:
|
|
7228
|
+
detail: z31.string().max(200).nullable(),
|
|
7229
|
+
/**
|
|
7230
|
+
* Why the robot refused the start, as a class: set with `reason:
|
|
7231
|
+
* 'start_refused'` (fleetless/fleetless#1126), absent or `null` for every
|
|
7232
|
+
* other reason. `detail` carries the matching sentence.
|
|
7233
|
+
*/
|
|
7234
|
+
refusal: liveStartRefusal.nullable().optional(),
|
|
7182
7235
|
/** When it ended — not when this frame was sent. Same reasoning as `changed_at_ms`. */
|
|
7183
|
-
ended_at_ms:
|
|
7184
|
-
});
|
|
7185
|
-
var resourceHealthCleared =
|
|
7186
|
-
type:
|
|
7187
|
-
robot_id:
|
|
7188
|
-
kind:
|
|
7189
|
-
ref:
|
|
7190
|
-
facet:
|
|
7191
|
-
cleared_at_ms:
|
|
7192
|
-
});
|
|
7193
|
-
var resourceHealthEvent =
|
|
7194
|
-
type:
|
|
7195
|
-
robot_id:
|
|
7196
|
-
kind:
|
|
7197
|
-
ref:
|
|
7236
|
+
ended_at_ms: z31.number().int().nonnegative()
|
|
7237
|
+
});
|
|
7238
|
+
var resourceHealthCleared = z31.object({
|
|
7239
|
+
type: z31.literal("resource_health_cleared"),
|
|
7240
|
+
robot_id: z31.uuid(),
|
|
7241
|
+
kind: z31.enum(RESOURCE_HEALTH_KINDS),
|
|
7242
|
+
ref: z31.string().min(1).max(64),
|
|
7243
|
+
facet: z31.enum(["source", "publish"]),
|
|
7244
|
+
cleared_at_ms: z31.number().int().nonnegative()
|
|
7245
|
+
});
|
|
7246
|
+
var resourceHealthEvent = z31.object({
|
|
7247
|
+
type: z31.literal("resource_health"),
|
|
7248
|
+
robot_id: z31.uuid(),
|
|
7249
|
+
kind: z31.enum(RESOURCE_HEALTH_KINDS),
|
|
7250
|
+
ref: z31.string().min(1).max(64),
|
|
7198
7251
|
/** Which of the two questions this entry answers — see `resourceHealthState.facet`. */
|
|
7199
|
-
facet:
|
|
7200
|
-
state:
|
|
7201
|
-
reason:
|
|
7202
|
-
changed_at_ms:
|
|
7252
|
+
facet: z31.enum(["source", "publish"]),
|
|
7253
|
+
state: z31.enum(RESOURCE_HEALTH_STATES),
|
|
7254
|
+
reason: z31.string().max(200).nullable(),
|
|
7255
|
+
changed_at_ms: z31.number().int().nonnegative()
|
|
7203
7256
|
});
|
|
7204
7257
|
var ORG_EVENT_BUFFER_SIZE = 200;
|
|
7205
|
-
var orgEventKind =
|
|
7206
|
-
var orgEventSeverity =
|
|
7207
|
-
var orgEvent =
|
|
7208
|
-
type:
|
|
7258
|
+
var orgEventKind = z31.enum(["datapoint", "health", "job", "bridge", "audit", "alert"]);
|
|
7259
|
+
var orgEventSeverity = z31.enum(["info", "warning", "error"]);
|
|
7260
|
+
var orgEvent = z31.object({
|
|
7261
|
+
type: z31.literal("org_event"),
|
|
7209
7262
|
/**
|
|
7210
7263
|
* **Per org, per process.** Like `job.seq` and unlike `job_runs.seq`, which
|
|
7211
7264
|
* is a postgres `bigserial` and durable. All three say which they are,
|
|
7212
7265
|
* because anyone who confuses them will confuse them in both directions.
|
|
7213
7266
|
*/
|
|
7214
|
-
seq:
|
|
7215
|
-
at:
|
|
7267
|
+
seq: z31.number().int().positive(),
|
|
7268
|
+
at: z31.iso.datetime(),
|
|
7216
7269
|
kind: orgEventKind,
|
|
7217
7270
|
severity: orgEventSeverity,
|
|
7218
7271
|
/** `null` for an org-level event — an invitation, a quota change — which belongs to no robot. */
|
|
7219
|
-
robot_id:
|
|
7272
|
+
robot_id: z31.uuid().nullable(),
|
|
7220
7273
|
/** What the line is about: a slug, a camera, an actor's email. */
|
|
7221
|
-
subject:
|
|
7274
|
+
subject: z31.string().min(1).max(200),
|
|
7222
7275
|
/**
|
|
7223
7276
|
* Kind-specific, and **capped at `ORG_EVENT_DETAIL_MAX_BYTES`** — above it
|
|
7224
7277
|
* the producer substitutes `{ omitted: 'too_large', bytes }`. Truncated,
|
|
@@ -7227,13 +7280,13 @@ var orgEvent = z30.object({
|
|
|
7227
7280
|
* Never a pre-formatted line: the reader decides language, number format
|
|
7228
7281
|
* and truncation, so changing how a line reads is not a cloud deploy.
|
|
7229
7282
|
*/
|
|
7230
|
-
detail:
|
|
7283
|
+
detail: z31.unknown().nullable()
|
|
7231
7284
|
}).strict();
|
|
7232
|
-
var orgEventSubscribe =
|
|
7233
|
-
var orgEventUnsubscribe =
|
|
7234
|
-
var orgEventReplay =
|
|
7235
|
-
type:
|
|
7236
|
-
events:
|
|
7285
|
+
var orgEventSubscribe = z31.object({ type: z31.literal("org_event_subscribe") }).strict();
|
|
7286
|
+
var orgEventUnsubscribe = z31.object({ type: z31.literal("org_event_unsubscribe") }).strict();
|
|
7287
|
+
var orgEventReplay = z31.object({
|
|
7288
|
+
type: z31.literal("org_event_replay"),
|
|
7289
|
+
events: z31.array(orgEvent).max(ORG_EVENT_BUFFER_SIZE),
|
|
7237
7290
|
/**
|
|
7238
7291
|
* **`false` means three different things, on purpose**: the buffer was
|
|
7239
7292
|
* already full, the cloud restarted, or this org's buffer had expired. All
|
|
@@ -7241,10 +7294,10 @@ var orgEventReplay = z30.object({
|
|
|
7241
7294
|
* line* — and a field separating them would claim a distinction nobody
|
|
7242
7295
|
* would act on differently.
|
|
7243
7296
|
*/
|
|
7244
|
-
complete:
|
|
7297
|
+
complete: z31.boolean()
|
|
7245
7298
|
}).strict();
|
|
7246
|
-
var orgEventDropped =
|
|
7247
|
-
type:
|
|
7299
|
+
var orgEventDropped = z31.object({
|
|
7300
|
+
type: z31.literal("org_event_dropped"),
|
|
7248
7301
|
/**
|
|
7249
7302
|
* **An epoch instant in milliseconds (`Date.now()`), not a duration.**
|
|
7250
7303
|
* The moment this socket last reported a drop — or the moment it
|
|
@@ -7255,75 +7308,75 @@ var orgEventDropped = z30.object({
|
|
|
7255
7308
|
* it as "milliseconds ago" renders a drop that happened seconds ago as
|
|
7256
7309
|
* having happened in 1970.
|
|
7257
7310
|
*/
|
|
7258
|
-
since_ms:
|
|
7311
|
+
since_ms: z31.number().int().nonnegative(),
|
|
7259
7312
|
/** Always at least one — a frame reporting nothing lost is noise on a channel built to be quiet. */
|
|
7260
|
-
dropped:
|
|
7313
|
+
dropped: z31.number().int().positive()
|
|
7261
7314
|
}).strict();
|
|
7262
|
-
var collectionRequestId =
|
|
7315
|
+
var collectionRequestId = z31.string().min(1).max(64).meta({
|
|
7263
7316
|
description: "Chosen by the client, unique among the collection subscriptions open on this socket: a `request_id` that is already in use is refused with `validation_error`. Every frame about the subscription carries it."
|
|
7264
7317
|
});
|
|
7265
|
-
var collectionSubscribe =
|
|
7266
|
-
type:
|
|
7318
|
+
var collectionSubscribe = z31.object({
|
|
7319
|
+
type: z31.literal("collection_subscribe"),
|
|
7267
7320
|
request_id: collectionRequestId,
|
|
7268
|
-
app_id:
|
|
7321
|
+
app_id: z31.uuid().meta({
|
|
7269
7322
|
description: "The app whose collection to follow. Required on the connection of a developer, whose token belongs to the organization and so to no app: without it the subscribe is refused with `validation_error`. On the connection of an app user or a server key it can be left out, because the token names the app; if it is sent, it must be that app, otherwise `validation_error`. An app that does not exist or belongs to another organization is answered `collection_not_found`."
|
|
7270
7323
|
}).optional(),
|
|
7271
7324
|
collection: collectionKey.meta({ description: "The key of the collection." }),
|
|
7272
|
-
robot_id:
|
|
7325
|
+
robot_id: z31.uuid().meta({ description: "Only the records of this robot, in a collection that belongs to robots." }).optional(),
|
|
7273
7326
|
filter: collectionFilter.meta({
|
|
7274
7327
|
description: "Only records matching this filter are delivered, with the grammar of the `filter` of the record list but as an object, not JSON text. The whole frame is at most 16,384 bytes; a larger frame closes the socket with code 1009 (message too big) instead of being answered, so a filter with many long values may not fit."
|
|
7275
7328
|
}).optional()
|
|
7276
7329
|
}).strict().meta({
|
|
7277
7330
|
description: "Subscribes to the changes of the records of one collection. The cloud answers an accepted subscription with `collection_subscribed` and a refused one with `collection_subscribe_error`."
|
|
7278
7331
|
});
|
|
7279
|
-
var collectionSubscribed =
|
|
7280
|
-
type:
|
|
7332
|
+
var collectionSubscribed = z31.object({
|
|
7333
|
+
type: z31.literal("collection_subscribed"),
|
|
7281
7334
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription that is now registered." })
|
|
7282
7335
|
}).strict().meta({ description: "A collection subscription is registered: every change it covers is delivered from now on." });
|
|
7283
|
-
var collectionUnsubscribe =
|
|
7284
|
-
type:
|
|
7336
|
+
var collectionUnsubscribe = z31.object({
|
|
7337
|
+
type: z31.literal("collection_unsubscribe"),
|
|
7285
7338
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription to end." })
|
|
7286
7339
|
}).strict().meta({ description: "Ends a collection subscription." });
|
|
7287
|
-
var collectionEvent =
|
|
7288
|
-
type:
|
|
7340
|
+
var collectionEvent = z31.object({
|
|
7341
|
+
type: z31.literal("collection_event"),
|
|
7289
7342
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription the event belongs to." }),
|
|
7290
|
-
event:
|
|
7343
|
+
event: z31.enum(["created", "updated", "deleted", "removed", "entered"]).meta({
|
|
7291
7344
|
description: "`created`, `updated` and `deleted`: the record was written. `removed`: the record left the view of this subscription without being deleted, because its values no longer match the filter, the role lost the right to read it or its robot was detached. `entered`: the record came into view the same way."
|
|
7292
7345
|
}),
|
|
7293
|
-
id:
|
|
7346
|
+
id: z31.uuid().meta({ description: "The id of the record." }),
|
|
7294
7347
|
record: collectionRecord.meta({
|
|
7295
7348
|
description: "The record: as it is now for `created`, `updated`, `entered` and `removed`, and as it was for `deleted`. Absent only on a `removed` event for a record the subscriber may no longer read, so that its values are not told: that is the case when the robot of the record was detached, or when the role lost the right to read the collection."
|
|
7296
7349
|
}).optional()
|
|
7297
7350
|
}).strict().meta({ description: "A record came into view, changed or went away." });
|
|
7298
|
-
var collectionSubscribeError =
|
|
7299
|
-
type:
|
|
7300
|
-
request_id:
|
|
7301
|
-
code:
|
|
7302
|
-
message:
|
|
7351
|
+
var collectionSubscribeError = z31.object({
|
|
7352
|
+
type: z31.literal("collection_subscribe_error"),
|
|
7353
|
+
request_id: z31.string().meta({ description: "The `request_id` of the subscription, as the client sent it." }),
|
|
7354
|
+
code: z31.string().min(1).meta({ description: "A stable error code, as in REST; `unauthorized` is also possible here, for a subscribe sent before `auth`." }),
|
|
7355
|
+
message: z31.string().min(1)
|
|
7303
7356
|
}).strict().meta({ description: "A collection subscription was refused or has ended." });
|
|
7304
|
-
var collectionsSchemaPublished =
|
|
7305
|
-
type:
|
|
7306
|
-
version:
|
|
7357
|
+
var collectionsSchemaPublished = z31.object({
|
|
7358
|
+
type: z31.literal("collections_schema_published"),
|
|
7359
|
+
version: z31.number().int().min(1).meta({ description: "The version that is in force now." })
|
|
7307
7360
|
}).strict().meta({ description: "A new schema version is in force for the app." });
|
|
7308
7361
|
|
|
7309
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7310
|
-
import { z as
|
|
7362
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/feedback.js
|
|
7363
|
+
import { z as z32 } from "zod";
|
|
7311
7364
|
var FEEDBACK_KINDS = ["idea", "problem", "question", "other"];
|
|
7312
|
-
var feedbackKind =
|
|
7365
|
+
var feedbackKind = z32.enum(FEEDBACK_KINDS);
|
|
7313
7366
|
var FEEDBACK_MESSAGE_MAX = 5e3;
|
|
7314
|
-
var feedbackRequest =
|
|
7367
|
+
var feedbackRequest = z32.object({
|
|
7315
7368
|
kind: feedbackKind.meta({
|
|
7316
7369
|
description: "What the message is: an `idea`, a `problem`, a `question` or `other`. It only sorts the inbox; it changes nothing about how the message is handled."
|
|
7317
7370
|
}),
|
|
7318
|
-
message:
|
|
7371
|
+
message: z32.string().trim().min(1).max(FEEDBACK_MESSAGE_MAX).meta({
|
|
7319
7372
|
description: "What the developer wrote, trimmed. At most 5000 characters; a message that is only whitespace is refused."
|
|
7320
7373
|
}),
|
|
7321
|
-
page:
|
|
7374
|
+
page: z32.string().startsWith("/").max(512).meta({
|
|
7322
7375
|
description: "The console path the message was sent from, e.g. `/robots/:id/jobs` with its real id. A path, never a full URL, so no host and no query string reach the inbox by accident."
|
|
7323
7376
|
})
|
|
7324
7377
|
}).strict();
|
|
7325
|
-
var feedbackResponse =
|
|
7326
|
-
id:
|
|
7378
|
+
var feedbackResponse = z32.object({
|
|
7379
|
+
id: z32.uuid().meta({
|
|
7327
7380
|
description: "The stored message. It exists whatever `mail` says."
|
|
7328
7381
|
}),
|
|
7329
7382
|
mail: mailStatus.meta({
|
|
@@ -7331,91 +7384,91 @@ var feedbackResponse = z31.object({
|
|
|
7331
7384
|
})
|
|
7332
7385
|
}).strict();
|
|
7333
7386
|
|
|
7334
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7335
|
-
import { z as
|
|
7336
|
-
var supportSessionInfo =
|
|
7337
|
-
session_id:
|
|
7387
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/support.js
|
|
7388
|
+
import { z as z33 } from "zod";
|
|
7389
|
+
var supportSessionInfo = z33.object({
|
|
7390
|
+
session_id: z33.uuid().meta({
|
|
7338
7391
|
description: "The support session this token or response describes. Stable for the life of the session."
|
|
7339
7392
|
}),
|
|
7340
|
-
mode:
|
|
7393
|
+
mode: z33.enum(["read", "edit"]).meta({
|
|
7341
7394
|
description: "The session's current mode. Every support session starts `read`; an operator-admin switches one session into `edit`, never the other way, and the switch is a one-way door for the life of the session."
|
|
7342
7395
|
}),
|
|
7343
|
-
operator_name:
|
|
7396
|
+
operator_name: z33.string().min(1).max(200).meta({
|
|
7344
7397
|
description: "The name of the operator-admin holding this session, for the console banner the operator-admin sees. Only the operator-admin's own console receives it; the customer's audit names every edit as Fleetless-Support, never this name."
|
|
7345
7398
|
}),
|
|
7346
|
-
expires_at:
|
|
7399
|
+
expires_at: z33.iso.datetime().meta({
|
|
7347
7400
|
description: "When the session stops being usable regardless of activity, as an ISO 8601 timestamp. A support session has a hard ceiling; nothing extends it past this instant."
|
|
7348
7401
|
})
|
|
7349
7402
|
}).strict();
|
|
7350
|
-
var supportTokenRequest =
|
|
7351
|
-
grant:
|
|
7403
|
+
var supportTokenRequest = z33.object({
|
|
7404
|
+
grant: z33.string().regex(/^[A-Za-z0-9_-]{43}$/).meta({
|
|
7352
7405
|
description: "The one-time grant minted when the support session was started: 32 random bytes, base64url, no padding. Consumed atomically by this exchange \u2014 presenting it again answers the same refusal a forged one would."
|
|
7353
7406
|
}),
|
|
7354
|
-
code_verifier:
|
|
7407
|
+
code_verifier: z33.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
7355
7408
|
description: "The PKCE verifier whose `S256` hash was sent as the grant's challenge when the session was started. Between 43 and 128 unreserved characters, RFC 7636 \xA74.1's charset \u2014 the same shape `oauthCodeTokenRequest.code_verifier` checks, compared rather than parsed."
|
|
7356
7409
|
})
|
|
7357
7410
|
}).strict();
|
|
7358
|
-
var supportTokenResponse =
|
|
7359
|
-
access_token:
|
|
7411
|
+
var supportTokenResponse = z33.object({
|
|
7412
|
+
access_token: z33.string().min(1).meta({
|
|
7360
7413
|
description: "The token to send as `Authorization: Bearer <token>`. Short-lived: read `expires_in`, never assume a lifetime."
|
|
7361
7414
|
}),
|
|
7362
|
-
token_type:
|
|
7415
|
+
token_type: z33.literal("Bearer").meta({
|
|
7363
7416
|
description: "`Bearer`, the same spelling every other session token on this wire uses."
|
|
7364
7417
|
}),
|
|
7365
|
-
expires_in:
|
|
7418
|
+
expires_in: z33.number().int().min(1).max(3600).meta({
|
|
7366
7419
|
description: "How long the access token stays valid, in seconds from now \u2014 at most 3600 (sixty minutes), the hard ceiling of any support session. Not a timestamp, and not milliseconds."
|
|
7367
7420
|
}),
|
|
7368
|
-
org_id:
|
|
7421
|
+
org_id: z33.uuid().meta({
|
|
7369
7422
|
description: "The organisation this session was scoped to when the grant was minted."
|
|
7370
7423
|
}),
|
|
7371
7424
|
support: supportSessionInfo.meta({
|
|
7372
7425
|
description: "The session as it stands at the moment of exchange: freshly started, in `read` mode."
|
|
7373
7426
|
})
|
|
7374
7427
|
}).strict();
|
|
7375
|
-
var supportRenewFailRequest =
|
|
7376
|
-
flow_id:
|
|
7377
|
-
code_verifier:
|
|
7428
|
+
var supportRenewFailRequest = z33.object({
|
|
7429
|
+
flow_id: z33.uuid().meta({ description: "The pending Cloud renewal flow created with the original support bearer." }),
|
|
7430
|
+
code_verifier: z33.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
7378
7431
|
description: "The server-held RFC 7636 verifier matching the flow's S256 challenge; never sent to the browser."
|
|
7379
7432
|
}),
|
|
7380
|
-
reason:
|
|
7433
|
+
reason: z33.literal("authority_failed").meta({ description: "A fixed category; browser and IdP error text is not forwarded." })
|
|
7381
7434
|
}).strict();
|
|
7382
|
-
var supportRenewFailRefusal =
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7435
|
+
var supportRenewFailRefusal = z33.union([
|
|
7436
|
+
z33.object({ code: z33.literal("validation_error"), message: z33.string().min(1), details: z33.object({ rule: z33.literal("invalid_flow") }).strict() }).strict(),
|
|
7437
|
+
z33.object({ code: z33.literal("unauthorized"), message: z33.string().min(1), details: z33.object({ rule: z33.literal("invalid_authority") }).strict() }).strict(),
|
|
7438
|
+
z33.object({ code: z33.literal("not_found"), message: z33.string().min(1), details: z33.object({ rule: z33.enum(["invalid_flow", "identity_mismatch"]) }).strict() }).strict(),
|
|
7439
|
+
z33.object({ code: z33.literal("target_state_conflict"), message: z33.string().min(1), details: z33.object({ rule: z33.enum(["expired", "replayed", "session_inactive", "stale_generation"]) }).strict() }).strict()
|
|
7387
7440
|
]);
|
|
7388
7441
|
var authMeSupportResponse = authMeResponse.extend({ support: supportSessionInfo.optional() });
|
|
7389
7442
|
|
|
7390
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7391
|
-
import { z as
|
|
7392
|
-
var clientRobotListItem =
|
|
7443
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/client-robots.js
|
|
7444
|
+
import { z as z34 } from "zod";
|
|
7445
|
+
var clientRobotListItem = z34.object({
|
|
7393
7446
|
...robot2.shape,
|
|
7394
7447
|
bridge_state: bridgeState.meta({
|
|
7395
7448
|
description: "The built-in `bridge_state` datapoint as the cloud observes it right now: whether the bridge is connected, and its latency when it is."
|
|
7396
7449
|
}),
|
|
7397
|
-
published_version:
|
|
7450
|
+
published_version: z34.number().int().positive().nullable().meta({
|
|
7398
7451
|
description: 'The published configuration version, or `null` when nothing has been published yet. A robot with nothing published is still listed \u2014 "not configured yet" is a real state, and the caller is entitled to it \u2014 and its datasheet answers an empty exposure list.'
|
|
7399
7452
|
})
|
|
7400
7453
|
});
|
|
7401
|
-
var clientRobotListResponse =
|
|
7402
|
-
robots:
|
|
7454
|
+
var clientRobotListResponse = z34.object({
|
|
7455
|
+
robots: z34.array(clientRobotListItem).meta({
|
|
7403
7456
|
description: "Every robot the caller reaches, in name order with the id as the tiebreak. An app user reaches the robots their app attaches on which their role grants at least one slug or capability; a server key reaches every robot its app attaches; a developer reaches every robot of the organisation."
|
|
7404
7457
|
})
|
|
7405
7458
|
});
|
|
7406
7459
|
|
|
7407
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7408
|
-
import { z as
|
|
7409
|
-
var legalAcceptanceCursor =
|
|
7410
|
-
var legalAcceptanceListQuery =
|
|
7411
|
-
limit:
|
|
7460
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/legal-acceptances.js
|
|
7461
|
+
import { z as z35 } from "zod";
|
|
7462
|
+
var legalAcceptanceCursor = z35.string().min(1).max(512).regex(/^[A-Za-z0-9_-]+$/);
|
|
7463
|
+
var legalAcceptanceListQuery = z35.object({
|
|
7464
|
+
limit: z35.union([z35.string().regex(/^(?:0{0,2}[1-9]|0?[1-9][0-9]|100)$/), z35.number().int().min(1).max(100)]).transform(Number).pipe(z35.number().int().min(1).max(100)).optional(),
|
|
7412
7465
|
cursor: legalAcceptanceCursor.optional()
|
|
7413
7466
|
}).strict();
|
|
7414
|
-
var legalAcceptanceVersionRow =
|
|
7415
|
-
id:
|
|
7416
|
-
context:
|
|
7417
|
-
accepted_at:
|
|
7418
|
-
text_id:
|
|
7467
|
+
var legalAcceptanceVersionRow = z35.object({
|
|
7468
|
+
id: z35.uuid(),
|
|
7469
|
+
context: z35.enum(["registration", "invitation", "order", "existing_org", "amendment", "price_offer"]),
|
|
7470
|
+
accepted_at: z35.iso.datetime({ precision: 6 }),
|
|
7471
|
+
text_id: z35.string().min(1).max(80).regex(/\S/),
|
|
7419
7472
|
terms: legalDocumentReference,
|
|
7420
7473
|
dpa: legalDocumentReference.nullable()
|
|
7421
7474
|
}).strict().superRefine((value, ctx) => {
|
|
@@ -7426,22 +7479,22 @@ var legalAcceptanceVersionRow = z34.object({
|
|
|
7426
7479
|
if: { properties: { context: { enum: ["amendment", "price_offer"] } }, required: ["context"] },
|
|
7427
7480
|
then: { properties: { dpa: { type: "null" } }, required: ["dpa"] }
|
|
7428
7481
|
}] });
|
|
7429
|
-
var legalAcceptanceListResponse =
|
|
7430
|
-
acceptances:
|
|
7482
|
+
var legalAcceptanceListResponse = z35.object({
|
|
7483
|
+
acceptances: z35.array(legalAcceptanceVersionRow),
|
|
7431
7484
|
next_cursor: legalAcceptanceCursor.nullable()
|
|
7432
7485
|
}).strict();
|
|
7433
7486
|
|
|
7434
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7435
|
-
import { z as
|
|
7436
|
-
var auditActor =
|
|
7437
|
-
kind:
|
|
7438
|
-
id:
|
|
7439
|
-
label:
|
|
7440
|
-
});
|
|
7441
|
-
var auditEvent =
|
|
7442
|
-
id:
|
|
7443
|
-
org_id:
|
|
7444
|
-
at:
|
|
7487
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/audit.js
|
|
7488
|
+
import { z as z36 } from "zod";
|
|
7489
|
+
var auditActor = z36.object({
|
|
7490
|
+
kind: z36.enum(["developer", "end_user", "app_user", "server_key", "bridge", "fleetless"]),
|
|
7491
|
+
id: z36.uuid(),
|
|
7492
|
+
label: z36.string().min(1).max(200)
|
|
7493
|
+
});
|
|
7494
|
+
var auditEvent = z36.object({
|
|
7495
|
+
id: z36.uuid(),
|
|
7496
|
+
org_id: z36.uuid(),
|
|
7497
|
+
at: z36.iso.datetime(),
|
|
7445
7498
|
/**
|
|
7446
7499
|
* A monotonic counter, ascending in write order, unique across the log.
|
|
7447
7500
|
*
|
|
@@ -7460,18 +7513,18 @@ var auditEvent = z35.object({
|
|
|
7460
7513
|
* Required, not optional: an event without a sequence cannot be ordered
|
|
7461
7514
|
* against one that has it, and a log with two orderings has none.
|
|
7462
7515
|
*/
|
|
7463
|
-
seq:
|
|
7516
|
+
seq: z36.number().int().positive(),
|
|
7464
7517
|
actor: auditActor,
|
|
7465
7518
|
/** Stable dotted name, e.g. `app_user.login`, `config.published`. */
|
|
7466
|
-
action:
|
|
7519
|
+
action: z36.string().min(1).max(80),
|
|
7467
7520
|
/**
|
|
7468
7521
|
* What the action was about, if anything — a robot, an app, a user. Free
|
|
7469
7522
|
* of ids the console cannot resolve: carry the label with it.
|
|
7470
7523
|
*/
|
|
7471
|
-
target:
|
|
7472
|
-
kind:
|
|
7473
|
-
id:
|
|
7474
|
-
label:
|
|
7524
|
+
target: z36.object({
|
|
7525
|
+
kind: z36.string().min(1).max(40),
|
|
7526
|
+
id: z36.string().min(1),
|
|
7527
|
+
label: z36.string().min(1).max(200)
|
|
7475
7528
|
}).nullable(),
|
|
7476
7529
|
/**
|
|
7477
7530
|
* Action-specific extras.
|
|
@@ -7485,10 +7538,10 @@ var auditEvent = z35.object({
|
|
|
7485
7538
|
* So: never credentials, never tokens. That is a rule, not a guarantee the
|
|
7486
7539
|
* schema enforces.
|
|
7487
7540
|
*/
|
|
7488
|
-
details:
|
|
7541
|
+
details: z36.record(z36.string(), z36.unknown()).nullable()
|
|
7489
7542
|
});
|
|
7490
7543
|
var auditTimestampMs = wireTimestampMs;
|
|
7491
|
-
var auditQuery =
|
|
7544
|
+
var auditQuery = z36.object({
|
|
7492
7545
|
/** Only events with a smaller `seq` — the next, older page. */
|
|
7493
7546
|
before_seq: wireSeqCursor.optional(),
|
|
7494
7547
|
/**
|
|
@@ -7497,9 +7550,9 @@ var auditQuery = z35.object({
|
|
|
7497
7550
|
* coercion's result in either `io` direction, so the artifact would describe
|
|
7498
7551
|
* a shape a query string can never carry.
|
|
7499
7552
|
*/
|
|
7500
|
-
limit:
|
|
7553
|
+
limit: z36.union([z36.string().regex(/^\d{1,4}$/), z36.number().int()]).transform((v) => Number(v)).pipe(z36.number().int().positive().max(500)).optional(),
|
|
7501
7554
|
/** Exact action name, e.g. `config.published`. No prefix matching: a filter that matches more than it says is not one. */
|
|
7502
|
-
action:
|
|
7555
|
+
action: z36.string().min(1).max(80).optional(),
|
|
7503
7556
|
/**
|
|
7504
7557
|
* Everything under a dotted prefix, e.g. `server_key.` for all three
|
|
7505
7558
|
* server-key actions.
|
|
@@ -7516,7 +7569,7 @@ var auditQuery = z35.object({
|
|
|
7516
7569
|
* happily. The cloud is the only enforcement point — the same residual
|
|
7517
7570
|
* `orgLatencyQuery` and `orgUsageQuery` already name.
|
|
7518
7571
|
*/
|
|
7519
|
-
action_prefix:
|
|
7572
|
+
action_prefix: z36.string().min(1).max(80).optional(),
|
|
7520
7573
|
/**
|
|
7521
7574
|
* Only events by this actor.
|
|
7522
7575
|
*
|
|
@@ -7528,9 +7581,9 @@ var auditQuery = z35.object({
|
|
|
7528
7581
|
* Not an injection question — the query is parameterised either way. It is a
|
|
7529
7582
|
* **500 where a 400 belongs**, and a 500 is the answer that explains nothing.
|
|
7530
7583
|
*/
|
|
7531
|
-
actor_id:
|
|
7584
|
+
actor_id: z36.uuid().optional(),
|
|
7532
7585
|
/** Only events about this kind of target, e.g. `robot`. */
|
|
7533
|
-
target_kind:
|
|
7586
|
+
target_kind: z36.string().min(1).max(40).optional(),
|
|
7534
7587
|
/**
|
|
7535
7588
|
* Only events about this target — and, for a robot, also the events that
|
|
7536
7589
|
* name it in `details.robot_id`, so a robot's log includes what was
|
|
@@ -7540,7 +7593,7 @@ var auditQuery = z35.object({
|
|
|
7540
7593
|
* string in this contract and text in the cloud's table, so a uuid rule
|
|
7541
7594
|
* here would refuse ids the log can hold, and no value can fail a cast.
|
|
7542
7595
|
*/
|
|
7543
|
-
target_id:
|
|
7596
|
+
target_id: z36.string().min(1).max(200).optional().meta({
|
|
7544
7597
|
description: "Events whose target is this id; for a robot also the events that name it in `details.robot_id` (`action.invoked`, `service.called`, \u2026), so a robot's events include what was started on it."
|
|
7545
7598
|
}),
|
|
7546
7599
|
/**
|
|
@@ -7558,8 +7611,8 @@ var auditQuery = z35.object({
|
|
|
7558
7611
|
message: "action and action_prefix cannot be combined",
|
|
7559
7612
|
path: ["action_prefix"]
|
|
7560
7613
|
});
|
|
7561
|
-
var auditListResponse =
|
|
7562
|
-
events:
|
|
7614
|
+
var auditListResponse = z36.object({
|
|
7615
|
+
events: z36.array(auditEvent),
|
|
7563
7616
|
/**
|
|
7564
7617
|
* The `seq` a caller sends as `before_seq` to keep reading — or `null` when
|
|
7565
7618
|
* there is nothing further.
|
|
@@ -7570,41 +7623,41 @@ var auditListResponse = z35.object({
|
|
|
7570
7623
|
* not mean *no more* here. The same distinction `historySamples` was given
|
|
7571
7624
|
* `truncated` for.
|
|
7572
7625
|
*/
|
|
7573
|
-
next_cursor:
|
|
7626
|
+
next_cursor: z36.number().int().positive().nullable()
|
|
7574
7627
|
});
|
|
7575
7628
|
|
|
7576
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7577
|
-
import { z as
|
|
7578
|
-
var apiError =
|
|
7579
|
-
code:
|
|
7580
|
-
message:
|
|
7581
|
-
details:
|
|
7629
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/errors.js
|
|
7630
|
+
import { z as z37 } from "zod";
|
|
7631
|
+
var apiError = z37.object({
|
|
7632
|
+
code: z37.string().min(1),
|
|
7633
|
+
message: z37.string().min(1),
|
|
7634
|
+
details: z37.unknown().optional()
|
|
7582
7635
|
});
|
|
7583
|
-
var parameterViolation =
|
|
7584
|
-
field:
|
|
7636
|
+
var parameterViolation = z37.object({
|
|
7637
|
+
field: z37.string().min(1),
|
|
7585
7638
|
/** Which rule failed — `min`, `max`, `enum`, `pattern`, `required`, `undeclared`. */
|
|
7586
|
-
rule:
|
|
7587
|
-
message:
|
|
7639
|
+
rule: z37.string().min(1),
|
|
7640
|
+
message: z37.string().min(1)
|
|
7588
7641
|
});
|
|
7589
|
-
var parameterInvalidDetails =
|
|
7590
|
-
violations:
|
|
7642
|
+
var parameterInvalidDetails = z37.object({
|
|
7643
|
+
violations: z37.array(parameterViolation).min(1)
|
|
7591
7644
|
});
|
|
7592
|
-
var cancelRejectedDetails =
|
|
7593
|
-
goals:
|
|
7645
|
+
var cancelRejectedDetails = z37.object({
|
|
7646
|
+
goals: z37.array(bridgeCancelResultEntry).min(1)
|
|
7594
7647
|
});
|
|
7595
|
-
var invalidCodeDetails =
|
|
7596
|
-
attempts_left:
|
|
7648
|
+
var invalidCodeDetails = z37.object({
|
|
7649
|
+
attempts_left: z37.number().int().min(0).meta({
|
|
7597
7650
|
description: "How many more wrong codes this code or challenge takes before it is spent. `0` means the next attempt answers `410 token_spent`."
|
|
7598
7651
|
})
|
|
7599
7652
|
});
|
|
7600
|
-
var planLimitDetails =
|
|
7653
|
+
var planLimitDetails = z37.object({
|
|
7601
7654
|
limit: planLimitKey.exclude(["history_days", "audit_days"]).meta({ description: "The limit the action would exceed." }),
|
|
7602
|
-
used:
|
|
7603
|
-
max:
|
|
7655
|
+
used: z37.number().int().nonnegative().meta({ description: "How much of the limit the org uses now." }),
|
|
7656
|
+
max: z37.number().int().nonnegative().meta({
|
|
7604
7657
|
description: "The limit. For `asset_bytes_per_robot`, the org's whole pool: robots \xD7 the plan's bytes per robot."
|
|
7605
7658
|
}),
|
|
7606
7659
|
plan: planId.meta({ description: "The plan whose limit refused: the target plan while a move to a lower plan is pending." }),
|
|
7607
|
-
lifted_by:
|
|
7660
|
+
lifted_by: z37.object({
|
|
7608
7661
|
plan: planId.nullable().meta({ description: "The cheapest higher plan that raises this limit, or `null` when none does." }),
|
|
7609
7662
|
addon: addonKey.nullable().meta({
|
|
7610
7663
|
description: "The add-on that raises this limit, when the org's plan can buy add-ons; otherwise `null`."
|
|
@@ -7620,59 +7673,59 @@ var assetPlanLimitDetails = planLimitDetails.extend({
|
|
|
7620
7673
|
description: "Bytes the org's assets occupy, across every robot, before this upload."
|
|
7621
7674
|
})
|
|
7622
7675
|
});
|
|
7623
|
-
var planRequiredDetails =
|
|
7676
|
+
var planRequiredDetails = z37.object({
|
|
7624
7677
|
feature: planFeature.meta({ description: "The feature the action needs." }),
|
|
7625
7678
|
plan: planId.meta({ description: "The org's current plan." }),
|
|
7626
7679
|
required_plan: planId.meta({ description: "The cheapest plan that has the feature." })
|
|
7627
7680
|
});
|
|
7628
|
-
var orgLockedDetails =
|
|
7629
|
-
reason:
|
|
7681
|
+
var orgLockedDetails = z37.object({
|
|
7682
|
+
reason: z37.enum(["payment", "migration"]).meta({
|
|
7630
7683
|
description: "`payment`: a payment is missing. `migration`: the org did not choose what stays when the beta ended."
|
|
7631
7684
|
})
|
|
7632
7685
|
});
|
|
7633
|
-
var paymentProviderUnavailableDetails =
|
|
7634
|
-
provider:
|
|
7635
|
-
status:
|
|
7686
|
+
var paymentProviderUnavailableDetails = z37.object({
|
|
7687
|
+
provider: z37.literal("mollie").meta({ description: "The payment provider. Always `mollie` today." }),
|
|
7688
|
+
status: z37.number().int().nullable().meta({ description: "Mollie's own HTTP status, or `null` when the request timed out instead of answering." })
|
|
7636
7689
|
});
|
|
7637
|
-
var billingDocumentsUnavailableDetails =
|
|
7638
|
-
reason:
|
|
7690
|
+
var billingDocumentsUnavailableDetails = z37.object({
|
|
7691
|
+
reason: z37.enum(["provider_unavailable", "rate_limited", "list_limit_exceeded", "list_changed", "unsupported_document", "profile_mismatch"]).meta({
|
|
7639
7692
|
description: "Why Cloud refused rather than answering with a partial or unchecked document: `provider_unavailable` (Lexware did not answer or answered with an error), `rate_limited` (Lexware throttled the request; nothing was read), `list_limit_exceeded` (Lexware reports more than 10,000 documents for the org), `list_changed` (the document list changed while it was being paged, so no consistent list exists), `unsupported_document` (the detail or the file only: Lexware answered with an e-invoice profile or a file this cloud cannot present as the document), `profile_mismatch` (the Lexware account this cloud is configured with failed its account check, so every Lexware read stays closed)."
|
|
7640
7693
|
})
|
|
7641
7694
|
}).strict();
|
|
7642
|
-
var confirmationRequiredDetails =
|
|
7643
|
-
preview:
|
|
7695
|
+
var confirmationRequiredDetails = z37.object({
|
|
7696
|
+
preview: z37.unknown().meta({
|
|
7644
7697
|
description: "The current preview of the operation, with its `token`: a `collectionsSchemaPreview` for a publish, a `collectionsRestorePreview` for a restore, a `collectionsPurgePreview` for a purge and a `collectionImportPreview` for an import. Confirm it by sending that `token` as `confirm`. A publish that names a `source_sha256` which is not the saved draft's, because the draft was saved again since it was previewed, is refused the same way with a preview whose `token` can be `null` (no effects, nothing to confirm): read this preview, then publish again with its `source_sha256`, and with its `token` as `confirm` when it has one."
|
|
7645
7698
|
})
|
|
7646
7699
|
}).strict();
|
|
7647
|
-
var recordReferencedDetails =
|
|
7648
|
-
references:
|
|
7649
|
-
collection:
|
|
7650
|
-
count:
|
|
7700
|
+
var recordReferencedDetails = z37.object({
|
|
7701
|
+
references: z37.array(z37.object({
|
|
7702
|
+
collection: z37.string().min(1).meta({ description: "The key of a collection that has records pointing at this one." }),
|
|
7703
|
+
count: z37.number().int().min(1).meta({ description: "How many records of that collection point at it." })
|
|
7651
7704
|
}).strict()).meta({
|
|
7652
7705
|
description: "The collections whose records reference the record, each with how many. Only collections the caller may read are named, so the list is empty when the records that point here are all in collections the caller cannot read; the refusal still stands."
|
|
7653
7706
|
})
|
|
7654
7707
|
}).strict();
|
|
7655
|
-
var recordChangedDetails =
|
|
7656
|
-
revision:
|
|
7708
|
+
var recordChangedDetails = z37.object({
|
|
7709
|
+
revision: z37.number().int().min(1).meta({ description: "The current revision of the record, which is not the `expected_revision` that was sent." })
|
|
7657
7710
|
}).strict();
|
|
7658
|
-
var referenceInvalidDetails =
|
|
7659
|
-
field:
|
|
7660
|
-
reason:
|
|
7711
|
+
var referenceInvalidDetails = z37.object({
|
|
7712
|
+
field: z37.string().min(1).meta({ description: "The key of the reference field." }),
|
|
7713
|
+
reason: z37.enum(["missing", "other_robot", "not_readable"]).meta({
|
|
7661
7714
|
description: "`missing`: no record of the target collection has that id. `other_robot`: the target belongs to another robot than the record that points at it. `not_readable`: the caller may not read the target collection."
|
|
7662
7715
|
})
|
|
7663
7716
|
}).strict();
|
|
7664
|
-
var requiredMissingDetails =
|
|
7665
|
-
fields:
|
|
7717
|
+
var requiredMissingDetails = z37.object({
|
|
7718
|
+
fields: z37.array(z37.string().min(1)).min(1).meta({ description: "The keys of the required fields that have no value." })
|
|
7666
7719
|
}).strict();
|
|
7667
|
-
var roleCycleDetails =
|
|
7668
|
-
cycle:
|
|
7720
|
+
var roleCycleDetails = z37.object({
|
|
7721
|
+
cycle: z37.array(z37.string()).min(2).meta({
|
|
7669
7722
|
description: 'The keys along the loop, in order, ending with the key the loop started from: `["a", "b", "a"]`.'
|
|
7670
7723
|
})
|
|
7671
7724
|
});
|
|
7672
7725
|
|
|
7673
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7674
|
-
import { z as
|
|
7675
|
-
var oauthErrorCode =
|
|
7726
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/oauth.js
|
|
7727
|
+
import { z as z38 } from "zod";
|
|
7728
|
+
var oauthErrorCode = z38.enum([
|
|
7676
7729
|
"invalid_request",
|
|
7677
7730
|
"invalid_client",
|
|
7678
7731
|
"invalid_grant",
|
|
@@ -7685,11 +7738,11 @@ var oauthErrorCode = z37.enum([
|
|
|
7685
7738
|
/** RFC 8707: the `resource` named is not one this server issues tokens for. */
|
|
7686
7739
|
"invalid_target"
|
|
7687
7740
|
]);
|
|
7688
|
-
var oauthError =
|
|
7741
|
+
var oauthError = z38.object({
|
|
7689
7742
|
error: oauthErrorCode,
|
|
7690
|
-
error_description:
|
|
7743
|
+
error_description: z38.string().min(1).max(500).optional(),
|
|
7691
7744
|
/** Echoed back per RFC 6749 §4.1.2.1 so a client can match the response. */
|
|
7692
|
-
state:
|
|
7745
|
+
state: z38.string().min(1).max(500).optional(),
|
|
7693
7746
|
/**
|
|
7694
7747
|
* **A Fleetless reason carried inside a standard envelope, and it exists
|
|
7695
7748
|
* because the alternative lost a distinction.**
|
|
@@ -7707,9 +7760,9 @@ var oauthError = z37.object({
|
|
|
7707
7760
|
* our own tooling switches on. RFC 6749 §5.2 permits additional members, and
|
|
7708
7761
|
* a client that ignores this one still behaves correctly.
|
|
7709
7762
|
*/
|
|
7710
|
-
fleetless_code:
|
|
7763
|
+
fleetless_code: z38.string().min(1).max(60).optional()
|
|
7711
7764
|
});
|
|
7712
|
-
var redirectUri =
|
|
7765
|
+
var redirectUri = z38.string().min(1).max(2e3).refine((v) => {
|
|
7713
7766
|
let url;
|
|
7714
7767
|
try {
|
|
7715
7768
|
url = new URL(v);
|
|
@@ -7724,183 +7777,183 @@ var redirectUri = z37.string().min(1).max(2e3).refine((v) => {
|
|
|
7724
7777
|
return ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
7725
7778
|
return false;
|
|
7726
7779
|
}, { message: "redirect_uri must be an https URL, or http on an explicit loopback address, and carry no fragment" });
|
|
7727
|
-
var codeChallengeMethod =
|
|
7780
|
+
var codeChallengeMethod = z38.enum(["S256"]);
|
|
7728
7781
|
var MCP_DCR_MAX_REDIRECT_URIS = 5;
|
|
7729
|
-
var dynamicClientRegistrationRequest =
|
|
7730
|
-
redirect_uris:
|
|
7782
|
+
var dynamicClientRegistrationRequest = z38.object({
|
|
7783
|
+
redirect_uris: z38.array(redirectUri).min(1).max(MCP_DCR_MAX_REDIRECT_URIS).meta({
|
|
7731
7784
|
description: `Where the authorization code may be returned, and the one field a registration cannot omit. Each must be an \`https\` URL, or \`http\` on an explicit loopback address for a native app that cannot hold a certificate, and none may carry a fragment. Between \`1\` and \`${MCP_DCR_MAX_REDIRECT_URIS}\` of them; duplicates are collapsed rather than counted twice. Matched **exactly** at the authorize step against what was registered here.`
|
|
7732
7785
|
}),
|
|
7733
|
-
client_name:
|
|
7786
|
+
client_name: z38.string().min(1).max(200).optional().meta({
|
|
7734
7787
|
description: 'The name the client calls itself. Optional: RFC 7591 makes every metadata field optional, so a registration without one is recorded under a default name. It is **not** vouched for by Fleetless and must never be rendered as if it were: a self-registered client chooses this string, and one has called itself *"Fleetless Official Helper"*.'
|
|
7735
7788
|
}),
|
|
7736
|
-
token_endpoint_auth_method:
|
|
7789
|
+
token_endpoint_auth_method: z38.enum(["none"]).optional().meta({
|
|
7737
7790
|
description: "`none`, RFC 7591's value for a public client, and the only value either server registers. Any other value is **refused rather than silently downgraded**: a client that believes it holds a secret and does not has a wrong mental model of its own security. There is no client secret to hold \u2014 mandatory PKCE (`S256`) is the defence."
|
|
7738
7791
|
}),
|
|
7739
|
-
grant_types:
|
|
7792
|
+
grant_types: z38.array(z38.enum(["authorization_code", "refresh_token"])).optional().meta({
|
|
7740
7793
|
description: "Accepted for conformance with RFC 7591 and then **ignored**: both MCP authorization servers grant `authorization_code` and `refresh_token` to every registration, and the answer states what was granted (\xA73.2.1) rather than what was asked."
|
|
7741
7794
|
}),
|
|
7742
|
-
response_types:
|
|
7795
|
+
response_types: z38.array(z38.enum(["code"])).optional().meta({
|
|
7743
7796
|
description: "Accepted for conformance and then **ignored**; the response names `code`, which is the only response type OAuth 2.1 leaves, the implicit grant having been removed."
|
|
7744
7797
|
}),
|
|
7745
|
-
scope:
|
|
7798
|
+
scope: z38.string().max(500).optional().meta({
|
|
7746
7799
|
description: "Accepted for conformance and then **ignored**. This authorization server issues no scopes at all, which is why the registration answer carries no `scope` field to echo one back in."
|
|
7747
7800
|
})
|
|
7748
7801
|
}).meta({
|
|
7749
7802
|
description: "What an MCP client sends to register itself, per RFC 7591. Unknown metadata is ignored rather than refused (\xA73.1), and the answer states what was actually granted rather than what was asked for (\xA73.2.1)."
|
|
7750
7803
|
});
|
|
7751
|
-
var dynamicClientRegistrationResponse =
|
|
7752
|
-
client_id:
|
|
7804
|
+
var dynamicClientRegistrationResponse = z38.object({
|
|
7805
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7753
7806
|
description: "The identifier this client sends at the authorize and token endpoints. Opaque, and not the app identifier."
|
|
7754
7807
|
}),
|
|
7755
|
-
client_name:
|
|
7808
|
+
client_name: z38.string().min(1).max(200).meta({
|
|
7756
7809
|
description: "The name the client registered under, echoed back. Chosen by the client and not vouched for by Fleetless."
|
|
7757
7810
|
}),
|
|
7758
|
-
redirect_uris:
|
|
7811
|
+
redirect_uris: z38.array(redirectUri).meta({
|
|
7759
7812
|
description: "The redirect URIs this registration was accepted for. A code is returned to one of these and nowhere else."
|
|
7760
7813
|
}),
|
|
7761
|
-
grant_types:
|
|
7814
|
+
grant_types: z38.array(z38.string()).meta({
|
|
7762
7815
|
description: 'The grants this client may use. Always exactly `["authorization_code", "refresh_token"]` \u2014 an exchange mints a refresh token and the token endpoint rotates it.'
|
|
7763
7816
|
}),
|
|
7764
|
-
response_types:
|
|
7817
|
+
response_types: z38.array(z38.string()).meta({
|
|
7765
7818
|
description: "The response types this client may ask for: `code`."
|
|
7766
7819
|
}),
|
|
7767
|
-
token_endpoint_auth_method:
|
|
7820
|
+
token_endpoint_auth_method: z38.literal("none").meta({
|
|
7768
7821
|
description: "`none` \u2014 this server registers public clients only, and PKCE rather than a secret is what protects the exchange."
|
|
7769
7822
|
}),
|
|
7770
|
-
client_id_issued_at:
|
|
7823
|
+
client_id_issued_at: z38.number().int().nonnegative().meta({
|
|
7771
7824
|
description: "When the registration was created, in seconds since the epoch, per RFC 7591."
|
|
7772
7825
|
}),
|
|
7773
|
-
client_secret_expires_at:
|
|
7826
|
+
client_secret_expires_at: z38.literal(0).meta({
|
|
7774
7827
|
description: "Always `0`, which is RFC 7591's way of saying the client secret never expires \u2014 there is none. The **registration** itself does expire: a self-registered client that never completes a flow is an unauthenticated write somebody left behind."
|
|
7775
7828
|
})
|
|
7776
7829
|
});
|
|
7777
|
-
var oauthCodeTokenRequest =
|
|
7778
|
-
grant_type:
|
|
7830
|
+
var oauthCodeTokenRequest = z38.object({
|
|
7831
|
+
grant_type: z38.literal("authorization_code").meta({
|
|
7779
7832
|
description: "`authorization_code`: this request exchanges the code from the authorize redirect for an access token and a refresh token."
|
|
7780
7833
|
}),
|
|
7781
|
-
code:
|
|
7834
|
+
code: z38.string().min(1).max(500).meta({
|
|
7782
7835
|
description: "The authorization code from the redirect. It may be exchanged once; a second presentation is `invalid_grant`, the same answer a fabricated code gets."
|
|
7783
7836
|
}),
|
|
7784
7837
|
redirect_uri: redirectUri.meta({
|
|
7785
7838
|
description: "The same redirect URI the authorize request used. It is compared, not merely recorded."
|
|
7786
7839
|
}),
|
|
7787
|
-
client_id:
|
|
7840
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7788
7841
|
description: "The client making the exchange, as registered."
|
|
7789
7842
|
}),
|
|
7790
|
-
code_verifier:
|
|
7843
|
+
code_verifier: z38.string().regex(/^[A-Za-z0-9\-._~]{43,128}$/, "code_verifier must be 43-128 unreserved characters (RFC 7636 \xA74.1)").meta({
|
|
7791
7844
|
description: "The PKCE verifier whose `S256` hash was sent as the challenge at the authorize step. Between `43` and `128` unreserved characters, per RFC 7636 \xA74.1 \u2014 it is compared rather than parsed, so a length nobody checks is a length an attacker chooses. PKCE is mandatory for every client under OAuth 2.1."
|
|
7792
7845
|
}),
|
|
7793
|
-
resource:
|
|
7846
|
+
resource: z38.url().optional().meta({
|
|
7794
7847
|
description: "The resource the token is requested for, per RFC 8707. It must match the audience the code was authorized for, or the answer is `invalid_target`; omitted, the code's own audience stands. It becomes the token's `aud`, and a resource refuses a token whose audience names something else \u2014 which is what keeps a token minted for one app out of another app's endpoint."
|
|
7795
7848
|
})
|
|
7796
7849
|
}).meta({
|
|
7797
7850
|
description: "RFC 6749 \xA74.1.3's authorization-code exchange with PKCE, as either MCP authorization server reads it. Sent as `application/x-www-form-urlencoded`, per \xA74.1.3, though the server accepts a JSON body too."
|
|
7798
7851
|
});
|
|
7799
|
-
var oauthRefreshTokenRequest =
|
|
7800
|
-
grant_type:
|
|
7852
|
+
var oauthRefreshTokenRequest = z38.object({
|
|
7853
|
+
grant_type: z38.literal("refresh_token").meta({
|
|
7801
7854
|
description: "`refresh_token`: this request rotates a refresh token into a new access token and a new refresh token. The presented token is consumed; presenting it again revokes the whole session."
|
|
7802
7855
|
}),
|
|
7803
|
-
refresh_token:
|
|
7856
|
+
refresh_token: z38.string().min(1).max(500).meta({
|
|
7804
7857
|
description: "The refresh token from the last token response. Bound to the client that received it and to one identity space: presented by another client, or at the other MCP server, it is `invalid_grant` and stays unconsumed."
|
|
7805
7858
|
}),
|
|
7806
|
-
client_id:
|
|
7859
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7807
7860
|
description: "The client the refresh token was issued to, as registered. A refresh token is not transferable between clients."
|
|
7808
7861
|
}),
|
|
7809
|
-
resource:
|
|
7862
|
+
resource: z38.url().optional().meta({
|
|
7810
7863
|
description: "The resource the new token is for, per RFC 8707. Optional; when named it must be the audience the session was issued for, or the answer is `invalid_target` and the refresh token is left untouched. The successor carries the same audience either way."
|
|
7811
7864
|
})
|
|
7812
7865
|
}).meta({
|
|
7813
7866
|
description: "RFC 6749 \xA76's refresh, as either MCP authorization server reads it. Every use rotates: the answer carries a new refresh token and the presented one is dead."
|
|
7814
7867
|
});
|
|
7815
|
-
var oauthTokenRequest =
|
|
7868
|
+
var oauthTokenRequest = z38.discriminatedUnion("grant_type", [oauthCodeTokenRequest, oauthRefreshTokenRequest]).meta({
|
|
7816
7869
|
description: "What an MCP token endpoint accepts: the authorization-code exchange, or a refresh. Any other `grant_type` is `unsupported_grant_type`, refused before a lookup happens."
|
|
7817
7870
|
});
|
|
7818
|
-
var oauthTokenResponse =
|
|
7819
|
-
access_token:
|
|
7871
|
+
var oauthTokenResponse = z38.object({
|
|
7872
|
+
access_token: z38.string().min(1).meta({
|
|
7820
7873
|
description: "The bearer token. It is the same token the client login mints \u2014 only the envelope differs, because an RFC-compliant client parses this one and knows nothing about Fleetless."
|
|
7821
7874
|
}),
|
|
7822
|
-
token_type:
|
|
7875
|
+
token_type: z38.literal("Bearer").meta({
|
|
7823
7876
|
description: "`Bearer`. RFC 6749 \xA75.1 makes the value case-insensitive for a client reading it; this is the spelling this server emits."
|
|
7824
7877
|
}),
|
|
7825
|
-
expires_in:
|
|
7878
|
+
expires_in: z38.number().int().positive().meta({
|
|
7826
7879
|
description: "How long the access token is valid, in **seconds**, per RFC 6749 \xA75.1. Not a timestamp, and not milliseconds."
|
|
7827
7880
|
}),
|
|
7828
|
-
refresh_token:
|
|
7881
|
+
refresh_token: z38.string().min(1).optional().meta({
|
|
7829
7882
|
description: "The refresh token. Both MCP token endpoints issue one on every exchange and every refresh; it rotates on every use, lives ninety days from its last use, and dies with the account's sessions \u2014 a block, a password change, a withdrawn consent. The console's own OAuth portal issues none."
|
|
7830
7883
|
}),
|
|
7831
|
-
scope:
|
|
7884
|
+
scope: z38.string().max(500).optional().meta({
|
|
7832
7885
|
description: "The scopes the issued token actually carries, space-separated."
|
|
7833
7886
|
})
|
|
7834
7887
|
});
|
|
7835
|
-
var authorizationServerMetadata =
|
|
7836
|
-
issuer:
|
|
7888
|
+
var authorizationServerMetadata = z38.object({
|
|
7889
|
+
issuer: z38.url().meta({
|
|
7837
7890
|
description: "The issuer identifier of this authorization server, per RFC 8414 \xA72. It is what a client checks a token's `iss` against."
|
|
7838
7891
|
}),
|
|
7839
|
-
authorization_endpoint:
|
|
7892
|
+
authorization_endpoint: z38.url().meta({
|
|
7840
7893
|
description: "Where a client sends the user to authorize."
|
|
7841
7894
|
}),
|
|
7842
|
-
token_endpoint:
|
|
7895
|
+
token_endpoint: z38.url().meta({
|
|
7843
7896
|
description: "The URL where a client exchanges an authorization code, or a refresh token, for tokens."
|
|
7844
7897
|
}),
|
|
7845
|
-
registration_endpoint:
|
|
7898
|
+
registration_endpoint: z38.url().optional().meta({
|
|
7846
7899
|
description: "The URL where a client may register itself, per RFC 7591. Absent when the app does not accept dynamic clients."
|
|
7847
7900
|
}),
|
|
7848
|
-
client_id_metadata_document_supported:
|
|
7901
|
+
client_id_metadata_document_supported: z38.boolean().optional().meta({
|
|
7849
7902
|
description: "`true` when a client may use the HTTPS URL of its Client ID Metadata Document as `client_id` (draft-ietf-oauth-client-id-metadata-document) instead of registering. Both MCP authorization servers answer `true` and keep `registration_endpoint` beside it."
|
|
7850
7903
|
}),
|
|
7851
|
-
response_types_supported:
|
|
7904
|
+
response_types_supported: z38.array(z38.literal("code")).meta({
|
|
7852
7905
|
description: "The response types this server offers: `code` only, the implicit grant being gone with OAuth 2.1."
|
|
7853
7906
|
}),
|
|
7854
|
-
grant_types_supported:
|
|
7907
|
+
grant_types_supported: z38.array(z38.enum(["authorization_code", "refresh_token"])).meta({
|
|
7855
7908
|
description: "The grants this server offers: `authorization_code` and `refresh_token`. OAuth 2.1 removes the implicit and password grants, so neither appears here."
|
|
7856
7909
|
}),
|
|
7857
|
-
code_challenge_methods_supported:
|
|
7910
|
+
code_challenge_methods_supported: z38.array(codeChallengeMethod).meta({
|
|
7858
7911
|
description: "The PKCE challenge methods accepted: `S256` only. `plain` is not offered \u2014 a challenge equal to its verifier defends against nothing, and offering it would make a downgrade negotiable."
|
|
7859
7912
|
}),
|
|
7860
|
-
token_endpoint_auth_methods_supported:
|
|
7913
|
+
token_endpoint_auth_methods_supported: z38.array(z38.literal("none")).meta({
|
|
7861
7914
|
description: "How a client authenticates at the token endpoint: `none`, the public-client method, with PKCE protecting the exchange."
|
|
7862
7915
|
}),
|
|
7863
|
-
scopes_supported:
|
|
7916
|
+
scopes_supported: z38.array(z38.string()).optional().meta({
|
|
7864
7917
|
description: "The scopes this server knows about, where it publishes a list."
|
|
7865
7918
|
})
|
|
7866
7919
|
});
|
|
7867
|
-
var protectedResourceMetadata =
|
|
7868
|
-
resource:
|
|
7920
|
+
var protectedResourceMetadata = z38.object({
|
|
7921
|
+
resource: z38.url().meta({
|
|
7869
7922
|
description: "The resource identifier this document describes, per RFC 9728. A token whose audience names something else is rejected here rather than merely noted."
|
|
7870
7923
|
}),
|
|
7871
|
-
authorization_servers:
|
|
7924
|
+
authorization_servers: z38.array(z38.url()).min(1).meta({
|
|
7872
7925
|
description: "The authorization servers that may issue tokens for this resource. There is always at least one."
|
|
7873
7926
|
}),
|
|
7874
|
-
bearer_methods_supported:
|
|
7927
|
+
bearer_methods_supported: z38.array(z38.literal("header")).meta({
|
|
7875
7928
|
description: "How a token may be presented: in the `Authorization` header only, never in a query parameter or a form field."
|
|
7876
7929
|
}),
|
|
7877
|
-
scopes_supported:
|
|
7930
|
+
scopes_supported: z38.array(z38.string()).optional().meta({
|
|
7878
7931
|
description: "The scopes this resource understands, where it publishes a list."
|
|
7879
7932
|
})
|
|
7880
7933
|
});
|
|
7881
|
-
var oauthRedirectResponse =
|
|
7882
|
-
redirect_to:
|
|
7934
|
+
var oauthRedirectResponse = z38.object({
|
|
7935
|
+
redirect_to: z38.string().min(1).max(2e3)
|
|
7883
7936
|
});
|
|
7884
|
-
var oauthAuthorizeQuery =
|
|
7885
|
-
response_type:
|
|
7937
|
+
var oauthAuthorizeQuery = z38.object({
|
|
7938
|
+
response_type: z38.literal("code").meta({
|
|
7886
7939
|
description: "Always `code`. RFC 6749 \xA74.1.2.1 names `unsupported_response_type` for any other value, but `oauthErrorCode` has no such member \u2014 this server issues no other grant from this endpoint \u2014 so an unsupported value comes back on the callback as `invalid_request`."
|
|
7887
7940
|
}),
|
|
7888
|
-
client_id:
|
|
7941
|
+
client_id: z38.string().min(1).meta({
|
|
7889
7942
|
description: "The OAuth client, self-registered or the one well-known central client \u2014 **not** the app identifier. Unknown, expired-dynamic and mismatched clients all collapse into the same `400 invalid_client`, answered without a redirect."
|
|
7890
7943
|
}),
|
|
7891
|
-
redirect_uri:
|
|
7944
|
+
redirect_uri: z38.string().min(1).meta({
|
|
7892
7945
|
description: "One of the client's registered redirect URIs, compared **exactly** \u2014 string equality against the registered list, never a prefix or a host match. Both the shape (`redirectUri`) and the registration are checked, and a failure of either is a `400 invalid_request` with no redirect."
|
|
7893
7946
|
}),
|
|
7894
|
-
code_challenge:
|
|
7947
|
+
code_challenge: z38.string().min(1).meta({
|
|
7895
7948
|
description: "The PKCE challenge; the verifier is presented at the token endpoint. Only non-emptiness is checked here \u2014 length and alphabet are not \u2014 since the verifier is what has to match."
|
|
7896
7949
|
}),
|
|
7897
|
-
code_challenge_method:
|
|
7950
|
+
code_challenge_method: z38.literal("S256").meta({
|
|
7898
7951
|
description: "Only `S256`. `plain` is refused: a challenge equal to its verifier defends against nothing."
|
|
7899
7952
|
}),
|
|
7900
|
-
state:
|
|
7953
|
+
state: z38.string().optional().meta({
|
|
7901
7954
|
description: "Returned unchanged on the callback, and on the error redirect too, so a client can bind either answer to its own request."
|
|
7902
7955
|
}),
|
|
7903
|
-
resource:
|
|
7956
|
+
resource: z38.string().optional().meta({
|
|
7904
7957
|
description: "RFC 8707 resource indicator: the API origin or the MCP endpoint the token is for. Checked against the resources this server issues tokens for **on behalf of this client's app**; a mismatch is `invalid_target` on the callback."
|
|
7905
7958
|
})
|
|
7906
7959
|
// **No `scope`, because this authorization server issues none.** The field
|
|
@@ -7913,15 +7966,15 @@ var oauthAuthorizeQuery = z37.object({
|
|
|
7913
7966
|
description: "The authorization request an MCP client sends, per RFC 6749 \xA74.1.1 with mandatory PKCE. The handler reads it parameter by parameter rather than through one parse, because the answers differ: `client_id` and `redirect_uri` are refused flat, with no redirect, since until both are confirmed there is no trusted target to bounce a browser to, and everything after them is reported to the client's own callback as query parameters."
|
|
7914
7967
|
});
|
|
7915
7968
|
|
|
7916
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7969
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-schema.js
|
|
7970
|
+
import { z as z41 } from "zod";
|
|
7971
|
+
|
|
7972
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-issues.js
|
|
7917
7973
|
import { z as z40 } from "zod";
|
|
7918
7974
|
|
|
7919
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7975
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-templates.js
|
|
7920
7976
|
import { z as z39 } from "zod";
|
|
7921
|
-
|
|
7922
|
-
// node_modules/.pnpm/@fleetless+contracts@18.2.0/node_modules/@fleetless/contracts/dist/collections-templates.js
|
|
7923
|
-
import { z as z38 } from "zod";
|
|
7924
|
-
var collectionJsonTemplateName = z38.enum(["pose2d", "point2d", "polygon2d", "range1d"]).meta({ description: "The name of a built-in JSON template: `pose2d`, `point2d`, `polygon2d` or `range1d`." });
|
|
7977
|
+
var collectionJsonTemplateName = z39.enum(["pose2d", "point2d", "polygon2d", "range1d"]).meta({ description: "The name of a built-in JSON template: `pose2d`, `point2d`, `polygon2d` or `range1d`." });
|
|
7925
7978
|
function deepFreeze(value) {
|
|
7926
7979
|
if (value !== null && typeof value === "object") {
|
|
7927
7980
|
for (const inner of Object.values(value))
|
|
@@ -7977,29 +8030,29 @@ var COLLECTION_JSON_TEMPLATES = deepFreeze({
|
|
|
7977
8030
|
}
|
|
7978
8031
|
});
|
|
7979
8032
|
|
|
7980
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8033
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-values.js
|
|
7981
8034
|
var TOO_DEEP_JSON = `The value nests arrays and objects more than ${COLLECTION_LIMITS.jsonDepth} levels deep.`;
|
|
7982
8035
|
|
|
7983
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7984
|
-
var collectionsIssue =
|
|
7985
|
-
path:
|
|
7986
|
-
code:
|
|
7987
|
-
message:
|
|
7988
|
-
severity:
|
|
8036
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-issues.js
|
|
8037
|
+
var collectionsIssue = z40.object({
|
|
8038
|
+
path: z40.string().min(1).meta({ description: "Where in the document, with dots between the keys: `collections.chargers.fields.location.to`." }),
|
|
8039
|
+
code: z40.string().meta({ description: "A stable name for the kind of finding, for code to branch on." }),
|
|
8040
|
+
message: z40.string().meta({ description: "What is wrong, in a sentence for a person." }),
|
|
8041
|
+
severity: z40.enum(["error", "warning", "info"]).meta({
|
|
7989
8042
|
description: "An error makes the document invalid and it cannot be saved or published. A warning and information leave it valid."
|
|
7990
8043
|
})
|
|
7991
8044
|
}).meta({ description: "One finding about a collections document." });
|
|
7992
8045
|
|
|
7993
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7994
|
-
var timestamp2 =
|
|
7995
|
-
var count4 =
|
|
7996
|
-
var schemaVersion2 =
|
|
8046
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-schema.js
|
|
8047
|
+
var timestamp2 = z41.iso.datetime();
|
|
8048
|
+
var count4 = z41.number().int().min(0);
|
|
8049
|
+
var schemaVersion2 = z41.number().int().min(1);
|
|
7997
8050
|
var UNIQUE_DISCARDED_LISTED = 1e3;
|
|
7998
|
-
var token =
|
|
8051
|
+
var token = z41.string().min(1);
|
|
7999
8052
|
var confirm = token.meta({
|
|
8000
8053
|
description: "The `token` of the preview of exactly this request. Needed when the preview lists effects; a missing or outdated token is answered with `confirmation_required` and the current preview."
|
|
8001
8054
|
});
|
|
8002
|
-
var sha256 =
|
|
8055
|
+
var sha256 = z41.string().regex(/^[0-9a-f]{64}$/);
|
|
8003
8056
|
var purgeConfirm = token.meta({
|
|
8004
8057
|
description: "The `token` of the preview of exactly this purge. A purge is always confirmed: without a token, or with one that no longer holds, the answer is `confirmation_required` with the current preview."
|
|
8005
8058
|
});
|
|
@@ -8021,16 +8074,16 @@ function utf8Length(text3) {
|
|
|
8021
8074
|
}
|
|
8022
8075
|
var collection = collectionKey.meta({ description: "The key of the collection." });
|
|
8023
8076
|
var field = collectionKey.meta({ description: "The key of the field." });
|
|
8024
|
-
var collectionsEffect =
|
|
8025
|
-
|
|
8026
|
-
kind:
|
|
8077
|
+
var collectionsEffect = z41.discriminatedUnion("kind", [
|
|
8078
|
+
z41.object({
|
|
8079
|
+
kind: z41.literal("collection_removed"),
|
|
8027
8080
|
collection,
|
|
8028
8081
|
records: count4.meta({ description: "Records deleted with the collection." })
|
|
8029
8082
|
}).strict().meta({
|
|
8030
8083
|
description: "The collection is gone from the document, so its records are deleted. Their history is deleted 90 days after the publish or restore that removed the collection, also when it held no records any more by then; until then a restore of an earlier version with its data can bring the records back."
|
|
8031
8084
|
}),
|
|
8032
|
-
|
|
8033
|
-
kind:
|
|
8085
|
+
z41.object({
|
|
8086
|
+
kind: z41.literal("collection_recreated"),
|
|
8034
8087
|
collection,
|
|
8035
8088
|
records: count4.meta({ description: "Records deleted by the re-creation." }),
|
|
8036
8089
|
from: collectionBinding,
|
|
@@ -8038,101 +8091,101 @@ var collectionsEffect = z40.discriminatedUnion("kind", [
|
|
|
8038
8091
|
}).strict().meta({
|
|
8039
8092
|
description: "The binding of the collection changed, which deletes its records and starts the collection again. The history of the deleted records is kept 90 days after the publish or restore, as for a removed collection."
|
|
8040
8093
|
}),
|
|
8041
|
-
|
|
8042
|
-
kind:
|
|
8094
|
+
z41.object({
|
|
8095
|
+
kind: z41.literal("records_created"),
|
|
8043
8096
|
collection,
|
|
8044
8097
|
count: count4.meta({ description: "Records created, one for each robot attached to the app." })
|
|
8045
8098
|
}).strict().meta({ description: "A collection with one record per robot got the records of the robots that have none." }),
|
|
8046
|
-
|
|
8047
|
-
kind:
|
|
8099
|
+
z41.object({
|
|
8100
|
+
kind: z41.literal("field_removed"),
|
|
8048
8101
|
collection,
|
|
8049
8102
|
field,
|
|
8050
8103
|
values: count4.meta({ description: "Values removed from records." })
|
|
8051
8104
|
}).strict().meta({ description: "The field is gone from the document, so its values are removed from the records." }),
|
|
8052
|
-
|
|
8053
|
-
kind:
|
|
8105
|
+
z41.object({
|
|
8106
|
+
kind: z41.literal("defaults_filled"),
|
|
8054
8107
|
collection,
|
|
8055
8108
|
field,
|
|
8056
8109
|
records: count4.meta({ description: "Records that receive the default." })
|
|
8057
8110
|
}).strict().meta({ description: "Records without a value get the default of a new or newly required field." }),
|
|
8058
|
-
|
|
8059
|
-
kind:
|
|
8111
|
+
z41.object({
|
|
8112
|
+
kind: z41.literal("values_converted"),
|
|
8060
8113
|
collection,
|
|
8061
8114
|
field,
|
|
8062
8115
|
converted: count4.meta({ description: "Values that became a value of the new type." }),
|
|
8063
8116
|
discarded: count4.meta({ description: "Values that could not be converted and were removed." })
|
|
8064
8117
|
}).strict().meta({ description: "The type of the field changed: values are converted where the conversion rules allow it and removed where they do not." }),
|
|
8065
|
-
|
|
8066
|
-
kind:
|
|
8118
|
+
z41.object({
|
|
8119
|
+
kind: z41.literal("values_discarded"),
|
|
8067
8120
|
collection,
|
|
8068
8121
|
field,
|
|
8069
|
-
reason:
|
|
8122
|
+
reason: z41.enum(["reference_target_changed", "option_removed", "constraint"]).meta({
|
|
8070
8123
|
description: "`reference_target_changed`: the field points at another collection now. `option_removed`: a select option is gone. `constraint`: a limit such as `max_length`, `pattern`, `min`, `max`, `integer` or the JSON schema now excludes the value."
|
|
8071
8124
|
}),
|
|
8072
8125
|
values: count4.meta({ description: "Values removed from records." })
|
|
8073
8126
|
}).strict().meta({ description: "Values that the changed field no longer accepts are removed." }),
|
|
8074
|
-
|
|
8075
|
-
kind:
|
|
8127
|
+
z41.object({
|
|
8128
|
+
kind: z41.literal("unique_discarded"),
|
|
8076
8129
|
collection,
|
|
8077
8130
|
field,
|
|
8078
8131
|
total: count4.meta({ description: "The exact number of values removed." }),
|
|
8079
|
-
records:
|
|
8080
|
-
id:
|
|
8081
|
-
display:
|
|
8082
|
-
value:
|
|
8132
|
+
records: z41.array(z41.object({
|
|
8133
|
+
id: z41.uuid(),
|
|
8134
|
+
display: z41.string().meta({ description: "The record's display text." }),
|
|
8135
|
+
value: z41.unknown().meta({ description: "The value the record loses." })
|
|
8083
8136
|
}).strict()).max(UNIQUE_DISCARDED_LISTED).meta({ description: `The records that lose their value, at most ${UNIQUE_DISCARDED_LISTED}; \`total\` is the exact number.` })
|
|
8084
8137
|
}).strict().meta({
|
|
8085
8138
|
description: "The field became unique, or unique across a wider scope, and records share a value: the record created first keeps it and the others lose it."
|
|
8086
8139
|
}),
|
|
8087
|
-
|
|
8088
|
-
kind:
|
|
8140
|
+
z41.object({
|
|
8141
|
+
kind: z41.literal("required_left_empty"),
|
|
8089
8142
|
collection,
|
|
8090
8143
|
field,
|
|
8091
8144
|
records: count4.meta({ description: "Records left without a value." })
|
|
8092
8145
|
}).strict().meta({ description: "The field is required now and these records have no value and no default to fill in; they stay updatable in their other fields." }),
|
|
8093
|
-
|
|
8094
|
-
kind:
|
|
8146
|
+
z41.object({
|
|
8147
|
+
kind: z41.literal("references_cleared"),
|
|
8095
8148
|
collection,
|
|
8096
8149
|
field,
|
|
8097
8150
|
values: count4.meta({ description: "References removed." })
|
|
8098
8151
|
}).strict().meta({ description: "References that pointed at records deleted by this change are cleared." })
|
|
8099
8152
|
]).meta({ description: "One effect of a publish or restore on existing data. Effects that would change nothing are not listed." });
|
|
8100
|
-
var collectionsAccessChange =
|
|
8153
|
+
var collectionsAccessChange = z41.object({
|
|
8101
8154
|
collection,
|
|
8102
|
-
action:
|
|
8103
|
-
from:
|
|
8104
|
-
to:
|
|
8155
|
+
action: z41.enum(["read", "create", "update", "delete"]),
|
|
8156
|
+
from: z41.unknown().meta({ description: "The access before, as written in the document. `null` means nobody." }),
|
|
8157
|
+
to: z41.unknown().meta({ description: "The access after, as written in the document. `null` means nobody." })
|
|
8105
8158
|
}).meta({ description: "A change of the roles that may do one thing with the records of a collection. Information only; it does not need confirming." });
|
|
8106
|
-
var collectionsSchemaPreview =
|
|
8159
|
+
var collectionsSchemaPreview = z41.object({
|
|
8107
8160
|
from_version: schemaVersion2.nullable().meta({ description: "The version that is published now. Null before the first publish." }),
|
|
8108
8161
|
to_version: schemaVersion2.meta({ description: "The number the new version would get." }),
|
|
8109
|
-
valid:
|
|
8110
|
-
issues:
|
|
8111
|
-
effects:
|
|
8112
|
-
access_changes:
|
|
8162
|
+
valid: z41.boolean().meta({ description: "False when the draft has errors; it cannot be published and no effects are computed." }),
|
|
8163
|
+
issues: z41.array(collectionsIssue).meta({ description: "Everything found in the draft: errors that block publishing, warnings and information." }),
|
|
8164
|
+
effects: z41.array(collectionsEffect).meta({ description: "What would happen to existing data, computed against the data as it is now." }),
|
|
8165
|
+
access_changes: z41.array(collectionsAccessChange),
|
|
8113
8166
|
source_sha256: sha256.meta({
|
|
8114
8167
|
description: "The SHA-256 of the draft text this preview is for (UTF-8, lowercase hex). Send it as `source_sha256` when publishing to publish exactly this draft, also when there are no effects and so no token."
|
|
8115
8168
|
}),
|
|
8116
|
-
token:
|
|
8169
|
+
token: z41.string().nullable().meta({
|
|
8117
8170
|
description: "Stands for exactly this list of effects, on exactly this draft text and the version in force now: send it as `confirm` when publishing. If the draft was saved again, or the data or the version changed, the token no longer holds. Null when there are no effects, since publishing then needs no confirmation."
|
|
8118
8171
|
})
|
|
8119
8172
|
}).meta({ description: "The preview of publishing the draft: its problems, its effects on existing data and the token that confirms them." });
|
|
8120
|
-
var collectionsDraftResponse =
|
|
8121
|
-
source:
|
|
8173
|
+
var collectionsDraftResponse = z41.object({
|
|
8174
|
+
source: z41.string().meta({ description: "The document as text. The saved draft; without one, the published version's text; before the first publish, empty." }),
|
|
8122
8175
|
doc: collectionsDocument.nullable().meta({ description: "The document the source parses to. Null when the source is empty." }),
|
|
8123
8176
|
updated_at: timestamp2.nullable().meta({ description: "When the draft was saved. Null when no draft is saved." }),
|
|
8124
8177
|
updated_by: collectionActor.nullable().meta({ description: "Who saved the draft. Null when no draft is saved." }),
|
|
8125
|
-
issues:
|
|
8178
|
+
issues: z41.array(collectionsIssue).meta({ description: "Warnings and information about the document. A draft is saved only when it has no errors." })
|
|
8126
8179
|
}).meta({ description: "The draft of the schema document, or the current version when there is no draft." });
|
|
8127
|
-
var putCollectionsDraftRequest =
|
|
8180
|
+
var putCollectionsDraftRequest = z41.object({
|
|
8128
8181
|
// A character is at least one byte, so the cheap bound on characters holds for every source and rules out the long ones before they are measured.
|
|
8129
|
-
source:
|
|
8182
|
+
source: z41.string().max(COLLECTION_LIMITS.schemaSourceBytes).refine((text3) => utf8Length(text3) <= COLLECTION_LIMITS.schemaSourceBytes, {
|
|
8130
8183
|
message: `The source is longer than ${COLLECTION_LIMITS.schemaSourceBytes.toLocaleString("en-US")} bytes of UTF-8.`
|
|
8131
8184
|
}).meta({
|
|
8132
8185
|
description: `The whole document as YAML or JSON text, at most ${COLLECTION_LIMITS.schemaSourceBytes.toLocaleString("en-US")} bytes of UTF-8, which is fewer characters when some are not plain ASCII. It replaces the draft and is refused with the problems found if it is not valid.`
|
|
8133
8186
|
})
|
|
8134
8187
|
}).strict().meta({ description: "Replaces the draft with a whole document." });
|
|
8135
|
-
var collectionsPublishRequest =
|
|
8188
|
+
var collectionsPublishRequest = z41.object({
|
|
8136
8189
|
confirm: confirm.optional(),
|
|
8137
8190
|
source_sha256: sha256.meta({
|
|
8138
8191
|
description: "The `source_sha256` of the preview that was looked at. When it is sent and the saved draft is another text, because somebody saved it again since, nothing is published and the answer is `409 confirmation_required` with the current preview. Leave it out to publish whichever draft is saved; a token (`confirm`) already binds the draft it was made for."
|
|
@@ -8140,27 +8193,27 @@ var collectionsPublishRequest = z40.object({
|
|
|
8140
8193
|
}).strict().meta({
|
|
8141
8194
|
description: "Publishes the draft. The body may be empty when the preview lists no effects; otherwise it carries the preview's token as `confirm`. Send `source_sha256` as well to be sure that the draft published is the one that was looked at."
|
|
8142
8195
|
});
|
|
8143
|
-
var collectionsPublishResponse =
|
|
8196
|
+
var collectionsPublishResponse = z41.object({
|
|
8144
8197
|
version: schemaVersion2,
|
|
8145
8198
|
published_at: timestamp2,
|
|
8146
|
-
effects:
|
|
8147
|
-
issues:
|
|
8199
|
+
effects: z41.array(collectionsEffect).meta({ description: "What the publish did to existing data." }),
|
|
8200
|
+
issues: z41.array(collectionsIssue).meta({ description: "Warnings and information about the published document." })
|
|
8148
8201
|
}).meta({ description: "The version that was published and the effects it had." });
|
|
8149
|
-
var collectionsVersionSummary =
|
|
8202
|
+
var collectionsVersionSummary = z41.object({
|
|
8150
8203
|
version: schemaVersion2,
|
|
8151
8204
|
published_at: timestamp2,
|
|
8152
8205
|
published_by: collectionActor,
|
|
8153
|
-
effect_counts:
|
|
8206
|
+
effect_counts: z41.record(z41.string(), count4).meta({
|
|
8154
8207
|
description: "For each kind of effect the publish had, how many records or values it touched, by effect `kind`. Empty when it had none."
|
|
8155
8208
|
}),
|
|
8156
8209
|
restored_from: schemaVersion2.nullable().meta({ description: "The version this one restored. Null for an ordinary publish." }),
|
|
8157
|
-
restore_with_data:
|
|
8210
|
+
restore_with_data: z41.boolean().meta({
|
|
8158
8211
|
description: `Whether restoring this version can also put records back: its restore point is at most ${COLLECTION_LIMITS.restoreDays} days old, has not been purged, and it is not the current version.`
|
|
8159
8212
|
}),
|
|
8160
|
-
with_data:
|
|
8213
|
+
with_data: z41.boolean().meta({
|
|
8161
8214
|
description: "Whether this version came from a restore that also put records back. `false` for an ordinary publish and for a restore of the document alone."
|
|
8162
8215
|
}),
|
|
8163
|
-
reverted_totals:
|
|
8216
|
+
reverted_totals: z41.object({
|
|
8164
8217
|
changes: count4.meta({ description: "Changes made since the restore point that were reverted." }),
|
|
8165
8218
|
records_back: count4.meta({ description: "Deleted records that came back." }),
|
|
8166
8219
|
records_deleted: count4.meta({ description: "Records created since the restore point that were deleted." }),
|
|
@@ -8169,110 +8222,110 @@ var collectionsVersionSummary = z40.object({
|
|
|
8169
8222
|
description: "What putting the records back did, in all the collections together, so that the history of versions can say what came back. Null unless `with_data`."
|
|
8170
8223
|
})
|
|
8171
8224
|
}).meta({ description: "A published version of the schema document." });
|
|
8172
|
-
var collectionsVersionsResponse =
|
|
8225
|
+
var collectionsVersionsResponse = z41.object({
|
|
8173
8226
|
current: schemaVersion2.nullable().meta({ description: "The version in force. Null before the first publish." }),
|
|
8174
|
-
versions:
|
|
8227
|
+
versions: z41.array(collectionsVersionSummary).meta({ description: "Newest first." })
|
|
8175
8228
|
}).meta({ description: "The published versions of the schema document." });
|
|
8176
8229
|
var collectionsVersionResponse = collectionsVersionSummary.extend({
|
|
8177
|
-
source:
|
|
8230
|
+
source: z41.string().meta({ description: "The document as it was published, as text." }),
|
|
8178
8231
|
doc: collectionsDocument
|
|
8179
8232
|
}).meta({ description: "One published version with its document." });
|
|
8180
|
-
var collectionsRestorePreview =
|
|
8233
|
+
var collectionsRestorePreview = z41.object({
|
|
8181
8234
|
version: schemaVersion2.meta({ description: "The version that would be restored." }),
|
|
8182
|
-
with_data:
|
|
8183
|
-
data_possible:
|
|
8184
|
-
data_reason:
|
|
8235
|
+
with_data: z41.boolean().meta({ description: "Whether this preview is for a restore that also puts records back." }),
|
|
8236
|
+
data_possible: z41.boolean().meta({ description: "Whether records can be put back at all." }),
|
|
8237
|
+
data_reason: z41.enum(["ok", "expired", "purged", "current_version"]).meta({
|
|
8185
8238
|
description: `\`ok\`: records can be put back. \`expired\`: the restore point is more than ${COLLECTION_LIMITS.restoreDays} days old. \`purged\`: an owner removed the history it needs. \`current_version\`: this version is already in force.`
|
|
8186
8239
|
}),
|
|
8187
|
-
touched:
|
|
8188
|
-
selected:
|
|
8189
|
-
reverted:
|
|
8240
|
+
touched: z41.array(collection).meta({ description: "The collections that differ between the current version and this one; only these can get records back." }),
|
|
8241
|
+
selected: z41.array(collection).meta({ description: "The touched collections whose records would be put back. The caller may deselect some." }),
|
|
8242
|
+
reverted: z41.array(z41.object({
|
|
8190
8243
|
collection,
|
|
8191
8244
|
changes: count4.meta({ description: "Changes made since the restore point that would be reverted." }),
|
|
8192
8245
|
records_back: count4.meta({ description: "Deleted records that would come back." }),
|
|
8193
8246
|
records_deleted: count4.meta({ description: "Records created since the restore point that would be deleted." })
|
|
8194
8247
|
}).strict()).meta({ description: "What putting the records back would do, per selected collection." }),
|
|
8195
8248
|
robots_gone: count4.meta({ description: "Records of robots that were deleted since cannot come back; this is how many." }),
|
|
8196
|
-
effects:
|
|
8197
|
-
access_changes:
|
|
8198
|
-
issues:
|
|
8199
|
-
token:
|
|
8249
|
+
effects: z41.array(collectionsEffect).meta({ description: "The ordinary effects of publishing this version's document." }),
|
|
8250
|
+
access_changes: z41.array(collectionsAccessChange),
|
|
8251
|
+
issues: z41.array(collectionsIssue),
|
|
8252
|
+
token: z41.string().nullable().meta({
|
|
8200
8253
|
description: "Stands for exactly what this restore would do: send it as `confirm`. Null when the restore changes no data and needs no confirmation."
|
|
8201
8254
|
})
|
|
8202
8255
|
}).meta({ description: "The preview of restoring a version, with the token that confirms it." });
|
|
8203
|
-
var collectionsRestorePreviewQuery =
|
|
8204
|
-
data:
|
|
8205
|
-
collections:
|
|
8256
|
+
var collectionsRestorePreviewQuery = z41.object({
|
|
8257
|
+
data: z41.enum(["true", "false"]).meta({ description: "`true` also puts records back to their state at the version's restore point. Default `false`." }).optional(),
|
|
8258
|
+
collections: z41.string().min(1).meta({ description: "The touched collections to put records back in, separated by commas. Default: all of them." }).optional()
|
|
8206
8259
|
}).strict();
|
|
8207
|
-
var collectionsRestoreRequest =
|
|
8208
|
-
data:
|
|
8209
|
-
collections:
|
|
8260
|
+
var collectionsRestoreRequest = z41.object({
|
|
8261
|
+
data: z41.boolean().meta({ description: "Also put records back to their state at the restore point, in the touched collections. Default `false`." }).optional(),
|
|
8262
|
+
collections: z41.array(collectionKey).max(COLLECTION_LIMITS.collections).meta({ description: "Limits putting records back to these touched collections. Default: all of them." }).optional(),
|
|
8210
8263
|
confirm: confirm.optional()
|
|
8211
8264
|
}).strict().meta({ description: "Restores a version. Send the `data` and `collections` of the preview together with its token as `confirm`." });
|
|
8212
|
-
var collectionsRestoreResponse = collectionsPublishResponse.extend({ with_data:
|
|
8213
|
-
var collectionsPurgeRequest =
|
|
8265
|
+
var collectionsRestoreResponse = collectionsPublishResponse.extend({ with_data: z41.boolean().meta({ description: "Whether records were put back as well." }) }).meta({ description: "The version that the restore published and what it did." });
|
|
8266
|
+
var collectionsPurgeRequest = z41.object({
|
|
8214
8267
|
before: timestamp2.meta({
|
|
8215
8268
|
description: "Revisions older than this UTC time are removed. The current values of records stay. It must lie in the past (`400 validation_error`, field `before`, rule `not_in_past`), and a date older than every revision is refused as well (rule `nothing_to_purge`)."
|
|
8216
8269
|
}),
|
|
8217
8270
|
collection: collectionKey.meta({ description: "Purge only this collection. Default: the whole app." }).optional(),
|
|
8218
8271
|
confirm: purgeConfirm.optional()
|
|
8219
8272
|
}).strict().meta({ description: "Removes the history older than a date. The preview answers with a token; send it as `confirm` to purge." });
|
|
8220
|
-
var collectionsPurgePreview =
|
|
8273
|
+
var collectionsPurgePreview = z41.object({
|
|
8221
8274
|
before: timestamp2,
|
|
8222
8275
|
collection: collectionKey.nullable().meta({ description: "The collection the purge is limited to. Null for the whole app." }),
|
|
8223
8276
|
revisions: count4.meta({ description: "Revisions that would be removed." }),
|
|
8224
8277
|
bytes: count4.meta({ description: "Their size in bytes." }),
|
|
8225
|
-
restore_points_lost:
|
|
8278
|
+
restore_points_lost: z41.array(schemaVersion2).meta({
|
|
8226
8279
|
description: "Versions whose records could be put back today and could not once the history is gone, judged the way `restore_with_data` of the version list is. For the purge of one collection only the versions whose restore touches that collection are named."
|
|
8227
8280
|
}),
|
|
8228
8281
|
token: token.meta({ description: "Stands for exactly this purge: send it as `confirm` to carry it out." })
|
|
8229
8282
|
}).meta({ description: "What a purge would remove, with the token that confirms it." });
|
|
8230
|
-
var collectionsPurgeResponse =
|
|
8283
|
+
var collectionsPurgeResponse = z41.object({
|
|
8231
8284
|
revisions: count4.meta({ description: "Revisions removed." }),
|
|
8232
8285
|
bytes: count4.meta({ description: "Their size in bytes." }),
|
|
8233
8286
|
purged_at: timestamp2
|
|
8234
8287
|
}).meta({ description: "What a purge removed." });
|
|
8235
8288
|
|
|
8236
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8237
|
-
import { z as
|
|
8289
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-transfer.js
|
|
8290
|
+
import { z as z42 } from "zod";
|
|
8238
8291
|
var IMPORT_ERRORS_LISTED = 1e3;
|
|
8239
|
-
var count5 =
|
|
8240
|
-
var confirm2 =
|
|
8292
|
+
var count5 = z42.number().int().min(0);
|
|
8293
|
+
var confirm2 = z42.string().min(1).meta({
|
|
8241
8294
|
description: "The `token` of the preview of exactly this import. Without it the import route answers the preview and imports nothing. A token that is not the one of the current preview, because the data moved on or it belongs to another import, is answered `409 confirmation_required` with the current preview in `details.preview`. A file with errors is never imported: its preview comes back with `token: null`, whatever `confirm` says."
|
|
8242
8295
|
});
|
|
8243
|
-
var mappingTarget = collectionKey.or(
|
|
8296
|
+
var mappingTarget = collectionKey.or(z42.literal("")).meta({
|
|
8244
8297
|
description: "The key of the field the column is imported into, the literal `robot`, or an empty string to leave the column out."
|
|
8245
8298
|
});
|
|
8246
|
-
var importScope =
|
|
8299
|
+
var importScope = z42.object({
|
|
8247
8300
|
filter: collectionFilter.meta({ description: "Only records matching this filter can be deleted. The same filter object that record lists take as JSON text." }).optional(),
|
|
8248
|
-
robot_id:
|
|
8301
|
+
robot_id: z42.uuid().meta({ description: "Only records of this robot can be deleted." }).optional()
|
|
8249
8302
|
}).strict().refine((scope) => !(scope.filter !== void 0 && scope.robot_id !== void 0), {
|
|
8250
8303
|
message: "A scope is a filter or a robot, not both",
|
|
8251
8304
|
path: ["robot_id"]
|
|
8252
8305
|
}).meta({
|
|
8253
8306
|
description: "Limits which records `mirror` may delete: those matching a filter, or those of one robot. Name exactly one of them: an empty `scope` is `400 validation_error` (rule `empty`), and so is a `scope` on an import that is not a `mirror` (rule `needs_mirror`). Without a scope the whole collection is mirrored, every robot's records included. `robot_id` of the request does not narrow a mirror; use `scope.robot_id`."
|
|
8254
8307
|
});
|
|
8255
|
-
var collectionImportRequest =
|
|
8256
|
-
format:
|
|
8308
|
+
var collectionImportRequest = z42.object({
|
|
8309
|
+
format: z42.enum(["csv", "json"]).meta({
|
|
8257
8310
|
description: "`csv`: UTF-8 text with a header row, as in RFC 4180; a `json` field is written as JSON text in its cell. `json`: an array of objects, one per record."
|
|
8258
8311
|
}),
|
|
8259
|
-
content:
|
|
8312
|
+
content: z42.string().max(COLLECTION_LIMITS.importBytes).meta({
|
|
8260
8313
|
description: `The file as text, at most ${COLLECTION_LIMITS.importBytes.toLocaleString("en-US")} characters and as many bytes of UTF-8, and ${COLLECTION_LIMITS.importRows.toLocaleString("en-US")} rows (\`400 validation_error\`, rule \`too_large\` or \`too_many_rows\`; the latter is raised as soon as the 50,001st row is read, so it does not say how many there are). A byte order mark at the start of a JSON file is ignored.`
|
|
8261
8314
|
}),
|
|
8262
|
-
mapping:
|
|
8315
|
+
mapping: z42.record(z42.string(), mappingTarget).meta({
|
|
8263
8316
|
description: "Where each column of the file goes, by the column name in the header (for JSON, the property name). A column that is not listed is imported into the field with the same key. A column named after a system field (`id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `revision`, `robot_id`) is left out unless it is mapped."
|
|
8264
8317
|
}).optional(),
|
|
8265
|
-
references:
|
|
8318
|
+
references: z42.record(collectionKey, collectionKey).meta({
|
|
8266
8319
|
description: "For each reference field, by its key: the unique field of the target collection that the values in its column identify, for example `name`. A reference field that is not listed takes record ids."
|
|
8267
8320
|
}).optional(),
|
|
8268
8321
|
key: collectionKey.meta({
|
|
8269
8322
|
description: "A unique field that matches rows to existing records: a row whose value is found updates that record, the rest create records. Without a key every row creates a record. A collection with one record per robot is only updated, matched by robot, takes no key and no mirror, and two rows for one robot are an error."
|
|
8270
8323
|
}).optional(),
|
|
8271
|
-
mode:
|
|
8324
|
+
mode: z42.enum(["upsert", "mirror"]).meta({
|
|
8272
8325
|
description: "`upsert` (the default) creates and updates records. `mirror` also deletes the records of `scope` that are not in the file, and needs `key`. A mirror deletes at most 50,000 records, a file without rows is refused, and a deletion that a `prevent` reference blocks fails the whole import. A collection with one record per robot takes neither a `key` nor a `mirror` (`400 validation_error`, rule `one_per_robot_is_automatic`)."
|
|
8273
8326
|
}).optional(),
|
|
8274
8327
|
scope: importScope.optional(),
|
|
8275
|
-
robot_id:
|
|
8328
|
+
robot_id: z42.uuid().meta({
|
|
8276
8329
|
description: "The robot every row belongs to, in a collection that belongs to robots, when the file has no `robot` column; sent together with a `robot` column it is refused (rule `robot_column_present`). It says which robot the rows are for and does not narrow a `mirror`: that is `scope.robot_id`."
|
|
8277
8330
|
}).optional(),
|
|
8278
8331
|
confirm: confirm2.optional()
|
|
@@ -8280,77 +8333,77 @@ var collectionImportRequest = z41.object({
|
|
|
8280
8333
|
message: 'Mode "mirror" needs a key: records are matched to the file by it',
|
|
8281
8334
|
path: ["key"]
|
|
8282
8335
|
}).meta({ description: "Imports a file of records into a collection, all or nothing." });
|
|
8283
|
-
var importError =
|
|
8336
|
+
var importError = z42.object({
|
|
8284
8337
|
row: count5.meta({
|
|
8285
8338
|
description: "The row the problem is in, counted from 1 over the records of the file, so the header of a CSV is not counted. 0 marks a problem with the file as a whole, and a deletion of a `mirror` that a `prevent` reference blocks (the column is then the key column and the value the key of the record)."
|
|
8286
8339
|
}),
|
|
8287
|
-
column:
|
|
8288
|
-
value:
|
|
8289
|
-
reason:
|
|
8340
|
+
column: z42.string().max(COLLECTION_LIMITS.importErrorText).meta({ description: "The column as named in the file. Empty when the problem is not about one column. Cut to 200 characters, an ellipsis included." }),
|
|
8341
|
+
value: z42.string().max(COLLECTION_LIMITS.importErrorText).meta({ description: "The value as found in the file, cut to 200 characters with an ellipsis (`\u2026`) at the end when it was longer." }),
|
|
8342
|
+
reason: z42.string().min(1).meta({ description: "What is wrong with it, in words." })
|
|
8290
8343
|
}).meta({ description: "A row, column and value that stop the import, with the reason." });
|
|
8291
|
-
var collectionImportPreview =
|
|
8292
|
-
counts:
|
|
8344
|
+
var collectionImportPreview = z42.object({
|
|
8345
|
+
counts: z42.object({
|
|
8293
8346
|
unchanged: count5.meta({ description: "Rows that match a record that already has these values." }),
|
|
8294
8347
|
new: count5.meta({ description: "Records that would be created." }),
|
|
8295
8348
|
updated: count5.meta({ description: "Records that would change." }),
|
|
8296
8349
|
deleted: count5.meta({ description: "Records that `mirror` would delete." }),
|
|
8297
8350
|
errors: count5.meta({ description: "Problems found in the file. The same number as `errors_total`." })
|
|
8298
8351
|
}).meta({ description: "What the import would do, counted." }),
|
|
8299
|
-
errors:
|
|
8352
|
+
errors: z42.array(importError).max(IMPORT_ERRORS_LISTED).meta({
|
|
8300
8353
|
description: `The problems found, in file order, at most ${IMPORT_ERRORS_LISTED.toLocaleString("en-US")}; \`errors_total\` is the exact number.`
|
|
8301
8354
|
}),
|
|
8302
8355
|
errors_total: count5.meta({ description: "The exact number of problems found." }),
|
|
8303
|
-
mirror_scope:
|
|
8356
|
+
mirror_scope: z42.enum(["collection", "filter", "robot"]).nullable().meta({
|
|
8304
8357
|
description: "Where `mirror` would delete records: `collection` is every record of the collection, which the preview should say prominently; `filter` and `robot` are the scope that was sent. Null when the mode is not `mirror`."
|
|
8305
8358
|
}),
|
|
8306
|
-
warnings:
|
|
8359
|
+
warnings: z42.array(z42.enum(["plan_limit"])).meta({
|
|
8307
8360
|
description: "`plan_limit`: importing the file would take the organization over a limit of its plan, so the import itself would be refused."
|
|
8308
8361
|
}),
|
|
8309
|
-
token:
|
|
8362
|
+
token: z42.string().min(1).nullable().meta({
|
|
8310
8363
|
description: "Stands for exactly this import: send it as `confirm` to carry it out. Null while the file has errors. It is not single-use; see the note on the import routes."
|
|
8311
8364
|
})
|
|
8312
8365
|
}).meta({ description: "The preview of an import: what it would do, the problems that stop it and the token that confirms it." });
|
|
8313
|
-
var collectionImportResult =
|
|
8366
|
+
var collectionImportResult = z42.object({
|
|
8314
8367
|
created: count5.meta({ description: "Records created." }),
|
|
8315
8368
|
updated: count5.meta({ description: "Records changed." }),
|
|
8316
8369
|
deleted: count5.meta({ description: "Records deleted by `mirror`." }),
|
|
8317
8370
|
unchanged: count5.meta({ description: "Rows that matched a record that already had these values." })
|
|
8318
8371
|
}).meta({ description: "What an import did." });
|
|
8319
|
-
var collectionExportQuery =
|
|
8320
|
-
format:
|
|
8372
|
+
var collectionExportQuery = z42.object({
|
|
8373
|
+
format: z42.enum(["csv", "json"]).meta({ description: "`csv`: UTF-8 text with a header row. `json`: an array of objects." }),
|
|
8321
8374
|
// The same four parameters, in the same words, as the record list they narrow down.
|
|
8322
8375
|
...collectionRecordListQuery.pick({ filter: true, search: true, sort: true, robot: true }).shape,
|
|
8323
|
-
fields:
|
|
8324
|
-
references:
|
|
8376
|
+
fields: z42.string().min(1).meta({ description: "The fields to export by key, separated by commas, in the order given. Default: all fields, in the order of the schema." }).optional(),
|
|
8377
|
+
references: z42.string().min(1).meta({
|
|
8325
8378
|
description: "How reference fields are written: `id` (the default) or the key of a unique field of the target collection, such as `name`, so that the file can be imported again. A reference field in the file whose target collection has no such unique field is `400 validation_error` (field `references`, rule `not_unique`); with no reference field among the columns the value is ignored."
|
|
8326
8379
|
}).optional(),
|
|
8327
|
-
system:
|
|
8380
|
+
system: z42.enum(["true", "false"]).meta({
|
|
8328
8381
|
description: "`true` adds the system fields after the fields: `robot_id` in a collection that belongs to robots, then `id`, `created_at`, `created_by`, `updated_at`, `updated_by` and `revision`. `created_by` and `updated_by` are the actors' labels. Default `false`."
|
|
8329
8382
|
}).optional()
|
|
8330
8383
|
}).strict();
|
|
8331
8384
|
|
|
8332
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8333
|
-
import { z as
|
|
8334
|
-
var text2 = (max) =>
|
|
8335
|
-
var email =
|
|
8336
|
-
var controllerRegisterAddress =
|
|
8385
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/controller-register.js
|
|
8386
|
+
import { z as z43 } from "zod";
|
|
8387
|
+
var text2 = (max) => z43.string().regex(/^\P{Cc}*$/u).trim().min(1).max(max);
|
|
8388
|
+
var email = z43.string().regex(/^\P{Cc}*$/u).trim().email().max(320);
|
|
8389
|
+
var controllerRegisterAddress = z43.object({
|
|
8337
8390
|
line1: text2(200),
|
|
8338
8391
|
line2: text2(200).nullable().default(null),
|
|
8339
8392
|
postalCode: text2(32),
|
|
8340
8393
|
city: text2(120),
|
|
8341
|
-
country:
|
|
8394
|
+
country: z43.string().regex(/^\P{Cc}*$/u).trim().regex(/^[A-Z]{2}$/)
|
|
8342
8395
|
}).strict();
|
|
8343
|
-
var controllerRegisterPrivacyContact =
|
|
8396
|
+
var controllerRegisterPrivacyContact = z43.object({
|
|
8344
8397
|
name: text2(200),
|
|
8345
8398
|
email,
|
|
8346
|
-
role:
|
|
8399
|
+
role: z43.enum(["general", "appointed_dpo"])
|
|
8347
8400
|
}).strict();
|
|
8348
|
-
var controllerRegisterRepresentative =
|
|
8401
|
+
var controllerRegisterRepresentative = z43.object({
|
|
8349
8402
|
name: text2(200),
|
|
8350
8403
|
email,
|
|
8351
8404
|
address: text2(500)
|
|
8352
8405
|
}).strict();
|
|
8353
|
-
var controllerRegisterWrite =
|
|
8406
|
+
var controllerRegisterWrite = z43.object({
|
|
8354
8407
|
legalName: text2(200),
|
|
8355
8408
|
address: controllerRegisterAddress,
|
|
8356
8409
|
privacyContact: controllerRegisterPrivacyContact.nullable(),
|
|
@@ -8360,19 +8413,19 @@ var controllerRegisterWrite = z42.object({
|
|
|
8360
8413
|
var controllerRegisterOrgRecord = controllerRegisterWrite.extend({
|
|
8361
8414
|
legalName: text2(200).nullable(),
|
|
8362
8415
|
address: controllerRegisterAddress.nullable(),
|
|
8363
|
-
updatedAt:
|
|
8364
|
-
updatedByKind:
|
|
8365
|
-
updatedById:
|
|
8416
|
+
updatedAt: z43.iso.datetime(),
|
|
8417
|
+
updatedByKind: z43.enum(["owner", "operator"]),
|
|
8418
|
+
updatedById: z43.uuid()
|
|
8366
8419
|
}).strict();
|
|
8367
|
-
var controllerRegisterOrgResponse =
|
|
8368
|
-
orgId:
|
|
8420
|
+
var controllerRegisterOrgResponse = z43.object({
|
|
8421
|
+
orgId: z43.uuid(),
|
|
8369
8422
|
details: controllerRegisterOrgRecord.nullable()
|
|
8370
8423
|
}).strict();
|
|
8371
8424
|
|
|
8372
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8373
|
-
import { z as
|
|
8425
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/billing.js
|
|
8426
|
+
import { z as z44 } from "zod";
|
|
8374
8427
|
|
|
8375
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8428
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/iana-time-zones.js
|
|
8376
8429
|
var ianaTimeZones = [
|
|
8377
8430
|
"UTC",
|
|
8378
8431
|
"Etc/UTC",
|
|
@@ -8797,8 +8850,8 @@ var ianaTimeZones = [
|
|
|
8797
8850
|
"Pacific/Wallis"
|
|
8798
8851
|
];
|
|
8799
8852
|
|
|
8800
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8801
|
-
var countryCode =
|
|
8853
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/billing.js
|
|
8854
|
+
var countryCode = z44.string().regex(/^[A-Z]{2}$/);
|
|
8802
8855
|
var EU_COUNTRIES = [
|
|
8803
8856
|
"AT",
|
|
8804
8857
|
"BE",
|
|
@@ -8832,52 +8885,52 @@ var SELLER_COUNTRY = "DE";
|
|
|
8832
8885
|
function isEuCountry(country) {
|
|
8833
8886
|
return EU_COUNTRIES.includes(country);
|
|
8834
8887
|
}
|
|
8835
|
-
var payerKind =
|
|
8836
|
-
var billingCycle =
|
|
8837
|
-
var vatTreatment =
|
|
8838
|
-
var payerRefusalRule =
|
|
8839
|
-
var viesPendingReason =
|
|
8840
|
-
var viesOutage =
|
|
8841
|
-
scope:
|
|
8888
|
+
var payerKind = z44.enum(["company", "person"]);
|
|
8889
|
+
var billingCycle = z44.enum(["monthly", "yearly"]);
|
|
8890
|
+
var vatTreatment = z44.enum(["de_standard", "reverse_charge", "outside_eu"]);
|
|
8891
|
+
var payerRefusalRule = z44.enum(["company_required", "vat_id_required", "vat_id_invalid"]);
|
|
8892
|
+
var viesPendingReason = z44.enum(["vies_unavailable", "vies_unverified", "vies_identifier_missing"]);
|
|
8893
|
+
var viesOutage = z44.object({
|
|
8894
|
+
scope: z44.enum(["member_state", "vies"]).meta({
|
|
8842
8895
|
description: "`member_state`: the VAT register of `country` does not answer VIES. `vies`: VIES itself does not answer."
|
|
8843
8896
|
}),
|
|
8844
8897
|
country: countryCode.meta({ description: "The billing address's country whose VAT ID was asked for. Greece is `GR`, never VIES's `EL`." })
|
|
8845
8898
|
}).strict();
|
|
8846
8899
|
function viesPending(shape) {
|
|
8847
|
-
return
|
|
8848
|
-
|
|
8849
|
-
|
|
8900
|
+
return z44.discriminatedUnion("reason", [
|
|
8901
|
+
z44.object({ ...shape, reason: z44.literal("vies_unavailable"), vies_outage: viesOutage }).strict(),
|
|
8902
|
+
z44.object({ ...shape, reason: viesPendingReason.exclude(["vies_unavailable"]) }).strict()
|
|
8850
8903
|
]);
|
|
8851
8904
|
}
|
|
8852
|
-
var vatDecision =
|
|
8853
|
-
|
|
8854
|
-
viesPending({ state:
|
|
8855
|
-
|
|
8905
|
+
var vatDecision = z44.discriminatedUnion("state", [
|
|
8906
|
+
z44.object({ state: z44.literal("eligible"), treatment: vatTreatment, rate_percent: z44.number().int().min(0).max(100) }).strict(),
|
|
8907
|
+
viesPending({ state: z44.literal("pending") }),
|
|
8908
|
+
z44.object({ state: z44.literal("refused"), rule: payerRefusalRule }).strict()
|
|
8856
8909
|
]);
|
|
8857
|
-
var billingAddress =
|
|
8858
|
-
line1:
|
|
8859
|
-
line2:
|
|
8860
|
-
postal_code:
|
|
8861
|
-
city:
|
|
8910
|
+
var billingAddress = z44.object({
|
|
8911
|
+
line1: z44.string().trim().min(1).max(200).meta({ description: "Street and number, or the first address line." }),
|
|
8912
|
+
line2: z44.string().trim().max(200).nullable().meta({ description: "A second address line, or `null` when there is none." }),
|
|
8913
|
+
postal_code: z44.string().trim().min(1).max(20).meta({ description: "Postal or ZIP code." }),
|
|
8914
|
+
city: z44.string().trim().min(1).max(100).meta({ description: "City or town." }),
|
|
8862
8915
|
country: countryCode.meta({ description: "The billing country, used for purchase eligibility and VAT." }),
|
|
8863
|
-
state:
|
|
8916
|
+
state: z44.string().trim().min(1).max(100).optional().meta({ description: "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it." })
|
|
8864
8917
|
}).strict();
|
|
8865
|
-
var billingDetails =
|
|
8866
|
-
|
|
8867
|
-
kind:
|
|
8868
|
-
company_name:
|
|
8869
|
-
vat_id:
|
|
8918
|
+
var billingDetails = z44.discriminatedUnion("kind", [
|
|
8919
|
+
z44.object({
|
|
8920
|
+
kind: z44.literal("company").meta({ description: "Billed as a company." }),
|
|
8921
|
+
company_name: z44.string().trim().min(1).max(200).meta({ description: "The company's legal name, printed on the invoice." }),
|
|
8922
|
+
vat_id: z44.string().trim().max(20).nullable().meta({
|
|
8870
8923
|
description: "The company's VAT ID, or `null` for none. Required for a new purchase in another EU country; direct VIES must confirm it with an identifier."
|
|
8871
8924
|
}),
|
|
8872
|
-
tax_id:
|
|
8925
|
+
tax_id: z44.string().trim().max(100).nullable().optional().meta({ description: "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it." }),
|
|
8873
8926
|
address: billingAddress.meta({ description: "The billing address." }),
|
|
8874
|
-
invoice_email:
|
|
8927
|
+
invoice_email: z44.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
8875
8928
|
}).strict().meta({ description: "A company: name and an optional VAT ID, never 'full name'." }),
|
|
8876
|
-
|
|
8877
|
-
kind:
|
|
8878
|
-
full_name:
|
|
8929
|
+
z44.object({
|
|
8930
|
+
kind: z44.literal("person").meta({ description: "Billed as a person." }),
|
|
8931
|
+
full_name: z44.string().trim().min(1).max(200).meta({ description: "The person's full name, printed on the invoice." }),
|
|
8879
8932
|
address: billingAddress.meta({ description: "The billing address." }),
|
|
8880
|
-
invoice_email:
|
|
8933
|
+
invoice_email: z44.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
8881
8934
|
}).strict().meta({ description: "A person: a full name, never a VAT ID \u2014 only a company can be VAT-registered." })
|
|
8882
8935
|
]);
|
|
8883
8936
|
var purchaseBillingDetails = billingDetails.options[0].superRefine((payer, ctx) => {
|
|
@@ -8892,55 +8945,55 @@ var purchaseBillingDetails = billingDetails.options[0].superRefine((payer, ctx)
|
|
|
8892
8945
|
ctx.addIssue({ code: "custom", path: ["address", "state"], message: "us_state_required" });
|
|
8893
8946
|
}
|
|
8894
8947
|
}).meta({ description: "New company purchase. Other EU countries require VAT ID; non-EU requires Tax ID; US requires two-letter state. Cloud additionally checks the versioned public-email policy and current VIES evidence." });
|
|
8895
|
-
var purchaseOperation =
|
|
8948
|
+
var purchaseOperation = z44.enum(["checkout", "paid_change", "invoice_payment", "payment_method_invoice", "mandate_setup"]);
|
|
8896
8949
|
var chargeOperation = purchaseOperation.exclude(["mandate_setup"]);
|
|
8897
|
-
var checkoutRequest =
|
|
8950
|
+
var checkoutRequest = z44.object({
|
|
8898
8951
|
operation_key: purchaseOperationKey,
|
|
8899
|
-
plan:
|
|
8952
|
+
plan: z44.enum(["plus", "pro"]).meta({ description: "The paid plan to buy; Basic requires no checkout." }),
|
|
8900
8953
|
cycle: billingCycle.meta({ description: "Monthly, or yearly at 15 percent off." }),
|
|
8901
8954
|
addons: orgAddons.partial().strict().optional().meta({ description: "Add-on units to buy; Pro only. Cloud refuses add-ons on Plus." }),
|
|
8902
8955
|
billing: purchaseBillingDetails.meta({ description: "The company buying the plan. Country requirements, current VIES and the email policy must pass before charging." }),
|
|
8903
|
-
accept_terms:
|
|
8956
|
+
accept_terms: z44.literal(true).optional().meta({ description: "Deprecated draft input. It is not evidence of a displayed C.4 declaration and never confirms an order." })
|
|
8904
8957
|
}).strict();
|
|
8905
|
-
var purchaseCents =
|
|
8906
|
-
var purchaseQuote =
|
|
8907
|
-
currency:
|
|
8958
|
+
var purchaseCents = z44.number().int().nonnegative();
|
|
8959
|
+
var purchaseQuote = z44.object({
|
|
8960
|
+
currency: z44.literal("eur").meta({ description: "Every new quote is in EUR." }),
|
|
8908
8961
|
net_cents: purchaseCents.meta({ description: "Current charge excluding VAT, in cents." }),
|
|
8909
8962
|
vat_cents: purchaseCents.meta({ description: "VAT on the current charge, in cents." }),
|
|
8910
8963
|
gross_cents: purchaseCents.meta({ description: "Total to confirm, including VAT, in cents." }),
|
|
8911
|
-
rate_percent:
|
|
8964
|
+
rate_percent: z44.number().int().min(0).max(100).meta({ description: "VAT rate in whole percent." })
|
|
8912
8965
|
}).strict();
|
|
8913
8966
|
var quoteIdentity = {
|
|
8914
|
-
quote_revision:
|
|
8915
|
-
buyer_fingerprint:
|
|
8967
|
+
quote_revision: z44.string().trim().min(1).max(200).meta({ description: "Opaque revision of the displayed quote; echo it when confirming." }),
|
|
8968
|
+
buyer_fingerprint: z44.string().trim().min(1).max(200).meta({ description: "Opaque revision of buyer details and email policy; never full VIES evidence." })
|
|
8916
8969
|
};
|
|
8917
|
-
var billingDecisionDisplayRequest =
|
|
8970
|
+
var billingDecisionDisplayRequest = z44.object({
|
|
8918
8971
|
operation_key: purchaseOperationKey,
|
|
8919
|
-
operation:
|
|
8972
|
+
operation: z44.enum(["checkout", "paid_change"])
|
|
8920
8973
|
}).strict();
|
|
8921
8974
|
var selectionBase = {
|
|
8922
|
-
plan:
|
|
8975
|
+
plan: z44.enum(["basic", "plus", "pro"]),
|
|
8923
8976
|
cycle: billingCycle,
|
|
8924
8977
|
addons: orgAddons
|
|
8925
8978
|
};
|
|
8926
|
-
var purchaseSelection =
|
|
8927
|
-
var planChangeSelection =
|
|
8928
|
-
var addonLine =
|
|
8979
|
+
var purchaseSelection = z44.object(selectionBase).strict();
|
|
8980
|
+
var planChangeSelection = z44.object({ ...selectionBase, keep: planChangeKeep.nullable() }).strict();
|
|
8981
|
+
var addonLine = z44.object({ addon: addonKey, quantity: z44.number().int().positive(), net_cents: purchaseCents }).strict();
|
|
8929
8982
|
var treatmentRules = [
|
|
8930
8983
|
{ if: { properties: { vat_treatment: { const: "de_standard" } }, required: ["vat_treatment"] }, then: { properties: { quote: { properties: { rate_percent: { const: 19 } } } } } },
|
|
8931
8984
|
{ if: { properties: { vat_treatment: { const: "reverse_charge" } }, required: ["vat_treatment"] }, then: { properties: { quote: { properties: { rate_percent: { const: 0 }, vat_cents: { const: 0 } } }, period_vat_cents: { const: 0 }, vat_treatment_line: { const: "Reverse charge \u2014 VAT payable by the recipient" } } } },
|
|
8932
8985
|
{ if: { properties: { vat_treatment: { const: "outside_eu" } }, required: ["vat_treatment"] }, then: { properties: { quote: { properties: { rate_percent: { const: 0 }, vat_cents: { const: 0 } } }, period_vat_cents: { const: 0 }, vat_treatment_line: { const: "Not taxable in Germany" } } } }
|
|
8933
8986
|
];
|
|
8934
|
-
var billingDecisionAmounts =
|
|
8935
|
-
currency:
|
|
8987
|
+
var billingDecisionAmounts = z44.object({
|
|
8988
|
+
currency: z44.literal("eur"),
|
|
8936
8989
|
quote: purchaseQuote,
|
|
8937
8990
|
plan_net_cents: purchaseCents,
|
|
8938
|
-
addon_lines:
|
|
8991
|
+
addon_lines: z44.array(addonLine),
|
|
8939
8992
|
period_net_cents: purchaseCents,
|
|
8940
8993
|
period_vat_cents: purchaseCents,
|
|
8941
8994
|
period_gross_cents: purchaseCents,
|
|
8942
8995
|
vat_treatment: vatTreatment,
|
|
8943
|
-
vat_treatment_line:
|
|
8996
|
+
vat_treatment_line: z44.string().min(1),
|
|
8944
8997
|
due_today_gross_cents: purchaseCents,
|
|
8945
8998
|
prorated_net_cents: purchaseCents.nullable(),
|
|
8946
8999
|
renewal_net_cents: purchaseCents
|
|
@@ -8961,8 +9014,8 @@ var billingDecisionAmounts = z43.object({
|
|
|
8961
9014
|
invalid("vat_treatment", "Zero-rated treatment, rate, VAT and line must agree.");
|
|
8962
9015
|
}
|
|
8963
9016
|
}).meta({ allOf: treatmentRules });
|
|
8964
|
-
var utcInstant =
|
|
8965
|
-
var ianaTimeZone =
|
|
9017
|
+
var utcInstant = z44.iso.datetime().regex(/Z$/);
|
|
9018
|
+
var ianaTimeZone = z44.enum(ianaTimeZones);
|
|
8966
9019
|
function localDate(instant, timeZone) {
|
|
8967
9020
|
try {
|
|
8968
9021
|
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(instant));
|
|
@@ -8972,16 +9025,16 @@ function localDate(instant, timeZone) {
|
|
|
8972
9025
|
return null;
|
|
8973
9026
|
}
|
|
8974
9027
|
}
|
|
8975
|
-
var existingBillingPeriod =
|
|
8976
|
-
anchor:
|
|
9028
|
+
var existingBillingPeriod = z44.object({
|
|
9029
|
+
anchor: z44.literal("existing_period"),
|
|
8977
9030
|
display_time_zone: ianaTimeZone,
|
|
8978
|
-
starts_on:
|
|
9031
|
+
starts_on: z44.iso.date(),
|
|
8979
9032
|
starts_at: utcInstant.nullable(),
|
|
8980
9033
|
current_period_ends_at: utcInstant,
|
|
8981
9034
|
renews_at: utcInstant,
|
|
8982
|
-
effective:
|
|
8983
|
-
|
|
8984
|
-
|
|
9035
|
+
effective: z44.discriminatedUnion("mode", [
|
|
9036
|
+
z44.object({ mode: z44.literal("on_confirmation"), quoted_as_of_at: utcInstant, local_date: z44.iso.date() }).strict(),
|
|
9037
|
+
z44.object({ mode: z44.literal("scheduled"), at: utcInstant, at_period_end: z44.boolean() }).strict()
|
|
8985
9038
|
])
|
|
8986
9039
|
}).strict().superRefine((period, ctx) => {
|
|
8987
9040
|
if (period.starts_at && localDate(period.starts_at, period.display_time_zone) !== period.starts_on)
|
|
@@ -8991,21 +9044,21 @@ var existingBillingPeriod = z43.object({
|
|
|
8991
9044
|
if (period.effective.mode === "on_confirmation" && localDate(period.effective.quoted_as_of_at, period.display_time_zone) !== period.effective.local_date)
|
|
8992
9045
|
ctx.addIssue({ code: "custom", path: ["effective", "local_date"], message: "Quoted local date must match the display zone." });
|
|
8993
9046
|
});
|
|
8994
|
-
var firstPaymentPeriod =
|
|
8995
|
-
|
|
8996
|
-
anchor:
|
|
8997
|
-
cycle:
|
|
8998
|
-
start_statement:
|
|
8999
|
-
period_statement:
|
|
9047
|
+
var firstPaymentPeriod = z44.discriminatedUnion("cycle", [
|
|
9048
|
+
z44.strictObject({
|
|
9049
|
+
anchor: z44.literal("on_first_successful_payment"),
|
|
9050
|
+
cycle: z44.literal("monthly"),
|
|
9051
|
+
start_statement: z44.literal("Starts when your first payment succeeds"),
|
|
9052
|
+
period_statement: z44.literal("First billing period: one full month from successful payment; renews at the end of that period")
|
|
9000
9053
|
}),
|
|
9001
|
-
|
|
9002
|
-
anchor:
|
|
9003
|
-
cycle:
|
|
9004
|
-
start_statement:
|
|
9005
|
-
period_statement:
|
|
9054
|
+
z44.strictObject({
|
|
9055
|
+
anchor: z44.literal("on_first_successful_payment"),
|
|
9056
|
+
cycle: z44.literal("yearly"),
|
|
9057
|
+
start_statement: z44.literal("Starts when your first payment succeeds"),
|
|
9058
|
+
period_statement: z44.literal("First billing period: one full year from successful payment; renews at the end of that period")
|
|
9006
9059
|
})
|
|
9007
9060
|
]);
|
|
9008
|
-
var billingDecisionPeriod =
|
|
9061
|
+
var billingDecisionPeriod = z44.union([existingBillingPeriod, firstPaymentPeriod]);
|
|
9009
9062
|
function formatEur(cents3) {
|
|
9010
9063
|
if (!Number.isSafeInteger(cents3))
|
|
9011
9064
|
throw new Error(`formatEur: ${cents3} is not a whole number of cents`);
|
|
@@ -9097,10 +9150,10 @@ var labelRules = {
|
|
|
9097
9150
|
"C4-1168-cancel": { const: "Cancel at period end" },
|
|
9098
9151
|
"C4-1168-keep-basic": { const: "Delete the rest and stay on Basic" }
|
|
9099
9152
|
};
|
|
9100
|
-
var declaration =
|
|
9101
|
-
text_id:
|
|
9102
|
-
text:
|
|
9103
|
-
action_label:
|
|
9153
|
+
var declaration = z44.object({
|
|
9154
|
+
text_id: z44.enum(C4_TEXT_IDS).meta({ description: "The approved sentence this display shows, one per action." }),
|
|
9155
|
+
text: z44.string().min(1).regex(/^By selecting “/).meta({ description: "The consent sentence shown directly above the button, naming the button." }),
|
|
9156
|
+
action_label: z44.string().min(1).meta({ description: "The label of the one button that confirms this decision." }),
|
|
9104
9157
|
...legalLinks
|
|
9105
9158
|
}).strict().superRefine(separateLegalLinks).meta({
|
|
9106
9159
|
allOf: C4_TEXT_IDS.map((textId) => ({
|
|
@@ -9108,32 +9161,32 @@ var declaration = z43.object({
|
|
|
9108
9161
|
then: { properties: { action_label: labelRules[textId] } }
|
|
9109
9162
|
}))
|
|
9110
9163
|
});
|
|
9111
|
-
var legacyDeclaration =
|
|
9112
|
-
text_id:
|
|
9113
|
-
text:
|
|
9164
|
+
var legacyDeclaration = z44.object({
|
|
9165
|
+
text_id: z44.literal(LEGACY_C4_TEXT_ID),
|
|
9166
|
+
text: z44.string().min(1),
|
|
9114
9167
|
...legalLinks
|
|
9115
9168
|
}).strict().superRefine(separateLegalLinks);
|
|
9116
|
-
var snapshotBase =
|
|
9117
|
-
snapshot_id:
|
|
9118
|
-
decision_id:
|
|
9169
|
+
var snapshotBase = z44.object({
|
|
9170
|
+
snapshot_id: z44.uuid(),
|
|
9171
|
+
decision_id: z44.uuid(),
|
|
9119
9172
|
operation_key: purchaseOperationKey,
|
|
9120
|
-
owner_id:
|
|
9121
|
-
organization_id:
|
|
9122
|
-
organization_name:
|
|
9173
|
+
owner_id: z44.uuid(),
|
|
9174
|
+
organization_id: z44.uuid(),
|
|
9175
|
+
organization_name: z44.string().min(1),
|
|
9123
9176
|
...quoteIdentity,
|
|
9124
9177
|
amounts: billingDecisionAmounts,
|
|
9125
9178
|
period: billingDecisionPeriod,
|
|
9126
|
-
future_price_replacement:
|
|
9179
|
+
future_price_replacement: z44.strictObject({ agreement_id: z44.uuid(), text: z44.string().min(1).regex(/\S/) }).nullable(),
|
|
9127
9180
|
declaration,
|
|
9128
9181
|
expires_at: utcInstant
|
|
9129
9182
|
}).strict();
|
|
9130
9183
|
var snapshotVariants = [
|
|
9131
|
-
snapshotBase.extend({ decision_kind:
|
|
9132
|
-
snapshotBase.extend({ decision_kind:
|
|
9133
|
-
snapshotBase.extend({ decision_kind:
|
|
9184
|
+
snapshotBase.extend({ decision_kind: z44.literal("checkout"), selection: purchaseSelection }).strict(),
|
|
9185
|
+
snapshotBase.extend({ decision_kind: z44.literal("paid_change"), selection: purchaseSelection, period: existingBillingPeriod }).strict(),
|
|
9186
|
+
snapshotBase.extend({ decision_kind: z44.literal("plan_change"), selection: planChangeSelection, period: existingBillingPeriod }).strict()
|
|
9134
9187
|
];
|
|
9135
|
-
var storedDeclaration =
|
|
9136
|
-
var storedSnapshotVariants =
|
|
9188
|
+
var storedDeclaration = z44.union([declaration, legacyDeclaration]);
|
|
9189
|
+
var storedSnapshotVariants = z44.discriminatedUnion("decision_kind", [
|
|
9137
9190
|
snapshotVariants[0].extend({ declaration: storedDeclaration }).strict(),
|
|
9138
9191
|
snapshotVariants[1].extend({ declaration: storedDeclaration }).strict(),
|
|
9139
9192
|
snapshotVariants[2].extend({ declaration: storedDeclaration }).strict()
|
|
@@ -9185,9 +9238,9 @@ var snapshotRules = { allOf: ["monthly", "yearly"].map((cycle) => ({
|
|
|
9185
9238
|
if: { properties: { period: { properties: { anchor: { const: "on_first_successful_payment" }, cycle: { const: cycle } }, required: ["anchor", "cycle"] } }, required: ["period"] },
|
|
9186
9239
|
then: { properties: { selection: { properties: { cycle: { const: cycle } }, required: ["cycle"] } }, required: ["selection"] }
|
|
9187
9240
|
})) };
|
|
9188
|
-
var billingDecisionSnapshot =
|
|
9241
|
+
var billingDecisionSnapshot = z44.discriminatedUnion("decision_kind", snapshotVariants).superRefine(refineSnapshot).meta(snapshotRules);
|
|
9189
9242
|
var storedBillingDecisionSnapshot = storedSnapshotVariants.superRefine(refineSnapshot).meta(snapshotRules);
|
|
9190
|
-
var billingDecisionDisplayResponse =
|
|
9243
|
+
var billingDecisionDisplayResponse = z44.object({
|
|
9191
9244
|
confirmation_proof: confirmationProof,
|
|
9192
9245
|
expires_at: utcInstant,
|
|
9193
9246
|
snapshot: billingDecisionSnapshot
|
|
@@ -9195,8 +9248,8 @@ var billingDecisionDisplayResponse = z43.object({
|
|
|
9195
9248
|
if (value.expires_at !== value.snapshot.expires_at)
|
|
9196
9249
|
ctx.addIssue({ code: "custom", path: ["expires_at"], message: "Display and snapshot expiry must match." });
|
|
9197
9250
|
});
|
|
9198
|
-
var planChangePrepareResponse =
|
|
9199
|
-
change_id:
|
|
9251
|
+
var planChangePrepareResponse = z44.object({
|
|
9252
|
+
change_id: z44.uuid(),
|
|
9200
9253
|
display: billingDecisionDisplayResponse
|
|
9201
9254
|
}).strict().superRefine((value, ctx) => {
|
|
9202
9255
|
if (value.display.snapshot.decision_kind !== "plan_change")
|
|
@@ -9205,20 +9258,20 @@ var planChangePrepareResponse = z43.object({
|
|
|
9205
9258
|
ctx.addIssue({ code: "custom", path: ["display", "snapshot", "decision_id"], message: "Display must refer to the prepared change." });
|
|
9206
9259
|
}).meta({ allOf: [{ properties: { display: { properties: { snapshot: { properties: { decision_kind: { const: "plan_change" } } } } } } }] });
|
|
9207
9260
|
var intentIdentity = {
|
|
9208
|
-
intent_id:
|
|
9261
|
+
intent_id: z44.uuid().meta({ description: "Opaque persisted purchase intent identity." }),
|
|
9209
9262
|
operation_key: purchaseOperationKey,
|
|
9210
9263
|
operation: chargeOperation,
|
|
9211
|
-
invoice_id:
|
|
9264
|
+
invoice_id: z44.uuid().optional().meta({
|
|
9212
9265
|
description: "For an invoice-paying operation, the due charge or issued invoice being paid. For a confirmed paid_change with payment_started, the charge or invoice created for that decision; when the charge was issued through Lexware (`charged` is `null`), it identifies the matching billing.charges[].id. Absent on a paid_change in any other state."
|
|
9213
9266
|
})
|
|
9214
9267
|
};
|
|
9215
|
-
var purchaseHoldReason =
|
|
9268
|
+
var purchaseHoldReason = z44.enum([
|
|
9216
9269
|
"legacy_usd_invoice",
|
|
9217
9270
|
"legacy_payer_unresolved",
|
|
9218
9271
|
"mandate_policy_unresolved",
|
|
9219
9272
|
"issuer_cutover_in_progress"
|
|
9220
9273
|
]);
|
|
9221
|
-
var purchaseRefusalRule =
|
|
9274
|
+
var purchaseRefusalRule = z44.enum(["company_required", "vat_id_required", "vat_id_invalid", "tax_id_required", "us_state_required", "public_email_domain", "invoice_not_open"]);
|
|
9222
9275
|
var intentRules = [
|
|
9223
9276
|
{ if: { properties: { operation: { enum: ["invoice_payment", "payment_method_invoice"] } }, required: ["operation"] }, then: { required: ["invoice_id"] } },
|
|
9224
9277
|
{ if: { properties: { operation: { const: "mandate_setup" } }, required: ["operation"] }, then: { properties: { state: { enum: ["held", "payment_started"] } } } },
|
|
@@ -9243,49 +9296,49 @@ function validateIntent(intent, ctx) {
|
|
|
9243
9296
|
ctx.addIssue({ code: "custom", path: ["payment"], message: "Owner checkout, invoice payment and mandate setup require a hosted payment." });
|
|
9244
9297
|
}
|
|
9245
9298
|
}
|
|
9246
|
-
var awaitingVies = { ...intentIdentity, state:
|
|
9299
|
+
var awaitingVies = { ...intentIdentity, state: z44.literal("awaiting_vies"), next_attempt_at: z44.iso.datetime() };
|
|
9247
9300
|
var draftVariants = [
|
|
9248
9301
|
viesPending(awaitingVies),
|
|
9249
|
-
|
|
9250
|
-
|
|
9302
|
+
z44.object({ ...intentIdentity, ...quoteIdentity, state: z44.literal("eligible"), quote: purchaseQuote }).strict(),
|
|
9303
|
+
z44.object({
|
|
9251
9304
|
...intentIdentity,
|
|
9252
9305
|
operation: purchaseOperation,
|
|
9253
|
-
state:
|
|
9306
|
+
state: z44.literal("held"),
|
|
9254
9307
|
reason: purchaseHoldReason,
|
|
9255
|
-
original_amount:
|
|
9308
|
+
original_amount: z44.object({ currency: planCurrency, gross_cents: purchaseCents }).strict().optional().meta({ description: "Recorded balance of a held invoice; not a new quote or authorization." })
|
|
9256
9309
|
}).strict(),
|
|
9257
|
-
|
|
9258
|
-
|
|
9310
|
+
z44.object({ ...intentIdentity, state: z44.literal("invalid_vat_id"), field: z44.literal("billing.vat_id"), rule: z44.literal("vat_id_invalid") }).strict(),
|
|
9311
|
+
z44.object({ ...intentIdentity, state: z44.literal("refused"), field: z44.string().min(1), rule: purchaseRefusalRule }).strict()
|
|
9259
9312
|
];
|
|
9260
|
-
var purchaseIntentDraft =
|
|
9261
|
-
var paymentStartedVariant =
|
|
9313
|
+
var purchaseIntentDraft = z44.discriminatedUnion("state", draftVariants).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9314
|
+
var paymentStartedVariant = z44.object({
|
|
9262
9315
|
...intentIdentity,
|
|
9263
9316
|
operation: purchaseOperation,
|
|
9264
|
-
state:
|
|
9265
|
-
payment_id:
|
|
9266
|
-
payment:
|
|
9267
|
-
|
|
9268
|
-
|
|
9317
|
+
state: z44.literal("payment_started"),
|
|
9318
|
+
payment_id: z44.uuid(),
|
|
9319
|
+
payment: z44.discriminatedUnion("kind", [
|
|
9320
|
+
z44.object({ kind: z44.literal("hosted"), checkout_id: z44.uuid(), checkout_url: z44.url() }).strict(),
|
|
9321
|
+
z44.object({ kind: z44.literal("mandate") }).strict()
|
|
9269
9322
|
])
|
|
9270
9323
|
}).strict();
|
|
9271
9324
|
var purchaseIntentPaymentStarted = paymentStartedVariant.superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9272
|
-
var purchaseIntentAcceptedWithoutPayment =
|
|
9273
|
-
intent_id:
|
|
9325
|
+
var purchaseIntentAcceptedWithoutPayment = z44.object({
|
|
9326
|
+
intent_id: z44.uuid(),
|
|
9274
9327
|
operation_key: purchaseOperationKey,
|
|
9275
|
-
operation:
|
|
9276
|
-
state:
|
|
9328
|
+
operation: z44.literal("paid_change"),
|
|
9329
|
+
state: z44.literal("accepted_no_payment"),
|
|
9277
9330
|
...quoteIdentity,
|
|
9278
|
-
quote: purchaseQuote.extend({ net_cents:
|
|
9331
|
+
quote: purchaseQuote.extend({ net_cents: z44.literal(0), vat_cents: z44.literal(0), gross_cents: z44.literal(0) }).strict(),
|
|
9279
9332
|
accepted_at: utcInstant
|
|
9280
9333
|
}).strict();
|
|
9281
|
-
var purchaseIntent =
|
|
9334
|
+
var purchaseIntent = z44.discriminatedUnion("state", [
|
|
9282
9335
|
...draftVariants,
|
|
9283
9336
|
paymentStartedVariant,
|
|
9284
9337
|
purchaseIntentAcceptedWithoutPayment
|
|
9285
9338
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9286
9339
|
var nonChangeOperation = purchaseOperation.exclude(["paid_change"]);
|
|
9287
9340
|
var nonChangeChargeOperation = chargeOperation.exclude(["paid_change"]);
|
|
9288
|
-
var nonChangeDraft =
|
|
9341
|
+
var nonChangeDraft = z44.discriminatedUnion("state", [
|
|
9289
9342
|
viesPending({ ...awaitingVies, operation: nonChangeChargeOperation }),
|
|
9290
9343
|
draftVariants[1].safeExtend({ operation: nonChangeChargeOperation }),
|
|
9291
9344
|
draftVariants[2].safeExtend({ operation: nonChangeOperation }),
|
|
@@ -9293,37 +9346,37 @@ var nonChangeDraft = z43.discriminatedUnion("state", [
|
|
|
9293
9346
|
draftVariants[4].safeExtend({ operation: nonChangeChargeOperation })
|
|
9294
9347
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9295
9348
|
var nonChangePaymentStarted = paymentStartedVariant.safeExtend({ operation: nonChangeOperation }).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9296
|
-
var paidChangeOperation =
|
|
9297
|
-
var paidChangeDraft =
|
|
9349
|
+
var paidChangeOperation = z44.literal("paid_change");
|
|
9350
|
+
var paidChangeDraft = z44.discriminatedUnion("state", [
|
|
9298
9351
|
draftVariants[1].safeExtend({ operation: paidChangeOperation }),
|
|
9299
9352
|
draftVariants[2].safeExtend({ operation: paidChangeOperation }),
|
|
9300
9353
|
draftVariants[3].safeExtend({ operation: paidChangeOperation }),
|
|
9301
9354
|
draftVariants[4].safeExtend({ operation: paidChangeOperation })
|
|
9302
9355
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9303
|
-
var checkoutResponse =
|
|
9356
|
+
var checkoutResponse = z44.union([nonChangeDraft, nonChangePaymentStarted]);
|
|
9304
9357
|
var checkoutIntentIdentity = {
|
|
9305
|
-
intent_id:
|
|
9358
|
+
intent_id: z44.uuid().meta({ description: "The persisted checkout intent; confirm it with `POST /api/billing/intents/:id/confirm`." }),
|
|
9306
9359
|
operation_key: purchaseOperationKey,
|
|
9307
|
-
operation:
|
|
9360
|
+
operation: z44.literal("checkout")
|
|
9308
9361
|
};
|
|
9309
|
-
var vatIdField =
|
|
9310
|
-
var checkoutStartResponse =
|
|
9311
|
-
|
|
9362
|
+
var vatIdField = z44.literal("billing.vat_id");
|
|
9363
|
+
var checkoutStartResponse = z44.discriminatedUnion("state", [
|
|
9364
|
+
z44.object({
|
|
9312
9365
|
...checkoutIntentIdentity,
|
|
9313
|
-
state:
|
|
9366
|
+
state: z44.literal("eligible"),
|
|
9314
9367
|
...quoteIdentity,
|
|
9315
9368
|
quote: purchaseQuote,
|
|
9316
9369
|
display: billingDecisionDisplayResponse
|
|
9317
9370
|
}).strict().meta({ description: "Eligible: the price is frozen and the display shown; one click on its button confirms." }),
|
|
9318
|
-
viesPending({ state:
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9371
|
+
viesPending({ state: z44.literal("vies_unavailable"), field: vatIdField }).meta({ description: "VIES did not confirm the VAT ID within its retries; with `vies_unavailable`, `vies_outage` says which side was down. Nothing is stored; check again." }),
|
|
9372
|
+
z44.object({ state: z44.literal("invalid_vat_id"), field: vatIdField, rule: z44.literal("vat_id_invalid") }).strict().meta({ description: "VIES says the VAT ID is invalid. Nothing is stored." }),
|
|
9373
|
+
z44.object({ state: z44.literal("refused"), field: z44.string().min(1), rule: purchaseRefusalRule }).strict().meta({ description: "A field the purchase cannot accept. Nothing is stored." }),
|
|
9374
|
+
z44.object({ ...checkoutIntentIdentity, state: z44.literal("held"), reason: z44.literal("issuer_cutover_in_progress") }).strict().meta({ description: "An issuer cutover is running; try again in a few minutes." }),
|
|
9375
|
+
z44.object({
|
|
9323
9376
|
...checkoutIntentIdentity,
|
|
9324
|
-
state:
|
|
9325
|
-
payment_id:
|
|
9326
|
-
payment:
|
|
9377
|
+
state: z44.literal("payment_started"),
|
|
9378
|
+
payment_id: z44.uuid(),
|
|
9379
|
+
payment: z44.object({ kind: z44.literal("hosted"), checkout_id: z44.uuid(), checkout_url: z44.url() }).strict()
|
|
9327
9380
|
}).strict().meta({ description: "The key was already confirmed: the hosted payment it started." })
|
|
9328
9381
|
]).superRefine((value, ctx) => {
|
|
9329
9382
|
if (value.state !== "eligible")
|
|
@@ -9347,29 +9400,29 @@ var checkoutStartResponse = z43.discriminatedUnion("state", [
|
|
|
9347
9400
|
if: { properties: { state: { const: "eligible" } }, required: ["state"] },
|
|
9348
9401
|
then: { properties: { display: { properties: { snapshot: { properties: { decision_kind: { const: "checkout" } } } } } } }
|
|
9349
9402
|
}] });
|
|
9350
|
-
var checkoutDraft =
|
|
9351
|
-
plan:
|
|
9403
|
+
var checkoutDraft = z44.object({
|
|
9404
|
+
plan: z44.enum(["plus", "pro"]).meta({ description: "The plan last chosen on the checkout page." }),
|
|
9352
9405
|
cycle: billingCycle.meta({ description: "The cycle last chosen." }),
|
|
9353
9406
|
billing: purchaseBillingDetails.meta({ description: "The company details last sent to the checkout start." }),
|
|
9354
|
-
updated_at:
|
|
9407
|
+
updated_at: z44.iso.datetime().meta({ description: "When the draft was last saved." })
|
|
9355
9408
|
}).strict();
|
|
9356
|
-
var checkoutDraftResponse =
|
|
9409
|
+
var checkoutDraftResponse = z44.object({
|
|
9357
9410
|
draft: checkoutDraft.nullable().meta({ description: "The saved checkout draft, or `null`. Deleted once the checkout is paid." }),
|
|
9358
9411
|
prefill: billingDetails.nullable().meta({ description: "The org's earlier billing details when there is no draft, else `null`." })
|
|
9359
9412
|
}).strict().superRefine((value, ctx) => {
|
|
9360
9413
|
if (value.draft !== null && value.prefill !== null)
|
|
9361
9414
|
ctx.addIssue({ code: "custom", path: ["prefill"], message: "A draft answers alone; prefill is null beside it." });
|
|
9362
9415
|
}).meta({ not: { properties: { draft: { type: "object" }, prefill: { type: "object" } }, required: ["draft", "prefill"] } });
|
|
9363
|
-
var checkoutOpenDetails =
|
|
9364
|
-
field:
|
|
9365
|
-
rule:
|
|
9366
|
-
expires_at:
|
|
9367
|
-
checkout_url:
|
|
9416
|
+
var checkoutOpenDetails = z44.object({
|
|
9417
|
+
field: z44.literal("billing"),
|
|
9418
|
+
rule: z44.literal("checkout_open"),
|
|
9419
|
+
expires_at: z44.iso.datetime().nullable().meta({ description: "When the open payment expires at the provider, or `null` when unknown." }),
|
|
9420
|
+
checkout_url: z44.url().nullable().meta({ description: "Where the open payment continues, or `null` when the provider no longer offers it." })
|
|
9368
9421
|
}).strict();
|
|
9369
|
-
var viesUnavailableDetails = viesPending({ field: vatIdField, rule:
|
|
9370
|
-
var purchaseIntentLookupQuery =
|
|
9422
|
+
var viesUnavailableDetails = viesPending({ field: vatIdField, rule: z44.literal("vies_unavailable") });
|
|
9423
|
+
var purchaseIntentLookupQuery = z44.object({
|
|
9371
9424
|
operation_key: purchaseOperationKey.optional().meta({ description: "The client operation key; supply this or intent_id, never both." }),
|
|
9372
|
-
intent_id:
|
|
9425
|
+
intent_id: z44.uuid().optional().meta({ description: "The persisted intent ID; supply this or operation_key, never both." }),
|
|
9373
9426
|
operation: purchaseOperation.meta({ description: "Expected operation; a mismatch returns 404 without disclosure." })
|
|
9374
9427
|
}).strict().refine((q) => q.operation_key !== void 0 !== (q.intent_id !== void 0), {
|
|
9375
9428
|
message: "Supply exactly one of operation_key or intent_id."
|
|
@@ -9382,163 +9435,160 @@ var purchaseIntentLookupQuery = z43.object({
|
|
|
9382
9435
|
});
|
|
9383
9436
|
var provedConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity, confirmation_proof: confirmationProof };
|
|
9384
9437
|
var invoiceConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity };
|
|
9385
|
-
var purchaseIntentConfirmRequest =
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9438
|
+
var purchaseIntentConfirmRequest = z44.discriminatedUnion("operation", [
|
|
9439
|
+
z44.object({ ...provedConfirmation, operation: z44.literal("checkout") }).strict(),
|
|
9440
|
+
z44.object({ ...provedConfirmation, operation: z44.literal("paid_change") }).strict(),
|
|
9441
|
+
z44.object({ ...invoiceConfirmation, operation: z44.literal("invoice_payment") }).strict(),
|
|
9442
|
+
z44.object({ ...invoiceConfirmation, operation: z44.literal("payment_method_invoice") }).strict()
|
|
9390
9443
|
]);
|
|
9391
|
-
var purchaseConflictDetails =
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9444
|
+
var purchaseConflictDetails = z44.discriminatedUnion("rule", [
|
|
9445
|
+
z44.object({ field: z44.literal("operation_key"), rule: z44.literal("operation_key_reused") }).strict(),
|
|
9446
|
+
z44.object({ field: z44.literal("confirmation_proof"), rule: z44.literal("display_stale") }).strict().meta({ description: "The display was spent, expired or no longer matches: fetch a fresh one and press again." }),
|
|
9447
|
+
z44.object({ field: z44.literal("intent"), rule: z44.enum(["stale_quote", "buyer_changed", "not_eligible", "invoice_not_open"]), current_intent: purchaseIntent }).strict()
|
|
9395
9448
|
]);
|
|
9396
|
-
var invoicePayRequest =
|
|
9397
|
-
var checkoutStatus =
|
|
9398
|
-
checkout_id:
|
|
9399
|
-
status:
|
|
9449
|
+
var invoicePayRequest = z44.object({ operation_key: purchaseOperationKey }).strict();
|
|
9450
|
+
var checkoutStatus = z44.object({
|
|
9451
|
+
checkout_id: z44.uuid().meta({ description: "The checkout this status is for." }),
|
|
9452
|
+
status: z44.enum(["pending", "paid", "failed", "canceled", "expired"]).meta({
|
|
9400
9453
|
description: "Mollie's payment status, as `reconcilePayment` last read it."
|
|
9401
9454
|
}),
|
|
9402
|
-
purpose:
|
|
9455
|
+
purpose: z44.enum(["upgrade", "payment_method", "invoice"]).meta({
|
|
9403
9456
|
description: "What this checkout paid for: a plan upgrade, a payment-method change, or an open invoice."
|
|
9404
9457
|
}),
|
|
9405
9458
|
plan: planId.meta({ description: "The org's plan after applying \u2014 unchanged unless `purpose` is `upgrade` and `status` is `paid`." })
|
|
9406
9459
|
});
|
|
9407
|
-
var vatIdStatus =
|
|
9408
|
-
var vatIdCheckRequest =
|
|
9460
|
+
var vatIdStatus = z44.enum(["valid", "unverified", "invalid", "unavailable"]);
|
|
9461
|
+
var vatIdCheckRequest = z44.object({
|
|
9409
9462
|
country: countryCode.meta({ description: "The VAT ID's country." }),
|
|
9410
|
-
vat_id:
|
|
9463
|
+
vat_id: z44.string().trim().min(1).max(20).meta({ description: "The VAT ID as typed; normalized before the VIES lookup (`normalizeVatId`)." })
|
|
9411
9464
|
}).strict();
|
|
9412
|
-
var vatCheckIdentity = { vat_id:
|
|
9413
|
-
var vatIdCheckResponse =
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
viesPending({ ...vatCheckIdentity, state:
|
|
9465
|
+
var vatCheckIdentity = { vat_id: z44.string(), name: z44.string().nullable() };
|
|
9466
|
+
var vatIdCheckResponse = z44.discriminatedUnion("state", [
|
|
9467
|
+
z44.object({ ...vatCheckIdentity, state: z44.literal("eligible"), status: z44.literal("valid") }).strict(),
|
|
9468
|
+
z44.object({ ...vatCheckIdentity, state: z44.literal("refused"), status: z44.literal("invalid"), rule: z44.literal("vat_id_invalid") }).strict(),
|
|
9469
|
+
viesPending({ ...vatCheckIdentity, state: z44.literal("pending"), status: z44.enum(["valid", "unverified", "unavailable"]) })
|
|
9417
9470
|
]);
|
|
9418
|
-
var billingChangeRequest =
|
|
9471
|
+
var billingChangeRequest = z44.object({
|
|
9419
9472
|
operation_key: purchaseOperationKey,
|
|
9420
|
-
plan:
|
|
9473
|
+
plan: z44.enum(["plus", "pro"]).optional().meta({ description: "The target plan. Omitted leaves the plan as it is." }),
|
|
9421
9474
|
cycle: billingCycle.optional().meta({ description: "The target cycle. Omitted leaves the cycle as it is." }),
|
|
9422
9475
|
addons: orgAddons.partial().strict().optional().meta({
|
|
9423
9476
|
description: "Absolute add-on counts to end up with, not a delta. Omitted leaves add-ons as they are."
|
|
9424
9477
|
})
|
|
9425
9478
|
}).strict().refine((r) => r.plan !== void 0 || r.cycle !== void 0 || r.addons !== void 0, { message: "Name a plan, a cycle or add-ons." });
|
|
9426
|
-
var billingCancelRequest =
|
|
9427
|
-
reason:
|
|
9479
|
+
var billingCancelRequest = z44.object({
|
|
9480
|
+
reason: z44.string().trim().max(500).optional().meta({ description: "An optional free-text reason. Shown to nobody but Fleetless." })
|
|
9428
9481
|
}).strict();
|
|
9429
|
-
var billingDetailsUpdate =
|
|
9430
|
-
company_name:
|
|
9482
|
+
var billingDetailsUpdate = z44.object({
|
|
9483
|
+
company_name: z44.string().trim().min(1).max(200).optional(),
|
|
9431
9484
|
address: billingAddress.optional(),
|
|
9432
|
-
tax_id:
|
|
9433
|
-
invoice_email:
|
|
9434
|
-
vat_id:
|
|
9485
|
+
tax_id: z44.string().trim().max(100).nullable().optional(),
|
|
9486
|
+
invoice_email: z44.email().optional().meta({ description: "Replaces the invoice email. Omitted leaves it as it is." }),
|
|
9487
|
+
vat_id: z44.string().trim().max(20).nullable().optional().meta({
|
|
9435
9488
|
description: "Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES."
|
|
9436
9489
|
})
|
|
9437
9490
|
}).strict();
|
|
9438
|
-
var billingDetailsConflictDetails =
|
|
9439
|
-
|
|
9491
|
+
var billingDetailsConflictDetails = z44.union([
|
|
9492
|
+
z44.object({ field: z44.string().min(1), rule: purchaseRefusalRule }).strict().meta({ description: "A field a purchase would refuse. Nothing is saved." }),
|
|
9440
9493
|
viesUnavailableDetails,
|
|
9441
|
-
|
|
9494
|
+
z44.object({ field: z44.literal("billing"), rule: z44.literal("buyer_changed") }).strict().meta({ description: "The billing details changed meanwhile. Nothing is saved." })
|
|
9442
9495
|
]);
|
|
9443
|
-
var paymentMethodKind =
|
|
9444
|
-
var paymentMethodChangeRequest =
|
|
9445
|
-
operation_key: purchaseOperationKey
|
|
9446
|
-
method: paymentMethodKind.meta({
|
|
9447
|
-
description: "The new mandate's method. Offer what `billingView.payment_method_options` lists: `applepay` may be refused with `400 validation_error` `{ field: 'method', rule: 'applepay_needs_open_invoice' }` unless an invoice is open."
|
|
9448
|
-
})
|
|
9496
|
+
var paymentMethodKind = z44.enum(["card", "paypal", "applepay"]);
|
|
9497
|
+
var paymentMethodChangeRequest = z44.object({
|
|
9498
|
+
operation_key: purchaseOperationKey
|
|
9449
9499
|
}).strict();
|
|
9450
|
-
var billingAccountStatus =
|
|
9451
|
-
var paymentMethod =
|
|
9452
|
-
|
|
9453
|
-
kind:
|
|
9454
|
-
brand:
|
|
9455
|
-
last4:
|
|
9456
|
-
expires:
|
|
9457
|
-
}),
|
|
9458
|
-
|
|
9459
|
-
kind:
|
|
9460
|
-
brand:
|
|
9461
|
-
last4:
|
|
9462
|
-
expires:
|
|
9463
|
-
}),
|
|
9464
|
-
|
|
9465
|
-
kind:
|
|
9466
|
-
account:
|
|
9500
|
+
var billingAccountStatus = z44.enum(["pending", "active", "past_due", "canceled"]);
|
|
9501
|
+
var paymentMethod = z44.discriminatedUnion("kind", [
|
|
9502
|
+
z44.object({
|
|
9503
|
+
kind: z44.literal("card").meta({ description: "A card mandate." }),
|
|
9504
|
+
brand: z44.string().meta({ description: "The card network, as Mollie's mandate reports it, e.g. 'Visa'." }),
|
|
9505
|
+
last4: z44.string().regex(/^\d{4}$/).meta({ description: "The last four digits of the card." }),
|
|
9506
|
+
expires: z44.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." })
|
|
9507
|
+
}),
|
|
9508
|
+
z44.object({
|
|
9509
|
+
kind: z44.literal("applepay").meta({ description: "A card mandate from an Apple Pay first payment \u2014 Mollie stores it as `creditcard`; Fleetless labels it Apple Pay." }),
|
|
9510
|
+
brand: z44.string().meta({ description: "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'." }),
|
|
9511
|
+
last4: z44.string().regex(/^\d{4}$/).meta({ description: "The last four digits of the card behind Apple Pay." }),
|
|
9512
|
+
expires: z44.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." })
|
|
9513
|
+
}),
|
|
9514
|
+
z44.object({
|
|
9515
|
+
kind: z44.literal("paypal").meta({ description: "A PayPal mandate." }),
|
|
9516
|
+
account: z44.string().meta({ description: "The PayPal account Mollie's mandate names." })
|
|
9467
9517
|
})
|
|
9468
9518
|
]);
|
|
9469
|
-
var invoiceStatus =
|
|
9470
|
-
var billingInvoice =
|
|
9471
|
-
id:
|
|
9472
|
-
number:
|
|
9519
|
+
var invoiceStatus = z44.enum(["open", "paid", "uncollectible", "cancelled"]);
|
|
9520
|
+
var billingInvoice = z44.object({
|
|
9521
|
+
id: z44.uuid().meta({ description: "The invoice's id." }),
|
|
9522
|
+
number: z44.string().regex(/^FL-\d{4}-\d{4,}$/).meta({
|
|
9473
9523
|
description: "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
|
|
9474
9524
|
}),
|
|
9475
|
-
issued_at:
|
|
9525
|
+
issued_at: z44.iso.datetime().meta({ description: "When the invoice was issued." }),
|
|
9476
9526
|
status: invoiceStatus.meta({ description: "This invoice's own status." }),
|
|
9477
|
-
cancellation_document_url:
|
|
9527
|
+
cancellation_document_url: z44.string().nullable().meta({
|
|
9478
9528
|
description: "Cloud always returns `null` for this field, including cancelled historical Cloud invoices. Cancellation documents are held in Lexware."
|
|
9479
9529
|
}),
|
|
9480
9530
|
currency: planCurrency.meta({ description: "The org's billing currency." }),
|
|
9481
|
-
net_cents:
|
|
9482
|
-
vat_rate_percent:
|
|
9483
|
-
vat_cents:
|
|
9484
|
-
gross_cents:
|
|
9531
|
+
net_cents: z44.number().int().nonnegative().meta({ description: "The charge, excluding VAT, in integer cents." }),
|
|
9532
|
+
vat_rate_percent: z44.number().int().min(0).max(100).meta({ description: "The VAT rate applied, in whole percent." }),
|
|
9533
|
+
vat_cents: z44.number().int().nonnegative().meta({ description: "VAT, in integer cents (`vatCents`)." }),
|
|
9534
|
+
gross_cents: z44.number().int().nonnegative().meta({ description: "Net plus VAT, in integer cents." })
|
|
9485
9535
|
});
|
|
9486
|
-
var billingInvoicePdfQuery =
|
|
9487
|
-
kind:
|
|
9536
|
+
var billingInvoicePdfQuery = z44.object({
|
|
9537
|
+
kind: z44.enum(["invoice", "cancellation"]).optional().meta({ description: "Omitted or `invoice` selects the original invoice PDF. `cancellation` is accepted but returns `404 not_found`: Cloud has no cancellation PDFs." })
|
|
9488
9538
|
}).strict();
|
|
9489
|
-
var billingAccount =
|
|
9539
|
+
var billingAccount = z44.object({
|
|
9490
9540
|
payer: billingDetails.meta({ description: "Who is paying, and the invoice address and email." }),
|
|
9491
9541
|
vat_id_status: vatIdStatus.nullable().meta({ description: "The payer's VAT ID check, or `null` when no VAT ID was given." }),
|
|
9492
|
-
vat:
|
|
9542
|
+
vat: z44.object({
|
|
9493
9543
|
treatment: vatTreatment.meta({ description: "How the account is taxed." }),
|
|
9494
|
-
rate_percent:
|
|
9544
|
+
rate_percent: z44.number().int().meta({ description: "The VAT rate, in whole percent." })
|
|
9495
9545
|
}).nullable().meta({ description: "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account." }),
|
|
9496
9546
|
currency: planCurrency.meta({ description: "The org's billing currency, fixed at the first payment." }),
|
|
9497
9547
|
cycle: billingCycle.meta({ description: "The current billing cycle." }),
|
|
9498
9548
|
status: billingAccountStatus.meta({ description: "The account's own status." }),
|
|
9499
|
-
period_starts_at:
|
|
9500
|
-
period_ends_at:
|
|
9501
|
-
next_charge:
|
|
9502
|
-
at:
|
|
9503
|
-
net_cents:
|
|
9504
|
-
vat_cents:
|
|
9505
|
-
gross_cents:
|
|
9549
|
+
period_starts_at: z44.iso.datetime().nullable().meta({ description: "The current period's start. `null` before the first payment." }),
|
|
9550
|
+
period_ends_at: z44.iso.datetime().nullable().meta({ description: "The current period's end. `null` before the first payment." }),
|
|
9551
|
+
next_charge: z44.object({
|
|
9552
|
+
at: z44.iso.datetime().meta({ description: "When the next charge is due." }),
|
|
9553
|
+
net_cents: z44.number().int().meta({ description: "The next charge, excluding VAT, in integer cents." }),
|
|
9554
|
+
vat_cents: z44.number().int().meta({ description: "VAT on the next charge, in integer cents." }),
|
|
9555
|
+
gross_cents: z44.number().int().meta({ description: "The next charge including VAT, in integer cents." })
|
|
9506
9556
|
}).nullable().meta({ description: "`null` while a cancel is pending or nothing else renews." }),
|
|
9507
|
-
current_price:
|
|
9508
|
-
net_cents:
|
|
9557
|
+
current_price: z44.object({
|
|
9558
|
+
net_cents: z44.number().int().meta({
|
|
9509
9559
|
description: "One period of the current plan, cycle and add-ons at the agreed price, excluding VAT, in integer cents."
|
|
9510
9560
|
})
|
|
9511
9561
|
}).nullable().meta({
|
|
9512
9562
|
description: "What one period (`cycle`) of the current plan costs this organization: the price it agreed, which stays when the catalogue changes. Show this, not the catalogue price, as the price of a billed organization. `null` when no agreed price is recorded for the current plan, cycle and add-ons."
|
|
9513
9563
|
}),
|
|
9514
|
-
scheduled:
|
|
9564
|
+
scheduled: z44.object({
|
|
9515
9565
|
cycle: billingCycle.nullable().meta({ description: "A cycle change queued for the period's end, or `null`." }),
|
|
9516
9566
|
addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." })
|
|
9517
9567
|
}).meta({ description: "What takes effect at the period's end." }),
|
|
9518
|
-
dunning:
|
|
9519
|
-
invoice_id:
|
|
9568
|
+
dunning: z44.object({
|
|
9569
|
+
invoice_id: z44.uuid().meta({
|
|
9520
9570
|
description: "What dunning is chasing: a historical open `FL-\u2026` invoice, or a due charge. Before the issuer cutover a due charge appears here only while the payer's VAT ID is unsettled; it has no number yet, is not in `invoices`, and `POST /api/billing/invoices/:id/pay` takes either. After the cutover this is always a due charge (in `charges`): pay it with `POST /api/billing/charges/:id/pay`."
|
|
9521
9571
|
}),
|
|
9522
|
-
gross_cents:
|
|
9572
|
+
gross_cents: z44.number().int().meta({
|
|
9523
9573
|
description: "The amount owed, in integer cents \u2014 after a partial chargeback only the charged-back part."
|
|
9524
9574
|
}),
|
|
9525
|
-
due_at:
|
|
9526
|
-
next_retry_at:
|
|
9575
|
+
due_at: z44.iso.datetime().meta({ description: "The charge's due date; retries and the lock count from here." }),
|
|
9576
|
+
next_retry_at: z44.iso.datetime().nullable().meta({
|
|
9527
9577
|
description: "The next automatic retry, or `null` once retries are exhausted. Always `null` after a chargeback: a charged-back payment is never charged again automatically."
|
|
9528
9578
|
}),
|
|
9529
|
-
lock_at:
|
|
9530
|
-
failure:
|
|
9579
|
+
lock_at: z44.iso.datetime().meta({ description: "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)." }),
|
|
9580
|
+
failure: z44.string().nullable().meta({
|
|
9531
9581
|
description: "Mollie's own reason, e.g. 'card_expired'; 'vat_id_invalid' while a renewal is held because VIES does not confirm the VAT ID; 'charged_back' after a chargeback or a lost PayPal dispute."
|
|
9532
9582
|
})
|
|
9533
9583
|
}).nullable().meta({ description: "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced." })
|
|
9534
9584
|
});
|
|
9535
|
-
var billingIssuer =
|
|
9536
|
-
var billingChargeInvoice =
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
state:
|
|
9541
|
-
document_id:
|
|
9585
|
+
var billingIssuer = z44.enum(["cloud", "lexware"]);
|
|
9586
|
+
var billingChargeInvoice = z44.discriminatedUnion("state", [
|
|
9587
|
+
z44.object({ state: z44.literal("not_issued").meta({ description: "Not collected (due, a failed retry, or uncollectible): no invoice exists." }) }).strict(),
|
|
9588
|
+
z44.object({ state: z44.literal("pending").meta({ description: "Collected; the Lexware invoice is not yet confirmed." }) }).strict(),
|
|
9589
|
+
z44.object({
|
|
9590
|
+
state: z44.literal("issued").meta({ description: "Lexware has confirmed the invoice." }),
|
|
9591
|
+
document_id: z44.uuid().meta({ description: "The Lexware document's id \u2014 read it with `GET /api/billing/documents/:id`." })
|
|
9542
9592
|
}).strict()
|
|
9543
9593
|
]);
|
|
9544
9594
|
var chargeInvoiceRules = [
|
|
@@ -9551,55 +9601,54 @@ function refuseChargeInvoiceMismatch(charge, ctx) {
|
|
|
9551
9601
|
ctx.addIssue({ code: "custom", path: ["invoice"], message: "A paid charge has an invoice (pending or issued); every other status has none yet." });
|
|
9552
9602
|
}
|
|
9553
9603
|
}
|
|
9554
|
-
var billingCharge =
|
|
9555
|
-
id:
|
|
9556
|
-
kind:
|
|
9557
|
-
status:
|
|
9604
|
+
var billingCharge = z44.object({
|
|
9605
|
+
id: z44.uuid().meta({ description: "The due charge's id \u2014 never a Cloud invoice number. Pay it with `POST /api/billing/charges/:id/pay`." }),
|
|
9606
|
+
kind: z44.enum(["first", "renewal", "change"]).meta({ description: "What caused the charge: the first charge after checkout, a scheduled renewal, or a mid-period plan change." }),
|
|
9607
|
+
status: z44.enum(["due", "paid", "uncollectible", "cancelled"]).meta({
|
|
9558
9608
|
description: "The charge's own status. A charged back or manually refunded charge stays `paid` \u2014 refunds and chargebacks are handled in Mollie or Lexware by hand; this status and the invoice it names are unchanged, and the resulting Lexware credit note appears under `GET /api/billing/documents` instead."
|
|
9559
9609
|
}),
|
|
9560
|
-
currency:
|
|
9561
|
-
net_cents:
|
|
9562
|
-
vat_rate_percent:
|
|
9563
|
-
vat_cents:
|
|
9564
|
-
gross_cents:
|
|
9565
|
-
period_start:
|
|
9566
|
-
period_end:
|
|
9567
|
-
due_at:
|
|
9568
|
-
paid_at:
|
|
9610
|
+
currency: z44.literal("eur").meta({ description: "Every charge billed through Lexware is EUR." }),
|
|
9611
|
+
net_cents: z44.number().int().nonnegative().meta({ description: "The charge, excluding VAT, in integer cents." }),
|
|
9612
|
+
vat_rate_percent: z44.number().int().min(0).max(100).meta({ description: "The VAT rate applied, in whole percent." }),
|
|
9613
|
+
vat_cents: z44.number().int().nonnegative().meta({ description: "VAT, in integer cents (`vatCents`)." }),
|
|
9614
|
+
gross_cents: z44.number().int().nonnegative().meta({ description: "Net plus VAT, in integer cents." }),
|
|
9615
|
+
period_start: z44.iso.datetime().meta({ description: "The covered period's start." }),
|
|
9616
|
+
period_end: z44.iso.datetime().meta({ description: "The covered period's end." }),
|
|
9617
|
+
due_at: z44.iso.datetime().meta({ description: "When this charge is due." }),
|
|
9618
|
+
paid_at: z44.iso.datetime().nullable().meta({ description: "When this charge was paid, or `null` while unpaid." }),
|
|
9569
9619
|
invoice: billingChargeInvoice.meta({ description: "Whether a Lexware invoice exists for this charge yet, and which document it names once it does." })
|
|
9570
9620
|
}).strict().superRefine(refuseChargeInvoiceMismatch).meta({ allOf: chargeInvoiceRules });
|
|
9571
9621
|
var chargePayRequest = invoicePayRequest;
|
|
9572
|
-
var billingView =
|
|
9573
|
-
available:
|
|
9622
|
+
var billingView = z44.object({
|
|
9623
|
+
available: z44.boolean().meta({ description: "Whether this cloud takes payments at all \u2014 `false` when no Mollie key is configured." }),
|
|
9574
9624
|
account: billingAccount.nullable().meta({ description: "`null` before the org has ever checked out." }),
|
|
9575
9625
|
payment_method: paymentMethod.nullable().meta({ description: "The payment method on file, or `null`." }),
|
|
9576
|
-
payment_method_options:
|
|
9577
|
-
method: paymentMethodKind.meta({ description: "A method
|
|
9578
|
-
pays_invoice: z43.boolean().meta({ description: "Whether changing to it also pays the open invoice \u2014 `true` only for `applepay` when a zero-amount Apple Pay payment is not available." })
|
|
9626
|
+
payment_method_options: z44.array(z44.object({
|
|
9627
|
+
method: paymentMethodKind.meta({ description: "A method Mollie's page offers for a change started now." })
|
|
9579
9628
|
})).meta({
|
|
9580
|
-
description: "
|
|
9629
|
+
description: "The methods a payment-method change offers on Mollie's page right now, where the payer chooses one: card and PayPal, and Apple Pay where this cloud takes a zero-amount Apple Pay payment. `[]` when no change is possible: the org has no active or past-due billing account."
|
|
9581
9630
|
}),
|
|
9582
9631
|
issuer: billingIssuer.meta({ description: "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it." }),
|
|
9583
|
-
invoices:
|
|
9584
|
-
charges:
|
|
9632
|
+
invoices: z44.array(billingInvoice).meta({ description: "Cloud-issued invoices from before the issuer cutover; read-only, never grows after it. Newest first, at most 24." }),
|
|
9633
|
+
charges: z44.array(billingCharge).meta({
|
|
9585
9634
|
description: "Newest first, at most 24. Lists only due charges with issuer `lexware` \u2014 never a pre-cutover charge, a legacy payment (legacy_issued/legacy_held/legacy_person/legacy_usd) or a late USD collection: none of those carry a Lexware intent, and they stay in `invoices` or nowhere. `[]` while `issuer` is `cloud`."
|
|
9586
9635
|
})
|
|
9587
9636
|
});
|
|
9588
|
-
var billingDocumentKind =
|
|
9589
|
-
var billingDocumentStatus =
|
|
9590
|
-
var billingDocumentProfile =
|
|
9591
|
-
var billingDocumentFormat =
|
|
9592
|
-
var billingDocumentBase =
|
|
9593
|
-
id:
|
|
9637
|
+
var billingDocumentKind = z44.enum(["invoice", "credit_note", "down_payment_invoice", "bookkeeping_invoice", "bookkeeping_credit_note"]);
|
|
9638
|
+
var billingDocumentStatus = z44.enum(["open", "overdue", "paid", "paidoff", "voided", "transferred", "sepadebit"]);
|
|
9639
|
+
var billingDocumentProfile = z44.enum(["NONE", "EN16931", "XRechnung"]);
|
|
9640
|
+
var billingDocumentFormat = z44.enum(["pdf", "xml"]);
|
|
9641
|
+
var billingDocumentBase = z44.object({
|
|
9642
|
+
id: z44.uuid().meta({ description: "The Lexware voucher id. Opaque; read the document or its file by this id, never a locally invented one." }),
|
|
9594
9643
|
kind: billingDocumentKind.meta({ description: "The document's kind." }),
|
|
9595
9644
|
status: billingDocumentStatus.meta({ description: "The document's own status." }),
|
|
9596
|
-
number:
|
|
9597
|
-
document_date:
|
|
9598
|
-
currency:
|
|
9599
|
-
gross_cents:
|
|
9645
|
+
number: z44.string().nullable().meta({ description: "The Lexware voucher number, for display only \u2014 never a key to read by. `null` for a voucher Lexware has not numbered." }),
|
|
9646
|
+
document_date: z44.iso.datetime({ offset: true }).meta({ description: "The date printed on the document." }),
|
|
9647
|
+
currency: z44.literal("EUR").meta({ description: "Every Lexware voucher this reads is EUR; nothing here reads a foreign-currency voucher." }),
|
|
9648
|
+
gross_cents: z44.number().int().meta({
|
|
9600
9649
|
description: "The gross amount, in integer cents, signed by `kind` and never by the sign Lexware itself reports: `credit_note` and `bookkeeping_credit_note` are zero or negative, every other kind is zero or positive."
|
|
9601
9650
|
}),
|
|
9602
|
-
file:
|
|
9651
|
+
file: z44.enum(["available", "unavailable"]).meta({ description: "Whether Lexware holds a file for this document at all." })
|
|
9603
9652
|
});
|
|
9604
9653
|
function refuseWrongGrossSign(doc, ctx) {
|
|
9605
9654
|
const isCredit = doc.kind === "credit_note" || doc.kind === "bookkeeping_credit_note";
|
|
@@ -9611,18 +9660,18 @@ function refuseWrongGrossSign(doc, ctx) {
|
|
|
9611
9660
|
}
|
|
9612
9661
|
}
|
|
9613
9662
|
var billingDocument = billingDocumentBase.strict().superRefine(refuseWrongGrossSign);
|
|
9614
|
-
var billingDocumentList =
|
|
9615
|
-
available:
|
|
9616
|
-
complete:
|
|
9617
|
-
unsupported_count:
|
|
9618
|
-
documents:
|
|
9663
|
+
var billingDocumentList = z44.object({
|
|
9664
|
+
available: z44.boolean().meta({ description: "Whether this cloud can list Lexware documents at all for this org \u2014 `false` when this cloud has no Lexware configured, its Lexware account failed the account check, or the org has no Lexware contact." }),
|
|
9665
|
+
complete: z44.boolean().meta({ description: "`false` when a document of an unsupported type or status was skipped rather than listed, counted in `unsupported_count`." }),
|
|
9666
|
+
unsupported_count: z44.number().int().nonnegative().meta({ description: "How many documents of an unsupported type or status were skipped; `complete` is `false` whenever this is above zero." }),
|
|
9667
|
+
documents: z44.array(billingDocument).meta({ description: "Every supported document this org has, complete or not \u2014 never a truncated page." })
|
|
9619
9668
|
}).strict().superRefine((list, ctx) => {
|
|
9620
9669
|
if (!list.available && (list.documents.length > 0 || !list.complete || list.unsupported_count > 0)) {
|
|
9621
9670
|
ctx.addIssue({ code: "custom", path: ["available"], message: "available: false carries no documents, is complete and has no unsupported document." });
|
|
9622
9671
|
}
|
|
9623
9672
|
});
|
|
9624
|
-
var billingDocumentFileRole =
|
|
9625
|
-
var billingDocumentFormatEntry =
|
|
9673
|
+
var billingDocumentFileRole = z44.enum(["e_invoice", "preview", "document"]);
|
|
9674
|
+
var billingDocumentFormatEntry = z44.object({ format: billingDocumentFormat, role: billingDocumentFileRole }).strict();
|
|
9626
9675
|
function sameFormats(a, b) {
|
|
9627
9676
|
return a.length === b.length && a.every((entry2, i) => entry2.format === b[i].format && entry2.role === b[i].role);
|
|
9628
9677
|
}
|
|
@@ -9634,14 +9683,14 @@ function refuseWrongFormats(doc, ctx) {
|
|
|
9634
9683
|
}
|
|
9635
9684
|
var billingDocumentDetail = billingDocumentBase.extend({
|
|
9636
9685
|
electronic_document_profile: billingDocumentProfile.nullable().meta({ description: "The e-invoice profile, or `null` for a bookkeeping voucher \u2014 it has none." }),
|
|
9637
|
-
formats:
|
|
9686
|
+
formats: z44.array(billingDocumentFormatEntry).meta({
|
|
9638
9687
|
description: '`NONE`: `[{ format: "pdf", role: "document" }]`. `EN16931`: `[{ format: "pdf", role: "e_invoice" }]`. `XRechnung`: `[{ format: "xml", role: "e_invoice" }, { format: "pdf", role: "preview" }]`. `null` profile: `[{ format: "pdf", role: "document" }]` when `file` is `available`, otherwise `[]`.'
|
|
9639
9688
|
})
|
|
9640
9689
|
}).strict().superRefine((doc, ctx) => {
|
|
9641
9690
|
refuseWrongGrossSign(doc, ctx);
|
|
9642
9691
|
refuseWrongFormats(doc, ctx);
|
|
9643
9692
|
});
|
|
9644
|
-
var billingDocumentFileQuery =
|
|
9693
|
+
var billingDocumentFileQuery = z44.object({
|
|
9645
9694
|
format: billingDocumentFormat.default("pdf").meta({ description: "The file format to read. `xml` answers `404` unless the document is `XRechnung`." })
|
|
9646
9695
|
}).strict();
|
|
9647
9696
|
var acceptedBillingFields = {
|
|
@@ -9650,30 +9699,30 @@ var acceptedBillingFields = {
|
|
|
9650
9699
|
description: "The Fleetless invoice charged now, or `null` when nothing was charged now (a change scheduled for the period end, or an increase that cost nothing) or the change was charged through Lexware (then the charge is in `billing.charges`)."
|
|
9651
9700
|
})
|
|
9652
9701
|
};
|
|
9653
|
-
var acceptedPaidChange =
|
|
9702
|
+
var acceptedPaidChange = z44.object({
|
|
9654
9703
|
...acceptedBillingFields,
|
|
9655
|
-
intent: paymentStartedVariant.safeExtend({ operation:
|
|
9704
|
+
intent: paymentStartedVariant.safeExtend({ operation: z44.literal("paid_change") })
|
|
9656
9705
|
}).strict();
|
|
9657
|
-
var acceptedNoPaymentChange =
|
|
9706
|
+
var acceptedNoPaymentChange = z44.object({
|
|
9658
9707
|
billing: billingView,
|
|
9659
|
-
charged:
|
|
9708
|
+
charged: z44.null().meta({
|
|
9660
9709
|
description: "Always `null`: nothing was charged now (a scheduled change or an increase that cost nothing)."
|
|
9661
9710
|
}),
|
|
9662
9711
|
intent: purchaseIntentAcceptedWithoutPayment
|
|
9663
9712
|
}).strict();
|
|
9664
|
-
var billingChangeResponse =
|
|
9665
|
-
|
|
9713
|
+
var billingChangeResponse = z44.union([
|
|
9714
|
+
z44.object({ intent: paidChangeDraft }).strict(),
|
|
9666
9715
|
acceptedPaidChange,
|
|
9667
9716
|
acceptedNoPaymentChange
|
|
9668
9717
|
]);
|
|
9669
|
-
var purchaseIntentResponse =
|
|
9718
|
+
var purchaseIntentResponse = z44.union([
|
|
9670
9719
|
purchaseIntentDraft,
|
|
9671
9720
|
nonChangePaymentStarted,
|
|
9672
9721
|
acceptedPaidChange,
|
|
9673
9722
|
acceptedNoPaymentChange
|
|
9674
9723
|
]);
|
|
9675
9724
|
|
|
9676
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
9725
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/routes.js
|
|
9677
9726
|
var MCP_APP = MCP_APP_PATHS(":appIdentifier");
|
|
9678
9727
|
var APP_IDENTIFIER = {
|
|
9679
9728
|
name: "appIdentifier",
|
|
@@ -13210,7 +13259,7 @@ var ROUTES = [
|
|
|
13210
13259
|
response: liveSessionResponse,
|
|
13211
13260
|
errors: [...CLIENT_GUARD, "invalid_uuid", "not_found", "robot_offline", "camera_offline", "live_unavailable"],
|
|
13212
13261
|
transport: "http",
|
|
13213
|
-
notes: "Refcounted: the first viewer starts the robot publishing and the last release stops it. No token is ever minted for an ungranted or offline camera \u2014 both refusals return before the hold is taken. `409 camera_offline` means the **robot itself** reported the failure; `502 live_unavailable` means this cloud could not start the stream. The difference matters, and it is why a failure the robot named is never dressed up as one this side invented."
|
|
13262
|
+
notes: "Refcounted: the first viewer starts the robot publishing and the last release stops it. No token is ever minted for an ungranted or offline camera \u2014 both refusals return before the hold is taken. `409 camera_offline` means the **robot itself** reported the failure; `502 live_unavailable` means this cloud could not start the stream. The difference matters, and it is why a failure the robot named is never dressed up as one this side invented. The `409` carries `details.refusal` (`cameraOfflineDetails`) and the cloud's fixed sentence for it as `message`, never the robot's own words. A start the robot refuses after the `201` ends the session with a `live_session` frame, reason `start_refused`, the same sentence as `detail` and the class as `refusal`; the next viewer of an emptied room gets a fresh try."
|
|
13214
13263
|
},
|
|
13215
13264
|
{
|
|
13216
13265
|
method: "DELETE",
|
|
@@ -13869,7 +13918,7 @@ var ROUTES = [
|
|
|
13869
13918
|
response: checkoutResponse,
|
|
13870
13919
|
errors: ["target_state_conflict", ...DEVELOPER_GUARD, "tier_required", "support_forbidden", "validation_error", "not_found", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
13871
13920
|
transport: "http",
|
|
13872
|
-
notes: "
|
|
13921
|
+
notes: "The body is `{ operation_key }` only: a body that still sends `method` is 400 validation_error. A change is a 0.00 `first` payment on the provider's hosted page, which offers every method `payment_method_options` lists (card, PayPal and, where a zero-amount Apple Pay payment is taken, Apple Pay); the payer chooses there, and the method paid with becomes the mandate. Offer the change only while `payment_method_options` is not empty. The answer is operation `mandate_setup` in `payment_started` with `payment.kind` hosted at once; redirect to its `checkout_url`. Nothing is quoted, so there is no `eligible` step, no confirmation and no VIES. It pays no invoice and clears no dunning or lock: open invoices stay open. When the provider reports it paid, the new mandate is the account's and every other valid mandate of the customer is revoked; canceled, expired or failed, nothing changes. `GET /api/billing/checkout/:id` with the `checkout_id` reads the outcome (`purpose: payment_method`). Keep one operation_key until its payment is finished. The same key again answers 200 with the same `payment_started` while the payment is open. 502 payment_provider_unavailable when the provider did not answer: the same key again resumes, and sends the same payment again under the same idempotency key. 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when the key's payment is finished or can no longer be sent: start again with a new key. A key first used for another operation, or before this route took no method, is a typed operation_key_reused conflict. A change stored while changes were on hold reads `held` with `mandate_policy_unresolved`; start again with a new key. 404 not_found when no billing account is active or past due. Owner only: a support session is answered 403 support_forbidden."
|
|
13873
13922
|
},
|
|
13874
13923
|
{
|
|
13875
13924
|
method: "POST",
|
|
@@ -14003,7 +14052,7 @@ var ROUTES = [
|
|
|
14003
14052
|
response: checkoutResponse,
|
|
14004
14053
|
errors: ["validation_error", ...DEVELOPER_GUARD, "tier_required", "not_found", "target_state_conflict", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
14005
14054
|
transport: "http",
|
|
14006
|
-
notes: "The required operation_key binds the org, invoice and request; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id may be an issued invoice or a due charge with no number. Recheck current buyer eligibility, VIES, invoice status, owed amount and original currency before every new provider call. Invalid VAT is state invalid_vat_id with rule vat_id_invalid, without a payment. Pending/eligible/held has no redirect; after VIES recovers, the owner must confirm the current quote. An issued USD invoice remains held/legacy_usd_invoice: never convert it or call the provider anew until the integration decision resolves the conflict. Already-created payments retain recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries. invoice_not_open is a typed conflict; 404 not_found for unknown/foreign invoice. Pending itself never pays an invoice, lifts a lock or resets dunning. After the issuer cutover, :id names a historical open FL-\u2026 invoice only; a due charge after the cutover answers 404 not_found here \u2014 pay it with POST /api/billing/charges/:id/pay instead."
|
|
14055
|
+
notes: "The required operation_key binds the org, invoice and request; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id may be an issued invoice or a due charge with no number. Recheck current buyer eligibility, VIES, invoice status, owed amount and original currency before every new provider call. Invalid VAT is state invalid_vat_id with rule vat_id_invalid, without a payment. Pending/eligible/held has no redirect; after VIES recovers, the owner must confirm the current quote. An issued USD invoice remains held/legacy_usd_invoice: never convert it or call the provider anew until the integration decision resolves the conflict. Already-created payments retain recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries. invoice_not_open is a typed conflict; 404 not_found for unknown/foreign invoice. Pending itself never pays an invoice, lifts a lock or resets dunning. An invoice charged back is never retried automatically. After the issuer cutover, :id names a historical open FL-\u2026 invoice only; a due charge after the cutover answers 404 not_found here \u2014 pay it with POST /api/billing/charges/:id/pay instead."
|
|
14007
14056
|
},
|
|
14008
14057
|
{
|
|
14009
14058
|
method: "POST",
|
|
@@ -15158,7 +15207,7 @@ function headerNumber(headers, name) {
|
|
|
15158
15207
|
const value = Number(raw);
|
|
15159
15208
|
return Number.isFinite(value) ? value : null;
|
|
15160
15209
|
}
|
|
15161
|
-
function createCamerasApi(http) {
|
|
15210
|
+
function createCamerasApi(http, endings) {
|
|
15162
15211
|
return {
|
|
15163
15212
|
async list(robotId) {
|
|
15164
15213
|
const response = await http.request(`/api/robots/${pathSegment(robotId)}/cameras`, {});
|
|
@@ -15196,6 +15245,7 @@ function createCamerasApi(http) {
|
|
|
15196
15245
|
}
|
|
15197
15246
|
},
|
|
15198
15247
|
async live(robotId, slug2) {
|
|
15248
|
+
if (endings) await endings.ready();
|
|
15199
15249
|
const response = await http.request(`/api/robots/${pathSegment(robotId)}/cameras/${pathSegment(slug2)}/live`, {
|
|
15200
15250
|
method: "POST"
|
|
15201
15251
|
});
|
|
@@ -15213,11 +15263,113 @@ function createCamerasApi(http) {
|
|
|
15213
15263
|
room: response.room,
|
|
15214
15264
|
token: response.token,
|
|
15215
15265
|
expires_at: response.expires_at,
|
|
15216
|
-
release
|
|
15266
|
+
release,
|
|
15267
|
+
onEnded: (handler) => endings ? endings.onEnded(response.session_id, handler) : () => {
|
|
15268
|
+
}
|
|
15269
|
+
};
|
|
15270
|
+
}
|
|
15271
|
+
};
|
|
15272
|
+
}
|
|
15273
|
+
|
|
15274
|
+
// src/live-sessions.ts
|
|
15275
|
+
var LIVE_CHANNEL_READY_TIMEOUT_MS = 5e3;
|
|
15276
|
+
var ENDINGS_KEPT = 64;
|
|
15277
|
+
function createLiveSessionEndings(channel, options = {}) {
|
|
15278
|
+
const readyTimeoutMs = options.readyTimeoutMs ?? LIVE_CHANNEL_READY_TIMEOUT_MS;
|
|
15279
|
+
const ended = /* @__PURE__ */ new Map();
|
|
15280
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
15281
|
+
let listening = false;
|
|
15282
|
+
function listen() {
|
|
15283
|
+
if (listening) return;
|
|
15284
|
+
listening = true;
|
|
15285
|
+
channel.on("live_session", (frame) => {
|
|
15286
|
+
const parsed = parseEnding(frame);
|
|
15287
|
+
if (!parsed) return;
|
|
15288
|
+
ended.set(parsed.sessionId, parsed.ended);
|
|
15289
|
+
if (ended.size > ENDINGS_KEPT) ended.delete(ended.keys().next().value);
|
|
15290
|
+
const waiting = handlers.get(parsed.sessionId);
|
|
15291
|
+
if (!waiting) return;
|
|
15292
|
+
handlers.delete(parsed.sessionId);
|
|
15293
|
+
for (const handler of waiting) deliver(handler, parsed.ended);
|
|
15294
|
+
});
|
|
15295
|
+
}
|
|
15296
|
+
return {
|
|
15297
|
+
ready() {
|
|
15298
|
+
listen();
|
|
15299
|
+
if (channel.isReady) return Promise.resolve();
|
|
15300
|
+
return new Promise((resolve) => {
|
|
15301
|
+
let settled = false;
|
|
15302
|
+
const unlistenReady = channel.onReady(() => settle());
|
|
15303
|
+
const unlistenFailed = channel.onAuthFailed(() => settle());
|
|
15304
|
+
const timer = setTimeout(() => settle(), readyTimeoutMs);
|
|
15305
|
+
function settle() {
|
|
15306
|
+
if (settled) return;
|
|
15307
|
+
settled = true;
|
|
15308
|
+
clearTimeout(timer);
|
|
15309
|
+
unlistenReady();
|
|
15310
|
+
unlistenFailed();
|
|
15311
|
+
resolve();
|
|
15312
|
+
}
|
|
15313
|
+
channel.connect();
|
|
15314
|
+
});
|
|
15315
|
+
},
|
|
15316
|
+
onEnded(sessionId, handler) {
|
|
15317
|
+
listen();
|
|
15318
|
+
let active = true;
|
|
15319
|
+
const known = ended.get(sessionId);
|
|
15320
|
+
if (known) {
|
|
15321
|
+
queueMicrotask(() => {
|
|
15322
|
+
if (!active) return;
|
|
15323
|
+
active = false;
|
|
15324
|
+
deliver(handler, known);
|
|
15325
|
+
});
|
|
15326
|
+
return () => {
|
|
15327
|
+
active = false;
|
|
15328
|
+
};
|
|
15329
|
+
}
|
|
15330
|
+
const once = (ending) => {
|
|
15331
|
+
if (!active) return;
|
|
15332
|
+
active = false;
|
|
15333
|
+
handler(ending);
|
|
15334
|
+
};
|
|
15335
|
+
let set = handlers.get(sessionId);
|
|
15336
|
+
if (!set) {
|
|
15337
|
+
set = /* @__PURE__ */ new Set();
|
|
15338
|
+
handlers.set(sessionId, set);
|
|
15339
|
+
}
|
|
15340
|
+
set.add(once);
|
|
15341
|
+
return () => {
|
|
15342
|
+
active = false;
|
|
15343
|
+
const current = handlers.get(sessionId);
|
|
15344
|
+
current?.delete(once);
|
|
15345
|
+
if (current?.size === 0) handlers.delete(sessionId);
|
|
15217
15346
|
};
|
|
15218
15347
|
}
|
|
15219
15348
|
};
|
|
15220
15349
|
}
|
|
15350
|
+
function deliver(handler, ended) {
|
|
15351
|
+
try {
|
|
15352
|
+
handler(ended);
|
|
15353
|
+
} catch (error) {
|
|
15354
|
+
queueMicrotask(() => {
|
|
15355
|
+
throw error;
|
|
15356
|
+
});
|
|
15357
|
+
}
|
|
15358
|
+
}
|
|
15359
|
+
function parseEnding(frame) {
|
|
15360
|
+
const { session_id: sessionId, state, reason, detail, refusal } = frame;
|
|
15361
|
+
if (typeof sessionId !== "string" || state !== "ended" || typeof reason !== "string") return null;
|
|
15362
|
+
if (detail !== null && typeof detail !== "string") return null;
|
|
15363
|
+
if (refusal !== void 0 && refusal !== null && typeof refusal !== "string") return null;
|
|
15364
|
+
return {
|
|
15365
|
+
sessionId,
|
|
15366
|
+
ended: {
|
|
15367
|
+
reason,
|
|
15368
|
+
detail,
|
|
15369
|
+
refusal: typeof refusal === "string" ? refusal : null
|
|
15370
|
+
}
|
|
15371
|
+
};
|
|
15372
|
+
}
|
|
15221
15373
|
|
|
15222
15374
|
// src/filter-json.ts
|
|
15223
15375
|
function filterJson(filter) {
|
|
@@ -16123,7 +16275,7 @@ function createClient(options) {
|
|
|
16123
16275
|
const actions = createActionsApi(commandTransport, jobSubscriptions);
|
|
16124
16276
|
const services = createServicesApi(commandTransport, jobSubscriptions);
|
|
16125
16277
|
const publishers = createPublishersApi(commandTransport);
|
|
16126
|
-
const cameras = createCamerasApi(http);
|
|
16278
|
+
const cameras = createCamerasApi(http, createLiveSessionEndings(channel));
|
|
16127
16279
|
const jobs = createJobsApi(http);
|
|
16128
16280
|
const assets = createAssetsApi(http);
|
|
16129
16281
|
const robots = createRobotsApi(http);
|
|
@@ -16165,7 +16317,9 @@ export {
|
|
|
16165
16317
|
CANCEL_RETURN_CODES,
|
|
16166
16318
|
FleetlessError,
|
|
16167
16319
|
InMemoryTokenStore,
|
|
16320
|
+
LIVE_START_REFUSALS,
|
|
16168
16321
|
SDK_ERROR_CODES,
|
|
16322
|
+
cameraOfflineDetails,
|
|
16169
16323
|
cancelRejectedDetails,
|
|
16170
16324
|
createClient,
|
|
16171
16325
|
parameterInvalidDetails,
|