@zyacreatives/shared 2.5.27 → 2.5.28
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/schemas/job.d.ts +2 -0
- package/dist/schemas/job.js +4 -4
- package/dist/schemas/transaction.d.ts +64 -18
- package/dist/schemas/transaction.js +22 -8
- package/package.json +1 -1
- package/src/schemas/job.ts +11 -9
- package/src/schemas/transaction.ts +31 -11
package/dist/schemas/job.d.ts
CHANGED
|
@@ -1270,6 +1270,8 @@ export declare const UpdateRoleJobInputSchema: z.ZodObject<{
|
|
|
1270
1270
|
id: z.ZodNonOptional<z.ZodOptional<z.ZodCUID2>>;
|
|
1271
1271
|
version: z.ZodNumber;
|
|
1272
1272
|
}, z.core.$strip>;
|
|
1273
|
+
export type CreateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
1274
|
+
export type CreateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
1273
1275
|
export type UpdateRoleJobInput = z.infer<typeof UpdateRoleJobInputSchema>;
|
|
1274
1276
|
export declare const UpdateGigJobInputSchema: z.ZodObject<{
|
|
1275
1277
|
overview: z.ZodOptional<z.ZodString>;
|
package/dist/schemas/job.js
CHANGED
|
@@ -266,15 +266,15 @@ exports.JobSearchDocumentSchema = zod_openapi_1.z
|
|
|
266
266
|
.openapi("JobSearchDocument");
|
|
267
267
|
exports.UpdateRoleJobInputSchema = exports.CreateRoleJobInputSchema.partial()
|
|
268
268
|
.extend({
|
|
269
|
-
version: zod_openapi_1.z.number().int().openapi({ example: 2 })
|
|
269
|
+
version: zod_openapi_1.z.number().int().openapi({ example: 2 }),
|
|
270
270
|
})
|
|
271
271
|
.required({
|
|
272
|
-
id: true
|
|
272
|
+
id: true,
|
|
273
273
|
});
|
|
274
274
|
exports.UpdateGigJobInputSchema = exports.CreateGigJobInputSchema.partial()
|
|
275
275
|
.extend({
|
|
276
|
-
version: zod_openapi_1.z.number().int().openapi({ example: 2 })
|
|
276
|
+
version: zod_openapi_1.z.number().int().openapi({ example: 2 }),
|
|
277
277
|
})
|
|
278
278
|
.required({
|
|
279
|
-
id: true
|
|
279
|
+
id: true,
|
|
280
280
|
});
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { z } from "@hono/zod-openapi";
|
|
2
|
-
export declare const TransactionDiscountSnapshotSchema: z.ZodObject<{
|
|
3
|
-
code: z.ZodOptional<z.ZodString>;
|
|
4
|
-
amount: z.ZodNumber;
|
|
5
|
-
type: z.ZodEnum<{
|
|
6
|
-
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
7
|
-
readonly PERCENTAGE: "Percentage";
|
|
8
|
-
}>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
2
|
export declare const BaseTransactionSchema: z.ZodObject<{
|
|
11
3
|
id: z.ZodCUID2;
|
|
12
4
|
productId: z.ZodCUID2;
|
|
@@ -40,12 +32,13 @@ export declare const BaseTransactionSchema: z.ZodObject<{
|
|
|
40
32
|
}>;
|
|
41
33
|
providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
34
|
discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
43
|
-
|
|
44
|
-
amount: z.ZodNumber;
|
|
45
|
-
type: z.ZodEnum<{
|
|
35
|
+
discountType: z.ZodEnum<{
|
|
46
36
|
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
47
37
|
readonly PERCENTAGE: "Percentage";
|
|
48
38
|
}>;
|
|
39
|
+
amount: z.ZodNumber;
|
|
40
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
41
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
49
42
|
}, z.core.$strip>>>;
|
|
50
43
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
51
44
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
@@ -57,6 +50,7 @@ export declare const InitTransactionInputSchema: z.ZodObject<{
|
|
|
57
50
|
readonly PAYSTACK: "PAYSTACK";
|
|
58
51
|
readonly NONE: "NONE";
|
|
59
52
|
}>;
|
|
53
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
60
54
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
61
55
|
amount: z.ZodOptional<z.ZodNumber>;
|
|
62
56
|
}, z.core.$strip>;
|
|
@@ -91,12 +85,13 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
|
|
|
91
85
|
readonly NONE: "NONE";
|
|
92
86
|
}>;
|
|
93
87
|
discountApplied: z.ZodOptional<z.ZodObject<{
|
|
94
|
-
|
|
95
|
-
amount: z.ZodNumber;
|
|
96
|
-
type: z.ZodEnum<{
|
|
88
|
+
discountType: z.ZodEnum<{
|
|
97
89
|
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
98
90
|
readonly PERCENTAGE: "Percentage";
|
|
99
91
|
}>;
|
|
92
|
+
amount: z.ZodNumber;
|
|
93
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
94
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
100
95
|
}, z.core.$strip>>;
|
|
101
96
|
providerTransactionId: z.ZodOptional<z.ZodString>;
|
|
102
97
|
}, z.core.$strip>;
|
|
@@ -141,12 +136,13 @@ export declare const TransactionEntitySchema: z.ZodObject<{
|
|
|
141
136
|
}>;
|
|
142
137
|
providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
138
|
discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
144
|
-
|
|
145
|
-
amount: z.ZodNumber;
|
|
146
|
-
type: z.ZodEnum<{
|
|
139
|
+
discountType: z.ZodEnum<{
|
|
147
140
|
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
148
141
|
readonly PERCENTAGE: "Percentage";
|
|
149
142
|
}>;
|
|
143
|
+
amount: z.ZodNumber;
|
|
144
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
145
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
150
146
|
}, z.core.$strip>>>;
|
|
151
147
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
152
148
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
@@ -155,9 +151,59 @@ export declare const TransactionEntitySchema: z.ZodObject<{
|
|
|
155
151
|
sellerId: z.ZodOptional<z.ZodString>;
|
|
156
152
|
sellerUsername: z.ZodOptional<z.ZodString>;
|
|
157
153
|
}, z.core.$strip>;
|
|
158
|
-
export
|
|
154
|
+
export declare const InitTransactionOutputSchema: z.ZodObject<{
|
|
155
|
+
transaction: z.ZodObject<{
|
|
156
|
+
id: z.ZodCUID2;
|
|
157
|
+
productId: z.ZodCUID2;
|
|
158
|
+
buyerId: z.ZodCUID2;
|
|
159
|
+
amount: z.ZodNumber;
|
|
160
|
+
platformFee: z.ZodNumber;
|
|
161
|
+
sellerAmount: z.ZodNumber;
|
|
162
|
+
currency: z.ZodEnum<{
|
|
163
|
+
readonly USD: "USD (United States Dollar)";
|
|
164
|
+
readonly EUR: "EUR (Euro)";
|
|
165
|
+
readonly GBP: "GBP (British Pound Sterling)";
|
|
166
|
+
readonly NGN: "NGN (Nigerian Naira)";
|
|
167
|
+
readonly CAD: "CAD (Canadian Dollar)";
|
|
168
|
+
readonly AUD: "AUD (Australian Dollar)";
|
|
169
|
+
readonly JPY: "JPY (Japanese Yen)";
|
|
170
|
+
readonly CHF: "CHF (Swiss Franc)";
|
|
171
|
+
readonly INR: "INR (Indian Rupee)";
|
|
172
|
+
readonly ZAR: "ZAR (South African Rand)";
|
|
173
|
+
}>;
|
|
174
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
175
|
+
readonly PENDING: "PENDING";
|
|
176
|
+
readonly SUCCESS: "SUCCESS";
|
|
177
|
+
readonly FAILED: "FAILED";
|
|
178
|
+
readonly REFUNDED: "REFUNDED";
|
|
179
|
+
}>>;
|
|
180
|
+
paymentProvider: z.ZodEnum<{
|
|
181
|
+
readonly STRIPE: "STRIPE";
|
|
182
|
+
readonly PAYSTACK: "PAYSTACK";
|
|
183
|
+
readonly NONE: "NONE";
|
|
184
|
+
}>;
|
|
185
|
+
providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
186
|
+
discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
187
|
+
discountType: z.ZodEnum<{
|
|
188
|
+
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
189
|
+
readonly PERCENTAGE: "Percentage";
|
|
190
|
+
}>;
|
|
191
|
+
amount: z.ZodNumber;
|
|
192
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
193
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
194
|
+
}, z.core.$strip>>>;
|
|
195
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
196
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
197
|
+
productTitle: z.ZodOptional<z.ZodString>;
|
|
198
|
+
sellerName: z.ZodOptional<z.ZodString>;
|
|
199
|
+
sellerId: z.ZodOptional<z.ZodString>;
|
|
200
|
+
sellerUsername: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
checkoutUrl: z.ZodNullable<z.ZodURL>;
|
|
203
|
+
}, z.core.$strip>;
|
|
159
204
|
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
160
205
|
export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;
|
|
161
206
|
export type CreateTransactionInput = z.infer<typeof CreateTransactionInputSchema>;
|
|
162
207
|
export type UpdateTransactionWebhookInput = z.infer<typeof UpdateTransactionWebhookInputSchema>;
|
|
163
208
|
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
209
|
+
export type InitTransactionResult = z.infer<typeof InitTransactionOutputSchema>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TransactionEntitySchema = exports.UpdateTransactionWebhookInputSchema = exports.CreateTransactionInputSchema = exports.InitTransactionInputSchema = exports.BaseTransactionSchema =
|
|
3
|
+
exports.InitTransactionOutputSchema = exports.TransactionEntitySchema = exports.UpdateTransactionWebhookInputSchema = exports.CreateTransactionInputSchema = exports.InitTransactionInputSchema = exports.BaseTransactionSchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
|
-
|
|
7
|
-
code: zod_openapi_1.z.string().optional(),
|
|
8
|
-
amount: zod_openapi_1.z.number().int("Amount must be a whole number"),
|
|
9
|
-
type: zod_openapi_1.z.enum(constants_1.DISCOUNT_TYPES),
|
|
10
|
-
});
|
|
6
|
+
const product_1 = require("./product");
|
|
11
7
|
exports.BaseTransactionSchema = zod_openapi_1.z.object({
|
|
12
8
|
id: zod_openapi_1.z.cuid2(),
|
|
13
9
|
productId: zod_openapi_1.z.cuid2(),
|
|
@@ -20,15 +16,22 @@ exports.BaseTransactionSchema = zod_openapi_1.z.object({
|
|
|
20
16
|
status: zod_openapi_1.z.enum(constants_1.TRANSACTION_STATUSES).default("PENDING"),
|
|
21
17
|
paymentProvider: zod_openapi_1.z.enum(constants_1.PAYMENT_PROVIDERS),
|
|
22
18
|
providerTransactionId: zod_openapi_1.z.string().nullable().optional(),
|
|
23
|
-
discountApplied:
|
|
19
|
+
discountApplied: product_1.ProductDiscountEntitySchema.nullable().optional(),
|
|
24
20
|
createdAt: zod_openapi_1.z.coerce.date(),
|
|
25
21
|
updatedAt: zod_openapi_1.z.coerce.date(),
|
|
26
22
|
});
|
|
23
|
+
// ==========================================
|
|
24
|
+
// INPUT SCHEMAS
|
|
25
|
+
// ==========================================
|
|
27
26
|
exports.InitTransactionInputSchema = zod_openapi_1.z.object({
|
|
28
27
|
productId: zod_openapi_1.z
|
|
29
28
|
.cuid2()
|
|
30
29
|
.openapi({ description: "ID of the product being purchased" }),
|
|
31
30
|
paymentProvider: zod_openapi_1.z.enum(constants_1.PAYMENT_PROVIDERS),
|
|
31
|
+
email: zod_openapi_1.z
|
|
32
|
+
.email()
|
|
33
|
+
.optional()
|
|
34
|
+
.openapi({ description: "Buyer's email address from the checkout form" }),
|
|
32
35
|
discountCode: zod_openapi_1.z
|
|
33
36
|
.string()
|
|
34
37
|
.optional()
|
|
@@ -53,16 +56,27 @@ exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
|
|
|
53
56
|
paymentProvider: true,
|
|
54
57
|
status: true,
|
|
55
58
|
}).extend({
|
|
56
|
-
discountApplied:
|
|
59
|
+
discountApplied: product_1.ProductDiscountEntitySchema.optional(),
|
|
57
60
|
providerTransactionId: zod_openapi_1.z.string().optional(),
|
|
58
61
|
});
|
|
59
62
|
exports.UpdateTransactionWebhookInputSchema = zod_openapi_1.z.object({
|
|
60
63
|
status: zod_openapi_1.z.enum(constants_1.TRANSACTION_STATUSES),
|
|
61
64
|
providerTransactionId: zod_openapi_1.z.string(),
|
|
62
65
|
});
|
|
66
|
+
// ==========================================
|
|
67
|
+
// ENTITY & OUTPUT SCHEMAS
|
|
68
|
+
// ==========================================
|
|
63
69
|
exports.TransactionEntitySchema = exports.BaseTransactionSchema.extend({
|
|
64
70
|
productTitle: zod_openapi_1.z.string().optional(),
|
|
65
71
|
sellerName: zod_openapi_1.z.string().optional(),
|
|
66
72
|
sellerId: zod_openapi_1.z.string().optional(),
|
|
67
73
|
sellerUsername: zod_openapi_1.z.string().optional(),
|
|
68
74
|
}).openapi({ title: "TransactionEntity" });
|
|
75
|
+
exports.InitTransactionOutputSchema = zod_openapi_1.z
|
|
76
|
+
.object({
|
|
77
|
+
transaction: exports.TransactionEntitySchema,
|
|
78
|
+
checkoutUrl: zod_openapi_1.z.url().nullable().openapi({
|
|
79
|
+
description: "The Stripe/Paystack checkout URL to redirect the user to",
|
|
80
|
+
}),
|
|
81
|
+
})
|
|
82
|
+
.openapi({ title: "InitTransactionResult" });
|
package/package.json
CHANGED
package/src/schemas/job.ts
CHANGED
|
@@ -359,25 +359,27 @@ export const JobSearchDocumentSchema = z
|
|
|
359
359
|
export type JobSearchDocument = z.infer<typeof JobSearchDocumentSchema>;
|
|
360
360
|
|
|
361
361
|
export const UpdateRoleJobInputSchema = CreateRoleJobInputSchema.partial()
|
|
362
|
-
.extend({
|
|
363
|
-
version: z.number().int().openapi({ example: 2 })
|
|
362
|
+
.extend({
|
|
363
|
+
version: z.number().int().openapi({ example: 2 }),
|
|
364
364
|
})
|
|
365
|
-
.required({
|
|
366
|
-
id: true
|
|
365
|
+
.required({
|
|
366
|
+
id: true,
|
|
367
367
|
});
|
|
368
|
+
export type CreateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
369
|
+
export type CreateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
368
370
|
|
|
369
371
|
export type UpdateRoleJobInput = z.infer<typeof UpdateRoleJobInputSchema>;
|
|
370
372
|
|
|
371
373
|
export const UpdateGigJobInputSchema = CreateGigJobInputSchema.partial()
|
|
372
|
-
.extend({
|
|
373
|
-
version: z.number().int().openapi({ example: 2 })
|
|
374
|
+
.extend({
|
|
375
|
+
version: z.number().int().openapi({ example: 2 }),
|
|
374
376
|
})
|
|
375
|
-
.required({
|
|
376
|
-
id: true
|
|
377
|
+
.required({
|
|
378
|
+
id: true,
|
|
377
379
|
});
|
|
378
380
|
|
|
379
381
|
export type UpdateGigJobInput = z.infer<typeof UpdateGigJobInputSchema>;
|
|
380
382
|
|
|
381
383
|
export type UpdateRoleJobOutput = z.infer<typeof RoleJobEntitySchema>;
|
|
382
384
|
|
|
383
|
-
export type UpdateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
385
|
+
export type UpdateGigJobOutput = z.infer<typeof GigJobEntitySchema>;
|
|
@@ -5,12 +5,9 @@ import {
|
|
|
5
5
|
TRANSACTION_STATUSES,
|
|
6
6
|
PAYMENT_PROVIDERS,
|
|
7
7
|
} from "../constants";
|
|
8
|
+
import { ProductDiscountEntitySchema } from "./product";
|
|
9
|
+
|
|
8
10
|
|
|
9
|
-
export const TransactionDiscountSnapshotSchema = z.object({
|
|
10
|
-
code: z.string().optional(),
|
|
11
|
-
amount: z.number().int("Amount must be a whole number"),
|
|
12
|
-
type: z.enum(DISCOUNT_TYPES),
|
|
13
|
-
});
|
|
14
11
|
|
|
15
12
|
export const BaseTransactionSchema = z.object({
|
|
16
13
|
id: z.cuid2(),
|
|
@@ -27,17 +24,25 @@ export const BaseTransactionSchema = z.object({
|
|
|
27
24
|
paymentProvider: z.enum(PAYMENT_PROVIDERS),
|
|
28
25
|
providerTransactionId: z.string().nullable().optional(),
|
|
29
26
|
|
|
30
|
-
discountApplied:
|
|
27
|
+
discountApplied: ProductDiscountEntitySchema.nullable().optional(),
|
|
31
28
|
|
|
32
29
|
createdAt: z.coerce.date(),
|
|
33
30
|
updatedAt: z.coerce.date(),
|
|
34
31
|
});
|
|
35
32
|
|
|
33
|
+
// ==========================================
|
|
34
|
+
// INPUT SCHEMAS
|
|
35
|
+
// ==========================================
|
|
36
|
+
|
|
36
37
|
export const InitTransactionInputSchema = z.object({
|
|
37
38
|
productId: z
|
|
38
39
|
.cuid2()
|
|
39
40
|
.openapi({ description: "ID of the product being purchased" }),
|
|
40
41
|
paymentProvider: z.enum(PAYMENT_PROVIDERS),
|
|
42
|
+
email: z
|
|
43
|
+
.email()
|
|
44
|
+
.optional()
|
|
45
|
+
.openapi({ description: "Buyer's email address from the checkout form" }),
|
|
41
46
|
discountCode: z
|
|
42
47
|
.string()
|
|
43
48
|
.optional()
|
|
@@ -64,8 +69,8 @@ export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
|
|
|
64
69
|
paymentProvider: true,
|
|
65
70
|
status: true,
|
|
66
71
|
}).extend({
|
|
67
|
-
discountApplied:
|
|
68
|
-
providerTransactionId: z.string().optional(),
|
|
72
|
+
discountApplied: ProductDiscountEntitySchema.optional(),
|
|
73
|
+
providerTransactionId: z.string().optional(),
|
|
69
74
|
});
|
|
70
75
|
|
|
71
76
|
export const UpdateTransactionWebhookInputSchema = z.object({
|
|
@@ -73,6 +78,10 @@ export const UpdateTransactionWebhookInputSchema = z.object({
|
|
|
73
78
|
providerTransactionId: z.string(),
|
|
74
79
|
});
|
|
75
80
|
|
|
81
|
+
// ==========================================
|
|
82
|
+
// ENTITY & OUTPUT SCHEMAS
|
|
83
|
+
// ==========================================
|
|
84
|
+
|
|
76
85
|
export const TransactionEntitySchema = BaseTransactionSchema.extend({
|
|
77
86
|
productTitle: z.string().optional(),
|
|
78
87
|
sellerName: z.string().optional(),
|
|
@@ -80,9 +89,19 @@ export const TransactionEntitySchema = BaseTransactionSchema.extend({
|
|
|
80
89
|
sellerUsername: z.string().optional(),
|
|
81
90
|
}).openapi({ title: "TransactionEntity" });
|
|
82
91
|
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
export const InitTransactionOutputSchema = z
|
|
93
|
+
.object({
|
|
94
|
+
transaction: TransactionEntitySchema,
|
|
95
|
+
checkoutUrl: z.url().nullable().openapi({
|
|
96
|
+
description: "The Stripe/Paystack checkout URL to redirect the user to",
|
|
97
|
+
}),
|
|
98
|
+
})
|
|
99
|
+
.openapi({ title: "InitTransactionResult" });
|
|
100
|
+
|
|
101
|
+
// ==========================================
|
|
102
|
+
// TYPES EXPORTS
|
|
103
|
+
// ==========================================
|
|
104
|
+
|
|
86
105
|
|
|
87
106
|
export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
|
|
88
107
|
|
|
@@ -95,3 +114,4 @@ export type UpdateTransactionWebhookInput = z.infer<
|
|
|
95
114
|
>;
|
|
96
115
|
|
|
97
116
|
export type TransactionEntity = z.infer<typeof TransactionEntitySchema>;
|
|
117
|
+
export type InitTransactionResult = z.infer<typeof InitTransactionOutputSchema>;
|