@epilot/sdk 2.1.6 → 2.1.7
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/definitions/permissions.json +41 -6
- package/dist/apis/access-token.cjs +6 -6
- package/dist/apis/access-token.js +1 -1
- package/dist/apis/address-suggestions.cjs +6 -6
- package/dist/apis/address-suggestions.js +1 -1
- package/dist/apis/address.cjs +6 -6
- package/dist/apis/address.js +1 -1
- package/dist/apis/ai-agents.cjs +6 -6
- package/dist/apis/ai-agents.js +1 -1
- package/dist/apis/app.cjs +6 -6
- package/dist/apis/app.js +1 -1
- package/dist/apis/audit-logs.cjs +6 -6
- package/dist/apis/audit-logs.js +1 -1
- package/dist/apis/automation.cjs +6 -6
- package/dist/apis/automation.js +1 -1
- package/dist/apis/billing.cjs +6 -6
- package/dist/apis/billing.js +1 -1
- package/dist/apis/blueprint-manifest.cjs +6 -6
- package/dist/apis/blueprint-manifest.js +1 -1
- package/dist/apis/consent.cjs +6 -6
- package/dist/apis/consent.js +1 -1
- package/dist/apis/customer-portal.cjs +6 -6
- package/dist/apis/customer-portal.js +1 -1
- package/dist/apis/dashboard.cjs +6 -6
- package/dist/apis/dashboard.js +1 -1
- package/dist/apis/data-management.cjs +6 -6
- package/dist/apis/data-management.js +1 -1
- package/dist/apis/deduplication.cjs +6 -6
- package/dist/apis/deduplication.js +1 -1
- package/dist/apis/design.cjs +6 -6
- package/dist/apis/design.js +1 -1
- package/dist/apis/document.cjs +6 -6
- package/dist/apis/document.js +1 -1
- package/dist/apis/email-settings.cjs +6 -6
- package/dist/apis/email-settings.js +1 -1
- package/dist/apis/email-template.cjs +6 -6
- package/dist/apis/email-template.js +1 -1
- package/dist/apis/entity-mapping.cjs +6 -6
- package/dist/apis/entity-mapping.js +1 -1
- package/dist/apis/entity.cjs +6 -6
- package/dist/apis/entity.js +1 -1
- package/dist/apis/environments.cjs +6 -6
- package/dist/apis/environments.js +1 -1
- package/dist/apis/erp-integration.cjs +6 -6
- package/dist/apis/erp-integration.js +1 -1
- package/dist/apis/event-catalog.cjs +6 -6
- package/dist/apis/event-catalog.js +1 -1
- package/dist/apis/file.cjs +6 -6
- package/dist/apis/file.js +1 -1
- package/dist/apis/iban.cjs +6 -6
- package/dist/apis/iban.js +1 -1
- package/dist/apis/journey.cjs +6 -6
- package/dist/apis/journey.js +1 -1
- package/dist/apis/kanban.cjs +6 -6
- package/dist/apis/kanban.js +1 -1
- package/dist/apis/message.cjs +6 -6
- package/dist/apis/message.js +1 -1
- package/dist/apis/metering.cjs +6 -6
- package/dist/apis/metering.js +1 -1
- package/dist/apis/notes.cjs +6 -6
- package/dist/apis/notes.js +1 -1
- package/dist/apis/notification.cjs +6 -6
- package/dist/apis/notification.js +1 -1
- package/dist/apis/organization.cjs +6 -6
- package/dist/apis/organization.js +1 -1
- package/dist/apis/partner-directory.cjs +6 -6
- package/dist/apis/partner-directory.js +1 -1
- package/dist/apis/permissions.cjs +6 -6
- package/dist/apis/permissions.d.cts +2 -2
- package/dist/apis/permissions.d.ts +2 -2
- package/dist/apis/permissions.js +1 -1
- package/dist/apis/pricing-tier.cjs +6 -6
- package/dist/apis/pricing-tier.js +1 -1
- package/dist/apis/pricing.cjs +6 -6
- package/dist/apis/pricing.js +1 -1
- package/dist/apis/purpose.cjs +6 -6
- package/dist/apis/purpose.js +1 -1
- package/dist/apis/sandbox.cjs +6 -6
- package/dist/apis/sandbox.js +1 -1
- package/dist/apis/submission.cjs +6 -6
- package/dist/apis/submission.js +1 -1
- package/dist/apis/targeting.cjs +6 -6
- package/dist/apis/targeting.js +1 -1
- package/dist/apis/template-variables.cjs +6 -6
- package/dist/apis/template-variables.js +1 -1
- package/dist/apis/user.cjs +6 -6
- package/dist/apis/user.js +1 -1
- package/dist/apis/validation-rules.cjs +6 -6
- package/dist/apis/validation-rules.js +1 -1
- package/dist/apis/webhooks.cjs +6 -6
- package/dist/apis/webhooks.js +1 -1
- package/dist/apis/workflow-definition.cjs +6 -6
- package/dist/apis/workflow-definition.js +1 -1
- package/dist/apis/workflow.cjs +6 -6
- package/dist/apis/workflow.js +1 -1
- package/dist/{chunk-DDMVRJDZ.cjs → chunk-4LDVICOS.cjs} +1 -1
- package/dist/{chunk-EQYWNVI2.js → chunk-PITTHLH4.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/permissions-X3SJVSPC.js +7 -0
- package/dist/permissions-ZJHUIBWY.cjs +7 -0
- package/dist/{permissions.d-BHB1FFS5.d.cts → permissions.d-l6AT8SYP.d.cts} +31 -4
- package/dist/{permissions.d-BHB1FFS5.d.ts → permissions.d-l6AT8SYP.d.ts} +31 -4
- package/docs/permissions.md +34 -9
- package/package.json +1 -1
- package/dist/permissions-4T3GFNB4.js +0 -7
- package/dist/permissions-FGBIJNN7.cjs +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-NJK5F5TF.cjs');
|
|
2
|
+
|
|
3
|
+
// src/docs/permissions.json
|
|
4
|
+
var permissions_default = '# Permissions API\n\n- **Full API Docs:** [https://docs.epilot.io/api/permissions](https://docs.epilot.io/api/permissions)\n\n## Usage\n\n```ts\nimport { epilot } from \'@epilot/sdk\'\n\nepilot.authorize(() => \'<token>\')\nconst { data } = await epilot.permissions.listCurrentRoles(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from \'@epilot/sdk/permissions\'\n\nconst permissionsClient = getClient()\nauthorize(permissionsClient, () => \'<token>\')\nconst { data } = await permissionsClient.listCurrentRoles(...)\n```\n\n## Operations\n\n**Roles**\n- [`listCurrentRoles`](#listcurrentroles)\n- [`listAllRoles`](#listallroles)\n- [`createRole`](#createrole)\n- [`searchRoles`](#searchroles)\n- [`getRole`](#getrole)\n- [`putRole`](#putrole)\n- [`deleteRole`](#deleterole)\n- [`refreshPermissions`](#refreshpermissions)\n\n**Assignments**\n- [`getAssignedRolesForUser`](#getassignedrolesforuser)\n- [`assignRoles`](#assignroles)\n- [`addAssignment`](#addassignment)\n- [`removeAssignment`](#removeassignment)\n- [`listAllAssignments`](#listallassignments)\n\n**Schemas**\n- [`Grant`](#grant)\n- [`GrantWithDependencies`](#grantwithdependencies)\n- [`GrantCondition`](#grantcondition)\n- [`EqualsCurrentUserCondition`](#equalscurrentusercondition)\n- [`EqualsCondition`](#equalscondition)\n- [`RoleId`](#roleid)\n- [`BaseRole`](#baserole)\n- [`BaseRoleForCreate`](#baseroleforcreate)\n- [`UserRole`](#userrole)\n- [`OrgRole`](#orgrole)\n- [`ShareRole`](#sharerole)\n- [`PartnerRole`](#partnerrole)\n- [`PortalRole`](#portalrole)\n- [`Role`](#role)\n- [`RolePayload`](#rolepayload)\n- [`Assignment`](#assignment)\n- [`InternalAssignment`](#internalassignment)\n- [`OrgAssignments`](#orgassignments)\n- [`OrgRoles`](#orgroles)\n- [`Assignments`](#assignments)\n- [`UserId`](#userid)\n- [`OrganizationId`](#organizationid)\n- [`Slug`](#slug)\n- [`RoleSearchInput`](#rolesearchinput)\n- [`CreateRolePayload`](#createrolepayload)\n- [`Error`](#error)\n\n### `listCurrentRoles`\n\nReturns roles and grants assigned to current user\n\n`GET /v1/permissions/me`\n\n```ts\nconst { data } = await client.listCurrentRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `listAllRoles`\n\nReturns list of all roles in organization\n\n`GET /v1/permissions/roles`\n\n```ts\nconst { data } = await client.listAllRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `createRole`\n\nCreate role\n\n`POST /v1/permissions/roles`\n\n```ts\nconst { data } = await client.createRole(\n null,\n {},\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n}\n```\n\n</details>\n\n---\n\n### `searchRoles`\n\nSearch Roles\n\n`POST /v1/permissions/roles:search`\n\n```ts\nconst { data } = await client.searchRoles(\n null,\n {\n role_ids: [\'123:manager\', \'456:owner\'],\n org_ids: [\'123\', \'456\'],\n slugs: [\'manager\', \'owner\'],\n query: \'Administrator\',\n limit: 1,\n offset: 1\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "hits": 0,\n "results": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `getRole`\n\nGet role by id\n\n`GET /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.getRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n}\n```\n\n</details>\n\n---\n\n### `putRole`\n\nCreate or update role\n\n`PUT /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.putRole(\n {\n roleId: \'example\',\n },\n {\n id: \'123:owner\',\n name: \'Owner\',\n slug: \'owner\',\n type: \'user_role\',\n expires_at: \'2028-07-21T17:32:28Z\',\n organization_id: \'123\',\n grants: [\n {\n action: \'entity-read\',\n resource: \'entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947\',\n effect: \'allow\',\n conditions: [\n {\n attribute: \'workflows.primary.task_name\',\n operation: \'equals\',\n values: [\'Qualification\']\n }\n ]\n }\n ],\n parent_role: \'123:owner\',\n vendor_created: true\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n}\n```\n\n</details>\n\n---\n\n### `deleteRole`\n\nDelete role by id\n\n`DELETE /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.deleteRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner",\n "vendor_created": true\n}\n```\n\n</details>\n\n---\n\n### `refreshPermissions`\n\nMakes sure the user has a role in the organization\n\n`GET /v1/permissions/refresh`\n\n```ts\nconst { data } = await client.refreshPermissions()\n```\n\n---\n\n### `getAssignedRolesForUser`\n\nGet list of assigned roles by user id\n\n`GET /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.getAssignedRolesForUser({\n userId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `assignRoles`\n\nAssign / unassign roles to users.\n\n`PUT /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.assignRoles(\n {\n userId: \'example\',\n },\n [\'123:owner\'],\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `addAssignment`\n\nAssign a user to a role.\n\n`POST /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.addAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `removeAssignment`\n\nRemove role assignment from user\n\n`DELETE /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.removeAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `listAllAssignments`\n\nReturns list of all assignments in organization\n\n`GET /v1/permissions/assignments`\n\n```ts\nconst { data } = await client.listAllAssignments()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "assignments": [\n {\n "user_id": "1",\n "roles": ["123:owner"]\n }\n ]\n}\n```\n\n</details>\n\n---\n\n## Schemas\n\n### `Grant`\n\n```ts\ntype Grant = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n}\n```\n\n### `GrantWithDependencies`\n\n```ts\ntype GrantWithDependencies = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `GrantCondition`\n\n```ts\ntype GrantCondition = object\n```\n\n### `EqualsCurrentUserCondition`\n\nCheck if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked.\n\n```ts\ntype EqualsCurrentUserCondition = {\n attribute?: string\n operation: "equals_current_user"\n}\n```\n\n### `EqualsCondition`\n\nCheck if attribute equals to any of the values\n\n```ts\ntype EqualsCondition = {\n attribute: string\n operation: "equals"\n values: unknown[]\n}\n```\n\n### `RoleId`\n\nFormat: `<organization_id>`:`<slug>`\n\n```ts\ntype RoleId = string\n```\n\n### `BaseRole`\n\n```ts\ntype BaseRole = {\n id: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `BaseRoleForCreate`\n\n```ts\ntype BaseRoleForCreate = {\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `UserRole`\n\n```ts\ntype UserRole = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n vendor_created?: boolean\n}\n```\n\n### `OrgRole`\n\n```ts\ntype OrgRole = {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n}\n```\n\n### `ShareRole`\n\n```ts\ntype ShareRole = {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `PartnerRole`\n\n```ts\ntype PartnerRole = {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n vendor_created?: boolean\n}\n```\n\n### `PortalRole`\n\n```ts\ntype PortalRole = {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `Role`\n\n```ts\ntype Role = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n vendor_created?: boolean\n} | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n} | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n} | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n vendor_created?: boolean\n} | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `RolePayload`\n\n```ts\ntype RolePayload = {\n grants?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignment`\n\nA role attached to an user\n\n```ts\ntype Assignment = {\n user_id?: string\n roles?: string[]\n}\n```\n\n### `InternalAssignment`\n\nA role attached to an user\n\n```ts\ntype InternalAssignment = {\n userId?: string\n roles?: string[]\n}\n```\n\n### `OrgAssignments`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgAssignments = {\n organizationId?: string\n assignments?: Array<{\n userId?: string\n roles?: string[]\n }>\n}\n```\n\n### `OrgRoles`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgRoles = {\n organizationId?: string\n roles?: Array<{\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n parent_role?: object\n vendor_created?: boolean\n } | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n pricing_tier?: string\n } | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n } | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n vendor_created?: boolean\n } | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignments`\n\nList of role ids attached to an user\n\n```ts\ntype Assignments = string[]\n```\n\n### `UserId`\n\nId of a user\n\n```ts\ntype UserId = string\n```\n\n### `OrganizationId`\n\nId of an organization\n\n```ts\ntype OrganizationId = string\n```\n\n### `Slug`\n\nSlug of a role; for a role with id = 123:manager -> 123 is org_id & manager is slug\n\n```ts\ntype Slug = string\n```\n\n### `RoleSearchInput`\n\n```ts\ntype RoleSearchInput = {\n role_ids?: string[]\n org_ids?: string[]\n slugs?: string[]\n query?: string\n limit?: number\n offset?: number\n}\n```\n\n### `CreateRolePayload`\n\n```ts\ntype CreateRolePayload = {\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n}\n```\n\n### `Error`\n\nError response\n\n```ts\ntype Error = {\n message: string\n}\n```\n';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.default = permissions_default;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { OpenAPIClient, Parameters, UnknownParamsObject, AxiosRequestConfig, OperationResponse } from 'openapi-client-axios';
|
|
2
2
|
|
|
3
3
|
/* Auto-copied from permissions-client */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
declare namespace Components {
|
|
@@ -124,6 +122,10 @@ declare namespace Components {
|
|
|
124
122
|
* 123:owner
|
|
125
123
|
*/
|
|
126
124
|
parent_role?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
127
|
+
*/
|
|
128
|
+
vendor_created?: boolean;
|
|
127
129
|
/**
|
|
128
130
|
* List of grants (permissions) applied to the role
|
|
129
131
|
*/
|
|
@@ -253,6 +255,10 @@ declare namespace Components {
|
|
|
253
255
|
* 123
|
|
254
256
|
*/
|
|
255
257
|
partner_org_id?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
260
|
+
*/
|
|
261
|
+
vendor_created?: boolean;
|
|
256
262
|
/**
|
|
257
263
|
* List of grants (permissions) applied to the role
|
|
258
264
|
*/
|
|
@@ -339,6 +345,18 @@ declare namespace Components {
|
|
|
339
345
|
operation: "equals";
|
|
340
346
|
values: any[];
|
|
341
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Check if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked.
|
|
350
|
+
*/
|
|
351
|
+
export interface EqualsCurrentUserCondition {
|
|
352
|
+
/**
|
|
353
|
+
* Optional JSON path to a specific user attribute. When omitted, all relation_user attributes on the entity are scanned.
|
|
354
|
+
* example:
|
|
355
|
+
* assignee.*.user_id
|
|
356
|
+
*/
|
|
357
|
+
attribute?: string;
|
|
358
|
+
operation: "equals_current_user";
|
|
359
|
+
}
|
|
342
360
|
/**
|
|
343
361
|
* Error response
|
|
344
362
|
*/
|
|
@@ -367,7 +385,7 @@ declare namespace Components {
|
|
|
367
385
|
/**
|
|
368
386
|
* An additional condition that must be met for the grant
|
|
369
387
|
*/
|
|
370
|
-
export type GrantCondition = /* An additional condition that must be met for the grant */ /* Check if attribute equals to any of the values */ EqualsCondition;
|
|
388
|
+
export type GrantCondition = /* An additional condition that must be met for the grant */ /* Check if attribute equals to any of the values */ EqualsCondition | /* Check if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked. */ EqualsCurrentUserCondition;
|
|
371
389
|
export interface GrantWithDependencies {
|
|
372
390
|
/**
|
|
373
391
|
* example:
|
|
@@ -534,6 +552,10 @@ declare namespace Components {
|
|
|
534
552
|
* Maximum number of users that can be assigned this role (vendor-enforced limit, can only be set via internal auth)
|
|
535
553
|
*/
|
|
536
554
|
vendor_enforced_user_limit?: number;
|
|
555
|
+
/**
|
|
556
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
557
|
+
*/
|
|
558
|
+
vendor_created?: boolean;
|
|
537
559
|
}
|
|
538
560
|
/**
|
|
539
561
|
* A role that is applied to end customers and installers using the Portals
|
|
@@ -753,6 +775,10 @@ declare namespace Components {
|
|
|
753
775
|
* 123:owner
|
|
754
776
|
*/
|
|
755
777
|
parent_role?: string;
|
|
778
|
+
/**
|
|
779
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
780
|
+
*/
|
|
781
|
+
vendor_created?: boolean;
|
|
756
782
|
}
|
|
757
783
|
}
|
|
758
784
|
}
|
|
@@ -1229,6 +1255,7 @@ type BaseRole = Components.Schemas.BaseRole;
|
|
|
1229
1255
|
type BaseRoleForCreate = Components.Schemas.BaseRoleForCreate;
|
|
1230
1256
|
type CreateRolePayload = Components.Schemas.CreateRolePayload;
|
|
1231
1257
|
type EqualsCondition = Components.Schemas.EqualsCondition;
|
|
1258
|
+
type EqualsCurrentUserCondition = Components.Schemas.EqualsCurrentUserCondition;
|
|
1232
1259
|
type Error = Components.Schemas.Error;
|
|
1233
1260
|
type Grant = Components.Schemas.Grant;
|
|
1234
1261
|
type GrantCondition = Components.Schemas.GrantCondition;
|
|
@@ -1249,4 +1276,4 @@ type Slug = Components.Schemas.Slug;
|
|
|
1249
1276
|
type UserId = Components.Schemas.UserId;
|
|
1250
1277
|
type UserRole = Components.Schemas.UserRole;
|
|
1251
1278
|
|
|
1252
|
-
export { type Assignment as A, type BaseRole as B, type Client as C, type EqualsCondition as E, type Grant as G, type InternalAssignment as I, type OperationMethods as O, Paths as P, type Role as R, type ShareRole as S, type UserId as U, Components as a, type PathsDictionary as b, type Assignments as c, type BaseRoleForCreate as d, type CreateRolePayload as e, type
|
|
1279
|
+
export { type Assignment as A, type BaseRole as B, type Client as C, type EqualsCondition as E, type Grant as G, type InternalAssignment as I, type OperationMethods as O, Paths as P, type Role as R, type ShareRole as S, type UserId as U, Components as a, type PathsDictionary as b, type Assignments as c, type BaseRoleForCreate as d, type CreateRolePayload as e, type EqualsCurrentUserCondition as f, type Error as g, type GrantCondition as h, type GrantWithDependencies as i, type OrgAssignments as j, type OrgRole as k, type OrgRoles as l, type OrganizationId as m, type PartnerRole as n, type PortalRole as o, type RoleId as p, type RolePayload as q, type RoleSearchInput as r, type Slug as s, type UserRole as t };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { OpenAPIClient, Parameters, UnknownParamsObject, AxiosRequestConfig, OperationResponse } from 'openapi-client-axios';
|
|
2
2
|
|
|
3
3
|
/* Auto-copied from permissions-client */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
|
|
6
4
|
|
|
7
5
|
|
|
8
6
|
declare namespace Components {
|
|
@@ -124,6 +122,10 @@ declare namespace Components {
|
|
|
124
122
|
* 123:owner
|
|
125
123
|
*/
|
|
126
124
|
parent_role?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
127
|
+
*/
|
|
128
|
+
vendor_created?: boolean;
|
|
127
129
|
/**
|
|
128
130
|
* List of grants (permissions) applied to the role
|
|
129
131
|
*/
|
|
@@ -253,6 +255,10 @@ declare namespace Components {
|
|
|
253
255
|
* 123
|
|
254
256
|
*/
|
|
255
257
|
partner_org_id?: string;
|
|
258
|
+
/**
|
|
259
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
260
|
+
*/
|
|
261
|
+
vendor_created?: boolean;
|
|
256
262
|
/**
|
|
257
263
|
* List of grants (permissions) applied to the role
|
|
258
264
|
*/
|
|
@@ -339,6 +345,18 @@ declare namespace Components {
|
|
|
339
345
|
operation: "equals";
|
|
340
346
|
values: any[];
|
|
341
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Check if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked.
|
|
350
|
+
*/
|
|
351
|
+
export interface EqualsCurrentUserCondition {
|
|
352
|
+
/**
|
|
353
|
+
* Optional JSON path to a specific user attribute. When omitted, all relation_user attributes on the entity are scanned.
|
|
354
|
+
* example:
|
|
355
|
+
* assignee.*.user_id
|
|
356
|
+
*/
|
|
357
|
+
attribute?: string;
|
|
358
|
+
operation: "equals_current_user";
|
|
359
|
+
}
|
|
342
360
|
/**
|
|
343
361
|
* Error response
|
|
344
362
|
*/
|
|
@@ -367,7 +385,7 @@ declare namespace Components {
|
|
|
367
385
|
/**
|
|
368
386
|
* An additional condition that must be met for the grant
|
|
369
387
|
*/
|
|
370
|
-
export type GrantCondition = /* An additional condition that must be met for the grant */ /* Check if attribute equals to any of the values */ EqualsCondition;
|
|
388
|
+
export type GrantCondition = /* An additional condition that must be met for the grant */ /* Check if attribute equals to any of the values */ EqualsCondition | /* Check if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked. */ EqualsCurrentUserCondition;
|
|
371
389
|
export interface GrantWithDependencies {
|
|
372
390
|
/**
|
|
373
391
|
* example:
|
|
@@ -534,6 +552,10 @@ declare namespace Components {
|
|
|
534
552
|
* Maximum number of users that can be assigned this role (vendor-enforced limit, can only be set via internal auth)
|
|
535
553
|
*/
|
|
536
554
|
vendor_enforced_user_limit?: number;
|
|
555
|
+
/**
|
|
556
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
557
|
+
*/
|
|
558
|
+
vendor_created?: boolean;
|
|
537
559
|
}
|
|
538
560
|
/**
|
|
539
561
|
* A role that is applied to end customers and installers using the Portals
|
|
@@ -753,6 +775,10 @@ declare namespace Components {
|
|
|
753
775
|
* 123:owner
|
|
754
776
|
*/
|
|
755
777
|
parent_role?: string;
|
|
778
|
+
/**
|
|
779
|
+
* Indicates whether this role was created by a vendor organization on behalf of the partner organization.
|
|
780
|
+
*/
|
|
781
|
+
vendor_created?: boolean;
|
|
756
782
|
}
|
|
757
783
|
}
|
|
758
784
|
}
|
|
@@ -1229,6 +1255,7 @@ type BaseRole = Components.Schemas.BaseRole;
|
|
|
1229
1255
|
type BaseRoleForCreate = Components.Schemas.BaseRoleForCreate;
|
|
1230
1256
|
type CreateRolePayload = Components.Schemas.CreateRolePayload;
|
|
1231
1257
|
type EqualsCondition = Components.Schemas.EqualsCondition;
|
|
1258
|
+
type EqualsCurrentUserCondition = Components.Schemas.EqualsCurrentUserCondition;
|
|
1232
1259
|
type Error = Components.Schemas.Error;
|
|
1233
1260
|
type Grant = Components.Schemas.Grant;
|
|
1234
1261
|
type GrantCondition = Components.Schemas.GrantCondition;
|
|
@@ -1249,4 +1276,4 @@ type Slug = Components.Schemas.Slug;
|
|
|
1249
1276
|
type UserId = Components.Schemas.UserId;
|
|
1250
1277
|
type UserRole = Components.Schemas.UserRole;
|
|
1251
1278
|
|
|
1252
|
-
export { type Assignment as A, type BaseRole as B, type Client as C, type EqualsCondition as E, type Grant as G, type InternalAssignment as I, type OperationMethods as O, Paths as P, type Role as R, type ShareRole as S, type UserId as U, Components as a, type PathsDictionary as b, type Assignments as c, type BaseRoleForCreate as d, type CreateRolePayload as e, type
|
|
1279
|
+
export { type Assignment as A, type BaseRole as B, type Client as C, type EqualsCondition as E, type Grant as G, type InternalAssignment as I, type OperationMethods as O, Paths as P, type Role as R, type ShareRole as S, type UserId as U, Components as a, type PathsDictionary as b, type Assignments as c, type BaseRoleForCreate as d, type CreateRolePayload as e, type EqualsCurrentUserCondition as f, type Error as g, type GrantCondition as h, type GrantWithDependencies as i, type OrgAssignments as j, type OrgRole as k, type OrgRoles as l, type OrganizationId as m, type PartnerRole as n, type PortalRole as o, type RoleId as p, type RolePayload as q, type RoleSearchInput as r, type Slug as s, type UserRole as t };
|
package/docs/permissions.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# Permissions API
|
|
2
2
|
|
|
3
|
-
- **Base URL:** `https://permissions.sls.epilot.io`
|
|
4
3
|
- **Full API Docs:** [https://docs.epilot.io/api/permissions](https://docs.epilot.io/api/permissions)
|
|
5
4
|
|
|
6
5
|
## Usage
|
|
@@ -45,6 +44,7 @@ const { data } = await permissionsClient.listCurrentRoles(...)
|
|
|
45
44
|
- [`Grant`](#grant)
|
|
46
45
|
- [`GrantWithDependencies`](#grantwithdependencies)
|
|
47
46
|
- [`GrantCondition`](#grantcondition)
|
|
47
|
+
- [`EqualsCurrentUserCondition`](#equalscurrentusercondition)
|
|
48
48
|
- [`EqualsCondition`](#equalscondition)
|
|
49
49
|
- [`RoleId`](#roleid)
|
|
50
50
|
- [`BaseRole`](#baserole)
|
|
@@ -105,7 +105,8 @@ const { data } = await client.listCurrentRoles()
|
|
|
105
105
|
]
|
|
106
106
|
}
|
|
107
107
|
],
|
|
108
|
-
"parent_role": "123:owner"
|
|
108
|
+
"parent_role": "123:owner",
|
|
109
|
+
"vendor_created": true
|
|
109
110
|
}
|
|
110
111
|
]
|
|
111
112
|
}
|
|
@@ -152,7 +153,8 @@ const { data } = await client.listAllRoles()
|
|
|
152
153
|
]
|
|
153
154
|
}
|
|
154
155
|
],
|
|
155
|
-
"parent_role": "123:owner"
|
|
156
|
+
"parent_role": "123:owner",
|
|
157
|
+
"vendor_created": true
|
|
156
158
|
}
|
|
157
159
|
]
|
|
158
160
|
}
|
|
@@ -200,7 +202,8 @@ const { data } = await client.createRole(
|
|
|
200
202
|
]
|
|
201
203
|
}
|
|
202
204
|
],
|
|
203
|
-
"parent_role": "123:owner"
|
|
205
|
+
"parent_role": "123:owner",
|
|
206
|
+
"vendor_created": true
|
|
204
207
|
}
|
|
205
208
|
```
|
|
206
209
|
|
|
@@ -256,7 +259,8 @@ const { data } = await client.searchRoles(
|
|
|
256
259
|
]
|
|
257
260
|
}
|
|
258
261
|
],
|
|
259
|
-
"parent_role": "123:owner"
|
|
262
|
+
"parent_role": "123:owner",
|
|
263
|
+
"vendor_created": true
|
|
260
264
|
}
|
|
261
265
|
]
|
|
262
266
|
}
|
|
@@ -303,7 +307,8 @@ const { data } = await client.getRole({
|
|
|
303
307
|
]
|
|
304
308
|
}
|
|
305
309
|
],
|
|
306
|
-
"parent_role": "123:owner"
|
|
310
|
+
"parent_role": "123:owner",
|
|
311
|
+
"vendor_created": true
|
|
307
312
|
}
|
|
308
313
|
```
|
|
309
314
|
|
|
@@ -343,7 +348,8 @@ const { data } = await client.putRole(
|
|
|
343
348
|
]
|
|
344
349
|
}
|
|
345
350
|
],
|
|
346
|
-
parent_role: '123:owner'
|
|
351
|
+
parent_role: '123:owner',
|
|
352
|
+
vendor_created: true
|
|
347
353
|
},
|
|
348
354
|
)
|
|
349
355
|
```
|
|
@@ -373,7 +379,8 @@ const { data } = await client.putRole(
|
|
|
373
379
|
]
|
|
374
380
|
}
|
|
375
381
|
],
|
|
376
|
-
"parent_role": "123:owner"
|
|
382
|
+
"parent_role": "123:owner",
|
|
383
|
+
"vendor_created": true
|
|
377
384
|
}
|
|
378
385
|
```
|
|
379
386
|
|
|
@@ -418,7 +425,8 @@ const { data } = await client.deleteRole({
|
|
|
418
425
|
]
|
|
419
426
|
}
|
|
420
427
|
],
|
|
421
|
-
"parent_role": "123:owner"
|
|
428
|
+
"parent_role": "123:owner",
|
|
429
|
+
"vendor_created": true
|
|
422
430
|
}
|
|
423
431
|
```
|
|
424
432
|
|
|
@@ -605,6 +613,17 @@ type GrantWithDependencies = {
|
|
|
605
613
|
type GrantCondition = object
|
|
606
614
|
```
|
|
607
615
|
|
|
616
|
+
### `EqualsCurrentUserCondition`
|
|
617
|
+
|
|
618
|
+
Check if any relation_user attribute on the entity contains the current user. When attribute is provided, only that specific attribute path is checked.
|
|
619
|
+
|
|
620
|
+
```ts
|
|
621
|
+
type EqualsCurrentUserCondition = {
|
|
622
|
+
attribute?: string
|
|
623
|
+
operation: "equals_current_user"
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
608
627
|
### `EqualsCondition`
|
|
609
628
|
|
|
610
629
|
Check if attribute equals to any of the values
|
|
@@ -680,6 +699,7 @@ type UserRole = {
|
|
|
680
699
|
conditions?: object[]
|
|
681
700
|
}>
|
|
682
701
|
parent_role?: object
|
|
702
|
+
vendor_created?: boolean
|
|
683
703
|
}
|
|
684
704
|
```
|
|
685
705
|
|
|
@@ -740,6 +760,7 @@ type PartnerRole = {
|
|
|
740
760
|
}>
|
|
741
761
|
partner_org_id?: object
|
|
742
762
|
vendor_enforced_user_limit?: number
|
|
763
|
+
vendor_created?: boolean
|
|
743
764
|
}
|
|
744
765
|
```
|
|
745
766
|
|
|
@@ -779,6 +800,7 @@ type Role = {
|
|
|
779
800
|
conditions?: object[]
|
|
780
801
|
}>
|
|
781
802
|
parent_role?: object
|
|
803
|
+
vendor_created?: boolean
|
|
782
804
|
} | {
|
|
783
805
|
id: string
|
|
784
806
|
name: string
|
|
@@ -821,6 +843,7 @@ type Role = {
|
|
|
821
843
|
}>
|
|
822
844
|
partner_org_id?: object
|
|
823
845
|
vendor_enforced_user_limit?: number
|
|
846
|
+
vendor_created?: boolean
|
|
824
847
|
} | {
|
|
825
848
|
id: string
|
|
826
849
|
name: string
|
|
@@ -913,6 +936,7 @@ type OrgRoles = {
|
|
|
913
936
|
conditions?: { ... }
|
|
914
937
|
}>
|
|
915
938
|
parent_role?: object
|
|
939
|
+
vendor_created?: boolean
|
|
916
940
|
} | {
|
|
917
941
|
id: string
|
|
918
942
|
name: string
|
|
@@ -955,6 +979,7 @@ type OrgRoles = {
|
|
|
955
979
|
}>
|
|
956
980
|
partner_org_id?: object
|
|
957
981
|
vendor_enforced_user_limit?: number
|
|
982
|
+
vendor_created?: boolean
|
|
958
983
|
} | {
|
|
959
984
|
id: string
|
|
960
985
|
name: string
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./chunk-YPSWSI3M.js";
|
|
2
|
-
|
|
3
|
-
// src/docs/permissions.json
|
|
4
|
-
var permissions_default = '# Permissions API\n\n- **Base URL:** `https://permissions.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/permissions](https://docs.epilot.io/api/permissions)\n\n## Usage\n\n```ts\nimport { epilot } from \'@epilot/sdk\'\n\nepilot.authorize(() => \'<token>\')\nconst { data } = await epilot.permissions.listCurrentRoles(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from \'@epilot/sdk/permissions\'\n\nconst permissionsClient = getClient()\nauthorize(permissionsClient, () => \'<token>\')\nconst { data } = await permissionsClient.listCurrentRoles(...)\n```\n\n## Operations\n\n**Roles**\n- [`listCurrentRoles`](#listcurrentroles)\n- [`listAllRoles`](#listallroles)\n- [`createRole`](#createrole)\n- [`searchRoles`](#searchroles)\n- [`getRole`](#getrole)\n- [`putRole`](#putrole)\n- [`deleteRole`](#deleterole)\n- [`refreshPermissions`](#refreshpermissions)\n\n**Assignments**\n- [`getAssignedRolesForUser`](#getassignedrolesforuser)\n- [`assignRoles`](#assignroles)\n- [`addAssignment`](#addassignment)\n- [`removeAssignment`](#removeassignment)\n- [`listAllAssignments`](#listallassignments)\n\n**Schemas**\n- [`Grant`](#grant)\n- [`GrantWithDependencies`](#grantwithdependencies)\n- [`GrantCondition`](#grantcondition)\n- [`EqualsCondition`](#equalscondition)\n- [`RoleId`](#roleid)\n- [`BaseRole`](#baserole)\n- [`BaseRoleForCreate`](#baseroleforcreate)\n- [`UserRole`](#userrole)\n- [`OrgRole`](#orgrole)\n- [`ShareRole`](#sharerole)\n- [`PartnerRole`](#partnerrole)\n- [`PortalRole`](#portalrole)\n- [`Role`](#role)\n- [`RolePayload`](#rolepayload)\n- [`Assignment`](#assignment)\n- [`InternalAssignment`](#internalassignment)\n- [`OrgAssignments`](#orgassignments)\n- [`OrgRoles`](#orgroles)\n- [`Assignments`](#assignments)\n- [`UserId`](#userid)\n- [`OrganizationId`](#organizationid)\n- [`Slug`](#slug)\n- [`RoleSearchInput`](#rolesearchinput)\n- [`CreateRolePayload`](#createrolepayload)\n- [`Error`](#error)\n\n### `listCurrentRoles`\n\nReturns roles and grants assigned to current user\n\n`GET /v1/permissions/me`\n\n```ts\nconst { data } = await client.listCurrentRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `listAllRoles`\n\nReturns list of all roles in organization\n\n`GET /v1/permissions/roles`\n\n```ts\nconst { data } = await client.listAllRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `createRole`\n\nCreate role\n\n`POST /v1/permissions/roles`\n\n```ts\nconst { data } = await client.createRole(\n null,\n {},\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `searchRoles`\n\nSearch Roles\n\n`POST /v1/permissions/roles:search`\n\n```ts\nconst { data } = await client.searchRoles(\n null,\n {\n role_ids: [\'123:manager\', \'456:owner\'],\n org_ids: [\'123\', \'456\'],\n slugs: [\'manager\', \'owner\'],\n query: \'Administrator\',\n limit: 1,\n offset: 1\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "hits": 0,\n "results": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `getRole`\n\nGet role by id\n\n`GET /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.getRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `putRole`\n\nCreate or update role\n\n`PUT /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.putRole(\n {\n roleId: \'example\',\n },\n {\n id: \'123:owner\',\n name: \'Owner\',\n slug: \'owner\',\n type: \'user_role\',\n expires_at: \'2028-07-21T17:32:28Z\',\n organization_id: \'123\',\n grants: [\n {\n action: \'entity-read\',\n resource: \'entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947\',\n effect: \'allow\',\n conditions: [\n {\n attribute: \'workflows.primary.task_name\',\n operation: \'equals\',\n values: [\'Qualification\']\n }\n ]\n }\n ],\n parent_role: \'123:owner\'\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `deleteRole`\n\nDelete role by id\n\n`DELETE /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.deleteRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `refreshPermissions`\n\nMakes sure the user has a role in the organization\n\n`GET /v1/permissions/refresh`\n\n```ts\nconst { data } = await client.refreshPermissions()\n```\n\n---\n\n### `getAssignedRolesForUser`\n\nGet list of assigned roles by user id\n\n`GET /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.getAssignedRolesForUser({\n userId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `assignRoles`\n\nAssign / unassign roles to users.\n\n`PUT /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.assignRoles(\n {\n userId: \'example\',\n },\n [\'123:owner\'],\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `addAssignment`\n\nAssign a user to a role.\n\n`POST /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.addAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `removeAssignment`\n\nRemove role assignment from user\n\n`DELETE /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.removeAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `listAllAssignments`\n\nReturns list of all assignments in organization\n\n`GET /v1/permissions/assignments`\n\n```ts\nconst { data } = await client.listAllAssignments()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "assignments": [\n {\n "user_id": "1",\n "roles": ["123:owner"]\n }\n ]\n}\n```\n\n</details>\n\n---\n\n## Schemas\n\n### `Grant`\n\n```ts\ntype Grant = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n}\n```\n\n### `GrantWithDependencies`\n\n```ts\ntype GrantWithDependencies = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `GrantCondition`\n\n```ts\ntype GrantCondition = object\n```\n\n### `EqualsCondition`\n\nCheck if attribute equals to any of the values\n\n```ts\ntype EqualsCondition = {\n attribute: string\n operation: "equals"\n values: unknown[]\n}\n```\n\n### `RoleId`\n\nFormat: `<organization_id>`:`<slug>`\n\n```ts\ntype RoleId = string\n```\n\n### `BaseRole`\n\n```ts\ntype BaseRole = {\n id: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `BaseRoleForCreate`\n\n```ts\ntype BaseRoleForCreate = {\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `UserRole`\n\n```ts\ntype UserRole = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n}\n```\n\n### `OrgRole`\n\n```ts\ntype OrgRole = {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n}\n```\n\n### `ShareRole`\n\n```ts\ntype ShareRole = {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `PartnerRole`\n\n```ts\ntype PartnerRole = {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n}\n```\n\n### `PortalRole`\n\n```ts\ntype PortalRole = {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `Role`\n\n```ts\ntype Role = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n} | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n} | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n} | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n} | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `RolePayload`\n\n```ts\ntype RolePayload = {\n grants?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignment`\n\nA role attached to an user\n\n```ts\ntype Assignment = {\n user_id?: string\n roles?: string[]\n}\n```\n\n### `InternalAssignment`\n\nA role attached to an user\n\n```ts\ntype InternalAssignment = {\n userId?: string\n roles?: string[]\n}\n```\n\n### `OrgAssignments`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgAssignments = {\n organizationId?: string\n assignments?: Array<{\n userId?: string\n roles?: string[]\n }>\n}\n```\n\n### `OrgRoles`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgRoles = {\n organizationId?: string\n roles?: Array<{\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n parent_role?: object\n } | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n pricing_tier?: string\n } | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n } | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n } | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignments`\n\nList of role ids attached to an user\n\n```ts\ntype Assignments = string[]\n```\n\n### `UserId`\n\nId of a user\n\n```ts\ntype UserId = string\n```\n\n### `OrganizationId`\n\nId of an organization\n\n```ts\ntype OrganizationId = string\n```\n\n### `Slug`\n\nSlug of a role; for a role with id = 123:manager -> 123 is org_id & manager is slug\n\n```ts\ntype Slug = string\n```\n\n### `RoleSearchInput`\n\n```ts\ntype RoleSearchInput = {\n role_ids?: string[]\n org_ids?: string[]\n slugs?: string[]\n query?: string\n limit?: number\n offset?: number\n}\n```\n\n### `CreateRolePayload`\n\n```ts\ntype CreateRolePayload = {\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n}\n```\n\n### `Error`\n\nError response\n\n```ts\ntype Error = {\n message: string\n}\n```\n';
|
|
5
|
-
export {
|
|
6
|
-
permissions_default as default
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-NJK5F5TF.cjs');
|
|
2
|
-
|
|
3
|
-
// src/docs/permissions.json
|
|
4
|
-
var permissions_default = '# Permissions API\n\n- **Base URL:** `https://permissions.sls.epilot.io`\n- **Full API Docs:** [https://docs.epilot.io/api/permissions](https://docs.epilot.io/api/permissions)\n\n## Usage\n\n```ts\nimport { epilot } from \'@epilot/sdk\'\n\nepilot.authorize(() => \'<token>\')\nconst { data } = await epilot.permissions.listCurrentRoles(...)\n```\n\n### Tree-shakeable import\n\n```ts\nimport { getClient, authorize } from \'@epilot/sdk/permissions\'\n\nconst permissionsClient = getClient()\nauthorize(permissionsClient, () => \'<token>\')\nconst { data } = await permissionsClient.listCurrentRoles(...)\n```\n\n## Operations\n\n**Roles**\n- [`listCurrentRoles`](#listcurrentroles)\n- [`listAllRoles`](#listallroles)\n- [`createRole`](#createrole)\n- [`searchRoles`](#searchroles)\n- [`getRole`](#getrole)\n- [`putRole`](#putrole)\n- [`deleteRole`](#deleterole)\n- [`refreshPermissions`](#refreshpermissions)\n\n**Assignments**\n- [`getAssignedRolesForUser`](#getassignedrolesforuser)\n- [`assignRoles`](#assignroles)\n- [`addAssignment`](#addassignment)\n- [`removeAssignment`](#removeassignment)\n- [`listAllAssignments`](#listallassignments)\n\n**Schemas**\n- [`Grant`](#grant)\n- [`GrantWithDependencies`](#grantwithdependencies)\n- [`GrantCondition`](#grantcondition)\n- [`EqualsCondition`](#equalscondition)\n- [`RoleId`](#roleid)\n- [`BaseRole`](#baserole)\n- [`BaseRoleForCreate`](#baseroleforcreate)\n- [`UserRole`](#userrole)\n- [`OrgRole`](#orgrole)\n- [`ShareRole`](#sharerole)\n- [`PartnerRole`](#partnerrole)\n- [`PortalRole`](#portalrole)\n- [`Role`](#role)\n- [`RolePayload`](#rolepayload)\n- [`Assignment`](#assignment)\n- [`InternalAssignment`](#internalassignment)\n- [`OrgAssignments`](#orgassignments)\n- [`OrgRoles`](#orgroles)\n- [`Assignments`](#assignments)\n- [`UserId`](#userid)\n- [`OrganizationId`](#organizationid)\n- [`Slug`](#slug)\n- [`RoleSearchInput`](#rolesearchinput)\n- [`CreateRolePayload`](#createrolepayload)\n- [`Error`](#error)\n\n### `listCurrentRoles`\n\nReturns roles and grants assigned to current user\n\n`GET /v1/permissions/me`\n\n```ts\nconst { data } = await client.listCurrentRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `listAllRoles`\n\nReturns list of all roles in organization\n\n`GET /v1/permissions/roles`\n\n```ts\nconst { data } = await client.listAllRoles()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "roles": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `createRole`\n\nCreate role\n\n`POST /v1/permissions/roles`\n\n```ts\nconst { data } = await client.createRole(\n null,\n {},\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `searchRoles`\n\nSearch Roles\n\n`POST /v1/permissions/roles:search`\n\n```ts\nconst { data } = await client.searchRoles(\n null,\n {\n role_ids: [\'123:manager\', \'456:owner\'],\n org_ids: [\'123\', \'456\'],\n slugs: [\'manager\', \'owner\'],\n query: \'Administrator\',\n limit: 1,\n offset: 1\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "hits": 0,\n "results": [\n {\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n }\n ]\n}\n```\n\n</details>\n\n---\n\n### `getRole`\n\nGet role by id\n\n`GET /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.getRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `putRole`\n\nCreate or update role\n\n`PUT /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.putRole(\n {\n roleId: \'example\',\n },\n {\n id: \'123:owner\',\n name: \'Owner\',\n slug: \'owner\',\n type: \'user_role\',\n expires_at: \'2028-07-21T17:32:28Z\',\n organization_id: \'123\',\n grants: [\n {\n action: \'entity-read\',\n resource: \'entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947\',\n effect: \'allow\',\n conditions: [\n {\n attribute: \'workflows.primary.task_name\',\n operation: \'equals\',\n values: [\'Qualification\']\n }\n ]\n }\n ],\n parent_role: \'123:owner\'\n },\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `deleteRole`\n\nDelete role by id\n\n`DELETE /v1/permissions/roles/{roleId}`\n\n```ts\nconst { data } = await client.deleteRole({\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "id": "123:owner",\n "name": "Owner",\n "slug": "owner",\n "type": "user_role",\n "expires_at": "2028-07-21T17:32:28Z",\n "organization_id": "123",\n "grants": [\n {\n "action": "entity-read",\n "resource": "entity:123:contact:f7c22299-ca72-4bca-8538-0a88eeefc947",\n "effect": "allow",\n "conditions": [\n {\n "attribute": "workflows.primary.task_name",\n "operation": "equals",\n "values": ["Qualification"]\n }\n ]\n }\n ],\n "parent_role": "123:owner"\n}\n```\n\n</details>\n\n---\n\n### `refreshPermissions`\n\nMakes sure the user has a role in the organization\n\n`GET /v1/permissions/refresh`\n\n```ts\nconst { data } = await client.refreshPermissions()\n```\n\n---\n\n### `getAssignedRolesForUser`\n\nGet list of assigned roles by user id\n\n`GET /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.getAssignedRolesForUser({\n userId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `assignRoles`\n\nAssign / unassign roles to users.\n\n`PUT /v1/permissions/assignments/{userId}`\n\n```ts\nconst { data } = await client.assignRoles(\n {\n userId: \'example\',\n },\n [\'123:owner\'],\n)\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n["123:owner"]\n```\n\n</details>\n\n---\n\n### `addAssignment`\n\nAssign a user to a role.\n\n`POST /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.addAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `removeAssignment`\n\nRemove role assignment from user\n\n`DELETE /v1/permissions/assignments/{userId}/{roleId}`\n\n```ts\nconst { data } = await client.removeAssignment({\n userId: \'example\',\n roleId: \'example\',\n})\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "user_id": "1",\n "roles": ["123:owner"]\n}\n```\n\n</details>\n\n---\n\n### `listAllAssignments`\n\nReturns list of all assignments in organization\n\n`GET /v1/permissions/assignments`\n\n```ts\nconst { data } = await client.listAllAssignments()\n```\n\n<details>\n<summary>Response</summary>\n\n```json\n{\n "assignments": [\n {\n "user_id": "1",\n "roles": ["123:owner"]\n }\n ]\n}\n```\n\n</details>\n\n---\n\n## Schemas\n\n### `Grant`\n\n```ts\ntype Grant = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n}\n```\n\n### `GrantWithDependencies`\n\n```ts\ntype GrantWithDependencies = {\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `GrantCondition`\n\n```ts\ntype GrantCondition = object\n```\n\n### `EqualsCondition`\n\nCheck if attribute equals to any of the values\n\n```ts\ntype EqualsCondition = {\n attribute: string\n operation: "equals"\n values: unknown[]\n}\n```\n\n### `RoleId`\n\nFormat: `<organization_id>`:`<slug>`\n\n```ts\ntype RoleId = string\n```\n\n### `BaseRole`\n\n```ts\ntype BaseRole = {\n id: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `BaseRoleForCreate`\n\n```ts\ntype BaseRoleForCreate = {\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `UserRole`\n\n```ts\ntype UserRole = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n}\n```\n\n### `OrgRole`\n\n```ts\ntype OrgRole = {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n}\n```\n\n### `ShareRole`\n\n```ts\ntype ShareRole = {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `PartnerRole`\n\n```ts\ntype PartnerRole = {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n}\n```\n\n### `PortalRole`\n\n```ts\ntype PortalRole = {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `Role`\n\n```ts\ntype Role = {\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n parent_role?: object\n} | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n pricing_tier?: string\n} | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n} | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n} | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n}\n```\n\n### `RolePayload`\n\n```ts\ntype RolePayload = {\n grants?: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n dependencies?: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignment`\n\nA role attached to an user\n\n```ts\ntype Assignment = {\n user_id?: string\n roles?: string[]\n}\n```\n\n### `InternalAssignment`\n\nA role attached to an user\n\n```ts\ntype InternalAssignment = {\n userId?: string\n roles?: string[]\n}\n```\n\n### `OrgAssignments`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgAssignments = {\n organizationId?: string\n assignments?: Array<{\n userId?: string\n roles?: string[]\n }>\n}\n```\n\n### `OrgRoles`\n\nAll roles attached to an users of an organization\n\n```ts\ntype OrgRoles = {\n organizationId?: string\n roles?: Array<{\n id: string\n name: string\n slug: string\n type: "user_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n parent_role?: object\n } | {\n id: string\n name: string\n slug: string\n type: "org_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n pricing_tier?: string\n } | {\n id: string\n name: string\n slug: string\n type: "share_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n } | {\n id: string\n name: string\n slug: string\n type: "partner_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n partner_org_id?: object\n vendor_enforced_user_limit?: number\n } | {\n id: string\n name: string\n slug: string\n type: "portal_role"\n expires_at?: string // date-time\n organization_id: string\n grants: Array<{\n action: { ... }\n resource?: { ... }\n effect?: { ... }\n conditions?: { ... }\n }>\n }>\n}\n```\n\n### `Assignments`\n\nList of role ids attached to an user\n\n```ts\ntype Assignments = string[]\n```\n\n### `UserId`\n\nId of a user\n\n```ts\ntype UserId = string\n```\n\n### `OrganizationId`\n\nId of an organization\n\n```ts\ntype OrganizationId = string\n```\n\n### `Slug`\n\nSlug of a role; for a role with id = 123:manager -> 123 is org_id & manager is slug\n\n```ts\ntype Slug = string\n```\n\n### `RoleSearchInput`\n\n```ts\ntype RoleSearchInput = {\n role_ids?: string[]\n org_ids?: string[]\n slugs?: string[]\n query?: string\n limit?: number\n offset?: number\n}\n```\n\n### `CreateRolePayload`\n\n```ts\ntype CreateRolePayload = {\n grants: Array<{\n action: string\n resource?: string\n effect?: "allow" | "deny"\n conditions?: object[]\n }>\n id?: string\n name: string\n slug: string\n type: string\n expires_at?: string // date-time\n organization_id?: string\n}\n```\n\n### `Error`\n\nError response\n\n```ts\ntype Error = {\n message: string\n}\n```\n';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = permissions_default;
|