ag-grid-url-sync 0.5.0 → 0.5.2

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 (83) hide show
  1. package/README.md +339 -66
  2. package/dist/core/ag-grid-url-sync.d.ts +16 -9
  3. package/dist/core/ag-grid-url-sync.js +23 -19
  4. package/dist/core/ag-grid-url-sync.js.map +1 -1
  5. package/dist/core/codecs.d.ts +28 -0
  6. package/dist/core/codecs.js +39 -0
  7. package/dist/core/codecs.js.map +1 -0
  8. package/dist/core/data-issue-codes.d.ts +3 -0
  9. package/dist/core/data-issue-codes.js +10 -0
  10. package/dist/core/data-issue-codes.js.map +1 -0
  11. package/dist/core/grid-integration.d.ts +38 -2
  12. package/dist/core/grid-integration.js +169 -128
  13. package/dist/core/grid-integration.js.map +1 -1
  14. package/dist/core/grid-url-sync.d.ts +62 -0
  15. package/dist/core/grid-url-sync.js +738 -0
  16. package/dist/core/grid-url-sync.js.map +1 -0
  17. package/dist/core/index.d.ts +4 -1
  18. package/dist/core/index.js +4 -1
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/core/individual-params.d.ts +12 -5
  21. package/dist/core/individual-params.js +38 -62
  22. package/dist/core/individual-params.js.map +1 -1
  23. package/dist/core/issue-columns.d.ts +2 -0
  24. package/dist/core/issue-columns.js +11 -0
  25. package/dist/core/issue-columns.js.map +1 -0
  26. package/dist/core/issues.d.ts +34 -0
  27. package/dist/core/issues.js +51 -0
  28. package/dist/core/issues.js.map +1 -0
  29. package/dist/core/operators.d.ts +189 -0
  30. package/dist/core/operators.js +60 -0
  31. package/dist/core/operators.js.map +1 -0
  32. package/dist/core/options.d.ts +21 -0
  33. package/dist/core/options.js +21 -0
  34. package/dist/core/options.js.map +1 -0
  35. package/dist/core/own-write.d.ts +138 -0
  36. package/dist/core/own-write.js +133 -0
  37. package/dist/core/own-write.js.map +1 -0
  38. package/dist/core/schemas.d.ts +51 -0
  39. package/dist/core/schemas.js +59 -0
  40. package/dist/core/schemas.js.map +1 -0
  41. package/dist/core/serialization/formats.d.ts +7 -7
  42. package/dist/core/serialization/formats.js +34 -28
  43. package/dist/core/serialization/formats.js.map +1 -1
  44. package/dist/core/serialization/grouped.d.ts +9 -12
  45. package/dist/core/serialization/grouped.js +24 -17
  46. package/dist/core/serialization/grouped.js.map +1 -1
  47. package/dist/core/to-error.d.ts +5 -0
  48. package/dist/core/to-error.js +4 -0
  49. package/dist/core/to-error.js.map +1 -0
  50. package/dist/core/types.d.ts +296 -43
  51. package/dist/core/types.js +39 -108
  52. package/dist/core/types.js.map +1 -1
  53. package/dist/core/url-generator.d.ts +4 -4
  54. package/dist/core/url-generator.js +9 -7
  55. package/dist/core/url-generator.js.map +1 -1
  56. package/dist/core/url-parser.d.ts +4 -4
  57. package/dist/core/url-parser.js +6 -4
  58. package/dist/core/url-parser.js.map +1 -1
  59. package/dist/core/validation.d.ts +21 -14
  60. package/dist/core/validation.js +58 -54
  61. package/dist/core/validation.js.map +1 -1
  62. package/dist/core/view-storage.js +21 -19
  63. package/dist/core/view-storage.js.map +1 -1
  64. package/dist/index.d.ts +4 -1
  65. package/dist/index.js +4 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/react/index.d.ts +3 -2
  68. package/dist/react/index.js +1 -0
  69. package/dist/react/index.js.map +1 -1
  70. package/dist/react/sync-holder.d.ts +22 -0
  71. package/dist/react/sync-holder.js +68 -0
  72. package/dist/react/sync-holder.js.map +1 -0
  73. package/dist/react/sync-options.d.ts +17 -0
  74. package/dist/react/sync-options.js +22 -0
  75. package/dist/react/sync-options.js.map +1 -0
  76. package/dist/react/types.d.ts +101 -14
  77. package/dist/react/use-ag-grid-url-sync.d.ts +3 -0
  78. package/dist/react/use-ag-grid-url-sync.js +344 -499
  79. package/dist/react/use-ag-grid-url-sync.js.map +1 -1
  80. package/dist/react/use-grid-url-sync.d.ts +14 -0
  81. package/dist/react/use-grid-url-sync.js +206 -0
  82. package/dist/react/use-grid-url-sync.js.map +1 -0
  83. package/package.json +35 -15
