@fleetless/sdk 5.2.0 → 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 +18 -0
- package/README.md +3 -1
- package/dist/index.cjs +1310 -1090
- package/dist/index.d.cts +205 -7
- package/dist/index.d.ts +205 -7
- package/dist/index.js +1308 -1090
- 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,
|
|
@@ -4438,7 +4438,22 @@ var rosGraph = z20.object({
|
|
|
4438
4438
|
topics: z20.array(rosGraphEntry),
|
|
4439
4439
|
services: z20.array(rosGraphEntry),
|
|
4440
4440
|
actions: z20.array(rosGraphEntry),
|
|
4441
|
-
captured_at_ms: z20.number().int().nonnegative()
|
|
4441
|
+
captured_at_ms: z20.number().int().nonnegative(),
|
|
4442
|
+
/**
|
|
4443
|
+
* How many entries of each list the bridge left out because the graph did
|
|
4444
|
+
* not fit `BRIDGE_FRAME_MAX_BYTES` (fleetless/fleetless#1222); absent when
|
|
4445
|
+
* the graph is complete. The bridge keeps first every name the applied
|
|
4446
|
+
* configuration references, then fills up in name order, so a validation
|
|
4447
|
+
* against the published config stays exact; a name that is missing may
|
|
4448
|
+
* still exist on the robot.
|
|
4449
|
+
*/
|
|
4450
|
+
omitted: z20.object({
|
|
4451
|
+
topics: z20.number().int().nonnegative(),
|
|
4452
|
+
services: z20.number().int().nonnegative(),
|
|
4453
|
+
actions: z20.number().int().nonnegative()
|
|
4454
|
+
}).optional().meta({
|
|
4455
|
+
description: "How many entries of each list the bridge left out because the graph did not fit `BRIDGE_FRAME_MAX_BYTES`; absent when the graph is complete."
|
|
4456
|
+
})
|
|
4442
4457
|
});
|
|
4443
4458
|
var typeField = z20.lazy(() => z20.object({
|
|
4444
4459
|
name: z20.string().min(1).max(128),
|
|
@@ -4467,11 +4482,25 @@ var typeDefinition = z20.discriminatedUnion("kind", [
|
|
|
4467
4482
|
})
|
|
4468
4483
|
]);
|
|
4469
4484
|
|
|
4470
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4485
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/jobs.js
|
|
4471
4486
|
import { z as z21 } from "zod";
|
|
4472
4487
|
var jobState = z21.enum(["running", "unknown", "succeeded", "failed", "cancelled", "lost"]);
|
|
4473
4488
|
var reportedJobState = jobState.exclude(["unknown"]);
|
|
4474
4489
|
var jobOrigin = z21.enum(["fleetless", "external"]);
|
|
4490
|
+
var resultOmitted = z21.object({
|
|
4491
|
+
reason: z21.enum(["too_large"]).meta({
|
|
4492
|
+
description: "Why the result was left out. `too_large`: its frame would have exceeded the robot's frame limit."
|
|
4493
|
+
}),
|
|
4494
|
+
bytes: z21.number().int().positive().meta({
|
|
4495
|
+
description: "The size of the result alone, serialised as JSON, in bytes."
|
|
4496
|
+
}),
|
|
4497
|
+
limit_bytes: z21.number().int().positive().meta({
|
|
4498
|
+
description: "The frame limit the robot applied, in bytes (`BRIDGE_FRAME_MAX_BYTES`, 1.5 MiB)."
|
|
4499
|
+
})
|
|
4500
|
+
}).meta({
|
|
4501
|
+
description: "The robot had a result and did not send it because it was too large; `result` is `null`. The state is unchanged, and the result cannot be fetched later."
|
|
4502
|
+
});
|
|
4503
|
+
var RESULT_OMITTED_DESCRIPTION = "Present when the robot had a result and did not send it because it was too large; `result` is `null` then. The state is unchanged: a goal that succeeded is still `succeeded`. Absent otherwise.";
|
|
4475
4504
|
var job = z21.object({
|
|
4476
4505
|
id: z21.uuid().meta({
|
|
4477
4506
|
description: "The job's id, minted by the cloud when the invocation is accepted. Informative \u2014 state is observed by slug; a cancel names this id to stop one specific job rather than whatever is running."
|
|
@@ -4512,8 +4541,9 @@ var job = z21.object({
|
|
|
4512
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."
|
|
4513
4542
|
}),
|
|
4514
4543
|
result: z21.unknown().nullable().meta({
|
|
4515
|
-
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`)."
|
|
4516
4545
|
}),
|
|
4546
|
+
result_omitted: resultOmitted.optional().meta({ description: RESULT_OMITTED_DESCRIPTION }),
|
|
4517
4547
|
/**
|
|
4518
4548
|
* Present on `failed`; a human message, plus a code where one exists.
|
|
4519
4549
|
*
|
|
@@ -4550,6 +4580,8 @@ var jobEvent = z21.object({
|
|
|
4550
4580
|
feedback: z21.unknown().nullable(),
|
|
4551
4581
|
/** 0..1 when the action reports progress; null when it does not. */
|
|
4552
4582
|
progress: z21.number().min(0).max(1).nullable(),
|
|
4583
|
+
/** The job's own `result_omitted`, repeated so a consumer of the event alone sees it — see `resultOmitted`. */
|
|
4584
|
+
result_omitted: resultOmitted.optional().meta({ description: RESULT_OMITTED_DESCRIPTION }),
|
|
4553
4585
|
timestamp_ms: z21.number().int().nonnegative()
|
|
4554
4586
|
});
|
|
4555
4587
|
var busyDetails = z21.object({
|
|
@@ -4623,8 +4655,9 @@ var jobRun = z21.object({
|
|
|
4623
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".'
|
|
4624
4656
|
}),
|
|
4625
4657
|
result: z21.unknown().nullable().meta({
|
|
4626
|
-
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`)."
|
|
4627
4659
|
}),
|
|
4660
|
+
result_omitted: resultOmitted.optional().meta({ description: RESULT_OMITTED_DESCRIPTION }),
|
|
4628
4661
|
error: z21.object({
|
|
4629
4662
|
code: z21.string().min(1).meta({
|
|
4630
4663
|
description: "A machine-readable code for the failure, such as `job_queue_full`, where one exists for it."
|
|
@@ -4704,7 +4737,7 @@ var jobRunSummary = z21.object({
|
|
|
4704
4737
|
since_ms: z21.number().int().nonnegative()
|
|
4705
4738
|
});
|
|
4706
4739
|
|
|
4707
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4740
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/protocol.js
|
|
4708
4741
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
4709
4742
|
var MAX_PATIENCE_MS = 12e4;
|
|
4710
4743
|
var MIN_PATIENCE_MS = 1e3;
|
|
@@ -4766,6 +4799,17 @@ var datapointFrame = z22.object({
|
|
|
4766
4799
|
timestamp_ms: z22.number().int().nonnegative(),
|
|
4767
4800
|
backfill: z22.boolean().optional().meta({ description: "true when the sample was captured while the bridge was disconnected and is being replayed after the reconnect. The cloud keeps such a sample out of its lag measure; absent means live." })
|
|
4768
4801
|
});
|
|
4802
|
+
var bridgeDatapointDropped = z22.object({
|
|
4803
|
+
type: z22.literal("datapoint_dropped"),
|
|
4804
|
+
slug,
|
|
4805
|
+
reason: z22.enum(["too_large"]),
|
|
4806
|
+
/** The size of the frame that was not sent, in bytes. */
|
|
4807
|
+
bytes: z22.number().int().positive(),
|
|
4808
|
+
/** `BRIDGE_FRAME_MAX_BYTES` as the bridge applied it. */
|
|
4809
|
+
limit_bytes: z22.number().int().positive(),
|
|
4810
|
+
/** Bridge capture time of the dropped sample, like `datapointFrame.timestamp_ms`. */
|
|
4811
|
+
timestamp_ms: z22.number().int().nonnegative()
|
|
4812
|
+
});
|
|
4769
4813
|
var cloudPing = z22.object({
|
|
4770
4814
|
type: z22.literal("ping"),
|
|
4771
4815
|
ts_ms: z22.number().int().nonnegative(),
|
|
@@ -4782,6 +4826,14 @@ var bridgeLinkMode = z22.object({
|
|
|
4782
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." }),
|
|
4783
4827
|
at_ms: z22.number().int().nonnegative().meta({ description: "Bridge time of the transition, epoch milliseconds." })
|
|
4784
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
|
+
});
|
|
4785
4837
|
var cloudConfig = z22.object({
|
|
4786
4838
|
type: z22.literal("config"),
|
|
4787
4839
|
version: z22.number().int().nonnegative(),
|
|
@@ -4885,6 +4937,8 @@ var bridgeJobUpdate = z22.object({
|
|
|
4885
4937
|
feedback: z22.unknown().nullable(),
|
|
4886
4938
|
progress: z22.number().min(0).max(1).nullable(),
|
|
4887
4939
|
result: z22.unknown().nullable(),
|
|
4940
|
+
/** The robot had a result and did not send it because it was too large; `result` is `null`. See `resultOmitted`. */
|
|
4941
|
+
result_omitted: resultOmitted.optional(),
|
|
4888
4942
|
/** Same shape as `job.error`, `details` included — see `jobs.ts`. */
|
|
4889
4943
|
error: z22.object({ code: z22.string().min(1), message: z22.string().min(1), details: z22.unknown().optional() }).nullable(),
|
|
4890
4944
|
timestamp_ms: z22.number().int().nonnegative()
|
|
@@ -4906,6 +4960,8 @@ var bridgeJobStatusEntry = z22.object({
|
|
|
4906
4960
|
feedback: z22.unknown().nullable(),
|
|
4907
4961
|
progress: z22.number().min(0).max(1).nullable(),
|
|
4908
4962
|
result: z22.unknown().nullable(),
|
|
4963
|
+
/** The robot had a result and did not send it because it was too large; `result` is `null`. See `resultOmitted`. */
|
|
4964
|
+
result_omitted: resultOmitted.optional(),
|
|
4909
4965
|
/** Same shape as `job.error`, `details` included — see `jobs.ts`. */
|
|
4910
4966
|
error: z22.object({ code: z22.string().min(1), message: z22.string().min(1), details: z22.unknown().optional() }).nullable()
|
|
4911
4967
|
});
|
|
@@ -4939,7 +4995,10 @@ var bridgeState = z22.object({
|
|
|
4939
4995
|
online: z22.boolean(),
|
|
4940
4996
|
latency_ms: z22.number().nonnegative().nullable(),
|
|
4941
4997
|
low_bandwidth: z22.boolean().meta({ description: "Whether the bridge is in its low-bandwidth mode: datapoints capped, cameras reduced or stopped. Bridge-reported." }),
|
|
4942
|
-
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." })
|
|
4943
5002
|
});
|
|
4944
5003
|
var snapshotHeader = z22.object({
|
|
4945
5004
|
type: z22.literal("snapshot"),
|
|
@@ -5103,11 +5162,11 @@ var bridgeCameraState = z22.object({
|
|
|
5103
5162
|
request_id: z22.string().min(1).max(64).nullable()
|
|
5104
5163
|
});
|
|
5105
5164
|
|
|
5106
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5165
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/config-issues.js
|
|
5107
5166
|
var EXPOSURE_SECTIONS = ["datapoints", "actions", "services", "publishers", "cameras"];
|
|
5108
5167
|
var EXPOSURE_SECTION_NAMES = new Set(EXPOSURE_SECTIONS);
|
|
5109
5168
|
|
|
5110
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5169
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/org-roles.js
|
|
5111
5170
|
import { z as z23 } from "zod";
|
|
5112
5171
|
var roleName = z23.string().trim().min(1).max(ROLE_NAME_MAX);
|
|
5113
5172
|
var referencePlace = z23.object({
|
|
@@ -5246,7 +5305,7 @@ var putRoleDefaultsRequest = z23.object({
|
|
|
5246
5305
|
})
|
|
5247
5306
|
}).strict();
|
|
5248
5307
|
|
|
5249
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5308
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/rest.js
|
|
5250
5309
|
import { z as z24 } from "zod";
|
|
5251
5310
|
var robot2 = z24.object({
|
|
5252
5311
|
id: z24.uuid().meta({
|
|
@@ -5384,7 +5443,16 @@ var configVersionResponse = z24.object({
|
|
|
5384
5443
|
var introspectionResponse = z24.object({
|
|
5385
5444
|
graph: rosGraph,
|
|
5386
5445
|
fetched_at: z24.iso.datetime(),
|
|
5387
|
-
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
|
+
})
|
|
5388
5456
|
});
|
|
5389
5457
|
var typesResponse = z24.object({
|
|
5390
5458
|
types: z24.array(typeDefinition)
|
|
@@ -5482,6 +5550,15 @@ var invokeResponse = z24.object({
|
|
|
5482
5550
|
var serviceCallResponse = z24.object({
|
|
5483
5551
|
result: z24.unknown().meta({
|
|
5484
5552
|
description: "What the service returned, shaped by the ROS service. A service call is awaited to completion, so there is no job to observe afterwards and no id to hold on to."
|
|
5553
|
+
}),
|
|
5554
|
+
/**
|
|
5555
|
+
* The service answered, and its response did not fit the robot's frame
|
|
5556
|
+
* limit (fleetless/fleetless#1222): `result` is `null` and this says why.
|
|
5557
|
+
* Without it, an omitted response would read as a service that returned
|
|
5558
|
+
* nothing.
|
|
5559
|
+
*/
|
|
5560
|
+
result_omitted: resultOmitted.optional().meta({
|
|
5561
|
+
description: "Present when the service answered and the robot did not send the response because it was too large; `result` is `null` then. Absent otherwise."
|
|
5485
5562
|
})
|
|
5486
5563
|
});
|
|
5487
5564
|
var invokeOrServiceResponse = z24.union([invokeResponse, serviceCallResponse]);
|
|
@@ -5844,6 +5921,7 @@ var robotDeleteQuery = z24.object({
|
|
|
5844
5921
|
description: "Pass `true` to delete a robot that has a live session open; without it that is `409 robot_in_use`. **`true` and nothing else** \u2014 any other value is `400 validation_error`, reported against the field `force` with rule `invalid_value`, so a caller is never left believing they forced a deletion they did not. The deletion is a full cascade, which is why saying it is the whole decision."
|
|
5845
5922
|
})
|
|
5846
5923
|
}).meta({ description: "The one optional parameter of `DELETE /api/robots/:id`, and it is the difference between a refusal and a cascade. It accepts the exact string `true`, or its own absence, and refuses everything else." });
|
|
5924
|
+
var RESOURCE_HEALTH_KINDS = ["camera", "datapoint"];
|
|
5847
5925
|
var RESOURCE_HEALTH_STATES = [
|
|
5848
5926
|
"ok",
|
|
5849
5927
|
/** The host did not answer. Not the same as refusing the password. */
|
|
@@ -5875,6 +5953,19 @@ var RESOURCE_HEALTH_STATES = [
|
|
|
5875
5953
|
"stopped_by_config_change",
|
|
5876
5954
|
/** Publishing failed after the session was already granted. */
|
|
5877
5955
|
"publish_failed",
|
|
5956
|
+
/**
|
|
5957
|
+
* The robot dropped the last value because its frame exceeded
|
|
5958
|
+
* `BRIDGE_FRAME_MAX_BYTES` (a datapoint only, fleetless/fleetless#1222).
|
|
5959
|
+
* `reason` names the size and the limit, built from numbers only.
|
|
5960
|
+
*/
|
|
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",
|
|
5878
5969
|
/**
|
|
5879
5970
|
* Something is wrong and this platform cannot say what.
|
|
5880
5971
|
*
|
|
@@ -5889,8 +5980,8 @@ var RESOURCE_HEALTH_STATES = [
|
|
|
5889
5980
|
];
|
|
5890
5981
|
var resourceHealthState = z24.object({
|
|
5891
5982
|
robot_id: z24.uuid(),
|
|
5892
|
-
kind: z24.enum(
|
|
5893
|
-
/** The camera
|
|
5983
|
+
kind: z24.enum(RESOURCE_HEALTH_KINDS),
|
|
5984
|
+
/** The camera or datapoint slug. */
|
|
5894
5985
|
ref: z24.string().min(1).max(64),
|
|
5895
5986
|
/**
|
|
5896
5987
|
* **Which of two questions this entry answers.**
|
|
@@ -6054,20 +6145,30 @@ var slugUsageResponse = z24.object({
|
|
|
6054
6145
|
alert_count: z24.number().int().nonnegative()
|
|
6055
6146
|
});
|
|
6056
6147
|
|
|
6057
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6058
|
-
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";
|
|
6059
6150
|
|
|
6060
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
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";
|
|
6163
|
+
|
|
6164
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/apps.js
|
|
6061
6165
|
import { z as z28 } from "zod";
|
|
6062
6166
|
|
|
6063
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6167
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-rights.js
|
|
6064
6168
|
import { z as z27 } from "zod";
|
|
6065
6169
|
|
|
6066
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6170
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections.js
|
|
6067
6171
|
import { z as z26 } from "zod";
|
|
6068
|
-
|
|
6069
|
-
// node_modules/.pnpm/@fleetless+contracts@18.1.0/node_modules/@fleetless/contracts/dist/collections.js
|
|
6070
|
-
import { z as z25 } from "zod";
|
|
6071
6172
|
var COLLECTIONS_FORMAT_VERSION = 1;
|
|
6072
6173
|
var COLLECTION_LIMITS = {
|
|
6073
6174
|
/** Collections in one document. */
|
|
@@ -6124,13 +6225,13 @@ var COLLECTION_LIMITS = {
|
|
|
6124
6225
|
importErrorText: 200
|
|
6125
6226
|
};
|
|
6126
6227
|
var KEY_RULE = /^[a-z][a-z0-9_]{0,62}$/;
|
|
6127
|
-
var collectionKey =
|
|
6228
|
+
var collectionKey = z26.string().regex(KEY_RULE, {
|
|
6128
6229
|
message: "A key starts with a lowercase letter and continues with lowercase letters, digits or underscores, up to 63 characters in all."
|
|
6129
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." });
|
|
6130
|
-
var collectionBinding =
|
|
6231
|
+
var collectionBinding = z26.enum(["global", "per_robot", "one_per_robot"]).meta({
|
|
6131
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."
|
|
6132
6233
|
});
|
|
6133
|
-
var collectionFieldType =
|
|
6234
|
+
var collectionFieldType = z26.enum([
|
|
6134
6235
|
"text",
|
|
6135
6236
|
"long_text",
|
|
6136
6237
|
"number",
|
|
@@ -6141,70 +6242,70 @@ var collectionFieldType = z25.enum([
|
|
|
6141
6242
|
"json",
|
|
6142
6243
|
"reference"
|
|
6143
6244
|
]);
|
|
6144
|
-
var label =
|
|
6145
|
-
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." });
|
|
6146
6247
|
var common2 = {
|
|
6147
6248
|
label: label.optional(),
|
|
6148
6249
|
description: description.optional(),
|
|
6149
|
-
required:
|
|
6150
|
-
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({
|
|
6151
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."
|
|
6152
6253
|
}).optional(),
|
|
6153
|
-
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()
|
|
6154
6255
|
};
|
|
6155
|
-
var textField =
|
|
6156
|
-
type:
|
|
6256
|
+
var textField = z26.object({
|
|
6257
|
+
type: z26.literal("text"),
|
|
6157
6258
|
...common2,
|
|
6158
|
-
max_length:
|
|
6159
|
-
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({
|
|
6160
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.`
|
|
6161
6262
|
}).optional(),
|
|
6162
|
-
searchable:
|
|
6263
|
+
searchable: z26.boolean().meta({ description: "Include this field in the `search` of record lists." }).optional()
|
|
6163
6264
|
}).strict();
|
|
6164
|
-
var longTextField =
|
|
6165
|
-
type:
|
|
6265
|
+
var longTextField = z26.object({
|
|
6266
|
+
type: z26.literal("long_text"),
|
|
6166
6267
|
...common2,
|
|
6167
|
-
max_length:
|
|
6168
|
-
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()
|
|
6169
6270
|
}).strict();
|
|
6170
|
-
var numberField =
|
|
6171
|
-
type:
|
|
6271
|
+
var numberField = z26.object({
|
|
6272
|
+
type: z26.literal("number"),
|
|
6172
6273
|
...common2,
|
|
6173
|
-
integer:
|
|
6174
|
-
min:
|
|
6175
|
-
max:
|
|
6176
|
-
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()
|
|
6177
6278
|
}).strict();
|
|
6178
|
-
var booleanField =
|
|
6179
|
-
var selectOption =
|
|
6180
|
-
value:
|
|
6181
|
-
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()
|
|
6182
6283
|
}).strict();
|
|
6183
|
-
var selectField =
|
|
6184
|
-
type:
|
|
6284
|
+
var selectField = z26.object({
|
|
6285
|
+
type: z26.literal("select"),
|
|
6185
6286
|
...common2,
|
|
6186
|
-
options:
|
|
6187
|
-
multiple:
|
|
6188
|
-
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()
|
|
6189
6290
|
}).strict();
|
|
6190
|
-
var dateField =
|
|
6191
|
-
var datetimeField =
|
|
6192
|
-
var jsonField =
|
|
6193
|
-
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"),
|
|
6194
6295
|
...common2,
|
|
6195
|
-
schema:
|
|
6296
|
+
schema: z26.union([z26.string(), z26.record(z26.string(), z26.unknown())]).meta({
|
|
6196
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."
|
|
6197
6298
|
}).optional()
|
|
6198
6299
|
}).strict();
|
|
6199
|
-
var referenceField =
|
|
6200
|
-
type:
|
|
6300
|
+
var referenceField = z26.object({
|
|
6301
|
+
type: z26.literal("reference"),
|
|
6201
6302
|
...common2,
|
|
6202
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." }),
|
|
6203
|
-
on_delete:
|
|
6304
|
+
on_delete: z26.enum(["prevent", "clear"]).meta({
|
|
6204
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."
|
|
6205
6306
|
}).optional()
|
|
6206
6307
|
}).strict();
|
|
6207
|
-
var collectionField =
|
|
6308
|
+
var collectionField = z26.discriminatedUnion("type", [
|
|
6208
6309
|
textField,
|
|
6209
6310
|
longTextField,
|
|
6210
6311
|
numberField,
|
|
@@ -6215,71 +6316,71 @@ var collectionField = z25.discriminatedUnion("type", [
|
|
|
6215
6316
|
jsonField,
|
|
6216
6317
|
referenceField
|
|
6217
6318
|
]);
|
|
6218
|
-
var collectionAccessValue =
|
|
6219
|
-
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({
|
|
6220
6321
|
all: collectionAccessValue.meta({ description: "Roles that may do this to every record." }).optional(),
|
|
6221
6322
|
own: collectionAccessValue.meta({ description: "Roles that may do this only to records they created themselves." }).optional()
|
|
6222
6323
|
}).strict();
|
|
6223
|
-
var collectionAccess =
|
|
6324
|
+
var collectionAccess = z26.object({
|
|
6224
6325
|
read: collectionAccessValue.meta({ description: "Roles that may read records." }).optional(),
|
|
6225
6326
|
create: collectionAccessValue.meta({ description: "Roles that may create records. Has no effect on `one_per_robot` collections, whose records Fleetless creates." }).optional(),
|
|
6226
|
-
update:
|
|
6227
|
-
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()
|
|
6228
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." });
|
|
6229
|
-
var collectionDefinition =
|
|
6230
|
-
label:
|
|
6231
|
-
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(),
|
|
6232
6333
|
binding: collectionBinding,
|
|
6233
|
-
display:
|
|
6334
|
+
display: z26.string().meta({
|
|
6234
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>`."
|
|
6235
6336
|
}).optional(),
|
|
6236
6337
|
access: collectionAccess.optional(),
|
|
6237
|
-
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.` })
|
|
6238
6339
|
}).strict();
|
|
6239
|
-
var collectionsMap =
|
|
6240
|
-
var collectionsDocument =
|
|
6241
|
-
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}.` }),
|
|
6242
6343
|
// A codec on the property and not a preprocess on the document: the published JSON Schema then says `object | null` and still lists
|
|
6243
6344
|
// `collections` as required, and the parsed value (and the output schema) is the plain map.
|
|
6244
|
-
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.` })
|
|
6245
6346
|
}).strict().meta({ description: "The data model of an app: its collections, their fields, and who may use them." });
|
|
6246
6347
|
|
|
6247
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6248
|
-
var records =
|
|
6249
|
-
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({
|
|
6250
6351
|
collection: collectionKey.meta({ description: "The collection's key." }),
|
|
6251
|
-
label:
|
|
6352
|
+
label: z27.string().meta({ description: "The collection's label for people to read; its key when the schema gives none." }),
|
|
6252
6353
|
binding: collectionBinding,
|
|
6253
|
-
read:
|
|
6254
|
-
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." }),
|
|
6255
6356
|
update: records.meta({
|
|
6256
6357
|
description: "`all`: the role may change every record. `own`: only records its user created. `false`: none."
|
|
6257
6358
|
}),
|
|
6258
6359
|
delete: records.meta({
|
|
6259
6360
|
description: "`all`: the role may delete every record. `own`: only records its user created. `false`: none."
|
|
6260
6361
|
}),
|
|
6261
|
-
robot_filter:
|
|
6362
|
+
robot_filter: z27.boolean().meta({
|
|
6262
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."
|
|
6263
6364
|
})
|
|
6264
6365
|
}).meta({ description: "What one role may do with the records of one collection." });
|
|
6265
6366
|
|
|
6266
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6367
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/apps.js
|
|
6267
6368
|
var appIdentifier = slug;
|
|
6268
|
-
var app2 =
|
|
6269
|
-
id:
|
|
6369
|
+
var app2 = z28.object({
|
|
6370
|
+
id: z28.uuid().meta({
|
|
6270
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`."
|
|
6271
6372
|
}),
|
|
6272
|
-
org_id:
|
|
6373
|
+
org_id: z28.uuid().meta({
|
|
6273
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."
|
|
6274
6375
|
}),
|
|
6275
|
-
name:
|
|
6376
|
+
name: z28.string().min(1).max(120).meta({
|
|
6276
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`."
|
|
6277
6378
|
}),
|
|
6278
6379
|
identifier: appIdentifier.meta({
|
|
6279
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`."
|
|
6280
6381
|
}),
|
|
6281
6382
|
/** Robots are referenced individually; tags never grant rights. */
|
|
6282
|
-
robot_ids:
|
|
6383
|
+
robot_ids: z28.array(z28.uuid()).meta({
|
|
6283
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."
|
|
6284
6385
|
}),
|
|
6285
6386
|
/**
|
|
@@ -6301,83 +6402,83 @@ var app2 = z27.object({
|
|
|
6301
6402
|
default_role: roleKey.nullable().meta({
|
|
6302
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`."
|
|
6303
6404
|
}),
|
|
6304
|
-
created_at:
|
|
6405
|
+
created_at: z28.iso.datetime().meta({
|
|
6305
6406
|
description: "When the app was created, as an ISO 8601 timestamp. `GET /api/apps` orders by this field."
|
|
6306
6407
|
})
|
|
6307
6408
|
});
|
|
6308
|
-
var appListResponse =
|
|
6309
|
-
apps:
|
|
6409
|
+
var appListResponse = z28.object({
|
|
6410
|
+
apps: z28.array(app2).meta({
|
|
6310
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."
|
|
6311
6412
|
})
|
|
6312
6413
|
});
|
|
6313
|
-
var appDeletionSummary =
|
|
6314
|
-
user_count:
|
|
6414
|
+
var appDeletionSummary = z28.object({
|
|
6415
|
+
user_count: z28.number().int().nonnegative().meta({
|
|
6315
6416
|
description: "App users deleted with the app. They are the developer's own customers, not Fleetless users, and exist in no other app."
|
|
6316
6417
|
}),
|
|
6317
|
-
server_key_count:
|
|
6418
|
+
server_key_count: z28.number().int().nonnegative().meta({
|
|
6318
6419
|
description: "Server keys deleted with the app. A client still holding one is refused at its next request."
|
|
6319
6420
|
}),
|
|
6320
|
-
invitation_count:
|
|
6421
|
+
invitation_count: z28.number().int().nonnegative().meta({
|
|
6321
6422
|
description: "Outstanding invitations \u2014 unspent and unexpired \u2014 that will never be accepted."
|
|
6322
6423
|
}),
|
|
6323
|
-
oidc_provider_count:
|
|
6424
|
+
oidc_provider_count: z28.number().int().nonnegative().meta({
|
|
6324
6425
|
description: "Identity providers configured for this app. The providers themselves are somebody else's; only this app's configuration of them goes."
|
|
6325
6426
|
}),
|
|
6326
|
-
mail_template_count:
|
|
6427
|
+
mail_template_count: z28.number().int().nonnegative().meta({
|
|
6327
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."
|
|
6328
6429
|
}),
|
|
6329
|
-
collection_count:
|
|
6430
|
+
collection_count: z28.number().int().nonnegative().meta({
|
|
6330
6431
|
description: "Collections of the app's latest published schema. They go with the app, together with their records and history."
|
|
6331
6432
|
}),
|
|
6332
|
-
record_count:
|
|
6433
|
+
record_count: z28.number().int().nonnegative().meta({
|
|
6333
6434
|
description: "Records of the app's collections, deleted with the app."
|
|
6334
6435
|
})
|
|
6335
6436
|
});
|
|
6336
|
-
var createAppRequest =
|
|
6337
|
-
name:
|
|
6437
|
+
var createAppRequest = z28.object({
|
|
6438
|
+
name: z28.string().min(1).max(120),
|
|
6338
6439
|
identifier: appIdentifier,
|
|
6339
|
-
robot_ids:
|
|
6440
|
+
robot_ids: z28.array(z28.uuid()).optional()
|
|
6340
6441
|
}).strict();
|
|
6341
|
-
var updateAppRequest =
|
|
6342
|
-
name:
|
|
6343
|
-
robot_ids:
|
|
6442
|
+
var updateAppRequest = z28.object({
|
|
6443
|
+
name: z28.string().min(1).max(120).optional(),
|
|
6444
|
+
robot_ids: z28.array(z28.uuid()).optional()
|
|
6344
6445
|
}).strict();
|
|
6345
|
-
var serverKeyToken =
|
|
6346
|
-
var serverKey =
|
|
6347
|
-
id:
|
|
6446
|
+
var serverKeyToken = z28.string().regex(/^flk_[0-9a-f]{32}$/);
|
|
6447
|
+
var serverKey = z28.object({
|
|
6448
|
+
id: z28.uuid().meta({
|
|
6348
6449
|
description: "The key row, and what the rotate and delete routes address. It is not the key: this shape never carries the secret."
|
|
6349
6450
|
}),
|
|
6350
|
-
app_id:
|
|
6451
|
+
app_id: z28.uuid().meta({
|
|
6351
6452
|
description: "The app whose full rights this key carries. A key is never shared between apps."
|
|
6352
6453
|
}),
|
|
6353
|
-
name:
|
|
6454
|
+
name: z28.string().min(1).max(120).meta({
|
|
6354
6455
|
description: "A label the developer chose, so a key can be recognised before it is rotated or deleted."
|
|
6355
6456
|
}),
|
|
6356
|
-
created_at:
|
|
6457
|
+
created_at: z28.iso.datetime().meta({
|
|
6357
6458
|
description: "When the key was minted, as an ISO 8601 timestamp. `GET /api/apps/:id/server-keys` orders by this field."
|
|
6358
6459
|
}),
|
|
6359
6460
|
/** Null until first use — the cheapest way to spot a key nobody needs. */
|
|
6360
|
-
last_used_at:
|
|
6461
|
+
last_used_at: z28.iso.datetime().nullable().meta({
|
|
6361
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."
|
|
6362
6463
|
})
|
|
6363
6464
|
});
|
|
6364
|
-
var serverKeyListResponse =
|
|
6365
|
-
server_keys:
|
|
6465
|
+
var serverKeyListResponse = z28.object({
|
|
6466
|
+
server_keys: z28.array(serverKey).meta({
|
|
6366
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."
|
|
6367
6468
|
})
|
|
6368
6469
|
});
|
|
6369
|
-
var createServerKeyResponse =
|
|
6470
|
+
var createServerKeyResponse = z28.object({
|
|
6370
6471
|
server_key: serverKey,
|
|
6371
6472
|
key: serverKeyToken
|
|
6372
6473
|
});
|
|
6373
6474
|
var MAX_LOCK_SLUGS = 2e3;
|
|
6374
6475
|
var MAX_APP_LOCKS = 1e3;
|
|
6375
6476
|
var namedOnce = (items) => new Set(items).size === items.length;
|
|
6376
|
-
var appLock =
|
|
6377
|
-
robot_id:
|
|
6477
|
+
var appLock = z28.object({
|
|
6478
|
+
robot_id: z28.uuid().meta({
|
|
6378
6479
|
description: "The robot whose capabilities are locked for this app."
|
|
6379
6480
|
}),
|
|
6380
|
-
slugs:
|
|
6481
|
+
slugs: z28.array(slug).min(1).max(MAX_LOCK_SLUGS).refine(namedOnce, { message: "Name each slug once." }).meta({
|
|
6381
6482
|
uniqueItems: true,
|
|
6382
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.`
|
|
6383
6484
|
})
|
|
@@ -6386,245 +6487,245 @@ var appAccessFields = {
|
|
|
6386
6487
|
default_role: roleKey.nullable().meta({
|
|
6387
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."
|
|
6388
6489
|
}),
|
|
6389
|
-
locked_kinds:
|
|
6490
|
+
locked_kinds: z28.array(accessKind).max(ACCESS_KINDS.length).refine(namedOnce, { message: "Name each kind once." }).meta({
|
|
6390
6491
|
uniqueItems: true,
|
|
6391
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."
|
|
6392
6493
|
}),
|
|
6393
|
-
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({
|
|
6394
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.`
|
|
6395
6496
|
})
|
|
6396
6497
|
};
|
|
6397
|
-
var appAccessRevision =
|
|
6498
|
+
var appAccessRevision = z28.string().regex(/^[0-9a-f]{64}$/).meta({
|
|
6398
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."
|
|
6399
6500
|
});
|
|
6400
|
-
var appAccess =
|
|
6501
|
+
var appAccess = z28.object({
|
|
6401
6502
|
...appAccessFields,
|
|
6402
6503
|
revision: appAccessRevision.optional().meta({
|
|
6403
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."
|
|
6404
6505
|
})
|
|
6405
6506
|
}).strict();
|
|
6406
|
-
var accessWarning =
|
|
6407
|
-
code:
|
|
6507
|
+
var accessWarning = z28.object({
|
|
6508
|
+
code: z28.enum(["unknown_default_role", "unknown_lock_slug", "lock_robot_not_attached"]).meta({
|
|
6408
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."
|
|
6409
6510
|
}),
|
|
6410
|
-
message:
|
|
6511
|
+
message: z28.string().min(1).meta({
|
|
6411
6512
|
description: "A sentence a person can read, naming the key, robot or slug."
|
|
6412
6513
|
}),
|
|
6413
|
-
robot_id:
|
|
6514
|
+
robot_id: z28.uuid().nullable().meta({
|
|
6414
6515
|
description: "The robot a lock warning is about; `null` for `unknown_default_role`."
|
|
6415
6516
|
}),
|
|
6416
|
-
slug:
|
|
6517
|
+
slug: z28.string().nullable().meta({
|
|
6417
6518
|
description: "The slug an `unknown_lock_slug` warning is about; `null` for the other warnings."
|
|
6418
6519
|
})
|
|
6419
6520
|
});
|
|
6420
|
-
var appAccessResponse =
|
|
6521
|
+
var appAccessResponse = z28.object({
|
|
6421
6522
|
...appAccessFields,
|
|
6422
6523
|
revision: appAccessRevision.meta({
|
|
6423
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."
|
|
6424
6525
|
}),
|
|
6425
|
-
warnings:
|
|
6526
|
+
warnings: z28.array(accessWarning).meta({
|
|
6426
6527
|
description: "What the access names that does not exist as written. Empty when nothing is out of step."
|
|
6427
6528
|
})
|
|
6428
6529
|
});
|
|
6429
|
-
var effectiveRightsQuery =
|
|
6530
|
+
var effectiveRightsQuery = z28.object({
|
|
6430
6531
|
role: roleKey.optional().meta({
|
|
6431
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."
|
|
6432
6533
|
}),
|
|
6433
|
-
user:
|
|
6534
|
+
user: z28.uuid().optional().meta({
|
|
6434
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`."
|
|
6435
6536
|
})
|
|
6436
6537
|
}).strict().refine((query) => query.role === void 0 !== (query.user === void 0), {
|
|
6437
6538
|
message: "Name exactly one of role and user."
|
|
6438
6539
|
});
|
|
6439
|
-
var effectiveCapability =
|
|
6540
|
+
var effectiveCapability = z28.object({
|
|
6440
6541
|
name: slug.meta({
|
|
6441
6542
|
description: "The exposure's slug, or `assets` or `job_history` for the capabilities that belong to the robot as a whole."
|
|
6442
6543
|
}),
|
|
6443
6544
|
kind: accessKind.meta({
|
|
6444
6545
|
description: "The kind of access the capability needs."
|
|
6445
6546
|
}),
|
|
6446
|
-
granted:
|
|
6547
|
+
granted: z28.boolean().meta({
|
|
6447
6548
|
description: "Whether the role may use it: its requirement is met and the app has not locked it."
|
|
6448
6549
|
}),
|
|
6449
|
-
requirement:
|
|
6550
|
+
requirement: z28.array(z28.string()).meta({
|
|
6450
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."
|
|
6451
6552
|
}),
|
|
6452
|
-
source:
|
|
6553
|
+
source: z28.enum(["entry", "rule", "robot", "org_default"]).meta({
|
|
6453
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."
|
|
6454
6555
|
}),
|
|
6455
|
-
rule_index:
|
|
6556
|
+
rule_index: z28.number().int().nonnegative().nullable().meta({
|
|
6456
6557
|
description: "For `rule`, the position of the deciding rule in `access.rules`, counted from zero; `null` otherwise."
|
|
6457
6558
|
}),
|
|
6458
|
-
rule_match:
|
|
6559
|
+
rule_match: z28.string().nullable().meta({
|
|
6459
6560
|
description: "For `rule`, that rule's `match` glob; `null` otherwise."
|
|
6460
6561
|
}),
|
|
6461
|
-
satisfied_by:
|
|
6562
|
+
satisfied_by: z28.string().nullable().meta({
|
|
6462
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."
|
|
6463
6564
|
}),
|
|
6464
|
-
locked:
|
|
6565
|
+
locked: z28.boolean().meta({
|
|
6465
6566
|
description: "Whether the app locks this capability, as a kind or as a single lock. A lock wins over the requirement."
|
|
6466
6567
|
}),
|
|
6467
|
-
unknown_roles:
|
|
6568
|
+
unknown_roles: z28.array(z28.string()).meta({
|
|
6468
6569
|
description: "Keys in the requirement that name no role of the organization. They grant nothing."
|
|
6469
6570
|
})
|
|
6470
6571
|
});
|
|
6471
|
-
var effectiveRobotRights =
|
|
6472
|
-
robot_id:
|
|
6473
|
-
robot_name:
|
|
6474
|
-
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({
|
|
6475
6576
|
description: "The version of the robot's published `fleetless.yaml` that the answer was computed from; `null` when nothing is published."
|
|
6476
6577
|
}),
|
|
6477
|
-
reachable:
|
|
6578
|
+
reachable: z28.boolean().meta({
|
|
6478
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."
|
|
6479
6580
|
}),
|
|
6480
|
-
capabilities:
|
|
6581
|
+
capabilities: z28.array(effectiveCapability).meta({
|
|
6481
6582
|
description: "Every capability of the published configuration, and `assets` and `job_history`, each granted or not."
|
|
6482
6583
|
}),
|
|
6483
6584
|
datasheet: mcpRobotDatasheet.meta({
|
|
6484
6585
|
description: "The datasheet an MCP session of this role would get for the robot."
|
|
6485
6586
|
})
|
|
6486
6587
|
});
|
|
6487
|
-
var effectiveRightsResponse =
|
|
6488
|
-
role:
|
|
6588
|
+
var effectiveRightsResponse = z28.object({
|
|
6589
|
+
role: z28.string().nullable().meta({
|
|
6489
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."
|
|
6490
6591
|
}),
|
|
6491
|
-
role_known:
|
|
6592
|
+
role_known: z28.boolean().meta({
|
|
6492
6593
|
description: "Whether the key names a role of the organization. `false` means every capability below is not granted."
|
|
6493
6594
|
}),
|
|
6494
|
-
user_id:
|
|
6595
|
+
user_id: z28.uuid().nullable().meta({
|
|
6495
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."
|
|
6496
6597
|
}),
|
|
6497
|
-
robots:
|
|
6598
|
+
robots: z28.array(effectiveRobotRights).meta({
|
|
6498
6599
|
description: "The robots attached to the app, each with what the role may use."
|
|
6499
6600
|
}),
|
|
6500
|
-
collections:
|
|
6601
|
+
collections: z28.array(roleCollectionRights).meta({
|
|
6501
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."
|
|
6502
6603
|
})
|
|
6503
6604
|
});
|
|
6504
6605
|
|
|
6505
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6506
|
-
var clientLoginRequest =
|
|
6606
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/client-auth.js
|
|
6607
|
+
var clientLoginRequest = z29.object({
|
|
6507
6608
|
app_identifier: appIdentifier.meta({
|
|
6508
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."
|
|
6509
6610
|
}),
|
|
6510
|
-
email:
|
|
6611
|
+
email: z29.email().meta({
|
|
6511
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."
|
|
6512
6613
|
}),
|
|
6513
|
-
password:
|
|
6614
|
+
password: z29.string().min(1).meta({
|
|
6514
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."
|
|
6515
6616
|
})
|
|
6516
6617
|
});
|
|
6517
|
-
var clientRefreshRequest =
|
|
6518
|
-
refresh_token:
|
|
6618
|
+
var clientRefreshRequest = z29.object({
|
|
6619
|
+
refresh_token: z29.string().min(1).meta({
|
|
6519
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."
|
|
6520
6621
|
})
|
|
6521
6622
|
});
|
|
6522
|
-
var clientLogoutRequest =
|
|
6523
|
-
refresh_token:
|
|
6623
|
+
var clientLogoutRequest = z29.object({
|
|
6624
|
+
refresh_token: z29.string().min(1).meta({
|
|
6524
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."
|
|
6525
6626
|
})
|
|
6526
6627
|
});
|
|
6527
|
-
var clientLoginCodeRequest =
|
|
6628
|
+
var clientLoginCodeRequest = z29.object({
|
|
6528
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." }),
|
|
6529
|
-
email:
|
|
6630
|
+
email: z29.email().meta({
|
|
6530
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."
|
|
6531
6632
|
})
|
|
6532
6633
|
}).strict();
|
|
6533
|
-
var clientLoginCodeVerifyRequest =
|
|
6634
|
+
var clientLoginCodeVerifyRequest = z29.object({
|
|
6534
6635
|
app_identifier: appIdentifier.meta({ description: "The app the code was requested for." }),
|
|
6535
|
-
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." }),
|
|
6536
6637
|
code: loginCode.meta({ description: "The six digits from the mail, exactly \u2014 leading zeros included, no spaces." })
|
|
6537
6638
|
}).strict();
|
|
6538
|
-
var twoFactorChallenge =
|
|
6539
|
-
status:
|
|
6639
|
+
var twoFactorChallenge = z29.object({
|
|
6640
|
+
status: z29.enum(["two_factor_required", "two_factor_setup_required"]).meta({
|
|
6540
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."
|
|
6541
6642
|
}),
|
|
6542
|
-
challenge:
|
|
6643
|
+
challenge: z29.string().min(1).meta({
|
|
6543
6644
|
description: "The handle the next step spends. Valid five minutes; afterwards it answers `410 token_spent` and the sign-in starts over."
|
|
6544
6645
|
})
|
|
6545
6646
|
});
|
|
6546
|
-
var clientSignInResult =
|
|
6547
|
-
var clientTwoFactorVerifyRequest =
|
|
6548
|
-
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." }),
|
|
6549
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." }),
|
|
6550
6651
|
recovery_code: recoveryCode.optional().meta({ description: "One of the ten recovery codes, `xxxxx-xxxxx`, in either case. Spent by its use." })
|
|
6551
6652
|
}).strict().refine((b) => b.code === void 0 !== (b.recovery_code === void 0), { message: "Send exactly one of code and recovery_code." });
|
|
6552
|
-
var clientTwoFactorSetupRequest =
|
|
6553
|
-
challenge:
|
|
6653
|
+
var clientTwoFactorSetupRequest = z29.object({
|
|
6654
|
+
challenge: z29.string().min(1).optional().meta({
|
|
6554
6655
|
description: "The `two_factor_setup_required` challenge, during sign-in. Absent when the call carries the app user's bearer instead."
|
|
6555
6656
|
})
|
|
6556
6657
|
}).strict();
|
|
6557
|
-
var clientTwoFactorSetupConfirmRequest =
|
|
6558
|
-
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." }),
|
|
6559
6660
|
code: totpCode.meta({ description: "A code the new authenticator shows now. It proves the secret was copied correctly before anything depends on it." })
|
|
6560
6661
|
}).strict();
|
|
6561
|
-
var clientTwoFactorSetupConfirmResponse =
|
|
6662
|
+
var clientTwoFactorSetupConfirmResponse = z29.object({
|
|
6562
6663
|
recovery_codes: recoveryCodesList.meta({
|
|
6563
6664
|
description: "The ten single-use recovery codes, lowercase, shown once. Any earlier set is void."
|
|
6564
6665
|
}),
|
|
6565
6666
|
session: sessionTokens.meta({ description: "The session the sign-in was waiting for, or a fresh one for the account settings." })
|
|
6566
6667
|
});
|
|
6567
|
-
var clientTwoFactorDisableRequest =
|
|
6668
|
+
var clientTwoFactorDisableRequest = z29.object({
|
|
6568
6669
|
code: totpCode.meta({ description: "A code the authenticator shows now." })
|
|
6569
6670
|
}).strict();
|
|
6570
|
-
var clientRegisterRequest =
|
|
6671
|
+
var clientRegisterRequest = z29.object({
|
|
6571
6672
|
app_identifier: appIdentifier.meta({
|
|
6572
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."
|
|
6573
6674
|
}),
|
|
6574
|
-
email:
|
|
6675
|
+
email: z29.email().meta({
|
|
6575
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."
|
|
6576
6677
|
}),
|
|
6577
6678
|
password: password.optional().meta({
|
|
6578
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."
|
|
6579
6680
|
}),
|
|
6580
|
-
display_name:
|
|
6681
|
+
display_name: z29.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
6581
6682
|
description: "An optional human name for the account. The developer's own UI decides whether to ask for it."
|
|
6582
6683
|
})
|
|
6583
6684
|
}).strict();
|
|
6584
|
-
var clientVerifyEmailRequest =
|
|
6585
|
-
token:
|
|
6685
|
+
var clientVerifyEmailRequest = z29.object({
|
|
6686
|
+
token: z29.string().min(1).meta({
|
|
6586
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."
|
|
6587
6688
|
})
|
|
6588
6689
|
}).strict();
|
|
6589
|
-
var clientResendVerificationRequest =
|
|
6690
|
+
var clientResendVerificationRequest = z29.object({
|
|
6590
6691
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
6591
|
-
email:
|
|
6692
|
+
email: z29.email().meta({
|
|
6592
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."
|
|
6593
6694
|
})
|
|
6594
6695
|
}).strict();
|
|
6595
|
-
var clientPasswordResetRequest =
|
|
6696
|
+
var clientPasswordResetRequest = z29.object({
|
|
6596
6697
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
6597
|
-
email:
|
|
6698
|
+
email: z29.email().meta({
|
|
6598
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."
|
|
6599
6700
|
})
|
|
6600
6701
|
}).strict();
|
|
6601
|
-
var clientPasswordResetConfirmRequest =
|
|
6602
|
-
token:
|
|
6702
|
+
var clientPasswordResetConfirmRequest = z29.object({
|
|
6703
|
+
token: z29.string().min(1).meta({
|
|
6603
6704
|
description: "The opaque token from the reset link, valid one hour. Single-use; unknown, expired and spent all answer `410 token_spent`."
|
|
6604
6705
|
}),
|
|
6605
6706
|
new_password: password.meta({
|
|
6606
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."
|
|
6607
6708
|
})
|
|
6608
6709
|
}).strict();
|
|
6609
|
-
var clientAcceptInvitationRequest =
|
|
6610
|
-
token:
|
|
6710
|
+
var clientAcceptInvitationRequest = z29.object({
|
|
6711
|
+
token: z29.string().min(1).meta({
|
|
6611
6712
|
description: "The opaque token from the invitation link, valid seven days. Unknown, expired, revoked and already-accepted all answer `410 token_spent`."
|
|
6612
6713
|
}),
|
|
6613
6714
|
password: password.optional().meta({
|
|
6614
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."
|
|
6615
6716
|
}),
|
|
6616
|
-
display_name:
|
|
6717
|
+
display_name: z29.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
6617
6718
|
description: "An optional name, overriding whatever the invitation pre-filled."
|
|
6618
6719
|
})
|
|
6619
6720
|
}).strict();
|
|
6620
6721
|
var CLIENT_OIDC_CALLBACK_PATH = "/api/client/oidc/callback";
|
|
6621
|
-
var clientProviderListQuery =
|
|
6722
|
+
var clientProviderListQuery = z29.object({
|
|
6622
6723
|
app_identifier: appIdentifier.meta({ description: "The app whose enabled providers to list." })
|
|
6623
6724
|
}).meta({ description: "The one parameter of the public provider listing." });
|
|
6624
|
-
var clientProviderListResponse =
|
|
6625
|
-
providers:
|
|
6725
|
+
var clientProviderListResponse = z29.object({
|
|
6726
|
+
providers: z29.array(z29.object({
|
|
6626
6727
|
slug: providerSlug.meta({ description: "The handle to put in the start URL: `GET /api/client/oidc/<slug>/start`." }),
|
|
6627
|
-
name:
|
|
6728
|
+
name: z29.string().meta({ description: "What to write on the button, as the developer configured it." })
|
|
6628
6729
|
})).meta({
|
|
6629
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."
|
|
6630
6731
|
}),
|
|
@@ -6635,41 +6736,41 @@ var clientProviderListResponse = z28.object({
|
|
|
6635
6736
|
description: "The app's off, optional or required two-factor policy; not the caller's enrollment state."
|
|
6636
6737
|
})
|
|
6637
6738
|
});
|
|
6638
|
-
var clientOidcStartQuery =
|
|
6739
|
+
var clientOidcStartQuery = z29.object({
|
|
6639
6740
|
app_identifier: appIdentifier.meta({ description: "The app being signed in to." }),
|
|
6640
|
-
redirect_uri:
|
|
6741
|
+
redirect_uri: z29.url().max(2e3).meta({
|
|
6641
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."
|
|
6642
6743
|
}),
|
|
6643
|
-
state:
|
|
6744
|
+
state: z29.string().min(8).max(512).meta({
|
|
6644
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."
|
|
6645
6746
|
}),
|
|
6646
|
-
code_challenge:
|
|
6747
|
+
code_challenge: z29.string().regex(/^[A-Za-z0-9_-]{43,128}$/).meta({
|
|
6647
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."
|
|
6648
6749
|
})
|
|
6649
6750
|
});
|
|
6650
|
-
var clientOidcCallbackQuery =
|
|
6651
|
-
state:
|
|
6751
|
+
var clientOidcCallbackQuery = z29.object({
|
|
6752
|
+
state: z29.string().min(1).meta({
|
|
6652
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."
|
|
6653
6754
|
}),
|
|
6654
|
-
code:
|
|
6755
|
+
code: z29.string().min(1).optional().meta({
|
|
6655
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`."
|
|
6656
6757
|
}),
|
|
6657
|
-
error:
|
|
6758
|
+
error: z29.string().min(1).optional().meta({
|
|
6658
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."
|
|
6659
6760
|
}),
|
|
6660
|
-
error_description:
|
|
6761
|
+
error_description: z29.string().optional().meta({
|
|
6661
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."
|
|
6662
6763
|
})
|
|
6663
6764
|
});
|
|
6664
|
-
var clientOidcExchangeRequest =
|
|
6665
|
-
code:
|
|
6765
|
+
var clientOidcExchangeRequest = z29.object({
|
|
6766
|
+
code: z29.string().min(1).meta({
|
|
6666
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."
|
|
6667
6768
|
}),
|
|
6668
|
-
code_verifier:
|
|
6769
|
+
code_verifier: z29.string().regex(/^[A-Za-z0-9_.~-]{43,128}$/).meta({
|
|
6669
6770
|
description: "The verifier for the challenge sent at `start`. RFC 7636 \xA74.1's alphabet and length."
|
|
6670
6771
|
})
|
|
6671
6772
|
}).strict();
|
|
6672
|
-
var clientOidcErrorCode =
|
|
6773
|
+
var clientOidcErrorCode = z29.enum([
|
|
6673
6774
|
"no_access",
|
|
6674
6775
|
"email_taken",
|
|
6675
6776
|
"email_unverified",
|
|
@@ -6684,255 +6785,255 @@ var clientOidcErrorCode = z28.enum([
|
|
|
6684
6785
|
"quota_exceeded",
|
|
6685
6786
|
"plan_limit"
|
|
6686
6787
|
]);
|
|
6687
|
-
var clientMcpInteraction =
|
|
6688
|
-
id:
|
|
6689
|
-
app_id:
|
|
6690
|
-
client_name:
|
|
6691
|
-
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({
|
|
6692
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."
|
|
6693
6794
|
}),
|
|
6694
|
-
client_id_host:
|
|
6795
|
+
client_id_host: z29.string().nullable().meta({
|
|
6695
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."
|
|
6696
6797
|
}),
|
|
6697
|
-
redirect_uri_host:
|
|
6798
|
+
redirect_uri_host: z29.string().meta({
|
|
6698
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."
|
|
6699
6800
|
}),
|
|
6700
|
-
redirect_uri_loopback:
|
|
6801
|
+
redirect_uri_loopback: z29.boolean().meta({
|
|
6701
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."'
|
|
6702
6803
|
}),
|
|
6703
|
-
scopes:
|
|
6704
|
-
already_granted:
|
|
6705
|
-
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`." })
|
|
6706
6807
|
});
|
|
6707
|
-
var clientMcpInteractionDecisionResponse =
|
|
6708
|
-
redirect_to:
|
|
6808
|
+
var clientMcpInteractionDecisionResponse = z29.object({
|
|
6809
|
+
redirect_to: z29.url().meta({
|
|
6709
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."
|
|
6710
6811
|
})
|
|
6711
6812
|
});
|
|
6712
|
-
var mcpConsentGrant =
|
|
6713
|
-
client_id:
|
|
6813
|
+
var mcpConsentGrant = z29.object({
|
|
6814
|
+
client_id: z29.string().meta({
|
|
6714
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."
|
|
6715
6816
|
}),
|
|
6716
|
-
client_id_host:
|
|
6817
|
+
client_id_host: z29.string().nullable().meta({
|
|
6717
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."
|
|
6718
6819
|
}),
|
|
6719
|
-
client_name:
|
|
6820
|
+
client_name: z29.string().nullable().meta({
|
|
6720
6821
|
description: "What the client calls itself, or `null` once its registration or cached metadata document is gone. **Unverified** \u2014 see `client_name_verified`."
|
|
6721
6822
|
}),
|
|
6722
|
-
client_name_verified:
|
|
6823
|
+
client_name_verified: z29.literal(false).meta({
|
|
6723
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."
|
|
6724
6825
|
}),
|
|
6725
|
-
granted_at:
|
|
6826
|
+
granted_at: z29.iso.datetime().meta({
|
|
6726
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."
|
|
6727
6828
|
})
|
|
6728
6829
|
});
|
|
6729
|
-
var mcpConsentGrantListResponse =
|
|
6730
|
-
grants:
|
|
6830
|
+
var mcpConsentGrantListResponse = z29.object({
|
|
6831
|
+
grants: z29.array(mcpConsentGrant).meta({
|
|
6731
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."
|
|
6732
6833
|
})
|
|
6733
6834
|
});
|
|
6734
|
-
var clientIdentity =
|
|
6735
|
-
kind:
|
|
6835
|
+
var clientIdentity = z29.object({
|
|
6836
|
+
kind: z29.enum(["developer", "app_user", "server_key"]).meta({
|
|
6736
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."
|
|
6737
6838
|
}),
|
|
6738
|
-
developer_id:
|
|
6839
|
+
developer_id: z29.uuid().nullable().meta({
|
|
6739
6840
|
description: "The Fleetless user behind this session, or `null` when `kind` is not `developer`."
|
|
6740
6841
|
}),
|
|
6741
|
-
app_user_id:
|
|
6842
|
+
app_user_id: z29.uuid().nullable().meta({
|
|
6742
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."
|
|
6743
6844
|
}),
|
|
6744
|
-
server_key_id:
|
|
6845
|
+
server_key_id: z29.uuid().nullable().meta({
|
|
6745
6846
|
description: "The server key this session was authenticated with, or `null` when `kind` is not `server_key`."
|
|
6746
6847
|
}),
|
|
6747
|
-
app_id:
|
|
6848
|
+
app_id: z29.uuid().nullable().meta({
|
|
6748
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."
|
|
6749
6850
|
}),
|
|
6750
|
-
role:
|
|
6851
|
+
role: z29.object({
|
|
6751
6852
|
key: roleKey.meta({
|
|
6752
6853
|
description: "The role's key, the same string `fleetless.yaml` and the organization's role list write."
|
|
6753
6854
|
}),
|
|
6754
|
-
name:
|
|
6855
|
+
name: z29.string().meta({
|
|
6755
6856
|
description: "The role's display name, for showing the caller what they hold. Changing it changes nothing about rights."
|
|
6756
6857
|
})
|
|
6757
6858
|
}).nullable().meta({
|
|
6758
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."
|
|
6759
6860
|
}),
|
|
6760
|
-
email:
|
|
6861
|
+
email: z29.email().nullable().meta({
|
|
6761
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."
|
|
6762
6863
|
}),
|
|
6763
|
-
two_factor_enabled:
|
|
6864
|
+
two_factor_enabled: z29.boolean().nullable().meta({
|
|
6764
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`."
|
|
6765
6866
|
})
|
|
6766
6867
|
});
|
|
6767
6868
|
|
|
6768
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6769
|
-
import { z as
|
|
6770
|
-
var timestamp =
|
|
6771
|
-
var count3 =
|
|
6772
|
-
var schemaVersion =
|
|
6773
|
-
var collectionActor =
|
|
6774
|
-
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({
|
|
6775
6876
|
description: "What made the change: a developer, a user of the app, a server key of the app, or the platform itself."
|
|
6776
6877
|
}),
|
|
6777
|
-
id:
|
|
6778
|
-
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({
|
|
6779
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."
|
|
6780
6881
|
})
|
|
6781
6882
|
}).meta({ description: "Who or what made a change to a record." });
|
|
6782
|
-
var collectionRecord =
|
|
6783
|
-
id:
|
|
6784
|
-
robot_id:
|
|
6883
|
+
var collectionRecord = z30.object({
|
|
6884
|
+
id: z30.uuid(),
|
|
6885
|
+
robot_id: z30.uuid().nullable().meta({
|
|
6785
6886
|
description: "The robot a record of a `per_robot` or `one_per_robot` collection belongs to; null in a `global` collection."
|
|
6786
6887
|
}),
|
|
6787
6888
|
created_at: timestamp,
|
|
6788
6889
|
created_by: collectionActor,
|
|
6789
6890
|
updated_at: timestamp,
|
|
6790
6891
|
updated_by: collectionActor,
|
|
6791
|
-
revision:
|
|
6792
|
-
display:
|
|
6793
|
-
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({
|
|
6794
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."
|
|
6795
6896
|
}).optional(),
|
|
6796
|
-
values:
|
|
6897
|
+
values: z30.record(z30.string(), z30.unknown()).meta({
|
|
6797
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."
|
|
6798
6899
|
}),
|
|
6799
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(),
|
|
6800
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()
|
|
6801
6902
|
}).meta({ description: "A record of a collection: its system fields and its values." });
|
|
6802
|
-
var collectionFilter =
|
|
6903
|
+
var collectionFilter = z30.record(z30.string(), z30.unknown()).meta({
|
|
6803
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`.'
|
|
6804
6905
|
});
|
|
6805
|
-
var pageLimit =
|
|
6806
|
-
var wireBoolean =
|
|
6807
|
-
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({
|
|
6808
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."
|
|
6809
6910
|
});
|
|
6810
|
-
var collectionRecordListQuery =
|
|
6811
|
-
filter:
|
|
6911
|
+
var collectionRecordListQuery = z30.object({
|
|
6912
|
+
filter: z30.string().min(1).meta({
|
|
6812
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.'
|
|
6813
6914
|
}).optional(),
|
|
6814
|
-
search:
|
|
6915
|
+
search: z30.string().meta({
|
|
6815
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."
|
|
6816
6917
|
}).optional(),
|
|
6817
|
-
sort:
|
|
6918
|
+
sort: z30.string().min(1).meta({
|
|
6818
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`."
|
|
6819
6920
|
}).optional(),
|
|
6820
6921
|
expand: expandParam.optional(),
|
|
6821
6922
|
limit: pageLimit.meta({
|
|
6822
6923
|
description: `The most records to return, 1 to ${COLLECTION_LIMITS.pageMax}. Default ${COLLECTION_LIMITS.pageDefault}. A page can hold fewer: see \`next_cursor\`.`
|
|
6823
6924
|
}).optional(),
|
|
6824
|
-
cursor:
|
|
6925
|
+
cursor: z30.string().min(1).meta({ description: "The `next_cursor` of the previous page." }).optional(),
|
|
6825
6926
|
count: wireBoolean.meta({ description: "`true` adds `total`, the number of records that match." }).optional(),
|
|
6826
6927
|
deleted: wireBoolean.meta({ description: "`true` lists deleted records instead, newest deletion first. Needs the right to create records." }).optional(),
|
|
6827
|
-
robot:
|
|
6928
|
+
robot: z30.uuid().meta({ description: "Only the records of this robot, in a collection that belongs to robots." }).optional()
|
|
6828
6929
|
}).strict();
|
|
6829
|
-
var collectionRecordGetQuery =
|
|
6830
|
-
var collectionRecordListResponse =
|
|
6831
|
-
records:
|
|
6930
|
+
var collectionRecordGetQuery = z30.object({ expand: expandParam.optional() }).strict();
|
|
6931
|
+
var collectionRecordListResponse = z30.object({
|
|
6932
|
+
records: z30.array(collectionRecord).meta({
|
|
6832
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."
|
|
6833
6934
|
}),
|
|
6834
|
-
next_cursor:
|
|
6935
|
+
next_cursor: z30.string().nullable().meta({
|
|
6835
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."
|
|
6836
6937
|
}),
|
|
6837
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()
|
|
6838
6939
|
}).meta({ description: "One page of records." });
|
|
6839
|
-
var collectionRecordWrite =
|
|
6840
|
-
values:
|
|
6940
|
+
var collectionRecordWrite = z30.object({
|
|
6941
|
+
values: z30.record(z30.string(), z30.unknown()).meta({
|
|
6841
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.`
|
|
6842
6943
|
}),
|
|
6843
|
-
robot_id:
|
|
6844
|
-
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()
|
|
6845
6946
|
}).strict().meta({ description: "The body of a record create or update." });
|
|
6846
|
-
var collectionRevision =
|
|
6847
|
-
seq:
|
|
6848
|
-
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"]),
|
|
6849
6950
|
at: timestamp,
|
|
6850
6951
|
actor: collectionActor,
|
|
6851
|
-
reason:
|
|
6852
|
-
revision:
|
|
6853
|
-
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({
|
|
6854
6955
|
description: "The fields this change touched by key, each with its value before and after. `null` means no value."
|
|
6855
6956
|
}),
|
|
6856
6957
|
record: collectionRecord.nullable().meta({ description: "The whole record, on a `delete` revision. Null on every other operation." })
|
|
6857
6958
|
}).meta({ description: "One change in the history of a record." });
|
|
6858
|
-
var collectionRecordHistoryQuery =
|
|
6959
|
+
var collectionRecordHistoryQuery = z30.object({
|
|
6859
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(),
|
|
6860
6961
|
before_seq: wireSeqCursor.meta({ description: "Only revisions older than this `seq`: the next page, since the history is read newest first." }).optional()
|
|
6861
6962
|
}).strict();
|
|
6862
|
-
var collectionRecordHistoryResponse =
|
|
6863
|
-
revisions:
|
|
6963
|
+
var collectionRecordHistoryResponse = z30.object({
|
|
6964
|
+
revisions: z30.array(collectionRevision).meta({
|
|
6864
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."
|
|
6865
6966
|
}),
|
|
6866
|
-
next_before_seq:
|
|
6967
|
+
next_before_seq: z30.number().int().positive().nullable().meta({
|
|
6867
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."
|
|
6868
6969
|
}),
|
|
6869
|
-
purged:
|
|
6970
|
+
purged: z30.object({
|
|
6870
6971
|
before: timestamp.meta({ description: "Revisions older than this were removed." }),
|
|
6871
6972
|
by: collectionActor,
|
|
6872
6973
|
at: timestamp.meta({ description: "When they were removed." })
|
|
6873
6974
|
}).nullable().meta({ description: "Set when an organization owner removed the older part of this history: the history then starts with that note." })
|
|
6874
6975
|
}).meta({ description: "A page of a record's history, newest first." });
|
|
6875
|
-
var collectionRecordRestoreRequest =
|
|
6876
|
-
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()
|
|
6877
6978
|
}).strict().meta({ description: "The body of a record restore." });
|
|
6878
|
-
var collectionSummary =
|
|
6979
|
+
var collectionSummary = z30.object({
|
|
6879
6980
|
key: collectionKey,
|
|
6880
|
-
label:
|
|
6981
|
+
label: z30.string(),
|
|
6881
6982
|
binding: collectionBinding,
|
|
6882
6983
|
records: count3.meta({ description: "Records the collection holds now." }),
|
|
6883
6984
|
fields: count3,
|
|
6884
|
-
read_roles:
|
|
6885
|
-
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({
|
|
6886
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."
|
|
6887
6988
|
}),
|
|
6888
6989
|
revisions: count3.meta({ description: "Entries in the history of all the collection's records." }),
|
|
6889
6990
|
history_bytes: count3.meta({ description: "The size of that history in bytes." }),
|
|
6890
6991
|
updated_at: timestamp.nullable().meta({ description: "When a record of the collection last changed. Null if it never held one." })
|
|
6891
6992
|
}).meta({ description: "A collection as the developer's overview shows it." });
|
|
6892
|
-
var collectionListResponse =
|
|
6993
|
+
var collectionListResponse = z30.object({
|
|
6893
6994
|
version: schemaVersion.nullable().meta({ description: "The published schema version. Null before anything was published." }),
|
|
6894
|
-
collections:
|
|
6995
|
+
collections: z30.array(collectionSummary)
|
|
6895
6996
|
}).meta({ description: "The collections of an app." });
|
|
6896
|
-
var collectionCan =
|
|
6897
|
-
read:
|
|
6898
|
-
create:
|
|
6899
|
-
update:
|
|
6900
|
-
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." })
|
|
6901
7002
|
}).meta({ description: "What the caller may do with the records of this collection." });
|
|
6902
|
-
var collectionDefinitionsResponse =
|
|
7003
|
+
var collectionDefinitionsResponse = z30.object({
|
|
6903
7004
|
version: schemaVersion.nullable().meta({ description: "The published schema version. Null before anything was published." }),
|
|
6904
|
-
collections:
|
|
7005
|
+
collections: z30.array(z30.object({
|
|
6905
7006
|
key: collectionKey,
|
|
6906
|
-
label:
|
|
6907
|
-
description:
|
|
7007
|
+
label: z30.string(),
|
|
7008
|
+
description: z30.string(),
|
|
6908
7009
|
binding: collectionBinding,
|
|
6909
|
-
display:
|
|
6910
|
-
fields:
|
|
7010
|
+
display: z30.string().meta({ description: "The template that names a record of this collection." }),
|
|
7011
|
+
fields: z30.record(collectionKey, collectionField),
|
|
6911
7012
|
can: collectionCan
|
|
6912
7013
|
}))
|
|
6913
7014
|
}).meta({ description: "The collections the caller may read, with their field definitions and the caller's rights." });
|
|
6914
7015
|
|
|
6915
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
6916
|
-
var clientAuth =
|
|
6917
|
-
type:
|
|
6918
|
-
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)
|
|
6919
7020
|
});
|
|
6920
|
-
var authOk =
|
|
6921
|
-
type:
|
|
7021
|
+
var authOk = z31.object({
|
|
7022
|
+
type: z31.literal("auth_ok"),
|
|
6922
7023
|
identity: clientIdentity
|
|
6923
7024
|
});
|
|
6924
|
-
var authError =
|
|
6925
|
-
type:
|
|
6926
|
-
code:
|
|
6927
|
-
message:
|
|
7025
|
+
var authError = z31.object({
|
|
7026
|
+
type: z31.literal("auth_error"),
|
|
7027
|
+
code: z31.string().min(1),
|
|
7028
|
+
message: z31.string().min(1)
|
|
6928
7029
|
});
|
|
6929
|
-
var clientInvoke =
|
|
6930
|
-
type:
|
|
6931
|
-
request_id:
|
|
6932
|
-
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(),
|
|
6933
7034
|
slug,
|
|
6934
7035
|
/** Parameters by field path, validated against the configuration's rules. */
|
|
6935
|
-
params:
|
|
7036
|
+
params: z31.record(z31.string(), z31.unknown()),
|
|
6936
7037
|
/**
|
|
6937
7038
|
* How long this one call is worth waiting for — the same field, meaning and
|
|
6938
7039
|
* cap as `invokeRequest.patience_ms`; absent means `DEFAULT_PATIENCE_MS`.
|
|
@@ -6942,12 +7043,12 @@ var clientInvoke = z30.object({
|
|
|
6942
7043
|
* unreachable to every caller that invokes over the realtime channel, while
|
|
6943
7044
|
* still appearing in the documentation.
|
|
6944
7045
|
*/
|
|
6945
|
-
patience_ms:
|
|
7046
|
+
patience_ms: z31.number().int().min(MIN_PATIENCE_MS).max(MAX_PATIENCE_MS).optional()
|
|
6946
7047
|
});
|
|
6947
|
-
var clientCancel =
|
|
6948
|
-
type:
|
|
6949
|
-
request_id:
|
|
6950
|
-
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(),
|
|
6951
7052
|
/** Which slug — required, and the coarse address of a cancel. */
|
|
6952
7053
|
slug,
|
|
6953
7054
|
/**
|
|
@@ -6965,19 +7066,19 @@ var clientCancel = z30.object({
|
|
|
6965
7066
|
* back to the slug. Falling back would be the platform deciding that the
|
|
6966
7067
|
* caller did not really mean the id they typed.
|
|
6967
7068
|
*/
|
|
6968
|
-
job_id:
|
|
7069
|
+
job_id: z31.uuid().nullable()
|
|
6969
7070
|
});
|
|
6970
|
-
var clientPublish =
|
|
6971
|
-
type:
|
|
6972
|
-
request_id:
|
|
6973
|
-
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(),
|
|
6974
7075
|
slug,
|
|
6975
|
-
message:
|
|
7076
|
+
message: z31.record(z31.string(), z31.unknown())
|
|
6976
7077
|
});
|
|
6977
|
-
var commandResult =
|
|
6978
|
-
type:
|
|
6979
|
-
request_id:
|
|
6980
|
-
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(),
|
|
6981
7082
|
/**
|
|
6982
7083
|
* The job this reply is *about* — which is not always the caller's own.
|
|
6983
7084
|
*
|
|
@@ -7001,9 +7102,9 @@ var commandResult = z30.object({
|
|
|
7001
7102
|
* later. Returning the kind lets a client refuse its own mistake at once,
|
|
7002
7103
|
* instead of reporting it as the machine's.
|
|
7003
7104
|
*/
|
|
7004
|
-
kind:
|
|
7005
|
-
code:
|
|
7006
|
-
message:
|
|
7105
|
+
kind: z31.enum(["datapoint", "action", "service", "publisher", "camera"]).nullable(),
|
|
7106
|
+
code: z31.string().nullable(),
|
|
7107
|
+
message: z31.string().nullable(),
|
|
7007
7108
|
/**
|
|
7008
7109
|
* The same payload the REST envelope carries in `apiError.details` — for
|
|
7009
7110
|
* `parameter_invalid`, a `parameterInvalidDetails`.
|
|
@@ -7014,16 +7115,16 @@ var commandResult = z30.object({
|
|
|
7014
7115
|
* socket. A client cannot bind an error to the input that caused it from a
|
|
7015
7116
|
* code alone, which is the entire point of the flat parameter shape.
|
|
7016
7117
|
*/
|
|
7017
|
-
details:
|
|
7118
|
+
details: z31.unknown().optional()
|
|
7018
7119
|
});
|
|
7019
|
-
var errorFrame =
|
|
7020
|
-
type:
|
|
7021
|
-
code:
|
|
7022
|
-
message:
|
|
7120
|
+
var errorFrame = z31.object({
|
|
7121
|
+
type: z31.literal("error"),
|
|
7122
|
+
code: z31.string().min(1),
|
|
7123
|
+
message: z31.string().min(1)
|
|
7023
7124
|
});
|
|
7024
|
-
var clientSubscribe =
|
|
7025
|
-
type:
|
|
7026
|
-
robot_id:
|
|
7125
|
+
var clientSubscribe = z31.object({
|
|
7126
|
+
type: z31.literal("subscribe"),
|
|
7127
|
+
robot_id: z31.uuid(),
|
|
7027
7128
|
slug,
|
|
7028
7129
|
/**
|
|
7029
7130
|
* What the subscriber expects, and how it wants it.
|
|
@@ -7043,35 +7144,45 @@ var clientSubscribe = z30.object({
|
|
|
7043
7144
|
* request was the same mistake as the silent wrong-verb subscribe this
|
|
7044
7145
|
* field was added to fix.
|
|
7045
7146
|
*/
|
|
7046
|
-
kind:
|
|
7047
|
-
options:
|
|
7147
|
+
kind: z31.enum(["datapoint", "action", "service", "publisher", "camera"]).optional(),
|
|
7148
|
+
options: z31.record(z31.string(), z31.unknown()).optional()
|
|
7048
7149
|
});
|
|
7049
|
-
var clientUnsubscribe =
|
|
7050
|
-
type:
|
|
7051
|
-
robot_id:
|
|
7150
|
+
var clientUnsubscribe = z31.object({
|
|
7151
|
+
type: z31.literal("unsubscribe"),
|
|
7152
|
+
robot_id: z31.uuid(),
|
|
7052
7153
|
slug
|
|
7053
7154
|
});
|
|
7054
|
-
var subscribeError =
|
|
7055
|
-
type:
|
|
7056
|
-
robot_id:
|
|
7057
|
-
slug:
|
|
7058
|
-
code:
|
|
7059
|
-
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)
|
|
7060
7161
|
});
|
|
7061
|
-
var datapointEvent =
|
|
7062
|
-
type:
|
|
7063
|
-
robot_id:
|
|
7162
|
+
var datapointEvent = z31.object({
|
|
7163
|
+
type: z31.literal("datapoint"),
|
|
7164
|
+
robot_id: z31.uuid(),
|
|
7064
7165
|
slug,
|
|
7065
|
-
value:
|
|
7066
|
-
timestamp_ms:
|
|
7166
|
+
value: z31.unknown(),
|
|
7167
|
+
timestamp_ms: z31.number().int().nonnegative()
|
|
7067
7168
|
});
|
|
7068
|
-
var liveSessionEndReason =
|
|
7169
|
+
var liveSessionEndReason = z31.enum([
|
|
7069
7170
|
/** Another holder of this camera released it — another tab, or another client. */
|
|
7070
7171
|
"released_by_peer",
|
|
7071
7172
|
/** The robot's configuration was published and this camera changed with it. */
|
|
7072
7173
|
"config_changed",
|
|
7073
|
-
/**
|
|
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
|
+
*/
|
|
7074
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",
|
|
7075
7186
|
/** The bridge stopped answering. */
|
|
7076
7187
|
"robot_offline",
|
|
7077
7188
|
/** The grant this session was minted under was withdrawn. */
|
|
@@ -7094,12 +7205,12 @@ var liveSessionEndReason = z30.enum([
|
|
|
7094
7205
|
*/
|
|
7095
7206
|
"unknown"
|
|
7096
7207
|
]);
|
|
7097
|
-
var liveSessionEvent =
|
|
7098
|
-
type:
|
|
7099
|
-
robot_id:
|
|
7208
|
+
var liveSessionEvent = z31.object({
|
|
7209
|
+
type: z31.literal("live_session"),
|
|
7210
|
+
robot_id: z31.uuid(),
|
|
7100
7211
|
slug,
|
|
7101
|
-
session_id:
|
|
7102
|
-
state:
|
|
7212
|
+
session_id: z31.uuid(),
|
|
7213
|
+
state: z31.literal("ended"),
|
|
7103
7214
|
reason: liveSessionEndReason,
|
|
7104
7215
|
/**
|
|
7105
7216
|
* **Classified text the cloud produced, never text the robot sent.**
|
|
@@ -7114,47 +7225,53 @@ var liveSessionEvent = z30.object({
|
|
|
7114
7225
|
* code with fixed text, the way camera health already does it — not as
|
|
7115
7226
|
* forwarded foreign text on a channel a client reads.
|
|
7116
7227
|
*/
|
|
7117
|
-
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(),
|
|
7118
7235
|
/** When it ended — not when this frame was sent. Same reasoning as `changed_at_ms`. */
|
|
7119
|
-
ended_at_ms:
|
|
7120
|
-
});
|
|
7121
|
-
var resourceHealthCleared =
|
|
7122
|
-
type:
|
|
7123
|
-
robot_id:
|
|
7124
|
-
kind:
|
|
7125
|
-
ref:
|
|
7126
|
-
facet:
|
|
7127
|
-
cleared_at_ms:
|
|
7128
|
-
});
|
|
7129
|
-
var resourceHealthEvent =
|
|
7130
|
-
type:
|
|
7131
|
-
robot_id:
|
|
7132
|
-
kind:
|
|
7133
|
-
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),
|
|
7134
7251
|
/** Which of the two questions this entry answers — see `resourceHealthState.facet`. */
|
|
7135
|
-
facet:
|
|
7136
|
-
state:
|
|
7137
|
-
reason:
|
|
7138
|
-
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()
|
|
7139
7256
|
});
|
|
7140
7257
|
var ORG_EVENT_BUFFER_SIZE = 200;
|
|
7141
|
-
var orgEventKind =
|
|
7142
|
-
var orgEventSeverity =
|
|
7143
|
-
var orgEvent =
|
|
7144
|
-
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"),
|
|
7145
7262
|
/**
|
|
7146
7263
|
* **Per org, per process.** Like `job.seq` and unlike `job_runs.seq`, which
|
|
7147
7264
|
* is a postgres `bigserial` and durable. All three say which they are,
|
|
7148
7265
|
* because anyone who confuses them will confuse them in both directions.
|
|
7149
7266
|
*/
|
|
7150
|
-
seq:
|
|
7151
|
-
at:
|
|
7267
|
+
seq: z31.number().int().positive(),
|
|
7268
|
+
at: z31.iso.datetime(),
|
|
7152
7269
|
kind: orgEventKind,
|
|
7153
7270
|
severity: orgEventSeverity,
|
|
7154
7271
|
/** `null` for an org-level event — an invitation, a quota change — which belongs to no robot. */
|
|
7155
|
-
robot_id:
|
|
7272
|
+
robot_id: z31.uuid().nullable(),
|
|
7156
7273
|
/** What the line is about: a slug, a camera, an actor's email. */
|
|
7157
|
-
subject:
|
|
7274
|
+
subject: z31.string().min(1).max(200),
|
|
7158
7275
|
/**
|
|
7159
7276
|
* Kind-specific, and **capped at `ORG_EVENT_DETAIL_MAX_BYTES`** — above it
|
|
7160
7277
|
* the producer substitutes `{ omitted: 'too_large', bytes }`. Truncated,
|
|
@@ -7163,13 +7280,13 @@ var orgEvent = z30.object({
|
|
|
7163
7280
|
* Never a pre-formatted line: the reader decides language, number format
|
|
7164
7281
|
* and truncation, so changing how a line reads is not a cloud deploy.
|
|
7165
7282
|
*/
|
|
7166
|
-
detail:
|
|
7283
|
+
detail: z31.unknown().nullable()
|
|
7167
7284
|
}).strict();
|
|
7168
|
-
var orgEventSubscribe =
|
|
7169
|
-
var orgEventUnsubscribe =
|
|
7170
|
-
var orgEventReplay =
|
|
7171
|
-
type:
|
|
7172
|
-
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),
|
|
7173
7290
|
/**
|
|
7174
7291
|
* **`false` means three different things, on purpose**: the buffer was
|
|
7175
7292
|
* already full, the cloud restarted, or this org's buffer had expired. All
|
|
@@ -7177,10 +7294,10 @@ var orgEventReplay = z30.object({
|
|
|
7177
7294
|
* line* — and a field separating them would claim a distinction nobody
|
|
7178
7295
|
* would act on differently.
|
|
7179
7296
|
*/
|
|
7180
|
-
complete:
|
|
7297
|
+
complete: z31.boolean()
|
|
7181
7298
|
}).strict();
|
|
7182
|
-
var orgEventDropped =
|
|
7183
|
-
type:
|
|
7299
|
+
var orgEventDropped = z31.object({
|
|
7300
|
+
type: z31.literal("org_event_dropped"),
|
|
7184
7301
|
/**
|
|
7185
7302
|
* **An epoch instant in milliseconds (`Date.now()`), not a duration.**
|
|
7186
7303
|
* The moment this socket last reported a drop — or the moment it
|
|
@@ -7191,75 +7308,75 @@ var orgEventDropped = z30.object({
|
|
|
7191
7308
|
* it as "milliseconds ago" renders a drop that happened seconds ago as
|
|
7192
7309
|
* having happened in 1970.
|
|
7193
7310
|
*/
|
|
7194
|
-
since_ms:
|
|
7311
|
+
since_ms: z31.number().int().nonnegative(),
|
|
7195
7312
|
/** Always at least one — a frame reporting nothing lost is noise on a channel built to be quiet. */
|
|
7196
|
-
dropped:
|
|
7313
|
+
dropped: z31.number().int().positive()
|
|
7197
7314
|
}).strict();
|
|
7198
|
-
var collectionRequestId =
|
|
7315
|
+
var collectionRequestId = z31.string().min(1).max(64).meta({
|
|
7199
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."
|
|
7200
7317
|
});
|
|
7201
|
-
var collectionSubscribe =
|
|
7202
|
-
type:
|
|
7318
|
+
var collectionSubscribe = z31.object({
|
|
7319
|
+
type: z31.literal("collection_subscribe"),
|
|
7203
7320
|
request_id: collectionRequestId,
|
|
7204
|
-
app_id:
|
|
7321
|
+
app_id: z31.uuid().meta({
|
|
7205
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`."
|
|
7206
7323
|
}).optional(),
|
|
7207
7324
|
collection: collectionKey.meta({ description: "The key of the collection." }),
|
|
7208
|
-
robot_id:
|
|
7325
|
+
robot_id: z31.uuid().meta({ description: "Only the records of this robot, in a collection that belongs to robots." }).optional(),
|
|
7209
7326
|
filter: collectionFilter.meta({
|
|
7210
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."
|
|
7211
7328
|
}).optional()
|
|
7212
7329
|
}).strict().meta({
|
|
7213
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`."
|
|
7214
7331
|
});
|
|
7215
|
-
var collectionSubscribed =
|
|
7216
|
-
type:
|
|
7332
|
+
var collectionSubscribed = z31.object({
|
|
7333
|
+
type: z31.literal("collection_subscribed"),
|
|
7217
7334
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription that is now registered." })
|
|
7218
7335
|
}).strict().meta({ description: "A collection subscription is registered: every change it covers is delivered from now on." });
|
|
7219
|
-
var collectionUnsubscribe =
|
|
7220
|
-
type:
|
|
7336
|
+
var collectionUnsubscribe = z31.object({
|
|
7337
|
+
type: z31.literal("collection_unsubscribe"),
|
|
7221
7338
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription to end." })
|
|
7222
7339
|
}).strict().meta({ description: "Ends a collection subscription." });
|
|
7223
|
-
var collectionEvent =
|
|
7224
|
-
type:
|
|
7340
|
+
var collectionEvent = z31.object({
|
|
7341
|
+
type: z31.literal("collection_event"),
|
|
7225
7342
|
request_id: collectionRequestId.meta({ description: "The `request_id` of the subscription the event belongs to." }),
|
|
7226
|
-
event:
|
|
7343
|
+
event: z31.enum(["created", "updated", "deleted", "removed", "entered"]).meta({
|
|
7227
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."
|
|
7228
7345
|
}),
|
|
7229
|
-
id:
|
|
7346
|
+
id: z31.uuid().meta({ description: "The id of the record." }),
|
|
7230
7347
|
record: collectionRecord.meta({
|
|
7231
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."
|
|
7232
7349
|
}).optional()
|
|
7233
7350
|
}).strict().meta({ description: "A record came into view, changed or went away." });
|
|
7234
|
-
var collectionSubscribeError =
|
|
7235
|
-
type:
|
|
7236
|
-
request_id:
|
|
7237
|
-
code:
|
|
7238
|
-
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)
|
|
7239
7356
|
}).strict().meta({ description: "A collection subscription was refused or has ended." });
|
|
7240
|
-
var collectionsSchemaPublished =
|
|
7241
|
-
type:
|
|
7242
|
-
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." })
|
|
7243
7360
|
}).strict().meta({ description: "A new schema version is in force for the app." });
|
|
7244
7361
|
|
|
7245
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7246
|
-
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";
|
|
7247
7364
|
var FEEDBACK_KINDS = ["idea", "problem", "question", "other"];
|
|
7248
|
-
var feedbackKind =
|
|
7365
|
+
var feedbackKind = z32.enum(FEEDBACK_KINDS);
|
|
7249
7366
|
var FEEDBACK_MESSAGE_MAX = 5e3;
|
|
7250
|
-
var feedbackRequest =
|
|
7367
|
+
var feedbackRequest = z32.object({
|
|
7251
7368
|
kind: feedbackKind.meta({
|
|
7252
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."
|
|
7253
7370
|
}),
|
|
7254
|
-
message:
|
|
7371
|
+
message: z32.string().trim().min(1).max(FEEDBACK_MESSAGE_MAX).meta({
|
|
7255
7372
|
description: "What the developer wrote, trimmed. At most 5000 characters; a message that is only whitespace is refused."
|
|
7256
7373
|
}),
|
|
7257
|
-
page:
|
|
7374
|
+
page: z32.string().startsWith("/").max(512).meta({
|
|
7258
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."
|
|
7259
7376
|
})
|
|
7260
7377
|
}).strict();
|
|
7261
|
-
var feedbackResponse =
|
|
7262
|
-
id:
|
|
7378
|
+
var feedbackResponse = z32.object({
|
|
7379
|
+
id: z32.uuid().meta({
|
|
7263
7380
|
description: "The stored message. It exists whatever `mail` says."
|
|
7264
7381
|
}),
|
|
7265
7382
|
mail: mailStatus.meta({
|
|
@@ -7267,91 +7384,91 @@ var feedbackResponse = z31.object({
|
|
|
7267
7384
|
})
|
|
7268
7385
|
}).strict();
|
|
7269
7386
|
|
|
7270
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7271
|
-
import { z as
|
|
7272
|
-
var supportSessionInfo =
|
|
7273
|
-
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({
|
|
7274
7391
|
description: "The support session this token or response describes. Stable for the life of the session."
|
|
7275
7392
|
}),
|
|
7276
|
-
mode:
|
|
7393
|
+
mode: z33.enum(["read", "edit"]).meta({
|
|
7277
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."
|
|
7278
7395
|
}),
|
|
7279
|
-
operator_name:
|
|
7396
|
+
operator_name: z33.string().min(1).max(200).meta({
|
|
7280
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."
|
|
7281
7398
|
}),
|
|
7282
|
-
expires_at:
|
|
7399
|
+
expires_at: z33.iso.datetime().meta({
|
|
7283
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."
|
|
7284
7401
|
})
|
|
7285
7402
|
}).strict();
|
|
7286
|
-
var supportTokenRequest =
|
|
7287
|
-
grant:
|
|
7403
|
+
var supportTokenRequest = z33.object({
|
|
7404
|
+
grant: z33.string().regex(/^[A-Za-z0-9_-]{43}$/).meta({
|
|
7288
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."
|
|
7289
7406
|
}),
|
|
7290
|
-
code_verifier:
|
|
7407
|
+
code_verifier: z33.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
7291
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."
|
|
7292
7409
|
})
|
|
7293
7410
|
}).strict();
|
|
7294
|
-
var supportTokenResponse =
|
|
7295
|
-
access_token:
|
|
7411
|
+
var supportTokenResponse = z33.object({
|
|
7412
|
+
access_token: z33.string().min(1).meta({
|
|
7296
7413
|
description: "The token to send as `Authorization: Bearer <token>`. Short-lived: read `expires_in`, never assume a lifetime."
|
|
7297
7414
|
}),
|
|
7298
|
-
token_type:
|
|
7415
|
+
token_type: z33.literal("Bearer").meta({
|
|
7299
7416
|
description: "`Bearer`, the same spelling every other session token on this wire uses."
|
|
7300
7417
|
}),
|
|
7301
|
-
expires_in:
|
|
7418
|
+
expires_in: z33.number().int().min(1).max(3600).meta({
|
|
7302
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."
|
|
7303
7420
|
}),
|
|
7304
|
-
org_id:
|
|
7421
|
+
org_id: z33.uuid().meta({
|
|
7305
7422
|
description: "The organisation this session was scoped to when the grant was minted."
|
|
7306
7423
|
}),
|
|
7307
7424
|
support: supportSessionInfo.meta({
|
|
7308
7425
|
description: "The session as it stands at the moment of exchange: freshly started, in `read` mode."
|
|
7309
7426
|
})
|
|
7310
7427
|
}).strict();
|
|
7311
|
-
var supportRenewFailRequest =
|
|
7312
|
-
flow_id:
|
|
7313
|
-
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({
|
|
7314
7431
|
description: "The server-held RFC 7636 verifier matching the flow's S256 challenge; never sent to the browser."
|
|
7315
7432
|
}),
|
|
7316
|
-
reason:
|
|
7433
|
+
reason: z33.literal("authority_failed").meta({ description: "A fixed category; browser and IdP error text is not forwarded." })
|
|
7317
7434
|
}).strict();
|
|
7318
|
-
var supportRenewFailRefusal =
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
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()
|
|
7323
7440
|
]);
|
|
7324
7441
|
var authMeSupportResponse = authMeResponse.extend({ support: supportSessionInfo.optional() });
|
|
7325
7442
|
|
|
7326
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7327
|
-
import { z as
|
|
7328
|
-
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({
|
|
7329
7446
|
...robot2.shape,
|
|
7330
7447
|
bridge_state: bridgeState.meta({
|
|
7331
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."
|
|
7332
7449
|
}),
|
|
7333
|
-
published_version:
|
|
7450
|
+
published_version: z34.number().int().positive().nullable().meta({
|
|
7334
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.'
|
|
7335
7452
|
})
|
|
7336
7453
|
});
|
|
7337
|
-
var clientRobotListResponse =
|
|
7338
|
-
robots:
|
|
7454
|
+
var clientRobotListResponse = z34.object({
|
|
7455
|
+
robots: z34.array(clientRobotListItem).meta({
|
|
7339
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."
|
|
7340
7457
|
})
|
|
7341
7458
|
});
|
|
7342
7459
|
|
|
7343
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7344
|
-
import { z as
|
|
7345
|
-
var legalAcceptanceCursor =
|
|
7346
|
-
var legalAcceptanceListQuery =
|
|
7347
|
-
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(),
|
|
7348
7465
|
cursor: legalAcceptanceCursor.optional()
|
|
7349
7466
|
}).strict();
|
|
7350
|
-
var legalAcceptanceVersionRow =
|
|
7351
|
-
id:
|
|
7352
|
-
context:
|
|
7353
|
-
accepted_at:
|
|
7354
|
-
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/),
|
|
7355
7472
|
terms: legalDocumentReference,
|
|
7356
7473
|
dpa: legalDocumentReference.nullable()
|
|
7357
7474
|
}).strict().superRefine((value, ctx) => {
|
|
@@ -7362,22 +7479,22 @@ var legalAcceptanceVersionRow = z34.object({
|
|
|
7362
7479
|
if: { properties: { context: { enum: ["amendment", "price_offer"] } }, required: ["context"] },
|
|
7363
7480
|
then: { properties: { dpa: { type: "null" } }, required: ["dpa"] }
|
|
7364
7481
|
}] });
|
|
7365
|
-
var legalAcceptanceListResponse =
|
|
7366
|
-
acceptances:
|
|
7482
|
+
var legalAcceptanceListResponse = z35.object({
|
|
7483
|
+
acceptances: z35.array(legalAcceptanceVersionRow),
|
|
7367
7484
|
next_cursor: legalAcceptanceCursor.nullable()
|
|
7368
7485
|
}).strict();
|
|
7369
7486
|
|
|
7370
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7371
|
-
import { z as
|
|
7372
|
-
var auditActor =
|
|
7373
|
-
kind:
|
|
7374
|
-
id:
|
|
7375
|
-
label:
|
|
7376
|
-
});
|
|
7377
|
-
var auditEvent =
|
|
7378
|
-
id:
|
|
7379
|
-
org_id:
|
|
7380
|
-
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(),
|
|
7381
7498
|
/**
|
|
7382
7499
|
* A monotonic counter, ascending in write order, unique across the log.
|
|
7383
7500
|
*
|
|
@@ -7396,18 +7513,18 @@ var auditEvent = z35.object({
|
|
|
7396
7513
|
* Required, not optional: an event without a sequence cannot be ordered
|
|
7397
7514
|
* against one that has it, and a log with two orderings has none.
|
|
7398
7515
|
*/
|
|
7399
|
-
seq:
|
|
7516
|
+
seq: z36.number().int().positive(),
|
|
7400
7517
|
actor: auditActor,
|
|
7401
7518
|
/** Stable dotted name, e.g. `app_user.login`, `config.published`. */
|
|
7402
|
-
action:
|
|
7519
|
+
action: z36.string().min(1).max(80),
|
|
7403
7520
|
/**
|
|
7404
7521
|
* What the action was about, if anything — a robot, an app, a user. Free
|
|
7405
7522
|
* of ids the console cannot resolve: carry the label with it.
|
|
7406
7523
|
*/
|
|
7407
|
-
target:
|
|
7408
|
-
kind:
|
|
7409
|
-
id:
|
|
7410
|
-
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)
|
|
7411
7528
|
}).nullable(),
|
|
7412
7529
|
/**
|
|
7413
7530
|
* Action-specific extras.
|
|
@@ -7421,10 +7538,10 @@ var auditEvent = z35.object({
|
|
|
7421
7538
|
* So: never credentials, never tokens. That is a rule, not a guarantee the
|
|
7422
7539
|
* schema enforces.
|
|
7423
7540
|
*/
|
|
7424
|
-
details:
|
|
7541
|
+
details: z36.record(z36.string(), z36.unknown()).nullable()
|
|
7425
7542
|
});
|
|
7426
7543
|
var auditTimestampMs = wireTimestampMs;
|
|
7427
|
-
var auditQuery =
|
|
7544
|
+
var auditQuery = z36.object({
|
|
7428
7545
|
/** Only events with a smaller `seq` — the next, older page. */
|
|
7429
7546
|
before_seq: wireSeqCursor.optional(),
|
|
7430
7547
|
/**
|
|
@@ -7433,9 +7550,9 @@ var auditQuery = z35.object({
|
|
|
7433
7550
|
* coercion's result in either `io` direction, so the artifact would describe
|
|
7434
7551
|
* a shape a query string can never carry.
|
|
7435
7552
|
*/
|
|
7436
|
-
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(),
|
|
7437
7554
|
/** Exact action name, e.g. `config.published`. No prefix matching: a filter that matches more than it says is not one. */
|
|
7438
|
-
action:
|
|
7555
|
+
action: z36.string().min(1).max(80).optional(),
|
|
7439
7556
|
/**
|
|
7440
7557
|
* Everything under a dotted prefix, e.g. `server_key.` for all three
|
|
7441
7558
|
* server-key actions.
|
|
@@ -7452,7 +7569,7 @@ var auditQuery = z35.object({
|
|
|
7452
7569
|
* happily. The cloud is the only enforcement point — the same residual
|
|
7453
7570
|
* `orgLatencyQuery` and `orgUsageQuery` already name.
|
|
7454
7571
|
*/
|
|
7455
|
-
action_prefix:
|
|
7572
|
+
action_prefix: z36.string().min(1).max(80).optional(),
|
|
7456
7573
|
/**
|
|
7457
7574
|
* Only events by this actor.
|
|
7458
7575
|
*
|
|
@@ -7464,9 +7581,9 @@ var auditQuery = z35.object({
|
|
|
7464
7581
|
* Not an injection question — the query is parameterised either way. It is a
|
|
7465
7582
|
* **500 where a 400 belongs**, and a 500 is the answer that explains nothing.
|
|
7466
7583
|
*/
|
|
7467
|
-
actor_id:
|
|
7584
|
+
actor_id: z36.uuid().optional(),
|
|
7468
7585
|
/** Only events about this kind of target, e.g. `robot`. */
|
|
7469
|
-
target_kind:
|
|
7586
|
+
target_kind: z36.string().min(1).max(40).optional(),
|
|
7470
7587
|
/**
|
|
7471
7588
|
* Only events about this target — and, for a robot, also the events that
|
|
7472
7589
|
* name it in `details.robot_id`, so a robot's log includes what was
|
|
@@ -7476,7 +7593,7 @@ var auditQuery = z35.object({
|
|
|
7476
7593
|
* string in this contract and text in the cloud's table, so a uuid rule
|
|
7477
7594
|
* here would refuse ids the log can hold, and no value can fail a cast.
|
|
7478
7595
|
*/
|
|
7479
|
-
target_id:
|
|
7596
|
+
target_id: z36.string().min(1).max(200).optional().meta({
|
|
7480
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."
|
|
7481
7598
|
}),
|
|
7482
7599
|
/**
|
|
@@ -7494,8 +7611,8 @@ var auditQuery = z35.object({
|
|
|
7494
7611
|
message: "action and action_prefix cannot be combined",
|
|
7495
7612
|
path: ["action_prefix"]
|
|
7496
7613
|
});
|
|
7497
|
-
var auditListResponse =
|
|
7498
|
-
events:
|
|
7614
|
+
var auditListResponse = z36.object({
|
|
7615
|
+
events: z36.array(auditEvent),
|
|
7499
7616
|
/**
|
|
7500
7617
|
* The `seq` a caller sends as `before_seq` to keep reading — or `null` when
|
|
7501
7618
|
* there is nothing further.
|
|
@@ -7506,41 +7623,41 @@ var auditListResponse = z35.object({
|
|
|
7506
7623
|
* not mean *no more* here. The same distinction `historySamples` was given
|
|
7507
7624
|
* `truncated` for.
|
|
7508
7625
|
*/
|
|
7509
|
-
next_cursor:
|
|
7626
|
+
next_cursor: z36.number().int().positive().nullable()
|
|
7510
7627
|
});
|
|
7511
7628
|
|
|
7512
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7513
|
-
import { z as
|
|
7514
|
-
var apiError =
|
|
7515
|
-
code:
|
|
7516
|
-
message:
|
|
7517
|
-
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()
|
|
7518
7635
|
});
|
|
7519
|
-
var parameterViolation =
|
|
7520
|
-
field:
|
|
7636
|
+
var parameterViolation = z37.object({
|
|
7637
|
+
field: z37.string().min(1),
|
|
7521
7638
|
/** Which rule failed — `min`, `max`, `enum`, `pattern`, `required`, `undeclared`. */
|
|
7522
|
-
rule:
|
|
7523
|
-
message:
|
|
7639
|
+
rule: z37.string().min(1),
|
|
7640
|
+
message: z37.string().min(1)
|
|
7524
7641
|
});
|
|
7525
|
-
var parameterInvalidDetails =
|
|
7526
|
-
violations:
|
|
7642
|
+
var parameterInvalidDetails = z37.object({
|
|
7643
|
+
violations: z37.array(parameterViolation).min(1)
|
|
7527
7644
|
});
|
|
7528
|
-
var cancelRejectedDetails =
|
|
7529
|
-
goals:
|
|
7645
|
+
var cancelRejectedDetails = z37.object({
|
|
7646
|
+
goals: z37.array(bridgeCancelResultEntry).min(1)
|
|
7530
7647
|
});
|
|
7531
|
-
var invalidCodeDetails =
|
|
7532
|
-
attempts_left:
|
|
7648
|
+
var invalidCodeDetails = z37.object({
|
|
7649
|
+
attempts_left: z37.number().int().min(0).meta({
|
|
7533
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`."
|
|
7534
7651
|
})
|
|
7535
7652
|
});
|
|
7536
|
-
var planLimitDetails =
|
|
7653
|
+
var planLimitDetails = z37.object({
|
|
7537
7654
|
limit: planLimitKey.exclude(["history_days", "audit_days"]).meta({ description: "The limit the action would exceed." }),
|
|
7538
|
-
used:
|
|
7539
|
-
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({
|
|
7540
7657
|
description: "The limit. For `asset_bytes_per_robot`, the org's whole pool: robots \xD7 the plan's bytes per robot."
|
|
7541
7658
|
}),
|
|
7542
7659
|
plan: planId.meta({ description: "The plan whose limit refused: the target plan while a move to a lower plan is pending." }),
|
|
7543
|
-
lifted_by:
|
|
7660
|
+
lifted_by: z37.object({
|
|
7544
7661
|
plan: planId.nullable().meta({ description: "The cheapest higher plan that raises this limit, or `null` when none does." }),
|
|
7545
7662
|
addon: addonKey.nullable().meta({
|
|
7546
7663
|
description: "The add-on that raises this limit, when the org's plan can buy add-ons; otherwise `null`."
|
|
@@ -7556,59 +7673,59 @@ var assetPlanLimitDetails = planLimitDetails.extend({
|
|
|
7556
7673
|
description: "Bytes the org's assets occupy, across every robot, before this upload."
|
|
7557
7674
|
})
|
|
7558
7675
|
});
|
|
7559
|
-
var planRequiredDetails =
|
|
7676
|
+
var planRequiredDetails = z37.object({
|
|
7560
7677
|
feature: planFeature.meta({ description: "The feature the action needs." }),
|
|
7561
7678
|
plan: planId.meta({ description: "The org's current plan." }),
|
|
7562
7679
|
required_plan: planId.meta({ description: "The cheapest plan that has the feature." })
|
|
7563
7680
|
});
|
|
7564
|
-
var orgLockedDetails =
|
|
7565
|
-
reason:
|
|
7681
|
+
var orgLockedDetails = z37.object({
|
|
7682
|
+
reason: z37.enum(["payment", "migration"]).meta({
|
|
7566
7683
|
description: "`payment`: a payment is missing. `migration`: the org did not choose what stays when the beta ended."
|
|
7567
7684
|
})
|
|
7568
7685
|
});
|
|
7569
|
-
var paymentProviderUnavailableDetails =
|
|
7570
|
-
provider:
|
|
7571
|
-
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." })
|
|
7572
7689
|
});
|
|
7573
|
-
var billingDocumentsUnavailableDetails =
|
|
7574
|
-
reason:
|
|
7690
|
+
var billingDocumentsUnavailableDetails = z37.object({
|
|
7691
|
+
reason: z37.enum(["provider_unavailable", "rate_limited", "list_limit_exceeded", "list_changed", "unsupported_document", "profile_mismatch"]).meta({
|
|
7575
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)."
|
|
7576
7693
|
})
|
|
7577
7694
|
}).strict();
|
|
7578
|
-
var confirmationRequiredDetails =
|
|
7579
|
-
preview:
|
|
7695
|
+
var confirmationRequiredDetails = z37.object({
|
|
7696
|
+
preview: z37.unknown().meta({
|
|
7580
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."
|
|
7581
7698
|
})
|
|
7582
7699
|
}).strict();
|
|
7583
|
-
var recordReferencedDetails =
|
|
7584
|
-
references:
|
|
7585
|
-
collection:
|
|
7586
|
-
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." })
|
|
7587
7704
|
}).strict()).meta({
|
|
7588
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."
|
|
7589
7706
|
})
|
|
7590
7707
|
}).strict();
|
|
7591
|
-
var recordChangedDetails =
|
|
7592
|
-
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." })
|
|
7593
7710
|
}).strict();
|
|
7594
|
-
var referenceInvalidDetails =
|
|
7595
|
-
field:
|
|
7596
|
-
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({
|
|
7597
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."
|
|
7598
7715
|
})
|
|
7599
7716
|
}).strict();
|
|
7600
|
-
var requiredMissingDetails =
|
|
7601
|
-
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." })
|
|
7602
7719
|
}).strict();
|
|
7603
|
-
var roleCycleDetails =
|
|
7604
|
-
cycle:
|
|
7720
|
+
var roleCycleDetails = z37.object({
|
|
7721
|
+
cycle: z37.array(z37.string()).min(2).meta({
|
|
7605
7722
|
description: 'The keys along the loop, in order, ending with the key the loop started from: `["a", "b", "a"]`.'
|
|
7606
7723
|
})
|
|
7607
7724
|
});
|
|
7608
7725
|
|
|
7609
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7610
|
-
import { z as
|
|
7611
|
-
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([
|
|
7612
7729
|
"invalid_request",
|
|
7613
7730
|
"invalid_client",
|
|
7614
7731
|
"invalid_grant",
|
|
@@ -7621,11 +7738,11 @@ var oauthErrorCode = z37.enum([
|
|
|
7621
7738
|
/** RFC 8707: the `resource` named is not one this server issues tokens for. */
|
|
7622
7739
|
"invalid_target"
|
|
7623
7740
|
]);
|
|
7624
|
-
var oauthError =
|
|
7741
|
+
var oauthError = z38.object({
|
|
7625
7742
|
error: oauthErrorCode,
|
|
7626
|
-
error_description:
|
|
7743
|
+
error_description: z38.string().min(1).max(500).optional(),
|
|
7627
7744
|
/** Echoed back per RFC 6749 §4.1.2.1 so a client can match the response. */
|
|
7628
|
-
state:
|
|
7745
|
+
state: z38.string().min(1).max(500).optional(),
|
|
7629
7746
|
/**
|
|
7630
7747
|
* **A Fleetless reason carried inside a standard envelope, and it exists
|
|
7631
7748
|
* because the alternative lost a distinction.**
|
|
@@ -7643,9 +7760,9 @@ var oauthError = z37.object({
|
|
|
7643
7760
|
* our own tooling switches on. RFC 6749 §5.2 permits additional members, and
|
|
7644
7761
|
* a client that ignores this one still behaves correctly.
|
|
7645
7762
|
*/
|
|
7646
|
-
fleetless_code:
|
|
7763
|
+
fleetless_code: z38.string().min(1).max(60).optional()
|
|
7647
7764
|
});
|
|
7648
|
-
var redirectUri =
|
|
7765
|
+
var redirectUri = z38.string().min(1).max(2e3).refine((v) => {
|
|
7649
7766
|
let url;
|
|
7650
7767
|
try {
|
|
7651
7768
|
url = new URL(v);
|
|
@@ -7660,183 +7777,183 @@ var redirectUri = z37.string().min(1).max(2e3).refine((v) => {
|
|
|
7660
7777
|
return ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
7661
7778
|
return false;
|
|
7662
7779
|
}, { message: "redirect_uri must be an https URL, or http on an explicit loopback address, and carry no fragment" });
|
|
7663
|
-
var codeChallengeMethod =
|
|
7780
|
+
var codeChallengeMethod = z38.enum(["S256"]);
|
|
7664
7781
|
var MCP_DCR_MAX_REDIRECT_URIS = 5;
|
|
7665
|
-
var dynamicClientRegistrationRequest =
|
|
7666
|
-
redirect_uris:
|
|
7782
|
+
var dynamicClientRegistrationRequest = z38.object({
|
|
7783
|
+
redirect_uris: z38.array(redirectUri).min(1).max(MCP_DCR_MAX_REDIRECT_URIS).meta({
|
|
7667
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.`
|
|
7668
7785
|
}),
|
|
7669
|
-
client_name:
|
|
7786
|
+
client_name: z38.string().min(1).max(200).optional().meta({
|
|
7670
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"*.'
|
|
7671
7788
|
}),
|
|
7672
|
-
token_endpoint_auth_method:
|
|
7789
|
+
token_endpoint_auth_method: z38.enum(["none"]).optional().meta({
|
|
7673
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."
|
|
7674
7791
|
}),
|
|
7675
|
-
grant_types:
|
|
7792
|
+
grant_types: z38.array(z38.enum(["authorization_code", "refresh_token"])).optional().meta({
|
|
7676
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."
|
|
7677
7794
|
}),
|
|
7678
|
-
response_types:
|
|
7795
|
+
response_types: z38.array(z38.enum(["code"])).optional().meta({
|
|
7679
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."
|
|
7680
7797
|
}),
|
|
7681
|
-
scope:
|
|
7798
|
+
scope: z38.string().max(500).optional().meta({
|
|
7682
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."
|
|
7683
7800
|
})
|
|
7684
7801
|
}).meta({
|
|
7685
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)."
|
|
7686
7803
|
});
|
|
7687
|
-
var dynamicClientRegistrationResponse =
|
|
7688
|
-
client_id:
|
|
7804
|
+
var dynamicClientRegistrationResponse = z38.object({
|
|
7805
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7689
7806
|
description: "The identifier this client sends at the authorize and token endpoints. Opaque, and not the app identifier."
|
|
7690
7807
|
}),
|
|
7691
|
-
client_name:
|
|
7808
|
+
client_name: z38.string().min(1).max(200).meta({
|
|
7692
7809
|
description: "The name the client registered under, echoed back. Chosen by the client and not vouched for by Fleetless."
|
|
7693
7810
|
}),
|
|
7694
|
-
redirect_uris:
|
|
7811
|
+
redirect_uris: z38.array(redirectUri).meta({
|
|
7695
7812
|
description: "The redirect URIs this registration was accepted for. A code is returned to one of these and nowhere else."
|
|
7696
7813
|
}),
|
|
7697
|
-
grant_types:
|
|
7814
|
+
grant_types: z38.array(z38.string()).meta({
|
|
7698
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.'
|
|
7699
7816
|
}),
|
|
7700
|
-
response_types:
|
|
7817
|
+
response_types: z38.array(z38.string()).meta({
|
|
7701
7818
|
description: "The response types this client may ask for: `code`."
|
|
7702
7819
|
}),
|
|
7703
|
-
token_endpoint_auth_method:
|
|
7820
|
+
token_endpoint_auth_method: z38.literal("none").meta({
|
|
7704
7821
|
description: "`none` \u2014 this server registers public clients only, and PKCE rather than a secret is what protects the exchange."
|
|
7705
7822
|
}),
|
|
7706
|
-
client_id_issued_at:
|
|
7823
|
+
client_id_issued_at: z38.number().int().nonnegative().meta({
|
|
7707
7824
|
description: "When the registration was created, in seconds since the epoch, per RFC 7591."
|
|
7708
7825
|
}),
|
|
7709
|
-
client_secret_expires_at:
|
|
7826
|
+
client_secret_expires_at: z38.literal(0).meta({
|
|
7710
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."
|
|
7711
7828
|
})
|
|
7712
7829
|
});
|
|
7713
|
-
var oauthCodeTokenRequest =
|
|
7714
|
-
grant_type:
|
|
7830
|
+
var oauthCodeTokenRequest = z38.object({
|
|
7831
|
+
grant_type: z38.literal("authorization_code").meta({
|
|
7715
7832
|
description: "`authorization_code`: this request exchanges the code from the authorize redirect for an access token and a refresh token."
|
|
7716
7833
|
}),
|
|
7717
|
-
code:
|
|
7834
|
+
code: z38.string().min(1).max(500).meta({
|
|
7718
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."
|
|
7719
7836
|
}),
|
|
7720
7837
|
redirect_uri: redirectUri.meta({
|
|
7721
7838
|
description: "The same redirect URI the authorize request used. It is compared, not merely recorded."
|
|
7722
7839
|
}),
|
|
7723
|
-
client_id:
|
|
7840
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7724
7841
|
description: "The client making the exchange, as registered."
|
|
7725
7842
|
}),
|
|
7726
|
-
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({
|
|
7727
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."
|
|
7728
7845
|
}),
|
|
7729
|
-
resource:
|
|
7846
|
+
resource: z38.url().optional().meta({
|
|
7730
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."
|
|
7731
7848
|
})
|
|
7732
7849
|
}).meta({
|
|
7733
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."
|
|
7734
7851
|
});
|
|
7735
|
-
var oauthRefreshTokenRequest =
|
|
7736
|
-
grant_type:
|
|
7852
|
+
var oauthRefreshTokenRequest = z38.object({
|
|
7853
|
+
grant_type: z38.literal("refresh_token").meta({
|
|
7737
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."
|
|
7738
7855
|
}),
|
|
7739
|
-
refresh_token:
|
|
7856
|
+
refresh_token: z38.string().min(1).max(500).meta({
|
|
7740
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."
|
|
7741
7858
|
}),
|
|
7742
|
-
client_id:
|
|
7859
|
+
client_id: z38.string().min(1).max(200).meta({
|
|
7743
7860
|
description: "The client the refresh token was issued to, as registered. A refresh token is not transferable between clients."
|
|
7744
7861
|
}),
|
|
7745
|
-
resource:
|
|
7862
|
+
resource: z38.url().optional().meta({
|
|
7746
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."
|
|
7747
7864
|
})
|
|
7748
7865
|
}).meta({
|
|
7749
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."
|
|
7750
7867
|
});
|
|
7751
|
-
var oauthTokenRequest =
|
|
7868
|
+
var oauthTokenRequest = z38.discriminatedUnion("grant_type", [oauthCodeTokenRequest, oauthRefreshTokenRequest]).meta({
|
|
7752
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."
|
|
7753
7870
|
});
|
|
7754
|
-
var oauthTokenResponse =
|
|
7755
|
-
access_token:
|
|
7871
|
+
var oauthTokenResponse = z38.object({
|
|
7872
|
+
access_token: z38.string().min(1).meta({
|
|
7756
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."
|
|
7757
7874
|
}),
|
|
7758
|
-
token_type:
|
|
7875
|
+
token_type: z38.literal("Bearer").meta({
|
|
7759
7876
|
description: "`Bearer`. RFC 6749 \xA75.1 makes the value case-insensitive for a client reading it; this is the spelling this server emits."
|
|
7760
7877
|
}),
|
|
7761
|
-
expires_in:
|
|
7878
|
+
expires_in: z38.number().int().positive().meta({
|
|
7762
7879
|
description: "How long the access token is valid, in **seconds**, per RFC 6749 \xA75.1. Not a timestamp, and not milliseconds."
|
|
7763
7880
|
}),
|
|
7764
|
-
refresh_token:
|
|
7881
|
+
refresh_token: z38.string().min(1).optional().meta({
|
|
7765
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."
|
|
7766
7883
|
}),
|
|
7767
|
-
scope:
|
|
7884
|
+
scope: z38.string().max(500).optional().meta({
|
|
7768
7885
|
description: "The scopes the issued token actually carries, space-separated."
|
|
7769
7886
|
})
|
|
7770
7887
|
});
|
|
7771
|
-
var authorizationServerMetadata =
|
|
7772
|
-
issuer:
|
|
7888
|
+
var authorizationServerMetadata = z38.object({
|
|
7889
|
+
issuer: z38.url().meta({
|
|
7773
7890
|
description: "The issuer identifier of this authorization server, per RFC 8414 \xA72. It is what a client checks a token's `iss` against."
|
|
7774
7891
|
}),
|
|
7775
|
-
authorization_endpoint:
|
|
7892
|
+
authorization_endpoint: z38.url().meta({
|
|
7776
7893
|
description: "Where a client sends the user to authorize."
|
|
7777
7894
|
}),
|
|
7778
|
-
token_endpoint:
|
|
7895
|
+
token_endpoint: z38.url().meta({
|
|
7779
7896
|
description: "The URL where a client exchanges an authorization code, or a refresh token, for tokens."
|
|
7780
7897
|
}),
|
|
7781
|
-
registration_endpoint:
|
|
7898
|
+
registration_endpoint: z38.url().optional().meta({
|
|
7782
7899
|
description: "The URL where a client may register itself, per RFC 7591. Absent when the app does not accept dynamic clients."
|
|
7783
7900
|
}),
|
|
7784
|
-
client_id_metadata_document_supported:
|
|
7901
|
+
client_id_metadata_document_supported: z38.boolean().optional().meta({
|
|
7785
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."
|
|
7786
7903
|
}),
|
|
7787
|
-
response_types_supported:
|
|
7904
|
+
response_types_supported: z38.array(z38.literal("code")).meta({
|
|
7788
7905
|
description: "The response types this server offers: `code` only, the implicit grant being gone with OAuth 2.1."
|
|
7789
7906
|
}),
|
|
7790
|
-
grant_types_supported:
|
|
7907
|
+
grant_types_supported: z38.array(z38.enum(["authorization_code", "refresh_token"])).meta({
|
|
7791
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."
|
|
7792
7909
|
}),
|
|
7793
|
-
code_challenge_methods_supported:
|
|
7910
|
+
code_challenge_methods_supported: z38.array(codeChallengeMethod).meta({
|
|
7794
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."
|
|
7795
7912
|
}),
|
|
7796
|
-
token_endpoint_auth_methods_supported:
|
|
7913
|
+
token_endpoint_auth_methods_supported: z38.array(z38.literal("none")).meta({
|
|
7797
7914
|
description: "How a client authenticates at the token endpoint: `none`, the public-client method, with PKCE protecting the exchange."
|
|
7798
7915
|
}),
|
|
7799
|
-
scopes_supported:
|
|
7916
|
+
scopes_supported: z38.array(z38.string()).optional().meta({
|
|
7800
7917
|
description: "The scopes this server knows about, where it publishes a list."
|
|
7801
7918
|
})
|
|
7802
7919
|
});
|
|
7803
|
-
var protectedResourceMetadata =
|
|
7804
|
-
resource:
|
|
7920
|
+
var protectedResourceMetadata = z38.object({
|
|
7921
|
+
resource: z38.url().meta({
|
|
7805
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."
|
|
7806
7923
|
}),
|
|
7807
|
-
authorization_servers:
|
|
7924
|
+
authorization_servers: z38.array(z38.url()).min(1).meta({
|
|
7808
7925
|
description: "The authorization servers that may issue tokens for this resource. There is always at least one."
|
|
7809
7926
|
}),
|
|
7810
|
-
bearer_methods_supported:
|
|
7927
|
+
bearer_methods_supported: z38.array(z38.literal("header")).meta({
|
|
7811
7928
|
description: "How a token may be presented: in the `Authorization` header only, never in a query parameter or a form field."
|
|
7812
7929
|
}),
|
|
7813
|
-
scopes_supported:
|
|
7930
|
+
scopes_supported: z38.array(z38.string()).optional().meta({
|
|
7814
7931
|
description: "The scopes this resource understands, where it publishes a list."
|
|
7815
7932
|
})
|
|
7816
7933
|
});
|
|
7817
|
-
var oauthRedirectResponse =
|
|
7818
|
-
redirect_to:
|
|
7934
|
+
var oauthRedirectResponse = z38.object({
|
|
7935
|
+
redirect_to: z38.string().min(1).max(2e3)
|
|
7819
7936
|
});
|
|
7820
|
-
var oauthAuthorizeQuery =
|
|
7821
|
-
response_type:
|
|
7937
|
+
var oauthAuthorizeQuery = z38.object({
|
|
7938
|
+
response_type: z38.literal("code").meta({
|
|
7822
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`."
|
|
7823
7940
|
}),
|
|
7824
|
-
client_id:
|
|
7941
|
+
client_id: z38.string().min(1).meta({
|
|
7825
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."
|
|
7826
7943
|
}),
|
|
7827
|
-
redirect_uri:
|
|
7944
|
+
redirect_uri: z38.string().min(1).meta({
|
|
7828
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."
|
|
7829
7946
|
}),
|
|
7830
|
-
code_challenge:
|
|
7947
|
+
code_challenge: z38.string().min(1).meta({
|
|
7831
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."
|
|
7832
7949
|
}),
|
|
7833
|
-
code_challenge_method:
|
|
7950
|
+
code_challenge_method: z38.literal("S256").meta({
|
|
7834
7951
|
description: "Only `S256`. `plain` is refused: a challenge equal to its verifier defends against nothing."
|
|
7835
7952
|
}),
|
|
7836
|
-
state:
|
|
7953
|
+
state: z38.string().optional().meta({
|
|
7837
7954
|
description: "Returned unchanged on the callback, and on the error redirect too, so a client can bind either answer to its own request."
|
|
7838
7955
|
}),
|
|
7839
|
-
resource:
|
|
7956
|
+
resource: z38.string().optional().meta({
|
|
7840
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."
|
|
7841
7958
|
})
|
|
7842
7959
|
// **No `scope`, because this authorization server issues none.** The field
|
|
@@ -7849,15 +7966,15 @@ var oauthAuthorizeQuery = z37.object({
|
|
|
7849
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."
|
|
7850
7967
|
});
|
|
7851
7968
|
|
|
7852
|
-
// 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
|
|
7853
7973
|
import { z as z40 } from "zod";
|
|
7854
7974
|
|
|
7855
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7975
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-templates.js
|
|
7856
7976
|
import { z as z39 } from "zod";
|
|
7857
|
-
|
|
7858
|
-
// node_modules/.pnpm/@fleetless+contracts@18.1.0/node_modules/@fleetless/contracts/dist/collections-templates.js
|
|
7859
|
-
import { z as z38 } from "zod";
|
|
7860
|
-
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`." });
|
|
7861
7978
|
function deepFreeze(value) {
|
|
7862
7979
|
if (value !== null && typeof value === "object") {
|
|
7863
7980
|
for (const inner of Object.values(value))
|
|
@@ -7913,29 +8030,29 @@ var COLLECTION_JSON_TEMPLATES = deepFreeze({
|
|
|
7913
8030
|
}
|
|
7914
8031
|
});
|
|
7915
8032
|
|
|
7916
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8033
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/collections-values.js
|
|
7917
8034
|
var TOO_DEEP_JSON = `The value nests arrays and objects more than ${COLLECTION_LIMITS.jsonDepth} levels deep.`;
|
|
7918
8035
|
|
|
7919
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7920
|
-
var collectionsIssue =
|
|
7921
|
-
path:
|
|
7922
|
-
code:
|
|
7923
|
-
message:
|
|
7924
|
-
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({
|
|
7925
8042
|
description: "An error makes the document invalid and it cannot be saved or published. A warning and information leave it valid."
|
|
7926
8043
|
})
|
|
7927
8044
|
}).meta({ description: "One finding about a collections document." });
|
|
7928
8045
|
|
|
7929
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
7930
|
-
var timestamp2 =
|
|
7931
|
-
var count4 =
|
|
7932
|
-
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);
|
|
7933
8050
|
var UNIQUE_DISCARDED_LISTED = 1e3;
|
|
7934
|
-
var token =
|
|
8051
|
+
var token = z41.string().min(1);
|
|
7935
8052
|
var confirm = token.meta({
|
|
7936
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."
|
|
7937
8054
|
});
|
|
7938
|
-
var sha256 =
|
|
8055
|
+
var sha256 = z41.string().regex(/^[0-9a-f]{64}$/);
|
|
7939
8056
|
var purgeConfirm = token.meta({
|
|
7940
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."
|
|
7941
8058
|
});
|
|
@@ -7957,16 +8074,16 @@ function utf8Length(text3) {
|
|
|
7957
8074
|
}
|
|
7958
8075
|
var collection = collectionKey.meta({ description: "The key of the collection." });
|
|
7959
8076
|
var field = collectionKey.meta({ description: "The key of the field." });
|
|
7960
|
-
var collectionsEffect =
|
|
7961
|
-
|
|
7962
|
-
kind:
|
|
8077
|
+
var collectionsEffect = z41.discriminatedUnion("kind", [
|
|
8078
|
+
z41.object({
|
|
8079
|
+
kind: z41.literal("collection_removed"),
|
|
7963
8080
|
collection,
|
|
7964
8081
|
records: count4.meta({ description: "Records deleted with the collection." })
|
|
7965
8082
|
}).strict().meta({
|
|
7966
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."
|
|
7967
8084
|
}),
|
|
7968
|
-
|
|
7969
|
-
kind:
|
|
8085
|
+
z41.object({
|
|
8086
|
+
kind: z41.literal("collection_recreated"),
|
|
7970
8087
|
collection,
|
|
7971
8088
|
records: count4.meta({ description: "Records deleted by the re-creation." }),
|
|
7972
8089
|
from: collectionBinding,
|
|
@@ -7974,101 +8091,101 @@ var collectionsEffect = z40.discriminatedUnion("kind", [
|
|
|
7974
8091
|
}).strict().meta({
|
|
7975
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."
|
|
7976
8093
|
}),
|
|
7977
|
-
|
|
7978
|
-
kind:
|
|
8094
|
+
z41.object({
|
|
8095
|
+
kind: z41.literal("records_created"),
|
|
7979
8096
|
collection,
|
|
7980
8097
|
count: count4.meta({ description: "Records created, one for each robot attached to the app." })
|
|
7981
8098
|
}).strict().meta({ description: "A collection with one record per robot got the records of the robots that have none." }),
|
|
7982
|
-
|
|
7983
|
-
kind:
|
|
8099
|
+
z41.object({
|
|
8100
|
+
kind: z41.literal("field_removed"),
|
|
7984
8101
|
collection,
|
|
7985
8102
|
field,
|
|
7986
8103
|
values: count4.meta({ description: "Values removed from records." })
|
|
7987
8104
|
}).strict().meta({ description: "The field is gone from the document, so its values are removed from the records." }),
|
|
7988
|
-
|
|
7989
|
-
kind:
|
|
8105
|
+
z41.object({
|
|
8106
|
+
kind: z41.literal("defaults_filled"),
|
|
7990
8107
|
collection,
|
|
7991
8108
|
field,
|
|
7992
8109
|
records: count4.meta({ description: "Records that receive the default." })
|
|
7993
8110
|
}).strict().meta({ description: "Records without a value get the default of a new or newly required field." }),
|
|
7994
|
-
|
|
7995
|
-
kind:
|
|
8111
|
+
z41.object({
|
|
8112
|
+
kind: z41.literal("values_converted"),
|
|
7996
8113
|
collection,
|
|
7997
8114
|
field,
|
|
7998
8115
|
converted: count4.meta({ description: "Values that became a value of the new type." }),
|
|
7999
8116
|
discarded: count4.meta({ description: "Values that could not be converted and were removed." })
|
|
8000
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." }),
|
|
8001
|
-
|
|
8002
|
-
kind:
|
|
8118
|
+
z41.object({
|
|
8119
|
+
kind: z41.literal("values_discarded"),
|
|
8003
8120
|
collection,
|
|
8004
8121
|
field,
|
|
8005
|
-
reason:
|
|
8122
|
+
reason: z41.enum(["reference_target_changed", "option_removed", "constraint"]).meta({
|
|
8006
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."
|
|
8007
8124
|
}),
|
|
8008
8125
|
values: count4.meta({ description: "Values removed from records." })
|
|
8009
8126
|
}).strict().meta({ description: "Values that the changed field no longer accepts are removed." }),
|
|
8010
|
-
|
|
8011
|
-
kind:
|
|
8127
|
+
z41.object({
|
|
8128
|
+
kind: z41.literal("unique_discarded"),
|
|
8012
8129
|
collection,
|
|
8013
8130
|
field,
|
|
8014
8131
|
total: count4.meta({ description: "The exact number of values removed." }),
|
|
8015
|
-
records:
|
|
8016
|
-
id:
|
|
8017
|
-
display:
|
|
8018
|
-
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." })
|
|
8019
8136
|
}).strict()).max(UNIQUE_DISCARDED_LISTED).meta({ description: `The records that lose their value, at most ${UNIQUE_DISCARDED_LISTED}; \`total\` is the exact number.` })
|
|
8020
8137
|
}).strict().meta({
|
|
8021
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."
|
|
8022
8139
|
}),
|
|
8023
|
-
|
|
8024
|
-
kind:
|
|
8140
|
+
z41.object({
|
|
8141
|
+
kind: z41.literal("required_left_empty"),
|
|
8025
8142
|
collection,
|
|
8026
8143
|
field,
|
|
8027
8144
|
records: count4.meta({ description: "Records left without a value." })
|
|
8028
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." }),
|
|
8029
|
-
|
|
8030
|
-
kind:
|
|
8146
|
+
z41.object({
|
|
8147
|
+
kind: z41.literal("references_cleared"),
|
|
8031
8148
|
collection,
|
|
8032
8149
|
field,
|
|
8033
8150
|
values: count4.meta({ description: "References removed." })
|
|
8034
8151
|
}).strict().meta({ description: "References that pointed at records deleted by this change are cleared." })
|
|
8035
8152
|
]).meta({ description: "One effect of a publish or restore on existing data. Effects that would change nothing are not listed." });
|
|
8036
|
-
var collectionsAccessChange =
|
|
8153
|
+
var collectionsAccessChange = z41.object({
|
|
8037
8154
|
collection,
|
|
8038
|
-
action:
|
|
8039
|
-
from:
|
|
8040
|
-
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." })
|
|
8041
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." });
|
|
8042
|
-
var collectionsSchemaPreview =
|
|
8159
|
+
var collectionsSchemaPreview = z41.object({
|
|
8043
8160
|
from_version: schemaVersion2.nullable().meta({ description: "The version that is published now. Null before the first publish." }),
|
|
8044
8161
|
to_version: schemaVersion2.meta({ description: "The number the new version would get." }),
|
|
8045
|
-
valid:
|
|
8046
|
-
issues:
|
|
8047
|
-
effects:
|
|
8048
|
-
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),
|
|
8049
8166
|
source_sha256: sha256.meta({
|
|
8050
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."
|
|
8051
8168
|
}),
|
|
8052
|
-
token:
|
|
8169
|
+
token: z41.string().nullable().meta({
|
|
8053
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."
|
|
8054
8171
|
})
|
|
8055
8172
|
}).meta({ description: "The preview of publishing the draft: its problems, its effects on existing data and the token that confirms them." });
|
|
8056
|
-
var collectionsDraftResponse =
|
|
8057
|
-
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." }),
|
|
8058
8175
|
doc: collectionsDocument.nullable().meta({ description: "The document the source parses to. Null when the source is empty." }),
|
|
8059
8176
|
updated_at: timestamp2.nullable().meta({ description: "When the draft was saved. Null when no draft is saved." }),
|
|
8060
8177
|
updated_by: collectionActor.nullable().meta({ description: "Who saved the draft. Null when no draft is saved." }),
|
|
8061
|
-
issues:
|
|
8178
|
+
issues: z41.array(collectionsIssue).meta({ description: "Warnings and information about the document. A draft is saved only when it has no errors." })
|
|
8062
8179
|
}).meta({ description: "The draft of the schema document, or the current version when there is no draft." });
|
|
8063
|
-
var putCollectionsDraftRequest =
|
|
8180
|
+
var putCollectionsDraftRequest = z41.object({
|
|
8064
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.
|
|
8065
|
-
source:
|
|
8182
|
+
source: z41.string().max(COLLECTION_LIMITS.schemaSourceBytes).refine((text3) => utf8Length(text3) <= COLLECTION_LIMITS.schemaSourceBytes, {
|
|
8066
8183
|
message: `The source is longer than ${COLLECTION_LIMITS.schemaSourceBytes.toLocaleString("en-US")} bytes of UTF-8.`
|
|
8067
8184
|
}).meta({
|
|
8068
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.`
|
|
8069
8186
|
})
|
|
8070
8187
|
}).strict().meta({ description: "Replaces the draft with a whole document." });
|
|
8071
|
-
var collectionsPublishRequest =
|
|
8188
|
+
var collectionsPublishRequest = z41.object({
|
|
8072
8189
|
confirm: confirm.optional(),
|
|
8073
8190
|
source_sha256: sha256.meta({
|
|
8074
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."
|
|
@@ -8076,27 +8193,27 @@ var collectionsPublishRequest = z40.object({
|
|
|
8076
8193
|
}).strict().meta({
|
|
8077
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."
|
|
8078
8195
|
});
|
|
8079
|
-
var collectionsPublishResponse =
|
|
8196
|
+
var collectionsPublishResponse = z41.object({
|
|
8080
8197
|
version: schemaVersion2,
|
|
8081
8198
|
published_at: timestamp2,
|
|
8082
|
-
effects:
|
|
8083
|
-
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." })
|
|
8084
8201
|
}).meta({ description: "The version that was published and the effects it had." });
|
|
8085
|
-
var collectionsVersionSummary =
|
|
8202
|
+
var collectionsVersionSummary = z41.object({
|
|
8086
8203
|
version: schemaVersion2,
|
|
8087
8204
|
published_at: timestamp2,
|
|
8088
8205
|
published_by: collectionActor,
|
|
8089
|
-
effect_counts:
|
|
8206
|
+
effect_counts: z41.record(z41.string(), count4).meta({
|
|
8090
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."
|
|
8091
8208
|
}),
|
|
8092
8209
|
restored_from: schemaVersion2.nullable().meta({ description: "The version this one restored. Null for an ordinary publish." }),
|
|
8093
|
-
restore_with_data:
|
|
8210
|
+
restore_with_data: z41.boolean().meta({
|
|
8094
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.`
|
|
8095
8212
|
}),
|
|
8096
|
-
with_data:
|
|
8213
|
+
with_data: z41.boolean().meta({
|
|
8097
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."
|
|
8098
8215
|
}),
|
|
8099
|
-
reverted_totals:
|
|
8216
|
+
reverted_totals: z41.object({
|
|
8100
8217
|
changes: count4.meta({ description: "Changes made since the restore point that were reverted." }),
|
|
8101
8218
|
records_back: count4.meta({ description: "Deleted records that came back." }),
|
|
8102
8219
|
records_deleted: count4.meta({ description: "Records created since the restore point that were deleted." }),
|
|
@@ -8105,110 +8222,110 @@ var collectionsVersionSummary = z40.object({
|
|
|
8105
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`."
|
|
8106
8223
|
})
|
|
8107
8224
|
}).meta({ description: "A published version of the schema document." });
|
|
8108
|
-
var collectionsVersionsResponse =
|
|
8225
|
+
var collectionsVersionsResponse = z41.object({
|
|
8109
8226
|
current: schemaVersion2.nullable().meta({ description: "The version in force. Null before the first publish." }),
|
|
8110
|
-
versions:
|
|
8227
|
+
versions: z41.array(collectionsVersionSummary).meta({ description: "Newest first." })
|
|
8111
8228
|
}).meta({ description: "The published versions of the schema document." });
|
|
8112
8229
|
var collectionsVersionResponse = collectionsVersionSummary.extend({
|
|
8113
|
-
source:
|
|
8230
|
+
source: z41.string().meta({ description: "The document as it was published, as text." }),
|
|
8114
8231
|
doc: collectionsDocument
|
|
8115
8232
|
}).meta({ description: "One published version with its document." });
|
|
8116
|
-
var collectionsRestorePreview =
|
|
8233
|
+
var collectionsRestorePreview = z41.object({
|
|
8117
8234
|
version: schemaVersion2.meta({ description: "The version that would be restored." }),
|
|
8118
|
-
with_data:
|
|
8119
|
-
data_possible:
|
|
8120
|
-
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({
|
|
8121
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.`
|
|
8122
8239
|
}),
|
|
8123
|
-
touched:
|
|
8124
|
-
selected:
|
|
8125
|
-
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({
|
|
8126
8243
|
collection,
|
|
8127
8244
|
changes: count4.meta({ description: "Changes made since the restore point that would be reverted." }),
|
|
8128
8245
|
records_back: count4.meta({ description: "Deleted records that would come back." }),
|
|
8129
8246
|
records_deleted: count4.meta({ description: "Records created since the restore point that would be deleted." })
|
|
8130
8247
|
}).strict()).meta({ description: "What putting the records back would do, per selected collection." }),
|
|
8131
8248
|
robots_gone: count4.meta({ description: "Records of robots that were deleted since cannot come back; this is how many." }),
|
|
8132
|
-
effects:
|
|
8133
|
-
access_changes:
|
|
8134
|
-
issues:
|
|
8135
|
-
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({
|
|
8136
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."
|
|
8137
8254
|
})
|
|
8138
8255
|
}).meta({ description: "The preview of restoring a version, with the token that confirms it." });
|
|
8139
|
-
var collectionsRestorePreviewQuery =
|
|
8140
|
-
data:
|
|
8141
|
-
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()
|
|
8142
8259
|
}).strict();
|
|
8143
|
-
var collectionsRestoreRequest =
|
|
8144
|
-
data:
|
|
8145
|
-
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(),
|
|
8146
8263
|
confirm: confirm.optional()
|
|
8147
8264
|
}).strict().meta({ description: "Restores a version. Send the `data` and `collections` of the preview together with its token as `confirm`." });
|
|
8148
|
-
var collectionsRestoreResponse = collectionsPublishResponse.extend({ with_data:
|
|
8149
|
-
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({
|
|
8150
8267
|
before: timestamp2.meta({
|
|
8151
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`)."
|
|
8152
8269
|
}),
|
|
8153
8270
|
collection: collectionKey.meta({ description: "Purge only this collection. Default: the whole app." }).optional(),
|
|
8154
8271
|
confirm: purgeConfirm.optional()
|
|
8155
8272
|
}).strict().meta({ description: "Removes the history older than a date. The preview answers with a token; send it as `confirm` to purge." });
|
|
8156
|
-
var collectionsPurgePreview =
|
|
8273
|
+
var collectionsPurgePreview = z41.object({
|
|
8157
8274
|
before: timestamp2,
|
|
8158
8275
|
collection: collectionKey.nullable().meta({ description: "The collection the purge is limited to. Null for the whole app." }),
|
|
8159
8276
|
revisions: count4.meta({ description: "Revisions that would be removed." }),
|
|
8160
8277
|
bytes: count4.meta({ description: "Their size in bytes." }),
|
|
8161
|
-
restore_points_lost:
|
|
8278
|
+
restore_points_lost: z41.array(schemaVersion2).meta({
|
|
8162
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."
|
|
8163
8280
|
}),
|
|
8164
8281
|
token: token.meta({ description: "Stands for exactly this purge: send it as `confirm` to carry it out." })
|
|
8165
8282
|
}).meta({ description: "What a purge would remove, with the token that confirms it." });
|
|
8166
|
-
var collectionsPurgeResponse =
|
|
8283
|
+
var collectionsPurgeResponse = z41.object({
|
|
8167
8284
|
revisions: count4.meta({ description: "Revisions removed." }),
|
|
8168
8285
|
bytes: count4.meta({ description: "Their size in bytes." }),
|
|
8169
8286
|
purged_at: timestamp2
|
|
8170
8287
|
}).meta({ description: "What a purge removed." });
|
|
8171
8288
|
|
|
8172
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8173
|
-
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";
|
|
8174
8291
|
var IMPORT_ERRORS_LISTED = 1e3;
|
|
8175
|
-
var count5 =
|
|
8176
|
-
var confirm2 =
|
|
8292
|
+
var count5 = z42.number().int().min(0);
|
|
8293
|
+
var confirm2 = z42.string().min(1).meta({
|
|
8177
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."
|
|
8178
8295
|
});
|
|
8179
|
-
var mappingTarget = collectionKey.or(
|
|
8296
|
+
var mappingTarget = collectionKey.or(z42.literal("")).meta({
|
|
8180
8297
|
description: "The key of the field the column is imported into, the literal `robot`, or an empty string to leave the column out."
|
|
8181
8298
|
});
|
|
8182
|
-
var importScope =
|
|
8299
|
+
var importScope = z42.object({
|
|
8183
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(),
|
|
8184
|
-
robot_id:
|
|
8301
|
+
robot_id: z42.uuid().meta({ description: "Only records of this robot can be deleted." }).optional()
|
|
8185
8302
|
}).strict().refine((scope) => !(scope.filter !== void 0 && scope.robot_id !== void 0), {
|
|
8186
8303
|
message: "A scope is a filter or a robot, not both",
|
|
8187
8304
|
path: ["robot_id"]
|
|
8188
8305
|
}).meta({
|
|
8189
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`."
|
|
8190
8307
|
});
|
|
8191
|
-
var collectionImportRequest =
|
|
8192
|
-
format:
|
|
8308
|
+
var collectionImportRequest = z42.object({
|
|
8309
|
+
format: z42.enum(["csv", "json"]).meta({
|
|
8193
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."
|
|
8194
8311
|
}),
|
|
8195
|
-
content:
|
|
8312
|
+
content: z42.string().max(COLLECTION_LIMITS.importBytes).meta({
|
|
8196
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.`
|
|
8197
8314
|
}),
|
|
8198
|
-
mapping:
|
|
8315
|
+
mapping: z42.record(z42.string(), mappingTarget).meta({
|
|
8199
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."
|
|
8200
8317
|
}).optional(),
|
|
8201
|
-
references:
|
|
8318
|
+
references: z42.record(collectionKey, collectionKey).meta({
|
|
8202
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."
|
|
8203
8320
|
}).optional(),
|
|
8204
8321
|
key: collectionKey.meta({
|
|
8205
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."
|
|
8206
8323
|
}).optional(),
|
|
8207
|
-
mode:
|
|
8324
|
+
mode: z42.enum(["upsert", "mirror"]).meta({
|
|
8208
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`)."
|
|
8209
8326
|
}).optional(),
|
|
8210
8327
|
scope: importScope.optional(),
|
|
8211
|
-
robot_id:
|
|
8328
|
+
robot_id: z42.uuid().meta({
|
|
8212
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`."
|
|
8213
8330
|
}).optional(),
|
|
8214
8331
|
confirm: confirm2.optional()
|
|
@@ -8216,77 +8333,77 @@ var collectionImportRequest = z41.object({
|
|
|
8216
8333
|
message: 'Mode "mirror" needs a key: records are matched to the file by it',
|
|
8217
8334
|
path: ["key"]
|
|
8218
8335
|
}).meta({ description: "Imports a file of records into a collection, all or nothing." });
|
|
8219
|
-
var importError =
|
|
8336
|
+
var importError = z42.object({
|
|
8220
8337
|
row: count5.meta({
|
|
8221
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)."
|
|
8222
8339
|
}),
|
|
8223
|
-
column:
|
|
8224
|
-
value:
|
|
8225
|
-
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." })
|
|
8226
8343
|
}).meta({ description: "A row, column and value that stop the import, with the reason." });
|
|
8227
|
-
var collectionImportPreview =
|
|
8228
|
-
counts:
|
|
8344
|
+
var collectionImportPreview = z42.object({
|
|
8345
|
+
counts: z42.object({
|
|
8229
8346
|
unchanged: count5.meta({ description: "Rows that match a record that already has these values." }),
|
|
8230
8347
|
new: count5.meta({ description: "Records that would be created." }),
|
|
8231
8348
|
updated: count5.meta({ description: "Records that would change." }),
|
|
8232
8349
|
deleted: count5.meta({ description: "Records that `mirror` would delete." }),
|
|
8233
8350
|
errors: count5.meta({ description: "Problems found in the file. The same number as `errors_total`." })
|
|
8234
8351
|
}).meta({ description: "What the import would do, counted." }),
|
|
8235
|
-
errors:
|
|
8352
|
+
errors: z42.array(importError).max(IMPORT_ERRORS_LISTED).meta({
|
|
8236
8353
|
description: `The problems found, in file order, at most ${IMPORT_ERRORS_LISTED.toLocaleString("en-US")}; \`errors_total\` is the exact number.`
|
|
8237
8354
|
}),
|
|
8238
8355
|
errors_total: count5.meta({ description: "The exact number of problems found." }),
|
|
8239
|
-
mirror_scope:
|
|
8356
|
+
mirror_scope: z42.enum(["collection", "filter", "robot"]).nullable().meta({
|
|
8240
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`."
|
|
8241
8358
|
}),
|
|
8242
|
-
warnings:
|
|
8359
|
+
warnings: z42.array(z42.enum(["plan_limit"])).meta({
|
|
8243
8360
|
description: "`plan_limit`: importing the file would take the organization over a limit of its plan, so the import itself would be refused."
|
|
8244
8361
|
}),
|
|
8245
|
-
token:
|
|
8362
|
+
token: z42.string().min(1).nullable().meta({
|
|
8246
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."
|
|
8247
8364
|
})
|
|
8248
8365
|
}).meta({ description: "The preview of an import: what it would do, the problems that stop it and the token that confirms it." });
|
|
8249
|
-
var collectionImportResult =
|
|
8366
|
+
var collectionImportResult = z42.object({
|
|
8250
8367
|
created: count5.meta({ description: "Records created." }),
|
|
8251
8368
|
updated: count5.meta({ description: "Records changed." }),
|
|
8252
8369
|
deleted: count5.meta({ description: "Records deleted by `mirror`." }),
|
|
8253
8370
|
unchanged: count5.meta({ description: "Rows that matched a record that already had these values." })
|
|
8254
8371
|
}).meta({ description: "What an import did." });
|
|
8255
|
-
var collectionExportQuery =
|
|
8256
|
-
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." }),
|
|
8257
8374
|
// The same four parameters, in the same words, as the record list they narrow down.
|
|
8258
8375
|
...collectionRecordListQuery.pick({ filter: true, search: true, sort: true, robot: true }).shape,
|
|
8259
|
-
fields:
|
|
8260
|
-
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({
|
|
8261
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."
|
|
8262
8379
|
}).optional(),
|
|
8263
|
-
system:
|
|
8380
|
+
system: z42.enum(["true", "false"]).meta({
|
|
8264
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`."
|
|
8265
8382
|
}).optional()
|
|
8266
8383
|
}).strict();
|
|
8267
8384
|
|
|
8268
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8269
|
-
import { z as
|
|
8270
|
-
var text2 = (max) =>
|
|
8271
|
-
var email =
|
|
8272
|
-
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({
|
|
8273
8390
|
line1: text2(200),
|
|
8274
8391
|
line2: text2(200).nullable().default(null),
|
|
8275
8392
|
postalCode: text2(32),
|
|
8276
8393
|
city: text2(120),
|
|
8277
|
-
country:
|
|
8394
|
+
country: z43.string().regex(/^\P{Cc}*$/u).trim().regex(/^[A-Z]{2}$/)
|
|
8278
8395
|
}).strict();
|
|
8279
|
-
var controllerRegisterPrivacyContact =
|
|
8396
|
+
var controllerRegisterPrivacyContact = z43.object({
|
|
8280
8397
|
name: text2(200),
|
|
8281
8398
|
email,
|
|
8282
|
-
role:
|
|
8399
|
+
role: z43.enum(["general", "appointed_dpo"])
|
|
8283
8400
|
}).strict();
|
|
8284
|
-
var controllerRegisterRepresentative =
|
|
8401
|
+
var controllerRegisterRepresentative = z43.object({
|
|
8285
8402
|
name: text2(200),
|
|
8286
8403
|
email,
|
|
8287
8404
|
address: text2(500)
|
|
8288
8405
|
}).strict();
|
|
8289
|
-
var controllerRegisterWrite =
|
|
8406
|
+
var controllerRegisterWrite = z43.object({
|
|
8290
8407
|
legalName: text2(200),
|
|
8291
8408
|
address: controllerRegisterAddress,
|
|
8292
8409
|
privacyContact: controllerRegisterPrivacyContact.nullable(),
|
|
@@ -8296,19 +8413,19 @@ var controllerRegisterWrite = z42.object({
|
|
|
8296
8413
|
var controllerRegisterOrgRecord = controllerRegisterWrite.extend({
|
|
8297
8414
|
legalName: text2(200).nullable(),
|
|
8298
8415
|
address: controllerRegisterAddress.nullable(),
|
|
8299
|
-
updatedAt:
|
|
8300
|
-
updatedByKind:
|
|
8301
|
-
updatedById:
|
|
8416
|
+
updatedAt: z43.iso.datetime(),
|
|
8417
|
+
updatedByKind: z43.enum(["owner", "operator"]),
|
|
8418
|
+
updatedById: z43.uuid()
|
|
8302
8419
|
}).strict();
|
|
8303
|
-
var controllerRegisterOrgResponse =
|
|
8304
|
-
orgId:
|
|
8420
|
+
var controllerRegisterOrgResponse = z43.object({
|
|
8421
|
+
orgId: z43.uuid(),
|
|
8305
8422
|
details: controllerRegisterOrgRecord.nullable()
|
|
8306
8423
|
}).strict();
|
|
8307
8424
|
|
|
8308
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8309
|
-
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";
|
|
8310
8427
|
|
|
8311
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8428
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/iana-time-zones.js
|
|
8312
8429
|
var ianaTimeZones = [
|
|
8313
8430
|
"UTC",
|
|
8314
8431
|
"Etc/UTC",
|
|
@@ -8733,8 +8850,8 @@ var ianaTimeZones = [
|
|
|
8733
8850
|
"Pacific/Wallis"
|
|
8734
8851
|
];
|
|
8735
8852
|
|
|
8736
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
8737
|
-
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}$/);
|
|
8738
8855
|
var EU_COUNTRIES = [
|
|
8739
8856
|
"AT",
|
|
8740
8857
|
"BE",
|
|
@@ -8768,52 +8885,52 @@ var SELLER_COUNTRY = "DE";
|
|
|
8768
8885
|
function isEuCountry(country) {
|
|
8769
8886
|
return EU_COUNTRIES.includes(country);
|
|
8770
8887
|
}
|
|
8771
|
-
var payerKind =
|
|
8772
|
-
var billingCycle =
|
|
8773
|
-
var vatTreatment =
|
|
8774
|
-
var payerRefusalRule =
|
|
8775
|
-
var viesPendingReason =
|
|
8776
|
-
var viesOutage =
|
|
8777
|
-
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({
|
|
8778
8895
|
description: "`member_state`: the VAT register of `country` does not answer VIES. `vies`: VIES itself does not answer."
|
|
8779
8896
|
}),
|
|
8780
8897
|
country: countryCode.meta({ description: "The billing address's country whose VAT ID was asked for. Greece is `GR`, never VIES's `EL`." })
|
|
8781
8898
|
}).strict();
|
|
8782
8899
|
function viesPending(shape) {
|
|
8783
|
-
return
|
|
8784
|
-
|
|
8785
|
-
|
|
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()
|
|
8786
8903
|
]);
|
|
8787
8904
|
}
|
|
8788
|
-
var vatDecision =
|
|
8789
|
-
|
|
8790
|
-
viesPending({ state:
|
|
8791
|
-
|
|
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()
|
|
8792
8909
|
]);
|
|
8793
|
-
var billingAddress =
|
|
8794
|
-
line1:
|
|
8795
|
-
line2:
|
|
8796
|
-
postal_code:
|
|
8797
|
-
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." }),
|
|
8798
8915
|
country: countryCode.meta({ description: "The billing country, used for purchase eligibility and VAT." }),
|
|
8799
|
-
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." })
|
|
8800
8917
|
}).strict();
|
|
8801
|
-
var billingDetails =
|
|
8802
|
-
|
|
8803
|
-
kind:
|
|
8804
|
-
company_name:
|
|
8805
|
-
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({
|
|
8806
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."
|
|
8807
8924
|
}),
|
|
8808
|
-
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." }),
|
|
8809
8926
|
address: billingAddress.meta({ description: "The billing address." }),
|
|
8810
|
-
invoice_email:
|
|
8927
|
+
invoice_email: z44.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
8811
8928
|
}).strict().meta({ description: "A company: name and an optional VAT ID, never 'full name'." }),
|
|
8812
|
-
|
|
8813
|
-
kind:
|
|
8814
|
-
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." }),
|
|
8815
8932
|
address: billingAddress.meta({ description: "The billing address." }),
|
|
8816
|
-
invoice_email:
|
|
8933
|
+
invoice_email: z44.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
8817
8934
|
}).strict().meta({ description: "A person: a full name, never a VAT ID \u2014 only a company can be VAT-registered." })
|
|
8818
8935
|
]);
|
|
8819
8936
|
var purchaseBillingDetails = billingDetails.options[0].superRefine((payer, ctx) => {
|
|
@@ -8828,55 +8945,55 @@ var purchaseBillingDetails = billingDetails.options[0].superRefine((payer, ctx)
|
|
|
8828
8945
|
ctx.addIssue({ code: "custom", path: ["address", "state"], message: "us_state_required" });
|
|
8829
8946
|
}
|
|
8830
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." });
|
|
8831
|
-
var purchaseOperation =
|
|
8948
|
+
var purchaseOperation = z44.enum(["checkout", "paid_change", "invoice_payment", "payment_method_invoice", "mandate_setup"]);
|
|
8832
8949
|
var chargeOperation = purchaseOperation.exclude(["mandate_setup"]);
|
|
8833
|
-
var checkoutRequest =
|
|
8950
|
+
var checkoutRequest = z44.object({
|
|
8834
8951
|
operation_key: purchaseOperationKey,
|
|
8835
|
-
plan:
|
|
8952
|
+
plan: z44.enum(["plus", "pro"]).meta({ description: "The paid plan to buy; Basic requires no checkout." }),
|
|
8836
8953
|
cycle: billingCycle.meta({ description: "Monthly, or yearly at 15 percent off." }),
|
|
8837
8954
|
addons: orgAddons.partial().strict().optional().meta({ description: "Add-on units to buy; Pro only. Cloud refuses add-ons on Plus." }),
|
|
8838
8955
|
billing: purchaseBillingDetails.meta({ description: "The company buying the plan. Country requirements, current VIES and the email policy must pass before charging." }),
|
|
8839
|
-
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." })
|
|
8840
8957
|
}).strict();
|
|
8841
|
-
var purchaseCents =
|
|
8842
|
-
var purchaseQuote =
|
|
8843
|
-
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." }),
|
|
8844
8961
|
net_cents: purchaseCents.meta({ description: "Current charge excluding VAT, in cents." }),
|
|
8845
8962
|
vat_cents: purchaseCents.meta({ description: "VAT on the current charge, in cents." }),
|
|
8846
8963
|
gross_cents: purchaseCents.meta({ description: "Total to confirm, including VAT, in cents." }),
|
|
8847
|
-
rate_percent:
|
|
8964
|
+
rate_percent: z44.number().int().min(0).max(100).meta({ description: "VAT rate in whole percent." })
|
|
8848
8965
|
}).strict();
|
|
8849
8966
|
var quoteIdentity = {
|
|
8850
|
-
quote_revision:
|
|
8851
|
-
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." })
|
|
8852
8969
|
};
|
|
8853
|
-
var billingDecisionDisplayRequest =
|
|
8970
|
+
var billingDecisionDisplayRequest = z44.object({
|
|
8854
8971
|
operation_key: purchaseOperationKey,
|
|
8855
|
-
operation:
|
|
8972
|
+
operation: z44.enum(["checkout", "paid_change"])
|
|
8856
8973
|
}).strict();
|
|
8857
8974
|
var selectionBase = {
|
|
8858
|
-
plan:
|
|
8975
|
+
plan: z44.enum(["basic", "plus", "pro"]),
|
|
8859
8976
|
cycle: billingCycle,
|
|
8860
8977
|
addons: orgAddons
|
|
8861
8978
|
};
|
|
8862
|
-
var purchaseSelection =
|
|
8863
|
-
var planChangeSelection =
|
|
8864
|
-
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();
|
|
8865
8982
|
var treatmentRules = [
|
|
8866
8983
|
{ if: { properties: { vat_treatment: { const: "de_standard" } }, required: ["vat_treatment"] }, then: { properties: { quote: { properties: { rate_percent: { const: 19 } } } } } },
|
|
8867
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" } } } },
|
|
8868
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" } } } }
|
|
8869
8986
|
];
|
|
8870
|
-
var billingDecisionAmounts =
|
|
8871
|
-
currency:
|
|
8987
|
+
var billingDecisionAmounts = z44.object({
|
|
8988
|
+
currency: z44.literal("eur"),
|
|
8872
8989
|
quote: purchaseQuote,
|
|
8873
8990
|
plan_net_cents: purchaseCents,
|
|
8874
|
-
addon_lines:
|
|
8991
|
+
addon_lines: z44.array(addonLine),
|
|
8875
8992
|
period_net_cents: purchaseCents,
|
|
8876
8993
|
period_vat_cents: purchaseCents,
|
|
8877
8994
|
period_gross_cents: purchaseCents,
|
|
8878
8995
|
vat_treatment: vatTreatment,
|
|
8879
|
-
vat_treatment_line:
|
|
8996
|
+
vat_treatment_line: z44.string().min(1),
|
|
8880
8997
|
due_today_gross_cents: purchaseCents,
|
|
8881
8998
|
prorated_net_cents: purchaseCents.nullable(),
|
|
8882
8999
|
renewal_net_cents: purchaseCents
|
|
@@ -8897,8 +9014,8 @@ var billingDecisionAmounts = z43.object({
|
|
|
8897
9014
|
invalid("vat_treatment", "Zero-rated treatment, rate, VAT and line must agree.");
|
|
8898
9015
|
}
|
|
8899
9016
|
}).meta({ allOf: treatmentRules });
|
|
8900
|
-
var utcInstant =
|
|
8901
|
-
var ianaTimeZone =
|
|
9017
|
+
var utcInstant = z44.iso.datetime().regex(/Z$/);
|
|
9018
|
+
var ianaTimeZone = z44.enum(ianaTimeZones);
|
|
8902
9019
|
function localDate(instant, timeZone) {
|
|
8903
9020
|
try {
|
|
8904
9021
|
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(instant));
|
|
@@ -8908,16 +9025,16 @@ function localDate(instant, timeZone) {
|
|
|
8908
9025
|
return null;
|
|
8909
9026
|
}
|
|
8910
9027
|
}
|
|
8911
|
-
var existingBillingPeriod =
|
|
8912
|
-
anchor:
|
|
9028
|
+
var existingBillingPeriod = z44.object({
|
|
9029
|
+
anchor: z44.literal("existing_period"),
|
|
8913
9030
|
display_time_zone: ianaTimeZone,
|
|
8914
|
-
starts_on:
|
|
9031
|
+
starts_on: z44.iso.date(),
|
|
8915
9032
|
starts_at: utcInstant.nullable(),
|
|
8916
9033
|
current_period_ends_at: utcInstant,
|
|
8917
9034
|
renews_at: utcInstant,
|
|
8918
|
-
effective:
|
|
8919
|
-
|
|
8920
|
-
|
|
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()
|
|
8921
9038
|
])
|
|
8922
9039
|
}).strict().superRefine((period, ctx) => {
|
|
8923
9040
|
if (period.starts_at && localDate(period.starts_at, period.display_time_zone) !== period.starts_on)
|
|
@@ -8927,21 +9044,21 @@ var existingBillingPeriod = z43.object({
|
|
|
8927
9044
|
if (period.effective.mode === "on_confirmation" && localDate(period.effective.quoted_as_of_at, period.display_time_zone) !== period.effective.local_date)
|
|
8928
9045
|
ctx.addIssue({ code: "custom", path: ["effective", "local_date"], message: "Quoted local date must match the display zone." });
|
|
8929
9046
|
});
|
|
8930
|
-
var firstPaymentPeriod =
|
|
8931
|
-
|
|
8932
|
-
anchor:
|
|
8933
|
-
cycle:
|
|
8934
|
-
start_statement:
|
|
8935
|
-
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")
|
|
8936
9053
|
}),
|
|
8937
|
-
|
|
8938
|
-
anchor:
|
|
8939
|
-
cycle:
|
|
8940
|
-
start_statement:
|
|
8941
|
-
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")
|
|
8942
9059
|
})
|
|
8943
9060
|
]);
|
|
8944
|
-
var billingDecisionPeriod =
|
|
9061
|
+
var billingDecisionPeriod = z44.union([existingBillingPeriod, firstPaymentPeriod]);
|
|
8945
9062
|
function formatEur(cents3) {
|
|
8946
9063
|
if (!Number.isSafeInteger(cents3))
|
|
8947
9064
|
throw new Error(`formatEur: ${cents3} is not a whole number of cents`);
|
|
@@ -9033,10 +9150,10 @@ var labelRules = {
|
|
|
9033
9150
|
"C4-1168-cancel": { const: "Cancel at period end" },
|
|
9034
9151
|
"C4-1168-keep-basic": { const: "Delete the rest and stay on Basic" }
|
|
9035
9152
|
};
|
|
9036
|
-
var declaration =
|
|
9037
|
-
text_id:
|
|
9038
|
-
text:
|
|
9039
|
-
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." }),
|
|
9040
9157
|
...legalLinks
|
|
9041
9158
|
}).strict().superRefine(separateLegalLinks).meta({
|
|
9042
9159
|
allOf: C4_TEXT_IDS.map((textId) => ({
|
|
@@ -9044,32 +9161,32 @@ var declaration = z43.object({
|
|
|
9044
9161
|
then: { properties: { action_label: labelRules[textId] } }
|
|
9045
9162
|
}))
|
|
9046
9163
|
});
|
|
9047
|
-
var legacyDeclaration =
|
|
9048
|
-
text_id:
|
|
9049
|
-
text:
|
|
9164
|
+
var legacyDeclaration = z44.object({
|
|
9165
|
+
text_id: z44.literal(LEGACY_C4_TEXT_ID),
|
|
9166
|
+
text: z44.string().min(1),
|
|
9050
9167
|
...legalLinks
|
|
9051
9168
|
}).strict().superRefine(separateLegalLinks);
|
|
9052
|
-
var snapshotBase =
|
|
9053
|
-
snapshot_id:
|
|
9054
|
-
decision_id:
|
|
9169
|
+
var snapshotBase = z44.object({
|
|
9170
|
+
snapshot_id: z44.uuid(),
|
|
9171
|
+
decision_id: z44.uuid(),
|
|
9055
9172
|
operation_key: purchaseOperationKey,
|
|
9056
|
-
owner_id:
|
|
9057
|
-
organization_id:
|
|
9058
|
-
organization_name:
|
|
9173
|
+
owner_id: z44.uuid(),
|
|
9174
|
+
organization_id: z44.uuid(),
|
|
9175
|
+
organization_name: z44.string().min(1),
|
|
9059
9176
|
...quoteIdentity,
|
|
9060
9177
|
amounts: billingDecisionAmounts,
|
|
9061
9178
|
period: billingDecisionPeriod,
|
|
9062
|
-
future_price_replacement:
|
|
9179
|
+
future_price_replacement: z44.strictObject({ agreement_id: z44.uuid(), text: z44.string().min(1).regex(/\S/) }).nullable(),
|
|
9063
9180
|
declaration,
|
|
9064
9181
|
expires_at: utcInstant
|
|
9065
9182
|
}).strict();
|
|
9066
9183
|
var snapshotVariants = [
|
|
9067
|
-
snapshotBase.extend({ decision_kind:
|
|
9068
|
-
snapshotBase.extend({ decision_kind:
|
|
9069
|
-
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()
|
|
9070
9187
|
];
|
|
9071
|
-
var storedDeclaration =
|
|
9072
|
-
var storedSnapshotVariants =
|
|
9188
|
+
var storedDeclaration = z44.union([declaration, legacyDeclaration]);
|
|
9189
|
+
var storedSnapshotVariants = z44.discriminatedUnion("decision_kind", [
|
|
9073
9190
|
snapshotVariants[0].extend({ declaration: storedDeclaration }).strict(),
|
|
9074
9191
|
snapshotVariants[1].extend({ declaration: storedDeclaration }).strict(),
|
|
9075
9192
|
snapshotVariants[2].extend({ declaration: storedDeclaration }).strict()
|
|
@@ -9121,9 +9238,9 @@ var snapshotRules = { allOf: ["monthly", "yearly"].map((cycle) => ({
|
|
|
9121
9238
|
if: { properties: { period: { properties: { anchor: { const: "on_first_successful_payment" }, cycle: { const: cycle } }, required: ["anchor", "cycle"] } }, required: ["period"] },
|
|
9122
9239
|
then: { properties: { selection: { properties: { cycle: { const: cycle } }, required: ["cycle"] } }, required: ["selection"] }
|
|
9123
9240
|
})) };
|
|
9124
|
-
var billingDecisionSnapshot =
|
|
9241
|
+
var billingDecisionSnapshot = z44.discriminatedUnion("decision_kind", snapshotVariants).superRefine(refineSnapshot).meta(snapshotRules);
|
|
9125
9242
|
var storedBillingDecisionSnapshot = storedSnapshotVariants.superRefine(refineSnapshot).meta(snapshotRules);
|
|
9126
|
-
var billingDecisionDisplayResponse =
|
|
9243
|
+
var billingDecisionDisplayResponse = z44.object({
|
|
9127
9244
|
confirmation_proof: confirmationProof,
|
|
9128
9245
|
expires_at: utcInstant,
|
|
9129
9246
|
snapshot: billingDecisionSnapshot
|
|
@@ -9131,8 +9248,8 @@ var billingDecisionDisplayResponse = z43.object({
|
|
|
9131
9248
|
if (value.expires_at !== value.snapshot.expires_at)
|
|
9132
9249
|
ctx.addIssue({ code: "custom", path: ["expires_at"], message: "Display and snapshot expiry must match." });
|
|
9133
9250
|
});
|
|
9134
|
-
var planChangePrepareResponse =
|
|
9135
|
-
change_id:
|
|
9251
|
+
var planChangePrepareResponse = z44.object({
|
|
9252
|
+
change_id: z44.uuid(),
|
|
9136
9253
|
display: billingDecisionDisplayResponse
|
|
9137
9254
|
}).strict().superRefine((value, ctx) => {
|
|
9138
9255
|
if (value.display.snapshot.decision_kind !== "plan_change")
|
|
@@ -9141,20 +9258,20 @@ var planChangePrepareResponse = z43.object({
|
|
|
9141
9258
|
ctx.addIssue({ code: "custom", path: ["display", "snapshot", "decision_id"], message: "Display must refer to the prepared change." });
|
|
9142
9259
|
}).meta({ allOf: [{ properties: { display: { properties: { snapshot: { properties: { decision_kind: { const: "plan_change" } } } } } } }] });
|
|
9143
9260
|
var intentIdentity = {
|
|
9144
|
-
intent_id:
|
|
9261
|
+
intent_id: z44.uuid().meta({ description: "Opaque persisted purchase intent identity." }),
|
|
9145
9262
|
operation_key: purchaseOperationKey,
|
|
9146
9263
|
operation: chargeOperation,
|
|
9147
|
-
invoice_id:
|
|
9264
|
+
invoice_id: z44.uuid().optional().meta({
|
|
9148
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."
|
|
9149
9266
|
})
|
|
9150
9267
|
};
|
|
9151
|
-
var purchaseHoldReason =
|
|
9268
|
+
var purchaseHoldReason = z44.enum([
|
|
9152
9269
|
"legacy_usd_invoice",
|
|
9153
9270
|
"legacy_payer_unresolved",
|
|
9154
9271
|
"mandate_policy_unresolved",
|
|
9155
9272
|
"issuer_cutover_in_progress"
|
|
9156
9273
|
]);
|
|
9157
|
-
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"]);
|
|
9158
9275
|
var intentRules = [
|
|
9159
9276
|
{ if: { properties: { operation: { enum: ["invoice_payment", "payment_method_invoice"] } }, required: ["operation"] }, then: { required: ["invoice_id"] } },
|
|
9160
9277
|
{ if: { properties: { operation: { const: "mandate_setup" } }, required: ["operation"] }, then: { properties: { state: { enum: ["held", "payment_started"] } } } },
|
|
@@ -9179,49 +9296,49 @@ function validateIntent(intent, ctx) {
|
|
|
9179
9296
|
ctx.addIssue({ code: "custom", path: ["payment"], message: "Owner checkout, invoice payment and mandate setup require a hosted payment." });
|
|
9180
9297
|
}
|
|
9181
9298
|
}
|
|
9182
|
-
var awaitingVies = { ...intentIdentity, state:
|
|
9299
|
+
var awaitingVies = { ...intentIdentity, state: z44.literal("awaiting_vies"), next_attempt_at: z44.iso.datetime() };
|
|
9183
9300
|
var draftVariants = [
|
|
9184
9301
|
viesPending(awaitingVies),
|
|
9185
|
-
|
|
9186
|
-
|
|
9302
|
+
z44.object({ ...intentIdentity, ...quoteIdentity, state: z44.literal("eligible"), quote: purchaseQuote }).strict(),
|
|
9303
|
+
z44.object({
|
|
9187
9304
|
...intentIdentity,
|
|
9188
9305
|
operation: purchaseOperation,
|
|
9189
|
-
state:
|
|
9306
|
+
state: z44.literal("held"),
|
|
9190
9307
|
reason: purchaseHoldReason,
|
|
9191
|
-
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." })
|
|
9192
9309
|
}).strict(),
|
|
9193
|
-
|
|
9194
|
-
|
|
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()
|
|
9195
9312
|
];
|
|
9196
|
-
var purchaseIntentDraft =
|
|
9197
|
-
var paymentStartedVariant =
|
|
9313
|
+
var purchaseIntentDraft = z44.discriminatedUnion("state", draftVariants).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9314
|
+
var paymentStartedVariant = z44.object({
|
|
9198
9315
|
...intentIdentity,
|
|
9199
9316
|
operation: purchaseOperation,
|
|
9200
|
-
state:
|
|
9201
|
-
payment_id:
|
|
9202
|
-
payment:
|
|
9203
|
-
|
|
9204
|
-
|
|
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()
|
|
9205
9322
|
])
|
|
9206
9323
|
}).strict();
|
|
9207
9324
|
var purchaseIntentPaymentStarted = paymentStartedVariant.superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9208
|
-
var purchaseIntentAcceptedWithoutPayment =
|
|
9209
|
-
intent_id:
|
|
9325
|
+
var purchaseIntentAcceptedWithoutPayment = z44.object({
|
|
9326
|
+
intent_id: z44.uuid(),
|
|
9210
9327
|
operation_key: purchaseOperationKey,
|
|
9211
|
-
operation:
|
|
9212
|
-
state:
|
|
9328
|
+
operation: z44.literal("paid_change"),
|
|
9329
|
+
state: z44.literal("accepted_no_payment"),
|
|
9213
9330
|
...quoteIdentity,
|
|
9214
|
-
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(),
|
|
9215
9332
|
accepted_at: utcInstant
|
|
9216
9333
|
}).strict();
|
|
9217
|
-
var purchaseIntent =
|
|
9334
|
+
var purchaseIntent = z44.discriminatedUnion("state", [
|
|
9218
9335
|
...draftVariants,
|
|
9219
9336
|
paymentStartedVariant,
|
|
9220
9337
|
purchaseIntentAcceptedWithoutPayment
|
|
9221
9338
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9222
9339
|
var nonChangeOperation = purchaseOperation.exclude(["paid_change"]);
|
|
9223
9340
|
var nonChangeChargeOperation = chargeOperation.exclude(["paid_change"]);
|
|
9224
|
-
var nonChangeDraft =
|
|
9341
|
+
var nonChangeDraft = z44.discriminatedUnion("state", [
|
|
9225
9342
|
viesPending({ ...awaitingVies, operation: nonChangeChargeOperation }),
|
|
9226
9343
|
draftVariants[1].safeExtend({ operation: nonChangeChargeOperation }),
|
|
9227
9344
|
draftVariants[2].safeExtend({ operation: nonChangeOperation }),
|
|
@@ -9229,37 +9346,37 @@ var nonChangeDraft = z43.discriminatedUnion("state", [
|
|
|
9229
9346
|
draftVariants[4].safeExtend({ operation: nonChangeChargeOperation })
|
|
9230
9347
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9231
9348
|
var nonChangePaymentStarted = paymentStartedVariant.safeExtend({ operation: nonChangeOperation }).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9232
|
-
var paidChangeOperation =
|
|
9233
|
-
var paidChangeDraft =
|
|
9349
|
+
var paidChangeOperation = z44.literal("paid_change");
|
|
9350
|
+
var paidChangeDraft = z44.discriminatedUnion("state", [
|
|
9234
9351
|
draftVariants[1].safeExtend({ operation: paidChangeOperation }),
|
|
9235
9352
|
draftVariants[2].safeExtend({ operation: paidChangeOperation }),
|
|
9236
9353
|
draftVariants[3].safeExtend({ operation: paidChangeOperation }),
|
|
9237
9354
|
draftVariants[4].safeExtend({ operation: paidChangeOperation })
|
|
9238
9355
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
9239
|
-
var checkoutResponse =
|
|
9356
|
+
var checkoutResponse = z44.union([nonChangeDraft, nonChangePaymentStarted]);
|
|
9240
9357
|
var checkoutIntentIdentity = {
|
|
9241
|
-
intent_id:
|
|
9358
|
+
intent_id: z44.uuid().meta({ description: "The persisted checkout intent; confirm it with `POST /api/billing/intents/:id/confirm`." }),
|
|
9242
9359
|
operation_key: purchaseOperationKey,
|
|
9243
|
-
operation:
|
|
9360
|
+
operation: z44.literal("checkout")
|
|
9244
9361
|
};
|
|
9245
|
-
var vatIdField =
|
|
9246
|
-
var checkoutStartResponse =
|
|
9247
|
-
|
|
9362
|
+
var vatIdField = z44.literal("billing.vat_id");
|
|
9363
|
+
var checkoutStartResponse = z44.discriminatedUnion("state", [
|
|
9364
|
+
z44.object({
|
|
9248
9365
|
...checkoutIntentIdentity,
|
|
9249
|
-
state:
|
|
9366
|
+
state: z44.literal("eligible"),
|
|
9250
9367
|
...quoteIdentity,
|
|
9251
9368
|
quote: purchaseQuote,
|
|
9252
9369
|
display: billingDecisionDisplayResponse
|
|
9253
9370
|
}).strict().meta({ description: "Eligible: the price is frozen and the display shown; one click on its button confirms." }),
|
|
9254
|
-
viesPending({ state:
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
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({
|
|
9259
9376
|
...checkoutIntentIdentity,
|
|
9260
|
-
state:
|
|
9261
|
-
payment_id:
|
|
9262
|
-
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()
|
|
9263
9380
|
}).strict().meta({ description: "The key was already confirmed: the hosted payment it started." })
|
|
9264
9381
|
]).superRefine((value, ctx) => {
|
|
9265
9382
|
if (value.state !== "eligible")
|
|
@@ -9283,29 +9400,29 @@ var checkoutStartResponse = z43.discriminatedUnion("state", [
|
|
|
9283
9400
|
if: { properties: { state: { const: "eligible" } }, required: ["state"] },
|
|
9284
9401
|
then: { properties: { display: { properties: { snapshot: { properties: { decision_kind: { const: "checkout" } } } } } } }
|
|
9285
9402
|
}] });
|
|
9286
|
-
var checkoutDraft =
|
|
9287
|
-
plan:
|
|
9403
|
+
var checkoutDraft = z44.object({
|
|
9404
|
+
plan: z44.enum(["plus", "pro"]).meta({ description: "The plan last chosen on the checkout page." }),
|
|
9288
9405
|
cycle: billingCycle.meta({ description: "The cycle last chosen." }),
|
|
9289
9406
|
billing: purchaseBillingDetails.meta({ description: "The company details last sent to the checkout start." }),
|
|
9290
|
-
updated_at:
|
|
9407
|
+
updated_at: z44.iso.datetime().meta({ description: "When the draft was last saved." })
|
|
9291
9408
|
}).strict();
|
|
9292
|
-
var checkoutDraftResponse =
|
|
9409
|
+
var checkoutDraftResponse = z44.object({
|
|
9293
9410
|
draft: checkoutDraft.nullable().meta({ description: "The saved checkout draft, or `null`. Deleted once the checkout is paid." }),
|
|
9294
9411
|
prefill: billingDetails.nullable().meta({ description: "The org's earlier billing details when there is no draft, else `null`." })
|
|
9295
9412
|
}).strict().superRefine((value, ctx) => {
|
|
9296
9413
|
if (value.draft !== null && value.prefill !== null)
|
|
9297
9414
|
ctx.addIssue({ code: "custom", path: ["prefill"], message: "A draft answers alone; prefill is null beside it." });
|
|
9298
9415
|
}).meta({ not: { properties: { draft: { type: "object" }, prefill: { type: "object" } }, required: ["draft", "prefill"] } });
|
|
9299
|
-
var checkoutOpenDetails =
|
|
9300
|
-
field:
|
|
9301
|
-
rule:
|
|
9302
|
-
expires_at:
|
|
9303
|
-
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." })
|
|
9304
9421
|
}).strict();
|
|
9305
|
-
var viesUnavailableDetails = viesPending({ field: vatIdField, rule:
|
|
9306
|
-
var purchaseIntentLookupQuery =
|
|
9422
|
+
var viesUnavailableDetails = viesPending({ field: vatIdField, rule: z44.literal("vies_unavailable") });
|
|
9423
|
+
var purchaseIntentLookupQuery = z44.object({
|
|
9307
9424
|
operation_key: purchaseOperationKey.optional().meta({ description: "The client operation key; supply this or intent_id, never both." }),
|
|
9308
|
-
intent_id:
|
|
9425
|
+
intent_id: z44.uuid().optional().meta({ description: "The persisted intent ID; supply this or operation_key, never both." }),
|
|
9309
9426
|
operation: purchaseOperation.meta({ description: "Expected operation; a mismatch returns 404 without disclosure." })
|
|
9310
9427
|
}).strict().refine((q) => q.operation_key !== void 0 !== (q.intent_id !== void 0), {
|
|
9311
9428
|
message: "Supply exactly one of operation_key or intent_id."
|
|
@@ -9318,163 +9435,160 @@ var purchaseIntentLookupQuery = z43.object({
|
|
|
9318
9435
|
});
|
|
9319
9436
|
var provedConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity, confirmation_proof: confirmationProof };
|
|
9320
9437
|
var invoiceConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity };
|
|
9321
|
-
var purchaseIntentConfirmRequest =
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
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()
|
|
9326
9443
|
]);
|
|
9327
|
-
var purchaseConflictDetails =
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
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()
|
|
9331
9448
|
]);
|
|
9332
|
-
var invoicePayRequest =
|
|
9333
|
-
var checkoutStatus =
|
|
9334
|
-
checkout_id:
|
|
9335
|
-
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({
|
|
9336
9453
|
description: "Mollie's payment status, as `reconcilePayment` last read it."
|
|
9337
9454
|
}),
|
|
9338
|
-
purpose:
|
|
9455
|
+
purpose: z44.enum(["upgrade", "payment_method", "invoice"]).meta({
|
|
9339
9456
|
description: "What this checkout paid for: a plan upgrade, a payment-method change, or an open invoice."
|
|
9340
9457
|
}),
|
|
9341
9458
|
plan: planId.meta({ description: "The org's plan after applying \u2014 unchanged unless `purpose` is `upgrade` and `status` is `paid`." })
|
|
9342
9459
|
});
|
|
9343
|
-
var vatIdStatus =
|
|
9344
|
-
var vatIdCheckRequest =
|
|
9460
|
+
var vatIdStatus = z44.enum(["valid", "unverified", "invalid", "unavailable"]);
|
|
9461
|
+
var vatIdCheckRequest = z44.object({
|
|
9345
9462
|
country: countryCode.meta({ description: "The VAT ID's country." }),
|
|
9346
|
-
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`)." })
|
|
9347
9464
|
}).strict();
|
|
9348
|
-
var vatCheckIdentity = { vat_id:
|
|
9349
|
-
var vatIdCheckResponse =
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
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"]) })
|
|
9353
9470
|
]);
|
|
9354
|
-
var billingChangeRequest =
|
|
9471
|
+
var billingChangeRequest = z44.object({
|
|
9355
9472
|
operation_key: purchaseOperationKey,
|
|
9356
|
-
plan:
|
|
9473
|
+
plan: z44.enum(["plus", "pro"]).optional().meta({ description: "The target plan. Omitted leaves the plan as it is." }),
|
|
9357
9474
|
cycle: billingCycle.optional().meta({ description: "The target cycle. Omitted leaves the cycle as it is." }),
|
|
9358
9475
|
addons: orgAddons.partial().strict().optional().meta({
|
|
9359
9476
|
description: "Absolute add-on counts to end up with, not a delta. Omitted leaves add-ons as they are."
|
|
9360
9477
|
})
|
|
9361
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." });
|
|
9362
|
-
var billingCancelRequest =
|
|
9363
|
-
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." })
|
|
9364
9481
|
}).strict();
|
|
9365
|
-
var billingDetailsUpdate =
|
|
9366
|
-
company_name:
|
|
9482
|
+
var billingDetailsUpdate = z44.object({
|
|
9483
|
+
company_name: z44.string().trim().min(1).max(200).optional(),
|
|
9367
9484
|
address: billingAddress.optional(),
|
|
9368
|
-
tax_id:
|
|
9369
|
-
invoice_email:
|
|
9370
|
-
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({
|
|
9371
9488
|
description: "Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES."
|
|
9372
9489
|
})
|
|
9373
9490
|
}).strict();
|
|
9374
|
-
var billingDetailsConflictDetails =
|
|
9375
|
-
|
|
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." }),
|
|
9376
9493
|
viesUnavailableDetails,
|
|
9377
|
-
|
|
9494
|
+
z44.object({ field: z44.literal("billing"), rule: z44.literal("buyer_changed") }).strict().meta({ description: "The billing details changed meanwhile. Nothing is saved." })
|
|
9378
9495
|
]);
|
|
9379
|
-
var paymentMethodKind =
|
|
9380
|
-
var paymentMethodChangeRequest =
|
|
9381
|
-
operation_key: purchaseOperationKey
|
|
9382
|
-
method: paymentMethodKind.meta({
|
|
9383
|
-
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."
|
|
9384
|
-
})
|
|
9496
|
+
var paymentMethodKind = z44.enum(["card", "paypal", "applepay"]);
|
|
9497
|
+
var paymentMethodChangeRequest = z44.object({
|
|
9498
|
+
operation_key: purchaseOperationKey
|
|
9385
9499
|
}).strict();
|
|
9386
|
-
var billingAccountStatus =
|
|
9387
|
-
var paymentMethod =
|
|
9388
|
-
|
|
9389
|
-
kind:
|
|
9390
|
-
brand:
|
|
9391
|
-
last4:
|
|
9392
|
-
expires:
|
|
9393
|
-
}),
|
|
9394
|
-
|
|
9395
|
-
kind:
|
|
9396
|
-
brand:
|
|
9397
|
-
last4:
|
|
9398
|
-
expires:
|
|
9399
|
-
}),
|
|
9400
|
-
|
|
9401
|
-
kind:
|
|
9402
|
-
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." })
|
|
9403
9517
|
})
|
|
9404
9518
|
]);
|
|
9405
|
-
var invoiceStatus =
|
|
9406
|
-
var billingInvoice =
|
|
9407
|
-
id:
|
|
9408
|
-
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({
|
|
9409
9523
|
description: "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
|
|
9410
9524
|
}),
|
|
9411
|
-
issued_at:
|
|
9525
|
+
issued_at: z44.iso.datetime().meta({ description: "When the invoice was issued." }),
|
|
9412
9526
|
status: invoiceStatus.meta({ description: "This invoice's own status." }),
|
|
9413
|
-
cancellation_document_url:
|
|
9527
|
+
cancellation_document_url: z44.string().nullable().meta({
|
|
9414
9528
|
description: "Cloud always returns `null` for this field, including cancelled historical Cloud invoices. Cancellation documents are held in Lexware."
|
|
9415
9529
|
}),
|
|
9416
9530
|
currency: planCurrency.meta({ description: "The org's billing currency." }),
|
|
9417
|
-
net_cents:
|
|
9418
|
-
vat_rate_percent:
|
|
9419
|
-
vat_cents:
|
|
9420
|
-
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." })
|
|
9421
9535
|
});
|
|
9422
|
-
var billingInvoicePdfQuery =
|
|
9423
|
-
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." })
|
|
9424
9538
|
}).strict();
|
|
9425
|
-
var billingAccount =
|
|
9539
|
+
var billingAccount = z44.object({
|
|
9426
9540
|
payer: billingDetails.meta({ description: "Who is paying, and the invoice address and email." }),
|
|
9427
9541
|
vat_id_status: vatIdStatus.nullable().meta({ description: "The payer's VAT ID check, or `null` when no VAT ID was given." }),
|
|
9428
|
-
vat:
|
|
9542
|
+
vat: z44.object({
|
|
9429
9543
|
treatment: vatTreatment.meta({ description: "How the account is taxed." }),
|
|
9430
|
-
rate_percent:
|
|
9544
|
+
rate_percent: z44.number().int().meta({ description: "The VAT rate, in whole percent." })
|
|
9431
9545
|
}).nullable().meta({ description: "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account." }),
|
|
9432
9546
|
currency: planCurrency.meta({ description: "The org's billing currency, fixed at the first payment." }),
|
|
9433
9547
|
cycle: billingCycle.meta({ description: "The current billing cycle." }),
|
|
9434
9548
|
status: billingAccountStatus.meta({ description: "The account's own status." }),
|
|
9435
|
-
period_starts_at:
|
|
9436
|
-
period_ends_at:
|
|
9437
|
-
next_charge:
|
|
9438
|
-
at:
|
|
9439
|
-
net_cents:
|
|
9440
|
-
vat_cents:
|
|
9441
|
-
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." })
|
|
9442
9556
|
}).nullable().meta({ description: "`null` while a cancel is pending or nothing else renews." }),
|
|
9443
|
-
current_price:
|
|
9444
|
-
net_cents:
|
|
9557
|
+
current_price: z44.object({
|
|
9558
|
+
net_cents: z44.number().int().meta({
|
|
9445
9559
|
description: "One period of the current plan, cycle and add-ons at the agreed price, excluding VAT, in integer cents."
|
|
9446
9560
|
})
|
|
9447
9561
|
}).nullable().meta({
|
|
9448
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."
|
|
9449
9563
|
}),
|
|
9450
|
-
scheduled:
|
|
9564
|
+
scheduled: z44.object({
|
|
9451
9565
|
cycle: billingCycle.nullable().meta({ description: "A cycle change queued for the period's end, or `null`." }),
|
|
9452
9566
|
addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." })
|
|
9453
9567
|
}).meta({ description: "What takes effect at the period's end." }),
|
|
9454
|
-
dunning:
|
|
9455
|
-
invoice_id:
|
|
9568
|
+
dunning: z44.object({
|
|
9569
|
+
invoice_id: z44.uuid().meta({
|
|
9456
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`."
|
|
9457
9571
|
}),
|
|
9458
|
-
gross_cents:
|
|
9572
|
+
gross_cents: z44.number().int().meta({
|
|
9459
9573
|
description: "The amount owed, in integer cents \u2014 after a partial chargeback only the charged-back part."
|
|
9460
9574
|
}),
|
|
9461
|
-
due_at:
|
|
9462
|
-
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({
|
|
9463
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."
|
|
9464
9578
|
}),
|
|
9465
|
-
lock_at:
|
|
9466
|
-
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({
|
|
9467
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."
|
|
9468
9582
|
})
|
|
9469
9583
|
}).nullable().meta({ description: "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced." })
|
|
9470
9584
|
});
|
|
9471
|
-
var billingIssuer =
|
|
9472
|
-
var billingChargeInvoice =
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
state:
|
|
9477
|
-
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`." })
|
|
9478
9592
|
}).strict()
|
|
9479
9593
|
]);
|
|
9480
9594
|
var chargeInvoiceRules = [
|
|
@@ -9487,55 +9601,54 @@ function refuseChargeInvoiceMismatch(charge, ctx) {
|
|
|
9487
9601
|
ctx.addIssue({ code: "custom", path: ["invoice"], message: "A paid charge has an invoice (pending or issued); every other status has none yet." });
|
|
9488
9602
|
}
|
|
9489
9603
|
}
|
|
9490
|
-
var billingCharge =
|
|
9491
|
-
id:
|
|
9492
|
-
kind:
|
|
9493
|
-
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({
|
|
9494
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."
|
|
9495
9609
|
}),
|
|
9496
|
-
currency:
|
|
9497
|
-
net_cents:
|
|
9498
|
-
vat_rate_percent:
|
|
9499
|
-
vat_cents:
|
|
9500
|
-
gross_cents:
|
|
9501
|
-
period_start:
|
|
9502
|
-
period_end:
|
|
9503
|
-
due_at:
|
|
9504
|
-
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." }),
|
|
9505
9619
|
invoice: billingChargeInvoice.meta({ description: "Whether a Lexware invoice exists for this charge yet, and which document it names once it does." })
|
|
9506
9620
|
}).strict().superRefine(refuseChargeInvoiceMismatch).meta({ allOf: chargeInvoiceRules });
|
|
9507
9621
|
var chargePayRequest = invoicePayRequest;
|
|
9508
|
-
var billingView =
|
|
9509
|
-
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." }),
|
|
9510
9624
|
account: billingAccount.nullable().meta({ description: "`null` before the org has ever checked out." }),
|
|
9511
9625
|
payment_method: paymentMethod.nullable().meta({ description: "The payment method on file, or `null`." }),
|
|
9512
|
-
payment_method_options:
|
|
9513
|
-
method: paymentMethodKind.meta({ description: "A method
|
|
9514
|
-
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." })
|
|
9515
9628
|
})).meta({
|
|
9516
|
-
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."
|
|
9517
9630
|
}),
|
|
9518
9631
|
issuer: billingIssuer.meta({ description: "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it." }),
|
|
9519
|
-
invoices:
|
|
9520
|
-
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({
|
|
9521
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`."
|
|
9522
9635
|
})
|
|
9523
9636
|
});
|
|
9524
|
-
var billingDocumentKind =
|
|
9525
|
-
var billingDocumentStatus =
|
|
9526
|
-
var billingDocumentProfile =
|
|
9527
|
-
var billingDocumentFormat =
|
|
9528
|
-
var billingDocumentBase =
|
|
9529
|
-
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." }),
|
|
9530
9643
|
kind: billingDocumentKind.meta({ description: "The document's kind." }),
|
|
9531
9644
|
status: billingDocumentStatus.meta({ description: "The document's own status." }),
|
|
9532
|
-
number:
|
|
9533
|
-
document_date:
|
|
9534
|
-
currency:
|
|
9535
|
-
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({
|
|
9536
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."
|
|
9537
9650
|
}),
|
|
9538
|
-
file:
|
|
9651
|
+
file: z44.enum(["available", "unavailable"]).meta({ description: "Whether Lexware holds a file for this document at all." })
|
|
9539
9652
|
});
|
|
9540
9653
|
function refuseWrongGrossSign(doc, ctx) {
|
|
9541
9654
|
const isCredit = doc.kind === "credit_note" || doc.kind === "bookkeeping_credit_note";
|
|
@@ -9547,18 +9660,18 @@ function refuseWrongGrossSign(doc, ctx) {
|
|
|
9547
9660
|
}
|
|
9548
9661
|
}
|
|
9549
9662
|
var billingDocument = billingDocumentBase.strict().superRefine(refuseWrongGrossSign);
|
|
9550
|
-
var billingDocumentList =
|
|
9551
|
-
available:
|
|
9552
|
-
complete:
|
|
9553
|
-
unsupported_count:
|
|
9554
|
-
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." })
|
|
9555
9668
|
}).strict().superRefine((list, ctx) => {
|
|
9556
9669
|
if (!list.available && (list.documents.length > 0 || !list.complete || list.unsupported_count > 0)) {
|
|
9557
9670
|
ctx.addIssue({ code: "custom", path: ["available"], message: "available: false carries no documents, is complete and has no unsupported document." });
|
|
9558
9671
|
}
|
|
9559
9672
|
});
|
|
9560
|
-
var billingDocumentFileRole =
|
|
9561
|
-
var billingDocumentFormatEntry =
|
|
9673
|
+
var billingDocumentFileRole = z44.enum(["e_invoice", "preview", "document"]);
|
|
9674
|
+
var billingDocumentFormatEntry = z44.object({ format: billingDocumentFormat, role: billingDocumentFileRole }).strict();
|
|
9562
9675
|
function sameFormats(a, b) {
|
|
9563
9676
|
return a.length === b.length && a.every((entry2, i) => entry2.format === b[i].format && entry2.role === b[i].role);
|
|
9564
9677
|
}
|
|
@@ -9570,14 +9683,14 @@ function refuseWrongFormats(doc, ctx) {
|
|
|
9570
9683
|
}
|
|
9571
9684
|
var billingDocumentDetail = billingDocumentBase.extend({
|
|
9572
9685
|
electronic_document_profile: billingDocumentProfile.nullable().meta({ description: "The e-invoice profile, or `null` for a bookkeeping voucher \u2014 it has none." }),
|
|
9573
|
-
formats:
|
|
9686
|
+
formats: z44.array(billingDocumentFormatEntry).meta({
|
|
9574
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 `[]`.'
|
|
9575
9688
|
})
|
|
9576
9689
|
}).strict().superRefine((doc, ctx) => {
|
|
9577
9690
|
refuseWrongGrossSign(doc, ctx);
|
|
9578
9691
|
refuseWrongFormats(doc, ctx);
|
|
9579
9692
|
});
|
|
9580
|
-
var billingDocumentFileQuery =
|
|
9693
|
+
var billingDocumentFileQuery = z44.object({
|
|
9581
9694
|
format: billingDocumentFormat.default("pdf").meta({ description: "The file format to read. `xml` answers `404` unless the document is `XRechnung`." })
|
|
9582
9695
|
}).strict();
|
|
9583
9696
|
var acceptedBillingFields = {
|
|
@@ -9586,30 +9699,30 @@ var acceptedBillingFields = {
|
|
|
9586
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`)."
|
|
9587
9700
|
})
|
|
9588
9701
|
};
|
|
9589
|
-
var acceptedPaidChange =
|
|
9702
|
+
var acceptedPaidChange = z44.object({
|
|
9590
9703
|
...acceptedBillingFields,
|
|
9591
|
-
intent: paymentStartedVariant.safeExtend({ operation:
|
|
9704
|
+
intent: paymentStartedVariant.safeExtend({ operation: z44.literal("paid_change") })
|
|
9592
9705
|
}).strict();
|
|
9593
|
-
var acceptedNoPaymentChange =
|
|
9706
|
+
var acceptedNoPaymentChange = z44.object({
|
|
9594
9707
|
billing: billingView,
|
|
9595
|
-
charged:
|
|
9708
|
+
charged: z44.null().meta({
|
|
9596
9709
|
description: "Always `null`: nothing was charged now (a scheduled change or an increase that cost nothing)."
|
|
9597
9710
|
}),
|
|
9598
9711
|
intent: purchaseIntentAcceptedWithoutPayment
|
|
9599
9712
|
}).strict();
|
|
9600
|
-
var billingChangeResponse =
|
|
9601
|
-
|
|
9713
|
+
var billingChangeResponse = z44.union([
|
|
9714
|
+
z44.object({ intent: paidChangeDraft }).strict(),
|
|
9602
9715
|
acceptedPaidChange,
|
|
9603
9716
|
acceptedNoPaymentChange
|
|
9604
9717
|
]);
|
|
9605
|
-
var purchaseIntentResponse =
|
|
9718
|
+
var purchaseIntentResponse = z44.union([
|
|
9606
9719
|
purchaseIntentDraft,
|
|
9607
9720
|
nonChangePaymentStarted,
|
|
9608
9721
|
acceptedPaidChange,
|
|
9609
9722
|
acceptedNoPaymentChange
|
|
9610
9723
|
]);
|
|
9611
9724
|
|
|
9612
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
9725
|
+
// node_modules/.pnpm/@fleetless+contracts@19.3.0/node_modules/@fleetless/contracts/dist/routes.js
|
|
9613
9726
|
var MCP_APP = MCP_APP_PATHS(":appIdentifier");
|
|
9614
9727
|
var APP_IDENTIFIER = {
|
|
9615
9728
|
name: "appIdentifier",
|
|
@@ -13146,7 +13259,7 @@ var ROUTES = [
|
|
|
13146
13259
|
response: liveSessionResponse,
|
|
13147
13260
|
errors: [...CLIENT_GUARD, "invalid_uuid", "not_found", "robot_offline", "camera_offline", "live_unavailable"],
|
|
13148
13261
|
transport: "http",
|
|
13149
|
-
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."
|
|
13150
13263
|
},
|
|
13151
13264
|
{
|
|
13152
13265
|
method: "DELETE",
|
|
@@ -13805,7 +13918,7 @@ var ROUTES = [
|
|
|
13805
13918
|
response: checkoutResponse,
|
|
13806
13919
|
errors: ["target_state_conflict", ...DEVELOPER_GUARD, "tier_required", "support_forbidden", "validation_error", "not_found", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
13807
13920
|
transport: "http",
|
|
13808
|
-
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."
|
|
13809
13922
|
},
|
|
13810
13923
|
{
|
|
13811
13924
|
method: "POST",
|
|
@@ -13939,7 +14052,7 @@ var ROUTES = [
|
|
|
13939
14052
|
response: checkoutResponse,
|
|
13940
14053
|
errors: ["validation_error", ...DEVELOPER_GUARD, "tier_required", "not_found", "target_state_conflict", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
13941
14054
|
transport: "http",
|
|
13942
|
-
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."
|
|
13943
14056
|
},
|
|
13944
14057
|
{
|
|
13945
14058
|
method: "POST",
|
|
@@ -15094,7 +15207,7 @@ function headerNumber(headers, name) {
|
|
|
15094
15207
|
const value = Number(raw);
|
|
15095
15208
|
return Number.isFinite(value) ? value : null;
|
|
15096
15209
|
}
|
|
15097
|
-
function createCamerasApi(http) {
|
|
15210
|
+
function createCamerasApi(http, endings) {
|
|
15098
15211
|
return {
|
|
15099
15212
|
async list(robotId) {
|
|
15100
15213
|
const response = await http.request(`/api/robots/${pathSegment(robotId)}/cameras`, {});
|
|
@@ -15132,6 +15245,7 @@ function createCamerasApi(http) {
|
|
|
15132
15245
|
}
|
|
15133
15246
|
},
|
|
15134
15247
|
async live(robotId, slug2) {
|
|
15248
|
+
if (endings) await endings.ready();
|
|
15135
15249
|
const response = await http.request(`/api/robots/${pathSegment(robotId)}/cameras/${pathSegment(slug2)}/live`, {
|
|
15136
15250
|
method: "POST"
|
|
15137
15251
|
});
|
|
@@ -15149,11 +15263,113 @@ function createCamerasApi(http) {
|
|
|
15149
15263
|
room: response.room,
|
|
15150
15264
|
token: response.token,
|
|
15151
15265
|
expires_at: response.expires_at,
|
|
15152
|
-
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);
|
|
15153
15346
|
};
|
|
15154
15347
|
}
|
|
15155
15348
|
};
|
|
15156
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
|
+
}
|
|
15157
15373
|
|
|
15158
15374
|
// src/filter-json.ts
|
|
15159
15375
|
function filterJson(filter) {
|
|
@@ -16059,7 +16275,7 @@ function createClient(options) {
|
|
|
16059
16275
|
const actions = createActionsApi(commandTransport, jobSubscriptions);
|
|
16060
16276
|
const services = createServicesApi(commandTransport, jobSubscriptions);
|
|
16061
16277
|
const publishers = createPublishersApi(commandTransport);
|
|
16062
|
-
const cameras = createCamerasApi(http);
|
|
16278
|
+
const cameras = createCamerasApi(http, createLiveSessionEndings(channel));
|
|
16063
16279
|
const jobs = createJobsApi(http);
|
|
16064
16280
|
const assets = createAssetsApi(http);
|
|
16065
16281
|
const robots = createRobotsApi(http);
|
|
@@ -16101,7 +16317,9 @@ export {
|
|
|
16101
16317
|
CANCEL_RETURN_CODES,
|
|
16102
16318
|
FleetlessError,
|
|
16103
16319
|
InMemoryTokenStore,
|
|
16320
|
+
LIVE_START_REFUSALS,
|
|
16104
16321
|
SDK_ERROR_CODES,
|
|
16322
|
+
cameraOfflineDetails,
|
|
16105
16323
|
cancelRejectedDetails,
|
|
16106
16324
|
createClient,
|
|
16107
16325
|
parameterInvalidDetails,
|