@contrail/flexplm 1.1.59 → 1.1.61

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.
@@ -287,7 +287,7 @@ describe('getPersistableChanges', () => {
287
287
  };
288
288
  const diffs = dc.getPersistableChanges(entity, potentialChanges);
289
289
  expect(Object.getOwnPropertyNames(diffs).length).toEqual(1);
290
- expect(diffs['str']).toEqual(potentialChanges['str']);
290
+ expect(diffs['str']).toBeNull();
291
291
  });
292
292
  });
293
293
  describe('getObjectReferenceValue cache', () => {
@@ -87,22 +87,18 @@ class ThumbnailUtil {
87
87
  return sizes;
88
88
  }
89
89
  async getContentEntity(primaryViewableId, sizes) {
90
- const criteria = {
91
- id: primaryViewableId
92
- };
93
90
  const relations = sizes.map(s => s.slug);
94
91
  relations.push('primaryFile');
95
- const contentResults = await this.entities.get({
92
+ const content = await this.entities.get({
96
93
  entityName: 'content',
97
- criteria,
94
+ id: primaryViewableId,
98
95
  relations
99
96
  });
100
- const content = (contentResults && contentResults[0]) ? contentResults[0] : undefined;
101
97
  this.logContentResults(content, relations);
102
98
  return content;
103
99
  }
104
100
  logContentResults(content, relations) {
105
- if (app_framework_1.Logger.isDebugOn()) {
101
+ if (app_framework_1.Logger.isDebugOn() && content && relations) {
106
102
  const contentCopy = JSON.parse(JSON.stringify(content));
107
103
  relations.forEach(r => {
108
104
  delete contentCopy[r];
@@ -211,4 +211,30 @@ describe('ThumbnailUtil Tests', () => {
211
211
  expect(results).toBeTruthy();
212
212
  });
213
213
  });
214
+ describe('logContentResults', () => {
215
+ it('no content - doesnt error', () => {
216
+ const tu = new thumbnail_util_1.ThumbnailUtil(config);
217
+ const content = undefined;
218
+ const relations = [];
219
+ tu.logContentResults(content, relations);
220
+ });
221
+ it('no relations - doesnt error', () => {
222
+ const tu = new thumbnail_util_1.ThumbnailUtil(config);
223
+ const content = undefined;
224
+ const relations = undefined;
225
+ tu.logContentResults(content, relations);
226
+ });
227
+ it('content and relations - logs', () => {
228
+ const tu = new thumbnail_util_1.ThumbnailUtil(config);
229
+ const content = {
230
+ id: '123',
231
+ name: 'Test',
232
+ primaryFile: { id: 'file123' }
233
+ };
234
+ const relations = ['primaryFile'];
235
+ tu.logContentResults(content, relations);
236
+ expect(Object.keys(content)).toHaveLength(3);
237
+ expect(content).toHaveProperty('primaryFile');
238
+ });
239
+ });
214
240
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.59",
3
+ "version": "1.1.61",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -40,9 +40,10 @@
40
40
  "testEnvironment": "node"
41
41
  },
42
42
  "dependencies": {
43
- "@contrail/app-framework": "^1.2.4",
44
- "@contrail/sdk": "^1.3.7",
45
- "@contrail/transform-data": "^1.1.1",
43
+ "@contrail/app-framework": "^1.3.4",
44
+ "@contrail/sdk": "^1.4.3",
45
+ "@contrail/transform-data": "^1.1.3",
46
+ "@contrail/util": "^1.0.48",
46
47
  "axios": "^1.4.0",
47
48
  "p-limit": "^3.1.0"
48
49
  }
@@ -321,7 +321,7 @@ describe('getPersistableChanges', () =>{
321
321
 
322
322
  const diffs = dc.getPersistableChanges(entity, potentialChanges);
323
323
  expect(Object.getOwnPropertyNames(diffs).length).toEqual(1);
324
- expect(diffs['str']).toEqual(potentialChanges['str']);
324
+ expect(diffs['str']).toBeNull();
325
325
  });
326
326
 
327
327
  });
@@ -234,4 +234,34 @@ describe('ThumbnailUtil Tests', () =>{
234
234
  expect(results).toBeTruthy();
235
235
  });
236
236
  });
237
+
238
+ describe('logContentResults', () =>{
239
+ it('no content - doesnt error', () =>{
240
+ const tu = new ThumbnailUtil(config);
241
+ const content = undefined;
242
+ const relations = [];
243
+ tu.logContentResults(content, relations);
244
+ });
245
+ it('no relations - doesnt error', () =>{
246
+ const tu = new ThumbnailUtil(config);
247
+ const content = undefined;
248
+ const relations = undefined;
249
+ tu.logContentResults(content, relations);
250
+ });
251
+
252
+ it('content and relations - logs', () =>{
253
+ const tu = new ThumbnailUtil(config);
254
+ const content = {
255
+ id: '123',
256
+ name: 'Test',
257
+ primaryFile: { id:'file123'}
258
+ };
259
+ const relations = ['primaryFile'];
260
+ tu.logContentResults(content, relations);
261
+
262
+ expect(Object.keys(content)).toHaveLength(3);
263
+ expect(content).toHaveProperty('primaryFile');
264
+ });
265
+
266
+ });
237
267
  });
@@ -105,17 +105,13 @@ export class ThumbnailUtil {
105
105
  }
106
106
 
107
107
  async getContentEntity(primaryViewableId: any, sizes: any[]) {
108
- const criteria = {
109
- id: primaryViewableId
110
- };
111
108
  const relations = sizes.map(s => s.slug);
112
109
  relations.push('primaryFile');
113
- const contentResults = await this.entities.get({
110
+ const content = await this.entities.get({
114
111
  entityName: 'content',
115
- criteria,
112
+ id: primaryViewableId,
116
113
  relations
117
114
  });
118
- const content = (contentResults && contentResults[0]) ? contentResults[0] : undefined;
119
115
  this.logContentResults(content, relations);
120
116
  return content;
121
117
  }
@@ -129,7 +125,7 @@ export class ThumbnailUtil {
129
125
  * @param relations: string[] of the slugs for inflated objects
130
126
  */
131
127
  logContentResults(content: any, relations: string[]) {
132
- if(Logger.isDebugOn()){
128
+ if(Logger.isDebugOn() && content && relations){
133
129
  const contentCopy = JSON.parse(JSON.stringify(content));
134
130
  relations.forEach(r => {
135
131
  delete contentCopy[r];