Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOISSUE - Fix Linter #93

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-rabbits-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@absmach/magistrala-sdk": patch
---

update linter
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
coverage/
23 changes: 22 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
{}
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["airbnb-base", "airbnb-typescript/base"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/quotes": [2, "double", "avoid-escape"],
"@typescript-eslint/comma-dangle": "off",
"no-useless-catch": "off",
"max-len": "off",
"no-console": "off",
"object-curly-newline": "off"
}
}
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ jobs:
- name: Run Jest tests
run: npm test -- --passWithNoTests

- name: Lint with ESLint
run: npm run lint
2 changes: 1 addition & 1 deletion bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ require = (function () {
// return fetch(url , options)
// .then((response) => {
// if (!response.ok) {
// return this.userError.HandleError(this.userError.errors, response.status);
// return Errors.HandleError(this.userError.errors, response.status);
// // throw new Error(`HTTP error! Status: ${response.status}`);
// }
// return response.json();
Expand Down
140 changes: 73 additions & 67 deletions examples/bootstrap.ts
Original file line number Diff line number Diff line change
@@ -1,142 +1,148 @@
import SDK from '../src/sdk'
import SDK from "../src/sdk";

const defaultUrl = 'http://localhost'
const defaultUrl = "http://localhost";

const mySdk = new SDK({
bootstrapUrl: defaultUrl + ':9013'
})
bootstrapUrl: `${defaultUrl}:9013`,
});

const token = '<token>'
const domainId = '<domainId>'
const token = "<token>";
const domainId = "<domainId>";

mySdk.bootstrap.AddBootstrap(
{
external_id: '<externalId>',
external_key: 'externalKey',
thing_id: '<thingId>',
name: '<bootstrapName>'
external_id: "<externalId>",
external_key: "externalKey",
thing_id: "<thingId>",
name: "<bootstrapName>",
},
domainId,
token
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.Whitelist(
{
external_id: '<externalId>',
external_key: '<externalKey>',
thing_id: '<thingId>',
name: '<bootstrapName>'
external_id: "<externalId>",
external_key: "<externalKey>",
thing_id: "<thingId>",
name: "<bootstrapName>",
},
domainId,
token)
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.UpdateBootstrap(
{
name: 'Bootstrap1',
thing_id: '<thingId>'
name: "Bootstrap1",
thing_id: "<thingId>",
},
domainId,
token)
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.ViewBootstrap(
'<thingId>',
"<thingId>",
domainId,
token)
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.UpdateBootstrapCerts(
{
thing_id: '<thingId>',
client_cert: '<clientCert>',
client_key: '<clientKey>',
ca_cert: '<caCert>'
thing_id: "<thingId>",
client_cert: "<clientCert>",
client_key: "<clientKey>",
ca_cert: "<caCert>",
},
domainId,
token
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.RemoveBootstrap(
'<thingId>',
"<thingId>",
domainId,
token)
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.Bootstrap(
'externalId',
'externalKey'
"externalId",
"externalKey",
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.Bootstraps(
{ offset: 0, limit: 10 },
domainId,
token
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.UpdateBootstrapConnection(
'<thingId>',
"<thingId>",
domainId,
['<channelId>', '<channelId2>'],
token)
["<channelId>", "<channelId2>"],
token,
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.bootstrap.SecureBootstrap(
'<externalId>',
'<externalKey>',
'<cryptoKey>')
"<externalId>",
"<externalKey>",
"<cryptoKey>",
)
.then((response: any) => {
console.log('response:', response)
console.log("response:", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});
54 changes: 27 additions & 27 deletions examples/certs.ts
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
import SDK from '../src/sdk'
import SDK from "../src/sdk";

const defaultUrl = 'http://localhost'
const defaultUrl = "http://localhost";

const mySdk = new SDK({
certsUrl: defaultUrl + ':9019'
})
certsUrl: `${defaultUrl}:9019`,
});

const token = '<token>'
const domainId = '<domainId>'
const token = "<token>";
const domainId = "<domainId>";

mySdk.certs
.IssueCert(
'<thingID>',
'<valid>',
"<thingID>",
"<valid>",
domainId,
token
token,
)
.then((response: any) => {
console.log('response: ', response)
console.log("response: ", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.certs
.ViewCertByThing(
'<thingID>',
"<thingID>",
domainId,
token
token,
)
.then((response: any) => {
console.log('response: ', response)
console.log("response: ", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.certs
.ViewCert(
'<certID>',
"<certID>",
domainId,
token
token,
)
.then((response: any) => {
console.log('response: ', response)
console.log("response: ", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});

mySdk.certs
.RevokeCert(
'<thingID>',
"<thingID>",
domainId,
token
token,
)
.then((response: any) => {
console.log('response: ', response)
console.log("response: ", response);
})
.catch((error) => {
console.log(error)
})
console.log(error);
});
Loading
Loading