@vrplatform/api 1.3.1-stage.4260 → 1.3.1-stage.42602953090
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/main/cache.js +10 -7
- package/build/main/cache.js.map +1 -1
- package/build/main/client.d.ts +6 -2
- package/build/main/client.js +18 -15
- package/build/main/client.js.map +1 -1
- package/build/main/control-plane-routing.d.ts +6 -0
- package/build/main/control-plane-routing.js +34 -0
- package/build/main/control-plane-routing.js.map +1 -0
- package/build/main/embed-lifecycle.d.ts +140 -0
- package/build/main/embed-lifecycle.js +126 -0
- package/build/main/embed-lifecycle.js.map +1 -0
- package/build/main/error.d.ts +32 -17
- package/build/main/error.js +56 -32
- package/build/main/error.js.map +1 -1
- package/build/main/generated/routing.d.ts +11 -0
- package/build/main/generated/routing.js +292 -0
- package/build/main/generated/routing.js.map +1 -0
- package/build/main/generated/v1.d.ts +4 -75185
- package/build/main/generated/v1.js.map +4 -1
- package/build/main/index.d.ts +7 -0
- package/build/main/index.js +7 -0
- package/build/main/index.js.map +1 -1
- package/build/main/is-test-team.d.ts +18 -0
- package/build/main/is-test-team.js +27 -0
- package/build/main/is-test-team.js.map +1 -0
- package/build/main/is-test-user.d.ts +4 -0
- package/build/main/is-test-user.js +31 -0
- package/build/main/is-test-user.js.map +1 -0
- package/build/main/is-vrp-member.d.ts +4 -0
- package/build/main/is-vrp-member.js +33 -0
- package/build/main/is-vrp-member.js.map +1 -0
- package/build/main/retarget-request.d.ts +7 -0
- package/build/main/retarget-request.js +21 -0
- package/build/main/retarget-request.js.map +1 -0
- package/build/main/routing.d.ts +7 -0
- package/build/main/routing.js +22 -0
- package/build/main/routing.js.map +1 -1
- package/build/main/sec.js.map +1 -1
- package/build/main/types.d.ts +2 -0
- package/build/main/types.js.map +1 -1
- package/build/main/vrt-mcp.d.ts +216 -0
- package/build/main/vrt-mcp.js +201 -0
- package/build/main/vrt-mcp.js.map +1 -0
- package/build/module/cache.js +10 -7
- package/build/module/cache.js.map +1 -1
- package/build/module/client.d.ts +6 -2
- package/build/module/client.js +18 -15
- package/build/module/client.js.map +1 -1
- package/build/module/control-plane-routing.d.ts +6 -0
- package/build/module/control-plane-routing.js +30 -0
- package/build/module/control-plane-routing.js.map +1 -0
- package/build/module/embed-lifecycle.d.ts +140 -0
- package/build/module/embed-lifecycle.js +90 -0
- package/build/module/embed-lifecycle.js.map +1 -0
- package/build/module/error.d.ts +32 -17
- package/build/module/error.js +59 -31
- package/build/module/error.js.map +1 -1
- package/build/module/generated/routing.d.ts +11 -0
- package/build/module/generated/routing.js +289 -0
- package/build/module/generated/routing.js.map +1 -0
- package/build/module/generated/v1.d.ts +4 -75185
- package/build/module/generated/v1.js.map +4 -1
- package/build/module/index.d.ts +7 -0
- package/build/module/index.js +7 -0
- package/build/module/index.js.map +1 -1
- package/build/module/is-test-team.d.ts +18 -0
- package/build/module/is-test-team.js +22 -0
- package/build/module/is-test-team.js.map +1 -0
- package/build/module/is-test-user.d.ts +4 -0
- package/build/module/is-test-user.js +27 -0
- package/build/module/is-test-user.js.map +1 -0
- package/build/module/is-vrp-member.d.ts +4 -0
- package/build/module/is-vrp-member.js +29 -0
- package/build/module/is-vrp-member.js.map +1 -0
- package/build/module/retarget-request.d.ts +7 -0
- package/build/module/retarget-request.js +18 -0
- package/build/module/retarget-request.js.map +1 -0
- package/build/module/routing.d.ts +7 -0
- package/build/module/routing.js +21 -0
- package/build/module/routing.js.map +1 -1
- package/build/module/types.d.ts +2 -0
- package/build/module/types.js.map +1 -1
- package/build/module/vrt-mcp.d.ts +216 -0
- package/build/module/vrt-mcp.js +165 -0
- package/build/module/vrt-mcp.js.map +1 -0
- package/package.json +10 -9
- package/src/cache.ts +11 -8
- package/src/client.ts +20 -17
- package/src/control-plane-routing.ts +46 -0
- package/src/embed-lifecycle.ts +96 -0
- package/src/error.ts +105 -56
- package/src/generated/routing.ts +292 -0
- package/src/generated/v1.ts +4 -75186
- package/src/index.ts +7 -0
- package/src/is-test-team.ts +50 -0
- package/src/is-test-user.ts +39 -0
- package/src/is-vrp-member.ts +38 -0
- package/src/retarget-request.ts +17 -0
- package/src/routing.ts +30 -0
- package/src/types.ts +8 -0
- package/src/vrt-mcp.ts +192 -0
- package/build/main/generated/openapi-fetch.d.ts +0 -224
- package/build/main/generated/openapi-fetch.js +0 -14
- package/build/main/generated/openapi-fetch.js.map +0 -1
- package/build/module/generated/openapi-fetch.d.ts +0 -224
- package/build/module/generated/openapi-fetch.js +0 -2
- package/build/module/generated/openapi-fetch.js.map +0 -1
- package/src/generated/openapi-fetch.ts +0 -433
package/src/index.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { ApiClient } from './types';
|
|
2
2
|
|
|
3
3
|
export * from './client';
|
|
4
|
+
export * from './control-plane-routing';
|
|
5
|
+
export * from './embed-lifecycle';
|
|
4
6
|
export * from './error';
|
|
5
7
|
export type * from './generated/v1';
|
|
8
|
+
export * from './is-test-team';
|
|
9
|
+
export * from './is-test-user';
|
|
10
|
+
export * from './is-vrp-member';
|
|
11
|
+
export * from './retarget-request';
|
|
6
12
|
export * from './routing';
|
|
7
13
|
export * from './sec';
|
|
8
14
|
export * from './types';
|
|
15
|
+
export * from './vrt-mcp';
|
|
9
16
|
|
|
10
17
|
export type VRPlatformApi = ApiClient;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const DEMO_TEST_PARTNER_TENANT_ID = '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa';
|
|
2
|
+
|
|
3
|
+
export const TEST_TEAM_IDS = [
|
|
4
|
+
DEMO_TEST_PARTNER_TENANT_ID,
|
|
5
|
+
'fa4d1a20-2f47-4021-9c72-c5a809be9c48', // Testing tenant
|
|
6
|
+
'c4fd21b4-8447-43a2-bdcb-f06a85a935ad', // VRP Automated Testing
|
|
7
|
+
'8f21060e-afe6-410a-b2f4-00a3caa20786', // test_company_xxxx
|
|
8
|
+
] as const;
|
|
9
|
+
|
|
10
|
+
export function isTestTeam(
|
|
11
|
+
team:
|
|
12
|
+
| {
|
|
13
|
+
id: string;
|
|
14
|
+
partnerId?: string | null;
|
|
15
|
+
billingPartnerId?: string | null;
|
|
16
|
+
}
|
|
17
|
+
| undefined
|
|
18
|
+
): boolean {
|
|
19
|
+
if (!team) return false;
|
|
20
|
+
return (
|
|
21
|
+
new Set<string>(TEST_TEAM_IDS).has(team.id) ||
|
|
22
|
+
[team.partnerId, team.billingPartnerId].includes(
|
|
23
|
+
DEMO_TEST_PARTNER_TENANT_ID
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type TestTeamReference =
|
|
29
|
+
| {
|
|
30
|
+
id: string;
|
|
31
|
+
partnerId?: string | null;
|
|
32
|
+
billingPartnerId?: string | null;
|
|
33
|
+
}
|
|
34
|
+
| null
|
|
35
|
+
| undefined;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A team is a test team when it, its accounting partner or its billing
|
|
39
|
+
* partner is one by `isTestTeam`. Partners are checked without recursion.
|
|
40
|
+
* Hyperline bills these teams in Sandbox.
|
|
41
|
+
*/
|
|
42
|
+
export function isTestTeamWithPartners(
|
|
43
|
+
team: TestTeamReference,
|
|
44
|
+
partner: TestTeamReference,
|
|
45
|
+
billingPartner: TestTeamReference
|
|
46
|
+
): boolean {
|
|
47
|
+
return [team, partner, billingPartner].some((reference) =>
|
|
48
|
+
isTestTeam(reference ?? undefined)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const E2E_TEST_USER_EMAILS = [
|
|
2
|
+
'e2e-invite-owner@finalytic.io',
|
|
3
|
+
'e2e-invite-owner@vrp.rocks',
|
|
4
|
+
'e2e-invite-member@finalytic.io',
|
|
5
|
+
'e2e-invite-member@vrp.rocks',
|
|
6
|
+
'e2e-sign-up-legacy@vrp.rocks',
|
|
7
|
+
'e2e-sign-up-partner@vrp.rocks',
|
|
8
|
+
'e2e-sign-up@finalytic.io',
|
|
9
|
+
'e2e-sign-up@vrp.rocks',
|
|
10
|
+
'lars+e2e@vrplatform.app',
|
|
11
|
+
'lars+e2e-gl@vrplatform.app',
|
|
12
|
+
'lars+checkly@finalytic.co',
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
const E2E_TEST_USERS: Partial<
|
|
16
|
+
Record<(typeof E2E_TEST_USER_EMAILS)[number], string>
|
|
17
|
+
> = {
|
|
18
|
+
'e2e-invite-member@finalytic.io': '113d73d8-ee21-46b7-a12a-a74f632401ca',
|
|
19
|
+
'e2e-invite-member@vrp.rocks': '113d73d8-ee21-46b7-a12a-a74f632401ca',
|
|
20
|
+
'e2e-invite-owner@finalytic.io': '917b7c4e-cb03-491c-9e94-d33a5bdeca05',
|
|
21
|
+
'e2e-invite-owner@vrp.rocks': '917b7c4e-cb03-491c-9e94-d33a5bdeca05',
|
|
22
|
+
'e2e-sign-up-partner@vrp.rocks': '5c8e5572-74d0-4ae6-af73-bca8db9a27e9',
|
|
23
|
+
'e2e-sign-up@vrp.rocks': '3c8e5572-74d0-4ae6-af73-bca8db9a27e9',
|
|
24
|
+
'e2e-sign-up@finalytic.io': 'ec8e5572-74d0-4ae6-af73-bca8db9a27e9',
|
|
25
|
+
'e2e-sign-up-legacy@vrp.rocks': 'ec8e5572-74d0-4ae6-af73-bca8db9a27e9',
|
|
26
|
+
'lars+checkly@finalytic.co': '9e7dfc88-503c-4222-9905-9116169d2203',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const isTestUser = ({
|
|
30
|
+
userEmail,
|
|
31
|
+
userId,
|
|
32
|
+
}: {
|
|
33
|
+
userEmail?: string | null;
|
|
34
|
+
userId?: string | null;
|
|
35
|
+
}) =>
|
|
36
|
+
Boolean(
|
|
37
|
+
(userId && Object.values(E2E_TEST_USERS).includes(userId)) ||
|
|
38
|
+
(userEmail && Object.keys(E2E_TEST_USERS).includes(userEmail))
|
|
39
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const VRP_EMAIL_DOMAINS = ['@finalytic.co', '@vrplatform.app'];
|
|
2
|
+
const VRP_EMAILS = [
|
|
3
|
+
'radek+vrp@setup.inc',
|
|
4
|
+
'philipp@philipp-achenbach.de',
|
|
5
|
+
'l.behrenberg@gmail.com',
|
|
6
|
+
'l.behrenberg+secondary@gmail.com',
|
|
7
|
+
'adam@ximplifi.com',
|
|
8
|
+
];
|
|
9
|
+
const VRP_USER_IDS = [
|
|
10
|
+
'3267f329-26d9-471d-86c1-d4c2efab2951',
|
|
11
|
+
'735e1803-13f5-4a90-a02f-2498b3eefa03',
|
|
12
|
+
'1a2bd1ea-88b1-4217-935f-2a8d97c422f9',
|
|
13
|
+
'4b221539-d6cf-4d18-a015-1f3a99fc3c2d',
|
|
14
|
+
'5e9bdcc1-71ae-4e59-87a1-affbfc3ce603',
|
|
15
|
+
'2a40c6c5-c9a2-4d98-a70f-3c6f75bff3e2',
|
|
16
|
+
'31a87570-3917-4e4c-b237-af605ab0094b',
|
|
17
|
+
'ec78e603-705c-4f1c-9b85-4dc5733c5b85',
|
|
18
|
+
'16b5bd68-8261-4192-a28a-13817b31fede',
|
|
19
|
+
'2e22dcba-73f0-4699-bc48-088209804fe2',
|
|
20
|
+
'840da880-9a3d-43e5-9e2e-d4c74429ed17',
|
|
21
|
+
'9ecc0316-e7dc-4c73-960d-01c2763fb8da',
|
|
22
|
+
'9f6008c7-4df5-4aec-997f-07ecd44a2f79',
|
|
23
|
+
'27dc0d2a-d11a-4fe1-a500-6e0e6350ad04',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const isVrpMember = ({
|
|
27
|
+
email,
|
|
28
|
+
userId,
|
|
29
|
+
}: {
|
|
30
|
+
email?: string | null;
|
|
31
|
+
userId?: string | null;
|
|
32
|
+
}) =>
|
|
33
|
+
Boolean(
|
|
34
|
+
(email &&
|
|
35
|
+
(VRP_EMAILS.includes(email) ||
|
|
36
|
+
VRP_EMAIL_DOMAINS.some((domain) => email.endsWith(domain)))) ||
|
|
37
|
+
(userId && VRP_USER_IDS.includes(userId))
|
|
38
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy of `request` for another URL with its body buffered. `new Request(url,
|
|
3
|
+
* request)` hands the source body over as a ReadableStream, which WebKit
|
|
4
|
+
* (every iOS browser) rejects with "ReadableStream uploading is not supported".
|
|
5
|
+
* The source body is consumed, so pass a clone when the original is still needed.
|
|
6
|
+
*/
|
|
7
|
+
export async function retargetRequest(request: Request, url: string | URL) {
|
|
8
|
+
return new Request(url.toString(), {
|
|
9
|
+
method: request.method,
|
|
10
|
+
headers: request.headers,
|
|
11
|
+
body: request.body ? await request.arrayBuffer() : null,
|
|
12
|
+
signal: request.signal,
|
|
13
|
+
credentials: request.credentials,
|
|
14
|
+
cache: request.cache,
|
|
15
|
+
redirect: request.redirect,
|
|
16
|
+
});
|
|
17
|
+
}
|
package/src/routing.ts
CHANGED
|
@@ -57,3 +57,33 @@ export async function resolveTenantRouting({
|
|
|
57
57
|
apiBaseUrl: new URL(response.apiBaseUrl).toString().replace(/\/$/, ''),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Resolve a tenant's home region and return an API client configured for that
|
|
63
|
+
* regional API. The resolved tenant id is applied to every regional request.
|
|
64
|
+
*/
|
|
65
|
+
export async function useResolvedApiClient({
|
|
66
|
+
connectionId,
|
|
67
|
+
slug,
|
|
68
|
+
tenantId,
|
|
69
|
+
auth,
|
|
70
|
+
...apiClientOptions
|
|
71
|
+
}: Parameters<typeof resolveTenantRouting>[0]) {
|
|
72
|
+
const routing = await resolveTenantRouting({
|
|
73
|
+
...apiClientOptions,
|
|
74
|
+
connectionId,
|
|
75
|
+
slug,
|
|
76
|
+
tenantId,
|
|
77
|
+
auth,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
return useApiClient({
|
|
81
|
+
...apiClientOptions,
|
|
82
|
+
baseUrl: routing.apiBaseUrl,
|
|
83
|
+
auth: () =>
|
|
84
|
+
({
|
|
85
|
+
...(typeof auth === 'function' ? auth() : (auth ?? {})),
|
|
86
|
+
tenantId: routing.id,
|
|
87
|
+
}) satisfies ApiClientAuth,
|
|
88
|
+
});
|
|
89
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,14 @@ export type ResponseData<T extends ResponseCombinations> =
|
|
|
39
39
|
: never
|
|
40
40
|
: never;
|
|
41
41
|
|
|
42
|
+
export type ApiScope = NonNullable<
|
|
43
|
+
ResponseData<'get:/me'>['membership']
|
|
44
|
+
>['permissions'][number];
|
|
45
|
+
|
|
46
|
+
export type UiPermissionBundleName = NonNullable<
|
|
47
|
+
ResponseData<'get:/me'>['membership']
|
|
48
|
+
>['permissionBundles'][number];
|
|
49
|
+
|
|
42
50
|
type RequestBodyCombinations = {
|
|
43
51
|
[Path in keyof paths]: {
|
|
44
52
|
[Method in keyof paths[Path]]: paths[Path][Method] extends never
|
package/src/vrt-mcp.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
|
|
3
|
+
const vrtLookupLimitSchema = z.number().int().min(1).max(25).default(10);
|
|
4
|
+
const vrtLookupPageSchema = z.number().int().min(1).default(1);
|
|
5
|
+
const vrtDateRangeSchema = z.string().trim().min(1).optional();
|
|
6
|
+
const vrtCsvSchema = z.string().trim().min(1).optional();
|
|
7
|
+
const vrtTeamIdSchema = z.string().uuid().optional();
|
|
8
|
+
|
|
9
|
+
export const vrtPaginatedLookupPayloadSchema = z.object({
|
|
10
|
+
data: z.array(z.unknown()),
|
|
11
|
+
pagination: z.object({
|
|
12
|
+
limit: z.number().int(),
|
|
13
|
+
nextPage: z.number().int().optional(),
|
|
14
|
+
page: z.number().int(),
|
|
15
|
+
total: z.number().int(),
|
|
16
|
+
totalPage: z.number().int(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const vrtPaginatedLookupOutputSchema =
|
|
21
|
+
vrtPaginatedLookupPayloadSchema.extend({
|
|
22
|
+
schemaVersion: z.literal(1),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const vrtListingsLookupSchema = z.object({
|
|
26
|
+
activeOwnership: z.boolean().optional(),
|
|
27
|
+
includeChildren: z.boolean().optional(),
|
|
28
|
+
issue: z
|
|
29
|
+
.enum([
|
|
30
|
+
'all',
|
|
31
|
+
'any',
|
|
32
|
+
'missingOwnershipOrDeactivation',
|
|
33
|
+
'missingFeesAndCommission',
|
|
34
|
+
'missingOpeningBalance',
|
|
35
|
+
])
|
|
36
|
+
.optional(),
|
|
37
|
+
limit: vrtLookupLimitSchema,
|
|
38
|
+
page: vrtLookupPageSchema,
|
|
39
|
+
parent: z.union([z.string().uuid(), z.literal('null')]).optional(),
|
|
40
|
+
search: z.string().trim().min(1).optional(),
|
|
41
|
+
status: z.enum(['active', 'inactive']).optional(),
|
|
42
|
+
teamId: vrtTeamIdSchema,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const vrtReservationsLookupSchema = z.object({
|
|
46
|
+
bookingChannel: z.string().trim().min(1).optional(),
|
|
47
|
+
date: vrtDateRangeSchema,
|
|
48
|
+
dateField: z
|
|
49
|
+
.enum([
|
|
50
|
+
'bookedAt',
|
|
51
|
+
'cancelledAt',
|
|
52
|
+
'checkIn',
|
|
53
|
+
'checkOut',
|
|
54
|
+
'payment',
|
|
55
|
+
'intersection',
|
|
56
|
+
])
|
|
57
|
+
.optional(),
|
|
58
|
+
generalLedgerStatus: z.enum(['active', 'inactive']).optional(),
|
|
59
|
+
ids: vrtCsvSchema,
|
|
60
|
+
includeLines: z.boolean().optional(),
|
|
61
|
+
limit: vrtLookupLimitSchema,
|
|
62
|
+
listingId: z.string().trim().min(1).optional(),
|
|
63
|
+
page: vrtLookupPageSchema,
|
|
64
|
+
paidStatus: z
|
|
65
|
+
.enum([
|
|
66
|
+
'unpaid',
|
|
67
|
+
'underpaid',
|
|
68
|
+
'overpaid',
|
|
69
|
+
'paid',
|
|
70
|
+
'!unpaid',
|
|
71
|
+
'!underpaid',
|
|
72
|
+
'!overpaid',
|
|
73
|
+
'!paid',
|
|
74
|
+
])
|
|
75
|
+
.optional(),
|
|
76
|
+
search: z.string().trim().min(1).optional(),
|
|
77
|
+
shortRefs: vrtCsvSchema,
|
|
78
|
+
status: z.enum(['booked', 'canceled', 'inactive']).optional(),
|
|
79
|
+
teamId: vrtTeamIdSchema,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const vrtTransactionsLookupSchema = z.object({
|
|
83
|
+
accountId: z.string().trim().min(1).optional(),
|
|
84
|
+
amount: z.string().trim().min(1).optional(),
|
|
85
|
+
contactId: z.string().uuid().optional(),
|
|
86
|
+
dateRange: vrtDateRangeSchema,
|
|
87
|
+
ids: vrtCsvSchema,
|
|
88
|
+
includeLines: z.boolean().optional(),
|
|
89
|
+
limit: vrtLookupLimitSchema,
|
|
90
|
+
listingIds: vrtCsvSchema,
|
|
91
|
+
page: vrtLookupPageSchema,
|
|
92
|
+
paidAtRange: vrtDateRangeSchema,
|
|
93
|
+
paidStatus: z.enum(['unpaid', 'underpaid', 'overpaid', 'paid']).optional(),
|
|
94
|
+
reconciled: z.union([z.boolean(), z.literal('candidate')]).optional(),
|
|
95
|
+
search: z.string().trim().min(1).optional(),
|
|
96
|
+
shortRefs: vrtCsvSchema,
|
|
97
|
+
status: z.enum(['active', 'inactive']).optional(),
|
|
98
|
+
teamId: vrtTeamIdSchema,
|
|
99
|
+
type: z.enum(['deposit', 'expense', 'transfer', 'payout']).optional(),
|
|
100
|
+
uniqueRefs: vrtCsvSchema,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const vrtAccountsLookupSchema = z.object({
|
|
104
|
+
bankingCategory: z.enum(['trust', 'operating', 'external']).optional(),
|
|
105
|
+
classification: z
|
|
106
|
+
.enum([
|
|
107
|
+
'asset',
|
|
108
|
+
'liability',
|
|
109
|
+
'equity',
|
|
110
|
+
'revenue',
|
|
111
|
+
'costOfRevenue',
|
|
112
|
+
'expense',
|
|
113
|
+
])
|
|
114
|
+
.optional(),
|
|
115
|
+
limit: vrtLookupLimitSchema,
|
|
116
|
+
page: vrtLookupPageSchema,
|
|
117
|
+
reconciled: z.boolean().optional(),
|
|
118
|
+
search: z.string().trim().min(1).optional(),
|
|
119
|
+
status: z.enum(['active', 'inactive']).optional(),
|
|
120
|
+
teamId: vrtTeamIdSchema,
|
|
121
|
+
type: z.enum(['ledger', 'bank', 'recurringFee', 'nonPosting']).optional(),
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
export const vrtStatementsLookupSchema = z.object({
|
|
125
|
+
dateRange: vrtDateRangeSchema,
|
|
126
|
+
isDateRangeEndInclusive: z.boolean().optional(),
|
|
127
|
+
limit: vrtLookupLimitSchema,
|
|
128
|
+
listingIds: vrtCsvSchema,
|
|
129
|
+
month: z
|
|
130
|
+
.string()
|
|
131
|
+
.regex(/^\d{4}-\d{2}$/)
|
|
132
|
+
.optional(),
|
|
133
|
+
ownerIds: vrtCsvSchema,
|
|
134
|
+
page: vrtLookupPageSchema,
|
|
135
|
+
periodIds: vrtCsvSchema,
|
|
136
|
+
recurringFeeIds: vrtCsvSchema,
|
|
137
|
+
search: z.string().trim().min(1).optional(),
|
|
138
|
+
statementIds: vrtCsvSchema,
|
|
139
|
+
status: z.enum(['draft', 'inReview', 'published', 'all']).optional(),
|
|
140
|
+
teamId: vrtTeamIdSchema,
|
|
141
|
+
year: z.number().int().min(1900).max(2100).optional(),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export const vrtJournalEntriesLookupSchema = z.object({
|
|
145
|
+
accountAssignmentTypes: vrtCsvSchema,
|
|
146
|
+
accountIds: vrtCsvSchema,
|
|
147
|
+
accountType: z
|
|
148
|
+
.enum(['ledger', 'bank', 'recurringFee', 'nonPosting'])
|
|
149
|
+
.optional(),
|
|
150
|
+
amount: z.string().trim().min(1).optional(),
|
|
151
|
+
classifications: vrtCsvSchema,
|
|
152
|
+
date: vrtDateRangeSchema,
|
|
153
|
+
endAt: z.string().trim().min(1).optional(),
|
|
154
|
+
entityTypes: vrtCsvSchema,
|
|
155
|
+
excludeTriggerTypes: vrtCsvSchema,
|
|
156
|
+
excludeTypes: vrtCsvSchema,
|
|
157
|
+
ids: vrtCsvSchema,
|
|
158
|
+
includeDetails: z.boolean().optional(),
|
|
159
|
+
ledger: z.enum(['historical', 'trust', 'operating']).optional(),
|
|
160
|
+
limit: vrtLookupLimitSchema,
|
|
161
|
+
listingIds: vrtCsvSchema,
|
|
162
|
+
ownerStatementIds: vrtCsvSchema,
|
|
163
|
+
page: vrtLookupPageSchema,
|
|
164
|
+
party: z.enum(['owners', 'manager']).optional(),
|
|
165
|
+
published: z.boolean().optional(),
|
|
166
|
+
reservationIds: vrtCsvSchema,
|
|
167
|
+
search: z.string().trim().min(1).optional(),
|
|
168
|
+
startAt: z.string().trim().min(1).optional(),
|
|
169
|
+
status: z.enum(['active', 'inactive']).optional(),
|
|
170
|
+
teamId: vrtTeamIdSchema,
|
|
171
|
+
transactionIds: vrtCsvSchema,
|
|
172
|
+
triggerTypes: vrtCsvSchema,
|
|
173
|
+
types: vrtCsvSchema,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
export type VrtListingsLookupInput = z.infer<typeof vrtListingsLookupSchema>;
|
|
177
|
+
export type VrtReservationsLookupInput = z.infer<
|
|
178
|
+
typeof vrtReservationsLookupSchema
|
|
179
|
+
>;
|
|
180
|
+
export type VrtTransactionsLookupInput = z.infer<
|
|
181
|
+
typeof vrtTransactionsLookupSchema
|
|
182
|
+
>;
|
|
183
|
+
export type VrtAccountsLookupInput = z.infer<typeof vrtAccountsLookupSchema>;
|
|
184
|
+
export type VrtStatementsLookupInput = z.infer<
|
|
185
|
+
typeof vrtStatementsLookupSchema
|
|
186
|
+
>;
|
|
187
|
+
export type VrtJournalEntriesLookupInput = z.infer<
|
|
188
|
+
typeof vrtJournalEntriesLookupSchema
|
|
189
|
+
>;
|
|
190
|
+
export type VrtPaginatedLookupOutput = z.infer<
|
|
191
|
+
typeof vrtPaginatedLookupOutputSchema
|
|
192
|
+
>;
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import type { ErrorResponse, FilterKeys, HttpMethod, IsOperationRequestBodyOptional, MediaType, OperationRequestBodyContent, PathsWithMethod, RequiredKeysOf, ResponseObjectMap, SuccessResponse } from 'openapi-typescript-helpers';
|
|
2
|
-
/** Options for each client instance */
|
|
3
|
-
interface ClientOptions extends Omit<RequestInit, 'headers'> {
|
|
4
|
-
/** set the common root URL for all API requests */
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
/** custom fetch (defaults to globalThis.fetch) */
|
|
7
|
-
fetch?: (input: Request) => Promise<Response>;
|
|
8
|
-
/** custom Request (defaults to globalThis.Request) */
|
|
9
|
-
Request?: typeof Request;
|
|
10
|
-
/** global querySerializer */
|
|
11
|
-
querySerializer?: QuerySerializer<unknown> | QuerySerializerOptions;
|
|
12
|
-
/** global bodySerializer */
|
|
13
|
-
bodySerializer?: BodySerializer<unknown>;
|
|
14
|
-
headers?: HeadersOptions;
|
|
15
|
-
/** RequestInit extension object to pass as 2nd argument to fetch when supported (defaults to undefined) */
|
|
16
|
-
requestInitExt?: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
type HeadersOptions = Required<RequestInit>['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined>;
|
|
19
|
-
type QuerySerializer<T> = (query: T extends {
|
|
20
|
-
parameters: any;
|
|
21
|
-
} ? NonNullable<T['parameters']['query']> : Record<string, unknown>) => string;
|
|
22
|
-
/** @see https://swagger.io/docs/specification/serialization/#query */
|
|
23
|
-
type QuerySerializerOptions = {
|
|
24
|
-
/** Set serialization for arrays. @see https://swagger.io/docs/specification/serialization/#query */
|
|
25
|
-
array?: {
|
|
26
|
-
/** default: "form" */
|
|
27
|
-
style: 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
28
|
-
/** default: true */
|
|
29
|
-
explode: boolean;
|
|
30
|
-
};
|
|
31
|
-
/** Set serialization for objects. @see https://swagger.io/docs/specification/serialization/#query */
|
|
32
|
-
object?: {
|
|
33
|
-
/** default: "deepObject" */
|
|
34
|
-
style: 'form' | 'deepObject';
|
|
35
|
-
/** default: true */
|
|
36
|
-
explode: boolean;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* The `allowReserved` keyword specifies whether the reserved characters
|
|
40
|
-
* `:/?#[]@!$&'()*+,;=` in parameter values are allowed to be sent as they
|
|
41
|
-
* are, or should be percent-encoded. By default, allowReserved is `false`,
|
|
42
|
-
* and reserved characters are percent-encoded.
|
|
43
|
-
* @see https://swagger.io/docs/specification/serialization/#query
|
|
44
|
-
*/
|
|
45
|
-
allowReserved?: boolean;
|
|
46
|
-
};
|
|
47
|
-
type BodySerializer<T> = (body: OperationRequestBodyContent<T>) => any;
|
|
48
|
-
type BodyType<T = unknown> = {
|
|
49
|
-
json: T;
|
|
50
|
-
text: Awaited<ReturnType<Response['text']>>;
|
|
51
|
-
blob: Awaited<ReturnType<Response['blob']>>;
|
|
52
|
-
arrayBuffer: Awaited<ReturnType<Response['arrayBuffer']>>;
|
|
53
|
-
stream: Response['body'];
|
|
54
|
-
};
|
|
55
|
-
type ParseAs = keyof BodyType;
|
|
56
|
-
type ParseAsResponse<T, Options> = Options extends {
|
|
57
|
-
parseAs: ParseAs;
|
|
58
|
-
} ? BodyType<T>[Options['parseAs']] : T;
|
|
59
|
-
interface DefaultParamsOption {
|
|
60
|
-
params?: {
|
|
61
|
-
query?: Record<string, unknown>;
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
type ParamsOption<T> = T extends {
|
|
65
|
-
parameters: any;
|
|
66
|
-
} ? RequiredKeysOf<T['parameters']> extends never ? {
|
|
67
|
-
params?: T['parameters'];
|
|
68
|
-
} : {
|
|
69
|
-
params: T['parameters'];
|
|
70
|
-
} : DefaultParamsOption;
|
|
71
|
-
type RequestBodyOption<T> = OperationRequestBodyContent<T> extends never ? {
|
|
72
|
-
body?: never;
|
|
73
|
-
} : IsOperationRequestBodyOptional<T> extends true ? {
|
|
74
|
-
body?: OperationRequestBodyContent<T>;
|
|
75
|
-
} : {
|
|
76
|
-
body: OperationRequestBodyContent<T>;
|
|
77
|
-
};
|
|
78
|
-
type FetchOptions<T> = RequestOptions<T> & Omit<RequestInit, 'body' | 'headers'>;
|
|
79
|
-
type FetchResponse<T extends Record<string | number, any>, Options, Media extends MediaType> = {
|
|
80
|
-
data: ParseAsResponse<SuccessResponse<ResponseObjectMap<T>, Media>, Options>;
|
|
81
|
-
error?: never;
|
|
82
|
-
response: Response;
|
|
83
|
-
} | {
|
|
84
|
-
data?: never;
|
|
85
|
-
error: ErrorResponse<ResponseObjectMap<T>, Media>;
|
|
86
|
-
response: Response;
|
|
87
|
-
};
|
|
88
|
-
type RequestOptions<T> = ParamsOption<T> & RequestBodyOption<T> & {
|
|
89
|
-
baseUrl?: string;
|
|
90
|
-
querySerializer?: QuerySerializer<T> | QuerySerializerOptions;
|
|
91
|
-
bodySerializer?: BodySerializer<T>;
|
|
92
|
-
parseAs?: ParseAs;
|
|
93
|
-
fetch?: ClientOptions['fetch'];
|
|
94
|
-
headers?: HeadersOptions;
|
|
95
|
-
};
|
|
96
|
-
type MergedOptions<T = unknown> = {
|
|
97
|
-
baseUrl: string;
|
|
98
|
-
parseAs: ParseAs;
|
|
99
|
-
querySerializer: QuerySerializer<T>;
|
|
100
|
-
bodySerializer: BodySerializer<T>;
|
|
101
|
-
fetch: typeof globalThis.fetch;
|
|
102
|
-
};
|
|
103
|
-
interface MiddlewareCallbackParams {
|
|
104
|
-
/** Current Request object */
|
|
105
|
-
request: Request;
|
|
106
|
-
/** The original OpenAPI schema path (including curly braces) */
|
|
107
|
-
readonly schemaPath: string;
|
|
108
|
-
/** OpenAPI parameters as provided from openapi-fetch */
|
|
109
|
-
readonly params: {
|
|
110
|
-
query?: Record<string, unknown>;
|
|
111
|
-
header?: Record<string, unknown>;
|
|
112
|
-
path?: Record<string, unknown>;
|
|
113
|
-
cookie?: Record<string, unknown>;
|
|
114
|
-
};
|
|
115
|
-
/** Unique ID for this request */
|
|
116
|
-
readonly id: string;
|
|
117
|
-
/** createClient options (read-only) */
|
|
118
|
-
readonly options: MergedOptions;
|
|
119
|
-
}
|
|
120
|
-
type MiddlewareOnRequest = (options: MiddlewareCallbackParams) => void | Request | Response | undefined | Promise<Request | Response | undefined | void>;
|
|
121
|
-
type MiddlewareOnResponse = (options: MiddlewareCallbackParams & {
|
|
122
|
-
response: Response;
|
|
123
|
-
}) => void | Response | undefined | Promise<Response | undefined | void>;
|
|
124
|
-
type MiddlewareOnError = (options: MiddlewareCallbackParams & {
|
|
125
|
-
error: unknown;
|
|
126
|
-
}) => void | Response | Error | Promise<void | Response | Error>;
|
|
127
|
-
type Middleware = {
|
|
128
|
-
onRequest: MiddlewareOnRequest;
|
|
129
|
-
onResponse?: MiddlewareOnResponse;
|
|
130
|
-
onError?: MiddlewareOnError;
|
|
131
|
-
} | {
|
|
132
|
-
onRequest?: MiddlewareOnRequest;
|
|
133
|
-
onResponse: MiddlewareOnResponse;
|
|
134
|
-
onError?: MiddlewareOnError;
|
|
135
|
-
} | {
|
|
136
|
-
onRequest?: MiddlewareOnRequest;
|
|
137
|
-
onResponse?: MiddlewareOnResponse;
|
|
138
|
-
onError: MiddlewareOnError;
|
|
139
|
-
};
|
|
140
|
-
/** This type helper makes the 2nd function param required if params/requestBody are required; otherwise, optional */
|
|
141
|
-
type MaybeOptionalInit<Params, Location extends keyof Params> = RequiredKeysOf<FetchOptions<FilterKeys<Params, Location>>> extends never ? FetchOptions<FilterKeys<Params, Location>> | undefined : FetchOptions<FilterKeys<Params, Location>>;
|
|
142
|
-
type InitParam<Init> = RequiredKeysOf<Init> extends never ? [(Init & {
|
|
143
|
-
[key: string]: unknown;
|
|
144
|
-
})?] : [Init & {
|
|
145
|
-
[key: string]: unknown;
|
|
146
|
-
}];
|
|
147
|
-
type ClientMethod<Paths extends Record<string, Record<HttpMethod, {}>>, Method extends HttpMethod, Media extends MediaType> = <Path extends PathsWithMethod<Paths, Method>, Init extends MaybeOptionalInit<Paths[Path], Method>>(url: Path, ...init: InitParam<Init>) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
148
|
-
type ClientRequestMethod<Paths extends Record<string, Record<HttpMethod, {}>>, Media extends MediaType> = <Method extends HttpMethod, Path extends PathsWithMethod<Paths, Method>, Init extends MaybeOptionalInit<Paths[Path], Method>>(method: Method, url: Path, ...init: InitParam<Init>) => Promise<FetchResponse<Paths[Path][Method], Init, Media>>;
|
|
149
|
-
type ClientForPath<PathInfo extends Record<string | number, any>, Media extends MediaType> = {
|
|
150
|
-
[Method in keyof PathInfo as Uppercase<string & Method>]: <Init extends MaybeOptionalInit<PathInfo, Method>>(...init: InitParam<Init>) => Promise<FetchResponse<PathInfo[Method], Init, Media>>;
|
|
151
|
-
};
|
|
152
|
-
interface Client<Paths extends {}, Media extends MediaType = MediaType> {
|
|
153
|
-
request: ClientRequestMethod<Paths, Media>;
|
|
154
|
-
/** Call a GET endpoint */
|
|
155
|
-
GET: ClientMethod<Paths, 'get', Media>;
|
|
156
|
-
/** Call a PUT endpoint */
|
|
157
|
-
PUT: ClientMethod<Paths, 'put', Media>;
|
|
158
|
-
/** Call a POST endpoint */
|
|
159
|
-
POST: ClientMethod<Paths, 'post', Media>;
|
|
160
|
-
/** Call a DELETE endpoint */
|
|
161
|
-
DELETE: ClientMethod<Paths, 'delete', Media>;
|
|
162
|
-
/** Call a OPTIONS endpoint */
|
|
163
|
-
OPTIONS: ClientMethod<Paths, 'options', Media>;
|
|
164
|
-
/** Call a HEAD endpoint */
|
|
165
|
-
HEAD: ClientMethod<Paths, 'head', Media>;
|
|
166
|
-
/** Call a PATCH endpoint */
|
|
167
|
-
PATCH: ClientMethod<Paths, 'patch', Media>;
|
|
168
|
-
/** Call a TRACE endpoint */
|
|
169
|
-
TRACE: ClientMethod<Paths, 'trace', Media>;
|
|
170
|
-
/** Register middleware */
|
|
171
|
-
use(...middleware: Middleware[]): void;
|
|
172
|
-
/** Unregister middleware */
|
|
173
|
-
eject(...middleware: Middleware[]): void;
|
|
174
|
-
}
|
|
175
|
-
type ClientPathsWithMethod<CreatedClient extends Client<any, any>, Method extends HttpMethod> = CreatedClient extends Client<infer Paths, infer _Media> ? PathsWithMethod<Paths, Method> : never;
|
|
176
|
-
type MethodResponse<CreatedClient extends Client<any, any>, Method extends HttpMethod, Path extends ClientPathsWithMethod<CreatedClient, Method>, Options = {}> = CreatedClient extends Client<infer Paths extends {
|
|
177
|
-
[key: string]: any;
|
|
178
|
-
}, infer Media extends MediaType> ? NonNullable<FetchResponse<Paths[Path][Method], Options, Media>['data']> : never;
|
|
179
|
-
type PathBasedClient<Paths extends Record<string | number, any>, Media extends MediaType = MediaType> = {
|
|
180
|
-
[Path in keyof Paths]: ClientForPath<Paths[Path], Media>;
|
|
181
|
-
};
|
|
182
|
-
declare function wrapAsPathBasedClient<Paths extends {}, Media extends MediaType = MediaType>(client: Client<Paths, Media>): PathBasedClient<Paths, Media>;
|
|
183
|
-
declare function createPathBasedClient<Paths extends {}, Media extends MediaType = MediaType>(clientOptions?: ClientOptions): PathBasedClient<Paths, Media>;
|
|
184
|
-
/** Serialize primitive params to string */
|
|
185
|
-
declare function serializePrimitiveParam(name: string, value: string, options?: {
|
|
186
|
-
allowReserved?: boolean;
|
|
187
|
-
}): string;
|
|
188
|
-
/** Serialize object param to string */
|
|
189
|
-
declare function serializeObjectParam(name: string, value: Record<string, unknown>, options: {
|
|
190
|
-
style: 'simple' | 'label' | 'matrix' | 'form' | 'deepObject';
|
|
191
|
-
explode: boolean;
|
|
192
|
-
allowReserved?: boolean;
|
|
193
|
-
}): string;
|
|
194
|
-
/** Serialize array param to string */
|
|
195
|
-
declare function serializeArrayParam(name: string, value: unknown[], options: {
|
|
196
|
-
style: 'simple' | 'label' | 'matrix' | 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
197
|
-
explode: boolean;
|
|
198
|
-
allowReserved?: boolean;
|
|
199
|
-
}): string;
|
|
200
|
-
/** Serialize query params to string */
|
|
201
|
-
declare function createQuerySerializer<T = unknown>(options?: QuerySerializerOptions): (queryParams: T) => string;
|
|
202
|
-
/**
|
|
203
|
-
* Handle different OpenAPI 3.x serialization styles
|
|
204
|
-
* @type {import("openapi-fetch").defaultPathSerializer}
|
|
205
|
-
* @see https://swagger.io/docs/specification/serialization/#path
|
|
206
|
-
*/
|
|
207
|
-
declare function defaultPathSerializer(pathname: string, pathParams: Record<string, unknown>): string;
|
|
208
|
-
/** Serialize body object to string */
|
|
209
|
-
declare function defaultBodySerializer<T>(body: T): string;
|
|
210
|
-
/** Construct URL string from baseUrl and handle path and query params */
|
|
211
|
-
declare function createFinalURL<O>(pathname: string, options: {
|
|
212
|
-
baseUrl: string;
|
|
213
|
-
params: {
|
|
214
|
-
query?: Record<string, unknown>;
|
|
215
|
-
path?: Record<string, unknown>;
|
|
216
|
-
};
|
|
217
|
-
querySerializer: QuerySerializer<O>;
|
|
218
|
-
}): string;
|
|
219
|
-
/** Merge headers a and b, with b taking priority */
|
|
220
|
-
declare function mergeHeaders(...allHeaders: (HeadersOptions | undefined)[]): Headers;
|
|
221
|
-
/** Remove trailing slash from url */
|
|
222
|
-
declare function removeTrailingSlash(url: string): string;
|
|
223
|
-
export { createFinalURL, createPathBasedClient, createQuerySerializer, defaultBodySerializer, defaultPathSerializer, mergeHeaders, removeTrailingSlash, serializeArrayParam, serializeObjectParam, serializePrimitiveParam, wrapAsPathBasedClient, };
|
|
224
|
-
export type { BodySerializer, Client, ClientForPath, ClientMethod, ClientOptions, ClientPathsWithMethod, ClientRequestMethod, DefaultParamsOption, FetchOptions, FetchResponse, HeadersOptions, MaybeOptionalInit, MergedOptions, MethodResponse, Middleware, MiddlewareCallbackParams, ParamsOption, ParseAs, ParseAsResponse, PathBasedClient, QuerySerializer, QuerySerializerOptions, RequestBodyOption, RequestOptions, };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFinalURL = createFinalURL;
|
|
4
|
-
exports.createPathBasedClient = createPathBasedClient;
|
|
5
|
-
exports.createQuerySerializer = createQuerySerializer;
|
|
6
|
-
exports.defaultBodySerializer = defaultBodySerializer;
|
|
7
|
-
exports.defaultPathSerializer = defaultPathSerializer;
|
|
8
|
-
exports.mergeHeaders = mergeHeaders;
|
|
9
|
-
exports.removeTrailingSlash = removeTrailingSlash;
|
|
10
|
-
exports.serializeArrayParam = serializeArrayParam;
|
|
11
|
-
exports.serializeObjectParam = serializeObjectParam;
|
|
12
|
-
exports.serializePrimitiveParam = serializePrimitiveParam;
|
|
13
|
-
exports.wrapAsPathBasedClient = wrapAsPathBasedClient;
|
|
14
|
-
//# sourceMappingURL=openapi-fetch.js.map
|