@acmekit/settings 2.13.1

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 (35) hide show
  1. package/README.md +17 -0
  2. package/dist/index.d.ts +6 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +9 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/migrations/Migration20250717162007.d.ts +5 -0
  7. package/dist/migrations/Migration20250717162007.d.ts.map +1 -0
  8. package/dist/migrations/Migration20250717162007.js +20 -0
  9. package/dist/migrations/Migration20250717162007.js.map +1 -0
  10. package/dist/models/index.d.ts +3 -0
  11. package/dist/models/index.d.ts.map +1 -0
  12. package/dist/models/index.js +8 -0
  13. package/dist/models/index.js.map +1 -0
  14. package/dist/models/user-preference.d.ts +7 -0
  15. package/dist/models/user-preference.d.ts.map +1 -0
  16. package/dist/models/user-preference.js +21 -0
  17. package/dist/models/user-preference.js.map +1 -0
  18. package/dist/models/view-configuration.d.ts +9 -0
  19. package/dist/models/view-configuration.d.ts.map +1 -0
  20. package/dist/models/view-configuration.js +25 -0
  21. package/dist/models/view-configuration.js.map +1 -0
  22. package/dist/services/index.d.ts +2 -0
  23. package/dist/services/index.d.ts.map +1 -0
  24. package/dist/services/index.js +9 -0
  25. package/dist/services/index.js.map +1 -0
  26. package/dist/services/settings-module-service.d.ts +33 -0
  27. package/dist/services/settings-module-service.d.ts.map +1 -0
  28. package/dist/services/settings-module-service.js +241 -0
  29. package/dist/services/settings-module-service.js.map +1 -0
  30. package/dist/tsconfig.tsbuildinfo +1 -0
  31. package/dist/types/index.d.ts +5 -0
  32. package/dist/types/index.d.ts.map +1 -0
  33. package/dist/types/index.js +3 -0
  34. package/dist/types/index.js.map +1 -0
  35. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Settings Module
