zitejs 0.9.86 → 0.9.88

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.
@@ -67,8 +67,7 @@ function getDeclaredEnvVarNames(appDir) {
67
67
  function regenerateAppTypedWrappers(appDir) {
68
68
  const outDir = (0, path_1.join)("apps", appDir, ".zite");
69
69
  (0, fs_2.mkdirSync)(outDir, { recursive: true });
70
- (0, fs_2.writeFileSync)((0, path_1.join)(outDir, "user.ts"), (0, lib_js_1.generateUserTs)());
71
- (0, fs_2.writeFileSync)((0, path_1.join)(outDir, "auth.ts"), (0, lib_js_1.generateAuthWrapperTs)());
70
+ // user.ts and auth.ts no longer generated — User type is fixed in zitejs/auth
72
71
  // Email integration: generate the Email client at .zite/integrations/email.ts.
73
72
  // Resolved by the `zitejs/email` bundler/tsconfig alias (mirrors airtable's
74
73
  // `zitejs/integrations`), so endpoint code uses `import { Email } from 'zitejs/email'`.
@@ -35,11 +35,6 @@ export type EndpointFileInfo = {
35
35
  content?: string;
36
36
  };
37
37
  export declare function generateApiTs(endpointFiles: (string | EndpointFileInfo)[]): string | null;
38
- export declare function generateUserTs(usersTableFields?: Array<{
39
- name: string;
40
- type: string;
41
- }>): string;
42
- export declare function generateAuthWrapperTs(): string;
43
38
  export type AirtableLockField = {
44
39
  id: string;
45
40
  sdkName: string;
@@ -5,8 +5,6 @@ exports.toCamelCase = toCamelCase;
5
5
  exports.generateSchema = generateSchema;
6
6
  exports.generateDbTs = generateDbTs;
7
7
  exports.generateApiTs = generateApiTs;
8
- exports.generateUserTs = generateUserTs;
9
- exports.generateAuthWrapperTs = generateAuthWrapperTs;
10
8
  exports.generateAirtableTs = generateAirtableTs;
11
9
  exports.generateBackendWrapperTs = generateBackendWrapperTs;
12
10
  exports.generateEmailSdk = generateEmailSdk;
@@ -459,66 +457,6 @@ function tsTypeForField(field) {
459
457
  return FIELD_TYPE_MAP[field.type];
460
458
  return "string";
461
459
  }
462
- function generateUserTs(usersTableFields) {
463
- const lines = [
464
- "// Auto-generated by zitejs generate. Do not edit manually.",
465
- "",
466
- ];
467
- if (usersTableFields && usersTableFields.length > 0) {
468
- lines.push("export type User = {");
469
- lines.push(" id: string;");
470
- lines.push(" email: string;");
471
- for (const field of usersTableFields) {
472
- const lowerName = field.name.toLowerCase();
473
- if (lowerName === "id" || lowerName === "email")
474
- continue;
475
- const fieldName = toCamelCase(field.name);
476
- const tsType = tsTypeForField(field);
477
- lines.push(` ${fieldName}: ${tsType};`);
478
- }
479
- lines.push(" [key: string]: unknown;");
480
- lines.push("};");
481
- }
482
- else {
483
- lines.push("export type User = {");
484
- lines.push(" id: string;");
485
- lines.push(" email: string;");
486
- lines.push(" firstName?: string;");
487
- lines.push(" lastName?: string;");
488
- lines.push(" [key: string]: unknown;");
489
- lines.push("};");
490
- }
491
- lines.push("");
492
- return lines.join("\n");
493
- }
494
- function generateAuthWrapperTs() {
495
- return [
496
- "// Auto-generated auth re-exports. Do not edit manually.",
497
- "// The real auth logic lives in the zitejs npm package (zitejs/auth).",
498
- "// Imports use zitejs/auth/base to avoid circular alias (zitejs/auth → this file).",
499
- "",
500
- "export {",
501
- " useAuth,",
502
- " useSession,",
503
- " signIn,",
504
- " signOut,",
505
- " signUp,",
506
- " loginWithRedirect,",
507
- " logout,",
508
- " updateProfile,",
509
- "} from 'zitejs/auth/base';",
510
- "",
511
- "export type {",
512
- " User,",
513
- " ZiteAppConfig,",
514
- " ZiteAuthenticationConfig,",
515
- " ZiteAuthMethods,",
516
- " ZiteAuthPage,",
517
- " ZiteAuthPageMessages,",
518
- "} from 'zitejs/auth/base';",
519
- "",
520
- ].join("\n");
521
- }
522
460
  const AIRTABLE_FIELD_TYPE_MAP = {
523
461
  // Writable fields
524
462
  singleLineText: "string",
@@ -723,7 +661,7 @@ function generateBackendWrapperTs(envVarNames = []) {
723
661
  "// Re-exports createEndpoint with context.user typed to the app User.",
724
662
  "",
725
663
  "import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext, ZiteSchedule, ZiteWebhook } from 'zitejs/backend/base';",
726
- "import type { User } from './user';",
664
+ "import type { User } from 'zitejs/auth';",
727
665
  "",
728
666
  "export type { ZiteSchedule, ZiteWebhook };",
729
667
  "",
@@ -2,42 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
4
  const lib_js_1 = require("./lib.js");
5
- (0, vitest_1.describe)('generateAuthWrapperTs', () => {
6
- const output = (0, lib_js_1.generateAuthWrapperTs)();
7
- (0, vitest_1.it)('imports from zitejs/auth/base (not zitejs/auth) to avoid circular alias', () => {
8
- (0, vitest_1.expect)(output).toContain("from 'zitejs/auth/base'");
9
- (0, vitest_1.expect)(output).not.toContain("from 'zitejs/auth';");
5
+ (0, vitest_1.describe)('generateBackendWrapperTs', () => {
6
+ const output = (0, lib_js_1.generateBackendWrapperTs)();
7
+ (0, vitest_1.it)('imports User from zitejs/auth', () => {
8
+ (0, vitest_1.expect)(output).toContain("from 'zitejs/auth'");
10
9
  });
11
- (0, vitest_1.it)('re-exports all auth runtime functions', () => {
12
- for (const fn of [
13
- 'useSession',
14
- 'signIn',
15
- 'signOut',
16
- 'signUp',
17
- 'loginWithRedirect',
18
- 'logout',
19
- ]) {
20
- (0, vitest_1.expect)(output).toContain(fn);
21
- }
10
+ (0, vitest_1.it)('exports createEndpoint', () => {
11
+ (0, vitest_1.expect)(output).toContain('createEndpoint');
22
12
  });
23
- (0, vitest_1.it)('re-exports all config types', () => {
24
- for (const type of [
25
- 'User',
26
- 'ZiteAppConfig',
27
- 'ZiteAuthenticationConfig',
28
- 'ZiteAuthMethods',
29
- 'ZiteAuthPage',
30
- 'ZiteAuthPageMessages',
31
- ]) {
32
- (0, vitest_1.expect)(output).toContain(type);
33
- }
34
- });
35
- (0, vitest_1.it)('always exports useAuth as primary API', () => {
36
- (0, vitest_1.expect)(output).toContain('useAuth');
37
- });
38
- (0, vitest_1.it)('exports all standard functions', () => {
39
- for (const fn of ['useAuth', 'useSession', 'signIn', 'signOut', 'loginWithRedirect', 'logout']) {
40
- (0, vitest_1.expect)(output).toContain(fn);
41
- }
13
+ (0, vitest_1.it)('exports ZiteError', () => {
14
+ (0, vitest_1.expect)(output).toContain('ZiteError');
42
15
  });
43
16
  });
@@ -2,7 +2,7 @@ import { watch } from "fs";
2
2
  import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync, } from "fs";
3
3
  import { join } from "path";
4
4
  import { runSync } from "../sync/index.js";
5
- import { generateDbTs, generateApiTs, generateUserTs, generateAuthWrapperTs, generateBackendWrapperTs, generateAirtableTs, generateEmailSdk, } from "../sync/lib.js";
5
+ import { generateDbTs, generateApiTs, generateBackendWrapperTs, generateAirtableTs, generateEmailSdk, } from "../sync/lib.js";
6
6
  const debounceTimers = new Map();
7
7
  function debounce(key, fn, ms) {
8
8
  const existing = debounceTimers.get(key);
@@ -63,8 +63,7 @@ function getDeclaredEnvVarNames(appDir) {
63
63
  function regenerateAppTypedWrappers(appDir) {
64
64
  const outDir = join("apps", appDir, ".zite");
65
65
  mkdirSync(outDir, { recursive: true });
66
- writeFileSync(join(outDir, "user.ts"), generateUserTs());
67
- writeFileSync(join(outDir, "auth.ts"), generateAuthWrapperTs());
66
+ // user.ts and auth.ts no longer generated — User type is fixed in zitejs/auth
68
67
  // Email integration: generate the Email client at .zite/integrations/email.ts.
69
68
  // Resolved by the `zitejs/email` bundler/tsconfig alias (mirrors airtable's
70
69
  // `zitejs/integrations`), so endpoint code uses `import { Email } from 'zitejs/email'`.
@@ -35,11 +35,6 @@ export type EndpointFileInfo = {
35
35
  content?: string;
36
36
  };
37
37
  export declare function generateApiTs(endpointFiles: (string | EndpointFileInfo)[]): string | null;
38
- export declare function generateUserTs(usersTableFields?: Array<{
39
- name: string;
40
- type: string;
41
- }>): string;
42
- export declare function generateAuthWrapperTs(): string;
43
38
  export type AirtableLockField = {
44
39
  id: string;
45
40
  sdkName: string;
@@ -447,66 +447,6 @@ function tsTypeForField(field) {
447
447
  return FIELD_TYPE_MAP[field.type];
448
448
  return "string";
449
449
  }
450
- export function generateUserTs(usersTableFields) {
451
- const lines = [
452
- "// Auto-generated by zitejs generate. Do not edit manually.",
453
- "",
454
- ];
455
- if (usersTableFields && usersTableFields.length > 0) {
456
- lines.push("export type User = {");
457
- lines.push(" id: string;");
458
- lines.push(" email: string;");
459
- for (const field of usersTableFields) {
460
- const lowerName = field.name.toLowerCase();
461
- if (lowerName === "id" || lowerName === "email")
462
- continue;
463
- const fieldName = toCamelCase(field.name);
464
- const tsType = tsTypeForField(field);
465
- lines.push(` ${fieldName}: ${tsType};`);
466
- }
467
- lines.push(" [key: string]: unknown;");
468
- lines.push("};");
469
- }
470
- else {
471
- lines.push("export type User = {");
472
- lines.push(" id: string;");
473
- lines.push(" email: string;");
474
- lines.push(" firstName?: string;");
475
- lines.push(" lastName?: string;");
476
- lines.push(" [key: string]: unknown;");
477
- lines.push("};");
478
- }
479
- lines.push("");
480
- return lines.join("\n");
481
- }
482
- export function generateAuthWrapperTs() {
483
- return [
484
- "// Auto-generated auth re-exports. Do not edit manually.",
485
- "// The real auth logic lives in the zitejs npm package (zitejs/auth).",
486
- "// Imports use zitejs/auth/base to avoid circular alias (zitejs/auth → this file).",
487
- "",
488
- "export {",
489
- " useAuth,",
490
- " useSession,",
491
- " signIn,",
492
- " signOut,",
493
- " signUp,",
494
- " loginWithRedirect,",
495
- " logout,",
496
- " updateProfile,",
497
- "} from 'zitejs/auth/base';",
498
- "",
499
- "export type {",
500
- " User,",
501
- " ZiteAppConfig,",
502
- " ZiteAuthenticationConfig,",
503
- " ZiteAuthMethods,",
504
- " ZiteAuthPage,",
505
- " ZiteAuthPageMessages,",
506
- "} from 'zitejs/auth/base';",
507
- "",
508
- ].join("\n");
509
- }
510
450
  const AIRTABLE_FIELD_TYPE_MAP = {
511
451
  // Writable fields
512
452
  singleLineText: "string",
@@ -711,7 +651,7 @@ export function generateBackendWrapperTs(envVarNames = []) {
711
651
  "// Re-exports createEndpoint with context.user typed to the app User.",
712
652
  "",
713
653
  "import type { ZiteRequestContext as _ZiteRequestContext, ZiteScheduledContext as _ZiteScheduledContext, ZiteSchedule, ZiteWebhook } from 'zitejs/backend/base';",
714
- "import type { User } from './user';",
654
+ "import type { User } from 'zitejs/auth';",
715
655
  "",
716
656
  "export type { ZiteSchedule, ZiteWebhook };",
717
657
  "",
@@ -1,41 +1,14 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { generateAuthWrapperTs } from './lib.js';
3
- describe('generateAuthWrapperTs', () => {
4
- const output = generateAuthWrapperTs();
5
- it('imports from zitejs/auth/base (not zitejs/auth) to avoid circular alias', () => {
6
- expect(output).toContain("from 'zitejs/auth/base'");
7
- expect(output).not.toContain("from 'zitejs/auth';");
2
+ import { generateBackendWrapperTs } from './lib.js';
3
+ describe('generateBackendWrapperTs', () => {
4
+ const output = generateBackendWrapperTs();
5
+ it('imports User from zitejs/auth', () => {
6
+ expect(output).toContain("from 'zitejs/auth'");
8
7
  });
9
- it('re-exports all auth runtime functions', () => {
10
- for (const fn of [
11
- 'useSession',
12
- 'signIn',
13
- 'signOut',
14
- 'signUp',
15
- 'loginWithRedirect',
16
- 'logout',
17
- ]) {
18
- expect(output).toContain(fn);
19
- }
8
+ it('exports createEndpoint', () => {
9
+ expect(output).toContain('createEndpoint');
20
10
  });
21
- it('re-exports all config types', () => {
22
- for (const type of [
23
- 'User',
24
- 'ZiteAppConfig',
25
- 'ZiteAuthenticationConfig',
26
- 'ZiteAuthMethods',
27
- 'ZiteAuthPage',
28
- 'ZiteAuthPageMessages',
29
- ]) {
30
- expect(output).toContain(type);
31
- }
32
- });
33
- it('always exports useAuth as primary API', () => {
34
- expect(output).toContain('useAuth');
35
- });
36
- it('exports all standard functions', () => {
37
- for (const fn of ['useAuth', 'useSession', 'signIn', 'signOut', 'loginWithRedirect', 'logout']) {
38
- expect(output).toContain(fn);
39
- }
11
+ it('exports ZiteError', () => {
12
+ expect(output).toContain('ZiteError');
40
13
  });
41
14
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zitejs",
3
- "version": "0.9.86",
3
+ "version": "0.9.88",
4
4
  "description": "The Zite framework — build apps on Zite Database",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",