@barchart/portfolio-api-common 1.2.71 → 1.2.75

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.
@@ -230,7 +230,7 @@ module.exports = (() => {
230
230
  const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.');
231
231
  const transactionCreateFailedTypeReserved = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_RESERVED', 'Unable to create {U|type.description} transaction, this type of transaction is managed by the system.');
232
232
  const transactionCreateFailedReinvestPriceUnavailable = new FailureType('TRANSACTION_CREATE_FAILED_REINVEST_PRICE_UNAVAILABLE', 'Unable to create transaction, a dividend was paid on {L|day}; however no historical price is available for this day. To successfully create this transaction, please turn off dividend reinvestment for this position.');
233
- const transactionCreateFailedPositionLocked = new FailureType('TRANSACTION_CREATE_FAILED_POSITION_LOCKED', 'Unable to create transaction, are being recalculated for this position (or the linked cash position). Please re-enter the transaction in a minute or two.');
233
+ const transactionCreateFailedPositionLocked = new FailureType('TRANSACTION_CREATE_FAILED_POSITION_LOCKED', 'Unable to create transaction, your {L|description} history is being recalculated. Please re-enter this transaction in a minute or two.');
234
234
 
235
235
  const transactionDeleteFailedOutOfSequence = new FailureType('TRANSACTION_DELETE_FAILED_OUT_OF_SEQUENCE', 'Deleting any transaction, except for the most recent, will cause transaction history to be re-written. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
236
236
  const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
@@ -104,7 +104,7 @@ module.exports = (() => {
104
104
  assert.argumentIsArray(transactions, 'transactions');
105
105
  assert.argumentIsOptional(strict, 'strict', Boolean);
106
106
 
107
- return transactions.findIndex((t, i, a) => TransactionValidator.getSortSequence(t) !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
107
+ return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
108
108
  }
109
109
 
110
110
  /**
@@ -33,10 +33,9 @@ module.exports = (() => {
33
33
  * @param {Boolean=} descending
34
34
  * @returns {Array}
35
35
  */
36
- static format(transactions, positions, mutate, descending) {
36
+ static format(transactions, positions, descending) {
37
37
  assert.argumentIsArray(transactions, 'transactions');
38
38
  assert.argumentIsArray(positions, 'positions');
39
- assert.argumentIsOptional(mutate, 'mutate', Boolean);
40
39
  assert.argumentIsOptional(descending, 'descending', Boolean);
41
40
 
42
41
  const instruments = positions.reduce((map, p) => {
@@ -370,6 +370,19 @@ module.exports = (() => {
370
370
  return array.unique(symbols);
371
371
  }
372
372
 
373
+ setPositionLock(position) {
374
+ assert.argumentIsRequired(position, 'position', Object);
375
+ assert.argumentIsRequired(position.position, 'position.position', String);
376
+
377
+ const item = this._items.find((i) => i.position.position === position.position);
378
+
379
+ if (item) {
380
+ const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
381
+
382
+ item.setPositionLock(locked);
383
+ }
384
+ }
385
+
373
386
  /**
374
387
  * Performs a batch update of both position quotes and forex quotes,
375
388
  * triggering updates to position(s) and data aggregation(s).
@@ -72,6 +72,7 @@ module.exports = (() => {
72
72
  this._dataFormat.description = this._description;
73
73
  this._dataFormat.hide = false;
74
74
  this._dataFormat.invalid = false;
75
+ this._dataFormat.locked = false;
75
76
  this._dataFormat.newsExists = false;
76
77
  this._dataFormat.quantity = null;
77
78
  this._dataFormat.basisPrice = null;
@@ -541,12 +542,17 @@ module.exports = (() => {
541
542
  });
542
543
 
543
544
  let newsBinding = Disposable.getEmpty();
545
+ let lockedBinding = Disposable.getEmpty();
544
546
 
545
547
  if (this._single) {
546
548
  newsBinding = item.registerNewsExistsChangeHandler((exists) => {
547
549
  this._dataActual.newsExists = exists;
548
550
  this._dataFormat.newsExists = exists;
549
551
  });
552
+
553
+ lockedBinding = item.registerLockChangeHandler((locked) => {
554
+ this._dataFormat.locked = locked;
555
+ });
550
556
  }
551
557
 
552
558
  this._disposeStack.push(item.registerPortfolioChangeHandler((portfolio) => {
@@ -558,14 +564,16 @@ module.exports = (() => {
558
564
  this._dataFormat.description = this._description;
559
565
  }));
560
566
 
567
+ this._disposeStack.push(fundamentalBinding);
561
568
  this._disposeStack.push(quoteBinding);
569
+ this._disposeStack.push(lockedBinding);
562
570
  this._disposeStack.push(newsBinding);
563
- this._disposeStack.push(fundamentalBinding);
564
571
 
565
572
  this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
573
+ fundamentalBinding.dispose();
566
574
  quoteBinding.dispose();
567
575
  newsBinding.dispose();
568
- fundamentalBinding.dispose();
576
+ lockedBinding.dispose();
569
577
 
570
578
  array.remove(this._items, i => i === item);
571
579
  array.remove(this._excludedItems, i => i === item);
@@ -692,6 +700,7 @@ module.exports = (() => {
692
700
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
693
701
 
694
702
  format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
703
+ format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
695
704
  }
696
705
 
697
706
  const groupItems = group._items;
@@ -70,13 +70,15 @@ module.exports = (() => {
70
70
 
71
71
  this._data.newsExists = false;
72
72
  this._data.fundamental = { };
73
+ this._data.locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
73
74
 
74
75
  calculateStaticData(this);
75
76
  calculatePriceData(this, null);
76
77
 
77
78
  this._quoteChangedEvent = new Event(this);
78
79
  this._newsExistsChangedEvent = new Event(this);
79
- this._fundamentalDataChangeEvent = new Event(this);
80
+ this._fundamentalDataChangedEvent = new Event(this);
81
+ this._lockChangedEvent = new Event(this);
80
82
  this._portfolioChangedEvent = new Event(this);
81
83
  this._positionItemDisposeEvent = new Event(this);
82
84
  }
@@ -204,6 +206,25 @@ module.exports = (() => {
204
206
  }
205
207
  }
206
208
 
209
+ /**
210
+ * Sets a flag which indicates if news article(s) exist for the encapsulated position's
211
+ * symbol.
212
+ *
213
+ * @public
214
+ * @param {Boolean} value
215
+ */
216
+ setNewsArticleExists(value) {
217
+ assert.argumentIsRequired(value, 'value', Boolean);
218
+
219
+ if (this.getIsDisposed()) {
220
+ return;
221
+ }
222
+
223
+ if (this._data.newsExists !== value) {
224
+ this._newsExistsChangedEvent.fire(this._data.newsExists = value);
225
+ }
226
+ }
227
+
207
228
  /**
208
229
  * Sets fundamental data for the position.
209
230
  *
@@ -217,25 +238,24 @@ module.exports = (() => {
217
238
  return;
218
239
  }
219
240
 
220
- this._fundamentalDataChangeEvent.fire(this._data.fundamental = data);
241
+ this._fundamentalDataChangedEvent.fire(this._data.fundamental = data);
221
242
  }
222
243
 
223
244
  /**
224
- * Sets a flag which indicates if news article(s) exist for the encapsulated position's
225
- * symbol.
245
+ * Sets position lock status.
226
246
  *
227
247
  * @public
228
248
  * @param {Boolean} value
229
249
  */
230
- setNewsArticleExists(value) {
250
+ setPositionLock(value) {
231
251
  assert.argumentIsRequired(value, 'value', Boolean);
232
252
 
233
253
  if (this.getIsDisposed()) {
234
254
  return;
235
255
  }
236
256
 
237
- if (this._data.newsExists !== value) {
238
- this._newsExistsChangedEvent.fire(this._data.newsExists = value);
257
+ if (this._data.locked !== value) {
258
+ this._lockChangedEvent.fire(this._data.locked = value);
239
259
  }
240
260
  }
241
261
 
@@ -251,6 +271,17 @@ module.exports = (() => {
251
271
  return this._quoteChangedEvent.register(handler);
252
272
  }
253
273
 
274
+ /**
275
+ * Registers an observer changes to the status of news existence.
276
+ *
277
+ * @public
278
+ * @param {Function} handler
279
+ * @returns {Disposable}
280
+ */
281
+ registerNewsExistsChangeHandler(handler) {
282
+ return this._newsExistsChangedEvent.register(handler);
283
+ }
284
+
254
285
  /**
255
286
  * Registers an observer for fundamental data changes.
256
287
  *
@@ -259,18 +290,18 @@ module.exports = (() => {
259
290
  * @returns {Disposable}
260
291
  */
261
292
  registerFundamentalDataChangeHandler(handler) {
262
- return this._fundamentalDataChangeEvent.register(handler);
293
+ return this._fundamentalDataChangedEvent.register(handler);
263
294
  }
264
295
 
265
296
  /**
266
- * Registers an observer changes to the status of news existence.
297
+ * Registers an observer for position lock changes.
267
298
  *
268
299
  * @public
269
300
  * @param {Function} handler
270
301
  * @returns {Disposable}
271
302
  */
272
- registerNewsExistsChangeHandler(handler) {
273
- return this._newsExistsChangedEvent.register(handler);
303
+ registerLockChangeHandler(handler) {
304
+ return this._lockChangedEvent.register(handler);
274
305
  }
275
306
 
276
307
  /**
@@ -300,7 +331,8 @@ module.exports = (() => {
300
331
 
301
332
  this._quoteChangedEvent.clear();
302
333
  this._newsExistsChangedEvent.clear();
303
- this._fundamentalDataChangeEvent.clear();
334
+ this._fundamentalDataChangedEvent.clear();
335
+ this._lockChangedEvent.clear();
304
336
  this._portfolioChangedEvent.clear();
305
337
  this._positionItemDisposeEvent.clear();
306
338
  }
@@ -102,6 +102,7 @@ module.exports = (() => {
102
102
  .withField('legacy.portfolio', DataType.STRING, true)
103
103
  .withField('legacy.position', DataType.STRING, true)
104
104
  .withField('system.version', DataType.NUMBER, true)
105
+ .withField('system.locked', DataType.BOOLEAN, true)
105
106
  .withField('root', DataType.STRING, true)
106
107
  .schema
107
108
  );
@@ -131,6 +132,7 @@ module.exports = (() => {
131
132
  .withField('snapshot.basis', DataType.DECIMAL)
132
133
  .withField('snapshot.income', DataType.DECIMAL)
133
134
  .withField('snapshot.value', DataType.DECIMAL)
135
+ .withField('system.locked', DataType.BOOLEAN, true)
134
136
  .withField('previous', DataType.NUMBER, true)
135
137
  .schema
136
138
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.71",
3
+ "version": "1.2.75",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1187,7 +1187,7 @@ module.exports = (() => {
1187
1187
  assert.argumentIsArray(transactions, 'transactions');
1188
1188
  assert.argumentIsOptional(strict, 'strict', Boolean);
1189
1189
 
1190
- return transactions.findIndex((t, i, a) => TransactionValidator.getSortSequence(t) !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
1190
+ return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
1191
1191
  }
1192
1192
 
1193
1193
  /**
@@ -1749,6 +1749,19 @@ module.exports = (() => {
1749
1749
  return array.unique(symbols);
1750
1750
  }
1751
1751
 
1752
+ setPositionLock(position) {
1753
+ assert.argumentIsRequired(position, 'position', Object);
1754
+ assert.argumentIsRequired(position.position, 'position.position', String);
1755
+
1756
+ const item = this._items.find((i) => i.position.position === position.position);
1757
+
1758
+ if (item) {
1759
+ const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
1760
+
1761
+ item.setPositionLock(locked);
1762
+ }
1763
+ }
1764
+
1752
1765
  /**
1753
1766
  * Performs a batch update of both position quotes and forex quotes,
1754
1767
  * triggering updates to position(s) and data aggregation(s).
@@ -2393,6 +2406,7 @@ module.exports = (() => {
2393
2406
  this._dataFormat.description = this._description;
2394
2407
  this._dataFormat.hide = false;
2395
2408
  this._dataFormat.invalid = false;
2409
+ this._dataFormat.locked = false;
2396
2410
  this._dataFormat.newsExists = false;
2397
2411
  this._dataFormat.quantity = null;
2398
2412
  this._dataFormat.basisPrice = null;
@@ -2862,12 +2876,17 @@ module.exports = (() => {
2862
2876
  });
2863
2877
 
2864
2878
  let newsBinding = Disposable.getEmpty();
2879
+ let lockedBinding = Disposable.getEmpty();
2865
2880
 
2866
2881
  if (this._single) {
2867
2882
  newsBinding = item.registerNewsExistsChangeHandler((exists) => {
2868
2883
  this._dataActual.newsExists = exists;
2869
2884
  this._dataFormat.newsExists = exists;
2870
2885
  });
2886
+
2887
+ lockedBinding = item.registerLockChangeHandler((locked) => {
2888
+ this._dataFormat.locked = locked;
2889
+ });
2871
2890
  }
2872
2891
 
2873
2892
  this._disposeStack.push(item.registerPortfolioChangeHandler((portfolio) => {
@@ -2879,14 +2898,16 @@ module.exports = (() => {
2879
2898
  this._dataFormat.description = this._description;
2880
2899
  }));
2881
2900
 
2901
+ this._disposeStack.push(fundamentalBinding);
2882
2902
  this._disposeStack.push(quoteBinding);
2903
+ this._disposeStack.push(lockedBinding);
2883
2904
  this._disposeStack.push(newsBinding);
2884
- this._disposeStack.push(fundamentalBinding);
2885
2905
 
2886
2906
  this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
2907
+ fundamentalBinding.dispose();
2887
2908
  quoteBinding.dispose();
2888
2909
  newsBinding.dispose();
2889
- fundamentalBinding.dispose();
2910
+ lockedBinding.dispose();
2890
2911
 
2891
2912
  array.remove(this._items, i => i === item);
2892
2913
  array.remove(this._excludedItems, i => i === item);
@@ -3013,6 +3034,7 @@ module.exports = (() => {
3013
3034
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
3014
3035
 
3015
3036
  format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
3037
+ format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
3016
3038
  }
3017
3039
 
3018
3040
  const groupItems = group._items;
@@ -3251,13 +3273,15 @@ module.exports = (() => {
3251
3273
 
3252
3274
  this._data.newsExists = false;
3253
3275
  this._data.fundamental = { };
3276
+ this._data.locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
3254
3277
 
3255
3278
  calculateStaticData(this);
3256
3279
  calculatePriceData(this, null);
3257
3280
 
3258
3281
  this._quoteChangedEvent = new Event(this);
3259
3282
  this._newsExistsChangedEvent = new Event(this);
3260
- this._fundamentalDataChangeEvent = new Event(this);
3283
+ this._fundamentalDataChangedEvent = new Event(this);
3284
+ this._lockChangedEvent = new Event(this);
3261
3285
  this._portfolioChangedEvent = new Event(this);
3262
3286
  this._positionItemDisposeEvent = new Event(this);
3263
3287
  }
@@ -3385,6 +3409,25 @@ module.exports = (() => {
3385
3409
  }
3386
3410
  }
3387
3411
 
3412
+ /**
3413
+ * Sets a flag which indicates if news article(s) exist for the encapsulated position's
3414
+ * symbol.
3415
+ *
3416
+ * @public
3417
+ * @param {Boolean} value
3418
+ */
3419
+ setNewsArticleExists(value) {
3420
+ assert.argumentIsRequired(value, 'value', Boolean);
3421
+
3422
+ if (this.getIsDisposed()) {
3423
+ return;
3424
+ }
3425
+
3426
+ if (this._data.newsExists !== value) {
3427
+ this._newsExistsChangedEvent.fire(this._data.newsExists = value);
3428
+ }
3429
+ }
3430
+
3388
3431
  /**
3389
3432
  * Sets fundamental data for the position.
3390
3433
  *
@@ -3398,25 +3441,24 @@ module.exports = (() => {
3398
3441
  return;
3399
3442
  }
3400
3443
 
3401
- this._fundamentalDataChangeEvent.fire(this._data.fundamental = data);
3444
+ this._fundamentalDataChangedEvent.fire(this._data.fundamental = data);
3402
3445
  }
3403
3446
 
3404
3447
  /**
3405
- * Sets a flag which indicates if news article(s) exist for the encapsulated position's
3406
- * symbol.
3448
+ * Sets position lock status.
3407
3449
  *
3408
3450
  * @public
3409
3451
  * @param {Boolean} value
3410
3452
  */
3411
- setNewsArticleExists(value) {
3453
+ setPositionLock(value) {
3412
3454
  assert.argumentIsRequired(value, 'value', Boolean);
3413
3455
 
3414
3456
  if (this.getIsDisposed()) {
3415
3457
  return;
3416
3458
  }
3417
3459
 
3418
- if (this._data.newsExists !== value) {
3419
- this._newsExistsChangedEvent.fire(this._data.newsExists = value);
3460
+ if (this._data.locked !== value) {
3461
+ this._lockChangedEvent.fire(this._data.locked = value);
3420
3462
  }
3421
3463
  }
3422
3464
 
@@ -3432,6 +3474,17 @@ module.exports = (() => {
3432
3474
  return this._quoteChangedEvent.register(handler);
3433
3475
  }
3434
3476
 
3477
+ /**
3478
+ * Registers an observer changes to the status of news existence.
3479
+ *
3480
+ * @public
3481
+ * @param {Function} handler
3482
+ * @returns {Disposable}
3483
+ */
3484
+ registerNewsExistsChangeHandler(handler) {
3485
+ return this._newsExistsChangedEvent.register(handler);
3486
+ }
3487
+
3435
3488
  /**
3436
3489
  * Registers an observer for fundamental data changes.
3437
3490
  *
@@ -3440,18 +3493,18 @@ module.exports = (() => {
3440
3493
  * @returns {Disposable}
3441
3494
  */
3442
3495
  registerFundamentalDataChangeHandler(handler) {
3443
- return this._fundamentalDataChangeEvent.register(handler);
3496
+ return this._fundamentalDataChangedEvent.register(handler);
3444
3497
  }
3445
3498
 
3446
3499
  /**
3447
- * Registers an observer changes to the status of news existence.
3500
+ * Registers an observer for position lock changes.
3448
3501
  *
3449
3502
  * @public
3450
3503
  * @param {Function} handler
3451
3504
  * @returns {Disposable}
3452
3505
  */
3453
- registerNewsExistsChangeHandler(handler) {
3454
- return this._newsExistsChangedEvent.register(handler);
3506
+ registerLockChangeHandler(handler) {
3507
+ return this._lockChangedEvent.register(handler);
3455
3508
  }
3456
3509
 
3457
3510
  /**
@@ -3481,7 +3534,8 @@ module.exports = (() => {
3481
3534
 
3482
3535
  this._quoteChangedEvent.clear();
3483
3536
  this._newsExistsChangedEvent.clear();
3484
- this._fundamentalDataChangeEvent.clear();
3537
+ this._fundamentalDataChangedEvent.clear();
3538
+ this._lockChangedEvent.clear();
3485
3539
  this._portfolioChangedEvent.clear();
3486
3540
  this._positionItemDisposeEvent.clear();
3487
3541
  }
@@ -5920,12 +5974,11 @@ module.exports = function () {
5920
5974
  }
5921
5975
 
5922
5976
  /**
5923
- * Converts a string (which matches the output of {@link Day#format} into
5924
- * a {@link Day} instance.
5977
+ * Clones a {@link Day} instance.
5925
5978
  *
5926
5979
  * @public
5927
5980
  * @static
5928
- * @param {String} value
5981
+ * @param {Day} value
5929
5982
  * @returns {Day}
5930
5983
  */
5931
5984
 
@@ -5966,6 +6019,24 @@ module.exports = function () {
5966
6019
  return this._day;
5967
6020
  }
5968
6021
  }], [{
6022
+ key: 'clone',
6023
+ value: function clone(value) {
6024
+ assert.argumentIsRequired(value, 'value', Day, 'Day');
6025
+
6026
+ return new Day(value.year, value.month, value.day);
6027
+ }
6028
+
6029
+ /**
6030
+ * Converts a string (which matches the output of {@link Day#format} into
6031
+ * a {@link Day} instance.
6032
+ *
6033
+ * @public
6034
+ * @static
6035
+ * @param {String} value
6036
+ * @returns {Day}
6037
+ */
6038
+
6039
+ }, {
5969
6040
  key: 'parse',
5970
6041
  value: function parse(value) {
5971
6042
  assert.argumentIsRequired(value, 'value', String);
@@ -6476,10 +6547,11 @@ module.exports = function () {
6476
6547
  }
6477
6548
 
6478
6549
  /**
6479
- * Parses the value emitted by {@link Decimal#toJSON}.
6550
+ * Clones a {@link Decimal} instance.
6480
6551
  *
6481
6552
  * @public
6482
- * @param {String} value
6553
+ * @static
6554
+ * @param {Decimal} value
6483
6555
  * @returns {Decimal}
6484
6556
  */
6485
6557
 
@@ -6489,6 +6561,22 @@ module.exports = function () {
6489
6561
  return '[Decimal]';
6490
6562
  }
6491
6563
  }], [{
6564
+ key: 'clone',
6565
+ value: function clone(value) {
6566
+ assert.argumentIsRequired(value, 'value', Decimal, 'Decimal');
6567
+
6568
+ return new Decimal(value._big);
6569
+ }
6570
+
6571
+ /**
6572
+ * Parses the value emitted by {@link Decimal#toJSON}.
6573
+ *
6574
+ * @public
6575
+ * @param {String} value
6576
+ * @returns {Decimal}
6577
+ */
6578
+
6579
+ }, {
6492
6580
  key: 'parse',
6493
6581
  value: function parse(value) {
6494
6582
  return new Decimal(value);
@@ -7510,10 +7598,11 @@ module.exports = function () {
7510
7598
  }
7511
7599
 
7512
7600
  /**
7513
- * Parses the value emitted by {@link Timestamp#toJSON}.
7601
+ * Clones a {@link Timestamp} instance.
7514
7602
  *
7515
7603
  * @public
7516
- * @param {Number} value
7604
+ * @static
7605
+ * @param {Timestamp} value
7517
7606
  * @returns {Timestamp}
7518
7607
  */
7519
7608
 
@@ -7549,6 +7638,22 @@ module.exports = function () {
7549
7638
  return this._moment;
7550
7639
  }
7551
7640
  }], [{
7641
+ key: 'clone',
7642
+ value: function clone(value) {
7643
+ assert.argumentIsRequired(value, 'value', Timestamp, 'Timestamp');
7644
+
7645
+ return new Timestamp(value._timestamp, value._timezone);
7646
+ }
7647
+
7648
+ /**
7649
+ * Parses the value emitted by {@link Timestamp#toJSON}.
7650
+ *
7651
+ * @public
7652
+ * @param {Number} value
7653
+ * @returns {Timestamp}
7654
+ */
7655
+
7656
+ }, {
7552
7657
  key: 'parse',
7553
7658
  value: function parse(value) {
7554
7659
  return new Timestamp(value);