@logto/core-kit 1.0.0-rc.0 → 1.0.0

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/LICENSE CHANGED
@@ -1,3 +1,9 @@
1
+ Portions of this software are licensed as follows:
2
+
3
+ * All content that resides under the "packages/cloud" directory of this repository, if that directory exists, is licensed under the license defined in "packages/cloud/LICENSE" (Elastic-2.0).
4
+ * All third party components incorporated into this software are licensed under the original license provided by the owner of the applicable component.
5
+ * Content outside of the above mentioned directories or restrictions above is available under the "MPL-2.0" license as defined below.
6
+
1
7
  Mozilla Public License Version 2.0
2
8
  ==================================
3
9
 
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './utilities/index.js';
1
+ export * from './utils/index.js';
2
2
  export * from './regex.js';
3
3
  export * from './scope.js';
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from './utilities/index.js';
1
+ export * from './utils/index.js';
2
2
  export * from './regex.js';
3
3
  export * from './scope.js';
package/lib/regex.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export declare const emailRegEx: RegExp;
2
2
  export declare const phoneRegEx: RegExp;
3
+ export declare const phoneInputRegEx: RegExp;
3
4
  export declare const usernameRegEx: RegExp;
4
- export declare const passwordRegEx: RegExp;
5
5
  export declare const webRedirectUriProtocolRegEx: RegExp;
6
6
  export declare const mobileUriSchemeProtocolRegEx: RegExp;
7
7
  export declare const hexColorRegEx: RegExp;
8
8
  export declare const dateRegex: RegExp;
9
9
  export declare const noSpaceRegEx: RegExp;
10
+ export declare const passwordRegEx: RegExp;
package/lib/regex.js CHANGED
@@ -1,9 +1,14 @@
1
1
  export const emailRegEx = /^\S+@\S+\.\S+$/;
2
2
  export const phoneRegEx = /^\d+$/;
3
+ export const phoneInputRegEx = /^\+?[\d-( )]+$/;
3
4
  export const usernameRegEx = /^[A-Z_a-z]\w*$/;
4
- export const passwordRegEx = /^.{6,}$/;
5
5
  export const webRedirectUriProtocolRegEx = /^https?:$/;
6
6
  export const mobileUriSchemeProtocolRegEx = /^[a-z][\d_a-z]*(\.[\d_a-z]+)+:$/;
7
7
  export const hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
8
8
  export const dateRegex = /^\d{4}(-\d{2}){2}/;
9
9
  export const noSpaceRegEx = /^\S+$/;
10
+ const atLeastOneDigitAndOneLetters = /(?=.*\d)(?=.*[A-Za-z])/;
11
+ const atLeastOneDigitAndOneSpecialChar = /(?=.*\d)(?=.*[!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/;
12
+ const atLeastOneLetterAndOneSpecialChar = /(?=.*[A-Za-z])(?=.*[!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/;
13
+ const allowedChars = /[\w!"#$%&'()*+,./:;<=>?@[\]^`{|}~-]{8,}/;
14
+ export const passwordRegEx = new RegExp(`^(${atLeastOneDigitAndOneLetters.source}|${atLeastOneDigitAndOneSpecialChar.source}|${atLeastOneLetterAndOneSpecialChar.source})${allowedChars.source}$`);
@@ -1,4 +1,3 @@
1
1
  export * from './color.js';
2
2
  export * from './id.js';
3
- export * from './zod.js';
4
3
  export * from './url.js';
@@ -1,4 +1,3 @@
1
1
  export * from './color.js';
2
2
  export * from './id.js';
3
- export * from './zod.js';
4
3
  export * from './url.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/core-kit",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "homepage": "https://github.com/logto-io/toolkit#readme",
6
6
  "repository": {
@@ -27,28 +27,27 @@
27
27
  "dependencies": {
28
28
  "color": "^4.2.3",
29
29
  "nanoid": "^4.0.0",
30
- "@logto/language-kit": "1.0.0-rc.0"
30
+ "@logto/language-kit": "1.0.0"
31
31
  },
32
32
  "optionalDependencies": {
33
33
  "zod": "^3.20.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@jest/types": "^29.0.3",
37
- "@silverhand/eslint-config": "1.3.0",
38
- "@silverhand/eslint-config-react": "1.3.0",
39
- "@silverhand/essentials": "2.1.0",
40
- "@silverhand/ts-config": "1.2.1",
37
+ "@silverhand/eslint-config": "2.0.1",
38
+ "@silverhand/eslint-config-react": "2.0.1",
39
+ "@silverhand/essentials": "^2.5.0",
40
+ "@silverhand/ts-config": "2.0.3",
41
41
  "@types/color": "^3.0.3",
42
- "@types/jest": "^29.0.3",
42
+ "@types/jest": "^29.4.0",
43
43
  "@types/node": "^18.11.18",
44
44
  "@types/react": "^18.0.20",
45
- "eslint": "^8.21.0",
46
- "jest": "^29.0.3",
47
- "jest-matcher-specific-error": "^1.0.0",
45
+ "eslint": "^8.34.0",
46
+ "jest": "^29.5.0",
48
47
  "lint-staged": "^13.0.0",
49
48
  "postcss": "^8.4.6",
50
- "prettier": "^2.8.1",
51
- "stylelint": "^14.9.1",
49
+ "prettier": "^2.8.2",
50
+ "stylelint": "^15.0.0",
52
51
  "tslib": "^2.4.1",
53
52
  "typescript": "^4.9.4"
54
53
  },
@@ -108,6 +108,7 @@
108
108
  --color-on-error: var(--color-all-100);
109
109
  --color-error-container: var(--color-error-90);
110
110
  --color-on-error-container: var(--color-error-10);
111
+ --color-alert-container: var(--color-alert-99);
111
112
  --color-background: var(--color-neutral-99);
112
113
  --color-on-background: var(--color-neutral-10);
113
114
  --color-surface: var(--color-neutral-99);
@@ -280,6 +281,7 @@
280
281
  --color-on-error: var(--color-all-0);
281
282
  --color-error-container: var(--color-error-90);
282
283
  --color-on-error-container: var(--color-error-30);
284
+ --color-alert-container: var(--color-alert-90);
283
285
  --color-background: var(--color-neutral-99);
284
286
  --color-on-background: var(--color-neutral-10);
285
287
  --color-surface: var(--color-neutral-99);
@@ -1,11 +0,0 @@
1
- /**
2
- * https://github.com/colinhacks/zod/issues/316#issuecomment-850906479
3
- * Create a schema matches anything and returns a value. Use it with `or`:
4
- *
5
- * const schema = zod.number();
6
- * const tolerant = schema.or(fallback(-1));
7
- *
8
- * schema.parse('foo') // => ZodError
9
- * tolerant.parse('foo') // -1
10
- */
11
- export declare function fallback<T>(value: T): import("zod").ZodEffects<import("zod").ZodAny, T, any>;
@@ -1,14 +0,0 @@
1
- import { any } from 'zod';
2
- /**
3
- * https://github.com/colinhacks/zod/issues/316#issuecomment-850906479
4
- * Create a schema matches anything and returns a value. Use it with `or`:
5
- *
6
- * const schema = zod.number();
7
- * const tolerant = schema.or(fallback(-1));
8
- *
9
- * schema.parse('foo') // => ZodError
10
- * tolerant.parse('foo') // -1
11
- */
12
- export function fallback(value) {
13
- return any().transform(() => value);
14
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes