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.cjs
CHANGED
|
@@ -888,11 +888,14 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
888
888
|
if (_ApitallyClient.instance) {
|
|
889
889
|
throw new Error("Apitally client is already initialized");
|
|
890
890
|
}
|
|
891
|
+
this.logger = logger ?? getLogger();
|
|
891
892
|
if (!isValidClientId(clientId)) {
|
|
892
|
-
|
|
893
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
894
|
+
this.enabled = false;
|
|
893
895
|
}
|
|
894
896
|
if (!isValidEnv(env)) {
|
|
895
|
-
|
|
897
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
898
|
+
this.enabled = false;
|
|
896
899
|
}
|
|
897
900
|
if (requestLoggingConfig && !requestLogging) {
|
|
898
901
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -907,8 +910,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
907
910
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
908
911
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
909
912
|
this.consumerRegistry = new ConsumerRegistry();
|
|
910
|
-
this.logger = logger ?? getLogger();
|
|
911
|
-
this.startSync();
|
|
912
913
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
913
914
|
}
|
|
914
915
|
static getInstance() {
|
|
@@ -963,15 +964,20 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
963
964
|
}
|
|
964
965
|
}
|
|
965
966
|
startSync() {
|
|
967
|
+
if (!this.enabled) {
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
966
970
|
this.sync();
|
|
967
971
|
this.syncIntervalId = setInterval(() => {
|
|
968
972
|
this.sync();
|
|
969
973
|
}, INITIAL_SYNC_INTERVAL);
|
|
970
974
|
setTimeout(() => {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
this.
|
|
974
|
-
|
|
975
|
+
if (this.syncIntervalId) {
|
|
976
|
+
clearInterval(this.syncIntervalId);
|
|
977
|
+
this.syncIntervalId = setInterval(() => {
|
|
978
|
+
this.sync();
|
|
979
|
+
}, SYNC_INTERVAL);
|
|
980
|
+
}
|
|
975
981
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
976
982
|
}
|
|
977
983
|
async sync() {
|
|
@@ -999,7 +1005,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
999
1005
|
setStartupData(data) {
|
|
1000
1006
|
this.startupData = data;
|
|
1001
1007
|
this.startupDataSent = false;
|
|
1002
|
-
this.sendStartupData();
|
|
1003
1008
|
}
|
|
1004
1009
|
async sendStartupData() {
|
|
1005
1010
|
if (this.startupData) {
|
|
@@ -1448,18 +1453,22 @@ function listEndpoints(app) {
|
|
|
1448
1453
|
__name(listEndpoints, "listEndpoints");
|
|
1449
1454
|
function extractZodErrors(responseJson) {
|
|
1450
1455
|
var _a2;
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1456
|
+
try {
|
|
1457
|
+
const errors = [];
|
|
1458
|
+
if (responseJson && responseJson.success === false && responseJson.error && responseJson.error.name === "ZodError") {
|
|
1459
|
+
const zodError = responseJson.error;
|
|
1460
|
+
(_a2 = zodError.issues) == null ? void 0 : _a2.forEach((zodIssue) => {
|
|
1461
|
+
errors.push({
|
|
1462
|
+
loc: zodIssue.path.join("."),
|
|
1463
|
+
msg: zodIssue.message,
|
|
1464
|
+
type: zodIssue.code
|
|
1465
|
+
});
|
|
1459
1466
|
});
|
|
1460
|
-
}
|
|
1467
|
+
}
|
|
1468
|
+
return errors;
|
|
1469
|
+
} catch (error) {
|
|
1470
|
+
return [];
|
|
1461
1471
|
}
|
|
1462
|
-
return errors;
|
|
1463
1472
|
}
|
|
1464
1473
|
__name(extractZodErrors, "extractZodErrors");
|
|
1465
1474
|
|
|
@@ -1472,6 +1481,7 @@ function useApitally(app, config) {
|
|
|
1472
1481
|
const appInfo = getAppInfo(app, config.appVersion);
|
|
1473
1482
|
if (appInfo.paths.length > 0 || attempt >= 10) {
|
|
1474
1483
|
client.setStartupData(appInfo);
|
|
1484
|
+
client.startSync();
|
|
1475
1485
|
} else {
|
|
1476
1486
|
setTimeout(() => setStartupData(attempt + 1), 500);
|
|
1477
1487
|
}
|