@owlmeans/iam 0.1.18-rc.8 → 0.1.18

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.
Files changed (110) hide show
  1. package/README.md +185 -15
  2. package/agent-meta/manifest.json +92 -4
  3. package/agent-meta/skills/iam/SKILL.md +91 -177
  4. package/agent-meta/skills/iam/parts/clients.md +93 -0
  5. package/agent-meta/skills/iam/parts/permissions.md +106 -0
  6. package/agent-meta/skills/iam/parts/service.md +115 -0
  7. package/agent-meta/skills/iam/parts/tenancy.md +72 -0
  8. package/build/consts.d.ts +170 -1
  9. package/build/consts.d.ts.map +1 -1
  10. package/build/consts.js +221 -0
  11. package/build/consts.js.map +1 -1
  12. package/build/consts.local.d.ts +58 -0
  13. package/build/consts.local.d.ts.map +1 -0
  14. package/build/consts.local.js +21 -0
  15. package/build/consts.local.js.map +1 -0
  16. package/build/errors.d.ts +26 -0
  17. package/build/errors.d.ts.map +1 -1
  18. package/build/errors.js +38 -0
  19. package/build/errors.js.map +1 -1
  20. package/build/facet.d.ts +10 -0
  21. package/build/facet.d.ts.map +1 -0
  22. package/build/facet.js +16 -0
  23. package/build/facet.js.map +1 -0
  24. package/build/gate/consts.local.d.ts +2 -0
  25. package/build/gate/consts.local.d.ts.map +1 -0
  26. package/build/gate/consts.local.js +3 -0
  27. package/build/gate/consts.local.js.map +1 -0
  28. package/build/gate/index.d.ts +4 -0
  29. package/build/gate/index.d.ts.map +1 -0
  30. package/build/gate/index.js +4 -0
  31. package/build/gate/index.js.map +1 -0
  32. package/build/gate/param.d.ts +6 -0
  33. package/build/gate/param.d.ts.map +1 -0
  34. package/build/gate/param.js +83 -0
  35. package/build/gate/param.js.map +1 -0
  36. package/build/gate/resolve.d.ts +10 -0
  37. package/build/gate/resolve.d.ts.map +1 -0
  38. package/build/gate/resolve.js +93 -0
  39. package/build/gate/resolve.js.map +1 -0
  40. package/build/gate/types.d.ts +109 -0
  41. package/build/gate/types.d.ts.map +1 -0
  42. package/build/gate/types.js +2 -0
  43. package/build/gate/types.js.map +1 -0
  44. package/build/gate/types.local.d.ts +5 -0
  45. package/build/gate/types.local.d.ts.map +1 -0
  46. package/build/gate/types.local.js +2 -0
  47. package/build/gate/types.local.js.map +1 -0
  48. package/build/gate/validate.d.ts +4 -0
  49. package/build/gate/validate.d.ts.map +1 -0
  50. package/build/gate/validate.js +100 -0
  51. package/build/gate/validate.js.map +1 -0
  52. package/build/index.d.ts +9 -0
  53. package/build/index.d.ts.map +1 -1
  54. package/build/index.js +5 -0
  55. package/build/index.js.map +1 -1
  56. package/build/permission/types.d.ts +35 -0
  57. package/build/permission/types.d.ts.map +1 -0
  58. package/build/permission/types.js +2 -0
  59. package/build/permission/types.js.map +1 -0
  60. package/build/permission.d.ts +8 -0
  61. package/build/permission.d.ts.map +1 -0
  62. package/build/permission.js +34 -0
  63. package/build/permission.js.map +1 -0
  64. package/build/runtime/types.d.ts +90 -0
  65. package/build/runtime/types.d.ts.map +1 -0
  66. package/build/runtime/types.js +2 -0
  67. package/build/runtime/types.js.map +1 -0
  68. package/build/runtime.d.ts +75 -0
  69. package/build/runtime.d.ts.map +1 -0
  70. package/build/runtime.js +75 -0
  71. package/build/runtime.js.map +1 -0
  72. package/build/schemas.d.ts +13 -0
  73. package/build/schemas.d.ts.map +1 -0
  74. package/build/schemas.js +108 -0
  75. package/build/schemas.js.map +1 -0
  76. package/build/types.d.ts +429 -30
  77. package/build/types.d.ts.map +1 -1
  78. package/build/utils/types.d.ts +12 -0
  79. package/build/utils/types.d.ts.map +1 -0
  80. package/build/utils/types.js +2 -0
  81. package/build/utils/types.js.map +1 -0
  82. package/build/utils.d.ts +7 -6
  83. package/build/utils.d.ts.map +1 -1
  84. package/build/utils.js +10 -1
  85. package/build/utils.js.map +1 -1
  86. package/package.json +12 -7
  87. package/src/consts.local.ts +26 -0
  88. package/src/consts.ts +241 -1
  89. package/src/errors.ts +44 -0
  90. package/src/facet.ts +17 -0
  91. package/src/gate/consts.local.ts +3 -0
  92. package/src/gate/index.ts +3 -0
  93. package/src/gate/param.ts +108 -0
  94. package/src/gate/resolve.ts +114 -0
  95. package/src/gate/types.local.ts +4 -0
  96. package/src/gate/types.ts +117 -0
  97. package/src/gate/validate.ts +123 -0
  98. package/src/index.ts +9 -0
  99. package/src/permission/types.ts +33 -0
  100. package/src/permission.ts +48 -0
  101. package/src/runtime/types.ts +107 -0
  102. package/src/runtime.ts +142 -0
  103. package/src/schemas.ts +122 -0
  104. package/src/types.ts +492 -31
  105. package/src/utils/types.ts +11 -0
  106. package/src/utils.ts +12 -7
  107. package/tests/gate-param.spec.ts +233 -0
  108. package/tests/runtime.spec.ts +101 -0
  109. package/tests/tsconfig.json +12 -0
  110. package/tests/utils.spec.ts +47 -1
