@constructive-io/sheets 0.3.0 → 0.6.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.
Files changed (51) hide show
  1. package/README.md +19 -24
  2. package/dist/advanced.cjs +659 -474
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +9 -10
  5. package/dist/advanced.d.ts +9 -10
  6. package/dist/advanced.js +3 -3
  7. package/dist/auth.cjs +10 -10
  8. package/dist/auth.cjs.map +1 -1
  9. package/dist/auth.d.cts +5 -4
  10. package/dist/auth.d.ts +5 -4
  11. package/dist/auth.js +3 -3
  12. package/dist/{chunk-GLVZSPV2.js → chunk-4EZ6A23C.js} +4 -3
  13. package/dist/chunk-4EZ6A23C.js.map +1 -0
  14. package/dist/{chunk-FNVHSOQQ.js → chunk-KKAWMVEG.js} +11 -11
  15. package/dist/chunk-KKAWMVEG.js.map +1 -0
  16. package/dist/{chunk-4PGPVMZB.js → chunk-KOZAW264.js} +4 -3
  17. package/dist/chunk-KOZAW264.js.map +1 -0
  18. package/dist/{chunk-ODUBS2NL.js → chunk-KVPVEXWB.js} +40 -17
  19. package/dist/chunk-KVPVEXWB.js.map +1 -0
  20. package/dist/{chunk-TU7ATZ4X.js → chunk-LR64FLWO.js} +301 -410
  21. package/dist/chunk-LR64FLWO.js.map +1 -0
  22. package/dist/chunk-ZETPUEXH.js +494 -0
  23. package/dist/chunk-ZETPUEXH.js.map +1 -0
  24. package/dist/{date-editor-CXKKGNL6.js → date-editor-QT47WY5T.js} +5 -3
  25. package/dist/date-editor-QT47WY5T.js.map +1 -0
  26. package/dist/{editor-props-M6Dh0P9f.d.ts → grid-cell-types-C3ARj148.d.cts} +70 -62
  27. package/dist/{editor-props-M6Dh0P9f.d.cts → grid-cell-types-C3ARj148.d.ts} +70 -62
  28. package/dist/index.cjs +1150 -703
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.cts +123 -35
  31. package/dist/index.d.ts +123 -35
  32. package/dist/index.js +323 -99
  33. package/dist/index.js.map +1 -1
  34. package/dist/{sheets-context-CojEFlaY.d.cts → sheets-context-B03WDhZ9.d.cts} +36 -6
  35. package/dist/{sheets-context-Da55TTR9.d.ts → sheets-context-DmVCOgiX.d.ts} +36 -6
  36. package/dist/styles.css +6 -0
  37. package/dist/testing.cjs +476 -108
  38. package/dist/testing.cjs.map +1 -1
  39. package/dist/testing.d.cts +11 -7
  40. package/dist/testing.d.ts +11 -7
  41. package/dist/testing.js +34 -8
  42. package/dist/testing.js.map +1 -1
  43. package/package.json +15 -16
  44. package/dist/chunk-4PGPVMZB.js.map +0 -1
  45. package/dist/chunk-FNVHSOQQ.js.map +0 -1
  46. package/dist/chunk-GLVZSPV2.js.map +0 -1
  47. package/dist/chunk-H4JJTMP5.js +0 -160
  48. package/dist/chunk-H4JJTMP5.js.map +0 -1
  49. package/dist/chunk-ODUBS2NL.js.map +0 -1
  50. package/dist/chunk-TU7ATZ4X.js.map +0 -1
  51. package/dist/date-editor-CXKKGNL6.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import * as React$1 from 'react';
1
+ import * as react from 'react';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { DocumentNode } from 'graphql';
4
- import { TypedDocumentString, MetaQuery, CleanTable, FieldSelection, MutationOptions } from '@constructive-io/data';
5
- import { S as SheetsCell, b as CellType, c as CellCategory, C as CellCreationMetadata, E as EditorProps } from './editor-props-M6Dh0P9f.cjs';
4
+ import { TypedDocumentString, FieldSelection, CleanTable, MetaQuery, MutationOptions } from '@constructive-io/data';
5
+ import { b as CellType, S as SheetsCell, C as CellCreationMetadata, c as CellCategory, E as EditorProps } from './grid-cell-types-C3ARj148.cjs';
6
6
 
7
7
  type ExecutableDocument = TypedDocumentString<any, any> | DocumentNode | string | unknown;
8
8
  type SheetsExecuteFn = <T = unknown>(document: ExecutableDocument, variables?: Record<string, unknown>) => Promise<T>;
