@lokalise/fastify-extras 11.0.0 → 13.0.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/plugins/amplitudePlugin.d.ts +1 -1
- package/dist/plugins/bugsnagPlugin.d.ts +4 -1
- package/dist/plugins/metricsPlugin.d.ts +4 -1
- package/dist/plugins/metricsPlugin.js +3 -0
- package/dist/plugins/metricsPlugin.js.map +1 -1
- package/dist/plugins/newrelicTransactionManagerPlugin.d.ts +4 -1
- package/dist/plugins/opentelemetry/prismaOtelTracingPlugin.d.ts +4 -1
- package/dist/plugins/publicHealthcheckPlugin.d.ts +3 -1
- package/dist/plugins/requestContextProviderPlugin.d.ts +4 -2
- package/dist/plugins/requestContextProviderPlugin.js.map +1 -1
- package/dist/plugins/splitIOFeatureManagerPlugin.d.ts +4 -1
- package/package.json +26 -26
|
@@ -52,7 +52,7 @@ export interface AmplitudeConfig {
|
|
|
52
52
|
* })
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare const amplitudePlugin: import("fastify").FastifyPluginCallback<AmplitudeConfig, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault>;
|
|
55
|
+
export declare const amplitudePlugin: import("fastify").FastifyPluginCallback<AmplitudeConfig, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>;
|
|
56
56
|
export declare class Amplitude {
|
|
57
57
|
private readonly isEnabled;
|
|
58
58
|
constructor(isEnabled: boolean);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Event, NotifiableError } from '@bugsnag/js';
|
|
2
2
|
import type { NodeConfig } from '@bugsnag/node';
|
|
3
|
+
import type { FastifyInstance } from 'fastify';
|
|
3
4
|
export type Severity = Event['severity'];
|
|
4
5
|
export interface ErrorReport {
|
|
5
6
|
error: NotifiableError;
|
|
@@ -12,4 +13,6 @@ export interface BugsnagPluginConfig {
|
|
|
12
13
|
bugsnag: NodeConfig;
|
|
13
14
|
isEnabled: boolean;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
declare function plugin(app: FastifyInstance, opts: BugsnagPluginConfig, done: () => void): void;
|
|
17
|
+
export declare const bugsnagPlugin: typeof plugin;
|
|
18
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
1
2
|
import type { PinoLoggerOptions } from 'fastify/types/logger';
|
|
2
3
|
export type ErrorObjectResolver = (err: unknown, correlationID?: string) => unknown;
|
|
3
4
|
export interface MetricsPluginOptions {
|
|
@@ -6,4 +7,6 @@ export interface MetricsPluginOptions {
|
|
|
6
7
|
bindAddress?: string;
|
|
7
8
|
errorObjectResolver: ErrorObjectResolver;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
declare function plugin(app: FastifyInstance, opts: MetricsPluginOptions): Promise<void>;
|
|
11
|
+
export declare const metricsPlugin: typeof plugin;
|
|
12
|
+
export {};
|
|
@@ -47,6 +47,9 @@ function plugin(app, opts) {
|
|
|
47
47
|
const logObject = opts.errorObjectResolver(err);
|
|
48
48
|
promServer.log.error(logObject);
|
|
49
49
|
throw new Error('Critical error when trying to launch metrics server');
|
|
50
|
+
})
|
|
51
|
+
.then(() => {
|
|
52
|
+
// this is to consume string which plugin does not expect
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
exports.metricsPlugin = (0, fastify_plugin_1.default)(plugin, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metricsPlugin.js","sourceRoot":"","sources":["../../lib/plugins/metricsPlugin.ts"],"names":[],"mappings":";;;;AACA,8DAA6B;AAE7B,8EAA4C;AAC5C,4EAA+B;AAE/B,MAAM,YAAY,GAAG,IAAI,CAAA;AAWzB,SAAS,MAAM,CAAC,GAAoB,EAAE,IAA0B;IAC9D,KAAK,GAAG,CAAC,QAAQ,CAAC,yBAAc,EAAE;QAChC,cAAc,EAAE,EAAE,OAAO,EAAE,I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I,CAAC,OAAO,CAAC,CAAA;QAC/C,CAAC;KACF,CAAC,CAAA;IAEF,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAChC,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU;SACd,MAAM,CAAC;QACN,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,IAAI,CAAC,WAAW;QACtB,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC9B,OAAO,0CAA0C,OAAO,EAAE,CAAA;QAC5D,CAAC;KACF,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;QAC/C,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;QAC/B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;IACxE,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,yDAAyD;IAC3D,CAAC,CAAC,CAAA;AACN,CAAC;AAEY,QAAA,aAAa,GAAG,IAAA,wBAAE,EAAC,MAAM,EAAE;IACtC,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,gBAAgB;CACvB,CAAC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
1
2
|
declare module 'fastify' {
|
|
2
3
|
interface FastifyInstance {
|
|
3
4
|
newrelicTransactionManager: NewRelicTransactionManager;
|
|
@@ -14,4 +15,6 @@ export declare class NewRelicTransactionManager {
|
|
|
14
15
|
start(jobName: string): void;
|
|
15
16
|
stop(jobId: string): void;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
declare function plugin(fastify: FastifyInstance, opts: NewRelicTransactionManagerOptions, done: () => void): void;
|
|
19
|
+
export declare const newrelicTransactionManagerPlugin: typeof plugin;
|
|
20
|
+
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
1
2
|
export interface PrismaOtelTracingPluginConfig {
|
|
2
3
|
isEnabled: boolean;
|
|
3
4
|
useBatchSpans: boolean;
|
|
4
5
|
samplingRatio: number;
|
|
5
6
|
serviceName: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
declare function plugin(app: FastifyInstance, opts: PrismaOtelTracingPluginConfig, done: () => void): void;
|
|
9
|
+
export declare const prismaOtelTracingPlugin: typeof plugin;
|
|
10
|
+
export {};
|
|
@@ -5,4 +5,6 @@ export interface PublicHealthcheckPluginOptions {
|
|
|
5
5
|
healthChecks: readonly HealthCheck[];
|
|
6
6
|
}
|
|
7
7
|
export type HealthCheck = (app: FastifyInstance) => Promise<Either<Error, true>>;
|
|
8
|
-
|
|
8
|
+
declare function plugin(app: FastifyInstance, opts: PublicHealthcheckPluginOptions, done: () => void): void;
|
|
9
|
+
export declare const publicHealthcheckPlugin: typeof plugin;
|
|
10
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FastifyServerOptions, FastifyBaseLogger } from 'fastify';
|
|
1
|
+
import type { FastifyInstance, FastifyServerOptions, FastifyBaseLogger } from 'fastify';
|
|
2
2
|
export declare const REQUEST_ID_STORE_KEY = "request_id";
|
|
3
3
|
declare module 'fastify' {
|
|
4
4
|
interface FastifyRequest {
|
|
@@ -19,4 +19,6 @@ declare module '@fastify/request-context' {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export declare function getRequestIdFastifyAppConfig(): Pick<FastifyServerOptions, 'genReqId' | 'requestIdHeader'>;
|
|
22
|
-
|
|
22
|
+
declare function plugin(fastify: FastifyInstance, opts: unknown, done: () => void): void;
|
|
23
|
+
export declare const requestContextProviderPlugin: typeof plugin;
|
|
24
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestContextProviderPlugin.js","sourceRoot":"","sources":["../../lib/plugins/requestContextProviderPlugin.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AAEnC,8DAAyD;AASzD,4EAA+B;AAElB,QAAA,oBAAoB,GAAG,YAAY,CAAA;AAyBhD,SAAgB,4BAA4B;IAI1C,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,mBAAU,GAAE;QAC5B,eAAe,EAAE,cAAc;KAChC,CAAA;AACH,CAAC;AARD,oEAQC;AAED,SAAS,MAAM,CAAC,OAAwB,EAAE,IAAa,EAAE,IAAgB;IACvE,OAAO,CAAC,OAAO,CACb,WAAW,EACX,CAAC,GAAmB,EAAE,GAAiB,EAAE,IAA6B,EAAE,EAAE;QACxE,GAAG,CAAC,UAAU,GAAG;YACf,MAAM,EAAE,GAAG,CAAC,GAAG;YACf,KAAK,EAAE,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"requestContextProviderPlugin.js","sourceRoot":"","sources":["../../lib/plugins/requestContextProviderPlugin.ts"],"names":[],"mappings":";;;;AAAA,mCAAmC;AAEnC,8DAAyD;AASzD,4EAA+B;AAElB,QAAA,oBAAoB,GAAG,YAAY,CAAA;AAyBhD,SAAgB,4BAA4B;IAI1C,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,mBAAU,GAAE;QAC5B,eAAe,EAAE,cAAc;KAChC,CAAA;AACH,CAAC;AARD,oEAQC;AAED,SAAS,MAAM,CAAC,OAAwB,EAAE,IAAa,EAAE,IAAgB;IACvE,OAAO,CAAC,OAAO,CACb,WAAW,EACX,CAAC,GAAmB,EAAE,GAAiB,EAAE,IAA6B,EAAE,EAAE;QACxE,GAAG,CAAC,UAAU,GAAG;YACf,MAAM,EAAE,GAAG,CAAC,GAAG;YACf,KAAK,EAAE,GAAG,CAAC,EAAE;SACd,CAAA;QAED,0GAA0G;QAC1G,gCAAc,CAAC,GAAG,CAAC,4BAAoB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;QAEhD,IAAI,EAAE,CAAA;IACR,CAAC,CACF,CAAA;IAED,OAAO,CAAC,OAAO,CACb,QAAQ,EACR,CAAC,GAAmB,EAAE,GAAiB,EAAE,OAAO,EAAE,IAA6B,EAAE,EAAE;QACjF,KAAK,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;QACvC,IAAI,EAAE,CAAA;IACR,CAAC,CACF,CAAA;IAED,IAAI,EAAE,CAAA;AACR,CAAC;AAEY,QAAA,4BAA4B,GAAG,IAAA,wBAAE,EAAC,MAAM,EAAE;IACrD,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,iCAAiC;CACxC,CAAC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type SplitIO from '@splitsoftware/splitio/types/splitio';
|
|
2
2
|
import type { Attributes, Properties, SplitKey, Treatment, TreatmentWithConfig } from '@splitsoftware/splitio/types/splitio';
|
|
3
|
+
import type { FastifyInstance } from 'fastify';
|
|
3
4
|
declare module 'fastify' {
|
|
4
5
|
interface FastifyInstance {
|
|
5
6
|
splitIOFeatureManager: SplitIOFeatureManager;
|
|
@@ -21,4 +22,6 @@ export declare class SplitIOFeatureManager {
|
|
|
21
22
|
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
|
|
22
23
|
shutdown(): Promise<void>;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
declare function plugin(fastify: FastifyInstance, opts: SplitIOOptions, done: () => void): void;
|
|
26
|
+
export declare const splitIOFeatureManagerPlugin: typeof plugin;
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/fastify-extras",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Opinionated set of fastify plugins, commonly used in Lokalise",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Lokalise",
|
|
@@ -43,51 +43,51 @@
|
|
|
43
43
|
"version": "auto-changelog -p && git add CHANGELOG.md"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@bugsnag/js": "^7.
|
|
46
|
+
"@bugsnag/js": "^7.21.0",
|
|
47
47
|
"@opentelemetry/api": "^1.4.1",
|
|
48
|
-
"@opentelemetry/exporter-trace-otlp-grpc": "^0.
|
|
49
|
-
"@opentelemetry/instrumentation": "^0.
|
|
48
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.41.0",
|
|
49
|
+
"@opentelemetry/instrumentation": "^0.41.0",
|
|
50
50
|
"@opentelemetry/resources": "^1.14.0",
|
|
51
51
|
"@opentelemetry/sdk-trace-base": "^1.14.0",
|
|
52
52
|
"@opentelemetry/sdk-trace-node": "^1.14.0",
|
|
53
53
|
"@opentelemetry/semantic-conventions": "^1.14.0",
|
|
54
|
-
"@prisma/instrumentation": "^
|
|
55
|
-
"@splitsoftware/splitio": "^10.22.
|
|
56
|
-
"@amplitude/analytics-node": "^1.3.
|
|
54
|
+
"@prisma/instrumentation": "^5.2.0",
|
|
55
|
+
"@splitsoftware/splitio": "^10.22.6",
|
|
56
|
+
"@amplitude/analytics-node": "^1.3.1",
|
|
57
57
|
"fastify-metrics": "^10.3.0",
|
|
58
|
-
"fastify-plugin": "^4.5.
|
|
59
|
-
"tslib": "^2.
|
|
58
|
+
"fastify-plugin": "^4.5.1",
|
|
59
|
+
"tslib": "^2.6.2"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@fastify/request-context": "^5.0.0",
|
|
63
|
-
"fastify": "^4.
|
|
64
|
-
"newrelic": "^
|
|
65
|
-
"pino": "^8.
|
|
63
|
+
"fastify": "^4.22.2",
|
|
64
|
+
"newrelic": "^11.0.0",
|
|
65
|
+
"pino": "^8.15.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@fastify/request-context": "^5.0.0",
|
|
69
|
-
"@lokalise/node-core": "^
|
|
70
|
-
"@types/jest": "^29.5.
|
|
69
|
+
"@lokalise/node-core": "^6.2.0",
|
|
70
|
+
"@types/jest": "^29.5.3",
|
|
71
71
|
"@types/newrelic": "^9.14.0",
|
|
72
|
-
"@types/node": "^18.16.
|
|
72
|
+
"@types/node": "^18.16.19",
|
|
73
73
|
"@amplitude/analytics-types": "^2.1.1",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
75
|
-
"@typescript-eslint/parser": "^5.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
75
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
76
76
|
"auto-changelog": "^2.4.0",
|
|
77
|
-
"eslint": "^8.
|
|
77
|
+
"eslint": "^8.44.0",
|
|
78
78
|
"eslint-config-prettier": "^8.8.0",
|
|
79
79
|
"eslint-plugin-import": "^2.27.5",
|
|
80
80
|
"eslint-plugin-jest": "^27.2.2",
|
|
81
|
-
"eslint-plugin-prettier": "^
|
|
82
|
-
"fastify": "^4.
|
|
83
|
-
"jest": "^29.
|
|
84
|
-
"newrelic": "
|
|
85
|
-
"pino": "^8.
|
|
86
|
-
"prettier": "^
|
|
81
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
82
|
+
"fastify": "^4.22.2",
|
|
83
|
+
"jest": "^29.6.4",
|
|
84
|
+
"newrelic": "11.0.0",
|
|
85
|
+
"pino": "^8.15.0",
|
|
86
|
+
"prettier": "^3.0.0",
|
|
87
87
|
"shx": "^0.3.4",
|
|
88
|
-
"ts-jest": "^29.1.
|
|
88
|
+
"ts-jest": "^29.1.1",
|
|
89
89
|
"ts-node": "^10.9.1",
|
|
90
|
-
"typescript": "^5.
|
|
90
|
+
"typescript": "^5.2.2"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
93
|
"node": ">=18"
|