@sparkvault/sdk-js 11.1.14 → 11.2.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
@@ -15194,6 +15194,7 @@ class VaultsModule {
15194
15194
  createdAt: v.created_at,
15195
15195
  ingotCount: v.ingot_count,
15196
15196
  storageBytes: v.storage_bytes,
15197
+ ...mapLifecycle(v),
15197
15198
  })),
15198
15199
  nextCursor: response.data.next_cursor,
15199
15200
  };
@@ -15208,18 +15209,7 @@ class VaultsModule {
15208
15209
  async get(vaultId) {
15209
15210
  const id = requireResourceId(vaultId, 'vaultId');
15210
15211
  const response = await this.http.get(apiPath `/v1/vaults/${id}`);
15211
- const v = response.data;
15212
- return {
15213
- id: v.vault_id,
15214
- name: v.name,
15215
- description: v.description ?? null,
15216
- status: v.status,
15217
- ingotCount: v.ingot_count ?? 0,
15218
- storageBytes: v.storage_bytes ?? 0,
15219
- createdAt: v.created_at,
15220
- lastUnsealedAt: v.last_unsealed_at ?? null,
15221
- unsealCount: v.unseal_count ?? 0,
15222
- };
15212
+ return mapVaultDetail(response.data);
15223
15213
  }
15224
15214
  /**
15225
15215
  * Rename a vault.
@@ -15254,7 +15244,8 @@ class VaultsModule {
15254
15244
  await this.http.post(apiPath `/v1/vaults/${id}/seal`);
15255
15245
  }
15256
15246
  /**
15257
- * Delete a vault and all its ingots. This action is irreversible!
15247
+ * Schedule permanent deletion in seven days and immediately lock all vault access.
15248
+ * Company admins only; cancelDeletion can abort this schedule before its deadline.
15258
15249
  *
15259
15250
  * Requires the vault's exact name as confirmation, matched case-sensitively.
15260
15251
  * The name is sent base64(UTF-8) as the `X-Confirm-Name-B64` header so a vault
@@ -15269,9 +15260,32 @@ class VaultsModule {
15269
15260
  if (!name) {
15270
15261
  throw new ValidationError('Vault name is required to confirm deletion');
15271
15262
  }
15272
- await this.http.delete(apiPath `/v1/vaults/${id}`, {
15273
- headers: { 'X-Confirm-Name-B64': base64EncodeUtf8(name) },
15263
+ const response = await this.http.delete(apiPath `/v1/vaults/${id}`, {
15264
+ headers: {
15265
+ 'X-Confirm-Name-B64': base64EncodeUtf8(name),
15266
+ 'X-Vault-Deletion-Mode': 'schedule',
15267
+ },
15274
15268
  });
15269
+ const scheduled = response.data;
15270
+ return {
15271
+ id: scheduled.vault_id,
15272
+ status: scheduled.status,
15273
+ deletionRequestedAt: scheduled.deletion_requested_at,
15274
+ deletionScheduledFor: scheduled.deletion_scheduled_for,
15275
+ deletionRequestedBy: scheduled.deletion_requested_by,
15276
+ deletionScheduleId: scheduled.deletion_schedule_id,
15277
+ };
15278
+ }
15279
+ /** Cancel this exact deletion schedule before its deadline; company admins only. */
15280
+ async cancelDeletion(vaultId, deletionScheduleId) {
15281
+ const id = requireResourceId(vaultId, 'vaultId');
15282
+ if (!deletionScheduleId?.trim()) {
15283
+ throw new ValidationError('Deletion schedule is required to cancel deletion');
15284
+ }
15285
+ const response = await this.http.post(apiPath `/v1/vaults/${id}/deletion/cancel`, {
15286
+ deletion_schedule_id: deletionScheduleId,
15287
+ });
15288
+ return mapVaultDetail(response.data);
15275
15289
  }
15276
15290
  /**
15277
15291
  * Get a vault's public-sharing configuration.
@@ -15452,6 +15466,28 @@ class VaultsModule {
15452
15466
  }
15453
15467
  }
15454
15468
  }
15469
+ function mapLifecycle(v) {
15470
+ return {
15471
+ status: v.status,
15472
+ deletionRequestedAt: v.deletion_requested_at,
15473
+ deletionScheduledFor: v.deletion_scheduled_for,
15474
+ deletionRequestedBy: v.deletion_requested_by,
15475
+ deletionScheduleId: v.deletion_schedule_id,
15476
+ };
15477
+ }
15478
+ function mapVaultDetail(v) {
15479
+ return {
15480
+ id: v.vault_id,
15481
+ name: v.name,
15482
+ description: v.description ?? null,
15483
+ ...mapLifecycle(v),
15484
+ ingotCount: v.ingot_count ?? 0,
15485
+ storageBytes: v.storage_bytes ?? 0,
15486
+ createdAt: v.created_at,
15487
+ lastUnsealedAt: v.last_unsealed_at ?? null,
15488
+ unsealCount: v.unseal_count ?? 0,
15489
+ };
15490
+ }
15455
15491
  function mapSharingConfig$1(wire) {
15456
15492
  return {
15457
15493
  vaultId: wire.vault_id,
@@ -17384,7 +17420,7 @@ class SparkVault {
17384
17420
  }
17385
17421
  /** Get the SDK version */
17386
17422
  static get version() {
17387
- return '11.1.14';
17423
+ return '11.2.0';
17388
17424
  }
17389
17425
  }
17390
17426
  if (typeof window !== 'undefined') {