@orion-js/mongodb 4.0.0-alpha.3 → 4.0.0-next.0
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/dist/index.cjs +82 -100
- package/dist/index.d.ts +5 -383
- package/dist/index.js +80 -98
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -31518,151 +31518,133 @@ var require_jsbn = __commonJS((exports2, module2) => {
|
|
|
31518
31518
|
|
|
31519
31519
|
// ../../node_modules/sprintf-js/src/sprintf.js
|
|
31520
31520
|
var require_sprintf = __commonJS((exports2) => {
|
|
31521
|
-
(function() {
|
|
31521
|
+
(function(window2) {
|
|
31522
31522
|
var re = {
|
|
31523
31523
|
not_string: /[^s]/,
|
|
31524
|
-
not_bool: /[^t]/,
|
|
31525
|
-
not_type: /[^T]/,
|
|
31526
|
-
not_primitive: /[^v]/,
|
|
31527
31524
|
number: /[diefg]/,
|
|
31528
|
-
numeric_arg: /[bcdiefguxX]/,
|
|
31529
31525
|
json: /[j]/,
|
|
31530
31526
|
not_json: /[^j]/,
|
|
31531
31527
|
text: /^[^\x25]+/,
|
|
31532
31528
|
modulo: /^\x25{2}/,
|
|
31533
|
-
placeholder: /^\x25(?:([1-9]\d*)\$|\(([
|
|
31529
|
+
placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,
|
|
31534
31530
|
key: /^([a-z_][a-z_\d]*)/i,
|
|
31535
31531
|
key_access: /^\.([a-z_][a-z_\d]*)/i,
|
|
31536
31532
|
index_access: /^\[(\d+)\]/,
|
|
31537
|
-
sign: /^[
|
|
31533
|
+
sign: /^[\+\-]/
|
|
31538
31534
|
};
|
|
31539
|
-
function sprintf(
|
|
31540
|
-
|
|
31541
|
-
|
|
31542
|
-
|
|
31543
|
-
|
|
31535
|
+
function sprintf() {
|
|
31536
|
+
var key = arguments[0], cache2 = sprintf.cache;
|
|
31537
|
+
if (!(cache2[key] && cache2.hasOwnProperty(key))) {
|
|
31538
|
+
cache2[key] = sprintf.parse(key);
|
|
31539
|
+
}
|
|
31540
|
+
return sprintf.format.call(null, cache2[key], arguments);
|
|
31544
31541
|
}
|
|
31545
|
-
function
|
|
31546
|
-
var cursor = 1, tree_length = parse_tree.length, arg, output =
|
|
31542
|
+
sprintf.format = function(parse_tree, argv) {
|
|
31543
|
+
var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "";
|
|
31547
31544
|
for (i = 0;i < tree_length; i++) {
|
|
31548
|
-
|
|
31549
|
-
|
|
31550
|
-
|
|
31551
|
-
|
|
31552
|
-
|
|
31545
|
+
node_type = get_type(parse_tree[i]);
|
|
31546
|
+
if (node_type === "string") {
|
|
31547
|
+
output[output.length] = parse_tree[i];
|
|
31548
|
+
} else if (node_type === "array") {
|
|
31549
|
+
match = parse_tree[i];
|
|
31550
|
+
if (match[2]) {
|
|
31553
31551
|
arg = argv[cursor];
|
|
31554
|
-
for (k = 0;k <
|
|
31555
|
-
if (arg
|
|
31556
|
-
throw new Error(sprintf(
|
|
31552
|
+
for (k = 0;k < match[2].length; k++) {
|
|
31553
|
+
if (!arg.hasOwnProperty(match[2][k])) {
|
|
31554
|
+
throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k]));
|
|
31557
31555
|
}
|
|
31558
|
-
arg = arg[
|
|
31556
|
+
arg = arg[match[2][k]];
|
|
31559
31557
|
}
|
|
31560
|
-
} else if (
|
|
31561
|
-
arg = argv[
|
|
31558
|
+
} else if (match[1]) {
|
|
31559
|
+
arg = argv[match[1]];
|
|
31562
31560
|
} else {
|
|
31563
31561
|
arg = argv[cursor++];
|
|
31564
31562
|
}
|
|
31565
|
-
if (
|
|
31563
|
+
if (get_type(arg) == "function") {
|
|
31566
31564
|
arg = arg();
|
|
31567
31565
|
}
|
|
31568
|
-
if (re.
|
|
31569
|
-
throw new TypeError(sprintf("[sprintf] expecting number but found %
|
|
31566
|
+
if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) {
|
|
31567
|
+
throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg)));
|
|
31570
31568
|
}
|
|
31571
|
-
if (re.number.test(
|
|
31569
|
+
if (re.number.test(match[8])) {
|
|
31572
31570
|
is_positive = arg >= 0;
|
|
31573
31571
|
}
|
|
31574
|
-
switch (
|
|
31572
|
+
switch (match[8]) {
|
|
31575
31573
|
case "b":
|
|
31576
|
-
arg =
|
|
31574
|
+
arg = arg.toString(2);
|
|
31577
31575
|
break;
|
|
31578
31576
|
case "c":
|
|
31579
|
-
arg = String.fromCharCode(
|
|
31577
|
+
arg = String.fromCharCode(arg);
|
|
31580
31578
|
break;
|
|
31581
31579
|
case "d":
|
|
31582
31580
|
case "i":
|
|
31583
31581
|
arg = parseInt(arg, 10);
|
|
31584
31582
|
break;
|
|
31585
31583
|
case "j":
|
|
31586
|
-
arg = JSON.stringify(arg, null,
|
|
31584
|
+
arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0);
|
|
31587
31585
|
break;
|
|
31588
31586
|
case "e":
|
|
31589
|
-
arg =
|
|
31587
|
+
arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential();
|
|
31590
31588
|
break;
|
|
31591
31589
|
case "f":
|
|
31592
|
-
arg =
|
|
31590
|
+
arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg);
|
|
31593
31591
|
break;
|
|
31594
31592
|
case "g":
|
|
31595
|
-
arg =
|
|
31593
|
+
arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg);
|
|
31596
31594
|
break;
|
|
31597
31595
|
case "o":
|
|
31598
|
-
arg =
|
|
31596
|
+
arg = arg.toString(8);
|
|
31599
31597
|
break;
|
|
31600
31598
|
case "s":
|
|
31601
|
-
arg = String(arg);
|
|
31602
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31603
|
-
break;
|
|
31604
|
-
case "t":
|
|
31605
|
-
arg = String(!!arg);
|
|
31606
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31607
|
-
break;
|
|
31608
|
-
case "T":
|
|
31609
|
-
arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
|
|
31610
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31599
|
+
arg = (arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg;
|
|
31611
31600
|
break;
|
|
31612
31601
|
case "u":
|
|
31613
|
-
arg =
|
|
31614
|
-
break;
|
|
31615
|
-
case "v":
|
|
31616
|
-
arg = arg.valueOf();
|
|
31617
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31602
|
+
arg = arg >>> 0;
|
|
31618
31603
|
break;
|
|
31619
31604
|
case "x":
|
|
31620
|
-
arg =
|
|
31605
|
+
arg = arg.toString(16);
|
|
31621
31606
|
break;
|
|
31622
31607
|
case "X":
|
|
31623
|
-
arg =
|
|
31608
|
+
arg = arg.toString(16).toUpperCase();
|
|
31624
31609
|
break;
|
|
31625
31610
|
}
|
|
31626
|
-
if (re.json.test(
|
|
31627
|
-
output
|
|
31611
|
+
if (re.json.test(match[8])) {
|
|
31612
|
+
output[output.length] = arg;
|
|
31628
31613
|
} else {
|
|
31629
|
-
if (re.number.test(
|
|
31614
|
+
if (re.number.test(match[8]) && (!is_positive || match[3])) {
|
|
31630
31615
|
sign = is_positive ? "+" : "-";
|
|
31631
31616
|
arg = arg.toString().replace(re.sign, "");
|
|
31632
31617
|
} else {
|
|
31633
31618
|
sign = "";
|
|
31634
31619
|
}
|
|
31635
|
-
pad_character =
|
|
31636
|
-
pad_length =
|
|
31637
|
-
pad =
|
|
31638
|
-
output
|
|
31620
|
+
pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " ";
|
|
31621
|
+
pad_length = match[6] - (sign + arg).length;
|
|
31622
|
+
pad = match[6] ? pad_length > 0 ? str_repeat(pad_character, pad_length) : "" : "";
|
|
31623
|
+
output[output.length] = match[5] ? sign + arg + pad : pad_character === "0" ? sign + pad + arg : pad + sign + arg;
|
|
31639
31624
|
}
|
|
31640
31625
|
}
|
|
31641
31626
|
}
|
|
31642
|
-
return output;
|
|
31643
|
-
}
|
|
31644
|
-
|
|
31645
|
-
function
|
|
31646
|
-
|
|
31647
|
-
return sprintf_cache[fmt];
|
|
31648
|
-
}
|
|
31649
|
-
var _fmt = fmt, match, parse_tree = [], arg_names = 0;
|
|
31627
|
+
return output.join("");
|
|
31628
|
+
};
|
|
31629
|
+
sprintf.cache = {};
|
|
31630
|
+
sprintf.parse = function(fmt) {
|
|
31631
|
+
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
|
|
31650
31632
|
while (_fmt) {
|
|
31651
31633
|
if ((match = re.text.exec(_fmt)) !== null) {
|
|
31652
|
-
parse_tree.
|
|
31634
|
+
parse_tree[parse_tree.length] = match[0];
|
|
31653
31635
|
} else if ((match = re.modulo.exec(_fmt)) !== null) {
|
|
31654
|
-
parse_tree.
|
|
31636
|
+
parse_tree[parse_tree.length] = "%";
|
|
31655
31637
|
} else if ((match = re.placeholder.exec(_fmt)) !== null) {
|
|
31656
31638
|
if (match[2]) {
|
|
31657
31639
|
arg_names |= 1;
|
|
31658
31640
|
var field_list = [], replacement_field = match[2], field_match = [];
|
|
31659
31641
|
if ((field_match = re.key.exec(replacement_field)) !== null) {
|
|
31660
|
-
field_list.
|
|
31642
|
+
field_list[field_list.length] = field_match[1];
|
|
31661
31643
|
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
|
|
31662
31644
|
if ((field_match = re.key_access.exec(replacement_field)) !== null) {
|
|
31663
|
-
field_list.
|
|
31645
|
+
field_list[field_list.length] = field_match[1];
|
|
31664
31646
|
} else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
|
|
31665
|
-
field_list.
|
|
31647
|
+
field_list[field_list.length] = field_match[1];
|
|
31666
31648
|
} else {
|
|
31667
31649
|
throw new SyntaxError("[sprintf] failed to parse named argument key");
|
|
31668
31650
|
}
|
|
@@ -31677,32 +31659,32 @@ var require_sprintf = __commonJS((exports2) => {
|
|
|
31677
31659
|
if (arg_names === 3) {
|
|
31678
31660
|
throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
|
|
31679
31661
|
}
|
|
31680
|
-
parse_tree.
|
|
31681
|
-
placeholder: match[0],
|
|
31682
|
-
param_no: match[1],
|
|
31683
|
-
keys: match[2],
|
|
31684
|
-
sign: match[3],
|
|
31685
|
-
pad_char: match[4],
|
|
31686
|
-
align: match[5],
|
|
31687
|
-
width: match[6],
|
|
31688
|
-
precision: match[7],
|
|
31689
|
-
type: match[8]
|
|
31690
|
-
});
|
|
31662
|
+
parse_tree[parse_tree.length] = match;
|
|
31691
31663
|
} else {
|
|
31692
31664
|
throw new SyntaxError("[sprintf] unexpected placeholder");
|
|
31693
31665
|
}
|
|
31694
31666
|
_fmt = _fmt.substring(match[0].length);
|
|
31695
31667
|
}
|
|
31696
|
-
return
|
|
31668
|
+
return parse_tree;
|
|
31669
|
+
};
|
|
31670
|
+
var vsprintf = function(fmt, argv, _argv) {
|
|
31671
|
+
_argv = (argv || []).slice(0);
|
|
31672
|
+
_argv.splice(0, 0, fmt);
|
|
31673
|
+
return sprintf.apply(null, _argv);
|
|
31674
|
+
};
|
|
31675
|
+
function get_type(variable) {
|
|
31676
|
+
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
|
|
31697
31677
|
}
|
|
31698
|
-
|
|
31699
|
-
|
|
31700
|
-
exports2["vsprintf"] = vsprintf;
|
|
31678
|
+
function str_repeat(input, multiplier) {
|
|
31679
|
+
return Array(multiplier + 1).join(input);
|
|
31701
31680
|
}
|
|
31702
|
-
if (typeof
|
|
31703
|
-
|
|
31704
|
-
|
|
31705
|
-
|
|
31681
|
+
if (typeof exports2 !== "undefined") {
|
|
31682
|
+
exports2.sprintf = sprintf;
|
|
31683
|
+
exports2.vsprintf = vsprintf;
|
|
31684
|
+
} else {
|
|
31685
|
+
window2.sprintf = sprintf;
|
|
31686
|
+
window2.vsprintf = vsprintf;
|
|
31687
|
+
if (typeof define === "function" && define.amd) {
|
|
31706
31688
|
define(function() {
|
|
31707
31689
|
return {
|
|
31708
31690
|
sprintf,
|
|
@@ -31711,7 +31693,7 @@ var require_sprintf = __commonJS((exports2) => {
|
|
|
31711
31693
|
});
|
|
31712
31694
|
}
|
|
31713
31695
|
}
|
|
31714
|
-
})();
|
|
31696
|
+
})(typeof window === "undefined" ? exports2 : window);
|
|
31715
31697
|
});
|
|
31716
31698
|
|
|
31717
31699
|
// ../../node_modules/ip-address/dist/ipv4.js
|
|
@@ -46863,7 +46845,7 @@ function findOne_default(collection) {
|
|
|
46863
46845
|
return findOne;
|
|
46864
46846
|
}
|
|
46865
46847
|
|
|
46866
|
-
//
|
|
46848
|
+
// node_modules/@orion-js/schema/dist/index.js
|
|
46867
46849
|
var __create2 = Object.create;
|
|
46868
46850
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
46869
46851
|
var __defProp2 = Object.defineProperty;
|
|
@@ -50516,7 +50498,7 @@ function loadOne_default(collection) {
|
|
|
50516
50498
|
return loadOne;
|
|
50517
50499
|
}
|
|
50518
50500
|
|
|
50519
|
-
//
|
|
50501
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
50520
50502
|
var import_node_module = require("node:module");
|
|
50521
50503
|
var import_crypto = __toESM(require("crypto"));
|
|
50522
50504
|
var __create3 = Object.create;
|
|
@@ -54630,7 +54612,7 @@ function getDBName(url) {
|
|
|
54630
54612
|
return dbName;
|
|
54631
54613
|
}
|
|
54632
54614
|
|
|
54633
|
-
//
|
|
54615
|
+
// node_modules/@orion-js/env/dist/index.js
|
|
54634
54616
|
var import_node_module2 = require("node:module");
|
|
54635
54617
|
var import_node_fs = __toESM(require("node:fs"));
|
|
54636
54618
|
var __create4 = Object.create;
|
|
@@ -63937,7 +63919,7 @@ var getMongoURLFromEnv = (connectionName) => {
|
|
|
63937
63919
|
return uri;
|
|
63938
63920
|
};
|
|
63939
63921
|
|
|
63940
|
-
//
|
|
63922
|
+
// node_modules/@orion-js/logger/dist/index.js
|
|
63941
63923
|
var import_node_module3 = require("node:module");
|
|
63942
63924
|
var import_node_util = __toESM(require("node:util"));
|
|
63943
63925
|
var __create5 = Object.create;
|
|
@@ -80604,7 +80586,7 @@ var improveFileName = (path) => {
|
|
|
80604
80586
|
return path;
|
|
80605
80587
|
};
|
|
80606
80588
|
var transports2 = [
|
|
80607
|
-
|
|
80589
|
+
textConsoleTransport
|
|
80608
80590
|
];
|
|
80609
80591
|
var winstonLogger = import_winston2.createLogger({
|
|
80610
80592
|
levels: import_winston2.config.npm.levels,
|
|
@@ -80718,7 +80700,7 @@ class Collection {
|
|
|
80718
80700
|
createIndexesPromise;
|
|
80719
80701
|
connectionPromise;
|
|
80720
80702
|
}
|
|
80721
|
-
//
|
|
80703
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
80722
80704
|
var __create6 = Object.create;
|
|
80723
80705
|
var __getProtoOf6 = Object.getPrototypeOf;
|
|
80724
80706
|
var __defProp6 = Object.defineProperty;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,388 +1,10 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { Model } from '@orion-js/models';
|
|
4
|
+
import { Blackbox, Schema } from '@orion-js/schema';
|
|
3
5
|
import * as MongoDB from 'mongodb';
|
|
4
6
|
import { Db, MongoClient } from 'mongodb';
|
|
5
7
|
|
|
6
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
7
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
8
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
9
|
-
export interface StoredCacheData {
|
|
10
|
-
value: any;
|
|
11
|
-
expires?: Date;
|
|
12
|
-
}
|
|
13
|
-
export interface SetCacheOptions {
|
|
14
|
-
ttl?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface GetCacheOptions {
|
|
17
|
-
ttl?: number;
|
|
18
|
-
fallback?(): Promise<any>;
|
|
19
|
-
}
|
|
20
|
-
export interface OrionCache {
|
|
21
|
-
/**
|
|
22
|
-
* Save data in the cache
|
|
23
|
-
*/
|
|
24
|
-
set(key: string, value: any, options?: SetCacheOptions): Promise<void> | void;
|
|
25
|
-
/**
|
|
26
|
-
* Get data from the cache
|
|
27
|
-
*/
|
|
28
|
-
get(key: string, options?: GetCacheOptions): Promise<StoredCacheData>;
|
|
29
|
-
/**
|
|
30
|
-
* Removes data from the cache
|
|
31
|
-
*/
|
|
32
|
-
invalidate(key: string): Promise<void> | void;
|
|
33
|
-
}
|
|
34
|
-
export type Blackbox = {
|
|
35
|
-
[name: string]: any;
|
|
36
|
-
};
|
|
37
|
-
export type ModelResolverResolve = (item: any, params: any, viewer: any, info?: any) => Promise<any>;
|
|
38
|
-
export type GlobalCheckPermissions = (params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
39
|
-
export type ModelCheckPermissions = (parent: any, params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
40
|
-
export type GlobalGetCacheKey = (params: any, viewer: any, info: any) => Promise<any>;
|
|
41
|
-
export type ModelGetCacheKey = (parent: any, params: any, viewer: any, info: any) => Promise<any>;
|
|
42
|
-
export interface ExecuteOptions {
|
|
43
|
-
params: Blackbox;
|
|
44
|
-
viewer: any;
|
|
45
|
-
parent?: any;
|
|
46
|
-
info?: any;
|
|
47
|
-
options: ResolverOptions;
|
|
48
|
-
}
|
|
49
|
-
export type Parameters$1<T> = T extends (...args: infer P) => any ? P : never;
|
|
50
|
-
export type ReturnType$1<T> = T extends (...args: any) => infer R ? R : any;
|
|
51
|
-
export type ResolverParams<Resolve, IsModel> = IsModel extends undefined ? Parameters$1<Resolve>[0] : Parameters$1<Resolve>[1];
|
|
52
|
-
export interface ExecuteParams<Resolve = Function, IsModel = undefined> {
|
|
53
|
-
params?: ResolverParams<Resolve, IsModel>;
|
|
54
|
-
viewer?: any;
|
|
55
|
-
parent?: IsModel extends undefined ? undefined : Parameters$1<Resolve>[0];
|
|
56
|
-
info?: any;
|
|
57
|
-
}
|
|
58
|
-
export type Execute<Resolve = Function, IsModel = undefined> = (executeOptions: ExecuteParams<Resolve, IsModel>) => ReturnType$1<Resolve>;
|
|
59
|
-
export interface SharedResolverOptions {
|
|
60
|
-
resolverId?: string;
|
|
61
|
-
params?: any;
|
|
62
|
-
returns?: any;
|
|
63
|
-
mutation?: boolean;
|
|
64
|
-
private?: boolean;
|
|
65
|
-
checkPermission?: GlobalCheckPermissions | ModelCheckPermissions;
|
|
66
|
-
getCacheKey?: GlobalGetCacheKey | ModelGetCacheKey;
|
|
67
|
-
cache?: number;
|
|
68
|
-
cacheProvider?: OrionCache;
|
|
69
|
-
permissionsOptions?: any;
|
|
70
|
-
middlewares?: ResolverMiddleware[];
|
|
71
|
-
}
|
|
72
|
-
export interface ResolverOptions<Resolve = Function> extends SharedResolverOptions {
|
|
73
|
-
resolve: Resolve;
|
|
74
|
-
}
|
|
75
|
-
export type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
76
|
-
export interface Resolver<Resolve = Function, IsModel = undefined> extends SharedResolverOptions {
|
|
77
|
-
execute: Execute<Resolve, IsModel>;
|
|
78
|
-
resolve: Resolve;
|
|
79
|
-
modelResolve: IsModel extends undefined ? undefined : OmitFirstArg<Resolve>;
|
|
80
|
-
}
|
|
81
|
-
export type ModelResolver<Resolve = Function> = Resolver<Resolve, true>;
|
|
82
|
-
export type ResolverMiddleware = (executeOptions: ExecuteOptions, next: () => Promise<any>) => Promise<any>;
|
|
83
|
-
export interface FieldType {
|
|
84
|
-
name: string;
|
|
85
|
-
validate: ValidateFunction;
|
|
86
|
-
clean: CleanFunction;
|
|
87
|
-
meta?: any;
|
|
88
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
89
|
-
_isFieldType: boolean;
|
|
90
|
-
}
|
|
91
|
-
export type Constructor<T> = new (...args: any[]) => T;
|
|
92
|
-
export type FieldTypesList = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
93
|
-
export type TypedModelOnSchema = Function;
|
|
94
|
-
export type ConstructorsTypesList = Constructor<String> | Constructor<Number> | Constructor<Boolean> | Constructor<Date>;
|
|
95
|
-
export type SchemaRecursiveNodeTypeExtras = {
|
|
96
|
-
_isFieldType?: boolean;
|
|
97
|
-
__clean?: CleanFunction;
|
|
98
|
-
__validate?: ValidateFunction;
|
|
99
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo) => Promise<boolean>;
|
|
100
|
-
};
|
|
101
|
-
export interface Schema {
|
|
102
|
-
[key: string]: SchemaNode | Function;
|
|
103
|
-
}
|
|
104
|
-
export type SchemaRecursiveNodeType = Schema & SchemaRecursiveNodeTypeExtras;
|
|
105
|
-
export type SchemaMetaFieldTypeSingle = FieldTypesList | ConstructorsTypesList | SchemaRecursiveNodeType | FieldType | TypedModelOnSchema;
|
|
106
|
-
export type SchemaMetaFieldType = SchemaMetaFieldTypeSingle | SchemaMetaFieldTypeSingle[];
|
|
107
|
-
export type ValidateFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
108
|
-
export type CleanFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => any | Promise<any>;
|
|
109
|
-
export interface SchemaNode {
|
|
110
|
-
/**
|
|
111
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
112
|
-
*/
|
|
113
|
-
type: SchemaMetaFieldType;
|
|
114
|
-
/**
|
|
115
|
-
* Defaults to false
|
|
116
|
-
*/
|
|
117
|
-
optional?: boolean;
|
|
118
|
-
allowedValues?: Array<any>;
|
|
119
|
-
defaultValue?: ((info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>) | any;
|
|
120
|
-
/**
|
|
121
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
122
|
-
*/
|
|
123
|
-
validate?: ValidateFunction;
|
|
124
|
-
/**
|
|
125
|
-
* Function that preprocesses a value before it is set.
|
|
126
|
-
*/
|
|
127
|
-
clean?: CleanFunction;
|
|
128
|
-
autoValue?: (value: any, info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>;
|
|
129
|
-
/**
|
|
130
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
131
|
-
*/
|
|
132
|
-
min?: number;
|
|
133
|
-
/**
|
|
134
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
135
|
-
*/
|
|
136
|
-
max?: number;
|
|
137
|
-
/**
|
|
138
|
-
* Internal use only.
|
|
139
|
-
*/
|
|
140
|
-
isBlackboxChild?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* @deprecated
|
|
143
|
-
*/
|
|
144
|
-
custom?: ValidateFunction;
|
|
145
|
-
/**
|
|
146
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
147
|
-
*/
|
|
148
|
-
private?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
151
|
-
*/
|
|
152
|
-
graphQLResolver?: (...args: any) => any;
|
|
153
|
-
/**
|
|
154
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
155
|
-
*/
|
|
156
|
-
key?: string;
|
|
157
|
-
/**
|
|
158
|
-
* The name that would be displayed in a front-end form
|
|
159
|
-
*/
|
|
160
|
-
label?: string;
|
|
161
|
-
/**
|
|
162
|
-
* The description that would be displayed in a front-end form
|
|
163
|
-
*/
|
|
164
|
-
description?: string;
|
|
165
|
-
/**
|
|
166
|
-
* The placeholder that would be displayed in a front-end form
|
|
167
|
-
*/
|
|
168
|
-
placeholder?: string;
|
|
169
|
-
/**
|
|
170
|
-
* The field type that would be used in a front-end form
|
|
171
|
-
*/
|
|
172
|
-
fieldType?: string;
|
|
173
|
-
/**
|
|
174
|
-
* The field options that will be passed as props to the front-end field
|
|
175
|
-
*/
|
|
176
|
-
fieldOptions?: any;
|
|
177
|
-
}
|
|
178
|
-
export interface CurrentNodeInfoOptions {
|
|
179
|
-
autoConvert?: boolean;
|
|
180
|
-
filter?: boolean;
|
|
181
|
-
trimStrings?: boolean;
|
|
182
|
-
removeEmptyStrings?: boolean;
|
|
183
|
-
forceDoc?: any;
|
|
184
|
-
omitRequired?: boolean;
|
|
185
|
-
}
|
|
186
|
-
export interface CurrentNodeInfo {
|
|
187
|
-
/**
|
|
188
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
189
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
190
|
-
*/
|
|
191
|
-
schema?: SchemaNode | Schema;
|
|
192
|
-
/**
|
|
193
|
-
* The current node subschema
|
|
194
|
-
*/
|
|
195
|
-
currentSchema?: Partial<SchemaNode>;
|
|
196
|
-
value: any;
|
|
197
|
-
doc?: any;
|
|
198
|
-
currentDoc?: any;
|
|
199
|
-
options?: CurrentNodeInfoOptions;
|
|
200
|
-
args?: any[];
|
|
201
|
-
type?: SchemaMetaFieldType;
|
|
202
|
-
keys?: string[];
|
|
203
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
204
|
-
}
|
|
205
|
-
export interface ModelResolversMap {
|
|
206
|
-
[key: string]: ModelResolver<ModelResolverResolve>;
|
|
207
|
-
}
|
|
208
|
-
export interface CloneOptions {
|
|
209
|
-
name: string;
|
|
210
|
-
omitFields?: string[];
|
|
211
|
-
pickFields?: string[];
|
|
212
|
-
mapFields?: (field: any, key: string) => any;
|
|
213
|
-
extendSchema?: Schema;
|
|
214
|
-
extendResolvers?: ModelResolversMap;
|
|
215
|
-
}
|
|
216
|
-
export interface Model<TSchema = any> {
|
|
217
|
-
__isModel: boolean;
|
|
218
|
-
/**
|
|
219
|
-
* The name of the model, used for example for GraphQL
|
|
220
|
-
*/
|
|
221
|
-
name: string;
|
|
222
|
-
/**
|
|
223
|
-
* Returns the schema of the model
|
|
224
|
-
*/
|
|
225
|
-
getSchema: () => Schema & {
|
|
226
|
-
__model: Model;
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* Returns the schema without adding __model to the schema
|
|
230
|
-
*/
|
|
231
|
-
getCleanSchema: () => Schema;
|
|
232
|
-
/**
|
|
233
|
-
* Returns the model resolvers
|
|
234
|
-
*/
|
|
235
|
-
getResolvers: () => ModelResolversMap;
|
|
236
|
-
/**
|
|
237
|
-
* Adds the model resolvers to a item
|
|
238
|
-
*/
|
|
239
|
-
initItem: (item: any) => any;
|
|
240
|
-
/**
|
|
241
|
-
* Validates an item using @orion-js/schema
|
|
242
|
-
*/
|
|
243
|
-
validate: (item: any) => Promise<any>;
|
|
244
|
-
/**
|
|
245
|
-
* Cleans an item using @orion-js/schema
|
|
246
|
-
*/
|
|
247
|
-
clean: (item: any) => Promise<TSchema>;
|
|
248
|
-
/**
|
|
249
|
-
* Cleans and validates an item using @orion-js/schema
|
|
250
|
-
*/
|
|
251
|
-
cleanAndValidate: (item: any) => Promise<TSchema>;
|
|
252
|
-
/**
|
|
253
|
-
* Creates a new model using this one as a base
|
|
254
|
-
*/
|
|
255
|
-
clone: (cloneOptions: CloneOptions) => Model;
|
|
256
|
-
/**
|
|
257
|
-
* The type of the model. Only use this in typescript
|
|
258
|
-
*/
|
|
259
|
-
type: TSchema;
|
|
260
|
-
}
|
|
261
|
-
interface FieldType$1 {
|
|
262
|
-
name: string;
|
|
263
|
-
validate: ValidateFunction$1;
|
|
264
|
-
clean: CleanFunction$1;
|
|
265
|
-
meta?: any;
|
|
266
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
267
|
-
_isFieldType: boolean;
|
|
268
|
-
}
|
|
269
|
-
type Constructor$1<T> = new (...args: any[]) => T;
|
|
270
|
-
type Blackbox$1 = {
|
|
271
|
-
[name: string]: any;
|
|
272
|
-
};
|
|
273
|
-
type FieldTypesList$1 = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
274
|
-
type TypedModelOnSchema$1 = Function;
|
|
275
|
-
type ConstructorsTypesList$1 = Constructor$1<String> | Constructor$1<Number> | Constructor$1<Boolean> | Constructor$1<Date>;
|
|
276
|
-
type SchemaRecursiveNodeTypeExtras$1 = {
|
|
277
|
-
_isFieldType?: boolean;
|
|
278
|
-
__clean?: CleanFunction$1;
|
|
279
|
-
__validate?: ValidateFunction$1;
|
|
280
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo$1) => Promise<boolean>;
|
|
281
|
-
};
|
|
282
|
-
interface Schema$1 {
|
|
283
|
-
[key: string]: SchemaNode$1 | Function;
|
|
284
|
-
}
|
|
285
|
-
type SchemaRecursiveNodeType$1 = Schema$1 & SchemaRecursiveNodeTypeExtras$1;
|
|
286
|
-
type SchemaMetaFieldTypeSingle$1 = FieldTypesList$1 | ConstructorsTypesList$1 | SchemaRecursiveNodeType$1 | FieldType$1 | TypedModelOnSchema$1;
|
|
287
|
-
type SchemaMetaFieldType$1 = SchemaMetaFieldTypeSingle$1 | SchemaMetaFieldTypeSingle$1[];
|
|
288
|
-
type ValidateFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
289
|
-
type CleanFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => any | Promise<any>;
|
|
290
|
-
interface SchemaNode$1 {
|
|
291
|
-
/**
|
|
292
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
293
|
-
*/
|
|
294
|
-
type: SchemaMetaFieldType$1;
|
|
295
|
-
/**
|
|
296
|
-
* Defaults to false
|
|
297
|
-
*/
|
|
298
|
-
optional?: boolean;
|
|
299
|
-
allowedValues?: Array<any>;
|
|
300
|
-
defaultValue?: ((info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>) | any;
|
|
301
|
-
/**
|
|
302
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
303
|
-
*/
|
|
304
|
-
validate?: ValidateFunction$1;
|
|
305
|
-
/**
|
|
306
|
-
* Function that preprocesses a value before it is set.
|
|
307
|
-
*/
|
|
308
|
-
clean?: CleanFunction$1;
|
|
309
|
-
autoValue?: (value: any, info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>;
|
|
310
|
-
/**
|
|
311
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
312
|
-
*/
|
|
313
|
-
min?: number;
|
|
314
|
-
/**
|
|
315
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
316
|
-
*/
|
|
317
|
-
max?: number;
|
|
318
|
-
/**
|
|
319
|
-
* Internal use only.
|
|
320
|
-
*/
|
|
321
|
-
isBlackboxChild?: boolean;
|
|
322
|
-
/**
|
|
323
|
-
* @deprecated
|
|
324
|
-
*/
|
|
325
|
-
custom?: ValidateFunction$1;
|
|
326
|
-
/**
|
|
327
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
328
|
-
*/
|
|
329
|
-
private?: boolean;
|
|
330
|
-
/**
|
|
331
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
332
|
-
*/
|
|
333
|
-
graphQLResolver?: (...args: any) => any;
|
|
334
|
-
/**
|
|
335
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
336
|
-
*/
|
|
337
|
-
key?: string;
|
|
338
|
-
/**
|
|
339
|
-
* The name that would be displayed in a front-end form
|
|
340
|
-
*/
|
|
341
|
-
label?: string;
|
|
342
|
-
/**
|
|
343
|
-
* The description that would be displayed in a front-end form
|
|
344
|
-
*/
|
|
345
|
-
description?: string;
|
|
346
|
-
/**
|
|
347
|
-
* The placeholder that would be displayed in a front-end form
|
|
348
|
-
*/
|
|
349
|
-
placeholder?: string;
|
|
350
|
-
/**
|
|
351
|
-
* The field type that would be used in a front-end form
|
|
352
|
-
*/
|
|
353
|
-
fieldType?: string;
|
|
354
|
-
/**
|
|
355
|
-
* The field options that will be passed as props to the front-end field
|
|
356
|
-
*/
|
|
357
|
-
fieldOptions?: any;
|
|
358
|
-
}
|
|
359
|
-
interface CurrentNodeInfoOptions$1 {
|
|
360
|
-
autoConvert?: boolean;
|
|
361
|
-
filter?: boolean;
|
|
362
|
-
trimStrings?: boolean;
|
|
363
|
-
removeEmptyStrings?: boolean;
|
|
364
|
-
forceDoc?: any;
|
|
365
|
-
omitRequired?: boolean;
|
|
366
|
-
}
|
|
367
|
-
interface CurrentNodeInfo$1 {
|
|
368
|
-
/**
|
|
369
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
370
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
371
|
-
*/
|
|
372
|
-
schema?: SchemaNode$1 | Schema$1;
|
|
373
|
-
/**
|
|
374
|
-
* The current node subschema
|
|
375
|
-
*/
|
|
376
|
-
currentSchema?: Partial<SchemaNode$1>;
|
|
377
|
-
value: any;
|
|
378
|
-
doc?: any;
|
|
379
|
-
currentDoc?: any;
|
|
380
|
-
options?: CurrentNodeInfoOptions$1;
|
|
381
|
-
args?: any[];
|
|
382
|
-
type?: SchemaMetaFieldType$1;
|
|
383
|
-
keys?: string[];
|
|
384
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
385
|
-
}
|
|
386
8
|
export interface OrionMongoClient {
|
|
387
9
|
client: MongoClient;
|
|
388
10
|
db: Db;
|
|
@@ -402,7 +24,7 @@ export type RemoveFunctions<T extends ModelClassBase> = Pick<T, {
|
|
|
402
24
|
};
|
|
403
25
|
export type ModelClassBase = {
|
|
404
26
|
_id: string;
|
|
405
|
-
} & Blackbox
|
|
27
|
+
} & Blackbox;
|
|
406
28
|
export type DocumentWithIdOptional<T extends ModelClassBase> = Omit<T, "_id"> & {
|
|
407
29
|
/**
|
|
408
30
|
* The ID of the document
|
|
@@ -520,14 +142,14 @@ export type CreateCollection = <ModelClass extends ModelClassBase = any>(options
|
|
|
520
142
|
export declare class Collection<ModelClass extends ModelClassBase = ModelClassBase> {
|
|
521
143
|
name: string;
|
|
522
144
|
connectionName?: string;
|
|
523
|
-
schema?: Schema
|
|
145
|
+
schema?: Schema;
|
|
524
146
|
/**
|
|
525
147
|
* @deprecated Use schema instead. If you use model, all items will be initialized with the model to add resolvers (which are also deprecated)
|
|
526
148
|
*/
|
|
527
149
|
model?: Model;
|
|
528
150
|
indexes: Array<CollectionIndex>;
|
|
529
151
|
generateId: () => ModelClass["_id"];
|
|
530
|
-
getSchema: () => Schema
|
|
152
|
+
getSchema: () => Schema;
|
|
531
153
|
db: MongoDB.Db;
|
|
532
154
|
client: OrionMongoClient;
|
|
533
155
|
rawCollection: MongoDB.Collection<ModelClass>;
|
package/dist/index.js
CHANGED
|
@@ -31496,151 +31496,133 @@ var require_jsbn = __commonJS((exports, module) => {
|
|
|
31496
31496
|
|
|
31497
31497
|
// ../../node_modules/sprintf-js/src/sprintf.js
|
|
31498
31498
|
var require_sprintf = __commonJS((exports) => {
|
|
31499
|
-
(function() {
|
|
31499
|
+
(function(window2) {
|
|
31500
31500
|
var re = {
|
|
31501
31501
|
not_string: /[^s]/,
|
|
31502
|
-
not_bool: /[^t]/,
|
|
31503
|
-
not_type: /[^T]/,
|
|
31504
|
-
not_primitive: /[^v]/,
|
|
31505
31502
|
number: /[diefg]/,
|
|
31506
|
-
numeric_arg: /[bcdiefguxX]/,
|
|
31507
31503
|
json: /[j]/,
|
|
31508
31504
|
not_json: /[^j]/,
|
|
31509
31505
|
text: /^[^\x25]+/,
|
|
31510
31506
|
modulo: /^\x25{2}/,
|
|
31511
|
-
placeholder: /^\x25(?:([1-9]\d*)\$|\(([
|
|
31507
|
+
placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,
|
|
31512
31508
|
key: /^([a-z_][a-z_\d]*)/i,
|
|
31513
31509
|
key_access: /^\.([a-z_][a-z_\d]*)/i,
|
|
31514
31510
|
index_access: /^\[(\d+)\]/,
|
|
31515
|
-
sign: /^[
|
|
31511
|
+
sign: /^[\+\-]/
|
|
31516
31512
|
};
|
|
31517
|
-
function sprintf(
|
|
31518
|
-
|
|
31519
|
-
|
|
31520
|
-
|
|
31521
|
-
|
|
31513
|
+
function sprintf() {
|
|
31514
|
+
var key = arguments[0], cache2 = sprintf.cache;
|
|
31515
|
+
if (!(cache2[key] && cache2.hasOwnProperty(key))) {
|
|
31516
|
+
cache2[key] = sprintf.parse(key);
|
|
31517
|
+
}
|
|
31518
|
+
return sprintf.format.call(null, cache2[key], arguments);
|
|
31522
31519
|
}
|
|
31523
|
-
function
|
|
31524
|
-
var cursor = 1, tree_length = parse_tree.length, arg, output =
|
|
31520
|
+
sprintf.format = function(parse_tree, argv) {
|
|
31521
|
+
var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "";
|
|
31525
31522
|
for (i = 0;i < tree_length; i++) {
|
|
31526
|
-
|
|
31527
|
-
|
|
31528
|
-
|
|
31529
|
-
|
|
31530
|
-
|
|
31523
|
+
node_type = get_type(parse_tree[i]);
|
|
31524
|
+
if (node_type === "string") {
|
|
31525
|
+
output[output.length] = parse_tree[i];
|
|
31526
|
+
} else if (node_type === "array") {
|
|
31527
|
+
match = parse_tree[i];
|
|
31528
|
+
if (match[2]) {
|
|
31531
31529
|
arg = argv[cursor];
|
|
31532
|
-
for (k = 0;k <
|
|
31533
|
-
if (arg
|
|
31534
|
-
throw new Error(sprintf(
|
|
31530
|
+
for (k = 0;k < match[2].length; k++) {
|
|
31531
|
+
if (!arg.hasOwnProperty(match[2][k])) {
|
|
31532
|
+
throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k]));
|
|
31535
31533
|
}
|
|
31536
|
-
arg = arg[
|
|
31534
|
+
arg = arg[match[2][k]];
|
|
31537
31535
|
}
|
|
31538
|
-
} else if (
|
|
31539
|
-
arg = argv[
|
|
31536
|
+
} else if (match[1]) {
|
|
31537
|
+
arg = argv[match[1]];
|
|
31540
31538
|
} else {
|
|
31541
31539
|
arg = argv[cursor++];
|
|
31542
31540
|
}
|
|
31543
|
-
if (
|
|
31541
|
+
if (get_type(arg) == "function") {
|
|
31544
31542
|
arg = arg();
|
|
31545
31543
|
}
|
|
31546
|
-
if (re.
|
|
31547
|
-
throw new TypeError(sprintf("[sprintf] expecting number but found %
|
|
31544
|
+
if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) {
|
|
31545
|
+
throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg)));
|
|
31548
31546
|
}
|
|
31549
|
-
if (re.number.test(
|
|
31547
|
+
if (re.number.test(match[8])) {
|
|
31550
31548
|
is_positive = arg >= 0;
|
|
31551
31549
|
}
|
|
31552
|
-
switch (
|
|
31550
|
+
switch (match[8]) {
|
|
31553
31551
|
case "b":
|
|
31554
|
-
arg =
|
|
31552
|
+
arg = arg.toString(2);
|
|
31555
31553
|
break;
|
|
31556
31554
|
case "c":
|
|
31557
|
-
arg = String.fromCharCode(
|
|
31555
|
+
arg = String.fromCharCode(arg);
|
|
31558
31556
|
break;
|
|
31559
31557
|
case "d":
|
|
31560
31558
|
case "i":
|
|
31561
31559
|
arg = parseInt(arg, 10);
|
|
31562
31560
|
break;
|
|
31563
31561
|
case "j":
|
|
31564
|
-
arg = JSON.stringify(arg, null,
|
|
31562
|
+
arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0);
|
|
31565
31563
|
break;
|
|
31566
31564
|
case "e":
|
|
31567
|
-
arg =
|
|
31565
|
+
arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential();
|
|
31568
31566
|
break;
|
|
31569
31567
|
case "f":
|
|
31570
|
-
arg =
|
|
31568
|
+
arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg);
|
|
31571
31569
|
break;
|
|
31572
31570
|
case "g":
|
|
31573
|
-
arg =
|
|
31571
|
+
arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg);
|
|
31574
31572
|
break;
|
|
31575
31573
|
case "o":
|
|
31576
|
-
arg =
|
|
31574
|
+
arg = arg.toString(8);
|
|
31577
31575
|
break;
|
|
31578
31576
|
case "s":
|
|
31579
|
-
arg = String(arg);
|
|
31580
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31581
|
-
break;
|
|
31582
|
-
case "t":
|
|
31583
|
-
arg = String(!!arg);
|
|
31584
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31585
|
-
break;
|
|
31586
|
-
case "T":
|
|
31587
|
-
arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();
|
|
31588
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31577
|
+
arg = (arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg;
|
|
31589
31578
|
break;
|
|
31590
31579
|
case "u":
|
|
31591
|
-
arg =
|
|
31592
|
-
break;
|
|
31593
|
-
case "v":
|
|
31594
|
-
arg = arg.valueOf();
|
|
31595
|
-
arg = ph.precision ? arg.substring(0, ph.precision) : arg;
|
|
31580
|
+
arg = arg >>> 0;
|
|
31596
31581
|
break;
|
|
31597
31582
|
case "x":
|
|
31598
|
-
arg =
|
|
31583
|
+
arg = arg.toString(16);
|
|
31599
31584
|
break;
|
|
31600
31585
|
case "X":
|
|
31601
|
-
arg =
|
|
31586
|
+
arg = arg.toString(16).toUpperCase();
|
|
31602
31587
|
break;
|
|
31603
31588
|
}
|
|
31604
|
-
if (re.json.test(
|
|
31605
|
-
output
|
|
31589
|
+
if (re.json.test(match[8])) {
|
|
31590
|
+
output[output.length] = arg;
|
|
31606
31591
|
} else {
|
|
31607
|
-
if (re.number.test(
|
|
31592
|
+
if (re.number.test(match[8]) && (!is_positive || match[3])) {
|
|
31608
31593
|
sign = is_positive ? "+" : "-";
|
|
31609
31594
|
arg = arg.toString().replace(re.sign, "");
|
|
31610
31595
|
} else {
|
|
31611
31596
|
sign = "";
|
|
31612
31597
|
}
|
|
31613
|
-
pad_character =
|
|
31614
|
-
pad_length =
|
|
31615
|
-
pad =
|
|
31616
|
-
output
|
|
31598
|
+
pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " ";
|
|
31599
|
+
pad_length = match[6] - (sign + arg).length;
|
|
31600
|
+
pad = match[6] ? pad_length > 0 ? str_repeat(pad_character, pad_length) : "" : "";
|
|
31601
|
+
output[output.length] = match[5] ? sign + arg + pad : pad_character === "0" ? sign + pad + arg : pad + sign + arg;
|
|
31617
31602
|
}
|
|
31618
31603
|
}
|
|
31619
31604
|
}
|
|
31620
|
-
return output;
|
|
31621
|
-
}
|
|
31622
|
-
|
|
31623
|
-
function
|
|
31624
|
-
|
|
31625
|
-
return sprintf_cache[fmt];
|
|
31626
|
-
}
|
|
31627
|
-
var _fmt = fmt, match, parse_tree = [], arg_names = 0;
|
|
31605
|
+
return output.join("");
|
|
31606
|
+
};
|
|
31607
|
+
sprintf.cache = {};
|
|
31608
|
+
sprintf.parse = function(fmt) {
|
|
31609
|
+
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
|
|
31628
31610
|
while (_fmt) {
|
|
31629
31611
|
if ((match = re.text.exec(_fmt)) !== null) {
|
|
31630
|
-
parse_tree.
|
|
31612
|
+
parse_tree[parse_tree.length] = match[0];
|
|
31631
31613
|
} else if ((match = re.modulo.exec(_fmt)) !== null) {
|
|
31632
|
-
parse_tree.
|
|
31614
|
+
parse_tree[parse_tree.length] = "%";
|
|
31633
31615
|
} else if ((match = re.placeholder.exec(_fmt)) !== null) {
|
|
31634
31616
|
if (match[2]) {
|
|
31635
31617
|
arg_names |= 1;
|
|
31636
31618
|
var field_list = [], replacement_field = match[2], field_match = [];
|
|
31637
31619
|
if ((field_match = re.key.exec(replacement_field)) !== null) {
|
|
31638
|
-
field_list.
|
|
31620
|
+
field_list[field_list.length] = field_match[1];
|
|
31639
31621
|
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
|
|
31640
31622
|
if ((field_match = re.key_access.exec(replacement_field)) !== null) {
|
|
31641
|
-
field_list.
|
|
31623
|
+
field_list[field_list.length] = field_match[1];
|
|
31642
31624
|
} else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
|
|
31643
|
-
field_list.
|
|
31625
|
+
field_list[field_list.length] = field_match[1];
|
|
31644
31626
|
} else {
|
|
31645
31627
|
throw new SyntaxError("[sprintf] failed to parse named argument key");
|
|
31646
31628
|
}
|
|
@@ -31655,32 +31637,32 @@ var require_sprintf = __commonJS((exports) => {
|
|
|
31655
31637
|
if (arg_names === 3) {
|
|
31656
31638
|
throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
|
|
31657
31639
|
}
|
|
31658
|
-
parse_tree.
|
|
31659
|
-
placeholder: match[0],
|
|
31660
|
-
param_no: match[1],
|
|
31661
|
-
keys: match[2],
|
|
31662
|
-
sign: match[3],
|
|
31663
|
-
pad_char: match[4],
|
|
31664
|
-
align: match[5],
|
|
31665
|
-
width: match[6],
|
|
31666
|
-
precision: match[7],
|
|
31667
|
-
type: match[8]
|
|
31668
|
-
});
|
|
31640
|
+
parse_tree[parse_tree.length] = match;
|
|
31669
31641
|
} else {
|
|
31670
31642
|
throw new SyntaxError("[sprintf] unexpected placeholder");
|
|
31671
31643
|
}
|
|
31672
31644
|
_fmt = _fmt.substring(match[0].length);
|
|
31673
31645
|
}
|
|
31674
|
-
return
|
|
31646
|
+
return parse_tree;
|
|
31647
|
+
};
|
|
31648
|
+
var vsprintf = function(fmt, argv, _argv) {
|
|
31649
|
+
_argv = (argv || []).slice(0);
|
|
31650
|
+
_argv.splice(0, 0, fmt);
|
|
31651
|
+
return sprintf.apply(null, _argv);
|
|
31652
|
+
};
|
|
31653
|
+
function get_type(variable) {
|
|
31654
|
+
return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
|
|
31655
|
+
}
|
|
31656
|
+
function str_repeat(input, multiplier) {
|
|
31657
|
+
return Array(multiplier + 1).join(input);
|
|
31675
31658
|
}
|
|
31676
31659
|
if (typeof exports !== "undefined") {
|
|
31677
31660
|
exports.sprintf = sprintf;
|
|
31678
31661
|
exports.vsprintf = vsprintf;
|
|
31679
|
-
}
|
|
31680
|
-
|
|
31681
|
-
|
|
31682
|
-
|
|
31683
|
-
if (typeof define === "function" && define["amd"]) {
|
|
31662
|
+
} else {
|
|
31663
|
+
window2.sprintf = sprintf;
|
|
31664
|
+
window2.vsprintf = vsprintf;
|
|
31665
|
+
if (typeof define === "function" && define.amd) {
|
|
31684
31666
|
define(function() {
|
|
31685
31667
|
return {
|
|
31686
31668
|
sprintf,
|
|
@@ -31689,7 +31671,7 @@ var require_sprintf = __commonJS((exports) => {
|
|
|
31689
31671
|
});
|
|
31690
31672
|
}
|
|
31691
31673
|
}
|
|
31692
|
-
})();
|
|
31674
|
+
})(typeof window === "undefined" ? exports : window);
|
|
31693
31675
|
});
|
|
31694
31676
|
|
|
31695
31677
|
// ../../node_modules/ip-address/dist/ipv4.js
|
|
@@ -46827,7 +46809,7 @@ function findOne_default(collection) {
|
|
|
46827
46809
|
return findOne;
|
|
46828
46810
|
}
|
|
46829
46811
|
|
|
46830
|
-
//
|
|
46812
|
+
// node_modules/@orion-js/schema/dist/index.js
|
|
46831
46813
|
var __create2 = Object.create;
|
|
46832
46814
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
46833
46815
|
var __defProp2 = Object.defineProperty;
|
|
@@ -50480,7 +50462,7 @@ function loadOne_default(collection) {
|
|
|
50480
50462
|
return loadOne;
|
|
50481
50463
|
}
|
|
50482
50464
|
|
|
50483
|
-
//
|
|
50465
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
50484
50466
|
import { createRequire as createRequire2 } from "node:module";
|
|
50485
50467
|
import crypto2 from "crypto";
|
|
50486
50468
|
var __create3 = Object.create;
|
|
@@ -54594,7 +54576,7 @@ function getDBName(url) {
|
|
|
54594
54576
|
return dbName;
|
|
54595
54577
|
}
|
|
54596
54578
|
|
|
54597
|
-
//
|
|
54579
|
+
// node_modules/@orion-js/env/dist/index.js
|
|
54598
54580
|
import { createRequire as createRequire3 } from "node:module";
|
|
54599
54581
|
import fs from "node:fs";
|
|
54600
54582
|
var __create4 = Object.create;
|
|
@@ -63901,7 +63883,7 @@ var getMongoURLFromEnv = (connectionName) => {
|
|
|
63901
63883
|
return uri;
|
|
63902
63884
|
};
|
|
63903
63885
|
|
|
63904
|
-
//
|
|
63886
|
+
// node_modules/@orion-js/logger/dist/index.js
|
|
63905
63887
|
import { createRequire as createRequire4 } from "node:module";
|
|
63906
63888
|
import util from "node:util";
|
|
63907
63889
|
var __create5 = Object.create;
|
|
@@ -80568,7 +80550,7 @@ var improveFileName = (path) => {
|
|
|
80568
80550
|
return path;
|
|
80569
80551
|
};
|
|
80570
80552
|
var transports2 = [
|
|
80571
|
-
|
|
80553
|
+
textConsoleTransport
|
|
80572
80554
|
];
|
|
80573
80555
|
var winstonLogger = import_winston2.createLogger({
|
|
80574
80556
|
levels: import_winston2.config.npm.levels,
|
|
@@ -80682,7 +80664,7 @@ class Collection {
|
|
|
80682
80664
|
createIndexesPromise;
|
|
80683
80665
|
connectionPromise;
|
|
80684
80666
|
}
|
|
80685
|
-
//
|
|
80667
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
80686
80668
|
var __create6 = Object.create;
|
|
80687
80669
|
var __getProtoOf6 = Object.getPrototypeOf;
|
|
80688
80670
|
var __defProp6 = Object.defineProperty;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/mongodb",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-next.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"clean": "rm -rf ./dist"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@orion-js/env": "^4.0.0-
|
|
26
|
-
"@orion-js/helpers": "^4.0.0-
|
|
27
|
-
"@orion-js/logger": "^4.0.0-
|
|
28
|
-
"@orion-js/models": "^4.0.0-
|
|
29
|
-
"@orion-js/resolvers": "^4.0.0-
|
|
30
|
-
"@orion-js/schema": "^4.0.0-
|
|
31
|
-
"@orion-js/services": "^4.0.0-
|
|
32
|
-
"@orion-js/typed-model": "^4.0.0-
|
|
25
|
+
"@orion-js/env": "^4.0.0-next.0",
|
|
26
|
+
"@orion-js/helpers": "^4.0.0-next.0",
|
|
27
|
+
"@orion-js/logger": "^4.0.0-next.0",
|
|
28
|
+
"@orion-js/models": "^4.0.0-next.0",
|
|
29
|
+
"@orion-js/resolvers": "^4.0.0-next.0",
|
|
30
|
+
"@orion-js/schema": "^4.0.0-next.0",
|
|
31
|
+
"@orion-js/services": "^4.0.0-next.0",
|
|
32
|
+
"@orion-js/typed-model": "^4.0.0-next.0",
|
|
33
33
|
"bson": "^6.10.3",
|
|
34
34
|
"dataloader": "2.2.2",
|
|
35
35
|
"dot-object": "2.1.4",
|