@contractspec/lib.identity-rbac 0.0.0-canary-20260113162409

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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/dist/contracts/index.d.ts +4 -0
  4. package/dist/contracts/index.js +5 -0
  5. package/dist/contracts/organization.d.ts +896 -0
  6. package/dist/contracts/organization.d.ts.map +1 -0
  7. package/dist/contracts/organization.js +605 -0
  8. package/dist/contracts/organization.js.map +1 -0
  9. package/dist/contracts/rbac.d.ts +612 -0
  10. package/dist/contracts/rbac.d.ts.map +1 -0
  11. package/dist/contracts/rbac.js +484 -0
  12. package/dist/contracts/rbac.js.map +1 -0
  13. package/dist/contracts/user.d.ts +611 -0
  14. package/dist/contracts/user.d.ts.map +1 -0
  15. package/dist/contracts/user.js +333 -0
  16. package/dist/contracts/user.js.map +1 -0
  17. package/dist/entities/index.d.ts +177 -0
  18. package/dist/entities/index.d.ts.map +1 -0
  19. package/dist/entities/index.js +36 -0
  20. package/dist/entities/index.js.map +1 -0
  21. package/dist/entities/organization.d.ts +87 -0
  22. package/dist/entities/organization.d.ts.map +1 -0
  23. package/dist/entities/organization.js +151 -0
  24. package/dist/entities/organization.js.map +1 -0
  25. package/dist/entities/rbac.d.ts +88 -0
  26. package/dist/entities/rbac.d.ts.map +1 -0
  27. package/dist/entities/rbac.js +138 -0
  28. package/dist/entities/rbac.js.map +1 -0
  29. package/dist/entities/user.d.ts +88 -0
  30. package/dist/entities/user.d.ts.map +1 -0
  31. package/dist/entities/user.js +194 -0
  32. package/dist/entities/user.js.map +1 -0
  33. package/dist/events.d.ts +690 -0
  34. package/dist/events.d.ts.map +1 -0
  35. package/dist/events.js +683 -0
  36. package/dist/events.js.map +1 -0
  37. package/dist/identity-rbac.capability.d.ts +8 -0
  38. package/dist/identity-rbac.capability.d.ts.map +1 -0
  39. package/dist/identity-rbac.capability.js +29 -0
  40. package/dist/identity-rbac.capability.js.map +1 -0
  41. package/dist/identity-rbac.feature.d.ts +12 -0
  42. package/dist/identity-rbac.feature.d.ts.map +1 -0
  43. package/dist/identity-rbac.feature.js +195 -0
  44. package/dist/identity-rbac.feature.js.map +1 -0
  45. package/dist/index.d.ts +12 -0
  46. package/dist/index.js +14 -0
  47. package/dist/policies/engine.d.ts +133 -0
  48. package/dist/policies/engine.d.ts.map +1 -0
  49. package/dist/policies/engine.js +168 -0
  50. package/dist/policies/engine.js.map +1 -0
  51. package/dist/policies/index.d.ts +2 -0
  52. package/dist/policies/index.js +3 -0
  53. package/package.json +85 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\n// ============ User Event Payloads ============\n\nconst UserCreatedPayload = new SchemaModel({\n name: 'UserCreatedPayload',\n description: 'Payload for user created event',\n fields: {\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UserUpdatedPayload = new SchemaModel({\n name: 'UserUpdatedPayload',\n description: 'Payload for user updated event',\n fields: {\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedFields: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n isArray: true,\n },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UserDeletedPayload = new SchemaModel({\n name: 'UserDeletedPayload',\n description: 'Payload for user deleted event',\n fields: {\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },\n deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst UserEmailVerifiedPayload = new SchemaModel({\n name: 'UserEmailVerifiedPayload',\n description: 'Payload for user email verified event',\n fields: {\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },\n verifiedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Organization Event Payloads ============\n\nconst OrgCreatedPayload = new SchemaModel({\n name: 'OrgCreatedPayload',\n description: 'Payload for org created event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n createdBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgUpdatedPayload = new SchemaModel({\n name: 'OrgUpdatedPayload',\n description: 'Payload for org updated event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedFields: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n isArray: true,\n },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgDeletedPayload = new SchemaModel({\n name: 'OrgDeletedPayload',\n description: 'Payload for org deleted event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deletedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n deletedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Member Event Payloads ============\n\nconst OrgMemberAddedPayload = new SchemaModel({\n name: 'OrgMemberAddedPayload',\n description: 'Payload for member added event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n role: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n invitedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n joinedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgMemberRemovedPayload = new SchemaModel({\n name: 'OrgMemberRemovedPayload',\n description: 'Payload for member removed event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n removedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }, // left | removed | banned\n removedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgMemberRoleChangedPayload = new SchemaModel({\n name: 'OrgMemberRoleChangedPayload',\n description: 'Payload for member role changed event',\n fields: {\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousRole: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n newRole: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n changedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Invitation Event Payloads ============\n\nconst OrgInviteSentPayload = new SchemaModel({\n name: 'OrgInviteSentPayload',\n description: 'Payload for invite sent event',\n fields: {\n invitationId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },\n role: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n invitedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n expiresAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n sentAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgInviteAcceptedPayload = new SchemaModel({\n name: 'OrgInviteAcceptedPayload',\n description: 'Payload for invite accepted event',\n fields: {\n invitationId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n acceptedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrgInviteDeclinedPayload = new SchemaModel({\n name: 'OrgInviteDeclinedPayload',\n description: 'Payload for invite declined event',\n fields: {\n invitationId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orgId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n declinedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ Role Event Payloads ============\n\nconst RoleAssignedPayload = new SchemaModel({\n name: 'RoleAssignedPayload',\n description: 'Payload for role assigned event',\n fields: {\n bindingId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n roleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n roleName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }, // user | organization\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n assignedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n expiresAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n assignedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst RoleRevokedPayload = new SchemaModel({\n name: 'RoleRevokedPayload',\n description: 'Payload for role revoked event',\n fields: {\n bindingId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n roleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n roleName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n targetType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }, // user | organization\n targetId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n revokedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n revokedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n// ============ User Events ============\n\n/**\n * Emitted when a new user is created.\n */\nexport const UserCreatedEvent = defineEvent({\n meta: {\n key: 'user.created',\n version: '1.0.0',\n description: 'A new user has been created.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['user', 'created', 'identity'],\n },\n payload: UserCreatedPayload,\n});\n\n/**\n * Emitted when a user profile is updated.\n */\nexport const UserUpdatedEvent = defineEvent({\n meta: {\n key: 'user.updated',\n version: '1.0.0',\n description: 'A user profile has been updated.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['user', 'updated', 'identity'],\n },\n payload: UserUpdatedPayload,\n});\n\n/**\n * Emitted when a user is deleted.\n */\nexport const UserDeletedEvent = defineEvent({\n meta: {\n key: 'user.deleted',\n version: '1.0.0',\n description: 'A user account has been deleted.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['user', 'deleted', 'identity'],\n },\n pii: ['email'],\n payload: UserDeletedPayload,\n});\n\n/**\n * Emitted when a user's email is verified.\n */\nexport const UserEmailVerifiedEvent = defineEvent({\n meta: {\n key: 'user.email_verified',\n version: '1.0.0',\n description: 'A user has verified their email address.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['user', 'verified', 'identity'],\n },\n payload: UserEmailVerifiedPayload,\n});\n\n// ============ Organization Events ============\n\n/**\n * Emitted when a new organization is created.\n */\nexport const OrgCreatedEvent = defineEvent({\n meta: {\n key: 'org.created',\n version: '1.0.0',\n description: 'A new organization has been created.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'created', 'identity'],\n },\n payload: OrgCreatedPayload,\n});\n\n/**\n * Emitted when an organization is updated.\n */\nexport const OrgUpdatedEvent = defineEvent({\n meta: {\n key: 'org.updated',\n version: '1.0.0',\n description: 'An organization has been updated.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'updated', 'identity'],\n },\n payload: OrgUpdatedPayload,\n});\n\n/**\n * Emitted when an organization is deleted.\n */\nexport const OrgDeletedEvent = defineEvent({\n meta: {\n key: 'org.deleted',\n version: '1.0.0',\n description: 'An organization has been deleted.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'deleted', 'identity'],\n },\n payload: OrgDeletedPayload,\n});\n\n// ============ Member Events ============\n\n/**\n * Emitted when a member joins an organization.\n */\nexport const OrgMemberAddedEvent = defineEvent({\n meta: {\n key: 'org.member.added',\n version: '1.0.0',\n description: 'A user has joined an organization.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'member', 'added', 'identity'],\n },\n payload: OrgMemberAddedPayload,\n});\n\n/**\n * Emitted when a member leaves or is removed from an organization.\n */\nexport const OrgMemberRemovedEvent = defineEvent({\n meta: {\n key: 'org.member.removed',\n version: '1.0.0',\n description: 'A user has left or been removed from an organization.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'member', 'removed', 'identity'],\n },\n payload: OrgMemberRemovedPayload,\n});\n\n/**\n * Emitted when a member's role is changed.\n */\nexport const OrgMemberRoleChangedEvent = defineEvent({\n meta: {\n key: 'org.member.role_changed',\n version: '1.0.0',\n description: \"A member's role in an organization has changed.\",\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'member', 'role', 'changed', 'identity'],\n },\n payload: OrgMemberRoleChangedPayload,\n});\n\n// ============ Invitation Events ============\n\n/**\n * Emitted when an invitation is sent.\n */\nexport const OrgInviteSentEvent = defineEvent({\n meta: {\n key: 'org.invite.sent',\n version: '1.0.0',\n description: 'An invitation to join an organization has been sent.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'invite', 'sent', 'identity'],\n },\n pii: ['email'],\n payload: OrgInviteSentPayload,\n});\n\n/**\n * Emitted when an invitation is accepted.\n */\nexport const OrgInviteAcceptedEvent = defineEvent({\n meta: {\n key: 'org.invite.accepted',\n version: '1.0.0',\n description: 'An invitation has been accepted.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'invite', 'accepted', 'identity'],\n },\n payload: OrgInviteAcceptedPayload,\n});\n\n/**\n * Emitted when an invitation is declined.\n */\nexport const OrgInviteDeclinedEvent = defineEvent({\n meta: {\n key: 'org.invite.declined',\n version: '1.0.0',\n description: 'An invitation has been declined.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['org', 'invite', 'declined', 'identity'],\n },\n payload: OrgInviteDeclinedPayload,\n});\n\n// ============ Role Events ============\n\n/**\n * Emitted when a role is assigned to a user or organization.\n */\nexport const RoleAssignedEvent = defineEvent({\n meta: {\n key: 'role.assigned',\n version: '1.0.0',\n description: 'A role has been assigned.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['role', 'assigned', 'identity'],\n },\n payload: RoleAssignedPayload,\n});\n\n/**\n * Emitted when a role is revoked from a user or organization.\n */\nexport const RoleRevokedEvent = defineEvent({\n meta: {\n key: 'role.revoked',\n version: '1.0.0',\n description: 'A role has been revoked.',\n stability: 'stable',\n owners: ['@platform.identity-rbac'],\n tags: ['role', 'revoked', 'identity'],\n },\n payload: RoleRevokedPayload,\n});\n\n// ============ All Events ============\n\n/**\n * All identity-rbac events.\n */\nexport const IdentityRbacEvents = {\n UserCreatedEvent,\n UserUpdatedEvent,\n UserDeletedEvent,\n UserEmailVerifiedEvent,\n OrgCreatedEvent,\n OrgUpdatedEvent,\n OrgDeletedEvent,\n OrgMemberAddedEvent,\n OrgMemberRemovedEvent,\n OrgMemberRoleChangedEvent,\n OrgInviteSentEvent,\n OrgInviteAcceptedEvent,\n OrgInviteDeclinedEvent,\n RoleAssignedEvent,\n RoleRevokedEvent,\n};\n"],"mappings":";;;;AAKA,MAAM,qBAAqB,IAAI,YAAY;CACzC,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,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EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAO;GAAU;GAAY;GAAW;EAChD;CACD,SAAS;CACV,CAAC;;;;AAOF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAQ;GAAY;GAAW;EACvC;CACD,SAAS;CACV,CAAC;;;;AAKF,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAQ;GAAW;GAAW;EACtC;CACD,SAAS;CACV,CAAC;;;;AAOF,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -0,0 +1,8 @@
