contiguity 0.0.3 → 0.0.4
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/client/fetch.d.ts +5 -10
- package/dist/client/fetch.d.ts.map +1 -1
- package/dist/client/fetch.js +13 -45
- package/dist/contiguity.d.ts +1 -1
- package/dist/contiguity.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -185
- package/dist/services/domains/delete.d.ts +0 -4
- package/dist/services/domains/delete.d.ts.map +1 -1
- package/dist/services/domains/delete.js +1 -7
- package/dist/services/domains/get.d.ts +0 -30
- package/dist/services/domains/get.d.ts.map +1 -1
- package/dist/services/domains/get.js +1 -7
- package/dist/services/domains/list.d.ts +0 -32
- package/dist/services/domains/list.d.ts.map +1 -1
- package/dist/services/domains/list.js +1 -11
- package/dist/services/domains/register.d.ts +0 -22
- package/dist/services/domains/register.d.ts.map +1 -1
- package/dist/services/domains/register.js +1 -7
- package/dist/services/email/send.d.ts +0 -3
- package/dist/services/email/send.d.ts.map +1 -1
- package/dist/services/email/send.js +1 -7
- package/dist/services/imessage/send.d.ts +0 -3
- package/dist/services/imessage/send.d.ts.map +1 -1
- package/dist/services/imessage/send.js +1 -7
- package/dist/services/imessage/typing.d.ts +0 -3
- package/dist/services/imessage/typing.d.ts.map +1 -1
- package/dist/services/imessage/typing.js +1 -7
- package/dist/services/lease/available.d.ts +0 -62
- package/dist/services/lease/available.d.ts.map +1 -1
- package/dist/services/lease/available.js +1 -7
- package/dist/services/lease/create.d.ts +0 -31
- package/dist/services/lease/create.d.ts.map +1 -1
- package/dist/services/lease/create.js +1 -7
- package/dist/services/lease/details.d.ts +0 -77
- package/dist/services/lease/details.d.ts.map +1 -1
- package/dist/services/lease/details.js +1 -7
- package/dist/services/lease/get.d.ts +0 -59
- package/dist/services/lease/get.d.ts.map +1 -1
- package/dist/services/lease/get.js +1 -7
- package/dist/services/lease/leased.d.ts +0 -80
- package/dist/services/lease/leased.d.ts.map +1 -1
- package/dist/services/lease/leased.js +1 -7
- package/dist/services/lease/terminate.d.ts +0 -10
- package/dist/services/lease/terminate.d.ts.map +1 -1
- package/dist/services/lease/terminate.js +1 -7
- package/dist/services/otp/index.d.ts +8 -3
- package/dist/services/otp/index.d.ts.map +1 -1
- package/dist/services/otp/index.js +9 -2
- package/dist/services/otp/resend.d.ts +0 -3
- package/dist/services/otp/resend.d.ts.map +1 -1
- package/dist/services/otp/resend.js +1 -7
- package/dist/services/otp/send.d.ts +26 -0
- package/dist/services/otp/send.d.ts.map +1 -0
- package/dist/services/otp/send.js +38 -0
- package/dist/services/otp/verify.d.ts +0 -3
- package/dist/services/otp/verify.d.ts.map +1 -1
- package/dist/services/otp/verify.js +1 -7
- package/dist/services/text/send.d.ts +0 -3
- package/dist/services/text/send.d.ts.map +1 -1
- package/dist/services/text/send.js +1 -7
- package/dist/services/whatsapp/send.d.ts +0 -3
- package/dist/services/whatsapp/send.d.ts.map +1 -1
- package/dist/services/whatsapp/send.js +1 -7
- package/dist/services/whatsapp/typing.d.ts +0 -3
- package/dist/services/whatsapp/typing.d.ts.map +1 -1
- package/dist/services/whatsapp/typing.js +1 -7
- package/dist/types/base.d.ts +2 -23
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/base.js +3 -15
- package/dist/types/response.d.ts +0 -7
- package/dist/types/response.d.ts.map +1 -1
- package/dist/types/response.js +0 -7
- package/package.json +1 -1
|
@@ -171,86 +171,6 @@ export declare const LeaseLeasedResponse: z.ZodObject<{
|
|
|
171
171
|
}, z.core.$strip>;
|
|
172
172
|
}, z.core.$strip>>;
|
|
173
173
|
}, z.core.$strip>;
|
|
174
|
-
export declare const LeaseLeasedResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
175
|
-
leased: z.ZodNumber;
|
|
176
|
-
numbers: z.ZodArray<z.ZodObject<{
|
|
177
|
-
id: z.ZodString;
|
|
178
|
-
status: z.ZodEnum<{
|
|
179
|
-
available: "available";
|
|
180
|
-
"g-available": "g-available";
|
|
181
|
-
leased: "leased";
|
|
182
|
-
unavailable: "unavailable";
|
|
183
|
-
}>;
|
|
184
|
-
number: z.ZodObject<{
|
|
185
|
-
e164: z.ZodString;
|
|
186
|
-
formatted: z.ZodString;
|
|
187
|
-
}, z.core.$strip>;
|
|
188
|
-
location: z.ZodObject<{
|
|
189
|
-
country: z.ZodString;
|
|
190
|
-
region: z.ZodString;
|
|
191
|
-
city: z.ZodString;
|
|
192
|
-
}, z.core.$strip>;
|
|
193
|
-
carrier: z.ZodEnum<{
|
|
194
|
-
"T-Mobile": "T-Mobile";
|
|
195
|
-
"AT&T": "AT&T";
|
|
196
|
-
Verizon: "Verizon";
|
|
197
|
-
Contiguity: "Contiguity";
|
|
198
|
-
"International Partner": "International Partner";
|
|
199
|
-
Twilio: "Twilio";
|
|
200
|
-
}>;
|
|
201
|
-
capabilities: z.ZodObject<{
|
|
202
|
-
intl_sms: z.ZodBoolean;
|
|
203
|
-
channels: z.ZodArray<z.ZodEnum<{
|
|
204
|
-
sms: "sms";
|
|
205
|
-
mms: "mms";
|
|
206
|
-
rcs: "rcs";
|
|
207
|
-
imessage: "imessage";
|
|
208
|
-
whatsapp: "whatsapp";
|
|
209
|
-
}>>;
|
|
210
|
-
}, z.core.$strip>;
|
|
211
|
-
health: z.ZodObject<{
|
|
212
|
-
reputation: z.ZodNumber;
|
|
213
|
-
previous_owners: z.ZodNumber;
|
|
214
|
-
}, z.core.$strip>;
|
|
215
|
-
data: z.ZodObject<{
|
|
216
|
-
requirements: z.ZodArray<z.ZodEnum<{
|
|
217
|
-
imessage_entitlement_required: "imessage_entitlement_required";
|
|
218
|
-
whatsapp_entitlement_required: "whatsapp_entitlement_required";
|
|
219
|
-
enterprise_plan_required: "enterprise_plan_required";
|
|
220
|
-
}>>;
|
|
221
|
-
e911_capable: z.ZodBoolean;
|
|
222
|
-
}, z.core.$strip>;
|
|
223
|
-
created_at: z.ZodNumber;
|
|
224
|
-
pricing: z.ZodObject<{
|
|
225
|
-
currency: z.ZodEnum<{
|
|
226
|
-
USD: "USD";
|
|
227
|
-
EUR: "EUR";
|
|
228
|
-
GBP: "GBP";
|
|
229
|
-
CAD: "CAD";
|
|
230
|
-
AUD: "AUD";
|
|
231
|
-
}>;
|
|
232
|
-
upfront_fee: z.ZodNumber;
|
|
233
|
-
monthly_rate: z.ZodNumber;
|
|
234
|
-
}, z.core.$strip>;
|
|
235
|
-
lease_id: z.ZodString;
|
|
236
|
-
lease_status: z.ZodEnum<{
|
|
237
|
-
active: "active";
|
|
238
|
-
expired: "expired";
|
|
239
|
-
terminated: "terminated";
|
|
240
|
-
}>;
|
|
241
|
-
billing: z.ZodObject<{
|
|
242
|
-
method: z.ZodEnum<{
|
|
243
|
-
monthly: "monthly";
|
|
244
|
-
service_contract: "service_contract";
|
|
245
|
-
goodwill: "goodwill";
|
|
246
|
-
}>;
|
|
247
|
-
period: z.ZodObject<{
|
|
248
|
-
start: z.ZodNumber;
|
|
249
|
-
end: z.ZodNullable<z.ZodNumber>;
|
|
250
|
-
}, z.core.$strip>;
|
|
251
|
-
}, z.core.$strip>;
|
|
252
|
-
}, z.core.$strip>>;
|
|
253
|
-
}, z.core.$strip>>;
|
|
254
174
|
export type LeaseLeasedResponseType = z.infer<typeof LeaseLeasedResponse>;
|
|
255
175
|
export type LeasedNumberType = z.infer<typeof LeasedNumber>;
|
|
256
176
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leased.d.ts","sourceRoot":"","sources":["../../../src/services/lease/leased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"leased.d.ts","sourceRoot":"","sources":["../../../src/services/lease/leased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,mBAAmB;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;iBAKxB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BvB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK9B,CAAC;AAKH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAS5D"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
import { NumberCapabilities, NumberHealth, NumberLocation, NumberFormat, NumberData, NumberPricing } from "@/services/lease/available";
|
|
4
3
|
export const LeasedBillingPeriod = z.object({
|
|
5
4
|
/** Lease start timestamp */
|
|
@@ -47,8 +46,6 @@ export const LeaseLeasedResponse = z.object({
|
|
|
47
46
|
/** User's leased numbers */
|
|
48
47
|
numbers: z.array(LeasedNumber)
|
|
49
48
|
});
|
|
50
|
-
// Using the new base response builder
|
|
51
|
-
export const LeaseLeasedResponseBuilder = createResponse(LeaseLeasedResponse);
|
|
52
49
|
/**
|
|
53
50
|
* Gets all phone numbers currently leased by the user
|
|
54
51
|
*
|
|
@@ -106,9 +103,6 @@ export async function _leasedNumbers() {
|
|
|
106
103
|
});
|
|
107
104
|
return this.parse({
|
|
108
105
|
response,
|
|
109
|
-
|
|
110
|
-
sdk: LeaseLeasedResponse,
|
|
111
|
-
raw: LeaseLeasedResponseBuilder.raw
|
|
112
|
-
}
|
|
106
|
+
schema: LeaseLeasedResponse
|
|
113
107
|
});
|
|
114
108
|
}
|
|
@@ -12,16 +12,6 @@ export declare const LeaseTerminateResponse: z.ZodObject<{
|
|
|
12
12
|
}>;
|
|
13
13
|
terminated_at: z.ZodNumber;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
|
-
export declare const LeaseTerminateResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
16
|
-
lease_id: z.ZodString;
|
|
17
|
-
number_id: z.ZodString;
|
|
18
|
-
status: z.ZodEnum<{
|
|
19
|
-
active: "active";
|
|
20
|
-
expired: "expired";
|
|
21
|
-
terminated: "terminated";
|
|
22
|
-
}>;
|
|
23
|
-
terminated_at: z.ZodNumber;
|
|
24
|
-
}, z.core.$strip>>;
|
|
25
15
|
export type LeaseTerminateParams = z.infer<typeof LeaseTerminateRequest>;
|
|
26
16
|
export type LeaseTerminateResponseType = z.infer<typeof LeaseTerminateResponse>;
|
|
27
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminate.d.ts","sourceRoot":"","sources":["../../../src/services/lease/terminate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"terminate.d.ts","sourceRoot":"","sources":["../../../src/services/lease/terminate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;iBAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;iBASjC,CAAC;AAKH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,CAU3F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
export const LeaseTerminateRequest = z.object({
|
|
4
3
|
/** Phone number in E.164 format to terminate lease for */
|
|
5
4
|
number: z.string().regex(/^\+[1-9]\d{1,14}$/, "Phone number must be in E.164 format"),
|
|
@@ -14,8 +13,6 @@ export const LeaseTerminateResponse = z.object({
|
|
|
14
13
|
/** Termination timestamp */
|
|
15
14
|
terminated_at: z.number()
|
|
16
15
|
});
|
|
17
|
-
// Using the new base response builder
|
|
18
|
-
export const LeaseTerminateResponseBuilder = createResponse(LeaseTerminateResponse);
|
|
19
16
|
/**
|
|
20
17
|
* Terminates your lease for a number
|
|
21
18
|
*
|
|
@@ -76,9 +73,6 @@ export async function _leaseTerminate(params) {
|
|
|
76
73
|
});
|
|
77
74
|
return this.parse({
|
|
78
75
|
response,
|
|
79
|
-
|
|
80
|
-
sdk: LeaseTerminateResponse,
|
|
81
|
-
raw: LeaseTerminateResponseBuilder.raw
|
|
82
|
-
}
|
|
76
|
+
schema: LeaseTerminateResponse
|
|
83
77
|
});
|
|
84
78
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ContiguityClient } from "@/client/fetch";
|
|
3
3
|
import type { WithMetadata } from "@/types/metadata";
|
|
4
|
-
import { type
|
|
4
|
+
import { type OTPSendParams, OTPSendResponse } from "./send";
|
|
5
5
|
import { type OTPVerifyParams, OTPVerifyResponse } from "./verify";
|
|
6
6
|
import { type OTPResendParams, OTPResendResponse } from "./resend";
|
|
7
|
-
export type
|
|
7
|
+
export type OTPSendResponseType = z.infer<typeof OTPSendResponse>;
|
|
8
8
|
export type OTPVerifyResponseType = z.infer<typeof OTPVerifyResponse>;
|
|
9
9
|
export type OTPResendResponseType = z.infer<typeof OTPResendResponse>;
|
|
10
10
|
/**
|
|
@@ -14,8 +14,13 @@ export declare class OTPService extends ContiguityClient {
|
|
|
14
14
|
constructor(token: string);
|
|
15
15
|
/**
|
|
16
16
|
* Send a new OTP to the specified phone number
|
|
17
|
+
* @deprecated Use `send()` instead. This method will be removed in a future version.
|
|
17
18
|
*/
|
|
18
|
-
new(params:
|
|
19
|
+
new(params: OTPSendParams): Promise<WithMetadata<OTPSendResponseType>>;
|
|
20
|
+
/**
|
|
21
|
+
* Send a new OTP to the specified phone number
|
|
22
|
+
*/
|
|
23
|
+
send(params: OTPSendParams): Promise<WithMetadata<OTPSendResponseType>>;
|
|
19
24
|
/**
|
|
20
25
|
* Verify an OTP code
|
|
21
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/otp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/otp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAY,KAAK,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAc,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EAAc,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAClE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACtE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEtE;;GAEG;AACH,qBAAa,UAAW,SAAQ,gBAAgB;gBAChC,KAAK,EAAE,MAAM;IAIzB;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAI5E;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IAI7E;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAInF;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;CAGtF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContiguityClient } from "@/client/fetch";
|
|
2
|
-
import {
|
|
2
|
+
import { _otpSend } from "./send";
|
|
3
3
|
import { _otpVerify } from "./verify";
|
|
4
4
|
import { _otpResend } from "./resend";
|
|
5
5
|
/**
|
|
@@ -11,9 +11,16 @@ export class OTPService extends ContiguityClient {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Send a new OTP to the specified phone number
|
|
14
|
+
* @deprecated Use `send()` instead. This method will be removed in a future version.
|
|
14
15
|
*/
|
|
15
16
|
async new(params) {
|
|
16
|
-
return
|
|
17
|
+
return this.send(params);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Send a new OTP to the specified phone number
|
|
21
|
+
*/
|
|
22
|
+
async send(params) {
|
|
23
|
+
return _otpSend.call(this, params);
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
19
26
|
* Verify an OTP code
|
|
@@ -5,9 +5,6 @@ export declare const OTPResendRequest: z.ZodObject<{
|
|
|
5
5
|
export declare const OTPResendResponse: z.ZodObject<{
|
|
6
6
|
resent: z.ZodBoolean;
|
|
7
7
|
}, z.core.$strip>;
|
|
8
|
-
export declare const OTPResendResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
9
|
-
resent: z.ZodBoolean;
|
|
10
|
-
}, z.core.$strip>>;
|
|
11
8
|
export type OTPResendParams = z.infer<typeof OTPResendRequest>;
|
|
12
9
|
export type OTPResendResponse = z.infer<typeof OTPResendResponse>;
|
|
13
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resend.d.ts","sourceRoot":"","sources":["../../../src/services/otp/resend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"resend.d.ts","sourceRoot":"","sources":["../../../src/services/otp/resend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;iBAG3B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;iBAG5B,CAAA;AAKF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAWjF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
export const OTPResendRequest = z.object({
|
|
4
3
|
/** The OTP ID you received when sending the OTP */
|
|
5
4
|
otp_id: z.string().min(1, "OTP ID cannot be empty"),
|
|
@@ -8,8 +7,6 @@ export const OTPResendResponse = z.object({
|
|
|
8
7
|
/** Whether the OTP was resent */
|
|
9
8
|
resent: z.boolean(),
|
|
10
9
|
});
|
|
11
|
-
// Using the new base response builder
|
|
12
|
-
export const OTPResendResponseBuilder = createResponse(OTPResendResponse);
|
|
13
10
|
/**
|
|
14
11
|
* Resends an OTP to the same phone number
|
|
15
12
|
*
|
|
@@ -29,9 +26,6 @@ export async function _otpResend(params) {
|
|
|
29
26
|
});
|
|
30
27
|
return this.parse({
|
|
31
28
|
response,
|
|
32
|
-
|
|
33
|
-
sdk: OTPResendResponse,
|
|
34
|
-
raw: OTPResendResponseBuilder.raw
|
|
35
|
-
}
|
|
29
|
+
schema: OTPResendResponse
|
|
36
30
|
});
|
|
37
31
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const OTPSendRequest: z.ZodObject<{
|
|
3
|
+
to: z.ZodString;
|
|
4
|
+
language: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const OTPSendResponse: z.ZodObject<{
|
|
8
|
+
otp_id: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type OTPSendParams = z.infer<typeof OTPSendRequest>;
|
|
11
|
+
export type OTPSendResponse = z.infer<typeof OTPSendResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Sends a new OTP to the specified phone number
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const response = await contiguity.otp.send({
|
|
18
|
+
* to: "+1234567890",
|
|
19
|
+
* language: "en",
|
|
20
|
+
* name: "My App"
|
|
21
|
+
* });
|
|
22
|
+
* console.log(`OTP ID: ${response.otp_id}`);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function _otpSend(this: any, params: OTPSendParams): Promise<any>;
|
|
26
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/services/otp/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;iBAOzB,CAAA;AAEF,eAAO,MAAM,eAAe;;iBAG1B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;;;;;;;GAYG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAW7E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { E164PhoneNumber } from "@/types/common";
|
|
3
|
+
export const OTPSendRequest = z.object({
|
|
4
|
+
/** Recipient's phone number. Must be in E.164 format */
|
|
5
|
+
to: E164PhoneNumber,
|
|
6
|
+
/** Language of the OTP message */
|
|
7
|
+
language: z.string().min(1, "Language cannot be empty"),
|
|
8
|
+
/** Your app's name (customizes message to 'Your [name] code is...') */
|
|
9
|
+
name: z.string().min(1, "App name cannot be empty"),
|
|
10
|
+
});
|
|
11
|
+
export const OTPSendResponse = z.object({
|
|
12
|
+
/** The OTP's ID. Use it to refer to this verification in the future, such as when verifying the OTP or resending it. */
|
|
13
|
+
otp_id: z.string(),
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Sends a new OTP to the specified phone number
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const response = await contiguity.otp.send({
|
|
21
|
+
* to: "+1234567890",
|
|
22
|
+
* language: "en",
|
|
23
|
+
* name: "My App"
|
|
24
|
+
* });
|
|
25
|
+
* console.log(`OTP ID: ${response.otp_id}`);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export async function _otpSend(params) {
|
|
29
|
+
const validatedParams = OTPSendRequest.parse(params);
|
|
30
|
+
const response = await this.request("/otp/new", {
|
|
31
|
+
method: "POST",
|
|
32
|
+
body: JSON.stringify(validatedParams),
|
|
33
|
+
});
|
|
34
|
+
return this.parse({
|
|
35
|
+
response,
|
|
36
|
+
schema: OTPSendResponse
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -6,9 +6,6 @@ export declare const OTPVerifyRequest: z.ZodObject<{
|
|
|
6
6
|
export declare const OTPVerifyResponse: z.ZodObject<{
|
|
7
7
|
verified: z.ZodBoolean;
|
|
8
8
|
}, z.core.$strip>;
|
|
9
|
-
export declare const OTPVerifyResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
10
|
-
verified: z.ZodBoolean;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
9
|
export type OTPVerifyParams = z.infer<typeof OTPVerifyRequest>;
|
|
13
10
|
export type OTPVerifyResponse = z.infer<typeof OTPVerifyResponse>;
|
|
14
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/services/otp/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/services/otp/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAA;AAEF,eAAO,MAAM,iBAAiB;;iBAG5B,CAAA;AAIF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAWjF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
export const OTPVerifyRequest = z.object({
|
|
4
3
|
/** The OTP ID you received when sending the OTP */
|
|
5
4
|
otp_id: z.string().min(1, "OTP ID cannot be empty"),
|
|
@@ -10,8 +9,6 @@ export const OTPVerifyResponse = z.object({
|
|
|
10
9
|
/** Whether the OTP was verified or not */
|
|
11
10
|
verified: z.boolean(),
|
|
12
11
|
});
|
|
13
|
-
// Using the new base response builder
|
|
14
|
-
export const OTPVerifyResponseBuilder = createResponse(OTPVerifyResponse);
|
|
15
12
|
/**
|
|
16
13
|
* Verifies an OTP code
|
|
17
14
|
*
|
|
@@ -32,9 +29,6 @@ export async function _otpVerify(params) {
|
|
|
32
29
|
});
|
|
33
30
|
return this.parse({
|
|
34
31
|
response,
|
|
35
|
-
|
|
36
|
-
sdk: OTPVerifyResponse,
|
|
37
|
-
raw: OTPVerifyResponseBuilder.raw
|
|
38
|
-
}
|
|
32
|
+
schema: OTPVerifyResponse
|
|
39
33
|
});
|
|
40
34
|
}
|
|
@@ -7,9 +7,6 @@ export declare const TextSendRequest: z.ZodObject<{
|
|
|
7
7
|
export declare const TextResponse: z.ZodObject<{
|
|
8
8
|
message_id: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
10
|
-
export declare const TextSendResponse: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
11
|
-
message_id: z.ZodString;
|
|
12
|
-
}, z.core.$strip>>;
|
|
13
10
|
export type TextSendParams = z.infer<typeof TextSendRequest>;
|
|
14
11
|
export type TextSendResponse = z.infer<typeof TextResponse>;
|
|
15
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/services/text/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/services/text/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe;;;;iBAO1B,CAAA;AAEF,eAAO,MAAM,YAAY;;iBAGvB,CAAA;AAIF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,CAW/E"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
import { E164PhoneNumber, OptionalSenderNumber, MessageContent } from "@/types/common";
|
|
4
3
|
export const TextSendRequest = z.object({
|
|
5
4
|
/** Recipient's phone number. Must be in E.164 format */
|
|
@@ -13,8 +12,6 @@ export const TextResponse = z.object({
|
|
|
13
12
|
/** The message's ID. Use it to refer to this message in the future */
|
|
14
13
|
message_id: z.string(),
|
|
15
14
|
});
|
|
16
|
-
// Using the new base response builder - this replaces the manual Flattened/Raw definitions
|
|
17
|
-
export const TextSendResponse = createResponse(TextResponse);
|
|
18
15
|
/**
|
|
19
16
|
* Sends a text message
|
|
20
17
|
*
|
|
@@ -35,9 +32,6 @@ export async function _textSend(params) {
|
|
|
35
32
|
});
|
|
36
33
|
return this.parse({
|
|
37
34
|
response,
|
|
38
|
-
|
|
39
|
-
sdk: TextResponse,
|
|
40
|
-
raw: TextSendResponse.raw
|
|
41
|
-
}
|
|
35
|
+
schema: TextResponse
|
|
42
36
|
});
|
|
43
37
|
}
|
|
@@ -16,9 +16,6 @@ export declare const WhatsAppSendRequest: z.ZodObject<{
|
|
|
16
16
|
export declare const WhatsAppResponse: z.ZodObject<{
|
|
17
17
|
message_id: z.ZodString;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
-
export declare const WhatsAppSendResponse: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
20
|
-
message_id: z.ZodString;
|
|
21
|
-
}, z.core.$strip>>;
|
|
22
19
|
export type WhatsAppFallbackParams = {
|
|
23
20
|
when: ("whatsapp_unsupported" | "whatsapp_fails")[];
|
|
24
21
|
from?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/services/whatsapp/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/services/whatsapp/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;iBAW9B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;iBAG3B,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,CAAC,sBAAsB,GAAG,gBAAgB,CAAC,EAAE,CAAC;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,CAWvF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
import { E164PhoneNumber, OptionalSenderNumber, MessageContent, AttachmentList, createFallbackSchema } from "@/types/common";
|
|
4
3
|
export const WhatsAppSendRequest = z.object({
|
|
5
4
|
/** Recipient's WhatsApp number. Must be in E.164 format */
|
|
@@ -17,8 +16,6 @@ export const WhatsAppResponse = z.object({
|
|
|
17
16
|
/** The message's ID. Use it to refer to this message in the future, when checking the status of the message or finding it in the Console */
|
|
18
17
|
message_id: z.string(),
|
|
19
18
|
});
|
|
20
|
-
// Using the new base response builder - this replaces the manual Flattened/Raw definitions
|
|
21
|
-
export const WhatsAppSendResponse = createResponse(WhatsAppResponse);
|
|
22
19
|
/**
|
|
23
20
|
* Sends a WhatsApp message
|
|
24
21
|
*
|
|
@@ -58,9 +55,6 @@ export async function _whatsAppSend(params) {
|
|
|
58
55
|
});
|
|
59
56
|
return this.parse({
|
|
60
57
|
response,
|
|
61
|
-
|
|
62
|
-
sdk: WhatsAppResponse,
|
|
63
|
-
raw: WhatsAppSendResponse.raw
|
|
64
|
-
}
|
|
58
|
+
schema: WhatsAppResponse
|
|
65
59
|
});
|
|
66
60
|
}
|
|
@@ -10,9 +10,6 @@ export declare const WhatsAppTypingRequest: z.ZodObject<{
|
|
|
10
10
|
export declare const WhatsAppTypingResponse: z.ZodObject<{
|
|
11
11
|
status: z.ZodString;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
-
export declare const WhatsAppTypingResponseBuilder: import("@/types/base").BaseResponseBuilder<z.ZodObject<{
|
|
14
|
-
status: z.ZodString;
|
|
15
|
-
}, z.core.$strip>>;
|
|
16
13
|
export type WhatsAppTypingParams = z.infer<typeof WhatsAppTypingRequest>;
|
|
17
14
|
export type WhatsAppTypingResponseType = z.infer<typeof WhatsAppTypingResponse>;
|
|
18
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../../../src/services/whatsapp/typing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"typing.d.ts","sourceRoot":"","sources":["../../../src/services/whatsapp/typing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;iBAOhC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;iBAGjC,CAAA;AAKF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC,CAW3F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { createResponse } from "@/types/base";
|
|
3
2
|
import { E164PhoneNumber, OptionalSenderNumber, TypingAction } from "@/types/common";
|
|
4
3
|
export const WhatsAppTypingRequest = z.object({
|
|
5
4
|
/** Recipient's WhatsApp number. Must be in E.164 format */
|
|
@@ -13,8 +12,6 @@ export const WhatsAppTypingResponse = z.object({
|
|
|
13
12
|
/** Status of the typing indicator */
|
|
14
13
|
status: z.string(),
|
|
15
14
|
});
|
|
16
|
-
// Using the new base response builder
|
|
17
|
-
export const WhatsAppTypingResponseBuilder = createResponse(WhatsAppTypingResponse);
|
|
18
15
|
/**
|
|
19
16
|
* Start or stop sending typing indicators over WhatsApp
|
|
20
17
|
*
|
|
@@ -47,9 +44,6 @@ export async function _whatsAppTyping(params) {
|
|
|
47
44
|
});
|
|
48
45
|
return this.parse({
|
|
49
46
|
response,
|
|
50
|
-
|
|
51
|
-
sdk: WhatsAppTypingResponse,
|
|
52
|
-
raw: WhatsAppTypingResponseBuilder.raw
|
|
53
|
-
}
|
|
47
|
+
schema: WhatsAppTypingResponse
|
|
54
48
|
});
|
|
55
49
|
}
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
|
-
* Base response builder that automatically creates
|
|
4
|
-
* This
|
|
3
|
+
* Base response builder that automatically creates typed responses with metadata
|
|
4
|
+
* This creates flattened responses where the data is combined with metadata
|
|
5
5
|
*/
|
|
6
6
|
export declare class BaseResponseBuilder<T extends z.ZodObject<any>> {
|
|
7
7
|
readonly schema: T;
|
|
@@ -10,29 +10,8 @@ export declare class BaseResponseBuilder<T extends z.ZodObject<any>> {
|
|
|
10
10
|
get flattened(): z.ZodObject<{
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
-
get raw(): z.ZodObject<{
|
|
14
|
-
id: z.ZodString;
|
|
15
|
-
timestamp: z.ZodNumber;
|
|
16
|
-
api_version: z.ZodString;
|
|
17
|
-
object: z.ZodString;
|
|
18
|
-
data: T;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
get all(): {
|
|
21
|
-
response: T;
|
|
22
|
-
flattened: z.ZodObject<{
|
|
23
|
-
[x: string]: any;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
raw: z.ZodObject<{
|
|
26
|
-
id: z.ZodString;
|
|
27
|
-
timestamp: z.ZodNumber;
|
|
28
|
-
api_version: z.ZodString;
|
|
29
|
-
object: z.ZodString;
|
|
30
|
-
data: T;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
};
|
|
33
13
|
}
|
|
34
14
|
export declare function createResponse<T extends z.ZodObject<any>>(schema: T): BaseResponseBuilder<T>;
|
|
35
15
|
export type BaseResponse<T extends BaseResponseBuilder<any>> = z.infer<T['response']>;
|
|
36
16
|
export type FlattenedResponse<T extends BaseResponseBuilder<any>> = z.infer<T['flattened']>;
|
|
37
|
-
export type RawResponse<T extends BaseResponseBuilder<any>> = z.infer<T['raw']>;
|
|
38
17
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/types/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;aAC3B,MAAM,EAAE,CAAC;gBAAT,MAAM,EAAE,CAAC;IAErC,IAAI,QAAQ,MAEX;IAED,IAAI,SAAS;;sBAEZ;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;aAC3B,MAAM,EAAE,CAAC;gBAAT,MAAM,EAAE,CAAC;IAErC,IAAI,QAAQ,MAEX;IAED,IAAI,SAAS;;sBAEZ;CACJ;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,0BAEnE;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AACtF,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/types/base.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ContiguityResponse
|
|
1
|
+
import { ContiguityResponse } from "@/types/response";
|
|
2
2
|
/**
|
|
3
|
-
* Base response builder that automatically creates
|
|
4
|
-
* This
|
|
3
|
+
* Base response builder that automatically creates typed responses with metadata
|
|
4
|
+
* This creates flattened responses where the data is combined with metadata
|
|
5
5
|
*/
|
|
6
6
|
export class BaseResponseBuilder {
|
|
7
7
|
schema;
|
|
@@ -14,18 +14,6 @@ export class BaseResponseBuilder {
|
|
|
14
14
|
get flattened() {
|
|
15
15
|
return ContiguityResponse.extend(this.schema.shape);
|
|
16
16
|
}
|
|
17
|
-
get raw() {
|
|
18
|
-
return ContiguityRawResponse.extend({
|
|
19
|
-
data: this.schema,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
get all() {
|
|
23
|
-
return {
|
|
24
|
-
response: this.response,
|
|
25
|
-
flattened: this.flattened,
|
|
26
|
-
raw: this.raw,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
17
|
}
|
|
30
18
|
export function createResponse(schema) {
|
|
31
19
|
return new BaseResponseBuilder(schema);
|
package/dist/types/response.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const ContiguityRawResponse: z.ZodObject<{
|
|
3
|
-
id: z.ZodString;
|
|
4
|
-
timestamp: z.ZodNumber;
|
|
5
|
-
api_version: z.ZodString;
|
|
6
|
-
object: z.ZodString;
|
|
7
|
-
data: z.ZodAny;
|
|
8
|
-
}, z.core.$strip>;
|
|
9
2
|
export declare const ContiguityResponse: z.ZodObject<{
|
|
10
3
|
metadata: z.ZodObject<{
|
|
11
4
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/types/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/types/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;iBAQ7B,CAAC"}
|
package/dist/types/response.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const ContiguityRawResponse = z.object({
|
|
3
|
-
id: z.string(),
|
|
4
|
-
timestamp: z.number(),
|
|
5
|
-
api_version: z.string(),
|
|
6
|
-
object: z.string(),
|
|
7
|
-
data: z.any(),
|
|
8
|
-
});
|
|
9
2
|
export const ContiguityResponse = z.object({
|
|
10
3
|
metadata: z.object({
|
|
11
4
|
id: z.string(),
|