@vrplatform/kysely 1.3.45-5066 → 1.3.45-5080

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.
Files changed (88) hide show
  1. package/build/.data.tar +0 -0
  2. package/build/main/local/generate.js +8 -8
  3. package/build/main/local/generate.js.map +1 -1
  4. package/build/main/local/index.js +5 -4
  5. package/build/main/local/index.js.map +1 -1
  6. package/build/main/migration.d.ts +7 -0
  7. package/build/main/migration.js +11 -0
  8. package/build/main/migration.js.map +1 -0
  9. package/build/main/v1.generated.d.ts +142 -134
  10. package/build/main/v1.generated.js.map +1 -1
  11. package/build/migrations-v2/0000000000000-baseline.ts +5 -0
  12. package/build/module/local/generate.js +8 -8
  13. package/build/module/local/generate.js.map +1 -1
  14. package/build/module/local/index.js +5 -4
  15. package/build/module/local/index.js.map +1 -1
  16. package/build/module/migration.d.ts +7 -0
  17. package/build/module/migration.js +8 -0
  18. package/build/module/migration.js.map +1 -0
  19. package/build/module/v1.generated.d.ts +142 -134
  20. package/build/module/v1.generated.js.map +1 -1
  21. package/package.json +3 -3
  22. package/build/migrations/0000000000001-init.ts +0 -5
  23. package/build/migrations/0000000000009-drop-store-schema.ts +0 -14
  24. package/build/migrations/0000000000010-bank-rules.ts +0 -190
  25. package/build/migrations/0000000000011-bank-rule-line-adjustments.ts +0 -65
  26. package/build/migrations/0000000000012-bank-rule-conditions.ts +0 -45
  27. package/build/migrations/0000000000013-bank-rule-name-unique.ts +0 -15
  28. package/build/migrations/0000000000014-bank-rule-drop-legacy-conditions.ts +0 -41
  29. package/build/migrations/0000000000015-booking-channel-logo-dev-provider.ts +0 -70
  30. package/build/migrations/0000000000016-owner-statement-draft-status.ts +0 -22
  31. package/build/migrations/0000000000017-tenant-migration-markers.ts +0 -18
  32. package/build/migrations/0000000000018-security-deposits-payable-category.ts +0 -63
  33. package/build/migrations/0000000000019-tenant-app-settings.ts +0 -76
  34. package/build/migrations/0000000000020-operating-opening-trial-balance.ts +0 -36
  35. package/build/migrations/0000000000021-audit-foreign-key-indexes.ts +0 -77
  36. package/build/migrations/0000000000022-opening-trial-balance-combined-columns.ts +0 -30
  37. package/build/migrations/0000000000023-journal-entry-currency-mismatch-reason.ts +0 -14
  38. package/build/migrations/0000000000024-listing-parent.ts +0 -37
  39. package/build/migrations/0000000000025-journal-entry-parent-listing.ts +0 -26
  40. package/build/migrations/0000000000026-booking-channel-logo-slots.ts +0 -89
  41. package/build/migrations/0000000000027-list-browse-performance-indexes.ts +0 -52
  42. package/build/migrations/0000000000028-flow-setting-status-jsonb.ts +0 -20
  43. package/build/migrations/0000000000029-tenant-slug.ts +0 -328
  44. package/build/migrations/0000000000030-pms-accounting-windows.ts +0 -50
  45. package/build/migrations/0000000000031-owner-statement-projection-listing-revision.ts +0 -20
  46. package/build/migrations/0000000000032-flow-event-listening.ts +0 -28
  47. package/build/migrations/0000000000033-opening-trial-balance-transaction.ts +0 -272
  48. package/build/migrations/0000000000034-historic-general-ledger.ts +0 -24
  49. package/build/migrations/0000000000035-tenant-regional-placement.ts +0 -37
  50. package/build/migrations/0000000000036-control-plane-projection-events.ts +0 -43
  51. package/build/migrations/0000000000037-tenant-guide-onboarding.ts +0 -21
  52. package/build/migrations/0000000000038-tracking-event-analytics-sink.ts +0 -31
  53. package/build/migrations/0000000000039-crunchy-region.ts +0 -86
  54. package/build/migrations/0000000000040-hostaway-region.ts +0 -72
  55. package/build/migrations/0000000000041-audit-tenant-fk.ts +0 -66
  56. package/build/migrations/0000000000042-ramp-staging-connect-params.ts +0 -35
  57. package/build/migrations/0000000000043-gl-pms-accounting-window-guard.ts +0 -125
  58. package/build/migrations/0000000000044-tenant-cross-region-fks.ts +0 -45
  59. package/build/migrations/0000000000045-cloudflare-region-env.ts +0 -100
  60. package/build/migrations/0000000000046-control-plane-outbox-alias.ts +0 -46
  61. package/build/migrations/0000000000047-ramp-contact-last-4-digits.ts +0 -16
  62. package/build/migrations/0000000000047-tenant-status-backfill.ts +0 -40
  63. package/build/migrations/0000000000048-tenant-status-constraint.ts +0 -24
  64. package/build/migrations/0000000000049-health-tenant-issues.ts +0 -69
  65. package/build/migrations/0000000000050-partner-webhooks.ts +0 -135
  66. package/build/migrations/0000000000051-health-webhook-runtime-grants.ts +0 -42
  67. package/build/migrations/0000000000052-feature-approval-team-enablement.ts +0 -13
  68. package/build/migrations/0000000000053-health-webhook-enums.ts +0 -296
  69. package/build/migrations/0000000000054-user-secondary-emails-jsonb.ts +0 -25
  70. package/build/migrations/0000000000055-outbound-webhooks-v1.ts +0 -221
  71. package/build/migrations/0000000000056-connection-webhook-version.ts +0 -18
  72. package/build/migrations/0000000000057-sync-webhook-version.ts +0 -18
  73. package/build/migrations/0000000000058-reservation-webhook-version.ts +0 -18
  74. package/build/migrations/0000000000059-listing-webhook-version.ts +0 -18
  75. package/build/migrations/0000000000060-owner-statement-webhook-version.ts +0 -19
  76. package/build/migrations/0000000000061-transaction-webhook-version.ts +0 -18
  77. package/build/migrations/0000000000062-plaid-connect-session.ts +0 -102
  78. package/build/migrations/0000000000063-pgcrypto.ts +0 -27
  79. package/build/migrations/0000000000064-partner-api-foundation.ts +0 -36
  80. package/build/migrations/0000000000065-canonical-jsonb-shapes.ts +0 -231
  81. package/build/migrations/0000000000066-source-delete-fk-indexes.ts +0 -20
  82. package/build/migrations/0000000000067-remove-opening-trial-balance-account-columns.ts +0 -34
  83. package/build/migrations/0000000000068-bank-record-account-delete-cascade.ts +0 -26
  84. package/build/migrations/0000000000069-account-connections.ts +0 -204
  85. package/build/migrations/0000000000070-provider-payment-projection-indexes.ts +0 -53
  86. package/build/migrations/0000000000071-tenant-app-settings-shape.ts +0 -39
  87. package/build/migrations/0000000000072-tenant-app-settings-shape-validation.ts +0 -11
  88. package/build/migrations/0000000000073-public-audit-events.ts +0 -241
