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/index.cjs
CHANGED
|
@@ -5301,11 +5301,14 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5301
5301
|
if (_ApitallyClient.instance) {
|
|
5302
5302
|
throw new Error("Apitally client is already initialized");
|
|
5303
5303
|
}
|
|
5304
|
+
this.logger = logger ?? getLogger();
|
|
5304
5305
|
if (!isValidClientId(clientId)) {
|
|
5305
|
-
|
|
5306
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
5307
|
+
this.enabled = false;
|
|
5306
5308
|
}
|
|
5307
5309
|
if (!isValidEnv(env)) {
|
|
5308
|
-
|
|
5310
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
5311
|
+
this.enabled = false;
|
|
5309
5312
|
}
|
|
5310
5313
|
if (requestLoggingConfig && !requestLogging) {
|
|
5311
5314
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -5320,8 +5323,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5320
5323
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
5321
5324
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
5322
5325
|
this.consumerRegistry = new ConsumerRegistry();
|
|
5323
|
-
this.logger = logger ?? getLogger();
|
|
5324
|
-
this.startSync();
|
|
5325
5326
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
5326
5327
|
}
|
|
5327
5328
|
static getInstance() {
|
|
@@ -5376,15 +5377,20 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5376
5377
|
}
|
|
5377
5378
|
}
|
|
5378
5379
|
startSync() {
|
|
5380
|
+
if (!this.enabled) {
|
|
5381
|
+
return;
|
|
5382
|
+
}
|
|
5379
5383
|
this.sync();
|
|
5380
5384
|
this.syncIntervalId = setInterval(() => {
|
|
5381
5385
|
this.sync();
|
|
5382
5386
|
}, INITIAL_SYNC_INTERVAL);
|
|
5383
5387
|
setTimeout(() => {
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
this.
|
|
5387
|
-
|
|
5388
|
+
if (this.syncIntervalId) {
|
|
5389
|
+
clearInterval(this.syncIntervalId);
|
|
5390
|
+
this.syncIntervalId = setInterval(() => {
|
|
5391
|
+
this.sync();
|
|
5392
|
+
}, SYNC_INTERVAL);
|
|
5393
|
+
}
|
|
5388
5394
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
5389
5395
|
}
|
|
5390
5396
|
async sync() {
|
|
@@ -5412,7 +5418,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5412
5418
|
setStartupData(data) {
|
|
5413
5419
|
this.startupData = data;
|
|
5414
5420
|
this.startupDataSent = false;
|
|
5415
|
-
this.sendStartupData();
|
|
5416
5421
|
}
|
|
5417
5422
|
async sendStartupData() {
|
|
5418
5423
|
if (this.startupData) {
|
|
@@ -5925,6 +5930,7 @@ var apitallyPlugin = /* @__PURE__ */ __name(async (fastify, config) => {
|
|
|
5925
5930
|
});
|
|
5926
5931
|
fastify.addHook("onReady", () => {
|
|
5927
5932
|
client.setStartupData(getAppInfo(routes, config.appVersion));
|
|
5933
|
+
client.startSync();
|
|
5928
5934
|
});
|
|
5929
5935
|
fastify.addHook("onClose", async () => {
|
|
5930
5936
|
await client.handleShutdown();
|