@aws-amplify/datastore 3.7.8-cloud-logging.7 → 3.7.8-unstable.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/dist/aws-amplify-datastore.js +159 -573
- package/dist/aws-amplify-datastore.js.map +1 -1
- package/dist/aws-amplify-datastore.min.js +22 -78
- package/dist/aws-amplify-datastore.min.js.map +1 -1
- package/lib/datastore/datastore.js +9 -18
- package/lib/datastore/datastore.js.map +1 -1
- package/lib/storage/adapter/index.d.ts +0 -1
- package/lib/storage/storage.d.ts +0 -2
- package/lib/storage/storage.js +0 -24
- package/lib/storage/storage.js.map +1 -1
- package/lib/sync/index.js +13 -20
- package/lib/sync/index.js.map +1 -1
- package/lib/sync/processors/mutation.js +0 -1
- package/lib/sync/processors/mutation.js.map +1 -1
- package/lib/types.d.ts +0 -1
- package/lib/types.js.map +1 -1
- package/lib-esm/datastore/datastore.js +9 -18
- package/lib-esm/datastore/datastore.js.map +1 -1
- package/lib-esm/storage/adapter/index.d.ts +0 -1
- package/lib-esm/storage/storage.d.ts +0 -2
- package/lib-esm/storage/storage.js +0 -24
- package/lib-esm/storage/storage.js.map +1 -1
- package/lib-esm/sync/index.js +13 -20
- package/lib-esm/sync/index.js.map +1 -1
- package/lib-esm/sync/processors/mutation.js +0 -1
- package/lib-esm/sync/processors/mutation.js.map +1 -1
- package/lib-esm/types.d.ts +0 -1
- package/lib-esm/types.js.map +1 -1
- package/package.json +7 -7
- package/src/datastore/datastore.ts +1 -10
- package/src/storage/adapter/index.ts +0 -1
- package/src/storage/storage.ts +0 -11
- package/src/sync/index.ts +0 -8
- package/src/sync/processors/mutation.ts +24 -21
- package/src/types.ts +12 -11
|
@@ -565,7 +565,7 @@ function defaultConflictHandler(conflictData: SyncConflict): PersistentModel {
|
|
|
565
565
|
}
|
|
566
566
|
|
|
567
567
|
function defaultErrorHandler(error: SyncError) {
|
|
568
|
-
logger.warn(
|
|
568
|
+
logger.warn(error);
|
|
569
569
|
}
|
|
570
570
|
|
|
571
571
|
function getModelConstructorByModelName(
|
|
@@ -728,9 +728,6 @@ class DataStore {
|
|
|
728
728
|
|
|
729
729
|
await this.storage.init();
|
|
730
730
|
|
|
731
|
-
logger.debug('Debug info before sync');
|
|
732
|
-
await this.storage.logDebugInfo();
|
|
733
|
-
|
|
734
731
|
await checkSchemaVersion(this.storage, schema.version);
|
|
735
732
|
|
|
736
733
|
const { aws_appsync_graphqlEndpoint } = this.amplifyConfig;
|
|
@@ -770,12 +767,6 @@ class DataStore {
|
|
|
770
767
|
this.initResolve();
|
|
771
768
|
}
|
|
772
769
|
|
|
773
|
-
if (type === ControlMessage.SYNC_ENGINE_SYNC_QUERIES_READY) {
|
|
774
|
-
logger.debug('Debug info after sync');
|
|
775
|
-
this.storage.logDebugInfo();
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
logger.debug({ event: type, data });
|
|
779
770
|
Hub.dispatch('datastore', {
|
|
780
771
|
event: type,
|
|
781
772
|
data,
|
package/src/storage/storage.ts
CHANGED
|
@@ -371,13 +371,6 @@ class StorageClass implements StorageFacade {
|
|
|
371
371
|
_deleted,
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
async logDebugInfo() {
|
|
376
|
-
if (typeof this.adapter.getDebugInfo === 'function') {
|
|
377
|
-
const results = await this.adapter.getDebugInfo();
|
|
378
|
-
logger.debug('DB Debug Info', results);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
374
|
}
|
|
382
375
|
|
|
383
376
|
class ExclusiveStorage implements StorageFacade {
|
|
@@ -489,10 +482,6 @@ class ExclusiveStorage implements StorageFacade {
|
|
|
489
482
|
return this.storage.batchSave(modelConstructor, items);
|
|
490
483
|
}
|
|
491
484
|
|
|
492
|
-
async logDebugInfo(): Promise<void> {
|
|
493
|
-
return this.runExclusive(storage => storage.logDebugInfo());
|
|
494
|
-
}
|
|
495
|
-
|
|
496
485
|
async init() {
|
|
497
486
|
return this.storage.init();
|
|
498
487
|
}
|
package/src/sync/index.ts
CHANGED
|
@@ -303,11 +303,6 @@ export class SyncEngine {
|
|
|
303
303
|
isEmpty: !hasMore,
|
|
304
304
|
},
|
|
305
305
|
});
|
|
306
|
-
|
|
307
|
-
if (!hasMore) {
|
|
308
|
-
logger.debug('Debug info after queue drained');
|
|
309
|
-
this.storage.logDebugInfo();
|
|
310
|
-
}
|
|
311
306
|
})
|
|
312
307
|
);
|
|
313
308
|
//#endregion
|
|
@@ -345,9 +340,6 @@ export class SyncEngine {
|
|
|
345
340
|
},
|
|
346
341
|
});
|
|
347
342
|
|
|
348
|
-
logger.debug('Debug info after offline');
|
|
349
|
-
await this.storage.logDebugInfo();
|
|
350
|
-
|
|
351
343
|
subscriptions.forEach(sub => sub.unsubscribe());
|
|
352
344
|
subscriptions = [];
|
|
353
345
|
}
|
|
@@ -251,14 +251,19 @@ class MutationProcessor {
|
|
|
251
251
|
MutationEvent: PersistentModelConstructor<MutationEvent>,
|
|
252
252
|
mutationEvent: MutationEvent
|
|
253
253
|
) => {
|
|
254
|
-
const [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
const [
|
|
255
|
+
query,
|
|
256
|
+
variables,
|
|
257
|
+
graphQLCondition,
|
|
258
|
+
opName,
|
|
259
|
+
modelDefinition,
|
|
260
|
+
] = this.createQueryVariables(
|
|
261
|
+
namespaceName,
|
|
262
|
+
model,
|
|
263
|
+
operation,
|
|
264
|
+
data,
|
|
265
|
+
condition
|
|
266
|
+
);
|
|
262
267
|
|
|
263
268
|
const authToken = await getTokenForCustomAuth(
|
|
264
269
|
authMode,
|
|
@@ -353,18 +358,17 @@ class MutationProcessor {
|
|
|
353
358
|
const namespace = this.schema.namespaces[namespaceName];
|
|
354
359
|
|
|
355
360
|
// convert retry with to tryWith
|
|
356
|
-
const updatedMutation =
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
);
|
|
361
|
+
const updatedMutation = createMutationInstanceFromModelOperation(
|
|
362
|
+
namespace.relationships,
|
|
363
|
+
modelDefinition,
|
|
364
|
+
opType,
|
|
365
|
+
modelConstructor,
|
|
366
|
+
retryWith,
|
|
367
|
+
graphQLCondition,
|
|
368
|
+
MutationEvent,
|
|
369
|
+
this.modelInstanceCreator,
|
|
370
|
+
mutationEvent.id
|
|
371
|
+
);
|
|
368
372
|
|
|
369
373
|
await this.storage.save(updatedMutation);
|
|
370
374
|
|
|
@@ -376,7 +380,6 @@ class MutationProcessor {
|
|
|
376
380
|
modelConstructor,
|
|
377
381
|
variables.input
|
|
378
382
|
),
|
|
379
|
-
modelName: model,
|
|
380
383
|
message: error.message,
|
|
381
384
|
operation,
|
|
382
385
|
errorType: error.errorType,
|
package/src/types.ts
CHANGED
|
@@ -407,14 +407,15 @@ export type DataStoreSnapshot<T extends PersistentModel> = {
|
|
|
407
407
|
|
|
408
408
|
//#region Predicates
|
|
409
409
|
|
|
410
|
-
export type PredicateExpression<
|
|
411
|
-
M extends PersistentModel,
|
|
410
|
+
export type PredicateExpression<M extends PersistentModel, FT> = TypeName<
|
|
412
411
|
FT
|
|
413
|
-
>
|
|
412
|
+
> extends keyof MapTypeToOperands<FT>
|
|
414
413
|
? (
|
|
415
414
|
operator: keyof MapTypeToOperands<FT>[TypeName<FT>],
|
|
416
415
|
// make the operand type match the type they're trying to filter on
|
|
417
|
-
operand: MapTypeToOperands<FT>[TypeName<FT>][keyof MapTypeToOperands<
|
|
416
|
+
operand: MapTypeToOperands<FT>[TypeName<FT>][keyof MapTypeToOperands<
|
|
417
|
+
FT
|
|
418
|
+
>[TypeName<FT>]]
|
|
418
419
|
) => ModelPredicate<M>
|
|
419
420
|
: never;
|
|
420
421
|
|
|
@@ -482,7 +483,8 @@ export type PredicateGroups<T extends PersistentModel> = {
|
|
|
482
483
|
|
|
483
484
|
export type ModelPredicate<M extends PersistentModel> = {
|
|
484
485
|
[K in keyof M]-?: PredicateExpression<M, NonNullable<M[K]>>;
|
|
485
|
-
} &
|
|
486
|
+
} &
|
|
487
|
+
PredicateGroups<M>;
|
|
486
488
|
|
|
487
489
|
export type ProducerModelPredicate<M extends PersistentModel> = (
|
|
488
490
|
condition: ModelPredicate<M>
|
|
@@ -572,10 +574,9 @@ export type SortPredicate<T extends PersistentModel> = {
|
|
|
572
574
|
[K in keyof T]-?: SortPredicateExpression<T, NonNullable<T[K]>>;
|
|
573
575
|
};
|
|
574
576
|
|
|
575
|
-
export type SortPredicateExpression<
|
|
576
|
-
M extends PersistentModel,
|
|
577
|
+
export type SortPredicateExpression<M extends PersistentModel, FT> = TypeName<
|
|
577
578
|
FT
|
|
578
|
-
>
|
|
579
|
+
> extends keyof MapTypeToOperands<FT>
|
|
579
580
|
? (sortDirection: keyof typeof SortDirection) => SortPredicate<M>
|
|
580
581
|
: never;
|
|
581
582
|
|
|
@@ -584,8 +585,9 @@ export enum SortDirection {
|
|
|
584
585
|
DESCENDING = 'DESCENDING',
|
|
585
586
|
}
|
|
586
587
|
|
|
587
|
-
export type SortPredicatesGroup<
|
|
588
|
-
|
|
588
|
+
export type SortPredicatesGroup<
|
|
589
|
+
T extends PersistentModel
|
|
590
|
+
> = SortPredicateObject<T>[];
|
|
589
591
|
|
|
590
592
|
export type SortPredicateObject<T extends PersistentModel> = {
|
|
591
593
|
field: keyof T;
|
|
@@ -776,7 +778,6 @@ export type SyncError = {
|
|
|
776
778
|
localModel: PersistentModel;
|
|
777
779
|
remoteModel: PersistentModel;
|
|
778
780
|
operation: string;
|
|
779
|
-
modelName?: string;
|
|
780
781
|
};
|
|
781
782
|
|
|
782
783
|
export const DISCARD = Symbol('DISCARD');
|