sprint-es 0.0.57 → 0.0.58
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/cjs/index.cjs +13 -3
- package/dist/esm/index.js +13 -3
- package/dist/types/sprint.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -62,6 +62,14 @@ function matchesPatterns(patterns, routePath) {
|
|
|
62
62
|
function stripRouteGroups(routePath) {
|
|
63
63
|
return routePath.split("/").filter((segment) => !/^\(.+\)$/.test(segment)).join("/") || "/";
|
|
64
64
|
}
|
|
65
|
+
function deepMerge(target, source) {
|
|
66
|
+
const output = { ...target };
|
|
67
|
+
for (const key in source) {
|
|
68
|
+
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) output[key] = deepMerge(output[key] ?? {}, source[key]);
|
|
69
|
+
else output[key] = source[key];
|
|
70
|
+
}
|
|
71
|
+
return output;
|
|
72
|
+
}
|
|
65
73
|
const nodeEnv = process.env.NODE_ENV?.toLowerCase();
|
|
66
74
|
const isDev = nodeEnv === "development";
|
|
67
75
|
const isProd = nodeEnv === "production";
|
|
@@ -136,7 +144,7 @@ class Sprint {
|
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
};
|
|
139
|
-
const finalConfig =
|
|
147
|
+
const finalConfig = deepMerge(defaults, config || {});
|
|
140
148
|
this.port = finalConfig.port;
|
|
141
149
|
this.routesPath = finalConfig.routesPath || "./routes";
|
|
142
150
|
this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
|
|
@@ -467,14 +475,16 @@ class Sprint {
|
|
|
467
475
|
const bold = "\x1B[1m";
|
|
468
476
|
const cyan = "\x1B[36m";
|
|
469
477
|
const dim = "\x1B[2m";
|
|
478
|
+
const VERSION = process.env.npm_package_version;
|
|
470
479
|
console.log("");
|
|
471
|
-
console.log(` ${bold}${cyan}Sprint${reset} ready to handle requests`);
|
|
480
|
+
if (VERSION) console.log(` ${bold}${cyan}Sprint${reset} v${VERSION} ready to handle requests`);
|
|
481
|
+
else console.log(` ${bold}${cyan}Sprint${reset} ready to handle requests`);
|
|
472
482
|
console.log("");
|
|
473
483
|
console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
|
|
474
484
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
475
485
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}${this.prefix}/healthcheck`);
|
|
476
486
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.prefix}/openapi.json`);
|
|
477
|
-
if (this.openapi.
|
|
487
|
+
if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.prefix}/swagger`);
|
|
478
488
|
console.log("");
|
|
479
489
|
console.log(` ${dim}Tip: Need stronger route protection? Learn more at${reset}`);
|
|
480
490
|
console.log(` ${dim}https://docs.tpeoficial.com/docs/dymo-api/private/request-verifier${reset}`);
|
package/dist/esm/index.js
CHANGED
|
@@ -37,6 +37,14 @@ function matchesPatterns(patterns, routePath) {
|
|
|
37
37
|
function stripRouteGroups(routePath) {
|
|
38
38
|
return routePath.split("/").filter((segment) => !/^\(.+\)$/.test(segment)).join("/") || "/";
|
|
39
39
|
}
|
|
40
|
+
function deepMerge(target, source) {
|
|
41
|
+
const output = { ...target };
|
|
42
|
+
for (const key in source) {
|
|
43
|
+
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) output[key] = deepMerge(output[key] ?? {}, source[key]);
|
|
44
|
+
else output[key] = source[key];
|
|
45
|
+
}
|
|
46
|
+
return output;
|
|
47
|
+
}
|
|
40
48
|
const nodeEnv = process.env.NODE_ENV?.toLowerCase();
|
|
41
49
|
const isDev = nodeEnv === "development";
|
|
42
50
|
const isProd = nodeEnv === "production";
|
|
@@ -111,7 +119,7 @@ class Sprint {
|
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
};
|
|
114
|
-
const finalConfig =
|
|
122
|
+
const finalConfig = deepMerge(defaults, config || {});
|
|
115
123
|
this.port = finalConfig.port;
|
|
116
124
|
this.routesPath = finalConfig.routesPath || "./routes";
|
|
117
125
|
this.middlewaresPath = finalConfig.middlewaresPath || "./middlewares";
|
|
@@ -442,14 +450,16 @@ class Sprint {
|
|
|
442
450
|
const bold = "\x1B[1m";
|
|
443
451
|
const cyan = "\x1B[36m";
|
|
444
452
|
const dim = "\x1B[2m";
|
|
453
|
+
const VERSION = process.env.npm_package_version;
|
|
445
454
|
console.log("");
|
|
446
|
-
console.log(` ${bold}${cyan}Sprint${reset} ready to handle requests`);
|
|
455
|
+
if (VERSION) console.log(` ${bold}${cyan}Sprint${reset} v${VERSION} ready to handle requests`);
|
|
456
|
+
else console.log(` ${bold}${cyan}Sprint${reset} ready to handle requests`);
|
|
447
457
|
console.log("");
|
|
448
458
|
console.log(` ${dim}Local:${reset} http://localhost:${bold}${port}${reset}`);
|
|
449
459
|
console.log(` ${dim}Prefix:${reset} ${bold}${prefixInfo}${reset}`);
|
|
450
460
|
console.log(` ${dim}Healthcheck:${reset} http://localhost:${port}${this.prefix}/healthcheck`);
|
|
451
461
|
if (this.openapi.generateOnBuild) console.log(` ${dim}OpenAPI Spec:${reset} http://localhost:${port}${this.prefix}/openapi.json`);
|
|
452
|
-
if (this.openapi.
|
|
462
|
+
if (this.openapi.swaggerUi.enabled) console.log(` ${dim}Swagger UI:${reset} http://localhost:${port}${this.prefix}/swagger`);
|
|
453
463
|
console.log("");
|
|
454
464
|
console.log(` ${dim}Tip: Need stronger route protection? Learn more at${reset}`);
|
|
455
465
|
console.log(` ${dim}https://docs.tpeoficial.com/docs/dymo-api/private/request-verifier${reset}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprint.d.ts","sourceRoot":"","sources":["../../src/sprint.ts"],"names":[],"mappings":"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,EAAE,OAAO,EAAE,OAAO;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACrC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACpC,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,gBAAgB,EAAE,YAAY,CAAC,EAAE,OAAO;IAYlF,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CA4DzC"}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ export declare function matchesPatterns(patterns: string[], routePath: string):
|
|
|
19
19
|
* Example: "(group)/(subgroup)/api/users" -> "/api/users"
|
|
20
20
|
*/
|
|
21
21
|
export declare function stripRouteGroups(routePath: string): string;
|
|
22
|
+
export declare function deepMerge<T>(target: T, source: Partial<T>): T;
|
|
22
23
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,SAAiC,CAAC;AACpD,eAAO,MAAM,SAAS,SAAqC,CAAC;AAE5D,QAAA,IAAI,UAAU,EAAE,MAAM,CAAC;AACvB,QAAA,IAAI,SAAS,EAAE,MAAM,CAAC;AAYtB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAEjC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAoBxE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK1D"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src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