@prosopo/api-route 2.5.5 → 2.6.8

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/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # @prosopo/api-route
2
+
3
+ ## 2.6.8
4
+ ### Patch Changes
5
+
6
+ - 3573f0b: fix npm scripts bundle command
7
+ - 3573f0b: build using vite, typecheck using tsc
8
+ - efd8102: Add tests for unwrap error helper
9
+ - 3573f0b: standardise all vite based npm scripts for bundling
10
+ - Updated dependencies [3573f0b]
11
+ - Updated dependencies [3573f0b]
12
+ - Updated dependencies [efd8102]
13
+ - Updated dependencies [f29fc7e]
14
+ - Updated dependencies [3573f0b]
15
+ - Updated dependencies [2d0dd8a]
16
+ - @prosopo/common@3.1.0
17
+ - @prosopo/config@3.1.1
18
+
19
+ ## 2.6.7
20
+ ### Patch Changes
21
+
22
+ - @prosopo/common@3.0.2
23
+
24
+ ## 2.6.6
25
+ ### Patch Changes
26
+
27
+ - @prosopo/common@3.0.1
28
+
29
+ ## 2.6.5
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [64b5bcd]
33
+ - @prosopo/common@3.0.0
34
+
35
+ ## 2.6.4
36
+ ### Patch Changes
37
+
38
+ - 86c22b8: structured logging
39
+ - Updated dependencies [86c22b8]
40
+ - @prosopo/common@2.7.2
41
+
42
+ ## 2.6.3
43
+ ### Patch Changes
44
+
45
+ - @prosopo/common@2.7.1
46
+
47
+ ## 2.6.2
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [8f0644a]
51
+ - @prosopo/common@2.7.0
52
+
53
+ ## 2.6.1
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [04cc7ee]
58
+ - @prosopo/common@2.6.1
59
+
60
+ ## 2.6.0
61
+
62
+ ### Minor Changes
63
+
64
+ - a0bfc8a: bump all pkg versions since independent versioning applied
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ var ApiEndpointResponseStatus = /* @__PURE__ */ ((ApiEndpointResponseStatus2) => {
4
+ ApiEndpointResponseStatus2["SUCCESS"] = "SUCCESS";
5
+ ApiEndpointResponseStatus2["FAIL"] = "FAIL";
6
+ ApiEndpointResponseStatus2["PROCESSING"] = "PROCESSING";
7
+ return ApiEndpointResponseStatus2;
8
+ })(ApiEndpointResponseStatus || {});
9
+ exports.ApiEndpointResponseStatus = ApiEndpointResponseStatus;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const apiEndpointResponseStatus = require("./endpoint/apiEndpointResponseStatus.cjs");
4
+ exports.ApiEndpointResponseStatus = apiEndpointResponseStatus.ApiEndpointResponseStatus;
@@ -1,8 +1,9 @@
1
- var ApiEndpointResponseStatus;
2
- (function (ApiEndpointResponseStatus) {
3
- ApiEndpointResponseStatus["SUCCESS"] = "SUCCESS";
4
- ApiEndpointResponseStatus["FAIL"] = "FAIL";
5
- ApiEndpointResponseStatus["PROCESSING"] = "PROCESSING";
6
- })(ApiEndpointResponseStatus || (ApiEndpointResponseStatus = {}));
7
- export { ApiEndpointResponseStatus };
8
- //# sourceMappingURL=apiEndpointResponseStatus.js.map
1
+ var ApiEndpointResponseStatus = /* @__PURE__ */ ((ApiEndpointResponseStatus2) => {
2
+ ApiEndpointResponseStatus2["SUCCESS"] = "SUCCESS";
3
+ ApiEndpointResponseStatus2["FAIL"] = "FAIL";
4
+ ApiEndpointResponseStatus2["PROCESSING"] = "PROCESSING";
5
+ return ApiEndpointResponseStatus2;
6
+ })(ApiEndpointResponseStatus || {});
7
+ export {
8
+ ApiEndpointResponseStatus
9
+ };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import { ApiEndpointResponseStatus } from "./endpoint/apiEndpointResponseStatus.js";
2
- export { ApiEndpointResponseStatus, };
3
- //# sourceMappingURL=index.js.map
2
+ export {
3
+ ApiEndpointResponseStatus
4
+ };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@prosopo/api-route",
3
- "version": "2.5.5",
3
+ "version": "2.6.8",
4
4
  "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
5
6
  "type": "module",
6
7
  "engines": {
7
8
  "node": "20",
@@ -9,22 +10,25 @@
9
10
  },
10
11
  "exports": {
11
12
  ".": {
13
+ "types": "./dist/index.d.ts",
12
14
  "import": "./dist/index.js",
13
15
  "require": "./dist/cjs/index.cjs"
14
16
  }
15
17
  },
16
18
  "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"
