@antasphere/chassis-contract 1.0.0 → 1.0.2
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/dist/entitlements.d.ts +9 -230
- package/dist/entitlements.d.ts.map +1 -1
- package/dist/entitlements.js +20 -209
- package/dist/entitlements.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/entitlements.ts +46 -233
- package/src/index.ts +0 -1
- package/dist/wire.d.ts +0 -101
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -161
- package/dist/wire.js.map +0 -1
- package/src/wire.ts +0 -246
- package/test/hub-wire.test.ts +0 -114
package/dist/entitlements.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type BillingPlan } from '@antasphere/contract';
|
|
2
3
|
import type { HeaderReader, Principal } from './seams.js';
|
|
3
4
|
/**
|
|
4
5
|
* The billing rail's declaration layer (the pay-per-use billing rail spec,
|
|
@@ -13,242 +14,20 @@ import type { HeaderReader, Principal } from './seams.js';
|
|
|
13
14
|
* tool's contract builds the registry from its route objects and the SDK can
|
|
14
15
|
* read the same declarations without pulling the server.
|
|
15
16
|
*/
|
|
17
|
+
export { BILLING_PLANS, USAGE_CHECK_REASONS, USAGE_EVENT_MAX_FUTURE_MS, USAGE_EVENT_MAX_PAST_MS, USAGE_EVENTS_BATCH_MAX, USAGE_REJECT_REASONS, USAGE_ROUTE_ERRORS, USAGE_WRITE_SCOPE, usageCheckRequestSchema, usageCheckSchema, usageEventOccurrenceIssue, usageEventResultSchema, usageEventSchema, usageEventsBatchSchema, usageIngestResultSchema, usageRejectReasonSchema } from '@antasphere/contract';
|
|
18
|
+
export type { UsageCheck, UsageCheckReason, UsageCheckRequest, UsageEventResult, UsageEventsBatch, UsageIngestResult, UsageRejectReason, UsageRouteError } from '@antasphere/contract';
|
|
16
19
|
/**
|
|
17
|
-
* The plan tiers, a CLOSED enum the hub owns
|
|
18
|
-
*
|
|
19
|
-
* `pro` is the paid plan. "Enterprise" is not
|
|
20
|
-
* override the hub serves.
|
|
20
|
+
* The plan tiers, a CLOSED enum the hub owns (`BILLING_PLANS` in
|
|
21
|
+
* `@antasphere/contract`), under the chassis's own names (§8b): `free` is the
|
|
22
|
+
* default with no subscription; `pro` is the paid plan. "Enterprise" is not
|
|
23
|
+
* a tier but a per-account override the hub serves.
|
|
21
24
|
*/
|
|
22
25
|
export declare const ENTITLEMENT_TIERS: readonly ["free", "pro"];
|
|
23
|
-
export type EntitlementTier =
|
|
26
|
+
export type EntitlementTier = BillingPlan;
|
|
24
27
|
export declare const entitlementTierSchema: z.ZodEnum<{
|
|
25
28
|
free: "free";
|
|
26
29
|
pro: "pro";
|
|
27
30
|
}>;
|
|
28
|
-
/** The hub's name for the same closed enum (`BILLING_PLANS` in `@antasphere/contract`). */
|
|
29
|
-
export declare const BILLING_PLANS: readonly ["free", "pro"];
|
|
30
|
-
/**
|
|
31
|
-
* The one scope of the tool → hub machine channel (§6): a `client_credentials`
|
|
32
|
-
* token on the registry client, reaching `/usage/*` and nothing else.
|
|
33
|
-
*/
|
|
34
|
-
export declare const USAGE_WRITE_SCOPE = "usage:write";
|
|
35
|
-
/**
|
|
36
|
-
* The error codes the three tool routes of the hub (`POST /usage/events`,
|
|
37
|
-
* `GET /usage/entitlements`, `POST /usage/check`) answer with, and the status
|
|
38
|
-
* each rides on: the hub's `USAGE_ROUTE_ERRORS` (PRDCT-2677).
|
|
39
|
-
* `tool_credential_required`: the caller is not a registry tool's machine
|
|
40
|
-
* credential. `unknown_account`: no organization holds the `accountRef` (the
|
|
41
|
-
* check and the entitlements read; the ingest answers it per event instead).
|
|
42
|
-
* `validation_error`: the body or the query does not parse. The chassis maps
|
|
43
|
-
* the check's two (`check.ts`): a 404 `unknown_account` and a 400 are the
|
|
44
|
-
* hub's judgement, allowed and logged, never an outage.
|
|
45
|
-
*/
|
|
46
|
-
export declare const USAGE_ROUTE_ERRORS: {
|
|
47
|
-
readonly tool_credential_required: 401;
|
|
48
|
-
readonly unknown_account: 404;
|
|
49
|
-
readonly validation_error: 400;
|
|
50
|
-
};
|
|
51
|
-
export type UsageRouteError = keyof typeof USAGE_ROUTE_ERRORS;
|
|
52
|
-
/**
|
|
53
|
-
* The wire shape of one usage event as the hub ingests it: the hub's
|
|
54
|
-
* `usageEventSchema` (`packages/contract/src/schemas/billing.ts` of the hub,
|
|
55
|
-
* PRDCT-2625), copied here and checked against the hub's wire snapshot
|
|
56
|
-
* (`wire.ts`, `pnpm --filter @antasphere/chassis-contract wire:check`, the
|
|
57
|
-
* `hub-wire` CI job; PRDCT-2677), so the fake hub of the test kit refuses
|
|
58
|
-
* exactly what the real hub refuses (PRDCT-2629). `userId` is the HUB user
|
|
59
|
-
* (the SSO `sub`), never the tool's local id, and null when the actor is a
|
|
60
|
-
* resource owner the tool could not name; `accountRef` is the hub
|
|
61
|
-
* organization id (a uuid) the tool carries as its workspace's central
|
|
62
|
-
* account id. `toolSlug` is accepted by the hub only when it equals the
|
|
63
|
-
* calling token's registry slug — the chassis NEVER sends it: the token is
|
|
64
|
-
* the only authority on the tool's name, the body never names the tool
|
|
65
|
-
* (PRDCT-2629; `UsageEvent` in seams.ts has no such field).
|
|
66
|
-
*/
|
|
67
|
-
export declare const usageEventSchema: z.ZodObject<{
|
|
68
|
-
id: z.ZodString;
|
|
69
|
-
actionKey: z.ZodOptional<z.ZodString>;
|
|
70
|
-
meter: z.ZodOptional<z.ZodString>;
|
|
71
|
-
quantity: z.ZodNumber;
|
|
72
|
-
unit: z.ZodString;
|
|
73
|
-
occurredAt: z.ZodISODateTime;
|
|
74
|
-
workspaceId: z.ZodString;
|
|
75
|
-
accountRef: z.ZodUUID;
|
|
76
|
-
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
-
via: z.ZodEnum<{
|
|
78
|
-
session: "session";
|
|
79
|
-
api_key: "api_key";
|
|
80
|
-
oauth: "oauth";
|
|
81
|
-
}>;
|
|
82
|
-
resourceType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
-
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
-
toolSlug: z.ZodOptional<z.ZodString>;
|
|
85
|
-
source: z.ZodObject<{
|
|
86
|
-
instanceId: z.ZodString;
|
|
87
|
-
edition: z.ZodString;
|
|
88
|
-
version: z.ZodString;
|
|
89
|
-
}, z.core.$strip>;
|
|
90
|
-
}, z.core.$strip>;
|
|
91
|
-
/** The batch cap of `POST /usage/events` (the hub's `USAGE_EVENTS_BATCH_MAX`): at most this many events per post. */
|
|
92
|
-
export declare const USAGE_EVENTS_BATCH_MAX = 500;
|
|
93
|
-
/**
|
|
94
|
-
* The body of `POST /usage/events` as the hub parses it (its
|
|
95
|
-
* `usageEventsBatchSchema`): one to `USAGE_EVENTS_BATCH_MAX` elements, each
|
|
96
|
-
* judged on its own against `usageEventSchema` afterwards.
|
|
97
|
-
*/
|
|
98
|
-
export declare const usageEventsBatchSchema: z.ZodObject<{
|
|
99
|
-
events: z.ZodArray<z.ZodUnknown>;
|
|
100
|
-
}, z.core.$strip>;
|
|
101
|
-
export type UsageEventsBatch = z.infer<typeof usageEventsBatchSchema>;
|
|
102
|
-
/**
|
|
103
|
-
* Why the hub did not accept an event (its `USAGE_REJECT_REASONS`, a closed
|
|
104
|
-
* list): `unknown_account`, `unknown_user`, `tool_mismatch`, and
|
|
105
|
-
* `invalid_event` (the element does not parse, its `occurredAt` falls outside
|
|
106
|
-
* the window, or its price exceeds `Number.MAX_SAFE_INTEGER`; `details` names
|
|
107
|
-
* the field).
|
|
108
|
-
*/
|
|
109
|
-
export declare const USAGE_REJECT_REASONS: readonly ["unknown_account", "unknown_user", "tool_mismatch", "invalid_event"];
|
|
110
|
-
export declare const usageRejectReasonSchema: z.ZodEnum<{
|
|
111
|
-
unknown_account: "unknown_account";
|
|
112
|
-
unknown_user: "unknown_user";
|
|
113
|
-
tool_mismatch: "tool_mismatch";
|
|
114
|
-
invalid_event: "invalid_event";
|
|
115
|
-
}>;
|
|
116
|
-
export type UsageRejectReason = z.infer<typeof usageRejectReasonSchema>;
|
|
117
|
-
/**
|
|
118
|
-
* One element's answer. Since phase 2 an `accepted` result carries the
|
|
119
|
-
* `credits` the hub debited for it (0 when the action has no price).
|
|
120
|
-
*/
|
|
121
|
-
export declare const usageEventResultSchema: z.ZodObject<{
|
|
122
|
-
id: z.ZodNullable<z.ZodString>;
|
|
123
|
-
status: z.ZodEnum<{
|
|
124
|
-
accepted: "accepted";
|
|
125
|
-
duplicate: "duplicate";
|
|
126
|
-
rejected: "rejected";
|
|
127
|
-
}>;
|
|
128
|
-
reason: z.ZodOptional<z.ZodEnum<{
|
|
129
|
-
unknown_account: "unknown_account";
|
|
130
|
-
unknown_user: "unknown_user";
|
|
131
|
-
tool_mismatch: "tool_mismatch";
|
|
132
|
-
invalid_event: "invalid_event";
|
|
133
|
-
}>>;
|
|
134
|
-
details: z.ZodOptional<z.ZodUnknown>;
|
|
135
|
-
credits: z.ZodOptional<z.ZodNumber>;
|
|
136
|
-
}, z.core.$strip>;
|
|
137
|
-
export type UsageEventResult = z.infer<typeof usageEventResultSchema>;
|
|
138
|
-
/**
|
|
139
|
-
* The hub's answer to `POST /usage/events`: one result per element, in the
|
|
140
|
-
* batch's order, and the three counts (always sent).
|
|
141
|
-
*/
|
|
142
|
-
export declare const usageIngestResultSchema: z.ZodObject<{
|
|
143
|
-
results: z.ZodArray<z.ZodObject<{
|
|
144
|
-
id: z.ZodNullable<z.ZodString>;
|
|
145
|
-
status: z.ZodEnum<{
|
|
146
|
-
accepted: "accepted";
|
|
147
|
-
duplicate: "duplicate";
|
|
148
|
-
rejected: "rejected";
|
|
149
|
-
}>;
|
|
150
|
-
reason: z.ZodOptional<z.ZodEnum<{
|
|
151
|
-
unknown_account: "unknown_account";
|
|
152
|
-
unknown_user: "unknown_user";
|
|
153
|
-
tool_mismatch: "tool_mismatch";
|
|
154
|
-
invalid_event: "invalid_event";
|
|
155
|
-
}>>;
|
|
156
|
-
details: z.ZodOptional<z.ZodUnknown>;
|
|
157
|
-
credits: z.ZodOptional<z.ZodNumber>;
|
|
158
|
-
}, z.core.$strip>>;
|
|
159
|
-
accepted: z.ZodNumber;
|
|
160
|
-
duplicate: z.ZodNumber;
|
|
161
|
-
rejected: z.ZodNumber;
|
|
162
|
-
}, z.core.$strip>;
|
|
163
|
-
export type UsageIngestResult = z.infer<typeof usageIngestResultSchema>;
|
|
164
|
-
/**
|
|
165
|
-
* The window an event's `occurredAt` must fall in, measured against the
|
|
166
|
-
* moment the hub receives it: the hub's `USAGE_EVENT_MAX_PAST_MS` and
|
|
167
|
-
* `USAGE_EVENT_MAX_FUTURE_MS` (`packages/contract/src/schemas/billing.ts`
|
|
168
|
-
* of the hub), same names and values, checked against the hub's wire
|
|
169
|
-
* snapshot (`wire.ts`, `wire:check`, the `hub-wire` CI job; PRDCT-2677). Backward, seven days:
|
|
170
|
-
* the queue's retry budget is about eight and a half hours, so an outage of
|
|
171
|
-
* a night is covered many times over, and a week also covers an operator
|
|
172
|
-
* re-driving held jobs by hand. Forward, five minutes: the skew every JWT
|
|
173
|
-
* verifier already tolerates; anything further is a clock that is wrong.
|
|
174
|
-
* Outside the window the hub answers `rejected(invalid_event)` naming
|
|
175
|
-
* `occurredAt` and never clamps, so the poster refuses BEFORE posting: an
|
|
176
|
-
* event the hub would refuse on its date is held where it was made, never
|
|
177
|
-
* counted as a rejection at the hub (PRDCT-2644).
|
|
178
|
-
*/
|
|
179
|
-
export declare const USAGE_EVENT_MAX_PAST_MS: number;
|
|
180
|
-
export declare const USAGE_EVENT_MAX_FUTURE_MS: number;
|
|
181
|
-
/**
|
|
182
|
-
* Why an event's `occurredAt` is refused against the receipt time, or null
|
|
183
|
-
* when it falls inside the window (both bounds INCLUSIVE). The hub's
|
|
184
|
-
* `usageEventOccurrenceIssue`, copied (the wire snapshot's occurrence table
|
|
185
|
-
* checks it on the hub's offsets): the one comparison both
|
|
186
|
-
* halves run, the hub at ingest against its own clock, the chassis before
|
|
187
|
-
* posting against its best estimate of the receipt (its own clock), so the
|
|
188
|
-
* two never disagree on the sign or the edge.
|
|
189
|
-
*/
|
|
190
|
-
export declare function usageEventOccurrenceIssue(occurredAt: Date, receivedAt: Date): {
|
|
191
|
-
path: 'occurredAt';
|
|
192
|
-
message: string;
|
|
193
|
-
} | null;
|
|
194
|
-
/**
|
|
195
|
-
* The request of `POST /usage/check` (the hub's `UsageCheckRequest`,
|
|
196
|
-
* PRDCT-2663): the paying account, the action key and the quantity of THIS
|
|
197
|
-
* request. `unit` is accepted and ignored by the hub, which prices by its
|
|
198
|
-
* own row; it is sent so the answer's unit can be compared and a mismatch
|
|
199
|
-
* logged.
|
|
200
|
-
*/
|
|
201
|
-
export declare const usageCheckRequestSchema: z.ZodObject<{
|
|
202
|
-
accountRef: z.ZodUUID;
|
|
203
|
-
actionKey: z.ZodString;
|
|
204
|
-
quantity: z.ZodNumber;
|
|
205
|
-
unit: z.ZodOptional<z.ZodString>;
|
|
206
|
-
}, z.core.$strip>;
|
|
207
|
-
export type UsageCheckRequest = z.infer<typeof usageCheckRequestSchema>;
|
|
208
|
-
/**
|
|
209
|
-
* The three reasons a check refuses (`null` when allowed), the hub's
|
|
210
|
-
* `USAGE_CHECK_REASONS`: `account_suspended` (checked first, whatever the
|
|
211
|
-
* price), `unpriceable` (the price of this quantity exceeds
|
|
212
|
-
* `Number.MAX_SAFE_INTEGER`: the hub clamps `credits` to that bound, and the
|
|
213
|
-
* ingest would reject the same event on its `quantity`) and
|
|
214
|
-
* `insufficient_credits` (`balance < credits`). Each is a refusal, never an
|
|
215
|
-
* outage (PRDCT-2677).
|
|
216
|
-
*/
|
|
217
|
-
export declare const USAGE_CHECK_REASONS: readonly ["insufficient_credits", "account_suspended", "unpriceable"];
|
|
218
|
-
export type UsageCheckReason = (typeof USAGE_CHECK_REASONS)[number];
|
|
219
|
-
/**
|
|
220
|
-
* The hub's answer to `POST /usage/check` (its `UsageCheck`, PRDCT-2663),
|
|
221
|
-
* checked against the hub's wire snapshot (PRDCT-2677): advisory, no side effect. `credits` is the price of
|
|
222
|
-
* this quantity from the price book row effective now (0 and `priced:
|
|
223
|
-
* false` when the tool has no row for the action: views are never priced,
|
|
224
|
-
* an unknown key is not a refusal); `balance` the account's; `allowed` is
|
|
225
|
-
* `balance >= credits` unless the organization is suspended, which refuses
|
|
226
|
-
* whatever the price. `topUpUrl` is always present: the hub's billing page
|
|
227
|
-
* for that organization, what a `402 entitlement_denied` carries straight
|
|
228
|
-
* off the answer. No lower bound on `quantity` or `credits`, as at the hub: a
|
|
229
|
-
* copy stricter than the hub reads a valid answer as an outage.
|
|
230
|
-
*/
|
|
231
|
-
export declare const usageCheckSchema: z.ZodObject<{
|
|
232
|
-
accountRef: z.ZodUUID;
|
|
233
|
-
actionKey: z.ZodString;
|
|
234
|
-
quantity: z.ZodNumber;
|
|
235
|
-
allowed: z.ZodBoolean;
|
|
236
|
-
credits: z.ZodNumber;
|
|
237
|
-
balance: z.ZodNumber;
|
|
238
|
-
unit: z.ZodNullable<z.ZodString>;
|
|
239
|
-
priced: z.ZodBoolean;
|
|
240
|
-
plan: z.ZodEnum<{
|
|
241
|
-
free: "free";
|
|
242
|
-
pro: "pro";
|
|
243
|
-
}>;
|
|
244
|
-
reason: z.ZodNullable<z.ZodEnum<{
|
|
245
|
-
insufficient_credits: "insufficient_credits";
|
|
246
|
-
account_suspended: "account_suspended";
|
|
247
|
-
unpriceable: "unpriceable";
|
|
248
|
-
}>>;
|
|
249
|
-
topUpUrl: z.ZodString;
|
|
250
|
-
}, z.core.$strip>;
|
|
251
|
-
export type UsageCheck = z.infer<typeof usageCheckSchema>;
|
|
252
31
|
/** The wire code of a credit refusal (§7 step 4), and its `details`. */
|
|
253
32
|
export declare const ENTITLEMENT_DENIED = "entitlement_denied";
|
|
254
33
|
export interface EntitlementDeniedDetails {
|
|
@@ -449,7 +228,7 @@ export declare const toolEntitlementsSchema: z.ZodObject<{
|
|
|
449
228
|
export type ToolEntitlements = z.infer<typeof toolEntitlementsSchema>;
|
|
450
229
|
/**
|
|
451
230
|
* The hub's answer to `GET /usage/entitlements?accountRef=` (§5): the hub's
|
|
452
|
-
* `usageEntitlementsSchema` (PRDCT-2636),
|
|
231
|
+
* `usageEntitlementsSchema` (PRDCT-2636), the hub's own shape in
|
|
453
232
|
* snapshot (PRDCT-2677). The account's
|
|
454
233
|
* plan, resolved from the tier's defaults and the account's overrides; in
|
|
455
234
|
* phase 1 `limits` and `features` are empty and the tool's own declared
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../src/entitlements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../src/entitlements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;;GAYG;AAWH,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,i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KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAQnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,sEAAsE;AACtE,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,eAAe,CAAC;IACtB,qEAAqE;IACrE,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/entitlements.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { BILLING_PLANS, billingPlanSchema } from '@antasphere/contract';
|
|
2
3
|
/**
|
|
3
4
|
* The billing rail's declaration layer (the pay-per-use billing rail spec,
|
|
4
5
|
* §7 and §8b): a route says ONCE, next to its contract, what it meters, which
|
|
@@ -12,214 +13,24 @@ import { z } from 'zod';
|
|
|
12
13
|
* tool's contract builds the registry from its route objects and the SDK can
|
|
13
14
|
* read the same declarations without pulling the server.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* each rides on: the hub's `USAGE_ROUTE_ERRORS` (PRDCT-2677).
|
|
34
|
-
* `tool_credential_required`: the caller is not a registry tool's machine
|
|
35
|
-
* credential. `unknown_account`: no organization holds the `accountRef` (the
|
|
36
|
-
* check and the entitlements read; the ingest answers it per event instead).
|
|
37
|
-
* `validation_error`: the body or the query does not parse. The chassis maps
|
|
38
|
-
* the check's two (`check.ts`): a 404 `unknown_account` and a 400 are the
|
|
39
|
-
* hub's judgement, allowed and logged, never an outage.
|
|
40
|
-
*/
|
|
41
|
-
export const USAGE_ROUTE_ERRORS = {
|
|
42
|
-
tool_credential_required: 401,
|
|
43
|
-
unknown_account: 404,
|
|
44
|
-
validation_error: 400
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* The wire shape of one usage event as the hub ingests it: the hub's
|
|
48
|
-
* `usageEventSchema` (`packages/contract/src/schemas/billing.ts` of the hub,
|
|
49
|
-
* PRDCT-2625), copied here and checked against the hub's wire snapshot
|
|
50
|
-
* (`wire.ts`, `pnpm --filter @antasphere/chassis-contract wire:check`, the
|
|
51
|
-
* `hub-wire` CI job; PRDCT-2677), so the fake hub of the test kit refuses
|
|
52
|
-
* exactly what the real hub refuses (PRDCT-2629). `userId` is the HUB user
|
|
53
|
-
* (the SSO `sub`), never the tool's local id, and null when the actor is a
|
|
54
|
-
* resource owner the tool could not name; `accountRef` is the hub
|
|
55
|
-
* organization id (a uuid) the tool carries as its workspace's central
|
|
56
|
-
* account id. `toolSlug` is accepted by the hub only when it equals the
|
|
57
|
-
* calling token's registry slug — the chassis NEVER sends it: the token is
|
|
58
|
-
* the only authority on the tool's name, the body never names the tool
|
|
59
|
-
* (PRDCT-2629; `UsageEvent` in seams.ts has no such field).
|
|
60
|
-
*/
|
|
61
|
-
export const usageEventSchema = z
|
|
62
|
-
.object({
|
|
63
|
-
id: z.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, 'a ULID'),
|
|
64
|
-
actionKey: z.string().min(1).max(120).optional(),
|
|
65
|
-
meter: z.string().min(1).max(120).optional(),
|
|
66
|
-
quantity: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
67
|
-
unit: z.string().min(1).max(40),
|
|
68
|
-
occurredAt: z.iso.datetime({ offset: true }),
|
|
69
|
-
workspaceId: z.string().min(1).max(128),
|
|
70
|
-
accountRef: z.uuid(),
|
|
71
|
-
userId: z.string().min(1).max(128).nullable().optional(),
|
|
72
|
-
via: z.enum(['session', 'api_key', 'oauth']),
|
|
73
|
-
resourceType: z.string().min(1).max(80).nullable().optional(),
|
|
74
|
-
resourceId: z.string().min(1).max(256).nullable().optional(),
|
|
75
|
-
toolSlug: z.string().min(1).max(64).optional(),
|
|
76
|
-
source: z.object({
|
|
77
|
-
instanceId: z.string().min(1).max(128),
|
|
78
|
-
edition: z.string().min(1).max(32),
|
|
79
|
-
version: z.string().min(1).max(64)
|
|
80
|
-
})
|
|
81
|
-
})
|
|
82
|
-
.refine((e) => e.actionKey !== undefined || e.meter !== undefined, {
|
|
83
|
-
message: 'actionKey (or its legacy alias meter) is required',
|
|
84
|
-
path: ['actionKey']
|
|
85
|
-
});
|
|
86
|
-
/** The batch cap of `POST /usage/events` (the hub's `USAGE_EVENTS_BATCH_MAX`): at most this many events per post. */
|
|
87
|
-
export const USAGE_EVENTS_BATCH_MAX = 500;
|
|
88
|
-
/**
|
|
89
|
-
* The body of `POST /usage/events` as the hub parses it (its
|
|
90
|
-
* `usageEventsBatchSchema`): one to `USAGE_EVENTS_BATCH_MAX` elements, each
|
|
91
|
-
* judged on its own against `usageEventSchema` afterwards.
|
|
92
|
-
*/
|
|
93
|
-
export const usageEventsBatchSchema = z.object({
|
|
94
|
-
events: z.array(z.unknown()).min(1).max(USAGE_EVENTS_BATCH_MAX)
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* Why the hub did not accept an event (its `USAGE_REJECT_REASONS`, a closed
|
|
98
|
-
* list): `unknown_account`, `unknown_user`, `tool_mismatch`, and
|
|
99
|
-
* `invalid_event` (the element does not parse, its `occurredAt` falls outside
|
|
100
|
-
* the window, or its price exceeds `Number.MAX_SAFE_INTEGER`; `details` names
|
|
101
|
-
* the field).
|
|
102
|
-
*/
|
|
103
|
-
export const USAGE_REJECT_REASONS = [
|
|
104
|
-
'unknown_account',
|
|
105
|
-
'unknown_user',
|
|
106
|
-
'tool_mismatch',
|
|
107
|
-
'invalid_event'
|
|
108
|
-
];
|
|
109
|
-
export const usageRejectReasonSchema = z.enum(USAGE_REJECT_REASONS);
|
|
110
|
-
/**
|
|
111
|
-
* One element's answer. Since phase 2 an `accepted` result carries the
|
|
112
|
-
* `credits` the hub debited for it (0 when the action has no price).
|
|
113
|
-
*/
|
|
114
|
-
export const usageEventResultSchema = z.object({
|
|
115
|
-
id: z.string().nullable(),
|
|
116
|
-
status: z.enum(['accepted', 'duplicate', 'rejected']),
|
|
117
|
-
reason: usageRejectReasonSchema.optional(),
|
|
118
|
-
details: z.unknown().optional(),
|
|
119
|
-
credits: z.number().int().optional()
|
|
120
|
-
});
|
|
121
|
-
/**
|
|
122
|
-
* The hub's answer to `POST /usage/events`: one result per element, in the
|
|
123
|
-
* batch's order, and the three counts (always sent).
|
|
124
|
-
*/
|
|
125
|
-
export const usageIngestResultSchema = z.object({
|
|
126
|
-
results: z.array(usageEventResultSchema),
|
|
127
|
-
accepted: z.number().int(),
|
|
128
|
-
duplicate: z.number().int(),
|
|
129
|
-
rejected: z.number().int()
|
|
130
|
-
});
|
|
131
|
-
// ── The hub's window on an event's date (PRDCT-2630 at the hub, PRDCT-2644 here) ──
|
|
132
|
-
/**
|
|
133
|
-
* The window an event's `occurredAt` must fall in, measured against the
|
|
134
|
-
* moment the hub receives it: the hub's `USAGE_EVENT_MAX_PAST_MS` and
|
|
135
|
-
* `USAGE_EVENT_MAX_FUTURE_MS` (`packages/contract/src/schemas/billing.ts`
|
|
136
|
-
* of the hub), same names and values, checked against the hub's wire
|
|
137
|
-
* snapshot (`wire.ts`, `wire:check`, the `hub-wire` CI job; PRDCT-2677). Backward, seven days:
|
|
138
|
-
* the queue's retry budget is about eight and a half hours, so an outage of
|
|
139
|
-
* a night is covered many times over, and a week also covers an operator
|
|
140
|
-
* re-driving held jobs by hand. Forward, five minutes: the skew every JWT
|
|
141
|
-
* verifier already tolerates; anything further is a clock that is wrong.
|
|
142
|
-
* Outside the window the hub answers `rejected(invalid_event)` naming
|
|
143
|
-
* `occurredAt` and never clamps, so the poster refuses BEFORE posting: an
|
|
144
|
-
* event the hub would refuse on its date is held where it was made, never
|
|
145
|
-
* counted as a rejection at the hub (PRDCT-2644).
|
|
146
|
-
*/
|
|
147
|
-
export const USAGE_EVENT_MAX_PAST_MS = 7 * 24 * 60 * 60 * 1000;
|
|
148
|
-
export const USAGE_EVENT_MAX_FUTURE_MS = 5 * 60 * 1000;
|
|
149
|
-
/**
|
|
150
|
-
* Why an event's `occurredAt` is refused against the receipt time, or null
|
|
151
|
-
* when it falls inside the window (both bounds INCLUSIVE). The hub's
|
|
152
|
-
* `usageEventOccurrenceIssue`, copied (the wire snapshot's occurrence table
|
|
153
|
-
* checks it on the hub's offsets): the one comparison both
|
|
154
|
-
* halves run, the hub at ingest against its own clock, the chassis before
|
|
155
|
-
* posting against its best estimate of the receipt (its own clock), so the
|
|
156
|
-
* two never disagree on the sign or the edge.
|
|
157
|
-
*/
|
|
158
|
-
export function usageEventOccurrenceIssue(occurredAt, receivedAt) {
|
|
159
|
-
const delta = occurredAt.getTime() - receivedAt.getTime();
|
|
160
|
-
if (delta < -USAGE_EVENT_MAX_PAST_MS) {
|
|
161
|
-
return {
|
|
162
|
-
path: 'occurredAt',
|
|
163
|
-
message: `more than ${USAGE_EVENT_MAX_PAST_MS / 86_400_000} days before the hub received the event`
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if (delta > USAGE_EVENT_MAX_FUTURE_MS) {
|
|
167
|
-
return {
|
|
168
|
-
path: 'occurredAt',
|
|
169
|
-
message: `more than ${USAGE_EVENT_MAX_FUTURE_MS / 60_000} minutes after the hub received the event`
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
// ── POST /usage/check: the price and the balance before an action (§5, §7 step 3) ──
|
|
175
|
-
/**
|
|
176
|
-
* The request of `POST /usage/check` (the hub's `UsageCheckRequest`,
|
|
177
|
-
* PRDCT-2663): the paying account, the action key and the quantity of THIS
|
|
178
|
-
* request. `unit` is accepted and ignored by the hub, which prices by its
|
|
179
|
-
* own row; it is sent so the answer's unit can be compared and a mismatch
|
|
180
|
-
* logged.
|
|
181
|
-
*/
|
|
182
|
-
export const usageCheckRequestSchema = z.object({
|
|
183
|
-
accountRef: z.uuid(),
|
|
184
|
-
actionKey: z.string().min(1).max(120),
|
|
185
|
-
quantity: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
186
|
-
unit: z.string().min(1).max(40).optional()
|
|
187
|
-
});
|
|
188
|
-
/**
|
|
189
|
-
* The three reasons a check refuses (`null` when allowed), the hub's
|
|
190
|
-
* `USAGE_CHECK_REASONS`: `account_suspended` (checked first, whatever the
|
|
191
|
-
* price), `unpriceable` (the price of this quantity exceeds
|
|
192
|
-
* `Number.MAX_SAFE_INTEGER`: the hub clamps `credits` to that bound, and the
|
|
193
|
-
* ingest would reject the same event on its `quantity`) and
|
|
194
|
-
* `insufficient_credits` (`balance < credits`). Each is a refusal, never an
|
|
195
|
-
* outage (PRDCT-2677).
|
|
196
|
-
*/
|
|
197
|
-
export const USAGE_CHECK_REASONS = ['insufficient_credits', 'account_suspended', 'unpriceable'];
|
|
198
|
-
/**
|
|
199
|
-
* The hub's answer to `POST /usage/check` (its `UsageCheck`, PRDCT-2663),
|
|
200
|
-
* checked against the hub's wire snapshot (PRDCT-2677): advisory, no side effect. `credits` is the price of
|
|
201
|
-
* this quantity from the price book row effective now (0 and `priced:
|
|
202
|
-
* false` when the tool has no row for the action: views are never priced,
|
|
203
|
-
* an unknown key is not a refusal); `balance` the account's; `allowed` is
|
|
204
|
-
* `balance >= credits` unless the organization is suspended, which refuses
|
|
205
|
-
* whatever the price. `topUpUrl` is always present: the hub's billing page
|
|
206
|
-
* for that organization, what a `402 entitlement_denied` carries straight
|
|
207
|
-
* off the answer. No lower bound on `quantity` or `credits`, as at the hub: a
|
|
208
|
-
* copy stricter than the hub reads a valid answer as an outage.
|
|
209
|
-
*/
|
|
210
|
-
export const usageCheckSchema = z.object({
|
|
211
|
-
accountRef: z.uuid(),
|
|
212
|
-
actionKey: z.string(),
|
|
213
|
-
quantity: z.number().int(),
|
|
214
|
-
allowed: z.boolean(),
|
|
215
|
-
credits: z.number().int(),
|
|
216
|
-
balance: z.number().int(),
|
|
217
|
-
unit: z.string().nullable(),
|
|
218
|
-
priced: z.boolean(),
|
|
219
|
-
plan: entitlementTierSchema,
|
|
220
|
-
reason: z.enum(USAGE_CHECK_REASONS).nullable(),
|
|
221
|
-
topUpUrl: z.string()
|
|
222
|
-
});
|
|
16
|
+
// ── The hub's half: the messages the tool exchanges with the hub ──────────
|
|
17
|
+
//
|
|
18
|
+
// The hub owns these shapes and publishes them as `@antasphere/contract`
|
|
19
|
+
// (the hub's own contract package, on npm at the hub's version); this file
|
|
20
|
+
// re-exports them under the names the chassis has always used, so a tool
|
|
21
|
+
// reads exactly what the hub wrote and a change at the hub reaches every
|
|
22
|
+
// tool through one dependency bump (PRDCT-3325; before it, a hand copy checked
|
|
23
|
+
// against the hub's wire snapshot). The chassis's OWN half — the
|
|
24
|
+
// declaration layer below — stays here.
|
|
25
|
+
export { BILLING_PLANS, USAGE_CHECK_REASONS, USAGE_EVENT_MAX_FUTURE_MS, USAGE_EVENT_MAX_PAST_MS, USAGE_EVENTS_BATCH_MAX, USAGE_REJECT_REASONS, USAGE_ROUTE_ERRORS, USAGE_WRITE_SCOPE, usageCheckRequestSchema, usageCheckSchema, usageEventOccurrenceIssue, usageEventResultSchema, usageEventSchema, usageEventsBatchSchema, usageIngestResultSchema, usageRejectReasonSchema } from '@antasphere/contract';
|
|
26
|
+
/**
|
|
27
|
+
* The plan tiers, a CLOSED enum the hub owns (`BILLING_PLANS` in
|
|
28
|
+
* `@antasphere/contract`), under the chassis's own names (§8b): `free` is the
|
|
29
|
+
* default with no subscription; `pro` is the paid plan. "Enterprise" is not
|
|
30
|
+
* a tier but a per-account override the hub serves.
|
|
31
|
+
*/
|
|
32
|
+
export const ENTITLEMENT_TIERS = BILLING_PLANS;
|
|
33
|
+
export const entitlementTierSchema = billingPlanSchema;
|
|
223
34
|
/** The wire code of a credit refusal (§7 step 4), and its `details`. */
|
|
224
35
|
export const ENTITLEMENT_DENIED = 'entitlement_denied';
|
|
225
36
|
/** The key of a route's feature declaration, whichever shape it uses; null when none. */
|
|
@@ -317,7 +128,7 @@ export const toolEntitlementsSchema = z.object({
|
|
|
317
128
|
});
|
|
318
129
|
/**
|
|
319
130
|
* The hub's answer to `GET /usage/entitlements?accountRef=` (§5): the hub's
|
|
320
|
-
* `usageEntitlementsSchema` (PRDCT-2636),
|
|
131
|
+
* `usageEntitlementsSchema` (PRDCT-2636), the hub's own shape in
|
|
321
132
|
* snapshot (PRDCT-2677). The account's
|
|
322
133
|
* plan, resolved from the tier's defaults and the account's overrides; in
|
|
323
134
|
* phase 1 `limits` and `features` are empty and the tool's own declared
|
package/dist/entitlements.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../src/entitlements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"entitlements.js","sourceRoot":"","sources":["../src/entitlements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAG1F;;;;;;;;;;;;GAYG;AAEH,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,+EAA+E;AAC/E,iEAAiE;AACjE,wCAAwC;AACxC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,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AC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;IACpB,IAAI,EAAE,qBAAqB;IAC3B,6FAA6F;IAC7F,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAChE,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAGH,sEAAsE;AACtE,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export * from './schemas/teams.js';
|
|
|
17
17
|
export * from './schemas/demo-passes.js';
|
|
18
18
|
export * from './seams.js';
|
|
19
19
|
export * from './entitlements.js';
|
|
20
|
-
export * from './wire.js';
|
|
21
20
|
export * from './define.js';
|
|
22
21
|
export type { ToolIdentity } from './identity.js';
|
|
23
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtF,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,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AAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,2EAA2E;AAC3E,qEAAqE;AACrE,8EAA8E;AAC9E,oFAAoF;AACpF,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAA4B,MAAM,iBAAiB,CAAC;AACtF,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EAKrB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,2EAA2E;AAC3E,qEAAqE;AACrE,8EAA8E;AAC9E,oFAAoF;AACpF,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAA4B,MAAM,iBAAiB,CAAC;AACtF,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EAKrB,MAAM,uBAAuB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antasphere/chassis-contract",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@antasphere/contract": "^0.16.3",
|
|
31
32
|
"@hono/zod-openapi": "^1.4.0",
|
|
32
33
|
"zod": "^4.1.0"
|
|
33
34
|
},
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
"build": "tsc -p tsconfig.json",
|
|
39
40
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
40
41
|
"lint": "eslint src test",
|
|
41
|
-
"test": "vitest run --passWithNoTests"
|
|
42
|
-
"wire:check": "node scripts/hub-wire-check.mjs"
|
|
42
|
+
"test": "vitest run --passWithNoTests"
|
|
43
43
|
}
|
|
44
44
|
}
|