@constructive-io/sheets 0.13.1 → 0.15.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 (61) hide show
  1. package/README.md +231 -148
  2. package/dist/advanced.cjs +7220 -4030
  3. package/dist/advanced.cjs.map +1 -1
  4. package/dist/advanced.d.cts +2 -2
  5. package/dist/advanced.d.ts +2 -2
  6. package/dist/advanced.js +5 -5
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.js +3 -3
  9. package/dist/chunk-CJ4PRA64.js +312 -0
  10. package/dist/chunk-CJ4PRA64.js.map +1 -0
  11. package/dist/chunk-II3MSNRO.js +18 -0
  12. package/dist/chunk-II3MSNRO.js.map +1 -0
  13. package/dist/{chunk-MXVNIKES.js → chunk-J7KK4UWI.js} +6 -6
  14. package/dist/chunk-MBSHDF55.js +839 -0
  15. package/dist/chunk-MBSHDF55.js.map +1 -0
  16. package/dist/{chunk-ZKANUG3F.js → chunk-MOFFS5WQ.js} +20 -15
  17. package/dist/chunk-MOFFS5WQ.js.map +1 -0
  18. package/dist/chunk-VCBY2AMT.js +8920 -0
  19. package/dist/chunk-VCBY2AMT.js.map +1 -0
  20. package/dist/{chunk-H5HR5HUJ.js → chunk-ZOQDSOMO.js} +50 -312
  21. package/dist/chunk-ZOQDSOMO.js.map +1 -0
  22. package/dist/date-editor-ORCB43ZM.js +346 -0
  23. package/dist/date-editor-ORCB43ZM.js.map +1 -0
  24. package/dist/grid-cell-types-YNIVK4hN.d.cts +346 -0
  25. package/dist/grid-cell-types-YNIVK4hN.d.ts +346 -0
  26. package/dist/index.cjs +22910 -12084
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +1497 -337
  29. package/dist/index.d.ts +1497 -337
  30. package/dist/index.js +12833 -6142
  31. package/dist/index.js.map +1 -1
  32. package/dist/sheets-context-Bb7ZoNBg.d.cts +436 -0
  33. package/dist/sheets-context-CPuf31LS.d.ts +436 -0
  34. package/dist/testing.cjs +1253 -638
  35. package/dist/testing.cjs.map +1 -1
  36. package/dist/testing.d.cts +80 -11
  37. package/dist/testing.d.ts +80 -11
  38. package/dist/testing.js +791 -148
  39. package/dist/testing.js.map +1 -1
  40. package/package.json +5 -5
  41. package/dist/chunk-4EZ6A23C.js +0 -44
  42. package/dist/chunk-4EZ6A23C.js.map +0 -1
  43. package/dist/chunk-5QPNOKMA.js +0 -4397
  44. package/dist/chunk-5QPNOKMA.js.map +0 -1
  45. package/dist/chunk-AYMXT3ME.js +0 -540
  46. package/dist/chunk-AYMXT3ME.js.map +0 -1
  47. package/dist/chunk-H5HR5HUJ.js.map +0 -1
  48. package/dist/chunk-PZL2BCWF.js +0 -168
  49. package/dist/chunk-PZL2BCWF.js.map +0 -1
  50. package/dist/chunk-X7DHTSOX.js +0 -21
  51. package/dist/chunk-X7DHTSOX.js.map +0 -1
  52. package/dist/chunk-ZKANUG3F.js.map +0 -1
  53. package/dist/date-editor-ZFNDKYBD.js +0 -358
  54. package/dist/date-editor-ZFNDKYBD.js.map +0 -1
  55. package/dist/grid-cell-types-Pbe2m2tE.d.cts +0 -253
  56. package/dist/grid-cell-types-Pbe2m2tE.d.ts +0 -253
  57. package/dist/map-picker-ZUGGOIZS.js +0 -290
  58. package/dist/map-picker-ZUGGOIZS.js.map +0 -1
  59. package/dist/sheets-context-CY1RmDKL.d.cts +0 -244
  60. package/dist/sheets-context-Cu3Ec_ca.d.ts +0 -244
  61. /package/dist/{chunk-MXVNIKES.js.map → chunk-J7KK4UWI.js.map} +0 -0
