@chainfuse/helpers 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/dist/net.mjs +29 -3
  2. package/package.json +2 -2
package/dist/net.mjs CHANGED
@@ -30,7 +30,7 @@ export class NetHelpers {
30
30
  const customHeaders = new Headers(headers);
31
31
  await import('chalk')
32
32
  .then(({ Chalk }) => {
33
- const chalk = new Chalk({ level: 2 });
33
+ const chalk = new Chalk({ level: 3 });
34
34
  // Replace with color
35
35
  loggingItems.splice(0, 1, chalk.rgb(245, 130, 30)('CF Rest'));
36
36
  // Add in with color
@@ -69,8 +69,32 @@ export class NetHelpers {
69
69
  }
70
70
  await Promise.all([import('chalk'), import("./index.mjs")])
71
71
  .then(([{ Chalk }, { Helpers }]) => {
72
- const chalk = new Chalk({ level: 2 });
72
+ const chalk = new Chalk({ level: 3 });
73
73
  loggingItems.splice(1, 1, chalk.rgb(...Helpers.uniqueIdColor(id))(`[${id}]`));
74
+ const initMethod = loggingItems[2].toUpperCase();
75
+ /**
76
+ * @link https://github.com/swagger-api/swagger-ui/blob/master/src/style/_variables.scss#L48-L53
77
+ */
78
+ switch (initMethod) {
79
+ case 'POST':
80
+ loggingItems.splice(2, 1, chalk.hex('#49cc90')(initMethod));
81
+ break;
82
+ case 'GET':
83
+ loggingItems.splice(2, 1, chalk.hex('#61affe')(initMethod));
84
+ break;
85
+ case 'PUT':
86
+ loggingItems.splice(2, 1, chalk.hex('#fca130')(initMethod));
87
+ break;
88
+ case 'DELETE':
89
+ loggingItems.splice(2, 1, chalk.hex('#f93e3e')(initMethod));
90
+ break;
91
+ case 'HEAD':
92
+ loggingItems.splice(2, 1, chalk.hex('#9012fe')(initMethod));
93
+ break;
94
+ case 'PATCH':
95
+ loggingItems.splice(2, 1, chalk.hex('#50e3c2')(initMethod));
96
+ break;
97
+ }
74
98
  })
75
99
  // eslint-disable-next-line @typescript-eslint/no-empty-function
76
100
  .catch(() => { });
@@ -81,6 +105,7 @@ export class NetHelpers {
81
105
  }
82
106
  }
83
107
  else {
108
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
84
109
  await logger(...loggingItems);
85
110
  }
86
111
  return id;
@@ -101,7 +126,7 @@ export class NetHelpers {
101
126
  }
102
127
  await Promise.all([import('chalk'), import("./index.mjs")])
103
128
  .then(([{ Chalk }, { Helpers }]) => {
104
- const chalk = new Chalk({ level: 2 });
129
+ const chalk = new Chalk({ level: 3 });
105
130
  loggingItems.splice(1, 1, chalk.rgb(...Helpers.uniqueIdColor(id))(`[${id}]`));
106
131
  loggingItems.splice(2, 1, response.ok ? chalk.green(response.status) : chalk.red(response.status));
107
132
  })
@@ -114,6 +139,7 @@ export class NetHelpers {
114
139
  }
115
140
  }
116
141
  else {
142
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
117
143
  await logger(...loggingItems);
118
144
  }
119
145
  resolve(response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainfuse/helpers",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "",
5
5
  "author": "ChainFuse",
6
6
  "homepage": "https://github.com/ChainFuse/packages/tree/main/packages/helpers#readme",
@@ -58,5 +58,5 @@
58
58
  "@cloudflare/workers-types": "^4.20250410.0",
59
59
  "@types/node": "^22.14.0"
60
60
  },
61
- "gitHead": "c480462d073b3d89c915eb003b0ba789fe79d414"
61
+ "gitHead": "c131e6b181f7cd1f4c25732c8141b340e5d9a6d3"
62
62
  }