1
+ import * as _contractspec_lib_contracts29 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/identity-rbac.capability.d.ts
4
+ declare const IdentityCapability: _contractspec_lib_contracts29.CapabilitySpec;
5
+ declare const RbacCapability: _contractspec_lib_contracts29.CapabilitySpec;
6
+ //#endregion
7
+ export { IdentityCapability, RbacCapability };
8
+ //# sourceMappingURL=identity-rbac.capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-rbac.capability.d.ts","names":[],"sources":["../src/identity-rbac.capability.ts"],"sourcesContent":[],"mappings":";;;cAEa,oBAUX,6BAAA,CAV6B;cAYlB,gBAUX,6BAAA,CAVyB"}
@@ -0,0 +1,29 @@
1
+ import { StabilityEnum, defineCapability } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/identity-rbac.capability.ts
4
+ const IdentityCapability = defineCapability({ meta: {
5
+ key: "identity",
6
+ version: "1.0.0",
7
+ kind: "api",
8
+ stability: StabilityEnum.Experimental,
9
+ description: "User identity and authentication",
10
+ owners: ["@platform.core"],
11
+ tags: ["identity", "auth"]
12
+ } });
13
+ const RbacCapability = defineCapability({ meta: {
14
+ key: "rbac",
15
+ version: "1.0.0",
16
+ kind: "api",
17
+ stability: StabilityEnum.Experimental,
18
+ description: "Role-based access control",
19
+ owners: ["@platform.core"],
20
+ tags: [
21
+ "rbac",
22
+ "permissions",
23
+ "auth"
24
+ ]
25
+ } });
26
+
27
+ //#endregion
28
+ export { IdentityCapability, RbacCapability };
29
+ //# sourceMappingURL=identity-rbac.capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-rbac.capability.js","names":[],"sources":["../src/identity-rbac.capability.ts"],"sourcesContent":["import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';\n\nexport const IdentityCapability = defineCapability({\n meta: {\n key: 'identity',\n version: '1.0.0',\n kind: 'api',\n stability: StabilityEnum.Experimental,\n description: 'User identity and authentication',\n owners: ['@platform.core'],\n tags: ['identity', 'auth'],\n },\n});\n\nexport const RbacCapability = defineCapability({\n meta: {\n key: 'rbac',\n version: '1.0.0',\n kind: 'api',\n stability: StabilityEnum.Experimental,\n description: 'Role-based access control',\n owners: ['@platform.core'],\n tags: ['rbac', 'permissions', 'auth'],\n },\n});\n"],"mappings":";;;AAEA,MAAa,qBAAqB,iBAAiB,EACjD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,iBAAiB;CAC1B,MAAM,CAAC,YAAY,OAAO;CAC3B,EACF,CAAC;AAEF,MAAa,iBAAiB,iBAAiB,EAC7C,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,iBAAiB;CAC1B,MAAM;EAAC;EAAQ;EAAe;EAAO;CACtC,EACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as _contractspec_lib_contracts31 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/identity-rbac.feature.d.ts
4
+
5
+ /**
6
+ * Identity & RBAC feature module that bundles user management,
7
+ * organization tenancy, and role-based access control.
8
+ */
9
+ declare const IdentityRbacFeature: _contractspec_lib_contracts31.FeatureModuleSpec;
10
+ //#endregion
11
+ export { IdentityRbacFeature };
12
+ //# sourceMappingURL=identity-rbac.feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-rbac.feature.d.ts","names":[],"sources":["../src/identity-rbac.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;cAAa,qBAkFX,6BAAA,CAlF8B"}
@@ -0,0 +1,195 @@
1
+ import { defineFeature } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/identity-rbac.feature.ts
4
+ /**
5
+ * Identity RBAC Feature Module Specification
6
+ *
7
+ * Defines the feature module for identity management and role-based access control.
8
+ */
9
+ /**
10
+ * Identity & RBAC feature module that bundles user management,
11
+ * organization tenancy, and role-based access control.
12
+ */
13
+ const IdentityRbacFeature = defineFeature({
14
+ meta: {
15
+ key: "identity-rbac",
16
+ version: "1.0.0",
17
+ title: "Identity & RBAC",
18
+ description: "User identity, organization management, and role-based access control",
19
+ domain: "platform",
20
+ owners: ["@platform.identity-rbac"],
21
+ tags: [
22
+ "identity",
23
+ "rbac",
24
+ "users",
25
+ "organizations",
26
+ "permissions"
27
+ ],
28
+ stability: "stable"
29
+ },
30
+ operations: [
31
+ {
32
+ key: "identity.user.create",
33
+ version: "1.0.0"
34
+ },
35
+ {
36
+ key: "identity.user.update",
37
+ version: "1.0.0"
38
+ },
39
+ {
40
+ key: "identity.user.delete",
41
+ version: "1.0.0"
42
+ },
43
+ {
44
+ key: "identity.user.me",
45
+ version: "1.0.0"
46
+ },
47
+ {
48
+ key: "identity.user.list",
49
+ version: "1.0.0"
50
+ },
51
+ {
52
+ key: "identity.org.create",
53
+ version: "1.0.0"
54
+ },
55
+ {
56
+ key: "identity.org.update",
57
+ version: "1.0.0"
58
+ },
59
+ {
60
+ key: "identity.org.get",
61
+ version: "1.0.0"
62
+ },
63
+ {
64
+ key: "identity.org.list",
65
+ version: "1.0.0"
66
+ },
67
+ {
68
+ key: "identity.org.invite",
69
+ version: "1.0.0"
70
+ },
71
+ {
72
+ key: "identity.org.invite.accept",
73
+ version: "1.0.0"
74
+ },
75
+ {
76
+ key: "identity.org.member.remove",
77
+ version: "1.0.0"
78
+ },
79
+ {
80
+ key: "identity.org.members.list",
81
+ version: "1.0.0"
82
+ },
83
+ {
84
+ key: "identity.rbac.role.create",
85
+ version: "1.0.0"
86
+ },
87
+ {
88
+ key: "identity.rbac.role.update",
89
+ version: "1.0.0"
90
+ },
91
+ {
92
+ key: "identity.rbac.role.delete",
93
+ version: "1.0.0"
94
+ },
95
+ {
96
+ key: "identity.rbac.role.list",
97
+ version: "1.0.0"
98
+ },
99
+ {
100
+ key: "identity.rbac.assign",
101
+ version: "1.0.0"
102
+ },
103
+ {
104
+ key: "identity.rbac.revoke",
105
+ version: "1.0.0"
106
+ },
107
+ {
108
+ key: "identity.rbac.check",
109
+ version: "1.0.0"
110
+ },
111
+ {
112
+ key: "identity.rbac.permissions",
113
+ version: "1.0.0"
114
+ }
115
+ ],
116
+ events: [
117
+ {
118
+ key: "user.created",
119
+ version: "1.0.0"
120
+ },
121
+ {
122
+ key: "user.updated",
123
+ version: "1.0.0"
124
+ },
125
+ {
126
+ key: "user.deleted",
127
+ version: "1.0.0"
128
+ },
129
+ {
130
+ key: "user.email_verified",
131
+ version: "1.0.0"
132
+ },
133
+ {
134
+ key: "org.created",
135
+ version: "1.0.0"
136
+ },
137
+ {
138
+ key: "org.updated",
139
+ version: "1.0.0"
140
+ },
141
+ {
142
+ key: "org.deleted",
143
+ version: "1.0.0"
144
+ },
145
+ {
146
+ key: "org.member.added",
147
+ version: "1.0.0"
148
+ },
149
+ {
150
+ key: "org.member.removed",
151
+ version: "1.0.0"
152
+ },
153
+ {
154
+ key: "org.member.role_changed",
155
+ version: "1.0.0"
156
+ },
157
+ {
158
+ key: "org.invite.sent",
159
+ version: "1.0.0"
160
+ },
161
+ {
162
+ key: "org.invite.accepted",
163
+ version: "1.0.0"
164
+ },
165
+ {
166
+ key: "org.invite.declined",
167
+ version: "1.0.0"
168
+ },
169
+ {
170
+ key: "role.assigned",
171
+ version: "1.0.0"
172
+ },
173
+ {
174
+ key: "role.revoked",
175
+ version: "1.0.0"
176
+ }
177
+ ],
178
+ presentations: [],
179
+ opToPresentation: [],
180
+ presentationsTargets: [],
181
+ capabilities: {
182
+ provides: [{
183
+ key: "identity",
184
+ version: "1.0.0"
185
+ }, {
186
+ key: "rbac",
187
+ version: "1.0.0"
188
+ }],
189
+ requires: []
190
+ }
191
+ });
192
+
193
+ //#endregion
194
+ export { IdentityRbacFeature };
195
+ //# sourceMappingURL=identity-rbac.feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-rbac.feature.js","names":[],"sources":["../src/identity-rbac.feature.ts"],"sourcesContent":["/**\n * Identity RBAC Feature Module Specification\n *\n * Defines the feature module for identity management and role-based access control.\n */\nimport { defineFeature } from '@contractspec/lib.contracts';\n\n/**\n * Identity & RBAC feature module that bundles user management,\n * organization tenancy, and role-based access control.\n */\nexport const IdentityRbacFeature = defineFeature({\n meta: {\n key: 'identity-rbac',\n version: '1.0.0',\n title: 'Identity & RBAC',\n description:\n 'User identity, organization management, and role-based access control',\n domain: 'platform',\n owners: ['@platform.identity-rbac'],\n tags: ['identity', 'rbac', 'users', 'organizations', 'permissions'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // User operations\n { key: 'identity.user.create', version: '1.0.0' },\n { key: 'identity.user.update', version: '1.0.0' },\n { key: 'identity.user.delete', version: '1.0.0' },\n { key: 'identity.user.me', version: '1.0.0' },\n { key: 'identity.user.list', version: '1.0.0' },\n\n // Organization operations\n { key: 'identity.org.create', version: '1.0.0' },\n { key: 'identity.org.update', version: '1.0.0' },\n { key: 'identity.org.get', version: '1.0.0' },\n { key: 'identity.org.list', version: '1.0.0' },\n { key: 'identity.org.invite', version: '1.0.0' },\n { key: 'identity.org.invite.accept', version: '1.0.0' },\n { key: 'identity.org.member.remove', version: '1.0.0' },\n { key: 'identity.org.members.list', version: '1.0.0' },\n\n // RBAC operations\n { key: 'identity.rbac.role.create', version: '1.0.0' },\n { key: 'identity.rbac.role.update', version: '1.0.0' },\n { key: 'identity.rbac.role.delete', version: '1.0.0' },\n { key: 'identity.rbac.role.list', version: '1.0.0' },\n { key: 'identity.rbac.assign', version: '1.0.0' },\n { key: 'identity.rbac.revoke', version: '1.0.0' },\n { key: 'identity.rbac.check', version: '1.0.0' },\n { key: 'identity.rbac.permissions', version: '1.0.0' },\n ],\n\n // Events emitted by this feature\n events: [\n // User events\n { key: 'user.created', version: '1.0.0' },\n { key: 'user.updated', version: '1.0.0' },\n { key: 'user.deleted', version: '1.0.0' },\n { key: 'user.email_verified', version: '1.0.0' },\n\n // Organization events\n { key: 'org.created', version: '1.0.0' },\n { key: 'org.updated', version: '1.0.0' },\n { key: 'org.deleted', version: '1.0.0' },\n { key: 'org.member.added', version: '1.0.0' },\n { key: 'org.member.removed', version: '1.0.0' },\n { key: 'org.member.role_changed', version: '1.0.0' },\n\n // Invitation events\n { key: 'org.invite.sent', version: '1.0.0' },\n { key: 'org.invite.accepted', version: '1.0.0' },\n { key: 'org.invite.declined', version: '1.0.0' },\n\n // Role events\n { key: 'role.assigned', version: '1.0.0' },\n { key: 'role.revoked', version: '1.0.0' },\n ],\n\n // No presentations for this library feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [\n { key: 'identity', version: '1.0.0' },\n { key: 'rbac', version: '1.0.0' },\n ],\n requires: [],\n },\n});\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAY;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GAAS;EAGpD;GAAE,KAAK;GAAmB,SAAS;GAAS;EAC5C;GAAE,KAAK;GAAuB,SAAS;GAAS;EAChD;GAAE,KAAK;GAAuB,SAAS;GAAS;EAGhD;GAAE,KAAK;GAAiB,SAAS;GAAS;EAC1C;GAAE,KAAK;GAAgB,SAAS;GAAS;EAC1C;CAGD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CACR;GAAE,KAAK;GAAY,SAAS;GAAS,EACrC;GAAE,KAAK;GAAQ,SAAS;GAAS,CAClC;EACD,UAAU,EAAE;EACb;CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { CreateUserContract, CreateUserInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, SuccessResultModel, UpdateUserContract, UpdateUserInputModel, UserDeletedPayloadModel, UserProfileModel } from "./contracts/user.js";
2
+ import { AcceptInviteContract, AcceptInviteInputModel, CreateOrgContract, CreateOrgInputModel, GetOrgContract, GetOrgInputModel, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrganizationModel, OrganizationWithRoleModel, RemoveMemberContract, RemoveMemberInputModel, UpdateOrgContract, UpdateOrgInputModel } from "./contracts/organization.js";
3
+ import { AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateRoleContract, CreateRoleInputModel, DeleteRoleContract, DeleteRoleInputModel, ListRolesContract, ListRolesOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, PermissionCheckResultModel, PolicyBindingModel, RevokeRoleContract, RevokeRoleInputModel, RoleModel, UpdateRoleContract, UpdateRoleInputModel } from "./contracts/rbac.js";
4
+ import "./contracts/index.js";
5
+ import { AccountEntity, SessionEntity, UserEntity, VerificationEntity } from "./entities/user.js";
6
+ import { InvitationEntity, MemberEntity, OrganizationEntity, OrganizationTypeEnum, TeamEntity, TeamMemberEntity } from "./entities/organization.js";
7
+ import { ApiKeyEntity, PasskeyEntity, PermissionEntity, PolicyBindingEntity, RoleEntity } from "./entities/rbac.js";
8
+ import { identityRbacEntities, identityRbacSchemaContribution } from "./entities/index.js";
9
+ import { IdentityRbacEvents, OrgCreatedEvent, OrgDeletedEvent, OrgInviteAcceptedEvent, OrgInviteDeclinedEvent, OrgInviteSentEvent, OrgMemberAddedEvent, OrgMemberRemovedEvent, OrgMemberRoleChangedEvent, OrgUpdatedEvent, RoleAssignedEvent, RoleRevokedEvent, UserCreatedEvent, UserDeletedEvent, UserEmailVerifiedEvent, UserUpdatedEvent } from "./events.js";
10
+ import { IdentityRbacFeature } from "./identity-rbac.feature.js";
11
+ import { Permission, PermissionCheckInput, PermissionCheckResult, PermissionKey, PolicyBindingForEval, RBACPolicyEngine, RoleWithPermissions, StandardRole, createRBACEngine } from "./policies/engine.js";
12
+ export { AcceptInviteContract, AcceptInviteInputModel, AccountEntity, ApiKeyEntity, AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateOrgContract, CreateOrgInputModel, CreateRoleContract, CreateRoleInputModel, CreateUserContract, CreateUserInputModel, DeleteRoleContract, DeleteRoleInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, GetOrgContract, GetOrgInputModel, IdentityRbacEvents, IdentityRbacFeature, InvitationEntity, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListRolesContract, ListRolesOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, MemberEntity, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrgCreatedEvent, OrgDeletedEvent, OrgInviteAcceptedEvent, OrgInviteDeclinedEvent, OrgInviteSentEvent, OrgMemberAddedEvent, OrgMemberRemovedEvent, OrgMemberRoleChangedEvent, OrgUpdatedEvent, OrganizationEntity, OrganizationModel, OrganizationTypeEnum, OrganizationWithRoleModel, PasskeyEntity, Permission, PermissionCheckInput, PermissionCheckResult, PermissionCheckResultModel, PermissionEntity, PermissionKey, PolicyBindingEntity, PolicyBindingForEval, PolicyBindingModel, RBACPolicyEngine, RemoveMemberContract, RemoveMemberInputModel, RevokeRoleContract, RevokeRoleInputModel, RoleAssignedEvent, RoleEntity, RoleModel, RoleRevokedEvent, RoleWithPermissions, SessionEntity, StandardRole, SuccessResultModel, TeamEntity, TeamMemberEntity, UpdateOrgContract, UpdateOrgInputModel, UpdateRoleContract, UpdateRoleInputModel, UpdateUserContract, UpdateUserInputModel, UserCreatedEvent, UserDeletedEvent, UserDeletedPayloadModel, UserEmailVerifiedEvent, UserEntity, UserProfileModel, UserUpdatedEvent, VerificationEntity, createRBACEngine, identityRbacEntities, identityRbacSchemaContribution };
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import { IdentityRbacEvents, OrgCreatedEvent, OrgDeletedEvent, OrgInviteAcceptedEvent, OrgInviteDeclinedEvent, OrgInviteSentEvent, OrgMemberAddedEvent, OrgMemberRemovedEvent, OrgMemberRoleChangedEvent, OrgUpdatedEvent, RoleAssignedEvent, RoleRevokedEvent, UserCreatedEvent, UserDeletedEvent, UserEmailVerifiedEvent, UserUpdatedEvent } from "./events.js";
2
+ import { IdentityRbacFeature } from "./identity-rbac.feature.js";
3
+ import { AccountEntity, SessionEntity, UserEntity, VerificationEntity } from "./entities/user.js";
4
+ import { InvitationEntity, MemberEntity, OrganizationEntity, OrganizationTypeEnum, TeamEntity, TeamMemberEntity } from "./entities/organization.js";
5
+ import { ApiKeyEntity, PasskeyEntity, PermissionEntity, PolicyBindingEntity, RoleEntity } from "./entities/rbac.js";
6
+ import { identityRbacEntities, identityRbacSchemaContribution } from "./entities/index.js";
7
+ import { CreateUserContract, CreateUserInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, SuccessResultModel, UpdateUserContract, UpdateUserInputModel, UserDeletedPayloadModel, UserProfileModel } from "./contracts/user.js";
8
+ import { AcceptInviteContract, AcceptInviteInputModel, CreateOrgContract, CreateOrgInputModel, GetOrgContract, GetOrgInputModel, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrganizationModel, OrganizationWithRoleModel, RemoveMemberContract, RemoveMemberInputModel, UpdateOrgContract, UpdateOrgInputModel } from "./contracts/organization.js";
9
+ import { AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateRoleContract, CreateRoleInputModel, DeleteRoleContract, DeleteRoleInputModel, ListRolesContract, ListRolesOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, PermissionCheckResultModel, PolicyBindingModel, RevokeRoleContract, RevokeRoleInputModel, RoleModel, UpdateRoleContract, UpdateRoleInputModel } from "./contracts/rbac.js";
10
+ import "./contracts/index.js";
11
+ import { Permission, RBACPolicyEngine, StandardRole, createRBACEngine } from "./policies/engine.js";
12
+ import "./policies/index.js";
13
+
14
+ export { AcceptInviteContract, AcceptInviteInputModel, AccountEntity, ApiKeyEntity, AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateOrgContract, CreateOrgInputModel, CreateRoleContract, CreateRoleInputModel, CreateUserContract, CreateUserInputModel, DeleteRoleContract, DeleteRoleInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, GetOrgContract, GetOrgInputModel, IdentityRbacEvents, IdentityRbacFeature, InvitationEntity, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListRolesContract, ListRolesOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, MemberEntity, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrgCreatedEvent, OrgDeletedEvent, OrgInviteAcceptedEvent, OrgInviteDeclinedEvent, OrgInviteSentEvent, OrgMemberAddedEvent, OrgMemberRemovedEvent, OrgMemberRoleChangedEvent, OrgUpdatedEvent, OrganizationEntity, OrganizationModel, OrganizationTypeEnum, OrganizationWithRoleModel, PasskeyEntity, Permission, PermissionCheckResultModel, PermissionEntity, PolicyBindingEntity, PolicyBindingModel, RBACPolicyEngine, RemoveMemberContract, RemoveMemberInputModel, RevokeRoleContract, RevokeRoleInputModel, RoleAssignedEvent, RoleEntity, RoleModel, RoleRevokedEvent, SessionEntity, StandardRole, SuccessResultModel, TeamEntity, TeamMemberEntity, UpdateOrgContract, UpdateOrgInputModel, UpdateRoleContract, UpdateRoleInputModel, UpdateUserContract, UpdateUserInputModel, UserCreatedEvent, UserDeletedEvent, UserDeletedPayloadModel, UserEmailVerifiedEvent, UserEntity, UserProfileModel, UserUpdatedEvent, VerificationEntity, createRBACEngine, identityRbacEntities, identityRbacSchemaContribution };
@@ -0,0 +1,133 @@
1
+ //#region src/policies/engine.d.ts
2
+ /**
3
+ * Standard permissions for identity-rbac module.
4
+ */
5
+ declare const Permission: {
6
+ readonly USER_CREATE: "user.create";
7
+ readonly USER_READ: "user.read";
8
+ readonly USER_UPDATE: "user.update";
9
+ readonly USER_DELETE: "user.delete";
10
+ readonly USER_LIST: "user.list";
11
+ readonly USER_MANAGE: "user.manage";
12
+ readonly ORG_CREATE: "org.create";
13
+ readonly ORG_READ: "org.read";
14
+ readonly ORG_UPDATE: "org.update";
15
+ readonly ORG_DELETE: "org.delete";
16
+ readonly ORG_LIST: "org.list";
17
+ readonly MEMBER_INVITE: "member.invite";
18
+ readonly MEMBER_REMOVE: "member.remove";
19
+ readonly MEMBER_UPDATE_ROLE: "member.update_role";
20
+ readonly MEMBER_LIST: "member.list";
21
+ readonly MANAGE_MEMBERS: "org.manage_members";
22
+ readonly TEAM_CREATE: "team.create";
23
+ readonly TEAM_UPDATE: "team.update";
24
+ readonly TEAM_DELETE: "team.delete";
25
+ readonly TEAM_MANAGE: "team.manage";
26
+ readonly ROLE_CREATE: "role.create";
27
+ readonly ROLE_UPDATE: "role.update";
28
+ readonly ROLE_DELETE: "role.delete";
29
+ readonly ROLE_ASSIGN: "role.assign";
30
+ readonly ROLE_REVOKE: "role.revoke";
31
+ readonly BILLING_VIEW: "billing.view";
32
+ readonly BILLING_MANAGE: "billing.manage";
33
+ readonly PROJECT_CREATE: "project.create";
34
+ readonly PROJECT_READ: "project.read";
35
+ readonly PROJECT_UPDATE: "project.update";
36
+ readonly PROJECT_DELETE: "project.delete";
37
+ readonly PROJECT_MANAGE: "project.manage";
38
+ readonly ADMIN_ACCESS: "admin.access";
39
+ readonly ADMIN_IMPERSONATE: "admin.impersonate";
40
+ };
41
+ type PermissionKey = (typeof Permission)[keyof typeof Permission];
42
+ /**
43
+ * Standard role definitions.
44
+ */
45
+ declare const StandardRole: {
46
+ readonly OWNER: {
47
+ readonly name: "owner";
48
+ readonly description: "Organization owner with full access";
49
+ readonly permissions: ("user.create" | "user.read" | "user.update" | "user.delete" | "user.list" | "user.manage" | "org.create" | "org.read" | "org.update" | "org.delete" | "org.list" | "member.invite" | "member.remove" | "member.update_role" | "member.list" | "org.manage_members" | "team.create" | "team.update" | "team.delete" | "team.manage" | "role.create" | "role.update" | "role.delete" | "role.assign" | "role.revoke" | "billing.view" | "billing.manage" | "project.create" | "project.read" | "project.update" | "project.delete" | "project.manage" | "admin.access" | "admin.impersonate")[];
50
+ };
51
+ readonly ADMIN: {
52
+ readonly name: "admin";
53
+ readonly description: "Administrator with most permissions";
54
+ readonly permissions: readonly ["user.read", "user.list", "org.read", "org.update", "member.invite", "member.remove", "member.update_role", "member.list", "org.manage_members", "team.create", "team.update", "team.delete", "team.manage", "project.create", "project.read", "project.update", "project.delete", "project.manage", "billing.view"];
55
+ };
56
+ readonly MEMBER: {
57
+ readonly name: "member";
58
+ readonly description: "Regular organization member";
59
+ readonly permissions: readonly ["user.read", "org.read", "member.list", "project.read", "project.create"];
60
+ };
61
+ readonly VIEWER: {
62
+ readonly name: "viewer";
63
+ readonly description: "Read-only access";
64
+ readonly permissions: readonly ["user.read", "org.read", "member.list", "project.read"];
65
+ };
66
+ };
67
+ /**
68
+ * Permission check input.
69
+ */
70
+ interface PermissionCheckInput {
71
+ userId: string;
72
+ orgId?: string;
73
+ permission: PermissionKey | string;
74
+ }
75
+ /**
76
+ * Permission check result.
77
+ */
78
+ interface PermissionCheckResult {
79
+ allowed: boolean;
80
+ reason?: string;
81
+ matchedRole?: string;
82
+ }
83
+ /**
84
+ * Role with permissions.
85
+ */
86
+ interface RoleWithPermissions {
87
+ id: string;
88
+ name: string;
89
+ permissions: string[];
90
+ }
91
+ /**
92
+ * Policy binding for permission evaluation.
93
+ */
94
+ interface PolicyBindingForEval {
95
+ roleId: string;
96
+ role: RoleWithPermissions;
97
+ targetType: 'user' | 'organization';
98
+ targetId: string;
99
+ expiresAt?: Date | null;
100
+ }
101
+ /**
102
+ * RBAC Policy Engine for permission checks.
103
+ */
104
+ declare class RBACPolicyEngine {
105
+ private roleCache;
106
+ private bindingCache;
107
+ /**
108
+ * Check if a user has a specific permission.
109
+ */
110
+ checkPermission(input: PermissionCheckInput, bindings: PolicyBindingForEval[]): Promise<PermissionCheckResult>;
111
+ /**
112
+ * Get all permissions for a user in a context.
113
+ */
114
+ getPermissions(userId: string, orgId: string | undefined, bindings: PolicyBindingForEval[]): Promise<{
115
+ permissions: Set<string>;
116
+ roles: RoleWithPermissions[];
117
+ }>;
118
+ /**
119
+ * Check if user has any of the specified permissions.
120
+ */
121
+ hasAnyPermission(userId: string, orgId: string | undefined, permissions: string[], bindings: PolicyBindingForEval[]): Promise<boolean>;
122
+ /**
123
+ * Check if user has all of the specified permissions.
124
+ */
125
+ hasAllPermissions(userId: string, orgId: string | undefined, permissions: string[], bindings: PolicyBindingForEval[]): Promise<boolean>;
126
+ }
127
+ /**
128
+ * Create a new RBAC policy engine instance.
129
+ */
130
+ declare function createRBACEngine(): RBACPolicyEngine;
131
+ //#endregion
132
+ export { Permission, PermissionCheckInput, PermissionCheckResult, PermissionKey, PolicyBindingForEval, RBACPolicyEngine, RoleWithPermissions, StandardRole, createRBACEngine };
133
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","names":[],"sources":["../../src/policies/engine.ts"],"sourcesContent":[],"mappings":";;AAGA;AAoDA;AAKa,cAzDA,UA6GH,EAAA;EAKO,SAAA,WAAA,EAAA,aAGH;EAMG,SAAA,SAAA,EAAA,WAAqB;EASrB,SAAA,WAAA,EAAmB,aAAA;EASnB,SAAA,WAAA,EAAA,aAET;EASK,SAAA,SAAA,EAAgB,WAAA;EAQlB,SAAA,WAAA,EAAA,aAAA;EACG,SAAA,UAAA,EAAA,YAAA;EACD,SAAA,QAAA,EAAA,UAAA;EAAR,SAAA,UAAA,EAAA,YAAA;EAmDS,SAAA,UAAA,EAAA,YAAA;EAEG,SAAA,QAAA,EAAA,UAAA;EACN,SAAA,aAAA,EAAA,eAAA;EAFN,SAAA,aAAA,EAAA,eAAA;EA4CS,SAAA,kBAAA,EAAA,oBAAA;EACT,SAAA,WAAA,EAAA,aAAA;EAiBS,SAAA,cAAA,EAAA,oBAAA;EACT,SAAA,WAAA,EAAA,aAAA;EAAO,SAAA,WAAA,EAAA,aAAA;EAcI,SAAA,WAAgB,EAAA,aAAI;;;;;;;;;;;;;;;;;KA/OxB,aAAA,WAAwB,yBAAyB;;;;cAKhD;;;;;;;;;;;;;;;;;;;;;;;;;UAyDI,oBAAA;;;cAGH;;;;;UAMG,qBAAA;;;;;;;;UASA,mBAAA;;;;;;;;UASA,oBAAA;;QAET;;;cAGM;;;;;cAMD,gBAAA;;;;;;yBAQF,gCACG,yBACT,QAAQ;;;;sEAmDC,yBACT;iBACY;WACN;;;;;+FA0CG,yBACT;;;;gGAiBS,yBACT;;;;;iBAcW,gBAAA,CAAA,GAAoB"}