vovk-hello-world 0.0.42 → 0.0.44
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/README.md +31 -31
- package/index.cjs +288 -29
- package/index.d.cts +26 -15
- package/index.d.mts +26 -15
- package/index.mjs +284 -31
- package/openapi.cjs +256 -0
- package/openapi.d.cts +2 -0
- package/package.json +58 -5
- package/schema.cjs +25 -20
- package/schema.d.cts +15 -9
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<!-- auto-generated by vovk-cli v0.0.1-draft.
|
|
1
|
+
<!-- auto-generated by vovk-cli v0.0.1-draft.345 at 2025-08-28T19:40:42.305Z -->
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
# vovk-hello-world v0.0.
|
|
4
|
+
# vovk-hello-world v0.0.44 [](https://www.typescriptlang.org/) [](https://vovk.dev)
|
|
5
5
|
|
|
6
6
|
> A showcase for Next.js + Vovk.ts + Zod, demonstrating its capabilities with TypeScript, Rust, and Python RPC.
|
|
7
7
|
|
|
@@ -17,46 +17,46 @@ npm install vovk-hello-world
|
|
|
17
17
|
## UserRPC
|
|
18
18
|
|
|
19
19
|
### UserRPC.updateUser
|
|
20
|
-
> Update user
|
|
21
20
|
|
|
22
|
-
Update user by ID
|
|
23
21
|
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
`POST /api/users/{id}`
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
import { UserRPC } from 'vovk-hello-world';
|
|
29
29
|
|
|
30
30
|
const response = await UserRPC.updateUser({
|
|
31
31
|
body: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
// User email
|
|
33
|
+
email: "john@example.com",
|
|
34
|
+
// User profile object
|
|
35
|
+
profile: {
|
|
36
|
+
// User full name
|
|
37
|
+
name: "John Doe",
|
|
38
|
+
// User age
|
|
39
|
+
age: 25
|
|
40
|
+
}
|
|
41
41
|
},
|
|
42
42
|
query: {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// Notification type
|
|
44
|
+
notify: "email"
|
|
45
45
|
},
|
|
46
46
|
params: {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
// User ID
|
|
48
|
+
id: "123e4567-e89b-12d3-a456-426614174000"
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
console.log(response);
|
|
53
53
|
/*
|
|
54
54
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
// -----
|
|
56
|
+
// Response object
|
|
57
|
+
// -----
|
|
58
|
+
// Success status
|
|
59
|
+
success: true
|
|
60
60
|
}
|
|
61
61
|
*/
|
|
62
62
|
```
|
|
@@ -66,12 +66,12 @@ console.log(response);
|
|
|
66
66
|
## StreamRPC
|
|
67
67
|
|
|
68
68
|
### StreamRPC.streamTokens
|
|
69
|
-
> Stream tokens
|
|
70
69
|
|
|
71
|
-
Stream tokens to the client
|
|
72
70
|
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
`GET /api/streams/tokens`
|
|
75
75
|
|
|
76
76
|
```ts
|
|
77
77
|
import { StreamRPC } from 'vovk-hello-world';
|
|
@@ -82,8 +82,8 @@ for await (const item of response) {
|
|
|
82
82
|
console.log(item);
|
|
83
83
|
/*
|
|
84
84
|
{
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
// Message from the token
|
|
86
|
+
message: "string"
|
|
87
87
|
}
|
|
88
88
|
*/
|
|
89
89
|
}
|
|
@@ -95,12 +95,12 @@ for await (const item of response) {
|
|
|
95
95
|
## OpenApiRPC
|
|
96
96
|
|
|
97
97
|
### OpenApiRPC.getSpec
|
|
98
|
-
> OpenAPI spec
|
|
99
98
|
|
|
100
|
-
Get the OpenAPI spec for the "Hello World" app API
|
|
101
99
|
|
|
102
100
|
|
|
103
|
-
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
`GET /api/static/openapi/spec.json`
|
|
104
104
|
|
|
105
105
|
```ts
|
|
106
106
|
import { OpenApiRPC } from 'vovk-hello-world';
|
package/index.cjs
CHANGED
|
@@ -22,18 +22,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
24
|
const vovk = __toESM(require("vovk"));
|
|
25
|
-
const vovk_ajv = __toESM(require("vovk-ajv"));
|
|
26
25
|
|
|
27
26
|
//#region .vovk-schema/_meta.json
|
|
27
|
+
var $schema$2 = "https://vovk.dev/api/schema/v3/meta.json";
|
|
28
28
|
var config = {
|
|
29
29
|
"libs": {},
|
|
30
|
-
"
|
|
30
|
+
"generatorConfig": {
|
|
31
|
+
"imports": { "validateOnClient": "vovk-ajv" },
|
|
32
|
+
"origin": "",
|
|
33
|
+
"segments": {}
|
|
34
|
+
},
|
|
35
|
+
"$schema": "https://vovk.dev/api/schema/v3/config.json"
|
|
36
|
+
};
|
|
37
|
+
var _meta_default = {
|
|
38
|
+
$schema: $schema$2,
|
|
39
|
+
config
|
|
31
40
|
};
|
|
32
|
-
var _meta_default = { config };
|
|
33
41
|
|
|
34
42
|
//#endregion
|
|
35
43
|
//#region .vovk-schema/root.json
|
|
36
|
-
var $schema$1 = "https://vovk.dev/api/
|
|
44
|
+
var $schema$1 = "https://vovk.dev/api/schema/v3/segment.json";
|
|
37
45
|
var emitSchema$1 = true;
|
|
38
46
|
var segmentName$1 = "";
|
|
39
47
|
var segmentType$1 = "segment";
|
|
@@ -105,7 +113,7 @@ var controllers$1 = {
|
|
|
105
113
|
"examples": ["123e4567-e89b-12d3-a456-426614174000"],
|
|
106
114
|
"type": "string",
|
|
107
115
|
"format": "uuid",
|
|
108
|
-
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$"
|
|
116
|
+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
|
|
109
117
|
} },
|
|
110
118
|
"required": ["id"],
|
|
111
119
|
"additionalProperties": false
|
|
@@ -122,12 +130,12 @@ var controllers$1 = {
|
|
|
122
130
|
"additionalProperties": false
|
|
123
131
|
}
|
|
124
132
|
},
|
|
125
|
-
"
|
|
126
|
-
"httpMethod": "POST",
|
|
127
|
-
"openapi": {
|
|
133
|
+
"operationObject": {
|
|
128
134
|
"summary": "Update user",
|
|
129
135
|
"description": "Update user by ID"
|
|
130
|
-
}
|
|
136
|
+
},
|
|
137
|
+
"path": "{id}",
|
|
138
|
+
"httpMethod": "POST"
|
|
131
139
|
} }
|
|
132
140
|
},
|
|
133
141
|
"StreamRPC": {
|
|
@@ -146,12 +154,12 @@ var controllers$1 = {
|
|
|
146
154
|
"required": ["message"],
|
|
147
155
|
"additionalProperties": false
|
|
148
156
|
} },
|
|
149
|
-
"
|
|
150
|
-
"httpMethod": "GET",
|
|
151
|
-
"openapi": {
|
|
157
|
+
"operationObject": {
|
|
152
158
|
"summary": "Stream tokens",
|
|
153
159
|
"description": "Stream tokens to the client"
|
|
154
|
-
}
|
|
160
|
+
},
|
|
161
|
+
"path": "tokens",
|
|
162
|
+
"httpMethod": "GET"
|
|
155
163
|
} }
|
|
156
164
|
}
|
|
157
165
|
};
|
|
@@ -165,7 +173,7 @@ var root_default = {
|
|
|
165
173
|
|
|
166
174
|
//#endregion
|
|
167
175
|
//#region .vovk-schema/static.json
|
|
168
|
-
var $schema = "https://vovk.dev/api/
|
|
176
|
+
var $schema = "https://vovk.dev/api/schema/v3/segment.json";
|
|
169
177
|
var emitSchema = true;
|
|
170
178
|
var segmentName = "static";
|
|
171
179
|
var segmentType = "segment";
|
|
@@ -176,7 +184,7 @@ var controllers = { "OpenApiRPC": {
|
|
|
176
184
|
"handlers": { "getSpec": {
|
|
177
185
|
"path": "spec.json",
|
|
178
186
|
"httpMethod": "GET",
|
|
179
|
-
"
|
|
187
|
+
"operationObject": {
|
|
180
188
|
"summary": "OpenAPI spec",
|
|
181
189
|
"description": "Get the OpenAPI spec for the \"Hello World\" app API"
|
|
182
190
|
}
|
|
@@ -197,32 +205,283 @@ const segments = {
|
|
|
197
205
|
"static": static_default
|
|
198
206
|
};
|
|
199
207
|
const schema = {
|
|
200
|
-
$schema: "https://vovk.dev/api/
|
|
208
|
+
$schema: "https://vovk.dev/api/schema/v3/schema.json",
|
|
201
209
|
segments,
|
|
202
|
-
meta: {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
210
|
+
meta: { ..._meta_default }
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region tmp_prebundle/openapi.json
|
|
215
|
+
var info = {};
|
|
216
|
+
var openapi = "3.1.0";
|
|
217
|
+
var components = { "schemas": {
|
|
218
|
+
"HttpStatus": {
|
|
219
|
+
"type": "integer",
|
|
220
|
+
"description": "HTTP status code",
|
|
221
|
+
"enum": [
|
|
222
|
+
100,
|
|
223
|
+
101,
|
|
224
|
+
102,
|
|
225
|
+
103,
|
|
226
|
+
200,
|
|
227
|
+
201,
|
|
228
|
+
202,
|
|
229
|
+
203,
|
|
230
|
+
204,
|
|
231
|
+
205,
|
|
232
|
+
206,
|
|
233
|
+
300,
|
|
234
|
+
301,
|
|
235
|
+
302,
|
|
236
|
+
303,
|
|
237
|
+
304,
|
|
238
|
+
307,
|
|
239
|
+
308,
|
|
240
|
+
400,
|
|
241
|
+
401,
|
|
242
|
+
402,
|
|
243
|
+
403,
|
|
244
|
+
404,
|
|
245
|
+
405,
|
|
246
|
+
406,
|
|
247
|
+
407,
|
|
248
|
+
408,
|
|
249
|
+
409,
|
|
250
|
+
410,
|
|
251
|
+
411,
|
|
252
|
+
412,
|
|
253
|
+
413,
|
|
254
|
+
414,
|
|
255
|
+
415,
|
|
256
|
+
416,
|
|
257
|
+
417,
|
|
258
|
+
418,
|
|
259
|
+
421,
|
|
260
|
+
422,
|
|
261
|
+
424,
|
|
262
|
+
428,
|
|
263
|
+
429,
|
|
264
|
+
500,
|
|
265
|
+
501,
|
|
266
|
+
502,
|
|
267
|
+
503,
|
|
268
|
+
504,
|
|
269
|
+
505
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
"VovkErrorResponse": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"description": "Vovk error response",
|
|
275
|
+
"properties": {
|
|
276
|
+
"cause": { "description": "Error cause of any shape" },
|
|
277
|
+
"statusCode": { "$ref": "#/components/schemas/HttpStatus" },
|
|
278
|
+
"message": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"description": "Error message"
|
|
281
|
+
},
|
|
282
|
+
"isError": {
|
|
283
|
+
"type": "boolean",
|
|
284
|
+
"const": true,
|
|
285
|
+
"description": "Indicates that this object represents an error"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"required": [
|
|
289
|
+
"statusCode",
|
|
290
|
+
"message",
|
|
291
|
+
"isError"
|
|
292
|
+
],
|
|
293
|
+
"additionalProperties": false
|
|
206
294
|
}
|
|
295
|
+
} };
|
|
296
|
+
var paths = {
|
|
297
|
+
"/api/users/{id}": { "post": {
|
|
298
|
+
"summary": "Update user",
|
|
299
|
+
"description": "Update user by ID",
|
|
300
|
+
"x-codeSamples": [
|
|
301
|
+
{
|
|
302
|
+
"label": "TypeScript RPC",
|
|
303
|
+
"lang": "typescript",
|
|
304
|
+
"source": "import { UserRPC } from 'vovk-client';\n\nconst response = await UserRPC.updateUser({\n body: {\n // User email\n email: \"john@example.com\",\n // User profile object\n profile: {\n // User full name\n name: \"John Doe\",\n // User age\n age: 25\n }\n },\n query: {\n // Notification type\n notify: \"email\"\n },\n params: {\n // User ID\n id: \"123e4567-e89b-12d3-a456-426614174000\"\n },\n});\n\nconsole.log(response); \n/* \n{\n // -----\n // Response object\n // -----\n // Success status\n success: true\n}\n*/"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"label": "Python RPC",
|
|
308
|
+
"lang": "python",
|
|
309
|
+
"source": "from vovk_client import UserRPC\n\nresponse = UserRPC.update_user(\n body={\n # User email\n \"email\": \"john@example.com\",\n # User profile object\n \"profile\": {\n # User full name\n \"name\": \"John Doe\",\n # User age\n \"age\": 25\n }\n },\n query={\n # Notification type\n \"notify\": \"email\"\n },\n params={\n # User ID\n \"id\": \"123e4567-e89b-12d3-a456-426614174000\"\n },\n)\n\nprint(response)\n{\n # -----\n # Response object\n # -----\n # Success status\n \"success\": true\n}"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"label": "Rust RPC",
|
|
313
|
+
"lang": "rust",
|
|
314
|
+
"source": "use vovk_client::user_rpc;\nuse serde_json::{ \n from_value, \n json \n};\n\n\npub fn main() {\n let response = user_rpc::update_user(\n from_value(json!({\n // User email\n \"email\": \"john@example.com\",\n // User profile object\n \"profile\": {\n // User full name\n \"name\": \"John Doe\",\n // User age\n \"age\": 25\n }\n })).unwrap(), /* body */ \n from_value(json!({\n // Notification type\n \"notify\": \"email\"\n })).unwrap(), /* query */ \n from_value(json!({\n // User ID\n \"id\": \"123e4567-e89b-12d3-a456-426614174000\"\n })).unwrap(), /* params */ \n None, /* headers (HashMap) */ \n None, /* api_root */\n false, /* disable_client_validation */\n );\n\nmatch response {\n Ok(output) => println!(\"{:?}\", output),\n /* \n output {\n // Success status\n success: true\n } \n */\n Err(e) => println!(\"error: {:?}\", e),\n }\n}"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"parameters": [{
|
|
318
|
+
"name": "notify",
|
|
319
|
+
"in": "query",
|
|
320
|
+
"required": true,
|
|
321
|
+
"schema": {
|
|
322
|
+
"description": "Notification type",
|
|
323
|
+
"type": "string",
|
|
324
|
+
"enum": [
|
|
325
|
+
"email",
|
|
326
|
+
"push",
|
|
327
|
+
"none"
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
}, {
|
|
331
|
+
"name": "id",
|
|
332
|
+
"in": "path",
|
|
333
|
+
"required": true,
|
|
334
|
+
"schema": {
|
|
335
|
+
"description": "User ID",
|
|
336
|
+
"examples": ["123e4567-e89b-12d3-a456-426614174000"],
|
|
337
|
+
"type": "string",
|
|
338
|
+
"format": "uuid",
|
|
339
|
+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
|
|
340
|
+
}
|
|
341
|
+
}],
|
|
342
|
+
"responses": { "200": {
|
|
343
|
+
"description": "Response object",
|
|
344
|
+
"content": { "application/json": { "schema": {
|
|
345
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
346
|
+
"description": "Response object",
|
|
347
|
+
"type": "object",
|
|
348
|
+
"properties": { "success": {
|
|
349
|
+
"description": "Success status",
|
|
350
|
+
"type": "boolean"
|
|
351
|
+
} },
|
|
352
|
+
"required": ["success"],
|
|
353
|
+
"additionalProperties": false
|
|
354
|
+
} } }
|
|
355
|
+
} },
|
|
356
|
+
"requestBody": {
|
|
357
|
+
"description": "User data object",
|
|
358
|
+
"required": true,
|
|
359
|
+
"content": { "application/json": { "schema": {
|
|
360
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
361
|
+
"description": "User data object",
|
|
362
|
+
"type": "object",
|
|
363
|
+
"properties": {
|
|
364
|
+
"email": {
|
|
365
|
+
"description": "User email",
|
|
366
|
+
"examples": ["john@example.com", "jane@example.com"],
|
|
367
|
+
"type": "string",
|
|
368
|
+
"format": "email",
|
|
369
|
+
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
|
|
370
|
+
},
|
|
371
|
+
"profile": {
|
|
372
|
+
"description": "User profile object",
|
|
373
|
+
"type": "object",
|
|
374
|
+
"properties": {
|
|
375
|
+
"name": {
|
|
376
|
+
"description": "User full name",
|
|
377
|
+
"examples": ["John Doe", "Jane Smith"],
|
|
378
|
+
"type": "string"
|
|
379
|
+
},
|
|
380
|
+
"age": {
|
|
381
|
+
"description": "User age",
|
|
382
|
+
"examples": [25, 30],
|
|
383
|
+
"type": "integer",
|
|
384
|
+
"minimum": 16,
|
|
385
|
+
"maximum": 120
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"required": ["name", "age"],
|
|
389
|
+
"additionalProperties": false
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
"required": ["email", "profile"],
|
|
393
|
+
"additionalProperties": false
|
|
394
|
+
} } }
|
|
395
|
+
}
|
|
396
|
+
} },
|
|
397
|
+
"/api/streams/tokens": { "get": {
|
|
398
|
+
"summary": "Stream tokens",
|
|
399
|
+
"description": "Stream tokens to the client",
|
|
400
|
+
"x-codeSamples": [
|
|
401
|
+
{
|
|
402
|
+
"label": "TypeScript RPC",
|
|
403
|
+
"lang": "typescript",
|
|
404
|
+
"source": "import { StreamRPC } from 'vovk-client';\n\nusing response = await StreamRPC.streamTokens();\n\nfor await (const item of response) {\n console.log(item); \n /*\n {\n // Message from the token\n message: \"string\"\n }\n */\n}"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"label": "Python RPC",
|
|
408
|
+
"lang": "python",
|
|
409
|
+
"source": "from vovk_client import StreamRPC\n\nresponse = StreamRPC.stream_tokens()\n\nfor i, item in enumerate(response):\n print(f\"iteration #{i}:\\n {item}\")\n # iteration #0:\n {\n # Message from the token\n \"message\": \"string\"\n }"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"label": "Rust RPC",
|
|
413
|
+
"lang": "rust",
|
|
414
|
+
"source": "use vovk_client::stream_rpc;\nuse serde_json::{ \n from_value, \n json \n};\n\n\npub fn main() {\n let response = stream_rpc::stream_tokens(\n (), /* body */ \n (), /* query */ \n (), /* params */ \n None, /* headers (HashMap) */ \n None, /* api_root */\n false, /* disable_client_validation */\n );\n\nmatch response {\n Ok(stream) => {\n for (i, item) in stream.enumerate() {\n println!(\"#{}: {:?}\", i, item);\n /*\n #0: iteration {\n // Message from the token\n message: \"string\"\n }\n */\n }\n },\n Err(e) => println!(\"Error initiating stream: {:?}\", e),\n }\n}"
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
"responses": { "200": {
|
|
418
|
+
"description": "Streamed token object",
|
|
419
|
+
"content": { "application/jsonl": { "schema": {
|
|
420
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
421
|
+
"description": "Streamed token object",
|
|
422
|
+
"type": "object",
|
|
423
|
+
"properties": { "message": {
|
|
424
|
+
"description": "Message from the token",
|
|
425
|
+
"type": "string"
|
|
426
|
+
} },
|
|
427
|
+
"required": ["message"],
|
|
428
|
+
"additionalProperties": false,
|
|
429
|
+
"examples": ["{\"message\":\"string\"}\n{\"message\":\"string\"}\n{\"message\":\"string\"}"]
|
|
430
|
+
} } }
|
|
431
|
+
} }
|
|
432
|
+
} },
|
|
433
|
+
"/api/static/openapi/spec.json": { "get": {
|
|
434
|
+
"summary": "OpenAPI spec",
|
|
435
|
+
"description": "Get the OpenAPI spec for the \"Hello World\" app API",
|
|
436
|
+
"x-codeSamples": [
|
|
437
|
+
{
|
|
438
|
+
"label": "TypeScript RPC",
|
|
439
|
+
"lang": "typescript",
|
|
440
|
+
"source": "import { OpenApiRPC } from 'vovk-client';\n\nconst response = await OpenApiRPC.getSpec();"
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"label": "Python RPC",
|
|
444
|
+
"lang": "python",
|
|
445
|
+
"source": "from vovk_client import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"label": "Rust RPC",
|
|
449
|
+
"lang": "rust",
|
|
450
|
+
"source": "use vovk_client::open_api_rpc;\nuse serde_json::{ \n from_value, \n json \n};\n\n\npub fn main() {\n let response = open_api_rpc::get_spec(\n (), /* body */ \n (), /* query */ \n (), /* params */ \n None, /* headers (HashMap) */ \n None, /* api_root */\n false, /* disable_client_validation */\n );\n}"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
} }
|
|
454
|
+
};
|
|
455
|
+
var openapi_default = {
|
|
456
|
+
info,
|
|
457
|
+
openapi,
|
|
458
|
+
components,
|
|
459
|
+
paths
|
|
207
460
|
};
|
|
208
461
|
|
|
209
462
|
//#endregion
|
|
210
463
|
//#region tmp_prebundle/index.ts
|
|
211
|
-
const UserRPC = (0, vovk.createRPC)(schema, "", "UserRPC", vovk
|
|
212
|
-
validateOnClient:
|
|
213
|
-
apiRoot: "
|
|
464
|
+
const UserRPC = (0, vovk.createRPC)(schema, "", "UserRPC", import("vovk"), {
|
|
465
|
+
validateOnClient: import("vovk-ajv"),
|
|
466
|
+
apiRoot: "/api"
|
|
214
467
|
});
|
|
215
|
-
const StreamRPC = (0, vovk.createRPC)(schema, "", "StreamRPC", vovk
|
|
216
|
-
validateOnClient:
|
|
217
|
-
apiRoot: "
|
|
468
|
+
const StreamRPC = (0, vovk.createRPC)(schema, "", "StreamRPC", import("vovk"), {
|
|
469
|
+
validateOnClient: import("vovk-ajv"),
|
|
470
|
+
apiRoot: "/api"
|
|
218
471
|
});
|
|
219
|
-
const OpenApiRPC = (0, vovk.createRPC)(schema, "static", "OpenApiRPC", vovk
|
|
220
|
-
validateOnClient:
|
|
221
|
-
apiRoot: "
|
|
472
|
+
const OpenApiRPC = (0, vovk.createRPC)(schema, "static", "OpenApiRPC", import("vovk"), {
|
|
473
|
+
validateOnClient: import("vovk-ajv"),
|
|
474
|
+
apiRoot: "/api"
|
|
222
475
|
});
|
|
223
476
|
|
|
224
477
|
//#endregion
|
|
225
478
|
exports.OpenApiRPC = OpenApiRPC;
|
|
226
479
|
exports.StreamRPC = StreamRPC;
|
|
227
480
|
exports.UserRPC = UserRPC;
|
|
481
|
+
Object.defineProperty(exports, 'openapi', {
|
|
482
|
+
enumerable: true,
|
|
483
|
+
get: function () {
|
|
484
|
+
return openapi_default;
|
|
485
|
+
}
|
|
486
|
+
});
|
|
228
487
|
exports.schema = schema;
|
package/index.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ import * as zod0 from "zod";
|
|
|
4
4
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
5
|
import * as vovk_mjs_client_types0 from "vovk/mjs/client/types";
|
|
6
6
|
import * as openapi3_ts_oas310 from "openapi3-ts/oas31";
|
|
7
|
+
import openapi from "./openapi.json";
|
|
7
8
|
|
|
8
9
|
//#region tmp_prebundle/schema.d.ts
|
|
9
10
|
declare const schema: {
|
|
@@ -102,12 +103,12 @@ declare const schema: {
|
|
|
102
103
|
additionalProperties: boolean;
|
|
103
104
|
};
|
|
104
105
|
};
|
|
105
|
-
|
|
106
|
-
httpMethod: string;
|
|
107
|
-
openapi: {
|
|
106
|
+
operationObject: {
|
|
108
107
|
summary: string;
|
|
109
108
|
description: string;
|
|
110
109
|
};
|
|
110
|
+
path: string;
|
|
111
|
+
httpMethod: string;
|
|
111
112
|
};
|
|
112
113
|
};
|
|
113
114
|
};
|
|
@@ -132,12 +133,12 @@ declare const schema: {
|
|
|
132
133
|
additionalProperties: boolean;
|
|
133
134
|
};
|
|
134
135
|
};
|
|
135
|
-
|
|
136
|
-
httpMethod: string;
|
|
137
|
-
openapi: {
|
|
136
|
+
operationObject: {
|
|
138
137
|
summary: string;
|
|
139
138
|
description: string;
|
|
140
139
|
};
|
|
140
|
+
path: string;
|
|
141
|
+
httpMethod: string;
|
|
141
142
|
};
|
|
142
143
|
};
|
|
143
144
|
};
|
|
@@ -157,7 +158,7 @@ declare const schema: {
|
|
|
157
158
|
getSpec: {
|
|
158
159
|
path: string;
|
|
159
160
|
httpMethod: string;
|
|
160
|
-
|
|
161
|
+
operationObject: {
|
|
161
162
|
summary: string;
|
|
162
163
|
description: string;
|
|
163
164
|
};
|
|
@@ -168,12 +169,18 @@ declare const schema: {
|
|
|
168
169
|
};
|
|
169
170
|
};
|
|
170
171
|
meta: {
|
|
172
|
+
$schema: string;
|
|
171
173
|
config: {
|
|
172
174
|
libs: {};
|
|
175
|
+
generatorConfig: {
|
|
176
|
+
imports: {
|
|
177
|
+
validateOnClient: string;
|
|
178
|
+
};
|
|
179
|
+
origin: string;
|
|
180
|
+
segments: {};
|
|
181
|
+
};
|
|
173
182
|
$schema: string;
|
|
174
183
|
};
|
|
175
|
-
$schema: string;
|
|
176
|
-
apiRoot: string;
|
|
177
184
|
};
|
|
178
185
|
};
|
|
179
186
|
//#endregion
|
|
@@ -218,7 +225,7 @@ declare const UserRPC: {
|
|
|
218
225
|
};
|
|
219
226
|
isRPC?: boolean;
|
|
220
227
|
} & {
|
|
221
|
-
schema: vovk0.VovkHandlerSchema
|
|
228
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
222
229
|
wrapper?: ((req: vovk0.VovkRequest<any, any, any>, params: {
|
|
223
230
|
id: string;
|
|
224
231
|
}) => Promise<{
|
|
@@ -305,7 +312,9 @@ declare const UserRPC: {
|
|
|
305
312
|
}, {
|
|
306
313
|
apiRoot?: string;
|
|
307
314
|
disableClientValidation?: boolean;
|
|
308
|
-
validateOnClient?: vovk0.VovkValidateOnClient<unknown> |
|
|
315
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
316
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
317
|
+
}> | undefined;
|
|
309
318
|
interpretAs?: string;
|
|
310
319
|
init?: RequestInit;
|
|
311
320
|
}, unknown>;
|
|
@@ -326,7 +335,7 @@ declare const StreamRPC: {
|
|
|
326
335
|
};
|
|
327
336
|
isRPC?: boolean;
|
|
328
337
|
} & {
|
|
329
|
-
schema: vovk0.VovkHandlerSchema
|
|
338
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
330
339
|
wrapper?: ((req: vovk0.VovkRequest<any, any, any>, params: undefined) => AsyncGenerator<{
|
|
331
340
|
message: string;
|
|
332
341
|
}, void, unknown>) | undefined;
|
|
@@ -377,13 +386,15 @@ declare const StreamRPC: {
|
|
|
377
386
|
}, {
|
|
378
387
|
apiRoot?: string;
|
|
379
388
|
disableClientValidation?: boolean;
|
|
380
|
-
validateOnClient?: vovk0.VovkValidateOnClient<unknown> |
|
|
389
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
390
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
391
|
+
}> | undefined;
|
|
381
392
|
interpretAs?: string;
|
|
382
393
|
init?: RequestInit;
|
|
383
394
|
}, unknown>;
|
|
384
395
|
};
|
|
385
396
|
declare const OpenApiRPC: {
|
|
386
|
-
getSpec: () =>
|
|
397
|
+
getSpec: () => openapi3_ts_oas310.OpenAPIObject;
|
|
387
398
|
};
|
|
388
399
|
//#endregion
|
|
389
|
-
export { OpenApiRPC, StreamRPC, UserRPC, schema };
|
|
400
|
+
export { OpenApiRPC, StreamRPC, UserRPC, openapi, schema };
|