From 55f8f910fa04a84b16ef1b081c1be5d13df7c018 Mon Sep 17 00:00:00 2001 From: Lin Onetwo Date: Thu, 5 Jan 2023 14:53:39 +0800 Subject: [PATCH] feat: auto generate tauri ipc interfaces --- .../provider/tauri-ipc/ipc/types/blob.json | 61 +++++++++++++++++++ .../src/provider/tauri-ipc/ipc/types/blob.ts | 25 ++++++++ .../tauri-ipc/ipc/types/document.json | 19 ++++++ .../provider/tauri-ipc/ipc/types/document.ts | 12 ++++ .../tauri-ipc/ipc/types/workspace.json | 18 ++++++ .../provider/tauri-ipc/ipc/types/workspace.ts | 13 ++++ 6 files changed, 148 insertions(+) create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/blob.json create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/blob.ts create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/document.json create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/document.ts create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.json create mode 100644 packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.ts diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.json b/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.json new file mode 100644 index 000000000..f136a8b4d --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.json @@ -0,0 +1,61 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IBlobParameters", + "oneOf": [ + { + "type": "object", + "required": ["Put"], + "properties": { + "Put": { + "$ref": "#/definitions/PutBlob" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["Get"], + "properties": { + "Get": { + "$ref": "#/definitions/GetBlob" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "GetBlob": { + "type": "object", + "required": ["id", "workspace_id"], + "properties": { + "id": { + "type": "string" + }, + "workspace_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "PutBlob": { + "type": "object", + "required": ["blob", "workspace_id"], + "properties": { + "blob": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + }, + "workspace_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } +} diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.ts b/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.ts new file mode 100644 index 000000000..388d1611d --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/blob.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export type IBlobParameters = + | { + Put: PutBlob; + } + | { + Get: GetBlob; + }; + +export interface PutBlob { + blob: number[]; + workspace_id: number; + [k: string]: unknown; +} +export interface GetBlob { + id: string; + workspace_id: number; + [k: string]: unknown; +} diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/document.json b/packages/data-center/src/provider/tauri-ipc/ipc/types/document.json new file mode 100644 index 000000000..a5c2f8f12 --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/document.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "YDocumentUpdate", + "type": "object", + "required": ["room", "update"], + "properties": { + "room": { + "type": "string" + }, + "update": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + } +} diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/document.ts b/packages/data-center/src/provider/tauri-ipc/ipc/types/document.ts new file mode 100644 index 000000000..fd6dd9160 --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/document.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface YDocumentUpdate { + room: string; + update: number[]; + [k: string]: unknown; +} diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.json b/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.json new file mode 100644 index 000000000..e73b360e0 --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CreateWorkspace", + "type": "object", + "required": ["avatar", "id", "name"], + "properties": { + "avatar": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + } +} diff --git a/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.ts b/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.ts new file mode 100644 index 000000000..cf60dcbd5 --- /dev/null +++ b/packages/data-center/src/provider/tauri-ipc/ipc/types/workspace.ts @@ -0,0 +1,13 @@ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface CreateWorkspace { + avatar: string; + id: number; + name: string; + [k: string]: unknown; +}