@prosopo/load-balancer 2.6.13 → 2.6.15

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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @prosopo/load-balancer
2
2
 
3
+ ## 2.6.15
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 [93d5e50]
11
+ - Updated dependencies [3573f0b]
12
+ - Updated dependencies [3573f0b]
13
+ - Updated dependencies [efd8102]
14
+ - Updated dependencies [93d5e50]
15
+ - Updated dependencies [63519d7]
16
+ - Updated dependencies [f29fc7e]
17
+ - Updated dependencies [3573f0b]
18
+ - Updated dependencies [2d0dd8a]
19
+ - @prosopo/types@3.0.4
20
+ - @prosopo/common@3.1.0
21
+ - @prosopo/config@3.1.1
22
+
23
+ ## 2.6.14
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [b0d7207]
27
+ - @prosopo/types@3.0.3
28
+
3
29
  ## 2.6.13
4
30
  ### Patch Changes
5
31
 
package/dist/index.js CHANGED
@@ -1,30 +1,38 @@
1
1
  import { ProsopoEnvError } from "@prosopo/common";
2
2
  const convertHostedProvider = (provider) => {
3
- return Object.values(provider);
3
+ return Object.values(provider);
4
4
  };
5
- export const loadBalancer = async (environment) => {
6
- if (environment === "production") {
7
- const providers = await fetch("https://provider-list.prosopo.io/", {
8
- method: "GET",
9
- mode: "cors",
10
- }).then((res) => res.json());
11
- return convertHostedProvider(providers);
12
- }
13
- if (environment === "staging") {
14
- const providers = await fetch("https://provider-list.prosopo.io/staging.json", { method: "GET", mode: "cors" }).then((res) => res.json());
15
- return convertHostedProvider(providers);
16
- }
17
- if (environment === "development") {
18
- return [
19
- {
20
- address: "5EjTA28bKSbFPPyMbUjNtArxyqjwq38r1BapVmLZShaqEedV",
21
- url: "http://localhost:9229",
22
- datasetId: "0x9f460e81ac9c71b486f796a21bb36e2263694756a6621134d110da217fd3ef25",
23
- },
24
- ];
25
- }
26
- throw new ProsopoEnvError("CONFIG.UNKNOWN_ENVIRONMENT", {
27
- context: { environment },
28
- });
5
+ const loadBalancer = async (environment) => {
6
+ if (environment === "production") {
7
+ const providers = await fetch(
8
+ "https://provider-list.prosopo.io/",
9
+ {
10
+ method: "GET",
11
+ mode: "cors"
12
+ }
13
+ ).then((res) => res.json());
14
+ return convertHostedProvider(providers);
15
+ }
16
+ if (environment === "staging") {
17
+ const providers = await fetch(
18
+ "https://provider-list.prosopo.io/staging.json",
19
+ { method: "GET", mode: "cors" }
20
+ ).then((res) => res.json());
21
+ return convertHostedProvider(providers);
22
+ }
23
+ if (environment === "development") {
24
+ return [
25
+ {
26
+ address: "5EjTA28bKSbFPPyMbUjNtArxyqjwq38r1BapVmLZShaqEedV",
27
+ url: "http://localhost:9229",
28
+ datasetId: "0x9f460e81ac9c71b486f796a21bb36e2263694756a6621134d110da217fd3ef25"
29
+ }
30
+ ];
31
+ }
32
+ throw new ProsopoEnvError("CONFIG.UNKNOWN_ENVIRONMENT", {
33
+ context: { environment }
34
+ });
35
+ };
36
+ export {
37
+ loadBalancer
29
38
  };
30
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@prosopo/load-balancer",
3
- "version": "2.6.13",
3
+ "version": "2.6.15",
4
4
  "description": "Provider load balancer",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "type": "module",
7
8
  "engines": {
8
9
  "node": "20",
@@ -10,15 +11,18 @@
10
11
  },
11
12
  "exports": {
12
13
  ".": {
14
+ "types": "./dist/index.d.ts",
13
15
  "import": "./dist/index.js",
14
16
  "require": "./dist/cjs/index.cjs"
15
17
  }
16
18
  },
17
19
  "scripts": {
18
- "test": "echo \"No test specified\"",
19
- "clean": "tsc --build --clean",
20
- "build": "tsc --build --verbose",
21
- "build:cjs": "npx vite --config vite.cjs.config.ts build"
20
+ "clean": "del-cli --verbose dist tsconfig.tsbuildinfo",
21
+ "build": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
22
+ "build:tsc": "tsc --build --verbose",
23
+ "build:cjs": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
24
+ "typecheck": "tsc --build --declaration --emitDeclarationOnly",
25
+ "test": "echo no tests"
22
26
  },
23
27
  "repository": {
24
28
  "type": "git",
@@ -31,9 +35,9 @@
31
35
  },
32
36
  "homepage": "https://github.com/prosopo/captcha#readme",
33
37
  "dependencies": {
34
- "@prosopo/common": "3.0.2",
35
- "@prosopo/config": "3.1.0",
36
- "@prosopo/types": "3.0.2",
38
+ "@prosopo/common": "3.1.0",
39
+ "@prosopo/config": "3.1.1",
40
+ "@prosopo/types": "3.0.4",
37
41
  "@typegoose/auto-increment": "4.13.0",
38
42
  "axios": "1.10.0",
39
43
  "esbuild": "0.25.6",
@@ -15,5 +15,8 @@ import path from "node:path";
15
15
  import { ViteCommonJSConfig } from "@prosopo/config";
16
16
 
17
17
  export default function () {
18
- return ViteCommonJSConfig("types-env", path.resolve("./tsconfig.cjs.json"));
18
+ return ViteCommonJSConfig(
19
+ path.basename("."),
20
+ path.resolve("./tsconfig.json"),
21
+ );
19
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
+ }
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { EnvironmentTypes } from "@prosopo/types";
2
- export type HardcodedProvider = {
3
- address: string;
4
- url: string;
5
- datasetId: string;
6
- };
7
- export declare const loadBalancer: (environment: EnvironmentTypes) => Promise<HardcodedProvider[]>;
8
- //# 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,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CAClB,CAAC;AAUF,eAAO,MAAM,YAAY,gBACX,gBAAgB,KAC3B,OAAO,CAAC,iBAAiB,EAAE,CAgC7B,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAWlD,MAAM,qBAAqB,GAAG,CAC7B,QAAyB,EACH,EAAE;IACxB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAChC,WAA6B,EACE,EAAE;IACjC,IAAI,WAAW,KAAK,YAAY,EAAE,CAAC;QAClC,MAAM,SAAS,GAAoB,MAAM,KAAK,CAC7C,mCAAmC,EACnC;YACC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,MAAM;SACZ,CACD,CAAC,IAAI,CAAC,CAAC,GAAG,E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