zitejs 0.9.96 → 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
@@ -43,12 +63,19 @@ export type RecordFilters<T> = {
43
63
  export type InferSchemaType<T> = T extends {
44
64
  _output: infer U;
45
65
  } ? U : T;
66
+ /**
67
+ * SDK field names, with autocomplete, but not restricted to them: the runtime
68
+ * resolves a raw field id too ("Step 1: check if it's already a field ID" in
69
+ * `transformFieldsToFieldIds`). `string & {}` keeps the known keys as
70
+ * suggestions while still admitting an id, which `keyof T` alone would reject.
71
+ */
72
+ export type FieldSelector<T> = Extract<keyof T, string> | (string & {});
46
73
  export interface TableFindAllOptions<T = Record<string, unknown>> {
47
74
  limit?: number;
48
75
  offset?: number;
49
76
  sort?: unknown[];
50
77
  filters?: RecordFilters<T>;
51
- fields?: Array<Extract<keyof T, string>>;
78
+ fields?: Array<FieldSelector<T>>;
52
79
  }
53
80
  export interface BulkCreateResult<T> {
54
81
  success: boolean;
@@ -75,7 +102,7 @@ export interface TableClient<T, TInput = T> {
75
102
  findOne(params: {
76
103
  id?: string;
77
104
  filters?: RecordFilters<T>;
78
- fields?: Array<Extract<keyof T, string>>;
105
+ fields?: Array<FieldSelector<T>>;
79
106
  }): Promise<T | undefined>;
80
107
  create(params: {
81
108
  record: Partial<TInput>;
@@ -118,6 +145,13 @@ export interface AuthUser {
118
145
  export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, "fields"> & {
119
146
  /** Restrict results to users belonging to any of these apps. */
120
147
  appIds?: string[];
148
+ /**
149
+ * Nested filter (`RecordsNestedFilterSchema`), the newer format alongside the
150
+ * flat `filters`. Only the auth client forwards it — the table `findAll` path
151
+ * destructures `{ filters, limit, offset, fields }` and drops it — which is
152
+ * why it lives here rather than on `TableFindAllOptions`.
153
+ */
154
+ filter?: unknown;
121
155
  };
122
156
  export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
123
157
  records: T[];
@@ -136,7 +170,7 @@ export interface AirtableTableClient<T, TInput = T> {
136
170
  /** An opaque cursor from a previous call — not a row count. */
137
171
  offset?: string;
138
172
  limit?: number;
139
- filters?: RecordFilters<T>;
173
+ filters?: AirtableRecordFilters<T>;
140
174
  }): Promise<{
141
175
  records: T[];
142
176
  offset: string | undefined;
@@ -144,7 +178,7 @@ export interface AirtableTableClient<T, TInput = T> {
144
178
  }>;
145
179
  findOne(params: {
146
180
  id?: string;
147
- filters?: RecordFilters<T>;
181
+ filters?: AirtableRecordFilters<T>;
148
182
  }): Promise<T | undefined>;
149
183
  create(params: {
150
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
@@ -43,12 +63,19 @@ export type RecordFilters<T> = {
43
63
  export type InferSchemaType<T> = T extends {
44
64
  _output: infer U;
45
65
  } ? U : T;
66
+ /**
67
+ * SDK field names, with autocomplete, but not restricted to them: the runtime
68
+ * resolves a raw field id too ("Step 1: check if it's already a field ID" in
69
+ * `transformFieldsToFieldIds`). `string & {}` keeps the known keys as
70
+ * suggestions while still admitting an id, which `keyof T` alone would reject.
71
+ */
72
+ export type FieldSelector<T> = Extract<keyof T, string> | (string & {});
46
73
  export interface TableFindAllOptions<T = Record<string, unknown>> {
47
74
  limit?: number;
48
75
  offset?: number;
49
76
  sort?: unknown[];
50
77
  filters?: RecordFilters<T>;
51
- fields?: Array<Extract<keyof T, string>>;
78
+ fields?: Array<FieldSelector<T>>;
52
79
  }
53
80
  export interface BulkCreateResult<T> {
54
81
  success: boolean;
@@ -75,7 +102,7 @@ export interface TableClient<T, TInput = T> {
75
102
  findOne(params: {
76
103
  id?: string;
77
104
  filters?: RecordFilters<T>;
78
- fields?: Array<Extract<keyof T, string>>;
105
+ fields?: Array<FieldSelector<T>>;
79
106
  }): Promise<T | undefined>;
80
107
  create(params: {
81
108
  record: Partial<TInput>;
@@ -118,6 +145,13 @@ export interface AuthUser {
118
145
  export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, "fields"> & {
119
146
  /** Restrict results to users belonging to any of these apps. */
120
147
  appIds?: string[];
148
+ /**
149
+ * Nested filter (`RecordsNestedFilterSchema`), the newer format alongside the
150
+ * flat `filters`. Only the auth client forwards it — the table `findAll` path
151
+ * destructures `{ filters, limit, offset, fields }` and drops it — which is
152
+ * why it lives here rather than on `TableFindAllOptions`.
153
+ */
154
+ filter?: unknown;
121
155
  };
122
156
  export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
123
157
  records: T[];
@@ -136,7 +170,7 @@ export interface AirtableTableClient<T, TInput = T> {
136
170
  /** An opaque cursor from a previous call — not a row count. */
137
171
  offset?: string;
138
172
  limit?: number;
139
- filters?: RecordFilters<T>;
173
+ filters?: AirtableRecordFilters<T>;
140
174
  }): Promise<{
141
175
  records: T[];
142
176
  offset: string | undefined;
@@ -144,7 +178,7 @@ export interface AirtableTableClient<T, TInput = T> {
144
178
  }>;
145
179
  findOne(params: {
146
180
  id?: string;
147
- filters?: RecordFilters<T>;
181
+ filters?: AirtableRecordFilters<T>;
148
182
  }): Promise<T | undefined>;
149
183
  create(params: {
150
184
  record: Partial<TInput>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.96",
4
- "description": "The Zite framework \u2014 build apps on Zite Database",
3
+ "version": "0.9.98",
4
+ "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "module": "./dist/esm/index.js",