@@ -0,0 +1,189 @@
1
+ /** A filter type that the library supports */
2
+ export type OperatorFilterType = 'text' | 'number' | 'date';
3
+ declare const ALL_TYPES: readonly ['text', 'number', 'date'];
4
+ /**
5
+ * Row order matters: the public operation lists keep their old order, and
6
+ * the deprecated reverse AG Grid map keeps its old "last row wins" values.
7
+ * Keep text-only rows first, then shared rows, then number-only rows, then
8
+ * date-only rows.
9
+ */
10
+ export declare const OPERATORS: readonly [{
11
+ readonly id: 'contains';
12
+ readonly url: 'contains';
13
+ readonly agGrid: 'contains';
14
+ readonly types: readonly ["text"];
15
+ readonly arity: 1;
16
+ }, {
17
+ readonly id: 'notContains';
18
+ readonly url: 'notContains';
19
+ readonly agGrid: 'notContains';
20
+ readonly types: readonly ["text"];
21
+ readonly arity: 1;
22
+ }, {
23
+ readonly id: 'startsWith';
24
+ readonly url: 'startsWith';
25
+ readonly agGrid: 'startsWith';
26
+ readonly types: readonly ["text"];
27
+ readonly arity: 1;
28
+ }, {
29
+ readonly id: 'endsWith';
30
+ readonly url: 'endsWith';
31
+ readonly agGrid: 'endsWith';
32
+ readonly types: readonly ["text"];
33
+ readonly arity: 1;
34
+ }, {
35
+ readonly id: 'eq';
36
+ readonly url: 'eq';
37
+ readonly agGrid: 'equals';
38
+ readonly types: readonly ["text", "number", "date"];
39
+ readonly arity: 1;
40
+ }, {
41
+ readonly id: 'notEqual';
42
+ readonly url: 'neq';
43
+ readonly agGrid: 'notEqual';
44
+ readonly types: readonly ["text", "number", "date"];
45
+ readonly arity: 1;
46
+ }, {
47
+ readonly id: 'blank';
48
+ readonly url: 'blank';
49
+ readonly agGrid: 'blank';
50
+ readonly types: readonly ["text", "number", "date"];
51
+ readonly arity: 0;
52
+ }, {
53
+ readonly id: 'notBlank';
54
+ readonly url: 'notBlank';
55
+ readonly agGrid: 'notBlank';
56
+ readonly types: readonly ["text", "number", "date"];
57
+ readonly arity: 0;
58
+ }, {
59
+ readonly id: 'lessThan';
60
+ readonly url: 'lt';
61
+ readonly agGrid: 'lessThan';
62
+ readonly types: readonly ["number"];
63
+ readonly arity: 1;
64
+ }, {
65
+ readonly id: 'lessThanOrEqual';
66
+ readonly url: 'lte';
67
+ readonly agGrid: 'lessThanOrEqual';
68
+ readonly types: readonly ["number"];
69
+ readonly arity: 1;
70
+ }, {
71
+ readonly id: 'greaterThan';
72
+ readonly url: 'gt';
73
+ readonly agGrid: 'greaterThan';
74
+ readonly types: readonly ["number"];
75
+ readonly arity: 1;
76
+ }, {
77
+ readonly id: 'greaterThanOrEqual';
78
+ readonly url: 'gte';
79
+ readonly agGrid: 'greaterThanOrEqual';
80
+ readonly types: readonly ["number"];
81
+ readonly arity: 1;
82
+ }, {
83
+ readonly id: 'inRange';
84
+ readonly url: 'range';
85
+ readonly agGrid: 'inRange';
86
+ readonly types: readonly ["number"];
87
+ readonly arity: 2;
88
+ }, {
89
+ readonly id: 'dateBefore';
90
+ readonly url: 'before';
91
+ readonly agGrid: 'lessThan';
92
+ readonly types: readonly ["date"];
93
+ readonly arity: 1;
94
+ }, {
95
+ readonly id: 'dateBeforeOrEqual';
96
+ readonly url: 'beforeEq';
97
+ readonly agGrid: 'lessThanOrEqual';
98
+ readonly types: readonly ["date"];
99
+ readonly arity: 1;
100
+ }, {
101
+ readonly id: 'dateAfter';
102
+ readonly url: 'after';
103
+ readonly agGrid: 'greaterThan';
104
+ readonly types: readonly ["date"];
105
+ readonly arity: 1;
106
+ }, {
107
+ readonly id: 'dateAfterOrEqual';
108
+ readonly url: 'afterEq';
109
+ readonly agGrid: 'greaterThanOrEqual';
110
+ readonly types: readonly ["date"];
111
+ readonly arity: 1;
112
+ }, {
113
+ readonly id: 'dateRange';
114
+ readonly url: 'daterange';
115
+ readonly agGrid: 'inRange';
116
+ readonly types: readonly ["date"];
117
+ readonly arity: 2;
118
+ }];
119
+ export type Operator = (typeof OPERATORS)[number];
120
+ export type OperatorId = Operator['id'];
121
+ /**
122
+ * The ids of the rows in `Ops` that match `Match`, in table order, as a tuple
123
+ * with a literal type at each index
124
+ */
125
+ type IdsWhere<Ops extends readonly unknown[], Match> = Ops extends readonly [
126
+ infer Head,
127
+ ...infer Rest
128
+ ] ? Head extends Match ? Head extends {
129
+ id: infer Id;
130
+ } ? [Id, ...IdsWhere<Rest, Match>] : IdsWhere<Rest, Match> : IdsWhere<Rest, Match> : [];
131
+ /**
132
+ * The tuples for each filter type, in a map. A generic `T` then indexes
133
+ * concrete tuples, so TypeScript can compare the generic type with a list of
134
+ * ids.
135
+ */
136
+ type OnlyForTuples = {
137
+ [K in OperatorFilterType]: Readonly<IdsWhere<typeof OPERATORS, {
138
+ types: readonly [K];
139
+ }>>;
140
+ };
141
+ /** Ids of the operations that only one filter type supports, as a tuple */
142
+ export type OperationsOnlyForTuple<T extends OperatorFilterType> = OnlyForTuples[T];
143
+ /** Ids of the operations that every filter type supports, as a tuple */
144
+ export type SharedOperationsTuple = Readonly<IdsWhere<typeof OPERATORS, {
145
+ types: typeof ALL_TYPES;
146
+ }>>;
147
+ /**
148
+ * Ids of the operations that a filter type supports, as a tuple: its own
149
+ * operations first, then the shared ones
150
+ */
151
+ export type OperationsForTuple<T extends OperatorFilterType> = {
152
+ [K in OperatorFilterType]: readonly [
153
+ ...OnlyForTuples[K],
154
+ ...SharedOperationsTuple
155
+ ];
156
+ }[T];
157
+ /** Ids of the operations that a filter type supports, shared ones included */
158
+ export type OperationsFor<T extends OperatorFilterType> = OperationsForTuple<T>[number];
159
+ /** Ids of the operations that only one filter type supports */
160
+ export type OperationsOnlyFor<T extends OperatorFilterType> = OperationsOnlyForTuple<T>[number];
161
+ /** Ids of the operations that every filter type supports */
162
+ export type SharedOperationId = SharedOperationsTuple[number];
163
+ /** The operations that only `type` supports, in table order */
164
+ export declare function operationsOnlyFor<T extends OperatorFilterType>(type: T): OperationsOnlyForTuple<T>;
165
+ /** The operations that every filter type supports, in table order */
166
+ export declare function sharedOperations(): SharedOperationsTuple;
167
+ /**
168
+ * The operations that `type` supports: its own operations first, then the
169
+ * shared ones
170
+ */
171
+ export declare function operationsFor<T extends OperatorFilterType>(type: T): OperationsForTuple<T>;
172
+ /** The operator with this internal id */
173
+ export declare function operatorById(id: string): Operator | undefined;
174
+ /** The operator with this name in a URL param (`gt`, `before`, `neq`, …) */
175
+ export declare function operatorFromUrl(urlName: string): Operator | undefined;
176
+ /**
177
+ * The operator for an AG Grid operation name on a filter type. The key is the
178
+ * pair, because AG Grid uses one name for a number and a date operation
179
+ * (`lessThan` is `lessThan` on a number filter and `dateBefore` on a date
180
+ * filter).
181
+ */
182
+ export declare function operatorFromAgGrid(filterType: string | undefined, agGridName: string | undefined): Operator | undefined;
183
+ /** Whether `id` is an operation that only `type` supports */
184
+ export declare function isOperationOnlyFor<T extends OperatorFilterType>(id: string, type: T): id is OperationsOnlyFor<T>;
185
+ /** Whether `id` is an operation that every filter type supports */
186
+ export declare function isSharedOperation(id: string): id is SharedOperationId;
187
+ /** Whether `id` is an operation that `type` supports */
188
+ export declare function isOperationFor<T extends OperatorFilterType>(id: string, type: T): id is OperationsFor<T>;
189
+ export {};
@@ -0,0 +1,60 @@
1
+ const ALL_TYPES = ['text', 'number', 'date'];
2
+ export const OPERATORS = [
3
+ { id: 'contains', url: 'contains', agGrid: 'contains', types: ['text'], arity: 1 },
4
+ { id: 'notContains', url: 'notContains', agGrid: 'notContains', types: ['text'], arity: 1 },
5
+ { id: 'startsWith', url: 'startsWith', agGrid: 'startsWith', types: ['text'], arity: 1 },
6
+ { id: 'endsWith', url: 'endsWith', agGrid: 'endsWith', types: ['text'], arity: 1 },
7
+ { id: 'eq', url: 'eq', agGrid: 'equals', types: ALL_TYPES, arity: 1 },
8
+ { id: 'notEqual', url: 'neq', agGrid: 'notEqual', types: ALL_TYPES, arity: 1 },
9
+ { id: 'blank', url: 'blank', agGrid: 'blank', types: ALL_TYPES, arity: 0 },
10
+ { id: 'notBlank', url: 'notBlank', agGrid: 'notBlank', types: ALL_TYPES, arity: 0 },
11
+ { id: 'lessThan', url: 'lt', agGrid: 'lessThan', types: ['number'], arity: 1 },
12
+ { id: 'lessThanOrEqual', url: 'lte', agGrid: 'lessThanOrEqual', types: ['number'], arity: 1 },
13
+ { id: 'greaterThan', url: 'gt', agGrid: 'greaterThan', types: ['number'], arity: 1 },
14
+ { id: 'greaterThanOrEqual', url: 'gte', agGrid: 'greaterThanOrEqual', types: ['number'], arity: 1 },
15
+ { id: 'inRange', url: 'range', agGrid: 'inRange', types: ['number'], arity: 2 },
16
+ { id: 'dateBefore', url: 'before', agGrid: 'lessThan', types: ['date'], arity: 1 },
17
+ { id: 'dateBeforeOrEqual', url: 'beforeEq', agGrid: 'lessThanOrEqual', types: ['date'], arity: 1 },
18
+ { id: 'dateAfter', url: 'after', agGrid: 'greaterThan', types: ['date'], arity: 1 },
19
+ { id: 'dateAfterOrEqual', url: 'afterEq', agGrid: 'greaterThanOrEqual', types: ['date'], arity: 1 },
20
+ { id: 'dateRange', url: 'daterange', agGrid: 'inRange', types: ['date'], arity: 2 }
21
+ ];
22
+ const isShared = (op) => op.types.length === ALL_TYPES.length;
23
+ const supports = (op, type) => op.types.some(own => own === type);
24
+ export function operationsOnlyFor(type) {
25
+ const ids = OPERATORS.flatMap(op => !isShared(op) && supports(op, type) ? [op.id] : []);
26
+ return ids;
27
+ }
28
+ export function sharedOperations() {
29
+ const ids = OPERATORS.flatMap(op => isShared(op) ? [op.id] : []);
30
+ return ids;
31
+ }
32
+ export function operationsFor(type) {
33
+ const own = operationsOnlyFor(type);
34
+ const ids = [...own, ...sharedOperations()];
35
+ return ids;
36
+ }
37
+ const BY_ID = new Map(OPERATORS.map(op => [op.id, op]));
38
+ const BY_URL = new Map(OPERATORS.map(op => [op.url, op]));
39
+ export function operatorById(id) {
40
+ return BY_ID.get(id);
41
+ }
42
+ export function operatorFromUrl(urlName) {
43
+ return BY_URL.get(urlName);
44
+ }
45
+ export function operatorFromAgGrid(filterType, agGridName) {
46
+ return OPERATORS.find(op => op.agGrid === agGridName && supports(op, filterType));
47
+ }
48
+ export function isOperationOnlyFor(id, type) {
49
+ const op = operatorById(id);
50
+ return op !== undefined && !isShared(op) && supports(op, type);
51
+ }
52
+ export function isSharedOperation(id) {
53
+ const op = operatorById(id);
54
+ return op !== undefined && isShared(op);
55
+ }
56
+ export function isOperationFor(id, type) {
57
+ const op = operatorById(id);
58
+ return op !== undefined && supports(op, type);
59
+ }
60
+ //# sourceMappingURL=operators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/core/operators.ts"],"names":[],"mappings":"AAaA,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAA;AASrD,MAAM,CAAC,MAAM,SAAS,GAAG;IAEvB,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IAClF,EAAE,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IAC3F,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IACxF,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;IAElF,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE;IACrE,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,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AAC,CAAA;IAE3B,OAAO,EAAE,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;AAChE,CAAC;AAGD,MAAM,UAAU,iBAAiB,CAAC,EAAU;IAC1C,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,CAAA;IAE3B,OAAO,EAAE,KAAK,SAAS,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAA;AACzC,CAAC;AAGD,MAAM,UAAU,cAAc,CAC5B,EAAU,EACV,IAAO;IAEP,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,CAAA;IAE3B,OAAO,EAAE,KAAK,SAAS,IAAI,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { AGGridUrlSyncConfig, ResolvedOptions } from './types.js';
2
+ /**
3
+ * Default configuration values
4
+ */
5
+ export declare const DEFAULT_CONFIG: {
6
+ readonly paramPrefix: 'f_';
7
+ readonly maxValueLength: 200;
8
+ readonly serialization: 'individual';
9
+ readonly groupedParam: 'grid_filters';
10
+ readonly format: 'querystring';
11
+ readonly onParseError: () => void;
12
+ readonly throwOnError: false;
13
+ };
14
+ /**
15
+ * Fills in the default of each option that the config leaves out or sets to
16
+ * undefined. The result has only the options, so a `gridApi` or any other
17
+ * key in the config is not copied. The config is not changed.
18
+ *
19
+ * An empty `paramPrefix` is kept: the prefix rules read it as the default.
20
+ */
21
+ export declare function resolveOptions(options?: AGGridUrlSyncConfig): ResolvedOptions;
@@ -0,0 +1,21 @@
1
+ export const DEFAULT_CONFIG = {
2
+ paramPrefix: 'f_',
3
+ maxValueLength: 200,
4
+ serialization: 'individual',
5
+ groupedParam: 'grid_filters',
6
+ format: 'querystring',
7
+ onParseError: () => { },
8
+ throwOnError: false
9
+ };
10
+ export function resolveOptions(options = {}) {
11
+ return {
12
+ paramPrefix: options.paramPrefix ?? DEFAULT_CONFIG.paramPrefix,
13
+ maxValueLength: options.maxValueLength ?? DEFAULT_CONFIG.maxValueLength,
14
+ onParseError: options.onParseError ?? DEFAULT_CONFIG.onParseError,
15
+ serialization: options.serialization ?? DEFAULT_CONFIG.serialization,
16
+ groupedParam: options.groupedParam ?? DEFAULT_CONFIG.groupedParam,
17
+ format: options.format ?? DEFAULT_CONFIG.format,
18
+ throwOnError: options.throwOnError ?? DEFAULT_CONFIG.throwOnError
19
+ };
20
+ }
21
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/core/options.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,GAAG;IACnB,aAAa,EAAE,YAAqB;IACpC,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,aAAsB;IAC9B,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,YAAY,EAAE,KAAK;CACe,CAAA;AASpC,MAAM,UAAU,cAAc,CAC5B,OAAO,GAAwB,EAAE;IAEjC,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,cAAc,CAAC,WAAW;QAC9D,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,cAAc,CAAC,cAAc;QACvE,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,cAAc,CAAC,YAAY;QACjE,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,cAAc,CAAC,aAAa;QACpE,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,cAAc,CAAC,YAAY;QACjE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM;QAC/C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,cAAc,CAAC,YAAY;KAClE,CAAA;AACH,CAAC"}
@@ -0,0 +1,138 @@
1
+ import type { FilterModel } from 'ag-grid-community';
2
+ import type { FilterState } from './types.js';
3
+ /** What a write is. It decides the key form and the history write at the landing. */
4
+ export type WriteKind = 'url' | 'view' | 'restore' | 'app';
5
+ /** Per-column values: a FilterState ('url') or an AG Grid model (the others) */
6
+ export type Columns = Readonly<FilterState> | Readonly<FilterModel>;
7
+ /**
8
+ * The sync's own latest grid write. It is set before setFilterModel, because
9
+ * AG Grid can send filterChanged inside the call, after it, or one tick later.
10
+ * - `writing`: inside the call, so an event is the write landing.
11
+ * - `pending`: the grid did not take the write yet (deferred). `before` is
12
+ * the grid's columns before the write, and `accepted` the part of the write
13
+ * that the grid has columns for. A model write also has `acceptedUrlKey`:
14
+ * the URL form of `accepted`, because the grid can rebuild a model.
15
+ * - `landed`: the grid shows the write with this key. An event with the same
16
+ * key is the write's echo: one write can cause more than one event.
17
+ *
18
+ * `waits`: the URL forms of earlier writes that were still pending when this
19
+ * write started, oldest first. A deferred grid lands them first and in
20
+ * order, so their landing events are echoes of this write, not changes.
21
+ * Each such event takes its write (and the ones before it) off the queue.
22
+ */
23
+ export type OwnWrite = {
24
+ readonly phase: 'writing';
25
+ readonly kind: WriteKind;
26
+ readonly waits?: readonly string[] | undefined;
27
+ } | {
28
+ readonly phase: 'pending';
29
+ readonly kind: WriteKind;
30
+ readonly before: Columns | null;
31
+ readonly beforeKey: string | null;
32
+ readonly accepted: Columns;
33
+ readonly acceptedKey: string;
34
+ readonly acceptedUrlKey?: string | undefined;
35
+ readonly acceptedColumnUrlKeys?: ColumnUrlKeys | undefined;
36
+ readonly waits?: readonly string[] | undefined;
37
+ } | {
38
+ readonly phase: 'landed';
39
+ readonly kind: WriteKind;
40
+ readonly key: string;
41
+ };
42
+ /**
43
+ * The URL form of each column of a model, by column id. A column that the
44
+ * URL cannot hold (a set filter) has no entry.
45
+ */
46
+ export type ColumnUrlKeys = ReadonlyMap<string, string>;
47
+ /** The URL form of each column of the grid now and of the write */
48
+ export interface ColumnUrlForms {
49
+ readonly live: ColumnUrlKeys;
50
+ readonly written: ColumnUrlKeys;
51
+ }
52
+ export interface AfterCall {
53
+ readonly kind: WriteKind;
54
+ /** The grid threw */
55
+ readonly failed: boolean;
56
+ /** The key of the grid after the call. Null: the grid could not be read. */
57
+ readonly afterKey: string | null;
58
+ readonly before: Columns | null;
59
+ readonly beforeKey: string | null;
60
+ readonly accepted: Columns;
61
+ readonly acceptedKey: string;
62
+ /** A model write: the URL form of `accepted` */
63
+ readonly acceptedUrlKey?: string | undefined;
64
+ /** A model write: the URL form of each column of `accepted` */
65
+ readonly acceptedColumnUrlKeys?: ColumnUrlKeys | undefined;
66
+ }
67
+ export interface Settled {
68
+ readonly own: OwnWrite | null;
69
+ readonly landed: boolean;
70
+ }
71
+ export interface Classified {
72
+ readonly own: OwnWrite | null;
73
+ readonly kind: EventKind;
74
+ readonly write: WriteKind | null;
75
+ /**
76
+ * An echo in which the grid lands an earlier write from `waits`: the grid
77
+ * passes through the state of that write
78
+ */
79
+ readonly queued?: boolean | undefined;
80
+ }
81
+ /**
82
+ * The record of a new write, set before setFilterModel. A write that starts
83
+ * while another write is pending keeps the URL form of that write (and of
84
+ * the writes that it waited for) in `waits`.
85
+ */
86
+ export declare function startWrite(own: OwnWrite | null, kind: WriteKind): OwnWrite;
87
+ /** After the sync's setFilterModel returns. `landed`: the write is on the grid now. */
88
+ export declare function settleWrite(own: OwnWrite | null, call: AfterCall): Settled;
89
+ /**
90
+ * - `echo`: the same grid state as the record (or the state from before the
91
+ * write, while the write is pending).
92
+ * - `landing`: the pending write lands now.
93
+ * - `change`: anything else. The record ends.
94
+ */
95
+ export type EventKind = 'echo' | 'landing' | 'change';
96
+ /**
97
+ * A filterChanged outside the call. `key` and `live` are in the form of
98
+ * `own.kind`. For a pending model write, `urlKey` is the URL form of `live`,
99
+ * and `columnUrlKeys` the URL form of each of its columns.
100
+ */
101
+ export declare function classifyEvent(own: OwnWrite | null, event: {
102
+ key: string;
103
+ live: Columns;
104
+ source: string | undefined;
105
+ urlKey?: string | undefined;
106
+ columnUrlKeys?: ColumnUrlKeys | undefined;
107
+ }): Classified;
108
+ /**
109
+ * The record that a new sync on the same grid takes from the earlier sync
110
+ * (#276), checked against the grid now. The write can land, or the user can
111
+ * edit, while no sync listens (for example while React hides the tree), so
112
+ * the record holds only while the grid agrees with it:
113
+ * - pending: the grid still shows the state from before (still pending), or
114
+ * it shows the write, also in a form that the grid made of it (landed).
115
+ * - landed: the grid still shows it.
116
+ * Anything else is null: the next event is then a change, as with no record.
117
+ * `live` has the keys of the grid now in the record's form, and for a model
118
+ * write the URL form. Null: the grid cannot be read.
119
+ */
120
+ export declare function takeOver(own: OwnWrite, live: {
121
+ key: string;
122
+ urlKey?: string | undefined;
123
+ } | null): OwnWrite | null;
124
+ /**
125
+ * A key for per-column values that depends on no key order, at any level.
126
+ * The grid can rebuild a column's model with its keys in another order.
127
+ */
128
+ export declare function modelKey(columns: Columns): string;
129
+ /**
130
+ * Whether the grid's columns could be a write landing in which the grid took
131
+ * only part of the write: each column has the write's value, or the value
132
+ * that the grid had before. At least one column must be the write's, so a
133
+ * clear-all or another value is a change, not the landing (#274 review).
134
+ *
135
+ * With `forms`, a column that the grid rebuilt is the write's too when its
136
+ * URL form is the URL form of the write's column (#223).
137
+ */
138
+ export declare function couldBeLanding(live: Columns, accepted: Columns, before: Columns | null, forms?: ColumnUrlForms): boolean;
@@ -0,0 +1,133 @@
1
+ export function startWrite(own, kind) {
2
+ if (own?.phase !== 'pending')
3
+ return { phase: 'writing', kind };
4
+ const urlForm = own.kind === 'url' ? own.acceptedKey : own.acceptedUrlKey;
5
+ const waits = [
6
+ ...(own.waits ?? []),
7
+ ...(urlForm === undefined ? [] : [urlForm])
8
+ ];
9
+ return waits.length
10
+ ? { phase: 'writing', kind, waits }
11
+ : { phase: 'writing', kind };
12
+ }
13
+ export function settleWrite(own, call) {
14
+ if (call.failed)
15
+ return { own: null, landed: false };
16
+ if (own?.phase === 'landed') {
17
+ return {
18
+ own: { phase: 'landed', kind: call.kind, key: call.afterKey ?? own.key },
19
+ landed: true
20
+ };
21
+ }
22
+ const waits = own?.phase === 'writing' ? own.waits : undefined;
23
+ if (call.afterKey !== null &&
24
+ ((waits === undefined && call.afterKey === call.acceptedKey) ||
25
+ (call.beforeKey !== null && call.afterKey !== call.beforeKey))) {
26
+ return {
27
+ own: { phase: 'landed', kind: call.kind, key: call.afterKey },
28
+ landed: true
29
+ };
30
+ }
31
+ return {
32
+ own: {
33
+ phase: 'pending',
34
+ kind: call.kind,
35
+ before: call.before,
36
+ beforeKey: call.beforeKey,
37
+ accepted: call.accepted,
38
+ acceptedKey: call.acceptedKey,
39
+ acceptedUrlKey: call.acceptedUrlKey,
40
+ acceptedColumnUrlKeys: call.acceptedColumnUrlKeys,
41
+ waits
42
+ },
43
+ landed: false
44
+ };
45
+ }
46
+ export function classifyEvent(own, event) {
47
+ if (own?.phase === 'landed' && event.key === own.key) {
48
+ return { own, kind: 'echo', write: own.kind };
49
+ }
50
+ if (own?.phase === 'pending') {
51
+ if (event.source === 'api') {
52
+ const waited = afterWait(own, event);
53
+ if (waited)
54
+ return waited;
55
+ }
56
+ if (event.key === own.acceptedKey)
57
+ return landing(own, event.key);
58
+ if (own.beforeKey !== null && event.key === own.beforeKey) {
59
+ return { own, kind: 'echo', write: own.kind };
60
+ }
61
+ const forms = own.acceptedColumnUrlKeys && event.columnUrlKeys
62
+ ? { live: event.columnUrlKeys, written: own.acceptedColumnUrlKeys }
63
+ : undefined;
64
+ if (event.source === 'api' &&
65
+ (couldBeLanding(event.live, own.accepted, own.before, forms) ||
66
+ rebuiltLanding(own, event))) {
67
+ return landing(own, event.key);
68
+ }
69
+ }
70
+ return { own: null, kind: 'change', write: null };
71
+ }
72
+ function landing(own, key) {
73
+ return {
74
+ own: { phase: 'landed', kind: own.kind, key },
75
+ kind: 'landing',
76
+ write: own.kind
77
+ };
78
+ }
79
+ function afterWait(own, event) {
80
+ const urlForm = own.kind === 'url' ? event.key : event.urlKey;
81
+ const waits = own.waits ?? [];
82
+ const at = urlForm === undefined ? -1 : waits.indexOf(urlForm);
83
+ if (at < 0)
84
+ return null;
85
+ const rest = waits.slice(at + 1);
86
+ const other = rest.findIndex(form => form !== urlForm);
87
+ const left = other < 0 ? [] : rest.slice(other);
88
+ const next = { ...own, waits: left };
89
+ if (left.length === 0 && event.key === own.acceptedKey) {
90
+ return landing(next, event.key);
91
+ }
92
+ return { own: next, kind: 'echo', write: own.kind, queued: true };
93
+ }
94
+ function rebuiltLanding(own, event) {
95
+ return (own.acceptedUrlKey !== undefined &&
96
+ event.urlKey === own.acceptedUrlKey &&
97
+ event.key !== own.beforeKey);
98
+ }
99
+ export function takeOver(own, live) {
100
+ if (live === null || own.phase === 'writing')
101
+ return null;
102
+ if (own.phase === 'landed')
103
+ return live.key === own.key ? own : null;
104
+ if (own.beforeKey !== null && live.key === own.beforeKey)
105
+ return own;
106
+ const shown = live.key === own.acceptedKey ||
107
+ (own.acceptedUrlKey !== undefined && live.urlKey === own.acceptedUrlKey);
108
+ return shown ? { phase: 'landed', kind: own.kind, key: live.key } : null;
109
+ }
110
+ export function modelKey(columns) {
111
+ return stableJson(columns);
112
+ }
113
+ function stableJson(value) {
114
+ return JSON.stringify(value, (_key, part) => part instanceof Object && !Array.isArray(part)
115
+ ? Object.fromEntries(Object.entries(part).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)))
116
+ : part);
117
+ }
118
+ export function couldBeLanding(live, accepted, before, forms) {
119
+ const columns = Object.keys(live);
120
+ const sameUrlForm = (colId) => {
121
+ const written = forms?.written.get(colId);
122
+ return written !== undefined && forms?.live.get(colId) === written;
123
+ };
124
+ const fromWrite = (colId) => Object.hasOwn(accepted, colId) &&
125
+ (stableJson(live[colId]) === stableJson(accepted[colId]) ||
126
+ sameUrlForm(colId));
127
+ const fromBefore = (colId) => before !== null &&
128
+ Object.hasOwn(before, colId) &&
129
+ stableJson(live[colId]) === stableJson(before[colId]);
130
+ return (columns.some(fromWrite) &&
131
+ columns.every(colId => fromWrite(colId) || fromBefore(colId)));
132
+ }
133
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AAK,CAAC,CAAC,CAAA;IAEvD,OAAO,CACL,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAC9D,CAAA;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ import * as v from 'valibot';
2
+ /** Any JSON object (arrays included, the same as `typeof x === 'object'`) */
3
+ export declare const JsonObjectSchema: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
4
+ /** One column filter in the library's own format */
5
+ export declare const ColumnFilterSchema: v.VariantSchema<"filterType", [v.ObjectSchema<{
6
+ readonly filterType: v.LiteralSchema<"text", undefined>;
7
+ readonly type: v.PicklistSchema<readonly ["contains", "notContains", "startsWith", "endsWith", "eq", "notEqual", "blank", "notBlank"], undefined>;
8
+ readonly filter: v.StringSchema<undefined>;
9
+ }, undefined>, v.ObjectSchema<{
10
+ readonly filterType: v.LiteralSchema<"number", undefined>;
11
+ readonly type: v.PicklistSchema<readonly ["lessThan", "lessThanOrEqual", "greaterThan", "greaterThanOrEqual", "inRange", "eq", "notEqual", "blank", "notBlank"], undefined>;
12
+ readonly filter: v.NumberSchema<undefined>;
13
+ readonly filterTo: v.ExactOptionalSchema<v.NumberSchema<undefined>, undefined>;
14
+ }, undefined>, v.ObjectSchema<{
15
+ readonly filterType: v.LiteralSchema<"date", undefined>;
16
+ readonly type: v.PicklistSchema<readonly ["dateBefore", "dateBeforeOrEqual", "dateAfter", "dateAfterOrEqual", "dateRange", "eq", "notEqual", "blank", "notBlank"], undefined>;
17
+ readonly filter: v.StringSchema<undefined>;
18
+ readonly filterTo: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
19
+ }, undefined>], undefined>;
20
+ /** One saved view. A view that does not match is dropped, not repaired. */
21
+ export declare const GridViewSchema: v.ObjectSchema<{
22
+ readonly id: v.StringSchema<undefined>;
23
+ readonly name: v.StringSchema<undefined>;
24
+ readonly updatedAt: v.NumberSchema<undefined>;
25
+ readonly filterModel: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
26
+ }, undefined>;
27
+ /**
28
+ * The stored blob. Reads must never fail: a `views` value that is not a list
29
+ * reads as no views, and an `activeId` that is not a string reads as none.
30
+ */
31
+ export declare const StoredViewsSchema: v.LooseObjectSchema<{
32
+ readonly views: v.SchemaWithFallback<v.ArraySchema<v.UnknownSchema, undefined>, readonly []>;
33
+ readonly activeId: v.SchemaWithFallback<v.NullableSchema<v.StringSchema<undefined>, undefined>, null>;
34
+ }, undefined>;
35
+ /** One column of the AG Grid filter model that the library can read */
36
+ export declare const AgGridFilterSchema: v.VariantSchema<"filterType", [v.LooseObjectSchema<{
37
+ readonly filterType: v.LiteralSchema<"text", undefined>;
38
+ readonly type: v.SchemaWithFallback<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
39
+ readonly filter: v.SchemaWithFallback<v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, undefined>;
40
+ }, undefined>, v.LooseObjectSchema<{
41
+ readonly filterType: v.LiteralSchema<"number", undefined>;
42
+ readonly type: v.SchemaWithFallback<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
43
+ readonly filter: v.SchemaWithFallback<v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, undefined>;
44
+ readonly filterTo: v.SchemaWithFallback<v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, undefined>;
45
+ }, undefined>, v.LooseObjectSchema<{
46
+ readonly filterType: v.LiteralSchema<"date", undefined>;
47
+ readonly type: v.SchemaWithFallback<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
48
+ readonly filter: v.SchemaWithFallback<v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>, v.NullSchema<undefined>], undefined>, undefined>, undefined>;
49
+ readonly dateFrom: v.SchemaWithFallback<v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
50
+ readonly dateTo: v.SchemaWithFallback<v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
51
+ }, undefined>], undefined>;