@chainfuse/helpers 3.1.0 → 3.2.1
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/discord.d.mts +3 -3
- package/dist/net.d.mts +12 -12
- package/dist/net.mjs +22 -1
- package/package.json +7 -7
package/dist/discord.d.mts
CHANGED
|
@@ -23,15 +23,15 @@ export declare class DiscordHelpers {
|
|
|
23
23
|
color: z.ZodDefault<z.ZodBoolean>;
|
|
24
24
|
custom: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
level: number;
|
|
27
26
|
error: number;
|
|
27
|
+
level: number;
|
|
28
28
|
color: boolean;
|
|
29
29
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
30
30
|
}, {
|
|
31
|
-
level?: number | undefined;
|
|
32
31
|
error?: number | undefined;
|
|
33
|
-
color?: boolean | undefined;
|
|
34
32
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
33
|
+
level?: number | undefined;
|
|
34
|
+
color?: boolean | undefined;
|
|
35
35
|
}>>>;
|
|
36
36
|
static discordRest(apiKey: string, logging: z.input<Awaited<ReturnType<typeof DiscordHelpers.disordRestLogging>>>, cacheTtl?: number, forceCache?: boolean, executionContext?: ExecutionContext, restOptions?: Partial<Omit<RESTOptions, 'agent' | 'authPrefix' | 'makeRequest'>>): Promise<import("@discordjs/rest").REST>;
|
|
37
37
|
static userIcon(userId: bigint | string, userIconHash?: Parameters<CDN['avatar']>[1] | null, guildId?: bigint | string, memberIconHash?: Parameters<CDN['avatar']>[1] | null, options?: Parameters<CDN['avatar']>[2]): string;
|
package/dist/net.d.mts
CHANGED
|
@@ -23,15 +23,15 @@ export declare class NetHelpers {
|
|
|
23
23
|
color: z.ZodDefault<z.ZodBoolean>;
|
|
24
24
|
custom: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
level: number;
|
|
27
26
|
error: number;
|
|
27
|
+
level: number;
|
|
28
28
|
color: boolean;
|
|
29
29
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
30
30
|
}, {
|
|
31
|
-
level?: number | undefined;
|
|
32
31
|
error?: number | undefined;
|
|
33
|
-
color?: boolean | undefined;
|
|
34
32
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
33
|
+
level?: number | undefined;
|
|
34
|
+
color?: boolean | undefined;
|
|
35
35
|
}>>>;
|
|
36
36
|
/**
|
|
37
37
|
* Creates an instance of the Cloudflare API client with enhanced logging capabilities.
|
|
@@ -59,29 +59,29 @@ export declare class NetHelpers {
|
|
|
59
59
|
color: z.ZodDefault<z.ZodBoolean>;
|
|
60
60
|
custom: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
level: number;
|
|
63
62
|
error: number;
|
|
63
|
+
level: number;
|
|
64
64
|
color: boolean;
|
|
65
65
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
66
66
|
}, {
|
|
67
|
-
level?: number | undefined;
|
|
68
67
|
error?: number | undefined;
|
|
69
|
-
color?: boolean | undefined;
|
|
70
68
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
69
|
+
level?: number | undefined;
|
|
70
|
+
color?: boolean | undefined;
|
|
71
71
|
}>>;
|
|
72
72
|
}, "strip", z.ZodTypeAny, {
|
|
73
73
|
logging: {
|
|
74
|
-
level: number;
|
|
75
74
|
error: number;
|
|
75
|
+
level: number;
|
|
76
76
|
color: boolean;
|
|
77
77
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
78
78
|
};
|
|
79
79
|
}, {
|
|
80
80
|
logging?: {
|
|
81
|
-
level?: number | undefined;
|
|
82
81
|
error?: number | undefined;
|
|
83
|
-
color?: boolean | undefined;
|
|
84
82
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
83
|
+
level?: number | undefined;
|
|
84
|
+
color?: boolean | undefined;
|
|
85
85
|
} | undefined;
|
|
86
86
|
}>>;
|
|
87
87
|
static loggingFetchInitLogging(): Promise<z.ZodDefault<z.ZodObject<{
|
|
@@ -90,15 +90,15 @@ export declare class NetHelpers {
|
|
|
90
90
|
color: z.ZodDefault<z.ZodBoolean>;
|
|
91
91
|
custom: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnion<[z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
92
92
|
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
level: number;
|
|
94
93
|
error: number;
|
|
94
|
+
level: number;
|
|
95
95
|
color: boolean;
|
|
96
96
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
97
97
|
}, {
|
|
98
|
-
level?: number | undefined;
|
|
99
98
|
error?: number | undefined;
|
|
100
|
-
color?: boolean | undefined;
|
|
101
99
|
custom?: ((...args: unknown[]) => void | Promise<void>) | undefined;
|
|
100
|
+
level?: number | undefined;
|
|
101
|
+
color?: boolean | undefined;
|
|
102
102
|
}>>>;
|
|
103
103
|
/**
|
|
104
104
|
* A utility function that wraps the native `fetch` API with enhanced capabilities.
|
package/dist/net.mjs
CHANGED
|
@@ -396,7 +396,28 @@ export class NetHelpers {
|
|
|
396
396
|
static stripSensitiveHeaders(originalHeaders = new Headers()) {
|
|
397
397
|
const mutableHeaders = new Headers(originalHeaders);
|
|
398
398
|
mutableHeaders.delete('Set-Cookie');
|
|
399
|
-
mutableHeaders.
|
|
399
|
+
if (mutableHeaders.has('Authorization')) {
|
|
400
|
+
const split = mutableHeaders.get('Authorization').split(' ');
|
|
401
|
+
if (split.length > 1) {
|
|
402
|
+
const [scheme, ...parameters] = split;
|
|
403
|
+
const maskedValue = parameters.join(' ').replaceAll(/./g, '*');
|
|
404
|
+
mutableHeaders.set('Authorization', `${scheme} ${maskedValue}`);
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
mutableHeaders.delete('Authorization');
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (mutableHeaders.has('cf-aig-authorization')) {
|
|
411
|
+
const split = mutableHeaders.get('cf-aig-authorization').split(' ');
|
|
412
|
+
if (split.length > 1) {
|
|
413
|
+
const [scheme, ...parameters] = split;
|
|
414
|
+
const maskedValue = parameters.join(' ').replaceAll(/./g, '*');
|
|
415
|
+
mutableHeaders.set('cf-aig-authorization', `${scheme} ${maskedValue}`);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
mutableHeaders.delete('cf-aig-authorization');
|
|
419
|
+
}
|
|
420
|
+
}
|
|
400
421
|
return mutableHeaders;
|
|
401
422
|
}
|
|
402
423
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainfuse/helpers",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "ChainFuse",
|
|
6
6
|
"homepage": "https://github.com/ChainFuse/packages/tree/main/packages/helpers#readme",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
},
|
|
49
49
|
"prettier": "@demosjarco/prettier-config",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@discordjs/rest": "^2.
|
|
51
|
+
"@discordjs/rest": "^2.5.0",
|
|
52
52
|
"chalk": "^5.4.1",
|
|
53
53
|
"cloudflare": "^4.2.0",
|
|
54
54
|
"strip-ansi": "^7.1.0",
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
|
-
"zod": "^3.24.
|
|
56
|
+
"zod": "^3.24.4"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@chainfuse/types": "^2.10.
|
|
60
|
-
"@cloudflare/workers-types": "^4.
|
|
61
|
-
"@types/node": "^22.14
|
|
59
|
+
"@chainfuse/types": "^2.10.6",
|
|
60
|
+
"@cloudflare/workers-types": "^4.20250507.0",
|
|
61
|
+
"@types/node": "^22.15.14"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "3ef29119ac1926fbbee7f9545e18d7732a86a5ff"
|
|
64
64
|
}
|