2
+
3
+ The settings module provides functionality for managing user preferences and configurations in AcmeKit.
4
+
5
+ ## Features
6
+
7
+ - **View Configurations**: Save and manage table view configurations (column visibility, order, widths)
8
+ - **User Preferences**: Store arbitrary user preferences in a key-value format
9
+ - **System Defaults**: Admin users can set default configurations for all users
10
+
11
+ ## Module Options
12
+
13
+ ```js
14
+ const settingsModuleOptions = {
15
+ // Module options can be added here if needed
16
+ }
17
+ ```
@@ -0,0 +1,6 @@
1
+ import { SettingsModuleService } from "./services";
2
+ declare const _default: import("@acmekit/types").ModuleExports<typeof SettingsModuleService> & {
3
+ linkable: Record<string, any>;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;;;;AAIlD,wBAEE"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const services_1 = require("./services");
4
+ const utils_1 = require("@acmekit/framework/utils");
5
+ const utils_2 = require("@acmekit/utils");
6
+ exports.default = (0, utils_1.Module)(utils_2.Modules.SETTINGS, {
7
+ service: services_1.SettingsModuleService,
8
+ });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,oDAAiD;AACjD,0CAAwC;AAExC,kBAAe,IAAA,cAAM,EAAC,eAAO,CAAC,QAAQ,EAAE;IACtC,OAAO,EAAE,gCAAqB;CAC/B,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { Migration } from "@acmekit/framework/mikro-orm/migrations";
2
+ export declare class Migration20250717162007 extends Migration {
3
+ up(): Promise<void>;
4
+ }
5
+ //# sourceMappingURL=Migration20250717162007.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20250717162007.d.ts","sourceRoot":"","sources":["../../src/migrations/Migration20250717162007.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,qBAAa,uBAAwB,SAAQ,SAAS;IAErC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;CAcnC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration20250717162007 = void 0;
4
+ const migrations_1 = require("@acmekit/framework/mikro-orm/migrations");
5
+ class Migration20250717162007 extends migrations_1.Migration {
6
+ async up() {
7
+ this.addSql(`alter table if exists "user_preference" drop constraint if exists "user_preference_user_id_key_unique";`);
8
+ this.addSql(`create table if not exists "user_preference" ("id" text not null, "user_id" text not null, "key" text not null, "value" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "user_preference_pkey" primary key ("id"));`);
9
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_user_preference_deleted_at" ON "user_preference" (deleted_at) WHERE deleted_at IS NULL;`);
10
+ this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_user_preference_user_id_key_unique" ON "user_preference" (user_id, key) WHERE deleted_at IS NULL;`);
11
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_user_preference_user_id" ON "user_preference" (user_id) WHERE deleted_at IS NULL;`);
12
+ this.addSql(`create table if not exists "view_configuration" ("id" text not null, "entity" text not null, "name" text null, "user_id" text null, "is_system_default" boolean not null default false, "configuration" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "view_configuration_pkey" primary key ("id"));`);
13
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_view_configuration_deleted_at" ON "view_configuration" (deleted_at) WHERE deleted_at IS NULL;`);
14
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_view_configuration_entity_user_id" ON "view_configuration" (entity, user_id) WHERE deleted_at IS NULL;`);
15
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_view_configuration_entity_is_system_default" ON "view_configuration" (entity, is_system_default) WHERE deleted_at IS NULL;`);
16
+ this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_view_configuration_user_id" ON "view_configuration" (user_id) WHERE deleted_at IS NULL;`);
17
+ }
18
+ }
19
+ exports.Migration20250717162007 = Migration20250717162007;
20
+ //# sourceMappingURL=Migration20250717162007.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Migration20250717162007.js","sourceRoot":"","sources":["../../src/migrations/Migration20250717162007.ts"],"names":[],"mappings":";;;AAAA,wEAAoE;AAEpE,MAAa,uBAAwB,SAAQ,sBAAS;IAE3C,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,yGAAyG,CAAC,CAAC;QACvH,IAAI,CAAC,MAAM,CAAC,iUAAiU,CAAC,CAAC;QAC/U,IAAI,CAAC,MAAM,CAAC,yHAAyH,CAAC,CAAC;QACvI,IAAI,CAAC,MAAM,CAAC,0IAA0I,CAAC,CAAC;QACxJ,IAAI,CAAC,MAAM,CAAC,mHAAmH,CAAC,CAAC;QAEjI,IAAI,CAAC,MAAM,CAAC,oZAAoZ,CAAC,CAAC;QACla,IAAI,CAAC,MAAM,CAAC,+HAA+H,CAAC,CAAC;QAC7I,IAAI,CAAC,MAAM,CAAC,wIAAwI,CAAC,CAAC;QACtJ,IAAI,CAAC,MAAM,CAAC,4JAA4J,CAAC,CAAC;QAC1K,IAAI,CAAC,MAAM,CAAC,yHAAyH,CAAC,CAAC;IACzI,CAAC;CAEF;AAhBD,0DAgBC"}
@@ -0,0 +1,3 @@
1
+ export { ViewConfiguration } from "./view-configuration";
2
+ export { UserPreference } from "./user-preference";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserPreference = exports.ViewConfiguration = void 0;
4
+ var view_configuration_1 = require("./view-configuration");
5
+ Object.defineProperty(exports, "ViewConfiguration", { enumerable: true, get: function () { return view_configuration_1.ViewConfiguration; } });
6
+ var user_preference_1 = require("./user-preference");
7
+ Object.defineProperty(exports, "UserPreference", { enumerable: true, get: function () { return user_preference_1.UserPreference; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAA/C,uHAAA,iBAAiB,OAAA;AAC1B,qDAAkD;AAAzC,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,7 @@
1
+ export declare const UserPreference: import("@acmekit/framework/utils").DmlEntity<import("@acmekit/framework/utils").DMLEntitySchemaBuilder<{
2
+ id: import("@acmekit/framework/utils").PrimaryKeyModifier<string, import("@acmekit/framework/utils").IdProperty>;
3
+ user_id: import("@acmekit/framework/utils").TextProperty;
4
+ key: import("@acmekit/framework/utils").TextProperty;
5
+ value: import("@acmekit/framework/utils").JSONProperty;
6
+ }>, "user_preference">;
7
+ //# sourceMappingURL=user-preference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-preference.d.ts","sourceRoot":"","sources":["../../src/models/user-preference.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;sBAevB,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserPreference = void 0;
4
+ const utils_1 = require("@acmekit/framework/utils");
5
+ exports.UserPreference = utils_1.model
6
+ .define("user_preference", {
7
+ id: utils_1.model.id({ prefix: "usrpref" }).primaryKey(),
8
+ user_id: utils_1.model.text(),
9
+ key: utils_1.model.text().searchable(),
10
+ value: utils_1.model.json(),
11
+ })
12
+ .indexes([
13
+ {
14
+ on: ["user_id", "key"],
15
+ unique: true,
16
+ },
17
+ {
18
+ on: ["user_id"],
19
+ },
20
+ ]);
21
+ //# sourceMappingURL=user-preference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-preference.js","sourceRoot":"","sources":["../../src/models/user-preference.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEnC,QAAA,cAAc,GAAG,aAAK;KAChC,MAAM,CAAC,iBAAiB,EAAE;IACzB,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,EAAE;IAChD,OAAO,EAAE,aAAK,CAAC,IAAI,EAAE;IACrB,GAAG,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IAC9B,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;CACpB,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;QACtB,MAAM,EAAE,IAAI;KACb;IACD;QACE,EAAE,EAAE,CAAC,SAAS,CAAC;KAChB;CACF,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const ViewConfiguration: import("@acmekit/framework/utils").DmlEntity<import("@acmekit/framework/utils").DMLEntitySchemaBuilder<{
2
+ id: import("@acmekit/framework/utils").PrimaryKeyModifier<string, import("@acmekit/framework/utils").IdProperty>;
3
+ entity: import("@acmekit/framework/utils").TextProperty;
4
+ name: import("@acmekit/framework/utils").NullableModifier<string, import("@acmekit/framework/utils").TextProperty>;
5
+ user_id: import("@acmekit/framework/utils").NullableModifier<string, import("@acmekit/framework/utils").TextProperty>;
6
+ is_system_default: import("@acmekit/framework/utils").BooleanProperty;
7
+ configuration: import("@acmekit/framework/utils").JSONProperty;
8
+ }>, "view_configuration">;
9
+ //# sourceMappingURL=view-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-configuration.d.ts","sourceRoot":"","sources":["../../src/models/view-configuration.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;yBAmB1B,CAAA"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewConfiguration = void 0;
4
+ const utils_1 = require("@acmekit/framework/utils");
5
+ exports.ViewConfiguration = utils_1.model
6
+ .define("view_configuration", {
7
+ id: utils_1.model.id({ prefix: "vconf" }).primaryKey(),
8
+ entity: utils_1.model.text().searchable(),
9
+ name: utils_1.model.text().searchable().nullable(),
10
+ user_id: utils_1.model.text().nullable(),
11
+ is_system_default: utils_1.model.boolean().default(false),
12
+ configuration: utils_1.model.json(),
13
+ })
14
+ .indexes([
15
+ {
16
+ on: ["entity", "user_id"],
17
+ },
18
+ {
19
+ on: ["entity", "is_system_default"],
20
+ },
21
+ {
22
+ on: ["user_id"],
23
+ },
24
+ ]);
25
+ //# sourceMappingURL=view-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-configuration.js","sourceRoot":"","sources":["../../src/models/view-configuration.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEnC,QAAA,iBAAiB,GAAG,aAAK;KACnC,MAAM,CAAC,oBAAoB,EAAE;IAC5B,EAAE,EAAE,aAAK,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE;IAC9C,MAAM,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE;IACjC,IAAI,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,aAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAChC,iBAAiB,EAAE,aAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACjD,aAAa,EAAE,aAAK,CAAC,IAAI,EAAE;CAC5B,CAAC;KACD,OAAO,CAAC;IACP;QACE,EAAE,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;KAC1B;IACD;QACE,EAAE,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;KACpC;IACD;QACE,EAAE,EAAE,CAAC,SAAS,CAAC;KAChB;CACF,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default as SettingsModuleService } from "./settings-module-service";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SettingsModuleService = void 0;
7
+ var settings_module_service_1 = require("./settings-module-service");
8
+ Object.defineProperty(exports, "SettingsModuleService", { enumerable: true, get: function () { return __importDefault(settings_module_service_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,qEAA4E;AAAnE,iJAAA,OAAO,OAAyB"}
@@ -0,0 +1,33 @@
1
+ import { Context, DAL, InferEntityType, InternalModuleDeclaration, ModulesSdkTypes, SettingsTypes } from "@acmekit/framework/types";
2
+ import { ViewConfiguration, UserPreference } from "../models";
3
+ type InjectedDependencies = {
4
+ baseRepository: DAL.RepositoryService;
5
+ viewConfigurationService: ModulesSdkTypes.IAcmeKitInternalService<any>;
6
+ userPreferenceService: ModulesSdkTypes.IAcmeKitInternalService<any>;
7
+ };
8
+ declare const SettingsModuleService_base: import("@acmekit/framework/utils").AcmeKitServiceReturnType<{
9
+ ViewConfiguration: {
10
+ dto: SettingsTypes.ViewConfigurationDTO;
11
+ };
12
+ UserPreference: {
13
+ dto: SettingsTypes.UserPreferenceDTO;
14
+ };
15
+ }>;
16
+ export default class SettingsModuleService extends SettingsModuleService_base implements SettingsTypes.ISettingsModuleService {
17
+ protected readonly moduleDeclaration: InternalModuleDeclaration;
18
+ protected baseRepository_: DAL.RepositoryService;
19
+ protected readonly viewConfigurationService_: ModulesSdkTypes.IAcmeKitInternalService<InferEntityType<typeof ViewConfiguration>>;
20
+ protected readonly userPreferenceService_: ModulesSdkTypes.IAcmeKitInternalService<InferEntityType<typeof UserPreference>>;
21
+ constructor({ baseRepository, viewConfigurationService, userPreferenceService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
22
+ createViewConfigurations(data: SettingsTypes.CreateViewConfigurationDTO | SettingsTypes.CreateViewConfigurationDTO[], sharedContext?: Context): Promise<SettingsTypes.ViewConfigurationDTO | SettingsTypes.ViewConfigurationDTO[]>;
23
+ updateViewConfigurations(idOrSelector: string | SettingsTypes.FilterableViewConfigurationProps, data: SettingsTypes.UpdateViewConfigurationDTO, sharedContext?: Context): Promise<SettingsTypes.ViewConfigurationDTO | SettingsTypes.ViewConfigurationDTO[]>;
24
+ protected updateViewConfigurations_(idOrSelector: string | SettingsTypes.FilterableViewConfigurationProps, data: SettingsTypes.UpdateViewConfigurationDTO, sharedContext?: Context): Promise<InferEntityType<typeof ViewConfiguration>[]>;
25
+ getUserPreference(userId: string, key: string, sharedContext?: Context): Promise<SettingsTypes.UserPreferenceDTO | null>;
26
+ setUserPreference(userId: string, key: string, value: any, sharedContext?: Context): Promise<SettingsTypes.UserPreferenceDTO>;
27
+ getActiveViewConfiguration(entity: string, userId: string, sharedContext?: Context): Promise<SettingsTypes.ViewConfigurationDTO | null>;
28
+ setActiveViewConfiguration(entity: string, userId: string, viewConfigurationId: string, sharedContext?: Context): Promise<void>;
29
+ getSystemDefaultViewConfiguration(entity: string, sharedContext?: Context): Promise<SettingsTypes.ViewConfigurationDTO | null>;
30
+ clearActiveViewConfiguration(entity: string, userId: string, sharedContext?: Context): Promise<void>;
31
+ }
32
+ export {};
33
+ //# sourceMappingURL=settings-module-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-module-service.d.ts","sourceRoot":"","sources":["../../src/services/settings-module-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,GAAG,EACH,eAAe,EACf,yBAAyB,EACzB,eAAe,EACf,aAAa,EACd,MAAM,0BAA0B,CAAA;AASjC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE5D,KAAK,oBAAoB,GAAG;IAC1B,cAAc,EAAE,GAAG,CAAC,iBAAiB,CAAA;IACrC,wBAAwB,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAA;IACtE,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAA;CACpE,CAAA;;uBAIsB;QAAE,GAAG,EAAE,aAAa,CAAC,oBAAoB,CAAA;KAAE;oBAC9C;QAAE,GAAG,EAAE,aAAa,CAAC,iBAAiB,CAAA;KAAE;;AAH5D,MAAM,CAAC,OAAO,OAAO,qBACnB,SAAQ,0BAIR,YAAW,aAAa,CAAC,sBAAsB;IAgB7C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,yBAAyB;IAdjE,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,iBAAiB,CAAA;IAChD,SAAS,CAAC,QAAQ,CAAC,yBAAyB,EAAE,eAAe,CAAC,uBAAuB,CACnF,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAC1C,CAAA;IACD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,eAAe,CAAC,uBAAuB,CAChF,eAAe,CAAC,OAAO,cAAc,CAAC,CACvC,CAAA;gBAGC,EACE,cAAc,EACd,wBAAwB,EACxB,qBAAqB,GACtB,EAAE,oBAAoB,EACJ,iBAAiB,EAAE,yBAAyB;IAW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E,OAAY,GAC5C,OAAO,CAAC,aAAa,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAY/C,4BAA4B,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACI,aAAa,GAAE,OAAY,GAC5C,OAAO,CAAC,IAAI,CAAC;CAUjB"}
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const types_1 = require("@acmekit/framework/types");
16
+ const utils_1 = require("@acmekit/framework/utils");
17
+ const models_1 = require("../models");
18
+ class SettingsModuleService extends (0, utils_1.AcmeKitService)({ ViewConfiguration: models_1.ViewConfiguration, UserPreference: models_1.UserPreference }) {
19
+ constructor({ baseRepository, viewConfigurationService, userPreferenceService, }, moduleDeclaration) {
20
+ super(...arguments);
21
+ this.moduleDeclaration = moduleDeclaration;
22
+ this.baseRepository_ = baseRepository;
23
+ this.viewConfigurationService_ = viewConfigurationService;
24
+ this.userPreferenceService_ = userPreferenceService;
25
+ }
26
+ // @ts-expect-error
27
+ async createViewConfigurations(data, sharedContext = {}) {
28
+ // Convert to array for validation only
29
+ const isArrayInput = Array.isArray(data);
30
+ const dataArray = isArrayInput ? data : [data];
31
+ // Validate system defaults
32
+ for (const config of dataArray) {
33
+ if (config.is_system_default && config.user_id) {
34
+ throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_DATA, "System default view configurations cannot have a user_id");
35
+ }
36
+ if (config.is_system_default) {
37
+ // Check if a system default already exists for this entity
38
+ const existingDefault = await this.viewConfigurationService_.list({
39
+ entity: config.entity,
40
+ is_system_default: true,
41
+ }, { select: ["id"] }, sharedContext);
42
+ if (existingDefault.length > 0) {
43
+ throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.DUPLICATE_ERROR, `A system default view configuration already exists for entity: ${config.entity}`);
44
+ }
45
+ }
46
+ }
47
+ const result = await super.createViewConfigurations(dataArray, sharedContext);
48
+ return await this.baseRepository_.serialize(isArrayInput ? result : result[0]);
49
+ }
50
+ // @ts-expect-error
51
+ async updateViewConfigurations(idOrSelector, data, sharedContext = {}) {
52
+ const updated = await this.updateViewConfigurations_(idOrSelector, data, sharedContext);
53
+ const serialized = await this.baseRepository_.serialize(updated);
54
+ return typeof idOrSelector === "string" ? serialized[0] : serialized;
55
+ }
56
+ async updateViewConfigurations_(idOrSelector, data, sharedContext = {}) {
57
+ let selector = {};
58
+ if (typeof idOrSelector === "string") {
59
+ selector = { id: idOrSelector };
60
+ }
61
+ else {
62
+ selector = idOrSelector;
63
+ }
64
+ // Special handling for configuration updates to ensure replacement instead of merge
65
+ if (data.configuration) {
66
+ // First, get the entities to update
67
+ const entities = await this.viewConfigurationService_.list(selector, {}, sharedContext);
68
+ if (entities.length === 0) {
69
+ return typeof idOrSelector === "string" ? [] : [];
70
+ }
71
+ // Use upsertWithReplace to update the configuration field without merging
72
+ const updateDataArray = entities.map((entity) => ({
73
+ id: entity.id,
74
+ ...data,
75
+ configuration: {
76
+ visible_columns: data.configuration?.visible_columns ?? [],
77
+ column_order: data.configuration?.column_order ?? [],
78
+ column_widths: data.configuration?.column_widths !== undefined
79
+ ? data.configuration.column_widths
80
+ : {},
81
+ filters: data.configuration?.filters !== undefined
82
+ ? data.configuration.filters
83
+ : {},
84
+ sorting: data.configuration?.sorting !== undefined
85
+ ? data.configuration.sorting
86
+ : null,
87
+ search: data.configuration?.search !== undefined
88
+ ? data.configuration.search
89
+ : "",
90
+ },
91
+ }));
92
+ // Use upsertWithReplace which uses nativeUpdateMany internally and doesn't merge JSON fields
93
+ const { entities: updatedEntities } = await this.viewConfigurationService_.upsertWithReplace(updateDataArray, { relations: [] }, sharedContext);
94
+ return updatedEntities;
95
+ }
96
+ // For non-configuration updates, use the standard update method
97
+ const updated = await this.viewConfigurationService_.update({ selector, data }, sharedContext);
98
+ return updated;
99
+ }
100
+ async getUserPreference(userId, key, sharedContext = {}) {
101
+ const prefs = await this.userPreferenceService_.list({ user_id: userId, key }, {}, sharedContext);
102
+ if (prefs.length === 0) {
103
+ return null;
104
+ }
105
+ return await this.baseRepository_.serialize(prefs[0]);
106
+ }
107
+ async setUserPreference(userId, key, value, sharedContext = {}) {
108
+ const existing = await this.userPreferenceService_.list({ user_id: userId, key }, { select: ["id"] }, sharedContext);
109
+ let result;
110
+ if (existing.length > 0) {
111
+ const updated = await this.userPreferenceService_.update([{ id: existing[0].id, value }], sharedContext);
112
+ result = updated[0];
113
+ }
114
+ else {
115
+ const created = await this.userPreferenceService_.create({ user_id: userId, key, value }, sharedContext);
116
+ result = created[0];
117
+ }
118
+ return await this.baseRepository_.serialize(result);
119
+ }
120
+ async getActiveViewConfiguration(entity, userId, sharedContext = {}) {
121
+ // Check if user has an active view preference
122
+ const activeViewPref = await this.getUserPreference(userId, `active_view.${entity}`, sharedContext);
123
+ // Check if we have a preference with a view configuration ID (not explicitly null)
124
+ if (activeViewPref &&
125
+ activeViewPref.value?.viewConfigurationId &&
126
+ activeViewPref.value.viewConfigurationId !== null) {
127
+ try {
128
+ return await this.retrieveViewConfiguration(activeViewPref.value.viewConfigurationId, {}, sharedContext);
129
+ }
130
+ catch (error) {
131
+ // View configuration might have been deleted
132
+ }
133
+ }
134
+ // If we have an explicit null preference, or no preference, or a deleted view
135
+ // We should check for defaults in this order:
136
+ // Check if user has any personal views (only if no explicit null preference)
137
+ if (!activeViewPref || activeViewPref.value?.viewConfigurationId !== null) {
138
+ const [personalView] = await this.listViewConfigurations({ entity, user_id: userId }, { take: 1, order: { created_at: "ASC" } }, sharedContext);
139
+ if (personalView) {
140
+ return personalView;
141
+ }
142
+ }
143
+ // Fall back to system default
144
+ const systemDefaults = await this.listViewConfigurations({ entity, is_system_default: true }, {}, sharedContext);
145
+ return systemDefaults.length > 0 ? systemDefaults[0] : null;
146
+ }
147
+ async setActiveViewConfiguration(entity, userId, viewConfigurationId, sharedContext = {}) {
148
+ // Verify the view configuration exists and user has access
149
+ const viewConfig = await this.retrieveViewConfiguration(viewConfigurationId, {}, sharedContext);
150
+ if (viewConfig.entity !== entity) {
151
+ throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.INVALID_DATA, `View configuration ${viewConfigurationId} is not for entity ${entity}`);
152
+ }
153
+ if (viewConfig.user_id && viewConfig.user_id !== userId) {
154
+ throw new utils_1.AcmeKitError(utils_1.AcmeKitError.Types.NOT_ALLOWED, `User ${userId} does not have access to view configuration ${viewConfigurationId}`);
155
+ }
156
+ await this.setUserPreference(userId, `active_view.${entity}`, { viewConfigurationId }, sharedContext);
157
+ }
158
+ async getSystemDefaultViewConfiguration(entity, sharedContext = {}) {
159
+ const systemDefaults = await this.listViewConfigurations({ entity, is_system_default: true }, {}, sharedContext);
160
+ return systemDefaults.length > 0 ? systemDefaults[0] : null;
161
+ }
162
+ async clearActiveViewConfiguration(entity, userId, sharedContext = {}) {
163
+ // Instead of deleting, set the preference to null
164
+ // This ensures we're using the same transaction pattern as setActiveViewConfiguration
165
+ await this.setUserPreference(userId, `active_view.${entity}`, { viewConfigurationId: null }, sharedContext);
166
+ }
167
+ }
168
+ exports.default = SettingsModuleService;
169
+ __decorate([
170
+ (0, utils_1.InjectManager)(),
171
+ (0, utils_1.EmitEvents)()
172
+ // @ts-expect-error
173
+ ,
174
+ __param(1, (0, utils_1.AcmeKitContext)()),
175
+ __metadata("design:type", Function),
176
+ __metadata("design:paramtypes", [Object, Object]),
177
+ __metadata("design:returntype", Promise)
178
+ ], SettingsModuleService.prototype, "createViewConfigurations", null);
179
+ __decorate([
180
+ (0, utils_1.InjectManager)(),
181
+ (0, utils_1.EmitEvents)()
182
+ // @ts-expect-error
183
+ ,
184
+ __param(2, (0, utils_1.AcmeKitContext)()),
185
+ __metadata("design:type", Function),
186
+ __metadata("design:paramtypes", [Object, Object, Object]),
187
+ __metadata("design:returntype", Promise)
188
+ ], SettingsModuleService.prototype, "updateViewConfigurations", null);
189
+ __decorate([
190
+ (0, utils_1.InjectTransactionManager)(),
191
+ __param(2, (0, utils_1.AcmeKitContext)()),
192
+ __metadata("design:type", Function),
193
+ __metadata("design:paramtypes", [Object, Object, Object]),
194
+ __metadata("design:returntype", Promise)
195
+ ], SettingsModuleService.prototype, "updateViewConfigurations_", null);
196
+ __decorate([
197
+ (0, utils_1.InjectManager)(),
198
+ __param(2, (0, utils_1.AcmeKitContext)()),
199
+ __metadata("design:type", Function),
200
+ __metadata("design:paramtypes", [String, String, Object]),
201
+ __metadata("design:returntype", Promise)
202
+ ], SettingsModuleService.prototype, "getUserPreference", null);
203
+ __decorate([
204
+ (0, utils_1.InjectManager)(),
205
+ (0, utils_1.EmitEvents)(),
206
+ __param(3, (0, utils_1.AcmeKitContext)()),
207
+ __metadata("design:type", Function),
208
+ __metadata("design:paramtypes", [String, String, Object, Object]),
209
+ __metadata("design:returntype", Promise)
210
+ ], SettingsModuleService.prototype, "setUserPreference", null);
211
+ __decorate([
212
+ (0, utils_1.InjectManager)(),
213
+ __param(2, (0, utils_1.AcmeKitContext)()),
214
+ __metadata("design:type", Function),
215
+ __metadata("design:paramtypes", [String, String, Object]),
216
+ __metadata("design:returntype", Promise)
217
+ ], SettingsModuleService.prototype, "getActiveViewConfiguration", null);
218
+ __decorate([
219
+ (0, utils_1.InjectManager)(),
220
+ (0, utils_1.EmitEvents)(),
221
+ __param(3, (0, utils_1.AcmeKitContext)()),
222
+ __metadata("design:type", Function),
223
+ __metadata("design:paramtypes", [String, String, String, Object]),
224
+ __metadata("design:returntype", Promise)
225
+ ], SettingsModuleService.prototype, "setActiveViewConfiguration", null);
226
+ __decorate([
227
+ (0, utils_1.InjectManager)(),
228
+ __param(1, (0, utils_1.AcmeKitContext)()),
229
+ __metadata("design:type", Function),
230
+ __metadata("design:paramtypes", [String, Object]),
231
+ __metadata("design:returntype", Promise)
232
+ ], SettingsModuleService.prototype, "getSystemDefaultViewConfiguration", null);
233
+ __decorate([
234
+ (0, utils_1.InjectManager)(),
235
+ (0, utils_1.EmitEvents)(),
236
+ __param(2, (0, utils_1.AcmeKitContext)()),
237
+ __metadata("design:type", Function),
238
+ __metadata("design:paramtypes", [String, String, Object]),
239
+ __metadata("design:returntype", Promise)
240
+ ], SettingsModuleService.prototype, "clearActiveViewConfiguration", null);
241
+ //# sourceMappingURL=settings-module-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-module-service.js","sourceRoot":"","sources":["../../src/services/settings-module-service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAOiC;AACjC,oDAOiC;AACjC,qCAA4D;AAQ5D,MAAqB,qBACnB,SAAQ,IAAA,sBAAc,EAGnB,EAAE,iBAAiB,EAAjB,0BAAiB,EAAE,cAAc,EAAd,uBAAc,EAAE,CAAC;IAWzC,YACE,EACE,cAAc,EACd,wBAAwB,EACxB,qBAAqB,GACA,EACJ,iBAA4C;QAE/D,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;QAFA,sBAAiB,GAAjB,iBAAiB,CAA2B;QAG/D,IAAI,CAAC,eAAe,GAAG,cAAc,CAAA;QACrC,IAAI,CAAC,yBAAyB,GAAG,wBAAwB,CAAA;QACzD,IAAI,CAAC,sBAAsB,GAAG,qBAAqB,CAAA;IACrD,CAAC;IAKK,AADN,mBAAmB;IACnB,KAAK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IAAA,sBAAc,GAAE,CAAA;;;;qEA6ClB;AAKK;IAHL,IAAA,qBAAa,GAAE;IACf,IAAA,kBAAU,GAAE;IACb,mBAAmB;;IAIhB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;qEAelB;AAGe;IADf,IAAA,gCAAwB,GAAE;IAIxB,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;sEAmElB;AAGK;IADL,IAAA,qBAAa,GAAE;IAIb,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;8DAelB;AAIK;IAFL,IAAA,qBAAa,GAAE;IACf,IAAA,kBAAU,GAAE;IAKV,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;8DA2BlB;AAGK;IADL,IAAA,qBAAa,GAAE;IAIb,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;uEAkDlB;AAIK;IAFL,IAAA,qBAAa,GAAE;IACf,IAAA,kBAAU,GAAE;IAKV,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;uEA6BlB;AAGK;IADL,IAAA,qBAAa,GAAE;IAGb,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;8EASlB;AAIK;IAFL,IAAA,qBAAa,GAAE;IACf,IAAA,kBAAU,GAAE;IAIV,WAAA,IAAA,sBAAc,GAAE,CAAA;;;;yEAUlB"}
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts","../src/migrations/migration20250717162007.ts","../src/models/index.ts","../src/models/user-preference.ts","../src/models/view-configuration.ts","../src/services/index.ts","../src/services/settings-module-service.ts","../src/types/index.ts"],"version":"5.9.3"}
@@ -0,0 +1,5 @@
1
+ import { Logger } from "@acmekit/framework/types";
2
+ export type InitializeModuleInjectableDependencies = {
3
+ logger?: Logger;
4
+ };
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@acmekit/settings",
3
+ "version": "2.13.1",
4
+ "description": "AcmeKit Settings module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "!dist/**/__tests__",
10
+ "!dist/**/__mocks__",
11
+ "!dist/**/__fixtures__"
12
+ ],
13
+ "engines": {
14
+ "node": ">=20"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/acmekit/acmekit",
19
+ "directory": "packages/modules/settings"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "author": "AcmeKit",
25
+ "license": "MIT",
26
+ "scripts": {
27
+ "watch": "yarn run -T tsc --build --watch",
28
+ "watch:test": "yarn run -T tsc --build tsconfig.spec.json --watch",
29
+ "resolve:aliases": "yarn run -T tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && yarn run -T tsc-alias -p tsconfig.resolved.json && yarn run -T rimraf tsconfig.resolved.json",
30
+ "build": "yarn run -T rimraf dist && yarn run -T tsc --build && npm run resolve:aliases",
31
+ "test": "../../../node_modules/.bin/jest --passWithNoTests --bail --forceExit --testPathPattern=src",
32
+ "test:integration": "../../../node_modules/.bin/jest --passWithNoTests --forceExit --testPathPattern=\"integration-tests/__tests__/.*\\.ts\"",
33
+ "migration:initial": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create --initial",
34
+ "migration:create": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:create",
35
+ "migration:up": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm migration:up",
36
+ "orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true acmekit-mikro-orm cache:clear"
37
+ },
38
+ "devDependencies": {
39
+ "@acmekit/framework": "2.13.1",
40
+ "@acmekit/test-utils": "2.13.1"
41
+ },
42
+ "peerDependencies": {
43
+ "@acmekit/framework": "2.13.1"
44
+ }
45
+ }