@meshagent/meshagent 0.36.2 → 0.37.0

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 (78) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/browser/agent-client.d.ts +2 -10
  3. package/dist/browser/agent-client.js +2 -30
  4. package/dist/browser/agent.d.ts +22 -22
  5. package/dist/browser/agent.js +36 -16
  6. package/dist/browser/containers-client.d.ts +7 -19
  7. package/dist/browser/containers-client.js +27 -21
  8. package/dist/browser/data-types.d.ts +12 -0
  9. package/dist/browser/data-types.js +39 -1
  10. package/dist/browser/database-client.d.ts +134 -47
  11. package/dist/browser/database-client.js +359 -133
  12. package/dist/browser/entrypoint.js +3 -3
  13. package/dist/browser/index.d.ts +1 -0
  14. package/dist/browser/index.js +1 -0
  15. package/dist/browser/meshagent-client.js +18 -5
  16. package/dist/browser/participant-token.d.ts +189 -22
  17. package/dist/browser/participant-token.js +1001 -189
  18. package/dist/browser/room-client.d.ts +1 -1
  19. package/dist/browser/room-event.d.ts +12 -0
  20. package/dist/browser/room-event.js +16 -1
  21. package/dist/browser/secrets-client.d.ts +5 -0
  22. package/dist/browser/secrets-client.js +11 -0
  23. package/dist/browser/services-client.d.ts +1 -1
  24. package/dist/browser/storage-client.d.ts +4 -0
  25. package/dist/browser/storage-client.js +18 -0
  26. package/dist/browser/version.d.ts +1 -0
  27. package/dist/browser/version.js +4 -0
  28. package/dist/esm/agent-client.d.ts +2 -10
  29. package/dist/esm/agent-client.js +1 -28
  30. package/dist/esm/agent.d.ts +22 -22
  31. package/dist/esm/agent.js +33 -14
  32. package/dist/esm/containers-client.d.ts +7 -19
  33. package/dist/esm/containers-client.js +27 -21
  34. package/dist/esm/data-types.d.ts +12 -0
  35. package/dist/esm/data-types.js +36 -0
  36. package/dist/esm/database-client.d.ts +134 -47
  37. package/dist/esm/database-client.js +352 -132
  38. package/dist/esm/index.d.ts +1 -0
  39. package/dist/esm/index.js +1 -0
  40. package/dist/esm/meshagent-client.js +18 -5
  41. package/dist/esm/participant-token.d.ts +189 -22
  42. package/dist/esm/participant-token.js +992 -188
  43. package/dist/esm/room-client.d.ts +1 -1
  44. package/dist/esm/room-event.d.ts +12 -0
  45. package/dist/esm/room-event.js +14 -0
  46. package/dist/esm/secrets-client.d.ts +5 -0
  47. package/dist/esm/secrets-client.js +11 -0
  48. package/dist/esm/services-client.d.ts +1 -1
  49. package/dist/esm/storage-client.d.ts +4 -0
  50. package/dist/esm/storage-client.js +19 -1
  51. package/dist/esm/version.d.ts +1 -0
  52. package/dist/esm/version.js +1 -0
  53. package/dist/node/agent-client.d.ts +2 -10
  54. package/dist/node/agent-client.js +2 -30
  55. package/dist/node/agent.d.ts +22 -22
  56. package/dist/node/agent.js +36 -16
  57. package/dist/node/containers-client.d.ts +7 -19
  58. package/dist/node/containers-client.js +27 -21
  59. package/dist/node/data-types.d.ts +12 -0
  60. package/dist/node/data-types.js +39 -1
  61. package/dist/node/database-client.d.ts +134 -47
  62. package/dist/node/database-client.js +359 -133
  63. package/dist/node/index.d.ts +1 -0
  64. package/dist/node/index.js +1 -0
  65. package/dist/node/meshagent-client.js +18 -5
  66. package/dist/node/participant-token.d.ts +189 -22
  67. package/dist/node/participant-token.js +1001 -189
  68. package/dist/node/room-client.d.ts +1 -1
  69. package/dist/node/room-event.d.ts +12 -0
  70. package/dist/node/room-event.js +16 -1
  71. package/dist/node/secrets-client.d.ts +5 -0
  72. package/dist/node/secrets-client.js +11 -0
  73. package/dist/node/services-client.d.ts +1 -1
  74. package/dist/node/storage-client.d.ts +4 -0
  75. package/dist/node/storage-client.js +18 -0
  76. package/dist/node/version.d.ts +1 -0
  77. package/dist/node/version.js +4 -0
  78. package/package.json +3 -3
@@ -5,6 +5,8 @@ export interface TableRef {
5
5
  name: string;
6
6
  namespace?: string[];
7
7
  alias?: string;
8
+ branch?: string;
9
+ version?: number;
8
10
  }
9
11
  export interface TableVersion {
10
12
  version: number;
@@ -16,7 +18,56 @@ export interface TableIndex {
16
18
  columns: string[];
17
19
  type: string;
18
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>;
19
65
  type DatabaseRoomInvoker = Pick<RoomClient, "invoke" | "invokeStream">;
66
+ export declare class DatabaseUuid {
67
+ readonly value: string;
68
+ constructor(value: string);
69
+ toString(): string;
70
+ }
20
71
  export declare class DatabaseClient {
21
72
  private room;
22
73
  constructor({ room }: {
@@ -27,168 +78,204 @@ export declare class DatabaseClient {
27
78
  private invokeStream;
28
79
  private drainWriteStream;
29
80
  private streamRows;
30
- listTables({ namespace }?: {
81
+ listTables({ namespace, branch }?: {
31
82
  namespace?: string[];
83
+ branch?: string;
32
84
  }): Promise<string[]>;
33
85
  private createTable;
34
- createTableWithSchema({ name, schema, data, mode, namespace, metadata }: {
86
+ createTableWithSchema({ name, schema, data, mode, namespace, branch, metadata }: {
35
87
  name: string;
36
88
  schema?: Record<string, DataType>;
37
- data?: Array<Record<string, any>>;
89
+ data?: DatabaseRows;
38
90
  mode?: CreateMode;
39
91
  namespace?: string[];
92
+ branch?: string;
40
93
  metadata?: Record<string, unknown>;
41
94
  }): Promise<void>;
42
- createTableFromData({ name, data, mode, namespace, metadata }: {
95
+ createTableFromData({ name, data, mode, namespace, branch, metadata }: {
43
96
  name: string;
44
- data?: Array<Record<string, any>>;
97
+ data?: DatabaseRows;
45
98
  mode?: CreateMode;
46
99
  namespace?: string[];
100
+ branch?: string;
47
101
  metadata?: Record<string, unknown>;
48
102
  }): Promise<void>;
49
- createTableFromDataStream({ name, chunks, schema, mode, namespace, metadata }: {
103
+ createTableFromDataStream({ name, chunks, schema, mode, namespace, branch, metadata }: {
50
104
  name: string;
51
- chunks: AsyncIterable<Array<Record<string, any>>> | Iterable<Array<Record<string, any>>>;
105
+ chunks: DatabaseRowChunks;
52
106
  schema?: Record<string, DataType>;
53
107
  mode?: CreateMode;
54
108
  namespace?: string[];
109
+ branch?: string;
55
110
  metadata?: Record<string, unknown>;
56
111
  }): Promise<void>;
57
- dropTable({ name, ignoreMissing, namespace }: {
112
+ dropTable({ name, ignoreMissing, namespace, branch }: {
58
113
  name: string;
59
114
  ignoreMissing?: boolean;
60
115
  namespace?: string[];
116
+ branch?: string;
61
117
  }): Promise<void>;
62
- dropIndex({ table, name, namespace }: {
118
+ dropIndex({ table, name, namespace, branch }: {
63
119
  table: string;
64
120
  name: string;
65
121
  namespace?: string[];
122
+ branch?: string;
66
123
  }): Promise<void>;
67
- addColumns({ table, newColumns, namespace }: {
124
+ addColumns({ table, newColumns, namespace, branch }: {
68
125
  table: string;
69
126
  newColumns: Record<string, string | DataType>;
70
127
  namespace?: string[];
128
+ branch?: string;
71
129
  }): Promise<void>;
72
- dropColumns({ table, columns, namespace }: {
130
+ dropColumns({ table, columns, namespace, branch }: {
73
131
  table: string;
74
132
  columns: string[];
75
133
  namespace?: string[];
134
+ branch?: string;
76
135
  }): Promise<void>;
77
- insert({ table, records, namespace }: {
136
+ insert({ table, records, namespace, branch }: {
78
137
  table: string;
79
- records: Array<Record<string, any>>;
138
+ records: DatabaseRows;
80
139
  namespace?: string[];
140
+ branch?: string;
81
141
  }): Promise<void>;
82
- insertStream({ table, chunks, namespace }: {
142
+ insertStream({ table, chunks, namespace, branch }: {
83
143
  table: string;
84
- chunks: AsyncIterable<Array<Record<string, any>>> | Iterable<Array<Record<string, any>>>;
144
+ chunks: DatabaseRowChunks;
85
145
  namespace?: string[];
146
+ branch?: string;
86
147
  }): Promise<void>;
87
- update({ table, where, values, valuesSql, namespace }: {
148
+ update({ table, where, values, namespace, branch }: {
88
149
  table: string;
89
150
  where: string;
90
- values?: Record<string, any>;
91
- valuesSql?: Record<string, string>;
151
+ values: DatabaseRecord;
92
152
  namespace?: string[];
153
+ branch?: string;
93
154
  }): Promise<void>;
94
- delete({ table, where, namespace }: {
155
+ delete({ table, where, namespace, branch }: {
95
156
  table: string;
96
157
  where: string;
97
158
  namespace?: string[];
159
+ branch?: string;
98
160
  }): Promise<void>;
99
- merge({ table, on, records, namespace }: {
161
+ merge({ table, on, records, namespace, branch }: {
100
162
  table: string;
101
163
  on: string;
102
- records: Array<Record<string, any>>;
164
+ records: DatabaseRows;
103
165
  namespace?: string[];
166
+ branch?: string;
104
167
  }): Promise<void>;
105
- mergeStream({ table, on, chunks, namespace }: {
168
+ mergeStream({ table, on, chunks, namespace, branch }: {
106
169
  table: string;
107
170
  on: string;
108
- chunks: AsyncIterable<Array<Record<string, any>>> | Iterable<Array<Record<string, any>>>;
171
+ chunks: DatabaseRowChunks;
109
172
  namespace?: string[];
173
+ branch?: string;
110
174
  }): Promise<void>;
111
175
  sql({ query, tables, params }: {
112
176
  query: string;
113
177
  tables: Array<TableRef | string>;
114
- params?: Record<string, any>;
115
- }): Promise<Array<Record<string, any>>>;
178
+ params?: DatabaseRecord;
179
+ }): Promise<DatabaseRows>;
116
180
  sqlStream({ query, tables, params }: {
117
181
  query: string;
118
182
  tables: Array<TableRef | string>;
119
- params?: Record<string, any>;
120
- }): AsyncIterable<Array<Record<string, any>>>;
121
- search({ table, text, vector, where, offset, limit, select, namespace }: {
183
+ params?: DatabaseRecord;
184
+ }): AsyncIterable<DatabaseRows>;
185
+ search({ table, text, vector, where, offset, limit, select, namespace, branch, version }: {
122
186
  table: string;
123
187
  text?: string;
124
188
  vector?: number[];
125
- where?: string | Record<string, any>;
189
+ where?: DatabaseWhere;
126
190
  offset?: number;
127
191
  limit?: number;
128
192
  select?: string[];
129
193
  namespace?: string[];
130
- }): Promise<Array<Record<string, any>>>;
131
- searchStream({ table, text, vector, where, offset, limit, select, namespace }: {
194
+ branch?: string;
195
+ version?: number;
196
+ }): Promise<DatabaseRows>;
197
+ searchStream({ table, text, vector, where, offset, limit, select, namespace, branch, version }: {
132
198
  table: string;
133
199
  text?: string;
134
200
  vector?: number[];
135
- where?: string | Record<string, any>;
201
+ where?: DatabaseWhere;
136
202
  offset?: number;
137
203
  limit?: number;
138
204
  select?: string[];
139
205
  namespace?: string[];
140
- }): AsyncIterable<Array<Record<string, any>>>;
141
- count({ table, text, vector, where, namespace }: {
206
+ branch?: string;
207
+ version?: number;
208
+ }): AsyncIterable<DatabaseRows>;
209
+ count({ table, text, vector, where, namespace, branch, version }: {
142
210
  table: string;
143
211
  text?: string;
144
212
  vector?: number[];
145
- where?: string | Record<string, any>;
213
+ where?: DatabaseWhere;
146
214
  namespace?: string[];
215
+ branch?: string;
216
+ version?: number;
147
217
  }): Promise<number>;
148
- inspect({ table, namespace }: {
218
+ inspect({ table, namespace, branch, version }: {
149
219
  table: string;
150
220
  namespace?: string[];
221
+ branch?: string;
222
+ version?: number;
151
223
  }): Promise<Record<string, DataType>>;
152
224
  optimize(table: string): Promise<void>;
153
225
  optimize(params: {
154
226
  table: string;
155
227
  namespace?: string[];
228
+ branch?: string;
156
229
  }): Promise<void>;
157
- restore({ table, version, namespace }: {
230
+ restore({ table, version, namespace, branch }: {
158
231
  table: string;
159
232
  version: number;
160
233
  namespace?: string[];
234
+ branch?: string;
161
235
  }): Promise<void>;
162
- checkout({ table, version, namespace }: {
163
- table: string;
164
- version: number;
165
- namespace?: string[];
166
- }): Promise<void>;
167
- listVersions({ table, namespace }: {
236
+ listVersions({ table, namespace, branch }: {
168
237
  table: string;
169
238
  namespace?: string[];
239
+ branch?: string;
170
240
  }): Promise<TableVersion[]>;
171
- createVectorIndex({ table, column, replace, namespace }: {
241
+ createVectorIndex({ table, column, replace, namespace, branch }: {
172
242
  table: string;
173
243
  column: string;
174
244
  replace?: boolean;
175
245
  namespace?: string[];
246
+ branch?: string;
176
247
  }): Promise<void>;
177
- createScalarIndex({ table, column, replace, namespace }: {
248
+ createScalarIndex({ table, column, replace, namespace, branch }: {
178
249
  table: string;
179
250
  column: string;
180
251
  replace?: boolean;
181
252
  namespace?: string[];
253
+ branch?: string;
182
254
  }): Promise<void>;
183
- createFullTextSearchIndex({ table, column, replace, namespace }: {
255
+ createFullTextSearchIndex({ table, column, replace, namespace, branch }: {
184
256
  table: string;
185
257
  column: string;
186
258
  replace?: boolean;
187
259
  namespace?: string[];
260
+ branch?: string;
188
261
  }): Promise<void>;
189
- listIndexes({ table, namespace }: {
262
+ listIndexes({ table, namespace, branch, version }: {
190
263
  table: string;
191
264
  namespace?: string[];
265
+ branch?: string;
266
+ version?: number;
192
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>;
193
280
  }
194
281
  export {};