@airtable/blocks 1.10.1 → 1.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.
package/CHANGELOG.md CHANGED
@@ -9,10 +9,14 @@ Not every commit needs to result in a change to this file (e.g. docs and chore c
9
9
  commit that affects the code in a way that consumers might care about should include edits to the
10
10
  'Unreleased' section though. Breaking changes should be prefixed with `**BREAKING:**`.
11
11
 
12
- ## [Unreleased](https://github.com/airtable/blocks/compare/@airtable/blocks@1.10.1...HEAD)
12
+ ## [Unreleased](https://github.com/airtable/blocks/compare/@airtable/blocks@1.10.2...HEAD)
13
13
 
14
14
  No changes.
15
15
 
16
+ ## [1.10.2](https://github.com/airtable/blocks/compare/@airtable/blocks@1.10.1...@airtable/blocks@1.10.2) - 2022-01-25
17
+
18
+ - Rare invariant failure addressed
19
+
16
20
  ## [1.10.1](https://github.com/airtable/blocks/compare/@airtable/blocks@1.10.0...@airtable/blocks@1.10.1) - 2021-12-22
17
21
 
18
22
  - Update examples for table, view and field URLs.
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.array.iterator");
4
+
3
5
  require("core-js/modules/es.string.replace");
4
6
 
7
+ require("core-js/modules/web.dom-collections.iterator");
8
+
5
9
  Object.defineProperty(exports, "__esModule", {
6
10
  value: true
7
11
  });
8
12
  exports.spawnError = spawnError;
13
+ exports.logErrorToRollbar = logErrorToRollbar;
9
14
  exports.invariant = invariant;
10
15
  exports.spawnUnknownSwitchCaseError = spawnUnknownSwitchCaseError;
11
16
  exports.spawnAbstractMethodError = spawnAbstractMethodError;
@@ -52,6 +57,26 @@ function spawnError(errorMessageFormat) {
52
57
  }
53
58
 
54
59
  return spawnErrorWithOriginOmittedFromStackTrace(errorMessageFormat, errorMessageArgs, spawnError);
60
+ } // istanbul ignore next
61
+
62
+ /**
63
+ * Logs an error to Rollbar
64
+ *
65
+ * @hidden
66
+ */
67
+
68
+
69
+ function logErrorToRollbar(errorMessageFormat) {
70
+ // See this comment for how to log via Rollbar: https://github.com/Hyperbase/hyperbase/blob/009dcd1dc4c5204277c2939e7f61dfce74535f30/client/run_block_frame.tsx#L548
71
+ var rollbar = window.Rollbar;
72
+
73
+ if (rollbar === null || rollbar === void 0 ? void 0 : rollbar.warn) {
74
+ for (var _len2 = arguments.length, errorMessageArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
75
+ errorMessageArgs[_key2 - 1] = arguments[_key2];
76
+ }
77
+
78
+ rollbar.warn(spawnError(errorMessageFormat, ...errorMessageArgs));
79
+ }
55
80
  }
