@xenterprises/fastify-xconfig 2.0.1 → 2.0.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xenterprises/fastify-xconfig",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "description": "Fastify configuration plugin for setting up middleware, services, and route handling.",
6
6
  "main": "src/xConfig.js",
7
7
  "scripts": {
@@ -11,6 +11,14 @@
11
11
  },
12
12
  "author": "Tim Mushen",
13
13
  "license": "ISC",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://gitlab.com/x-enterprises/fastify-plugins/fastify-x-config"
17
+ },
18
+ "bugs": {
19
+ "url": "https://gitlab.com/x-enterprises/fastify-plugins/fastify-x-config/-/issues"
20
+ },
21
+ "homepage": "https://gitlab.com/x-enterprises/fastify-plugins/fastify-x-config#readme",
14
22
  "devDependencies": {
15
23
  "@types/node": "^22.7.4",
16
24
  "c8": "^9.0.0",
@@ -1,7 +1,7 @@
1
1
  import fp from "fastify-plugin";
2
2
 
3
3
  async function formatBytesPlugin(fastify, options) {
4
- fastify.decorate("formatBytes", (bytes, decimals = 2) => {
4
+ fastify.decorate("xFormatBytes", (bytes, decimals = 2) => {
5
5
  if (bytes === 0) return "0 Bytes";
6
6
 
7
7
  const k = 1024;
@@ -2,7 +2,7 @@
2
2
  import fp from "fastify-plugin";
3
3
 
4
4
  async function xSlugify(fastify, options) {
5
- fastify.decorate('slugify', (string) => {
5
+ fastify.decorate('xSlugify', (string) => {
6
6
  return string
7
7
  .toString()
8
8
  .toLowerCase() // Convert to lowercase
@@ -2,9 +2,9 @@ import fp from "fastify-plugin";
2
2
  import { randomUUID } from "uncrypto";
3
3
 
4
4
  async function xUUID(fastify, options) {
5
- fastify.decorate("generateUUID", randomUUID);
5
+ fastify.decorate("xGenerateUUID", randomUUID);
6
6
 
7
- fastify.decorate('randomUUID', () => {
7
+ fastify.decorate('xRandomUUID', () => {
8
8
  return randomUUID(); // Generate a UUID using uncrypto's randomUUID
9
9
  });
10
10
  }
@@ -133,11 +133,11 @@ test("xConfig Utilities - xUUID generates valid UUIDs", async () => {
133
133
  try {
134
134
  await fastify.register(xConfig, minimalConfig);
135
135
 
136
- const uuid1 = fastify.randomUUID();
137
- const uuid2 = fastify.randomUUID();
136
+ const uuid1 = fastify.xRandomUUID();
137
+ const uuid2 = fastify.xRandomUUID();
138
138
 
139
139
  // Check that randomUUID is a function
140
- assert.equal(typeof fastify.randomUUID, "function", "randomUUID is a function");
140
+ assert.equal(typeof fastify.xRandomUUID, "function", "randomUUID is a function");
141
141
 
142
142
  // Check that UUIDs are generated
143
143
  assert.ok(uuid1, "UUID is generated");
@@ -159,21 +159,21 @@ test("xConfig Utilities - xSlugify handles various inputs", async () => {
159
159
  await fastify.register(xConfig, minimalConfig);
160
160
 
161
161
  // Test basic slugification
162
- assert.equal(fastify.slugify("Hello World"), "hello-world", "Converts to lowercase and replaces spaces");
163
- assert.equal(fastify.slugify("UPPERCASE"), "uppercase", "Converts uppercase to lowercase");
164
- assert.equal(fastify.slugify("Multiple Spaces"), "multiple-spaces", "Collapses multiple spaces");
162
+ assert.equal(fastify.xSlugify("Hello World"), "hello-world", "Converts to lowercase and replaces spaces");
163
+ assert.equal(fastify.xSlugify("UPPERCASE"), "uppercase", "Converts uppercase to lowercase");
164
+ assert.equal(fastify.xSlugify("Multiple Spaces"), "multiple-spaces", "Collapses multiple spaces");
165
165
 
166
166
  // Test special character removal
167
- assert.equal(fastify.slugify("Hello@World!"), "helloworld", "Removes special characters");
168
- assert.equal(fastify.slugify("Test-String"), "test-string", "Preserves dashes");
167
+ assert.equal(fastify.xSlugify("Hello@World!"), "helloworld", "Removes special characters");
168
+ assert.equal(fastify.xSlugify("Test-String"), "test-string", "Preserves dashes");
169
169
 
170
170
  // Test edge cases
171
- assert.equal(fastify.slugify(" Trim "), "trim", "Trims leading and trailing spaces");
172
- assert.equal(fastify.slugify("---multiple-dashes---"), "multiple-dashes", "Collapses multiple dashes");
173
- assert.equal(fastify.slugify(""), "", "Handles empty string");
171
+ assert.equal(fastify.xSlugify(" Trim "), "trim", "Trims leading and trailing spaces");
172
+ assert.equal(fastify.xSlugify("---multiple-dashes---"), "multiple-dashes", "Collapses multiple dashes");
173
+ assert.equal(fastify.xSlugify(""), "", "Handles empty string");
174
174
 
175
175
  // Test with numbers
176
- assert.equal(fastify.slugify("Test123"), "test123", "Preserves numbers");
176
+ assert.equal(fastify.xSlugify("Test123"), "test123", "Preserves numbers");
177
177
  } finally {
178
178
  await fastify.close();
179
179
  }
@@ -263,15 +263,15 @@ test("xConfig Integration - all decorators available together", async () => {
263
263
 
264
264
  // Verify all expected decorators exist
265
265
  assert.ok(fastify.xEcho, "xEcho decorator available");
266
- assert.ok(fastify.randomUUID, "randomUUID decorator available");
267
- assert.ok(fastify.generateUUID, "generateUUID decorator available");
268
- assert.ok(fastify.slugify, "slugify decorator available");
266
+ assert.ok(fastify.xRandomUUID, "randomUUID decorator available");
267
+ assert.ok(fastify.xGenerateUUID, "generateUUID decorator available");
268
+ assert.ok(fastify.xSlugify, "slugify decorator available");
269
269
 
270
270
  // Verify they're functions
271
271
  assert.equal(typeof fastify.xEcho, "function", "xEcho is a function");
272
- assert.equal(typeof fastify.randomUUID, "function", "randomUUID is a function");
273
- assert.equal(typeof fastify.generateUUID, "function", "generateUUID is a function");
274
- assert.equal(typeof fastify.slugify, "function", "slugify is a function");
272
+ assert.equal(typeof fastify.xRandomUUID, "function", "randomUUID is a function");
273
+ assert.equal(typeof fastify.xGenerateUUID, "function", "generateUUID is a function");
274
+ assert.equal(typeof fastify.xSlugify, "function", "slugify is a function");
275
275
  } finally {
276
276
  await fastify.close();
277
277
  }