@tachybase/utils 0.23.8

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 (116) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/LICENSE +201 -0
  3. package/lib/assign.d.ts +9 -0
  4. package/lib/assign.js +136 -0
  5. package/lib/client.d.ts +21 -0
  6. package/lib/client.js +77 -0
  7. package/lib/cluster.d.ts +2 -0
  8. package/lib/cluster.js +39 -0
  9. package/lib/collections-graph.d.ts +16 -0
  10. package/lib/collections-graph.js +98 -0
  11. package/lib/common.d.ts +7 -0
  12. package/lib/common.js +98 -0
  13. package/lib/currencyUtils.d.ts +44 -0
  14. package/lib/currencyUtils.js +75 -0
  15. package/lib/date.d.ts +22 -0
  16. package/lib/date.js +186 -0
  17. package/lib/dayjs.d.ts +10 -0
  18. package/lib/dayjs.js +73 -0
  19. package/lib/decorators.d.ts +16 -0
  20. package/lib/decorators.js +94 -0
  21. package/lib/dom.d.ts +4 -0
  22. package/lib/dom.js +52 -0
  23. package/lib/forEach.d.ts +1 -0
  24. package/lib/forEach.js +36 -0
  25. package/lib/fs-exists.d.ts +1 -0
  26. package/lib/fs-exists.js +37 -0
  27. package/lib/getCurrentStacks.d.ts +1 -0
  28. package/lib/getCurrentStacks.js +35 -0
  29. package/lib/getValuesByPath.d.ts +1 -0
  30. package/lib/getValuesByPath.js +62 -0
  31. package/lib/index.d.ts +31 -0
  32. package/lib/index.js +97 -0
  33. package/lib/isPortalInBody.d.ts +5 -0
  34. package/lib/isPortalInBody.js +45 -0
  35. package/lib/json-templates.d.ts +1 -0
  36. package/lib/json-templates.js +145 -0
  37. package/lib/koa-multer.d.ts +6 -0
  38. package/lib/koa-multer.js +83 -0
  39. package/lib/log.d.ts +1 -0
  40. package/lib/log.js +30 -0
  41. package/lib/measure-execution-time.d.ts +1 -0
  42. package/lib/measure-execution-time.js +35 -0
  43. package/lib/merge.d.ts +1 -0
  44. package/lib/merge.js +46 -0
  45. package/lib/mixin/AsyncEmitter.d.ts +3 -0
  46. package/lib/mixin/AsyncEmitter.js +73 -0
  47. package/lib/mixin/index.d.ts +1 -0
  48. package/lib/mixin/index.js +39 -0
  49. package/lib/notification.d.ts +1 -0
  50. package/lib/notification.js +34 -0
  51. package/lib/number.d.ts +1 -0
  52. package/lib/number.js +36 -0
  53. package/lib/parse-date.d.ts +3 -0
  54. package/lib/parse-date.js +237 -0
  55. package/lib/parse-filter.d.ts +146 -0
  56. package/lib/parse-filter.js +305 -0
  57. package/lib/parseHTML.d.ts +7 -0
  58. package/lib/parseHTML.js +33 -0
  59. package/lib/perf-hooks.d.ts +6 -0
  60. package/lib/perf-hooks.js +60 -0
  61. package/lib/plugin-symlink.d.ts +4 -0
  62. package/lib/plugin-symlink.js +131 -0
  63. package/lib/registry.d.ts +14 -0
  64. package/lib/registry.js +60 -0
  65. package/lib/requireModule.d.ts +3 -0
  66. package/lib/requireModule.js +64 -0
  67. package/lib/toposort.d.ts +13 -0
  68. package/lib/toposort.js +90 -0
  69. package/lib/typedi/container-instance.class.d.ts +109 -0
  70. package/lib/typedi/container-instance.class.js +349 -0
  71. package/lib/typedi/container-registry.class.d.ts +51 -0
  72. package/lib/typedi/container-registry.class.js +97 -0
  73. package/lib/typedi/decorators/inject-many.decorator.d.ts +8 -0
  74. package/lib/typedi/decorators/inject-many.decorator.js +56 -0
  75. package/lib/typedi/decorators/inject.decorator.d.ts +9 -0
  76. package/lib/typedi/decorators/inject.decorator.js +56 -0
  77. package/lib/typedi/decorators/service.decorator.d.ts +6 -0
  78. package/lib/typedi/decorators/service.decorator.js +49 -0
  79. package/lib/typedi/empty.const.d.ts +6 -0
  80. package/lib/typedi/empty.const.js +27 -0
  81. package/lib/typedi/error/cannot-inject-value.error.d.ts +11 -0
  82. package/lib/typedi/error/cannot-inject-value.error.js +40 -0
  83. package/lib/typedi/error/cannot-instantiate-value.error.d.ts +11 -0
  84. package/lib/typedi/error/cannot-instantiate-value.error.js +49 -0
  85. package/lib/typedi/error/service-not-found.error.d.ts +11 -0
  86. package/lib/typedi/error/service-not-found.error.js +49 -0
  87. package/lib/typedi/index.d.ts +17 -0
  88. package/lib/typedi/index.js +64 -0
  89. package/lib/typedi/interfaces/container-options.interface.d.ts +45 -0
  90. package/lib/typedi/interfaces/container-options.interface.js +15 -0
  91. package/lib/typedi/interfaces/handler.interface.d.ts +27 -0
  92. package/lib/typedi/interfaces/handler.interface.js +15 -0
  93. package/lib/typedi/interfaces/service-metadata.interface.d.ts +53 -0
  94. package/lib/typedi/interfaces/service-metadata.interface.js +15 -0
  95. package/lib/typedi/interfaces/service-options.interface.d.ts +6 -0
  96. package/lib/typedi/interfaces/service-options.interface.js +15 -0
  97. package/lib/typedi/token.class.d.ts +11 -0
  98. package/lib/typedi/token.class.js +37 -0
  99. package/lib/typedi/types/abstract-constructable.type.d.ts +9 -0
  100. package/lib/typedi/types/abstract-constructable.type.js +15 -0
  101. package/lib/typedi/types/constructable.type.d.ts +10 -0
  102. package/lib/typedi/types/constructable.type.js +15 -0
  103. package/lib/typedi/types/container-identifier.type.d.ts +4 -0
  104. package/lib/typedi/types/container-identifier.type.js +15 -0
  105. package/lib/typedi/types/container-scope.type.d.ts +1 -0
  106. package/lib/typedi/types/container-scope.type.js +15 -0
  107. package/lib/typedi/types/service-identifier.type.d.ts +8 -0
  108. package/lib/typedi/types/service-identifier.type.js +15 -0
  109. package/lib/typedi/utils/resolve-to-type-wrapper.util.d.ts +15 -0
  110. package/lib/typedi/utils/resolve-to-type-wrapper.util.js +39 -0
  111. package/lib/uid.d.ts +1 -0
  112. package/lib/uid.js +35 -0
  113. package/lib/url.d.ts +1 -0
  114. package/lib/url.js +37 -0
  115. package/package.json +49 -0
  116. package/tsconfig.json +31 -0
