@monkeyplus/payscope 1.0.0
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/THIRD-PARTY-LICENSES.md +41 -0
- package/dist/_chunks/auth.d.mts +707 -0
- package/dist/_chunks/database.mjs +831 -0
- package/dist/_chunks/db.d.mts +7100 -0
- package/dist/_chunks/index.d.mts +178 -0
- package/dist/_chunks/lib.mjs +3073 -0
- package/dist/_chunks/libs/better-call.d.mts +478 -0
- package/dist/_chunks/libs/postgres.d.mts +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +11 -0
- package/dist/server/db.d.mts +2 -0
- package/dist/server/db.mjs +108 -0
- package/dist/server/env.d.mts +21 -0
- package/dist/server/env.mjs +22 -0
- package/dist/server/lib.d.mts +362 -0
- package/dist/server/lib.mjs +2 -0
- package/dist/server/router.d.mts +1218 -0
- package/dist/server/router.mjs +1157 -0
- package/dist/server/schemas/auth.d.mts +2 -0
- package/dist/server/schemas/auth.mjs +62 -0
- package/package.json +58 -0
- package/storefront/Readme.md +0 -0
- package/storefront/auth.ts +29 -0
- package/storefront/cart/ResumeCart.vue +217 -0
- package/storefront/cart/ResumeCartSelect.vue +32 -0
- package/storefront/cart/ShoppinCart.vue +100 -0
- package/storefront/cart/ShoppinCartItem.vue +99 -0
- package/storefront/checkout/App.vue +36 -0
- package/storefront/checkout/AppCart.vue +72 -0
- package/storefront/checkout/AppCartDiscount.vue +74 -0
- package/storefront/checkout/AppCartTotals.vue +72 -0
- package/storefront/checkout/AppLoading.vue +55 -0
- package/storefront/checkout/composables.ts +28 -0
- package/storefront/checkout/constants.ts +0 -0
- package/storefront/checkout/main.ts +11 -0
- package/storefront/checkout/pages/Address/Address.vue +95 -0
- package/storefront/checkout/pages/Info/Info.vue +94 -0
- package/storefront/checkout/pages/Info/InfoUser.vue +38 -0
- package/storefront/checkout/pages/Pay/Pay.vue +115 -0
- package/storefront/checkout/pages/Pay/Providers/BancoEconomico/BancoEconomico.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Cybersource/Cybersource.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Datafast/Datafast.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Multipago/Multipago.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/Pagomedios.vue +93 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/composable.ts +23 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/Paypal.vue +168 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/composable.ts +33 -0
- package/storefront/checkout/pages/Pay/Providers/Placetopay/Placetopay.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Wabi/Wabi.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/composable.ts +30 -0
- package/storefront/checkout/pages/Payment/Payment.vue +19 -0
- package/storefront/checkout/pages/Payment/PaymentStatus.vue +187 -0
- package/storefront/checkout/pages/Payment/PaymentStatusDetail.vue +77 -0
- package/storefront/checkout/pages/Payment/composable.ts +81 -0
- package/storefront/checkout/pages/Shipping/Shipping.vue +67 -0
- package/storefront/checkout/pages/StepInfo.vue +37 -0
- package/storefront/checkout/router.ts +59 -0
- package/storefront/index.ts +3 -0
- package/storefront/login/App.vue +9 -0
- package/storefront/login/main.ts +10 -0
- package/storefront/login/pages/SignIn/Login.vue +82 -0
- package/storefront/login/pages/SignUp/SignUp.vue +99 -0
- package/storefront/login/router.ts +15 -0
- package/storefront/product/AddProduct.vue +303 -0
- package/storefront/product/AddProductNumber.vue +62 -0
- package/storefront/product/AddProductVariant.vue +66 -0
- package/storefront/profile/App.vue +88 -0
- package/storefront/profile/main.ts +10 -0
- package/storefront/profile/pages/Addresses/Addresses.vue +79 -0
- package/storefront/profile/pages/Addresses/AddressesForm.vue +95 -0
- package/storefront/profile/pages/Addresses/AddressesModal.vue +24 -0
- package/storefront/profile/pages/Buys/Buys.vue +8 -0
- package/storefront/profile/pages/Me/Me.vue +15 -0
- package/storefront/profile/pages/Me/MeBilling.vue +79 -0
- package/storefront/profile/pages/Me/MeBillingForm.vue +66 -0
- package/storefront/profile/pages/Me/MeBillingModal.vue +24 -0
- package/storefront/profile/pages/Me/MeInfo.vue +75 -0
- package/storefront/profile/pages/Me/MePassword.vue +53 -0
- package/storefront/profile/pages/Me/MeSubscriptions.vue +15 -0
- package/storefront/profile/pages/Returns/Returns.vue +8 -0
- package/storefront/profile/pages/Whislist/Whislist.vue +8 -0
- package/storefront/profile/router.ts +32 -0
- package/storefront/stores.ts +320 -0
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
2
|
+
type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
3
|
+
type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}:${infer Param}` ? { [K in Param]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
|
|
4
|
+
type InferParamWildCard<Path> = Path extends `${infer _Start}/*:${infer Param}/${infer Rest}` | `${infer _Start}/**:${infer Param}/${infer Rest}` ? { [K in Param | keyof InferParamPath<Rest>]: string } : Path extends `${infer _Start}/*` ? { [K in "_"]: string } : Path extends `${infer _Start}/${infer Rest}` ? InferParamWildCard<Rest> : {}; //#endregion
|
|
5
|
+
//#region src/standard-schema.d.ts
|
|
6
|
+
/** The Standard Schema interface. */
|
|
7
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
8
|
+
/** The Standard Schema properties. */
|
|
9
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
10
|
+
}
|
|
11
|
+
declare namespace StandardSchemaV1 {
|
|
12
|
+
/** The Standard Schema properties interface. */
|
|
13
|
+
interface Props<Input = unknown, Output = Input> {
|
|
14
|
+
/** The version number of the standard. */
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
/** The vendor name of the schema library. */
|
|
17
|
+
readonly vendor: string;
|
|
18
|
+
/** Validates unknown input values. */
|
|
19
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
20
|
+
/** Inferred types associated with the schema. */
|
|
21
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** The result interface of the validate function. */
|
|
24
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
25
|
+
/** The result interface if validation succeeds. */
|
|
26
|
+
interface SuccessResult<Output> {
|
|
27
|
+
/** The typed output value. */
|
|
28
|
+
readonly value: Output;
|
|
29
|
+
/** The non-existent issues. */
|
|
30
|
+
readonly issues?: undefined;
|
|
31
|
+
}
|
|
32
|
+
/** The result interface if validation fails. */
|
|
33
|
+
interface FailureResult {
|
|
34
|
+
/** The issues of failed validation. */
|
|
35
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
36
|
+
}
|
|
37
|
+
/** The issue interface of the failure output. */
|
|
38
|
+
interface Issue {
|
|
39
|
+
/** The error message of the issue. */
|
|
40
|
+
readonly message: string;
|
|
41
|
+
/** The path of the issue, if any. */
|
|
42
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
43
|
+
}
|
|
44
|
+
/** The path segment interface of the issue. */
|
|
45
|
+
interface PathSegment {
|
|
46
|
+
/** The key representing a path segment. */
|
|
47
|
+
readonly key: PropertyKey;
|
|
48
|
+
}
|
|
49
|
+
/** The Standard Schema types interface. */
|
|
50
|
+
interface Types<Input = unknown, Output = Input> {
|
|
51
|
+
/** The input type of the schema. */
|
|
52
|
+
readonly input: Input;
|
|
53
|
+
/** The output type of the schema. */
|
|
54
|
+
readonly output: Output;
|
|
55
|
+
}
|
|
56
|
+
/** Infers the input type of a Standard Schema. */
|
|
57
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
58
|
+
/** Infers the output type of a Standard Schema. */
|
|
59
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
60
|
+
} //#endregion
|
|
61
|
+
declare const statusCodes: {
|
|
62
|
+
OK: number;
|
|
63
|
+
CREATED: number;
|
|
64
|
+
ACCEPTED: number;
|
|
65
|
+
NO_CONTENT: number;
|
|
66
|
+
MULTIPLE_CHOICES: number;
|
|
67
|
+
MOVED_PERMANENTLY: number;
|
|
68
|
+
FOUND: number;
|
|
69
|
+
SEE_OTHER: number;
|
|
70
|
+
NOT_MODIFIED: number;
|
|
71
|
+
TEMPORARY_REDIRECT: number;
|
|
72
|
+
BAD_REQUEST: number;
|
|
73
|
+
UNAUTHORIZED: number;
|
|
74
|
+
PAYMENT_REQUIRED: number;
|
|
75
|
+
FORBIDDEN: number;
|
|
76
|
+
NOT_FOUND: number;
|
|
77
|
+
METHOD_NOT_ALLOWED: number;
|
|
78
|
+
NOT_ACCEPTABLE: number;
|
|
79
|
+
PROXY_AUTHENTICATION_REQUIRED: number;
|
|
80
|
+
REQUEST_TIMEOUT: number;
|
|
81
|
+
CONFLICT: number;
|
|
82
|
+
GONE: number;
|
|
83
|
+
LENGTH_REQUIRED: number;
|
|
84
|
+
PRECONDITION_FAILED: number;
|
|
85
|
+
PAYLOAD_TOO_LARGE: number;
|
|
86
|
+
URI_TOO_LONG: number;
|
|
87
|
+
UNSUPPORTED_MEDIA_TYPE: number;
|
|
88
|
+
RANGE_NOT_SATISFIABLE: number;
|
|
89
|
+
EXPECTATION_FAILED: number;
|
|
90
|
+
"I'M_A_TEAPOT": number;
|
|
91
|
+
MISDIRECTED_REQUEST: number;
|
|
92
|
+
UNPROCESSABLE_ENTITY: number;
|
|
93
|
+
LOCKED: number;
|
|
94
|
+
FAILED_DEPENDENCY: number;
|
|
95
|
+
TOO_EARLY: number;
|
|
96
|
+
UPGRADE_REQUIRED: number;
|
|
97
|
+
PRECONDITION_REQUIRED: number;
|
|
98
|
+
TOO_MANY_REQUESTS: number;
|
|
99
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: number;
|
|
100
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: number;
|
|
101
|
+
INTERNAL_SERVER_ERROR: number;
|
|
102
|
+
NOT_IMPLEMENTED: number;
|
|
103
|
+
BAD_GATEWAY: number;
|
|
104
|
+
SERVICE_UNAVAILABLE: number;
|
|
105
|
+
GATEWAY_TIMEOUT: number;
|
|
106
|
+
HTTP_VERSION_NOT_SUPPORTED: number;
|
|
107
|
+
VARIANT_ALSO_NEGOTIATES: number;
|
|
108
|
+
INSUFFICIENT_STORAGE: number;
|
|
109
|
+
LOOP_DETECTED: number;
|
|
110
|
+
NOT_EXTENDED: number;
|
|
111
|
+
NETWORK_AUTHENTICATION_REQUIRED: number;
|
|
112
|
+
};
|
|
113
|
+
type Status = 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
114
|
+
declare class InternalAPIError extends Error {
|
|
115
|
+
status: keyof typeof statusCodes | Status;
|
|
116
|
+
body: ({
|
|
117
|
+
message?: string;
|
|
118
|
+
code?: string;
|
|
119
|
+
cause?: unknown;
|
|
120
|
+
} & Record<string, any>) | undefined;
|
|
121
|
+
headers: HeadersInit;
|
|
122
|
+
statusCode: number;
|
|
123
|
+
constructor(status?: keyof typeof statusCodes | Status, body?: ({
|
|
124
|
+
message?: string;
|
|
125
|
+
code?: string;
|
|
126
|
+
cause?: unknown;
|
|
127
|
+
} & Record<string, any>) | undefined, headers?: HeadersInit, statusCode?: number);
|
|
128
|
+
}
|
|
129
|
+
type APIError = InstanceType<typeof InternalAPIError>;
|
|
130
|
+
declare const APIError: new (status?: Status | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "BAD_REQUEST" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "CONFLICT" | "GONE" | "LENGTH_REQUIRED" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "URI_TOO_LONG" | "UNSUPPORTED_MEDIA_TYPE" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "TOO_MANY_REQUESTS" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED" | undefined, body?: ({
|
|
131
|
+
message?: string;
|
|
132
|
+
code?: string;
|
|
133
|
+
cause?: unknown;
|
|
134
|
+
} & Record<string, any>) | undefined, headers?: HeadersInit | undefined, statusCode?: number | undefined) => InternalAPIError & {
|
|
135
|
+
errorStack: string | undefined;
|
|
136
|
+
}; //#endregion
|
|
137
|
+
//#region src/openapi.d.ts
|
|
138
|
+
type OpenAPISchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object";
|
|
139
|
+
interface OpenAPIParameter {
|
|
140
|
+
in: "query" | "path" | "header" | "cookie";
|
|
141
|
+
name?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
required?: boolean;
|
|
144
|
+
schema?: {
|
|
145
|
+
type: OpenAPISchemaType;
|
|
146
|
+
format?: string | undefined;
|
|
147
|
+
items?: {
|
|
148
|
+
type: OpenAPISchemaType;
|
|
149
|
+
};
|
|
150
|
+
enum?: string[];
|
|
151
|
+
minLength?: number;
|
|
152
|
+
description?: string | undefined;
|
|
153
|
+
default?: string | undefined;
|
|
154
|
+
example?: string | undefined;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//#region src/endpoint.d.ts
|
|
158
|
+
interface EndpointBaseOptions {
|
|
159
|
+
/**
|
|
160
|
+
* Query Schema
|
|
161
|
+
*/
|
|
162
|
+
query?: StandardSchemaV1;
|
|
163
|
+
/**
|
|
164
|
+
* Error Schema
|
|
165
|
+
*/
|
|
166
|
+
error?: StandardSchemaV1;
|
|
167
|
+
/**
|
|
168
|
+
* If true headers will be required to be passed in the context
|
|
169
|
+
*/
|
|
170
|
+
requireHeaders?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* If true request object will be required
|
|
173
|
+
*/
|
|
174
|
+
requireRequest?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Clone the request object from the router
|
|
177
|
+
*/
|
|
178
|
+
cloneRequest?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* If true the body will be undefined
|
|
181
|
+
*/
|
|
182
|
+
disableBody?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Endpoint metadata
|
|
185
|
+
*/
|
|
186
|
+
metadata?: {
|
|
187
|
+
/**
|
|
188
|
+
* Open API definition
|
|
189
|
+
*/
|
|
190
|
+
openapi?: {
|
|
191
|
+
summary?: string;
|
|
192
|
+
description?: string;
|
|
193
|
+
tags?: string[];
|
|
194
|
+
operationId?: string;
|
|
195
|
+
parameters?: OpenAPIParameter[];
|
|
196
|
+
requestBody?: {
|
|
197
|
+
content: {
|
|
198
|
+
"application/json": {
|
|
199
|
+
schema: {
|
|
200
|
+
type?: OpenAPISchemaType;
|
|
201
|
+
properties?: Record<string, any>;
|
|
202
|
+
required?: string[];
|
|
203
|
+
$ref?: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
responses?: {
|
|
209
|
+
[status: string]: {
|
|
210
|
+
description: string;
|
|
211
|
+
content?: {
|
|
212
|
+
"application/json"?: {
|
|
213
|
+
schema: {
|
|
214
|
+
type?: OpenAPISchemaType;
|
|
215
|
+
properties?: Record<string, any>;
|
|
216
|
+
required?: string[];
|
|
217
|
+
$ref?: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
"text/plain"?: {
|
|
221
|
+
schema?: {
|
|
222
|
+
type?: OpenAPISchemaType;
|
|
223
|
+
properties?: Record<string, any>;
|
|
224
|
+
required?: string[];
|
|
225
|
+
$ref?: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
"text/html"?: {
|
|
229
|
+
schema?: {
|
|
230
|
+
type?: OpenAPISchemaType;
|
|
231
|
+
properties?: Record<string, any>;
|
|
232
|
+
required?: string[];
|
|
233
|
+
$ref?: string;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Infer body and query type from ts interface
|
|
242
|
+
*
|
|
243
|
+
* useful for generic and dynamic types
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const endpoint = createEndpoint("/path", {
|
|
248
|
+
* method: "POST",
|
|
249
|
+
* body: z.record(z.string()),
|
|
250
|
+
* $Infer: {
|
|
251
|
+
* body: {} as {
|
|
252
|
+
* type: InferTypeFromOptions<Option> // custom type inference
|
|
253
|
+
* }
|
|
254
|
+
* }
|
|
255
|
+
* }, async(ctx)=>{
|
|
256
|
+
* const body = ctx.body
|
|
257
|
+
* })
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
$Infer?: {
|
|
261
|
+
/**
|
|
262
|
+
* Body
|
|
263
|
+
*/
|
|
264
|
+
body?: any;
|
|
265
|
+
/**
|
|
266
|
+
* Query
|
|
267
|
+
*/
|
|
268
|
+
query?: Record<string, any>;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* If enabled, endpoint won't be exposed over a router
|
|
272
|
+
* @deprecated Use path-less endpoints instead
|
|
273
|
+
*/
|
|
274
|
+
SERVER_ONLY?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* If enabled, endpoint won't be exposed as an action to the client
|
|
277
|
+
* @deprecated Use path-less endpoints instead
|
|
278
|
+
*/
|
|
279
|
+
isAction?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Defines the places where the endpoint will be available
|
|
282
|
+
*
|
|
283
|
+
* Possible options:
|
|
284
|
+
* - `rpc` - the endpoint is exposed to the router, can be invoked directly and is available to the client
|
|
285
|
+
* - `server` - the endpoint is exposed to the router, can be invoked directly, but is not available to the client
|
|
286
|
+
* - `http` - the endpoint is only exposed to the router
|
|
287
|
+
* @default "rpc"
|
|
288
|
+
*/
|
|
289
|
+
scope?: "rpc" | "server" | "http";
|
|
290
|
+
/**
|
|
291
|
+
* List of allowed media types (MIME types) for the endpoint
|
|
292
|
+
*
|
|
293
|
+
* if provided, only the media types in the list will be allowed to be passed in the body
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* const endpoint = createEndpoint("/path", {
|
|
298
|
+
* method: "POST",
|
|
299
|
+
* allowedMediaTypes: ["application/json", "application/x-www-form-urlencoded"],
|
|
300
|
+
* }, async(ctx)=>{
|
|
301
|
+
* const body = ctx.body
|
|
302
|
+
* })
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
allowedMediaTypes?: string[];
|
|
306
|
+
/**
|
|
307
|
+
* Extra metadata
|
|
308
|
+
*/
|
|
309
|
+
[key: string]: any;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* List of middlewares to use
|
|
313
|
+
*/
|
|
314
|
+
use?: Middleware[];
|
|
315
|
+
/**
|
|
316
|
+
* A callback to run before any API error is throw or returned
|
|
317
|
+
*
|
|
318
|
+
* @param e - The API error
|
|
319
|
+
* @returns - The response to return
|
|
320
|
+
*/
|
|
321
|
+
onAPIError?: (e: APIError) => void | Promise<void>;
|
|
322
|
+
/**
|
|
323
|
+
* A callback to run before a validation error is thrown
|
|
324
|
+
* You can customize the validation error message by throwing your own APIError
|
|
325
|
+
*/
|
|
326
|
+
onValidationError?: ({
|
|
327
|
+
issues,
|
|
328
|
+
message
|
|
329
|
+
}: {
|
|
330
|
+
message: string;
|
|
331
|
+
issues: readonly StandardSchemaV1.Issue[];
|
|
332
|
+
}) => void | Promise<void>;
|
|
333
|
+
}
|
|
334
|
+
type EndpointBodyMethodOptions = {
|
|
335
|
+
/**
|
|
336
|
+
* Request Method
|
|
337
|
+
*/
|
|
338
|
+
method: "POST" | "PUT" | "DELETE" | "PATCH" | ("POST" | "PUT" | "DELETE" | "PATCH")[];
|
|
339
|
+
/**
|
|
340
|
+
* Body Schema
|
|
341
|
+
*/
|
|
342
|
+
body?: StandardSchemaV1;
|
|
343
|
+
} | {
|
|
344
|
+
/**
|
|
345
|
+
* Request Method
|
|
346
|
+
*/
|
|
347
|
+
method: "GET" | "HEAD" | ("GET" | "HEAD")[];
|
|
348
|
+
/**
|
|
349
|
+
* Body Schema
|
|
350
|
+
*/
|
|
351
|
+
body?: never;
|
|
352
|
+
} | {
|
|
353
|
+
/**
|
|
354
|
+
* Request Method
|
|
355
|
+
*/
|
|
356
|
+
method: "*";
|
|
357
|
+
/**
|
|
358
|
+
* Body Schema
|
|
359
|
+
*/
|
|
360
|
+
body?: StandardSchemaV1;
|
|
361
|
+
} | {
|
|
362
|
+
/**
|
|
363
|
+
* Request Method
|
|
364
|
+
*/
|
|
365
|
+
method: ("POST" | "PUT" | "DELETE" | "PATCH" | "GET" | "HEAD")[];
|
|
366
|
+
/**
|
|
367
|
+
* Body Schema
|
|
368
|
+
*/
|
|
369
|
+
body?: StandardSchemaV1;
|
|
370
|
+
};
|
|
371
|
+
type EndpointOptions = EndpointBaseOptions & EndpointBodyMethodOptions;
|
|
372
|
+
type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = any> = {
|
|
373
|
+
(context: InputContext<Path, Options> & {
|
|
374
|
+
asResponse: true;
|
|
375
|
+
}): Promise<Response>;
|
|
376
|
+
(context: InputContext<Path, Options> & {
|
|
377
|
+
returnHeaders: true;
|
|
378
|
+
returnStatus: true;
|
|
379
|
+
}): Promise<{
|
|
380
|
+
headers: Headers;
|
|
381
|
+
status: number;
|
|
382
|
+
response: Awaited<R>;
|
|
383
|
+
}>;
|
|
384
|
+
(context: InputContext<Path, Options> & {
|
|
385
|
+
returnHeaders: true;
|
|
386
|
+
returnStatus: false;
|
|
387
|
+
}): Promise<{
|
|
388
|
+
headers: Headers;
|
|
389
|
+
response: Awaited<R>;
|
|
390
|
+
}>;
|
|
391
|
+
(context: InputContext<Path, Options> & {
|
|
392
|
+
returnHeaders: false;
|
|
393
|
+
returnStatus: true;
|
|
394
|
+
}): Promise<{
|
|
395
|
+
status: number;
|
|
396
|
+
response: Awaited<R>;
|
|
397
|
+
}>;
|
|
398
|
+
(context: InputContext<Path, Options> & {
|
|
399
|
+
returnHeaders: false;
|
|
400
|
+
returnStatus: false;
|
|
401
|
+
}): Promise<R>;
|
|
402
|
+
(context: InputContext<Path, Options> & {
|
|
403
|
+
returnHeaders: true;
|
|
404
|
+
}): Promise<{
|
|
405
|
+
headers: Headers;
|
|
406
|
+
response: Awaited<R>;
|
|
407
|
+
}>;
|
|
408
|
+
(context: InputContext<Path, Options> & {
|
|
409
|
+
returnStatus: true;
|
|
410
|
+
}): Promise<{
|
|
411
|
+
status: number;
|
|
412
|
+
response: Awaited<R>;
|
|
413
|
+
}>;
|
|
414
|
+
(context?: InputContext<Path, Options>): Promise<R>;
|
|
415
|
+
options: Options;
|
|
416
|
+
path: Path;
|
|
417
|
+
};
|
|
418
|
+
//#region src/middleware.d.ts
|
|
419
|
+
interface MiddlewareOptions extends Omit<EndpointOptions, "method"> {}
|
|
420
|
+
type MiddlewareInputContext<Options extends MiddlewareOptions> = InferBodyInput<Options> & InferQueryInput<Options> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
421
|
+
asResponse?: boolean;
|
|
422
|
+
returnHeaders?: boolean;
|
|
423
|
+
use?: Middleware[];
|
|
424
|
+
};
|
|
425
|
+
type Middleware<Options extends MiddlewareOptions = MiddlewareOptions, Handler extends (inputCtx: any) => Promise<any> = any> = Handler & {
|
|
426
|
+
options: Options;
|
|
427
|
+
}; //#endregion
|
|
428
|
+
//#region src/context.d.ts
|
|
429
|
+
type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
430
|
+
type InferBodyInput<Options extends EndpointOptions | MiddlewareOptions, Body = (Options["metadata"] extends {
|
|
431
|
+
$Infer: {
|
|
432
|
+
body: infer B;
|
|
433
|
+
};
|
|
434
|
+
} ? B : Options["body"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["body"]> : undefined)> = undefined extends Body ? {
|
|
435
|
+
body?: Body;
|
|
436
|
+
} : {
|
|
437
|
+
body: Body;
|
|
438
|
+
};
|
|
439
|
+
type InferQueryInput<Options extends EndpointOptions | MiddlewareOptions, Query = (Options["metadata"] extends {
|
|
440
|
+
$Infer: {
|
|
441
|
+
query: infer Query;
|
|
442
|
+
};
|
|
443
|
+
} ? Query : Options["query"] extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Options["query"]> : Record<string, any> | undefined)> = undefined extends Query ? {
|
|
444
|
+
query?: Query;
|
|
445
|
+
} : {
|
|
446
|
+
query: Query;
|
|
447
|
+
};
|
|
448
|
+
type InferInputMethod<Options extends EndpointOptions, Method = (Options["method"] extends Array<any> ? Options["method"][number] | undefined : Options["method"] extends "*" ? HTTPMethod : Options["method"] | undefined)> = undefined extends Method ? {
|
|
449
|
+
method?: Method;
|
|
450
|
+
} : {
|
|
451
|
+
method: Method;
|
|
452
|
+
};
|
|
453
|
+
type InferParamInput<Path extends string> = [Path] extends [never] ? {
|
|
454
|
+
params?: Record<string, any>;
|
|
455
|
+
} : IsEmptyObject<InferParamPath<Path> & InferParamWildCard<Path>> extends true ? {
|
|
456
|
+
params?: Record<string, any>;
|
|
457
|
+
} : {
|
|
458
|
+
params: Prettify<InferParamPath<Path> & InferParamWildCard<Path>>;
|
|
459
|
+
};
|
|
460
|
+
type InferRequestInput<Option extends EndpointOptions | MiddlewareOptions> = Option["requireRequest"] extends true ? {
|
|
461
|
+
request: Request;
|
|
462
|
+
} : {
|
|
463
|
+
request?: Request;
|
|
464
|
+
};
|
|
465
|
+
type InferHeadersInput<Option extends EndpointOptions | MiddlewareOptions> = Option["requireHeaders"] extends true ? {
|
|
466
|
+
headers: HeadersInit;
|
|
467
|
+
} : {
|
|
468
|
+
headers?: HeadersInit;
|
|
469
|
+
};
|
|
470
|
+
type InputContext<Path extends string, Options extends EndpointOptions> = InferBodyInput<Options> & InferInputMethod<Options> & InferQueryInput<Options> & InferParamInput<Path> & InferRequestInput<Options> & InferHeadersInput<Options> & {
|
|
471
|
+
asResponse?: boolean;
|
|
472
|
+
returnHeaders?: boolean;
|
|
473
|
+
returnStatus?: boolean;
|
|
474
|
+
use?: Middleware[];
|
|
475
|
+
path?: string;
|
|
476
|
+
context?: Record<string, any>;
|
|
477
|
+
};
|
|
478
|
+
export { MiddlewareInputContext, MiddlewareOptions, StrictEndpoint };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __exportAll = (all, no_symbols) => {
|
|
3
|
+
let target = {};
|
|
4
|
+
for (var name in all) __defProp(target, name, {
|
|
5
|
+
get: all[name],
|
|
6
|
+
enumerable: true
|
|
7
|
+
});
|
|
8
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
export { __exportAll };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { __exportAll } from "../_chunks/rolldown-runtime.mjs";
|
|
2
|
+
import { auth_exports } from "./schemas/auth.mjs";
|
|
3
|
+
import { account, auth, buys, checkouts, countries, customBigSerial, customerAddresses, customerBillings, customerBuys, customerReturns, customerWhislists, customers, discountCoupons, discounts, drivers, ecommerce, extensions, keys, links, namespaceKeys, orders, paymentAttempts, payments, pgmigrations, productStocks, productTaxXRefs, products, quote, quoteGroups, quoteQuotes, quoteVersions, recurringPayments, refunds, reportBuys, reportDebts, reportLogs, reportMessages, reportPayments, sCustomers, secures, session, sessions, stores, subscriptions, taxes, teamUserXRefs, teamZoneXRefs, teams, transactions, typeTaxes, user, users, verification, zones } from "../_chunks/database.mjs";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { defineRelations } from "drizzle-orm";
|
|
6
|
+
import { drizzle } from "drizzle-orm/postgres-js";
|
|
7
|
+
var ecommerce_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
account: () => account,
|
|
9
|
+
auth: () => auth,
|
|
10
|
+
buys: () => buys,
|
|
11
|
+
checkouts: () => checkouts,
|
|
12
|
+
countries: () => countries,
|
|
13
|
+
customBigSerial: () => customBigSerial,
|
|
14
|
+
customerAddresses: () => customerAddresses,
|
|
15
|
+
customerBillings: () => customerBillings,
|
|
16
|
+
customerBuys: () => customerBuys,
|
|
17
|
+
customerReturns: () => customerReturns,
|
|
18
|
+
customerWhislists: () => customerWhislists,
|
|
19
|
+
customers: () => customers,
|
|
20
|
+
discountCoupons: () => discountCoupons,
|
|
21
|
+
discounts: () => discounts,
|
|
22
|
+
drivers: () => drivers,
|
|
23
|
+
ecommerce: () => ecommerce,
|
|
24
|
+
extensions: () => extensions,
|
|
25
|
+
keys: () => keys,
|
|
26
|
+
links: () => links,
|
|
27
|
+
namespaceKeys: () => namespaceKeys,
|
|
28
|
+
orders: () => orders,
|
|
29
|
+
paymentAttempts: () => paymentAttempts,
|
|
30
|
+
payments: () => payments,
|
|
31
|
+
pgmigrations: () => pgmigrations,
|
|
32
|
+
productStocks: () => productStocks,
|
|
33
|
+
productTaxXRefs: () => productTaxXRefs,
|
|
34
|
+
products: () => products,
|
|
35
|
+
quote: () => quote,
|
|
36
|
+
quoteGroups: () => quoteGroups,
|
|
37
|
+
quoteQuotes: () => quoteQuotes,
|
|
38
|
+
quoteVersions: () => quoteVersions,
|
|
39
|
+
recurringPayments: () => recurringPayments,
|
|
40
|
+
refunds: () => refunds,
|
|
41
|
+
reportBuys: () => reportBuys,
|
|
42
|
+
reportDebts: () => reportDebts,
|
|
43
|
+
reportLogs: () => reportLogs,
|
|
44
|
+
reportMessages: () => reportMessages,
|
|
45
|
+
reportPayments: () => reportPayments,
|
|
46
|
+
sCustomers: () => sCustomers,
|
|
47
|
+
secures: () => secures,
|
|
48
|
+
session: () => session,
|
|
49
|
+
sessions: () => sessions,
|
|
50
|
+
stores: () => stores,
|
|
51
|
+
subscriptions: () => subscriptions,
|
|
52
|
+
taxes: () => taxes,
|
|
53
|
+
teamUserXRefs: () => teamUserXRefs,
|
|
54
|
+
teamZoneXRefs: () => teamZoneXRefs,
|
|
55
|
+
teams: () => teams,
|
|
56
|
+
transactions: () => transactions,
|
|
57
|
+
typeTaxes: () => typeTaxes,
|
|
58
|
+
user: () => user,
|
|
59
|
+
users: () => users,
|
|
60
|
+
verification: () => verification,
|
|
61
|
+
zones: () => zones
|
|
62
|
+
});
|
|
63
|
+
const dbAuth = drizzle(process.env.DATABASE_URL, { relations: defineRelations(auth_exports) });
|
|
64
|
+
const db = drizzle(process.env.PAYSCOPE_URL, { relations: defineRelations(ecommerce_exports, (r) => ({
|
|
65
|
+
products: { taxes: r.many.productTaxXRefs({
|
|
66
|
+
from: r.products.id,
|
|
67
|
+
to: r.productTaxXRefs.productId
|
|
68
|
+
}) },
|
|
69
|
+
productTaxXRefs: { tax: r.one.taxes({
|
|
70
|
+
from: r.productTaxXRefs.taxId,
|
|
71
|
+
to: r.taxes.id
|
|
72
|
+
}) },
|
|
73
|
+
stores: { country: r.one.countries({
|
|
74
|
+
from: r.stores.countryId,
|
|
75
|
+
to: r.countries.id
|
|
76
|
+
}) },
|
|
77
|
+
countries: { taxesList: r.many.taxes({
|
|
78
|
+
from: r.countries.id,
|
|
79
|
+
to: r.taxes.countryId
|
|
80
|
+
}) },
|
|
81
|
+
taxes: { type: r.one.typeTaxes({
|
|
82
|
+
from: r.taxes.typeId,
|
|
83
|
+
to: r.typeTaxes.id
|
|
84
|
+
}) },
|
|
85
|
+
sessions: { store: r.one.stores({
|
|
86
|
+
from: r.sessions.storeId,
|
|
87
|
+
to: r.stores.id
|
|
88
|
+
}) },
|
|
89
|
+
transactions: {
|
|
90
|
+
store: r.one.stores({
|
|
91
|
+
from: r.transactions.storeId,
|
|
92
|
+
to: r.stores.id
|
|
93
|
+
}),
|
|
94
|
+
checkout: r.one.checkouts({
|
|
95
|
+
from: r.transactions.checkoutId,
|
|
96
|
+
to: r.checkouts.id
|
|
97
|
+
}),
|
|
98
|
+
session: r.one.sessions({
|
|
99
|
+
from: r.transactions.sessionId,
|
|
100
|
+
to: r.sessions.id
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
refunds: { transaction: r.one.transactions({
|
|
104
|
+
from: r.refunds.transactionId,
|
|
105
|
+
to: r.transactions.id
|
|
106
|
+
}) }
|
|
107
|
+
})) });
|
|
108
|
+
export { db, dbAuth };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const URL: string;
|
|
2
|
+
declare const DATAFAST_ENDPOINT: string;
|
|
3
|
+
declare const DATAFAST_ENTITY_ID: string;
|
|
4
|
+
declare const DATAFAST_TOKEN: string;
|
|
5
|
+
declare const DATAFAST_FASE: number;
|
|
6
|
+
declare const DATAFAST_MID: string;
|
|
7
|
+
declare const DATAFAST_TID: string;
|
|
8
|
+
declare const DATAFAST_NAME_ECOMMERCE: string;
|
|
9
|
+
declare const PGM_ENDPOINT: string;
|
|
10
|
+
declare const PGM_TOKEN: string;
|
|
11
|
+
declare const PGM_NAME: string;
|
|
12
|
+
declare const CYB_KEY_ID: string;
|
|
13
|
+
declare const CYB_SECRET: string;
|
|
14
|
+
declare const CYB_MERCHANT_ID: string;
|
|
15
|
+
declare const CYB_HOST_ENDPOINT: string;
|
|
16
|
+
declare const PAYP_CLIENT: string;
|
|
17
|
+
declare const PAYP_SECRET: string;
|
|
18
|
+
declare const GRAPHQL_ENDPOINT: string;
|
|
19
|
+
declare const GRAPHQL_TOKEN: string;
|
|
20
|
+
declare const TASKS_ENDPOINT: string;
|
|
21
|
+
export { CYB_HOST_ENDPOINT, CYB_KEY_ID, CYB_MERCHANT_ID, CYB_SECRET, DATAFAST_ENDPOINT, DATAFAST_ENTITY_ID, DATAFAST_FASE, DATAFAST_MID, DATAFAST_NAME_ECOMMERCE, DATAFAST_TID, DATAFAST_TOKEN, GRAPHQL_ENDPOINT, GRAPHQL_TOKEN, PAYP_CLIENT, PAYP_SECRET, PGM_ENDPOINT, PGM_NAME, PGM_TOKEN, TASKS_ENDPOINT, URL };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
const URL = process.env.URL || process.env.APP_URL;
|
|
3
|
+
const DATAFAST_ENDPOINT = process.env.DATAFAST_ENDPOINT;
|
|
4
|
+
const DATAFAST_ENTITY_ID = process.env.DATAFAST_ENTITY_ID;
|
|
5
|
+
const DATAFAST_TOKEN = process.env.DATAFAST_TOKEN;
|
|
6
|
+
const DATAFAST_FASE = +process.env.DATAFAST_FASE;
|
|
7
|
+
const DATAFAST_MID = process.env.DATAFAST_MID;
|
|
8
|
+
const DATAFAST_TID = process.env.DATAFAST_TID;
|
|
9
|
+
const DATAFAST_NAME_ECOMMERCE = process.env.DATAFAST_NAME_ECOMMERCE;
|
|
10
|
+
const PGM_ENDPOINT = process.env.PGM_ENDPOINT;
|
|
11
|
+
const PGM_TOKEN = process.env.PGM_TOKEN;
|
|
12
|
+
const PGM_NAME = process.env.PGM_NAME;
|
|
13
|
+
const CYB_KEY_ID = process.env.CYB_KEY_ID;
|
|
14
|
+
const CYB_SECRET = process.env.CYB_SECRET;
|
|
15
|
+
const CYB_MERCHANT_ID = process.env.CYB_MERCHANT_ID;
|
|
16
|
+
const CYB_HOST_ENDPOINT = process.env.CYB_HOST_ENDPOINT;
|
|
17
|
+
const PAYP_CLIENT = process.env.PAYP_CLIENT;
|
|
18
|
+
const PAYP_SECRET = process.env.PAYP_SECRET;
|
|
19
|
+
const GRAPHQL_ENDPOINT = process.env.GRAPHQL_ENDPOINT;
|
|
20
|
+
const GRAPHQL_TOKEN = process.env.GRAPHQL_TOKEN;
|
|
21
|
+
const TASKS_ENDPOINT = process.env.TASKS_ENDPOINT;
|
|
22
|
+
export { CYB_HOST_ENDPOINT, CYB_KEY_ID, CYB_MERCHANT_ID, CYB_SECRET, DATAFAST_ENDPOINT, DATAFAST_ENTITY_ID, DATAFAST_FASE, DATAFAST_MID, DATAFAST_NAME_ECOMMERCE, DATAFAST_TID, DATAFAST_TOKEN, GRAPHQL_ENDPOINT, GRAPHQL_TOKEN, PAYP_CLIENT, PAYP_SECRET, PGM_ENDPOINT, PGM_NAME, PGM_TOKEN, TASKS_ENDPOINT, URL };
|