56
81
  /**
57
82
  * An alternative to facebook's invariant that's safe to use with base data
@@ -62,8 +87,8 @@ function spawnError(errorMessageFormat) {
62
87
 
63
88
  function invariant(condition, errorMessageFormat) {
64
89
  if (!condition) {
65
- for (var _len2 = arguments.length, errorMessageArgs = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
66
- errorMessageArgs[_key2 - 2] = arguments[_key2];
90
+ for (var _len3 = arguments.length, errorMessageArgs = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
91
+ errorMessageArgs[_key3 - 2] = arguments[_key3];
67
92
  }
68
93
 
69
94
  throw spawnErrorWithOriginOmittedFromStackTrace(errorMessageFormat, errorMessageArgs, invariant);
@@ -515,7 +515,7 @@ function (_AbstractModelWithAsy) {
515
515
  }, {
516
516
  key: "_loadCellValuesInFieldIdsAsync",
517
517
  value: function _loadCellValuesInFieldIdsAsync(fieldIds) {
518
- var _ref, newRecordsById, existingRecordsById, _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, _step7$value, recordId, newRecordObj, existingRecordObj, existingCellValuesByFieldId, i, fieldId, changedKeys;
518
+ var _ref, newRecordsById, existingRecordsById, _iteratorNormalCompletion7, _didIteratorError7, _iteratorError7, _iterator7, _step7, _step7$value, recordId, newRecordObj, existingRecordObj, isCommentCountTypesSame, isCreatedTimeTypesSame, existingCellValuesByFieldId, i, fieldId, changedKeys;
519
519
 
520
520
  return _regenerator.default.async(function _loadCellValuesInFieldIdsAsync$(_context3) {
521
521
  while (1) {
@@ -545,12 +545,22 @@ function (_AbstractModelWithAsy) {
545
545
  if (!(0, _private_utils.has)(existingRecordsById, recordId)) {
546
546
  existingRecordsById[recordId] = newRecordObj;
547
547
  } else {
548
- existingRecordObj = existingRecordsById[recordId]; // Metadata (createdTime, commentCount) should already be up to date,
549
- // but just verify for sanity. If this doesn't catch anything, can
550
- // remove it for perf.
548
+ existingRecordObj = existingRecordsById[recordId]; // Metadata (createdTime, commentCount) should generally be up to date,
549
+ // but can be out of date in the rare scenario where realtime
550
+ // data has not yet been delivered to the SDK, but is populated in hyperbase
551
+ // at the time this new fetch is executed.
552
+ // istanbul ignore next
551
553
 
552
- (0, _error_utils.invariant)(existingRecordObj.commentCount === newRecordObj.commentCount, 'comment count out of sync');
553
- (0, _error_utils.invariant)(existingRecordObj.createdTime === newRecordObj.createdTime, 'created time out of sync');
554
+ if (existingRecordObj.commentCount !== newRecordObj.commentCount) {
555
+ isCommentCountTypesSame = typeof existingRecordObj.commentCount !== typeof newRecordObj.commentCount;
556
+ (0, _error_utils.logErrorToRollbar)('comment count out of sync - types are same: %s', isCommentCountTypesSame);
557
+ } // istanbul ignore next
558
+
559
+
560
+ if (existingRecordObj.createdTime !== newRecordObj.createdTime) {
561
+ isCreatedTimeTypesSame = typeof existingRecordObj.createdTime !== typeof newRecordObj.createdTime;
562
+ (0, _error_utils.logErrorToRollbar)('created time out of sync - types are same: %s', isCreatedTimeTypesSame);
563
+ }
554
564
 
555
565
  if (!existingRecordObj.cellValuesByFieldId) {
556
566
  existingRecordObj.cellValuesByFieldId = {};
package/dist/cjs/sdk.js CHANGED
@@ -330,4 +330,4 @@ function () {
330
330
  }();
331
331
 
332
332
  exports.default = BlockSdk;
333
- (0, _defineProperty2.default)(BlockSdk, "VERSION", "1.10.1");
333
+ (0, _defineProperty2.default)(BlockSdk, "VERSION", "1.10.2");
@@ -2,6 +2,12 @@
2
2
  * @hidden
3
3
  */
4
4
  export declare function spawnError(errorMessageFormat: string, ...errorMessageArgs: ReadonlyArray<unknown>): Error;
5
+ /**
6
+ * Logs an error to Rollbar
7
+ *
8
+ * @hidden
9
+ */
10
+ export declare function logErrorToRollbar(errorMessageFormat: string, ...errorMessageArgs: ReadonlyArray<unknown>): void;
5
11
  /**
6
12
  * An alternative to facebook's invariant that's safe to use with base data
7
13
  *
@@ -1 +1 @@
1
- {"version":3,"file":"error_utils.d.ts","sourceRoot":"","sources":["../../../src/error_utils.ts"],"names":[],"mappings":"AAsCA;;GAEG;AACH,wBAAgB,UAAU,CACtB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,gBAAgB,EAAE,aAAa,CAAC,OAAO,CAAC,SAO9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,SAAS,EAAE,OAAO,EAClB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,SAAS,CAQnB"}
1
+ {"version":3,"file":"error_utils.d.ts","sourceRoot":"","sources":["../../../src/error_utils.ts"],"names":[],"mappings":"AAsCA;;GAEG;AACH,wBAAgB,UAAU,CACtB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,gBAAgB,EAAE,aAAa,CAAC,OAAO,CAAC,SAO9C;AAGD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC7B,kBAAkB,EAAE,MAAM,EAC1B,GAAG,gBAAgB,EAAE,aAAa,CAAC,OAAO,CAAC,QAO9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACrB,SAAS,EAAE,OAAO,EAClB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,GACpC,OAAO,CAAC,SAAS,CAQnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airtable/blocks",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "Airtable Blocks SDK",
5
5
  "repository": {
6
6
  "type": "git",