@meshagent/meshagent 0.45.6 → 0.46.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.46.0]
2
+ - Stability
3
+
4
+ ## [0.45.9]
5
+ - The TypeScript services client now exposes `list()` with typed `ServiceRuntimeState`, `ServiceRuntimeStatus`, and `ServicePortRuntimeState`, including per-port liveness.
6
+ - The React dev services view now shows a Ports column with readiness indicators for each exposed port.
7
+ - Breaking change: `SecretVersion.encryption_key_id` was removed from the generated TypeScript client model.
8
+
9
+ ## [0.45.8]
10
+ - Stability
11
+
12
+ ## [0.45.7]
13
+ - Updated JS/TS SDK dependency versions, including `typescript`, `mocha`, `esbuild`, `jose`, `ws`, `yjs`, and `apache-arrow`.
14
+
1
15
  ## [0.45.6]
2
16
  - Aligned the JavaScript and TypeScript package set, example packages, and inter-package dependencies across the core SDK, agents, React, auth, livekit, tailwind, entrypoint, and node/TS wrappers.
3
17
 
@@ -159,7 +159,6 @@ export interface SecretVersion {
159
159
  id: string;
160
160
  secret_id: string;
161
161
  version: number;
162
- encryption_key_id: string;
163
162
  value_sha256?: string | null;
164
163
  created_by_user_id?: string | null;
165
164
  created_by_service_account_id?: string | null;
@@ -1,5 +1,6 @@
1
1
  import type { ServiceSpec } from "./meshagent-client.js";
2
2
  import { RoomClient } from "./room-client.js";
3
+ export type ServicePortNum = NonNullable<ServiceSpec["ports"]>[number]["num"];
3
4
  export interface ServiceRuntimeState {
4
5
  serviceId: string;
5
6
  state: string;
@@ -11,8 +12,19 @@ export interface ServiceRuntimeState {
11
12
  lastExitAt?: number;
12
13
  lastStartError?: string;
13
14
  lastStartErrorAt?: number;
15
+ status: ServiceRuntimeStatus;
14
16
  events: ServiceRuntimeEvent[];
15
17
  }
18
+ export interface ServiceRuntimeStatus {
19
+ ports: ServicePortRuntimeState[];
20
+ }
21
+ export interface ServicePortRuntimeState {
22
+ num: ServicePortNum;
23
+ liveness?: string;
24
+ livenessStatus: "not_configured" | "not_ready" | "ready";
25
+ lastCheckedAt?: number;
26
+ lastError?: string;
27
+ }
16
28
  export interface ServiceRuntimeEvent {
17
29
  type: string;
18
30
  reason: string;
@@ -31,8 +43,7 @@ export declare class ServicesClient {
31
43
  room: RoomClient;
32
44
  });
33
45
  private unexpectedResponse;
34
- list(): Promise<ServiceSpec[]>;
35
- listWithState(): Promise<ListServicesResult>;
46
+ list(): Promise<ListServicesResult>;
36
47
  restart(params: {
37
48
  serviceId: string;
38
49
  }): Promise<void>;
@@ -12,6 +12,34 @@ function toOptionalNumber(value) {
12
12
  function toOptionalInteger(value) {
13
13
  return typeof value === "number" && Number.isInteger(value) ? value : undefined;
14
14
  }
15
+ function parseServiceRuntimeStatus(value) {
16
+ if (!isRecord(value)) {
17
+ return { ports: [] };
18
+ }
19
+ const portsRaw = value["ports"];
20
+ return {
21
+ ports: Array.isArray(portsRaw) ? portsRaw.map((port) => parseServicePortRuntimeState(port)) : [],
22
+ };
23
+ }
24
+ function parseServicePortRuntimeState(value) {
25
+ if (!isRecord(value)) {
26
+ throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
27
+ }
28
+ const num = value["num"];
29
+ if (num !== "*" && typeof num !== "number") {
30
+ throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
31
+ }
32
+ const liveness = value["liveness"];
33
+ const livenessStatus = value["liveness_status"];
34
+ const lastError = value["last_error"];
35
+ return {
36
+ num,
37
+ liveness: typeof liveness === "string" ? liveness : undefined,
38
+ livenessStatus: livenessStatus === "not_ready" || livenessStatus === "ready" ? livenessStatus : "not_configured",
39
+ lastCheckedAt: toOptionalNumber(value["last_checked_at"]),
40
+ lastError: typeof lastError === "string" ? lastError : undefined,
41
+ };
42
+ }
15
43
  function parseServiceRuntimeState(value) {
16
44
  if (!isRecord(value) || typeof value["service_id"] !== "string") {
17
45
  throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
@@ -30,6 +58,7 @@ function parseServiceRuntimeState(value) {
30
58
  lastExitAt: toOptionalNumber(value["last_exit_at"]),
31
59
  lastStartError: typeof value["last_start_error"] === "string" ? value["last_start_error"] : undefined,
32
60
  lastStartErrorAt: toOptionalNumber(value["last_start_error_at"]),
61
+ status: parseServiceRuntimeStatus(value["status"]),
33
62
  events: Array.isArray(eventsRaw) ? eventsRaw.map((event) => parseServiceRuntimeEvent(event)) : [],
34
63
  };
35
64
  }
@@ -67,9 +96,6 @@ class ServicesClient {
67
96
  return new room_server_client_js_1.RoomServerException(`unexpected return type from services.${operation}`);
68
97
  }
69
98
  async list() {
70
- return (await this.listWithState()).services;
71
- }
72
- async listWithState() {
73
99
  const response = await this.room.invokeContent({
74
100
  toolkit: "services",
75
101
  tool: "list",
@@ -49,6 +49,16 @@ export declare class SqliteDatabaseClient {
49
49
  data?: Iterable<Table> | Table;
50
50
  mode?: SqliteCreateMode;
51
51
  }): Promise<void>;
52
+ createTableFromArrowTable(params: {
53
+ name: string;
54
+ table: Table;
55
+ mode?: SqliteCreateMode;
56
+ }): Promise<void>;
57
+ createTableFromArrowBatches(params: {
58
+ name: string;
59
+ batches: ArrowTableChunks;
60
+ mode?: SqliteCreateMode;
61
+ }): Promise<void>;
52
62
  dropTable(params: {
53
63
  name: string;
54
64
  ignoreMissing?: boolean;
@@ -64,6 +74,10 @@ export declare class SqliteDatabaseClient {
64
74
  table: string;
65
75
  newColumns: Schema;
66
76
  }): Promise<void>;
77
+ addColumnsWithSchema(params: {
78
+ table: string;
79
+ schema: Schema;
80
+ }): Promise<void>;
67
81
  dropColumns(params: {
68
82
  table: string;
69
83
  columns: string[];
@@ -72,6 +86,10 @@ export declare class SqliteDatabaseClient {
72
86
  table: string;
73
87
  records: Table;
74
88
  }): Promise<void>;
89
+ insertTable(params: {
90
+ table: string;
91
+ records: Table;
92
+ }): Promise<void>;
75
93
  update(params: {
76
94
  table: string;
77
95
  where: string;
@@ -184,6 +202,20 @@ export declare class SqliteClient {
184
202
  mode?: SqliteCreateMode;
185
203
  namespace?: string[];
186
204
  }): Promise<void>;
205
+ createTableFromArrowTable({ database, name, table, mode, namespace }: {
206
+ database: string;
207
+ name: string;
208
+ table: Table;
209
+ mode?: SqliteCreateMode;
210
+ namespace?: string[];
211
+ }): Promise<void>;
212
+ createTableFromArrowBatches({ database, name, batches, mode, namespace }: {
213
+ database: string;
214
+ name: string;
215
+ batches: ArrowTableChunks;
216
+ mode?: SqliteCreateMode;
217
+ namespace?: string[];
218
+ }): Promise<void>;
187
219
  dropTable({ database, name, ignoreMissing, namespace }: {
188
220
  database: string;
189
221
  name: string;
@@ -207,6 +239,12 @@ export declare class SqliteClient {
207
239
  newColumns: Schema;
208
240
  namespace?: string[];
209
241
  }): Promise<void>;
242
+ addColumnsWithSchema({ database, table, schema, namespace }: {
243
+ database: string;
244
+ table: string;
245
+ schema: Schema;
246
+ namespace?: string[];
247
+ }): Promise<void>;
210
248
  dropColumns({ database, table, columns, namespace }: {
211
249
  database: string;
212
250
  table: string;
@@ -219,6 +257,12 @@ export declare class SqliteClient {
219
257
  records: Table;
220
258
  namespace?: string[];
221
259
  }): Promise<void>;
260
+ insertTable({ database, table, records, namespace }: {
261
+ database: string;
262
+ table: string;
263
+ records: Table;
264
+ namespace?: string[];
265
+ }): Promise<void>;
222
266
  insertStream({ database, table, chunks, namespace }: {
223
267
  database: string;
224
268
  table: string;
@@ -21,6 +21,9 @@ async function* toAsyncArrowIterable(chunks) {
21
21
  function isRecord(value) {
22
22
  return typeof value === "object" && value !== null && !Array.isArray(value);
23
23
  }
24
+ function isStringArray(value) {
25
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
26
+ }
24
27
  function bytesToBase64(bytes) {
25
28
  if (globalScope.Buffer) {
26
29
  return globalScope.Buffer.from(bytes).toString("base64");
@@ -229,6 +232,12 @@ class SqliteDatabaseClient {
229
232
  async createTableFromData(params) {
230
233
  return this.client.createTableFromData({ ...params, database: this.database, namespace: this.namespace });
231
234
  }
235
+ async createTableFromArrowTable(params) {
236
+ return this.client.createTableFromArrowTable({ ...params, database: this.database, namespace: this.namespace });
237
+ }
238
+ async createTableFromArrowBatches(params) {
239
+ return this.client.createTableFromArrowBatches({ ...params, database: this.database, namespace: this.namespace });
240
+ }
232
241
  async dropTable(params) {
233
242
  return this.client.dropTable({ ...params, database: this.database, namespace: this.namespace });
234
243
  }
@@ -241,12 +250,18 @@ class SqliteDatabaseClient {
241
250
  async addColumns(params) {
242
251
  return this.client.addColumns({ ...params, database: this.database, namespace: this.namespace });
243
252
  }
253
+ async addColumnsWithSchema(params) {
254
+ return this.client.addColumnsWithSchema({ ...params, database: this.database, namespace: this.namespace });
255
+ }
244
256
  async dropColumns(params) {
245
257
  return this.client.dropColumns({ ...params, database: this.database, namespace: this.namespace });
246
258
  }
247
259
  async insert(params) {
248
260
  return this.client.insert({ ...params, database: this.database, namespace: this.namespace });
249
261
  }
262
+ async insertTable(params) {
263
+ return this.client.insertTable({ ...params, database: this.database, namespace: this.namespace });
264
+ }
250
265
  async update(params) {
251
266
  return this.client.update({ ...params, database: this.database, namespace: this.namespace });
252
267
  }
@@ -352,7 +367,7 @@ class SqliteClient {
352
367
  }
353
368
  async listDatabases({ namespace } = {}) {
354
369
  const response = await this.invoke("list_databases", { namespace: namespace ?? null });
355
- if (!(response instanceof response_js_1.JsonContent) || !Array.isArray(response.json.databases)) {
370
+ if (!(response instanceof response_js_1.JsonContent) || !isStringArray(response.json.databases)) {
356
371
  throw this.unexpectedResponseError("list_databases");
357
372
  }
358
373
  return response.json.databases;
@@ -383,7 +398,7 @@ class SqliteClient {
383
398
  }
384
399
  async listTables({ database, namespace }) {
385
400
  const response = await this.invoke("list_tables", { database, namespace: namespace ?? null });
386
- if (!(response instanceof response_js_1.JsonContent) || !Array.isArray(response.json.tables)) {
401
+ if (!(response instanceof response_js_1.JsonContent) || !isStringArray(response.json.tables)) {
387
402
  throw this.unexpectedResponseError("list_tables");
388
403
  }
389
404
  return response.json.tables;
@@ -417,6 +432,12 @@ class SqliteClient {
417
432
  namespace,
418
433
  });
419
434
  }
435
+ async createTableFromArrowTable({ database, name, table, mode = "create", namespace }) {
436
+ return this.createTableWithSchema({ database, name, schema: table.schema, data: table, mode, namespace });
437
+ }
438
+ async createTableFromArrowBatches({ database, name, batches, mode = "create", namespace }) {
439
+ return this.createTable({ database, name, data: batches, mode, namespace });
440
+ }
420
441
  async dropTable({ database, name, ignoreMissing = false, namespace }) {
421
442
  const response = await this.invoke("drop_table", { database, name, ignore_missing: ignoreMissing, namespace: namespace ?? null });
422
443
  if (!(response instanceof response_js_1.EmptyContent)) {
@@ -450,6 +471,9 @@ class SqliteClient {
450
471
  throw this.unexpectedResponseError("add_columns");
451
472
  }
452
473
  }
474
+ async addColumnsWithSchema({ database, table, schema, namespace }) {
475
+ return this.addColumns({ database, table, newColumns: schema, namespace });
476
+ }
453
477
  async dropColumns({ database, table, columns, namespace }) {
454
478
  const response = await this.invoke("drop_columns", { database, table, columns, namespace: namespace ?? null });
455
479
  if (!(response instanceof response_js_1.EmptyContent)) {
@@ -459,6 +483,9 @@ class SqliteClient {
459
483
  async insert({ database, table, records, namespace }) {
460
484
  await this.insertStream({ database, table, chunks: [records], namespace });
461
485
  }
486
+ async insertTable({ database, table, records, namespace }) {
487
+ await this.insert({ database, table, records, namespace });
488
+ }
462
489
  async insertStream({ database, table, chunks, namespace }) {
463
490
  const input = new SqliteArrowWriteInputStream({
464
491
  kind: "start",
@@ -159,7 +159,6 @@ export interface SecretVersion {
159
159
  id: string;
160
160
  secret_id: string;
161
161
  version: number;
162
- encryption_key_id: string;
163
162
  value_sha256?: string | null;
164
163
  created_by_user_id?: string | null;
165
164
  created_by_service_account_id?: string | null;
@@ -1,5 +1,6 @@
1
1
  import type { ServiceSpec } from "./meshagent-client.js";
2
2
  import { RoomClient } from "./room-client.js";
3
+ export type ServicePortNum = NonNullable<ServiceSpec["ports"]>[number]["num"];
3
4
  export interface ServiceRuntimeState {
4
5
  serviceId: string;
5
6
  state: string;
@@ -11,8 +12,19 @@ export interface ServiceRuntimeState {
11
12
  lastExitAt?: number;
12
13
  lastStartError?: string;
13
14
  lastStartErrorAt?: number;
15
+ status: ServiceRuntimeStatus;
14
16
  events: ServiceRuntimeEvent[];
15
17
  }
18
+ export interface ServiceRuntimeStatus {
19
+ ports: ServicePortRuntimeState[];
20
+ }
21
+ export interface ServicePortRuntimeState {
22
+ num: ServicePortNum;
23
+ liveness?: string;
24
+ livenessStatus: "not_configured" | "not_ready" | "ready";
25
+ lastCheckedAt?: number;
26
+ lastError?: string;
27
+ }
16
28
  export interface ServiceRuntimeEvent {
17
29
  type: string;
18
30
  reason: string;
@@ -31,8 +43,7 @@ export declare class ServicesClient {
31
43
  room: RoomClient;
32
44
  });
33
45
  private unexpectedResponse;
34
- list(): Promise<ServiceSpec[]>;
35
- listWithState(): Promise<ListServicesResult>;
46
+ list(): Promise<ListServicesResult>;
36
47
  restart(params: {
37
48
  serviceId: string;
38
49
  }): Promise<void>;
@@ -9,6 +9,34 @@ function toOptionalNumber(value) {
9
9
  function toOptionalInteger(value) {
10
10
  return typeof value === "number" && Number.isInteger(value) ? value : undefined;
11
11
  }
12
+ function parseServiceRuntimeStatus(value) {
13
+ if (!isRecord(value)) {
14
+ return { ports: [] };
15
+ }
16
+ const portsRaw = value["ports"];
17
+ return {
18
+ ports: Array.isArray(portsRaw) ? portsRaw.map((port) => parseServicePortRuntimeState(port)) : [],
19
+ };
20
+ }
21
+ function parseServicePortRuntimeState(value) {
22
+ if (!isRecord(value)) {
23
+ throw new RoomServerException("unexpected return type from services.list");
24
+ }
25
+ const num = value["num"];
26
+ if (num !== "*" && typeof num !== "number") {
27
+ throw new RoomServerException("unexpected return type from services.list");
28
+ }
29
+ const liveness = value["liveness"];
30
+ const livenessStatus = value["liveness_status"];
31
+ const lastError = value["last_error"];
32
+ return {
33
+ num,
34
+ liveness: typeof liveness === "string" ? liveness : undefined,
35
+ livenessStatus: livenessStatus === "not_ready" || livenessStatus === "ready" ? livenessStatus : "not_configured",
36
+ lastCheckedAt: toOptionalNumber(value["last_checked_at"]),
37
+ lastError: typeof lastError === "string" ? lastError : undefined,
38
+ };
39
+ }
12
40
  function parseServiceRuntimeState(value) {
13
41
  if (!isRecord(value) || typeof value["service_id"] !== "string") {
14
42
  throw new RoomServerException("unexpected return type from services.list");
@@ -27,6 +55,7 @@ function parseServiceRuntimeState(value) {
27
55
  lastExitAt: toOptionalNumber(value["last_exit_at"]),
28
56
  lastStartError: typeof value["last_start_error"] === "string" ? value["last_start_error"] : undefined,
29
57
  lastStartErrorAt: toOptionalNumber(value["last_start_error_at"]),
58
+ status: parseServiceRuntimeStatus(value["status"]),
30
59
  events: Array.isArray(eventsRaw) ? eventsRaw.map((event) => parseServiceRuntimeEvent(event)) : [],
31
60
  };
32
61
  }
@@ -64,9 +93,6 @@ export class ServicesClient {
64
93
  return new RoomServerException(`unexpected return type from services.${operation}`);
65
94
  }
66
95
  async list() {
67
- return (await this.listWithState()).services;
68
- }
69
- async listWithState() {
70
96
  const response = await this.room.invokeContent({
71
97
  toolkit: "services",
72
98
  tool: "list",
@@ -49,6 +49,16 @@ export declare class SqliteDatabaseClient {
49
49
  data?: Iterable<Table> | Table;
50
50
  mode?: SqliteCreateMode;
51
51
  }): Promise<void>;
52
+ createTableFromArrowTable(params: {
53
+ name: string;
54
+ table: Table;
55
+ mode?: SqliteCreateMode;
56
+ }): Promise<void>;
57
+ createTableFromArrowBatches(params: {
58
+ name: string;
59
+ batches: ArrowTableChunks;
60
+ mode?: SqliteCreateMode;
61
+ }): Promise<void>;
52
62
  dropTable(params: {
53
63
  name: string;
54
64
  ignoreMissing?: boolean;
@@ -64,6 +74,10 @@ export declare class SqliteDatabaseClient {
64
74
  table: string;
65
75
  newColumns: Schema;
66
76
  }): Promise<void>;
77
+ addColumnsWithSchema(params: {
78
+ table: string;
79
+ schema: Schema;
80
+ }): Promise<void>;
67
81
  dropColumns(params: {
68
82
  table: string;
69
83
  columns: string[];
@@ -72,6 +86,10 @@ export declare class SqliteDatabaseClient {
72
86
  table: string;
73
87
  records: Table;
74
88
  }): Promise<void>;
89
+ insertTable(params: {
90
+ table: string;
91
+ records: Table;
92
+ }): Promise<void>;
75
93
  update(params: {
76
94
  table: string;
77
95
  where: string;
@@ -184,6 +202,20 @@ export declare class SqliteClient {
184
202
  mode?: SqliteCreateMode;
185
203
  namespace?: string[];
186
204
  }): Promise<void>;
205
+ createTableFromArrowTable({ database, name, table, mode, namespace }: {
206
+ database: string;
207
+ name: string;
208
+ table: Table;
209
+ mode?: SqliteCreateMode;
210
+ namespace?: string[];
211
+ }): Promise<void>;
212
+ createTableFromArrowBatches({ database, name, batches, mode, namespace }: {
213
+ database: string;
214
+ name: string;
215
+ batches: ArrowTableChunks;
216
+ mode?: SqliteCreateMode;
217
+ namespace?: string[];
218
+ }): Promise<void>;
187
219
  dropTable({ database, name, ignoreMissing, namespace }: {
188
220
  database: string;
189
221
  name: string;
@@ -207,6 +239,12 @@ export declare class SqliteClient {
207
239
  newColumns: Schema;
208
240
  namespace?: string[];
209
241
  }): Promise<void>;
242
+ addColumnsWithSchema({ database, table, schema, namespace }: {
243
+ database: string;
244
+ table: string;
245
+ schema: Schema;
246
+ namespace?: string[];
247
+ }): Promise<void>;
210
248
  dropColumns({ database, table, columns, namespace }: {
211
249
  database: string;
212
250
  table: string;
@@ -219,6 +257,12 @@ export declare class SqliteClient {
219
257
  records: Table;
220
258
  namespace?: string[];
221
259
  }): Promise<void>;
260
+ insertTable({ database, table, records, namespace }: {
261
+ database: string;
262
+ table: string;
263
+ records: Table;
264
+ namespace?: string[];
265
+ }): Promise<void>;
222
266
  insertStream({ database, table, chunks, namespace }: {
223
267
  database: string;
224
268
  table: string;
@@ -18,6 +18,9 @@ async function* toAsyncArrowIterable(chunks) {
18
18
  function isRecord(value) {
19
19
  return typeof value === "object" && value !== null && !Array.isArray(value);
20
20
  }
21
+ function isStringArray(value) {
22
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
23
+ }
21
24
  function bytesToBase64(bytes) {
22
25
  if (globalScope.Buffer) {
23
26
  return globalScope.Buffer.from(bytes).toString("base64");
@@ -226,6 +229,12 @@ export class SqliteDatabaseClient {
226
229
  async createTableFromData(params) {
227
230
  return this.client.createTableFromData({ ...params, database: this.database, namespace: this.namespace });
228
231
  }
232
+ async createTableFromArrowTable(params) {
233
+ return this.client.createTableFromArrowTable({ ...params, database: this.database, namespace: this.namespace });
234
+ }
235
+ async createTableFromArrowBatches(params) {
236
+ return this.client.createTableFromArrowBatches({ ...params, database: this.database, namespace: this.namespace });
237
+ }
229
238
  async dropTable(params) {
230
239
  return this.client.dropTable({ ...params, database: this.database, namespace: this.namespace });
231
240
  }
@@ -238,12 +247,18 @@ export class SqliteDatabaseClient {
238
247
  async addColumns(params) {
239
248
  return this.client.addColumns({ ...params, database: this.database, namespace: this.namespace });
240
249
  }
250
+ async addColumnsWithSchema(params) {
251
+ return this.client.addColumnsWithSchema({ ...params, database: this.database, namespace: this.namespace });
252
+ }
241
253
  async dropColumns(params) {
242
254
  return this.client.dropColumns({ ...params, database: this.database, namespace: this.namespace });
243
255
  }
244
256
  async insert(params) {
245
257
  return this.client.insert({ ...params, database: this.database, namespace: this.namespace });
246
258
  }
259
+ async insertTable(params) {
260
+ return this.client.insertTable({ ...params, database: this.database, namespace: this.namespace });
261
+ }
247
262
  async update(params) {
248
263
  return this.client.update({ ...params, database: this.database, namespace: this.namespace });
249
264
  }
@@ -348,7 +363,7 @@ export class SqliteClient {
348
363
  }
349
364
  async listDatabases({ namespace } = {}) {
350
365
  const response = await this.invoke("list_databases", { namespace: namespace ?? null });
351
- if (!(response instanceof JsonContent) || !Array.isArray(response.json.databases)) {
366
+ if (!(response instanceof JsonContent) || !isStringArray(response.json.databases)) {
352
367
  throw this.unexpectedResponseError("list_databases");
353
368
  }
354
369
  return response.json.databases;
@@ -379,7 +394,7 @@ export class SqliteClient {
379
394
  }
380
395
  async listTables({ database, namespace }) {
381
396
  const response = await this.invoke("list_tables", { database, namespace: namespace ?? null });
382
- if (!(response instanceof JsonContent) || !Array.isArray(response.json.tables)) {
397
+ if (!(response instanceof JsonContent) || !isStringArray(response.json.tables)) {
383
398
  throw this.unexpectedResponseError("list_tables");
384
399
  }
385
400
  return response.json.tables;
@@ -413,6 +428,12 @@ export class SqliteClient {
413
428
  namespace,
414
429
  });
415
430
  }
431
+ async createTableFromArrowTable({ database, name, table, mode = "create", namespace }) {
432
+ return this.createTableWithSchema({ database, name, schema: table.schema, data: table, mode, namespace });
433
+ }
434
+ async createTableFromArrowBatches({ database, name, batches, mode = "create", namespace }) {
435
+ return this.createTable({ database, name, data: batches, mode, namespace });
436
+ }
416
437
  async dropTable({ database, name, ignoreMissing = false, namespace }) {
417
438
  const response = await this.invoke("drop_table", { database, name, ignore_missing: ignoreMissing, namespace: namespace ?? null });
418
439
  if (!(response instanceof EmptyContent)) {
@@ -446,6 +467,9 @@ export class SqliteClient {
446
467
  throw this.unexpectedResponseError("add_columns");
447
468
  }
448
469
  }
470
+ async addColumnsWithSchema({ database, table, schema, namespace }) {
471
+ return this.addColumns({ database, table, newColumns: schema, namespace });
472
+ }
449
473
  async dropColumns({ database, table, columns, namespace }) {
450
474
  const response = await this.invoke("drop_columns", { database, table, columns, namespace: namespace ?? null });
451
475
  if (!(response instanceof EmptyContent)) {
@@ -455,6 +479,9 @@ export class SqliteClient {
455
479
  async insert({ database, table, records, namespace }) {
456
480
  await this.insertStream({ database, table, chunks: [records], namespace });
457
481
  }
482
+ async insertTable({ database, table, records, namespace }) {
483
+ await this.insert({ database, table, records, namespace });
484
+ }
458
485
  async insertStream({ database, table, chunks, namespace }) {
459
486
  const input = new SqliteArrowWriteInputStream({
460
487
  kind: "start",
@@ -159,7 +159,6 @@ export interface SecretVersion {
159
159
  id: string;
160
160
  secret_id: string;
161
161
  version: number;
162
- encryption_key_id: string;
163
162
  value_sha256?: string | null;
164
163
  created_by_user_id?: string | null;
165
164
  created_by_service_account_id?: string | null;
@@ -1,5 +1,6 @@
1
1
  import type { ServiceSpec } from "./meshagent-client.js";
2
2
  import { RoomClient } from "./room-client.js";
3
+ export type ServicePortNum = NonNullable<ServiceSpec["ports"]>[number]["num"];
3
4
  export interface ServiceRuntimeState {
4
5
  serviceId: string;
5
6
  state: string;
@@ -11,8 +12,19 @@ export interface ServiceRuntimeState {
11
12
  lastExitAt?: number;
12
13
  lastStartError?: string;
13
14
  lastStartErrorAt?: number;
15
+ status: ServiceRuntimeStatus;
14
16
  events: ServiceRuntimeEvent[];
15
17
  }
18
+ export interface ServiceRuntimeStatus {
19
+ ports: ServicePortRuntimeState[];
20
+ }
21
+ export interface ServicePortRuntimeState {
22
+ num: ServicePortNum;
23
+ liveness?: string;
24
+ livenessStatus: "not_configured" | "not_ready" | "ready";
25
+ lastCheckedAt?: number;
26
+ lastError?: string;
27
+ }
16
28
  export interface ServiceRuntimeEvent {
17
29
  type: string;
18
30
  reason: string;
@@ -31,8 +43,7 @@ export declare class ServicesClient {
31
43
  room: RoomClient;
32
44
  });
33
45
  private unexpectedResponse;
34
- list(): Promise<ServiceSpec[]>;
35
- listWithState(): Promise<ListServicesResult>;
46
+ list(): Promise<ListServicesResult>;
36
47
  restart(params: {
37
48
  serviceId: string;
38
49
  }): Promise<void>;
@@ -12,6 +12,34 @@ function toOptionalNumber(value) {
12
12
  function toOptionalInteger(value) {
13
13
  return typeof value === "number" && Number.isInteger(value) ? value : undefined;
14
14
  }
15
+ function parseServiceRuntimeStatus(value) {
16
+ if (!isRecord(value)) {
17
+ return { ports: [] };
18
+ }
19
+ const portsRaw = value["ports"];
20
+ return {
21
+ ports: Array.isArray(portsRaw) ? portsRaw.map((port) => parseServicePortRuntimeState(port)) : [],
22
+ };
23
+ }
24
+ function parseServicePortRuntimeState(value) {
25
+ if (!isRecord(value)) {
26
+ throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
27
+ }
28
+ const num = value["num"];
29
+ if (num !== "*" && typeof num !== "number") {
30
+ throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
31
+ }
32
+ const liveness = value["liveness"];
33
+ const livenessStatus = value["liveness_status"];
34
+ const lastError = value["last_error"];
35
+ return {
36
+ num,
37
+ liveness: typeof liveness === "string" ? liveness : undefined,
38
+ livenessStatus: livenessStatus === "not_ready" || livenessStatus === "ready" ? livenessStatus : "not_configured",
39
+ lastCheckedAt: toOptionalNumber(value["last_checked_at"]),
40
+ lastError: typeof lastError === "string" ? lastError : undefined,
41
+ };
42
+ }
15
43
  function parseServiceRuntimeState(value) {
16
44
  if (!isRecord(value) || typeof value["service_id"] !== "string") {
17
45
  throw new room_server_client_js_1.RoomServerException("unexpected return type from services.list");
@@ -30,6 +58,7 @@ function parseServiceRuntimeState(value) {
30
58
  lastExitAt: toOptionalNumber(value["last_exit_at"]),
31
59
  lastStartError: typeof value["last_start_error"] === "string" ? value["last_start_error"] : undefined,
32
60
  lastStartErrorAt: toOptionalNumber(value["last_start_error_at"]),
61
+ status: parseServiceRuntimeStatus(value["status"]),
33
62
  events: Array.isArray(eventsRaw) ? eventsRaw.map((event) => parseServiceRuntimeEvent(event)) : [],
34
63
  };
35
64
  }
@@ -67,9 +96,6 @@ class ServicesClient {
67
96
  return new room_server_client_js_1.RoomServerException(`unexpected return type from services.${operation}`);
68
97
  }
69
98
  async list() {
70
- return (await this.listWithState()).services;
71
- }
72
- async listWithState() {
73
99
  const response = await this.room.invokeContent({
74
100
  toolkit: "services",
75
101
  tool: "list",
@@ -49,6 +49,16 @@ export declare class SqliteDatabaseClient {
49
49
  data?: Iterable<Table> | Table;
50
50
  mode?: SqliteCreateMode;
51
51
  }): Promise<void>;
52
+ createTableFromArrowTable(params: {
53
+ name: string;
54
+ table: Table;
55
+ mode?: SqliteCreateMode;
56
+ }): Promise<void>;
57
+ createTableFromArrowBatches(params: {
58
+ name: string;
59
+ batches: ArrowTableChunks;
60
+ mode?: SqliteCreateMode;
61
+ }): Promise<void>;
52
62
  dropTable(params: {
53
63
  name: string;
54
64
  ignoreMissing?: boolean;
@@ -64,6 +74,10 @@ export declare class SqliteDatabaseClient {
64
74
  table: string;
65
75
  newColumns: Schema;
66
76
  }): Promise<void>;
77
+ addColumnsWithSchema(params: {
78
+ table: string;
79
+ schema: Schema;
80
+ }): Promise<void>;
67
81
  dropColumns(params: {
68
82
  table: string;
69
83
  columns: string[];
@@ -72,6 +86,10 @@ export declare class SqliteDatabaseClient {
72
86
  table: string;
73
87
  records: Table;
74
88
  }): Promise<void>;
89
+ insertTable(params: {
90
+ table: string;
91
+ records: Table;
92
+ }): Promise<void>;
75
93
  update(params: {
76
94
  table: string;
77
95
  where: string;
@@ -184,6 +202,20 @@ export declare class SqliteClient {
184
202
  mode?: SqliteCreateMode;
185
203
  namespace?: string[];
186
204
  }): Promise<void>;
205
+ createTableFromArrowTable({ database, name, table, mode, namespace }: {
206
+ database: string;
207
+ name: string;
208
+ table: Table;
209
+ mode?: SqliteCreateMode;
210
+ namespace?: string[];
211
+ }): Promise<void>;
212
+ createTableFromArrowBatches({ database, name, batches, mode, namespace }: {
213
+ database: string;
214
+ name: string;
215
+ batches: ArrowTableChunks;
216
+ mode?: SqliteCreateMode;
217
+ namespace?: string[];
218
+ }): Promise<void>;
187
219
  dropTable({ database, name, ignoreMissing, namespace }: {
188
220
  database: string;
189
221
  name: string;
@@ -207,6 +239,12 @@ export declare class SqliteClient {
207
239
  newColumns: Schema;
208
240
  namespace?: string[];
209
241
  }): Promise<void>;
242
+ addColumnsWithSchema({ database, table, schema, namespace }: {
243
+ database: string;
244
+ table: string;
245
+ schema: Schema;
246
+ namespace?: string[];
247
+ }): Promise<void>;
210
248
  dropColumns({ database, table, columns, namespace }: {
211
249
  database: string;
212
250
  table: string;
@@ -219,6 +257,12 @@ export declare class SqliteClient {
219
257
  records: Table;
220
258
  namespace?: string[];
221
259
  }): Promise<void>;
260
+ insertTable({ database, table, records, namespace }: {
261
+ database: string;
262
+ table: string;
263
+ records: Table;
264
+ namespace?: string[];
265
+ }): Promise<void>;
222
266
  insertStream({ database, table, chunks, namespace }: {
223
267
  database: string;
224
268
  table: string;
@@ -21,6 +21,9 @@ async function* toAsyncArrowIterable(chunks) {
21
21
  function isRecord(value) {
22
22
  return typeof value === "object" && value !== null && !Array.isArray(value);
23
23
  }
24
+ function isStringArray(value) {
25
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
26
+ }
24
27
  function bytesToBase64(bytes) {
25
28
  if (globalScope.Buffer) {
26
29
  return globalScope.Buffer.from(bytes).toString("base64");
@@ -229,6 +232,12 @@ class SqliteDatabaseClient {
229
232
  async createTableFromData(params) {
230
233
  return this.client.createTableFromData({ ...params, database: this.database, namespace: this.namespace });
231
234
  }
235
+ async createTableFromArrowTable(params) {
236
+ return this.client.createTableFromArrowTable({ ...params, database: this.database, namespace: this.namespace });
237
+ }
238
+ async createTableFromArrowBatches(params) {
239
+ return this.client.createTableFromArrowBatches({ ...params, database: this.database, namespace: this.namespace });
240
+ }
232
241
  async dropTable(params) {
233
242
  return this.client.dropTable({ ...params, database: this.database, namespace: this.namespace });
234
243
  }
@@ -241,12 +250,18 @@ class SqliteDatabaseClient {
241
250
  async addColumns(params) {
242
251
  return this.client.addColumns({ ...params, database: this.database, namespace: this.namespace });
243
252
  }
253
+ async addColumnsWithSchema(params) {
254
+ return this.client.addColumnsWithSchema({ ...params, database: this.database, namespace: this.namespace });
255
+ }
244
256
  async dropColumns(params) {
245
257
  return this.client.dropColumns({ ...params, database: this.database, namespace: this.namespace });
246
258
  }
247
259
  async insert(params) {
248
260
  return this.client.insert({ ...params, database: this.database, namespace: this.namespace });
249
261
  }
262
+ async insertTable(params) {
263
+ return this.client.insertTable({ ...params, database: this.database, namespace: this.namespace });
264
+ }
250
265
  async update(params) {
251
266
  return this.client.update({ ...params, database: this.database, namespace: this.namespace });
252
267
  }
@@ -352,7 +367,7 @@ class SqliteClient {
352
367
  }
353
368
  async listDatabases({ namespace } = {}) {
354
369
  const response = await this.invoke("list_databases", { namespace: namespace ?? null });
355
- if (!(response instanceof response_js_1.JsonContent) || !Array.isArray(response.json.databases)) {
370
+ if (!(response instanceof response_js_1.JsonContent) || !isStringArray(response.json.databases)) {
356
371
  throw this.unexpectedResponseError("list_databases");
357
372
  }
358
373
  return response.json.databases;
@@ -383,7 +398,7 @@ class SqliteClient {
383
398
  }
384
399
  async listTables({ database, namespace }) {
385
400
  const response = await this.invoke("list_tables", { database, namespace: namespace ?? null });
386
- if (!(response instanceof response_js_1.JsonContent) || !Array.isArray(response.json.tables)) {
401
+ if (!(response instanceof response_js_1.JsonContent) || !isStringArray(response.json.tables)) {
387
402
  throw this.unexpectedResponseError("list_tables");
388
403
  }
389
404
  return response.json.tables;
@@ -417,6 +432,12 @@ class SqliteClient {
417
432
  namespace,
418
433
  });
419
434
  }
435
+ async createTableFromArrowTable({ database, name, table, mode = "create", namespace }) {
436
+ return this.createTableWithSchema({ database, name, schema: table.schema, data: table, mode, namespace });
437
+ }
438
+ async createTableFromArrowBatches({ database, name, batches, mode = "create", namespace }) {
439
+ return this.createTable({ database, name, data: batches, mode, namespace });
440
+ }
420
441
  async dropTable({ database, name, ignoreMissing = false, namespace }) {
421
442
  const response = await this.invoke("drop_table", { database, name, ignore_missing: ignoreMissing, namespace: namespace ?? null });
422
443
  if (!(response instanceof response_js_1.EmptyContent)) {
@@ -450,6 +471,9 @@ class SqliteClient {
450
471
  throw this.unexpectedResponseError("add_columns");
451
472
  }
452
473
  }
474
+ async addColumnsWithSchema({ database, table, schema, namespace }) {
475
+ return this.addColumns({ database, table, newColumns: schema, namespace });
476
+ }
453
477
  async dropColumns({ database, table, columns, namespace }) {
454
478
  const response = await this.invoke("drop_columns", { database, table, columns, namespace: namespace ?? null });
455
479
  if (!(response instanceof response_js_1.EmptyContent)) {
@@ -459,6 +483,9 @@ class SqliteClient {
459
483
  async insert({ database, table, records, namespace }) {
460
484
  await this.insertStream({ database, table, chunks: [records], namespace });
461
485
  }
486
+ async insertTable({ database, table, records, namespace }) {
487
+ await this.insert({ database, table, records, namespace });
488
+ }
462
489
  async insertStream({ database, table, chunks, namespace }) {
463
490
  const input = new SqliteArrowWriteInputStream({
464
491
  kind: "start",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent",
3
- "version": "0.45.6",
3
+ "version": "0.46.0",
4
4
  "description": "Meshagent Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-ts",
6
6
  "scripts": {