@alva-ai/toolkit 0.14.0 → 0.15.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/dist/index.cjs CHANGED
@@ -273,7 +273,8 @@ var DeployResource = class {
273
273
  cron_expression: params.cron_expression,
274
274
  args: params.args,
275
275
  push_notify: params.push_notify,
276
- max_heap_size_mb: params.max_heap_size_mb
276
+ max_heap_size_mb: params.max_heap_size_mb,
277
+ run_as_user_id: params.run_as_user_id
277
278
  }
278
279
  });
279
280
  }
@@ -353,6 +354,50 @@ var DeployResource = class {
353
354
  }
354
355
  };
355
356
 
357
+ // src/resources/serviceAccount.ts
358
+ var ServiceAccountResource = class {
359
+ constructor(client) {
360
+ this.client = client;
361
+ }
362
+ client;
363
+ async create(params) {
364
+ this.client._requireAuth();
365
+ return this.client._request("POST", "/api/v1/service-account", {
366
+ body: { display_name: params.display_name }
367
+ });
368
+ }
369
+ async list() {
370
+ this.client._requireAuth();
371
+ return this.client._request(
372
+ "GET",
373
+ "/api/v1/service-accounts"
374
+ );
375
+ }
376
+ async delete(params) {
377
+ this.client._requireAuth();
378
+ await this.client._request(
379
+ "DELETE",
380
+ `/api/v1/service-account/${params.id}`
381
+ );
382
+ }
383
+ async grant(params) {
384
+ this.client._requireAuth();
385
+ await this.client._request(
386
+ "POST",
387
+ `/api/v1/service-account/${params.id}/grant`,
388
+ { body: { path: params.path, permission: params.permission } }
389
+ );
390
+ }
391
+ async revoke(params) {
392
+ this.client._requireAuth();
393
+ await this.client._request(
394
+ "POST",
395
+ `/api/v1/service-account/${params.id}/revoke`,
396
+ { body: { path: params.path, permission: params.permission } }
397
+ );
398
+ }
399
+ };
400
+
356
401
  // src/resources/release.ts
357
402
  var ReleaseResource = class {
358
403
  constructor(client) {
@@ -2463,7 +2508,8 @@ var FunctionsResource = class {
2463
2508
  function_name: params.function_name,
2464
2509
  entry_script_path: params.entry_script_path,
2465
2510
  params_schema: params.params_schema,
2466
- allow_charges: params.allow_charges
2511
+ allow_charges: params.allow_charges,
2512
+ run_as_user_id: params.run_as_user_id
2467
2513
  }
2468
2514
  });
2469
2515
  }
@@ -2800,6 +2846,7 @@ var AlvaClient = class {
2800
2846
  _fs;
2801
2847
  _run;
2802
2848
  _deploy;
2849
+ _serviceAccount;
2803
2850
  _release;
2804
2851
  _feed;
2805
2852
  _playbooks;
@@ -2842,6 +2889,9 @@ var AlvaClient = class {
2842
2889
  get deploy() {
2843
2890
  return this._deploy ??= new DeployResource(this);
2844
2891
  }
2892
+ get serviceAccount() {
2893
+ return this._serviceAccount ??= new ServiceAccountResource(this);
2894
+ }
2845
2895
  get release() {
2846
2896
  return this._release ??= new ReleaseResource(this);
2847
2897
  }
@@ -3071,11 +3121,11 @@ var AlvaClient = class {
3071
3121
  if (response.status === 204) {
3072
3122
  return void 0;
3073
3123
  }
3074
- const contentType = response.headers.get("content-type") ?? "";
3075
- if (contentType.includes("application/octet-stream") || contentType.startsWith("text/") || contentType.includes("image/")) {
3076
- return response.arrayBuffer();
3124
+ const contentType = (response.headers.get("content-type") ?? "").toLowerCase();
3125
+ if (contentType.includes("application/json") || contentType.includes("+json")) {
3126
+ return response.json();
3077
3127
  }
3078
- return response.json();
3128
+ return response.arrayBuffer();
3079
3129
  }
3080
3130
  };
3081
3131
 
@@ -3506,7 +3556,7 @@ var installPlaybookRuntime = (targetWindow) => {
3506
3556
  };
3507
3557
 
3508
3558
  // src/index.ts
3509
- var VERSION = true ? "0.14.0" : "dev";
3559
+ var VERSION = true ? "0.15.0" : "dev";
3510
3560
  // Annotate the CommonJS export names for ESM import in node:
3511
3561
  0 && (module.exports = {
3512
3562
  AlvaClient,