@alva-ai/toolkit 0.14.1-beta.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.d.cts CHANGED
@@ -188,6 +188,12 @@ interface CronjobCreateRequest {
188
188
  push_notify?: boolean;
189
189
  /** Override per-cronjob V8 heap limit (MB). Valid range 1–2046. */
190
190
  max_heap_size_mb?: number;
191
+ /**
192
+ * Run the cronjob under a restricted service-account identity (an SA id
193
+ * owned by the caller) instead of the owner (#602). Omitted ⇒ runs as owner.
194
+ * A string: SA ids are snowflake int64s that overflow JS number precision.
195
+ */
196
+ run_as_user_id?: string;
191
197
  }
192
198
  interface Cronjob {
193
199
  id: number;
@@ -199,6 +205,11 @@ interface Cronjob {
199
205
  push_notify: boolean;
200
206
  /** Per-cronjob V8 heap cap (MB). null when using the server default. */
201
207
  max_heap_size_mb: number | null;
208
+ /**
209
+ * SA id the cronjob runs as, or "0" when it runs as the owner (#602).
210
+ * A string: snowflake int64 ids overflow JS number precision.
211
+ */
212
+ run_as_user_id: string;
202
213
  created_at: string;
203
214
  updated_at: string;
204
215
  }
@@ -218,6 +229,12 @@ interface CronjobUpdateRequest {
218
229
  push_notify?: boolean;
219
230
  /** Override per-cronjob V8 heap limit (MB). Valid range 1–2046. */
220
231
  max_heap_size_mb?: number;
232
+ /**
233
+ * Re-point the cronjob at a service-account identity, or "0" to clear it back
234
+ * to the owner (#602). Omitted ⇒ run_as unchanged.
235
+ * A string: SA ids are snowflake int64s that overflow JS number precision.
236
+ */
237
+ run_as_user_id?: string;
221
238
  }
222
239
  interface CronjobRunsListParams {
223
240
  cronjob_id: number;
@@ -850,6 +867,27 @@ interface ChannelGroupSubscriptionMutationResponse {
850
867
  admin: ChannelGroupAdminInfo | null;
851
868
  subscriptions: ChannelGroupSubscription[];
852
869
  }
870
+ interface ServiceAccount {
871
+ id: string;
872
+ display_name: string;
873
+ username: string;
874
+ parent_user_id: string;
875
+ created_at?: number;
876
+ }
877
+ interface ServiceAccountCreateRequest {
878
+ display_name: string;
879
+ }
880
+ interface ServiceAccountCreateResponse {
881
+ service_account: ServiceAccount;
882
+ }
883
+ interface ServiceAccountListResponse {
884
+ service_accounts: ServiceAccount[];
885
+ }
886
+ interface ServiceAccountGrantRequest {
887
+ id: string;
888
+ path: string;
889
+ permission: string;
890
+ }
853
891
 
854
892
  declare class FsResource {
855
893
  private client;
@@ -923,6 +961,25 @@ declare class DeployResource {
923
961
  }): Promise<CronjobRunLogsResponse>;
924
962
  }
925
963
 
964
+ /**
965
+ * Service-account lifecycle: create a restricted run-as identity, list/delete
966
+ * the ones you own, and grant/revoke its ALFS paths. Set the resulting id as
967
+ * `--run-as-service-account` on a UDF or cronjob to run it under that scoped
968
+ * identity (billing/audit stay with you). See the service-accounts skill
969
+ * reference. Owner-gated by the backend — an SA cannot manage SAs.
970
+ */
971
+ declare class ServiceAccountResource {
972
+ private client;
973
+ constructor(client: AlvaClient);
974
+ create(params: ServiceAccountCreateRequest): Promise<ServiceAccountCreateResponse>;
975
+ list(): Promise<ServiceAccountListResponse>;
976
+ delete(params: {
977
+ id: string;
978
+ }): Promise<void>;
979
+ grant(params: ServiceAccountGrantRequest): Promise<void>;
980
+ revoke(params: ServiceAccountGrantRequest): Promise<void>;
981
+ }
982
+
926
983
  declare class ReleaseResource {
927
984
  private client;
928
985
  constructor(client: AlvaClient);
@@ -1455,6 +1512,13 @@ interface RegisterFunctionParams {
1455
1512
  entry_script_path: string;
1456
1513
  params_schema?: string;
1457
1514
  allow_charges?: boolean;
1515
+ /**
1516
+ * Run invocations of this function under a restricted service-account
1517
+ * identity (an SA id owned by the caller) instead of the owner (#602).
1518
+ * Omitted ⇒ runs as the owner. A string: SA ids are snowflake int64s that
1519
+ * overflow JS number precision.
1520
+ */
1521
+ run_as_user_id?: string;
1458
1522
  }
1459
1523
  interface RegisterFunctionResponse {
1460
1524
  function?: PlaybookFunction;
@@ -1573,6 +1637,7 @@ declare class AlvaClient {
1573
1637
  private _fs?;
1574
1638
  private _run?;
1575
1639
  private _deploy?;
1640
+ private _serviceAccount?;
1576
1641
  private _release?;
1577
1642
  private _feed?;
1578
1643
  private _playbooks?;
@@ -1598,6 +1663,7 @@ declare class AlvaClient {
1598
1663
  get fs(): FsResource;
1599
1664
  get run(): RunResource;
1600
1665
  get deploy(): DeployResource;
1666
+ get serviceAccount(): ServiceAccountResource;
1601
1667
  get release(): ReleaseResource;
1602
1668
  get feed(): FeedResource;
1603
1669
  get playbooks(): PlaybooksResource;
package/dist/index.d.ts CHANGED
@@ -188,6 +188,12 @@ interface CronjobCreateRequest {
188
188
  push_notify?: boolean;
189
189
  /** Override per-cronjob V8 heap limit (MB). Valid range 1–2046. */
190
190
  max_heap_size_mb?: number;
191
+ /**
192
+ * Run the cronjob under a restricted service-account identity (an SA id
193
+ * owned by the caller) instead of the owner (#602). Omitted ⇒ runs as owner.
194
+ * A string: SA ids are snowflake int64s that overflow JS number precision.
195
+ */
196
+ run_as_user_id?: string;
191
197
  }
192
198
  interface Cronjob {
193
199
  id: number;
@@ -199,6 +205,11 @@ interface Cronjob {
199
205
  push_notify: boolean;
200
206
  /** Per-cronjob V8 heap cap (MB). null when using the server default. */
201
207
  max_heap_size_mb: number | null;
208
+ /**
209
+ * SA id the cronjob runs as, or "0" when it runs as the owner (#602).
210
+ * A string: snowflake int64 ids overflow JS number precision.
211
+ */
212
+ run_as_user_id: string;
202
213
  created_at: string;
203
214
  updated_at: string;
204
215
  }
@@ -218,6 +229,12 @@ interface CronjobUpdateRequest {
218
229
  push_notify?: boolean;
219
230
  /** Override per-cronjob V8 heap limit (MB). Valid range 1–2046. */
220
231
  max_heap_size_mb?: number;
232
+ /**
233
+ * Re-point the cronjob at a service-account identity, or "0" to clear it back
234
+ * to the owner (#602). Omitted ⇒ run_as unchanged.
235
+ * A string: SA ids are snowflake int64s that overflow JS number precision.
236
+ */
237
+ run_as_user_id?: string;
221
238
  }
222
239
  interface CronjobRunsListParams {
223
240
  cronjob_id: number;
@@ -850,6 +867,27 @@ interface ChannelGroupSubscriptionMutationResponse {
850
867
  admin: ChannelGroupAdminInfo | null;
851
868
  subscriptions: ChannelGroupSubscription[];
852
869
  }
870
+ interface ServiceAccount {
871
+ id: string;
872
+ display_name: string;
873
+ username: string;
874
+ parent_user_id: string;
875
+ created_at?: number;
876
+ }
877
+ interface ServiceAccountCreateRequest {
878
+ display_name: string;
879
+ }
880
+ interface ServiceAccountCreateResponse {
881
+ service_account: ServiceAccount;
882
+ }
883
+ interface ServiceAccountListResponse {
884
+ service_accounts: ServiceAccount[];
885
+ }
886
+ interface ServiceAccountGrantRequest {
887
+ id: string;
888
+ path: string;
889
+ permission: string;
890
+ }
853
891
 
854
892
  declare class FsResource {
855
893
  private client;
@@ -923,6 +961,25 @@ declare class DeployResource {
923
961
  }): Promise<CronjobRunLogsResponse>;
924
962
  }
925
963
 
964
+ /**
965
+ * Service-account lifecycle: create a restricted run-as identity, list/delete
966
+ * the ones you own, and grant/revoke its ALFS paths. Set the resulting id as
967
+ * `--run-as-service-account` on a UDF or cronjob to run it under that scoped
968
+ * identity (billing/audit stay with you). See the service-accounts skill
969
+ * reference. Owner-gated by the backend — an SA cannot manage SAs.
970
+ */
971
+ declare class ServiceAccountResource {
972
+ private client;
973
+ constructor(client: AlvaClient);
974
+ create(params: ServiceAccountCreateRequest): Promise<ServiceAccountCreateResponse>;
975
+ list(): Promise<ServiceAccountListResponse>;
976
+ delete(params: {
977
+ id: string;
978
+ }): Promise<void>;
979
+ grant(params: ServiceAccountGrantRequest): Promise<void>;
980
+ revoke(params: ServiceAccountGrantRequest): Promise<void>;
981
+ }
982
+
926
983
  declare class ReleaseResource {
927
984
  private client;
928
985
  constructor(client: AlvaClient);
@@ -1455,6 +1512,13 @@ interface RegisterFunctionParams {
1455
1512
  entry_script_path: string;
1456
1513
  params_schema?: string;
1457
1514
  allow_charges?: boolean;
1515
+ /**
1516
+ * Run invocations of this function under a restricted service-account
1517
+ * identity (an SA id owned by the caller) instead of the owner (#602).
1518
+ * Omitted ⇒ runs as the owner. A string: SA ids are snowflake int64s that
1519
+ * overflow JS number precision.
1520
+ */
1521
+ run_as_user_id?: string;
1458
1522
  }
1459
1523
  interface RegisterFunctionResponse {
1460
1524
  function?: PlaybookFunction;
@@ -1573,6 +1637,7 @@ declare class AlvaClient {
1573
1637
  private _fs?;
1574
1638
  private _run?;
1575
1639
  private _deploy?;
1640
+ private _serviceAccount?;
1576
1641
  private _release?;
1577
1642
  private _feed?;
1578
1643
  private _playbooks?;
@@ -1598,6 +1663,7 @@ declare class AlvaClient {
1598
1663
  get fs(): FsResource;
1599
1664
  get run(): RunResource;
1600
1665
  get deploy(): DeployResource;
1666
+ get serviceAccount(): ServiceAccountResource;
1601
1667
  get release(): ReleaseResource;
1602
1668
  get feed(): FeedResource;
1603
1669
  get playbooks(): PlaybooksResource;
package/dist/index.js CHANGED
@@ -218,7 +218,8 @@ var DeployResource = class {
218
218
  cron_expression: params.cron_expression,
219
219
  args: params.args,
220
220
  push_notify: params.push_notify,
221
- max_heap_size_mb: params.max_heap_size_mb
221
+ max_heap_size_mb: params.max_heap_size_mb,
222
+ run_as_user_id: params.run_as_user_id
222
223
  }
223
224
  });
224
225
  }
@@ -298,6 +299,50 @@ var DeployResource = class {
298
299
  }
299
300
  };
300
301
 
302
+ // src/resources/serviceAccount.ts
303
+ var ServiceAccountResource = class {
304
+ constructor(client) {
305
+ this.client = client;
306
+ }
307
+ client;
308
+ async create(params) {
309
+ this.client._requireAuth();
310
+ return this.client._request("POST", "/api/v1/service-account", {
311
+ body: { display_name: params.display_name }
312
+ });
313
+ }
314
+ async list() {
315
+ this.client._requireAuth();
316
+ return this.client._request(
317
+ "GET",
318
+ "/api/v1/service-accounts"
319
+ );
320
+ }
321
+ async delete(params) {
322
+ this.client._requireAuth();
323
+ await this.client._request(
324
+ "DELETE",
325
+ `/api/v1/service-account/${params.id}`
326
+ );
327
+ }
328
+ async grant(params) {
329
+ this.client._requireAuth();
330
+ await this.client._request(
331
+ "POST",
332
+ `/api/v1/service-account/${params.id}/grant`,
333
+ { body: { path: params.path, permission: params.permission } }
334
+ );
335
+ }
336
+ async revoke(params) {
337
+ this.client._requireAuth();
338
+ await this.client._request(
339
+ "POST",
340
+ `/api/v1/service-account/${params.id}/revoke`,
341
+ { body: { path: params.path, permission: params.permission } }
342
+ );
343
+ }
344
+ };
345
+
301
346
  // src/resources/release.ts
302
347
  var ReleaseResource = class {
303
348
  constructor(client) {
@@ -2408,7 +2453,8 @@ var FunctionsResource = class {
2408
2453
  function_name: params.function_name,
2409
2454
  entry_script_path: params.entry_script_path,
2410
2455
  params_schema: params.params_schema,
2411
- allow_charges: params.allow_charges
2456
+ allow_charges: params.allow_charges,
2457
+ run_as_user_id: params.run_as_user_id
2412
2458
  }
2413
2459
  });
2414
2460
  }
@@ -2745,6 +2791,7 @@ var AlvaClient = class {
2745
2791
  _fs;
2746
2792
  _run;
2747
2793
  _deploy;
2794
+ _serviceAccount;
2748
2795
  _release;
2749
2796
  _feed;
2750
2797
  _playbooks;
@@ -2787,6 +2834,9 @@ var AlvaClient = class {
2787
2834
  get deploy() {
2788
2835
  return this._deploy ??= new DeployResource(this);
2789
2836
  }
2837
+ get serviceAccount() {
2838
+ return this._serviceAccount ??= new ServiceAccountResource(this);
2839
+ }
2790
2840
  get release() {
2791
2841
  return this._release ??= new ReleaseResource(this);
2792
2842
  }
@@ -3451,7 +3501,7 @@ var installPlaybookRuntime = (targetWindow) => {
3451
3501
  };
3452
3502
 
3453
3503
  // src/index.ts
3454
- var VERSION = true ? "0.14.1-beta.0" : "dev";
3504
+ var VERSION = true ? "0.15.0" : "dev";
3455
3505
  export {
3456
3506
  AlvaClient,
3457
3507
  AlvaError,