@murumets-ee/settings 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.mjs CHANGED
@@ -1,25 +1,2 @@
1
- function e(){return`export const toolkitSettings = pgTable('toolkit_settings', {
2
- id: uuid('id').primaryKey().defaultRandom(),
3
- namespace: varchar('namespace', { length: 100 }).notNull(),
4
- scope: varchar('scope', { length: 20 }).notNull().default('global'),
5
- scopeId: varchar('scope_id', { length: 100 }).notNull().default('__global__'),
6
- key: varchar('key', { length: 255 }).notNull(),
7
- locale: varchar('locale', { length: 10 }).notNull().default('_default'),
8
- value: jsonb('value'),
9
- updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
10
- updatedBy: uuid('updated_by'),
11
- }, (table) => ({
12
- uniqueSetting: unique().on(table.namespace, table.scope, table.scopeId, table.key, table.locale),
13
- }))
14
-
15
- export const toolkitViewState = pgTable('toolkit_view_state', {
16
- id: uuid('id').primaryKey().defaultRandom(),
17
- userId: uuid('user_id').notNull(),
18
- viewKey: varchar('view_key', { length: 255 }).notNull(),
19
- state: jsonb('state').notNull(),
20
- expiresAt: timestamp('expires_at', { withTimezone: true }),
21
- updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
22
- }, (table) => ({
23
- uniqueUserView: unique().on(table.userId, table.viewKey),
24
- }))`}function t(){return{name:`@murumets-ee/settings`,schemaCode:e(),init:async e=>{let{schemaRegistry:t}=await import(`@murumets-ee/db`),{toolkitSettings:n,toolkitViewState:r}=await import(`./schema.mjs`);t.has(`toolkit_settings`)||t.register(`toolkit_settings`,n),t.has(`toolkit_view_state`)||t.register(`toolkit_view_state`,r),e.logger.info(`Settings plugin initialized`)}}}export{t as settings};
1
+ import{toolkitSettings as e,toolkitViewState as t}from"./schema.mjs";function n(){return{name:`@murumets-ee/settings`,tables:{toolkitSettings:e,toolkitViewState:t},init:async n=>{let{schemaRegistry:r}=await import(`@murumets-ee/db`);r.has(`toolkit_settings`)||r.register(`toolkit_settings`,e),r.has(`toolkit_view_state`)||r.register(`toolkit_view_state`,t),n.logger.info(`Settings plugin initialized`)}}}export{n as settings};
25
2
  //# sourceMappingURL=plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/schema-codegen.ts","../src/plugin.ts"],"sourcesContent":["/**\n * Returns Drizzle table definition code as a string for settings plugin tables.\n * Used by the CLI generate command to inline into generated/schema.ts.\n */\nexport function generateSettingsSchemaCode(): string {\n return `export const toolkitSettings = pgTable('toolkit_settings', {\n id: uuid('id').primaryKey().defaultRandom(),\n namespace: varchar('namespace', { length: 100 }).notNull(),\n scope: varchar('scope', { length: 20 }).notNull().default('global'),\n scopeId: varchar('scope_id', { length: 100 }).notNull().default('__global__'),\n key: varchar('key', { length: 255 }).notNull(),\n locale: varchar('locale', { length: 10 }).notNull().default('_default'),\n value: jsonb('value'),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n updatedBy: uuid('updated_by'),\n}, (table) => ({\n uniqueSetting: unique().on(table.namespace, table.scope, table.scopeId, table.key, table.locale),\n}))\n\nexport const toolkitViewState = pgTable('toolkit_view_state', {\n id: uuid('id').primaryKey().defaultRandom(),\n userId: uuid('user_id').notNull(),\n viewKey: varchar('view_key', { length: 255 }).notNull(),\n state: jsonb('state').notNull(),\n expiresAt: timestamp('expires_at', { withTimezone: true }),\n updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),\n}, (table) => ({\n uniqueUserView: unique().on(table.userId, table.viewKey),\n}))`\n}\n","/**\n * Settings plugin for @murumets-ee/core.\n *\n * Registers the settings Drizzle tables with the schema registry\n * so they can be discovered for migrations and queries.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@murumets-ee/core'\n * import { settings } from '@murumets-ee/settings/plugin'\n *\n * export default defineConfig({\n * plugins: [settings()],\n * })\n * ```\n */\n\nimport type { Plugin } from '@murumets-ee/core'\nimport { generateSettingsSchemaCode } from './schema-codegen.js'\n\nexport function settings(): Plugin {\n return {\n name: '@murumets-ee/settings',\n schemaCode: generateSettingsSchemaCode(),\n init: async (app) => {\n const { schemaRegistry } = await import('@murumets-ee/db')\n const { toolkitSettings, toolkitViewState } = await import('./schema.js')\n\n if (!schemaRegistry.has('toolkit_settings')) {\n schemaRegistry.register('toolkit_settings', toolkitSettings)\n }\n if (!schemaRegistry.has('toolkit_view_state')) {\n schemaRegistry.register('toolkit_view_state', toolkitViewState)\n }\n\n app.logger.info('Settings plugin initialized')\n },\n }\n}\n"],"mappings":"AAIA,SAAgB,GAAqC,CACnD,MAAO;;;;;;;;;;;;;;;;;;;;;;;KCeT,SAAgB,GAAmB,CACjC,MAAO,CACL,KAAM,wBACN,WAAY,GAA4B,CACxC,KAAM,KAAO,IAAQ,CACnB,GAAM,CAAE,kBAAmB,MAAM,OAAO,mBAClC,CAAE,kBAAiB,oBAAqB,MAAM,OAAO,gBAEtD,EAAe,IAAI,mBAAmB,EACzC,EAAe,SAAS,mBAAoB,EAAgB,CAEzD,EAAe,IAAI,qBAAqB,EAC3C,EAAe,SAAS,qBAAsB,EAAiB,CAGjE,EAAI,OAAO,KAAK,8BAA8B,EAEjD"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["/**\n * Settings plugin for @murumets-ee/core.\n *\n * Registers the settings Drizzle tables with the schema registry\n * so they can be discovered for migrations and queries.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@murumets-ee/core'\n * import { settings } from '@murumets-ee/settings/plugin'\n *\n * export default defineConfig({\n * plugins: [settings()],\n * })\n * ```\n */\n\nimport type { Plugin } from '@murumets-ee/core'\nimport { toolkitSettings, toolkitViewState } from './schema.js'\n\nexport function settings(): Plugin {\n return {\n name: '@murumets-ee/settings',\n tables: { toolkitSettings, toolkitViewState },\n init: async (app) => {\n const { schemaRegistry } = await import('@murumets-ee/db')\n\n if (!schemaRegistry.has('toolkit_settings')) {\n schemaRegistry.register('toolkit_settings', toolkitSettings)\n }\n if (!schemaRegistry.has('toolkit_view_state')) {\n schemaRegistry.register('toolkit_view_state', toolkitViewState)\n }\n\n app.logger.info('Settings plugin initialized')\n },\n }\n}\n"],"mappings":"qEAoBA,SAAgB,GAAmB,CACjC,MAAO,CACL,KAAM,wBACN,OAAQ,CAAE,kBAAiB,mBAAkB,CAC7C,KAAM,KAAO,IAAQ,CACnB,GAAM,CAAE,kBAAmB,MAAM,OAAO,mBAEnC,EAAe,IAAI,mBAAmB,EACzC,EAAe,SAAS,mBAAoB,EAAgB,CAEzD,EAAe,IAAI,qBAAqB,EAC3C,EAAe,SAAS,qBAAsB,EAAiB,CAGjE,EAAI,OAAO,KAAK,8BAA8B,EAEjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@murumets-ee/settings",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "license": "Elastic-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -32,9 +32,9 @@
32
32
  "drizzle-orm": "^0.45.1",
33
33
  "zod": "^3.24.1",
34
34
  "server-only": "^0.0.1",
35
- "@murumets-ee/core": "0.1.6",
36
- "@murumets-ee/db": "0.1.5",
37
- "@murumets-ee/logging": "0.1.6"
35
+ "@murumets-ee/core": "0.2.0",
36
+ "@murumets-ee/db": "0.2.0",
37
+ "@murumets-ee/logging": "0.2.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.10.5",