@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.
- package/README.md +19 -24
- package/dist/advanced.cjs +659 -474
- package/dist/advanced.cjs.map +1 -1
- package/dist/advanced.d.cts +9 -10
- package/dist/advanced.d.ts +9 -10
- package/dist/advanced.js +3 -3
- package/dist/auth.cjs +10 -10
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +5 -4
- package/dist/auth.d.ts +5 -4
- package/dist/auth.js +3 -3
- package/dist/{chunk-GLVZSPV2.js → chunk-4EZ6A23C.js} +4 -3
- package/dist/chunk-4EZ6A23C.js.map +1 -0
- package/dist/{chunk-FNVHSOQQ.js → chunk-KKAWMVEG.js} +11 -11
- package/dist/chunk-KKAWMVEG.js.map +1 -0
- package/dist/{chunk-4PGPVMZB.js → chunk-KOZAW264.js} +4 -3
- package/dist/chunk-KOZAW264.js.map +1 -0
- package/dist/{chunk-ODUBS2NL.js → chunk-KVPVEXWB.js} +40 -17
- package/dist/chunk-KVPVEXWB.js.map +1 -0
- package/dist/{chunk-TU7ATZ4X.js → chunk-LR64FLWO.js} +301 -410
- package/dist/chunk-LR64FLWO.js.map +1 -0
- package/dist/chunk-ZETPUEXH.js +494 -0
- package/dist/chunk-ZETPUEXH.js.map +1 -0
- package/dist/{date-editor-CXKKGNL6.js → date-editor-QT47WY5T.js} +5 -3
- package/dist/date-editor-QT47WY5T.js.map +1 -0
- package/dist/{editor-props-M6Dh0P9f.d.ts → grid-cell-types-C3ARj148.d.cts} +70 -62
- package/dist/{editor-props-M6Dh0P9f.d.cts → grid-cell-types-C3ARj148.d.ts} +70 -62
- package/dist/index.cjs +1150 -703
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -35
- package/dist/index.d.ts +123 -35
- package/dist/index.js +323 -99
- package/dist/index.js.map +1 -1
- package/dist/{sheets-context-CojEFlaY.d.cts → sheets-context-B03WDhZ9.d.cts} +36 -6
- package/dist/{sheets-context-Da55TTR9.d.ts → sheets-context-DmVCOgiX.d.ts} +36 -6
- package/dist/styles.css +6 -0
- package/dist/testing.cjs +476 -108
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +11 -7
- package/dist/testing.d.ts +11 -7
- package/dist/testing.js +34 -8
- package/dist/testing.js.map +1 -1
- package/package.json +15 -16
- package/dist/chunk-4PGPVMZB.js.map +0 -1
- package/dist/chunk-FNVHSOQQ.js.map +0 -1
- package/dist/chunk-GLVZSPV2.js.map +0 -1
- package/dist/chunk-H4JJTMP5.js +0 -160
- package/dist/chunk-H4JJTMP5.js.map +0 -1
- package/dist/chunk-ODUBS2NL.js.map +0 -1
- package/dist/chunk-TU7ATZ4X.js.map +0 -1
- package/dist/date-editor-CXKKGNL6.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { DocumentNode } from 'graphql';
|
|
4
|
-
import { TypedDocumentString,
|
|
5
|
-
import {
|
|
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
|
|
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:
|
|
241
|
+
declare const SheetsContext: react.Context<SheetsContextValue | null>;
|
|
212
242
|
declare function useSheetsContext(): SheetsContextValue;
|
|
213
243
|
|
|
214
|
-
export { type
|
|
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
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { DocumentNode } from 'graphql';
|
|
4
|
-
import { TypedDocumentString,
|
|
5
|
-
import {
|
|
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
|
|
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:
|
|
241
|
+
declare const SheetsContext: react.Context<SheetsContextValue | null>;
|
|
212
242
|
declare function useSheetsContext(): SheetsContextValue;
|
|
213
243
|
|
|
214
|
-
export { type
|
|
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 };
|
package/dist/styles.css
ADDED