@@ -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
  /**
@@ -146,7 +165,7 @@ interface AdapterListResult<T = Record<string, unknown>> {
146
165
  pageInfo?: AdapterPageInfo;
147
166
  }
148
167
  interface SheetsBackendAdapter {
149
- /** Introspect the schema. Default adapter runs the v5 `_meta` query. */
168
+ /** Introspect the schema. Default adapter validates and runs the July 2026 `_meta` contract. */
150
169
  fetchMeta(execute: SheetsExecuteFn): Promise<MetaQuery>;
151
170
  /** Read a page of rows, flattening relation connections into arrays. */
152
171
  listRows<T = Record<string, unknown>>(ctx: AdapterTableContext, query: AdapterListQuery, execute: SheetsExecuteFn): Promise<AdapterListResult<T>>;
@@ -161,6 +180,12 @@ interface SheetsBackendAdapter {
161
180
  interface SheetsAuthEmbedded {
162
181
  mode: 'embedded';
163
182
  getToken: () => string | null;
183
+ /**
184
+ * Stable, non-secret identity used to isolate cached data between users.
185
+ * Hosts should return the authenticated user/session id, never the token.
186
+ * When omitted, the provider uses an opaque key that changes with the token.
187
+ */
188
+ getIdentityKey?: () => string | null;
164
189
  }
165
190
  interface SheetsAuthStandalone {
166
191
  mode: 'standalone';
@@ -182,6 +207,10 @@ interface SheetsConfig {
182
207
  execute?: SheetsExecuteFn;
183
208
  /** Optional: inject custom upload function */
184
209
  executeUpload?: SheetsUploadFn;
210
+ /** Optional upload settings. `bucketKey` defaults to "public". */
211
+ upload?: {
212
+ bucketKey?: string;
213
+ };
185
214
  /** Optional: inject existing QueryClient */
186
215
  queryClient?: QueryClient;
187
216
  /** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */
@@ -207,8 +236,9 @@ interface SheetsContextValue {
207
236
  interface SheetsScopeKey {
208
237
  databaseId: string | null;
209
238
  endpoint: string;
239
+ identityKey: string | null;
210
240
  }
211
- declare const SheetsContext: React$1.Context<SheetsContextValue | null>;
241
+ declare const SheetsContext: react.Context<SheetsContextValue | null>;
212
242
  declare function useSheetsContext(): SheetsContextValue;
213
243
 
214
- export { type AdapterTableContext as A, type CellProps as C, type SheetsExecuteFn as S, type SheetsUploadFn as a, type SheetsConfig as b, type CellTypeDefinition as c, type CellTypeMatchInput as d, type SheetsCellRenderContext as e, type SheetsScopeKey as f, type SheetsBackendAdapter as g, SheetsContext as h, type SheetsContextValue as i, type SheetsAuthEmbedded as j, type SheetsAuthStandalone as k, createSheetsExecute as l, createSheetsUpload as m, type AdapterListQuery as n, type AdapterListResult as o, type AdapterPageInfo as p, defineCellType as q, type CellTypePlugin as r, type CellColumnDescriptor as s, type SheetsLogger as t, useSheetsContext as u };
244
+ export { type AdapterListQuery as A, type CellProps as C, type SheetsExecuteFn as S, type SheetsUploadFn as a, type SheetsConfig as b, type CellTypeDefinition as c, type SheetsCellRenderContext as d, type CellTypeMatchInput as e, type SheetsScopeKey as f, type SheetsBackendAdapter as g, type AdapterListResult as h, type AdapterPageInfo as i, type AdapterTableContext as j, type CellColumnDescriptor as k, type CellTypePlugin as l, type SheetsAuthEmbedded as m, type SheetsAuthStandalone as n, SheetsContext as o, type SheetsContextValue as p, type SheetsLogger as q, createSheetsExecute as r, createSheetsUpload as s, defineCellType as t, useSheetsContext as u };
@@ -1,8 +1,8 @@
1
- import * as React$1 from 'react';
1
+ import * as react from 'react';
2
2
  import { QueryClient } from '@tanstack/react-query';
3
3
  import { DocumentNode } from 'graphql';
4
- import { TypedDocumentString, MetaQuery, CleanTable, FieldSelection, MutationOptions } from '@constructive-io/data';
5
- import { S as SheetsCell, b as CellType, c as CellCategory, C as CellCreationMetadata, E as EditorProps } from './editor-props-M6Dh0P9f.js';
4
+ import { TypedDocumentString, FieldSelection, CleanTable, MetaQuery, MutationOptions } from '@constructive-io/data';
5
+ import { b as CellType, S as SheetsCell, C as CellCreationMetadata, c as CellCategory, E as EditorProps } from './grid-cell-types-C3ARj148.js';
6
6
 
7
7
  type ExecutableDocument = TypedDocumentString<any, any> | DocumentNode | string | unknown;
8
8
  type SheetsExecuteFn = <T = unknown>(document: ExecutableDocument, variables?: Record<string, unknown>) => Promise<T>;
@@ -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
  /**
@@ -146,7 +165,7 @@ interface AdapterListResult<T = Record<string, unknown>> {
146
165
  pageInfo?: AdapterPageInfo;
147
166
  }
148
167
  interface SheetsBackendAdapter {
149
- /** Introspect the schema. Default adapter runs the v5 `_meta` query. */
168
+ /** Introspect the schema. Default adapter validates and runs the July 2026 `_meta` contract. */
150
169
  fetchMeta(execute: SheetsExecuteFn): Promise<MetaQuery>;
151
170
  /** Read a page of rows, flattening relation connections into arrays. */
152
171
  listRows<T = Record<string, unknown>>(ctx: AdapterTableContext, query: AdapterListQuery, execute: SheetsExecuteFn): Promise<AdapterListResult<T>>;
@@ -161,6 +180,12 @@ interface SheetsBackendAdapter {
161
180
  interface SheetsAuthEmbedded {
162
181
  mode: 'embedded';
163
182
  getToken: () => string | null;
183
+ /**
184
+ * Stable, non-secret identity used to isolate cached data between users.
185
+ * Hosts should return the authenticated user/session id, never the token.
186
+ * When omitted, the provider uses an opaque key that changes with the token.
187
+ */
188
+ getIdentityKey?: () => string | null;
164
189
  }
165
190
  interface SheetsAuthStandalone {
166
191
  mode: 'standalone';
@@ -182,6 +207,10 @@ interface SheetsConfig {
182
207
  execute?: SheetsExecuteFn;
183
208
  /** Optional: inject custom upload function */
184
209
  executeUpload?: SheetsUploadFn;
210
+ /** Optional upload settings. `bucketKey` defaults to "public". */
211
+ upload?: {
212
+ bucketKey?: string;
213
+ };
185
214
  /** Optional: inject existing QueryClient */
186
215
  queryClient?: QueryClient;
187
216
  /** Optional: inject a custom backend adapter. Defaults to the PostGraphile adapter. */
@@ -207,8 +236,9 @@ interface SheetsContextValue {
207
236
  interface SheetsScopeKey {
208
237
  databaseId: string | null;
209
238
  endpoint: string;
239
+ identityKey: string | null;
210
240
  }
211
- declare const SheetsContext: React$1.Context<SheetsContextValue | null>;
241
+ declare const SheetsContext: react.Context<SheetsContextValue | null>;
212
242
  declare function useSheetsContext(): SheetsContextValue;
213
243
 
214
- export { type AdapterTableContext as A, type CellProps as C, type SheetsExecuteFn as S, type SheetsUploadFn as a, type SheetsConfig as b, type CellTypeDefinition as c, type CellTypeMatchInput as d, type SheetsCellRenderContext as e, type SheetsScopeKey as f, type SheetsBackendAdapter as g, SheetsContext as h, type SheetsContextValue as i, type SheetsAuthEmbedded as j, type SheetsAuthStandalone as k, createSheetsExecute as l, createSheetsUpload as m, type AdapterListQuery as n, type AdapterListResult as o, type AdapterPageInfo as p, defineCellType as q, type CellTypePlugin as r, type CellColumnDescriptor as s, type SheetsLogger as t, useSheetsContext as u };
244
+ export { type AdapterListQuery as A, type CellProps as C, type SheetsExecuteFn as S, type SheetsUploadFn as a, type SheetsConfig as b, type CellTypeDefinition as c, type SheetsCellRenderContext as d, type CellTypeMatchInput as e, type SheetsScopeKey as f, type SheetsBackendAdapter as g, type AdapterListResult as h, type AdapterPageInfo as i, type AdapterTableContext as j, type CellColumnDescriptor as k, type CellTypePlugin as l, type SheetsAuthEmbedded as m, type SheetsAuthStandalone as n, SheetsContext as o, type SheetsContextValue as p, type SheetsLogger as q, createSheetsExecute as r, createSheetsUpload as s, defineCellType as t, useSheetsContext as u };
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Tailwind CSS v4 source contract for the published Sheets package.
3
+ * Import this file after Tailwind so utilities used by the compiled package
4
+ * are generated without scanning package source that is not shipped to npm.
5
+ */
6
+ @source "./**/*.{js,cjs}";