@nocobase/plugin-auth 0.17.0-alpha.7 → 0.18.0-alpha.2

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.
Files changed (63) hide show
  1. package/dist/client/authenticator.d.ts +13 -0
  2. package/dist/client/basic/SignInForm.d.ts +9 -0
  3. package/dist/client/basic/SignUpForm.d.ts +13 -0
  4. package/dist/client/basic/index.d.ts +3 -0
  5. package/dist/client/index.d.ts +21 -0
  6. package/dist/client/index.js +12 -2
  7. package/dist/client/pages/AuthLayout.d.ts +2 -0
  8. package/dist/client/pages/SignInPage.d.ts +16 -0
  9. package/dist/client/pages/SignUpPage.d.ts +21 -0
  10. package/dist/client/pages/index.d.ts +3 -0
  11. package/dist/client/settings/Options.d.ts +3 -2
  12. package/dist/externalVersion.js +14 -12
  13. package/dist/locale/en-US.json +4 -1
  14. package/dist/locale/zh-CN.json +4 -1
  15. package/dist/node_modules/cron/LICENSE +0 -0
  16. package/dist/node_modules/cron/lib/cron.js +1 -1
  17. package/dist/node_modules/cron/lib/job.js +0 -0
  18. package/dist/node_modules/cron/lib/time.js +33 -20
  19. package/dist/node_modules/cron/node_modules/luxon/build/amd/luxon.js +7826 -0
  20. package/dist/node_modules/cron/node_modules/luxon/build/cjs-browser/luxon.js +7824 -0
  21. package/dist/node_modules/cron/node_modules/luxon/build/es6/luxon.js +7217 -0
  22. package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.js +7829 -0
  23. package/dist/node_modules/cron/node_modules/luxon/build/global/luxon.min.js +1 -0
  24. package/dist/node_modules/cron/node_modules/luxon/build/node/luxon.js +6932 -0
  25. package/dist/node_modules/cron/node_modules/luxon/package.json +85 -0
  26. package/dist/node_modules/cron/node_modules/luxon/src/datetime.js +2248 -0
  27. package/dist/node_modules/cron/node_modules/luxon/src/duration.js +948 -0
  28. package/dist/node_modules/cron/node_modules/luxon/src/errors.js +61 -0
  29. package/dist/node_modules/cron/node_modules/luxon/src/impl/conversions.js +161 -0
  30. package/dist/node_modules/cron/node_modules/luxon/src/impl/diff.js +75 -0
  31. package/dist/node_modules/cron/node_modules/luxon/src/impl/digits.js +75 -0
  32. package/dist/node_modules/cron/node_modules/luxon/src/impl/english.js +233 -0
  33. package/dist/node_modules/cron/node_modules/luxon/src/impl/formats.js +176 -0
  34. package/dist/node_modules/cron/node_modules/luxon/src/impl/formatter.js +400 -0
  35. package/dist/node_modules/cron/node_modules/luxon/src/impl/invalid.js +14 -0
  36. package/dist/node_modules/cron/node_modules/luxon/src/impl/locale.js +494 -0
  37. package/dist/node_modules/cron/node_modules/luxon/src/impl/regexParser.js +335 -0
  38. package/dist/node_modules/cron/node_modules/luxon/src/impl/tokenParser.js +444 -0
  39. package/dist/node_modules/cron/node_modules/luxon/src/impl/util.js +274 -0
  40. package/dist/node_modules/cron/node_modules/luxon/src/impl/zoneUtil.js +34 -0
  41. package/dist/node_modules/cron/node_modules/luxon/src/info.js +169 -0
  42. package/dist/node_modules/cron/node_modules/luxon/src/interval.js +637 -0
  43. package/dist/node_modules/cron/node_modules/luxon/src/luxon.js +26 -0
  44. package/dist/node_modules/cron/node_modules/luxon/src/package.json +4 -0
  45. package/dist/node_modules/cron/node_modules/luxon/src/settings.js +148 -0
  46. package/dist/node_modules/cron/node_modules/luxon/src/zone.js +91 -0
  47. package/dist/node_modules/cron/node_modules/luxon/src/zones/IANAZone.js +189 -0
  48. package/dist/node_modules/cron/node_modules/luxon/src/zones/fixedOffsetZone.js +102 -0
  49. package/dist/node_modules/cron/node_modules/luxon/src/zones/invalidZone.js +53 -0
  50. package/dist/node_modules/cron/node_modules/luxon/src/zones/systemZone.js +61 -0
  51. package/dist/node_modules/cron/package.json +1 -1
  52. package/dist/node_modules/cron/types/index.d.ts +181 -0
  53. package/dist/node_modules/cron/types/index.test-d.ts +85 -0
  54. package/dist/server/actions/authenticators.js +3 -0
  55. package/dist/server/basic-auth.js +5 -2
  56. package/dist/server/migrations/20231218132032-fix-allow-signup.d.ts +5 -0
  57. package/dist/server/migrations/20231218132032-fix-allow-signup.js +54 -0
  58. package/dist/server/model/authenticator.d.ts +5 -2
  59. package/dist/server/model/authenticator.js +2 -2
  60. package/package.json +2 -2
  61. package/dist/client/AuthPluginProvider.d.ts +0 -2
  62. package/dist/client/basic/SigninPage.d.ts +0 -6
  63. package/dist/client/basic/SignupPage.d.ts +0 -5
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @private
3
+ */
4
+
5
+ import Zone from "../zone.js";
6
+ import IANAZone from "../zones/IANAZone.js";
7
+ import FixedOffsetZone from "../zones/fixedOffsetZone.js";
8
+ import InvalidZone from "../zones/invalidZone.js";
9
+
10
+ import { isUndefined, isString, isNumber } from "./util.js";
11
+ import SystemZone from "../zones/systemZone.js";
12
+
13
+ export function normalizeZone(input, defaultZone) {
14
+ let offset;
15
+ if (isUndefined(input) || input === null) {
16
+ return defaultZone;
17
+ } else if (input instanceof Zone) {
18
+ return input;
19
+ } else if (isString(input)) {
20
+ const lowered = input.toLowerCase();
21
+ if (lowered === "default") return defaultZone;
22
+ else if (lowered === "local" || lowered === "system") return SystemZone.instance;
23
+ else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;
24
+ else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
25
+ } else if (isNumber(input)) {
26
+ return FixedOffsetZone.instance(input);
27
+ } else if (typeof input === "object" && input.offset && typeof input.offset === "number") {
28
+ // This is dumb, but the instanceof check above doesn't seem to really work
29
+ // so we're duck checking it
30
+ return input;
31
+ } else {
32
+ return new InvalidZone(input);
33
+ }
34
+ }
@@ -0,0 +1,169 @@
1
+ import DateTime from "./datetime.js";
2
+ import Settings from "./settings.js";
3
+ import Locale from "./impl/locale.js";
4
+ import IANAZone from "./zones/IANAZone.js";
5
+ import { normalizeZone } from "./impl/zoneUtil.js";
6
+
7
+ import { hasRelative } from "./impl/util.js";
8
+
9
+ /**
10
+ * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.
11
+ */
12
+ export default class Info {
13
+ /**
14
+ * Return whether the specified zone contains a DST.
15
+ * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone.
16
+ * @return {boolean}
17
+ */
18
+ static hasDST(zone = Settings.defaultZone) {
19
+ const proto = DateTime.now().setZone(zone).set({ month: 12 });
20
+
21
+ return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;
22
+ }
23
+
24
+ /**
25
+ * Return whether the specified zone is a valid IANA specifier.
26
+ * @param {string} zone - Zone to check
27
+ * @return {boolean}
28
+ */
29
+ static isValidIANAZone(zone) {
30
+ return IANAZone.isValidZone(zone);
31
+ }
32
+
33
+ /**
34
+ * Converts the input into a {@link Zone} instance.
35
+ *
36
+ * * If `input` is already a Zone instance, it is returned unchanged.
37
+ * * If `input` is a string containing a valid time zone name, a Zone instance
38
+ * with that name is returned.
39
+ * * If `input` is a string that doesn't refer to a known time zone, a Zone
40
+ * instance with {@link Zone#isValid} == false is returned.
41
+ * * If `input is a number, a Zone instance with the specified fixed offset
42
+ * in minutes is returned.
43
+ * * If `input` is `null` or `undefined`, the default zone is returned.
44
+ * @param {string|Zone|number} [input] - the value to be converted
45
+ * @return {Zone}
46
+ */
47
+ static normalizeZone(input) {
48
+ return normalizeZone(input, Settings.defaultZone);
49
+ }
50
+
51
+ /**
52
+ * Return an array of standalone month names.
53
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
54
+ * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
55
+ * @param {Object} opts - options
56
+ * @param {string} [opts.locale] - the locale code
57
+ * @param {string} [opts.numberingSystem=null] - the numbering system
58
+ * @param {string} [opts.locObj=null] - an existing locale object to use
59
+ * @param {string} [opts.outputCalendar='gregory'] - the calendar
60
+ * @example Info.months()[0] //=> 'January'
61
+ * @example Info.months('short')[0] //=> 'Jan'
62
+ * @example Info.months('numeric')[0] //=> '1'
63
+ * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.'
64
+ * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١'
65
+ * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
66
+ * @return {Array}
67
+ */
68
+ static months(
69
+ length = "long",
70
+ { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}
71
+ ) {
72
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
73
+ }
74
+
75
+ /**
76
+ * Return an array of format month names.
77
+ * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that
78
+ * changes the string.
79
+ * See {@link Info#months}
80
+ * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long"
81
+ * @param {Object} opts - options
82
+ * @param {string} [opts.locale] - the locale code
83
+ * @param {string} [opts.numberingSystem=null] - the numbering system
84
+ * @param {string} [opts.locObj=null] - an existing locale object to use
85
+ * @param {string} [opts.outputCalendar='gregory'] - the calendar
86
+ * @return {Array}
87
+ */
88
+ static monthsFormat(
89
+ length = "long",
90
+ { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}
91
+ ) {
92
+ return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
93
+ }
94
+
95
+ /**
96
+ * Return an array of standalone week names.
97
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
98
+ * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long".
99
+ * @param {Object} opts - options
100
+ * @param {string} [opts.locale] - the locale code
101
+ * @param {string} [opts.numberingSystem=null] - the numbering system
102
+ * @param {string} [opts.locObj=null] - an existing locale object to use
103
+ * @example Info.weekdays()[0] //=> 'Monday'
104
+ * @example Info.weekdays('short')[0] //=> 'Mon'
105
+ * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.'
106
+ * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
107
+ * @return {Array}
108
+ */
109
+ static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
110
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
111
+ }
112
+
113
+ /**
114
+ * Return an array of format week names.
115
+ * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that
116
+ * changes the string.
117
+ * See {@link Info#weekdays}
118
+ * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long".
119
+ * @param {Object} opts - options
120
+ * @param {string} [opts.locale=null] - the locale code
121
+ * @param {string} [opts.numberingSystem=null] - the numbering system
122
+ * @param {string} [opts.locObj=null] - an existing locale object to use
123
+ * @return {Array}
124
+ */
125
+ static weekdaysFormat(
126
+ length = "long",
127
+ { locale = null, numberingSystem = null, locObj = null } = {}
128
+ ) {
129
+ return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
130
+ }
131
+
132
+ /**
133
+ * Return an array of meridiems.
134
+ * @param {Object} opts - options
135
+ * @param {string} [opts.locale] - the locale code
136
+ * @example Info.meridiems() //=> [ 'AM', 'PM' ]
137
+ * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
138
+ * @return {Array}
139
+ */
140
+ static meridiems({ locale = null } = {}) {
141
+ return Locale.create(locale).meridiems();
142
+ }
143
+
144
+ /**
145
+ * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian.
146
+ * @param {string} [length='short'] - the length of the era representation, such as "short" or "long".
147
+ * @param {Object} opts - options
148
+ * @param {string} [opts.locale] - the locale code
149
+ * @example Info.eras() //=> [ 'BC', 'AD' ]
150
+ * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ]
151
+ * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
152
+ * @return {Array}
153
+ */
154
+ static eras(length = "short", { locale = null } = {}) {
155
+ return Locale.create(locale, null, "gregory").eras(length);
156
+ }
157
+
158
+ /**
159
+ * Return the set of available features in this environment.
160
+ * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
161
+ * Keys:
162
+ * * `relative`: whether this environment supports relative time formatting
163
+ * @example Info.features() //=> { relative: false }
164
+ * @return {Object}
165
+ */
166
+ static features() {
167
+ return { relative: hasRelative() };
168
+ }
169
+ }