From 7221142da38d440edbf7c696ddd7dd1e11444cc8 Mon Sep 17 00:00:00 2001 From: Joe Torreggiani Date: Wed, 29 Jan 2020 12:25:53 -0500 Subject: [PATCH 1/3] Export object promise proxy from main --- dist/mobx-async-store.cjs.js | 31 ++++++++++--------------------- dist/mobx-async-store.esm.js | 32 ++++++++++---------------------- src/main.js | 5 ++++- 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/dist/mobx-async-store.cjs.js b/dist/mobx-async-store.cjs.js index d6c1efad..96eca86e 100644 --- a/dist/mobx-async-store.cjs.js +++ b/dist/mobx-async-store.cjs.js @@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); +var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread')); var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator')); var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator')); var _initializerDefineProperty = _interopDefault(require('@babel/runtime/helpers/initializerDefineProperty')); @@ -21,6 +21,7 @@ var jqueryParam = _interopDefault(require('jquery-param')); var pluralize = _interopDefault(require('pluralize')); var dig = _interopDefault(require('lodash/get')); var flattenDeep = _interopDefault(require('lodash/flattenDeep')); +var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn')); var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf')); var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized')); @@ -169,10 +170,6 @@ function walk(value, iteratee, prop, path) { return iteratee(value, path); } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - function ObjectPromiseProxy(promise, target) { target.isInFlight = true; var tmpId = target.id; @@ -360,10 +357,6 @@ var schema = new Schema(); var _class, _descriptor, _descriptor2, _temp; -function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - function stringifyIds(object) { Object.keys(object).forEach(function (key) { var property = object[key]; @@ -695,7 +688,7 @@ function () { key: "_makeObservable", value: function _makeObservable(initialAttributes) { var defaultAttributes = this.defaultAttributes; - mobx.extendObservable(this, _objectSpread$1({}, defaultAttributes, {}, initialAttributes)); + mobx.extendObservable(this, _objectSpread({}, defaultAttributes, initialAttributes)); } /** * The current state of defined attributes and relationships of the instance @@ -1058,10 +1051,6 @@ function () { })), _class); var _class$1, _descriptor$1, _descriptor2$1, _descriptor3, _temp$1; - -function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * Defines the Artemis Data Store class. * @@ -1311,14 +1300,14 @@ function () { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var defaultFetchOptions = this.defaultFetchOptions; - var fetchOptions = _objectSpread$2({}, defaultFetchOptions, {}, options); + var fetchOptions = _objectSpread({}, defaultFetchOptions, options); var key = JSON.stringify({ url: url, fetchOptions: fetchOptions }); return combineRacedRequests(key, function () { - return fetch(url, _objectSpread$2({}, defaultFetchOptions, {}, options)); + return fetch(url, _objectSpread({}, defaultFetchOptions, options)); }); }) /** @@ -1550,7 +1539,7 @@ function () { // Don't try to create relationship if meta included false if (!relationships[key].meta) { // defensive against existingRecord.relationships being undefined - mobx.set(record, 'relationships', _objectSpread$2({}, record.relationships, _defineProperty({}, key, relationships[key]))); + mobx.set(record, 'relationships', _objectSpread({}, record.relationships, _defineProperty({}, key, relationships[key]))); mobx.set(_this4.data[type].records, id, record); } }); @@ -1616,7 +1605,7 @@ function () { throw new Error("Could not find a model for '".concat(type, "'")); } - return new ModelKlass(_objectSpread$2({ + return new ModelKlass(_objectSpread({ id: id, store: store, relationships: relationships @@ -1694,7 +1683,7 @@ function () { _dataObject$relations2 = dataObject.relationships, relationships = _dataObject$relations2 === void 0 ? {} : _dataObject$relations2; var ModelKlass = _this6.modelTypeIndex[type]; - var record = new ModelKlass(_objectSpread$2({ + var record = new ModelKlass(_objectSpread({ store: store, relationships: relationships }, attributes)); @@ -1964,7 +1953,6 @@ function validates(target, property) { } } -var _Symbol$species; /* * Defines a one-to-many relationship. Defaults to the class with camelized singular name of the property * An optional argument specifies the data model, if different from the property name @@ -2173,7 +2161,7 @@ function setRelatedRecord(record, relatedRecord, property) { * @param {String} property the property on the record that references the array */ -_Symbol$species = Symbol.species; +var _Symbol$species = Symbol.species; var RelatedRecordsArray = /*#__PURE__*/ function (_Array) { @@ -2326,6 +2314,7 @@ function (_Array) { }(_wrapNativeSuper(Array)); exports.Model = Model; +exports.ObjectPromiseProxy = ObjectPromiseProxy; exports.Store = Store; exports.attribute = attribute; exports.relatedToMany = relatedToMany; diff --git a/dist/mobx-async-store.esm.js b/dist/mobx-async-store.esm.js index 2aa7db77..a5049d85 100644 --- a/dist/mobx-async-store.esm.js +++ b/dist/mobx-async-store.esm.js @@ -1,4 +1,4 @@ -import _defineProperty from '@babel/runtime/helpers/defineProperty'; +import _objectSpread from '@babel/runtime/helpers/objectSpread'; import _regeneratorRuntime from '@babel/runtime/regenerator'; import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; import _initializerDefineProperty from '@babel/runtime/helpers/initializerDefineProperty'; @@ -15,6 +15,7 @@ import jqueryParam from 'jquery-param'; import pluralize from 'pluralize'; import dig from 'lodash/get'; import flattenDeep from 'lodash/flattenDeep'; +import _defineProperty from '@babel/runtime/helpers/defineProperty'; import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn'; import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf'; import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized'; @@ -163,10 +164,6 @@ function walk(value, iteratee, prop, path) { return iteratee(value, path); } -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - function ObjectPromiseProxy(promise, target) { target.isInFlight = true; var tmpId = target.id; @@ -354,10 +351,6 @@ var schema = new Schema(); var _class, _descriptor, _descriptor2, _temp; -function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - function stringifyIds(object) { Object.keys(object).forEach(function (key) { var property = object[key]; @@ -689,7 +682,7 @@ function () { key: "_makeObservable", value: function _makeObservable(initialAttributes) { var defaultAttributes = this.defaultAttributes; - extendObservable(this, _objectSpread$1({}, defaultAttributes, {}, initialAttributes)); + extendObservable(this, _objectSpread({}, defaultAttributes, initialAttributes)); } /** * The current state of defined attributes and relationships of the instance @@ -1052,10 +1045,6 @@ function () { })), _class); var _class$1, _descriptor$1, _descriptor2$1, _descriptor3, _temp$1; - -function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * Defines the Artemis Data Store class. * @@ -1305,14 +1294,14 @@ function () { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var defaultFetchOptions = this.defaultFetchOptions; - var fetchOptions = _objectSpread$2({}, defaultFetchOptions, {}, options); + var fetchOptions = _objectSpread({}, defaultFetchOptions, options); var key = JSON.stringify({ url: url, fetchOptions: fetchOptions }); return combineRacedRequests(key, function () { - return fetch(url, _objectSpread$2({}, defaultFetchOptions, {}, options)); + return fetch(url, _objectSpread({}, defaultFetchOptions, options)); }); }) /** @@ -1544,7 +1533,7 @@ function () { // Don't try to create relationship if meta included false if (!relationships[key].meta) { // defensive against existingRecord.relationships being undefined - set(record, 'relationships', _objectSpread$2({}, record.relationships, _defineProperty({}, key, relationships[key]))); + set(record, 'relationships', _objectSpread({}, record.relationships, _defineProperty({}, key, relationships[key]))); set(_this4.data[type].records, id, record); } }); @@ -1610,7 +1599,7 @@ function () { throw new Error("Could not find a model for '".concat(type, "'")); } - return new ModelKlass(_objectSpread$2({ + return new ModelKlass(_objectSpread({ id: id, store: store, relationships: relationships @@ -1688,7 +1677,7 @@ function () { _dataObject$relations2 = dataObject.relationships, relationships = _dataObject$relations2 === void 0 ? {} : _dataObject$relations2; var ModelKlass = _this6.modelTypeIndex[type]; - var record = new ModelKlass(_objectSpread$2({ + var record = new ModelKlass(_objectSpread({ store: store, relationships: relationships }, attributes)); @@ -1958,7 +1947,6 @@ function validates(target, property) { } } -var _Symbol$species; /* * Defines a one-to-many relationship. Defaults to the class with camelized singular name of the property * An optional argument specifies the data model, if different from the property name @@ -2167,7 +2155,7 @@ function setRelatedRecord(record, relatedRecord, property) { * @param {String} property the property on the record that references the array */ -_Symbol$species = Symbol.species; +var _Symbol$species = Symbol.species; var RelatedRecordsArray = /*#__PURE__*/ function (_Array) { @@ -2319,4 +2307,4 @@ function (_Array) { return RelatedRecordsArray; }(_wrapNativeSuper(Array)); -export { Model, Store, attribute, relatedToMany, relatedToOne, validates }; +export { Model, ObjectPromiseProxy, Store, attribute, relatedToMany, relatedToOne, validates }; diff --git a/src/main.js b/src/main.js index 8b0301f8..3c6624eb 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,8 @@ import Model from './Model' import Store from './Store' import { attribute, validates } from './decorators/attributes' import { relatedToMany, relatedToOne } from './decorators/relationships' +import ObjectPromiseProxy from './ObjectPromiseProxy' + export { Model, @@ -9,5 +11,6 @@ export { attribute, relatedToMany, relatedToOne, - validates + validates, + ObjectPromiseProxy } From b15c2c91aa14311263b5d1586ebd71eb30a6f3b5 Mon Sep 17 00:00:00 2001 From: Joe Torreggiani Date: Wed, 29 Jan 2020 12:27:16 -0500 Subject: [PATCH 2/3] Make linter happy --- src/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.js b/src/main.js index 3c6624eb..8c5364e8 100644 --- a/src/main.js +++ b/src/main.js @@ -4,7 +4,6 @@ import { attribute, validates } from './decorators/attributes' import { relatedToMany, relatedToOne } from './decorators/relationships' import ObjectPromiseProxy from './ObjectPromiseProxy' - export { Model, Store, From 9854607f98dca1d9f1f05c875ac2541a8b85c1dc Mon Sep 17 00:00:00 2001 From: Joe Torreggiani Date: Wed, 29 Jan 2020 12:41:49 -0500 Subject: [PATCH 3/3] Bump version --- dist/mobx-async-store.cjs.js | 30 +++++++++++++++++++++--------- dist/mobx-async-store.esm.js | 30 +++++++++++++++++++++--------- package.json | 2 +- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/dist/mobx-async-store.cjs.js b/dist/mobx-async-store.cjs.js index 96eca86e..c332f221 100644 --- a/dist/mobx-async-store.cjs.js +++ b/dist/mobx-async-store.cjs.js @@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread')); +var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); var _regeneratorRuntime = _interopDefault(require('@babel/runtime/regenerator')); var _asyncToGenerator = _interopDefault(require('@babel/runtime/helpers/asyncToGenerator')); var _initializerDefineProperty = _interopDefault(require('@babel/runtime/helpers/initializerDefineProperty')); @@ -21,7 +21,6 @@ var jqueryParam = _interopDefault(require('jquery-param')); var pluralize = _interopDefault(require('pluralize')); var dig = _interopDefault(require('lodash/get')); var flattenDeep = _interopDefault(require('lodash/flattenDeep')); -var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); var _possibleConstructorReturn = _interopDefault(require('@babel/runtime/helpers/possibleConstructorReturn')); var _getPrototypeOf = _interopDefault(require('@babel/runtime/helpers/getPrototypeOf')); var _assertThisInitialized = _interopDefault(require('@babel/runtime/helpers/assertThisInitialized')); @@ -170,6 +169,10 @@ function walk(value, iteratee, prop, path) { return iteratee(value, path); } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + function ObjectPromiseProxy(promise, target) { target.isInFlight = true; var tmpId = target.id; @@ -357,6 +360,10 @@ var schema = new Schema(); var _class, _descriptor, _descriptor2, _temp; +function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + function stringifyIds(object) { Object.keys(object).forEach(function (key) { var property = object[key]; @@ -688,7 +695,7 @@ function () { key: "_makeObservable", value: function _makeObservable(initialAttributes) { var defaultAttributes = this.defaultAttributes; - mobx.extendObservable(this, _objectSpread({}, defaultAttributes, initialAttributes)); + mobx.extendObservable(this, _objectSpread$1({}, defaultAttributes, {}, initialAttributes)); } /** * The current state of defined attributes and relationships of the instance @@ -1051,6 +1058,10 @@ function () { })), _class); var _class$1, _descriptor$1, _descriptor2$1, _descriptor3, _temp$1; + +function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * Defines the Artemis Data Store class. * @@ -1300,14 +1311,14 @@ function () { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var defaultFetchOptions = this.defaultFetchOptions; - var fetchOptions = _objectSpread({}, defaultFetchOptions, options); + var fetchOptions = _objectSpread$2({}, defaultFetchOptions, {}, options); var key = JSON.stringify({ url: url, fetchOptions: fetchOptions }); return combineRacedRequests(key, function () { - return fetch(url, _objectSpread({}, defaultFetchOptions, options)); + return fetch(url, _objectSpread$2({}, defaultFetchOptions, {}, options)); }); }) /** @@ -1539,7 +1550,7 @@ function () { // Don't try to create relationship if meta included false if (!relationships[key].meta) { // defensive against existingRecord.relationships being undefined - mobx.set(record, 'relationships', _objectSpread({}, record.relationships, _defineProperty({}, key, relationships[key]))); + mobx.set(record, 'relationships', _objectSpread$2({}, record.relationships, _defineProperty({}, key, relationships[key]))); mobx.set(_this4.data[type].records, id, record); } }); @@ -1605,7 +1616,7 @@ function () { throw new Error("Could not find a model for '".concat(type, "'")); } - return new ModelKlass(_objectSpread({ + return new ModelKlass(_objectSpread$2({ id: id, store: store, relationships: relationships @@ -1683,7 +1694,7 @@ function () { _dataObject$relations2 = dataObject.relationships, relationships = _dataObject$relations2 === void 0 ? {} : _dataObject$relations2; var ModelKlass = _this6.modelTypeIndex[type]; - var record = new ModelKlass(_objectSpread({ + var record = new ModelKlass(_objectSpread$2({ store: store, relationships: relationships }, attributes)); @@ -1953,6 +1964,7 @@ function validates(target, property) { } } +var _Symbol$species; /* * Defines a one-to-many relationship. Defaults to the class with camelized singular name of the property * An optional argument specifies the data model, if different from the property name @@ -2161,7 +2173,7 @@ function setRelatedRecord(record, relatedRecord, property) { * @param {String} property the property on the record that references the array */ -var _Symbol$species = Symbol.species; +_Symbol$species = Symbol.species; var RelatedRecordsArray = /*#__PURE__*/ function (_Array) { diff --git a/dist/mobx-async-store.esm.js b/dist/mobx-async-store.esm.js index a5049d85..e35baec8 100644 --- a/dist/mobx-async-store.esm.js +++ b/dist/mobx-async-store.esm.js @@ -1,4 +1,4 @@ -import _objectSpread from '@babel/runtime/helpers/objectSpread'; +import _defineProperty from '@babel/runtime/helpers/defineProperty'; import _regeneratorRuntime from '@babel/runtime/regenerator'; import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator'; import _initializerDefineProperty from '@babel/runtime/helpers/initializerDefineProperty'; @@ -15,7 +15,6 @@ import jqueryParam from 'jquery-param'; import pluralize from 'pluralize'; import dig from 'lodash/get'; import flattenDeep from 'lodash/flattenDeep'; -import _defineProperty from '@babel/runtime/helpers/defineProperty'; import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn'; import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf'; import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized'; @@ -164,6 +163,10 @@ function walk(value, iteratee, prop, path) { return iteratee(value, path); } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + function ObjectPromiseProxy(promise, target) { target.isInFlight = true; var tmpId = target.id; @@ -351,6 +354,10 @@ var schema = new Schema(); var _class, _descriptor, _descriptor2, _temp; +function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + function stringifyIds(object) { Object.keys(object).forEach(function (key) { var property = object[key]; @@ -682,7 +689,7 @@ function () { key: "_makeObservable", value: function _makeObservable(initialAttributes) { var defaultAttributes = this.defaultAttributes; - extendObservable(this, _objectSpread({}, defaultAttributes, initialAttributes)); + extendObservable(this, _objectSpread$1({}, defaultAttributes, {}, initialAttributes)); } /** * The current state of defined attributes and relationships of the instance @@ -1045,6 +1052,10 @@ function () { })), _class); var _class$1, _descriptor$1, _descriptor2$1, _descriptor3, _temp$1; + +function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * Defines the Artemis Data Store class. * @@ -1294,14 +1305,14 @@ function () { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var defaultFetchOptions = this.defaultFetchOptions; - var fetchOptions = _objectSpread({}, defaultFetchOptions, options); + var fetchOptions = _objectSpread$2({}, defaultFetchOptions, {}, options); var key = JSON.stringify({ url: url, fetchOptions: fetchOptions }); return combineRacedRequests(key, function () { - return fetch(url, _objectSpread({}, defaultFetchOptions, options)); + return fetch(url, _objectSpread$2({}, defaultFetchOptions, {}, options)); }); }) /** @@ -1533,7 +1544,7 @@ function () { // Don't try to create relationship if meta included false if (!relationships[key].meta) { // defensive against existingRecord.relationships being undefined - set(record, 'relationships', _objectSpread({}, record.relationships, _defineProperty({}, key, relationships[key]))); + set(record, 'relationships', _objectSpread$2({}, record.relationships, _defineProperty({}, key, relationships[key]))); set(_this4.data[type].records, id, record); } }); @@ -1599,7 +1610,7 @@ function () { throw new Error("Could not find a model for '".concat(type, "'")); } - return new ModelKlass(_objectSpread({ + return new ModelKlass(_objectSpread$2({ id: id, store: store, relationships: relationships @@ -1677,7 +1688,7 @@ function () { _dataObject$relations2 = dataObject.relationships, relationships = _dataObject$relations2 === void 0 ? {} : _dataObject$relations2; var ModelKlass = _this6.modelTypeIndex[type]; - var record = new ModelKlass(_objectSpread({ + var record = new ModelKlass(_objectSpread$2({ store: store, relationships: relationships }, attributes)); @@ -1947,6 +1958,7 @@ function validates(target, property) { } } +var _Symbol$species; /* * Defines a one-to-many relationship. Defaults to the class with camelized singular name of the property * An optional argument specifies the data model, if different from the property name @@ -2155,7 +2167,7 @@ function setRelatedRecord(record, relatedRecord, property) { * @param {String} property the property on the record that references the array */ -var _Symbol$species = Symbol.species; +_Symbol$species = Symbol.species; var RelatedRecordsArray = /*#__PURE__*/ function (_Array) { diff --git a/package.json b/package.json index 6a4a22ae..f02cf4a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mobx-async-store", - "version": "1.0.5", + "version": "1.0.6", "module": "dist/mobx-async-store.esm.js", "browser": "dist/mobx-async-store.cjs.js", "main": "dist/mobx-async-store.cjs.js",