@chainfuse/helpers 3.4.2 → 3.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db.d.mts +2 -2
- package/dist/net.mjs +68 -19
- package/package.json +8 -8
package/dist/db.d.mts
CHANGED
|
@@ -34,8 +34,8 @@ export declare class SQLCache<C extends CacheStorageLike> extends DrizzleCache {
|
|
|
34
34
|
cacheTTL: z.ZodDefault<z.ZodInt>;
|
|
35
35
|
cachePurge: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodDate]>>;
|
|
36
36
|
strategy: z.ZodDefault<z.ZodEnum<{
|
|
37
|
-
explicit: "explicit";
|
|
38
37
|
all: "all";
|
|
38
|
+
explicit: "explicit";
|
|
39
39
|
}>>;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
41
|
/**
|
|
@@ -56,7 +56,7 @@ export declare class SQLCache<C extends CacheStorageLike> extends DrizzleCache {
|
|
|
56
56
|
* - `all`: All queries are cached globally.
|
|
57
57
|
* @default 'explicit'
|
|
58
58
|
*/
|
|
59
|
-
strategy(): "
|
|
59
|
+
strategy(): "all" | "explicit";
|
|
60
60
|
/**
|
|
61
61
|
* Generates a cache key as a `Request` object based on the provided tag or key.
|
|
62
62
|
*
|
package/dist/net.mjs
CHANGED
|
@@ -69,17 +69,14 @@ export class NetHelpers {
|
|
|
69
69
|
const customHeaders = new Headers(headers);
|
|
70
70
|
if (customHeaders.has('cf-ray')) {
|
|
71
71
|
args.splice(3, 0, customHeaders.get('cf-ray'));
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
82
|
-
.catch(() => { });
|
|
72
|
+
if ('color' in logging && logging.color) {
|
|
73
|
+
await import('chalk')
|
|
74
|
+
.then(({ Chalk }) => new Chalk({ level: 2 }))
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
76
|
+
.then((chalk) => args.splice(3, 1, chalk.rgb(255, 102, 51)(customHeaders.get('cf-ray'))))
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
78
|
+
.catch(() => { });
|
|
79
|
+
}
|
|
83
80
|
}
|
|
84
81
|
if ('custom' in logging && logging.custom) {
|
|
85
82
|
// We faked level 1 as 2 to get headers for ray-id
|
|
@@ -104,8 +101,21 @@ export class NetHelpers {
|
|
|
104
101
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
105
102
|
.map((value) => (value instanceof Date && !isNaN(value.getTime()) ? value.toISOString() : value))
|
|
106
103
|
// Wrap id in brackets
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
.map((value) => {
|
|
105
|
+
if (value === id) {
|
|
106
|
+
const wrappedString = `[${stripAnsi(id)}]`;
|
|
107
|
+
if (logging.color) {
|
|
108
|
+
return chalk.rgb(...Helpers.uniqueIdColor(stripAnsi(id)))(wrappedString);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
return wrappedString;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
})
|
|
109
119
|
// Strip out redundant parts of url
|
|
110
120
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
111
121
|
.map((value) => (value === url ? `${customUrl.pathname}${customUrl.search}${customUrl.hash}` : value)));
|
|
@@ -119,8 +129,21 @@ export class NetHelpers {
|
|
|
119
129
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
120
130
|
.map((value) => (value instanceof Date && !isNaN(value.getTime()) ? value.toISOString() : value))
|
|
121
131
|
// Wrap id in brackets
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
.map((value) => {
|
|
133
|
+
if (value === id) {
|
|
134
|
+
const wrappedString = `[${stripAnsi(id)}]`;
|
|
135
|
+
if (logging.color) {
|
|
136
|
+
return chalk.rgb(...Helpers.uniqueIdColor(stripAnsi(id)))(wrappedString);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return wrappedString;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
144
|
+
return value;
|
|
145
|
+
}
|
|
146
|
+
})
|
|
124
147
|
// Strip out redundant parts of url
|
|
125
148
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
126
149
|
.map((value) => (value === url ? `${customUrl.pathname}${customUrl.search}${customUrl.hash}` : value)));
|
|
@@ -133,8 +156,21 @@ export class NetHelpers {
|
|
|
133
156
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
134
157
|
.map((value) => (value instanceof Date && !isNaN(value.getTime()) ? value.toISOString() : value))
|
|
135
158
|
// Wrap id in brackets
|
|
136
|
-
|
|
137
|
-
|
|
159
|
+
.map((value) => {
|
|
160
|
+
if (value === id) {
|
|
161
|
+
const wrappedString = `[${stripAnsi(id)}]`;
|
|
162
|
+
if (logging.color) {
|
|
163
|
+
return chalk.rgb(...Helpers.uniqueIdColor(stripAnsi(id)))(wrappedString);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return wrappedString;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
171
|
+
return value;
|
|
172
|
+
}
|
|
173
|
+
})
|
|
138
174
|
// Strip out redundant parts of url
|
|
139
175
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
140
176
|
.map((value) => (value === url ? `${customUrl.pathname}${customUrl.search}${customUrl.hash}` : value)));
|
|
@@ -147,8 +183,21 @@ export class NetHelpers {
|
|
|
147
183
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
148
184
|
.map((value) => (value instanceof Date && !isNaN(value.getTime()) ? value.toISOString() : value))
|
|
149
185
|
// Wrap id in brackets
|
|
150
|
-
|
|
151
|
-
|
|
186
|
+
.map((value) => {
|
|
187
|
+
if (value === id) {
|
|
188
|
+
const wrappedString = `[${stripAnsi(id)}]`;
|
|
189
|
+
if (logging.color) {
|
|
190
|
+
return chalk.rgb(...Helpers.uniqueIdColor(stripAnsi(id)))(wrappedString);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
return wrappedString;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
198
|
+
return value;
|
|
199
|
+
}
|
|
200
|
+
})
|
|
152
201
|
// Strip out redundant parts of url
|
|
153
202
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
154
203
|
.map((value) => (value === url ? `${customUrl.pathname}${customUrl.search}${customUrl.hash}` : value)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainfuse/helpers",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "ChainFuse",
|
|
6
6
|
"homepage": "https://github.com/ChainFuse/packages/tree/main/packages/helpers#readme",
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
},
|
|
77
77
|
"prettier": "@demosjarco/prettier-config",
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@chainfuse/types": "^2.10.
|
|
80
|
-
"@discordjs/rest": "^2.5.
|
|
79
|
+
"@chainfuse/types": "^2.10.25",
|
|
80
|
+
"@discordjs/rest": "^2.5.1",
|
|
81
81
|
"chalk": "^5.4.1",
|
|
82
|
-
"cloudflare": "^4.
|
|
82
|
+
"cloudflare": "^4.4.1",
|
|
83
83
|
"drizzle-orm": "^0.44.2",
|
|
84
84
|
"strip-ansi": "^7.1.0",
|
|
85
85
|
"uuid": "^11.1.0",
|
|
86
|
-
"zod": "^3.25.
|
|
86
|
+
"zod": "^3.25.76"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@cloudflare/workers-types": "^4.
|
|
90
|
-
"@types/node": "^22.
|
|
89
|
+
"@cloudflare/workers-types": "^4.20250708.0",
|
|
90
|
+
"@types/node": "^22.16.0"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "01d3b71baf251aaa852be29d0eaa92224e44496a"
|
|
93
93
|
}
|