@aws-amplify/datastore 5.0.32 → 5.0.33-s-auth.30d0cd2.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.
Files changed (149) hide show
  1. package/dist/cjs/authModeStrategies/multiAuthStrategy.js +1 -1
  2. package/dist/cjs/authModeStrategies/multiAuthStrategy.js.map +1 -1
  3. package/dist/cjs/datastore/datastore.js +46 -41
  4. package/dist/cjs/datastore/datastore.js.map +1 -1
  5. package/dist/cjs/index.js +3 -1
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/predicates/index.js +1 -0
  8. package/dist/cjs/predicates/index.js.map +1 -1
  9. package/dist/cjs/predicates/next.js +13 -12
  10. package/dist/cjs/predicates/next.js.map +1 -1
  11. package/dist/cjs/predicates/sort.js +2 -2
  12. package/dist/cjs/predicates/sort.js.map +1 -1
  13. package/dist/cjs/storage/adapter/AsyncStorageAdapter.js +21 -18
  14. package/dist/cjs/storage/adapter/AsyncStorageAdapter.js.map +1 -1
  15. package/dist/cjs/storage/adapter/AsyncStorageDatabase.js +10 -9
  16. package/dist/cjs/storage/adapter/AsyncStorageDatabase.js.map +1 -1
  17. package/dist/cjs/storage/adapter/InMemoryStore.js +4 -1
  18. package/dist/cjs/storage/adapter/InMemoryStore.js.map +1 -1
  19. package/dist/cjs/storage/adapter/IndexedDBAdapter.js +21 -23
  20. package/dist/cjs/storage/adapter/IndexedDBAdapter.js.map +1 -1
  21. package/dist/cjs/storage/adapter/StorageAdapterBase.js +7 -7
  22. package/dist/cjs/storage/adapter/StorageAdapterBase.js.map +1 -1
  23. package/dist/cjs/storage/adapter/getDefaultAdapter/index.js +4 -1
  24. package/dist/cjs/storage/adapter/getDefaultAdapter/index.js.map +1 -1
  25. package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js +1 -0
  26. package/dist/cjs/storage/adapter/getDefaultAdapter/index.native.js.map +1 -1
  27. package/dist/cjs/storage/relationship.js +1 -0
  28. package/dist/cjs/storage/relationship.js.map +1 -1
  29. package/dist/cjs/storage/storage.js +14 -14
  30. package/dist/cjs/storage/storage.js.map +1 -1
  31. package/dist/cjs/sync/datastoreConnectivity.js +0 -3
  32. package/dist/cjs/sync/datastoreConnectivity.js.map +1 -1
  33. package/dist/cjs/sync/index.js +47 -43
  34. package/dist/cjs/sync/index.js.map +1 -1
  35. package/dist/cjs/sync/merger.js +1 -1
  36. package/dist/cjs/sync/merger.js.map +1 -1
  37. package/dist/cjs/sync/outbox.js +19 -17
  38. package/dist/cjs/sync/outbox.js.map +1 -1
  39. package/dist/cjs/sync/processors/errorMaps.js.map +1 -1
  40. package/dist/cjs/sync/processors/mutation.js +31 -28
  41. package/dist/cjs/sync/processors/mutation.js.map +1 -1
  42. package/dist/cjs/sync/processors/subscription.js +21 -12
  43. package/dist/cjs/sync/processors/subscription.js.map +1 -1
  44. package/dist/cjs/sync/processors/sync.js +25 -21
  45. package/dist/cjs/sync/processors/sync.js.map +1 -1
  46. package/dist/cjs/sync/utils.js +20 -21
  47. package/dist/cjs/sync/utils.js.map +1 -1
  48. package/dist/cjs/types.js +1 -0
  49. package/dist/cjs/types.js.map +1 -1
  50. package/dist/cjs/util.js +46 -25
  51. package/dist/cjs/util.js.map +1 -1
  52. package/dist/esm/authModeStrategies/multiAuthStrategy.d.ts +1 -1
  53. package/dist/esm/authModeStrategies/multiAuthStrategy.mjs +1 -1
  54. package/dist/esm/authModeStrategies/multiAuthStrategy.mjs.map +1 -1
  55. package/dist/esm/datastore/datastore.d.ts +4 -6
  56. package/dist/esm/datastore/datastore.mjs +42 -34
  57. package/dist/esm/datastore/datastore.mjs.map +1 -1
  58. package/dist/esm/index.d.ts +1 -1
  59. package/dist/esm/index.mjs +2 -2
  60. package/dist/esm/index.mjs.map +1 -1
  61. package/dist/esm/predicates/index.mjs +1 -0
  62. package/dist/esm/predicates/index.mjs.map +1 -1
  63. package/dist/esm/predicates/next.d.ts +7 -7
  64. package/dist/esm/predicates/next.mjs +13 -12
  65. package/dist/esm/predicates/next.mjs.map +1 -1
  66. package/dist/esm/predicates/sort.d.ts +1 -1
  67. package/dist/esm/predicates/sort.mjs +2 -2
  68. package/dist/esm/predicates/sort.mjs.map +1 -1
  69. package/dist/esm/storage/adapter/AsyncStorageAdapter.d.ts +1 -1
  70. package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs +21 -18
  71. package/dist/esm/storage/adapter/AsyncStorageAdapter.mjs.map +1 -1
  72. package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs +10 -9
  73. package/dist/esm/storage/adapter/AsyncStorageDatabase.mjs.map +1 -1
  74. package/dist/esm/storage/adapter/InMemoryStore.mjs +4 -1
  75. package/dist/esm/storage/adapter/InMemoryStore.mjs.map +1 -1
  76. package/dist/esm/storage/adapter/IndexedDBAdapter.mjs +21 -23
  77. package/dist/esm/storage/adapter/IndexedDBAdapter.mjs.map +1 -1
  78. package/dist/esm/storage/adapter/StorageAdapterBase.d.ts +2 -2
  79. package/dist/esm/storage/adapter/StorageAdapterBase.mjs +7 -7
  80. package/dist/esm/storage/adapter/StorageAdapterBase.mjs.map +1 -1
  81. package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs +3 -1
  82. package/dist/esm/storage/adapter/getDefaultAdapter/index.mjs.map +1 -1
  83. package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs +1 -0
  84. package/dist/esm/storage/adapter/getDefaultAdapter/index.native.mjs.map +1 -1
  85. package/dist/esm/storage/adapter/index.d.ts +1 -1
  86. package/dist/esm/storage/relationship.mjs +1 -0
  87. package/dist/esm/storage/relationship.mjs.map +1 -1
  88. package/dist/esm/storage/storage.d.ts +11 -11
  89. package/dist/esm/storage/storage.mjs +10 -10
  90. package/dist/esm/storage/storage.mjs.map +1 -1
  91. package/dist/esm/sync/datastoreConnectivity.d.ts +2 -2
  92. package/dist/esm/sync/datastoreConnectivity.mjs +0 -3
  93. package/dist/esm/sync/datastoreConnectivity.mjs.map +1 -1
  94. package/dist/esm/sync/index.d.ts +3 -3
  95. package/dist/esm/sync/index.mjs +47 -43
  96. package/dist/esm/sync/index.mjs.map +1 -1
  97. package/dist/esm/sync/merger.d.ts +1 -1
  98. package/dist/esm/sync/merger.mjs +1 -1
  99. package/dist/esm/sync/merger.mjs.map +1 -1
  100. package/dist/esm/sync/outbox.d.ts +4 -4
  101. package/dist/esm/sync/outbox.mjs +19 -17
  102. package/dist/esm/sync/outbox.mjs.map +1 -1
  103. package/dist/esm/sync/processors/errorMaps.mjs.map +1 -1
  104. package/dist/esm/sync/processors/mutation.d.ts +5 -5
  105. package/dist/esm/sync/processors/mutation.mjs +31 -28
  106. package/dist/esm/sync/processors/mutation.mjs.map +1 -1
  107. package/dist/esm/sync/processors/subscription.d.ts +1 -1
  108. package/dist/esm/sync/processors/subscription.mjs +21 -12
  109. package/dist/esm/sync/processors/subscription.mjs.map +1 -1
  110. package/dist/esm/sync/processors/sync.d.ts +3 -3
  111. package/dist/esm/sync/processors/sync.mjs +13 -9
  112. package/dist/esm/sync/processors/sync.mjs.map +1 -1
  113. package/dist/esm/sync/utils.d.ts +11 -13
  114. package/dist/esm/sync/utils.mjs +20 -21
  115. package/dist/esm/sync/utils.mjs.map +1 -1
  116. package/dist/esm/types.d.ts +121 -131
  117. package/dist/esm/types.mjs +3 -2
  118. package/dist/esm/types.mjs.map +1 -1
  119. package/dist/esm/util.d.ts +5 -5
  120. package/dist/esm/util.mjs +46 -25
  121. package/dist/esm/util.mjs.map +1 -1
  122. package/package.json +74 -73
  123. package/src/authModeStrategies/multiAuthStrategy.ts +8 -4
  124. package/src/datastore/datastore.ts +145 -123
  125. package/src/index.ts +10 -8
  126. package/src/predicates/index.ts +10 -2
  127. package/src/predicates/next.ts +39 -28
  128. package/src/predicates/sort.ts +23 -26
  129. package/src/storage/adapter/AsyncStorageAdapter.ts +43 -25
  130. package/src/storage/adapter/AsyncStorageDatabase.ts +18 -10
  131. package/src/storage/adapter/InMemoryStore.ts +5 -1
  132. package/src/storage/adapter/IndexedDBAdapter.ts +50 -37
  133. package/src/storage/adapter/StorageAdapterBase.ts +24 -18
  134. package/src/storage/adapter/getDefaultAdapter/index.native.ts +1 -0
  135. package/src/storage/adapter/getDefaultAdapter/index.ts +4 -1
  136. package/src/storage/adapter/index.ts +2 -2
  137. package/src/storage/relationship.ts +5 -1
  138. package/src/storage/storage.ts +38 -30
  139. package/src/sync/datastoreConnectivity.ts +4 -6
  140. package/src/sync/index.ts +228 -230
  141. package/src/sync/merger.ts +4 -3
  142. package/src/sync/outbox.ts +26 -24
  143. package/src/sync/processors/errorMaps.ts +5 -0
  144. package/src/sync/processors/mutation.ts +80 -72
  145. package/src/sync/processors/subscription.ts +69 -53
  146. package/src/sync/processors/sync.ts +49 -37
  147. package/src/sync/utils.ts +60 -41
  148. package/src/types.ts +165 -165
  149. package/src/util.ts +89 -53