@@ -1,9 +1,81 @@
1
1
  import * as react from 'react';
2
- import { S as SheetsExecuteFn, a as SheetsUploadFn } from './sheets-context-CY1RmDKL.cjs';
3
- import { MetaContractIntrospectionQuery } from '@constructive-io/data';
2
+ import { S as SheetsExecuteFn, a as SheetsUploadFn } from './sheets-context-Bb7ZoNBg.cjs';
3
+ import { GraphQLSchema } from 'graphql';
4
+ import { MetaQuery, MetaContractIntrospectionQuery, MetaschemaTable } from '@constructive-io/data';
4
5
  import '@tanstack/react-query';
5
- import 'graphql';
6
- import './grid-cell-types-Pbe2m2tE.cjs';
6
+ import './grid-cell-types-YNIVK4hN.cjs';
7
+
8
+ type Row$1 = Record<string, unknown>;
9
+ interface ModelBackendUploadOptions {
10
+ /** Answer every upload as already stored: no upload URL, the existing file row or a new live one. */
11
+ deduplicated?: boolean;
12
+ /** A new file row stays not live for this many writes that reference it; each of those writes fails. */
13
+ notLiveForWrites?: number;
14
+ /**
15
+ * The confirm job rejects this upload (its bytes did not match): the new files row is
16
+ * `rejected`, `confirmUpload` leaves it so, and every write that references it fails.
17
+ */
18
+ rejectUpload?: (input: Readonly<Row$1>) => boolean;
19
+ /** Fail an upload request: return a message (and optional code), or null to let it through. */
20
+ failure?: (input: Readonly<Row$1>) => {
21
+ message: string;
22
+ code?: string;
23
+ } | null;
24
+ /** Address of public buckets, for the projection `url`. Default `https://cdn.mock`. */
25
+ publicUrlPrefix?: string;
26
+ /** Address of upload URLs. Default `https://storage.mock/upload`. */
27
+ uploadUrlPrefix?: string;
28
+ }
29
+ interface RecordedUpload {
30
+ /** Root mutation field that was called. */
31
+ mutation: string;
32
+ /** GraphQL type name of the files table. */
33
+ filesTable: string;
34
+ /** The per-file input, after defaults from a bulk input. */
35
+ input: Readonly<Row$1>;
36
+ outcome: 'requested' | 'deduplicated' | 'failed';
37
+ fileId: string | null;
38
+ error: string | null;
39
+ at: number;
40
+ }
41
+
42
+ type Row = Record<string, unknown>;
43
+ interface RecordedMutation {
44
+ op: 'create' | 'update' | 'delete' | 'upload';
45
+ tableName: string;
46
+ variables: Record<string, unknown>;
47
+ at: number;
48
+ }
49
+ interface ModelBackendOptions {
50
+ /** The schema the backend serves. */
51
+ schema: GraphQLSchema;
52
+ /** The `_meta` response the backend serves. */
53
+ meta: MetaQuery;
54
+ /** Rows per table (GraphQL type name). Changed in place by mutations. */
55
+ rows: Record<string, Row[]>;
56
+ /** Called after every recorded mutation. */
57
+ onMutation?: (mutation: RecordedMutation) => void;
58
+ /** How the storage upload mutations behave. */
59
+ uploads?: ModelBackendUploadOptions;
60
+ /**
61
+ * Rows a row rule hides from this writer. An update or a delete of such a row, like one of a
62
+ * row that is gone, changes nothing and answers with an empty record and no error, as the
63
+ * server does.
64
+ */
65
+ writeHidden?: (tableName: string, row: Row) => boolean;
66
+ }
67
+ interface ModelBackend {
68
+ execute: SheetsExecuteFn;
69
+ /** Every create, update, delete and upload mutation, in order. */
70
+ mutations: RecordedMutation[];
71
+ /** Every upload request with its input and outcome, in order. */
72
+ uploads: RecordedUpload[];
73
+ /** The rows, per table, as the backend holds them now. */
74
+ rows: Record<string, Row[]>;
75
+ /** Mark a file row live, as the confirm step does after the PUT. */
76
+ confirmUpload(fileId: string): void;
77
+ }
78
+ declare function createModelBackend(options: ModelBackendOptions): ModelBackend;
7
79
 
