@prosopo/cli 3.6.73 → 3.6.75
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 +37 -27
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +30 -27
- package/CHANGELOG.md +32 -0
- package/dist/RateLimiter.js +118 -118
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/argv.js +37 -36
- package/dist/bundle/decodeBehavior-BnJdECMR.js +233 -0
- package/dist/bundle/decodeSimd-hDznYwxo.js +218 -0
- package/dist/bundle/i18nBackend-C078WszN.js +3553 -0
- package/dist/bundle/i18nFrontend-pIqw8hl9.js +850 -0
- package/dist/bundle/i18next-q3w8LsnI.js +1213 -0
- package/dist/bundle/node-ponyfill-BXKwLYwg.js +1534 -0
- package/dist/bundle/provider.cli.bundle.js +102274 -131288
- package/dist/bundle/src-DhRyWllF.js +1880 -0
- package/dist/cjs/RateLimiter.cjs +118 -118
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/argv.cjs +41 -38
- package/dist/cjs/cli.cjs +32 -43
- package/dist/cjs/commands/ensureExternalIndexes.cjs +26 -27
- package/dist/cjs/commands/ensureIndexes.cjs +24 -25
- package/dist/cjs/commands/index.cjs +18 -20
- package/dist/cjs/commands/migrateAbuserScoreThreshold.cjs +54 -65
- package/dist/cjs/commands/providerSetDataset.cjs +45 -59
- package/dist/cjs/commands/siteKeyRegister.cjs +93 -105
- package/dist/cjs/commands/siteKeyRegisterApi.cjs +84 -102
- package/dist/cjs/commands/storeCaptchasExternally.cjs +24 -24
- package/dist/cjs/commands/updateSpamEmailDomains.cjs +42 -49
- package/dist/cjs/commands/validators.cjs +18 -37
- package/dist/cjs/commands/version.cjs +14 -15
- package/dist/cjs/files.cjs +32 -30
- package/dist/cjs/index.cjs +15 -17
- package/dist/cjs/process.env.cjs +14 -25
- package/dist/cjs/prosopo.config.cjs +108 -132
- package/dist/cjs/reloader.cjs +54 -63
- package/dist/cjs/start.cjs +59 -81
- package/dist/cli.js +27 -37
- package/dist/commands/ensureExternalIndexes.js +24 -26
- package/dist/commands/ensureIndexes.js +22 -24
- package/dist/commands/index.js +10 -20
- package/dist/commands/migrateAbuserScoreThreshold.js +52 -64
- package/dist/commands/providerSetDataset.js +41 -41
- package/dist/commands/siteKeyRegister.js +90 -103
- package/dist/commands/siteKeyRegisterApi.js +82 -101
- package/dist/commands/storeCaptchasExternally.js +22 -23
- package/dist/commands/updateSpamEmailDomains.js +40 -48
- package/dist/commands/validators.js +15 -37
- package/dist/commands/version.js +13 -15
- package/dist/files.js +28 -30
- package/dist/index.js +5 -16
- package/dist/process.env.js +14 -28
- package/dist/prosopo.config.js +108 -131
- package/dist/reloader.js +49 -61
- package/dist/start.js +57 -79
- package/package.json +16 -16
- package/dist/bundle/decodeBehavior-Btp_pZCR.js +0 -224
- package/dist/bundle/decodeSimd-Cz4sdHHN.js +0 -212
- package/dist/bundle/i18nBackend-BiuZSvrn.js +0 -5366
- package/dist/bundle/index-DUVLsNmB.js +0 -2371
|
@@ -1,104 +1,85 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateSiteKey } from "./validators.js";
|
|
2
|
+
import { SiteKeyRegisterCommandArgsSpec } from "./siteKeyRegister.js";
|
|
3
|
+
import { LogLevel, getLogger } from "@prosopo/logger";
|
|
2
4
|
import { ProviderEnvironment } from "@prosopo/env";
|
|
3
|
-
import { getLogger, LogLevel } from "@prosopo/logger";
|
|
4
|
-
import { puzzleToleranceDefault, CaptchaTypeSpec, Tier } from "@prosopo/types";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
verifiedTimeout: 6e4,
|
|
84
|
-
solutionTimeout: 6e4
|
|
85
|
-
},
|
|
86
|
-
jwt
|
|
87
|
-
);
|
|
88
|
-
logger.info(() => ({
|
|
89
|
-
data: { sitekey },
|
|
90
|
-
msg: "Site Key registered"
|
|
91
|
-
}));
|
|
92
|
-
} catch (err) {
|
|
93
|
-
logger.error(() => ({
|
|
94
|
-
err,
|
|
95
|
-
msg: "Error registering Site Key"
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
middlewares: [validateSiteKey]
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
export {
|
|
103
|
-
commandSiteKeyRegisterApi as default
|
|
6
|
+
import { CaptchaTypeSpec, Tier, puzzleToleranceDefault } from "@prosopo/types";
|
|
7
|
+
import { ProviderApi } from "@prosopo/api";
|
|
8
|
+
//#region src/commands/siteKeyRegisterApi.ts
|
|
9
|
+
var SiteKeyRegisterApiCommandArgsSpec = SiteKeyRegisterCommandArgsSpec.extend({ url: z.string() });
|
|
10
|
+
var siteKeyRegisterApi_default = (pair, authAccount, config, cmdArgs) => {
|
|
11
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.dapp_register");
|
|
12
|
+
return {
|
|
13
|
+
command: "site_key_register_api <sitekey> <url>",
|
|
14
|
+
describe: "Register a Site Key",
|
|
15
|
+
builder: (yargs) => yargs.positional("sitekey", {
|
|
16
|
+
type: "string",
|
|
17
|
+
demandOption: true,
|
|
18
|
+
desc: "The AccountId of the application to register the Site Key with"
|
|
19
|
+
}).positional("tier", {
|
|
20
|
+
choices: Object.values(Tier),
|
|
21
|
+
demandOption: true,
|
|
22
|
+
desc: "The tier of the account"
|
|
23
|
+
}).option("url", {
|
|
24
|
+
type: "string",
|
|
25
|
+
demandOption: true,
|
|
26
|
+
desc: "Provider URL to register the Site Key with"
|
|
27
|
+
}).option("captcha_type", {
|
|
28
|
+
type: "string",
|
|
29
|
+
demandOption: false,
|
|
30
|
+
desc: "Captcha type for settings"
|
|
31
|
+
}).option("frictionless_threshold", {
|
|
32
|
+
type: "number",
|
|
33
|
+
demandOption: false,
|
|
34
|
+
desc: "Frictionless threshold for settings"
|
|
35
|
+
}).option("domains", {
|
|
36
|
+
type: "array",
|
|
37
|
+
demandOption: false,
|
|
38
|
+
desc: "URLs for settings"
|
|
39
|
+
}).option("pow_difficulty", {
|
|
40
|
+
type: "number",
|
|
41
|
+
demandOption: false,
|
|
42
|
+
desc: "POW difficulty for settings"
|
|
43
|
+
}).option("image_threshold", {
|
|
44
|
+
type: "number",
|
|
45
|
+
demandOption: false,
|
|
46
|
+
desc: "Image threshold for settings"
|
|
47
|
+
}).option("image_max_rounds", {
|
|
48
|
+
type: "number",
|
|
49
|
+
demandOption: false,
|
|
50
|
+
desc: "Max image rounds"
|
|
51
|
+
}),
|
|
52
|
+
handler: async (argv) => {
|
|
53
|
+
try {
|
|
54
|
+
await new ProviderEnvironment(config, pair, authAccount).isReady();
|
|
55
|
+
const { sitekey, captcha_type, frictionless_threshold, url, domains, pow_difficulty, image_threshold, image_max_rounds } = SiteKeyRegisterApiCommandArgsSpec.parse(argv);
|
|
56
|
+
const api = new ProviderApi(url, pair.address);
|
|
57
|
+
const jwt = pair.jwtIssue();
|
|
58
|
+
await api.registerSiteKey(sitekey, argv.tier, {
|
|
59
|
+
captchaType: CaptchaTypeSpec.parse(captcha_type),
|
|
60
|
+
frictionlessThreshold: frictionless_threshold,
|
|
61
|
+
domains: domains || [],
|
|
62
|
+
powDifficulty: pow_difficulty,
|
|
63
|
+
imageThreshold: image_threshold,
|
|
64
|
+
imageMaxRounds: image_max_rounds,
|
|
65
|
+
puzzleTolerance: puzzleToleranceDefault,
|
|
66
|
+
disallowWebView: false,
|
|
67
|
+
verifiedTimeout: 6e4,
|
|
68
|
+
solutionTimeout: 6e4
|
|
69
|
+
}, jwt);
|
|
70
|
+
logger.info(() => ({
|
|
71
|
+
data: { sitekey },
|
|
72
|
+
msg: "Site Key registered"
|
|
73
|
+
}));
|
|
74
|
+
} catch (err) {
|
|
75
|
+
logger.error(() => ({
|
|
76
|
+
err,
|
|
77
|
+
msg: "Error registering Site Key"
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
middlewares: [validateSiteKey]
|
|
82
|
+
};
|
|
104
83
|
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { siteKeyRegisterApi_default as default };
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/logger";
|
|
1
2
|
import { ProviderEnvironment } from "@prosopo/env";
|
|
2
|
-
import { getLogger, LogLevel } from "@prosopo/logger";
|
|
3
3
|
import { Tasks } from "@prosopo/provider";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
commandStoreCaptchasExternally as default
|
|
4
|
+
//#region src/commands/storeCaptchasExternally.ts
|
|
5
|
+
var storeCaptchasExternally_default = (pair, config, cmdArgs) => {
|
|
6
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.store_captchas");
|
|
7
|
+
return {
|
|
8
|
+
command: "store_captchas",
|
|
9
|
+
describe: "Store captcha records externally for billing purposes",
|
|
10
|
+
handler: async () => {
|
|
11
|
+
try {
|
|
12
|
+
const env = new ProviderEnvironment(config, pair);
|
|
13
|
+
await env.isReady();
|
|
14
|
+
await new Tasks(env).clientTaskManager.storeCommitmentsExternal().catch((err) => {
|
|
15
|
+
env.logger.error(() => ({ err }));
|
|
16
|
+
});
|
|
17
|
+
} catch (err) {
|
|
18
|
+
logger.error(() => ({ err }));
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
middlewares: []
|
|
22
|
+
};
|
|
26
23
|
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { storeCaptchasExternally_default as default };
|
|
@@ -1,51 +1,43 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/logger";
|
|
1
2
|
import { ProviderEnvironment } from "@prosopo/env";
|
|
2
|
-
import { getLogger, LogLevel } from "@prosopo/logger";
|
|
3
3
|
import { updateSpamEmailDomains } from "@prosopo/provider";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
err
|
|
42
|
-
}));
|
|
43
|
-
throw err;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
middlewares: []
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
export {
|
|
50
|
-
commandUpdateSpamEmailDomains as default
|
|
4
|
+
//#region src/commands/updateSpamEmailDomains.ts
|
|
5
|
+
var updateSpamEmailDomains_default = (pair, config, cmdArgs) => {
|
|
6
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.update_spam_email_domains");
|
|
7
|
+
return {
|
|
8
|
+
command: "update_spam_email_domains",
|
|
9
|
+
describe: "Update spam email domains from configured URLs",
|
|
10
|
+
handler: async () => {
|
|
11
|
+
try {
|
|
12
|
+
const env = new ProviderEnvironment(config, pair);
|
|
13
|
+
await env.isReady();
|
|
14
|
+
const spamEmailDomainsUrls = config.spamEmailDomainsUrls || [];
|
|
15
|
+
if (spamEmailDomainsUrls.length === 0) {
|
|
16
|
+
logger.warn(() => ({ msg: "No spam email domains URLs configured. Set SPAM_EMAIL_DOMAINS_URLS in environment." }));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
logger.info(() => ({
|
|
20
|
+
msg: "Starting spam email domains update",
|
|
21
|
+
data: { urlCount: spamEmailDomainsUrls.length }
|
|
22
|
+
}));
|
|
23
|
+
await updateSpamEmailDomains(env.getDb(), env.logger, spamEmailDomainsUrls).catch((err) => {
|
|
24
|
+
env.logger.error(() => ({
|
|
25
|
+
msg: "Error updating spam email domains",
|
|
26
|
+
err
|
|
27
|
+
}));
|
|
28
|
+
throw err;
|
|
29
|
+
});
|
|
30
|
+
logger.info(() => ({ msg: "Spam email domains update completed successfully" }));
|
|
31
|
+
} catch (err) {
|
|
32
|
+
logger.error(() => ({
|
|
33
|
+
msg: "Failed to update spam email domains",
|
|
34
|
+
err
|
|
35
|
+
}));
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
middlewares: []
|
|
40
|
+
};
|
|
51
41
|
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { updateSpamEmailDomains_default as default };
|
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
import { ProsopoEnvError } from "@prosopo/common";
|
|
2
1
|
import { encodeStringAddress } from "@prosopo/provider";
|
|
2
|
+
import { ProsopoEnvError } from "@prosopo/common";
|
|
3
3
|
import parser from "cron-parser";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return { address };
|
|
7
|
-
};
|
|
8
|
-
const validateSiteKey = (argv) => {
|
|
9
|
-
const sitekey = encodeStringAddress(argv.sitekey);
|
|
10
|
-
return { sitekey };
|
|
11
|
-
};
|
|
12
|
-
const validateValue = (argv) => {
|
|
13
|
-
if (typeof argv.value !== "number") {
|
|
14
|
-
throw new ProsopoEnvError("CLI.PARAMETER_ERROR", {
|
|
15
|
-
context: { value: [argv.value] }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const value = argv.value;
|
|
19
|
-
return { value };
|
|
20
|
-
};
|
|
21
|
-
const validateScheduleExpression = (argv) => {
|
|
22
|
-
if (typeof argv.schedule === "string") {
|
|
23
|
-
const result = parser.parseString(argv.schedule);
|
|
24
|
-
if (argv.schedule in result.errors) {
|
|
25
|
-
throw new ProsopoEnvError("CLI.PARAMETER_ERROR", {
|
|
26
|
-
context: {
|
|
27
|
-
payee: [argv.shedule],
|
|
28
|
-
failedFuncName: validateScheduleExpression.name
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return { schedule: argv.schedule };
|
|
33
|
-
}
|
|
34
|
-
return { schedule: null };
|
|
4
|
+
var validateSiteKey = (argv) => {
|
|
5
|
+
return { sitekey: encodeStringAddress(argv.sitekey) };
|
|
35
6
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
7
|
+
var validateScheduleExpression = (argv) => {
|
|
8
|
+
if (typeof argv.schedule === "string") {
|
|
9
|
+
const result = parser.parseString(argv.schedule);
|
|
10
|
+
if (argv.schedule in result.errors) throw new ProsopoEnvError("CLI.PARAMETER_ERROR", { context: {
|
|
11
|
+
payee: [argv.shedule],
|
|
12
|
+
failedFuncName: validateScheduleExpression.name
|
|
13
|
+
} });
|
|
14
|
+
return { schedule: argv.schedule };
|
|
15
|
+
}
|
|
16
|
+
return { schedule: null };
|
|
41
17
|
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { validateScheduleExpression, validateSiteKey };
|
package/dist/commands/version.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/logger";
|
|
2
2
|
import { version } from "@prosopo/util";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
commandVersion as default
|
|
3
|
+
//#region src/commands/version.ts
|
|
4
|
+
var version_default = (pair, config, cmdArgs) => {
|
|
5
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.version");
|
|
6
|
+
return {
|
|
7
|
+
command: "version",
|
|
8
|
+
describe: "Return the version of the software",
|
|
9
|
+
handler: () => {
|
|
10
|
+
logger.info(() => ({ data: { version } }));
|
|
11
|
+
}
|
|
12
|
+
};
|
|
17
13
|
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { version_default as default };
|
package/dist/files.js
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
import fs, { createWriteStream } from "node:fs";
|
|
2
2
|
import { Readable } from "node:stream";
|
|
3
3
|
import { ProsopoCliError } from "@prosopo/common";
|
|
4
|
+
//#region src/files.ts
|
|
4
5
|
function loadJSONFile(filePath) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
8
|
+
} catch (error) {
|
|
9
|
+
throw new ProsopoCliError("GENERAL.JSON_LOAD_FAILED", { context: {
|
|
10
|
+
error,
|
|
11
|
+
filePath
|
|
12
|
+
} });
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
15
|
function writeJSONFile(filePath, jsonData) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const writeStream = createWriteStream(filePath);
|
|
18
|
+
writeStream.setDefaultEncoding("utf-8");
|
|
19
|
+
writeStream.on("finish", () => {
|
|
20
|
+
resolve(true);
|
|
21
|
+
});
|
|
22
|
+
writeStream.on("error", (err) => {
|
|
23
|
+
reject(err);
|
|
24
|
+
});
|
|
25
|
+
Readable.from(JSON.stringify(jsonData)).pipe(writeStream);
|
|
26
|
+
});
|
|
26
27
|
}
|
|
27
28
|
async function readFile(filePath) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
fs.readFile(filePath, (err, data) => {
|
|
31
|
+
if (err) reject(err);
|
|
32
|
+
resolve(data);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
readFile,
|
|
38
|
-
writeJSONFile
|
|
39
|
-
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { loadJSONFile, readFile, writeJSONFile };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
+
import "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { loadJSONFile, readFile, writeJSONFile } from "./files.js";
|
|
1
3
|
import { processArgs } from "./argv.js";
|
|
2
|
-
import "./cli.js";
|
|
3
|
-
import { start } from "./start.js";
|
|
4
4
|
import { getAddress, getDB, getPassword, getSecret } from "./process.env.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
default2 as defaultConfig,
|
|
9
|
-
getAddress,
|
|
10
|
-
getDB,
|
|
11
|
-
getPassword,
|
|
12
|
-
getSecret,
|
|
13
|
-
loadJSONFile,
|
|
14
|
-
processArgs,
|
|
15
|
-
readFile,
|
|
16
|
-
start,
|
|
17
|
-
writeJSONFile
|
|
18
|
-
};
|
|
5
|
+
import getConfig from "./prosopo.config.js";
|
|
6
|
+
import { start } from "./start.js";
|
|
7
|
+
export { getConfig as defaultConfig, getAddress, getDB, getPassword, getSecret, loadJSONFile, processArgs, readFile, start, writeJSONFile };
|
package/dist/process.env.js
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
import { ProsopoEnvError } from "@prosopo/common";
|
|
2
|
+
//#region src/process.env.ts
|
|
2
3
|
function getAddress(who) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
who = who.toUpperCase();
|
|
7
|
-
}
|
|
8
|
-
return process.env[`PROSOPO_${who}_ADDRESS`];
|
|
4
|
+
if (!who) who = "PROVIDER";
|
|
5
|
+
else who = who.toUpperCase();
|
|
6
|
+
return process.env[`PROSOPO_${who}_ADDRESS`];
|
|
9
7
|
}
|
|
10
8
|
function getPassword(who) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
who = who.toUpperCase();
|
|
15
|
-
}
|
|
16
|
-
return process.env[`PROSOPO_${who}_ACCOUNT_PASSWORD`];
|
|
9
|
+
if (!who) who = "PROVIDER";
|
|
10
|
+
else who = who.toUpperCase();
|
|
11
|
+
return process.env[`PROSOPO_${who}_ACCOUNT_PASSWORD`];
|
|
17
12
|
}
|
|
18
13
|
function getSecret(who) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
who = who.toUpperCase();
|
|
23
|
-
}
|
|
24
|
-
return process.env[`PROSOPO_${who}_MNEMONIC`] || process.env[`PROSOPO_${who}_SEED`] || process.env[`PROSOPO_${who}_URI`] || process.env[`PROSOPO_${who}_JSON`];
|
|
14
|
+
if (!who) who = "PROVIDER";
|
|
15
|
+
else who = who.toUpperCase();
|
|
16
|
+
return process.env[`PROSOPO_${who}_MNEMONIC`] || process.env[`PROSOPO_${who}_SEED`] || process.env[`PROSOPO_${who}_URI`] || process.env[`PROSOPO_${who}_JSON`];
|
|
25
17
|
}
|
|
26
18
|
function getDB() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
return process.env.PROSOPO_DATABASE_HOST;
|
|
19
|
+
if (!process.env.PROSOPO_DATABASE_HOST) throw new ProsopoEnvError("DATABASE.DATABASE_HOST_UNDEFINED");
|
|
20
|
+
return process.env.PROSOPO_DATABASE_HOST;
|
|
31
21
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getDB,
|
|
35
|
-
getPassword,
|
|
36
|
-
getSecret
|
|
37
|
-
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getAddress, getDB, getPassword, getSecret };
|