vovk-hello-world 0.0.49 → 0.0.51
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 +2 -2
- package/index.cjs +18 -24
- package/index.d.cts +31 -39
- package/index.d.mts +31 -39
- package/index.mjs +18 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<!-- Generated by vovk-cli v0.0.1-draft.
|
|
1
|
+
<!-- Generated by vovk-cli v0.0.1-draft.392 at 2025-11-03T08:16:54.290Z -->
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
# vovk-hello-world v0.0.
|
|
4
|
+
# vovk-hello-world v0.0.51 [](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
|
|
package/index.cjs
CHANGED
|
@@ -178,20 +178,6 @@ var _meta_default = {
|
|
|
178
178
|
$schema: "https://vovk.dev/api/schema/v3/meta.json",
|
|
179
179
|
config: {
|
|
180
180
|
"libs": {},
|
|
181
|
-
"outputConfig": {
|
|
182
|
-
"imports": { "validateOnClient": "vovk-ajv" },
|
|
183
|
-
"openAPIObject": { "info": {
|
|
184
|
-
"title": "\"Hello World\" app API",
|
|
185
|
-
"description": "API for \"Hello World\" app hosted at https://hello-world.vovk.dev/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
186
|
-
"license": {
|
|
187
|
-
"name": "MIT",
|
|
188
|
-
"url": "https://opensource.org/licenses/MIT"
|
|
189
|
-
},
|
|
190
|
-
"version": "1.0.0"
|
|
191
|
-
} },
|
|
192
|
-
"origin": "",
|
|
193
|
-
"segments": {}
|
|
194
|
-
},
|
|
195
181
|
"$schema": "https://vovk.dev/api/schema/v3/config.json"
|
|
196
182
|
}
|
|
197
183
|
};
|
|
@@ -212,7 +198,15 @@ const schema = {
|
|
|
212
198
|
//#region tmp_prebundle/openapi.json
|
|
213
199
|
var openapi_default = {
|
|
214
200
|
openapi: "3.1.0",
|
|
215
|
-
info: {
|
|
201
|
+
info: {
|
|
202
|
+
"title": "\"Hello World\" app API",
|
|
203
|
+
"version": "1.0.0",
|
|
204
|
+
"description": "API for \"Hello World\" app hosted at https://hello-world.vovk.dev/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
205
|
+
"license": {
|
|
206
|
+
"name": "MIT",
|
|
207
|
+
"url": "https://opensource.org/licenses/MIT"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
216
210
|
components: { "schemas": {
|
|
217
211
|
"HttpStatus": {
|
|
218
212
|
"type": "integer",
|
|
@@ -300,17 +294,17 @@ var openapi_default = {
|
|
|
300
294
|
{
|
|
301
295
|
"label": "TypeScript RPC",
|
|
302
296
|
"lang": "typescript",
|
|
303
|
-
"source": "import { UserRPC } from 'vovk-
|
|
297
|
+
"source": "import { UserRPC } from 'vovk-hello-world';\n\nconst response = await UserRPC.updateUser({\n body: {\n // -----\n // User data object\n // -----\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 // -----\n // Query parameters\n // -----\n // Notification type\n notify: \"email\"\n },\n params: {\n // -----\n // Path parameters\n // -----\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*/"
|
|
304
298
|
},
|
|
305
299
|
{
|
|
306
300
|
"label": "Python RPC",
|
|
307
301
|
"lang": "python",
|
|
308
|
-
"source": "from
|
|
302
|
+
"source": "from vovk_hello_world import UserRPC\n\nresponse = UserRPC.update_user(\n body={\n # -----\n # User data object\n # -----\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 # -----\n # Query parameters\n # -----\n # Notification type\n \"notify\": \"email\"\n },\n params={\n # -----\n # Path parameters\n # -----\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}"
|
|
309
303
|
},
|
|
310
304
|
{
|
|
311
305
|
"label": "Rust RPC",
|
|
312
306
|
"lang": "rust",
|
|
313
|
-
"source": "use
|
|
307
|
+
"source": "use vovk_hello_world::user_rpc;\nuse serde_json::{ \n from_value, \n json \n};\n\npub fn main() {\n let response = user_rpc::update_user(\n from_value(json!({\n // -----\n // User data object\n // -----\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 // -----\n // Query parameters\n // -----\n // Notification type\n \"notify\": \"email\"\n })).unwrap(), /* query */ \n from_value(json!({\n // -----\n // Path parameters\n // -----\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 // -----\n // Response object\n // -----\n // Success status\n success: true\n } \n */\n Err(e) => println!(\"error: {:?}\", e),\n }\n}"
|
|
314
308
|
}
|
|
315
309
|
],
|
|
316
310
|
"parameters": [{
|
|
@@ -400,17 +394,17 @@ var openapi_default = {
|
|
|
400
394
|
{
|
|
401
395
|
"label": "TypeScript RPC",
|
|
402
396
|
"lang": "typescript",
|
|
403
|
-
"source": "import { StreamRPC } from 'vovk-
|
|
397
|
+
"source": "import { StreamRPC } from 'vovk-hello-world';\n\nusing response = await StreamRPC.streamTokens();\n\nfor await (const item of response) {\n console.log(item); \n /*\n {\n // -----\n // Streamed token object\n // -----\n // Message from the token\n message: \"string\"\n }\n */\n}"
|
|
404
398
|
},
|
|
405
399
|
{
|
|
406
400
|
"label": "Python RPC",
|
|
407
401
|
"lang": "python",
|
|
408
|
-
"source": "from
|
|
402
|
+
"source": "from vovk_hello_world 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 # -----\n # Streamed token object\n # -----\n # Message from the token\n \"message\": \"string\"\n }"
|
|
409
403
|
},
|
|
410
404
|
{
|
|
411
405
|
"label": "Rust RPC",
|
|
412
406
|
"lang": "rust",
|
|
413
|
-
"source": "use
|
|
407
|
+
"source": "use vovk_hello_world::stream_rpc;\nuse serde_json::{ \n from_value, \n json \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 // -----\n // Streamed token object\n // -----\n // Message from the token\n message: \"string\"\n }\n */\n }\n },\n Err(e) => println!(\"Error initiating stream: {:?}\", e),\n }\n}"
|
|
414
408
|
}
|
|
415
409
|
],
|
|
416
410
|
"responses": { "200": {
|
|
@@ -436,17 +430,17 @@ var openapi_default = {
|
|
|
436
430
|
{
|
|
437
431
|
"label": "TypeScript RPC",
|
|
438
432
|
"lang": "typescript",
|
|
439
|
-
"source": "import { OpenApiRPC } from 'vovk-
|
|
433
|
+
"source": "import { OpenApiRPC } from 'vovk-hello-world';\n\nconst response = await OpenApiRPC.getSpec();"
|
|
440
434
|
},
|
|
441
435
|
{
|
|
442
436
|
"label": "Python RPC",
|
|
443
437
|
"lang": "python",
|
|
444
|
-
"source": "from
|
|
438
|
+
"source": "from vovk_hello_world import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
|
|
445
439
|
},
|
|
446
440
|
{
|
|
447
441
|
"label": "Rust RPC",
|
|
448
442
|
"lang": "rust",
|
|
449
|
-
"source": "use
|
|
443
|
+
"source": "use vovk_hello_world::open_api_rpc;\nuse serde_json::{ \n from_value, \n json \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}"
|
|
450
444
|
}
|
|
451
445
|
]
|
|
452
446
|
} }
|
package/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vovk0 from "vovk";
|
|
2
2
|
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
3
3
|
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
|
+
import * as openapi3_ts_oas310 from "openapi3-ts/oas31";
|
|
6
7
|
|
|
7
8
|
//#region tmp_prebundle/schema.d.ts
|
|
8
9
|
declare const schema: {
|
|
@@ -170,24 +171,6 @@ declare const schema: {
|
|
|
170
171
|
$schema: string;
|
|
171
172
|
config: {
|
|
172
173
|
libs: {};
|
|
173
|
-
outputConfig: {
|
|
174
|
-
imports: {
|
|
175
|
-
validateOnClient: string;
|
|
176
|
-
};
|
|
177
|
-
openAPIObject: {
|
|
178
|
-
info: {
|
|
179
|
-
title: string;
|
|
180
|
-
description: string;
|
|
181
|
-
license: {
|
|
182
|
-
name: string;
|
|
183
|
-
url: string;
|
|
184
|
-
};
|
|
185
|
-
version: string;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
origin: string;
|
|
189
|
-
segments: {};
|
|
190
|
-
};
|
|
191
174
|
$schema: string;
|
|
192
175
|
};
|
|
193
176
|
};
|
|
@@ -195,24 +178,33 @@ declare const schema: {
|
|
|
195
178
|
//#endregion
|
|
196
179
|
//#region tmp_prebundle/openapi.d.ts
|
|
197
180
|
declare let openapi: string;
|
|
198
|
-
declare
|
|
181
|
+
declare namespace info {
|
|
182
|
+
let title: string;
|
|
183
|
+
let version: string;
|
|
184
|
+
let description: string;
|
|
185
|
+
namespace license {
|
|
186
|
+
let name: string;
|
|
187
|
+
let url: string;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
199
190
|
declare namespace components {
|
|
200
191
|
namespace schemas {
|
|
201
192
|
namespace HttpStatus {
|
|
202
193
|
export let type: string;
|
|
203
|
-
|
|
194
|
+
let description_1: string;
|
|
195
|
+
export { description_1 as description };
|
|
204
196
|
let _enum: number[];
|
|
205
197
|
export { _enum as enum };
|
|
206
198
|
}
|
|
207
199
|
namespace VovkErrorResponse {
|
|
208
200
|
let type_1: string;
|
|
209
201
|
export { type_1 as type };
|
|
210
|
-
let
|
|
211
|
-
export {
|
|
202
|
+
let description_2: string;
|
|
203
|
+
export { description_2 as description };
|
|
212
204
|
export namespace properties {
|
|
213
205
|
namespace cause {
|
|
214
|
-
let
|
|
215
|
-
export {
|
|
206
|
+
let description_3: string;
|
|
207
|
+
export { description_3 as description };
|
|
216
208
|
}
|
|
217
209
|
namespace statusCode {
|
|
218
210
|
let $ref: string;
|
|
@@ -220,16 +212,16 @@ declare namespace components {
|
|
|
220
212
|
namespace message {
|
|
221
213
|
let type_2: string;
|
|
222
214
|
export { type_2 as type };
|
|
223
|
-
let
|
|
224
|
-
export {
|
|
215
|
+
let description_4: string;
|
|
216
|
+
export { description_4 as description };
|
|
225
217
|
}
|
|
226
218
|
namespace isError {
|
|
227
219
|
let type_3: string;
|
|
228
220
|
export { type_3 as type };
|
|
229
221
|
let _const: boolean;
|
|
230
222
|
export { _const as const };
|
|
231
|
-
let
|
|
232
|
-
export {
|
|
223
|
+
let description_5: string;
|
|
224
|
+
export { description_5 as description };
|
|
233
225
|
}
|
|
234
226
|
}
|
|
235
227
|
export let required: string[];
|
|
@@ -392,7 +384,7 @@ declare namespace __json_default_export {
|
|
|
392
384
|
//#endregion
|
|
393
385
|
//#region tmp_prebundle/index.d.ts
|
|
394
386
|
declare const UserRPC: {
|
|
395
|
-
updateUser: vovk_mjs_client_types0.ClientMethod<((req:
|
|
387
|
+
updateUser: vovk_mjs_client_types0.ClientMethod<((req: vovk0.VovkRequest<{
|
|
396
388
|
email: string;
|
|
397
389
|
profile: {
|
|
398
390
|
name: string;
|
|
@@ -431,8 +423,8 @@ declare const UserRPC: {
|
|
|
431
423
|
};
|
|
432
424
|
isRPC?: boolean;
|
|
433
425
|
} & {
|
|
434
|
-
schema: Omit<
|
|
435
|
-
wrapper?: (req:
|
|
426
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
427
|
+
wrapper?: (req: vovk0.VovkRequest<any, any, any>, params: {
|
|
436
428
|
id: string;
|
|
437
429
|
}) => Promise<{
|
|
438
430
|
success: true;
|
|
@@ -518,8 +510,8 @@ declare const UserRPC: {
|
|
|
518
510
|
}, {
|
|
519
511
|
apiRoot?: string;
|
|
520
512
|
disableClientValidation?: boolean;
|
|
521
|
-
validateOnClient?:
|
|
522
|
-
validateOnClient:
|
|
513
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
514
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
523
515
|
}> | undefined;
|
|
524
516
|
interpretAs?: string;
|
|
525
517
|
init?: RequestInit;
|
|
@@ -541,8 +533,8 @@ declare const StreamRPC: {
|
|
|
541
533
|
};
|
|
542
534
|
isRPC?: boolean;
|
|
543
535
|
} & {
|
|
544
|
-
schema: Omit<
|
|
545
|
-
wrapper?: (req:
|
|
536
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
537
|
+
wrapper?: (req: vovk0.VovkRequest<any, any, any>, params: undefined) => AsyncGenerator<{
|
|
546
538
|
message: string;
|
|
547
539
|
}, void, unknown>;
|
|
548
540
|
} & {
|
|
@@ -592,15 +584,15 @@ declare const StreamRPC: {
|
|
|
592
584
|
}, {
|
|
593
585
|
apiRoot?: string;
|
|
594
586
|
disableClientValidation?: boolean;
|
|
595
|
-
validateOnClient?:
|
|
596
|
-
validateOnClient:
|
|
587
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
588
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
597
589
|
}> | undefined;
|
|
598
590
|
interpretAs?: string;
|
|
599
591
|
init?: RequestInit;
|
|
600
592
|
}, unknown>;
|
|
601
593
|
};
|
|
602
594
|
declare const OpenApiRPC: {
|
|
603
|
-
getSpec: () =>
|
|
595
|
+
getSpec: () => openapi3_ts_oas310.OpenAPIObject;
|
|
604
596
|
};
|
|
605
597
|
//#endregion
|
|
606
598
|
export { OpenApiRPC, StreamRPC, UserRPC, __json_default_export as openapi, schema };
|
package/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vovk0 from "vovk";
|
|
2
2
|
import * as _standard_schema_spec0 from "@standard-schema/spec";
|
|
3
3
|
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
|
+
import * as openapi3_ts_oas310 from "openapi3-ts/oas31";
|
|
6
7
|
|
|
7
8
|
//#region tmp_prebundle/schema.d.ts
|
|
8
9
|
declare const schema: {
|
|
@@ -170,24 +171,6 @@ declare const schema: {
|
|
|
170
171
|
$schema: string;
|
|
171
172
|
config: {
|
|
172
173
|
libs: {};
|
|
173
|
-
outputConfig: {
|
|
174
|
-
imports: {
|
|
175
|
-
validateOnClient: string;
|
|
176
|
-
};
|
|
177
|
-
openAPIObject: {
|
|
178
|
-
info: {
|
|
179
|
-
title: string;
|
|
180
|
-
description: string;
|
|
181
|
-
license: {
|
|
182
|
-
name: string;
|
|
183
|
-
url: string;
|
|
184
|
-
};
|
|
185
|
-
version: string;
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
origin: string;
|
|
189
|
-
segments: {};
|
|
190
|
-
};
|
|
191
174
|
$schema: string;
|
|
192
175
|
};
|
|
193
176
|
};
|
|
@@ -195,24 +178,33 @@ declare const schema: {
|
|
|
195
178
|
//#endregion
|
|
196
179
|
//#region tmp_prebundle/openapi.d.ts
|
|
197
180
|
declare let openapi: string;
|
|
198
|
-
declare
|
|
181
|
+
declare namespace info {
|
|
182
|
+
let title: string;
|
|
183
|
+
let version: string;
|
|
184
|
+
let description: string;
|
|
185
|
+
namespace license {
|
|
186
|
+
let name: string;
|
|
187
|
+
let url: string;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
199
190
|
declare namespace components {
|
|
200
191
|
namespace schemas {
|
|
201
192
|
namespace HttpStatus {
|
|
202
193
|
export let type: string;
|
|
203
|
-
|
|
194
|
+
let description_1: string;
|
|
195
|
+
export { description_1 as description };
|
|
204
196
|
let _enum: number[];
|
|
205
197
|
export { _enum as enum };
|
|
206
198
|
}
|
|
207
199
|
namespace VovkErrorResponse {
|
|
208
200
|
let type_1: string;
|
|
209
201
|
export { type_1 as type };
|
|
210
|
-
let
|
|
211
|
-
export {
|
|
202
|
+
let description_2: string;
|
|
203
|
+
export { description_2 as description };
|
|
212
204
|
export namespace properties {
|
|
213
205
|
namespace cause {
|
|
214
|
-
let
|
|
215
|
-
export {
|
|
206
|
+
let description_3: string;
|
|
207
|
+
export { description_3 as description };
|
|
216
208
|
}
|
|
217
209
|
namespace statusCode {
|
|
218
210
|
let $ref: string;
|
|
@@ -220,16 +212,16 @@ declare namespace components {
|
|
|
220
212
|
namespace message {
|
|
221
213
|
let type_2: string;
|
|
222
214
|
export { type_2 as type };
|
|
223
|
-
let
|
|
224
|
-
export {
|
|
215
|
+
let description_4: string;
|
|
216
|
+
export { description_4 as description };
|
|
225
217
|
}
|
|
226
218
|
namespace isError {
|
|
227
219
|
let type_3: string;
|
|
228
220
|
export { type_3 as type };
|
|
229
221
|
let _const: boolean;
|
|
230
222
|
export { _const as const };
|
|
231
|
-
let
|
|
232
|
-
export {
|
|
223
|
+
let description_5: string;
|
|
224
|
+
export { description_5 as description };
|
|
233
225
|
}
|
|
234
226
|
}
|
|
235
227
|
export let required: string[];
|
|
@@ -392,7 +384,7 @@ declare namespace __json_default_export {
|
|
|
392
384
|
//#endregion
|
|
393
385
|
//#region tmp_prebundle/index.d.ts
|
|
394
386
|
declare const UserRPC: {
|
|
395
|
-
updateUser: vovk_mjs_client_types0.ClientMethod<((req:
|
|
387
|
+
updateUser: vovk_mjs_client_types0.ClientMethod<((req: vovk0.VovkRequest<{
|
|
396
388
|
email: string;
|
|
397
389
|
profile: {
|
|
398
390
|
name: string;
|
|
@@ -431,8 +423,8 @@ declare const UserRPC: {
|
|
|
431
423
|
};
|
|
432
424
|
isRPC?: boolean;
|
|
433
425
|
} & {
|
|
434
|
-
schema: Omit<
|
|
435
|
-
wrapper?: (req:
|
|
426
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
427
|
+
wrapper?: (req: vovk0.VovkRequest<any, any, any>, params: {
|
|
436
428
|
id: string;
|
|
437
429
|
}) => Promise<{
|
|
438
430
|
success: true;
|
|
@@ -518,8 +510,8 @@ declare const UserRPC: {
|
|
|
518
510
|
}, {
|
|
519
511
|
apiRoot?: string;
|
|
520
512
|
disableClientValidation?: boolean;
|
|
521
|
-
validateOnClient?:
|
|
522
|
-
validateOnClient:
|
|
513
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
514
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
523
515
|
}> | undefined;
|
|
524
516
|
interpretAs?: string;
|
|
525
517
|
init?: RequestInit;
|
|
@@ -541,8 +533,8 @@ declare const StreamRPC: {
|
|
|
541
533
|
};
|
|
542
534
|
isRPC?: boolean;
|
|
543
535
|
} & {
|
|
544
|
-
schema: Omit<
|
|
545
|
-
wrapper?: (req:
|
|
536
|
+
schema: Omit<vovk0.VovkHandlerSchema, "httpMethod" | "path"> & Partial<vovk0.VovkHandlerSchema>;
|
|
537
|
+
wrapper?: (req: vovk0.VovkRequest<any, any, any>, params: undefined) => AsyncGenerator<{
|
|
546
538
|
message: string;
|
|
547
539
|
}, void, unknown>;
|
|
548
540
|
} & {
|
|
@@ -592,15 +584,15 @@ declare const StreamRPC: {
|
|
|
592
584
|
}, {
|
|
593
585
|
apiRoot?: string;
|
|
594
586
|
disableClientValidation?: boolean;
|
|
595
|
-
validateOnClient?:
|
|
596
|
-
validateOnClient:
|
|
587
|
+
validateOnClient?: vovk0.VovkValidateOnClient<unknown> | Promise<{
|
|
588
|
+
validateOnClient: vovk0.VovkValidateOnClient<unknown>;
|
|
597
589
|
}> | undefined;
|
|
598
590
|
interpretAs?: string;
|
|
599
591
|
init?: RequestInit;
|
|
600
592
|
}, unknown>;
|
|
601
593
|
};
|
|
602
594
|
declare const OpenApiRPC: {
|
|
603
|
-
getSpec: () =>
|
|
595
|
+
getSpec: () => openapi3_ts_oas310.OpenAPIObject;
|
|
604
596
|
};
|
|
605
597
|
//#endregion
|
|
606
598
|
export { OpenApiRPC, StreamRPC, UserRPC, __json_default_export as openapi, schema };
|
package/index.mjs
CHANGED
|
@@ -154,20 +154,6 @@ var _meta_default = {
|
|
|
154
154
|
$schema: "https://vovk.dev/api/schema/v3/meta.json",
|
|
155
155
|
config: {
|
|
156
156
|
"libs": {},
|
|
157
|
-
"outputConfig": {
|
|
158
|
-
"imports": { "validateOnClient": "vovk-ajv" },
|
|
159
|
-
"openAPIObject": { "info": {
|
|
160
|
-
"title": "\"Hello World\" app API",
|
|
161
|
-
"description": "API for \"Hello World\" app hosted at https://hello-world.vovk.dev/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
162
|
-
"license": {
|
|
163
|
-
"name": "MIT",
|
|
164
|
-
"url": "https://opensource.org/licenses/MIT"
|
|
165
|
-
},
|
|
166
|
-
"version": "1.0.0"
|
|
167
|
-
} },
|
|
168
|
-
"origin": "",
|
|
169
|
-
"segments": {}
|
|
170
|
-
},
|
|
171
157
|
"$schema": "https://vovk.dev/api/schema/v3/config.json"
|
|
172
158
|
}
|
|
173
159
|
};
|
|
@@ -188,7 +174,15 @@ const schema = {
|
|
|
188
174
|
//#region tmp_prebundle/openapi.json
|
|
189
175
|
var openapi_default = {
|
|
190
176
|
openapi: "3.1.0",
|
|
191
|
-
info: {
|
|
177
|
+
info: {
|
|
178
|
+
"title": "\"Hello World\" app API",
|
|
179
|
+
"version": "1.0.0",
|
|
180
|
+
"description": "API for \"Hello World\" app hosted at https://hello-world.vovk.dev/. Source code is available on Github https://github.com/finom/vovk-hello-world.",
|
|
181
|
+
"license": {
|
|
182
|
+
"name": "MIT",
|
|
183
|
+
"url": "https://opensource.org/licenses/MIT"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
192
186
|
components: { "schemas": {
|
|
193
187
|
"HttpStatus": {
|
|
194
188
|
"type": "integer",
|
|
@@ -276,17 +270,17 @@ var openapi_default = {
|
|
|
276
270
|
{
|
|
277
271
|
"label": "TypeScript RPC",
|
|
278
272
|
"lang": "typescript",
|
|
279
|
-
"source": "import { UserRPC } from 'vovk-
|
|
273
|
+
"source": "import { UserRPC } from 'vovk-hello-world';\n\nconst response = await UserRPC.updateUser({\n body: {\n // -----\n // User data object\n // -----\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 // -----\n // Query parameters\n // -----\n // Notification type\n notify: \"email\"\n },\n params: {\n // -----\n // Path parameters\n // -----\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*/"
|
|
280
274
|
},
|
|
281
275
|
{
|
|
282
276
|
"label": "Python RPC",
|
|
283
277
|
"lang": "python",
|
|
284
|
-
"source": "from
|
|
278
|
+
"source": "from vovk_hello_world import UserRPC\n\nresponse = UserRPC.update_user(\n body={\n # -----\n # User data object\n # -----\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 # -----\n # Query parameters\n # -----\n # Notification type\n \"notify\": \"email\"\n },\n params={\n # -----\n # Path parameters\n # -----\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}"
|
|
285
279
|
},
|
|
286
280
|
{
|
|
287
281
|
"label": "Rust RPC",
|
|
288
282
|
"lang": "rust",
|
|
289
|
-
"source": "use
|
|
283
|
+
"source": "use vovk_hello_world::user_rpc;\nuse serde_json::{ \n from_value, \n json \n};\n\npub fn main() {\n let response = user_rpc::update_user(\n from_value(json!({\n // -----\n // User data object\n // -----\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 // -----\n // Query parameters\n // -----\n // Notification type\n \"notify\": \"email\"\n })).unwrap(), /* query */ \n from_value(json!({\n // -----\n // Path parameters\n // -----\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 // -----\n // Response object\n // -----\n // Success status\n success: true\n } \n */\n Err(e) => println!(\"error: {:?}\", e),\n }\n}"
|
|
290
284
|
}
|
|
291
285
|
],
|
|
292
286
|
"parameters": [{
|
|
@@ -376,17 +370,17 @@ var openapi_default = {
|
|
|
376
370
|
{
|
|
377
371
|
"label": "TypeScript RPC",
|
|
378
372
|
"lang": "typescript",
|
|
379
|
-
"source": "import { StreamRPC } from 'vovk-
|
|
373
|
+
"source": "import { StreamRPC } from 'vovk-hello-world';\n\nusing response = await StreamRPC.streamTokens();\n\nfor await (const item of response) {\n console.log(item); \n /*\n {\n // -----\n // Streamed token object\n // -----\n // Message from the token\n message: \"string\"\n }\n */\n}"
|
|
380
374
|
},
|
|
381
375
|
{
|
|
382
376
|
"label": "Python RPC",
|
|
383
377
|
"lang": "python",
|
|
384
|
-
"source": "from
|
|
378
|
+
"source": "from vovk_hello_world 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 # -----\n # Streamed token object\n # -----\n # Message from the token\n \"message\": \"string\"\n }"
|
|
385
379
|
},
|
|
386
380
|
{
|
|
387
381
|
"label": "Rust RPC",
|
|
388
382
|
"lang": "rust",
|
|
389
|
-
"source": "use
|
|
383
|
+
"source": "use vovk_hello_world::stream_rpc;\nuse serde_json::{ \n from_value, \n json \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 // -----\n // Streamed token object\n // -----\n // Message from the token\n message: \"string\"\n }\n */\n }\n },\n Err(e) => println!(\"Error initiating stream: {:?}\", e),\n }\n}"
|
|
390
384
|
}
|
|
391
385
|
],
|
|
392
386
|
"responses": { "200": {
|
|
@@ -412,17 +406,17 @@ var openapi_default = {
|
|
|
412
406
|
{
|
|
413
407
|
"label": "TypeScript RPC",
|
|
414
408
|
"lang": "typescript",
|
|
415
|
-
"source": "import { OpenApiRPC } from 'vovk-
|
|
409
|
+
"source": "import { OpenApiRPC } from 'vovk-hello-world';\n\nconst response = await OpenApiRPC.getSpec();"
|
|
416
410
|
},
|
|
417
411
|
{
|
|
418
412
|
"label": "Python RPC",
|
|
419
413
|
"lang": "python",
|
|
420
|
-
"source": "from
|
|
414
|
+
"source": "from vovk_hello_world import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
|
|
421
415
|
},
|
|
422
416
|
{
|
|
423
417
|
"label": "Rust RPC",
|
|
424
418
|
"lang": "rust",
|
|
425
|
-
"source": "use
|
|
419
|
+
"source": "use vovk_hello_world::open_api_rpc;\nuse serde_json::{ \n from_value, \n json \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}"
|
|
426
420
|
}
|
|
427
421
|
]
|
|
428
422
|
} }
|
package/package.json
CHANGED