19
+ "clean": "del-cli --verbose dist tsconfig.tsbuildinfo",
20
+ "build": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
21
+ "build:tsc": "tsc --build --verbose",
22
+ "build:cjs": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
23
+ "typecheck": "tsc --build --declaration --emitDeclarationOnly",
24
+ "test": "echo no tests"
21
25
  },
22
26
  "dependencies": {
23
- "zod": "3.23.8"
24
- },
25
- "devDependencies": {
26
- "@prosopo/config": "2.5.5"
27
+ "@prosopo/common": "3.1.0",
28
+ "zod": "3.23.8",
29
+ "@prosopo/config": "3.1.1"
27
30
  },
31
+ "devDependencies": {},
28
32
  "author": "PROSOPO LIMITED <info@prosopo.io>",
29
33
  "license": "Apache-2.0",
30
34
  "bugs": {
@@ -1,3 +1,4 @@
1
+ import path from "node:path";
1
2
  // Copyright 2021-2025 Prosopo (UK) Ltd.
2
3
  //
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,10 +12,11 @@
11
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
13
  // See the License for the specific language governing permissions and
13
14
  // limitations under the License.
14
-
15
- import path from "node:path";
16
15
  import { ViteCommonJSConfig } from "@prosopo/config";
17
16
 
18
17
  export default function () {
19
- return ViteCommonJSConfig("api-route", path.resolve("./tsconfig.cjs.json"));
18
+ return ViteCommonJSConfig(
19
+ path.basename("."),
20
+ path.resolve("./tsconfig.json"),
21
+ );
20
22
  }
@@ -0,0 +1,20 @@
1
+ // Copyright 2021-2025 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 { ViteEsmConfig } from "@prosopo/config";
17
+
18
+ export default function () {
19
+ return ViteEsmConfig(path.basename("."), path.resolve("./tsconfig.json"));
20
+ }
@@ -1,8 +0,0 @@
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
@@ -1 +0,0 @@
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"}
package/dist/apiRoute.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=apiRoute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiRoute.js","sourceRoot":"","sources":["../src/apiRoute.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import type { ApiRoute } from "./apiRoute.js";
2
- interface ApiRoutesProvider {
3
- getRoutes(): ApiRoute[];
4
- }
5
- export type { ApiRoutesProvider };
6
- //# sourceMappingURL=apiRoutesProvider.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=apiRoutesProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiRoutesProvider.js","sourceRoot":"","sources":["../src/apiRoutesProvider.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import type { Logger } from "@prosopo/common";
2
- import type { ZodType, z } from "zod";
3
- import type { ApiEndpointResponse } from "./apiEndpointResponse.js";
4
- interface ApiEndpoint<T extends ZodType | undefined> {
5
- processRequest: T extends ZodType ? (args: z.infer<T>, logger?: Logger) => Promise<ApiEndpointResponse> : (logger?: Logger) => Promise<ApiEndpointResponse>;
6
- getRequestArgsSchema(): T;
7
- }
8
- export type { ApiEndpoint };
9
- //# sourceMappingURL=apiEndpoint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiEndpoint.d.ts","sourceRoot":"","sources":["../../src/endpoint/apiEndpoint.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,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,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,GACnE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAErD,oBAAoB,IAAI,CAAC,CAAC;CAC1B;AAED,YAAY,EAAE,WAAW,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=apiEndpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiEndpoint.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpoint.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import type { ApiEndpointResponseStatus } from "./apiEndpointResponseStatus.js";
2
- interface ApiEndpointResponse {
3
- status: ApiEndpointResponseStatus;
4
- data?: object;
5
- error?: string;
6
- }
7
- export type { ApiEndpointResponse };
8
- //# sourceMappingURL=apiEndpointResponse.d.ts.map
@@ -1 +0,0 @@
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;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=apiEndpointResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiEndpointResponse.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponse.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- declare enum ApiEndpointResponseStatus {
2
- SUCCESS = "SUCCESS",
3
- FAIL = "FAIL",
4
- PROCESSING = "PROCESSING"
5
- }
6
- export { ApiEndpointResponseStatus };
7
- //# sourceMappingURL=apiEndpointResponseStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiEndpointResponseStatus.d.ts","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponseStatus.ts"],"names":[],"mappings":"AAcA,aAAK,yBAAyB;IAC7B,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,UAAU,eAAe;CACzB;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiEndpointResponseStatus.js","sourceRoot":"","sources":["../../src/endpoint/apiEndpointResponseStatus.ts"],"names":[],"mappings":"AAcA,IAAK,yBAIJ;AAJD,WAAK,yBAAyB;IAC7B,gDAAmB,CAAA;IACnB,0CAAa,CAAA;IACb,sDAAyB,CAAA;AAC1B,CAAC,EAJI,yBAAyB,KAAzB,yBAAyB,QAI7B;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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.map DELETED
@@ -1 +0,0 @@
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"}