@fuzdev/fuz_app 0.161.0 → 0.163.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/auth/CLAUDE.md +47 -36
- package/dist/auth/account_action_specs.d.ts +614 -150
- package/dist/auth/account_action_specs.d.ts.map +1 -1
- package/dist/auth/account_action_specs.js +56 -52
- package/dist/auth/account_route_schema.d.ts +401 -94
- package/dist/auth/account_route_schema.d.ts.map +1 -1
- package/dist/auth/account_route_schema.js +54 -39
- package/dist/auth/account_routes.js +1 -1
- package/dist/auth/account_schema.d.ts +531 -118
- package/dist/auth/account_schema.d.ts.map +1 -1
- package/dist/auth/account_schema.js +76 -58
- package/dist/auth/admin_action_specs.d.ts +1753 -240
- package/dist/auth/admin_action_specs.d.ts.map +1 -1
- package/dist/auth/admin_action_specs.js +28 -26
- package/dist/auth/admin_actions.d.ts +4 -4
- package/dist/auth/admin_actions.d.ts.map +1 -1
- package/dist/auth/admin_actions.js +3 -3
- package/dist/auth/all_cell_actions.d.ts +3 -3
- package/dist/auth/all_cell_actions.d.ts.map +1 -1
- package/dist/auth/all_cell_actions.js +1 -1
- package/dist/auth/api_token.d.ts +4 -4
- package/dist/auth/api_token.d.ts.map +1 -1
- package/dist/auth/api_token.js +3 -3
- package/dist/auth/audit_emitter.d.ts +8 -3
- package/dist/auth/audit_emitter.d.ts.map +1 -1
- package/dist/auth/audit_emitter.js +32 -9
- package/dist/auth/audit_log_queries.d.ts.map +1 -1
- package/dist/auth/audit_log_queries.js +4 -3
- package/dist/auth/audit_log_schema.d.ts +798 -291
- package/dist/auth/audit_log_schema.d.ts.map +1 -1
- package/dist/auth/audit_log_schema.js +192 -201
- package/dist/auth/bootstrap_route_schema.d.ts +173 -50
- package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
- package/dist/auth/bootstrap_route_schema.js +35 -16
- package/dist/auth/cell_grant_action_specs.d.ts +1 -1
- package/dist/auth/cell_grant_action_specs.js +1 -1
- package/dist/auth/cell_grant_actions.d.ts +4 -4
- package/dist/auth/cell_grant_actions.d.ts.map +1 -1
- package/dist/auth/cell_grant_actions.js +1 -1
- package/dist/auth/credential_type_schema.d.ts +16 -29
- package/dist/auth/credential_type_schema.d.ts.map +1 -1
- package/dist/auth/credential_type_schema.js +14 -18
- package/dist/auth/grant_path_schema.d.ts +15 -29
- package/dist/auth/grant_path_schema.d.ts.map +1 -1
- package/dist/auth/grant_path_schema.js +13 -17
- package/dist/auth/invite_schema.d.ts +98 -26
- package/dist/auth/invite_schema.d.ts.map +1 -1
- package/dist/auth/invite_schema.js +21 -14
- package/dist/auth/migrations.d.ts.map +1 -1
- package/dist/auth/migrations.js +28 -1
- package/dist/auth/name_schema.d.ts +7 -6
- package/dist/auth/name_schema.d.ts.map +1 -1
- package/dist/auth/name_schema.js +8 -9
- package/dist/auth/password.d.ts +15 -7
- package/dist/auth/password.d.ts.map +1 -1
- package/dist/auth/password.js +16 -9
- package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
- package/dist/auth/role_grant_offer_action_specs.js +2 -2
- package/dist/auth/role_grant_offer_actions.d.ts +4 -4
- package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_actions.js +3 -3
- package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
- package/dist/auth/role_grant_offer_notifications.js +2 -2
- package/dist/auth/role_grant_offer_schema.d.ts +8 -8
- package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
- package/dist/auth/role_grant_offer_schema.js +10 -10
- package/dist/auth/role_schema.d.ts +47 -55
- package/dist/auth/role_schema.d.ts.map +1 -1
- package/dist/auth/role_schema.js +29 -35
- package/dist/auth/scope_kind_schema.d.ts +22 -26
- package/dist/auth/scope_kind_schema.d.ts.map +1 -1
- package/dist/auth/scope_kind_schema.js +19 -19
- package/dist/auth/self_service_role_action_specs.js +1 -1
- package/dist/auth/self_service_role_actions.d.ts +6 -6
- package/dist/auth/self_service_role_actions.d.ts.map +1 -1
- package/dist/auth/self_service_role_actions.js +7 -6
- package/dist/auth/signup_route_schema.d.ts +71 -21
- package/dist/auth/signup_route_schema.d.ts.map +1 -1
- package/dist/auth/signup_route_schema.js +18 -16
- package/dist/auth/standard_rpc_actions.d.ts +1 -1
- package/dist/auth/standard_rpc_actions.js +1 -1
- package/dist/auth/token_lifetime.d.ts +33 -9
- package/dist/auth/token_lifetime.d.ts.map +1 -1
- package/dist/auth/token_lifetime.js +8 -7
- package/dist/auth/token_scope.d.ts +99 -25
- package/dist/auth/token_scope.d.ts.map +1 -1
- package/dist/auth/token_scope.js +57 -35
- package/dist/dev/setup.d.ts +14 -7
- package/dist/dev/setup.d.ts.map +1 -1
- package/dist/dev/setup.js +11 -6
- package/dist/primitive_schemas.d.ts +2 -22
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas.js +2 -24
- package/dist/primitive_schemas_fuz.d.ts +56 -2
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +54 -4
- package/dist/testing/CLAUDE.md +29 -8
- package/dist/testing/admin_integration.d.ts +3 -3
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +1 -1
- package/dist/testing/app_server.d.ts +3 -1
- package/dist/testing/app_server.d.ts.map +1 -1
- package/dist/testing/app_server.js +6 -2
- package/dist/testing/audit_drift_guard.d.ts.map +1 -1
- package/dist/testing/audit_drift_guard.js +12 -13
- package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
- package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/default_spine_surface.js +2 -2
- package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
- package/dist/testing/cross_backend/identity_parity.js +43 -8
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
- package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
- package/dist/testing/cross_backend/session_cap.js +4 -3
- 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 +45 -42
- package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.d.ts +4 -4
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
- package/dist/testing/cross_backend/token_lifetime.js +34 -1
- package/dist/testing/db_entities.d.ts +3 -1
- package/dist/testing/db_entities.d.ts.map +1 -1
- package/dist/testing/db_entities.js +4 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +4 -3
- package/dist/testing/token_scope_fixtures.d.ts +24 -0
- package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
- package/dist/testing/token_scope_fixtures.js +49 -0
- 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 +13 -12
- package/dist/ui/BootstrapForm.svelte +4 -2
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte +4 -2
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/zod.d.ts +2 -1
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +6 -2
- package/package.json +1 -1
- package/dist/auth/audit_log_schema_fuz.d.ts +0 -39
- package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
- package/dist/auth/audit_log_schema_fuz.js +0 -37
- package/dist/auth/role_schema_fuz.d.ts +0 -30
- package/dist/auth/role_schema_fuz.d.ts.map +0 -1
- package/dist/auth/role_schema_fuz.js +0 -30
- package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
- package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
- package/dist/auth/scope_kind_schema_fuz.js +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"account_schema.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/account_schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAON,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAc,KAAK,EAAgC,IAAI,EAAE,MAAM,6BAA6B,CAAC;AASpG,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;;OAKG;IACH,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;CACxB;AAED,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,4FAA4F;AAC5F,MAAM,WAAW,KAAK;IACrB,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,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G,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,IAAI,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,OAAO,KAAG,cAMpD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,gBAKlD,CAAC"}
|
|
@@ -5,19 +5,25 @@
|
|
|
5
5
|
* `Account`, `Actor`, `RoleGrant`, `AuthSession`, and `ApiToken`.
|
|
6
6
|
*
|
|
7
7
|
* Identifier primitives (`Username`, `UsernameProvided`, `Email`) live
|
|
8
|
-
* in `primitive_schemas.ts` — they're general
|
|
9
|
-
* don't depend on the auth domain. The auth-shape request-contract
|
|
8
|
+
* in `primitive_schemas.ts` and `primitive_schemas_fuz.ts` — they're general
|
|
9
|
+
* validator shapes that don't depend on the auth domain. The auth-shape request-contract
|
|
10
10
|
* primitive `ActingActor` lives in `http/auth_shape.ts` next to
|
|
11
11
|
* `RouteAuth` (the two pair: `auth.actor !== 'none'` ⟺ input declares
|
|
12
12
|
* `acting?: ActingActor`).
|
|
13
13
|
*
|
|
14
|
+
* The wire schemas are `@fuzdev/fuz_schema` schemas, `SessionId` among them.
|
|
15
|
+
*
|
|
14
16
|
* DDL lives in `auth/auth_ddl.ts`; role system in `auth/role_schema.ts`.
|
|
15
17
|
* See docs/identity.md for design rationale.
|
|
16
18
|
*
|
|
17
19
|
* @module
|
|
18
20
|
*/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
+
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
22
|
+
import { array, boolean, brand, nullable, object, string } from '@fuzdev/fuz_schema/schema.ts';
|
|
23
|
+
import { Blake3Hash, Email, Timestamp, UsernameCanonical, Uuid } from '../primitive_schemas_fuz.js';
|
|
24
|
+
import { RoleName } from './role_schema.js';
|
|
25
|
+
import { ScopeKindName } from './scope_kind_schema.js';
|
|
26
|
+
import { ApiTokenId } from './api_token.js';
|
|
21
27
|
import { is_iso8601_seconds_live } from '../timestamp.js';
|
|
22
28
|
/**
|
|
23
29
|
* Maximum length of the optional free-form `revoked_reason` attached to a
|
|
@@ -72,79 +78,88 @@ export const is_role_grant_active = (p, now = new Date()) => !p.revoked_at && (!
|
|
|
72
78
|
export const has_global_role = (role_grants, role, now = new Date()) => role_grants.some((p) => p.role === role && p.scope_id === null && is_role_grant_active(p, now));
|
|
73
79
|
/**
|
|
74
80
|
* A session's storage key — the blake3 hash of its raw token, branded so a
|
|
75
|
-
* bare `string` can't stand in for one. `Blake3Hash` (`
|
|
76
|
-
* the shape; this is the meaning. Mint only via `hash_session_token`, or
|
|
77
|
-
*
|
|
81
|
+
* bare `string` can't stand in for one. `Blake3Hash` (`primitive_schemas_fuz.ts`)
|
|
82
|
+
* is the shape; this is the meaning. Mint only via `hash_session_token`, or a
|
|
83
|
+
* parse of this schema at an external boundary.
|
|
78
84
|
*
|
|
79
85
|
* The raw token itself is never typed — it stays a `string` that exists only
|
|
80
86
|
* long enough to be hashed.
|
|
81
87
|
*/
|
|
82
|
-
export const SessionId =
|
|
83
|
-
// Client-safe
|
|
84
|
-
/**
|
|
85
|
-
|
|
88
|
+
export const SessionId = brand(Blake3Hash, 'SessionId');
|
|
89
|
+
// Client-safe schemas — for route output validation and ActionSpec outputs.
|
|
90
|
+
/**
|
|
91
|
+
* `SessionAccount` — account without sensitive fields, a `@fuzdev/fuz_schema`
|
|
92
|
+
* schema. Its `username` is `UsernameCanonical`, the lowercase an account row
|
|
93
|
+
* holds.
|
|
94
|
+
*/
|
|
95
|
+
export const SessionAccountJson = object({
|
|
86
96
|
id: Uuid,
|
|
87
|
-
username:
|
|
88
|
-
email:
|
|
89
|
-
email_verified:
|
|
90
|
-
created_at:
|
|
97
|
+
username: UsernameCanonical,
|
|
98
|
+
email: nullable(Email),
|
|
99
|
+
email_verified: boolean,
|
|
100
|
+
created_at: Timestamp
|
|
91
101
|
});
|
|
92
|
-
/**
|
|
93
|
-
export const AuthSessionJson =
|
|
102
|
+
/** `AuthSession` — id is the blake3 hash, safe for client. A `@fuzdev/fuz_schema` schema. */
|
|
103
|
+
export const AuthSessionJson = object({
|
|
94
104
|
id: SessionId,
|
|
95
105
|
account_id: Uuid,
|
|
96
|
-
created_at:
|
|
97
|
-
expires_at:
|
|
98
|
-
is_current:
|
|
106
|
+
created_at: Timestamp,
|
|
107
|
+
expires_at: Timestamp,
|
|
108
|
+
is_current: meta(boolean, {
|
|
99
109
|
description: 'Whether this is the session the request authenticated with — `false` on every row for a non-session credential.'
|
|
100
110
|
})
|
|
101
111
|
});
|
|
102
|
-
/**
|
|
103
|
-
export const ClientApiTokenJson =
|
|
104
|
-
id:
|
|
112
|
+
/** Client-safe API token listing (excludes `token_hash`), a `@fuzdev/fuz_schema` schema. */
|
|
113
|
+
export const ClientApiTokenJson = object({
|
|
114
|
+
id: ApiTokenId,
|
|
105
115
|
account_id: Uuid,
|
|
106
|
-
name:
|
|
107
|
-
expires_at:
|
|
108
|
-
last_used_at:
|
|
109
|
-
last_used_ip:
|
|
110
|
-
created_at:
|
|
116
|
+
name: string,
|
|
117
|
+
expires_at: nullable(Timestamp),
|
|
118
|
+
last_used_at: nullable(Timestamp),
|
|
119
|
+
last_used_ip: nullable(string),
|
|
120
|
+
created_at: Timestamp,
|
|
111
121
|
/**
|
|
112
122
|
* Human-readable scope label (`full` / `full (grandfathered)` /
|
|
113
123
|
* `N methods`). A label rather than the document so the list stays a display
|
|
114
124
|
* surface — nothing authorizes off this, and a grandfathered token reads
|
|
115
125
|
* differently from a deliberately-full one.
|
|
116
126
|
*/
|
|
117
|
-
scope:
|
|
127
|
+
scope: string
|
|
118
128
|
});
|
|
119
|
-
/**
|
|
120
|
-
export const RoleGrantSummaryJson =
|
|
129
|
+
/** The role_grant summary returned in admin account listings, a `@fuzdev/fuz_schema` schema. */
|
|
130
|
+
export const RoleGrantSummaryJson = object({
|
|
121
131
|
id: Uuid,
|
|
122
|
-
role:
|
|
123
|
-
scope_kind:
|
|
124
|
-
scope_id:
|
|
125
|
-
created_at:
|
|
126
|
-
expires_at:
|
|
127
|
-
granted_by:
|
|
132
|
+
role: RoleName,
|
|
133
|
+
scope_kind: nullable(ScopeKindName),
|
|
134
|
+
scope_id: nullable(Uuid),
|
|
135
|
+
created_at: Timestamp,
|
|
136
|
+
expires_at: nullable(Timestamp),
|
|
137
|
+
granted_by: nullable(Uuid)
|
|
128
138
|
});
|
|
129
|
-
/**
|
|
130
|
-
export const ActorSummaryJson =
|
|
139
|
+
/** The actor summary returned in admin account listings, a `@fuzdev/fuz_schema` schema. */
|
|
140
|
+
export const ActorSummaryJson = object({
|
|
131
141
|
id: Uuid,
|
|
132
|
-
name:
|
|
142
|
+
name: string
|
|
133
143
|
});
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Admin-facing account data — `SessionAccountJson`'s entries with audit
|
|
146
|
+
* fields, a `@fuzdev/fuz_schema` schema.
|
|
147
|
+
*/
|
|
148
|
+
export const AdminAccountJson = object({
|
|
149
|
+
...SessionAccountJson.def,
|
|
150
|
+
updated_at: Timestamp,
|
|
151
|
+
updated_by: nullable(Uuid),
|
|
138
152
|
/**
|
|
139
153
|
* Soft-delete tombstone, non-null when the account is deleted. Surfaced
|
|
140
154
|
* so the admin UI can mark tombstoned rows (shown only when the listing
|
|
141
155
|
* is requested with `include_deleted`) and offer reactivation via
|
|
142
156
|
* `account_undelete`. Active listings always carry `null` here.
|
|
143
157
|
*/
|
|
144
|
-
deleted_at:
|
|
158
|
+
deleted_at: nullable(Timestamp)
|
|
145
159
|
});
|
|
146
160
|
/**
|
|
147
|
-
*
|
|
161
|
+
* A pending role_grant offer surfaced in admin account listings, a
|
|
162
|
+
* `@fuzdev/fuz_schema` schema.
|
|
148
163
|
*
|
|
149
164
|
* Deliberately narrower than `RoleGrantOfferJson`: omits `message` and
|
|
150
165
|
* `decline_reason` so cross-admin visibility of the listing does not expose
|
|
@@ -156,22 +171,25 @@ export const AdminAccountJson = SessionAccountJson.extend({
|
|
|
156
171
|
* at a glance whose pending offer is blocking a "+ {role}" button; the
|
|
157
172
|
* resolution runs inside the listing query's parallel batch.
|
|
158
173
|
*/
|
|
159
|
-
export const PendingOfferSummaryJson =
|
|
174
|
+
export const PendingOfferSummaryJson = object({
|
|
160
175
|
id: Uuid,
|
|
161
|
-
role:
|
|
162
|
-
scope_kind:
|
|
163
|
-
scope_id:
|
|
176
|
+
role: RoleName,
|
|
177
|
+
scope_kind: nullable(ScopeKindName),
|
|
178
|
+
scope_id: nullable(Uuid),
|
|
164
179
|
from_actor_id: Uuid,
|
|
165
|
-
from_username:
|
|
166
|
-
created_at:
|
|
167
|
-
expires_at:
|
|
180
|
+
from_username: string,
|
|
181
|
+
created_at: Timestamp,
|
|
182
|
+
expires_at: Timestamp
|
|
168
183
|
});
|
|
169
|
-
/**
|
|
170
|
-
|
|
184
|
+
/**
|
|
185
|
+
* An admin account listing entry (account + actor + role_grants + pending
|
|
186
|
+
* offers), a `@fuzdev/fuz_schema` schema.
|
|
187
|
+
*/
|
|
188
|
+
export const AdminAccountEntryJson = object({
|
|
171
189
|
account: AdminAccountJson,
|
|
172
|
-
actor:
|
|
173
|
-
role_grants:
|
|
174
|
-
pending_offers:
|
|
190
|
+
actor: nullable(ActorSummaryJson),
|
|
191
|
+
role_grants: array(RoleGrantSummaryJson),
|
|
192
|
+
pending_offers: array(PendingOfferSummaryJson)
|
|
175
193
|
});
|
|
176
194
|
/**
|
|
177
195
|
* Convert an `Account` to a `SessionAccount` by stripping sensitive fields.
|