@tomei/sso 0.65.1-test.1 → 0.65.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/.gitlab-ci.yml +33 -214
- package/__tests__/unit/components/group/group.spec.ts +0 -6
- package/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.ts +1 -9
- package/__tests__/unit/components/login-user/login.spec.ts +5 -1199
- package/__tests__/unit/components/login-user/password-expiry.spec.ts +87 -0
- package/__tests__/unit/components/system/system.spec.ts +0 -1
- package/dist/__tests__/unit/components/group/group.spec.js +0 -4
- package/dist/__tests__/unit/components/group/group.spec.js.map +1 -1
- package/dist/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.js +1 -9
- package/dist/__tests__/unit/components/group-reporting-user/group-reporting-user.spec.js.map +1 -1
- package/dist/__tests__/unit/components/login-user/login.spec.js +0 -703
- package/dist/__tests__/unit/components/login-user/login.spec.js.map +1 -1
- package/dist/__tests__/unit/components/login-user/password-expiry.spec.js +86 -0
- package/dist/__tests__/unit/components/login-user/password-expiry.spec.js.map +1 -0
- package/dist/__tests__/unit/components/system/system.spec.js +0 -1
- package/dist/__tests__/unit/components/system/system.spec.js.map +1 -1
- package/dist/src/components/login-user/user.d.ts +5 -0
- package/dist/src/components/login-user/user.js +44 -0
- package/dist/src/components/login-user/user.js.map +1 -1
- package/dist/src/components/user-password-history/user-password-history.d.ts +1 -0
- package/dist/src/components/user-password-history/user-password-history.js +41 -2
- package/dist/src/components/user-password-history/user-password-history.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +0 -2
- package/package.json +2 -2
- package/src/components/login-user/user.ts +78 -0
- package/src/components/user-password-history/user-password-history.ts +57 -6
- package/__tests__/unit/components/api-key/api-key.spec.ts +0 -201
- package/__tests__/unit/components/user-password-history/user-password-history.spec.ts +0 -165
- package/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.ts +0 -233
- package/coverage/cobertura-coverage.xml +0 -6837
- package/coverage/test-report.xml +0 -161
- package/dist/__tests__/unit/components/api-key/api-key.spec.js +0 -158
- package/dist/__tests__/unit/components/api-key/api-key.spec.js.map +0 -1
- package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.d.ts +0 -1
- package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.js +0 -138
- package/dist/__tests__/unit/components/user-password-history/user-password-history.spec.js.map +0 -1
- package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.d.ts +0 -1
- package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.js +0 -182
- package/dist/__tests__/unit/components/user-reporting-hierarchy/user-reporting-hierarchy.spec.js.map +0 -1
- package/migrations/20250805085707-add-bulk-approval-code-to-sso-user.js +0 -29
- /package/dist/__tests__/unit/components/{api-key/api-key.spec.d.ts → login-user/password-expiry.spec.d.ts} +0 -0
package/.gitlab-ci.yml
CHANGED
|
@@ -1,83 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# Project path: all-tomei-projects/tomei-package/General/<package-name>
|
|
5
|
-
#
|
|
6
|
-
# Tag patterns:
|
|
7
|
-
# test-vX.Y.Z-rc.N → npm publish --tag test (RC for test env)
|
|
8
|
-
# staging-vX.Y.Z-rc.N → npm publish --tag staging (RC for staging env)
|
|
9
|
-
# prod-vX.Y.Z → npm publish --tag latest (production, manual gate)
|
|
10
|
-
# prod-vX.Y.Z-hotfix.N → npm publish --tag latest (hotfix, manual gate)
|
|
11
|
-
#
|
|
12
|
-
# No NPM_TOKEN secret needed — OIDC trusted publishing only.
|
|
13
|
-
#
|
|
14
|
-
# Required CI/CD variables (Settings → CI/CD → Variables):
|
|
15
|
-
# DISCORD_WEBHOOK — Discord incoming webhook URL (masked)
|
|
16
|
-
#
|
|
17
|
-
# npm side setup required (npmjs.com):
|
|
18
|
-
# 1. package.json → publishConfig.provenance: true
|
|
19
|
-
# 2. npmjs.com → package Settings → Publishing Access
|
|
20
|
-
# → Enable OIDC publishing for GitLab project:
|
|
21
|
-
# all-tomei-projects/tomei-package/General/<package-name>
|
|
22
|
-
# ============================================================
|
|
23
|
-
default:
|
|
24
|
-
image: node:20-alpine
|
|
25
|
-
tags:
|
|
26
|
-
- shared
|
|
1
|
+
variables:
|
|
2
|
+
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
3
|
+
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
27
4
|
|
|
28
5
|
stages:
|
|
29
|
-
- validate
|
|
30
6
|
- build
|
|
31
7
|
- publish
|
|
32
|
-
- notify
|
|
33
8
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
lint:
|
|
40
|
-
stage: validate
|
|
9
|
+
sonarcloud-check:
|
|
10
|
+
stage: build
|
|
11
|
+
image:
|
|
12
|
+
name: sonarsource/sonar-scanner-cli:latest
|
|
13
|
+
entrypoint: [""]
|
|
41
14
|
cache:
|
|
42
|
-
key:
|
|
43
|
-
paths:
|
|
15
|
+
key: "${CI_JOB_NAME}"
|
|
16
|
+
paths:
|
|
17
|
+
- .sonar/cache
|
|
44
18
|
script:
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
19
|
+
- sonar-scanner
|
|
20
|
+
only:
|
|
21
|
+
- merge_requests
|
|
22
|
+
- main
|
|
50
23
|
|
|
51
|
-
|
|
52
|
-
stage: validate
|
|
53
|
-
cache:
|
|
54
|
-
key: node-$CI_COMMIT_REF_SLUG
|
|
55
|
-
paths: [node_modules/]
|
|
56
|
-
script:
|
|
57
|
-
- npm ci
|
|
58
|
-
- npm test
|
|
59
|
-
coverage: '/Lines\s*:\s*(\d+\.?\d*)%/'
|
|
60
|
-
artifacts:
|
|
61
|
-
reports:
|
|
62
|
-
coverage_report:
|
|
63
|
-
coverage_format: cobertura
|
|
64
|
-
path: coverage/cobertura-coverage.xml
|
|
65
|
-
expire_in: 7 days
|
|
66
|
-
rules:
|
|
67
|
-
- if: '$CI_COMMIT_TAG =~ /^test-v/'
|
|
68
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
69
|
-
|
|
70
|
-
# ────────────────────────────────────────────────────────────
|
|
71
|
-
# STAGE: build
|
|
72
|
-
# Compiles the package (tsc / rollup / whatever your build uses)
|
|
73
|
-
# Artifacts passed to publish jobs
|
|
74
|
-
# Runs on all tag patterns
|
|
75
|
-
# ────────────────────────────────────────────────────────────
|
|
76
|
-
build:
|
|
24
|
+
package-build:
|
|
77
25
|
stage: build
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
26
|
+
image: node:20-alpine
|
|
27
|
+
tags:
|
|
28
|
+
- shared
|
|
81
29
|
script:
|
|
82
30
|
- npm ci
|
|
83
31
|
- npm run build
|
|
@@ -86,152 +34,23 @@ build:
|
|
|
86
34
|
- dist/
|
|
87
35
|
expire_in: 1 hour
|
|
88
36
|
rules:
|
|
89
|
-
- if: '$CI_COMMIT_TAG =~ /^
|
|
90
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
91
|
-
- if: '$CI_COMMIT_TAG =~ /^prod-v/'
|
|
92
|
-
|
|
93
|
-
# ────────────────────────────────────────────────────────────
|
|
94
|
-
# STAGE: publish — test RC
|
|
95
|
-
# Triggered by: test-vX.Y.Z-rc.N tag
|
|
96
|
-
# Publishes with dist-tag "test"
|
|
97
|
-
# Consumers must opt in: npm install @tomei/pkg@test
|
|
98
|
-
# Version stamped: test-v1.24.0-rc.1 → 1.24.0-rc.1
|
|
99
|
-
# ────────────────────────────────────────────────────────────
|
|
100
|
-
publish-test:
|
|
101
|
-
stage: publish
|
|
102
|
-
needs: [build]
|
|
103
|
-
rules:
|
|
104
|
-
- if: '$CI_COMMIT_TAG =~ /^test-v/'
|
|
105
|
-
script:
|
|
106
|
-
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
107
|
-
- cat ~/.npmrc # verify .npmrc content
|
|
108
|
-
- |
|
|
109
|
-
RC_VERSION=$(echo "$CI_COMMIT_TAG" | sed 's/^test-v\([0-9.]*\)-rc\.\([0-9]*\)$/\1-test.\2/')
|
|
110
|
-
echo "Publishing version $RC_VERSION with dist-tag: test"
|
|
111
|
-
npm version "$RC_VERSION" --no-git-tag-version --ignore-scripts --force
|
|
112
|
-
npm publish --tag test --access public
|
|
113
|
-
echo "Published: @$(node -p "require('./package.json').name")@$RC_VERSION [test]"
|
|
114
|
-
|
|
115
|
-
# ────────────────────────────────────────────────────────────
|
|
116
|
-
# STAGE: publish — staging RC
|
|
117
|
-
# Triggered by: staging-vX.Y.Z-rc.N tag
|
|
118
|
-
# Publishes with dist-tag "staging"
|
|
119
|
-
# Consumers must opt in: npm install @tomei/pkg@staging
|
|
120
|
-
# Version stamped: staging-v1.24.0-rc.1 → 1.24.0-rc.1
|
|
121
|
-
# ────────────────────────────────────────────────────────────
|
|
122
|
-
publish-staging:
|
|
123
|
-
stage: publish
|
|
124
|
-
needs: [build]
|
|
125
|
-
rules:
|
|
126
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
127
|
-
script:
|
|
128
|
-
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
129
|
-
- |
|
|
130
|
-
RC_VERSION=$(echo "$CI_COMMIT_TAG" | sed 's/^staging-v\([0-9.]*\)-rc\.\([0-9]*\)$/\1-staging.\2/')
|
|
131
|
-
echo "Publishing version $RC_VERSION with dist-tag: staging"
|
|
132
|
-
npm version "$RC_VERSION" --no-git-tag-version --ignore-scripts --force
|
|
133
|
-
npm publish --tag staging --access public
|
|
134
|
-
echo "Published: @$(node -p "require('./package.json').name")@$RC_VERSION [staging]"
|
|
37
|
+
- if: '$CI_COMMIT_TAG =~ /^prod-v[0-9]+\.[0-9]+\.[0-9]+(-retry\.[0-9]+)?$/'
|
|
135
38
|
|
|
136
|
-
|
|
137
|
-
# STAGE: publish — production
|
|
138
|
-
# Triggered by: prod-vX.Y.Z or prod-vX.Y.Z-hotfix.N tag (from main only)
|
|
139
|
-
# Publishes with dist-tag "latest" — becomes the default install version
|
|
140
|
-
# Manual gate — human must click Play in GitLab pipeline UI
|
|
141
|
-
# Version stamped: prod-v2.2.0 → 2.2.0 | prod-v2.2.0-hotfix.1 → 2.2.0-hotfix.1
|
|
142
|
-
# ────────────────────────────────────────────────────────────
|
|
143
|
-
publish-prod:
|
|
39
|
+
package-publish:
|
|
144
40
|
stage: publish
|
|
145
|
-
|
|
41
|
+
image: node:20-alpine
|
|
42
|
+
tags:
|
|
43
|
+
- shared
|
|
44
|
+
needs:
|
|
45
|
+
- job: package-build
|
|
46
|
+
artifacts: true
|
|
146
47
|
rules:
|
|
147
|
-
- if: '$CI_COMMIT_TAG =~ /^prod-v
|
|
48
|
+
- if: '$CI_COMMIT_TAG =~ /^prod-v[0-9]+\.[0-9]+\.[0-9]+(-retry\.[0-9]+)?$/'
|
|
148
49
|
when: manual
|
|
149
50
|
allow_failure: false
|
|
150
51
|
script:
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
npm publish --tag latest --access public
|
|
157
|
-
echo "Published: @$(node -p "require('./package.json').name")@$PROD_VERSION [latest]"
|
|
158
|
-
echo "Pipeline: $CI_PIPELINE_URL"
|
|
159
|
-
|
|
160
|
-
# ────────────────────────────────────────────────────────────
|
|
161
|
-
# STAGE: notify — success
|
|
162
|
-
# ────────────────────────────────────────────────────────────
|
|
163
|
-
notify-success:
|
|
164
|
-
stage: notify
|
|
165
|
-
image: curlimages/curl:latest
|
|
166
|
-
needs:
|
|
167
|
-
- job: publish-test
|
|
168
|
-
optional: true
|
|
169
|
-
- job: publish-staging
|
|
170
|
-
optional: true
|
|
171
|
-
- job: publish-prod
|
|
172
|
-
optional: true
|
|
173
|
-
rules:
|
|
174
|
-
- if: '$CI_COMMIT_TAG =~ /^test-v/'
|
|
175
|
-
when: on_success
|
|
176
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
177
|
-
when: on_success
|
|
178
|
-
- if: '$CI_COMMIT_TAG =~ /^prod-v/'
|
|
179
|
-
when: on_success
|
|
180
|
-
script:
|
|
181
|
-
- |
|
|
182
|
-
if echo "$CI_COMMIT_TAG" | grep -q "^test-v"; then
|
|
183
|
-
DIST_TAG="test"
|
|
184
|
-
COLOR=3066993
|
|
185
|
-
elif echo "$CI_COMMIT_TAG" | grep -q "^staging-v"; then
|
|
186
|
-
DIST_TAG="staging"
|
|
187
|
-
COLOR=16776960
|
|
188
|
-
elif echo "$CI_COMMIT_TAG" | grep -q "^prod-v"; then
|
|
189
|
-
DIST_TAG="latest"
|
|
190
|
-
COLOR=3066993
|
|
191
|
-
fi
|
|
192
|
-
|
|
193
|
-
curl -s -X POST "$DISCORD_WEBHOOK" \
|
|
194
|
-
-H "Content-Type: application/json" \
|
|
195
|
-
-d '{
|
|
196
|
-
"embeds": [{
|
|
197
|
-
"title": "Package published successfully",
|
|
198
|
-
"color": '"$COLOR"',
|
|
199
|
-
"fields": [
|
|
200
|
-
{"name": "Package", "value": "'"$CI_PROJECT_NAME"'", "inline": true},
|
|
201
|
-
{"name": "Tag", "value": "'"$CI_COMMIT_TAG"'", "inline": true},
|
|
202
|
-
{"name": "Dist-tag", "value": "'"$DIST_TAG"'", "inline": true},
|
|
203
|
-
{"name": "Published by", "value": "'"$GITLAB_USER_NAME"'", "inline": true},
|
|
204
|
-
{"name": "Pipeline", "value": "'"$CI_PIPELINE_URL"'", "inline": false}
|
|
205
|
-
]
|
|
206
|
-
}]
|
|
207
|
-
}'
|
|
208
|
-
|
|
209
|
-
# ────────────────────────────────────────────────────────────
|
|
210
|
-
# STAGE: notify — failure
|
|
211
|
-
# ────────────────────────────────────────────────────────────
|
|
212
|
-
notify-failure:
|
|
213
|
-
stage: notify
|
|
214
|
-
image: curlimages/curl:latest
|
|
215
|
-
rules:
|
|
216
|
-
- if: '$CI_COMMIT_TAG =~ /^test-v/'
|
|
217
|
-
when: on_failure
|
|
218
|
-
- if: '$CI_COMMIT_TAG =~ /^staging-v/'
|
|
219
|
-
when: on_failure
|
|
220
|
-
- if: '$CI_COMMIT_TAG =~ /^prod-v/'
|
|
221
|
-
when: on_failure
|
|
222
|
-
script:
|
|
223
|
-
- |
|
|
224
|
-
curl -s -X POST "$DISCORD_WEBHOOK" \
|
|
225
|
-
-H "Content-Type: application/json" \
|
|
226
|
-
-d '{
|
|
227
|
-
"embeds": [{
|
|
228
|
-
"title": "Package publish FAILED",
|
|
229
|
-
"color": 15158332,
|
|
230
|
-
"fields": [
|
|
231
|
-
{"name": "Package", "value": "'"$CI_PROJECT_NAME"'", "inline": true},
|
|
232
|
-
{"name": "Tag", "value": "'"$CI_COMMIT_TAG"'", "inline": true},
|
|
233
|
-
{"name": "Failed by", "value": "'"$GITLAB_USER_NAME"'", "inline": true},
|
|
234
|
-
{"name": "Pipeline", "value": "'"$CI_PIPELINE_URL"'", "inline": false}
|
|
235
|
-
]
|
|
236
|
-
}]
|
|
237
|
-
}'
|
|
52
|
+
- npm ci
|
|
53
|
+
- test -n "$NPM_TOKEN"
|
|
54
|
+
- printf '%s\n' "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
55
|
+
- npm whoami --registry https://registry.npmjs.org/
|
|
56
|
+
- npm publish --tag latest --access public
|
|
@@ -2,15 +2,9 @@ import { Group } from '../../../../src/components/group/group';
|
|
|
2
2
|
import { GroupRepository } from '../../../../src/components/group/group.repository';
|
|
3
3
|
import { ClassError } from '@tomei/general';
|
|
4
4
|
import { GroupTypeEnum } from '../../../../src/enum/group-type.enum';
|
|
5
|
-
import { RedisService } from '../../../../src/redis-client/redis.service';
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
describe('Group', () => {
|
|
9
|
-
beforeAll(() => {
|
|
10
|
-
process.env.REDIS_HOST = 'localhost';
|
|
11
|
-
process.env.REDIS_PORT = '6379';
|
|
12
|
-
});
|
|
13
|
-
|
|
14
8
|
afterEach(() => {
|
|
15
9
|
jest.clearAllMocks();
|
|
16
10
|
});
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
// Break circular dependency: group-reporting-user → user → login-user → user
|
|
2
|
-
jest.mock('../../../../src/components/login-user/login-user', () => ({
|
|
3
|
-
LoginUser: class MockLoginUser {},
|
|
4
|
-
}));
|
|
5
|
-
jest.mock('../../../../src/components/login-user/user', () => ({
|
|
6
|
-
User: class MockUser {},
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
1
|
import { GroupReportingUser } from '../../../../src/components/group-reporting-user/group-reporting-user';
|
|
10
2
|
import { GroupReportingUserRepository } from '../../../../src/components/group-reporting-user/group-reporting-user.repository';
|
|
11
3
|
import { ClassError } from '@tomei/general';
|
|
@@ -69,7 +61,7 @@ describe('GroupReportingUser', () => {
|
|
|
69
61
|
|
|
70
62
|
await expect(
|
|
71
63
|
GroupReportingUser.init(mockDbTransaction, '1')
|
|
72
|
-
).rejects.toThrow(
|
|
64
|
+
).rejects.toThrow(ClassError);
|
|
73
65
|
});
|
|
74
66
|
});
|
|
75
67
|
});
|