zitejs 0.9.97 → 0.9.98
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.
|
@@ -26,6 +26,26 @@ export type FilterCondition<V> = {
|
|
|
26
26
|
};
|
|
27
27
|
/** Pre-monorepo name for {@link FilterCondition}. Kept so migrated app code that spells the type out still compiles. */
|
|
28
28
|
export type FilterOperators<V> = FilterCondition<V> | V;
|
|
29
|
+
/**
|
|
30
|
+
* Airtable's filter set is the shared one plus two of its own, both compiled to
|
|
31
|
+
* formulas in `integrations/airtable/formulas.ts`:
|
|
32
|
+
*
|
|
33
|
+
* - `equals` — explicit equality, alongside the bare-value shorthand.
|
|
34
|
+
* - `ilike` — case-insensitive equality (`LOWER(f) = LOWER(v)`). Load-bearing:
|
|
35
|
+
* the `zite.auth.ts` generated for a migrated user-sync app matches rostered
|
|
36
|
+
* emails with it, because Airtable compares text case-sensitively while Zite
|
|
37
|
+
* lowercases emails on some sign-in paths and not others.
|
|
38
|
+
*
|
|
39
|
+
* Kept separate from `FilterCondition` rather than merged into it, so a Zite DB
|
|
40
|
+
* filter can't offer an operator its runtime ignores.
|
|
41
|
+
*/
|
|
42
|
+
export type AirtableFilterCondition<V> = FilterCondition<V> & {
|
|
43
|
+
equals?: V;
|
|
44
|
+
ilike?: V | V[];
|
|
45
|
+
};
|
|
46
|
+
export type AirtableRecordFilters<T> = {
|
|
47
|
+
[K in keyof T]?: T[K] | (T[K] extends Array<infer E> ? E : never) | AirtableFilterCondition<T[K]>;
|
|
48
|
+
};
|
|
29
49
|
/**
|
|
30
50
|
* Filters keyed by the record's own field names. Typed rather than `unknown`
|
|
31
51
|
* because an unrecognized key is not an error at runtime — it passes through
|
|
@@ -150,7 +170,7 @@ export interface AirtableTableClient<T, TInput = T> {
|
|
|
150
170
|
/** An opaque cursor from a previous call — not a row count. */
|
|
151
171
|
offset?: string;
|
|
152
172
|
limit?: number;
|
|
153
|
-
filters?:
|
|
173
|
+
filters?: AirtableRecordFilters<T>;
|
|
154
174
|
}): Promise<{
|
|
155
175
|
records: T[];
|
|
156
176
|
offset: string | undefined;
|
|
@@ -158,7 +178,7 @@ export interface AirtableTableClient<T, TInput = T> {
|
|
|
158
178
|
}>;
|
|
159
179
|
findOne(params: {
|
|
160
180
|
id?: string;
|
|
161
|
-
filters?:
|
|
181
|
+
filters?: AirtableRecordFilters<T>;
|
|
162
182
|
}): Promise<T | undefined>;
|
|
163
183
|
create(params: {
|
|
164
184
|
record: Partial<TInput>;
|
|
@@ -26,6 +26,26 @@ export type FilterCondition<V> = {
|
|
|
26
26
|
};
|
|
27
27
|
/** Pre-monorepo name for {@link FilterCondition}. Kept so migrated app code that spells the type out still compiles. */
|
|
28
28
|
export type FilterOperators<V> = FilterCondition<V> | V;
|
|
29
|
+
/**
|
|
30
|
+
* Airtable's filter set is the shared one plus two of its own, both compiled to
|
|
31
|
+
* formulas in `integrations/airtable/formulas.ts`:
|
|
32
|
+
*
|
|
33
|
+
* - `equals` — explicit equality, alongside the bare-value shorthand.
|
|
34
|
+
* - `ilike` — case-insensitive equality (`LOWER(f) = LOWER(v)`). Load-bearing:
|
|
35
|
+
* the `zite.auth.ts` generated for a migrated user-sync app matches rostered
|
|
36
|
+
* emails with it, because Airtable compares text case-sensitively while Zite
|
|
37
|
+
* lowercases emails on some sign-in paths and not others.
|
|
38
|
+
*
|
|
39
|
+
* Kept separate from `FilterCondition` rather than merged into it, so a Zite DB
|
|
40
|
+
* filter can't offer an operator its runtime ignores.
|
|
41
|
+
*/
|
|
42
|
+
export type AirtableFilterCondition<V> = FilterCondition<V> & {
|
|
43
|
+
equals?: V;
|
|
44
|
+
ilike?: V | V[];
|
|
45
|
+
};
|
|
46
|
+
export type AirtableRecordFilters<T> = {
|
|
47
|
+
[K in keyof T]?: T[K] | (T[K] extends Array<infer E> ? E : never) | AirtableFilterCondition<T[K]>;
|
|
48
|
+
};
|
|
29
49
|
/**
|
|
30
50
|
* Filters keyed by the record's own field names. Typed rather than `unknown`
|
|
31
51
|
* because an unrecognized key is not an error at runtime — it passes through
|
|
@@ -150,7 +170,7 @@ export interface AirtableTableClient<T, TInput = T> {
|
|
|
150
170
|
/** An opaque cursor from a previous call — not a row count. */
|
|
151
171
|
offset?: string;
|
|
152
172
|
limit?: number;
|
|
153
|
-
filters?:
|
|
173
|
+
filters?: AirtableRecordFilters<T>;
|
|
154
174
|
}): Promise<{
|
|
155
175
|
records: T[];
|
|
156
176
|
offset: string | undefined;
|
|
@@ -158,7 +178,7 @@ export interface AirtableTableClient<T, TInput = T> {
|
|
|
158
178
|
}>;
|
|
159
179
|
findOne(params: {
|
|
160
180
|
id?: string;
|
|
161
|
-
filters?:
|
|
181
|
+
filters?: AirtableRecordFilters<T>;
|
|
162
182
|
}): Promise<T | undefined>;
|
|
163
183
|
create(params: {
|
|
164
184
|
record: Partial<TInput>;
|