@esb-market-contracts/backend 1.0.14 → 1.0.16

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.
Files changed (3) hide show
  1. package/api.d.ts +144 -0
  2. package/package.json +1 -1
  3. package/types.d.ts +124 -0
package/api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import { SessionPayload } from '@esb-market-contracts/admin-backend';
4
+ import { z } from 'zod';
4
5
 
5
6
  export type VariablesWithActor = {
6
7
  actorSession: SessionPayload;
@@ -290,6 +291,149 @@ declare const countriesRouter: import("hono/hono-base").HonoBase<{
290
291
  };
291
292
  }, "/catalog/countries", "/catalog/countries/update">;
292
293
  export type CountriesRouter = typeof countriesRouter;
294
+ declare const auditLogSourcesArray: readonly [
295
+ "admin",
296
+ "backend"
297
+ ];
298
+ export type AuditLogSource = (typeof auditLogSourcesArray)[number];
299
+ declare const auditLogSchema: import("drizzle-orm/zod").BuildSchema<"select", {
300
+ id: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgSerialBuilder>, {
301
+ name: string;
302
+ tableName: "audit_logs";
303
+ dataType: "number int32";
304
+ data: number;
305
+ driverParam: number;
306
+ notNull: true;
307
+ hasDefault: true;
308
+ isPrimaryKey: false;
309
+ isAutoincrement: false;
310
+ hasRuntimeDefault: false;
311
+ enumValues: undefined;
312
+ identity: undefined;
313
+ generated: undefined;
314
+ }>;
315
+ event: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[
316
+ string,
317
+ ...string[]
318
+ ]>>, "brand.created" | "brand.updated" | "category.created" | "category.updated" | "category.activated" | "category.archived" | "country.created" | "country.updated" | "customer.created" | "customer.updated">, {
319
+ name: string;
320
+ tableName: "audit_logs";
321
+ dataType: "string";
322
+ data: "brand.created" | "brand.updated" | "category.created" | "category.updated" | "category.activated" | "category.archived" | "country.created" | "country.updated" | "customer.created" | "customer.updated";
323
+ driverParam: string;
324
+ notNull: true;
325
+ hasDefault: false;
326
+ isPrimaryKey: false;
327
+ isAutoincrement: false;
328
+ hasRuntimeDefault: false;
329
+ enumValues: undefined;
330
+ identity: undefined;
331
+ generated: undefined;
332
+ }>;
333
+ actorEmployeeId: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").PgIntegerBuilder, {
334
+ name: string;
335
+ tableName: "audit_logs";
336
+ dataType: "number int32";
337
+ data: number;
338
+ driverParam: string | number;
339
+ notNull: false;
340
+ hasDefault: false;
341
+ isPrimaryKey: false;
342
+ isAutoincrement: false;
343
+ hasRuntimeDefault: false;
344
+ enumValues: undefined;
345
+ identity: undefined;
346
+ generated: undefined;
347
+ }>;
348
+ payload: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgJsonbBuilder>, {
349
+ name: string;
350
+ tableName: "audit_logs";
351
+ dataType: "object json";
352
+ data: unknown;
353
+ driverParam: unknown;
354
+ notNull: true;
355
+ hasDefault: false;
356
+ isPrimaryKey: false;
357
+ isAutoincrement: false;
358
+ hasRuntimeDefault: false;
359
+ enumValues: undefined;
360
+ identity: undefined;
361
+ generated: undefined;
362
+ }>;
363
+ createdAt: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTimestampBuilder>>, {
364
+ name: string;
365
+ tableName: "audit_logs";
366
+ dataType: "object date";
367
+ data: Date;
368
+ driverParam: string;
369
+ notNull: true;
370
+ hasDefault: true;
371
+ isPrimaryKey: false;
372
+ isAutoincrement: false;
373
+ hasRuntimeDefault: false;
374
+ enumValues: undefined;
375
+ identity: undefined;
376
+ generated: undefined;
377
+ }>;
378
+ }, undefined, undefined>;
379
+ export type AuditLog = z.infer<typeof auditLogSchema>;
380
+ export type AuditLogResult = AuditLog & {
381
+ source: AuditLogSource;
382
+ };
383
+ declare const auditLogsRouter: import("hono/hono-base").HonoBase<{
384
+ Variables: VariablesWithActor;
385
+ }, {
386
+ "/operations/audit-logs/existing-events": {
387
+ $get: {
388
+ input: {};
389
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
390
+ auditEvents: string[];
391
+ }>;
392
+ outputFormat: "json";
393
+ status: 200;
394
+ };
395
+ };
396
+ } & {
397
+ "/operations/audit-logs/one": {
398
+ $get: {
399
+ input: {
400
+ query: {
401
+ id: string | string[];
402
+ source: "admin" | "backend";
403
+ };
404
+ };
405
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
406
+ auditLog: AuditLogResult;
407
+ }>;
408
+ outputFormat: "json";
409
+ status: 200;
410
+ };
411
+ };
412
+ } & {
413
+ "/operations/audit-logs/search": {
414
+ $post: {
415
+ input: {
416
+ json: {
417
+ pagination: {
418
+ offset?: unknown;
419
+ limit?: unknown;
420
+ };
421
+ where?: {
422
+ event?: string | undefined;
423
+ actorEmployeeId?: number | null | undefined;
424
+ } | undefined;
425
+ };
426
+ };
427
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
428
+ auditLogs: AuditLogResult[];
429
+ total: number;
430
+ }>;
431
+ outputFormat: "json";
432
+ status: 200;
433
+ };
434
+ };
435
+ }, "/operations/audit-logs", "/operations/audit-logs/search">;
436
+ export type AuditLogsRouter = typeof auditLogsRouter;
293
437
  declare const customersRouter: import("hono/hono-base").HonoBase<{
294
438
  Variables: VariablesWithActor;
295
439
  }, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esb-market-contracts/backend",
