@vrplatform/kysely 1.3.45-6284 → 1.3.45-6288
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.
- package/build/.data.tar +0 -0
- package/build/main/local/generate.js +1 -0
- package/build/main/local/generate.js.map +1 -1
- package/build/main/v1.generated.d.ts +83 -0
- package/build/main/v1.generated.js.map +1 -1
- package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
- package/build/module/local/generate.js +1 -0
- package/build/module/local/generate.js.map +1 -1
- package/build/module/v1.generated.d.ts +83 -0
- package/build/module/v1.generated.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { type Kysely, sql } from 'kysely';
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await sql`
|
|
5
|
+
alter table health.accounting_integrity_run
|
|
6
|
+
add column scope_tenant_ids uuid[],
|
|
7
|
+
add column resolves_cases boolean not null default true,
|
|
8
|
+
add constraint accounting_integrity_run_scope_tenant_ids_check
|
|
9
|
+
check (
|
|
10
|
+
scope_tenant_ids is null or cardinality(scope_tenant_ids) > 0
|
|
11
|
+
)
|
|
12
|
+
`.execute(db);
|
|
13
|
+
|
|
14
|
+
await sql`
|
|
15
|
+
create type health.accounting_integrity_repair_plan_status as enum (
|
|
16
|
+
'draft',
|
|
17
|
+
'active',
|
|
18
|
+
'paused',
|
|
19
|
+
'failed',
|
|
20
|
+
'completed',
|
|
21
|
+
'canceled'
|
|
22
|
+
)
|
|
23
|
+
`.execute(db);
|
|
24
|
+
await sql`
|
|
25
|
+
create type health.accounting_integrity_repair_stage_status as enum (
|
|
26
|
+
'planned',
|
|
27
|
+
'dry_run_passed',
|
|
28
|
+
'approved',
|
|
29
|
+
'applying',
|
|
30
|
+
'verifying',
|
|
31
|
+
'verified',
|
|
32
|
+
'paused',
|
|
33
|
+
'failed',
|
|
34
|
+
'canceled'
|
|
35
|
+
)
|
|
36
|
+
`.execute(db);
|
|
37
|
+
await sql`
|
|
38
|
+
create type health.accounting_integrity_repair_scope_type as enum (
|
|
39
|
+
'case',
|
|
40
|
+
'tenant'
|
|
41
|
+
)
|
|
42
|
+
`.execute(db);
|
|
43
|
+
await sql`
|
|
44
|
+
create type health.accounting_integrity_repair_target_status as enum (
|
|
45
|
+
'pending',
|
|
46
|
+
'applying',
|
|
47
|
+
'applied',
|
|
48
|
+
'verifying',
|
|
49
|
+
'verified',
|
|
50
|
+
'paused',
|
|
51
|
+
'failed',
|
|
52
|
+
'canceled'
|
|
53
|
+
)
|
|
54
|
+
`.execute(db);
|
|
55
|
+
await sql`
|
|
56
|
+
create type health.accounting_integrity_repair_transition_type as enum (
|
|
57
|
+
'plan_created',
|
|
58
|
+
'plan_activated',
|
|
59
|
+
'dry_run_passed',
|
|
60
|
+
'approval_granted',
|
|
61
|
+
'approval_invalidated',
|
|
62
|
+
'stage_applying',
|
|
63
|
+
'target_applying',
|
|
64
|
+
'target_applied',
|
|
65
|
+
'target_verifying',
|
|
66
|
+
'target_verified',
|
|
67
|
+
'stage_verified',
|
|
68
|
+
'paused',
|
|
69
|
+
'failed',
|
|
70
|
+
'canceled',
|
|
71
|
+
'completed'
|
|
72
|
+
)
|
|
73
|
+
`.execute(db);
|
|
74
|
+
|
|
75
|
+
await sql`
|
|
76
|
+
create table health.accounting_integrity_repair_plan (
|
|
77
|
+
id uuid primary key default gen_random_uuid(),
|
|
78
|
+
data_region text not null,
|
|
79
|
+
environment text not null,
|
|
80
|
+
code text not null,
|
|
81
|
+
recipe_version integer not null,
|
|
82
|
+
git_revision text not null,
|
|
83
|
+
status health.accounting_integrity_repair_plan_status
|
|
84
|
+
not null default 'draft',
|
|
85
|
+
title text not null,
|
|
86
|
+
linear_ref text,
|
|
87
|
+
created_by text not null,
|
|
88
|
+
created_at timestamptz not null default now(),
|
|
89
|
+
updated_at timestamptz not null default now(),
|
|
90
|
+
completed_at timestamptz,
|
|
91
|
+
canceled_at timestamptz,
|
|
92
|
+
constraint accounting_integrity_repair_plan_recipe_version_check
|
|
93
|
+
check (recipe_version > 0),
|
|
94
|
+
constraint accounting_integrity_repair_plan_completion_check
|
|
95
|
+
check ((status = 'completed') = (completed_at is not null)),
|
|
96
|
+
constraint accounting_integrity_repair_plan_cancellation_check
|
|
97
|
+
check ((status = 'canceled') = (canceled_at is not null))
|
|
98
|
+
)
|
|
99
|
+
`.execute(db);
|
|
100
|
+
|
|
101
|
+
await sql`
|
|
102
|
+
create index accounting_integrity_repair_plan_status_idx
|
|
103
|
+
on health.accounting_integrity_repair_plan (
|
|
104
|
+
data_region,
|
|
105
|
+
environment,
|
|
106
|
+
status,
|
|
107
|
+
updated_at desc
|
|
108
|
+
)
|
|
109
|
+
`.execute(db);
|
|
110
|
+
|
|
111
|
+
await sql`
|
|
112
|
+
create table health.accounting_integrity_repair_stage (
|
|
113
|
+
id uuid primary key default gen_random_uuid(),
|
|
114
|
+
plan_id uuid not null
|
|
115
|
+
references health.accounting_integrity_repair_plan(id)
|
|
116
|
+
on delete cascade,
|
|
117
|
+
ordinal integer not null,
|
|
118
|
+
scope_type health.accounting_integrity_repair_scope_type not null,
|
|
119
|
+
tenant_id uuid not null,
|
|
120
|
+
status health.accounting_integrity_repair_stage_status
|
|
121
|
+
not null default 'planned',
|
|
122
|
+
manifest jsonb not null,
|
|
123
|
+
manifest_hash text not null,
|
|
124
|
+
limits jsonb not null,
|
|
125
|
+
dry_run_result jsonb,
|
|
126
|
+
approved_by text,
|
|
127
|
+
approved_at timestamptz,
|
|
128
|
+
approval_ref text,
|
|
129
|
+
apply_result jsonb,
|
|
130
|
+
verification_result jsonb,
|
|
131
|
+
started_at timestamptz,
|
|
132
|
+
completed_at timestamptz,
|
|
133
|
+
created_at timestamptz not null default now(),
|
|
134
|
+
updated_at timestamptz not null default now(),
|
|
135
|
+
constraint accounting_integrity_repair_stage_plan_ordinal_key
|
|
136
|
+
unique (plan_id, ordinal),
|
|
137
|
+
constraint accounting_integrity_repair_stage_ordinal_check
|
|
138
|
+
check (ordinal > 0),
|
|
139
|
+
constraint accounting_integrity_repair_stage_approval_check check (
|
|
140
|
+
(approved_by is null and approved_at is null and approval_ref is null)
|
|
141
|
+
or
|
|
142
|
+
(approved_by is not null and approved_at is not null and
|
|
143
|
+
approval_ref is not null)
|
|
144
|
+
),
|
|
145
|
+
constraint accounting_integrity_repair_stage_completion_check check (
|
|
146
|
+
(status = 'verified') = (completed_at is not null)
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
`.execute(db);
|
|
150
|
+
|
|
151
|
+
await sql`
|
|
152
|
+
create index accounting_integrity_repair_stage_plan_status_idx
|
|
153
|
+
on health.accounting_integrity_repair_stage (
|
|
154
|
+
plan_id,
|
|
155
|
+
status,
|
|
156
|
+
ordinal
|
|
157
|
+
)
|
|
158
|
+
`.execute(db);
|
|
159
|
+
|
|
160
|
+
await sql`
|
|
161
|
+
create table health.accounting_integrity_repair_target (
|
|
162
|
+
id uuid primary key default gen_random_uuid(),
|
|
163
|
+
stage_id uuid not null
|
|
164
|
+
references health.accounting_integrity_repair_stage(id)
|
|
165
|
+
on delete cascade,
|
|
166
|
+
ordinal integer not null,
|
|
167
|
+
case_id uuid not null,
|
|
168
|
+
case_version bigint not null,
|
|
169
|
+
case_content_hash text not null,
|
|
170
|
+
tenant_id uuid not null,
|
|
171
|
+
target_key text not null,
|
|
172
|
+
action jsonb not null,
|
|
173
|
+
before_state jsonb not null,
|
|
174
|
+
before_hash text not null,
|
|
175
|
+
expected_result jsonb not null,
|
|
176
|
+
lock_assessment jsonb not null,
|
|
177
|
+
effect_plan jsonb not null,
|
|
178
|
+
status health.accounting_integrity_repair_target_status
|
|
179
|
+
not null default 'pending',
|
|
180
|
+
idempotency_key text not null unique,
|
|
181
|
+
audit_action_id uuid,
|
|
182
|
+
apply_result jsonb,
|
|
183
|
+
verification_result jsonb,
|
|
184
|
+
started_at timestamptz,
|
|
185
|
+
completed_at timestamptz,
|
|
186
|
+
created_at timestamptz not null default now(),
|
|
187
|
+
updated_at timestamptz not null default now(),
|
|
188
|
+
constraint accounting_integrity_repair_target_stage_key
|
|
189
|
+
unique (stage_id, target_key),
|
|
190
|
+
constraint accounting_integrity_repair_target_stage_ordinal_key
|
|
191
|
+
unique (stage_id, ordinal),
|
|
192
|
+
constraint accounting_integrity_repair_target_ordinal_check
|
|
193
|
+
check (ordinal > 0),
|
|
194
|
+
constraint accounting_integrity_repair_target_case_version_check
|
|
195
|
+
check (case_version > 0),
|
|
196
|
+
constraint accounting_integrity_repair_target_completion_check check (
|
|
197
|
+
(status = 'verified') = (completed_at is not null)
|
|
198
|
+
)
|
|
199
|
+
)
|
|
200
|
+
`.execute(db);
|
|
201
|
+
|
|
202
|
+
await sql`
|
|
203
|
+
create index accounting_integrity_repair_target_stage_status_idx
|
|
204
|
+
on health.accounting_integrity_repair_target (
|
|
205
|
+
stage_id,
|
|
206
|
+
status,
|
|
207
|
+
ordinal
|
|
208
|
+
)
|
|
209
|
+
`.execute(db);
|
|
210
|
+
await sql`
|
|
211
|
+
create index accounting_integrity_repair_target_case_idx
|
|
212
|
+
on health.accounting_integrity_repair_target (case_id)
|
|
213
|
+
`.execute(db);
|
|
214
|
+
|
|
215
|
+
await sql`
|
|
216
|
+
create table health.accounting_integrity_repair_transition (
|
|
217
|
+
id uuid primary key default gen_random_uuid(),
|
|
218
|
+
plan_id uuid not null
|
|
219
|
+
references health.accounting_integrity_repair_plan(id)
|
|
220
|
+
on delete cascade,
|
|
221
|
+
stage_id uuid
|
|
222
|
+
references health.accounting_integrity_repair_stage(id)
|
|
223
|
+
on delete cascade,
|
|
224
|
+
target_id uuid
|
|
225
|
+
references health.accounting_integrity_repair_target(id)
|
|
226
|
+
on delete cascade,
|
|
227
|
+
type health.accounting_integrity_repair_transition_type not null,
|
|
228
|
+
actor text not null,
|
|
229
|
+
payload jsonb not null,
|
|
230
|
+
created_at timestamptz not null default now(),
|
|
231
|
+
constraint accounting_integrity_repair_transition_target_stage_check
|
|
232
|
+
check (target_id is null or stage_id is not null)
|
|
233
|
+
)
|
|
234
|
+
`.execute(db);
|
|
235
|
+
|
|
236
|
+
await sql`
|
|
237
|
+
create index accounting_integrity_repair_transition_plan_idx
|
|
238
|
+
on health.accounting_integrity_repair_transition (
|
|
239
|
+
plan_id,
|
|
240
|
+
created_at,
|
|
241
|
+
id
|
|
242
|
+
)
|
|
243
|
+
`.execute(db);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
247
|
+
await sql`
|
|
248
|
+
drop table if exists health.accounting_integrity_repair_transition
|
|
249
|
+
`.execute(db);
|
|
250
|
+
await sql`
|
|
251
|
+
drop table if exists health.accounting_integrity_repair_target
|
|
252
|
+
`.execute(db);
|
|
253
|
+
await sql`
|
|
254
|
+
drop table if exists health.accounting_integrity_repair_stage
|
|
255
|
+
`.execute(db);
|
|
256
|
+
await sql`
|
|
257
|
+
drop table if exists health.accounting_integrity_repair_plan
|
|
258
|
+
`.execute(db);
|
|
259
|
+
await sql`
|
|
260
|
+
drop type if exists
|
|
261
|
+
health.accounting_integrity_repair_transition_type
|
|
262
|
+
`.execute(db);
|
|
263
|
+
await sql`
|
|
264
|
+
drop type if exists health.accounting_integrity_repair_target_status
|
|
265
|
+
`.execute(db);
|
|
266
|
+
await sql`
|
|
267
|
+
drop type if exists health.accounting_integrity_repair_scope_type
|
|
268
|
+
`.execute(db);
|
|
269
|
+
await sql`
|
|
270
|
+
drop type if exists health.accounting_integrity_repair_stage_status
|
|
271
|
+
`.execute(db);
|
|
272
|
+
await sql`
|
|
273
|
+
drop type if exists health.accounting_integrity_repair_plan_status
|
|
274
|
+
`.execute(db);
|
|
275
|
+
await sql`
|
|
276
|
+
alter table health.accounting_integrity_run
|
|
277
|
+
drop constraint accounting_integrity_run_scope_tenant_ids_check,
|
|
278
|
+
drop column resolves_cases,
|
|
279
|
+
drop column scope_tenant_ids
|
|
280
|
+
`.execute(db);
|
|
281
|
+
}
|
|
@@ -13,6 +13,7 @@ async function normalizeGeneratedTypes(root) {
|
|
|
13
13
|
const current = await Bun.file(outFile).text();
|
|
14
14
|
const next = current
|
|
15
15
|
.replace('export type Timestamp = ColumnType<Date, Date | string, Date | string>;', 'export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;')
|
|
16
|
+
.replace(' managedTeamAccess: Generated<string>;\n', ' managedTeamAccess: Generated<"all" | "assigned">;\n')
|
|
16
17
|
.replace(' slug: string;\n', ' slug: Generated<string>;\n');
|
|
17
18
|
if (next !== current) {
|
|
18
19
|
await Bun.write(outFile, next);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;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;SAC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AO,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"]}
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"src/","sources":["local/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAe,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;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,CACN,2CAA2C,EAC3C,uDAAuD,CACxD;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;IACjD,OAAO,CAAC,GAAG,CAAC,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AAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,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,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,UAAU;IACV,MAAM,MAAM,CAAC,GAAG,CAAA,UAAU,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,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(\n ' managedTeamAccess: Generated<string>;\\n',\n ' managedTeamAccess: Generated<\"all\" | \"assigned\">;\\n'\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"]}
|
|
@@ -21,6 +21,11 @@ export type HealthAccountingIntegrityCaseStatus = "open" | "resolved";
|
|
|
21
21
|
export type HealthAccountingIntegrityConfidence = "probable" | "proven" | "unknown";
|
|
22
22
|
export type HealthAccountingIntegrityDeliveryChannel = "sentry" | "slack";
|
|
23
23
|
export type HealthAccountingIntegrityDeliveryStatus = "dead_letter" | "delivered" | "failed" | "pending" | "processing" | "suppressed";
|
|
24
|
+
export type HealthAccountingIntegrityRepairPlanStatus = "active" | "canceled" | "completed" | "draft" | "failed" | "paused";
|
|
25
|
+
export type HealthAccountingIntegrityRepairScopeType = "case" | "tenant";
|
|
26
|
+
export type HealthAccountingIntegrityRepairStageStatus = "applying" | "approved" | "canceled" | "dry_run_passed" | "failed" | "paused" | "planned" | "verified" | "verifying";
|
|
27
|
+
export type HealthAccountingIntegrityRepairTargetStatus = "applied" | "applying" | "canceled" | "failed" | "paused" | "pending" | "verified" | "verifying";
|
|
28
|
+
export type HealthAccountingIntegrityRepairTransitionType = "approval_granted" | "approval_invalidated" | "canceled" | "completed" | "dry_run_passed" | "failed" | "paused" | "plan_activated" | "plan_created" | "stage_applying" | "stage_verified" | "target_applied" | "target_applying" | "target_verified" | "target_verifying";
|
|
24
29
|
export type HealthAccountingIntegrityResolutionClassification = "code_fix" | "configuration" | "data_repair" | "expected" | "false_positive" | "monitor_fix" | "unknown";
|
|
25
30
|
export type HealthAccountingIntegrityReviewStatus = "confirmed_issue" | "expected" | "false_positive" | "unreviewed";
|
|
26
31
|
export type HealthAccountingIntegrityRunStatus = "completed" | "failed" | "running" | "skipped";
|
|
@@ -943,6 +948,78 @@ export interface HealthAccountingIntegrityDelivery {
|
|
|
943
948
|
status: Generated<HealthAccountingIntegrityDeliveryStatus>;
|
|
944
949
|
updatedAt: Generated<Timestamp>;
|
|
945
950
|
}
|
|
951
|
+
export interface HealthAccountingIntegrityRepairPlan {
|
|
952
|
+
canceledAt: Timestamp | null;
|
|
953
|
+
code: string;
|
|
954
|
+
completedAt: Timestamp | null;
|
|
955
|
+
createdAt: Generated<Timestamp>;
|
|
956
|
+
createdBy: string;
|
|
957
|
+
dataRegion: string;
|
|
958
|
+
environment: string;
|
|
959
|
+
gitRevision: string;
|
|
960
|
+
id: Generated<string>;
|
|
961
|
+
linearRef: string | null;
|
|
962
|
+
recipeVersion: number;
|
|
963
|
+
status: Generated<HealthAccountingIntegrityRepairPlanStatus>;
|
|
964
|
+
title: string;
|
|
965
|
+
updatedAt: Generated<Timestamp>;
|
|
966
|
+
}
|
|
967
|
+
export interface HealthAccountingIntegrityRepairStage {
|
|
968
|
+
applyResult: Json | null;
|
|
969
|
+
approvalRef: string | null;
|
|
970
|
+
approvedAt: Timestamp | null;
|
|
971
|
+
approvedBy: string | null;
|
|
972
|
+
completedAt: Timestamp | null;
|
|
973
|
+
createdAt: Generated<Timestamp>;
|
|
974
|
+
dryRunResult: Json | null;
|
|
975
|
+
id: Generated<string>;
|
|
976
|
+
limits: Json;
|
|
977
|
+
manifest: Json;
|
|
978
|
+
manifestHash: string;
|
|
979
|
+
ordinal: number;
|
|
980
|
+
planId: string;
|
|
981
|
+
scopeType: HealthAccountingIntegrityRepairScopeType;
|
|
982
|
+
startedAt: Timestamp | null;
|
|
983
|
+
status: Generated<HealthAccountingIntegrityRepairStageStatus>;
|
|
984
|
+
tenantId: string;
|
|
985
|
+
updatedAt: Generated<Timestamp>;
|
|
986
|
+
verificationResult: Json | null;
|
|
987
|
+
}
|
|
988
|
+
export interface HealthAccountingIntegrityRepairTarget {
|
|
989
|
+
action: Json;
|
|
990
|
+
applyResult: Json | null;
|
|
991
|
+
auditActionId: string | null;
|
|
992
|
+
beforeHash: string;
|
|
993
|
+
beforeState: Json;
|
|
994
|
+
caseContentHash: string;
|
|
995
|
+
caseId: string;
|
|
996
|
+
caseVersion: Int8;
|
|
997
|
+
completedAt: Timestamp | null;
|
|
998
|
+
createdAt: Generated<Timestamp>;
|
|
999
|
+
effectPlan: Json;
|
|
1000
|
+
expectedResult: Json;
|
|
1001
|
+
id: Generated<string>;
|
|
1002
|
+
idempotencyKey: string;
|
|
1003
|
+
lockAssessment: Json;
|
|
1004
|
+
ordinal: number;
|
|
1005
|
+
stageId: string;
|
|
1006
|
+
startedAt: Timestamp | null;
|
|
1007
|
+
status: Generated<HealthAccountingIntegrityRepairTargetStatus>;
|
|
1008
|
+
targetKey: string;
|
|
1009
|
+
tenantId: string;
|
|
1010
|
+
updatedAt: Generated<Timestamp>;
|
|
1011
|
+
verificationResult: Json | null;
|
|
1012
|
+
}
|
|
1013
|
+
export interface HealthAccountingIntegrityRepairTransition {
|
|
1014
|
+
actor: string;
|
|
1015
|
+
createdAt: Generated<Timestamp>;
|
|
1016
|
+
id: Generated<string>;
|
|
1017
|
+
payload: Json;
|
|
1018
|
+
planId: string;
|
|
1019
|
+
stageId: string | null;
|
|
1020
|
+
targetId: string | null;
|
|
1021
|
+
type: HealthAccountingIntegrityRepairTransitionType;
|
|
1022
|
+
}
|
|
946
1023
|
export interface HealthAccountingIntegrityRun {
|
|
947
1024
|
caseCount: Generated<Int8>;
|
|
948
1025
|
changedCaseCount: Generated<Int8>;
|
|
@@ -960,7 +1037,9 @@ export interface HealthAccountingIntegrityRun {
|
|
|
960
1037
|
openedCaseCount: Generated<Int8>;
|
|
961
1038
|
reopenedCaseCount: Generated<Int8>;
|
|
962
1039
|
resolvedCaseCount: Generated<Int8>;
|
|
1040
|
+
resolvesCases: Generated<boolean>;
|
|
963
1041
|
rowsScanned: Generated<Int8>;
|
|
1042
|
+
scopeTenantIds: string[] | null;
|
|
964
1043
|
shardKey: Generated<string>;
|
|
965
1044
|
startedAt: Timestamp;
|
|
966
1045
|
status: HealthAccountingIntegrityRunStatus;
|
|
@@ -2310,6 +2389,10 @@ export interface DB {
|
|
|
2310
2389
|
"hdbCatalog.hdbVersion": HdbCatalogHdbVersion;
|
|
2311
2390
|
"health.accountingIntegrityCase": HealthAccountingIntegrityCase;
|
|
2312
2391
|
"health.accountingIntegrityDelivery": HealthAccountingIntegrityDelivery;
|
|
2392
|
+
"health.accountingIntegrityRepairPlan": HealthAccountingIntegrityRepairPlan;
|
|
2393
|
+
"health.accountingIntegrityRepairStage": HealthAccountingIntegrityRepairStage;
|
|
2394
|
+
"health.accountingIntegrityRepairTarget": HealthAccountingIntegrityRepairTarget;
|
|
2395
|
+
"health.accountingIntegrityRepairTransition": HealthAccountingIntegrityRepairTransition;
|
|
2313
2396
|
"health.accountingIntegrityRun": HealthAccountingIntegrityRun;
|
|
2314
2397
|
"health.accountingIntegrityTransition": HealthAccountingIntegrityTransition;
|
|
2315
2398
|
"health.reservationIssueSnapshot": HealthReservationIssueSnapshot;
|