@esb-market-contracts/backend 1.0.15 → 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 +107 -7
  2. package/package.json +1 -1
  3. package/types.d.ts +20 -1
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,95 @@ 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
+ };
293
383
  declare const auditLogsRouter: import("hono/hono-base").HonoBase<{
294
384
  Variables: VariablesWithActor;
295
385
  }, {
@@ -303,6 +393,22 @@ declare const auditLogsRouter: import("hono/hono-base").HonoBase<{
303
393
  status: 200;
304
394
  };
305
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
+ };
306
412
  } & {
307
413
  "/operations/audit-logs/search": {
308
414
  $post: {
@@ -319,13 +425,7 @@ declare const auditLogsRouter: import("hono/hono-base").HonoBase<{
319
425
  };
320
426
  };
321
427
  output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
322
- auditLogs: {
323
- id: number;
324
- event: string;
325
- actorEmployeeId: number | null;
326
- payload: import("drizzle-orm").Json;
327
- createdAt: Date;
328
- }[];
428
+ auditLogs: AuditLogResult[];
329
429
  total: number;
330
430
  }>;
331
431
  outputFormat: "json";
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.15",
4
+ "version": "1.0.16",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -300,6 +300,11 @@ declare const auditLogSchema: import("drizzle-orm/zod").BuildSchema<"select", {
300
300
  }>;
301
301
  }, undefined, undefined>;
302
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];
303
308
  declare const auditLogSearchPayloadSchema: z.ZodObject<{
304
309
  where: z.ZodOptional<z.ZodPipe<z.ZodObject<{
305
310
  event: z.ZodOptional<z.ZodString>;
@@ -319,9 +324,23 @@ declare const auditLogSearchPayloadSchema: z.ZodObject<{
319
324
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
320
325
  }, z.core.$strip>;
321
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
+ }>;
322
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>;
323
342
  export type AuditLogSearchResult = {
324
- auditLogs: AuditLog[];
343
+ auditLogs: AuditLogResult[];
325
344
  total: number;
326
345
  };
327
346
  declare const customerSchema: z.ZodObject<{