3
3
  "description": "Shared TypeScript contract definitions for backend.",
4
- "version": "1.0.14",
4
+ "version": "1.0.16",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -219,6 +219,130 @@ export type CountrySearchResult = {
219
219
  export type CountrySelectOneQuery = z.infer<typeof countrySelectOneQuerySchema>;
220
220
  export type CountryCreatePayload = z.infer<typeof countryCreatePayloadSchema>;
221
221
  export type CountryUpdatePayload = z.infer<typeof countryUpdatePayloadSchema>;
222
+ declare const auditLogSchema: import("drizzle-orm/zod").BuildSchema<"select", {
223
+ id: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgSerialBuilder>, {
224
+ name: string;
225
+ tableName: "audit_logs";
226
+ dataType: "number int32";
227
+ data: number;
228
+ driverParam: number;
229
+ notNull: true;
230
+ hasDefault: true;
231
+ isPrimaryKey: false;
232
+ isAutoincrement: false;
233
+ hasRuntimeDefault: false;
234
+ enumValues: undefined;
235
+ identity: undefined;
236
+ generated: undefined;
237
+ }>;
238
+ event: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[
239
+ string,
240
+ ...string[]
241
+ ]>>, "brand.created" | "brand.updated" | "category.created" | "category.updated" | "category.activated" | "category.archived" | "country.created" | "country.updated" | "customer.created" | "customer.updated">, {
242
+ name: string;
243
+ tableName: "audit_logs";
244
+ dataType: "string";
245
+ data: "brand.created" | "brand.updated" | "category.created" | "category.updated" | "category.activated" | "category.archived" | "country.created" | "country.updated" | "customer.created" | "customer.updated";
246
+ driverParam: string;
247
+ notNull: true;
248
+ hasDefault: false;
249
+ isPrimaryKey: false;
250
+ isAutoincrement: false;
251
+ hasRuntimeDefault: false;
252
+ enumValues: undefined;
253
+ identity: undefined;
254
+ generated: undefined;
255
+ }>;
256
+ actorEmployeeId: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").PgIntegerBuilder, {
257
+ name: string;
258
+ tableName: "audit_logs";
259
+ dataType: "number int32";
260
+ data: number;
261
+ driverParam: string | number;
262
+ notNull: false;
263
+ hasDefault: false;
264
+ isPrimaryKey: false;
265
+ isAutoincrement: false;
266
+ hasRuntimeDefault: false;
267
+ enumValues: undefined;
268
+ identity: undefined;
269
+ generated: undefined;
270
+ }>;
271
+ payload: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgJsonbBuilder>, {
272
+ name: string;
273
+ tableName: "audit_logs";
274
+ dataType: "object json";
275
+ data: unknown;
276
+ driverParam: unknown;
277
+ notNull: true;
278
+ hasDefault: false;
279
+ isPrimaryKey: false;
280
+ isAutoincrement: false;
281
+ hasRuntimeDefault: false;
282
+ enumValues: undefined;
283
+ identity: undefined;
284
+ generated: undefined;
285
+ }>;
286
+ createdAt: import("drizzle-orm/pg-core").PgBuildColumn<"audit_logs", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTimestampBuilder>>, {
287
+ name: string;
288
+ tableName: "audit_logs";
289
+ dataType: "object date";
290
+ data: Date;
291
+ driverParam: string;
292
+ notNull: true;
293
+ hasDefault: true;
294
+ isPrimaryKey: false;
295
+ isAutoincrement: false;
296
+ hasRuntimeDefault: false;
297
+ enumValues: undefined;
298
+ identity: undefined;
299
+ generated: undefined;
300
+ }>;
301
+ }, undefined, undefined>;
302
+ export type AuditLog = z.infer<typeof auditLogSchema>;
303
+ declare const auditLogSourcesArray: readonly [
304
+ "admin",
305
+ "backend"
306
+ ];
307
+ export type AuditLogSource = (typeof auditLogSourcesArray)[number];
308
+ declare const auditLogSearchPayloadSchema: z.ZodObject<{
309
+ where: z.ZodOptional<z.ZodPipe<z.ZodObject<{
310
+ event: z.ZodOptional<z.ZodString>;
311
+ actorEmployeeId: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
312
+ }, z.core.$strip>, z.ZodTransform<{
313
+ event: string;
314
+ actorEmployeeId?: number | null | undefined;
315
+ } | {
316
+ actorEmployeeId: number | null;
317
+ event?: string | undefined;
318
+ }, {
319
+ event?: string | undefined;
320
+ actorEmployeeId?: number | null | undefined;
321
+ }>>>;
322
+ pagination: z.ZodObject<{
323
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
324
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
325
+ }, z.core.$strip>;
326
+ }, z.core.$strict>;
327
+ declare const auditLogSelectOneQuerySchema: z.ZodObject<{
328
+ id: z.ZodInt;
329
+ source: z.ZodEnum<{
330
+ admin: "admin";
331
+ backend: "backend";
332
+ }>;
333
+ }, {
334
+ out: {};
335
+ in: {};
336
+ }>;
337
+ export type AuditLogSearchPayload = z.infer<typeof auditLogSearchPayloadSchema>;
338
+ export type AuditLogResult = AuditLog & {
339
+ source: AuditLogSource;
340
+ };
341
+ export type AuditLogSelectOneQuery = z.infer<typeof auditLogSelectOneQuerySchema>;
342
+ export type AuditLogSearchResult = {
343
+ auditLogs: AuditLogResult[];
344
+ total: number;
345
+ };
222
346
  declare const customerSchema: z.ZodObject<{
223
347
  id: z.ZodInt;
224
348
  type: z.ZodEnum<{