@meshagent/meshagent 0.38.4 → 0.39.1

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +14 -2
  2. package/dist/browser/datasets-client.d.ts +415 -0
  3. package/dist/{node/database-client.js → browser/datasets-client.js} +480 -234
  4. package/dist/browser/entrypoint.js +9 -17
  5. package/dist/browser/index.d.ts +1 -2
  6. package/dist/browser/index.js +1 -2
  7. package/dist/browser/meshagent-client.d.ts +179 -3
  8. package/dist/browser/meshagent-client.js +333 -25
  9. package/dist/browser/participant-token.d.ts +5 -5
  10. package/dist/browser/participant-token.js +14 -13
  11. package/dist/browser/room-client.d.ts +5 -3
  12. package/dist/browser/room-client.js +70 -4
  13. package/dist/esm/datasets-client.d.ts +415 -0
  14. package/dist/esm/{database-client.js → datasets-client.js} +473 -227
  15. package/dist/esm/entrypoint.js +6 -12
  16. package/dist/esm/index.d.ts +1 -2
  17. package/dist/esm/index.js +1 -2
  18. package/dist/esm/meshagent-client.d.ts +179 -3
  19. package/dist/esm/meshagent-client.js +333 -25
  20. package/dist/esm/participant-token.d.ts +5 -5
  21. package/dist/esm/participant-token.js +12 -11
  22. package/dist/esm/room-client.d.ts +5 -3
  23. package/dist/esm/room-client.js +70 -4
  24. package/dist/node/datasets-client.d.ts +415 -0
  25. package/dist/{browser/database-client.js → node/datasets-client.js} +480 -234
  26. package/dist/node/entrypoint.js +6 -12
  27. package/dist/node/index.d.ts +1 -2
  28. package/dist/node/index.js +1 -2
  29. package/dist/node/meshagent-client.d.ts +179 -3
  30. package/dist/node/meshagent-client.js +333 -25
  31. package/dist/node/participant-token.d.ts +5 -5
  32. package/dist/node/participant-token.js +14 -13
  33. package/dist/node/room-client.d.ts +5 -3
  34. package/dist/node/room-client.js +70 -4
  35. package/package.json +3 -2
  36. package/dist/browser/data-types.d.ts +0 -67
  37. package/dist/browser/data-types.js +0 -192
  38. package/dist/browser/database-client.d.ts +0 -281
  39. package/dist/esm/data-types.d.ts +0 -67
  40. package/dist/esm/data-types.js +0 -179
  41. package/dist/esm/database-client.d.ts +0 -281
  42. package/dist/node/data-types.d.ts +0 -67
  43. package/dist/node/data-types.js +0 -192
  44. package/dist/node/database-client.d.ts +0 -281
