@wipperoz/common-entities-account 1.0.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.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # common-entities-account
2
+ Common repository for account entities
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./measurementSystem.enum"), exports);
18
+ __exportStar(require("./notificationMeansType.enum"), exports);
19
+ __exportStar(require("./notificationType.enum"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.measurementSystemEnum = exports.MeasurementSystemEnum = void 0;
4
+ var MeasurementSystemEnum;
5
+ (function (MeasurementSystemEnum) {
6
+ MeasurementSystemEnum["IMPERIAL"] = "Imperial";
7
+ MeasurementSystemEnum["METRIC"] = "Metric";
8
+ })(MeasurementSystemEnum || (exports.MeasurementSystemEnum = MeasurementSystemEnum = {}));
9
+ exports.measurementSystemEnum = Object.values(MeasurementSystemEnum);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const measurementSystem_enum_1 = require("./measurementSystem.enum");
4
+ describe('MeasurementSystemEnum', () => {
5
+ it('should have IMPERIAL and METRIC values', () => {
6
+ expect(measurementSystem_enum_1.MeasurementSystemEnum.IMPERIAL).toBe('Imperial');
7
+ expect(measurementSystem_enum_1.MeasurementSystemEnum.METRIC).toBe('Metric');
8
+ });
9
+ it('should have an array of enum values', () => {
10
+ expect(measurementSystem_enum_1.measurementSystemEnum).toEqual(['Imperial', 'Metric']);
11
+ });
12
+ });
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const notificationMeansType_enum_1 = require("./notificationMeansType.enum");
4
+ describe('NotificationMeansTypeEnum', () => {
5
+ it('should have EMAIL and SMS values', () => {
6
+ expect(notificationMeansType_enum_1.NotificationMeansTypeEnum.EMAIL).toBe('Email');
7
+ expect(notificationMeansType_enum_1.NotificationMeansTypeEnum.SMS).toBe('SMS');
8
+ });
9
+ it('should have an array of enum values', () => {
10
+ expect(notificationMeansType_enum_1.notificationMeansTypeEnum).toEqual(['Email', 'SMS']);
11
+ });
12
+ });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationMeansTypeEnum = exports.NotificationMeansTypeEnum = void 0;
4
+ var NotificationMeansTypeEnum;
5
+ (function (NotificationMeansTypeEnum) {
6
+ NotificationMeansTypeEnum["EMAIL"] = "Email";
7
+ NotificationMeansTypeEnum["SMS"] = "SMS";
8
+ })(NotificationMeansTypeEnum || (exports.NotificationMeansTypeEnum = NotificationMeansTypeEnum = {}));
9
+ exports.notificationMeansTypeEnum = Object.values(NotificationMeansTypeEnum);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notificationTypeEnum = exports.NotificationTypeEnum = void 0;
4
+ var NotificationTypeEnum;
5
+ (function (NotificationTypeEnum) {
6
+ NotificationTypeEnum["BILLING"] = "Billing";
7
+ NotificationTypeEnum["WIP_TRANSACTIONS"] = "WIP Transactions";
8
+ NotificationTypeEnum["MARKETING"] = "Marketing";
9
+ })(NotificationTypeEnum || (exports.NotificationTypeEnum = NotificationTypeEnum = {}));
10
+ exports.notificationTypeEnum = Object.values(NotificationTypeEnum);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const notificationType_enum_1 = require("./notificationType.enum");
4
+ describe('NotificationTypeEnum', () => {
5
+ it('should have BILLING, WIP_TRANSACTIONS, and MARKETING values', () => {
6
+ expect(notificationType_enum_1.NotificationTypeEnum.BILLING).toBe('Billing');
7
+ expect(notificationType_enum_1.NotificationTypeEnum.WIP_TRANSACTIONS).toBe('WIP Transactions');
8
+ expect(notificationType_enum_1.NotificationTypeEnum.MARKETING).toBe('Marketing');
9
+ });
10
+ it('should have an array of enum values', () => {
11
+ expect(notificationType_enum_1.notificationTypeEnum).toEqual([
12
+ 'Billing',
13
+ 'WIP Transactions',
14
+ 'Marketing',
15
+ ]);
16
+ });
17
+ it('should contain all enum keys', () => {
18
+ const keys = Object.keys(notificationType_enum_1.NotificationTypeEnum);
19
+ expect(keys).toContain('BILLING');
20
+ expect(keys).toContain('WIP_TRANSACTIONS');
21
+ expect(keys).toContain('MARKETING');
22
+ });
23
+ it('should contain all enum values', () => {
24
+ const values = Object.values(notificationType_enum_1.NotificationTypeEnum);
25
+ expect(values).toContain('Billing');
26
+ expect(values).toContain('WIP Transactions');
27
+ expect(values).toContain('Marketing');
28
+ });
29
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./enums"), exports);
18
+ __exportStar(require("./interfaces"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("../enums/index.js");
4
+ describe('IAccountSettings Interface', () => {
5
+ it('should allow an empty Items array', () => {
6
+ const accountSettings = {};
7
+ expect(accountSettings.Items).toBeUndefined();
8
+ });
9
+ it('should allow Items with Pkey, Skey, and Details', () => {
10
+ const notification = {
11
+ notificationType: index_js_1.NotificationTypeEnum.BILLING,
12
+ allowChange: true,
13
+ notificationActive: true,
14
+ };
15
+ const accountSettings = {
16
+ Items: [
17
+ {
18
+ Pkey: 'user-id:123',
19
+ Skey: 'account-settings-id:456',
20
+ Details: {
21
+ wipperozNotifications: [notification],
22
+ },
23
+ },
24
+ ],
25
+ };
26
+ expect(accountSettings.Items).toHaveLength(1);
27
+ expect(accountSettings.Items?.[0].Pkey).toBe('user-id:123');
28
+ expect(accountSettings.Items?.[0].Skey).toBe('account-settings-id:456');
29
+ expect(accountSettings.Items?.[0].Details?.wipperozNotifications).toHaveLength(1);
30
+ expect(accountSettings.Items?.[0].Details?.wipperozNotifications[0]).toEqual(notification);
31
+ });
32
+ it('should allow Items without Pkey and Skey', () => {
33
+ const notification = {
34
+ notificationType: index_js_1.NotificationTypeEnum.BILLING,
35
+ allowChange: true,
36
+ notificationActive: true,
37
+ };
38
+ const accountSettings = {
39
+ Items: [
40
+ {
41
+ Details: {
42
+ wipperozNotifications: [notification],
43
+ },
44
+ },
45
+ ],
46
+ };
47
+ expect(accountSettings.Items).toHaveLength(1);
48
+ expect(accountSettings.Items?.[0].Pkey).toBeUndefined();
49
+ expect(accountSettings.Items?.[0].Skey).toBeUndefined();
50
+ expect(accountSettings.Items?.[0].Details?.wipperozNotifications).toHaveLength(1);
51
+ expect(accountSettings.Items?.[0].Details?.wipperozNotifications[0]).toEqual(notification);
52
+ });
53
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./account-settings.interface.js"), exports);
18
+ __exportStar(require("./wipperoz-notification.interface.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("../enums/index.js");
4
+ describe('IWipperozNotification Interface', () => {
5
+ it('should create a valid IWipperozNotification object', () => {
6
+ const notification = {
7
+ notificationType: index_js_1.NotificationTypeEnum.BILLING,
8
+ allowChange: true,
9
+ notificationActive: true,
10
+ };
11
+ expect(notification.notificationType).toBe(index_js_1.NotificationTypeEnum.BILLING);
12
+ expect(notification.allowChange).toBe(true);
13
+ expect(notification.notificationActive).toBe(true);
14
+ });
15
+ it('should allow changing notificationActive property', () => {
16
+ const notification = {
17
+ notificationType: index_js_1.NotificationTypeEnum.MARKETING,
18
+ allowChange: true,
19
+ notificationActive: false,
20
+ };
21
+ notification.notificationActive = true;
22
+ expect(notification.notificationActive).toBe(true);
23
+ });
24
+ });
package/package.json ADDED
@@ -0,0 +1,197 @@
1
+ {
2
+ "name": "@wipperoz/common-entities-account",
3
+ "version": "1.0.1",
4
+ "description": "Wipperoz common entities account package",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "author": "Diego Santana <dsantana@wipperoz.com>",
11
+ "license": "MIT",
12
+ "scripts": {
13
+ "cz": "git-cz",
14
+ "clean": "node bin/run-clean.mjs dist reports",
15
+ "build": "yarn clean & yarn tsc",
16
+ "build:watch": "yarn build --watch",
17
+ "lint": "yarn prettier:check && yarn eslint:cli",
18
+ "lint:fix": "yarn eslint:fix && yarn prettier:fix",
19
+ "prettier:cli": "yarn prettier \"*/**/*.{js,ts}\"",
20
+ "prettier:check": "yarn prettier:cli --l",
21
+ "prettier:fix": "yarn prettier:cli --write",
22
+ "eslint:cli": "yarn eslint --report-unused-disable-directives .",
23
+ "eslint:fix": "yarn eslint:cli --fix",
24
+ "pretest": "yarn build",
25
+ "test": "jest --passWithNoTests --colors --coverage",
26
+ "posttest": "yarn lint:fix",
27
+ "semantic-release": "semantic-release -t v\\${version}",
28
+ "prepack": "yarn build",
29
+ "prepare": "husky"
30
+ },
31
+ "files": [
32
+ "dist/**/*"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/wipperoz/common-entities-account.git"
37
+ },
38
+ "_moduleAliases": {
39
+ "enums": "dist/enums",
40
+ "services": "dist/interfaces"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/wipperoz/common-entities-account/issues"
44
+ },
45
+ "homepage": "https://github.com/wipperoz/common-entities-account",
46
+ "dependencies": {
47
+ "@wipperoz/common-utils": "^1.16.0"
48
+ },
49
+ "devDependencies": {
50
+ "@commitlint/cli": "^19.5.0",
51
+ "@commitlint/config-conventional": "^19.5.0",
52
+ "@eslint/js": "^9.10.0",
53
+ "@semantic-release/changelog": "^6.0.3",
54
+ "@semantic-release/exec": "^6.0.3",
55
+ "@semantic-release/git": "^10.0.1",
56
+ "@tsconfig/node20": "^20.1.4",
57
+ "@types/jest": "^29.5.13",
58
+ "@types/node": "^22.5.4",
59
+ "@typescript-eslint/eslint-plugin": "^8.6.0",
60
+ "@typescript-eslint/parser": "^8.6.0",
61
+ "commitizen": "^4.3.0",
62
+ "conventional-changelog-conventionalcommits": "^8.0.0",
63
+ "cross-env": "^7.0.3",
64
+ "cz-conventional-changelog": "^3.3.0",
65
+ "eslint": "^9.10.0",
66
+ "eslint-config-prettier": "^9.1.0",
67
+ "eslint-formatter-junit": "^8.40.0",
68
+ "eslint-plugin-mocha": "^10.5.0",
69
+ "eslint-plugin-node": "^11.1.0",
70
+ "eslint-plugin-prettier": "^5.2.1",
71
+ "eslint-plugin-security": "^3.0.1",
72
+ "eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
73
+ "husky": "^9.1.6",
74
+ "jest": "^29.7.0",
75
+ "jest-junit": "^16.0.0",
76
+ "json-schema-to-ts": "^3.1.1",
77
+ "prettier": "^3.3.3",
78
+ "semantic-release": "^24.1.1",
79
+ "ts-jest": "^29.2.5",
80
+ "ts-node": "^9.1.1",
81
+ "tsconfig-paths": "^4.2.0",
82
+ "tsx": "^4.19.1",
83
+ "typescript": "^5.6.2",
84
+ "typescript-eslint": "^8.6.0"
85
+ },
86
+ "config": {
87
+ "commitizen": {
88
+ "path": "./node_modules/cz-conventional-changelog"
89
+ }
90
+ },
91
+ "release": {
92
+ "branches": [
93
+ "+([0-9])?(.{+([0-9]),x}).x",
94
+ "main",
95
+ "next",
96
+ "next-major",
97
+ {
98
+ "name": "beta",
99
+ "prerelease": true
100
+ },
101
+ {
102
+ "name": "alpha",
103
+ "prerelease": true
104
+ }
105
+ ],
106
+ "plugins": [
107
+ [
108
+ "@semantic-release/commit-analyzer",
109
+ {
110
+ "preset": "conventionalcommits"
111
+ }
112
+ ],
113
+ [
114
+ "@semantic-release/release-notes-generator",
115
+ {
116
+ "preset": "conventionalcommits",
117
+ "presetConfig": {
118
+ "types": [
119
+ {
120
+ "type": "chore",
121
+ "section": "Others",
122
+ "hidden": false
123
+ },
124
+ {
125
+ "type": "revert",
126
+ "section": "Reverts",
127
+ "hidden": false
128
+ },
129
+ {
130
+ "type": "feat",
131
+ "section": "Features",
132
+ "hidden": false
133
+ },
134
+ {
135
+ "type": "fix",
136
+ "section": "Bug Fixes",
137
+ "hidden": false
138
+ },
139
+ {
140
+ "type": "improvement",
141
+ "section": "Feature Improvements",
142
+ "hidden": false
143
+ },
144
+ {
145
+ "type": "docs",
146
+ "section": "Docs",
147
+ "hidden": false
148
+ },
149
+ {
150
+ "type": "style",
151
+ "section": "Styling",
152
+ "hidden": false
153
+ },
154
+ {
155
+ "type": "refactor",
156
+ "section": "Code Refactoring",
157
+ "hidden": false
158
+ },
159
+ {
160
+ "type": "perf",
161
+ "section": "Performance Improvements",
162
+ "hidden": false
163
+ },
164
+ {
165
+ "type": "test",
166
+ "section": "Tests",
167
+ "hidden": false
168
+ },
169
+ {
170
+ "type": "build",
171
+ "section": "Build System",
172
+ "hidden": false
173
+ },
174
+ {
175
+ "type": "ci",
176
+ "section": "CI",
177
+ "hidden": false
178
+ }
179
+ ],
180
+ "issuePrefixes": [
181
+ "WIP-"
182
+ ],
183
+ "issueUrlFormat": "https://wipperoz.atlassian.net/browse/{{prefix}}{{id}}"
184
+ }
185
+ }
186
+ ],
187
+ [
188
+ "@semantic-release/changelog",
189
+ {
190
+ "changelogFile": "CHANGELOG.md"
191
+ }
192
+ ],
193
+ "@semantic-release/npm",
194
+ "@semantic-release/git"
195
+ ]
196
+ }
197
+ }