apitally 0.21.2 → 0.21.3
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/adonisjs/provider.cjs +15 -9
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.js +15 -9
- package/dist/adonisjs/provider.js.map +1 -1
- package/dist/common/client.cjs +14 -9
- package/dist/common/client.cjs.map +1 -1
- package/dist/common/client.d.cts +1 -1
- package/dist/common/client.d.ts +1 -1
- package/dist/common/client.js +14 -9
- package/dist/common/client.js.map +1 -1
- package/dist/common/response.cjs +21 -2
- package/dist/common/response.cjs.map +1 -1
- package/dist/common/response.d.cts +2 -1
- package/dist/common/response.d.ts +2 -1
- package/dist/common/response.js +19 -1
- package/dist/common/response.js.map +1 -1
- package/dist/elysia/index.cjs +40 -16
- package/dist/elysia/index.cjs.map +1 -1
- package/dist/elysia/index.js +40 -16
- package/dist/elysia/index.js.map +1 -1
- package/dist/elysia/plugin.cjs +40 -16
- package/dist/elysia/plugin.cjs.map +1 -1
- package/dist/elysia/plugin.js +40 -16
- package/dist/elysia/plugin.js.map +1 -1
- package/dist/express/index.cjs +15 -9
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.js +15 -9
- package/dist/express/index.js.map +1 -1
- package/dist/express/middleware.cjs +15 -9
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.js +15 -9
- package/dist/express/middleware.js.map +1 -1
- package/dist/fastify/index.cjs +15 -9
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.js +15 -9
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/plugin.cjs +15 -9
- package/dist/fastify/plugin.cjs.map +1 -1
- package/dist/fastify/plugin.js +15 -9
- package/dist/fastify/plugin.js.map +1 -1
- package/dist/h3/index.cjs +15 -9
- package/dist/h3/index.cjs.map +1 -1
- package/dist/h3/index.js +15 -9
- package/dist/h3/index.js.map +1 -1
- package/dist/h3/plugin.cjs +15 -9
- package/dist/h3/plugin.cjs.map +1 -1
- package/dist/h3/plugin.js +15 -9
- package/dist/h3/plugin.js.map +1 -1
- package/dist/hapi/index.cjs +15 -9
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.js +15 -9
- package/dist/hapi/index.js.map +1 -1
- package/dist/hapi/plugin.cjs +15 -9
- package/dist/hapi/plugin.cjs.map +1 -1
- package/dist/hapi/plugin.js +15 -9
- package/dist/hapi/plugin.js.map +1 -1
- package/dist/hono/index.cjs +15 -9
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.js +15 -9
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +15 -9
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.js +15 -9
- package/dist/hono/middleware.js.map +1 -1
- package/dist/koa/index.cjs +15 -9
- package/dist/koa/index.cjs.map +1 -1
- package/dist/koa/index.js +15 -9
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/middleware.cjs +15 -9
- package/dist/koa/middleware.cjs.map +1 -1
- package/dist/koa/middleware.js +15 -9
- package/dist/koa/middleware.js.map +1 -1
- package/dist/nestjs/index.cjs +16 -9
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +16 -9
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +1 -1
package/dist/fastify/plugin.js
CHANGED
|
@@ -5293,11 +5293,14 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5293
5293
|
if (_ApitallyClient.instance) {
|
|
5294
5294
|
throw new Error("Apitally client is already initialized");
|
|
5295
5295
|
}
|
|
5296
|
+
this.logger = logger ?? getLogger();
|
|
5296
5297
|
if (!isValidClientId(clientId)) {
|
|
5297
|
-
|
|
5298
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
5299
|
+
this.enabled = false;
|
|
5298
5300
|
}
|
|
5299
5301
|
if (!isValidEnv(env)) {
|
|
5300
|
-
|
|
5302
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
5303
|
+
this.enabled = false;
|
|
5301
5304
|
}
|
|
5302
5305
|
if (requestLoggingConfig && !requestLogging) {
|
|
5303
5306
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -5312,8 +5315,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5312
5315
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
5313
5316
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
5314
5317
|
this.consumerRegistry = new ConsumerRegistry();
|
|
5315
|
-
this.logger = logger ?? getLogger();
|
|
5316
|
-
this.startSync();
|
|
5317
5318
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
5318
5319
|
}
|
|
5319
5320
|
static getInstance() {
|
|
@@ -5368,15 +5369,20 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5368
5369
|
}
|
|
5369
5370
|
}
|
|
5370
5371
|
startSync() {
|
|
5372
|
+
if (!this.enabled) {
|
|
5373
|
+
return;
|
|
5374
|
+
}
|
|
5371
5375
|
this.sync();
|
|
5372
5376
|
this.syncIntervalId = setInterval(() => {
|
|
5373
5377
|
this.sync();
|
|
5374
5378
|
}, INITIAL_SYNC_INTERVAL);
|
|
5375
5379
|
setTimeout(() => {
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
this.
|
|
5379
|
-
|
|
5380
|
+
if (this.syncIntervalId) {
|
|
5381
|
+
clearInterval(this.syncIntervalId);
|
|
5382
|
+
this.syncIntervalId = setInterval(() => {
|
|
5383
|
+
this.sync();
|
|
5384
|
+
}, SYNC_INTERVAL);
|
|
5385
|
+
}
|
|
5380
5386
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
5381
5387
|
}
|
|
5382
5388
|
async sync() {
|
|
@@ -5404,7 +5410,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5404
5410
|
setStartupData(data) {
|
|
5405
5411
|
this.startupData = data;
|
|
5406
5412
|
this.startupDataSent = false;
|
|
5407
|
-
this.sendStartupData();
|
|
5408
5413
|
}
|
|
5409
5414
|
async sendStartupData() {
|
|
5410
5415
|
if (this.startupData) {
|
|
@@ -5916,6 +5921,7 @@ var apitallyPlugin = /* @__PURE__ */ __name(async (fastify, config) => {
|
|
|
5916
5921
|
});
|
|
5917
5922
|
fastify.addHook("onReady", () => {
|
|
5918
5923
|
client.setStartupData(getAppInfo(routes, config.appVersion));
|
|
5924
|
+
client.startSync();
|
|
5919
5925
|
});
|
|
5920
5926
|
fastify.addHook("onClose", async () => {
|
|
5921
5927
|
await client.handleShutdown();
|