@vrplatform/kysely 1.3.45-5070 → 1.3.45-5103

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 (89) 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 +158 -154
  10. package/build/main/v1.generated.js.map +1 -1
  11. package/build/migrations-v2/0000000000000-baseline.ts +5 -0
  12. package/build/migrations-v2/0000000000001-public-audit-events-v2.ts +137 -0
  13. package/build/module/local/generate.js +8 -8
  14. package/build/module/local/generate.js.map +1 -1
  15. package/build/module/local/index.js +5 -4
  16. package/build/module/local/index.js.map +1 -1
  17. package/build/module/migration.d.ts +7 -0
  18. package/build/module/migration.js +8 -0
  19. package/build/module/migration.js.map +1 -0
  20. package/build/module/v1.generated.d.ts +158 -154
  21. package/build/module/v1.generated.js.map +1 -1
  22. package/package.json +3 -3
  23. package/build/migrations/0000000000001-init.ts +0 -5
  24. package/build/migrations/0000000000009-drop-store-schema.ts +0 -14
  25. package/build/migrations/0000000000010-bank-rules.ts +0 -190
  26. package/build/migrations/0000000000011-bank-rule-line-adjustments.ts +0 -65
  27. package/build/migrations/0000000000012-bank-rule-conditions.ts +0 -45
  28. package/build/migrations/0000000000013-bank-rule-name-unique.ts +0 -15
  29. package/build/migrations/0000000000014-bank-rule-drop-legacy-conditions.ts +0 -41
  30. package/build/migrations/0000000000015-booking-channel-logo-dev-provider.ts +0 -70
  31. package/build/migrations/0000000000016-owner-statement-draft-status.ts +0 -22
  32. package/build/migrations/0000000000017-tenant-migration-markers.ts +0 -18
  33. package/build/migrations/0000000000018-security-deposits-payable-category.ts +0 -63
  34. package/build/migrations/0000000000019-tenant-app-settings.ts +0 -76
  35. package/build/migrations/0000000000020-operating-opening-trial-balance.ts +0 -36
  36. package/build/migrations/0000000000021-audit-foreign-key-indexes.ts +0 -77
  37. package/build/migrations/0000000000022-opening-trial-balance-combined-columns.ts +0 -30
  38. package/build/migrations/0000000000023-journal-entry-currency-mismatch-reason.ts +0 -14
  39. package/build/migrations/0000000000024-listing-parent.ts +0 -37
  40. package/build/migrations/0000000000025-journal-entry-parent-listing.ts +0 -26
  41. package/build/migrations/0000000000026-booking-channel-logo-slots.ts +0 -89
  42. package/build/migrations/0000000000027-list-browse-performance-indexes.ts +0 -52
  43. package/build/migrations/0000000000028-flow-setting-status-jsonb.ts +0 -20
  44. package/build/migrations/0000000000029-tenant-slug.ts +0 -328
  45. package/build/migrations/0000000000030-pms-accounting-windows.ts +0 -50
  46. package/build/migrations/0000000000031-owner-statement-projection-listing-revision.ts +0 -20
  47. package/build/migrations/0000000000032-flow-event-listening.ts +0 -28
  48. package/build/migrations/0000000000033-opening-trial-balance-transaction.ts +0 -272
  49. package/build/migrations/0000000000034-historic-general-ledger.ts +0 -24
  50. package/build/migrations/0000000000035-tenant-regional-placement.ts +0 -37
  51. package/build/migrations/0000000000036-control-plane-projection-events.ts +0 -43
  52. package/build/migrations/0000000000037-tenant-guide-onboarding.ts +0 -21
  53. package/build/migrations/0000000000038-tracking-event-analytics-sink.ts +0 -31
  54. package/build/migrations/0000000000039-crunchy-region.ts +0 -86
  55. package/build/migrations/0000000000040-hostaway-region.ts +0 -72
  56. package/build/migrations/0000000000041-audit-tenant-fk.ts +0 -66
  57. package/build/migrations/0000000000042-ramp-staging-connect-params.ts +0 -35
  58. package/build/migrations/0000000000043-gl-pms-accounting-window-guard.ts +0 -125
  59. package/build/migrations/0000000000044-tenant-cross-region-fks.ts +0 -45
  60. package/build/migrations/0000000000045-cloudflare-region-env.ts +0 -100
  61. package/build/migrations/0000000000046-control-plane-outbox-alias.ts +0 -46
  62. package/build/migrations/0000000000047-ramp-contact-last-4-digits.ts +0 -16
  63. package/build/migrations/0000000000047-tenant-status-backfill.ts +0 -40
  64. package/build/migrations/0000000000048-tenant-status-constraint.ts +0 -24
  65. package/build/migrations/0000000000049-health-tenant-issues.ts +0 -69
  66. package/build/migrations/0000000000050-partner-webhooks.ts +0 -135
  67. package/build/migrations/0000000000051-health-webhook-runtime-grants.ts +0 -42
  68. package/build/migrations/0000000000052-feature-approval-team-enablement.ts +0 -13
  69. package/build/migrations/0000000000053-health-webhook-enums.ts +0 -296
  70. package/build/migrations/0000000000054-user-secondary-emails-jsonb.ts +0 -25
  71. package/build/migrations/0000000000055-outbound-webhooks-v1.ts +0 -221
  72. package/build/migrations/0000000000056-connection-webhook-version.ts +0 -18
  73. package/build/migrations/0000000000057-sync-webhook-version.ts +0 -18
  74. package/build/migrations/0000000000058-reservation-webhook-version.ts +0 -18
  75. package/build/migrations/0000000000059-listing-webhook-version.ts +0 -18
  76. package/build/migrations/0000000000060-owner-statement-webhook-version.ts +0 -19
  77. package/build/migrations/0000000000061-transaction-webhook-version.ts +0 -18
  78. package/build/migrations/0000000000062-plaid-connect-session.ts +0 -102
  79. package/build/migrations/0000000000063-pgcrypto.ts +0 -27
  80. package/build/migrations/0000000000064-partner-api-foundation.ts +0 -36
  81. package/build/migrations/0000000000065-canonical-jsonb-shapes.ts +0 -231
  82. package/build/migrations/0000000000066-source-delete-fk-indexes.ts +0 -20
  83. package/build/migrations/0000000000067-remove-opening-trial-balance-account-columns.ts +0 -34
  84. package/build/migrations/0000000000068-bank-record-account-delete-cascade.ts +0 -26
  85. package/build/migrations/0000000000069-account-connections.ts +0 -204
  86. package/build/migrations/0000000000070-provider-payment-projection-indexes.ts +0 -53
  87. package/build/migrations/0000000000071-tenant-app-settings-shape.ts +0 -39
  88. package/build/migrations/0000000000072-tenant-app-settings-shape-validation.ts +0 -11
  89. package/build/migrations/0000000000073-public-audit-events.ts +0 -241
