@parra/parra-js-sdk 0.2.41 → 0.2.42

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.
@@ -1,4 +1,13 @@
1
1
  import { HTTPClient } from "@parra/http-client";
2
+ export interface AuthorizationCheckRequestBody {
3
+ namespace: string;
4
+ subject: string;
5
+ scope: string;
6
+ context?: Map<string, any>;
7
+ }
8
+ export interface AuthorizationCheck {
9
+ allowed: boolean;
10
+ }
2
11
  export interface CreateCheckoutSessionRequestBody {
3
12
  plan_id: string;
4
13
  }
@@ -98,6 +107,16 @@ export interface CreateTenantRequestBody {
98
107
  name: string;
99
108
  is_test: boolean;
100
109
  }
110
+ export interface TenantUser {
111
+ id: string;
112
+ created_at: string;
113
+ updated_at: string;
114
+ deleted_at?: string | null;
115
+ name: string;
116
+ is_test: boolean;
117
+ entitlements?: Array<Entitlement> | null;
118
+ scopes: Array<string>;
119
+ }
101
120
  export interface Tenant {
102
121
  id: string;
103
122
  created_at: string;
@@ -147,6 +166,9 @@ export interface ApiKeyCollectionResponse {
147
166
  }
148
167
  export interface AnswerData {
149
168
  }
169
+ export interface FeedbackMetrics {
170
+ questions_asked_this_month: number;
171
+ }
150
172
  export interface Answer {
151
173
  id: string;
152
174
  created_at: string;
@@ -379,6 +401,12 @@ export interface UserCollectionResponse {
379
401
  total_count: number;
380
402
  data: Array<UserResponse>;
381
403
  }
404
+ export interface CheckAuthorizationRequestBody {
405
+ scope: string;
406
+ }
407
+ export interface CheckAuthorization {
408
+ allowed: boolean;
409
+ }
382
410
  export interface UserInfoResponse {
383
411
  user?: UserResponse | null;
384
412
  }
@@ -396,7 +424,6 @@ declare class ParraAPI {
396
424
  getTenantById: (tenant_id: string) => Promise<Tenant>;
397
425
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
398
426
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
399
- getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
400
427
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
401
428
  getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
402
429
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
@@ -435,6 +462,7 @@ declare class ParraAPI {
435
462
  createIdentityForUserById: (user_id: string, body: CreateIdentityRequestBody) => Promise<IdentityResponse>;
436
463
  listIdentitiesForUserById: (user_id: string) => Promise<Array<IdentityResponse>>;
437
464
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
465
+ checkAuthorization: (body?: CheckAuthorizationRequestBody | undefined) => Promise<CheckAuthorization>;
438
466
  getUserInfo: () => Promise<UserInfoResponse>;
439
467
  }
440
468
  export default ParraAPI;
package/dist/ParraAPI.js CHANGED
@@ -97,11 +97,6 @@ var ParraAPI = /** @class */ (function () {
97
97
  method: "get",
98
98
  });
99
99
  };
100
- this.getTenantByUserIdAndTenantId = function (user_id, tenant_id) {
101
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/tenants/" + tenant_id, {
102
- method: "get",
103
- });
104
- };
105
100
  this.createApiKeyForTenantById = function (tenant_id, body) {
106
101
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys", {
107
102
  method: "post",
@@ -246,6 +241,15 @@ var ParraAPI = /** @class */ (function () {
246
241
  method: "get",
247
242
  });
248
243
  };
244
+ this.checkAuthorization = function (body) {
245
+ return _this.http.execute(_this.options.baseUrl + "/v1/tenants/authorization/check", {
246
+ method: "post",
247
+ body: JSON.stringify(body),
248
+ headers: {
249
+ "content-type": "application/json",
250
+ },
251
+ });
252
+ };
249
253
  this.getUserInfo = function () {
250
254
  return _this.http.execute(_this.options.baseUrl + "/v1/user-info", {
251
255
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",