apitally 0.21.1 → 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 +456 -612
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.js +456 -612
- 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 +450 -606
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.js +450 -606
- package/dist/express/index.js.map +1 -1
- package/dist/express/middleware.cjs +450 -606
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.js +450 -606
- package/dist/express/middleware.js.map +1 -1
- package/dist/fastify/index.cjs +450 -606
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.js +450 -606
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/plugin.cjs +450 -606
- package/dist/fastify/plugin.cjs.map +1 -1
- package/dist/fastify/plugin.js +450 -606
- 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 +456 -612
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.js +456 -612
- package/dist/hapi/index.js.map +1 -1
- package/dist/hapi/plugin.cjs +456 -612
- package/dist/hapi/plugin.cjs.map +1 -1
- package/dist/hapi/plugin.js +456 -612
- package/dist/hapi/plugin.js.map +1 -1
- package/dist/hono/index.cjs +29 -19
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.js +29 -19
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +29 -19
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.js +29 -19
- package/dist/hono/middleware.js.map +1 -1
- package/dist/hono/utils.cjs +14 -10
- package/dist/hono/utils.cjs.map +1 -1
- package/dist/hono/utils.js +14 -10
- package/dist/hono/utils.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/loggers/index.cjs +441 -603
- package/dist/loggers/index.cjs.map +1 -1
- package/dist/loggers/index.js +441 -603
- package/dist/loggers/index.js.map +1 -1
- package/dist/loggers/pino.cjs +435 -597
- package/dist/loggers/pino.cjs.map +1 -1
- package/dist/loggers/pino.js +435 -597
- package/dist/loggers/pino.js.map +1 -1
- package/dist/nestjs/index.cjs +451 -606
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +451 -606
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +2 -2
package/dist/hono/index.js
CHANGED
|
@@ -859,11 +859,14 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
859
859
|
if (_ApitallyClient.instance) {
|
|
860
860
|
throw new Error("Apitally client is already initialized");
|
|
861
861
|
}
|
|
862
|
+
this.logger = logger ?? getLogger();
|
|
862
863
|
if (!isValidClientId(clientId)) {
|
|
863
|
-
|
|
864
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
865
|
+
this.enabled = false;
|
|
864
866
|
}
|
|
865
867
|
if (!isValidEnv(env)) {
|
|
866
|
-
|
|
868
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
869
|
+
this.enabled = false;
|
|
867
870
|
}
|
|
868
871
|
if (requestLoggingConfig && !requestLogging) {
|
|
869
872
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -878,8 +881,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
878
881
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
879
882
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
880
883
|
this.consumerRegistry = new ConsumerRegistry();
|
|
881
|
-
this.logger = logger ?? getLogger();
|
|
882
|
-
this.startSync();
|
|
883
884
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
884
885
|
}
|
|
885
886
|
static getInstance() {
|
|
@@ -934,15 +935,20 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
934
935
|
}
|
|
935
936
|
}
|
|
936
937
|
startSync() {
|
|
938
|
+
if (!this.enabled) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
937
941
|
this.sync();
|
|
938
942
|
this.syncIntervalId = setInterval(() => {
|
|
939
943
|
this.sync();
|
|
940
944
|
}, INITIAL_SYNC_INTERVAL);
|
|
941
945
|
setTimeout(() => {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
this.
|
|
945
|
-
|
|
946
|
+
if (this.syncIntervalId) {
|
|
947
|
+
clearInterval(this.syncIntervalId);
|
|
948
|
+
this.syncIntervalId = setInterval(() => {
|
|
949
|
+
this.sync();
|
|
950
|
+
}, SYNC_INTERVAL);
|
|
951
|
+
}
|
|
946
952
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
947
953
|
}
|
|
948
954
|
async sync() {
|
|
@@ -970,7 +976,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
970
976
|
setStartupData(data) {
|
|
971
977
|
this.startupData = data;
|
|
972
978
|
this.startupDataSent = false;
|
|
973
|
-
this.sendStartupData();
|
|
974
979
|
}
|
|
975
980
|
async sendStartupData() {
|
|
976
981
|
if (this.startupData) {
|
|
@@ -1418,18 +1423,22 @@ function listEndpoints(app) {
|
|
|
1418
1423
|
__name(listEndpoints, "listEndpoints");
|
|
1419
1424
|
function extractZodErrors(responseJson) {
|
|
1420
1425
|
var _a2;
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1426
|
+
try {
|
|
1427
|
+
const errors = [];
|
|
1428
|
+
if (responseJson && responseJson.success === false && responseJson.error && responseJson.error.name === "ZodError") {
|
|
1429
|
+
const zodError = responseJson.error;
|
|
1430
|
+
(_a2 = zodError.issues) == null ? void 0 : _a2.forEach((zodIssue) => {
|
|
1431
|
+
errors.push({
|
|
1432
|
+
loc: zodIssue.path.join("."),
|
|
1433
|
+
msg: zodIssue.message,
|
|
1434
|
+
type: zodIssue.code
|
|
1435
|
+
});
|
|
1429
1436
|
});
|
|
1430
|
-
}
|
|
1437
|
+
}
|
|
1438
|
+
return errors;
|
|
1439
|
+
} catch (error) {
|
|
1440
|
+
return [];
|
|
1431
1441
|
}
|
|
1432
|
-
return errors;
|
|
1433
1442
|
}
|
|
1434
1443
|
__name(extractZodErrors, "extractZodErrors");
|
|
1435
1444
|
|
|
@@ -1442,6 +1451,7 @@ function useApitally(app, config) {
|
|
|
1442
1451
|
const appInfo = getAppInfo(app, config.appVersion);
|
|
1443
1452
|
if (appInfo.paths.length > 0 || attempt >= 10) {
|
|
1444
1453
|
client.setStartupData(appInfo);
|
|
1454
|
+
client.startSync();
|
|
1445
1455
|
} else {
|
|
1446
1456
|
setTimeout(() => setStartupData(attempt + 1), 500);
|
|
1447
1457
|
}
|