@credal/sdk 0.1.3 → 0.1.5
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/cjs/Client.d.ts +0 -3
- package/dist/cjs/Client.js +6 -11
- package/dist/cjs/api/resources/{permissionsService/types/Group.d.ts → common/types/CustomMetadataValue.d.ts} +1 -4
- package/dist/cjs/api/resources/common/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/common/types/index.js +1 -0
- package/dist/cjs/api/resources/copilots/client/Client.js +9 -9
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +3 -3
- package/dist/cjs/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.ts +5 -2
- package/dist/cjs/api/resources/documentCollections/client/Client.js +7 -7
- package/dist/cjs/api/resources/index.d.ts +0 -3
- package/dist/cjs/api/resources/index.js +1 -4
- package/dist/cjs/api/resources/search/client/Client.js +1 -1
- package/dist/cjs/api/resources/users/client/Client.js +1 -1
- package/dist/cjs/core/auth/index.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.js +2 -2
- package/dist/cjs/core/fetcher/index.d.ts +5 -5
- package/dist/cjs/core/fetcher/index.js +5 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +0 -3
- package/dist/esm/Client.mjs +2 -7
- package/dist/esm/api/resources/{permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.d.mts} +1 -1
- package/dist/esm/api/resources/common/types/index.d.mts +1 -0
- package/dist/esm/api/resources/common/types/index.mjs +1 -0
- package/dist/esm/api/resources/copilots/client/Client.mjs +9 -9
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +3 -3
- package/dist/esm/api/resources/documentCatalog/client/requests/UploadDocumentContentsRequest.d.mts +5 -2
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +7 -7
- package/dist/esm/api/resources/index.d.mts +0 -3
- package/dist/esm/api/resources/index.mjs +0 -3
- package/dist/esm/api/resources/search/client/Client.mjs +1 -1
- package/dist/esm/api/resources/users/client/Client.mjs +1 -1
- package/dist/esm/core/auth/index.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
- package/dist/esm/core/fetcher/index.d.mts +5 -5
- package/dist/esm/core/fetcher/index.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +0 -213
- package/dist/cjs/api/resources/permissionsService/client/Client.d.ts +0 -86
- package/dist/cjs/api/resources/permissionsService/client/Client.js +0 -260
- package/dist/cjs/api/resources/permissionsService/client/index.d.ts +0 -2
- package/dist/cjs/api/resources/permissionsService/client/index.js +0 -17
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.ts +0 -26
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.ts +0 -23
- package/dist/cjs/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.js +0 -5
- package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.ts +0 -20
- package/dist/cjs/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.js +0 -5
- package/dist/cjs/api/resources/permissionsService/client/requests/index.d.ts +0 -3
- package/dist/cjs/api/resources/permissionsService/client/requests/index.js +0 -2
- package/dist/cjs/api/resources/permissionsService/index.d.ts +0 -2
- package/dist/cjs/api/resources/permissionsService/index.js +0 -18
- package/dist/cjs/api/resources/permissionsService/types/Action.d.ts +0 -7
- package/dist/cjs/api/resources/permissionsService/types/Action.js +0 -9
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResource.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.d.ts +0 -5
- package/dist/cjs/api/resources/permissionsService/types/AuthorizedResourceListPage.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.ts +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.ts +0 -6
- package/dist/cjs/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/Group.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/Principal.d.ts +0 -13
- package/dist/cjs/api/resources/permissionsService/types/Principal.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/PrincipalListPage.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.d.ts +0 -9
- package/dist/cjs/api/resources/permissionsService/types/ResourceAuthorizationResult.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/User.d.ts +0 -8
- package/dist/cjs/api/resources/permissionsService/types/User.js +0 -5
- package/dist/cjs/api/resources/permissionsService/types/index.d.ts +0 -10
- package/dist/cjs/api/resources/permissionsService/types/index.js +0 -26
- package/dist/esm/api/resources/permissionsService/client/Client.d.mts +0 -86
- package/dist/esm/api/resources/permissionsService/client/Client.mjs +0 -223
- package/dist/esm/api/resources/permissionsService/client/index.d.mts +0 -2
- package/dist/esm/api/resources/permissionsService/client/index.mjs +0 -1
- package/dist/esm/api/resources/permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.d.mts +0 -26
- package/dist/esm/api/resources/permissionsService/client/requests/CheckResourceAuthorizationForUserRequest.d.mts +0 -23
- package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.d.mts +0 -20
- package/dist/esm/api/resources/permissionsService/client/requests/ListCachedAuthorizedResourcesForUserRequest.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/client/requests/index.d.mts +0 -3
- package/dist/esm/api/resources/permissionsService/client/requests/index.mjs +0 -1
- package/dist/esm/api/resources/permissionsService/index.d.mts +0 -2
- package/dist/esm/api/resources/permissionsService/index.mjs +0 -2
- package/dist/esm/api/resources/permissionsService/types/Action.d.mts +0 -7
- package/dist/esm/api/resources/permissionsService/types/Action.mjs +0 -6
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResource.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.d.mts +0 -5
- package/dist/esm/api/resources/permissionsService/types/AuthorizedResourceListPage.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.d.mts +0 -5
- package/dist/esm/api/resources/permissionsService/types/CheckBulkResourcesAuthorizationResponse.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.d.mts +0 -6
- package/dist/esm/api/resources/permissionsService/types/CheckResourceAuthorizationResponse.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/Group.d.mts +0 -7
- package/dist/esm/api/resources/permissionsService/types/Group.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/Principal.d.mts +0 -13
- package/dist/esm/api/resources/permissionsService/types/Principal.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/PrincipalListPage.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.d.mts +0 -9
- package/dist/esm/api/resources/permissionsService/types/ResourceAuthorizationResult.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/User.d.mts +0 -8
- package/dist/esm/api/resources/permissionsService/types/User.mjs +0 -4
- package/dist/esm/api/resources/permissionsService/types/index.d.mts +0 -10
- package/dist/esm/api/resources/permissionsService/types/index.mjs +0 -10
- /package/dist/cjs/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.js → common/types/CustomMetadataValue.js} +0 -0
- /package/dist/esm/api/resources/{permissionsService/client/requests/CheckBulkResourcesAuthorizationForUserRequest.mjs → common/types/CustomMetadataValue.mjs} +0 -0
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.PermissionsService = void 0;
|
|
49
|
-
const environments = __importStar(require("../../../../environments.js"));
|
|
50
|
-
const core = __importStar(require("../../../../core/index.js"));
|
|
51
|
-
const headers_js_1 = require("../../../../core/headers.js");
|
|
52
|
-
const errors = __importStar(require("../../../../errors/index.js"));
|
|
53
|
-
class PermissionsService {
|
|
54
|
-
constructor(_options = {}) {
|
|
55
|
-
this._options = _options;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Admin endpoint to check whether the specified user is authorized to read the specified resource.
|
|
59
|
-
*
|
|
60
|
-
* @param {Credal.CheckResourceAuthorizationForUserRequest} request
|
|
61
|
-
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* await client.permissionsService.checkResourceAuthorizationForUser({
|
|
65
|
-
* resourceIdentifier: {
|
|
66
|
-
* type: "external-resource-id",
|
|
67
|
-
* externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
|
|
68
|
-
* resourceType: "GOOGLE_DRIVE_ITEM"
|
|
69
|
-
* },
|
|
70
|
-
* userEmail: "john.smith@foo.com"
|
|
71
|
-
* })
|
|
72
|
-
*/
|
|
73
|
-
checkResourceAuthorizationForUser(request, requestOptions) {
|
|
74
|
-
return core.HttpResponsePromise.fromPromise(this.__checkResourceAuthorizationForUser(request, requestOptions));
|
|
75
|
-
}
|
|
76
|
-
__checkResourceAuthorizationForUser(request, requestOptions) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
var _a, _b, _c, _d;
|
|
79
|
-
var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
80
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
81
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/permissions/checkResourceAuthorizationForUser"),
|
|
82
|
-
method: "POST",
|
|
83
|
-
headers: _headers,
|
|
84
|
-
contentType: "application/json",
|
|
85
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
86
|
-
requestType: "json",
|
|
87
|
-
body: request,
|
|
88
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
89
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
90
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
|
-
});
|
|
92
|
-
if (_response.ok) {
|
|
93
|
-
return {
|
|
94
|
-
data: _response.body,
|
|
95
|
-
rawResponse: _response.rawResponse,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (_response.error.reason === "status-code") {
|
|
99
|
-
throw new errors.CredalError({
|
|
100
|
-
statusCode: _response.error.statusCode,
|
|
101
|
-
body: _response.error.body,
|
|
102
|
-
rawResponse: _response.rawResponse,
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
switch (_response.error.reason) {
|
|
106
|
-
case "non-json":
|
|
107
|
-
throw new errors.CredalError({
|
|
108
|
-
statusCode: _response.error.statusCode,
|
|
109
|
-
body: _response.error.rawBody,
|
|
110
|
-
rawResponse: _response.rawResponse,
|
|
111
|
-
});
|
|
112
|
-
case "timeout":
|
|
113
|
-
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkResourceAuthorizationForUser.");
|
|
114
|
-
case "unknown":
|
|
115
|
-
throw new errors.CredalError({
|
|
116
|
-
message: _response.error.errorMessage,
|
|
117
|
-
rawResponse: _response.rawResponse,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Admin endpoint to check whether the specified user is authorized to read the specified set of resources.
|
|
124
|
-
*
|
|
125
|
-
* @param {Credal.CheckBulkResourcesAuthorizationForUserRequest} request
|
|
126
|
-
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* await client.permissionsService.checkBulkResourcesAuthorizationForUser({
|
|
130
|
-
* resourceIdentifiers: [{
|
|
131
|
-
* type: "url",
|
|
132
|
-
* url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
|
|
133
|
-
* }, {
|
|
134
|
-
* type: "external-resource-id",
|
|
135
|
-
* externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
|
|
136
|
-
* resourceType: "ZENDESK_TICKET"
|
|
137
|
-
* }],
|
|
138
|
-
* userEmail: "john.smith@foo.com"
|
|
139
|
-
* })
|
|
140
|
-
*/
|
|
141
|
-
checkBulkResourcesAuthorizationForUser(request, requestOptions) {
|
|
142
|
-
return core.HttpResponsePromise.fromPromise(this.__checkBulkResourcesAuthorizationForUser(request, requestOptions));
|
|
143
|
-
}
|
|
144
|
-
__checkBulkResourcesAuthorizationForUser(request, requestOptions) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
var _a, _b, _c, _d;
|
|
147
|
-
var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
148
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
149
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/permissions/checkBulkResourcesAuthorizationForUser"),
|
|
150
|
-
method: "POST",
|
|
151
|
-
headers: _headers,
|
|
152
|
-
contentType: "application/json",
|
|
153
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
154
|
-
requestType: "json",
|
|
155
|
-
body: request,
|
|
156
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
157
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
158
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
159
|
-
});
|
|
160
|
-
if (_response.ok) {
|
|
161
|
-
return {
|
|
162
|
-
data: _response.body,
|
|
163
|
-
rawResponse: _response.rawResponse,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if (_response.error.reason === "status-code") {
|
|
167
|
-
throw new errors.CredalError({
|
|
168
|
-
statusCode: _response.error.statusCode,
|
|
169
|
-
body: _response.error.body,
|
|
170
|
-
rawResponse: _response.rawResponse,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
switch (_response.error.reason) {
|
|
174
|
-
case "non-json":
|
|
175
|
-
throw new errors.CredalError({
|
|
176
|
-
statusCode: _response.error.statusCode,
|
|
177
|
-
body: _response.error.rawBody,
|
|
178
|
-
rawResponse: _response.rawResponse,
|
|
179
|
-
});
|
|
180
|
-
case "timeout":
|
|
181
|
-
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/checkBulkResourcesAuthorizationForUser.");
|
|
182
|
-
case "unknown":
|
|
183
|
-
throw new errors.CredalError({
|
|
184
|
-
message: _response.error.errorMessage,
|
|
185
|
-
rawResponse: _response.rawResponse,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Admin endpoint to list all resources that the specified user is authorized to read. Note this endpoint returns cached results and may not be up-to-date. You can use the checkResourceAuthorizationForUser endpoint with disableCache set to true to get the most up-to-date results.
|
|
192
|
-
*
|
|
193
|
-
* @param {Credal.ListCachedAuthorizedResourcesForUserRequest} request
|
|
194
|
-
* @param {PermissionsService.RequestOptions} requestOptions - Request-specific configuration.
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* await client.permissionsService.listCachedAuthorizedResourcesForUser({
|
|
198
|
-
* userEmail: "john.smith@foo.com"
|
|
199
|
-
* })
|
|
200
|
-
*/
|
|
201
|
-
listCachedAuthorizedResourcesForUser(request, requestOptions) {
|
|
202
|
-
return core.HttpResponsePromise.fromPromise(this.__listCachedAuthorizedResourcesForUser(request, requestOptions));
|
|
203
|
-
}
|
|
204
|
-
__listCachedAuthorizedResourcesForUser(request, requestOptions) {
|
|
205
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
var _a, _b, _c, _d;
|
|
207
|
-
var _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
208
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
209
|
-
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/permissions/listCachedAuthorizedResourcesForUser"),
|
|
210
|
-
method: "POST",
|
|
211
|
-
headers: _headers,
|
|
212
|
-
contentType: "application/json",
|
|
213
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
214
|
-
requestType: "json",
|
|
215
|
-
body: request,
|
|
216
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
217
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
218
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
219
|
-
});
|
|
220
|
-
if (_response.ok) {
|
|
221
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
222
|
-
}
|
|
223
|
-
if (_response.error.reason === "status-code") {
|
|
224
|
-
throw new errors.CredalError({
|
|
225
|
-
statusCode: _response.error.statusCode,
|
|
226
|
-
body: _response.error.body,
|
|
227
|
-
rawResponse: _response.rawResponse,
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
switch (_response.error.reason) {
|
|
231
|
-
case "non-json":
|
|
232
|
-
throw new errors.CredalError({
|
|
233
|
-
statusCode: _response.error.statusCode,
|
|
234
|
-
body: _response.error.rawBody,
|
|
235
|
-
rawResponse: _response.rawResponse,
|
|
236
|
-
});
|
|
237
|
-
case "timeout":
|
|
238
|
-
throw new errors.CredalTimeoutError("Timeout exceeded when calling POST /v0/permissions/listCachedAuthorizedResourcesForUser.");
|
|
239
|
-
case "unknown":
|
|
240
|
-
throw new errors.CredalError({
|
|
241
|
-
message: _response.error.errorMessage,
|
|
242
|
-
rawResponse: _response.rawResponse,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
_getAuthorizationHeader() {
|
|
248
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
var _a;
|
|
250
|
-
const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["CREDAL_API_KEY"];
|
|
251
|
-
if (bearer == null) {
|
|
252
|
-
throw new errors.CredalError({
|
|
253
|
-
message: "Please specify a bearer by either passing it in to the constructor or initializing a CREDAL_API_KEY environment variable",
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
return `Bearer ${bearer}`;
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
exports.PermissionsService = PermissionsService;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as Credal from "../../../../index.js";
|
|
5
|
-
/**
|
|
6
|
-
* @example
|
|
7
|
-
* {
|
|
8
|
-
* resourceIdentifiers: [{
|
|
9
|
-
* type: "url",
|
|
10
|
-
* url: "https://docs.google.com/document/d/170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr/edit"
|
|
11
|
-
* }, {
|
|
12
|
-
* type: "external-resource-id",
|
|
13
|
-
* externalResourceId: "sfsdfvr54UvyslPVWkQFOA0dfsdfsdflgNycFmdZJQr",
|
|
14
|
-
* resourceType: "ZENDESK_TICKET"
|
|
15
|
-
* }],
|
|
16
|
-
* userEmail: "john.smith@foo.com"
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export interface CheckBulkResourcesAuthorizationForUserRequest {
|
|
20
|
-
/** The set of resource identifier for which you want to check authorization. Currently limited to 20 resources. */
|
|
21
|
-
resourceIdentifiers: Credal.ResourceIdentifier[];
|
|
22
|
-
/** The user email to check authorization for. */
|
|
23
|
-
userEmail: string;
|
|
24
|
-
/** If specified, Credal will bypass the permissions cache and check current permissions for all resources specified. */
|
|
25
|
-
disableCache?: boolean;
|
|
26
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as Credal from "../../../../index.js";
|
|
5
|
-
/**
|
|
6
|
-
* @example
|
|
7
|
-
* {
|
|
8
|
-
* resourceIdentifier: {
|
|
9
|
-
* type: "external-resource-id",
|
|
10
|
-
* externalResourceId: "170NrBm0Do7gdzvr54UvyslPVWkQFOA0lgNycFmdZJQr",
|
|
11
|
-
* resourceType: "GOOGLE_DRIVE_ITEM"
|
|
12
|
-
* },
|
|
13
|
-
* userEmail: "john.smith@foo.com"
|
|
14
|
-
* }
|
|
15
|
-
*/
|
|
16
|
-
export interface CheckResourceAuthorizationForUserRequest {
|
|
17
|
-
/** The resource identifier for which you want to check authorization. */
|
|
18
|
-
resourceIdentifier: Credal.ResourceIdentifier;
|
|
19
|
-
/** The user email to check authorization for. */
|
|
20
|
-
userEmail: string;
|
|
21
|
-
/** If specified, Credal will bypass the permissions cache and check current permissions for this resource */
|
|
22
|
-
disableCache?: boolean;
|
|
23
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as Credal from "../../../../index.js";
|
|
5
|
-
/**
|
|
6
|
-
* @example
|
|
7
|
-
* {
|
|
8
|
-
* userEmail: "john.smith@foo.com"
|
|
9
|
-
* }
|
|
10
|
-
*/
|
|
11
|
-
export interface ListCachedAuthorizedResourcesForUserRequest {
|
|
12
|
-
/** The user email to list authorized resources for. */
|
|
13
|
-
userEmail: string;
|
|
14
|
-
/** The type of resource you want to list. If not specified, all resource types will be listed. */
|
|
15
|
-
resourceType?: Credal.ResourceType;
|
|
16
|
-
/** The maximum number of resources to return. Defaults to 100. */
|
|
17
|
-
limit?: number;
|
|
18
|
-
/** The offset to use for pagination. If not specified, the first page of results will be returned. */
|
|
19
|
-
offset?: number;
|
|
20
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { type CheckResourceAuthorizationForUserRequest } from "./CheckResourceAuthorizationForUserRequest.js";
|
|
2
|
-
export { type CheckBulkResourcesAuthorizationForUserRequest } from "./CheckBulkResourcesAuthorizationForUserRequest.js";
|
|
3
|
-
export { type ListCachedAuthorizedResourcesForUserRequest } from "./ListCachedAuthorizedResourcesForUserRequest.js";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types/index.js"), exports);
|
|
18
|
-
__exportStar(require("./client/index.js"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as Credal from "../../../index.js";
|
|
5
|
-
export type Principal = Credal.Principal.Group | Credal.Principal.User;
|
|
6
|
-
export declare namespace Principal {
|
|
7
|
-
interface Group extends Credal.Group {
|
|
8
|
-
type: "group";
|
|
9
|
-
}
|
|
10
|
-
interface User extends Credal.User {
|
|
11
|
-
type: "user";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as Credal from "../../../index.js";
|
|
5
|
-
export interface ResourceAuthorizationResult {
|
|
6
|
-
externalResourceId: Credal.ExternalResourceId;
|
|
7
|
-
inputUrl?: string;
|
|
8
|
-
authorized: boolean;
|
|
9
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./Group.js";
|
|
2
|
-
export * from "./User.js";
|
|
3
|
-
export * from "./Principal.js";
|
|
4
|
-
export * from "./AuthorizedResource.js";
|
|
5
|
-
export * from "./AuthorizedResourceListPage.js";
|
|
6
|
-
export * from "./PrincipalListPage.js";
|
|
7
|
-
export * from "./CheckResourceAuthorizationResponse.js";
|
|
8
|
-
export * from "./ResourceAuthorizationResult.js";
|
|
9
|
-
export * from "./CheckBulkResourcesAuthorizationResponse.js";
|
|
10
|
-
export * from "./Action.js";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Group.js"), exports);
|
|
18
|
-
__exportStar(require("./User.js"), exports);
|
|
19
|
-
__exportStar(require("./Principal.js"), exports);
|
|
20
|
-
__exportStar(require("./AuthorizedResource.js"), exports);
|
|
21
|
-
__exportStar(require("./AuthorizedResourceListPage.js"), exports);
|
|
22
|
-
__exportStar(require("./PrincipalListPage.js"), exports);
|
|
23
|
-
__exportStar(require("./CheckResourceAuthorizationResponse.js"), exports);
|
|
24
|
-
__exportStar(require("./ResourceAuthorizationResult.js"), exports);
|
|
25
|
-
__exportStar(require("./CheckBulkResourcesAuthorizationResponse.js"), exports);
|
|
26
|
-
__exportStar(require("./Action.js"), exports);
|