@@ -0,0 +1,27 @@
1
+ import { ContainerInstance } from '../container-instance.class';
2
+ import { Constructable } from '../types/constructable.type';
3
+ /**
4
+ * Used to register special "handler" which will be executed on a service class during its initialization.
5
+ * It can be used to create custom decorators and set/replace service class properties and constructor parameters.
6
+ */
7
+ export interface Handler<T = unknown> {
8
+ /**
9
+ * Service object used to apply handler to.
10
+ */
11
+ object: Constructable<T>;
12
+ /**
13
+ * Class property name to set/replace value of.
14
+ * Used if handler is applied on a class property.
15
+ */
16
+ propertyName?: string;
17
+ /**
18
+ * Parameter index to set/replace value of.
19
+ * Used if handler is applied on a constructor parameter.
20
+ */
21
+ index?: number;
22
+ /**
23
+ * Factory function that produces value that will be set to class property or constructor parameter.
24
+ * Accepts container instance which requested the value.
25
+ */
26
+ value: (container: ContainerInstance) => any;
27
+ }
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var handler_interface_exports = {};
15
+ module.exports = __toCommonJS(handler_interface_exports);
@@ -0,0 +1,53 @@
1
+ import { ContainerInstance } from '../container-instance.class';
2
+ import { Constructable } from '../types/constructable.type';
3
+ import { ContainerIdentifier } from '../types/container-identifier.type';
4
+ import { ContainerScope } from '../types/container-scope.type';
5
+ import { ServiceIdentifier } from '../types/service-identifier.type';
6
+ /**
7
+ * Service metadata is used to initialize service and store its state.
8
+ */
9
+ export interface ServiceMetadata<Type = unknown> {
10
+ /** Unique identifier of the referenced service. */
11
+ id: ServiceIdentifier;
12
+ /**
13
+ * The injection scope for the service.
14
+ * - a `singleton` service always will be created in the default container regardless of who registering it
15
+ * - a `container` scoped service will be created once when requested from the given container
16
+ * - a `transient` service will be created each time it is requested
17
+ */
18
+ scope: ContainerScope;
19
+ /**
20
+ * Class definition of the service what is used to initialize given service.
21
+ * This property maybe null if the value of the service is set manually.
22
+ * If id is not set then it serves as service id.
23
+ */
24
+ type: Constructable<Type> | null;
25
+ /**
26
+ * Factory function used to initialize this service.
27
+ * Can be regular function ("createCar" for example),
28
+ * or other service which produces this instance ([CarFactory, "createCar"] for example).
29
+ */
30
+ factory: [Constructable<unknown>, string] | CallableFunction | undefined;
31
+ /**
32
+ * Instance of the target class.
33
+ */
34
+ value: unknown | Symbol;
35
+ /**
36
+ * Allows to setup multiple instances the different classes under a single service id string or token.
37
+ */
38
+ multiple: boolean;
39
+ /**
40
+ * Indicates whether a new instance should be created as soon as the class is registered.
41
+ * By default the registered classes are only instantiated when they are requested from the container.
42
+ *
43
+ * _Note: This option is ignored for transient services._
44
+ */
45
+ eager: boolean;
46
+ /**
47
+ * Map of containers referencing this metadata. This is used when a container
48
+ * is inheriting it's parents definitions and values to track the lifecycle of
49
+ * the metadata. Namely, a service can be disposed only if it's only referenced
50
+ * by the container being disposed.
51
+ */
52
+ referencedBy: Map<ContainerIdentifier, ContainerInstance>;
53
+ }
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var service_metadata_interface_exports = {};
15
+ module.exports = __toCommonJS(service_metadata_interface_exports);
@@ -0,0 +1,6 @@
1
+ import { ServiceMetadata } from './service-metadata.interface';
2
+ /**
3
+ * The public ServiceOptions is partial object of ServiceMetadata and either one
4
+ * of the following is set: `type`, `factory`, `value` but not more than one.
5
+ */
6
+ export type ServiceOptions<T = unknown> = Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'type' | 'factory'> | Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'value' | 'factory'> | Omit<Partial<ServiceMetadata<T>>, 'referencedBy' | 'value' | 'type'>;
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var service_options_interface_exports = {};
15
+ module.exports = __toCommonJS(service_options_interface_exports);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Used to create unique typed service identifier.
3
+ * Useful when service has only interface, but don't have a class.
4
+ */
5
+ export declare class Token<T> {
6
+ name?: string;
7
+ /**
8
+ * @param name Token name, optional and only used for debugging purposes.
9
+ */
10
+ constructor(name?: string);
11
+ }
@@ -0,0 +1,37 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var token_class_exports = {};
20
+ __export(token_class_exports, {
21
+ Token: () => Token
22
+ });
23
+ module.exports = __toCommonJS(token_class_exports);
24
+ const _Token = class _Token {
25
+ /**
26
+ * @param name Token name, optional and only used for debugging purposes.
27
+ */
28
+ constructor(name) {
29
+ this.name = name;
30
+ }
31
+ };
32
+ __name(_Token, "Token");
33
+ let Token = _Token;
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ Token
37
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Generic type for abstract class definitions.
3
+ *
4
+ * Explanation: This describes a newable Function with a prototype Which is
5
+ * what an abstract class is - no constructor, just the prototype.
6
+ */
7
+ export type AbstractConstructable<T> = NewableFunction & {
8
+ prototype: T;
9
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var abstract_constructable_type_exports = {};
15
+ module.exports = __toCommonJS(abstract_constructable_type_exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Generic type for class definitions.
3
+ * Example usage:
4
+ * ```
5
+ * function createSomeInstance(myClassDefinition: Constructable<MyClass>) {
6
+ * return new myClassDefinition()
7
+ * }
8
+ * ```
9
+ */
10
+ export type Constructable<T> = new (...args: any[]) => T;
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var constructable_type_exports = {};
15
+ module.exports = __toCommonJS(constructable_type_exports);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A container identifier. This value must be unique across all containers.
3
+ */
4
+ export type ContainerIdentifier = string | Symbol;
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var container_identifier_type_exports = {};
15
+ module.exports = __toCommonJS(container_identifier_type_exports);
@@ -0,0 +1 @@
1
+ export type ContainerScope = 'singleton' | 'container' | 'transient';
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var container_scope_type_exports = {};
15
+ module.exports = __toCommonJS(container_scope_type_exports);
@@ -0,0 +1,8 @@
1
+ import { Token } from '../token.class';
2
+ import { AbstractConstructable } from './abstract-constructable.type';
3
+ import { Constructable } from './constructable.type';
4
+ /**
5
+ * Unique service identifier.
6
+ * Can be some class type, or string id, or instance of Token.
7
+ */
8
+ export type ServiceIdentifier<T = unknown> = Constructable<T> | AbstractConstructable<T> | CallableFunction | Token<T> | string;
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var service_identifier_type_exports = {};
15
+ module.exports = __toCommonJS(service_identifier_type_exports);
@@ -0,0 +1,15 @@
1
+ import { Constructable } from '../types/constructable.type';
2
+ import { ServiceIdentifier } from '../types/service-identifier.type';
3
+ /**
4
+ * Helper function used in inject decorators to resolve the received identifier to
5
+ * an eager type when possible or to a lazy type when cyclic dependencies are possibly involved.
6
+ *
7
+ * @param typeOrIdentifier a service identifier or a function returning a type acting as service identifier or nothing
8
+ * @param target the class definition of the target of the decorator
9
+ * @param propertyName the name of the property in case of a PropertyDecorator
10
+ * @param index the index of the parameter in the constructor in case of ParameterDecorator
11
+ */
12
+ export declare function resolveToTypeWrapper(typeOrIdentifier: ((type?: never) => Constructable<unknown>) | ServiceIdentifier<unknown> | undefined, target: Object, propertyName: string | Symbol, index?: number): {
13
+ eagerType: ServiceIdentifier | null;
14
+ lazyType: (type?: never) => ServiceIdentifier;
15
+ };
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var resolve_to_type_wrapper_util_exports = {};
20
+ __export(resolve_to_type_wrapper_util_exports, {
21
+ resolveToTypeWrapper: () => resolveToTypeWrapper
22
+ });
23
+ module.exports = __toCommonJS(resolve_to_type_wrapper_util_exports);
24
+ var import_token = require("../token.class");
25
+ function resolveToTypeWrapper(typeOrIdentifier, target, propertyName, index) {
26
+ let typeWrapper;
27
+ if (typeOrIdentifier && typeof typeOrIdentifier === "string" || typeOrIdentifier instanceof import_token.Token) {
28
+ typeWrapper = { eagerType: typeOrIdentifier, lazyType: /* @__PURE__ */ __name(() => typeOrIdentifier, "lazyType") };
29
+ }
30
+ if (typeOrIdentifier && typeof typeOrIdentifier === "function") {
31
+ typeWrapper = { eagerType: null, lazyType: /* @__PURE__ */ __name(() => typeOrIdentifier(), "lazyType") };
32
+ }
33
+ return typeWrapper;
34
+ }
35
+ __name(resolveToTypeWrapper, "resolveToTypeWrapper");
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ resolveToTypeWrapper
39
+ });
package/lib/uid.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function uid(len?: number): string;
package/lib/uid.js ADDED
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var uid_exports = {};
20
+ __export(uid_exports, {
21
+ uid: () => uid
22
+ });
23
+ module.exports = __toCommonJS(uid_exports);
24
+ let IDX = 36, HEX = "";
25
+ while (IDX--) HEX += IDX.toString(36);
26
+ function uid(len) {
27
+ let str = "", num = len || 11;
28
+ while (num--) str += HEX[Math.random() * 36 | 0];
29
+ return str;
30
+ }
31
+ __name(uid, "uid");
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ uid
35
+ });
package/lib/url.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function isURL(string: any): boolean;
package/lib/url.js ADDED
@@ -0,0 +1,37 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var url_exports = {};
20
+ __export(url_exports, {
21
+ isURL: () => isURL
22
+ });
23
+ module.exports = __toCommonJS(url_exports);
24
+ function isURL(string) {
25
+ let url;
26
+ try {
27
+ url = new URL(string);
28
+ } catch (e) {
29
+ return false;
30
+ }
31
+ return url.protocol === "http:" || url.protocol === "https:";
32
+ }
33
+ __name(isURL, "isURL");
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ isURL
37
+ });
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@tachybase/utils",
3
+ "version": "0.23.8",
4
+ "license": "Apache-2.0",
5
+ "exports": {
6
+ ".": {
7
+ "require": {
8
+ "types": "./lib/index.d.ts",
9
+ "default": "./lib/index.js"
10
+ },
11
+ "import": {
12
+ "types": "./lib/index.d.ts",
13
+ "default": "./lib/index.js"
14
+ }
15
+ },
16
+ "./client": {
17
+ "require": {
18
+ "types": "./lib/client.d.ts",
19
+ "default": "./lib/client.js"
20
+ },
21
+ "import": {
22
+ "types": "./lib/client.d.ts",
23
+ "default": "./lib/client.js"
24
+ }
25
+ }
26
+ },
27
+ "main": "lib/index.js",
28
+ "types": "lib/index.d.ts",
29
+ "dependencies": {
30
+ "@hapi/topo": "^6.0.2",
31
+ "@rc-component/mini-decimal": "^1.1.0",
32
+ "antd": "5.22.5",
33
+ "dayjs": "1.11.13",
34
+ "dedupe": "^3.0.3",
35
+ "deepmerge": "^4.3.1",
36
+ "flat-to-nested": "^1.1.1",
37
+ "graphlib": "^2.1.8",
38
+ "lodash": "4.17.21",
39
+ "multer": "1.4.5-lts.1",
40
+ "object-path": "^0.11.8"
41
+ },
42
+ "devDependencies": {
43
+ "@types/lodash": "4.17.13",
44
+ "@types/node": "20.17.10"
45
+ },
46
+ "scripts": {
47
+ "build": "tachybase-build --no-dts @tachybase/utils"
48
+ }
49
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["esnext", "DOM.Iterable", "DOM"],
4
+ "esModuleInterop": true,
5
+ "moduleResolution": "node",
6
+ "jsx": "react",
7
+ "target": "esnext",
8
+ "module": "esnext",
9
+ "allowJs": true,
10
+ "noUnusedLocals": false,
11
+ "preserveConstEnums": true,
12
+ "skipLibCheck": true,
13
+ "skipDefaultLibCheck": true,
14
+ "sourceMap": true,
15
+ "inlineSources": true,
16
+ "resolveJsonModule": true,
17
+ "declaration": true,
18
+ "typeRoots": ["./node_modules/@types"],
19
+ "downlevelIteration": true
20
+ },
21
+ "exclude": [
22
+ "node_modules",
23
+ "lib",
24
+ "client.d.ts",
25
+ "server.d.ts",
26
+ "client.js",
27
+ "server.js",
28
+ "plugin-symlink.d.ts",
29
+ "plugin-symlink.js"
30
+ ]
31
+ }