package/build/.data.tar CHANGED
Binary file
@@ -45,11 +45,14 @@ const pglite_1 = require("@electric-sql/pglite");
45
45
  const kysely_1 = require("kysely");
46
46
  const kysely_codegen_1 = __importDefault(require("kysely-codegen"));
47
47
  const kysely_pglite_dialect_1 = require("kysely-pglite-dialect");
48
+ const migration_1 = require("../migration");
48
49
  const plugins_1 = require("../plugins");
49
50
  async function normalizeGeneratedTypes(root) {
50
51
  const outFile = path.join(root, 'src/v1.generated.ts');
51
52
  const current = await Bun.file(outFile).text();
52
- const next = current.replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;');
53
+ const next = current
54
+ .replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;')
55
+ .replace(' slug: string;\n', ' slug: Generated<string>;\n');
53
56
  if (next !== current) {
54
57
  await Bun.write(outFile, next);
55
58
  }
@@ -69,14 +72,14 @@ async function migrateKysely(root, kysely) {
69
72
  console.log('init migrating kysely ....');
70
73
  const migrator = new kysely_1.Migrator({
71
74
  db: kysely,
72
- migrationTableSchema: 'core',
73
- migrationTableName: 'kysely_migration',
74
- migrationLockTableName: 'kysely_migration_lock',
75
+ migrationTableSchema: migration_1.appMigrationEpoch.tableSchema,
76
+ migrationTableName: migration_1.appMigrationEpoch.tableName,
77
+ migrationLockTableName: migration_1.appMigrationEpoch.lockTableName,
75
78
  provider: new kysely_1.FileMigrationProvider({
76
79
  fs: node_fs_1.promises,
77
80
  path,
78
81
  // This needs to be an absolute path.
79
- migrationFolder: path.join(root, 'migrations'),
82
+ migrationFolder: path.join(root, migration_1.appMigrationEpoch.folder),
80
83
  }),
81
84
  });
82
85
  console.log('migrating kysely ....');
@@ -123,9 +126,6 @@ async function generateDump(root, dumpPath) {
123
126
  outFile: path.join(root, 'src/v1.generated.ts'),
124
127
  defaultSchemas: ['xxx'],
125
128
  camelCase: true,
126
- typeMapping: {
127
- date: 'string',
128
- },
129
129
  dialect: kysely_codegen_1.default.getDialect('postgres'),
130
130
  })
131
131
  .catch(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"src/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AC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,OAAO,EAAE;QAChC,cAAc,EAAE,cAAc;QAC9B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;QAC1B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,yCAAyC;QACzC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport { exists } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { join } from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type Kysely, Migrator } from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\n\nasync function normalizeGeneratedTypes(root: string) {\n const outFile = path.join(root, 'src/v1.generated.ts');\n const current = await Bun.file(outFile).text();\n const next = current.replace(\n 'export type Timestamp = ColumnType<Date, Date | string, Date | string>;',\n 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;'\n );\n\n if (next !== current) {\n await Bun.write(outFile, next);\n }\n}\n\nasync function migrate(root: string, client: PGlite) {\n console.log('migrating pglite ....');\n const glob = new Bun.Glob('initial/*.sql');\n for await (const migration of glob.scan(root)) {\n const raw = await Bun.file(join(root, migration)).text();\n // `pg_dump` (v17+) prepends `\\restrict`/`\\unrestrict` psql meta commands\n // which PostgreSQL-compatible parsers (like PGlite) cannot execute.\n const sanitized = raw.replace(/^\\s*\\\\(?:un)?restrict.*$/gim, '');\n await client.exec(sanitized);\n }\n}\n\nasync function migrateKysely(root: string, kysely: Kysely<DB>) {\n console.log('init migrating kysely ....');\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: 'core',\n migrationTableName: 'kysely_migration',\n migrationLockTableName: 'kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n // This needs to be an absolute path.\n migrationFolder: path.join(root, 'migrations'),\n }),\n });\n\n console.log('migrating kysely ....');\n const { error, results } = await migrator.migrateToLatest().catch(() => {\n console.error('failed to migrate');\n process.exit(1);\n });\n\n for (const it of results ?? []) {\n if (it.status === 'Success') {\n console.log(`migration \"${it.migrationName}\" was executed successfully`);\n } else if (it.status === 'Error') {\n console.error(`failed to execute migration \"${it.migrationName}\"`);\n }\n }\n\n if (error) {\n console.error('failed to migrate');\n console.error(error);\n process.exit(1);\n }\n}\n\nasync function generateDump(root: string, dumpPath: string) {\n const dataExists = await exists(dumpPath).catch(() => false);\n if (!dataExists) {\n console.log('Creating initial dump');\n const main = new PGlite();\n await migrate(root, main).catch(async (err) => {\n console.error('failed to migrate initial dump');\n await Bun.write(\n '../logs/migrate-initial-dump.json',\n JSON.stringify(err as any, null, 2)\n );\n process.exit(1);\n });\n const dialect = new PGliteDialect(main);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n await migrateKysely(root, kysely).catch(() => {\n console.error('failed to migrate kysely');\n process.exit(1);\n });\n await codegen\n .generate({\n db: kysely,\n outFile: path.join(root, 'src/v1.generated.ts'),\n defaultSchemas: ['xxx'],\n camelCase: true,\n typeMapping: {\n date: 'string',\n },\n dialect: codegen.getDialect('postgres'),\n })\n .catch(() => {\n console.error('failed to generate kysely');\n process.exit(1);\n });\n await normalizeGeneratedTypes(root);\n const content = await main.dumpDataDir('none').catch(() => {\n console.error('failed to dump data');\n process.exit(1);\n });\n await Bun.write(dumpPath, content).catch(() => {\n console.error('failed to write dump');\n process.exit(1);\n });\n return content;\n }\n return Bun.file(dumpPath);\n}\n\nexport async function createLocalKysely(root: string, dumpPath: string) {\n let isDestroyed = false;\n //const now = performance.now();\n\n const dump = await generateDump(root, dumpPath);\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n // const destroyTime = performance.now();\n await originalDestroy();\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HA,8CA6BC;AAxJD,qCAAyC;AACzC,+CAA0C;AAC1C,gDAAkC;AAClC,yCAAiC;AACjC,iDAA8C;AAC9C,mCAAsE;AACtE,oEAAqC;AACrC,iEAAsD;AACtD,4CAAiD;AACjD,wCAAuC;AAGvC,KAAK,UAAU,uBAAuB,CAAC,IAAY;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CACN,yEAAyE,EACzE,kFAAkF,CACnF;SACA,OAAO,CAAC,mBAAmB,EAAE,8BAA8B,CAAC,CAAC;IAEhE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,MAAM,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,MAAc;I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;YACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,QAAgB;IACpE,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,gCAAgC;IAEhC,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEhD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,UAAU;IACV,MAAM,MAAM,CAAC,GAAG,CAAA,UAAU,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,qCAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,OAAO,EAAE;QAChC,cAAc,EAAE,cAAc;QAC9B,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;QAC1B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,yCAAyC;QACzC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport { exists } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { join } from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type Kysely, Migrator } from 'kysely';\nimport codegen from 'kysely-codegen';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { appMigrationEpoch } from '../migration';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\n\nasync function normalizeGeneratedTypes(root: string) {\n const outFile = path.join(root, 'src/v1.generated.ts');\n const current = await Bun.file(outFile).text();\n const next = current\n .replace(\n 'export type Timestamp = ColumnType<Date, Date | string, Date | string>;',\n 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;'\n )\n .replace(' slug: string;\\n', ' slug: Generated<string>;\\n');\n\n if (next !== current) {\n await Bun.write(outFile, next);\n }\n}\n\nasync function migrate(root: string, client: PGlite) {\n console.log('migrating pglite ....');\n const glob = new Bun.Glob('initial/*.sql');\n for await (const migration of glob.scan(root)) {\n const raw = await Bun.file(join(root, migration)).text();\n // `pg_dump` (v17+) prepends `\\restrict`/`\\unrestrict` psql meta commands\n // which PostgreSQL-compatible parsers (like PGlite) cannot execute.\n const sanitized = raw.replace(/^\\s*\\\\(?:un)?restrict.*$/gim, '');\n await client.exec(sanitized);\n }\n}\n\nasync function migrateKysely(root: string, kysely: Kysely<DB>) {\n console.log('init migrating kysely ....');\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: appMigrationEpoch.tableSchema,\n migrationTableName: appMigrationEpoch.tableName,\n migrationLockTableName: appMigrationEpoch.lockTableName,\n provider: new FileMigrationProvider({\n fs,\n path,\n // This needs to be an absolute path.\n migrationFolder: path.join(root, appMigrationEpoch.folder),\n }),\n });\n\n console.log('migrating kysely ....');\n const { error, results } = await migrator.migrateToLatest().catch(() => {\n console.error('failed to migrate');\n process.exit(1);\n });\n\n for (const it of results ?? []) {\n if (it.status === 'Success') {\n console.log(`migration \"${it.migrationName}\" was executed successfully`);\n } else if (it.status === 'Error') {\n console.error(`failed to execute migration \"${it.migrationName}\"`);\n }\n }\n\n if (error) {\n console.error('failed to migrate');\n console.error(error);\n process.exit(1);\n }\n}\n\nasync function generateDump(root: string, dumpPath: string) {\n const dataExists = await exists(dumpPath).catch(() => false);\n if (!dataExists) {\n console.log('Creating initial dump');\n const main = new PGlite();\n await migrate(root, main).catch(async (err) => {\n console.error('failed to migrate initial dump');\n await Bun.write(\n '../logs/migrate-initial-dump.json',\n JSON.stringify(err as any, null, 2)\n );\n process.exit(1);\n });\n const dialect = new PGliteDialect(main);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n await migrateKysely(root, kysely).catch(() => {\n console.error('failed to migrate kysely');\n process.exit(1);\n });\n await codegen\n .generate({\n db: kysely,\n outFile: path.join(root, 'src/v1.generated.ts'),\n defaultSchemas: ['xxx'],\n camelCase: true,\n dialect: codegen.getDialect('postgres'),\n })\n .catch(() => {\n console.error('failed to generate kysely');\n process.exit(1);\n });\n await normalizeGeneratedTypes(root);\n const content = await main.dumpDataDir('none').catch(() => {\n console.error('failed to dump data');\n process.exit(1);\n });\n await Bun.write(dumpPath, content).catch(() => {\n console.error('failed to write dump');\n process.exit(1);\n });\n return content;\n }\n return Bun.file(dumpPath);\n}\n\nexport async function createLocalKysely(root: string, dumpPath: string) {\n let isDestroyed = false;\n //const now = performance.now();\n\n const dump = await generateDump(root, dumpPath);\n\n const pglite = new PGlite({ loadDataDir: dump });\n // warm up\n await pglite.sql`SELECT 1`;\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: 'localTesting',\n log: undefined,\n });\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n // const destroyTime = performance.now();\n await originalDestroy();\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
@@ -40,6 +40,7 @@ const path = __importStar(require("node:path"));
40
40
  const pglite_1 = require("@electric-sql/pglite");
41
41
  const kysely_1 = require("kysely");
42
42
  const kysely_pglite_dialect_1 = require("kysely-pglite-dialect");
43
+ const migration_1 = require("../migration");
43
44
  const plugins_1 = require("../plugins");
44
45
  const digest_1 = require("./digest");
45
46
  exports.root = path.join(__dirname, '../..');
@@ -47,13 +48,13 @@ exports.dumpPath = path.join(exports.root, '.data.tar');
47
48
  async function migrateToLatest(kysely) {
48
49
  const migrator = new kysely_1.Migrator({
49
50
  db: kysely,
50
- migrationTableSchema: 'core',
51
- migrationTableName: 'kysely_migration',
52
- migrationLockTableName: 'kysely_migration_lock',
51
+ migrationTableSchema: migration_1.appMigrationEpoch.tableSchema,
52
+ migrationTableName: migration_1.appMigrationEpoch.tableName,
53
+ migrationLockTableName: migration_1.appMigrationEpoch.lockTableName,
53
54
  provider: new kysely_1.FileMigrationProvider({
54
55
  fs: node_fs_1.promises,
55
56
  path,
56
- migrationFolder: path.join(exports.root, 'migrations'),
57
+ migrationFolder: path.join(exports.root, migration_1.appMigrationEpoch.folder),
57
58
  }),
58
59
  });
59
60
  const { error } = await migrator.migrateToLatest();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,wCAgCC;AApED,qCAAyC;AACzC,gDAAkC;AAClC,iDAA8C;AAC9C,mCAAyE;AACzE,iEAAsD;AACtD,wCAAuC;AAEvC,qCAA8E;AAEjE,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACrC,QAAA,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAI,EAAE,WAAW,CAAC,CAAC;AAOrD,KAAK,UAAU,eAAe,CAAC,MAAmC;IAChE,MAAM,QAAQ,GAAG,IAAI,iBAAQ,CAAC;QAC5B,EAAE,EAAE,MAAM;QACV,oBAAoB,EAAE,MAAM;QAC5B,kBAAkB,EAAE,kBAAkB;QACtC,sBAAsB,EAAE,uBAAuB;QAC/C,QAAQ,EAAE,IAAI,8BAAqB,CAAC;YAClC,EAAE,EAAF,kBAAE;YACF,IAAI;YACJ,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:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type LogConfig, Migrator } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\nimport { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';\n\nexport const root = path.join(__dirname, '../..');\nexport const dumpPath = path.join(root, '.data.tar');\n\nexport type UseLocalKyselyOptions = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\nasync function migrateToLatest(kysely: import('kysely').Kysely<DB>) {\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: 'core',\n migrationTableName: 'kysely_migration',\n migrationLockTableName: 'kysely_migration_lock',\n provider: new FileMigrationProvider({\n fs,\n path,\n migrationFolder: path.join(root, 'migrations'),\n }),\n });\n\n const { error } = await migrator.migrateToLatest();\n if (error) {\n throw error;\n }\n}\n\nexport async function useLocalKysely(args: UseLocalKyselyOptions = {}) {\n let isDestroyed = false;\n // const now = performance.now();\n\n const dump = Bun.file(dumpPath);\n\n const pglite = new PGlite({\n loadDataDir: dump,\n });\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely as import('kysely').Kysely<DB>);\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n //const destroyTime = performance.now();\n await originalDestroy();\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["local/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,wCAgCC;AArED,qCAAyC;AACzC,gDAAk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ACtD,GAAG,EAAE,IAAI,EAAE,GAAG;KACf,CAAC,CAAC;IACH,MAAM,IAAA,6BAAoB,EAAC,MAAM,CAAC,CAAC;IACnC,MAAM,IAAA,qCAA4B,EAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,eAAe,CAAC,MAAqC,CAAC,CAAC;IAE7D,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;QAC1B,IAAI,WAAW;YAAE,OAAO;QACxB,WAAW,GAAG,IAAI,CAAC;QACnB,wCAAwC;QACxC,MAAM,eAAe,EAAE,CAAC;QACxB,cAAc;QACd,0EAA0E;QAC1E,IAAI;IACN,CAAC,CAAC;IAEF,iFAAiF;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { PGlite } from '@electric-sql/pglite';\nimport { FileMigrationProvider, type LogConfig, Migrator } from 'kysely';\nimport { PGliteDialect } from 'kysely-pglite-dialect';\nimport { appMigrationEpoch } from '../migration';\nimport { getKysely } from '../plugins';\nimport type { DB } from '../v1.generated';\nimport { ensureDigestFunction, ensureGenRandomBytesFunction } from './digest';\n\nexport const root = path.join(__dirname, '../..');\nexport const dumpPath = path.join(root, '.data.tar');\n\nexport type UseLocalKyselyOptions = {\n repositoryName?: string;\n log?: true | LogConfig;\n};\n\nasync function migrateToLatest(kysely: import('kysely').Kysely<DB>) {\n const migrator = new Migrator({\n db: kysely,\n migrationTableSchema: appMigrationEpoch.tableSchema,\n migrationTableName: appMigrationEpoch.tableName,\n migrationLockTableName: appMigrationEpoch.lockTableName,\n provider: new FileMigrationProvider({\n fs,\n path,\n migrationFolder: path.join(root, appMigrationEpoch.folder),\n }),\n });\n\n const { error } = await migrator.migrateToLatest();\n if (error) {\n throw error;\n }\n}\n\nexport async function useLocalKysely(args: UseLocalKyselyOptions = {}) {\n let isDestroyed = false;\n // const now = performance.now();\n\n const dump = Bun.file(dumpPath);\n\n const pglite = new PGlite({\n loadDataDir: dump,\n });\n const dialect = new PGliteDialect(pglite);\n const kysely = getKysely(dialect, {\n repositoryName: args?.repositoryName ?? 'localTesting',\n log: args?.log,\n });\n await ensureDigestFunction(kysely);\n await ensureGenRandomBytesFunction(kysely);\n await migrateToLatest(kysely as import('kysely').Kysely<DB>);\n\n const originalDestroy = kysely.destroy.bind(kysely);\n kysely.destroy = async () => {\n if (isDestroyed) return;\n isDestroyed = true;\n //const destroyTime = performance.now();\n await originalDestroy();\n //console.log(\n // `Database destroyed: ${Math.round(performance.now() - destroyTime)}ms`\n //);\n };\n\n // console.log(`Database initialized: ${Math.round(performance.now() - now)}ms`);\n\n return kysely;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export declare const appMigrationEpoch: {
2
+ readonly baseline: "0000000000000-baseline";
3
+ readonly folder: "migrations-v2";
4
+ readonly lockTableName: "kysely_migration_lock";
5
+ readonly tableName: "kysely_migration";
6
+ readonly tableSchema: "kysely_v2";
7
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appMigrationEpoch = void 0;
4
+ exports.appMigrationEpoch = {
5
+ baseline: '0000000000000-baseline',
6
+ folder: 'migrations-v2',
7
+ lockTableName: 'kysely_migration_lock',
8
+ tableName: 'kysely_migration',
9
+ tableSchema: 'kysely_v2',
10
+ };
11
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"src/","sources":["migration.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE,wBAAwB;IAClC,MAAM,EAAE,eAAe;IACvB,aAAa,EAAE,uBAAuB;IACtC,SAAS,EAAE,kBAAkB;IAC7B,WAAW,EAAE,WAAW;CAChB,CAAC","sourcesContent":["export const appMigrationEpoch = {\n baseline: '0000000000000-baseline',\n folder: 'migrations-v2',\n lockTableName: 'kysely_migration_lock',\n tableName: 'kysely_migration',\n tableSchema: 'kysely_v2',\n} as const;\n"]}
@@ -6,6 +6,8 @@ import type { ColumnType } from "kysely";
6
6
  export type AccountingJournalEntryInactiveReason = "cancelledReservationLine" | "currencyMismatch" | "generalLedgerStartAt" | "inactiveAccount" | "listingInactive" | "nonPostingAccount" | "reservationGeneralLedgerStatusInactive" | "transactionInactive" | "unknownInactiveReason";
7
7
  export type AccountingJournalEntryLedger = "historical" | "operating" | "trust";
8
8
  export type AccountingTransactionAttachmentStatus = "attached" | "deleting" | "ready" | "uploading";
9
+ export type ArrayType<T> = ArrayTypeImpl<T> extends (infer U)[] ? U[] : ArrayTypeImpl<T>;
10
+ export type ArrayTypeImpl<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S[], I[], U[]> : T[];
9
11
  export type AuditActionActorType = "api_key" | "automation" | "sync" | "system" | "user";
10
12
  export type AuditEffectAttemptStatus = "completed" | "failed" | "running" | "skipped_locked";
11
13
  export type AuditEffectStatus = "claimed" | "completed" | "dead_letter" | "failed" | "pending" | "running";
@@ -13,11 +15,11 @@ export type AuditJournalDeltaOperation = "delete" | "insert" | "update";
13
15
  export type AuditPublicEventAccountingStatus = "blocked" | "changed" | "failed" | "mixed" | "not_applicable" | "pending" | "unchanged";
14
16
  export type AuditPublicEventOperation = "archive" | "create" | "delete" | "execute" | "recalculate" | "restore" | "update";
15
17
  export type AuditSourceType = "api" | "automation" | "integration" | "portal" | "sync" | "system";
18
+ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
16
19
  export type HealthTenantIssueCategory = "criticalToSystem" | "criticalToUser";
17
20
  export type HealthTenantIssueCode = "brokenConnections" | "cancelledReservationPaidWithoutAdjustment" | "closedPeriodUnattachedJournalEntries" | "duplicatedPayments" | "endedOwnershipNonZeroBalance" | "listingOwnershipPeriodNotFoundOnActiveJournals" | "missingOwnershipOrDeactivation" | "operatingBankAccountsWithoutOpex" | "outdatedConnections" | "partnerBillingInactive" | "partnerInactive" | "pmsMissingAccountingStart" | "publishedStatementUnpaid" | "reservationCurrencyMismatch" | "reservationGuestTotalsMismatch" | "reservationPaymentProjectionMismatch" | "teamInactive" | "unbalancedJournalEntries" | "unbalancedTransactionJournalEntries" | "unpaidReservations";
18
21
  export type HealthTenantIssueSeverity = "error" | "warning";
19
22
  export type HealthTenantIssueStatus = "open" | "resolved";
20
- export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
21
23
  export type Int8 = ColumnType<string, bigint | number | string, bigint | number | string>;
22
24
  export type Json = JsonValue;
23
25
  export type JsonArray = JsonValue[];
@@ -31,6 +33,7 @@ export type PublicFlowType = "pull" | "push";
31
33
  export type PublicPlaidConnectMode = "create" | "replace" | "update";
32
34
  export type PublicPlaidConnectStatus = "awaitingConfiguration" | "completed" | "configuring" | "credentialsStored" | "discoveringAccounts" | "exchangeOutcomeUnknown" | "exchanging" | "expired" | "failed" | "pendingLink";
33
35
  export type PublicRecurringFeeConditionOperator = "<" | "<=" | "=" | ">" | ">=";
36
+ export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
34
37
  export type WebhookApiVersion = "2026-07-01";
35
38
  export type WebhookDeliveryStatus = "canceled" | "delivering" | "failed" | "queued" | "retrying" | "succeeded";
36
39
  export type WebhookEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed" | "webhook.test";
@@ -38,7 +41,6 @@ export type WebhookResourceType = "connection" | "listing" | "reservation" | "st
38
41
  export type WebhookSubscriptionEventType = "connection.changed" | "listing.changed" | "reservation.changed" | "statement.status.changed" | "sync.status.changed" | "team.issues.changed" | "transaction.changed";
39
42
  export type WebhookSubscriptionScope = "managedTeams" | "self";
40
43
  export type WebhookSubscriptionStatus = "active" | "disabled" | "pending";
41
- export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
42
44
  export interface AccountingAccount {
43
45
  bankingCategory: string | null;
44
46
  bankingCurrency: string | null;
@@ -86,23 +88,6 @@ export interface AccountingAccountCategory {
86
88
  export interface AccountingAccountClassification {
87
89
  name: string;
88
90
  }
89
- export interface AccountingAccountReservationLineType {
90
- accountId: string | null;
91
- bookingChannel: string | null;
92
- createdAt: Generated<Timestamp>;
93
- id: Generated<string>;
94
- lineType: string;
95
- revenueRecognition: string | null;
96
- status: Generated<string | null>;
97
- tenantId: string;
98
- updatedAt: Generated<Timestamp>;
99
- }
100
- export interface AccountingAccountReservationRevRec {
101
- name: string;
102
- }
103
- export interface AccountingAccountType {
104
- name: string;
105
- }
106
91
  export interface AccountingAccountConnection {
107
92
  accountId: string | null;
108
93
  category: Generated<string | null>;
@@ -126,6 +111,23 @@ export interface AccountingAccountConnection {
126
111
  uniqueRef: string | null;
127
112
  updatedAt: Generated<Timestamp>;
128
113
  }
114
+ export interface AccountingAccountReservationLineType {
115
+ accountId: string | null;
116
+ bookingChannel: string | null;
117
+ createdAt: Generated<Timestamp>;
118
+ id: Generated<string>;
119
+ lineType: string;
120
+ revenueRecognition: string | null;
121
+ status: Generated<string | null>;
122
+ tenantId: string;
123
+ updatedAt: Generated<Timestamp>;
124
+ }
125
+ export interface AccountingAccountReservationRevRec {
126
+ name: string;
127
+ }
128
+ export interface AccountingAccountType {
129
+ name: string;
130
+ }
129
131
  export interface AccountingBankAccountCategory {
130
132
  name: string;
131
133
  }
@@ -133,8 +135,8 @@ export interface AccountingBankAccountType {
133
135
  name: string;
134
136
  }
135
137
  export interface AccountingBankRecord {
136
- accountId: string | null;
137
138
  accountConnectionId: string | null;
139
+ accountId: string | null;
138
140
  calculatedCentBalance: number | null;
139
141
  calculatedCentTotalCorrection: number | null;
140
142
  centBalance: number | null;
@@ -580,8 +582,8 @@ export interface AuditPublicEvent {
580
582
  actorType: AuditActionActorType;
581
583
  affectedAccountIds: Generated<string[]>;
582
584
  affectedAccounts: Generated<Json>;
583
- affectedOwnerStatementIds: Generated<string[]>;
584
585
  affectedOwnershipPeriodIds: Generated<string[]>;
586
+ affectedOwnerStatementIds: Generated<string[]>;
585
587
  affectedPeriods: Generated<string[]>;
586
588
  changedDimensions: Generated<string[]>;
587
589
  entityChanges: Generated<Json>;
@@ -613,8 +615,8 @@ export interface AuditPublicEventPostingChange {
613
615
  eventId: string;
614
616
  id: Generated<string>;
615
617
  ledger: string | null;
616
- ownerStatementId: string | null;
617
618
  ownershipPeriodId: string | null;
619
+ ownerStatementId: string | null;
618
620
  party: string | null;
619
621
  postingDate: Timestamp | null;
620
622
  status: string | null;
@@ -876,6 +878,35 @@ export interface HdbCatalogHdbVersion {
876
878
  upgradedOn: Timestamp;
877
879
  version: string;
878
880
  }
881
+ export interface HealthTenantIssue {
882
+ affected: number;
883
+ category: HealthTenantIssueCategory;
884
+ code: HealthTenantIssueCode;
885
+ contentHash: string;
886
+ context: Json;
887
+ createdAt: Generated<Timestamp>;
888
+ firstSeenAt: Timestamp;
889
+ id: Generated<string>;
890
+ lastChangedAt: Timestamp;
891
+ message: string;
892
+ openedAt: Timestamp;
893
+ resolvedAt: Timestamp | null;
894
+ severity: HealthTenantIssueSeverity;
895
+ snapshotVersion: Int8;
896
+ status: HealthTenantIssueStatus;
897
+ tenantId: string;
898
+ updatedAt: Generated<Timestamp>;
899
+ version: Int8;
900
+ }
901
+ export interface HealthTenantIssueSnapshot {
902
+ computedAt: Timestamp | null;
903
+ contentHash: string | null;
904
+ createdAt: Generated<Timestamp>;
905
+ dirtyAt: Generated<Timestamp>;
906
+ tenantId: string;
907
+ updatedAt: Generated<Timestamp>;
908
+ version: Generated<Int8>;
909
+ }
879
910
  export interface PublicAccountCollection {
880
911
  automationId: string | null;
881
912
  connectionId: string;
@@ -1070,24 +1101,6 @@ export interface PublicControlPlaneProjectionEvent {
1070
1101
  eventVersion: number;
1071
1102
  payload: Generated<Json>;
1072
1103
  }
1073
- export interface PublicPlaidConnectSession {
1074
- connectionId: string | null;
1075
- createdAt: Generated<Timestamp>;
1076
- environment: string;
1077
- errorCode: string | null;
1078
- errorRetryable: boolean | null;
1079
- expiresAt: Timestamp;
1080
- id: Generated<string>;
1081
- itemId: string | null;
1082
- leaseExpiresAt: Timestamp | null;
1083
- linkSessionId: string | null;
1084
- mode: PublicPlaidConnectMode;
1085
- result: Json | null;
1086
- status: Generated<PublicPlaidConnectStatus>;
1087
- syncId: string | null;
1088
- tenantId: string;
1089
- updatedAt: Generated<Timestamp>;
1090
- }
1091
1104
  export interface PublicCurrency {
1092
1105
  name: string;
1093
1106
  }
@@ -1500,6 +1513,24 @@ export interface PublicPaymentStatus {
1500
1513
  export interface PublicPaymentType {
1501
1514
  name: string;
1502
1515
  }
1516
+ export interface PublicPlaidConnectSession {
1517
+ connectionId: string | null;
1518
+ createdAt: Generated<Timestamp>;
1519
+ environment: string;
1520
+ errorCode: string | null;
1521
+ errorRetryable: boolean | null;
1522
+ expiresAt: Timestamp;
1523
+ id: Generated<string>;
1524
+ itemId: string | null;
1525
+ leaseExpiresAt: Timestamp | null;
1526
+ linkSessionId: string | null;
1527
+ mode: PublicPlaidConnectMode;
1528
+ result: Json | null;
1529
+ status: Generated<PublicPlaidConnectStatus>;
1530
+ syncId: string | null;
1531
+ tenantId: string;
1532
+ updatedAt: Generated<Timestamp>;
1533
+ }
1503
1534
  export interface PublicRecurringFee {
1504
1535
  bookingChannelsFilter: string[] | null;
1505
1536
  createdAt: Generated<Timestamp>;
@@ -1755,6 +1786,9 @@ export interface PublicTenant {
1755
1786
  addressCountry: string | null;
1756
1787
  addressLine1: string | null;
1757
1788
  addressPostcode: string | null;
1789
+ /**
1790
+ * JSON column for app-owned tenant settings exposed through APIs.
1791
+ */
1758
1792
  appSettings: Json | null;
1759
1793
  billingAddressData: Json | null;
1760
1794
  billingAddressId: string | null;
@@ -1783,6 +1817,9 @@ export interface PublicTenant {
1783
1817
  defaultRevenueRecognition: string | null;
1784
1818
  email: string | null;
1785
1819
  featureFlags: Generated<Json | null>;
1820
+ /**
1821
+ * JSON column for explicit VRPilot onboarding guide state.
1822
+ */
1786
1823
  guideOnboarding: Json | null;
1787
1824
  historicalStatementsImportedAt: Timestamp | null;
1788
1825
  id: Generated<string>;
@@ -1932,34 +1969,72 @@ export interface PublicWebhook {
1932
1969
  types2: string[] | null;
1933
1970
  url: string;
1934
1971
  }
1935
- export interface HealthTenantIssue {
1936
- affected: number;
1937
- category: HealthTenantIssueCategory;
1938
- code: HealthTenantIssueCode;
1939
- contentHash: string;
1940
- context: Json;
1972
+ export interface TrackingEvent {
1941
1973
  createdAt: Generated<Timestamp>;
1942
- firstSeenAt: Timestamp;
1943
1974
  id: Generated<string>;
1944
- lastChangedAt: Timestamp;
1945
- message: string;
1946
- openedAt: Timestamp;
1947
- resolvedAt: Timestamp | null;
1948
- severity: HealthTenantIssueSeverity;
1949
- snapshotVersion: Int8;
1950
- status: HealthTenantIssueStatus;
1975
+ name: string;
1976
+ packageName: string;
1977
+ props: Json;
1978
+ tenantId: string | null;
1979
+ timestamp: Generated<Timestamp | null>;
1980
+ trackedAt: Generated<Timestamp | null>;
1981
+ userId: string | null;
1982
+ }
1983
+ export interface TrackingIntercomConversation {
1984
+ answer: string;
1985
+ conversationId: Int8;
1986
+ createdAt: Generated<Timestamp>;
1987
+ id: Generated<string>;
1988
+ isRelevant: boolean;
1989
+ outcome: string;
1990
+ question: string;
1991
+ summary: string;
1992
+ tags: string;
1993
+ }
1994
+ export interface TrackingIntercomConversationUser {
1995
+ conversationId: string;
1996
+ createdAt: Generated<Timestamp>;
1997
+ id: Generated<string>;
1998
+ userId: string;
1999
+ }
2000
+ export interface TrackingIntercomReport {
2001
+ action: string;
2002
+ category: string;
2003
+ createdAt: Generated<Timestamp>;
2004
+ id: Generated<string>;
2005
+ summary: string;
2006
+ tags: string;
2007
+ }
2008
+ export interface TrackingIntercomReportConversation {
2009
+ conversationId: string;
2010
+ id: Generated<string>;
2011
+ reportId: string;
2012
+ }
2013
+ export interface TrackingMetricCache {
2014
+ connectionId: Generated<string>;
2015
+ date: Timestamp;
2016
+ name: Generated<string>;
2017
+ refreshedAt: Generated<Timestamp>;
2018
+ status: Generated<string>;
1951
2019
  tenantId: string;
1952
- updatedAt: Generated<Timestamp>;
1953
- version: Int8;
2020
+ total: Numeric;
2021
+ type: string;
1954
2022
  }
1955
- export interface HealthTenantIssueSnapshot {
1956
- computedAt: Timestamp | null;
1957
- contentHash: string | null;
2023
+ export interface TrackingMonitorConnection {
2024
+ appId: string;
2025
+ connectionId: string;
1958
2026
  createdAt: Generated<Timestamp>;
1959
- dirtyAt: Generated<Timestamp>;
2027
+ id: Generated<string>;
2028
+ message: string | null;
2029
+ status: string | null;
2030
+ syncedAt: Timestamp | null;
1960
2031
  tenantId: string;
1961
- updatedAt: Generated<Timestamp>;
1962
- version: Generated<Int8>;
2032
+ triggerRef: string | null;
2033
+ updatedAt: Timestamp | null;
2034
+ version: number | null;
2035
+ }
2036
+ export interface TrackingMonitorConnectionState {
2037
+ name: string;
1963
2038
  }
1964
2039
  export interface WebhookDelivery {
1965
2040
  apiVersion: WebhookApiVersion;
@@ -2012,7 +2087,7 @@ export interface WebhookSubscription {
2012
2087
  createdAt: Generated<Timestamp>;
2013
2088
  description: string | null;
2014
2089
  disabledAt: Timestamp | null;
2015
- eventTypes: WebhookSubscriptionEventType[];
2090
+ eventTypes: ArrayType<WebhookSubscriptionEventType>;
2016
2091
  id: Generated<string>;
2017
2092
  ownerTenantId: string;
2018
2093
  revision: Generated<Int8>;
@@ -2032,73 +2107,6 @@ export interface WebhookSubscriptionSecret {
2032
2107
  revokedAt: Timestamp | null;
2033
2108
  subscriptionId: string;
2034
2109
  }
2035
- export interface TrackingEvent {
2036
- createdAt: Generated<Timestamp>;
2037
- id: Generated<string>;
2038
- name: string;
2039
- packageName: string;
2040
- props: Json;
2041
- tenantId: string | null;
2042
- timestamp: Generated<Timestamp | null>;
2043
- trackedAt: Generated<Timestamp | null>;
2044
- userId: string | null;
2045
- }
2046
- export interface TrackingIntercomConversation {
2047
- answer: string;
2048
- conversationId: Int8;
2049
- createdAt: Generated<Timestamp>;
2050
- id: Generated<string>;
2051
- isRelevant: boolean;
2052
- outcome: string;
2053
- question: string;
2054
- summary: string;
2055
- tags: string;
2056
- }
2057
- export interface TrackingIntercomConversationUser {
2058
- conversationId: string;
2059
- createdAt: Generated<Timestamp>;
2060
- id: Generated<string>;
2061
- userId: string;
2062
- }
2063
- export interface TrackingIntercomReport {
2064
- action: string;
2065
- category: string;
2066
- createdAt: Generated<Timestamp>;
2067
- id: Generated<string>;
2068
- summary: string;
2069
- tags: string;
2070
- }
2071
- export interface TrackingIntercomReportConversation {
2072
- conversationId: string;
2073
- id: Generated<string>;
2074
- reportId: string;
2075
- }
2076
- export interface TrackingMetricCache {
2077
- connectionId: Generated<string>;
2078
- date: Timestamp;
2079
- name: Generated<string>;
2080
- refreshedAt: Generated<Timestamp>;
2081
- status: Generated<string>;
2082
- tenantId: string;
2083
- total: Numeric;
2084
- type: string;
2085
- }
2086
- export interface TrackingMonitorConnection {
2087
- appId: string;
2088
- connectionId: string;
2089
- createdAt: Generated<Timestamp>;
2090
- id: Generated<string>;
2091
- message: string | null;
2092
- status: string | null;
2093
- syncedAt: Timestamp | null;
2094
- tenantId: string;
2095
- triggerRef: string | null;
2096
- updatedAt: Timestamp | null;
2097
- version: number | null;
2098
- }
2099
- export interface TrackingMonitorConnectionState {
2100
- name: string;
2101
- }
2102
2110
  export interface DB {
2103
2111
  "accounting.account": AccountingAccount;
2104
2112
  "accounting.accountAssignment": AccountingAccountAssignment;
@@ -2106,10 +2114,10 @@ export interface DB {
2106
2114
  "accounting.accountAssignmentType": AccountingAccountAssignmentType;
2107
2115
  "accounting.accountCategory": AccountingAccountCategory;
2108
2116
  "accounting.accountClassification": AccountingAccountClassification;
2117
+ "accounting.accountConnection": AccountingAccountConnection;
2109
2118
  "accounting.accountReservationLineType": AccountingAccountReservationLineType;
2110
2119
  "accounting.accountReservationRevRec": AccountingAccountReservationRevRec;
2111
2120
  "accounting.accountType": AccountingAccountType;
2112
- "accounting.accountConnection": AccountingAccountConnection;
2113
2121
  "accounting.bankAccountCategory": AccountingBankAccountCategory;
2114
2122
  "accounting.bankAccountType": AccountingBankAccountType;
2115
2123
  "accounting.bankRecord": AccountingBankRecord;
@@ -2166,8 +2174,6 @@ export interface DB {
2166
2174
  "core.syncStatus": CoreSyncStatus;
2167
2175
  "core.syncSubtask": CoreSyncSubtask;
2168
2176
  "core.syncType": CoreSyncType;
2169
- "health.tenantIssue": HealthTenantIssue;
2170
- "health.tenantIssueSnapshot": HealthTenantIssueSnapshot;
2171
2177
  "hdbCatalog.eventInvocationLogs": HdbCatalogEventInvocationLogs;
2172
2178
  "hdbCatalog.eventLog": HdbCatalogEventLog;
2173
2179
  "hdbCatalog.hdbActionLog": HdbCatalogHdbActionLog;
@@ -2180,6 +2186,8 @@ export interface DB {
2180
2186
  "hdbCatalog.hdbSchemaNotifications": HdbCatalogHdbSchemaNotifications;
2181
2187
  "hdbCatalog.hdbSourceCatalogVersion": HdbCatalogHdbSourceCatalogVersion;
2182
2188
  "hdbCatalog.hdbVersion": HdbCatalogHdbVersion;
2189
+ "health.tenantIssue": HealthTenantIssue;
2190
+ "health.tenantIssueSnapshot": HealthTenantIssueSnapshot;
2183
2191
  "public.accountCollection": PublicAccountCollection;
2184
2192
  "public.accountCollectionType": PublicAccountCollectionType;
2185
2193
  "public.address": PublicAddress;
@@ -2194,7 +2202,6 @@ export interface DB {
2194
2202
  "public.connectionRoute": PublicConnectionRoute;
2195
2203
  "public.controlPlaneOutbox": PublicControlPlaneOutbox;
2196
2204
  "public.controlPlaneProjectionEvent": PublicControlPlaneProjectionEvent;
2197
- "public.plaidConnectSession": PublicPlaidConnectSession;
2198
2205
  "public.currency": PublicCurrency;
2199
2206
  "public.duplicateEmails": PublicDuplicateEmails;
2200
2207
  "public.emailTemplate": PublicEmailTemplate;
@@ -2233,6 +2240,7 @@ export interface DB {
2233
2240
  "public.paymentLineClassification": PublicPaymentLineClassification;
2234
2241
  "public.paymentStatus": PublicPaymentStatus;
2235
2242
  "public.paymentType": PublicPaymentType;
2243
+ "public.plaidConnectSession": PublicPlaidConnectSession;
2236
2244
  "public.recurringFee": PublicRecurringFee;
2237
2245
  "public.recurringFeeAccount": PublicRecurringFeeAccount;
2238
2246
  "public.recurringFeeAccountCondition": PublicRecurringFeeAccountCondition;