package/src/util.ts CHANGED
@@ -1,40 +1,41 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { monotonicFactory, ULID } from 'ulid';
3
+ import { ULID, monotonicFactory } from 'ulid';
4
4
  import {
5
- amplifyUuid,
6
5
  AmplifyUrl,
7
6
  WordArray,
7
+ amplifyUuid,
8
8
  } from '@aws-amplify/core/internals/utils';
9
- import { produce, applyPatches, Patch } from 'immer';
9
+ import { Patch, applyPatches, produce } from 'immer';
10
+
10
11
  import { ModelInstanceCreator } from './datastore/datastore';
11
12
  import {
12
13
  AllOperators,
13
- isPredicateGroup,
14
- isPredicateObj,
14
+ DeferredCallbackResolverOptions,
15
+ IndexesType,
16
+ LimitTimerRaceResolvedValues,
17
+ ModelAssociation,
18
+ ModelAttribute,
19
+ ModelAttributes,
20
+ ModelKeys,
21
+ NonModelTypeConstructor,
22
+ PaginationInput,
15
23
  PersistentModel,
16
24
  PersistentModelConstructor,
17
25
  PredicateGroups,
18
26
  PredicateObject,
19
27
  PredicatesGroup,
20
- RelationshipType,
21
28
  RelationType,
22
- ModelKeys,
23
- ModelAttributes,
29
+ RelationshipType,
30
+ SchemaModel,
24
31
  SchemaNamespace,
25
- SortPredicatesGroup,
26
32
  SortDirection,
33
+ SortPredicatesGroup,
34
+ isModelAttributeCompositeKey,
27
35
  isModelAttributeKey,
28
36
  isModelAttributePrimaryKey,
29
- isModelAttributeCompositeKey,
30
- NonModelTypeConstructor,
31
- PaginationInput,
32
- DeferredCallbackResolverOptions,
33
- LimitTimerRaceResolvedValues,
34
- SchemaModel,
35
- ModelAttribute,
36
- IndexesType,
37
- ModelAssociation,
37
+ isPredicateGroup,
38
+ isPredicateObj,
38
39
  } from './types';
