@vulog/aima-event 1.1.77 → 1.1.79
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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -5
- package/dist/index.mjs +12 -5
- package/package.json +3 -3
- package/src/getEvents.ts +15 -8
package/dist/index.d.mts
CHANGED
|
@@ -35,8 +35,8 @@ type EventFilters = {
|
|
|
35
35
|
*/
|
|
36
36
|
endDate?: string;
|
|
37
37
|
};
|
|
38
|
-
declare const getEventsByType: (client: Client, type: EventType, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
39
|
-
declare const getEvents: (client: Client, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
40
|
-
declare const getEventsByTripId: (client: Client, tripId: string, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
38
|
+
declare const getEventsByType: (client: Client, type: EventType, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
39
|
+
declare const getEvents: (client: Client, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
40
|
+
declare const getEventsByTripId: (client: Client, tripId: string, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
41
41
|
|
|
42
42
|
export { type Event, type EventFilters, type EventType, type ExtraInfo, getEvents, getEventsByTripId, getEventsByType };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ type EventFilters = {
|
|
|
35
35
|
*/
|
|
36
36
|
endDate?: string;
|
|
37
37
|
};
|
|
38
|
-
declare const getEventsByType: (client: Client, type: EventType, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
39
|
-
declare const getEvents: (client: Client, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
40
|
-
declare const getEventsByTripId: (client: Client, tripId: string, options?: PaginableOptions<EventFilters>) => Promise<PaginableResponse<Event>>;
|
|
38
|
+
declare const getEventsByType: (client: Client, type: EventType, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
39
|
+
declare const getEvents: (client: Client, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
40
|
+
declare const getEventsByTripId: (client: Client, tripId: string, options?: PaginableOptions<EventFilters, "date">) => Promise<PaginableResponse<Event>>;
|
|
41
41
|
|
|
42
42
|
export { type Event, type EventFilters, type EventType, type ExtraInfo, getEvents, getEventsByTripId, getEventsByType };
|
package/dist/index.js
CHANGED
|
@@ -234,7 +234,10 @@ var getEventsByType = async (client, type, options) => {
|
|
|
234
234
|
startDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
235
235
|
endDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).default(endDate)
|
|
236
236
|
});
|
|
237
|
-
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
|
|
237
|
+
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
|
|
238
|
+
EventFiltersSchema,
|
|
239
|
+
import_zod.z.enum(["date"]).optional().default("date")
|
|
240
|
+
).default({});
|
|
238
241
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
239
242
|
if (!resultOptions.success) {
|
|
240
243
|
throw new TypeError("Invalid options", {
|
|
@@ -245,6 +248,7 @@ var getEventsByType = async (client, type, options) => {
|
|
|
245
248
|
const searchParams = new URLSearchParams();
|
|
246
249
|
searchParams.append("page", finalOptions.page.toString());
|
|
247
250
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
251
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
248
252
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
249
253
|
if (value === void 0) {
|
|
250
254
|
return;
|
|
@@ -271,7 +275,10 @@ var getEvents = async (client, options) => {
|
|
|
271
275
|
startDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
272
276
|
endDate: import_zod.z.string().datetime({ offset: false, precision: 0 }).default(endDate)
|
|
273
277
|
});
|
|
274
|
-
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
|
|
278
|
+
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
|
|
279
|
+
EventFiltersSchema,
|
|
280
|
+
import_zod.z.enum(["date"]).optional().default("date")
|
|
281
|
+
).default({});
|
|
275
282
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
276
283
|
if (!resultOptions.success) {
|
|
277
284
|
throw new TypeError("Invalid options", {
|
|
@@ -282,6 +289,7 @@ var getEvents = async (client, options) => {
|
|
|
282
289
|
const searchParams = new URLSearchParams();
|
|
283
290
|
searchParams.append("page", finalOptions.page.toString());
|
|
284
291
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
292
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
285
293
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
286
294
|
if (value === void 0) {
|
|
287
295
|
return;
|
|
@@ -306,7 +314,7 @@ var getEventsByTripId = async (client, tripId, options) => {
|
|
|
306
314
|
});
|
|
307
315
|
const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(
|
|
308
316
|
EventFiltersSchema,
|
|
309
|
-
import_zod.z.enum(["date"]).optional()
|
|
317
|
+
import_zod.z.enum(["date"]).optional().default("date")
|
|
310
318
|
).default({});
|
|
311
319
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
312
320
|
if (!resultOptions.success) {
|
|
@@ -318,8 +326,7 @@ var getEventsByTripId = async (client, tripId, options) => {
|
|
|
318
326
|
const searchParams = new URLSearchParams();
|
|
319
327
|
searchParams.append("page", finalOptions.page.toString());
|
|
320
328
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
321
|
-
searchParams.append("sort", finalOptions.sort.toString());
|
|
322
|
-
searchParams.append("sortDirection", finalOptions.sortDirection.toString());
|
|
329
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
323
330
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
324
331
|
if (value === void 0) {
|
|
325
332
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -206,7 +206,10 @@ var getEventsByType = async (client, type, options) => {
|
|
|
206
206
|
startDate: z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
207
207
|
endDate: z.string().datetime({ offset: false, precision: 0 }).default(endDate)
|
|
208
208
|
});
|
|
209
|
-
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
209
|
+
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
210
|
+
EventFiltersSchema,
|
|
211
|
+
z.enum(["date"]).optional().default("date")
|
|
212
|
+
).default({});
|
|
210
213
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
211
214
|
if (!resultOptions.success) {
|
|
212
215
|
throw new TypeError("Invalid options", {
|
|
@@ -217,6 +220,7 @@ var getEventsByType = async (client, type, options) => {
|
|
|
217
220
|
const searchParams = new URLSearchParams();
|
|
218
221
|
searchParams.append("page", finalOptions.page.toString());
|
|
219
222
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
223
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
220
224
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
221
225
|
if (value === void 0) {
|
|
222
226
|
return;
|
|
@@ -243,7 +247,10 @@ var getEvents = async (client, options) => {
|
|
|
243
247
|
startDate: z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
244
248
|
endDate: z.string().datetime({ offset: false, precision: 0 }).default(endDate)
|
|
245
249
|
});
|
|
246
|
-
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
250
|
+
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
251
|
+
EventFiltersSchema,
|
|
252
|
+
z.enum(["date"]).optional().default("date")
|
|
253
|
+
).default({});
|
|
247
254
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
248
255
|
if (!resultOptions.success) {
|
|
249
256
|
throw new TypeError("Invalid options", {
|
|
@@ -254,6 +261,7 @@ var getEvents = async (client, options) => {
|
|
|
254
261
|
const searchParams = new URLSearchParams();
|
|
255
262
|
searchParams.append("page", finalOptions.page.toString());
|
|
256
263
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
264
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
257
265
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
258
266
|
if (value === void 0) {
|
|
259
267
|
return;
|
|
@@ -278,7 +286,7 @@ var getEventsByTripId = async (client, tripId, options) => {
|
|
|
278
286
|
});
|
|
279
287
|
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
280
288
|
EventFiltersSchema,
|
|
281
|
-
z.enum(["date"]).optional()
|
|
289
|
+
z.enum(["date"]).optional().default("date")
|
|
282
290
|
).default({});
|
|
283
291
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
284
292
|
if (!resultOptions.success) {
|
|
@@ -290,8 +298,7 @@ var getEventsByTripId = async (client, tripId, options) => {
|
|
|
290
298
|
const searchParams = new URLSearchParams();
|
|
291
299
|
searchParams.append("page", finalOptions.page.toString());
|
|
292
300
|
searchParams.append("pageSize", finalOptions.pageSize.toString());
|
|
293
|
-
searchParams.append("sort", finalOptions.sort.toString());
|
|
294
|
-
searchParams.append("sortDirection", finalOptions.sortDirection.toString());
|
|
301
|
+
searchParams.append("sort", `${finalOptions.sort.toString()},${finalOptions.sortDirection.toString()}`);
|
|
295
302
|
Object.entries(finalOptions.filters).forEach(([key, value]) => {
|
|
296
303
|
if (value === void 0) {
|
|
297
304
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-event",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.79",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Vulog",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.1.
|
|
23
|
-
"@vulog/aima-core": "1.1.
|
|
22
|
+
"@vulog/aima-client": "1.1.79",
|
|
23
|
+
"@vulog/aima-core": "1.1.79"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.24.2"
|
package/src/getEvents.ts
CHANGED
|
@@ -211,7 +211,7 @@ export type EventFilters = {
|
|
|
211
211
|
export const getEventsByType = async (
|
|
212
212
|
client: Client,
|
|
213
213
|
type: EventType,
|
|
214
|
-
options?: PaginableOptions<EventFilters>
|
|
214
|
+
options?: PaginableOptions<EventFilters, 'date'>
|
|
215
215
|
): Promise<PaginableResponse<Event>> => {
|
|
216
216
|
const resultStatus = EventTypeList.safeParse(type);
|
|
217
217
|
if (!resultStatus.success) {
|
|
@@ -228,7 +228,10 @@ export const getEventsByType = async (
|
|
|
228
228
|
startDate: z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
229
229
|
endDate: z.string().datetime({ offset: false, precision: 0 }).default(endDate),
|
|
230
230
|
});
|
|
231
|
-
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
231
|
+
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
232
|
+
EventFiltersSchema,
|
|
233
|
+
z.enum(['date']).optional().default('date')
|
|
234
|
+
).default({});
|
|
232
235
|
|
|
233
236
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
234
237
|
if (!resultOptions.success) {
|
|
@@ -242,6 +245,7 @@ export const getEventsByType = async (
|
|
|
242
245
|
const searchParams = new URLSearchParams();
|
|
243
246
|
searchParams.append('page', finalOptions.page!.toString());
|
|
244
247
|
searchParams.append('pageSize', finalOptions.pageSize!.toString());
|
|
248
|
+
searchParams.append('sort', `${finalOptions.sort!.toString()},${finalOptions.sortDirection!.toString()}`);
|
|
245
249
|
|
|
246
250
|
Object.entries(finalOptions.filters!).forEach(([key, value]) => {
|
|
247
251
|
if (value === undefined) {
|
|
@@ -267,7 +271,7 @@ export const getEventsByType = async (
|
|
|
267
271
|
|
|
268
272
|
export const getEvents = async (
|
|
269
273
|
client: Client,
|
|
270
|
-
options?: PaginableOptions<EventFilters>
|
|
274
|
+
options?: PaginableOptions<EventFilters, 'date'>
|
|
271
275
|
): Promise<PaginableResponse<Event>> => {
|
|
272
276
|
const date = new Date();
|
|
273
277
|
date.setMilliseconds(0);
|
|
@@ -278,7 +282,10 @@ export const getEvents = async (
|
|
|
278
282
|
startDate: z.string().datetime({ offset: false, precision: 0 }).default(startDate),
|
|
279
283
|
endDate: z.string().datetime({ offset: false, precision: 0 }).default(endDate),
|
|
280
284
|
});
|
|
281
|
-
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
285
|
+
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
286
|
+
EventFiltersSchema,
|
|
287
|
+
z.enum(['date']).optional().default('date')
|
|
288
|
+
).default({});
|
|
282
289
|
|
|
283
290
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
284
291
|
if (!resultOptions.success) {
|
|
@@ -292,6 +299,7 @@ export const getEvents = async (
|
|
|
292
299
|
const searchParams = new URLSearchParams();
|
|
293
300
|
searchParams.append('page', finalOptions.page!.toString());
|
|
294
301
|
searchParams.append('pageSize', finalOptions.pageSize!.toString());
|
|
302
|
+
searchParams.append('sort', `${finalOptions.sort!.toString()},${finalOptions.sortDirection!.toString()}`);
|
|
295
303
|
|
|
296
304
|
Object.entries(finalOptions.filters!).forEach(([key, value]) => {
|
|
297
305
|
if (value === undefined) {
|
|
@@ -318,7 +326,7 @@ export const getEvents = async (
|
|
|
318
326
|
export const getEventsByTripId = async (
|
|
319
327
|
client: Client,
|
|
320
328
|
tripId: string,
|
|
321
|
-
options?: PaginableOptions<EventFilters>
|
|
329
|
+
options?: PaginableOptions<EventFilters, 'date'>
|
|
322
330
|
): Promise<PaginableResponse<Event>> => {
|
|
323
331
|
const EventFiltersSchema = z.object({
|
|
324
332
|
startDate: z.string().datetime({ offset: false, precision: 0 }).optional(),
|
|
@@ -327,7 +335,7 @@ export const getEventsByTripId = async (
|
|
|
327
335
|
});
|
|
328
336
|
const PaginableOptionsSchema = createPaginableOptionsSchema(
|
|
329
337
|
EventFiltersSchema,
|
|
330
|
-
z.enum(['date']).optional()
|
|
338
|
+
z.enum(['date']).optional().default('date')
|
|
331
339
|
).default({});
|
|
332
340
|
|
|
333
341
|
const resultOptions = PaginableOptionsSchema.safeParse(options);
|
|
@@ -342,8 +350,7 @@ export const getEventsByTripId = async (
|
|
|
342
350
|
const searchParams = new URLSearchParams();
|
|
343
351
|
searchParams.append('page', finalOptions.page!.toString());
|
|
344
352
|
searchParams.append('pageSize', finalOptions.pageSize!.toString());
|
|
345
|
-
searchParams.append('sort', finalOptions.sort!.toString());
|
|
346
|
-
searchParams.append('sortDirection', finalOptions.sortDirection!.toString());
|
|
353
|
+
searchParams.append('sort', `${finalOptions.sort!.toString()},${finalOptions.sortDirection!.toString()}`);
|
|
347
354
|
|
|
348
355
|
Object.entries(finalOptions.filters!).forEach(([key, value]) => {
|
|
349
356
|
if (value === undefined) {
|