zitejs 0.9.96 → 0.9.97

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.
@@ -43,12 +43,19 @@ export type RecordFilters<T> = {
43
43
  export type InferSchemaType<T> = T extends {
44
44
  _output: infer U;
45
45
  } ? U : T;
46
+ /**
47
+ * SDK field names, with autocomplete, but not restricted to them: the runtime
48
+ * resolves a raw field id too ("Step 1: check if it's already a field ID" in
49
+ * `transformFieldsToFieldIds`). `string & {}` keeps the known keys as
50
+ * suggestions while still admitting an id, which `keyof T` alone would reject.
51
+ */
52
+ export type FieldSelector<T> = Extract<keyof T, string> | (string & {});
46
53
  export interface TableFindAllOptions<T = Record<string, unknown>> {
47
54
  limit?: number;
48
55
  offset?: number;
49
56
  sort?: unknown[];
50
57
  filters?: RecordFilters<T>;
51
- fields?: Array<Extract<keyof T, string>>;
58
+ fields?: Array<FieldSelector<T>>;
52
59
  }
53
60
  export interface BulkCreateResult<T> {
54
61
  success: boolean;
@@ -75,7 +82,7 @@ export interface TableClient<T, TInput = T> {
75
82
  findOne(params: {
76
83
  id?: string;
77
84
  filters?: RecordFilters<T>;
78
- fields?: Array<Extract<keyof T, string>>;
85
+ fields?: Array<FieldSelector<T>>;
79
86
  }): Promise<T | undefined>;
80
87
  create(params: {
81
88
  record: Partial<TInput>;
@@ -118,6 +125,13 @@ export interface AuthUser {
118
125
  export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, "fields"> & {
119
126
  /** Restrict results to users belonging to any of these apps. */
120
127
  appIds?: string[];
128
+ /**
129
+ * Nested filter (`RecordsNestedFilterSchema`), the newer format alongside the
130
+ * flat `filters`. Only the auth client forwards it — the table `findAll` path
131
+ * destructures `{ filters, limit, offset, fields }` and drops it — which is
132
+ * why it lives here rather than on `TableFindAllOptions`.
133
+ */
134
+ filter?: unknown;
121
135
  };
122
136
  export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
123
137
  records: T[];
@@ -43,12 +43,19 @@ export type RecordFilters<T> = {
43
43
  export type InferSchemaType<T> = T extends {
44
44
  _output: infer U;
45
45
  } ? U : T;
46
+ /**
47
+ * SDK field names, with autocomplete, but not restricted to them: the runtime
48
+ * resolves a raw field id too ("Step 1: check if it's already a field ID" in
49
+ * `transformFieldsToFieldIds`). `string & {}` keeps the known keys as
50
+ * suggestions while still admitting an id, which `keyof T` alone would reject.
51
+ */
52
+ export type FieldSelector<T> = Extract<keyof T, string> | (string & {});
46
53
  export interface TableFindAllOptions<T = Record<string, unknown>> {
47
54
  limit?: number;
48
55
  offset?: number;
49
56
  sort?: unknown[];
50
57
  filters?: RecordFilters<T>;
51
- fields?: Array<Extract<keyof T, string>>;
58
+ fields?: Array<FieldSelector<T>>;
52
59
  }
53
60
  export interface BulkCreateResult<T> {
54
61
  success: boolean;
@@ -75,7 +82,7 @@ export interface TableClient<T, TInput = T> {
75
82
  findOne(params: {
76
83
  id?: string;
77
84
  filters?: RecordFilters<T>;
78
- fields?: Array<Extract<keyof T, string>>;
85
+ fields?: Array<FieldSelector<T>>;
79
86
  }): Promise<T | undefined>;
80
87
  create(params: {
81
88
  record: Partial<TInput>;
@@ -118,6 +125,13 @@ export interface AuthUser {
118
125
  export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, "fields"> & {
119
126
  /** Restrict results to users belonging to any of these apps. */
120
127
  appIds?: string[];
128
+ /**
129
+ * Nested filter (`RecordsNestedFilterSchema`), the newer format alongside the
130
+ * flat `filters`. Only the auth client forwards it — the table `findAll` path
131
+ * destructures `{ filters, limit, offset, fields }` and drops it — which is
132
+ * why it lives here rather than on `TableFindAllOptions`.
133
+ */
134
+ filter?: unknown;
121
135
  };
122
136
  export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
123
137
  records: T[];
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.97",
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",