@fleetless/contracts 6.0.0 → 6.1.0-next.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/artifacts/openapi.json +636 -1
  3. package/artifacts/routes.json +101 -0
  4. package/artifacts/schema/addon-catalogue-entry.schema.json +75 -0
  5. package/artifacts/schema/addon-key.schema.json +11 -0
  6. package/artifacts/schema/admin-plan-change-request.schema.json +171 -0
  7. package/artifacts/schema/asset-plan-limit-details.schema.json +108 -0
  8. package/artifacts/schema/audit-actor.schema.json +2 -1
  9. package/artifacts/schema/audit-event.schema.json +2 -1
  10. package/artifacts/schema/audit-list-response.schema.json +2 -1
  11. package/artifacts/schema/org-addons.schema.json +39 -0
  12. package/artifacts/schema/org-lock.schema.json +23 -0
  13. package/artifacts/schema/org-locked-details.schema.json +17 -0
  14. package/artifacts/schema/org-plan-usage.schema.json +45 -0
  15. package/artifacts/schema/org-plan.schema.json +450 -0
  16. package/artifacts/schema/pending-plan-change.schema.json +112 -0
  17. package/artifacts/schema/plan-catalogue-entry.schema.json +226 -0
  18. package/artifacts/schema/plan-change-keep.schema.json +45 -0
  19. package/artifacts/schema/plan-change-reason.schema.json +10 -0
  20. package/artifacts/schema/plan-change-request.schema.json +71 -0
  21. package/artifacts/schema/plan-currency.schema.json +8 -0
  22. package/artifacts/schema/plan-features.schema.json +37 -0
  23. package/artifacts/schema/plan-id.schema.json +10 -0
  24. package/artifacts/schema/plan-limit-details.schema.json +87 -0
  25. package/artifacts/schema/plan-limits.schema.json +113 -0
  26. package/artifacts/schema/plan-overrides.schema.json +103 -0
  27. package/artifacts/schema/plan-prices.schema.json +33 -0
  28. package/artifacts/schema/plan-required-details.schema.json +42 -0
  29. package/dist/audit.d.ts +10 -0
  30. package/dist/audit.js +8 -1
  31. package/dist/errors.d.ts +138 -1
  32. package/dist/errors.js +94 -0
  33. package/dist/index.d.ts +6 -2
  34. package/dist/index.js +11 -1
  35. package/dist/plans.d.ts +525 -0
  36. package/dist/plans.js +442 -0
  37. package/dist/realtime.d.ts +2 -0
  38. package/dist/realtime.js +6 -0
  39. package/dist/routes.d.ts +5 -1
  40. package/dist/routes.js +58 -0
  41. package/package.json +1 -1
@@ -6368,6 +6368,107 @@
6368
6368
  "transport": "http",
6369
6369
  "notes": "The message is stored before any mail is tried, so `202` means it is kept whatever `mail` says: `sent`, `failed`, or `not_configured` when this cloud has no feedback address. At most 10 messages per developer per hour; the 11th answers `429 rate_limited` with `retry_after_ms`. Replies come by mail, to the sender's address."
6370
6370
  },
