@prosopo/provider 4.11.5 → 4.12.0
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/.turbo/turbo-build$colon$cjs.log +19 -19
- package/.turbo/turbo-build$colon$tsc.log +24 -24
- package/.turbo/turbo-build.log +20 -20
- package/CHANGELOG.md +92 -0
- package/dist/api/admin/apiRemoveDetectorKeyEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.d.ts.map +1 -1
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.js +8 -2
- package/dist/api/admin/apiUpdateDecisionMachineEndpoint.js.map +1 -1
- package/dist/api/blacklistRequestInspector.d.ts.map +1 -1
- package/dist/api/blacklistRequestInspector.js +0 -1
- package/dist/api/blacklistRequestInspector.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.js +25 -0
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.d.ts +0 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js +0 -14
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js +0 -4
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/handler.js.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.d.ts.map +1 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js +0 -1
- package/dist/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.js.map +1 -1
- package/dist/api/captcha/getImageCaptchaChallenge.d.ts.map +1 -1
- package/dist/api/captcha/getImageCaptchaChallenge.js +20 -1
- package/dist/api/captcha/getImageCaptchaChallenge.js.map +1 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.js +0 -1
- package/dist/api/captcha/submitPoWCaptchaSolution.js.map +1 -1
- package/dist/api/public.d.ts.map +1 -1
- package/dist/api/public.js +2 -1
- package/dist/api/public.js.map +1 -1
- package/dist/api/startProviderApi.d.ts.map +1 -1
- package/dist/api/startProviderApi.js +16 -21
- package/dist/api/startProviderApi.js.map +1 -1
- package/dist/cjs/api/admin/apiUpdateDecisionMachineEndpoint.cjs +8 -2
- package/dist/cjs/api/blacklistRequestInspector.cjs +0 -1
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.cjs +25 -0
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.cjs +0 -14
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/handler.cjs +0 -4
- package/dist/cjs/api/captcha/getFrictionlessCaptchaChallenge/shortCircuit.cjs +0 -1
- package/dist/cjs/api/captcha/getImageCaptchaChallenge.cjs +20 -1
- package/dist/cjs/api/captcha/submitPoWCaptchaSolution.cjs +0 -1
- package/dist/cjs/api/public.cjs +2 -1
- package/dist/cjs/api/startProviderApi.cjs +16 -43
- package/dist/cjs/tasks/client/clientTasks.cjs +5 -1
- package/dist/cjs/tasks/decisionMachine/decisionMachineRunner.cjs +41 -17
- package/dist/cjs/tasks/detection/getBotScore.cjs +1 -5
- package/dist/cjs/tasks/frictionless/frictionlessTasks.cjs +5 -63
- package/dist/cjs/tasks/imgCaptcha/imgCaptchaTasks.cjs +0 -1
- package/dist/cjs/tasks/powCaptcha/powTasks.cjs +0 -1
- package/dist/cjs/tasks/puzzleCaptcha/puzzleTasks.cjs +0 -1
- package/dist/tasks/client/clientTasks.d.ts +5 -2
- package/dist/tasks/client/clientTasks.d.ts.map +1 -1
- package/dist/tasks/client/clientTasks.js +5 -1
- package/dist/tasks/client/clientTasks.js.map +1 -1
- package/dist/tasks/decisionMachine/decisionMachineRunner.d.ts.map +1 -1
- package/dist/tasks/decisionMachine/decisionMachineRunner.js +42 -18
- package/dist/tasks/decisionMachine/decisionMachineRunner.js.map +1 -1
- package/dist/tasks/detection/getBotScore.d.ts +0 -2
- package/dist/tasks/detection/getBotScore.d.ts.map +1 -1
- package/dist/tasks/detection/getBotScore.js +1 -5
- package/dist/tasks/detection/getBotScore.js.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.d.ts +1 -11
- package/dist/tasks/frictionless/frictionlessTasks.d.ts.map +1 -1
- package/dist/tasks/frictionless/frictionlessTasks.js +5 -63
- package/dist/tasks/frictionless/frictionlessTasks.js.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.d.ts.map +1 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js +0 -1
- package/dist/tasks/imgCaptcha/imgCaptchaTasks.js.map +1 -1
- package/dist/tasks/powCaptcha/powTasks.d.ts.map +1 -1
- package/dist/tasks/powCaptcha/powTasks.js +0 -1
- package/dist/tasks/powCaptcha/powTasks.js.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.d.ts.map +1 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js +0 -1
- package/dist/tasks/puzzleCaptcha/puzzleTasks.js.map +1 -1
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js +2 -2
- package/dist/tests/integration/api/blacklistRequestInspector.integration.test.js.map +1 -1
- package/dist/tests/integration/clientSettingsPersistence.integration.test.js +1 -1
- package/dist/tests/integration/decisionMachines.integration.test.js +2 -2
- package/dist/tests/integration/decisionMachines.integration.test.js.map +1 -1
- package/dist/tests/integration/imgCaptcha.integration.test.js +2 -2
- package/dist/tests/integration/imgCaptcha.integration.test.js.map +1 -1
- package/dist/tests/integration/powCaptcha.integration.test.js +2 -2
- package/dist/tests/integration/powCaptcha.integration.test.js.map +1 -1
- package/dist/tests/integration/routingDecisionMachines.integration.test.js +0 -1
- package/dist/tests/integration/routingDecisionMachines.integration.test.js.map +1 -1
- package/dist/tests/unit/api/blacklistRequestInspector.unit.test.js +0 -1
- package/dist/tests/unit/api/blacklistRequestInspector.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.unit.test.js +63 -0
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/accessPolicy.unit.test.js.map +1 -1
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js +0 -75
- package/dist/tests/unit/api/captcha/getFrictionlessCaptchaChallenge/decisionMachine.unit.test.js.map +1 -1
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js +0 -20
- package/dist/tests/unit/api/getFrictionlessCaptchaChallenge.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js +0 -3
- package/dist/tests/unit/tasks/decisionMachine/decisionMachineRunner.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js +0 -10
- package/dist/tests/unit/tasks/detection/getBotScore.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js +0 -82
- package/dist/tests/unit/tasks/frictionless/decryptPayload.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js +1 -13
- package/dist/tests/unit/tasks/frictionless/frictionlessTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js +0 -2
- package/dist/tests/unit/tasks/imgCaptcha/imgCaptchaTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js +0 -4
- package/dist/tests/unit/tasks/powCaptcha/powTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js +0 -2
- package/dist/tests/unit/tasks/puzzleCaptcha/puzzleTasks.unit.test.js.map +1 -1
- package/dist/tests/unit/tasks/writeQueueIntegration.unit.test.js +0 -3
- package/dist/tests/unit/tasks/writeQueueIntegration.unit.test.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
3
|
const fs = require("node:fs");
|
|
26
4
|
const https = require("node:https");
|
|
27
5
|
const path = require("node:path");
|
|
28
6
|
const node_url = require("node:url");
|
|
29
7
|
const apiExpressRouter = require("@prosopo/api-express-router");
|
|
30
|
-
const loadBalancer = require("@prosopo/load-balancer");
|
|
31
8
|
const locale = require("@prosopo/locale");
|
|
32
9
|
const logger = require("@prosopo/logger");
|
|
33
10
|
const types = require("@prosopo/types");
|
|
34
11
|
const api = require("@prosopo/user-access-policy/api");
|
|
35
|
-
const node = require("@prosopo/util/node");
|
|
36
12
|
const cors = require("cors");
|
|
37
13
|
const express = require("express");
|
|
38
14
|
const rateLimit = require("express-rate-limit");
|
|
@@ -85,24 +61,6 @@ const getUserFromJWT = (req) => {
|
|
|
85
61
|
};
|
|
86
62
|
async function startProviderApi(env, admin = false, port) {
|
|
87
63
|
env.logger.info(() => ({ msg: "Starting Prosopo API" }));
|
|
88
|
-
const providerCacheDir = path.resolve("./provider-list-cache");
|
|
89
|
-
loadBalancer.setProviderLoader(async (environment) => {
|
|
90
|
-
if (environment === "development") {
|
|
91
|
-
const { loadBalancer: loadBalancer2 } = await import("@prosopo/load-balancer");
|
|
92
|
-
return loadBalancer2(environment);
|
|
93
|
-
}
|
|
94
|
-
const url = loadBalancer.getLoadBalancerUrl(environment);
|
|
95
|
-
const filePath = await node.cacheFile(
|
|
96
|
-
providerCacheDir,
|
|
97
|
-
url,
|
|
98
|
-
env.logger,
|
|
99
|
-
"provider-list-",
|
|
100
|
-
".json"
|
|
101
|
-
);
|
|
102
|
-
const text = fs.readFileSync(filePath, "utf-8");
|
|
103
|
-
const providers = JSON.parse(text);
|
|
104
|
-
return loadBalancer.convertHostedProvider(providers);
|
|
105
|
-
});
|
|
106
64
|
const apiApp = express();
|
|
107
65
|
const apiPort = port || env.config.server?.port;
|
|
108
66
|
const apiEndpointAdapter = apiExpressRouter.createApiExpressDefaultEndpointAdapter(
|
|
@@ -128,7 +86,22 @@ async function startProviderApi(env, admin = false, port) {
|
|
|
128
86
|
paths: clientPathsExcludingVerify
|
|
129
87
|
}));
|
|
130
88
|
apiApp.set("trust proxy", 1);
|
|
131
|
-
apiApp.use(
|
|
89
|
+
apiApp.use(
|
|
90
|
+
cors({
|
|
91
|
+
exposedHeaders: ["x-prosopo-meta"],
|
|
92
|
+
allowedHeaders: [
|
|
93
|
+
"Accept",
|
|
94
|
+
"Accept-Language",
|
|
95
|
+
"Authorization",
|
|
96
|
+
"Content-Language",
|
|
97
|
+
"Content-Type",
|
|
98
|
+
"Prosopo-Site-Key",
|
|
99
|
+
"Prosopo-User",
|
|
100
|
+
"x-prosopo-meta"
|
|
101
|
+
],
|
|
102
|
+
maxAge: 86400
|
|
103
|
+
})
|
|
104
|
+
);
|
|
132
105
|
apiApp.use(express.json({ limit: "50mb" }));
|
|
133
106
|
apiApp.use(_public.publicRouter(env));
|
|
134
107
|
const isTestOrDevelopmentEnv = process.env.NODE_ENV === "test" || env.config.defaultEnvironment === "development";
|
|
@@ -333,7 +333,7 @@ class ClientTaskManager {
|
|
|
333
333
|
}
|
|
334
334
|
await this.providerDB.removeDetectorKey(detectorKey, expirationInSeconds);
|
|
335
335
|
}
|
|
336
|
-
async updateDecisionMachine(scope, runtime, source, dappAccount, language, name, version, captchaType) {
|
|
336
|
+
async updateDecisionMachine(scope, runtime, source, dappAccount, language, name, version, captchaType, kind) {
|
|
337
337
|
if (scope === types.DecisionMachineScope.Dapp && !dappAccount) {
|
|
338
338
|
throw new common.ProsopoApiError("API.BAD_REQUEST", {
|
|
339
339
|
context: { scope, dappAccount },
|
|
@@ -344,6 +344,7 @@ class ClientTaskManager {
|
|
|
344
344
|
await this.providerDB.upsertDecisionMachineArtifact({
|
|
345
345
|
scope,
|
|
346
346
|
dappAccount,
|
|
347
|
+
kind,
|
|
347
348
|
runtime,
|
|
348
349
|
language,
|
|
349
350
|
source,
|
|
@@ -356,6 +357,7 @@ class ClientTaskManager {
|
|
|
356
357
|
return {
|
|
357
358
|
scope,
|
|
358
359
|
dappAccount,
|
|
360
|
+
kind,
|
|
359
361
|
updatedAt: now.toISOString()
|
|
360
362
|
};
|
|
361
363
|
}
|
|
@@ -365,6 +367,7 @@ class ClientTaskManager {
|
|
|
365
367
|
_id: artifact._id.toString(),
|
|
366
368
|
scope: artifact.scope,
|
|
367
369
|
dappAccount: artifact.dappAccount,
|
|
370
|
+
kind: artifact.kind,
|
|
368
371
|
runtime: artifact.runtime,
|
|
369
372
|
language: artifact.language,
|
|
370
373
|
name: artifact.name,
|
|
@@ -386,6 +389,7 @@ class ClientTaskManager {
|
|
|
386
389
|
_id: artifact._id.toString(),
|
|
387
390
|
scope: artifact.scope,
|
|
388
391
|
dappAccount: artifact.dappAccount,
|
|
392
|
+
kind: artifact.kind,
|
|
389
393
|
runtime: artifact.runtime,
|
|
390
394
|
language: artifact.language,
|
|
391
395
|
source: artifact.source,
|
|
@@ -18,30 +18,33 @@ class DecisionMachineRunner {
|
|
|
18
18
|
this.db = db;
|
|
19
19
|
this.artifactCache = /* @__PURE__ */ new Map();
|
|
20
20
|
}
|
|
21
|
-
/** Build a cache key for a given scope + dappAccount
|
|
22
|
-
static cacheKey(scope, dappAccount) {
|
|
23
|
-
return `${scope}:${dappAccount ?? ""}`;
|
|
21
|
+
/** Build a cache key for a given scope + kind + dappAccount tuple. */
|
|
22
|
+
static cacheKey(scope, kind, dappAccount) {
|
|
23
|
+
return `${scope}:${kind}:${dappAccount ?? ""}`;
|
|
24
24
|
}
|
|
25
25
|
/** Return a cached artifact if still fresh, or undefined. */
|
|
26
|
-
getCachedArtifact(scope, dappAccount) {
|
|
26
|
+
getCachedArtifact(scope, kind, dappAccount) {
|
|
27
27
|
const entry = this.artifactCache.get(
|
|
28
|
-
DecisionMachineRunner.cacheKey(scope, dappAccount)
|
|
28
|
+
DecisionMachineRunner.cacheKey(scope, kind, dappAccount)
|
|
29
29
|
);
|
|
30
30
|
if (!entry) return null;
|
|
31
31
|
if (Date.now() - entry.cachedAt > ARTIFACT_CACHE_TTL_MS) {
|
|
32
32
|
this.artifactCache.delete(
|
|
33
|
-
DecisionMachineRunner.cacheKey(scope, dappAccount)
|
|
33
|
+
DecisionMachineRunner.cacheKey(scope, kind, dappAccount)
|
|
34
34
|
);
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
return entry.artifact;
|
|
38
38
|
}
|
|
39
39
|
/** Store an artifact (or undefined for negative cache) in the cache. */
|
|
40
|
-
setCachedArtifact(scope, dappAccount, artifact) {
|
|
41
|
-
this.artifactCache.set(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
setCachedArtifact(scope, kind, dappAccount, artifact) {
|
|
41
|
+
this.artifactCache.set(
|
|
42
|
+
DecisionMachineRunner.cacheKey(scope, kind, dappAccount),
|
|
43
|
+
{
|
|
44
|
+
artifact,
|
|
45
|
+
cachedAt: Date.now()
|
|
46
|
+
}
|
|
47
|
+
);
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
47
50
|
* Evaluates a single decision machine artifact and returns a decision.
|
|
@@ -55,6 +58,7 @@ class DecisionMachineRunner {
|
|
|
55
58
|
try {
|
|
56
59
|
const artifact = await this.selectArtifact(
|
|
57
60
|
input.dappAccount,
|
|
61
|
+
types.DecisionMachineKind.Decision,
|
|
58
62
|
input.captchaType
|
|
59
63
|
);
|
|
60
64
|
if (!artifact) {
|
|
@@ -92,7 +96,10 @@ class DecisionMachineRunner {
|
|
|
92
96
|
*/
|
|
93
97
|
async route(input, logger) {
|
|
94
98
|
try {
|
|
95
|
-
const artifact = await this.selectArtifact(
|
|
99
|
+
const artifact = await this.selectArtifact(
|
|
100
|
+
input.dappAccount,
|
|
101
|
+
types.DecisionMachineKind.Routing
|
|
102
|
+
);
|
|
96
103
|
if (!artifact) return void 0;
|
|
97
104
|
if (artifact.runtime !== types.DecisionMachineRuntime.Node) {
|
|
98
105
|
logger?.warn?.(() => ({
|
|
@@ -123,7 +130,10 @@ class DecisionMachineRunner {
|
|
|
123
130
|
*/
|
|
124
131
|
async getRequiredCounters(input, logger) {
|
|
125
132
|
try {
|
|
126
|
-
const artifact = await this.selectArtifact(
|
|
133
|
+
const artifact = await this.selectArtifact(
|
|
134
|
+
input.dappAccount,
|
|
135
|
+
types.DecisionMachineKind.Routing
|
|
136
|
+
);
|
|
127
137
|
if (!artifact) return [];
|
|
128
138
|
if (artifact.runtime !== types.DecisionMachineRuntime.Node) return [];
|
|
129
139
|
const specs = await this.runArtifactExport(
|
|
@@ -156,12 +166,16 @@ class DecisionMachineRunner {
|
|
|
156
166
|
* @param captchaType - The captcha type to filter by (optional)
|
|
157
167
|
* @returns The single highest-priority artifact, or undefined if none exists
|
|
158
168
|
*/
|
|
159
|
-
async selectArtifact(dappAccount, captchaType) {
|
|
169
|
+
async selectArtifact(dappAccount, kind, captchaType) {
|
|
160
170
|
const cachedDapp = this.getCachedArtifact(
|
|
161
171
|
types.DecisionMachineScope.Dapp,
|
|
172
|
+
kind,
|
|
162
173
|
dappAccount
|
|
163
174
|
);
|
|
164
|
-
const cachedGlobal = this.getCachedArtifact(
|
|
175
|
+
const cachedGlobal = this.getCachedArtifact(
|
|
176
|
+
types.DecisionMachineScope.Global,
|
|
177
|
+
kind
|
|
178
|
+
);
|
|
165
179
|
if (cachedDapp !== null && cachedGlobal !== null) {
|
|
166
180
|
if (cachedDapp && this.matchesCaptchaType(cachedDapp, captchaType)) {
|
|
167
181
|
return cachedDapp;
|
|
@@ -172,17 +186,27 @@ class DecisionMachineRunner {
|
|
|
172
186
|
return void 0;
|
|
173
187
|
}
|
|
174
188
|
const [dappArtifact, globalArtifact] = await Promise.all([
|
|
175
|
-
cachedDapp !== null ? Promise.resolve(cachedDapp) : this.db.getDecisionMachineArtifact(
|
|
189
|
+
cachedDapp !== null ? Promise.resolve(cachedDapp) : this.db.getDecisionMachineArtifact(
|
|
190
|
+
types.DecisionMachineScope.Dapp,
|
|
191
|
+
dappAccount,
|
|
192
|
+
kind
|
|
193
|
+
).then((a) => {
|
|
176
194
|
this.setCachedArtifact(
|
|
177
195
|
types.DecisionMachineScope.Dapp,
|
|
196
|
+
kind,
|
|
178
197
|
dappAccount,
|
|
179
198
|
a ?? void 0
|
|
180
199
|
);
|
|
181
200
|
return a ?? void 0;
|
|
182
201
|
}),
|
|
183
|
-
cachedGlobal !== null ? Promise.resolve(cachedGlobal) : this.db.getDecisionMachineArtifact(
|
|
202
|
+
cachedGlobal !== null ? Promise.resolve(cachedGlobal) : this.db.getDecisionMachineArtifact(
|
|
203
|
+
types.DecisionMachineScope.Global,
|
|
204
|
+
void 0,
|
|
205
|
+
kind
|
|
206
|
+
).then((a) => {
|
|
184
207
|
this.setCachedArtifact(
|
|
185
208
|
types.DecisionMachineScope.Global,
|
|
209
|
+
kind,
|
|
186
210
|
void 0,
|
|
187
211
|
a ?? void 0
|
|
188
212
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const decodePayload = require("./decodePayload.cjs");
|
|
4
|
-
const DEFAULT_ENTROPY = 13837;
|
|
5
4
|
const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
6
5
|
const result = await decodePayload(
|
|
7
6
|
payload,
|
|
@@ -10,7 +9,6 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
10
9
|
);
|
|
11
10
|
const baseBotScore = result.score;
|
|
12
11
|
const timestamp = result.timestamp;
|
|
13
|
-
const providerSelectEntropy = result.providerSelectEntropy;
|
|
14
12
|
const userId = result.userId;
|
|
15
13
|
const userAgent = result.userAgent;
|
|
16
14
|
const isWebView = result.isWebView ?? false;
|
|
@@ -25,14 +23,12 @@ const getBotScore = async (payload, headHash, privateKeyString) => {
|
|
|
25
23
|
if (baseBotScore === void 0 || Number.isNaN(baseBotScore)) {
|
|
26
24
|
return {
|
|
27
25
|
baseBotScore: 1,
|
|
28
|
-
timestamp: 0
|
|
29
|
-
providerSelectEntropy: DEFAULT_ENTROPY
|
|
26
|
+
timestamp: 0
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
return {
|
|
33
30
|
baseBotScore,
|
|
34
31
|
timestamp,
|
|
35
|
-
providerSelectEntropy,
|
|
36
32
|
userId,
|
|
37
33
|
userAgent,
|
|
38
34
|
isWebView,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const loadBalancer = require("@prosopo/load-balancer");
|
|
4
3
|
const types = require("@prosopo/types");
|
|
5
4
|
const uuid = require("uuid");
|
|
6
5
|
const dnsEventUrl = require("../../api/dnsEventUrl.cjs");
|
|
@@ -10,17 +9,7 @@ const captchaManager = require("../captchaManager.cjs");
|
|
|
10
9
|
const decisionMachineRunner = require("../decisionMachine/decisionMachineRunner.cjs");
|
|
11
10
|
const getBotScore = require("../detection/getBotScore.cjs");
|
|
12
11
|
const routingMachine = require("./routingMachine.cjs");
|
|
13
|
-
const getDefaultEntropy = () => {
|
|
14
|
-
if (process.env.PROSOPO_ENTROPY) {
|
|
15
|
-
const parsed = Number.parseInt(process.env.PROSOPO_ENTROPY);
|
|
16
|
-
if (!Number.isNaN(parsed)) {
|
|
17
|
-
return parsed;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return 13337;
|
|
21
|
-
};
|
|
22
12
|
const DEFAULT_MAX_TIMESTAMP_AGE = 60 * 10 * 1e3;
|
|
23
|
-
const DEFAULT_ENTROPY = getDefaultEntropy();
|
|
24
13
|
const getSessionIDPrefix = (host) => {
|
|
25
14
|
return host ? host.replace(".prosopo.io", "") : "local";
|
|
26
15
|
};
|
|
@@ -49,7 +38,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
49
38
|
score: params.score,
|
|
50
39
|
threshold: params.threshold,
|
|
51
40
|
scoreComponents: params.scoreComponents,
|
|
52
|
-
providerSelectEntropy: params.providerSelectEntropy,
|
|
53
41
|
ipAddress: params.ipAddress,
|
|
54
42
|
webView: params.webView ?? false,
|
|
55
43
|
iFrame: params.iFrame ?? false,
|
|
@@ -74,7 +62,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
74
62
|
checkLangRules(acceptLanguage) {
|
|
75
63
|
return lang.checkLangRules(this.config, acceptLanguage);
|
|
76
64
|
}
|
|
77
|
-
async createSession(token, score, threshold, scoreComponents,
|
|
65
|
+
async createSession(token, score, threshold, scoreComponents, ipAddress, captchaType, siteKey, solvedImagesCount, powDifficulty, userSitekeyIpHash, webView = false, iFrame = false, decryptedHeadHash = "", reason, blocked, deleted, ipInfo, headers, mode, simdReadings, entropyMathRandomFingerprint, entropyCryptoFingerprint, entropyWallClockOffsetMs, entropyMathRandomFirst) {
|
|
78
66
|
const sessionRecord = {
|
|
79
67
|
sessionId: `${getSessionIDPrefix(this.config.host)}-${uuid.v4()}`,
|
|
80
68
|
createdAt: /* @__PURE__ */ new Date(),
|
|
@@ -82,7 +70,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
82
70
|
score,
|
|
83
71
|
threshold,
|
|
84
72
|
scoreComponents,
|
|
85
|
-
providerSelectEntropy,
|
|
86
73
|
ipAddress,
|
|
87
74
|
captchaType,
|
|
88
75
|
mode,
|
|
@@ -128,25 +115,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
128
115
|
}
|
|
129
116
|
return sessionRecord;
|
|
130
117
|
}
|
|
131
|
-
async hostVerified(entropy) {
|
|
132
|
-
const chosen = await loadBalancer.getRandomActiveProvider(
|
|
133
|
-
this.config.defaultEnvironment,
|
|
134
|
-
entropy
|
|
135
|
-
);
|
|
136
|
-
const domain = new URL(chosen.provider.url).hostname;
|
|
137
|
-
const configDomain = this.config.host.indexOf("http") > -1 ? new URL(this.config.host).hostname : this.config.host;
|
|
138
|
-
this.logger.info(() => ({
|
|
139
|
-
data: { entropy, host: this.config.host, domain }
|
|
140
|
-
}));
|
|
141
|
-
if (domain !== configDomain) {
|
|
142
|
-
this.logger.info(() => ({
|
|
143
|
-
msg: "Host mismatch",
|
|
144
|
-
data: { expected: configDomain, got: domain, entropy }
|
|
145
|
-
}));
|
|
146
|
-
return { verified: false, domain };
|
|
147
|
-
}
|
|
148
|
-
return { verified: true, domain };
|
|
149
|
-
}
|
|
150
118
|
async sendImageCaptcha(params) {
|
|
151
119
|
return this.sendCaptcha(types.CaptchaType.image, params);
|
|
152
120
|
}
|
|
@@ -161,7 +129,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
161
129
|
// validation and the createSession invocation only live in one place.
|
|
162
130
|
async sendCaptcha(captchaType, params) {
|
|
163
131
|
const effectiveParams = { ...this.sessionParams, ...params };
|
|
164
|
-
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents ||
|
|
132
|
+
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents || !effectiveParams.ipAddress || effectiveParams.siteKey === void 0) {
|
|
165
133
|
throw new Error(
|
|
166
134
|
`Session parameters must be set before sending a ${captchaType} captcha`
|
|
167
135
|
);
|
|
@@ -187,7 +155,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
187
155
|
effectiveParams.score,
|
|
188
156
|
effectiveParams.threshold,
|
|
189
157
|
effectiveParams.scoreComponents,
|
|
190
|
-
effectiveParams.providerSelectEntropy,
|
|
191
158
|
effectiveParams.ipAddress,
|
|
192
159
|
finalCaptchaType,
|
|
193
160
|
effectiveParams.siteKey,
|
|
@@ -229,7 +196,7 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
229
196
|
}
|
|
230
197
|
async registerBlockedSession(params) {
|
|
231
198
|
const effectiveParams = { ...this.sessionParams, ...params };
|
|
232
|
-
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents ||
|
|
199
|
+
if (!effectiveParams.token || effectiveParams.score === void 0 || effectiveParams.threshold === void 0 || !effectiveParams.scoreComponents || !effectiveParams.ipAddress || effectiveParams.siteKey === void 0) {
|
|
233
200
|
throw new Error(
|
|
234
201
|
"Session parameters must be set before calling registerBlockedSession"
|
|
235
202
|
);
|
|
@@ -239,7 +206,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
239
206
|
effectiveParams.score,
|
|
240
207
|
effectiveParams.threshold,
|
|
241
208
|
effectiveParams.scoreComponents,
|
|
242
|
-
effectiveParams.providerSelectEntropy,
|
|
243
209
|
effectiveParams.ipAddress,
|
|
244
210
|
types.CaptchaType.image,
|
|
245
211
|
effectiveParams.siteKey,
|
|
@@ -269,20 +235,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
269
235
|
}
|
|
270
236
|
};
|
|
271
237
|
}
|
|
272
|
-
scoreIncreaseUnverifiedHost(host, baseBotScore, botScore, scoreComponents) {
|
|
273
|
-
this.logger.info(() => ({
|
|
274
|
-
msg: "Host not verified",
|
|
275
|
-
data: { requested: this.config.host, selected: host }
|
|
276
|
-
}));
|
|
277
|
-
botScore += this.config.penalties.PENALTY_UNVERIFIED_HOST;
|
|
278
|
-
return {
|
|
279
|
-
score: botScore,
|
|
280
|
-
scoreComponents: {
|
|
281
|
-
...scoreComponents,
|
|
282
|
-
unverifiedHost: this.config.penalties.PENALTY_UNVERIFIED_HOST
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
238
|
scoreIncreaseWebView(baseBotScore, botScore, scoreComponents) {
|
|
287
239
|
this.logger.debug(() => ({
|
|
288
240
|
msg: "WebView detected"
|
|
@@ -350,7 +302,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
350
302
|
});
|
|
351
303
|
let baseBotScore;
|
|
352
304
|
let timestamp;
|
|
353
|
-
let providerSelectEntropy;
|
|
354
305
|
let userId;
|
|
355
306
|
let userAgent;
|
|
356
307
|
let webView;
|
|
@@ -375,7 +326,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
375
326
|
decryptedHeadHash = decrypted.decryptedHeadHash || "";
|
|
376
327
|
const s = decrypted.baseBotScore;
|
|
377
328
|
const t = decrypted.timestamp;
|
|
378
|
-
const p = decrypted.providerSelectEntropy;
|
|
379
329
|
const a = decrypted.userId;
|
|
380
330
|
const u = decrypted.userAgent;
|
|
381
331
|
const w = decrypted.isWebView;
|
|
@@ -392,7 +342,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
392
342
|
key: this.redactKeyForLogging(key),
|
|
393
343
|
baseBotScore: s,
|
|
394
344
|
timestamp: t,
|
|
395
|
-
entropy: p,
|
|
396
345
|
userId: a,
|
|
397
346
|
userAgent: u,
|
|
398
347
|
webView: w,
|
|
@@ -407,7 +356,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
407
356
|
}));
|
|
408
357
|
baseBotScore = s;
|
|
409
358
|
timestamp = t;
|
|
410
|
-
providerSelectEntropy = p;
|
|
411
359
|
userId = a;
|
|
412
360
|
userAgent = u;
|
|
413
361
|
webView = w;
|
|
@@ -426,7 +374,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
426
374
|
}));
|
|
427
375
|
baseBotScore = 1;
|
|
428
376
|
timestamp = 0;
|
|
429
|
-
providerSelectEntropy = DEFAULT_ENTROPY + 1;
|
|
430
377
|
decryptedHeadHash = "";
|
|
431
378
|
decryptionFailed = true;
|
|
432
379
|
}
|
|
@@ -434,15 +381,13 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
434
381
|
}
|
|
435
382
|
const baseBotScoreUndefined = baseBotScore === void 0 || Number.isNaN(baseBotScore);
|
|
436
383
|
const timestampUndefined = timestamp === void 0 || Number.isNaN(timestamp);
|
|
437
|
-
const
|
|
438
|
-
const undefinedCount = Number(baseBotScoreUndefined) + Number(timestampUndefined) + Number(providerSelectEntropyUndefined);
|
|
384
|
+
const undefinedCount = Number(baseBotScoreUndefined) + Number(timestampUndefined);
|
|
439
385
|
if (undefinedCount > 0) {
|
|
440
386
|
this.logger.error(() => ({
|
|
441
|
-
msg: "Error decrypting score: baseBotScore or timestamp
|
|
387
|
+
msg: "Error decrypting score: baseBotScore or timestamp is undefined"
|
|
442
388
|
}));
|
|
443
389
|
baseBotScore = 1;
|
|
444
390
|
timestamp = 0;
|
|
445
|
-
providerSelectEntropy = DEFAULT_ENTROPY - undefinedCount;
|
|
446
391
|
decryptedHeadHash = "";
|
|
447
392
|
decryptionFailed = true;
|
|
448
393
|
}
|
|
@@ -451,7 +396,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
451
396
|
data: {
|
|
452
397
|
baseBotScore,
|
|
453
398
|
timestamp,
|
|
454
|
-
entropy: providerSelectEntropy,
|
|
455
399
|
userId,
|
|
456
400
|
userAgent,
|
|
457
401
|
webView,
|
|
@@ -464,7 +408,6 @@ class FrictionlessManager extends captchaManager.CaptchaManager {
|
|
|
464
408
|
return {
|
|
465
409
|
baseBotScore: Number(baseBotScore),
|
|
466
410
|
timestamp: Number(timestamp),
|
|
467
|
-
providerSelectEntropy: Number(providerSelectEntropy),
|
|
468
411
|
userId,
|
|
469
412
|
userAgent,
|
|
470
413
|
webView: webView || false,
|
|
@@ -487,5 +430,4 @@ Object.defineProperty(exports, "FrictionlessReason", {
|
|
|
487
430
|
enumerable: true,
|
|
488
431
|
get: () => types.FrictionlessReason
|
|
489
432
|
});
|
|
490
|
-
exports.DEFAULT_ENTROPY = DEFAULT_ENTROPY;
|
|
491
433
|
exports.FrictionlessManager = FrictionlessManager;
|
|
@@ -699,7 +699,6 @@ class ImgCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
699
699
|
scoreComponents: sessionRecord?.scoreComponents,
|
|
700
700
|
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
701
701
|
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
702
|
-
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
703
702
|
simdReadings: sessionRecord?.simdReadings,
|
|
704
703
|
frictionlessReason: sessionRecord?.reason,
|
|
705
704
|
ruleType: sessionRecord?.ruleType,
|
|
@@ -588,7 +588,6 @@ class PowCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
588
588
|
scoreComponents: sessionRecord?.scoreComponents,
|
|
589
589
|
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
590
590
|
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
591
|
-
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
592
591
|
simdReadings: sessionRecord?.simdReadings,
|
|
593
592
|
frictionlessReason: sessionRecord?.reason,
|
|
594
593
|
ruleType: sessionRecord?.ruleType,
|
|
@@ -531,7 +531,6 @@ class PuzzleCaptchaManager extends captchaManager.CaptchaManager {
|
|
|
531
531
|
scoreComponents: sessionRecord?.scoreComponents,
|
|
532
532
|
decryptedHeadHash: sessionRecord?.decryptedHeadHash,
|
|
533
533
|
userSitekeyIpHash: sessionRecord?.userSitekeyIpHash,
|
|
534
|
-
providerSelectEntropy: sessionRecord?.providerSelectEntropy,
|
|
535
534
|
simdReadings: sessionRecord?.simdReadings,
|
|
536
535
|
frictionlessReason: sessionRecord?.reason,
|
|
537
536
|
ruleType: sessionRecord?.ruleType,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CaptchaDatabase } from "@prosopo/database";
|
|
2
2
|
import type { Logger } from "@prosopo/logger";
|
|
3
|
-
import { type DecisionMachineCaptchaType, type DecisionMachineLanguage, type DecisionMachineRuntime, DecisionMachineScope, type IUserSettings, type ProsopoConfigOutput, Tier } from "@prosopo/types";
|
|
3
|
+
import { type DecisionMachineCaptchaType, type DecisionMachineKind, type DecisionMachineLanguage, type DecisionMachineRuntime, DecisionMachineScope, type IUserSettings, type ProsopoConfigOutput, Tier } from "@prosopo/types";
|
|
4
4
|
import type { IProviderDatabase } from "@prosopo/types-database";
|
|
5
5
|
export declare class ClientTaskManager {
|
|
6
6
|
config: ProsopoConfigOutput;
|
|
@@ -24,15 +24,17 @@ export declare class ClientTaskManager {
|
|
|
24
24
|
}>): Promise<void>;
|
|
25
25
|
updateDetectorKey(detectorKey: string): Promise<string[]>;
|
|
26
26
|
removeDetectorKey(detectorKey: string, expirationInSeconds?: number): Promise<void>;
|
|
27
|
-
updateDecisionMachine(scope: DecisionMachineScope, runtime: DecisionMachineRuntime, source: string, dappAccount?: string, language?: DecisionMachineLanguage, name?: string, version?: string, captchaType?: DecisionMachineCaptchaType): Promise<{
|
|
27
|
+
updateDecisionMachine(scope: DecisionMachineScope, runtime: DecisionMachineRuntime, source: string, dappAccount?: string, language?: DecisionMachineLanguage, name?: string, version?: string, captchaType?: DecisionMachineCaptchaType, kind?: DecisionMachineKind): Promise<{
|
|
28
28
|
scope: DecisionMachineScope;
|
|
29
29
|
dappAccount?: string;
|
|
30
|
+
kind?: DecisionMachineKind;
|
|
30
31
|
updatedAt: string;
|
|
31
32
|
}>;
|
|
32
33
|
getAllDecisionMachines(): Promise<{
|
|
33
34
|
_id: string;
|
|
34
35
|
scope: DecisionMachineScope;
|
|
35
36
|
dappAccount?: string;
|
|
37
|
+
kind?: DecisionMachineKind;
|
|
36
38
|
runtime: DecisionMachineRuntime;
|
|
37
39
|
language?: DecisionMachineLanguage;
|
|
38
40
|
name?: string;
|
|
@@ -45,6 +47,7 @@ export declare class ClientTaskManager {
|
|
|
45
47
|
_id: string;
|
|
46
48
|
scope: DecisionMachineScope;
|
|
47
49
|
dappAccount?: string;
|
|
50
|
+
kind?: DecisionMachineKind;
|
|
48
51
|
runtime: DecisionMachineRuntime;
|
|
49
52
|
language?: DecisionMachineLanguage;
|
|
50
53
|
source: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientTasks.d.ts","sourceRoot":"","sources":["../../../src/tasks/client/clientTasks.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAkB,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAEN,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,oBAAoB,EACpB,KAA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C;QACnC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,0BAA0B,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KAClB,EAAE,CACH;IAiBK,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAC7C,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,oBAAoB,CAAC;QAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,mBAAmB,CAAC;QAC3B,OAAO,EAAE,sBAAsB,CAAC;QAChC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;QACnC,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,0BAA0B,CAAC;QACzC,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;IAwBI,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QAChD,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KAClB,CAAC;IAcI,yBAAyB,IAAI,OAAO,CAAC;QAC1C,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;KACrB,CAAC;IAaF,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO;IA8CrE,OAAO,CAAC,eAAe;YAWT,wBAAwB;CAatC"}
|
|
@@ -331,7 +331,7 @@ class ClientTaskManager {
|
|
|
331
331
|
}
|
|
332
332
|
await this.providerDB.removeDetectorKey(detectorKey, expirationInSeconds);
|
|
333
333
|
}
|
|
334
|
-
async updateDecisionMachine(scope, runtime, source, dappAccount, language, name, version, captchaType) {
|
|
334
|
+
async updateDecisionMachine(scope, runtime, source, dappAccount, language, name, version, captchaType, kind) {
|
|
335
335
|
if (scope === DecisionMachineScope.Dapp && !dappAccount) {
|
|
336
336
|
throw new ProsopoApiError("API.BAD_REQUEST", {
|
|
337
337
|
context: { scope, dappAccount },
|
|
@@ -342,6 +342,7 @@ class ClientTaskManager {
|
|
|
342
342
|
await this.providerDB.upsertDecisionMachineArtifact({
|
|
343
343
|
scope,
|
|
344
344
|
dappAccount,
|
|
345
|
+
kind,
|
|
345
346
|
runtime,
|
|
346
347
|
language,
|
|
347
348
|
source,
|
|
@@ -354,6 +355,7 @@ class ClientTaskManager {
|
|
|
354
355
|
return {
|
|
355
356
|
scope,
|
|
356
357
|
dappAccount,
|
|
358
|
+
kind,
|
|
357
359
|
updatedAt: now.toISOString()
|
|
358
360
|
};
|
|
359
361
|
}
|
|
@@ -363,6 +365,7 @@ class ClientTaskManager {
|
|
|
363
365
|
_id: artifact._id.toString(),
|
|
364
366
|
scope: artifact.scope,
|
|
365
367
|
dappAccount: artifact.dappAccount,
|
|
368
|
+
kind: artifact.kind,
|
|
366
369
|
runtime: artifact.runtime,
|
|
367
370
|
language: artifact.language,
|
|
368
371
|
name: artifact.name,
|
|
@@ -384,6 +387,7 @@ class ClientTaskManager {
|
|
|
384
387
|
_id: artifact._id.toString(),
|
|
385
388
|
scope: artifact.scope,
|
|
386
389
|
dappAccount: artifact.dappAccount,
|
|
390
|
+
kind: artifact.kind,
|
|
387
391
|
runtime: artifact.runtime,
|
|
388
392
|
language: artifact.language,
|
|
389
393
|
source: artifact.source,
|