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