@raystack/frontier 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -152,6 +152,22 @@ interface V1Beta1AuthenticateResponse {
152
152
  /** state is used for resuming authentication flow in applicable strategies */
153
153
  state?: string;
154
154
  }
155
+ interface V1Beta1BatchCheckPermissionBody {
156
+ /** the permission name to check. <br/> *Example:* `get` or `list` */
157
+ permission: string;
158
+ /** `namespace:uuid` or `namespace:name` of the org or project, and `namespace:urn` of a resource under a project. In case of an org/project either provide the complete namespace (app/organization) or Frontier can also parse aliases for the same as `org` or `project`. <br/> *Example:* `organization:92f69c3a-334b-4f25-90b8-4d4f3be6b825` or `app/project:project-name` or `compute/instance:92f69c3a-334b-4f25-90b8-4d4f3be6b825` */
159
+ resource?: string;
160
+ }
161
+ interface V1Beta1BatchCheckPermissionRequest {
162
+ bodies?: V1Beta1BatchCheckPermissionBody[];
163
+ }
164
+ interface V1Beta1BatchCheckPermissionResponse {
165
+ pairs?: V1Beta1BatchCheckPermissionResponsePair[];
166
+ }
167
+ interface V1Beta1BatchCheckPermissionResponsePair {
168
+ body?: V1Beta1BatchCheckPermissionBody;
169
+ status?: boolean;
170
+ }
155
171
  interface V1Beta1CheckResourcePermissionRequest {
156
172
  /** Deprecated. Use `resource` field instead. */
157
173
  objectId?: string;
@@ -670,6 +686,13 @@ interface V1Beta1Organization {
670
686
  * @example "2023-06-07T05:39:56.961Z"
671
687
  */
672
688
  updatedAt?: string;
689
+ /**
690
+ * The state of the organization (enabled or disabled).
691
+ * @example "enabled"
692
+ */
693
+ state?: string;
694
+ /** The base64 encoded image string of the organization avatar. Should be less than 2MB. */
695
+ avatar?: string;
673
696
  }
674
697
  interface V1Beta1OrganizationRequestBody {
675
698
  /** The name of the organization. The name must be unique within the entire Frontier instance. The name can contain only alphanumeric characters, dashes and underscores.<br/>*Example:*`"frontier-org1-acme"` */
@@ -678,6 +701,11 @@ interface V1Beta1OrganizationRequestBody {
678
701
  title?: string;
679
702
  /** Metadata object for organizations that can hold key value pairs defined in Organization Metaschema. The metadata object can be used to store arbitrary information about the organization such as labels, descriptions etc. The default Organization Metaschema contains labels and descripton fields. Update the Organization Metaschema to add more fields. <br/>*Example*:`{"labels": {"key": "value"}, "description": "Organization description"}` */
680
703
  metadata?: object;
704
+ /**
705
+ * The avatar is base64 encoded image data of the user. Can also be left empty. The image should be less than 200KB. Should follow the regex pattern `^data:image/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})+$`.
706
+ * @example "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAA"
707
+ */
708
+ avatar?: string;
681
709
  }
682
710
  interface V1Beta1Permission {
683
711
  id?: string;
@@ -1043,7 +1071,13 @@ interface V1Beta1User {
1043
1071
  * @example "2023-06-07T05:39:56.961Z"
1044
1072
  */
1045
1073
  updatedAt?: string;
1074
+ /**
1075
+ * The state of the user (enabled or disabled).
1076
+ * @example "enabled"
1077
+ */
1046
1078
  state?: string;
1079
+ /** The base64 encoded image string of the user avatar. Should be less than 2MB. */
1080
+ avatar?: string;
1047
1081
  }
1048
1082
  interface V1Beta1UserRequestBody {
1049
1083
  /** The name of the user. The name must be unique within the entire Frontier instance. The name can contain only alphanumeric characters, dashes and underscores and must start with a letter. If not provided, Frontier automatically generates a name from the user email. */
@@ -1054,6 +1088,11 @@ interface V1Beta1UserRequestBody {
1054
1088
  metadata?: object;
1055
1089
  /** The title can contain any UTF-8 character, used to provide a human-readable name for the user. Can also be left empty. <br/>*Example:*`"John Doe"` */
1056
1090
  title?: string;
1091
+ /**
1092
+ * The avatar is base64 encoded image data of the user. Can also be left empty. The image should be less than 200KB. Should follow the regex pattern `^data:image/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})+$`.
1093
+ * @example "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAA"
1094
+ */
1095
+ avatar?: string;
1057
1096
  }
1058
1097
  interface V1Beta1VerifyOrganizationDomainResponse {
1059
1098
  state?: string;
@@ -1323,6 +1362,16 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
1323
1362
  * @secure
1324
1363
  */
1325
1364
  frontierServiceAuthToken: (body: V1Beta1AuthTokenRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1AuthTokenResponse, RpcStatus>>;
1365
+ /**
1366
+ * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
1367
+ *
1368
+ * @tags Authz
1369
+ * @name FrontierServiceBatchCheckPermission
1370
+ * @summary Batch check
1371
+ * @request POST:/v1beta1/batchcheck
1372
+ * @secure
1373
+ */
1374
+ frontierServiceBatchCheckPermission: (body: V1Beta1BatchCheckPermissionRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1BatchCheckPermissionResponse, RpcStatus>>;
1326
1375
  /**
1327
1376
  * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
1328
1377
  *
@@ -2052,7 +2101,7 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2052
2101
  * @tags Preference
2053
2102
  * @name FrontierServiceDescribePreferences
2054
2103
  * @summary Describe preferences
2055
- * @request GET:/v1beta1/preferences/_describe
2104
+ * @request GET:/v1beta1/preferences/traits
2056
2105
  * @secure
2057
2106
  */
2058
2107
  frontierServiceDescribePreferences: (params?: RequestParams) => Promise<HttpResponse<V1Beta1DescribePreferencesResponse, RpcStatus>>;
@@ -2635,4 +2684,4 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2635
2684
 
2636
2685
  declare const FrontierClient: typeof V1Beta1;
2637
2686
 
2638
- export { FrontierClient, ProtobufAny, ProtobufNullValue, RpcStatus, V1Beta1, V1Beta1AcceptOrganizationInvitationResponse, V1Beta1AddGroupUsersResponse, V1Beta1AddOrganizationUsersResponse, V1Beta1AuditLog, V1Beta1AuditLogActor, V1Beta1AuditLogTarget, V1Beta1AuthCallbackRequest, V1Beta1AuthCallbackResponse, V1Beta1AuthLogoutResponse, V1Beta1AuthStrategy, V1Beta1AuthTokenRequest, V1Beta1AuthTokenResponse, V1Beta1AuthenticateResponse, V1Beta1CheckResourcePermissionRequest, V1Beta1CheckResourcePermissionResponse, V1Beta1CreateCurrentUserPreferencesRequest, V1Beta1CreateCurrentUserPreferencesResponse, V1Beta1CreateGroupPreferencesResponse, V1Beta1CreateGroupResponse, V1Beta1CreateMetaSchemaResponse, V1Beta1CreateOrganizationAuditLogsResponse, V1Beta1CreateOrganizationDomainResponse, V1Beta1CreateOrganizationInvitationResponse, V1Beta1CreateOrganizationPreferencesResponse, V1Beta1CreateOrganizationResponse, V1Beta1CreateOrganizationRoleResponse, V1Beta1CreatePermissionRequest, V1Beta1CreatePermissionResponse, V1Beta1CreatePolicyResponse, V1Beta1CreatePreferencesRequest, V1Beta1CreatePreferencesResponse, V1Beta1CreateProjectPreferencesResponse, V1Beta1CreateProjectResourceResponse, V1Beta1CreateProjectResponse, V1Beta1CreateRelationResponse, V1Beta1CreateRoleResponse, V1Beta1CreateServiceUserKeyResponse, V1Beta1CreateServiceUserRequest, V1Beta1CreateServiceUserResponse, V1Beta1CreateServiceUserSecretResponse, V1Beta1CreateUserPreferencesResponse, V1Beta1CreateUserResponse, V1Beta1DeleteGroupResponse, V1Beta1DeleteMetaSchemaResponse, V1Beta1DeleteOrganizationDomainResponse, V1Beta1DeleteOrganizationInvitationResponse, V1Beta1DeleteOrganizationResponse, V1Beta1DeleteOrganizationRoleResponse, V1Beta1DeletePermissionResponse, V1Beta1DeletePolicyResponse, V1Beta1DeleteProjectResourceResponse, V1Beta1DeleteProjectResponse, V1Beta1DeleteRelationResponse, V1Beta1DeleteRoleResponse, V1Beta1DeleteServiceUserKeyResponse, V1Beta1DeleteServiceUserResponse, V1Beta1DeleteServiceUserSecretResponse, V1Beta1DeleteUserResponse, V1Beta1DescribePreferencesResponse, V1Beta1DisableGroupResponse, V1Beta1DisableOrganizationResponse, V1Beta1DisableProjectResponse, V1Beta1DisableUserResponse, V1Beta1Domain, V1Beta1EnableGroupResponse, V1Beta1EnableOrganizationResponse, V1Beta1EnableProjectResponse, V1Beta1EnableUserResponse, V1Beta1GetCurrentUserResponse, V1Beta1GetGroupResponse, V1Beta1GetJWKsResponse, V1Beta1GetMetaSchemaResponse, V1Beta1GetNamespaceResponse, V1Beta1GetOrganizationAuditLogResponse, V1Beta1GetOrganizationDomainResponse, V1Beta1GetOrganizationInvitationResponse, V1Beta1GetOrganizationResponse, V1Beta1GetOrganizationRoleResponse, V1Beta1GetOrganizationsByCurrentUserResponse, V1Beta1GetOrganizationsByUserResponse, V1Beta1GetPermissionResponse, V1Beta1GetPolicyResponse, V1Beta1GetProjectResourceResponse, V1Beta1GetProjectResponse, V1Beta1GetProjectsByCurrentUserResponse, V1Beta1GetProjectsByUserResponse, V1Beta1GetRelationResponse, V1Beta1GetServiceUserKeyResponse, V1Beta1GetServiceUserResponse, V1Beta1GetUserResponse, V1Beta1Group, V1Beta1GroupRequestBody, V1Beta1Invitation, V1Beta1JSONWebKey, V1Beta1JoinOrganizationResponse, V1Beta1KeyCredential, V1Beta1ListAllOrganizationsResponse, V1Beta1ListAllUsersResponse, V1Beta1ListAuthStrategiesResponse, V1Beta1ListCurrentUserGroupsResponse, V1Beta1ListCurrentUserPreferencesResponse, V1Beta1ListGroupPreferencesResponse, V1Beta1ListGroupUsersResponse, V1Beta1ListGroupsResponse, V1Beta1ListMetaSchemasResponse, V1Beta1ListNamespacesResponse, V1Beta1ListOrganizationAdminsResponse, V1Beta1ListOrganizationAuditLogsResponse, V1Beta1ListOrganizationDomainsResponse, V1Beta1ListOrganizationGroupsResponse, V1Beta1ListOrganizationInvitationsResponse, V1Beta1ListOrganizationPreferencesResponse, V1Beta1ListOrganizationProjectsResponse, V1Beta1ListOrganizationRolesResponse, V1Beta1ListOrganizationServiceUsersResponse, V1Beta1ListOrganizationUsersResponse, V1Beta1ListOrganizationsResponse, V1Beta1ListPermissionsResponse, V1Beta1ListPoliciesResponse, V1Beta1ListPreferencesResponse, V1Beta1ListProjectAdminsResponse, V1Beta1ListProjectPreferencesResponse, V1Beta1ListProjectResourcesResponse, V1Beta1ListProjectUsersResponse, V1Beta1ListProjectsResponse, V1Beta1ListRelationsResponse, V1Beta1ListResourcesResponse, V1Beta1ListRolesResponse, V1Beta1ListServiceUserKeysResponse, V1Beta1ListServiceUserSecretsResponse, V1Beta1ListServiceUsersResponse, V1Beta1ListUserGroupsResponse, V1Beta1ListUserInvitationsResponse, V1Beta1ListUserPreferencesResponse, V1Beta1ListUsersResponse, V1Beta1MetaSchema, V1Beta1MetaSchemaRequestBody, V1Beta1Namespace, V1Beta1Organization, V1Beta1OrganizationRequestBody, V1Beta1Permission, V1Beta1PermissionRequestBody, V1Beta1Policy, V1Beta1PolicyRequestBody, V1Beta1Preference, V1Beta1PreferenceRequestBody, V1Beta1PreferenceTrait, V1Beta1Project, V1Beta1ProjectRequestBody, V1Beta1Relation, V1Beta1RelationRequestBody, V1Beta1RemoveGroupUserResponse, V1Beta1RemoveOrganizationUserResponse, V1Beta1Resource, V1Beta1ResourceRequestBody, V1Beta1Role, V1Beta1RoleRequestBody, V1Beta1SecretCredential, V1Beta1ServiceUser, V1Beta1ServiceUserKey, V1Beta1ServiceUserRequestBody, V1Beta1UpdateCurrentUserResponse, V1Beta1UpdateGroupResponse, V1Beta1UpdateMetaSchemaResponse, V1Beta1UpdateOrganizationResponse, V1Beta1UpdateOrganizationRoleResponse, V1Beta1UpdatePermissionResponse, V1Beta1UpdatePolicyResponse, V1Beta1UpdateProjectResourceResponse, V1Beta1UpdateProjectResponse, V1Beta1UpdateRoleResponse, V1Beta1UpdateUserResponse, V1Beta1User, V1Beta1UserRequestBody, V1Beta1VerifyOrganizationDomainResponse };
2687
+ export { FrontierClient, ProtobufAny, ProtobufNullValue, RpcStatus, V1Beta1, V1Beta1AcceptOrganizationInvitationResponse, V1Beta1AddGroupUsersResponse, V1Beta1AddOrganizationUsersResponse, V1Beta1AuditLog, V1Beta1AuditLogActor, V1Beta1AuditLogTarget, V1Beta1AuthCallbackRequest, V1Beta1AuthCallbackResponse, V1Beta1AuthLogoutResponse, V1Beta1AuthStrategy, V1Beta1AuthTokenRequest, V1Beta1AuthTokenResponse, V1Beta1AuthenticateResponse, V1Beta1BatchCheckPermissionBody, V1Beta1BatchCheckPermissionRequest, V1Beta1BatchCheckPermissionResponse, V1Beta1BatchCheckPermissionResponsePair, V1Beta1CheckResourcePermissionRequest, V1Beta1CheckResourcePermissionResponse, V1Beta1CreateCurrentUserPreferencesRequest, V1Beta1CreateCurrentUserPreferencesResponse, V1Beta1CreateGroupPreferencesResponse, V1Beta1CreateGroupResponse, V1Beta1CreateMetaSchemaResponse, V1Beta1CreateOrganizationAuditLogsResponse, V1Beta1CreateOrganizationDomainResponse, V1Beta1CreateOrganizationInvitationResponse, V1Beta1CreateOrganizationPreferencesResponse, V1Beta1CreateOrganizationResponse, V1Beta1CreateOrganizationRoleResponse, V1Beta1CreatePermissionRequest, V1Beta1CreatePermissionResponse, V1Beta1CreatePolicyResponse, V1Beta1CreatePreferencesRequest, V1Beta1CreatePreferencesResponse, V1Beta1CreateProjectPreferencesResponse, V1Beta1CreateProjectResourceResponse, V1Beta1CreateProjectResponse, V1Beta1CreateRelationResponse, V1Beta1CreateRoleResponse, V1Beta1CreateServiceUserKeyResponse, V1Beta1CreateServiceUserRequest, V1Beta1CreateServiceUserResponse, V1Beta1CreateServiceUserSecretResponse, V1Beta1CreateUserPreferencesResponse, V1Beta1CreateUserResponse, V1Beta1DeleteGroupResponse, V1Beta1DeleteMetaSchemaResponse, V1Beta1DeleteOrganizationDomainResponse, V1Beta1DeleteOrganizationInvitationResponse, V1Beta1DeleteOrganizationResponse, V1Beta1DeleteOrganizationRoleResponse, V1Beta1DeletePermissionResponse, V1Beta1DeletePolicyResponse, V1Beta1DeleteProjectResourceResponse, V1Beta1DeleteProjectResponse, V1Beta1DeleteRelationResponse, V1Beta1DeleteRoleResponse, V1Beta1DeleteServiceUserKeyResponse, V1Beta1DeleteServiceUserResponse, V1Beta1DeleteServiceUserSecretResponse, V1Beta1DeleteUserResponse, V1Beta1DescribePreferencesResponse, V1Beta1DisableGroupResponse, V1Beta1DisableOrganizationResponse, V1Beta1DisableProjectResponse, V1Beta1DisableUserResponse, V1Beta1Domain, V1Beta1EnableGroupResponse, V1Beta1EnableOrganizationResponse, V1Beta1EnableProjectResponse, V1Beta1EnableUserResponse, V1Beta1GetCurrentUserResponse, V1Beta1GetGroupResponse, V1Beta1GetJWKsResponse, V1Beta1GetMetaSchemaResponse, V1Beta1GetNamespaceResponse, V1Beta1GetOrganizationAuditLogResponse, V1Beta1GetOrganizationDomainResponse, V1Beta1GetOrganizationInvitationResponse, V1Beta1GetOrganizationResponse, V1Beta1GetOrganizationRoleResponse, V1Beta1GetOrganizationsByCurrentUserResponse, V1Beta1GetOrganizationsByUserResponse, V1Beta1GetPermissionResponse, V1Beta1GetPolicyResponse, V1Beta1GetProjectResourceResponse, V1Beta1GetProjectResponse, V1Beta1GetProjectsByCurrentUserResponse, V1Beta1GetProjectsByUserResponse, V1Beta1GetRelationResponse, V1Beta1GetServiceUserKeyResponse, V1Beta1GetServiceUserResponse, V1Beta1GetUserResponse, V1Beta1Group, V1Beta1GroupRequestBody, V1Beta1Invitation, V1Beta1JSONWebKey, V1Beta1JoinOrganizationResponse, V1Beta1KeyCredential, V1Beta1ListAllOrganizationsResponse, V1Beta1ListAllUsersResponse, V1Beta1ListAuthStrategiesResponse, V1Beta1ListCurrentUserGroupsResponse, V1Beta1ListCurrentUserPreferencesResponse, V1Beta1ListGroupPreferencesResponse, V1Beta1ListGroupUsersResponse, V1Beta1ListGroupsResponse, V1Beta1ListMetaSchemasResponse, V1Beta1ListNamespacesResponse, V1Beta1ListOrganizationAdminsResponse, V1Beta1ListOrganizationAuditLogsResponse, V1Beta1ListOrganizationDomainsResponse, V1Beta1ListOrganizationGroupsResponse, V1Beta1ListOrganizationInvitationsResponse, V1Beta1ListOrganizationPreferencesResponse, V1Beta1ListOrganizationProjectsResponse, V1Beta1ListOrganizationRolesResponse, V1Beta1ListOrganizationServiceUsersResponse, V1Beta1ListOrganizationUsersResponse, V1Beta1ListOrganizationsResponse, V1Beta1ListPermissionsResponse, V1Beta1ListPoliciesResponse, V1Beta1ListPreferencesResponse, V1Beta1ListProjectAdminsResponse, V1Beta1ListProjectPreferencesResponse, V1Beta1ListProjectResourcesResponse, V1Beta1ListProjectUsersResponse, V1Beta1ListProjectsResponse, V1Beta1ListRelationsResponse, V1Beta1ListResourcesResponse, V1Beta1ListRolesResponse, V1Beta1ListServiceUserKeysResponse, V1Beta1ListServiceUserSecretsResponse, V1Beta1ListServiceUsersResponse, V1Beta1ListUserGroupsResponse, V1Beta1ListUserInvitationsResponse, V1Beta1ListUserPreferencesResponse, V1Beta1ListUsersResponse, V1Beta1MetaSchema, V1Beta1MetaSchemaRequestBody, V1Beta1Namespace, V1Beta1Organization, V1Beta1OrganizationRequestBody, V1Beta1Permission, V1Beta1PermissionRequestBody, V1Beta1Policy, V1Beta1PolicyRequestBody, V1Beta1Preference, V1Beta1PreferenceRequestBody, V1Beta1PreferenceTrait, V1Beta1Project, V1Beta1ProjectRequestBody, V1Beta1Relation, V1Beta1RelationRequestBody, V1Beta1RemoveGroupUserResponse, V1Beta1RemoveOrganizationUserResponse, V1Beta1Resource, V1Beta1ResourceRequestBody, V1Beta1Role, V1Beta1RoleRequestBody, V1Beta1SecretCredential, V1Beta1ServiceUser, V1Beta1ServiceUserKey, V1Beta1ServiceUserRequestBody, V1Beta1UpdateCurrentUserResponse, V1Beta1UpdateGroupResponse, V1Beta1UpdateMetaSchemaResponse, V1Beta1UpdateOrganizationResponse, V1Beta1UpdateOrganizationRoleResponse, V1Beta1UpdatePermissionResponse, V1Beta1UpdatePolicyResponse, V1Beta1UpdateProjectResourceResponse, V1Beta1UpdateProjectResponse, V1Beta1UpdateRoleResponse, V1Beta1UpdateUserResponse, V1Beta1User, V1Beta1UserRequestBody, V1Beta1VerifyOrganizationDomainResponse };
package/dist/index.js CHANGED
@@ -446,6 +446,23 @@ var V1Beta1 = class extends HttpClient {
446
446
  type: "application/json" /* Json */,
447
447
  format: "json"
448
448
  }, params));
449
+ /**
450
+ * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
451
+ *
452
+ * @tags Authz
453
+ * @name FrontierServiceBatchCheckPermission
454
+ * @summary Batch check
455
+ * @request POST:/v1beta1/batchcheck
456
+ * @secure
457
+ */
458
+ this.frontierServiceBatchCheckPermission = (body, params = {}) => this.request(__spreadValues({
459
+ path: `/v1beta1/batchcheck`,
460
+ method: "POST",
461
+ body,
462
+ secure: true,
463
+ type: "application/json" /* Json */,
464
+ format: "json"
465
+ }, params));
449
466
  /**
450
467
  * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
451
468
  *
@@ -1486,11 +1503,11 @@ var V1Beta1 = class extends HttpClient {
1486
1503
  * @tags Preference
1487
1504
  * @name FrontierServiceDescribePreferences
1488
1505
  * @summary Describe preferences
1489
- * @request GET:/v1beta1/preferences/_describe
1506
+ * @request GET:/v1beta1/preferences/traits
1490
1507
  * @secure
1491
1508
  */
1492
1509
  this.frontierServiceDescribePreferences = (params = {}) => this.request(__spreadValues({
1493
- path: `/v1beta1/preferences/_describe`,
1510
+ path: `/v1beta1/preferences/traits`,
1494
1511
  method: "GET",
1495
1512
  secure: true,
1496
1513
  format: "json"
package/dist/index.mjs CHANGED
@@ -421,6 +421,23 @@ var V1Beta1 = class extends HttpClient {
421
421
  type: "application/json" /* Json */,
422
422
  format: "json"
423
423
  }, params));
424
+ /**
425
+ * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
426
+ *
427
+ * @tags Authz
428
+ * @name FrontierServiceBatchCheckPermission
429
+ * @summary Batch check
430
+ * @request POST:/v1beta1/batchcheck
431
+ * @secure
432
+ */
433
+ this.frontierServiceBatchCheckPermission = (body, params = {}) => this.request(__spreadValues({
434
+ path: `/v1beta1/batchcheck`,
435
+ method: "POST",
436
+ body,
437
+ secure: true,
438
+ type: "application/json" /* Json */,
439
+ format: "json"
440
+ }, params));
424
441
  /**
425
442
  * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
426
443
  *
@@ -1461,11 +1478,11 @@ var V1Beta1 = class extends HttpClient {
1461
1478
  * @tags Preference
1462
1479
  * @name FrontierServiceDescribePreferences
1463
1480
  * @summary Describe preferences
1464
- * @request GET:/v1beta1/preferences/_describe
1481
+ * @request GET:/v1beta1/preferences/traits
1465
1482
  * @secure
1466
1483
  */
1467
1484
  this.frontierServiceDescribePreferences = (params = {}) => this.request(__spreadValues({
1468
- path: `/v1beta1/preferences/_describe`,
1485
+ path: `/v1beta1/preferences/traits`,
1469
1486
  method: "GET",
1470
1487
  secure: true,
1471
1488
  format: "json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raystack/frontier",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A js library for frontier",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -55,6 +55,7 @@
55
55
  "@types/node": "^20.4.5",
56
56
  "@types/react": "^18.2.5",
57
57
  "@types/react-dom": "^18.2.7",
58
+ "esbuild-css-modules-plugin": "^2.7.1",
58
59
  "esbuild-plugin-external-global": "^1.0.1",
59
60
  "eslint": "^7.32.0",
60
61
  "eslint-config-frontier": "workspace:^",
@@ -67,10 +68,12 @@
67
68
  },
68
69
  "dependencies": {
69
70
  "@hookform/resolvers": "^3.1.1",
70
- "@raystack/apsara": "0.10.8",
71
+ "@raystack/apsara": "0.11.0",
72
+ "@tanstack/react-router": "0.0.1-beta.174",
71
73
  "axios": "^1.4.0",
74
+ "class-variance-authority": "^0.7.0",
72
75
  "react-hook-form": "^7.45.2",
73
- "react-router-dom": "^6.14.2",
76
+ "react-loading-skeleton": "^3.3.1",
74
77
  "sonner": "^0.6.2",
75
78
  "yup": "^1.2.0"
76
79
  },
@@ -1,4 +1,6 @@
1
1
  import React$1, { ComponentPropsWithRef, Dispatch, SetStateAction } from 'react';
2
+ import * as _tanstack_router_core from '@tanstack/router-core';
3
+ import { Router, Route, RootRoute } from '@tanstack/react-router';
2
4
 
3
5
  type ContainerProps = ComponentPropsWithRef<'div'> & {
4
6
  children?: React$1.ReactNode;
@@ -8,6 +10,12 @@ type ContainerProps = ComponentPropsWithRef<'div'> & {
8
10
  };
9
11
  declare const Container: ({ children, shadow, radius, style, className }: ContainerProps) => JSX.Element;
10
12
 
13
+ type HeaderProps = ComponentPropsWithRef<'div'> & {
14
+ title?: string;
15
+ logo?: React$1.ReactNode;
16
+ };
17
+ declare const Header: ({ title, logo }: HeaderProps) => JSX.Element;
18
+
11
19
  type MagicLinkVerifyProps = ComponentPropsWithRef<typeof Container> & {
12
20
  logo?: React$1.ReactNode;
13
21
  title?: string;
@@ -38,7 +46,13 @@ interface OrganizationProfileProps {
38
46
  organizationId: string;
39
47
  defaultRoute?: string;
40
48
  }
49
+ declare const router: Router<Route<any, "/", "/", string, "__root__", unknown, {}, {}, {}, {}, {}, {}, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, {}, (Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/", "/", string, "/", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/", "/", string, "/", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/delete", "/delete", string, "/delete", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/security", "/security", string, "/security", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/members", "/members", string, "/members", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/members", "/members", string, "/members", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/modal", "/members/modal", string, "/members/modal", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/teams", "/teams", string, "/teams", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/teams", "/teams", string, "/teams", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/modal", "/teams/modal", string, "/teams/modal", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/domains", "/domains", string, "/domains", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, (Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/domains", "/domains", string, "/domains", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/modal", "/domains/modal", string, "/domains/modal", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute> | Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/domains", "/domains", string, "/domains", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/$domainId/verify", "/domains/$domainId/verify", string, "/domains/$domainId/verify", unknown, {}, {}, Record<"domainId", string>, Record<never, string> & Record<"domainId", string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>)[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/teams/$teamId", "/teams/$teamId", string, "/teams/$teamId", unknown, {}, {}, Record<"teamId", string>, Record<"teamId", string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/teams/$teamId", "/teams/$teamId", string, "/teams/$teamId", unknown, {}, {}, Record<"teamId", string>, Record<"teamId", string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/delete", "/teams/$teamId/delete", string, "/teams/$teamId/delete", unknown, {}, {}, Record<never, string>, Record<"teamId", string> & Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/projects", "/projects", string, "/projects", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/projects", "/projects", string, "/projects", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/modal", "/projects/modal", string, "/projects/modal", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/projects/$projectId", "/projects/$projectId", string, "/projects/$projectId", unknown, {}, {}, Record<"projectId", string>, Record<"projectId", string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, Route<Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/projects/$projectId", "/projects/$projectId", string, "/projects/$projectId", unknown, {}, {}, Record<"projectId", string>, Record<"projectId", string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>, "/delete", "/projects/$projectId/delete", string, "/projects/$projectId/delete", unknown, {}, {}, Record<never, string>, Record<"projectId", string> & Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>[], _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/profile", "/profile", string, "/profile", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute> | Route<RootRoute<unknown, {}, _tanstack_router_core.RouteContext, {}>, "/perferences", "/perferences", string, "/perferences", unknown, {}, {}, Record<never, string>, Record<never, string>, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.RouteContext, _tanstack_router_core.AnyContext, unknown, _tanstack_router_core.AnyRoute>)[], any>, Record<string, any>>;
41
50
  declare const OrganizationProfile: ({ organizationId, defaultRoute }: OrganizationProfileProps) => JSX.Element;
51
+ declare module '@tanstack/react-router' {
52
+ interface Register {
53
+ router: typeof router;
54
+ }
55
+ }
42
56
 
43
57
  interface WindowProps extends React.HTMLAttributes<HTMLDialogElement> {
44
58
  open?: boolean;
@@ -200,6 +214,22 @@ interface V1Beta1AuthenticateResponse {
200
214
  /** state is used for resuming authentication flow in applicable strategies */
201
215
  state?: string;
202
216
  }
217
+ interface V1Beta1BatchCheckPermissionBody {
218
+ /** the permission name to check. <br/> *Example:* `get` or `list` */
219
+ permission: string;
220
+ /** `namespace:uuid` or `namespace:name` of the org or project, and `namespace:urn` of a resource under a project. In case of an org/project either provide the complete namespace (app/organization) or Frontier can also parse aliases for the same as `org` or `project`. <br/> *Example:* `organization:92f69c3a-334b-4f25-90b8-4d4f3be6b825` or `app/project:project-name` or `compute/instance:92f69c3a-334b-4f25-90b8-4d4f3be6b825` */
221
+ resource?: string;
222
+ }
223
+ interface V1Beta1BatchCheckPermissionRequest {
224
+ bodies?: V1Beta1BatchCheckPermissionBody[];
225
+ }
226
+ interface V1Beta1BatchCheckPermissionResponse {
227
+ pairs?: V1Beta1BatchCheckPermissionResponsePair[];
228
+ }
229
+ interface V1Beta1BatchCheckPermissionResponsePair {
230
+ body?: V1Beta1BatchCheckPermissionBody;
231
+ status?: boolean;
232
+ }
203
233
  interface V1Beta1CheckResourcePermissionRequest {
204
234
  /** Deprecated. Use `resource` field instead. */
205
235
  objectId?: string;
@@ -692,6 +722,13 @@ interface V1Beta1Organization {
692
722
  * @example "2023-06-07T05:39:56.961Z"
693
723
  */
694
724
  updatedAt?: string;
725
+ /**
726
+ * The state of the organization (enabled or disabled).
727
+ * @example "enabled"
728
+ */
729
+ state?: string;
730
+ /** The base64 encoded image string of the organization avatar. Should be less than 2MB. */
731
+ avatar?: string;
695
732
  }
696
733
  interface V1Beta1OrganizationRequestBody {
697
734
  /** The name of the organization. The name must be unique within the entire Frontier instance. The name can contain only alphanumeric characters, dashes and underscores.<br/>*Example:*`"frontier-org1-acme"` */
@@ -700,6 +737,11 @@ interface V1Beta1OrganizationRequestBody {
700
737
  title?: string;
701
738
  /** Metadata object for organizations that can hold key value pairs defined in Organization Metaschema. The metadata object can be used to store arbitrary information about the organization such as labels, descriptions etc. The default Organization Metaschema contains labels and descripton fields. Update the Organization Metaschema to add more fields. <br/>*Example*:`{"labels": {"key": "value"}, "description": "Organization description"}` */
702
739
  metadata?: object;
740
+ /**
741
+ * The avatar is base64 encoded image data of the user. Can also be left empty. The image should be less than 200KB. Should follow the regex pattern `^data:image/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})+$`.
742
+ * @example "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAA"
743
+ */
744
+ avatar?: string;
703
745
  }
704
746
  interface V1Beta1Permission {
705
747
  id?: string;
@@ -1063,7 +1105,13 @@ interface V1Beta1User {
1063
1105
  * @example "2023-06-07T05:39:56.961Z"
1064
1106
  */
1065
1107
  updatedAt?: string;
1108
+ /**
1109
+ * The state of the user (enabled or disabled).
1110
+ * @example "enabled"
1111
+ */
1066
1112
  state?: string;
1113
+ /** The base64 encoded image string of the user avatar. Should be less than 2MB. */
1114
+ avatar?: string;
1067
1115
  }
1068
1116
  interface V1Beta1UserRequestBody {
1069
1117
  /** The name of the user. The name must be unique within the entire Frontier instance. The name can contain only alphanumeric characters, dashes and underscores and must start with a letter. If not provided, Frontier automatically generates a name from the user email. */
@@ -1074,6 +1122,11 @@ interface V1Beta1UserRequestBody {
1074
1122
  metadata?: object;
1075
1123
  /** The title can contain any UTF-8 character, used to provide a human-readable name for the user. Can also be left empty. <br/>*Example:*`"John Doe"` */
1076
1124
  title?: string;
1125
+ /**
1126
+ * The avatar is base64 encoded image data of the user. Can also be left empty. The image should be less than 200KB. Should follow the regex pattern `^data:image/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})+$`.
1127
+ * @example "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAA"
1128
+ */
1129
+ avatar?: string;
1077
1130
  }
1078
1131
  interface V1Beta1VerifyOrganizationDomainResponse {
1079
1132
  state?: string;
@@ -1343,6 +1396,16 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
1343
1396
  * @secure
1344
1397
  */
1345
1398
  frontierServiceAuthToken: (body: V1Beta1AuthTokenRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1AuthTokenResponse, RpcStatus>>;
1399
+ /**
1400
+ * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
1401
+ *
1402
+ * @tags Authz
1403
+ * @name FrontierServiceBatchCheckPermission
1404
+ * @summary Batch check
1405
+ * @request POST:/v1beta1/batchcheck
1406
+ * @secure
1407
+ */
1408
+ frontierServiceBatchCheckPermission: (body: V1Beta1BatchCheckPermissionRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1BatchCheckPermissionResponse, RpcStatus>>;
1346
1409
  /**
1347
1410
  * @description Returns true if a principal has required permissions to access a resource and false otherwise.<br/> Note the principal can be a user or a service account, and Frontier will the credentials from the current logged in principal from the session cookie (if any), or the client id and secret (in case of service users) or the access token (in case of human user accounts).
1348
1411
  *
@@ -2072,7 +2135,7 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2072
2135
  * @tags Preference
2073
2136
  * @name FrontierServiceDescribePreferences
2074
2137
  * @summary Describe preferences
2075
- * @request GET:/v1beta1/preferences/_describe
2138
+ * @request GET:/v1beta1/preferences/traits
2076
2139
  * @secure
2077
2140
  */
2078
2141
  frontierServiceDescribePreferences: (params?: RequestParams) => Promise<HttpResponse<V1Beta1DescribePreferencesResponse, RpcStatus>>;
@@ -2664,6 +2727,12 @@ interface FrontierContextProviderProps {
2664
2727
  setStrategies: Dispatch<SetStateAction<V1Beta1AuthStrategy[]>>;
2665
2728
  user: V1Beta1User | undefined;
2666
2729
  setUser: Dispatch<SetStateAction<V1Beta1User | undefined>>;
2730
+ activeOrganization: V1Beta1Organization | undefined;
2731
+ setActiveOrganization: Dispatch<SetStateAction<V1Beta1Organization | undefined>>;
2732
+ isActiveOrganizationLoading: boolean;
2733
+ setIsActiveOrganizationLoading: Dispatch<SetStateAction<boolean>>;
2734
+ isUserLoading: boolean;
2735
+ setIsUserLoading: Dispatch<SetStateAction<boolean>>;
2667
2736
  }
2668
2737
  declare function useFrontier(): FrontierContextProviderProps;
2669
2738
 
@@ -2672,4 +2741,4 @@ declare const FrontierProvider: {
2672
2741
  displayName: string;
2673
2742
  };
2674
2743
 
2675
- export { Container, CreateOrganization, FrontierProvider, MagicLinkVerify, OrganizationProfile, SignIn, SignUp, Window, useFrontier };
2744
+ export { Container, CreateOrganization, FrontierProvider, Header, MagicLinkVerify, OrganizationProfile, SignIn, SignUp, Window, useFrontier };