apitally 0.15.1 → 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 +6 -6
- package/dist/adonisjs/configure.cjs +58 -0
- package/dist/adonisjs/configure.cjs.map +1 -0
- package/dist/adonisjs/configure.d.cts +9 -0
- package/dist/adonisjs/configure.d.ts +9 -0
- package/dist/adonisjs/configure.js +34 -0
- package/dist/adonisjs/configure.js.map +1 -0
- package/dist/adonisjs/index.cjs +33 -0
- package/dist/adonisjs/index.cjs.map +1 -1
- package/dist/adonisjs/index.d.cts +2 -0
- package/dist/adonisjs/index.d.ts +2 -0
- package/dist/adonisjs/index.js +29 -0
- package/dist/adonisjs/index.js.map +1 -1
- package/package.json +3 -4
- package/configure.ts +0 -35
- package/stubs/main.ts +0 -3
- /package/{stubs → dist/adonisjs/stubs}/config/apitally.stub +0 -0
package/README.md
CHANGED
|
@@ -205,23 +205,23 @@ _Note:_ Apitally only works with H3 v2 and currently doesn't support nested apps
|
|
|
205
205
|
|
|
206
206
|
### AdonisJS
|
|
207
207
|
|
|
208
|
-
You can use the built-in Ace command to
|
|
208
|
+
You can use the built-in Ace command to configure Apitally in your AdonisJS application:
|
|
209
209
|
|
|
210
210
|
```bash
|
|
211
|
-
node ace
|
|
211
|
+
node ace configure apitally/adonisjs
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
This command will automatically:
|
|
215
215
|
|
|
216
|
-
- Create
|
|
216
|
+
- Create a config file at `config/apitally.ts`
|
|
217
217
|
- Register the Apitally provider in `adonisrc.ts`
|
|
218
|
-
- Add the Apitally middleware to
|
|
219
|
-
- Add environment variables to `.env` and
|
|
218
|
+
- Add the Apitally middleware to `start/kernel.ts`
|
|
219
|
+
- Add environment variables to `.env` and `start/env.ts`
|
|
220
220
|
|
|
221
221
|
After running the command, you'll need to:
|
|
222
222
|
|
|
223
223
|
- Set your `APITALLY_CLIENT_ID` in the `.env` file
|
|
224
|
-
- Modify
|
|
224
|
+
- Modify your exception handler in `app/exceptions/handler.ts` to capture validation and server errors
|
|
225
225
|
|
|
226
226
|
For further instructions, see our
|
|
227
227
|
[setup guide for AdonisJS](https://docs.apitally.io/frameworks/adonisjs).
|
|
@@ -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,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"]}
|
package/dist/adonisjs/index.cjs
CHANGED
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;
|
|
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;
|
package/dist/adonisjs/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/adonisjs/index.js
CHANGED
|
@@ -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":";;;;
|
|
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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apitally",
|
|
3
|
-
"version": "0.15.
|
|
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,13 @@
|
|
|
35
35
|
"homepage": "https://apitally.io",
|
|
36
36
|
"type": "module",
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "tsup
|
|
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
|
-
"stubs/",
|
|
46
|
-
"configure.ts",
|
|
47
45
|
"LICENSE",
|
|
48
46
|
"README.md"
|
|
49
47
|
],
|
|
@@ -251,6 +249,7 @@
|
|
|
251
249
|
"celebrate": "^15.0.3",
|
|
252
250
|
"class-transformer": "^0.5.1",
|
|
253
251
|
"class-validator": "^0.14.0",
|
|
252
|
+
"copyfiles": "^2.4.1",
|
|
254
253
|
"eslint": "^9.0.0",
|
|
255
254
|
"express": "^5.1.0",
|
|
256
255
|
"express-validator": "^7.2.1",
|
package/configure.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Allows users to add Apitally to their AdonisJS application using the built-in Ace command.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type Configure from "@adonisjs/core/commands/configure";
|
|
6
|
-
import { stubsRoot } from "./stubs/main.js";
|
|
7
|
-
|
|
8
|
-
export async function configure(command: Configure) {
|
|
9
|
-
const codemods = await command.createCodemods();
|
|
10
|
-
|
|
11
|
-
await codemods.makeUsingStub(stubsRoot, "config/apitally.stub", {});
|
|
12
|
-
|
|
13
|
-
await codemods.registerMiddleware("router", [
|
|
14
|
-
{
|
|
15
|
-
path: "apitally/adonisjs/middleware",
|
|
16
|
-
},
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
await codemods.updateRcFile((rcFile) => {
|
|
20
|
-
rcFile.addProvider("apitally/adonisjs/provider");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await codemods.defineEnvVariables({
|
|
24
|
-
APITALLY_CLIENT_ID: "",
|
|
25
|
-
APITALLY_ENV: "dev",
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
await codemods.defineEnvValidations({
|
|
29
|
-
leadingComment: "Variables for configuring the apitally package",
|
|
30
|
-
variables: {
|
|
31
|
-
APITALLY_CLIENT_ID: "Env.schema.string()",
|
|
32
|
-
APITALLY_ENV: "Env.schema.string.optional()",
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
package/stubs/main.ts
DELETED
|
File without changes
|