vrc-packages-api-preview 0.0.0-stage → 2026.10.0-pre
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 +202 -0
- package/README.md +62 -2
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/tokens.d.ts +25 -0
- package/dist/auth/tokens.js +35 -0
- package/dist/client.d.ts +182 -0
- package/dist/client.js +388 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/protocol/catalog.d.ts +246 -0
- package/dist/protocol/catalog.js +54 -0
- package/dist/protocol/downstream.d.ts +219 -0
- package/dist/protocol/downstream.js +82 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.js +4 -0
- package/dist/protocol/operator.d.ts +627 -0
- package/dist/protocol/operator.js +354 -0
- package/dist/protocol/user.d.ts +38 -0
- package/dist/protocol/user.js +15 -0
- package/dist/taxonomy/index.d.ts +1 -0
- package/dist/taxonomy/index.js +1 -0
- package/dist/taxonomy/taxonomy.d.ts +10 -0
- package/dist/taxonomy/taxonomy.js +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/package.d.ts +122 -0
- package/dist/types/package.js +64 -0
- package/dist/types/platform.d.ts +15 -0
- package/dist/types/platform.js +22 -0
- package/package.json +65 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vrc-packages-api
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package supplies the consumer SDK and schemas for operator, user and application APIs. It does not supply a crawler node or job runner.
|
|
4
|
+
|
|
5
|
+
The root exports VRCPackageClient, VRCPackageClientOptions and VRCPApiError. VRC Packages is the canonical project brand. VRCP abbreviates that name, and P already stands for Packages. Use the exact client spelling VRCPackageClient, not VRCPPackageClient or VRCPPackagesClient. Crawler, Worker and Client describe project components, not the overall brand.
|
|
6
|
+
|
|
7
|
+
One SDK source supplies two npm identities: release `vrc-packages-api` and preview `vrc-packages-api-preview`.
|
|
8
|
+
Version configs select their versions. Preview uses CalVer with a `pre` suffix.
|
|
9
|
+
Version zero retains no aliases for the old client/options/error names. Package aliases do not add retired API exports.
|
|
10
|
+
|
|
11
|
+
The taxonomy subpath exposes the three umbrella values: tools, assets and avatars. It does not supply an indexed tag vocabulary or coordinator-internal evidence schemas. VPM version validation belongs to the crawler. Coordinator-owned tags and classification profiles remain under development.
|
|
12
|
+
|
|
13
|
+
The distribution contains ESM JavaScript and TypeScript declarations. It does not require TypeScript source execution, Bun or another monorepo folder at runtime. Supported imports:
|
|
14
|
+
|
|
15
|
+
- `vrc-packages-api`
|
|
16
|
+
- `vrc-packages-api/protocol`
|
|
17
|
+
- `vrc-packages-api/types`
|
|
18
|
+
- `vrc-packages-api/taxonomy`
|
|
19
|
+
- `vrc-packages-api/auth`
|
|
20
|
+
|
|
21
|
+
The preview package has the same subpaths under `vrc-packages-api-preview`.
|
|
22
|
+
Consumers can keep the release import spelling with an exact npm dependency alias:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"vrc-packages-api": "npm:vrc-packages-api-preview@2026.10.0-pre"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This is an example alias. Read the preview config for the current milestone version.
|
|
33
|
+
|
|
34
|
+
Run `bun run build` to create the distribution. Each build removes the generated `dist` directory before compilation. This prevents deleted source files from leaving stale package exports. Source files remain unchanged.
|
|
35
|
+
|
|
36
|
+
Run `bun run test` to build and test it. `npm pack` runs the build before it creates a tarball. Runtime dependencies remain declared npm dependencies, not bundled copies.
|
|
37
|
+
|
|
38
|
+
Run `npm run test:distribution` before release. This test packs the SDK, installs the tarball in a separate directory and checks all exports with ordinary Node. It also checks strict declarations, an isolated Wrangler build and native Worker execution. Use `npm run test:distribution -- --offline` when npm has cached the runtime dependencies.
|
|
39
|
+
|
|
40
|
+
The SDK owns its pinned Worker test tools as development dependencies. The distribution test does not use another project directory. It prints and retains the temporary consumer directory for inspection. The packed SDK contains no Worker test tools or crawler source.
|
|
41
|
+
|
|
42
|
+
The owner authorizes release v0.0.0 and CalVer preview publication after package verification.
|
|
43
|
+
The manifest permits publication and declares the existing Apache-2.0 license asset. CI checks the artifact before publication.
|
|
44
|
+
The complete owner API route review still gates release v0.1.0, including its prereleases. That milestone declares a stable `/v1/` contract.
|
|
45
|
+
Separate preview versions do not waive artifact checks or declare that stable contract.
|
|
46
|
+
See [delivery](../docs/source/DELIVERY.md) for config routing and remaining checks.
|
|
47
|
+
Packaging this SDK does not relocate crawler-internal Worker dependencies.
|
|
48
|
+
The source typecheck excludes installed-consumer fixtures. The distribution gate compiles those fixtures strictly against packed declarations for each identity.
|
|
49
|
+
|
|
50
|
+
Operator lead rows use the exact Worker snake-case wire fields. The SDK adds no aliases or missing provenance. Approval and rejection require an explicit reason. Unknown fields fail validation. The grouped source and packed-consumer checks passed. Remaining authorization and report-lifecycle gaps still require review.
|
|
51
|
+
|
|
52
|
+
## Public catalog pages
|
|
53
|
+
|
|
54
|
+
`client.index.query` calls GET `/v1/app/index` without authentication. It accepts only `limit` and `cursor`. The default limit is 50. Integer limits from 1 through 100 are valid.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const first = await client.index.query({ limit: 100 });
|
|
58
|
+
if (first.nextCursor !== null) {
|
|
59
|
+
const next = await client.index.query({ limit: 100, cursor: first.nextCursor });
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The response contains `schemaVersion`, `packages` and `nextCursor`. A null cursor ends the page sequence. It has no total count. Unsupported options, invalid cursors and malformed responses fail validation. Use the authenticated `index.search` method for search filters.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tokens.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tokens.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative Identity and Token Prefix Configuration for Downstream Consumers.
|
|
3
|
+
* Enforces unified `vrcp_` prepend identity across consumer credentials.
|
|
4
|
+
*/
|
|
5
|
+
export declare const IDENTITY_PREFIX: "vrcp_";
|
|
6
|
+
/** Downstream application credentials prepend `vrcp_app_` followed by 64-hex entropy. */
|
|
7
|
+
export declare const APP_TOKEN_PREFIX: "vrcp_app_";
|
|
8
|
+
export declare const APP_TOKEN_REGEX: RegExp;
|
|
9
|
+
export declare function formatAppToken(entropyHex: string): string;
|
|
10
|
+
export declare function isAppToken(token: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* User credentials prepend `vrcp_usr_` followed by 64-hex entropy.
|
|
13
|
+
* Users can register downstream apps and submit delisting requests on their own behalf.
|
|
14
|
+
*/
|
|
15
|
+
export declare const USER_TOKEN_PREFIX: "vrcp_usr_";
|
|
16
|
+
export declare const USER_TOKEN_REGEX: RegExp;
|
|
17
|
+
export declare function formatUserToken(entropyHex: string): string;
|
|
18
|
+
export declare function isUserToken(token: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Admin operator credentials are 64-character hex secrets in version 0 wire protocols.
|
|
21
|
+
* In future web operator panel gates (src-web / Gate G10), Firebase and/or GitHub
|
|
22
|
+
* will be used for Auth / OAuth identity providers.
|
|
23
|
+
*/
|
|
24
|
+
export declare const OPERATOR_TOKEN_REGEX: RegExp;
|
|
25
|
+
export declare function isOperatorToken(token: string): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative Identity and Token Prefix Configuration for Downstream Consumers.
|
|
3
|
+
* Enforces unified `vrcp_` prepend identity across consumer credentials.
|
|
4
|
+
*/
|
|
5
|
+
export const IDENTITY_PREFIX = "vrcp_";
|
|
6
|
+
/** Downstream application credentials prepend `vrcp_app_` followed by 64-hex entropy. */
|
|
7
|
+
export const APP_TOKEN_PREFIX = "vrcp_app_";
|
|
8
|
+
export const APP_TOKEN_REGEX = /^vrcp_app_[a-f0-9]{64}$/;
|
|
9
|
+
export function formatAppToken(entropyHex) {
|
|
10
|
+
return `${APP_TOKEN_PREFIX}${entropyHex.toLowerCase()}`;
|
|
11
|
+
}
|
|
12
|
+
export function isAppToken(token) {
|
|
13
|
+
return APP_TOKEN_REGEX.test(token);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* User credentials prepend `vrcp_usr_` followed by 64-hex entropy.
|
|
17
|
+
* Users can register downstream apps and submit delisting requests on their own behalf.
|
|
18
|
+
*/
|
|
19
|
+
export const USER_TOKEN_PREFIX = "vrcp_usr_";
|
|
20
|
+
export const USER_TOKEN_REGEX = /^vrcp_usr_[a-f0-9]{64}$/;
|
|
21
|
+
export function formatUserToken(entropyHex) {
|
|
22
|
+
return `${USER_TOKEN_PREFIX}${entropyHex.toLowerCase()}`;
|
|
23
|
+
}
|
|
24
|
+
export function isUserToken(token) {
|
|
25
|
+
return USER_TOKEN_REGEX.test(token);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Admin operator credentials are 64-character hex secrets in version 0 wire protocols.
|
|
29
|
+
* In future web operator panel gates (src-web / Gate G10), Firebase and/or GitHub
|
|
30
|
+
* will be used for Auth / OAuth identity providers.
|
|
31
|
+
*/
|
|
32
|
+
export const OPERATOR_TOKEN_REGEX = /^[0-9a-fA-F]{64}$/;
|
|
33
|
+
export function isOperatorToken(token) {
|
|
34
|
+
return OPERATOR_TOKEN_REGEX.test(token);
|
|
35
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { type Platform } from "./types/index.ts";
|
|
2
|
+
import { type CatalogDeltaResponse, type PublicCatalogListQuery, type PublicCatalogListResponse } from "./protocol/catalog.ts";
|
|
3
|
+
import { type CatalogSearchResponse, type RegisterAppRequest, type RegisterAppResponse, type ReportSubmissionRequest, type ReportSubmissionResponse, type QueryOrigin } from "./protocol/downstream.ts";
|
|
4
|
+
import { type UserAppListQuery, type UserAppListResponse, type UserAppResponse } from "./protocol/user.ts";
|
|
5
|
+
import { type LeadStatus, type RevokeNodeResponse, type EnqueueJobRequest, type EnqueueJobResponse, type InitializeCoordinatorResponse, type LeadListResponse, type LeadActionResponse, type SourceAccessProfileListResponse, type CreateSourceAccessProfile, type SourceAccessProfileResponse, type AutoQueueRuleListResponse, type CreateAutoQueueRule, type AutoQueueRuleResponse, type IssueNodeCredential, type NodeCredentialResponse, type CatalogListResponse, type TakedownListResponse, type VerifyTakedownResponse } from "./protocol/operator.ts";
|
|
6
|
+
export declare class VRCPApiError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly code?: string;
|
|
9
|
+
readonly details?: unknown;
|
|
10
|
+
constructor(status: number, message: string, code?: string, details?: unknown);
|
|
11
|
+
}
|
|
12
|
+
export interface VRCPackageClientOptions {
|
|
13
|
+
/** Coordinator baseUrl, e.g. "https://api.vrc-packages.example" or "http://127.0.0.1:8787" */
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
/** Downstream application token starting with `vrcp_app_` */
|
|
16
|
+
appToken?: string;
|
|
17
|
+
/** User token starting with `vrcp_usr_` */
|
|
18
|
+
userToken?: string;
|
|
19
|
+
/** Operator token for administrative endpoints */
|
|
20
|
+
operatorToken?: string;
|
|
21
|
+
/** Custom fetch implementation (defaults to global fetch) */
|
|
22
|
+
fetch?: typeof fetch;
|
|
23
|
+
}
|
|
24
|
+
export interface CatalogSearchParams {
|
|
25
|
+
query?: string;
|
|
26
|
+
queryOrigin: QueryOrigin;
|
|
27
|
+
umbrella?: "tools" | "assets" | "avatars";
|
|
28
|
+
category?: string;
|
|
29
|
+
platform?: Platform;
|
|
30
|
+
tags?: string[];
|
|
31
|
+
limit?: number;
|
|
32
|
+
cursor?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface SyncDeltasParams {
|
|
35
|
+
cursor?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class VRCPackageClient {
|
|
39
|
+
private readonly baseUrl;
|
|
40
|
+
private readonly appToken?;
|
|
41
|
+
private readonly userToken?;
|
|
42
|
+
private readonly operatorToken?;
|
|
43
|
+
private readonly fetchFn;
|
|
44
|
+
constructor(options: VRCPackageClientOptions);
|
|
45
|
+
private request;
|
|
46
|
+
readonly index: {
|
|
47
|
+
/**
|
|
48
|
+
* Queries the public canonical package index projection (GET /v1/app/index).
|
|
49
|
+
*/
|
|
50
|
+
query: (params?: PublicCatalogListQuery) => Promise<PublicCatalogListResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes bounded search with mandatory query attribution (user_authored vs app_automated).
|
|
53
|
+
* Requires downstream application token (POST /v1/app/index/search).
|
|
54
|
+
*/
|
|
55
|
+
search: (params: CatalogSearchParams) => Promise<CatalogSearchResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* Pages current catalog changes (GET /v1/app/index/delta), not an immutable event log.
|
|
58
|
+
*/
|
|
59
|
+
syncDeltas: (params?: SyncDeltasParams) => Promise<CatalogDeltaResponse>;
|
|
60
|
+
};
|
|
61
|
+
readonly app: {
|
|
62
|
+
/**
|
|
63
|
+
* Registers a downstream application (POST /v1/app/register).
|
|
64
|
+
* Gated by user authentication (userToken) or operator token.
|
|
65
|
+
*/
|
|
66
|
+
register: (request: RegisterAppRequest) => Promise<RegisterAppResponse>;
|
|
67
|
+
};
|
|
68
|
+
readonly reports: {
|
|
69
|
+
/**
|
|
70
|
+
* Submits demand, issue or pending removal reports (POST /v1/app/report).
|
|
71
|
+
* Requires downstream application token.
|
|
72
|
+
*/
|
|
73
|
+
submit: (report: ReportSubmissionRequest) => Promise<ReportSubmissionResponse>;
|
|
74
|
+
};
|
|
75
|
+
readonly user: {
|
|
76
|
+
apps: {
|
|
77
|
+
list: (params?: Partial<UserAppListQuery>) => Promise<UserAppListResponse>;
|
|
78
|
+
get: (appId: string) => Promise<UserAppResponse>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly operator: {
|
|
82
|
+
jobs: {
|
|
83
|
+
/** Record a crawl candidate. Existing jobs keep their state and lease. */
|
|
84
|
+
enqueue: (request: EnqueueJobRequest) => Promise<EnqueueJobResponse>;
|
|
85
|
+
};
|
|
86
|
+
/** Initialize storage and optionally queue candidates, without granting source access. */
|
|
87
|
+
init: (params?: {
|
|
88
|
+
autoSeed?: boolean;
|
|
89
|
+
}) => Promise<InitializeCoordinatorResponse>;
|
|
90
|
+
leads: {
|
|
91
|
+
/**
|
|
92
|
+
* Lists pending, approved, or rejected discovery leads (GET /v1/operator/leads).
|
|
93
|
+
*/
|
|
94
|
+
list: (params?: {
|
|
95
|
+
status?: LeadStatus;
|
|
96
|
+
limit?: number;
|
|
97
|
+
cursor?: string;
|
|
98
|
+
}) => Promise<LeadListResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Approves a discovery lead into the crawl queue (POST /v1/operator/leads/{leadKey}/approve).
|
|
101
|
+
*/
|
|
102
|
+
approve: (leadKey: string, params: {
|
|
103
|
+
minDelayMs?: number;
|
|
104
|
+
reason: string;
|
|
105
|
+
}) => Promise<LeadActionResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Rejects a discovery lead (POST /v1/operator/leads/{leadKey}/reject).
|
|
108
|
+
*/
|
|
109
|
+
reject: (leadKey: string, params: {
|
|
110
|
+
reason: string;
|
|
111
|
+
}) => Promise<LeadActionResponse>;
|
|
112
|
+
};
|
|
113
|
+
sourceProfiles: {
|
|
114
|
+
/**
|
|
115
|
+
* Lists source-access profiles (GET /v1/operator/source-profiles).
|
|
116
|
+
*/
|
|
117
|
+
list: (params?: {
|
|
118
|
+
limit?: number;
|
|
119
|
+
cursor?: string;
|
|
120
|
+
}) => Promise<SourceAccessProfileListResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Creates a source-access profile (POST /v1/operator/source-profiles).
|
|
123
|
+
*/
|
|
124
|
+
create: (request: CreateSourceAccessProfile) => Promise<SourceAccessProfileResponse>;
|
|
125
|
+
/**
|
|
126
|
+
* Disables a source-access profile (POST /v1/operator/source-profiles/{id}/disable).
|
|
127
|
+
*/
|
|
128
|
+
disable: (profileId: string, reason: string) => Promise<SourceAccessProfileResponse>;
|
|
129
|
+
};
|
|
130
|
+
autoQueueRules: {
|
|
131
|
+
/**
|
|
132
|
+
* Lists auto-queue rules (GET /v1/operator/autoqueue-rules).
|
|
133
|
+
*/
|
|
134
|
+
list: (params?: {
|
|
135
|
+
limit?: number;
|
|
136
|
+
cursor?: string;
|
|
137
|
+
}) => Promise<AutoQueueRuleListResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Creates an auto-queue rule (POST /v1/operator/autoqueue-rules).
|
|
140
|
+
*/
|
|
141
|
+
create: (request: CreateAutoQueueRule) => Promise<AutoQueueRuleResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Disables an auto-queue rule (POST /v1/operator/autoqueue-rules/{id}/disable).
|
|
144
|
+
*/
|
|
145
|
+
disable: (ruleId: string, reason: string) => Promise<AutoQueueRuleResponse>;
|
|
146
|
+
};
|
|
147
|
+
nodes: {
|
|
148
|
+
/** Revoke credentials without releasing a possibly in-flight origin reservation. */
|
|
149
|
+
revoke: (nodeId: string, reason: string) => Promise<RevokeNodeResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Issues an audited node credential with assigned capabilities (POST /v1/operator/nodes).
|
|
152
|
+
*/
|
|
153
|
+
issue: (request: IssueNodeCredential) => Promise<NodeCredentialResponse>;
|
|
154
|
+
};
|
|
155
|
+
catalog: {
|
|
156
|
+
/**
|
|
157
|
+
* Lists canonical packages with operator oversight (GET /v1/operator/catalog).
|
|
158
|
+
*/
|
|
159
|
+
list: (params?: {
|
|
160
|
+
limit?: number;
|
|
161
|
+
cursor?: string;
|
|
162
|
+
}) => Promise<CatalogListResponse>;
|
|
163
|
+
};
|
|
164
|
+
takedowns: {
|
|
165
|
+
/**
|
|
166
|
+
* Audits recorded creator opt-outs and delistings (GET /v1/operator/takedowns).
|
|
167
|
+
*/
|
|
168
|
+
list: (params?: {
|
|
169
|
+
requesterType?: "unauthenticated_creator" | "user" | "admin_operator";
|
|
170
|
+
limit?: number;
|
|
171
|
+
cursor?: string;
|
|
172
|
+
}) => Promise<TakedownListResponse>;
|
|
173
|
+
/**
|
|
174
|
+
* Records an operator verdict on a stored creator opt-out (POST /v1/operator/takedowns/{id}/verify).
|
|
175
|
+
*/
|
|
176
|
+
verify: (takedownId: string, request: {
|
|
177
|
+
verdict: "accepted" | "rejected";
|
|
178
|
+
notes?: string;
|
|
179
|
+
}) => Promise<VerifyTakedownResponse>;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
}
|