@antasphere/chassis-contract 0.0.0-stage → 1.0.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 +82 -0
- package/dist/define.d.ts +177 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +35 -0
- package/dist/define.js.map +1 -0
- package/dist/entitlements.d.ts +265 -0
- package/dist/entitlements.d.ts.map +1 -0
- package/dist/entitlements.js +155 -0
- package/dist/entitlements.js.map +1 -0
- package/dist/identity.d.ts +56 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +2 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/index.d.ts +5403 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +940 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/schemas/api-keys.d.ts +54 -0
- package/dist/schemas/api-keys.d.ts.map +1 -0
- package/dist/schemas/api-keys.js +48 -0
- package/dist/schemas/api-keys.js.map +1 -0
- package/dist/schemas/audit.d.ts +74 -0
- package/dist/schemas/audit.d.ts.map +1 -0
- package/dist/schemas/audit.js +65 -0
- package/dist/schemas/audit.js.map +1 -0
- package/dist/schemas/break-glass.d.ts +42 -0
- package/dist/schemas/break-glass.d.ts.map +1 -0
- package/dist/schemas/break-glass.js +38 -0
- package/dist/schemas/break-glass.js.map +1 -0
- package/dist/schemas/cli-auth.d.ts +59 -0
- package/dist/schemas/cli-auth.d.ts.map +1 -0
- package/dist/schemas/cli-auth.js +68 -0
- package/dist/schemas/cli-auth.js.map +1 -0
- package/dist/schemas/common.d.ts +96 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +205 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/demo-passes.d.ts +90 -0
- package/dist/schemas/demo-passes.d.ts.map +1 -0
- package/dist/schemas/demo-passes.js +60 -0
- package/dist/schemas/demo-passes.js.map +1 -0
- package/dist/schemas/files.d.ts +39 -0
- package/dist/schemas/files.d.ts.map +1 -0
- package/dist/schemas/files.js +26 -0
- package/dist/schemas/files.js.map +1 -0
- package/dist/schemas/instance.d.ts +58 -0
- package/dist/schemas/instance.d.ts.map +1 -0
- package/dist/schemas/instance.js +70 -0
- package/dist/schemas/instance.js.map +1 -0
- package/dist/schemas/invitations.d.ts +100 -0
- package/dist/schemas/invitations.d.ts.map +1 -0
- package/dist/schemas/invitations.js +55 -0
- package/dist/schemas/invitations.js.map +1 -0
- package/dist/schemas/me.d.ts +81 -0
- package/dist/schemas/me.d.ts.map +1 -0
- package/dist/schemas/me.js +178 -0
- package/dist/schemas/me.js.map +1 -0
- package/dist/schemas/members.d.ts +60 -0
- package/dist/schemas/members.d.ts.map +1 -0
- package/dist/schemas/members.js +43 -0
- package/dist/schemas/members.js.map +1 -0
- package/dist/schemas/projects.d.ts +232 -0
- package/dist/schemas/projects.d.ts.map +1 -0
- package/dist/schemas/projects.js +140 -0
- package/dist/schemas/projects.js.map +1 -0
- package/dist/schemas/scope.d.ts +14 -0
- package/dist/schemas/scope.d.ts.map +1 -0
- package/dist/schemas/scope.js +5 -0
- package/dist/schemas/scope.js.map +1 -0
- package/dist/schemas/setup.d.ts +28 -0
- package/dist/schemas/setup.d.ts.map +1 -0
- package/dist/schemas/setup.js +28 -0
- package/dist/schemas/setup.js.map +1 -0
- package/dist/schemas/sso-connect.d.ts +30 -0
- package/dist/schemas/sso-connect.d.ts.map +1 -0
- package/dist/schemas/sso-connect.js +38 -0
- package/dist/schemas/sso-connect.js.map +1 -0
- package/dist/schemas/sso-logout.d.ts +17 -0
- package/dist/schemas/sso-logout.d.ts.map +1 -0
- package/dist/schemas/sso-logout.js +16 -0
- package/dist/schemas/sso-logout.js.map +1 -0
- package/dist/schemas/teams.d.ts +100 -0
- package/dist/schemas/teams.d.ts.map +1 -0
- package/dist/schemas/teams.js +84 -0
- package/dist/schemas/teams.js.map +1 -0
- package/dist/schemas/workspaces.d.ts +99 -0
- package/dist/schemas/workspaces.d.ts.map +1 -0
- package/dist/schemas/workspaces.js +96 -0
- package/dist/schemas/workspaces.js.map +1 -0
- package/dist/seams.d.ts +185 -0
- package/dist/seams.d.ts.map +1 -0
- package/dist/seams.js +37 -0
- package/dist/seams.js.map +1 -0
- package/package.json +41 -3
- package/src/define.ts +64 -0
- package/src/entitlements.ts +340 -0
- package/src/identity.ts +49 -0
- package/src/index.ts +37 -0
- package/src/routes/index.ts +1146 -0
- package/src/schemas/api-keys.ts +53 -0
- package/src/schemas/audit.ts +74 -0
- package/src/schemas/break-glass.ts +46 -0
- package/src/schemas/cli-auth.ts +78 -0
- package/src/schemas/common.ts +206 -0
- package/src/schemas/demo-passes.ts +73 -0
- package/src/schemas/files.ts +30 -0
- package/src/schemas/instance.ts +71 -0
- package/src/schemas/invitations.ts +66 -0
- package/src/schemas/me.ts +184 -0
- package/src/schemas/members.ts +53 -0
- package/src/schemas/projects.ts +174 -0
- package/src/schemas/scope.ts +18 -0
- package/src/schemas/setup.ts +31 -0
- package/src/schemas/sso-connect.ts +40 -0
- package/src/schemas/sso-logout.ts +17 -0
- package/src/schemas/teams.ts +101 -0
- package/src/schemas/workspaces.ts +109 -0
- package/src/seams.ts +202 -0
- package/test/define.test.ts +59 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
The Antasphere chassis
|
|
4
|
+
Copyright (c) 2026 Antasphere
|
|
5
|
+
|
|
6
|
+
The Antasphere chassis is made available by Antasphere, the licensor, under the "Sustainable Use License" as
|
|
7
|
+
defined below. All third party components incorporated into the Antasphere chassis are licensed under the
|
|
8
|
+
original license provided by the owner of the applicable component.
|
|
9
|
+
|
|
10
|
+
## Sustainable Use License
|
|
11
|
+
|
|
12
|
+
Version 1.0
|
|
13
|
+
|
|
14
|
+
### Acceptance
|
|
15
|
+
|
|
16
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
17
|
+
|
|
18
|
+
### Copyright License
|
|
19
|
+
|
|
20
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
|
|
21
|
+
to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
|
|
22
|
+
to the limitations below.
|
|
23
|
+
|
|
24
|
+
### Limitations
|
|
25
|
+
|
|
26
|
+
You may use or modify the software only for your own internal business purposes or for non-commercial or
|
|
27
|
+
personal use. You may distribute the software or provide it to others only if you do so free of charge for
|
|
28
|
+
non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
|
|
29
|
+
the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
30
|
+
|
|
31
|
+
### Patents
|
|
32
|
+
|
|
33
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
|
|
34
|
+
license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
|
|
35
|
+
subject to the limitations and conditions in this license. This license does not cover any patent claims that
|
|
36
|
+
you cause to be infringed by modifications or additions to the software. If you or your company make any
|
|
37
|
+
written claim that the software infringes or contributes to infringement of any patent, your patent license
|
|
38
|
+
for the software granted under these terms ends immediately. If your company makes such a claim, your patent
|
|
39
|
+
license ends immediately for work on behalf of your company.
|
|
40
|
+
|
|
41
|
+
### Notices
|
|
42
|
+
|
|
43
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
|
|
44
|
+
terms. If you modify the software, you must include in any modified copies of the software a prominent notice
|
|
45
|
+
stating that you have modified the software.
|
|
46
|
+
|
|
47
|
+
### No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
50
|
+
|
|
51
|
+
### Termination
|
|
52
|
+
|
|
53
|
+
If you use the software in violation of these terms, such use is not licensed, and your license will
|
|
54
|
+
automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
|
|
55
|
+
violation of this license no later than 30 days after you receive that notice, your license will be reinstated
|
|
56
|
+
retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
|
|
57
|
+
terms will cause your license to terminate automatically and permanently.
|
|
58
|
+
|
|
59
|
+
### No Liability
|
|
60
|
+
|
|
61
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
|
|
62
|
+
not be liable to you for any damages arising out of these terms or the use or nature of the software, under
|
|
63
|
+
any kind of legal claim.
|
|
64
|
+
|
|
65
|
+
### Definitions
|
|
66
|
+
|
|
67
|
+
The “licensor” is the entity offering these terms.
|
|
68
|
+
|
|
69
|
+
The “software” is the software the licensor makes available under these terms, including any portion of it.
|
|
70
|
+
|
|
71
|
+
“You” refers to the individual or entity agreeing to these terms.
|
|
72
|
+
|
|
73
|
+
“Your company” is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
|
|
74
|
+
all organizations that have control over, are under the control of, or are under common control with that
|
|
75
|
+
organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
|
|
76
|
+
management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
77
|
+
|
|
78
|
+
“Your license” is the license granted to you for the software under these terms.
|
|
79
|
+
|
|
80
|
+
“Use” means anything you do with the software requiring your license.
|
|
81
|
+
|
|
82
|
+
“Trademark” means trademarks, service marks, and similar rights.
|
package/dist/define.d.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { type ScopeSchema, type ScopeTuple } from './schemas/scope.js';
|
|
3
|
+
/**
|
|
4
|
+
* The scope-dependent half of the chassis contract. Everything else in this
|
|
5
|
+
* package is a plain static export; these schemas transitively hold the
|
|
6
|
+
* tool's scope enum, so they are BUILT, once per tool, from the scopes the
|
|
7
|
+
* tool names — no module-level state, the returned object is the contract.
|
|
8
|
+
*
|
|
9
|
+
* const { read, write, dataExport } = IDENTITY.scopes; // the tool's `ToolIdentity` value
|
|
10
|
+
* const contract = defineChassisContract({ scopes: [read, write, dataExport] });
|
|
11
|
+
* export const { scopeSchema, apiKeySchema, meResponseSchema } = contract;
|
|
12
|
+
* export type Scope = ScopeOf<typeof contract>;
|
|
13
|
+
*
|
|
14
|
+
* The scopes are a TUPLE, in the order the enum publishes them: a tool with
|
|
15
|
+
* more scopes than the three parts of its identity appends them here.
|
|
16
|
+
*
|
|
17
|
+
* The route contracts over these schemas come from
|
|
18
|
+
* `defineChassisRoutes(contract, IDENTITY, copy)` on the `./routes` entry (it pulls
|
|
19
|
+
* Hono; this one stays client-safe).
|
|
20
|
+
*/
|
|
21
|
+
export declare function defineChassisContract<const TScopes extends ScopeTuple>(tool: {
|
|
22
|
+
scopes: TScopes;
|
|
23
|
+
}): ChassisContract<TScopes[number]>;
|
|
24
|
+
declare function buildChassisContract<TScope extends string>(scopeSchema: ScopeSchema<TScope>): {
|
|
25
|
+
meResponseSchema: z.ZodObject<{
|
|
26
|
+
user: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
email: z.ZodString;
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
workspace: z.ZodNullable<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
hubOrigin: z.ZodBoolean;
|
|
35
|
+
look: z.ZodObject<{
|
|
36
|
+
theme: z.ZodNullable<z.ZodString>;
|
|
37
|
+
pattern: z.ZodNullable<z.ZodString>;
|
|
38
|
+
field: z.ZodNullable<z.ZodNumber>;
|
|
39
|
+
grain: z.ZodNullable<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
role: z.ZodNullable<z.ZodEnum<{
|
|
43
|
+
owner: "owner";
|
|
44
|
+
admin: "admin";
|
|
45
|
+
member: "member";
|
|
46
|
+
}>>;
|
|
47
|
+
origin: z.ZodNullable<z.ZodEnum<{
|
|
48
|
+
local: "local";
|
|
49
|
+
hub: "hub";
|
|
50
|
+
guest: "guest";
|
|
51
|
+
}>>;
|
|
52
|
+
via: z.ZodEnum<{
|
|
53
|
+
session: "session";
|
|
54
|
+
api_key: "api_key";
|
|
55
|
+
oauth: "oauth";
|
|
56
|
+
}>;
|
|
57
|
+
scopes: z.ZodNullable<z.ZodArray<ScopeSchema<TScope>>>;
|
|
58
|
+
apiKeyExpiresAt: z.ZodNullable<z.ZodString>;
|
|
59
|
+
workspaces: z.ZodArray<z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
role: z.ZodEnum<{
|
|
63
|
+
owner: "owner";
|
|
64
|
+
admin: "admin";
|
|
65
|
+
member: "member";
|
|
66
|
+
}>;
|
|
67
|
+
hubOrigin: z.ZodBoolean;
|
|
68
|
+
centralAccountId: z.ZodNullable<z.ZodString>;
|
|
69
|
+
look: z.ZodObject<{
|
|
70
|
+
theme: z.ZodNullable<z.ZodString>;
|
|
71
|
+
pattern: z.ZodNullable<z.ZodString>;
|
|
72
|
+
field: z.ZodNullable<z.ZodNumber>;
|
|
73
|
+
grain: z.ZodNullable<z.ZodNumber>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
suspended: z.ZodBoolean;
|
|
76
|
+
default: z.ZodBoolean;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
activeWorkspaceId: z.ZodNullable<z.ZodString>;
|
|
79
|
+
hubManageUrl: z.ZodNullable<z.ZodString>;
|
|
80
|
+
canCreateWorkspace: z.ZodBoolean;
|
|
81
|
+
firstRunPending: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
ssoOnly: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
hubDenied: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
hubNoAccessUrl: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
cliAuthCompletedSchema: z.ZodObject<{
|
|
90
|
+
key: z.ZodString;
|
|
91
|
+
apiKey: z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
keyId: z.ZodString;
|
|
95
|
+
scopes: z.ZodArray<ScopeSchema<TScope>>;
|
|
96
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
97
|
+
createdBy: z.ZodString;
|
|
98
|
+
createdAt: z.ZodString;
|
|
99
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
100
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
101
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
user: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
email: z.ZodString;
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
apiKeySchema: z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
keyId: z.ZodString;
|
|
114
|
+
scopes: z.ZodArray<ScopeSchema<TScope>>;
|
|
115
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
116
|
+
createdBy: z.ZodString;
|
|
117
|
+
createdAt: z.ZodString;
|
|
118
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
119
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
120
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
apiKeysListSchema: z.ZodObject<{
|
|
123
|
+
apiKeys: z.ZodArray<z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
name: z.ZodString;
|
|
126
|
+
keyId: z.ZodString;
|
|
127
|
+
scopes: z.ZodArray<ScopeSchema<TScope>>;
|
|
128
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
129
|
+
createdBy: z.ZodString;
|
|
130
|
+
createdAt: z.ZodString;
|
|
131
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
132
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
133
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
apiKeyCreateSchema: z.ZodObject<{
|
|
138
|
+
name: z.ZodString;
|
|
139
|
+
scopes: z.ZodArray<ScopeSchema<TScope>>;
|
|
140
|
+
expiresInDays: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
workspaceId: z.ZodOptional<z.ZodUUID>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
apiKeyCreatedSchema: z.ZodObject<{
|
|
144
|
+
apiKey: z.ZodObject<{
|
|
145
|
+
id: z.ZodString;
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
keyId: z.ZodString;
|
|
148
|
+
scopes: z.ZodArray<ScopeSchema<TScope>>;
|
|
149
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
150
|
+
createdBy: z.ZodString;
|
|
151
|
+
createdAt: z.ZodString;
|
|
152
|
+
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
153
|
+
revokedAt: z.ZodNullable<z.ZodString>;
|
|
154
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
key: z.ZodString;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
scopeSchema: ScopeSchema<TScope>;
|
|
159
|
+
};
|
|
160
|
+
/** The contract a tool gets for its scopes (`TScope` = the union of the scope literals). */
|
|
161
|
+
export type ChassisContract<TScope extends string> = ReturnType<typeof buildChassisContract<TScope>>;
|
|
162
|
+
/** The loosest reading of a contract — what the `…Of` type helpers below accept. */
|
|
163
|
+
export type ChassisContractShape = {
|
|
164
|
+
[K in keyof ChassisContract<string>]: z.ZodType;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* The inferred types of an instantiated contract, under the names their
|
|
168
|
+
* schemas have always had: `type Scope = ScopeOf<typeof contract>`.
|
|
169
|
+
*/
|
|
170
|
+
export type ScopeOf<C extends Pick<ChassisContractShape, 'scopeSchema'>> = z.infer<C['scopeSchema']>;
|
|
171
|
+
export type ApiKeyInfoOf<C extends Pick<ChassisContractShape, 'apiKeySchema'>> = z.infer<C['apiKeySchema']>;
|
|
172
|
+
export type ApiKeyCreateOf<C extends Pick<ChassisContractShape, 'apiKeyCreateSchema'>> = z.infer<C['apiKeyCreateSchema']>;
|
|
173
|
+
export type ApiKeyCreatedOf<C extends Pick<ChassisContractShape, 'apiKeyCreatedSchema'>> = z.infer<C['apiKeyCreatedSchema']>;
|
|
174
|
+
export type CliAuthCompletedOf<C extends Pick<ChassisContractShape, 'cliAuthCompletedSchema'>> = z.infer<C['cliAuthCompletedSchema']>;
|
|
175
|
+
export type MeResponseOf<C extends Pick<ChassisContractShape, 'meResponseSchema'>> = z.infer<C['meResponseSchema']>;
|
|
176
|
+
export {};
|
|
177
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1F;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,OAAO,SAAS,UAAU,EAAE,IAAI,EAAE;IAC5E,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAEnC;AA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tG,CAAC,CAAC,wBAAwB,CAAC,CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,CAC1F,CAAC,CAAC,kBAAkB,CAAC,CACtB,CAAC"}
|
package/dist/define.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineApiKeySchemas } from './schemas/api-keys.js';
|
|
2
|
+
import { defineCliAuthSchemas } from './schemas/cli-auth.js';
|
|
3
|
+
import { defineMeSchemas } from './schemas/me.js';
|
|
4
|
+
import { defineScopeSchema } from './schemas/scope.js';
|
|
5
|
+
/**
|
|
6
|
+
* The scope-dependent half of the chassis contract. Everything else in this
|
|
7
|
+
* package is a plain static export; these schemas transitively hold the
|
|
8
|
+
* tool's scope enum, so they are BUILT, once per tool, from the scopes the
|
|
9
|
+
* tool names — no module-level state, the returned object is the contract.
|
|
10
|
+
*
|
|
11
|
+
* const { read, write, dataExport } = IDENTITY.scopes; // the tool's `ToolIdentity` value
|
|
12
|
+
* const contract = defineChassisContract({ scopes: [read, write, dataExport] });
|
|
13
|
+
* export const { scopeSchema, apiKeySchema, meResponseSchema } = contract;
|
|
14
|
+
* export type Scope = ScopeOf<typeof contract>;
|
|
15
|
+
*
|
|
16
|
+
* The scopes are a TUPLE, in the order the enum publishes them: a tool with
|
|
17
|
+
* more scopes than the three parts of its identity appends them here.
|
|
18
|
+
*
|
|
19
|
+
* The route contracts over these schemas come from
|
|
20
|
+
* `defineChassisRoutes(contract, IDENTITY, copy)` on the `./routes` entry (it pulls
|
|
21
|
+
* Hono; this one stays client-safe).
|
|
22
|
+
*/
|
|
23
|
+
export function defineChassisContract(tool) {
|
|
24
|
+
return buildChassisContract(defineScopeSchema(tool.scopes));
|
|
25
|
+
}
|
|
26
|
+
function buildChassisContract(scopeSchema) {
|
|
27
|
+
const apiKeys = defineApiKeySchemas(scopeSchema);
|
|
28
|
+
return {
|
|
29
|
+
scopeSchema,
|
|
30
|
+
...apiKeys,
|
|
31
|
+
...defineCliAuthSchemas(apiKeys.apiKeySchema),
|
|
32
|
+
...defineMeSchemas(scopeSchema)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=define.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAqC,MAAM,oBAAoB,CAAC;AAE1F;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CAAmC,IAEvE;IACC,OAAO,oBAAoB,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,oBAAoB,CAAwB,WAAgC;IACnF,MAAM,OAAO,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACjD,OAAO;QACL,WAAW;QACX,GAAG,OAAO;QACV,GAAG,oBAAoB,CAAC,OAAO,CAAC,YAAY,CAAC;QAC7C,GAAG,eAAe,CAAC,WAAW,CAAC;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type BillingPlan } from '@antasphere/contract';
|
|
3
|
+
import type { HeaderReader, Principal } from './seams.js';
|
|
4
|
+
/**
|
|
5
|
+
* The billing rail's declaration layer (the pay-per-use billing rail spec,
|
|
6
|
+
* §7 and §8b): a route says ONCE, next to its contract, what it meters, which
|
|
7
|
+
* limit it checks and which feature it needs. One chassis middleware reads
|
|
8
|
+
* the declaration and enforces it for every client of `/api/v1` at once (the
|
|
9
|
+
* dashboard, the CLI and the MCP tools are all HTTP clients of it), and a
|
|
10
|
+
* handler never checks or emits by hand.
|
|
11
|
+
*
|
|
12
|
+
* Client-safe on purpose: no Hono here. A route is referenced by its
|
|
13
|
+
* `{ method, path }` as the OpenAPI helper spells it (`{id}` params), so the
|
|
14
|
+
* tool's contract builds the registry from its route objects and the SDK can
|
|
15
|
+
* read the same declarations without pulling the server.
|
|
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';
|
|
19
|
+
/**
|
|
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.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ENTITLEMENT_TIERS: readonly ["free", "pro"];
|
|
26
|
+
export type EntitlementTier = BillingPlan;
|
|
27
|
+
export declare const entitlementTierSchema: z.ZodEnum<{
|
|
28
|
+
free: "free";
|
|
29
|
+
pro: "pro";
|
|
30
|
+
}>;
|
|
31
|
+
/** The wire code of a credit refusal (§7 step 4), and its `details`. */
|
|
32
|
+
export declare const ENTITLEMENT_DENIED = "entitlement_denied";
|
|
33
|
+
export interface EntitlementDeniedDetails {
|
|
34
|
+
/** The price of this action, in credits. */
|
|
35
|
+
credits: number;
|
|
36
|
+
/** The organization's balance, in credits. */
|
|
37
|
+
balance: number;
|
|
38
|
+
/** The hub's billing page for the organization: where a human adds credits. */
|
|
39
|
+
topUpUrl: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What a declaration's functions see: the request as the chassis reads it.
|
|
43
|
+
* `audit` is present only AFTER the handler ran (the emit), carrying what the
|
|
44
|
+
* handler recorded for its audit row — the place a stored size or a created
|
|
45
|
+
* resource id lives.
|
|
46
|
+
*/
|
|
47
|
+
export interface EntitlementRequest {
|
|
48
|
+
method: string;
|
|
49
|
+
path: string;
|
|
50
|
+
headers: HeaderReader;
|
|
51
|
+
/** Route params by name (`{id}` → its value). */
|
|
52
|
+
params: Record<string, string>;
|
|
53
|
+
principal: Principal | null;
|
|
54
|
+
/**
|
|
55
|
+
* The parsed JSON body of the request, read once and shared with the
|
|
56
|
+
* handler's own validation (the server caches the parse); `undefined`
|
|
57
|
+
* when the request carries none or it does not parse (the route's
|
|
58
|
+
* validator then answers 400 itself). A count limit or a conditional
|
|
59
|
+
* feature reads what the request asks for here (PRDCT-2702): the mint
|
|
60
|
+
* of a share link with a password, the address an invitation names.
|
|
61
|
+
*/
|
|
62
|
+
body: () => Promise<unknown>;
|
|
63
|
+
audit?: {
|
|
64
|
+
action: string;
|
|
65
|
+
resourceType: string;
|
|
66
|
+
resourceId?: string;
|
|
67
|
+
metadata?: Record<string, unknown>;
|
|
68
|
+
} | undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Who pays and who is reported (§8): the organization's account pays, the
|
|
72
|
+
* user is reported. The default actor is the principal; a route on an
|
|
73
|
+
* anonymous surface resolves its resource's owner here instead (share token
|
|
74
|
+
* → deck → owner → the owner's workspace and account) — the viewer is never
|
|
75
|
+
* identified.
|
|
76
|
+
*/
|
|
77
|
+
export interface ActorRef {
|
|
78
|
+
/** The reported user, or null when the actor is a resource owner the tool could not name. */
|
|
79
|
+
userId: string | null;
|
|
80
|
+
workspaceId: string;
|
|
81
|
+
/** The paying account (the workspace's central account id); absent = unmetered (oss, or a cloud-local workspace). */
|
|
82
|
+
accountRef?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The actor of a request when it is not the principal: the owner of a
|
|
86
|
+
* resource reached anonymously (a form response through a share link), or
|
|
87
|
+
* the workspace a public door opens (an invitation accepted, a collaborator
|
|
88
|
+
* grant claimed). Resolves null to leave the route to its own handling.
|
|
89
|
+
*/
|
|
90
|
+
export type ActorHook = (ctx: EntitlementRequest) => Promise<ActorRef | null> | ActorRef | null;
|
|
91
|
+
export interface MeterDeclaration {
|
|
92
|
+
/** The action key, namespaced by the tool's price book (`things.publish`). */
|
|
93
|
+
key: string;
|
|
94
|
+
/** The unit the price is per (`call`, `bytes`, `items`). */
|
|
95
|
+
unit: string;
|
|
96
|
+
/** The quantity of this request; default 1. Called before the handler (the check) and after it (the emit, with `audit` set). */
|
|
97
|
+
quantity?: (ctx: EntitlementRequest) => number;
|
|
98
|
+
/** The actor when it is not the principal (the owner of a resource reached anonymously). */
|
|
99
|
+
actor?: ActorHook;
|
|
100
|
+
}
|
|
101
|
+
export interface LimitDeclaration {
|
|
102
|
+
/** The limit key (`things.maxBytes`), declared with its per-tier values in the tool's `entitlements` slot. */
|
|
103
|
+
key: string;
|
|
104
|
+
/**
|
|
105
|
+
* The value this request observes, compared against the tier's value; over
|
|
106
|
+
* it is a plan refusal. A SIZE limit reads the declared length
|
|
107
|
+
* (`declaredContentLength`, synchronous: the gate then also demands a
|
|
108
|
+
* Content-Length on a metered account). A COUNT limit (PRDCT-2702) may be
|
|
109
|
+
* asynchronous and read the body and the tool's own tables: it returns the
|
|
110
|
+
* count AFTER this action (the resource's things plus this one), so
|
|
111
|
+
* `observed > max` is the refusal, and `null` when there is nothing to
|
|
112
|
+
* judge (the resource does not resolve, the caller may not see it): the
|
|
113
|
+
* gate then lets the route answer on its own.
|
|
114
|
+
*/
|
|
115
|
+
value: (ctx: EntitlementRequest) => number | null | Promise<number | null>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A feature a route needs, with an optional condition on the request
|
|
119
|
+
* (PRDCT-2702): a route that creates a thing needs `things.premium` only
|
|
120
|
+
* when the body asks for the premium option, so a declaration on the route
|
|
121
|
+
* refuses the act and never the route. Absent `when`, the whole route needs
|
|
122
|
+
* the feature.
|
|
123
|
+
*/
|
|
124
|
+
export interface FeatureDeclaration {
|
|
125
|
+
key: string;
|
|
126
|
+
when?: (ctx: EntitlementRequest) => boolean | Promise<boolean>;
|
|
127
|
+
}
|
|
128
|
+
export interface RouteEntitlement {
|
|
129
|
+
meter?: MeterDeclaration | undefined;
|
|
130
|
+
limit?: LimitDeclaration | undefined;
|
|
131
|
+
/** A feature key (`things.premium`), declared with its per-tier switch in the tool's `entitlements` slot, or the key with a condition. */
|
|
132
|
+
feature?: string | FeatureDeclaration | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* The actor of a route that meters nothing but checks a limit or a feature
|
|
135
|
+
* on a PUBLIC door (no principal): the workspace the door opens pays and is
|
|
136
|
+
* judged. A meter's own `actor` serves the same purpose on a metered route;
|
|
137
|
+
* this one covers the limit-only shape. Either makes the route a viewer's
|
|
138
|
+
* surface: every refusal to it is one neutral sentence.
|
|
139
|
+
*/
|
|
140
|
+
actor?: ActorHook | undefined;
|
|
141
|
+
}
|
|
142
|
+
/** The key of a route's feature declaration, whichever shape it uses; null when none. */
|
|
143
|
+
export declare function featureKeyOf(entry: RouteEntitlement): string | null;
|
|
144
|
+
/** The actor hook of a route, the entry's own or its meter's; null when the principal is the actor. */
|
|
145
|
+
export declare function actorHookOf(entry: RouteEntitlement): ActorHook | null;
|
|
146
|
+
/** A route as the contract spells it: the OpenAPI method and the `{param}` path. */
|
|
147
|
+
export interface RouteRef {
|
|
148
|
+
method: string;
|
|
149
|
+
path: string;
|
|
150
|
+
}
|
|
151
|
+
export interface RouteEntitlementEntry extends RouteEntitlement {
|
|
152
|
+
route: RouteRef;
|
|
153
|
+
}
|
|
154
|
+
/** `METHOD /path` — the registry key of a route. */
|
|
155
|
+
export declare function routeEntitlementKey(route: RouteRef): string;
|
|
156
|
+
export type RouteEntitlementDeclarations = ReadonlyMap<string, RouteEntitlementEntry>;
|
|
157
|
+
/**
|
|
158
|
+
* Build the registry from the tool's route objects. One entry per route: a
|
|
159
|
+
* second declaration of the same route throws at module load, so a typo or a
|
|
160
|
+
* copy cannot silently double or replace a price.
|
|
161
|
+
*/
|
|
162
|
+
export declare function declareRouteEntitlements(entries: ReadonlyArray<RouteEntitlementEntry>): RouteEntitlementDeclarations;
|
|
163
|
+
/** The declared body size of a request (its `Content-Length`), 0 when absent or malformed. */
|
|
164
|
+
export declare function declaredContentLength(ctx: EntitlementRequest): number;
|
|
165
|
+
/**
|
|
166
|
+
* The stored size a handler recorded in its audit metadata (`sizeBytes`),
|
|
167
|
+
* falling back to the declared body size before the handler ran. The check
|
|
168
|
+
* sees the declared size, the emit sees the bytes that were actually kept.
|
|
169
|
+
*/
|
|
170
|
+
export declare function auditedSizeBytes(ctx: EntitlementRequest): number;
|
|
171
|
+
/**
|
|
172
|
+
* A priced action: the default the hub seeds its price book from (§7); the
|
|
173
|
+
* hub's rows win afterwards. `creditsPerUnit` credits buy `per` units of
|
|
174
|
+
* `unit` (`per` defaults to 1): an action metered in bytes and priced per
|
|
175
|
+
* mebibyte declares `{ creditsPerUnit: 5, unit: 'bytes', per: 1048576 }`,
|
|
176
|
+
* so the meter stays exact, the price reads as the seed table says it, and
|
|
177
|
+
* the two agree by construction (PRDCT-2627: the boot refuses a route whose
|
|
178
|
+
* meter unit differs from its action's). The hub prices an event as
|
|
179
|
+
* `creditsPerUnit × quantity / per`; rounding a fraction of a credit is the
|
|
180
|
+
* hub's rule, not the tool's.
|
|
181
|
+
*/
|
|
182
|
+
export declare const entitlementActionSchema: z.ZodObject<{
|
|
183
|
+
key: z.ZodString;
|
|
184
|
+
creditsPerUnit: z.ZodNumber;
|
|
185
|
+
unit: z.ZodString;
|
|
186
|
+
per: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
label: z.ZodString;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
export type EntitlementAction = z.infer<typeof entitlementActionSchema>;
|
|
190
|
+
/**
|
|
191
|
+
* The credits an action declares for a quantity: `creditsPerUnit × quantity
|
|
192
|
+
* / per`, exact (a fraction is the hub's to round). A test pins the seed
|
|
193
|
+
* values with it, so a unit slip (5 per byte where 5 per MB was meant)
|
|
194
|
+
* fails before the price book is seeded from discovery.
|
|
195
|
+
*/
|
|
196
|
+
export declare function declaredCredits(action: Pick<EntitlementAction, 'creditsPerUnit' | 'per'>, quantity: number): number;
|
|
197
|
+
/** A limit's value per tier plus the oss value (the operator's own knob); null = unlimited. */
|
|
198
|
+
export declare const tierLimitSchema: z.ZodObject<{
|
|
199
|
+
oss: z.ZodNullable<z.ZodNumber>;
|
|
200
|
+
free: z.ZodNullable<z.ZodNumber>;
|
|
201
|
+
pro: z.ZodNullable<z.ZodNumber>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
export type TierLimit = z.infer<typeof tierLimitSchema>;
|
|
204
|
+
/** A feature's switch per tier (oss has every feature: a self-hosted instance knows no plan). */
|
|
205
|
+
export declare const tierFeatureSchema: z.ZodObject<{
|
|
206
|
+
free: z.ZodBoolean;
|
|
207
|
+
pro: z.ZodBoolean;
|
|
208
|
+
}, z.core.$strip>;
|
|
209
|
+
export type TierFeature = z.infer<typeof tierFeatureSchema>;
|
|
210
|
+
export declare const toolEntitlementsSchema: z.ZodObject<{
|
|
211
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
212
|
+
key: z.ZodString;
|
|
213
|
+
creditsPerUnit: z.ZodNumber;
|
|
214
|
+
unit: z.ZodString;
|
|
215
|
+
per: z.ZodOptional<z.ZodNumber>;
|
|
216
|
+
label: z.ZodString;
|
|
217
|
+
}, z.core.$strip>>;
|
|
218
|
+
limits: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
219
|
+
oss: z.ZodNullable<z.ZodNumber>;
|
|
220
|
+
free: z.ZodNullable<z.ZodNumber>;
|
|
221
|
+
pro: z.ZodNullable<z.ZodNumber>;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
features: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
224
|
+
free: z.ZodBoolean;
|
|
225
|
+
pro: z.ZodBoolean;
|
|
226
|
+
}, z.core.$strip>>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
export type ToolEntitlements = z.infer<typeof toolEntitlementsSchema>;
|
|
229
|
+
/**
|
|
230
|
+
* The hub's answer to `GET /usage/entitlements?accountRef=` (§5): the hub's
|
|
231
|
+
* `usageEntitlementsSchema` (PRDCT-2636), the hub's own shape in
|
|
232
|
+
* snapshot (PRDCT-2677). The account's
|
|
233
|
+
* plan, resolved from the tier's defaults and the account's overrides; in
|
|
234
|
+
* phase 1 `limits` and `features` are empty and the tool's own declared
|
|
235
|
+
* values fill the numbers. A limit's value is a number or a boolean: the
|
|
236
|
+
* hub may switch a numeric limit off or on per account (`true` = unlimited,
|
|
237
|
+
* `false` = nothing allowed; `profiles.ts` resolves it so). Since phase 2
|
|
238
|
+
* (PRDCT-2663) the hub serves its real rows — every limit key it holds for
|
|
239
|
+
* the calling tool and the features on for the account — and `upgradeUrl`,
|
|
240
|
+
* its upgrade page for the organization carrying `org`, `tool` and `plan`;
|
|
241
|
+
* the chassis appends `&key=<key>&requiredPlan=<tier>` at refusal time.
|
|
242
|
+
* Required: every hub since 0.11.0 sends it.
|
|
243
|
+
*/
|
|
244
|
+
export declare const entitlementProfileSchema: z.ZodObject<{
|
|
245
|
+
accountRef: z.ZodUUID;
|
|
246
|
+
plan: z.ZodEnum<{
|
|
247
|
+
free: "free";
|
|
248
|
+
pro: "pro";
|
|
249
|
+
}>;
|
|
250
|
+
planUntil: z.ZodNullable<z.ZodString>;
|
|
251
|
+
limits: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean]>>;
|
|
252
|
+
features: z.ZodArray<z.ZodString>;
|
|
253
|
+
upgradeUrl: z.ZodString;
|
|
254
|
+
}, z.core.$strip>;
|
|
255
|
+
export type EntitlementProfile = z.infer<typeof entitlementProfileSchema>;
|
|
256
|
+
/** The wire code of a plan refusal, and its `details` (§7 step 2). */
|
|
257
|
+
export declare const PLAN_REQUIRED = "plan_required";
|
|
258
|
+
export interface PlanRequiredDetails {
|
|
259
|
+
key: string;
|
|
260
|
+
plan: EntitlementTier;
|
|
261
|
+
/** The first tier that allows the action, or null when none does. */
|
|
262
|
+
requiredPlan: EntitlementTier | null;
|
|
263
|
+
upgradeUrl: string;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -0,0 +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,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,iBAAiB,EACjB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AACH,eAAO,MAAM,iBA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