8
80
  interface MockTableField {
9
81
  name: string;
@@ -19,12 +91,6 @@ interface MockTable {
19
91
  /** GraphQL field names in PK order. Defaults to `['id']` when an id field exists. */
20
92
  primaryKeyFields?: string[];
21
93
  }
22
- interface RecordedMutation {
23
- op: 'create' | 'update' | 'delete' | 'upload';
24
- tableName: string;
25
- variables: Record<string, unknown>;
26
- at: number;
27
- }
28
94
  interface MockSheetsOptions {
29
95
  tables: MockTable[];
30
96
  onMutation?: (m: RecordedMutation) => void;
@@ -46,4 +112,7 @@ declare const usersFixture: MockTable;
46
112
  /** Current `_meta` type signature for tests using an injected execute seam. */
47
113
  declare function createMetaContractFixture(): MetaContractIntrospectionQuery;
48
114
 
49
- export { type MockExecuteHandle, type MockSheetsOptions, MockSheetsProvider, type MockSheetsProviderProps, type MockTable, type MockTableField, type RecordedMutation, createMetaContractFixture, createMockExecute, usersFixture };
115
+ /** SDL for the tables, with every scalar, operator input and root field they need. */
116
+ declare function buildMetaSchemaSdl(tables: readonly MetaschemaTable[]): string;
117
+
118
+ export { type MockExecuteHandle, type MockSheetsOptions, MockSheetsProvider, type MockSheetsProviderProps, type MockTable, type MockTableField, type ModelBackend, type ModelBackendOptions, type ModelBackendUploadOptions, type RecordedMutation, type RecordedUpload, buildMetaSchemaSdl, createMetaContractFixture, createMockExecute, createModelBackend, usersFixture };
package/dist/testing.d.ts CHANGED
@@ -1,9 +1,81 @@
1
1
  import * as react from 'react';
2
- import { S as SheetsExecuteFn, a as SheetsUploadFn } from './sheets-context-Cu3Ec_ca.js';
3
- import { MetaContractIntrospectionQuery } from '@constructive-io/data';
2
+ import { S as SheetsExecuteFn, a as SheetsUploadFn } from './sheets-context-CPuf31LS.js';
3
+ import { GraphQLSchema } from 'graphql';
4
+ import { MetaQuery, MetaContractIntrospectionQuery, MetaschemaTable } from '@constructive-io/data';
4
5
  import '@tanstack/react-query';
5
- import 'graphql';
6
- import './grid-cell-types-Pbe2m2tE.js';
6
+ import './grid-cell-types-YNIVK4hN.js';
7
+
8
+ type Row$1 = Record<string, unknown>;
9
+ interface ModelBackendUploadOptions {
10
+ /** Answer every upload as already stored: no upload URL, the existing file row or a new live one. */
11
+ deduplicated?: boolean;
12
+ /** A new file row stays not live for this many writes that reference it; each of those writes fails. */
13
+ notLiveForWrites?: number;
14
+ /**
15
+ * The confirm job rejects this upload (its bytes did not match): the new files row is
16
+ * `rejected`, `confirmUpload` leaves it so, and every write that references it fails.
17
+ */
18
+ rejectUpload?: (input: Readonly<Row$1>) => boolean;
19
+ /** Fail an upload request: return a message (and optional code), or null to let it through. */
20
+ failure?: (input: Readonly<Row$1>) => {
21
+ message: string;
22
+ code?: string;
23
+ } | null;
24
+ /** Address of public buckets, for the projection `url`. Default `https://cdn.mock`. */
25
+ publicUrlPrefix?: string;
26
+ /** Address of upload URLs. Default `https://storage.mock/upload`. */
27
+ uploadUrlPrefix?: string;
28
+ }
29
+ interface RecordedUpload {
30
+ /** Root mutation field that was called. */
31
+ mutation: string;
32
+ /** GraphQL type name of the files table. */
33
+ filesTable: string;
34
+ /** The per-file input, after defaults from a bulk input. */
35
+ input: Readonly<Row$1>;
36
+ outcome: 'requested' | 'deduplicated' | 'failed';
37
+ fileId: string | null;
38
+ error: string | null;
39
+ at: number;
40
+ }
41
+
42
+ type Row = Record<string, unknown>;
43
+ interface RecordedMutation {
44
+ op: 'create' | 'update' | 'delete' | 'upload';
45
+ tableName: string;
46
+ variables: Record<string, unknown>;
47
+ at: number;
48
+ }
49
+ interface ModelBackendOptions {
50
+ /** The schema the backend serves. */
51
+ schema: GraphQLSchema;
52
+ /** The `_meta` response the backend serves. */
53
+ meta: MetaQuery;
54
+ /** Rows per table (GraphQL type name). Changed in place by mutations. */
55
+ rows: Record<string, Row[]>;
56
+ /** Called after every recorded mutation. */
57
+ onMutation?: (mutation: RecordedMutation) => void;
58
+ /** How the storage upload mutations behave. */
59
+ uploads?: ModelBackendUploadOptions;
60
+ /**
61
+ * Rows a row rule hides from this writer. An update or a delete of such a row, like one of a
62
+ * row that is gone, changes nothing and answers with an empty record and no error, as the
63
+ * server does.
64
+ */
65
+ writeHidden?: (tableName: string, row: Row) => boolean;
66
+ }
67
+ interface ModelBackend {
68
+ execute: SheetsExecuteFn;
69
+ /** Every create, update, delete and upload mutation, in order. */
70
+ mutations: RecordedMutation[];
71
+ /** Every upload request with its input and outcome, in order. */
72
+ uploads: RecordedUpload[];
73
+ /** The rows, per table, as the backend holds them now. */
74
+ rows: Record<string, Row[]>;
75
+ /** Mark a file row live, as the confirm step does after the PUT. */
76
+ confirmUpload(fileId: string): void;
77
+ }
78
+ declare function createModelBackend(options: ModelBackendOptions): ModelBackend;
7
79
 
8
80
  interface MockTableField {
9
81
  name: string;
@@ -19,12 +91,6 @@ interface MockTable {
19
91
  /** GraphQL field names in PK order. Defaults to `['id']` when an id field exists. */
20
92
  primaryKeyFields?: string[];
21
93
  }
22
- interface RecordedMutation {
23
- op: 'create' | 'update' | 'delete' | 'upload';
24
- tableName: string;
25
- variables: Record<string, unknown>;
26
- at: number;
27
- }
28
94
  interface MockSheetsOptions {
29
95
  tables: MockTable[];
30
96
  onMutation?: (m: RecordedMutation) => void;
@@ -46,4 +112,7 @@ declare const usersFixture: MockTable;
46
112
  /** Current `_meta` type signature for tests using an injected execute seam. */
47
113
  declare function createMetaContractFixture(): MetaContractIntrospectionQuery;
48
114
 
49
- export { type MockExecuteHandle, type MockSheetsOptions, MockSheetsProvider, type MockSheetsProviderProps, type MockTable, type MockTableField, type RecordedMutation, createMetaContractFixture, createMockExecute, usersFixture };
115
+ /** SDL for the tables, with every scalar, operator input and root field they need. */
116
+ declare function buildMetaSchemaSdl(tables: readonly MetaschemaTable[]): string;
117
+
118
+ export { type MockExecuteHandle, type MockSheetsOptions, MockSheetsProvider, type MockSheetsProviderProps, type MockTable, type MockTableField, type ModelBackend, type ModelBackendOptions, type ModelBackendUploadOptions, type RecordedMutation, type RecordedUpload, buildMetaSchemaSdl, createMetaContractFixture, createMockExecute, createModelBackend, usersFixture };