@vrplatform/kysely 1.3.45-stage.6033 → 1.3.45-stage.604

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 (98) hide show
  1. package/build/.data.tar +0 -0
  2. package/build/main/control-plane/index.d.ts +314 -0
  3. package/build/main/control-plane/index.js.map +1 -1
  4. package/build/main/index.d.ts +13 -2
  5. package/build/main/index.js +217 -23
  6. package/build/main/index.js.map +1 -1
  7. package/build/main/local/generate.js +2 -0
  8. package/build/main/local/generate.js.map +1 -1
  9. package/build/main/local/index.js +110 -8
  10. package/build/main/local/index.js.map +1 -1
  11. package/build/main/postgres-error.d.ts +3 -3
  12. package/build/main/postgres-error.js +4 -3
  13. package/build/main/postgres-error.js.map +1 -1
  14. package/build/main/query/listing/status.js +2 -6
  15. package/build/main/query/listing/status.js.map +1 -1
  16. package/build/main/query/tenant/status.d.ts +4 -6
  17. package/build/main/query/tenant/status.js +17 -14
  18. package/build/main/query/tenant/status.js.map +1 -1
  19. package/build/main/regional.d.ts +1 -0
  20. package/build/main/regional.js +1 -0
  21. package/build/main/regional.js.map +1 -1
  22. package/build/main/test/index.d.ts +23 -3
  23. package/build/main/test/index.js +35 -13
  24. package/build/main/test/index.js.map +1 -1
  25. package/build/main/v1.generated.d.ts +560 -7
  26. package/build/main/v1.generated.js.map +1 -1
  27. package/build/migrations-v2/0000000000013-ui-permission-bundles.ts +45 -0
  28. package/build/migrations-v2/0000000000014-ui-permission-bundle-top-up.ts +32 -0
  29. package/build/migrations-v2/0000000000015-durable-flow-events.ts +163 -0
  30. package/build/migrations-v2/0000000000016-billing-listing-facts.ts +539 -0
  31. package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
  32. package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
  33. package/build/migrations-v2/0000000000017-webhook-secret-reencryption-failures.ts +18 -0
  34. package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
  35. package/build/migrations-v2/0000000000018-durable-flow-event-sensitive-input.ts +28 -0
  36. package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
  37. package/build/migrations-v2/0000000000019-asynchronous-operations.ts +736 -0
  38. package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
  39. package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
  40. package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
  41. package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
  42. package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
  43. package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
  44. package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
  45. package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
  46. package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
  47. package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
  48. package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
  49. package/build/migrations-v2/0000000000031-ui-permission-role-simplification.ts +70 -0
  50. package/build/migrations-v2/0000000000032-tenant-delete-ownership-cascades.ts +44 -0
  51. package/build/migrations-v2/0000000000033-reservation-issue-seed-bucket-index.ts +19 -0
  52. package/build/migrations-v2/0000000000034-retire-recent-classification-indexes.ts +29 -0
  53. package/build/migrations-v2/0000000000035-core-change-autovacuum.ts +24 -0
  54. package/build/migrations-v2/0000000000036-journal-entry-inactive-reason-constraint.ts +33 -0
  55. package/build/migrations-v2/0000000000037-journal-entry-inactive-reasons.ts +19 -0
  56. package/build/migrations-v2/0000000000038-journal-entry-group-inactive-reason.ts +14 -0
  57. package/build/migrations-v2/0000000000039-reservation-guest-breakdown.ts +19 -0
  58. package/build/migrations-v2/0000000000040-csv-import-source-identity-index.ts +23 -0
  59. package/build/migrations-v2/0000000000041-payment-returns.ts +38 -0
  60. package/build/migrations-v2/0000000000042-operation-resource-types.ts +609 -0
  61. package/build/migrations-v2/0000000000043-reservation-journal-freshness.ts +149 -0
  62. package/build/migrations-v2/0000000000044-reservation-journal-freshness-backfill.ts +254 -0
  63. package/build/migrations-v2/0000000000045-reservation-journal-freshness-revision-repair.ts +83 -0
  64. package/build/migrations-v2/0000000000046-materialized-reservation-journal-operations.ts +709 -0
  65. package/build/migrations-v2/0000000000047-public-audit-completion.ts +77 -0
  66. package/build/migrations-v2/0000000000048-reservation-journal-full-refresh-repair.ts +136 -0
  67. package/build/migrations-v2/0000000000049-queued-journal-operation-failures.ts +60 -0
  68. package/build/migrations-v2/0000000000050-connection-oauth-state.ts +43 -0
  69. package/build/migrations-v2/0000000000051-owner-statement-email-delivery.ts +134 -0
  70. package/build/migrations-v2/0000000000052-fee-journal-lock-skip-operations.ts +59 -0
  71. package/build/migrations-v2/0000000000053-fee-journal-lock-skip-null-attempt.ts +44 -0
  72. package/build/migrations-v2/0000000000054-journal-refresh-issue-codes.ts +16 -0
  73. package/build/module/control-plane/index.d.ts +314 -0
  74. package/build/module/control-plane/index.js.map +1 -1
  75. package/build/module/index.d.ts +13 -2
  76. package/build/module/index.js +219 -24
  77. package/build/module/index.js.map +1 -1
  78. package/build/module/local/generate.js +2 -0
  79. package/build/module/local/generate.js.map +1 -1
  80. package/build/module/local/index.js +110 -8
  81. package/build/module/local/index.js.map +1 -1
  82. package/build/module/postgres-error.d.ts +3 -3
  83. package/build/module/postgres-error.js +4 -3
  84. package/build/module/postgres-error.js.map +1 -1
  85. package/build/module/query/listing/status.js +2 -6
  86. package/build/module/query/listing/status.js.map +1 -1
  87. package/build/module/query/tenant/status.d.ts +4 -6
  88. package/build/module/query/tenant/status.js +17 -14
  89. package/build/module/query/tenant/status.js.map +1 -1
  90. package/build/module/regional.d.ts +1 -0
  91. package/build/module/regional.js +1 -0
  92. package/build/module/regional.js.map +1 -1
  93. package/build/module/test/index.d.ts +23 -3
  94. package/build/module/test/index.js +34 -13
  95. package/build/module/test/index.js.map +1 -1
  96. package/build/module/v1.generated.d.ts +560 -7
  97. package/build/module/v1.generated.js.map +1 -1
  98. package/package.json +4 -2
