@tachybase/utils 1.3.41 → 1.3.43

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.
Files changed (55) hide show
  1. package/lib/client.d.ts +0 -3
  2. package/lib/client.js +0 -22
  3. package/lib/date.d.ts +1 -1
  4. package/lib/date.js +9 -9
  5. package/lib/dayjs.d.ts +1 -10
  6. package/lib/dayjs.js +4 -22
  7. package/lib/index.d.ts +2 -6
  8. package/lib/index.js +0 -27
  9. package/lib/parse-date.js +21 -11
  10. package/lib/parse-filter.js +4 -4
  11. package/package.json +1 -1
  12. package/lib/decorators.d.ts +0 -16
  13. package/lib/decorators.js +0 -94
  14. package/lib/typedi/container-instance.class.d.ts +0 -109
  15. package/lib/typedi/container-instance.class.js +0 -340
  16. package/lib/typedi/container-registry.class.d.ts +0 -51
  17. package/lib/typedi/container-registry.class.js +0 -95
  18. package/lib/typedi/decorators/inject-many.decorator.d.ts +0 -8
  19. package/lib/typedi/decorators/inject-many.decorator.js +0 -56
  20. package/lib/typedi/decorators/inject.decorator.d.ts +0 -9
  21. package/lib/typedi/decorators/inject.decorator.js +0 -56
  22. package/lib/typedi/decorators/service.decorator.d.ts +0 -6
  23. package/lib/typedi/decorators/service.decorator.js +0 -49
  24. package/lib/typedi/empty.const.d.ts +0 -6
  25. package/lib/typedi/empty.const.js +0 -27
  26. package/lib/typedi/error/cannot-inject-value.error.d.ts +0 -11
  27. package/lib/typedi/error/cannot-inject-value.error.js +0 -40
  28. package/lib/typedi/error/cannot-instantiate-value.error.d.ts +0 -11
  29. package/lib/typedi/error/cannot-instantiate-value.error.js +0 -49
  30. package/lib/typedi/error/service-not-found.error.d.ts +0 -11
  31. package/lib/typedi/error/service-not-found.error.js +0 -49
  32. package/lib/typedi/index.d.ts +0 -17
  33. package/lib/typedi/index.js +0 -49
  34. package/lib/typedi/interfaces/container-options.interface.d.ts +0 -45
  35. package/lib/typedi/interfaces/container-options.interface.js +0 -15
  36. package/lib/typedi/interfaces/handler.interface.d.ts +0 -27
  37. package/lib/typedi/interfaces/handler.interface.js +0 -15
  38. package/lib/typedi/interfaces/service-metadata.interface.d.ts +0 -53
  39. package/lib/typedi/interfaces/service-metadata.interface.js +0 -15
  40. package/lib/typedi/interfaces/service-options.interface.d.ts +0 -6
  41. package/lib/typedi/interfaces/service-options.interface.js +0 -15
  42. package/lib/typedi/token.class.d.ts +0 -11
  43. package/lib/typedi/token.class.js +0 -37
  44. package/lib/typedi/types/abstract-constructable.type.d.ts +0 -9
  45. package/lib/typedi/types/abstract-constructable.type.js +0 -15
  46. package/lib/typedi/types/container-identifier.type.d.ts +0 -4
  47. package/lib/typedi/types/container-identifier.type.js +0 -15
  48. package/lib/typedi/types/container-scope.type.d.ts +0 -1
  49. package/lib/typedi/types/container-scope.type.js +0 -15
  50. package/lib/typedi/types/service-identifier.type.d.ts +0 -8
  51. package/lib/typedi/types/service-identifier.type.js +0 -15
  52. package/lib/typedi/utils/resolve-to-type-wrapper.util.d.ts +0 -15
  53. package/lib/typedi/utils/resolve-to-type-wrapper.util.js +0 -39
  54. /package/lib/{typedi/types → types}/constructable.type.d.ts +0 -0
  55. /package/lib/{typedi/types → types}/constructable.type.js +0 -0
package/lib/client.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import lodash from 'lodash';
2
- import { dayjs, type Dayjs } from './dayjs';
3
1
  export * from './collections-graph';
4
2
  export * from './common';
5
3
  export * from './date';
@@ -14,7 +12,6 @@ export * from './registry';
14
12
  export * from './isPortalInBody';
15
13
  export * from './uid';
16
14
  export * from './url';
