lunesjs 1.5.2 → 1.5.5
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/.github/workflows/deploy.yml +23 -22
- package/.github/workflows/test.yml +18 -4
- package/Dockerfile +1 -4
- package/README.md +2 -2
- package/dist/client/transactions/BaseTransaction.d.ts +6 -0
- package/dist/client/transactions/BaseTransaction.js +2 -0
- package/dist/client/transactions/transactions.types.d.ts +10 -0
- package/dist/client/transactions/transactions.types.js +17 -0
- package/dist/client/transactions/transfer/service.transfer.d.ts +12 -0
- package/dist/client/transactions/transfer/service.transfer.js +78 -0
- package/dist/client/transactions/transfer/transfer.types.d.ts +12 -0
- package/dist/client/transactions/transfer/transfer.types.js +2 -0
- package/dist/client/transactions/transfer/validator.d.ts +9 -0
- package/dist/client/transactions/transfer/validator.js +93 -0
- package/dist/client/wallet/constants.d.ts +8 -0
- package/dist/client/wallet/constants.js +2064 -0
- package/dist/client/wallet/service.account.d.ts +20 -0
- package/dist/client/wallet/service.account.js +35 -0
- package/dist/client/wallet/wallet.types.d.ts +21 -0
- package/dist/client/wallet/wallet.types.js +11 -0
- package/dist/utils/crypto.d.ts +13 -0
- package/dist/utils/crypto.js +102 -0
- package/package.json +4 -2
- package/src/client/transactions/transfer/service.transfer.ts +15 -21
- package/src/client/transactions/transfer/validator.ts +13 -7
- package/src/client/wallet/service.account.ts +4 -4
- package/test/client/transactions/transfer/transfer.token.test.ts +10 -8
- package/tsconfig.json +12 -89
- package/.github/workflows/fmt.yml +0 -21
- package/docker/runner/Dockerfile +0 -22
@@ -0,0 +1,20 @@
|
|
1
|
+
import { IAccount } from "./wallet.types";
|
2
|
+
declare class Account implements IAccount {
|
3
|
+
privateKey: string;
|
4
|
+
publicKey: string;
|
5
|
+
address: string;
|
6
|
+
chain: number;
|
7
|
+
nonce: number;
|
8
|
+
seed: string;
|
9
|
+
constructor(wallet: IAccount);
|
10
|
+
}
|
11
|
+
export declare function accountFactory({ privateKey, publicKey, address, nWords, chain, nonce, seed }?: {
|
12
|
+
privateKey?: string;
|
13
|
+
publicKey?: string;
|
14
|
+
address?: string;
|
15
|
+
nWords?: number;
|
16
|
+
chain?: number;
|
17
|
+
nonce?: number;
|
18
|
+
seed?: string;
|
19
|
+
}): Account;
|
20
|
+
export {};
|
@@ -0,0 +1,35 @@
|
|
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
|
+
exports.accountFactory = void 0;
|
7
|
+
const crypto_1 = __importDefault(require("../../utils/crypto"));
|
8
|
+
class Account {
|
9
|
+
constructor(wallet) {
|
10
|
+
this.privateKey = wallet.privateKey;
|
11
|
+
this.publicKey = wallet.publicKey;
|
12
|
+
this.address = wallet.address;
|
13
|
+
this.chain = wallet.chain;
|
14
|
+
this.nonce = wallet.nonce;
|
15
|
+
this.seed = wallet.seed;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
function accountFactory({ privateKey, publicKey, address, nWords, chain, nonce, seed } = {}) {
|
19
|
+
if (seed != undefined) {
|
20
|
+
return new Account(Object.assign({}, crypto_1.default.fromExistingSeed(seed, nonce != undefined ? nonce : 0, chain != undefined ? chain : 1)));
|
21
|
+
}
|
22
|
+
else if (privateKey != undefined) {
|
23
|
+
return new Account(Object.assign({}, crypto_1.default.fromPrivateKey(privateKey, chain != undefined ? chain : 1)));
|
24
|
+
}
|
25
|
+
else if (publicKey != undefined) {
|
26
|
+
return new Account(Object.assign({}, crypto_1.default.fromPublicKey(publicKey, chain != undefined ? chain : 1)));
|
27
|
+
}
|
28
|
+
else if (address != undefined) {
|
29
|
+
return new Account(Object.assign({}, crypto_1.default.fromAddress(address, chain != undefined ? chain : 0)));
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
return new Account(Object.assign({}, crypto_1.default.fromNewSeed(nWords != undefined ? nWords : 12, nonce != undefined ? nonce : 0, chain != undefined ? chain : 1)));
|
33
|
+
}
|
34
|
+
}
|
35
|
+
exports.accountFactory = accountFactory;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare type empty = "";
|
2
|
+
export declare type zero = 0;
|
3
|
+
export declare namespace WalletTypes {
|
4
|
+
type Seed = string | empty;
|
5
|
+
type Nonce = number | zero;
|
6
|
+
enum Chain {
|
7
|
+
Mainnet = 1,
|
8
|
+
Testnet = 0
|
9
|
+
}
|
10
|
+
type PrivateKey = string | empty;
|
11
|
+
type PublicKey = string | empty;
|
12
|
+
type Address = string | empty;
|
13
|
+
}
|
14
|
+
export interface IAccount {
|
15
|
+
privateKey: WalletTypes.PrivateKey;
|
16
|
+
publicKey: WalletTypes.PublicKey;
|
17
|
+
address: WalletTypes.Address;
|
18
|
+
nonce: WalletTypes.Nonce;
|
19
|
+
chain: WalletTypes.Chain;
|
20
|
+
seed: WalletTypes.Seed;
|
21
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WalletTypes = void 0;
|
4
|
+
var WalletTypes;
|
5
|
+
(function (WalletTypes) {
|
6
|
+
let Chain;
|
7
|
+
(function (Chain) {
|
8
|
+
Chain[Chain["Mainnet"] = 1] = "Mainnet";
|
9
|
+
Chain[Chain["Testnet"] = 0] = "Testnet";
|
10
|
+
})(Chain = WalletTypes.Chain || (WalletTypes.Chain = {}));
|
11
|
+
})(WalletTypes = exports.WalletTypes || (exports.WalletTypes = {}));
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { IAccount, WalletTypes } from "../client/wallet/wallet.types";
|
2
|
+
declare const cryptoUtils: {
|
3
|
+
fromExistingSeed: (seed: string, nonce: number, chain: WalletTypes.Chain) => IAccount;
|
4
|
+
fromPrivateKey: (privateKey: string, chain: WalletTypes.Chain) => IAccount;
|
5
|
+
fromPublicKey: (publicKey: string, chain: WalletTypes.Chain) => IAccount;
|
6
|
+
fromAddress: (address: string, chain: WalletTypes.Chain) => IAccount;
|
7
|
+
fromNewSeed: (nWords: number, nonce: number, chain: WalletTypes.Chain) => IAccount;
|
8
|
+
validateAddress: (address: string, chain: WalletTypes.Chain) => boolean;
|
9
|
+
validateSignature: (publicKey: string, message: string, signature: string) => boolean;
|
10
|
+
fastSignature: (privateKey: string, message: string) => string;
|
11
|
+
fullSignature: (privateKey: string, message: string) => string;
|
12
|
+
};
|
13
|
+
export default cryptoUtils;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
const constants_1 = __importDefault(require("../client/wallet/constants"));
|
30
|
+
const wasm = __importStar(require("lunesrs"));
|
31
|
+
const cryptoUtils = {
|
32
|
+
fromExistingSeed: (seed, nonce, chain) => {
|
33
|
+
const hidden_seed = wasm.hiddenSeed(nonce, seed);
|
34
|
+
const privateKey = wasm.toPrivateKey(hidden_seed);
|
35
|
+
const publicKey = wasm.toPublicKey(privateKey);
|
36
|
+
const address = wasm.toAddress(1, chain, publicKey);
|
37
|
+
return {
|
38
|
+
nonce: nonce,
|
39
|
+
chain: chain,
|
40
|
+
seed: seed,
|
41
|
+
privateKey: wasm.arrayToBase58(privateKey),
|
42
|
+
publicKey: wasm.arrayToBase58(publicKey),
|
43
|
+
address: wasm.arrayToBase58(address)
|
44
|
+
};
|
45
|
+
},
|
46
|
+
fromPrivateKey: (privateKey, chain) => {
|
47
|
+
const publicKey = wasm.toPublicKey(wasm.base58ToArray(privateKey));
|
48
|
+
const address = wasm.toAddress(1, chain, publicKey);
|
49
|
+
return {
|
50
|
+
seed: "",
|
51
|
+
nonce: 0,
|
52
|
+
chain: chain,
|
53
|
+
privateKey: privateKey,
|
54
|
+
publicKey: wasm.arrayToBase58(publicKey),
|
55
|
+
address: wasm.arrayToBase58(address)
|
56
|
+
};
|
57
|
+
},
|
58
|
+
fromPublicKey: (publicKey, chain) => {
|
59
|
+
const address = wasm.toAddress(1, chain, wasm.base58ToArray(publicKey));
|
60
|
+
return {
|
61
|
+
seed: "",
|
62
|
+
nonce: 0,
|
63
|
+
privateKey: "",
|
64
|
+
chain: chain,
|
65
|
+
publicKey: publicKey,
|
66
|
+
address: wasm.arrayToBase58(address)
|
67
|
+
};
|
68
|
+
},
|
69
|
+
fromAddress: (address, chain) => {
|
70
|
+
return {
|
71
|
+
seed: "",
|
72
|
+
nonce: 0,
|
73
|
+
privateKey: "",
|
74
|
+
publicKey: "",
|
75
|
+
chain: chain,
|
76
|
+
address: address
|
77
|
+
};
|
78
|
+
},
|
79
|
+
fromNewSeed: (nWords, nonce, chain) => {
|
80
|
+
let seed = [];
|
81
|
+
nWords = nWords != undefined ? Math.round(nWords / 3) : 4;
|
82
|
+
for (let i = 0; i < nWords; i++) {
|
83
|
+
for (let n in wasm.randomTripleNumber()) {
|
84
|
+
seed.push(constants_1.default.wordsList[n]);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
return cryptoUtils.fromExistingSeed(seed.join(" "), nonce, chain);
|
88
|
+
},
|
89
|
+
validateAddress: (address, chain) => {
|
90
|
+
return wasm.validateAddress(chain, wasm.base58ToArray(address));
|
91
|
+
},
|
92
|
+
validateSignature: (publicKey, message, signature) => {
|
93
|
+
return wasm.validateSignature(wasm.base58ToArray(publicKey), wasm.base58ToArray(message), wasm.base58ToArray(signature));
|
94
|
+
},
|
95
|
+
fastSignature: (privateKey, message) => {
|
96
|
+
return wasm.arrayToBase58(wasm.fastSignature(wasm.base58ToArray(privateKey), wasm.base58ToArray(message)));
|
97
|
+
},
|
98
|
+
fullSignature: (privateKey, message) => {
|
99
|
+
return wasm.arrayToBase58(wasm.fullSignature(wasm.base58ToArray(privateKey), wasm.base58ToArray(message)));
|
100
|
+
}
|
101
|
+
};
|
102
|
+
exports.default = cryptoUtils;
|
package/package.json
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "lunesjs",
|
3
|
-
"version": "1.5.
|
3
|
+
"version": "1.5.5",
|
4
4
|
"description": "Library for communication with nodes in mainnet or testnet of the lunes-blockchain network",
|
5
|
-
"main": "
|
5
|
+
"main": "dist/*.js",
|
6
|
+
"types": "dist/*.d.ts",
|
6
7
|
"repository": "git@git.lunes.io:blockchain/labs/lunesjs.git",
|
7
8
|
"keywords": [
|
8
9
|
"blockchain",
|
@@ -12,6 +13,7 @@
|
|
12
13
|
"author": "lunes-platform",
|
13
14
|
"license": "SEE LICENSE IN ./LICENSE",
|
14
15
|
"scripts": {
|
16
|
+
"build": "tsc --declaration",
|
15
17
|
"fmtc": "prettier -c",
|
16
18
|
"fmt": "prettier -w .",
|
17
19
|
"test": "yarn jest"
|
@@ -7,10 +7,8 @@ import * as wasm from "lunesrs"
|
|
7
7
|
|
8
8
|
class TransferToken implements BaseTransaction {
|
9
9
|
private tx: ITransfer
|
10
|
-
|
11
|
-
constructor(tx: ITransfer, chain: WalletTypes.Chain) {
|
10
|
+
constructor(tx: ITransfer) {
|
12
11
|
this.tx = tx
|
13
|
-
this.chain = chain
|
14
12
|
}
|
15
13
|
|
16
14
|
transaction(): ITransfer {
|
@@ -43,22 +41,18 @@ export function transferTokenFactory(
|
|
43
41
|
) {
|
44
42
|
throw new Error("dados invalidos")
|
45
43
|
}
|
46
|
-
return new TransferToken(
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
signature: ""
|
61
|
-
},
|
62
|
-
chain_id
|
63
|
-
)
|
44
|
+
return new TransferToken({
|
45
|
+
senderPublicKey: senderPublicKey,
|
46
|
+
recipient: recipient,
|
47
|
+
amount: amount,
|
48
|
+
sender: wasm.arrayToBase58(
|
49
|
+
wasm.toAddress(1, chain_id, wasm.base58ToArray(senderPublicKey))
|
50
|
+
),
|
51
|
+
timestamp: timestamp != undefined ? timestamp : new Date().getTime(),
|
52
|
+
feeAsset: feeAsset != undefined ? feeAsset : "",
|
53
|
+
assetId: assetId != undefined ? assetId : "",
|
54
|
+
type: TransactionsTypes.TransferToken.int,
|
55
|
+
fee: fee != undefined ? fee : TransactionsTypes.TransferToken.fee,
|
56
|
+
signature: ""
|
57
|
+
})
|
64
58
|
}
|
@@ -14,12 +14,17 @@ const validator = {
|
|
14
14
|
amount: number,
|
15
15
|
fee: number,
|
16
16
|
recipient: string
|
17
|
-
)
|
18
|
-
const tokenId =
|
19
|
-
assetId != ""
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
) => {
|
18
|
+
const tokenId: Uint8Array =
|
19
|
+
assetId != ""
|
20
|
+
? new Uint8Array([1, ...wasm.base58ToArray(assetId)])
|
21
|
+
: new Uint8Array([0])
|
22
|
+
const tokenFee: Uint8Array =
|
23
|
+
feeAsset != ""
|
24
|
+
? new Uint8Array([1, ...wasm.base58ToArray(feeAsset)])
|
25
|
+
: new Uint8Array([0])
|
26
|
+
|
27
|
+
return new Uint8Array([
|
23
28
|
...[TransactionsTypes.TransferToken.int],
|
24
29
|
...wasm.base58ToArray(senderPublicKey),
|
25
30
|
...tokenId,
|
@@ -28,7 +33,7 @@ const validator = {
|
|
28
33
|
...wasm.serializeUInteger(BigInt(amount)),
|
29
34
|
...wasm.serializeUInteger(BigInt(fee)),
|
30
35
|
...wasm.base58ToArray(recipient)
|
31
|
-
]
|
36
|
+
])
|
32
37
|
},
|
33
38
|
ready: (
|
34
39
|
senderPublicKey: string,
|
@@ -62,6 +67,7 @@ const validator = {
|
|
62
67
|
tx.fee,
|
63
68
|
tx.recipient
|
64
69
|
)
|
70
|
+
|
65
71
|
return cryptoUtils.fastSignature(
|
66
72
|
privateKey,
|
67
73
|
wasm.arrayToBase58(new Uint8Array(message))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { IAccount
|
1
|
+
import { IAccount } from "./wallet.types"
|
2
2
|
import cryptoUtils from "../../utils/crypto"
|
3
3
|
|
4
4
|
class Account implements IAccount {
|
@@ -41,21 +41,21 @@ export function accountFactory({
|
|
41
41
|
...cryptoUtils.fromExistingSeed(
|
42
42
|
seed,
|
43
43
|
nonce != undefined ? nonce : 0,
|
44
|
-
chain != undefined ? chain :
|
44
|
+
chain != undefined ? chain : 1
|
45
45
|
)
|
46
46
|
})
|
47
47
|
} else if (privateKey != undefined) {
|
48
48
|
return new Account({
|
49
49
|
...cryptoUtils.fromPrivateKey(
|
50
50
|
privateKey,
|
51
|
-
chain != undefined ? chain :
|
51
|
+
chain != undefined ? chain : 1
|
52
52
|
)
|
53
53
|
})
|
54
54
|
} else if (publicKey != undefined) {
|
55
55
|
return new Account({
|
56
56
|
...cryptoUtils.fromPublicKey(
|
57
57
|
publicKey,
|
58
|
-
chain != undefined ? chain :
|
58
|
+
chain != undefined ? chain : 1
|
59
59
|
)
|
60
60
|
})
|
61
61
|
} else if (address != undefined) {
|
@@ -58,14 +58,16 @@ describe("Transfer Token Suite", () => {
|
|
58
58
|
expect(wasm.arrayToBase58(Uint8Array.from(message))).toEqual(
|
59
59
|
"2J2EfWqeqbH17PC5yfioAeQ5h27J76uduH5nafAUuJhKb8gHCSqpDFV4oGgWPwQkBgg9tfQjatWZu8eiYYe6NF67Sd5Hf7ieAsaZT5hZow9xgjefbfs5"
|
60
60
|
)
|
61
|
-
expect(message).toEqual(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
expect(message).toEqual(
|
62
|
+
new Uint8Array([
|
63
|
+
4, 28, 26, 172, 20, 253, 115, 23, 6, 248, 59, 119, 129, 151,
|
64
|
+
144, 5, 252, 208, 116, 12, 81, 146, 227, 208, 88, 57, 27, 134,
|
65
|
+
143, 7, 76, 94, 8, 0, 0, 0, 0, 1, 127, 201, 78, 107, 19, 0, 0,
|
66
|
+
0, 23, 72, 118, 232, 0, 0, 0, 0, 0, 0, 15, 66, 64, 1, 49, 146,
|
67
|
+
80, 170, 11, 139, 27, 185, 41, 131, 242, 219, 45, 180, 199, 38,
|
68
|
+
41, 173, 240, 198, 30, 146, 73, 23, 128
|
69
|
+
])
|
70
|
+
)
|
69
71
|
expect(rawTx).toStrictEqual({
|
70
72
|
senderPublicKey: "2ti1GM7F7J78J347fqSWSVocueDV3RSCFkLSKqmhk35Z",
|
71
73
|
recipient: "37xRcbn1LiT1Az4REoLhjpca93jPG1gTEwq",
|
package/tsconfig.json
CHANGED
@@ -1,92 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
16
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
17
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
18
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
19
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
20
|
-
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
21
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
22
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
23
|
-
/* Modules */
|
24
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
25
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
26
|
-
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
27
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
28
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
29
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
30
|
-
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
31
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
32
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
33
|
-
// "resolveJsonModule": true, /* Enable importing .json files */
|
34
|
-
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
35
|
-
/* JavaScript Support */
|
36
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
37
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
38
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
39
|
-
/* Emit */
|
40
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
41
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
42
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
43
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
44
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
45
|
-
"outDir": "./build" /* Specify an output folder for all emitted files. */,
|
46
|
-
// "removeComments": true, /* Disable emitting comments. */
|
47
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
48
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
49
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
50
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
51
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
52
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
53
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
54
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
55
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
56
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
57
|
-
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
58
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
59
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
60
|
-
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
61
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
62
|
-
/* Interop Constraints */
|
63
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
64
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
65
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
66
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
67
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
68
|
-
/* Type Checking */
|
69
|
-
"strict": true /* Enable all strict type-checking options. */,
|
70
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
71
|
-
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
72
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
73
|
-
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
74
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
75
|
-
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
76
|
-
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
77
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
78
|
-
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
79
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
80
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
81
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
82
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
83
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
84
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
85
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
86
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
87
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
88
|
-
/* Completeness */
|
89
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
90
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
91
|
-
}
|
3
|
+
"target": "es6",
|
4
|
+
"module": "commonjs",
|
5
|
+
"outDir": "./dist",
|
6
|
+
"strict": true,
|
7
|
+
"noUnusedLocals": true,
|
8
|
+
"noUnusedParameters": true,
|
9
|
+
"noImplicitReturns": true,
|
10
|
+
"noFallthroughCasesInSwitch": true,
|
11
|
+
"esModuleInterop": true
|
12
|
+
},
|
13
|
+
"include": ["src/**/*"],
|
14
|
+
"exclude": ["node_modules", "**/*.test.ts"]
|
92
15
|
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
name: Format Checker
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [main]
|
6
|
-
pull_request:
|
7
|
-
branches: [main]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
format-checker:
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v2
|
15
|
-
- uses: actions/setup-node@v3
|
16
|
-
|
17
|
-
- name: Install dependencies
|
18
|
-
run: yarn install -D
|
19
|
-
|
20
|
-
- name: Format Checker
|
21
|
-
run: yarn fmtc
|
package/docker/runner/Dockerfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
FROM --platform=linux/amd64 node:16.13.2
|
2
|
-
|
3
|
-
WORKDIR runner/
|
4
|
-
|
5
|
-
ENV RUNNER_ALLOW_RUNASROOT="1"
|
6
|
-
|
7
|
-
RUN npm install -g npm@latest
|
8
|
-
RUN npm install -g commitizen
|
9
|
-
RUN npm install -g --save-dev --save-exact prettier
|
10
|
-
RUN npm install -g jest
|
11
|
-
|
12
|
-
# Install Github Runner
|
13
|
-
RUN apt update -y
|
14
|
-
# Download
|
15
|
-
RUN curl -o actions-runner-linux-x64-2.287.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.287.1/actions-runner-linux-x64-2.287.1.tar.gz
|
16
|
-
# Installer
|
17
|
-
RUN tar xzf ./actions-runner-linux-x64-2.287.1.tar.gz
|
18
|
-
|
19
|
-
# Running container and then
|
20
|
-
## get your token here https://github.com/lunes-platform/lunesjs/settings/actions/runners/new
|
21
|
-
# RUN ./config.sh --url https://github.com/lunes-platform/lunesjs --token YOUR_TOKEN
|
22
|
-
# RUN ["./run.sh"]
|