@fuzdev/fuz_app 0.53.0 → 0.55.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 +68 -13
- package/dist/actions/action_codegen.d.ts +13 -0
- package/dist/actions/action_codegen.d.ts.map +1 -1
- package/dist/actions/action_codegen.js +15 -1
- package/dist/actions/action_rpc.d.ts +60 -7
- package/dist/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +158 -44
- package/dist/actions/register_action_ws.d.ts +4 -4
- package/dist/actions/register_action_ws.js +6 -6
- package/dist/actions/register_ws_endpoint.d.ts +20 -7
- package/dist/actions/register_ws_endpoint.d.ts.map +1 -1
- package/dist/actions/register_ws_endpoint.js +30 -5
- package/dist/actions/transports.d.ts.map +1 -1
- package/dist/actions/transports.js +0 -4
- package/dist/auth/CLAUDE.md +230 -63
- package/dist/auth/account_actions.d.ts +6 -6
- package/dist/auth/account_actions.d.ts.map +1 -1
- package/dist/auth/account_actions.js +8 -11
- package/dist/auth/account_queries.d.ts +6 -3
- package/dist/auth/account_queries.d.ts.map +1 -1
- package/dist/auth/account_queries.js +14 -5
- package/dist/auth/account_routes.d.ts +7 -10
- package/dist/auth/account_routes.d.ts.map +1 -1
- package/dist/auth/account_routes.js +70 -23
- package/dist/auth/account_schema.d.ts +19 -0
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +20 -0
- package/dist/auth/admin_action_specs.d.ts +45 -11
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +23 -8
- package/dist/auth/admin_actions.d.ts +8 -7
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +11 -18
- package/dist/auth/audit_log_queries.d.ts +53 -14
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +45 -2
- package/dist/auth/audit_log_schema.d.ts +55 -1
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +19 -3
- package/dist/auth/bearer_auth.d.ts +9 -7
- package/dist/auth/bearer_auth.d.ts.map +1 -1
- package/dist/auth/bearer_auth.js +13 -21
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +5 -0
- package/dist/auth/daemon_token_middleware.d.ts +23 -11
- package/dist/auth/daemon_token_middleware.d.ts.map +1 -1
- package/dist/auth/daemon_token_middleware.js +26 -20
- package/dist/auth/deps.d.ts +14 -0
- package/dist/auth/deps.d.ts.map +1 -1
- package/dist/auth/middleware.d.ts.map +1 -1
- package/dist/auth/middleware.js +4 -2
- package/dist/auth/migrations.d.ts +15 -7
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +15 -7
- package/dist/auth/permit_offer_action_specs.d.ts +45 -6
- package/dist/auth/permit_offer_action_specs.d.ts.map +1 -1
- package/dist/auth/permit_offer_action_specs.js +38 -7
- package/dist/auth/permit_offer_actions.d.ts +2 -2
- package/dist/auth/permit_offer_actions.d.ts.map +1 -1
- package/dist/auth/permit_offer_actions.js +106 -95
- package/dist/auth/permit_offer_notifications.d.ts +10 -0
- package/dist/auth/permit_offer_notifications.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.d.ts +68 -9
- package/dist/auth/permit_offer_queries.d.ts.map +1 -1
- package/dist/auth/permit_offer_queries.js +147 -35
- package/dist/auth/permit_offer_schema.d.ts +23 -1
- package/dist/auth/permit_offer_schema.d.ts.map +1 -1
- package/dist/auth/permit_offer_schema.js +5 -0
- package/dist/auth/permit_queries.d.ts +17 -5
- package/dist/auth/permit_queries.d.ts.map +1 -1
- package/dist/auth/permit_queries.js +19 -8
- package/dist/auth/request_context.d.ts +360 -32
- package/dist/auth/request_context.d.ts.map +1 -1
- package/dist/auth/request_context.js +442 -60
- package/dist/auth/route_guards.d.ts +10 -4
- package/dist/auth/route_guards.d.ts.map +1 -1
- package/dist/auth/route_guards.js +14 -8
- package/dist/auth/self_service_role_action_specs.d.ts +2 -0
- package/dist/auth/self_service_role_action_specs.d.ts.map +1 -1
- package/dist/auth/self_service_role_action_specs.js +2 -0
- package/dist/auth/self_service_role_actions.d.ts +6 -5
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +32 -19
- package/dist/db/migrate.d.ts +11 -7
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +9 -6
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +5 -3
- package/dist/hono_context.d.ts +77 -0
- package/dist/hono_context.d.ts.map +1 -1
- package/dist/hono_context.js +50 -0
- package/dist/http/CLAUDE.md +80 -17
- package/dist/http/error_schemas.d.ts +92 -1
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/error_schemas.js +73 -16
- package/dist/http/jsonrpc_errors.d.ts +27 -2
- package/dist/http/jsonrpc_errors.d.ts.map +1 -1
- package/dist/http/jsonrpc_errors.js +26 -2
- package/dist/http/route_spec.d.ts +62 -4
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +117 -21
- package/dist/http/schema_helpers.d.ts +13 -1
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +21 -2
- package/dist/http/surface.d.ts +10 -1
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +2 -2
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +11 -1
- package/dist/testing/CLAUDE.md +23 -17
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +15 -13
- package/dist/testing/adversarial_headers.js +1 -1
- package/dist/testing/app_server.js +2 -2
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +21 -7
- package/dist/testing/auth_apps.d.ts.map +1 -1
- package/dist/testing/auth_apps.js +6 -3
- package/dist/testing/entities.d.ts +2 -1
- package/dist/testing/entities.d.ts.map +1 -1
- package/dist/testing/entities.js +1 -0
- package/dist/testing/integration_helpers.d.ts +4 -2
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +9 -5
- package/dist/testing/middleware.d.ts +12 -8
- package/dist/testing/middleware.d.ts.map +1 -1
- package/dist/testing/middleware.js +67 -25
- package/dist/testing/rpc_helpers.d.ts.map +1 -1
- package/dist/testing/rpc_helpers.js +3 -1
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +12 -0
- package/dist/testing/ws_round_trip.d.ts.map +1 -1
- package/dist/testing/ws_round_trip.js +5 -1
- package/dist/ui/CLAUDE.md +16 -10
- package/dist/ui/PermitOfferForm.svelte +14 -0
- package/dist/ui/PermitOfferForm.svelte.d.ts +6 -0
- package/dist/ui/PermitOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts +8 -1
- package/dist/ui/admin_accounts_state.svelte.d.ts.map +1 -1
- package/dist/ui/admin_accounts_state.svelte.js +14 -3
- package/dist/ui/permit_offers_state.svelte.d.ts +9 -1
- package/dist/ui/permit_offers_state.svelte.d.ts.map +1 -1
- package/dist/ui/permit_offers_state.svelte.js +7 -1
- package/package.json +1 -1
|
@@ -11,18 +11,19 @@
|
|
|
11
11
|
* policy checks (e.g. `permit_offer_list`/`_history` elevate to admin only
|
|
12
12
|
* when inspecting another account — an input-dependent check that can't be
|
|
13
13
|
* expressed at the spec level). `permit_revoke` declares
|
|
14
|
-
* `auth: {role: 'admin'}` — the RPC dispatcher's per-spec
|
|
15
|
-
*
|
|
14
|
+
* `auth: {role: 'admin'}` — the RPC dispatcher's per-spec post-authorization
|
|
15
|
+
* auth gate (`check_action_auth_post_authorization`) rejects non-admin
|
|
16
|
+
* callers before the handler runs even though the endpoint hosts non-admin
|
|
16
17
|
* methods alongside.
|
|
17
18
|
*
|
|
18
19
|
* @module
|
|
19
20
|
*/
|
|
20
21
|
import { z } from 'zod';
|
|
21
22
|
import { Uuid } from '@fuzdev/fuz_util/id.js';
|
|
22
|
-
import {
|
|
23
|
+
import { ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
23
24
|
import { RoleName } from './role_schema.js';
|
|
24
25
|
import { PERMIT_OFFER_MESSAGE_LENGTH_MAX, PermitOfferJson } from './permit_offer_schema.js';
|
|
25
|
-
import { PERMIT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
|
|
26
|
+
import { ActingActor, PERMIT_REVOKED_REASON_LENGTH_MAX } from './account_schema.js';
|
|
26
27
|
/** Error reason — caller tried to offer themselves a permit. */
|
|
27
28
|
export const ERROR_OFFER_SELF_TARGET = 'offer_self_target';
|
|
28
29
|
/** Error reason — offer is declined, retracted, or superseded. */
|
|
@@ -35,10 +36,27 @@ export const ERROR_OFFER_NOT_FOUND = 'offer_not_found';
|
|
|
35
36
|
export const ERROR_OFFER_ROLE_NOT_GRANTABLE = 'offer_role_not_grantable';
|
|
36
37
|
/** Error reason — caller is not authorized to offer this role (default policy: caller lacks the role; consumer `authorize` callback may add further policy). */
|
|
37
38
|
export const ERROR_OFFER_NOT_AUTHORIZED = 'offer_not_authorized';
|
|
39
|
+
/** Error reason — actor-targeted offer was accepted by an actor other than `to_actor_id`. */
|
|
40
|
+
export const ERROR_OFFER_ACTOR_MISMATCH = 'offer_actor_mismatch';
|
|
41
|
+
/** Error reason — `permit_offer_create` was called with a `to_actor_id` that does not belong to `to_account_id`. */
|
|
42
|
+
export const ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH = 'offer_actor_account_mismatch';
|
|
38
43
|
// -- Input/output schemas ---------------------------------------------------
|
|
39
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Input for `permit_offer_create`.
|
|
46
|
+
*
|
|
47
|
+
* `to_actor_id` (optional) narrows the offer to a specific actor on the
|
|
48
|
+
* recipient account. When supplied, `permit_offer_accept` will only admit
|
|
49
|
+
* the named actor — wrong-actor accepts reject with
|
|
50
|
+
* `offer_actor_mismatch`. The audit envelope's `target_actor_id` is
|
|
51
|
+
* stamped from this column on the create / supersede / expire / retract
|
|
52
|
+
* events. Omit (or pass null) for the account-grain default — any actor
|
|
53
|
+
* on `to_account_id` may accept.
|
|
54
|
+
*/
|
|
40
55
|
export const PermitOfferCreateInput = z.strictObject({
|
|
41
56
|
to_account_id: Uuid.meta({ description: 'Account id of the recipient.' }),
|
|
57
|
+
to_actor_id: Uuid.nullish().meta({
|
|
58
|
+
description: 'Optional actor-grain target on the recipient account. When set, only this actor may accept and the audit envelope carries it on offer-shape events. Must belong to `to_account_id`.',
|
|
59
|
+
}),
|
|
42
60
|
role: RoleName.meta({ description: 'Role being offered.' }),
|
|
43
61
|
scope_id: Uuid.nullish().meta({
|
|
44
62
|
description: 'Scope id for resource-scoped grants (e.g. classroom id). `null` for global.',
|
|
@@ -48,10 +66,12 @@ export const PermitOfferCreateInput = z.strictObject({
|
|
|
48
66
|
.max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
|
|
49
67
|
.nullish()
|
|
50
68
|
.meta({ description: 'Optional free-form note from the grantor.' }),
|
|
69
|
+
acting: ActingActor,
|
|
51
70
|
});
|
|
52
71
|
/** Input for `permit_offer_accept`. */
|
|
53
72
|
export const PermitOfferAcceptInput = z.strictObject({
|
|
54
73
|
offer_id: Uuid.meta({ description: 'The offer to accept.' }),
|
|
74
|
+
acting: ActingActor,
|
|
55
75
|
});
|
|
56
76
|
/** Input for `permit_offer_decline`. */
|
|
57
77
|
export const PermitOfferDeclineInput = z.strictObject({
|
|
@@ -61,16 +81,19 @@ export const PermitOfferDeclineInput = z.strictObject({
|
|
|
61
81
|
.max(PERMIT_OFFER_MESSAGE_LENGTH_MAX)
|
|
62
82
|
.nullish()
|
|
63
83
|
.meta({ description: 'Optional free-form reason given on decline.' }),
|
|
84
|
+
acting: ActingActor,
|
|
64
85
|
});
|
|
65
86
|
/** Input for `permit_offer_retract`. */
|
|
66
87
|
export const PermitOfferRetractInput = z.strictObject({
|
|
67
88
|
offer_id: Uuid.meta({ description: 'The offer to retract.' }),
|
|
89
|
+
acting: ActingActor,
|
|
68
90
|
});
|
|
69
91
|
/** Input for `permit_offer_list`. `account_id` is admin-only (inspect another account's inbox). */
|
|
70
92
|
export const PermitOfferListInput = z.strictObject({
|
|
71
93
|
account_id: Uuid.nullish().meta({
|
|
72
94
|
description: 'Admin-only — list offers for another account. Defaults to the caller.',
|
|
73
95
|
}),
|
|
96
|
+
acting: ActingActor,
|
|
74
97
|
});
|
|
75
98
|
/**
|
|
76
99
|
* Input for `permit_revoke`. Admin-only mutation that revokes an active
|
|
@@ -85,6 +108,7 @@ export const PermitRevokeInput = z.strictObject({
|
|
|
85
108
|
reason: z.string().max(PERMIT_REVOKED_REASON_LENGTH_MAX).nullish().meta({
|
|
86
109
|
description: 'Optional free-form reason; stamped on `permit.revoked_reason` and surfaced on the revokee WS notification.',
|
|
87
110
|
}),
|
|
111
|
+
acting: ActingActor,
|
|
88
112
|
});
|
|
89
113
|
/**
|
|
90
114
|
* Input for `permit_offer_history`. Returns every offer involving the account
|
|
@@ -101,6 +125,7 @@ export const PermitOfferHistoryInput = z.strictObject({
|
|
|
101
125
|
offset: z.number().int().min(0).nullish().meta({
|
|
102
126
|
description: 'Pagination offset (default 0).',
|
|
103
127
|
}),
|
|
128
|
+
acting: ActingActor,
|
|
104
129
|
});
|
|
105
130
|
/** Output for `permit_offer_create`. */
|
|
106
131
|
export const PermitOfferCreateOutput = z.strictObject({
|
|
@@ -138,6 +163,7 @@ export const permit_offer_create_action_spec = {
|
|
|
138
163
|
ERROR_OFFER_SELF_TARGET,
|
|
139
164
|
ERROR_OFFER_ROLE_NOT_GRANTABLE,
|
|
140
165
|
ERROR_OFFER_NOT_AUTHORIZED,
|
|
166
|
+
ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH,
|
|
141
167
|
],
|
|
142
168
|
};
|
|
143
169
|
export const permit_offer_accept_action_spec = {
|
|
@@ -150,7 +176,12 @@ export const permit_offer_accept_action_spec = {
|
|
|
150
176
|
output: PermitOfferAcceptOutput,
|
|
151
177
|
async: true,
|
|
152
178
|
description: 'Accept an offer. Atomically marks the offer accepted, inserts the permit, and supersedes sibling pending offers for the same (account, role, scope).',
|
|
153
|
-
error_reasons: [
|
|
179
|
+
error_reasons: [
|
|
180
|
+
ERROR_OFFER_NOT_FOUND,
|
|
181
|
+
ERROR_OFFER_TERMINAL,
|
|
182
|
+
ERROR_OFFER_EXPIRED,
|
|
183
|
+
ERROR_OFFER_ACTOR_MISMATCH,
|
|
184
|
+
],
|
|
154
185
|
};
|
|
155
186
|
export const permit_offer_decline_action_spec = {
|
|
156
187
|
method: 'permit_offer_decline',
|
|
@@ -208,7 +239,7 @@ export const permit_revoke_action_spec = {
|
|
|
208
239
|
output: PermitRevokeOutput,
|
|
209
240
|
async: true,
|
|
210
241
|
description: 'Revoke an active permit on a target actor. Admin-only. Supersedes any pending offers for the same (account, role, scope). Fires permit_revoke + permit_offer_supersede notifications.',
|
|
211
|
-
error_reasons: [ERROR_PERMIT_NOT_FOUND,
|
|
242
|
+
error_reasons: [ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE],
|
|
212
243
|
rate_limit: 'account',
|
|
213
244
|
};
|
|
214
245
|
/**
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
import { type ActionContext, type RpcAction } from '../actions/action_rpc.js';
|
|
40
40
|
import { type RoleSchemaResult } from './role_schema.js';
|
|
41
41
|
import { type RequestContext } from './request_context.js';
|
|
42
|
-
import type { RouteFactoryDeps } from './deps.js';
|
|
42
|
+
import type { AuditEmitDeps, RouteFactoryDeps } from './deps.js';
|
|
43
43
|
import { type NotificationSender } from './permit_offer_notifications.js';
|
|
44
44
|
/**
|
|
45
45
|
* Authorization callback for `permit_offer_create`. Returns `true` to allow,
|
|
@@ -94,7 +94,7 @@ export declare const authorize_admin_or_holder: PermitOfferCreateAuthorize;
|
|
|
94
94
|
* directly (the transport's `send_to_account` signature accepts the broader
|
|
95
95
|
* `JsonrpcMessageFromServerToClient`, which is contravariantly compatible).
|
|
96
96
|
*/
|
|
97
|
-
export interface PermitOfferActionDeps extends
|
|
97
|
+
export interface PermitOfferActionDeps extends AuditEmitDeps {
|
|
98
98
|
/** Optional WS fan-out primitive. `null` or absent → notifications skipped. */
|
|
99
99
|
notification_sender?: NotificationSender | null;
|
|
100
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permit_offer_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"permit_offer_actions.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAmC,KAAK,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAoBzF,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC/D,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iCAAiC,CAAC;AAiCzC;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG,CACxC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAC,EACrE,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,EACnC,GAAG,EAAE,aAAa,KACd,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEhC,iDAAiD;AACjD,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,0BAA0B,CAAC;CACvC;AA4BD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,EAAE,0BASvC,CAAC;AAIF;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC3D,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACvC,MAAM,qBAAqB,EAC3B,UAAS,wBAA6B,KACpC,KAAK,CAAC,SAAS,CA4cjB,CAAC"}
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
*
|
|
37
37
|
* @module
|
|
38
38
|
*/
|
|
39
|
-
import {
|
|
39
|
+
import { rpc_actor_action, } from '../actions/action_rpc.js';
|
|
40
40
|
import { jsonrpc_errors } from '../http/jsonrpc_errors.js';
|
|
41
41
|
import { emit_after_commit } from '../http/pending_effects.js';
|
|
42
42
|
import { BUILTIN_ROLE_OPTIONS, ROLE_ADMIN } from './role_schema.js';
|
|
43
43
|
import { PERMIT_OFFER_DEFAULT_TTL_MS, to_permit_offer_json } from './permit_offer_schema.js';
|
|
44
|
-
import { query_permit_offer_create, query_permit_offer_decline, query_permit_offer_retract, query_permit_offer_list, query_permit_offer_history_for_account, query_accept_offer, PermitOfferAlreadyTerminalError, PermitOfferExpiredError, PermitOfferNotFoundError, PermitOfferSelfTargetError, } from './permit_offer_queries.js';
|
|
45
|
-
import { query_permit_find_active_role_for_actor,
|
|
44
|
+
import { query_permit_offer_create, query_permit_offer_decline, query_permit_offer_retract, query_permit_offer_list, query_permit_offer_history_for_account, query_accept_offer, PermitOfferActorAccountMismatchError, PermitOfferActorMismatchError, PermitOfferAlreadyTerminalError, PermitOfferExpiredError, PermitOfferNotFoundError, PermitOfferSelfTargetError, } from './permit_offer_queries.js';
|
|
45
|
+
import { query_permit_find_active_role_for_actor, query_revoke_permit } from './permit_queries.js';
|
|
46
46
|
import { query_actor_by_id } from './account_queries.js';
|
|
47
|
-
import {
|
|
48
|
-
import { has_role } from './request_context.js';
|
|
47
|
+
import { emit_permit_target_event } from './audit_log_queries.js';
|
|
48
|
+
import { has_role, has_scoped_role, } from './request_context.js';
|
|
49
49
|
import { build_permit_offer_accepted_notification, build_permit_offer_declined_notification, build_permit_offer_received_notification, build_permit_offer_retracted_notification, build_permit_offer_supersede_notification, build_permit_revoke_notification, } from './permit_offer_notifications.js';
|
|
50
|
-
import {
|
|
51
|
-
import { ERROR_OFFER_EXPIRED, ERROR_OFFER_NOT_AUTHORIZED, ERROR_OFFER_NOT_FOUND, ERROR_OFFER_ROLE_NOT_GRANTABLE, ERROR_OFFER_SELF_TARGET, ERROR_OFFER_TERMINAL, permit_offer_create_action_spec, permit_offer_accept_action_spec, permit_offer_decline_action_spec, permit_offer_retract_action_spec, permit_offer_list_action_spec, permit_offer_history_action_spec, permit_revoke_action_spec, } from './permit_offer_action_specs.js';
|
|
50
|
+
import { ERROR_PERMIT_NOT_FOUND, ERROR_ROLE_NOT_WEB_GRANTABLE } from '../http/error_schemas.js';
|
|
51
|
+
import { ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH, ERROR_OFFER_ACTOR_MISMATCH, ERROR_OFFER_EXPIRED, ERROR_OFFER_NOT_AUTHORIZED, ERROR_OFFER_NOT_FOUND, ERROR_OFFER_ROLE_NOT_GRANTABLE, ERROR_OFFER_SELF_TARGET, ERROR_OFFER_TERMINAL, permit_offer_create_action_spec, permit_offer_accept_action_spec, permit_offer_decline_action_spec, permit_offer_retract_action_spec, permit_offer_list_action_spec, permit_offer_history_action_spec, permit_revoke_action_spec, } from './permit_offer_action_specs.js';
|
|
52
52
|
// -- Helpers ----------------------------------------------------------------
|
|
53
53
|
/** Fire `on_audit_event` for each event — used by accept, whose events were written in-transaction. */
|
|
54
54
|
const fan_out_audit_events = (events, on_audit_event, log) => {
|
|
@@ -61,10 +61,13 @@ const fan_out_audit_events = (events, on_audit_event, log) => {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
65
|
+
const default_authorize = async (auth, input, _deps, _ctx) => {
|
|
65
66
|
// Caller must hold an active permit for the offered role. Global (no scope)
|
|
66
67
|
// check — the scope-aware "only in this classroom" policy is consumer-level.
|
|
67
|
-
|
|
68
|
+
// Reads from the in-memory `auth.permits` snapshot loaded once per request
|
|
69
|
+
// by `create_request_context_middleware`; no DB roundtrip needed.
|
|
70
|
+
return has_scoped_role(auth, input.role, null);
|
|
68
71
|
};
|
|
69
72
|
/**
|
|
70
73
|
* Authorization callback that admits any admin and otherwise falls back to
|
|
@@ -79,20 +82,10 @@ const default_authorize = async (auth, input, _deps, ctx) => {
|
|
|
79
82
|
* classroom_student in their own scope) wrap this and short-circuit `true`
|
|
80
83
|
* before delegating.
|
|
81
84
|
*/
|
|
82
|
-
export const authorize_admin_or_holder = async (auth, input, _deps,
|
|
85
|
+
export const authorize_admin_or_holder = async (auth, input, _deps, _ctx) => {
|
|
83
86
|
if (has_role(auth, ROLE_ADMIN))
|
|
84
87
|
return true;
|
|
85
|
-
return
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Narrow `ctx.auth` to non-null. The RPC dispatcher has already enforced
|
|
89
|
-
* `auth: 'authenticated'` before the handler runs — this is a type narrow,
|
|
90
|
-
* not a runtime check that would otherwise fail.
|
|
91
|
-
*/
|
|
92
|
-
const require_request_auth = (auth) => {
|
|
93
|
-
if (!auth)
|
|
94
|
-
throw new Error('unreachable: action auth guard did not enforce authentication');
|
|
95
|
-
return auth;
|
|
88
|
+
return has_scoped_role(auth, input.role, null);
|
|
96
89
|
};
|
|
97
90
|
/**
|
|
98
91
|
* Create the seven permit-offer RPC actions (six offer-lifecycle methods
|
|
@@ -107,28 +100,29 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
107
100
|
const role_options = options.roles?.role_options ?? BUILTIN_ROLE_OPTIONS;
|
|
108
101
|
const default_ttl_ms = options.default_ttl_ms ?? PERMIT_OFFER_DEFAULT_TTL_MS;
|
|
109
102
|
const authorize = options.authorize ?? default_authorize;
|
|
110
|
-
//
|
|
111
|
-
//
|
|
103
|
+
// Four denial paths (web_grantable, authorize, self-target,
|
|
104
|
+
// actor-account mismatch) all emit the same failure-outcome audit
|
|
105
|
+
// event. `target_actor_id` is populated when the caller supplied a
|
|
106
|
+
// `to_actor_id` so failure rows match the success-shape envelope of
|
|
107
|
+
// actor-targeted offers.
|
|
112
108
|
const emit_create_failure_audit = (ctx, auth, input) => {
|
|
113
|
-
void
|
|
109
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
114
110
|
event_type: 'permit_offer_create',
|
|
115
111
|
outcome: 'failure',
|
|
116
|
-
actor_id: auth.actor.id,
|
|
117
|
-
account_id: auth.account.id,
|
|
118
112
|
target_account_id: input.to_account_id,
|
|
119
|
-
|
|
113
|
+
target_actor_id: input.to_actor_id ?? null,
|
|
120
114
|
metadata: {
|
|
121
115
|
role: input.role,
|
|
122
116
|
scope_id: input.scope_id ?? null,
|
|
123
117
|
to_account_id: input.to_account_id,
|
|
124
118
|
},
|
|
125
|
-
}
|
|
119
|
+
});
|
|
126
120
|
};
|
|
127
121
|
// Returns {offer} only — no auto-accept. Recipient must call
|
|
128
122
|
// permit_offer_accept; admin tests materialize permits via
|
|
129
123
|
// query_accept_offer (see testing/admin_integration.ts `offer_and_accept`).
|
|
130
124
|
const create_handler = async (input, ctx) => {
|
|
131
|
-
const auth =
|
|
125
|
+
const auth = ctx.auth;
|
|
132
126
|
// Role must be web_grantable — same gate as admin direct-grant.
|
|
133
127
|
const rc = role_options.get(input.role);
|
|
134
128
|
if (!rc?.web_grantable) {
|
|
@@ -153,6 +147,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
153
147
|
offer = await query_permit_offer_create(ctx, {
|
|
154
148
|
from_actor_id: auth.actor.id,
|
|
155
149
|
to_account_id: input.to_account_id,
|
|
150
|
+
to_actor_id: input.to_actor_id ?? null,
|
|
156
151
|
role: input.role,
|
|
157
152
|
scope_id: input.scope_id ?? null,
|
|
158
153
|
message: input.message ?? null,
|
|
@@ -166,21 +161,29 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
166
161
|
reason: ERROR_OFFER_SELF_TARGET,
|
|
167
162
|
});
|
|
168
163
|
}
|
|
164
|
+
if (err instanceof PermitOfferActorAccountMismatchError) {
|
|
165
|
+
emit_create_failure_audit(ctx, auth, input);
|
|
166
|
+
throw jsonrpc_errors.invalid_params('to_actor_id does not belong to to_account_id', {
|
|
167
|
+
reason: ERROR_OFFER_ACTOR_ACCOUNT_MISMATCH,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
169
170
|
throw err;
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
+
// `target_actor_id` is populated when the offer is actor-targeted
|
|
173
|
+
// (per the offer's `to_actor_id`), null for account-grain offers
|
|
174
|
+
// — closes the audit hole where offer-shape events used to leave
|
|
175
|
+
// actor-grain forensics blank even when the binding was known.
|
|
176
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
172
177
|
event_type: 'permit_offer_create',
|
|
173
|
-
actor_id: auth.actor.id,
|
|
174
|
-
account_id: auth.account.id,
|
|
175
178
|
target_account_id: input.to_account_id,
|
|
176
|
-
|
|
179
|
+
target_actor_id: offer.to_actor_id,
|
|
177
180
|
metadata: {
|
|
178
181
|
offer_id: offer.id,
|
|
179
182
|
role: offer.role,
|
|
180
183
|
scope_id: offer.scope_id,
|
|
181
184
|
to_account_id: offer.to_account_id,
|
|
182
185
|
},
|
|
183
|
-
}
|
|
186
|
+
});
|
|
184
187
|
const offer_json = to_permit_offer_json(offer);
|
|
185
188
|
if (notification_sender) {
|
|
186
189
|
emit_after_commit(ctx, () => {
|
|
@@ -190,12 +193,13 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
190
193
|
return { offer: offer_json };
|
|
191
194
|
};
|
|
192
195
|
const accept_handler = async (input, ctx) => {
|
|
193
|
-
const auth =
|
|
196
|
+
const auth = ctx.auth;
|
|
194
197
|
let result;
|
|
195
198
|
try {
|
|
196
199
|
result = await query_accept_offer(ctx, {
|
|
197
200
|
offer_id: input.offer_id,
|
|
198
201
|
to_account_id: auth.account.id,
|
|
202
|
+
actor_id: auth.actor.id,
|
|
199
203
|
ip: ctx.client_ip,
|
|
200
204
|
});
|
|
201
205
|
}
|
|
@@ -209,6 +213,11 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
209
213
|
if (err instanceof PermitOfferExpiredError) {
|
|
210
214
|
throw jsonrpc_errors.invalid_request({ reason: ERROR_OFFER_EXPIRED });
|
|
211
215
|
}
|
|
216
|
+
if (err instanceof PermitOfferActorMismatchError) {
|
|
217
|
+
throw jsonrpc_errors.forbidden('offer is targeted to a different actor', {
|
|
218
|
+
reason: ERROR_OFFER_ACTOR_MISMATCH,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
212
221
|
throw err;
|
|
213
222
|
}
|
|
214
223
|
// Look up the grantor's account_id inside the transaction so the
|
|
@@ -251,7 +260,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
251
260
|
};
|
|
252
261
|
};
|
|
253
262
|
const decline_handler = async (input, ctx) => {
|
|
254
|
-
const auth =
|
|
263
|
+
const auth = ctx.auth;
|
|
255
264
|
let declined;
|
|
256
265
|
try {
|
|
257
266
|
declined = await query_permit_offer_decline(ctx, input.offer_id, auth.account.id, input.reason ?? null);
|
|
@@ -265,35 +274,36 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
265
274
|
if (!declined) {
|
|
266
275
|
throw jsonrpc_errors.not_found('offer', { reason: ERROR_OFFER_NOT_FOUND });
|
|
267
276
|
}
|
|
268
|
-
|
|
277
|
+
// `permit_offer_decline` is *to* the offering actor — populate both
|
|
278
|
+
// `target_actor_id` (the grantor actor) and `target_account_id`
|
|
279
|
+
// (the grantor account, joined in the decline RETURNING via CTE).
|
|
280
|
+
// The "both populated → same account" invariant holds: the
|
|
281
|
+
// grantor's actor↔account binding is 1:1 by definition of `actor`.
|
|
282
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
269
283
|
event_type: 'permit_offer_decline',
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
ip: ctx.client_ip,
|
|
284
|
+
target_account_id: declined.from_account_id,
|
|
285
|
+
target_actor_id: declined.from_actor_id,
|
|
273
286
|
metadata: {
|
|
274
287
|
offer_id: declined.id,
|
|
275
288
|
role: declined.role,
|
|
276
289
|
scope_id: declined.scope_id,
|
|
277
290
|
reason: input.reason ?? undefined,
|
|
278
291
|
},
|
|
279
|
-
}
|
|
292
|
+
});
|
|
280
293
|
if (notification_sender) {
|
|
281
|
-
//
|
|
282
|
-
//
|
|
283
|
-
// `offer.decline_reason` — the DB set it
|
|
284
|
-
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
notification_sender.send_to_account(grantor_account_id, build_permit_offer_declined_notification({ offer: offer_json }));
|
|
290
|
-
});
|
|
291
|
-
}
|
|
294
|
+
// Grantor's account_id rides on `declined.from_account_id` from
|
|
295
|
+
// the decline RETURNING — no second SELECT needed. The decline
|
|
296
|
+
// reason rides along on `offer.decline_reason` — the DB set it
|
|
297
|
+
// in the RETURNING above.
|
|
298
|
+
const offer_json = to_permit_offer_json(declined);
|
|
299
|
+
emit_after_commit(ctx, () => {
|
|
300
|
+
notification_sender.send_to_account(declined.from_account_id, build_permit_offer_declined_notification({ offer: offer_json }));
|
|
301
|
+
});
|
|
292
302
|
}
|
|
293
303
|
return { ok: true };
|
|
294
304
|
};
|
|
295
305
|
const retract_handler = async (input, ctx) => {
|
|
296
|
-
const auth =
|
|
306
|
+
const auth = ctx.auth;
|
|
297
307
|
let retracted;
|
|
298
308
|
try {
|
|
299
309
|
retracted = await query_permit_offer_retract(ctx, input.offer_id, auth.actor.id);
|
|
@@ -307,17 +317,20 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
307
317
|
if (!retracted) {
|
|
308
318
|
throw jsonrpc_errors.not_found('offer', { reason: ERROR_OFFER_NOT_FOUND });
|
|
309
319
|
}
|
|
310
|
-
|
|
320
|
+
// `permit_offer_retract` is *from* the recipient inbox —
|
|
321
|
+
// `target_account_id` is the recipient account; `target_actor_id`
|
|
322
|
+
// inherits the offer's `to_actor_id` (set on actor-targeted
|
|
323
|
+
// offers, null on account-grain offers).
|
|
324
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
311
325
|
event_type: 'permit_offer_retract',
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
ip: ctx.client_ip,
|
|
326
|
+
target_account_id: retracted.to_account_id,
|
|
327
|
+
target_actor_id: retracted.to_actor_id,
|
|
315
328
|
metadata: {
|
|
316
329
|
offer_id: retracted.id,
|
|
317
330
|
role: retracted.role,
|
|
318
331
|
scope_id: retracted.scope_id,
|
|
319
332
|
},
|
|
320
|
-
}
|
|
333
|
+
});
|
|
321
334
|
if (notification_sender) {
|
|
322
335
|
const offer_json = to_permit_offer_json(retracted);
|
|
323
336
|
emit_after_commit(ctx, () => {
|
|
@@ -327,7 +340,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
327
340
|
return { ok: true };
|
|
328
341
|
};
|
|
329
342
|
const list_handler = async (input, ctx) => {
|
|
330
|
-
const auth =
|
|
343
|
+
const auth = ctx.auth;
|
|
331
344
|
const target = input.account_id ?? auth.account.id;
|
|
332
345
|
if (target !== auth.account.id && !has_role(auth, ROLE_ADMIN)) {
|
|
333
346
|
throw jsonrpc_errors.forbidden('admin required to inspect another account');
|
|
@@ -336,7 +349,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
336
349
|
return { offers: offers.map(to_permit_offer_json) };
|
|
337
350
|
};
|
|
338
351
|
const history_handler = async (input, ctx) => {
|
|
339
|
-
const auth =
|
|
352
|
+
const auth = ctx.auth;
|
|
340
353
|
const target = input.account_id ?? auth.account.id;
|
|
341
354
|
if (target !== auth.account.id && !has_role(auth, ROLE_ADMIN)) {
|
|
342
355
|
throw jsonrpc_errors.forbidden('admin required to inspect another account');
|
|
@@ -345,35 +358,32 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
345
358
|
return { offers: offers.map(to_permit_offer_json) };
|
|
346
359
|
};
|
|
347
360
|
const revoke_handler = async (input, ctx) => {
|
|
348
|
-
const auth =
|
|
349
|
-
// IDOR guard + role lookup. One SELECT —
|
|
350
|
-
// permit is revoked, missing, or belongs
|
|
361
|
+
const auth = ctx.auth;
|
|
362
|
+
// IDOR guard + role lookup + actor → account JOIN. One SELECT —
|
|
363
|
+
// returns null when the permit is revoked, missing, or belongs
|
|
364
|
+
// to a different actor. The JOIN supplies `account_id` for the
|
|
365
|
+
// audit envelope's `target_account_id` and the post-commit
|
|
366
|
+
// SSE/WS socket-close fan-out target. `permit_revoke` is the
|
|
367
|
+
// canonical actor-bound-subject event: `target_actor_id` is the
|
|
368
|
+
// permit's grantee (input.actor_id); `target_account_id` is the
|
|
369
|
+
// account hosting that actor (sessions remain account-grain
|
|
370
|
+
// after multi-actor lands).
|
|
351
371
|
const permit_row = await query_permit_find_active_role_for_actor(ctx, input.permit_id, input.actor_id);
|
|
352
372
|
if (!permit_row) {
|
|
353
373
|
throw jsonrpc_errors.not_found('permit', { reason: ERROR_PERMIT_NOT_FOUND });
|
|
354
374
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const target_actor = await query_actor_by_id(ctx, input.actor_id);
|
|
358
|
-
if (!target_actor) {
|
|
359
|
-
// The IDOR guard above already matched, so a missing actor here
|
|
360
|
-
// indicates a race (account deleted between the two SELECTs).
|
|
361
|
-
// Treat as account-not-found for the caller.
|
|
362
|
-
throw jsonrpc_errors.not_found('account', { reason: ERROR_ACCOUNT_NOT_FOUND });
|
|
363
|
-
}
|
|
364
|
-
const target_account_id = target_actor.account_id;
|
|
375
|
+
const target_account_id = permit_row.account_id;
|
|
376
|
+
const target_actor_id = input.actor_id;
|
|
365
377
|
// web_grantable gate — keeper/daemon-scoped roles stay CLI-only.
|
|
366
378
|
const rc = role_options.get(permit_row.role);
|
|
367
379
|
if (!rc?.web_grantable) {
|
|
368
|
-
void
|
|
380
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
369
381
|
event_type: 'permit_revoke',
|
|
370
382
|
outcome: 'failure',
|
|
371
|
-
actor_id: auth.actor.id,
|
|
372
|
-
account_id: auth.account.id,
|
|
373
383
|
target_account_id,
|
|
374
|
-
|
|
384
|
+
target_actor_id,
|
|
375
385
|
metadata: { role: permit_row.role, permit_id: input.permit_id },
|
|
376
|
-
}
|
|
386
|
+
});
|
|
377
387
|
throw jsonrpc_errors.forbidden('role not web-grantable', {
|
|
378
388
|
reason: ERROR_ROLE_NOT_WEB_GRANTABLE,
|
|
379
389
|
});
|
|
@@ -384,25 +394,26 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
384
394
|
// the IDOR check and the UPDATE.
|
|
385
395
|
throw jsonrpc_errors.not_found('permit', { reason: ERROR_PERMIT_NOT_FOUND });
|
|
386
396
|
}
|
|
387
|
-
void
|
|
397
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
388
398
|
event_type: 'permit_revoke',
|
|
389
|
-
actor_id: auth.actor.id,
|
|
390
|
-
account_id: auth.account.id,
|
|
391
399
|
target_account_id,
|
|
392
|
-
|
|
400
|
+
target_actor_id,
|
|
393
401
|
metadata: {
|
|
394
402
|
role: result.role,
|
|
395
403
|
permit_id: result.id,
|
|
396
404
|
scope_id: result.scope_id,
|
|
397
405
|
reason: input.reason ?? undefined,
|
|
398
406
|
},
|
|
399
|
-
}
|
|
407
|
+
});
|
|
408
|
+
// Supersede cascade — the recipient is known (`offer.to_account_id`),
|
|
409
|
+
// so populate `target_account_id` rather than leaving it null;
|
|
410
|
+
// `target_actor_id` inherits the offer's `to_actor_id` (actor-grain
|
|
411
|
+
// when the superseded offer was actor-targeted, null otherwise).
|
|
400
412
|
for (const offer of result.superseded_offers) {
|
|
401
|
-
void
|
|
413
|
+
void emit_permit_target_event(ctx, auth, deps, {
|
|
402
414
|
event_type: 'permit_offer_supersede',
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
ip: ctx.client_ip,
|
|
415
|
+
target_account_id: offer.to_account_id,
|
|
416
|
+
target_actor_id: offer.to_actor_id,
|
|
406
417
|
metadata: {
|
|
407
418
|
offer_id: offer.id,
|
|
408
419
|
role: offer.role,
|
|
@@ -410,7 +421,7 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
410
421
|
reason: 'permit_revoked',
|
|
411
422
|
cause_id: result.id,
|
|
412
423
|
},
|
|
413
|
-
}
|
|
424
|
+
});
|
|
414
425
|
}
|
|
415
426
|
if (notification_sender) {
|
|
416
427
|
const superseded = result.superseded_offers.map((o) => ({
|
|
@@ -438,12 +449,12 @@ export const create_permit_offer_actions = (deps, options = {}) => {
|
|
|
438
449
|
return { ok: true, revoked: true };
|
|
439
450
|
};
|
|
440
451
|
return [
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
452
|
+
rpc_actor_action(permit_offer_create_action_spec, create_handler),
|
|
453
|
+
rpc_actor_action(permit_offer_accept_action_spec, accept_handler),
|
|
454
|
+
rpc_actor_action(permit_offer_decline_action_spec, decline_handler),
|
|
455
|
+
rpc_actor_action(permit_offer_retract_action_spec, retract_handler),
|
|
456
|
+
rpc_actor_action(permit_offer_list_action_spec, list_handler),
|
|
457
|
+
rpc_actor_action(permit_offer_history_action_spec, history_handler),
|
|
458
|
+
rpc_actor_action(permit_revoke_action_spec, revoke_handler),
|
|
448
459
|
];
|
|
449
460
|
};
|
|
@@ -62,6 +62,7 @@ export declare const PermitOfferReceivedParams: z.ZodObject<{
|
|
|
62
62
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
63
63
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
64
64
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
65
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
65
66
|
role: z.ZodString;
|
|
66
67
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
67
68
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -82,6 +83,7 @@ export declare const PermitOfferRetractedParams: z.ZodObject<{
|
|
|
82
83
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
83
84
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
84
85
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
86
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
85
87
|
role: z.ZodString;
|
|
86
88
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
87
89
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -102,6 +104,7 @@ export declare const PermitOfferAcceptedParams: z.ZodObject<{
|
|
|
102
104
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
103
105
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
104
106
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
107
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
105
108
|
role: z.ZodString;
|
|
106
109
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
107
110
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -126,6 +129,7 @@ export declare const PermitOfferDeclinedParams: z.ZodObject<{
|
|
|
126
129
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
127
130
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
128
131
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
132
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
129
133
|
role: z.ZodString;
|
|
130
134
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
131
135
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -154,6 +158,7 @@ export declare const PermitOfferSupersedeParams: z.ZodObject<{
|
|
|
154
158
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
155
159
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
156
160
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
161
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
157
162
|
role: z.ZodString;
|
|
158
163
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
159
164
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -199,6 +204,7 @@ export declare const permit_offer_received_notification_spec: {
|
|
|
199
204
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
200
205
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
201
206
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
207
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
202
208
|
role: z.ZodString;
|
|
203
209
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
204
210
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -227,6 +233,7 @@ export declare const permit_offer_retracted_notification_spec: {
|
|
|
227
233
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
228
234
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
229
235
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
236
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
230
237
|
role: z.ZodString;
|
|
231
238
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
232
239
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -255,6 +262,7 @@ export declare const permit_offer_accepted_notification_spec: {
|
|
|
255
262
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
256
263
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
257
264
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
265
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
258
266
|
role: z.ZodString;
|
|
259
267
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
260
268
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -283,6 +291,7 @@ export declare const permit_offer_declined_notification_spec: {
|
|
|
283
291
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
284
292
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
285
293
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
294
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
286
295
|
role: z.ZodString;
|
|
287
296
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
288
297
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -311,6 +320,7 @@ export declare const permit_offer_supersede_notification_spec: {
|
|
|
311
320
|
id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
312
321
|
from_actor_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
313
322
|
to_account_id: z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">;
|
|
323
|
+
to_actor_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
314
324
|
role: z.ZodString;
|
|
315
325
|
scope_id: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "Uuid", "out">>;
|
|
316
326
|
message: z.ZodNullable<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permit_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAqB,KAAK,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAIrE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAM5D;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAClC,eAAe,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,mBAAmB,KAAK,MAAM,CAAC;CAC5E;AAID,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,0CAA0C,2BAA2B,CAAC;AACnF,eAAO,MAAM,iCAAiC,kBAAkB,CAAC;AAIjE,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"permit_offer_notifications.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/permit_offer_notifications.ts"],"names":[],"mappings":"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"}
|