@constructive-io/sheets 0.3.0 → 0.4.1

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.
@@ -32,6 +32,25 @@ interface SheetsUploadOptions {
32
32
  }
33
33
  type SheetsUploadFn = (file: File, path?: string, options?: SheetsUploadOptions) => Promise<SheetsUploadResult>;
34
34
  declare function createSheetsExecute(config: SheetsConfig, getToken: () => string | null): SheetsExecuteFn;
35
+ /**
36
+ * Presigned-URL cell-upload seam.
37
+ *
38
+ * Replaces the legacy multipart `<endpoint>/upload` POST entirely. The flow:
39
+ * 1. Read + SHA-256 hash the file bytes (Web Crypto)
40
+ * 2. Discover (cached per endpoint) the upload op + downloadUrl-by-id field
41
+ * via GraphQL introspection — the root `upload<Type>File` mutation, matched
42
+ * by FIELD/TYPE SHAPE (LOCKED: no hardcoded names)
43
+ * 3. Call the upload op with input `{ bucketKey, contentHash, contentType,
44
+ * size, filename }` — NO `ownerId` (app-scoped buckets have no owner_id)
45
+ * 4. If `uploadUrl` is non-null, PUT the raw bytes to it with ONLY the signed
46
+ * `Content-Type` header (NO Authorization). Skipped when `deduplicated`.
47
+ * 5. Resolve the stable public `downloadUrl` for the returned fileId.
48
+ *
49
+ * Returns `{ url, filename, mime, size, key, fileId }` where `url` is the stable
50
+ * download URL — the same cell value shape callers/Step-2 already consume.
51
+ *
52
+ * `path` is ignored (content-addressed buckets key on `contentHash`).
53
+ */
35
54
  declare function createSheetsUpload(config: SheetsConfig, getToken: () => string | null): SheetsUploadFn;
36
55
 
37
56
  /**
@@ -182,6 +201,10 @@ interface SheetsConfig {
182
201
  execute?: SheetsExecuteFn;
183
202
  /** Optional: inject custom upload function */
184
203
  executeUpload?: SheetsUploadFn;
204
+ /** Optional upload settings. `bucketKey` defaults to "public". */
205
+ upload?: {
206
+ bucketKey?: string;
207
+ };
185
208
  /** Optional: inject existing QueryClient */
186
209
  queryClient?: QueryClient;
187
210
  /** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */
@@ -32,6 +32,25 @@ interface SheetsUploadOptions {
32
32
  }
33
33
  type SheetsUploadFn = (file: File, path?: string, options?: SheetsUploadOptions) => Promise<SheetsUploadResult>;
34
34
  declare function createSheetsExecute(config: SheetsConfig, getToken: () => string | null): SheetsExecuteFn;
35
+ /**
36
+ * Presigned-URL cell-upload seam.
37
+ *
38
+ * Replaces the legacy multipart `<endpoint>/upload` POST entirely. The flow:
39
+ * 1. Read + SHA-256 hash the file bytes (Web Crypto)
40
+ * 2. Discover (cached per endpoint) the upload op + downloadUrl-by-id field
41
+ * via GraphQL introspection — the root `upload<Type>File` mutation, matched
42
+ * by FIELD/TYPE SHAPE (LOCKED: no hardcoded names)
43
+ * 3. Call the upload op with input `{ bucketKey, contentHash, contentType,
44
+ * size, filename }` — NO `ownerId` (app-scoped buckets have no owner_id)
45
+ * 4. If `uploadUrl` is non-null, PUT the raw bytes to it with ONLY the signed
46
+ * `Content-Type` header (NO Authorization). Skipped when `deduplicated`.
47
+ * 5. Resolve the stable public `downloadUrl` for the returned fileId.
48
+ *
49
+ * Returns `{ url, filename, mime, size, key, fileId }` where `url` is the stable
50
+ * download URL — the same cell value shape callers/Step-2 already consume.
51
+ *
52
+ * `path` is ignored (content-addressed buckets key on `contentHash`).
53
+ */
35
54
  declare function createSheetsUpload(config: SheetsConfig, getToken: () => string | null): SheetsUploadFn;
36
55
 
37
56
  /**
@@ -182,6 +201,10 @@ interface SheetsConfig {
182
201
  execute?: SheetsExecuteFn;
183
202
  /** Optional: inject custom upload function */
184
203
  executeUpload?: SheetsUploadFn;
204
+ /** Optional upload settings. `bucketKey` defaults to "public". */
205
+ upload?: {
206
+ bucketKey?: string;
207
+ };
185
208
  /** Optional: inject existing QueryClient */
186
209
  queryClient?: QueryClient;
187
210
  /** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */