@myxtra/microservice 0.1.1 → 0.2.0
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 +17 -3
- package/package.json +6 -6
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
@@ -5053,7 +5053,7 @@ var require_parseDef = __commonJS({
|
|
5053
5053
|
case zod_1.ZodFirstPartyTypeKind.ZodSymbol:
|
5054
5054
|
return void 0;
|
5055
5055
|
default:
|
5056
|
-
return ((_) => void 0)(typeName);
|
5056
|
+
return /* @__PURE__ */ ((_) => void 0)(typeName);
|
5057
5057
|
}
|
5058
5058
|
};
|
5059
5059
|
var addMeta = (def, refs, jsonSchema) => {
|
@@ -5172,7 +5172,7 @@ var require_zod_to_json_schema = __commonJS({
|
|
5172
5172
|
var require_dist = __commonJS({
|
5173
5173
|
"../../node_modules/fastify-type-provider-zod/dist/index.js"(exports) {
|
5174
5174
|
"use strict";
|
5175
|
-
var __extends = exports && exports.__extends || function() {
|
5175
|
+
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
5176
5176
|
var extendStatics = function(d, b) {
|
5177
5177
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
5178
5178
|
d2.__proto__ = b2;
|
@@ -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.
|
3
|
+
"version": "0.2.0",
|
4
4
|
"main": "./dist/index.mjs",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"publishConfig": {
|
@@ -20,15 +20,15 @@
|
|
20
20
|
"typecheck": "tsc --noEmit"
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
|
-
"@myxtra/api": "0.
|
23
|
+
"@myxtra/api": "0.2.0"
|
24
24
|
},
|
25
25
|
"devDependencies": {
|
26
|
-
"@myxtra/eslint-config": "1.
|
26
|
+
"@myxtra/eslint-config": "1.13.0",
|
27
27
|
"@tsconfig/node18": "^18.2.2",
|
28
|
-
"eslint": "^8.
|
28
|
+
"eslint": "^8.54.0",
|
29
29
|
"fastify-type-provider-zod": "^1.1.9",
|
30
|
-
"tsup": "^
|
31
|
-
"typescript": "^5.
|
30
|
+
"tsup": "^8.0.1",
|
31
|
+
"typescript": "^5.3.2"
|
32
32
|
},
|
33
33
|
"peerDependencies": {
|
34
34
|
"@fastify/swagger": ">=8.0.0",
|