@prosopo/cli 2.1.8 → 2.1.10
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/dist/RateLimiter.d.ts +63 -0
- package/dist/RateLimiter.d.ts.map +1 -0
- package/dist/RateLimiter.js +66 -0
- package/dist/RateLimiter.js.map +1 -0
- package/dist/argv.d.ts +22 -0
- package/dist/argv.d.ts.map +1 -0
- package/dist/argv.js +22 -0
- package/dist/argv.js.map +1 -0
- package/dist/bundle/provider.cli.bundle.js +244470 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +57 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/addBlockRules.d.ts +25 -0
- package/dist/commands/addBlockRules.d.ts.map +1 -0
- package/dist/commands/addBlockRules.js +58 -0
- package/dist/commands/addBlockRules.js.map +1 -0
- package/dist/commands/index.d.ts +6 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +6 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/providerDeregister.d.ts +19 -0
- package/dist/commands/providerDeregister.d.ts.map +1 -0
- package/dist/commands/providerDeregister.js +30 -0
- package/dist/commands/providerDeregister.js.map +1 -0
- package/dist/commands/providerSetDataset.d.ts +17 -0
- package/dist/commands/providerSetDataset.d.ts.map +1 -0
- package/dist/commands/providerSetDataset.js +35 -0
- package/dist/commands/providerSetDataset.js.map +1 -0
- package/dist/commands/siteKeyRegister.d.ts +19 -0
- package/dist/commands/siteKeyRegister.d.ts.map +1 -0
- package/dist/commands/siteKeyRegister.js +31 -0
- package/dist/commands/siteKeyRegister.js.map +1 -0
- package/dist/commands/storeCaptchasExternally.d.ts +13 -0
- package/dist/commands/storeCaptchasExternally.d.ts.map +1 -0
- package/dist/commands/storeCaptchasExternally.js +27 -0
- package/dist/commands/storeCaptchasExternally.js.map +1 -0
- package/dist/commands/validators.d.ts +18 -0
- package/dist/commands/validators.d.ts.map +1 -0
- package/dist/commands/validators.js +36 -0
- package/dist/commands/validators.js.map +1 -0
- package/dist/commands/version.d.ts +12 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +13 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/files.d.ts +4 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +37 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/process.env.d.ts +8 -0
- package/dist/process.env.d.ts.map +1 -0
- package/dist/process.env.js +44 -0
- package/dist/process.env.js.map +1 -0
- package/dist/prosopo.config.d.ts +3 -0
- package/dist/prosopo.config.d.ts.map +1 -0
- package/dist/prosopo.config.js +73 -0
- package/dist/prosopo.config.js.map +1 -0
- package/dist/reloader.d.ts +21 -0
- package/dist/reloader.d.ts.map +1 -0
- package/dist/reloader.js +58 -0
- package/dist/reloader.js.map +1 -0
- package/dist/start.d.ts +5 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/start.js +65 -0
- package/dist/start.js.map +1 -0
- package/dist/tests/bundle/bundle.unit.test.d.ts +2 -0
- package/dist/tests/bundle/bundle.unit.test.d.ts.map +1 -0
- package/dist/tests/bundle/bundle.unit.test.js +14 -0
- package/dist/tests/bundle/bundle.unit.test.js.map +1 -0
- package/package.json +11 -11
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
3
|
+
import { getPairAsync } from "@prosopo/contract";
|
|
4
|
+
import { loadEnv } from "@prosopo/dotenv";
|
|
5
|
+
import { isMain } from "@prosopo/util";
|
|
6
|
+
import { processArgs } from "./argv.js";
|
|
7
|
+
import getConfig from "./prosopo.config.js";
|
|
8
|
+
import ReloadingAPI from "./reloader.js";
|
|
9
|
+
const log = getLogger(LogLevel.enum.info, "CLI");
|
|
10
|
+
async function main() {
|
|
11
|
+
const envPath = loadEnv();
|
|
12
|
+
const config = getConfig(undefined, {
|
|
13
|
+
solved: { count: 2 },
|
|
14
|
+
unsolved: { count: 0 },
|
|
15
|
+
});
|
|
16
|
+
log.info(config);
|
|
17
|
+
if (config.devOnlyWatchEvents) {
|
|
18
|
+
log.warn(`
|
|
19
|
+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
|
|
20
|
+
EVENT TRACKING ON. IF NOT DEVELOPMENT, PLEASE STOP, CHANGE THE ENVIRONMENT, AND RESTART
|
|
21
|
+
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
const pair = await getPairAsync(config.account.secret, config.account.address);
|
|
25
|
+
log.info(`Pair address: ${pair.address}`);
|
|
26
|
+
const processedArgs = await processArgs(process.argv, pair, config);
|
|
27
|
+
log.info(`Processsed args: ${JSON.stringify(processedArgs, null, 4)}`);
|
|
28
|
+
if (processedArgs.api) {
|
|
29
|
+
if (process.env.NODE_ENV === "development") {
|
|
30
|
+
await new ReloadingAPI(envPath, config, pair, processedArgs)
|
|
31
|
+
.startDev()
|
|
32
|
+
.then(() => {
|
|
33
|
+
log.info("Reloading API started...");
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await new ReloadingAPI(envPath, config, pair, processedArgs)
|
|
38
|
+
.start()
|
|
39
|
+
.then(() => {
|
|
40
|
+
log.info("Reloading API started...");
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (isMain(import.meta.url, "provider")) {
|
|
49
|
+
main()
|
|
50
|
+
.then(() => {
|
|
51
|
+
log.info("Running main process...");
|
|
52
|
+
})
|
|
53
|
+
.catch((error) => {
|
|
54
|
+
log.error(error);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAaA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,YAAY,MAAM,eAAe,CAAC;AAEzC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAEjD,KAAK,UAAU,IAAI;IAClB,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;IAG1B,MAAM,MAAM,GAAwB,SAAS,CAAC,SAAS,EAAE;QACxD,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;QACpB,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;KACtB,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEjB,IAAI,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC/B,GAAG,CAAC,IAAI,CACP;;;;aAIU,CACV,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,YAAY,CAC9B,MAAM,CAAC,OAAO,CAAC,MAAM,EACrB,MAAM,CAAC,OAAO,CAAC,OAAO,CACtB,CAAC;IAEF,GAAG,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAE1C,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEpE,GAAG,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACvE,IAAI,aAAa,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;YAC5C,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC;iBAC1D,QAAQ,EAAE;iBACV,IAAI,CAAC,GAAG,EAAE;gBACV,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC;iBAC1D,KAAK,EAAE;iBACP,IAAI,CAAC,GAAG,EAAE;gBACV,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;QACL,CAAC;IACF,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC;AAGD,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC;IACzC,IAAI,EAAE;SACJ,IAAI,CAAC,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACrC,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
import type { ArgumentsCamelCase, Argv } from "yargs";
|
|
5
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}) => {
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (yargs: Argv) => Argv<{
|
|
11
|
+
ips: (string | number)[] | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
users: (string | number)[] | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
dapp: string | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
global: string | true;
|
|
18
|
+
} & {
|
|
19
|
+
hardBlock: string | false;
|
|
20
|
+
}>;
|
|
21
|
+
handler: (argv: ArgumentsCamelCase) => Promise<void>;
|
|
22
|
+
middlewares: never[];
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=addBlockRules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addBlockRules.d.ts","sourceRoot":"","sources":["../../src/commands/addBlockRules.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;+BAK/C,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;qBASX,IAAI;;;;;;;;;;;oBA6BC,kBAAkB;;;AAzC1C,wBAoEE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { ProviderEnvironment } from "@prosopo/env";
|
|
3
|
+
import { Tasks } from "@prosopo/provider";
|
|
4
|
+
export default (pair, config, cmdArgs) => {
|
|
5
|
+
const logger = cmdArgs?.logger ||
|
|
6
|
+
getLogger(LogLevel.enum.info, "cli.provider_set_data_set");
|
|
7
|
+
return {
|
|
8
|
+
command: "add_block_rules",
|
|
9
|
+
describe: "Add a rule for blocking requests to the database",
|
|
10
|
+
builder: (yargs) => yargs
|
|
11
|
+
.option("ips", {
|
|
12
|
+
type: "array",
|
|
13
|
+
demandOption: false,
|
|
14
|
+
desc: "The ips to be blocked",
|
|
15
|
+
})
|
|
16
|
+
.option("users", {
|
|
17
|
+
type: "array",
|
|
18
|
+
demandOption: false,
|
|
19
|
+
desc: "The users to be blocked",
|
|
20
|
+
})
|
|
21
|
+
.option("dapp", {
|
|
22
|
+
type: "string",
|
|
23
|
+
demandOption: false,
|
|
24
|
+
desc: "The users to be blocked",
|
|
25
|
+
})
|
|
26
|
+
.option("global", {
|
|
27
|
+
type: "string",
|
|
28
|
+
demandOption: true,
|
|
29
|
+
default: true,
|
|
30
|
+
desc: "Whether the ip is to be blocked globally or not",
|
|
31
|
+
})
|
|
32
|
+
.option("hardBlock", {
|
|
33
|
+
type: "string",
|
|
34
|
+
demandOption: true,
|
|
35
|
+
default: false,
|
|
36
|
+
desc: "Hardblock stops requests, softblock informs frictionless",
|
|
37
|
+
}),
|
|
38
|
+
handler: async (argv) => {
|
|
39
|
+
try {
|
|
40
|
+
const env = new ProviderEnvironment(config, pair);
|
|
41
|
+
await env.isReady();
|
|
42
|
+
const tasks = new Tasks(env);
|
|
43
|
+
if (argv.ips) {
|
|
44
|
+
await tasks.clientTaskManager.addIPBlockRules(argv.ips, argv.global, argv.hardBlock, argv.dapp);
|
|
45
|
+
}
|
|
46
|
+
if (argv.users) {
|
|
47
|
+
await tasks.clientTaskManager.addUserBlockRules(argv.users, argv.hardBlock, argv.dapp);
|
|
48
|
+
}
|
|
49
|
+
logger.info("IP Block rules added");
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
logger.error(err);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
middlewares: [],
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=addBlockRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addBlockRules.js","sourceRoot":"","sources":["../../src/commands/addBlockRules.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM1C,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM;QACf,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;IAE5D,OAAO;QACN,OAAO,EAAE,iBAAiB;QAC1B,QAAQ,EAAE,kDAAkD;QAC5D,OAAO,EAAE,CAAC,KAAW,EAAE,EAAE,CACxB,KAAK;aACH,MAAM,CAAC,KAAK,EAAE;YACd,IAAI,EAAE,OAAgB;YACtB,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE,uBAAuB;SACpB,CAAC;aACV,MAAM,CAAC,OAAO,EAAE;YAChB,IAAI,EAAE,OAAgB;YACtB,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE,yBAAyB;SACtB,CAAC;aACV,MAAM,CAAC,MAAM,EAAE;YACf,IAAI,EAAE,QAAiB;YACvB,YAAY,EAAE,KAAK;YACnB,IAAI,EAAE,yBAAyB;SACtB,CAAC;aACV,MAAM,CAAC,QAAQ,EAAE;YACjB,IAAI,EAAE,QAAiB;YACvB,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,iDAAiD;SAC9C,CAAC;aACV,MAAM,CAAC,WAAW,EAAE;YACpB,IAAI,EAAE,QAAiB;YACvB,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,0DAA0D;SACvD,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAClD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;oBACd,MAAM,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAC5C,IAAI,CAAC,GAA0B,EAC/B,IAAI,CAAC,MAAiB,EACtB,IAAI,CAAC,SAAoB,EACzB,IAAI,CAAC,IAAyB,CAC9B,CAAC;gBACH,CAAC;gBACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBAChB,MAAM,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAC9C,IAAI,CAAC,KAA4B,EACjC,IAAI,CAAC,SAAoB,EACzB,IAAI,CAAC,IAAyB,CAC9B,CAAC;gBACH,CAAC;gBACD,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACrC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACF,CAAC;QACD,WAAW,EAAE,EAAE;KACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as commandAddBlockRules } from "./addBlockRules.js";
|
|
2
|
+
export { default as commandProviderSetDataset } from "./providerSetDataset.js";
|
|
3
|
+
export { default as commandStoreCaptchasExternally } from "./storeCaptchasExternally.js";
|
|
4
|
+
export { default as commandVersion } from "./version.js";
|
|
5
|
+
export { default as commandSiteKeyRegister } from "./siteKeyRegister.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as commandAddBlockRules } from "./addBlockRules.js";
|
|
2
|
+
export { default as commandProviderSetDataset } from "./providerSetDataset.js";
|
|
3
|
+
export { default as commandStoreCaptchasExternally } from "./storeCaptchasExternally.js";
|
|
4
|
+
export { default as commandVersion } from "./version.js";
|
|
5
|
+
export { default as commandSiteKeyRegister } from "./siteKeyRegister.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
import type { ArgumentsCamelCase, Argv } from "yargs";
|
|
5
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}) => {
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (yargs: Argv) => Argv<{
|
|
11
|
+
address: string;
|
|
12
|
+
}>;
|
|
13
|
+
handler: (argv: ArgumentsCamelCase) => Promise<void>;
|
|
14
|
+
middlewares: ((argv: ArgumentsCamelCase) => {
|
|
15
|
+
address: string;
|
|
16
|
+
})[];
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
19
|
+
//# sourceMappingURL=providerDeregister.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerDeregister.d.ts","sourceRoot":"","sources":["../../src/commands/providerDeregister.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAInE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;+BAI/C,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;qBAQX,IAAI;;;oBAMC,kBAAkB;;;;;AAjB1C,wBAmCE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { ProsopoEnvError } from "@prosopo/common";
|
|
3
|
+
import { ProviderEnvironment } from "@prosopo/env";
|
|
4
|
+
import { Tasks } from "@prosopo/provider";
|
|
5
|
+
import { validateAddress } from "./validators.js";
|
|
6
|
+
export default (pair, config, cmdArgs) => {
|
|
7
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.provider_deregister");
|
|
8
|
+
return {
|
|
9
|
+
command: "provider_deregister",
|
|
10
|
+
describe: "Deregister a Provider",
|
|
11
|
+
builder: (yargs) => yargs.option("address", {
|
|
12
|
+
type: "string",
|
|
13
|
+
demand: true,
|
|
14
|
+
desc: "The AccountId of the Provider",
|
|
15
|
+
}),
|
|
16
|
+
handler: async (argv) => {
|
|
17
|
+
try {
|
|
18
|
+
const env = new ProviderEnvironment(config, pair);
|
|
19
|
+
await env.isReady();
|
|
20
|
+
const tasks = new Tasks(env);
|
|
21
|
+
throw new ProsopoEnvError("GENERAL.NOT_IMPLEMENTED");
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
logger.error(err);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
middlewares: [validateAddress],
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=providerDeregister.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerDeregister.js","sourceRoot":"","sources":["../../src/commands/providerDeregister.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;IAE7E,OAAO;QACN,OAAO,EAAE,qBAAqB;QAC9B,QAAQ,EAAE,uBAAuB;QACjC,OAAO,EAAE,CAAC,KAAW,EAAE,EAAE,CACxB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;YACvB,IAAI,EAAE,QAAiB;YACvB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,+BAA+B;SAC5B,CAAC;QACZ,OAAO,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAClD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;gBAO7B,MAAM,IAAI,eAAe,CAAC,yBAAyB,CAAC,CAAC;YACtD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACF,CAAC;QACD,WAAW,EAAE,CAAC,eAAe,CAAC;KAC9B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
import type { ArgumentsCamelCase, Argv } from "yargs";
|
|
5
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}) => {
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (yargs: Argv) => Argv<{
|
|
11
|
+
file: string;
|
|
12
|
+
}>;
|
|
13
|
+
handler: (argv: ArgumentsCamelCase) => Promise<void>;
|
|
14
|
+
middlewares: never[];
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=providerSetDataset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerSetDataset.d.ts","sourceRoot":"","sources":["../../src/commands/providerSetDataset.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;+BAK/C,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;qBASX,IAAI;;;oBAMC,kBAAkB;;;AAlB1C,wBAmCE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { ProviderEnvironment } from "@prosopo/env";
|
|
3
|
+
import { Tasks } from "@prosopo/provider";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
import { loadJSONFile } from "../files.js";
|
|
6
|
+
export default (pair, config, cmdArgs) => {
|
|
7
|
+
const logger = cmdArgs?.logger ||
|
|
8
|
+
getLogger(LogLevel.enum.info, "cli.provider_set_data_set");
|
|
9
|
+
return {
|
|
10
|
+
command: "provider_set_data_set",
|
|
11
|
+
describe: "Add a dataset as a Provider",
|
|
12
|
+
builder: (yargs) => yargs.option("file", {
|
|
13
|
+
type: "string",
|
|
14
|
+
demand: true,
|
|
15
|
+
desc: "The file path of a JSON dataset file",
|
|
16
|
+
}),
|
|
17
|
+
handler: async (argv) => {
|
|
18
|
+
try {
|
|
19
|
+
const env = new ProviderEnvironment(config, pair);
|
|
20
|
+
await env.isReady();
|
|
21
|
+
const tasks = new Tasks(env);
|
|
22
|
+
const file = z.string().parse(argv.file);
|
|
23
|
+
const jsonFile = loadJSONFile(file);
|
|
24
|
+
logger.info(`Loaded JSON from ${file}`);
|
|
25
|
+
const result = await tasks.datasetManager.providerSetDatasetFromFile(jsonFile);
|
|
26
|
+
logger.info(JSON.stringify(result, null, 2));
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
logger.error(err);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
middlewares: [],
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=providerSetDataset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerSetDataset.js","sourceRoot":"","sources":["../../src/commands/providerSetDataset.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM;QACf,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;IAE5D,OAAO;QACN,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,6BAA6B;QACvC,OAAO,EAAE,CAAC,KAAW,EAAE,EAAE,CACxB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;YACpB,IAAI,EAAE,QAAiB;YACvB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,sCAAsC;SACnC,CAAC;QACZ,OAAO,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAClD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC7B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAS,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;gBACxC,MAAM,MAAM,GACX,MAAM,KAAK,CAAC,cAAc,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;gBACjE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC9C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACF,CAAC;QACD,WAAW,EAAE,EAAE;KACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
import type { ArgumentsCamelCase, Argv } from "yargs";
|
|
5
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}) => {
|
|
8
|
+
command: string;
|
|
9
|
+
describe: string;
|
|
10
|
+
builder: (yargs: Argv) => Argv<{
|
|
11
|
+
sitekey: string;
|
|
12
|
+
}>;
|
|
13
|
+
handler: (argv: ArgumentsCamelCase) => Promise<void>;
|
|
14
|
+
middlewares: ((argv: ArgumentsCamelCase) => {
|
|
15
|
+
sitekey: string;
|
|
16
|
+
})[];
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
19
|
+
//# sourceMappingURL=siteKeyRegister.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siteKeyRegister.d.ts","sourceRoot":"","sources":["../../src/commands/siteKeyRegister.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;+BAI/C,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;qBAQX,IAAI;;;oBAMC,kBAAkB;;;;;AAjB1C,wBA+BE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { ProviderEnvironment } from "@prosopo/env";
|
|
3
|
+
import { Tasks } from "@prosopo/provider";
|
|
4
|
+
import { validateSiteKey } from "./validators.js";
|
|
5
|
+
export default (pair, config, cmdArgs) => {
|
|
6
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.dapp_register");
|
|
7
|
+
return {
|
|
8
|
+
command: "site_key_register <sitekey>",
|
|
9
|
+
describe: "Register a Site Key",
|
|
10
|
+
builder: (yargs) => yargs.positional("sitekey", {
|
|
11
|
+
type: "string",
|
|
12
|
+
demandOption: true,
|
|
13
|
+
desc: "The AccountId of the application to register the Site Key with",
|
|
14
|
+
}),
|
|
15
|
+
handler: async (argv) => {
|
|
16
|
+
try {
|
|
17
|
+
const env = new ProviderEnvironment(config, pair);
|
|
18
|
+
await env.isReady();
|
|
19
|
+
const siteKey = argv.sitekey;
|
|
20
|
+
const tasks = new Tasks(env);
|
|
21
|
+
await tasks.clientTaskManager.registerSiteKey(siteKey, {});
|
|
22
|
+
logger.info(`Site Key ${argv.sitekey} registered`);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
logger.error(err);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
middlewares: [validateSiteKey],
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=siteKeyRegister.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siteKeyRegister.js","sourceRoot":"","sources":["../../src/commands/siteKeyRegister.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAEvE,OAAO;QACN,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,qBAAqB;QAC/B,OAAO,EAAE,CAAC,KAAW,EAAE,EAAE,CACxB,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE;YAC3B,IAAI,EAAE,QAAiB;YACvB,YAAY,EAAE,IAAI;YAClB,IAAI,EAAE,gEAAgE;SAC7D,CAAC;QACZ,OAAO,EAAE,KAAK,EAAE,IAAwB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAClD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC7B,MAAM,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,OAAiB,EAAE,EAAE,CAAC,CAAC;gBACrE,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,OAAO,aAAa,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACF,CAAC;QACD,WAAW,EAAE,CAAC,eAAe,CAAC;KAC9B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
5
|
+
logger?: Logger;
|
|
6
|
+
}) => {
|
|
7
|
+
command: string;
|
|
8
|
+
describe: string;
|
|
9
|
+
handler: () => Promise<void>;
|
|
10
|
+
middlewares: never[];
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=storeCaptchasExternally.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeCaptchasExternally.d.ts","sourceRoot":"","sources":["../../src/commands/storeCaptchasExternally.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;+BAGnD,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;AAH9B,wBA2BE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { ProviderEnvironment } from "@prosopo/env";
|
|
3
|
+
import { Tasks } from "@prosopo/provider";
|
|
4
|
+
export default (pair, config, cmdArgs) => {
|
|
5
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.store_captchas");
|
|
6
|
+
return {
|
|
7
|
+
command: "store_captchas",
|
|
8
|
+
describe: "Store captcha records externally for billing purposes",
|
|
9
|
+
handler: async () => {
|
|
10
|
+
try {
|
|
11
|
+
const env = new ProviderEnvironment(config, pair);
|
|
12
|
+
await env.isReady();
|
|
13
|
+
const tasks = new Tasks(env);
|
|
14
|
+
await tasks.clientTaskManager
|
|
15
|
+
.storeCommitmentsExternal()
|
|
16
|
+
.catch((err) => {
|
|
17
|
+
env.logger.error(err);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
logger.error(err);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
middlewares: [],
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=storeCaptchasExternally.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeCaptchasExternally.js","sourceRoot":"","sources":["../../src/commands/storeCaptchasExternally.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;IAExE,OAAO;QACN,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,uDAAuD;QACjE,OAAO,EAAE,KAAK,IAAI,EAAE;YACnB,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;gBAClD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC7B,MAAM,KAAK,CAAC,iBAAiB;qBAC3B,wBAAwB,EAAE;qBAC1B,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACd,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,CAAC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACF,CAAC;QACD,WAAW,EAAE,EAAE;KACf,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Compact } from "@polkadot/types-codec/base";
|
|
2
|
+
import type { u128 } from "@polkadot/types-codec/primitive";
|
|
3
|
+
import type { ArgumentsCamelCase } from "yargs";
|
|
4
|
+
export declare const validateAddress: (argv: ArgumentsCamelCase) => {
|
|
5
|
+
address: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const validateSiteKey: (argv: ArgumentsCamelCase) => {
|
|
8
|
+
sitekey: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const validateValue: (argv: ArgumentsCamelCase) => {
|
|
11
|
+
value: Compact<u128>;
|
|
12
|
+
};
|
|
13
|
+
export declare const validateScheduleExpression: (argv: ArgumentsCamelCase) => {
|
|
14
|
+
schedule: string;
|
|
15
|
+
} | {
|
|
16
|
+
schedule: null;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/commands/validators.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAK5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,eAAO,MAAM,eAAe,SACrB,kBAAkB,KACtB;IAAE,OAAO,EAAE,MAAM,CAAA;CAInB,CAAC;AAEF,eAAO,MAAM,eAAe,SACrB,kBAAkB,KACtB;IAAE,OAAO,EAAE,MAAM,CAAA;CAInB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,kBAAkB;;CAQrD,CAAC;AAEF,eAAO,MAAM,0BAA0B,SAAU,kBAAkB;cAa7B,MAAM;;;CAG3C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ProsopoEnvError } from "@prosopo/common";
|
|
2
|
+
import { encodeStringAddress } from "@prosopo/provider";
|
|
3
|
+
import parser from "cron-parser";
|
|
4
|
+
export const validateAddress = (argv) => {
|
|
5
|
+
const address = encodeStringAddress(argv.address);
|
|
6
|
+
return { address };
|
|
7
|
+
};
|
|
8
|
+
export const validateSiteKey = (argv) => {
|
|
9
|
+
const sitekey = encodeStringAddress(argv.sitekey);
|
|
10
|
+
return { sitekey };
|
|
11
|
+
};
|
|
12
|
+
export 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
|
+
export 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 };
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/commands/validators.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,MAAM,MAAM,aAAa,CAAC;AAIjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,IAAwB,EACF,EAAE;IACxB,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAiB,CAAC,CAAC;IAE5D,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,IAAwB,EACF,EAAE;IACxB,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,OAAiB,CAAC,CAAC;IAE5D,OAAO,EAAE,OAAO,EAAE,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAwB,EAAE,EAAE;IACzD,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,eAAe,CAAC,qBAAqB,EAAE;YAChD,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;SAChC,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAkB,IAAI,CAAC,KAAiC,CAAC;IACpE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAwB,EAAE,EAAE;IACtE,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,QAAkB,CAAC,CAAC;QAE3D,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,eAAe,CAAC,qBAAqB,EAAE;gBAChD,OAAO,EAAE;oBACR,KAAK,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;oBACrB,cAAc,EAAE,0BAA0B,CAAC,IAAI;iBAC/C;aACD,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAkB,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyringPair } from "@polkadot/keyring/types";
|
|
2
|
+
import { type Logger } from "@prosopo/common";
|
|
3
|
+
import type { ProsopoConfigOutput } from "@prosopo/types";
|
|
4
|
+
declare const _default: (pair: KeyringPair, config: ProsopoConfigOutput, cmdArgs?: {
|
|
5
|
+
logger?: Logger;
|
|
6
|
+
}) => {
|
|
7
|
+
command: string;
|
|
8
|
+
describe: string;
|
|
9
|
+
handler: () => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAY,KAAK,MAAM,EAAa,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;+BAInD,WAAW,UACT,mBAAmB,YACjB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;AAH9B,wBAeE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogLevel, getLogger } from "@prosopo/common";
|
|
2
|
+
import { version } from "@prosopo/util";
|
|
3
|
+
export default (pair, config, cmdArgs) => {
|
|
4
|
+
const logger = cmdArgs?.logger || getLogger(LogLevel.enum.info, "cli.version");
|
|
5
|
+
return {
|
|
6
|
+
command: "version",
|
|
7
|
+
describe: "Return the version of the software",
|
|
8
|
+
handler: async () => {
|
|
9
|
+
logger.info(`Version: ${JSON.stringify(version)}`);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,eAAe,CACd,IAAiB,EACjB,MAA2B,EAC3B,OAA6B,EAC5B,EAAE;IACH,MAAM,MAAM,GACX,OAAO,EAAE,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEjE,OAAO;QACN,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,oCAAoC;QAC9C,OAAO,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpD,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function loadJSONFile(filePath: string): any;
|
|
2
|
+
export declare function writeJSONFile(filePath: string, jsonData: Record<string, any>): Promise<unknown>;
|
|
3
|
+
export declare function readFile(filePath: string): Promise<Buffer>;
|
|
4
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAiBA,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,OAQ5C;AAGD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,oBAmB5E;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhE"}
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fs, { createWriteStream } from "node:fs";
|
|
2
|
+
import { Readable } from "node:stream";
|
|
3
|
+
import { ProsopoCliError } from "@prosopo/common";
|
|
4
|
+
export function loadJSONFile(filePath) {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
throw new ProsopoCliError("GENERAL.JSON_LOAD_FAILED", {
|
|
10
|
+
context: { error, filePath },
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function writeJSONFile(filePath, jsonData) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const writeStream = createWriteStream(filePath);
|
|
17
|
+
writeStream.setDefaultEncoding("utf-8");
|
|
18
|
+
writeStream.on("finish", () => {
|
|
19
|
+
resolve(true);
|
|
20
|
+
});
|
|
21
|
+
writeStream.on("error", (err) => {
|
|
22
|
+
reject(err);
|
|
23
|
+
});
|
|
24
|
+
const readable = Readable.from(JSON.stringify(jsonData));
|
|
25
|
+
readable.pipe(writeStream);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export async function readFile(filePath) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
fs.readFile(filePath, (err, data) => {
|
|
31
|
+
if (err)
|
|
32
|
+
reject(err);
|
|
33
|
+
resolve(data);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAoB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAcvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC5C,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,eAAe,CAAC,0BAA0B,EAAE;YACrD,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;SAC5B,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAGD,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,QAA6B;IAC5E,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,WAAW,GAAgB,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAE7D,WAAW,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAExC,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;QAGH,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEzD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACnC,IAAI,GAAG;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,OAAO,CAAC,IAAc,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KeypairType } from "@polkadot/util-crypto/types";
|
|
2
|
+
export declare function getSs58Format(): number;
|
|
3
|
+
export declare function getPairType(): KeypairType;
|
|
4
|
+
export declare function getAddress(who?: string): string | undefined;
|
|
5
|
+
export declare function getPassword(who?: string): string | undefined;
|
|
6
|
+
export declare function getSecret(who?: string): string | undefined;
|
|
7
|
+
export declare function getDB(): string;
|
|
8
|
+
//# sourceMappingURL=process.env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.env.d.ts","sourceRoot":"","sources":["../src/process.env.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,WAAW,IAAI,WAAW,CAIzC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO3D;AAED,wBAAgB,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5D;AAED,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY1D;AAED,wBAAgB,KAAK,IAAI,MAAM,CAK9B"}
|