@murumets-ee/logging 0.1.6 → 0.2.0

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/plugin.d.mts CHANGED
@@ -1,6 +1,14 @@
1
+ import { PgTable } from "drizzle-orm/pg-core";
2
+
1
3
  //#region src/plugin.d.ts
4
+ interface LoggingPlugin {
5
+ name: string;
6
+ tables: Record<string, PgTable<any>>;
7
+ }
2
8
  /**
3
- * Logging plugin — registers the audit log table schema for migration generation.
9
+ * Logging plugin — registers the `toolkit_audit_logs` table so it shows up
10
+ * in generated migrations. Zero runtime behavior; the audit logger is wired
11
+ * up separately via `createAuditLogger()`.
4
12
  *
5
13
  * @example
6
14
  * ```typescript
@@ -11,10 +19,7 @@
11
19
  * })
12
20
  * ```
13
21
  */
14
- declare function logging(): {
15
- name: string;
16
- schemaCode: string;
17
- };
22
+ declare function logging(): LoggingPlugin;
18
23
  //#endregion
19
24
  export { logging };
20
25
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;AAcA;;;;;;;;;;;iBAAgB,OAAA,CAAA;EAAa,IAAA;EAAc,UAAA;AAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;UAMU,aAAA;EACR,IAAA;EAEA,MAAA,EAAQ,MAAA,SAAe,OAAA;AAAA;;;;;;;;;AAiBzB;;;;;;iBAAgB,OAAA,CAAA,GAAW,aAAA"}
package/dist/plugin.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{generateLoggingSchemaCode as e}from"./schema-codegen.mjs";function t(){return{name:`@murumets-ee/logging`,schemaCode:e()}}export{t as logging};
1
+ import{toolkitAuditLogs as e}from"./schema.mjs";function t(){return{name:`@murumets-ee/logging`,tables:{toolkitAuditLogs:e}}}export{t as logging};
2
2
  //# sourceMappingURL=plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import { generateLoggingSchemaCode } from './schema-codegen.js'\n\n/**\n * Logging plugin — registers the audit log table schema for migration generation.\n *\n * @example\n * ```typescript\n * import { logging } from '@murumets-ee/logging/plugin'\n *\n * export default defineConfig({\n * plugins: [logging()],\n * })\n * ```\n */\nexport function logging(): { name: string; schemaCode: string } {\n return {\n name: '@murumets-ee/logging',\n schemaCode: generateLoggingSchemaCode(),\n }\n}\n"],"mappings":"iEAcA,SAAgB,GAAgD,CAC9D,MAAO,CACL,KAAM,uBACN,WAAY,GAA2B,CACxC"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["// biome-ignore lint/suspicious/noExplicitAny: structural PgTable\nimport type { PgTable } from 'drizzle-orm/pg-core'\nimport { toolkitAuditLogs } from './schema.js'\n\n// Structural Plugin shape — kept in sync with @murumets-ee/core. Not imported\n// from core because core depends on logging (circular dep would fail).\ninterface LoggingPlugin {\n name: string\n // biome-ignore lint/suspicious/noExplicitAny: as above\n tables: Record<string, PgTable<any>>\n}\n\n/**\n * Logging plugin — registers the `toolkit_audit_logs` table so it shows up\n * in generated migrations. Zero runtime behavior; the audit logger is wired\n * up separately via `createAuditLogger()`.\n *\n * @example\n * ```typescript\n * import { logging } from '@murumets-ee/logging/plugin'\n *\n * export default defineConfig({\n * plugins: [logging()],\n * })\n * ```\n */\nexport function logging(): LoggingPlugin {\n return {\n name: '@murumets-ee/logging',\n tables: { toolkitAuditLogs },\n }\n}\n"],"mappings":"gDA0BA,SAAgB,GAAyB,CACvC,MAAO,CACL,KAAM,uBACN,OAAQ,CAAE,mBAAkB,CAC7B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@murumets-ee/logging",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,9 +0,0 @@
1
- //#region src/schema-codegen.d.ts
2
- /**
3
- * Returns Drizzle table definition code as a string for logging plugin tables.
4
- * Used by the CLI generate command to inline into generated/schema.ts.
5
- */
6
- declare function generateLoggingSchemaCode(): string;
7
- //#endregion
8
- export { generateLoggingSchemaCode };
9
- //# sourceMappingURL=schema-codegen.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-codegen.d.mts","names":[],"sources":["../src/schema-codegen.ts"],"mappings":";;AAIA;;;iBAAgB,yBAAA,CAAA"}
@@ -1,18 +0,0 @@
1
- function e(){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{e as generateLoggingSchemaCode};
18
- //# sourceMappingURL=schema-codegen.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-codegen.mjs","names":[],"sources":["../src/schema-codegen.ts"],"sourcesContent":["/**\n * Returns Drizzle table definition code as a string for logging plugin tables.\n * Used by the CLI generate command to inline into generated/schema.ts.\n */\nexport function generateLoggingSchemaCode(): string {\n return `export const toolkitAuditLogs = pgTable('toolkit_audit_logs', {\n id: uuid('id').primaryKey().defaultRandom(),\n action: varchar('action', { length: 100 }).notNull(),\n entityType: varchar('entity_type', { length: 100 }),\n entityId: varchar('entity_id', { length: 255 }),\n userId: varchar('user_id', { length: 255 }),\n userName: varchar('user_name', { length: 255 }),\n changes: jsonb('changes'),\n metadata: jsonb('metadata'),\n createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),\n}, (table) => ({\n entityTypeCreatedAtIdx: index('audit_entity_type_created_at_idx').on(table.entityType, table.createdAt),\n userIdCreatedAtIdx: index('audit_user_id_created_at_idx').on(table.userId, table.createdAt),\n actionCreatedAtIdx: index('audit_action_created_at_idx').on(table.action, table.createdAt),\n createdAtIdx: index('audit_created_at_idx').on(table.createdAt),\n entityIdIdx: index('audit_entity_id_idx').on(table.entityId),\n}))`\n}\n"],"mappings":"AAIA,SAAgB,GAAoC,CAClD,MAAO"}