@fuzdev/fuz_app 0.136.0 → 0.138.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/actions/action_codegen.js +1 -1
- package/dist/actions/action_event.js +1 -1
- package/dist/actions/action_rpc.d.ts +1 -1
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_spec.d.ts +0 -48
- package/dist/actions/action_spec.d.ts.map +1 -1
- package/dist/actions/connection_closer.d.ts +1 -1
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/peer_request.d.ts +1 -1
- package/dist/actions/peer_request.d.ts.map +1 -1
- package/dist/actions/perform_action.d.ts +1 -1
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/register_action_ws.d.ts +1 -1
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.d.ts +1 -1
- package/dist/actions/transports_ws_backend.d.ts.map +1 -1
- package/dist/actions/transports_ws_backend.js +1 -1
- package/dist/auth/account_action_specs.d.ts +1 -1
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +3 -4
- package/dist/auth/account_schema.d.ts +3 -9
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +3 -4
- package/dist/auth/actor_lookup_action_specs.js +1 -1
- package/dist/auth/actor_lookup_queries.d.ts +1 -1
- package/dist/auth/actor_lookup_queries.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.d.ts +1 -1
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +3 -7
- package/dist/auth/actor_search_queries.d.ts +1 -1
- package/dist/auth/actor_search_queries.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +1 -2
- package/dist/auth/app_settings_schema.d.ts +1 -1
- package/dist/auth/app_settings_schema.d.ts.map +1 -1
- package/dist/auth/app_settings_schema.js +1 -1
- package/dist/auth/audit_emitter.d.ts +1 -1
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.d.ts +1 -1
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +1 -2
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +1 -2
- package/dist/auth/cell_action_specs.d.ts +25 -25
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +7 -10
- package/dist/auth/cell_actions.d.ts +1 -1
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_audit_action_specs.js +1 -1
- package/dist/auth/cell_audit_metadata.js +1 -1
- package/dist/auth/cell_field_action_specs.js +1 -1
- package/dist/auth/cell_field_audit_metadata.js +1 -1
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_audit_metadata.js +1 -1
- package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_item_action_specs.js +2 -5
- package/dist/auth/cell_item_audit_metadata.js +1 -1
- package/dist/auth/cell_relation_visibility.d.ts +1 -1
- package/dist/auth/cell_relation_visibility.d.ts.map +1 -1
- package/dist/auth/invite_schema.d.ts +1 -2
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +1 -2
- package/dist/auth/password.d.ts +2 -2
- package/dist/auth/password.d.ts.map +1 -1
- package/dist/auth/password.js +10 -12
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +5 -11
- package/dist/auth/role_grant_offer_notifications.d.ts +1 -1
- package/dist/auth/role_grant_offer_notifications.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_queries.d.ts +1 -1
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.d.ts +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +4 -8
- package/dist/auth/role_grant_queries.d.ts +1 -1
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +5 -4
- package/dist/auth/scope_kind_schema.d.ts +1 -1
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +6 -5
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +1 -2
- package/dist/cli/args.d.ts +21 -15
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +40 -16
- package/dist/cli/daemon.d.ts +0 -5
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/help.d.ts +45 -6
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +81 -4
- package/dist/db/cell_audit_queries.d.ts +1 -1
- package/dist/db/cell_audit_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.d.ts +1 -1
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_grant_queries.d.ts +1 -1
- package/dist/db/cell_grant_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.d.ts +1 -1
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.d.ts +1 -1
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/http/auth_shape.d.ts +0 -27
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +2 -2
- package/dist/http/db_routes.d.ts +1 -1
- package/dist/http/db_routes.d.ts.map +1 -1
- package/dist/primitive_schemas.d.ts +82 -8
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +120 -17
- package/dist/server/serve_fact_route.js +1 -2
- package/dist/server/x_accel.d.ts +0 -1
- package/dist/server/x_accel.d.ts.map +1 -1
- package/dist/testing/adversarial_input.js +1 -1
- package/dist/testing/app_server.d.ts +1 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.d.ts +0 -14
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/fact_serving.js +1 -1
- package/dist/testing/cross_backend/setup.d.ts +1 -1
- package/dist/testing/cross_backend/setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/setup.js +1 -2
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +1 -10
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +1 -2
- package/dist/testing/role_grant_helpers.d.ts +1 -1
- package/dist/testing/role_grant_helpers.d.ts.map +1 -1
- package/dist/testing/schema_generators.d.ts +1 -1
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +1 -1
- package/dist/testing/transports/bootstrap.d.ts +1 -1
- package/dist/testing/transports/bootstrap.d.ts.map +1 -1
- package/dist/testing/transports/bootstrap.js +1 -1
- package/dist/testing/ws_round_trip.d.ts +1 -1
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts +1 -1
- package/dist/ui/admin_invites_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_sessions_state.svelte.d.ts +1 -1
- package/dist/ui/admin_sessions_state.svelte.d.ts.map +1 -1
- package/dist/zod.d.ts +64 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +171 -0
- package/package.json +7 -5
package/dist/cli/help.js
CHANGED
|
@@ -5,10 +5,87 @@
|
|
|
5
5
|
* once with `create_help` and get back `generate_main_help`,
|
|
6
6
|
* `generate_command_help`, and `get_help_text`.
|
|
7
7
|
*
|
|
8
|
+
* Schemas are `@fuzdev/fuz_schema` object schemas, the ones `parse_command_args`
|
|
9
|
+
* and `create_extract_global_flags` take, read with fuz_schema's `introspect.ts`:
|
|
10
|
+
* each entry's `description` and `aliases` metadata, its default, and its type
|
|
11
|
+
* as `format_schema_type` renders it.
|
|
12
|
+
*
|
|
8
13
|
* @module
|
|
9
14
|
*/
|
|
10
|
-
import {
|
|
15
|
+
import { format_schema_type, get_schema_fields, get_schema_meta } from '@fuzdev/fuz_schema/introspect.ts';
|
|
11
16
|
import { colors } from './util.js';
|
|
17
|
+
/**
|
|
18
|
+
* Read the args of an object schema for help output, in order.
|
|
19
|
+
*
|
|
20
|
+
* An entry whose `no-` negation is also an entry is left out, so a pair like
|
|
21
|
+
* `color` and `no-color` is shown once, as `--no-color`.
|
|
22
|
+
*
|
|
23
|
+
* @param schema - fuz_schema object schema
|
|
24
|
+
* @returns the args, none when `schema` is not an object schema
|
|
25
|
+
*/
|
|
26
|
+
export const to_help_arg_properties = (schema) => {
|
|
27
|
+
const fields = get_schema_fields(schema);
|
|
28
|
+
const names = new Set(fields.map((f) => f.name));
|
|
29
|
+
const properties = [];
|
|
30
|
+
for (const field of fields) {
|
|
31
|
+
if (names.has('no-' + field.name))
|
|
32
|
+
continue;
|
|
33
|
+
properties.push({
|
|
34
|
+
name: field.name,
|
|
35
|
+
type: format_schema_type(field.schema),
|
|
36
|
+
description: field.description ?? '',
|
|
37
|
+
default: to_field_default(field),
|
|
38
|
+
aliases: get_schema_meta(field.schema, 'aliases') ?? []
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return properties;
|
|
42
|
+
};
|
|
43
|
+
// the default a field's help shows: a `with_default_fn`'s is made by calling its `make`,
|
|
44
|
+
// as each parse that fills the key in does, found by walking the layers `get_schema_fields`
|
|
45
|
+
// reads, whose first `optional` or default it is when `default_computed`
|
|
46
|
+
const to_field_default = (field) => {
|
|
47
|
+
if (!field.default_computed)
|
|
48
|
+
return field.default;
|
|
49
|
+
let layer = field.schema;
|
|
50
|
+
for (;;) {
|
|
51
|
+
switch (layer.kind) {
|
|
52
|
+
case 'with_default_fn':
|
|
53
|
+
return layer.def.make();
|
|
54
|
+
case 'optional':
|
|
55
|
+
case 'nullable':
|
|
56
|
+
case 'with_default':
|
|
57
|
+
layer = layer.def.schema;
|
|
58
|
+
break;
|
|
59
|
+
case 'pipe':
|
|
60
|
+
layer = layer.def[0];
|
|
61
|
+
break;
|
|
62
|
+
case 'lazy':
|
|
63
|
+
layer = layer.def();
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Format a default value for display, `''` for none.
|
|
72
|
+
*
|
|
73
|
+
* Strings and arrays are written as JSON, as the type column writes a string literal.
|
|
74
|
+
*
|
|
75
|
+
* @param value - the default
|
|
76
|
+
* @returns display text
|
|
77
|
+
*/
|
|
78
|
+
export const format_arg_default = (value) => {
|
|
79
|
+
if (value === undefined)
|
|
80
|
+
return '';
|
|
81
|
+
if (value === null)
|
|
82
|
+
return 'null';
|
|
83
|
+
if (typeof value === 'string' || typeof value === 'object')
|
|
84
|
+
return JSON.stringify(value);
|
|
85
|
+
if (typeof value === 'boolean' || typeof value === 'number')
|
|
86
|
+
return String(value);
|
|
87
|
+
return '';
|
|
88
|
+
};
|
|
12
89
|
/**
|
|
13
90
|
* Get maximum length from array.
|
|
14
91
|
*
|
|
@@ -50,7 +127,7 @@ export const create_help = (options) => {
|
|
|
50
127
|
? colors
|
|
51
128
|
: { green: '', yellow: '', blue: '', red: '', cyan: '', dim: '', bold: '', reset: '' };
|
|
52
129
|
const generate_global_options = () => {
|
|
53
|
-
const properties =
|
|
130
|
+
const properties = to_help_arg_properties(options.global_args_schema);
|
|
54
131
|
const max_width = to_max_length(properties, (p) => ` ${format_arg_name(p)}`);
|
|
55
132
|
return properties.map((prop) => {
|
|
56
133
|
const name = format_arg_name(prop);
|
|
@@ -65,7 +142,7 @@ export const create_help = (options) => {
|
|
|
65
142
|
lines.push(`${c.yellow}Usage${c.reset}: ${meta.usage}`);
|
|
66
143
|
lines.push('');
|
|
67
144
|
if (meta.schema) {
|
|
68
|
-
const properties =
|
|
145
|
+
const properties = to_help_arg_properties(meta.schema);
|
|
69
146
|
const flag_props = properties.filter((p) => p.name !== '_');
|
|
70
147
|
const positional_prop = properties.find((p) => p.name === '_');
|
|
71
148
|
if (positional_prop?.description) {
|
|
@@ -79,7 +156,7 @@ export const create_help = (options) => {
|
|
|
79
156
|
for (const prop of flag_props) {
|
|
80
157
|
const name = format_arg_name(prop).padEnd(longest_name);
|
|
81
158
|
const type = prop.type.padEnd(longest_type);
|
|
82
|
-
const def =
|
|
159
|
+
const def = format_arg_default(prop.default);
|
|
83
160
|
const desc = prop.description || '';
|
|
84
161
|
const default_str = def ? ` (default: ${def})` : '';
|
|
85
162
|
lines.push(` ${name} ${type} ${desc}${default_str}`);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { QueryDeps } from './query_deps.js';
|
|
16
16
|
import type { AuditLogEvent } from '../auth/audit_log_schema.js';
|
|
17
|
-
import type { Uuid } from '
|
|
17
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
18
18
|
export interface CellAuditListOptions {
|
|
19
19
|
limit: number;
|
|
20
20
|
/** Cursor — return rows with `seq < before`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_audit_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_audit_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cell_audit_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_audit_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAoBpD,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,SAAS,EACf,SAAS,IAAI,EACb,SAAS,oBAAoB,KAC3B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAwB9B,CAAC"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
19
|
import type { QueryDeps } from './query_deps.js';
|
|
20
|
-
import type { Uuid } from '
|
|
20
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
21
21
|
/** Row shape returned by `cell_field` SELECTs. */
|
|
22
22
|
export interface CellFieldRow {
|
|
23
23
|
source_id: Uuid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_field_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_field_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cell_field_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_field_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,y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@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @module
|
|
23
23
|
*/
|
|
24
24
|
import type { QueryDeps } from './query_deps.js';
|
|
25
|
-
import type { Uuid } from '
|
|
25
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
26
26
|
import type { CellGrantLevel } from '../auth/cell_grant_action_specs.js';
|
|
27
27
|
/** Row shape returned by `cell_grant` SELECTs. */
|
|
28
28
|
export interface CellGrantRow {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_grant_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_grant_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cell_grant_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_grant_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIzE,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,iGASuB,C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AAI,GAAG,IAAI,EAC5B,kBAAkB,aAAa,CAAC,MAAM,CAAC,EACvC,sBAAsB,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,KAC9C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAmB7B,CAAC"}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* @module
|
|
21
21
|
*/
|
|
22
22
|
import type { QueryDeps } from './query_deps.js';
|
|
23
|
-
import type { Uuid } from '
|
|
23
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
24
24
|
/** Row shape returned by `cell_item` SELECTs. */
|
|
25
25
|
export interface CellItemRow {
|
|
26
26
|
parent_id: Uuid;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_item_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_item_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cell_item_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_item_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,8DAKuB,CAAC;AAKtD,0CAA0C;AAC1C,MAAM,WAAW,wBAAwB;IACxC,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,SAAS,EACf,OAAO,wBAAwB,KAC7B,OAAO,CAAC,WAAW,CAQrB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,SAAS,EACf,WAAW,IAAI,EACf,UAAU,MAAM,KACd,OAAO,CAAC,WAAW,GAAG,IAAI,CAM5B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,WAAW,IAAI,EACf,cAAc,MAAM,EACpB,cAAc,MAAM,KAClB,OAAO,CAAC,WAAW,GAAG,IAAI,CAS5B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,SAAS,EACf,WAAW,IAAI,EACf,UAAU,MAAM,KACd,OAAO,CAAC,WAAW,GAAG,IAAI,CAO5B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,+BAA+B,GAC3C,MAAM,SAAS,EACf,WAAW,IAAI,EACf,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,KACnD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAa5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,GAC1C,MAAM,SAAS,EACf,UAAU,IAAI,EACd,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAC1B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAS3B,CAAC"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import type { QueryDeps } from './query_deps.js';
|
|
24
24
|
import type { Json } from '@fuzdev/fuz_util/json.ts';
|
|
25
|
-
import type { Uuid } from '
|
|
25
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
26
26
|
import type { FactHash } from '@fuzdev/fuz_util/hash_schemas.ts';
|
|
27
27
|
import type { CellData } from '../auth/cell_data_schema.js';
|
|
28
28
|
import type { CellVisibility } from '../auth/cell_action_specs.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cell_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAA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,CAAC;IAC9B;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAChD;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACzD;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;IACvC,sCAAsC;IACtC,eAAe,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACjC,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -134,33 +134,6 @@ export declare const RouteAuth: z.ZodObject<{
|
|
|
134
134
|
}>;
|
|
135
135
|
roles: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
136
136
|
credential_types: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
137
|
-
/**
|
|
138
|
-
* The capability a **narrowed** api token's scope must admit to reach this
|
|
139
|
-
* route, in the `<section>:<id>` vocabulary a denial reports back as
|
|
140
|
-
* `required_scope`:
|
|
141
|
-
*
|
|
142
|
-
* - `surface:<name>` — a non-RPC surface, refused to every narrowed token
|
|
143
|
-
* whatever its method list says (token scoping's rule that a narrowed
|
|
144
|
-
* token is RPC-only). `surface:audit_stream`, `surface:fact_bare`, and
|
|
145
|
-
* `surface:app_surface` are the spine's route-spec ones; a consumer names
|
|
146
|
-
* its own without registering it.
|
|
147
|
-
* - `rpc:<method>` — one action method, refused unless the token lists it.
|
|
148
|
-
* What a route bridged from an `ActionSpec` declares: it carries the
|
|
149
|
-
* method's identity but never reaches the dispatcher's per-method gate.
|
|
150
|
-
*
|
|
151
|
-
* Declaring it makes the guard resolver mount the refusal ahead of the role
|
|
152
|
-
* gate, instead of the route hand-rolling the check in its handler (which
|
|
153
|
-
* the auth phase has already role-gated by then, so a narrowed token whose
|
|
154
|
-
* account lacks the role would be told about the role rather than about the
|
|
155
|
-
* scope).
|
|
156
|
-
*
|
|
157
|
-
* Opt-in rather than blanket: the account REST routes cross no boundary, and
|
|
158
|
-
* the RPC endpoint runs its own per-method check inside the dispatcher — and
|
|
159
|
-
* both are route specs too.
|
|
160
|
-
*
|
|
161
|
-
* Typed as a plain string here to keep `http/` from importing `auth/`; the
|
|
162
|
-
* resolver parses it at registration and throws on a malformed one.
|
|
163
|
-
*/
|
|
164
137
|
required_scope: z.ZodOptional<z.ZodString>;
|
|
165
138
|
}, z.core.$strict>;
|
|
166
139
|
export type RouteAuth = z.infer<typeof RouteAuth>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_shape.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/auth_shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,6DAGtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SAGtD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;EAA2C,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"auth_shape.d.ts","sourceRoot":"../src/lib/","sources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BAA2B,GAAI,MAAM,SAAS,KAAG,OACwB,CAAC;AAYvF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,OAIhE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sCAAsC,GAClD,MAAM,SAAS,EACf,OAAO,WAAW,EAClB,SAAS,MAAM,KACb,IAmBF,CAAC"}
|
package/dist/http/auth_shape.js
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
* @module
|
|
34
34
|
*/
|
|
35
35
|
import { z } from 'zod';
|
|
36
|
-
import { Uuid } from '
|
|
37
|
-
import { zod_unwrap_to_object } from '
|
|
36
|
+
import { Uuid } from '../primitive_schemas.js';
|
|
37
|
+
import { zod_unwrap_to_object } from '../zod.js';
|
|
38
38
|
/**
|
|
39
39
|
* `acting` field shared by every input that needs the caller's acting actor.
|
|
40
40
|
* Declaring `acting: ActingActor` on a route or action input signals to the
|
package/dist/http/db_routes.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
13
|
-
import type { Uuid } from '
|
|
13
|
+
import type { Uuid } from '../primitive_schemas.js';
|
|
14
14
|
import type { Db, DbType } from '../db/db.js';
|
|
15
15
|
import { type RouteSpec } from './route_spec.js';
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db_routes.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/db_routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC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,GAAG,EAAE;YACJ,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,mBAAmB,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACvD,EACD,KAAK,EAAE;YACN,UAAU,EAAE,qBAAqB,CAAC;YAClC,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;YACxB,EAAE,EAAE,MAAM,CAAC;YACX,QAAQ,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,SAAS,EAAE,MAAM,CAAC;gBAAC,EAAE,EAAE,MAAM,CAAA;aAAE,CAAC;SAC3D,KACG,IAAI,CAAC;KACV,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,8EAA8E;IAC9E,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,oBAAoB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7C;AA2CD;;GAEG;AACH,eAAO,MAAM,qBAAqB,GACjC,MAAM,WAAW,EACjB,SAAS,cAAc,KACrB,KAAK,CAAC,SAAS,CA8XjB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reusable validator-schema primitives — `
|
|
3
|
-
* `Email
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Reusable validator-schema primitives — `bounded_string`, `Username`,
|
|
3
|
+
* `UsernameProvided`, `Email`, the branded `Uuid` and `Datetime` with their
|
|
4
|
+
* factories, and the hash schemas `Blake3Hash` and `FactHashSchema`. Lives at
|
|
5
|
+
* the top level (not inside `auth/` or `http/`) because these shapes don't
|
|
6
|
+
* depend on or imply any domain — accounts hold a username and email, but
|
|
7
|
+
* invites, password resets, cells, and other surfaces all reach for the same
|
|
8
|
+
* primitives without going through auth.
|
|
8
9
|
*
|
|
9
10
|
* Split out from `auth/account_schema.ts` so the auth module shrinks to
|
|
10
11
|
* entity types + client-safe JSON shapes (its real responsibility) and
|
|
@@ -12,14 +13,52 @@
|
|
|
12
13
|
* auth domain along. Future cross-domain primitives (phone, url, slug)
|
|
13
14
|
* land here too.
|
|
14
15
|
*
|
|
16
|
+
* Client-safe: nothing here imports `@fuzdev/blake3-wasm`, so wire schemas
|
|
17
|
+
* that validate a hash don't pull the WASM binary into a bundle.
|
|
18
|
+
*
|
|
15
19
|
* @module
|
|
16
20
|
*/
|
|
17
21
|
import { z } from 'zod';
|
|
22
|
+
import { type FactHash } from '@fuzdev/fuz_util/hash_schemas.ts';
|
|
23
|
+
/** Length bounds for `bounded_string`, in UTF-16 code units. */
|
|
24
|
+
export interface BoundedStringOptions {
|
|
25
|
+
/** Shortest string admitted. Omit for no lower bound. */
|
|
26
|
+
min?: number;
|
|
27
|
+
/** Longest string admitted. */
|
|
28
|
+
max: number;
|
|
29
|
+
/** Message for the over-`max` issue, in place of Zod's default. */
|
|
30
|
+
max_message?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A string schema whose length is bounded in UTF-16 code units — what
|
|
34
|
+
* `String.length` measures, and what the Rust spine counts
|
|
35
|
+
* (`encode_utf16().count()`), so an astral-plane character costs two on both.
|
|
36
|
+
* Every `.min()` / `.max()` length bound on a wire string in the package is
|
|
37
|
+
* built here, bar a bare `.min(1)`, which reads the same in either count.
|
|
38
|
+
*
|
|
39
|
+
* Zod's `.min()` / `.max()` alone don't pin the unit: depending on the
|
|
40
|
+
* installed Zod they count code units or Unicode code points, and the peer
|
|
41
|
+
* range admits both. The schema still carries them — they are what puts
|
|
42
|
+
* `minLength` / `maxLength` in the generated JSON Schema — and a check beside
|
|
43
|
+
* them settles the verdict on `String.length`: it adds the over-`max` or
|
|
44
|
+
* under-`min` issue when Zod raised none, and withdraws one Zod raised for a
|
|
45
|
+
* string that is within the bound in units. The issue it adds has the fields
|
|
46
|
+
* of Zod's own and, like Zod's, lets the checks chained after it run, so a
|
|
47
|
+
* refusal reads the same whichever count Zod used.
|
|
48
|
+
*
|
|
49
|
+
* Returns a plain `ZodString`, so format checks, `.brand()`, `.nullish()` and
|
|
50
|
+
* `.meta()` chain as usual. Don't chain a further `.min()` / `.max()` — pass
|
|
51
|
+
* the bound here.
|
|
52
|
+
*
|
|
53
|
+
* @param options - the bounds, in UTF-16 code units
|
|
54
|
+
* @returns the bounded string schema
|
|
55
|
+
*/
|
|
56
|
+
export declare const bounded_string: ({ min, max, max_message }: BoundedStringOptions) => z.ZodString;
|
|
18
57
|
/** Minimum username length (must have start + middle + end characters). */
|
|
19
58
|
export declare const USERNAME_LENGTH_MIN = 3;
|
|
20
|
-
/** Maximum username length (matches GitHub's limit). */
|
|
59
|
+
/** Maximum username length (matches GitHub's limit). The grammar is ASCII, so units and characters agree. */
|
|
21
60
|
export declare const USERNAME_LENGTH_MAX = 39;
|
|
22
|
-
/** Maximum length for username input on login/lookup — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
61
|
+
/** Maximum length for username input on login/lookup, in UTF-16 code units, measured before trimming — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
23
62
|
export declare const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
24
63
|
/**
|
|
25
64
|
* Username for account creation — starts with letter, alphanumeric/dash/underscore middle, ends with alphanumeric. No @ or . allowed.
|
|
@@ -78,4 +117,39 @@ export declare const EMAIL_LENGTH_MAX = 254;
|
|
|
78
117
|
*/
|
|
79
118
|
export declare const Email: z.ZodString;
|
|
80
119
|
export type Email = z.infer<typeof Email>;
|
|
120
|
+
/** Returns a new random (v4) `Uuid`. */
|
|
121
|
+
export declare const create_uuid: () => Uuid;
|
|
122
|
+
/** Branded UUID schema. */
|
|
123
|
+
export declare const Uuid: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
124
|
+
export type Uuid = z.infer<typeof Uuid>;
|
|
125
|
+
/** `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
|
|
126
|
+
export declare const UuidWithDefault: z.ZodDefault<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
127
|
+
export type UuidWithDefault = z.infer<typeof UuidWithDefault>;
|
|
128
|
+
/** Branded ISO 8601 datetime schema. */
|
|
129
|
+
export declare const Datetime: z.core.$ZodBranded<z.ZodISODateTime, "Datetime", "out">;
|
|
130
|
+
export type Datetime = z.infer<typeof Datetime>;
|
|
131
|
+
/** Returns an ISO 8601 datetime string for the current time. */
|
|
132
|
+
export declare const get_datetime_now: () => Datetime;
|
|
133
|
+
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
134
|
+
export declare const DatetimeNow: z.ZodDefault<z.core.$ZodBranded<z.ZodISODateTime, "Datetime", "out">>;
|
|
135
|
+
export type DatetimeNow = z.infer<typeof DatetimeNow>;
|
|
136
|
+
/** Zod schema for a BLAKE3 hex hash — 64 lowercase hex characters (256-bit output). */
|
|
137
|
+
export declare const Blake3Hash: z.ZodString;
|
|
138
|
+
export type Blake3Hash = z.infer<typeof Blake3Hash>;
|
|
139
|
+
/**
|
|
140
|
+
* Wire-form schema for a `blake3:`-prefixed fact hash, whose output is
|
|
141
|
+
* `FactHash` from `@fuzdev/fuz_util/hash_schemas.ts` — the type
|
|
142
|
+
* `fact_hash_bytes`, `fact_hash_stream`, and `FactStore` use — so a parsed
|
|
143
|
+
* value passes straight to them. Client-side (cell payloads) and server-side
|
|
144
|
+
* (DB-row hashes) consumers reuse this same schema.
|
|
145
|
+
*
|
|
146
|
+
* The output type is a cast over a plain regex check: Zod's `.brand('FactHash')`
|
|
147
|
+
* would output Zod's own brand, which doesn't fit fuz_util's fuz_schema-branded
|
|
148
|
+
* `FactHash`, and a `.transform` or `z.custom` that produced the right type
|
|
149
|
+
* makes `z.toJSONSchema` throw, as neither can be represented in JSON Schema.
|
|
150
|
+
* The cast costs nothing at runtime and keeps the `ZodString` API and the
|
|
151
|
+
* `pattern` in the generated JSON Schema, so `.meta()`, `.nullable()`, and
|
|
152
|
+
* `z.array()` compose as before.
|
|
153
|
+
*/
|
|
154
|
+
export declare const FactHashSchema: z.ZodString & z.ZodType<FactHash, string>;
|
|
81
155
|
//# sourceMappingURL=primitive_schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/primitive_schemas.ts"],"names":[],"mappings":"AAAA
|
|
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;AAEt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M,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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reusable validator-schema primitives — `
|
|
3
|
-
* `Email
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Reusable validator-schema primitives — `bounded_string`, `Username`,
|
|
3
|
+
* `UsernameProvided`, `Email`, the branded `Uuid` and `Datetime` with their
|
|
4
|
+
* factories, and the hash schemas `Blake3Hash` and `FactHashSchema`. Lives at
|
|
5
|
+
* the top level (not inside `auth/` or `http/`) because these shapes don't
|
|
6
|
+
* depend on or imply any domain — accounts hold a username and email, but
|
|
7
|
+
* invites, password resets, cells, and other surfaces all reach for the same
|
|
8
|
+
* primitives without going through auth.
|
|
8
9
|
*
|
|
9
10
|
* Split out from `auth/account_schema.ts` so the auth module shrinks to
|
|
10
11
|
* entity types + client-safe JSON shapes (its real responsibility) and
|
|
@@ -12,15 +13,89 @@
|
|
|
12
13
|
* auth domain along. Future cross-domain primitives (phone, url, slug)
|
|
13
14
|
* land here too.
|
|
14
15
|
*
|
|
16
|
+
* Client-safe: nothing here imports `@fuzdev/blake3-wasm`, so wire schemas
|
|
17
|
+
* that validate a hash don't pull the WASM binary into a bundle.
|
|
18
|
+
*
|
|
15
19
|
* @module
|
|
16
20
|
*/
|
|
17
21
|
import { z } from 'zod';
|
|
18
|
-
|
|
22
|
+
import { FACT_HASH_EXACT } from '@fuzdev/fuz_util/hash_schemas.ts';
|
|
23
|
+
/**
|
|
24
|
+
* A string schema whose length is bounded in UTF-16 code units — what
|
|
25
|
+
* `String.length` measures, and what the Rust spine counts
|
|
26
|
+
* (`encode_utf16().count()`), so an astral-plane character costs two on both.
|
|
27
|
+
* Every `.min()` / `.max()` length bound on a wire string in the package is
|
|
28
|
+
* built here, bar a bare `.min(1)`, which reads the same in either count.
|
|
29
|
+
*
|
|
30
|
+
* Zod's `.min()` / `.max()` alone don't pin the unit: depending on the
|
|
31
|
+
* installed Zod they count code units or Unicode code points, and the peer
|
|
32
|
+
* range admits both. The schema still carries them — they are what puts
|
|
33
|
+
* `minLength` / `maxLength` in the generated JSON Schema — and a check beside
|
|
34
|
+
* them settles the verdict on `String.length`: it adds the over-`max` or
|
|
35
|
+
* under-`min` issue when Zod raised none, and withdraws one Zod raised for a
|
|
36
|
+
* string that is within the bound in units. The issue it adds has the fields
|
|
37
|
+
* of Zod's own and, like Zod's, lets the checks chained after it run, so a
|
|
38
|
+
* refusal reads the same whichever count Zod used.
|
|
39
|
+
*
|
|
40
|
+
* Returns a plain `ZodString`, so format checks, `.brand()`, `.nullish()` and
|
|
41
|
+
* `.meta()` chain as usual. Don't chain a further `.min()` / `.max()` — pass
|
|
42
|
+
* the bound here.
|
|
43
|
+
*
|
|
44
|
+
* @param options - the bounds, in UTF-16 code units
|
|
45
|
+
* @returns the bounded string schema
|
|
46
|
+
*/
|
|
47
|
+
export const bounded_string = ({ min, max, max_message }) => {
|
|
48
|
+
let schema = z.string();
|
|
49
|
+
if (min !== undefined)
|
|
50
|
+
schema = schema.min(min);
|
|
51
|
+
schema = max_message === undefined ? schema.max(max) : schema.max(max, max_message);
|
|
52
|
+
return schema.check((ctx) => {
|
|
53
|
+
const { length } = ctx.value;
|
|
54
|
+
const { issues } = ctx;
|
|
55
|
+
const too_big = issues.findIndex((i) => i.code === 'too_big' && i.origin === 'string' && i.maximum === max);
|
|
56
|
+
if (length > max) {
|
|
57
|
+
if (too_big === -1) {
|
|
58
|
+
issues.push({
|
|
59
|
+
origin: 'string',
|
|
60
|
+
code: 'too_big',
|
|
61
|
+
maximum: max,
|
|
62
|
+
inclusive: true,
|
|
63
|
+
input: ctx.value,
|
|
64
|
+
// as on Zod's own length issues: the checks chained after still run
|
|
65
|
+
continue: true,
|
|
66
|
+
// `path` ahead of `message`, the key order of Zod's finalized issue
|
|
67
|
+
...(max_message !== undefined && { path: [], message: max_message })
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (too_big !== -1) {
|
|
72
|
+
issues.splice(too_big, 1);
|
|
73
|
+
}
|
|
74
|
+
if (min === undefined)
|
|
75
|
+
return;
|
|
76
|
+
const too_small = issues.findIndex((i) => i.code === 'too_small' && i.origin === 'string' && i.minimum === min);
|
|
77
|
+
if (length < min) {
|
|
78
|
+
if (too_small === -1) {
|
|
79
|
+
issues.push({
|
|
80
|
+
origin: 'string',
|
|
81
|
+
code: 'too_small',
|
|
82
|
+
minimum: min,
|
|
83
|
+
inclusive: true,
|
|
84
|
+
input: ctx.value,
|
|
85
|
+
continue: true
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (too_small !== -1) {
|
|
90
|
+
issues.splice(too_small, 1);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
19
94
|
/** Minimum username length (must have start + middle + end characters). */
|
|
20
95
|
export const USERNAME_LENGTH_MIN = 3;
|
|
21
|
-
/** Maximum username length (matches GitHub's limit). */
|
|
96
|
+
/** Maximum username length (matches GitHub's limit). The grammar is ASCII, so units and characters agree. */
|
|
22
97
|
export const USERNAME_LENGTH_MAX = 39;
|
|
23
|
-
/** Maximum length for username input on login/lookup — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
98
|
+
/** Maximum length for username input on login/lookup, in UTF-16 code units, measured before trimming — more permissive than `USERNAME_LENGTH_MAX` for forward-compatibility if the creation limit is raised. */
|
|
24
99
|
export const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
25
100
|
/**
|
|
26
101
|
* Username for account creation — starts with letter, alphanumeric/dash/underscore middle, ends with alphanumeric. No @ or . allowed.
|
|
@@ -32,10 +107,7 @@ export const USERNAME_PROVIDED_LENGTH_MAX = 255;
|
|
|
32
107
|
* per-caller `trim().toLowerCase()` ritual and keeps the
|
|
33
108
|
* `LOWER(username) = LOWER($1)` lookup contract simple.
|
|
34
109
|
*/
|
|
35
|
-
export const Username =
|
|
36
|
-
.string()
|
|
37
|
-
.min(USERNAME_LENGTH_MIN)
|
|
38
|
-
.max(USERNAME_LENGTH_MAX)
|
|
110
|
+
export const Username = bounded_string({ min: USERNAME_LENGTH_MIN, max: USERNAME_LENGTH_MAX })
|
|
39
111
|
.regex(/^[a-zA-Z][0-9a-zA-Z_-]*[0-9a-zA-Z]$/)
|
|
40
112
|
.transform((s) => s.toLowerCase());
|
|
41
113
|
/**
|
|
@@ -53,10 +125,7 @@ export const Username = z
|
|
|
53
125
|
* input, not a wrong credential. Keeps the Rust spine's
|
|
54
126
|
* `account_login` (which rejects empty-after-trim) in parity.
|
|
55
127
|
*/
|
|
56
|
-
export const UsernameProvided =
|
|
57
|
-
.string()
|
|
58
|
-
.min(1)
|
|
59
|
-
.max(USERNAME_PROVIDED_LENGTH_MAX)
|
|
128
|
+
export const UsernameProvided = bounded_string({ min: 1, max: USERNAME_PROVIDED_LENGTH_MAX })
|
|
60
129
|
.transform((s) => s.trim().toLowerCase())
|
|
61
130
|
.refine((s) => s.length > 0, { message: 'Username must not be empty after trimming whitespace' });
|
|
62
131
|
/**
|
|
@@ -112,3 +181,37 @@ export const Email = z
|
|
|
112
181
|
.refine((s) => s.length <= EMAIL_LENGTH_MAX && utf8_encoder.encode(s).length <= EMAIL_LENGTH_MAX, {
|
|
113
182
|
message: `Email must be at most ${EMAIL_LENGTH_MAX} bytes`
|
|
114
183
|
});
|
|
184
|
+
/** Returns a new random (v4) `Uuid`. */
|
|
185
|
+
export const create_uuid = () => crypto.randomUUID();
|
|
186
|
+
/** Branded UUID schema. */
|
|
187
|
+
export const Uuid = z.uuid().brand('Uuid');
|
|
188
|
+
/** `Uuid` that defaults to a fresh `create_uuid()` when the input is `undefined`. */
|
|
189
|
+
export const UuidWithDefault = Uuid.default(create_uuid);
|
|
190
|
+
/** Branded ISO 8601 datetime schema. */
|
|
191
|
+
export const Datetime = z.iso.datetime().brand('Datetime');
|
|
192
|
+
/** Returns an ISO 8601 datetime string for the current time. */
|
|
193
|
+
export const get_datetime_now = () => new Date().toISOString();
|
|
194
|
+
/** `Datetime` that defaults to `get_datetime_now()` when the input is `undefined`. */
|
|
195
|
+
export const DatetimeNow = Datetime.default(get_datetime_now);
|
|
196
|
+
/** Zod schema for a BLAKE3 hex hash — 64 lowercase hex characters (256-bit output). */
|
|
197
|
+
export const Blake3Hash = z
|
|
198
|
+
.string()
|
|
199
|
+
.regex(/^[0-9a-f]{64}$/, 'Expected a 64-character lowercase hex blake3 hash');
|
|
200
|
+
/**
|
|
201
|
+
* Wire-form schema for a `blake3:`-prefixed fact hash, whose output is
|
|
202
|
+
* `FactHash` from `@fuzdev/fuz_util/hash_schemas.ts` — the type
|
|
203
|
+
* `fact_hash_bytes`, `fact_hash_stream`, and `FactStore` use — so a parsed
|
|
204
|
+
* value passes straight to them. Client-side (cell payloads) and server-side
|
|
205
|
+
* (DB-row hashes) consumers reuse this same schema.
|
|
206
|
+
*
|
|
207
|
+
* The output type is a cast over a plain regex check: Zod's `.brand('FactHash')`
|
|
208
|
+
* would output Zod's own brand, which doesn't fit fuz_util's fuz_schema-branded
|
|
209
|
+
* `FactHash`, and a `.transform` or `z.custom` that produced the right type
|
|
210
|
+
* makes `z.toJSONSchema` throw, as neither can be represented in JSON Schema.
|
|
211
|
+
* The cast costs nothing at runtime and keeps the `ZodString` API and the
|
|
212
|
+
* `pattern` in the generated JSON Schema, so `.meta()`, `.nullable()`, and
|
|
213
|
+
* `z.array()` compose as before.
|
|
214
|
+
*/
|
|
215
|
+
export const FactHashSchema = z
|
|
216
|
+
.string()
|
|
217
|
+
.regex(FACT_HASH_EXACT);
|
|
@@ -93,8 +93,7 @@
|
|
|
93
93
|
import { createReadStream } from 'node:fs';
|
|
94
94
|
import { Readable } from 'node:stream';
|
|
95
95
|
import { join } from 'node:path';
|
|
96
|
-
import { FactHashSchema } from '
|
|
97
|
-
import { Uuid } from '@fuzdev/fuz_util/id.ts';
|
|
96
|
+
import { FactHashSchema, Uuid } from '../primitive_schemas.js';
|
|
98
97
|
import { z } from 'zod';
|
|
99
98
|
import { build_request_context, get_request_context, has_scoped_role } from '../auth/request_context.js';
|
|
100
99
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
package/dist/server/x_accel.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ export declare const validate_facts_internal_location: (config: string, facts_lo
|
|
|
50
50
|
* an explicit cast, so the factory is the only ordinary construction path.
|
|
51
51
|
*/
|
|
52
52
|
export declare const XAccelConfig: z.core.$ZodBranded<z.ZodObject<{
|
|
53
|
-
/** The validated redirect prefix the serving path prepends (e.g. `/_facts/`). */
|
|
54
53
|
redirect_prefix: z.ZodString;
|
|
55
54
|
}, z.core.$strict>, "XAccelConfig", "out">;
|
|
56
55
|
export type XAccelConfig = z.infer<typeof XAccelConfig>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x_accel.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/server/x_accel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,0CAA0C;AAC1C,MAAM,WAAW,oBAAoB;IACpC,gEAAgE;IAChE,EAAE,EAAE,OAAO,CAAC;IACZ,iEAAiE;IACjE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAuDD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,GAC5C,QAAQ,MAAM,EACd,gBAAgB,MAAM,KACpB,oBAqBF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"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