@decaf-ts/for-fabric 0.1.34 → 0.1.35
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/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/version.cjs +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +2 -2
- package/lib/bin/build-contract.cjs +0 -71
- package/lib/bin/build-contract.d.ts +0 -1
- package/lib/bin/build-contract.js.map +0 -1
- package/lib/bin/build-contracts.cjs +0 -47
- package/lib/bin/build-contracts.d.ts +0 -1
- package/lib/bin/build-contracts.js.map +0 -1
- package/lib/bin/compile-indexes.cjs +0 -39
- package/lib/bin/compile-indexes.d.ts +0 -1
- package/lib/bin/compile-indexes.js.map +0 -1
- package/lib/esm/bin/build-contract.d.ts +0 -1
- package/lib/esm/bin/build-contract.js +0 -66
- package/lib/esm/bin/build-contract.js.map +0 -1
- package/lib/esm/bin/build-contracts.d.ts +0 -1
- package/lib/esm/bin/build-contracts.js +0 -42
- package/lib/esm/bin/build-contracts.js.map +0 -1
- package/lib/esm/bin/compile-indexes.d.ts +0 -1
- package/lib/esm/bin/compile-indexes.js +0 -37
- package/lib/esm/bin/compile-indexes.js.map +0 -1
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.34";
|
|
2
2
|
export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
|
package/lib/esm/version.js
CHANGED
package/lib/version.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PACKAGE_NAME = exports.VERSION = void 0;
|
|
4
4
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
5
|
-
exports.VERSION = "0.1.
|
|
5
|
+
exports.VERSION = "0.1.34";
|
|
6
6
|
exports.PACKAGE_NAME = "@decaf-ts/for-fabric";
|
|
7
7
|
decoration_1.Metadata.registerLibrary(exports.PACKAGE_NAME, exports.VERSION);
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.34";
|
|
2
2
|
export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/for-fabric",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"description": "Abstracts fabric logic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"bin": {
|
|
29
|
-
"for-fabric": "
|
|
29
|
+
"for-fabric": "lib/bin/cli.cjs"
|
|
30
30
|
},
|
|
31
31
|
"types": "lib/index.d.ts",
|
|
32
32
|
"typesVersions": {
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const rollup_1 = require("rollup");
|
|
9
|
-
const plugin_replace_1 = __importDefault(require("@rollup/plugin-replace"));
|
|
10
|
-
const plugin_typescript_1 = __importDefault(require("@rollup/plugin-typescript"));
|
|
11
|
-
const commander_1 = require("commander");
|
|
12
|
-
const child_process_1 = require("child_process");
|
|
13
|
-
const program = new commander_1.Command();
|
|
14
|
-
program
|
|
15
|
-
.command("compile-global-contract")
|
|
16
|
-
.description("Creates a global contract")
|
|
17
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
18
|
-
.option("--debug", "makes attaching debugger possible", false)
|
|
19
|
-
.action(async (options) => {
|
|
20
|
-
const dev = options.dev;
|
|
21
|
-
(0, child_process_1.execSync)("rm -rf ./global");
|
|
22
|
-
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../../package.json"), "utf-8"));
|
|
23
|
-
const version = pkg.version;
|
|
24
|
-
const bundle = await (0, rollup_1.rollup)({
|
|
25
|
-
input: "./src/contract/index.ts",
|
|
26
|
-
plugins: [
|
|
27
|
-
(0, plugin_replace_1.default)({
|
|
28
|
-
preventAssignment: true,
|
|
29
|
-
delimiters: ["", ""],
|
|
30
|
-
values: { "##VERSION##": version },
|
|
31
|
-
}),
|
|
32
|
-
(0, plugin_typescript_1.default)({
|
|
33
|
-
tsconfig: "./tsconfig.json",
|
|
34
|
-
compilerOptions: {
|
|
35
|
-
outDir: "global",
|
|
36
|
-
},
|
|
37
|
-
module: "esnext",
|
|
38
|
-
declaration: false,
|
|
39
|
-
}),
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
await bundle.write({
|
|
43
|
-
file: "./global/GlobalContract.js",
|
|
44
|
-
format: "umd",
|
|
45
|
-
name: "GlobalContract.js",
|
|
46
|
-
});
|
|
47
|
-
const scripts = {
|
|
48
|
-
start: options.debug
|
|
49
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
50
|
-
: "fabric-chaincode-node start",
|
|
51
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
52
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
53
|
-
build: 'echo "No need to build the chaincode"',
|
|
54
|
-
lint: "eslint . --fix --ext .js",
|
|
55
|
-
};
|
|
56
|
-
const contractPackage = pkg;
|
|
57
|
-
contractPackage.name = "global-contract";
|
|
58
|
-
contractPackage.description = "Global contract implementation";
|
|
59
|
-
contractPackage.scripts = scripts;
|
|
60
|
-
delete contractPackage.type;
|
|
61
|
-
delete contractPackage.types;
|
|
62
|
-
delete contractPackage.exports;
|
|
63
|
-
contractPackage.main = "GlobalContract.js";
|
|
64
|
-
fs_1.default.writeFileSync(path_1.default.join(__dirname, "../../global/package.json"), JSON.stringify(contractPackage));
|
|
65
|
-
(0, child_process_1.execSync)("cd ./global && npm install");
|
|
66
|
-
(0, child_process_1.execSync)("cd ./global && npm shrinkwrap");
|
|
67
|
-
(0, child_process_1.execSync)("cd ./global && rm -rf node_modules");
|
|
68
|
-
(0, child_process_1.execSync)("rm -rf ./global/lib && rm -rf ./global/dist");
|
|
69
|
-
});
|
|
70
|
-
program.parse(process.argv);
|
|
71
|
-
//# sourceMappingURL=build-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contract.js","sourceRoot":"","sources":["../../src/bin/build-contract.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,mCAAgC;AAChC,4EAA6C;AAC7C,kFAAmD;AACnD,yCAAoC;AACpC,iDAAyC;AACzC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,yBAAyB,CAAC;KAClC,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EAAE,yCAAyC,EAAE,KAAK,CAAC;KACjE,MAAM,CAAC,SAAS,EAAE,mCAAmC,EAAE,KAAK,CAAC;KAC7D,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,MAAM,GAAG,GAAY,OAAO,CAAC,GAAG,CAAC;IAEjC,IAAA,wBAAQ,EAAC,iBAAiB,CAAC,CAAC;IAE5B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,YAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI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mBAAmB,CAAC;IAE3C,YAAE,CAAC,aAAa,CACd,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,EACjD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAChC,CAAC;IAEF,IAAA,wBAAQ,EAAC,4BAA4B,CAAC,CAAC;IACvC,IAAA,wBAAQ,EAAC,+BAA+B,CAAC,CAAC;IAC1C,IAAA,wBAAQ,EAAC,oCAAoC,CAAC,CAAC;IAE/C,IAAA,wBAAQ,EAAC,6CAA6C,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const commander_1 = require("commander");
|
|
9
|
-
const child_process_1 = require("child_process");
|
|
10
|
-
const program = new commander_1.Command();
|
|
11
|
-
program
|
|
12
|
-
.command("compile-contract")
|
|
13
|
-
.description("Creates a global contract")
|
|
14
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
15
|
-
.option("--debug", "enables inspector", false)
|
|
16
|
-
.option("--name <String>", "contract name", "contract")
|
|
17
|
-
.option("--output <String>", "output", undefined)
|
|
18
|
-
.action(async (options) => {
|
|
19
|
-
const dev = options.dev;
|
|
20
|
-
const debug = options.debug;
|
|
21
|
-
const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, "../../package.json"), "utf-8"));
|
|
22
|
-
const scripts = {
|
|
23
|
-
start: debug
|
|
24
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
25
|
-
: "fabric-chaincode-node start",
|
|
26
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
27
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
28
|
-
build: 'echo "No need to build the chaincode"',
|
|
29
|
-
lint: "eslint . --fix --ext .js",
|
|
30
|
-
};
|
|
31
|
-
const contractPackage = pkg;
|
|
32
|
-
contractPackage.name = options.name;
|
|
33
|
-
contractPackage.description = "Global contract implementation";
|
|
34
|
-
contractPackage.scripts = scripts;
|
|
35
|
-
delete contractPackage.type;
|
|
36
|
-
delete contractPackage.types;
|
|
37
|
-
delete contractPackage.exports;
|
|
38
|
-
contractPackage.main = "index.js";
|
|
39
|
-
fs_1.default.writeFileSync(path_1.default.join(__dirname, "../../", options.output, "package.json"), JSON.stringify(contractPackage));
|
|
40
|
-
(0, child_process_1.execSync)(`cd ${path_1.default.join(__dirname, "../../", options.output)} && npm install`);
|
|
41
|
-
(0, child_process_1.execSync)(`cd ${path_1.default.join(__dirname, "../../", options.output)} && npm shrinkwrap`);
|
|
42
|
-
// execSync(
|
|
43
|
-
// `cd ${path.join(__dirname, "../../", options.output)} && rm -rf node_modules`
|
|
44
|
-
// );
|
|
45
|
-
});
|
|
46
|
-
program.parse(process.argv);
|
|
47
|
-
//# sourceMappingURL=build-contracts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contracts.js","sourceRoot":"","sources":["../../src/bin/build-contracts.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,yCAAoC;AACpC,iDAAyC;AACzC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,kBAAkB,CAAC;KAC3B,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EA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A,wBAAQ,EACN,MAAM,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,CACtE,CAAC;IACF,IAAA,wBAAQ,EACN,MAAM,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAC1E,CAAC;IACF,YAAY;IACZ,mFAAmF;IACnF,KAAK;AACP,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const commander_1 = require("commander");
|
|
4
|
-
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
5
|
-
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
6
|
-
const index_1 = require("./../client/indexes/index.cjs");
|
|
7
|
-
const logging_1 = require("@decaf-ts/logging");
|
|
8
|
-
const program = new commander_1.Command();
|
|
9
|
-
program
|
|
10
|
-
.command("compile-indexes")
|
|
11
|
-
.option("--file [String]", "the model file")
|
|
12
|
-
.option("--folder [String]", "the model folder")
|
|
13
|
-
.option("--outDir <String>", "the outdir. should match your contract folder")
|
|
14
|
-
.description("Creates a the JSON index files to be submitted to along with the contract")
|
|
15
|
-
.action(async (options) => {
|
|
16
|
-
// eslint-disable-next-line prefer-const
|
|
17
|
-
let { file, folder, outDir } = options;
|
|
18
|
-
const log = logging_1.Logging.get();
|
|
19
|
-
const models = [];
|
|
20
|
-
if (file) {
|
|
21
|
-
models.push(...(0, index_1.readModelFile)(file));
|
|
22
|
-
}
|
|
23
|
-
if (folder) {
|
|
24
|
-
log.info(`Loading models from ${folder}...`);
|
|
25
|
-
models.push(...(await (0, index_1.readModelFolders)(folder)));
|
|
26
|
-
}
|
|
27
|
-
const result = {};
|
|
28
|
-
if (!file && !folder)
|
|
29
|
-
throw new db_decorators_1.InternalError(`Must pass a file or a folder`);
|
|
30
|
-
for (const m of models) {
|
|
31
|
-
log.verbose(`Extracting indexes for table ${decorator_validation_1.Model.tableName(m)}`);
|
|
32
|
-
(0, index_1.generateModelIndexes)(m, result);
|
|
33
|
-
}
|
|
34
|
-
log.verbose(`Found ${Object.keys(result).length} indexes to create`);
|
|
35
|
-
log.debug(`Indexes: ${JSON.stringify(result)}`);
|
|
36
|
-
(0, index_1.writeIndexes)(Object.values(result), outDir);
|
|
37
|
-
});
|
|
38
|
-
program.parse(process.argv);
|
|
39
|
-
//# sourceMappingURL=compile-indexes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-indexes.js","sourceRoot":"","sources":["../../src/bin/compile-indexes.ts"],"names":[],"mappings":";;AACA,yCAAoC;AACpC,2DAAwD;AACxD,yEAAuD;AACvD,yDAKiC;AACjC,+CAA4C;AAC5C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,iBAAiB,CAAC;KAC1B,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;KAC3C,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;KAC/C,MAAM,CAAC,mBAAmB,EAAE,+CAA+C,CAAC;KAC5E,WAAW,CACV,2EAA2E,CAC5E;KACA,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,wCAAwC;IACxC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,GAAG,GAAG,iBAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,GAAG,CAAC,IAAI,CAAC,uBAAuB,MAAM,KAAK,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IACD,MAAM,MAAM,GAAwB,EAAE,CAAC;IAEvC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;QAClB,MAAM,IAAI,6BAAa,CAAC,8BAA8B,CAAC,CAAC;IAE1D,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,GAAG,CAAC,OAAO,CAAC,gCAAgC,4BAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClE,IAAA,4BAAoB,EAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,GAAG,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,oBAAoB,CAAC,CAAC;IACrE,GAAG,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAChD,IAAA,oBAAY,EAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import { rollup } from "rollup";
|
|
4
|
-
import replace from "@rollup/plugin-replace";
|
|
5
|
-
import typescript from "@rollup/plugin-typescript";
|
|
6
|
-
import { Command } from "commander";
|
|
7
|
-
import { execSync } from "child_process";
|
|
8
|
-
const program = new Command();
|
|
9
|
-
program
|
|
10
|
-
.command("compile-global-contract")
|
|
11
|
-
.description("Creates a global contract")
|
|
12
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
13
|
-
.option("--debug", "makes attaching debugger possible", false)
|
|
14
|
-
.action(async (options) => {
|
|
15
|
-
const dev = options.dev;
|
|
16
|
-
execSync("rm -rf ./global");
|
|
17
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../../package.json"), "utf-8"));
|
|
18
|
-
const version = pkg.version;
|
|
19
|
-
const bundle = await rollup({
|
|
20
|
-
input: "./src/contract/index.ts",
|
|
21
|
-
plugins: [
|
|
22
|
-
replace({
|
|
23
|
-
preventAssignment: true,
|
|
24
|
-
delimiters: ["", ""],
|
|
25
|
-
values: { "##VERSION##": version },
|
|
26
|
-
}),
|
|
27
|
-
typescript({
|
|
28
|
-
tsconfig: "./tsconfig.json",
|
|
29
|
-
compilerOptions: {
|
|
30
|
-
outDir: "global",
|
|
31
|
-
},
|
|
32
|
-
module: "esnext",
|
|
33
|
-
declaration: false,
|
|
34
|
-
}),
|
|
35
|
-
],
|
|
36
|
-
});
|
|
37
|
-
await bundle.write({
|
|
38
|
-
file: "./global/GlobalContract.js",
|
|
39
|
-
format: "umd",
|
|
40
|
-
name: "GlobalContract.js",
|
|
41
|
-
});
|
|
42
|
-
const scripts = {
|
|
43
|
-
start: options.debug
|
|
44
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
45
|
-
: "fabric-chaincode-node start",
|
|
46
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
47
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
48
|
-
build: 'echo "No need to build the chaincode"',
|
|
49
|
-
lint: "eslint . --fix --ext .js",
|
|
50
|
-
};
|
|
51
|
-
const contractPackage = pkg;
|
|
52
|
-
contractPackage.name = "global-contract";
|
|
53
|
-
contractPackage.description = "Global contract implementation";
|
|
54
|
-
contractPackage.scripts = scripts;
|
|
55
|
-
delete contractPackage.type;
|
|
56
|
-
delete contractPackage.types;
|
|
57
|
-
delete contractPackage.exports;
|
|
58
|
-
contractPackage.main = "GlobalContract.js";
|
|
59
|
-
fs.writeFileSync(path.join(__dirname, "../../global/package.json"), JSON.stringify(contractPackage));
|
|
60
|
-
execSync("cd ./global && npm install");
|
|
61
|
-
execSync("cd ./global && npm shrinkwrap");
|
|
62
|
-
execSync("cd ./global && rm -rf node_modules");
|
|
63
|
-
execSync("rm -rf ./global/lib && rm -rf ./global/dist");
|
|
64
|
-
});
|
|
65
|
-
program.parse(process.argv);
|
|
66
|
-
//# sourceMappingURL=build-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contract.js","sourceRoot":"","sources":["../../../src/bin/build-contract.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,yBAAyB,CAAC;KAClC,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EAAE,yCAAyC,EAAE,KAAK,CAAC;KACjE,MAAM,CAAC,SAAS,EAAE,mCAAmC,EAAE,KAAK,CAAC;KAC7D,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,MAAM,GAAG,GAAY,OAAO,CAAC,GAAG,CAAC;IAEjC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAE5B,MAAM,GA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AAe,CAAC,OAAO,CAAC;IAC/B,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAE3C,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,EACjD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAChC,CAAC;IAEF,QAAQ,CAAC,4BAA4B,CAAC,CAAC;IACvC,QAAQ,CAAC,+BAA+B,CAAC,CAAC;IAC1C,QAAQ,CAAC,oCAAoC,CAAC,CAAC;IAE/C,QAAQ,CAAC,6CAA6C,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
const program = new Command();
|
|
6
|
-
program
|
|
7
|
-
.command("compile-contract")
|
|
8
|
-
.description("Creates a global contract")
|
|
9
|
-
.option("--dev", "compiles contracts without minification", false)
|
|
10
|
-
.option("--debug", "enables inspector", false)
|
|
11
|
-
.option("--name <String>", "contract name", "contract")
|
|
12
|
-
.option("--output <String>", "output", undefined)
|
|
13
|
-
.action(async (options) => {
|
|
14
|
-
const dev = options.dev;
|
|
15
|
-
const debug = options.debug;
|
|
16
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "../../package.json"), "utf-8"));
|
|
17
|
-
const scripts = {
|
|
18
|
-
start: debug
|
|
19
|
-
? "node --inspect=0.0.0.0:9229 /usr/local/src/node_modules/.bin/fabric-chaincode-node start"
|
|
20
|
-
: "fabric-chaincode-node start",
|
|
21
|
-
"start:dev": 'fabric-chaincode-node start --peer.address "127.0.0.1:8541" --chaincode-id-name "chaincode1:0.0.1" --tls.enabled false',
|
|
22
|
-
"start:watch": 'nodemon --exec "npm run start:dev"',
|
|
23
|
-
build: 'echo "No need to build the chaincode"',
|
|
24
|
-
lint: "eslint . --fix --ext .js",
|
|
25
|
-
};
|
|
26
|
-
const contractPackage = pkg;
|
|
27
|
-
contractPackage.name = options.name;
|
|
28
|
-
contractPackage.description = "Global contract implementation";
|
|
29
|
-
contractPackage.scripts = scripts;
|
|
30
|
-
delete contractPackage.type;
|
|
31
|
-
delete contractPackage.types;
|
|
32
|
-
delete contractPackage.exports;
|
|
33
|
-
contractPackage.main = "index.js";
|
|
34
|
-
fs.writeFileSync(path.join(__dirname, "../../", options.output, "package.json"), JSON.stringify(contractPackage));
|
|
35
|
-
execSync(`cd ${path.join(__dirname, "../../", options.output)} && npm install`);
|
|
36
|
-
execSync(`cd ${path.join(__dirname, "../../", options.output)} && npm shrinkwrap`);
|
|
37
|
-
// execSync(
|
|
38
|
-
// `cd ${path.join(__dirname, "../../", options.output)} && rm -rf node_modules`
|
|
39
|
-
// );
|
|
40
|
-
});
|
|
41
|
-
program.parse(process.argv);
|
|
42
|
-
//# sourceMappingURL=build-contracts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-contracts.js","sourceRoot":"","sources":["../../../src/bin/build-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,kBAAkB,CAAC;KAC3B,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EAAE,yCAAyC,EAAE,KAAK,CAAC;KACjE,MAAM,CAAC,SAAS,EAAE,mBAAmB,EAAE,KAAK,CAAC;KAC7C,MAAM,CAAC,iBAAiB,EAAE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,CACN,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAC1E,CAAC;IACF,YAAY;IACZ,mFAAmF;IACnF,KAAK;AACP,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { InternalError } from "@decaf-ts/db-decorators";
|
|
3
|
-
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
-
import { generateModelIndexes, readModelFile, readModelFolders, writeIndexes, } from "./../client/indexes/index.js";
|
|
5
|
-
import { Logging } from "@decaf-ts/logging";
|
|
6
|
-
const program = new Command();
|
|
7
|
-
program
|
|
8
|
-
.command("compile-indexes")
|
|
9
|
-
.option("--file [String]", "the model file")
|
|
10
|
-
.option("--folder [String]", "the model folder")
|
|
11
|
-
.option("--outDir <String>", "the outdir. should match your contract folder")
|
|
12
|
-
.description("Creates a the JSON index files to be submitted to along with the contract")
|
|
13
|
-
.action(async (options) => {
|
|
14
|
-
// eslint-disable-next-line prefer-const
|
|
15
|
-
let { file, folder, outDir } = options;
|
|
16
|
-
const log = Logging.get();
|
|
17
|
-
const models = [];
|
|
18
|
-
if (file) {
|
|
19
|
-
models.push(...readModelFile(file));
|
|
20
|
-
}
|
|
21
|
-
if (folder) {
|
|
22
|
-
log.info(`Loading models from ${folder}...`);
|
|
23
|
-
models.push(...(await readModelFolders(folder)));
|
|
24
|
-
}
|
|
25
|
-
const result = {};
|
|
26
|
-
if (!file && !folder)
|
|
27
|
-
throw new InternalError(`Must pass a file or a folder`);
|
|
28
|
-
for (const m of models) {
|
|
29
|
-
log.verbose(`Extracting indexes for table ${Model.tableName(m)}`);
|
|
30
|
-
generateModelIndexes(m, result);
|
|
31
|
-
}
|
|
32
|
-
log.verbose(`Found ${Object.keys(result).length} indexes to create`);
|
|
33
|
-
log.debug(`Indexes: ${JSON.stringify(result)}`);
|
|
34
|
-
writeIndexes(Object.values(result), outDir);
|
|
35
|
-
});
|
|
36
|
-
program.parse(process.argv);
|
|
37
|
-
//# sourceMappingURL=compile-indexes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-indexes.js","sourceRoot":"","sources":["../../../src/bin/compile-indexes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,qCAAgC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,OAAO,CAAC,iBAAiB,CAAC;KAC1B,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;KAC3C,MAAM,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;KAC/C,MAAM,CAAC,mBAAmB,EAAE,+CAA+C,CAAC;KAC5E,WAAW,CACV,2EAA2E,CAC5E;KACA,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC7B,wCAAwC;IACxC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACX,GAAG,CAAC,IAA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