@yangsaiyam/helper 1.8.1 → 1.8.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangsaiyam/helper",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "main": "./src/index.ts",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -8,10 +8,16 @@ export const CAREER_JOB_TYPE = [
8
8
  ] as const satisfies readonly MappingOption[];
9
9
 
10
10
  export const CAREER_CATEGORY = [
11
- { key: 1, value: "Engineering", i18nKey: "career.category.1" },
11
+ { key: 1, value: "Technology", i18nKey: "career.category.1" },
12
12
  { key: 2, value: "Design", i18nKey: "career.category.2" },
13
- { key: 3, value: "Product", i18nKey: "career.category.3" },
13
+ { key: 3, value: "Business", i18nKey: "career.category.3" },
14
14
  { key: 4, value: "Marketing", i18nKey: "career.category.4" },
15
+ { key: 5, value: "Operations", i18nKey: "career.category.5" },
16
+ { key: 6, value: "Finance", i18nKey: "career.category.6" },
17
+ { key: 7, value: "Human Resources", i18nKey: "career.category.7" },
18
+ { key: 8, value: "Legal", i18nKey: "career.category.8" },
19
+ { key: 9, value: "Customer Support", i18nKey: "career.category.9" },
20
+ { key: 10, value: "Management", i18nKey: "career.category.10" },
15
21
  ] as const satisfies readonly MappingOption[];
16
22
 
17
23
  export const CAREER_MODE = [
@@ -72,6 +72,23 @@ assert.equal(
72
72
  );
73
73
  assert.equal(permissionLabelKey(Permission.VIEWS_READ), "permissions.viewsRead");
74
74
  assert.equal(permissionLabelKey(Permission.LOGS_READ), "permissions.logsRead");
75
+ assert.equal(
76
+ permissionLabelKey(Permission.UTM_RECORDS_READ),
77
+ "permissions.utmRecordsRead",
78
+ );
79
+ assert.equal(
80
+ permissionLabelKey(Permission.UTM_RECORDS_WRITE),
81
+ "permissions.utmRecordsWrite",
82
+ );
83
+ assert.equal(permissionLabelKey(Permission.ORIGIN_READ), "permissions.originRead");
84
+ assert.equal(
85
+ permissionLabelKey(Permission.ORIGIN_WRITE),
86
+ "permissions.originWrite",
87
+ );
88
+ assert.equal(
89
+ permissionLabelKey(Permission.ORIGIN_DELETE),
90
+ "permissions.originDelete",
91
+ );
75
92
 
76
93
  assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.USERS_DELETE));
77
94
  assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.OTP_ATTEMPTS_READ));
@@ -80,9 +97,15 @@ assert.ok(
80
97
  );
81
98
  assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.VIEWS_READ));
82
99
  assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.LOGS_READ));
100
+ assert.ok(
101
+ ROLE_PERMISSIONS["super-admin"].includes(Permission.UTM_RECORDS_WRITE),
102
+ );
103
+ assert.ok(ROLE_PERMISSIONS["super-admin"].includes(Permission.ORIGIN_DELETE));
83
104
  assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.CONTACT_FORM_DELETE));
84
105
  assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.VIEWS_READ));
85
106
  assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.LOGS_READ));
107
+ assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.UTM_RECORDS_WRITE));
108
+ assert.ok(ROLE_PERMISSIONS.admin.includes(Permission.ORIGIN_DELETE));
86
109
  assert.equal(
87
110
  ROLE_PERMISSIONS.admin.includes(Permission.USERS_WRITE),
88
111
  false,
@@ -99,6 +122,8 @@ assert.equal(hasPermission("hr", Permission.CAREERS_WRITE), true);
99
122
  assert.equal(hasPermission("staff", Permission.CAREERS_WRITE), false);
100
123
  assert.equal(hasPermission("staff", Permission.CONTACT_FORM_READ), true);
101
124
  assert.equal(hasPermission("admin", Permission.VIEWS_READ), true);
125
+ assert.equal(hasPermission("admin", Permission.UTM_RECORDS_WRITE), true);
126
+ assert.equal(hasPermission("admin", Permission.ORIGIN_DELETE), true);
102
127
  assert.equal(hasPermission("visitor", Permission.VIEWS_READ), false);
103
128
  assert.equal(hasPermission(32767, Permission.LOGS_READ), false);
104
129
  assert.equal(hasPermission(undefined, Permission.CAREERS_READ), false);
@@ -95,6 +95,11 @@ export const Permission = {
95
95
  TWO_FACTOR_AUTH_WRITE: "two-factor-auth:write",
96
96
  VIEWS_READ: "views:read",
97
97
  LOGS_READ: "logs:read",
98
+ UTM_RECORDS_READ: "utm-records:read",
99
+ UTM_RECORDS_WRITE: "utm-records:write",
100
+ ORIGIN_READ: "origin:read",
101
+ ORIGIN_WRITE: "origin:write",
102
+ ORIGIN_DELETE: "origin:delete",
98
103
  } as const;
99
104
 
100
105
  export type Permission = (typeof Permission)[keyof typeof Permission];
@@ -117,6 +122,11 @@ export const PERMISSION_I18N_KEY: Record<Permission, string> = {
117
122
  [Permission.TWO_FACTOR_AUTH_WRITE]: "permissions.twoFactorAuthWrite",
118
123
  [Permission.VIEWS_READ]: "permissions.viewsRead",
119
124
  [Permission.LOGS_READ]: "permissions.logsRead",
125
+ [Permission.UTM_RECORDS_READ]: "permissions.utmRecordsRead",
126
+ [Permission.UTM_RECORDS_WRITE]: "permissions.utmRecordsWrite",
127
+ [Permission.ORIGIN_READ]: "permissions.originRead",
128
+ [Permission.ORIGIN_WRITE]: "permissions.originWrite",
129
+ [Permission.ORIGIN_DELETE]: "permissions.originDelete",
120
130
  };
121
131
 
122
132
  export const ROLE_PERMISSIONS: Record<CanonicalRole, Permission[]> = {
@@ -138,6 +148,11 @@ export const ROLE_PERMISSIONS: Record<CanonicalRole, Permission[]> = {
138
148
  Permission.TWO_FACTOR_AUTH_WRITE,
139
149
  Permission.VIEWS_READ,
140
150
  Permission.LOGS_READ,
151
+ Permission.UTM_RECORDS_READ,
152
+ Permission.UTM_RECORDS_WRITE,
153
+ Permission.ORIGIN_READ,
154
+ Permission.ORIGIN_WRITE,
155
+ Permission.ORIGIN_DELETE,
141
156
  ],
142
157
  admin: [
143
158
  Permission.ALLOWED_EMAILS_READ,
@@ -151,6 +166,11 @@ export const ROLE_PERMISSIONS: Record<CanonicalRole, Permission[]> = {
151
166
  Permission.JOB_APPLICATIONS_READ,
152
167
  Permission.VIEWS_READ,
153
168
  Permission.LOGS_READ,
169
+ Permission.UTM_RECORDS_READ,
170
+ Permission.UTM_RECORDS_WRITE,
171
+ Permission.ORIGIN_READ,
172
+ Permission.ORIGIN_WRITE,
173
+ Permission.ORIGIN_DELETE,
154
174
  ],
155
175
  hr: [
156
176
  Permission.CAREERS_READ,