@drttix/drt-sdk 0.6.5 → 0.7.0
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/azure-pipelines.yml +15 -6
- package/demo/default.html +2 -1
- package/demo/test.html +529 -102
- package/demo/with-base.html +10 -8
- package/dist/bundle/drt-sdk.js +1 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/portal/core/request.js +3 -1
- package/dist/cjs/src/generated/portal/services/AccountService.d.ts +12 -2
- package/dist/cjs/src/generated/portal/services/AccountService.js +26 -2
- package/dist/cjs/src/generated/portal/services/AuthService.d.ts +2 -1
- package/dist/cjs/src/generated/portal/services/AuthService.js +5 -1
- package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +10 -7
- package/dist/cjs/src/generated/portal/services/FeaturesBlockedSeatsService.js +19 -7
- package/dist/cjs/src/generated/portal/services/OrderLookupService.d.ts +4 -3
- package/dist/cjs/src/generated/portal/services/OrderLookupService.js +7 -3
- package/dist/cjs/src/generated/scanner/core/request.d.ts +7 -10
- package/dist/cjs/src/generated/scanner/core/request.js +56 -37
- package/dist/cjs/src/generated/shopper/core/request.js +3 -1
- package/dist/cjs/src/scripts/build-all.js +9 -1
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/portal/core/request.js +3 -1
- package/dist/esm/src/generated/portal/services/AccountService.d.ts +12 -2
- package/dist/esm/src/generated/portal/services/AccountService.js +26 -2
- package/dist/esm/src/generated/portal/services/AuthService.d.ts +2 -1
- package/dist/esm/src/generated/portal/services/AuthService.js +5 -1
- package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.d.ts +10 -7
- package/dist/esm/src/generated/portal/services/FeaturesBlockedSeatsService.js +19 -7
- package/dist/esm/src/generated/portal/services/OrderLookupService.d.ts +4 -3
- package/dist/esm/src/generated/portal/services/OrderLookupService.js +7 -3
- package/dist/esm/src/generated/scanner/core/request.d.ts +7 -10
- package/dist/esm/src/generated/scanner/core/request.js +58 -39
- package/dist/esm/src/generated/shopper/core/request.js +3 -1
- package/dist/esm/src/scripts/build-all.js +9 -1
- package/index.ts +5 -0
- package/package.json +3 -1
- package/src/custom/custom-request.txt +7 -2
- package/src/generated/portal/core/OpenAPI.ts +1 -1
- package/src/generated/portal/core/request.ts +7 -2
- package/src/generated/portal/services/AccountService.ts +30 -1
- package/src/generated/portal/services/AuthService.ts +7 -1
- package/src/generated/portal/services/FeaturesBlockedSeatsService.ts +23 -6
- package/src/generated/portal/services/OrderLookupService.ts +7 -2
- package/src/generated/scanner/core/request.ts +331 -266
- package/src/generated/shopper/core/request.ts +7 -2
- package/src/scripts/build-all.ts +14 -1
|
@@ -140,11 +140,12 @@ export declare class OrderLookupService {
|
|
|
140
140
|
/**
|
|
141
141
|
* Change the type of the tier
|
|
142
142
|
* Toggle tier to another available type for the same seats
|
|
143
|
+
* @param xStudioId
|
|
143
144
|
* @param requestBody
|
|
144
145
|
* @returns ToggleTierResponseDto Tier type changed successfully
|
|
145
146
|
* @throws ApiError
|
|
146
147
|
*/
|
|
147
|
-
static toggleTier(requestBody: ToggleTierRequestDto): CancelablePromise<ToggleTierResponseDto>;
|
|
148
|
+
static toggleTier(xStudioId: string, requestBody: ToggleTierRequestDto): CancelablePromise<ToggleTierResponseDto>;
|
|
148
149
|
/**
|
|
149
150
|
* Get details of show and tier
|
|
150
151
|
* Fetch details of the show with tier details
|
|
@@ -240,13 +241,13 @@ export declare class OrderLookupService {
|
|
|
240
241
|
/**
|
|
241
242
|
* Toggle modify tier status for the order
|
|
242
243
|
* To toggle the modify tier status for the order
|
|
243
|
-
* @param orderId The ID of the order
|
|
244
244
|
* @param xStudioId The ID of the studio
|
|
245
|
+
* @param orderId The ID of the order
|
|
245
246
|
* @param requestBody Modify tier status details
|
|
246
247
|
* @returns ToggleModifyTierResponseDto Modify tier status toggled successfully
|
|
247
248
|
* @throws ApiError
|
|
248
249
|
*/
|
|
249
|
-
static toggleModifyTierStatus(
|
|
250
|
+
static toggleModifyTierStatus(xStudioId: string, orderId: string, requestBody: ToggleModifyTierRequestDto): CancelablePromise<ToggleModifyTierResponseDto>;
|
|
250
251
|
/**
|
|
251
252
|
* Add seats to session
|
|
252
253
|
* To add seats to the session for the order
|
|
@@ -245,14 +245,18 @@ class OrderLookupService {
|
|
|
245
245
|
/**
|
|
246
246
|
* Change the type of the tier
|
|
247
247
|
* Toggle tier to another available type for the same seats
|
|
248
|
+
* @param xStudioId
|
|
248
249
|
* @param requestBody
|
|
249
250
|
* @returns ToggleTierResponseDto Tier type changed successfully
|
|
250
251
|
* @throws ApiError
|
|
251
252
|
*/
|
|
252
|
-
static toggleTier(requestBody) {
|
|
253
|
+
static toggleTier(xStudioId, requestBody) {
|
|
253
254
|
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
254
255
|
method: 'POST',
|
|
255
256
|
url: '/order-lookup/toggle-tier',
|
|
257
|
+
headers: {
|
|
258
|
+
'x-studio-id': xStudioId,
|
|
259
|
+
},
|
|
256
260
|
body: requestBody,
|
|
257
261
|
mediaType: 'application/json',
|
|
258
262
|
});
|
|
@@ -460,13 +464,13 @@ class OrderLookupService {
|
|
|
460
464
|
/**
|
|
461
465
|
* Toggle modify tier status for the order
|
|
462
466
|
* To toggle the modify tier status for the order
|
|
463
|
-
* @param orderId The ID of the order
|
|
464
467
|
* @param xStudioId The ID of the studio
|
|
468
|
+
* @param orderId The ID of the order
|
|
465
469
|
* @param requestBody Modify tier status details
|
|
466
470
|
* @returns ToggleModifyTierResponseDto Modify tier status toggled successfully
|
|
467
471
|
* @throws ApiError
|
|
468
472
|
*/
|
|
469
|
-
static toggleModifyTierStatus(
|
|
473
|
+
static toggleModifyTierStatus(xStudioId, orderId, requestBody) {
|
|
470
474
|
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
471
475
|
method: 'PUT',
|
|
472
476
|
url: '/order-lookup/{orderId}/toggle-modify-tier',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ApiRequestOptions } from
|
|
2
|
-
import type { ApiResult } from
|
|
3
|
-
import { CancelablePromise } from
|
|
4
|
-
import type { OnCancel } from
|
|
5
|
-
import type { OpenAPIConfig } from
|
|
1
|
+
import type { ApiRequestOptions } from "./ApiRequestOptions";
|
|
2
|
+
import type { ApiResult } from "./ApiResult";
|
|
3
|
+
import { CancelablePromise } from "./CancelablePromise";
|
|
4
|
+
import type { OnCancel } from "./CancelablePromise";
|
|
5
|
+
import type { OpenAPIConfig } from "./OpenAPI";
|
|
6
6
|
export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
|
|
7
7
|
export declare const isString: (value: any) => value is string;
|
|
8
8
|
export declare const isStringWithValue: (value: any) => value is string;
|
|
@@ -20,11 +20,8 @@ export declare const getResponseHeader: (response: Response, responseHeader?: st
|
|
|
20
20
|
export declare const getResponseBody: (response: Response) => Promise<any>;
|
|
21
21
|
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param options The request options from the service
|
|
26
|
-
* @returns CancelablePromise<T>
|
|
27
|
-
* @throws ApiError
|
|
23
|
+
* Wraps sendRequest to capture cookies on login
|
|
24
|
+
* and attach cookies on other requests
|
|
28
25
|
*/
|
|
29
26
|
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
|
|
30
27
|
export {};
|
|
@@ -12,20 +12,20 @@ const isDefined = (value) => {
|
|
|
12
12
|
};
|
|
13
13
|
exports.isDefined = isDefined;
|
|
14
14
|
const isString = (value) => {
|
|
15
|
-
return typeof value ===
|
|
15
|
+
return typeof value === "string";
|
|
16
16
|
};
|
|
17
17
|
exports.isString = isString;
|
|
18
18
|
const isStringWithValue = (value) => {
|
|
19
|
-
return (0, exports.isString)(value) && value !==
|
|
19
|
+
return (0, exports.isString)(value) && value !== "";
|
|
20
20
|
};
|
|
21
21
|
exports.isStringWithValue = isStringWithValue;
|
|
22
22
|
const isBlob = (value) => {
|
|
23
|
-
return (typeof value ===
|
|
24
|
-
typeof value.type ===
|
|
25
|
-
typeof value.stream ===
|
|
26
|
-
typeof value.arrayBuffer ===
|
|
27
|
-
typeof value.constructor ===
|
|
28
|
-
typeof value.constructor.name ===
|
|
23
|
+
return (typeof value === "object" &&
|
|
24
|
+
typeof value.type === "string" &&
|
|
25
|
+
typeof value.stream === "function" &&
|
|
26
|
+
typeof value.arrayBuffer === "function" &&
|
|
27
|
+
typeof value.constructor === "function" &&
|
|
28
|
+
typeof value.constructor.name === "string" &&
|
|
29
29
|
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
30
30
|
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
31
31
|
};
|
|
@@ -40,7 +40,7 @@ const base64 = (str) => {
|
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
// @ts-ignore
|
|
43
|
-
return Buffer.from(str).toString(
|
|
43
|
+
return Buffer.from(str).toString("base64");
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
exports.base64 = base64;
|
|
@@ -52,11 +52,11 @@ const getQueryString = (params) => {
|
|
|
52
52
|
const process = (key, value) => {
|
|
53
53
|
if ((0, exports.isDefined)(value)) {
|
|
54
54
|
if (Array.isArray(value)) {
|
|
55
|
-
value.forEach(v => {
|
|
55
|
+
value.forEach((v) => {
|
|
56
56
|
process(key, v);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
else if (typeof value ===
|
|
59
|
+
else if (typeof value === "object") {
|
|
60
60
|
Object.entries(value).forEach(([k, v]) => {
|
|
61
61
|
process(`${key}[${k}]`, v);
|
|
62
62
|
});
|
|
@@ -70,15 +70,15 @@ const getQueryString = (params) => {
|
|
|
70
70
|
process(key, value);
|
|
71
71
|
});
|
|
72
72
|
if (qs.length > 0) {
|
|
73
|
-
return `?${qs.join(
|
|
73
|
+
return `?${qs.join("&")}`;
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return "";
|
|
76
76
|
};
|
|
77
77
|
exports.getQueryString = getQueryString;
|
|
78
78
|
const getUrl = (config, options) => {
|
|
79
79
|
const encoder = config.ENCODE_PATH || encodeURI;
|
|
80
80
|
const path = options.url
|
|
81
|
-
.replace(
|
|
81
|
+
.replace("{api-version}", config.VERSION)
|
|
82
82
|
.replace(/{(.*?)}/g, (substring, group) => {
|
|
83
83
|
var _a;
|
|
84
84
|
if ((_a = options.path) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(group)) {
|
|
@@ -107,7 +107,7 @@ const getFormData = (options) => {
|
|
|
107
107
|
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
108
108
|
.forEach(([key, value]) => {
|
|
109
109
|
if (Array.isArray(value)) {
|
|
110
|
-
value.forEach(v => process(key, v));
|
|
110
|
+
value.forEach((v) => process(key, v));
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
113
|
process(key, value);
|
|
@@ -119,7 +119,7 @@ const getFormData = (options) => {
|
|
|
119
119
|
};
|
|
120
120
|
exports.getFormData = getFormData;
|
|
121
121
|
const resolve = async (options, resolver) => {
|
|
122
|
-
if (typeof resolver ===
|
|
122
|
+
if (typeof resolver === "function") {
|
|
123
123
|
return resolver(options);
|
|
124
124
|
}
|
|
125
125
|
return resolver;
|
|
@@ -132,28 +132,30 @@ const getHeaders = async (config, options) => {
|
|
|
132
132
|
(0, exports.resolve)(options, config.PASSWORD),
|
|
133
133
|
(0, exports.resolve)(options, config.HEADERS),
|
|
134
134
|
]);
|
|
135
|
-
|
|
135
|
+
// Filter out undefined/null values from options.headers first
|
|
136
|
+
const optionsHeaders = Object.fromEntries(Object.entries(options.headers || {}).filter(([_, value]) => (0, exports.isDefined)(value)));
|
|
137
|
+
const headers = Object.entries(Object.assign(Object.assign({ Accept: "application/json" }, optionsHeaders), additionalHeaders))
|
|
136
138
|
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
137
139
|
.reduce((headers, [key, value]) => (Object.assign(Object.assign({}, headers), { [key]: String(value) })), {});
|
|
138
140
|
if ((0, exports.isStringWithValue)(token)) {
|
|
139
|
-
headers[
|
|
141
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
140
142
|
}
|
|
141
143
|
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
142
144
|
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
143
|
-
headers[
|
|
145
|
+
headers["Authorization"] = `Basic ${credentials}`;
|
|
144
146
|
}
|
|
145
147
|
if (options.body !== undefined) {
|
|
146
148
|
if (options.mediaType) {
|
|
147
|
-
headers[
|
|
149
|
+
headers["Content-Type"] = options.mediaType;
|
|
148
150
|
}
|
|
149
151
|
else if ((0, exports.isBlob)(options.body)) {
|
|
150
|
-
headers[
|
|
152
|
+
headers["Content-Type"] = options.body.type || "application/octet-stream";
|
|
151
153
|
}
|
|
152
154
|
else if ((0, exports.isString)(options.body)) {
|
|
153
|
-
headers[
|
|
155
|
+
headers["Content-Type"] = "text/plain";
|
|
154
156
|
}
|
|
155
157
|
else if (!(0, exports.isFormData)(options.body)) {
|
|
156
|
-
headers[
|
|
158
|
+
headers["Content-Type"] = "application/json";
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
return new Headers(headers);
|
|
@@ -162,10 +164,12 @@ exports.getHeaders = getHeaders;
|
|
|
162
164
|
const getRequestBody = (options) => {
|
|
163
165
|
var _a;
|
|
164
166
|
if (options.body !== undefined) {
|
|
165
|
-
if ((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes(
|
|
167
|
+
if ((_a = options.mediaType) === null || _a === void 0 ? void 0 : _a.includes("/json")) {
|
|
166
168
|
return JSON.stringify(options.body);
|
|
167
169
|
}
|
|
168
|
-
else if ((0, exports.isString)(options.body) ||
|
|
170
|
+
else if ((0, exports.isString)(options.body) ||
|
|
171
|
+
(0, exports.isBlob)(options.body) ||
|
|
172
|
+
(0, exports.isFormData)(options.body)) {
|
|
169
173
|
return options.body;
|
|
170
174
|
}
|
|
171
175
|
else {
|
|
@@ -203,10 +207,10 @@ exports.getResponseHeader = getResponseHeader;
|
|
|
203
207
|
const getResponseBody = async (response) => {
|
|
204
208
|
if (response.status !== 204) {
|
|
205
209
|
try {
|
|
206
|
-
const contentType = response.headers.get(
|
|
210
|
+
const contentType = response.headers.get("Content-Type");
|
|
207
211
|
if (contentType) {
|
|
208
|
-
const jsonTypes = [
|
|
209
|
-
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
212
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
213
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
210
214
|
if (isJSON) {
|
|
211
215
|
return await response.json();
|
|
212
216
|
}
|
|
@@ -224,14 +228,14 @@ const getResponseBody = async (response) => {
|
|
|
224
228
|
exports.getResponseBody = getResponseBody;
|
|
225
229
|
const catchErrorCodes = (options, result) => {
|
|
226
230
|
var _a, _b;
|
|
227
|
-
const errors = Object.assign({ 400:
|
|
231
|
+
const errors = Object.assign({ 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", 500: "Internal Server Error", 502: "Bad Gateway", 503: "Service Unavailable" }, options.errors);
|
|
228
232
|
const error = errors[result.status];
|
|
229
233
|
if (error) {
|
|
230
234
|
throw new ApiError_1.ApiError(options, result, error);
|
|
231
235
|
}
|
|
232
236
|
if (!result.ok) {
|
|
233
|
-
const errorStatus = (_a = result.status) !== null && _a !== void 0 ? _a :
|
|
234
|
-
const errorStatusText = (_b = result.statusText) !== null && _b !== void 0 ? _b :
|
|
237
|
+
const errorStatus = (_a = result.status) !== null && _a !== void 0 ? _a : "unknown";
|
|
238
|
+
const errorStatusText = (_b = result.statusText) !== null && _b !== void 0 ? _b : "unknown";
|
|
235
239
|
const errorBody = (() => {
|
|
236
240
|
try {
|
|
237
241
|
return JSON.stringify(result.body, null, 2);
|
|
@@ -244,12 +248,10 @@ const catchErrorCodes = (options, result) => {
|
|
|
244
248
|
}
|
|
245
249
|
};
|
|
246
250
|
exports.catchErrorCodes = catchErrorCodes;
|
|
251
|
+
let globalCookieHeader;
|
|
247
252
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* @param options The request options from the service
|
|
251
|
-
* @returns CancelablePromise<T>
|
|
252
|
-
* @throws ApiError
|
|
253
|
+
* Wraps sendRequest to capture cookies on login
|
|
254
|
+
* and attach cookies on other requests
|
|
253
255
|
*/
|
|
254
256
|
const request = (config, options) => {
|
|
255
257
|
return new CancelablePromise_1.CancelablePromise(async (resolve, reject, onCancel) => {
|
|
@@ -257,9 +259,26 @@ const request = (config, options) => {
|
|
|
257
259
|
const url = getUrl(config, options);
|
|
258
260
|
const formData = (0, exports.getFormData)(options);
|
|
259
261
|
const body = (0, exports.getRequestBody)(options);
|
|
260
|
-
|
|
262
|
+
// Before making headers, possibly attach cookie if we have it
|
|
263
|
+
const baseHeaders = await (0, exports.getHeaders)(config, options);
|
|
264
|
+
// We will build combined headers
|
|
265
|
+
const headerObj = {};
|
|
266
|
+
baseHeaders.forEach((value, key) => {
|
|
267
|
+
headerObj[key] = value;
|
|
268
|
+
});
|
|
269
|
+
if (globalCookieHeader) {
|
|
270
|
+
// Attach stored cookie
|
|
271
|
+
headerObj["Cookie"] = globalCookieHeader;
|
|
272
|
+
}
|
|
273
|
+
const headers = new Headers(headerObj);
|
|
261
274
|
if (!onCancel.isCancelled) {
|
|
262
275
|
const response = await (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel);
|
|
276
|
+
// Capture Set-Cookie if present
|
|
277
|
+
const setCookie = response.headers.get("set-cookie");
|
|
278
|
+
if (setCookie) {
|
|
279
|
+
// Overwrite or append as needed
|
|
280
|
+
globalCookieHeader = setCookie;
|
|
281
|
+
}
|
|
263
282
|
const responseBody = await (0, exports.getResponseBody)(response);
|
|
264
283
|
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
265
284
|
const result = {
|
|
@@ -132,7 +132,9 @@ const getHeaders = async (config, options) => {
|
|
|
132
132
|
(0, exports.resolve)(options, config.PASSWORD),
|
|
133
133
|
(0, exports.resolve)(options, config.HEADERS),
|
|
134
134
|
]);
|
|
135
|
-
|
|
135
|
+
// Filter out undefined/null values from options.headers first
|
|
136
|
+
const optionsHeaders = Object.fromEntries(Object.entries(options.headers || {}).filter(([_, value]) => (0, exports.isDefined)(value)));
|
|
137
|
+
const headers = Object.entries(Object.assign(Object.assign({ Accept: "application/json" }, optionsHeaders), additionalHeaders))
|
|
136
138
|
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
137
139
|
.reduce((headers, [key, value]) => (Object.assign(Object.assign({}, headers), { [key]: String(value) })), {});
|
|
138
140
|
if ((0, exports.isStringWithValue)(token)) {
|
|
@@ -51,15 +51,18 @@ for (const spec of specs) {
|
|
|
51
51
|
shell: true,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
// After generating all clients and definitions, replace request.ts for
|
|
54
|
+
// After generating all clients and definitions, replace request.ts for all services
|
|
55
55
|
const customRequestPath = path_1.default.resolve('src/custom/custom-request.txt');
|
|
56
56
|
const shopperRequestPath = path_1.default.resolve('src/generated/shopper/core/request.ts');
|
|
57
57
|
const portalRequestPath = path_1.default.resolve('src/generated/portal/core/request.ts');
|
|
58
|
+
const scannerRequestPath = path_1.default.resolve('src/generated/scanner/core/request.ts');
|
|
58
59
|
const customRequestContent = fs_1.default.readFileSync(customRequestPath, 'utf-8');
|
|
59
60
|
fs_1.default.writeFileSync(shopperRequestPath, customRequestContent);
|
|
60
61
|
console.log('✅ Replaced shopper/core/request.ts with custom-request.txt');
|
|
61
62
|
fs_1.default.writeFileSync(portalRequestPath, customRequestContent);
|
|
62
63
|
console.log('✅ Replaced portal/core/request.ts with custom-request.txt');
|
|
64
|
+
fs_1.default.writeFileSync(scannerRequestPath, customRequestContent);
|
|
65
|
+
console.log('✅ Replaced scanner/core/request.ts with custom-request.txt');
|
|
63
66
|
// --- Generate index.ts
|
|
64
67
|
console.log(`🧩 Generating DRT index...`);
|
|
65
68
|
const lines = [];
|
|
@@ -70,6 +73,7 @@ for (const spec of specs) {
|
|
|
70
73
|
lines.push(`import { ${name} } from "./src/definitions/${name}";`);
|
|
71
74
|
}
|
|
72
75
|
lines.push(`import { setBaseUrlsOnce } from "./src/functions/setBaseURL";`);
|
|
76
|
+
lines.push(`import { init, isReady, getConfig, reset } from "./src/functions/sdkConfig";`);
|
|
73
77
|
lines.push('');
|
|
74
78
|
// Re-export type namespaces for easy access
|
|
75
79
|
for (const spec of specs) {
|
|
@@ -82,6 +86,10 @@ lines.push('export const DRT = {');
|
|
|
82
86
|
for (const spec of specs) {
|
|
83
87
|
lines.push(` ${spec.name.toLowerCase()},`);
|
|
84
88
|
}
|
|
89
|
+
lines.push(' init,');
|
|
90
|
+
lines.push(' isReady,');
|
|
91
|
+
lines.push(' getConfig,');
|
|
92
|
+
lines.push(' reset,');
|
|
85
93
|
lines.push('};');
|
|
86
94
|
lines.push('');
|
|
87
95
|
lines.push('setBaseUrlsOnce();');
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { init, isReady, getConfig, reset } from "./src/functions/sdkConfig";
|
|
1
2
|
export { ShopperTypes } from "./src/definitions/shopper";
|
|
2
3
|
export { ScannerTypes } from "./src/definitions/scanner";
|
|
3
4
|
export { PortalTypes } from "./src/definitions/portal";
|
|
@@ -52,5 +53,9 @@ export declare const DRT: {
|
|
|
52
53
|
settings: typeof import("./src/generated/portal").SettingsService;
|
|
53
54
|
shows: typeof import("./src/generated/portal").ShowsService;
|
|
54
55
|
};
|
|
56
|
+
init: typeof init;
|
|
57
|
+
isReady: typeof isReady;
|
|
58
|
+
getConfig: typeof getConfig;
|
|
59
|
+
reset: typeof reset;
|
|
55
60
|
};
|
|
56
61
|
export type DRT = typeof DRT;
|
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { shopper } from "./src/definitions/shopper.js";
|
|
|
3
3
|
import { scanner } from "./src/definitions/scanner.js";
|
|
4
4
|
import { portal } from "./src/definitions/portal.js";
|
|
5
5
|
import { setBaseUrlsOnce } from "./src/functions/setBaseURL.js";
|
|
6
|
+
import { init, isReady, getConfig, reset } from "./src/functions/sdkConfig.js";
|
|
6
7
|
export { ShopperTypes } from "./src/definitions/shopper.js";
|
|
7
8
|
export { ScannerTypes } from "./src/definitions/scanner.js";
|
|
8
9
|
export { PortalTypes } from "./src/definitions/portal.js";
|
|
@@ -10,5 +11,9 @@ export const DRT = {
|
|
|
10
11
|
shopper,
|
|
11
12
|
scanner,
|
|
12
13
|
portal,
|
|
14
|
+
init,
|
|
15
|
+
isReady,
|
|
16
|
+
getConfig,
|
|
17
|
+
reset,
|
|
13
18
|
};
|
|
14
19
|
setBaseUrlsOnce();
|
|
@@ -120,7 +120,9 @@ export const getHeaders = async (config, options) => {
|
|
|
120
120
|
resolve(options, config.PASSWORD),
|
|
121
121
|
resolve(options, config.HEADERS),
|
|
122
122
|
]);
|
|
123
|
-
|
|
123
|
+
// Filter out undefined/null values from options.headers first
|
|
124
|
+
const optionsHeaders = Object.fromEntries(Object.entries(options.headers || {}).filter(([_, value]) => isDefined(value)));
|
|
125
|
+
const headers = Object.entries(Object.assign(Object.assign({ Accept: "application/json" }, optionsHeaders), additionalHeaders))
|
|
124
126
|
.filter(([_, value]) => isDefined(value))
|
|
125
127
|
.reduce((headers, [key, value]) => (Object.assign(Object.assign({}, headers), { [key]: String(value) })), {});
|
|
126
128
|
if (isStringWithValue(token)) {
|
|
@@ -8,10 +8,11 @@ export declare class AccountService {
|
|
|
8
8
|
/**
|
|
9
9
|
* Fetch the portal object details
|
|
10
10
|
* To fetch the portal object details
|
|
11
|
+
* @param xStudioId
|
|
11
12
|
* @returns MappedPortalObjectPermission Account created successfully
|
|
12
13
|
* @throws ApiError
|
|
13
14
|
*/
|
|
14
|
-
static getPortalObject(): CancelablePromise<Array<MappedPortalObjectPermission>>;
|
|
15
|
+
static getPortalObject(xStudioId: string): CancelablePromise<Array<MappedPortalObjectPermission>>;
|
|
15
16
|
/**
|
|
16
17
|
* Creating the account
|
|
17
18
|
* To create account and update the permissions
|
|
@@ -24,12 +25,13 @@ export declare class AccountService {
|
|
|
24
25
|
/**
|
|
25
26
|
* Permissions to be updated
|
|
26
27
|
* To update the permissions of the user
|
|
28
|
+
* @param xStudioId
|
|
27
29
|
* @param id The ID of the user
|
|
28
30
|
* @param requestBody Permissions to be updated
|
|
29
31
|
* @returns SuccessResponse Permission updated successfully
|
|
30
32
|
* @throws ApiError
|
|
31
33
|
*/
|
|
32
|
-
static updatePermission(id: string, requestBody: Array<PortalObjectRequestDto>): CancelablePromise<SuccessResponse>;
|
|
34
|
+
static updatePermission(xStudioId: string, id: string, requestBody: Array<PortalObjectRequestDto>): CancelablePromise<SuccessResponse>;
|
|
33
35
|
/**
|
|
34
36
|
* Delete user
|
|
35
37
|
* To delete the user
|
|
@@ -47,4 +49,12 @@ export declare class AccountService {
|
|
|
47
49
|
* @throws ApiError
|
|
48
50
|
*/
|
|
49
51
|
static renewPolicy(xStudioId: string, policyId: string): CancelablePromise<SuccessResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear user permissions cache
|
|
54
|
+
* To clear the cached permissions for a specific studio login
|
|
55
|
+
* @param studioLoginId The studio login ID to clear cache for
|
|
56
|
+
* @returns SuccessResponse Cache cleared successfully
|
|
57
|
+
* @throws ApiError
|
|
58
|
+
*/
|
|
59
|
+
static clearPermissionsCache(studioLoginId: string): CancelablePromise<SuccessResponse>;
|
|
50
60
|
}
|
|
@@ -4,13 +4,17 @@ export class AccountService {
|
|
|
4
4
|
/**
|
|
5
5
|
* Fetch the portal object details
|
|
6
6
|
* To fetch the portal object details
|
|
7
|
+
* @param xStudioId
|
|
7
8
|
* @returns MappedPortalObjectPermission Account created successfully
|
|
8
9
|
* @throws ApiError
|
|
9
10
|
*/
|
|
10
|
-
static getPortalObject() {
|
|
11
|
+
static getPortalObject(xStudioId) {
|
|
11
12
|
return __request(OpenAPI, {
|
|
12
13
|
method: 'GET',
|
|
13
14
|
url: '/account/permission',
|
|
15
|
+
headers: {
|
|
16
|
+
'x-studio-id': xStudioId,
|
|
17
|
+
},
|
|
14
18
|
});
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
@@ -35,18 +39,22 @@ export class AccountService {
|
|
|
35
39
|
/**
|
|
36
40
|
* Permissions to be updated
|
|
37
41
|
* To update the permissions of the user
|
|
42
|
+
* @param xStudioId
|
|
38
43
|
* @param id The ID of the user
|
|
39
44
|
* @param requestBody Permissions to be updated
|
|
40
45
|
* @returns SuccessResponse Permission updated successfully
|
|
41
46
|
* @throws ApiError
|
|
42
47
|
*/
|
|
43
|
-
static updatePermission(id, requestBody) {
|
|
48
|
+
static updatePermission(xStudioId, id, requestBody) {
|
|
44
49
|
return __request(OpenAPI, {
|
|
45
50
|
method: 'PUT',
|
|
46
51
|
url: '/account/{id}',
|
|
47
52
|
path: {
|
|
48
53
|
'id': id,
|
|
49
54
|
},
|
|
55
|
+
headers: {
|
|
56
|
+
'x-studio-id': xStudioId,
|
|
57
|
+
},
|
|
50
58
|
body: requestBody,
|
|
51
59
|
mediaType: 'application/json',
|
|
52
60
|
});
|
|
@@ -87,4 +95,20 @@ export class AccountService {
|
|
|
87
95
|
},
|
|
88
96
|
});
|
|
89
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Clear user permissions cache
|
|
100
|
+
* To clear the cached permissions for a specific studio login
|
|
101
|
+
* @param studioLoginId The studio login ID to clear cache for
|
|
102
|
+
* @returns SuccessResponse Cache cleared successfully
|
|
103
|
+
* @throws ApiError
|
|
104
|
+
*/
|
|
105
|
+
static clearPermissionsCache(studioLoginId) {
|
|
106
|
+
return __request(OpenAPI, {
|
|
107
|
+
method: 'POST',
|
|
108
|
+
url: '/account/cache',
|
|
109
|
+
query: {
|
|
110
|
+
'studio_login_id': studioLoginId,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
90
114
|
}
|
|
@@ -37,10 +37,11 @@ export declare class AuthService {
|
|
|
37
37
|
/**
|
|
38
38
|
* Logging out the user
|
|
39
39
|
* Logging out the user
|
|
40
|
+
* @param xStudioId
|
|
40
41
|
* @returns SuccessResponse Logout successful
|
|
41
42
|
* @throws ApiError
|
|
42
43
|
*/
|
|
43
|
-
static logout(): CancelablePromise<SuccessResponse>;
|
|
44
|
+
static logout(xStudioId: string): CancelablePromise<SuccessResponse>;
|
|
44
45
|
/**
|
|
45
46
|
* Change Password
|
|
46
47
|
* Change the user password
|
|
@@ -61,13 +61,17 @@ export class AuthService {
|
|
|
61
61
|
/**
|
|
62
62
|
* Logging out the user
|
|
63
63
|
* Logging out the user
|
|
64
|
+
* @param xStudioId
|
|
64
65
|
* @returns SuccessResponse Logout successful
|
|
65
66
|
* @throws ApiError
|
|
66
67
|
*/
|
|
67
|
-
static logout() {
|
|
68
|
+
static logout(xStudioId) {
|
|
68
69
|
return __request(OpenAPI, {
|
|
69
70
|
method: 'POST',
|
|
70
71
|
url: '/auth/logout',
|
|
72
|
+
headers: {
|
|
73
|
+
'x-studio-id': xStudioId,
|
|
74
|
+
},
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
/**
|
|
@@ -60,28 +60,29 @@ export declare class FeaturesBlockedSeatsService {
|
|
|
60
60
|
/**
|
|
61
61
|
* Fetch the selected seats
|
|
62
62
|
* Fetch the selected seats
|
|
63
|
+
* @param xStudioId
|
|
63
64
|
* @returns BlockedSeatDetailResponseDto Selected seats fetched successfully
|
|
64
65
|
* @throws ApiError
|
|
65
66
|
*/
|
|
66
|
-
static getSelectedSeats(): CancelablePromise<Array<BlockedSeatDetailResponseDto>>;
|
|
67
|
+
static getSelectedSeats(xStudioId: string): CancelablePromise<Array<BlockedSeatDetailResponseDto>>;
|
|
67
68
|
/**
|
|
68
69
|
* Initialize the seat engine for a show
|
|
69
70
|
* Initialize the seat engine for a show
|
|
70
|
-
* @param showId The ID of the show
|
|
71
71
|
* @param xStudioId The ID of the studio
|
|
72
|
+
* @param showId The ID of the show
|
|
72
73
|
* @returns SuccessResponse Show initialized successfully
|
|
73
74
|
* @throws ApiError
|
|
74
75
|
*/
|
|
75
|
-
static initializeSeatEngine(
|
|
76
|
+
static initializeSeatEngine(xStudioId: string, showId: string): CancelablePromise<SuccessResponse>;
|
|
76
77
|
/**
|
|
77
78
|
* Fetch the seat engine occupancy for a show
|
|
78
79
|
* Fetch the seat engine occupancy for a show
|
|
79
|
-
* @param showId The ID of the show
|
|
80
80
|
* @param xStudioId The ID of the studio
|
|
81
|
+
* @param showId The ID of the show
|
|
81
82
|
* @returns any Show occupancy fetched successfully
|
|
82
83
|
* @throws ApiError
|
|
83
84
|
*/
|
|
84
|
-
static getSeatEngineOccupancy(
|
|
85
|
+
static getSeatEngineOccupancy(xStudioId: string, showId: string): CancelablePromise<any>;
|
|
85
86
|
/**
|
|
86
87
|
* Check the selected seats against show
|
|
87
88
|
* Check the selected seats against show
|
|
@@ -214,17 +215,19 @@ export declare class FeaturesBlockedSeatsService {
|
|
|
214
215
|
/**
|
|
215
216
|
* Release all seats
|
|
216
217
|
* Release all seats
|
|
218
|
+
* @param xStudioId
|
|
217
219
|
* @returns SuccessResponse Seats released successfully
|
|
218
220
|
* @throws ApiError
|
|
219
221
|
*/
|
|
220
|
-
static releaseAllSeats(): CancelablePromise<SuccessResponse>;
|
|
222
|
+
static releaseAllSeats(xStudioId: string): CancelablePromise<SuccessResponse>;
|
|
221
223
|
/**
|
|
222
224
|
* Toggle the seat in cart ticket
|
|
223
225
|
* Toggle the seat in cart ticket
|
|
226
|
+
* @param xStudioId
|
|
224
227
|
* @param showId The ID of the show
|
|
225
228
|
* @param seatId The ID of the seat
|
|
226
229
|
* @returns CartToggleTickerResponseDto Seat toggled successfully
|
|
227
230
|
* @throws ApiError
|
|
228
231
|
*/
|
|
229
|
-
static toggleSeatInCartTicket(showId: string, seatId: string): CancelablePromise<CartToggleTickerResponseDto>;
|
|
232
|
+
static toggleSeatInCartTicket(xStudioId: string, showId: string, seatId: string): CancelablePromise<CartToggleTickerResponseDto>;
|
|
230
233
|
}
|