apitally 0.15.0 → 0.15.2

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/README.md CHANGED
@@ -7,8 +7,8 @@
7
7
  </picture>
8
8
  </a>
9
9
  </p>
10
- <p align="center"><b>Simple, privacy-focused API monitoring & analytics</b></p>
11
- <p align="center" style="color: #ccc;">Apitally gives you the visibility you need to build better APIs – with just a few lines of code.</p>
10
+ <p align="center"><b>API monitoring & analytics made simple</b></p>
11
+ <p align="center" style="color: #ccc;">Real-time metrics, request logs, and alerts for your APIs — with just a few lines of code.</p>
12
12
  <br>
13
13
  <img alt="Apitally screenshots" src="https://assets.apitally.io/screenshots/overview.png">
14
14
  <br>
@@ -205,43 +205,26 @@ _Note:_ Apitally only works with H3 v2 and currently doesn't support nested apps
205
205
 
206
206
  ### AdonisJS
207
207
 
208
- This is an example of how to use the Apitally middleware with a AdonisJS application.
209
- For further instructions, see our
210
- [setup guide for AdonisJS](https://docs.apitally.io/frameworks/adonisjs).
211
-
212
- Create a configuration file at `config/apitally.ts`:
213
-
214
- ```javascript
215
- import { defineConfig } from "apitally/adonisjs";
208
+ You can use the built-in Ace command to configure Apitally in your AdonisJS application:
216
209
 
217
- const apitallyConfig = defineConfig({
218
- clientId: "your-client-id",
219
- env: "dev", // or "prod" etc.
220
- });
221
-
222
- export default apitallyConfig;
210
+ ```bash
211
+ node ace configure apitally/adonisjs
223
212
  ```
224
213
 
225
- Register the Apitally provider in your `adonisrc.ts` file:
214
+ This command will automatically:
226
215
 
227
- ```javascript
228
- export default defineConfig({
229
- // ... existing code ...
230
- providers: [
231
- // ... existing providers ...
232
- () => import("apitally/adonisjs/provider"),
233
- ],
234
- });
235
- ```
216
+ - Create a config file at `config/apitally.ts`
217
+ - Register the Apitally provider in `adonisrc.ts`
218
+ - Add the Apitally middleware to `start/kernel.ts`
219
+ - Add environment variables to `.env` and `start/env.ts`
236
220
 
237
- Register the Apitally middleware in your `start/kernel.ts` file:
221
+ After running the command, you'll need to:
238
222
 
239
- ```javascript
240
- router.use([
241
- () => import("apitally/adonisjs/middleware"),
242
- // ... other middleware ...
243
- ]);
244
- ```
223
+ - Set your `APITALLY_CLIENT_ID` in the `.env` file
224
+ - Modify your exception handler in `app/exceptions/handler.ts` to capture validation and server errors
225
+
226
+ For further instructions, see our
227
+ [setup guide for AdonisJS](https://docs.apitally.io/frameworks/adonisjs).
245
228
 
246
229
  ## Getting help
247
230
 
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/adonisjs/configure.ts
22
+ var configure_exports = {};
23
+ __export(configure_exports, {
24
+ configure: () => configure
25
+ });
26
+ module.exports = __toCommonJS(configure_exports);
27
+ var import_url = require("url");
28
+ var import_meta = {};
29
+ var STUBS_ROOT = (0, import_url.fileURLToPath)(new URL("./stubs/", import_meta.url));
30
+ async function configure(command) {
31
+ const codemods = await command.createCodemods();
32
+ await codemods.makeUsingStub(STUBS_ROOT, "config/apitally.stub", {});
33
+ await codemods.registerMiddleware("router", [
34
+ {
35
+ path: "apitally/adonisjs/middleware"
36
+ }
37
+ ]);
38
+ await codemods.updateRcFile((rcFile) => {
39
+ rcFile.addProvider("apitally/adonisjs/provider");
40
+ });
41
+ await codemods.defineEnvVariables({
42
+ APITALLY_CLIENT_ID: "",
43
+ APITALLY_ENV: "dev"
44
+ });
45
+ await codemods.defineEnvValidations({
46
+ leadingComment: "Variables for configuring the apitally package",
47
+ variables: {
48
+ APITALLY_CLIENT_ID: "Env.schema.string()",
49
+ APITALLY_ENV: "Env.schema.string.optional()"
50
+ }
51
+ });
52
+ }
53
+ __name(configure, "configure");
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ configure
57
+ });
58
+ //# sourceMappingURL=configure.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/adonisjs/configure.ts"],"sourcesContent":["/**\n * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.\n */\n\nimport type Configure from \"@adonisjs/core/commands/configure\";\nimport { fileURLToPath } from \"url\";\n\nconst STUBS_ROOT = fileURLToPath(new URL(\"./stubs/\", import.meta.url));\n\nexport async function configure(command: Configure) {\n const codemods = await command.createCodemods();\n\n await codemods.makeUsingStub(STUBS_ROOT, \"config/apitally.stub\", {});\n\n await codemods.registerMiddleware(\"router\", [\n {\n path: \"apitally/adonisjs/middleware\",\n },\n ]);\n\n await codemods.updateRcFile((rcFile: any) => {\n rcFile.addProvider(\"apitally/adonisjs/provider\");\n });\n\n await codemods.defineEnvVariables({\n APITALLY_CLIENT_ID: \"\",\n APITALLY_ENV: \"dev\",\n });\n\n await codemods.defineEnvValidations({\n leadingComment: \"Variables for configuring the apitally package\",\n variables: {\n APITALLY_CLIENT_ID: \"Env.schema.string()\",\n APITALLY_ENV: \"Env.schema.string.optional()\",\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKA,iBAA8B;AAL9B;AAOA,IAAMA,iBAAaC,0BAAc,IAAIC,IAAI,YAAY,YAAYC,GAAG,CAAA;AAEpE,eAAsBC,UAAUC,SAAkB;AAChD,QAAMC,WAAW,MAAMD,QAAQE,eAAc;AAE7C,QAAMD,SAASE,cAAcR,YAAY,wBAAwB,CAAC,CAAA;AAElE,QAAMM,SAASG,mBAAmB,UAAU;IAC1C;MACEC,MAAM;IACR;GACD;AAED,QAAMJ,SAASK,aAAa,CAACC,WAAAA;AAC3BA,WAAOC,YAAY,4BAAA;EACrB,CAAA;AAEA,QAAMP,SAASQ,mBAAmB;IAChCC,oBAAoB;IACpBC,cAAc;EAChB,CAAA;AAEA,QAAMV,SAASW,qBAAqB;IAClCC,gBAAgB;IAChBC,WAAW;MACTJ,oBAAoB;MACpBC,cAAc;IAChB;EACF,CAAA;AACF;AA3BsBZ;","names":["STUBS_ROOT","fileURLToPath","URL","url","configure","command","codemods","createCodemods","makeUsingStub","registerMiddleware","path","updateRcFile","rcFile","addProvider","defineEnvVariables","APITALLY_CLIENT_ID","APITALLY_ENV","defineEnvValidations","leadingComment","variables"]}
@@ -0,0 +1,9 @@
1
+ import Configure from '@adonisjs/core/commands/configure';
2
+
3
+ /**
4
+ * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.
5
+ */
6
+
7
+ declare function configure(command: Configure): Promise<void>;
8
+
9
+ export { configure };
@@ -0,0 +1,9 @@
1
+ import Configure from '@adonisjs/core/commands/configure';
2
+
3
+ /**
4
+ * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.
5
+ */
6
+
7
+ declare function configure(command: Configure): Promise<void>;
8
+
9
+ export { configure };
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/adonisjs/configure.ts
5
+ import { fileURLToPath } from "url";
6
+ var STUBS_ROOT = fileURLToPath(new URL("./stubs/", import.meta.url));
7
+ async function configure(command) {
8
+ const codemods = await command.createCodemods();
9
+ await codemods.makeUsingStub(STUBS_ROOT, "config/apitally.stub", {});
10
+ await codemods.registerMiddleware("router", [
11
+ {
12
+ path: "apitally/adonisjs/middleware"
13
+ }
14
+ ]);
15
+ await codemods.updateRcFile((rcFile) => {
16
+ rcFile.addProvider("apitally/adonisjs/provider");
17
+ });
18
+ await codemods.defineEnvVariables({
19
+ APITALLY_CLIENT_ID: "",
20
+ APITALLY_ENV: "dev"
21
+ });
22
+ await codemods.defineEnvValidations({
23
+ leadingComment: "Variables for configuring the apitally package",
24
+ variables: {
25
+ APITALLY_CLIENT_ID: "Env.schema.string()",
26
+ APITALLY_ENV: "Env.schema.string.optional()"
27
+ }
28
+ });
29
+ }
30
+ __name(configure, "configure");
31
+ export {
32
+ configure
33
+ };
34
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/adonisjs/configure.ts"],"sourcesContent":["/**\n * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.\n */\n\nimport type Configure from \"@adonisjs/core/commands/configure\";\nimport { fileURLToPath } from \"url\";\n\nconst STUBS_ROOT = fileURLToPath(new URL(\"./stubs/\", import.meta.url));\n\nexport async function configure(command: Configure) {\n const codemods = await command.createCodemods();\n\n await codemods.makeUsingStub(STUBS_ROOT, \"config/apitally.stub\", {});\n\n await codemods.registerMiddleware(\"router\", [\n {\n path: \"apitally/adonisjs/middleware\",\n },\n ]);\n\n await codemods.updateRcFile((rcFile: any) => {\n rcFile.addProvider(\"apitally/adonisjs/provider\");\n });\n\n await codemods.defineEnvVariables({\n APITALLY_CLIENT_ID: \"\",\n APITALLY_ENV: \"dev\",\n });\n\n await codemods.defineEnvValidations({\n leadingComment: \"Variables for configuring the apitally package\",\n variables: {\n APITALLY_CLIENT_ID: \"Env.schema.string()\",\n APITALLY_ENV: \"Env.schema.string.optional()\",\n },\n });\n}\n"],"mappings":";;;;AAKA,SAASA,qBAAqB;AAE9B,IAAMC,aAAaC,cAAc,IAAIC,IAAI,YAAY,YAAYC,GAAG,CAAA;AAEpE,eAAsBC,UAAUC,SAAkB;AAChD,QAAMC,WAAW,MAAMD,QAAQE,eAAc;AAE7C,QAAMD,SAASE,cAAcR,YAAY,wBAAwB,CAAC,CAAA;AAElE,QAAMM,SAASG,mBAAmB,UAAU;IAC1C;MACEC,MAAM;IACR;GACD;AAED,QAAMJ,SAASK,aAAa,CAACC,WAAAA;AAC3BA,WAAOC,YAAY,4BAAA;EACrB,CAAA;AAEA,QAAMP,SAASQ,mBAAmB;IAChCC,oBAAoB;IACpBC,cAAc;EAChB,CAAA;AAEA,QAAMV,SAASW,qBAAqB;IAClCC,gBAAgB;IAChBC,WAAW;MACTJ,oBAAoB;MACpBC,cAAc;IAChB;EACF,CAAA;AACF;AA3BsBZ;","names":["fileURLToPath","STUBS_ROOT","fileURLToPath","URL","url","configure","command","codemods","createCodemods","makeUsingStub","registerMiddleware","path","updateRcFile","rcFile","addProvider","defineEnvVariables","APITALLY_CLIENT_ID","APITALLY_ENV","defineEnvValidations","leadingComment","variables"]}
@@ -22,9 +22,41 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
22
22
  var adonisjs_exports = {};
23
23
  __export(adonisjs_exports, {
24
24
  captureError: () => captureError,
25
+ configure: () => configure,
25
26
  defineConfig: () => defineConfig
26
27
  });
27
28
  module.exports = __toCommonJS(adonisjs_exports);
29
+
30
+ // src/adonisjs/configure.ts
31
+ var import_url = require("url");
32
+ var import_meta = {};
33
+ var STUBS_ROOT = (0, import_url.fileURLToPath)(new URL("./stubs/", import_meta.url));
34
+ async function configure(command) {
35
+ const codemods = await command.createCodemods();
36
+ await codemods.makeUsingStub(STUBS_ROOT, "config/apitally.stub", {});
37
+ await codemods.registerMiddleware("router", [
38
+ {
39
+ path: "apitally/adonisjs/middleware"
40
+ }
41
+ ]);
42
+ await codemods.updateRcFile((rcFile) => {
43
+ rcFile.addProvider("apitally/adonisjs/provider");
44
+ });
45
+ await codemods.defineEnvVariables({
46
+ APITALLY_CLIENT_ID: "",
47
+ APITALLY_ENV: "dev"
48
+ });
49
+ await codemods.defineEnvValidations({
50
+ leadingComment: "Variables for configuring the apitally package",
51
+ variables: {
52
+ APITALLY_CLIENT_ID: "Env.schema.string()",
53
+ APITALLY_ENV: "Env.schema.string.optional()"
54
+ }
55
+ });
56
+ }
57
+ __name(configure, "configure");
58
+
59
+ // src/adonisjs/index.ts
28
60
  function defineConfig(config) {
29
61
  return config;
30
62
  }
@@ -38,6 +70,7 @@ __name(captureError, "captureError");
38
70
  // Annotate the CommonJS export names for ESM import in node:
39
71
  0 && (module.exports = {
40
72
  captureError,
73
+ configure,
41
74
  defineConfig
42
75
  });
43
76
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adonisjs/index.ts"],"sourcesContent":["import type { HttpContext } from \"@adonisjs/core/http\";\n\nimport type { ApitallyConfig } from \"../common/types.js\";\nexport type { ApitallyConfig, ApitallyConsumer } from \"../common/types.js\";\n\nexport function defineConfig(config: ApitallyConfig) {\n return config;\n}\n\nexport function captureError(error: unknown, ctx: HttpContext) {\n if (error instanceof Error) {\n ctx.apitallyError = error;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA;;;;;;AAAO,SAASA,aAAaC,QAAsB;AACjD,SAAOA;AACT;AAFgBD;AAIT,SAASE,aAAaC,OAAgBC,KAAgB;AAC3D,MAAID,iBAAiBE,OAAO;AAC1BD,QAAIE,gBAAgBH;EACtB;AACF;AAJgBD;","names":["defineConfig","config","captureError","error","ctx","Error","apitallyError"]}
1
+ {"version":3,"sources":["../../src/adonisjs/index.ts","../../src/adonisjs/configure.ts"],"sourcesContent":["import type { HttpContext } from \"@adonisjs/core/http\";\n\nimport type { ApitallyConfig } from \"../common/types.js\";\nexport type { ApitallyConfig, ApitallyConsumer } from \"../common/types.js\";\nexport { configure } from \"./configure.js\";\n\nexport function defineConfig(config: ApitallyConfig) {\n return config;\n}\n\nexport function captureError(error: unknown, ctx: HttpContext) {\n if (error instanceof Error) {\n ctx.apitallyError = error;\n }\n}\n","/**\n * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.\n */\n\nimport type Configure from \"@adonisjs/core/commands/configure\";\nimport { fileURLToPath } from \"url\";\n\nconst STUBS_ROOT = fileURLToPath(new URL(\"./stubs/\", import.meta.url));\n\nexport async function configure(command: Configure) {\n const codemods = await command.createCodemods();\n\n await codemods.makeUsingStub(STUBS_ROOT, \"config/apitally.stub\", {});\n\n await codemods.registerMiddleware(\"router\", [\n {\n path: \"apitally/adonisjs/middleware\",\n },\n ]);\n\n await codemods.updateRcFile((rcFile: any) => {\n rcFile.addProvider(\"apitally/adonisjs/provider\");\n });\n\n await codemods.defineEnvVariables({\n APITALLY_CLIENT_ID: \"\",\n APITALLY_ENV: \"dev\",\n });\n\n await codemods.defineEnvValidations({\n leadingComment: \"Variables for configuring the apitally package\",\n variables: {\n APITALLY_CLIENT_ID: \"Env.schema.string()\",\n APITALLY_ENV: \"Env.schema.string.optional()\",\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA;;;;;;;;;ACCA,iBAA8B;AAL9B;AAOA,IAAMA,iBAAaC,0BAAc,IAAIC,IAAI,YAAY,YAAYC,GAAG,CAAA;AAEpE,eAAsBC,UAAUC,SAAkB;AAChD,QAAMC,WAAW,MAAMD,QAAQE,eAAc;AAE7C,QAAMD,SAASE,cAAcR,YAAY,wBAAwB,CAAC,CAAA;AAElE,QAAMM,SAASG,mBAAmB,UAAU;IAC1C;MACEC,MAAM;IACR;GACD;AAED,QAAMJ,SAASK,aAAa,CAACC,WAAAA;AAC3BA,WAAOC,YAAY,4BAAA;EACrB,CAAA;AAEA,QAAMP,SAASQ,mBAAmB;IAChCC,oBAAoB;IACpBC,cAAc;EAChB,CAAA;AAEA,QAAMV,SAASW,qBAAqB;IAClCC,gBAAgB;IAChBC,WAAW;MACTJ,oBAAoB;MACpBC,cAAc;IAChB;EACF,CAAA;AACF;AA3BsBZ;;;ADHf,SAASgB,aAAaC,QAAsB;AACjD,SAAOA;AACT;AAFgBD;AAIT,SAASE,aAAaC,OAAgBC,KAAgB;AAC3D,MAAID,iBAAiBE,OAAO;AAC1BD,QAAIE,gBAAgBH;EACtB;AACF;AAJgBD;","names":["STUBS_ROOT","fileURLToPath","URL","url","configure","command","codemods","createCodemods","makeUsingStub","registerMiddleware","path","updateRcFile","rcFile","addProvider","defineEnvVariables","APITALLY_CLIENT_ID","APITALLY_ENV","defineEnvValidations","leadingComment","variables","defineConfig","config","captureError","error","ctx","Error","apitallyError"]}
@@ -1,12 +1,14 @@
1
1
  import { HttpContext } from '@adonisjs/core/http';
2
2
  import { ApitallyConfig } from '../common/types.cjs';
3
3
  export { ApitallyConsumer } from '../common/types.cjs';
4
+ export { configure } from './configure.cjs';
4
5
  import '../common/logging.cjs';
5
6
  import 'winston';
6
7
  import '../common/requestLogger.cjs';
7
8
  import 'buffer';
8
9
  import 'http';
9
10
  import '../common/tempGzipFile.cjs';
11
+ import '@adonisjs/core/commands/configure';
10
12
 
11
13
  declare function defineConfig(config: ApitallyConfig): ApitallyConfig;
12
14
  declare function captureError(error: unknown, ctx: HttpContext): void;
@@ -1,12 +1,14 @@
1
1
  import { HttpContext } from '@adonisjs/core/http';
2
2
  import { ApitallyConfig } from '../common/types.js';
3
3
  export { ApitallyConsumer } from '../common/types.js';
4
+ export { configure } from './configure.js';
4
5
  import '../common/logging.js';
5
6
  import 'winston';
6
7
  import '../common/requestLogger.js';
7
8
  import 'buffer';
8
9
  import 'http';
9
10
  import '../common/tempGzipFile.js';
11
+ import '@adonisjs/core/commands/configure';
10
12
 
11
13
  declare function defineConfig(config: ApitallyConfig): ApitallyConfig;
12
14
  declare function captureError(error: unknown, ctx: HttpContext): void;
@@ -1,6 +1,34 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
+ // src/adonisjs/configure.ts
5
+ import { fileURLToPath } from "url";
6
+ var STUBS_ROOT = fileURLToPath(new URL("./stubs/", import.meta.url));
7
+ async function configure(command) {
8
+ const codemods = await command.createCodemods();
9
+ await codemods.makeUsingStub(STUBS_ROOT, "config/apitally.stub", {});
10
+ await codemods.registerMiddleware("router", [
11
+ {
12
+ path: "apitally/adonisjs/middleware"
13
+ }
14
+ ]);
15
+ await codemods.updateRcFile((rcFile) => {
16
+ rcFile.addProvider("apitally/adonisjs/provider");
17
+ });
18
+ await codemods.defineEnvVariables({
19
+ APITALLY_CLIENT_ID: "",
20
+ APITALLY_ENV: "dev"
21
+ });
22
+ await codemods.defineEnvValidations({
23
+ leadingComment: "Variables for configuring the apitally package",
24
+ variables: {
25
+ APITALLY_CLIENT_ID: "Env.schema.string()",
26
+ APITALLY_ENV: "Env.schema.string.optional()"
27
+ }
28
+ });
29
+ }
30
+ __name(configure, "configure");
31
+
4
32
  // src/adonisjs/index.ts
5
33
  function defineConfig(config) {
6
34
  return config;
@@ -14,6 +42,7 @@ function captureError(error, ctx) {
14
42
  __name(captureError, "captureError");
15
43
  export {
16
44
  captureError,
45
+ configure,
17
46
  defineConfig
18
47
  };
19
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/adonisjs/index.ts"],"sourcesContent":["import type { HttpContext } from \"@adonisjs/core/http\";\n\nimport type { ApitallyConfig } from \"../common/types.js\";\nexport type { ApitallyConfig, ApitallyConsumer } from \"../common/types.js\";\n\nexport function defineConfig(config: ApitallyConfig) {\n return config;\n}\n\nexport function captureError(error: unknown, ctx: HttpContext) {\n if (error instanceof Error) {\n ctx.apitallyError = error;\n }\n}\n"],"mappings":";;;;AAKO,SAASA,aAAaC,QAAsB;AACjD,SAAOA;AACT;AAFgBD;AAIT,SAASE,aAAaC,OAAgBC,KAAgB;AAC3D,MAAID,iBAAiBE,OAAO;AAC1BD,QAAIE,gBAAgBH;EACtB;AACF;AAJgBD;","names":["defineConfig","config","captureError","error","ctx","Error","apitallyError"]}
1
+ {"version":3,"sources":["../../src/adonisjs/configure.ts","../../src/adonisjs/index.ts"],"sourcesContent":["/**\n * Allows users to add Apitally to their AdonisJS application using the built-in Ace command.\n */\n\nimport type Configure from \"@adonisjs/core/commands/configure\";\nimport { fileURLToPath } from \"url\";\n\nconst STUBS_ROOT = fileURLToPath(new URL(\"./stubs/\", import.meta.url));\n\nexport async function configure(command: Configure) {\n const codemods = await command.createCodemods();\n\n await codemods.makeUsingStub(STUBS_ROOT, \"config/apitally.stub\", {});\n\n await codemods.registerMiddleware(\"router\", [\n {\n path: \"apitally/adonisjs/middleware\",\n },\n ]);\n\n await codemods.updateRcFile((rcFile: any) => {\n rcFile.addProvider(\"apitally/adonisjs/provider\");\n });\n\n await codemods.defineEnvVariables({\n APITALLY_CLIENT_ID: \"\",\n APITALLY_ENV: \"dev\",\n });\n\n await codemods.defineEnvValidations({\n leadingComment: \"Variables for configuring the apitally package\",\n variables: {\n APITALLY_CLIENT_ID: \"Env.schema.string()\",\n APITALLY_ENV: \"Env.schema.string.optional()\",\n },\n });\n}\n","import type { HttpContext } from \"@adonisjs/core/http\";\n\nimport type { ApitallyConfig } from \"../common/types.js\";\nexport type { ApitallyConfig, ApitallyConsumer } from \"../common/types.js\";\nexport { configure } from \"./configure.js\";\n\nexport function defineConfig(config: ApitallyConfig) {\n return config;\n}\n\nexport function captureError(error: unknown, ctx: HttpContext) {\n if (error instanceof Error) {\n ctx.apitallyError = error;\n }\n}\n"],"mappings":";;;;AAKA,SAASA,qBAAqB;AAE9B,IAAMC,aAAaC,cAAc,IAAIC,IAAI,YAAY,YAAYC,GAAG,CAAA;AAEpE,eAAsBC,UAAUC,SAAkB;AAChD,QAAMC,WAAW,MAAMD,QAAQE,eAAc;AAE7C,QAAMD,SAASE,cAAcR,YAAY,wBAAwB,CAAC,CAAA;AAElE,QAAMM,SAASG,mBAAmB,UAAU;IAC1C;MACEC,MAAM;IACR;GACD;AAED,QAAMJ,SAASK,aAAa,CAACC,WAAAA;AAC3BA,WAAOC,YAAY,4BAAA;EACrB,CAAA;AAEA,QAAMP,SAASQ,mBAAmB;IAChCC,oBAAoB;IACpBC,cAAc;EAChB,CAAA;AAEA,QAAMV,SAASW,qBAAqB;IAClCC,gBAAgB;IAChBC,WAAW;MACTJ,oBAAoB;MACpBC,cAAc;IAChB;EACF,CAAA;AACF;AA3BsBZ;;;ACHf,SAASgB,aAAaC,QAAsB;AACjD,SAAOA;AACT;AAFgBD;AAIT,SAASE,aAAaC,OAAgBC,KAAgB;AAC3D,MAAID,iBAAiBE,OAAO;AAC1BD,QAAIE,gBAAgBH;EACtB;AACF;AAJgBD;","names":["fileURLToPath","STUBS_ROOT","fileURLToPath","URL","url","configure","command","codemods","createCodemods","makeUsingStub","registerMiddleware","path","updateRcFile","rcFile","addProvider","defineEnvVariables","APITALLY_CLIENT_ID","APITALLY_ENV","defineEnvValidations","leadingComment","variables","defineConfig","config","captureError","error","ctx","Error","apitallyError"]}
@@ -0,0 +1,15 @@
1
+ {{{
2
+ exports({
3
+ to: app.configPath('apitally.ts')
4
+ })
5
+ }}}
6
+ import env from '#start/env'
7
+ import app from '@adonisjs/core/services/app'
8
+ import { defineConfig } from 'apitally/adonisjs'
9
+
10
+ const apitallyConfig = defineConfig({
11
+ clientId: env.get('APITALLY_CLIENT_ID'),
12
+ env: env.get('APITALLY_ENV', app.inProduction ? 'prod' : 'dev'),
13
+ })
14
+
15
+ export default apitallyConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apitally",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Simple API monitoring & analytics for REST APIs built with Express, Fastify, Hono, H3, Koa, and NestJS.",
5
5
  "author": "Apitally <hello@apitally.io>",
6
6
  "license": "MIT",
@@ -35,15 +35,15 @@
35
35
  "homepage": "https://apitally.io",
36
36
  "type": "module",
37
37
  "scripts": {
38
- "build": "tsup src",
38
+ "build": "tsup",
39
39
  "format": "prettier --write .",
40
40
  "check": "tsc --noEmit && eslint src tests && prettier --check .",
41
41
  "test": "vitest"
42
42
  },
43
43
  "files": [
44
44
  "dist/",
45
- "README.md",
46
- "LICENSE"
45
+ "LICENSE",
46
+ "README.md"
47
47
  ],
48
48
  "exports": {
49
49
  "./adonisjs": {
@@ -249,13 +249,14 @@
249
249
  "celebrate": "^15.0.3",
250
250
  "class-transformer": "^0.5.1",
251
251
  "class-validator": "^0.14.0",
252
+ "copyfiles": "^2.4.1",
252
253
  "eslint": "^9.0.0",
253
254
  "express": "^5.1.0",
254
255
  "express-validator": "^7.2.1",
255
256
  "fastify": "^5.0.0",
256
257
  "fastify-plugin": "^5.0.1",
257
258
  "globals": "^16.2.0",
258
- "h3": "^2.0.0-beta.0",
259
+ "h3": "2.0.0-beta.0",
259
260
  "hono": "^4.6.5",
260
261
  "koa": "^3.0.0",
261
262
  "koa-bodyparser": "^4.4.1",