vovk-hello-world 0.0.59 → 0.0.61

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 CHANGED
@@ -1,7 +1,7 @@
1
- <!-- Generated by vovk-cli v0.0.1-draft.397 at 2025-11-07T07:44:09.125Z -->
1
+ <!-- Generated by vovk-cli v0.0.1-draft.399 at 2025-11-07T10:05:19.176Z -->
2
2
 
3
3
 
4
- # vovk-hello-world v0.0.59 [![TypeScript](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555)](https://www.typescriptlang.org/) [![Vovk.ts](https://badgen.net/badge/Built%20with/Vovk.ts/333333?icon=https://vovk.dev/icon-white.svg)](https://vovk.dev)
4
+ # vovk-hello-world v0.0.61 [![TypeScript](https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555)](https://www.typescriptlang.org/) [![Vovk.ts](https://badgen.net/badge/Built%20with/Vovk.ts/333333?icon=https://vovk.dev/icon-white.svg)](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
 
@@ -22,7 +22,7 @@ npm install vovk-hello-world
22
22
  Update user by ID
23
23
 
24
24
 
25
- `POST http://localhost:3000/api/users/{id}`
25
+ `POST https://hello-world.vovk.dev/api/users/{id}`
26
26
 
27
27
  ```ts
28
28
  import { UserRPC } from 'vovk-hello-world';
@@ -84,7 +84,7 @@ console.log(response);
84
84
  Stream tokens to the client
85
85
 
86
86
 
87
- `GET http://localhost:3000/api/streams/tokens`
87
+ `GET https://hello-world.vovk.dev/api/streams/tokens`
88
88
 
89
89
  ```ts
90
90
  import { StreamRPC } from 'vovk-hello-world';
@@ -116,7 +116,7 @@ for await (const item of response) {
116
116
  Get the OpenAPI spec for the "Hello World" app API
117
117
 
118
118
 
119
- `GET http://localhost:3000/api/static/openapi.json`
119
+ `GET https://hello-world.vovk.dev/api/static/openapi.json`
120
120
 
