@sparkvault/sdk-js 15.9.1 → 15.10.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.
@@ -0,0 +1,4 @@
1
+ import type { IngotHistory, IngotHistoryResponse } from './types';
2
+ /** Core files and Structured Ingots expose the same retained publication metadata. */
3
+ export declare function mapIngotHistory(data: IngotHistoryResponse): IngotHistory;
4
+ export declare function requireVersionId(value: unknown): string;
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { type ResolvedConfig } from '../config';
13
13
  import { HttpClient } from '../http';
14
- import type { UnsealedVault, Ingot, IngotUpload, UploadEnd, CreatedIngot, IngotDownloadLink, IngotDownload, DeleteIngotOptions, DownloadIngotOptions, CreateUploadOptions, UploadIngotOptions, SendUploadOptions, ResumeUploadOptions, UploadSession, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, FolderContents, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvitation, IngotAccessLogPage, AccessLogsOptions, HashCheckResponse } from './types';
14
+ import type { UnsealedVault, Ingot, IngotUpload, UploadEnd, CreatedIngot, IngotDownloadLink, IngotDownload, IngotHistory, IngotVersionDownloadLink, DeleteIngotOptions, DownloadIngotOptions, CreateUploadOptions, UploadIngotOptions, SendUploadOptions, ResumeUploadOptions, UploadSession, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, FolderContents, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvitation, IngotAccessLogPage, AccessLogsOptions, HashCheckResponse } from './types';
15
15
  export declare class IngotsModule {
16
16
  private readonly config;
17
17
  private readonly http;
@@ -260,6 +260,12 @@ export declare class IngotsModule {
260
260
  * } while (pageToken);
261
261
  */
262
262
  listContents(vault: UnsealedVault, options?: ListContentsOptions): Promise<FolderContents>;
263
+ /** List previous publications of a file, newest first. Structured objects use their product's history method. */
264
+ listVersions(vault: UnsealedVault, ingotId: string): Promise<IngotHistory>;
265
+ /** Mint a one-use link to a retained file publication; use downloadVersion to verify the served bytes. */
266
+ createVersionDownloadLink(vault: UnsealedVault, ingotId: string, versionId: string): Promise<IngotVersionDownloadLink>;
267
+ /** Download a retained file publication; never substitutes the current bytes if history is unavailable. */
268
+ downloadVersion(vault: UnsealedVault, ingotId: string, versionId: string): Promise<Blob>;
263
269
  /**
264
270
  * Create a signed download link for an ingot (discrete primitive).
265
271
  *
@@ -379,4 +385,4 @@ export { NAME_CONFLICT_POLICIES } from './types';
379
385
  export { fetchDownload } from './fetch-download';
380
386
  export { isReceivedUploadFailure } from '../vaults/upload/api';
381
387
  export type { FetchDownloadOptions, FetchedDownload } from './fetch-download';
382
- export type { NameConflictPolicy, UnsealedVault, Ingot, IngotUpload, UploadEnd, CreatedIngot, IngotDownloadLink, IngotDownload, DeleteIngotOptions, DownloadIngotOptions, CreateUploadOptions, UploadIngotOptions, SendUploadOptions, ResumeUploadOptions, UploadSession, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, FolderContents, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvite, IngotInvitation, IngotAccessLog, IngotAccessLogPage, AccessLogsOptions, HashCheckResponse, } from './types';
388
+ export type { NameConflictPolicy, UnsealedVault, Ingot, IngotUpload, UploadEnd, CreatedIngot, IngotDownloadLink, IngotDownload, IngotVersion, IngotHistory, IngotVersionDownloadLink, DeleteIngotOptions, DownloadIngotOptions, CreateUploadOptions, UploadIngotOptions, SendUploadOptions, ResumeUploadOptions, UploadSession, ReplaceIngotOptions, ListIngotsOptions, ListContentsOptions, FolderContents, SearchIngotsOptions, IngotPage, IngotSharingConfig, UpdateIngotSharingOptions, IngotInvite, IngotInvitation, IngotAccessLog, IngotAccessLogPage, AccessLogsOptions, HashCheckResponse, } from './types';
@@ -151,6 +151,32 @@ export interface IngotDownload {
151
151
  blob: Blob;
152
152
  revision: string;
153
153
  }
154
+ /** One retained publication; current content is not included in version history. */
155
+ export interface IngotVersion {
156
+ versionId: string;
157
+ publishedAt: number;
158
+ sizeBytes: number;
159
+ /** Absent for publications retained before MIME metadata was recorded. */
160
+ contentType?: string;
161
+ }
162
+ export interface IngotHistory {
163
+ id: string;
164
+ /** Maximum previous versions retained on the next successful content change. */
165
+ versionLimit: number;
166
+ /** Retained publications, newest first. */
167
+ versions: IngotVersion[];
168
+ }
169
+ /** A one-use download link bound to a retained publication. */
170
+ export interface IngotVersionDownloadLink {
171
+ id: string;
172
+ downloadUrl: string;
173
+ size: number;
174
+ contentVersion: string;
175
+ revision?: string;
176
+ expiresAt: number;
177
+ name?: string;
178
+ contentType?: string;
179
+ }
154
180
  export interface DeleteIngotOptions {
155
181
  /** Delete only this object publication. Omitted preserves unconditional deletion. */
156
182
  expectedRevision?: string;
@@ -482,6 +508,26 @@ export interface DownloadIngotResponse {
482
508
  size_bytes: number;
483
509
  content_type: string;
484
510
  }
511
+ export interface IngotHistoryResponse {
512
+ ingot_id: string;
513
+ version_limit: number;
514
+ versions: Array<{
515
+ version_id: string;
516
+ published_at: number;
517
+ size_bytes: number;
518
+ content_type?: string;
519
+ }>;
520
+ }
521
+ export interface IngotVersionDownloadResponse {
522
+ ingot_id: string;
523
+ download_url: string;
524
+ size_bytes: number;
525
+ content_version: string;
526
+ revision?: string;
527
+ expires_at: number;
528
+ name?: string;
529
+ content_type?: string;
530
+ }
485
531
  /** A sharing answer (apps/api/src/ingots/sharing.js formatSharingConfig). */
486
532
  export interface IngotSharingConfigResponse {
487
533
  ingot_id: string;
@@ -1,3 +1,4 @@
1
+ import type { IngotHistory, IngotVersion } from '../../ingots/types';
1
2
  /** JSON values travel without implicit coercion. Binary leaves use explicit paths. */
2
3
  export type StructuredJsonValue = null | boolean | number | string | StructuredJsonValue[] | {
3
4
  [key: string]: StructuredJsonValue;
@@ -91,16 +92,8 @@ export interface DeleteStructuredIngotOptions {
91
92
  /** Delete only this object publication. Omitted preserves unconditional deletion. */
92
93
  expectedRevision?: string;
93
94
  }
94
- export interface StructuredIngotVersion {
95
- versionId: string;
96
- publishedAt: number;
97
- sizeBytes: number;
98
- }
99
- export interface StructuredIngotHistory {
100
- id: string;
101
- versionLimit: number;
102
- versions: StructuredIngotVersion[];
103
- }
95
+ export type StructuredIngotVersion = IngotVersion;
96
+ export type StructuredIngotHistory = IngotHistory;
104
97
  export type StructuredActivityPeriod = '24h' | '7d';
105
98
  export interface StructuredActivityOptions {
106
99
  period?: StructuredActivityPeriod;