6371
+ {
6372
+ "method": "GET",
6373
+ "path": "/api/org/plan",
6374
+ "section": "org",
6375
+ "summary": "Reads the org's plan: its limits, its usage against them, its add-ons and any change already queued.",
6376
+ "audience": "developer",
6377
+ "auth": "developer",
6378
+ "rateLimited": false,
6379
+ "ownerTier": false,
6380
+ "status": 200,
6381
+ "params": [],
6382
+ "query": null,
6383
+ "request": null,
6384
+ "response": "org-plan",
6385
+ "errors": [
6386
+ "unauthorized",
6387
+ "token_expired",
6388
+ "token_revoked"
6389
+ ],
6390
+ "transport": "http",
6391
+ "notes": "The one read the console's Plan & billing page, its usage and limit gauges, and every upgrade prompt and feature gate draw from — 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."
6392
+ },
6393
+ {
6394
+ "method": "PUT",
6395
+ "path": "/api/org/plan/change",
6396
+ "section": "org",
6397
+ "summary": "Moves the org's plan down — a lower plan or a cancellation to Basic — queuing the change rather than applying it at once.",
6398
+ "audience": "developer",
6399
+ "auth": "developer",
6400
+ "rateLimited": false,
6401
+ "ownerTier": true,
6402
+ "status": 200,
6403
+ "params": [],
6404
+ "query": null,
6405
+ "request": "plan-change-request",
6406
+ "response": "org-plan",
6407
+ "errors": [
6408
+ "unauthorized",
6409
+ "token_expired",
6410
+ "token_revoked",
6411
+ "tier_required",
6412
+ "validation_error",
6413
+ "plan_limit",
6414
+ "target_state_conflict"
6415
+ ],
6416
+ "transport": "http",
6417
+ "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 — until payment exists, an upgrade or an add-on is not this route's job at all, and is handled today as a Feedback request that Fleetless then applies through the admin route. `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 — 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` — **everything of the chosen kind not named in `keep` is deleted at that instant, never before** — 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. A later `PUT` replaces a still-pending choice outright."
6418
+ },
6419
+ {
6420
+ "method": "DELETE",
6421
+ "path": "/api/org/plan/change",
6422
+ "section": "org",
6423
+ "summary": "Withdraws a plan change that was queued but has not taken effect yet.",
6424
+ "audience": "developer",
6425
+ "auth": "developer",
6426
+ "rateLimited": false,
6427
+ "ownerTier": true,
6428
+ "status": 204,
6429
+ "params": [],
6430
+ "query": null,
6431
+ "request": null,
6432
+ "response": null,
6433
+ "errors": [
6434
+ "unauthorized",
6435
+ "token_expired",
6436
+ "token_revoked",
6437
+ "tier_required",
6438
+ "not_found"
6439
+ ],
6440
+ "transport": "http",
6441
+ "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; a developer who wants a different one sends a new `PUT`, which would have replaced this one outright anyway."
6442
+ },
6443
+ {
6444
+ "method": "PATCH",
6445
+ "path": "/api/admin/orgs/:id/plan",
6446
+ "section": "org",
6447
+ "summary": "Changes an org's plan, add-ons, limit overrides, currency or billing period as the operator.",
6448
+ "audience": "internal",
6449
+ "auth": "ops",
6450
+ "rateLimited": true,
6451
+ "ownerTier": false,
6452
+ "status": 200,
6453
+ "params": [
6454
+ {
6455
+ "name": "id",
6456
+ "description": "The org's uuid, whose plan, add-ons or overrides the operator is changing."
6457
+ }
6458
+ ],
6459
+ "query": null,
6460
+ "request": "admin-plan-change-request",
6461
+ "response": "org-plan",
6462
+ "errors": [
6463
+ "unauthorized",
6464
+ "not_found",
6465
+ "validation_error",
6466
+ "plan_limit",
6467
+ "rate_limited"
6468
+ ],
6469
+ "transport": "http",
6470
+ "notes": "Every public host answers `404 not_found` for every `/api/admin/*` path — this route is reachable only on the cloud's private address — 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: an operator's plan, add-on or override change is never queued as a `pending_change`, unlike a developer's own downgrade. `409 plan_limit` when a lowered override or a removed add-on would leave the org's current usage over its new ceiling. Every change here is audited with the `fleetless` actor, never a developer's — the row names what an operator did, not who in the org asked for it."
6471
+ },
6371
6472
  {
6372
6473
  "method": "POST",
6373
6474
  "path": "/api/bridge/assets",
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string",
7
+ "enum": [
8
+ "seats",
9
+ "robots",
10
+ "apps",
11
+ "app_user_packs",
12
+ "live_video_packs"
13
+ ]
14
+ },
15
+ "raises": {
16
+ "type": "string",
17
+ "enum": [
18
+ "seats",
19
+ "robots",
20
+ "apps",
21
+ "app_users",
22
+ "live_video_ms_per_month",
23
+ "asset_bytes_per_robot",
24
+ "history_days",
25
+ "audit_days"
26
+ ],
27
+ "description": "The plan limit this add-on raises."
28
+ },
29
+ "per_unit": {
30
+ "type": "integer",
31
+ "exclusiveMinimum": 0,
32
+ "maximum": 9007199254740991,
33
+ "description": "How much one unit of this add-on raises `raises` by."
34
+ },
35
+ "prices": {
36
+ "type": "object",
37
+ "properties": {
38
+ "eur_month": {
39
+ "type": "integer",
40
+ "minimum": 0,
41
+ "maximum": 9007199254740991
42
+ },
43
+ "usd_month": {
44
+ "type": "integer",
45
+ "minimum": 0,
46
+ "maximum": 9007199254740991
47
+ },
48
+ "eur_year": {
49
+ "type": "integer",
50
+ "minimum": 0,
51
+ "maximum": 9007199254740991
52
+ },
53
+ "usd_year": {
54
+ "type": "integer",
55
+ "minimum": 0,
56
+ "maximum": 9007199254740991
57
+ }
58
+ },
59
+ "required": [
60
+ "eur_month",
61
+ "usd_month",
62
+ "eur_year",
63
+ "usd_year"
64
+ ],
65
+ "additionalProperties": false
66
+ }
67
+ },
68
+ "required": [
69
+ "key",
70
+ "raises",
71
+ "per_unit",
72
+ "prices"
73
+ ],
74
+ "additionalProperties": false
75
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "enum": [
5
+ "seats",
6
+ "robots",
7
+ "apps",
8
+ "app_user_packs",
9
+ "live_video_packs"
10
+ ]
11
+ }
@@ -0,0 +1,171 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "plan": {
6
+ "type": "string",
7
+ "enum": [
8
+ "basic",
9
+ "plus",
10
+ "pro",
11
+ "enterprise"
12
+ ]
13
+ },
14
+ "addons": {
15
+ "type": "object",
16
+ "properties": {
17
+ "seats": {
18
+ "type": "integer",
19
+ "minimum": 0,
20
+ "maximum": 9007199254740991
21
+ },
22
+ "robots": {
23
+ "type": "integer",
24
+ "minimum": 0,
25
+ "maximum": 9007199254740991
26
+ },
27
+ "apps": {
28
+ "type": "integer",
29
+ "minimum": 0,
30
+ "maximum": 9007199254740991
31
+ },
32
+ "app_user_packs": {
33
+ "type": "integer",
34
+ "minimum": 0,
35
+ "maximum": 9007199254740991
36
+ },
37
+ "live_video_packs": {
38
+ "type": "integer",
39
+ "minimum": 0,
40
+ "maximum": 9007199254740991
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ },
45
+ "overrides": {
46
+ "type": "object",
47
+ "properties": {
48
+ "seats": {
49
+ "anyOf": [
50
+ {
51
+ "type": "integer",
52
+ "exclusiveMinimum": 0,
53
+ "maximum": 9007199254740991
54
+ },
55
+ {
56
+ "type": "null"
57
+ }
58
+ ]
59
+ },
60
+ "robots": {
61
+ "anyOf": [
62
+ {
63
+ "type": "integer",
64
+ "exclusiveMinimum": 0,
65
+ "maximum": 9007199254740991
66
+ },
67
+ {
68
+ "type": "null"
69
+ }
70
+ ]
71
+ },
72
+ "apps": {
73
+ "anyOf": [
74
+ {
75
+ "type": "integer",
76
+ "exclusiveMinimum": 0,
77
+ "maximum": 9007199254740991
78
+ },
79
+ {
80
+ "type": "null"
81
+ }
82
+ ]
83
+ },
84
+ "app_users": {
85
+ "anyOf": [
86
+ {
87
+ "type": "integer",
88
+ "exclusiveMinimum": 0,
89
+ "maximum": 9007199254740991
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ]
95
+ },
96
+ "live_video_ms_per_month": {
97
+ "anyOf": [
98
+ {
99
+ "type": "integer",
100
+ "exclusiveMinimum": 0,
101
+ "maximum": 9007199254740991
102
+ },
103
+ {
104
+ "type": "null"
105
+ }
106
+ ]
107
+ },
108
+ "asset_bytes_per_robot": {
109
+ "anyOf": [
110
+ {
111
+ "type": "integer",
112
+ "exclusiveMinimum": 0,
113
+ "maximum": 9007199254740991
114
+ },
115
+ {
116
+ "type": "null"
117
+ }
118
+ ]
119
+ },
120
+ "history_days": {
121
+ "anyOf": [
122
+ {
123
+ "type": "integer",
124
+ "exclusiveMinimum": 0,
125
+ "maximum": 9007199254740991
126
+ },
127
+ {
128
+ "type": "null"
129
+ }
130
+ ]
131
+ },
132
+ "audit_days": {
133
+ "anyOf": [
134
+ {
135
+ "type": "integer",
136
+ "exclusiveMinimum": 0,
137
+ "maximum": 9007199254740991
138
+ },
139
+ {
140
+ "type": "null"
141
+ }
142
+ ]
143
+ }
144
+ },
145
+ "additionalProperties": false
146
+ },
147
+ "currency": {
148
+ "type": "string",
149
+ "enum": [
150
+ "eur",
151
+ "usd"
152
+ ]
153
+ },
154
+ "period_ends_at": {
155
+ "anyOf": [
156
+ {
157
+ "type": "string",
158
+ "format": "date-time",
159
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
160
+ },
161
+ {
162
+ "type": "null"
163
+ }
164
+ ]
165
+ }
166
+ },
167
+ "required": [
168
+ "plan"
169
+ ],
170
+ "additionalProperties": false
171
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "limit": {
6
+ "type": "string",
7
+ "enum": [
8
+ "seats",
9
+ "robots",
10
+ "apps",
11
+ "app_users",
12
+ "live_video_ms_per_month",
13
+ "asset_bytes_per_robot"
14
+ ]
15
+ },
16
+ "used": {
17
+ "type": "integer",
18
+ "minimum": 0,
19
+ "maximum": 9007199254740991
20
+ },
21
+ "max": {
22
+ "type": "integer",
23
+ "minimum": 0,
24
+ "maximum": 9007199254740991
25
+ },
26
+ "plan": {
27
+ "type": "string",
28
+ "enum": [
29
+ "basic",
30
+ "plus",
31
+ "pro",
32
+ "enterprise"
33
+ ]
34
+ },
35
+ "lifted_by": {
36
+ "type": "object",
37
+ "properties": {
38
+ "plan": {
39
+ "anyOf": [
40
+ {
41
+ "type": "string",
42
+ "enum": [
43
+ "basic",
44
+ "plus",
45
+ "pro",
46
+ "enterprise"
47
+ ]
48
+ },
49
+ {
50
+ "type": "null"
51
+ }
52
+ ]
53
+ },
54
+ "addon": {
55
+ "anyOf": [
56
+ {
57
+ "type": "string",
58
+ "enum": [
59
+ "seats",
60
+ "robots",
61
+ "apps",
62
+ "app_user_packs",
63
+ "live_video_packs"
64
+ ]
65
+ },
66
+ {
67
+ "type": "null"
68
+ }
69
+ ]
70
+ }
71
+ },
72
+ "required": [
73
+ "plan",
74
+ "addon"
75
+ ],
76
+ "additionalProperties": false
77
+ },
78
+ "store_bytes": {
79
+ "type": "integer",
80
+ "exclusiveMinimum": 0,
81
+ "maximum": 9007199254740991,
82
+ "description": "The org's asset pool, in bytes: `robots × asset_bytes_per_robot`."
83
+ },
84
+ "used_bytes": {
85
+ "type": "integer",
86
+ "minimum": 0,
87
+ "maximum": 9007199254740991,
88
+ "description": "Bytes the org's assets occupy, across every robot, before this upload."
89
+ },
90
+ "size_bytes": {
91
+ "type": "integer",
92
+ "exclusiveMinimum": 0,
93
+ "maximum": 9007199254740991,
94
+ "description": "The refused upload, in bytes."
95
+ }
96
+ },
97
+ "required": [
98
+ "limit",
99
+ "used",
100
+ "max",
101
+ "plan",
102
+ "lifted_by",
103
+ "store_bytes",
104
+ "used_bytes",
105
+ "size_bytes"
106
+ ],
107
+ "additionalProperties": false
108
+ }
@@ -9,7 +9,8 @@
9
9
  "end_user",
