@tstdl/base 0.90.57 → 0.90.59

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 (76) hide show
  1. package/.eslintrc.json +136 -116
  2. package/json-path/json-path.d.ts +11 -9
  3. package/json-path/json-path.js +9 -6
  4. package/jsx/render-to-string.d.ts +2 -0
  5. package/jsx/render-to-string.js +9 -3
  6. package/package.json +9 -9
  7. package/queue/mongo/queue.provider.d.ts +2 -4
  8. package/random/series.d.ts +1 -1
  9. package/schema/constraints/maximum.d.ts +1 -1
  10. package/schema/constraints/minimum-date.d.ts +1 -1
  11. package/schema/constraints/minimum.d.ts +1 -1
  12. package/schema/constraints/pattern.d.ts +1 -1
  13. package/schema/types/types.d.ts +2 -2
  14. package/search-index/elastic/query-builder/boolean-query-builder.d.ts +1 -4
  15. package/search-index/elastic/query-builder/boolean-query-builder.js +23 -23
  16. package/templates/renderers/jsx.template-renderer.d.ts +1 -1
  17. package/templates/renderers/jsx.template-renderer.js +3 -3
  18. package/theme/theme-service.d.ts +1 -1
  19. package/theme/theme-service.js +3 -2
  20. package/types.d.ts +26 -12
  21. package/utils/async-iterable-helpers/to-async-iterator.js +2 -2
  22. package/utils/async-iterator-iterable-iterator.js +3 -3
  23. package/utils/base64.js +1 -1
  24. package/utils/cryptography.d.ts +13 -13
  25. package/utils/cryptography.js +12 -12
  26. package/utils/date-time.js +1 -1
  27. package/utils/encoding.d.ts +6 -6
  28. package/utils/encoding.js +6 -6
  29. package/utils/enum.js +9 -15
  30. package/utils/equals.js +3 -2
  31. package/utils/format-error.d.ts +5 -5
  32. package/utils/format.js +7 -6
  33. package/utils/helpers.d.ts +9 -9
  34. package/utils/helpers.js +3 -3
  35. package/utils/object/decycle.d.ts +2 -2
  36. package/utils/object/decycle.js +8 -8
  37. package/utils/object/dereference.d.ts +4 -4
  38. package/utils/object/dereference.js +4 -4
  39. package/utils/object/forward-ref.js +2 -2
  40. package/utils/object/lazy-property.d.ts +9 -9
  41. package/utils/object/lazy-property.js +4 -3
  42. package/utils/object/merge.d.ts +1 -1
  43. package/utils/object/merge.js +3 -3
  44. package/utils/object/object.d.ts +2 -2
  45. package/utils/object/object.js +2 -2
  46. package/utils/object/property-name.d.ts +15 -15
  47. package/utils/object/property-name.js +12 -12
  48. package/utils/patch-worker.d.ts +3 -3
  49. package/utils/patterns.d.ts +2 -2
  50. package/utils/patterns.js +3 -3
  51. package/utils/periodic-reporter.d.ts +1 -1
  52. package/utils/periodic-sampler.d.ts +1 -1
  53. package/utils/periodic-sampler.js +7 -5
  54. package/utils/random.d.ts +2 -2
  55. package/utils/random.js +2 -2
  56. package/utils/reactive-value-to-signal.d.ts +1 -1
  57. package/utils/reactive-value-to-signal.js +1 -1
  58. package/utils/repl.js +1 -0
  59. package/utils/singleton.d.ts +5 -4
  60. package/utils/singleton.js +3 -3
  61. package/utils/stream/finalize-stream.d.ts +5 -5
  62. package/utils/stream/readable-stream-adapter.d.ts +1 -1
  63. package/utils/stream/readable-stream-adapter.js +2 -2
  64. package/utils/stream/readable-stream-from-promise.d.ts +1 -1
  65. package/utils/stream/slice.js +1 -1
  66. package/utils/stream/to-bytes-stream.js +4 -4
  67. package/utils/timing.d.ts +5 -5
  68. package/utils/timing.js +4 -4
  69. package/utils/type-guards.js +1 -1
  70. package/utils/type-of.d.ts +3 -2
  71. package/utils/type-of.js +1 -1
  72. package/utils/units.js +3 -2
  73. package/utils/url-builder.js +3 -3
  74. package/utils/value-or-provider.js +1 -1
  75. package/utils/z-base32.js +1 -3
  76. package/web-types.d.ts +1 -1
package/.eslintrc.json CHANGED
@@ -9,7 +9,8 @@
9
9
  "eslint:all",
10
10
  "plugin:@typescript-eslint/all",
11
11
  "plugin:import/recommended",
12
- "plugin:import/typescript"
12
+ "plugin:import/typescript",
13
+ "plugin:@stylistic/disable-legacy"
13
14
  ],
14
15
  "settings": {
15
16
  "import/resolver": {
@@ -20,140 +21,141 @@
20
21
  "parserOptions": {
21
22
  "ecmaVersion": "latest",
22
23
  "sourceType": "module",
23
- "project": "tsconfig.json"
24
+ "project": true
24
25
  },
25
- "plugins": ["@typescript-eslint"],
26
+ "plugins": ["@stylistic"],
26
27
  "rules": {
27
- /** typescript */
28
- "@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
29
- "@typescript-eslint/class-methods-use-this": ["error", { "ignoreOverrideMethods": true, "ignoreClassesThatImplementAnInterface": true }],
30
- "@typescript-eslint/consistent-type-definitions": "off",
28
+ "camelcase": ["off"],
29
+ "capitalized-comments": ["warn", "always", { "ignorePattern": "noop" }],
30
+ "class-methods-use-this": ["off"],
31
+ "complexity": ["off"],
32
+ "consistent-type-definitions": ["off"],
33
+ "eqeqeq": ["off"],
34
+ "explicit-function-return-type": ["off"],
35
+ "explicit-member-accessibility": ["off"],
36
+ "func-style": ["error", "declaration", { "allowArrowFunctions": true }],
37
+ "id-length": ["off"],
38
+ "init-declarations": ["off"],
39
+ "line-comment-position": ["off"],
40
+ "max-classes-per-file": ["off"],
41
+ "max-lines-per-function": ["warn", { "max": 100, "skipBlankLines": true, "skipComments": true }],
42
+ "max-lines": ["off"],
43
+ "max-params": ["off"],
44
+ "max-statements": ["off"],
45
+ "new-cap": ["off"],
46
+ "no-await-in-loop": ["off"],
47
+ "no-bitwise": ["off"],
48
+ "no-case-declarations": ["warn"],
49
+ "no-confusing-void-expression": ["off"],
50
+ "no-constant-condition": ["error", { "checkLoops": false }],
51
+ "no-continue": ["off"],
52
+ "no-duplicate-imports": ["off"],
53
+ "no-empty-interface": ["off"],
54
+ "no-explicit-any": ["off"],
55
+ "no-inferrable-types": ["off"],
56
+ "no-inline-comments": ["off"],
57
+ "no-magic-numbers": ["off"],
58
+ "no-negated-condition": ["warn"],
59
+ "no-nested-ternary": ["off"],
60
+ "no-plusplus": ["off"],
61
+ "no-promise-executor-return": ["off"],
62
+ "no-restricted-imports": ["off"],
63
+ "no-ternary": ["off"],
64
+ "no-undefined": ["off"],
65
+ "no-underscore-dangle": ["off"],
66
+ "no-unnecessary-condition": ["off"],
67
+ "no-unused-vars": ["off"],
68
+ "no-use-before-define": ["off"],
69
+ "no-void": ["warn", { "allowAsStatement": true }],
70
+ "one-var": ["error", "never"],
71
+ "prefer-arrow-callback": ["warn"],
72
+ "prefer-destructuring": ["off"],
73
+ "prefer-named-capture-group": ["warn"],
74
+ "restrict-template-expressions": ["off"],
75
+ "sort-imports": ["off", { "ignoreCase": true }],
76
+ "sort-keys": ["off"],
77
+ "sort-type-constituents": ["off"],
78
+
79
+ "@typescript-eslint/ban-types": ["error"],
80
+ "@typescript-eslint/class-methods-use-this": ["warn", { "ignoreOverrideMethods": true, "ignoreClassesThatImplementAnInterface": true }],
81
+ "@typescript-eslint/consistent-type-definitions": ["off"],
82
+ "@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports", "fixStyle": "inline-type-imports", "disallowTypeAnnotations": false }],
31
83
  "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true, "allowFunctionsWithoutTypeParameters": true }],
32
84
  "@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],
33
- "@typescript-eslint/explicit-module-boundary-types": "off",
34
- "@typescript-eslint/indent": "off",
35
- "@typescript-eslint/init-declarations": "off",
36
- "@typescript-eslint/lines-around-comment": "off",
37
- "@typescript-eslint/lines-between-class-members": ["warn", "always", { "exceptAfterSingleLine": true }],
38
- "@typescript-eslint/max-params": "off",
39
- "@typescript-eslint/method-signature-style": "off",
85
+ "@typescript-eslint/init-declarations": ["off"],
86
+ "@typescript-eslint/max-params": ["warn", { "max": 5 }],
40
87
  "@typescript-eslint/no-confusing-void-expression": ["error", { "ignoreArrowShorthand": true, "ignoreVoidOperator": true }],
41
88
  "@typescript-eslint/no-empty-interface": ["warn", { "allowSingleExtends": true }],
42
- "@typescript-eslint/no-explicit-any": "off",
43
- "@typescript-eslint/no-extra-parens": "off",
44
- "@typescript-eslint/no-extraneous-class": "off",
89
+ "@typescript-eslint/no-explicit-any": ["off"],
45
90
  "@typescript-eslint/no-inferrable-types": ["warn", { "ignoreParameters": true, "ignoreProperties": true }],
46
- "@typescript-eslint/no-invalid-void-type": "off",
47
- "@typescript-eslint/no-magic-numbers": ["off", { "ignoreNumericLiteralTypes": true, "ignoreEnums": true, "ignore": [0, 1, 128, 256, 512, 1024, 2048, 4096], "ignoreArrayIndexes": true }],
48
- "@typescript-eslint/no-non-null-assertion": "off",
49
- "@typescript-eslint/no-restricted-imports": "off",
50
- "@typescript-eslint/no-type-alias": "off",
91
+ "@typescript-eslint/no-invalid-void-type": ["error", { "allowInGenericTypeArguments": true }],
92
+ "@typescript-eslint/no-magic-numbers": ["error", { "ignoreEnums": true, "ignoreNumericLiteralTypes": true, "ignoreReadonlyClassProperties": true, "ignoreArrayIndexes": true, "ignoreTypeIndexes": true, "ignore": [0, 1, 2, 4, 8, 16, 32, 64, 128, 192, 255, 256, 512, 1024, 2048, 4096, 8192] }],
93
+ "@typescript-eslint/no-restricted-imports": ["warn"],
51
94
  "@typescript-eslint/no-unnecessary-condition": ["error", { "allowConstantLoopConditions": true }],
52
- "@typescript-eslint/no-unsafe-assignment": "off",
53
- "@typescript-eslint/no-unused-vars-experimental": "off",
95
+ "@typescript-eslint/no-unsafe-assignment": ["off"],
54
96
  "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
55
- "@typescript-eslint/no-use-before-define": ["error", { "functions": false }],
56
- "@typescript-eslint/no-useless-constructor": "off",
57
- "@typescript-eslint/object-curly-spacing": "off",
58
- "@typescript-eslint/prefer-readonly-parameter-types": ["off", { "checkParameterProperties": false }],
59
- "@typescript-eslint/quotes": ["warn", "single"],
97
+ "@typescript-eslint/no-use-before-define": ["off"],
98
+ "@typescript-eslint/prefer-destructuring": ["off"],
60
99
  "@typescript-eslint/restrict-template-expressions": ["error", { "allowNumber": true, "allowBoolean": true, "allowNullish": true }],
61
- "@typescript-eslint/sort-type-constituents": "off",
62
- "@typescript-eslint/sort-type-union-intersection-members": "off",
63
- "@typescript-eslint/space-before-function-paren": ["warn", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
64
- "@typescript-eslint/typedef": "off",
100
+ "@typescript-eslint/sort-type-constituents": ["off"],
101
+ "@typescript-eslint/method-signature-style": ["off"],
65
102
 
66
- /** import */
67
- "import/no-duplicates": ["warn", { "prefer-inline": true }],
103
+ /* deprecated */
104
+ "@typescript-eslint/no-non-null-assertion": ["off"],
105
+ "@typescript-eslint/prefer-readonly-parameter-types": ["off"],
106
+ "@typescript-eslint/explicit-module-boundary-types": ["off"],
107
+
108
+ "@stylistic/brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
109
+ "@stylistic/explicit-module-boundary-types": ["off"],
110
+ "@stylistic/newline-per-chained-call": ["off"],
111
+ "@stylistic/no-extra-parens": ["off"],
112
+ "@stylistic/no-extraneous-class": ["off"],
113
+ "@stylistic/no-non-null-assertion": ["off"],
114
+ "@stylistic/no-type-alias": ["off"],
115
+ "@stylistic/no-unused-vars-experimental": ["off"],
116
+ "@stylistic/no-useless-constructor": ["off"],
117
+ "@stylistic/prefer-readonly-parameter-types": ["off", { "checkParameterProperties": false }],
118
+ "@stylistic/sort-type-union-intersection-members": ["off"],
119
+ "@stylistic/space-before-function-paren": ["warn", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
120
+ "@stylistic/typedef": ["off"],
121
+
122
+ "import/consistent-type-specifier-style": ["off", "prefer-inline"],
123
+ "import/newline-after-import": ["warn"],
124
+ "import/no-absolute-path": ["error"],
125
+ "import/no-anonymous-default-export": ["error"],
68
126
  "import/no-cycle": ["off", { "ignoreExternal": true }],
69
- "import/no-self-import": ["error"],
70
- "import/no-extraneous-dependencies": ["off", { "devDependencies": false, "includeTypes": true }],
127
+ "import/no-duplicates": ["warn", { "prefer-inline": true }],
71
128
  "import/no-empty-named-blocks": ["error"],
129
+ "import/no-extraneous-dependencies": ["off", { "devDependencies": false, "includeTypes": true }],
72
130
  "import/no-mutable-exports": ["error"],
73
- "import/no-nodejs-modules": ["error"],
74
- "import/no-absolute-path": ["error"],
75
- "import/no-useless-path-segments": ["warn"],
76
- "import/consistent-type-specifier-style": ["off", "prefer-inline"],
77
- "import/newline-after-import": ["warn", { "considerComments": true }],
78
- "import/no-anonymous-default-export": ["error"],
79
131
  "import/no-named-default": ["error"],
132
+ "import/no-nodejs-modules": ["error"],
133
+ "import/no-self-import": ["error"],
80
134
  "import/no-unassigned-import": ["error"],
135
+ "import/no-useless-path-segments": ["warn"],
81
136
 
82
137
  /** misc */
83
- "array-bracket-newline": ["error", "consistent"],
84
- "array-element-newline": ["error", "consistent"],
85
- "camelcase": "off",
86
- "capitalized-comments": "off",
87
- "class-methods-use-this": "off",
88
- "complexity": "off",
89
- "dot-location": ["error", "property"],
90
- "eqeqeq": "off",
91
- "func-style": ["error", "declaration", { "allowArrowFunctions": true }],
92
- "function-call-argument-newline": ["warn", "consistent"],
93
- "function-paren-newline": ["warn", "consistent"],
94
- "generator-star-spacing": ["off", { "before": false, "after": true }],
95
- "id-length": "off",
96
- "indent": "off",
97
- "init-declarations": "off",
98
- "line-comment-position": "off",
99
- "linebreak-style": ["error", "unix"],
100
- "lines-around-comment": "off",
101
- "lines-between-class-members": "off",
102
- "max-classes-per-file": "off",
103
- "max-len": ["off", { "code": 150 }],
104
- "max-lines-per-function": ["off", { "max": 100, "skipBlankLines": true, "skipComments": true }],
105
- "max-lines": "off",
106
- "max-params": "off",
107
- "max-statements": "off",
108
- "multiline-ternary": "off",
109
- "new-cap": "off",
110
- "newline-per-chained-call": "off",
111
- "no-await-in-loop": "off",
112
- "no-case-declarations": "off",
113
- "no-constant-condition": "off",
114
- "no-continue": "off",
115
- "no-duplicate-imports": "off",
116
- "no-inline-comments": "off",
117
- "no-negated-condition": "off",
118
- "no-nested-ternary": "off",
119
- "no-plusplus": ["off", { "allowForLoopAfterthoughts": true }],
120
- "no-promise-executor-return": "off",
121
- "no-restricted-imports": "off",
122
- "no-ternary": "off",
123
- "no-undefined": "off",
124
- "no-underscore-dangle": "off",
125
- "no-void": "off",
126
- "object-curly-spacing": "off",
127
- "object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }],
128
- "one-var": ["error", "never"],
129
- "operator-linebreak": ["warn", "before"],
130
- "padded-blocks": ["error", "never"],
131
- "prefer-arrow/prefer-arrow-functions": "off",
132
- "prefer-destructuring": "off",
133
- "prefer-named-capture-group": "off",
134
- "quote-props": ["error", "as-needed"],
135
- "quotes": ["error", "single"],
136
- "semi": ["error", "always"],
137
- "sort-imports": ["off", { "ignoreCase": true }],
138
- "sort-keys": "off",
138
+ "@stylistic/lines-around-comment": ["warn", { "allowClassStart": true, "allowTypeStart": true }],
139
+ "@stylistic/array-bracket-newline": ["error", "consistent"],
140
+ "@stylistic/array-element-newline": ["error", "consistent"],
141
+ "@stylistic/dot-location": ["error", "property"],
142
+ "@stylistic/function-call-argument-newline": ["warn", "consistent"],
143
+ "@stylistic/function-paren-newline": ["warn", "consistent"],
144
+ "@stylistic/linebreak-style": ["error", "unix"],
145
+ "@stylistic/lines-between-class-members": ["warn", "always", { "exceptAfterSingleLine": true }],
146
+ "@stylistic/object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }],
147
+ "@stylistic/operator-linebreak": ["warn", "before"],
148
+ "@stylistic/padded-blocks": ["error", "never"],
149
+ "@stylistic/quote-props": ["error", "consistent-as-needed"],
150
+ "@stylistic/quotes": ["warn", "single"],
151
+ "@stylistic/semi": ["error", "always"],
152
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
153
+ "@stylistic/generator-star-spacing": ["warn", { "before": false, "after": true }],
154
+ "@stylistic/indent": ["warn", 2],
155
+ "@stylistic/max-len": ["off"],
156
+ "@stylistic/object-curly-spacing": ["warn", "always"],
139
157
 
140
- "@typescript-eslint/naming-convention": [
141
- "warn",
142
- {
143
- "selector": "default",
144
- "format": ["camelCase"],
145
- "leadingUnderscore": "allowSingleOrDouble"
146
- },
147
- {
148
- "selector": "enumMember",
149
- "format": ["PascalCase"]
150
- },
151
- {
152
- "selector": "typeLike",
153
- "format": ["PascalCase"]
154
- }
155
- ],
156
- "@typescript-eslint/member-delimiter-style": ["error", {
158
+ "@stylistic/member-delimiter-style": ["error", {
157
159
  "multiline": {
158
160
  "delimiter": "comma",
159
161
  "requireLast": false
@@ -171,6 +173,24 @@
171
173
  }
172
174
  }
173
175
  }],
176
+
177
+ "@typescript-eslint/naming-convention": [
178
+ "warn",
179
+ {
180
+ "selector": "default",
181
+ "format": ["camelCase"],
182
+ "leadingUnderscore": "allowSingleOrDouble"
183
+ },
184
+ {
185
+ "selector": "enumMember",
186
+ "format": ["PascalCase"]
187
+ },
188
+ {
189
+ "selector": "typeLike",
190
+ "format": ["PascalCase"]
191
+ }
192
+ ],
193
+
174
194
  "@typescript-eslint/member-ordering": ["warn", {
175
195
  "default": [
176
196
  // Index signature
@@ -4,22 +4,24 @@ export declare class JsonPath<T = any> implements Iterable<JsonPathNode> {
4
4
  private readonly _options;
5
5
  private _path;
6
6
  private _nodes;
7
- /** json path as encoded string */
7
+ /** Json path as encoded string */
8
8
  get path(): string;
9
- /** json path as decoded array */
9
+ /** Json path as decoded array */
10
10
  get nodes(): readonly JsonPathNode[];
11
11
  static get ROOT(): JsonPath;
12
12
  constructor(options?: JsonPathOptions);
13
13
  constructor(path: JsonPathInput, options?: JsonPathOptions);
14
+ static from(options?: JsonPathOptions): JsonPath;
15
+ static from(path: JsonPathInput, options?: JsonPathOptions): JsonPath;
14
16
  static isJsonPath(path: string): boolean;
15
17
  /**
16
- * add a property or index to current path
18
+ * Add a property or index to current path
17
19
  * @param key
18
20
  * @returns new JsonPath instance
19
21
  */
20
22
  add<K extends keyof T>(key: K): JsonPath<T[K]>;
21
23
  /**
22
- * updates options
24
+ * Updates options
23
25
  * @param options
24
26
  * @returns new JsonPath instance
25
27
  */
@@ -27,9 +29,9 @@ export declare class JsonPath<T = any> implements Iterable<JsonPathNode> {
27
29
  [Symbol.iterator](): Iterator<PropertyKey>;
28
30
  }
29
31
  export type JsonPathOptions = {
30
- /** encode as array.0 instead of array[0] */
32
+ /** Encode as array.0 instead of array[0] */
31
33
  treatArrayAsObject?: boolean;
32
- /** encode as ['foo'] instead of .foo */
34
+ /** Encode as ['foo'] instead of .foo */
33
35
  forceBrackets?: boolean;
34
36
  /**
35
37
  * Prepend $
@@ -38,12 +40,12 @@ export type JsonPathOptions = {
38
40
  dollar?: boolean;
39
41
  };
40
42
  export type JsonPathContext = {
41
- /** if path contains symbols, they are required in order to be mapped, otherwise they are created from global symbol registry */
43
+ /** If path contains symbols, they are required in order to be mapped, otherwise they are created from global symbol registry */
42
44
  symbols?: symbol[];
43
45
  };
44
46
  export declare function isJsonPath(path: string): boolean;
45
47
  /**
46
- * encodes an array of nodes into a JSONPath
48
+ * Encodes an array of nodes into a JSONPath
47
49
  * @param nodes nodes to encode
48
50
  * @param options encoding options
49
51
  * @returns JSONPath string
@@ -53,7 +55,7 @@ export declare function isJsonPath(path: string): boolean;
53
55
  */
54
56
  export declare function encodeJsonPath(nodes: readonly JsonPathNode[], options?: JsonPathOptions): string;
55
57
  /**
56
- * decodes a JSONPath into its nodes. Only supports child operator
58
+ * Decodes a JSONPath into its nodes. Only supports child operator
57
59
  * @param path JSONPath string
58
60
  * @returns array of nodes
59
61
  * @example
@@ -6,14 +6,14 @@ export class JsonPath {
6
6
  _options;
7
7
  _path;
8
8
  _nodes;
9
- /** json path as encoded string */
9
+ /** Json path as encoded string */
10
10
  get path() {
11
11
  if (isUndefined(this._path)) {
12
12
  this._path = encodeJsonPath(this._nodes, this._options);
13
13
  }
14
14
  return this._path;
15
15
  }
16
- /** json path as decoded array */
16
+ /** Json path as decoded array */
17
17
  get nodes() {
18
18
  if (isUndefined(this._nodes)) {
19
19
  this._nodes = decodeJsonPath(this._path);
@@ -42,11 +42,14 @@ export class JsonPath {
42
42
  this._options = pathOrNodesOrOptions;
43
43
  }
44
44
  }
45
+ static from(pathOrNodesOrOptions = [], options = {}) {
46
+ return new JsonPath(pathOrNodesOrOptions, options);
47
+ }
45
48
  static isJsonPath(path) {
46
49
  return isJsonPath(path);
47
50
  }
48
51
  /**
49
- * add a property or index to current path
52
+ * Add a property or index to current path
50
53
  * @param key
51
54
  * @returns new JsonPath instance
52
55
  */
@@ -54,7 +57,7 @@ export class JsonPath {
54
57
  return new JsonPath([...this.nodes, key], this._options);
55
58
  }
56
59
  /**
57
- * updates options
60
+ * Updates options
58
61
  * @param options
59
62
  * @returns new JsonPath instance
60
63
  */
@@ -69,7 +72,7 @@ export function isJsonPath(path) {
69
72
  return parsePattern.test(path);
70
73
  }
71
74
  /**
72
- * encodes an array of nodes into a JSONPath
75
+ * Encodes an array of nodes into a JSONPath
73
76
  * @param nodes nodes to encode
74
77
  * @param options encoding options
75
78
  * @returns JSONPath string
@@ -106,7 +109,7 @@ export function encodeJsonPath(nodes, options = {}) {
106
109
  return path.slice(1);
107
110
  }
108
111
  /**
109
- * decodes a JSONPath into its nodes. Only supports child operator
112
+ * Decodes a JSONPath into its nodes. Only supports child operator
110
113
  * @param path JSONPath string
111
114
  * @returns array of nodes
112
115
  * @example
@@ -1,3 +1,5 @@
1
1
  import type { ComponentClass, FunctionComponent, VNode } from 'preact';
2
2
  export declare function renderJsx(template: FunctionComponent<void> | ComponentClass<void, void> | VNode): string;
3
3
  export declare function renderJsx<Properties>(template: FunctionComponent<Properties> | ComponentClass<Properties, any>, properties: Properties): string;
4
+ export declare function renderJsxAsync(template: FunctionComponent<void> | ComponentClass<void, void> | VNode): Promise<string>;
5
+ export declare function renderJsxAsync<Properties>(template: FunctionComponent<Properties> | ComponentClass<Properties, any>, properties: Properties): Promise<string>;
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx } from "preact/jsx-runtime";
2
2
  import { isFunction } from '../utils/type-guards.js';
3
- import { render } from 'preact-render-to-string';
3
+ import { renderToString, renderToStringAsync } from 'preact-render-to-string';
4
4
  export function renderJsx(Template, properties) {
5
5
  if (isFunction(Template)) {
6
- return render(_jsx(Template, { ...properties }));
6
+ return renderToString(_jsx(Template, { ...properties }));
7
7
  }
8
- return render(Template);
8
+ return renderToString(Template);
9
+ }
10
+ export async function renderJsxAsync(Template, properties) {
11
+ if (isFunction(Template)) {
12
+ return renderToStringAsync(_jsx(Template, { ...properties }));
13
+ }
14
+ return renderToStringAsync(Template);
9
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.90.57",
3
+ "version": "0.90.59",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,7 +13,7 @@
13
13
  "build:production:copy-files": "cp package.json .eslintrc.json tsconfig.server.json dist/ && cp tsconfig.base.json dist/tsconfig.json",
14
14
  "build:docs": "typedoc",
15
15
  "build:docs:watch": "typedoc --watch",
16
- "lint": "eslint -c .eslintrc.json --ext .ts .",
16
+ "lint": "eslint --config .eslintrc.json --cache source/",
17
17
  "pub": "npm run build:production && rm -vf dist/test* && npm publish dist/",
18
18
  "tsc:watch": "tsc --watch",
19
19
  "tsc-alias:watch": "tsc-alias --watch"
@@ -113,6 +113,7 @@
113
113
  },
114
114
  "devDependencies": {
115
115
  "@mxssfd/typedoc-theme": "1.1",
116
+ "@stylistic/eslint-plugin": "1.6",
116
117
  "@types/chroma-js": "2.4",
117
118
  "@types/koa__router": "12.0",
118
119
  "@types/luxon": "3.4",
@@ -120,17 +121,16 @@
120
121
  "@types/mjml": "4.7",
121
122
  "@types/node": "20",
122
123
  "@types/nodemailer": "6.4",
123
- "@typescript-eslint/eslint-plugin": "6.21",
124
- "@typescript-eslint/parser": "6.21",
125
124
  "concurrently": "8.2",
126
125
  "esbuild": "0.20",
127
- "eslint": "8.56",
126
+ "eslint": "8.57",
128
127
  "eslint-import-resolver-typescript": "3.6",
129
128
  "eslint-plugin-import": "2.29",
130
129
  "tsc-alias": "1.8",
131
130
  "typedoc": "0.25",
132
131
  "typedoc-plugin-missing-exports": "2.2",
133
- "typescript": "5.3"
132
+ "typescript": "5.3",
133
+ "typescript-eslint": "7.1"
134
134
  },
135
135
  "peerDependencies": {
136
136
  "@elastic/elasticsearch": "^8.12",
@@ -145,11 +145,11 @@
145
145
  "koa": "^2.15",
146
146
  "minio": "^7.1",
147
147
  "mjml": "^4.15",
148
- "mongodb": "^6.3",
148
+ "mongodb": "^6.4",
149
149
  "nodemailer": "^6.9",
150
- "playwright": "^1.41",
150
+ "playwright": "^1.42",
151
151
  "preact": "^10.19",
152
- "preact-render-to-string": "^6.3",
152
+ "preact-render-to-string": "^6.4",
153
153
  "undici": "^6.6",
154
154
  "urlpattern-polyfill": "^10.0"
155
155
  },
@@ -1,10 +1,8 @@
1
1
  import type { CollectionArgument, MongoRepositoryConfig } from '../../database/mongo/index.js';
2
- import type { Resolvable } from '../../injector/interfaces.js';
3
- import { resolveArgumentType } from '../../injector/interfaces.js';
2
+ import { resolveArgumentType, type Resolvable } from '../../injector/interfaces.js';
4
3
  import { LockProvider } from '../../lock/index.js';
5
4
  import { MessageBusProvider } from '../../message-bus/index.js';
6
- import type { QueueConfig } from '../../queue/index.js';
7
- import { QueueProvider } from '../../queue/index.js';
5
+ import { QueueProvider, type QueueConfig } from '../../queue/index.js';
8
6
  import type { MongoJob } from './job.js';
9
7
  import { MongoJobRepository } from './mongo-job.repository.js';
10
8
  import { MongoQueue } from './queue.js';
@@ -1,4 +1,4 @@
1
- import type { RandomNumberGeneratorFn } from './number-generator/random-number-generator-function.js';
1
+ import { type RandomNumberGeneratorFn } from './number-generator/random-number-generator-function.js';
2
2
  export type RandomSeriesOptions = {
3
3
  /**
4
4
  * Initial value of series. If [number, number] is provided, a random value in that range is generated. If not provided but {@link RandomSeriesOptions.bounds} are, their values are used.
@@ -1,7 +1,7 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
2
  import type { Decorator } from '../../reflection/index.js';
3
3
  import { SchemaValueConstraint } from '../types/schema-value-constraint.js';
4
- import type { ConstraintContext, ConstraintResult } from '../types/types.js';
4
+ import { type ConstraintContext, type ConstraintResult } from '../types/types.js';
5
5
  export declare class MaximumConstraint extends SchemaValueConstraint {
6
6
  private readonly maximum;
7
7
  readonly suitableTypes: NumberConstructor;
@@ -1,7 +1,7 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
2
  import type { Decorator } from '../../reflection/index.js';
3
3
  import { SchemaValueConstraint } from '../types/schema-value-constraint.js';
4
- import type { ConstraintContext, ConstraintResult } from '../types/types.js';
4
+ import { type ConstraintContext, type ConstraintResult } from '../types/types.js';
5
5
  export declare class MinimumDateConstraint extends SchemaValueConstraint {
6
6
  private readonly minimum;
7
7
  readonly suitableTypes: NumberConstructor;
@@ -1,7 +1,7 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
2
  import type { Decorator } from '../../reflection/index.js';
3
3
  import { SchemaValueConstraint } from '../types/schema-value-constraint.js';
4
- import type { ConstraintContext, ConstraintResult } from '../types/types.js';
4
+ import { type ConstraintContext, type ConstraintResult } from '../types/types.js';
5
5
  export declare class MinimumConstraint extends SchemaValueConstraint {
6
6
  private readonly minimum;
7
7
  readonly suitableTypes: NumberConstructor;
@@ -1,7 +1,7 @@
1
1
  import type { JsonPath } from '../../json-path/json-path.js';
2
2
  import type { Decorator } from '../../reflection/index.js';
3
3
  import { SchemaValueConstraint } from '../types/schema-value-constraint.js';
4
- import type { ConstraintContext, ConstraintResult } from '../types/types.js';
4
+ import { type ConstraintContext, type ConstraintResult } from '../types/types.js';
5
5
  export declare class PatternConstraint extends SchemaValueConstraint {
6
6
  private readonly pattern;
7
7
  private readonly patternName;
@@ -53,9 +53,9 @@ export type ValueSchema<T = unknown> = {
53
53
  array?: boolean;
54
54
  optional?: boolean;
55
55
  nullable?: boolean;
56
- /** use default coercers */
56
+ /** Use default coercers */
57
57
  coerce?: boolean;
58
- /** custom coercers */
58
+ /** Custom coercers */
59
59
  coercers?: OneOrMany<SchemaValueCoercer>;
60
60
  transformers?: OneOrMany<SchemaValueTransformer>;
61
61
  arrayConstraints?: OneOrMany<SchemaArrayConstraint>;
@@ -1,9 +1,6 @@
1
1
  import type { ElasticQuery } from '../model/elastic-query.js';
2
2
  export declare class BoolQueryBuilder {
3
- private readonly _must;
4
- private readonly _should;
5
- private readonly _mustNot;
6
- private readonly _filter;
3
+ #private;
7
4
  get totalQueries(): number;
8
5
  constructor();
9
6
  build(): ElasticQuery;