vovk-hello-world 0.0.43 → 0.0.45
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 +305 -29
- package/index.d.cts +37 -15
- package/index.d.mts +37 -15
- package/index.mjs +301 -31
- package/openapi.cjs +264 -0
- package/openapi.d.cts +2 -0
- package/package.json +58 -5
- package/schema.cjs +34 -20
- package/schema.d.cts +26 -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:57:27.166Z -->
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
# vovk-hello-world v0.0.
|
|
4
|
+
# vovk-hello-world v0.0.45 [](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 http://localhost:3000/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 http://localhost:3000/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 http://localhost:3000/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,35 @@ 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
|
+
"origin": "http://localhost:3000",
|
|
32
|
+
"imports": { "validateOnClient": "vovk-ajv" },
|
|
33
|
+
"openAPIObject": { "info": {
|
|
34
|
+
"title": "\"Hello World\" app API",
|
|
35
|
+
"description": "API for \"Hello World\" app hosted at https://vovk-hello-world.vercel.app/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
36
|
+
"license": {
|
|
37
|
+
"name": "MIT",
|
|
38
|
+
"url": "https://opensource.org/licenses/MIT"
|
|
39
|
+
},
|
|
40
|
+
"version": "1.0.0"
|
|
41
|
+
} },
|
|
42
|
+
"segments": {}
|
|
43
|
+
},
|
|
44
|
+
"$schema": "https://vovk.dev/api/schema/v3/config.json"
|
|
45
|
+
};
|
|
46
|
+
var _meta_default = {
|
|
47
|
+
$schema: $schema$2,
|
|
48
|
+
config
|
|
31
49
|
};
|
|
32
|
-
var _meta_default = { config };
|
|
33
50
|
|
|
34
51
|
//#endregion
|
|
35
52
|
//#region .vovk-schema/root.json
|
|
36
|
-
var $schema$1 = "https://vovk.dev/api/
|
|
53
|
+
var $schema$1 = "https://vovk.dev/api/schema/v3/segment.json";
|
|
37
54
|
var emitSchema$1 = true;
|
|
38
55
|
var segmentName$1 = "";
|
|
39
56
|
var segmentType$1 = "segment";
|
|
@@ -105,7 +122,7 @@ var controllers$1 = {
|
|
|
105
122
|
"examples": ["123e4567-e89b-12d3-a456-426614174000"],
|
|
106
123
|
"type": "string",
|
|
107
124
|
"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)$"
|
|
125
|
+
"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
126
|
} },
|
|
110
127
|
"required": ["id"],
|
|
111
128
|
"additionalProperties": false
|
|
@@ -122,12 +139,12 @@ var controllers$1 = {
|
|
|
122
139
|
"additionalProperties": false
|
|
123
140
|
}
|
|
124
141
|
},
|
|
125
|
-
"
|
|
126
|
-
"httpMethod": "POST",
|
|
127
|
-
"openapi": {
|
|
142
|
+
"operationObject": {
|
|
128
143
|
"summary": "Update user",
|
|
129
144
|
"description": "Update user by ID"
|
|
130
|
-
}
|
|
145
|
+
},
|
|
146
|
+
"path": "{id}",
|
|
147
|
+
"httpMethod": "POST"
|
|
131
148
|
} }
|
|
132
149
|
},
|
|
133
150
|
"StreamRPC": {
|
|
@@ -146,12 +163,12 @@ var controllers$1 = {
|
|
|
146
163
|
"required": ["message"],
|
|
147
164
|
"additionalProperties": false
|
|
148
165
|
} },
|
|
149
|
-
"
|
|
150
|
-
"httpMethod": "GET",
|
|
151
|
-
"openapi": {
|
|
166
|
+
"operationObject": {
|
|
152
167
|
"summary": "Stream tokens",
|
|
153
168
|
"description": "Stream tokens to the client"
|
|
154
|
-
}
|
|
169
|
+
},
|
|
170
|
+
"path": "tokens",
|
|
171
|
+
"httpMethod": "GET"
|
|
155
172
|
} }
|
|
156
173
|
}
|
|
157
174
|
};
|
|
@@ -165,7 +182,7 @@ var root_default = {
|
|
|
165
182
|
|
|
166
183
|
//#endregion
|
|
167
184
|
//#region .vovk-schema/static.json
|
|
168
|
-
var $schema = "https://vovk.dev/api/
|
|
185
|
+
var $schema = "https://vovk.dev/api/schema/v3/segment.json";
|
|
169
186
|
var emitSchema = true;
|
|
170
187
|
var segmentName = "static";
|
|
171
188
|
var segmentType = "segment";
|
|
@@ -176,7 +193,7 @@ var controllers = { "OpenApiRPC": {
|
|
|
176
193
|
"handlers": { "getSpec": {
|
|
177
194
|
"path": "spec.json",
|
|
178
195
|
"httpMethod": "GET",
|
|
179
|
-
"
|
|
196
|
+
"operationObject": {
|
|
180
197
|
"summary": "OpenAPI spec",
|
|
181
198
|
"description": "Get the OpenAPI spec for the \"Hello World\" app API"
|
|
182
199
|
}
|
|
@@ -197,32 +214,291 @@ const segments = {
|
|
|
197
214
|
"static": static_default
|
|
198
215
|
};
|
|
199
216
|
const schema = {
|
|
200
|
-
$schema: "https://vovk.dev/api/
|
|
217
|
+
$schema: "https://vovk.dev/api/schema/v3/schema.json",
|
|
201
218
|
segments,
|
|
202
|
-
meta: {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
219
|
+
meta: { ..._meta_default }
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region tmp_prebundle/openapi.json
|
|
224
|
+
var info = {
|
|
225
|
+
"title": "\"Hello World\" app API",
|
|
226
|
+
"version": "1.0.0",
|
|
227
|
+
"description": "API for \"Hello World\" app hosted at https://vovk-hello-world.vercel.app/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
228
|
+
"license": {
|
|
229
|
+
"name": "MIT",
|
|
230
|
+
"url": "https://opensource.org/licenses/MIT"
|
|
206
231
|
}
|
|
207
232
|
};
|
|
233
|
+
var openapi = "3.1.0";
|
|
234
|
+
var components = { "schemas": {
|
|
235
|
+
"HttpStatus": {
|
|
236
|
+
"type": "integer",
|
|
237
|
+
"description": "HTTP status code",
|
|
238
|
+
"enum": [
|
|
239
|
+
100,
|
|
240
|
+
101,
|
|
241
|
+
102,
|
|
242
|
+
103,
|
|
243
|
+
200,
|
|
244
|
+
201,
|
|
245
|
+
202,
|
|
246
|
+
203,
|
|
247
|
+
204,
|
|
248
|
+
205,
|
|
249
|
+
206,
|
|
250
|
+
300,
|
|
251
|
+
301,
|
|
252
|
+
302,
|
|
253
|
+
303,
|
|
254
|
+
304,
|
|
255
|
+
307,
|
|
256
|
+
308,
|
|
257
|
+
400,
|
|
258
|
+
401,
|
|
259
|
+
402,
|
|
260
|
+
403,
|
|
261
|
+
404,
|
|
262
|
+
405,
|
|
263
|
+
406,
|
|
264
|
+
407,
|
|
265
|
+
408,
|
|
266
|
+
409,
|
|
267
|
+
410,
|
|
268
|
+
411,
|
|
269
|
+
412,
|
|
270
|
+
413,
|
|
271
|
+
414,
|
|
272
|
+
415,
|
|
273
|
+
416,
|
|
274
|
+
417,
|
|
275
|
+
418,
|
|
276
|
+
421,
|
|
277
|
+
422,
|
|
278
|
+
424,
|
|
279
|
+
428,
|
|
280
|
+
429,
|
|
281
|
+
500,
|
|
282
|
+
501,
|
|
283
|
+
502,
|
|
284
|
+
503,
|
|
285
|
+
504,
|
|
286
|
+
505
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
"VovkErrorResponse": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "Vovk error response",
|
|
292
|
+
"properties": {
|
|
293
|
+
"cause": { "description": "Error cause of any shape" },
|
|
294
|
+
"statusCode": { "$ref": "#/components/schemas/HttpStatus" },
|
|
295
|
+
"message": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"description": "Error message"
|
|
298
|
+
},
|
|
299
|
+
"isError": {
|
|
300
|
+
"type": "boolean",
|
|
301
|
+
"const": true,
|
|
302
|
+
"description": "Indicates that this object represents an error"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"required": [
|
|
306
|
+
"statusCode",
|
|
307
|
+
"message",
|
|
308
|
+
"isError"
|
|
309
|
+
],
|
|
310
|
+
"additionalProperties": false
|
|
311
|
+
}
|
|
312
|
+
} };
|
|
313
|
+
var paths = {
|
|
314
|
+
"/api/users/{id}": { "post": {
|
|
315
|
+
"summary": "Update user",
|
|
316
|
+
"description": "Update user by ID",
|
|
317
|
+
"x-codeSamples": [
|
|
318
|
+
{
|
|
319
|
+
"label": "TypeScript RPC",
|
|
320
|
+
"lang": "typescript",
|
|
321
|
+
"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*/"
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"label": "Python RPC",
|
|
325
|
+
"lang": "python",
|
|
326
|
+
"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}"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"label": "Rust RPC",
|
|
330
|
+
"lang": "rust",
|
|
331
|
+
"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}"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"parameters": [{
|
|
335
|
+
"name": "notify",
|
|
336
|
+
"in": "query",
|
|
337
|
+
"required": true,
|
|
338
|
+
"schema": {
|
|
339
|
+
"description": "Notification type",
|
|
340
|
+
"type": "string",
|
|
341
|
+
"enum": [
|
|
342
|
+
"email",
|
|
343
|
+
"push",
|
|
344
|
+
"none"
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
}, {
|
|
348
|
+
"name": "id",
|
|
349
|
+
"in": "path",
|
|
350
|
+
"required": true,
|
|
351
|
+
"schema": {
|
|
352
|
+
"description": "User ID",
|
|
353
|
+
"examples": ["123e4567-e89b-12d3-a456-426614174000"],
|
|
354
|
+
"type": "string",
|
|
355
|
+
"format": "uuid",
|
|
356
|
+
"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)$"
|
|
357
|
+
}
|
|
358
|
+
}],
|
|
359
|
+
"responses": { "200": {
|
|
360
|
+
"description": "Response object",
|
|
361
|
+
"content": { "application/json": { "schema": {
|
|
362
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
363
|
+
"description": "Response object",
|
|
364
|
+
"type": "object",
|
|
365
|
+
"properties": { "success": {
|
|
366
|
+
"description": "Success status",
|
|
367
|
+
"type": "boolean"
|
|
368
|
+
} },
|
|
369
|
+
"required": ["success"],
|
|
370
|
+
"additionalProperties": false
|
|
371
|
+
} } }
|
|
372
|
+
} },
|
|
373
|
+
"requestBody": {
|
|
374
|
+
"description": "User data object",
|
|
375
|
+
"required": true,
|
|
376
|
+
"content": { "application/json": { "schema": {
|
|
377
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
378
|
+
"description": "User data object",
|
|
379
|
+
"type": "object",
|
|
380
|
+
"properties": {
|
|
381
|
+
"email": {
|
|
382
|
+
"description": "User email",
|
|
383
|
+
"examples": ["john@example.com", "jane@example.com"],
|
|
384
|
+
"type": "string",
|
|
385
|
+
"format": "email",
|
|
386
|
+
"pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
|
|
387
|
+
},
|
|
388
|
+
"profile": {
|
|
389
|
+
"description": "User profile object",
|
|
390
|
+
"type": "object",
|
|
391
|
+
"properties": {
|
|
392
|
+
"name": {
|
|
393
|
+
"description": "User full name",
|
|
394
|
+
"examples": ["John Doe", "Jane Smith"],
|
|
395
|
+
"type": "string"
|
|
396
|
+
},
|
|
397
|
+
"age": {
|
|
398
|
+
"description": "User age",
|
|
399
|
+
"examples": [25, 30],
|
|
400
|
+
"type": "integer",
|
|
401
|
+
"minimum": 16,
|
|
402
|
+
"maximum": 120
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"required": ["name", "age"],
|
|
406
|
+
"additionalProperties": false
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"required": ["email", "profile"],
|
|
410
|
+
"additionalProperties": false
|
|
411
|
+
} } }
|
|
412
|
+
}
|
|
413
|
+
} },
|
|
414
|
+
"/api/streams/tokens": { "get": {
|
|
415
|
+
"summary": "Stream tokens",
|
|
416
|
+
"description": "Stream tokens to the client",
|
|
417
|
+
"x-codeSamples": [
|
|
418
|
+
{
|
|
419
|
+
"label": "TypeScript RPC",
|
|
420
|
+
"lang": "typescript",
|
|
421
|
+
"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}"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"label": "Python RPC",
|
|
425
|
+
"lang": "python",
|
|
426
|
+
"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 }"
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"label": "Rust RPC",
|
|
430
|
+
"lang": "rust",
|
|
431
|
+
"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}"
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
"responses": { "200": {
|
|
435
|
+
"description": "Streamed token object",
|
|
436
|
+
"content": { "application/jsonl": { "schema": {
|
|
437
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
438
|
+
"description": "Streamed token object",
|
|
439
|
+
"type": "object",
|
|
440
|
+
"properties": { "message": {
|
|
441
|
+
"description": "Message from the token",
|
|
442
|
+
"type": "string"
|
|
443
|
+
} },
|
|
444
|
+
"required": ["message"],
|
|
445
|
+
"additionalProperties": false,
|
|
446
|
+
"examples": ["{\"message\":\"string\"}\n{\"message\":\"string\"}\n{\"message\":\"string\"}"]
|
|
447
|
+
} } }
|
|
448
|
+
} }
|
|
449
|
+
} },
|
|
450
|
+
"/api/static/openapi/spec.json": { "get": {
|
|
451
|
+
"summary": "OpenAPI spec",
|
|
452
|
+
"description": "Get the OpenAPI spec for the \"Hello World\" app API",
|
|
453
|
+
"x-codeSamples": [
|
|
454
|
+
{
|
|
455
|
+
"label": "TypeScript RPC",
|
|
456
|
+
"lang": "typescript",
|
|
457
|
+
"source": "import { OpenApiRPC } from 'vovk-client';\n\nconst response = await OpenApiRPC.getSpec();"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"label": "Python RPC",
|
|
461
|
+
"lang": "python",
|
|
462
|
+
"source": "from vovk_client import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"label": "Rust RPC",
|
|
466
|
+
"lang": "rust",
|
|
467
|
+
"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}"
|
|
468
|
+
}
|
|
469
|
+
]
|
|
470
|
+
} }
|
|
471
|
+
};
|
|
472
|
+
var openapi_default = {
|
|
473
|
+
info,
|
|
474
|
+
openapi,
|
|
475
|
+
components,
|
|
476
|
+
paths
|
|
477
|
+
};
|
|
208
478
|
|
|
209
479
|
//#endregion
|
|
210
480
|
//#region tmp_prebundle/index.ts
|
|
211
|
-
const UserRPC = (0, vovk.createRPC)(schema, "", "UserRPC", vovk
|
|
212
|
-
validateOnClient:
|
|
213
|
-
apiRoot: "
|
|
481
|
+
const UserRPC = (0, vovk.createRPC)(schema, "", "UserRPC", import("vovk"), {
|
|
482
|
+
validateOnClient: import("vovk-ajv"),
|
|
483
|
+
apiRoot: "http://localhost:3000/api"
|
|
214
484
|
});
|
|
215
|
-
const StreamRPC = (0, vovk.createRPC)(schema, "", "StreamRPC", vovk
|
|
216
|
-
validateOnClient:
|
|
217
|
-
apiRoot: "
|
|
485
|
+
const StreamRPC = (0, vovk.createRPC)(schema, "", "StreamRPC", import("vovk"), {
|
|
486
|
+
validateOnClient: import("vovk-ajv"),
|
|
487
|
+
apiRoot: "http://localhost:3000/api"
|
|
218
488
|
});
|
|
219
|
-
const OpenApiRPC = (0, vovk.createRPC)(schema, "static", "OpenApiRPC", vovk
|
|
220
|
-
validateOnClient:
|
|
221
|
-
apiRoot: "
|
|
489
|
+
const OpenApiRPC = (0, vovk.createRPC)(schema, "static", "OpenApiRPC", import("vovk"), {
|
|
490
|
+
validateOnClient: import("vovk-ajv"),
|
|
491
|
+
apiRoot: "http://localhost:3000/api"
|
|
222
492
|
});
|
|
223
493
|
|
|
224
494
|
//#endregion
|
|
225
495
|
exports.OpenApiRPC = OpenApiRPC;
|
|
226
496
|
exports.StreamRPC = StreamRPC;
|
|
227
497
|
exports.UserRPC = UserRPC;
|
|
498
|
+
Object.defineProperty(exports, 'openapi', {
|
|
499
|
+
enumerable: true,
|
|
500
|
+
get: function () {
|
|
501
|
+
return openapi_default;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
228
504
|
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,29 @@ declare const schema: {
|
|
|
168
169
|
};
|
|
169
170
|
};
|
|
170
171
|
meta: {
|
|
172
|
+
$schema: string;
|
|
171
173
|
config: {
|
|
172
174
|
libs: {};
|
|
175
|
+
generatorConfig: {
|
|
176
|
+
origin: string;
|
|
177
|
+
imports: {
|
|
178
|
+
validateOnClient: string;
|
|
179
|
+
};
|
|
180
|
+
openAPIObject: {
|
|
181
|
+
info: {
|
|
182
|
+
title: string;
|
|
183
|
+
description: string;
|
|
184
|
+
license: {
|
|
185
|
+
name: string;
|
|
186
|
+
url: string;
|
|
187
|
+
};
|
|
188
|
+
version: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
segments: {};
|
|
192
|
+
};
|
|
173
193
|
$schema: string;
|
|
174
194
|
};
|
|
175
|
-
$schema: string;
|
|
176
|
-
apiRoot: string;
|
|
177
195
|
};
|
|
178
196
|
};
|
|
179
197
|
//#endregion
|
|
@@ -218,7 +236,7 @@ declare const UserRPC: {
|
|
|
218
236
|
};
|
|
219
237
|
isRPC?: boolean;
|
|
220
238
|
} & {
|
|
221
|
-
schema: vovk0.VovkHandlerSchema
|
|
239
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
222
240
|
wrapper?: ((req: vovk0.VovkRequest<any, any, any>, params: {
|
|
223
241
|
id: string;
|
|
224
242
|
}) => Promise<{
|
|
@@ -305,7 +323,9 @@ declare const UserRPC: {
|
|
|
305
323
|
}, {
|
|
306
324
|
apiRoot?: string;
|
|
307
325
|
disableClientValidation?: boolean;
|
|
308
|
-
validateOnClient?: vovk0.VovkValidateOnClient<unknown> |
|
|
326
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
327
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
328
|
+
}> | undefined;
|
|
309
329
|
interpretAs?: string;
|
|
310
330
|
init?: RequestInit;
|
|
311
331
|
}, unknown>;
|
|
@@ -326,7 +346,7 @@ declare const StreamRPC: {
|
|
|
326
346
|
};
|
|
327
347
|
isRPC?: boolean;
|
|
328
348
|
} & {
|
|
329
|
-
schema: vovk0.VovkHandlerSchema
|
|
349
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
330
350
|
wrapper?: ((req: vovk0.VovkRequest<any, any, any>, params: undefined) => AsyncGenerator<{
|
|
331
351
|
message: string;
|
|
332
352
|
}, void, unknown>) | undefined;
|
|
@@ -377,13 +397,15 @@ declare const StreamRPC: {
|
|
|
377
397
|
}, {
|
|
378
398
|
apiRoot?: string;
|
|
379
399
|
disableClientValidation?: boolean;
|
|
380
|
-
validateOnClient?: vovk0.VovkValidateOnClient<unknown> |
|
|
400
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
401
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
402
|
+
}> | undefined;
|
|
381
403
|
interpretAs?: string;
|
|
382
404
|
init?: RequestInit;
|
|
383
405
|
}, unknown>;
|
|
384
406
|
};
|
|
385
407
|
declare const OpenApiRPC: {
|
|
386
|
-
getSpec: () =>
|
|
408
|
+
getSpec: () => openapi3_ts_oas310.OpenAPIObject;
|
|
387
409
|
};
|
|
388
410
|
//#endregion
|
|
389
|
-
export { OpenApiRPC, StreamRPC, UserRPC, schema };
|
|
411
|
+
export { OpenApiRPC, StreamRPC, UserRPC, openapi, schema };
|