10
10
  "app_user",
11
11
  "server_key",
12
- "bridge"
12
+ "bridge",
13
+ "fleetless"
13
14
  ]
14
15
  },
15
16
  "id": {
@@ -32,7 +32,8 @@
32
32
  "end_user",
33
33
  "app_user",
34
34
  "server_key",
35
- "bridge"
35
+ "bridge",
36
+ "fleetless"
36
37
  ]
37
38
  },
38
39
  "id": {
@@ -37,7 +37,8 @@
37
37
  "end_user",
38
38
  "app_user",
39
39
  "server_key",
40
- "bridge"
40
+ "bridge",
41
+ "fleetless"
41
42
  ]
42
43
  },
43
44
  "id": {
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "seats": {
6
+ "type": "integer",
7
+ "minimum": 0,
8
+ "maximum": 9007199254740991
9
+ },
10
+ "robots": {
11
+ "type": "integer",
12
+ "minimum": 0,
13
+ "maximum": 9007199254740991
14
+ },
15
+ "apps": {
16
+ "type": "integer",
17
+ "minimum": 0,
18
+ "maximum": 9007199254740991
19
+ },
20
+ "app_user_packs": {
21
+ "type": "integer",
22
+ "minimum": 0,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "live_video_packs": {
26
+ "type": "integer",
27
+ "minimum": 0,
28
+ "maximum": 9007199254740991
29
+ }
30
+ },
31
+ "required": [
32
+ "seats",
33
+ "robots",
34
+ "apps",
35
+ "app_user_packs",
36
+ "live_video_packs"
37
+ ],
38
+ "additionalProperties": false
39
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "reason": {
6
+ "type": "string",
7
+ "enum": [
8
+ "payment",
9
+ "migration"
10
+ ]
11
+ },
12
+ "since": {
13
+ "type": "string",
14
+ "format": "date-time",
15
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
16
+ }
17
+ },
18
+ "required": [
19
+ "reason",
20
+ "since"
21
+ ],
22
+ "additionalProperties": false
23
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "reason": {
6
+ "type": "string",
7
+ "enum": [
8
+ "payment",
9
+ "migration"
10
+ ]
11
+ }
12
+ },
13
+ "required": [
14
+ "reason"
15
+ ],
16
+ "additionalProperties": false
17
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "seats": {
6
+ "type": "integer",
7
+ "minimum": 0,
8
+ "maximum": 9007199254740991
9
+ },
10
+ "robots": {
11
+ "type": "integer",
12
+ "minimum": 0,
13
+ "maximum": 9007199254740991
14
+ },
15
+ "apps": {
16
+ "type": "integer",
17
+ "minimum": 0,
18
+ "maximum": 9007199254740991
19
+ },
20
+ "app_users": {
21
+ "type": "integer",
22
+ "minimum": 0,
23
+ "maximum": 9007199254740991
24
+ },
25
+ "live_video_ms_this_month": {
26
+ "type": "integer",
27
+ "minimum": 0,
28
+ "maximum": 9007199254740991
29
+ },
30
+ "asset_bytes": {
31
+ "type": "integer",
32
+ "minimum": 0,
33
+ "maximum": 9007199254740991
34
+ }
35
+ },
36
+ "required": [
37
+ "seats",
38
+ "robots",
39
+ "apps",
40
+ "app_users",
41
+ "live_video_ms_this_month",
42
+ "asset_bytes"
43
+ ],
44
+ "additionalProperties": false
45
+ }