121
121
  ```ts
122
122
  import { OpenApiRPC } from 'vovk-hello-world';
package/index.cjs CHANGED
@@ -192,311 +192,23 @@ const schema = {
192
192
  meta: _meta_default
193
193
  };
194
194
 
195
- //#endregion
196
- //#region tmp_prebundle/openapi.json
197
- var openapi_default = {
198
- openapi: "3.1.0",
199
- info: {
200
- "title": "\"Hello World\" app API",
201
- "version": "1.0.0",
202
- "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.",
203
- "license": {
204
- "name": "MIT",
205
- "url": "https://opensource.org/licenses/MIT"
206
- }
207
- },
208
- servers: [{
209
- "url": "https://hello-world.vovk.dev",
210
- "description": "Production"
211
- }, {
212
- "url": "http://localhost:3000",
213
- "description": "Localhost"
214
- }],
215
- components: { "schemas": {
216
- "HttpStatus": {
217
- "type": "integer",
218
- "description": "HTTP status code",
219
- "enum": [
220
- 100,
221
- 101,
222
- 102,
223
- 103,
224
- 200,
225
- 201,
226
- 202,
227
- 203,
228
- 204,
229
- 205,
230
- 206,
231
- 300,
232
- 301,
233
- 302,
234
- 303,
235
- 304,
236
- 307,
237
- 308,
238
- 400,
239
- 401,
240
- 402,
241
- 403,
242
- 404,
243
- 405,
244
- 406,
245
- 407,
246
- 408,
247
- 409,
248
- 410,
249
- 411,
250
- 412,
251
- 413,
252
- 414,
253
- 415,
254
- 416,
255
- 417,
256
- 418,
257
- 421,
258
- 422,
259
- 424,
260
- 428,
261
- 429,
262
- 500,
263
- 501,
264
- 502,
265
- 503,
266
- 504,
267
- 505
268
- ]
269
- },
270
- "VovkErrorResponse": {
271
- "type": "object",
272
- "description": "Vovk error response",
273
- "properties": {
274
- "cause": { "description": "Error cause of any shape" },
275
- "statusCode": { "$ref": "#/components/schemas/HttpStatus" },
276
- "message": {
277
- "type": "string",
278
- "description": "Error message"
279
- },
280
- "isError": {
281
- "type": "boolean",
282
- "const": true,
283
- "description": "Indicates that this object represents an error"
284
- }
285
- },
286
- "required": [
287
- "statusCode",
288
- "message",
289
- "isError"
290
- ],
291
- "additionalProperties": false
292
- }
293
- } },
294
- paths: {
295
- "/api/users/{id}": { "post": {
296
- "summary": "Update user",
297
- "description": "Update user by ID",
298
- "x-codeSamples": [
299
- {
300
- "label": "TypeScript RPC",
301
- "lang": "typescript",
302
- "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 // User ID\n id: \"00000000-0000-0000-0000-000000000000\",\n // Notification type\n notify: \"email\"\n}\n*/"
303
- },
304
- {
305
- "label": "Python RPC",
306
- "lang": "python",
307
- "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 # User ID\n \"id\": \"00000000-0000-0000-0000-000000000000\",\n # Notification type\n \"notify\": \"email\"\n}"
308
- },
309
- {
310
- "label": "Rust RPC",
311
- "lang": "rust",
312
- "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 // User ID\n id: \"00000000-0000-0000-0000-000000000000\",\n // Notification type\n notify: \"email\"\n } \n */\n Err(e) => println!(\"error: {:?}\", e),\n }\n}"
313
- }
314
- ],
315
- "parameters": [{
316
- "name": "notify",
317
- "in": "query",
318
- "required": true,
319
- "schema": {
320
- "description": "Notification type",
321
- "type": "string",
322
- "enum": [
323
- "email",
324
- "push",
325
- "none"
326
- ]
327
- }
328
- }, {
329
- "name": "id",
330
- "in": "path",
331
- "required": true,
332
- "schema": {
333
- "description": "User ID",
334
- "examples": ["123e4567-e89b-12d3-a456-426614174000"],
335
- "type": "string",
336
- "format": "uuid",
337
- "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)$"
338
- }
339
- }],
340
- "responses": { "200": {
341
- "description": "Response object",
342
- "content": { "application/json": { "schema": {
343
- "$schema": "https://json-schema.org/draft/2020-12/schema",
344
- "description": "Response object",
345
- "type": "object",
346
- "properties": {
347
- "success": {
348
- "description": "Success status",
349
- "type": "boolean"
350
- },
351
- "id": {
352
- "description": "User ID",
353
- "type": "string",
354
- "format": "uuid",
355
- "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)$"
356
- },
357
- "notify": {
358
- "description": "Notification type",
359
- "type": "string",
360
- "enum": [
361
- "email",
362
- "push",
363
- "none"
364
- ]
365
- }
366
- },
367
- "required": [
368
- "success",
369
- "id",
370
- "notify"
371
- ],
372
- "additionalProperties": false
373
- } } }
374
- } },
375
- "requestBody": {
376
- "description": "User data object",
377
- "required": true,
378
- "content": { "application/json": { "schema": {
379
- "$schema": "https://json-schema.org/draft/2020-12/schema",
380
- "description": "User data object",
381
- "type": "object",
382
- "properties": {
383
- "email": {
384
- "description": "User email",
385
- "examples": ["john@example.com", "jane@example.com"],
386
- "type": "string",
387
- "format": "email",
388
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
389
- },
390
- "profile": {
391
- "description": "User profile object",
392
- "type": "object",
393
- "properties": {
394
- "name": {
395
- "description": "User full name",
396
- "examples": ["John Doe", "Jane Smith"],
397
- "type": "string",
398
- "minLength": 2
399
- },
400
- "age": {
401
- "description": "User age",
402
- "examples": [25, 30],
403
- "type": "integer",
404
- "minimum": 16,
405
- "maximum": 120
406
- }
407
- },
408
- "required": ["name", "age"],
409
- "additionalProperties": false
410
- }
411
- },
412
- "required": ["email", "profile"],
413
- "additionalProperties": false
414
- } } }
415
- }
416
- } },
417
- "/api/streams/tokens": { "get": {
418
- "summary": "Stream tokens",
419
- "description": "Stream tokens to the client",
420
- "x-codeSamples": [
421
- {
422
- "label": "TypeScript RPC",
423
- "lang": "typescript",
424
- "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}"
425
- },
426
- {
427
- "label": "Python RPC",
428
- "lang": "python",
429
- "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 }"
430
- },
431
- {
432
- "label": "Rust RPC",
433
- "lang": "rust",
434
- "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}"
435
- }
436
- ],
437
- "responses": { "200": {
438
- "description": "Streamed token object",
439
- "content": { "application/jsonl": { "schema": {
440
- "$schema": "https://json-schema.org/draft/2020-12/schema",
441
- "description": "Streamed token object",
442
- "type": "object",
443
- "properties": { "message": {
444
- "description": "Message from the token",
445
- "type": "string"
446
- } },
447
- "required": ["message"],
448
- "additionalProperties": false,
449
- "examples": ["{\"message\":\"string\"}\n{\"message\":\"string\"}\n{\"message\":\"string\"}"]
450
- } } }
451
- } }
452
- } },
453
- "/api/static/openapi.json": { "get": {
454
- "summary": "OpenAPI spec",
455
- "description": "Get the OpenAPI spec for the \"Hello World\" app API",
456
- "x-codeSamples": [
457
- {
458
- "label": "TypeScript RPC",
459
- "lang": "typescript",
460
- "source": "import { OpenApiRPC } from 'vovk-hello-world';\n\nconst response = await OpenApiRPC.getSpec();"
461
- },
462
- {
463
- "label": "Python RPC",
464
- "lang": "python",
465
- "source": "from vovk_hello_world import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
466
- },
467
- {
468
- "label": "Rust RPC",
469
- "lang": "rust",
470
- "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}"
471
- }
472
- ]
473
- } }
474
- }
475
- };
476
-
477
195
  //#endregion
478
196
  //#region tmp_prebundle/index.ts
479
197
  const UserRPC = (0, vovk.createRPC)(schema, "", "UserRPC", import("vovk"), {
480
198
  validateOnClient: import("vovk-ajv"),
481
- apiRoot: "http://localhost:3000/api"
199
+ apiRoot: "https://hello-world.vovk.dev/api"
482
200
  });
483
201
  const StreamRPC = (0, vovk.createRPC)(schema, "", "StreamRPC", import("vovk"), {
484
202
  validateOnClient: import("vovk-ajv"),
485
- apiRoot: "http://localhost:3000/api"
203
+ apiRoot: "https://hello-world.vovk.dev/api"
486
204
  });
487
205
  const OpenApiRPC = (0, vovk.createRPC)(schema, "static", "OpenApiRPC", import("vovk"), {
488
206
  validateOnClient: import("vovk-ajv"),
489
- apiRoot: "http://localhost:3000/api"
207
+ apiRoot: "https://hello-world.vovk.dev/api"
490
208
  });
491
209
 
492
210
  //#endregion
493
211
  exports.OpenApiRPC = OpenApiRPC;
494
212
  exports.StreamRPC = StreamRPC;
495
213
  exports.UserRPC = UserRPC;
496
- Object.defineProperty(exports, 'openapi', {
497
- enumerable: true,
498
- get: function () {
499
- return openapi_default;
500
- }
501
- });
502
214
  exports.schema = schema;
package/index.d.cts CHANGED
@@ -188,228 +188,6 @@ declare const schema: {
188
188
  };
189
189
  };
190
190
  //#endregion
191
- //#region tmp_prebundle/openapi.d.ts
192
- declare let openapi: string;
193
- declare namespace info {
194
- let title: string;
195
- let version: string;
196
- let description: string;
197
- namespace license {
198
- let name: string;
199
- let url: string;
200
- }
201
- }
202
- declare let servers: {
203
- url: string;
204
- description: string;
205
- }[];
206
- declare namespace components {
207
- namespace schemas {
208
- namespace HttpStatus {
209
- export let type: string;
210
- let description_1: string;
211
- export { description_1 as description };
212
- let _enum: number[];
213
- export { _enum as enum };
214
- }
215
- namespace VovkErrorResponse {
216
- let type_1: string;
217
- export { type_1 as type };
218
- let description_2: string;
219
- export { description_2 as description };
220
- export namespace properties {
221
- namespace cause {
222
- let description_3: string;
223
- export { description_3 as description };
224
- }
225
- namespace statusCode {
226
- let $ref: string;
227
- }
228
- namespace message {
229
- let type_2: string;
230
- export { type_2 as type };
231
- let description_4: string;
232
- export { description_4 as description };
233
- }
234
- namespace isError {
235
- let type_3: string;
236
- export { type_3 as type };
237
- let _const: boolean;
238
- export { _const as const };
239
- let description_5: string;
240
- export { description_5 as description };
241
- }
242
- }
243
- export let required: string[];
244
- export let additionalProperties: boolean;
245
- }
246
- }
247
- }
248
- declare let paths: {
249
- "/api/users/{id}": {
250
- post: {
251
- summary: string;
252
- description: string;
253
- "x-codeSamples": {
254
- label: string;
255
- lang: string;
256
- source: string;
257
- }[];
258
- parameters: ({
259
- name: string;
260
- in: string;
261
- required: boolean;
262
- schema: {
263
- description: string;
264
- type: string;
265
- enum: string[];
266
- examples?: undefined;
267
- format?: undefined;
268
- pattern?: undefined;
269
- };
270
- } | {
271
- name: string;
272
- in: string;
273
- required: boolean;
274
- schema: {
275
- description: string;
276
- examples: string[];
277
- type: string;
278
- format: string;
279
- pattern: string;
280
- enum?: undefined;
281
- };
282
- })[];
283
- responses: {
284
- "200": {
285
- description: string;
286
- content: {
287
- "application/json": {
288
- schema: {
289
- $schema: string;
290
- description: string;
291
- type: string;
292
- properties: {
293
- success: {
294
- description: string;
295
- type: string;
296
- };
297
- id: {
298
- description: string;
299
- type: string;
300
- format: string;
301
- pattern: string;
302
- };
303
- notify: {
304
- description: string;
305
- type: string;
306
- enum: string[];
307
- };
308
- };
309
- required: string[];
310
- additionalProperties: boolean;
311
- };
312
- };
313
- };
314
- };
315
- };
316
- requestBody: {
317
- description: string;
318
- required: boolean;
319
- content: {
320
- "application/json": {
321
- schema: {
322
- $schema: string;
323
- description: string;
324
- type: string;
325
- properties: {
326
- email: {
327
- description: string;
328
- examples: string[];
329
- type: string;
330
- format: string;
331
- pattern: string;
332
- };
333
- profile: {
334
- description: string;
335
- type: string;
336
- properties: {
337
- name: {
338
- description: string;
339
- examples: string[];
340
- type: string;
341
- minLength: number;
342
- };
343
- age: {
344
- description: string;
345
- examples: number[];
346
- type: string;
347
- minimum: number;
348
- maximum: number;
349
- };
350
- };
351
- required: string[];
352
- additionalProperties: boolean;
353
- };
354
- };
355
- required: string[];
356
- additionalProperties: boolean;
357
- };
358
- };
359
- };
360
- };
361
- };
362
- };
363
- "/api/streams/tokens": {
364
- get: {
365
- summary: string;
366
- description: string;
367
- "x-codeSamples": {
368
- label: string;
369
- lang: string;
370
- source: string;
371
- }[];
372
- responses: {
373
- "200": {
374
- description: string;
375
- content: {
376
- "application/jsonl": {
377
- schema: {
378
- $schema: string;
379
- description: string;
380
- type: string;
381
- properties: {
382
- message: {
383
- description: string;
384
- type: string;
385
- };
386
- };
387
- required: string[];
388
- additionalProperties: boolean;
389
- examples: string[];
390
- };
391
- };
392
- };
393
- };
394
- };
395
- };
396
- };
397
- "/api/static/openapi.json": {
398
- get: {
399
- summary: string;
400
- description: string;
401
- "x-codeSamples": {
402
- label: string;
403
- lang: string;
404
- source: string;
405
- }[];
406
- };
407
- };
408
- };
409
- declare namespace __json_default_export {
410
- export { openapi, info, servers, components, paths };
411
- }
412
- //#endregion
413
191
  //#region tmp_prebundle/index.d.ts
414
192
  declare const UserRPC: {
415
193
  updateUser: vovk_mjs_client_types0.ClientMethod<((req: vovk0.VovkRequest<{
@@ -639,4 +417,4 @@ declare const OpenApiRPC: {
639
417
  getSpec: () => openapi3_ts_oas310.OpenAPIObject;
640
418
  };
641
419
  //#endregion
642
- export { OpenApiRPC, StreamRPC, UserRPC, __json_default_export as openapi, schema };
420
+ export { OpenApiRPC, StreamRPC, UserRPC, schema };
package/index.d.mts CHANGED
@@ -188,228 +188,6 @@ declare const schema: {
188
188
  };
189
189
  };
190
190
  //#endregion
191
- //#region tmp_prebundle/openapi.d.ts
192
- declare let openapi: string;
193
- declare namespace info {
194
- let title: string;
195
- let version: string;
196
- let description: string;
197
- namespace license {
198
- let name: string;
199
- let url: string;
200
- }
201
- }
202
- declare let servers: {
203
- url: string;
204
- description: string;
205
- }[];
206
- declare namespace components {
207
- namespace schemas {
208
- namespace HttpStatus {
209
- export let type: string;
210
- let description_1: string;
211
- export { description_1 as description };
212
- let _enum: number[];
213
- export { _enum as enum };
214
- }
215
- namespace VovkErrorResponse {
216
- let type_1: string;
217
- export { type_1 as type };
218
- let description_2: string;
219
- export { description_2 as description };
220
- export namespace properties {
221
- namespace cause {
222
- let description_3: string;
223
- export { description_3 as description };
224
- }
225
- namespace statusCode {
226
- let $ref: string;
227
- }
228
- namespace message {
229
- let type_2: string;
230
- export { type_2 as type };
231
- let description_4: string;
232
- export { description_4 as description };
233
- }
234
- namespace isError {
235
- let type_3: string;
236
- export { type_3 as type };
237
- let _const: boolean;
238
- export { _const as const };
239
- let description_5: string;
240
- export { description_5 as description };
241
- }
242
- }
243
- export let required: string[];
244
- export let additionalProperties: boolean;
245
- }
246
- }
247
- }
248
- declare let paths: {
249
- "/api/users/{id}": {
250
- post: {
251
- summary: string;
252
- description: string;
253
- "x-codeSamples": {
254
- label: string;
255
- lang: string;
256
- source: string;
257
- }[];
258
- parameters: ({
259
- name: string;
260
- in: string;
261
- required: boolean;
262
- schema: {
263
- description: string;
264
- type: string;
265
- enum: string[];
266
- examples?: undefined;
267
- format?: undefined;
268
- pattern?: undefined;
269
- };
270
- } | {
271
- name: string;
272
- in: string;
273
- required: boolean;
274
- schema: {
275
- description: string;
276
- examples: string[];
277
- type: string;
278
- format: string;
279
- pattern: string;
280
- enum?: undefined;
281
- };
282
- })[];
283
- responses: {
284
- "200": {
285
- description: string;
286
- content: {
287
- "application/json": {
288
- schema: {
289
- $schema: string;
290
- description: string;
291
- type: string;
292
- properties: {
293
- success: {
294
- description: string;
295
- type: string;
296
- };
297
- id: {
298
- description: string;
299
- type: string;
300
- format: string;
301
- pattern: string;
302
- };
303
- notify: {
304
- description: string;
305
- type: string;
306
- enum: string[];
307
- };
308
- };
309
- required: string[];
310
- additionalProperties: boolean;
311
- };
312
- };
313
- };
314
- };
315
- };
316
- requestBody: {
317
- description: string;
318
- required: boolean;
319
- content: {
320
- "application/json": {
321
- schema: {
322
- $schema: string;
323
- description: string;
324
- type: string;
325
- properties: {
326
- email: {
327
- description: string;
328
- examples: string[];
329
- type: string;
330
- format: string;
331
- pattern: string;
332
- };
333
- profile: {
334
- description: string;
335
- type: string;
336
- properties: {
337
- name: {
338
- description: string;
339
- examples: string[];
340
- type: string;
341
- minLength: number;
342
- };
343
- age: {
344
- description: string;
345
- examples: number[];
346
- type: string;
347
- minimum: number;
348
- maximum: number;
349
- };
350
- };
351
- required: string[];
352
- additionalProperties: boolean;
353
- };
354
- };
355
- required: string[];
356
- additionalProperties: boolean;
357
- };
358
- };
359
- };
360
- };
361
- };
362
- };
363
- "/api/streams/tokens": {
364
- get: {
365
- summary: string;
366
- description: string;
367
- "x-codeSamples": {
368
- label: string;
369
- lang: string;
370
- source: string;
371
- }[];
372
- responses: {
373
- "200": {
374
- description: string;
375
- content: {
376
- "application/jsonl": {
377
- schema: {
378
- $schema: string;
379
- description: string;
380
- type: string;
381
- properties: {
382
- message: {
383
- description: string;
384
- type: string;
385
- };
386
- };
387
- required: string[];
388
- additionalProperties: boolean;
389
- examples: string[];
390
- };
391
- };
392
- };
393
- };
394
- };
395
- };
396
- };
397
- "/api/static/openapi.json": {
398
- get: {
399
- summary: string;
400
- description: string;
401
- "x-codeSamples": {
402
- label: string;
403
- lang: string;
404
- source: string;
405
- }[];
406
- };
407
- };
408
- };
409
- declare namespace __json_default_export {
410
- export { openapi, info, servers, components, paths };
411
- }
412
- //#endregion
413
191
  //#region tmp_prebundle/index.d.ts
414
192
  declare const UserRPC: {
415
193
  updateUser: vovk_mjs_client_types0.ClientMethod<((req: vovk0.VovkRequest<{
@@ -639,4 +417,4 @@ declare const OpenApiRPC: {
639
417
  getSpec: () => openapi3_ts_oas310.OpenAPIObject;
640
418
  };
641
419
  //#endregion
642
- export { OpenApiRPC, StreamRPC, UserRPC, __json_default_export as openapi, schema };
420
+ export { OpenApiRPC, StreamRPC, UserRPC, schema };
package/index.mjs CHANGED
@@ -192,302 +192,20 @@ const schema = {
192
192
  meta: _meta_default
193
193
  };
194
194
 
195
- //#endregion
196
- //#region tmp_prebundle/openapi.json
197
- var openapi_default = {
198
- openapi: "3.1.0",
199
- info: {
200
- "title": "\"Hello World\" app API",
201
- "version": "1.0.0",
202
- "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.",
203
- "license": {
204
- "name": "MIT",
205
- "url": "https://opensource.org/licenses/MIT"
206
- }
207
- },
208
- servers: [{
209
- "url": "https://hello-world.vovk.dev",
210
- "description": "Production"
211
- }, {
212
- "url": "http://localhost:3000",
213
- "description": "Localhost"
214
- }],
215
- components: { "schemas": {
216
- "HttpStatus": {
217
- "type": "integer",
218
- "description": "HTTP status code",
219
- "enum": [
220
- 100,
221
- 101,
222
- 102,
223
- 103,
224
- 200,
225
- 201,
226
- 202,
227
- 203,
228
- 204,
229
- 205,
230
- 206,
231
- 300,
232
- 301,
233
- 302,
234
- 303,
235
- 304,
236
- 307,
237
- 308,
238
- 400,
239
- 401,
240
- 402,
241
- 403,
242
- 404,
243
- 405,
244
- 406,
245
- 407,
246
- 408,
247
- 409,
248
- 410,
249
- 411,
250
- 412,
251
- 413,
252
- 414,
253
- 415,
254
- 416,
255
- 417,
256
- 418,
257
- 421,
258
- 422,
259
- 424,
260
- 428,
261
- 429,
262
- 500,
263
- 501,
264
- 502,
265
- 503,
266
- 504,
267
- 505
268
- ]
269
- },
270
- "VovkErrorResponse": {
271
- "type": "object",
272
- "description": "Vovk error response",
273
- "properties": {
274
- "cause": { "description": "Error cause of any shape" },
275
- "statusCode": { "$ref": "#/components/schemas/HttpStatus" },
276
- "message": {
277
- "type": "string",
278
- "description": "Error message"
279
- },
280
- "isError": {
281
- "type": "boolean",
282
- "const": true,
283
- "description": "Indicates that this object represents an error"
284
- }
285
- },
286
- "required": [
287
- "statusCode",
288
- "message",
289
- "isError"
290
- ],
291
- "additionalProperties": false
292
- }
293
- } },
294
- paths: {
295
- "/api/users/{id}": { "post": {
296
- "summary": "Update user",
297
- "description": "Update user by ID",
298
- "x-codeSamples": [
299
- {
300
- "label": "TypeScript RPC",
301
- "lang": "typescript",
302
- "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 // User ID\n id: \"00000000-0000-0000-0000-000000000000\",\n // Notification type\n notify: \"email\"\n}\n*/"
303
- },
304
- {
305
- "label": "Python RPC",
306
- "lang": "python",
307
- "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 # User ID\n \"id\": \"00000000-0000-0000-0000-000000000000\",\n # Notification type\n \"notify\": \"email\"\n}"
308
- },
309
- {
310
- "label": "Rust RPC",
311
- "lang": "rust",
312
- "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 // User ID\n id: \"00000000-0000-0000-0000-000000000000\",\n // Notification type\n notify: \"email\"\n } \n */\n Err(e) => println!(\"error: {:?}\", e),\n }\n}"
313
- }
314
- ],
315
- "parameters": [{
316
- "name": "notify",
317
- "in": "query",
318
- "required": true,
319
- "schema": {
320
- "description": "Notification type",
321
- "type": "string",
322
- "enum": [
323
- "email",
324
- "push",
325
- "none"
326
- ]
327
- }
328
- }, {
329
- "name": "id",
330
- "in": "path",
331
- "required": true,
332
- "schema": {
333
- "description": "User ID",
334
- "examples": ["123e4567-e89b-12d3-a456-426614174000"],
335
- "type": "string",
336
- "format": "uuid",
337
- "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)$"
338
- }
339
- }],
340
- "responses": { "200": {
341
- "description": "Response object",
342
- "content": { "application/json": { "schema": {
343
- "$schema": "https://json-schema.org/draft/2020-12/schema",
344
- "description": "Response object",
345
- "type": "object",
346
- "properties": {
347
- "success": {
348
- "description": "Success status",
349
- "type": "boolean"
350
- },
351
- "id": {
352
- "description": "User ID",
353
- "type": "string",
354
- "format": "uuid",
355
- "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)$"
356
- },
357
- "notify": {
358
- "description": "Notification type",
359
- "type": "string",
360
- "enum": [
361
- "email",
362
- "push",
363
- "none"
364
- ]
365
- }
366
- },
367
- "required": [
368
- "success",
369
- "id",
370
- "notify"
371
- ],
372
- "additionalProperties": false
373
- } } }
374
- } },
375
- "requestBody": {
376
- "description": "User data object",
377
- "required": true,
378
- "content": { "application/json": { "schema": {
379
- "$schema": "https://json-schema.org/draft/2020-12/schema",
380
- "description": "User data object",
381
- "type": "object",
382
- "properties": {
383
- "email": {
384
- "description": "User email",
385
- "examples": ["john@example.com", "jane@example.com"],
386
- "type": "string",
387
- "format": "email",
388
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
389
- },
390
- "profile": {
391
- "description": "User profile object",
392
- "type": "object",
393
- "properties": {
394
- "name": {
395
- "description": "User full name",
396
- "examples": ["John Doe", "Jane Smith"],
397
- "type": "string",
398
- "minLength": 2
399
- },
400
- "age": {
401
- "description": "User age",
402
- "examples": [25, 30],
403
- "type": "integer",
404
- "minimum": 16,
405
- "maximum": 120
406
- }
407
- },
408
- "required": ["name", "age"],
409
- "additionalProperties": false
410
- }
411
- },
412
- "required": ["email", "profile"],
413
- "additionalProperties": false
414
- } } }
415
- }
416
- } },
417
- "/api/streams/tokens": { "get": {
418
- "summary": "Stream tokens",
419
- "description": "Stream tokens to the client",
420
- "x-codeSamples": [
421
- {
422
- "label": "TypeScript RPC",
423
- "lang": "typescript",
424
- "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}"
425
- },
426
- {
427
- "label": "Python RPC",
428
- "lang": "python",
429
- "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 }"
430
- },
431
- {
432
- "label": "Rust RPC",
433
- "lang": "rust",
434
- "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}"
435
- }
436
- ],
437
- "responses": { "200": {
438
- "description": "Streamed token object",
439
- "content": { "application/jsonl": { "schema": {
440
- "$schema": "https://json-schema.org/draft/2020-12/schema",
441
- "description": "Streamed token object",
442
- "type": "object",
443
- "properties": { "message": {
444
- "description": "Message from the token",
445
- "type": "string"
446
- } },
447
- "required": ["message"],
448
- "additionalProperties": false,
449
- "examples": ["{\"message\":\"string\"}\n{\"message\":\"string\"}\n{\"message\":\"string\"}"]
450
- } } }
451
- } }
452
- } },
453
- "/api/static/openapi.json": { "get": {
454
- "summary": "OpenAPI spec",
455
- "description": "Get the OpenAPI spec for the \"Hello World\" app API",
456
- "x-codeSamples": [
457
- {
458
- "label": "TypeScript RPC",
459
- "lang": "typescript",
460
- "source": "import { OpenApiRPC } from 'vovk-hello-world';\n\nconst response = await OpenApiRPC.getSpec();"
461
- },
462
- {
463
- "label": "Python RPC",
464
- "lang": "python",
465
- "source": "from vovk_hello_world import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"
466
- },
467
- {
468
- "label": "Rust RPC",
469
- "lang": "rust",
470
- "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}"
471
- }
472
- ]
473
- } }
474
- }
475
- };
476
-
477
195
  //#endregion
478
196
  //#region tmp_prebundle/index.ts
479
197
  const UserRPC = createRPC(schema, "", "UserRPC", import("vovk"), {
480
198
  validateOnClient: import("vovk-ajv"),
481
- apiRoot: "http://localhost:3000/api"
199
+ apiRoot: "https://hello-world.vovk.dev/api"
482
200
  });
483
201
  const StreamRPC = createRPC(schema, "", "StreamRPC", import("vovk"), {
484
202
  validateOnClient: import("vovk-ajv"),
485
- apiRoot: "http://localhost:3000/api"
203
+ apiRoot: "https://hello-world.vovk.dev/api"
486
204
  });
487
205
  const OpenApiRPC = createRPC(schema, "static", "OpenApiRPC", import("vovk"), {
488
206
  validateOnClient: import("vovk-ajv"),
489
- apiRoot: "http://localhost:3000/api"
207
+ apiRoot: "https://hello-world.vovk.dev/api"
490
208
  });
491
209
 
492
210
  //#endregion
493
- export { OpenApiRPC, StreamRPC, UserRPC, openapi_default as openapi, schema };
211
+ export { OpenApiRPC, StreamRPC, UserRPC, schema };
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  }
11
11
  },
12
12
  "name": "vovk-hello-world",
13
- "version": "0.0.59",
13
+ "version": "0.0.61",
14
14
  "description": "A showcase for Next.js + Vovk.ts + Zod, demonstrating its capabilities with TypeScript, Rust, and Python RPC.",
15
15
  "license": "MIT"
16
16
  }