@contrail/flexplm 3.1.0-alpha.6e0bbd3 → 3.1.0-alpha.9a5a5c3
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/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/publish/base-process-publish-assortment.d.ts +2 -1
- package/lib/publish/base-process-publish-assortment.js +18 -2
- package/lib/publish/base-process-publish-assortment.spec.js +75 -2
- package/lib/util/config-defaults.d.ts +6 -0
- package/lib/util/config-defaults.js +24 -13
- package/lib/util/config-defaults.spec.js +47 -0
- package/package.json +1 -2
- package/lib/flexplm-request.d.ts +0 -3
- package/lib/flexplm-request.js +0 -34
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./flexplm-request"), exports);
|
|
18
17
|
__exportStar(require("./flexplm-utils"), exports);
|
|
19
18
|
__exportStar(require("./util/config-defaults"), exports);
|
|
20
19
|
__exportStar(require("./util/data-converter"), exports);
|
|
@@ -107,7 +107,8 @@ export declare class BaseProcessPublishAssortment {
|
|
|
107
107
|
* - The events are still uploaded to a VibeIQ file (auto-deleted) to make troubleshooting easier.
|
|
108
108
|
* - Product-season events are all created before any SKU-season event is created.
|
|
109
109
|
* - The external-event entity has no batch endpoint, so the events are created one by one,
|
|
110
|
-
* a small group at a time (separateEventsConcurrency, default
|
|
110
|
+
* a small group at a time (separateEventsConcurrency, default 1; see DEFAULT_SEPARATE_EVENTS_CONCURRENCY)
|
|
111
|
+
* because there can be thousands.
|
|
111
112
|
*/
|
|
112
113
|
private sendAsSeparateVibeIQEvents;
|
|
113
114
|
/** Builds the VibeIQ external-event body for one seasonal event. */
|
|
@@ -742,7 +742,8 @@ class BaseProcessPublishAssortment {
|
|
|
742
742
|
* - The events are still uploaded to a VibeIQ file (auto-deleted) to make troubleshooting easier.
|
|
743
743
|
* - Product-season events are all created before any SKU-season event is created.
|
|
744
744
|
* - The external-event entity has no batch endpoint, so the events are created one by one,
|
|
745
|
-
* a small group at a time (separateEventsConcurrency, default
|
|
745
|
+
* a small group at a time (separateEventsConcurrency, default 1; see DEFAULT_SEPARATE_EVENTS_CONCURRENCY)
|
|
746
|
+
* because there can be thousands.
|
|
746
747
|
*/
|
|
747
748
|
async sendAsSeparateVibeIQEvents(events, eventType) {
|
|
748
749
|
const uploadFile = await this.uploadEventsFile(events);
|
|
@@ -769,6 +770,19 @@ class BaseProcessPublishAssortment {
|
|
|
769
770
|
// Events created before the failure are already queued; report that so a re-publish is understood.
|
|
770
771
|
error.eventsCreatedBeforeFailure = { ...eventsCreated };
|
|
771
772
|
error.eventsFileId = uploadFile.id;
|
|
773
|
+
// ErrorResponseObject.getResponse only passes error.details through (as errorDetails), so the same
|
|
774
|
+
// information goes there too. Existing details keys stay where they are; details that are not an
|
|
775
|
+
// object are kept under batchErrorDetails.
|
|
776
|
+
const queuedInfo = { eventsCreatedBeforeFailure: error.eventsCreatedBeforeFailure, eventsFileId: error.eventsFileId };
|
|
777
|
+
if (error.details && typeof error.details === 'object' && !Array.isArray(error.details)) {
|
|
778
|
+
error.details = { ...error.details, ...queuedInfo };
|
|
779
|
+
}
|
|
780
|
+
else if (error.details !== undefined && error.details !== null) {
|
|
781
|
+
error.details = { batchErrorDetails: error.details, ...queuedInfo };
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
error.details = queuedInfo;
|
|
785
|
+
}
|
|
772
786
|
console.error('sendAsSeparateVibeIQEvents(): failed after creating: ' + JSON.stringify(eventsCreated) + ': ' + error.message);
|
|
773
787
|
throw error;
|
|
774
788
|
}
|
|
@@ -1220,4 +1234,6 @@ BaseProcessPublishAssortment.ASSORTMENT_NO_FED_INFO = 'Assortment doesn\'t have
|
|
|
1220
1234
|
BaseProcessPublishAssortment.NOT_ABLE_TO_PROCESS_DELETE_CHANGES = 'Error: Not able to process delete changes';
|
|
1221
1235
|
BaseProcessPublishAssortment.SEND_MODE_SEPARATE_VIBEIQ_EVENTS = 'separatevibeiqevents'; // compared lower-cased
|
|
1222
1236
|
BaseProcessPublishAssortment.SEND_SEASONAL_EVENT_OBJECT_CLASS = 'SendSeasonalEventToFlexPLM';
|
|
1223
|
-
|
|
1237
|
+
// 1 until the external-events deduplication fix ships: the service uses a millisecond timestamp as the queue
|
|
1238
|
+
// dedup id, so events created at the same moment can be silently dropped (about 2 in 10 at a concurrency of 10).
|
|
1239
|
+
BaseProcessPublishAssortment.DEFAULT_SEPARATE_EVENTS_CONCURRENCY = 1;
|
|
@@ -10,6 +10,7 @@ const type_conversion_utils_1 = require("../util/type-conversion-utils");
|
|
|
10
10
|
const map_utils_1 = require("../util/map-utils");
|
|
11
11
|
const item_family_changes_1 = require("../interfaces/item-family-changes");
|
|
12
12
|
const flexplm_connect_1 = require("../util/flexplm-connect");
|
|
13
|
+
const error_response_object_1 = require("../util/error-response-object");
|
|
13
14
|
let federatedId = '';
|
|
14
15
|
jest.mock('../util/data-converter', () => {
|
|
15
16
|
return {
|
|
@@ -2399,7 +2400,7 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2399
2400
|
expect(state.mixed).toBe(false);
|
|
2400
2401
|
expect(result.eventsCreated).toEqual({ productSeasons: 5, colorwaySeasons: 3 });
|
|
2401
2402
|
});
|
|
2402
|
-
it('creates
|
|
2403
|
+
it('creates 1 event at a time when separateEventsConcurrency is not a valid number', async () => {
|
|
2403
2404
|
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 'abc' }));
|
|
2404
2405
|
const state = trackConcurrency();
|
|
2405
2406
|
const events = [];
|
|
@@ -2408,7 +2409,7 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2408
2409
|
}
|
|
2409
2410
|
await bppa.sendEvents(events);
|
|
2410
2411
|
expect(createCalls).toHaveLength(25);
|
|
2411
|
-
expect(state.maxInFlight).toBe(
|
|
2412
|
+
expect(state.maxInFlight).toBe(1);
|
|
2412
2413
|
});
|
|
2413
2414
|
it('uploads the events file, and does not call FlexPLM or create AssortmentPublishedToFlexPLM', async () => {
|
|
2414
2415
|
const bppa = newBppa(buildConfig());
|
|
@@ -2450,6 +2451,78 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2450
2451
|
});
|
|
2451
2452
|
expect(createCalls).toHaveLength(4);
|
|
2452
2453
|
});
|
|
2454
|
+
describe('queued counts and file id in error.details', () => {
|
|
2455
|
+
const failOnCall = (failingCall, reason) => {
|
|
2456
|
+
let callCount = 0;
|
|
2457
|
+
createImpl = () => {
|
|
2458
|
+
callCount++;
|
|
2459
|
+
return callCount === failingCall ? Promise.reject(reason) : Promise.resolve({});
|
|
2460
|
+
};
|
|
2461
|
+
};
|
|
2462
|
+
const fiveProducts = () => [1, 2, 3, 4, 5].map(i => productEvent(i));
|
|
2463
|
+
beforeEach(() => {
|
|
2464
|
+
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
2465
|
+
});
|
|
2466
|
+
it('adds the counts and file id to details and keeps the existing details keys', async () => {
|
|
2467
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 2 }));
|
|
2468
|
+
failOnCall(4, { statusCode: 404, message: 'Internal Server Error' });
|
|
2469
|
+
await expect(bppa.sendEvents(fiveProducts())).rejects.toMatchObject({
|
|
2470
|
+
details: {
|
|
2471
|
+
statusCode: 404,
|
|
2472
|
+
message: 'Internal Server Error',
|
|
2473
|
+
eventsCreatedBeforeFailure: { productSeasons: 3, colorwaySeasons: 0 },
|
|
2474
|
+
eventsFileId: 'file-123'
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2477
|
+
});
|
|
2478
|
+
it('creates details when the error has none', async () => {
|
|
2479
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2480
|
+
failOnCall(2, new Error('create failed'));
|
|
2481
|
+
await expect(bppa.sendEvents(fiveProducts())).rejects.toMatchObject({
|
|
2482
|
+
message: 'create failed',
|
|
2483
|
+
details: { eventsCreatedBeforeFailure: { productSeasons: 1, colorwaySeasons: 0 }, eventsFileId: 'file-123' }
|
|
2484
|
+
});
|
|
2485
|
+
});
|
|
2486
|
+
it('keeps details that are not an object under batchErrorDetails', async () => {
|
|
2487
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2488
|
+
const error = new Error('create failed');
|
|
2489
|
+
error.details = 'plain text details';
|
|
2490
|
+
failOnCall(1, error);
|
|
2491
|
+
await expect(bppa.sendEvents(fiveProducts())).rejects.toMatchObject({
|
|
2492
|
+
details: {
|
|
2493
|
+
batchErrorDetails: 'plain text details',
|
|
2494
|
+
eventsCreatedBeforeFailure: { productSeasons: 0, colorwaySeasons: 0 },
|
|
2495
|
+
eventsFileId: 'file-123'
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
});
|
|
2499
|
+
it('still sets the counts and file id as properties of the error', async () => {
|
|
2500
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2501
|
+
failOnCall(3, new Error('create failed'));
|
|
2502
|
+
await expect(bppa.sendEvents(fiveProducts())).rejects.toMatchObject({
|
|
2503
|
+
eventsCreatedBeforeFailure: { productSeasons: 2, colorwaySeasons: 0 },
|
|
2504
|
+
eventsFileId: 'file-123'
|
|
2505
|
+
});
|
|
2506
|
+
});
|
|
2507
|
+
it('comes through ErrorResponseObject.getResponse as errorDetails', async () => {
|
|
2508
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2509
|
+
failOnCall(3, { statusCode: 500, message: 'boom' });
|
|
2510
|
+
jest.spyOn(console, 'log').mockImplementation(() => undefined);
|
|
2511
|
+
let thrown;
|
|
2512
|
+
try {
|
|
2513
|
+
await bppa.sendEvents(fiveProducts());
|
|
2514
|
+
}
|
|
2515
|
+
catch (e) {
|
|
2516
|
+
thrown = e;
|
|
2517
|
+
}
|
|
2518
|
+
const response = error_response_object_1.ErrorResponseObject.getResponse(thrown);
|
|
2519
|
+
expect(response.output.errorDetails).toMatchObject({
|
|
2520
|
+
statusCode: 500,
|
|
2521
|
+
eventsCreatedBeforeFailure: { productSeasons: 2, colorwaySeasons: 0 },
|
|
2522
|
+
eventsFileId: 'file-123'
|
|
2523
|
+
});
|
|
2524
|
+
});
|
|
2525
|
+
});
|
|
2453
2526
|
it('keeps a readable message when the SDK rejects with a plain object instead of an Error', async () => {
|
|
2454
2527
|
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2455
2528
|
createImpl = () => Promise.reject({ statusCode: 404, message: 'Internal Server Error' });
|
|
@@ -6,6 +6,12 @@ export declare class ConfigDefaults {
|
|
|
6
6
|
static PROTO_KEYS: string[];
|
|
7
7
|
static stripProtoKeys(obj: any): any;
|
|
8
8
|
static setConfigDefaults(config: any): Promise<FCConfig>;
|
|
9
|
+
/**
|
|
10
|
+
* Turns a sendMode given as a JSON string into an object, in place. Used for the action configuration
|
|
11
|
+
* and for the config file, so both behave the same.
|
|
12
|
+
* Throws INVALID_SEND_MODE when the string is not valid JSON or is not a JSON object.
|
|
13
|
+
*/
|
|
14
|
+
static normalizeSendMode(config: any): void;
|
|
9
15
|
static getDefaultConfig(): {
|
|
10
16
|
urlContext: string;
|
|
11
17
|
sendMode: {
|
|
@@ -29,19 +29,7 @@ class ConfigDefaults {
|
|
|
29
29
|
}
|
|
30
30
|
// sendMode can arrive as a JSON string (for example from an action configuration field).
|
|
31
31
|
// Normalise it to an object so it merges with the defaults instead of replacing them.
|
|
32
|
-
|
|
33
|
-
let parsedSendMode;
|
|
34
|
-
try {
|
|
35
|
-
parsedSendMode = JSON.parse(config.sendMode);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
throw new Error(ConfigDefaults.INVALID_SEND_MODE + config.sendMode);
|
|
39
|
-
}
|
|
40
|
-
if (parsedSendMode === null || typeof parsedSendMode !== 'object' || Array.isArray(parsedSendMode)) {
|
|
41
|
-
throw new Error(ConfigDefaults.INVALID_SEND_MODE + config.sendMode);
|
|
42
|
-
}
|
|
43
|
-
config.sendMode = ConfigDefaults.stripProtoKeys(parsedSendMode);
|
|
44
|
-
}
|
|
32
|
+
ConfigDefaults.normalizeSendMode(config);
|
|
45
33
|
// List will be comma separated list in UI, so convert to array
|
|
46
34
|
if (config?.itemPreDevelopmentLifecycleStages && !(config?.itemPreDevelopmentLifecycleStages instanceof Array)) {
|
|
47
35
|
config.itemPreDevelopmentLifecycleStages = config.itemPreDevelopmentLifecycleStages.split(',');
|
|
@@ -52,6 +40,8 @@ class ConfigDefaults {
|
|
|
52
40
|
const configArr = [ConfigDefaults.getDefaultConfig()];
|
|
53
41
|
if (config.configFile) {
|
|
54
42
|
const fileConfig = await ConfigDefaults.getConfigFile(config.configFile);
|
|
43
|
+
// The config file gets the same sendMode handling as the action configuration.
|
|
44
|
+
ConfigDefaults.normalizeSendMode(fileConfig);
|
|
55
45
|
configArr.push(fileConfig);
|
|
56
46
|
}
|
|
57
47
|
configArr.push(config);
|
|
@@ -66,6 +56,27 @@ class ConfigDefaults {
|
|
|
66
56
|
console.log('outputConfig: ' + JSON.stringify(outputConfig));
|
|
67
57
|
return outputConfig;
|
|
68
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Turns a sendMode given as a JSON string into an object, in place. Used for the action configuration
|
|
61
|
+
* and for the config file, so both behave the same.
|
|
62
|
+
* Throws INVALID_SEND_MODE when the string is not valid JSON or is not a JSON object.
|
|
63
|
+
*/
|
|
64
|
+
static normalizeSendMode(config) {
|
|
65
|
+
if (!config || typeof config.sendMode !== 'string') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
let parsedSendMode;
|
|
69
|
+
try {
|
|
70
|
+
parsedSendMode = JSON.parse(config.sendMode);
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
throw new Error(ConfigDefaults.INVALID_SEND_MODE + config.sendMode);
|
|
74
|
+
}
|
|
75
|
+
if (parsedSendMode === null || typeof parsedSendMode !== 'object' || Array.isArray(parsedSendMode)) {
|
|
76
|
+
throw new Error(ConfigDefaults.INVALID_SEND_MODE + config.sendMode);
|
|
77
|
+
}
|
|
78
|
+
config.sendMode = ConfigDefaults.stripProtoKeys(parsedSendMode);
|
|
79
|
+
}
|
|
69
80
|
static getDefaultConfig() {
|
|
70
81
|
return {
|
|
71
82
|
urlContext: '/Windchill',
|
|
@@ -413,6 +413,53 @@ describe('all tests', () => {
|
|
|
413
413
|
expect(Object.keys(config).length).toEqual(0);
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
|
+
describe('sendMode in the config file', () => {
|
|
417
|
+
const config = {
|
|
418
|
+
apiHost: 'http://test.com',
|
|
419
|
+
userName: 'vibeiq',
|
|
420
|
+
password: 'vibeiq',
|
|
421
|
+
configFile: 'id-sendmode'
|
|
422
|
+
};
|
|
423
|
+
beforeEach(() => {
|
|
424
|
+
config_defaults_1.ConfigDefaults.clearConfigCache();
|
|
425
|
+
entityObject = { downloadUrl: 'http://sss.com' };
|
|
426
|
+
});
|
|
427
|
+
afterEach(() => {
|
|
428
|
+
config_defaults_1.ConfigDefaults.clearConfigCache();
|
|
429
|
+
fetchJson = {};
|
|
430
|
+
});
|
|
431
|
+
it('a JSON string sendMode in the config file is parsed and merged with the defaults', async () => {
|
|
432
|
+
fetchJson = { sendMode: '{"ASYNC_PUBLISH_SEASON": "separateVibeIQEvents", "OTHER": "x"}' };
|
|
433
|
+
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(Object.assign({}, config));
|
|
434
|
+
expect(fcConfig.sendMode.ASYNC_PUBLISH_SEASON).toEqual('separateVibeIQEvents');
|
|
435
|
+
expect(fcConfig.sendMode.OTHER).toEqual('x');
|
|
436
|
+
});
|
|
437
|
+
it('an object sendMode in the config file still works', async () => {
|
|
438
|
+
fetchJson = { sendMode: { ASYNC_PUBLISH_SEASON: 'vibeiqfile-dontsendtoflexplm' } };
|
|
439
|
+
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(Object.assign({}, config));
|
|
440
|
+
expect(fcConfig.sendMode.ASYNC_PUBLISH_SEASON).toEqual('vibeiqfile-dontsendtoflexplm');
|
|
441
|
+
});
|
|
442
|
+
it('a sendMode in the action configuration overrides the one in the config file', async () => {
|
|
443
|
+
fetchJson = { sendMode: '{"ASYNC_PUBLISH_SEASON": "vibeiqfile-dontsendtoflexplm"}' };
|
|
444
|
+
const startConfig = Object.assign({}, config, { sendMode: { ASYNC_PUBLISH_SEASON: 'separateVibeIQEvents' } });
|
|
445
|
+
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(startConfig);
|
|
446
|
+
expect(fcConfig.sendMode.ASYNC_PUBLISH_SEASON).toEqual('separateVibeIQEvents');
|
|
447
|
+
});
|
|
448
|
+
it('invalid JSON in the config file sendMode throws', async () => {
|
|
449
|
+
fetchJson = { sendMode: '{not json' };
|
|
450
|
+
await expect(config_defaults_1.ConfigDefaults.setConfigDefaults(Object.assign({}, config))).rejects.toThrow(config_defaults_1.ConfigDefaults.INVALID_SEND_MODE);
|
|
451
|
+
});
|
|
452
|
+
it.each([['"separateVibeIQEvents"'], ['["separateVibeIQEvents"]'], ['null']])('a config file sendMode that is the JSON string %s (not an object) throws', async (value) => {
|
|
453
|
+
fetchJson = { sendMode: value };
|
|
454
|
+
await expect(config_defaults_1.ConfigDefaults.setConfigDefaults(Object.assign({}, config))).rejects.toThrow(config_defaults_1.ConfigDefaults.INVALID_SEND_MODE);
|
|
455
|
+
});
|
|
456
|
+
it('removes prototype keys from a parsed config file sendMode', async () => {
|
|
457
|
+
fetchJson = { sendMode: '{"__proto__": {"polluted": true}, "ASYNC_PUBLISH_SEASON": "separateVibeIQEvents"}' };
|
|
458
|
+
const fcConfig = await config_defaults_1.ConfigDefaults.setConfigDefaults(Object.assign({}, config));
|
|
459
|
+
expect(fcConfig.sendMode.ASYNC_PUBLISH_SEASON).toEqual('separateVibeIQEvents');
|
|
460
|
+
expect({}.polluted).toBeUndefined();
|
|
461
|
+
});
|
|
462
|
+
});
|
|
416
463
|
describe('prototype pollution', () => {
|
|
417
464
|
const config = {
|
|
418
465
|
apiHost: 'http://test.com',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/flexplm",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.9a5a5c3",
|
|
4
4
|
"description": "Library used for integration with flexplm.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -66,7 +66,6 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@contrail/util": "^2.2.1",
|
|
69
|
-
"axios": "^1.4.0",
|
|
70
69
|
"p-limit": "^3.1.0"
|
|
71
70
|
},
|
|
72
71
|
"engines": {
|
package/lib/flexplm-request.d.ts
DELETED
package/lib/flexplm-request.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FlexPLMRequest = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const BASE_URL = 'https://PP-2006031951wo.portal.ptc.io/Windchill/servlet/rest/cdee';
|
|
9
|
-
const BASE_CONFIG = {
|
|
10
|
-
method: 'POST',
|
|
11
|
-
headers: {
|
|
12
|
-
'Accept': 'application/json',
|
|
13
|
-
'Content-Type': 'application/json',
|
|
14
|
-
'CSRF_NONCE': '2OaLp+0dWNBtrkTwtdDC491zaacu6Hykvqi/lpl6bZgJ/QXBrK/B1J5FErMkmAmktr/I3thcbO1Xn3HJ7Ne/l9kpaedUmn7H75Xey4ZbNLsenW+anM3vxIZ7ELosk3k=',
|
|
15
|
-
'Authorization': 'Basic d2NhZG1pbjpSZXRhaWwyMDIwLQ==',
|
|
16
|
-
'Cookie': 'JSESSIONID=36D5B3C74C1F963C6C73E9AF5B6BDA78.tomcat1; JSESSIONID=B8090C802D8548EA773C97F5886FAB79.tomcat1',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
class FlexPLMRequest {
|
|
20
|
-
static async request(path, data) {
|
|
21
|
-
const config = Object.assign({}, BASE_CONFIG);
|
|
22
|
-
config.url = BASE_URL + path;
|
|
23
|
-
config.data = data;
|
|
24
|
-
try {
|
|
25
|
-
const resp = await (0, axios_1.default)(config);
|
|
26
|
-
return Promise.resolve(resp.data);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error(`${FlexPLMRequest} error: ${error.message}`);
|
|
30
|
-
return Promise.resolve(null);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.FlexPLMRequest = FlexPLMRequest;
|