atom.io 0.10.1 → 0.10.2

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.
@@ -381,8 +381,11 @@ var abortTransaction = (store) => {
381
381
  );
382
382
  return;
383
383
  }
384
+ store.logger.info(
385
+ `\u{1FA82}`,
386
+ `Aborting transaction "${store.transactionStatus.key}"`
387
+ );
384
388
  store.transactionStatus = { phase: `idle` };
385
- store.logger.info(`\u{1FA82}`, `transaction fail`);
386
389
  };
387
390
  var applyTransaction = (output, store) => {
388
391
  if (store.transactionStatus.phase !== `building`) {
@@ -397,7 +400,10 @@ var applyTransaction = (output, store) => {
397
400
  store.logger.info(
398
401
  `\u{1F6C3} applying transaction "${store.transactionStatus.key}" with ${atomUpdates.length} updates.`
399
402
  );
400
- store.logger.info(`\u{1F6C3} the updates are:`, atomUpdates);
403
+ store.logger.info(
404
+ `\u{1F6C3} the updates from "${store.transactionStatus.key}" are:`,
405
+ atomUpdates
406
+ );
401
407
  for (const { key, newValue } of atomUpdates) {
402
408
  const token = { key, type: `atom` };
403
409
  if (!store.valueMap.has(token.key)) {
@@ -415,7 +421,7 @@ var applyTransaction = (output, store) => {
415
421
  }
416
422
  store.atoms.set(newAtom.key, newAtom);
417
423
  store.valueMap.set(newAtom.key, newAtom.default);
418
- store.logger.info(`\u{1F527} add atom "${newAtom.key}"`);
424
+ store.logger.info(`\u{1F527} Add atom "${newAtom.key}"`);
419
425
  }
420
426
  }
421
427
  setState(token, newValue, store);
@@ -436,7 +442,7 @@ var applyTransaction = (output, store) => {
436
442
  params: store.transactionStatus.params
437
443
  });
438
444
  store.transactionStatus = { phase: `idle` };
439
- store.logger.info(`\u{1F6EC} transaction "${myTransaction.key}" applied`);
445
+ store.logger.info(`\u{1F6EC} Successfully applied transaction "${myTransaction.key}"`);
440
446
  };
441
447
 
442
448
  // src/transaction/build-transaction.ts
@@ -467,7 +473,7 @@ var buildTransaction = (key, params, store) => {
467
473
  output: void 0
468
474
  };
469
475
  store.logger.info(
470
- `\u{1F6EB} transaction "${key}" building in store "${store.config.name}"`
476
+ `\u{1F6EB} Building transaction "${key}" in store "${store.config.name}"`
471
477
  );
472
478
  };
473
479
 
@@ -508,7 +514,7 @@ function transaction__INTERNAL(options, store = IMPLICIT.STORE) {
508
514
  }
509
515
  var target = (store = IMPLICIT.STORE) => store.transactionStatus.phase === `building` ? store.transactionStatus.core : store;
