@gleb216/warden-angular 0.0.0-stage → 0.1.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/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@gleb216/warden-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Angular side of the warden core: session in memory, interceptor, guards, permissions in the UI",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/GlebStepenko/warden.lib.git",
9
+ "directory": "angular"
10
+ },
11
+ "peerDependencies": {
12
+ "@angular/common": "^22.2.0",
13
+ "@angular/core": "^22.2.0",
14
+ "@angular/router": "^22.2.0",
15
+ "rxjs": "~7.8.0"
16
+ },
17
+ "dependencies": {
18
+ "tslib": "^2.3.0"
19
+ },
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "module": "fesm2022/gleb216-warden-angular.mjs",
25
+ "typings": "types/gleb216-warden-angular.d.ts",
26
+ "exports": {
27
+ "./package.json": {
28
+ "default": "./package.json"
29
+ },
30
+ ".": {
31
+ "types": "./types/gleb216-warden-angular.d.ts",
32
+ "default": "./fesm2022/gleb216-warden-angular.mjs"
33
+ },
34
+ "./contracts": {
35
+ "types": "./types/gleb216-warden-angular-contracts.d.ts",
36
+ "default": "./fesm2022/gleb216-warden-angular-contracts.mjs"
37
+ }
38
+ },
39
+ "type": "module"
6
40
  }
