@vrplatform/kysely 1.3.45-6090 → 1.3.45-61
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/control-plane/index.d.ts +175 -0
- package/build/main/control-plane/index.js.map +1 -1
- package/build/main/index.d.ts +2 -2
- package/build/main/index.js +111 -22
- package/build/main/index.js.map +1 -1
- package/build/main/local/generate.js +2 -0
- package/build/main/local/generate.js.map +1 -1
- package/build/main/local/index.js +12 -0
- package/build/main/local/index.js.map +1 -1
- package/build/main/query/listing/status.js +2 -6
- package/build/main/query/listing/status.js.map +1 -1
- package/build/main/query/tenant/status.js +2 -2
- package/build/main/query/tenant/status.js.map +1 -1
- package/build/main/test/index.d.ts +0 -3
- package/build/main/test/index.js +0 -9
- package/build/main/test/index.js.map +1 -1
- package/build/main/v1.generated.d.ts +253 -2
- package/build/main/v1.generated.js.map +1 -1
- package/build/migrations-v2/0000000000015-durable-flow-events.ts +163 -0
- package/build/migrations-v2/0000000000016-billing-listing-facts.ts +539 -0
- package/build/migrations-v2/0000000000016-managed-team-access.ts +34 -0
- package/build/migrations-v2/0000000000017-drop-trial-until.ts +42 -0
- package/build/migrations-v2/0000000000017-webhook-secret-reencryption-failures.ts +18 -0
- package/build/migrations-v2/0000000000018-accounting-integrity-monitoring.ts +276 -0
- package/build/migrations-v2/0000000000018-durable-flow-event-sensitive-input.ts +28 -0
- package/build/migrations-v2/0000000000019-accounting-integrity-run-shards.ts +26 -0
- package/build/migrations-v2/0000000000019-asynchronous-operations.ts +736 -0
- package/build/migrations-v2/0000000000020-accounting-integrity-case-classification.ts +52 -0
- package/build/migrations-v2/0000000000021-payment-line-classification-monitor-indexes.ts +31 -0
- package/build/migrations-v2/0000000000022-accounting-integrity-controlled-repairs.ts +281 -0
- package/build/migrations-v2/0000000000023-line-classification-usage.ts +325 -0
- package/build/migrations-v2/0000000000024-tenant-region-migration.ts +108 -0
- package/build/migrations-v2/0000000000025-partner-ach-denial-default.ts +30 -0
- package/build/migrations-v2/0000000000026-line-classification-usage-capture.ts +399 -0
- package/build/migrations-v2/0000000000027-payout-replacement-chain.ts +27 -0
- package/build/migrations-v2/0000000000028-accounting-integrity-operator-workflow.ts +108 -0
- package/build/migrations-v2/0000000000029-accounting-integrity-definition-artifacts.ts +40 -0
- package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts +49 -0
- package/build/migrations-v2/0000000000031-ui-permission-role-simplification.ts +70 -0
- package/build/migrations-v2/0000000000032-tenant-delete-ownership-cascades.ts +44 -0
- package/build/module/control-plane/index.d.ts +175 -0
- package/build/module/control-plane/index.js.map +1 -1
- package/build/module/index.d.ts +2 -2
- package/build/module/index.js +113 -23
- package/build/module/index.js.map +1 -1
- package/build/module/local/generate.js +2 -0
- package/build/module/local/generate.js.map +1 -1
- package/build/module/local/index.js +12 -0
- package/build/module/local/index.js.map +1 -1
- package/build/module/query/listing/status.js +2 -6
- package/build/module/query/listing/status.js.map +1 -1
- package/build/module/query/tenant/status.js +2 -2
- package/build/module/query/tenant/status.js.map +1 -1
- package/build/module/test/index.d.ts +0 -3
- package/build/module/test/index.js +0 -9
- package/build/module/test/index.js.map +1 -1
- package/build/module/v1.generated.d.ts +253 -2
- package/build/module/v1.generated.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Kysely, sql } from 'kysely';
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await sql`set local lock_timeout = '5s'`.execute(db);
|
|
5
|
+
await sql`
|
|
6
|
+
alter table health.accounting_integrity_run
|
|
7
|
+
add column definition_version_id uuid,
|
|
8
|
+
add column definition_artifact_hash text,
|
|
9
|
+
add column definition_template_id text,
|
|
10
|
+
add column definition_template_version integer,
|
|
11
|
+
add column operator_definition_version integer,
|
|
12
|
+
add constraint accounting_integrity_run_definition_artifact_check check (
|
|
13
|
+
(
|
|
14
|
+
definition_version_id is null and
|
|
15
|
+
definition_artifact_hash is null and
|
|
16
|
+
definition_template_id is null and
|
|
17
|
+
definition_template_version is null and
|
|
18
|
+
operator_definition_version is null
|
|
19
|
+
) or (
|
|
20
|
+
definition_version_id is not null and
|
|
21
|
+
definition_artifact_hash is not null and
|
|
22
|
+
definition_template_id is not null and
|
|
23
|
+
definition_template_version > 0 and
|
|
24
|
+
operator_definition_version > 0
|
|
25
|
+
)
|
|
26
|
+
)
|
|
27
|
+
`.execute(db);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
31
|
+
await sql`
|
|
32
|
+
alter table health.accounting_integrity_run
|
|
33
|
+
drop constraint accounting_integrity_run_definition_artifact_check,
|
|
34
|
+
drop column operator_definition_version,
|
|
35
|
+
drop column definition_template_version,
|
|
36
|
+
drop column definition_template_id,
|
|
37
|
+
drop column definition_artifact_hash,
|
|
38
|
+
drop column definition_version_id
|
|
39
|
+
`.execute(db);
|
|
40
|
+
}
|
package/build/migrations-v2/0000000000030-accounting-integrity-review-metadata-compatibility.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Kysely, sql } from 'kysely';
|
|
2
|
+
|
|
3
|
+
export async function up(db: Kysely<unknown>): Promise<void> {
|
|
4
|
+
await sql`set local lock_timeout = '5s'`.execute(db);
|
|
5
|
+
await sql`
|
|
6
|
+
alter table health.accounting_integrity_case
|
|
7
|
+
drop constraint accounting_integrity_case_review_metadata_check,
|
|
8
|
+
add constraint accounting_integrity_case_review_metadata_check check (
|
|
9
|
+
(
|
|
10
|
+
reviewed_by is null and reviewed_at is null and
|
|
11
|
+
review_rationale is null
|
|
12
|
+
) or (
|
|
13
|
+
reviewed_by is not null and reviewed_at is not null and
|
|
14
|
+
nullif(trim(review_rationale), '') is not null
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
`.execute(db);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
21
|
+
await sql`
|
|
22
|
+
update health.accounting_integrity_case
|
|
23
|
+
set reviewed_by = null, reviewed_at = null, review_rationale = null
|
|
24
|
+
where review_status = 'unreviewed'
|
|
25
|
+
`.execute(db);
|
|
26
|
+
await sql`
|
|
27
|
+
update health.accounting_integrity_case
|
|
28
|
+
set
|
|
29
|
+
reviewed_by = coalesce(reviewed_by, 'legacy-monitoring'),
|
|
30
|
+
reviewed_at = coalesce(reviewed_at, last_changed_at),
|
|
31
|
+
review_rationale = coalesce(
|
|
32
|
+
nullif(trim(review_rationale), ''),
|
|
33
|
+
'Migrated from compatibility review state.'
|
|
34
|
+
)
|
|
35
|
+
where review_status <> 'unreviewed'
|
|
36
|
+
`.execute(db);
|
|
37
|
+
await sql`
|
|
38
|
+
alter table health.accounting_integrity_case
|
|
39
|
+
drop constraint accounting_integrity_case_review_metadata_check,
|
|
40
|
+
add constraint accounting_integrity_case_review_metadata_check check (
|
|
41
|
+
(review_status = 'unreviewed' and reviewed_by is null and
|
|
42
|
+
reviewed_at is null and review_rationale is null)
|
|
43
|
+
or
|
|
44
|
+
(review_status <> 'unreviewed' and reviewed_by is not null and
|
|
45
|
+
reviewed_at is not null and nullif(trim(review_rationale), '')
|
|
46
|
+
is not null)
|
|
47
|
+
)
|
|
48
|
+
`.execute(db);
|
|
49
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
disable trigger set_public_tenant_user_updated_at
|
|
9
|
+
`.execute(db);
|
|
10
|
+
await sql`
|
|
11
|
+
update public.tenant_user as tenant_user
|
|
12
|
+
set permission_bundles = (
|
|
13
|
+
select array_agg(mapped.bundle order by mapped.first_ordinal)
|
|
14
|
+
from (
|
|
15
|
+
select
|
|
16
|
+
case existing.bundle
|
|
17
|
+
when 'ui:accounting:v1' then 'ui:standard-member:v1'
|
|
18
|
+
when 'ui:owner-statements:v1' then 'ui:operations:v1'
|
|
19
|
+
when 'ui:reports-viewer:v1' then 'ui:read-only:v1'
|
|
20
|
+
else existing.bundle
|
|
21
|
+
end as bundle,
|
|
22
|
+
min(existing.ordinality) as first_ordinal
|
|
23
|
+
from unnest(tenant_user.permission_bundles)
|
|
24
|
+
with ordinality as existing(bundle, ordinality)
|
|
25
|
+
group by
|
|
26
|
+
case existing.bundle
|
|
27
|
+
when 'ui:accounting:v1' then 'ui:standard-member:v1'
|
|
28
|
+
when 'ui:owner-statements:v1' then 'ui:operations:v1'
|
|
29
|
+
when 'ui:reports-viewer:v1' then 'ui:read-only:v1'
|
|
30
|
+
else existing.bundle
|
|
31
|
+
end
|
|
32
|
+
) as mapped
|
|
33
|
+
)
|
|
34
|
+
where tenant_user.permission_bundles && array[
|
|
35
|
+
'ui:accounting:v1',
|
|
36
|
+
'ui:owner-statements:v1',
|
|
37
|
+
'ui:reports-viewer:v1'
|
|
38
|
+
]::text[]
|
|
39
|
+
`.execute(db);
|
|
40
|
+
await sql`
|
|
41
|
+
alter table public.tenant_user
|
|
42
|
+
enable trigger set_public_tenant_user_updated_at
|
|
43
|
+
`.execute(db);
|
|
44
|
+
await sql`alter table public.tenant disable trigger user`.execute(db);
|
|
45
|
+
await sql`
|
|
46
|
+
update public.tenant as tenant
|
|
47
|
+
set partner_denied_permissions = (
|
|
48
|
+
select array_agg(rewritten.permission order by rewritten.first_ordinal)
|
|
49
|
+
from (
|
|
50
|
+
select
|
|
51
|
+
permission,
|
|
52
|
+
min(ordinality) as first_ordinal
|
|
53
|
+
from unnest(
|
|
54
|
+
array_remove(tenant.partner_denied_permissions, 'transactions:write')
|
|
55
|
+
|| array[
|
|
56
|
+
'transactions:deposits:write',
|
|
57
|
+
'transactions:expenses:write',
|
|
58
|
+
'transactions:transfers:write',
|
|
59
|
+
'transactions:payouts:write'
|
|
60
|
+
]::text[]
|
|
61
|
+
) with ordinality as expanded(permission, ordinality)
|
|
62
|
+
group by permission
|
|
63
|
+
) as rewritten
|
|
64
|
+
)
|
|
65
|
+
where 'transactions:write' = any(tenant.partner_denied_permissions)
|
|
66
|
+
`.execute(db);
|
|
67
|
+
await sql`alter table public.tenant enable trigger user`.execute(db);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export async function down(_db: Kysely<unknown>): Promise<void> {}
|
|
@@ -0,0 +1,44 @@
|
|
|
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.connection
|
|
7
|
+
drop constraint connection_tenant_id_fkey,
|
|
8
|
+
add constraint connection_tenant_id_fkey
|
|
9
|
+
foreign key (tenant_id)
|
|
10
|
+
references public.tenant(id)
|
|
11
|
+
on update restrict
|
|
12
|
+
on delete cascade
|
|
13
|
+
`.execute(db);
|
|
14
|
+
await sql`
|
|
15
|
+
alter table accounting.account_reservation_line_type
|
|
16
|
+
drop constraint account_reservation_line_type_account_id_fkey,
|
|
17
|
+
add constraint account_reservation_line_type_account_id_fkey
|
|
18
|
+
foreign key (account_id)
|
|
19
|
+
references accounting.account(id)
|
|
20
|
+
on update restrict
|
|
21
|
+
on delete cascade
|
|
22
|
+
`.execute(db);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function down(db: Kysely<unknown>): Promise<void> {
|
|
26
|
+
await sql`
|
|
27
|
+
alter table accounting.account_reservation_line_type
|
|
28
|
+
drop constraint account_reservation_line_type_account_id_fkey,
|
|
29
|
+
add constraint account_reservation_line_type_account_id_fkey
|
|
30
|
+
foreign key (account_id)
|
|
31
|
+
references accounting.account(id)
|
|
32
|
+
on update restrict
|
|
33
|
+
on delete restrict
|
|
34
|
+
`.execute(db);
|
|
35
|
+
await sql`
|
|
36
|
+
alter table public.connection
|
|
37
|
+
drop constraint connection_tenant_id_fkey,
|
|
38
|
+
add constraint connection_tenant_id_fkey
|
|
39
|
+
foreign key (tenant_id)
|
|
40
|
+
references public.tenant(id)
|
|
41
|
+
on update restrict
|
|
42
|
+
on delete restrict
|
|
43
|
+
`.execute(db);
|
|
44
|
+
}
|
|
@@ -7,6 +7,7 @@ export type JsonObject = {
|
|
|
7
7
|
};
|
|
8
8
|
export type JsonPrimitive = boolean | number | string | null;
|
|
9
9
|
export type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
10
|
+
export type Int8 = ColumnType<string, number | string | bigint, number | string | bigint>;
|
|
10
11
|
export type Timestamp = ColumnType<Date | string, Date | string, Date | string>;
|
|
11
12
|
export interface ControlPlaneApp {
|
|
12
13
|
authentication: Generated<Json>;
|
|
@@ -21,6 +22,56 @@ export interface ControlPlaneApp {
|
|
|
21
22
|
type: string;
|
|
22
23
|
version: Generated<number>;
|
|
23
24
|
}
|
|
25
|
+
export interface ControlPlaneAccountingIntegrityEvaluation {
|
|
26
|
+
caseCount: Generated<Int8>;
|
|
27
|
+
completedAt: Timestamp | null;
|
|
28
|
+
completedRunCount: Generated<number>;
|
|
29
|
+
createdAt: Generated<Timestamp>;
|
|
30
|
+
environment: string;
|
|
31
|
+
error: Json | null;
|
|
32
|
+
expectedRunCount: number;
|
|
33
|
+
failedRunCount: Generated<number>;
|
|
34
|
+
findingRowCount: Generated<Int8>;
|
|
35
|
+
gitRevision: string;
|
|
36
|
+
id: string;
|
|
37
|
+
results: Generated<Json>;
|
|
38
|
+
rowsScanned: Generated<Int8>;
|
|
39
|
+
skippedRunCount: Generated<number>;
|
|
40
|
+
source: string;
|
|
41
|
+
startedAt: Timestamp;
|
|
42
|
+
status: string;
|
|
43
|
+
updatedAt: Generated<Timestamp>;
|
|
44
|
+
}
|
|
45
|
+
export interface ControlPlaneAccountingIntegrityDefinitionDraft {
|
|
46
|
+
artifact: Json;
|
|
47
|
+
artifactHash: string;
|
|
48
|
+
code: string;
|
|
49
|
+
createdAt: Generated<Timestamp>;
|
|
50
|
+
id: Generated<string>;
|
|
51
|
+
ownerId: string;
|
|
52
|
+
previewResult: Json | null;
|
|
53
|
+
rationale: string;
|
|
54
|
+
revision: Generated<number>;
|
|
55
|
+
status: string;
|
|
56
|
+
templateId: string;
|
|
57
|
+
templateVersion: number;
|
|
58
|
+
title: string;
|
|
59
|
+
updatedAt: Generated<Timestamp>;
|
|
60
|
+
validationResult: Json | null;
|
|
61
|
+
}
|
|
62
|
+
export interface ControlPlaneAccountingIntegrityDefinitionVersion {
|
|
63
|
+
artifact: Json;
|
|
64
|
+
artifactHash: string;
|
|
65
|
+
code: string;
|
|
66
|
+
draftId: string;
|
|
67
|
+
id: Generated<string>;
|
|
68
|
+
publishedAt: Generated<Timestamp>;
|
|
69
|
+
publishedBy: string;
|
|
70
|
+
rollout: string;
|
|
71
|
+
templateId: string;
|
|
72
|
+
templateVersion: number;
|
|
73
|
+
version: number;
|
|
74
|
+
}
|
|
24
75
|
export interface ControlPlaneBookingChannel {
|
|
25
76
|
channelRef: string | null;
|
|
26
77
|
color: string | null;
|
|
@@ -98,6 +149,25 @@ export interface ControlPlaneFeatureApproval {
|
|
|
98
149
|
updatedAt: Generated<Timestamp>;
|
|
99
150
|
userId: string;
|
|
100
151
|
}
|
|
152
|
+
export interface ControlPlaneFlow {
|
|
153
|
+
appId: string;
|
|
154
|
+
createdAt: Generated<Timestamp>;
|
|
155
|
+
description: string | null;
|
|
156
|
+
eventListening: Generated<Json>;
|
|
157
|
+
id: Generated<string>;
|
|
158
|
+
isPublic: Generated<boolean>;
|
|
159
|
+
leftType: string | null;
|
|
160
|
+
mappingSchema: Generated<Json>;
|
|
161
|
+
revision: Generated<number>;
|
|
162
|
+
rightType: string | null;
|
|
163
|
+
runSchema: Generated<Json>;
|
|
164
|
+
settingSchema: Generated<Json>;
|
|
165
|
+
title: string;
|
|
166
|
+
type: 'pull' | 'push' | null;
|
|
167
|
+
uniqueRef: string;
|
|
168
|
+
updatedAt: Generated<Timestamp>;
|
|
169
|
+
useGlobalMapping: Generated<boolean>;
|
|
170
|
+
}
|
|
101
171
|
export interface ControlPlaneIssueMessageOverwrite {
|
|
102
172
|
createdAt: Generated<Timestamp>;
|
|
103
173
|
id: Generated<string>;
|
|
@@ -105,6 +175,74 @@ export interface ControlPlaneIssueMessageOverwrite {
|
|
|
105
175
|
pattern: string;
|
|
106
176
|
updatedAt: Generated<Timestamp>;
|
|
107
177
|
}
|
|
178
|
+
export interface ControlPlaneLineClassification {
|
|
179
|
+
appConflict: Generated<boolean>;
|
|
180
|
+
appId: string | null;
|
|
181
|
+
createdAt: Generated<Timestamp>;
|
|
182
|
+
firstSeenAt: Timestamp;
|
|
183
|
+
id: Generated<string>;
|
|
184
|
+
kind: string;
|
|
185
|
+
lastSeenAt: Timestamp;
|
|
186
|
+
name: string;
|
|
187
|
+
updatedAt: Generated<Timestamp>;
|
|
188
|
+
}
|
|
189
|
+
export interface ControlPlaneLineClassificationTeamUsage {
|
|
190
|
+
classificationId: string;
|
|
191
|
+
createdAt: Generated<Timestamp>;
|
|
192
|
+
dataRegion: string;
|
|
193
|
+
firstSeenAt: Timestamp;
|
|
194
|
+
lastSeenAt: Timestamp;
|
|
195
|
+
mappingStatus: string | null;
|
|
196
|
+
revision: number;
|
|
197
|
+
tenantId: string;
|
|
198
|
+
updatedAt: Generated<Timestamp>;
|
|
199
|
+
}
|
|
200
|
+
export interface ControlPlaneReservationLineDefault {
|
|
201
|
+
accountKey: string | null;
|
|
202
|
+
bookingChannel: string | null;
|
|
203
|
+
bookingChannelKey: Generated<string>;
|
|
204
|
+
classificationId: string;
|
|
205
|
+
createdAt: Generated<Timestamp>;
|
|
206
|
+
id: Generated<string>;
|
|
207
|
+
partnerTenantId: string | null;
|
|
208
|
+
revenueRecognition: string | null;
|
|
209
|
+
revision: Generated<number>;
|
|
210
|
+
updatedAt: Generated<Timestamp>;
|
|
211
|
+
}
|
|
212
|
+
export interface ControlPlaneRolloutMonitorSnapshot {
|
|
213
|
+
monitorName: string;
|
|
214
|
+
result: Json;
|
|
215
|
+
snapshotDate: Timestamp;
|
|
216
|
+
}
|
|
217
|
+
export interface ControlPlaneTransactionLineMapping {
|
|
218
|
+
accountAssignmentType: string | null;
|
|
219
|
+
createdAt: Generated<Timestamp>;
|
|
220
|
+
deletedAt: Timestamp | null;
|
|
221
|
+
id: Generated<string>;
|
|
222
|
+
lineType: string;
|
|
223
|
+
revision: Generated<number>;
|
|
224
|
+
updatedAt: Generated<Timestamp>;
|
|
225
|
+
}
|
|
226
|
+
export interface ControlPlaneGeneralLedgerDefaultSet {
|
|
227
|
+
createdAt: Generated<Timestamp>;
|
|
228
|
+
id: Generated<string>;
|
|
229
|
+
partnerTenantId: string | null;
|
|
230
|
+
publishedVersion: number | null;
|
|
231
|
+
sourceDataRegion: string;
|
|
232
|
+
sourceDigest: string | null;
|
|
233
|
+
sourceTenantId: string;
|
|
234
|
+
templateKey: string;
|
|
235
|
+
updatedAt: Generated<Timestamp>;
|
|
236
|
+
}
|
|
237
|
+
export interface ControlPlaneGeneralLedgerDefaultVersion {
|
|
238
|
+
dataJson: Json;
|
|
239
|
+
defaultSetId: string;
|
|
240
|
+
id: Generated<string>;
|
|
241
|
+
publishedAt: Generated<Timestamp>;
|
|
242
|
+
sourceDigest: string;
|
|
243
|
+
sourceTenantId: string;
|
|
244
|
+
version: number;
|
|
245
|
+
}
|
|
108
246
|
export interface ControlPlaneOutbox {
|
|
109
247
|
aggregateId: string;
|
|
110
248
|
aggregateType: string;
|
|
@@ -118,12 +256,19 @@ export interface ControlPlaneOutbox {
|
|
|
118
256
|
payload: Generated<Json>;
|
|
119
257
|
publishedAt: Timestamp | null;
|
|
120
258
|
}
|
|
259
|
+
export interface ControlPlanePartnerManagedTeamAssignment {
|
|
260
|
+
createdAt: Generated<Timestamp>;
|
|
261
|
+
managedTeamId: string;
|
|
262
|
+
partnerTenantId: string;
|
|
263
|
+
userId: string;
|
|
264
|
+
}
|
|
121
265
|
export interface ControlPlaneTenant {
|
|
122
266
|
billingPartnerId: string | null;
|
|
123
267
|
billingPlan: string | null;
|
|
124
268
|
createdAt: Generated<Timestamp>;
|
|
125
269
|
dataRegion: Generated<string>;
|
|
126
270
|
id: Generated<string>;
|
|
271
|
+
migrationStatus: Generated<string>;
|
|
127
272
|
name: string;
|
|
128
273
|
partnerId: string | null;
|
|
129
274
|
partnerDeniedPermissions: Generated<string[]>;
|
|
@@ -134,10 +279,26 @@ export interface ControlPlaneTenant {
|
|
|
134
279
|
uniqueRef: string | null;
|
|
135
280
|
updatedAt: Generated<Timestamp | null>;
|
|
136
281
|
}
|
|
282
|
+
export interface ControlPlaneTenantRegionMigration {
|
|
283
|
+
actor: string;
|
|
284
|
+
completedAt: Timestamp | null;
|
|
285
|
+
error: Json | null;
|
|
286
|
+
id: string;
|
|
287
|
+
reason: string;
|
|
288
|
+
sourceManifest: Json | null;
|
|
289
|
+
sourceRegion: string;
|
|
290
|
+
startedAt: Generated<Timestamp>;
|
|
291
|
+
status: Generated<string>;
|
|
292
|
+
targetManifest: Json | null;
|
|
293
|
+
targetRegion: string;
|
|
294
|
+
tenantId: string;
|
|
295
|
+
updatedAt: Generated<Timestamp>;
|
|
296
|
+
}
|
|
137
297
|
export interface ControlPlaneTenantUser {
|
|
138
298
|
createdAt: Generated<Timestamp | null>;
|
|
139
299
|
id: Generated<string>;
|
|
140
300
|
lastInvitedAt: Timestamp | null;
|
|
301
|
+
managedTeamAccess: Generated<'all' | 'assigned'>;
|
|
141
302
|
permissionBundles: Generated<string[]>;
|
|
142
303
|
role: Generated<string | null>;
|
|
143
304
|
status: Generated<string | null>;
|
|
@@ -161,6 +322,7 @@ export interface ControlPlaneUser {
|
|
|
161
322
|
email: string | null;
|
|
162
323
|
firstName: string | null;
|
|
163
324
|
id: Generated<string>;
|
|
325
|
+
internalOperationGrants: Generated<string[]>;
|
|
164
326
|
isAdmin: Generated<boolean>;
|
|
165
327
|
lastName: string | null;
|
|
166
328
|
lastSeen: Timestamp | null;
|
|
@@ -174,6 +336,9 @@ export interface ControlPlaneUser {
|
|
|
174
336
|
updatedAt: Generated<Timestamp | null>;
|
|
175
337
|
}
|
|
176
338
|
export interface ControlPlaneDB {
|
|
339
|
+
'controlPlane.accountingIntegrityDefinitionDraft': ControlPlaneAccountingIntegrityDefinitionDraft;
|
|
340
|
+
'controlPlane.accountingIntegrityDefinitionVersion': ControlPlaneAccountingIntegrityDefinitionVersion;
|
|
341
|
+
'controlPlane.accountingIntegrityEvaluation': ControlPlaneAccountingIntegrityEvaluation;
|
|
177
342
|
'controlPlane.app': ControlPlaneApp;
|
|
178
343
|
'controlPlane.bookingChannel': ControlPlaneBookingChannel;
|
|
179
344
|
'controlPlane.bookingChannelIconCandidate': ControlPlaneBookingChannelIconCandidate;
|
|
@@ -184,10 +349,20 @@ export interface ControlPlaneDB {
|
|
|
184
349
|
'controlPlane.feature': ControlPlaneFeature;
|
|
185
350
|
'controlPlane.featureApproval': ControlPlaneFeatureApproval;
|
|
186
351
|
'controlPlane.featureEnabledTeam': ControlPlaneFeatureEnabledTeam;
|
|
352
|
+
'controlPlane.generalLedgerDefaultSet': ControlPlaneGeneralLedgerDefaultSet;
|
|
353
|
+
'controlPlane.generalLedgerDefaultVersion': ControlPlaneGeneralLedgerDefaultVersion;
|
|
354
|
+
'controlPlane.lineClassification': ControlPlaneLineClassification;
|
|
355
|
+
'controlPlane.lineClassificationTeamUsage': ControlPlaneLineClassificationTeamUsage;
|
|
356
|
+
'controlPlane.partnerManagedTeamAssignment': ControlPlanePartnerManagedTeamAssignment;
|
|
357
|
+
'controlPlane.reservationLineDefault': ControlPlaneReservationLineDefault;
|
|
358
|
+
'controlPlane.rolloutMonitorSnapshot': ControlPlaneRolloutMonitorSnapshot;
|
|
187
359
|
'controlPlane.tenant': ControlPlaneTenant;
|
|
360
|
+
'controlPlane.tenantRegionMigration': ControlPlaneTenantRegionMigration;
|
|
188
361
|
'controlPlane.tenantUser': ControlPlaneTenantUser;
|
|
189
362
|
'controlPlane.token': ControlPlaneToken;
|
|
363
|
+
'controlPlane.transactionLineMapping': ControlPlaneTransactionLineMapping;
|
|
190
364
|
'controlPlane.user': ControlPlaneUser;
|
|
365
|
+
'controlPlaneCore.flow': ControlPlaneFlow;
|
|
191
366
|
'controlPlaneCore.issueMessageOverwrite': ControlPlaneIssueMessageOverwrite;
|
|
192
367
|
}
|
|
193
368
|
export declare function withControlPlaneSchema(kysely: Kysely<ControlPlaneDB>, schema: string, issueMessageOverwriteSchema?: string): Kysely<ControlPlaneDB>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["control-plane/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAGd,wBAAwB,GAQzB,MAAM,QAAQ,CAAC;AA2NhB,MAAM,6BAA8B,SAAQ,wBAAwB;IAEvD;IACA;IAFX,YACW,MAAc,EACd,2BAAmC;QAE5C,KAAK,EAAE,CAAC;QAHC,WAAM,GAAN,MAAM,CAAQ;QACd,gCAA2B,GAA3B,2BAA2B,CAAQ;IAG9C,CAAC;IAEkB,4BAA4B,CAC7C,IAA6B,EAC7B,OAAgB;QAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtE,IACE,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,cAAc;YAC3C,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,eAAe,EAC5C,CAAC;YACD,OAAO,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACxE,CAAC;QACD,IACE,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,kBAAkB;YAC/C,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,oBAAoB,EACjD,CAAC;YACD,OAAO;gBACL,GAAG,WAAW;gBACd,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC;aAChE,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEkB,iBAAiB,CAClC,IAAkB,EAClB,OAAgB;QAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;YAC1C,CAAC,CAAC;gBACE,GAAG,WAAW;gBACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE;aACzE;YACH,CAAC,CAAC,WAAW,CAAC;IAClB,CAAC;CACF;AAED,MAAM,wBAAwB;IACnB,YAAY,CAAgC;IAErD,YAAY,MAAc,EAAE,2BAAmC;QAC7D,IAAI,CAAC,YAAY,GAAG,IAAI,6BAA6B,CACnD,MAAM,EACN,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,IAA8B;QAC3C,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAA+B;QAE/B,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CACpC,MAA8B,EAC9B,MAAc,EACd,2BAA2B,GAAG,MAAM;IAEpC,OAAO,MAAM,CAAC,UAAU,CACtB,IAAI,wBAAwB,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAClE,CAAC;AACJ,CAAC","sourcesContent":["import {\n type ColumnType,\n type FunctionNode,\n IdentifierNode,\n type Kysely,\n type KyselyPlugin,\n OperationNodeTransformer,\n type PluginTransformQueryArgs,\n type PluginTransformResultArgs,\n type QueryId,\n type QueryResult,\n type RootOperationNode,\n type SchemableIdentifierNode,\n type UnknownRow,\n} from 'kysely';\n\nexport type Generated<T> =\n T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\n\nexport type Json = JsonValue;\n\nexport type JsonArray = JsonValue[];\n\nexport type JsonObject = {\n [x: string]: JsonValue | undefined;\n};\n\nexport type JsonPrimitive = boolean | number | string | null;\n\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport type Timestamp = ColumnType<Date | string, Date | string, Date | string>;\n\nexport interface ControlPlaneApp {\n authentication: Generated<Json>;\n category: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconRound: string | null;\n id: Generated<string>;\n info: Json | null;\n name: string;\n type: string;\n version: Generated<number>;\n}\n\nexport interface ControlPlaneBookingChannel {\n channelRef: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconProvider: string | null;\n id: Generated<string>;\n lastGenerateRun: Timestamp | null;\n logo: string | null;\n logoProvider: string | null;\n selectedBookingChannelIconCandidateId: string | null;\n selectedBookingChannelLogoCandidateId: string | null;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneBookingChannelIconCandidate {\n bookingChannelId: string;\n cloudflareImageId: string | null;\n color: string | null;\n comment: string | null;\n createdAt: Generated<Timestamp>;\n externalIcon: string | null;\n height: number | null;\n id: Generated<string>;\n provider: Generated<string>;\n source: string | null;\n updatedAt: Generated<Timestamp>;\n width: number | null;\n}\n\nexport interface ControlPlaneCurrency {\n name: string;\n}\n\nexport interface ControlPlaneEvent {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n packageName: string;\n props: Json;\n tenantId: string | null;\n timestamp: Generated<Timestamp>;\n trackedAt: Generated<Timestamp | null>;\n userId: string | null;\n}\n\nexport interface ControlPlaneConnectionRoute {\n connectionId: string;\n createdAt: Generated<Timestamp>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneFeature {\n createdAt: Generated<Timestamp>;\n description: string | null;\n id: Generated<string>;\n issueUrl: string | null;\n requiredApprovals: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string | null;\n title: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n}\n\nexport interface ControlPlaneFeatureEnabledTeam {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneFeatureApproval {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface ControlPlaneIssueMessageOverwrite {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string;\n pattern: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneOutbox {\n aggregateId: string;\n aggregateType: string;\n attempts: Generated<number>;\n createdAt: Generated<Timestamp>;\n dataRegion: string | null;\n eventType: string;\n eventVersion: number;\n id: Generated<string>;\n lastError: string | null;\n payload: Generated<Json>;\n publishedAt: Timestamp | null;\n}\n\nexport interface ControlPlaneTenant {\n billingPartnerId: string | null;\n billingPlan: string | null;\n createdAt: Generated<Timestamp>;\n dataRegion: Generated<string>;\n id: Generated<string>;\n name: string;\n partnerId: string | null;\n partnerDeniedPermissions: Generated<string[]>;\n slug: string;\n status: Generated<string | null>;\n storageRealm: Generated<string>;\n type: Generated<string | null>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface ControlPlaneTenantUser {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n lastInvitedAt: Timestamp | null;\n permissionBundles: Generated<string[]>;\n role: Generated<string | null>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp | null>;\n userId: string;\n}\n\nexport interface ControlPlaneToken {\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n id: Generated<string>;\n nanoId: Generated<string>;\n payload: Generated<Json>;\n tenantId: string | null;\n type: string | null;\n userId: string | null;\n}\n\nexport interface ControlPlaneUser {\n clerkId: string | null;\n createdAt: Generated<Timestamp | null>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n isAdmin: Generated<boolean>;\n lastName: string | null;\n lastSeen: Timestamp | null;\n name: string | null;\n partnerId: string | null;\n phone: string | null;\n secondaryEmails: Generated<Json>;\n status: Generated<string | null>;\n sub: string | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface ControlPlaneDB {\n 'controlPlane.app': ControlPlaneApp;\n 'controlPlane.bookingChannel': ControlPlaneBookingChannel;\n 'controlPlane.bookingChannelIconCandidate': ControlPlaneBookingChannelIconCandidate;\n 'controlPlane.connectionRoute': ControlPlaneConnectionRoute;\n 'controlPlane.controlPlaneOutbox': ControlPlaneOutbox;\n 'controlPlane.currency': ControlPlaneCurrency;\n 'controlPlane.events': ControlPlaneEvent;\n 'controlPlane.feature': ControlPlaneFeature;\n 'controlPlane.featureApproval': ControlPlaneFeatureApproval;\n 'controlPlane.featureEnabledTeam': ControlPlaneFeatureEnabledTeam;\n 'controlPlane.tenant': ControlPlaneTenant;\n 'controlPlane.tenantUser': ControlPlaneTenantUser;\n 'controlPlane.token': ControlPlaneToken;\n 'controlPlane.user': ControlPlaneUser;\n 'controlPlaneCore.issueMessageOverwrite': ControlPlaneIssueMessageOverwrite;\n}\n\nclass ControlPlaneSchemaTransformer extends OperationNodeTransformer {\n constructor(\n readonly schema: string,\n readonly issueMessageOverwriteSchema: string\n ) {\n super();\n }\n\n protected override transformSchemableIdentifier(\n node: SchemableIdentifierNode,\n queryId: QueryId\n ): SchemableIdentifierNode {\n const transformed = super.transformSchemableIdentifier(node, queryId);\n if (\n transformed.schema?.name === 'controlPlane' ||\n transformed.schema?.name === 'control_plane'\n ) {\n return { ...transformed, schema: IdentifierNode.create(this.schema) };\n }\n if (\n transformed.schema?.name === 'controlPlaneCore' ||\n transformed.schema?.name === 'control_plane_core'\n ) {\n return {\n ...transformed,\n schema: IdentifierNode.create(this.issueMessageOverwriteSchema),\n };\n }\n return transformed;\n }\n\n protected override transformFunction(\n node: FunctionNode,\n queryId: QueryId\n ): FunctionNode {\n const transformed = super.transformFunction(node, queryId);\n return node.func.startsWith('controlPlane.')\n ? {\n ...transformed,\n func: `${this.schema}.${transformed.func.slice('controlPlane.'.length)}`,\n }\n : transformed;\n }\n}\n\nclass ControlPlaneSchemaPlugin implements KyselyPlugin {\n readonly #transformer: ControlPlaneSchemaTransformer;\n\n constructor(schema: string, issueMessageOverwriteSchema: string) {\n this.#transformer = new ControlPlaneSchemaTransformer(\n schema,\n issueMessageOverwriteSchema\n );\n }\n\n transformQuery(args: PluginTransformQueryArgs): RootOperationNode {\n return this.#transformer.transformNode(args.node, args.queryId);\n }\n\n async transformResult(\n args: PluginTransformResultArgs\n ): Promise<QueryResult<UnknownRow>> {\n return args.result;\n }\n}\n\nexport function withControlPlaneSchema(\n kysely: Kysely<ControlPlaneDB>,\n schema: string,\n issueMessageOverwriteSchema = 'core'\n) {\n return kysely.withPlugin(\n new ControlPlaneSchemaPlugin(schema, issueMessageOverwriteSchema)\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["control-plane/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAGd,wBAAwB,GAQzB,MAAM,QAAQ,CAAC;AA4ZhB,MAAM,6BAA8B,SAAQ,wBAAwB;IAEvD;IACA;IAFX,YACW,MAAc,EACd,2BAAmC;QAE5C,KAAK,EAAE,CAAC;QAHC,WAAM,GAAN,MAAM,CAAQ;QACd,gCAA2B,GAA3B,2BAA2B,CAAQ;IAG9C,CAAC;IAEkB,4BAA4B,CAC7C,IAA6B,EAC7B,OAAgB;QAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,4BAA4B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACtE,IACE,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,cAAc;YAC3C,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,eAAe,EAC5C,CAAC;YACD,OAAO,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACxE,CAAC;QACD,IACE,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,kBAAkB;YAC/C,WAAW,CAAC,MAAM,EAAE,IAAI,KAAK,oBAAoB,EACjD,CAAC;YACD,OAAO;gBACL,GAAG,WAAW;gBACd,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC;aAChE,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEkB,iBAAiB,CAClC,IAAkB,EAClB,OAAgB;QAEhB,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;YAC1C,CAAC,CAAC;gBACE,GAAG,WAAW;gBACd,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE;aACzE;YACH,CAAC,CAAC,WAAW,CAAC;IAClB,CAAC;CACF;AAED,MAAM,wBAAwB;IACnB,YAAY,CAAgC;IAErD,YAAY,MAAc,EAAE,2BAAmC;QAC7D,IAAI,CAAC,YAAY,GAAG,IAAI,6BAA6B,CACnD,MAAM,EACN,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,IAA8B;QAC3C,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAA+B;QAE/B,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CACpC,MAA8B,EAC9B,MAAc,EACd,2BAA2B,GAAG,MAAM;IAEpC,OAAO,MAAM,CAAC,UAAU,CACtB,IAAI,wBAAwB,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAClE,CAAC;AACJ,CAAC","sourcesContent":["import {\n type ColumnType,\n type FunctionNode,\n IdentifierNode,\n type Kysely,\n type KyselyPlugin,\n OperationNodeTransformer,\n type PluginTransformQueryArgs,\n type PluginTransformResultArgs,\n type QueryId,\n type QueryResult,\n type RootOperationNode,\n type SchemableIdentifierNode,\n type UnknownRow,\n} from 'kysely';\n\nexport type Generated<T> =\n T extends ColumnType<infer S, infer I, infer U>\n ? ColumnType<S, I | undefined, U>\n : ColumnType<T, T | undefined, T>;\n\nexport type Json = JsonValue;\n\nexport type JsonArray = JsonValue[];\n\nexport type JsonObject = {\n [x: string]: JsonValue | undefined;\n};\n\nexport type JsonPrimitive = boolean | number | string | null;\n\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport type Int8 = ColumnType<\n string,\n number | string | bigint,\n number | string | bigint\n>;\n\nexport type Timestamp = ColumnType<Date | string, Date | string, Date | string>;\n\nexport interface ControlPlaneApp {\n authentication: Generated<Json>;\n category: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconRound: string | null;\n id: Generated<string>;\n info: Json | null;\n name: string;\n type: string;\n version: Generated<number>;\n}\n\nexport interface ControlPlaneAccountingIntegrityEvaluation {\n caseCount: Generated<Int8>;\n completedAt: Timestamp | null;\n completedRunCount: Generated<number>;\n createdAt: Generated<Timestamp>;\n environment: string;\n error: Json | null;\n expectedRunCount: number;\n failedRunCount: Generated<number>;\n findingRowCount: Generated<Int8>;\n gitRevision: string;\n id: string;\n results: Generated<Json>;\n rowsScanned: Generated<Int8>;\n skippedRunCount: Generated<number>;\n source: string;\n startedAt: Timestamp;\n status: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneAccountingIntegrityDefinitionDraft {\n artifact: Json;\n artifactHash: string;\n code: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n ownerId: string;\n previewResult: Json | null;\n rationale: string;\n revision: Generated<number>;\n status: string;\n templateId: string;\n templateVersion: number;\n title: string;\n updatedAt: Generated<Timestamp>;\n validationResult: Json | null;\n}\n\nexport interface ControlPlaneAccountingIntegrityDefinitionVersion {\n artifact: Json;\n artifactHash: string;\n code: string;\n draftId: string;\n id: Generated<string>;\n publishedAt: Generated<Timestamp>;\n publishedBy: string;\n rollout: string;\n templateId: string;\n templateVersion: number;\n version: number;\n}\n\nexport interface ControlPlaneBookingChannel {\n channelRef: string | null;\n color: string | null;\n createdAt: Generated<Timestamp>;\n icon: string | null;\n iconProvider: string | null;\n id: Generated<string>;\n lastGenerateRun: Timestamp | null;\n logo: string | null;\n logoProvider: string | null;\n selectedBookingChannelIconCandidateId: string | null;\n selectedBookingChannelLogoCandidateId: string | null;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneBookingChannelIconCandidate {\n bookingChannelId: string;\n cloudflareImageId: string | null;\n color: string | null;\n comment: string | null;\n createdAt: Generated<Timestamp>;\n externalIcon: string | null;\n height: number | null;\n id: Generated<string>;\n provider: Generated<string>;\n source: string | null;\n updatedAt: Generated<Timestamp>;\n width: number | null;\n}\n\nexport interface ControlPlaneCurrency {\n name: string;\n}\n\nexport interface ControlPlaneEvent {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n name: string;\n packageName: string;\n props: Json;\n tenantId: string | null;\n timestamp: Generated<Timestamp>;\n trackedAt: Generated<Timestamp | null>;\n userId: string | null;\n}\n\nexport interface ControlPlaneConnectionRoute {\n connectionId: string;\n createdAt: Generated<Timestamp>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneFeature {\n createdAt: Generated<Timestamp>;\n description: string | null;\n id: Generated<string>;\n issueUrl: string | null;\n requiredApprovals: Generated<Json | null>;\n status: Generated<string | null>;\n tenantId: string | null;\n title: string;\n updatedAt: Generated<Timestamp>;\n url: string | null;\n}\n\nexport interface ControlPlaneFeatureEnabledTeam {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneFeatureApproval {\n createdAt: Generated<Timestamp>;\n featureId: string;\n id: Generated<string>;\n status: Generated<string | null>;\n updatedAt: Generated<Timestamp>;\n userId: string;\n}\n\nexport interface ControlPlaneFlow {\n appId: string;\n createdAt: Generated<Timestamp>;\n description: string | null;\n eventListening: Generated<Json>;\n id: Generated<string>;\n isPublic: Generated<boolean>;\n leftType: string | null;\n mappingSchema: Generated<Json>;\n revision: Generated<number>;\n rightType: string | null;\n runSchema: Generated<Json>;\n settingSchema: Generated<Json>;\n title: string;\n type: 'pull' | 'push' | null;\n uniqueRef: string;\n updatedAt: Generated<Timestamp>;\n useGlobalMapping: Generated<boolean>;\n}\n\nexport interface ControlPlaneIssueMessageOverwrite {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n message: string;\n pattern: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneLineClassification {\n appConflict: Generated<boolean>;\n appId: string | null;\n createdAt: Generated<Timestamp>;\n firstSeenAt: Timestamp;\n id: Generated<string>;\n kind: string;\n lastSeenAt: Timestamp;\n name: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneLineClassificationTeamUsage {\n classificationId: string;\n createdAt: Generated<Timestamp>;\n dataRegion: string;\n firstSeenAt: Timestamp;\n lastSeenAt: Timestamp;\n mappingStatus: string | null;\n revision: number;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneReservationLineDefault {\n accountKey: string | null;\n bookingChannel: string | null;\n bookingChannelKey: Generated<string>;\n classificationId: string;\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n partnerTenantId: string | null;\n revenueRecognition: string | null;\n revision: Generated<number>;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneRolloutMonitorSnapshot {\n monitorName: string;\n result: Json;\n snapshotDate: Timestamp;\n}\n\nexport interface ControlPlaneTransactionLineMapping {\n accountAssignmentType: string | null;\n createdAt: Generated<Timestamp>;\n deletedAt: Timestamp | null;\n id: Generated<string>;\n lineType: string;\n revision: Generated<number>;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneGeneralLedgerDefaultSet {\n createdAt: Generated<Timestamp>;\n id: Generated<string>;\n partnerTenantId: string | null;\n publishedVersion: number | null;\n sourceDataRegion: string;\n sourceDigest: string | null;\n sourceTenantId: string;\n templateKey: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneGeneralLedgerDefaultVersion {\n dataJson: Json;\n defaultSetId: string;\n id: Generated<string>;\n publishedAt: Generated<Timestamp>;\n sourceDigest: string;\n sourceTenantId: string;\n version: number;\n}\n\nexport interface ControlPlaneOutbox {\n aggregateId: string;\n aggregateType: string;\n attempts: Generated<number>;\n createdAt: Generated<Timestamp>;\n dataRegion: string | null;\n eventType: string;\n eventVersion: number;\n id: Generated<string>;\n lastError: string | null;\n payload: Generated<Json>;\n publishedAt: Timestamp | null;\n}\n\nexport interface ControlPlanePartnerManagedTeamAssignment {\n createdAt: Generated<Timestamp>;\n managedTeamId: string;\n partnerTenantId: string;\n userId: string;\n}\n\nexport interface ControlPlaneTenant {\n billingPartnerId: string | null;\n billingPlan: string | null;\n createdAt: Generated<Timestamp>;\n dataRegion: Generated<string>;\n id: Generated<string>;\n migrationStatus: Generated<string>;\n name: string;\n partnerId: string | null;\n partnerDeniedPermissions: Generated<string[]>;\n slug: string;\n status: Generated<string | null>;\n storageRealm: Generated<string>;\n type: Generated<string | null>;\n uniqueRef: string | null;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface ControlPlaneTenantRegionMigration {\n actor: string;\n completedAt: Timestamp | null;\n error: Json | null;\n id: string;\n reason: string;\n sourceManifest: Json | null;\n sourceRegion: string;\n startedAt: Generated<Timestamp>;\n status: Generated<string>;\n targetManifest: Json | null;\n targetRegion: string;\n tenantId: string;\n updatedAt: Generated<Timestamp>;\n}\n\nexport interface ControlPlaneTenantUser {\n createdAt: Generated<Timestamp | null>;\n id: Generated<string>;\n lastInvitedAt: Timestamp | null;\n managedTeamAccess: Generated<'all' | 'assigned'>;\n permissionBundles: Generated<string[]>;\n role: Generated<string | null>;\n status: Generated<string | null>;\n tenantId: string;\n updatedAt: Generated<Timestamp | null>;\n userId: string;\n}\n\nexport interface ControlPlaneToken {\n createdAt: Generated<Timestamp>;\n expiresAt: Timestamp | null;\n id: Generated<string>;\n nanoId: Generated<string>;\n payload: Generated<Json>;\n tenantId: string | null;\n type: string | null;\n userId: string | null;\n}\n\nexport interface ControlPlaneUser {\n clerkId: string | null;\n createdAt: Generated<Timestamp | null>;\n email: string | null;\n firstName: string | null;\n id: Generated<string>;\n internalOperationGrants: Generated<string[]>;\n isAdmin: Generated<boolean>;\n lastName: string | null;\n lastSeen: Timestamp | null;\n name: string | null;\n partnerId: string | null;\n phone: string | null;\n secondaryEmails: Generated<Json>;\n status: Generated<string | null>;\n sub: string | null;\n type: Generated<string | null>;\n updatedAt: Generated<Timestamp | null>;\n}\n\nexport interface ControlPlaneDB {\n 'controlPlane.accountingIntegrityDefinitionDraft': ControlPlaneAccountingIntegrityDefinitionDraft;\n 'controlPlane.accountingIntegrityDefinitionVersion': ControlPlaneAccountingIntegrityDefinitionVersion;\n 'controlPlane.accountingIntegrityEvaluation': ControlPlaneAccountingIntegrityEvaluation;\n 'controlPlane.app': ControlPlaneApp;\n 'controlPlane.bookingChannel': ControlPlaneBookingChannel;\n 'controlPlane.bookingChannelIconCandidate': ControlPlaneBookingChannelIconCandidate;\n 'controlPlane.connectionRoute': ControlPlaneConnectionRoute;\n 'controlPlane.controlPlaneOutbox': ControlPlaneOutbox;\n 'controlPlane.currency': ControlPlaneCurrency;\n 'controlPlane.events': ControlPlaneEvent;\n 'controlPlane.feature': ControlPlaneFeature;\n 'controlPlane.featureApproval': ControlPlaneFeatureApproval;\n 'controlPlane.featureEnabledTeam': ControlPlaneFeatureEnabledTeam;\n 'controlPlane.generalLedgerDefaultSet': ControlPlaneGeneralLedgerDefaultSet;\n 'controlPlane.generalLedgerDefaultVersion': ControlPlaneGeneralLedgerDefaultVersion;\n 'controlPlane.lineClassification': ControlPlaneLineClassification;\n 'controlPlane.lineClassificationTeamUsage': ControlPlaneLineClassificationTeamUsage;\n 'controlPlane.partnerManagedTeamAssignment': ControlPlanePartnerManagedTeamAssignment;\n 'controlPlane.reservationLineDefault': ControlPlaneReservationLineDefault;\n 'controlPlane.rolloutMonitorSnapshot': ControlPlaneRolloutMonitorSnapshot;\n 'controlPlane.tenant': ControlPlaneTenant;\n 'controlPlane.tenantRegionMigration': ControlPlaneTenantRegionMigration;\n 'controlPlane.tenantUser': ControlPlaneTenantUser;\n 'controlPlane.token': ControlPlaneToken;\n 'controlPlane.transactionLineMapping': ControlPlaneTransactionLineMapping;\n 'controlPlane.user': ControlPlaneUser;\n 'controlPlaneCore.flow': ControlPlaneFlow;\n 'controlPlaneCore.issueMessageOverwrite': ControlPlaneIssueMessageOverwrite;\n}\n\nclass ControlPlaneSchemaTransformer extends OperationNodeTransformer {\n constructor(\n readonly schema: string,\n readonly issueMessageOverwriteSchema: string\n ) {\n super();\n }\n\n protected override transformSchemableIdentifier(\n node: SchemableIdentifierNode,\n queryId: QueryId\n ): SchemableIdentifierNode {\n const transformed = super.transformSchemableIdentifier(node, queryId);\n if (\n transformed.schema?.name === 'controlPlane' ||\n transformed.schema?.name === 'control_plane'\n ) {\n return { ...transformed, schema: IdentifierNode.create(this.schema) };\n }\n if (\n transformed.schema?.name === 'controlPlaneCore' ||\n transformed.schema?.name === 'control_plane_core'\n ) {\n return {\n ...transformed,\n schema: IdentifierNode.create(this.issueMessageOverwriteSchema),\n };\n }\n return transformed;\n }\n\n protected override transformFunction(\n node: FunctionNode,\n queryId: QueryId\n ): FunctionNode {\n const transformed = super.transformFunction(node, queryId);\n return node.func.startsWith('controlPlane.')\n ? {\n ...transformed,\n func: `${this.schema}.${transformed.func.slice('controlPlane.'.length)}`,\n }\n : transformed;\n }\n}\n\nclass ControlPlaneSchemaPlugin implements KyselyPlugin {\n readonly #transformer: ControlPlaneSchemaTransformer;\n\n constructor(schema: string, issueMessageOverwriteSchema: string) {\n this.#transformer = new ControlPlaneSchemaTransformer(\n schema,\n issueMessageOverwriteSchema\n );\n }\n\n transformQuery(args: PluginTransformQueryArgs): RootOperationNode {\n return this.#transformer.transformNode(args.node, args.queryId);\n }\n\n async transformResult(\n args: PluginTransformResultArgs\n ): Promise<QueryResult<UnknownRow>> {\n return args.result;\n }\n}\n\nexport function withControlPlaneSchema(\n kysely: Kysely<ControlPlaneDB>,\n schema: string,\n issueMessageOverwriteSchema = 'core'\n) {\n return kysely.withPlugin(\n new ControlPlaneSchemaPlugin(schema, issueMessageOverwriteSchema)\n );\n}\n"]}
|
package/build/module/index.d.ts
CHANGED
|
@@ -10,15 +10,15 @@ export * from './regional';
|
|
|
10
10
|
export * from './transaction';
|
|
11
11
|
import type { DB } from './v1.generated';
|
|
12
12
|
type KyselyOpts = {
|
|
13
|
+
hyperdrive?: true;
|
|
13
14
|
repositoryName?: string;
|
|
14
15
|
log?: true | LogConfig;
|
|
15
16
|
};
|
|
16
17
|
type PgOpt = {
|
|
17
18
|
forceDisableSSL?: boolean;
|
|
18
|
-
hyperdrive?: true;
|
|
19
19
|
probe?: true;
|
|
20
20
|
retries?: false | number;
|
|
21
|
-
}
|
|
21
|
+
} & Pick<KyselyOpts, 'hyperdrive'>;
|
|
22
22
|
export type Kysely = K<DB>;
|
|
23
23
|
export type ControlPlaneKysely = K<ControlPlaneDB>;
|
|
24
24
|
export type ControlPlaneTransaction = T<ControlPlaneDB>;
|