zitejs 0.9.100 → 0.9.101

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.
@@ -213,11 +213,12 @@ function getSdkImportSource(baseDir) {
213
213
  /**
214
214
  * `zitejs/db`, `zitejs/api`, `zitejs/integrations` and `zitejs/email` are
215
215
  * tsconfig aliases onto generated files, not real package subpaths — they are
216
- * absent from the `exports` map, and `zitejs` isn't in PREBUNDLED_LIBS either.
217
- * So marking one external doesn't defer resolution, it guarantees a module
218
- * that fails to instantiate the first time the deployed endpoint is invoked,
219
- * long after the build reported success. Fail here instead, where the message
220
- * can name the file that's missing.
216
+ * absent from the `exports` map. `zitejs/backend` IS a real subpath export, but
217
+ * it lands here too and `zitejs` is not in PREBUNDLED_LIBS, so nothing would
218
+ * resolve it in the worker either. Either way, marking one external doesn't
219
+ * defer resolution: it guarantees a module that fails to instantiate the first
220
+ * time the deployed endpoint is invoked, long after the build reported success.
221
+ * Fail here instead, where the message can name the file that's missing.
221
222
  */
222
223
  const unresolvedAlias = (specifier, expectedPath) => {
223
224
  throw new Error(`Cannot resolve '${specifier}': expected generated file at ${expectedPath}. ` +
@@ -90,10 +90,18 @@ export interface TableFindAllOptions<T = Record<string, unknown>> {
90
90
  */
91
91
  sort?: unknown[];
92
92
  filters?: RecordFilters<T>;
93
+ /**
94
+ * The nested filter format (`filters` is the legacy flat one). IGNORED here
95
+ * for the same reason as `sort` — not in `DatabasesFindAllParamsSchema`, so
96
+ * zod strips it — but kept so code already passing it still compiles. It IS
97
+ * honored by `zite.auth.findAllUsers`.
98
+ */
99
+ filter?: unknown;
93
100
  fields?: Array<FieldSelector<T>>;
94
101
  }
95
102
  export interface BulkCreateResult<T> {
96
- success: boolean;
103
+ /** Absent when `records: []` was passed — the dispatch short-circuits before setting it. */
104
+ success?: boolean;
97
105
  records: T[];
98
106
  }
99
107
  export interface UpdateResult<T> {
@@ -173,7 +181,16 @@ export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
173
181
  total: number;
174
182
  hasMore: boolean;
175
183
  };
176
- export type UpdateAuthUserProfile = Partial<Omit<AuthUser, "id" | "email" | "name">>;
184
+ /**
185
+ * `null` clears a value — `publicUpdateAuthUserInputSchema` accepts
186
+ * `string | null | undefined` on each of these, and null is the only way to
187
+ * unset a name.
188
+ */
189
+ export type UpdateAuthUserProfile = {
190
+ firstName?: string | null;
191
+ lastName?: string | null;
192
+ image?: string | null;
193
+ };
177
194
  export interface AuthClient<T extends AuthUser = AuthUser> {
178
195
  findAllUsers(options?: FindAllAuthUsersOptions): Promise<FindAllAuthUsersResult<T>>;
179
196
  updateUserProfile(userId: string, profile: UpdateAuthUserProfile): Promise<T>;
@@ -1058,8 +1058,22 @@ function generateBackendWrapperTs(envVarNames = []) {
1058
1058
  // Narrows `user` to this app's generated User. ZiteScheduledContext is
1059
1059
  // re-exported unchanged — a scheduled fire has no user at all, so there is
1060
1060
  // nothing to narrow.
1061
+ "/**",
1062
+ " * The user an endpoint sees. NOT the full `User` from zitejs/auth — that is",
1063
+ " * the browser's better-auth session, and the runtime never sends its",
1064
+ " * `name`, `emailVerified`, `image`, `createdAt` or `updatedAt` to an",
1065
+ " * endpoint. Typing those here let `context.user.createdAt.getFullYear()`",
1066
+ " * compile and throw. `Omit` keeps any index signature merged in by",
1067
+ " * `.zite/user-extensions.d.ts`, so a migrated user-sync app still reads its",
1068
+ " * synced columns off this.",
1069
+ " */",
1070
+ "export type ZiteEndpointUser = Omit<",
1071
+ " User,",
1072
+ " 'name' | 'emailVerified' | 'image' | 'createdAt' | 'updatedAt'",
1073
+ ">;",
1074
+ "",
1061
1075
  'export interface ZiteRequestContext extends Omit<_ZiteRequestContext, "user"> {',
1062
- " user: User;",
1076
+ " user: ZiteEndpointUser;",
1063
1077
  "}",
1064
1078
  "",
1065
1079
  "type SchemaLike<TOut, TIn = TOut> = { _output: TOut; _input: TIn; parse: (data: unknown) => TOut };",
@@ -177,11 +177,12 @@ function getSdkImportSource(baseDir) {
177
177
  /**
178
178
  * `zitejs/db`, `zitejs/api`, `zitejs/integrations` and `zitejs/email` are
179
179
  * tsconfig aliases onto generated files, not real package subpaths — they are
180
- * absent from the `exports` map, and `zitejs` isn't in PREBUNDLED_LIBS either.
181
- * So marking one external doesn't defer resolution, it guarantees a module
182
- * that fails to instantiate the first time the deployed endpoint is invoked,
183
- * long after the build reported success. Fail here instead, where the message
184
- * can name the file that's missing.
180
+ * absent from the `exports` map. `zitejs/backend` IS a real subpath export, but
181
+ * it lands here too and `zitejs` is not in PREBUNDLED_LIBS, so nothing would
182
+ * resolve it in the worker either. Either way, marking one external doesn't
183
+ * defer resolution: it guarantees a module that fails to instantiate the first
184
+ * time the deployed endpoint is invoked, long after the build reported success.
185
+ * Fail here instead, where the message can name the file that's missing.
185
186
  */
186
187
  const unresolvedAlias = (specifier, expectedPath) => {
187
188
  throw new Error(`Cannot resolve '${specifier}': expected generated file at ${expectedPath}. ` +
@@ -90,10 +90,18 @@ export interface TableFindAllOptions<T = Record<string, unknown>> {
90
90
  */
91
91
  sort?: unknown[];
92
92
  filters?: RecordFilters<T>;
93
+ /**
94
+ * The nested filter format (`filters` is the legacy flat one). IGNORED here
95
+ * for the same reason as `sort` — not in `DatabasesFindAllParamsSchema`, so
96
+ * zod strips it — but kept so code already passing it still compiles. It IS
97
+ * honored by `zite.auth.findAllUsers`.
98
+ */
99
+ filter?: unknown;
93
100
  fields?: Array<FieldSelector<T>>;
94
101
  }
95
102
  export interface BulkCreateResult<T> {
96
- success: boolean;
103
+ /** Absent when `records: []` was passed — the dispatch short-circuits before setting it. */
104
+ success?: boolean;
97
105
  records: T[];
98
106
  }
99
107
  export interface UpdateResult<T> {
@@ -173,7 +181,16 @@ export type FindAllAuthUsersResult<T extends AuthUser = AuthUser> = {
173
181
  total: number;
174
182
  hasMore: boolean;
175
183
  };
176
- export type UpdateAuthUserProfile = Partial<Omit<AuthUser, "id" | "email" | "name">>;
184
+ /**
185
+ * `null` clears a value — `publicUpdateAuthUserInputSchema` accepts
186
+ * `string | null | undefined` on each of these, and null is the only way to
187
+ * unset a name.
188
+ */
189
+ export type UpdateAuthUserProfile = {
190
+ firstName?: string | null;
191
+ lastName?: string | null;
192
+ image?: string | null;
193
+ };
177
194
  export interface AuthClient<T extends AuthUser = AuthUser> {
178
195
  findAllUsers(options?: FindAllAuthUsersOptions): Promise<FindAllAuthUsersResult<T>>;
179
196
  updateUserProfile(userId: string, profile: UpdateAuthUserProfile): Promise<T>;
@@ -1048,8 +1048,22 @@ export function generateBackendWrapperTs(envVarNames = []) {
1048
1048
  // Narrows `user` to this app's generated User. ZiteScheduledContext is
1049
1049
  // re-exported unchanged — a scheduled fire has no user at all, so there is
1050
1050
  // nothing to narrow.
1051
+ "/**",
1052
+ " * The user an endpoint sees. NOT the full `User` from zitejs/auth — that is",
1053
+ " * the browser's better-auth session, and the runtime never sends its",
1054
+ " * `name`, `emailVerified`, `image`, `createdAt` or `updatedAt` to an",
1055
+ " * endpoint. Typing those here let `context.user.createdAt.getFullYear()`",
1056
+ " * compile and throw. `Omit` keeps any index signature merged in by",
1057
+ " * `.zite/user-extensions.d.ts`, so a migrated user-sync app still reads its",
1058
+ " * synced columns off this.",
1059
+ " */",
1060
+ "export type ZiteEndpointUser = Omit<",
1061
+ " User,",
1062
+ " 'name' | 'emailVerified' | 'image' | 'createdAt' | 'updatedAt'",
1063
+ ">;",
1064
+ "",
1051
1065
  'export interface ZiteRequestContext extends Omit<_ZiteRequestContext, "user"> {',
1052
- " user: User;",
1066
+ " user: ZiteEndpointUser;",
1053
1067
  "}",
1054
1068
  "",
1055
1069
  "type SchemaLike<TOut, TIn = TOut> = { _output: TOut; _input: TIn; parse: (data: unknown) => TOut };",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.100",
3
+ "version": "0.9.101",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",