@@ -0,0 +1,361 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /** A calendar date without time and time zone: `'2026-10-25'`. Matches PostgreSQL `date`. */
5
+ type IsoDate = string;
6
+ /** A moment in UTC, ISO 8601: `'2026-10-25T11:03:11.123456+00:00'`. Matches PostgreSQL `timestamptz`. */
7
+ type IsoDateTime = string;
8
+ /** Machine codes of API errors; the client picks the user-facing text by the code. */
9
+ type WardenErrorCode = 'unauthenticated' | 'session_invalid' | 'forbidden' | 'invalid_credentials' | 'too_many_attempts' | 'origin_forbidden' | 'login_forbidden' | 'oidc_email_not_verified' | 'oidc_user_unknown' | 'oidc_failed' | 'validation_failed' | 'not_found' | 'duplicate' | 'email_taken' | 'last_login_method' | 'link_invalid' | 'internal_error';
10
+ /** Body of every error response. `code` may also be a domain-specific code raised by a DB function. */
11
+ interface ApiError {
12
+ statusCode: number;
13
+ code: WardenErrorCode | (string & {});
14
+ message: string;
15
+ /** Seconds until the next login attempt is allowed (`too_many_attempts` only). */
16
+ retryAfterSeconds?: number;
17
+ }
18
+ interface LoginRequestDto {
19
+ email: string;
20
+ password: string;
21
+ }
22
+ interface MeUserDto {
23
+ id: string;
24
+ email: string;
25
+ firstName: string | null;
26
+ secondName: string | null;
27
+ middleName: string | null;
28
+ }
29
+ /**
30
+ * Where the user has an action: everywhere, or on these nodes of the hierarchy and everything below them. For
31
+ * showing the interface only: the server checks every request.
32
+ */
33
+ type PermissionScopeDto = {
34
+ action: string;
35
+ global: true;
36
+ } | {
37
+ action: string;
38
+ global: false;
39
+ entityIds: Array<string>;
40
+ };
41
+ interface MeDto {
42
+ user: MeUserDto;
43
+ /** Every action of the user (e.g. `'orders.read'`) with its scope, sorted by action. */
44
+ permissions: Array<PermissionScopeDto>;
45
+ }
46
+ interface AuthSessionDto extends MeDto {
47
+ /** Short-lived access token; keep it in memory only. */
48
+ accessToken: string;
49
+ accessExpiresAt: IsoDateTime;
50
+ }
51
+ interface AuthProviderDto {
52
+ id: string;
53
+ label: string;
54
+ }
55
+ interface LoginIdentityDto {
56
+ id: string;
57
+ provider: string;
58
+ email: string | null;
59
+ linkedAt: IsoDateTime;
60
+ lastLoginAt: IsoDateTime | null;
61
+ }
62
+ interface LoginMethodsDto {
63
+ hasPassword: boolean;
64
+ identities: Array<LoginIdentityDto>;
65
+ }
66
+ interface ChangePasswordDto {
67
+ /** Required when the user already has a password. */
68
+ currentPassword?: string;
69
+ newPassword: string;
70
+ }
71
+ /** Which users the administration list shows (specs/003-settings-users). */
72
+ type AdminUserState = 'all' | 'active' | 'blocked';
73
+ type AdminUserSort = 'createdAt' | 'name';
74
+ type SortDirection = 'asc' | 'desc';
75
+ /** Query of `GET /admin/users`; omitted fields take the defaults (all, createdAt desc, page 1, 25 per page). */
76
+ interface AdminUserListQuery {
77
+ search?: string;
78
+ state?: AdminUserState;
79
+ sort?: AdminUserSort;
80
+ direction?: SortDirection;
81
+ page?: number;
82
+ pageSize?: 10 | 25 | 50 | 100;
83
+ }
84
+ /** A user in the administration list: no password hash and no block reason. */
85
+ interface AdminUserRowDto {
86
+ id: string;
87
+ email: string;
88
+ firstName: string | null;
89
+ secondName: string | null;
90
+ middleName: string | null;
91
+ /** The system groups (without an owner organization), by name. */
92
+ groups: Array<AdminGroupNameDto>;
93
+ /** Ids of the linked login providers (`'google'`, `'microsoft'`). */
94
+ providers: Array<string>;
95
+ hasPassword: boolean;
96
+ isBlocked: boolean;
97
+ createdAt: IsoDateTime;
98
+ }
99
+ interface AdminUserListDto {
100
+ items: Array<AdminUserRowDto>;
101
+ /** Users matching the search and the state. */
102
+ total: number;
103
+ /** The page actually returned: the last one when a larger page was asked for. */
104
+ page: number;
105
+ pageSize: number;
106
+ /** Users matching the search, by state (without the state filter). */
107
+ counts: {
108
+ all: number;
109
+ active: number;
110
+ blocked: number;
111
+ };
112
+ }
113
+ /** Another user referred to by a record, e.g. who issued a grant. */
114
+ interface AdminUserRefDto {
115
+ id: string;
116
+ email: string | null;
117
+ firstName: string | null;
118
+ secondName: string | null;
119
+ isSystem: boolean;
120
+ }
121
+ /** Who blocked a user, when and why: the card only, the list has no reason (specs/007-user-block-password). */
122
+ interface AdminUserBlockDto {
123
+ at: IsoDateTime;
124
+ /** The author; null when that user no longer exists. */
125
+ by: AdminUserRefDto | null;
126
+ reason: string;
127
+ }
128
+ /** A user in the administration card: a row of the list plus the block details; `isBlocked === (block !== null)`. */
129
+ interface AdminUserDto extends AdminUserRowDto {
130
+ block: AdminUserBlockDto | null;
131
+ /** The last invitation of an active user without a password (specs/015); `null` — none. */
132
+ invitation: AdminInvitationStateDto | null;
133
+ }
134
+ /** Language of a letter (specs/014): the build of the interface the request came from. */
135
+ type MailLang = 'uk' | 'en';
136
+ /** State of a letter in the mail queue (specs/014) as the card shows it. */
137
+ interface MailStateDto {
138
+ status: 'pending' | 'sent' | 'failed' | 'disabled';
139
+ attempts: number;
140
+ }
141
+ /** The invitation of a user on the card (specs/015 data-model.md). */
142
+ interface AdminInvitationStateDto {
143
+ createdAt: IsoDateTime;
144
+ createdBy: {
145
+ id: string;
146
+ name: string;
147
+ } | null;
148
+ expiresAt: IsoDateTime;
149
+ expired: boolean;
150
+ /** `null` — no letter (removed after 30 days). */
151
+ mail: MailStateDto | null;
152
+ }
153
+ /** Body of `POST /admin/users` (specs/015). */
154
+ interface AdminUserCreateRequest {
155
+ email: string;
156
+ firstName?: string | null;
157
+ secondName?: string | null;
158
+ middleName?: string | null;
159
+ method: 'invite' | 'password';
160
+ /** For `password` only. */
161
+ password?: string;
162
+ lang?: MailLang;
163
+ }
164
+ /** A new invitation link: shown only in the response that created it. */
165
+ interface AdminInvitationLinkDto {
166
+ link: string;
167
+ expiresAt: IsoDateTime;
168
+ /** `false` — no letter was sent; the administrator passes the link on. */
169
+ mailEnabled: boolean;
170
+ }
171
+ /** The created user (core.user_json). */
172
+ interface AdminCreatedUserDto {
173
+ id: string;
174
+ email: string;
175
+ firstName: string | null;
176
+ secondName: string | null;
177
+ middleName: string | null;
178
+ hasPassword: boolean;
179
+ }
180
+ interface AdminUserCreateResponse {
181
+ user: AdminCreatedUserDto;
182
+ invitation: AdminInvitationLinkDto | null;
183
+ }
184
+ /** Body of `POST /admin/users/:id/invitation` (specs/015). */
185
+ interface AdminInvitationRequest {
186
+ lang?: MailLang;
187
+ }
188
+ /**
189
+ * Codes (`ApiError.code`) of the administration of users and groups (specs/005, 007, 008, 011): what the routes
190
+ * `/admin/users/…` and `/admin/groups/…` refuse with. The application gives each its text.
191
+ */
192
+ type AdminErrorCode = 'not_found' | 'forbidden' | 'validation_failed' | 'system_user' | 'self_block' | 'self_password' | 'reason_required' | 'reason_too_long' | 'last_access_manager' | 'self_grant' | 'self_revoke' | 'grant_too_wide' | 'grant_subject_required' | 'action_not_in_catalog' | 'role_not_found' | 'name_required' | 'name_too_long' | 'description_too_long' | 'group_name_taken' | 'group_too_wide' | 'user_not_found' | 'email_taken' | 'has_password' | 'user_blocked' | 'invalid_arguments';
193
+ /** A system role for the page «Roles and actions» (specs/010-settings-roles). */
194
+ interface AdminRoleDto {
195
+ code: string;
196
+ title: string;
197
+ description: string | null;
198
+ /** Own actions of the role, sorted. */
199
+ actions: Array<string>;
200
+ /** Every action of the role with the included roles at any depth, sorted, without repeats. */
201
+ allActions: Array<string>;
202
+ /** Codes of the directly included roles, sorted. */
203
+ includes: Array<string>;
204
+ }
205
+ /** An action of the catalog with where it can be granted. */
206
+ interface AdminActionDto {
207
+ action: string;
208
+ grantScope: 'global' | 'node';
209
+ description: string | null;
210
+ }
211
+ /**
212
+ * Why a role or an action cannot be granted to this user or group now (specs/008-user-grants, 011); `global_only` —
213
+ * on a node of the hierarchy, while the subject holds an action granted only globally (specs/012).
214
+ */
215
+ type AdminGrantOptionState = 'available' | 'granted' | 'wider' | 'global_only';
216
+ /** A role of the catalog for the grant dialog. */
217
+ interface AdminGrantRoleOptionDto {
218
+ code: string;
219
+ title: string;
220
+ description: string | null;
221
+ /** Every action of the role with the included roles, sorted. */
222
+ actions: Array<string>;
223
+ state: AdminGrantOptionState;
224
+ }
225
+ /** An action of the catalog for the grant dialog. */
226
+ interface AdminGrantActionOptionDto {
227
+ action: string;
228
+ description: string | null;
229
+ state: AdminGrantOptionState;
230
+ }
231
+ /** What the signed-in administrator can grant to the user or the group globally. */
232
+ interface AdminGrantOptionsDto {
233
+ roles: Array<AdminGrantRoleOptionDto>;
234
+ actions: Array<AdminGrantActionOptionDto>;
235
+ }
236
+ /** Body of `POST /admin/users/:id/grants` and `POST /admin/groups/:id/grants`: exactly one of the two. */
237
+ interface AdminGrantRequest {
238
+ role?: string;
239
+ action?: string;
240
+ }
241
+ /** Body of `POST /admin/users/:id/block`: the reason, 1–500 characters after trimming. */
242
+ interface AdminUserBlockRequest {
243
+ reason: string;
244
+ }
245
+ /** Body of `PUT /admin/users/:id/password`: the new password (at least 10 characters). */
246
+ interface AdminUserPasswordRequest {
247
+ password: string;
248
+ }
249
+ /** A global grant of a user (personal) or of a group: a role or an action. */
250
+ interface AdminGrantDto {
251
+ id: number;
252
+ kind: 'role' | 'action';
253
+ code: string;
254
+ title: string | null;
255
+ grantedAt: IsoDateTime;
256
+ /** `null` when the issuer is unknown. */
257
+ grantedBy: AdminUserRefDto | null;
258
+ }
259
+ /** A system group as a user refers to it (specs/011). */
260
+ interface AdminGroupNameDto {
261
+ id: string;
262
+ name: string;
263
+ }
264
+ /** A system group in the list of Settings › Groups (specs/011-settings-groups). */
265
+ interface AdminGroupRowDto {
266
+ id: string;
267
+ name: string;
268
+ description: string | null;
269
+ /** Always `null` on this page; the CLI lists groups of an organization with it. */
270
+ ownerEntityId: string | null;
271
+ /** The number of members. */
272
+ members: number;
273
+ /** Global grants of the group: roles first, then actions, by code. */
274
+ grants: Array<{
275
+ kind: 'role' | 'action';
276
+ code: string;
277
+ }>;
278
+ }
279
+ /** A group as creating or changing it answers. */
280
+ interface AdminGroupRefDto {
281
+ id: string;
282
+ name: string;
283
+ description: string | null;
284
+ ownerEntityId: string | null;
285
+ }
286
+ /** A member of a group. */
287
+ interface AdminGroupMemberDto {
288
+ id: string;
289
+ email: string;
290
+ firstName: string | null;
291
+ secondName: string | null;
292
+ middleName: string | null;
293
+ isBlocked: boolean;
294
+ addedAt: IsoDateTime;
295
+ }
296
+ /** A system group with its members; its grants come separately. */
297
+ interface AdminGroupDto {
298
+ id: string;
299
+ name: string;
300
+ description: string | null;
301
+ createdAt: IsoDateTime;
302
+ /** The signed-in administrator has every action of the grants of the group: may change the members and delete it. */
303
+ canManage: boolean;
304
+ /** By second name, then first name, then email. */
305
+ members: Array<AdminGroupMemberDto>;
306
+ }
307
+ /** Body of `POST /admin/groups` and `PATCH /admin/groups/:id`: name 1–100, description up to 500 after trimming. */
308
+ interface AdminGroupRequest {
309
+ name: string;
310
+ description?: string | null;
311
+ }
312
+ /** Body of `POST /admin/groups/:id/members`: the user found by `GET /admin/users/find` (specs/012 FR-024). */
313
+ interface AdminGroupMemberRequest {
314
+ userId: string;
315
+ }
316
+ /** A user found by the exact email before granting or adding to a group (`GET /admin/users/find`, specs/012 R5). */
317
+ interface UserLookupDto {
318
+ id: string;
319
+ name: string | null;
320
+ email: string;
321
+ isBlocked: boolean;
322
+ }
323
+ /** An effective action of a user with where it applies and where it comes from. */
324
+ interface AdminUserPermissionDto {
325
+ action: string;
326
+ title: string | null;
327
+ /** `null` — globally; otherwise the node of the hierarchy. */
328
+ entityId: string | null;
329
+ via: 'direct' | 'group';
330
+ group: string | null;
331
+ /** The role that was granted, when the action comes through a role. */
332
+ role: string | null;
333
+ /** From the granted role down to the role that holds the action; `[]` without a role. */
334
+ rolePath: Array<string>;
335
+ }
336
+ /** Kind of a one-time link (specs/015). */
337
+ type AuthLinkKind = 'invite' | 'reset';
338
+ /** Body of `POST /auth/link`: the secret from the fragment of the link. */
339
+ interface AuthLinkRequestDto {
340
+ kind: AuthLinkKind;
341
+ token: string;
342
+ }
343
+ /** A valid link: the email of its owner, shown read-only. */
344
+ interface AuthLinkDto {
345
+ email: string;
346
+ }
347
+ /** Body of `POST /auth/link/password`: answered like `/auth/login`. */
348
+ interface AuthLinkPasswordRequestDto extends AuthLinkRequestDto {
349
+ password: string;
350
+ }
351
+ /** `GET /auth/password-reset`: whether «Forgot password?» can send a letter. */
352
+ interface PasswordResetAvailabilityDto {
353
+ available: boolean;
354
+ }
355
+ /** Body of `POST /auth/password-reset`. */
356
+ interface PasswordResetRequestDto {
357
+ email: string;
358
+ lang?: MailLang;
359
+ }
360
+ export type { AdminActionDto, AdminCreatedUserDto, AdminErrorCode, AdminGrantActionOptionDto, AdminGrantDto, AdminGrantOptionState, AdminGrantOptionsDto, AdminGrantRequest, AdminGrantRoleOptionDto, AdminGroupDto, AdminGroupMemberDto, AdminGroupMemberRequest, AdminGroupNameDto, AdminGroupRefDto, AdminGroupRequest, AdminGroupRowDto, AdminInvitationLinkDto, AdminInvitationRequest, AdminInvitationStateDto, AdminRoleDto, AdminUserBlockDto, AdminUserBlockRequest, AdminUserCreateRequest, AdminUserCreateResponse, AdminUserDto, AdminUserListDto, AdminUserListQuery, AdminUserPasswordRequest, AdminUserPermissionDto, AdminUserRefDto, AdminUserRowDto, AdminUserSort, AdminUserState, ApiError, AuthLinkDto, AuthLinkKind, AuthLinkPasswordRequestDto, AuthLinkRequestDto, AuthProviderDto, AuthSessionDto, ChangePasswordDto, IsoDate, IsoDateTime, LoginIdentityDto, LoginMethodsDto, LoginRequestDto, MailLang, MailStateDto, MeDto, MeUserDto, PasswordResetAvailabilityDto, PasswordResetRequestDto, PermissionScopeDto, SortDirection, UserLookupDto, WardenErrorCode };
361
+ //# sourceMappingURL=gleb216-warden-angular-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gleb216-warden-angular-contracts.d.ts","names":[],"sources":["../../contracts/src/index.ts"],"mappings":"AAIA;;;;KAAY;;KAGA;;KAGA;;UAoBK;EACf;EACA,MAAM;EACN;;EAEA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;;;;;;KAOU;EAAuB;EAAgB;;EAAmB;EAAgB;EAAe,WAAW;;UAE/F;EACf,MAAM;;EAEN,aAAa,MAAM;;UAGJ,uBAAuB;;EAEtC;EACA,iBAAiB;;UAGF;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,YAAY,MAAM;;UAGH;;EAEf;EACA;;;KAIU;KACA;KACA;;UAGK;EACf;EACA,QAAQ;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