ce-storefront 0.15.7 → 0.15.8
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/README.md +2 -21
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/index.d.ts +0 -2
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +0 -2
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/operations/index.d.ts +0 -8
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +0 -8
- package/esm/models/operations/index.js.map +1 -1
- package/esm/sdk/sdk.d.ts +0 -3
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +0 -4
- package/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/index.ts +0 -2
- package/src/models/operations/index.ts +0 -8
- package/src/sdk/sdk.ts +0 -6
- package/docs/sdks/pos/README.md +0 -610
- package/esm/funcs/posCreatePosCart.d.ts +0 -17
- package/esm/funcs/posCreatePosCart.d.ts.map +0 -1
- package/esm/funcs/posCreatePosCart.js +0 -80
- package/esm/funcs/posCreatePosCart.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithEmail.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithEmail.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithEmail.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithEmail.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithPhone.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithPhone.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithPhone.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithPhone.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.js.map +0 -1
- package/esm/funcs/posPairPosDevice.d.ts +0 -17
- package/esm/funcs/posPairPosDevice.d.ts.map +0 -1
- package/esm/funcs/posPairPosDevice.js +0 -84
- package/esm/funcs/posPairPosDevice.js.map +0 -1
- package/esm/funcs/posRefreshPosAccessToken.d.ts +0 -17
- package/esm/funcs/posRefreshPosAccessToken.d.ts.map +0 -1
- package/esm/funcs/posRefreshPosAccessToken.js +0 -81
- package/esm/funcs/posRefreshPosAccessToken.js.map +0 -1
- package/esm/funcs/posUpdatePosCart.d.ts +0 -17
- package/esm/funcs/posUpdatePosCart.d.ts.map +0 -1
- package/esm/funcs/posUpdatePosCart.js +0 -84
- package/esm/funcs/posUpdatePosCart.js.map +0 -1
- package/esm/funcs/posVerifyPosLoginOtp.d.ts +0 -17
- package/esm/funcs/posVerifyPosLoginOtp.d.ts.map +0 -1
- package/esm/funcs/posVerifyPosLoginOtp.js +0 -84
- package/esm/funcs/posVerifyPosLoginOtp.js.map +0 -1
- package/esm/models/components/posdevice.d.ts +0 -71
- package/esm/models/components/posdevice.d.ts.map +0 -1
- package/esm/models/components/posdevice.js +0 -85
- package/esm/models/components/posdevice.js.map +0 -1
- package/esm/models/components/posuser.d.ts +0 -124
- package/esm/models/components/posuser.d.ts.map +0 -1
- package/esm/models/components/posuser.js +0 -139
- package/esm/models/components/posuser.js.map +0 -1
- package/esm/models/operations/createposcart.d.ts +0 -90
- package/esm/models/operations/createposcart.d.ts.map +0 -1
- package/esm/models/operations/createposcart.js +0 -86
- package/esm/models/operations/createposcart.js.map +0 -1
- package/esm/models/operations/loginposdevicewithemail.d.ts +0 -138
- package/esm/models/operations/loginposdevicewithemail.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithemail.js +0 -159
- package/esm/models/operations/loginposdevicewithemail.js.map +0 -1
- package/esm/models/operations/loginposdevicewithphone.d.ts +0 -146
- package/esm/models/operations/loginposdevicewithphone.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithphone.js +0 -163
- package/esm/models/operations/loginposdevicewithphone.js.map +0 -1
- package/esm/models/operations/loginposdevicewithwhatsapp.d.ts +0 -146
- package/esm/models/operations/loginposdevicewithwhatsapp.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithwhatsapp.js +0 -163
- package/esm/models/operations/loginposdevicewithwhatsapp.js.map +0 -1
- package/esm/models/operations/pairposdevice.d.ts +0 -112
- package/esm/models/operations/pairposdevice.d.ts.map +0 -1
- package/esm/models/operations/pairposdevice.js +0 -128
- package/esm/models/operations/pairposdevice.js.map +0 -1
- package/esm/models/operations/refreshposaccesstoken.d.ts +0 -88
- package/esm/models/operations/refreshposaccesstoken.d.ts.map +0 -1
- package/esm/models/operations/refreshposaccesstoken.js +0 -106
- package/esm/models/operations/refreshposaccesstoken.js.map +0 -1
- package/esm/models/operations/updateposcart.d.ts +0 -120
- package/esm/models/operations/updateposcart.d.ts.map +0 -1
- package/esm/models/operations/updateposcart.js +0 -122
- package/esm/models/operations/updateposcart.js.map +0 -1
- package/esm/models/operations/verifyposloginotp.d.ts +0 -158
- package/esm/models/operations/verifyposloginotp.d.ts.map +0 -1
- package/esm/models/operations/verifyposloginotp.js +0 -169
- package/esm/models/operations/verifyposloginotp.js.map +0 -1
- package/esm/sdk/pos.d.ts +0 -61
- package/esm/sdk/pos.d.ts.map +0 -1
- package/esm/sdk/pos.js +0 -88
- package/esm/sdk/pos.js.map +0 -1
- package/src/funcs/posCreatePosCart.ts +0 -165
- package/src/funcs/posLoginPosDeviceWithEmail.ts +0 -173
- package/src/funcs/posLoginPosDeviceWithPhone.ts +0 -173
- package/src/funcs/posLoginPosDeviceWithWhatsapp.ts +0 -176
- package/src/funcs/posPairPosDevice.ts +0 -174
- package/src/funcs/posRefreshPosAccessToken.ts +0 -164
- package/src/funcs/posUpdatePosCart.ts +0 -167
- package/src/funcs/posVerifyPosLoginOtp.ts +0 -174
- package/src/models/components/posdevice.ts +0 -141
- package/src/models/components/posuser.ts +0 -263
- package/src/models/operations/createposcart.ts +0 -197
- package/src/models/operations/loginposdevicewithemail.ts +0 -328
- package/src/models/operations/loginposdevicewithphone.ts +0 -340
- package/src/models/operations/loginposdevicewithwhatsapp.ts +0 -347
- package/src/models/operations/pairposdevice.ts +0 -269
- package/src/models/operations/refreshposaccesstoken.ts +0 -223
- package/src/models/operations/updateposcart.ts +0 -271
- package/src/models/operations/verifyposloginotp.ts +0 -345
- package/src/sdk/pos.ts +0 -163
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { CeStorefrontCore } from "../core.js";
|
|
6
|
-
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
-
import * as M from "../lib/matchers.js";
|
|
8
|
-
import { compactMap } from "../lib/primitives.js";
|
|
9
|
-
import { safeParse } from "../lib/schemas.js";
|
|
10
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
-
import { resolveSecurity } from "../lib/security.js";
|
|
12
|
-
import { pathToFunc } from "../lib/url.js";
|
|
13
|
-
import { CeStorefrontError } from "../models/errors/cestorefronterror.js";
|
|
14
|
-
import {
|
|
15
|
-
ConnectionError,
|
|
16
|
-
InvalidRequestError,
|
|
17
|
-
RequestAbortedError,
|
|
18
|
-
RequestTimeoutError,
|
|
19
|
-
UnexpectedClientError,
|
|
20
|
-
} from "../models/errors/httpclienterrors.js";
|
|
21
|
-
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
-
import * as operations from "../models/operations/index.js";
|
|
24
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
-
import { Result } from "../types/fp.js";
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Verify OTP
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Verify POS login otp.
|
|
32
|
-
*/
|
|
33
|
-
export function posVerifyPosLoginOtp(
|
|
34
|
-
client: CeStorefrontCore,
|
|
35
|
-
security: operations.VerifyPosLoginOtpSecurity,
|
|
36
|
-
request?: operations.VerifyPosLoginOtpRequestBody | undefined,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): APIPromise<
|
|
39
|
-
Result<
|
|
40
|
-
operations.VerifyPosLoginOtpResponseBody,
|
|
41
|
-
| CeStorefrontError
|
|
42
|
-
| ResponseValidationError
|
|
43
|
-
| ConnectionError
|
|
44
|
-
| RequestAbortedError
|
|
45
|
-
| RequestTimeoutError
|
|
46
|
-
| InvalidRequestError
|
|
47
|
-
| UnexpectedClientError
|
|
48
|
-
| SDKValidationError
|
|
49
|
-
>
|
|
50
|
-
> {
|
|
51
|
-
return new APIPromise($do(
|
|
52
|
-
client,
|
|
53
|
-
security,
|
|
54
|
-
request,
|
|
55
|
-
options,
|
|
56
|
-
));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function $do(
|
|
60
|
-
client: CeStorefrontCore,
|
|
61
|
-
security: operations.VerifyPosLoginOtpSecurity,
|
|
62
|
-
request?: operations.VerifyPosLoginOtpRequestBody | undefined,
|
|
63
|
-
options?: RequestOptions,
|
|
64
|
-
): Promise<
|
|
65
|
-
[
|
|
66
|
-
Result<
|
|
67
|
-
operations.VerifyPosLoginOtpResponseBody,
|
|
68
|
-
| CeStorefrontError
|
|
69
|
-
| ResponseValidationError
|
|
70
|
-
| ConnectionError
|
|
71
|
-
| RequestAbortedError
|
|
72
|
-
| RequestTimeoutError
|
|
73
|
-
| InvalidRequestError
|
|
74
|
-
| UnexpectedClientError
|
|
75
|
-
| SDKValidationError
|
|
76
|
-
>,
|
|
77
|
-
APICall,
|
|
78
|
-
]
|
|
79
|
-
> {
|
|
80
|
-
const parsed = safeParse(
|
|
81
|
-
request,
|
|
82
|
-
(value) =>
|
|
83
|
-
operations.VerifyPosLoginOtpRequestBody$outboundSchema.optional().parse(
|
|
84
|
-
value,
|
|
85
|
-
),
|
|
86
|
-
"Input validation failed",
|
|
87
|
-
);
|
|
88
|
-
if (!parsed.ok) {
|
|
89
|
-
return [parsed, { status: "invalid" }];
|
|
90
|
-
}
|
|
91
|
-
const payload = parsed.value;
|
|
92
|
-
const body = payload === undefined
|
|
93
|
-
? null
|
|
94
|
-
: encodeJSON("body", payload, { explode: true });
|
|
95
|
-
|
|
96
|
-
const path = pathToFunc("/pos/auth/verify-otp")();
|
|
97
|
-
|
|
98
|
-
const headers = new Headers(compactMap({
|
|
99
|
-
"Content-Type": "application/json",
|
|
100
|
-
Accept: "application/json",
|
|
101
|
-
}));
|
|
102
|
-
|
|
103
|
-
const requestSecurity = resolveSecurity(
|
|
104
|
-
[
|
|
105
|
-
{
|
|
106
|
-
fieldName: "X-Api-Key",
|
|
107
|
-
type: "apiKey:header",
|
|
108
|
-
value: security?.xApiKey,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const context = {
|
|
114
|
-
options: client._options,
|
|
115
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
-
operationID: "verify-pos-login-otp",
|
|
117
|
-
oAuth2Scopes: null,
|
|
118
|
-
|
|
119
|
-
resolvedSecurity: requestSecurity,
|
|
120
|
-
|
|
121
|
-
securitySource: security,
|
|
122
|
-
retryConfig: options?.retries
|
|
123
|
-
|| client._options.retryConfig
|
|
124
|
-
|| { strategy: "none" },
|
|
125
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const requestRes = client._createRequest(context, {
|
|
129
|
-
security: requestSecurity,
|
|
130
|
-
method: "POST",
|
|
131
|
-
baseURL: options?.serverURL,
|
|
132
|
-
path: path,
|
|
133
|
-
headers: headers,
|
|
134
|
-
body: body,
|
|
135
|
-
userAgent: client._options.userAgent,
|
|
136
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
137
|
-
}, options);
|
|
138
|
-
if (!requestRes.ok) {
|
|
139
|
-
return [requestRes, { status: "invalid" }];
|
|
140
|
-
}
|
|
141
|
-
const req = requestRes.value;
|
|
142
|
-
|
|
143
|
-
const doResult = await client._do(req, {
|
|
144
|
-
context,
|
|
145
|
-
errorCodes: ["4XX", "5XX"],
|
|
146
|
-
retryConfig: context.retryConfig,
|
|
147
|
-
retryCodes: context.retryCodes,
|
|
148
|
-
});
|
|
149
|
-
if (!doResult.ok) {
|
|
150
|
-
return [doResult, { status: "request-error", request: req }];
|
|
151
|
-
}
|
|
152
|
-
const response = doResult.value;
|
|
153
|
-
|
|
154
|
-
const [result] = await M.match<
|
|
155
|
-
operations.VerifyPosLoginOtpResponseBody,
|
|
156
|
-
| CeStorefrontError
|
|
157
|
-
| ResponseValidationError
|
|
158
|
-
| ConnectionError
|
|
159
|
-
| RequestAbortedError
|
|
160
|
-
| RequestTimeoutError
|
|
161
|
-
| InvalidRequestError
|
|
162
|
-
| UnexpectedClientError
|
|
163
|
-
| SDKValidationError
|
|
164
|
-
>(
|
|
165
|
-
M.json(200, operations.VerifyPosLoginOtpResponseBody$inboundSchema),
|
|
166
|
-
M.fail("4XX"),
|
|
167
|
-
M.fail("5XX"),
|
|
168
|
-
)(response, req);
|
|
169
|
-
if (!result.ok) {
|
|
170
|
-
return [result, { status: "complete", request: req, response }];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return [result, { status: "complete", request: req, response }];
|
|
174
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
-
|
|
12
|
-
export const DeviceType = {
|
|
13
|
-
POSTerminal: "POS Terminal",
|
|
14
|
-
} as const;
|
|
15
|
-
export type DeviceType = ClosedEnum<typeof DeviceType>;
|
|
16
|
-
|
|
17
|
-
export type PosDevice = {
|
|
18
|
-
id?: string | undefined;
|
|
19
|
-
name?: string | undefined;
|
|
20
|
-
deviceType?: DeviceType | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* A Device ID for an app.
|
|
23
|
-
*/
|
|
24
|
-
externalDeviceId?: string | undefined;
|
|
25
|
-
manufacturer?: string | undefined;
|
|
26
|
-
modelNumber?: string | undefined;
|
|
27
|
-
macAddress?: string | null | undefined;
|
|
28
|
-
locationId?: string | undefined;
|
|
29
|
-
locationName?: string | undefined;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/** @internal */
|
|
33
|
-
export const DeviceType$inboundSchema: z.ZodNativeEnum<typeof DeviceType> = z
|
|
34
|
-
.nativeEnum(DeviceType);
|
|
35
|
-
|
|
36
|
-
/** @internal */
|
|
37
|
-
export const DeviceType$outboundSchema: z.ZodNativeEnum<typeof DeviceType> =
|
|
38
|
-
DeviceType$inboundSchema;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @internal
|
|
42
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
-
*/
|
|
44
|
-
export namespace DeviceType$ {
|
|
45
|
-
/** @deprecated use `DeviceType$inboundSchema` instead. */
|
|
46
|
-
export const inboundSchema = DeviceType$inboundSchema;
|
|
47
|
-
/** @deprecated use `DeviceType$outboundSchema` instead. */
|
|
48
|
-
export const outboundSchema = DeviceType$outboundSchema;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** @internal */
|
|
52
|
-
export const PosDevice$inboundSchema: z.ZodType<
|
|
53
|
-
PosDevice,
|
|
54
|
-
z.ZodTypeDef,
|
|
55
|
-
unknown
|
|
56
|
-
> = z.object({
|
|
57
|
-
id: z.string().optional(),
|
|
58
|
-
name: z.string().optional(),
|
|
59
|
-
device_type: DeviceType$inboundSchema.optional(),
|
|
60
|
-
external_device_id: z.string().optional(),
|
|
61
|
-
manufacturer: z.string().optional(),
|
|
62
|
-
model_number: z.string().optional(),
|
|
63
|
-
mac_address: z.nullable(z.string()).optional(),
|
|
64
|
-
location_id: z.string().optional(),
|
|
65
|
-
location_name: z.string().optional(),
|
|
66
|
-
}).transform((v) => {
|
|
67
|
-
return remap$(v, {
|
|
68
|
-
"device_type": "deviceType",
|
|
69
|
-
"external_device_id": "externalDeviceId",
|
|
70
|
-
"model_number": "modelNumber",
|
|
71
|
-
"mac_address": "macAddress",
|
|
72
|
-
"location_id": "locationId",
|
|
73
|
-
"location_name": "locationName",
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
/** @internal */
|
|
78
|
-
export type PosDevice$Outbound = {
|
|
79
|
-
id?: string | undefined;
|
|
80
|
-
name?: string | undefined;
|
|
81
|
-
device_type?: string | undefined;
|
|
82
|
-
external_device_id?: string | undefined;
|
|
83
|
-
manufacturer?: string | undefined;
|
|
84
|
-
model_number?: string | undefined;
|
|
85
|
-
mac_address?: string | null | undefined;
|
|
86
|
-
location_id?: string | undefined;
|
|
87
|
-
location_name?: string | undefined;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/** @internal */
|
|
91
|
-
export const PosDevice$outboundSchema: z.ZodType<
|
|
92
|
-
PosDevice$Outbound,
|
|
93
|
-
z.ZodTypeDef,
|
|
94
|
-
PosDevice
|
|
95
|
-
> = z.object({
|
|
96
|
-
id: z.string().optional(),
|
|
97
|
-
name: z.string().optional(),
|
|
98
|
-
deviceType: DeviceType$outboundSchema.optional(),
|
|
99
|
-
externalDeviceId: z.string().optional(),
|
|
100
|
-
manufacturer: z.string().optional(),
|
|
101
|
-
modelNumber: z.string().optional(),
|
|
102
|
-
macAddress: z.nullable(z.string()).optional(),
|
|
103
|
-
locationId: z.string().optional(),
|
|
104
|
-
locationName: z.string().optional(),
|
|
105
|
-
}).transform((v) => {
|
|
106
|
-
return remap$(v, {
|
|
107
|
-
deviceType: "device_type",
|
|
108
|
-
externalDeviceId: "external_device_id",
|
|
109
|
-
modelNumber: "model_number",
|
|
110
|
-
macAddress: "mac_address",
|
|
111
|
-
locationId: "location_id",
|
|
112
|
-
locationName: "location_name",
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @internal
|
|
118
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
119
|
-
*/
|
|
120
|
-
export namespace PosDevice$ {
|
|
121
|
-
/** @deprecated use `PosDevice$inboundSchema` instead. */
|
|
122
|
-
export const inboundSchema = PosDevice$inboundSchema;
|
|
123
|
-
/** @deprecated use `PosDevice$outboundSchema` instead. */
|
|
124
|
-
export const outboundSchema = PosDevice$outboundSchema;
|
|
125
|
-
/** @deprecated use `PosDevice$Outbound` instead. */
|
|
126
|
-
export type Outbound = PosDevice$Outbound;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function posDeviceToJSON(posDevice: PosDevice): string {
|
|
130
|
-
return JSON.stringify(PosDevice$outboundSchema.parse(posDevice));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function posDeviceFromJSON(
|
|
134
|
-
jsonString: string,
|
|
135
|
-
): SafeParseResult<PosDevice, SDKValidationError> {
|
|
136
|
-
return safeParse(
|
|
137
|
-
jsonString,
|
|
138
|
-
(x) => PosDevice$inboundSchema.parse(JSON.parse(x)),
|
|
139
|
-
`Failed to parse 'PosDevice' from JSON`,
|
|
140
|
-
);
|
|
141
|
-
}
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
-
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
-
|
|
11
|
-
export type Device = {
|
|
12
|
-
id?: string | undefined;
|
|
13
|
-
name?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export type Location = {
|
|
17
|
-
id?: string | undefined;
|
|
18
|
-
name?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export type Role = {
|
|
22
|
-
id?: string | undefined;
|
|
23
|
-
name?: string | undefined;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type PosUser = {
|
|
27
|
-
id?: string | undefined;
|
|
28
|
-
firstName?: string | undefined;
|
|
29
|
-
lastName?: string | null | undefined;
|
|
30
|
-
phone?: string | undefined;
|
|
31
|
-
email?: string | undefined;
|
|
32
|
-
device?: Device | undefined;
|
|
33
|
-
location?: Location | undefined;
|
|
34
|
-
role?: Role | undefined;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** @internal */
|
|
38
|
-
export const Device$inboundSchema: z.ZodType<Device, z.ZodTypeDef, unknown> = z
|
|
39
|
-
.object({
|
|
40
|
-
id: z.string().optional(),
|
|
41
|
-
name: z.string().optional(),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
/** @internal */
|
|
45
|
-
export type Device$Outbound = {
|
|
46
|
-
id?: string | undefined;
|
|
47
|
-
name?: string | undefined;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export const Device$outboundSchema: z.ZodType<
|
|
52
|
-
Device$Outbound,
|
|
53
|
-
z.ZodTypeDef,
|
|
54
|
-
Device
|
|
55
|
-
> = z.object({
|
|
56
|
-
id: z.string().optional(),
|
|
57
|
-
name: z.string().optional(),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @internal
|
|
62
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
63
|
-
*/
|
|
64
|
-
export namespace Device$ {
|
|
65
|
-
/** @deprecated use `Device$inboundSchema` instead. */
|
|
66
|
-
export const inboundSchema = Device$inboundSchema;
|
|
67
|
-
/** @deprecated use `Device$outboundSchema` instead. */
|
|
68
|
-
export const outboundSchema = Device$outboundSchema;
|
|
69
|
-
/** @deprecated use `Device$Outbound` instead. */
|
|
70
|
-
export type Outbound = Device$Outbound;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function deviceToJSON(device: Device): string {
|
|
74
|
-
return JSON.stringify(Device$outboundSchema.parse(device));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function deviceFromJSON(
|
|
78
|
-
jsonString: string,
|
|
79
|
-
): SafeParseResult<Device, SDKValidationError> {
|
|
80
|
-
return safeParse(
|
|
81
|
-
jsonString,
|
|
82
|
-
(x) => Device$inboundSchema.parse(JSON.parse(x)),
|
|
83
|
-
`Failed to parse 'Device' from JSON`,
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** @internal */
|
|
88
|
-
export const Location$inboundSchema: z.ZodType<
|
|
89
|
-
Location,
|
|
90
|
-
z.ZodTypeDef,
|
|
91
|
-
unknown
|
|
92
|
-
> = z.object({
|
|
93
|
-
id: z.string().optional(),
|
|
94
|
-
name: z.string().optional(),
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
/** @internal */
|
|
98
|
-
export type Location$Outbound = {
|
|
99
|
-
id?: string | undefined;
|
|
100
|
-
name?: string | undefined;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/** @internal */
|
|
104
|
-
export const Location$outboundSchema: z.ZodType<
|
|
105
|
-
Location$Outbound,
|
|
106
|
-
z.ZodTypeDef,
|
|
107
|
-
Location
|
|
108
|
-
> = z.object({
|
|
109
|
-
id: z.string().optional(),
|
|
110
|
-
name: z.string().optional(),
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @internal
|
|
115
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
116
|
-
*/
|
|
117
|
-
export namespace Location$ {
|
|
118
|
-
/** @deprecated use `Location$inboundSchema` instead. */
|
|
119
|
-
export const inboundSchema = Location$inboundSchema;
|
|
120
|
-
/** @deprecated use `Location$outboundSchema` instead. */
|
|
121
|
-
export const outboundSchema = Location$outboundSchema;
|
|
122
|
-
/** @deprecated use `Location$Outbound` instead. */
|
|
123
|
-
export type Outbound = Location$Outbound;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function locationToJSON(location: Location): string {
|
|
127
|
-
return JSON.stringify(Location$outboundSchema.parse(location));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function locationFromJSON(
|
|
131
|
-
jsonString: string,
|
|
132
|
-
): SafeParseResult<Location, SDKValidationError> {
|
|
133
|
-
return safeParse(
|
|
134
|
-
jsonString,
|
|
135
|
-
(x) => Location$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
-
`Failed to parse 'Location' from JSON`,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** @internal */
|
|
141
|
-
export const Role$inboundSchema: z.ZodType<Role, z.ZodTypeDef, unknown> = z
|
|
142
|
-
.object({
|
|
143
|
-
id: z.string().optional(),
|
|
144
|
-
name: z.string().optional(),
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
/** @internal */
|
|
148
|
-
export type Role$Outbound = {
|
|
149
|
-
id?: string | undefined;
|
|
150
|
-
name?: string | undefined;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/** @internal */
|
|
154
|
-
export const Role$outboundSchema: z.ZodType<Role$Outbound, z.ZodTypeDef, Role> =
|
|
155
|
-
z.object({
|
|
156
|
-
id: z.string().optional(),
|
|
157
|
-
name: z.string().optional(),
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
163
|
-
*/
|
|
164
|
-
export namespace Role$ {
|
|
165
|
-
/** @deprecated use `Role$inboundSchema` instead. */
|
|
166
|
-
export const inboundSchema = Role$inboundSchema;
|
|
167
|
-
/** @deprecated use `Role$outboundSchema` instead. */
|
|
168
|
-
export const outboundSchema = Role$outboundSchema;
|
|
169
|
-
/** @deprecated use `Role$Outbound` instead. */
|
|
170
|
-
export type Outbound = Role$Outbound;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export function roleToJSON(role: Role): string {
|
|
174
|
-
return JSON.stringify(Role$outboundSchema.parse(role));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export function roleFromJSON(
|
|
178
|
-
jsonString: string,
|
|
179
|
-
): SafeParseResult<Role, SDKValidationError> {
|
|
180
|
-
return safeParse(
|
|
181
|
-
jsonString,
|
|
182
|
-
(x) => Role$inboundSchema.parse(JSON.parse(x)),
|
|
183
|
-
`Failed to parse 'Role' from JSON`,
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/** @internal */
|
|
188
|
-
export const PosUser$inboundSchema: z.ZodType<PosUser, z.ZodTypeDef, unknown> =
|
|
189
|
-
z.object({
|
|
190
|
-
id: z.string().optional(),
|
|
191
|
-
first_name: z.string().optional(),
|
|
192
|
-
last_name: z.nullable(z.string()).optional(),
|
|
193
|
-
phone: z.string().optional(),
|
|
194
|
-
email: z.string().optional(),
|
|
195
|
-
device: z.lazy(() => Device$inboundSchema).optional(),
|
|
196
|
-
location: z.lazy(() => Location$inboundSchema).optional(),
|
|
197
|
-
role: z.lazy(() => Role$inboundSchema).optional(),
|
|
198
|
-
}).transform((v) => {
|
|
199
|
-
return remap$(v, {
|
|
200
|
-
"first_name": "firstName",
|
|
201
|
-
"last_name": "lastName",
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
/** @internal */
|
|
206
|
-
export type PosUser$Outbound = {
|
|
207
|
-
id?: string | undefined;
|
|
208
|
-
first_name?: string | undefined;
|
|
209
|
-
last_name?: string | null | undefined;
|
|
210
|
-
phone?: string | undefined;
|
|
211
|
-
email?: string | undefined;
|
|
212
|
-
device?: Device$Outbound | undefined;
|
|
213
|
-
location?: Location$Outbound | undefined;
|
|
214
|
-
role?: Role$Outbound | undefined;
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/** @internal */
|
|
218
|
-
export const PosUser$outboundSchema: z.ZodType<
|
|
219
|
-
PosUser$Outbound,
|
|
220
|
-
z.ZodTypeDef,
|
|
221
|
-
PosUser
|
|
222
|
-
> = z.object({
|
|
223
|
-
id: z.string().optional(),
|
|
224
|
-
firstName: z.string().optional(),
|
|
225
|
-
lastName: z.nullable(z.string()).optional(),
|
|
226
|
-
phone: z.string().optional(),
|
|
227
|
-
email: z.string().optional(),
|
|
228
|
-
device: z.lazy(() => Device$outboundSchema).optional(),
|
|
229
|
-
location: z.lazy(() => Location$outboundSchema).optional(),
|
|
230
|
-
role: z.lazy(() => Role$outboundSchema).optional(),
|
|
231
|
-
}).transform((v) => {
|
|
232
|
-
return remap$(v, {
|
|
233
|
-
firstName: "first_name",
|
|
234
|
-
lastName: "last_name",
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* @internal
|
|
240
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
241
|
-
*/
|
|
242
|
-
export namespace PosUser$ {
|
|
243
|
-
/** @deprecated use `PosUser$inboundSchema` instead. */
|
|
244
|
-
export const inboundSchema = PosUser$inboundSchema;
|
|
245
|
-
/** @deprecated use `PosUser$outboundSchema` instead. */
|
|
246
|
-
export const outboundSchema = PosUser$outboundSchema;
|
|
247
|
-
/** @deprecated use `PosUser$Outbound` instead. */
|
|
248
|
-
export type Outbound = PosUser$Outbound;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export function posUserToJSON(posUser: PosUser): string {
|
|
252
|
-
return JSON.stringify(PosUser$outboundSchema.parse(posUser));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export function posUserFromJSON(
|
|
256
|
-
jsonString: string,
|
|
257
|
-
): SafeParseResult<PosUser, SDKValidationError> {
|
|
258
|
-
return safeParse(
|
|
259
|
-
jsonString,
|
|
260
|
-
(x) => PosUser$inboundSchema.parse(JSON.parse(x)),
|
|
261
|
-
`Failed to parse 'PosUser' from JSON`,
|
|
262
|
-
);
|
|
263
|
-
}
|