@dimo-network/data-sdk 1.2.3 → 1.2.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/README.jp.md +86 -0
- package/README.md +60 -47
- package/README.zh-tw.md +86 -0
- package/dist/api/functions/{getToken.d.ts → getDeveloperJwt.d.ts} +1 -1
- package/dist/api/functions/{getToken.js → getDeveloperJwt.js} +1 -1
- package/dist/api/functions/getVehicleJwt.d.ts +7 -0
- package/dist/api/functions/getVehicleJwt.js +23 -0
- package/dist/api/functions/index.d.ts +3 -2
- package/dist/api/functions/index.js +3 -2
- package/dist/api/resources/Auth/index.js +2 -2
- package/dist/api/resources/TokenExchange/index.js +4 -0
- package/dist/constants.d.ts +4 -1
- package/dist/constants.js +3 -0
- package/dist/dimo.js +1 -1
- package/dist/environments/index.d.ts +0 -6
- package/dist/environments/index.js +0 -6
- package/dist/graphql/Query.js +7 -8
- package/dist/graphql/functions/getVehiclePrivileges.d.ts +6 -0
- package/dist/graphql/functions/getVehiclePrivileges.js +46 -0
- package/dist/graphql/functions/index.d.ts +2 -1
- package/dist/graphql/functions/index.js +2 -1
- package/dist/graphql/resources/Identity/index.d.ts +0 -1
- package/dist/graphql/resources/Identity/index.js +53 -78
- package/dist/graphql/util/paginate.d.ts +9 -0
- package/dist/graphql/util/paginate.js +37 -0
- package/dist/index.cjs +1624 -293
- package/dist/util/decodeJwt.d.ts +1 -0
- package/dist/util/decodeJwt.js +11 -0
- package/dist/util/decodePermissions.d.ts +1 -0
- package/dist/util/decodePermissions.js +12 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/index.js +7 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decodeJwt: (token: string) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decodePermissions: (permissionHex: string) => number[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const decodePermissions = (permissionHex) => {
|
|
2
|
+
const cleanHex = permissionHex.toLowerCase().replace("0x", "");
|
|
3
|
+
const permissionBits = BigInt("0x" + cleanHex);
|
|
4
|
+
const grantedPermissions = [];
|
|
5
|
+
for (let i = 0; i < 128; i++) {
|
|
6
|
+
const bitPair = (permissionBits >> BigInt(i * 2)) & BigInt(0b11);
|
|
7
|
+
if (bitPair === BigInt(0b11)) {
|
|
8
|
+
grantedPermissions.push(i);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return grantedPermissions;
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { decodeJwt } from './decodeJwt';
|
|
2
|
+
import { decodePermissions } from './decodePermissions';
|
|
3
|
+
export { decodeJwt, decodePermissions };
|
|
4
|
+
declare const _default: {
|
|
5
|
+
decodeJwt: (token: string) => any;
|
|
6
|
+
decodePermissions: (permissionHex: string) => number[];
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimo-network/data-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "DIMO Data SDK for JavaScript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "James Li",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"fs": "^0.0.1-security",
|
|
34
|
+
"jwt-decode": "^4.0.0",
|
|
34
35
|
"rxjs": "^7.8.1",
|
|
35
36
|
"web3": "^4.6.0"
|
|
36
37
|
},
|
|
@@ -52,5 +53,8 @@
|
|
|
52
53
|
"ts-jest": "^29.1.4",
|
|
53
54
|
"typescript": "^5.4.5"
|
|
54
55
|
},
|
|
56
|
+
"optionalDependencies": {
|
|
57
|
+
"@rollup/rollup-linux-x64-gnu": "*"
|
|
58
|
+
},
|
|
55
59
|
"types": "./dist/index.d.ts"
|
|
56
60
|
}
|