@fuzdev/fuz_app 0.138.0 → 0.140.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 +10 -17
- package/README.md +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +19 -19
- package/dist/cli/config.d.ts +6 -6
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +9 -8
- package/dist/cli/daemon.d.ts +28 -10
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +13 -12
- package/dist/primitive_schemas.d.ts +3 -5
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +3 -5
- package/dist/ui/AdminAccounts.svelte +2 -2
- package/dist/ui/ConfirmButton.svelte +1 -1
- package/dist/ui/RoleGrantOfferInbox.svelte +1 -1
- package/package.json +14 -14
package/LICENSE
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
BSD Zero Clause License
|
|
2
2
|
|
|
3
3
|
Copyright (c) fuz.dev
|
|
4
4
|
|
|
5
|
-
Permission
|
|
6
|
-
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for
|
|
6
|
+
any purpose with or without fee is hereby granted.
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
8
|
+
THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL
|
|
9
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
10
|
+
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
11
|
+
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
|
|
12
|
+
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
|
13
|
+
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
|
14
|
+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
package/dist/cli/args.d.ts
CHANGED
|
@@ -41,7 +41,8 @@ export declare const parse_command_args: <T extends Record<string, unknown>>(rem
|
|
|
41
41
|
* read on any wrapper layer of the entry), and the fallback provides defaults
|
|
42
42
|
* when parsing fails. Every entry is global, both of a `no-` pair like `color`
|
|
43
43
|
* and `no-color` included, so `--no-color`, which `argv_parse` reads as
|
|
44
|
-
* `color: false`, never lands in `remaining`.
|
|
44
|
+
* `color: false`, never lands in `remaining`. A `no-` pair and aliases resolve
|
|
45
|
+
* as `args_parse` resolves them.
|
|
45
46
|
*
|
|
46
47
|
* @param schema - fuz_schema object schema for global flags
|
|
47
48
|
* @param fallback - default values when parsing fails
|
package/dist/cli/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAyB,KAAK,UAAU,EAAiB,MAAM,0BAA0B,CAAC;AACjG,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGzE;;GAEG;AACH,MAAM,MAAM,sBAAsB,C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AK;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,CA0ChE,CAAC"}
|
package/dist/cli/args.js
CHANGED
|
@@ -38,7 +38,8 @@ export const parse_command_args = (remaining, schema) => {
|
|
|
38
38
|
* read on any wrapper layer of the entry), and the fallback provides defaults
|
|
39
39
|
* when parsing fails. Every entry is global, both of a `no-` pair like `color`
|
|
40
40
|
* and `no-color` included, so `--no-color`, which `argv_parse` reads as
|
|
41
|
-
* `color: false`, never lands in `remaining`.
|
|
41
|
+
* `color: false`, never lands in `remaining`. A `no-` pair and aliases resolve
|
|
42
|
+
* as `args_parse` resolves them.
|
|
42
43
|
*
|
|
43
44
|
* @param schema - fuz_schema object schema for global flags
|
|
44
45
|
* @param fallback - default values when parsing fails
|
|
@@ -46,37 +47,35 @@ export const parse_command_args = (remaining, schema) => {
|
|
|
46
47
|
*/
|
|
47
48
|
export const create_extract_global_flags = (schema, fallback) => {
|
|
48
49
|
return (unparsed) => {
|
|
49
|
-
// get all global flag names and aliases from schema
|
|
50
|
+
// get all global flag names and aliases from schema, `input_names` with
|
|
51
|
+
// those of a `_` entry, which is read but never stripped from `remaining`
|
|
50
52
|
const global_props = to_global_props(schema);
|
|
51
53
|
const global_names = new Set();
|
|
54
|
+
const input_names = new Set();
|
|
52
55
|
for (const prop of global_props) {
|
|
56
|
+
input_names.add(prop.name);
|
|
57
|
+
for (const alias of prop.aliases)
|
|
58
|
+
input_names.add(alias);
|
|
53
59
|
if (prop.name === '_')
|
|
54
60
|
continue;
|
|
55
61
|
global_names.add(prop.name);
|
|
56
62
|
for (const alias of prop.aliases)
|
|
57
63
|
global_names.add(alias);
|
|
58
64
|
}
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
else {
|
|
67
|
-
for (const alias of prop.aliases) {
|
|
68
|
-
if (alias in unparsed) {
|
|
69
|
-
flags_input[prop.name] = unparsed[alias];
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
65
|
+
// copy the given global flags in the order they were given, aliases included,
|
|
66
|
+
// so `args_parse` expands aliases and resolves a `no-` pair given both ways
|
|
67
|
+
// to the side given last; a null prototype keeps every key an own key
|
|
68
|
+
const flags_input = Object.create(null);
|
|
69
|
+
for (const [key, value] of Object.entries(unparsed)) {
|
|
70
|
+
if (input_names.has(key))
|
|
71
|
+
flags_input[key] = value;
|
|
74
72
|
}
|
|
75
73
|
// parse global flags
|
|
76
74
|
const global_parsed = args_parse(flags_input, schema);
|
|
77
75
|
const flags = global_parsed.ok ? global_parsed.value : fallback;
|
|
78
|
-
// build remaining args without global flags
|
|
79
|
-
const remaining =
|
|
76
|
+
// build remaining args without global flags, `__proto__` as an own key
|
|
77
|
+
const remaining = Object.create(null);
|
|
78
|
+
remaining._ = [...unparsed._];
|
|
80
79
|
for (const [key, value] of Object.entries(unparsed)) {
|
|
81
80
|
if (key === '_')
|
|
82
81
|
continue;
|
|
@@ -84,6 +83,7 @@ export const create_extract_global_flags = (schema, fallback) => {
|
|
|
84
83
|
continue;
|
|
85
84
|
remaining[key] = value;
|
|
86
85
|
}
|
|
86
|
+
Object.setPrototypeOf(remaining, Object.prototype);
|
|
87
87
|
return { flags, remaining };
|
|
88
88
|
};
|
|
89
89
|
};
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Generic CLI configuration loader.
|
|
3
3
|
*
|
|
4
4
|
* Manages CLI-specific configuration stored at `~/.{name}/config.json`.
|
|
5
|
-
* Consumers keep their project-specific
|
|
6
|
-
* these generic load/save functions.
|
|
5
|
+
* Consumers keep their project-specific `@fuzdev/fuz_schema` schemas locally
|
|
6
|
+
* and use these generic load/save functions.
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import type
|
|
10
|
+
import { type Schema } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
11
|
import type { EnvDeps, FsReadDeps, FsWriteDeps, LogDeps } from '../runtime/deps.js';
|
|
12
12
|
/**
|
|
13
13
|
* Get the CLI config directory path (`~/.{name}`).
|
|
@@ -26,14 +26,14 @@ export declare const get_app_dir: (runtime: Pick<EnvDeps, "env_get">, name: stri
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const get_config_path: (runtime: Pick<EnvDeps, "env_get">, name: string) => string | null;
|
|
28
28
|
/**
|
|
29
|
-
* Load CLI configuration from a JSON file
|
|
29
|
+
* Load CLI configuration from a JSON file validated by a `@fuzdev/fuz_schema` schema.
|
|
30
30
|
*
|
|
31
31
|
* @param runtime - runtime with file read capability
|
|
32
32
|
* @param path - path to the config JSON file
|
|
33
|
-
* @param schema -
|
|
33
|
+
* @param schema - fuz_schema schema to validate against
|
|
34
34
|
* @returns parsed config, or null if file doesn't exist or is invalid
|
|
35
35
|
*/
|
|
36
|
-
export declare const load_config: <T>(runtime: Pick<FsReadDeps, "stat" | "read_text_file"> & LogDeps, path: string, schema:
|
|
36
|
+
export declare const load_config: <T>(runtime: Pick<FsReadDeps, "stat" | "read_text_file"> & LogDeps, path: string, schema: Schema<T, any>) => Promise<T | null>;
|
|
37
37
|
/**
|
|
38
38
|
* Save CLI configuration to a JSON file.
|
|
39
39
|
*
|
package/dist/cli/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAuB,KAAK,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAGtF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAG1F,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EAClC,SAAS,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAAG,OAAO,EAC9D,MAAM,MAAM,EACZ,QAAQ,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,KACpB,OAAO,CAAC,CAAC,GAAG,IAAI,CAoBlB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EAClC,SAAS,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,iBAAiB,CAAC,EACvD,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,QAAQ,CAAC,KACP,OAAO,CAAC,IAAI,CAOd,CAAC"}
|
package/dist/cli/config.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* Generic CLI configuration loader.
|
|
3
3
|
*
|
|
4
4
|
* Manages CLI-specific configuration stored at `~/.{name}/config.json`.
|
|
5
|
-
* Consumers keep their project-specific
|
|
6
|
-
* these generic load/save functions.
|
|
5
|
+
* Consumers keep their project-specific `@fuzdev/fuz_schema` schemas locally
|
|
6
|
+
* and use these generic load/save functions.
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
+
import { format_issue, parse } from '@fuzdev/fuz_schema/schema.ts';
|
|
10
11
|
/**
|
|
11
12
|
* Get the CLI config directory path (`~/.{name}`).
|
|
12
13
|
*
|
|
@@ -30,11 +31,11 @@ export const get_config_path = (runtime, name) => {
|
|
|
30
31
|
return app_dir ? `${app_dir}/config.json` : null;
|
|
31
32
|
};
|
|
32
33
|
/**
|
|
33
|
-
* Load CLI configuration from a JSON file
|
|
34
|
+
* Load CLI configuration from a JSON file validated by a `@fuzdev/fuz_schema` schema.
|
|
34
35
|
*
|
|
35
36
|
* @param runtime - runtime with file read capability
|
|
36
37
|
* @param path - path to the config JSON file
|
|
37
|
-
* @param schema -
|
|
38
|
+
* @param schema - fuz_schema schema to validate against
|
|
38
39
|
* @returns parsed config, or null if file doesn't exist or is invalid
|
|
39
40
|
*/
|
|
40
41
|
export const load_config = async (runtime, path, schema) => {
|
|
@@ -46,12 +47,12 @@ export const load_config = async (runtime, path, schema) => {
|
|
|
46
47
|
try {
|
|
47
48
|
const content = await runtime.read_text_file(path);
|
|
48
49
|
const parsed = JSON.parse(content);
|
|
49
|
-
const result = schema
|
|
50
|
-
if (!result.
|
|
51
|
-
runtime.warn(`Invalid config.json: ${result.
|
|
50
|
+
const result = parse(schema, parsed);
|
|
51
|
+
if (!result.ok) {
|
|
52
|
+
runtime.warn(`Invalid config.json: ${result.issues.map(format_issue).join('; ')}`);
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
54
|
-
return result.
|
|
55
|
+
return result.value;
|
|
55
56
|
}
|
|
56
57
|
catch (error) {
|
|
57
58
|
runtime.warn(`Failed to read config.json: ${error.message}`);
|
package/dist/cli/daemon.d.ts
CHANGED
|
@@ -7,19 +7,37 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
11
|
import { type CommandDeps, type EnvDeps, type FetchDeps, type FsReadDeps, type FsRemoveDeps, type FsWriteDeps, type LogDeps } from '../runtime/deps.js';
|
|
12
12
|
/**
|
|
13
|
-
* Daemon info schema for `~/.{name}/run/daemon.json
|
|
13
|
+
* Daemon info schema for `~/.{name}/run/daemon.json`, a strict
|
|
14
|
+
* `@fuzdev/fuz_schema` object schema.
|
|
14
15
|
*/
|
|
15
|
-
export declare const DaemonInfo:
|
|
16
|
-
version:
|
|
17
|
-
pid:
|
|
18
|
-
port:
|
|
19
|
-
started:
|
|
20
|
-
app_version:
|
|
21
|
-
},
|
|
22
|
-
|
|
16
|
+
export declare const DaemonInfo: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
17
|
+
version: number;
|
|
18
|
+
pid: number;
|
|
19
|
+
port: number;
|
|
20
|
+
started: string;
|
|
21
|
+
app_version: string;
|
|
22
|
+
}, {
|
|
23
|
+
version: number;
|
|
24
|
+
pid: number;
|
|
25
|
+
port: number;
|
|
26
|
+
started: string;
|
|
27
|
+
app_version: string;
|
|
28
|
+
}, "object", {
|
|
29
|
+
/** Schema version. */
|
|
30
|
+
version: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
31
|
+
/** Server process ID. */
|
|
32
|
+
pid: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
33
|
+
/** Port the server is listening on. */
|
|
34
|
+
port: import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>;
|
|
35
|
+
/** ISO timestamp when server started. */
|
|
36
|
+
started: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
37
|
+
/** Package version of the application. */
|
|
38
|
+
app_version: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
39
|
+
}>;
|
|
40
|
+
export type DaemonInfo = Infer<typeof DaemonInfo>;
|
|
23
41
|
/**
|
|
24
42
|
* Get the daemon info file path (`~/.{name}/run/daemon.json`).
|
|
25
43
|
*
|
package/dist/cli/daemon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemon.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/cli/daemon.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,
|
|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AAO,CAAC,OAAO,CAG1F,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,MAAM,MAAM,EACZ,aAAkB,EAClB,mBAAiB,KACf,OAAO,CAAC,OAAO,CAYjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GACvB,SAAS,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAChC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAAC,GAC3C,YAAY,GACZ,WAAW,GACX,OAAO,EACR,MAAM,MAAM,KACV,OAAO,CAAC,gBAAgB,CA2C1B,CAAC"}
|
package/dist/cli/daemon.js
CHANGED
|
@@ -7,24 +7,25 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
10
|
+
import { format_issue, number, object, parse, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
11
11
|
import {} from '../runtime/deps.js';
|
|
12
12
|
import { write_file_atomic } from '../runtime/fs.js';
|
|
13
13
|
import { get_app_dir } from './config.js';
|
|
14
14
|
/**
|
|
15
|
-
* Daemon info schema for `~/.{name}/run/daemon.json
|
|
15
|
+
* Daemon info schema for `~/.{name}/run/daemon.json`, a strict
|
|
16
|
+
* `@fuzdev/fuz_schema` object schema.
|
|
16
17
|
*/
|
|
17
|
-
export const DaemonInfo =
|
|
18
|
+
export const DaemonInfo = object({
|
|
18
19
|
/** Schema version. */
|
|
19
|
-
version:
|
|
20
|
+
version: number,
|
|
20
21
|
/** Server process ID. */
|
|
21
|
-
pid:
|
|
22
|
+
pid: number,
|
|
22
23
|
/** Port the server is listening on. */
|
|
23
|
-
port:
|
|
24
|
+
port: number,
|
|
24
25
|
/** ISO timestamp when server started. */
|
|
25
|
-
started:
|
|
26
|
+
started: string,
|
|
26
27
|
/** Package version of the application. */
|
|
27
|
-
app_version:
|
|
28
|
+
app_version: string
|
|
28
29
|
});
|
|
29
30
|
/**
|
|
30
31
|
* Get the daemon info file path (`~/.{name}/run/daemon.json`).
|
|
@@ -75,12 +76,12 @@ export const read_daemon_info = async (runtime, name) => {
|
|
|
75
76
|
try {
|
|
76
77
|
const content = await runtime.read_text_file(daemon_path);
|
|
77
78
|
const parsed = JSON.parse(content);
|
|
78
|
-
const result = DaemonInfo
|
|
79
|
-
if (!result.
|
|
80
|
-
runtime.warn(`Invalid daemon.json: ${result.
|
|
79
|
+
const result = parse(DaemonInfo, parsed);
|
|
80
|
+
if (!result.ok) {
|
|
81
|
+
runtime.warn(`Invalid daemon.json: ${result.issues.map(format_issue).join('; ')}`);
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
|
-
return result.
|
|
84
|
+
return result.value;
|
|
84
85
|
}
|
|
85
86
|
catch {
|
|
86
87
|
runtime.warn('Failed to parse daemon.json');
|
|
@@ -96,11 +96,9 @@ export type UsernameProvided = z.infer<typeof UsernameProvided>;
|
|
|
96
96
|
*/
|
|
97
97
|
export declare const EMAIL_LENGTH_MAX = 254;
|
|
98
98
|
/**
|
|
99
|
-
* Email validation.
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* identity-primitive bundle. Promote to fuz_util if a non-identity consumer
|
|
103
|
-
* surfaces.
|
|
99
|
+
* Email validation. Every current consumer pairs it with `Username` (signup,
|
|
100
|
+
* invites, audit log), so the two live together with the other Zod
|
|
101
|
+
* primitives.
|
|
104
102
|
*
|
|
105
103
|
* Deliberately permissive — a structural shape check (`EMAIL_REGEX` plus the
|
|
106
104
|
* `EMAIL_LENGTH_MAX` byte bound), not RFC 5322 conformance or deliverability
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIlF,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACpC,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,GAAI,2BAA2B,oBAAoB,KAAG,CAAC,CAAC,SA8ClF,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,6GAA6G;AAC7G,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,gNAAgN;AAChN,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,wDAEc,CAAC;AACpC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,wDAEqE,CAAC;AACnG,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAqBpC
|
|
1
|
+
{"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC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ACrF,eAAO,MAAM,eAAe,4DAA4B,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wCAAwC;AACxC,eAAO,MAAM,QAAQ,yDAAqC,CAAC;AAC3D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,QAAO,QAAgD,CAAC;AAErF,sFAAsF;AACtF,eAAO,MAAM,WAAW,uEAAqC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,uFAAuF;AACvF,eAAO,MAAM,UAAU,aAEuD,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAEA,CAAC"}
|
|
@@ -152,11 +152,9 @@ const EMAIL_REGEX = /^[^\s\u0085@]+@[^\s\u0085@]+\.[^\s\u0085@]+$/;
|
|
|
152
152
|
/** UTF-8 encoder for the `EMAIL_LENGTH_MAX` byte (octet) bound. */
|
|
153
153
|
const utf8_encoder = new TextEncoder();
|
|
154
154
|
/**
|
|
155
|
-
* Email validation.
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* identity-primitive bundle. Promote to fuz_util if a non-identity consumer
|
|
159
|
-
* surfaces.
|
|
155
|
+
* Email validation. Every current consumer pairs it with `Username` (signup,
|
|
156
|
+
* invites, audit log), so the two live together with the other Zod
|
|
157
|
+
* primitives.
|
|
160
158
|
*
|
|
161
159
|
* Deliberately permissive — a structural shape check (`EMAIL_REGEX` plus the
|
|
162
160
|
* `EMAIL_LENGTH_MAX` byte bound), not RFC 5322 conformance or deliverability
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
{#snippet popover_content(_popover, do_confirm)}
|
|
173
173
|
<button
|
|
174
174
|
type="button"
|
|
175
|
-
class="palette_b background-color:var(--
|
|
175
|
+
class="palette_b background-color:var(--paper_100)"
|
|
176
176
|
onclick={() => do_confirm()}
|
|
177
177
|
>
|
|
178
178
|
<span class="py_sm">offer '{role}' to @{row.account.username}</span>
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
{#snippet popover_content(_popover, do_confirm)}
|
|
217
217
|
<button
|
|
218
218
|
type="button"
|
|
219
|
-
class="palette_c background-color:var(--
|
|
219
|
+
class="palette_c background-color:var(--paper_100)"
|
|
220
220
|
onclick={() => do_confirm()}
|
|
221
221
|
>
|
|
222
222
|
<span class="py_sm">soft-delete @{row.account.username} (reversible)</span>
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
{:else}
|
|
131
131
|
<button
|
|
132
132
|
type="button"
|
|
133
|
-
class="palette_c background-color:var(--
|
|
133
|
+
class="palette_c background-color:var(--paper_100)"
|
|
134
134
|
class:icon_button={!popover_button_content}
|
|
135
135
|
onclick={() => confirm(popover)}
|
|
136
136
|
title={rest.title ? `confirm ${rest.title}` : 'confirm'}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzdev/fuz_app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.140.0",
|
|
4
4
|
"description": "fullstack app library",
|
|
5
5
|
"glyph": "🗝",
|
|
6
6
|
"logo": "logo.svg",
|
|
7
7
|
"logo_alt": "a friendly teal spider facing you",
|
|
8
|
-
"license": "
|
|
8
|
+
"license": "0BSD",
|
|
9
9
|
"homepage": "https://app.fuz.dev/",
|
|
10
10
|
"repository": "https://github.com/fuzdev/fuz_app",
|
|
11
11
|
"scripts": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@electric-sql/pglite": ">=0.4",
|
|
35
35
|
"@fuzdev/blake3-wasm": ">=0.2.0",
|
|
36
|
-
"@fuzdev/fuz_css": ">=0.
|
|
37
|
-
"@fuzdev/fuz_schema": "^0.
|
|
38
|
-
"@fuzdev/fuz_util": ">=0.
|
|
36
|
+
"@fuzdev/fuz_css": ">=0.70.0",
|
|
37
|
+
"@fuzdev/fuz_schema": "^0.5.0",
|
|
38
|
+
"@fuzdev/fuz_util": ">=0.77.0",
|
|
39
39
|
"@fuzdev/pglet-wasm": ">=0.1.1",
|
|
40
40
|
"@hono/bun": ">=1",
|
|
41
41
|
"@hono/deno": ">=1",
|
|
@@ -91,20 +91,20 @@
|
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@electric-sql/pglite": "^0.5.8",
|
|
93
93
|
"@fuzdev/blake3-wasm": "^0.2.0",
|
|
94
|
-
"@fuzdev/fuz_code": "^0.
|
|
95
|
-
"@fuzdev/fuz_css": "^0.
|
|
96
|
-
"@fuzdev/fuz_schema": "^0.
|
|
97
|
-
"@fuzdev/fuz_ui": "^0.
|
|
98
|
-
"@fuzdev/fuz_util": "^0.
|
|
99
|
-
"@fuzdev/gro": "^0.
|
|
100
|
-
"@fuzdev/mdz": "^0.
|
|
94
|
+
"@fuzdev/fuz_code": "^0.54.0",
|
|
95
|
+
"@fuzdev/fuz_css": "^0.70.0",
|
|
96
|
+
"@fuzdev/fuz_schema": "^0.5.0",
|
|
97
|
+
"@fuzdev/fuz_ui": "^0.217.0",
|
|
98
|
+
"@fuzdev/fuz_util": "^0.77.0",
|
|
99
|
+
"@fuzdev/gro": "^0.220.0",
|
|
100
|
+
"@fuzdev/mdz": "^0.6.0",
|
|
101
101
|
"@fuzdev/pglet-wasm": "^0.1.1",
|
|
102
102
|
"@hono/bun": "^1.0.1",
|
|
103
103
|
"@hono/deno": "^1.0.3",
|
|
104
104
|
"@hono/node-server": "^1.19.14",
|
|
105
105
|
"@hono/node-ws": "^1.3.1",
|
|
106
106
|
"@node-rs/argon2": "^2.0.2",
|
|
107
|
-
"@ryanatkn/eslint-config": "^0.13.
|
|
107
|
+
"@ryanatkn/eslint-config": "^0.13.1",
|
|
108
108
|
"@sveltejs/acorn-typescript": "^1.0.9",
|
|
109
109
|
"@sveltejs/adapter-static": "^4.0.0",
|
|
110
110
|
"@sveltejs/kit": "^3.0.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"pg": "^8.20.0",
|
|
124
124
|
"svelte": "^5.57.2",
|
|
125
125
|
"svelte-check": "^4.7.6",
|
|
126
|
-
"svelte-docinfo": "^0.
|
|
126
|
+
"svelte-docinfo": "^0.13.0",
|
|
127
127
|
"svelte2tsx": "^0.7.52",
|
|
128
128
|
"tslib": "^2.8.1",
|
|
129
129
|
"typescript": "^6.0.3",
|