@myxtra/microservice 0.1.1 → 0.1.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/dist/index.d.mts +10 -1
- package/dist/index.mjs +15 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -54,4 +54,13 @@ declare const getLanguage: (acceptLanguage?: string) => Language;
|
|
54
54
|
declare const DEFAULT_SPEC_FILE_URL = "../.azure/apim/swagger.json";
|
55
55
|
declare const generateSwagger: (app: FastifyInstance, specFile: URL) => void;
|
56
56
|
|
57
|
-
|
57
|
+
declare const getTechnicalContext: (request: FastifyRequest) => {
|
58
|
+
webSignature: {
|
59
|
+
userAgent: string;
|
60
|
+
originUrl: string;
|
61
|
+
remoteIPAddress: string;
|
62
|
+
signatureDate: string;
|
63
|
+
};
|
64
|
+
};
|
65
|
+
|
66
|
+
export { DEFAULT_SPEC_FILE_URL, MOCKED_BEARER_TOKEN, MOCKED_JWT_HEADER, MOCKED_JWT_NAME, MOCKED_JWT_PAYLOAD, MOCKED_JWT_SIGNATURE, createApi, generateSwagger, getLanguage, getTechnicalContext, _default$1 as swagger, validationError, _default as zod };
|
package/dist/index.mjs
CHANGED
@@ -9105,7 +9105,7 @@ var zod = (app, options, done) => {
|
|
9105
9105
|
app.setValidatorCompiler(import_fastify_type_provider_zod2.validatorCompiler);
|
9106
9106
|
app.setSerializerCompiler(import_fastify_type_provider_zod2.serializerCompiler);
|
9107
9107
|
app.setErrorHandler((error, request, reply) => {
|
9108
|
-
if (error
|
9108
|
+
if (error.name === "ZodError") {
|
9109
9109
|
const problemJson = error.flatten();
|
9110
9110
|
return reply.status(400).send({
|
9111
9111
|
url: request.url,
|
@@ -9159,6 +9159,19 @@ var generateSwagger = (app, specFile) => {
|
|
9159
9159
|
return app.log.info(`Saved api spec to ${specFile.href}`);
|
9160
9160
|
});
|
9161
9161
|
};
|
9162
|
+
|
9163
|
+
// src/utils/technicalContext.ts
|
9164
|
+
import "@myxtra/api";
|
9165
|
+
import "fastify";
|
9166
|
+
var getTechnicalContext = (request) => {
|
9167
|
+
const userAgent = request.headers["user-agent"] ?? "";
|
9168
|
+
const originUrl = request.url;
|
9169
|
+
const remoteIPAddress = request.ip;
|
9170
|
+
const signatureDate = (/* @__PURE__ */ new Date()).toISOString();
|
9171
|
+
return {
|
9172
|
+
webSignature: { userAgent, originUrl, remoteIPAddress, signatureDate }
|
9173
|
+
};
|
9174
|
+
};
|
9162
9175
|
export {
|
9163
9176
|
DEFAULT_SPEC_FILE_URL,
|
9164
9177
|
MOCKED_BEARER_TOKEN,
|
@@ -9169,6 +9182,7 @@ export {
|
|
9169
9182
|
createApi,
|
9170
9183
|
generateSwagger,
|
9171
9184
|
getLanguage,
|
9185
|
+
getTechnicalContext,
|
9172
9186
|
swagger_default as swagger,
|
9173
9187
|
validationError,
|
9174
9188
|
zod_default as zod
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@myxtra/microservice",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.2",
|
4
4
|
"main": "./dist/index.mjs",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"publishConfig": {
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"@myxtra/api": "0.1.
|
23
|
+
"@myxtra/api": "0.1.2"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
26
|
"@myxtra/eslint-config": "1.12.0",
|