edilkamin 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/cli-tests.yml +4 -1
- package/.github/workflows/documentation.yml +8 -5
- package/.github/workflows/publish.yml +2 -1
- package/.github/workflows/tests.yml +6 -2
- package/dist/{cli.js → esm/cli.js} +13 -19
- package/dist/esm/constants.js +2 -0
- package/dist/esm/index.js +4 -0
- package/dist/{library.js → esm/library.js} +12 -53
- package/dist/{library.test.js → esm/library.test.js} +25 -30
- package/dist/esm/types.js +1 -0
- package/package.json +10 -7
- package/src/library.test.ts +1 -2
- package/src/library.ts +1 -3
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +8 -7
- package/dist/constants.js +0 -5
- package/dist/index.js +0 -11
- package/dist/types.js +0 -2
- /package/dist/{cli.d.ts → esm/cli.d.ts} +0 -0
- /package/dist/{constants.d.ts → esm/constants.d.ts} +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{library.d.ts → esm/library.d.ts} +0 -0
- /package/dist/{library.test.d.ts → esm/library.test.d.ts} +0 -0
- /package/dist/{types.d.ts → esm/types.d.ts} +0 -0
|
@@ -8,10 +8,13 @@ jobs:
|
|
|
8
8
|
tests:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
timeout-minutes: 5
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
node-version: [20.x, 22.x]
|
|
11
14
|
steps:
|
|
12
15
|
- uses: actions/checkout@v4
|
|
13
16
|
- uses: actions/setup-node@v4
|
|
14
17
|
with:
|
|
15
|
-
node-version:
|
|
18
|
+
node-version: ${{ matrix.node-version }}
|
|
16
19
|
- run: yarn install --no-ignore-optional
|
|
17
20
|
- run: yarn cli --help
|
|
@@ -2,17 +2,17 @@ name: Documentation
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
|
|
6
|
-
- main
|
|
5
|
+
pull_request:
|
|
7
6
|
|
|
8
7
|
jobs:
|
|
9
8
|
deploy:
|
|
10
9
|
runs-on: ubuntu-latest
|
|
10
|
+
timeout-minutes: 5
|
|
11
11
|
steps:
|
|
12
12
|
- uses: actions/checkout@v4
|
|
13
13
|
- uses: actions/setup-node@v4
|
|
14
14
|
with:
|
|
15
|
-
node-version: "
|
|
15
|
+
node-version: "22.x"
|
|
16
16
|
- name: git config
|
|
17
17
|
run: |
|
|
18
18
|
git config user.name documentation-deploy-action
|
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
git remote set-url origin https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git
|
|
21
21
|
- run: yarn install
|
|
22
22
|
- run: yarn typedoc src/index.ts --out /tmp/docs
|
|
23
|
-
- name:
|
|
23
|
+
- name: commit documentation
|
|
24
24
|
run: |
|
|
25
25
|
git ls-remote --exit-code . origin/gh-pages \
|
|
26
26
|
&& git checkout -b gh-pages \
|
|
@@ -30,5 +30,8 @@ jobs:
|
|
|
30
30
|
cp --recursive /tmp/docs/. .
|
|
31
31
|
echo /node_modules > .gitignore
|
|
32
32
|
git add --all
|
|
33
|
-
git commit --all --message ":memo: docs: Update generated documentation"
|
|
33
|
+
git commit --all --message ":memo: docs: Update generated documentation" || echo "No changes to commit"
|
|
34
|
+
- name: push documentation
|
|
35
|
+
if: github.ref_name == 'main'
|
|
36
|
+
run: |
|
|
34
37
|
git push origin gh-pages
|
|
@@ -8,11 +8,12 @@ on:
|
|
|
8
8
|
jobs:
|
|
9
9
|
build:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
|
+
timeout-minutes: 5
|
|
11
12
|
steps:
|
|
12
13
|
- uses: actions/checkout@v4
|
|
13
14
|
- uses: actions/setup-node@v4
|
|
14
15
|
with:
|
|
15
|
-
node-version: "
|
|
16
|
+
node-version: "22.x"
|
|
16
17
|
registry-url: "https://registry.npmjs.org"
|
|
17
18
|
- run: yarn install
|
|
18
19
|
- run: yarn build
|
|
@@ -5,13 +5,17 @@ on:
|
|
|
5
5
|
pull_request:
|
|
6
6
|
|
|
7
7
|
jobs:
|
|
8
|
-
|
|
8
|
+
tests:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
|
+
timeout-minutes: 5
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
node-version: [20.x, 22.x]
|
|
10
14
|
steps:
|
|
11
15
|
- uses: actions/checkout@v4
|
|
12
16
|
- uses: actions/setup-node@v4
|
|
13
17
|
with:
|
|
14
|
-
node-version:
|
|
18
|
+
node-version: ${{ matrix.node-version }}
|
|
15
19
|
- run: yarn install
|
|
16
20
|
- run: yarn lint
|
|
17
21
|
- run: yarn build
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -9,17 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
9
|
});
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
exports.main = void 0;
|
|
17
|
-
const library_1 = require("./library");
|
|
18
|
-
const commander_1 = require("commander");
|
|
19
|
-
const readline_1 = __importDefault(require("readline"));
|
|
20
|
-
const package_json_1 = require("../package.json");
|
|
11
|
+
import { signIn, configure } from "./library";
|
|
12
|
+
import { Command } from "commander";
|
|
13
|
+
import readline from "readline";
|
|
14
|
+
import { version } from "../package.json";
|
|
21
15
|
const promptPassword = () => {
|
|
22
|
-
const rl =
|
|
16
|
+
const rl = readline.createInterface({
|
|
23
17
|
input: process.stdin,
|
|
24
18
|
output: process.stdout,
|
|
25
19
|
terminal: true,
|
|
@@ -27,8 +21,8 @@ const promptPassword = () => {
|
|
|
27
21
|
return new Promise((resolve) => {
|
|
28
22
|
rl.question("Enter password: ", (password) => {
|
|
29
23
|
// Hide the password input
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
readline.moveCursor(process.stdout, 0, -1);
|
|
25
|
+
readline.clearLine(process.stdout, 0);
|
|
32
26
|
rl.close();
|
|
33
27
|
resolve(password);
|
|
34
28
|
});
|
|
@@ -49,16 +43,16 @@ const addCommonOptions = (command) => command
|
|
|
49
43
|
.requiredOption("-u, --username <username>", "Username")
|
|
50
44
|
.option("-p, --password <password>", "Password");
|
|
51
45
|
const createProgram = () => {
|
|
52
|
-
const program = new
|
|
46
|
+
const program = new Command();
|
|
53
47
|
program
|
|
54
48
|
.name("edilkamin-cli")
|
|
55
49
|
.description("CLI tool for interacting with the Edilkamin API")
|
|
56
|
-
.version(
|
|
50
|
+
.version(version);
|
|
57
51
|
// Command: signIn
|
|
58
52
|
addCommonOptions(program.command("signIn").description("Sign in and retrieve a JWT token")).action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
53
|
const { username, password } = options;
|
|
60
54
|
const pwd = password || (yield promptPassword());
|
|
61
|
-
const jwtToken = yield
|
|
55
|
+
const jwtToken = yield signIn(username, pwd);
|
|
62
56
|
console.log("JWT Token:", jwtToken);
|
|
63
57
|
}));
|
|
64
58
|
// Command: deviceInfo
|
|
@@ -68,8 +62,8 @@ const createProgram = () => {
|
|
|
68
62
|
.requiredOption("-m, --mac <macAddress>", "MAC address of the device")).action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
63
|
const { username, password, mac } = options;
|
|
70
64
|
const pwd = password || (yield promptPassword());
|
|
71
|
-
const jwtToken = yield
|
|
72
|
-
const api =
|
|
65
|
+
const jwtToken = yield signIn(username, pwd);
|
|
66
|
+
const api = configure(); // Use the default API configuration
|
|
73
67
|
const deviceInfo = yield api.deviceInfo(jwtToken, mac);
|
|
74
68
|
console.log("Device Info:", deviceInfo.data);
|
|
75
69
|
}));
|
|
@@ -79,7 +73,7 @@ const main = () => {
|
|
|
79
73
|
const program = createProgram();
|
|
80
74
|
program.parse(process.argv);
|
|
81
75
|
};
|
|
82
|
-
exports.main = main;
|
|
83
76
|
if (require.main === module) {
|
|
84
77
|
main();
|
|
85
78
|
}
|
|
79
|
+
export { main };
|
|
@@ -1,37 +1,3 @@
|
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -41,22 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
41
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
8
|
});
|
|
43
9
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const assert_1 = require("assert");
|
|
50
|
-
const aws_amplify_1 = require("aws-amplify");
|
|
51
|
-
const amplifyAuth = __importStar(require("aws-amplify/auth"));
|
|
52
|
-
const axios_1 = __importDefault(require("axios"));
|
|
53
|
-
const constants_1 = require("./constants");
|
|
10
|
+
import { strict as assert } from "assert";
|
|
11
|
+
import { Amplify } from "aws-amplify";
|
|
12
|
+
import * as amplifyAuth from "aws-amplify/auth";
|
|
13
|
+
import axios from "axios";
|
|
14
|
+
import { API_URL } from "./constants";
|
|
54
15
|
const amplifyconfiguration = {
|
|
55
16
|
aws_project_region: "eu-central-1",
|
|
56
17
|
aws_user_pools_id: "eu-central-1_BYmQ2VBlo",
|
|
57
18
|
aws_user_pools_web_client_id: "7sc1qltkqobo3ddqsk4542dg2h",
|
|
58
19
|
};
|
|
59
|
-
|
|
20
|
+
Amplify.configure(amplifyconfiguration);
|
|
60
21
|
const headers = (jwtToken) => ({ Authorization: `Bearer ${jwtToken}` });
|
|
61
22
|
/**
|
|
62
23
|
* Sign in to return the JWT token.
|
|
@@ -65,16 +26,15 @@ const signIn = (username, password) => __awaiter(void 0, void 0, void 0, functio
|
|
|
65
26
|
// in case the user is already signed in, refs:
|
|
66
27
|
// https://github.com/aws-amplify/amplify-js/issues/13813
|
|
67
28
|
yield amplifyAuth.signOut();
|
|
68
|
-
const { isSignedIn
|
|
29
|
+
const { isSignedIn } = yield amplifyAuth.signIn({
|
|
69
30
|
username,
|
|
70
31
|
password,
|
|
71
32
|
});
|
|
72
|
-
|
|
33
|
+
assert.ok(isSignedIn);
|
|
73
34
|
const { tokens } = yield amplifyAuth.fetchAuthSession();
|
|
74
|
-
|
|
35
|
+
assert.ok(tokens);
|
|
75
36
|
return tokens.accessToken.toString();
|
|
76
37
|
});
|
|
77
|
-
exports.signIn = signIn;
|
|
78
38
|
const deviceInfo = (axiosInstance) => (jwtToken, macAddress) => axiosInstance.get(`device/${macAddress}/info`, {
|
|
79
39
|
headers: headers(jwtToken),
|
|
80
40
|
});
|
|
@@ -82,8 +42,8 @@ const mqttCommand = (axiosInstance) => (jwtToken, macAddress, payload) => axiosI
|
|
|
82
42
|
const setPower = (axiosInstance) => (jwtToken, macAddress, value) => mqttCommand(axiosInstance)(jwtToken, macAddress, { name: "power", value });
|
|
83
43
|
const setPowerOn = (axiosInstance) => (jwtToken, macAddress) => setPower(axiosInstance)(jwtToken, macAddress, 1);
|
|
84
44
|
const setPowerOff = (axiosInstance) => (jwtToken, macAddress) => setPower(axiosInstance)(jwtToken, macAddress, 0);
|
|
85
|
-
const configure = (baseURL =
|
|
86
|
-
const axiosInstance =
|
|
45
|
+
const configure = (baseURL = API_URL) => {
|
|
46
|
+
const axiosInstance = axios.create({ baseURL });
|
|
87
47
|
const deviceInfoInstance = deviceInfo(axiosInstance);
|
|
88
48
|
const setPowerInstance = setPower(axiosInstance);
|
|
89
49
|
const setPowerOffInstance = setPowerOff(axiosInstance);
|
|
@@ -95,5 +55,4 @@ const configure = (baseURL = constants_1.API_URL) => {
|
|
|
95
55
|
setPowerOn: setPowerOnInstance,
|
|
96
56
|
};
|
|
97
57
|
};
|
|
98
|
-
|
|
99
|
-
const defaultApi = configure();
|
|
58
|
+
export { signIn, configure };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,32 +7,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const assert_1 = require("assert");
|
|
16
|
-
const sinon_1 = __importDefault(require("sinon"));
|
|
17
|
-
const axios_1 = __importDefault(require("axios"));
|
|
18
|
-
const library_1 = require("../src/library");
|
|
10
|
+
import { strict as assert } from "assert";
|
|
11
|
+
import sinon from "sinon";
|
|
12
|
+
import axios from "axios";
|
|
13
|
+
import { configure } from "../src/library";
|
|
19
14
|
describe("library", () => {
|
|
20
15
|
let axiosStub;
|
|
21
16
|
beforeEach(() => {
|
|
22
|
-
axiosStub =
|
|
23
|
-
get:
|
|
24
|
-
put:
|
|
17
|
+
axiosStub = sinon.stub(axios, "create").returns({
|
|
18
|
+
get: sinon.stub(),
|
|
19
|
+
put: sinon.stub(),
|
|
25
20
|
});
|
|
26
21
|
});
|
|
27
22
|
afterEach(() => {
|
|
28
|
-
|
|
23
|
+
sinon.restore();
|
|
29
24
|
});
|
|
30
25
|
describe("configure", () => {
|
|
31
26
|
it("should create API methods with the correct baseURL", () => {
|
|
32
27
|
const baseURL = "https://example.com/api";
|
|
33
|
-
const api =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
const api = configure(baseURL);
|
|
29
|
+
assert.ok(axiosStub.calledOnce);
|
|
30
|
+
assert.deepEqual(axiosStub.firstCall.args[0], { baseURL });
|
|
31
|
+
assert.deepEqual(Object.keys(api), [
|
|
37
32
|
"deviceInfo",
|
|
38
33
|
"setPower",
|
|
39
34
|
"setPowerOff",
|
|
@@ -44,38 +39,38 @@ describe("library", () => {
|
|
|
44
39
|
describe("API Methods", () => {
|
|
45
40
|
it("should call axios for deviceInfo", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
41
|
const mockAxios = {
|
|
47
|
-
get:
|
|
42
|
+
get: sinon
|
|
48
43
|
.stub()
|
|
49
44
|
.resolves({ data: { id: "123", name: "Mock Device" } }),
|
|
50
45
|
};
|
|
51
46
|
axiosStub.returns(mockAxios);
|
|
52
|
-
const api =
|
|
47
|
+
const api = configure("https://example.com/api");
|
|
53
48
|
const result = yield api.deviceInfo("mockToken", "mockMacAddress");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
assert.ok(mockAxios.get.calledOnce);
|
|
50
|
+
assert.equal(mockAxios.get.firstCall.args[0], "device/mockMacAddress/info");
|
|
51
|
+
assert.deepEqual(mockAxios.get.firstCall.args[1], {
|
|
57
52
|
headers: { Authorization: "Bearer mockToken" },
|
|
58
53
|
});
|
|
59
|
-
|
|
54
|
+
assert.deepEqual(result.data, { id: "123", name: "Mock Device" });
|
|
60
55
|
}));
|
|
61
56
|
it("should call axios for setPowerOn", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
57
|
const mockAxios = {
|
|
63
|
-
put:
|
|
58
|
+
put: sinon.stub().resolves({ status: 200 }),
|
|
64
59
|
};
|
|
65
60
|
axiosStub.returns(mockAxios);
|
|
66
|
-
const api =
|
|
61
|
+
const api = configure("https://example.com/api");
|
|
67
62
|
const result = yield api.setPowerOn("mockToken", "mockMacAddress");
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
assert.ok(mockAxios.put.calledOnce);
|
|
64
|
+
assert.equal(mockAxios.put.firstCall.args[0], "mqtt/command");
|
|
65
|
+
assert.deepEqual(mockAxios.put.firstCall.args[1], {
|
|
71
66
|
mac_address: "mockMacAddress",
|
|
72
67
|
name: "power",
|
|
73
68
|
value: 1,
|
|
74
69
|
});
|
|
75
|
-
|
|
70
|
+
assert.deepEqual(mockAxios.put.firstCall.args[2], {
|
|
76
71
|
headers: { Authorization: "Bearer mockToken" },
|
|
77
72
|
});
|
|
78
|
-
|
|
73
|
+
assert.equal(result.status, 200);
|
|
79
74
|
}));
|
|
80
75
|
});
|
|
81
76
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edilkamin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
9
|
"cli": "ts-node src/cli.ts",
|
|
9
10
|
"cli:debug": "node --inspect --require ts-node/register/transpile-only src/cli.ts",
|
|
10
11
|
"test": "mocha --require ts-node/register src/*.test.ts",
|
|
11
12
|
"test:debug": "mocha --require ts-node/register/transpile-only --inspect src/*.test.ts",
|
|
12
|
-
"lint": "prettier --check src docs .github *.md",
|
|
13
|
-
"format": "prettier --write src docs .github *.md",
|
|
14
|
-
"build": "tsc"
|
|
13
|
+
"lint": "prettier --check src docs .github *.md *.json",
|
|
14
|
+
"format": "prettier --write src docs .github *.md *.json",
|
|
15
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
16
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
17
|
+
"build": "npm run build:cjs && npm run build:esm"
|
|
15
18
|
},
|
|
16
19
|
"repository": {
|
|
17
20
|
"type": "git",
|
|
@@ -24,7 +27,7 @@
|
|
|
24
27
|
},
|
|
25
28
|
"homepage": "https://github.com/AndreMiras/edilkamin.js#readme",
|
|
26
29
|
"bin": {
|
|
27
|
-
"edilkamin": "dist/cli.js"
|
|
30
|
+
"edilkamin": "dist/cjs/cli.js"
|
|
28
31
|
},
|
|
29
32
|
"dependencies": {
|
|
30
33
|
"aws-amplify": "^6.10.0",
|
package/src/library.test.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { strict as assert } from "assert";
|
|
2
2
|
import sinon from "sinon";
|
|
3
|
-
import { Amplify } from "aws-amplify";
|
|
4
3
|
import axios from "axios";
|
|
5
|
-
import {
|
|
4
|
+
import { configure } from "../src/library";
|
|
6
5
|
|
|
7
6
|
describe("library", () => {
|
|
8
7
|
let axiosStub: sinon.SinonStub;
|
package/src/library.ts
CHANGED
|
@@ -21,7 +21,7 @@ const signIn = async (username: string, password: string): Promise<string> => {
|
|
|
21
21
|
// in case the user is already signed in, refs:
|
|
22
22
|
// https://github.com/aws-amplify/amplify-js/issues/13813
|
|
23
23
|
await amplifyAuth.signOut();
|
|
24
|
-
const { isSignedIn
|
|
24
|
+
const { isSignedIn } = await amplifyAuth.signIn({
|
|
25
25
|
username,
|
|
26
26
|
password,
|
|
27
27
|
});
|
|
@@ -72,6 +72,4 @@ const configure = (baseURL: string = API_URL) => {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
const defaultApi = configure();
|
|
76
|
-
|
|
77
75
|
export { signIn, configure };
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"target": "
|
|
5
|
-
"
|
|
6
|
-
"outDir": "
|
|
3
|
+
"target": "es6",
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"outDir": "dist",
|
|
7
7
|
"rootDir": "src",
|
|
8
8
|
"strict": true,
|
|
9
|
+
"declaration": true,
|
|
9
10
|
"esModuleInterop": true,
|
|
10
11
|
"resolveJsonModule": true,
|
|
12
|
+
"noUnusedLocals": true,
|
|
13
|
+
"noUnusedParameters": true,
|
|
11
14
|
"preserveConstEnums": true
|
|
12
15
|
},
|
|
13
|
-
"include": [
|
|
14
|
-
"src/**/*.ts"
|
|
15
|
-
]
|
|
16
|
+
"include": ["src/**/*.ts"]
|
|
16
17
|
}
|
package/dist/constants.js
DELETED
package/dist/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.setPowerOn = exports.setPowerOff = exports.setPower = exports.deviceInfo = exports.configure = exports.signIn = exports.API_URL = void 0;
|
|
5
|
-
const library_1 = require("./library");
|
|
6
|
-
var constants_1 = require("./constants");
|
|
7
|
-
Object.defineProperty(exports, "API_URL", { enumerable: true, get: function () { return constants_1.API_URL; } });
|
|
8
|
-
var library_2 = require("./library");
|
|
9
|
-
Object.defineProperty(exports, "signIn", { enumerable: true, get: function () { return library_2.signIn; } });
|
|
10
|
-
Object.defineProperty(exports, "configure", { enumerable: true, get: function () { return library_2.configure; } });
|
|
11
|
-
_a = (0, library_1.configure)(), exports.deviceInfo = _a.deviceInfo, exports.setPower = _a.setPower, exports.setPowerOff = _a.setPowerOff, exports.setPowerOn = _a.setPowerOn;
|
package/dist/types.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|