@mongoosejs/studio 0.0.45 → 0.0.47
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/frontend/public/app.js +704 -423
- package/frontend/public/index.html +2 -1
- package/frontend/public/tw.css +4 -0
- package/frontend/src/dashboard/dashboard.html +12 -0
- package/frontend/src/dashboard/dashboard.js +11 -3
- package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +2 -2
- package/frontend/src/dashboard-result/dashboard-result.js +3 -0
- package/frontend/src/dashboard-result/dashboard-text/dashboard-text.html +8 -0
- package/frontend/src/dashboard-result/dashboard-text/dashboard-text.js +8 -0
- package/frontend/src/document/confirm-delete/confirm-delete.html +18 -0
- package/frontend/src/document/confirm-delete/confirm-delete.js +24 -0
- package/frontend/src/document/document.html +7 -1
- package/frontend/src/document/document.js +2 -1
- package/frontend/src/edit-array/edit-array.js +6 -4
- package/frontend/src/index.js +3 -1
- package/package.json +2 -2
- package/frontend/dist/app.js +0 -160
- package/frontend/dist/tw.css +0 -595
package/frontend/public/app.js
CHANGED
|
@@ -425,11 +425,33 @@ module.exports = app => app.component('dashboard-result', {
|
|
|
425
425
|
if (value.$document) {
|
|
426
426
|
return 'dashboard-document';
|
|
427
427
|
}
|
|
428
|
+
if (value.$text) {
|
|
429
|
+
return 'dashboard-text';
|
|
430
|
+
}
|
|
428
431
|
}
|
|
429
432
|
}
|
|
430
433
|
});
|
|
431
434
|
|
|
432
435
|
|
|
436
|
+
/***/ }),
|
|
437
|
+
|
|
438
|
+
/***/ "./frontend/src/dashboard-result/dashboard-text/dashboard-text.js":
|
|
439
|
+
/*!************************************************************************!*\
|
|
440
|
+
!*** ./frontend/src/dashboard-result/dashboard-text/dashboard-text.js ***!
|
|
441
|
+
\************************************************************************/
|
|
442
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
443
|
+
|
|
444
|
+
"use strict";
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
const template = __webpack_require__(/*! ./dashboard-text.html */ "./frontend/src/dashboard-result/dashboard-text/dashboard-text.html");
|
|
448
|
+
|
|
449
|
+
module.exports = app => app.component('dashboard-text', {
|
|
450
|
+
template: template,
|
|
451
|
+
props: ['value']
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
|
|
433
455
|
/***/ }),
|
|
434
456
|
|
|
435
457
|
/***/ "./frontend/src/dashboard/dashboard.js":
|
|
@@ -455,7 +477,8 @@ module.exports = app => app.component('dashboard', {
|
|
|
455
477
|
description: '',
|
|
456
478
|
showEditor: false,
|
|
457
479
|
dashboard: null,
|
|
458
|
-
result: null
|
|
480
|
+
result: null,
|
|
481
|
+
errorMessage: null
|
|
459
482
|
}
|
|
460
483
|
},
|
|
461
484
|
methods: {
|
|
@@ -466,15 +489,22 @@ module.exports = app => app.component('dashboard', {
|
|
|
466
489
|
this.code = update.doc.code;
|
|
467
490
|
this.title = update.doc.title;
|
|
468
491
|
this.description = update.doc.description;
|
|
469
|
-
|
|
492
|
+
if (update.result) {
|
|
493
|
+
this.result = update.result;
|
|
494
|
+
} else {
|
|
495
|
+
this.errorMessage = update.error.message;
|
|
496
|
+
}
|
|
470
497
|
}
|
|
471
498
|
},
|
|
472
499
|
mounted: async function() {
|
|
473
|
-
const { dashboard, result } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
|
|
500
|
+
const { dashboard, result, error } = await api.Dashboard.getDashboard({ dashboardId: this.dashboardId, evaluate: true });
|
|
474
501
|
if (!dashboard) {
|
|
475
502
|
return;
|
|
476
503
|
}
|
|
477
504
|
this.dashboard = dashboard;
|
|
505
|
+
if (error) {
|
|
506
|
+
this.errorMessage = error.message;
|
|
507
|
+
}
|
|
478
508
|
this.code = this.dashboard.code;
|
|
479
509
|
this.title = this.dashboard.title;
|
|
480
510
|
this.description = this.dashboard.description ?? '';
|
|
@@ -515,13 +545,13 @@ module.exports = app => app.component('edit-dashboard', {
|
|
|
515
545
|
},
|
|
516
546
|
async updateCode() {
|
|
517
547
|
console.log('this.title', this.title, 'this.description', this.description)
|
|
518
|
-
const { doc, result } = await api.Dashboard.updateDashboard({
|
|
548
|
+
const { doc, result, error } = await api.Dashboard.updateDashboard({
|
|
519
549
|
dashboardId: this.dashboardId,
|
|
520
550
|
code: this.editor.getValue(),
|
|
521
551
|
title: this.title,
|
|
522
552
|
description: this.description
|
|
523
553
|
});
|
|
524
|
-
this.$emit('update', { doc, result });
|
|
554
|
+
this.$emit('update', { doc, result, error });
|
|
525
555
|
this.editor.setValue(doc.code);
|
|
526
556
|
this.closeEditor();
|
|
527
557
|
}
|
|
@@ -801,6 +831,40 @@ module.exports = app => app.component('confirm-changes', {
|
|
|
801
831
|
|
|
802
832
|
/***/ }),
|
|
803
833
|
|
|
834
|
+
/***/ "./frontend/src/document/confirm-delete/confirm-delete.js":
|
|
835
|
+
/*!****************************************************************!*\
|
|
836
|
+
!*** ./frontend/src/document/confirm-delete/confirm-delete.js ***!
|
|
837
|
+
\****************************************************************/
|
|
838
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
839
|
+
|
|
840
|
+
"use strict";
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
const template = __webpack_require__(/*! ./confirm-delete.html */ "./frontend/src/document/confirm-delete/confirm-delete.html");
|
|
844
|
+
|
|
845
|
+
module.exports = app => app.component('confirm-delete', {
|
|
846
|
+
template: template,
|
|
847
|
+
props: ['value'],
|
|
848
|
+
computed: {
|
|
849
|
+
displayValue() {
|
|
850
|
+
return JSON.stringify(this.value, null, ' ').trim();
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
methods: {
|
|
854
|
+
closeDelete() {
|
|
855
|
+
this.$emit('close')
|
|
856
|
+
},
|
|
857
|
+
startDelete() {
|
|
858
|
+
this.$emit('remove');
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
mounted() {
|
|
862
|
+
Prism.highlightElement(this.$refs.code);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
/***/ }),
|
|
867
|
+
|
|
804
868
|
/***/ "./frontend/src/document/document.js":
|
|
805
869
|
/*!*******************************************!*\
|
|
806
870
|
!*** ./frontend/src/document/document.js ***!
|
|
@@ -830,7 +894,8 @@ module.exports = app => app.component('document', {
|
|
|
830
894
|
invalid: {},
|
|
831
895
|
editting: false,
|
|
832
896
|
virtuals: [],
|
|
833
|
-
shouldShowConfirmModal: false
|
|
897
|
+
shouldShowConfirmModal: false,
|
|
898
|
+
shouldShowDeleteModal: false
|
|
834
899
|
}),
|
|
835
900
|
async mounted() {
|
|
836
901
|
window.pageState = this;
|
|
@@ -900,7 +965,7 @@ module.exports = app => app.component('document', {
|
|
|
900
965
|
|
|
901
966
|
const template = __webpack_require__(/*! ./edit-array.html */ "./frontend/src/edit-array/edit-array.html");
|
|
902
967
|
|
|
903
|
-
const { BSON
|
|
968
|
+
const { BSON } = __webpack_require__(/*! bson */ "./node_modules/bson/lib/bson.cjs");
|
|
904
969
|
|
|
905
970
|
const ObjectId = new Proxy(BSON.ObjectId, {
|
|
906
971
|
apply (target, thisArg, argumentsList) {
|
|
@@ -927,15 +992,17 @@ module.exports = app => app.component('edit-array', {
|
|
|
927
992
|
this.editor.on('change', ev => {
|
|
928
993
|
this.currentValue = this.editor.getValue();
|
|
929
994
|
});
|
|
930
|
-
this.status = 'loaded';
|
|
931
995
|
},
|
|
932
996
|
watch: {
|
|
933
|
-
currentValue() {
|
|
997
|
+
currentValue(newValue, oldValue) {
|
|
998
|
+
// Hacky way of skipping initial trigger because `immediate: false` doesn't work in Vue 3
|
|
934
999
|
if (this.status === 'init') {
|
|
935
1000
|
return;
|
|
936
1001
|
}
|
|
1002
|
+
this.status = 'loaded';
|
|
937
1003
|
try {
|
|
938
|
-
|
|
1004
|
+
const array = eval(`(${this.currentValue})`);
|
|
1005
|
+
this.$emit('input', array);
|
|
939
1006
|
} catch (err) {
|
|
940
1007
|
this.$emit('error', err);
|
|
941
1008
|
}
|
|
@@ -970,6 +1037,24 @@ module.exports = app => app.component('edit-date', {
|
|
|
970
1037
|
data: () => ({
|
|
971
1038
|
inputType: ''
|
|
972
1039
|
}),
|
|
1040
|
+
methods: {
|
|
1041
|
+
updateFromISO($event) {
|
|
1042
|
+
const value = $event.target.value;
|
|
1043
|
+
if (value == null) {
|
|
1044
|
+
return this.$emit('input', $event.target.value);
|
|
1045
|
+
}
|
|
1046
|
+
if (value === 'null') {
|
|
1047
|
+
return this.$emit('input', null);
|
|
1048
|
+
}
|
|
1049
|
+
if (value === 'undefined') {
|
|
1050
|
+
return this.$emit('input', undefined);
|
|
1051
|
+
}
|
|
1052
|
+
const valueAsDate = new Date(value);
|
|
1053
|
+
if (!isNaN(valueAsDate.valueOf())) {
|
|
1054
|
+
this.$emit('input', $event.target.value);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
973
1058
|
computed: {
|
|
974
1059
|
valueAsLocalString() {
|
|
975
1060
|
if (this.value == null) {
|
|
@@ -990,7 +1075,7 @@ module.exports = app => app.component('edit-date', {
|
|
|
990
1075
|
},
|
|
991
1076
|
valueAsISOString() {
|
|
992
1077
|
if (this.value == null) {
|
|
993
|
-
return this.value;
|
|
1078
|
+
return '' + this.value;
|
|
994
1079
|
}
|
|
995
1080
|
const date = new Date(this.value);
|
|
996
1081
|
return date.toISOString();
|
|
@@ -2519,6 +2604,17 @@ module.exports = "<div>\n <div v-if=\"Array.isArray(result)\">\n <div v-for=
|
|
|
2519
2604
|
|
|
2520
2605
|
/***/ }),
|
|
2521
2606
|
|
|
2607
|
+
/***/ "./frontend/src/dashboard-result/dashboard-text/dashboard-text.html":
|
|
2608
|
+
/*!**************************************************************************!*\
|
|
2609
|
+
!*** ./frontend/src/dashboard-result/dashboard-text/dashboard-text.html ***!
|
|
2610
|
+
\**************************************************************************/
|
|
2611
|
+
/***/ ((module) => {
|
|
2612
|
+
|
|
2613
|
+
"use strict";
|
|
2614
|
+
module.exports = "<div class=\"py-2\">\n <div v-if=\"header\" class=\"border-b border-gray-100 px-2 pb-2 text-xl font-bold\">\n {{header}}\n </div>\n <div class=\"text-xl p-2\">\n <pre v-text=\"value.$text\"></pre>\n </div>\n</div>\n";
|
|
2615
|
+
|
|
2616
|
+
/***/ }),
|
|
2617
|
+
|
|
2522
2618
|
/***/ "./frontend/src/dashboard/dashboard.html":
|
|
2523
2619
|
/*!***********************************************!*\
|
|
2524
2620
|
!*** ./frontend/src/dashboard/dashboard.html ***!
|
|
@@ -2526,7 +2622,7 @@ module.exports = "<div>\n <div v-if=\"Array.isArray(result)\">\n <div v-for=
|
|
|
2526
2622
|
/***/ ((module) => {
|
|
2527
2623
|
|
|
2528
2624
|
"use strict";
|
|
2529
|
-
module.exports = "<div class=\"dashboard px-1\">\n <div v-if=\"status === 'loading'\" class=\"max-w-5xl mx-auto text-center\">\n <img src=\"images/loader.gif\" class=\"inline mt-10\">\n </div>\n <div v-if=\"dashboard && status === 'loaded'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div>\n <button\n v-if=\"!showEditor\"\n @click=\"showEditor = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1em]\" /> Edit\n </button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <dashboard-result :result=\"result\"></dashboard-result>\n </div>\n <div v-if=\"showEditor\">\n <edit-dashboard\n :dashboardId=\"dashboard._id\"\n :code=\"code\"\n :currentDescription=\"description\"\n :currentTitle=\"title\"\n @close=\"showEditor=false;\"\n @update=\"updateCode\"></edit-dashboard>\n </div>\n \n </div>\n <div v-if=\"!dashboard && status === 'loaded'\">\n No dashboard with the given id could be found.\n </div>\n</div>\n";
|
|
2625
|
+
module.exports = "<div class=\"dashboard px-1\">\n <div v-if=\"status === 'loading'\" class=\"max-w-5xl mx-auto text-center\">\n <img src=\"images/loader.gif\" class=\"inline mt-10\">\n </div>\n <div v-if=\"dashboard && status === 'loaded'\" class=\"max-w-5xl mx-auto\">\n <div class=\"flex items-center w-full\">\n <h2 class=\"mt-4 mb-4 text-gray-900 font-semibold text-xl grow shrink\">{{title}}</h2>\n <div>\n <button\n v-if=\"!showEditor\"\n @click=\"showEditor = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline h-[1em]\" /> Edit\n </button>\n </div>\n </div>\n <div v-if=\"!showEditor\" class=\"mt-4 mb-4\">\n <dashboard-result :result=\"result\"></dashboard-result>\n </div>\n <div v-if=\"showEditor\">\n <edit-dashboard\n :dashboardId=\"dashboard._id\"\n :code=\"code\"\n :currentDescription=\"description\"\n :currentTitle=\"title\"\n @close=\"showEditor=false;\"\n @update=\"updateCode\"></edit-dashboard>\n </div>\n <div v-if=\"errorMessage\" class=\"rounded-md bg-red-50 p-4 mt-4\">\n <div class=\"flex\">\n <div class=\"flex-shrink-0\">\n <svg class=\"h-5 w-5 text-red-400\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\" data-slot=\"icon\">\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z\" clip-rule=\"evenodd\" />\n </svg>\n </div>\n <div class=\"ml-3\">\n <h3 class=\"text-sm font-medium text-red-800\">{{errorMessage}}</h3>\n </div>\n </div>\n </div>\n \n </div>\n <div v-if=\"!dashboard && status === 'loaded'\">\n No dashboard with the given id could be found.\n </div>\n</div>\n";
|
|
2530
2626
|
|
|
2531
2627
|
/***/ }),
|
|
2532
2628
|
|
|
@@ -2629,6 +2725,17 @@ module.exports = "<div>\n <h2>\n Are you sure you want to save the fol
|
|
|
2629
2725
|
|
|
2630
2726
|
/***/ }),
|
|
2631
2727
|
|
|
2728
|
+
/***/ "./frontend/src/document/confirm-delete/confirm-delete.html":
|
|
2729
|
+
/*!******************************************************************!*\
|
|
2730
|
+
!*** ./frontend/src/document/confirm-delete/confirm-delete.html ***!
|
|
2731
|
+
\******************************************************************/
|
|
2732
|
+
/***/ ((module) => {
|
|
2733
|
+
|
|
2734
|
+
"use strict";
|
|
2735
|
+
module.exports = "<div>\n <h2>\n Are you sure you want to delete the following document?\n </h2>\n <pre class=\"max-h-[50vh] overflow-auto\"><code ref=\"code\" class=\"language-javascript\" v-text=\"displayValue\"></code></pre>\n <div class=\"flex gap-2 mt-2\">\n <async-button\n class=\"rounded-md bg-green-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600\"\n @click=\"startDelete\">\n Confirm\n </async-button>\n <button \n class=\"rounded-md bg-gray-200 px-2.5 py-1.5 text-sm font-semibold text-black shadow-sm hover:bg-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-300\"\n @click=\"closeDelete\">\n Cancel\n </button>\n </div>\n</div>";
|
|
2736
|
+
|
|
2737
|
+
/***/ }),
|
|
2738
|
+
|
|
2632
2739
|
/***/ "./frontend/src/document/document.css":
|
|
2633
2740
|
/*!********************************************!*\
|
|
2634
2741
|
!*** ./frontend/src/document/document.css ***!
|
|
@@ -2647,7 +2754,7 @@ module.exports = ".document {\n max-width: 1200px;\n margin-left: auto;\n mar
|
|
|
2647
2754
|
/***/ ((module) => {
|
|
2648
2755
|
|
|
2649
2756
|
"use strict";
|
|
2650
|
-
module.exports = "<div class=\"document\">\n <div class=\"document-menu\">\n <div class=\"left\">\n <button @click=\"$router.push('/model/' + this.model)\">\n ‹ Back\n </button>\n </div>\n\n <div class=\"right\">\n <button\n v-if=\"!editting\"\n @click=\"editting = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline\" /> Edit\n </button>\n <button\n v-if=\"editting\"\n @click=\"editting = false\"\n type=\"button\"\n class=\"rounded-md bg-slate-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-slate-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-600\">\n × Cancel\n </button>\n <button\n v-if=\"editting\"\n @click=\"shouldShowConfirmModal=true;\"\n type=\"button\"\n class=\"rounded-md bg-green-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600\">\n <img src=\"images/save.svg\" class=\"inline\" /> Save\n </button>\n <button\n @click=\"
|
|
2757
|
+
module.exports = "<div class=\"document\">\n <div class=\"document-menu\">\n <div class=\"left\">\n <button @click=\"$router.push('/model/' + this.model)\">\n ‹ Back\n </button>\n </div>\n\n <div class=\"right\">\n <button\n v-if=\"!editting\"\n @click=\"editting = true\"\n type=\"button\"\n class=\"rounded-md bg-teal-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-teal-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-600\">\n <img src=\"images/edit.svg\" class=\"inline\" /> Edit\n </button>\n <button\n v-if=\"editting\"\n @click=\"editting = false\"\n type=\"button\"\n class=\"rounded-md bg-slate-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-slate-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-slate-600\">\n × Cancel\n </button>\n <button\n v-if=\"editting\"\n @click=\"shouldShowConfirmModal=true;\"\n type=\"button\"\n class=\"rounded-md bg-green-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600\">\n <img src=\"images/save.svg\" class=\"inline\" /> Save\n </button>\n <button\n @click=\"shouldShowDeleteModal=true;\"\n type=\"button\"\n class=\"rounded-md bg-red-600 px-2.5 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600\">\n <img src=\"images/delete.svg\" class=\"inline\" /> Delete\n </button>\n </div>\n </div>\n <div v-if=\"status === 'loaded'\">\n <document-details\n :document=\"document\"\n :schemaPaths=\"schemaPaths\"\n :editting=\"editting\"\n :changes=\"changes\"\n :invalid=\"invalid\"></document-details>\n <modal v-if=\"shouldShowConfirmModal\">\n <template v-slot:body>\n <div class=\"modal-exit\" @click=\"shouldShowConfirmModal = false;\">×</div>\n <confirm-changes @close=\"shouldShowConfirmModal = false;\" @save=\"save\" :value=\"changes\"></confirm-changes>\n </template>\n </modal>\n <modal v-if=\"shouldShowDeleteModal\">\n <template v-slot:body>\n <div class=\"modal-exit\" @click=\"shouldShowConfirmModal = false;\">×</div>\n <confirm-delete @close=\"shouldShowConfirmModal = false;\" @remove=\"remove\" :value=\"document\"></confirm-delete>\n </template>\n </modal>\n </div>\n</div>\n";
|
|
2651
2758
|
|
|
2652
2759
|
/***/ }),
|
|
2653
2760
|
|
|
@@ -2680,7 +2787,7 @@ module.exports = "<div class=\"edit-array\">\n <textarea\n ref=\"arrayEditor
|
|
|
2680
2787
|
/***/ ((module) => {
|
|
2681
2788
|
|
|
2682
2789
|
"use strict";
|
|
2683
|
-
module.exports = "<div>\n <input
|
|
2790
|
+
module.exports = "<div>\n <input\n v-if=\"dateSelection == 'picker'\"\n class=\"w-64 h-8 border border-gray-300 outline-0\"\n type=\"datetime-local\"\n :value=\"valueAsLocalString\"\n @input=\"$emit('input', $event.target.value)\">\n <input\n v-if=\"dateSelection == 'iso'\"\n type=\"text\"\n class=\"w-64 h-8 border border-gray-300 outline-0\"\n :value=\"valueAsISOString\"\n @input=\"updateFromISO\">\n</div>";
|
|
2684
2791
|
|
|
2685
2792
|
/***/ }),
|
|
2686
2793
|
|
|
@@ -6112,20 +6219,31 @@ module.exports = axios;
|
|
|
6112
6219
|
"use strict";
|
|
6113
6220
|
|
|
6114
6221
|
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6222
|
+
const TypedArrayPrototypeGetSymbolToStringTag = (() => {
|
|
6223
|
+
const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
|
|
6224
|
+
return (value) => g.call(value);
|
|
6225
|
+
})();
|
|
6118
6226
|
function isUint8Array(value) {
|
|
6119
|
-
return
|
|
6227
|
+
return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
|
|
6120
6228
|
}
|
|
6121
|
-
function
|
|
6122
|
-
return
|
|
6229
|
+
function isAnyArrayBuffer(value) {
|
|
6230
|
+
return (typeof value === 'object' &&
|
|
6231
|
+
value != null &&
|
|
6232
|
+
Symbol.toStringTag in value &&
|
|
6233
|
+
(value[Symbol.toStringTag] === 'ArrayBuffer' ||
|
|
6234
|
+
value[Symbol.toStringTag] === 'SharedArrayBuffer'));
|
|
6235
|
+
}
|
|
6236
|
+
function isRegExp(regexp) {
|
|
6237
|
+
return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
|
|
6123
6238
|
}
|
|
6124
|
-
function isMap(
|
|
6125
|
-
return
|
|
6239
|
+
function isMap(value) {
|
|
6240
|
+
return (typeof value === 'object' &&
|
|
6241
|
+
value != null &&
|
|
6242
|
+
Symbol.toStringTag in value &&
|
|
6243
|
+
value[Symbol.toStringTag] === 'Map');
|
|
6126
6244
|
}
|
|
6127
|
-
function isDate(
|
|
6128
|
-
return Object.prototype.toString.call(
|
|
6245
|
+
function isDate(date) {
|
|
6246
|
+
return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
|
|
6129
6247
|
}
|
|
6130
6248
|
function defaultInspect(x, _options) {
|
|
6131
6249
|
return JSON.stringify(x, (k, v) => {
|
|
@@ -6149,6 +6267,7 @@ function getStylizeFunction(options) {
|
|
|
6149
6267
|
}
|
|
6150
6268
|
|
|
6151
6269
|
const BSON_MAJOR_VERSION = 6;
|
|
6270
|
+
const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
|
|
6152
6271
|
const BSON_INT32_MAX = 0x7fffffff;
|
|
6153
6272
|
const BSON_INT32_MIN = -0x80000000;
|
|
6154
6273
|
const BSON_INT64_MAX = Math.pow(2, 63) - 1;
|
|
@@ -6341,7 +6460,7 @@ const nodeJsByteUtils = {
|
|
|
6341
6460
|
stringTag === '[object SharedArrayBuffer]') {
|
|
6342
6461
|
return Buffer.from(potentialBuffer);
|
|
6343
6462
|
}
|
|
6344
|
-
throw new BSONError(`Cannot create Buffer from
|
|
6463
|
+
throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
|
|
6345
6464
|
},
|
|
6346
6465
|
allocate(size) {
|
|
6347
6466
|
return Buffer.alloc(size);
|
|
@@ -6399,7 +6518,10 @@ const nodeJsByteUtils = {
|
|
|
6399
6518
|
}
|
|
6400
6519
|
return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
|
|
6401
6520
|
},
|
|
6402
|
-
randomBytes: nodejsRandomBytes
|
|
6521
|
+
randomBytes: nodejsRandomBytes,
|
|
6522
|
+
swap32(buffer) {
|
|
6523
|
+
return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
|
|
6524
|
+
}
|
|
6403
6525
|
};
|
|
6404
6526
|
|
|
6405
6527
|
function isReactNative() {
|
|
@@ -6444,7 +6566,7 @@ const webByteUtils = {
|
|
|
6444
6566
|
stringTag === '[object SharedArrayBuffer]') {
|
|
6445
6567
|
return new Uint8Array(potentialUint8array);
|
|
6446
6568
|
}
|
|
6447
|
-
throw new BSONError(`Cannot make a Uint8Array from
|
|
6569
|
+
throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
|
|
6448
6570
|
},
|
|
6449
6571
|
allocate(size) {
|
|
6450
6572
|
if (typeof size !== 'number') {
|
|
@@ -6516,14 +6638,30 @@ const webByteUtils = {
|
|
|
6516
6638
|
uint8array.set(bytes, byteOffset);
|
|
6517
6639
|
return bytes.byteLength;
|
|
6518
6640
|
},
|
|
6519
|
-
randomBytes: webRandomBytes
|
|
6641
|
+
randomBytes: webRandomBytes,
|
|
6642
|
+
swap32(buffer) {
|
|
6643
|
+
if (buffer.length % 4 !== 0) {
|
|
6644
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits');
|
|
6645
|
+
}
|
|
6646
|
+
for (let i = 0; i < buffer.length; i += 4) {
|
|
6647
|
+
const byte0 = buffer[i];
|
|
6648
|
+
const byte1 = buffer[i + 1];
|
|
6649
|
+
const byte2 = buffer[i + 2];
|
|
6650
|
+
const byte3 = buffer[i + 3];
|
|
6651
|
+
buffer[i] = byte3;
|
|
6652
|
+
buffer[i + 1] = byte2;
|
|
6653
|
+
buffer[i + 2] = byte1;
|
|
6654
|
+
buffer[i + 3] = byte0;
|
|
6655
|
+
}
|
|
6656
|
+
return buffer;
|
|
6657
|
+
}
|
|
6520
6658
|
};
|
|
6521
6659
|
|
|
6522
6660
|
const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
|
|
6523
6661
|
const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
|
|
6524
6662
|
|
|
6525
6663
|
class BSONValue {
|
|
6526
|
-
get [
|
|
6664
|
+
get [BSON_VERSION_SYMBOL]() {
|
|
6527
6665
|
return BSON_MAJOR_VERSION;
|
|
6528
6666
|
}
|
|
6529
6667
|
[Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
|
|
@@ -6531,6 +6669,134 @@ class BSONValue {
|
|
|
6531
6669
|
}
|
|
6532
6670
|
}
|
|
6533
6671
|
|
|
6672
|
+
const FLOAT = new Float64Array(1);
|
|
6673
|
+
const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
|
|
6674
|
+
FLOAT[0] = -1;
|
|
6675
|
+
const isBigEndian = FLOAT_BYTES[7] === 0;
|
|
6676
|
+
const NumberUtils = {
|
|
6677
|
+
isBigEndian,
|
|
6678
|
+
getNonnegativeInt32LE(source, offset) {
|
|
6679
|
+
if (source[offset + 3] > 127) {
|
|
6680
|
+
throw new RangeError(`Size cannot be negative at offset: ${offset}`);
|
|
6681
|
+
}
|
|
6682
|
+
return (source[offset] |
|
|
6683
|
+
(source[offset + 1] << 8) |
|
|
6684
|
+
(source[offset + 2] << 16) |
|
|
6685
|
+
(source[offset + 3] << 24));
|
|
6686
|
+
},
|
|
6687
|
+
getInt32LE(source, offset) {
|
|
6688
|
+
return (source[offset] |
|
|
6689
|
+
(source[offset + 1] << 8) |
|
|
6690
|
+
(source[offset + 2] << 16) |
|
|
6691
|
+
(source[offset + 3] << 24));
|
|
6692
|
+
},
|
|
6693
|
+
getUint32LE(source, offset) {
|
|
6694
|
+
return (source[offset] +
|
|
6695
|
+
source[offset + 1] * 256 +
|
|
6696
|
+
source[offset + 2] * 65536 +
|
|
6697
|
+
source[offset + 3] * 16777216);
|
|
6698
|
+
},
|
|
6699
|
+
getUint32BE(source, offset) {
|
|
6700
|
+
return (source[offset + 3] +
|
|
6701
|
+
source[offset + 2] * 256 +
|
|
6702
|
+
source[offset + 1] * 65536 +
|
|
6703
|
+
source[offset] * 16777216);
|
|
6704
|
+
},
|
|
6705
|
+
getBigInt64LE(source, offset) {
|
|
6706
|
+
const lo = NumberUtils.getUint32LE(source, offset);
|
|
6707
|
+
const hi = NumberUtils.getUint32LE(source, offset + 4);
|
|
6708
|
+
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
6709
|
+
},
|
|
6710
|
+
getFloat64LE: isBigEndian
|
|
6711
|
+
? (source, offset) => {
|
|
6712
|
+
FLOAT_BYTES[7] = source[offset];
|
|
6713
|
+
FLOAT_BYTES[6] = source[offset + 1];
|
|
6714
|
+
FLOAT_BYTES[5] = source[offset + 2];
|
|
6715
|
+
FLOAT_BYTES[4] = source[offset + 3];
|
|
6716
|
+
FLOAT_BYTES[3] = source[offset + 4];
|
|
6717
|
+
FLOAT_BYTES[2] = source[offset + 5];
|
|
6718
|
+
FLOAT_BYTES[1] = source[offset + 6];
|
|
6719
|
+
FLOAT_BYTES[0] = source[offset + 7];
|
|
6720
|
+
return FLOAT[0];
|
|
6721
|
+
}
|
|
6722
|
+
: (source, offset) => {
|
|
6723
|
+
FLOAT_BYTES[0] = source[offset];
|
|
6724
|
+
FLOAT_BYTES[1] = source[offset + 1];
|
|
6725
|
+
FLOAT_BYTES[2] = source[offset + 2];
|
|
6726
|
+
FLOAT_BYTES[3] = source[offset + 3];
|
|
6727
|
+
FLOAT_BYTES[4] = source[offset + 4];
|
|
6728
|
+
FLOAT_BYTES[5] = source[offset + 5];
|
|
6729
|
+
FLOAT_BYTES[6] = source[offset + 6];
|
|
6730
|
+
FLOAT_BYTES[7] = source[offset + 7];
|
|
6731
|
+
return FLOAT[0];
|
|
6732
|
+
},
|
|
6733
|
+
setInt32BE(destination, offset, value) {
|
|
6734
|
+
destination[offset + 3] = value;
|
|
6735
|
+
value >>>= 8;
|
|
6736
|
+
destination[offset + 2] = value;
|
|
6737
|
+
value >>>= 8;
|
|
6738
|
+
destination[offset + 1] = value;
|
|
6739
|
+
value >>>= 8;
|
|
6740
|
+
destination[offset] = value;
|
|
6741
|
+
return 4;
|
|
6742
|
+
},
|
|
6743
|
+
setInt32LE(destination, offset, value) {
|
|
6744
|
+
destination[offset] = value;
|
|
6745
|
+
value >>>= 8;
|
|
6746
|
+
destination[offset + 1] = value;
|
|
6747
|
+
value >>>= 8;
|
|
6748
|
+
destination[offset + 2] = value;
|
|
6749
|
+
value >>>= 8;
|
|
6750
|
+
destination[offset + 3] = value;
|
|
6751
|
+
return 4;
|
|
6752
|
+
},
|
|
6753
|
+
setBigInt64LE(destination, offset, value) {
|
|
6754
|
+
const mask32bits = BigInt(0xffff_ffff);
|
|
6755
|
+
let lo = Number(value & mask32bits);
|
|
6756
|
+
destination[offset] = lo;
|
|
6757
|
+
lo >>= 8;
|
|
6758
|
+
destination[offset + 1] = lo;
|
|
6759
|
+
lo >>= 8;
|
|
6760
|
+
destination[offset + 2] = lo;
|
|
6761
|
+
lo >>= 8;
|
|
6762
|
+
destination[offset + 3] = lo;
|
|
6763
|
+
let hi = Number((value >> BigInt(32)) & mask32bits);
|
|
6764
|
+
destination[offset + 4] = hi;
|
|
6765
|
+
hi >>= 8;
|
|
6766
|
+
destination[offset + 5] = hi;
|
|
6767
|
+
hi >>= 8;
|
|
6768
|
+
destination[offset + 6] = hi;
|
|
6769
|
+
hi >>= 8;
|
|
6770
|
+
destination[offset + 7] = hi;
|
|
6771
|
+
return 8;
|
|
6772
|
+
},
|
|
6773
|
+
setFloat64LE: isBigEndian
|
|
6774
|
+
? (destination, offset, value) => {
|
|
6775
|
+
FLOAT[0] = value;
|
|
6776
|
+
destination[offset] = FLOAT_BYTES[7];
|
|
6777
|
+
destination[offset + 1] = FLOAT_BYTES[6];
|
|
6778
|
+
destination[offset + 2] = FLOAT_BYTES[5];
|
|
6779
|
+
destination[offset + 3] = FLOAT_BYTES[4];
|
|
6780
|
+
destination[offset + 4] = FLOAT_BYTES[3];
|
|
6781
|
+
destination[offset + 5] = FLOAT_BYTES[2];
|
|
6782
|
+
destination[offset + 6] = FLOAT_BYTES[1];
|
|
6783
|
+
destination[offset + 7] = FLOAT_BYTES[0];
|
|
6784
|
+
return 8;
|
|
6785
|
+
}
|
|
6786
|
+
: (destination, offset, value) => {
|
|
6787
|
+
FLOAT[0] = value;
|
|
6788
|
+
destination[offset] = FLOAT_BYTES[0];
|
|
6789
|
+
destination[offset + 1] = FLOAT_BYTES[1];
|
|
6790
|
+
destination[offset + 2] = FLOAT_BYTES[2];
|
|
6791
|
+
destination[offset + 3] = FLOAT_BYTES[3];
|
|
6792
|
+
destination[offset + 4] = FLOAT_BYTES[4];
|
|
6793
|
+
destination[offset + 5] = FLOAT_BYTES[5];
|
|
6794
|
+
destination[offset + 6] = FLOAT_BYTES[6];
|
|
6795
|
+
destination[offset + 7] = FLOAT_BYTES[7];
|
|
6796
|
+
return 8;
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6799
|
+
|
|
6534
6800
|
class Binary extends BSONValue {
|
|
6535
6801
|
get _bsontype() {
|
|
6536
6802
|
return 'Binary';
|
|
@@ -6603,7 +6869,8 @@ class Binary extends BSONValue {
|
|
|
6603
6869
|
}
|
|
6604
6870
|
read(position, length) {
|
|
6605
6871
|
length = length && length > 0 ? length : this.position;
|
|
6606
|
-
|
|
6872
|
+
const end = position + length;
|
|
6873
|
+
return this.buffer.subarray(position, end > this.position ? this.position : end);
|
|
6607
6874
|
}
|
|
6608
6875
|
value() {
|
|
6609
6876
|
return this.buffer.length === this.position
|
|
@@ -6627,6 +6894,9 @@ class Binary extends BSONValue {
|
|
|
6627
6894
|
}
|
|
6628
6895
|
toExtendedJSON(options) {
|
|
6629
6896
|
options = options || {};
|
|
6897
|
+
if (this.sub_type === Binary.SUBTYPE_VECTOR) {
|
|
6898
|
+
validateBinaryVector(this);
|
|
6899
|
+
}
|
|
6630
6900
|
const base64String = ByteUtils.toBase64(this.buffer);
|
|
6631
6901
|
const subType = Number(this.sub_type).toString(16);
|
|
6632
6902
|
if (options.legacy) {
|
|
@@ -6644,7 +6914,7 @@ class Binary extends BSONValue {
|
|
|
6644
6914
|
}
|
|
6645
6915
|
toUUID() {
|
|
6646
6916
|
if (this.sub_type === Binary.SUBTYPE_UUID) {
|
|
6647
|
-
return new UUID(this.buffer.
|
|
6917
|
+
return new UUID(this.buffer.subarray(0, this.position));
|
|
6648
6918
|
}
|
|
6649
6919
|
throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
|
|
6650
6920
|
}
|
|
@@ -6686,6 +6956,99 @@ class Binary extends BSONValue {
|
|
|
6686
6956
|
const subTypeArg = inspect(this.sub_type, options);
|
|
6687
6957
|
return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
|
|
6688
6958
|
}
|
|
6959
|
+
toInt8Array() {
|
|
6960
|
+
if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
|
|
6961
|
+
throw new BSONError('Binary sub_type is not Vector');
|
|
6962
|
+
}
|
|
6963
|
+
if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
|
|
6964
|
+
throw new BSONError('Binary datatype field is not Int8');
|
|
6965
|
+
}
|
|
6966
|
+
return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
|
|
6967
|
+
}
|
|
6968
|
+
toFloat32Array() {
|
|
6969
|
+
if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
|
|
6970
|
+
throw new BSONError('Binary sub_type is not Vector');
|
|
6971
|
+
}
|
|
6972
|
+
if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
|
|
6973
|
+
throw new BSONError('Binary datatype field is not Float32');
|
|
6974
|
+
}
|
|
6975
|
+
const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
|
|
6976
|
+
if (NumberUtils.isBigEndian)
|
|
6977
|
+
ByteUtils.swap32(floatBytes);
|
|
6978
|
+
return new Float32Array(floatBytes.buffer);
|
|
6979
|
+
}
|
|
6980
|
+
toPackedBits() {
|
|
6981
|
+
if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
|
|
6982
|
+
throw new BSONError('Binary sub_type is not Vector');
|
|
6983
|
+
}
|
|
6984
|
+
if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
|
|
6985
|
+
throw new BSONError('Binary datatype field is not packed bit');
|
|
6986
|
+
}
|
|
6987
|
+
return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
|
|
6988
|
+
}
|
|
6989
|
+
toBits() {
|
|
6990
|
+
if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
|
|
6991
|
+
throw new BSONError('Binary sub_type is not Vector');
|
|
6992
|
+
}
|
|
6993
|
+
if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
|
|
6994
|
+
throw new BSONError('Binary datatype field is not packed bit');
|
|
6995
|
+
}
|
|
6996
|
+
const byteCount = this.length() - 2;
|
|
6997
|
+
const bitCount = byteCount * 8 - this.buffer[1];
|
|
6998
|
+
const bits = new Int8Array(bitCount);
|
|
6999
|
+
for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
|
|
7000
|
+
const byteOffset = (bitOffset / 8) | 0;
|
|
7001
|
+
const byte = this.buffer[byteOffset + 2];
|
|
7002
|
+
const shift = 7 - (bitOffset % 8);
|
|
7003
|
+
const bit = (byte >> shift) & 1;
|
|
7004
|
+
bits[bitOffset] = bit;
|
|
7005
|
+
}
|
|
7006
|
+
return bits;
|
|
7007
|
+
}
|
|
7008
|
+
static fromInt8Array(array) {
|
|
7009
|
+
const buffer = ByteUtils.allocate(array.byteLength + 2);
|
|
7010
|
+
buffer[0] = Binary.VECTOR_TYPE.Int8;
|
|
7011
|
+
buffer[1] = 0;
|
|
7012
|
+
const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
7013
|
+
buffer.set(intBytes, 2);
|
|
7014
|
+
return new this(buffer, this.SUBTYPE_VECTOR);
|
|
7015
|
+
}
|
|
7016
|
+
static fromFloat32Array(array) {
|
|
7017
|
+
const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
|
|
7018
|
+
binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
|
|
7019
|
+
binaryBytes[1] = 0;
|
|
7020
|
+
const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
7021
|
+
binaryBytes.set(floatBytes, 2);
|
|
7022
|
+
if (NumberUtils.isBigEndian)
|
|
7023
|
+
ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
|
|
7024
|
+
return new this(binaryBytes, this.SUBTYPE_VECTOR);
|
|
7025
|
+
}
|
|
7026
|
+
static fromPackedBits(array, padding = 0) {
|
|
7027
|
+
const buffer = ByteUtils.allocate(array.byteLength + 2);
|
|
7028
|
+
buffer[0] = Binary.VECTOR_TYPE.PackedBit;
|
|
7029
|
+
buffer[1] = padding;
|
|
7030
|
+
buffer.set(array, 2);
|
|
7031
|
+
return new this(buffer, this.SUBTYPE_VECTOR);
|
|
7032
|
+
}
|
|
7033
|
+
static fromBits(bits) {
|
|
7034
|
+
const byteLength = (bits.length + 7) >>> 3;
|
|
7035
|
+
const bytes = new Uint8Array(byteLength + 2);
|
|
7036
|
+
bytes[0] = Binary.VECTOR_TYPE.PackedBit;
|
|
7037
|
+
const remainder = bits.length % 8;
|
|
7038
|
+
bytes[1] = remainder === 0 ? 0 : 8 - remainder;
|
|
7039
|
+
for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
|
|
7040
|
+
const byteOffset = bitOffset >>> 3;
|
|
7041
|
+
const bit = bits[bitOffset];
|
|
7042
|
+
if (bit !== 0 && bit !== 1) {
|
|
7043
|
+
throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
|
|
7044
|
+
}
|
|
7045
|
+
if (bit === 0)
|
|
7046
|
+
continue;
|
|
7047
|
+
const shift = 7 - (bitOffset % 8);
|
|
7048
|
+
bytes[byteOffset + 2] |= bit << shift;
|
|
7049
|
+
}
|
|
7050
|
+
return new this(bytes, Binary.SUBTYPE_VECTOR);
|
|
7051
|
+
}
|
|
6689
7052
|
}
|
|
6690
7053
|
Binary.BSON_BINARY_SUBTYPE_DEFAULT = 0;
|
|
6691
7054
|
Binary.BUFFER_SIZE = 256;
|
|
@@ -6698,7 +7061,30 @@ Binary.SUBTYPE_MD5 = 5;
|
|
|
6698
7061
|
Binary.SUBTYPE_ENCRYPTED = 6;
|
|
6699
7062
|
Binary.SUBTYPE_COLUMN = 7;
|
|
6700
7063
|
Binary.SUBTYPE_SENSITIVE = 8;
|
|
7064
|
+
Binary.SUBTYPE_VECTOR = 9;
|
|
6701
7065
|
Binary.SUBTYPE_USER_DEFINED = 128;
|
|
7066
|
+
Binary.VECTOR_TYPE = Object.freeze({
|
|
7067
|
+
Int8: 0x03,
|
|
7068
|
+
Float32: 0x27,
|
|
7069
|
+
PackedBit: 0x10
|
|
7070
|
+
});
|
|
7071
|
+
function validateBinaryVector(vector) {
|
|
7072
|
+
if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
|
|
7073
|
+
return;
|
|
7074
|
+
const size = vector.position;
|
|
7075
|
+
const datatype = vector.buffer[0];
|
|
7076
|
+
const padding = vector.buffer[1];
|
|
7077
|
+
if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
|
|
7078
|
+
padding !== 0) {
|
|
7079
|
+
throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
|
|
7080
|
+
}
|
|
7081
|
+
if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
|
|
7082
|
+
throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
|
|
7083
|
+
}
|
|
7084
|
+
if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
|
|
7085
|
+
throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
6702
7088
|
const UUID_BYTE_LENGTH = 16;
|
|
6703
7089
|
const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
|
|
6704
7090
|
const UUID_WITH_DASHES = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
|
|
@@ -6967,19 +7353,18 @@ class Long extends BSONValue {
|
|
|
6967
7353
|
get __isLong__() {
|
|
6968
7354
|
return true;
|
|
6969
7355
|
}
|
|
6970
|
-
constructor(
|
|
7356
|
+
constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
|
|
6971
7357
|
super();
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
}
|
|
7358
|
+
const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
|
|
7359
|
+
const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
|
|
7360
|
+
const res = typeof lowOrValue === 'string'
|
|
7361
|
+
? Long.fromString(lowOrValue, unsignedBool)
|
|
7362
|
+
: typeof lowOrValue === 'bigint'
|
|
7363
|
+
? Long.fromBigInt(lowOrValue, unsignedBool)
|
|
7364
|
+
: { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
|
|
7365
|
+
this.low = res.low;
|
|
7366
|
+
this.high = res.high;
|
|
7367
|
+
this.unsigned = res.unsigned;
|
|
6983
7368
|
}
|
|
6984
7369
|
static fromBits(lowBits, highBits, unsigned) {
|
|
6985
7370
|
return new Long(lowBits, highBits, unsigned);
|
|
@@ -7031,7 +7416,9 @@ class Long extends BSONValue {
|
|
|
7031
7416
|
return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
|
|
7032
7417
|
}
|
|
7033
7418
|
static fromBigInt(value, unsigned) {
|
|
7034
|
-
|
|
7419
|
+
const FROM_BIGINT_BIT_MASK = BigInt(0xffffffff);
|
|
7420
|
+
const FROM_BIGINT_BIT_SHIFT = BigInt(32);
|
|
7421
|
+
return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
|
|
7035
7422
|
}
|
|
7036
7423
|
static _fromString(str, unsigned, radix) {
|
|
7037
7424
|
if (str.length === 0)
|
|
@@ -7699,7 +8086,7 @@ class Decimal128 extends BSONValue {
|
|
|
7699
8086
|
if (typeof bytes === 'string') {
|
|
7700
8087
|
this.bytes = Decimal128.fromString(bytes).bytes;
|
|
7701
8088
|
}
|
|
7702
|
-
else if (isUint8Array(bytes)) {
|
|
8089
|
+
else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
|
|
7703
8090
|
if (bytes.byteLength !== 16) {
|
|
7704
8091
|
throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
|
|
7705
8092
|
}
|
|
@@ -8309,152 +8696,25 @@ class MinKey extends BSONValue {
|
|
|
8309
8696
|
}
|
|
8310
8697
|
}
|
|
8311
8698
|
|
|
8312
|
-
|
|
8313
|
-
const
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
(
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
},
|
|
8332
|
-
getUint32LE(source, offset) {
|
|
8333
|
-
return (source[offset] +
|
|
8334
|
-
source[offset + 1] * 256 +
|
|
8335
|
-
source[offset + 2] * 65536 +
|
|
8336
|
-
source[offset + 3] * 16777216);
|
|
8337
|
-
},
|
|
8338
|
-
getUint32BE(source, offset) {
|
|
8339
|
-
return (source[offset + 3] +
|
|
8340
|
-
source[offset + 2] * 256 +
|
|
8341
|
-
source[offset + 1] * 65536 +
|
|
8342
|
-
source[offset] * 16777216);
|
|
8343
|
-
},
|
|
8344
|
-
getBigInt64LE(source, offset) {
|
|
8345
|
-
const lo = NumberUtils.getUint32LE(source, offset);
|
|
8346
|
-
const hi = NumberUtils.getUint32LE(source, offset + 4);
|
|
8347
|
-
return (BigInt(hi) << BigInt(32)) + BigInt(lo);
|
|
8348
|
-
},
|
|
8349
|
-
getFloat64LE: isBigEndian
|
|
8350
|
-
? (source, offset) => {
|
|
8351
|
-
FLOAT_BYTES[7] = source[offset];
|
|
8352
|
-
FLOAT_BYTES[6] = source[offset + 1];
|
|
8353
|
-
FLOAT_BYTES[5] = source[offset + 2];
|
|
8354
|
-
FLOAT_BYTES[4] = source[offset + 3];
|
|
8355
|
-
FLOAT_BYTES[3] = source[offset + 4];
|
|
8356
|
-
FLOAT_BYTES[2] = source[offset + 5];
|
|
8357
|
-
FLOAT_BYTES[1] = source[offset + 6];
|
|
8358
|
-
FLOAT_BYTES[0] = source[offset + 7];
|
|
8359
|
-
return FLOAT[0];
|
|
8360
|
-
}
|
|
8361
|
-
: (source, offset) => {
|
|
8362
|
-
FLOAT_BYTES[0] = source[offset];
|
|
8363
|
-
FLOAT_BYTES[1] = source[offset + 1];
|
|
8364
|
-
FLOAT_BYTES[2] = source[offset + 2];
|
|
8365
|
-
FLOAT_BYTES[3] = source[offset + 3];
|
|
8366
|
-
FLOAT_BYTES[4] = source[offset + 4];
|
|
8367
|
-
FLOAT_BYTES[5] = source[offset + 5];
|
|
8368
|
-
FLOAT_BYTES[6] = source[offset + 6];
|
|
8369
|
-
FLOAT_BYTES[7] = source[offset + 7];
|
|
8370
|
-
return FLOAT[0];
|
|
8371
|
-
},
|
|
8372
|
-
setInt32BE(destination, offset, value) {
|
|
8373
|
-
destination[offset + 3] = value;
|
|
8374
|
-
value >>>= 8;
|
|
8375
|
-
destination[offset + 2] = value;
|
|
8376
|
-
value >>>= 8;
|
|
8377
|
-
destination[offset + 1] = value;
|
|
8378
|
-
value >>>= 8;
|
|
8379
|
-
destination[offset] = value;
|
|
8380
|
-
return 4;
|
|
8381
|
-
},
|
|
8382
|
-
setInt32LE(destination, offset, value) {
|
|
8383
|
-
destination[offset] = value;
|
|
8384
|
-
value >>>= 8;
|
|
8385
|
-
destination[offset + 1] = value;
|
|
8386
|
-
value >>>= 8;
|
|
8387
|
-
destination[offset + 2] = value;
|
|
8388
|
-
value >>>= 8;
|
|
8389
|
-
destination[offset + 3] = value;
|
|
8390
|
-
return 4;
|
|
8391
|
-
},
|
|
8392
|
-
setBigInt64LE(destination, offset, value) {
|
|
8393
|
-
const mask32bits = BigInt(4294967295);
|
|
8394
|
-
let lo = Number(value & mask32bits);
|
|
8395
|
-
destination[offset] = lo;
|
|
8396
|
-
lo >>= 8;
|
|
8397
|
-
destination[offset + 1] = lo;
|
|
8398
|
-
lo >>= 8;
|
|
8399
|
-
destination[offset + 2] = lo;
|
|
8400
|
-
lo >>= 8;
|
|
8401
|
-
destination[offset + 3] = lo;
|
|
8402
|
-
let hi = Number((value >> BigInt(32)) & mask32bits);
|
|
8403
|
-
destination[offset + 4] = hi;
|
|
8404
|
-
hi >>= 8;
|
|
8405
|
-
destination[offset + 5] = hi;
|
|
8406
|
-
hi >>= 8;
|
|
8407
|
-
destination[offset + 6] = hi;
|
|
8408
|
-
hi >>= 8;
|
|
8409
|
-
destination[offset + 7] = hi;
|
|
8410
|
-
return 8;
|
|
8411
|
-
},
|
|
8412
|
-
setFloat64LE: isBigEndian
|
|
8413
|
-
? (destination, offset, value) => {
|
|
8414
|
-
FLOAT[0] = value;
|
|
8415
|
-
destination[offset] = FLOAT_BYTES[7];
|
|
8416
|
-
destination[offset + 1] = FLOAT_BYTES[6];
|
|
8417
|
-
destination[offset + 2] = FLOAT_BYTES[5];
|
|
8418
|
-
destination[offset + 3] = FLOAT_BYTES[4];
|
|
8419
|
-
destination[offset + 4] = FLOAT_BYTES[3];
|
|
8420
|
-
destination[offset + 5] = FLOAT_BYTES[2];
|
|
8421
|
-
destination[offset + 6] = FLOAT_BYTES[1];
|
|
8422
|
-
destination[offset + 7] = FLOAT_BYTES[0];
|
|
8423
|
-
return 8;
|
|
8424
|
-
}
|
|
8425
|
-
: (destination, offset, value) => {
|
|
8426
|
-
FLOAT[0] = value;
|
|
8427
|
-
destination[offset] = FLOAT_BYTES[0];
|
|
8428
|
-
destination[offset + 1] = FLOAT_BYTES[1];
|
|
8429
|
-
destination[offset + 2] = FLOAT_BYTES[2];
|
|
8430
|
-
destination[offset + 3] = FLOAT_BYTES[3];
|
|
8431
|
-
destination[offset + 4] = FLOAT_BYTES[4];
|
|
8432
|
-
destination[offset + 5] = FLOAT_BYTES[5];
|
|
8433
|
-
destination[offset + 6] = FLOAT_BYTES[6];
|
|
8434
|
-
destination[offset + 7] = FLOAT_BYTES[7];
|
|
8435
|
-
return 8;
|
|
8436
|
-
}
|
|
8437
|
-
};
|
|
8438
|
-
|
|
8439
|
-
const checkForHexRegExp = new RegExp('^[0-9a-fA-F]{24}$');
|
|
8440
|
-
let PROCESS_UNIQUE = null;
|
|
8441
|
-
class ObjectId extends BSONValue {
|
|
8442
|
-
get _bsontype() {
|
|
8443
|
-
return 'ObjectId';
|
|
8444
|
-
}
|
|
8445
|
-
constructor(inputId) {
|
|
8446
|
-
super();
|
|
8447
|
-
let workingId;
|
|
8448
|
-
if (typeof inputId === 'object' && inputId && 'id' in inputId) {
|
|
8449
|
-
if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
|
|
8450
|
-
throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
|
|
8451
|
-
}
|
|
8452
|
-
if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
|
|
8453
|
-
workingId = ByteUtils.fromHex(inputId.toHexString());
|
|
8454
|
-
}
|
|
8455
|
-
else {
|
|
8456
|
-
workingId = inputId.id;
|
|
8457
|
-
}
|
|
8699
|
+
let PROCESS_UNIQUE = null;
|
|
8700
|
+
const __idCache = new WeakMap();
|
|
8701
|
+
class ObjectId extends BSONValue {
|
|
8702
|
+
get _bsontype() {
|
|
8703
|
+
return 'ObjectId';
|
|
8704
|
+
}
|
|
8705
|
+
constructor(inputId) {
|
|
8706
|
+
super();
|
|
8707
|
+
let workingId;
|
|
8708
|
+
if (typeof inputId === 'object' && inputId && 'id' in inputId) {
|
|
8709
|
+
if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
|
|
8710
|
+
throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
|
|
8711
|
+
}
|
|
8712
|
+
if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
|
|
8713
|
+
workingId = ByteUtils.fromHex(inputId.toHexString());
|
|
8714
|
+
}
|
|
8715
|
+
else {
|
|
8716
|
+
workingId = inputId.id;
|
|
8717
|
+
}
|
|
8458
8718
|
}
|
|
8459
8719
|
else {
|
|
8460
8720
|
workingId = inputId;
|
|
@@ -8466,8 +8726,11 @@ class ObjectId extends BSONValue {
|
|
|
8466
8726
|
this.buffer = ByteUtils.toLocalBufferType(workingId);
|
|
8467
8727
|
}
|
|
8468
8728
|
else if (typeof workingId === 'string') {
|
|
8469
|
-
if (
|
|
8729
|
+
if (ObjectId.validateHexString(workingId)) {
|
|
8470
8730
|
this.buffer = ByteUtils.fromHex(workingId);
|
|
8731
|
+
if (ObjectId.cacheHexString) {
|
|
8732
|
+
__idCache.set(this, workingId);
|
|
8733
|
+
}
|
|
8471
8734
|
}
|
|
8472
8735
|
else {
|
|
8473
8736
|
throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
|
|
@@ -8476,9 +8739,6 @@ class ObjectId extends BSONValue {
|
|
|
8476
8739
|
else {
|
|
8477
8740
|
throw new BSONError('Argument passed in does not match the accepted types');
|
|
8478
8741
|
}
|
|
8479
|
-
if (ObjectId.cacheHexString) {
|
|
8480
|
-
this.__id = ByteUtils.toHex(this.id);
|
|
8481
|
-
}
|
|
8482
8742
|
}
|
|
8483
8743
|
get id() {
|
|
8484
8744
|
return this.buffer;
|
|
@@ -8486,16 +8746,32 @@ class ObjectId extends BSONValue {
|
|
|
8486
8746
|
set id(value) {
|
|
8487
8747
|
this.buffer = value;
|
|
8488
8748
|
if (ObjectId.cacheHexString) {
|
|
8489
|
-
this
|
|
8749
|
+
__idCache.set(this, ByteUtils.toHex(value));
|
|
8490
8750
|
}
|
|
8491
8751
|
}
|
|
8752
|
+
static validateHexString(string) {
|
|
8753
|
+
if (string?.length !== 24)
|
|
8754
|
+
return false;
|
|
8755
|
+
for (let i = 0; i < 24; i++) {
|
|
8756
|
+
const char = string.charCodeAt(i);
|
|
8757
|
+
if ((char >= 48 && char <= 57) ||
|
|
8758
|
+
(char >= 97 && char <= 102) ||
|
|
8759
|
+
(char >= 65 && char <= 70)) {
|
|
8760
|
+
continue;
|
|
8761
|
+
}
|
|
8762
|
+
return false;
|
|
8763
|
+
}
|
|
8764
|
+
return true;
|
|
8765
|
+
}
|
|
8492
8766
|
toHexString() {
|
|
8493
|
-
if (ObjectId.cacheHexString
|
|
8494
|
-
|
|
8767
|
+
if (ObjectId.cacheHexString) {
|
|
8768
|
+
const __id = __idCache.get(this);
|
|
8769
|
+
if (__id)
|
|
8770
|
+
return __id;
|
|
8495
8771
|
}
|
|
8496
8772
|
const hexString = ByteUtils.toHex(this.id);
|
|
8497
|
-
if (ObjectId.cacheHexString
|
|
8498
|
-
this
|
|
8773
|
+
if (ObjectId.cacheHexString) {
|
|
8774
|
+
__idCache.set(this, hexString);
|
|
8499
8775
|
}
|
|
8500
8776
|
return hexString;
|
|
8501
8777
|
}
|
|
@@ -8601,6 +8877,8 @@ class ObjectId extends BSONValue {
|
|
|
8601
8877
|
static isValid(id) {
|
|
8602
8878
|
if (id == null)
|
|
8603
8879
|
return false;
|
|
8880
|
+
if (typeof id === 'string')
|
|
8881
|
+
return ObjectId.validateHexString(id);
|
|
8604
8882
|
try {
|
|
8605
8883
|
new ObjectId(id);
|
|
8606
8884
|
return true;
|
|
@@ -8617,6 +8895,9 @@ class ObjectId extends BSONValue {
|
|
|
8617
8895
|
static fromExtendedJSON(doc) {
|
|
8618
8896
|
return new ObjectId(doc.$oid);
|
|
8619
8897
|
}
|
|
8898
|
+
isCached() {
|
|
8899
|
+
return ObjectId.cacheHexString && __idCache.has(this);
|
|
8900
|
+
}
|
|
8620
8901
|
inspect(depth, options, inspect) {
|
|
8621
8902
|
inspect ??= defaultInspect;
|
|
8622
8903
|
return `new ObjectId(${inspect(this.toHexString(), options)})`;
|
|
@@ -8671,7 +8952,7 @@ function calculateElement(name, value, serializeFunctions = false, isArray = fal
|
|
|
8671
8952
|
case 'object':
|
|
8672
8953
|
if (value != null &&
|
|
8673
8954
|
typeof value._bsontype === 'string' &&
|
|
8674
|
-
value[
|
|
8955
|
+
value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
|
|
8675
8956
|
throw new BSONVersionError();
|
|
8676
8957
|
}
|
|
8677
8958
|
else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
@@ -8875,6 +9156,12 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
8875
9156
|
get _bsontype() {
|
|
8876
9157
|
return 'Timestamp';
|
|
8877
9158
|
}
|
|
9159
|
+
get i() {
|
|
9160
|
+
return this.low >>> 0;
|
|
9161
|
+
}
|
|
9162
|
+
get t() {
|
|
9163
|
+
return this.high >>> 0;
|
|
9164
|
+
}
|
|
8878
9165
|
constructor(low) {
|
|
8879
9166
|
if (low == null) {
|
|
8880
9167
|
super(0, 0, true);
|
|
@@ -8900,10 +9187,10 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
8900
9187
|
if (i < 0 || Number.isNaN(i)) {
|
|
8901
9188
|
throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
|
|
8902
9189
|
}
|
|
8903
|
-
if (t >
|
|
9190
|
+
if (t > 0xffff_ffff) {
|
|
8904
9191
|
throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
|
|
8905
9192
|
}
|
|
8906
|
-
if (i >
|
|
9193
|
+
if (i > 0xffff_ffff) {
|
|
8907
9194
|
throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
|
|
8908
9195
|
}
|
|
8909
9196
|
super(i, t, true);
|
|
@@ -8930,7 +9217,7 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
8930
9217
|
return new Timestamp(Long.fromString(str, true, optRadix));
|
|
8931
9218
|
}
|
|
8932
9219
|
toExtendedJSON() {
|
|
8933
|
-
return { $timestamp: { t: this.
|
|
9220
|
+
return { $timestamp: { t: this.t, i: this.i } };
|
|
8934
9221
|
}
|
|
8935
9222
|
static fromExtendedJSON(doc) {
|
|
8936
9223
|
const i = Long.isLong(doc.$timestamp.i)
|
|
@@ -8943,8 +9230,8 @@ class Timestamp extends LongWithoutOverridesClass {
|
|
|
8943
9230
|
}
|
|
8944
9231
|
inspect(depth, options, inspect) {
|
|
8945
9232
|
inspect ??= defaultInspect;
|
|
8946
|
-
const t = inspect(this.
|
|
8947
|
-
const i = inspect(this.
|
|
9233
|
+
const t = inspect(this.t, options);
|
|
9234
|
+
const i = inspect(this.i, options);
|
|
8948
9235
|
return `new Timestamp({ t: ${t}, i: ${i} })`;
|
|
8949
9236
|
}
|
|
8950
9237
|
}
|
|
@@ -9101,7 +9388,7 @@ function deserializeObject(buffer, index, options, isArray = false) {
|
|
|
9101
9388
|
if (objectSize <= 0 || objectSize > buffer.length - index)
|
|
9102
9389
|
throw new BSONError('bad embedded document length in bson');
|
|
9103
9390
|
if (raw) {
|
|
9104
|
-
value = buffer.
|
|
9391
|
+
value = buffer.subarray(index, index + objectSize);
|
|
9105
9392
|
}
|
|
9106
9393
|
else {
|
|
9107
9394
|
let objectOptions = options;
|
|
@@ -9173,49 +9460,23 @@ function deserializeObject(buffer, index, options, isArray = false) {
|
|
|
9173
9460
|
throw new BSONError('Negative binary type element size found');
|
|
9174
9461
|
if (binarySize > buffer.byteLength)
|
|
9175
9462
|
throw new BSONError('Binary type size larger than document size');
|
|
9176
|
-
if (
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
value = ByteUtils.toLocalBufferType(buffer.slice(index, index + binarySize));
|
|
9189
|
-
}
|
|
9190
|
-
else {
|
|
9191
|
-
value = new Binary(buffer.slice(index, index + binarySize), subType);
|
|
9192
|
-
if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
|
|
9193
|
-
value = value.toUUID();
|
|
9194
|
-
}
|
|
9195
|
-
}
|
|
9463
|
+
if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
|
|
9464
|
+
binarySize = NumberUtils.getInt32LE(buffer, index);
|
|
9465
|
+
index += 4;
|
|
9466
|
+
if (binarySize < 0)
|
|
9467
|
+
throw new BSONError('Negative binary type element size found for subtype 0x02');
|
|
9468
|
+
if (binarySize > totalBinarySize - 4)
|
|
9469
|
+
throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
|
|
9470
|
+
if (binarySize < totalBinarySize - 4)
|
|
9471
|
+
throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
|
|
9472
|
+
}
|
|
9473
|
+
if (promoteBuffers && promoteValues) {
|
|
9474
|
+
value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
|
|
9196
9475
|
}
|
|
9197
9476
|
else {
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
if (binarySize < 0)
|
|
9202
|
-
throw new BSONError('Negative binary type element size found for subtype 0x02');
|
|
9203
|
-
if (binarySize > totalBinarySize - 4)
|
|
9204
|
-
throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
|
|
9205
|
-
if (binarySize < totalBinarySize - 4)
|
|
9206
|
-
throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
|
|
9207
|
-
}
|
|
9208
|
-
if (promoteBuffers && promoteValues) {
|
|
9209
|
-
value = ByteUtils.allocateUnsafe(binarySize);
|
|
9210
|
-
for (i = 0; i < binarySize; i++) {
|
|
9211
|
-
value[i] = buffer[index + i];
|
|
9212
|
-
}
|
|
9213
|
-
}
|
|
9214
|
-
else {
|
|
9215
|
-
value = new Binary(buffer.slice(index, index + binarySize), subType);
|
|
9216
|
-
if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
|
|
9217
|
-
value = value.toUUID();
|
|
9218
|
-
}
|
|
9477
|
+
value = new Binary(buffer.subarray(index, index + binarySize), subType);
|
|
9478
|
+
if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
|
|
9479
|
+
value = value.toUUID();
|
|
9219
9480
|
}
|
|
9220
9481
|
}
|
|
9221
9482
|
index = index + binarySize;
|
|
@@ -9637,6 +9898,9 @@ function serializeBinary(buffer, key, value, index) {
|
|
|
9637
9898
|
size = size - 4;
|
|
9638
9899
|
index += NumberUtils.setInt32LE(buffer, index, size);
|
|
9639
9900
|
}
|
|
9901
|
+
if (value.sub_type === Binary.SUBTYPE_VECTOR) {
|
|
9902
|
+
validateBinaryVector(value);
|
|
9903
|
+
}
|
|
9640
9904
|
if (size <= 16) {
|
|
9641
9905
|
for (let i = 0; i < size; i++)
|
|
9642
9906
|
buffer[index + i] = data[i];
|
|
@@ -9713,79 +9977,83 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
9713
9977
|
if (typeof value?.toBSON === 'function') {
|
|
9714
9978
|
value = value.toBSON();
|
|
9715
9979
|
}
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
}
|
|
9719
|
-
else if (typeof value === 'number') {
|
|
9720
|
-
index = serializeNumber(buffer, key, value, index);
|
|
9721
|
-
}
|
|
9722
|
-
else if (typeof value === 'bigint') {
|
|
9723
|
-
index = serializeBigInt(buffer, key, value, index);
|
|
9724
|
-
}
|
|
9725
|
-
else if (typeof value === 'boolean') {
|
|
9726
|
-
index = serializeBoolean(buffer, key, value, index);
|
|
9727
|
-
}
|
|
9728
|
-
else if (value instanceof Date || isDate(value)) {
|
|
9729
|
-
index = serializeDate(buffer, key, value, index);
|
|
9730
|
-
}
|
|
9731
|
-
else if (value === undefined) {
|
|
9980
|
+
const type = typeof value;
|
|
9981
|
+
if (value === undefined) {
|
|
9732
9982
|
index = serializeNull(buffer, key, value, index);
|
|
9733
9983
|
}
|
|
9734
9984
|
else if (value === null) {
|
|
9735
9985
|
index = serializeNull(buffer, key, value, index);
|
|
9736
9986
|
}
|
|
9737
|
-
else if (
|
|
9738
|
-
index =
|
|
9739
|
-
}
|
|
9740
|
-
else if (value instanceof RegExp || isRegExp(value)) {
|
|
9741
|
-
index = serializeRegExp(buffer, key, value, index);
|
|
9742
|
-
}
|
|
9743
|
-
else if (typeof value === 'object' && value._bsontype == null) {
|
|
9744
|
-
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
9987
|
+
else if (type === 'string') {
|
|
9988
|
+
index = serializeString(buffer, key, value, index);
|
|
9745
9989
|
}
|
|
9746
|
-
else if (
|
|
9747
|
-
|
|
9748
|
-
throw new BSONVersionError();
|
|
9990
|
+
else if (type === 'number') {
|
|
9991
|
+
index = serializeNumber(buffer, key, value, index);
|
|
9749
9992
|
}
|
|
9750
|
-
else if (
|
|
9751
|
-
index =
|
|
9993
|
+
else if (type === 'bigint') {
|
|
9994
|
+
index = serializeBigInt(buffer, key, value, index);
|
|
9752
9995
|
}
|
|
9753
|
-
else if (
|
|
9754
|
-
index =
|
|
9996
|
+
else if (type === 'boolean') {
|
|
9997
|
+
index = serializeBoolean(buffer, key, value, index);
|
|
9755
9998
|
}
|
|
9756
|
-
else if (
|
|
9757
|
-
|
|
9999
|
+
else if (type === 'object' && value._bsontype == null) {
|
|
10000
|
+
if (value instanceof Date || isDate(value)) {
|
|
10001
|
+
index = serializeDate(buffer, key, value, index);
|
|
10002
|
+
}
|
|
10003
|
+
else if (value instanceof Uint8Array || isUint8Array(value)) {
|
|
10004
|
+
index = serializeBuffer(buffer, key, value, index);
|
|
10005
|
+
}
|
|
10006
|
+
else if (value instanceof RegExp || isRegExp(value)) {
|
|
10007
|
+
index = serializeRegExp(buffer, key, value, index);
|
|
10008
|
+
}
|
|
10009
|
+
else {
|
|
10010
|
+
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10011
|
+
}
|
|
9758
10012
|
}
|
|
9759
|
-
else if (
|
|
9760
|
-
|
|
10013
|
+
else if (type === 'object') {
|
|
10014
|
+
if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
|
|
10015
|
+
throw new BSONVersionError();
|
|
10016
|
+
}
|
|
10017
|
+
else if (value._bsontype === 'ObjectId') {
|
|
10018
|
+
index = serializeObjectId(buffer, key, value, index);
|
|
10019
|
+
}
|
|
10020
|
+
else if (value._bsontype === 'Decimal128') {
|
|
10021
|
+
index = serializeDecimal128(buffer, key, value, index);
|
|
10022
|
+
}
|
|
10023
|
+
else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
|
|
10024
|
+
index = serializeLong(buffer, key, value, index);
|
|
10025
|
+
}
|
|
10026
|
+
else if (value._bsontype === 'Double') {
|
|
10027
|
+
index = serializeDouble(buffer, key, value, index);
|
|
10028
|
+
}
|
|
10029
|
+
else if (value._bsontype === 'Code') {
|
|
10030
|
+
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10031
|
+
}
|
|
10032
|
+
else if (value._bsontype === 'Binary') {
|
|
10033
|
+
index = serializeBinary(buffer, key, value, index);
|
|
10034
|
+
}
|
|
10035
|
+
else if (value._bsontype === 'BSONSymbol') {
|
|
10036
|
+
index = serializeSymbol(buffer, key, value, index);
|
|
10037
|
+
}
|
|
10038
|
+
else if (value._bsontype === 'DBRef') {
|
|
10039
|
+
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
10040
|
+
}
|
|
10041
|
+
else if (value._bsontype === 'BSONRegExp') {
|
|
10042
|
+
index = serializeBSONRegExp(buffer, key, value, index);
|
|
10043
|
+
}
|
|
10044
|
+
else if (value._bsontype === 'Int32') {
|
|
10045
|
+
index = serializeInt32(buffer, key, value, index);
|
|
10046
|
+
}
|
|
10047
|
+
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
10048
|
+
index = serializeMinMax(buffer, key, value, index);
|
|
10049
|
+
}
|
|
10050
|
+
else if (typeof value._bsontype !== 'undefined') {
|
|
10051
|
+
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
10052
|
+
}
|
|
9761
10053
|
}
|
|
9762
|
-
else if (
|
|
10054
|
+
else if (type === 'function' && serializeFunctions) {
|
|
9763
10055
|
index = serializeFunction(buffer, key, value, index);
|
|
9764
10056
|
}
|
|
9765
|
-
else if (value._bsontype === 'Code') {
|
|
9766
|
-
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
9767
|
-
}
|
|
9768
|
-
else if (value._bsontype === 'Binary') {
|
|
9769
|
-
index = serializeBinary(buffer, key, value, index);
|
|
9770
|
-
}
|
|
9771
|
-
else if (value._bsontype === 'BSONSymbol') {
|
|
9772
|
-
index = serializeSymbol(buffer, key, value, index);
|
|
9773
|
-
}
|
|
9774
|
-
else if (value._bsontype === 'DBRef') {
|
|
9775
|
-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
9776
|
-
}
|
|
9777
|
-
else if (value._bsontype === 'BSONRegExp') {
|
|
9778
|
-
index = serializeBSONRegExp(buffer, key, value, index);
|
|
9779
|
-
}
|
|
9780
|
-
else if (value._bsontype === 'Int32') {
|
|
9781
|
-
index = serializeInt32(buffer, key, value, index);
|
|
9782
|
-
}
|
|
9783
|
-
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
9784
|
-
index = serializeMinMax(buffer, key, value, index);
|
|
9785
|
-
}
|
|
9786
|
-
else if (typeof value._bsontype !== 'undefined') {
|
|
9787
|
-
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
9788
|
-
}
|
|
9789
10057
|
}
|
|
9790
10058
|
}
|
|
9791
10059
|
else if (object instanceof Map || isMap(object)) {
|
|
@@ -9815,7 +10083,14 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
9815
10083
|
}
|
|
9816
10084
|
}
|
|
9817
10085
|
}
|
|
9818
|
-
if (
|
|
10086
|
+
if (value === undefined) {
|
|
10087
|
+
if (ignoreUndefined === false)
|
|
10088
|
+
index = serializeNull(buffer, key, value, index);
|
|
10089
|
+
}
|
|
10090
|
+
else if (value === null) {
|
|
10091
|
+
index = serializeNull(buffer, key, value, index);
|
|
10092
|
+
}
|
|
10093
|
+
else if (type === 'string') {
|
|
9819
10094
|
index = serializeString(buffer, key, value, index);
|
|
9820
10095
|
}
|
|
9821
10096
|
else if (type === 'number') {
|
|
@@ -9827,64 +10102,64 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
9827
10102
|
else if (type === 'boolean') {
|
|
9828
10103
|
index = serializeBoolean(buffer, key, value, index);
|
|
9829
10104
|
}
|
|
9830
|
-
else if (value instanceof Date || isDate(value)) {
|
|
9831
|
-
index = serializeDate(buffer, key, value, index);
|
|
9832
|
-
}
|
|
9833
|
-
else if (value === null || (value === undefined && ignoreUndefined === false)) {
|
|
9834
|
-
index = serializeNull(buffer, key, value, index);
|
|
9835
|
-
}
|
|
9836
|
-
else if (isUint8Array(value)) {
|
|
9837
|
-
index = serializeBuffer(buffer, key, value, index);
|
|
9838
|
-
}
|
|
9839
|
-
else if (value instanceof RegExp || isRegExp(value)) {
|
|
9840
|
-
index = serializeRegExp(buffer, key, value, index);
|
|
9841
|
-
}
|
|
9842
10105
|
else if (type === 'object' && value._bsontype == null) {
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
value
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
|
|
9856
|
-
index = serializeLong(buffer, key, value, index);
|
|
9857
|
-
}
|
|
9858
|
-
else if (value._bsontype === 'Double') {
|
|
9859
|
-
index = serializeDouble(buffer, key, value, index);
|
|
10106
|
+
if (value instanceof Date || isDate(value)) {
|
|
10107
|
+
index = serializeDate(buffer, key, value, index);
|
|
10108
|
+
}
|
|
10109
|
+
else if (value instanceof Uint8Array || isUint8Array(value)) {
|
|
10110
|
+
index = serializeBuffer(buffer, key, value, index);
|
|
10111
|
+
}
|
|
10112
|
+
else if (value instanceof RegExp || isRegExp(value)) {
|
|
10113
|
+
index = serializeRegExp(buffer, key, value, index);
|
|
10114
|
+
}
|
|
10115
|
+
else {
|
|
10116
|
+
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10117
|
+
}
|
|
9860
10118
|
}
|
|
9861
|
-
else if (
|
|
9862
|
-
|
|
10119
|
+
else if (type === 'object') {
|
|
10120
|
+
if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
|
|
10121
|
+
throw new BSONVersionError();
|
|
10122
|
+
}
|
|
10123
|
+
else if (value._bsontype === 'ObjectId') {
|
|
10124
|
+
index = serializeObjectId(buffer, key, value, index);
|
|
10125
|
+
}
|
|
10126
|
+
else if (value._bsontype === 'Decimal128') {
|
|
10127
|
+
index = serializeDecimal128(buffer, key, value, index);
|
|
10128
|
+
}
|
|
10129
|
+
else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
|
|
10130
|
+
index = serializeLong(buffer, key, value, index);
|
|
10131
|
+
}
|
|
10132
|
+
else if (value._bsontype === 'Double') {
|
|
10133
|
+
index = serializeDouble(buffer, key, value, index);
|
|
10134
|
+
}
|
|
10135
|
+
else if (value._bsontype === 'Code') {
|
|
10136
|
+
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10137
|
+
}
|
|
10138
|
+
else if (value._bsontype === 'Binary') {
|
|
10139
|
+
index = serializeBinary(buffer, key, value, index);
|
|
10140
|
+
}
|
|
10141
|
+
else if (value._bsontype === 'BSONSymbol') {
|
|
10142
|
+
index = serializeSymbol(buffer, key, value, index);
|
|
10143
|
+
}
|
|
10144
|
+
else if (value._bsontype === 'DBRef') {
|
|
10145
|
+
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
10146
|
+
}
|
|
10147
|
+
else if (value._bsontype === 'BSONRegExp') {
|
|
10148
|
+
index = serializeBSONRegExp(buffer, key, value, index);
|
|
10149
|
+
}
|
|
10150
|
+
else if (value._bsontype === 'Int32') {
|
|
10151
|
+
index = serializeInt32(buffer, key, value, index);
|
|
10152
|
+
}
|
|
10153
|
+
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
10154
|
+
index = serializeMinMax(buffer, key, value, index);
|
|
10155
|
+
}
|
|
10156
|
+
else if (typeof value._bsontype !== 'undefined') {
|
|
10157
|
+
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
10158
|
+
}
|
|
9863
10159
|
}
|
|
9864
|
-
else if (
|
|
10160
|
+
else if (type === 'function' && serializeFunctions) {
|
|
9865
10161
|
index = serializeFunction(buffer, key, value, index);
|
|
9866
10162
|
}
|
|
9867
|
-
else if (value._bsontype === 'Binary') {
|
|
9868
|
-
index = serializeBinary(buffer, key, value, index);
|
|
9869
|
-
}
|
|
9870
|
-
else if (value._bsontype === 'BSONSymbol') {
|
|
9871
|
-
index = serializeSymbol(buffer, key, value, index);
|
|
9872
|
-
}
|
|
9873
|
-
else if (value._bsontype === 'DBRef') {
|
|
9874
|
-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
9875
|
-
}
|
|
9876
|
-
else if (value._bsontype === 'BSONRegExp') {
|
|
9877
|
-
index = serializeBSONRegExp(buffer, key, value, index);
|
|
9878
|
-
}
|
|
9879
|
-
else if (value._bsontype === 'Int32') {
|
|
9880
|
-
index = serializeInt32(buffer, key, value, index);
|
|
9881
|
-
}
|
|
9882
|
-
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
9883
|
-
index = serializeMinMax(buffer, key, value, index);
|
|
9884
|
-
}
|
|
9885
|
-
else if (typeof value._bsontype !== 'undefined') {
|
|
9886
|
-
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
9887
|
-
}
|
|
9888
10163
|
}
|
|
9889
10164
|
}
|
|
9890
10165
|
else {
|
|
@@ -9913,7 +10188,14 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
9913
10188
|
}
|
|
9914
10189
|
}
|
|
9915
10190
|
}
|
|
9916
|
-
if (
|
|
10191
|
+
if (value === undefined) {
|
|
10192
|
+
if (ignoreUndefined === false)
|
|
10193
|
+
index = serializeNull(buffer, key, value, index);
|
|
10194
|
+
}
|
|
10195
|
+
else if (value === null) {
|
|
10196
|
+
index = serializeNull(buffer, key, value, index);
|
|
10197
|
+
}
|
|
10198
|
+
else if (type === 'string') {
|
|
9917
10199
|
index = serializeString(buffer, key, value, index);
|
|
9918
10200
|
}
|
|
9919
10201
|
else if (type === 'number') {
|
|
@@ -9925,68 +10207,64 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
|
|
|
9925
10207
|
else if (type === 'boolean') {
|
|
9926
10208
|
index = serializeBoolean(buffer, key, value, index);
|
|
9927
10209
|
}
|
|
9928
|
-
else if (value instanceof Date || isDate(value)) {
|
|
9929
|
-
index = serializeDate(buffer, key, value, index);
|
|
9930
|
-
}
|
|
9931
|
-
else if (value === undefined) {
|
|
9932
|
-
if (ignoreUndefined === false)
|
|
9933
|
-
index = serializeNull(buffer, key, value, index);
|
|
9934
|
-
}
|
|
9935
|
-
else if (value === null) {
|
|
9936
|
-
index = serializeNull(buffer, key, value, index);
|
|
9937
|
-
}
|
|
9938
|
-
else if (isUint8Array(value)) {
|
|
9939
|
-
index = serializeBuffer(buffer, key, value, index);
|
|
9940
|
-
}
|
|
9941
|
-
else if (value instanceof RegExp || isRegExp(value)) {
|
|
9942
|
-
index = serializeRegExp(buffer, key, value, index);
|
|
9943
|
-
}
|
|
9944
10210
|
else if (type === 'object' && value._bsontype == null) {
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
value
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
|
|
9958
|
-
index = serializeLong(buffer, key, value, index);
|
|
9959
|
-
}
|
|
9960
|
-
else if (value._bsontype === 'Double') {
|
|
9961
|
-
index = serializeDouble(buffer, key, value, index);
|
|
10211
|
+
if (value instanceof Date || isDate(value)) {
|
|
10212
|
+
index = serializeDate(buffer, key, value, index);
|
|
10213
|
+
}
|
|
10214
|
+
else if (value instanceof Uint8Array || isUint8Array(value)) {
|
|
10215
|
+
index = serializeBuffer(buffer, key, value, index);
|
|
10216
|
+
}
|
|
10217
|
+
else if (value instanceof RegExp || isRegExp(value)) {
|
|
10218
|
+
index = serializeRegExp(buffer, key, value, index);
|
|
10219
|
+
}
|
|
10220
|
+
else {
|
|
10221
|
+
index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10222
|
+
}
|
|
9962
10223
|
}
|
|
9963
|
-
else if (
|
|
9964
|
-
|
|
10224
|
+
else if (type === 'object') {
|
|
10225
|
+
if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
|
|
10226
|
+
throw new BSONVersionError();
|
|
10227
|
+
}
|
|
10228
|
+
else if (value._bsontype === 'ObjectId') {
|
|
10229
|
+
index = serializeObjectId(buffer, key, value, index);
|
|
10230
|
+
}
|
|
10231
|
+
else if (value._bsontype === 'Decimal128') {
|
|
10232
|
+
index = serializeDecimal128(buffer, key, value, index);
|
|
10233
|
+
}
|
|
10234
|
+
else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
|
|
10235
|
+
index = serializeLong(buffer, key, value, index);
|
|
10236
|
+
}
|
|
10237
|
+
else if (value._bsontype === 'Double') {
|
|
10238
|
+
index = serializeDouble(buffer, key, value, index);
|
|
10239
|
+
}
|
|
10240
|
+
else if (value._bsontype === 'Code') {
|
|
10241
|
+
index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
|
|
10242
|
+
}
|
|
10243
|
+
else if (value._bsontype === 'Binary') {
|
|
10244
|
+
index = serializeBinary(buffer, key, value, index);
|
|
10245
|
+
}
|
|
10246
|
+
else if (value._bsontype === 'BSONSymbol') {
|
|
10247
|
+
index = serializeSymbol(buffer, key, value, index);
|
|
10248
|
+
}
|
|
10249
|
+
else if (value._bsontype === 'DBRef') {
|
|
10250
|
+
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
10251
|
+
}
|
|
10252
|
+
else if (value._bsontype === 'BSONRegExp') {
|
|
10253
|
+
index = serializeBSONRegExp(buffer, key, value, index);
|
|
10254
|
+
}
|
|
10255
|
+
else if (value._bsontype === 'Int32') {
|
|
10256
|
+
index = serializeInt32(buffer, key, value, index);
|
|
10257
|
+
}
|
|
10258
|
+
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
10259
|
+
index = serializeMinMax(buffer, key, value, index);
|
|
10260
|
+
}
|
|
10261
|
+
else if (typeof value._bsontype !== 'undefined') {
|
|
10262
|
+
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
10263
|
+
}
|
|
9965
10264
|
}
|
|
9966
|
-
else if (
|
|
10265
|
+
else if (type === 'function' && serializeFunctions) {
|
|
9967
10266
|
index = serializeFunction(buffer, key, value, index);
|
|
9968
10267
|
}
|
|
9969
|
-
else if (value._bsontype === 'Binary') {
|
|
9970
|
-
index = serializeBinary(buffer, key, value, index);
|
|
9971
|
-
}
|
|
9972
|
-
else if (value._bsontype === 'BSONSymbol') {
|
|
9973
|
-
index = serializeSymbol(buffer, key, value, index);
|
|
9974
|
-
}
|
|
9975
|
-
else if (value._bsontype === 'DBRef') {
|
|
9976
|
-
index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
|
|
9977
|
-
}
|
|
9978
|
-
else if (value._bsontype === 'BSONRegExp') {
|
|
9979
|
-
index = serializeBSONRegExp(buffer, key, value, index);
|
|
9980
|
-
}
|
|
9981
|
-
else if (value._bsontype === 'Int32') {
|
|
9982
|
-
index = serializeInt32(buffer, key, value, index);
|
|
9983
|
-
}
|
|
9984
|
-
else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
|
|
9985
|
-
index = serializeMinMax(buffer, key, value, index);
|
|
9986
|
-
}
|
|
9987
|
-
else if (typeof value._bsontype !== 'undefined') {
|
|
9988
|
-
throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
|
|
9989
|
-
}
|
|
9990
10268
|
}
|
|
9991
10269
|
}
|
|
9992
10270
|
path.delete(object);
|
|
@@ -10238,7 +10516,7 @@ function serializeDocument(doc, options) {
|
|
|
10238
10516
|
else if (doc != null &&
|
|
10239
10517
|
typeof doc === 'object' &&
|
|
10240
10518
|
typeof doc._bsontype === 'string' &&
|
|
10241
|
-
doc[
|
|
10519
|
+
doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
|
|
10242
10520
|
throw new BSONVersionError();
|
|
10243
10521
|
}
|
|
10244
10522
|
else if (isBSONType(doc)) {
|
|
@@ -10571,7 +10849,7 @@ exports.setInternalBufferSize = setInternalBufferSize;
|
|
|
10571
10849
|
/******/
|
|
10572
10850
|
/************************************************************************/
|
|
10573
10851
|
var __webpack_exports__ = {};
|
|
10574
|
-
// This entry
|
|
10852
|
+
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
10575
10853
|
(() => {
|
|
10576
10854
|
"use strict";
|
|
10577
10855
|
/*!*******************************!*\
|
|
@@ -10598,11 +10876,13 @@ __webpack_require__(/*! ./dashboard-result/dashboard-result */ "./frontend/src/d
|
|
|
10598
10876
|
__webpack_require__(/*! ./dashboard-result/dashboard-chart/dashboard-chart */ "./frontend/src/dashboard-result/dashboard-chart/dashboard-chart.js")(app);
|
|
10599
10877
|
__webpack_require__(/*! ./dashboard-result/dashboard-document/dashboard-document */ "./frontend/src/dashboard-result/dashboard-document/dashboard-document.js")(app);
|
|
10600
10878
|
__webpack_require__(/*! ./dashboard-result/dashboard-primitive/dashboard-primitive */ "./frontend/src/dashboard-result/dashboard-primitive/dashboard-primitive.js")(app);
|
|
10879
|
+
__webpack_require__(/*! ./dashboard-result/dashboard-text/dashboard-text */ "./frontend/src/dashboard-result/dashboard-text/dashboard-text.js")(app);
|
|
10601
10880
|
__webpack_require__(/*! ./dashboard/edit-dashboard/edit-dashboard */ "./frontend/src/dashboard/edit-dashboard/edit-dashboard.js")(app)
|
|
10602
10881
|
__webpack_require__(/*! ./detail-array/detail-array */ "./frontend/src/detail-array/detail-array.js")(app);
|
|
10603
10882
|
__webpack_require__(/*! ./detail-default/detail-default */ "./frontend/src/detail-default/detail-default.js")(app);
|
|
10604
10883
|
__webpack_require__(/*! ./document/document */ "./frontend/src/document/document.js")(app);
|
|
10605
10884
|
__webpack_require__(/*! ./document/confirm-changes/confirm-changes */ "./frontend/src/document/confirm-changes/confirm-changes.js")(app);
|
|
10885
|
+
__webpack_require__(/*! ./document/confirm-delete/confirm-delete */ "./frontend/src/document/confirm-delete/confirm-delete.js")(app);
|
|
10606
10886
|
__webpack_require__(/*! ./document-details/document-details */ "./frontend/src/document-details/document-details.js")(app);
|
|
10607
10887
|
__webpack_require__(/*! ./document-details/document-property/document-property */ "./frontend/src/document-details/document-property/document-property.js")(app);
|
|
10608
10888
|
__webpack_require__(/*! ./edit-array/edit-array */ "./frontend/src/edit-array/edit-array.js")(app);
|
|
@@ -10632,7 +10912,7 @@ app.component('app-component', {
|
|
|
10632
10912
|
`,
|
|
10633
10913
|
errorCaptured(err) {
|
|
10634
10914
|
vanillatoasts.create({
|
|
10635
|
-
title: `Error: ${err.message}`,
|
|
10915
|
+
title: `Error: ${err?.response?.data?.message || err.message}`,
|
|
10636
10916
|
icon: 'images/failure.jpg',
|
|
10637
10917
|
timeout: 10000,
|
|
10638
10918
|
positionClass: 'bottomRight'
|
|
@@ -10653,6 +10933,7 @@ const router = VueRouter.createRouter({
|
|
|
10653
10933
|
app.use(router);
|
|
10654
10934
|
|
|
10655
10935
|
app.mount('#content');
|
|
10936
|
+
|
|
10656
10937
|
})();
|
|
10657
10938
|
|
|
10658
10939
|
/******/ })()
|