@contrail/cli 3.6.0-alpha-8-alpha.193f9cf → 3.6.0-alpha-8-alpha.5396d7b
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/README.md +1 -1
- package/node_modules/@contrail/sdk/lib/image-search/image-search.d.ts +34 -0
- package/node_modules/@contrail/sdk/lib/image-search/image-search.js +42 -0
- package/node_modules/@contrail/sdk/lib/image-search/index.d.ts +1 -0
- package/node_modules/@contrail/{org-config-migration/node_modules/@contrail/sdk/lib/assets → sdk/lib/image-search}/index.js +1 -1
- package/node_modules/@contrail/sdk/lib/index.d.ts +1 -0
- package/node_modules/@contrail/sdk/lib/index.js +1 -0
- package/node_modules/@contrail/sdk/package.json +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/pull_request_template.md +0 -31
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/check-code-formatting.yml +0 -34
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/empty.yml +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/generate-sdk-docs.yml +0 -32
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/publish-to-npm.yml +0 -117
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.github/workflows/sdk-lib.yml +0 -27
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/.prettierrc.yaml +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/README.md +0 -72
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/home-hero.svg +0 -11
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/assets.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/assets.js +0 -54
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/assets/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/auth.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/auth.js +0 -6
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/index.d.ts +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/index.js +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/login.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/auth/login.js +0 -209
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/config.d.ts +0 -48
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/config.js +0 -42
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/config/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/content.d.ts +0 -12
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/content.js +0 -70
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/content/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/request.d.ts +0 -15
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/request.js +0 -241
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entities.client.d.ts +0 -101
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entities.client.js +0 -306
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference-expander.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference-expander.js +0 -86
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference.d.ts +0 -6
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity-reference.js +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity.resource.registry.d.ts +0 -5
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/entity.resource.registry.js +0 -59
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/index.d.ts +0 -3
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/entities/index.js +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/file-type-helper.d.ts +0 -3
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/file-type-helper.js +0 -24
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/files.d.ts +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/files.js +0 -151
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/files/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.d.ts +0 -10
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/index.js +0 -26
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/notifications-dispatcher.d.ts +0 -16
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/notifications/notifications-dispatcher.js +0 -37
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/index.d.ts +0 -1
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/index.js +0 -17
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies-cache.d.ts +0 -12
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies-cache.js +0 -55
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies.client.d.ts +0 -9
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/policies/policies.client.js +0 -74
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/index.d.ts +0 -2
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/index.js +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/sub-types-helper.d.ts +0 -18
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/sub-types-helper.js +0 -98
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types-cache.d.ts +0 -19
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types-cache.js +0 -73
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types.client.d.ts +0 -42
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/types/types.client.js +0 -217
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/package.json +0 -64
- package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/scripts/replicate-bug.js +0 -69
package/node_modules/@contrail/org-config-migration/node_modules/@contrail/sdk/lib/core/request.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.Request = exports._resetTokenRefreshPromise = exports.AUTH_TOKEN_REQUIRED = void 0;
|
|
16
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
|
-
const config_1 = require("../config/config");
|
|
18
|
-
const auth_1 = require("../auth/auth");
|
|
19
|
-
exports.AUTH_TOKEN_REQUIRED = 'Authentication token must be set to make a contrail call.';
|
|
20
|
-
class ApiError extends Error {
|
|
21
|
-
constructor(message, details, errorCode) {
|
|
22
|
-
super(message);
|
|
23
|
-
this.details = details;
|
|
24
|
-
this.errorCode = errorCode;
|
|
25
|
-
this.details = details;
|
|
26
|
-
this.errorCode = errorCode;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
let tokenRefreshPromise = null;
|
|
30
|
-
function performTokenRefresh() {
|
|
31
|
-
var _a, _b, _c;
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const apiRefreshToken = (_a = auth_1.Auth.config) === null || _a === void 0 ? void 0 : _a.apiRefreshToken;
|
|
34
|
-
const apiGateway = (_b = auth_1.Auth.config) === null || _b === void 0 ? void 0 : _b.apiGateway;
|
|
35
|
-
if (!apiRefreshToken) {
|
|
36
|
-
throw new Error('No API refresh token available. Please login again.');
|
|
37
|
-
}
|
|
38
|
-
if (!apiGateway) {
|
|
39
|
-
throw new Error('API Gateway not configured. Ensure the application environment is properly configured.');
|
|
40
|
-
}
|
|
41
|
-
const url = apiGateway + '/auth/jwt_refresh/';
|
|
42
|
-
try {
|
|
43
|
-
const response = yield (0, node_fetch_1.default)(url, {
|
|
44
|
-
method: 'POST',
|
|
45
|
-
headers: {
|
|
46
|
-
Accept: 'application/json',
|
|
47
|
-
'Content-Type': 'application/json',
|
|
48
|
-
},
|
|
49
|
-
body: JSON.stringify({
|
|
50
|
-
refreshToken: apiRefreshToken,
|
|
51
|
-
}),
|
|
52
|
-
});
|
|
53
|
-
if (!response.ok) {
|
|
54
|
-
const errorText = yield response.text();
|
|
55
|
-
throw new Error(`Token refresh failed with status ${response.status}: ${errorText}`);
|
|
56
|
-
}
|
|
57
|
-
const data = yield response.json();
|
|
58
|
-
if (!data.accessToken) {
|
|
59
|
-
throw new Error(`Token refresh response did not contain a new access token.`);
|
|
60
|
-
}
|
|
61
|
-
auth_1.Auth.config.apiUserToken = data.accessToken;
|
|
62
|
-
(0, config_1.setConfig)(auth_1.Auth.config);
|
|
63
|
-
console.log('Access token refreshed successfully');
|
|
64
|
-
return data.accessToken;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
throw new Error(`Token refresh failed: ${(_c = error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : String(error)}. Please login again with your credentials.`);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function refreshAccessToken() {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
if (tokenRefreshPromise) {
|
|
74
|
-
console.log('Token refresh already in progress, waiting for completion...');
|
|
75
|
-
return tokenRefreshPromise;
|
|
76
|
-
}
|
|
77
|
-
tokenRefreshPromise = performTokenRefresh();
|
|
78
|
-
try {
|
|
79
|
-
const newToken = yield tokenRefreshPromise;
|
|
80
|
-
return newToken;
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
83
|
-
tokenRefreshPromise = null;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function _resetTokenRefreshPromise() {
|
|
88
|
-
tokenRefreshPromise = null;
|
|
89
|
-
}
|
|
90
|
-
exports._resetTokenRefreshPromise = _resetTokenRefreshPromise;
|
|
91
|
-
class Request {
|
|
92
|
-
static request(resource, params = { method: 'get' }, ctx) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
params.headers = Object.assign(Object.assign({}, (params.headers || {})), (yield Request.getHeaders()));
|
|
95
|
-
try {
|
|
96
|
-
return yield this.requestWithRetries(resource, params, ctx);
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
if (this.isTokenExpiredError(error)) {
|
|
100
|
-
console.log(`[SDK Request: Token Expired] Attempting to refresh access token...`);
|
|
101
|
-
try {
|
|
102
|
-
yield refreshAccessToken();
|
|
103
|
-
params.headers = Object.assign(Object.assign({}, (params.headers || {})), (yield Request.getHeaders()));
|
|
104
|
-
console.log(`[SDK Request: Token Refreshed] Retrying request...`);
|
|
105
|
-
return yield this.requestWithRetries(resource, params, ctx);
|
|
106
|
-
}
|
|
107
|
-
catch (refreshError) {
|
|
108
|
-
console.error(`[SDK Request: Token Refresh Failed] ${refreshError === null || refreshError === void 0 ? void 0 : refreshError.message}`, refreshError);
|
|
109
|
-
throw new ApiError('Access token refresh failed after TOKEN_EXPIRED error. Unable to proceed with request', refreshError);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
static requestWithRetries(resource, params, ctx) {
|
|
117
|
-
var _a;
|
|
118
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const userCtx = ctx || (0, config_1.getGlobalContext)();
|
|
120
|
-
const start = new Date();
|
|
121
|
-
const { apiGateway: API_GATEWAY, networkErrorHandler, errorHandler } = (0, config_1.getConfig)();
|
|
122
|
-
const url = API_GATEWAY + resource;
|
|
123
|
-
const method = (params === null || params === void 0 ? void 0 : params.method) ? params.method.toUpperCase() : 'GET';
|
|
124
|
-
const fullResource = `${method} ${url.split('/')[3]}${resource}`;
|
|
125
|
-
let res;
|
|
126
|
-
let attempt = 0;
|
|
127
|
-
while (attempt <= this.MAX_RETRIES) {
|
|
128
|
-
attempt++;
|
|
129
|
-
try {
|
|
130
|
-
if ((_a = userCtx === null || userCtx === void 0 ? void 0 : userCtx.requestOptions) === null || _a === void 0 ? void 0 : _a.useNativeFetch) {
|
|
131
|
-
res = yield globalThis.fetch(url, params);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
res = yield (0, node_fetch_1.default)(url, params);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
if (networkErrorHandler) {
|
|
139
|
-
Request.logError(error, resource, params);
|
|
140
|
-
return yield networkErrorHandler.handle(error);
|
|
141
|
-
}
|
|
142
|
-
console.error(`[Attempt ${attempt}][SDK Request: Network Error] resource: ${fullResource}`);
|
|
143
|
-
console.error(`[Attempt ${attempt}][SDK Request: Network Error] params: ${this.sanitizeParametersString(params)}`);
|
|
144
|
-
console.error(`[Attempt ${attempt}][SDK Request: Network Error] error: ${error}`);
|
|
145
|
-
console.error(`[Attempt ${attempt}][SDK Request: Network Error] retrying...`);
|
|
146
|
-
if (attempt > Request.MAX_RETRIES) {
|
|
147
|
-
console.error(`[Max Number of retries reached][SDK Request: Network Error] resource: ${fullResource} error: ${error}`);
|
|
148
|
-
throw error;
|
|
149
|
-
}
|
|
150
|
-
yield Request.delay(this.RETRY_DELAY);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
if (res.ok) {
|
|
154
|
-
const text = yield res.text();
|
|
155
|
-
const json = text.length ? JSON.parse(text) : null;
|
|
156
|
-
const end = new Date();
|
|
157
|
-
console.log(`[###### SDK Request]: (DURATION:${end.getTime() - start.getTime()}) : ${fullResource}:`);
|
|
158
|
-
return Promise.resolve(json);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
const error = yield res.text();
|
|
162
|
-
const errorJson = this.tryParseStringIntoObject(error);
|
|
163
|
-
const isTokenExpired = errorJson && typeof errorJson === 'object' && errorJson.errorCode === 'TOKEN_EXPIRED';
|
|
164
|
-
if (isTokenExpired) {
|
|
165
|
-
throw new ApiError('Token expired', errorJson, 'TOKEN_EXPIRED');
|
|
166
|
-
}
|
|
167
|
-
if (errorHandler) {
|
|
168
|
-
const retryCallback = () => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
params.headers = Object.assign(Object.assign({}, (params.headers || {})), (yield Request.getHeaders()));
|
|
170
|
-
return yield (0, node_fetch_1.default)(url, params);
|
|
171
|
-
});
|
|
172
|
-
console.log(`[###### SDK Request: ERROR] code ${res.status} resource: ${fullResource}`);
|
|
173
|
-
console.log(`[###### SDK Request: ERROR] params ${Request.sanitizeParametersString(params)}`);
|
|
174
|
-
const request = Object.assign(Object.assign({}, params), { url, method });
|
|
175
|
-
return yield errorHandler.handle(res, errorJson, retryCallback, request);
|
|
176
|
-
}
|
|
177
|
-
if (attempt <= this.MAX_RETRIES) {
|
|
178
|
-
console.error(`[Attempt ${attempt}][SDK Request: ERROR] resource: ${fullResource}`);
|
|
179
|
-
console.error(`[Attempt ${attempt}][SDK Request: ERROR] params ${Request.sanitizeParametersString(params)}`);
|
|
180
|
-
console.error(`[Attempt ${attempt}][SDK Request: ERROR] error: ${error}`);
|
|
181
|
-
console.error(`[Attempt ${attempt}][SDK Request: ERROR] retrying...`);
|
|
182
|
-
yield Request.delay(this.RETRY_DELAY);
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
console.error(`[Max Number of retries reached][SDK Request: ERROR] resource: ${fullResource}`);
|
|
186
|
-
console.error(`[Max Number of retries reached][SDK Request: ERROR] params ${Request.sanitizeParametersString(params)}`);
|
|
187
|
-
console.error(`[Max Number of retries reached][SDK Request: ERROR] error: ${error}`);
|
|
188
|
-
throw new ApiError(error.message, error);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
static isTokenExpiredError(error) {
|
|
194
|
-
return error instanceof ApiError && error.errorCode === 'TOKEN_EXPIRED';
|
|
195
|
-
}
|
|
196
|
-
static delay(ms) {
|
|
197
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
198
|
-
}
|
|
199
|
-
static logError(error = {}, resource, params = {}) {
|
|
200
|
-
const sanitizedParams = Request.sanitizeParametersString(params);
|
|
201
|
-
console.error(`[###### SDK Request: ERROR] error: ${JSON.stringify(error)}
|
|
202
|
-
resource: ${resource}
|
|
203
|
-
params: ${JSON.stringify(sanitizedParams)}`);
|
|
204
|
-
}
|
|
205
|
-
static sanitizeParametersString(params) {
|
|
206
|
-
if (!params) {
|
|
207
|
-
return '';
|
|
208
|
-
}
|
|
209
|
-
const sanitizedParams = JSON.parse(JSON.stringify(params));
|
|
210
|
-
if ((sanitizedParams === null || sanitizedParams === void 0 ? void 0 : sanitizedParams.headers) && sanitizedParams.headers['X-Api-Key']) {
|
|
211
|
-
sanitizedParams.headers['X-Api-Key'] = sanitizedParams.headers['X-Api-Key'].substring(0, 5) + '...';
|
|
212
|
-
}
|
|
213
|
-
return JSON.stringify(sanitizedParams);
|
|
214
|
-
}
|
|
215
|
-
static getHeaders() {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
const config = (0, config_1.getConfig)();
|
|
218
|
-
const headers = {};
|
|
219
|
-
if (config.authTokenResolver) {
|
|
220
|
-
headers['X-Api-Key'] = yield config.authTokenResolver.resolveAuthToken();
|
|
221
|
-
headers['X-Api-Org'] = config.orgSlug;
|
|
222
|
-
}
|
|
223
|
-
else if (config.apiUserToken) {
|
|
224
|
-
headers['X-Api-Key'] = config.apiUserToken;
|
|
225
|
-
headers['X-Api-Org'] = config.orgSlug;
|
|
226
|
-
}
|
|
227
|
-
return headers;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
static tryParseStringIntoObject(jsonString) {
|
|
231
|
-
try {
|
|
232
|
-
return JSON.parse(jsonString);
|
|
233
|
-
}
|
|
234
|
-
catch (e) {
|
|
235
|
-
return jsonString;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
exports.Request = Request;
|
|
240
|
-
Request.MAX_RETRIES = 2;
|
|
241
|
-
Request.RETRY_DELAY = 1000;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { EntityReference } from './entity-reference';
|
|
2
|
-
import { EntitiesClient as AbstractEntitiesClient } from '@contrail/entity-types';
|
|
3
|
-
export interface SortOption {
|
|
4
|
-
orderField: string;
|
|
5
|
-
order?: SortOrderOptions;
|
|
6
|
-
}
|
|
7
|
-
export declare enum SortOrderOptions {
|
|
8
|
-
ASC = "asc",
|
|
9
|
-
DESC = "desc"
|
|
10
|
-
}
|
|
11
|
-
export declare enum API_VERSION {
|
|
12
|
-
EMPTY = "",
|
|
13
|
-
V1 = "1",
|
|
14
|
-
V2 = "2"
|
|
15
|
-
}
|
|
16
|
-
export declare const DEFAULT_API_VERSION = API_VERSION.EMPTY;
|
|
17
|
-
export declare abstract class EntitiesClientGetOptions {
|
|
18
|
-
entityName?: string;
|
|
19
|
-
id?: string;
|
|
20
|
-
reference?: string;
|
|
21
|
-
federatedId?: string;
|
|
22
|
-
federatedIds?: string[];
|
|
23
|
-
relation?: string;
|
|
24
|
-
relations?: Array<string>;
|
|
25
|
-
criteria?: {
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
};
|
|
28
|
-
cacheMode?: string;
|
|
29
|
-
search?: string;
|
|
30
|
-
useSearch?: boolean;
|
|
31
|
-
order?: SortOption[];
|
|
32
|
-
skip?: number;
|
|
33
|
-
take?: number;
|
|
34
|
-
paginate?: boolean;
|
|
35
|
-
nextPageKey?: string;
|
|
36
|
-
apiVersion?: API_VERSION;
|
|
37
|
-
suffix?: string;
|
|
38
|
-
skipHydrateRelationships?: boolean;
|
|
39
|
-
customParams?: Record<string, string | number | boolean>;
|
|
40
|
-
}
|
|
41
|
-
export declare abstract class EntitiesClientCreateOptions {
|
|
42
|
-
entityName: string;
|
|
43
|
-
object: any;
|
|
44
|
-
id?: string;
|
|
45
|
-
relation?: string;
|
|
46
|
-
apiVersion?: API_VERSION;
|
|
47
|
-
suffix?: string;
|
|
48
|
-
skipHydrateRelationships?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export declare abstract class EntitiesClientBatchCreateOptions {
|
|
51
|
-
entityName: string;
|
|
52
|
-
objects: any[];
|
|
53
|
-
apiVersion?: API_VERSION;
|
|
54
|
-
suffix?: string;
|
|
55
|
-
}
|
|
56
|
-
declare class EntitiesClientUpdateOptions {
|
|
57
|
-
entityName?: string;
|
|
58
|
-
object: any;
|
|
59
|
-
id?: string;
|
|
60
|
-
reference?: string;
|
|
61
|
-
relation?: string;
|
|
62
|
-
relationId?: string;
|
|
63
|
-
apiVersion?: API_VERSION;
|
|
64
|
-
suffix?: string;
|
|
65
|
-
skipHydrateRelationships?: boolean;
|
|
66
|
-
}
|
|
67
|
-
export declare abstract class EntitiesClientBatchUpdateOptions {
|
|
68
|
-
entityName: string;
|
|
69
|
-
objects: any[];
|
|
70
|
-
apiVersion?: API_VERSION;
|
|
71
|
-
suffix?: string;
|
|
72
|
-
}
|
|
73
|
-
export declare abstract class EntitiesClientDeleteOptions {
|
|
74
|
-
entityName?: string;
|
|
75
|
-
id?: string;
|
|
76
|
-
reference?: string;
|
|
77
|
-
relation?: string;
|
|
78
|
-
relationId?: string;
|
|
79
|
-
apiVersion?: API_VERSION;
|
|
80
|
-
suffix?: string;
|
|
81
|
-
}
|
|
82
|
-
export declare abstract class EntitiesClientBatchDeleteOptions {
|
|
83
|
-
entityName?: string;
|
|
84
|
-
ids?: string[];
|
|
85
|
-
apiVersion?: API_VERSION;
|
|
86
|
-
suffix?: string;
|
|
87
|
-
}
|
|
88
|
-
export declare class Entities implements AbstractEntitiesClient {
|
|
89
|
-
private ctx?;
|
|
90
|
-
private apiVersion;
|
|
91
|
-
constructor(ctx?: any, apiVersion?: API_VERSION);
|
|
92
|
-
getAllReferences(references: Array<EntityReference>, relations: Array<string>): Promise<Map<string, any>>;
|
|
93
|
-
get(options: EntitiesClientGetOptions): Promise<any | any[]>;
|
|
94
|
-
create(options: EntitiesClientCreateOptions): Promise<any>;
|
|
95
|
-
batchCreate(options: EntitiesClientBatchCreateOptions): Promise<any>;
|
|
96
|
-
update(options: EntitiesClientUpdateOptions): Promise<any>;
|
|
97
|
-
batchUpdate(options: EntitiesClientBatchUpdateOptions): Promise<any>;
|
|
98
|
-
delete(options: EntitiesClientDeleteOptions): Promise<any>;
|
|
99
|
-
batchDelete(options: EntitiesClientBatchDeleteOptions): Promise<any>;
|
|
100
|
-
}
|
|
101
|
-
export {};
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Entities = exports.EntitiesClientBatchDeleteOptions = exports.EntitiesClientDeleteOptions = exports.EntitiesClientBatchUpdateOptions = exports.EntitiesClientBatchCreateOptions = exports.EntitiesClientCreateOptions = exports.EntitiesClientGetOptions = exports.DEFAULT_API_VERSION = exports.API_VERSION = exports.SortOrderOptions = void 0;
|
|
13
|
-
const request_1 = require("../core/request");
|
|
14
|
-
const entity_reference_1 = require("./entity-reference");
|
|
15
|
-
const entity_reference_expander_1 = require("./entity-reference-expander");
|
|
16
|
-
const entity_resource_registry_1 = require("./entity.resource.registry");
|
|
17
|
-
let JSURL = require('jsurl');
|
|
18
|
-
var SortOrderOptions;
|
|
19
|
-
(function (SortOrderOptions) {
|
|
20
|
-
SortOrderOptions["ASC"] = "asc";
|
|
21
|
-
SortOrderOptions["DESC"] = "desc";
|
|
22
|
-
})(SortOrderOptions = exports.SortOrderOptions || (exports.SortOrderOptions = {}));
|
|
23
|
-
var API_VERSION;
|
|
24
|
-
(function (API_VERSION) {
|
|
25
|
-
API_VERSION["EMPTY"] = "";
|
|
26
|
-
API_VERSION["V1"] = "1";
|
|
27
|
-
API_VERSION["V2"] = "2";
|
|
28
|
-
})(API_VERSION = exports.API_VERSION || (exports.API_VERSION = {}));
|
|
29
|
-
exports.DEFAULT_API_VERSION = API_VERSION.EMPTY;
|
|
30
|
-
class EntitiesClientGetOptions {
|
|
31
|
-
}
|
|
32
|
-
exports.EntitiesClientGetOptions = EntitiesClientGetOptions;
|
|
33
|
-
class EntitiesClientCreateOptions {
|
|
34
|
-
}
|
|
35
|
-
exports.EntitiesClientCreateOptions = EntitiesClientCreateOptions;
|
|
36
|
-
class EntitiesClientBatchCreateOptions {
|
|
37
|
-
}
|
|
38
|
-
exports.EntitiesClientBatchCreateOptions = EntitiesClientBatchCreateOptions;
|
|
39
|
-
class EntitiesClientUpdateOptions {
|
|
40
|
-
}
|
|
41
|
-
class EntitiesClientBatchUpdateOptions {
|
|
42
|
-
}
|
|
43
|
-
exports.EntitiesClientBatchUpdateOptions = EntitiesClientBatchUpdateOptions;
|
|
44
|
-
class EntitiesClientDeleteOptions {
|
|
45
|
-
}
|
|
46
|
-
exports.EntitiesClientDeleteOptions = EntitiesClientDeleteOptions;
|
|
47
|
-
class EntitiesClientBatchDeleteOptions {
|
|
48
|
-
}
|
|
49
|
-
exports.EntitiesClientBatchDeleteOptions = EntitiesClientBatchDeleteOptions;
|
|
50
|
-
class Entities {
|
|
51
|
-
constructor(ctx, apiVersion = exports.DEFAULT_API_VERSION) {
|
|
52
|
-
this.ctx = ctx;
|
|
53
|
-
this.apiVersion = apiVersion;
|
|
54
|
-
}
|
|
55
|
-
getAllReferences(references, relations) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
return entity_reference_expander_1.EntityReferenceExpander.expandEntityReferences(this, references, relations);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
get(options) {
|
|
61
|
-
var _a;
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
if (options.reference) {
|
|
64
|
-
const ref = new entity_reference_1.EntityReference(options.reference);
|
|
65
|
-
options.entityName = ref.entityType;
|
|
66
|
-
options.id = ref.id;
|
|
67
|
-
}
|
|
68
|
-
if (!options.entityName) {
|
|
69
|
-
throw Error('Missing entityName or valid reference.');
|
|
70
|
-
}
|
|
71
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}`;
|
|
72
|
-
if (options.id) {
|
|
73
|
-
resource += '/' + options.id;
|
|
74
|
-
}
|
|
75
|
-
else if (options.federatedId) {
|
|
76
|
-
resource += '/federated/' + options.federatedId;
|
|
77
|
-
}
|
|
78
|
-
else if (options.federatedIds) {
|
|
79
|
-
resource += '/federated/batch';
|
|
80
|
-
}
|
|
81
|
-
if (options.suffix) {
|
|
82
|
-
resource += '/' + options.suffix;
|
|
83
|
-
}
|
|
84
|
-
else if (options.relation) {
|
|
85
|
-
resource += '/' + options.relation;
|
|
86
|
-
}
|
|
87
|
-
const objectKeys = Object.keys(options);
|
|
88
|
-
if (options.relations ||
|
|
89
|
-
options.federatedIds ||
|
|
90
|
-
options.criteria ||
|
|
91
|
-
options.cacheMode ||
|
|
92
|
-
options.skip ||
|
|
93
|
-
options.search ||
|
|
94
|
-
objectKeys.includes('useSearch') ||
|
|
95
|
-
objectKeys.includes('paginate') ||
|
|
96
|
-
options.order ||
|
|
97
|
-
options.nextPageKey ||
|
|
98
|
-
objectKeys.includes('skipHydrateRelationships') ||
|
|
99
|
-
options.take ||
|
|
100
|
-
options.customParams) {
|
|
101
|
-
resource += '?';
|
|
102
|
-
}
|
|
103
|
-
if (options.relations) {
|
|
104
|
-
resource += `relations=${options.relations.join(',')}&`;
|
|
105
|
-
}
|
|
106
|
-
if (options.cacheMode) {
|
|
107
|
-
resource += `cacheMode=${options.cacheMode}&`;
|
|
108
|
-
}
|
|
109
|
-
if (options.search) {
|
|
110
|
-
resource += `search=${options.search}&`;
|
|
111
|
-
}
|
|
112
|
-
if (objectKeys.includes('useSearch')) {
|
|
113
|
-
resource += `useSearch=${options.useSearch}&`;
|
|
114
|
-
}
|
|
115
|
-
if (options.order) {
|
|
116
|
-
resource += `order=${JSURL.stringify(options.order)}&`;
|
|
117
|
-
}
|
|
118
|
-
if (options.skip) {
|
|
119
|
-
resource += `skip=${options.skip}&`;
|
|
120
|
-
}
|
|
121
|
-
if (objectKeys.includes('paginate')) {
|
|
122
|
-
resource += `paginate=${options.paginate}&`;
|
|
123
|
-
}
|
|
124
|
-
if (options.take) {
|
|
125
|
-
resource += `take=${options.take}&`;
|
|
126
|
-
}
|
|
127
|
-
if (options.nextPageKey) {
|
|
128
|
-
resource += `nextPageKey=${options.nextPageKey}&`;
|
|
129
|
-
}
|
|
130
|
-
if (objectKeys.includes('skipHydrateRelationships')) {
|
|
131
|
-
resource += `skipHydrateRelationships=${options.skipHydrateRelationships}&`;
|
|
132
|
-
}
|
|
133
|
-
if (options.federatedIds) {
|
|
134
|
-
resource += `ids=${options.federatedIds.map((id) => encodeURIComponent(id.replace(/,/g, '_COMMA_'))).join(',')}&`;
|
|
135
|
-
}
|
|
136
|
-
if (options.criteria) {
|
|
137
|
-
resource += 'criteria=' + JSURL.stringify(options.criteria) + '&';
|
|
138
|
-
}
|
|
139
|
-
if (options.customParams) {
|
|
140
|
-
const buildQueryParam = (key, value) => {
|
|
141
|
-
if (value === undefined || value === null) {
|
|
142
|
-
return '';
|
|
143
|
-
}
|
|
144
|
-
if (typeof value === 'object') {
|
|
145
|
-
throw Error('customParams must be string, number, or boolean.');
|
|
146
|
-
}
|
|
147
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value.toString())}`;
|
|
148
|
-
};
|
|
149
|
-
const combinedCustomParamsString = Object.entries(options.customParams)
|
|
150
|
-
.filter(([_key, value]) => value !== undefined && value !== null)
|
|
151
|
-
.map(([key, value]) => buildQueryParam(key, value))
|
|
152
|
-
.join('&');
|
|
153
|
-
resource += combinedCustomParamsString;
|
|
154
|
-
}
|
|
155
|
-
return yield request_1.Request.request(resource, {
|
|
156
|
-
headers: Object.assign({}, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
157
|
-
}, this.ctx);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
create(options) {
|
|
161
|
-
var _a;
|
|
162
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
let resource = '/' + entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName);
|
|
164
|
-
if (options.relation && options.id) {
|
|
165
|
-
resource += `/${options.id}/${options.relation}`;
|
|
166
|
-
}
|
|
167
|
-
else if (options.relation) {
|
|
168
|
-
resource += `/${options.relation}`;
|
|
169
|
-
}
|
|
170
|
-
if (options.suffix) {
|
|
171
|
-
resource += '/' + options.suffix;
|
|
172
|
-
}
|
|
173
|
-
if (options.skipHydrateRelationships) {
|
|
174
|
-
resource += '?skipHydrateRelationships=true';
|
|
175
|
-
}
|
|
176
|
-
return yield request_1.Request.request(resource, {
|
|
177
|
-
method: 'POST',
|
|
178
|
-
body: JSON.stringify(options.object),
|
|
179
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
180
|
-
}, this.ctx);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
batchCreate(options) {
|
|
184
|
-
var _a;
|
|
185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}/batch`;
|
|
187
|
-
if (options.suffix) {
|
|
188
|
-
resource += '/' + options.suffix;
|
|
189
|
-
}
|
|
190
|
-
return yield request_1.Request.request(resource, {
|
|
191
|
-
method: 'POST',
|
|
192
|
-
body: JSON.stringify(options.objects),
|
|
193
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
194
|
-
}, this.ctx);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
update(options) {
|
|
198
|
-
var _a;
|
|
199
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
if (options.reference) {
|
|
201
|
-
const ref = new entity_reference_1.EntityReference(options.reference);
|
|
202
|
-
options.entityName = ref.entityType;
|
|
203
|
-
options.id = ref.id;
|
|
204
|
-
}
|
|
205
|
-
if (!options.id) {
|
|
206
|
-
throw Error(`Must specify id in update.`);
|
|
207
|
-
}
|
|
208
|
-
if (!options.entityName) {
|
|
209
|
-
throw Error('Missing entityName or valid reference.');
|
|
210
|
-
}
|
|
211
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}/${options.id}`;
|
|
212
|
-
if (options.relation) {
|
|
213
|
-
if (!options.relationId) {
|
|
214
|
-
throw Error(`Must specify a relation id when updating a relation.`);
|
|
215
|
-
}
|
|
216
|
-
resource += `/${options.relation}/${options.relationId}`;
|
|
217
|
-
}
|
|
218
|
-
if (options.suffix) {
|
|
219
|
-
resource += '/' + options.suffix;
|
|
220
|
-
}
|
|
221
|
-
if (options.skipHydrateRelationships) {
|
|
222
|
-
resource += '?skipHydrateRelationships=true';
|
|
223
|
-
}
|
|
224
|
-
return yield request_1.Request.request(resource, {
|
|
225
|
-
method: 'PUT',
|
|
226
|
-
body: JSON.stringify(options.object),
|
|
227
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
228
|
-
}, this.ctx);
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
batchUpdate(options) {
|
|
232
|
-
var _a;
|
|
233
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}/batch`;
|
|
235
|
-
if (options.suffix) {
|
|
236
|
-
resource += '/' + options.suffix;
|
|
237
|
-
}
|
|
238
|
-
return yield request_1.Request.request(resource, {
|
|
239
|
-
method: 'PUT',
|
|
240
|
-
body: JSON.stringify(options.objects),
|
|
241
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
242
|
-
}, this.ctx);
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
delete(options) {
|
|
246
|
-
var _a;
|
|
247
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
-
if (options.reference) {
|
|
249
|
-
const ref = new entity_reference_1.EntityReference(options.reference);
|
|
250
|
-
options.entityName = ref.entityType;
|
|
251
|
-
options.id = ref.id;
|
|
252
|
-
}
|
|
253
|
-
if (!options.id) {
|
|
254
|
-
throw Error(`Must specify id in delete.`);
|
|
255
|
-
}
|
|
256
|
-
if (!options.entityName) {
|
|
257
|
-
throw Error('Missing entityName or valid reference.');
|
|
258
|
-
}
|
|
259
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}/${options.id}`;
|
|
260
|
-
if (options.relation) {
|
|
261
|
-
if (!options.relationId) {
|
|
262
|
-
throw Error(`Must specify a relation id when deleting a relation.`);
|
|
263
|
-
}
|
|
264
|
-
resource += `/${options.relation}/${options.relationId}`;
|
|
265
|
-
}
|
|
266
|
-
if (options.suffix) {
|
|
267
|
-
resource += '/' + options.suffix;
|
|
268
|
-
}
|
|
269
|
-
return yield request_1.Request.request(resource, {
|
|
270
|
-
method: 'DELETE',
|
|
271
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
272
|
-
}, this.ctx);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
batchDelete(options) {
|
|
276
|
-
var _a;
|
|
277
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
if (!options.ids) {
|
|
279
|
-
throw Error(`Must specify ids in batch delete.`);
|
|
280
|
-
}
|
|
281
|
-
if (!options.entityName) {
|
|
282
|
-
throw Error('Missing entityName');
|
|
283
|
-
}
|
|
284
|
-
let resource = `/${entity_resource_registry_1.EntityResourceRegistry.getEntityResourceName(options.entityName)}/batch`;
|
|
285
|
-
if (options.suffix) {
|
|
286
|
-
resource += '/' + options.suffix;
|
|
287
|
-
}
|
|
288
|
-
return yield request_1.Request.request(resource, {
|
|
289
|
-
method: 'DELETE',
|
|
290
|
-
body: JSON.stringify({ ids: options.ids }),
|
|
291
|
-
headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
|
|
292
|
-
}, this.ctx);
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.Entities = Entities;
|
|
297
|
-
function getVersionHeader(version) {
|
|
298
|
-
if (version === API_VERSION.EMPTY) {
|
|
299
|
-
return {};
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
return {
|
|
303
|
-
'Api-Version': version,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Entities } from './entities.client';
|
|
2
|
-
import { EntityReference } from './entity-reference';
|
|
3
|
-
export declare class EntityReferenceExpander {
|
|
4
|
-
static expandEntityReferences(entitiesClient: Entities, references: Array<EntityReference>, relations: Array<string>): Promise<Map<string, any>>;
|
|
5
|
-
static getEntityTypeMap(references: Array<EntityReference>): Map<any, any>;
|
|
6
|
-
private static getEntitiesFromReferences;
|
|
7
|
-
static createEntityMapFromTypeBasedResults(typeBasedResults: Map<string, Array<any>>): Map<string, any>;
|
|
8
|
-
static splitIntoChunksByLen(arr: any, len: any): any[];
|
|
9
|
-
}
|