17
- export { dayjs, lodash, Dayjs };
18
15
  export * from './parseHTML';
19
16
  export * from './dom';
20
17
  export * from './currencyUtils';
package/lib/client.js CHANGED
@@ -1,13 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
6
  if (from && typeof from === "object" || typeof from === "function") {
13
7
  for (let key of __getOwnPropNames(from))
@@ -17,23 +11,9 @@ var __copyProps = (to, from, except, desc) => {
17
11
  return to;
18
12
  };
19
13
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
15
  var client_exports = {};
30
- __export(client_exports, {
31
- dayjs: () => import_dayjs.dayjs,
32
- lodash: () => import_lodash.default
33
- });
34
16
  module.exports = __toCommonJS(client_exports);
35
- var import_lodash = __toESM(require("lodash"));
36
- var import_dayjs = require("./dayjs");
37
17
  __reExport(client_exports, require("./collections-graph"), module.exports);
38
18
  __reExport(client_exports, require("./common"), module.exports);
39
19
  __reExport(client_exports, require("./date"), module.exports);
@@ -53,8 +33,6 @@ __reExport(client_exports, require("./dom"), module.exports);
53
33
  __reExport(client_exports, require("./currencyUtils"), module.exports);
54
34
  // Annotate the CommonJS export names for ESM import in node:
55
35
  0 && (module.exports = {
56
- dayjs,
57
- lodash,
58
36
  ...require("./collections-graph"),
59
37
  ...require("./common"),
60
38
  ...require("./date"),
package/lib/date.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { dayjs } from './dayjs';
1
+ import dayjs from 'dayjs';
2
2
  export interface Str2momentOptions {
3
3
  gmt?: boolean;
4
4
  picker?: 'year' | 'month' | 'week' | 'quarter';
package/lib/date.js CHANGED
@@ -37,8 +37,8 @@ __export(date_exports, {
37
37
  toLocal: () => toLocal
38
38
  });
39
39
  module.exports = __toCommonJS(date_exports);
40
+ var import_dayjs = __toESM(require("dayjs"));
40
41
  var import_lodash = __toESM(require("lodash"));
41
- var import_dayjs = require("./dayjs");
42
42
  const getDefaultFormat = /* @__PURE__ */ __name((props) => {
43
43
  if (props.format) {
44
44
  return props.format;
@@ -61,7 +61,7 @@ const getDefaultFormat = /* @__PURE__ */ __name((props) => {
61
61
  return props["showTime"] ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
62
62
  }, "getDefaultFormat");
63
63
  const toGmt = /* @__PURE__ */ __name((value) => {
64
- if (!value || !import_dayjs.dayjs.isDayjs(value)) {
64
+ if (!value || !import_dayjs.default.isDayjs(value)) {
65
65
  return value;
66
66
  }
67
67
  return `${value.format("YYYY-MM-DD")}T${value.format("HH:mm:ss.SSS")}Z`;
@@ -73,12 +73,12 @@ const toLocal = /* @__PURE__ */ __name((value) => {
73
73
  if (Array.isArray(value)) {
74
74
  return value.map((val) => val.startOf("second").toISOString());
75
75
  }
76
- if (import_dayjs.dayjs.isDayjs(value)) {
76
+ if (import_dayjs.default.isDayjs(value)) {
77
77
  return value.startOf("second").toISOString();
78
78
  }
79
79
  }, "toLocal");
80
80
  const convertUTCToLocal = /* @__PURE__ */ __name((utcString, formater = "YYYY-MM-DD HH:mm:ss") => {
81
- const localDate = import_dayjs.dayjs.utc(utcString).local().format(formater);
81
+ const localDate = import_dayjs.default.utc(utcString).local().format(formater);
82
82
  return localDate;
83
83
  }, "convertUTCToLocal");
84
84
  const toMoment = /* @__PURE__ */ __name((val, options) => {
@@ -88,15 +88,15 @@ const toMoment = /* @__PURE__ */ __name((val, options) => {
88
88
  const offset = options.utcOffset || -1 * (/* @__PURE__ */ new Date()).getTimezoneOffset();
89
89
  const { gmt, picker, utc = true } = options;
90
90
  if (!utc) {
91
- return (0, import_dayjs.dayjs)(val);
91
+ return (0, import_dayjs.default)(val);
92
92
  }
93
- if (import_dayjs.dayjs.isDayjs(val)) {
93
+ if (import_dayjs.default.isDayjs(val)) {
94
94
  return val.utcOffset(offsetFromString(offset));
95
95
  }
96
96
  if (gmt || picker) {
97
- return (0, import_dayjs.dayjs)(val).utcOffset(0);
97
+ return (0, import_dayjs.default)(val).utcOffset(0);
98
98
  }
99
- return (0, import_dayjs.dayjs)(val).utcOffset(offsetFromString(offset));
99
+ return (0, import_dayjs.default)(val).utcOffset(offsetFromString(offset));
100
100
  }, "toMoment");
101
101
  const str2moment = /* @__PURE__ */ __name((value, options = {}) => {
102
102
  return Array.isArray(value) ? value.map((val) => {
@@ -125,7 +125,7 @@ const toGmtByPicker = /* @__PURE__ */ __name((value, picker) => {
125
125
  if (Array.isArray(value)) {
126
126
  return value.map((val) => toStringByPicker(val, picker));
127
127
  }
128
- if (import_dayjs.dayjs.isDayjs(value)) {
128
+ if (import_dayjs.default.isDayjs(value)) {
129
129
  return toStringByPicker(value, picker);
130
130
  }
131
131
  }, "toGmtByPicker");
package/lib/dayjs.d.ts CHANGED
@@ -1,10 +1 @@
1
- import dayjs, { type Dayjs } from 'dayjs';
2
- import 'dayjs/plugin/isBetween';
3
- import 'dayjs/plugin/isSameOrAfter';
4
- import 'dayjs/plugin/isSameOrBefore';
5
- import 'dayjs/plugin/isoWeek';
6
- import 'dayjs/plugin/localeData';
7
- import 'dayjs/plugin/quarterOfYear';
8
- import 'dayjs/plugin/utc';
9
- import 'dayjs/plugin/weekday';
10
- export { dayjs, Dayjs };
1
+ export {};
package/lib/dayjs.js CHANGED
@@ -4,10 +4,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
7
  var __copyProps = (to, from, except, desc) => {
12
8
  if (from && typeof from === "object" || typeof from === "function") {
13
9
  for (let key of __getOwnPropNames(from))
@@ -24,12 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
20
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
21
  mod
26
22
  ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var dayjs_exports = {};
29
- __export(dayjs_exports, {
30
- dayjs: () => import_dayjs.default
31
- });
32
- module.exports = __toCommonJS(dayjs_exports);
33
23
  var import_dayjs = __toESM(require("dayjs"));
34
24
  var import_advancedFormat = __toESM(require("dayjs/plugin/advancedFormat"));
35
25
  var import_calendar = __toESM(require("dayjs/plugin/calendar"));
@@ -40,19 +30,13 @@ var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
40
30
  var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
41
31
  var import_localeData = __toESM(require("dayjs/plugin/localeData"));
42
32
  var import_quarterOfYear = __toESM(require("dayjs/plugin/quarterOfYear"));
33
+ var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"));
43
34
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
35
+ var import_updateLocale = __toESM(require("dayjs/plugin/updateLocale"));
44
36
  var import_utc = __toESM(require("dayjs/plugin/utc"));
45
37
  var import_weekday = __toESM(require("dayjs/plugin/weekday"));
46
38
  var import_weekOfYear = __toESM(require("dayjs/plugin/weekOfYear"));
47
39
  var import_weekYear = __toESM(require("dayjs/plugin/weekYear"));
48
- var import_isBetween2 = require("dayjs/plugin/isBetween");
49
- var import_isSameOrAfter2 = require("dayjs/plugin/isSameOrAfter");
50
- var import_isSameOrBefore2 = require("dayjs/plugin/isSameOrBefore");
51
- var import_isoWeek2 = require("dayjs/plugin/isoWeek");
52
- var import_localeData2 = require("dayjs/plugin/localeData");
53
- var import_quarterOfYear2 = require("dayjs/plugin/quarterOfYear");
54
- var import_utc2 = require("dayjs/plugin/utc");
55
- var import_weekday2 = require("dayjs/plugin/weekday");
56
40
  import_dayjs.default.extend(import_weekday.default);
57
41
  import_dayjs.default.extend(import_localeData.default);
58
42
  import_dayjs.default.extend(import_timezone.default);
@@ -67,7 +51,5 @@ import_dayjs.default.extend(import_weekYear.default);
67
51
  import_dayjs.default.extend(import_customParseFormat.default);
68
52
  import_dayjs.default.extend(import_advancedFormat.default);
69
53
  import_dayjs.default.extend(import_calendar.default);
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {
72
- dayjs
73
- });
54
+ import_dayjs.default.extend(import_relativeTime.default);
55
+ import_dayjs.default.extend(import_updateLocale.default);
package/lib/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import lodash from 'lodash';
2
- import { dayjs } from './dayjs';
1
+ import './dayjs';
3
2
  export * from './assign';
4
3
  export * from './collections-graph';
5
4
  export * from './common';
6
5
  export * from './date';
7
- export * from './dayjs';
8
6
  export * from './forEach';
9
7
  export * from './fs-exists';
10
8
  export * from './json-templates';
@@ -22,11 +20,9 @@ export * from './requireModule';
22
20
  export * from './toposort';
23
21
  export * from './uid';
24
22
  export * from './url';
25
- export * from './typedi';
26
- export * from './decorators';
27
23
  export * from './cluster';
28
24
  export * from './plugin-symlink';
29
25
  export * from './currencyUtils';
30
26
  export * from './getCurrentStacks';
31
27
  export * from './i18n';
32
- export { dayjs, lodash };
28
+ export type { Constructable } from './types/constructable.type';
package/lib/index.js CHANGED
@@ -1,13 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
5
  var __copyProps = (to, from, except, desc) => {
12
6
  if (from && typeof from === "object" || typeof from === "function") {
13
7
  for (let key of __getOwnPropNames(from))
@@ -17,28 +11,14 @@ var __copyProps = (to, from, except, desc) => {
17
11
  return to;
18
12
  };
19
13
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
15
  var index_exports = {};
30
- __export(index_exports, {
31
- dayjs: () => import_dayjs.dayjs,
32
- lodash: () => import_lodash.default
33
- });
34
16
  module.exports = __toCommonJS(index_exports);
35
- var import_lodash = __toESM(require("lodash"));
36
17
  var import_dayjs = require("./dayjs");
37
18
  __reExport(index_exports, require("./assign"), module.exports);
38
19
  __reExport(index_exports, require("./collections-graph"), module.exports);
39
20
  __reExport(index_exports, require("./common"), module.exports);
40
21
  __reExport(index_exports, require("./date"), module.exports);
41
- __reExport(index_exports, require("./dayjs"), module.exports);
42
22
  __reExport(index_exports, require("./forEach"), module.exports);
43
23
  __reExport(index_exports, require("./fs-exists"), module.exports);
44
24
  __reExport(index_exports, require("./json-templates"), module.exports);
@@ -56,8 +36,6 @@ __reExport(index_exports, require("./requireModule"), module.exports);
56
36
  __reExport(index_exports, require("./toposort"), module.exports);
57
37
  __reExport(index_exports, require("./uid"), module.exports);
58
38
  __reExport(index_exports, require("./url"), module.exports);
59
- __reExport(index_exports, require("./typedi"), module.exports);
60
- __reExport(index_exports, require("./decorators"), module.exports);
61
39
  __reExport(index_exports, require("./cluster"), module.exports);
62
40
  __reExport(index_exports, require("./plugin-symlink"), module.exports);
63
41
  __reExport(index_exports, require("./currencyUtils"), module.exports);
@@ -65,13 +43,10 @@ __reExport(index_exports, require("./getCurrentStacks"), module.exports);
65
43
  __reExport(index_exports, require("./i18n"), module.exports);
66
44
  // Annotate the CommonJS export names for ESM import in node:
67
45
  0 && (module.exports = {
68
- dayjs,
69
- lodash,
70
46
  ...require("./assign"),
71
47
  ...require("./collections-graph"),
72
48
  ...require("./common"),
73
49
  ...require("./date"),
74
- ...require("./dayjs"),
75
50
  ...require("./forEach"),
76
51
  ...require("./fs-exists"),
77
52
  ...require("./json-templates"),
@@ -89,8 +64,6 @@ __reExport(index_exports, require("./i18n"), module.exports);
89
64
  ...require("./toposort"),
90
65
  ...require("./uid"),
91
66
  ...require("./url"),
92
- ...require("./typedi"),
93
- ...require("./decorators"),
94
67
  ...require("./cluster"),
95
68
  ...require("./plugin-symlink"),
96
69
  ...require("./currencyUtils"),
package/lib/parse-date.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
8
  var __export = (target, all) => {
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var parse_date_exports = {};
20
30
  __export(parse_date_exports, {
@@ -22,10 +32,10 @@ __export(parse_date_exports, {
22
32
  parseWeek: () => parseWeek
23
33
  });
24
34
  module.exports = __toCommonJS(parse_date_exports);
35
+ var import_dayjs = __toESM(require("dayjs"));
25
36
  var import_date = require("./date");
26
- var import_dayjs = require("./dayjs");
27
37
  function parseUTC(value) {
28
- if (value instanceof Date || import_dayjs.dayjs.isDayjs(value)) {
38
+ if (value instanceof Date || import_dayjs.default.isDayjs(value)) {
29
39
  return {
30
40
  unit: "utc",
31
41
  start: value.toISOString()
@@ -53,7 +63,7 @@ function parseQuarter(value) {
53
63
  const [year, q] = value.split("Q");
54
64
  return {
55
65
  unit: "quarter",
56
- start: (0, import_dayjs.dayjs)(year, "YYYY").quarter(q).format("YYYY-MM-DD HH:mm:ss")
66
+ start: (0, import_dayjs.default)(year, "YYYY").quarter(q).format("YYYY-MM-DD HH:mm:ss")
57
67
  };
58
68
  }
59
69
  }
@@ -61,30 +71,30 @@ __name(parseQuarter, "parseQuarter");
61
71
  function parseWeek(value) {
62
72
  if (/^\d\d\d\d[W]\d\d$/.test(value)) {
63
73
  const arr = value.split("W");
64
- const year = (0, import_dayjs.dayjs)(arr[0], "YYYY").format("GGGG");
74
+ const year = (0, import_dayjs.default)(arr[0], "YYYY").format("GGGG");
65
75
  if (year !== arr[0]) {
66
76
  return {
67
77
  unit: "isoWeek",
68
- start: (0, import_dayjs.dayjs)(arr[0], "YYYY").add(1, "week").startOf("isoWeek").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
78
+ start: (0, import_dayjs.default)(arr[0], "YYYY").add(1, "week").startOf("isoWeek").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
69
79
  };
70
80
  }
71
81
  return {
72
82
  unit: "isoWeek",
73
- start: (0, import_dayjs.dayjs)(arr[0], "YYYY").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
83
+ start: (0, import_dayjs.default)(arr[0], "YYYY").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
74
84
  };
75
85
  }
76
86
  if (/^\d\d\d\d[w]\d\d$/.test(value)) {
77
87
  const arr = value.split("w");
78
- const year = (0, import_dayjs.dayjs)(arr[0], "YYYY").format("gggg");
88
+ const year = (0, import_dayjs.default)(arr[0], "YYYY").format("gggg");
79
89
  if (year !== arr[0]) {
80
90
  return {
81
91
  unit: "week",
82
- start: (0, import_dayjs.dayjs)(arr[0], "YYYY").add(1, "week").startOf("week").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
92
+ start: (0, import_dayjs.default)(arr[0], "YYYY").add(1, "week").startOf("week").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
83
93
  };
84
94
  }
85
95
  return {
86
96
  unit: "week",
87
- start: (0, import_dayjs.dayjs)(arr[0], "YYYY").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
97
+ start: (0, import_dayjs.default)(arr[0], "YYYY").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
88
98
  };
89
99
  }
90
100
  }
@@ -165,9 +175,9 @@ function dateRange(r) {
165
175
  }
166
176
  let m;
167
177
  if (r.unit === "utc") {
168
- return (0, import_dayjs.dayjs)(r == null ? void 0 : r.start).toISOString();
178
+ return (0, import_dayjs.default)(r == null ? void 0 : r.start).toISOString();
169
179
  } else {
170
- m = (0, import_dayjs.dayjs)(`${r == null ? void 0 : r.start}${r == null ? void 0 : r.timezone}`);
180
+ m = (0, import_dayjs.default)(`${r == null ? void 0 : r.start}${r == null ? void 0 : r.timezone}`);
171
181
  }
172
182
  m = m.utcOffset((0, import_date.offsetFromString)(r.timezone));
173
183
  return [m = m.startOf(r.unit), m.add(1, r.unit === "isoWeek" ? "weeks" : r.unit).startOf(r.unit)].map(toISOString);
@@ -37,10 +37,10 @@ __export(parse_filter_exports, {
37
37
  utc2unit: () => utc2unit
38
38
  });
39
39
  module.exports = __toCommonJS(parse_filter_exports);
40
+ var import_dayjs = __toESM(require("dayjs"));
40
41
  var import_lodash = __toESM(require("lodash"));
41
42
  var import_set = __toESM(require("lodash/set"));
42
43
  var import_date = require("./date");
43
- var import_dayjs = require("./dayjs");
44
44
  var import_getValuesByPath = require("./getValuesByPath");
45
45
  const re = /^\s*\{\{([\s\S]*)\}\}\s*$/;
46
46
  function isBuffer(obj) {
@@ -211,12 +211,12 @@ function getDayRange(options) {
211
211
  __name(getDayRange, "getDayRange");
212
212
  function toMoment(value, unit = "") {
213
213
  if (!value) {
214
- return unit === "isoWeek" ? (0, import_dayjs.dayjs)().isoWeekday(1) : (0, import_dayjs.dayjs)();
214
+ return unit === "isoWeek" ? (0, import_dayjs.default)().isoWeekday(1) : (0, import_dayjs.default)();
215
215
  }
216
- if (import_dayjs.dayjs.isDayjs(value)) {
216
+ if (import_dayjs.default.isDayjs(value)) {
217
217
  return value;
218
218
  }
219
- return unit === "isoWeek" ? (0, import_dayjs.dayjs)(value).isoWeekday(1) : (0, import_dayjs.dayjs)(value);
219
+ return unit === "isoWeek" ? (0, import_dayjs.default)(value).isoWeekday(1) : (0, import_dayjs.default)(value);
220
220
  }
221
221
  __name(toMoment, "toMoment");
222
222
  function utc2unit(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/utils",
3
- "version": "1.3.41",
3
+ "version": "1.3.43",
4
4
  "license": "Apache-2.0",
5
5
  "exports": {
6
6
  ".": {
@@ -1,16 +0,0 @@
1
- export interface ActionDef {
2
- type: string;
3
- resourceName?: string;
4
- actionName?: string;
5
- method?: string;
6
- options?: {
7
- acl?: 'loggedIn' | 'public' | 'private';
8
- };
9
- }
10
- export declare function App(): Function;
11
- export declare function Db(): Function;
12
- export declare function InjectLog(): Function;
13
- export declare function Controller(name: string): (target: any, context: ClassDecoratorContext) => void;
14
- export declare function Action(name: string, options?: {
15
- acl?: 'loggedIn' | 'public' | 'private';
16
- }): (_: any, context: ClassMethodDecoratorContext) => void;
package/lib/decorators.js DELETED
@@ -1,94 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var decorators_exports = {};
30
- __export(decorators_exports, {
31
- Action: () => Action,
32
- App: () => App,
33
- Controller: () => Controller,
34
- Db: () => Db,
35
- InjectLog: () => InjectLog
36
- });
37
- module.exports = __toCommonJS(decorators_exports);
38
- var import_typedi = __toESM(require("./typedi"));
39
- import_typedi.default.set({ id: "actions", value: /* @__PURE__ */ new Map() });
40
- function App() {
41
- return (0, import_typedi.Inject)("app");
42
- }
43
- __name(App, "App");
44
- function Db() {
45
- return (0, import_typedi.Inject)("db");
46
- }
47
- __name(Db, "Db");
48
- function InjectLog() {
49
- return (0, import_typedi.Inject)("logger");
50
- }
51
- __name(InjectLog, "InjectLog");
52
- function Controller(name) {
53
- return function(target, context) {
54
- const serviceOptions = { id: "controller", multiple: true };
55
- (0, import_typedi.Service)(serviceOptions)(target, context);
56
- const actions = import_typedi.default.get("actions");
57
- if (!actions.has(target)) {
58
- actions.set(target, []);
59
- }
60
- actions.get(target).push({
61
- type: "resource",
62
- resourceName: name
63
- });
64
- };
65
- }
66
- __name(Controller, "Controller");
67
- function Action(name, options) {
68
- return function(_, context) {
69
- if (!context.metadata.injects) {
70
- context.metadata.injects = [];
71
- }
72
- context.metadata.injects.push((target) => {
73
- const actions = import_typedi.default.get("actions");
74
- if (!actions.has(target)) {
75
- actions.set(target, []);
76
- }
77
- actions.get(target).push({
78
- type: "action",
79
- method: String(context.name),
80
- actionName: name,
81
- options: options || { acl: "private" }
82
- });
83
- });
84
- };
85
- }
86
- __name(Action, "Action");
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- Action,
90
- App,
91
- Controller,
92
- Db,
93
- InjectLog
94
- });
@@ -1,109 +0,0 @@
1
- import { Handler } from './interfaces/handler.interface';
2
- import { ServiceOptions } from './interfaces/service-options.interface';
3
- import { ContainerIdentifier } from './types/container-identifier.type';
4
- import { ServiceIdentifier } from './types/service-identifier.type';
5
- /**
6
- * TypeDI can have multiple containers.
7
- * One container is ContainerInstance.
8
- */
9
- export declare class ContainerInstance {
10
- /** Container instance id. */
11
- readonly id: ContainerIdentifier;
12
- /** Metadata for all registered services in this container. */
13
- private metadataMap;
14
- /**
15
- * Services registered with 'multiple: true' are saved as simple services
16
- * with a generated token and the mapping between the original ID and the
17
- * generated one is stored here. This is handled like this to allow simplifying
18
- * the inner workings of the service instance.
19
- */
20
- private multiServiceIds;
21
- /**
22
- * All registered handlers. The @Inject() decorator uses handlers internally to mark a property for injection.
23
- **/
24
- private readonly handlers;
25
- /**
26
- * The default global container. By default services are registered into this
27
- * container when registered via `Container.set()` or `@Service` decorator.
28
- */
29
- private static _default;
30
- static get default(): ContainerInstance;
31
- /**
32
- * Indicates if the container has been disposed or not.
33
- * Any function call should fail when called after being disposed.
34
- *
35
- * NOTE: Currently not in used
36
- */
37
- private disposed;
38
- constructor(id: ContainerIdentifier);
39
- /**
40
- * Checks if the service with given name or type is registered service container.
41
- * Optionally, parameters can be passed in case if instance is initialized in the container for the first time.
42
- */
43
- has<T = unknown>(identifier: ServiceIdentifier<T>): boolean;
44
- /**
45
- * Retrieves the service with given name or type from the service container.
46
- * Optionally, parameters can be passed in case if instance is initialized in the container for the first time.
47
- */
48
- get<T = unknown>(identifier: ServiceIdentifier<T>): T;
49
- /**
50
- * Gets all instances registered in the container of the given service identifier.
51
- * Used when service defined with multiple: true flag.
52
- */
53
- getMany<T = unknown>(identifier: ServiceIdentifier<T>): T[];
54
- /**
55
- * Sets a value for the given type or service name in the container.
56
- */
57
- set<T = unknown>(serviceOptions: ServiceOptions<T>): this;
58
- /**
59
- * Removes services with a given service identifiers.
60
- */
61
- remove(identifierOrIdentifierArray: ServiceIdentifier | ServiceIdentifier[]): this;
62
- /**
63
- * Gets a separate container instance for the given instance id.
64
- */
65
- of(containerId?: ContainerIdentifier): ContainerInstance;
66
- /**
67
- * Registers a new handler.
68
- */
69
- registerHandler(handler: Handler): ContainerInstance;
70
- /**
71
- * Helper method that imports given services.
72
- */
73
- import(services: Function[]): ContainerInstance;
74
- /**
75
- * Completely resets the container by removing all previously registered services from it.
76
- */
77
- reset(options?: {
78
- strategy: 'resetValue' | 'resetServices';
79
- }): this;
80
- dispose(): Promise<void>;
81
- private throwIfDisposed;
82
- /**
83
- * Gets the value belonging to passed in `ServiceMetadata` instance.
84
- *
85
- * - if `serviceMetadata.value` is already set it is immediately returned
86
- * - otherwise the requested type is resolved to the value saved to `serviceMetadata.value` and returned
87
- */
88
- private getServiceValue;
89
- /**
90
- * Initializes all parameter types for a given target service class.
91
- */
92
- private initializeParams;
93
- /**
94
- * Checks if given parameter type is primitive type or not.
95
- */
96
- private isPrimitiveParamType;
97
- /**
98
- * Applies all registered handlers on a given target class.
99
- */
100
- private applyPropertyHandlers;
101
- /**
102
- * Checks if the given service metadata contains a destroyable service instance and destroys it in place. If the service
103
- * contains a callable function named `destroy` it is called but not awaited and the return value is ignored..
104
- *
105
- * @param serviceMetadata the service metadata containing the instance to destroy
106
- * @param force when true the service will be always destroyed even if it's cannot be re-created
107
- */
108
- private disposeServiceInstance;
109
- }