@@ -0,0 +1,34 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`set local lock_timeout = '5s'`.execute(db);
6
+ await sql`
7
+ alter table public.tenant_user
8
+ add column managed_team_access text not null default 'assigned',
9
+ add constraint tenant_user_managed_team_access_check
10
+ check (managed_team_access in ('all', 'assigned'))
11
+ `.execute(db);
12
+ await sql`
13
+ alter table public.tenant_user
14
+ disable trigger set_public_tenant_user_updated_at
15
+ `.execute(db);
16
+ await sql`
17
+ update public.tenant_user as tenant_user
18
+ set managed_team_access = 'all'
19
+ from public.tenant as tenant
20
+ where tenant.id = tenant_user.tenant_id
21
+ and tenant.type = 'partner'
22
+ and tenant_user.role = 'admin'
23
+ `.execute(db);
24
+ await sql`
25
+ alter table public.tenant_user
26
+ enable trigger set_public_tenant_user_updated_at
27
+ `.execute(db);
28
+ }
29
+
30
+ export async function down(db: Kysely<unknown>): Promise<void> {
31
+ await sql`
32
+ alter table public.tenant_user drop column managed_team_access
33
+ `.execute(db);
34
+ }
@@ -0,0 +1,42 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ do $$
6
+ declare
7
+ definition text;
8
+ trigger_function regprocedure;
9
+ begin
10
+ for trigger_function in
11
+ select distinct p.oid::regprocedure
12
+ from pg_trigger as t
13
+ inner join pg_proc as p on p.oid = t.tgfoid
14
+ where t.tgrelid = 'public.tenant'::regclass
15
+ and not t.tgisinternal
16
+ and p.prosrc ilike '%trial_until%'
17
+ loop
18
+ definition := pg_get_functiondef(trigger_function);
19
+ definition := replace(definition, 'OLD."trial_until" , ', '');
20
+ definition := replace(definition, 'NEW."trial_until" , ', '');
21
+
22
+ if definition ilike '%trial_until%' then
23
+ raise exception
24
+ 'Could not remove trial_until from tenant trigger function %',
25
+ trigger_function;
26
+ end if;
27
+
28
+ execute definition;
29
+ end loop;
30
+ end;
31
+ $$;
32
+ `.execute(db);
33
+ await sql`
34
+ alter table public.tenant drop column if exists trial_until
35
+ `.execute(db);
36
+ }
37
+
38
+ export async function down(db: Kysely<unknown>): Promise<void> {
39
+ await sql`
40
+ alter table public.tenant add column trial_until date
41
+ `.execute(db);
42
+ }
@@ -0,0 +1,18 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`
6
+ alter table webhook.subscription_secret
7
+ add column reencryption_failed_at timestamptz,
8
+ add column reencryption_failure_code text
9
+ `.execute(db);
10
+ }
11
+
12
+ export async function down(db: Kysely<unknown>): Promise<void> {
13
+ await sql`
14
+ alter table webhook.subscription_secret
15
+ drop column reencryption_failure_code,
16
+ drop column reencryption_failed_at
17
+ `.execute(db);
18
+ }
@@ -0,0 +1,276 @@
1
+ import { type Kysely, sql } from 'kysely';
2
+
3
+ export async function up(db: Kysely<unknown>): Promise<void> {
4
+ await sql`
5
+ create type health.accounting_integrity_run_status as enum (
6
+ 'running',
7
+ 'completed',
8
+ 'failed',
9
+ 'skipped'
10
+ )
11
+ `.execute(db);
12
+ await sql`
13
+ create type health.accounting_integrity_case_status as enum (
14
+ 'open',
15
+ 'resolved'
16
+ )
17
+ `.execute(db);
18
+ await sql`
19
+ create type health.accounting_integrity_review_status as enum (
20
+ 'unreviewed',
21
+ 'confirmed_issue',
22
+ 'expected',
23
+ 'false_positive'
24
+ )
25
+ `.execute(db);
26
+ await sql`
27
+ create type health.accounting_integrity_actionability as enum (
28
+ 'automatically_repairable',
29
+ 'manual_repair',
30
+ 'blocked',
31
+ 'code_fix_required',
32
+ 'unknown'
33
+ )
34
+ `.execute(db);
35
+ await sql`
36
+ create type health.accounting_integrity_resolution_classification as enum (
37
+ 'code_fix',
38
+ 'configuration',
39
+ 'data_repair',
40
+ 'expected',
41
+ 'false_positive',
42
+ 'monitor_fix',
43
+ 'unknown'
44
+ )
45
+ `.execute(db);
46
+ await sql`
47
+ create type health.accounting_integrity_severity as enum (
48
+ 'info',
49
+ 'warning',
50
+ 'error',
51
+ 'critical'
52
+ )
53
+ `.execute(db);
54
+ await sql`
55
+ create type health.accounting_integrity_transition_type as enum (
56
+ 'opened',
57
+ 'changed',
58
+ 'reopened',
59
+ 'resolved',
60
+ 'reviewed'
61
+ )
62
+ `.execute(db);
63
+ await sql`
64
+ create type health.accounting_integrity_delivery_channel as enum (
65
+ 'sentry',
66
+ 'slack'
67
+ )
68
+ `.execute(db);
69
+ await sql`
70
+ create type health.accounting_integrity_delivery_status as enum (
71
+ 'suppressed',
72
+ 'pending',
73
+ 'processing',
74
+ 'delivered',
75
+ 'failed',
76
+ 'dead_letter'
77
+ )
78
+ `.execute(db);
79
+
80
+ await sql`
81
+ create table health.accounting_integrity_run (
82
+ id uuid primary key default gen_random_uuid(),
83
+ evaluation_id uuid not null,
84
+ code text not null,
85
+ definition_version integer not null,
86
+ git_revision text not null,
87
+ environment text not null,
88
+ data_region text not null,
89
+ status health.accounting_integrity_run_status not null,
90
+ started_at timestamptz not null,
91
+ completed_at timestamptz,
92
+ rows_scanned bigint not null default 0,
93
+ finding_row_count bigint not null default 0,
94
+ case_count bigint not null default 0,
95
+ opened_case_count bigint not null default 0,
96
+ changed_case_count bigint not null default 0,
97
+ reopened_case_count bigint not null default 0,
98
+ resolved_case_count bigint not null default 0,
99
+ unchanged_case_count bigint not null default 0,
100
+ error jsonb,
101
+ created_at timestamptz not null default now(),
102
+ updated_at timestamptz not null default now(),
103
+ constraint accounting_integrity_run_evaluation_region_code_key
104
+ unique (evaluation_id, data_region, code)
105
+ );
106
+ `.execute(db);
107
+
108
+ await sql`
109
+ create index accounting_integrity_run_metrics_idx
110
+ on health.accounting_integrity_run (
111
+ environment,
112
+ started_at desc
113
+ );
114
+ `.execute(db);
115
+
116
+ await sql`
117
+ create table health.accounting_integrity_case (
118
+ id uuid primary key default gen_random_uuid(),
119
+ data_region text not null,
120
+ code text not null,
121
+ tenant_id uuid not null references public.tenant(id) on delete cascade,
122
+ case_key text not null,
123
+ version bigint not null default 1,
124
+ status health.accounting_integrity_case_status not null,
125
+ review_status health.accounting_integrity_review_status
126
+ not null default 'unreviewed',
127
+ actionability health.accounting_integrity_actionability not null,
128
+ resolution_classification
129
+ health.accounting_integrity_resolution_classification not null,
130
+ severity health.accounting_integrity_severity not null,
131
+ title text not null,
132
+ root_cause text not null,
133
+ expected jsonb not null,
134
+ actual jsonb not null,
135
+ impact jsonb not null,
136
+ lock_assessment jsonb not null,
137
+ evidence jsonb not null,
138
+ evidence_complete boolean not null,
139
+ portal_urls jsonb not null,
140
+ historical_issue_refs jsonb not null,
141
+ verification jsonb not null,
142
+ repair jsonb not null,
143
+ content_hash text not null,
144
+ run_id uuid not null
145
+ references health.accounting_integrity_run(id) on delete restrict,
146
+ definition_version integer not null,
147
+ git_revision text not null,
148
+ first_seen_at timestamptz not null,
149
+ last_seen_at timestamptz not null,
150
+ last_changed_at timestamptz not null,
151
+ resolved_at timestamptz,
152
+ created_at timestamptz not null default now(),
153
+ updated_at timestamptz not null default now(),
154
+ constraint accounting_integrity_case_identity_key
155
+ unique (data_region, code, tenant_id, case_key),
156
+ constraint accounting_integrity_case_version_check check (version > 0)
157
+ );
158
+ `.execute(db);
159
+
160
+ await sql`
161
+ create index accounting_integrity_case_tenant_idx
162
+ on health.accounting_integrity_case (tenant_id)
163
+ `.execute(db);
164
+ await sql`
165
+ create index accounting_integrity_case_run_idx
166
+ on health.accounting_integrity_case (run_id)
167
+ `.execute(db);
168
+ await sql`
169
+ create index accounting_integrity_case_open_idx
170
+ on health.accounting_integrity_case (
171
+ data_region,
172
+ code,
173
+ severity,
174
+ tenant_id,
175
+ last_changed_at desc
176
+ )
177
+ where status = 'open';
178
+ `.execute(db);
179
+
180
+ await sql`
181
+ create table health.accounting_integrity_transition (
182
+ id uuid primary key default gen_random_uuid(),
183
+ run_id uuid not null
184
+ references health.accounting_integrity_run(id) on delete cascade,
185
+ case_id uuid not null
186
+ references health.accounting_integrity_case(id) on delete cascade,
187
+ case_version bigint not null,
188
+ type health.accounting_integrity_transition_type not null,
189
+ payload jsonb not null,
190
+ created_at timestamptz not null default now(),
191
+ constraint accounting_integrity_transition_case_version_type_key
192
+ unique (case_id, case_version, type)
193
+ );
194
+ `.execute(db);
195
+
196
+ await sql`
197
+ create index accounting_integrity_transition_run_idx
198
+ on health.accounting_integrity_transition (run_id)
199
+ `.execute(db);
200
+ await sql`
201
+ create table health.accounting_integrity_delivery (
202
+ id uuid primary key default gen_random_uuid(),
203
+ run_id uuid not null
204
+ references health.accounting_integrity_run(id) on delete cascade,
205
+ case_id uuid
206
+ references health.accounting_integrity_case(id) on delete cascade,
207
+ channel health.accounting_integrity_delivery_channel not null,
208
+ event_type text not null,
209
+ dedupe_key text not null unique,
210
+ payload jsonb not null,
211
+ status health.accounting_integrity_delivery_status
212
+ not null default 'pending',
213
+ attempts integer not null default 0,
214
+ claim_id uuid,
215
+ claimed_at timestamptz,
216
+ next_attempt_at timestamptz not null default now(),
217
+ delivered_at timestamptz,
218
+ result jsonb,
219
+ last_error jsonb,
220
+ created_at timestamptz not null default now(),
221
+ updated_at timestamptz not null default now()
222
+ );
223
+ `.execute(db);
224
+
225
+ await sql`
226
+ create index accounting_integrity_delivery_run_idx
227
+ on health.accounting_integrity_delivery (run_id)
228
+ `.execute(db);
229
+ await sql`
230
+ create index accounting_integrity_delivery_case_idx
231
+ on health.accounting_integrity_delivery (case_id)
232
+ `.execute(db);
233
+ await sql`
234
+ create index accounting_integrity_delivery_pending_idx
235
+ on health.accounting_integrity_delivery (next_attempt_at, created_at, id)
236
+ where status in ('pending', 'processing', 'failed');
237
+ `.execute(db);
238
+ }
239
+
240
+ export async function down(db: Kysely<unknown>): Promise<void> {
241
+ await sql`drop table if exists health.accounting_integrity_delivery;`.execute(
242
+ db
243
+ );
244
+ await sql`drop table if exists health.accounting_integrity_transition;`.execute(
245
+ db
246
+ );
247
+ await sql`drop table if exists health.accounting_integrity_case;`.execute(db);
248
+ await sql`drop table if exists health.accounting_integrity_run;`.execute(db);
249
+ await sql`drop type if exists health.accounting_integrity_delivery_status`.execute(
250
+ db
251
+ );
252
+ await sql`drop type if exists health.accounting_integrity_delivery_channel`.execute(
253
+ db
254
+ );
255
+ await sql`drop type if exists health.accounting_integrity_transition_type`.execute(
256
+ db
257
+ );
258
+ await sql`drop type if exists health.accounting_integrity_severity`.execute(
259
+ db
260
+ );
261
+ await sql`drop type if exists health.accounting_integrity_resolution_classification`.execute(
262
+ db
263
+ );
264
+ await sql`drop type if exists health.accounting_integrity_actionability`.execute(
265
+ db
266
+ );
267
+ await sql`drop type if exists health.accounting_integrity_review_status`.execute(
268
+ db
269
+ );
270
+ await sql`drop type if exists health.accounting_integrity_case_status`.execute(
271
+ db
272
+ );
273
+ await sql`drop type if exists health.accounting_integrity_run_status`.execute(
274
+ db
275
+ );
276
+ }
@@ -0,0 +1,28 @@
1
+ import type { Kysely } from 'kysely';
2
+ import { sql } from 'kysely';
3
+
4
+ export async function up(db: Kysely<unknown>): Promise<void> {
5
+ await sql`
6
+ alter table core.flow_event
7
+ add column requires_sensitive_input boolean not null default false
8
+ `.execute(db);
9
+ await sql`drop index core.flow_event_sync_idx`.execute(db);
10
+ await sql`
11
+ create index flow_event_sync_idx
12
+ on core.flow_event (sync_id, status)
13
+ where sync_id is not null
14
+ `.execute(db);
15
+ }
16
+
17
+ export async function down(db: Kysely<unknown>): Promise<void> {
18
+ await sql`drop index core.flow_event_sync_idx`.execute(db);
19
+ await sql`
20
+ create index flow_event_sync_idx
21
+ on core.flow_event (tenant_id, sync_id)
22
+ where sync_id is not null
23
+ `.execute(db);
24
+ await sql`
25
+ alter table core.flow_event
26
+ drop column requires_sensitive_input
27
+ `.execute(db);
28
+ }
@@ -0,0 +1,26 @@
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 shard_key text not null default 'regional'
7
+ `.execute(db);
8
+
9
+ await sql`
10
+ alter table health.accounting_integrity_run
11
+ drop constraint accounting_integrity_run_evaluation_region_code_key,
12
+ add constraint accounting_integrity_run_evaluation_region_code_shard_key
13
+ unique (evaluation_id, data_region, code, shard_key)
14
+ `.execute(db);
15
+ }
16
+
17
+ export async function down(db: Kysely<unknown>): Promise<void> {
18
+ await sql`
19
+ alter table health.accounting_integrity_run
20
+ drop constraint
21
+ accounting_integrity_run_evaluation_region_code_shard_key,
22
+ drop column shard_key,
23
+ add constraint accounting_integrity_run_evaluation_region_code_key
24
+ unique (evaluation_id, data_region, code)
25
+ `.execute(db);
26
+ }