@@ -1,53 +0,0 @@
1
- import type { Kysely } from 'kysely';
2
- import { sql } from 'kysely';
3
-
4
- export async function up(db: Kysely<any>): Promise<void> {
5
- await sql`
6
- create index if not exists source_bill_transfer_id_idx
7
- on public.source (tenant_id, (json ->> 'transferId'))
8
- where type = 'bill';
9
- `.execute(db);
10
-
11
- await sql`
12
- create index if not exists sync_provider_payment_idempotency_key_idx
13
- on core.sync (
14
- tenant_id,
15
- connection_id,
16
- ((params -> 'providerPayment') ->> 'idempotencyKey')
17
- )
18
- where params ? 'providerPayment';
19
- `.execute(db);
20
-
21
- await sql`
22
- create index if not exists sync_provider_payment_transaction_ids_idx
23
- on core.sync using gin (((params -> 'providerPayment') -> 'transactionIds'))
24
- where params ? 'providerPayment';
25
- `.execute(db);
26
-
27
- await sql`
28
- create index if not exists sync_payment_method_contact_id_idx
29
- on core.sync (
30
- tenant_id,
31
- ((params -> 'paymentMethod') ->> 'contactId')
32
- )
33
- where params ? 'paymentMethod';
34
- `.execute(db);
35
- }
36
-
37
- export async function down(db: Kysely<any>): Promise<void> {
38
- await sql`
39
- drop index if exists core.sync_payment_method_contact_id_idx;
40
- `.execute(db);
41
-
42
- await sql`
43
- drop index if exists core.sync_provider_payment_transaction_ids_idx;
44
- `.execute(db);
45
-
46
- await sql`
47
- drop index if exists core.sync_provider_payment_idempotency_key_idx;
48
- `.execute(db);
49
-
50
- await sql`
51
- drop index if exists public.source_bill_transfer_id_idx;
52
- `.execute(db);
53
- }
@@ -1,39 +0,0 @@
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 public.tenant
7
- add constraint tenant_app_settings_object_check
8
- check (
9
- app_settings is null
10
- or jsonb_typeof(app_settings) = 'object'
11
- ) not valid
12
- `.execute(db);
13
-
14
- await sql`
15
- update public.tenant
16
- set app_settings = case
17
- when jsonb_typeof(app_settings) = 'string' then
18
- case
19
- when pg_input_is_valid(app_settings #>> '{}', 'jsonb') then
20
- case
21
- when jsonb_typeof((app_settings #>> '{}')::jsonb) = 'object'
22
- then (app_settings #>> '{}')::jsonb
23
- else '{}'::jsonb
24
- end
25
- else '{}'::jsonb
26
- end
27
- else '{}'::jsonb
28
- end
29
- where app_settings is not null
30
- and jsonb_typeof(app_settings) <> 'object'
31
- `.execute(db);
32
- }
33
-
34
- export async function down(db: Kysely<unknown>): Promise<void> {
35
- await sql`
36
- alter table public.tenant
37
- drop constraint if exists tenant_app_settings_object_check
38
- `.execute(db);
39
- }
@@ -1,11 +0,0 @@
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 public.tenant
7
- validate constraint tenant_app_settings_object_check
8
- `.execute(db);
9
- }
10
-
11
- export async function down(): Promise<void> {}
@@ -1,241 +0,0 @@
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 type audit.action_actor_type add value if not exists 'api_key';
7
- `.execute(db);
8
-
9
- await sql`
10
- create type audit.source_type as enum (
11
- 'portal', 'api', 'integration', 'sync', 'automation', 'system'
12
- );
13
- `.execute(db);
14
- await sql`
15
- create type audit.public_event_operation as enum (
16
- 'create', 'update', 'delete', 'archive', 'restore', 'execute',
17
- 'recalculate'
18
- );
19
- `.execute(db);
20
- await sql`
21
- create type audit.public_event_accounting_status as enum (
22
- 'not_applicable', 'pending', 'unchanged', 'changed', 'blocked',
23
- 'failed', 'mixed'
24
- );
25
- `.execute(db);
26
-
27
- // actor_id stays uuid: every writer supplies a user or token-row UUID, and
28
- // retyping to text would rewrite the multi-GB action table under lock.
29
- await sql`
30
- alter table audit.action
31
- add column actor_name text,
32
- add column actor_email text,
33
- add column actor_label text,
34
- add column source_type audit.source_type;
35
- `.execute(db);
36
-
37
- await sql`
38
- alter table audit.effect
39
- add column accounting_relevant boolean not null default false;
40
- `.execute(db);
41
-
42
- // capture_order uses a nullable column plus a sequence default instead of
43
- // an identity column: identity backfills every existing row, which rewrites
44
- // the 100M+-row mutation table under an access-exclusive lock. Rows written
45
- // before this migration keep null; only post-cutover mutations are ever
46
- // projected, and those all receive sequence values.
47
- await sql`
48
- alter table audit.mutation
49
- add column accounting_relevant boolean not null default false,
50
- add column public_changes jsonb not null default '[]'::jsonb,
51
- add column capture_order bigint;
52
- `.execute(db);
53
- await sql`
54
- create sequence audit.mutation_capture_order_seq
55
- owned by audit.mutation.capture_order;
56
- `.execute(db);
57
- await sql`
58
- alter table audit.mutation
59
- alter column capture_order
60
- set default nextval('audit.mutation_capture_order_seq');
61
- `.execute(db);
62
-
63
- await sql`
64
- alter table audit.journal_delta
65
- add column currency_before text,
66
- add column currency_after text,
67
- add column ledger_before text,
68
- add column ledger_after text,
69
- add column account_name_before text,
70
- add column account_name_after text,
71
- add column account_category_id_before uuid,
72
- add column account_category_id_after uuid,
73
- add column account_category_name_before text,
74
- add column account_category_name_after text,
75
- add column account_classification_before text,
76
- add column account_classification_after text;
77
- `.execute(db);
78
-
79
- await sql`
80
- create table audit.public_event (
81
- id uuid primary key default gen_random_uuid(),
82
- tenant_id uuid not null,
83
- action_id uuid not null,
84
- root_entity_type text not null,
85
- root_entity_id uuid not null,
86
- revision integer not null default 1 check (revision >= 1),
87
- occurred_at timestamptz not null,
88
- updated_at timestamptz not null default now(),
89
- team_unique_ref text,
90
- team_name text not null,
91
- actor_type audit.action_actor_type not null,
92
- actor_id text,
93
- actor_name text,
94
- actor_email text,
95
- actor_label text,
96
- source_type audit.source_type not null,
97
- request_id text,
98
- action_code text not null,
99
- action_summary text not null,
100
- entity_unique_ref text,
101
- entity_name text,
102
- operation audit.public_event_operation not null,
103
- entity_changes jsonb not null default '[]'::jsonb,
104
- accounting_status audit.public_event_accounting_status not null,
105
- changed_dimensions text[] not null default '{}',
106
- affected_account_ids uuid[] not null default '{}',
107
- affected_accounts jsonb not null default '[]'::jsonb,
108
- affected_periods text[] not null default '{}',
109
- affected_ownership_period_ids uuid[] not null default '{}',
110
- affected_owner_statement_ids uuid[] not null default '{}',
111
- projection_fingerprint text not null,
112
- unique (tenant_id, action_id, root_entity_type, root_entity_id)
113
- );
114
- `.execute(db);
115
-
116
- await sql`
117
- create table audit.public_event_posting_change (
118
- id uuid primary key default gen_random_uuid(),
119
- event_id uuid not null references audit.public_event(id) on delete cascade,
120
- tenant_id uuid not null,
121
- account_id uuid,
122
- account_name text,
123
- account_category_id uuid,
124
- account_category_name text,
125
- account_classification text,
126
- party text,
127
- currency text,
128
- posting_date date,
129
- ledger text,
130
- status text,
131
- ownership_period_id uuid,
132
- owner_statement_id uuid,
133
- before_cent_total bigint,
134
- after_cent_total bigint,
135
- check (
136
- before_cent_total is not null or after_cent_total is not null
137
- )
138
- );
139
- `.execute(db);
140
-
141
- await sql`
142
- create table audit.public_event_projection_state (
143
- singleton boolean primary key default true check (singleton),
144
- cutover_at timestamptz not null default now(),
145
- last_recovered_at timestamptz,
146
- retained_from timestamptz
147
- );
148
- `.execute(db);
149
- await sql`
150
- insert into audit.public_event_projection_state default values;
151
- `.execute(db);
152
-
153
- await sql`
154
- create index public_event_tenant_updated_idx
155
- on audit.public_event (tenant_id, updated_at, id);
156
- `.execute(db);
157
- await sql`
158
- create index public_event_tenant_entity_updated_idx
159
- on audit.public_event (
160
- tenant_id, root_entity_type, root_entity_id, updated_at, id
161
- );
162
- `.execute(db);
163
- await sql`
164
- create index public_event_updated_idx
165
- on audit.public_event (updated_at, id);
166
- `.execute(db);
167
- await sql`
168
- create index public_event_actor_idx
169
- on audit.public_event (tenant_id, actor_type, actor_id, updated_at, id);
170
- `.execute(db);
171
- await sql`
172
- create index public_event_action_idx
173
- on audit.public_event (tenant_id, action_id);
174
- `.execute(db);
175
- await sql`
176
- create index public_event_affected_accounts_idx
177
- on audit.public_event using gin (affected_account_ids);
178
- `.execute(db);
179
- await sql`
180
- create index public_event_posting_change_event_idx
181
- on audit.public_event_posting_change (event_id, tenant_id);
182
- `.execute(db);
183
- }
184
-
185
- export async function down(db: Kysely<unknown>): Promise<void> {
186
- await sql`
187
- drop table if exists audit.public_event_projection_state;
188
- `.execute(db);
189
- await sql`
190
- drop table if exists audit.public_event_posting_change;
191
- `.execute(db);
192
- await sql`
193
- drop table if exists audit.public_event;
194
- `.execute(db);
195
-
196
- await sql`
197
- alter table audit.journal_delta
198
- drop column if exists account_classification_after,
199
- drop column if exists account_classification_before,
200
- drop column if exists account_category_name_after,
201
- drop column if exists account_category_name_before,
202
- drop column if exists account_category_id_after,
203
- drop column if exists account_category_id_before,
204
- drop column if exists account_name_after,
205
- drop column if exists account_name_before,
206
- drop column if exists ledger_after,
207
- drop column if exists ledger_before,
208
- drop column if exists currency_after,
209
- drop column if exists currency_before;
210
- `.execute(db);
211
-
212
- await sql`
213
- alter table audit.mutation
214
- drop column if exists capture_order,
215
- drop column if exists public_changes,
216
- drop column if exists accounting_relevant;
217
- `.execute(db);
218
-
219
- await sql`
220
- alter table audit.effect
221
- drop column if exists accounting_relevant;
222
- `.execute(db);
223
-
224
- await sql`
225
- alter table audit.action
226
- drop column if exists source_type,
227
- drop column if exists actor_label,
228
- drop column if exists actor_email,
229
- drop column if exists actor_name;
230
- `.execute(db);
231
-
232
- await sql`
233
- drop type if exists audit.public_event_accounting_status;
234
- `.execute(db);
235
- await sql`
236
- drop type if exists audit.public_event_operation;
237
- `.execute(db);
238
- await sql`
239
- drop type if exists audit.source_type;
240
- `.execute(db);
241
- }