@verdaccio/core 6.0.0-6-next.47 → 6.0.0-6-next.49
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/CHANGELOG.md +12 -0
- package/build/constants.d.ts +2 -1
- package/build/constants.js +4 -3
- package/build/constants.js.map +1 -1
- package/build/error-utils.d.ts +1 -1
- package/build/error-utils.js +1 -1
- package/build/error-utils.js.map +1 -1
- package/build/index.d.ts +3 -2
- package/build/index.js +7 -3
- package/build/index.js.map +1 -1
- package/build/plugin-utils.d.ts +126 -10
- package/build/plugin-utils.js +23 -0
- package/build/plugin-utils.js.map +1 -1
- package/build/stream-utils.d.ts +3 -37
- package/build/stream-utils.js +1 -79
- package/build/stream-utils.js.map +1 -1
- package/build/string-utils.d.ts +8 -0
- package/build/string-utils.js +44 -0
- package/build/string-utils.js.map +1 -0
- package/build/validation-utils.d.ts +1 -0
- package/build/validation-utils.js +5 -0
- package/build/validation-utils.js.map +1 -1
- package/build/warning-utils.d.ts +1 -1
- package/build/warning-utils.js.map +1 -1
- package/package.json +6 -3
- package/src/constants.ts +2 -1
- package/src/error-utils.ts +2 -4
- package/src/index.ts +3 -1
- package/src/plugin-utils.ts +159 -9
- package/src/stream-utils.ts +3 -84
- package/src/string-utils.ts +36 -0
- package/src/validation-utils.ts +10 -1
- package/src/warning-utils.ts +1 -1
- package/test/mystreams.spec.ts +1 -27
- package/test/string-utils.spec.ts +40 -0
- package/test/validation-utilts.spec.ts +52 -1
- package/tsconfig.build.json +2 -1
- package/tsconfig.json +2 -1
- package/typedoc.json +5 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { DIST_TAGS } from '../src/constants';
|
|
1
|
+
import { DEFAULT_PASSWORD_VALIDATION, DIST_TAGS } from '../src/constants';
|
|
2
2
|
import { validatePublishSingleVersion } from '../src/schemes/publish-manifest';
|
|
3
3
|
import {
|
|
4
4
|
isObject,
|
|
5
5
|
normalizeMetadata,
|
|
6
6
|
validateName,
|
|
7
7
|
validatePackage,
|
|
8
|
+
validatePassword,
|
|
8
9
|
} from '../src/validation-utils';
|
|
9
10
|
|
|
10
11
|
describe('validatePackage', () => {
|
|
@@ -166,3 +167,53 @@ describe('validatePublishSingleVersion', () => {
|
|
|
166
167
|
).toBeFalsy();
|
|
167
168
|
});
|
|
168
169
|
});
|
|
170
|
+
|
|
171
|
+
describe('validatePassword', () => {
|
|
172
|
+
test('should validate password according the length', () => {
|
|
173
|
+
expect(validatePassword('12345', DEFAULT_PASSWORD_VALIDATION)).toBeTruthy();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('should validate invalid regex', () => {
|
|
177
|
+
// @ts-expect-error
|
|
178
|
+
expect(validatePassword('12345', 34234342)).toBeFalsy();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('should validate invalid regex (undefined)', () => {
|
|
182
|
+
expect(validatePassword('12345', undefined)).toBeTruthy();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test('should validate invalid password)', () => {
|
|
186
|
+
// @ts-expect-error
|
|
187
|
+
expect(validatePassword(undefined)).toBeFalsy();
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test('should validate invalid password number)', () => {
|
|
191
|
+
// @ts-expect-error
|
|
192
|
+
expect(validatePassword(2342344234342)).toBeFalsy();
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('should fails on validate password according the length', () => {
|
|
196
|
+
expect(validatePassword('12345', /.{10}$/)).toBeFalsy();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('should fails handle complex password validation', () => {
|
|
200
|
+
expect(validatePassword('12345', /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/)).toBeFalsy();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('should handle complex password validation', () => {
|
|
204
|
+
expect(
|
|
205
|
+
validatePassword(
|
|
206
|
+
'c<?_:srdsj&WyZgY}r4:l[F<RgV<}',
|
|
207
|
+
/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/
|
|
208
|
+
)
|
|
209
|
+
).toBeTruthy();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test('should fails on validate password according the length and default config', () => {
|
|
213
|
+
expect(validatePassword('12')).toBeFalsy();
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test('should validate password according the length and default config', () => {
|
|
217
|
+
expect(validatePassword('1235678910')).toBeTruthy();
|
|
218
|
+
});
|
|
219
|
+
});
|
package/tsconfig.build.json
CHANGED
package/tsconfig.json
CHANGED