shoal-web-sdk 1.0.95 → 1.0.97
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/dist/sdk/billing/@tanstack/react-query.gen.d.ts +8 -1
- package/dist/sdk/billing/@tanstack/react-query.gen.js +20 -1
- package/dist/sdk/billing/sdk.gen.d.ts +8 -1
- package/dist/sdk/billing/sdk.gen.js +22 -0
- package/dist/sdk/billing/types.gen.d.ts +50 -2
- package/dist/sdk/billing/zod.gen.d.ts +28 -8
- package/dist/sdk/billing/zod.gen.js +13 -2
- package/dist/sdk/types.gen.d.ts +26 -2
- package/dist/sdk/zod.gen.d.ts +226 -83
- package/dist/sdk/zod.gen.js +31 -6
- package/dist/tanstack-codegen/generated/billing.d.ts +9 -1
- package/dist/tanstack-codegen/generated/billing.js +20 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutationOptions } from '@tanstack/react-query';
|
|
2
2
|
import { type Options } from '../sdk.gen';
|
|
3
|
-
import type { CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
3
|
+
import type { CreateSetupIntentData, CreateSetupIntentError, CreateSetupIntentResponse, CreateSubscriptionData, CreateSubscriptionError, DeletePaymentMethodData, DeletePaymentMethodError, DeletePaymentMethodResponse, GetCustomerData, GetInvoicesData, GetPlansData, M2mCreateCustomerData, M2mCreateCustomerError, M2mGetCustomerData, M2mUpdatePlanData, M2mUpdatePlanError, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodError, UpdateDefaultPaymentMethodResponse, UpdatePlanData, UpdatePlanError } from '../types.gen';
|
|
4
4
|
export type QueryKey<TOptions extends Options> = [
|
|
5
5
|
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
|
6
6
|
_id: string;
|
|
@@ -68,6 +68,13 @@ export declare const getPlansOptions: (options?: Options<GetPlansData>) => impor
|
|
|
68
68
|
* Returns a list of available pricing plans.
|
|
69
69
|
*/
|
|
70
70
|
export declare const updatePlanMutation: (options?: Partial<Options<UpdatePlanData>>) => UseMutationOptions<unknown, UpdatePlanError, Options<UpdatePlanData>>;
|
|
71
|
+
/**
|
|
72
|
+
* Starts a new subscription for a customer who no longer has one.
|
|
73
|
+
*
|
|
74
|
+
* Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export declare const createSubscriptionMutation: (options?: Partial<Options<CreateSubscriptionData>>) => UseMutationOptions<unknown, CreateSubscriptionError, Options<CreateSubscriptionData>>;
|
|
71
78
|
/**
|
|
72
79
|
* Creates a Stripe SetupIntent.
|
|
73
80
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
import { client } from '../client.gen';
|
|
4
|
-
import { createSetupIntent, deletePaymentMethod, getCustomer, getInvoices, getPlans, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
4
|
+
import { createSetupIntent, createSubscription, deletePaymentMethod, getCustomer, getInvoices, getPlans, m2mCreateCustomer, m2mGetCustomer, m2mUpdatePlan, updateDefaultPaymentMethod, updatePlan } from '../sdk.gen';
|
|
5
5
|
const createQueryKey = (id, options, infinite, tags) => {
|
|
6
6
|
const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
|
|
7
7
|
if (infinite) {
|
|
@@ -78,6 +78,25 @@ export const updatePlanMutation = (options) => {
|
|
|
78
78
|
};
|
|
79
79
|
return mutationOptions;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Starts a new subscription for a customer who no longer has one.
|
|
83
|
+
*
|
|
84
|
+
* Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
export const createSubscriptionMutation = (options) => {
|
|
88
|
+
const mutationOptions = {
|
|
89
|
+
mutationFn: async (fnOptions) => {
|
|
90
|
+
const { data } = await createSubscription({
|
|
91
|
+
...options,
|
|
92
|
+
...fnOptions,
|
|
93
|
+
throwOnError: true
|
|
94
|
+
});
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return mutationOptions;
|
|
99
|
+
};
|
|
81
100
|
/**
|
|
82
101
|
* Creates a Stripe SetupIntent.
|
|
83
102
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type { CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
2
|
+
import type { CreateSetupIntentData, CreateSetupIntentErrors, CreateSetupIntentResponses, CreateSubscriptionData, CreateSubscriptionErrors, CreateSubscriptionResponses, DeletePaymentMethodData, DeletePaymentMethodErrors, DeletePaymentMethodResponses, GetCustomerData, GetCustomerErrors, GetCustomerResponses, GetInvoicesData, GetInvoicesErrors, GetInvoicesResponses, GetPlansData, GetPlansErrors, GetPlansResponses, M2mCreateCustomerData, M2mCreateCustomerErrors, M2mCreateCustomerResponses, M2mGetCustomerData, M2mGetCustomerErrors, M2mGetCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanErrors, M2mUpdatePlanResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodErrors, UpdateDefaultPaymentMethodResponses, UpdatePlanData, UpdatePlanErrors, UpdatePlanResponses } from './types.gen';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -25,6 +25,13 @@ export declare const getPlans: <ThrowOnError extends boolean = false>(options?:
|
|
|
25
25
|
* Returns a list of available pricing plans.
|
|
26
26
|
*/
|
|
27
27
|
export declare const updatePlan: <ThrowOnError extends boolean = false>(options: Options<UpdatePlanData, ThrowOnError>) => import("./client").RequestResult<UpdatePlanResponses, UpdatePlanErrors, ThrowOnError, "fields">;
|
|
28
|
+
/**
|
|
29
|
+
* Starts a new subscription for a customer who no longer has one.
|
|
30
|
+
*
|
|
31
|
+
* Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export declare const createSubscription: <ThrowOnError extends boolean = false>(options: Options<CreateSubscriptionData, ThrowOnError>) => import("./client").RequestResult<CreateSubscriptionResponses, CreateSubscriptionErrors, ThrowOnError, "fields">;
|
|
28
35
|
/**
|
|
29
36
|
* Creates a Stripe SetupIntent.
|
|
30
37
|
*
|
|
@@ -49,6 +49,28 @@ export const updatePlan = (options) => {
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Starts a new subscription for a customer who no longer has one.
|
|
54
|
+
*
|
|
55
|
+
* Resubscribes an account whose subscription was cancelled — for example when a trial ended without a payment method. Reuses the existing Stripe customer, requires a saved payment method, and never grants a trial period.
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
export const createSubscription = (options) => {
|
|
59
|
+
return (options.client ?? client).post({
|
|
60
|
+
security: [
|
|
61
|
+
{
|
|
62
|
+
scheme: 'bearer',
|
|
63
|
+
type: 'http'
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
url: '/api/v1/subscription/{org}',
|
|
67
|
+
...options,
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
...options.headers
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
52
74
|
/**
|
|
53
75
|
* Creates a Stripe SetupIntent.
|
|
54
76
|
*
|
|
@@ -91,6 +91,10 @@ export type CreateCustomerRequest = {
|
|
|
91
91
|
plan: string;
|
|
92
92
|
billingInterval: BillingInterval;
|
|
93
93
|
};
|
|
94
|
+
export type CreateSubscriptionRequest = {
|
|
95
|
+
plan: string;
|
|
96
|
+
billingInterval: BillingInterval;
|
|
97
|
+
};
|
|
94
98
|
export type SetupIntentResponse = {
|
|
95
99
|
readonly clientSecret: string;
|
|
96
100
|
};
|
|
@@ -139,7 +143,7 @@ export type CustomerStatus = 'incomplete' | 'incomplete_expired' | 'trialing' |
|
|
|
139
143
|
export type CustomerResponse = {
|
|
140
144
|
id: string;
|
|
141
145
|
status: CustomerStatus;
|
|
142
|
-
currentPlan
|
|
146
|
+
currentPlan?: CustomerPlanResponse;
|
|
143
147
|
pendingPlan?: CustomerPlanResponse;
|
|
144
148
|
readonly currentPeriodEnd: number;
|
|
145
149
|
readonly scheduledChangeAt?: number;
|
|
@@ -200,7 +204,7 @@ export type CustomerPlanResponseWritable = {
|
|
|
200
204
|
export type CustomerResponseWritable = {
|
|
201
205
|
id: string;
|
|
202
206
|
status: CustomerStatus;
|
|
203
|
-
currentPlan
|
|
207
|
+
currentPlan?: CustomerPlanResponseWritable;
|
|
204
208
|
};
|
|
205
209
|
/**
|
|
206
210
|
* Stripe payment method.
|
|
@@ -299,6 +303,50 @@ export type UpdatePlanResponses = {
|
|
|
299
303
|
*/
|
|
300
304
|
202: unknown;
|
|
301
305
|
};
|
|
306
|
+
export type CreateSubscriptionData = {
|
|
307
|
+
body: CreateSubscriptionRequest;
|
|
308
|
+
path: {
|
|
309
|
+
/**
|
|
310
|
+
* Kinde organisation id.
|
|
311
|
+
*/
|
|
312
|
+
org: string;
|
|
313
|
+
};
|
|
314
|
+
query?: never;
|
|
315
|
+
url: '/api/v1/subscription/{org}';
|
|
316
|
+
};
|
|
317
|
+
export type CreateSubscriptionErrors = {
|
|
318
|
+
/**
|
|
319
|
+
* Invalid request body
|
|
320
|
+
*/
|
|
321
|
+
400: _Error;
|
|
322
|
+
/**
|
|
323
|
+
* Unauthorised user
|
|
324
|
+
*/
|
|
325
|
+
401: _Error;
|
|
326
|
+
/**
|
|
327
|
+
* Account not found
|
|
328
|
+
*/
|
|
329
|
+
404: _Error;
|
|
330
|
+
/**
|
|
331
|
+
* The account already has an in-force subscription
|
|
332
|
+
*/
|
|
333
|
+
409: _Error;
|
|
334
|
+
/**
|
|
335
|
+
* The subscription cannot be created
|
|
336
|
+
*/
|
|
337
|
+
422: _Error;
|
|
338
|
+
/**
|
|
339
|
+
* Internal error
|
|
340
|
+
*/
|
|
341
|
+
500: _Error;
|
|
342
|
+
};
|
|
343
|
+
export type CreateSubscriptionError = CreateSubscriptionErrors[keyof CreateSubscriptionErrors];
|
|
344
|
+
export type CreateSubscriptionResponses = {
|
|
345
|
+
/**
|
|
346
|
+
* The subscription was created
|
|
347
|
+
*/
|
|
348
|
+
201: unknown;
|
|
349
|
+
};
|
|
302
350
|
export type CreateSetupIntentData = {
|
|
303
351
|
body?: never;
|
|
304
352
|
path: {
|
|
@@ -422,6 +422,13 @@ export declare const zCreateCustomerRequest: z.ZodObject<{
|
|
|
422
422
|
annual: "annual";
|
|
423
423
|
}>;
|
|
424
424
|
}, z.core.$strip>;
|
|
425
|
+
export declare const zCreateSubscriptionRequest: z.ZodObject<{
|
|
426
|
+
plan: z.ZodString;
|
|
427
|
+
billingInterval: z.ZodEnum<{
|
|
428
|
+
monthly: "monthly";
|
|
429
|
+
annual: "annual";
|
|
430
|
+
}>;
|
|
431
|
+
}, z.core.$strip>;
|
|
425
432
|
export declare const zSetupIntentResponse: z.ZodObject<{
|
|
426
433
|
clientSecret: z.ZodReadonly<z.ZodString>;
|
|
427
434
|
}, z.core.$strip>;
|
|
@@ -581,7 +588,7 @@ export declare const zCustomerResponse: z.ZodObject<{
|
|
|
581
588
|
unpaid: "unpaid";
|
|
582
589
|
onboarding: "onboarding";
|
|
583
590
|
}>;
|
|
584
|
-
currentPlan: z.ZodObject<{
|
|
591
|
+
currentPlan: z.ZodOptional<z.ZodObject<{
|
|
585
592
|
key: z.ZodReadonly<z.ZodString>;
|
|
586
593
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
587
594
|
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
@@ -673,7 +680,7 @@ export declare const zCustomerResponse: z.ZodObject<{
|
|
|
673
680
|
}>;
|
|
674
681
|
}, z.core.$strip>>>]>>;
|
|
675
682
|
}, z.core.$strip>>;
|
|
676
|
-
}, z.core.$strip
|
|
683
|
+
}, z.core.$strip>>;
|
|
677
684
|
pendingPlan: z.ZodOptional<z.ZodObject<{
|
|
678
685
|
key: z.ZodReadonly<z.ZodString>;
|
|
679
686
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
@@ -922,12 +929,12 @@ export declare const zCustomerResponseWritable: z.ZodObject<{
|
|
|
922
929
|
unpaid: "unpaid";
|
|
923
930
|
onboarding: "onboarding";
|
|
924
931
|
}>;
|
|
925
|
-
currentPlan: z.ZodObject<{
|
|
932
|
+
currentPlan: z.ZodOptional<z.ZodObject<{
|
|
926
933
|
interval: z.ZodOptional<z.ZodEnum<{
|
|
927
934
|
monthly: "monthly";
|
|
928
935
|
annual: "annual";
|
|
929
936
|
}>>;
|
|
930
|
-
}, z.core.$strip
|
|
937
|
+
}, z.core.$strip>>;
|
|
931
938
|
}, z.core.$strip>;
|
|
932
939
|
/**
|
|
933
940
|
* Stripe payment method.
|
|
@@ -960,7 +967,7 @@ export declare const zGetCustomerResponse: z.ZodObject<{
|
|
|
960
967
|
unpaid: "unpaid";
|
|
961
968
|
onboarding: "onboarding";
|
|
962
969
|
}>;
|
|
963
|
-
currentPlan: z.ZodObject<{
|
|
970
|
+
currentPlan: z.ZodOptional<z.ZodObject<{
|
|
964
971
|
key: z.ZodReadonly<z.ZodString>;
|
|
965
972
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
966
973
|
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
@@ -1052,7 +1059,7 @@ export declare const zGetCustomerResponse: z.ZodObject<{
|
|
|
1052
1059
|
}>;
|
|
1053
1060
|
}, z.core.$strip>>>]>>;
|
|
1054
1061
|
}, z.core.$strip>>;
|
|
1055
|
-
}, z.core.$strip
|
|
1062
|
+
}, z.core.$strip>>;
|
|
1056
1063
|
pendingPlan: z.ZodOptional<z.ZodObject<{
|
|
1057
1064
|
key: z.ZodReadonly<z.ZodString>;
|
|
1058
1065
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
@@ -1305,6 +1312,19 @@ export declare const zUpdatePlanData: z.ZodObject<{
|
|
|
1305
1312
|
}, z.core.$strip>;
|
|
1306
1313
|
query: z.ZodOptional<z.ZodNever>;
|
|
1307
1314
|
}, z.core.$strip>;
|
|
1315
|
+
export declare const zCreateSubscriptionData: z.ZodObject<{
|
|
1316
|
+
body: z.ZodObject<{
|
|
1317
|
+
plan: z.ZodString;
|
|
1318
|
+
billingInterval: z.ZodEnum<{
|
|
1319
|
+
monthly: "monthly";
|
|
1320
|
+
annual: "annual";
|
|
1321
|
+
}>;
|
|
1322
|
+
}, z.core.$strip>;
|
|
1323
|
+
path: z.ZodObject<{
|
|
1324
|
+
org: z.ZodString;
|
|
1325
|
+
}, z.core.$strip>;
|
|
1326
|
+
query: z.ZodOptional<z.ZodNever>;
|
|
1327
|
+
}, z.core.$strip>;
|
|
1308
1328
|
export declare const zCreateSetupIntentData: z.ZodObject<{
|
|
1309
1329
|
body: z.ZodOptional<z.ZodNever>;
|
|
1310
1330
|
path: z.ZodObject<{
|
|
@@ -1395,7 +1415,7 @@ export declare const zM2mGetCustomerResponse: z.ZodObject<{
|
|
|
1395
1415
|
unpaid: "unpaid";
|
|
1396
1416
|
onboarding: "onboarding";
|
|
1397
1417
|
}>;
|
|
1398
|
-
currentPlan: z.ZodObject<{
|
|
1418
|
+
currentPlan: z.ZodOptional<z.ZodObject<{
|
|
1399
1419
|
key: z.ZodReadonly<z.ZodString>;
|
|
1400
1420
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
1401
1421
|
displayDescription: z.ZodOptional<z.ZodReadonly<z.ZodString>>;
|
|
@@ -1487,7 +1507,7 @@ export declare const zM2mGetCustomerResponse: z.ZodObject<{
|
|
|
1487
1507
|
}>;
|
|
1488
1508
|
}, z.core.$strip>>>]>>;
|
|
1489
1509
|
}, z.core.$strip>>;
|
|
1490
|
-
}, z.core.$strip
|
|
1510
|
+
}, z.core.$strip>>;
|
|
1491
1511
|
pendingPlan: z.ZodOptional<z.ZodObject<{
|
|
1492
1512
|
key: z.ZodReadonly<z.ZodString>;
|
|
1493
1513
|
displayName: z.ZodReadonly<z.ZodString>;
|
|
@@ -113,6 +113,10 @@ export const zCreateCustomerRequest = z.object({
|
|
|
113
113
|
plan: z.string(),
|
|
114
114
|
billingInterval: zBillingInterval
|
|
115
115
|
});
|
|
116
|
+
export const zCreateSubscriptionRequest = z.object({
|
|
117
|
+
plan: z.string(),
|
|
118
|
+
billingInterval: zBillingInterval
|
|
119
|
+
});
|
|
116
120
|
export const zSetupIntentResponse = z.object({
|
|
117
121
|
clientSecret: z.string().readonly()
|
|
118
122
|
});
|
|
@@ -171,7 +175,7 @@ export const zCustomerStatus = z.enum([
|
|
|
171
175
|
export const zCustomerResponse = z.object({
|
|
172
176
|
id: z.uuid(),
|
|
173
177
|
status: zCustomerStatus,
|
|
174
|
-
currentPlan: zCustomerPlanResponse,
|
|
178
|
+
currentPlan: z.optional(zCustomerPlanResponse),
|
|
175
179
|
pendingPlan: z.optional(zCustomerPlanResponse),
|
|
176
180
|
currentPeriodEnd: z.int().readonly(),
|
|
177
181
|
scheduledChangeAt: z.optional(z.int().readonly()),
|
|
@@ -236,7 +240,7 @@ export const zCustomerPlanResponseWritable = z.object({
|
|
|
236
240
|
export const zCustomerResponseWritable = z.object({
|
|
237
241
|
id: z.uuid(),
|
|
238
242
|
status: zCustomerStatus,
|
|
239
|
-
currentPlan: zCustomerPlanResponseWritable
|
|
243
|
+
currentPlan: z.optional(zCustomerPlanResponseWritable)
|
|
240
244
|
});
|
|
241
245
|
/**
|
|
242
246
|
* Stripe payment method.
|
|
@@ -273,6 +277,13 @@ export const zUpdatePlanData = z.object({
|
|
|
273
277
|
}),
|
|
274
278
|
query: z.optional(z.never())
|
|
275
279
|
});
|
|
280
|
+
export const zCreateSubscriptionData = z.object({
|
|
281
|
+
body: zCreateSubscriptionRequest,
|
|
282
|
+
path: z.object({
|
|
283
|
+
org: z.string()
|
|
284
|
+
}),
|
|
285
|
+
query: z.optional(z.never())
|
|
286
|
+
});
|
|
276
287
|
export const zCreateSetupIntentData = z.object({
|
|
277
288
|
body: z.optional(z.never()),
|
|
278
289
|
path: z.object({
|
package/dist/sdk/types.gen.d.ts
CHANGED
|
@@ -709,7 +709,16 @@ export type ContainerNodeProps = {
|
|
|
709
709
|
};
|
|
710
710
|
export type DesiredStatus = 'TERMINATED' | 'SUSPENDED' | 'RUNNING';
|
|
711
711
|
export type DiskType = 'pd-standard' | 'pd-balanced' | 'pd-ssd' | 'pd-extreme' | 'hyperdisk-balanced' | 'hyperdisk-extreme' | 'hyperdisk-throughput';
|
|
712
|
-
|
|
712
|
+
/**
|
|
713
|
+
* Number of vCPUs for the instance. Memory must stay between 0.9GB and 6.5GB per vCPU, so memoryMb has to be chosen alongside this.
|
|
714
|
+
*/
|
|
715
|
+
export type CloudSqlCpuCount = 1 | 2 | 4 | 8 | 16;
|
|
716
|
+
export type CloudSqlDiskType = 'PD_SSD' | 'PD_HDD';
|
|
717
|
+
export type CloudSqlEdition = 'ENTERPRISE' | 'ENTERPRISE_PLUS';
|
|
718
|
+
/**
|
|
719
|
+
* ZONAL runs a single instance. REGIONAL adds a standby in a second zone for automatic failover, at roughly double the cost.
|
|
720
|
+
*/
|
|
721
|
+
export type CloudSqlAvailabilityType = 'ZONAL' | 'REGIONAL';
|
|
713
722
|
export type CloudSqlDbVersion = 'POSTGRES_15' | 'POSTGRES_16' | 'POSTGRES_17';
|
|
714
723
|
export type MachineType = 'e2-micro' | 'e2-small' | 'e2-medium' | 'e2-standard-2' | 'e2-standard-4' | 'e2-standard-8';
|
|
715
724
|
export type ImageVersion = 'debian-cloud/debian-12' | 'debian-cloud/debian-11' | 'ubuntu-os-cloud/ubuntu-2404-lts' | 'ubuntu-os-cloud/ubuntu-2204-lts' | 'cos-cloud/cos-stable' | 'cos-cloud/cos-beta' | 'cos-cloud/cos-arm64-stable' | 'cos-cloud/cos-arm64-beta';
|
|
@@ -785,10 +794,25 @@ export type CloudSqlNodeProps = {
|
|
|
785
794
|
*/
|
|
786
795
|
instanceName?: string;
|
|
787
796
|
region?: Region;
|
|
788
|
-
|
|
797
|
+
cpuCount?: CloudSqlCpuCount;
|
|
798
|
+
/**
|
|
799
|
+
* Instance memory in MB. Must be a multiple of 256 and between 0.9GB and 6.5GB per vCPU, so the valid range depends on cpuCount.
|
|
800
|
+
*/
|
|
801
|
+
memoryMb?: number;
|
|
789
802
|
dbVersion?: CloudSqlDbVersion;
|
|
790
803
|
dbName?: string;
|
|
791
804
|
storageSizeGb?: number;
|
|
805
|
+
diskType?: CloudSqlDiskType;
|
|
806
|
+
edition?: CloudSqlEdition;
|
|
807
|
+
availabilityType?: CloudSqlAvailabilityType;
|
|
808
|
+
/**
|
|
809
|
+
* Whether scheduled backups are taken for the instance.
|
|
810
|
+
*/
|
|
811
|
+
backupEnabled?: boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Whether write-ahead logs are retained so the instance can be restored to a point in time. Requires backupEnabled.
|
|
814
|
+
*/
|
|
815
|
+
pointInTimeRecoveryEnabled?: boolean;
|
|
792
816
|
/**
|
|
793
817
|
* CIDR ranges allowed to connect to the instance. Use 0.0.0.0/0 to allow any address.
|
|
794
818
|
*/
|
package/dist/sdk/zod.gen.d.ts
CHANGED
|
@@ -840,11 +840,24 @@ export declare const zDiskType: z.ZodEnum<{
|
|
|
840
840
|
"hyperdisk-extreme": "hyperdisk-extreme";
|
|
841
841
|
"hyperdisk-throughput": "hyperdisk-throughput";
|
|
842
842
|
}>;
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
843
|
+
/**
|
|
844
|
+
* Number of vCPUs for the instance. Memory must stay between 0.9GB and 6.5GB per vCPU, so memoryMb has to be chosen alongside this.
|
|
845
|
+
*/
|
|
846
|
+
export declare const zCloudSqlCpuCount: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>;
|
|
847
|
+
export declare const zCloudSqlDiskType: z.ZodEnum<{
|
|
848
|
+
PD_SSD: "PD_SSD";
|
|
849
|
+
PD_HDD: "PD_HDD";
|
|
850
|
+
}>;
|
|
851
|
+
export declare const zCloudSqlEdition: z.ZodEnum<{
|
|
852
|
+
ENTERPRISE: "ENTERPRISE";
|
|
853
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
854
|
+
}>;
|
|
855
|
+
/**
|
|
856
|
+
* ZONAL runs a single instance. REGIONAL adds a standby in a second zone for automatic failover, at roughly double the cost.
|
|
857
|
+
*/
|
|
858
|
+
export declare const zCloudSqlAvailabilityType: z.ZodEnum<{
|
|
859
|
+
ZONAL: "ZONAL";
|
|
860
|
+
REGIONAL: "REGIONAL";
|
|
848
861
|
}>;
|
|
849
862
|
export declare const zCloudSqlDbVersion: z.ZodEnum<{
|
|
850
863
|
POSTGRES_15: "POSTGRES_15";
|
|
@@ -961,12 +974,8 @@ export declare const zCloudSqlNodeProps: z.ZodObject<{
|
|
|
961
974
|
region: z.ZodOptional<z.ZodEnum<{
|
|
962
975
|
"europe-west2": "europe-west2";
|
|
963
976
|
}>>;
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
967
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
968
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
969
|
-
}>>;
|
|
977
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
978
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
970
979
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
971
980
|
POSTGRES_15: "POSTGRES_15";
|
|
972
981
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -974,6 +983,20 @@ export declare const zCloudSqlNodeProps: z.ZodObject<{
|
|
|
974
983
|
}>>;
|
|
975
984
|
dbName: z.ZodOptional<z.ZodString>;
|
|
976
985
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
986
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
987
|
+
PD_SSD: "PD_SSD";
|
|
988
|
+
PD_HDD: "PD_HDD";
|
|
989
|
+
}>>;
|
|
990
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
991
|
+
ENTERPRISE: "ENTERPRISE";
|
|
992
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
993
|
+
}>>;
|
|
994
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
995
|
+
ZONAL: "ZONAL";
|
|
996
|
+
REGIONAL: "REGIONAL";
|
|
997
|
+
}>>;
|
|
998
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
999
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
977
1000
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
978
1001
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
979
1002
|
}, z.core.$strip>;
|
|
@@ -1275,12 +1298,8 @@ export declare const zNode: z.ZodObject<{
|
|
|
1275
1298
|
region: z.ZodOptional<z.ZodEnum<{
|
|
1276
1299
|
"europe-west2": "europe-west2";
|
|
1277
1300
|
}>>;
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
1281
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
1282
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
1283
|
-
}>>;
|
|
1301
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
1302
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
1284
1303
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
1285
1304
|
POSTGRES_15: "POSTGRES_15";
|
|
1286
1305
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -1288,6 +1307,20 @@ export declare const zNode: z.ZodObject<{
|
|
|
1288
1307
|
}>>;
|
|
1289
1308
|
dbName: z.ZodOptional<z.ZodString>;
|
|
1290
1309
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
1310
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
1311
|
+
PD_SSD: "PD_SSD";
|
|
1312
|
+
PD_HDD: "PD_HDD";
|
|
1313
|
+
}>>;
|
|
1314
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
1315
|
+
ENTERPRISE: "ENTERPRISE";
|
|
1316
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
1317
|
+
}>>;
|
|
1318
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
1319
|
+
ZONAL: "ZONAL";
|
|
1320
|
+
REGIONAL: "REGIONAL";
|
|
1321
|
+
}>>;
|
|
1322
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1323
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1291
1324
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1292
1325
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
1293
1326
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1543,12 +1576,8 @@ export declare const zNodes: z.ZodObject<{
|
|
|
1543
1576
|
region: z.ZodOptional<z.ZodEnum<{
|
|
1544
1577
|
"europe-west2": "europe-west2";
|
|
1545
1578
|
}>>;
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
1549
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
1550
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
1551
|
-
}>>;
|
|
1579
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
1580
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
1552
1581
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
1553
1582
|
POSTGRES_15: "POSTGRES_15";
|
|
1554
1583
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -1556,6 +1585,20 @@ export declare const zNodes: z.ZodObject<{
|
|
|
1556
1585
|
}>>;
|
|
1557
1586
|
dbName: z.ZodOptional<z.ZodString>;
|
|
1558
1587
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
1588
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
1589
|
+
PD_SSD: "PD_SSD";
|
|
1590
|
+
PD_HDD: "PD_HDD";
|
|
1591
|
+
}>>;
|
|
1592
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
1593
|
+
ENTERPRISE: "ENTERPRISE";
|
|
1594
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
1595
|
+
}>>;
|
|
1596
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
1597
|
+
ZONAL: "ZONAL";
|
|
1598
|
+
REGIONAL: "REGIONAL";
|
|
1599
|
+
}>>;
|
|
1600
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1601
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1559
1602
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1560
1603
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
1561
1604
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -1814,12 +1857,8 @@ export declare const zGraph: z.ZodObject<{
|
|
|
1814
1857
|
region: z.ZodOptional<z.ZodEnum<{
|
|
1815
1858
|
"europe-west2": "europe-west2";
|
|
1816
1859
|
}>>;
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
1820
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
1821
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
1822
|
-
}>>;
|
|
1860
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
1861
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
1823
1862
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
1824
1863
|
POSTGRES_15: "POSTGRES_15";
|
|
1825
1864
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -1827,6 +1866,20 @@ export declare const zGraph: z.ZodObject<{
|
|
|
1827
1866
|
}>>;
|
|
1828
1867
|
dbName: z.ZodOptional<z.ZodString>;
|
|
1829
1868
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
1869
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
1870
|
+
PD_SSD: "PD_SSD";
|
|
1871
|
+
PD_HDD: "PD_HDD";
|
|
1872
|
+
}>>;
|
|
1873
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
1874
|
+
ENTERPRISE: "ENTERPRISE";
|
|
1875
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
1876
|
+
}>>;
|
|
1877
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
1878
|
+
ZONAL: "ZONAL";
|
|
1879
|
+
REGIONAL: "REGIONAL";
|
|
1880
|
+
}>>;
|
|
1881
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1882
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1830
1883
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1831
1884
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
1832
1885
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -2090,12 +2143,8 @@ export declare const zBlueprintDetail: z.ZodObject<{
|
|
|
2090
2143
|
region: z.ZodOptional<z.ZodEnum<{
|
|
2091
2144
|
"europe-west2": "europe-west2";
|
|
2092
2145
|
}>>;
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
2096
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
2097
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
2098
|
-
}>>;
|
|
2146
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
2147
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
2099
2148
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
2100
2149
|
POSTGRES_15: "POSTGRES_15";
|
|
2101
2150
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -2103,6 +2152,20 @@ export declare const zBlueprintDetail: z.ZodObject<{
|
|
|
2103
2152
|
}>>;
|
|
2104
2153
|
dbName: z.ZodOptional<z.ZodString>;
|
|
2105
2154
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
2155
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
2156
|
+
PD_SSD: "PD_SSD";
|
|
2157
|
+
PD_HDD: "PD_HDD";
|
|
2158
|
+
}>>;
|
|
2159
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
2160
|
+
ENTERPRISE: "ENTERPRISE";
|
|
2161
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
2162
|
+
}>>;
|
|
2163
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
2164
|
+
ZONAL: "ZONAL";
|
|
2165
|
+
REGIONAL: "REGIONAL";
|
|
2166
|
+
}>>;
|
|
2167
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
2168
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
2106
2169
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2107
2170
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
2108
2171
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -3035,12 +3098,8 @@ export declare const zFetchGraphM2mResponse: z.ZodObject<{
|
|
|
3035
3098
|
region: z.ZodOptional<z.ZodEnum<{
|
|
3036
3099
|
"europe-west2": "europe-west2";
|
|
3037
3100
|
}>>;
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
3041
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
3042
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
3043
|
-
}>>;
|
|
3101
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
3102
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
3044
3103
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
3045
3104
|
POSTGRES_15: "POSTGRES_15";
|
|
3046
3105
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -3048,6 +3107,20 @@ export declare const zFetchGraphM2mResponse: z.ZodObject<{
|
|
|
3048
3107
|
}>>;
|
|
3049
3108
|
dbName: z.ZodOptional<z.ZodString>;
|
|
3050
3109
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
3110
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
3111
|
+
PD_SSD: "PD_SSD";
|
|
3112
|
+
PD_HDD: "PD_HDD";
|
|
3113
|
+
}>>;
|
|
3114
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
3115
|
+
ENTERPRISE: "ENTERPRISE";
|
|
3116
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
3117
|
+
}>>;
|
|
3118
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
3119
|
+
ZONAL: "ZONAL";
|
|
3120
|
+
REGIONAL: "REGIONAL";
|
|
3121
|
+
}>>;
|
|
3122
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3123
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3051
3124
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3052
3125
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
3053
3126
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -3305,12 +3378,8 @@ export declare const zUpdateGraphM2mData: z.ZodObject<{
|
|
|
3305
3378
|
region: z.ZodOptional<z.ZodEnum<{
|
|
3306
3379
|
"europe-west2": "europe-west2";
|
|
3307
3380
|
}>>;
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
3311
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
3312
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
3313
|
-
}>>;
|
|
3381
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
3382
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
3314
3383
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
3315
3384
|
POSTGRES_15: "POSTGRES_15";
|
|
3316
3385
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -3318,6 +3387,20 @@ export declare const zUpdateGraphM2mData: z.ZodObject<{
|
|
|
3318
3387
|
}>>;
|
|
3319
3388
|
dbName: z.ZodOptional<z.ZodString>;
|
|
3320
3389
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
3390
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
3391
|
+
PD_SSD: "PD_SSD";
|
|
3392
|
+
PD_HDD: "PD_HDD";
|
|
3393
|
+
}>>;
|
|
3394
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
3395
|
+
ENTERPRISE: "ENTERPRISE";
|
|
3396
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
3397
|
+
}>>;
|
|
3398
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
3399
|
+
ZONAL: "ZONAL";
|
|
3400
|
+
REGIONAL: "REGIONAL";
|
|
3401
|
+
}>>;
|
|
3402
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3403
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3321
3404
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3322
3405
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
3323
3406
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -3592,12 +3675,8 @@ export declare const zFetchNodeM2mResponse: z.ZodObject<{
|
|
|
3592
3675
|
region: z.ZodOptional<z.ZodEnum<{
|
|
3593
3676
|
"europe-west2": "europe-west2";
|
|
3594
3677
|
}>>;
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
3598
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
3599
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
3600
|
-
}>>;
|
|
3678
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
3679
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
3601
3680
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
3602
3681
|
POSTGRES_15: "POSTGRES_15";
|
|
3603
3682
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -3605,6 +3684,20 @@ export declare const zFetchNodeM2mResponse: z.ZodObject<{
|
|
|
3605
3684
|
}>>;
|
|
3606
3685
|
dbName: z.ZodOptional<z.ZodString>;
|
|
3607
3686
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
3687
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
3688
|
+
PD_SSD: "PD_SSD";
|
|
3689
|
+
PD_HDD: "PD_HDD";
|
|
3690
|
+
}>>;
|
|
3691
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
3692
|
+
ENTERPRISE: "ENTERPRISE";
|
|
3693
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
3694
|
+
}>>;
|
|
3695
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
3696
|
+
ZONAL: "ZONAL";
|
|
3697
|
+
REGIONAL: "REGIONAL";
|
|
3698
|
+
}>>;
|
|
3699
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3700
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3608
3701
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3609
3702
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
3610
3703
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -3860,12 +3953,8 @@ export declare const zUpdateNodeM2mData: z.ZodObject<{
|
|
|
3860
3953
|
region: z.ZodOptional<z.ZodEnum<{
|
|
3861
3954
|
"europe-west2": "europe-west2";
|
|
3862
3955
|
}>>;
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
3866
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
3867
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
3868
|
-
}>>;
|
|
3956
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
3957
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
3869
3958
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
3870
3959
|
POSTGRES_15: "POSTGRES_15";
|
|
3871
3960
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -3873,6 +3962,20 @@ export declare const zUpdateNodeM2mData: z.ZodObject<{
|
|
|
3873
3962
|
}>>;
|
|
3874
3963
|
dbName: z.ZodOptional<z.ZodString>;
|
|
3875
3964
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
3965
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
3966
|
+
PD_SSD: "PD_SSD";
|
|
3967
|
+
PD_HDD: "PD_HDD";
|
|
3968
|
+
}>>;
|
|
3969
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
3970
|
+
ENTERPRISE: "ENTERPRISE";
|
|
3971
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
3972
|
+
}>>;
|
|
3973
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
3974
|
+
ZONAL: "ZONAL";
|
|
3975
|
+
REGIONAL: "REGIONAL";
|
|
3976
|
+
}>>;
|
|
3977
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3978
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
3876
3979
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
3877
3980
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
3878
3981
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -4197,12 +4300,8 @@ export declare const zGetBlueprintM2mResponse: z.ZodObject<{
|
|
|
4197
4300
|
region: z.ZodOptional<z.ZodEnum<{
|
|
4198
4301
|
"europe-west2": "europe-west2";
|
|
4199
4302
|
}>>;
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
4203
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
4204
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
4205
|
-
}>>;
|
|
4303
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
4304
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
4206
4305
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
4207
4306
|
POSTGRES_15: "POSTGRES_15";
|
|
4208
4307
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -4210,6 +4309,20 @@ export declare const zGetBlueprintM2mResponse: z.ZodObject<{
|
|
|
4210
4309
|
}>>;
|
|
4211
4310
|
dbName: z.ZodOptional<z.ZodString>;
|
|
4212
4311
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
4312
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
4313
|
+
PD_SSD: "PD_SSD";
|
|
4314
|
+
PD_HDD: "PD_HDD";
|
|
4315
|
+
}>>;
|
|
4316
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
4317
|
+
ENTERPRISE: "ENTERPRISE";
|
|
4318
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
4319
|
+
}>>;
|
|
4320
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
4321
|
+
ZONAL: "ZONAL";
|
|
4322
|
+
REGIONAL: "REGIONAL";
|
|
4323
|
+
}>>;
|
|
4324
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
4325
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
4213
4326
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
4214
4327
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
4215
4328
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -5128,12 +5241,8 @@ export declare const zPreviewBlueprintResponse: z.ZodObject<{
|
|
|
5128
5241
|
region: z.ZodOptional<z.ZodEnum<{
|
|
5129
5242
|
"europe-west2": "europe-west2";
|
|
5130
5243
|
}>>;
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
5134
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
5135
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
5136
|
-
}>>;
|
|
5244
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
5245
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
5137
5246
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
5138
5247
|
POSTGRES_15: "POSTGRES_15";
|
|
5139
5248
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -5141,6 +5250,20 @@ export declare const zPreviewBlueprintResponse: z.ZodObject<{
|
|
|
5141
5250
|
}>>;
|
|
5142
5251
|
dbName: z.ZodOptional<z.ZodString>;
|
|
5143
5252
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
5253
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
5254
|
+
PD_SSD: "PD_SSD";
|
|
5255
|
+
PD_HDD: "PD_HDD";
|
|
5256
|
+
}>>;
|
|
5257
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
5258
|
+
ENTERPRISE: "ENTERPRISE";
|
|
5259
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
5260
|
+
}>>;
|
|
5261
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
5262
|
+
ZONAL: "ZONAL";
|
|
5263
|
+
REGIONAL: "REGIONAL";
|
|
5264
|
+
}>>;
|
|
5265
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
5266
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
5144
5267
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5145
5268
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
5146
5269
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -6302,12 +6425,8 @@ export declare const zGetGraphOverviewResponse: z.ZodObject<{
|
|
|
6302
6425
|
region: z.ZodOptional<z.ZodEnum<{
|
|
6303
6426
|
"europe-west2": "europe-west2";
|
|
6304
6427
|
}>>;
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
6308
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
6309
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
6310
|
-
}>>;
|
|
6428
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
6429
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
6311
6430
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
6312
6431
|
POSTGRES_15: "POSTGRES_15";
|
|
6313
6432
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -6315,6 +6434,20 @@ export declare const zGetGraphOverviewResponse: z.ZodObject<{
|
|
|
6315
6434
|
}>>;
|
|
6316
6435
|
dbName: z.ZodOptional<z.ZodString>;
|
|
6317
6436
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
6437
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
6438
|
+
PD_SSD: "PD_SSD";
|
|
6439
|
+
PD_HDD: "PD_HDD";
|
|
6440
|
+
}>>;
|
|
6441
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
6442
|
+
ENTERPRISE: "ENTERPRISE";
|
|
6443
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
6444
|
+
}>>;
|
|
6445
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
6446
|
+
ZONAL: "ZONAL";
|
|
6447
|
+
REGIONAL: "REGIONAL";
|
|
6448
|
+
}>>;
|
|
6449
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
6450
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
6318
6451
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6319
6452
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
6320
6453
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
|
@@ -6572,12 +6705,8 @@ export declare const zUpdateGraphStateData: z.ZodObject<{
|
|
|
6572
6705
|
region: z.ZodOptional<z.ZodEnum<{
|
|
6573
6706
|
"europe-west2": "europe-west2";
|
|
6574
6707
|
}>>;
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
"db-custom-2-7680": "db-custom-2-7680";
|
|
6578
|
-
"db-custom-4-15360": "db-custom-4-15360";
|
|
6579
|
-
"db-custom-8-30720": "db-custom-8-30720";
|
|
6580
|
-
}>>;
|
|
6708
|
+
cpuCount: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<4>, z.ZodLiteral<8>, z.ZodLiteral<16>]>>;
|
|
6709
|
+
memoryMb: z.ZodOptional<z.ZodInt>;
|
|
6581
6710
|
dbVersion: z.ZodOptional<z.ZodEnum<{
|
|
6582
6711
|
POSTGRES_15: "POSTGRES_15";
|
|
6583
6712
|
POSTGRES_16: "POSTGRES_16";
|
|
@@ -6585,6 +6714,20 @@ export declare const zUpdateGraphStateData: z.ZodObject<{
|
|
|
6585
6714
|
}>>;
|
|
6586
6715
|
dbName: z.ZodOptional<z.ZodString>;
|
|
6587
6716
|
storageSizeGb: z.ZodOptional<z.ZodInt>;
|
|
6717
|
+
diskType: z.ZodOptional<z.ZodEnum<{
|
|
6718
|
+
PD_SSD: "PD_SSD";
|
|
6719
|
+
PD_HDD: "PD_HDD";
|
|
6720
|
+
}>>;
|
|
6721
|
+
edition: z.ZodOptional<z.ZodEnum<{
|
|
6722
|
+
ENTERPRISE: "ENTERPRISE";
|
|
6723
|
+
ENTERPRISE_PLUS: "ENTERPRISE_PLUS";
|
|
6724
|
+
}>>;
|
|
6725
|
+
availabilityType: z.ZodOptional<z.ZodEnum<{
|
|
6726
|
+
ZONAL: "ZONAL";
|
|
6727
|
+
REGIONAL: "REGIONAL";
|
|
6728
|
+
}>>;
|
|
6729
|
+
backupEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
6730
|
+
pointInTimeRecoveryEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
6588
6731
|
allowedIps: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6589
6732
|
connectionUri: z.ZodOptional<z.ZodString>;
|
|
6590
6733
|
}, z.core.$strip>>, z.ZodIntersection<z.ZodObject<{
|
package/dist/sdk/zod.gen.js
CHANGED
|
@@ -589,11 +589,30 @@ export const zDiskType = z.enum([
|
|
|
589
589
|
'hyperdisk-extreme',
|
|
590
590
|
'hyperdisk-throughput'
|
|
591
591
|
]);
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
592
|
+
/**
|
|
593
|
+
* Number of vCPUs for the instance. Memory must stay between 0.9GB and 6.5GB per vCPU, so memoryMb has to be chosen alongside this.
|
|
594
|
+
*/
|
|
595
|
+
export const zCloudSqlCpuCount = z.union([
|
|
596
|
+
z.literal(1),
|
|
597
|
+
z.literal(2),
|
|
598
|
+
z.literal(4),
|
|
599
|
+
z.literal(8),
|
|
600
|
+
z.literal(16)
|
|
601
|
+
]);
|
|
602
|
+
export const zCloudSqlDiskType = z.enum([
|
|
603
|
+
'PD_SSD',
|
|
604
|
+
'PD_HDD'
|
|
605
|
+
]);
|
|
606
|
+
export const zCloudSqlEdition = z.enum([
|
|
607
|
+
'ENTERPRISE',
|
|
608
|
+
'ENTERPRISE_PLUS'
|
|
609
|
+
]);
|
|
610
|
+
/**
|
|
611
|
+
* ZONAL runs a single instance. REGIONAL adds a standby in a second zone for automatic failover, at roughly double the cost.
|
|
612
|
+
*/
|
|
613
|
+
export const zCloudSqlAvailabilityType = z.enum([
|
|
614
|
+
'ZONAL',
|
|
615
|
+
'REGIONAL'
|
|
597
616
|
]);
|
|
598
617
|
export const zCloudSqlDbVersion = z.enum([
|
|
599
618
|
'POSTGRES_15',
|
|
@@ -695,10 +714,16 @@ export const zMongoDbNodeProps = z.object({
|
|
|
695
714
|
export const zCloudSqlNodeProps = z.object({
|
|
696
715
|
instanceName: z.optional(z.string()),
|
|
697
716
|
region: z.optional(zRegion),
|
|
698
|
-
|
|
717
|
+
cpuCount: z.optional(zCloudSqlCpuCount),
|
|
718
|
+
memoryMb: z.optional(z.int().gte(3840).lte(106496)),
|
|
699
719
|
dbVersion: z.optional(zCloudSqlDbVersion),
|
|
700
720
|
dbName: z.optional(z.string()),
|
|
701
721
|
storageSizeGb: z.optional(z.int().gte(10)),
|
|
722
|
+
diskType: z.optional(zCloudSqlDiskType),
|
|
723
|
+
edition: z.optional(zCloudSqlEdition),
|
|
724
|
+
availabilityType: z.optional(zCloudSqlAvailabilityType),
|
|
725
|
+
backupEnabled: z.optional(z.boolean()),
|
|
726
|
+
pointInTimeRecoveryEnabled: z.optional(z.boolean()),
|
|
702
727
|
allowedIps: z.optional(z.array(z.string())),
|
|
703
728
|
connectionUri: z.optional(z.string())
|
|
704
729
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { GetSuccessResponse } from "../util";
|
|
3
|
-
import { GetCustomerData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
3
|
+
import { GetCustomerData, GetPlansData, UpdatePlanData, UpdatePlanResponses, CreateSubscriptionData, CreateSubscriptionResponses, CreateSetupIntentData, CreateSetupIntentResponses, DeletePaymentMethodData, DeletePaymentMethodResponses, UpdateDefaultPaymentMethodData, UpdateDefaultPaymentMethodResponses, GetInvoicesData, M2mGetCustomerData, M2mCreateCustomerData, M2mCreateCustomerResponses, M2mUpdatePlanData, M2mUpdatePlanResponses } from "../../sdk/billing/types.gen";
|
|
4
4
|
export declare const useGetCustomer: (options: Omit<GetCustomerData, "url"> & {
|
|
5
5
|
enabled?: boolean;
|
|
6
6
|
}) => {
|
|
@@ -423,6 +423,14 @@ export declare const useUpdatePlan: (config?: {
|
|
|
423
423
|
data: unknown;
|
|
424
424
|
headers: Record<string, string>;
|
|
425
425
|
}, unknown, Omit<UpdatePlanData, "url">, unknown>;
|
|
426
|
+
export declare const useCreateSubscription: (config?: {
|
|
427
|
+
onSuccess?: (data: GetSuccessResponse<CreateSubscriptionResponses>, headers: Record<string, string>) => void;
|
|
428
|
+
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
429
|
+
retry?: boolean;
|
|
430
|
+
}) => import("@tanstack/react-query").UseMutationResult<{
|
|
431
|
+
data: unknown;
|
|
432
|
+
headers: Record<string, string>;
|
|
433
|
+
}, unknown, Omit<CreateSubscriptionData, "url">, unknown>;
|
|
426
434
|
export declare const useCreateSetupIntent: (config?: {
|
|
427
435
|
onSuccess?: (data: GetSuccessResponse<CreateSetupIntentResponses>, headers: Record<string, string>) => void;
|
|
428
436
|
onError?: Parameters<typeof useMutation>["0"]["onError"];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { isPromise, headersToObject } from "../util";
|
|
4
4
|
import { useToken } from "../../provider/token-provider";
|
|
5
|
-
import { getCustomer, getPlans, updatePlan, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
5
|
+
import { getCustomer, getPlans, updatePlan, createSubscription, createSetupIntent, deletePaymentMethod, updateDefaultPaymentMethod, getInvoices, m2mGetCustomer, m2mCreateCustomer, m2mUpdatePlan } from "../../sdk/billing/sdk.gen";
|
|
6
6
|
export const useGetCustomer = (options) => {
|
|
7
7
|
const token = useToken();
|
|
8
8
|
let { enabled, ...rest } = options || { enabled: true };
|
|
@@ -66,6 +66,25 @@ export const useUpdatePlan = (config) => {
|
|
|
66
66
|
retry: config?.retry
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
+
export const useCreateSubscription = (config) => {
|
|
70
|
+
const token = useToken();
|
|
71
|
+
const queryClient = useQueryClient();
|
|
72
|
+
const opts = { throwOnError: true, url: "/api/v1/subscription/{org}" };
|
|
73
|
+
const funcer = async (options) => {
|
|
74
|
+
const auth = isPromise(token) ? (await token) || "" : token || "";
|
|
75
|
+
const res = await createSubscription({ ...opts, ...options, auth });
|
|
76
|
+
return { data: res.data, headers: headersToObject(res.response.headers) };
|
|
77
|
+
};
|
|
78
|
+
return useMutation({
|
|
79
|
+
mutationFn: funcer,
|
|
80
|
+
onSuccess: (res, options, c, ctx) => {
|
|
81
|
+
queryClient.invalidateQueries({ queryKey: ["api", "v1", "subscription", options?.path?.org] });
|
|
82
|
+
config?.onSuccess && config.onSuccess(res.data, res.headers);
|
|
83
|
+
},
|
|
84
|
+
onError: config?.onError,
|
|
85
|
+
retry: config?.retry
|
|
86
|
+
});
|
|
87
|
+
};
|
|
69
88
|
export const useCreateSetupIntent = (config) => {
|
|
70
89
|
const token = useToken();
|
|
71
90
|
const queryClient = useQueryClient();
|