@lssm/lib.identity-rbac 0.0.0-canary-20251217080011 → 1.41.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/contracts/index.js +1 -5
- package/dist/contracts/organization.js +1 -607
- package/dist/contracts/rbac.js +1 -487
- package/dist/contracts/user.js +1 -335
- package/dist/entities/index.js +1 -35
- package/dist/entities/organization.js +1 -151
- package/dist/entities/rbac.js +1 -138
- package/dist/entities/user.js +1 -194
- package/dist/events.js +1 -543
- package/dist/identity-rbac.feature.js +1 -186
- package/dist/index.js +1 -14
- package/dist/policies/engine.js +1 -167
- package/dist/policies/index.js +1 -3
- package/package.json +18 -19
- package/dist/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/contracts/dist/client/index.js +0 -5
- package/dist/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/contracts/dist/client/react/form-render.js +0 -4
- package/dist/contracts/dist/client/react/index.js +0 -4
- package/dist/contracts/dist/contract-registry/index.js +0 -1
- package/dist/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/contracts/dist/docs/index.js +0 -29
- package/dist/contracts/dist/docs/presentations.js +0 -71
- package/dist/contracts/dist/docs/registry.js +0 -44
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/contracts/dist/events.js +0 -10
- package/dist/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/contracts/dist/index.js +0 -71
- package/dist/contracts/dist/install.js +0 -2
- package/dist/contracts/dist/integrations/contracts.js +0 -377
- package/dist/contracts/dist/integrations/index.js +0 -18
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/contracts/dist/jsonschema.js +0 -1
- package/dist/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/contracts/dist/knowledge/index.js +0 -7
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/contracts/dist/llm/exporters.js +0 -19
- package/dist/contracts/dist/llm/index.js +0 -2
- package/dist/contracts/dist/llm/prompts.js +0 -1
- package/dist/contracts/dist/onboarding-base.js +0 -196
- package/dist/contracts/dist/openapi.js +0 -1
- package/dist/contracts/dist/ownership.js +0 -21
- package/dist/contracts/dist/presentations.js +0 -1
- package/dist/contracts/dist/presentations.v2.js +0 -11
- package/dist/contracts/dist/prompt.js +0 -1
- package/dist/contracts/dist/promptRegistry.js +0 -1
- package/dist/contracts/dist/regenerator/index.js +0 -1
- package/dist/contracts/dist/regenerator/service.js +0 -6
- package/dist/contracts/dist/registry.js +0 -2
- package/dist/contracts/dist/resources.js +0 -1
- package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/contracts/dist/schema/dist/index.js +0 -6
- package/dist/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/contracts/dist/server/index.js +0 -8
- package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/contracts/dist/server/rest-express.js +0 -1
- package/dist/contracts/dist/server/rest-generic.js +0 -1
- package/dist/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/contracts/dist/spec.js +0 -34
- package/dist/contracts/dist/telemetry/index.js +0 -1
- package/dist/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/contracts/dist/tests/index.js +0 -1
- package/dist/contracts/dist/tests/runner.js +0 -2
- package/dist/contracts/dist/workflow/index.js +0 -1
- package/dist/contracts/dist/workflow/runner.js +0 -1
- package/dist/contracts/index.d.ts +0 -4
- package/dist/contracts/organization.d.ts +0 -895
- package/dist/contracts/rbac.d.ts +0 -611
- package/dist/contracts/user.d.ts +0 -610
- package/dist/entities/index.d.ts +0 -176
- package/dist/entities/organization.d.ts +0 -86
- package/dist/entities/rbac.d.ts +0 -87
- package/dist/entities/user.d.ts +0 -87
- package/dist/events.d.ts +0 -689
- package/dist/identity-rbac.feature.d.ts +0 -11
- package/dist/index.d.ts +0 -11
- package/dist/policies/engine.d.ts +0 -132
- package/dist/policies/index.d.ts +0 -2
- package/dist/schema/dist/EnumType.js +0 -2
- package/dist/schema/dist/FieldType.js +0 -49
- package/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/schema/dist/entity/defineEntity.js +0 -236
- package/dist/schema/dist/entity/index.js +0 -2
- package/dist/schema/dist/entity/types.js +0 -1
- package/dist/schema/dist/index.js +0 -6
package/dist/contracts/rbac.js
CHANGED
|
@@ -1,487 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SchemaModel } from "../schema/dist/SchemaModel.js";
|
|
3
|
-
import "../schema/dist/index.js";
|
|
4
|
-
import { defineCommand, defineQuery } from "./dist/spec.js";
|
|
5
|
-
import "./dist/index.js";
|
|
6
|
-
import { SuccessResultModel } from "./user.js";
|
|
7
|
-
|
|
8
|
-
//#region src/contracts/rbac.ts
|
|
9
|
-
const OWNERS = ["platform.identity-rbac"];
|
|
10
|
-
const RoleModel = new SchemaModel({
|
|
11
|
-
name: "Role",
|
|
12
|
-
description: "RBAC role definition",
|
|
13
|
-
fields: {
|
|
14
|
-
id: {
|
|
15
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
-
isOptional: false
|
|
17
|
-
},
|
|
18
|
-
name: {
|
|
19
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
20
|
-
isOptional: false
|
|
21
|
-
},
|
|
22
|
-
description: {
|
|
23
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
24
|
-
isOptional: true
|
|
25
|
-
},
|
|
26
|
-
permissions: {
|
|
27
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
28
|
-
isOptional: false,
|
|
29
|
-
isArray: true
|
|
30
|
-
},
|
|
31
|
-
createdAt: {
|
|
32
|
-
type: ScalarTypeEnum.DateTime(),
|
|
33
|
-
isOptional: false
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const PolicyBindingModel = new SchemaModel({
|
|
38
|
-
name: "PolicyBinding",
|
|
39
|
-
description: "Role assignment to a target",
|
|
40
|
-
fields: {
|
|
41
|
-
id: {
|
|
42
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
43
|
-
isOptional: false
|
|
44
|
-
},
|
|
45
|
-
roleId: {
|
|
46
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
47
|
-
isOptional: false
|
|
48
|
-
},
|
|
49
|
-
targetType: {
|
|
50
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
51
|
-
isOptional: false
|
|
52
|
-
},
|
|
53
|
-
targetId: {
|
|
54
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
55
|
-
isOptional: false
|
|
56
|
-
},
|
|
57
|
-
expiresAt: {
|
|
58
|
-
type: ScalarTypeEnum.DateTime(),
|
|
59
|
-
isOptional: true
|
|
60
|
-
},
|
|
61
|
-
createdAt: {
|
|
62
|
-
type: ScalarTypeEnum.DateTime(),
|
|
63
|
-
isOptional: false
|
|
64
|
-
},
|
|
65
|
-
role: {
|
|
66
|
-
type: RoleModel,
|
|
67
|
-
isOptional: false
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const PermissionCheckResultModel = new SchemaModel({
|
|
72
|
-
name: "PermissionCheckResult",
|
|
73
|
-
description: "Result of a permission check",
|
|
74
|
-
fields: {
|
|
75
|
-
allowed: {
|
|
76
|
-
type: ScalarTypeEnum.Boolean(),
|
|
77
|
-
isOptional: false
|
|
78
|
-
},
|
|
79
|
-
reason: {
|
|
80
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
81
|
-
isOptional: true
|
|
82
|
-
},
|
|
83
|
-
matchedRole: {
|
|
84
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
85
|
-
isOptional: true
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
const CreateRoleInputModel = new SchemaModel({
|
|
90
|
-
name: "CreateRoleInput",
|
|
91
|
-
description: "Input for creating a role",
|
|
92
|
-
fields: {
|
|
93
|
-
name: {
|
|
94
|
-
type: ScalarTypeEnum.NonEmptyString(),
|
|
95
|
-
isOptional: false
|
|
96
|
-
},
|
|
97
|
-
description: {
|
|
98
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
99
|
-
isOptional: true
|
|
100
|
-
},
|
|
101
|
-
permissions: {
|
|
102
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
103
|
-
isOptional: false,
|
|
104
|
-
isArray: true
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const UpdateRoleInputModel = new SchemaModel({
|
|
109
|
-
name: "UpdateRoleInput",
|
|
110
|
-
description: "Input for updating a role",
|
|
111
|
-
fields: {
|
|
112
|
-
roleId: {
|
|
113
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
114
|
-
isOptional: false
|
|
115
|
-
},
|
|
116
|
-
name: {
|
|
117
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
118
|
-
isOptional: true
|
|
119
|
-
},
|
|
120
|
-
description: {
|
|
121
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
122
|
-
isOptional: true
|
|
123
|
-
},
|
|
124
|
-
permissions: {
|
|
125
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
126
|
-
isOptional: true,
|
|
127
|
-
isArray: true
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
const DeleteRoleInputModel = new SchemaModel({
|
|
132
|
-
name: "DeleteRoleInput",
|
|
133
|
-
description: "Input for deleting a role",
|
|
134
|
-
fields: { roleId: {
|
|
135
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
136
|
-
isOptional: false
|
|
137
|
-
} }
|
|
138
|
-
});
|
|
139
|
-
const ListRolesOutputModel = new SchemaModel({
|
|
140
|
-
name: "ListRolesOutput",
|
|
141
|
-
description: "Output for listing roles",
|
|
142
|
-
fields: { roles: {
|
|
143
|
-
type: RoleModel,
|
|
144
|
-
isOptional: false,
|
|
145
|
-
isArray: true
|
|
146
|
-
} }
|
|
147
|
-
});
|
|
148
|
-
const AssignRoleInputModel = new SchemaModel({
|
|
149
|
-
name: "AssignRoleInput",
|
|
150
|
-
description: "Input for assigning a role",
|
|
151
|
-
fields: {
|
|
152
|
-
roleId: {
|
|
153
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
154
|
-
isOptional: false
|
|
155
|
-
},
|
|
156
|
-
targetType: {
|
|
157
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
158
|
-
isOptional: false
|
|
159
|
-
},
|
|
160
|
-
targetId: {
|
|
161
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
162
|
-
isOptional: false
|
|
163
|
-
},
|
|
164
|
-
expiresAt: {
|
|
165
|
-
type: ScalarTypeEnum.DateTime(),
|
|
166
|
-
isOptional: true
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
const RevokeRoleInputModel = new SchemaModel({
|
|
171
|
-
name: "RevokeRoleInput",
|
|
172
|
-
description: "Input for revoking a role",
|
|
173
|
-
fields: { bindingId: {
|
|
174
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
175
|
-
isOptional: false
|
|
176
|
-
} }
|
|
177
|
-
});
|
|
178
|
-
const BindingIdPayloadModel = new SchemaModel({
|
|
179
|
-
name: "BindingIdPayload",
|
|
180
|
-
description: "Payload with binding ID",
|
|
181
|
-
fields: { bindingId: {
|
|
182
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
183
|
-
isOptional: false
|
|
184
|
-
} }
|
|
185
|
-
});
|
|
186
|
-
const CheckPermissionInputModel = new SchemaModel({
|
|
187
|
-
name: "CheckPermissionInput",
|
|
188
|
-
description: "Input for checking a permission",
|
|
189
|
-
fields: {
|
|
190
|
-
userId: {
|
|
191
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
192
|
-
isOptional: false
|
|
193
|
-
},
|
|
194
|
-
orgId: {
|
|
195
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
196
|
-
isOptional: true
|
|
197
|
-
},
|
|
198
|
-
permission: {
|
|
199
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
200
|
-
isOptional: false
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
const ListUserPermissionsInputModel = new SchemaModel({
|
|
205
|
-
name: "ListUserPermissionsInput",
|
|
206
|
-
description: "Input for listing user permissions",
|
|
207
|
-
fields: {
|
|
208
|
-
userId: {
|
|
209
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
210
|
-
isOptional: false
|
|
211
|
-
},
|
|
212
|
-
orgId: {
|
|
213
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
214
|
-
isOptional: true
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
const ListUserPermissionsOutputModel = new SchemaModel({
|
|
219
|
-
name: "ListUserPermissionsOutput",
|
|
220
|
-
description: "Output for listing user permissions",
|
|
221
|
-
fields: {
|
|
222
|
-
permissions: {
|
|
223
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
224
|
-
isOptional: false,
|
|
225
|
-
isArray: true
|
|
226
|
-
},
|
|
227
|
-
roles: {
|
|
228
|
-
type: RoleModel,
|
|
229
|
-
isOptional: false,
|
|
230
|
-
isArray: true
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
/**
|
|
235
|
-
* Create a new role.
|
|
236
|
-
*/
|
|
237
|
-
const CreateRoleContract = defineCommand({
|
|
238
|
-
meta: {
|
|
239
|
-
name: "identity.rbac.role.create",
|
|
240
|
-
version: 1,
|
|
241
|
-
stability: "stable",
|
|
242
|
-
owners: [...OWNERS],
|
|
243
|
-
tags: [
|
|
244
|
-
"identity",
|
|
245
|
-
"rbac",
|
|
246
|
-
"role",
|
|
247
|
-
"create"
|
|
248
|
-
],
|
|
249
|
-
description: "Create a new role with permissions.",
|
|
250
|
-
goal: "Allow admins to define custom roles.",
|
|
251
|
-
context: "Role management in admin settings."
|
|
252
|
-
},
|
|
253
|
-
io: {
|
|
254
|
-
input: CreateRoleInputModel,
|
|
255
|
-
output: RoleModel,
|
|
256
|
-
errors: { ROLE_EXISTS: {
|
|
257
|
-
description: "A role with this name already exists",
|
|
258
|
-
http: 409,
|
|
259
|
-
gqlCode: "ROLE_EXISTS",
|
|
260
|
-
when: "Role name is taken"
|
|
261
|
-
} }
|
|
262
|
-
},
|
|
263
|
-
policy: { auth: "admin" },
|
|
264
|
-
sideEffects: { audit: ["role.created"] }
|
|
265
|
-
});
|
|
266
|
-
/**
|
|
267
|
-
* Update a role.
|
|
268
|
-
*/
|
|
269
|
-
const UpdateRoleContract = defineCommand({
|
|
270
|
-
meta: {
|
|
271
|
-
name: "identity.rbac.role.update",
|
|
272
|
-
version: 1,
|
|
273
|
-
stability: "stable",
|
|
274
|
-
owners: [...OWNERS],
|
|
275
|
-
tags: [
|
|
276
|
-
"identity",
|
|
277
|
-
"rbac",
|
|
278
|
-
"role",
|
|
279
|
-
"update"
|
|
280
|
-
],
|
|
281
|
-
description: "Update an existing role.",
|
|
282
|
-
goal: "Allow admins to modify role permissions.",
|
|
283
|
-
context: "Role management in admin settings."
|
|
284
|
-
},
|
|
285
|
-
io: {
|
|
286
|
-
input: UpdateRoleInputModel,
|
|
287
|
-
output: RoleModel
|
|
288
|
-
},
|
|
289
|
-
policy: { auth: "admin" },
|
|
290
|
-
sideEffects: { audit: ["role.updated"] }
|
|
291
|
-
});
|
|
292
|
-
/**
|
|
293
|
-
* Delete a role.
|
|
294
|
-
*/
|
|
295
|
-
const DeleteRoleContract = defineCommand({
|
|
296
|
-
meta: {
|
|
297
|
-
name: "identity.rbac.role.delete",
|
|
298
|
-
version: 1,
|
|
299
|
-
stability: "stable",
|
|
300
|
-
owners: [...OWNERS],
|
|
301
|
-
tags: [
|
|
302
|
-
"identity",
|
|
303
|
-
"rbac",
|
|
304
|
-
"role",
|
|
305
|
-
"delete"
|
|
306
|
-
],
|
|
307
|
-
description: "Delete an existing role.",
|
|
308
|
-
goal: "Allow admins to remove unused roles.",
|
|
309
|
-
context: "Role management. Removes all policy bindings using this role."
|
|
310
|
-
},
|
|
311
|
-
io: {
|
|
312
|
-
input: DeleteRoleInputModel,
|
|
313
|
-
output: SuccessResultModel,
|
|
314
|
-
errors: { ROLE_IN_USE: {
|
|
315
|
-
description: "Role is still assigned to users or organizations",
|
|
316
|
-
http: 409,
|
|
317
|
-
gqlCode: "ROLE_IN_USE",
|
|
318
|
-
when: "Role has active bindings"
|
|
319
|
-
} }
|
|
320
|
-
},
|
|
321
|
-
policy: { auth: "admin" },
|
|
322
|
-
sideEffects: { audit: ["role.deleted"] }
|
|
323
|
-
});
|
|
324
|
-
/**
|
|
325
|
-
* List all roles.
|
|
326
|
-
*/
|
|
327
|
-
const ListRolesContract = defineQuery({
|
|
328
|
-
meta: {
|
|
329
|
-
name: "identity.rbac.role.list",
|
|
330
|
-
version: 1,
|
|
331
|
-
stability: "stable",
|
|
332
|
-
owners: [...OWNERS],
|
|
333
|
-
tags: [
|
|
334
|
-
"identity",
|
|
335
|
-
"rbac",
|
|
336
|
-
"role",
|
|
337
|
-
"list"
|
|
338
|
-
],
|
|
339
|
-
description: "List all available roles.",
|
|
340
|
-
goal: "Show available roles for assignment.",
|
|
341
|
-
context: "Role assignment UI."
|
|
342
|
-
},
|
|
343
|
-
io: {
|
|
344
|
-
input: null,
|
|
345
|
-
output: ListRolesOutputModel
|
|
346
|
-
},
|
|
347
|
-
policy: { auth: "user" }
|
|
348
|
-
});
|
|
349
|
-
/**
|
|
350
|
-
* Assign a role to a user or organization.
|
|
351
|
-
*/
|
|
352
|
-
const AssignRoleContract = defineCommand({
|
|
353
|
-
meta: {
|
|
354
|
-
name: "identity.rbac.assign",
|
|
355
|
-
version: 1,
|
|
356
|
-
stability: "stable",
|
|
357
|
-
owners: [...OWNERS],
|
|
358
|
-
tags: [
|
|
359
|
-
"identity",
|
|
360
|
-
"rbac",
|
|
361
|
-
"assign"
|
|
362
|
-
],
|
|
363
|
-
description: "Assign a role to a user or organization.",
|
|
364
|
-
goal: "Grant permissions via role assignment.",
|
|
365
|
-
context: "User/org permission management."
|
|
366
|
-
},
|
|
367
|
-
io: {
|
|
368
|
-
input: AssignRoleInputModel,
|
|
369
|
-
output: PolicyBindingModel,
|
|
370
|
-
errors: {
|
|
371
|
-
ROLE_NOT_FOUND: {
|
|
372
|
-
description: "The specified role does not exist",
|
|
373
|
-
http: 404,
|
|
374
|
-
gqlCode: "ROLE_NOT_FOUND",
|
|
375
|
-
when: "Role ID is invalid"
|
|
376
|
-
},
|
|
377
|
-
ALREADY_ASSIGNED: {
|
|
378
|
-
description: "This role is already assigned to the target",
|
|
379
|
-
http: 409,
|
|
380
|
-
gqlCode: "ALREADY_ASSIGNED",
|
|
381
|
-
when: "Binding already exists"
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
policy: { auth: "admin" },
|
|
386
|
-
sideEffects: {
|
|
387
|
-
emits: [{
|
|
388
|
-
name: "role.assigned",
|
|
389
|
-
version: 1,
|
|
390
|
-
when: "Role is assigned",
|
|
391
|
-
payload: PolicyBindingModel
|
|
392
|
-
}],
|
|
393
|
-
audit: ["role.assigned"]
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
/**
|
|
397
|
-
* Revoke a role from a user or organization.
|
|
398
|
-
*/
|
|
399
|
-
const RevokeRoleContract = defineCommand({
|
|
400
|
-
meta: {
|
|
401
|
-
name: "identity.rbac.revoke",
|
|
402
|
-
version: 1,
|
|
403
|
-
stability: "stable",
|
|
404
|
-
owners: [...OWNERS],
|
|
405
|
-
tags: [
|
|
406
|
-
"identity",
|
|
407
|
-
"rbac",
|
|
408
|
-
"revoke"
|
|
409
|
-
],
|
|
410
|
-
description: "Revoke a role from a user or organization.",
|
|
411
|
-
goal: "Remove permissions via role revocation.",
|
|
412
|
-
context: "User/org permission management."
|
|
413
|
-
},
|
|
414
|
-
io: {
|
|
415
|
-
input: RevokeRoleInputModel,
|
|
416
|
-
output: SuccessResultModel,
|
|
417
|
-
errors: { BINDING_NOT_FOUND: {
|
|
418
|
-
description: "The policy binding does not exist",
|
|
419
|
-
http: 404,
|
|
420
|
-
gqlCode: "BINDING_NOT_FOUND",
|
|
421
|
-
when: "Binding ID is invalid"
|
|
422
|
-
} }
|
|
423
|
-
},
|
|
424
|
-
policy: { auth: "admin" },
|
|
425
|
-
sideEffects: {
|
|
426
|
-
emits: [{
|
|
427
|
-
name: "role.revoked",
|
|
428
|
-
version: 1,
|
|
429
|
-
when: "Role is revoked",
|
|
430
|
-
payload: BindingIdPayloadModel
|
|
431
|
-
}],
|
|
432
|
-
audit: ["role.revoked"]
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
/**
|
|
436
|
-
* Check if a user has a specific permission.
|
|
437
|
-
*/
|
|
438
|
-
const CheckPermissionContract = defineQuery({
|
|
439
|
-
meta: {
|
|
440
|
-
name: "identity.rbac.check",
|
|
441
|
-
version: 1,
|
|
442
|
-
stability: "stable",
|
|
443
|
-
owners: [...OWNERS],
|
|
444
|
-
tags: [
|
|
445
|
-
"identity",
|
|
446
|
-
"rbac",
|
|
447
|
-
"check",
|
|
448
|
-
"permission"
|
|
449
|
-
],
|
|
450
|
-
description: "Check if a user has a specific permission.",
|
|
451
|
-
goal: "Authorization check before sensitive operations.",
|
|
452
|
-
context: "Called by other services to verify permissions."
|
|
453
|
-
},
|
|
454
|
-
io: {
|
|
455
|
-
input: CheckPermissionInputModel,
|
|
456
|
-
output: PermissionCheckResultModel
|
|
457
|
-
},
|
|
458
|
-
policy: { auth: "user" }
|
|
459
|
-
});
|
|
460
|
-
/**
|
|
461
|
-
* List permissions for a user.
|
|
462
|
-
*/
|
|
463
|
-
const ListUserPermissionsContract = defineQuery({
|
|
464
|
-
meta: {
|
|
465
|
-
name: "identity.rbac.permissions",
|
|
466
|
-
version: 1,
|
|
467
|
-
stability: "stable",
|
|
468
|
-
owners: [...OWNERS],
|
|
469
|
-
tags: [
|
|
470
|
-
"identity",
|
|
471
|
-
"rbac",
|
|
472
|
-
"permissions",
|
|
473
|
-
"user"
|
|
474
|
-
],
|
|
475
|
-
description: "List all permissions for a user in a context.",
|
|
476
|
-
goal: "Show what a user can do in an org.",
|
|
477
|
-
context: "UI permission display, debugging."
|
|
478
|
-
},
|
|
479
|
-
io: {
|
|
480
|
-
input: ListUserPermissionsInputModel,
|
|
481
|
-
output: ListUserPermissionsOutputModel
|
|
482
|
-
},
|
|
483
|
-
policy: { auth: "user" }
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
//#endregion
|
|
487
|
-
export { AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateRoleContract, CreateRoleInputModel, DeleteRoleContract, DeleteRoleInputModel, ListRolesContract, ListRolesOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, PermissionCheckResultModel, PolicyBindingModel, RevokeRoleContract, RevokeRoleInputModel, RoleModel, UpdateRoleContract, UpdateRoleInputModel };
|
|
1
|
+
import{SuccessResultModel as e}from"./user.js";import{ScalarTypeEnum as t,SchemaModel as n}from"@lssm/lib.schema";import{defineCommand as r,defineQuery as i}from"@lssm/lib.contracts";const a=[`platform.identity-rbac`],o=new n({name:`Role`,description:`RBAC role definition`,fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},permissions:{type:t.String_unsecure(),isOptional:!1,isArray:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),s=new n({name:`PolicyBinding`,description:`Role assignment to a target`,fields:{id:{type:t.String_unsecure(),isOptional:!1},roleId:{type:t.String_unsecure(),isOptional:!1},targetType:{type:t.String_unsecure(),isOptional:!1},targetId:{type:t.String_unsecure(),isOptional:!1},expiresAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1},role:{type:o,isOptional:!1}}}),c=new n({name:`PermissionCheckResult`,description:`Result of a permission check`,fields:{allowed:{type:t.Boolean(),isOptional:!1},reason:{type:t.String_unsecure(),isOptional:!0},matchedRole:{type:t.String_unsecure(),isOptional:!0}}}),l=new n({name:`CreateRoleInput`,description:`Input for creating a role`,fields:{name:{type:t.NonEmptyString(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},permissions:{type:t.String_unsecure(),isOptional:!1,isArray:!0}}}),u=new n({name:`UpdateRoleInput`,description:`Input for updating a role`,fields:{roleId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!0},description:{type:t.String_unsecure(),isOptional:!0},permissions:{type:t.String_unsecure(),isOptional:!0,isArray:!0}}}),d=new n({name:`DeleteRoleInput`,description:`Input for deleting a role`,fields:{roleId:{type:t.String_unsecure(),isOptional:!1}}}),f=new n({name:`ListRolesOutput`,description:`Output for listing roles`,fields:{roles:{type:o,isOptional:!1,isArray:!0}}}),p=new n({name:`AssignRoleInput`,description:`Input for assigning a role`,fields:{roleId:{type:t.String_unsecure(),isOptional:!1},targetType:{type:t.String_unsecure(),isOptional:!1},targetId:{type:t.String_unsecure(),isOptional:!1},expiresAt:{type:t.DateTime(),isOptional:!0}}}),m=new n({name:`RevokeRoleInput`,description:`Input for revoking a role`,fields:{bindingId:{type:t.String_unsecure(),isOptional:!1}}}),h=new n({name:`BindingIdPayload`,description:`Payload with binding ID`,fields:{bindingId:{type:t.String_unsecure(),isOptional:!1}}}),g=new n({name:`CheckPermissionInput`,description:`Input for checking a permission`,fields:{userId:{type:t.String_unsecure(),isOptional:!1},orgId:{type:t.String_unsecure(),isOptional:!0},permission:{type:t.String_unsecure(),isOptional:!1}}}),_=new n({name:`ListUserPermissionsInput`,description:`Input for listing user permissions`,fields:{userId:{type:t.String_unsecure(),isOptional:!1},orgId:{type:t.String_unsecure(),isOptional:!0}}}),v=new n({name:`ListUserPermissionsOutput`,description:`Output for listing user permissions`,fields:{permissions:{type:t.String_unsecure(),isOptional:!1,isArray:!0},roles:{type:o,isOptional:!1,isArray:!0}}}),y=r({meta:{name:`identity.rbac.role.create`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`role`,`create`],description:`Create a new role with permissions.`,goal:`Allow admins to define custom roles.`,context:`Role management in admin settings.`},io:{input:l,output:o,errors:{ROLE_EXISTS:{description:`A role with this name already exists`,http:409,gqlCode:`ROLE_EXISTS`,when:`Role name is taken`}}},policy:{auth:`admin`},sideEffects:{audit:[`role.created`]}}),b=r({meta:{name:`identity.rbac.role.update`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`role`,`update`],description:`Update an existing role.`,goal:`Allow admins to modify role permissions.`,context:`Role management in admin settings.`},io:{input:u,output:o},policy:{auth:`admin`},sideEffects:{audit:[`role.updated`]}}),x=r({meta:{name:`identity.rbac.role.delete`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`role`,`delete`],description:`Delete an existing role.`,goal:`Allow admins to remove unused roles.`,context:`Role management. Removes all policy bindings using this role.`},io:{input:d,output:e,errors:{ROLE_IN_USE:{description:`Role is still assigned to users or organizations`,http:409,gqlCode:`ROLE_IN_USE`,when:`Role has active bindings`}}},policy:{auth:`admin`},sideEffects:{audit:[`role.deleted`]}}),S=i({meta:{name:`identity.rbac.role.list`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`role`,`list`],description:`List all available roles.`,goal:`Show available roles for assignment.`,context:`Role assignment UI.`},io:{input:null,output:f},policy:{auth:`user`}}),C=r({meta:{name:`identity.rbac.assign`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`assign`],description:`Assign a role to a user or organization.`,goal:`Grant permissions via role assignment.`,context:`User/org permission management.`},io:{input:p,output:s,errors:{ROLE_NOT_FOUND:{description:`The specified role does not exist`,http:404,gqlCode:`ROLE_NOT_FOUND`,when:`Role ID is invalid`},ALREADY_ASSIGNED:{description:`This role is already assigned to the target`,http:409,gqlCode:`ALREADY_ASSIGNED`,when:`Binding already exists`}}},policy:{auth:`admin`},sideEffects:{emits:[{name:`role.assigned`,version:1,when:`Role is assigned`,payload:s}],audit:[`role.assigned`]}}),w=r({meta:{name:`identity.rbac.revoke`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`revoke`],description:`Revoke a role from a user or organization.`,goal:`Remove permissions via role revocation.`,context:`User/org permission management.`},io:{input:m,output:e,errors:{BINDING_NOT_FOUND:{description:`The policy binding does not exist`,http:404,gqlCode:`BINDING_NOT_FOUND`,when:`Binding ID is invalid`}}},policy:{auth:`admin`},sideEffects:{emits:[{name:`role.revoked`,version:1,when:`Role is revoked`,payload:h}],audit:[`role.revoked`]}}),T=i({meta:{name:`identity.rbac.check`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`check`,`permission`],description:`Check if a user has a specific permission.`,goal:`Authorization check before sensitive operations.`,context:`Called by other services to verify permissions.`},io:{input:g,output:c},policy:{auth:`user`}}),E=i({meta:{name:`identity.rbac.permissions`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`rbac`,`permissions`,`user`],description:`List all permissions for a user in a context.`,goal:`Show what a user can do in an org.`,context:`UI permission display, debugging.`},io:{input:_,output:v},policy:{auth:`user`}});export{C as AssignRoleContract,p as AssignRoleInputModel,h as BindingIdPayloadModel,T as CheckPermissionContract,g as CheckPermissionInputModel,y as CreateRoleContract,l as CreateRoleInputModel,x as DeleteRoleContract,d as DeleteRoleInputModel,S as ListRolesContract,f as ListRolesOutputModel,E as ListUserPermissionsContract,_ as ListUserPermissionsInputModel,v as ListUserPermissionsOutputModel,c as PermissionCheckResultModel,s as PolicyBindingModel,w as RevokeRoleContract,m as RevokeRoleInputModel,o as RoleModel,b as UpdateRoleContract,u as UpdateRoleInputModel};
|