@dork-labs/cloud-api 0.75.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/LICENSE +21 -0
- package/README.md +192 -0
- package/dist/billing.d.ts +328 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +267 -0
- package/dist/billing.js.map +1 -0
- package/dist/client.d.ts +130 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +192 -0
- package/dist/client.js.map +1 -0
- package/dist/connections.d.ts +281 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +241 -0
- package/dist/connections.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +123 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +114 -0
- package/dist/inference.js.map +1 -0
- package/dist/instances.d.ts +60 -0
- package/dist/instances.d.ts.map +1 -0
- package/dist/instances.js +65 -0
- package/dist/instances.js.map +1 -0
- package/dist/primitives.d.ts +74 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +98 -0
- package/dist/primitives.js.map +1 -0
- package/dist/problem.d.ts +96 -0
- package/dist/problem.d.ts.map +1 -0
- package/dist/problem.js +94 -0
- package/dist/problem.js.map +1 -0
- package/dist/remote.d.ts +268 -0
- package/dist/remote.d.ts.map +1 -0
- package/dist/remote.js +267 -0
- package/dist/remote.js.map +1 -0
- package/dist/routes.d.ts +273 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +302 -0
- package/dist/routes.js.map +1 -0
- package/dist/seats.d.ts +529 -0
- package/dist/seats.d.ts.map +1 -0
- package/dist/seats.js +266 -0
- package/dist/seats.js.map +1 -0
- package/dist/session.d.ts +135 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +143 -0
- package/dist/session.js.map +1 -0
- package/fixtures/v1/billing/balance-owed.json +16 -0
- package/fixtures/v1/billing/balance.json +16 -0
- package/fixtures/v1/billing/entitlements-free.json +34 -0
- package/fixtures/v1/billing/hosted-page.json +3 -0
- package/fixtures/v1/billing/nudge.json +9 -0
- package/fixtures/v1/billing/price-list.json +13 -0
- package/fixtures/v1/billing/statement.json +5 -0
- package/fixtures/v1/billing/usage-by-model.json +21 -0
- package/fixtures/v1/connections/catalog.json +12 -0
- package/fixtures/v1/connections/events-ack.json +3 -0
- package/fixtures/v1/connections/events-pull.json +16 -0
- package/fixtures/v1/connections/execution.json +12 -0
- package/fixtures/v1/connections/list.json +16 -0
- package/fixtures/v1/connections/usage.json +16 -0
- package/fixtures/v1/index.json +58 -0
- package/fixtures/v1/inference/models.json +17 -0
- package/fixtures/v1/inference/token-revoke.json +3 -0
- package/fixtures/v1/inference/token.json +14 -0
- package/fixtures/v1/instances/heartbeat.json +5 -0
- package/fixtures/v1/instances/list.json +15 -0
- package/fixtures/v1/instances/revoke.json +3 -0
- package/fixtures/v1/problem/handle-tombstoned.json +6 -0
- package/fixtures/v1/problem/person-seat-required.json +7 -0
- package/fixtures/v1/problem/unauthenticated.json +7 -0
- package/fixtures/v1/remote/address.json +5 -0
- package/fixtures/v1/remote/command-keepalive.json +4 -0
- package/fixtures/v1/remote/command-open.json +6 -0
- package/fixtures/v1/remote/commands-ack.json +3 -0
- package/fixtures/v1/remote/credential.json +7 -0
- package/fixtures/v1/remote/custom-address.json +12 -0
- package/fixtures/v1/remote/designation.json +5 -0
- package/fixtures/v1/remote/enrolment.json +5 -0
- package/fixtures/v1/remote/events.json +3 -0
- package/fixtures/v1/remote/open.json +5 -0
- package/fixtures/v1/remote/status-closed.json +7 -0
- package/fixtures/v1/remote/status-open.json +10 -0
- package/fixtures/v1/remote/wake-token.json +5 -0
- package/fixtures/v1/seats/addons.json +11 -0
- package/fixtures/v1/seats/agent.json +9 -0
- package/fixtures/v1/seats/grants.json +20 -0
- package/fixtures/v1/seats/inbox-browse.json +17 -0
- package/fixtures/v1/seats/inbox-pull.json +17 -0
- package/fixtures/v1/seats/invitation.json +9 -0
- package/fixtures/v1/seats/members.json +12 -0
- package/fixtures/v1/seats/org.json +7 -0
- package/fixtures/v1/seats/presence.json +6 -0
- package/fixtures/v1/seats/seat.json +21 -0
- package/fixtures/v1/session/account-export.json +6 -0
- package/fixtures/v1/session/device-code.json +8 -0
- package/fixtures/v1/session/device-token-pending.json +4 -0
- package/fixtures/v1/session/device-token.json +7 -0
- package/fixtures/v1/session/signed-in.json +14 -0
- package/fixtures/v1/session/signed-out.json +4 -0
- package/package.json +58 -0
package/dist/problem.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IdSchema, TimestampSchema } from './primitives.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every machine-readable failure code this contract can return.
|
|
5
|
+
*
|
|
6
|
+
* These are mechanism, not catalog: they name what went wrong with a request,
|
|
7
|
+
* which is a property of the protocol and is published on purpose. Nothing here
|
|
8
|
+
* names a plan, a model, a supplier or an amount.
|
|
9
|
+
*/
|
|
10
|
+
export const ProblemCodeSchema = z
|
|
11
|
+
.enum([
|
|
12
|
+
// Authentication and authorization.
|
|
13
|
+
'unauthenticated',
|
|
14
|
+
'invalid_token',
|
|
15
|
+
'expired_token',
|
|
16
|
+
'forbidden',
|
|
17
|
+
'scope_required',
|
|
18
|
+
// Request shape.
|
|
19
|
+
'malformed_request',
|
|
20
|
+
'unsupported_wire_version',
|
|
21
|
+
'not_found',
|
|
22
|
+
'conflict',
|
|
23
|
+
'precondition_failed',
|
|
24
|
+
'rate_limited',
|
|
25
|
+
// Seats, orgs and identity.
|
|
26
|
+
'person_seat_required',
|
|
27
|
+
'seat_unavailable',
|
|
28
|
+
'handle_taken',
|
|
29
|
+
'handle_reserved',
|
|
30
|
+
'handle_tombstoned',
|
|
31
|
+
'claim_not_approved',
|
|
32
|
+
'inbox_full',
|
|
33
|
+
// Entitlement and balance refusals.
|
|
34
|
+
'entitlement_required',
|
|
35
|
+
'balance_exhausted',
|
|
36
|
+
'quota_exceeded',
|
|
37
|
+
// Remote access.
|
|
38
|
+
'enrolment_required',
|
|
39
|
+
'remote_disabled',
|
|
40
|
+
'address_unavailable',
|
|
41
|
+
// The server's own faults.
|
|
42
|
+
'internal_error',
|
|
43
|
+
'temporarily_unavailable',
|
|
44
|
+
])
|
|
45
|
+
.describe('The machine-readable failure code. Codes describe the mechanism of a refusal and never identify a plan, a model or a supplier.');
|
|
46
|
+
/**
|
|
47
|
+
* The single error envelope every endpoint in this contract returns.
|
|
48
|
+
*
|
|
49
|
+
* A response is either the route's success schema or this. There is no third
|
|
50
|
+
* shape and no per-route error type, so a client writes one failure path.
|
|
51
|
+
*
|
|
52
|
+
* `requiredPlanId` is present only on a refusal a subscription would lift. It
|
|
53
|
+
* is an opaque identifier paired with a server-supplied display string: the
|
|
54
|
+
* client renders what it is given and never switches on the value, and no
|
|
55
|
+
* amount ever appears here.
|
|
56
|
+
*/
|
|
57
|
+
export const ProblemSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
code: ProblemCodeSchema,
|
|
60
|
+
status: z
|
|
61
|
+
.number()
|
|
62
|
+
.int()
|
|
63
|
+
.min(400)
|
|
64
|
+
.max(599)
|
|
65
|
+
.describe('The HTTP status that accompanied this problem.'),
|
|
66
|
+
title: z.string().describe('A short, human-readable summary, safe to show a person.'),
|
|
67
|
+
detail: z
|
|
68
|
+
.string()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('A longer explanation of this specific occurrence, safe to show a person.'),
|
|
71
|
+
instance: IdSchema.optional().describe('An opaque request identifier to quote when reporting the failure.'),
|
|
72
|
+
retryAfterMs: z
|
|
73
|
+
.number()
|
|
74
|
+
.int()
|
|
75
|
+
.nonnegative()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe('How long to wait before retrying, when the failure is transient.'),
|
|
78
|
+
requiredPlanId: IdSchema.optional().describe('An opaque identifier for the subscription that would lift this refusal. Render the accompanying display string; never branch on this value.'),
|
|
79
|
+
requiredPlanDisplayName: z
|
|
80
|
+
.string()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('The server-supplied display string for `requiredPlanId`.'),
|
|
83
|
+
freesAt: TimestampSchema.optional().describe('When the blocking condition clears, where the server can say so.'),
|
|
84
|
+
})
|
|
85
|
+
.describe('The error envelope every endpoint in this contract returns in place of its success body.');
|
|
86
|
+
/**
|
|
87
|
+
* Narrows an unknown value to a {@link Problem}.
|
|
88
|
+
*
|
|
89
|
+
* @param value - A parsed response body of unknown shape.
|
|
90
|
+
*/
|
|
91
|
+
export function isProblem(value) {
|
|
92
|
+
return ProblemSchema.safeParse(value).success;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=problem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problem.js","sourceRoot":"","sources":["../src/problem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,IAAI,CAAC;IACJ,oCAAoC;IACpC,iBAAiB;IACjB,eAAe;IACf,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,0BAA0B;IAC1B,WAAW;IACX,UAAU;IACV,qBAAqB;IACrB,cAAc;IACd,4BAA4B;IAC5B,sBAAsB;IACtB,kBAAkB;IAClB,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,YAAY;IACZ,oCAAoC;IACpC,sBAAsB;IACtB,mBAAmB;IACnB,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,qBAAqB;IACrB,2BAA2B;IAC3B,gBAAgB;IAChB,yBAAyB;CAC1B,CAAC;KACD,QAAQ,CACP,gIAAgI,CACjI,CAAC;AAKJ;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,CAAC;IACN,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,GAAG,CAAC;SACR,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IACrF,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0EAA0E,CAAC;IACvF,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACpC,mEAAmE,CACpE;IACD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,cAAc,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC1C,6IAA6I,CAC9I;IACD,uBAAuB,EAAE,CAAC;SACvB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC1C,kEAAkE,CACnE;CACF,CAAC;KACD,QAAQ,CACP,0FAA0F,CAC3F,CAAC;AAKJ;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;AAChD,CAAC"}
|
package/dist/remote.d.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* How remote access is arranged for an instance.
|
|
4
|
+
*
|
|
5
|
+
* Mechanism, and safe under catalog blindness for the same reason the
|
|
6
|
+
* entitlement capability enums are: it describes how the thing works, not what
|
|
7
|
+
* anybody bought.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RemoteModeSchema: z.ZodEnum<{
|
|
10
|
+
byo: "byo";
|
|
11
|
+
managed: "managed";
|
|
12
|
+
off: "off";
|
|
13
|
+
}>;
|
|
14
|
+
/** Where the tunnel is in its lifecycle. */
|
|
15
|
+
export declare const RemoteStateSchema: z.ZodEnum<{
|
|
16
|
+
closed: "closed";
|
|
17
|
+
opening: "opening";
|
|
18
|
+
open: "open";
|
|
19
|
+
draining: "draining";
|
|
20
|
+
blocked: "blocked";
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* `GET /v1/remote/status`.
|
|
24
|
+
*
|
|
25
|
+
* `alwaysAvailable` is a boolean the server computes. A client renders the
|
|
26
|
+
* promise and never sees a subscription identifier to derive it from.
|
|
27
|
+
*/
|
|
28
|
+
export declare const RemoteStatusSchema: z.ZodObject<{
|
|
29
|
+
mode: z.ZodEnum<{
|
|
30
|
+
byo: "byo";
|
|
31
|
+
managed: "managed";
|
|
32
|
+
off: "off";
|
|
33
|
+
}>;
|
|
34
|
+
state: z.ZodEnum<{
|
|
35
|
+
closed: "closed";
|
|
36
|
+
opening: "opening";
|
|
37
|
+
open: "open";
|
|
38
|
+
draining: "draining";
|
|
39
|
+
blocked: "blocked";
|
|
40
|
+
}>;
|
|
41
|
+
address: z.ZodString;
|
|
42
|
+
url: z.ZodOptional<z.ZodString>;
|
|
43
|
+
openedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
44
|
+
idleClosesAt: z.ZodOptional<z.ZodISODateTime>;
|
|
45
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
46
|
+
alwaysAvailable: z.ZodBoolean;
|
|
47
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/** The current remote-access state of one instance. */
|
|
50
|
+
export type RemoteStatus = z.infer<typeof RemoteStatusSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* `POST /v1/remote/open`.
|
|
53
|
+
*
|
|
54
|
+
* Accepted from a person`s session, a person`s bearer token, or a valid wake
|
|
55
|
+
* token. Idempotent on `(instanceId, wakeId)`: repeating the call with the same
|
|
56
|
+
* wake identifier repeats the answer rather than opening a second tunnel.
|
|
57
|
+
*/
|
|
58
|
+
export declare const RemoteOpenRequestSchema: z.ZodObject<{
|
|
59
|
+
instanceId: z.ZodString;
|
|
60
|
+
wakeId: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
/** The accepted open request. */
|
|
63
|
+
export declare const RemoteOpenResponseSchema: z.ZodObject<{
|
|
64
|
+
wakeId: z.ZodString;
|
|
65
|
+
state: z.ZodEnum<{
|
|
66
|
+
closed: "closed";
|
|
67
|
+
opening: "opening";
|
|
68
|
+
open: "open";
|
|
69
|
+
draining: "draining";
|
|
70
|
+
blocked: "blocked";
|
|
71
|
+
}>;
|
|
72
|
+
pollAfterMs: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
/** `POST /v1/remote/close`. */
|
|
75
|
+
export declare const RemoteCloseResponseSchema: z.ZodObject<{
|
|
76
|
+
state: z.ZodEnum<{
|
|
77
|
+
closed: "closed";
|
|
78
|
+
opening: "opening";
|
|
79
|
+
open: "open";
|
|
80
|
+
draining: "draining";
|
|
81
|
+
blocked: "blocked";
|
|
82
|
+
}>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* `POST /v1/remote/wake-tokens` — mint a token that can open a closed tunnel.
|
|
86
|
+
*
|
|
87
|
+
* `token` is returned once. Hold it as a credential reference, never as
|
|
88
|
+
* configuration.
|
|
89
|
+
*/
|
|
90
|
+
export declare const RemoteWakeTokenSchema: z.ZodObject<{
|
|
91
|
+
token: z.ZodString;
|
|
92
|
+
expiresAt: z.ZodISODateTime;
|
|
93
|
+
singleUse: z.ZodBoolean;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
/**
|
|
96
|
+
* `POST /v1/remote/enrolment` — the person`s consent to managed remote access.
|
|
97
|
+
*
|
|
98
|
+
* Accepted only from a person`s session. An instance cannot enrol itself.
|
|
99
|
+
*/
|
|
100
|
+
export declare const RemoteEnrolmentSchema: z.ZodObject<{
|
|
101
|
+
enrolmentId: z.ZodString;
|
|
102
|
+
consentVersion: z.ZodString;
|
|
103
|
+
enrolledAt: z.ZodISODateTime;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
/** A person`s consent to managed remote access. */
|
|
106
|
+
export type RemoteEnrolment = z.infer<typeof RemoteEnrolmentSchema>;
|
|
107
|
+
/** `DELETE /v1/remote/enrolment` — withdrawn by the person or by the instance. */
|
|
108
|
+
export declare const RemoteEnrolmentWithdrawnSchema: z.ZodObject<{
|
|
109
|
+
withdrawnAt: z.ZodISODateTime;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
/** `GET` / `POST /v1/remote/address` — the canonical address for an instance. */
|
|
112
|
+
export declare const RemoteAddressSchema: z.ZodObject<{
|
|
113
|
+
address: z.ZodString;
|
|
114
|
+
host: z.ZodString;
|
|
115
|
+
kind: z.ZodLiteral<"canonical">;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
/** Where a custom hostname is in its setup. */
|
|
118
|
+
export declare const CustomAddressStatusSchema: z.ZodEnum<{
|
|
119
|
+
active: "active";
|
|
120
|
+
failed: "failed";
|
|
121
|
+
pending_verification: "pending_verification";
|
|
122
|
+
verifying: "verifying";
|
|
123
|
+
}>;
|
|
124
|
+
/** Where a custom hostname`s certificate is. */
|
|
125
|
+
export declare const CertificateStateSchema: z.ZodEnum<{
|
|
126
|
+
none: "none";
|
|
127
|
+
pending: "pending";
|
|
128
|
+
failed: "failed";
|
|
129
|
+
issued: "issued";
|
|
130
|
+
renewing: "renewing";
|
|
131
|
+
}>;
|
|
132
|
+
/** `GET` / `POST` / `DELETE /v1/remote/address/custom`. */
|
|
133
|
+
export declare const RemoteCustomAddressSchema: z.ZodObject<{
|
|
134
|
+
hostname: z.ZodString;
|
|
135
|
+
status: z.ZodEnum<{
|
|
136
|
+
active: "active";
|
|
137
|
+
failed: "failed";
|
|
138
|
+
pending_verification: "pending_verification";
|
|
139
|
+
verifying: "verifying";
|
|
140
|
+
}>;
|
|
141
|
+
verification: z.ZodObject<{
|
|
142
|
+
recordName: z.ZodString;
|
|
143
|
+
recordValue: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
certificate: z.ZodObject<{
|
|
146
|
+
state: z.ZodEnum<{
|
|
147
|
+
none: "none";
|
|
148
|
+
pending: "pending";
|
|
149
|
+
failed: "failed";
|
|
150
|
+
issued: "issued";
|
|
151
|
+
renewing: "renewing";
|
|
152
|
+
}>;
|
|
153
|
+
renewsAt: z.ZodNullable<z.ZodISODateTime>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
/** A custom hostname for an instance. */
|
|
157
|
+
export type RemoteCustomAddress = z.infer<typeof RemoteCustomAddressSchema>;
|
|
158
|
+
/** `POST /v1/orgs/{orgId}/remote/designation` — pick the always-available instance. */
|
|
159
|
+
export declare const RemoteDesignationRequestSchema: z.ZodObject<{
|
|
160
|
+
instanceId: z.ZodString;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
/** The accepted designation. */
|
|
163
|
+
export declare const RemoteDesignationSchema: z.ZodObject<{
|
|
164
|
+
instanceId: z.ZodString;
|
|
165
|
+
effectiveAt: z.ZodISODateTime;
|
|
166
|
+
cooldownUntil: z.ZodISODateTime;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
/**
|
|
169
|
+
* `POST /v1/remote/credentials/issue` — an instance asks for a tunnel
|
|
170
|
+
* credential.
|
|
171
|
+
*
|
|
172
|
+
* Instance API key only. `value` is returned once.
|
|
173
|
+
*/
|
|
174
|
+
export declare const RemoteCredentialIssueRequestSchema: z.ZodObject<{
|
|
175
|
+
instanceId: z.ZodString;
|
|
176
|
+
idempotencyKey: z.ZodString;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
/** A freshly issued tunnel credential. */
|
|
179
|
+
export declare const RemoteCredentialSchema: z.ZodObject<{
|
|
180
|
+
issuanceId: z.ZodString;
|
|
181
|
+
credentialId: z.ZodString;
|
|
182
|
+
value: z.ZodString;
|
|
183
|
+
fingerprint: z.ZodString;
|
|
184
|
+
acl: z.ZodArray<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
/** A freshly issued tunnel credential. */
|
|
187
|
+
export type RemoteCredential = z.infer<typeof RemoteCredentialSchema>;
|
|
188
|
+
/** `POST /v1/remote/credentials/confirm` — the instance reports it stored the credential. */
|
|
189
|
+
export declare const RemoteCredentialConfirmRequestSchema: z.ZodObject<{
|
|
190
|
+
credentialId: z.ZodString;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
/** The confirmation. */
|
|
193
|
+
export declare const RemoteCredentialConfirmResponseSchema: z.ZodObject<{
|
|
194
|
+
credentialId: z.ZodString;
|
|
195
|
+
confirmedAt: z.ZodISODateTime;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
/**
|
|
198
|
+
* One event on the instance command stream.
|
|
199
|
+
*
|
|
200
|
+
* A published discriminated union rather than an untyped string, so adding a
|
|
201
|
+
* command kind later is a package release the two sides can agree on rather
|
|
202
|
+
* than a field they disagree about.
|
|
203
|
+
*/
|
|
204
|
+
export declare const RemoteCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"open">;
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
leaseToken: z.ZodString;
|
|
208
|
+
wakeId: z.ZodString;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
kind: z.ZodLiteral<"close">;
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
leaseToken: z.ZodString;
|
|
213
|
+
reason: z.ZodString;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"rotate">;
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
leaseToken: z.ZodString;
|
|
218
|
+
credentialId: z.ZodString;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
kind: z.ZodLiteral<"revoke">;
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
leaseToken: z.ZodString;
|
|
223
|
+
credentialId: z.ZodString;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
kind: z.ZodLiteral<"inbox_pending">;
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
leaseToken: z.ZodString;
|
|
228
|
+
seatId: z.ZodString;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
kind: z.ZodLiteral<"keepalive">;
|
|
231
|
+
id: z.ZodString;
|
|
232
|
+
}, z.core.$strip>], "kind">;
|
|
233
|
+
/** One event on the instance command stream. */
|
|
234
|
+
export type RemoteCommand = z.infer<typeof RemoteCommandSchema>;
|
|
235
|
+
/** `POST /v1/remote/commands/ack`. */
|
|
236
|
+
export declare const RemoteCommandAckRequestSchema: z.ZodObject<{
|
|
237
|
+
items: z.ZodArray<z.ZodObject<{
|
|
238
|
+
id: z.ZodString;
|
|
239
|
+
leaseToken: z.ZodString;
|
|
240
|
+
outcome: z.ZodEnum<{
|
|
241
|
+
failed: "failed";
|
|
242
|
+
applied: "applied";
|
|
243
|
+
ignored: "ignored";
|
|
244
|
+
}>;
|
|
245
|
+
}, z.core.$strip>>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
/** How many command leases were settled. */
|
|
248
|
+
export declare const RemoteCommandAckResponseSchema: z.ZodObject<{
|
|
249
|
+
acknowledged: z.ZodNumber;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
/** `POST /v1/remote/events` — batched activity from an instance. */
|
|
252
|
+
export declare const RemoteEventBatchSchema: z.ZodObject<{
|
|
253
|
+
instanceId: z.ZodString;
|
|
254
|
+
activity: z.ZodArray<z.ZodObject<{
|
|
255
|
+
at: z.ZodISODateTime;
|
|
256
|
+
requests: z.ZodNumber;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
closeReports: z.ZodArray<z.ZodObject<{
|
|
259
|
+
at: z.ZodISODateTime;
|
|
260
|
+
reason: z.ZodString;
|
|
261
|
+
wakeId: z.ZodNullable<z.ZodString>;
|
|
262
|
+
}, z.core.$strip>>;
|
|
263
|
+
}, z.core.$strip>;
|
|
264
|
+
/** How many events were accepted. */
|
|
265
|
+
export declare const RemoteEventBatchResponseSchema: z.ZodObject<{
|
|
266
|
+
accepted: z.ZodNumber;
|
|
267
|
+
}, z.core.$strip>;
|
|
268
|
+
//# sourceMappingURL=remote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;EAEgE,CAAC;AAE9F,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB;;;;;;EAEsB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;iBAmBgC,CAAC;AAEhE,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;iBASjC,CAAC;AAEJ,iCAAiC;AACjC,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAUqD,CAAC;AAE3F,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB;;;;;;;;iBAE+B,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;iBAMuD,CAAC;AAE1F;;;;GAIG;AAC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AAM,6BAA6B;;;;;;;;;;iBAe6B,CAAC;AAExE,4CAA4C;AAC5C,eAAO,MAAM,8BAA8B;;iBAEe,CAAC;AAE3D,oEAAoE;AACpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAUkD,CAAC;AAEtF,qCAAqC;AACrC,eAAO,MAAM,8BAA8B;;iBAEwB,CAAC"}
|
package/dist/remote.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { IdSchema, SecretValueSchema, TimestampSchema } from './primitives.js';
|
|
3
|
+
/**
|
|
4
|
+
* How remote access is arranged for an instance.
|
|
5
|
+
*
|
|
6
|
+
* Mechanism, and safe under catalog blindness for the same reason the
|
|
7
|
+
* entitlement capability enums are: it describes how the thing works, not what
|
|
8
|
+
* anybody bought.
|
|
9
|
+
*/
|
|
10
|
+
export const RemoteModeSchema = z
|
|
11
|
+
.enum(['off', 'byo', 'managed'])
|
|
12
|
+
.describe('How remote access is arranged: off, the caller`s own tunnel, or a managed one.');
|
|
13
|
+
/** Where the tunnel is in its lifecycle. */
|
|
14
|
+
export const RemoteStateSchema = z
|
|
15
|
+
.enum(['closed', 'opening', 'open', 'draining', 'blocked'])
|
|
16
|
+
.describe('Where the tunnel is in its lifecycle.');
|
|
17
|
+
/**
|
|
18
|
+
* `GET /v1/remote/status`.
|
|
19
|
+
*
|
|
20
|
+
* `alwaysAvailable` is a boolean the server computes. A client renders the
|
|
21
|
+
* promise and never sees a subscription identifier to derive it from.
|
|
22
|
+
*/
|
|
23
|
+
export const RemoteStatusSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
mode: RemoteModeSchema,
|
|
26
|
+
state: RemoteStateSchema,
|
|
27
|
+
address: z.string().describe('The address this instance is reachable at.'),
|
|
28
|
+
url: z.string().url().optional().describe('The full URL, when the tunnel is open.'),
|
|
29
|
+
openedAt: TimestampSchema.optional(),
|
|
30
|
+
idleClosesAt: TimestampSchema.optional().describe('When an idle tunnel will close itself.'),
|
|
31
|
+
lastActivityAt: TimestampSchema.optional(),
|
|
32
|
+
alwaysAvailable: z
|
|
33
|
+
.boolean()
|
|
34
|
+
.describe('Computed by the server. The client renders the promise and never derives it from a subscription.'),
|
|
35
|
+
reason: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Why the tunnel is in this state, when the state needs explaining.'),
|
|
39
|
+
})
|
|
40
|
+
.describe('The current remote-access state of one instance.');
|
|
41
|
+
/**
|
|
42
|
+
* `POST /v1/remote/open`.
|
|
43
|
+
*
|
|
44
|
+
* Accepted from a person`s session, a person`s bearer token, or a valid wake
|
|
45
|
+
* token. Idempotent on `(instanceId, wakeId)`: repeating the call with the same
|
|
46
|
+
* wake identifier repeats the answer rather than opening a second tunnel.
|
|
47
|
+
*/
|
|
48
|
+
export const RemoteOpenRequestSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
instanceId: IdSchema,
|
|
51
|
+
wakeId: IdSchema.describe('A client-chosen idempotency key. The same key repeats the answer, not the effect.'),
|
|
52
|
+
})
|
|
53
|
+
.describe('Open the tunnel for an instance. Idempotent on the instance and wake identifier together.');
|
|
54
|
+
/** The accepted open request. */
|
|
55
|
+
export const RemoteOpenResponseSchema = z
|
|
56
|
+
.object({
|
|
57
|
+
wakeId: IdSchema,
|
|
58
|
+
state: RemoteStateSchema,
|
|
59
|
+
pollAfterMs: z
|
|
60
|
+
.number()
|
|
61
|
+
.int()
|
|
62
|
+
.nonnegative()
|
|
63
|
+
.describe('How long to wait before reading the status again.'),
|
|
64
|
+
})
|
|
65
|
+
.describe('The accepted open request, and how long to wait before checking the status.');
|
|
66
|
+
/** `POST /v1/remote/close`. */
|
|
67
|
+
export const RemoteCloseResponseSchema = z
|
|
68
|
+
.object({ state: RemoteStateSchema })
|
|
69
|
+
.describe('The state the tunnel is in after being asked to close.');
|
|
70
|
+
/**
|
|
71
|
+
* `POST /v1/remote/wake-tokens` — mint a token that can open a closed tunnel.
|
|
72
|
+
*
|
|
73
|
+
* `token` is returned once. Hold it as a credential reference, never as
|
|
74
|
+
* configuration.
|
|
75
|
+
*/
|
|
76
|
+
export const RemoteWakeTokenSchema = z
|
|
77
|
+
.object({
|
|
78
|
+
token: SecretValueSchema,
|
|
79
|
+
expiresAt: TimestampSchema,
|
|
80
|
+
singleUse: z.boolean(),
|
|
81
|
+
})
|
|
82
|
+
.describe('A token that can open a closed tunnel. The value is returned exactly once.');
|
|
83
|
+
/**
|
|
84
|
+
* `POST /v1/remote/enrolment` — the person`s consent to managed remote access.
|
|
85
|
+
*
|
|
86
|
+
* Accepted only from a person`s session. An instance cannot enrol itself.
|
|
87
|
+
*/
|
|
88
|
+
export const RemoteEnrolmentSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
enrolmentId: IdSchema,
|
|
91
|
+
consentVersion: z.string().describe('Which version of the consent text the person agreed to.'),
|
|
92
|
+
enrolledAt: TimestampSchema,
|
|
93
|
+
})
|
|
94
|
+
.describe('A person`s consent to managed remote access. Only a person`s session can create one.');
|
|
95
|
+
/** `DELETE /v1/remote/enrolment` — withdrawn by the person or by the instance. */
|
|
96
|
+
export const RemoteEnrolmentWithdrawnSchema = z
|
|
97
|
+
.object({ withdrawnAt: TimestampSchema })
|
|
98
|
+
.describe('When consent was withdrawn. Either the person or the instance may withdraw it.');
|
|
99
|
+
/** `GET` / `POST /v1/remote/address` — the canonical address for an instance. */
|
|
100
|
+
export const RemoteAddressSchema = z
|
|
101
|
+
.object({
|
|
102
|
+
address: z.string(),
|
|
103
|
+
host: z.string(),
|
|
104
|
+
kind: z.literal('canonical'),
|
|
105
|
+
})
|
|
106
|
+
.describe('The canonical address an instance is reachable at.');
|
|
107
|
+
/** Where a custom hostname is in its setup. */
|
|
108
|
+
export const CustomAddressStatusSchema = z
|
|
109
|
+
.enum(['pending_verification', 'verifying', 'active', 'failed'])
|
|
110
|
+
.describe('Where a custom hostname is in its setup.');
|
|
111
|
+
/** Where a custom hostname`s certificate is. */
|
|
112
|
+
export const CertificateStateSchema = z
|
|
113
|
+
.enum(['none', 'pending', 'issued', 'renewing', 'failed'])
|
|
114
|
+
.describe('Where a custom hostname`s certificate is.');
|
|
115
|
+
/** `GET` / `POST` / `DELETE /v1/remote/address/custom`. */
|
|
116
|
+
export const RemoteCustomAddressSchema = z
|
|
117
|
+
.object({
|
|
118
|
+
hostname: z.string(),
|
|
119
|
+
status: CustomAddressStatusSchema,
|
|
120
|
+
verification: z
|
|
121
|
+
.object({
|
|
122
|
+
recordName: z.string().describe('The DNS record name to create.'),
|
|
123
|
+
recordValue: z.string().describe('The DNS record value to set.'),
|
|
124
|
+
})
|
|
125
|
+
.describe('The DNS record that proves the caller controls the hostname.'),
|
|
126
|
+
certificate: z
|
|
127
|
+
.object({ state: CertificateStateSchema, renewsAt: TimestampSchema.nullable() })
|
|
128
|
+
.describe('The certificate this hostname is served with.'),
|
|
129
|
+
})
|
|
130
|
+
.describe('A custom hostname for an instance, its verification record and its certificate.');
|
|
131
|
+
/** `POST /v1/orgs/{orgId}/remote/designation` — pick the always-available instance. */
|
|
132
|
+
export const RemoteDesignationRequestSchema = z
|
|
133
|
+
.object({ instanceId: IdSchema })
|
|
134
|
+
.describe('Designate which instance an organization keeps always available.');
|
|
135
|
+
/** The accepted designation. */
|
|
136
|
+
export const RemoteDesignationSchema = z
|
|
137
|
+
.object({
|
|
138
|
+
instanceId: IdSchema,
|
|
139
|
+
effectiveAt: TimestampSchema,
|
|
140
|
+
cooldownUntil: TimestampSchema.describe('Until when the designation cannot be changed again.'),
|
|
141
|
+
})
|
|
142
|
+
.describe('The accepted designation, and when it may next be changed.');
|
|
143
|
+
/**
|
|
144
|
+
* `POST /v1/remote/credentials/issue` — an instance asks for a tunnel
|
|
145
|
+
* credential.
|
|
146
|
+
*
|
|
147
|
+
* Instance API key only. `value` is returned once.
|
|
148
|
+
*/
|
|
149
|
+
export const RemoteCredentialIssueRequestSchema = z
|
|
150
|
+
.object({
|
|
151
|
+
instanceId: IdSchema,
|
|
152
|
+
idempotencyKey: z
|
|
153
|
+
.string()
|
|
154
|
+
.min(1)
|
|
155
|
+
.describe('A client-chosen key. Repeating an issue with the same key repeats the answer, not the effect.'),
|
|
156
|
+
})
|
|
157
|
+
.describe('An instance asking for a tunnel credential. Instance API key only.');
|
|
158
|
+
/** A freshly issued tunnel credential. */
|
|
159
|
+
export const RemoteCredentialSchema = z
|
|
160
|
+
.object({
|
|
161
|
+
issuanceId: IdSchema,
|
|
162
|
+
credentialId: IdSchema,
|
|
163
|
+
value: SecretValueSchema,
|
|
164
|
+
fingerprint: z.string().describe('A stable digest of the credential, safe to log and compare.'),
|
|
165
|
+
acl: z
|
|
166
|
+
.array(z.string())
|
|
167
|
+
.describe('What this credential may do, as opaque server-supplied strings.'),
|
|
168
|
+
})
|
|
169
|
+
.describe('A freshly issued tunnel credential. The `value` is returned exactly once.');
|
|
170
|
+
/** `POST /v1/remote/credentials/confirm` — the instance reports it stored the credential. */
|
|
171
|
+
export const RemoteCredentialConfirmRequestSchema = z
|
|
172
|
+
.object({ credentialId: IdSchema })
|
|
173
|
+
.describe('An instance confirming it has stored an issued credential.');
|
|
174
|
+
/** The confirmation. */
|
|
175
|
+
export const RemoteCredentialConfirmResponseSchema = z
|
|
176
|
+
.object({ credentialId: IdSchema, confirmedAt: TimestampSchema })
|
|
177
|
+
.describe('When the server recorded the instance`s confirmation.');
|
|
178
|
+
/**
|
|
179
|
+
* One event on the instance command stream.
|
|
180
|
+
*
|
|
181
|
+
* A published discriminated union rather than an untyped string, so adding a
|
|
182
|
+
* command kind later is a package release the two sides can agree on rather
|
|
183
|
+
* than a field they disagree about.
|
|
184
|
+
*/
|
|
185
|
+
export const RemoteCommandSchema = z
|
|
186
|
+
.discriminatedUnion('kind', [
|
|
187
|
+
z
|
|
188
|
+
.object({
|
|
189
|
+
kind: z.literal('open'),
|
|
190
|
+
id: IdSchema,
|
|
191
|
+
leaseToken: z.string().min(1),
|
|
192
|
+
wakeId: IdSchema,
|
|
193
|
+
})
|
|
194
|
+
.describe('Open the tunnel.'),
|
|
195
|
+
z
|
|
196
|
+
.object({
|
|
197
|
+
kind: z.literal('close'),
|
|
198
|
+
id: IdSchema,
|
|
199
|
+
leaseToken: z.string().min(1),
|
|
200
|
+
reason: z.string(),
|
|
201
|
+
})
|
|
202
|
+
.describe('Close the tunnel.'),
|
|
203
|
+
z
|
|
204
|
+
.object({
|
|
205
|
+
kind: z.literal('rotate'),
|
|
206
|
+
id: IdSchema,
|
|
207
|
+
leaseToken: z.string().min(1),
|
|
208
|
+
credentialId: IdSchema,
|
|
209
|
+
})
|
|
210
|
+
.describe('Replace the tunnel credential.'),
|
|
211
|
+
z
|
|
212
|
+
.object({
|
|
213
|
+
kind: z.literal('revoke'),
|
|
214
|
+
id: IdSchema,
|
|
215
|
+
leaseToken: z.string().min(1),
|
|
216
|
+
credentialId: IdSchema,
|
|
217
|
+
})
|
|
218
|
+
.describe('Stop using the tunnel credential and forget it.'),
|
|
219
|
+
z
|
|
220
|
+
.object({
|
|
221
|
+
kind: z.literal('inbox_pending'),
|
|
222
|
+
id: IdSchema,
|
|
223
|
+
leaseToken: z.string().min(1),
|
|
224
|
+
seatId: IdSchema,
|
|
225
|
+
})
|
|
226
|
+
.describe('There is mail waiting for a seat.'),
|
|
227
|
+
z
|
|
228
|
+
.object({ kind: z.literal('keepalive'), id: IdSchema })
|
|
229
|
+
.describe('Nothing to do. Sent so a silent stream can be told from a dead one.'),
|
|
230
|
+
])
|
|
231
|
+
.describe('One event on the `GET /v1/remote/commands` stream. Server-sent events; instance API key only.');
|
|
232
|
+
/** `POST /v1/remote/commands/ack`. */
|
|
233
|
+
export const RemoteCommandAckRequestSchema = z
|
|
234
|
+
.object({
|
|
235
|
+
items: z
|
|
236
|
+
.array(z.object({
|
|
237
|
+
id: IdSchema,
|
|
238
|
+
leaseToken: z.string().min(1),
|
|
239
|
+
outcome: z
|
|
240
|
+
.enum(['applied', 'ignored', 'failed'])
|
|
241
|
+
.describe('What the instance did with the command.'),
|
|
242
|
+
}))
|
|
243
|
+
.min(1)
|
|
244
|
+
.max(100),
|
|
245
|
+
})
|
|
246
|
+
.describe('Report what an instance did with the commands it leased.');
|
|
247
|
+
/** How many command leases were settled. */
|
|
248
|
+
export const RemoteCommandAckResponseSchema = z
|
|
249
|
+
.object({ acknowledged: z.number().int().nonnegative() })
|
|
250
|
+
.describe('How many command leases the server settled.');
|
|
251
|
+
/** `POST /v1/remote/events` — batched activity from an instance. */
|
|
252
|
+
export const RemoteEventBatchSchema = z
|
|
253
|
+
.object({
|
|
254
|
+
instanceId: IdSchema,
|
|
255
|
+
activity: z
|
|
256
|
+
.array(z.object({ at: TimestampSchema, requests: z.number().int().nonnegative() }))
|
|
257
|
+
.describe('Windowed request counters.'),
|
|
258
|
+
closeReports: z
|
|
259
|
+
.array(z.object({ at: TimestampSchema, reason: z.string(), wakeId: IdSchema.nullable() }))
|
|
260
|
+
.describe('Why and when the tunnel closed itself.'),
|
|
261
|
+
})
|
|
262
|
+
.describe('Batched activity, close reports and window counters from one instance.');
|
|
263
|
+
/** How many events were accepted. */
|
|
264
|
+
export const RemoteEventBatchResponseSchema = z
|
|
265
|
+
.object({ accepted: z.number().int().nonnegative() })
|
|
266
|
+
.describe('How many of the reported events the server accepted.');
|
|
267
|
+
//# sourceMappingURL=remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../src/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;KAC/B,QAAQ,CAAC,gFAAgF,CAAC,CAAC;AAE9F,4CAA4C;AAC5C,MAAM,CAAC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