510
516
  var redoTransactionUpdate = (update, store) => {
511
- store.logger.info(` \u23ED redo transaction "${update.key}" (redo)`);
517
+ store.logger.info(` \u23ED Redo transaction "${update.key}"`);
512
518
  for (const { key, newValue } of update.atomUpdates) {
513
519
  const token = { key, type: `atom` };
514
520
  const state = withdraw(token, store);
@@ -521,7 +527,7 @@ var redoTransactionUpdate = (update, store) => {
521
527
  }
522
528
  };
523
529
  var undoTransactionUpdate = (update, store) => {
524
- store.logger.info(` \u23EE undo transaction "${update.key}" (undo)`);
530
+ store.logger.info(` \u23EE Undo transaction "${update.key}"`);
525
531
  for (const { key, oldValue } of update.atomUpdates) {
526
532
  const token = { key, type: `atom` };
527
533
  const state = withdraw(token, store);
@@ -1172,20 +1178,24 @@ var openOperation = (token, store) => {
1172
1178
  token
1173
1179
  };
1174
1180
  store.logger.info(
1175
- `\u2B55 operation start from "${token.key}" in store "${store.config.name}"${store.transactionStatus.phase === `idle` ? `` : ` ${store.transactionStatus.phase} "${store.transactionStatus.key}"`}`
1181
+ `\u2B55 Operation start from ${token.type} "${token.key}" in store "${store.config.name}"${store.transactionStatus.phase === `idle` ? `` : ` ${store.transactionStatus.phase} "${store.transactionStatus.key}"`}`
1176
1182
  );
1177
1183
  };
1178
1184
  var closeOperation = (store) => {
1179
1185
  const core = target(store);
1186
+ if (core.operation.open) {
1187
+ store.logger.info(
1188
+ `\u{1F534} Operation done for ${core.operation.token.type} "${core.operation.token.key}" in store ${store.config.name}`
1189
+ );
1190
+ }
1180
1191
  core.operation = { open: false };
1181
- store.logger.info(`\u{1F534} operation done`);
1182
1192
  store.subject.operationStatus.next(core.operation);
1183
1193
  };
1184
1194
  var isDone = (key, store = IMPLICIT.STORE) => {
1185
1195
  const core = target(store);
1186
1196
  if (!core.operation.open) {
1187
1197
  store.logger.warn(
1188
- `isDone called outside of an operation. This is probably a bug.`
1198
+ `\u{1F41E} isDone called outside of an operation. This is probably a bug.`
1189
1199
  );
1190
1200
  return true;
1191
1201
  }
@@ -1267,28 +1277,33 @@ var emitUpdate = (state, update, store) => {
1267
1277
  update.newValue,
1268
1278
  `)`
1269
1279
  );
1270
- logger.info(`\u{1F4E2} notifying subscribers:`, state.subject.subscribers);
1280
+ logger.info(
1281
+ `\u{1F4E2} notifying subscribers to "${state.key}"`,
1282
+ state.subject.subscribers
1283
+ );
1271
1284
  state.subject.next(update);
1272
1285
  };
1273
1286
 
1274
1287
  // src/set-state/evict-downstream.ts
1275
1288
  var evictDownStream = (state, store = IMPLICIT.STORE) => {
1276
- var _a;
1289
+ var _a, _b;
1277
1290
  const core = target(store);
1278
1291
  const downstreamKeys = core.selectorAtoms.getRelatedKeys(state.key);
1279
1292
  store.logger.info(
1280
- `\u{1F9F9} evicting ${downstreamKeys == null ? void 0 : downstreamKeys.size} states downstream from ${state.type} "${state.key}":`,
1293
+ `\u{1F9F9} evicting ${(_a = downstreamKeys == null ? void 0 : downstreamKeys.size) != null ? _a : 0} states downstream from ${state.type} "${state.key}":`,
1281
1294
  downstreamKeys
1282
1295
  );
1283
- if (core.operation.open) {
1284
- store.logger.info(`\u{1F9F9}`, [...core.operation.done], `already done`);
1285
- }
1286
- if (downstreamKeys) {
1296
+ if (downstreamKeys !== void 0) {
1297
+ if (core.operation.open) {
1298
+ store.logger.info(
1299
+ `\u{1F9F9} [ ${[...core.operation.done].join(`, `)} ] already done`
1300
+ );
1301
+ }
1287
1302
  for (const key of downstreamKeys) {
1288
1303
  if (isDone(key, store)) {
1289
1304
  continue;
1290
1305
  }
1291
- const state2 = (_a = core.selectors.get(key)) != null ? _a : core.readonlySelectors.get(key);
1306
+ const state2 = (_b = core.selectors.get(key)) != null ? _b : core.readonlySelectors.get(key);
1292
1307
  if (!state2) {
1293
1308
  store.logger.error(
1294
1309
  `\u{1F41E} "${key}" was not found in selectors or readonlySelectors`
@@ -1781,7 +1796,7 @@ var recallState = (state, store = IMPLICIT.STORE) => {
1781
1796
  const core = target(store);
1782
1797
  if (!core.operation.open) {
1783
1798
  store.logger.warn(
1784
- `\u{1F41E}recall called outside of an operation. This is probably a bug.`
1799
+ `\u{1F41E} recall called outside of an operation. This is probably a bug.`
1785
1800
  );
1786
1801
  return core.valueMap.get(state.key);
1787
1802
  }