@prosopo/api-route 2.3.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.
@@ -0,0 +1,8 @@
1
+ import type { ZodType } from "zod";
2
+ import type { ApiEndpoint } from "./endpoint/apiEndpoint.js";
3
+ interface ApiRoute {
4
+ path: string;
5
+ endpoint: ApiEndpoint<ZodType | undefined>;
6
+ }
7
+ export type { ApiRoute };
8
+ //# sourceMappingURL=apiRoute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiRoute.d.ts","sourceRoot":"","sources":["../src/apiRoute.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;CAC3C;AAED,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apiRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiRoute.js","sourceRoot":"","sources":["../src/apiRoute.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { ApiRoute } from "./apiRoute.js";
2
+ interface ApiRoutesProvider {
3
+ getRoutes(): ApiRoute[];
4
+ }
5
+ export type { ApiRoutesProvider };
6
+ //# sourceMappingURL=apiRoutesProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiRoutesProvider.d.ts","sourceRoot":"","sources":["../src/apiRoutesProvider.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,UAAU,iBAAiB;IAC1B,SAAS,IAAI,QAAQ,EAAE,CAAC;CACxB;AAED,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apiRoutesProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiRoutesProvider.js","sourceRoot":"","sources":["../src/apiRoutesProvider.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { ZodType, z } from "zod";
2
+ import type { ApiEndpointResponse } from "./apiEndpointResponse.js";
3
+ interface ApiEndpoint<T extends ZodType | undefined> {
4
+ processRequest: T extends ZodType ? (args: z.infer<T>) => Promise<ApiEndpointResponse> : () => Promise<ApiEndpointResponse>;
5
+ getRequestArgsSchema(): T;
6
+ }
7
+ export type { ApiEndpoint };
8
+ //# sourceMappingURL=apiEndpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpoint.d.ts","sourceRoot":"","sources":["../../src/endpoint/apiEndpoint.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,UAAU,WAAW,CAAC,CAAC,SAAS,OAAO,GAAG,SAAS;IAClD,cAAc,EAAE,CAAC,SAAS,OAAO,GAC9B,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAClD,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEtC,oBAAoB,IAAI,CAAC,CAAC;CAC1B;AAED,YAAY,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apiEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpoint.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpoint.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import type { ApiEndpointResponseStatus } from "./apiEndpointResponseStatus.js";
2
+ interface ApiEndpointResponse {
3
+ status: ApiEndpointResponseStatus;
4
+ data?: object;
5
+ }
6
+ export type { ApiEndpointResponse };
7
+ //# sourceMappingURL=apiEndpointResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpointResponse.d.ts","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponse.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEhF,UAAU,mBAAmB;IAC5B,MAAM,EAAE,yBAAyB,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apiEndpointResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpointResponse.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponse.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ declare enum ApiEndpointResponseStatus {
2
+ SUCCESS = "SUCCESS",
3
+ FAIL = "FAIL"
4
+ }
5
+ export { ApiEndpointResponseStatus };
6
+ //# sourceMappingURL=apiEndpointResponseStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpointResponseStatus.d.ts","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponseStatus.ts"],"names":[],"mappings":"AAcA,aAAK,yBAAyB;IAC7B,OAAO,YAAY;IACnB,IAAI,SAAS;CACb;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ var ApiEndpointResponseStatus;
2
+ (function (ApiEndpointResponseStatus) {
3
+ ApiEndpointResponseStatus["SUCCESS"] = "SUCCESS";
4
+ ApiEndpointResponseStatus["FAIL"] = "FAIL";
5
+ })(ApiEndpointResponseStatus || (ApiEndpointResponseStatus = {}));
6
+ export { ApiEndpointResponseStatus };
7
+ //# sourceMappingURL=apiEndpointResponseStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiEndpointResponseStatus.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponseStatus.ts"],"names":[],"mappings":"AAcA,IAAK,yBAGJ;AAHD,WAAK,yBAAyB;IAC7B,gDAAmB,CAAA;IACnB,0CAAa,CAAA;AACd,CAAC,EAHI,yBAAyB,KAAzB,yBAAyB,QAG7B;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ApiRoute } from "./apiRoute.js";
2
+ import type { ApiRoutesProvider } from "./apiRoutesProvider.js";
3
+ import type { ApiEndpoint } from "./endpoint/apiEndpoint.js";
4
+ import type { ApiEndpointResponse } from "./endpoint/apiEndpointResponse.js";
5
+ import { ApiEndpointResponseStatus } from "./endpoint/apiEndpointResponseStatus.js";
6
+ export { ApiEndpointResponseStatus, type ApiEndpointResponse, type ApiEndpoint, type ApiRoute, type ApiRoutesProvider, };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,OAAO,EACN,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,iBAAiB,GACtB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { ApiEndpointResponseStatus } from "./endpoint/apiEndpointResponseStatus.js";
2
+ export { ApiEndpointResponseStatus, };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAEpF,OAAO,EACN,yBAAyB,GAKzB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@prosopo/api-route",
3
+ "version": "2.3.2",
4
+ "main": "dist/index.js",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": "20",
8
+ "npm": ">=9"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/cjs/index.cjs"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "test": "echo \"No test specified\"",
18
+ "clean": "tsc --build --clean",
19
+ "build": "tsc --build --verbose",
20
+ "build:cjs": "npx vite --config vite.cjs.config.ts build"
21
+ },
22
+ "dependencies": {
23
+ "zod": "3.23.8"
24
+ },
25
+ "devDependencies": {
26
+ "@prosopo/config": "2.3.2"
27
+ },
28
+ "author": "PROSOPO LIMITED <info@prosopo.io>",
29
+ "license": "Apache-2.0",
30
+ "bugs": {
31
+ "url": "https://github.com/prosopo/captcha/issues"
32
+ },
33
+ "homepage": "https://github.com/prosopo/captcha#readme",
34
+ "sideEffects": false
35
+ }
@@ -0,0 +1,20 @@
1
+ // Copyright 2021-2024 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import path from "node:path";
16
+ import { ViteCommonJSConfig } from "@prosopo/config";
17
+
18
+ export default function () {
19
+ return ViteCommonJSConfig("api-route", path.resolve("./tsconfig.cjs.json"));
20
+ }