sprint-es 0.0.145 → 0.0.147
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
CHANGED
|
@@ -908,7 +908,7 @@ function createSchemaValidationMiddleware(schema) {
|
|
|
908
908
|
if (!authValue) errors.push({ location: "sprint.authorization", path: "authorization", message: "Authorization header or query parameter not found" });
|
|
909
909
|
else req.sprint.authorization = authValue;
|
|
910
910
|
}
|
|
911
|
-
const errorCode =
|
|
911
|
+
const errorCode = errors.length === 1 && errors[0]?.location === "sprint.authorization" ? 401 : 400;
|
|
912
912
|
if (errors.length > 0) return res.status(errorCode).json({ error: "Validation failed", details: errors });
|
|
913
913
|
next();
|
|
914
914
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -883,7 +883,7 @@ function createSchemaValidationMiddleware(schema) {
|
|
|
883
883
|
if (!authValue) errors.push({ location: "sprint.authorization", path: "authorization", message: "Authorization header or query parameter not found" });
|
|
884
884
|
else req.sprint.authorization = authValue;
|
|
885
885
|
}
|
|
886
|
-
const errorCode =
|
|
886
|
+
const errorCode = errors.length === 1 && errors[0]?.location === "sprint.authorization" ? 401 : 400;
|
|
887
887
|
if (errors.length > 0) return res.status(errorCode).json({ error: "Validation failed", details: errors });
|
|
888
888
|
next();
|
|
889
889
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhD,YAAY,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGjL,eAAO,MAAM,MAAM,kDAAwB,CAAC;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
package/dist/types/globals.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Express {
|
|
3
|
-
interface Request {
|
|
4
|
-
sprint: {
|
|
5
|
-
getAuthorization: (sources?: (`query:${string}` | `headers:${string}`) | (`query:${string}` | `headers:${string}`)[]) => string | undefined;
|
|
6
|
-
authorization?: string;
|
|
7
|
-
};
|
|
8
|
-
custom: any;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=globals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,OAAO,CAAC;QACd,UAAU,OAAO;YACb,MAAM,EAAE;gBACJ,gBAAgB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC,GAAG,CAAC,SAAS,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC,EAAE,KAAK,MAAM,GAAG,SAAS,CAAC;gBAC5I,aAAa,CAAC,EAAE,MAAM,CAAC;aAC1B,CAAC;YACF,MAAM,EAAE,GAAG,CAAC;SACf;KACJ;CACJ;AAED,OAAO,EAAG,CAAC"}
|