@iblai/data-layer 1.12.0 → 1.12.1

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.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Platform API token types.
3
+ *
4
+ * The pinned `@iblai/iblai-api` build predates the token-policy fields
5
+ * (`mode`, `policies_to_*`, `groups_to_*`), the detail/PATCH endpoints and the
6
+ * `field-permissions` endpoint, so the shapes those hand-built endpoints use
7
+ * live here.
8
+ */
9
+ /**
10
+ * How a token resolves permissions: `owner` uses the creating user's RBAC
11
+ * permissions, `token_policies` uses the policies/groups bound to the token.
12
+ */
13
+ export type ApiTokenMode = 'owner' | 'token_policies';
14
+ /**
15
+ * A policy or group bound to a token. Only returned by POST, PATCH and the
16
+ * detail endpoint — never by the list endpoint.
17
+ */
18
+ export interface ApiTokenAssociation {
19
+ id: number;
20
+ name?: string | null;
21
+ }
22
+ export interface ApiToken {
23
+ username: string;
24
+ name: string;
25
+ key: string;
26
+ created: string | null;
27
+ expires: string | null;
28
+ mode?: ApiTokenMode;
29
+ policies?: ApiTokenAssociation[];
30
+ groups?: ApiTokenAssociation[];
31
+ /** Present when the endpoint embeds per-field write flags in the payload. */
32
+ field_permissions?: ApiTokenFieldPermissions;
33
+ }
34
+ export interface PaginatedApiTokenList {
35
+ count: number;
36
+ next?: string | null;
37
+ previous?: string | null;
38
+ results: ApiToken[];
39
+ }
40
+ /** POST/PATCH body. `expires_in` is a duration; `expires` is read-only. */
41
+ export interface ApiTokenWriteBody {
42
+ name?: string;
43
+ username?: string;
44
+ key?: string;
45
+ platform_key?: string;
46
+ created?: string;
47
+ expires?: string;
48
+ expires_in?: string | null;
49
+ mode?: ApiTokenMode;
50
+ policies_to_add?: number[];
51
+ policies_to_remove?: number[];
52
+ groups_to_add?: number[];
53
+ groups_to_remove?: number[];
54
+ }
55
+ /**
56
+ * Per-field write flags, e.g. `{ mode: { write: true } }`. A field absent from
57
+ * the map is not RBAC-protected (`name` and `expires_in` are always writable).
58
+ */
59
+ export type ApiTokenFieldPermissions = Record<string, {
60
+ write: boolean;
61
+ }>;