@fuzdev/fuz_app 0.141.0 → 0.143.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/CLAUDE.md +10 -5
- package/dist/actions/connection_closer.d.ts +19 -2
- package/dist/actions/connection_closer.d.ts.map +1 -1
- package/dist/actions/connection_closer.js +25 -2
- package/dist/actions/perform_action.d.ts +10 -0
- package/dist/actions/perform_action.d.ts.map +1 -1
- package/dist/actions/perform_action.js +23 -9
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +5 -2
- package/dist/auth/CLAUDE.md +33 -13
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +12 -1
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +8 -0
- package/dist/auth/account_routes.d.ts +7 -2
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +240 -187
- package/dist/auth/admin_action_specs.d.ts +6 -1
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +6 -1
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +14 -2
- package/dist/auth/bootstrap_routes.d.ts.map +1 -1
- package/dist/auth/bootstrap_routes.js +85 -76
- package/dist/auth/cell_action_specs.d.ts +7 -3
- package/dist/auth/cell_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_action_specs.js +9 -5
- package/dist/auth/cell_actions.d.ts +3 -3
- package/dist/auth/cell_actions.d.ts.map +1 -1
- package/dist/auth/cell_actions.js +67 -38
- package/dist/auth/cell_authorize.d.ts +69 -8
- package/dist/auth/cell_authorize.d.ts.map +1 -1
- package/dist/auth/cell_authorize.js +89 -9
- package/dist/auth/cell_field_action_specs.d.ts +5 -4
- package/dist/auth/cell_field_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_field_action_specs.js +7 -7
- package/dist/auth/cell_field_actions.d.ts +7 -5
- package/dist/auth/cell_field_actions.d.ts.map +1 -1
- package/dist/auth/cell_field_actions.js +24 -22
- package/dist/auth/cell_grant_action_specs.d.ts +6 -0
- package/dist/auth/cell_grant_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_grant_action_specs.js +6 -0
- package/dist/auth/cell_grant_actions.d.ts +3 -1
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +16 -2
- package/dist/auth/cell_item_action_specs.d.ts +5 -4
- package/dist/auth/cell_item_action_specs.d.ts.map +1 -1
- package/dist/auth/cell_item_action_specs.js +7 -7
- package/dist/auth/cell_item_actions.d.ts +6 -5
- package/dist/auth/cell_item_actions.d.ts.map +1 -1
- package/dist/auth/cell_item_actions.js +23 -22
- package/dist/auth/cell_relation_list_limit.d.ts +20 -0
- package/dist/auth/cell_relation_list_limit.d.ts.map +1 -0
- package/dist/auth/cell_relation_list_limit.js +27 -0
- package/dist/auth/cell_relation_visibility.d.ts +4 -3
- package/dist/auth/cell_relation_visibility.d.ts.map +1 -1
- package/dist/auth/cell_relation_visibility.js +6 -5
- package/dist/auth/cell_steward.d.ts +45 -0
- package/dist/auth/cell_steward.d.ts.map +1 -0
- package/dist/auth/cell_steward.js +53 -0
- package/dist/auth/request_context.d.ts +4 -0
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +6 -1
- package/dist/auth/role_grant_offer_action_specs.d.ts +5 -0
- package/dist/auth/role_grant_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_action_specs.js +6 -1
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +23 -16
- package/dist/auth/role_grant_offer_queries.d.ts +8 -6
- package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_queries.js +16 -8
- package/dist/auth/signup_routes.d.ts +4 -3
- package/dist/auth/signup_routes.d.ts.map +1 -1
- package/dist/auth/signup_routes.js +157 -134
- package/dist/auth/token_scope.d.ts +7 -1
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +8 -2
- package/dist/db/CLAUDE.md +32 -19
- package/dist/db/cell_ddl.d.ts +1 -2
- package/dist/db/cell_ddl.d.ts.map +1 -1
- package/dist/db/cell_ddl.js +1 -2
- package/dist/db/cell_field_queries.d.ts +20 -18
- package/dist/db/cell_field_queries.d.ts.map +1 -1
- package/dist/db/cell_field_queries.js +28 -22
- package/dist/db/cell_item_queries.d.ts +20 -14
- package/dist/db/cell_item_queries.d.ts.map +1 -1
- package/dist/db/cell_item_queries.js +28 -18
- package/dist/db/cell_moderation.d.ts +67 -0
- package/dist/db/cell_moderation.d.ts.map +1 -0
- package/dist/db/cell_moderation.js +66 -0
- package/dist/db/cell_queries.d.ts +44 -14
- package/dist/db/cell_queries.d.ts.map +1 -1
- package/dist/db/cell_queries.js +68 -45
- package/dist/db/cell_view_sql.d.ts +102 -0
- package/dist/db/cell_view_sql.d.ts.map +1 -0
- package/dist/db/cell_view_sql.js +112 -0
- package/dist/db/db_pg.d.ts +1 -1
- package/dist/db/db_pg.js +1 -1
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/auth_shape.d.ts +5 -2
- package/dist/http/auth_shape.d.ts.map +1 -1
- package/dist/http/auth_shape.js +5 -2
- package/dist/http/ip_canonical.d.ts +56 -5
- package/dist/http/ip_canonical.d.ts.map +1 -1
- package/dist/http/ip_canonical.js +147 -35
- package/dist/primitive_schemas.d.ts +10 -1
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +11 -2
- package/dist/rate_limiter.d.ts +179 -12
- package/dist/rate_limiter.d.ts.map +1 -1
- package/dist/rate_limiter.js +352 -42
- package/dist/server/serve_fact_route.d.ts +8 -4
- package/dist/server/serve_fact_route.d.ts.map +1 -1
- package/dist/server/serve_fact_route.js +15 -6
- package/dist/testing/CLAUDE.md +16 -7
- package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
- package/dist/testing/cross_backend/account_lifecycle.js +37 -2
- package/dist/testing/cross_backend/cell_gated_create.d.ts +38 -0
- package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_gated_create.js +401 -5
- package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
- package/dist/testing/cross_backend/cell_relations.js +145 -2
- package/dist/testing/cross_backend/expected_schema.json +0 -1
- package/dist/testing/cross_backend/full_spine_mount.js +2 -1
- package/dist/testing/cross_backend/login_security.d.ts +16 -0
- package/dist/testing/cross_backend/login_security.d.ts.map +1 -1
- package/dist/testing/cross_backend/login_security.js +154 -0
- package/dist/testing/cross_backend/origin_conformance.d.ts +1 -1
- package/dist/testing/cross_backend/origin_conformance.d.ts.map +1 -1
- package/dist/testing/cross_backend/origin_conformance.js +1 -1
- package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
- package/dist/testing/cross_backend/query_shape.js +24 -2
- package/dist/testing/cross_backend/role_grant_participation.d.ts.map +1 -1
- package/dist/testing/cross_backend/role_grant_participation.js +64 -0
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +13 -21
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +13 -21
- package/dist/testing/cross_backend/testing_origin_check.d.ts +128 -0
- package/dist/testing/cross_backend/testing_origin_check.d.ts.map +1 -0
- package/dist/testing/cross_backend/testing_origin_check.js +87 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +7 -119
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +8 -92
- package/dist/testing/cross_backend/ws_action_rate_limit.d.ts.map +1 -1
- package/dist/testing/cross_backend/ws_action_rate_limit.js +21 -1
- package/dist/testing/schema_introspect.js +1 -1
- package/dist/testing/schema_parity.d.ts +4 -3
- package/dist/testing/schema_parity.d.ts.map +1 -1
- package/dist/testing/schema_parity.js +4 -3
- package/dist/testing/schema_ready_fixture.d.ts +2 -4
- package/dist/testing/schema_ready_fixture.d.ts.map +1 -1
- package/dist/testing/schema_ready_fixture.js +2 -4
- package/dist/ui/auth_state.svelte.d.ts +10 -0
- package/dist/ui/auth_state.svelte.d.ts.map +1 -1
- package/dist/ui/auth_state.svelte.js +22 -4
- package/package.json +1 -1
- package/dist/db/cell_history_ddl.d.ts +0 -38
- package/dist/db/cell_history_ddl.d.ts.map +0 -1
- package/dist/db/cell_history_ddl.js +0 -61
|
@@ -23,7 +23,9 @@ import '../assert_dev_env.js';
|
|
|
23
23
|
* 'ip'`, public) with malformed params, from one `X-Forwarded-For` address
|
|
24
24
|
* over anonymous HTTP and over a WS whose upgrade carried the same header:
|
|
25
25
|
* the call past the cap is refused on both, while a second address keeps its
|
|
26
|
-
* own budget on both.
|
|
26
|
+
* own budget on both. Over HTTP, IPv6 addresses bucket by their `/64`:
|
|
27
|
+
* another address in the same `/64` is refused once one has spent the
|
|
28
|
+
* budget, while one in the next `/64` keeps its own.
|
|
27
29
|
* - **account axis at the dispatchers** — `cell_create` (`rate_limit:
|
|
28
30
|
* 'account'`, on both spines' RPC and WS mounts) with malformed params: the
|
|
29
31
|
* call past the cap answers `429` over HTTP and `rate_limited` over WS, calls
|
|
@@ -84,6 +86,13 @@ const IP_LIMITED_BAD_PARAMS = { nonce: 'not_a_number' };
|
|
|
84
86
|
*/
|
|
85
87
|
const XFF_IP_EXHAUSTED = '198.51.100.1';
|
|
86
88
|
const XFF_IP_FRESH = '198.51.100.2';
|
|
89
|
+
/**
|
|
90
|
+
* RFC 3849 documentation addresses: two in one `/64` — the second differs past
|
|
91
|
+
* bit 64 only — and one in the next `/64`. Distinct from `login_security.ts`'s.
|
|
92
|
+
*/
|
|
93
|
+
const XFF_V6_EXHAUSTED = '2001:db8:e3a:1::1';
|
|
94
|
+
const XFF_V6_SAME_64 = '2001:db8:e3a:1:8000::2';
|
|
95
|
+
const XFF_V6_OTHER_64 = '2001:db8:e3a:2::1';
|
|
87
96
|
/** Generous per-response wait — the cases assert the server's answer, not a timeout. */
|
|
88
97
|
const RESPONSE_TIMEOUT_MS = 5000;
|
|
89
98
|
const outcome_from_frame = (status, frame) => ({
|
|
@@ -254,5 +263,16 @@ export const describe_ws_action_rate_limit_cross_tests = (options) => {
|
|
|
254
263
|
await ws_fresh.close();
|
|
255
264
|
}
|
|
256
265
|
});
|
|
266
|
+
test('an IP-limited action buckets IPv6 clients by /64', async () => {
|
|
267
|
+
const fixture = await setup_test();
|
|
268
|
+
const call = (forwarded_for) => call_http(fixture, IP_LIMITED_METHOD, IP_LIMITED_BAD_PARAMS, {
|
|
269
|
+
'x-forwarded-for': forwarded_for
|
|
270
|
+
});
|
|
271
|
+
for (let i = 1; i <= max_attempts; i++) {
|
|
272
|
+
assert_charged_not_limited(await call(XFF_V6_EXHAUSTED), `call ${i} from ${XFF_V6_EXHAUSTED}`);
|
|
273
|
+
}
|
|
274
|
+
assert_rate_limited(await call(XFF_V6_SAME_64), `a call from ${XFF_V6_SAME_64}, same /64`);
|
|
275
|
+
assert_charged_not_limited(await call(XFF_V6_OTHER_64), `a call from ${XFF_V6_OTHER_64}, the next /64`);
|
|
276
|
+
});
|
|
257
277
|
});
|
|
258
278
|
};
|
|
@@ -105,7 +105,7 @@ export const SchemaSnapshot = z.object({
|
|
|
105
105
|
* to the schema snapshot — is a gated fact, not a latent interop break.
|
|
106
106
|
*/
|
|
107
107
|
export const MigrationTrackerEntry = z.object({
|
|
108
|
-
/** Migration namespace (e.g. `
|
|
108
|
+
/** Migration namespace (e.g. `fuz_auth`, `fuz_cell`). */
|
|
109
109
|
namespace: z.string(),
|
|
110
110
|
/** Migration name within the namespace (e.g. `full_cell_schema`). */
|
|
111
111
|
name: z.string(),
|
|
@@ -175,9 +175,10 @@ export declare const format_migration_tracker_diffs: (diffs: ReadonlyArray<Migra
|
|
|
175
175
|
* re-bootstrapping). This catches what `assert_schema_snapshots_equal` is blind
|
|
176
176
|
* to by design: the snapshot excludes the tracker, so a migration-name or
|
|
177
177
|
* partitioning divergence that yields an identical *schema* (e.g. `cell_v0` vs
|
|
178
|
-
* `full_cell_schema`, or
|
|
179
|
-
* parity but breaks the runner's positional name-prefix
|
|
180
|
-
* (`name-divergence-at-N`). The error names the impls and lists
|
|
178
|
+
* `full_cell_schema`, or a table bundled into one namespace vs isolated in its
|
|
179
|
+
* own) passes schema parity but breaks the runner's positional name-prefix
|
|
180
|
+
* check at boot (`name-divergence-at-N`). The error names the impls and lists
|
|
181
|
+
* every diff.
|
|
181
182
|
*/
|
|
182
183
|
export declare const assert_migration_trackers_equal: (a: MigrationTracker, b: MigrationTracker, labels?: SchemaDiffLabels) => void;
|
|
183
184
|
//# sourceMappingURL=schema_parity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_parity.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_parity.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EACX,cAAc,EAEd,gBAAgB,EAChB,cAAc,EAGd,MAAM,wBAAwB,CAAC;AAEhC,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrF;IACA,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACvB,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CA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SAAQ,gBAAqB,KAC3B,MAoEF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,6BAA6B,GACzC,GAAG,cAAc,EACjB,GAAG,cAAc,EACjB,SAAQ,gBAAqB,KAC3B,IAUF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAC7B;IACA,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACrB,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIL;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GACnC,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,KACjB,KAAK,CAAC,oBAAoB,CAwC5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B,GAC1C,OAAO,aAAa,CAAC,oBAAoB,CAAC,EAC1C,SAAQ,gBAAqB,KAC3B,MAyBF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,GAC3C,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,EACnB,SAAQ,gBAAqB,KAC3B,IAUF,CAAC"}
|
|
@@ -304,9 +304,10 @@ export const format_migration_tracker_diffs = (diffs, labels = {}) => {
|
|
|
304
304
|
* re-bootstrapping). This catches what `assert_schema_snapshots_equal` is blind
|
|
305
305
|
* to by design: the snapshot excludes the tracker, so a migration-name or
|
|
306
306
|
* partitioning divergence that yields an identical *schema* (e.g. `cell_v0` vs
|
|
307
|
-
* `full_cell_schema`, or
|
|
308
|
-
* parity but breaks the runner's positional name-prefix
|
|
309
|
-
* (`name-divergence-at-N`). The error names the impls and lists
|
|
307
|
+
* `full_cell_schema`, or a table bundled into one namespace vs isolated in its
|
|
308
|
+
* own) passes schema parity but breaks the runner's positional name-prefix
|
|
309
|
+
* check at boot (`name-divergence-at-N`). The error names the impls and lists
|
|
310
|
+
* every diff.
|
|
310
311
|
*/
|
|
311
312
|
export const assert_migration_trackers_equal = (a, b, labels = {}) => {
|
|
312
313
|
const diffs = diff_migration_trackers(a, b);
|
|
@@ -35,10 +35,8 @@ export interface SyncExpectedSchemaFixtureResult {
|
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* When `update` writes the fixture it emits raw `JSON.stringify` (one array
|
|
38
|
-
* element per line)
|
|
39
|
-
*
|
|
40
|
-
* the regenerated file. (The content is identical either way — the regen test
|
|
41
|
-
* compares values, not formatting.)
|
|
38
|
+
* element per line). `gro format` leaves JSON untouched and the regen test compares values, not
|
|
39
|
+
* formatting, so the layout is cosmetic.
|
|
42
40
|
*
|
|
43
41
|
* @returns the live column map and the committed map (post-write when `update`)
|
|
44
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_ready_fixture.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_ready_fixture.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAElF,kDAAkD;AAClD,MAAM,WAAW,gCAAgC;IAChD,+EAA+E;IAC/E,EAAE,EAAE,EAAE,CAAC;IACP,gFAAgF;IAChF,WAAW,EAAE,GAAG,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,WAAW,+BAA+B;IAC/C,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACpC,mEAAmE;IACnE,SAAS,EAAE,cAAc,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"schema_ready_fixture.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_ready_fixture.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAElF,kDAAkD;AAClD,MAAM,WAAW,gCAAgC;IAChD,+EAA+E;IAC/E,EAAE,EAAE,EAAE,CAAC;IACP,gFAAgF;IAChF,WAAW,EAAE,GAAG,GAAG,MAAM,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,kFAAkF;AAClF,MAAM,WAAW,+BAA+B;IAC/C,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACpC,mEAAmE;IACnE,SAAS,EAAE,cAAc,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,4BAA4B,GACxC,SAAS,gCAAgC,KACvC,OAAO,CAAC,+BAA+B,CAQzC,CAAC"}
|
|
@@ -30,10 +30,8 @@ import { query_public_columns } from '../db/schema_ready.js';
|
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
32
|
* When `update` writes the fixture it emits raw `JSON.stringify` (one array
|
|
33
|
-
* element per line)
|
|
34
|
-
*
|
|
35
|
-
* the regenerated file. (The content is identical either way — the regen test
|
|
36
|
-
* compares values, not formatting.)
|
|
33
|
+
* element per line). `gro format` leaves JSON untouched and the regen test compares values, not
|
|
34
|
+
* formatting, so the layout is cosmetic.
|
|
37
35
|
*
|
|
38
36
|
* @returns the live column map and the committed map (post-write when `update`)
|
|
39
37
|
*/
|
|
@@ -32,6 +32,16 @@
|
|
|
32
32
|
* @module
|
|
33
33
|
*/
|
|
34
34
|
import { type ActorSummaryJson, type RoleGrantSummaryJson, type SessionAccount } from '../auth/account_schema.js';
|
|
35
|
+
/**
|
|
36
|
+
* The message a `429` shows, from its `retry_after` (seconds).
|
|
37
|
+
*
|
|
38
|
+
* A short wait reads as one — the spines answer `retry_after: 1` when the cap
|
|
39
|
+
* is held only by attempts still in flight — rather than rounding up to a
|
|
40
|
+
* minute; a missing value reads as a minute.
|
|
41
|
+
*
|
|
42
|
+
* @param retry_after - the response's `retry_after`, when it carried one
|
|
43
|
+
*/
|
|
44
|
+
export declare const format_rate_limit_message: (retry_after: unknown) => string;
|
|
35
45
|
/**
|
|
36
46
|
* Svelte context for `AuthState`.
|
|
37
47
|
* Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_state.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/ui/auth_state.svelte.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,MAAM,2BAA2B,CAAC;AAGnC;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;CAA8B,CAAC;AAE9D,qBAAa,SAAS;IACrB,SAAS,UAAqB;IAC9B,QAAQ,UAAqB;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAoB;IAC/C,OAAO,EAAE,cAAc,GAAG,IAAI,CAAoB;IAClD,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAoB;IAClD,WAAW,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAkB;IAC1D;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,EA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AC,MAAM,CAAC,CAExC;IACF,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAA+C;IAEzE,gEAAgE;IAChE,eAAe,UAAqB;IAEpC;;;;;;OAMG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAItC;;;;;;;;OAQG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BpC;;;;;;;OAOG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuCjE;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiCpF;;;;;;;OAOG;IACG,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA2ClF;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAe7B"}
|
|
@@ -36,6 +36,26 @@ import { create_context } from '@fuzdev/fuz_ui/context_helpers.ts';
|
|
|
36
36
|
import { ui_fetch } from './ui_fetch.js';
|
|
37
37
|
import { is_role_grant_active } from '../auth/account_schema.js';
|
|
38
38
|
import { ROLE_ADMIN } from '../auth/role_schema.js';
|
|
39
|
+
/**
|
|
40
|
+
* The message a `429` shows, from its `retry_after` (seconds).
|
|
41
|
+
*
|
|
42
|
+
* A short wait reads as one — the spines answer `retry_after: 1` when the cap
|
|
43
|
+
* is held only by attempts still in flight — rather than rounding up to a
|
|
44
|
+
* minute; a missing value reads as a minute.
|
|
45
|
+
*
|
|
46
|
+
* @param retry_after - the response's `retry_after`, when it carried one
|
|
47
|
+
*/
|
|
48
|
+
export const format_rate_limit_message = (retry_after) => {
|
|
49
|
+
const seconds = typeof retry_after === 'number' && retry_after > 0 ? retry_after : 60;
|
|
50
|
+
if (seconds <= 5)
|
|
51
|
+
return 'Too many attempts. Try again in a moment.';
|
|
52
|
+
if (seconds < 60) {
|
|
53
|
+
const whole = Math.ceil(seconds);
|
|
54
|
+
return `Too many attempts. Try again in ${whole} second${whole === 1 ? '' : 's'}.`;
|
|
55
|
+
}
|
|
56
|
+
const minutes = Math.ceil(seconds / 60);
|
|
57
|
+
return `Too many attempts. Try again in ${minutes} minute${minutes === 1 ? '' : 's'}.`;
|
|
58
|
+
};
|
|
39
59
|
/**
|
|
40
60
|
* Svelte context for `AuthState`.
|
|
41
61
|
* Use `auth_state_context.set(state)` in the provider and `auth_state_context.get()` to access.
|
|
@@ -145,8 +165,7 @@ export class AuthState {
|
|
|
145
165
|
if (response.status === 429) {
|
|
146
166
|
try {
|
|
147
167
|
const data = await response.json();
|
|
148
|
-
|
|
149
|
-
this.verify_error = `Too many attempts. Try again in ${minutes} minute${minutes === 1 ? '' : 's'}.`;
|
|
168
|
+
this.verify_error = format_rate_limit_message(data.retry_after);
|
|
150
169
|
}
|
|
151
170
|
catch {
|
|
152
171
|
this.verify_error = 'Too many attempts. Try again later.';
|
|
@@ -234,8 +253,7 @@ export class AuthState {
|
|
|
234
253
|
if (response.status === 429) {
|
|
235
254
|
try {
|
|
236
255
|
const data = await response.json();
|
|
237
|
-
|
|
238
|
-
this.verify_error = `Too many attempts. Try again in ${minutes} minute${minutes === 1 ? '' : 's'}.`;
|
|
256
|
+
this.verify_error = format_rate_limit_message(data.retry_after);
|
|
239
257
|
}
|
|
240
258
|
catch {
|
|
241
259
|
this.verify_error = 'Too many attempts. Try again later.';
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cell history PG schema (schema only).
|
|
3
|
-
*
|
|
4
|
-
* Lightweight references to cell state snapshots. Heavy data (serialized
|
|
5
|
-
* cell bytes) lives in the fact store; `fact_hash` points there. The
|
|
6
|
-
* snapshot lifecycle (when to serialize, hash, store, and record) is
|
|
7
|
-
* deferred to a future iteration — this only stages the table so
|
|
8
|
-
* downstream code can target a stable schema. The table ships
|
|
9
|
-
* present-but-unwritten.
|
|
10
|
-
*
|
|
11
|
-
* `fact_hash` is intentionally **not** a foreign key to `fact(hash)` —
|
|
12
|
-
* snapshots may be evicted by GC policy while history rows remain as audit
|
|
13
|
-
* traces, and federation may target facts on another instance.
|
|
14
|
-
*
|
|
15
|
-
* Depends on `CELL_MIGRATION_NS` (FK on `cell.id`).
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
import type { Migration, MigrationNamespace } from './migrate.js';
|
|
20
|
-
/** `cell_history` table — append-only log of cell snapshot references. */
|
|
21
|
-
export declare const CELL_HISTORY_SCHEMA = "\nCREATE TABLE IF NOT EXISTS cell_history (\n\tid BIGSERIAL PRIMARY KEY,\n\tcell_id UUID NOT NULL REFERENCES cell(id) ON DELETE CASCADE,\n\tfact_hash TEXT NOT NULL,\n\taction_id UUID,\n\tcreated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()\n)";
|
|
22
|
-
/**
|
|
23
|
-
* Cell-history indexes.
|
|
24
|
-
*
|
|
25
|
-
* - `idx_cell_history_cell`: per-cell timeline reads (newest first).
|
|
26
|
-
* - `idx_cell_history_fact`: fact → cells reverse lookup for GC liveness
|
|
27
|
-
* and provenance queries.
|
|
28
|
-
*/
|
|
29
|
-
export declare const CELL_HISTORY_INDEXES: Array<string>;
|
|
30
|
-
/** Tables created by `CELL_HISTORY_MIGRATION_NS`, in drop order. */
|
|
31
|
-
export declare const CELL_HISTORY_DROP_TABLES: readonly ["cell_history"];
|
|
32
|
-
/** Cell-history migrations. */
|
|
33
|
-
export declare const CELL_HISTORY_MIGRATIONS: Array<Migration>;
|
|
34
|
-
/** Namespace identifier for cell-history migrations. */
|
|
35
|
-
export declare const CELL_HISTORY_MIGRATION_NAMESPACE = "fuz_cell_history";
|
|
36
|
-
/** Migration namespace consumed by `run_migrations`. */
|
|
37
|
-
export declare const CELL_HISTORY_MIGRATION_NS: MigrationNamespace;
|
|
38
|
-
//# sourceMappingURL=cell_history_ddl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cell_history_ddl.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_history_ddl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElE,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,gPAO9B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAK9C,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,2BAA4B,CAAC;AAElE,+BAA+B;AAC/B,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,SAAS,CAUpD,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,gCAAgC,qBAAqB,CAAC;AAEnE,wDAAwD;AACxD,eAAO,MAAM,yBAAyB,EAAE,kBAGvC,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cell history PG schema (schema only).
|
|
3
|
-
*
|
|
4
|
-
* Lightweight references to cell state snapshots. Heavy data (serialized
|
|
5
|
-
* cell bytes) lives in the fact store; `fact_hash` points there. The
|
|
6
|
-
* snapshot lifecycle (when to serialize, hash, store, and record) is
|
|
7
|
-
* deferred to a future iteration — this only stages the table so
|
|
8
|
-
* downstream code can target a stable schema. The table ships
|
|
9
|
-
* present-but-unwritten.
|
|
10
|
-
*
|
|
11
|
-
* `fact_hash` is intentionally **not** a foreign key to `fact(hash)` —
|
|
12
|
-
* snapshots may be evicted by GC policy while history rows remain as audit
|
|
13
|
-
* traces, and federation may target facts on another instance.
|
|
14
|
-
*
|
|
15
|
-
* Depends on `CELL_MIGRATION_NS` (FK on `cell.id`).
|
|
16
|
-
*
|
|
17
|
-
* @module
|
|
18
|
-
*/
|
|
19
|
-
/** `cell_history` table — append-only log of cell snapshot references. */
|
|
20
|
-
export const CELL_HISTORY_SCHEMA = `
|
|
21
|
-
CREATE TABLE IF NOT EXISTS cell_history (
|
|
22
|
-
id BIGSERIAL PRIMARY KEY,
|
|
23
|
-
cell_id UUID NOT NULL REFERENCES cell(id) ON DELETE CASCADE,
|
|
24
|
-
fact_hash TEXT NOT NULL,
|
|
25
|
-
action_id UUID,
|
|
26
|
-
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
27
|
-
)`;
|
|
28
|
-
/**
|
|
29
|
-
* Cell-history indexes.
|
|
30
|
-
*
|
|
31
|
-
* - `idx_cell_history_cell`: per-cell timeline reads (newest first).
|
|
32
|
-
* - `idx_cell_history_fact`: fact → cells reverse lookup for GC liveness
|
|
33
|
-
* and provenance queries.
|
|
34
|
-
*/
|
|
35
|
-
export const CELL_HISTORY_INDEXES = [
|
|
36
|
-
`CREATE INDEX IF NOT EXISTS idx_cell_history_cell
|
|
37
|
-
ON cell_history(cell_id, created_at DESC)`,
|
|
38
|
-
`CREATE INDEX IF NOT EXISTS idx_cell_history_fact
|
|
39
|
-
ON cell_history(fact_hash)`
|
|
40
|
-
];
|
|
41
|
-
/** Tables created by `CELL_HISTORY_MIGRATION_NS`, in drop order. */
|
|
42
|
-
export const CELL_HISTORY_DROP_TABLES = ['cell_history'];
|
|
43
|
-
/** Cell-history migrations. */
|
|
44
|
-
export const CELL_HISTORY_MIGRATIONS = [
|
|
45
|
-
{
|
|
46
|
-
name: 'full_cell_history_schema',
|
|
47
|
-
up: async (db) => {
|
|
48
|
-
await db.query(CELL_HISTORY_SCHEMA);
|
|
49
|
-
for (const sql of CELL_HISTORY_INDEXES) {
|
|
50
|
-
await db.query(sql);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
];
|
|
55
|
-
/** Namespace identifier for cell-history migrations. */
|
|
56
|
-
export const CELL_HISTORY_MIGRATION_NAMESPACE = 'fuz_cell_history';
|
|
57
|
-
/** Migration namespace consumed by `run_migrations`. */
|
|
58
|
-
export const CELL_HISTORY_MIGRATION_NS = {
|
|
59
|
-
namespace: CELL_HISTORY_MIGRATION_NAMESPACE,
|
|
60
|
-
migrations: CELL_HISTORY_MIGRATIONS
|
|
61
|
-
};
|