@deallony/shared 1.1.97 → 1.1.98
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/cjs/schema/ad/save-ad.schema.d.ts +6 -22
- package/dist/cjs/schema/ad/save-ad.schema.js +18 -13
- package/dist/cjs/schema/ai/ai-fill-ad-form.schema.d.ts +6 -0
- package/dist/cjs/schema/ai/ai-fill-ad-form.schema.js +2 -0
- package/dist/esm/schema/ad/save-ad.schema.js +16 -11
- package/dist/esm/schema/ai/ai-fill-ad-form.schema.js +2 -0
- package/package.json +2 -2
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare const subjectTypeSchema: z.ZodEnum<{
|
|
3
|
+
properties: "properties";
|
|
4
|
+
services: "services";
|
|
5
|
+
motors: "motors";
|
|
6
|
+
used_products: "used_products";
|
|
7
|
+
}>;
|
|
2
8
|
export declare const createAdSchema: z.ZodObject<{
|
|
3
9
|
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
4
10
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -42,10 +48,6 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
42
48
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
43
49
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
44
50
|
}, z.core.$strip>>>;
|
|
45
|
-
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
46
|
-
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
47
|
-
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
48
|
-
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
49
51
|
}, z.core.$strip>>>;
|
|
50
52
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
51
53
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -77,7 +79,6 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
77
79
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
78
80
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
79
81
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
80
|
-
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
81
82
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
82
83
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
83
84
|
properties: "properties";
|
|
@@ -144,10 +145,6 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
144
145
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
145
146
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
146
147
|
}, z.core.$strip>>>;
|
|
147
|
-
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
148
|
-
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
149
|
-
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
150
|
-
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
151
148
|
id: z.ZodCoercedNumber<unknown>;
|
|
152
149
|
}, z.core.$strip>>>;
|
|
153
150
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -166,7 +163,6 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
166
163
|
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
167
164
|
locations: z.ZodArray<z.ZodObject<{
|
|
168
165
|
city_id: z.ZodNumber;
|
|
169
|
-
district_id: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
170
166
|
}, z.core.$strip>>;
|
|
171
167
|
}, z.core.$strip>>>;
|
|
172
168
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -179,7 +175,6 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
179
175
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
180
176
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
181
177
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
182
|
-
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
183
178
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
184
179
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
185
180
|
properties: "properties";
|
|
@@ -243,10 +238,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
243
238
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
244
239
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
245
240
|
}, z.core.$strip>>>;
|
|
246
|
-
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
247
|
-
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
248
|
-
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
249
|
-
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
250
241
|
}, z.core.$strip>>>;
|
|
251
242
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
252
243
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -278,7 +269,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
278
269
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
279
270
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
280
271
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
281
|
-
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
282
272
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
283
273
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
284
274
|
properties: "properties";
|
|
@@ -344,10 +334,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
344
334
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
345
335
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
346
336
|
}, z.core.$strip>>>;
|
|
347
|
-
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
348
|
-
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
349
|
-
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
350
|
-
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
351
337
|
id: z.ZodCoercedNumber<unknown>;
|
|
352
338
|
}, z.core.$strip>>>;
|
|
353
339
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -366,7 +352,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
366
352
|
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
367
353
|
locations: z.ZodArray<z.ZodObject<{
|
|
368
354
|
city_id: z.ZodNumber;
|
|
369
|
-
district_id: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
370
355
|
}, z.core.$strip>>;
|
|
371
356
|
}, z.core.$strip>>>;
|
|
372
357
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -379,7 +364,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
379
364
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
380
365
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
381
366
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
382
|
-
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
383
367
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
384
368
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
385
369
|
properties: "properties";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.saveAdSchema = exports.updateAdSchema = exports.createAdSchema = void 0;
|
|
3
|
+
exports.saveAdSchema = exports.updateAdSchema = exports.createAdSchema = exports.subjectTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
|
|
5
|
+
exports.subjectTypeSchema = zod_1.z.enum(['properties', 'services', 'motors', 'used_products']);
|
|
6
6
|
const adLocationSchema = zod_1.z.object({
|
|
7
7
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
8
8
|
admin_boundary_id: zod_1.z.coerce.number().int().positive(),
|
|
@@ -53,10 +53,10 @@ const createPropertySchema = zod_1.z.object({
|
|
|
53
53
|
feature_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).optional(),
|
|
54
54
|
facility_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).optional(),
|
|
55
55
|
property_facilities: zod_1.z.array(propertyFacilityRelationSchema).optional(),
|
|
56
|
-
condition_id:
|
|
57
|
-
age_id:
|
|
58
|
-
property_status_id:
|
|
59
|
-
license_type_id:
|
|
56
|
+
// condition_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
57
|
+
// age_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
58
|
+
// property_status_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
59
|
+
// license_type_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
60
60
|
});
|
|
61
61
|
const updatePropertySchema = createPropertySchema.extend({
|
|
62
62
|
id: zod_1.z.coerce.number().int().positive(),
|
|
@@ -85,7 +85,10 @@ const createServiceLocationSchema = zod_1.z.object({
|
|
|
85
85
|
});
|
|
86
86
|
const updateServiceLocationSchema = zod_1.z.object({
|
|
87
87
|
city_id: zod_1.z.number(),
|
|
88
|
-
district_id:
|
|
88
|
+
// district_id: z.preprocess(
|
|
89
|
+
// (v) => (v === null || v === '' ? undefined : v),
|
|
90
|
+
// z.coerce.number().int().optional(),
|
|
91
|
+
// ),
|
|
89
92
|
});
|
|
90
93
|
const createServiceSchema = zod_1.z.object({
|
|
91
94
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
@@ -113,13 +116,15 @@ const baseAdCommon = zod_1.z.object({
|
|
|
113
116
|
city_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
114
117
|
latitude: zod_1.z.coerce.number().optional().nullable(),
|
|
115
118
|
longitude: zod_1.z.coerce.number().optional().nullable(),
|
|
116
|
-
baseAdminBoundaryId:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
},
|
|
119
|
+
// baseAdminBoundaryId: z.preprocess(
|
|
120
|
+
// (value) => {
|
|
121
|
+
// if (value === 0 || value === '0') return undefined;
|
|
122
|
+
// return value;
|
|
123
|
+
// },
|
|
124
|
+
// z.coerce.number().optional().nullable(),
|
|
125
|
+
// ),
|
|
121
126
|
media: zod_1.z.array(zod_1.z.any()).optional().nullable(),
|
|
122
|
-
subject_type: subjectTypeSchema.optional(),
|
|
127
|
+
subject_type: exports.subjectTypeSchema.optional(),
|
|
123
128
|
base_price: zod_1.z.coerce.number().optional().nullable(),
|
|
124
129
|
contact_methods: zod_1.z
|
|
125
130
|
.object({
|
|
@@ -11,4 +11,10 @@ export declare const aiFillAdFormSchema: z.ZodObject<{
|
|
|
11
11
|
mimeType: z.ZodString;
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
}, z.core.$strip>>>;
|
|
14
|
+
subject_type: z.ZodEnum<{
|
|
15
|
+
properties: "properties";
|
|
16
|
+
services: "services";
|
|
17
|
+
motors: "motors";
|
|
18
|
+
used_products: "used_products";
|
|
19
|
+
}>;
|
|
14
20
|
}, z.core.$strip>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.aiFillAdFormSchema = exports.aiAdFillFormFileSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const ad_1 = require("../ad");
|
|
5
6
|
exports.aiAdFillFormFileSchema = zod_1.z.object({
|
|
6
7
|
URL: zod_1.z.string().trim().min(1),
|
|
7
8
|
mimeType: zod_1.z.string().trim().min(1),
|
|
@@ -10,4 +11,5 @@ exports.aiAdFillFormFileSchema = zod_1.z.object({
|
|
|
10
11
|
exports.aiFillAdFormSchema = zod_1.z.object({
|
|
11
12
|
text: zod_1.z.string().trim(),
|
|
12
13
|
files: zod_1.z.array(exports.aiAdFillFormFileSchema).optional(),
|
|
14
|
+
subject_type: ad_1.subjectTypeSchema
|
|
13
15
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
const subjectTypeSchema = z.enum(['properties', 'services', 'motors', 'used_products']);
|
|
2
|
+
export const subjectTypeSchema = z.enum(['properties', 'services', 'motors', 'used_products']);
|
|
3
3
|
const adLocationSchema = z.object({
|
|
4
4
|
ad_id: z.coerce.number().int().positive().optional(),
|
|
5
5
|
admin_boundary_id: z.coerce.number().int().positive(),
|
|
@@ -50,10 +50,10 @@ const createPropertySchema = z.object({
|
|
|
50
50
|
feature_ids: z.array(z.coerce.number().int().positive()).optional(),
|
|
51
51
|
facility_ids: z.array(z.coerce.number().int().positive()).optional(),
|
|
52
52
|
property_facilities: z.array(propertyFacilityRelationSchema).optional(),
|
|
53
|
-
condition_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
54
|
-
age_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
55
|
-
property_status_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
56
|
-
license_type_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
53
|
+
// condition_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
54
|
+
// age_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
55
|
+
// property_status_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
56
|
+
// license_type_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
57
57
|
});
|
|
58
58
|
const updatePropertySchema = createPropertySchema.extend({
|
|
59
59
|
id: z.coerce.number().int().positive(),
|
|
@@ -82,7 +82,10 @@ const createServiceLocationSchema = z.object({
|
|
|
82
82
|
});
|
|
83
83
|
const updateServiceLocationSchema = z.object({
|
|
84
84
|
city_id: z.number(),
|
|
85
|
-
district_id: z.preprocess(
|
|
85
|
+
// district_id: z.preprocess(
|
|
86
|
+
// (v) => (v === null || v === '' ? undefined : v),
|
|
87
|
+
// z.coerce.number().int().optional(),
|
|
88
|
+
// ),
|
|
86
89
|
});
|
|
87
90
|
const createServiceSchema = z.object({
|
|
88
91
|
ad_id: z.coerce.number().int().positive().optional(),
|
|
@@ -110,11 +113,13 @@ const baseAdCommon = z.object({
|
|
|
110
113
|
city_id: z.coerce.number().int().positive().optional().nullable(),
|
|
111
114
|
latitude: z.coerce.number().optional().nullable(),
|
|
112
115
|
longitude: z.coerce.number().optional().nullable(),
|
|
113
|
-
baseAdminBoundaryId: z.preprocess(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
},
|
|
116
|
+
// baseAdminBoundaryId: z.preprocess(
|
|
117
|
+
// (value) => {
|
|
118
|
+
// if (value === 0 || value === '0') return undefined;
|
|
119
|
+
// return value;
|
|
120
|
+
// },
|
|
121
|
+
// z.coerce.number().optional().nullable(),
|
|
122
|
+
// ),
|
|
118
123
|
media: z.array(z.any()).optional().nullable(),
|
|
119
124
|
subject_type: subjectTypeSchema.optional(),
|
|
120
125
|
base_price: z.coerce.number().optional().nullable(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { subjectTypeSchema } from '../ad/index.js';
|
|
2
3
|
export const aiAdFillFormFileSchema = z.object({
|
|
3
4
|
URL: z.string().trim().min(1),
|
|
4
5
|
mimeType: z.string().trim().min(1),
|
|
@@ -7,4 +8,5 @@ export const aiAdFillFormFileSchema = z.object({
|
|
|
7
8
|
export const aiFillAdFormSchema = z.object({
|
|
8
9
|
text: z.string().trim(),
|
|
9
10
|
files: z.array(aiAdFillFormFileSchema).optional(),
|
|
11
|
+
subject_type: subjectTypeSchema
|
|
10
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deallony/shared",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.98",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dashboard:update": "cd ../frontend-react-aloo && node ./scripts/upgrade-dellony.js",
|
|
28
28
|
"current": "npm view @deallony/shared version",
|
|
29
29
|
"============================= Links with project =============================": "",
|
|
30
|
-
"link:backend": "cd ../backend-service-marketplace && pnpm add @deallony/shared@file:../shared-deallony",
|
|
30
|
+
"link:backend": "cd ../backend-service-marketplace && pnpm uninstall @deallony/shared && pnpm add @deallony/shared@file:../shared-deallony",
|
|
31
31
|
"========": "============ DEFAULT ============",
|
|
32
32
|
"build": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && node ./scripts/fix-esm-imports.mjs",
|
|
33
33
|
"watch": "tsc -p tsconfig.cjs.json --watch",
|