@@ -1,67 +0,0 @@
1
- export declare const _dataTypes: Record<string, typeof DataType>;
2
- export declare abstract class DataType {
3
- constructor(_?: any);
4
- abstract toJson(): Record<string, unknown>;
5
- static fromJson(data: any): DataType;
6
- static int(): IntDataType;
7
- static date(): DateDataType;
8
- static float(): FloatDataType;
9
- static vector({ size, elementType }: {
10
- size: number;
11
- elementType: DataType;
12
- }): VectorDataType;
13
- static text(): TextDataType;
14
- static json(): JsonDataType;
15
- static uuid(): UuidDataType;
16
- static binary(): BinaryDataType;
17
- }
18
- export declare class BoolDataType extends DataType {
19
- constructor();
20
- static fromJson(data: any): IntDataType;
21
- toJson(): Record<string, unknown>;
22
- }
23
- export declare class IntDataType extends DataType {
24
- constructor();
25
- static fromJson(data: any): IntDataType;
26
- toJson(): Record<string, unknown>;
27
- }
28
- export declare class DateDataType extends DataType {
29
- constructor();
30
- static fromJson(data: any): DateDataType;
31
- toJson(): Record<string, unknown>;
32
- }
33
- export declare class FloatDataType extends DataType {
34
- constructor();
35
- static fromJson(data: any): FloatDataType;
36
- toJson(): Record<string, unknown>;
37
- }
38
- export declare class VectorDataType extends DataType {
39
- size: number;
40
- elementType: DataType;
41
- constructor({ size, elementType }: {
42
- size: number;
43
- elementType: DataType;
44
- });
45
- static fromJson(data: any): VectorDataType;
46
- toJson(): Record<string, unknown>;
47
- }
48
- export declare class TextDataType extends DataType {
49
- constructor();
50
- static fromJson(data: any): TextDataType;
51
- toJson(): Record<string, unknown>;
52
- }
53
- export declare class JsonDataType extends DataType {
54
- constructor();
55
- static fromJson(data: any): JsonDataType;
56
- toJson(): Record<string, unknown>;
57
- }
58
- export declare class UuidDataType extends DataType {
59
- constructor();
60
- static fromJson(data: any): UuidDataType;
61
- toJson(): Record<string, unknown>;
62
- }
63
- export declare class BinaryDataType extends DataType {
64
- constructor();
65
- static fromJson(data: any): BinaryDataType;
66
- toJson(): Record<string, unknown>;
67
- }
@@ -1,179 +0,0 @@
1
- export const _dataTypes = {};
2
- export class DataType {
3
- constructor(_) { }
4
- static fromJson(data) {
5
- const ctor = _dataTypes[data.type];
6
- if (!ctor) {
7
- throw new Error(`Unknown data type: ${data.type}`);
8
- }
9
- return ctor.fromJson(data);
10
- }
11
- static int() {
12
- return new IntDataType();
13
- }
14
- static date() {
15
- return new DateDataType();
16
- }
17
- static float() {
18
- return new FloatDataType();
19
- }
20
- static vector({ size, elementType }) {
21
- return new VectorDataType({ size, elementType });
22
- }
23
- static text() {
24
- return new TextDataType();
25
- }
26
- static json() {
27
- return new JsonDataType();
28
- }
29
- static uuid() {
30
- return new UuidDataType();
31
- }
32
- static binary() {
33
- return new BinaryDataType();
34
- }
35
- }
36
- export class BoolDataType extends DataType {
37
- constructor() {
38
- super();
39
- }
40
- static fromJson(data) {
41
- if (data.type !== "bool") {
42
- throw new Error(`Expected type 'bool', got '${data.type}'`);
43
- }
44
- return new BoolDataType();
45
- }
46
- toJson() {
47
- return { type: "bool" };
48
- }
49
- }
50
- _dataTypes["bool"] = BoolDataType;
51
- export class IntDataType extends DataType {
52
- constructor() {
53
- super();
54
- }
55
- static fromJson(data) {
56
- if (data.type !== "int") {
57
- throw new Error(`Expected type 'int', got '${data.type}'`);
58
- }
59
- return new IntDataType();
60
- }
61
- toJson() {
62
- return { type: "int" };
63
- }
64
- }
65
- _dataTypes["int"] = IntDataType;
66
- export class DateDataType extends DataType {
67
- constructor() {
68
- super();
69
- }
70
- static fromJson(data) {
71
- if (data.type !== "date") {
72
- throw new Error(`Expected type 'date', got '${data.type}'`);
73
- }
74
- return new DateDataType();
75
- }
76
- toJson() {
77
- return { type: "date" };
78
- }
79
- }
80
- _dataTypes["date"] = DateDataType;
81
- export class FloatDataType extends DataType {
82
- constructor() {
83
- super();
84
- }
85
- static fromJson(data) {
86
- if (data.type !== "float") {
87
- throw new Error(`Expected type 'float', got '${data.type}'`);
88
- }
89
- return new FloatDataType();
90
- }
91
- toJson() {
92
- return { type: "float" };
93
- }
94
- }
95
- _dataTypes["float"] = FloatDataType;
96
- export class VectorDataType extends DataType {
97
- constructor({ size, elementType }) {
98
- super();
99
- this.size = size;
100
- this.elementType = elementType;
101
- }
102
- static fromJson(data) {
103
- if (data.type !== "vector") {
104
- throw new Error(`Expected type 'vector', got '${data.type}'`);
105
- }
106
- return new VectorDataType({
107
- size: data.size,
108
- elementType: DataType.fromJson(data.element_type),
109
- });
110
- }
111
- toJson() {
112
- return {
113
- type: "vector",
114
- size: this.size,
115
- element_type: this.elementType.toJson(),
116
- };
117
- }
118
- }
119
- _dataTypes["vector"] = VectorDataType;
120
- export class TextDataType extends DataType {
121
- constructor() {
122
- super();
123
- }
124
- static fromJson(data) {
125
- if (data.type !== "text") {
126
- throw new Error(`Expected type 'text', got '${data.type}'`);
127
- }
128
- return new TextDataType();
129
- }
130
- toJson() {
131
- return { type: "text" };
132
- }
133
- }
134
- _dataTypes["text"] = TextDataType;
135
- export class JsonDataType extends DataType {
136
- constructor() {
137
- super();
138
- }
139
- static fromJson(data) {
140
- if (data.type !== "json") {
141
- throw new Error(`Expected type 'json', got '${data.type}'`);
142
- }
143
- return new JsonDataType();
144
- }
145
- toJson() {
146
- return { type: "json" };
147
- }
148
- }
149
- _dataTypes["json"] = JsonDataType;
150
- export class UuidDataType extends DataType {
151
- constructor() {
152
- super();
153
- }
154
- static fromJson(data) {
155
- if (data.type !== "uuid") {
156
- throw new Error(`Expected type 'uuid', got '${data.type}'`);
157
- }
158
- return new UuidDataType();
159
- }
160
- toJson() {
161
- return { type: "uuid" };
162
- }
163
- }
164
- _dataTypes["uuid"] = UuidDataType;
165
- export class BinaryDataType extends DataType {
166
- constructor() {
167
- super();
168
- }
169
- static fromJson(data) {
170
- if (data.type !== "binary") {
171
- throw new Error(`Expected type 'binary', got '${data.type}'`);
172
- }
173
- return new BinaryDataType();
174
- }
175
- toJson() {
176
- return { type: "binary" };
177
- }
178
- }
179
- _dataTypes["binary"] = BinaryDataType;
@@ -1,281 +0,0 @@
1
- import { DataType } from "./data-types";
2
- import { RoomClient } from "./room-client";
3
- export type CreateMode = "create" | "overwrite" | "create_if_not_exists";
4
- export interface TableRef {
5
- name: string;
6
- namespace?: string[];
7
- alias?: string;
8
- branch?: string;
9
- version?: number;
10
- }
11
- export interface TableVersion {
12
- version: number;
13
- timestamp: Date;
14
- metadata: Record<string, unknown>;
15
- }
16
- export interface TableIndex {
17
- name: string;
18
- columns: string[];
19
- type: string;
20
- }
21
- export interface TableBranch {
22
- name: string;
23
- parentBranch: string | null;
24
- parentVersion: number | null;
25
- createdAt: Date | null;
26
- manifestSize: number | null;
27
- }
28
- export declare abstract class DatabaseValueEncoder {
29
- abstract encodeDatabaseValue(): unknown;
30
- }
31
- export declare class DatabaseExpression extends DatabaseValueEncoder {
32
- readonly expression: string;
33
- constructor(expression: string);
34
- encodeDatabaseValue(): Record<string, string>;
35
- toString(): string;
36
- }
37
- export declare class DatabaseDate extends DatabaseValueEncoder {
38
- readonly value: string;
39
- constructor(value: string);
40
- encodeDatabaseValue(): Record<string, string>;
41
- toString(): string;
42
- }
43
- export type DatabaseJsonScalarValue = null | boolean | number | string;
44
- export type DatabaseJsonValue = DatabaseJsonScalarValue | DatabaseJsonValue[] | {
45
- [key: string]: DatabaseJsonValue;
46
- };
47
- export declare class DatabaseStruct extends DatabaseValueEncoder {
48
- readonly fields: Record<string, DatabaseValue>;
49
- constructor(fields: Record<string, DatabaseValue>);
50
- toJson(): Record<string, unknown>;
51
- encodeDatabaseValue(): Record<string, Record<string, unknown>>;
52
- }
53
- export declare class DatabaseJson extends DatabaseValueEncoder {
54
- readonly value: DatabaseJsonValue;
55
- constructor(value: DatabaseJsonValue);
56
- toJson(): DatabaseJsonValue;
57
- encodeDatabaseValue(): Record<string, DatabaseJsonValue>;
58
- }
59
- export type DatabaseScalarValue = null | boolean | number | string | Uint8Array | DatabaseUuid | Date;
60
- export type DatabaseValue = DatabaseScalarValue | DatabaseValueEncoder | DatabaseValue[];
61
- export type DatabaseRecord = Record<string, DatabaseValue>;
62
- export type DatabaseRows = DatabaseRecord[];
63
- export type DatabaseRowChunks = AsyncIterable<DatabaseRows> | Iterable<DatabaseRows>;
64
- export type DatabaseWhere = string | Record<string, DatabaseValue>;
65
- type DatabaseRoomInvoker = Pick<RoomClient, "invoke" | "invokeStream">;
66
- export declare class DatabaseUuid {
67
- readonly value: string;
68
- constructor(value: string);
69
- toString(): string;
70
- }
71
- export declare class DatabaseClient {
72
- private room;
73
- constructor({ room }: {
74
- room: DatabaseRoomInvoker;
75
- });
76
- private _unexpectedResponseError;
77
- private invoke;
78
- private invokeStream;
79
- private drainWriteStream;
80
- private streamRows;
81
- listTables({ namespace, branch }?: {
82
- namespace?: string[];
83
- branch?: string;
84
- }): Promise<string[]>;
85
- private createTable;
86
- createTableWithSchema({ name, schema, data, mode, namespace, branch, metadata }: {
87
- name: string;
88
- schema?: Record<string, DataType>;
89
- data?: DatabaseRows;
90
- mode?: CreateMode;
91
- namespace?: string[];
92
- branch?: string;
93
- metadata?: Record<string, unknown>;
94
- }): Promise<void>;
95
- createTableFromData({ name, data, mode, namespace, branch, metadata }: {
96
- name: string;
97
- data?: DatabaseRows;
98
- mode?: CreateMode;
99
- namespace?: string[];
100
- branch?: string;
101
- metadata?: Record<string, unknown>;
102
- }): Promise<void>;
103
- createTableFromDataStream({ name, chunks, schema, mode, namespace, branch, metadata }: {
104
- name: string;
105
- chunks: DatabaseRowChunks;
106
- schema?: Record<string, DataType>;
107
- mode?: CreateMode;
108
- namespace?: string[];
109
- branch?: string;
110
- metadata?: Record<string, unknown>;
111
- }): Promise<void>;
112
- dropTable({ name, ignoreMissing, namespace, branch }: {
113
- name: string;
114
- ignoreMissing?: boolean;
115
- namespace?: string[];
116
- branch?: string;
117
- }): Promise<void>;
118
- dropIndex({ table, name, namespace, branch }: {
119
- table: string;
120
- name: string;
121
- namespace?: string[];
122
- branch?: string;
123
- }): Promise<void>;
124
- addColumns({ table, newColumns, namespace, branch }: {
125
- table: string;
126
- newColumns: Record<string, string | DataType>;
127
- namespace?: string[];
128
- branch?: string;
129
- }): Promise<void>;
130
- dropColumns({ table, columns, namespace, branch }: {
131
- table: string;
132
- columns: string[];
133
- namespace?: string[];
134
- branch?: string;
135
- }): Promise<void>;
136
- insert({ table, records, namespace, branch }: {
137
- table: string;
138
- records: DatabaseRows;
139
- namespace?: string[];
140
- branch?: string;
141
- }): Promise<void>;
142
- insertStream({ table, chunks, namespace, branch }: {
143
- table: string;
144
- chunks: DatabaseRowChunks;
145
- namespace?: string[];
146
- branch?: string;
147
- }): Promise<void>;
148
- update({ table, where, values, namespace, branch }: {
149
- table: string;
150
- where: string;
151
- values: DatabaseRecord;
152
- namespace?: string[];
153
- branch?: string;
154
- }): Promise<void>;
155
- delete({ table, where, namespace, branch }: {
156
- table: string;
157
- where: string;
158
- namespace?: string[];
159
- branch?: string;
160
- }): Promise<void>;
161
- merge({ table, on, records, namespace, branch }: {
162
- table: string;
163
- on: string;
164
- records: DatabaseRows;
165
- namespace?: string[];
166
- branch?: string;
167
- }): Promise<void>;
168
- mergeStream({ table, on, chunks, namespace, branch }: {
169
- table: string;
170
- on: string;
171
- chunks: DatabaseRowChunks;
172
- namespace?: string[];
173
- branch?: string;
174
- }): Promise<void>;
175
- sql({ query, tables, params }: {
176
- query: string;
177
- tables: Array<TableRef | string>;
178
- params?: DatabaseRecord;
179
- }): Promise<DatabaseRows>;
180
- sqlStream({ query, tables, params }: {
181
- query: string;
182
- tables: Array<TableRef | string>;
183
- params?: DatabaseRecord;
184
- }): AsyncIterable<DatabaseRows>;
185
- search({ table, text, vector, where, offset, limit, select, namespace, branch, version }: {
186
- table: string;
187
- text?: string;
188
- vector?: number[];
189
- where?: DatabaseWhere;
190
- offset?: number;
191
- limit?: number;
192
- select?: string[];
193
- namespace?: string[];
194
- branch?: string;
195
- version?: number;
196
- }): Promise<DatabaseRows>;
197
- searchStream({ table, text, vector, where, offset, limit, select, namespace, branch, version }: {
198
- table: string;
199
- text?: string;
200
- vector?: number[];
201
- where?: DatabaseWhere;
202
- offset?: number;
203
- limit?: number;
204
- select?: string[];
205
- namespace?: string[];
206
- branch?: string;
207
- version?: number;
208
- }): AsyncIterable<DatabaseRows>;
209
- count({ table, text, vector, where, namespace, branch, version }: {
210
- table: string;
211
- text?: string;
212
- vector?: number[];
213
- where?: DatabaseWhere;
214
- namespace?: string[];
215
- branch?: string;
216
- version?: number;
217
- }): Promise<number>;
218
- inspect({ table, namespace, branch, version }: {
219
- table: string;
220
- namespace?: string[];
221
- branch?: string;
222
- version?: number;
223
- }): Promise<Record<string, DataType>>;
224
- optimize(table: string): Promise<void>;
225
- optimize(params: {
226
- table: string;
227
- namespace?: string[];
228
- branch?: string;
229
- }): Promise<void>;
230
- restore({ table, version, namespace, branch }: {
231
- table: string;
232
- version: number;
233
- namespace?: string[];
234
- branch?: string;
235
- }): Promise<void>;
236
- listVersions({ table, namespace, branch }: {
237
- table: string;
238
- namespace?: string[];
239
- branch?: string;
240
- }): Promise<TableVersion[]>;
241
- createVectorIndex({ table, column, replace, namespace, branch }: {
242
- table: string;
243
- column: string;
244
- replace?: boolean;
245
- namespace?: string[];
246
- branch?: string;
247
- }): Promise<void>;
248
- createScalarIndex({ table, column, replace, namespace, branch }: {
249
- table: string;
250
- column: string;
251
- replace?: boolean;
252
- namespace?: string[];
253
- branch?: string;
254
- }): Promise<void>;
255
- createFullTextSearchIndex({ table, column, replace, namespace, branch }: {
256
- table: string;
257
- column: string;
258
- replace?: boolean;
259
- namespace?: string[];
260
- branch?: string;
261
- }): Promise<void>;
262
- listIndexes({ table, namespace, branch, version }: {
263
- table: string;
264
- namespace?: string[];
265
- branch?: string;
266
- version?: number;
267
- }): Promise<TableIndex[]>;
268
- listBranches({ namespace }?: {
269
- namespace?: string[];
270
- }): Promise<TableBranch[]>;
271
- createBranch({ branch, fromBranch, namespace }: {
272
- branch: string;
273
- fromBranch?: string;
274
- namespace?: string[];
275
- }): Promise<void>;
276
- deleteBranch({ branch, namespace }: {
277
- branch: string;
278
- namespace?: string[];
279
- }): Promise<void>;
280
- }
281
- export {};
@@ -1,67 +0,0 @@
1
- export declare const _dataTypes: Record<string, typeof DataType>;
2
- export declare abstract class DataType {
3
- constructor(_?: any);
4
- abstract toJson(): Record<string, unknown>;
5
- static fromJson(data: any): DataType;
6
- static int(): IntDataType;
7
- static date(): DateDataType;
8
- static float(): FloatDataType;
9
- static vector({ size, elementType }: {
10
- size: number;
11
- elementType: DataType;
12
- }): VectorDataType;
13
- static text(): TextDataType;
14
- static json(): JsonDataType;
15
- static uuid(): UuidDataType;
16
- static binary(): BinaryDataType;
17
- }
18
- export declare class BoolDataType extends DataType {
19
- constructor();
20
- static fromJson(data: any): IntDataType;
21
- toJson(): Record<string, unknown>;
22
- }
23
- export declare class IntDataType extends DataType {
24
- constructor();
25
- static fromJson(data: any): IntDataType;
26
- toJson(): Record<string, unknown>;
27
- }
28
- export declare class DateDataType extends DataType {
29
- constructor();
30
- static fromJson(data: any): DateDataType;
31
- toJson(): Record<string, unknown>;
32
- }
33
- export declare class FloatDataType extends DataType {
34
- constructor();
35
- static fromJson(data: any): FloatDataType;
36
- toJson(): Record<string, unknown>;
37
- }
38
- export declare class VectorDataType extends DataType {
39
- size: number;
40
- elementType: DataType;
41
- constructor({ size, elementType }: {
42
- size: number;
43
- elementType: DataType;
44
- });
45
- static fromJson(data: any): VectorDataType;
46
- toJson(): Record<string, unknown>;
47
- }
48
- export declare class TextDataType extends DataType {
49
- constructor();
50
- static fromJson(data: any): TextDataType;
51
- toJson(): Record<string, unknown>;
52
- }
53
- export declare class JsonDataType extends DataType {
54
- constructor();
55
- static fromJson(data: any): JsonDataType;
56
- toJson(): Record<string, unknown>;
57
- }
58
- export declare class UuidDataType extends DataType {
59
- constructor();
60
- static fromJson(data: any): UuidDataType;
61
- toJson(): Record<string, unknown>;
62
- }
63
- export declare class BinaryDataType extends DataType {
64
- constructor();
65
- static fromJson(data: any): BinaryDataType;
66
- toJson(): Record<string, unknown>;
67
- }