datastore-api 6.2.0 → 6.2.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/README.md +2 -1
- package/dist/datastore-api.cjs.development.js +136 -109
- package/dist/datastore-api.cjs.development.js.map +1 -1
- package/dist/datastore-api.cjs.production.min.js +1 -1
- package/dist/datastore-api.cjs.production.min.js.map +1 -1
- package/dist/datastore-api.esm.js +137 -110
- package/dist/datastore-api.esm.js.map +1 -1
- package/dist/lib/assert.d.ts +1 -1
- package/dist/lib/dstore-api.d.ts +26 -2
- package/package.json +1 -1
- package/src/lib/assert.ts +1 -1
- package/src/lib/dstore-api-cloud.spec.ts +123 -123
- package/src/lib/dstore-api.ts +57 -16
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Dstore implements a slightly more accessible version of the [Google Cloud Datast
|
|
|
12
12
|
|
|
13
13
|
Also the typings are strange and overly broad.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
This package tries to abstract away most surprises the datastore provides to you but als tries to stay as API compatible as possible to [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore).
|
|
16
16
|
|
|
17
17
|
Main differences:
|
|
18
18
|
|
|
@@ -23,6 +23,7 @@ Main differences:
|
|
|
23
23
|
- [allocateOneId](http://mdornseif.io/datastore-api/classes/Dstore.html#allocateOneId) returns a single numeric string encoded unique datastore id without the need of fancy unpacking.
|
|
24
24
|
- [runInTransaction](http://mdornseif.io/datastore-api/classes/Dstore.html#runInTransaction) allows you to provide a function to be executed inside an transaction without the need of passing around the transaction object. This is modelled after Python 2.7 [ndb's `@ndb.transactional` feature](https://cloud.google.com/appengine/docs/standard/python/ndb/transactions). This is implemented via node's [AsyncLocalStorage](https://nodejs.org/docs/latest-v14.x/api/async_hooks.html).
|
|
25
25
|
- [keySerialize](http://mdornseif.io/datastore-api/classes/Dstore.html#keySerialize) is synchronous. 🦄
|
|
26
|
+
- [iterate] allows for async iteration of (larege) queries.
|
|
26
27
|
- Starting your code with the environment variable `DEBUG='ds:api'` allows you to trace API calls.
|
|
27
28
|
|
|
28
29
|
Find the full documentation [here](https://mdornseif.github.io/datastore-api/classes/Dstore.html). In there also some of the idiosyncrasies of using the Datastore are explained.
|
|
@@ -549,6 +549,35 @@ function _wrapNativeSuper(t) {
|
|
|
549
549
|
}, _wrapNativeSuper(t);
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
+
/*
|
|
553
|
+
* assert.ts
|
|
554
|
+
*
|
|
555
|
+
* Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
|
|
556
|
+
*/
|
|
557
|
+
/**
|
|
558
|
+
* Generates an type assertion message for the given `value`
|
|
559
|
+
*
|
|
560
|
+
* @param value value being type-checked
|
|
561
|
+
* @param type the expected value as a string; eg 'string', 'boolean', 'number'
|
|
562
|
+
* @param variableName the name of the variable being type-checked
|
|
563
|
+
* @param additionalMessage further information on failure
|
|
564
|
+
*/
|
|
565
|
+
var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
|
|
566
|
+
var message = variableName ? variableName + " must be of type '" + type + "', '" + assertateDebug.getType(value) + "' provided" : "expected value of type '" + type + "', '" + assertateDebug.getType(value) + "' provided";
|
|
567
|
+
return additionalMessage ? message + ": " + additionalMessage : message;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Type-checks the provided `value` to be a symbol, throws an Error if it is not
|
|
571
|
+
*
|
|
572
|
+
* @param value the value to type-check as a symbol
|
|
573
|
+
* @param variableName the name of the variable to be type-checked
|
|
574
|
+
* @param additionalMessage further information on failure
|
|
575
|
+
* @throws {Error}
|
|
576
|
+
*/
|
|
577
|
+
function assertIsKey(value, variableName, additionalMessage) {
|
|
578
|
+
assertateDebug.assert(datastore.Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
|
|
579
|
+
}
|
|
580
|
+
|
|
552
581
|
/** @ignore */
|
|
553
582
|
var debug = /*#__PURE__*/Debug('ds:api');
|
|
554
583
|
/** @ignore */
|
|
@@ -691,6 +720,31 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
691
720
|
});
|
|
692
721
|
return entities;
|
|
693
722
|
}
|
|
723
|
+
/** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
|
|
724
|
+
*
|
|
725
|
+
*/;
|
|
726
|
+
_proto.prepareEntitiesForDatastore = function prepareEntitiesForDatastore(entities) {
|
|
727
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(entities), _step2; !(_step2 = _iterator2()).done;) {
|
|
728
|
+
var e = _step2.value;
|
|
729
|
+
assertateDebug.assertIsObject(e.key);
|
|
730
|
+
assertateDebug.assertIsObject(e.data);
|
|
731
|
+
this.fixKeys([e.data]);
|
|
732
|
+
e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
|
|
733
|
+
e.data = _extends({}, e.data, {
|
|
734
|
+
_keyStr: undefined
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
/** this is for save, insert, update and upsert and ensures _kkeyStr() handling.
|
|
739
|
+
*
|
|
740
|
+
*/;
|
|
741
|
+
_proto.prepareEntitiesFromDatastore = function prepareEntitiesFromDatastore(entities) {
|
|
742
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(entities), _step3; !(_step3 = _iterator3()).done;) {
|
|
743
|
+
var e = _step3.value;
|
|
744
|
+
e.data[datastore.Datastore.KEY] = e.key;
|
|
745
|
+
this.fixKeys([e.data]);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
694
748
|
/** `get()` reads a [[IDstoreEntry]] from the Datastore.
|
|
695
749
|
*
|
|
696
750
|
* It returns [[IDstoreEntry]] or `null` if not found.
|
|
@@ -916,25 +970,16 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
916
970
|
/*#__PURE__*/
|
|
917
971
|
function () {
|
|
918
972
|
var _save = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(entities) {
|
|
919
|
-
var ret, metricEnd
|
|
973
|
+
var ret, metricEnd;
|
|
920
974
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
921
975
|
while (1) switch (_context4.prev = _context4.next) {
|
|
922
976
|
case 0:
|
|
923
977
|
assertateDebug.assertIsArray(entities);
|
|
924
978
|
metricEnd = metricHistogram.startTimer();
|
|
925
979
|
_context4.prev = 2;
|
|
980
|
+
this.prepareEntitiesForDatastore(entities);
|
|
926
981
|
// Within Transaction we don't get any answer here!
|
|
927
982
|
// [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]
|
|
928
|
-
for (_iterator2 = _createForOfIteratorHelperLoose(entities); !(_step2 = _iterator2()).done;) {
|
|
929
|
-
e = _step2.value;
|
|
930
|
-
assertateDebug.assertIsObject(e.key);
|
|
931
|
-
assertateDebug.assertIsObject(e.data);
|
|
932
|
-
this.fixKeys([e.data]);
|
|
933
|
-
e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;
|
|
934
|
-
e.data = _extends({}, e.data, {
|
|
935
|
-
_keyStr: undefined
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
983
|
_context4.next = 6;
|
|
939
984
|
return this.getDoT().save(entities);
|
|
940
985
|
case 6:
|
|
@@ -946,11 +991,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
946
991
|
_context4.t0 = undefined;
|
|
947
992
|
case 9:
|
|
948
993
|
ret = _context4.t0;
|
|
949
|
-
|
|
950
|
-
_e = _step3.value;
|
|
951
|
-
_e.data[datastore.Datastore.KEY] = _e.key;
|
|
952
|
-
this.fixKeys([_e.data]);
|
|
953
|
-
}
|
|
994
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
954
995
|
_context4.next = 19;
|
|
955
996
|
break;
|
|
956
997
|
case 13:
|
|
@@ -1012,43 +1053,45 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1012
1053
|
assertateDebug.assertIsArray(entities);
|
|
1013
1054
|
metricEnd = metricHistogram.startTimer();
|
|
1014
1055
|
_context5.prev = 2;
|
|
1015
|
-
|
|
1056
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1057
|
+
_context5.next = 6;
|
|
1016
1058
|
return this.getDoT().insert(entities);
|
|
1017
|
-
case
|
|
1059
|
+
case 6:
|
|
1018
1060
|
_context5.t0 = _context5.sent;
|
|
1019
1061
|
if (_context5.t0) {
|
|
1020
|
-
_context5.next =
|
|
1062
|
+
_context5.next = 9;
|
|
1021
1063
|
break;
|
|
1022
1064
|
}
|
|
1023
1065
|
_context5.t0 = undefined;
|
|
1024
|
-
case
|
|
1066
|
+
case 9:
|
|
1025
1067
|
ret = _context5.t0;
|
|
1026
|
-
|
|
1068
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1069
|
+
_context5.next = 19;
|
|
1027
1070
|
break;
|
|
1028
|
-
case
|
|
1029
|
-
_context5.prev =
|
|
1071
|
+
case 13:
|
|
1072
|
+
_context5.prev = 13;
|
|
1030
1073
|
_context5.t1 = _context5["catch"](2);
|
|
1031
1074
|
// console.error(error)
|
|
1032
1075
|
metricFailureCounter.inc({
|
|
1033
1076
|
operation: 'insert'
|
|
1034
1077
|
});
|
|
1035
|
-
_context5.next =
|
|
1078
|
+
_context5.next = 18;
|
|
1036
1079
|
return promises.setImmediate();
|
|
1037
|
-
case
|
|
1080
|
+
case 18:
|
|
1038
1081
|
throw new DstoreError('datastore.insert error', _context5.t1);
|
|
1039
|
-
case
|
|
1040
|
-
_context5.prev =
|
|
1082
|
+
case 19:
|
|
1083
|
+
_context5.prev = 19;
|
|
1041
1084
|
metricEnd({
|
|
1042
1085
|
operation: 'insert'
|
|
1043
1086
|
});
|
|
1044
|
-
return _context5.finish(
|
|
1045
|
-
case
|
|
1087
|
+
return _context5.finish(19);
|
|
1088
|
+
case 22:
|
|
1046
1089
|
return _context5.abrupt("return", ret);
|
|
1047
|
-
case
|
|
1090
|
+
case 23:
|
|
1048
1091
|
case "end":
|
|
1049
1092
|
return _context5.stop();
|
|
1050
1093
|
}
|
|
1051
|
-
}, _callee5, this, [[2,
|
|
1094
|
+
}, _callee5, this, [[2, 13, 19, 22]]);
|
|
1052
1095
|
}));
|
|
1053
1096
|
function insert(_x6) {
|
|
1054
1097
|
return _insert.apply(this, arguments);
|
|
@@ -1090,43 +1133,45 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1090
1133
|
});
|
|
1091
1134
|
metricEnd = metricHistogram.startTimer();
|
|
1092
1135
|
_context6.prev = 4;
|
|
1093
|
-
|
|
1136
|
+
this.prepareEntitiesForDatastore(entities);
|
|
1137
|
+
_context6.next = 8;
|
|
1094
1138
|
return this.getDoT().update(entities);
|
|
1095
|
-
case
|
|
1139
|
+
case 8:
|
|
1096
1140
|
_context6.t0 = _context6.sent;
|
|
1097
1141
|
if (_context6.t0) {
|
|
1098
|
-
_context6.next =
|
|
1142
|
+
_context6.next = 11;
|
|
1099
1143
|
break;
|
|
1100
1144
|
}
|
|
1101
1145
|
_context6.t0 = undefined;
|
|
1102
|
-
case
|
|
1146
|
+
case 11:
|
|
1103
1147
|
ret = _context6.t0;
|
|
1104
|
-
|
|
1148
|
+
this.prepareEntitiesFromDatastore(entities);
|
|
1149
|
+
_context6.next = 21;
|
|
1105
1150
|
break;
|
|
1106
|
-
case
|
|
1107
|
-
_context6.prev =
|
|
1151
|
+
case 15:
|
|
1152
|
+
_context6.prev = 15;
|
|
1108
1153
|
_context6.t1 = _context6["catch"](4);
|
|
1109
1154
|
// console.error(error)
|
|
1110
1155
|
metricFailureCounter.inc({
|
|
1111
1156
|
operation: 'update'
|
|
1112
1157
|
});
|
|
1113
|
-
_context6.next =
|
|
1158
|
+
_context6.next = 20;
|
|
1114
1159
|
return promises.setImmediate();
|
|
1115
|
-
case
|
|
1160
|
+
case 20:
|
|
1116
1161
|
throw new DstoreError('datastore.update error', _context6.t1);
|
|
1117
|
-
case
|
|
1118
|
-
_context6.prev =
|
|
1162
|
+
case 21:
|
|
1163
|
+
_context6.prev = 21;
|
|
1119
1164
|
metricEnd({
|
|
1120
1165
|
operation: 'update'
|
|
1121
1166
|
});
|
|
1122
|
-
return _context6.finish(
|
|
1123
|
-
case
|
|
1167
|
+
return _context6.finish(21);
|
|
1168
|
+
case 24:
|
|
1124
1169
|
return _context6.abrupt("return", ret);
|
|
1125
|
-
case
|
|
1170
|
+
case 25:
|
|
1126
1171
|
case "end":
|
|
1127
1172
|
return _context6.stop();
|
|
1128
1173
|
}
|
|
1129
|
-
}, _callee6, this, [[4,
|
|
1174
|
+
}, _callee6, this, [[4, 15, 21, 24]]);
|
|
1130
1175
|
}));
|
|
1131
1176
|
function update(_x7) {
|
|
1132
1177
|
return _update.apply(this, arguments);
|
|
@@ -1283,7 +1328,7 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1283
1328
|
/*#__PURE__*/
|
|
1284
1329
|
function () {
|
|
1285
1330
|
var _query = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(kindName, filters, limit, ordering, selection, cursor) {
|
|
1286
|
-
var q, _iterator4, _step4, filterSpec, _iterator5, _step5, orderField;
|
|
1331
|
+
var q, _iterator4, _step4, filterSpec, _iterator5, _step5, orderField, ret;
|
|
1287
1332
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1288
1333
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1289
1334
|
case 0:
|
|
@@ -1321,26 +1366,27 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1321
1366
|
q.select(selection);
|
|
1322
1367
|
}
|
|
1323
1368
|
_context9.next = 15;
|
|
1324
|
-
return this.runQuery(q);
|
|
1369
|
+
return this.getDoT().runQuery(q);
|
|
1325
1370
|
case 15:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1371
|
+
ret = _context9.sent;
|
|
1372
|
+
return _context9.abrupt("return", [this.fixKeys(ret[0]), ret[1]]);
|
|
1373
|
+
case 19:
|
|
1374
|
+
_context9.prev = 19;
|
|
1329
1375
|
_context9.t0 = _context9["catch"](7);
|
|
1330
|
-
_context9.next =
|
|
1376
|
+
_context9.next = 23;
|
|
1331
1377
|
return promises.setImmediate();
|
|
1332
|
-
case
|
|
1378
|
+
case 23:
|
|
1333
1379
|
throw new DstoreError('datastore.query error', _context9.t0, {
|
|
1334
1380
|
kindName: kindName,
|
|
1335
1381
|
filters: filters,
|
|
1336
1382
|
limit: limit,
|
|
1337
1383
|
ordering: ordering
|
|
1338
1384
|
});
|
|
1339
|
-
case
|
|
1385
|
+
case 24:
|
|
1340
1386
|
case "end":
|
|
1341
1387
|
return _context9.stop();
|
|
1342
1388
|
}
|
|
1343
|
-
}, _callee9, this, [[7,
|
|
1389
|
+
}, _callee9, this, [[7, 19]]);
|
|
1344
1390
|
}));
|
|
1345
1391
|
function query(_x10, _x11, _x12, _x13, _x14, _x15) {
|
|
1346
1392
|
return _query.apply(this, arguments);
|
|
@@ -1352,12 +1398,21 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1352
1398
|
* It takes a Parameter object and returns an AsyncIterable.
|
|
1353
1399
|
* Entities returned have been processed by `fixKeys()`.
|
|
1354
1400
|
*
|
|
1401
|
+
* Can be used with `for await` loops like this:
|
|
1402
|
+
*
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* for await (const entity of dstore.iterate({ kindName: 'p_ReservierungsAbruf', filters: [['verbucht', '=', true]]})) {
|
|
1405
|
+
* console.log(entity)
|
|
1406
|
+
* }
|
|
1407
|
+
* ```
|
|
1408
|
+
*
|
|
1355
1409
|
* @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) ("Table") which should be searched.
|
|
1356
1410
|
* @param filters List of [[Query]] filter() calls.
|
|
1357
1411
|
* @param limit Maximum Number of Results to return.
|
|
1358
1412
|
* @param ordering List of [[Query]] order() calls.
|
|
1359
1413
|
* @param selection selectionList of [[Query]] select() calls.
|
|
1360
1414
|
*
|
|
1415
|
+
* @throws [[DstoreError]]
|
|
1361
1416
|
* @category Additional
|
|
1362
1417
|
*/
|
|
1363
1418
|
;
|
|
@@ -1401,72 +1456,73 @@ var Dstore = /*#__PURE__*/function () {
|
|
|
1401
1456
|
_iteratorAbruptCompletion = false;
|
|
1402
1457
|
_didIteratorError = false;
|
|
1403
1458
|
_context10.prev = 11;
|
|
1404
|
-
_iterator = _asyncIterator(
|
|
1459
|
+
_iterator = _asyncIterator(q.runStream());
|
|
1405
1460
|
case 13:
|
|
1406
1461
|
_context10.next = 15;
|
|
1407
1462
|
return _awaitAsyncGenerator(_iterator.next());
|
|
1408
1463
|
case 15:
|
|
1409
1464
|
if (!(_iteratorAbruptCompletion = !(_step = _context10.sent).done)) {
|
|
1410
|
-
_context10.next =
|
|
1465
|
+
_context10.next = 25;
|
|
1411
1466
|
break;
|
|
1412
1467
|
}
|
|
1413
1468
|
_entity = _step.value;
|
|
1414
1469
|
ret = _this.fixKeys([_entity])[0];
|
|
1415
1470
|
assertateDebug.assertIsDefined(ret, 'datastore.iterate: entity is undefined');
|
|
1416
|
-
|
|
1471
|
+
assertIsKey(ret[datastore.Datastore.KEY]);
|
|
1472
|
+
_context10.next = 22;
|
|
1417
1473
|
return ret;
|
|
1418
|
-
case
|
|
1474
|
+
case 22:
|
|
1419
1475
|
_iteratorAbruptCompletion = false;
|
|
1420
1476
|
_context10.next = 13;
|
|
1421
1477
|
break;
|
|
1422
|
-
case
|
|
1423
|
-
_context10.next =
|
|
1478
|
+
case 25:
|
|
1479
|
+
_context10.next = 31;
|
|
1424
1480
|
break;
|
|
1425
|
-
case
|
|
1426
|
-
_context10.prev =
|
|
1481
|
+
case 27:
|
|
1482
|
+
_context10.prev = 27;
|
|
1427
1483
|
_context10.t0 = _context10["catch"](11);
|
|
1428
1484
|
_didIteratorError = true;
|
|
1429
1485
|
_iteratorError = _context10.t0;
|
|
1430
|
-
case
|
|
1431
|
-
_context10.prev = 30;
|
|
1486
|
+
case 31:
|
|
1432
1487
|
_context10.prev = 31;
|
|
1488
|
+
_context10.prev = 32;
|
|
1433
1489
|
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
1434
|
-
_context10.next =
|
|
1490
|
+
_context10.next = 36;
|
|
1435
1491
|
break;
|
|
1436
1492
|
}
|
|
1437
|
-
_context10.next =
|
|
1493
|
+
_context10.next = 36;
|
|
1438
1494
|
return _awaitAsyncGenerator(_iterator["return"]());
|
|
1439
|
-
case
|
|
1440
|
-
_context10.prev =
|
|
1495
|
+
case 36:
|
|
1496
|
+
_context10.prev = 36;
|
|
1441
1497
|
if (!_didIteratorError) {
|
|
1442
|
-
_context10.next =
|
|
1498
|
+
_context10.next = 39;
|
|
1443
1499
|
break;
|
|
1444
1500
|
}
|
|
1445
1501
|
throw _iteratorError;
|
|
1446
|
-
case 38:
|
|
1447
|
-
return _context10.finish(35);
|
|
1448
1502
|
case 39:
|
|
1449
|
-
return _context10.finish(
|
|
1503
|
+
return _context10.finish(36);
|
|
1450
1504
|
case 40:
|
|
1451
|
-
_context10.
|
|
1505
|
+
return _context10.finish(31);
|
|
1506
|
+
case 41:
|
|
1507
|
+
_context10.next = 48;
|
|
1452
1508
|
break;
|
|
1453
|
-
case
|
|
1454
|
-
_context10.prev =
|
|
1509
|
+
case 43:
|
|
1510
|
+
_context10.prev = 43;
|
|
1455
1511
|
_context10.t1 = _context10["catch"](3);
|
|
1456
|
-
_context10.next =
|
|
1512
|
+
_context10.next = 47;
|
|
1457
1513
|
return _awaitAsyncGenerator(promises.setImmediate());
|
|
1458
|
-
case
|
|
1514
|
+
case 47:
|
|
1459
1515
|
throw new DstoreError('datastore.query error', _context10.t1, {
|
|
1460
1516
|
kindName: kindName,
|
|
1461
1517
|
filters: filters,
|
|
1462
1518
|
limit: limit,
|
|
1463
1519
|
ordering: ordering
|
|
1464
1520
|
});
|
|
1465
|
-
case
|
|
1521
|
+
case 48:
|
|
1466
1522
|
case "end":
|
|
1467
1523
|
return _context10.stop();
|
|
1468
1524
|
}
|
|
1469
|
-
}, _callee10, null, [[3,
|
|
1525
|
+
}, _callee10, null, [[3, 43], [11, 27, 31, 41], [32,, 36, 40]]);
|
|
1470
1526
|
}))();
|
|
1471
1527
|
}
|
|
1472
1528
|
/** Allocate one ID in the Datastore.
|
|
@@ -1620,35 +1676,6 @@ var DstoreError = /*#__PURE__*/function (_Error) {
|
|
|
1620
1676
|
return DstoreError;
|
|
1621
1677
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
1622
1678
|
|
|
1623
|
-
/*
|
|
1624
|
-
* assert.ts
|
|
1625
|
-
*
|
|
1626
|
-
* Created by Dr. Maximillian Dornseif 2025-04-11 in datastore-api 6.0.1
|
|
1627
|
-
*/
|
|
1628
|
-
/**
|
|
1629
|
-
* Generates an type assertion message for the given `value`
|
|
1630
|
-
*
|
|
1631
|
-
* @param value value being type-checked
|
|
1632
|
-
* @param type the expected value as a string; eg 'string', 'boolean', 'number'
|
|
1633
|
-
* @param variableName the name of the variable being type-checked
|
|
1634
|
-
* @param additionalMessage further information on failure
|
|
1635
|
-
*/
|
|
1636
|
-
var AssertionMessage = function AssertionMessage(value, type, variableName, additionalMessage) {
|
|
1637
|
-
var message = variableName ? variableName + " must be of type '" + type + "', '" + assertateDebug.getType(value) + "' provided" : "expected value of type '" + type + "', '" + assertateDebug.getType(value) + "' provided";
|
|
1638
|
-
return additionalMessage ? message + ": " + additionalMessage : message;
|
|
1639
|
-
};
|
|
1640
|
-
/**
|
|
1641
|
-
* Type-checks the provided `value` to be a symbol, throws an Error if it is not
|
|
1642
|
-
*
|
|
1643
|
-
* @param value the value to type-check as a symbol
|
|
1644
|
-
* @param variableName the name of the variable to be type-checked
|
|
1645
|
-
* @param additionalMessage further information on failure
|
|
1646
|
-
* @throws {Error}
|
|
1647
|
-
*/
|
|
1648
|
-
function assertIsKey(value, variableName, additionalMessage) {
|
|
1649
|
-
assertateDebug.assert(datastore.Datastore.isKey(value), AssertionMessage(value, "Key", variableName, additionalMessage));
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
1679
|
Object.defineProperty(exports, 'Datastore', {
|
|
1653
1680
|
enumerable: true,
|
|
1654
1681
|
get: function () { return datastore.Datastore; }
|