@steedos/utils 2.5.11-beta.10 → 2.5.19-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Steedos Licensing
2
+
3
+ SOFTWARE LICENSING
4
+
5
+ To determine under which license you may use a file from the Steedos source code,
6
+ please resort to the header of that file.
7
+
8
+ If the file has no header, the following rules apply
9
+ 1. enterprise features are licensed under Steedos Enterprise Terms, see License.enterprise.txt
10
+ 2. source code that is neither (1) is licensed under MIT, see https://opensource.org/licenses/MIT
11
+
12
+ On request, licenses under different terms are available.
13
+
14
+ Source code of enterprise features are files that
15
+ * are in folders named "ee" or start with "ee_", or in subfolders of such folders.
16
+ * contain the strings "ee_" in its filename name.
17
+ The files can be found by running the command `find . -iname ee -or -iname "*_ee*" -or -iname "*ee_*"`
18
+
19
+ STEEDOS TRADEMARK GUIDELINES
20
+
21
+ Your use of the mark Steedos is subject to Steedos, Inc's prior written approval. For trademark approval or any questions
22
+ you have about using these trademarks, please email zhuangjianguo@steedos.com
package/lib/index.d.ts CHANGED
@@ -1 +1,5 @@
1
1
  export * from './queryMetadata';
2
+ export declare function sleep(ms: any): Promise<unknown>;
3
+ export declare function absoluteUrl(path: any, options?: any): any;
4
+ export declare function wrapAsync(fn: any, context: any): any;
5
+ export declare function JSONStringify(data: any): string;
package/lib/index.js CHANGED
@@ -1,5 +1,88 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSONStringify = exports.wrapAsync = exports.absoluteUrl = exports.sleep = void 0;
3
4
  var tslib_1 = require("tslib");
4
5
  tslib_1.__exportStar(require("./queryMetadata"), exports);
6
+ function sleep(ms) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
8
+ return tslib_1.__generator(this, function (_a) {
9
+ return [2, new Promise(function (resolve) { return setTimeout(resolve, ms); })];
10
+ });
11
+ });
12
+ }
13
+ exports.sleep = sleep;
14
+ function absoluteUrl(path, options) {
15
+ if (!options && typeof path === 'object') {
16
+ options = path;
17
+ path = undefined;
18
+ }
19
+ var rootUrl = process.env.ROOT_URL;
20
+ options = Object.assign({}, { rootUrl: rootUrl }, options || {});
21
+ var url = options.rootUrl;
22
+ if (!url)
23
+ throw new Error("Must pass options.rootUrl or set ROOT_URL in the server environment");
24
+ if (!/^http[s]?:\/\//i.test(url))
25
+ url = 'http://' + url;
26
+ if (!url.endsWith("/")) {
27
+ url += "/";
28
+ }
29
+ if (path) {
30
+ while (path.startsWith("/")) {
31
+ path = path.slice(1);
32
+ }
33
+ url += path;
34
+ }
35
+ if (options.secure &&
36
+ /^http:/.test(url) &&
37
+ !/http:\/\/localhost[:\/]/.test(url) &&
38
+ !/http:\/\/127\.0\.0\.1[:\/]/.test(url))
39
+ url = url.replace(/^http:/, 'https:');
40
+ if (options.replaceLocalhost)
41
+ url = url.replace(/^http:\/\/localhost([:\/].*)/, 'http://127.0.0.1$1');
42
+ return url;
43
+ }
44
+ exports.absoluteUrl = absoluteUrl;
45
+ function wrapAsync(fn, context) {
46
+ var Future = require('fibers/future');
47
+ var proxyFn = function (_cb) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
49
+ var value, error, err_1;
50
+ return tslib_1.__generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0:
53
+ value = null;
54
+ error = null;
55
+ _a.label = 1;
56
+ case 1:
57
+ _a.trys.push([1, 3, , 4]);
58
+ return [4, fn.call(context)];
59
+ case 2:
60
+ value = _a.sent();
61
+ return [3, 4];
62
+ case 3:
63
+ err_1 = _a.sent();
64
+ error = err_1;
65
+ return [3, 4];
66
+ case 4:
67
+ _cb(error, value);
68
+ return [2];
69
+ }
70
+ });
71
+ });
72
+ };
73
+ var fut = new Future();
74
+ var callback = fut.resolver();
75
+ var result = proxyFn.apply(this, [callback]);
76
+ return fut ? fut.wait() : result;
77
+ }
78
+ exports.wrapAsync = wrapAsync;
79
+ function JSONStringify(data) {
80
+ return JSON.stringify(data, function (key, val) {
81
+ if (typeof val === 'function') {
82
+ return val + '';
83
+ }
84
+ return val;
85
+ });
86
+ }
87
+ exports.JSONStringify = JSONStringify;
5
88
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAQA,0DAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAQA,0DAAgC;AAGhC,SAAsB,KAAK,CAAC,EAAE;;;YAC1B,WAAO,IAAI,OAAO,CAAC,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAC;;;CAC1D;AAFD,sBAEC;AAED,SAAgB,WAAW,CAAE,IAAI,EAAE,OAAQ;IAEvC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QACxC,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,GAAG,SAAS,CAAC;KAClB;IACD,IAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IAEpC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAC,OAAO,EAAE,OAAO,EAAC,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAE/D,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAC1B,IAAI,CAAC,GAAG;QACN,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IAEzF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9B,GAAG,GAAG,SAAS,GAAG,GAAG,CAAC;IAExB,IAAI,CAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvB,GAAG,IAAI,GAAG,CAAC;KACZ;IAED,IAAI,IAAI,EAAE;QAER,OAAO,IAAI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;AACrC,CAAC;AAhBD,8BAgBC;AAED,SAAgB,aAAa,CAAC,IAAI;IAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,GAAG;QAC1C,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;YAC3B,OAAO,GAAG,GAAG,EAAE,CAAC;SACnB;QACD,OAAO,GAAG,CAAC;IACf,CAAC,CAAC,CAAA;AACN,CAAC;AAPD,sCAOC"}
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@steedos/utils",
3
3
  "private": false,
4
- "version": "2.5.11-beta.10",
4
+ "version": "2.5.19-beta.2",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
8
8
  "build": "rm -rf ./lib && tsc"
9
9
  },
10
- "dependencies":{
11
- "mingo": "^6.0.5",
10
+ "dependencies": {
12
11
  "@steedos/filters": "2.5.11-beta.10",
13
12
  "@steedos/odata-v4-mongodb": "2.5.11-beta.10",
14
13
  "clone": "^2.1.2",
14
+ "mingo": "^6.0.5",
15
15
  "underscore": "1.5.2"
16
16
  },
17
17
  "author": "",
@@ -19,5 +19,6 @@
19
19
  "types": "lib/index.d.ts",
20
20
  "publishConfig": {
21
21
  "access": "public"
22
- }
22
+ },
23
+ "gitHead": "fc946a6dd1aa34db1809edf505ddd1edce91fe1c"
23
24
  }