39
40
  import { ModelSortPredicateCreator } from './predicates';
40
41
 
@@ -73,14 +74,14 @@ export enum NAMESPACES {
73
74
  STORAGE = 'storage',
74
75
  }
75
76
 
76
- const DATASTORE = NAMESPACES.DATASTORE;
77
- const USER = NAMESPACES.USER;
78
- const SYNC = NAMESPACES.SYNC;
79
- const STORAGE = NAMESPACES.STORAGE;
77
+ const { DATASTORE } = NAMESPACES;
78
+ const { USER } = NAMESPACES;
79
+ const { SYNC } = NAMESPACES;
80
+ const { STORAGE } = NAMESPACES;
80
81
 
81
82
  export { USER, SYNC, STORAGE, DATASTORE };
82
83
 
83
- export const exhaustiveCheck = (obj: never, throwOnError: boolean = true) => {
84
+ export const exhaustiveCheck = (obj: never, throwOnError = true) => {
84
85
  if (throwOnError) {
85
86
  throw new Error(`Invalid ${obj}`);
86
87
  }
@@ -127,6 +128,7 @@ export const validatePredicate = <T extends PersistentModel>(
127
128
 
128
129
  if (isPredicateGroup(predicateOrGroup)) {
129
130
  const { type, predicates } = predicateOrGroup;
131
+
130
132
  return validatePredicate(model, type, predicates);
131
133
  }
132
134
 
@@ -154,23 +156,26 @@ export const validatePredicateField = <T>(
154
156
  return value >= operand;
155
157
  case 'gt':
156
158
  return value > operand;
157
- case 'between':
158
- const [min, max] = <[T, T]>operand;
159
+ case 'between': {
160
+ const [min, max] = operand as [T, T];
161
+
159
162
  return value >= min && value <= max;
163
+ }
160
164
  case 'beginsWith':
161
165
  return (
162
166
  !isNullOrUndefined(value) &&
163
- (<string>(<unknown>value)).startsWith(<string>(<unknown>operand))
167
+ (value as unknown as string).startsWith(operand as unknown as string)
164
168
  );
165
169
  case 'contains':
166
170
  return (
167
171
  !isNullOrUndefined(value) &&
168
- (<string>(<unknown>value)).indexOf(<string>(<unknown>operand)) > -1
172
+ (value as unknown as string).indexOf(operand as unknown as string) > -1
169
173
  );
170
174
  case 'notContains':
171
175
  return (
172
176
  isNullOrUndefined(value) ||
173
- (<string>(<unknown>value)).indexOf(<string>(<unknown>operand)) === -1
177
+ (value as unknown as string).indexOf(operand as unknown as string) ===
178
+ -1
174
179
  );
175
180
  default:
176
181
  return false;
@@ -181,7 +186,7 @@ export const isModelConstructor = <T extends PersistentModel>(
181
186
  obj: any,
182
187
  ): obj is PersistentModelConstructor<T> => {
183
188
  return (
184
- obj && typeof (<PersistentModelConstructor<T>>obj).copyOf === 'function'
189
+ obj && typeof (obj as PersistentModelConstructor<T>).copyOf === 'function'
185
190
  );
186
191
  };
187
192
 
@@ -220,7 +225,9 @@ export const traverseModel = <T extends PersistentModel>(
220
225
  instance: T;
221
226
  }[] = [];
222
227
 
223
- const newInstance = modelConstructor.copyOf(instance, () => {});
228
+ const newInstance = modelConstructor.copyOf(instance, () => {
229
+ // no-op
230
+ });
224
231
 
225
232
  result.unshift({
226
233
  modelName: srcModelName,
@@ -251,6 +258,7 @@ let privateModeCheckResult;
251
258
  export const isPrivateMode = () => {
252
259
  return new Promise(resolve => {
253
260
  const dbname = amplifyUuid();
261
+ // eslint-disable-next-line prefer-const
254
262
  let db;
255
263
 
256
264
  const isPrivate = () => {
@@ -268,7 +276,7 @@ export const isPrivateMode = () => {
268
276
 
269
277
  privateModeCheckResult = true;
270
278
 
271
- return resolve(false);
279
+ resolve(false);
272
280
  };
273
281
 
274
282
  if (privateModeCheckResult === true) {
@@ -276,10 +284,16 @@ export const isPrivateMode = () => {
276
284
  }
277
285
 
278
286
  if (privateModeCheckResult === false) {
279
- return isPrivate();
287
+ isPrivate();
288
+
289
+ return;
280
290
  }
281
291
 
282
- if (indexedDB === null) return isPrivate();
292
+ if (indexedDB === null) {
293
+ isPrivate();
294
+
295
+ return;
296
+ }
283
297
 
284
298
  db = indexedDB.open(dbname);
285
299
  db.onerror = isPrivate;
@@ -313,19 +327,23 @@ export const isSafariCompatabilityMode: () => Promise<boolean> = async () => {
313
327
 
314
328
  const db: IDBDatabase | false = await new Promise(resolve => {
315
329
  const dbOpenRequest = indexedDB.open(dbName);
316
- dbOpenRequest.onerror = () => resolve(false);
330
+ dbOpenRequest.onerror = () => {
331
+ resolve(false);
332
+ };
317
333
 
318
334
  dbOpenRequest.onsuccess = () => {
319
- const db = dbOpenRequest.result;
320
- resolve(db);
335
+ const openedDb = dbOpenRequest.result;
336
+ resolve(openedDb);
321
337
  };
322
338
 
323
339
  dbOpenRequest.onupgradeneeded = (event: any) => {
324
- const db = event?.target?.result;
340
+ const upgradedDb = event?.target?.result;
325
341
 
326
- db.onerror = () => resolve(false);
342
+ upgradedDb.onerror = () => {
343
+ resolve(false);
344
+ };
327
345
 
328
- const store = db.createObjectStore(storeName, {
346
+ const store = upgradedDb.createObjectStore(storeName, {
329
347
  autoIncrement: true,
330
348
  });
331
349
 
@@ -352,7 +370,9 @@ export const isSafariCompatabilityMode: () => Promise<boolean> = async () => {
352
370
 
353
371
  const getRequest = index.get([1]);
354
372
 
355
- getRequest.onerror = () => resolve(false);
373
+ getRequest.onerror = () => {
374
+ resolve(false);
375
+ };
356
376
 
357
377
  getRequest.onsuccess = (event: any) => {
358
378
  resolve(event?.target?.result);
@@ -360,6 +380,7 @@ export const isSafariCompatabilityMode: () => Promise<boolean> = async () => {
360
380
  });
361
381
 
362
382
  if (db && typeof db.close === 'function') {
383
+ // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
363
384
  await db.close();
364
385
  }
365
386
 
@@ -486,7 +507,7 @@ export function sortCompareFunction<T extends PersistentModel>(
486
507
  export function directedValueEquality(
487
508
  fromObject: object,
488
509
  againstObject: object,
489
- nullish: boolean = false,
510
+ nullish = false,
490
511
  ) {
491
512
  const aKeys = Object.keys(fromObject);
492
513
 
@@ -507,11 +528,7 @@ export function directedValueEquality(
507
528
  // returns true if equal by value
508
529
  // if nullish is true, treat undefined and null values as equal
509
530
  // to normalize for GQL response values for undefined fields
510
- export function valuesEqual(
511
- valA: any,
512
- valB: any,
513
- nullish: boolean = false,
514
- ): boolean {
531
+ export function valuesEqual(valA: any, valB: any, nullish = false): boolean {
515
532
  let a = valA;
516
533
  let b = valB;
517
534
 
@@ -610,6 +627,7 @@ export function inMemoryPagination<T extends PersistentModel>(
610
627
 
611
628
  return records.slice(start, end);
612
629
  }
630
+
613
631
  return records;
614
632
  }
615
633
 
@@ -629,6 +647,7 @@ export async function asyncSome(
629
647
  return true;
630
648
  }
631
649
  }
650
+
632
651
  return false;
633
652
  }
634
653
 
@@ -648,6 +667,7 @@ export async function asyncEvery(
648
667
  return false;
649
668
  }
650
669
  }
670
+
651
671
  return true;
652
672
  }
653
673
 
@@ -669,6 +689,7 @@ export async function asyncFilter<T>(
669
689
  results.push(item);
670
690
  }
671
691
  }
692
+
672
693
  return results;
673
694
  }
674
695
 
@@ -701,6 +722,7 @@ export const isAWSEmail = (val: string): boolean => {
701
722
  export const isAWSJSON = (val: string): boolean => {
702
723
  try {
703
724
  JSON.parse(val);
725
+
704
726
  return true;
705
727
  } catch {
706
728
  return false;
@@ -730,6 +752,7 @@ export class DeferredPromise {
730
752
  public resolve: (value: string | PromiseLike<string>) => void;
731
753
  public reject: () => void;
732
754
  constructor() {
755
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
733
756
  const self = this;
734
757
  this.promise = new Promise(
735
758
  (resolve: (value: string | PromiseLike<string>) => void, reject) => {
@@ -746,7 +769,10 @@ export class DeferredCallbackResolver {
746
769
  private maxInterval: number;
747
770
  private timer: ReturnType<typeof setTimeout>;
748
771
  private raceInFlight = false;
749
- private callback = () => {};
772
+ private callback = () => {
773
+ // no-op
774
+ };
775
+
750
776
  private errorHandler: (error: string) => void;
751
777
  private defaultErrorHandler = (
752
778
  msg = 'DeferredCallbackResolver error',
@@ -761,7 +787,7 @@ export class DeferredCallbackResolver {
761
787
  }
762
788
 
763
789
  private startTimer(): void {
764
- this.timerPromise = new Promise((resolve, reject) => {
790
+ this.timerPromise = new Promise((resolve, _reject) => {
765
791
  this.timer = setTimeout(() => {
766
792
  resolve(LimitTimerRaceResolvedValues.TIMER);
767
793
  }, this.maxInterval);
@@ -786,6 +812,7 @@ export class DeferredCallbackResolver {
786
812
  this.raceInFlight = false;
787
813
  this.limitPromise = new DeferredPromise();
788
814
 
815
+ // eslint-disable-next-line no-unsafe-finally
789
816
  return winner!;
790
817
  }
791
818
  }
@@ -836,6 +863,7 @@ export function mergePatches<T>(
836
863
  patches = p;
837
864
  },
838
865
  );
866
+
839
867
  return patches!;
840
868
  }
841
869
 
@@ -845,7 +873,7 @@ export const getStorename = (namespace: string, modelName: string) => {
845
873
  return storeName;
846
874
  };
847
875
 
848
- //#region Key Utils
876
+ // #region Key Utils
849
877
 
850
878
  /*
851
879
  When we have GSI(s) with composite sort keys defined on a model
@@ -903,6 +931,7 @@ export const processCompositeKeys = (
903
931
 
904
932
  if (combined.length === 0) {
905
933
  combined.push(sortKeyFieldsSet);
934
+
906
935
  return combined;
907
936
  }
908
937
 
@@ -966,6 +995,7 @@ export const extractPrimaryKeysAndValues = <T extends PersistentModel>(
966
995
  ): any => {
967
996
  const primaryKeysAndValues = {};
968
997
  keyFields.forEach(key => (primaryKeysAndValues[key] = model[key]));
998
+
969
999
  return primaryKeysAndValues;
970
1000
  };
971
1001
 
@@ -1012,13 +1042,14 @@ export const establishRelationAndKeys = (
1012
1042
  typeof fieldAttribute.type === 'object' &&
1013
1043
  'model' in fieldAttribute.type
1014
1044
  ) {
1015
- const connectionType = fieldAttribute.association!.connectionType;
1045
+ const { connectionType } = fieldAttribute.association!;
1016
1046
  relationship[mKey].relationTypes.push({
1017
1047
  fieldName: fieldAttribute.name,
1018
1048
  modelName: fieldAttribute.type.model,
1019
1049
  relationType: connectionType,
1020
- targetName: fieldAttribute.association!['targetName'],
1021
- targetNames: fieldAttribute.association!['targetNames'],
1050
+ targetName: fieldAttribute.association!.targetName,
1051
+ targetNames: fieldAttribute.association!.targetNames,
1052
+ // eslint-disable-next-line dot-notation
1022
1053
  associatedWith: fieldAttribute.association!['associatedWith'],
1023
1054
  });
1024
1055
 
@@ -1089,13 +1120,16 @@ export const getIndex = (
1089
1120
  src: string,
1090
1121
  ): string | undefined => {
1091
1122
  let indexName;
1123
+ // eslint-disable-next-line array-callback-return
1092
1124
  rel.some((relItem: RelationType) => {
1093
1125
  if (relItem.modelName === src) {
1094
1126
  const targetNames = extractTargetNamesFromSrc(relItem);
1095
1127
  indexName = targetNames && indexNameFromKeys(targetNames);
1128
+
1096
1129
  return true;
1097
1130
  }
1098
1131
  });
1132
+
1099
1133
  return indexName;
1100
1134
  };
1101
1135
 
@@ -1112,6 +1146,7 @@ export const getIndexFromAssociation = (
1112
1146
  }
1113
1147
 
1114
1148
  const associationIndex = indexes.find(([idxName]) => idxName === indexName);
1149
+
1115
1150
  return associationIndex && associationIndex[0];
1116
1151
  };
1117
1152
 
@@ -1144,6 +1179,7 @@ export const indexNameFromKeys = (keys: string[]): string => {
1144
1179
  if (idx === 0) {
1145
1180
  return cur;
1146
1181
  }
1182
+
1147
1183
  return `${prev}${IDENTIFIER_KEY_SEPARATOR}${cur}`;
1148
1184
  }, '');
1149
1185
  };
@@ -1170,7 +1206,7 @@ export const getIndexKeys = (
1170
1206
  return [ID];
1171
1207
  };
1172
1208
 
1173
- //#endregion
1209
+ // #endregion
1174
1210
 
1175
1211
  /**
1176
1212
  * Determine what the managed timestamp field names are for the given model definition