@tinycloud/sdk-core 1.0.0
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.md +320 -0
- package/dist/TinyCloud.d.ts +206 -0
- package/dist/TinyCloud.d.ts.map +1 -0
- package/dist/TinyCloud.js +244 -0
- package/dist/TinyCloud.js.map +1 -0
- package/dist/TinyCloud.schema.d.ts +173 -0
- package/dist/TinyCloud.schema.d.ts.map +1 -0
- package/dist/TinyCloud.schema.js +136 -0
- package/dist/TinyCloud.schema.js.map +1 -0
- package/dist/TinyCloud.schema.test.d.ts +5 -0
- package/dist/TinyCloud.schema.test.d.ts.map +1 -0
- package/dist/TinyCloud.schema.test.js +286 -0
- package/dist/TinyCloud.schema.test.js.map +1 -0
- package/dist/authorization/CapabilityKeyRegistry.d.ts +317 -0
- package/dist/authorization/CapabilityKeyRegistry.d.ts.map +1 -0
- package/dist/authorization/CapabilityKeyRegistry.js +509 -0
- package/dist/authorization/CapabilityKeyRegistry.js.map +1 -0
- package/dist/authorization/authorization.schema.d.ts +233 -0
- package/dist/authorization/authorization.schema.d.ts.map +1 -0
- package/dist/authorization/authorization.schema.js +220 -0
- package/dist/authorization/authorization.schema.js.map +1 -0
- package/dist/authorization/authorization.schema.test.d.ts +5 -0
- package/dist/authorization/authorization.schema.test.d.ts.map +1 -0
- package/dist/authorization/authorization.schema.test.js +618 -0
- package/dist/authorization/authorization.schema.test.js.map +1 -0
- package/dist/authorization/index.d.ts +38 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +52 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/authorization/spaceCreation.d.ts +96 -0
- package/dist/authorization/spaceCreation.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.js +35 -0
- package/dist/authorization/spaceCreation.js.map +1 -0
- package/dist/authorization/spaceCreation.schema.d.ts +67 -0
- package/dist/authorization/spaceCreation.schema.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.schema.js +95 -0
- package/dist/authorization/spaceCreation.schema.js.map +1 -0
- package/dist/authorization/spaceCreation.schema.test.d.ts +5 -0
- package/dist/authorization/spaceCreation.schema.test.d.ts.map +1 -0
- package/dist/authorization/spaceCreation.schema.test.js +168 -0
- package/dist/authorization/spaceCreation.schema.test.js.map +1 -0
- package/dist/authorization/strategies.d.ts +134 -0
- package/dist/authorization/strategies.d.ts.map +1 -0
- package/dist/authorization/strategies.js +15 -0
- package/dist/authorization/strategies.js.map +1 -0
- package/dist/authorization/strategies.schema.d.ts +185 -0
- package/dist/authorization/strategies.schema.d.ts.map +1 -0
- package/dist/authorization/strategies.schema.js +147 -0
- package/dist/authorization/strategies.schema.js.map +1 -0
- package/dist/authorization/strategies.schema.test.d.ts +5 -0
- package/dist/authorization/strategies.schema.test.d.ts.map +1 -0
- package/dist/authorization/strategies.schema.test.js +253 -0
- package/dist/authorization/strategies.schema.test.js.map +1 -0
- package/dist/delegations/DelegationManager.d.ts +164 -0
- package/dist/delegations/DelegationManager.d.ts.map +1 -0
- package/dist/delegations/DelegationManager.js +428 -0
- package/dist/delegations/DelegationManager.js.map +1 -0
- package/dist/delegations/SharingService.d.ts +279 -0
- package/dist/delegations/SharingService.d.ts.map +1 -0
- package/dist/delegations/SharingService.js +558 -0
- package/dist/delegations/SharingService.js.map +1 -0
- package/dist/delegations/SharingService.schema.d.ts +401 -0
- package/dist/delegations/SharingService.schema.d.ts.map +1 -0
- package/dist/delegations/SharingService.schema.js +211 -0
- package/dist/delegations/SharingService.schema.js.map +1 -0
- package/dist/delegations/index.d.ts +38 -0
- package/dist/delegations/index.d.ts.map +1 -0
- package/dist/delegations/index.js +42 -0
- package/dist/delegations/index.js.map +1 -0
- package/dist/delegations/types.d.ts +13 -0
- package/dist/delegations/types.d.ts.map +1 -0
- package/dist/delegations/types.js +42 -0
- package/dist/delegations/types.js.map +1 -0
- package/dist/delegations/types.schema.d.ts +1641 -0
- package/dist/delegations/types.schema.d.ts.map +1 -0
- package/dist/delegations/types.schema.js +535 -0
- package/dist/delegations/types.schema.js.map +1 -0
- package/dist/delegations/types.schema.test.d.ts +5 -0
- package/dist/delegations/types.schema.test.d.ts.map +1 -0
- package/dist/delegations/types.schema.test.js +627 -0
- package/dist/delegations/types.schema.test.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +327 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +703 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/json-schema.test.d.ts +7 -0
- package/dist/json-schema.test.d.ts.map +1 -0
- package/dist/json-schema.test.js +365 -0
- package/dist/json-schema.test.js.map +1 -0
- package/dist/signer.d.ts +28 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +2 -0
- package/dist/signer.js.map +1 -0
- package/dist/space.d.ts +53 -0
- package/dist/space.d.ts.map +1 -0
- package/dist/space.js +67 -0
- package/dist/space.js.map +1 -0
- package/dist/space.schema.d.ts +65 -0
- package/dist/space.schema.d.ts.map +1 -0
- package/dist/space.schema.js +65 -0
- package/dist/space.schema.js.map +1 -0
- package/dist/space.schema.test.d.ts +5 -0
- package/dist/space.schema.test.d.ts.map +1 -0
- package/dist/space.schema.test.js +148 -0
- package/dist/space.schema.test.js.map +1 -0
- package/dist/spaces/Space.d.ts +175 -0
- package/dist/spaces/Space.d.ts.map +1 -0
- package/dist/spaces/Space.js +84 -0
- package/dist/spaces/Space.js.map +1 -0
- package/dist/spaces/SpaceService.d.ts +271 -0
- package/dist/spaces/SpaceService.d.ts.map +1 -0
- package/dist/spaces/SpaceService.js +715 -0
- package/dist/spaces/SpaceService.js.map +1 -0
- package/dist/spaces/index.d.ts +11 -0
- package/dist/spaces/index.d.ts.map +1 -0
- package/dist/spaces/index.js +20 -0
- package/dist/spaces/index.js.map +1 -0
- package/dist/spaces/spaces.schema.d.ts +421 -0
- package/dist/spaces/spaces.schema.d.ts.map +1 -0
- package/dist/spaces/spaces.schema.js +342 -0
- package/dist/spaces/spaces.schema.js.map +1 -0
- package/dist/spaces/spaces.schema.test.d.ts +5 -0
- package/dist/spaces/spaces.schema.test.d.ts.map +1 -0
- package/dist/spaces/spaces.schema.test.js +471 -0
- package/dist/spaces/spaces.schema.test.js.map +1 -0
- package/dist/storage.d.ts +47 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +14 -0
- package/dist/storage.js.map +1 -0
- package/dist/storage.schema.d.ts +277 -0
- package/dist/storage.schema.d.ts.map +1 -0
- package/dist/storage.schema.js +185 -0
- package/dist/storage.schema.js.map +1 -0
- package/dist/storage.schema.test.d.ts +5 -0
- package/dist/storage.schema.test.d.ts.map +1 -0
- package/dist/storage.schema.test.js +346 -0
- package/dist/storage.schema.test.js.map +1 -0
- package/dist/userAuthorization.d.ts +99 -0
- package/dist/userAuthorization.d.ts.map +1 -0
- package/dist/userAuthorization.js +3 -0
- package/dist/userAuthorization.js.map +1 -0
- package/dist/userAuthorization.schema.d.ts +259 -0
- package/dist/userAuthorization.schema.d.ts.map +1 -0
- package/dist/userAuthorization.schema.js +175 -0
- package/dist/userAuthorization.schema.js.map +1 -0
- package/dist/userAuthorization.schema.test.d.ts +5 -0
- package/dist/userAuthorization.schema.test.d.ts.map +1 -0
- package/dist/userAuthorization.schema.test.js +356 -0
- package/dist/userAuthorization.schema.test.js.map +1 -0
- package/dist/version.d.ts +30 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +54 -0
- package/dist/version.js.map +1 -0
- package/dist/wasm-validation.d.ts +287 -0
- package/dist/wasm-validation.d.ts.map +1 -0
- package/dist/wasm-validation.js +219 -0
- package/dist/wasm-validation.js.map +1 -0
- package/dist/wasm-validation.test.d.ts +5 -0
- package/dist/wasm-validation.test.d.ts.map +1 -0
- package/dist/wasm-validation.test.js +233 -0
- package/dist/wasm-validation.test.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,703 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema export for TinyCloud SDK schemas.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions to generate JSON Schema from Zod schemas,
|
|
5
|
+
* enabling documentation, external tool integration, and schema sharing.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Storage Schemas
|
|
12
|
+
// =============================================================================
|
|
13
|
+
import { EnsDataSchema, PersistedTinyCloudSessionSchema, PersistedSessionDataSchema, TinyCloudSessionSchema, } from "./storage.schema";
|
|
14
|
+
// =============================================================================
|
|
15
|
+
// Delegation Schemas
|
|
16
|
+
// =============================================================================
|
|
17
|
+
import { JWKSchema, KeyTypeSchema, KeyInfoSchema, DelegationErrorSchema, DelegationSchema, CapabilityEntrySchema, DelegationRecordSchema, CreateDelegationParamsSchema, DelegationChainSchema, DelegationChainV2Schema, DelegationDirectionSchema, DelegationFiltersSchema, SpaceOwnershipSchema, SpaceInfoSchema, ShareSchemaSchema, ShareLinkSchema, IngestOptionsSchema, GenerateShareParamsSchema, DelegationApiResponseSchema, CreateDelegationWasmParamsSchema, CreateDelegationWasmResultSchema, } from "./delegations/types.schema";
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Space Hosting Schemas
|
|
20
|
+
// =============================================================================
|
|
21
|
+
import { SpaceHostResultSchema } from "./space.schema";
|
|
22
|
+
// =============================================================================
|
|
23
|
+
// Space Creation Schemas
|
|
24
|
+
// =============================================================================
|
|
25
|
+
import { SpaceCreationContextSchema, SpaceCreationHandlerSchema, } from "./authorization/spaceCreation.schema";
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// TinyCloud Config Schemas
|
|
28
|
+
// =============================================================================
|
|
29
|
+
import { BackoffStrategySchema, RetryPolicySchema, PartialRetryPolicySchema, TinyCloudConfigSchema, } from "./TinyCloud.schema";
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// User Authorization Schemas
|
|
32
|
+
// =============================================================================
|
|
33
|
+
import { PartialSiweMessageSchema, UserAuthorizationConfigSchema, } from "./userAuthorization.schema";
|
|
34
|
+
// =============================================================================
|
|
35
|
+
// Sign Strategy Schemas
|
|
36
|
+
// =============================================================================
|
|
37
|
+
import { SignRequestTypeSchema, SignRequestSchema, SignResponseSchema, AutoSignStrategySchema, AutoRejectStrategySchema, CallbackStrategySchema, EventEmitterStrategySchema, SignStrategySchema, } from "./authorization/strategies.schema";
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// Space Service Schemas
|
|
40
|
+
// =============================================================================
|
|
41
|
+
import { SpaceConfigSchema, SpaceServiceConfigSchema, SpaceDelegationParamsSchema, } from "./spaces/spaces.schema";
|
|
42
|
+
const defaultOptions = {
|
|
43
|
+
target: "jsonSchema7",
|
|
44
|
+
};
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Individual Schema Exports - Storage
|
|
47
|
+
// =============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* Generate JSON Schema for EnsData.
|
|
50
|
+
*/
|
|
51
|
+
export function getEnsDataJsonSchema(options) {
|
|
52
|
+
return zodToJsonSchema(EnsDataSchema, {
|
|
53
|
+
name: options?.name ?? "EnsData",
|
|
54
|
+
...defaultOptions,
|
|
55
|
+
...options,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Generate JSON Schema for PersistedTinyCloudSession.
|
|
60
|
+
*/
|
|
61
|
+
export function getPersistedTinyCloudSessionJsonSchema(options) {
|
|
62
|
+
return zodToJsonSchema(PersistedTinyCloudSessionSchema, {
|
|
63
|
+
name: options?.name ?? "PersistedTinyCloudSession",
|
|
64
|
+
...defaultOptions,
|
|
65
|
+
...options,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Generate JSON Schema for PersistedSessionData.
|
|
70
|
+
*/
|
|
71
|
+
export function getPersistedSessionDataJsonSchema(options) {
|
|
72
|
+
return zodToJsonSchema(PersistedSessionDataSchema, {
|
|
73
|
+
name: options?.name ?? "PersistedSessionData",
|
|
74
|
+
...defaultOptions,
|
|
75
|
+
...options,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generate JSON Schema for TinyCloudSession.
|
|
80
|
+
*/
|
|
81
|
+
export function getTinyCloudSessionJsonSchema(options) {
|
|
82
|
+
return zodToJsonSchema(TinyCloudSessionSchema, {
|
|
83
|
+
name: options?.name ?? "TinyCloudSession",
|
|
84
|
+
...defaultOptions,
|
|
85
|
+
...options,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// Individual Schema Exports - Delegations
|
|
90
|
+
// =============================================================================
|
|
91
|
+
/**
|
|
92
|
+
* Generate JSON Schema for JWK.
|
|
93
|
+
*/
|
|
94
|
+
export function getJWKJsonSchema(options) {
|
|
95
|
+
return zodToJsonSchema(JWKSchema, {
|
|
96
|
+
name: options?.name ?? "JWK",
|
|
97
|
+
...defaultOptions,
|
|
98
|
+
...options,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Generate JSON Schema for KeyType.
|
|
103
|
+
*/
|
|
104
|
+
export function getKeyTypeJsonSchema(options) {
|
|
105
|
+
return zodToJsonSchema(KeyTypeSchema, {
|
|
106
|
+
name: options?.name ?? "KeyType",
|
|
107
|
+
...defaultOptions,
|
|
108
|
+
...options,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Generate JSON Schema for KeyInfo.
|
|
113
|
+
*/
|
|
114
|
+
export function getKeyInfoJsonSchema(options) {
|
|
115
|
+
return zodToJsonSchema(KeyInfoSchema, {
|
|
116
|
+
name: options?.name ?? "KeyInfo",
|
|
117
|
+
...defaultOptions,
|
|
118
|
+
...options,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generate JSON Schema for DelegationError.
|
|
123
|
+
*/
|
|
124
|
+
export function getDelegationErrorJsonSchema(options) {
|
|
125
|
+
return zodToJsonSchema(DelegationErrorSchema, {
|
|
126
|
+
name: options?.name ?? "DelegationError",
|
|
127
|
+
...defaultOptions,
|
|
128
|
+
...options,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Generate JSON Schema for Delegation.
|
|
133
|
+
*/
|
|
134
|
+
export function getDelegationJsonSchema(options) {
|
|
135
|
+
return zodToJsonSchema(DelegationSchema, {
|
|
136
|
+
name: options?.name ?? "Delegation",
|
|
137
|
+
...defaultOptions,
|
|
138
|
+
...options,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Generate JSON Schema for CapabilityEntry.
|
|
143
|
+
*/
|
|
144
|
+
export function getCapabilityEntryJsonSchema(options) {
|
|
145
|
+
return zodToJsonSchema(CapabilityEntrySchema, {
|
|
146
|
+
name: options?.name ?? "CapabilityEntry",
|
|
147
|
+
...defaultOptions,
|
|
148
|
+
...options,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Generate JSON Schema for DelegationRecord.
|
|
153
|
+
*/
|
|
154
|
+
export function getDelegationRecordJsonSchema(options) {
|
|
155
|
+
return zodToJsonSchema(DelegationRecordSchema, {
|
|
156
|
+
name: options?.name ?? "DelegationRecord",
|
|
157
|
+
...defaultOptions,
|
|
158
|
+
...options,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate JSON Schema for CreateDelegationParams.
|
|
163
|
+
*/
|
|
164
|
+
export function getCreateDelegationParamsJsonSchema(options) {
|
|
165
|
+
return zodToJsonSchema(CreateDelegationParamsSchema, {
|
|
166
|
+
name: options?.name ?? "CreateDelegationParams",
|
|
167
|
+
...defaultOptions,
|
|
168
|
+
...options,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Generate JSON Schema for DelegationChain.
|
|
173
|
+
*/
|
|
174
|
+
export function getDelegationChainJsonSchema(options) {
|
|
175
|
+
return zodToJsonSchema(DelegationChainSchema, {
|
|
176
|
+
name: options?.name ?? "DelegationChain",
|
|
177
|
+
...defaultOptions,
|
|
178
|
+
...options,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Generate JSON Schema for DelegationChainV2.
|
|
183
|
+
*/
|
|
184
|
+
export function getDelegationChainV2JsonSchema(options) {
|
|
185
|
+
return zodToJsonSchema(DelegationChainV2Schema, {
|
|
186
|
+
name: options?.name ?? "DelegationChainV2",
|
|
187
|
+
...defaultOptions,
|
|
188
|
+
...options,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Generate JSON Schema for DelegationDirection.
|
|
193
|
+
*/
|
|
194
|
+
export function getDelegationDirectionJsonSchema(options) {
|
|
195
|
+
return zodToJsonSchema(DelegationDirectionSchema, {
|
|
196
|
+
name: options?.name ?? "DelegationDirection",
|
|
197
|
+
...defaultOptions,
|
|
198
|
+
...options,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Generate JSON Schema for DelegationFilters.
|
|
203
|
+
*/
|
|
204
|
+
export function getDelegationFiltersJsonSchema(options) {
|
|
205
|
+
return zodToJsonSchema(DelegationFiltersSchema, {
|
|
206
|
+
name: options?.name ?? "DelegationFilters",
|
|
207
|
+
...defaultOptions,
|
|
208
|
+
...options,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Generate JSON Schema for SpaceOwnership.
|
|
213
|
+
*/
|
|
214
|
+
export function getSpaceOwnershipJsonSchema(options) {
|
|
215
|
+
return zodToJsonSchema(SpaceOwnershipSchema, {
|
|
216
|
+
name: options?.name ?? "SpaceOwnership",
|
|
217
|
+
...defaultOptions,
|
|
218
|
+
...options,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Generate JSON Schema for SpaceInfo.
|
|
223
|
+
*/
|
|
224
|
+
export function getSpaceInfoJsonSchema(options) {
|
|
225
|
+
return zodToJsonSchema(SpaceInfoSchema, {
|
|
226
|
+
name: options?.name ?? "SpaceInfo",
|
|
227
|
+
...defaultOptions,
|
|
228
|
+
...options,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Generate JSON Schema for ShareSchema.
|
|
233
|
+
*/
|
|
234
|
+
export function getShareSchemaJsonSchema(options) {
|
|
235
|
+
return zodToJsonSchema(ShareSchemaSchema, {
|
|
236
|
+
name: options?.name ?? "ShareSchema",
|
|
237
|
+
...defaultOptions,
|
|
238
|
+
...options,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate JSON Schema for ShareLink.
|
|
243
|
+
*/
|
|
244
|
+
export function getShareLinkJsonSchema(options) {
|
|
245
|
+
return zodToJsonSchema(ShareLinkSchema, {
|
|
246
|
+
name: options?.name ?? "ShareLink",
|
|
247
|
+
...defaultOptions,
|
|
248
|
+
...options,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Generate JSON Schema for IngestOptions.
|
|
253
|
+
*/
|
|
254
|
+
export function getIngestOptionsJsonSchema(options) {
|
|
255
|
+
return zodToJsonSchema(IngestOptionsSchema, {
|
|
256
|
+
name: options?.name ?? "IngestOptions",
|
|
257
|
+
...defaultOptions,
|
|
258
|
+
...options,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Generate JSON Schema for GenerateShareParams.
|
|
263
|
+
*/
|
|
264
|
+
export function getGenerateShareParamsJsonSchema(options) {
|
|
265
|
+
return zodToJsonSchema(GenerateShareParamsSchema, {
|
|
266
|
+
name: options?.name ?? "GenerateShareParams",
|
|
267
|
+
...defaultOptions,
|
|
268
|
+
...options,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Generate JSON Schema for DelegationApiResponse.
|
|
273
|
+
*/
|
|
274
|
+
export function getDelegationApiResponseJsonSchema(options) {
|
|
275
|
+
return zodToJsonSchema(DelegationApiResponseSchema, {
|
|
276
|
+
name: options?.name ?? "DelegationApiResponse",
|
|
277
|
+
...defaultOptions,
|
|
278
|
+
...options,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Generate JSON Schema for CreateDelegationWasmParams.
|
|
283
|
+
*/
|
|
284
|
+
export function getCreateDelegationWasmParamsJsonSchema(options) {
|
|
285
|
+
return zodToJsonSchema(CreateDelegationWasmParamsSchema, {
|
|
286
|
+
name: options?.name ?? "CreateDelegationWasmParams",
|
|
287
|
+
...defaultOptions,
|
|
288
|
+
...options,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Generate JSON Schema for CreateDelegationWasmResult.
|
|
293
|
+
*/
|
|
294
|
+
export function getCreateDelegationWasmResultJsonSchema(options) {
|
|
295
|
+
return zodToJsonSchema(CreateDelegationWasmResultSchema, {
|
|
296
|
+
name: options?.name ?? "CreateDelegationWasmResult",
|
|
297
|
+
...defaultOptions,
|
|
298
|
+
...options,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
// =============================================================================
|
|
302
|
+
// Individual Schema Exports - Space Hosting
|
|
303
|
+
// =============================================================================
|
|
304
|
+
/**
|
|
305
|
+
* Generate JSON Schema for SpaceHostResult.
|
|
306
|
+
*/
|
|
307
|
+
export function getSpaceHostResultJsonSchema(options) {
|
|
308
|
+
return zodToJsonSchema(SpaceHostResultSchema, {
|
|
309
|
+
name: options?.name ?? "SpaceHostResult",
|
|
310
|
+
...defaultOptions,
|
|
311
|
+
...options,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
// =============================================================================
|
|
315
|
+
// Individual Schema Exports - Space Creation
|
|
316
|
+
// =============================================================================
|
|
317
|
+
/**
|
|
318
|
+
* Generate JSON Schema for SpaceCreationContext.
|
|
319
|
+
*/
|
|
320
|
+
export function getSpaceCreationContextJsonSchema(options) {
|
|
321
|
+
return zodToJsonSchema(SpaceCreationContextSchema, {
|
|
322
|
+
name: options?.name ?? "SpaceCreationContext",
|
|
323
|
+
...defaultOptions,
|
|
324
|
+
...options,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Generate JSON Schema for SpaceCreationHandler.
|
|
329
|
+
*/
|
|
330
|
+
export function getSpaceCreationHandlerJsonSchema(options) {
|
|
331
|
+
return zodToJsonSchema(SpaceCreationHandlerSchema, {
|
|
332
|
+
name: options?.name ?? "SpaceCreationHandler",
|
|
333
|
+
...defaultOptions,
|
|
334
|
+
...options,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
// =============================================================================
|
|
338
|
+
// Individual Schema Exports - TinyCloud Config
|
|
339
|
+
// =============================================================================
|
|
340
|
+
/**
|
|
341
|
+
* Generate JSON Schema for BackoffStrategy.
|
|
342
|
+
*/
|
|
343
|
+
export function getBackoffStrategyJsonSchema(options) {
|
|
344
|
+
return zodToJsonSchema(BackoffStrategySchema, {
|
|
345
|
+
name: options?.name ?? "BackoffStrategy",
|
|
346
|
+
...defaultOptions,
|
|
347
|
+
...options,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Generate JSON Schema for RetryPolicy.
|
|
352
|
+
*/
|
|
353
|
+
export function getRetryPolicyJsonSchema(options) {
|
|
354
|
+
return zodToJsonSchema(RetryPolicySchema, {
|
|
355
|
+
name: options?.name ?? "RetryPolicy",
|
|
356
|
+
...defaultOptions,
|
|
357
|
+
...options,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Generate JSON Schema for PartialRetryPolicy.
|
|
362
|
+
*/
|
|
363
|
+
export function getPartialRetryPolicyJsonSchema(options) {
|
|
364
|
+
return zodToJsonSchema(PartialRetryPolicySchema, {
|
|
365
|
+
name: options?.name ?? "PartialRetryPolicy",
|
|
366
|
+
...defaultOptions,
|
|
367
|
+
...options,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Generate JSON Schema for TinyCloudConfig.
|
|
372
|
+
*/
|
|
373
|
+
export function getTinyCloudConfigJsonSchema(options) {
|
|
374
|
+
return zodToJsonSchema(TinyCloudConfigSchema, {
|
|
375
|
+
name: options?.name ?? "TinyCloudConfig",
|
|
376
|
+
...defaultOptions,
|
|
377
|
+
...options,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
// =============================================================================
|
|
381
|
+
// Individual Schema Exports - User Authorization
|
|
382
|
+
// =============================================================================
|
|
383
|
+
/**
|
|
384
|
+
* Generate JSON Schema for PartialSiweMessage.
|
|
385
|
+
*/
|
|
386
|
+
export function getPartialSiweMessageJsonSchema(options) {
|
|
387
|
+
return zodToJsonSchema(PartialSiweMessageSchema, {
|
|
388
|
+
name: options?.name ?? "PartialSiweMessage",
|
|
389
|
+
...defaultOptions,
|
|
390
|
+
...options,
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Generate JSON Schema for UserAuthorizationConfig.
|
|
395
|
+
*/
|
|
396
|
+
export function getUserAuthorizationConfigJsonSchema(options) {
|
|
397
|
+
return zodToJsonSchema(UserAuthorizationConfigSchema, {
|
|
398
|
+
name: options?.name ?? "UserAuthorizationConfig",
|
|
399
|
+
...defaultOptions,
|
|
400
|
+
...options,
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
// =============================================================================
|
|
404
|
+
// Individual Schema Exports - Sign Strategy
|
|
405
|
+
// =============================================================================
|
|
406
|
+
/**
|
|
407
|
+
* Generate JSON Schema for SignRequestType.
|
|
408
|
+
*/
|
|
409
|
+
export function getSignRequestTypeJsonSchema(options) {
|
|
410
|
+
return zodToJsonSchema(SignRequestTypeSchema, {
|
|
411
|
+
name: options?.name ?? "SignRequestType",
|
|
412
|
+
...defaultOptions,
|
|
413
|
+
...options,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Generate JSON Schema for SignRequest.
|
|
418
|
+
*/
|
|
419
|
+
export function getSignRequestJsonSchema(options) {
|
|
420
|
+
return zodToJsonSchema(SignRequestSchema, {
|
|
421
|
+
name: options?.name ?? "SignRequest",
|
|
422
|
+
...defaultOptions,
|
|
423
|
+
...options,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Generate JSON Schema for SignResponse.
|
|
428
|
+
*/
|
|
429
|
+
export function getSignResponseJsonSchema(options) {
|
|
430
|
+
return zodToJsonSchema(SignResponseSchema, {
|
|
431
|
+
name: options?.name ?? "SignResponse",
|
|
432
|
+
...defaultOptions,
|
|
433
|
+
...options,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Generate JSON Schema for AutoSignStrategy.
|
|
438
|
+
*/
|
|
439
|
+
export function getAutoSignStrategyJsonSchema(options) {
|
|
440
|
+
return zodToJsonSchema(AutoSignStrategySchema, {
|
|
441
|
+
name: options?.name ?? "AutoSignStrategy",
|
|
442
|
+
...defaultOptions,
|
|
443
|
+
...options,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Generate JSON Schema for AutoRejectStrategy.
|
|
448
|
+
*/
|
|
449
|
+
export function getAutoRejectStrategyJsonSchema(options) {
|
|
450
|
+
return zodToJsonSchema(AutoRejectStrategySchema, {
|
|
451
|
+
name: options?.name ?? "AutoRejectStrategy",
|
|
452
|
+
...defaultOptions,
|
|
453
|
+
...options,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Generate JSON Schema for CallbackStrategy.
|
|
458
|
+
*/
|
|
459
|
+
export function getCallbackStrategyJsonSchema(options) {
|
|
460
|
+
return zodToJsonSchema(CallbackStrategySchema, {
|
|
461
|
+
name: options?.name ?? "CallbackStrategy",
|
|
462
|
+
...defaultOptions,
|
|
463
|
+
...options,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Generate JSON Schema for EventEmitterStrategy.
|
|
468
|
+
*/
|
|
469
|
+
export function getEventEmitterStrategyJsonSchema(options) {
|
|
470
|
+
return zodToJsonSchema(EventEmitterStrategySchema, {
|
|
471
|
+
name: options?.name ?? "EventEmitterStrategy",
|
|
472
|
+
...defaultOptions,
|
|
473
|
+
...options,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Generate JSON Schema for SignStrategy.
|
|
478
|
+
*/
|
|
479
|
+
export function getSignStrategyJsonSchema(options) {
|
|
480
|
+
return zodToJsonSchema(SignStrategySchema, {
|
|
481
|
+
name: options?.name ?? "SignStrategy",
|
|
482
|
+
...defaultOptions,
|
|
483
|
+
...options,
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
// =============================================================================
|
|
487
|
+
// Individual Schema Exports - Space Service
|
|
488
|
+
// =============================================================================
|
|
489
|
+
/**
|
|
490
|
+
* Generate JSON Schema for SpaceConfig.
|
|
491
|
+
*/
|
|
492
|
+
export function getSpaceConfigJsonSchema(options) {
|
|
493
|
+
return zodToJsonSchema(SpaceConfigSchema, {
|
|
494
|
+
name: options?.name ?? "SpaceConfig",
|
|
495
|
+
...defaultOptions,
|
|
496
|
+
...options,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Generate JSON Schema for SpaceServiceConfig.
|
|
501
|
+
*/
|
|
502
|
+
export function getSpaceServiceConfigJsonSchema(options) {
|
|
503
|
+
return zodToJsonSchema(SpaceServiceConfigSchema, {
|
|
504
|
+
name: options?.name ?? "SpaceServiceConfig",
|
|
505
|
+
...defaultOptions,
|
|
506
|
+
...options,
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Generate JSON Schema for SpaceDelegationParams.
|
|
511
|
+
*/
|
|
512
|
+
export function getSpaceDelegationParamsJsonSchema(options) {
|
|
513
|
+
return zodToJsonSchema(SpaceDelegationParamsSchema, {
|
|
514
|
+
name: options?.name ?? "SpaceDelegationParams",
|
|
515
|
+
...defaultOptions,
|
|
516
|
+
...options,
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
// =============================================================================
|
|
520
|
+
// Bundle Generation
|
|
521
|
+
// =============================================================================
|
|
522
|
+
/**
|
|
523
|
+
* Generate all JSON Schemas as a categorized bundle.
|
|
524
|
+
*
|
|
525
|
+
* This function generates JSON Schema for every Zod schema in the SDK,
|
|
526
|
+
* organized into logical categories for easy consumption.
|
|
527
|
+
*
|
|
528
|
+
* @param options - Options applied to all schema generation
|
|
529
|
+
* @returns Object containing all JSON Schemas organized by category
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```typescript
|
|
533
|
+
* import { getAllJsonSchemas } from "@tinycloud/sdk-core";
|
|
534
|
+
*
|
|
535
|
+
* const schemas = getAllJsonSchemas();
|
|
536
|
+
*
|
|
537
|
+
* // Access individual schemas
|
|
538
|
+
* console.log(schemas.delegations.Delegation);
|
|
539
|
+
* console.log(schemas.storage.PersistedSessionData);
|
|
540
|
+
*
|
|
541
|
+
* // Export all schemas to file
|
|
542
|
+
* fs.writeFileSync("schemas.json", JSON.stringify(schemas, null, 2));
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
export function getAllJsonSchemas(options) {
|
|
546
|
+
return {
|
|
547
|
+
storage: {
|
|
548
|
+
EnsData: getEnsDataJsonSchema(options),
|
|
549
|
+
PersistedTinyCloudSession: getPersistedTinyCloudSessionJsonSchema(options),
|
|
550
|
+
PersistedSessionData: getPersistedSessionDataJsonSchema(options),
|
|
551
|
+
TinyCloudSession: getTinyCloudSessionJsonSchema(options),
|
|
552
|
+
},
|
|
553
|
+
delegations: {
|
|
554
|
+
JWK: getJWKJsonSchema(options),
|
|
555
|
+
KeyType: getKeyTypeJsonSchema(options),
|
|
556
|
+
KeyInfo: getKeyInfoJsonSchema(options),
|
|
557
|
+
DelegationError: getDelegationErrorJsonSchema(options),
|
|
558
|
+
Delegation: getDelegationJsonSchema(options),
|
|
559
|
+
CapabilityEntry: getCapabilityEntryJsonSchema(options),
|
|
560
|
+
DelegationRecord: getDelegationRecordJsonSchema(options),
|
|
561
|
+
CreateDelegationParams: getCreateDelegationParamsJsonSchema(options),
|
|
562
|
+
DelegationChain: getDelegationChainJsonSchema(options),
|
|
563
|
+
DelegationChainV2: getDelegationChainV2JsonSchema(options),
|
|
564
|
+
DelegationDirection: getDelegationDirectionJsonSchema(options),
|
|
565
|
+
DelegationFilters: getDelegationFiltersJsonSchema(options),
|
|
566
|
+
SpaceOwnership: getSpaceOwnershipJsonSchema(options),
|
|
567
|
+
SpaceInfo: getSpaceInfoJsonSchema(options),
|
|
568
|
+
ShareSchema: getShareSchemaJsonSchema(options),
|
|
569
|
+
ShareLink: getShareLinkJsonSchema(options),
|
|
570
|
+
IngestOptions: getIngestOptionsJsonSchema(options),
|
|
571
|
+
GenerateShareParams: getGenerateShareParamsJsonSchema(options),
|
|
572
|
+
DelegationApiResponse: getDelegationApiResponseJsonSchema(options),
|
|
573
|
+
CreateDelegationWasmParams: getCreateDelegationWasmParamsJsonSchema(options),
|
|
574
|
+
CreateDelegationWasmResult: getCreateDelegationWasmResultJsonSchema(options),
|
|
575
|
+
},
|
|
576
|
+
spaceHosting: {
|
|
577
|
+
SpaceHostResult: getSpaceHostResultJsonSchema(options),
|
|
578
|
+
},
|
|
579
|
+
spaceCreation: {
|
|
580
|
+
SpaceCreationContext: getSpaceCreationContextJsonSchema(options),
|
|
581
|
+
SpaceCreationHandler: getSpaceCreationHandlerJsonSchema(options),
|
|
582
|
+
},
|
|
583
|
+
config: {
|
|
584
|
+
BackoffStrategy: getBackoffStrategyJsonSchema(options),
|
|
585
|
+
RetryPolicy: getRetryPolicyJsonSchema(options),
|
|
586
|
+
PartialRetryPolicy: getPartialRetryPolicyJsonSchema(options),
|
|
587
|
+
TinyCloudConfig: getTinyCloudConfigJsonSchema(options),
|
|
588
|
+
},
|
|
589
|
+
authorization: {
|
|
590
|
+
PartialSiweMessage: getPartialSiweMessageJsonSchema(options),
|
|
591
|
+
UserAuthorizationConfig: getUserAuthorizationConfigJsonSchema(options),
|
|
592
|
+
},
|
|
593
|
+
signStrategy: {
|
|
594
|
+
SignRequestType: getSignRequestTypeJsonSchema(options),
|
|
595
|
+
SignRequest: getSignRequestJsonSchema(options),
|
|
596
|
+
SignResponse: getSignResponseJsonSchema(options),
|
|
597
|
+
AutoSignStrategy: getAutoSignStrategyJsonSchema(options),
|
|
598
|
+
AutoRejectStrategy: getAutoRejectStrategyJsonSchema(options),
|
|
599
|
+
CallbackStrategy: getCallbackStrategyJsonSchema(options),
|
|
600
|
+
EventEmitterStrategy: getEventEmitterStrategyJsonSchema(options),
|
|
601
|
+
SignStrategy: getSignStrategyJsonSchema(options),
|
|
602
|
+
},
|
|
603
|
+
spaceService: {
|
|
604
|
+
SpaceConfig: getSpaceConfigJsonSchema(options),
|
|
605
|
+
SpaceServiceConfig: getSpaceServiceConfigJsonSchema(options),
|
|
606
|
+
SpaceDelegationParams: getSpaceDelegationParamsJsonSchema(options),
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Get a flat object of all JSON Schemas keyed by name.
|
|
612
|
+
*
|
|
613
|
+
* @param options - Options applied to all schema generation
|
|
614
|
+
* @returns Object mapping schema names to JSON Schema definitions
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```typescript
|
|
618
|
+
* import { getAllJsonSchemasFlat } from "@tinycloud/sdk-core";
|
|
619
|
+
*
|
|
620
|
+
* const schemas = getAllJsonSchemasFlat();
|
|
621
|
+
* console.log(Object.keys(schemas)); // ["EnsData", "Delegation", ...]
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
export function getAllJsonSchemasFlat(options) {
|
|
625
|
+
const bundle = getAllJsonSchemas(options);
|
|
626
|
+
return {
|
|
627
|
+
// Storage
|
|
628
|
+
...bundle.storage,
|
|
629
|
+
// Delegations
|
|
630
|
+
...bundle.delegations,
|
|
631
|
+
// Space hosting
|
|
632
|
+
...bundle.spaceHosting,
|
|
633
|
+
// Space creation
|
|
634
|
+
...bundle.spaceCreation,
|
|
635
|
+
// Config
|
|
636
|
+
...bundle.config,
|
|
637
|
+
// Authorization
|
|
638
|
+
...bundle.authorization,
|
|
639
|
+
// Sign strategy
|
|
640
|
+
...bundle.signStrategy,
|
|
641
|
+
// Space service
|
|
642
|
+
...bundle.spaceService,
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* List of all available schema names.
|
|
647
|
+
*/
|
|
648
|
+
export const SCHEMA_NAMES = [
|
|
649
|
+
// Storage
|
|
650
|
+
"EnsData",
|
|
651
|
+
"PersistedTinyCloudSession",
|
|
652
|
+
"PersistedSessionData",
|
|
653
|
+
"TinyCloudSession",
|
|
654
|
+
// Delegations
|
|
655
|
+
"JWK",
|
|
656
|
+
"KeyType",
|
|
657
|
+
"KeyInfo",
|
|
658
|
+
"DelegationError",
|
|
659
|
+
"Delegation",
|
|
660
|
+
"CapabilityEntry",
|
|
661
|
+
"DelegationRecord",
|
|
662
|
+
"CreateDelegationParams",
|
|
663
|
+
"DelegationChain",
|
|
664
|
+
"DelegationChainV2",
|
|
665
|
+
"DelegationDirection",
|
|
666
|
+
"DelegationFilters",
|
|
667
|
+
"SpaceOwnership",
|
|
668
|
+
"SpaceInfo",
|
|
669
|
+
"ShareSchema",
|
|
670
|
+
"ShareLink",
|
|
671
|
+
"IngestOptions",
|
|
672
|
+
"GenerateShareParams",
|
|
673
|
+
"DelegationApiResponse",
|
|
674
|
+
"CreateDelegationWasmParams",
|
|
675
|
+
"CreateDelegationWasmResult",
|
|
676
|
+
// Space hosting
|
|
677
|
+
"SpaceHostResult",
|
|
678
|
+
// Space creation
|
|
679
|
+
"SpaceCreationContext",
|
|
680
|
+
"SpaceCreationHandler",
|
|
681
|
+
// Config
|
|
682
|
+
"BackoffStrategy",
|
|
683
|
+
"RetryPolicy",
|
|
684
|
+
"PartialRetryPolicy",
|
|
685
|
+
"TinyCloudConfig",
|
|
686
|
+
// Authorization
|
|
687
|
+
"PartialSiweMessage",
|
|
688
|
+
"UserAuthorizationConfig",
|
|
689
|
+
// Sign strategy
|
|
690
|
+
"SignRequestType",
|
|
691
|
+
"SignRequest",
|
|
692
|
+
"SignResponse",
|
|
693
|
+
"AutoSignStrategy",
|
|
694
|
+
"AutoRejectStrategy",
|
|
695
|
+
"CallbackStrategy",
|
|
696
|
+
"EventEmitterStrategy",
|
|
697
|
+
"SignStrategy",
|
|
698
|
+
// Space service
|
|
699
|
+
"SpaceConfig",
|
|
700
|
+
"SpaceServiceConfig",
|
|
701
|
+
"SpaceDelegationParams",
|
|
702
|
+
];
|
|
703
|
+
//# sourceMappingURL=json-schema.js.map
|