@murumets-ee/logging 0.1.0 → 0.1.2

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/admin.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)u(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of I(e))!R.call(t,o)&&o!==r&&u(t,o,{get:()=>e[o],enumerable:!(i=y(e,o))||i.enumerable});return t};var T=t=>x(u({},"__esModule",{value:!0}),t);var D={};w(D,{logRoutes:()=>m});module.exports=T(D);var n=require("zod"),c=/^[a-zA-Z0-9_-]{1,255}$/,A=n.z.object({action:n.z.string().max(100).optional(),entityType:n.z.string().max(100).optional(),entityId:n.z.string().regex(c,"Invalid ID format").optional(),userId:n.z.string().regex(c,"Invalid user ID format").optional(),dateFrom:n.z.string().datetime({offset:!0,message:"Invalid ISO date"}).optional(),dateTo:n.z.string().datetime({offset:!0,message:"Invalid ISO date"}).optional(),search:n.z.string().max(200).optional(),limit:n.z.coerce.number().min(1).max(100).default(50),offset:n.z.coerce.number().min(0).default(0),sortField:n.z.enum(["createdAt","action","entityType"]).default("createdAt"),sortDirection:n.z.enum(["asc","desc"]).default("desc")});function d(t,e=200){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json"}})}function l(t,e){return d({error:t},e)}function m(t){return{prefix:"logs",resource:"audit-logs",actions:["view"],handlers:{GET:async(e,{segments:r})=>{let i=t();if(r.length===1&&r[0]==="filters"){let[a,p]=await Promise.all([i.getDistinctEntityTypes(),i.getDistinctActions()]);return d({entityTypes:a,actions:p})}if(r.length===1&&r[0]!=="filters"){let a=await i.findById(r[0]);return a?d(a):l("Audit log entry not found",404)}let o=new URL(e.url),g=Object.fromEntries(o.searchParams),s=A.safeParse(g);if(!s.success)return l(`Invalid query params: ${s.error.issues.map(a=>a.message).join(", ")}`,400);let f=await i.query({...s.data,dateFrom:s.data.dateFrom?new Date(s.data.dateFrom):void 0,dateTo:s.data.dateTo?new Date(s.data.dateTo):void 0});return d(f)}}}}0&&(module.exports={logRoutes});
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Audit log admin routes for the centralized admin API handler.
3
+ *
4
+ * Read-only: only GET handlers. Audit logs are immutable.
5
+ * Admin-only: explicit role check before any data access.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { createAdminApiHandler } from '@murumets-ee/admin-ui/server'
10
+ * import { logRoutes } from '@murumets-ee/logging/admin'
11
+ * import { AuditLogClient } from '@murumets-ee/logging'
12
+ *
13
+ * const handler = createAdminApiHandler({
14
+ * authenticate: async (req) => { ... },
15
+ * entities: [...],
16
+ * routes: [logRoutes(() => new AuditLogClient(db))],
17
+ * })
18
+ * ```
19
+ */
20
+ interface AdminRoute {
21
+ prefix: string;
22
+ resource?: string;
23
+ actions?: readonly string[];
24
+ handlers: Partial<Record<string, (req: Request, ctx: {
25
+ segments: string[];
26
+ user: {
27
+ id: string;
28
+ role?: string;
29
+ };
30
+ checkPermission: (resource: string, action: string) => boolean;
31
+ }) => Promise<Response>>>;
32
+ }
33
+ interface AuditLogClientLike {
34
+ query(options: Record<string, unknown>): Promise<{
35
+ items: unknown[];
36
+ total: number;
37
+ }>;
38
+ findById(id: string): Promise<unknown | null>;
39
+ getDistinctEntityTypes(): Promise<string[]>;
40
+ getDistinctActions(): Promise<string[]>;
41
+ }
42
+ declare function logRoutes(getClient: () => AuditLogClientLike): AdminRoute;
43
+
44
+ export { logRoutes };
@@ -0,0 +1,17 @@
1
+ function t(){return`export const toolkitAuditLogs = pgTable('toolkit_audit_logs', {
2
+ id: uuid('id').primaryKey().defaultRandom(),
3
+ action: varchar('action', { length: 100 }).notNull(),
4
+ entityType: varchar('entity_type', { length: 100 }),
5
+ entityId: varchar('entity_id', { length: 255 }),
6
+ userId: varchar('user_id', { length: 255 }),
7
+ userName: varchar('user_name', { length: 255 }),
8
+ changes: jsonb('changes'),
9
+ metadata: jsonb('metadata'),
10
+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
11
+ }, (table) => ({
12
+ entityTypeCreatedAtIdx: index('audit_entity_type_created_at_idx').on(table.entityType, table.createdAt),
13
+ userIdCreatedAtIdx: index('audit_user_id_created_at_idx').on(table.userId, table.createdAt),
14
+ actionCreatedAtIdx: index('audit_action_created_at_idx').on(table.action, table.createdAt),
15
+ createdAtIdx: index('audit_created_at_idx').on(table.createdAt),
16
+ entityIdIdx: index('audit_entity_id_idx').on(table.entityId),
17
+ }))`}export{t as a};
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var T=Object.create;var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var r in t)u(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of _(t))!C.call(e,a)&&a!==r&&u(e,a,{get:()=>t[a],enumerable:!(s=w(t,a))||s.enumerable});return e};var R=(e,t,r)=>(r=e!=null?T(b(e)):{},l(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)),v=e=>l(u({},"__esModule",{value:!0}),e);var N={};E(N,{AuditLogClient:()=>d,bindRequestContext:()=>p,createAuditDbWriter:()=>y,createAuditLogger:()=>m,createChildLogger:()=>A,createLogger:()=>L,toolkitAuditLogs:()=>n});module.exports=v(N);var i=require("drizzle-orm");var o=require("drizzle-orm/pg-core"),n=(0,o.pgTable)("toolkit_audit_logs",{id:(0,o.uuid)("id").primaryKey().defaultRandom(),action:(0,o.varchar)("action",{length:100}).notNull(),entityType:(0,o.varchar)("entity_type",{length:100}),entityId:(0,o.varchar)("entity_id",{length:255}),userId:(0,o.varchar)("user_id",{length:255}),userName:(0,o.varchar)("user_name",{length:255}),changes:(0,o.jsonb)("changes").$type(),metadata:(0,o.jsonb)("metadata").$type(),createdAt:(0,o.timestamp)("created_at",{withTimezone:!0}).notNull().defaultNow()},e=>({entityTypeCreatedAtIdx:(0,o.index)("audit_entity_type_created_at_idx").on(e.entityType,e.createdAt),userIdCreatedAtIdx:(0,o.index)("audit_user_id_created_at_idx").on(e.userId,e.createdAt),actionCreatedAtIdx:(0,o.index)("audit_action_created_at_idx").on(e.action,e.createdAt),createdAtIdx:(0,o.index)("audit_created_at_idx").on(e.createdAt),entityIdIdx:(0,o.index)("audit_entity_id_idx").on(e.entityId)}));var D=100,k=50,d=class{constructor(t){this.db=t}async write(t){await this.db.insert(n).values({action:t.action,entityType:t.entityType,entityId:t.entityId,userId:t.userId,userName:t.userName,changes:t.changes,metadata:t.metadata})}async query(t={}){let r=Math.min(Math.max(t.limit??k,1),D),s=Math.max(t.offset??0,0),a=this.buildConditions(t),g=a.length>0?(0,i.and)(...a):void 0,h=this.buildOrderBy(t.sortField,t.sortDirection),[I,x]=await Promise.all([this.db.select().from(n).where(g).orderBy(h).limit(r).offset(s),this.db.select({count:(0,i.count)()}).from(n).where(g)]);return{items:I,total:x[0]?.count??0}}async findById(t){return(await this.db.select().from(n).where((0,i.eq)(n.id,t)).limit(1))[0]??null}async getDistinctEntityTypes(){return(await this.db.selectDistinct({entityType:n.entityType}).from(n).where((0,i.isNotNull)(n.entityType)).orderBy((0,i.asc)(n.entityType))).map(r=>r.entityType).filter(Boolean)}async getDistinctActions(){return(await this.db.selectDistinct({action:n.action}).from(n).orderBy((0,i.asc)(n.action))).map(r=>r.action)}buildConditions(t){let r=[];if(t.action&&r.push((0,i.eq)(n.action,t.action)),t.entityType&&r.push((0,i.eq)(n.entityType,t.entityType)),t.entityId&&r.push((0,i.eq)(n.entityId,t.entityId)),t.userId&&r.push((0,i.eq)(n.userId,t.userId)),t.dateFrom&&r.push((0,i.gte)(n.createdAt,t.dateFrom)),t.dateTo&&r.push((0,i.lte)(n.createdAt,t.dateTo)),t.search){let s=`%${t.search}%`;r.push((0,i.or)((0,i.ilike)(n.action,s),(0,i.ilike)(n.entityType,s),(0,i.ilike)(n.userName,s)))}return r}buildOrderBy(t,r){let s=r==="asc"?i.asc:i.desc;switch(t){case"action":return s(n.action);case"entityType":return s(n.entityType);default:return s(n.createdAt)}}};function y(e){let t=new d(e);return r=>t.write({action:r.action,entityType:r.entityType??null,entityId:r.entityId??null,userId:r.userId??null,userName:r.userName??null,changes:r.changes??null,metadata:r.metadata??null})}function m(e){return{log:async t=>{e.logger.info({audit:!0,action:t.action,entityType:t.entityType,entityId:t.entityId,userId:t.userId,userName:t.userName,changes:t.changes,metadata:t.metadata},`Audit: ${t.action}`),e.dbWriter&&e.dbWriter(t).catch(r=>{e.logger.error({err:r,auditEntry:t},"Failed to write audit log to database")})}}}function p(e,t){return e.child(t)}var c=R(require("pino"),1),f=(0,c.default)({level:process.env.LOG_LEVEL||"info",formatters:{level:e=>({level:e})},timestamp:!1,serializers:{err:c.default.stdSerializers.err,error:c.default.stdSerializers.err},redact:{paths:["password","token","secret","apiKey","accessToken","refreshToken"],censor:"[REDACTED]"}});function L(e){if(!e)return f;let t={};e.name&&(t.name=e.name);let r={};return e.level&&(r.level=e.level),f.child(t,r)}function A(e,t){return e.child(t)}0&&(module.exports={AuditLogClient,bindRequestContext,createAuditDbWriter,createAuditLogger,createChildLogger,createLogger,toolkitAuditLogs});
@@ -0,0 +1,121 @@
1
+ import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
2
+ import { Logger as Logger$1 } from 'pino';
3
+ export { toolkitAuditLogs } from './schema.cjs';
4
+ import 'drizzle-orm/pg-core';
5
+
6
+ type Logger = Logger$1;
7
+ interface LoggerConfig {
8
+ name?: string;
9
+ level?: string;
10
+ redact?: string[];
11
+ }
12
+ /**
13
+ * Create a logger instance
14
+ * If no config provided, returns the root logger
15
+ * If config provided, returns a child logger with the specified context
16
+ */
17
+ declare function createLogger(config?: LoggerConfig): Logger;
18
+ /**
19
+ * Create a child logger from an existing logger with additional context
20
+ */
21
+ declare function createChildLogger(parent: Logger, context: Record<string, unknown>): Logger;
22
+
23
+ interface AuditEntry {
24
+ action: string;
25
+ entityType?: string;
26
+ entityId?: string;
27
+ userId?: string;
28
+ userName?: string;
29
+ changes?: Record<string, unknown>;
30
+ metadata?: Record<string, unknown>;
31
+ }
32
+ interface AuditConfig {
33
+ logger: Logger;
34
+ dbWriter?: (entry: AuditEntry) => Promise<void>;
35
+ }
36
+ interface AuditLogger {
37
+ log: (entry: AuditEntry) => Promise<void>;
38
+ }
39
+ /**
40
+ * Create a dbWriter callback wired to AuditLogClient.
41
+ *
42
+ * Pass the returned function as `dbWriter` to `createAuditLogger`:
43
+ * ```typescript
44
+ * const auditLogger = createAuditLogger({
45
+ * logger,
46
+ * dbWriter: createAuditDbWriter(db),
47
+ * })
48
+ * ```
49
+ */
50
+ declare function createAuditDbWriter(db: PostgresJsDatabase): (entry: AuditEntry) => Promise<void>;
51
+ /**
52
+ * Create an audit logger
53
+ *
54
+ * Audit logs are written to stdout immediately (non-blocking).
55
+ * Optionally, they can also be written to the database if dbWriter is provided.
56
+ *
57
+ * Database writes are fire-and-forget to avoid blocking the main operation.
58
+ * If DB write fails, it's logged to stderr but doesn't throw.
59
+ */
60
+ declare function createAuditLogger(config: AuditConfig): AuditLogger;
61
+
62
+ interface AuditLogQueryOptions {
63
+ action?: string;
64
+ entityType?: string;
65
+ entityId?: string;
66
+ userId?: string;
67
+ dateFrom?: Date;
68
+ dateTo?: Date;
69
+ /** Free-text search across action, entityType, userName */
70
+ search?: string;
71
+ /** Default 50, max 100 */
72
+ limit?: number;
73
+ offset?: number;
74
+ sortField?: 'createdAt' | 'action' | 'entityType';
75
+ sortDirection?: 'asc' | 'desc';
76
+ }
77
+ interface AuditLogEntry {
78
+ id: string;
79
+ action: string;
80
+ entityType: string | null;
81
+ entityId: string | null;
82
+ userId: string | null;
83
+ userName: string | null;
84
+ changes: Record<string, unknown> | null;
85
+ metadata: Record<string, unknown> | null;
86
+ createdAt: Date;
87
+ }
88
+ interface AuditLogListResult {
89
+ items: AuditLogEntry[];
90
+ total: number;
91
+ }
92
+ declare class AuditLogClient {
93
+ private db;
94
+ constructor(db: PostgresJsDatabase);
95
+ /** Write a single audit log entry */
96
+ write(entry: Omit<AuditLogEntry, 'id' | 'createdAt'>): Promise<void>;
97
+ /** Query audit logs with filters and pagination */
98
+ query(options?: AuditLogQueryOptions): Promise<AuditLogListResult>;
99
+ /** Get a single audit log entry by ID */
100
+ findById(id: string): Promise<AuditLogEntry | null>;
101
+ /** Get distinct entity types present in the audit log */
102
+ getDistinctEntityTypes(): Promise<string[]>;
103
+ /** Get distinct actions present in the audit log */
104
+ getDistinctActions(): Promise<string[]>;
105
+ private buildConditions;
106
+ private buildOrderBy;
107
+ }
108
+
109
+ interface RequestContext {
110
+ requestId?: string;
111
+ userId?: string;
112
+ teamId?: string;
113
+ locale?: string;
114
+ }
115
+ /**
116
+ * Bind request context to a logger
117
+ * Returns a child logger with the context automatically included in all log entries
118
+ */
119
+ declare function bindRequestContext(logger: Logger, context: RequestContext): Logger;
120
+
121
+ export { type AuditConfig, type AuditEntry, AuditLogClient, type AuditLogEntry, type AuditLogListResult, type AuditLogQueryOptions, type AuditLogger, type Logger, type LoggerConfig, type RequestContext, bindRequestContext, createAuditDbWriter, createAuditLogger, createChildLogger, createLogger };
@@ -0,0 +1,17 @@
1
+ "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var d in e)i(t,d,{get:e[d],enumerable:!0})},g=(t,e,d,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of u(e))!c.call(t,a)&&a!==d&&i(t,a,{get:()=>e[a],enumerable:!(n=o(e,a))||n.enumerable});return t};var _=t=>g(i({},"__esModule",{value:!0}),t);var s={};l(s,{logging:()=>m});module.exports=_(s);function r(){return`export const toolkitAuditLogs = pgTable('toolkit_audit_logs', {
2
+ id: uuid('id').primaryKey().defaultRandom(),
3
+ action: varchar('action', { length: 100 }).notNull(),
4
+ entityType: varchar('entity_type', { length: 100 }),
5
+ entityId: varchar('entity_id', { length: 255 }),
6
+ userId: varchar('user_id', { length: 255 }),
7
+ userName: varchar('user_name', { length: 255 }),
8
+ changes: jsonb('changes'),
9
+ metadata: jsonb('metadata'),
10
+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
11
+ }, (table) => ({
12
+ entityTypeCreatedAtIdx: index('audit_entity_type_created_at_idx').on(table.entityType, table.createdAt),
13
+ userIdCreatedAtIdx: index('audit_user_id_created_at_idx').on(table.userId, table.createdAt),
14
+ actionCreatedAtIdx: index('audit_action_created_at_idx').on(table.action, table.createdAt),
15
+ createdAtIdx: index('audit_created_at_idx').on(table.createdAt),
16
+ entityIdIdx: index('audit_entity_id_idx').on(table.entityId),
17
+ }))`}function m(){return{name:"@murumets-ee/logging",schemaCode:r()}}0&&(module.exports={logging});
@@ -0,0 +1,17 @@
1
+ import { Plugin } from '@murumets-ee/core';
2
+
3
+ /**
4
+ * Logging plugin — registers the audit log table schema for migration generation.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { logging } from '@murumets-ee/logging/plugin'
9
+ *
10
+ * export default defineConfig({
11
+ * plugins: [logging()],
12
+ * })
13
+ * ```
14
+ */
15
+ declare function logging(): Plugin;
16
+
17
+ export { logging };
@@ -0,0 +1,17 @@
1
+ import { Plugin } from '@murumets-ee/core';
2
+
3
+ /**
4
+ * Logging plugin — registers the audit log table schema for migration generation.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { logging } from '@murumets-ee/logging/plugin'
9
+ *
10
+ * export default defineConfig({
11
+ * plugins: [logging()],
12
+ * })
13
+ * ```
14
+ */
15
+ declare function logging(): Plugin;
16
+
17
+ export { logging };
package/dist/plugin.js ADDED
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-3M2SQ6QE.js";function o(){return{name:"@murumets-ee/logging",schemaCode:e()}}export{o as logging};
@@ -0,0 +1,17 @@
1
+ "use strict";var i=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var d in t)i(e,d,{get:t[d],enumerable:!0})},l=(e,t,d,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of o(t))!_.call(e,a)&&a!==d&&i(e,a,{get:()=>t[a],enumerable:!(n=r(t,a))||n.enumerable});return e};var u=e=>l(i({},"__esModule",{value:!0}),e);var y={};c(y,{generateLoggingSchemaCode:()=>x});module.exports=u(y);function x(){return`export const toolkitAuditLogs = pgTable('toolkit_audit_logs', {
2
+ id: uuid('id').primaryKey().defaultRandom(),
3
+ action: varchar('action', { length: 100 }).notNull(),
4
+ entityType: varchar('entity_type', { length: 100 }),
5
+ entityId: varchar('entity_id', { length: 255 }),
6
+ userId: varchar('user_id', { length: 255 }),
7
+ userName: varchar('user_name', { length: 255 }),
8
+ changes: jsonb('changes'),
9
+ metadata: jsonb('metadata'),
10
+ createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
11
+ }, (table) => ({
12
+ entityTypeCreatedAtIdx: index('audit_entity_type_created_at_idx').on(table.entityType, table.createdAt),
13
+ userIdCreatedAtIdx: index('audit_user_id_created_at_idx').on(table.userId, table.createdAt),
14
+ actionCreatedAtIdx: index('audit_action_created_at_idx').on(table.action, table.createdAt),
15
+ createdAtIdx: index('audit_created_at_idx').on(table.createdAt),
16
+ entityIdIdx: index('audit_entity_id_idx').on(table.entityId),
17
+ }))`}0&&(module.exports={generateLoggingSchemaCode});
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns Drizzle table definition code as a string for logging plugin tables.
3
+ * Used by the CLI generate command to inline into generated/schema.ts.
4
+ */
5
+ declare function generateLoggingSchemaCode(): string;
6
+
7
+ export { generateLoggingSchemaCode };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns Drizzle table definition code as a string for logging plugin tables.
3
+ * Used by the CLI generate command to inline into generated/schema.ts.
4
+ */
5
+ declare function generateLoggingSchemaCode(): string;
6
+
7
+ export { generateLoggingSchemaCode };
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-3M2SQ6QE.js";export{a as generateLoggingSchemaCode};
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(e,d)=>{for(var n in d)a(e,n,{get:d[n],enumerable:!0})},y=(e,d,n,r)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of _(d))!u.call(e,i)&&i!==n&&a(e,i,{get:()=>d[i],enumerable:!(r=o(d,i))||r.enumerable});return e};var s=e=>y(a({},"__esModule",{value:!0}),e);var p={};c(p,{toolkitAuditLogs:()=>g});module.exports=s(p);var t=require("drizzle-orm/pg-core"),g=(0,t.pgTable)("toolkit_audit_logs",{id:(0,t.uuid)("id").primaryKey().defaultRandom(),action:(0,t.varchar)("action",{length:100}).notNull(),entityType:(0,t.varchar)("entity_type",{length:100}),entityId:(0,t.varchar)("entity_id",{length:255}),userId:(0,t.varchar)("user_id",{length:255}),userName:(0,t.varchar)("user_name",{length:255}),changes:(0,t.jsonb)("changes").$type(),metadata:(0,t.jsonb)("metadata").$type(),createdAt:(0,t.timestamp)("created_at",{withTimezone:!0}).notNull().defaultNow()},e=>({entityTypeCreatedAtIdx:(0,t.index)("audit_entity_type_created_at_idx").on(e.entityType,e.createdAt),userIdCreatedAtIdx:(0,t.index)("audit_user_id_created_at_idx").on(e.userId,e.createdAt),actionCreatedAtIdx:(0,t.index)("audit_action_created_at_idx").on(e.action,e.createdAt),createdAtIdx:(0,t.index)("audit_created_at_idx").on(e.createdAt),entityIdIdx:(0,t.index)("audit_entity_id_idx").on(e.entityId)}));0&&(module.exports={toolkitAuditLogs});
@@ -0,0 +1,178 @@
1
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
2
+
3
+ declare const toolkitAuditLogs: drizzle_orm_pg_core.PgTableWithColumns<{
4
+ name: "toolkit_audit_logs";
5
+ schema: undefined;
6
+ columns: {
7
+ id: drizzle_orm_pg_core.PgColumn<{
8
+ name: "id";
9
+ tableName: "toolkit_audit_logs";
10
+ dataType: "string";
11
+ columnType: "PgUUID";
12
+ data: string;
13
+ driverParam: string;
14
+ notNull: true;
15
+ hasDefault: true;
16
+ isPrimaryKey: true;
17
+ isAutoincrement: false;
18
+ hasRuntimeDefault: false;
19
+ enumValues: undefined;
20
+ baseColumn: never;
21
+ identity: undefined;
22
+ generated: undefined;
23
+ }, {}, {}>;
24
+ action: drizzle_orm_pg_core.PgColumn<{
25
+ name: "action";
26
+ tableName: "toolkit_audit_logs";
27
+ dataType: "string";
28
+ columnType: "PgVarchar";
29
+ data: string;
30
+ driverParam: string;
31
+ notNull: true;
32
+ hasDefault: false;
33
+ isPrimaryKey: false;
34
+ isAutoincrement: false;
35
+ hasRuntimeDefault: false;
36
+ enumValues: [string, ...string[]];
37
+ baseColumn: never;
38
+ identity: undefined;
39
+ generated: undefined;
40
+ }, {}, {
41
+ length: 100;
42
+ }>;
43
+ entityType: drizzle_orm_pg_core.PgColumn<{
44
+ name: "entity_type";
45
+ tableName: "toolkit_audit_logs";
46
+ dataType: "string";
47
+ columnType: "PgVarchar";
48
+ data: string;
49
+ driverParam: string;
50
+ notNull: false;
51
+ hasDefault: false;
52
+ isPrimaryKey: false;
53
+ isAutoincrement: false;
54
+ hasRuntimeDefault: false;
55
+ enumValues: [string, ...string[]];
56
+ baseColumn: never;
57
+ identity: undefined;
58
+ generated: undefined;
59
+ }, {}, {
60
+ length: 100;
61
+ }>;
62
+ entityId: drizzle_orm_pg_core.PgColumn<{
63
+ name: "entity_id";
64
+ tableName: "toolkit_audit_logs";
65
+ dataType: "string";
66
+ columnType: "PgVarchar";
67
+ data: string;
68
+ driverParam: string;
69
+ notNull: false;
70
+ hasDefault: false;
71
+ isPrimaryKey: false;
72
+ isAutoincrement: false;
73
+ hasRuntimeDefault: false;
74
+ enumValues: [string, ...string[]];
75
+ baseColumn: never;
76
+ identity: undefined;
77
+ generated: undefined;
78
+ }, {}, {
79
+ length: 255;
80
+ }>;
81
+ userId: drizzle_orm_pg_core.PgColumn<{
82
+ name: "user_id";
83
+ tableName: "toolkit_audit_logs";
84
+ dataType: "string";
85
+ columnType: "PgVarchar";
86
+ data: string;
87
+ driverParam: string;
88
+ notNull: false;
89
+ hasDefault: false;
90
+ isPrimaryKey: false;
91
+ isAutoincrement: false;
92
+ hasRuntimeDefault: false;
93
+ enumValues: [string, ...string[]];
94
+ baseColumn: never;
95
+ identity: undefined;
96
+ generated: undefined;
97
+ }, {}, {
98
+ length: 255;
99
+ }>;
100
+ userName: drizzle_orm_pg_core.PgColumn<{
101
+ name: "user_name";
102
+ tableName: "toolkit_audit_logs";
103
+ dataType: "string";
104
+ columnType: "PgVarchar";
105
+ data: string;
106
+ driverParam: string;
107
+ notNull: false;
108
+ hasDefault: false;
109
+ isPrimaryKey: false;
110
+ isAutoincrement: false;
111
+ hasRuntimeDefault: false;
112
+ enumValues: [string, ...string[]];
113
+ baseColumn: never;
114
+ identity: undefined;
115
+ generated: undefined;
116
+ }, {}, {
117
+ length: 255;
118
+ }>;
119
+ changes: drizzle_orm_pg_core.PgColumn<{
120
+ name: "changes";
121
+ tableName: "toolkit_audit_logs";
122
+ dataType: "json";
123
+ columnType: "PgJsonb";
124
+ data: Record<string, unknown>;
125
+ driverParam: unknown;
126
+ notNull: false;
127
+ hasDefault: false;
128
+ isPrimaryKey: false;
129
+ isAutoincrement: false;
130
+ hasRuntimeDefault: false;
131
+ enumValues: undefined;
132
+ baseColumn: never;
133
+ identity: undefined;
134
+ generated: undefined;
135
+ }, {}, {
136
+ $type: Record<string, unknown>;
137
+ }>;
138
+ metadata: drizzle_orm_pg_core.PgColumn<{
139
+ name: "metadata";
140
+ tableName: "toolkit_audit_logs";
141
+ dataType: "json";
142
+ columnType: "PgJsonb";
143
+ data: Record<string, unknown>;
144
+ driverParam: unknown;
145
+ notNull: false;
146
+ hasDefault: false;
147
+ isPrimaryKey: false;
148
+ isAutoincrement: false;
149
+ hasRuntimeDefault: false;
150
+ enumValues: undefined;
151
+ baseColumn: never;
152
+ identity: undefined;
153
+ generated: undefined;
154
+ }, {}, {
155
+ $type: Record<string, unknown>;
156
+ }>;
157
+ createdAt: drizzle_orm_pg_core.PgColumn<{
158
+ name: "created_at";
159
+ tableName: "toolkit_audit_logs";
160
+ dataType: "date";
161
+ columnType: "PgTimestamp";
162
+ data: Date;
163
+ driverParam: string;
164
+ notNull: true;
165
+ hasDefault: true;
166
+ isPrimaryKey: false;
167
+ isAutoincrement: false;
168
+ hasRuntimeDefault: false;
169
+ enumValues: undefined;
170
+ baseColumn: never;
171
+ identity: undefined;
172
+ generated: undefined;
173
+ }, {}, {}>;
174
+ };
175
+ dialect: "pg";
176
+ }>;
177
+
178
+ export { toolkitAuditLogs };
package/package.json CHANGED
@@ -1,20 +1,28 @@
1
1
  {
2
2
  "name": "@murumets-ee/logging",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js"
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.cjs"
10
11
  },
11
12
  "./schema": {
12
13
  "types": "./dist/schema.d.ts",
13
- "import": "./dist/schema.js"
14
+ "import": "./dist/schema.js",
15
+ "require": "./dist/schema.cjs"
14
16
  },
15
17
  "./admin": {
16
18
  "types": "./dist/admin.d.ts",
17
- "import": "./dist/admin.js"
19
+ "import": "./dist/admin.js",
20
+ "require": "./dist/admin.cjs"
21
+ },
22
+ "./plugin": {
23
+ "types": "./dist/plugin.d.ts",
24
+ "import": "./dist/plugin.js",
25
+ "require": "./dist/plugin.cjs"
18
26
  }
19
27
  },
20
28
  "files": [
@@ -30,6 +38,9 @@
30
38
  "typescript": "^5.7.2",
31
39
  "vitest": "^2.1.8"
32
40
  },
41
+ "peerDependencies": {
42
+ "@murumets-ee/core": "^0.1.0"
43
+ },
33
44
  "scripts": {
34
45
  "build": "tsup",
35
46
  "dev": "tsup --watch",