@wtfalch/auth 0.22.0 → 0.23.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/dist/names.d.ts CHANGED
@@ -38,6 +38,14 @@ export interface NameRules {
38
38
  pattern: RegExp;
39
39
  }
40
40
  export declare const DEFAULT_RULES: NameRules;
41
+ /**
42
+ * Lowercase letters with the digits read as letters and nothing else, runs
43
+ * collapsed. Every reading, since `1` may be an `i` or an `l`; the first is
44
+ * the one a list entry is stored under.
45
+ */
46
+ export declare function flattenings(name: string): string[];
47
+ /** Every entry checkName holds back: the system names, the people's and the reserved-usernames list, once each. */
48
+ export declare function reservedNames(): readonly string[];
41
49
  /** The refusal as a sentence the person can act on. */
42
50
  export declare function explain(reason: Refusal, rules?: NameRules): string;
43
51
  export declare function checkName(name: string, rules?: NameRules): Verdict;
package/dist/names.js CHANGED
@@ -35,7 +35,10 @@ strictWords.addPhrase((phrase) => {
35
35
  phrase.addWhitelistedTerm(term);
36
36
  return phrase;
37
37
  });
38
- const strict = new RegExpMatcher({ ...strictWords.build(), ...englishRecommendedTransformers });
38
+ const strict = new RegExpMatcher({
39
+ ...strictWords.build(),
40
+ ...englishRecommendedTransformers,
41
+ });
39
42
  /** Only the words that are slurs wherever they appear, read with everything between the letters skipped. */
40
43
  const looseWords = new DataSet();
41
44
  for (const entry of [
@@ -84,7 +87,7 @@ const LETTERS = {
84
87
  * collapsed. Every reading, since `1` may be an `i` or an `l`; the first is
85
88
  * the one a list entry is stored under.
86
89
  */
87
- function flattenings(name) {
90
+ export function flattenings(name) {
88
91
  let forms = [''];
89
92
  for (const char of name.toLowerCase()) {
90
93
  const readings = /[a-z]/.test(char) ? [char] : (LETTERS[char] ?? []);
@@ -96,7 +99,12 @@ function flattenings(name) {
96
99
  }
97
100
  return [...new Set(forms.map((form) => form.replace(/(.)\1+/g, '$1')))];
98
101
  }
99
- const reserved = new Set([...reservedUsernames, ...SYSTEM, ...PEOPLE].map((entry) => flattenings(entry)[0]));
102
+ const RESERVED = [...new Set([...reservedUsernames, ...SYSTEM, ...PEOPLE])];
103
+ const reserved = new Set(RESERVED.map((entry) => flattenings(entry)[0]));
104
+ /** Every entry checkName holds back: the system names, the people's and the reserved-usernames list, once each. */
105
+ export function reservedNames() {
106
+ return RESERVED;
107
+ }
100
108
  /** The name in the shapes a word might hide in. */
101
109
  function shapes(name) {
102
110
  const parts = name.split(/[^A-Za-z0-9æøåÆØÅ]+/).filter(Boolean);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/auth",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Sign in against a self-hosted ZITADEL issuer: a server session for a Next.js app, and a browser client with silent single sign-on across subdomains.",
5
5
  "repository": {
6
6
  "type": "git",