@fleetless/sdk 4.5.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +10 -0
- package/dist/index.cjs +2410 -553
- package/dist/index.d.cts +24 -5
- package/dist/index.d.ts +24 -5
- package/dist/index.js +2410 -553
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -119,15 +119,15 @@ var HttpClient = class {
|
|
|
119
119
|
*/
|
|
120
120
|
async request(path, options) {
|
|
121
121
|
const response = await this.#send(path, options, true);
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
122
|
+
const text2 = await response.text();
|
|
123
|
+
if (text2.length === 0) {
|
|
124
124
|
if (options.expectEmptyBody) return void 0;
|
|
125
125
|
throw new FleetlessError(
|
|
126
126
|
"unexpected_response",
|
|
127
127
|
`${options.method ?? "GET"} ${path} answered ok (${response.status}) but the body was empty; this route is expected to always return one.`
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
|
-
return JSON.parse(
|
|
130
|
+
return JSON.parse(text2);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* Like `request`, but for an endpoint that answers with raw bytes instead
|
|
@@ -410,7 +410,7 @@ function createAssetsApi(http) {
|
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
413
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/common.js
|
|
414
414
|
import { z } from "zod";
|
|
415
415
|
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.";
|
|
416
416
|
var slug = z.string().min(2).max(63).regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/, SLUG_RULE);
|
|
@@ -441,7 +441,7 @@ var applyError = z.object({
|
|
|
441
441
|
details: z.record(z.string(), z.unknown()).optional()
|
|
442
442
|
});
|
|
443
443
|
|
|
444
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
444
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/mcp.js
|
|
445
445
|
import { z as z2 } from "zod";
|
|
446
446
|
function mcpAppEndpointPath(appIdentifier2) {
|
|
447
447
|
return `/mcp/${appIdentifier2}`;
|
|
@@ -490,10 +490,10 @@ var mcpRolePreviewResponse = z2.object({
|
|
|
490
490
|
});
|
|
491
491
|
var MCP_ASSET_LINK_TTL_MS = 15 * 60 * 1e3;
|
|
492
492
|
|
|
493
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
493
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/protocol.js
|
|
494
494
|
import { z as z8 } from "zod";
|
|
495
495
|
|
|
496
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
496
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/assets.js
|
|
497
497
|
import { z as z3 } from "zod";
|
|
498
498
|
var assetKind = z3.enum(["urdf", "mesh", "texture"]);
|
|
499
499
|
var asset = z3.object({
|
|
@@ -813,10 +813,10 @@ var assetSyncBusyDetails = z3.object({
|
|
|
813
813
|
started_at_ms: z3.number().int().nonnegative()
|
|
814
814
|
});
|
|
815
815
|
|
|
816
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
816
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/config.js
|
|
817
817
|
import { z as z5 } from "zod";
|
|
818
818
|
|
|
819
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
819
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/alerts.js
|
|
820
820
|
import { z as z4 } from "zod";
|
|
821
821
|
var alertRowCondition = z4.discriminatedUnion("kind", [
|
|
822
822
|
z4.strictObject({
|
|
@@ -886,7 +886,7 @@ var putDatapointDisplayRequest = z4.object({
|
|
|
886
886
|
y_max: z4.number().finite().nullable()
|
|
887
887
|
}).strict();
|
|
888
888
|
|
|
889
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
889
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/config.js
|
|
890
890
|
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:`.";
|
|
891
891
|
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:`.";
|
|
892
892
|
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.";
|
|
@@ -1001,7 +1001,7 @@ var parameterSpec = strictObject({
|
|
|
1001
1001
|
examples: ["^[a-z_]+$"]
|
|
1002
1002
|
}).optional(),
|
|
1003
1003
|
description: parameterDescription.meta({
|
|
1004
|
-
description: "What this parameter means, in the developer's own words, and documentation only \u2014 the robot does nothing with it. It travels into the input schema `
|
|
1004
|
+
description: "What this parameter means, in the developer's own words, and documentation only \u2014 the robot does nothing with it. It travels into the input schema `robots.describe` publishes for this call, beside the bounds, so `type` and the range say what the value *is* and this is the only place that says what it *does*.",
|
|
1005
1005
|
/** The sentence `PARAMETER_SNIPPET` already places here, verbatim. */
|
|
1006
1006
|
examples: ["What a caller is choosing when they set this."]
|
|
1007
1007
|
})
|
|
@@ -1179,11 +1179,11 @@ var datapointNumeric = strictObject({
|
|
|
1179
1179
|
examples: [-273.15]
|
|
1180
1180
|
}).optional(),
|
|
1181
1181
|
unit: z5.string().max(32).meta({
|
|
1182
|
-
description: "The unit of the value **after** `scale` and `offset`, not the robot's own. It is shown beside the value and carried by `
|
|
1182
|
+
description: "The unit of the value **after** `scale` and `offset`, not the robot's own. It is shown beside the value and carried by `robots.describe` as its own field, so a model does not have to guess whether 15 means percent, volts or minutes.",
|
|
1183
1183
|
examples: ["%"]
|
|
1184
1184
|
}).optional(),
|
|
1185
1185
|
decimals: z5.number().int().min(0).max(6).meta({
|
|
1186
|
-
description: "How many fraction digits the console shows the value with \u2014 value tile, chart axis and tooltip, and the datapoint detail page \u2014 and the number `
|
|
1186
|
+
description: "How many fraction digits the console shows the value with \u2014 value tile, chart axis and tooltip, and the datapoint detail page \u2014 and the number `robots.describe` reports as its own field, so a model formats the value the way the console does. Presentation only: the stored value keeps the precision it arrived with, and absent means the console's own default rather than zero.",
|
|
1187
1187
|
examples: [1]
|
|
1188
1188
|
}).optional()
|
|
1189
1189
|
});
|
|
@@ -1281,7 +1281,7 @@ var datapointConfig = strictObject({
|
|
|
1281
1281
|
description: "`keep` exempts this datapoint from the low-bandwidth rate cap; its backfill still pauses."
|
|
1282
1282
|
}),
|
|
1283
1283
|
description: serviceDescription.meta({
|
|
1284
|
-
description: "Prose about what this value is, for whoever meets it in the console. It changes nothing the robot does, so a publish that touches only it pushes no configuration at all \u2014 but it is carried verbatim into `
|
|
1284
|
+
description: "Prose about what this value is, for whoever meets it in the console. It changes nothing the robot does, so a publish that touches only it pushes no configuration at all \u2014 but it is carried verbatim into `robots.describe`, where a model that has never seen this robot reads it. The datapoint is offered whenever the role grants it; without one it is offered with `description: null` and the model has less to go on, as for actions, services, publishers and cameras. Omission is the only way to say nothing; an empty string is refused, here and on all five.",
|
|
1285
1285
|
/**
|
|
1286
1286
|
* The sentence both datapoint snippets already place here, verbatim. Its
|
|
1287
1287
|
* four siblings — an action's, a service's, a publisher's, a camera's —
|
|
@@ -1494,7 +1494,7 @@ var actionConfig = strictObject({
|
|
|
1494
1494
|
message: messageBody.optional(),
|
|
1495
1495
|
parameters: parameterMap.optional(),
|
|
1496
1496
|
description: serviceDescription.meta({
|
|
1497
|
-
description: "What this action does, in the developer's own words \u2014 documentation for the console and for MCP clients, which is all it is: the robot does nothing with it. It is carried verbatim into `
|
|
1497
|
+
description: "What this action does, in the developer's own words \u2014 documentation for the console and for MCP clients, which is all it is: the robot does nothing with it. It is carried verbatim into `robots.describe` and read by a model that has never seen this robot. The action is offered whenever the role grants it; without one it is offered with `description: null`, and the model has nothing but the slug.",
|
|
1498
1498
|
examples: ["Drives to a target pose on the map."]
|
|
1499
1499
|
})
|
|
1500
1500
|
}).meta({
|
|
@@ -1870,7 +1870,7 @@ var cameraConfig = strictObject({
|
|
|
1870
1870
|
examples: [5]
|
|
1871
1871
|
}),
|
|
1872
1872
|
description: serviceDescription.meta({
|
|
1873
|
-
description: "What this camera shows, in the developer's own words \u2014 documentation for whoever reads the configuration, for the console and for MCP clients; the robot does nothing with it. A camera without one is still offered, with `description: null`, as for actions, services and publishers. What `
|
|
1873
|
+
description: "What this camera shows, in the developer's own words \u2014 documentation for whoever reads the configuration, for the console and for MCP clients; the robot does nothing with it. A camera without one is still offered, with `description: null`, as for actions, services and publishers. What `camera.snapshot` serves is the latest snapshot with its age; a live session is never a tool.",
|
|
1874
1874
|
examples: ["Forward-facing camera on the mast."]
|
|
1875
1875
|
})
|
|
1876
1876
|
}).meta({
|
|
@@ -1978,7 +1978,7 @@ var configState = z5.object({
|
|
|
1978
1978
|
applied_errors: z5.array(applyError).nullable()
|
|
1979
1979
|
});
|
|
1980
1980
|
|
|
1981
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
1981
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/introspection.js
|
|
1982
1982
|
import { z as z6 } from "zod";
|
|
1983
1983
|
var rosGraphEntry = z6.object({
|
|
1984
1984
|
name: rosName,
|
|
@@ -2017,7 +2017,7 @@ var typeDefinition = z6.discriminatedUnion("kind", [
|
|
|
2017
2017
|
})
|
|
2018
2018
|
]);
|
|
2019
2019
|
|
|
2020
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2020
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/jobs.js
|
|
2021
2021
|
import { z as z7 } from "zod";
|
|
2022
2022
|
var jobState = z7.enum(["running", "unknown", "succeeded", "failed", "cancelled", "lost"]);
|
|
2023
2023
|
var reportedJobState = jobState.exclude(["unknown"]);
|
|
@@ -2031,7 +2031,7 @@ var job = z7.object({
|
|
|
2031
2031
|
description: "The action or service this job is running, as the published configuration exposes it. One slug carries one job at a time, so every observer of that slug sees the same one."
|
|
2032
2032
|
}),
|
|
2033
2033
|
state: jobState.meta({
|
|
2034
|
-
description: "Where the job stands: `running`, `unknown`, `succeeded`, `failed`, `cancelled` or `lost`. `unknown` is not an outcome \u2014 the robot went offline or silent and the cloud does not know yet; the slug stays occupied and the bridge's next statement resolves it, `error` naming why the cloud lost sight of it. `lost` is final
|
|
2034
|
+
description: "Where the job stands: `running`, `unknown`, `succeeded`, `failed`, `cancelled` or `lost`. `unknown` is not an outcome \u2014 the robot went offline or silent and the cloud does not know yet; the slug stays occupied and the bridge's next statement resolves it, `error` naming why the cloud lost sight of it. `lost` is final after an action server disappears before terminal status (`action_server_lost`), a later query confirms the bridge does not know the job and no active goal accounts for it (`job_unknown_to_bridge`), or a terminal goal status is observed but its result cannot be recovered within the bounded wait (`job_lost`). An unqualified bridge loss report also uses `job_lost`, with a message distinguishing it from terminal-result loss. Cloud cleanup may settle a superseded job or a deleted robot's job as `lost` without an error code. A reconnect or omission from `hello.active_jobs` alone is not final."
|
|
2035
2035
|
}),
|
|
2036
2036
|
origin: jobOrigin.meta({
|
|
2037
2037
|
description: "Who started this job. `fleetless` for everything minted by the cloud; `external` for a goal the bridge found active on a published action without having sent it \u2014 no parameters, no starter, never written to `job_runs`."
|
|
@@ -2161,7 +2161,7 @@ var jobRun = z7.object({
|
|
|
2161
2161
|
description: "Whether the slug was an `action` or a `service`."
|
|
2162
2162
|
}),
|
|
2163
2163
|
state: jobState.meta({
|
|
2164
|
-
description: "How the run ended, or `running` while it is still going. `unknown` while the robot has not accounted for it \u2014 offline or silent \u2014 and updated once the bridge says how it stands. `lost` is final
|
|
2164
|
+
description: "How the run ended, or `running` while it is still going. `unknown` while the robot has not accounted for it \u2014 offline or silent \u2014 and updated once the bridge says how it stands. `lost` is final after an action server disappears before terminal status (`action_server_lost`), a later query confirms the bridge does not know the job and no active goal accounts for it (`job_unknown_to_bridge`), or a terminal goal status is observed but its result cannot be recovered within the bounded wait (`job_lost`). An unqualified bridge loss report also uses `job_lost`, with a message distinguishing it from terminal-result loss. Cloud cleanup may settle a superseded run or a deleted robot's run as `lost` without an error code. A reconnect or omission from `hello.active_jobs` alone is not final."
|
|
2165
2165
|
}),
|
|
2166
2166
|
started_at: z7.iso.datetime().meta({
|
|
2167
2167
|
description: "When the run started, as an ISO 8601 timestamp. Runs are listed and filtered by this instant."
|
|
@@ -2254,7 +2254,7 @@ var jobRunSummary = z7.object({
|
|
|
2254
2254
|
since_ms: z7.number().int().nonnegative()
|
|
2255
2255
|
});
|
|
2256
2256
|
|
|
2257
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2257
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/protocol.js
|
|
2258
2258
|
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
2259
2259
|
var MAX_PATIENCE_MS = 12e4;
|
|
2260
2260
|
var MIN_PATIENCE_MS = 1e3;
|
|
@@ -2488,7 +2488,8 @@ var bridgeTypeDefinitions = z8.object({
|
|
|
2488
2488
|
var bridgeState = z8.object({
|
|
2489
2489
|
online: z8.boolean(),
|
|
2490
2490
|
latency_ms: z8.number().nonnegative().nullable(),
|
|
2491
|
-
low_bandwidth: z8.boolean().meta({ description: "Whether the bridge is in its low-bandwidth mode: datapoints capped, cameras reduced or stopped. Bridge-reported." })
|
|
2491
|
+
low_bandwidth: z8.boolean().meta({ description: "Whether the bridge is in its low-bandwidth mode: datapoints capped, cameras reduced or stopped. Bridge-reported." }),
|
|
2492
|
+
health_reason: z8.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." })
|
|
2492
2493
|
});
|
|
2493
2494
|
var snapshotHeader = z8.object({
|
|
2494
2495
|
type: z8.literal("snapshot"),
|
|
@@ -2652,11 +2653,11 @@ var bridgeCameraState = z8.object({
|
|
|
2652
2653
|
request_id: z8.string().min(1).max(64).nullable()
|
|
2653
2654
|
});
|
|
2654
2655
|
|
|
2655
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2656
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/config-issues.js
|
|
2656
2657
|
var EXPOSURE_SECTIONS = ["datapoints", "actions", "services", "publishers", "cameras"];
|
|
2657
2658
|
var EXPOSURE_SECTION_NAMES = new Set(EXPOSURE_SECTIONS);
|
|
2658
2659
|
|
|
2659
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
2660
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/rest.js
|
|
2660
2661
|
import { z as z9 } from "zod";
|
|
2661
2662
|
var robot = z9.object({
|
|
2662
2663
|
id: z9.uuid().meta({
|
|
@@ -2858,6 +2859,12 @@ var cancelRequest = z9.object({
|
|
|
2858
2859
|
description: "The one job to stop. Absent or `null` cancels whatever is currently running on the slug, which is what every caller written before this field existed means. Unknown keys are refused rather than stripped, so a misspelling cannot silently become the slug-wide cancel."
|
|
2859
2860
|
})
|
|
2860
2861
|
}).strict();
|
|
2862
|
+
var recoverHeldJobRequest = z9.object({
|
|
2863
|
+
job_id: z9.uuid().meta({ description: "The exact held job id read from the robot job state; another job must never be released by a stale request." }),
|
|
2864
|
+
verified_stopped: z9.literal(true).meta({ description: "The Owner confirms a physical stop and safety check; this is not a cloud sensor reading." }),
|
|
2865
|
+
reason: z9.string().trim().min(10).max(500).meta({ description: "The Owner's reason and safety-check record, 10\u2013500 characters after trimming; retained in the audit trail." })
|
|
2866
|
+
}).strict();
|
|
2867
|
+
var recoverHeldJobResponse = z9.object({ job });
|
|
2861
2868
|
var releaseLiveQuery = z9.object({
|
|
2862
2869
|
session_id: z9.uuid().optional().meta({
|
|
2863
2870
|
description: "The one hold to release, as the live session returned it. Absent releases **all** of this identity's holds on this camera \u2014 the blunt form, still needed by a client that has lost its id or is going away, and the one that strands the identity's other tabs."
|
|
@@ -3421,13 +3428,13 @@ var slugUsageResponse = z9.object({
|
|
|
3421
3428
|
alert_count: z9.number().int().nonnegative()
|
|
3422
3429
|
});
|
|
3423
3430
|
|
|
3424
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3425
|
-
import { z as
|
|
3431
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/realtime.js
|
|
3432
|
+
import { z as z15 } from "zod";
|
|
3426
3433
|
|
|
3427
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3428
|
-
import { z as
|
|
3434
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/client-auth.js
|
|
3435
|
+
import { z as z14 } from "zod";
|
|
3429
3436
|
|
|
3430
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3437
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/apps.js
|
|
3431
3438
|
import { z as z10 } from "zod";
|
|
3432
3439
|
var appIdentifier = slug;
|
|
3433
3440
|
var app = z10.object({
|
|
@@ -3650,10 +3657,10 @@ var rolePermissions = z10.object({
|
|
|
3650
3657
|
})
|
|
3651
3658
|
});
|
|
3652
3659
|
|
|
3653
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3654
|
-
import { z as
|
|
3660
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/app-users.js
|
|
3661
|
+
import { z as z13 } from "zod";
|
|
3655
3662
|
|
|
3656
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3663
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/identity.js
|
|
3657
3664
|
import { z as z11 } from "zod";
|
|
3658
3665
|
var password = z11.string().min(12).max(256);
|
|
3659
3666
|
var USER_DISPLAY_NAME_MAX = 120;
|
|
@@ -3732,7 +3739,12 @@ var twoFactorSetupResponse = z11.object({
|
|
|
3732
3739
|
description: "The same secret as an `otpauth://totp/` URL, to render as a QR code. It carries the secret: never log it."
|
|
3733
3740
|
})
|
|
3734
3741
|
});
|
|
3735
|
-
var waitlistRequest = z11.object({
|
|
3742
|
+
var waitlistRequest = z11.object({
|
|
3743
|
+
email: z11.email().max(254),
|
|
3744
|
+
consent_text_version: z11.string().min(1).max(80).regex(/\S/).meta({
|
|
3745
|
+
description: "Version of the F.1 text shown at submission. Cloud rejects unsupported versions and stores the submitted value in a consent record separate from the waiting list."
|
|
3746
|
+
})
|
|
3747
|
+
});
|
|
3736
3748
|
var mailStatus = z11.enum(["sent", "not_requested", "not_configured", "failed"]);
|
|
3737
3749
|
var createTeamInviteRequest = z11.object({
|
|
3738
3750
|
email: z11.email().meta({
|
|
@@ -3871,24 +3883,44 @@ var recoveryCodesResponse = z11.object({
|
|
|
3871
3883
|
recovery_codes: recoveryCodesList.meta({ description: "The ten new recovery codes, lowercase, shown once. Every earlier code is void." })
|
|
3872
3884
|
});
|
|
3873
3885
|
|
|
3874
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
3886
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/legal.js
|
|
3887
|
+
import { z as z12 } from "zod";
|
|
3888
|
+
var httpsLegalUrl = z12.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) => {
|
|
3889
|
+
try {
|
|
3890
|
+
const url = new URL(value);
|
|
3891
|
+
return url.protocol === "https:" && !url.username && !url.password;
|
|
3892
|
+
} catch {
|
|
3893
|
+
return false;
|
|
3894
|
+
}
|
|
3895
|
+
}, { message: "must be an absolute HTTPS URL without credentials" }).meta({ format: "uri" });
|
|
3896
|
+
var legalDocumentReference = z12.object({
|
|
3897
|
+
version: z12.string().trim().min(1).max(80),
|
|
3898
|
+
version_date: z12.iso.date(),
|
|
3899
|
+
url: httpsLegalUrl
|
|
3900
|
+
}).strict();
|
|
3901
|
+
var legalTextReferences = z12.object({
|
|
3902
|
+
terms: legalDocumentReference,
|
|
3903
|
+
dpa: legalDocumentReference.nullable()
|
|
3904
|
+
}).strict();
|
|
3905
|
+
|
|
3906
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/app-users.js
|
|
3875
3907
|
var APP_USER_DISPLAY_NAME_MAX = 120;
|
|
3876
|
-
var providerSlug =
|
|
3877
|
-
var appUserStatus =
|
|
3878
|
-
var appUser =
|
|
3879
|
-
id:
|
|
3908
|
+
var providerSlug = z13.string().max(40).regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, "must be lowercase and hyphen-separated, starting with a letter");
|
|
3909
|
+
var appUserStatus = z13.enum(["pending_verification", "active", "blocked"]);
|
|
3910
|
+
var appUser = z13.object({
|
|
3911
|
+
id: z13.uuid().meta({
|
|
3880
3912
|
description: "The app user in the API, assigned by the cloud and stable for the life of the account."
|
|
3881
3913
|
}),
|
|
3882
|
-
app_id:
|
|
3914
|
+
app_id: z13.uuid().meta({
|
|
3883
3915
|
description: "The app this user belongs to, and the whole of their scope. An app user of one app is nobody at another, even inside the same organisation."
|
|
3884
3916
|
}),
|
|
3885
|
-
email:
|
|
3917
|
+
email: z13.email().meta({
|
|
3886
3918
|
description: "The address the account is identified by. Unique **per app**, case-insensitively \u2014 the same address may exist as an unrelated account in another app of the same organisation."
|
|
3887
3919
|
}),
|
|
3888
|
-
display_name:
|
|
3920
|
+
display_name: z13.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().meta({
|
|
3889
3921
|
description: "Optional human name, shown by the developer's own UI instead of the address where present. `null` when the user never supplied one; never used for authentication."
|
|
3890
3922
|
}),
|
|
3891
|
-
role_id:
|
|
3923
|
+
role_id: z13.uuid().meta({
|
|
3892
3924
|
description: "The role that decides what this user may reach. Roles are the only visibility filter: what a role does not grant does not exist for that user."
|
|
3893
3925
|
}),
|
|
3894
3926
|
status: appUserStatus.meta({
|
|
@@ -3900,83 +3932,83 @@ var appUser = z12.object({
|
|
|
3900
3932
|
* response. `false` is an OIDC-only account or an invitation not yet
|
|
3901
3933
|
* accepted — it does not mean blocked and it does not mean without access.
|
|
3902
3934
|
*/
|
|
3903
|
-
has_password:
|
|
3935
|
+
has_password: z13.boolean().meta({
|
|
3904
3936
|
description: 'Whether this account has a Fleetless-held password. `false` is an identity-provider-only account, or an invitation not yet accepted \u2014 it does not mean blocked and it does not mean without access. No hash, no algorithm and no "last changed" travels here, and nothing on the wire can say whether a password is strong or already known to somebody else.'
|
|
3905
3937
|
}),
|
|
3906
|
-
providers:
|
|
3938
|
+
providers: z13.array(providerSlug).max(20).meta({
|
|
3907
3939
|
description: "The slugs of the identity providers this account is linked to, empty for a password-only user. Lets a developer's user list say where an account came from without a second request."
|
|
3908
3940
|
}),
|
|
3909
|
-
last_login_at:
|
|
3941
|
+
last_login_at: z13.iso.datetime().nullable().meta({
|
|
3910
3942
|
description: "When this user last signed in, or `null` if they never have. Required and nullable rather than optional, so *never logged in* stays distinguishable from *this field was not loaded*."
|
|
3911
3943
|
}),
|
|
3912
|
-
two_factor:
|
|
3913
|
-
enabled:
|
|
3944
|
+
two_factor: z13.object({
|
|
3945
|
+
enabled: z13.boolean().meta({
|
|
3914
3946
|
description: "Whether the account has a confirmed authenticator app (TOTP). When it has, every sign-in that yields a session asks for a code as well \u2014 whatever the app's policy \u2014 except a sign-in through an identity provider, which owns that sign-in."
|
|
3915
3947
|
}),
|
|
3916
|
-
enabled_at:
|
|
3948
|
+
enabled_at: z13.iso.datetime().nullable().meta({
|
|
3917
3949
|
description: "When the authenticator was confirmed, or `null` while `enabled` is `false`."
|
|
3918
3950
|
}),
|
|
3919
|
-
recovery_codes_left:
|
|
3951
|
+
recovery_codes_left: z13.number().int().min(0).max(10).meta({
|
|
3920
3952
|
description: "How many of the ten single-use recovery codes are still unspent. `0` while `enabled` is `false`."
|
|
3921
3953
|
})
|
|
3922
3954
|
}).meta({
|
|
3923
3955
|
description: "The account's second factor, as a developer's user list shows it. No secret and no code travels here; resetting it is `DELETE /api/apps/:id/users/:userId/two-factor`."
|
|
3924
3956
|
}),
|
|
3925
|
-
created_at:
|
|
3957
|
+
created_at: z13.iso.datetime().meta({
|
|
3926
3958
|
description: "When the account was created, as an ISO 8601 timestamp."
|
|
3927
3959
|
})
|
|
3928
3960
|
});
|
|
3929
|
-
var appUserListResponse =
|
|
3930
|
-
users:
|
|
3961
|
+
var appUserListResponse = z13.object({
|
|
3962
|
+
users: z13.array(appUser).meta({
|
|
3931
3963
|
description: "Every user of this app. An app with no users answers an empty array, not an absent key."
|
|
3932
3964
|
})
|
|
3933
3965
|
});
|
|
3934
|
-
var createAppUserRequest =
|
|
3935
|
-
email:
|
|
3966
|
+
var createAppUserRequest = z13.object({
|
|
3967
|
+
email: z13.email().meta({
|
|
3936
3968
|
description: "The address, unique per app case-insensitively. An address this app already knows is refused with `email_taken` \u2014 a developer-authenticated route may say so, unlike the public registration route."
|
|
3937
3969
|
}),
|
|
3938
3970
|
password: password.meta({
|
|
3939
3971
|
description: "The initial password. At least 12 characters: length only, because a rule a user cannot predict is a rule they work around."
|
|
3940
3972
|
}),
|
|
3941
|
-
display_name:
|
|
3973
|
+
display_name: z13.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
3942
3974
|
description: "Optional human name. Absent leaves it unset; an explicit `null` is the same end state."
|
|
3943
3975
|
}),
|
|
3944
|
-
role_id:
|
|
3976
|
+
role_id: z13.uuid().optional().meta({
|
|
3945
3977
|
description: "The role the new user holds. Absent means the app's `default_role_id`, and `409 target_state_conflict` when the app has none or its default no longer resolves; a role belonging to another app is `404 not_found`, the same refusal a role that never existed gets."
|
|
3946
3978
|
})
|
|
3947
3979
|
}).strict();
|
|
3948
|
-
var patchAppUserRequest =
|
|
3949
|
-
display_name:
|
|
3980
|
+
var patchAppUserRequest = z13.object({
|
|
3981
|
+
display_name: z13.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
3950
3982
|
description: "The user's display name. Absent leaves it alone; an explicit `null` clears it."
|
|
3951
3983
|
}),
|
|
3952
|
-
role_id:
|
|
3984
|
+
role_id: z13.uuid().optional().meta({
|
|
3953
3985
|
description: "The role the user holds from now on. A role belonging to another app is `404 not_found`, the same refusal a role that never existed gets; re-roling closes the user's live subscriptions."
|
|
3954
3986
|
}),
|
|
3955
|
-
status:
|
|
3987
|
+
status: z13.enum(["active", "blocked"]).meta({
|
|
3956
3988
|
description: "Block the account or let it back in. **`pending_verification` cannot be set here**: it is reached only by self-registration and left only by spending the mailed verification token, so a developer setting it would strand the account in a state nothing re-mails them out of."
|
|
3957
3989
|
}).optional()
|
|
3958
3990
|
}).strict();
|
|
3959
|
-
var createAppInvitationRequest =
|
|
3960
|
-
email:
|
|
3991
|
+
var createAppInvitationRequest = z13.object({
|
|
3992
|
+
email: z13.email().meta({
|
|
3961
3993
|
description: "The address to invite. An invitation always bypasses the domain whitelist \u2014 a developer inviting somebody by hand has already made the decision the whitelist automates."
|
|
3962
3994
|
}),
|
|
3963
|
-
role_id:
|
|
3995
|
+
role_id: z13.uuid().optional().meta({
|
|
3964
3996
|
description: "The role the invitee gets on acceptance. Absent means the app's `default_role_id`."
|
|
3965
3997
|
}),
|
|
3966
|
-
display_name:
|
|
3998
|
+
display_name: z13.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
3967
3999
|
description: "An optional name to pre-fill the account with; the invitee can change it afterwards."
|
|
3968
4000
|
}),
|
|
3969
|
-
send_mail:
|
|
4001
|
+
send_mail: z13.boolean().meta({
|
|
3970
4002
|
description: "Whether Fleetless mails the invitation. The link points at the app's `invite_url`, or at the Fleetless-hosted invitation page when the app has configured none \u2014 so the mail always leads somewhere, and nothing is refused for a missing URL."
|
|
3971
4003
|
})
|
|
3972
4004
|
}).strict();
|
|
3973
|
-
var appInvitation =
|
|
3974
|
-
id:
|
|
3975
|
-
app_id:
|
|
3976
|
-
email:
|
|
3977
|
-
role_id:
|
|
3978
|
-
expires_at:
|
|
3979
|
-
accept_url:
|
|
4005
|
+
var appInvitation = z13.object({
|
|
4006
|
+
id: z13.uuid().meta({ description: "The invitation, as listed and revoked by the developer." }),
|
|
4007
|
+
app_id: z13.uuid().meta({ description: "The app the invitee will belong to." }),
|
|
4008
|
+
email: z13.email().meta({ description: "The address the invitation was addressed to." }),
|
|
4009
|
+
role_id: z13.uuid().meta({ description: "The role the invitee holds once they accept. Resolved at creation, so a later change to the app's default role does not silently re-aim an outstanding invitation." }),
|
|
4010
|
+
expires_at: z13.iso.datetime().meta({ description: "When the token stops working. Seven days from issue; an expired token answers exactly as an unknown one does." }),
|
|
4011
|
+
accept_url: z13.url().max(500).meta({
|
|
3980
4012
|
description: "The link to give the invitee: the app's `invite_url` with the token substituted for `{token}`, or the Fleetless-hosted invitation page when the app has configured none. Bounded like every other URL that gets mailed, logged and rendered."
|
|
3981
4013
|
}),
|
|
3982
4014
|
mail: mailStatus.meta({
|
|
@@ -3984,77 +4016,77 @@ var appInvitation = z12.object({
|
|
|
3984
4016
|
})
|
|
3985
4017
|
});
|
|
3986
4018
|
var pendingAppInvitation = appInvitation.omit({ accept_url: true, mail: true });
|
|
3987
|
-
var appInvitationListResponse =
|
|
3988
|
-
invitations:
|
|
4019
|
+
var appInvitationListResponse = z13.object({
|
|
4020
|
+
invitations: z13.array(pendingAppInvitation).meta({
|
|
3989
4021
|
description: "The app's outstanding invitations, without their tokens. An accepted one is history and does not appear."
|
|
3990
4022
|
})
|
|
3991
4023
|
});
|
|
3992
|
-
var appOidcProvider =
|
|
3993
|
-
id:
|
|
3994
|
-
app_id:
|
|
4024
|
+
var appOidcProvider = z13.object({
|
|
4025
|
+
id: z13.uuid().meta({ description: "The provider row, as listed, patched and deleted by the developer." }),
|
|
4026
|
+
app_id: z13.uuid().meta({ description: "The app this provider signs users in to." }),
|
|
3995
4027
|
slug: providerSlug.meta({
|
|
3996
4028
|
description: "The stable handle in the sign-in URL (`/api/client/oidc/:slug/start`) and on the developer's own button. Unique per app, lowercase and hyphen-separated \u2014 **not** the underscore-separated grammar `identifier` uses. Immutable: linked identities are keyed by it."
|
|
3997
4029
|
}),
|
|
3998
|
-
name:
|
|
4030
|
+
name: z13.string().min(1).max(80).meta({
|
|
3999
4031
|
description: 'What the developer\'s sign-in page calls this provider, e.g. "Sign in with Azure AD". Free text; the only field of this shape the public `GET /api/client/providers` reveals besides the slug.'
|
|
4000
4032
|
}),
|
|
4001
4033
|
issuer: idpIssuer.meta({
|
|
4002
4034
|
description: "The provider's issuer URL, from which discovery and the JWKS are read. http(s) only, with no credentials, query or fragment \u2014 RFC 8414 \xA73 builds the discovery URL from the issuer's path, so a query there is meaningless and an `@` is a redirect trick. **This is not the SSRF defence**: it cannot tell a loopback dev provider from a loopback database, and the real check refuses loopback, link-local and private ranges at the fetch."
|
|
4003
4035
|
}),
|
|
4004
|
-
client_id:
|
|
4036
|
+
client_id: z13.string().min(1).max(200).meta({
|
|
4005
4037
|
description: "The OAuth client the developer registered at their provider for Fleetless."
|
|
4006
4038
|
}),
|
|
4007
|
-
scopes:
|
|
4039
|
+
scopes: z13.array(z13.string().min(1).max(60)).min(1).max(20).meta({
|
|
4008
4040
|
description: "The scopes requested at the provider. At least one \u2014 a request that asks for nothing learns nothing \u2014 and bounded, because an unbounded array on a stored, logged and rendered shape is a size nobody chose."
|
|
4009
4041
|
}),
|
|
4010
|
-
link_verified_emails:
|
|
4042
|
+
link_verified_emails: z13.boolean().meta({
|
|
4011
4043
|
description: "Whether a federated login may join an **existing** app user with the same address. It needs the provider to assert `email_verified` as well: either condition alone is account takeover, since a provider that lets anyone type any address into a profile would otherwise hand over every matching account, and a developer who connects a provider for a subset of their users would otherwise silently merge strangers."
|
|
4012
4044
|
}),
|
|
4013
|
-
enabled:
|
|
4045
|
+
enabled: z13.boolean().meta({
|
|
4014
4046
|
description: "Whether this provider is offered. A disabled provider disappears from `GET /api/client/providers` and refuses a start with `provider_disabled`, without the row and its linked identities being deleted."
|
|
4015
4047
|
}),
|
|
4016
|
-
created_at:
|
|
4048
|
+
created_at: z13.iso.datetime().meta({ description: "When the provider was configured, as an ISO 8601 timestamp." })
|
|
4017
4049
|
}).strict();
|
|
4018
|
-
var appOidcProviderListResponse =
|
|
4019
|
-
providers:
|
|
4050
|
+
var appOidcProviderListResponse = z13.object({
|
|
4051
|
+
providers: z13.array(appOidcProvider).meta({
|
|
4020
4052
|
description: "Every provider configured on this app, disabled ones included \u2014 this is the developer's management view, unlike the public `GET /api/client/providers`, which lists only what a user can actually press."
|
|
4021
4053
|
})
|
|
4022
4054
|
});
|
|
4023
|
-
var createAppOidcProviderRequest =
|
|
4055
|
+
var createAppOidcProviderRequest = z13.object({
|
|
4024
4056
|
slug: providerSlug.meta({
|
|
4025
4057
|
description: "The handle for this provider, unique per app. Immutable once created \u2014 identities are keyed by it, so a rename would orphan every linked account."
|
|
4026
4058
|
}),
|
|
4027
|
-
name:
|
|
4059
|
+
name: z13.string().min(1).max(80).meta({ description: "What the developer's sign-in page calls this provider." }),
|
|
4028
4060
|
issuer: idpIssuer.meta({
|
|
4029
4061
|
description: "The provider's issuer URL. Shape-checked here (http(s), no credentials, query or fragment); the authoritative SSRF defence is at the discovery fetch."
|
|
4030
4062
|
}),
|
|
4031
|
-
client_id:
|
|
4032
|
-
client_secret:
|
|
4063
|
+
client_id: z13.string().min(1).max(200).meta({ description: "The OAuth client registered at the provider for Fleetless." }),
|
|
4064
|
+
client_secret: z13.string().min(16).max(500).meta({
|
|
4033
4065
|
description: "The client secret, **write-only**: it is stored encrypted and comes back through nothing \u2014 not the read, not this route's own answer, not an audit detail. Required on create, since a provider with no secret cannot exchange a code; the minimum length refuses a value that is a misconfiguration rather than a secret."
|
|
4034
4066
|
}),
|
|
4035
|
-
scopes:
|
|
4067
|
+
scopes: z13.array(z13.string().min(1).max(60)).min(1).max(20).default(["openid", "email", "profile"]).meta({
|
|
4036
4068
|
description: "The scopes to request. Defaults to `openid email profile`, which is what account linking actually reads: the subject, the address and its verified flag, and a name."
|
|
4037
4069
|
}),
|
|
4038
|
-
link_verified_emails:
|
|
4070
|
+
link_verified_emails: z13.boolean().default(false).meta({
|
|
4039
4071
|
description: "Whether a federated login may join an existing app user by verified address. **Defaults to off**, because relaxing later is additive and admitting duplicates now and tightening afterwards is not."
|
|
4040
4072
|
}),
|
|
4041
|
-
enabled:
|
|
4073
|
+
enabled: z13.boolean().default(true).meta({
|
|
4042
4074
|
description: "Whether the provider is offered immediately. Defaults to on: a developer who just typed a client secret is configuring a provider they mean to use."
|
|
4043
4075
|
})
|
|
4044
4076
|
}).strict();
|
|
4045
|
-
var patchAppOidcProviderRequest =
|
|
4046
|
-
name:
|
|
4077
|
+
var patchAppOidcProviderRequest = z13.object({
|
|
4078
|
+
name: z13.string().min(1).max(80).optional().meta({ description: "A new display name for the provider." }),
|
|
4047
4079
|
issuer: idpIssuer.optional().meta({ description: "A new issuer URL. Changing it re-runs discovery; identities linked under the old one keep their `(provider, subject)` key." }),
|
|
4048
|
-
client_id:
|
|
4049
|
-
client_secret:
|
|
4080
|
+
client_id: z13.string().min(1).max(200).optional().meta({ description: "A new client id." }),
|
|
4081
|
+
client_secret: z13.string().min(16).max(500).optional().meta({
|
|
4050
4082
|
description: "A replacement client secret. **Absent means keep the stored one**, so a routine edit need not put the secret back on the wire; it is never echoed back by any route."
|
|
4051
4083
|
}),
|
|
4052
|
-
scopes:
|
|
4053
|
-
link_verified_emails:
|
|
4054
|
-
enabled:
|
|
4084
|
+
scopes: z13.array(z13.string().min(1).max(60)).min(1).max(20).optional().meta({ description: "A replacement scope list. A replace, not a merge." }),
|
|
4085
|
+
link_verified_emails: z13.boolean().optional().meta({ description: "Whether a federated login may join an existing app user by verified address." }),
|
|
4086
|
+
enabled: z13.boolean().optional().meta({ description: "Turn the provider off or back on without deleting it or its linked identities." })
|
|
4055
4087
|
}).strict();
|
|
4056
4088
|
function appUrlTemplate(placeholder) {
|
|
4057
|
-
return
|
|
4089
|
+
return z13.string().max(500).refine((v) => {
|
|
4058
4090
|
try {
|
|
4059
4091
|
const u = new URL(v.replace(placeholder, "x"));
|
|
4060
4092
|
const schemeOk = u.protocol === "https:" || u.protocol === "http:" && (u.hostname === "localhost" || u.hostname === "127.0.0.1");
|
|
@@ -4064,7 +4096,7 @@ function appUrlTemplate(placeholder) {
|
|
|
4064
4096
|
}
|
|
4065
4097
|
}, { message: `must be an https URL (or http://localhost) containing ${placeholder} exactly once` });
|
|
4066
4098
|
}
|
|
4067
|
-
var allowedOrigin =
|
|
4099
|
+
var allowedOrigin = z13.string().max(200).refine((v) => {
|
|
4068
4100
|
try {
|
|
4069
4101
|
const u = new URL(v);
|
|
4070
4102
|
return u.origin === v && (u.protocol === "https:" || u.hostname === "localhost" || u.hostname === "127.0.0.1");
|
|
@@ -4072,17 +4104,17 @@ var allowedOrigin = z12.string().max(200).refine((v) => {
|
|
|
4072
4104
|
return false;
|
|
4073
4105
|
}
|
|
4074
4106
|
}, { message: "must be a bare origin (scheme, host, port) over https, or over http on localhost" });
|
|
4075
|
-
var emailDomain =
|
|
4076
|
-
var appSignInMethods =
|
|
4077
|
-
password:
|
|
4107
|
+
var emailDomain = z13.string().min(1).max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/, "must be a lowercase domain name with at least two labels");
|
|
4108
|
+
var appSignInMethods = z13.object({
|
|
4109
|
+
password: z13.boolean().meta({
|
|
4078
4110
|
description: "Whether app users may sign in with a password. Off refuses `POST /api/client/login` with `method_not_allowed`, and registration and invitations then take no password."
|
|
4079
4111
|
}),
|
|
4080
|
-
email_code:
|
|
4112
|
+
email_code: z13.boolean().meta({
|
|
4081
4113
|
description: "Whether app users may sign in with a six-digit code mailed to them, valid ten minutes. A code needs no URL, so it works in local development and in an app with no web UI."
|
|
4082
4114
|
})
|
|
4083
4115
|
}).strict().refine((m) => m.password || m.email_code, { message: "At least one sign-in method must be on.", path: ["password"] });
|
|
4084
|
-
var appTwoFactorPolicy =
|
|
4085
|
-
var appHomeUrl =
|
|
4116
|
+
var appTwoFactorPolicy = z13.enum(["off", "optional", "required"]);
|
|
4117
|
+
var appHomeUrl = z13.url().max(500).refine((v) => {
|
|
4086
4118
|
try {
|
|
4087
4119
|
const u = new URL(v);
|
|
4088
4120
|
const hostOk = u.protocol === "https:" || u.protocol === "http:" && ["localhost", "127.0.0.1"].includes(u.hostname);
|
|
@@ -4091,24 +4123,24 @@ var appHomeUrl = z12.url().max(500).refine((v) => {
|
|
|
4091
4123
|
return false;
|
|
4092
4124
|
}
|
|
4093
4125
|
}, { message: "An https URL (http only on localhost) without a placeholder." });
|
|
4094
|
-
var hostedAccent =
|
|
4095
|
-
var appHostedPages =
|
|
4096
|
-
invite_url:
|
|
4097
|
-
verify_url:
|
|
4098
|
-
reset_url:
|
|
4099
|
-
mcp_login_url:
|
|
4100
|
-
});
|
|
4101
|
-
var appAuthConfig =
|
|
4102
|
-
self_registration:
|
|
4126
|
+
var hostedAccent = z13.string().regex(/^#[0-9a-f]{6}$/, "must be a lowercase hex colour, #rrggbb");
|
|
4127
|
+
var appHostedPages = z13.object({
|
|
4128
|
+
invite_url: z13.url().meta({ description: "The hosted invitation page, `<portal>/app/<identifier>/invite/{token}`." }),
|
|
4129
|
+
verify_url: z13.url().meta({ description: "The hosted email-confirmation page, `<portal>/app/<identifier>/verify/{token}`." }),
|
|
4130
|
+
reset_url: z13.url().meta({ description: "The hosted new-password page, `<portal>/app/<identifier>/reset/{token}`." }),
|
|
4131
|
+
mcp_login_url: z13.url().meta({ description: "The hosted MCP sign-in, `<portal>/app/<identifier>/mcp/{interaction}`." })
|
|
4132
|
+
});
|
|
4133
|
+
var appAuthConfig = z13.object({
|
|
4134
|
+
self_registration: z13.boolean().meta({
|
|
4103
4135
|
description: "Whether a stranger may create an account in this app. Off refuses `POST /api/client/register` with `403 registration_closed`, and refuses an unknown identity at an OIDC callback with the same reasoning \u2014 one switch for one decision, whichever door the person arrives at."
|
|
4104
4136
|
}),
|
|
4105
|
-
allowed_domains:
|
|
4137
|
+
allowed_domains: z13.array(emailDomain).max(50).meta({
|
|
4106
4138
|
description: 'The email domains self-registration accepts, lowercase. An empty list means no domain restriction, not "nobody" \u2014 the switch above is what closes the door. **An invitation always bypasses this**, by password and through a provider alike.'
|
|
4107
4139
|
}),
|
|
4108
|
-
allowed_origins:
|
|
4140
|
+
allowed_origins: z13.array(allowedOrigin).max(20).meta({
|
|
4109
4141
|
description: "The origins the client auth API answers CORS for, and the only origins an OIDC `redirect_uri` may name. Bare origins: scheme, host and port, with no path \u2014 a browser sends nothing longer, so an entry carrying one could never match."
|
|
4110
4142
|
}),
|
|
4111
|
-
mcp_enabled:
|
|
4143
|
+
mcp_enabled: z13.boolean().meta({
|
|
4112
4144
|
description: "Whether this app serves an MCP endpoint at `/mcp/<identifier>`. Off refuses the whole OAuth surface for the app, not merely the tool calls, and is re-read on every request rather than cached off a token."
|
|
4113
4145
|
}),
|
|
4114
4146
|
invite_url: appUrlTemplate("{token}").nullable().meta({
|
|
@@ -4126,13 +4158,19 @@ var appAuthConfig = z12.object({
|
|
|
4126
4158
|
app_url: appHomeUrl.nullable().meta({
|
|
4127
4159
|
description: "The app's own home page, linked as `Open <app>` when a hosted flow is done. `null` makes the hosted done page say `You can close this tab`."
|
|
4128
4160
|
}),
|
|
4161
|
+
operator_info_url: httpsLegalUrl.nullable().meta({
|
|
4162
|
+
description: "Operator information / legal notice URL for this customer app. `null` means unset; cloud checks reachability and public addresses before allowing new app-user access flows."
|
|
4163
|
+
}),
|
|
4164
|
+
privacy_policy_url: httpsLegalUrl.nullable().meta({
|
|
4165
|
+
description: "Privacy policy URL for this customer app. `null` means unset; cloud checks reachability and public addresses before allowing new app-user access flows."
|
|
4166
|
+
}),
|
|
4129
4167
|
sign_in_methods: appSignInMethods.meta({
|
|
4130
4168
|
description: "Which sign-in methods the app offers: password, emailed code, or both \u2014 at least one. Identity providers stay on top of either. The default is password only."
|
|
4131
4169
|
}),
|
|
4132
4170
|
two_factor: appTwoFactorPolicy.meta({
|
|
4133
4171
|
description: "Whether the app asks for an authenticator code: `off` (the default), `optional` or `required`. A person with a confirmed authenticator is asked at every sign-in whatever the policy; a sign-in through an identity provider is never asked."
|
|
4134
4172
|
}),
|
|
4135
|
-
hosted_logo_url:
|
|
4173
|
+
hosted_logo_url: z13.url().nullable().meta({
|
|
4136
4174
|
description: "Where the hosted pages load the app's logo from, `<portal>/app/<identifier>/logo`, or `null` when no logo is stored. **Read-only** \u2014 the logo is written through `PUT /api/apps/:id/auth-config/logo`."
|
|
4137
4175
|
}),
|
|
4138
4176
|
hosted_accent: hostedAccent.nullable().meta({
|
|
@@ -4141,212 +4179,278 @@ var appAuthConfig = z12.object({
|
|
|
4141
4179
|
hosted_pages: appHostedPages.meta({
|
|
4142
4180
|
description: "The Fleetless-hosted pages an unset URL falls back to, as templates. **Read-only**: minted by the cloud from the auth portal and the app's identifier."
|
|
4143
4181
|
}),
|
|
4144
|
-
oidc_callback_url:
|
|
4182
|
+
oidc_callback_url: z13.url().meta({
|
|
4145
4183
|
description: "The one callback URL to register at every identity provider, the same for every app and every provider. **Read-only** \u2014 it is minted by the cloud from its own public base URL, and a writable version of this field would let a caller point the return leg, which carries an authorization code, at a host they own."
|
|
4146
4184
|
}),
|
|
4147
|
-
updated_at:
|
|
4185
|
+
updated_at: z13.iso.datetime().meta({ description: "When the configuration was last written, as an ISO 8601 timestamp." })
|
|
4148
4186
|
});
|
|
4149
4187
|
var putAppAuthRegistrationRequest = appAuthConfig.pick({ self_registration: true, allowed_domains: true, allowed_origins: true }).strict();
|
|
4150
4188
|
var putAppAuthSignInRequest = appAuthConfig.pick({ sign_in_methods: true, two_factor: true }).strict();
|
|
4151
|
-
var putAppAuthUrlsRequest = appAuthConfig.pick({
|
|
4189
|
+
var putAppAuthUrlsRequest = appAuthConfig.pick({
|
|
4190
|
+
app_url: true,
|
|
4191
|
+
invite_url: true,
|
|
4192
|
+
verify_url: true,
|
|
4193
|
+
reset_url: true,
|
|
4194
|
+
mcp_login_url: true,
|
|
4195
|
+
operator_info_url: true,
|
|
4196
|
+
privacy_policy_url: true
|
|
4197
|
+
}).strict();
|
|
4152
4198
|
var putAppAuthMcpRequest = appAuthConfig.pick({ mcp_enabled: true }).strict();
|
|
4153
4199
|
var putAppAuthLookRequest = appAuthConfig.pick({ hosted_accent: true }).strict();
|
|
4154
|
-
var mailTemplateKind =
|
|
4155
|
-
var
|
|
4200
|
+
var mailTemplateKind = z13.enum(["invite", "verify", "reset", "login_code"]);
|
|
4201
|
+
var APP_LEGAL_MAIL_FOOTER = `{% if app.operator_info_url and app.privacy_policy_url %}
|
|
4202
|
+
|
|
4203
|
+
{{ app.name }} \xB7 Operator information: {{ app.operator_info_url }} \xB7 Privacy policy: {{ app.privacy_policy_url }}
|
|
4204
|
+
{% endif %}`;
|
|
4205
|
+
var DEFAULT_MAIL_TEMPLATES = {
|
|
4206
|
+
invite: {
|
|
4207
|
+
subject: "You're invited to {{ app.name }}",
|
|
4208
|
+
text: `Hello {{ user.display_name | default: user.email }},
|
|
4209
|
+
|
|
4210
|
+
{{ org.name }} has invited you to {{ app.name }} as {{ role.name }}.
|
|
4211
|
+
|
|
4212
|
+
Accept the invitation:
|
|
4213
|
+
{{ link }}
|
|
4214
|
+
|
|
4215
|
+
The link works for the next {% if expires_in_hours >= 48 %}{{ expires_in_hours | divided_by: 24 }} days{% elsif expires_in_hours == 1 %}1 hour{% else %}{{ expires_in_hours }} hours{% endif %}. If you were not expecting this invitation, ignore this mail \u2014 no account is created until you accept.
|
|
4216
|
+
${APP_LEGAL_MAIL_FOOTER}
|
|
4217
|
+
`,
|
|
4218
|
+
html: null
|
|
4219
|
+
},
|
|
4220
|
+
verify: {
|
|
4221
|
+
subject: "Confirm your email for {{ app.name }}",
|
|
4222
|
+
text: `Hello {{ user.email }},
|
|
4223
|
+
|
|
4224
|
+
Confirm this address so you can sign in to {{ app.name }}:
|
|
4225
|
+
{{ link }}
|
|
4226
|
+
|
|
4227
|
+
The link works for the next {% if expires_in_hours >= 48 %}{{ expires_in_hours | divided_by: 24 }} days{% elsif expires_in_hours == 1 %}1 hour{% else %}{{ expires_in_hours }} hours{% endif %}. If you did not create this account, ignore this mail \u2014 the account stays unconfirmed and cannot be used.
|
|
4228
|
+
${APP_LEGAL_MAIL_FOOTER}
|
|
4229
|
+
`,
|
|
4230
|
+
html: null
|
|
4231
|
+
},
|
|
4232
|
+
reset: {
|
|
4233
|
+
subject: "Reset your {{ app.name }} password",
|
|
4234
|
+
text: `Hello {{ user.email }},
|
|
4235
|
+
|
|
4236
|
+
Someone asked to reset the password for this address at {{ app.name }}.
|
|
4237
|
+
|
|
4238
|
+
Choose a new password:
|
|
4239
|
+
{{ link }}
|
|
4240
|
+
|
|
4241
|
+
The link works for the next {% if expires_in_hours >= 48 %}{{ expires_in_hours | divided_by: 24 }} days{% elsif expires_in_hours == 1 %}1 hour{% else %}{{ expires_in_hours }} hours{% endif %}. If it was not you, ignore this mail \u2014 your current password keeps working and nothing changes.
|
|
4242
|
+
${APP_LEGAL_MAIL_FOOTER}
|
|
4243
|
+
`,
|
|
4244
|
+
html: null
|
|
4245
|
+
},
|
|
4246
|
+
login_code: {
|
|
4247
|
+
subject: "Your {{ app.name }} sign-in code",
|
|
4248
|
+
text: `Your sign-in code for {{ app.name }} is {{ code }}.
|
|
4249
|
+
|
|
4250
|
+
It works once, for {{ expires_in_minutes }} minutes. If you did not ask for it, ignore this mail.
|
|
4251
|
+
|
|
4252
|
+
${APP_LEGAL_MAIL_FOOTER}`,
|
|
4253
|
+
html: null
|
|
4254
|
+
}
|
|
4255
|
+
};
|
|
4256
|
+
var appMailTemplate = z13.object({
|
|
4156
4257
|
kind: mailTemplateKind.meta({ description: "Which of the four mails this template replaces." }),
|
|
4157
|
-
subject:
|
|
4158
|
-
text:
|
|
4159
|
-
html:
|
|
4160
|
-
updated_at:
|
|
4258
|
+
subject: z13.string().min(1).max(200).meta({ description: "The subject line, a Liquid template. Bounded because a subject is rendered into a header." }),
|
|
4259
|
+
text: z13.string().min(1).max(2e4).meta({ description: "The plain-text body, a Liquid template. Required even when an HTML part is given: a mail with no text part is unreadable to a client that refuses HTML." }),
|
|
4260
|
+
html: z13.string().min(1).max(1e5).nullable().meta({ description: "The optional HTML body, a Liquid template. `null` means this template is text-only, which is a complete mail and not a half-configured one." }),
|
|
4261
|
+
updated_at: z13.iso.datetime().meta({ description: "When the template was last written, as an ISO 8601 timestamp." })
|
|
4161
4262
|
});
|
|
4162
|
-
var appMailTemplateListResponse =
|
|
4163
|
-
templates:
|
|
4263
|
+
var appMailTemplateListResponse = z13.object({
|
|
4264
|
+
templates: z13.array(appMailTemplate).max(4).meta({
|
|
4164
4265
|
description: "The app's custom templates. A kind that does not appear is one using the Fleetless default text \u2014 an ordinary state, not a missing row."
|
|
4165
4266
|
})
|
|
4166
4267
|
});
|
|
4167
|
-
var mailTemplateBody = appMailTemplate.omit({ kind: true, updated_at: true }).extend({ html:
|
|
4268
|
+
var mailTemplateBody = appMailTemplate.omit({ kind: true, updated_at: true }).extend({ html: z13.string().min(1).max(1e5).nullable().optional() });
|
|
4168
4269
|
var putAppMailTemplateRequest = mailTemplateBody.strict();
|
|
4169
4270
|
var mailTemplatePreviewRequest = mailTemplateBody.strict();
|
|
4170
|
-
var mailTemplatePreviewResponse =
|
|
4171
|
-
subject:
|
|
4172
|
-
text:
|
|
4173
|
-
html:
|
|
4271
|
+
var mailTemplatePreviewResponse = z13.object({
|
|
4272
|
+
subject: z13.string().meta({ description: "The rendered subject line." }),
|
|
4273
|
+
text: z13.string().meta({ description: "The rendered plain-text body." }),
|
|
4274
|
+
html: z13.string().nullable().meta({ description: "The rendered HTML body, or `null` when the template is text-only." })
|
|
4174
4275
|
});
|
|
4175
|
-
var mailTemplateProblemDetails =
|
|
4176
|
-
part:
|
|
4177
|
-
message:
|
|
4276
|
+
var mailTemplateProblemDetails = z13.object({
|
|
4277
|
+
part: z13.enum(["subject", "text", "html"]).meta({ description: "Which of the three rendered parts failed." }),
|
|
4278
|
+
message: z13.string().meta({ description: "The renderer's own message \u2014 the unknown variable, or the syntax error and where it is." })
|
|
4178
4279
|
});
|
|
4179
|
-
var mailOutcome =
|
|
4280
|
+
var mailOutcome = z13.object({
|
|
4180
4281
|
mail: mailStatus.meta({
|
|
4181
4282
|
description: "What happened to the mail this call triggered. `sent` means the SMTP server accepted it, not that it was delivered; `not_requested` means none was attempted, because the caller asked for none or there was no link to carry; `not_configured` is an expected state and not a failure; `failed` is the one worth somebody's attention."
|
|
4182
4283
|
})
|
|
4183
4284
|
});
|
|
4184
4285
|
|
|
4185
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4186
|
-
var clientLoginRequest =
|
|
4286
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/client-auth.js
|
|
4287
|
+
var clientLoginRequest = z14.object({
|
|
4187
4288
|
app_identifier: appIdentifier.meta({
|
|
4188
4289
|
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."
|
|
4189
4290
|
}),
|
|
4190
|
-
email:
|
|
4291
|
+
email: z14.email().meta({
|
|
4191
4292
|
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."
|
|
4192
4293
|
}),
|
|
4193
|
-
password:
|
|
4294
|
+
password: z14.string().min(1).meta({
|
|
4194
4295
|
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."
|
|
4195
4296
|
})
|
|
4196
4297
|
});
|
|
4197
|
-
var clientRefreshRequest =
|
|
4198
|
-
refresh_token:
|
|
4298
|
+
var clientRefreshRequest = z14.object({
|
|
4299
|
+
refresh_token: z14.string().min(1).meta({
|
|
4199
4300
|
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."
|
|
4200
4301
|
})
|
|
4201
4302
|
});
|
|
4202
|
-
var clientLogoutRequest =
|
|
4203
|
-
refresh_token:
|
|
4303
|
+
var clientLogoutRequest = z14.object({
|
|
4304
|
+
refresh_token: z14.string().min(1).meta({
|
|
4204
4305
|
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."
|
|
4205
4306
|
})
|
|
4206
4307
|
});
|
|
4207
|
-
var clientLoginCodeRequest =
|
|
4308
|
+
var clientLoginCodeRequest = z14.object({
|
|
4208
4309
|
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." }),
|
|
4209
|
-
email:
|
|
4310
|
+
email: z14.email().meta({
|
|
4210
4311
|
description: "The address to mail the code to, trimmed and compared case-insensitively. `202` whether or not it names an account of this app."
|
|
4211
4312
|
})
|
|
4212
4313
|
}).strict();
|
|
4213
|
-
var clientLoginCodeVerifyRequest =
|
|
4314
|
+
var clientLoginCodeVerifyRequest = z14.object({
|
|
4214
4315
|
app_identifier: appIdentifier.meta({ description: "The app the code was requested for." }),
|
|
4215
|
-
email:
|
|
4316
|
+
email: z14.email().meta({ description: "The address the code was mailed to, as typed when it was requested; trimmed and compared case-insensitively." }),
|
|
4216
4317
|
code: loginCode.meta({ description: "The six digits from the mail, exactly \u2014 leading zeros included, no spaces." })
|
|
4217
4318
|
}).strict();
|
|
4218
|
-
var twoFactorChallenge =
|
|
4219
|
-
status:
|
|
4319
|
+
var twoFactorChallenge = z14.object({
|
|
4320
|
+
status: z14.enum(["two_factor_required", "two_factor_setup_required"]).meta({
|
|
4220
4321
|
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."
|
|
4221
4322
|
}),
|
|
4222
|
-
challenge:
|
|
4323
|
+
challenge: z14.string().min(1).meta({
|
|
4223
4324
|
description: "The handle the next step spends. Valid five minutes; afterwards it answers `410 token_spent` and the sign-in starts over."
|
|
4224
4325
|
})
|
|
4225
4326
|
});
|
|
4226
|
-
var clientSignInResult =
|
|
4227
|
-
var clientTwoFactorVerifyRequest =
|
|
4228
|
-
challenge:
|
|
4327
|
+
var clientSignInResult = z14.union([sessionTokens, twoFactorChallenge]);
|
|
4328
|
+
var clientTwoFactorVerifyRequest = z14.object({
|
|
4329
|
+
challenge: z14.string().min(1).meta({ description: "The challenge the sign-in step answered." }),
|
|
4229
4330
|
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." }),
|
|
4230
4331
|
recovery_code: recoveryCode.optional().meta({ description: "One of the ten recovery codes, `xxxxx-xxxxx`, in either case. Spent by its use." })
|
|
4231
4332
|
}).strict().refine((b) => b.code === void 0 !== (b.recovery_code === void 0), { message: "Send exactly one of code and recovery_code." });
|
|
4232
|
-
var clientTwoFactorSetupRequest =
|
|
4233
|
-
challenge:
|
|
4333
|
+
var clientTwoFactorSetupRequest = z14.object({
|
|
4334
|
+
challenge: z14.string().min(1).optional().meta({
|
|
4234
4335
|
description: "The `two_factor_setup_required` challenge, during sign-in. Absent when the call carries the app user's bearer instead."
|
|
4235
4336
|
})
|
|
4236
4337
|
}).strict();
|
|
4237
|
-
var clientTwoFactorSetupConfirmRequest =
|
|
4238
|
-
challenge:
|
|
4338
|
+
var clientTwoFactorSetupConfirmRequest = z14.object({
|
|
4339
|
+
challenge: z14.string().min(1).optional().meta({ description: "The same challenge as at `setup`, during sign-in; absent with a bearer." }),
|
|
4239
4340
|
code: totpCode.meta({ description: "A code the new authenticator shows now. It proves the secret was copied correctly before anything depends on it." })
|
|
4240
4341
|
}).strict();
|
|
4241
|
-
var clientTwoFactorSetupConfirmResponse =
|
|
4342
|
+
var clientTwoFactorSetupConfirmResponse = z14.object({
|
|
4242
4343
|
recovery_codes: recoveryCodesList.meta({
|
|
4243
4344
|
description: "The ten single-use recovery codes, lowercase, shown once. Any earlier set is void."
|
|
4244
4345
|
}),
|
|
4245
4346
|
session: sessionTokens.meta({ description: "The session the sign-in was waiting for, or a fresh one for the account settings." })
|
|
4246
4347
|
});
|
|
4247
|
-
var clientTwoFactorDisableRequest =
|
|
4348
|
+
var clientTwoFactorDisableRequest = z14.object({
|
|
4248
4349
|
code: totpCode.meta({ description: "A code the authenticator shows now." })
|
|
4249
4350
|
}).strict();
|
|
4250
|
-
var clientRegisterRequest =
|
|
4351
|
+
var clientRegisterRequest = z14.object({
|
|
4251
4352
|
app_identifier: appIdentifier.meta({
|
|
4252
4353
|
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."
|
|
4253
4354
|
}),
|
|
4254
|
-
email:
|
|
4355
|
+
email: z14.email().meta({
|
|
4255
4356
|
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."
|
|
4256
4357
|
}),
|
|
4257
4358
|
password: password.optional().meta({
|
|
4258
4359
|
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."
|
|
4259
4360
|
}),
|
|
4260
|
-
display_name:
|
|
4361
|
+
display_name: z14.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
4261
4362
|
description: "An optional human name for the account. The developer's own UI decides whether to ask for it."
|
|
4262
4363
|
})
|
|
4263
4364
|
}).strict();
|
|
4264
|
-
var clientVerifyEmailRequest =
|
|
4265
|
-
token:
|
|
4365
|
+
var clientVerifyEmailRequest = z14.object({
|
|
4366
|
+
token: z14.string().min(1).meta({
|
|
4266
4367
|
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."
|
|
4267
4368
|
})
|
|
4268
4369
|
}).strict();
|
|
4269
|
-
var clientResendVerificationRequest =
|
|
4370
|
+
var clientResendVerificationRequest = z14.object({
|
|
4270
4371
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
4271
|
-
email:
|
|
4372
|
+
email: z14.email().meta({
|
|
4272
4373
|
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."
|
|
4273
4374
|
})
|
|
4274
4375
|
}).strict();
|
|
4275
|
-
var clientPasswordResetRequest =
|
|
4376
|
+
var clientPasswordResetRequest = z14.object({
|
|
4276
4377
|
app_identifier: appIdentifier.meta({ description: "The app the address belongs to." }),
|
|
4277
|
-
email:
|
|
4378
|
+
email: z14.email().meta({
|
|
4278
4379
|
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."
|
|
4279
4380
|
})
|
|
4280
4381
|
}).strict();
|
|
4281
|
-
var clientPasswordResetConfirmRequest =
|
|
4282
|
-
token:
|
|
4382
|
+
var clientPasswordResetConfirmRequest = z14.object({
|
|
4383
|
+
token: z14.string().min(1).meta({
|
|
4283
4384
|
description: "The opaque token from the reset link, valid one hour. Single-use; unknown, expired and spent all answer `410 token_spent`."
|
|
4284
4385
|
}),
|
|
4285
4386
|
new_password: password.meta({
|
|
4286
4387
|
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."
|
|
4287
4388
|
})
|
|
4288
4389
|
}).strict();
|
|
4289
|
-
var clientAcceptInvitationRequest =
|
|
4290
|
-
token:
|
|
4390
|
+
var clientAcceptInvitationRequest = z14.object({
|
|
4391
|
+
token: z14.string().min(1).meta({
|
|
4291
4392
|
description: "The opaque token from the invitation link, valid seven days. Unknown, expired, revoked and already-accepted all answer `410 token_spent`."
|
|
4292
4393
|
}),
|
|
4293
4394
|
password: password.optional().meta({
|
|
4294
4395
|
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."
|
|
4295
4396
|
}),
|
|
4296
|
-
display_name:
|
|
4397
|
+
display_name: z14.string().min(1).max(APP_USER_DISPLAY_NAME_MAX).nullable().optional().meta({
|
|
4297
4398
|
description: "An optional name, overriding whatever the invitation pre-filled."
|
|
4298
4399
|
})
|
|
4299
4400
|
}).strict();
|
|
4300
4401
|
var CLIENT_OIDC_CALLBACK_PATH = "/api/client/oidc/callback";
|
|
4301
|
-
var clientProviderListQuery =
|
|
4402
|
+
var clientProviderListQuery = z14.object({
|
|
4302
4403
|
app_identifier: appIdentifier.meta({ description: "The app whose enabled providers to list." })
|
|
4303
4404
|
}).meta({ description: "The one parameter of the public provider listing." });
|
|
4304
|
-
var clientProviderListResponse =
|
|
4305
|
-
providers:
|
|
4405
|
+
var clientProviderListResponse = z14.object({
|
|
4406
|
+
providers: z14.array(z14.object({
|
|
4306
4407
|
slug: providerSlug.meta({ description: "The handle to put in the start URL: `GET /api/client/oidc/<slug>/start`." }),
|
|
4307
|
-
name:
|
|
4408
|
+
name: z14.string().meta({ description: "What to write on the button, as the developer configured it." })
|
|
4308
4409
|
})).meta({
|
|
4309
4410
|
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."
|
|
4310
4411
|
}),
|
|
4311
4412
|
sign_in_methods: appSignInMethods.meta({
|
|
4312
4413
|
description: "Which of password and emailed code the app accepts, so its sign-in page draws the right fields without guessing. The same value the developer set; public, like the provider buttons."
|
|
4414
|
+
}),
|
|
4415
|
+
two_factor: appTwoFactorPolicy.meta({
|
|
4416
|
+
description: "The app's off, optional or required two-factor policy; not the caller's enrollment state."
|
|
4313
4417
|
})
|
|
4314
4418
|
});
|
|
4315
|
-
var clientOidcStartQuery =
|
|
4419
|
+
var clientOidcStartQuery = z14.object({
|
|
4316
4420
|
app_identifier: appIdentifier.meta({ description: "The app being signed in to." }),
|
|
4317
|
-
redirect_uri:
|
|
4421
|
+
redirect_uri: z14.url().max(2e3).meta({
|
|
4318
4422
|
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."
|
|
4319
4423
|
}),
|
|
4320
|
-
state:
|
|
4424
|
+
state: z14.string().min(8).max(512).meta({
|
|
4321
4425
|
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."
|
|
4322
4426
|
}),
|
|
4323
|
-
code_challenge:
|
|
4427
|
+
code_challenge: z14.string().regex(/^[A-Za-z0-9_-]{43,128}$/).meta({
|
|
4324
4428
|
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."
|
|
4325
4429
|
})
|
|
4326
4430
|
});
|
|
4327
|
-
var clientOidcCallbackQuery =
|
|
4328
|
-
state:
|
|
4431
|
+
var clientOidcCallbackQuery = z14.object({
|
|
4432
|
+
state: z14.string().min(1).meta({
|
|
4329
4433
|
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."
|
|
4330
4434
|
}),
|
|
4331
|
-
code:
|
|
4435
|
+
code: z14.string().min(1).optional().meta({
|
|
4332
4436
|
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`."
|
|
4333
4437
|
}),
|
|
4334
|
-
error:
|
|
4438
|
+
error: z14.string().min(1).optional().meta({
|
|
4335
4439
|
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."
|
|
4336
4440
|
}),
|
|
4337
|
-
error_description:
|
|
4441
|
+
error_description: z14.string().optional().meta({
|
|
4338
4442
|
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."
|
|
4339
4443
|
})
|
|
4340
4444
|
});
|
|
4341
|
-
var clientOidcExchangeRequest =
|
|
4342
|
-
code:
|
|
4445
|
+
var clientOidcExchangeRequest = z14.object({
|
|
4446
|
+
code: z14.string().min(1).meta({
|
|
4343
4447
|
description: "The one-time code from the callback redirect. Valid 60 seconds, single-use, and bound to the PKCE challenge the start step carried."
|
|
4344
4448
|
}),
|
|
4345
|
-
code_verifier:
|
|
4449
|
+
code_verifier: z14.string().regex(/^[A-Za-z0-9_.~-]{43,128}$/).meta({
|
|
4346
4450
|
description: "The verifier for the challenge sent at `start`. RFC 7636 \xA74.1's alphabet and length."
|
|
4347
4451
|
})
|
|
4348
4452
|
}).strict();
|
|
4349
|
-
var clientOidcErrorCode =
|
|
4453
|
+
var clientOidcErrorCode = z14.enum([
|
|
4350
4454
|
"no_access",
|
|
4351
4455
|
"email_taken",
|
|
4352
4456
|
"email_unverified",
|
|
@@ -4361,89 +4465,89 @@ var clientOidcErrorCode = z13.enum([
|
|
|
4361
4465
|
"quota_exceeded",
|
|
4362
4466
|
"plan_limit"
|
|
4363
4467
|
]);
|
|
4364
|
-
var clientMcpInteraction =
|
|
4365
|
-
id:
|
|
4366
|
-
app_id:
|
|
4367
|
-
client_name:
|
|
4368
|
-
client_name_verified:
|
|
4468
|
+
var clientMcpInteraction = z14.object({
|
|
4469
|
+
id: z14.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." }),
|
|
4470
|
+
app_id: z14.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." }),
|
|
4471
|
+
client_name: z14.string().nullable().meta({ description: "What the MCP client calls itself, or `null` if it named nothing. **Unverified** \u2014 see `client_name_verified`." }),
|
|
4472
|
+
client_name_verified: z14.literal(false).meta({
|
|
4369
4473
|
description: "Always `false`. The client registered itself without authentication and named itself, so it must be rendered as a claim and never as an identity. 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."
|
|
4370
4474
|
}),
|
|
4371
|
-
scopes:
|
|
4372
|
-
already_granted:
|
|
4373
|
-
expires_at:
|
|
4475
|
+
scopes: z14.array(z14.string()).meta({ description: "The scopes the client asked for, to show the person before they approve." }),
|
|
4476
|
+
already_granted: z14.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." }),
|
|
4477
|
+
expires_at: z14.iso.datetime().meta({ description: "When the interaction stops being approvable. Ten minutes from the authorize step; afterwards both approve and deny answer `interaction_expired`." })
|
|
4374
4478
|
});
|
|
4375
|
-
var clientMcpInteractionDecisionResponse =
|
|
4376
|
-
redirect_to:
|
|
4479
|
+
var clientMcpInteractionDecisionResponse = z14.object({
|
|
4480
|
+
redirect_to: z14.url().meta({
|
|
4377
4481
|
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."
|
|
4378
4482
|
})
|
|
4379
4483
|
});
|
|
4380
|
-
var mcpConsentGrant =
|
|
4381
|
-
client_id:
|
|
4484
|
+
var mcpConsentGrant = z14.object({
|
|
4485
|
+
client_id: z14.string().meta({
|
|
4382
4486
|
description: "The MCP client this consent is for, as its dynamic registration was issued. It is the value the withdrawal routes take in their path, and it is the only stable handle on a client \u2014 the name beside it is not one."
|
|
4383
4487
|
}),
|
|
4384
|
-
client_name:
|
|
4488
|
+
client_name: z14.string().nullable().meta({
|
|
4385
4489
|
description: "What the client calls itself, or `null` once its registration is gone. **Unverified** \u2014 see `client_name_verified`."
|
|
4386
4490
|
}),
|
|
4387
|
-
client_name_verified:
|
|
4491
|
+
client_name_verified: z14.literal(false).meta({
|
|
4388
4492
|
description: "Always `false`. The client registered itself without authentication and named itself, so it must be rendered as a claim and never as an identity. 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."
|
|
4389
4493
|
}),
|
|
4390
|
-
granted_at:
|
|
4494
|
+
granted_at: z14.iso.datetime().meta({
|
|
4391
4495
|
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."
|
|
4392
4496
|
})
|
|
4393
4497
|
});
|
|
4394
|
-
var mcpConsentGrantListResponse =
|
|
4395
|
-
grants:
|
|
4498
|
+
var mcpConsentGrantListResponse = z14.object({
|
|
4499
|
+
grants: z14.array(mcpConsentGrant).meta({
|
|
4396
4500
|
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."
|
|
4397
4501
|
})
|
|
4398
4502
|
});
|
|
4399
|
-
var clientIdentity =
|
|
4400
|
-
kind:
|
|
4503
|
+
var clientIdentity = z14.object({
|
|
4504
|
+
kind: z14.enum(["developer", "app_user", "server_key"]).meta({
|
|
4401
4505
|
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."
|
|
4402
4506
|
}),
|
|
4403
|
-
developer_id:
|
|
4507
|
+
developer_id: z14.uuid().nullable().meta({
|
|
4404
4508
|
description: "The Fleetless user behind this session, or `null` when `kind` is not `developer`."
|
|
4405
4509
|
}),
|
|
4406
|
-
app_user_id:
|
|
4510
|
+
app_user_id: z14.uuid().nullable().meta({
|
|
4407
4511
|
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."
|
|
4408
4512
|
}),
|
|
4409
|
-
server_key_id:
|
|
4513
|
+
server_key_id: z14.uuid().nullable().meta({
|
|
4410
4514
|
description: "The server key this session was authenticated with, or `null` when `kind` is not `server_key`."
|
|
4411
4515
|
}),
|
|
4412
|
-
app_id:
|
|
4516
|
+
app_id: z14.uuid().nullable().meta({
|
|
4413
4517
|
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."
|
|
4414
4518
|
}),
|
|
4415
|
-
role_id:
|
|
4519
|
+
role_id: z14.uuid().nullable().meta({
|
|
4416
4520
|
description: "The role that decides what this caller may reach, and `null` for a developer. Roles are the only visibility filter: what a role does not grant does not exist for that user."
|
|
4417
4521
|
}),
|
|
4418
|
-
email:
|
|
4522
|
+
email: z14.email().nullable().meta({
|
|
4419
4523
|
description: "The address of the Fleetless user or app user behind this session, and `null` for a server key, which is not a person."
|
|
4420
4524
|
}),
|
|
4421
|
-
two_factor_enabled:
|
|
4525
|
+
two_factor_enabled: z14.boolean().nullable().meta({
|
|
4422
4526
|
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`."
|
|
4423
4527
|
})
|
|
4424
4528
|
});
|
|
4425
4529
|
|
|
4426
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4427
|
-
var clientAuth =
|
|
4428
|
-
type:
|
|
4429
|
-
token:
|
|
4530
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/realtime.js
|
|
4531
|
+
var clientAuth = z15.object({
|
|
4532
|
+
type: z15.literal("auth"),
|
|
4533
|
+
token: z15.string().min(1)
|
|
4430
4534
|
});
|
|
4431
|
-
var authOk =
|
|
4432
|
-
type:
|
|
4535
|
+
var authOk = z15.object({
|
|
4536
|
+
type: z15.literal("auth_ok"),
|
|
4433
4537
|
identity: clientIdentity
|
|
4434
4538
|
});
|
|
4435
|
-
var authError =
|
|
4436
|
-
type:
|
|
4437
|
-
code:
|
|
4438
|
-
message:
|
|
4539
|
+
var authError = z15.object({
|
|
4540
|
+
type: z15.literal("auth_error"),
|
|
4541
|
+
code: z15.string().min(1),
|
|
4542
|
+
message: z15.string().min(1)
|
|
4439
4543
|
});
|
|
4440
|
-
var clientInvoke =
|
|
4441
|
-
type:
|
|
4442
|
-
request_id:
|
|
4443
|
-
robot_id:
|
|
4544
|
+
var clientInvoke = z15.object({
|
|
4545
|
+
type: z15.literal("invoke"),
|
|
4546
|
+
request_id: z15.string().min(1).max(64),
|
|
4547
|
+
robot_id: z15.uuid(),
|
|
4444
4548
|
slug,
|
|
4445
4549
|
/** Parameters by field path, validated against the configuration's rules. */
|
|
4446
|
-
params:
|
|
4550
|
+
params: z15.record(z15.string(), z15.unknown()),
|
|
4447
4551
|
/**
|
|
4448
4552
|
* How long this one call is worth waiting for — the same field, meaning and
|
|
4449
4553
|
* cap as `invokeRequest.patience_ms`; absent means `DEFAULT_PATIENCE_MS`.
|
|
@@ -4453,12 +4557,12 @@ var clientInvoke = z14.object({
|
|
|
4453
4557
|
* unreachable to every caller that invokes over the realtime channel, while
|
|
4454
4558
|
* still appearing in the documentation.
|
|
4455
4559
|
*/
|
|
4456
|
-
patience_ms:
|
|
4560
|
+
patience_ms: z15.number().int().min(MIN_PATIENCE_MS).max(MAX_PATIENCE_MS).optional()
|
|
4457
4561
|
});
|
|
4458
|
-
var clientCancel =
|
|
4459
|
-
type:
|
|
4460
|
-
request_id:
|
|
4461
|
-
robot_id:
|
|
4562
|
+
var clientCancel = z15.object({
|
|
4563
|
+
type: z15.literal("cancel"),
|
|
4564
|
+
request_id: z15.string().min(1).max(64),
|
|
4565
|
+
robot_id: z15.uuid(),
|
|
4462
4566
|
/** Which slug — required, and the coarse address of a cancel. */
|
|
4463
4567
|
slug,
|
|
4464
4568
|
/**
|
|
@@ -4476,19 +4580,19 @@ var clientCancel = z14.object({
|
|
|
4476
4580
|
* back to the slug. Falling back would be the platform deciding that the
|
|
4477
4581
|
* caller did not really mean the id they typed.
|
|
4478
4582
|
*/
|
|
4479
|
-
job_id:
|
|
4583
|
+
job_id: z15.uuid().nullable()
|
|
4480
4584
|
});
|
|
4481
|
-
var clientPublish =
|
|
4482
|
-
type:
|
|
4483
|
-
request_id:
|
|
4484
|
-
robot_id:
|
|
4585
|
+
var clientPublish = z15.object({
|
|
4586
|
+
type: z15.literal("publish"),
|
|
4587
|
+
request_id: z15.string().min(1).max(64),
|
|
4588
|
+
robot_id: z15.uuid(),
|
|
4485
4589
|
slug,
|
|
4486
|
-
message:
|
|
4590
|
+
message: z15.record(z15.string(), z15.unknown())
|
|
4487
4591
|
});
|
|
4488
|
-
var commandResult =
|
|
4489
|
-
type:
|
|
4490
|
-
request_id:
|
|
4491
|
-
ok:
|
|
4592
|
+
var commandResult = z15.object({
|
|
4593
|
+
type: z15.literal("command_result"),
|
|
4594
|
+
request_id: z15.string().min(1).max(64),
|
|
4595
|
+
ok: z15.boolean(),
|
|
4492
4596
|
/**
|
|
4493
4597
|
* The job this reply is *about* — which is not always the caller's own.
|
|
4494
4598
|
*
|
|
@@ -4512,9 +4616,9 @@ var commandResult = z14.object({
|
|
|
4512
4616
|
* later. Returning the kind lets a client refuse its own mistake at once,
|
|
4513
4617
|
* instead of reporting it as the machine's.
|
|
4514
4618
|
*/
|
|
4515
|
-
kind:
|
|
4516
|
-
code:
|
|
4517
|
-
message:
|
|
4619
|
+
kind: z15.enum(["datapoint", "action", "service", "publisher", "camera"]).nullable(),
|
|
4620
|
+
code: z15.string().nullable(),
|
|
4621
|
+
message: z15.string().nullable(),
|
|
4518
4622
|
/**
|
|
4519
4623
|
* The same payload the REST envelope carries in `apiError.details` — for
|
|
4520
4624
|
* `parameter_invalid`, a `parameterInvalidDetails`.
|
|
@@ -4525,16 +4629,16 @@ var commandResult = z14.object({
|
|
|
4525
4629
|
* socket. A client cannot bind an error to the input that caused it from a
|
|
4526
4630
|
* code alone, which is the entire point of the flat parameter shape.
|
|
4527
4631
|
*/
|
|
4528
|
-
details:
|
|
4632
|
+
details: z15.unknown().optional()
|
|
4529
4633
|
});
|
|
4530
|
-
var errorFrame =
|
|
4531
|
-
type:
|
|
4532
|
-
code:
|
|
4533
|
-
message:
|
|
4634
|
+
var errorFrame = z15.object({
|
|
4635
|
+
type: z15.literal("error"),
|
|
4636
|
+
code: z15.string().min(1),
|
|
4637
|
+
message: z15.string().min(1)
|
|
4534
4638
|
});
|
|
4535
|
-
var clientSubscribe =
|
|
4536
|
-
type:
|
|
4537
|
-
robot_id:
|
|
4639
|
+
var clientSubscribe = z15.object({
|
|
4640
|
+
type: z15.literal("subscribe"),
|
|
4641
|
+
robot_id: z15.uuid(),
|
|
4538
4642
|
slug,
|
|
4539
4643
|
/**
|
|
4540
4644
|
* What the subscriber expects, and how it wants it.
|
|
@@ -4554,29 +4658,29 @@ var clientSubscribe = z14.object({
|
|
|
4554
4658
|
* request was the same mistake as the silent wrong-verb subscribe this
|
|
4555
4659
|
* field was added to fix.
|
|
4556
4660
|
*/
|
|
4557
|
-
kind:
|
|
4558
|
-
options:
|
|
4661
|
+
kind: z15.enum(["datapoint", "action", "service", "publisher", "camera"]).optional(),
|
|
4662
|
+
options: z15.record(z15.string(), z15.unknown()).optional()
|
|
4559
4663
|
});
|
|
4560
|
-
var clientUnsubscribe =
|
|
4561
|
-
type:
|
|
4562
|
-
robot_id:
|
|
4664
|
+
var clientUnsubscribe = z15.object({
|
|
4665
|
+
type: z15.literal("unsubscribe"),
|
|
4666
|
+
robot_id: z15.uuid(),
|
|
4563
4667
|
slug
|
|
4564
4668
|
});
|
|
4565
|
-
var subscribeError =
|
|
4566
|
-
type:
|
|
4567
|
-
robot_id:
|
|
4568
|
-
slug:
|
|
4569
|
-
code:
|
|
4570
|
-
message:
|
|
4669
|
+
var subscribeError = z15.object({
|
|
4670
|
+
type: z15.literal("subscribe_error"),
|
|
4671
|
+
robot_id: z15.string(),
|
|
4672
|
+
slug: z15.string(),
|
|
4673
|
+
code: z15.string().min(1),
|
|
4674
|
+
message: z15.string().min(1)
|
|
4571
4675
|
});
|
|
4572
|
-
var datapointEvent =
|
|
4573
|
-
type:
|
|
4574
|
-
robot_id:
|
|
4676
|
+
var datapointEvent = z15.object({
|
|
4677
|
+
type: z15.literal("datapoint"),
|
|
4678
|
+
robot_id: z15.uuid(),
|
|
4575
4679
|
slug,
|
|
4576
|
-
value:
|
|
4577
|
-
timestamp_ms:
|
|
4680
|
+
value: z15.unknown(),
|
|
4681
|
+
timestamp_ms: z15.number().int().nonnegative()
|
|
4578
4682
|
});
|
|
4579
|
-
var liveSessionEndReason =
|
|
4683
|
+
var liveSessionEndReason = z15.enum([
|
|
4580
4684
|
/** Another holder of this camera released it — another tab, or another client. */
|
|
4581
4685
|
"released_by_peer",
|
|
4582
4686
|
/** The robot's configuration was published and this camera changed with it. */
|
|
@@ -4605,12 +4709,12 @@ var liveSessionEndReason = z14.enum([
|
|
|
4605
4709
|
*/
|
|
4606
4710
|
"unknown"
|
|
4607
4711
|
]);
|
|
4608
|
-
var liveSessionEvent =
|
|
4609
|
-
type:
|
|
4610
|
-
robot_id:
|
|
4712
|
+
var liveSessionEvent = z15.object({
|
|
4713
|
+
type: z15.literal("live_session"),
|
|
4714
|
+
robot_id: z15.uuid(),
|
|
4611
4715
|
slug,
|
|
4612
|
-
session_id:
|
|
4613
|
-
state:
|
|
4716
|
+
session_id: z15.uuid(),
|
|
4717
|
+
state: z15.literal("ended"),
|
|
4614
4718
|
reason: liveSessionEndReason,
|
|
4615
4719
|
/**
|
|
4616
4720
|
* **Classified text the cloud produced, never text the robot sent.**
|
|
@@ -4625,47 +4729,47 @@ var liveSessionEvent = z14.object({
|
|
|
4625
4729
|
* code with fixed text, the way camera health already does it — not as
|
|
4626
4730
|
* forwarded foreign text on a channel a client reads.
|
|
4627
4731
|
*/
|
|
4628
|
-
detail:
|
|
4732
|
+
detail: z15.string().max(200).nullable(),
|
|
4629
4733
|
/** When it ended — not when this frame was sent. Same reasoning as `changed_at_ms`. */
|
|
4630
|
-
ended_at_ms:
|
|
4631
|
-
});
|
|
4632
|
-
var resourceHealthCleared =
|
|
4633
|
-
type:
|
|
4634
|
-
robot_id:
|
|
4635
|
-
kind:
|
|
4636
|
-
ref:
|
|
4637
|
-
facet:
|
|
4638
|
-
cleared_at_ms:
|
|
4639
|
-
});
|
|
4640
|
-
var resourceHealthEvent =
|
|
4641
|
-
type:
|
|
4642
|
-
robot_id:
|
|
4643
|
-
kind:
|
|
4644
|
-
ref:
|
|
4734
|
+
ended_at_ms: z15.number().int().nonnegative()
|
|
4735
|
+
});
|
|
4736
|
+
var resourceHealthCleared = z15.object({
|
|
4737
|
+
type: z15.literal("resource_health_cleared"),
|
|
4738
|
+
robot_id: z15.uuid(),
|
|
4739
|
+
kind: z15.enum(["camera"]),
|
|
4740
|
+
ref: z15.string().min(1).max(64),
|
|
4741
|
+
facet: z15.enum(["source", "publish"]),
|
|
4742
|
+
cleared_at_ms: z15.number().int().nonnegative()
|
|
4743
|
+
});
|
|
4744
|
+
var resourceHealthEvent = z15.object({
|
|
4745
|
+
type: z15.literal("resource_health"),
|
|
4746
|
+
robot_id: z15.uuid(),
|
|
4747
|
+
kind: z15.enum(["camera"]),
|
|
4748
|
+
ref: z15.string().min(1).max(64),
|
|
4645
4749
|
/** Which of the two questions this entry answers — see `resourceHealthState.facet`. */
|
|
4646
|
-
facet:
|
|
4647
|
-
state:
|
|
4648
|
-
reason:
|
|
4649
|
-
changed_at_ms:
|
|
4750
|
+
facet: z15.enum(["source", "publish"]),
|
|
4751
|
+
state: z15.enum(RESOURCE_HEALTH_STATES),
|
|
4752
|
+
reason: z15.string().max(200).nullable(),
|
|
4753
|
+
changed_at_ms: z15.number().int().nonnegative()
|
|
4650
4754
|
});
|
|
4651
4755
|
var ORG_EVENT_BUFFER_SIZE = 200;
|
|
4652
|
-
var orgEventKind =
|
|
4653
|
-
var orgEventSeverity =
|
|
4654
|
-
var orgEvent =
|
|
4655
|
-
type:
|
|
4756
|
+
var orgEventKind = z15.enum(["datapoint", "health", "job", "bridge", "audit", "alert"]);
|
|
4757
|
+
var orgEventSeverity = z15.enum(["info", "warning", "error"]);
|
|
4758
|
+
var orgEvent = z15.object({
|
|
4759
|
+
type: z15.literal("org_event"),
|
|
4656
4760
|
/**
|
|
4657
4761
|
* **Per org, per process.** Like `job.seq` and unlike `job_runs.seq`, which
|
|
4658
4762
|
* is a postgres `bigserial` and durable. All three say which they are,
|
|
4659
4763
|
* because anyone who confuses them will confuse them in both directions.
|
|
4660
4764
|
*/
|
|
4661
|
-
seq:
|
|
4662
|
-
at:
|
|
4765
|
+
seq: z15.number().int().positive(),
|
|
4766
|
+
at: z15.iso.datetime(),
|
|
4663
4767
|
kind: orgEventKind,
|
|
4664
4768
|
severity: orgEventSeverity,
|
|
4665
4769
|
/** `null` for an org-level event — an invitation, a quota change — which belongs to no robot. */
|
|
4666
|
-
robot_id:
|
|
4770
|
+
robot_id: z15.uuid().nullable(),
|
|
4667
4771
|
/** What the line is about: a slug, a camera, an actor's email. */
|
|
4668
|
-
subject:
|
|
4772
|
+
subject: z15.string().min(1).max(200),
|
|
4669
4773
|
/**
|
|
4670
4774
|
* Kind-specific, and **capped at `ORG_EVENT_DETAIL_MAX_BYTES`** — above it
|
|
4671
4775
|
* the producer substitutes `{ omitted: 'too_large', bytes }`. Truncated,
|
|
@@ -4674,13 +4778,13 @@ var orgEvent = z14.object({
|
|
|
4674
4778
|
* Never a pre-formatted line: the reader decides language, number format
|
|
4675
4779
|
* and truncation, so changing how a line reads is not a cloud deploy.
|
|
4676
4780
|
*/
|
|
4677
|
-
detail:
|
|
4781
|
+
detail: z15.unknown().nullable()
|
|
4678
4782
|
}).strict();
|
|
4679
|
-
var orgEventSubscribe =
|
|
4680
|
-
var orgEventUnsubscribe =
|
|
4681
|
-
var orgEventReplay =
|
|
4682
|
-
type:
|
|
4683
|
-
events:
|
|
4783
|
+
var orgEventSubscribe = z15.object({ type: z15.literal("org_event_subscribe") }).strict();
|
|
4784
|
+
var orgEventUnsubscribe = z15.object({ type: z15.literal("org_event_unsubscribe") }).strict();
|
|
4785
|
+
var orgEventReplay = z15.object({
|
|
4786
|
+
type: z15.literal("org_event_replay"),
|
|
4787
|
+
events: z15.array(orgEvent).max(ORG_EVENT_BUFFER_SIZE),
|
|
4684
4788
|
/**
|
|
4685
4789
|
* **`false` means three different things, on purpose**: the buffer was
|
|
4686
4790
|
* already full, the cloud restarted, or this org's buffer had expired. All
|
|
@@ -4688,10 +4792,10 @@ var orgEventReplay = z14.object({
|
|
|
4688
4792
|
* line* — and a field separating them would claim a distinction nobody
|
|
4689
4793
|
* would act on differently.
|
|
4690
4794
|
*/
|
|
4691
|
-
complete:
|
|
4795
|
+
complete: z15.boolean()
|
|
4692
4796
|
}).strict();
|
|
4693
|
-
var orgEventDropped =
|
|
4694
|
-
type:
|
|
4797
|
+
var orgEventDropped = z15.object({
|
|
4798
|
+
type: z15.literal("org_event_dropped"),
|
|
4695
4799
|
/**
|
|
4696
4800
|
* **An epoch instant in milliseconds (`Date.now()`), not a duration.**
|
|
4697
4801
|
* The moment this socket last reported a drop — or the moment it
|
|
@@ -4702,29 +4806,29 @@ var orgEventDropped = z14.object({
|
|
|
4702
4806
|
* it as "milliseconds ago" renders a drop that happened seconds ago as
|
|
4703
4807
|
* having happened in 1970.
|
|
4704
4808
|
*/
|
|
4705
|
-
since_ms:
|
|
4809
|
+
since_ms: z15.number().int().nonnegative(),
|
|
4706
4810
|
/** Always at least one — a frame reporting nothing lost is noise on a channel built to be quiet. */
|
|
4707
|
-
dropped:
|
|
4811
|
+
dropped: z15.number().int().positive()
|
|
4708
4812
|
}).strict();
|
|
4709
4813
|
|
|
4710
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4711
|
-
import { z as
|
|
4814
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/feedback.js
|
|
4815
|
+
import { z as z16 } from "zod";
|
|
4712
4816
|
var FEEDBACK_KINDS = ["idea", "problem", "question", "other"];
|
|
4713
|
-
var feedbackKind =
|
|
4817
|
+
var feedbackKind = z16.enum(FEEDBACK_KINDS);
|
|
4714
4818
|
var FEEDBACK_MESSAGE_MAX = 5e3;
|
|
4715
|
-
var feedbackRequest =
|
|
4819
|
+
var feedbackRequest = z16.object({
|
|
4716
4820
|
kind: feedbackKind.meta({
|
|
4717
4821
|
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."
|
|
4718
4822
|
}),
|
|
4719
|
-
message:
|
|
4823
|
+
message: z16.string().trim().min(1).max(FEEDBACK_MESSAGE_MAX).meta({
|
|
4720
4824
|
description: "What the developer wrote, trimmed. At most 5000 characters; a message that is only whitespace is refused."
|
|
4721
4825
|
}),
|
|
4722
|
-
page:
|
|
4826
|
+
page: z16.string().startsWith("/").max(512).meta({
|
|
4723
4827
|
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."
|
|
4724
4828
|
})
|
|
4725
4829
|
}).strict();
|
|
4726
|
-
var feedbackResponse =
|
|
4727
|
-
id:
|
|
4830
|
+
var feedbackResponse = z16.object({
|
|
4831
|
+
id: z16.uuid().meta({
|
|
4728
4832
|
description: "The stored message. It exists whatever `mail` says."
|
|
4729
4833
|
}),
|
|
4730
4834
|
mail: mailStatus.meta({
|
|
@@ -4732,34 +4836,110 @@ var feedbackResponse = z15.object({
|
|
|
4732
4836
|
})
|
|
4733
4837
|
}).strict();
|
|
4734
4838
|
|
|
4735
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4736
|
-
import { z as
|
|
4737
|
-
var
|
|
4839
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/support.js
|
|
4840
|
+
import { z as z17 } from "zod";
|
|
4841
|
+
var supportSessionInfo = z17.object({
|
|
4842
|
+
session_id: z17.uuid().meta({
|
|
4843
|
+
description: "The support session this token or response describes. Stable for the life of the session."
|
|
4844
|
+
}),
|
|
4845
|
+
mode: z17.enum(["read", "edit"]).meta({
|
|
4846
|
+
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."
|
|
4847
|
+
}),
|
|
4848
|
+
operator_name: z17.string().min(1).max(200).meta({
|
|
4849
|
+
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."
|
|
4850
|
+
}),
|
|
4851
|
+
expires_at: z17.iso.datetime().meta({
|
|
4852
|
+
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."
|
|
4853
|
+
})
|
|
4854
|
+
}).strict();
|
|
4855
|
+
var supportTokenRequest = z17.object({
|
|
4856
|
+
grant: z17.string().regex(/^[A-Za-z0-9_-]{43}$/).meta({
|
|
4857
|
+
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."
|
|
4858
|
+
}),
|
|
4859
|
+
code_verifier: z17.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
4860
|
+
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."
|
|
4861
|
+
})
|
|
4862
|
+
}).strict();
|
|
4863
|
+
var supportTokenResponse = z17.object({
|
|
4864
|
+
access_token: z17.string().min(1).meta({
|
|
4865
|
+
description: "The token to send as `Authorization: Bearer <token>`. Short-lived: read `expires_in`, never assume a lifetime."
|
|
4866
|
+
}),
|
|
4867
|
+
token_type: z17.literal("Bearer").meta({
|
|
4868
|
+
description: "`Bearer`, the same spelling every other session token on this wire uses."
|
|
4869
|
+
}),
|
|
4870
|
+
expires_in: z17.number().int().min(1).max(3600).meta({
|
|
4871
|
+
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."
|
|
4872
|
+
}),
|
|
4873
|
+
org_id: z17.uuid().meta({
|
|
4874
|
+
description: "The organisation this session was scoped to when the grant was minted."
|
|
4875
|
+
}),
|
|
4876
|
+
support: supportSessionInfo.meta({
|
|
4877
|
+
description: "The session as it stands at the moment of exchange: freshly started, in `read` mode."
|
|
4878
|
+
})
|
|
4879
|
+
}).strict();
|
|
4880
|
+
var supportRenewFailRequest = z17.object({
|
|
4881
|
+
flow_id: z17.uuid().meta({ description: "The pending Cloud renewal flow created with the original support bearer." }),
|
|
4882
|
+
code_verifier: z17.string().regex(/^[A-Za-z0-9._~-]{43,128}$/).meta({
|
|
4883
|
+
description: "The server-held RFC 7636 verifier matching the flow's S256 challenge; never sent to the browser."
|
|
4884
|
+
}),
|
|
4885
|
+
reason: z17.literal("authority_failed").meta({ description: "A fixed category; browser and IdP error text is not forwarded." })
|
|
4886
|
+
}).strict();
|
|
4887
|
+
var supportRenewFailRefusal = z17.union([
|
|
4888
|
+
z17.object({ code: z17.literal("validation_error"), message: z17.string().min(1), details: z17.object({ rule: z17.literal("invalid_flow") }).strict() }).strict(),
|
|
4889
|
+
z17.object({ code: z17.literal("unauthorized"), message: z17.string().min(1), details: z17.object({ rule: z17.literal("invalid_authority") }).strict() }).strict(),
|
|
4890
|
+
z17.object({ code: z17.literal("not_found"), message: z17.string().min(1), details: z17.object({ rule: z17.enum(["invalid_flow", "identity_mismatch"]) }).strict() }).strict(),
|
|
4891
|
+
z17.object({ code: z17.literal("target_state_conflict"), message: z17.string().min(1), details: z17.object({ rule: z17.enum(["expired", "replayed", "session_inactive", "stale_generation"]) }).strict() }).strict()
|
|
4892
|
+
]);
|
|
4893
|
+
var authMeSupportResponse = authMeResponse.extend({ support: supportSessionInfo.optional() });
|
|
4894
|
+
|
|
4895
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/client-robots.js
|
|
4896
|
+
import { z as z18 } from "zod";
|
|
4897
|
+
var clientRobotListItem = z18.object({
|
|
4738
4898
|
...robot.shape,
|
|
4739
4899
|
bridge_state: bridgeState.meta({
|
|
4740
4900
|
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."
|
|
4741
4901
|
}),
|
|
4742
|
-
published_version:
|
|
4902
|
+
published_version: z18.number().int().positive().nullable().meta({
|
|
4743
4903
|
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.'
|
|
4744
4904
|
})
|
|
4745
4905
|
});
|
|
4746
|
-
var clientRobotListResponse =
|
|
4747
|
-
robots:
|
|
4906
|
+
var clientRobotListResponse = z18.object({
|
|
4907
|
+
robots: z18.array(clientRobotListItem).meta({
|
|
4748
4908
|
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."
|
|
4749
4909
|
})
|
|
4750
4910
|
});
|
|
4751
4911
|
|
|
4752
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4753
|
-
import { z as
|
|
4754
|
-
var
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
});
|
|
4759
|
-
var
|
|
4760
|
-
id:
|
|
4761
|
-
|
|
4762
|
-
|
|
4912
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/legal-acceptances.js
|
|
4913
|
+
import { z as z19 } from "zod";
|
|
4914
|
+
var legalAcceptanceCursor = z19.string().min(1).max(512).regex(/^[A-Za-z0-9_-]+$/);
|
|
4915
|
+
var legalAcceptanceListQuery = z19.object({
|
|
4916
|
+
limit: z19.union([z19.string().regex(/^(?:0{0,2}[1-9]|0?[1-9][0-9]|100)$/), z19.number().int().min(1).max(100)]).transform(Number).pipe(z19.number().int().min(1).max(100)).optional(),
|
|
4917
|
+
cursor: legalAcceptanceCursor.optional()
|
|
4918
|
+
}).strict();
|
|
4919
|
+
var legalAcceptanceVersionRow = z19.object({
|
|
4920
|
+
id: z19.uuid(),
|
|
4921
|
+
context: z19.enum(["registration", "invitation", "order", "existing_org"]),
|
|
4922
|
+
accepted_at: z19.iso.datetime({ precision: 6 }),
|
|
4923
|
+
text_id: z19.string().min(1).max(80).regex(/\S/),
|
|
4924
|
+
terms: legalDocumentReference,
|
|
4925
|
+
dpa: legalDocumentReference.nullable()
|
|
4926
|
+
}).strict();
|
|
4927
|
+
var legalAcceptanceListResponse = z19.object({
|
|
4928
|
+
acceptances: z19.array(legalAcceptanceVersionRow),
|
|
4929
|
+
next_cursor: legalAcceptanceCursor.nullable()
|
|
4930
|
+
}).strict();
|
|
4931
|
+
|
|
4932
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/audit.js
|
|
4933
|
+
import { z as z20 } from "zod";
|
|
4934
|
+
var auditActor = z20.object({
|
|
4935
|
+
kind: z20.enum(["developer", "end_user", "app_user", "server_key", "bridge", "fleetless"]),
|
|
4936
|
+
id: z20.uuid(),
|
|
4937
|
+
label: z20.string().min(1).max(200)
|
|
4938
|
+
});
|
|
4939
|
+
var auditEvent = z20.object({
|
|
4940
|
+
id: z20.uuid(),
|
|
4941
|
+
org_id: z20.uuid(),
|
|
4942
|
+
at: z20.iso.datetime(),
|
|
4763
4943
|
/**
|
|
4764
4944
|
* A monotonic counter, ascending in write order, unique across the log.
|
|
4765
4945
|
*
|
|
@@ -4778,18 +4958,18 @@ var auditEvent = z17.object({
|
|
|
4778
4958
|
* Required, not optional: an event without a sequence cannot be ordered
|
|
4779
4959
|
* against one that has it, and a log with two orderings has none.
|
|
4780
4960
|
*/
|
|
4781
|
-
seq:
|
|
4961
|
+
seq: z20.number().int().positive(),
|
|
4782
4962
|
actor: auditActor,
|
|
4783
4963
|
/** Stable dotted name, e.g. `app_user.login`, `config.published`. */
|
|
4784
|
-
action:
|
|
4964
|
+
action: z20.string().min(1).max(80),
|
|
4785
4965
|
/**
|
|
4786
4966
|
* What the action was about, if anything — a robot, an app, a user. Free
|
|
4787
4967
|
* of ids the console cannot resolve: carry the label with it.
|
|
4788
4968
|
*/
|
|
4789
|
-
target:
|
|
4790
|
-
kind:
|
|
4791
|
-
id:
|
|
4792
|
-
label:
|
|
4969
|
+
target: z20.object({
|
|
4970
|
+
kind: z20.string().min(1).max(40),
|
|
4971
|
+
id: z20.string().min(1),
|
|
4972
|
+
label: z20.string().min(1).max(200)
|
|
4793
4973
|
}).nullable(),
|
|
4794
4974
|
/**
|
|
4795
4975
|
* Action-specific extras.
|
|
@@ -4803,10 +4983,10 @@ var auditEvent = z17.object({
|
|
|
4803
4983
|
* So: never credentials, never tokens. That is a rule, not a guarantee the
|
|
4804
4984
|
* schema enforces.
|
|
4805
4985
|
*/
|
|
4806
|
-
details:
|
|
4986
|
+
details: z20.record(z20.string(), z20.unknown()).nullable()
|
|
4807
4987
|
});
|
|
4808
4988
|
var auditTimestampMs = wireTimestampMs;
|
|
4809
|
-
var auditQuery =
|
|
4989
|
+
var auditQuery = z20.object({
|
|
4810
4990
|
/** Only events with a smaller `seq` — the next, older page. */
|
|
4811
4991
|
before_seq: wireSeqCursor.optional(),
|
|
4812
4992
|
/**
|
|
@@ -4815,9 +4995,9 @@ var auditQuery = z17.object({
|
|
|
4815
4995
|
* coercion's result in either `io` direction, so the artifact would describe
|
|
4816
4996
|
* a shape a query string can never carry.
|
|
4817
4997
|
*/
|
|
4818
|
-
limit:
|
|
4998
|
+
limit: z20.union([z20.string().regex(/^\d{1,4}$/), z20.number().int()]).transform((v) => Number(v)).pipe(z20.number().int().positive().max(500)).optional(),
|
|
4819
4999
|
/** Exact action name, e.g. `config.published`. No prefix matching: a filter that matches more than it says is not one. */
|
|
4820
|
-
action:
|
|
5000
|
+
action: z20.string().min(1).max(80).optional(),
|
|
4821
5001
|
/**
|
|
4822
5002
|
* Everything under a dotted prefix, e.g. `server_key.` for all three
|
|
4823
5003
|
* server-key actions.
|
|
@@ -4834,7 +5014,7 @@ var auditQuery = z17.object({
|
|
|
4834
5014
|
* happily. The cloud is the only enforcement point — the same residual
|
|
4835
5015
|
* `orgLatencyQuery` and `orgUsageQuery` already name.
|
|
4836
5016
|
*/
|
|
4837
|
-
action_prefix:
|
|
5017
|
+
action_prefix: z20.string().min(1).max(80).optional(),
|
|
4838
5018
|
/**
|
|
4839
5019
|
* Only events by this actor.
|
|
4840
5020
|
*
|
|
@@ -4846,9 +5026,9 @@ var auditQuery = z17.object({
|
|
|
4846
5026
|
* Not an injection question — the query is parameterised either way. It is a
|
|
4847
5027
|
* **500 where a 400 belongs**, and a 500 is the answer that explains nothing.
|
|
4848
5028
|
*/
|
|
4849
|
-
actor_id:
|
|
5029
|
+
actor_id: z20.uuid().optional(),
|
|
4850
5030
|
/** Only events about this kind of target, e.g. `robot`. */
|
|
4851
|
-
target_kind:
|
|
5031
|
+
target_kind: z20.string().min(1).max(40).optional(),
|
|
4852
5032
|
/**
|
|
4853
5033
|
* Only events about this target — and, for a robot, also the events that
|
|
4854
5034
|
* name it in `details.robot_id`, so a robot's log includes what was
|
|
@@ -4858,7 +5038,7 @@ var auditQuery = z17.object({
|
|
|
4858
5038
|
* string in this contract and text in the cloud's table, so a uuid rule
|
|
4859
5039
|
* here would refuse ids the log can hold, and no value can fail a cast.
|
|
4860
5040
|
*/
|
|
4861
|
-
target_id:
|
|
5041
|
+
target_id: z20.string().min(1).max(200).optional().meta({
|
|
4862
5042
|
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."
|
|
4863
5043
|
}),
|
|
4864
5044
|
/**
|
|
@@ -4876,8 +5056,8 @@ var auditQuery = z17.object({
|
|
|
4876
5056
|
message: "action and action_prefix cannot be combined",
|
|
4877
5057
|
path: ["action_prefix"]
|
|
4878
5058
|
});
|
|
4879
|
-
var auditListResponse =
|
|
4880
|
-
events:
|
|
5059
|
+
var auditListResponse = z20.object({
|
|
5060
|
+
events: z20.array(auditEvent),
|
|
4881
5061
|
/**
|
|
4882
5062
|
* The `seq` a caller sends as `before_seq` to keep reading — or `null` when
|
|
4883
5063
|
* there is nothing further.
|
|
@@ -4888,16 +5068,28 @@ var auditListResponse = z17.object({
|
|
|
4888
5068
|
* not mean *no more* here. The same distinction `historySamples` was given
|
|
4889
5069
|
* `truncated` for.
|
|
4890
5070
|
*/
|
|
4891
|
-
next_cursor:
|
|
5071
|
+
next_cursor: z20.number().int().positive().nullable()
|
|
4892
5072
|
});
|
|
4893
5073
|
|
|
4894
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4895
|
-
import { z as
|
|
5074
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/errors.js
|
|
5075
|
+
import { z as z24 } from "zod";
|
|
4896
5076
|
|
|
4897
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
4898
|
-
import { z as
|
|
4899
|
-
|
|
4900
|
-
|
|
5077
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/plans.js
|
|
5078
|
+
import { z as z23 } from "zod";
|
|
5079
|
+
|
|
5080
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/purchase-operation-key.js
|
|
5081
|
+
import { z as z21 } from "zod";
|
|
5082
|
+
var purchaseOperationKey = z21.uuid().meta({ description: "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input." });
|
|
5083
|
+
|
|
5084
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/confirmation-proof.js
|
|
5085
|
+
import { z as z22 } from "zod";
|
|
5086
|
+
var confirmationProof = z22.string().regex(/^[A-Za-z0-9_-]{43}$/).meta({
|
|
5087
|
+
description: "Opaque 32-byte Cloud proof, unpadded base64url. Syntax alone is not evidence."
|
|
5088
|
+
});
|
|
5089
|
+
|
|
5090
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/plans.js
|
|
5091
|
+
var planId = z23.enum(["basic", "plus", "pro", "enterprise"]);
|
|
5092
|
+
var planLimitKey = z23.enum([
|
|
4901
5093
|
"seats",
|
|
4902
5094
|
"robots",
|
|
4903
5095
|
"apps",
|
|
@@ -4907,8 +5099,8 @@ var planLimitKey = z18.enum([
|
|
|
4907
5099
|
"history_days",
|
|
4908
5100
|
"audit_days"
|
|
4909
5101
|
]);
|
|
4910
|
-
var limit =
|
|
4911
|
-
var planLimits =
|
|
5102
|
+
var limit = z23.number().int().positive().nullable();
|
|
5103
|
+
var planLimits = z23.object({
|
|
4912
5104
|
seats: limit.meta({ description: "Developers, owners included, plus pending team invitations." }),
|
|
4913
5105
|
robots: limit.meta({ description: "Robots in the org." }),
|
|
4914
5106
|
apps: limit.meta({ description: "Apps in the org." }),
|
|
@@ -4922,7 +5114,7 @@ var planLimits = z18.object({
|
|
|
4922
5114
|
history_days: limit.meta({ description: "Days the org's robot history is kept." }),
|
|
4923
5115
|
audit_days: limit.meta({ description: "Days the org's audit log is kept." })
|
|
4924
5116
|
});
|
|
4925
|
-
var planFeature =
|
|
5117
|
+
var planFeature = z23.enum(["app_mcp", "two_factor", "require_two_factor", "app_oidc", "hosted_logo", "audit_export", "addons"]);
|
|
4926
5118
|
var FEATURE_DESCRIPTIONS = {
|
|
4927
5119
|
app_mcp: "An app's own MCP endpoint, for its app users.",
|
|
4928
5120
|
two_factor: "Two-factor sign-in for developers.",
|
|
@@ -4932,33 +5124,28 @@ var FEATURE_DESCRIPTIONS = {
|
|
|
4932
5124
|
audit_export: "The audit log can be exported as CSV.",
|
|
4933
5125
|
addons: "Add-ons can be bought on top of the plan."
|
|
4934
5126
|
};
|
|
4935
|
-
var planFeatures =
|
|
4936
|
-
var cents =
|
|
4937
|
-
var planPrices =
|
|
5127
|
+
var planFeatures = z23.object(Object.fromEntries(planFeature.options.map((f) => [f, z23.boolean().meta({ description: FEATURE_DESCRIPTIONS[f] })])));
|
|
5128
|
+
var cents = z23.number().int().nonnegative();
|
|
5129
|
+
var planPrices = z23.object({
|
|
4938
5130
|
eur_month: cents.meta({ description: "Per month in euro cents, excluding VAT." }),
|
|
4939
|
-
|
|
4940
|
-
eur_year: cents.meta({ description: "Per year in euro cents, excluding VAT: twelve months less 15 %." }),
|
|
4941
|
-
usd_year: cents.meta({ description: "Per year in US dollar cents, excluding VAT: the yearly euro price \xD7 1.15, rounded up to a whole dollar." })
|
|
5131
|
+
eur_year: cents.meta({ description: "Per year in euro cents, excluding VAT: twelve months less 15 %." })
|
|
4942
5132
|
});
|
|
4943
|
-
var planSupport =
|
|
4944
|
-
var planCatalogueEntry =
|
|
5133
|
+
var planSupport = z23.enum(["community", "email", "priority", "named_contact"]);
|
|
5134
|
+
var planCatalogueEntry = z23.object({
|
|
4945
5135
|
id: planId.meta({ description: "The plan." }),
|
|
4946
|
-
name:
|
|
5136
|
+
name: z23.string().min(1).meta({ description: "The plan's display name: Basic, Plus, Pro or Enterprise." }),
|
|
4947
5137
|
limits: planLimits.meta({ description: "What the plan allows. `null` means by contract." }),
|
|
4948
5138
|
features: planFeatures.meta({ description: "What the plan unlocks." }),
|
|
4949
5139
|
prices: planPrices.nullable().meta({ description: "`null` for Enterprise: sold by contract, on request." }),
|
|
4950
5140
|
support: planSupport.meta({ description: "The support that comes with the plan." })
|
|
4951
5141
|
});
|
|
4952
|
-
var addonKey =
|
|
4953
|
-
var addonCatalogueEntry =
|
|
5142
|
+
var addonKey = z23.enum(["seats", "robots", "apps", "app_user_packs", "live_video_packs"]);
|
|
5143
|
+
var addonCatalogueEntry = z23.object({
|
|
4954
5144
|
key: addonKey.meta({ description: "The add-on." }),
|
|
4955
5145
|
raises: planLimitKey.meta({ description: "The plan limit this add-on raises." }),
|
|
4956
|
-
per_unit:
|
|
5146
|
+
per_unit: z23.number().int().positive().meta({ description: "How much one unit of this add-on raises `raises` by." }),
|
|
4957
5147
|
prices: planPrices.meta({ description: "The price of one unit." })
|
|
4958
5148
|
});
|
|
4959
|
-
function usdCentsFromEurCents(eurCents) {
|
|
4960
|
-
return Math.floor((eurCents * 115 + 9999) / 1e4) * 100;
|
|
4961
|
-
}
|
|
4962
5149
|
function yearlyEurCents(monthEurCents) {
|
|
4963
5150
|
return Math.round(monthEurCents * 12 * 85 / 100);
|
|
4964
5151
|
}
|
|
@@ -4966,9 +5153,7 @@ function pricesFromEurMonth(eurMonthCents) {
|
|
|
4966
5153
|
const eurYear = yearlyEurCents(eurMonthCents);
|
|
4967
5154
|
return {
|
|
4968
5155
|
eur_month: eurMonthCents,
|
|
4969
|
-
|
|
4970
|
-
eur_year: eurYear,
|
|
4971
|
-
usd_year: usdCentsFromEurCents(eurYear)
|
|
5156
|
+
eur_year: eurYear
|
|
4972
5157
|
};
|
|
4973
5158
|
}
|
|
4974
5159
|
var PLANS = {
|
|
@@ -5080,17 +5265,17 @@ var ADDONS = {
|
|
|
5080
5265
|
app_user_packs: { key: "app_user_packs", raises: "app_users", per_unit: 5, prices: pricesFromEurMonth(1e3) },
|
|
5081
5266
|
live_video_packs: { key: "live_video_packs", raises: "live_video_ms_per_month", per_unit: 9e8, prices: pricesFromEurMonth(900) }
|
|
5082
5267
|
};
|
|
5083
|
-
var planCurrency =
|
|
5084
|
-
var addonCount =
|
|
5085
|
-
var orgAddons =
|
|
5268
|
+
var planCurrency = z23.enum(["eur", "usd"]);
|
|
5269
|
+
var addonCount = z23.number().int().nonnegative();
|
|
5270
|
+
var orgAddons = z23.object({
|
|
5086
5271
|
seats: addonCount.meta({ description: "Extra developer seats, one each." }),
|
|
5087
5272
|
robots: addonCount.meta({ description: "Extra robots, one each." }),
|
|
5088
5273
|
apps: addonCount.meta({ description: "Extra apps, one each." }),
|
|
5089
5274
|
app_user_packs: addonCount.meta({ description: "Packs of five extra app users." }),
|
|
5090
5275
|
live_video_packs: addonCount.meta({ description: "Packs of 250 extra hours of app-user live video per month." })
|
|
5091
5276
|
});
|
|
5092
|
-
var usageCount =
|
|
5093
|
-
var orgPlanUsage =
|
|
5277
|
+
var usageCount = z23.number().int().nonnegative();
|
|
5278
|
+
var orgPlanUsage = z23.object({
|
|
5094
5279
|
seats: usageCount.meta({ description: "Developers, owners included, plus pending team invitations." }),
|
|
5095
5280
|
robots: usageCount.meta({ description: "Robots in the org." }),
|
|
5096
5281
|
apps: usageCount.meta({ description: "Apps in the org." }),
|
|
@@ -5100,42 +5285,42 @@ var orgPlanUsage = z18.object({
|
|
|
5100
5285
|
}),
|
|
5101
5286
|
asset_bytes: usageCount.meta({ description: "Bytes the assets of every robot of the org occupy, together." })
|
|
5102
5287
|
});
|
|
5103
|
-
var planChangeKeep =
|
|
5104
|
-
robots:
|
|
5105
|
-
apps:
|
|
5106
|
-
app_users:
|
|
5288
|
+
var planChangeKeep = z23.object({
|
|
5289
|
+
robots: z23.array(z23.uuid()).meta({ description: "The robots that stay, by id. Every other robot is deleted when the change takes effect." }),
|
|
5290
|
+
apps: z23.array(z23.uuid()).meta({ description: "The apps that stay, by id. Every other app is deleted when the change takes effect." }),
|
|
5291
|
+
app_users: z23.array(z23.uuid()).meta({
|
|
5107
5292
|
description: "The app users that stay, by id, across every app. Every other app user is deleted when the change takes effect."
|
|
5108
5293
|
}),
|
|
5109
|
-
developers:
|
|
5294
|
+
developers: z23.array(z23.uuid()).meta({
|
|
5110
5295
|
description: "The developers that stay, by user id, owners never among them: every owner stays. Every other developer is removed from the org when the change takes effect."
|
|
5111
5296
|
})
|
|
5112
5297
|
}).strict();
|
|
5113
|
-
var planChangeReason =
|
|
5114
|
-
var pendingPlanChange =
|
|
5298
|
+
var planChangeReason = z23.enum(["downgrade", "cancel", "migration", "lock"]);
|
|
5299
|
+
var pendingPlanChange = z23.object({
|
|
5115
5300
|
target_plan: planId.meta({ description: "The plan the org moves to." }),
|
|
5116
5301
|
reason: planChangeReason.meta({ description: "Why the change is pending: `downgrade`, `cancel`, `migration` or `lock`." }),
|
|
5117
|
-
effective_at:
|
|
5302
|
+
effective_at: z23.iso.datetime().nullable().meta({
|
|
5118
5303
|
description: "When the change takes effect. `null` only for a move off the beta whose date is not set yet."
|
|
5119
5304
|
}),
|
|
5120
5305
|
keep: planChangeKeep.nullable().meta({
|
|
5121
5306
|
description: "What stays. `null` when the org already fits the target plan and nothing is deleted."
|
|
5122
5307
|
}),
|
|
5123
|
-
history_days_after:
|
|
5308
|
+
history_days_after: z23.number().int().positive().meta({
|
|
5124
5309
|
description: "Days of history and audit log the org keeps on the target plan."
|
|
5125
5310
|
}),
|
|
5126
|
-
chosen_by:
|
|
5127
|
-
chosen_at:
|
|
5311
|
+
chosen_by: z23.uuid().meta({ description: "The user id of the owner who chose the change, or the nil UUID when Fleetless queued it." }),
|
|
5312
|
+
chosen_at: z23.iso.datetime().meta({ description: "When the change was chosen." })
|
|
5128
5313
|
});
|
|
5129
|
-
var orgLock =
|
|
5130
|
-
reason:
|
|
5314
|
+
var orgLock = z23.object({
|
|
5315
|
+
reason: z23.enum(["payment", "migration"]).meta({
|
|
5131
5316
|
description: "`payment`: a payment is missing. `migration`: the org did not choose what stays when the beta ended."
|
|
5132
5317
|
}),
|
|
5133
|
-
since:
|
|
5318
|
+
since: z23.iso.datetime().meta({ description: "When the org was locked." })
|
|
5134
5319
|
});
|
|
5135
|
-
var orgPlan =
|
|
5320
|
+
var orgPlan = z23.object({
|
|
5136
5321
|
plan: planId.meta({ description: "The org's current plan." }),
|
|
5137
5322
|
currency: planCurrency.meta({ description: "The currency the org's prices are shown and billed in." }),
|
|
5138
|
-
period_ends_at:
|
|
5323
|
+
period_ends_at: z23.iso.datetime().meta({
|
|
5139
5324
|
description: "The end of the organization's current billing period; while no payment period exists yet, the end of the current UTC calendar month. A pending downward plan change normally takes effect at this exact instant \u2014 except one chosen while the org was locked, which lands at once, and the platform's own move off the beta, which lands at its switch date instead."
|
|
5140
5325
|
}),
|
|
5141
5326
|
addons: orgAddons.meta({ description: "The add-ons the org has bought. All zero on a plan without the `addons` feature." }),
|
|
@@ -5146,66 +5331,82 @@ var orgPlan = z18.object({
|
|
|
5146
5331
|
usage: orgPlanUsage.meta({ description: "What the org uses now, counted the way each limit counts it." }),
|
|
5147
5332
|
pending_change: pendingPlanChange.nullable().meta({ description: "A move to a lower plan that has not taken effect yet, or `null`." }),
|
|
5148
5333
|
lock: orgLock.nullable().meta({ description: "Why and since when the org is locked, or `null` when it is not." }),
|
|
5149
|
-
switch:
|
|
5150
|
-
at:
|
|
5334
|
+
switch: z23.object({
|
|
5335
|
+
at: z23.iso.datetime().nullable().meta({
|
|
5151
5336
|
description: "When the org moves from the beta onto its plan. `null` while the date is not set."
|
|
5152
5337
|
}),
|
|
5153
|
-
needs_choice:
|
|
5338
|
+
needs_choice: z23.boolean().meta({
|
|
5154
5339
|
description: "Whether the org uses more than Basic allows, so an owner has to choose what stays before `at`."
|
|
5155
5340
|
})
|
|
5156
5341
|
}).nullable().meta({ description: "Set only while the org is still on the beta; `null` for every other org." })
|
|
5157
5342
|
});
|
|
5158
|
-
var
|
|
5343
|
+
var planChangePrepareRequest = z23.object({
|
|
5344
|
+
operation_key: purchaseOperationKey,
|
|
5159
5345
|
target_plan: planId.meta({ description: "The lower plan to move to; `basic` cancels." }),
|
|
5160
5346
|
keep: planChangeKeep.nullable().meta({
|
|
5161
5347
|
description: "What stays. `null` when the org already fits the target plan, so nothing is deleted."
|
|
5162
5348
|
})
|
|
5163
5349
|
}).strict();
|
|
5164
|
-
var
|
|
5350
|
+
var finalPlanChangeFields = {
|
|
5351
|
+
change_id: z23.uuid(),
|
|
5352
|
+
operation_key: purchaseOperationKey,
|
|
5353
|
+
keep: planChangeKeep.nullable(),
|
|
5354
|
+
confirmation_proof: confirmationProof
|
|
5355
|
+
};
|
|
5356
|
+
var planChangeRequest = z23.discriminatedUnion("target_plan", [
|
|
5357
|
+
z23.object({ ...finalPlanChangeFields, target_plan: z23.literal("basic"), cancellation_reason: z23.string().max(500).trim().optional() }).strict(),
|
|
5358
|
+
z23.object({ ...finalPlanChangeFields, target_plan: planId.exclude(["basic"]) }).strict()
|
|
5359
|
+
]);
|
|
5360
|
+
var planChangeDecisionLookupQuery = z23.object({ operation_key: purchaseOperationKey }).strict();
|
|
5361
|
+
var planChangeDecisionStatusResponse = z23.discriminatedUnion("state", [
|
|
5362
|
+
z23.object({ state: z23.literal("prepared"), change_id: z23.uuid() }).strict(),
|
|
5363
|
+
z23.object({ state: z23.literal("accepted"), change_id: z23.uuid(), result: orgPlan }).strict()
|
|
5364
|
+
]);
|
|
5365
|
+
var planOverrides = z23.object(Object.fromEntries(planLimitKey.options.map((k) => [
|
|
5165
5366
|
k,
|
|
5166
5367
|
limit.optional().meta({ description: `Replaces the plan's \`${k}\`. \`null\` clears the override.` })
|
|
5167
5368
|
]))).strict();
|
|
5168
|
-
var adminPlanChangeRequest =
|
|
5369
|
+
var adminPlanChangeRequest = z23.object({
|
|
5169
5370
|
plan: planId.meta({ description: "The plan the org is on after this request." }),
|
|
5170
5371
|
addons: orgAddons.partial().strict().optional().meta({ description: "Add-on counts to set. Counts not named stay as they are." }),
|
|
5171
5372
|
overrides: planOverrides.optional().meta({ description: "Limits to override. `null` clears an override." }),
|
|
5172
5373
|
currency: planCurrency.optional().meta({ description: "The currency the org is billed in." }),
|
|
5173
|
-
period_ends_at:
|
|
5374
|
+
period_ends_at: z23.iso.datetime().nullable().optional().meta({
|
|
5174
5375
|
description: "The end of the org's billing period. `null` falls back to the end of the current UTC month."
|
|
5175
5376
|
})
|
|
5176
5377
|
}).strict();
|
|
5177
5378
|
|
|
5178
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5179
|
-
var apiError =
|
|
5180
|
-
code:
|
|
5181
|
-
message:
|
|
5182
|
-
details:
|
|
5183
|
-
});
|
|
5184
|
-
var parameterViolation =
|
|
5185
|
-
field:
|
|
5379
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/errors.js
|
|
5380
|
+
var apiError = z24.object({
|
|
5381
|
+
code: z24.string().min(1),
|
|
5382
|
+
message: z24.string().min(1),
|
|
5383
|
+
details: z24.unknown().optional()
|
|
5384
|
+
});
|
|
5385
|
+
var parameterViolation = z24.object({
|
|
5386
|
+
field: z24.string().min(1),
|
|
5186
5387
|
/** Which rule failed — `min`, `max`, `enum`, `pattern`, `required`, `undeclared`. */
|
|
5187
|
-
rule:
|
|
5188
|
-
message:
|
|
5388
|
+
rule: z24.string().min(1),
|
|
5389
|
+
message: z24.string().min(1)
|
|
5189
5390
|
});
|
|
5190
|
-
var parameterInvalidDetails =
|
|
5191
|
-
violations:
|
|
5391
|
+
var parameterInvalidDetails = z24.object({
|
|
5392
|
+
violations: z24.array(parameterViolation).min(1)
|
|
5192
5393
|
});
|
|
5193
|
-
var cancelRejectedDetails =
|
|
5194
|
-
goals:
|
|
5394
|
+
var cancelRejectedDetails = z24.object({
|
|
5395
|
+
goals: z24.array(bridgeCancelResultEntry).min(1)
|
|
5195
5396
|
});
|
|
5196
|
-
var invalidCodeDetails =
|
|
5197
|
-
attempts_left:
|
|
5397
|
+
var invalidCodeDetails = z24.object({
|
|
5398
|
+
attempts_left: z24.number().int().min(0).meta({
|
|
5198
5399
|
description: "How many more wrong codes this code or challenge takes before it is spent. `0` means the next attempt answers `410 token_spent`."
|
|
5199
5400
|
})
|
|
5200
5401
|
});
|
|
5201
|
-
var planLimitDetails =
|
|
5402
|
+
var planLimitDetails = z24.object({
|
|
5202
5403
|
limit: planLimitKey.exclude(["history_days", "audit_days"]).meta({ description: "The limit the action would exceed." }),
|
|
5203
|
-
used:
|
|
5204
|
-
max:
|
|
5404
|
+
used: z24.number().int().nonnegative().meta({ description: "How much of the limit the org uses now." }),
|
|
5405
|
+
max: z24.number().int().nonnegative().meta({
|
|
5205
5406
|
description: "The limit. For `asset_bytes_per_robot`, the org's whole pool: robots \xD7 the plan's bytes per robot."
|
|
5206
5407
|
}),
|
|
5207
5408
|
plan: planId.meta({ description: "The plan whose limit refused: the target plan while a move to a lower plan is pending." }),
|
|
5208
|
-
lifted_by:
|
|
5409
|
+
lifted_by: z24.object({
|
|
5209
5410
|
plan: planId.nullable().meta({ description: "The cheapest higher plan that raises this limit, or `null` when none does." }),
|
|
5210
5411
|
addon: addonKey.nullable().meta({
|
|
5211
5412
|
description: "The add-on that raises this limit, when the org's plan can buy add-ons; otherwise `null`."
|
|
@@ -5221,28 +5422,37 @@ var assetPlanLimitDetails = planLimitDetails.extend({
|
|
|
5221
5422
|
description: "Bytes the org's assets occupy, across every robot, before this upload."
|
|
5222
5423
|
})
|
|
5223
5424
|
});
|
|
5224
|
-
var planRequiredDetails =
|
|
5425
|
+
var planRequiredDetails = z24.object({
|
|
5225
5426
|
feature: planFeature.meta({ description: "The feature the action needs." }),
|
|
5226
5427
|
plan: planId.meta({ description: "The org's current plan." }),
|
|
5227
5428
|
required_plan: planId.meta({ description: "The cheapest plan that has the feature." })
|
|
5228
5429
|
});
|
|
5229
|
-
var orgLockedDetails =
|
|
5230
|
-
reason:
|
|
5430
|
+
var orgLockedDetails = z24.object({
|
|
5431
|
+
reason: z24.enum(["payment", "migration"]).meta({
|
|
5231
5432
|
description: "`payment`: a payment is missing. `migration`: the org did not choose what stays when the beta ended."
|
|
5232
5433
|
})
|
|
5233
5434
|
});
|
|
5234
|
-
var fileTooLargeDetails =
|
|
5235
|
-
max_bytes:
|
|
5435
|
+
var fileTooLargeDetails = z24.object({
|
|
5436
|
+
max_bytes: z24.number().int().positive().meta({
|
|
5236
5437
|
description: "The most one asset file can be, in bytes: `ASSET_FILE_MAX_BYTES`, the same on every plan."
|
|
5237
5438
|
}),
|
|
5238
|
-
size_bytes:
|
|
5439
|
+
size_bytes: z24.number().int().positive().nullable().meta({
|
|
5239
5440
|
description: "The refused file's size, in bytes: the announced size, or the bytes that arrived when none (or a false one) was announced; `null` only when the body limit stopped the upload and nobody counted the bytes."
|
|
5240
5441
|
})
|
|
5241
5442
|
});
|
|
5443
|
+
var paymentProviderUnavailableDetails = z24.object({
|
|
5444
|
+
provider: z24.literal("mollie").meta({ description: "The payment provider. Always `mollie` today." }),
|
|
5445
|
+
status: z24.number().int().nullable().meta({ description: "Mollie's own HTTP status, or `null` when the request timed out instead of answering." })
|
|
5446
|
+
});
|
|
5447
|
+
var billingDocumentsUnavailableDetails = z24.object({
|
|
5448
|
+
reason: z24.enum(["provider_unavailable", "rate_limited", "list_limit_exceeded", "list_changed", "unsupported_document", "profile_mismatch"]).meta({
|
|
5449
|
+
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)."
|
|
5450
|
+
})
|
|
5451
|
+
}).strict();
|
|
5242
5452
|
|
|
5243
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5244
|
-
import { z as
|
|
5245
|
-
var oauthErrorCode =
|
|
5453
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/oauth.js
|
|
5454
|
+
import { z as z25 } from "zod";
|
|
5455
|
+
var oauthErrorCode = z25.enum([
|
|
5246
5456
|
"invalid_request",
|
|
5247
5457
|
"invalid_client",
|
|
5248
5458
|
"invalid_grant",
|
|
@@ -5255,11 +5465,11 @@ var oauthErrorCode = z20.enum([
|
|
|
5255
5465
|
/** RFC 8707: the `resource` named is not one this server issues tokens for. */
|
|
5256
5466
|
"invalid_target"
|
|
5257
5467
|
]);
|
|
5258
|
-
var oauthError =
|
|
5468
|
+
var oauthError = z25.object({
|
|
5259
5469
|
error: oauthErrorCode,
|
|
5260
|
-
error_description:
|
|
5470
|
+
error_description: z25.string().min(1).max(500).optional(),
|
|
5261
5471
|
/** Echoed back per RFC 6749 §4.1.2.1 so a client can match the response. */
|
|
5262
|
-
state:
|
|
5472
|
+
state: z25.string().min(1).max(500).optional(),
|
|
5263
5473
|
/**
|
|
5264
5474
|
* **A Fleetless reason carried inside a standard envelope, and it exists
|
|
5265
5475
|
* because the alternative lost a distinction.**
|
|
@@ -5277,9 +5487,9 @@ var oauthError = z20.object({
|
|
|
5277
5487
|
* our own tooling switches on. RFC 6749 §5.2 permits additional members, and
|
|
5278
5488
|
* a client that ignores this one still behaves correctly.
|
|
5279
5489
|
*/
|
|
5280
|
-
fleetless_code:
|
|
5490
|
+
fleetless_code: z25.string().min(1).max(60).optional()
|
|
5281
5491
|
});
|
|
5282
|
-
var redirectUri =
|
|
5492
|
+
var redirectUri = z25.string().min(1).max(2e3).refine((v) => {
|
|
5283
5493
|
let url;
|
|
5284
5494
|
try {
|
|
5285
5495
|
url = new URL(v);
|
|
@@ -5294,180 +5504,180 @@ var redirectUri = z20.string().min(1).max(2e3).refine((v) => {
|
|
|
5294
5504
|
return ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
5295
5505
|
return false;
|
|
5296
5506
|
}, { message: "redirect_uri must be an https URL, or http on an explicit loopback address, and carry no fragment" });
|
|
5297
|
-
var codeChallengeMethod =
|
|
5507
|
+
var codeChallengeMethod = z25.enum(["S256"]);
|
|
5298
5508
|
var MCP_DCR_MAX_REDIRECT_URIS = 5;
|
|
5299
|
-
var dynamicClientRegistrationRequest =
|
|
5300
|
-
redirect_uris:
|
|
5509
|
+
var dynamicClientRegistrationRequest = z25.object({
|
|
5510
|
+
redirect_uris: z25.array(redirectUri).min(1).max(MCP_DCR_MAX_REDIRECT_URIS).meta({
|
|
5301
5511
|
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.`
|
|
5302
5512
|
}),
|
|
5303
|
-
client_name:
|
|
5513
|
+
client_name: z25.string().min(1).max(200).optional().meta({
|
|
5304
5514
|
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"*.'
|
|
5305
5515
|
}),
|
|
5306
|
-
token_endpoint_auth_method:
|
|
5516
|
+
token_endpoint_auth_method: z25.enum(["none"]).optional().meta({
|
|
5307
5517
|
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."
|
|
5308
5518
|
}),
|
|
5309
|
-
grant_types:
|
|
5519
|
+
grant_types: z25.array(z25.enum(["authorization_code", "refresh_token"])).optional().meta({
|
|
5310
5520
|
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."
|
|
5311
5521
|
}),
|
|
5312
|
-
response_types:
|
|
5522
|
+
response_types: z25.array(z25.enum(["code"])).optional().meta({
|
|
5313
5523
|
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."
|
|
5314
5524
|
}),
|
|
5315
|
-
scope:
|
|
5525
|
+
scope: z25.string().max(500).optional().meta({
|
|
5316
5526
|
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."
|
|
5317
5527
|
})
|
|
5318
5528
|
}).meta({
|
|
5319
5529
|
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)."
|
|
5320
5530
|
});
|
|
5321
|
-
var dynamicClientRegistrationResponse =
|
|
5322
|
-
client_id:
|
|
5531
|
+
var dynamicClientRegistrationResponse = z25.object({
|
|
5532
|
+
client_id: z25.string().min(1).max(200).meta({
|
|
5323
5533
|
description: "The identifier this client sends at the authorize and token endpoints. Opaque, and not the app identifier."
|
|
5324
5534
|
}),
|
|
5325
|
-
client_name:
|
|
5535
|
+
client_name: z25.string().min(1).max(200).meta({
|
|
5326
5536
|
description: "The name the client registered under, echoed back. Chosen by the client and not vouched for by Fleetless."
|
|
5327
5537
|
}),
|
|
5328
|
-
redirect_uris:
|
|
5538
|
+
redirect_uris: z25.array(redirectUri).meta({
|
|
5329
5539
|
description: "The redirect URIs this registration was accepted for. A code is returned to one of these and nowhere else."
|
|
5330
5540
|
}),
|
|
5331
|
-
grant_types:
|
|
5541
|
+
grant_types: z25.array(z25.string()).meta({
|
|
5332
5542
|
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.'
|
|
5333
5543
|
}),
|
|
5334
|
-
response_types:
|
|
5544
|
+
response_types: z25.array(z25.string()).meta({
|
|
5335
5545
|
description: "The response types this client may ask for: `code`."
|
|
5336
5546
|
}),
|
|
5337
|
-
token_endpoint_auth_method:
|
|
5547
|
+
token_endpoint_auth_method: z25.literal("none").meta({
|
|
5338
5548
|
description: "`none` \u2014 this server registers public clients only, and PKCE rather than a secret is what protects the exchange."
|
|
5339
5549
|
}),
|
|
5340
|
-
client_id_issued_at:
|
|
5550
|
+
client_id_issued_at: z25.number().int().nonnegative().meta({
|
|
5341
5551
|
description: "When the registration was created, in seconds since the epoch, per RFC 7591."
|
|
5342
5552
|
}),
|
|
5343
|
-
client_secret_expires_at:
|
|
5553
|
+
client_secret_expires_at: z25.literal(0).meta({
|
|
5344
5554
|
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."
|
|
5345
5555
|
})
|
|
5346
5556
|
});
|
|
5347
|
-
var oauthCodeTokenRequest =
|
|
5348
|
-
grant_type:
|
|
5557
|
+
var oauthCodeTokenRequest = z25.object({
|
|
5558
|
+
grant_type: z25.literal("authorization_code").meta({
|
|
5349
5559
|
description: "`authorization_code`: this request exchanges the code from the authorize redirect for an access token and a refresh token."
|
|
5350
5560
|
}),
|
|
5351
|
-
code:
|
|
5561
|
+
code: z25.string().min(1).max(500).meta({
|
|
5352
5562
|
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."
|
|
5353
5563
|
}),
|
|
5354
5564
|
redirect_uri: redirectUri.meta({
|
|
5355
5565
|
description: "The same redirect URI the authorize request used. It is compared, not merely recorded."
|
|
5356
5566
|
}),
|
|
5357
|
-
client_id:
|
|
5567
|
+
client_id: z25.string().min(1).max(200).meta({
|
|
5358
5568
|
description: "The client making the exchange, as registered."
|
|
5359
5569
|
}),
|
|
5360
|
-
code_verifier:
|
|
5570
|
+
code_verifier: z25.string().regex(/^[A-Za-z0-9\-._~]{43,128}$/, "code_verifier must be 43-128 unreserved characters (RFC 7636 \xA74.1)").meta({
|
|
5361
5571
|
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."
|
|
5362
5572
|
}),
|
|
5363
|
-
resource:
|
|
5573
|
+
resource: z25.url().optional().meta({
|
|
5364
5574
|
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."
|
|
5365
5575
|
})
|
|
5366
5576
|
}).meta({
|
|
5367
5577
|
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."
|
|
5368
5578
|
});
|
|
5369
|
-
var oauthRefreshTokenRequest =
|
|
5370
|
-
grant_type:
|
|
5579
|
+
var oauthRefreshTokenRequest = z25.object({
|
|
5580
|
+
grant_type: z25.literal("refresh_token").meta({
|
|
5371
5581
|
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."
|
|
5372
5582
|
}),
|
|
5373
|
-
refresh_token:
|
|
5583
|
+
refresh_token: z25.string().min(1).max(500).meta({
|
|
5374
5584
|
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."
|
|
5375
5585
|
}),
|
|
5376
|
-
client_id:
|
|
5586
|
+
client_id: z25.string().min(1).max(200).meta({
|
|
5377
5587
|
description: "The client the refresh token was issued to, as registered. A refresh token is not transferable between clients."
|
|
5378
5588
|
}),
|
|
5379
|
-
resource:
|
|
5589
|
+
resource: z25.url().optional().meta({
|
|
5380
5590
|
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."
|
|
5381
5591
|
})
|
|
5382
5592
|
}).meta({
|
|
5383
5593
|
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."
|
|
5384
5594
|
});
|
|
5385
|
-
var oauthTokenRequest =
|
|
5595
|
+
var oauthTokenRequest = z25.discriminatedUnion("grant_type", [oauthCodeTokenRequest, oauthRefreshTokenRequest]).meta({
|
|
5386
5596
|
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."
|
|
5387
5597
|
});
|
|
5388
|
-
var oauthTokenResponse =
|
|
5389
|
-
access_token:
|
|
5598
|
+
var oauthTokenResponse = z25.object({
|
|
5599
|
+
access_token: z25.string().min(1).meta({
|
|
5390
5600
|
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."
|
|
5391
5601
|
}),
|
|
5392
|
-
token_type:
|
|
5602
|
+
token_type: z25.literal("Bearer").meta({
|
|
5393
5603
|
description: "`Bearer`. RFC 6749 \xA75.1 makes the value case-insensitive for a client reading it; this is the spelling this server emits."
|
|
5394
5604
|
}),
|
|
5395
|
-
expires_in:
|
|
5605
|
+
expires_in: z25.number().int().positive().meta({
|
|
5396
5606
|
description: "How long the access token is valid, in **seconds**, per RFC 6749 \xA75.1. Not a timestamp, and not milliseconds."
|
|
5397
5607
|
}),
|
|
5398
|
-
refresh_token:
|
|
5608
|
+
refresh_token: z25.string().min(1).optional().meta({
|
|
5399
5609
|
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."
|
|
5400
5610
|
}),
|
|
5401
|
-
scope:
|
|
5611
|
+
scope: z25.string().max(500).optional().meta({
|
|
5402
5612
|
description: "The scopes the issued token actually carries, space-separated."
|
|
5403
5613
|
})
|
|
5404
5614
|
});
|
|
5405
|
-
var authorizationServerMetadata =
|
|
5406
|
-
issuer:
|
|
5615
|
+
var authorizationServerMetadata = z25.object({
|
|
5616
|
+
issuer: z25.url().meta({
|
|
5407
5617
|
description: "The issuer identifier of this authorization server, per RFC 8414 \xA72. It is what a client checks a token's `iss` against."
|
|
5408
5618
|
}),
|
|
5409
|
-
authorization_endpoint:
|
|
5619
|
+
authorization_endpoint: z25.url().meta({
|
|
5410
5620
|
description: "Where a client sends the user to authorize."
|
|
5411
5621
|
}),
|
|
5412
|
-
token_endpoint:
|
|
5622
|
+
token_endpoint: z25.url().meta({
|
|
5413
5623
|
description: "The URL where a client exchanges an authorization code, or a refresh token, for tokens."
|
|
5414
5624
|
}),
|
|
5415
|
-
registration_endpoint:
|
|
5625
|
+
registration_endpoint: z25.url().optional().meta({
|
|
5416
5626
|
description: "The URL where a client may register itself, per RFC 7591. Absent when the app does not accept dynamic clients."
|
|
5417
5627
|
}),
|
|
5418
|
-
response_types_supported:
|
|
5628
|
+
response_types_supported: z25.array(z25.literal("code")).meta({
|
|
5419
5629
|
description: "The response types this server offers: `code` only, the implicit grant being gone with OAuth 2.1."
|
|
5420
5630
|
}),
|
|
5421
|
-
grant_types_supported:
|
|
5631
|
+
grant_types_supported: z25.array(z25.enum(["authorization_code", "refresh_token"])).meta({
|
|
5422
5632
|
description: "The grants this server offers: `authorization_code` and `refresh_token`. OAuth 2.1 removes the implicit and password grants, so neither appears here."
|
|
5423
5633
|
}),
|
|
5424
|
-
code_challenge_methods_supported:
|
|
5634
|
+
code_challenge_methods_supported: z25.array(codeChallengeMethod).meta({
|
|
5425
5635
|
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."
|
|
5426
5636
|
}),
|
|
5427
|
-
token_endpoint_auth_methods_supported:
|
|
5637
|
+
token_endpoint_auth_methods_supported: z25.array(z25.literal("none")).meta({
|
|
5428
5638
|
description: "How a client authenticates at the token endpoint: `none`, the public-client method, with PKCE protecting the exchange."
|
|
5429
5639
|
}),
|
|
5430
|
-
scopes_supported:
|
|
5640
|
+
scopes_supported: z25.array(z25.string()).optional().meta({
|
|
5431
5641
|
description: "The scopes this server knows about, where it publishes a list."
|
|
5432
5642
|
})
|
|
5433
5643
|
});
|
|
5434
|
-
var protectedResourceMetadata =
|
|
5435
|
-
resource:
|
|
5644
|
+
var protectedResourceMetadata = z25.object({
|
|
5645
|
+
resource: z25.url().meta({
|
|
5436
5646
|
description: "The resource identifier this document describes, per RFC 9728. A token whose audience names something else is rejected here rather than merely noted."
|
|
5437
5647
|
}),
|
|
5438
|
-
authorization_servers:
|
|
5648
|
+
authorization_servers: z25.array(z25.url()).min(1).meta({
|
|
5439
5649
|
description: "The authorization servers that may issue tokens for this resource. There is always at least one."
|
|
5440
5650
|
}),
|
|
5441
|
-
bearer_methods_supported:
|
|
5651
|
+
bearer_methods_supported: z25.array(z25.literal("header")).meta({
|
|
5442
5652
|
description: "How a token may be presented: in the `Authorization` header only, never in a query parameter or a form field."
|
|
5443
5653
|
}),
|
|
5444
|
-
scopes_supported:
|
|
5654
|
+
scopes_supported: z25.array(z25.string()).optional().meta({
|
|
5445
5655
|
description: "The scopes this resource understands, where it publishes a list."
|
|
5446
5656
|
})
|
|
5447
5657
|
});
|
|
5448
|
-
var oauthRedirectResponse =
|
|
5449
|
-
redirect_to:
|
|
5658
|
+
var oauthRedirectResponse = z25.object({
|
|
5659
|
+
redirect_to: z25.string().min(1).max(2e3)
|
|
5450
5660
|
});
|
|
5451
|
-
var oauthAuthorizeQuery =
|
|
5452
|
-
response_type:
|
|
5661
|
+
var oauthAuthorizeQuery = z25.object({
|
|
5662
|
+
response_type: z25.literal("code").meta({
|
|
5453
5663
|
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`."
|
|
5454
5664
|
}),
|
|
5455
|
-
client_id:
|
|
5665
|
+
client_id: z25.string().min(1).meta({
|
|
5456
5666
|
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."
|
|
5457
5667
|
}),
|
|
5458
|
-
redirect_uri:
|
|
5668
|
+
redirect_uri: z25.string().min(1).meta({
|
|
5459
5669
|
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."
|
|
5460
5670
|
}),
|
|
5461
|
-
code_challenge:
|
|
5671
|
+
code_challenge: z25.string().min(1).meta({
|
|
5462
5672
|
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."
|
|
5463
5673
|
}),
|
|
5464
|
-
code_challenge_method:
|
|
5674
|
+
code_challenge_method: z25.literal("S256").meta({
|
|
5465
5675
|
description: "Only `S256`. `plain` is refused: a challenge equal to its verifier defends against nothing."
|
|
5466
5676
|
}),
|
|
5467
|
-
state:
|
|
5677
|
+
state: z25.string().optional().meta({
|
|
5468
5678
|
description: "Returned unchanged on the callback, and on the error redirect too, so a client can bind either answer to its own request."
|
|
5469
5679
|
}),
|
|
5470
|
-
resource:
|
|
5680
|
+
resource: z25.string().optional().meta({
|
|
5471
5681
|
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."
|
|
5472
5682
|
})
|
|
5473
5683
|
// **No `scope`, because this authorization server issues none.** The field
|
|
@@ -5480,13 +5690,1106 @@ var oauthAuthorizeQuery = z20.object({
|
|
|
5480
5690
|
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."
|
|
5481
5691
|
});
|
|
5482
5692
|
|
|
5483
|
-
// node_modules/.pnpm/@fleetless+contracts@
|
|
5693
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/controller-register.js
|
|
5694
|
+
import { z as z26 } from "zod";
|
|
5695
|
+
var text = (max) => z26.string().regex(/^\P{Cc}*$/u).trim().min(1).max(max);
|
|
5696
|
+
var email = z26.string().regex(/^\P{Cc}*$/u).trim().email().max(320);
|
|
5697
|
+
var controllerRegisterAddress = z26.object({
|
|
5698
|
+
line1: text(200),
|
|
5699
|
+
line2: text(200).nullable().default(null),
|
|
5700
|
+
postalCode: text(32),
|
|
5701
|
+
city: text(120),
|
|
5702
|
+
country: z26.string().regex(/^\P{Cc}*$/u).trim().regex(/^[A-Z]{2}$/)
|
|
5703
|
+
}).strict();
|
|
5704
|
+
var controllerRegisterPrivacyContact = z26.object({
|
|
5705
|
+
name: text(200),
|
|
5706
|
+
email,
|
|
5707
|
+
role: z26.enum(["general", "appointed_dpo"])
|
|
5708
|
+
}).strict();
|
|
5709
|
+
var controllerRegisterRepresentative = z26.object({
|
|
5710
|
+
name: text(200),
|
|
5711
|
+
email,
|
|
5712
|
+
address: text(500)
|
|
5713
|
+
}).strict();
|
|
5714
|
+
var controllerRegisterWrite = z26.object({
|
|
5715
|
+
legalName: text(200),
|
|
5716
|
+
address: controllerRegisterAddress,
|
|
5717
|
+
privacyContact: controllerRegisterPrivacyContact.nullable(),
|
|
5718
|
+
euRepresentative: controllerRegisterRepresentative.nullable(),
|
|
5719
|
+
confirmationSource: text(500)
|
|
5720
|
+
}).strict();
|
|
5721
|
+
var controllerRegisterOrgRecord = controllerRegisterWrite.extend({
|
|
5722
|
+
legalName: text(200).nullable(),
|
|
5723
|
+
address: controllerRegisterAddress.nullable(),
|
|
5724
|
+
updatedAt: z26.iso.datetime(),
|
|
5725
|
+
updatedByKind: z26.enum(["owner", "operator"]),
|
|
5726
|
+
updatedById: z26.uuid()
|
|
5727
|
+
}).strict();
|
|
5728
|
+
var controllerRegisterOrgResponse = z26.object({
|
|
5729
|
+
orgId: z26.uuid(),
|
|
5730
|
+
details: controllerRegisterOrgRecord.nullable()
|
|
5731
|
+
}).strict();
|
|
5732
|
+
|
|
5733
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/billing.js
|
|
5734
|
+
import { z as z27 } from "zod";
|
|
5735
|
+
|
|
5736
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/iana-time-zones.js
|
|
5737
|
+
var ianaTimeZones = [
|
|
5738
|
+
"UTC",
|
|
5739
|
+
"Etc/UTC",
|
|
5740
|
+
"Etc/GMT",
|
|
5741
|
+
"Africa/Abidjan",
|
|
5742
|
+
"Africa/Accra",
|
|
5743
|
+
"Africa/Addis_Ababa",
|
|
5744
|
+
"Africa/Algiers",
|
|
5745
|
+
"Africa/Asmera",
|
|
5746
|
+
"Africa/Bamako",
|
|
5747
|
+
"Africa/Bangui",
|
|
5748
|
+
"Africa/Banjul",
|
|
5749
|
+
"Africa/Bissau",
|
|
5750
|
+
"Africa/Blantyre",
|
|
5751
|
+
"Africa/Brazzaville",
|
|
5752
|
+
"Africa/Bujumbura",
|
|
5753
|
+
"Africa/Cairo",
|
|
5754
|
+
"Africa/Casablanca",
|
|
5755
|
+
"Africa/Ceuta",
|
|
5756
|
+
"Africa/Conakry",
|
|
5757
|
+
"Africa/Dakar",
|
|
5758
|
+
"Africa/Dar_es_Salaam",
|
|
5759
|
+
"Africa/Djibouti",
|
|
5760
|
+
"Africa/Douala",
|
|
5761
|
+
"Africa/El_Aaiun",
|
|
5762
|
+
"Africa/Freetown",
|
|
5763
|
+
"Africa/Gaborone",
|
|
5764
|
+
"Africa/Harare",
|
|
5765
|
+
"Africa/Johannesburg",
|
|
5766
|
+
"Africa/Juba",
|
|
5767
|
+
"Africa/Kampala",
|
|
5768
|
+
"Africa/Khartoum",
|
|
5769
|
+
"Africa/Kigali",
|
|
5770
|
+
"Africa/Kinshasa",
|
|
5771
|
+
"Africa/Lagos",
|
|
5772
|
+
"Africa/Libreville",
|
|
5773
|
+
"Africa/Lome",
|
|
5774
|
+
"Africa/Luanda",
|
|
5775
|
+
"Africa/Lubumbashi",
|
|
5776
|
+
"Africa/Lusaka",
|
|
5777
|
+
"Africa/Malabo",
|
|
5778
|
+
"Africa/Maputo",
|
|
5779
|
+
"Africa/Maseru",
|
|
5780
|
+
"Africa/Mbabane",
|
|
5781
|
+
"Africa/Mogadishu",
|
|
5782
|
+
"Africa/Monrovia",
|
|
5783
|
+
"Africa/Nairobi",
|
|
5784
|
+
"Africa/Ndjamena",
|
|
5785
|
+
"Africa/Niamey",
|
|
5786
|
+
"Africa/Nouakchott",
|
|
5787
|
+
"Africa/Ouagadougou",
|
|
5788
|
+
"Africa/Porto-Novo",
|
|
5789
|
+
"Africa/Sao_Tome",
|
|
5790
|
+
"Africa/Tripoli",
|
|
5791
|
+
"Africa/Tunis",
|
|
5792
|
+
"Africa/Windhoek",
|
|
5793
|
+
"America/Adak",
|
|
5794
|
+
"America/Anchorage",
|
|
5795
|
+
"America/Anguilla",
|
|
5796
|
+
"America/Antigua",
|
|
5797
|
+
"America/Araguaina",
|
|
5798
|
+
"America/Argentina/La_Rioja",
|
|
5799
|
+
"America/Argentina/Rio_Gallegos",
|
|
5800
|
+
"America/Argentina/Salta",
|
|
5801
|
+
"America/Argentina/San_Juan",
|
|
5802
|
+
"America/Argentina/San_Luis",
|
|
5803
|
+
"America/Argentina/Tucuman",
|
|
5804
|
+
"America/Argentina/Ushuaia",
|
|
5805
|
+
"America/Aruba",
|
|
5806
|
+
"America/Asuncion",
|
|
5807
|
+
"America/Bahia",
|
|
5808
|
+
"America/Bahia_Banderas",
|
|
5809
|
+
"America/Barbados",
|
|
5810
|
+
"America/Belem",
|
|
5811
|
+
"America/Belize",
|
|
5812
|
+
"America/Blanc-Sablon",
|
|
5813
|
+
"America/Boa_Vista",
|
|
5814
|
+
"America/Bogota",
|
|
5815
|
+
"America/Boise",
|
|
5816
|
+
"America/Buenos_Aires",
|
|
5817
|
+
"America/Cambridge_Bay",
|
|
5818
|
+
"America/Campo_Grande",
|
|
5819
|
+
"America/Cancun",
|
|
5820
|
+
"America/Caracas",
|
|
5821
|
+
"America/Catamarca",
|
|
5822
|
+
"America/Cayenne",
|
|
5823
|
+
"America/Cayman",
|
|
5824
|
+
"America/Chicago",
|
|
5825
|
+
"America/Chihuahua",
|
|
5826
|
+
"America/Ciudad_Juarez",
|
|
5827
|
+
"America/Coral_Harbour",
|
|
5828
|
+
"America/Cordoba",
|
|
5829
|
+
"America/Costa_Rica",
|
|
5830
|
+
"America/Coyhaique",
|
|
5831
|
+
"America/Creston",
|
|
5832
|
+
"America/Cuiaba",
|
|
5833
|
+
"America/Curacao",
|
|
5834
|
+
"America/Danmarkshavn",
|
|
5835
|
+
"America/Dawson",
|
|
5836
|
+
"America/Dawson_Creek",
|
|
5837
|
+
"America/Denver",
|
|
5838
|
+
"America/Detroit",
|
|
5839
|
+
"America/Dominica",
|
|
5840
|
+
"America/Edmonton",
|
|
5841
|
+
"America/Eirunepe",
|
|
5842
|
+
"America/El_Salvador",
|
|
5843
|
+
"America/Fort_Nelson",
|
|
5844
|
+
"America/Fortaleza",
|
|
5845
|
+
"America/Glace_Bay",
|
|
5846
|
+
"America/Godthab",
|
|
5847
|
+
"America/Goose_Bay",
|
|
5848
|
+
"America/Grand_Turk",
|
|
5849
|
+
"America/Grenada",
|
|
5850
|
+
"America/Guadeloupe",
|
|
5851
|
+
"America/Guatemala",
|
|
5852
|
+
"America/Guayaquil",
|
|
5853
|
+
"America/Guyana",
|
|
5854
|
+
"America/Halifax",
|
|
5855
|
+
"America/Havana",
|
|
5856
|
+
"America/Hermosillo",
|
|
5857
|
+
"America/Indiana/Knox",
|
|
5858
|
+
"America/Indiana/Marengo",
|
|
5859
|
+
"America/Indiana/Petersburg",
|
|
5860
|
+
"America/Indiana/Tell_City",
|
|
5861
|
+
"America/Indiana/Vevay",
|
|
5862
|
+
"America/Indiana/Vincennes",
|
|
5863
|
+
"America/Indiana/Winamac",
|
|
5864
|
+
"America/Indianapolis",
|
|
5865
|
+
"America/Inuvik",
|
|
5866
|
+
"America/Iqaluit",
|
|
5867
|
+
"America/Jamaica",
|
|
5868
|
+
"America/Jujuy",
|
|
5869
|
+
"America/Juneau",
|
|
5870
|
+
"America/Kentucky/Monticello",
|
|
5871
|
+
"America/Kralendijk",
|
|
5872
|
+
"America/La_Paz",
|
|
5873
|
+
"America/Lima",
|
|
5874
|
+
"America/Los_Angeles",
|
|
5875
|
+
"America/Louisville",
|
|
5876
|
+
"America/Lower_Princes",
|
|
5877
|
+
"America/Maceio",
|
|
5878
|
+
"America/Managua",
|
|
5879
|
+
"America/Manaus",
|
|
5880
|
+
"America/Marigot",
|
|
5881
|
+
"America/Martinique",
|
|
5882
|
+
"America/Matamoros",
|
|
5883
|
+
"America/Mazatlan",
|
|
5884
|
+
"America/Mendoza",
|
|
5885
|
+
"America/Menominee",
|
|
5886
|
+
"America/Merida",
|
|
5887
|
+
"America/Metlakatla",
|
|
5888
|
+
"America/Mexico_City",
|
|
5889
|
+
"America/Miquelon",
|
|
5890
|
+
"America/Moncton",
|
|
5891
|
+
"America/Monterrey",
|
|
5892
|
+
"America/Montevideo",
|
|
5893
|
+
"America/Montserrat",
|
|
5894
|
+
"America/Nassau",
|
|
5895
|
+
"America/New_York",
|
|
5896
|
+
"America/Nome",
|
|
5897
|
+
"America/Noronha",
|
|
5898
|
+
"America/North_Dakota/Beulah",
|
|
5899
|
+
"America/North_Dakota/Center",
|
|
5900
|
+
"America/North_Dakota/New_Salem",
|
|
5901
|
+
"America/Ojinaga",
|
|
5902
|
+
"America/Panama",
|
|
5903
|
+
"America/Paramaribo",
|
|
5904
|
+
"America/Phoenix",
|
|
5905
|
+
"America/Port-au-Prince",
|
|
5906
|
+
"America/Port_of_Spain",
|
|
5907
|
+
"America/Porto_Velho",
|
|
5908
|
+
"America/Puerto_Rico",
|
|
5909
|
+
"America/Punta_Arenas",
|
|
5910
|
+
"America/Rankin_Inlet",
|
|
5911
|
+
"America/Recife",
|
|
5912
|
+
"America/Regina",
|
|
5913
|
+
"America/Resolute",
|
|
5914
|
+
"America/Rio_Branco",
|
|
5915
|
+
"America/Santarem",
|
|
5916
|
+
"America/Santiago",
|
|
5917
|
+
"America/Santo_Domingo",
|
|
5918
|
+
"America/Sao_Paulo",
|
|
5919
|
+
"America/Scoresbysund",
|
|
5920
|
+
"America/Sitka",
|
|
5921
|
+
"America/St_Barthelemy",
|
|
5922
|
+
"America/St_Johns",
|
|
5923
|
+
"America/St_Kitts",
|
|
5924
|
+
"America/St_Lucia",
|
|
5925
|
+
"America/St_Thomas",
|
|
5926
|
+
"America/St_Vincent",
|
|
5927
|
+
"America/Swift_Current",
|
|
5928
|
+
"America/Tegucigalpa",
|
|
5929
|
+
"America/Thule",
|
|
5930
|
+
"America/Tijuana",
|
|
5931
|
+
"America/Toronto",
|
|
5932
|
+
"America/Tortola",
|
|
5933
|
+
"America/Vancouver",
|
|
5934
|
+
"America/Whitehorse",
|
|
5935
|
+
"America/Winnipeg",
|
|
5936
|
+
"America/Yakutat",
|
|
5937
|
+
"Antarctica/Casey",
|
|
5938
|
+
"Antarctica/Davis",
|
|
5939
|
+
"Antarctica/DumontDUrville",
|
|
5940
|
+
"Antarctica/Macquarie",
|
|
5941
|
+
"Antarctica/Mawson",
|
|
5942
|
+
"Antarctica/McMurdo",
|
|
5943
|
+
"Antarctica/Palmer",
|
|
5944
|
+
"Antarctica/Rothera",
|
|
5945
|
+
"Antarctica/Syowa",
|
|
5946
|
+
"Antarctica/Troll",
|
|
5947
|
+
"Antarctica/Vostok",
|
|
5948
|
+
"Arctic/Longyearbyen",
|
|
5949
|
+
"Asia/Aden",
|
|
5950
|
+
"Asia/Almaty",
|
|
5951
|
+
"Asia/Amman",
|
|
5952
|
+
"Asia/Anadyr",
|
|
5953
|
+
"Asia/Aqtau",
|
|
5954
|
+
"Asia/Aqtobe",
|
|
5955
|
+
"Asia/Ashgabat",
|
|
5956
|
+
"Asia/Atyrau",
|
|
5957
|
+
"Asia/Baghdad",
|
|
5958
|
+
"Asia/Bahrain",
|
|
5959
|
+
"Asia/Baku",
|
|
5960
|
+
"Asia/Bangkok",
|
|
5961
|
+
"Asia/Barnaul",
|
|
5962
|
+
"Asia/Beirut",
|
|
5963
|
+
"Asia/Bishkek",
|
|
5964
|
+
"Asia/Brunei",
|
|
5965
|
+
"Asia/Calcutta",
|
|
5966
|
+
"Asia/Chita",
|
|
5967
|
+
"Asia/Colombo",
|
|
5968
|
+
"Asia/Damascus",
|
|
5969
|
+
"Asia/Dhaka",
|
|
5970
|
+
"Asia/Dili",
|
|
5971
|
+
"Asia/Dubai",
|
|
5972
|
+
"Asia/Dushanbe",
|
|
5973
|
+
"Asia/Famagusta",
|
|
5974
|
+
"Asia/Gaza",
|
|
5975
|
+
"Asia/Hebron",
|
|
5976
|
+
"Asia/Hong_Kong",
|
|
5977
|
+
"Asia/Hovd",
|
|
5978
|
+
"Asia/Irkutsk",
|
|
5979
|
+
"Asia/Jakarta",
|
|
5980
|
+
"Asia/Jayapura",
|
|
5981
|
+
"Asia/Jerusalem",
|
|
5982
|
+
"Asia/Kabul",
|
|
5983
|
+
"Asia/Kamchatka",
|
|
5984
|
+
"Asia/Karachi",
|
|
5985
|
+
"Asia/Katmandu",
|
|
5986
|
+
"Asia/Khandyga",
|
|
5987
|
+
"Asia/Krasnoyarsk",
|
|
5988
|
+
"Asia/Kuala_Lumpur",
|
|
5989
|
+
"Asia/Kuching",
|
|
5990
|
+
"Asia/Kuwait",
|
|
5991
|
+
"Asia/Macau",
|
|
5992
|
+
"Asia/Magadan",
|
|
5993
|
+
"Asia/Makassar",
|
|
5994
|
+
"Asia/Manila",
|
|
5995
|
+
"Asia/Muscat",
|
|
5996
|
+
"Asia/Nicosia",
|
|
5997
|
+
"Asia/Novokuznetsk",
|
|
5998
|
+
"Asia/Novosibirsk",
|
|
5999
|
+
"Asia/Omsk",
|
|
6000
|
+
"Asia/Oral",
|
|
6001
|
+
"Asia/Phnom_Penh",
|
|
6002
|
+
"Asia/Pontianak",
|
|
6003
|
+
"Asia/Pyongyang",
|
|
6004
|
+
"Asia/Qatar",
|
|
6005
|
+
"Asia/Qostanay",
|
|
6006
|
+
"Asia/Qyzylorda",
|
|
6007
|
+
"Asia/Rangoon",
|
|
6008
|
+
"Asia/Riyadh",
|
|
6009
|
+
"Asia/Saigon",
|
|
6010
|
+
"Asia/Sakhalin",
|
|
6011
|
+
"Asia/Samarkand",
|
|
6012
|
+
"Asia/Seoul",
|
|
6013
|
+
"Asia/Shanghai",
|
|
6014
|
+
"Asia/Singapore",
|
|
6015
|
+
"Asia/Srednekolymsk",
|
|
6016
|
+
"Asia/Taipei",
|
|
6017
|
+
"Asia/Tashkent",
|
|
6018
|
+
"Asia/Tbilisi",
|
|
6019
|
+
"Asia/Tehran",
|
|
6020
|
+
"Asia/Thimphu",
|
|
6021
|
+
"Asia/Tokyo",
|
|
6022
|
+
"Asia/Tomsk",
|
|
6023
|
+
"Asia/Ulaanbaatar",
|
|
6024
|
+
"Asia/Urumqi",
|
|
6025
|
+
"Asia/Ust-Nera",
|
|
6026
|
+
"Asia/Vientiane",
|
|
6027
|
+
"Asia/Vladivostok",
|
|
6028
|
+
"Asia/Yakutsk",
|
|
6029
|
+
"Asia/Yekaterinburg",
|
|
6030
|
+
"Asia/Yerevan",
|
|
6031
|
+
"Atlantic/Azores",
|
|
6032
|
+
"Atlantic/Bermuda",
|
|
6033
|
+
"Atlantic/Canary",
|
|
6034
|
+
"Atlantic/Cape_Verde",
|
|
6035
|
+
"Atlantic/Faeroe",
|
|
6036
|
+
"Atlantic/Madeira",
|
|
6037
|
+
"Atlantic/Reykjavik",
|
|
6038
|
+
"Atlantic/South_Georgia",
|
|
6039
|
+
"Atlantic/St_Helena",
|
|
6040
|
+
"Atlantic/Stanley",
|
|
6041
|
+
"Australia/Adelaide",
|
|
6042
|
+
"Australia/Brisbane",
|
|
6043
|
+
"Australia/Broken_Hill",
|
|
6044
|
+
"Australia/Darwin",
|
|
6045
|
+
"Australia/Eucla",
|
|
6046
|
+
"Australia/Hobart",
|
|
6047
|
+
"Australia/Lindeman",
|
|
6048
|
+
"Australia/Lord_Howe",
|
|
6049
|
+
"Australia/Melbourne",
|
|
6050
|
+
"Australia/Perth",
|
|
6051
|
+
"Australia/Sydney",
|
|
6052
|
+
"Europe/Amsterdam",
|
|
6053
|
+
"Europe/Andorra",
|
|
6054
|
+
"Europe/Astrakhan",
|
|
6055
|
+
"Europe/Athens",
|
|
6056
|
+
"Europe/Belgrade",
|
|
6057
|
+
"Europe/Berlin",
|
|
6058
|
+
"Europe/Bratislava",
|
|
6059
|
+
"Europe/Brussels",
|
|
6060
|
+
"Europe/Bucharest",
|
|
6061
|
+
"Europe/Budapest",
|
|
6062
|
+
"Europe/Busingen",
|
|
6063
|
+
"Europe/Chisinau",
|
|
6064
|
+
"Europe/Copenhagen",
|
|
6065
|
+
"Europe/Dublin",
|
|
6066
|
+
"Europe/Gibraltar",
|
|
6067
|
+
"Europe/Guernsey",
|
|
6068
|
+
"Europe/Helsinki",
|
|
6069
|
+
"Europe/Isle_of_Man",
|
|
6070
|
+
"Europe/Istanbul",
|
|
6071
|
+
"Europe/Jersey",
|
|
6072
|
+
"Europe/Kaliningrad",
|
|
6073
|
+
"Europe/Kiev",
|
|
6074
|
+
"Europe/Kirov",
|
|
6075
|
+
"Europe/Lisbon",
|
|
6076
|
+
"Europe/Ljubljana",
|
|
6077
|
+
"Europe/London",
|
|
6078
|
+
"Europe/Luxembourg",
|
|
6079
|
+
"Europe/Madrid",
|
|
6080
|
+
"Europe/Malta",
|
|
6081
|
+
"Europe/Mariehamn",
|
|
6082
|
+
"Europe/Minsk",
|
|
6083
|
+
"Europe/Monaco",
|
|
6084
|
+
"Europe/Moscow",
|
|
6085
|
+
"Europe/Oslo",
|
|
6086
|
+
"Europe/Paris",
|
|
6087
|
+
"Europe/Podgorica",
|
|
6088
|
+
"Europe/Prague",
|
|
6089
|
+
"Europe/Riga",
|
|
6090
|
+
"Europe/Rome",
|
|
6091
|
+
"Europe/Samara",
|
|
6092
|
+
"Europe/San_Marino",
|
|
6093
|
+
"Europe/Sarajevo",
|
|
6094
|
+
"Europe/Saratov",
|
|
6095
|
+
"Europe/Simferopol",
|
|
6096
|
+
"Europe/Skopje",
|
|
6097
|
+
"Europe/Sofia",
|
|
6098
|
+
"Europe/Stockholm",
|
|
6099
|
+
"Europe/Tallinn",
|
|
6100
|
+
"Europe/Tirane",
|
|
6101
|
+
"Europe/Ulyanovsk",
|
|
6102
|
+
"Europe/Vaduz",
|
|
6103
|
+
"Europe/Vatican",
|
|
6104
|
+
"Europe/Vienna",
|
|
6105
|
+
"Europe/Vilnius",
|
|
6106
|
+
"Europe/Volgograd",
|
|
6107
|
+
"Europe/Warsaw",
|
|
6108
|
+
"Europe/Zagreb",
|
|
6109
|
+
"Europe/Zurich",
|
|
6110
|
+
"Indian/Antananarivo",
|
|
6111
|
+
"Indian/Chagos",
|
|
6112
|
+
"Indian/Christmas",
|
|
6113
|
+
"Indian/Cocos",
|
|
6114
|
+
"Indian/Comoro",
|
|
6115
|
+
"Indian/Kerguelen",
|
|
6116
|
+
"Indian/Mahe",
|
|
6117
|
+
"Indian/Maldives",
|
|
6118
|
+
"Indian/Mauritius",
|
|
6119
|
+
"Indian/Mayotte",
|
|
6120
|
+
"Indian/Reunion",
|
|
6121
|
+
"Pacific/Apia",
|
|
6122
|
+
"Pacific/Auckland",
|
|
6123
|
+
"Pacific/Bougainville",
|
|
6124
|
+
"Pacific/Chatham",
|
|
6125
|
+
"Pacific/Easter",
|
|
6126
|
+
"Pacific/Efate",
|
|
6127
|
+
"Pacific/Enderbury",
|
|
6128
|
+
"Pacific/Fakaofo",
|
|
6129
|
+
"Pacific/Fiji",
|
|
6130
|
+
"Pacific/Funafuti",
|
|
6131
|
+
"Pacific/Galapagos",
|
|
6132
|
+
"Pacific/Gambier",
|
|
6133
|
+
"Pacific/Guadalcanal",
|
|
6134
|
+
"Pacific/Guam",
|
|
6135
|
+
"Pacific/Honolulu",
|
|
6136
|
+
"Pacific/Kiritimati",
|
|
6137
|
+
"Pacific/Kosrae",
|
|
6138
|
+
"Pacific/Kwajalein",
|
|
6139
|
+
"Pacific/Majuro",
|
|
6140
|
+
"Pacific/Marquesas",
|
|
6141
|
+
"Pacific/Midway",
|
|
6142
|
+
"Pacific/Nauru",
|
|
6143
|
+
"Pacific/Niue",
|
|
6144
|
+
"Pacific/Norfolk",
|
|
6145
|
+
"Pacific/Noumea",
|
|
6146
|
+
"Pacific/Pago_Pago",
|
|
6147
|
+
"Pacific/Palau",
|
|
6148
|
+
"Pacific/Pitcairn",
|
|
6149
|
+
"Pacific/Ponape",
|
|
6150
|
+
"Pacific/Port_Moresby",
|
|
6151
|
+
"Pacific/Rarotonga",
|
|
6152
|
+
"Pacific/Saipan",
|
|
6153
|
+
"Pacific/Tahiti",
|
|
6154
|
+
"Pacific/Tarawa",
|
|
6155
|
+
"Pacific/Tongatapu",
|
|
6156
|
+
"Pacific/Truk",
|
|
6157
|
+
"Pacific/Wake",
|
|
6158
|
+
"Pacific/Wallis"
|
|
6159
|
+
];
|
|
6160
|
+
|
|
6161
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/billing.js
|
|
6162
|
+
var countryCode = z27.string().regex(/^[A-Z]{2}$/);
|
|
6163
|
+
var EU_COUNTRIES = [
|
|
6164
|
+
"AT",
|
|
6165
|
+
"BE",
|
|
6166
|
+
"BG",
|
|
6167
|
+
"CY",
|
|
6168
|
+
"CZ",
|
|
6169
|
+
"DE",
|
|
6170
|
+
"DK",
|
|
6171
|
+
"EE",
|
|
6172
|
+
"ES",
|
|
6173
|
+
"FI",
|
|
6174
|
+
"FR",
|
|
6175
|
+
"GR",
|
|
6176
|
+
"HR",
|
|
6177
|
+
"HU",
|
|
6178
|
+
"IE",
|
|
6179
|
+
"IT",
|
|
6180
|
+
"LT",
|
|
6181
|
+
"LU",
|
|
6182
|
+
"LV",
|
|
6183
|
+
"MT",
|
|
6184
|
+
"NL",
|
|
6185
|
+
"PL",
|
|
6186
|
+
"PT",
|
|
6187
|
+
"RO",
|
|
6188
|
+
"SE",
|
|
6189
|
+
"SI",
|
|
6190
|
+
"SK"
|
|
6191
|
+
];
|
|
6192
|
+
var SELLER_COUNTRY = "DE";
|
|
6193
|
+
function isEuCountry(country) {
|
|
6194
|
+
return EU_COUNTRIES.includes(country);
|
|
6195
|
+
}
|
|
6196
|
+
var payerKind = z27.enum(["company", "person"]);
|
|
6197
|
+
var billingCycle = z27.enum(["monthly", "yearly"]);
|
|
6198
|
+
var vatTreatment = z27.enum(["de_standard", "reverse_charge", "outside_eu"]);
|
|
6199
|
+
var payerRefusalRule = z27.enum(["company_required", "vat_id_required", "vat_id_invalid"]);
|
|
6200
|
+
var viesPendingReason = z27.enum(["vies_unavailable", "vies_unverified", "vies_identifier_missing"]);
|
|
6201
|
+
var vatDecision = z27.discriminatedUnion("state", [
|
|
6202
|
+
z27.object({ state: z27.literal("eligible"), treatment: vatTreatment, rate_percent: z27.number().int().min(0).max(100) }).strict(),
|
|
6203
|
+
z27.object({ state: z27.literal("pending"), reason: viesPendingReason }).strict(),
|
|
6204
|
+
z27.object({ state: z27.literal("refused"), rule: payerRefusalRule }).strict()
|
|
6205
|
+
]);
|
|
6206
|
+
var billingAddress = z27.object({
|
|
6207
|
+
line1: z27.string().trim().min(1).max(200).meta({ description: "Street and number, or the first address line." }),
|
|
6208
|
+
line2: z27.string().trim().max(200).nullable().meta({ description: "A second address line, or `null` when there is none." }),
|
|
6209
|
+
postal_code: z27.string().trim().min(1).max(20).meta({ description: "Postal or ZIP code." }),
|
|
6210
|
+
city: z27.string().trim().min(1).max(100).meta({ description: "City or town." }),
|
|
6211
|
+
country: countryCode.meta({ description: "The billing country, used for purchase eligibility and VAT." }),
|
|
6212
|
+
state: z27.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." })
|
|
6213
|
+
}).strict();
|
|
6214
|
+
var billingDetails = z27.discriminatedUnion("kind", [
|
|
6215
|
+
z27.object({
|
|
6216
|
+
kind: z27.literal("company").meta({ description: "Billed as a company." }),
|
|
6217
|
+
company_name: z27.string().trim().min(1).max(200).meta({ description: "The company's legal name, printed on the invoice." }),
|
|
6218
|
+
vat_id: z27.string().trim().max(20).nullable().meta({
|
|
6219
|
+
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."
|
|
6220
|
+
}),
|
|
6221
|
+
tax_id: z27.string().trim().max(100).nullable().optional().meta({ description: "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it." }),
|
|
6222
|
+
address: billingAddress.meta({ description: "The billing address." }),
|
|
6223
|
+
invoice_email: z27.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
6224
|
+
}).strict().meta({ description: "A company: name and an optional VAT ID, never 'full name'." }),
|
|
6225
|
+
z27.object({
|
|
6226
|
+
kind: z27.literal("person").meta({ description: "Billed as a person." }),
|
|
6227
|
+
full_name: z27.string().trim().min(1).max(200).meta({ description: "The person's full name, printed on the invoice." }),
|
|
6228
|
+
address: billingAddress.meta({ description: "The billing address." }),
|
|
6229
|
+
invoice_email: z27.email().meta({ description: "Where invoices and billing mail are sent." })
|
|
6230
|
+
}).strict().meta({ description: "A person: a full name, never a VAT ID \u2014 only a company can be VAT-registered." })
|
|
6231
|
+
]);
|
|
6232
|
+
var purchaseBillingDetails = billingDetails.options[0].superRefine((payer, ctx) => {
|
|
6233
|
+
const country = payer.address.country;
|
|
6234
|
+
if (isEuCountry(country) && country !== SELLER_COUNTRY && !payer.vat_id?.trim()) {
|
|
6235
|
+
ctx.addIssue({ code: "custom", path: ["vat_id"], message: "vat_id_required" });
|
|
6236
|
+
}
|
|
6237
|
+
if (!isEuCountry(country) && !payer.tax_id?.trim()) {
|
|
6238
|
+
ctx.addIssue({ code: "custom", path: ["tax_id"], message: "tax_id_required" });
|
|
6239
|
+
}
|
|
6240
|
+
if (country === "US" && !/^[A-Z]{2}$/.test(payer.address.state ?? "")) {
|
|
6241
|
+
ctx.addIssue({ code: "custom", path: ["address", "state"], message: "us_state_required" });
|
|
6242
|
+
}
|
|
6243
|
+
}).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." });
|
|
6244
|
+
var purchaseOperation = z27.enum(["checkout", "paid_change", "invoice_payment", "payment_method_invoice", "mandate_setup"]);
|
|
6245
|
+
var chargeOperation = purchaseOperation.exclude(["mandate_setup"]);
|
|
6246
|
+
var checkoutRequest = z27.object({
|
|
6247
|
+
operation_key: purchaseOperationKey,
|
|
6248
|
+
plan: z27.enum(["plus", "pro"]).meta({ description: "The paid plan to buy; Basic requires no checkout." }),
|
|
6249
|
+
cycle: billingCycle.meta({ description: "Monthly, or yearly at 15 percent off." }),
|
|
6250
|
+
addons: orgAddons.partial().strict().optional().meta({ description: "Add-on units to buy; Pro only. Cloud refuses add-ons on Plus." }),
|
|
6251
|
+
billing: purchaseBillingDetails.meta({ description: "The company buying the plan. Country requirements, current VIES and the email policy must pass before charging." }),
|
|
6252
|
+
accept_terms: z27.literal(true).optional().meta({ description: "Deprecated draft input. It is not evidence of a displayed C.4 declaration and never confirms an order." })
|
|
6253
|
+
}).strict();
|
|
6254
|
+
var purchaseCents = z27.number().int().nonnegative();
|
|
6255
|
+
var purchaseQuote = z27.object({
|
|
6256
|
+
currency: z27.literal("eur").meta({ description: "Every new quote is in EUR." }),
|
|
6257
|
+
net_cents: purchaseCents.meta({ description: "Current charge excluding VAT, in cents." }),
|
|
6258
|
+
vat_cents: purchaseCents.meta({ description: "VAT on the current charge, in cents." }),
|
|
6259
|
+
gross_cents: purchaseCents.meta({ description: "Total to confirm, including VAT, in cents." }),
|
|
6260
|
+
rate_percent: z27.number().int().min(0).max(100).meta({ description: "VAT rate in whole percent." })
|
|
6261
|
+
}).strict();
|
|
6262
|
+
var quoteIdentity = {
|
|
6263
|
+
quote_revision: z27.string().trim().min(1).max(200).meta({ description: "Opaque revision of the displayed quote; echo it when confirming." }),
|
|
6264
|
+
buyer_fingerprint: z27.string().trim().min(1).max(200).meta({ description: "Opaque revision of buyer details and email policy; never full VIES evidence." })
|
|
6265
|
+
};
|
|
6266
|
+
var billingDecisionDisplayRequest = z27.object({
|
|
6267
|
+
operation_key: purchaseOperationKey,
|
|
6268
|
+
operation: z27.enum(["checkout", "paid_change"])
|
|
6269
|
+
}).strict();
|
|
6270
|
+
var selectionBase = {
|
|
6271
|
+
plan: z27.enum(["basic", "plus", "pro"]),
|
|
6272
|
+
cycle: billingCycle,
|
|
6273
|
+
addons: orgAddons
|
|
6274
|
+
};
|
|
6275
|
+
var purchaseSelection = z27.object(selectionBase).strict();
|
|
6276
|
+
var planChangeSelection = z27.object({ ...selectionBase, keep: planChangeKeep.nullable() }).strict();
|
|
6277
|
+
var addonLine = z27.object({ addon: addonKey, quantity: z27.number().int().positive(), net_cents: purchaseCents }).strict();
|
|
6278
|
+
var treatmentRules = [
|
|
6279
|
+
{ if: { properties: { vat_treatment: { const: "de_standard" } }, required: ["vat_treatment"] }, then: { properties: { quote: { properties: { rate_percent: { const: 19 } } } } } },
|
|
6280
|
+
{ 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" } } } },
|
|
6281
|
+
{ 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" } } } }
|
|
6282
|
+
];
|
|
6283
|
+
var billingDecisionAmounts = z27.object({
|
|
6284
|
+
currency: z27.literal("eur"),
|
|
6285
|
+
quote: purchaseQuote,
|
|
6286
|
+
plan_net_cents: purchaseCents,
|
|
6287
|
+
addon_lines: z27.array(addonLine),
|
|
6288
|
+
period_net_cents: purchaseCents,
|
|
6289
|
+
period_vat_cents: purchaseCents,
|
|
6290
|
+
period_gross_cents: purchaseCents,
|
|
6291
|
+
vat_treatment: vatTreatment,
|
|
6292
|
+
vat_treatment_line: z27.string().min(1),
|
|
6293
|
+
due_today_gross_cents: purchaseCents,
|
|
6294
|
+
prorated_net_cents: purchaseCents.nullable(),
|
|
6295
|
+
renewal_net_cents: purchaseCents
|
|
6296
|
+
}).strict().superRefine((value, ctx) => {
|
|
6297
|
+
const invalid = (field, message) => ctx.addIssue({ code: "custom", path: [field], message });
|
|
6298
|
+
if (value.quote.gross_cents !== value.quote.net_cents + value.quote.vat_cents)
|
|
6299
|
+
invalid("quote", "Quote gross must equal net plus VAT.");
|
|
6300
|
+
if (value.period_gross_cents !== value.period_net_cents + value.period_vat_cents)
|
|
6301
|
+
invalid("period_gross_cents", "Period gross must equal net plus VAT.");
|
|
6302
|
+
if (value.period_net_cents !== value.plan_net_cents + value.addon_lines.reduce((sum, line) => sum + line.net_cents, 0))
|
|
6303
|
+
invalid("period_net_cents", "Plan and add-on lines must reconcile.");
|
|
6304
|
+
if (value.due_today_gross_cents !== value.quote.gross_cents)
|
|
6305
|
+
invalid("due_today_gross_cents", "Due today must equal the quote gross.");
|
|
6306
|
+
if (value.vat_treatment === "de_standard") {
|
|
6307
|
+
if (value.quote.rate_percent !== 19 || !value.vat_treatment_line.startsWith("19% German VAT: "))
|
|
6308
|
+
invalid("vat_treatment", "German VAT requires 19 percent and its display line.");
|
|
6309
|
+
} else if (value.quote.rate_percent !== 0 || value.quote.vat_cents !== 0 || value.period_vat_cents !== 0 || value.vat_treatment_line !== (value.vat_treatment === "reverse_charge" ? "Reverse charge \u2014 VAT payable by the recipient" : "Not taxable in Germany")) {
|
|
6310
|
+
invalid("vat_treatment", "Zero-rated treatment, rate, VAT and line must agree.");
|
|
6311
|
+
}
|
|
6312
|
+
}).meta({ allOf: treatmentRules });
|
|
6313
|
+
var utcInstant = z27.iso.datetime().regex(/Z$/);
|
|
6314
|
+
var ianaTimeZone = z27.enum(ianaTimeZones);
|
|
6315
|
+
function localDate(instant, timeZone) {
|
|
6316
|
+
try {
|
|
6317
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(instant));
|
|
6318
|
+
const get = (type) => parts.find((part) => part.type === type)?.value ?? "";
|
|
6319
|
+
return `${get("year")}-${get("month")}-${get("day")}`;
|
|
6320
|
+
} catch {
|
|
6321
|
+
return null;
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
var billingDecisionPeriod = z27.object({
|
|
6325
|
+
display_time_zone: ianaTimeZone,
|
|
6326
|
+
starts_on: z27.iso.date(),
|
|
6327
|
+
starts_at: utcInstant.nullable(),
|
|
6328
|
+
current_period_ends_at: utcInstant,
|
|
6329
|
+
renews_at: utcInstant,
|
|
6330
|
+
effective: z27.discriminatedUnion("mode", [
|
|
6331
|
+
z27.object({ mode: z27.literal("on_confirmation"), quoted_as_of_at: utcInstant, local_date: z27.iso.date() }).strict(),
|
|
6332
|
+
z27.object({ mode: z27.literal("scheduled"), at: utcInstant, at_period_end: z27.boolean() }).strict()
|
|
6333
|
+
])
|
|
6334
|
+
}).strict().superRefine((period, ctx) => {
|
|
6335
|
+
if (period.starts_at && localDate(period.starts_at, period.display_time_zone) !== period.starts_on)
|
|
6336
|
+
ctx.addIssue({ code: "custom", path: ["starts_on"], message: "Start date must match the instant in the display zone." });
|
|
6337
|
+
if (period.effective.mode === "scheduled" && period.effective.at_period_end && period.effective.at !== period.current_period_ends_at)
|
|
6338
|
+
ctx.addIssue({ code: "custom", path: ["effective", "at"], message: "Period-end effect must equal the current period boundary." });
|
|
6339
|
+
if (period.effective.mode === "on_confirmation" && localDate(period.effective.quoted_as_of_at, period.display_time_zone) !== period.effective.local_date)
|
|
6340
|
+
ctx.addIssue({ code: "custom", path: ["effective", "local_date"], message: "Quoted local date must match the display zone." });
|
|
6341
|
+
});
|
|
6342
|
+
var declaration = z27.object({
|
|
6343
|
+
text_id: z27.literal("DR-1374-draft-3-C.4"),
|
|
6344
|
+
text: z27.string().min(1),
|
|
6345
|
+
terms: legalDocumentReference,
|
|
6346
|
+
dpa: legalDocumentReference
|
|
6347
|
+
}).strict().superRefine((value, ctx) => {
|
|
6348
|
+
if (value.terms.url === value.dpa.url)
|
|
6349
|
+
ctx.addIssue({ code: "custom", path: ["dpa"], message: "Terms and DPA require separate version URLs." });
|
|
6350
|
+
});
|
|
6351
|
+
var snapshotBase = z27.object({
|
|
6352
|
+
snapshot_id: z27.uuid(),
|
|
6353
|
+
decision_id: z27.uuid(),
|
|
6354
|
+
operation_key: purchaseOperationKey,
|
|
6355
|
+
owner_id: z27.uuid(),
|
|
6356
|
+
organization_id: z27.uuid(),
|
|
6357
|
+
organization_name: z27.string().min(1),
|
|
6358
|
+
...quoteIdentity,
|
|
6359
|
+
amounts: billingDecisionAmounts,
|
|
6360
|
+
period: billingDecisionPeriod,
|
|
6361
|
+
declaration,
|
|
6362
|
+
expires_at: utcInstant
|
|
6363
|
+
}).strict();
|
|
6364
|
+
var billingDecisionSnapshot = z27.discriminatedUnion("decision_kind", [
|
|
6365
|
+
snapshotBase.extend({ decision_kind: z27.literal("checkout"), selection: purchaseSelection }).strict(),
|
|
6366
|
+
snapshotBase.extend({ decision_kind: z27.literal("paid_change"), selection: purchaseSelection }).strict(),
|
|
6367
|
+
snapshotBase.extend({ decision_kind: z27.literal("plan_change"), selection: planChangeSelection }).strict()
|
|
6368
|
+
]).superRefine((value, ctx) => {
|
|
6369
|
+
const expected = `By selecting \u201COrder and pay\u201D, you agree to the Terms of Service and the Data Processing Agreement for ${value.organization_name}.`;
|
|
6370
|
+
if (value.declaration.text !== expected)
|
|
6371
|
+
ctx.addIssue({ code: "custom", path: ["declaration", "text"], message: "Declaration must match the approved C.4 sentence and organization." });
|
|
6372
|
+
if (value.amounts.vat_treatment === "de_standard") {
|
|
6373
|
+
const euro = (cents2) => new Intl.NumberFormat("en-US", { style: "currency", currency: "EUR" }).format(cents2 / 100);
|
|
6374
|
+
const period = value.selection.cycle === "monthly" ? "month" : "year";
|
|
6375
|
+
const line = `19% German VAT: ${euro(value.amounts.period_vat_cents)}; total ${euro(value.amounts.period_gross_cents)} per ${period}`;
|
|
6376
|
+
if (value.amounts.vat_treatment_line !== line)
|
|
6377
|
+
ctx.addIssue({ code: "custom", path: ["amounts", "vat_treatment_line"], message: "German VAT line must match the displayed period amounts and cycle." });
|
|
6378
|
+
}
|
|
6379
|
+
const lines = value.amounts.addon_lines;
|
|
6380
|
+
const expectedAddons = addonKey.options.filter((key) => value.selection.addons[key] > 0);
|
|
6381
|
+
if (lines.length !== expectedAddons.length || lines.some((line, i) => line.addon !== expectedAddons[i] || line.quantity !== value.selection.addons[line.addon]))
|
|
6382
|
+
ctx.addIssue({ code: "custom", path: ["amounts", "addon_lines"], message: "Add-on lines must match absolute selection in catalogue order." });
|
|
6383
|
+
});
|
|
6384
|
+
var billingDecisionDisplayResponse = z27.object({
|
|
6385
|
+
confirmation_proof: confirmationProof,
|
|
6386
|
+
expires_at: utcInstant,
|
|
6387
|
+
snapshot: billingDecisionSnapshot
|
|
6388
|
+
}).strict().superRefine((value, ctx) => {
|
|
6389
|
+
if (value.expires_at !== value.snapshot.expires_at)
|
|
6390
|
+
ctx.addIssue({ code: "custom", path: ["expires_at"], message: "Display and snapshot expiry must match." });
|
|
6391
|
+
});
|
|
6392
|
+
var planChangePrepareResponse = z27.object({
|
|
6393
|
+
change_id: z27.uuid(),
|
|
6394
|
+
display: billingDecisionDisplayResponse
|
|
6395
|
+
}).strict().superRefine((value, ctx) => {
|
|
6396
|
+
if (value.display.snapshot.decision_kind !== "plan_change")
|
|
6397
|
+
ctx.addIssue({ code: "custom", path: ["display", "snapshot", "decision_kind"], message: "Prepared plan changes require a plan-change display." });
|
|
6398
|
+
if (value.display.snapshot.decision_id !== value.change_id)
|
|
6399
|
+
ctx.addIssue({ code: "custom", path: ["display", "snapshot", "decision_id"], message: "Display must refer to the prepared change." });
|
|
6400
|
+
}).meta({ allOf: [{ properties: { display: { properties: { snapshot: { properties: { decision_kind: { const: "plan_change" } } } } } } }] });
|
|
6401
|
+
var intentIdentity = {
|
|
6402
|
+
intent_id: z27.uuid().meta({ description: "Opaque persisted purchase intent identity." }),
|
|
6403
|
+
operation_key: purchaseOperationKey,
|
|
6404
|
+
operation: chargeOperation,
|
|
6405
|
+
invoice_id: z27.uuid().optional().meta({ description: "The due charge or issued invoice, for invoice-paying operations." })
|
|
6406
|
+
};
|
|
6407
|
+
var purchaseHoldReason = z27.enum([
|
|
6408
|
+
"legacy_usd_invoice",
|
|
6409
|
+
"legacy_payer_unresolved",
|
|
6410
|
+
"mandate_policy_unresolved",
|
|
6411
|
+
// The Lexware issuer cutover (2026-10-19, fleetless/fleetless#327): holds
|
|
6412
|
+
// during and after the move from Cloud-issued invoices to charges billed
|
|
6413
|
+
// through Lexware.
|
|
6414
|
+
"lexware_contact_pending",
|
|
6415
|
+
"lexware_contact_changed",
|
|
6416
|
+
"issuer_cutover_in_progress",
|
|
6417
|
+
"lexware_issuance_paused"
|
|
6418
|
+
]);
|
|
6419
|
+
var purchaseRefusalRule = z27.enum(["company_required", "vat_id_required", "vat_id_invalid", "tax_id_required", "us_state_required", "public_email_domain", "invoice_not_open"]);
|
|
6420
|
+
var intentRules = [
|
|
6421
|
+
{ if: { properties: { operation: { enum: ["invoice_payment", "payment_method_invoice"] } }, required: ["operation"] }, then: { required: ["invoice_id"] } },
|
|
6422
|
+
{ if: { properties: { operation: { const: "mandate_setup" } }, required: ["operation"] }, then: { properties: { state: { const: "held" }, reason: { const: "mandate_policy_unresolved" } }, required: ["reason"] } },
|
|
6423
|
+
{ if: { properties: { reason: { const: "mandate_policy_unresolved" } }, required: ["reason"] }, then: { properties: { operation: { const: "mandate_setup" } } } },
|
|
6424
|
+
{ if: { properties: { payment: { properties: { kind: { const: "mandate" } }, required: ["kind"] } }, required: ["payment"] }, then: { properties: { operation: { const: "paid_change" } } } }
|
|
6425
|
+
];
|
|
6426
|
+
function validateIntent(intent, ctx) {
|
|
6427
|
+
if (["invoice_payment", "payment_method_invoice"].includes(intent.operation) && !intent.invoice_id) {
|
|
6428
|
+
ctx.addIssue({ code: "custom", path: ["invoice_id"], message: "An invoice-paying intent must name the invoice or due charge." });
|
|
6429
|
+
}
|
|
6430
|
+
if (intent.operation === "mandate_setup" !== (intent.reason === "mandate_policy_unresolved")) {
|
|
6431
|
+
ctx.addIssue({ code: "custom", path: ["reason"], message: "Mandate setup remains held until its integration policy is resolved." });
|
|
6432
|
+
}
|
|
6433
|
+
if (intent.payment?.kind === "mandate" && intent.operation !== "paid_change") {
|
|
6434
|
+
ctx.addIssue({ code: "custom", path: ["payment"], message: "Owner checkout and invoice payment require a hosted payment." });
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
var draftVariants = [
|
|
6438
|
+
z27.object({ ...intentIdentity, state: z27.literal("awaiting_vies"), reason: viesPendingReason, next_attempt_at: z27.iso.datetime() }).strict(),
|
|
6439
|
+
z27.object({ ...intentIdentity, ...quoteIdentity, state: z27.literal("eligible"), quote: purchaseQuote }).strict(),
|
|
6440
|
+
z27.object({
|
|
6441
|
+
...intentIdentity,
|
|
6442
|
+
operation: purchaseOperation,
|
|
6443
|
+
state: z27.literal("held"),
|
|
6444
|
+
reason: purchaseHoldReason,
|
|
6445
|
+
original_amount: z27.object({ currency: planCurrency, gross_cents: purchaseCents }).strict().optional().meta({ description: "Recorded balance of a held invoice; not a new quote or authorization." })
|
|
6446
|
+
}).strict(),
|
|
6447
|
+
z27.object({ ...intentIdentity, state: z27.literal("invalid_vat_id"), field: z27.literal("billing.vat_id"), rule: z27.literal("vat_id_invalid") }).strict(),
|
|
6448
|
+
z27.object({ ...intentIdentity, state: z27.literal("refused"), field: z27.string().min(1), rule: purchaseRefusalRule }).strict()
|
|
6449
|
+
];
|
|
6450
|
+
var purchaseIntentDraft = z27.discriminatedUnion("state", draftVariants).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6451
|
+
var paymentStartedVariant = z27.object({
|
|
6452
|
+
...intentIdentity,
|
|
6453
|
+
state: z27.literal("payment_started"),
|
|
6454
|
+
payment_id: z27.uuid(),
|
|
6455
|
+
payment: z27.discriminatedUnion("kind", [
|
|
6456
|
+
z27.object({ kind: z27.literal("hosted"), checkout_id: z27.uuid(), checkout_url: z27.url() }).strict(),
|
|
6457
|
+
z27.object({ kind: z27.literal("mandate") }).strict()
|
|
6458
|
+
])
|
|
6459
|
+
}).strict();
|
|
6460
|
+
var purchaseIntentPaymentStarted = paymentStartedVariant.superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6461
|
+
var purchaseIntentAcceptedWithoutPayment = z27.object({
|
|
6462
|
+
intent_id: z27.uuid(),
|
|
6463
|
+
operation_key: purchaseOperationKey,
|
|
6464
|
+
operation: z27.literal("paid_change"),
|
|
6465
|
+
state: z27.literal("accepted_no_payment"),
|
|
6466
|
+
...quoteIdentity,
|
|
6467
|
+
quote: purchaseQuote.extend({ net_cents: z27.literal(0), vat_cents: z27.literal(0), gross_cents: z27.literal(0) }).strict(),
|
|
6468
|
+
accepted_at: utcInstant
|
|
6469
|
+
}).strict();
|
|
6470
|
+
var purchaseIntent = z27.discriminatedUnion("state", [
|
|
6471
|
+
...draftVariants,
|
|
6472
|
+
paymentStartedVariant,
|
|
6473
|
+
purchaseIntentAcceptedWithoutPayment
|
|
6474
|
+
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6475
|
+
var nonChangeOperation = purchaseOperation.exclude(["paid_change"]);
|
|
6476
|
+
var nonChangeChargeOperation = chargeOperation.exclude(["paid_change"]);
|
|
6477
|
+
var nonChangeDraft = z27.discriminatedUnion("state", [
|
|
6478
|
+
draftVariants[0].safeExtend({ operation: nonChangeChargeOperation }),
|
|
6479
|
+
draftVariants[1].safeExtend({ operation: nonChangeChargeOperation }),
|
|
6480
|
+
draftVariants[2].safeExtend({ operation: nonChangeOperation }),
|
|
6481
|
+
draftVariants[3].safeExtend({ operation: nonChangeChargeOperation }),
|
|
6482
|
+
draftVariants[4].safeExtend({ operation: nonChangeChargeOperation })
|
|
6483
|
+
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6484
|
+
var nonChangePaymentStarted = paymentStartedVariant.safeExtend({ operation: nonChangeChargeOperation }).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6485
|
+
var paidChangeOperation = z27.literal("paid_change");
|
|
6486
|
+
var paidChangeDraft = z27.discriminatedUnion("state", [
|
|
6487
|
+
draftVariants[0].safeExtend({ operation: paidChangeOperation }),
|
|
6488
|
+
draftVariants[1].safeExtend({ operation: paidChangeOperation }),
|
|
6489
|
+
draftVariants[2].safeExtend({ operation: paidChangeOperation }),
|
|
6490
|
+
draftVariants[3].safeExtend({ operation: paidChangeOperation }),
|
|
6491
|
+
draftVariants[4].safeExtend({ operation: paidChangeOperation })
|
|
6492
|
+
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
6493
|
+
var checkoutResponse = z27.union([nonChangeDraft, nonChangePaymentStarted]);
|
|
6494
|
+
var purchaseIntentLookupQuery = z27.object({
|
|
6495
|
+
operation_key: purchaseOperationKey.optional().meta({ description: "The client operation key; supply this or intent_id, never both." }),
|
|
6496
|
+
intent_id: z27.uuid().optional().meta({ description: "The persisted intent ID; supply this or operation_key, never both." }),
|
|
6497
|
+
operation: purchaseOperation.meta({ description: "Expected operation; a mismatch returns 404 without disclosure." })
|
|
6498
|
+
}).strict().refine((q) => q.operation_key !== void 0 !== (q.intent_id !== void 0), {
|
|
6499
|
+
message: "Supply exactly one of operation_key or intent_id."
|
|
6500
|
+
}).meta({
|
|
6501
|
+
description: "Owner lookup by exactly one identity and the expected operation.",
|
|
6502
|
+
oneOf: [
|
|
6503
|
+
{ required: ["operation_key"], not: { required: ["intent_id"] } },
|
|
6504
|
+
{ required: ["intent_id"], not: { required: ["operation_key"] } }
|
|
6505
|
+
]
|
|
6506
|
+
});
|
|
6507
|
+
var provedConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity, confirmation_proof: confirmationProof };
|
|
6508
|
+
var invoiceConfirmation = { operation_key: purchaseOperationKey, ...quoteIdentity };
|
|
6509
|
+
var purchaseIntentConfirmRequest = z27.discriminatedUnion("operation", [
|
|
6510
|
+
z27.object({ ...provedConfirmation, operation: z27.literal("checkout") }).strict(),
|
|
6511
|
+
z27.object({ ...provedConfirmation, operation: z27.literal("paid_change") }).strict(),
|
|
6512
|
+
z27.object({ ...invoiceConfirmation, operation: z27.literal("invoice_payment") }).strict(),
|
|
6513
|
+
z27.object({ ...invoiceConfirmation, operation: z27.literal("payment_method_invoice") }).strict()
|
|
6514
|
+
]);
|
|
6515
|
+
var purchaseConflictDetails = z27.discriminatedUnion("rule", [
|
|
6516
|
+
z27.object({ field: z27.literal("operation_key"), rule: z27.literal("operation_key_reused") }).strict(),
|
|
6517
|
+
z27.object({ field: z27.literal("intent"), rule: z27.enum(["stale_quote", "buyer_changed", "not_eligible", "invoice_not_open"]), current_intent: purchaseIntent }).strict()
|
|
6518
|
+
]);
|
|
6519
|
+
var invoicePayRequest = z27.object({ operation_key: purchaseOperationKey }).strict();
|
|
6520
|
+
var checkoutStatus = z27.object({
|
|
6521
|
+
checkout_id: z27.uuid().meta({ description: "The checkout this status is for." }),
|
|
6522
|
+
status: z27.enum(["pending", "paid", "failed", "canceled", "expired"]).meta({
|
|
6523
|
+
description: "Mollie's payment status, as `reconcilePayment` last read it."
|
|
6524
|
+
}),
|
|
6525
|
+
purpose: z27.enum(["upgrade", "payment_method", "invoice"]).meta({
|
|
6526
|
+
description: "What this checkout paid for: a plan upgrade, a payment-method change, or an open invoice."
|
|
6527
|
+
}),
|
|
6528
|
+
plan: planId.meta({ description: "The org's plan after applying \u2014 unchanged unless `purpose` is `upgrade` and `status` is `paid`." })
|
|
6529
|
+
});
|
|
6530
|
+
var vatIdStatus = z27.enum(["valid", "unverified", "invalid", "unavailable"]);
|
|
6531
|
+
var vatIdCheckRequest = z27.object({
|
|
6532
|
+
country: countryCode.meta({ description: "The VAT ID's country." }),
|
|
6533
|
+
vat_id: z27.string().trim().min(1).max(20).meta({ description: "The VAT ID as typed; normalized before the VIES lookup (`normalizeVatId`)." })
|
|
6534
|
+
}).strict();
|
|
6535
|
+
var vatCheckIdentity = { vat_id: z27.string(), name: z27.string().nullable() };
|
|
6536
|
+
var vatIdCheckResponse = z27.discriminatedUnion("state", [
|
|
6537
|
+
z27.object({ ...vatCheckIdentity, state: z27.literal("eligible"), status: z27.literal("valid") }).strict(),
|
|
6538
|
+
z27.object({ ...vatCheckIdentity, state: z27.literal("refused"), status: z27.literal("invalid"), rule: z27.literal("vat_id_invalid") }).strict(),
|
|
6539
|
+
z27.object({ ...vatCheckIdentity, state: z27.literal("pending"), status: z27.enum(["valid", "unverified", "unavailable"]), reason: viesPendingReason }).strict()
|
|
6540
|
+
]);
|
|
6541
|
+
var billingChangeRequest = z27.object({
|
|
6542
|
+
operation_key: purchaseOperationKey,
|
|
6543
|
+
plan: z27.enum(["plus", "pro"]).optional().meta({ description: "The target plan. Omitted leaves the plan as it is." }),
|
|
6544
|
+
cycle: billingCycle.optional().meta({ description: "The target cycle. Omitted leaves the cycle as it is." }),
|
|
6545
|
+
addons: orgAddons.partial().strict().optional().meta({
|
|
6546
|
+
description: "Absolute add-on counts to end up with, not a delta. Omitted leaves add-ons as they are."
|
|
6547
|
+
})
|
|
6548
|
+
}).strict().refine((r) => r.plan !== void 0 || r.cycle !== void 0 || r.addons !== void 0, { message: "Name a plan, a cycle or add-ons." });
|
|
6549
|
+
var billingCancelRequest = z27.object({
|
|
6550
|
+
reason: z27.string().trim().max(500).optional().meta({ description: "An optional free-text reason. Shown to nobody but Fleetless." })
|
|
6551
|
+
}).strict();
|
|
6552
|
+
var billingDetailsUpdate = z27.object({
|
|
6553
|
+
company_name: z27.string().trim().min(1).max(200).optional(),
|
|
6554
|
+
address: billingAddress.optional(),
|
|
6555
|
+
tax_id: z27.string().trim().max(100).nullable().optional(),
|
|
6556
|
+
invoice_email: z27.email().optional().meta({ description: "Replaces the invoice email. Omitted leaves it as it is." }),
|
|
6557
|
+
vat_id: z27.string().trim().max(20).nullable().optional().meta({
|
|
6558
|
+
description: "Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES."
|
|
6559
|
+
})
|
|
6560
|
+
}).strict();
|
|
6561
|
+
var paymentMethodKind = z27.enum(["card", "paypal", "applepay"]);
|
|
6562
|
+
var paymentMethodChangeRequest = z27.object({
|
|
6563
|
+
operation_key: purchaseOperationKey,
|
|
6564
|
+
method: paymentMethodKind.meta({
|
|
6565
|
+
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."
|
|
6566
|
+
})
|
|
6567
|
+
}).strict();
|
|
6568
|
+
var billingAccountStatus = z27.enum(["pending", "active", "past_due", "canceled"]);
|
|
6569
|
+
var paymentMethod = z27.discriminatedUnion("kind", [
|
|
6570
|
+
z27.object({
|
|
6571
|
+
kind: z27.literal("card").meta({ description: "A card mandate." }),
|
|
6572
|
+
brand: z27.string().meta({ description: "The card network, as Mollie's mandate reports it, e.g. 'Visa'." }),
|
|
6573
|
+
last4: z27.string().regex(/^\d{4}$/).meta({ description: "The last four digits of the card." }),
|
|
6574
|
+
expires: z27.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." })
|
|
6575
|
+
}),
|
|
6576
|
+
z27.object({
|
|
6577
|
+
kind: z27.literal("applepay").meta({ description: "A card mandate from an Apple Pay first payment \u2014 Mollie stores it as `creditcard`; Fleetless labels it Apple Pay." }),
|
|
6578
|
+
brand: z27.string().meta({ description: "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'." }),
|
|
6579
|
+
last4: z27.string().regex(/^\d{4}$/).meta({ description: "The last four digits of the card behind Apple Pay." }),
|
|
6580
|
+
expires: z27.string().regex(/^\d{2}\/\d{2}$/).meta({ description: "Expiry as Mollie's mandate shows it, 'MM/YY'." })
|
|
6581
|
+
}),
|
|
6582
|
+
z27.object({
|
|
6583
|
+
kind: z27.literal("paypal").meta({ description: "A PayPal mandate." }),
|
|
6584
|
+
account: z27.string().meta({ description: "The PayPal account Mollie's mandate names." })
|
|
6585
|
+
})
|
|
6586
|
+
]);
|
|
6587
|
+
var invoiceStatus = z27.enum(["open", "paid", "uncollectible", "cancelled"]);
|
|
6588
|
+
var billingInvoice = z27.object({
|
|
6589
|
+
id: z27.uuid().meta({ description: "The invoice's id." }),
|
|
6590
|
+
number: z27.string().regex(/^FL-\d{4}-\d{4,}$/).meta({
|
|
6591
|
+
description: "The invoice number: `FL-<year>-<seq>`, `seq` zero-padded to four digits, gapless per calendar year in `Europe/Berlin`."
|
|
6592
|
+
}),
|
|
6593
|
+
issued_at: z27.iso.datetime().meta({ description: "When the invoice was issued." }),
|
|
6594
|
+
status: invoiceStatus.meta({ description: "This invoice's own status." }),
|
|
6595
|
+
cancellation_document_url: z27.string().nullable().meta({
|
|
6596
|
+
description: "Relative same-origin path `/api/billing/invoices/<id>/pdf?kind=cancellation` for a cancelled historical Cloud invoice with a stored cancellation number and PDF; otherwise `null`. The path uses this invoice's id, not the cancellation number."
|
|
6597
|
+
}),
|
|
6598
|
+
currency: planCurrency.meta({ description: "The org's billing currency." }),
|
|
6599
|
+
net_cents: z27.number().int().nonnegative().meta({ description: "The charge, excluding VAT, in integer cents." }),
|
|
6600
|
+
vat_rate_percent: z27.number().int().min(0).max(100).meta({ description: "The VAT rate applied, in whole percent." }),
|
|
6601
|
+
vat_cents: z27.number().int().nonnegative().meta({ description: "VAT, in integer cents (`vatCents`)." }),
|
|
6602
|
+
gross_cents: z27.number().int().nonnegative().meta({ description: "Net plus VAT, in integer cents." })
|
|
6603
|
+
});
|
|
6604
|
+
var billingInvoicePdfQuery = z27.object({
|
|
6605
|
+
kind: z27.enum(["invoice", "cancellation"]).optional().meta({ description: "The original invoice or its stored cancellation PDF; omitted means `invoice`." })
|
|
6606
|
+
}).strict();
|
|
6607
|
+
var billingAccount = z27.object({
|
|
6608
|
+
payer: billingDetails.meta({ description: "Who is paying, and the invoice address and email." }),
|
|
6609
|
+
vat_id_status: vatIdStatus.nullable().meta({ description: "The payer's VAT ID check, or `null` when no VAT ID was given." }),
|
|
6610
|
+
vat: z27.object({
|
|
6611
|
+
treatment: vatTreatment.meta({ description: "How the account is taxed." }),
|
|
6612
|
+
rate_percent: z27.number().int().meta({ description: "The VAT rate, in whole percent." })
|
|
6613
|
+
}).nullable().meta({ description: "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account." }),
|
|
6614
|
+
currency: planCurrency.meta({ description: "The org's billing currency, fixed at the first payment." }),
|
|
6615
|
+
cycle: billingCycle.meta({ description: "The current billing cycle." }),
|
|
6616
|
+
status: billingAccountStatus.meta({ description: "The account's own status." }),
|
|
6617
|
+
period_starts_at: z27.iso.datetime().nullable().meta({ description: "The current period's start. `null` before the first payment." }),
|
|
6618
|
+
period_ends_at: z27.iso.datetime().nullable().meta({ description: "The current period's end. `null` before the first payment." }),
|
|
6619
|
+
next_charge: z27.object({
|
|
6620
|
+
at: z27.iso.datetime().meta({ description: "When the next charge is due." }),
|
|
6621
|
+
net_cents: z27.number().int().meta({ description: "The next charge, excluding VAT, in integer cents." }),
|
|
6622
|
+
vat_cents: z27.number().int().meta({ description: "VAT on the next charge, in integer cents." }),
|
|
6623
|
+
gross_cents: z27.number().int().meta({ description: "The next charge including VAT, in integer cents." })
|
|
6624
|
+
}).nullable().meta({ description: "`null` while a cancel is pending or nothing else renews." }),
|
|
6625
|
+
scheduled: z27.object({
|
|
6626
|
+
cycle: billingCycle.nullable().meta({ description: "A cycle change queued for the period's end, or `null`." }),
|
|
6627
|
+
addons: orgAddons.nullable().meta({ description: "Add-on counts queued for the period's end, or `null`." })
|
|
6628
|
+
}).meta({ description: "What takes effect at the period's end." }),
|
|
6629
|
+
dunning: z27.object({
|
|
6630
|
+
invoice_id: z27.uuid().meta({
|
|
6631
|
+
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`."
|
|
6632
|
+
}),
|
|
6633
|
+
gross_cents: z27.number().int().meta({
|
|
6634
|
+
description: "The amount owed, in integer cents \u2014 after a partial chargeback only the charged-back part."
|
|
6635
|
+
}),
|
|
6636
|
+
due_at: z27.iso.datetime().meta({ description: "The charge's due date; retries and the lock count from here." }),
|
|
6637
|
+
next_retry_at: z27.iso.datetime().nullable().meta({
|
|
6638
|
+
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."
|
|
6639
|
+
}),
|
|
6640
|
+
lock_at: z27.iso.datetime().meta({ description: "When the org is locked if still unpaid (`BILLING_LOCK_DAY`)." }),
|
|
6641
|
+
failure: z27.string().nullable().meta({
|
|
6642
|
+
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."
|
|
6643
|
+
})
|
|
6644
|
+
}).nullable().meta({ description: "`null` while nothing is overdue. During a VAT-ID hold the charge is due but not yet invoiced." })
|
|
6645
|
+
});
|
|
6646
|
+
var billingIssuer = z27.enum(["cloud", "lexware"]);
|
|
6647
|
+
var billingChargeInvoice = z27.discriminatedUnion("state", [
|
|
6648
|
+
z27.object({ state: z27.literal("not_issued").meta({ description: "Not collected (due, a failed retry, or uncollectible): no invoice exists." }) }).strict(),
|
|
6649
|
+
z27.object({ state: z27.literal("pending").meta({ description: "Collected; the Lexware invoice is not yet confirmed." }) }).strict(),
|
|
6650
|
+
z27.object({
|
|
6651
|
+
state: z27.literal("issued").meta({ description: "Lexware has confirmed the invoice." }),
|
|
6652
|
+
document_id: z27.uuid().meta({ description: "The Lexware document's id \u2014 read it with `GET /api/billing/documents/:id`." })
|
|
6653
|
+
}).strict()
|
|
6654
|
+
]);
|
|
6655
|
+
var chargeInvoiceRules = [
|
|
6656
|
+
{ if: { properties: { status: { const: "paid" } }, required: ["status"] }, then: { properties: { invoice: { properties: { state: { enum: ["pending", "issued"] } } } } } },
|
|
6657
|
+
{ if: { properties: { status: { enum: ["due", "uncollectible", "cancelled"] } }, required: ["status"] }, then: { properties: { invoice: { properties: { state: { const: "not_issued" } } } } } }
|
|
6658
|
+
];
|
|
6659
|
+
function refuseChargeInvoiceMismatch(charge, ctx) {
|
|
6660
|
+
const notIssued = charge.invoice.state === "not_issued";
|
|
6661
|
+
if (charge.status === "paid" === notIssued) {
|
|
6662
|
+
ctx.addIssue({ code: "custom", path: ["invoice"], message: "A paid charge has an invoice (pending or issued); every other status has none yet." });
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
var billingCharge = z27.object({
|
|
6666
|
+
id: z27.uuid().meta({ description: "The due charge's id \u2014 never a Cloud invoice number. Pay it with `POST /api/billing/charges/:id/pay`." }),
|
|
6667
|
+
kind: z27.enum(["first", "renewal", "change"]).meta({ description: "What caused the charge: the first charge after checkout, a scheduled renewal, or a mid-period plan change." }),
|
|
6668
|
+
status: z27.enum(["due", "paid", "uncollectible", "cancelled"]).meta({
|
|
6669
|
+
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."
|
|
6670
|
+
}),
|
|
6671
|
+
currency: z27.literal("eur").meta({ description: "Every charge billed through Lexware is EUR." }),
|
|
6672
|
+
net_cents: z27.number().int().nonnegative().meta({ description: "The charge, excluding VAT, in integer cents." }),
|
|
6673
|
+
vat_rate_percent: z27.number().int().min(0).max(100).meta({ description: "The VAT rate applied, in whole percent." }),
|
|
6674
|
+
vat_cents: z27.number().int().nonnegative().meta({ description: "VAT, in integer cents (`vatCents`)." }),
|
|
6675
|
+
gross_cents: z27.number().int().nonnegative().meta({ description: "Net plus VAT, in integer cents." }),
|
|
6676
|
+
period_start: z27.iso.datetime().meta({ description: "The covered period's start." }),
|
|
6677
|
+
period_end: z27.iso.datetime().meta({ description: "The covered period's end." }),
|
|
6678
|
+
due_at: z27.iso.datetime().meta({ description: "When this charge is due." }),
|
|
6679
|
+
paid_at: z27.iso.datetime().nullable().meta({ description: "When this charge was paid, or `null` while unpaid." }),
|
|
6680
|
+
invoice: billingChargeInvoice.meta({ description: "Whether a Lexware invoice exists for this charge yet, and which document it names once it does." })
|
|
6681
|
+
}).strict().superRefine(refuseChargeInvoiceMismatch).meta({ allOf: chargeInvoiceRules });
|
|
6682
|
+
var chargePayRequest = invoicePayRequest;
|
|
6683
|
+
var billingView = z27.object({
|
|
6684
|
+
available: z27.boolean().meta({ description: "Whether this cloud takes payments at all \u2014 `false` when no Mollie key is configured." }),
|
|
6685
|
+
account: billingAccount.nullable().meta({ description: "`null` before the org has ever checked out." }),
|
|
6686
|
+
payment_method: paymentMethod.nullable().meta({ description: "The payment method on file, or `null`." }),
|
|
6687
|
+
payment_method_options: z27.array(z27.object({
|
|
6688
|
+
method: paymentMethodKind.meta({ description: "A method `POST /api/billing/payment-method` accepts now." }),
|
|
6689
|
+
pays_invoice: z27.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." })
|
|
6690
|
+
})).meta({
|
|
6691
|
+
description: "What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when it needs an open invoice and none is open; `[]` when the org has no billing account."
|
|
6692
|
+
}),
|
|
6693
|
+
issuer: billingIssuer.meta({ description: "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it." }),
|
|
6694
|
+
invoices: z27.array(billingInvoice).meta({ description: "Cloud-issued invoices from before the issuer cutover; read-only, never grows after it. Newest first, at most 24." }),
|
|
6695
|
+
charges: z27.array(billingCharge).meta({
|
|
6696
|
+
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`."
|
|
6697
|
+
})
|
|
6698
|
+
});
|
|
6699
|
+
var billingDocumentKind = z27.enum(["invoice", "credit_note", "down_payment_invoice", "bookkeeping_invoice", "bookkeeping_credit_note"]);
|
|
6700
|
+
var billingDocumentStatus = z27.enum(["open", "overdue", "paid", "paidoff", "voided", "transferred", "sepadebit"]);
|
|
6701
|
+
var billingDocumentProfile = z27.enum(["NONE", "EN16931", "XRechnung"]);
|
|
6702
|
+
var billingDocumentFormat = z27.enum(["pdf", "xml"]);
|
|
6703
|
+
var billingDocumentBase = z27.object({
|
|
6704
|
+
id: z27.uuid().meta({ description: "The Lexware voucher id. Opaque; read the document or its file by this id, never a locally invented one." }),
|
|
6705
|
+
kind: billingDocumentKind.meta({ description: "The document's kind." }),
|
|
6706
|
+
status: billingDocumentStatus.meta({ description: "The document's own status." }),
|
|
6707
|
+
number: z27.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." }),
|
|
6708
|
+
document_date: z27.iso.datetime({ offset: true }).meta({ description: "The date printed on the document." }),
|
|
6709
|
+
currency: z27.literal("EUR").meta({ description: "Every Lexware voucher this reads is EUR; nothing here reads a foreign-currency voucher." }),
|
|
6710
|
+
gross_cents: z27.number().int().meta({
|
|
6711
|
+
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."
|
|
6712
|
+
}),
|
|
6713
|
+
file: z27.enum(["available", "unavailable"]).meta({ description: "Whether Lexware holds a file for this document at all." })
|
|
6714
|
+
});
|
|
6715
|
+
function refuseWrongGrossSign(doc, ctx) {
|
|
6716
|
+
const isCredit = doc.kind === "credit_note" || doc.kind === "bookkeeping_credit_note";
|
|
6717
|
+
if (isCredit && doc.gross_cents > 0) {
|
|
6718
|
+
ctx.addIssue({ code: "custom", path: ["gross_cents"], message: "A credit note is zero or negative." });
|
|
6719
|
+
}
|
|
6720
|
+
if (!isCredit && doc.gross_cents < 0) {
|
|
6721
|
+
ctx.addIssue({ code: "custom", path: ["gross_cents"], message: "Only a credit note is negative." });
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6724
|
+
var billingDocument = billingDocumentBase.strict().superRefine(refuseWrongGrossSign);
|
|
6725
|
+
var billingDocumentList = z27.object({
|
|
6726
|
+
available: z27.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." }),
|
|
6727
|
+
complete: z27.boolean().meta({ description: "`false` when a document of an unsupported type or status was skipped rather than listed, counted in `unsupported_count`." }),
|
|
6728
|
+
unsupported_count: z27.number().int().nonnegative().meta({ description: "How many documents of an unsupported type or status were skipped; `complete` is `false` whenever this is above zero." }),
|
|
6729
|
+
documents: z27.array(billingDocument).meta({ description: "Every supported document this org has, complete or not \u2014 never a truncated page." })
|
|
6730
|
+
}).strict().superRefine((list, ctx) => {
|
|
6731
|
+
if (!list.available && (list.documents.length > 0 || !list.complete || list.unsupported_count > 0)) {
|
|
6732
|
+
ctx.addIssue({ code: "custom", path: ["available"], message: "available: false carries no documents, is complete and has no unsupported document." });
|
|
6733
|
+
}
|
|
6734
|
+
});
|
|
6735
|
+
var billingDocumentFileRole = z27.enum(["e_invoice", "preview", "document"]);
|
|
6736
|
+
var billingDocumentFormatEntry = z27.object({ format: billingDocumentFormat, role: billingDocumentFileRole }).strict();
|
|
6737
|
+
function sameFormats(a, b) {
|
|
6738
|
+
return a.length === b.length && a.every((entry, i) => entry.format === b[i].format && entry.role === b[i].role);
|
|
6739
|
+
}
|
|
6740
|
+
function refuseWrongFormats(doc, ctx) {
|
|
6741
|
+
const expected = doc.electronic_document_profile === "NONE" ? [{ format: "pdf", role: "document" }] : doc.electronic_document_profile === "EN16931" ? [{ format: "pdf", role: "e_invoice" }] : doc.electronic_document_profile === "XRechnung" ? [{ format: "xml", role: "e_invoice" }, { format: "pdf", role: "preview" }] : doc.file === "available" ? [{ format: "pdf", role: "document" }] : [];
|
|
6742
|
+
if (!sameFormats(doc.formats, expected)) {
|
|
6743
|
+
ctx.addIssue({ code: "custom", path: ["formats"], message: "formats must match electronic_document_profile (or, for a bookkeeping voucher, file) exactly." });
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
var billingDocumentDetail = billingDocumentBase.extend({
|
|
6747
|
+
electronic_document_profile: billingDocumentProfile.nullable().meta({ description: "The e-invoice profile, or `null` for a bookkeeping voucher \u2014 it has none." }),
|
|
6748
|
+
formats: z27.array(billingDocumentFormatEntry).meta({
|
|
6749
|
+
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 `[]`.'
|
|
6750
|
+
})
|
|
6751
|
+
}).strict().superRefine((doc, ctx) => {
|
|
6752
|
+
refuseWrongGrossSign(doc, ctx);
|
|
6753
|
+
refuseWrongFormats(doc, ctx);
|
|
6754
|
+
});
|
|
6755
|
+
var billingDocumentFileQuery = z27.object({
|
|
6756
|
+
format: billingDocumentFormat.default("pdf").meta({ description: "The file format to read. `xml` answers `404` unless the document is `XRechnung`." })
|
|
6757
|
+
}).strict();
|
|
6758
|
+
var acceptedBillingFields = {
|
|
6759
|
+
billing: billingView.meta({ description: "The billing view after the change." }),
|
|
6760
|
+
charged: billingInvoice.nullable().meta({ description: "The invoice charged now, or `null` when the change was only scheduled for the period's end." })
|
|
6761
|
+
};
|
|
6762
|
+
var acceptedPaidChange = z27.object({
|
|
6763
|
+
...acceptedBillingFields,
|
|
6764
|
+
intent: paymentStartedVariant.safeExtend({ operation: z27.literal("paid_change") })
|
|
6765
|
+
}).strict();
|
|
6766
|
+
var acceptedNoPaymentChange = z27.object({
|
|
6767
|
+
billing: billingView,
|
|
6768
|
+
charged: z27.null(),
|
|
6769
|
+
intent: purchaseIntentAcceptedWithoutPayment
|
|
6770
|
+
}).strict();
|
|
6771
|
+
var billingChangeResponse = z27.union([
|
|
6772
|
+
z27.object({ intent: paidChangeDraft }).strict(),
|
|
6773
|
+
acceptedPaidChange,
|
|
6774
|
+
acceptedNoPaymentChange
|
|
6775
|
+
]);
|
|
6776
|
+
var purchaseIntentResponse = z27.union([
|
|
6777
|
+
purchaseIntentDraft,
|
|
6778
|
+
nonChangePaymentStarted,
|
|
6779
|
+
acceptedPaidChange,
|
|
6780
|
+
acceptedNoPaymentChange
|
|
6781
|
+
]);
|
|
6782
|
+
|
|
6783
|
+
// node_modules/.pnpm/@fleetless+contracts@12.0.0/node_modules/@fleetless/contracts/dist/routes.js
|
|
5484
6784
|
var MCP_APP = MCP_APP_PATHS(":appIdentifier");
|
|
5485
6785
|
var APP_IDENTIFIER = {
|
|
5486
6786
|
name: "appIdentifier",
|
|
5487
6787
|
description: "The app's public identifier \u2014 `app.identifier`, what the console prints beside its copy button. It is not a secret: it appears in this path, in both metadata documents, and in the URL an app user pastes into their AI tool."
|
|
5488
6788
|
};
|
|
5489
6789
|
var IN_HANDLER_ROUTES = [
|
|
6790
|
+
// The old support bearer must reach the flow transaction after a newer
|
|
6791
|
+
// generation wins; a generic current-generation guard would hide that race.
|
|
6792
|
+
"POST /console/support/renew/fail",
|
|
5490
6793
|
"POST /mcp",
|
|
5491
6794
|
// The per-app endpoint, all three verbs: the bearer decides which app user
|
|
5492
6795
|
// is calling, and the path names none of that. Built from `MCP_APP` so the
|
|
@@ -5506,6 +6809,8 @@ var IN_HANDLER_ROUTES = [
|
|
|
5506
6809
|
"GET /api/asset-links/:token"
|
|
5507
6810
|
];
|
|
5508
6811
|
var DEVELOPER_GUARD = ["unauthorized", "token_expired", "token_revoked"];
|
|
6812
|
+
var BILLING_OFF = ["billing_unavailable"];
|
|
6813
|
+
var MOLLIE = ["payment_provider_unavailable"];
|
|
5509
6814
|
var CLIENT_GUARD = ["unauthorized", "token_expired", "token_revoked", "forbidden"];
|
|
5510
6815
|
function developerSignInRoutes(prefix) {
|
|
5511
6816
|
const section = prefix === "/console/oauth" ? "developer-auth" : "mcp";
|
|
@@ -5706,6 +7011,24 @@ var ROUTES = [
|
|
|
5706
7011
|
transport: "http",
|
|
5707
7012
|
notes: "No Owner tier: this can only ever touch the caller's own row, so there is nothing for a tier check to gate. Saving the name already held writes nothing and records no audit event \u2014 the org activity stream reaches every developer with the console open, and an event for a no-op would misreport that something changed."
|
|
5708
7013
|
},
|
|
7014
|
+
{
|
|
7015
|
+
method: "POST",
|
|
7016
|
+
path: "/api/auth/support/end",
|
|
7017
|
+
section: "developer-auth",
|
|
7018
|
+
summary: "Ends the calling support session immediately, from the console side.",
|
|
7019
|
+
audience: "internal",
|
|
7020
|
+
auth: "developer",
|
|
7021
|
+
rateLimited: false,
|
|
7022
|
+
ownerTier: false,
|
|
7023
|
+
status: 204,
|
|
7024
|
+
params: [],
|
|
7025
|
+
query: null,
|
|
7026
|
+
request: null,
|
|
7027
|
+
response: null,
|
|
7028
|
+
errors: [...DEVELOPER_GUARD, "forbidden"],
|
|
7029
|
+
transport: "http",
|
|
7030
|
+
notes: "Internal: the console calls this so the person a support session is driving can end it themselves \u2014 the counterpart to the operator side's `support_session_end` command, each ending the same session through its own path. The bearer must be a support token (`kind: 'support'`, `aud: 'console'`, minted by `POST /console/support/token`); any other token, including an ordinary developer session, answers `403 forbidden`. The session row behind the token is re-read on every request rather than trusted from its own claims, so a session already ended elsewhere is reflected here immediately."
|
|
7031
|
+
},
|
|
5709
7032
|
/* ------------------------------------ a developer's own second factors */
|
|
5710
7033
|
{
|
|
5711
7034
|
method: "GET",
|
|
@@ -5906,6 +7229,60 @@ var ROUTES = [
|
|
|
5906
7229
|
notes: "Answers `202` whether or not the address was already listed: the landing page's form must not be an oracle for who signed up. The operator notification is detached from the response \u2014 awaiting it made latency answer the question the status code refuses to \u2014 and is capped by its own global ceiling, above which the row is still written and the mail is skipped."
|
|
5907
7230
|
},
|
|
5908
7231
|
/* ---------------------------------------------------------------- org */
|
|
7232
|
+
{
|
|
7233
|
+
method: "GET",
|
|
7234
|
+
path: "/api/org/legal/acceptances",
|
|
7235
|
+
section: "org",
|
|
7236
|
+
summary: "Lists the calling organization's accepted legal document versions, newest first.",
|
|
7237
|
+
audience: "developer",
|
|
7238
|
+
auth: "developer",
|
|
7239
|
+
rateLimited: false,
|
|
7240
|
+
ownerTier: true,
|
|
7241
|
+
status: 200,
|
|
7242
|
+
params: [],
|
|
7243
|
+
query: legalAcceptanceListQuery,
|
|
7244
|
+
request: null,
|
|
7245
|
+
response: legalAcceptanceListResponse,
|
|
7246
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "support_forbidden", "validation_error"],
|
|
7247
|
+
transport: "http",
|
|
7248
|
+
notes: "A real Owner reads only the authenticated organization; Developer and support sessions cannot read it. Rows carry stored Terms and applicable DPA references, never the current versions substituted for history. The default page limit is 50, maximum 100. The opaque cursor is unpadded base64url of UTF-8 JSON `[accepted_at,id]`, with a six-digit UTC timestamp and lowercase UUID; Cloud rejects noncanonical tokens. Follow `next_cursor` until null. Equal timestamps sort by id descending; a new acceptance cannot displace older rows."
|
|
7249
|
+
},
|
|
7250
|
+
{
|
|
7251
|
+
method: "GET",
|
|
7252
|
+
path: "/api/org/controller-register",
|
|
7253
|
+
section: "org",
|
|
7254
|
+
summary: "Reads the calling owner's customer-confirmed controller register details.",
|
|
7255
|
+
audience: "developer",
|
|
7256
|
+
auth: "developer",
|
|
7257
|
+
rateLimited: false,
|
|
7258
|
+
ownerTier: true,
|
|
7259
|
+
status: 200,
|
|
7260
|
+
params: [],
|
|
7261
|
+
query: null,
|
|
7262
|
+
request: null,
|
|
7263
|
+
response: controllerRegisterOrgResponse,
|
|
7264
|
+
errors: [...DEVELOPER_GUARD, "tier_required"],
|
|
7265
|
+
transport: "http",
|
|
7266
|
+
notes: "The authenticated org is the only source. Members and support sessions receive no register data. A missing detail record is null. Billing data never populates this response. Access is audited."
|
|
7267
|
+
},
|
|
7268
|
+
{
|
|
7269
|
+
method: "PUT",
|
|
7270
|
+
path: "/api/org/controller-register",
|
|
7271
|
+
section: "org",
|
|
7272
|
+
summary: "Replaces the calling owner's confirmed controller register details.",
|
|
7273
|
+
audience: "developer",
|
|
7274
|
+
auth: "developer",
|
|
7275
|
+
rateLimited: false,
|
|
7276
|
+
ownerTier: true,
|
|
7277
|
+
status: 200,
|
|
7278
|
+
params: [],
|
|
7279
|
+
query: null,
|
|
7280
|
+
request: controllerRegisterWrite,
|
|
7281
|
+
response: controllerRegisterOrgResponse,
|
|
7282
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error"],
|
|
7283
|
+
transport: "http",
|
|
7284
|
+
notes: "The authenticated org is the only target. Null contacts explicitly clear earlier values. The write is atomic and audited; billing data is never an implicit source. Support sessions cannot write."
|
|
7285
|
+
},
|
|
5909
7286
|
{
|
|
5910
7287
|
method: "GET",
|
|
5911
7288
|
path: "/api/audit",
|
|
@@ -6148,7 +7525,7 @@ var ROUTES = [
|
|
|
6148
7525
|
response: mcpRolePreviewResponse,
|
|
6149
7526
|
errors: [...DEVELOPER_GUARD, "invalid_uuid", "not_found"],
|
|
6150
7527
|
transport: "http",
|
|
6151
|
-
notes: "Built by the same builder the MCP server's own `
|
|
7528
|
+
notes: "Built by the same builder the MCP server's own `robots.describe` uses, so the two cannot drift. It answers what the role *would* be offered and consults nothing about any user's actual MCP entitlement. A robot the role grants nothing on still appears, with an empty `exposures` \u2014 dropping it would read as \"not attached\", which is a different fact."
|
|
6152
7529
|
},
|
|
6153
7530
|
{
|
|
6154
7531
|
method: "PATCH",
|
|
@@ -7272,6 +8649,24 @@ var ROUTES = [
|
|
|
7272
8649
|
notes: "HTML: the email field, `Email me a code`, and `Sign in with a passkey`. Opening it binds the interaction to this browser with the browser-proof cookie, which every sign-in step after it checks. An expired, consumed, unknown or hand-edited interaction renders one page at `410`: which of the four it was is not a fact a stranger may learn, and to the person it is one fact anyway. The page resolves nothing about the address typed into it, so there is no enumeration oracle here at all."
|
|
7273
8650
|
},
|
|
7274
8651
|
...developerSignInRoutes("/console/oauth"),
|
|
8652
|
+
{
|
|
8653
|
+
method: "GET",
|
|
8654
|
+
path: "/waitlist-invite/:token",
|
|
8655
|
+
section: "developer-auth",
|
|
8656
|
+
summary: "Starts invite-bound console sign-up for a new Basic organization.",
|
|
8657
|
+
audience: "internal",
|
|
8658
|
+
auth: "none",
|
|
8659
|
+
rateLimited: true,
|
|
8660
|
+
ownerTier: false,
|
|
8661
|
+
status: 303,
|
|
8662
|
+
params: [{ name: "token", description: "The opaque waiting-list invitation token from the mailed link; never a query parameter." }],
|
|
8663
|
+
query: null,
|
|
8664
|
+
request: null,
|
|
8665
|
+
response: null,
|
|
8666
|
+
errors: ["rate_limited"],
|
|
8667
|
+
transport: "http",
|
|
8668
|
+
notes: "Exchanges a valid seven-day invitation for a short-lived browser-proof cookie, then redirects with `303` into console sign-up. The response uses `Cache-Control: no-store` and `Referrer-Policy: no-referrer`; no caller-supplied redirect is accepted. Invalid, expired, used, declined or replaced links render the same `410` page; the per-IP backstop answers `429 rate_limited`. Only the invited normalized email address may register a new Basic organization under `SIGNUP_MODE=closed`, and the signup code still proves control of that address. Every step rechecks the unspent generation, expiry and address; re-inviting immediately invalidates the old link and any signup it started. The GET does not consume the invitation: final organization/Owner creation, waiting-list transition and single-use consumption share one transaction. The interaction binds the invitation id/generation, never the raw token. Tokens, proof values and recipient links stay out of the directory, logs and operator responses. Team invitations through `/accept-invite/:token` still join an existing organization."
|
|
8669
|
+
},
|
|
7275
8670
|
{
|
|
7276
8671
|
method: "GET",
|
|
7277
8672
|
path: "/console/oauth/signup/:id",
|
|
@@ -7288,7 +8683,7 @@ var ROUTES = [
|
|
|
7288
8683
|
response: null,
|
|
7289
8684
|
errors: [],
|
|
7290
8685
|
transport: "http",
|
|
7291
|
-
notes: 'HTML: the email field and `Email me a code`, the first of three steps \u2014 email, code, organization. While the deployment runs in closed beta this renders the "sign-up is closed" card at `403` instead, keeping the interaction alive and pointing back at sign-in and the waiting list \u2014 the person may well already have an account.'
|
|
8686
|
+
notes: 'HTML: the email field and `Email me a code`, the first of three steps \u2014 email, code, organization. While the deployment runs in closed beta this renders the "sign-up is closed" card at `403` instead, keeping the interaction alive and pointing back at sign-in and the waiting list \u2014 the person may well already have an account. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may continue for the invited normalized email address and a new Basic organization. Each step rechecks its unspent invitation generation, expiry and address; ordinary public sign-up remains refused.'
|
|
7292
8687
|
},
|
|
7293
8688
|
{
|
|
7294
8689
|
method: "POST",
|
|
@@ -7306,7 +8701,7 @@ var ROUTES = [
|
|
|
7306
8701
|
response: null,
|
|
7307
8702
|
errors: ["rate_limited", "token_spent", "signup_closed", "validation_error", "email_taken"],
|
|
7308
8703
|
transport: "http",
|
|
7309
|
-
notes: 'A browser form post gets the code card; a JSON caller gets `{ "next", "email" }`, which has no schema. **No password**: the code mailed here, six digits valid ten minutes, proves the address. A per-interaction proof cookie is set here \u2014 it is what stops a third party from finishing a sign-up somebody else started. Sign-up is the one surface whose job is to say an address is taken, so `409 email_taken` is not a leak here.'
|
|
8704
|
+
notes: 'A browser form post gets the code card; a JSON caller gets `{ "next", "email" }`, which has no schema. **No password**: the code mailed here, six digits valid ten minutes, proves the address. A per-interaction proof cookie is set here \u2014 it is what stops a third party from finishing a sign-up somebody else started. Sign-up is the one surface whose job is to say an address is taken, so `409 email_taken` is not a leak here. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may request the code for the invited normalized email address; the unspent invitation generation, expiry and address are rechecked. Ordinary public sign-up still answers `403 signup_closed`.'
|
|
7310
8705
|
},
|
|
7311
8706
|
{
|
|
7312
8707
|
method: "POST",
|
|
@@ -7324,7 +8719,7 @@ var ROUTES = [
|
|
|
7324
8719
|
response: null,
|
|
7325
8720
|
errors: ["rate_limited", "token_spent", "signup_closed", "wrong_browser", "validation_error", "invalid_code"],
|
|
7326
8721
|
transport: "http",
|
|
7327
|
-
notes: 'A wrong code renders the code card again with the attempts left (`400 invalid_code`); a spent, expired or exhausted one is `410 token_spent`. The step before must have run in **this** browser (`401 wrong_browser`). A browser form post gets the organization card, the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema.'
|
|
8722
|
+
notes: 'A wrong code renders the code card again with the attempts left (`400 invalid_code`); a spent, expired or exhausted one is `410 token_spent`. The step before must have run in **this** browser (`401 wrong_browser`). A browser form post gets the organization card, the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may continue after rechecking its unspent invitation generation, expiry and invited normalized email address. Ordinary public sign-up still answers `403 signup_closed`.'
|
|
7328
8723
|
},
|
|
7329
8724
|
{
|
|
7330
8725
|
method: "POST",
|
|
@@ -7342,7 +8737,7 @@ var ROUTES = [
|
|
|
7342
8737
|
response: oauthRedirectResponse,
|
|
7343
8738
|
errors: ["rate_limited", "token_spent", "signup_closed", "wrong_browser", "validation_error", "email_taken"],
|
|
7344
8739
|
transport: "http",
|
|
7345
|
-
notes: "The form carries `org_name` only. The org and its founding Owner are created in one transaction, and only after the code step confirmed the address. Both steps before must have run in **this** browser: a missing or mismatched proof cookie is `401 wrong_browser` and the person is sent back to step one. `409 email_taken` when the address was taken meanwhile. A browser form post gets a `303` to the console callback; a JSON caller gets `redirect_to` at `200`. This is the only way an organisation is created: `POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address."
|
|
8740
|
+
notes: "The form carries `org_name` only. The org and its founding Owner are created in one transaction, and only after the code step confirmed the address. Both steps before must have run in **this** browser: a missing or mismatched proof cookie is `401 wrong_browser` and the person is sent back to step one. `409 email_taken` when the address was taken meanwhile. A browser form post gets a `303` to the console callback; a JSON caller gets `redirect_to` at `200`. This is the only way an organisation is created: `POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may create a new Basic organization for the invited normalized email address. Rechecking the unspent invitation generation, expiry and address, creating the org/Owner, transitioning the waiting-list entry and consuming the invitation happen in that same transaction. Ordinary public sign-up still answers `403 signup_closed`."
|
|
7346
8741
|
},
|
|
7347
8742
|
{
|
|
7348
8743
|
method: "POST",
|
|
@@ -7362,24 +8757,60 @@ var ROUTES = [
|
|
|
7362
8757
|
transport: "http",
|
|
7363
8758
|
notes: "Called by the console's own server, never by a browser. Refusals use RFC 6749 \xA75.2's flat `oauthError` shape \u2014 it is a token endpoint, and that is the dialect a caller of one expects \u2014 so it emits none of the codes in this reference. Proof of possession is checked before the replay check, and the single-use consume is atomic, so exactly one caller ever mints. The Org Admins membership is re-read here: the code was minted earlier, and a user moved out in between must not get a console session."
|
|
7364
8759
|
},
|
|
7365
|
-
/* --------------------------------- the Fleetless-hosted app pages */
|
|
7366
|
-
...HOSTED_APP_ROUTES,
|
|
7367
|
-
/* ---------------------------------------------------- mcp (the endpoint) */
|
|
7368
8760
|
{
|
|
7369
|
-
method: "
|
|
7370
|
-
path: "/
|
|
7371
|
-
section: "
|
|
7372
|
-
summary: "
|
|
8761
|
+
method: "POST",
|
|
8762
|
+
path: "/console/support/token",
|
|
8763
|
+
section: "developer-auth",
|
|
8764
|
+
summary: "Exchanges an operator's one-time support grant for a console session scoped to one org.",
|
|
7373
8765
|
audience: "internal",
|
|
7374
8766
|
auth: "none",
|
|
7375
|
-
rateLimited:
|
|
8767
|
+
rateLimited: true,
|
|
7376
8768
|
ownerTier: false,
|
|
7377
8769
|
status: 200,
|
|
7378
8770
|
params: [],
|
|
7379
8771
|
query: null,
|
|
7380
|
-
request:
|
|
7381
|
-
response:
|
|
7382
|
-
errors: [],
|
|
8772
|
+
request: supportTokenRequest,
|
|
8773
|
+
response: supportTokenResponse,
|
|
8774
|
+
errors: ["rate_limited"],
|
|
8775
|
+
transport: "http",
|
|
8776
|
+
notes: "Called by the console's own server, never by a browser \u2014 server to server only, exactly like `/console/oauth/token` beside it, but rate-limited where that one is not: the grant this exchanges is short-lived and worth guessing at, which a replay of the code exchange is not. `rate_limited` is the one code in this reference it can still answer, from the limiter itself, before the route's own dialect applies. Every other refusal uses the same RFC 6749 \xA75.2 flat `oauthError` shape, so this emits no other code in this reference: `invalid_grant` for a grant that is unknown, already used or expired, or for a verifier that does not match. Proof of possession is checked before the replay check, and the single-use consume is atomic, so exactly one caller ever mints from a given grant. The minted access token carries `kind: 'support'` and `aud: 'console'`, lives at most sixty minutes with no extension, and carries **no refresh token**: a support session that outlives its ceiling is a new grant and a new exchange, not a renewal. The session starts in `read` mode; switching one to `edit` is the operator side's `support_session_edit` command, not anything this route does."
|
|
8777
|
+
},
|
|
8778
|
+
{
|
|
8779
|
+
method: "POST",
|
|
8780
|
+
path: "/console/support/renew/fail",
|
|
8781
|
+
section: "developer-auth",
|
|
8782
|
+
summary: "Ends a current-generation support session after Console proves renewal authority failed.",
|
|
8783
|
+
audience: "internal",
|
|
8784
|
+
auth: "in_handler",
|
|
8785
|
+
rateLimited: false,
|
|
8786
|
+
ownerTier: false,
|
|
8787
|
+
status: 204,
|
|
8788
|
+
params: [],
|
|
8789
|
+
query: null,
|
|
8790
|
+
request: supportRenewFailRequest,
|
|
8791
|
+
response: null,
|
|
8792
|
+
errors: ["validation_error", "unauthorized", "not_found", "target_state_conflict"],
|
|
8793
|
+
transport: "http",
|
|
8794
|
+
notes: "Internal Console-to-Cloud POST only, no CORS. Console must first verify and consume signed Operator failure evidence bound to its original browser flow, or let Cloud timeout/sweep close an uncompleted flow; browser flow_id or error alone must never trigger this call. The evidence stays at Console: this strict Cloud request has no Operator or browser field. Authorization: Bearer <original fl_support>; a valid old bearer must reach the transaction even after another flow wins its generation, so a current-generation pre-handler must not intercept it. Cloud checks signature, audience, original expiry, exact stored bearer hash, S256 verifier, and bound session, org, mode and immutable creator subject. Lock session and flow in redemption order. After proof and before mutation, compare the saved credential generation: stale_generation takes precedence and cannot touch the winner. Only a live, pending, unauthorised current-generation flow before min(flow_created_at + 120 seconds, old credential expiry) atomically records failedAt, endedAt and audit/event. Success is 204 with no body. Missing callback closes an unauthorised expired flow at the next session check or sweep under the same generation fence. No failure extends a lease or compensates a committed redemption. Every refusal is Cache-Control: no-store with supportRenewFailRefusal body: 400 validation_error/invalid_flow for malformed JSON; 401 unauthorized/invalid_authority for missing or invalid bearer or proof; 404 not_found/invalid_flow for unknown or foreign flow, or /identity_mismatch for bound identity mismatch; 409 target_state_conflict/expired, /replayed, /session_inactive or /stale_generation. No failure response sets or clears fl_support. Network ambiguity is never a 204 and does not trigger an unconditional support_session.end."
|
|
8795
|
+
},
|
|
8796
|
+
/* --------------------------------- the Fleetless-hosted app pages */
|
|
8797
|
+
...HOSTED_APP_ROUTES,
|
|
8798
|
+
/* ---------------------------------------------------- mcp (the endpoint) */
|
|
8799
|
+
{
|
|
8800
|
+
method: "GET",
|
|
8801
|
+
path: "/mcp/welcome",
|
|
8802
|
+
section: "mcp",
|
|
8803
|
+
summary: "Serves the page that tells a person which URL to paste into their MCP client.",
|
|
8804
|
+
audience: "internal",
|
|
8805
|
+
auth: "none",
|
|
8806
|
+
rateLimited: false,
|
|
8807
|
+
ownerTier: false,
|
|
8808
|
+
status: 200,
|
|
8809
|
+
params: [],
|
|
8810
|
+
query: null,
|
|
8811
|
+
request: null,
|
|
8812
|
+
response: null,
|
|
8813
|
+
errors: [],
|
|
7383
8814
|
transport: "http",
|
|
7384
8815
|
notes: "HTML, one fixed document rendered once at startup \u2014 its inputs are process configuration, not request state. Cached for five minutes rather than a day, because the URLs it names can change with a deployment. Its content security policy admits the page's own inline style and script by SHA-256 rather than by `unsafe-inline`, and forbids every external fetch outright. A configured friendly URL that is not a usable absolute http(s) URL is ignored rather than rendered: a typo in a deployment variable must not put a broken URL in front of every end user."
|
|
7385
8816
|
},
|
|
@@ -7399,7 +8830,7 @@ var ROUTES = [
|
|
|
7399
8830
|
response: null,
|
|
7400
8831
|
errors: ["unauthorized", "forbidden"],
|
|
7401
8832
|
transport: "http",
|
|
7402
|
-
notes: "JSON-RPC over MCP's Streamable HTTP, so neither the request nor the response is a shape contracts describes; the tool arguments and results are the schemas in each tool definition. **Fleetless users only** \u2014 an app's users reach their own app endpoint instead. **The bearer is verified inside the handler**, not by a route guard: the identity comes from the token and the path names none, and the refusal has to carry a `WWW-Authenticate` challenge that a guard shared with the REST surface does not send. `Origin` is checked against the cloud's own, and a foreign one is the `403 forbidden` above. **Both catalogs, unconditionally**: every caller admitted here is a Fleetless user, so the tool list has nothing left to vary with and the admin-ness check on `tools/call` is gone \u2014 a console tool that is still narrower than the catalog refuses for itself (`
|
|
8833
|
+
notes: "JSON-RPC over MCP's Streamable HTTP, so neither the request nor the response is a shape contracts describes; the tool arguments and results are the schemas in each tool definition. **Fleetless users only** \u2014 an app's users reach their own app endpoint instead. **The bearer is verified inside the handler**, not by a route guard: the identity comes from the token and the path names none, and the refusal has to carry a `WWW-Authenticate` challenge that a guard shared with the REST surface does not send. `Origin` is checked against the cloud's own, and a foreign one is the `403 forbidden` above. **Both catalogs, unconditionally**: every caller admitted here is a Fleetless user, so the tool list has nothing left to vary with and the admin-ness check on `tools/call` is gone \u2014 a console tool that is still narrower than the catalog refuses for itself (`console_robots_write.delete` answers `tier_required` to a non-Owner). `403 forbidden` is also what an `mcp_session` token whose subject is an **app user** gets: this endpoint serves the team only, and such a token belongs to its own app's endpoint. The code is `forbidden` rather than `mcp_disabled` because nothing is switched off \u2014 the caller is at the wrong server \u2014 and per-app sign-in mints exactly such tokens, so the two states must not share a word. `mcp_access_denied` is gone with the per-user override and the group flag it read: every Fleetless user has MCP access here. Stateless: a fresh transport per request, no session id, nothing survives the call."
|
|
7403
8834
|
},
|
|
7404
8835
|
/* --------------------------------------------- mcp (one app's own server) */
|
|
7405
8836
|
{
|
|
@@ -8256,7 +9687,7 @@ var ROUTES = [
|
|
|
8256
9687
|
response: clientRobotListResponse,
|
|
8257
9688
|
errors: [...CLIENT_GUARD],
|
|
8258
9689
|
transport: "http",
|
|
8259
|
-
notes: "**The REST twin of the MCP
|
|
9690
|
+
notes: "**The REST twin of the MCP action `robots.list`**, and the one robot question no robot-scoped route can answer: which robots may I name at all. An app user sees the robots their app attaches on which their role grants at least one slug or capability; a server key sees every robot its app attaches; a developer bearer sees the organisation's robots. Name order, id as the tiebreak. A robot on which the role grants nothing is absent rather than listed empty \u2014 the same answer `robots.list` gives, for the same reason: reach is a grant, not an attachment. Under `/api/client/` because it names no robot; every robot-scoped read stays under `/api/robots/:id/\u2026`."
|
|
8260
9691
|
},
|
|
8261
9692
|
{
|
|
8262
9693
|
method: "GET",
|
|
@@ -8274,7 +9705,7 @@ var ROUTES = [
|
|
|
8274
9705
|
response: mcpRobotDatasheet,
|
|
8275
9706
|
errors: [...CLIENT_GUARD, "invalid_uuid", "not_found"],
|
|
8276
9707
|
transport: "http",
|
|
8277
|
-
notes: "**The REST twin of the MCP
|
|
9708
|
+
notes: "**The REST twin of the MCP action `robots.describe`**: one answer per robot \u2014 every datapoint, action, service, publisher and camera the role grants, each with its `input_schema` where it takes parameters, plus the two capabilities that gate whole features, `action_history` and `assets`. A robot with nothing published answers an empty `exposures` list, never a refusal. A robot the caller does not reach \u2014 not attached to their app, or attached with a role that grants nothing on it \u2014 answers `404` exactly as one that does not exist. The app-user datapoint and camera listings under this prefix stay; this is the one read that also names actions, services, publishers and capabilities, which is what an app needs before it can draw a screen."
|
|
8278
9709
|
},
|
|
8279
9710
|
/* ------------------------------------------------- config (draft/publish) */
|
|
8280
9711
|
{
|
|
@@ -8394,7 +9825,7 @@ var ROUTES = [
|
|
|
8394
9825
|
method: "POST",
|
|
8395
9826
|
path: "/api/robots/:id/config/rename-slug",
|
|
8396
9827
|
section: "config",
|
|
8397
|
-
summary: "Renames a slug in the draft and
|
|
9828
|
+
summary: "Renames a slug in the draft and moves every role grant and the recorded history with the name.",
|
|
8398
9829
|
audience: "developer",
|
|
8399
9830
|
auth: "developer",
|
|
8400
9831
|
rateLimited: false,
|
|
@@ -8413,10 +9844,11 @@ var ROUTES = [
|
|
|
8413
9844
|
"unknown_slug",
|
|
8414
9845
|
"reserved_slug",
|
|
8415
9846
|
"duplicate_slug",
|
|
9847
|
+
"history_migrating",
|
|
8416
9848
|
"internal_error"
|
|
8417
9849
|
],
|
|
8418
9850
|
transport: "http",
|
|
8419
|
-
notes: "One transaction
|
|
9851
|
+
notes: "One transaction: the draft document and every app-role grant carrying the slug are rewritten, and the recorded history moves with the name without rewriting any stored sample, so a rename takes the same time however much history there is. Samples the robot still sends under the old slug until the next publish join the renamed history. The published configuration is immutable, so `requires_publish` says the rename is not live on the robot yet. A draft that is not a document is `409 draft_not_a_document` \u2014 the same word the usage preview uses for the same state. While the recorded history is being migrated the rename is refused with `409 history_migrating`; nothing is written, and the same request succeeds once the migration has finished."
|
|
8420
9852
|
},
|
|
8421
9853
|
{
|
|
8422
9854
|
method: "GET",
|
|
@@ -8672,6 +10104,27 @@ var ROUTES = [
|
|
|
8672
10104
|
transport: "http",
|
|
8673
10105
|
notes: "The body is optional: a bodyless `POST` was every caller's shape before `job_id` existed, and absent or `job_id: null` both mean \"cancel whatever is running\". A named `job_id` that is **not** what is running cancels nothing and answers `404` \u2014 the caller named an id and thereby ruled the other one out. An `external` job is cancelled the same way, through its goal id. Cancelling an `unknown` job also cancels every external goal on its action, since one of them may be that job. A service is `422 not_cancellable`: a service call has no goal to cancel. Nothing running is a `200` with `job: null`. The answer waits for the bridge's `cancel_result`: a `200` means the action server accepted the cancel request, not that the goal has ended \u2014 the job's end arrives as its own update. Any goal answered `ERROR_REJECTED` makes it `409 cancel_rejected`, with every goal and its `return_code` in `details.goals`; no answer within `JOB_HEARTBEAT_TIMEOUT_MS` is `504 bridge_timeout`; a cancel the bridge could not send at all is `502` carrying the bridge's own code (`unknown_slug`, `action_server_lost`, `internal_error`)."
|
|
8674
10106
|
},
|
|
10107
|
+
{
|
|
10108
|
+
method: "POST",
|
|
10109
|
+
path: "/api/robots/:id/jobs/:slug/recover",
|
|
10110
|
+
section: "commands",
|
|
10111
|
+
summary: "Releases one held job after an Owner verifies the robot is stopped.",
|
|
10112
|
+
audience: "developer",
|
|
10113
|
+
auth: "developer",
|
|
10114
|
+
rateLimited: false,
|
|
10115
|
+
ownerTier: true,
|
|
10116
|
+
status: 200,
|
|
10117
|
+
params: [
|
|
10118
|
+
{ name: "id", description: "The robot uuid in the authenticated Owner's organization." },
|
|
10119
|
+
{ name: "slug", description: "The action slug holding the exact job named in the body." }
|
|
10120
|
+
],
|
|
10121
|
+
query: null,
|
|
10122
|
+
request: recoverHeldJobRequest,
|
|
10123
|
+
response: recoverHeldJobResponse,
|
|
10124
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "support_forbidden", "invalid_uuid", "not_found", "validation_error", "job_state_conflict", "internal_error"],
|
|
10125
|
+
transport: "http",
|
|
10126
|
+
notes: "Use only after physically stopping or isolating the robot and checking that it cannot move. Read the held job id, then submit that exact id with a reason and `verified_stopped: true`. The assertion is a human safety check, not a sensor reading. The cloud records the Owner and reason in the audit trail and returns the job settled to `lost`. App users, server keys, other developers and support sessions cannot use this route. A connected bridge or a changed job returns `409 job_state_conflict`; a normal cancel is not recovery and never releases an uncertain job."
|
|
10127
|
+
},
|
|
8675
10128
|
{
|
|
8676
10129
|
method: "POST",
|
|
8677
10130
|
path: "/api/robots/:id/publishers/:slug",
|
|
@@ -9136,11 +10589,29 @@ var ROUTES = [
|
|
|
9136
10589
|
transport: "http",
|
|
9137
10590
|
notes: "The one read the console's Plan & billing page, its usage and limit gauges, and every upgrade prompt and feature gate draw from \u2014 nothing else computes `limits` or `usage` on its own. `limits` is already the effective ceiling, the catalogue row raised by `addons` or replaced by an operator's override, so a consumer never recomputes it from the catalogue. `usage` is counted fresh on every call, never cached. `switch` is present only for an organization still on the beta that has not yet landed on a priced plan."
|
|
9138
10591
|
},
|
|
10592
|
+
{
|
|
10593
|
+
method: "POST",
|
|
10594
|
+
path: "/api/org/plan/change/prepare",
|
|
10595
|
+
section: "org",
|
|
10596
|
+
summary: "Prepares a nonbinding downward-plan decision and its C.4 display.",
|
|
10597
|
+
audience: "developer",
|
|
10598
|
+
auth: "developer",
|
|
10599
|
+
rateLimited: false,
|
|
10600
|
+
ownerTier: true,
|
|
10601
|
+
status: 200,
|
|
10602
|
+
params: [],
|
|
10603
|
+
query: null,
|
|
10604
|
+
request: planChangePrepareRequest,
|
|
10605
|
+
response: planChangePrepareResponse,
|
|
10606
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "plan_limit", "target_state_conflict"],
|
|
10607
|
+
transport: "http",
|
|
10608
|
+
notes: "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT."
|
|
10609
|
+
},
|
|
9139
10610
|
{
|
|
9140
10611
|
method: "PUT",
|
|
9141
10612
|
path: "/api/org/plan/change",
|
|
9142
10613
|
section: "org",
|
|
9143
|
-
summary: "
|
|
10614
|
+
summary: "Confirms a prepared downward-plan decision with its C.4 proof.",
|
|
9144
10615
|
audience: "developer",
|
|
9145
10616
|
auth: "developer",
|
|
9146
10617
|
rateLimited: false,
|
|
@@ -9152,7 +10623,25 @@ var ROUTES = [
|
|
|
9152
10623
|
response: orgPlan,
|
|
9153
10624
|
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "plan_limit", "target_state_conflict"],
|
|
9154
10625
|
transport: "http",
|
|
9155
|
-
notes: "Owner tier, and **downward only**: this route moves the org to a lower plan or cancels it outright to Basic. It never moves the org up \u2014
|
|
10626
|
+
notes: "Owner tier, and **downward only**: a prior prepare returns change_id and a displayed snapshot; this final PUT requires its confirmation_proof and the same operation_key, target_plan and keep. Only Basic permits cancellation_reason (at most 500 input characters). The reason is final idempotency metadata, not price or legal evidence. An exact replay returns the original result; a changed reason with the same key conflicts before effect. The decision and legal acceptance commit together. This route moves the org to a lower plan or cancels it outright to Basic. It never moves the org up \u2014 an upgrade or an add-on goes through the billing routes instead (`POST /api/billing/checkout`, `POST /api/billing/change`). `409 target_state_conflict` names `target_plan` with rule `not_lower` when the chosen plan is not below the org's current one; with rule `locked_basic_only` when the org is locked (`orgLock`) and the chosen plan is anything but Basic; and with rule `migration_basic_only` when the org is still on the beta, awaiting the switch to priced plans, and the chosen plan is anything but Basic \u2014 that choice is exactly what the org lands on at the switch. An owner is never named in `keep` and always stays, but still counts against the target plan's `seats`; `409 plan_limit` names `seats` when the owners alone already exceed it, and names whichever other limit `keep` still exceeds otherwise. `keep` is `null` when the org's current usage already fits the target plan outright and nothing is deleted; named, it lists exactly the robots, apps, app users and developers that stay. The choice is stored as `pending_change` and takes effect at `period_ends_at` \u2014 **everything of the chosen kind not named in `keep` is deleted at that instant, never before** \u2014 except a choice made while the org is locked, which takes effect at once, and a beta org's choice, which takes effect at the switch date instead. Anything created while the choice is pending is checked against the target plan too and, when it passes, is folded into `keep`, so exactly what the confirmation counted is what is actually deleted. Replacing a still-pending choice requires a new prepare and proof-bound final PUT."
|
|
10627
|
+
},
|
|
10628
|
+
{
|
|
10629
|
+
method: "GET",
|
|
10630
|
+
path: "/api/org/plan/change/decisions",
|
|
10631
|
+
section: "org",
|
|
10632
|
+
summary: "Looks up the prepared or accepted owner plan decision by operation key.",
|
|
10633
|
+
audience: "developer",
|
|
10634
|
+
auth: "developer",
|
|
10635
|
+
rateLimited: false,
|
|
10636
|
+
ownerTier: true,
|
|
10637
|
+
status: 200,
|
|
10638
|
+
params: [],
|
|
10639
|
+
query: planChangeDecisionLookupQuery,
|
|
10640
|
+
request: null,
|
|
10641
|
+
response: planChangeDecisionStatusResponse,
|
|
10642
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found"],
|
|
10643
|
+
transport: "http",
|
|
10644
|
+
notes: "Scope the operation key to the authenticated real Owner and organization. An unknown or foreign key returns 404 without disclosure. Prepared returns only change_id; accepted returns the stored original orgPlan result. No proof is returned. Console checks this before asking for a fresh display after a lost final response."
|
|
9156
10645
|
},
|
|
9157
10646
|
{
|
|
9158
10647
|
method: "DELETE",
|
|
@@ -9170,7 +10659,7 @@ var ROUTES = [
|
|
|
9170
10659
|
response: null,
|
|
9171
10660
|
errors: [...DEVELOPER_GUARD, "tier_required", "not_found"],
|
|
9172
10661
|
transport: "http",
|
|
9173
|
-
notes: "Owner tier. `404 not_found` when the org has no `pending_change` to withdraw. The org stays on its current plan, unchanged, as if the choice had never been made;
|
|
10662
|
+
notes: "Owner tier. `404 not_found` when the org has no `pending_change` to withdraw. The org stays on its current plan, unchanged, as if the choice had never been made; an Owner who wants a different one prepares a new display and confirms it with a final PUT."
|
|
9174
10663
|
},
|
|
9175
10664
|
{
|
|
9176
10665
|
method: "PATCH",
|
|
@@ -9186,9 +10675,369 @@ var ROUTES = [
|
|
|
9186
10675
|
query: null,
|
|
9187
10676
|
request: adminPlanChangeRequest,
|
|
9188
10677
|
response: orgPlan,
|
|
9189
|
-
errors: ["unauthorized", "not_found", "validation_error", "plan_limit", "rate_limited"],
|
|
10678
|
+
errors: ["unauthorized", "not_found", "validation_error", "plan_limit", "rate_limited", "target_state_conflict"],
|
|
9190
10679
|
transport: "http",
|
|
9191
|
-
notes: "Every public host answers `404 not_found` for every `/api/admin/*` path \u2014 this route is reachable only on the cloud's private address \u2014 and that same address answers `404` here too while `OPS_API_TOKEN` is not configured, so a door with no key behind it reads exactly like one nobody opened. An unknown `:id` is the same `404`. Applies at once, never queued as a `pending_change`, and only when the org's current usage fits the result: `409 plan_limit` when a lower plan, a lowered override or a removed add-on would leave the org over a limit \u2014 the operator never deletes an org's things, only the owner's own choice does. On success it also withdraws any `pending_change`, ends a beta org's wait for the switch and lifts a lock. Audited as `org.plan_changed` with the `fleetless` actor, never a developer's \u2014 the row names what an operator did, not who in the org asked for it."
|
|
10680
|
+
notes: "Every public host answers `404 not_found` for every `/api/admin/*` path \u2014 this route is reachable only on the cloud's private address \u2014 and that same address answers `404` here too while `OPS_API_TOKEN` is not configured, so a door with no key behind it reads exactly like one nobody opened. An unknown `:id` is the same `404`. Applies at once, never queued as a `pending_change`, and only when the org's current usage fits the result: `409 plan_limit` when a lower plan, a lowered override or a removed add-on would leave the org over a limit \u2014 the operator never deletes an org's things, only the owner's own choice does. On success it also withdraws any `pending_change`, ends a beta org's wait for the switch and lifts a lock. Audited as `org.plan_changed` with the `fleetless` actor, never a developer's \u2014 the row names what an operator did, not who in the org asked for it. `409 target_state_conflict` names `currency` or `period_ends_at` with rule `billed` when the org has a billing account in `active` or `past_due` and the request names either field: both are fixed at the first payment and billing, not the operator, owns them from then on. The plan itself keeps working on a billed org \u2014 a plan, an add-on or an override the operator sets here is charged from the next renewal, except `enterprise` and `basic`, which the sweep cancels the billing account for instead."
|
|
10681
|
+
},
|
|
10682
|
+
/* --- billing (2026-10-04, fleetless/fleetless#104) ----------------------
|
|
10683
|
+
*
|
|
10684
|
+
* Every route here but the webhook is owner-only (`ownerTier: true`), a
|
|
10685
|
+
* developer answers `403 tier_required` and `GET /api/billing`
|
|
10686
|
+
* is no exception — a developer reads #103's plan cards from
|
|
10687
|
+
* `GET /api/org/plan` instead, without the payer, payment method or
|
|
10688
|
+
* invoices. The routes that list `billing_unavailable` and
|
|
10689
|
+
* `payment_provider_unavailable` spread them from the `BILLING_OFF` and
|
|
10690
|
+
* `MOLLIE` constants near the top of this file.
|
|
10691
|
+
*/
|
|
10692
|
+
{
|
|
10693
|
+
method: "GET",
|
|
10694
|
+
path: "/api/billing",
|
|
10695
|
+
section: "billing",
|
|
10696
|
+
summary: "Reads the org's billing account, payment method and invoices.",
|
|
10697
|
+
audience: "developer",
|
|
10698
|
+
auth: "developer",
|
|
10699
|
+
rateLimited: false,
|
|
10700
|
+
ownerTier: true,
|
|
10701
|
+
status: 200,
|
|
10702
|
+
params: [],
|
|
10703
|
+
query: null,
|
|
10704
|
+
request: null,
|
|
10705
|
+
response: billingView,
|
|
10706
|
+
errors: [...DEVELOPER_GUARD, "tier_required"],
|
|
10707
|
+
transport: "http",
|
|
10708
|
+
notes: "`available: false` when `MOLLIE_API_KEY` is not configured \u2014 this cloud takes no payments, and every billing route that charges or opens a Mollie checkout answers `503 billing_unavailable` instead of acting; plan-change prepare, resume, the details and the VAT-ID check need no Mollie and answer normally. `account` is `null` before the org has ever checked out; the plan and its limits still come from `GET /api/org/plan` (fleetless/fleetless issue 103) and are not repeated here."
|
|
10709
|
+
},
|
|
10710
|
+
{
|
|
10711
|
+
method: "POST",
|
|
10712
|
+
path: "/api/billing/checkout",
|
|
10713
|
+
section: "billing",
|
|
10714
|
+
summary: "Records a company purchase intent for the first paid plan.",
|
|
10715
|
+
audience: "developer",
|
|
10716
|
+
auth: "developer",
|
|
10717
|
+
rateLimited: true,
|
|
10718
|
+
ownerTier: true,
|
|
10719
|
+
status: 201,
|
|
10720
|
+
params: [],
|
|
10721
|
+
query: null,
|
|
10722
|
+
request: checkoutRequest,
|
|
10723
|
+
response: checkoutResponse,
|
|
10724
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "plan_limit", "target_state_conflict", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
10725
|
+
transport: "http",
|
|
10726
|
+
notes: "Basic stays free for every payer. This start creates only a nonbinding draft; accept_terms is deprecated and cannot confirm an order. Current company, buyer, VIES and EUR quote checks still apply. Persist operation_key before POST; the same key and input return 200 with the existing intent (and its hosted checkout when payment_started), without another Mollie payment; changed input conflicts. A different operation_key while a first payment is open returns 409 target_state_conflict with rule checkout_open and details expires_at: null. An eligible Owner obtains a no-store C.4 display, then explicitly confirms with its proof. No payment or acceptance occurs at start. Hosted payment later offers card, PayPal or Apple Pay; its return is <console>/settings/billing?checkout=<checkout_id>. An active/past_due account uses billing/change."
|
|
10727
|
+
},
|
|
10728
|
+
{
|
|
10729
|
+
method: "GET",
|
|
10730
|
+
path: "/api/billing/intents",
|
|
10731
|
+
section: "billing",
|
|
10732
|
+
summary: "Recovers a purchase intent by operation key or intent ID.",
|
|
10733
|
+
audience: "developer",
|
|
10734
|
+
auth: "developer",
|
|
10735
|
+
rateLimited: false,
|
|
10736
|
+
ownerTier: true,
|
|
10737
|
+
status: 200,
|
|
10738
|
+
params: [],
|
|
10739
|
+
query: purchaseIntentLookupQuery,
|
|
10740
|
+
request: null,
|
|
10741
|
+
response: purchaseIntentResponse,
|
|
10742
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found"],
|
|
10743
|
+
transport: "http",
|
|
10744
|
+
notes: "Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click."
|
|
10745
|
+
},
|
|
10746
|
+
{
|
|
10747
|
+
method: "POST",
|
|
10748
|
+
path: "/api/billing/intents/:id/display",
|
|
10749
|
+
section: "billing",
|
|
10750
|
+
summary: "Issues a short-lived C.4 decision display and opaque confirmation proof.",
|
|
10751
|
+
audience: "developer",
|
|
10752
|
+
auth: "developer",
|
|
10753
|
+
rateLimited: false,
|
|
10754
|
+
ownerTier: true,
|
|
10755
|
+
status: 200,
|
|
10756
|
+
params: [{ name: "id", description: "The eligible intent ID returned by checkout or billing change." }],
|
|
10757
|
+
query: null,
|
|
10758
|
+
request: billingDecisionDisplayRequest,
|
|
10759
|
+
response: billingDecisionDisplayResponse,
|
|
10760
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found", "target_state_conflict"],
|
|
10761
|
+
transport: "http",
|
|
10762
|
+
notes: "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs."
|
|
10763
|
+
},
|
|
10764
|
+
{
|
|
10765
|
+
method: "POST",
|
|
10766
|
+
path: "/api/billing/intents/:id/confirm",
|
|
10767
|
+
section: "billing",
|
|
10768
|
+
summary: "Confirms the current purchase quote exactly once.",
|
|
10769
|
+
audience: "developer",
|
|
10770
|
+
auth: "developer",
|
|
10771
|
+
rateLimited: true,
|
|
10772
|
+
ownerTier: true,
|
|
10773
|
+
status: 200,
|
|
10774
|
+
params: [{ name: "id", description: "The intent ID returned by the start or lookup response." }],
|
|
10775
|
+
query: null,
|
|
10776
|
+
request: purchaseIntentConfirmRequest,
|
|
10777
|
+
response: purchaseIntentResponse,
|
|
10778
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found", "target_state_conflict", "plan_limit", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
10779
|
+
transport: "http",
|
|
10780
|
+
notes: "Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock; stale or spent proof conflicts without effect. One decision and one legal acceptance commit together. An exact same-key replay returns the original result without another payment or acceptance. A paid change can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; it does not start another charge. Foreign ownership answers 404 without disclosure; pending or held cannot charge."
|
|
10781
|
+
},
|
|
10782
|
+
{
|
|
10783
|
+
method: "GET",
|
|
10784
|
+
path: "/api/billing/checkout/:id",
|
|
10785
|
+
section: "billing",
|
|
10786
|
+
summary: "Reads a checkout's status, for the return page's poll.",
|
|
10787
|
+
audience: "developer",
|
|
10788
|
+
auth: "developer",
|
|
10789
|
+
rateLimited: false,
|
|
10790
|
+
ownerTier: true,
|
|
10791
|
+
status: 200,
|
|
10792
|
+
params: [{ name: "id", description: "The checkout id from `checkoutResponse.checkout_id`, carried on the return URL." }],
|
|
10793
|
+
query: null,
|
|
10794
|
+
request: null,
|
|
10795
|
+
response: checkoutStatus,
|
|
10796
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "not_found"],
|
|
10797
|
+
transport: "http",
|
|
10798
|
+
notes: "Calls the same `reconcilePayment(deps, molliePaymentId)` the webhook calls, so a return page that lands before the webhook does still sees the payment applied \u2014 this route, not the webhook, is what the dev stack and the test-mode suite rely on, since Mollie refuses an unreachable webhook URL. `plan` is the org's plan after applying, unchanged unless `purpose` is `upgrade` and `status` is `paid`."
|
|
10799
|
+
},
|
|
10800
|
+
{
|
|
10801
|
+
method: "POST",
|
|
10802
|
+
path: "/api/billing/vat-id/check",
|
|
10803
|
+
section: "billing",
|
|
10804
|
+
summary: "Checks a VAT ID using requester-aware direct VIES.",
|
|
10805
|
+
audience: "developer",
|
|
10806
|
+
auth: "developer",
|
|
10807
|
+
rateLimited: true,
|
|
10808
|
+
ownerTier: true,
|
|
10809
|
+
status: 200,
|
|
10810
|
+
params: [],
|
|
10811
|
+
query: null,
|
|
10812
|
+
request: vatIdCheckRequest,
|
|
10813
|
+
response: vatIdCheckResponse,
|
|
10814
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "rate_limited"],
|
|
10815
|
+
transport: "http",
|
|
10816
|
+
notes: "Reports status and optional display name only; full evidence stays in protected Finance storage. valid with a missing identifier remains pending/vies_identifier_missing. unverified or unavailable remains pending without zero rating or payment. A form check never authorizes a later charge; Cloud binds current evidence to the buyer and quote at confirmation. Rate limited on billing.vat_check."
|
|
10817
|
+
},
|
|
10818
|
+
{
|
|
10819
|
+
method: "PATCH",
|
|
10820
|
+
path: "/api/billing/details",
|
|
10821
|
+
section: "billing",
|
|
10822
|
+
summary: "Edits company billing details for revalidation before the next charge.",
|
|
10823
|
+
audience: "developer",
|
|
10824
|
+
auth: "developer",
|
|
10825
|
+
rateLimited: false,
|
|
10826
|
+
ownerTier: true,
|
|
10827
|
+
status: 200,
|
|
10828
|
+
params: [],
|
|
10829
|
+
query: null,
|
|
10830
|
+
request: billingDetailsUpdate,
|
|
10831
|
+
response: billingView,
|
|
10832
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found"],
|
|
10833
|
+
transport: "http",
|
|
10834
|
+
notes: "404 not_found when no billing account exists. Edits may change company name, full address/state, Tax ID, VAT ID and invoice email. Validate the merged buyer before a later charge; edits invalidate old evidence and quote revisions. Revalidate the email policy and country requirements. An edit does not create a payment, activate a plan, pay an invoice, clear dunning or lift a lock."
|
|
10835
|
+
},
|
|
10836
|
+
{
|
|
10837
|
+
method: "POST",
|
|
10838
|
+
path: "/api/billing/change",
|
|
10839
|
+
section: "billing",
|
|
10840
|
+
summary: "Records a nonbinding paid-change intent for a plan, cycle or add-on target.",
|
|
10841
|
+
audience: "developer",
|
|
10842
|
+
auth: "developer",
|
|
10843
|
+
rateLimited: false,
|
|
10844
|
+
ownerTier: true,
|
|
10845
|
+
status: 200,
|
|
10846
|
+
params: [],
|
|
10847
|
+
query: null,
|
|
10848
|
+
request: billingChangeRequest,
|
|
10849
|
+
response: billingChangeResponse,
|
|
10850
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "plan_limit", "target_state_conflict", ...BILLING_OFF, ...MOLLIE],
|
|
10851
|
+
transport: "http",
|
|
10852
|
+
notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key. Start is nonbinding for every change, including zero-charge, scheduled and formerly immediate decreases: it neither changes the plan nor writes legal acceptance. An eligible Owner obtains a C.4 display and explicitly confirms with its proof. Confirmation may return accepted_no_payment with charged: null and no provider payment or redirect, or payment_started for a charged change. Exact-key lookup recovers the accepted result. Existing no_account, past_due, no_valid_mandate and plan_limit conflicts remain. A later paid-change confirmation can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; no second charge starts."
|
|
10853
|
+
},
|
|
10854
|
+
{
|
|
10855
|
+
method: "POST",
|
|
10856
|
+
path: "/api/billing/payment-method",
|
|
10857
|
+
section: "billing",
|
|
10858
|
+
summary: "Records an invoice-paying method intent or a held mandate setup.",
|
|
10859
|
+
audience: "developer",
|
|
10860
|
+
auth: "developer",
|
|
10861
|
+
rateLimited: true,
|
|
10862
|
+
ownerTier: true,
|
|
10863
|
+
status: 201,
|
|
10864
|
+
params: [],
|
|
10865
|
+
query: null,
|
|
10866
|
+
request: paymentMethodChangeRequest,
|
|
10867
|
+
response: checkoutResponse,
|
|
10868
|
+
errors: ["target_state_conflict", ...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
10869
|
+
transport: "http",
|
|
10870
|
+
notes: "Use a stable operation_key and owner intent lookup after reload/timeout. Offer payment_method_options. Apple Pay with zero-amount changes disabled pays an open invoice through operation payment_method_invoice; without one, 400 validation_error has field method and rule applepay_needs_open_invoice. Apply the same buyer/VIES gate, current-amount reconfirmation and USD legacy hold as invoices/:id/pay. Pending, eligible and held contain no checkout URL; redirect only on payment_started.payment.kind hosted. A 0.00 mandate-only setup uses operation mandate_setup and held/mandate_policy_unresolved until the integration decision settles eligibility and currency. It pays no invoice and clears no dunning or lock. An invoice charged back is never retried automatically. 404 not_found when no account exists. Same key with changed input is a typed operation_key_reused conflict."
|
|
10871
|
+
},
|
|
10872
|
+
{
|
|
10873
|
+
method: "POST",
|
|
10874
|
+
path: "/api/billing/cancel",
|
|
10875
|
+
section: "billing",
|
|
10876
|
+
summary: "Rejects legacy direct cancellation after the C.4 gate is active.",
|
|
10877
|
+
audience: "developer",
|
|
10878
|
+
auth: "developer",
|
|
10879
|
+
rateLimited: false,
|
|
10880
|
+
ownerTier: true,
|
|
10881
|
+
status: 409,
|
|
10882
|
+
params: [],
|
|
10883
|
+
query: null,
|
|
10884
|
+
request: billingCancelRequest,
|
|
10885
|
+
requestOptional: true,
|
|
10886
|
+
response: null,
|
|
10887
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "target_state_conflict"],
|
|
10888
|
+
transport: "http",
|
|
10889
|
+
notes: "The C.4 gate rejects this legacy POST with 409 target_state_conflict before mutation, audit or mail. Console uses POST /api/org/plan/change/prepare and the proof-bound final PUT for Basic, including an optional reason there. This route cannot confirm a customer decision."
|
|
10890
|
+
},
|
|
10891
|
+
{
|
|
10892
|
+
method: "POST",
|
|
10893
|
+
path: "/api/billing/resume",
|
|
10894
|
+
section: "billing",
|
|
10895
|
+
summary: "Withdraws a scheduled cancel, keeping the current plan.",
|
|
10896
|
+
audience: "developer",
|
|
10897
|
+
auth: "developer",
|
|
10898
|
+
rateLimited: false,
|
|
10899
|
+
ownerTier: true,
|
|
10900
|
+
status: 200,
|
|
10901
|
+
params: [],
|
|
10902
|
+
query: null,
|
|
10903
|
+
request: null,
|
|
10904
|
+
response: billingView,
|
|
10905
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "not_found"],
|
|
10906
|
+
transport: "http",
|
|
10907
|
+
notes: "`404 not_found` when nothing is pending \u2014 there is no scheduled cancel to withdraw. The org stays on its current plan, unchanged."
|
|
10908
|
+
},
|
|
10909
|
+
{
|
|
10910
|
+
method: "GET",
|
|
10911
|
+
path: "/api/billing/invoices/:id/pdf",
|
|
10912
|
+
section: "billing",
|
|
10913
|
+
summary: "Downloads an invoice's original or cancellation PDF.",
|
|
10914
|
+
audience: "developer",
|
|
10915
|
+
auth: "developer",
|
|
10916
|
+
rateLimited: false,
|
|
10917
|
+
ownerTier: true,
|
|
10918
|
+
status: 200,
|
|
10919
|
+
params: [{ name: "id", description: "The invoice id, from `billingInvoice.id` in `GET /api/billing`'s `invoices`." }],
|
|
10920
|
+
query: billingInvoicePdfQuery,
|
|
10921
|
+
request: null,
|
|
10922
|
+
response: null,
|
|
10923
|
+
contentType: "application/pdf",
|
|
10924
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "validation_error", "not_found"],
|
|
10925
|
+
transport: "http",
|
|
10926
|
+
notes: "Owner-only. Omitted `kind` or `kind=invoice` returns the original PDF, rendered once with `pdfkit` when issued and stored as bytes. `kind=cancellation` returns the stored cancellation PDF for this same invoice id; no read renders a new PDF. `404 not_found` for an unknown id, one from another org, or a missing cancellation number or PDF. This reads historical Cloud invoices only: a due charge has no PDF of its own here \u2014 its eventual Lexware invoice is a document, read through `GET /api/billing/documents/:id/file`."
|
|
10927
|
+
},
|
|
10928
|
+
/* --- billing documents (2026-10-19, fleetless/fleetless#544) -------
|
|
10929
|
+
*
|
|
10930
|
+
* A read-only view of the Lexware vouchers issued to the org's company. Cloud resolves the org's own Lexware contact itself; the
|
|
10931
|
+
* contact is never supplied by the caller.
|
|
10932
|
+
*/
|
|
10933
|
+
{
|
|
10934
|
+
method: "GET",
|
|
10935
|
+
path: "/api/billing/documents",
|
|
10936
|
+
section: "billing",
|
|
10937
|
+
summary: "Lists the org's finalized Lexware billing documents.",
|
|
10938
|
+
audience: "developer",
|
|
10939
|
+
auth: "developer",
|
|
10940
|
+
rateLimited: true,
|
|
10941
|
+
ownerTier: true,
|
|
10942
|
+
status: 200,
|
|
10943
|
+
params: [],
|
|
10944
|
+
query: null,
|
|
10945
|
+
request: null,
|
|
10946
|
+
response: billingDocumentList,
|
|
10947
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "billing_documents_unavailable", "rate_limited"],
|
|
10948
|
+
transport: "http",
|
|
10949
|
+
notes: "Cloud resolves the org's own Lexware contact itself; the contact is never client supplied. The list is complete (every page) or an error \u2014 never a truncated page a caller could mistake for the whole thing: more than 10,000 documents answers 503 list_limit_exceeded. A draft, a quotation, an order confirmation, a delivery note or a purchase voucher never appears; a voided document does. `complete: false` with `unsupported_count` set means a document of an unsupported type or status was skipped rather than listed. `available: false` when this cloud has no Lexware configured, its Lexware account failed the account check, or the org has no Lexware contact \u2014 then `documents` is always `[]`."
|
|
10950
|
+
},
|
|
10951
|
+
{
|
|
10952
|
+
method: "GET",
|
|
10953
|
+
path: "/api/billing/documents/:id",
|
|
10954
|
+
section: "billing",
|
|
10955
|
+
summary: "Reads one billing document, with its e-invoice profile and available files.",
|
|
10956
|
+
audience: "developer",
|
|
10957
|
+
auth: "developer",
|
|
10958
|
+
rateLimited: true,
|
|
10959
|
+
ownerTier: true,
|
|
10960
|
+
status: 200,
|
|
10961
|
+
params: [{ name: "id", description: "The Lexware voucher id from the document list." }],
|
|
10962
|
+
query: null,
|
|
10963
|
+
request: null,
|
|
10964
|
+
response: billingDocumentDetail,
|
|
10965
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "billing_documents_unavailable", "rate_limited", "not_found"],
|
|
10966
|
+
transport: "http",
|
|
10967
|
+
notes: "`404 not_found` for an id from another organization or a guessed id \u2014 indistinguishable from an unknown one. `NONE` is a plain PDF and not an e-invoice; `EN16931` (ZUGFeRD) is a PDF with the e-invoice embedded in it; `XRechnung` is an XML e-invoice with a PDF that is only a preview. `electronic_document_profile` is `null` for a bookkeeping voucher \u2014 it has none. A fresh list must still contain the id. `502 billing_documents_unavailable` with reason `unsupported_document` for an e-invoice profile this cloud does not know."
|
|
10968
|
+
},
|
|
10969
|
+
{
|
|
10970
|
+
method: "GET",
|
|
10971
|
+
path: "/api/billing/documents/:id/file",
|
|
10972
|
+
section: "billing",
|
|
10973
|
+
summary: "Downloads one billing document's file.",
|
|
10974
|
+
audience: "developer",
|
|
10975
|
+
auth: "developer",
|
|
10976
|
+
rateLimited: true,
|
|
10977
|
+
ownerTier: true,
|
|
10978
|
+
status: 200,
|
|
10979
|
+
params: [{ name: "id", description: "The Lexware voucher id from the document list." }],
|
|
10980
|
+
query: billingDocumentFileQuery,
|
|
10981
|
+
request: null,
|
|
10982
|
+
response: null,
|
|
10983
|
+
contentType: "application/pdf",
|
|
10984
|
+
errors: [...DEVELOPER_GUARD, "tier_required", "billing_documents_unavailable", "rate_limited", "not_found", "validation_error"],
|
|
10985
|
+
transport: "http",
|
|
10986
|
+
notes: "`format=xml` answers `application/xml` for an `XRechnung` document only; every other document answers 404 for `format=xml`, because it has no XML to serve \u2014 a NONE document is a plain PDF and not an e-invoice, so it never has one either. `Cache-Control: no-store`; the bytes are streamed from Lexware and never persisted on this cloud's own side. 404 for a document of another organization or a guessed id \u2014 indistinguishable from an unknown one. A fresh list must still contain the id, and the org's Lexware contact is rechecked at file time, not only when the document was first listed. `502 billing_documents_unavailable` with reason `unsupported_document` when Lexware answers something that is not the document itself."
|
|
10987
|
+
},
|
|
10988
|
+
{
|
|
10989
|
+
method: "POST",
|
|
10990
|
+
path: "/api/billing/invoices/:id/pay",
|
|
10991
|
+
section: "billing",
|
|
10992
|
+
summary: "Records an owner-confirmed payment intent for an open invoice or due charge.",
|
|
10993
|
+
audience: "developer",
|
|
10994
|
+
auth: "developer",
|
|
10995
|
+
rateLimited: true,
|
|
10996
|
+
ownerTier: true,
|
|
10997
|
+
status: 201,
|
|
10998
|
+
params: [{ name: "id", description: "The invoice id, from `billingInvoice.id`, of the open invoice to pay \u2014 or, before the issuer cutover, a due charge's id, from `dunning.invoice_id`." }],
|
|
10999
|
+
query: null,
|
|
11000
|
+
request: invoicePayRequest,
|
|
11001
|
+
response: checkoutResponse,
|
|
11002
|
+
errors: ["validation_error", ...DEVELOPER_GUARD, "tier_required", "not_found", "target_state_conflict", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
11003
|
+
transport: "http",
|
|
11004
|
+
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."
|
|
11005
|
+
},
|
|
11006
|
+
{
|
|
11007
|
+
method: "POST",
|
|
11008
|
+
path: "/api/billing/charges/:id/pay",
|
|
11009
|
+
section: "billing",
|
|
11010
|
+
summary: "Records an owner-confirmed payment intent for a due Lexware-issuer charge.",
|
|
11011
|
+
audience: "developer",
|
|
11012
|
+
auth: "developer",
|
|
11013
|
+
rateLimited: true,
|
|
11014
|
+
ownerTier: true,
|
|
11015
|
+
status: 201,
|
|
11016
|
+
params: [{ name: "id", description: "The due charge id, from `billingCharge.id` in `GET /api/billing`'s `charges`." }],
|
|
11017
|
+
query: null,
|
|
11018
|
+
request: chargePayRequest,
|
|
11019
|
+
response: checkoutResponse,
|
|
11020
|
+
errors: ["validation_error", ...DEVELOPER_GUARD, "tier_required", "not_found", "target_state_conflict", "rate_limited", ...BILLING_OFF, ...MOLLIE],
|
|
11021
|
+
transport: "http",
|
|
11022
|
+
notes: "The required operation_key binds the org, charge and request, exactly like POST /api/billing/invoices/:id/pay; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id is a due charge's own id (billingCharge.id) \u2014 never a historical Cloud invoice; an invoice id, an unknown id or one from another org all answer 404 not_found alike. Recheck current buyer eligibility, the charge's own status and the owed amount before every new provider call: a charge already paid, cancelled or uncollectible is invoice_not_open, a typed 409 conflict. Pending/eligible/held has no redirect; after recovery the owner must confirm the current quote. Already-created payments retain their 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."
|
|
11023
|
+
},
|
|
11024
|
+
{
|
|
11025
|
+
method: "POST",
|
|
11026
|
+
path: "/api/billing/mollie/webhook",
|
|
11027
|
+
section: "billing",
|
|
11028
|
+
summary: "Takes Mollie's payment-changed notification and reconciles the payment.",
|
|
11029
|
+
audience: "internal",
|
|
11030
|
+
auth: "none",
|
|
11031
|
+
rateLimited: true,
|
|
11032
|
+
ownerTier: false,
|
|
11033
|
+
status: 200,
|
|
11034
|
+
params: [],
|
|
11035
|
+
query: null,
|
|
11036
|
+
request: null,
|
|
11037
|
+
response: null,
|
|
11038
|
+
errors: ["rate_limited"],
|
|
11039
|
+
transport: "http",
|
|
11040
|
+
notes: "**The body is never trusted**: it names only a payment id (`id=tr_\u2026`, form-encoded, Mollie's own shape), and this route does nothing with it but call `reconcilePayment(deps, molliePaymentId)` \u2014 the same function `GET /api/billing/checkout/:id` and the hourly sweep call \u2014 which fetches the payment from Mollie itself and applies what Mollie says, idempotently. Rate limited on the `billing.webhook` bucket, per ip, 600/min \u2014 generous, because this is Mollie's own infrastructure calling, not a browser; over it the answer is `429 rate_limited`, and Mollie retries the notification later. **Every other answer is `200`**, including an id this cloud does not recognise, which is logged and otherwise ignored, **except a processing fault, which is `500`** so Mollie retries the notification rather than this cloud losing it. `auth: 'none'` because Mollie signs nothing Fleetless checks here \u2014 the payment is only ever trusted once fetched back from Mollie's own API with the configured key."
|
|
9192
11041
|
},
|
|
9193
11042
|
/* ------------------------------------------------- assets (robot upload) */
|
|
9194
11043
|
{
|
|
@@ -9349,16 +11198,16 @@ function createPublicAuthCalls(http, appIdentifier2) {
|
|
|
9349
11198
|
};
|
|
9350
11199
|
await http.request("/api/client/register", { method: "POST", skipAuth: true, expectEmptyBody: true, body });
|
|
9351
11200
|
},
|
|
9352
|
-
async resendVerification(
|
|
9353
|
-
const body = { app_identifier: appIdentifier2, email };
|
|
11201
|
+
async resendVerification(email2) {
|
|
11202
|
+
const body = { app_identifier: appIdentifier2, email: email2 };
|
|
9354
11203
|
await http.request("/api/client/resend-verification", { method: "POST", skipAuth: true, expectEmptyBody: true, body });
|
|
9355
11204
|
},
|
|
9356
|
-
async requestPasswordReset(
|
|
9357
|
-
const body = { app_identifier: appIdentifier2, email };
|
|
11205
|
+
async requestPasswordReset(email2) {
|
|
11206
|
+
const body = { app_identifier: appIdentifier2, email: email2 };
|
|
9358
11207
|
await http.request("/api/client/password/reset", { method: "POST", skipAuth: true, expectEmptyBody: true, body });
|
|
9359
11208
|
},
|
|
9360
|
-
async requestLoginCode(
|
|
9361
|
-
const body = { app_identifier: appIdentifier2, email };
|
|
11209
|
+
async requestLoginCode(email2) {
|
|
11210
|
+
const body = { app_identifier: appIdentifier2, email: email2 };
|
|
9362
11211
|
await http.request("/api/client/login/code", { method: "POST", skipAuth: true, expectEmptyBody: true, body });
|
|
9363
11212
|
}
|
|
9364
11213
|
};
|
|
@@ -9382,13 +11231,13 @@ function createSessionAuth(http, tokenStore, appIdentifier2) {
|
|
|
9382
11231
|
const result = await http.request("/api/client/verify-email", { method: "POST", skipAuth: true, body });
|
|
9383
11232
|
return completeSignIn(result);
|
|
9384
11233
|
},
|
|
9385
|
-
async login(
|
|
9386
|
-
const body = { app_identifier: appIdentifier2, email, password: password2 };
|
|
11234
|
+
async login(email2, password2) {
|
|
11235
|
+
const body = { app_identifier: appIdentifier2, email: email2, password: password2 };
|
|
9387
11236
|
const result = await http.request("/api/client/login", { method: "POST", skipAuth: true, body });
|
|
9388
11237
|
return completeSignIn(result);
|
|
9389
11238
|
},
|
|
9390
|
-
async verifyLoginCode(
|
|
9391
|
-
const body = { app_identifier: appIdentifier2, email, code };
|
|
11239
|
+
async verifyLoginCode(email2, code) {
|
|
11240
|
+
const body = { app_identifier: appIdentifier2, email: email2, code };
|
|
9392
11241
|
const result = await http.request("/api/client/login/code/verify", { method: "POST", skipAuth: true, body });
|
|
9393
11242
|
return completeSignIn(result);
|
|
9394
11243
|
},
|
|
@@ -9473,7 +11322,7 @@ function createSessionAuth(http, tokenStore, appIdentifier2) {
|
|
|
9473
11322
|
async signInMethods() {
|
|
9474
11323
|
const query = new URLSearchParams({ app_identifier: appIdentifier2 });
|
|
9475
11324
|
const response = await http.request(`/api/client/providers?${query.toString()}`, { skipAuth: true });
|
|
9476
|
-
return
|
|
11325
|
+
return signInMethodsFrom(response);
|
|
9477
11326
|
},
|
|
9478
11327
|
async beginOidcLogin(input) {
|
|
9479
11328
|
const state = generateState();
|
|
@@ -9525,6 +11374,14 @@ function createSessionAuth(http, tokenStore, appIdentifier2) {
|
|
|
9525
11374
|
}
|
|
9526
11375
|
};
|
|
9527
11376
|
}
|
|
11377
|
+
function signInMethodsFrom(response) {
|
|
11378
|
+
const policy = appTwoFactorPolicy.safeParse(response.two_factor);
|
|
11379
|
+
return {
|
|
11380
|
+
password: response.sign_in_methods.password,
|
|
11381
|
+
emailCode: response.sign_in_methods.email_code,
|
|
11382
|
+
twoFactor: policy.success ? policy.data : null
|
|
11383
|
+
};
|
|
11384
|
+
}
|
|
9528
11385
|
async function decide(http, id, decision) {
|
|
9529
11386
|
const response = await http.request(
|
|
9530
11387
|
`/api/client/mcp/interactions/${pathSegment(id)}/${decision}`,
|
|
@@ -9611,7 +11468,7 @@ function createServerKeyAuth(http, appIdentifier2, option = "serverKey") {
|
|
|
9611
11468
|
async signInMethods() {
|
|
9612
11469
|
const query = new URLSearchParams({ app_identifier: appIdentifier2 });
|
|
9613
11470
|
const response = await http.request(`/api/client/providers?${query.toString()}`, { skipAuth: true });
|
|
9614
|
-
return
|
|
11471
|
+
return signInMethodsFrom(response);
|
|
9615
11472
|
},
|
|
9616
11473
|
async beginOidcLogin() {
|
|
9617
11474
|
serverKeyRefusal("beginOidcLogin", "a federated sign-in is inherently an app user's browser flow");
|