package/build/types.d.ts CHANGED
@@ -1,5 +1,20 @@
1
1
  import type { InitializedService } from '@owlmeans/context';
2
- import type { OidcProviderConfig } from '@owlmeans/oidc';
2
+ import type { OidcOrganizationClaim, OidcPermissionSetClaim, OidcProviderConfig } from '@owlmeans/oidc';
3
+ import { type IamDefaultClass, type IamGrantMode, type IamGrantOrigin, type IamRemovalPolicy, IAM_AREAS, IAM_MODE_INTEGRATED, IAM_MODE_KEYCLOAK } from './consts.js';
4
+ /**
5
+ * A client's own configuration, stored with its registration.
6
+ *
7
+ * The two tenancy flags decide which organizations the client's subjects act in. With NEITHER, every
8
+ * subject acts in the client's owning organization (a single-tenant app). With either, every subject
9
+ * acts in organizations of its own, and the runtime IAM API lets their owners manage them — `users`
10
+ * opens the `user` area to those owners, `operators` the `operator` area. Anything else is the
11
+ * client's arbitrary configuration, carried through untouched.
12
+ */
13
+ export interface IamClientConfig {
14
+ operators?: boolean;
15
+ users?: boolean;
16
+ [key: string]: unknown;
17
+ }
3
18
  export interface IamClient {
4
19
  id?: string;
5
20
  clientId: string;
@@ -7,6 +22,10 @@ export interface IamClient {
7
22
  name?: string;
8
23
  /** The entity realm this client belongs to — replaces the old (client as any)._realm hack */
9
24
  realm?: string;
25
+ config?: IamClientConfig;
26
+ }
27
+ /** A client as a reader that must never see its secret gets it. */
28
+ export interface IamClientInfo extends Omit<IamClient, 'secret'> {
10
29
  }
11
30
  export interface IamCredentialsPair {
12
31
  token: string;
@@ -25,14 +44,55 @@ export interface IamClientOptions {
25
44
  * unusable client.
26
45
  */
27
46
  redirectUris?: string[];
47
+ /**
48
+ * Merged SHALLOWLY into the stored configuration: a key passed is written (a flag passed as
49
+ * `false` included), a key omitted is kept. A backend with no tenancy refuses a tenancy flag.
50
+ */
51
+ config?: IamClientConfig;
28
52
  }
29
53
  export interface IamPermissionArgs {
30
54
  /** Action name. When absent the permission is unscoped (project-wide). */
31
55
  permission?: string;
32
- /** Declares that grants of this permission may be bound to specific resource ids. */
56
+ /**
57
+ * Declares that grants of this permission may be bound to specific resource ids.
58
+ *
59
+ * It does NOT mean grants must be: the same name is grantable in either form. A grant carrying no
60
+ * resource ids covers every resource, which is what `hasPermission` already implements.
61
+ */
33
62
  resourceScoped?: boolean;
63
+ /**
64
+ * Declares that grants of this permission are bound to ONE organization: stored on the row of that
65
+ * organization (or a group of it) and effective only while the subject acts in it.
66
+ *
67
+ * Turning it off while grants exist is refused — every bound grant would silently widen to
68
+ * every organization of its subject.
69
+ */
70
+ entityScoped?: boolean;
34
71
  /** Optional human-readable title for the permission definition. */
35
72
  title?: string;
73
+ /**
74
+ * Grouping tag — one of `IAM_AREAS`, or any string a deployment defines.
75
+ *
76
+ * Purely presentational: it groups the permission in an administrator's screen and is never read
77
+ * when a request is authorized. It is a TAG rather than a name segment precisely so an existing
78
+ * permission can be grouped without renaming it, which would orphan every grant already made.
79
+ */
80
+ area?: string;
81
+ /**
82
+ * Marks a permission the PLATFORM owns rather than one the application declared for itself.
83
+ *
84
+ * The distinction is not cosmetic: an operator must not be able to revoke a platform marker from
85
+ * an undifferentiated list, and a repair that deletes "definitions no declaration names" must not
86
+ * reach one — a marker can be enforced by a runtime decoration rather than by a gate parameter,
87
+ * so its absence from the declarations is not evidence that it is unused.
88
+ */
89
+ managed?: boolean;
90
+ /**
91
+ * Who holds it without an explicit grant. `User` needs an unbound, unmanaged `user`-area
92
+ * definition; `Member` / `Owner` need an `entityScoped` one. `None` (or omitted on creation) is
93
+ * nobody.
94
+ */
95
+ defaultClass?: IamDefaultClass;
36
96
  }
37
97
  export interface IamResourceSpec {
38
98
  name: string;
@@ -40,30 +100,152 @@ export interface IamResourceSpec {
40
100
  }
41
101
  /** A permission declared for an entity's client (project). */
42
102
  export interface IamPermissionDefinition {
43
- /** Canonical name: "res--action" or bare "res" when unscoped. */
103
+ /** Canonical name: "res--action" or bare "res" when unscoped. NEVER carries an `@` selector. */
44
104
  name: string;
45
105
  resource: string;
46
106
  action?: string;
47
107
  resourceScoped?: boolean;
108
+ /** Grants are bound to one organization. See `IamPermissionArgs.entityScoped`. */
109
+ entityScoped?: boolean;
48
110
  title?: string;
111
+ /** Grouping tag; presentational only. See `IamPermissionArgs.area`. */
112
+ area?: string;
113
+ /** Owned by the platform rather than declared by the application. See `IamPermissionArgs.managed`. */
114
+ managed?: boolean;
115
+ /** Who holds it by default. See `IamPermissionArgs.defaultClass`. */
116
+ defaultClass?: IamDefaultClass;
117
+ }
118
+ /** Narrows a definition listing. An `areas` entry of `null` matches definitions carrying no tag. */
119
+ export interface IamPermissionFilter {
120
+ areas?: (string | null)[];
121
+ managed?: boolean;
122
+ resourceScoped?: boolean;
123
+ entityScoped?: boolean;
124
+ }
125
+ /** A group, named the way it is on the wire: its organization's slug and its key in that organization. */
126
+ export interface IamGroupRef {
127
+ entitySlug: string;
128
+ key: string;
49
129
  }
50
130
  export interface IamGrantArgs {
51
131
  /** Resource ids for the resource-scoped grant form; omit for an unscoped (project-wide) grant. */
52
132
  resources?: string[];
133
+ /**
134
+ * Which form to address. THE DEFAULTS ARE ASYMMETRIC ON PURPOSE, to preserve the semantics every
135
+ * existing caller already relies on:
136
+ *
137
+ * grantPermission — `resources != null` ? Resources : Blanket
138
+ * revokePermission — `resources != null` ? Resources : All
139
+ *
140
+ * Revoke defaults to `All` because a bare `revokePermission(...)` has always meant "remove it
141
+ * everywhere". Narrowing that to `Blanket` would leave the resource-scoped set standing for every
142
+ * existing caller — a live grant surviving a revoke, which is the failure direction nobody detects.
143
+ *
144
+ * A `Blanket` or `All` revoke of a DECLARED definition RESTRICTS the subject: it writes the
145
+ * subject's own `false`, which cuts what it would inherit (class default, group, bundle).
146
+ * `Inherit` (revoke-only) drops that own value instead, grant or restriction.
147
+ *
148
+ * Pass `mode` explicitly rather than depending on the default.
149
+ */
150
+ mode?: IamGrantMode;
151
+ /**
152
+ * The organization a grant of an `entityScoped` definition is bound to — REQUIRED for one (it
153
+ * names the subject's row there, which must exist) and refused for any other definition.
154
+ */
155
+ entitySlug?: string;
53
156
  }
54
- /** A permission granted to an end-user subject of an entity's client. */
157
+ /**
158
+ * A permission held by ONE subject — a person (`profileId`) or a group (`group`), never both — of an
159
+ * entity's client.
160
+ */
55
161
  export interface IamGrant {
56
- /** Backend-specific subject id: integrated = IdentityProfile.profileId, keycloak = KC user id. */
57
- profileId: string;
162
+ /** Backend-specific subject id: integrated = the pairwise `profileId`, keycloak = KC user id. */
163
+ profileId?: string;
164
+ /** A group subject. */
165
+ group?: IamGroupRef;
58
166
  clientId: string;
59
167
  /** Canonical permission name. */
60
168
  permission: string;
61
169
  /** Present only for resource-scoped grants. */
62
170
  resources?: string[];
171
+ /** Which form this record is. Derived from `resources`, not new information. */
172
+ mode?: IamGrantMode;
173
+ /** The organization the grant is bound to; absent for an unbound one. */
174
+ entitySlug?: string;
175
+ /** Why the subject holds it. Listings report it; a write answers `Direct`. */
176
+ origin?: IamGrantOrigin;
177
+ /** The group a `Group`-origin grant reaches the person through. */
178
+ through?: IamGroupRef;
179
+ /**
180
+ * Present (`true`) only when a listing asked for restrictions (`IamGrantListArgs.restricted`): an
181
+ * inherited grant — by default class, group or bundle — that the subject's OWN restriction
182
+ * withholds. It is NOT held and never reaches a claim; a console shows it so the restriction can
183
+ * be lifted (`IamGrantMode.Inherit`).
184
+ */
185
+ restricted?: boolean;
186
+ }
187
+ /** What a grant listing adds to what is held. */
188
+ export interface IamGrantListArgs {
189
+ /** Also list the inherited grants the subject's own restriction withholds, as `restricted: true`. */
190
+ restricted?: boolean;
191
+ }
192
+ /** Grants every definition a filter selects, plus any named outright. */
193
+ export interface IamGrantBundle {
194
+ filter?: IamPermissionFilter;
195
+ /** Extra names included regardless of the filter — a platform marker, for instance. */
196
+ permissions?: string[];
197
+ /** Defaults to `Blanket`: a tier of access is a role, not a resource ACL. */
198
+ mode?: IamGrantMode;
199
+ /** Only meaningful with `mode: Resources`. */
200
+ resources?: string[];
201
+ /** The binding of the bundle's `entityScoped` definitions. See `IamGrantArgs.entitySlug`. */
202
+ entitySlug?: string;
203
+ }
204
+ export interface IamPermissionDeleteArgs {
205
+ /** Defaults to `Cascade`. */
206
+ policy?: IamRemovalPolicy;
207
+ /** Required to delete a `managed` definition. Defaults to false. */
208
+ managed?: boolean;
209
+ }
210
+ export interface IamPermissionRemoval {
211
+ permission: string;
212
+ clientId: string;
213
+ /** The definition existed and was removed. False is a normal, non-error outcome. */
214
+ found: boolean;
215
+ /** Grants stripped as part of the removal. */
216
+ revoked: IamGrant[];
63
217
  }
64
- /** An end-user of an entity (customer-wide; shared across that entity's projects). */
218
+ export interface IamNormalizeArgs {
219
+ /** Compute and report the plan without writing anything. */
220
+ dryRun?: boolean;
221
+ }
222
+ export interface IamNormalizationReport {
223
+ clientId: string;
224
+ renamed: {
225
+ from: string;
226
+ to: string;
227
+ grantsMoved: number;
228
+ }[];
229
+ merged: {
230
+ from: string;
231
+ into: string;
232
+ grantsMoved: number;
233
+ }[];
234
+ /** Well-formed definitions deliberately left alone. */
235
+ untouched: string[];
236
+ }
237
+ /** One organization a user of a client belongs to there. */
238
+ export interface IamMembershipInfo {
239
+ entitySlug: string;
240
+ title?: string;
241
+ owner: boolean;
242
+ groups: string[];
243
+ /** The organization the user starts in. */
244
+ home?: boolean;
245
+ }
246
+ /** A subject of one client (app): one account, seen through that app's rows. */
65
247
  export interface IamUser {
66
- /** Backend-specific subject id: integrated = IdentityProfile.profileId, keycloak = KC user id. */
248
+ /** Backend-specific subject id: integrated = the pairwise `profileId`, keycloak = KC user id. */
67
249
  profileId: string;
68
250
  /** Primary login identifier (email for the integrated OTP path). */
69
251
  email?: string;
@@ -73,20 +255,161 @@ export interface IamUser {
73
255
  disabled?: boolean;
74
256
  /** Convenience count of permission grants the user holds (across clients, or for one client). */
75
257
  grantCount?: number;
258
+ /** The `entitySlug` of the organization the user starts in. */
259
+ home?: string;
260
+ memberships?: IamMembershipInfo[];
76
261
  }
77
- /** Args to invite/create an end-user under an entity. */
262
+ /** Args to invite/create an end-user of a client. */
78
263
  export interface IamUserInvite {
79
264
  email: string;
80
265
  name?: string;
81
266
  /** AuthRole value; defaults to the backend's standard end-user role. */
82
267
  role?: string;
83
268
  }
84
- /** Args to update an existing end-user. */
269
+ /** Args to update an existing end-user. `disabled` is written on the user's primary row. */
85
270
  export interface IamUserUpdate {
86
271
  name?: string;
87
272
  role?: string;
88
273
  disabled?: boolean;
89
274
  }
275
+ /** An organization as a client's administration sees it. Named by slug only. */
276
+ export interface IamOrganization {
277
+ entitySlug: string;
278
+ title?: string;
279
+ /** How many subjects of the client are members. */
280
+ members?: number;
281
+ }
282
+ /** `organizations.create`: the organization's title, and the subject who becomes its owner. */
283
+ export interface IamOrganizationArgs {
284
+ title?: string;
285
+ /** A subject of the client — the creator, on the runtime path. */
286
+ profileId?: string;
287
+ }
288
+ export interface IamOrganizationUpdate {
289
+ title: string;
290
+ }
291
+ /** A member of an organization, as one client sees it. */
292
+ export interface IamMember {
293
+ profileId: string;
294
+ email?: string;
295
+ name?: string;
296
+ owner: boolean;
297
+ /** Group keys of (this organization, this client). */
298
+ groups: string[];
299
+ /** Written by the staff synchronization; an operator cannot change it. */
300
+ managed?: boolean;
301
+ }
302
+ /** Find-or-create by e-mail: an invitation and a first sign-in converge on one account. */
303
+ export interface IamMemberInvite {
304
+ email: string;
305
+ name?: string;
306
+ owner?: boolean;
307
+ }
308
+ export interface IamMemberUpdate {
309
+ owner?: boolean;
310
+ groups?: string[];
311
+ }
312
+ /** What a group grants its members: every definition the filter selects, plus names outright. */
313
+ export interface IamGroupBundle {
314
+ filter?: IamPermissionFilter;
315
+ permissions?: string[];
316
+ }
317
+ /** A group of (organization, client) — kept inside the organization record. */
318
+ export interface IamGroup {
319
+ entitySlug: string;
320
+ key: string;
321
+ title?: string;
322
+ /**
323
+ * Kept by the platform (the staff sync's `members`): its membership, bundles and existence are
324
+ * not an operator's to write. Its grants and restrictions are.
325
+ */
326
+ managed?: boolean;
327
+ members?: number;
328
+ bundles: IamGroupBundle[];
329
+ }
330
+ export interface IamGroupArgs {
331
+ title?: string;
332
+ bundles?: IamGroupBundle[];
333
+ }
334
+ /** `syncStaff`: what the managed `members` group of the owning organization grants. */
335
+ export interface IamStaffSyncArgs {
336
+ bundles: IamGroupBundle[];
337
+ }
338
+ /** The subjects whose managed rows the sync created and removed. */
339
+ export interface IamStaffSyncReport {
340
+ added: string[];
341
+ removed: string[];
342
+ }
343
+ /** Who a subject is to a client, as the provider builds its claims. */
344
+ export interface IamSubject {
345
+ /** The pairwise subject: `subjects.identify(clientId, accountId)`. */
346
+ profileId: string;
347
+ email?: string;
348
+ name?: string;
349
+ organizations: OidcOrganizationClaim[];
350
+ /** The FULL claim sets: a set bound to an organization carries its `entitySlug`. */
351
+ permissions: OidcPermissionSetClaim[];
352
+ }
353
+ export interface IamSignInArgs {
354
+ email: string;
355
+ name?: string;
356
+ }
357
+ export interface IamSignInResult {
358
+ accountId: string;
359
+ profileId: string;
360
+ }
361
+ /**
362
+ * The organizations a client's subjects act in. Every method takes `(entityId, clientId, …)`: the
363
+ * entity that OWNS the client, then the client — the organizations themselves are named by slug.
364
+ */
365
+ export interface IamOrganizationFacet {
366
+ /** Every organization with a member of the client. */
367
+ list: (entityId: string, clientId: string) => Promise<IamOrganization[]>;
368
+ get: (entityId: string, clientId: string, entitySlug: string) => Promise<IamOrganization | null>;
369
+ create: (entityId: string, clientId: string, args?: IamOrganizationArgs) => Promise<IamOrganization>;
370
+ update: (entityId: string, clientId: string, entitySlug: string, update: IamOrganizationUpdate) => Promise<IamOrganization>;
371
+ members: (entityId: string, clientId: string, entitySlug: string) => Promise<IamMember[]>;
372
+ /** Idempotent by e-mail. Refused past the membership cap. */
373
+ addMember: (entityId: string, clientId: string, entitySlug: string, invite: IamMemberInvite) => Promise<IamMember>;
374
+ /** Refused when it would leave the organization without an owner. */
375
+ updateMember: (entityId: string, clientId: string, entitySlug: string, profileId: string, update: IamMemberUpdate) => Promise<IamMember>;
376
+ /** Refused for the last owner. */
377
+ removeMember: (entityId: string, clientId: string, entitySlug: string, profileId: string) => Promise<void>;
378
+ }
379
+ /**
380
+ * Groups of (organization, client). Every method takes `(entityId, clientId, entitySlug, …)` and the
381
+ * group key after it where one is addressed; one client never reads or writes another client's group.
382
+ */
383
+ export interface IamGroupFacet {
384
+ list: (entityId: string, clientId: string, entitySlug: string) => Promise<IamGroup[]>;
385
+ ensure: (entityId: string, clientId: string, entitySlug: string, key: string, args?: IamGroupArgs) => Promise<IamGroup>;
386
+ /** Also drops the key from every member row. Refused for a managed group. */
387
+ remove: (entityId: string, clientId: string, entitySlug: string, key: string) => Promise<void>;
388
+ members: (entityId: string, clientId: string, entitySlug: string, key: string) => Promise<IamMember[]>;
389
+ addMembers: (entityId: string, clientId: string, entitySlug: string, key: string, profileIds: string[]) => Promise<void>;
390
+ removeMembers: (entityId: string, clientId: string, entitySlug: string, key: string, profileIds: string[]) => Promise<void>;
391
+ /** The binding of a group grant is the group's organization; `args.entitySlug` is not taken. */
392
+ grant: (entityId: string, clientId: string, entitySlug: string, key: string, permission: string, args?: Omit<IamGrantArgs, 'entitySlug'>) => Promise<IamGrant>;
393
+ revoke: (entityId: string, clientId: string, entitySlug: string, key: string, permission: string, args?: Omit<IamGrantArgs, 'entitySlug'>) => Promise<void>;
394
+ /**
395
+ * What the group holds: its own grants (`Direct`) and the names its bundles select (`Bundle`),
396
+ * minus the names it restricts — which `args.restricted` lists too, as `restricted: true`.
397
+ */
398
+ grants: (entityId: string, clientId: string, entitySlug: string, key: string, args?: IamGrantListArgs) => Promise<IamGrant[]>;
399
+ setBundles: (entityId: string, clientId: string, entitySlug: string, key: string, bundles: IamGroupBundle[]) => Promise<IamGroup>;
400
+ }
401
+ /**
402
+ * The provider's half: who signs in to a client and what the claims say about them. Keyed by the
403
+ * ACCOUNT, which never leaves the provider; what a client sees is the pairwise subject.
404
+ */
405
+ export interface IamSubjectFacet {
406
+ /** `null` = not admitted: no row of the client, or a disabled primary row. */
407
+ resolve: (clientId: string, accountId: string) => Promise<IamSubject | null>;
408
+ /** Find-or-create the account by e-mail and its rows for the client. Race-safe. */
409
+ signIn: (clientId: string, args: IamSignInArgs) => Promise<IamSignInResult>;
410
+ /** The pairwise `sub` of the account for the client — computed, the same on every call. */
411
+ identify: (clientId: string, accountId: string) => string;
412
+ }
90
413
  /** Unified IAM provider interface — all platform/agent code calls only this, never a backend directly */
91
414
  export interface IamService extends InitializedService {
92
415
  getEntityAdminConfig: (entityId: string) => Promise<OidcProviderConfig>;
@@ -114,6 +437,8 @@ export interface IamService extends InitializedService {
114
437
  * that tenant's redirect URIs.
115
438
  */
116
439
  ensureClient: (entityId: string, clientId: string, options?: IamClientOptions) => Promise<IamClient>;
440
+ /** The entity's client without its secret, or null when there is none. Never provisions. */
441
+ getClient: (entityId: string, clientId: string) => Promise<IamClientInfo | null>;
117
442
  /**
118
443
  * Reserve a client id for the entity without provisioning it, so a caller can find a free name
119
444
  * before committing to it. Returns false when the id is already taken — by this entity or any
@@ -125,49 +450,123 @@ export interface IamService extends InitializedService {
125
450
  */
126
451
  claimClient: (entityId: string, clientId: string) => Promise<boolean>;
127
452
  /**
128
- * Release a client id and everything keyed by it. Called when a project or slot is deleted —
129
- * without it a recreated project can inherit a stale registration.
453
+ * Release a client id and everything keyed by it — its subjects' rows, its groups and its
454
+ * definitions. Called when a project or slot is deleted; without it a recreated project can
455
+ * inherit a stale registration.
130
456
  */
131
457
  deleteClient: (entityId: string, clientId: string) => Promise<void>;
132
458
  /**
133
459
  * Ensures a permission/resource exists in the entity's client.
134
460
  * Returns the canonical resource name (e.g. "res--action" or "res").
461
+ *
462
+ * MERGES into an existing definition rather than replacing it: `resource` and `action` are
463
+ * re-derived and overwrite, while `title`, `resourceScoped`, `entityScoped`, `area`, `managed` and
464
+ * `defaultClass` are set when provided — including when provided as `false` / `None` — and KEPT
465
+ * when omitted. Replacing wholesale made every flag last-write-wins, so a caller that happened not
466
+ * to pass one erased it.
467
+ *
468
+ * It NEVER rewrites the name. Callers round-trip a definition's `resource` + `action` back through
469
+ * this method to copy a definition set between clients, so a rename here would silently orphan
470
+ * every grant made against the old name.
471
+ *
472
+ * The `resource` argument must not carry a gate selector: `@` is the gate's syntax and is never
473
+ * part of a stored name. Implementations reject one rather than storing a key no gate looks up.
474
+ * A `defaultClass` the definition's flags do not admit is refused (`IamPermissionError`).
135
475
  */
136
476
  ensurePermission: (entityId: string, clientId: string, resource?: string, args?: IamPermissionArgs) => Promise<string>;
477
+ /**
478
+ * Removes permission definitions, and by default every grant that referenced them.
479
+ *
480
+ * Takes NAMES: the definition record is keyed by name, and a malformed definition's stored
481
+ * `resource`/`action` cannot be trusted to recompose that key. Accepts an array so a repair costs
482
+ * one sweep of the entity's subjects rather than one per name.
483
+ *
484
+ * Idempotent — a name with no definition yields `{ found: false }` and writes nothing. Every other
485
+ * lifecycle operation here converges rather than erroring, and two repairs may run concurrently on
486
+ * one project.
487
+ *
488
+ * Implementations MUST revoke the grants before dropping the definition. There is no transaction
489
+ * across the two stores, and a crash between them must leave a definition with no grants — visible
490
+ * and re-runnable — rather than grants with no definition, which are invisible to any screen that
491
+ * renders the definition list yet still satisfy a gate.
492
+ *
493
+ * A `managed` definition is refused unless `args.managed` is explicitly true.
494
+ */
495
+ deletePermission: (entityId: string, clientId: string, permission: string | string[], args?: IamPermissionDeleteArgs) => Promise<IamPermissionRemoval[]>;
496
+ /**
497
+ * Repairs definitions whose stored name carries a gate selector, moving grants with them.
498
+ *
499
+ * Strictly a rename and merge — never a delete, never an invention. Where the stripped name
500
+ * already exists the two are merged, because one entrypoint scoping a permission by `:id` and
501
+ * another by `:enquiryId` describe ONE permission. The target is marked resource-scoped: a leaked
502
+ * selector is positive evidence that it is, and that evidence is otherwise discarded.
503
+ *
504
+ * Grants move in the same write that renames the definition, which is why this exists as its own
505
+ * operation: reconstructing it as delete + re-declare + re-grant drops real access on any failure
506
+ * between the three steps.
507
+ */
508
+ normalizePermissions: (entityId: string, clientId: string, args?: IamNormalizeArgs) => Promise<IamNormalizationReport>;
137
509
  /**
138
510
  * Idempotent: creates a resource, a client role for it, and assigns that role to
139
511
  * the entity-owner role. Used by payment provisioning for account/project/wl resources.
140
512
  */
141
513
  ensureResourceOwnership: (entityId: string, clientId: string, resource: IamResourceSpec) => Promise<void>;
142
- /** Lists permission definitions registered for the entity's client. */
143
- listPermissions: (entityId: string, clientId: string) => Promise<IamPermissionDefinition[]>;
514
+ /** Lists permission definitions registered for the entity's client, optionally narrowed. */
515
+ listPermissions: (entityId: string, clientId: string, filter?: IamPermissionFilter) => Promise<IamPermissionDefinition[]>;
144
516
  /**
145
517
  * Grants a permission to an end-user subject. With args.resources the grant is
146
518
  * resource-scoped (bound to those resource ids); without it the grant is project-wide.
519
+ * An `entityScoped` definition is granted on the subject's row of `args.entitySlug`.
147
520
  */
148
521
  grantPermission: (entityId: string, clientId: string, profileId: string, permission: string, args?: IamGrantArgs) => Promise<IamGrant>;
149
522
  /**
150
523
  * Revokes a grant. With args.resources only those resource ids are removed;
151
- * without it the whole grant is removed.
524
+ * without it the whole grant is removed. A blanket revoke of a declared definition also
525
+ * restricts the subject from what it inherits; `IamGrantMode.Inherit` takes that back.
152
526
  */
153
527
  revokePermission: (entityId: string, clientId: string, profileId: string, permission: string, args?: IamGrantArgs) => Promise<void>;
154
- /** Lists grants for the entity's client, optionally for a single subject. */
155
- listGrants: (entityId: string, clientId: string, profileId?: string) => Promise<IamGrant[]>;
156
528
  /**
157
- * Lists the entity's end-users. End-users are customer-wide — shared across every project of
158
- * the entity — so `clientId` scopes the reported `grantCount` to one project's client and does
159
- * **not** filter the set: a user who has authenticated against a project but holds no grant
160
- * there is still that project's user, and the screen that manages grants is exactly where they
161
- * must be visible.
529
+ * Grants every permission a bundle selects to each subject, idempotently.
530
+ *
531
+ * Exists as its own operation rather than a loop over `grantPermission` because a backend that
532
+ * loads-mutates-saves a subject per call turns N permissions across M subjects into N·M writes and
533
+ * N·M lost-update windows on the same records. Collapsing to one read and one write per subject is
534
+ * also what makes re-running it genuinely idempotent.
535
+ *
536
+ * Returns what each subject now holds, not what changed.
537
+ */
538
+ grantBundle: (entityId: string, clientId: string, profileIds: string[], bundle: IamGrantBundle) => Promise<IamGrant[]>;
539
+ /**
540
+ * Lists grants for the entity's client, optionally for a single subject — what each holds
541
+ * directly, by its definition's default class and through its groups, `origin` telling which.
542
+ * Only what is HELD, unless `args.restricted` adds the inherited grants the subject's own
543
+ * restriction withholds (`restricted: true`).
544
+ */
545
+ listGrants: (entityId: string, clientId: string, profileId?: string, args?: IamGrantListArgs) => Promise<IamGrant[]>;
546
+ /**
547
+ * Lists the subjects of the client — every account holding a row of that app, in whichever
548
+ * organization. Without `clientId` it is a read-only aggregate over every client the entity
549
+ * owns, for a console; nothing is written through it.
162
550
  */
163
551
  listUsers: (entityId: string, clientId?: string) => Promise<IamUser[]>;
164
- /** Loads a single end-user by subject id, or null when absent. */
165
- getUser: (entityId: string, profileId: string) => Promise<IamUser | null>;
166
- /** Creates (or resolves, idempotently by email) an end-user under the entity. */
167
- inviteUser: (entityId: string, invite: IamUserInvite) => Promise<IamUser>;
168
- /** Updates an end-user's mutable fields (name, role, disabled). */
169
- updateUser: (entityId: string, profileId: string, update: IamUserUpdate) => Promise<IamUser>;
170
- /** Removes an end-user from the entity (their grants go with them). */
171
- removeUser: (entityId: string, profileId: string) => Promise<void>;
552
+ /** Loads a single subject of the client by its id, or null when absent. */
553
+ getUser: (entityId: string, clientId: string, profileId: string) => Promise<IamUser | null>;
554
+ /** Creates (or resolves, idempotently by email) a subject of the client. */
555
+ inviteUser: (entityId: string, clientId: string, invite: IamUserInvite) => Promise<IamUser>;
556
+ /** Updates a subject's mutable fields; `disabled` is written on its primary row. */
557
+ updateUser: (entityId: string, clientId: string, profileId: string, update: IamUserUpdate) => Promise<IamUser>;
558
+ /** Deletes this account's rows of the client only — the account and its other apps stay. */
559
+ removeUser: (entityId: string, clientId: string, profileId: string) => Promise<void>;
560
+ /**
561
+ * Admits the owning organization's own staff to the client: keeps the managed `IAM_MEMBERS_GROUP`
562
+ * group there with `bundles`, a managed row per staff account, and removes the managed rows of
563
+ * people no longer on the staff.
564
+ */
565
+ syncStaff: (entityId: string, clientId: string, args: IamStaffSyncArgs) => Promise<IamStaffSyncReport>;
566
+ organizations: IamOrganizationFacet;
567
+ groups: IamGroupFacet;
568
+ subjects: IamSubjectFacet;
172
569
  }
570
+ export type IamMode = typeof IAM_MODE_KEYCLOAK | typeof IAM_MODE_INTEGRATED;
571
+ export type IamArea = typeof IAM_AREAS[number];
173
572
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD,MAAM,WAAW,SAAS;IACxB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAA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,12 @@
1
+ export interface HasPermissionOptions {
2
+ /** Restrict the check to PermissionSets of this scope (the project's clientId). */
3
+ scope?: string;
4
+ /** Resource-scoped check: the set must list this id — unless the set itself is unscoped. */
5
+ resourceId?: string;
6
+ /**
7
+ * The organization the request acts in. A set bound to an organization (one carrying
8
+ * `entitySlug`) counts only when this names that same organization.
9
+ */
10
+ entitySlug?: string;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
package/build/utils.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { Authorization } from '@owlmeans/auth';
2
- export interface HasPermissionOptions {
3
- /** Restrict the check to PermissionSets of this scope (the project's clientId). */
4
- scope?: string;
5
- /** Resource-scoped check: the set must list this id — unless the set itself is unscoped. */
6
- resourceId?: string;
7
- }
2
+ import type { HasPermissionOptions } from './utils/types.js';
8
3
  /**
9
4
  * True when any PermissionSet grants `permission`. An unscoped set (no resources)
10
5
  * satisfies a resourceId check too — a project-wide grant covers every resource.
6
+ *
7
+ * The organization follows the same rule the other way round, fail-closed: a set without a binding
8
+ * applies everywhere, a bound one only when `opts.entitySlug` names its organization. A relying
9
+ * party strips the binding from the sets of the organization a session acts in and drops every
10
+ * other bound set, so a bound set reaching a check is one that leaked — and it must not count
11
+ * merely because the caller did not say where the request acts.
11
12
  */
12
13
  export declare const hasPermission: (auth: Authorization, permission: string, opts?: HasPermissionOptions) => boolean;
13
14
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,SAClB,aAAa,cACP,MAAM,SACX,oBAAoB,KAC1B,OAIO,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,gBAAgB,CAAA;AAElE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAK5D;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,SAClB,aAAa,cACP,MAAM,SACX,oBAAoB,KAC1B,OAKO,CAAA"}