@drttix/drt-sdk 1.3.2 → 1.3.3
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 +0 -2
- package/dist/cjs/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/portal/services/ShowsService.d.ts +4 -2
- package/dist/cjs/src/generated/portal/services/ShowsService.js +10 -4
- package/dist/cjs/src/generated/shopper/core/OpenAPI.js +1 -1
- package/dist/cjs/src/generated/shopper/models/Account.d.ts +10 -0
- package/dist/cjs/src/generated/shopper/models/SessionInfoDto.d.ts +9 -0
- package/dist/cjs/src/scripts/build-all.js +15 -10
- package/dist/esm/src/generated/portal/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/portal/services/ShowsService.d.ts +4 -2
- package/dist/esm/src/generated/portal/services/ShowsService.js +10 -4
- package/dist/esm/src/generated/shopper/core/OpenAPI.js +1 -1
- package/dist/esm/src/generated/shopper/models/Account.d.ts +10 -0
- package/dist/esm/src/generated/shopper/models/SessionInfoDto.d.ts +9 -0
- package/dist/esm/src/scripts/build-all.js +16 -11
- package/package.json +2 -2
- package/src/generated/portal/core/OpenAPI.ts +1 -1
- package/src/generated/portal/services/ShowsService.ts +11 -3
- package/src/generated/shopper/core/OpenAPI.ts +1 -1
- package/src/generated/shopper/models/Account.ts +10 -0
- package/src/generated/shopper/models/SessionInfoDto.ts +9 -0
- package/src/scripts/build-all.ts +23 -22
package/azure-pipelines.yml
CHANGED
|
@@ -51,7 +51,6 @@ steps:
|
|
|
51
51
|
scriptType: 'inline'
|
|
52
52
|
inlineScript: |
|
|
53
53
|
aws s3 cp $(Build.SourcesDirectory)/dist/bundle/drt-sdk.js s3://drt-public-assets/sdk/$(VERSION)/drt-sdk.js --cache-control "max-age=31536000,public,immutable"
|
|
54
|
-
aws s3 cp $(Build.SourcesDirectory)/dist/bundle/staging.js s3://drt-public-assets/sdk/$(VERSION)/staging.js --cache-control "max-age=31536000,public,immutable"
|
|
55
54
|
|
|
56
55
|
- task: AWSShellScript@1
|
|
57
56
|
displayName: 'Upload to latest'
|
|
@@ -61,7 +60,6 @@ steps:
|
|
|
61
60
|
scriptType: 'inline'
|
|
62
61
|
inlineScript: |
|
|
63
62
|
aws s3 cp $(Build.SourcesDirectory)/dist/bundle/drt-sdk.js s3://drt-public-assets/sdk/latest/drt-sdk.js --cache-control "max-age=0,no-cache,no-store,must-revalidate"
|
|
64
|
-
aws s3 cp $(Build.SourcesDirectory)/dist/bundle/staging.js s3://drt-public-assets/sdk/latest/staging.js --cache-control "max-age=0,no-cache,no-store,must-revalidate"
|
|
65
63
|
|
|
66
64
|
- task: AWSShellScript@1
|
|
67
65
|
displayName: 'Upload demo files'
|
|
@@ -121,11 +121,13 @@ export declare class ShowsService {
|
|
|
121
121
|
/**
|
|
122
122
|
* Fetch the show virtual stream details
|
|
123
123
|
* To fetch the virtual stream details of the show
|
|
124
|
-
* @param guid
|
|
124
|
+
* @param guid
|
|
125
|
+
* @param shopperGuid Unique identifier for an shopper.
|
|
126
|
+
* @param showId The ID of the show
|
|
125
127
|
* @returns VirtualStreamResponseDto Virtual stream details fetched successfully
|
|
126
128
|
* @throws ApiError
|
|
127
129
|
*/
|
|
128
|
-
static getShowVirtualStream(guid: string): CancelablePromise<VirtualStreamResponseDto>;
|
|
130
|
+
static getShowVirtualStream(guid: string, shopperGuid: any, showId: string): CancelablePromise<VirtualStreamResponseDto>;
|
|
129
131
|
/**
|
|
130
132
|
* Fetch the migrate ticket details
|
|
131
133
|
* To fetch the migrate ticket details of the show
|
|
@@ -202,16 +202,22 @@ class ShowsService {
|
|
|
202
202
|
/**
|
|
203
203
|
* Fetch the show virtual stream details
|
|
204
204
|
* To fetch the virtual stream details of the show
|
|
205
|
-
* @param guid
|
|
205
|
+
* @param guid
|
|
206
|
+
* @param shopperGuid Unique identifier for an shopper.
|
|
207
|
+
* @param showId The ID of the show
|
|
206
208
|
* @returns VirtualStreamResponseDto Virtual stream details fetched successfully
|
|
207
209
|
* @throws ApiError
|
|
208
210
|
*/
|
|
209
|
-
static getShowVirtualStream(guid) {
|
|
211
|
+
static getShowVirtualStream(guid, shopperGuid, showId) {
|
|
210
212
|
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
211
213
|
method: 'GET',
|
|
212
|
-
url: '/shows/{
|
|
214
|
+
url: '/shows/{showId}/virtual-stream',
|
|
213
215
|
path: {
|
|
216
|
+
'showId': showId,
|
|
217
|
+
},
|
|
218
|
+
query: {
|
|
214
219
|
'guid': guid,
|
|
220
|
+
'shopperGuid': shopperGuid,
|
|
215
221
|
},
|
|
216
222
|
});
|
|
217
223
|
}
|
|
@@ -344,7 +350,7 @@ class ShowsService {
|
|
|
344
350
|
static createShow(xStudioId, requestBody) {
|
|
345
351
|
return (0, request_1.request)(OpenAPI_1.OpenAPI, {
|
|
346
352
|
method: 'POST',
|
|
347
|
-
url: '/shows/
|
|
353
|
+
url: '/shows/new',
|
|
348
354
|
headers: {
|
|
349
355
|
'x-studio-id': xStudioId,
|
|
350
356
|
},
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OpenAPI = void 0;
|
|
4
4
|
exports.OpenAPI = {
|
|
5
5
|
BASE: 'https://api.drttix.com/shopper',
|
|
6
|
-
VERSION: '
|
|
6
|
+
VERSION: '20260622.1',
|
|
7
7
|
WITH_CREDENTIALS: false,
|
|
8
8
|
CREDENTIALS: 'include',
|
|
9
9
|
TOKEN: undefined,
|
|
@@ -49,4 +49,14 @@ export type Account = {
|
|
|
49
49
|
csPhone: string;
|
|
50
50
|
numCouponAliases: number;
|
|
51
51
|
maxOrderSeats: number;
|
|
52
|
+
receiptFrom: string | null;
|
|
53
|
+
refundExchangePolicy: string | null;
|
|
54
|
+
eTickets: number;
|
|
55
|
+
canAssignTickets: number;
|
|
56
|
+
canEmailTickets: number;
|
|
57
|
+
enableOrderDonation: number;
|
|
58
|
+
obfuscateData: number;
|
|
59
|
+
paymentGatewayId: number | null;
|
|
60
|
+
enableAdjustmentPayment: number;
|
|
61
|
+
groupShows: number;
|
|
52
62
|
};
|
|
@@ -14,4 +14,13 @@ export type SessionInfoDto = {
|
|
|
14
14
|
superuser: boolean;
|
|
15
15
|
expireOnUnlock: boolean;
|
|
16
16
|
tierReminderShown: boolean;
|
|
17
|
+
modifyingOrderId: number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Resolved session/cart effective date (legacy cart_sessionDate). Use this for availability/priority checks instead of new Date().
|
|
20
|
+
*/
|
|
21
|
+
effectiveDate: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether an admin/preview date override is active.
|
|
24
|
+
*/
|
|
25
|
+
usingDateOverride: boolean;
|
|
17
26
|
};
|
|
@@ -6,6 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const child_process_1 = require("child_process");
|
|
9
|
+
// On Windows, execFileSync with shell:true joins args without quoting, so paths
|
|
10
|
+
// containing spaces are split. Use execSync with manual quoting on Windows instead.
|
|
11
|
+
function runCommand(cmd, args) {
|
|
12
|
+
if (process.platform === 'win32') {
|
|
13
|
+
const quotedArgs = args.map((a) => (a.includes(' ') ? `"${a}"` : a));
|
|
14
|
+
(0, child_process_1.execSync)([cmd, ...quotedArgs].join(' '), { stdio: 'inherit' });
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
(0, child_process_1.execFileSync)(cmd, args, { stdio: 'inherit' });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
9
20
|
// Load the spec list (use staging specs when --staging flag is passed)
|
|
10
21
|
const isStaging = process.argv.includes('--staging');
|
|
11
22
|
const specsFile = isStaging
|
|
@@ -27,11 +38,8 @@ for (const spec of specs) {
|
|
|
27
38
|
const tempSpecFile = path_1.default.join(process.cwd(), `${name}-spec.json`);
|
|
28
39
|
try {
|
|
29
40
|
console.log(`📥 Downloading spec from ${url}...`);
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
shell: true,
|
|
33
|
-
});
|
|
34
|
-
(0, child_process_1.execFileSync)(NPX_CMD, [
|
|
41
|
+
runCommand(CURL_CMD, ['-s', '-o', tempSpecFile, url]);
|
|
42
|
+
runCommand(NPX_CMD, [
|
|
35
43
|
'openapi-typescript-codegen',
|
|
36
44
|
'--input',
|
|
37
45
|
tempSpecFile,
|
|
@@ -39,7 +47,7 @@ for (const spec of specs) {
|
|
|
39
47
|
outputDir,
|
|
40
48
|
'--client',
|
|
41
49
|
'fetch',
|
|
42
|
-
]
|
|
50
|
+
]);
|
|
43
51
|
// Clean up temp file
|
|
44
52
|
fs_1.default.unlinkSync(tempSpecFile);
|
|
45
53
|
}
|
|
@@ -51,10 +59,7 @@ for (const spec of specs) {
|
|
|
51
59
|
throw error;
|
|
52
60
|
}
|
|
53
61
|
console.log(`⚙️ Generating wrapper for ${name}...`);
|
|
54
|
-
(
|
|
55
|
-
stdio: 'inherit',
|
|
56
|
-
shell: true,
|
|
57
|
-
});
|
|
62
|
+
runCommand(NPX_CMD, ['tsx', 'src/scripts/generate-definition.ts', name]);
|
|
58
63
|
}
|
|
59
64
|
// After generating all clients and definitions, replace request.ts for all services
|
|
60
65
|
const customRequestPath = path_1.default.resolve('src/custom/custom-request.txt');
|
|
@@ -121,11 +121,13 @@ export declare class ShowsService {
|
|
|
121
121
|
/**
|
|
122
122
|
* Fetch the show virtual stream details
|
|
123
123
|
* To fetch the virtual stream details of the show
|
|
124
|
-
* @param guid
|
|
124
|
+
* @param guid
|
|
125
|
+
* @param shopperGuid Unique identifier for an shopper.
|
|
126
|
+
* @param showId The ID of the show
|
|
125
127
|
* @returns VirtualStreamResponseDto Virtual stream details fetched successfully
|
|
126
128
|
* @throws ApiError
|
|
127
129
|
*/
|
|
128
|
-
static getShowVirtualStream(guid: string): CancelablePromise<VirtualStreamResponseDto>;
|
|
130
|
+
static getShowVirtualStream(guid: string, shopperGuid: any, showId: string): CancelablePromise<VirtualStreamResponseDto>;
|
|
129
131
|
/**
|
|
130
132
|
* Fetch the migrate ticket details
|
|
131
133
|
* To fetch the migrate ticket details of the show
|
|
@@ -199,16 +199,22 @@ export class ShowsService {
|
|
|
199
199
|
/**
|
|
200
200
|
* Fetch the show virtual stream details
|
|
201
201
|
* To fetch the virtual stream details of the show
|
|
202
|
-
* @param guid
|
|
202
|
+
* @param guid
|
|
203
|
+
* @param shopperGuid Unique identifier for an shopper.
|
|
204
|
+
* @param showId The ID of the show
|
|
203
205
|
* @returns VirtualStreamResponseDto Virtual stream details fetched successfully
|
|
204
206
|
* @throws ApiError
|
|
205
207
|
*/
|
|
206
|
-
static getShowVirtualStream(guid) {
|
|
208
|
+
static getShowVirtualStream(guid, shopperGuid, showId) {
|
|
207
209
|
return __request(OpenAPI, {
|
|
208
210
|
method: 'GET',
|
|
209
|
-
url: '/shows/{
|
|
211
|
+
url: '/shows/{showId}/virtual-stream',
|
|
210
212
|
path: {
|
|
213
|
+
'showId': showId,
|
|
214
|
+
},
|
|
215
|
+
query: {
|
|
211
216
|
'guid': guid,
|
|
217
|
+
'shopperGuid': shopperGuid,
|
|
212
218
|
},
|
|
213
219
|
});
|
|
214
220
|
}
|
|
@@ -341,7 +347,7 @@ export class ShowsService {
|
|
|
341
347
|
static createShow(xStudioId, requestBody) {
|
|
342
348
|
return __request(OpenAPI, {
|
|
343
349
|
method: 'POST',
|
|
344
|
-
url: '/shows/
|
|
350
|
+
url: '/shows/new',
|
|
345
351
|
headers: {
|
|
346
352
|
'x-studio-id': xStudioId,
|
|
347
353
|
},
|
|
@@ -49,4 +49,14 @@ export type Account = {
|
|
|
49
49
|
csPhone: string;
|
|
50
50
|
numCouponAliases: number;
|
|
51
51
|
maxOrderSeats: number;
|
|
52
|
+
receiptFrom: string | null;
|
|
53
|
+
refundExchangePolicy: string | null;
|
|
54
|
+
eTickets: number;
|
|
55
|
+
canAssignTickets: number;
|
|
56
|
+
canEmailTickets: number;
|
|
57
|
+
enableOrderDonation: number;
|
|
58
|
+
obfuscateData: number;
|
|
59
|
+
paymentGatewayId: number | null;
|
|
60
|
+
enableAdjustmentPayment: number;
|
|
61
|
+
groupShows: number;
|
|
52
62
|
};
|
|
@@ -14,4 +14,13 @@ export type SessionInfoDto = {
|
|
|
14
14
|
superuser: boolean;
|
|
15
15
|
expireOnUnlock: boolean;
|
|
16
16
|
tierReminderShown: boolean;
|
|
17
|
+
modifyingOrderId: number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Resolved session/cart effective date (legacy cart_sessionDate). Use this for availability/priority checks instead of new Date().
|
|
20
|
+
*/
|
|
21
|
+
effectiveDate: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether an admin/preview date override is active.
|
|
24
|
+
*/
|
|
25
|
+
usingDateOverride: boolean;
|
|
17
26
|
};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { execFileSync } from 'child_process';
|
|
3
|
+
import { execSync, execFileSync } from 'child_process';
|
|
4
|
+
// On Windows, execFileSync with shell:true joins args without quoting, so paths
|
|
5
|
+
// containing spaces are split. Use execSync with manual quoting on Windows instead.
|
|
6
|
+
function runCommand(cmd, args) {
|
|
7
|
+
if (process.platform === 'win32') {
|
|
8
|
+
const quotedArgs = args.map((a) => (a.includes(' ') ? `"${a}"` : a));
|
|
9
|
+
execSync([cmd, ...quotedArgs].join(' '), { stdio: 'inherit' });
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
execFileSync(cmd, args, { stdio: 'inherit' });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
4
15
|
// Load the spec list (use staging specs when --staging flag is passed)
|
|
5
16
|
const isStaging = process.argv.includes('--staging');
|
|
6
17
|
const specsFile = isStaging
|
|
@@ -22,11 +33,8 @@ for (const spec of specs) {
|
|
|
22
33
|
const tempSpecFile = path.join(process.cwd(), `${name}-spec.json`);
|
|
23
34
|
try {
|
|
24
35
|
console.log(`📥 Downloading spec from ${url}...`);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
shell: true,
|
|
28
|
-
});
|
|
29
|
-
execFileSync(NPX_CMD, [
|
|
36
|
+
runCommand(CURL_CMD, ['-s', '-o', tempSpecFile, url]);
|
|
37
|
+
runCommand(NPX_CMD, [
|
|
30
38
|
'openapi-typescript-codegen',
|
|
31
39
|
'--input',
|
|
32
40
|
tempSpecFile,
|
|
@@ -34,7 +42,7 @@ for (const spec of specs) {
|
|
|
34
42
|
outputDir,
|
|
35
43
|
'--client',
|
|
36
44
|
'fetch',
|
|
37
|
-
]
|
|
45
|
+
]);
|
|
38
46
|
// Clean up temp file
|
|
39
47
|
fs.unlinkSync(tempSpecFile);
|
|
40
48
|
}
|
|
@@ -46,10 +54,7 @@ for (const spec of specs) {
|
|
|
46
54
|
throw error;
|
|
47
55
|
}
|
|
48
56
|
console.log(`⚙️ Generating wrapper for ${name}...`);
|
|
49
|
-
|
|
50
|
-
stdio: 'inherit',
|
|
51
|
-
shell: true,
|
|
52
|
-
});
|
|
57
|
+
runCommand(NPX_CMD, ['tsx', 'src/scripts/generate-definition.ts', name]);
|
|
53
58
|
}
|
|
54
59
|
// After generating all clients and definitions, replace request.ts for all services
|
|
55
60
|
const customRequestPath = path.resolve('src/custom/custom-request.txt');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drttix/drt-sdk",
|
|
3
3
|
"description": "DRT SDK",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "npx tsc --project tsconfig.esm.json && npx tsc --project tsconfig.cjs.json && node scripts/fix-import-extensions.mjs",
|
|
28
|
-
"build:bundle": "npm run build && npx esbuild dist/esm/index.js --bundle --format=esm --outfile=dist/bundle/drt-sdk.js --minify
|
|
28
|
+
"build:bundle": "npm run build && npx esbuild dist/esm/index.js --bundle --format=esm --outfile=dist/bundle/drt-sdk.js --minify",
|
|
29
29
|
"generate": "npx tsx src/scripts/build-all.ts && npx tsx src/scripts/build-all.ts --staging",
|
|
30
30
|
"prepublishOnly": "npx tsx src/scripts/check-version-not-published.ts && npm run build"
|
|
31
31
|
},
|
|
@@ -262,18 +262,26 @@ export class ShowsService {
|
|
|
262
262
|
/**
|
|
263
263
|
* Fetch the show virtual stream details
|
|
264
264
|
* To fetch the virtual stream details of the show
|
|
265
|
-
* @param guid
|
|
265
|
+
* @param guid
|
|
266
|
+
* @param shopperGuid Unique identifier for an shopper.
|
|
267
|
+
* @param showId The ID of the show
|
|
266
268
|
* @returns VirtualStreamResponseDto Virtual stream details fetched successfully
|
|
267
269
|
* @throws ApiError
|
|
268
270
|
*/
|
|
269
271
|
public static getShowVirtualStream(
|
|
270
272
|
guid: string,
|
|
273
|
+
shopperGuid: any,
|
|
274
|
+
showId: string,
|
|
271
275
|
): CancelablePromise<VirtualStreamResponseDto> {
|
|
272
276
|
return __request(OpenAPI, {
|
|
273
277
|
method: 'GET',
|
|
274
|
-
url: '/shows/{
|
|
278
|
+
url: '/shows/{showId}/virtual-stream',
|
|
275
279
|
path: {
|
|
280
|
+
'showId': showId,
|
|
281
|
+
},
|
|
282
|
+
query: {
|
|
276
283
|
'guid': guid,
|
|
284
|
+
'shopperGuid': shopperGuid,
|
|
277
285
|
},
|
|
278
286
|
});
|
|
279
287
|
}
|
|
@@ -427,7 +435,7 @@ export class ShowsService {
|
|
|
427
435
|
): CancelablePromise<Array<SuccessResponse>> {
|
|
428
436
|
return __request(OpenAPI, {
|
|
429
437
|
method: 'POST',
|
|
430
|
-
url: '/shows/
|
|
438
|
+
url: '/shows/new',
|
|
431
439
|
headers: {
|
|
432
440
|
'x-studio-id': xStudioId,
|
|
433
441
|
},
|
|
@@ -53,5 +53,15 @@ export type Account = {
|
|
|
53
53
|
csPhone: string;
|
|
54
54
|
numCouponAliases: number;
|
|
55
55
|
maxOrderSeats: number;
|
|
56
|
+
receiptFrom: string | null;
|
|
57
|
+
refundExchangePolicy: string | null;
|
|
58
|
+
eTickets: number;
|
|
59
|
+
canAssignTickets: number;
|
|
60
|
+
canEmailTickets: number;
|
|
61
|
+
enableOrderDonation: number;
|
|
62
|
+
obfuscateData: number;
|
|
63
|
+
paymentGatewayId: number | null;
|
|
64
|
+
enableAdjustmentPayment: number;
|
|
65
|
+
groupShows: number;
|
|
56
66
|
};
|
|
57
67
|
|
|
@@ -18,5 +18,14 @@ export type SessionInfoDto = {
|
|
|
18
18
|
superuser: boolean;
|
|
19
19
|
expireOnUnlock: boolean;
|
|
20
20
|
tierReminderShown: boolean;
|
|
21
|
+
modifyingOrderId: number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Resolved session/cart effective date (legacy cart_sessionDate). Use this for availability/priority checks instead of new Date().
|
|
24
|
+
*/
|
|
25
|
+
effectiveDate: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether an admin/preview date override is active.
|
|
28
|
+
*/
|
|
29
|
+
usingDateOverride: boolean;
|
|
21
30
|
};
|
|
22
31
|
|
package/src/scripts/build-all.ts
CHANGED
|
@@ -2,6 +2,17 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { execSync, execFileSync } from 'child_process';
|
|
4
4
|
|
|
5
|
+
// On Windows, execFileSync with shell:true joins args without quoting, so paths
|
|
6
|
+
// containing spaces are split. Use execSync with manual quoting on Windows instead.
|
|
7
|
+
function runCommand(cmd: string, args: string[]): void {
|
|
8
|
+
if (process.platform === 'win32') {
|
|
9
|
+
const quotedArgs = args.map((a) => (a.includes(' ') ? `"${a}"` : a));
|
|
10
|
+
execSync([cmd, ...quotedArgs].join(' '), { stdio: 'inherit' });
|
|
11
|
+
} else {
|
|
12
|
+
execFileSync(cmd, args, { stdio: 'inherit' });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
// Load the spec list (use staging specs when --staging flag is passed)
|
|
6
17
|
const isStaging = process.argv.includes('--staging');
|
|
7
18
|
const specsFile = isStaging
|
|
@@ -31,24 +42,17 @@ for (const spec of specs) {
|
|
|
31
42
|
const tempSpecFile = path.join(process.cwd(), `${name}-spec.json`);
|
|
32
43
|
try {
|
|
33
44
|
console.log(`📥 Downloading spec from ${url}...`);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'--output',
|
|
46
|
-
outputDir,
|
|
47
|
-
'--client',
|
|
48
|
-
'fetch',
|
|
49
|
-
],
|
|
50
|
-
{ stdio: 'inherit', shell: true },
|
|
51
|
-
);
|
|
45
|
+
runCommand(CURL_CMD, ['-s', '-o', tempSpecFile, url]);
|
|
46
|
+
|
|
47
|
+
runCommand(NPX_CMD, [
|
|
48
|
+
'openapi-typescript-codegen',
|
|
49
|
+
'--input',
|
|
50
|
+
tempSpecFile,
|
|
51
|
+
'--output',
|
|
52
|
+
outputDir,
|
|
53
|
+
'--client',
|
|
54
|
+
'fetch',
|
|
55
|
+
]);
|
|
52
56
|
|
|
53
57
|
// Clean up temp file
|
|
54
58
|
fs.unlinkSync(tempSpecFile);
|
|
@@ -61,10 +65,7 @@ for (const spec of specs) {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
console.log(`⚙️ Generating wrapper for ${name}...`);
|
|
64
|
-
|
|
65
|
-
stdio: 'inherit',
|
|
66
|
-
shell: true,
|
|
67
|
-
});
|
|
68
|
+
runCommand(NPX_CMD, ['tsx', 'src/scripts/generate-definition.ts', name]);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
// After generating all clients and definitions, replace request.ts for all services
|