@contrail/flexplm 3.1.0-alpha.9d81aaa → 3.1.0-alpha.ed24f00
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 +14 -7
- package/lib/publish/base-process-publish-assortment.js +40 -20
- package/lib/publish/base-process-publish-assortment.spec.js +68 -35
- 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);
|
|
@@ -10,7 +10,7 @@ export declare class BaseProcessPublishAssortment {
|
|
|
10
10
|
static NOT_ABLE_TO_PROCESS_DELETE_CHANGES: string;
|
|
11
11
|
static SEND_MODE_SEPARATE_VIBEIQ_EVENTS: string;
|
|
12
12
|
static SEND_SEASONAL_EVENT_OBJECT_CLASS: string;
|
|
13
|
-
static
|
|
13
|
+
static DEFAULT_SEPARATE_EVENTS_CONCURRENCY: number;
|
|
14
14
|
private dc;
|
|
15
15
|
private config;
|
|
16
16
|
private mapFileUtil;
|
|
@@ -105,16 +105,23 @@ export declare class BaseProcessPublishAssortment {
|
|
|
105
105
|
* Creates one VibeIQ external-event per seasonal event. Each external-event triggers the
|
|
106
106
|
* 'VibeIQ-SendSeasonalEventToFlexPLM' workflow, which sends that single event to FlexPLM.
|
|
107
107
|
* - The events are still uploaded to a VibeIQ file (auto-deleted) to make troubleshooting easier.
|
|
108
|
-
* - Product-season events are
|
|
109
|
-
* -
|
|
108
|
+
* - Product-season events are all created before any SKU-season event is created.
|
|
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 10) because there can be thousands.
|
|
110
111
|
*/
|
|
111
112
|
private sendAsSeparateVibeIQEvents;
|
|
112
113
|
/** Builds the VibeIQ external-event body for one seasonal event. */
|
|
113
114
|
private buildSendSeasonalEventPayload;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
/** How many external-events are created at the same time (config separateEventsConcurrency). */
|
|
116
|
+
private getSeparateEventsConcurrency;
|
|
117
|
+
/** Makes sure that what was thrown is an Error with a readable message. The SDK can throw a plain
|
|
118
|
+
* object such as { statusCode: 404, message: '...' }, which has no usable String() value. */
|
|
119
|
+
private toError;
|
|
120
|
+
/** Creates the external-events one by one, `concurrency` at a time, in order. The next group only
|
|
121
|
+
* starts when the current one has finished. After each group the count for `key` is increased
|
|
122
|
+
* by the events that were created, so a caller can report progress if a later group fails.
|
|
123
|
+
* If any event in a group fails, the remaining events are not created and the error is thrown. */
|
|
124
|
+
private createExternalEvents;
|
|
118
125
|
private getCurrentDateString;
|
|
119
126
|
getItemFamilyChanges(pcd: PublishChangeData, changeDetail: any, assortmentItemFullChangeMap: Map<string, any>, assortmentItemDeleteMap: Map<string, any>): Map<string, ItemFamilyChanges>;
|
|
120
127
|
getEventsForPublishChangeData(publishChangeData: PublishChangeData): Promise<SeasonalPayload[]>;
|
|
@@ -740,8 +740,9 @@ class BaseProcessPublishAssortment {
|
|
|
740
740
|
* Creates one VibeIQ external-event per seasonal event. Each external-event triggers the
|
|
741
741
|
* 'VibeIQ-SendSeasonalEventToFlexPLM' workflow, which sends that single event to FlexPLM.
|
|
742
742
|
* - The events are still uploaded to a VibeIQ file (auto-deleted) to make troubleshooting easier.
|
|
743
|
-
* - Product-season events are
|
|
744
|
-
* -
|
|
743
|
+
* - Product-season events are all created before any SKU-season event is created.
|
|
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 10) because there can be thousands.
|
|
745
746
|
*/
|
|
746
747
|
async sendAsSeparateVibeIQEvents(events, eventType) {
|
|
747
748
|
const uploadFile = await this.uploadEventsFile(events);
|
|
@@ -760,11 +761,11 @@ class BaseProcessPublishAssortment {
|
|
|
760
761
|
const eventsCreated = { productSeasons: 0, colorwaySeasons: 0 };
|
|
761
762
|
try {
|
|
762
763
|
// Product Season events must be created (and so queued) before the SKU Season events.
|
|
763
|
-
await this.
|
|
764
|
-
await this.
|
|
764
|
+
await this.createExternalEvents(productWrappers, eventsCreated, 'productSeasons');
|
|
765
|
+
await this.createExternalEvents(skuWrappers, eventsCreated, 'colorwaySeasons');
|
|
765
766
|
}
|
|
766
767
|
catch (e) {
|
|
767
|
-
const error =
|
|
768
|
+
const error = this.toError(e);
|
|
768
769
|
// Events created before the failure are already queued; report that so a re-publish is understood.
|
|
769
770
|
error.eventsCreatedBeforeFailure = { ...eventsCreated };
|
|
770
771
|
error.eventsFileId = uploadFile.id;
|
|
@@ -806,23 +807,42 @@ class BaseProcessPublishAssortment {
|
|
|
806
807
|
initialEvent
|
|
807
808
|
};
|
|
808
809
|
}
|
|
809
|
-
|
|
810
|
-
|
|
810
|
+
/** How many external-events are created at the same time (config separateEventsConcurrency). */
|
|
811
|
+
getSeparateEventsConcurrency() {
|
|
812
|
+
const configured = Number(this.config?.separateEventsConcurrency);
|
|
811
813
|
return (Number.isInteger(configured) && configured > 0)
|
|
812
814
|
? configured
|
|
813
|
-
: BaseProcessPublishAssortment.
|
|
815
|
+
: BaseProcessPublishAssortment.DEFAULT_SEPARATE_EVENTS_CONCURRENCY;
|
|
814
816
|
}
|
|
815
|
-
/**
|
|
816
|
-
*
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
817
|
+
/** Makes sure that what was thrown is an Error with a readable message. The SDK can throw a plain
|
|
818
|
+
* object such as { statusCode: 404, message: '...' }, which has no usable String() value. */
|
|
819
|
+
toError(e) {
|
|
820
|
+
if (e instanceof Error) {
|
|
821
|
+
return e;
|
|
822
|
+
}
|
|
823
|
+
const text = (typeof e === 'string') ? e : (e?.message || JSON.stringify(e) || String(e));
|
|
824
|
+
const error = new Error(text);
|
|
825
|
+
if (e && typeof e === 'object') {
|
|
826
|
+
error.details = e;
|
|
827
|
+
}
|
|
828
|
+
return error;
|
|
829
|
+
}
|
|
830
|
+
/** Creates the external-events one by one, `concurrency` at a time, in order. The next group only
|
|
831
|
+
* starts when the current one has finished. After each group the count for `key` is increased
|
|
832
|
+
* by the events that were created, so a caller can report progress if a later group fails.
|
|
833
|
+
* If any event in a group fails, the remaining events are not created and the error is thrown. */
|
|
834
|
+
async createExternalEvents(wrappers, counts, key) {
|
|
835
|
+
const concurrency = this.getSeparateEventsConcurrency();
|
|
836
|
+
for (let i = 0; i < wrappers.length; i += concurrency) {
|
|
837
|
+
const group = wrappers.slice(i, i + concurrency);
|
|
838
|
+
const results = await Promise.allSettled(group.map(wrapper => new sdk_1.Entities().create({ entityName: 'external-event', object: wrapper })));
|
|
839
|
+
counts[key] += results.filter(r => r.status === 'fulfilled').length;
|
|
840
|
+
const failed = results.filter(r => r.status === 'rejected');
|
|
841
|
+
if (failed.length > 0) {
|
|
842
|
+
const error = this.toError(failed[0].reason);
|
|
843
|
+
error.failedEventsInGroup = failed.length;
|
|
844
|
+
throw error;
|
|
845
|
+
}
|
|
826
846
|
}
|
|
827
847
|
}
|
|
828
848
|
getCurrentDateString() {
|
|
@@ -1200,4 +1220,4 @@ BaseProcessPublishAssortment.ASSORTMENT_NO_FED_INFO = 'Assortment doesn\'t have
|
|
|
1200
1220
|
BaseProcessPublishAssortment.NOT_ABLE_TO_PROCESS_DELETE_CHANGES = 'Error: Not able to process delete changes';
|
|
1201
1221
|
BaseProcessPublishAssortment.SEND_MODE_SEPARATE_VIBEIQ_EVENTS = 'separatevibeiqevents'; // compared lower-cased
|
|
1202
1222
|
BaseProcessPublishAssortment.SEND_SEASONAL_EVENT_OBJECT_CLASS = 'SendSeasonalEventToFlexPLM';
|
|
1203
|
-
BaseProcessPublishAssortment.
|
|
1223
|
+
BaseProcessPublishAssortment.DEFAULT_SEPARATE_EVENTS_CONCURRENCY = 10;
|
|
@@ -33,8 +33,8 @@ jest.mock('../util/federation', () => {
|
|
|
33
33
|
let entityObject = {};
|
|
34
34
|
let getOptionsObject = {};
|
|
35
35
|
let createCallArg = undefined;
|
|
36
|
-
let
|
|
37
|
-
let
|
|
36
|
+
let createCalls = [];
|
|
37
|
+
let createImpl = () => Promise.resolve({});
|
|
38
38
|
let fileUploadCalls = [];
|
|
39
39
|
let fileUploadResult = {
|
|
40
40
|
id: 'file-123',
|
|
@@ -50,11 +50,8 @@ jest.mock('@contrail/sdk', () => {
|
|
|
50
50
|
}
|
|
51
51
|
create(arg) {
|
|
52
52
|
createCallArg = arg;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
batchCreate(arg) {
|
|
56
|
-
batchCreateCalls.push(arg);
|
|
57
|
-
return batchCreateImpl(arg);
|
|
53
|
+
createCalls.push(arg);
|
|
54
|
+
return createImpl(arg);
|
|
58
55
|
}
|
|
59
56
|
},
|
|
60
57
|
Files: class {
|
|
@@ -2317,12 +2314,31 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2317
2314
|
data: {}
|
|
2318
2315
|
});
|
|
2319
2316
|
const newBppa = (config) => new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, new data_converter_1.DataConverter(config, mapFileUtil), mapFileUtil);
|
|
2320
|
-
const
|
|
2317
|
+
const createdObjects = () => createCalls.map(call => call.object);
|
|
2318
|
+
/** An external-event create that takes a few ms and records how many run at the same time,
|
|
2319
|
+
* and whether a product-season and a sku-season event were ever in flight together. */
|
|
2320
|
+
const trackConcurrency = () => {
|
|
2321
|
+
const state = { inFlight: 0, maxInFlight: 0, mixed: false, active: [] };
|
|
2322
|
+
createImpl = async (arg) => {
|
|
2323
|
+
const objectClass = arg.object.eventToSend.objectClass;
|
|
2324
|
+
state.active.push(objectClass);
|
|
2325
|
+
state.inFlight++;
|
|
2326
|
+
state.maxInFlight = Math.max(state.maxInFlight, state.inFlight);
|
|
2327
|
+
if (state.active.includes('LCSProductSeasonLink') && state.active.includes('LCSSKUSeasonLink')) {
|
|
2328
|
+
state.mixed = true;
|
|
2329
|
+
}
|
|
2330
|
+
await new Promise(resolve => setTimeout(resolve, 5));
|
|
2331
|
+
state.active.splice(state.active.indexOf(objectClass), 1);
|
|
2332
|
+
state.inFlight--;
|
|
2333
|
+
return {};
|
|
2334
|
+
};
|
|
2335
|
+
return state;
|
|
2336
|
+
};
|
|
2321
2337
|
beforeEach(() => {
|
|
2322
2338
|
createCallArg = undefined;
|
|
2323
2339
|
fileUploadCalls = [];
|
|
2324
|
-
|
|
2325
|
-
|
|
2340
|
+
createCalls = [];
|
|
2341
|
+
createImpl = () => Promise.resolve({});
|
|
2326
2342
|
fileUploadResult = {
|
|
2327
2343
|
id: 'file-123',
|
|
2328
2344
|
downloadUrl: 'https://download.url',
|
|
@@ -2330,16 +2346,16 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2330
2346
|
};
|
|
2331
2347
|
});
|
|
2332
2348
|
afterEach(() => {
|
|
2349
|
+
createImpl = () => Promise.resolve({});
|
|
2333
2350
|
jest.restoreAllMocks();
|
|
2334
2351
|
});
|
|
2335
2352
|
it('creates one external-event per seasonal event, with the expected shape', async () => {
|
|
2336
2353
|
const bppa = newBppa(buildConfig());
|
|
2337
2354
|
const events = [productEvent(1), skuEvent(1, 1)];
|
|
2338
2355
|
await bppa.sendEvents(events);
|
|
2339
|
-
expect(
|
|
2340
|
-
|
|
2341
|
-
const objects =
|
|
2342
|
-
expect(objects).toHaveLength(2);
|
|
2356
|
+
expect(createCalls).toHaveLength(2);
|
|
2357
|
+
createCalls.forEach(call => expect(call.entityName).toBe('external-event'));
|
|
2358
|
+
const objects = createdObjects();
|
|
2343
2359
|
expect(objects[0]).toEqual({
|
|
2344
2360
|
originSystemType: 'VibeIQ',
|
|
2345
2361
|
objectClass: 'SendSeasonalEventToFlexPLM',
|
|
@@ -2361,14 +2377,15 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2361
2377
|
const bppa = newBppa(buildConfig());
|
|
2362
2378
|
const events = [skuEvent(1, 1), productEvent(1), skuEvent(2, 2), productEvent(2)];
|
|
2363
2379
|
await bppa.sendEvents(events);
|
|
2364
|
-
const classes =
|
|
2380
|
+
const classes = createdObjects().map(o => o.eventToSend.objectClass);
|
|
2365
2381
|
expect(classes).toEqual([
|
|
2366
2382
|
'LCSProductSeasonLink', 'LCSProductSeasonLink',
|
|
2367
2383
|
'LCSSKUSeasonLink', 'LCSSKUSeasonLink'
|
|
2368
2384
|
]);
|
|
2369
2385
|
});
|
|
2370
|
-
it('
|
|
2371
|
-
const bppa = newBppa(buildConfig({
|
|
2386
|
+
it('creates at most separateEventsConcurrency events at a time and never mixes product and sku events', async () => {
|
|
2387
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 2 }));
|
|
2388
|
+
const state = trackConcurrency();
|
|
2372
2389
|
const events = [];
|
|
2373
2390
|
for (let i = 1; i <= 5; i++) {
|
|
2374
2391
|
events.push(productEvent(i));
|
|
@@ -2377,17 +2394,21 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2377
2394
|
events.push(skuEvent(i, 1));
|
|
2378
2395
|
}
|
|
2379
2396
|
const result = await bppa.sendEvents(events);
|
|
2380
|
-
expect(
|
|
2397
|
+
expect(createCalls).toHaveLength(8);
|
|
2398
|
+
expect(state.maxInFlight).toBe(2);
|
|
2399
|
+
expect(state.mixed).toBe(false);
|
|
2381
2400
|
expect(result.eventsCreated).toEqual({ productSeasons: 5, colorwaySeasons: 3 });
|
|
2382
2401
|
});
|
|
2383
|
-
it('
|
|
2384
|
-
const bppa = newBppa(buildConfig({
|
|
2402
|
+
it('creates 10 events at a time when separateEventsConcurrency is not a valid number', async () => {
|
|
2403
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 'abc' }));
|
|
2404
|
+
const state = trackConcurrency();
|
|
2385
2405
|
const events = [];
|
|
2386
|
-
for (let i = 1; i <=
|
|
2406
|
+
for (let i = 1; i <= 25; i++) {
|
|
2387
2407
|
events.push(productEvent(i));
|
|
2388
2408
|
}
|
|
2389
2409
|
await bppa.sendEvents(events);
|
|
2390
|
-
expect(
|
|
2410
|
+
expect(createCalls).toHaveLength(25);
|
|
2411
|
+
expect(state.maxInFlight).toBe(10);
|
|
2391
2412
|
});
|
|
2392
2413
|
it('uploads the events file, and does not call FlexPLM or create AssortmentPublishedToFlexPLM', async () => {
|
|
2393
2414
|
const bppa = newBppa(buildConfig());
|
|
@@ -2397,7 +2418,8 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2397
2418
|
expect(fileUploadCalls).toHaveLength(1);
|
|
2398
2419
|
expect(JSON.parse(fileUploadCalls[0].buffer.toString('utf-8'))).toEqual(events);
|
|
2399
2420
|
expect(spyFlex).not.toHaveBeenCalled();
|
|
2400
|
-
expect(
|
|
2421
|
+
createdObjects().forEach(o => expect(o.objectClass).toBe('SendSeasonalEventToFlexPLM'));
|
|
2422
|
+
expect(createdObjects().some(o => o.objectClass === 'AssortmentPublishedToFlexPLM')).toBe(false);
|
|
2401
2423
|
expect(result).toEqual({
|
|
2402
2424
|
message: 'Successfully created separate VibeIQ events.',
|
|
2403
2425
|
eventType: 'ASYNC_PUBLISH_SEASON',
|
|
@@ -2407,25 +2429,36 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2407
2429
|
eventsCreated: { productSeasons: 1, colorwaySeasons: 1 }
|
|
2408
2430
|
});
|
|
2409
2431
|
});
|
|
2410
|
-
it('stops
|
|
2411
|
-
const bppa = newBppa(buildConfig({
|
|
2432
|
+
it('stops after the group with the failing event and reports the events already created', async () => {
|
|
2433
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 2 }));
|
|
2412
2434
|
const events = [];
|
|
2413
2435
|
for (let i = 1; i <= 5; i++) {
|
|
2414
2436
|
events.push(productEvent(i));
|
|
2415
2437
|
}
|
|
2416
2438
|
events.push(skuEvent(1, 1));
|
|
2417
2439
|
let callCount = 0;
|
|
2418
|
-
|
|
2440
|
+
createImpl = () => {
|
|
2419
2441
|
callCount++;
|
|
2420
|
-
return callCount ===
|
|
2442
|
+
return callCount === 4 ? Promise.reject(new Error('create failed')) : Promise.resolve({});
|
|
2421
2443
|
};
|
|
2422
2444
|
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
2423
2445
|
await expect(bppa.sendEvents(events)).rejects.toMatchObject({
|
|
2424
|
-
message: '
|
|
2425
|
-
eventsCreatedBeforeFailure: { productSeasons:
|
|
2426
|
-
eventsFileId: 'file-123'
|
|
2446
|
+
message: 'create failed',
|
|
2447
|
+
eventsCreatedBeforeFailure: { productSeasons: 3, colorwaySeasons: 0 },
|
|
2448
|
+
eventsFileId: 'file-123',
|
|
2449
|
+
failedEventsInGroup: 1
|
|
2450
|
+
});
|
|
2451
|
+
expect(createCalls).toHaveLength(4);
|
|
2452
|
+
});
|
|
2453
|
+
it('keeps a readable message when the SDK rejects with a plain object instead of an Error', async () => {
|
|
2454
|
+
const bppa = newBppa(buildConfig({ separateEventsConcurrency: 1 }));
|
|
2455
|
+
createImpl = () => Promise.reject({ statusCode: 404, message: 'Internal Server Error' });
|
|
2456
|
+
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
2457
|
+
await expect(bppa.sendEvents([productEvent(1)])).rejects.toMatchObject({
|
|
2458
|
+
message: 'Internal Server Error',
|
|
2459
|
+
details: { statusCode: 404, message: 'Internal Server Error' },
|
|
2460
|
+
eventsCreatedBeforeFailure: { productSeasons: 0, colorwaySeasons: 0 }
|
|
2427
2461
|
});
|
|
2428
|
-
expect(batchCreateCalls).toHaveLength(2);
|
|
2429
2462
|
});
|
|
2430
2463
|
it('falls back to the item id when projectItemId or itemFamilyId are missing', async () => {
|
|
2431
2464
|
const bppa = newBppa(buildConfig());
|
|
@@ -2436,7 +2469,7 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2436
2469
|
delete sku.itemFamilyId;
|
|
2437
2470
|
const spyWarn = jest.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
2438
2471
|
await bppa.sendEvents([prod, sku]);
|
|
2439
|
-
const objects =
|
|
2472
|
+
const objects = createdObjects();
|
|
2440
2473
|
expect(objects[0].id).toBe('fam9');
|
|
2441
2474
|
expect(objects[0].itemFamilyId).toBe('fam9');
|
|
2442
2475
|
expect(objects[1].id).toBe('sku9');
|
|
@@ -2448,7 +2481,7 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2448
2481
|
jest.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
2449
2482
|
const result = await bppa.sendEvents([productEvent(1)]);
|
|
2450
2483
|
expect(result).toEqual({});
|
|
2451
|
-
expect(
|
|
2484
|
+
expect(createCalls).toHaveLength(0);
|
|
2452
2485
|
expect(fileUploadCalls).toHaveLength(0);
|
|
2453
2486
|
});
|
|
2454
2487
|
it('returns {} and does not throw when sendMode is missing', async () => {
|
|
@@ -2457,11 +2490,11 @@ describe('sendEvents - separateVibeIQEvents', () => {
|
|
|
2457
2490
|
jest.spyOn(console, 'warn').mockImplementation(() => undefined);
|
|
2458
2491
|
const result = await bppa.sendEvents([productEvent(1)]);
|
|
2459
2492
|
expect(result).toEqual({});
|
|
2460
|
-
expect(
|
|
2493
|
+
expect(createCalls).toHaveLength(0);
|
|
2461
2494
|
});
|
|
2462
2495
|
it('is case-insensitive about the sendMode value', async () => {
|
|
2463
2496
|
const bppa = newBppa(buildConfig({ sendMode: { ASYNC_PUBLISH_SEASON: 'SEPARATEVIBEIQEVENTS' } }));
|
|
2464
2497
|
await bppa.sendEvents([productEvent(1)]);
|
|
2465
|
-
expect(
|
|
2498
|
+
expect(createdObjects()).toHaveLength(1);
|
|
2466
2499
|
});
|
|
2467
2500
|
});
|
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.ed24f00",
|
|
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;
|