@fleetless/contracts 6.3.0-next.5 → 6.4.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.
- package/CHANGELOG.md +79 -0
- package/CONTRIBUTING.md +4 -4
- package/artifacts/openapi.json +4386 -1883
- package/artifacts/routes.json +461 -2
- package/artifacts/schema/admin-org-detail.schema.json +641 -0
- package/artifacts/schema/admin-search-query.schema.json +14 -0
- package/artifacts/schema/admin-search-response.schema.json +219 -0
- package/artifacts/schema/billing-address.schema.json +49 -0
- package/artifacts/schema/billing-cancel-request.schema.json +12 -0
- package/artifacts/schema/billing-change-request.schema.json +60 -0
- package/artifacts/schema/billing-change-response.schema.json +799 -0
- package/artifacts/schema/billing-details-update.schema.json +25 -0
- package/artifacts/schema/billing-details.schema.json +176 -0
- package/artifacts/schema/billing-invoice.schema.json +76 -0
- package/artifacts/schema/billing-view.schema.json +705 -0
- package/artifacts/schema/checkout-request.schema.json +252 -0
- package/artifacts/schema/checkout-response.schema.json +22 -0
- package/artifacts/schema/checkout-status.schema.json +49 -0
- package/artifacts/schema/noop-command-request.schema.json +75 -0
- package/artifacts/schema/noop-command-response.schema.json +134 -0
- package/artifacts/schema/operator-audit-ref.schema.json +28 -0
- package/artifacts/schema/operator-preview.schema.json +66 -0
- package/artifacts/schema/payment-method-change-request.schema.json +19 -0
- package/artifacts/schema/payment-method.schema.json +86 -0
- package/artifacts/schema/payment-provider-unavailable-details.schema.json +29 -0
- package/artifacts/schema/preview-stale-details.schema.json +80 -0
- package/artifacts/schema/vat-id-check-request.schema.json +22 -0
- package/artifacts/schema/vat-id-check-response.schema.json +36 -0
- package/dist/admin.d.ts +217 -0
- package/dist/admin.js +39 -0
- package/dist/app-users.d.ts +3 -3
- package/dist/billing.d.ts +812 -0
- package/dist/billing.js +471 -0
- package/dist/errors.d.ts +23 -11
- package/dist/errors.js +47 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +10 -2
- package/dist/operator-commands.d.ts +137 -0
- package/dist/operator-commands.js +51 -0
- package/dist/operator.d.ts +63 -0
- package/dist/operator.js +48 -0
- package/dist/plans.d.ts +25 -25
- package/dist/realtime.d.ts +2 -2
- package/dist/rest.d.ts +3 -3
- package/dist/routes.d.ts +21 -2
- package/dist/routes.js +270 -4
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"oneOf": [
|
|
4
|
+
{
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"kind": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"const": "card",
|
|
10
|
+
"description": "A card mandate."
|
|
11
|
+
},
|
|
12
|
+
"brand": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Visa'."
|
|
15
|
+
},
|
|
16
|
+
"last4": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"pattern": "^\\d{4}$",
|
|
19
|
+
"description": "The last four digits of the card."
|
|
20
|
+
},
|
|
21
|
+
"expires": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
24
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"kind",
|
|
29
|
+
"brand",
|
|
30
|
+
"last4",
|
|
31
|
+
"expires"
|
|
32
|
+
],
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "object",
|
|
37
|
+
"properties": {
|
|
38
|
+
"kind": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"const": "applepay",
|
|
41
|
+
"description": "A card mandate from an Apple Pay first payment — Mollie stores it as `creditcard`; Fleetless labels it Apple Pay."
|
|
42
|
+
},
|
|
43
|
+
"brand": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "The card network, as Mollie's mandate reports it, e.g. 'Mastercard'."
|
|
46
|
+
},
|
|
47
|
+
"last4": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"pattern": "^\\d{4}$",
|
|
50
|
+
"description": "The last four digits of the card behind Apple Pay."
|
|
51
|
+
},
|
|
52
|
+
"expires": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"pattern": "^\\d{2}\\/\\d{2}$",
|
|
55
|
+
"description": "Expiry as Mollie's mandate shows it, 'MM/YY'."
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"required": [
|
|
59
|
+
"kind",
|
|
60
|
+
"brand",
|
|
61
|
+
"last4",
|
|
62
|
+
"expires"
|
|
63
|
+
],
|
|
64
|
+
"additionalProperties": false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"kind": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"const": "paypal",
|
|
72
|
+
"description": "A PayPal mandate."
|
|
73
|
+
},
|
|
74
|
+
"account": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"description": "The PayPal account Mollie's mandate names."
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": [
|
|
80
|
+
"kind",
|
|
81
|
+
"account"
|
|
82
|
+
],
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"provider": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"const": "mollie",
|
|
8
|
+
"description": "The payment provider. Always `mollie` today."
|
|
9
|
+
},
|
|
10
|
+
"status": {
|
|
11
|
+
"anyOf": [
|
|
12
|
+
{
|
|
13
|
+
"type": "integer",
|
|
14
|
+
"minimum": -9007199254740991,
|
|
15
|
+
"maximum": 9007199254740991
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "null"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"description": "Mollie's own HTTP status, or `null` when the request timed out instead of answering."
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"provider",
|
|
26
|
+
"status"
|
|
27
|
+
],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"preview": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"effects": {
|
|
9
|
+
"minItems": 1,
|
|
10
|
+
"maxItems": 50,
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"kind": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": [
|
|
18
|
+
"changes",
|
|
19
|
+
"triggers",
|
|
20
|
+
"keeps"
|
|
21
|
+
],
|
|
22
|
+
"description": "`changes`: a value moves from `from` to `to`. `triggers`: something is set off (a mail, a refund, a document). `keeps`: something explicitly stays as it is."
|
|
23
|
+
},
|
|
24
|
+
"label": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1,
|
|
27
|
+
"maxLength": 300
|
|
28
|
+
},
|
|
29
|
+
"from": {
|
|
30
|
+
"anyOf": [
|
|
31
|
+
{
|
|
32
|
+
"type": "string",
|
|
33
|
+
"maxLength": 300
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "null"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"to": {
|
|
41
|
+
"anyOf": [
|
|
42
|
+
{
|
|
43
|
+
"type": "string",
|
|
44
|
+
"maxLength": 300
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "null"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"amount_cents": {
|
|
52
|
+
"type": "integer",
|
|
53
|
+
"minimum": -9007199254740991,
|
|
54
|
+
"maximum": 9007199254740991
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"kind",
|
|
59
|
+
"label"
|
|
60
|
+
],
|
|
61
|
+
"additionalProperties": false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"required": [
|
|
66
|
+
"effects"
|
|
67
|
+
],
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"preview_token": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"minLength": 1
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"required": [
|
|
76
|
+
"preview",
|
|
77
|
+
"preview_token"
|
|
78
|
+
],
|
|
79
|
+
"additionalProperties": false
|
|
80
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"country": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"pattern": "^[A-Z]{2}$",
|
|
8
|
+
"description": "The VAT ID's country."
|
|
9
|
+
},
|
|
10
|
+
"vat_id": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"minLength": 1,
|
|
13
|
+
"maxLength": 20,
|
|
14
|
+
"description": "The VAT ID as typed; normalized before the VIES lookup (`normalizeVatId`)."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": [
|
|
18
|
+
"country",
|
|
19
|
+
"vat_id"
|
|
20
|
+
],
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"status": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"enum": [
|
|
8
|
+
"valid",
|
|
9
|
+
"unverified",
|
|
10
|
+
"invalid"
|
|
11
|
+
],
|
|
12
|
+
"description": "VIES's answer."
|
|
13
|
+
},
|
|
14
|
+
"vat_id": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The normalized VAT ID that was checked."
|
|
17
|
+
},
|
|
18
|
+
"name": {
|
|
19
|
+
"anyOf": [
|
|
20
|
+
{
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "null"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"description": "The registered holder, when VIES named one; `null` otherwise."
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": [
|
|
31
|
+
"status",
|
|
32
|
+
"vat_id",
|
|
33
|
+
"name"
|
|
34
|
+
],
|
|
35
|
+
"additionalProperties": false
|
|
36
|
+
}
|
package/dist/admin.d.ts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/** The kinds `GET /api/admin/search` can answer today (fleetless/fleetless#268). A further kind joins the same union as its data arrives. */
|
|
4
|
+
export declare const ADMIN_SEARCH_KINDS: readonly ["org", "person", "invoice", "payment", "robot"];
|
|
5
|
+
/** The most hits one search answers; past it, `truncated` says so. */
|
|
6
|
+
export declare const ADMIN_SEARCH_LIMIT = 50;
|
|
7
|
+
export declare const adminSearchQuery: z.ZodObject<{
|
|
8
|
+
q: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type AdminSearchQuery = z.infer<typeof adminSearchQuery>;
|
|
11
|
+
/**
|
|
12
|
+
* One search result. `q` is matched literally, never as a wildcard pattern,
|
|
13
|
+
* and case-insensitively. A `payment` hit's `payment_id` is `null` for a
|
|
14
|
+
* `cst_` or `mdt_` match, which names the account and not a payment.
|
|
15
|
+
*/
|
|
16
|
+
export declare const adminSearchHit: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"org">;
|
|
18
|
+
org_id: z.ZodUUID;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"person">;
|
|
22
|
+
user_id: z.ZodUUID;
|
|
23
|
+
email: z.ZodString;
|
|
24
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
25
|
+
org_id: z.ZodUUID;
|
|
26
|
+
org_name: z.ZodString;
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
+
kind: z.ZodLiteral<"invoice">;
|
|
29
|
+
invoice_id: z.ZodUUID;
|
|
30
|
+
number: z.ZodString;
|
|
31
|
+
org_id: z.ZodNullable<z.ZodUUID>;
|
|
32
|
+
org_name: z.ZodNullable<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"payment">;
|
|
35
|
+
payment_id: z.ZodNullable<z.ZodUUID>;
|
|
36
|
+
mollie_id: z.ZodString;
|
|
37
|
+
matched: z.ZodEnum<{
|
|
38
|
+
payment: "payment";
|
|
39
|
+
customer: "customer";
|
|
40
|
+
mandate: "mandate";
|
|
41
|
+
refund: "refund";
|
|
42
|
+
}>;
|
|
43
|
+
org_id: z.ZodUUID;
|
|
44
|
+
org_name: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"robot">;
|
|
47
|
+
robot_id: z.ZodUUID;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
org_id: z.ZodUUID;
|
|
50
|
+
org_name: z.ZodString;
|
|
51
|
+
}, z.core.$strip>], "kind">;
|
|
52
|
+
export type AdminSearchHit = z.infer<typeof adminSearchHit>;
|
|
53
|
+
export declare const adminSearchResponse: z.ZodObject<{
|
|
54
|
+
hits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
|
+
kind: z.ZodLiteral<"org">;
|
|
56
|
+
org_id: z.ZodUUID;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"person">;
|
|
60
|
+
user_id: z.ZodUUID;
|
|
61
|
+
email: z.ZodString;
|
|
62
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
63
|
+
org_id: z.ZodUUID;
|
|
64
|
+
org_name: z.ZodString;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
kind: z.ZodLiteral<"invoice">;
|
|
67
|
+
invoice_id: z.ZodUUID;
|
|
68
|
+
number: z.ZodString;
|
|
69
|
+
org_id: z.ZodNullable<z.ZodUUID>;
|
|
70
|
+
org_name: z.ZodNullable<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
kind: z.ZodLiteral<"payment">;
|
|
73
|
+
payment_id: z.ZodNullable<z.ZodUUID>;
|
|
74
|
+
mollie_id: z.ZodString;
|
|
75
|
+
matched: z.ZodEnum<{
|
|
76
|
+
payment: "payment";
|
|
77
|
+
customer: "customer";
|
|
78
|
+
mandate: "mandate";
|
|
79
|
+
refund: "refund";
|
|
80
|
+
}>;
|
|
81
|
+
org_id: z.ZodUUID;
|
|
82
|
+
org_name: z.ZodString;
|
|
83
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
+
kind: z.ZodLiteral<"robot">;
|
|
85
|
+
robot_id: z.ZodUUID;
|
|
86
|
+
name: z.ZodString;
|
|
87
|
+
org_id: z.ZodUUID;
|
|
88
|
+
org_name: z.ZodString;
|
|
89
|
+
}, z.core.$strip>], "kind">>;
|
|
90
|
+
truncated: z.ZodBoolean;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type AdminSearchResponse = z.infer<typeof adminSearchResponse>;
|
|
93
|
+
/**
|
|
94
|
+
* `none` means no `billing_accounts` row; the other values mirror
|
|
95
|
+
* `billingAccountStatus`. The payer, address and payment method never
|
|
96
|
+
* appear here (fleetless/fleetless#268): support may see exactly this
|
|
97
|
+
* billing block, the status chip and next charge only.
|
|
98
|
+
*/
|
|
99
|
+
export declare const adminOrgBillingState: z.ZodEnum<{
|
|
100
|
+
none: "none";
|
|
101
|
+
pending: "pending";
|
|
102
|
+
active: "active";
|
|
103
|
+
past_due: "past_due";
|
|
104
|
+
canceled: "canceled";
|
|
105
|
+
}>;
|
|
106
|
+
export type AdminOrgBillingState = z.infer<typeof adminOrgBillingState>;
|
|
107
|
+
/** `GET /api/admin/orgs/:id`'s response. Locks and plan changes travel in `plan`, which already carries them. */
|
|
108
|
+
export declare const adminOrgDetail: z.ZodObject<{
|
|
109
|
+
id: z.ZodUUID;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
created_at: z.ZodISODateTime;
|
|
112
|
+
owner: z.ZodNullable<z.ZodObject<{
|
|
113
|
+
user_id: z.ZodUUID;
|
|
114
|
+
email: z.ZodString;
|
|
115
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
plan: z.ZodObject<{
|
|
118
|
+
plan: z.ZodEnum<{
|
|
119
|
+
basic: "basic";
|
|
120
|
+
plus: "plus";
|
|
121
|
+
pro: "pro";
|
|
122
|
+
enterprise: "enterprise";
|
|
123
|
+
}>;
|
|
124
|
+
currency: z.ZodEnum<{
|
|
125
|
+
eur: "eur";
|
|
126
|
+
usd: "usd";
|
|
127
|
+
}>;
|
|
128
|
+
period_ends_at: z.ZodISODateTime;
|
|
129
|
+
addons: z.ZodObject<{
|
|
130
|
+
seats: z.ZodNumber;
|
|
131
|
+
robots: z.ZodNumber;
|
|
132
|
+
apps: z.ZodNumber;
|
|
133
|
+
app_user_packs: z.ZodNumber;
|
|
134
|
+
live_video_packs: z.ZodNumber;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
limits: z.ZodObject<{
|
|
137
|
+
seats: z.ZodNullable<z.ZodNumber>;
|
|
138
|
+
robots: z.ZodNullable<z.ZodNumber>;
|
|
139
|
+
apps: z.ZodNullable<z.ZodNumber>;
|
|
140
|
+
app_users: z.ZodNullable<z.ZodNumber>;
|
|
141
|
+
live_video_ms_per_month: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
asset_bytes_per_robot: z.ZodNullable<z.ZodNumber>;
|
|
143
|
+
history_days: z.ZodNullable<z.ZodNumber>;
|
|
144
|
+
audit_days: z.ZodNullable<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
features: z.ZodObject<{
|
|
147
|
+
app_mcp: z.ZodBoolean;
|
|
148
|
+
two_factor: z.ZodBoolean;
|
|
149
|
+
require_two_factor: z.ZodBoolean;
|
|
150
|
+
app_oidc: z.ZodBoolean;
|
|
151
|
+
hosted_logo: z.ZodBoolean;
|
|
152
|
+
audit_export: z.ZodBoolean;
|
|
153
|
+
addons: z.ZodBoolean;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
usage: z.ZodObject<{
|
|
156
|
+
seats: z.ZodNumber;
|
|
157
|
+
robots: z.ZodNumber;
|
|
158
|
+
apps: z.ZodNumber;
|
|
159
|
+
app_users: z.ZodNumber;
|
|
160
|
+
live_video_ms_this_month: z.ZodNumber;
|
|
161
|
+
asset_bytes: z.ZodNumber;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
pending_change: z.ZodNullable<z.ZodObject<{
|
|
164
|
+
target_plan: z.ZodEnum<{
|
|
165
|
+
basic: "basic";
|
|
166
|
+
plus: "plus";
|
|
167
|
+
pro: "pro";
|
|
168
|
+
enterprise: "enterprise";
|
|
169
|
+
}>;
|
|
170
|
+
reason: z.ZodEnum<{
|
|
171
|
+
downgrade: "downgrade";
|
|
172
|
+
cancel: "cancel";
|
|
173
|
+
migration: "migration";
|
|
174
|
+
lock: "lock";
|
|
175
|
+
}>;
|
|
176
|
+
effective_at: z.ZodNullable<z.ZodISODateTime>;
|
|
177
|
+
keep: z.ZodNullable<z.ZodObject<{
|
|
178
|
+
robots: z.ZodArray<z.ZodUUID>;
|
|
179
|
+
apps: z.ZodArray<z.ZodUUID>;
|
|
180
|
+
app_users: z.ZodArray<z.ZodUUID>;
|
|
181
|
+
developers: z.ZodArray<z.ZodUUID>;
|
|
182
|
+
}, z.core.$strict>>;
|
|
183
|
+
history_days_after: z.ZodNumber;
|
|
184
|
+
chosen_by: z.ZodUUID;
|
|
185
|
+
chosen_at: z.ZodISODateTime;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
lock: z.ZodNullable<z.ZodObject<{
|
|
188
|
+
reason: z.ZodEnum<{
|
|
189
|
+
migration: "migration";
|
|
190
|
+
payment: "payment";
|
|
191
|
+
}>;
|
|
192
|
+
since: z.ZodISODateTime;
|
|
193
|
+
}, z.core.$strip>>;
|
|
194
|
+
switch: z.ZodNullable<z.ZodObject<{
|
|
195
|
+
at: z.ZodNullable<z.ZodISODateTime>;
|
|
196
|
+
needs_choice: z.ZodBoolean;
|
|
197
|
+
}, z.core.$strip>>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
billing: z.ZodObject<{
|
|
200
|
+
state: z.ZodEnum<{
|
|
201
|
+
none: "none";
|
|
202
|
+
pending: "pending";
|
|
203
|
+
active: "active";
|
|
204
|
+
past_due: "past_due";
|
|
205
|
+
canceled: "canceled";
|
|
206
|
+
}>;
|
|
207
|
+
next_charge_at: z.ZodNullable<z.ZodISODateTime>;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
counts: z.ZodObject<{
|
|
210
|
+
members: z.ZodNumber;
|
|
211
|
+
robots: z.ZodNumber;
|
|
212
|
+
robots_online: z.ZodNumber;
|
|
213
|
+
apps: z.ZodNumber;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
last_activity_at: z.ZodNullable<z.ZodISODateTime>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
export type AdminOrgDetail = z.infer<typeof adminOrgDetail>;
|
package/dist/admin.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { orgPlan } from './plans.js';
|
|
4
|
+
/** The kinds `GET /api/admin/search` can answer today (fleetless/fleetless#268). A further kind joins the same union as its data arrives. */
|
|
5
|
+
export const ADMIN_SEARCH_KINDS = ['org', 'person', 'invoice', 'payment', 'robot'];
|
|
6
|
+
/** The most hits one search answers; past it, `truncated` says so. */
|
|
7
|
+
export const ADMIN_SEARCH_LIMIT = 50;
|
|
8
|
+
export const adminSearchQuery = z.object({ q: z.string().trim().min(2).max(200) });
|
|
9
|
+
/**
|
|
10
|
+
* One search result. `q` is matched literally, never as a wildcard pattern,
|
|
11
|
+
* and case-insensitively. A `payment` hit's `payment_id` is `null` for a
|
|
12
|
+
* `cst_` or `mdt_` match, which names the account and not a payment.
|
|
13
|
+
*/
|
|
14
|
+
export const adminSearchHit = z.discriminatedUnion('kind', [
|
|
15
|
+
z.object({ kind: z.literal('org'), org_id: z.uuid(), name: z.string() }),
|
|
16
|
+
z.object({ kind: z.literal('person'), user_id: z.uuid(), email: z.string(), display_name: z.string().nullable(), org_id: z.uuid(), org_name: z.string() }),
|
|
17
|
+
z.object({ kind: z.literal('invoice'), invoice_id: z.uuid(), number: z.string(), org_id: z.uuid().nullable(), org_name: z.string().nullable() }),
|
|
18
|
+
z.object({ kind: z.literal('payment'), payment_id: z.uuid().nullable(), mollie_id: z.string(), matched: z.enum(['payment', 'customer', 'mandate', 'refund']), org_id: z.uuid(), org_name: z.string() }),
|
|
19
|
+
z.object({ kind: z.literal('robot'), robot_id: z.uuid(), name: z.string(), org_id: z.uuid(), org_name: z.string() }),
|
|
20
|
+
]);
|
|
21
|
+
export const adminSearchResponse = z.object({ hits: z.array(adminSearchHit).max(ADMIN_SEARCH_LIMIT), truncated: z.boolean() });
|
|
22
|
+
/**
|
|
23
|
+
* `none` means no `billing_accounts` row; the other values mirror
|
|
24
|
+
* `billingAccountStatus`. The payer, address and payment method never
|
|
25
|
+
* appear here (fleetless/fleetless#268): support may see exactly this
|
|
26
|
+
* billing block, the status chip and next charge only.
|
|
27
|
+
*/
|
|
28
|
+
export const adminOrgBillingState = z.enum(['none', 'pending', 'active', 'past_due', 'canceled']);
|
|
29
|
+
/** `GET /api/admin/orgs/:id`'s response. Locks and plan changes travel in `plan`, which already carries them. */
|
|
30
|
+
export const adminOrgDetail = z.object({
|
|
31
|
+
id: z.uuid(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
created_at: z.iso.datetime(),
|
|
34
|
+
owner: z.object({ user_id: z.uuid(), email: z.string(), display_name: z.string().nullable() }).nullable(),
|
|
35
|
+
plan: orgPlan,
|
|
36
|
+
billing: z.object({ state: adminOrgBillingState, next_charge_at: z.iso.datetime().nullable() }),
|
|
37
|
+
counts: z.object({ members: z.number().int().min(0), robots: z.number().int().min(0), robots_online: z.number().int().min(0), apps: z.number().int().min(0) }),
|
|
38
|
+
last_activity_at: z.iso.datetime().nullable(),
|
|
39
|
+
});
|
package/dist/app-users.d.ts
CHANGED
|
@@ -62,8 +62,8 @@ export declare const providerSlug: z.ZodString;
|
|
|
62
62
|
* mailed token, which is why `patchAppUserRequest` cannot set it: see there.
|
|
63
63
|
*/
|
|
64
64
|
export declare const appUserStatus: z.ZodEnum<{
|
|
65
|
-
pending_verification: "pending_verification";
|
|
66
65
|
active: "active";
|
|
66
|
+
pending_verification: "pending_verification";
|
|
67
67
|
blocked: "blocked";
|
|
68
68
|
}>;
|
|
69
69
|
export type AppUserStatus = z.infer<typeof appUserStatus>;
|
|
@@ -80,8 +80,8 @@ export declare const appUser: z.ZodObject<{
|
|
|
80
80
|
display_name: z.ZodNullable<z.ZodString>;
|
|
81
81
|
role_id: z.ZodUUID;
|
|
82
82
|
status: z.ZodEnum<{
|
|
83
|
-
pending_verification: "pending_verification";
|
|
84
83
|
active: "active";
|
|
84
|
+
pending_verification: "pending_verification";
|
|
85
85
|
blocked: "blocked";
|
|
86
86
|
}>;
|
|
87
87
|
has_password: z.ZodBoolean;
|
|
@@ -104,8 +104,8 @@ export declare const appUserListResponse: z.ZodObject<{
|
|
|
104
104
|
display_name: z.ZodNullable<z.ZodString>;
|
|
105
105
|
role_id: z.ZodUUID;
|
|
106
106
|
status: z.ZodEnum<{
|
|
107
|
-
pending_verification: "pending_verification";
|
|
108
107
|
active: "active";
|
|
108
|
+
pending_verification: "pending_verification";
|
|
109
109
|
blocked: "blocked";
|
|
110
110
|
}>;
|
|
111
111
|
has_password: z.ZodBoolean;
|