@uniformdev/mesh-sdk 19.79.1-alpha.11 → 19.79.1-alpha.18
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/LICENSE.txt +1 -1
- package/dist/index.d.mts +199 -139
- package/dist/index.d.ts +199 -139
- package/dist/index.esm.js +18 -16
- package/dist/index.js +20 -16
- package/dist/index.mjs +18 -16
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ var src_exports = {};
|
|
|
45
45
|
__export(src_exports, {
|
|
46
46
|
IntegrationDefinitionClient: () => IntegrationDefinitionClient,
|
|
47
47
|
IntegrationInstallationClient: () => IntegrationInstallationClient,
|
|
48
|
+
hasPermissions: () => hasPermissions,
|
|
49
|
+
hasRole: () => hasRole,
|
|
48
50
|
initializeUniformMeshSDK: () => initializeUniformMeshSDK
|
|
49
51
|
});
|
|
50
52
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -517,10 +519,6 @@ async function connectToParent({
|
|
|
517
519
|
await client.request("setValue", value);
|
|
518
520
|
},
|
|
519
521
|
openDialog: async (message) => {
|
|
520
|
-
var _a;
|
|
521
|
-
if (getByteSize((_a = message.options) == null ? void 0 : _a.params) > 1e5) {
|
|
522
|
-
throw new Error(`Dialog parameters object is too large, maximum size is 100KB`);
|
|
523
|
-
}
|
|
524
522
|
const res = await client.request(
|
|
525
523
|
"openDialog",
|
|
526
524
|
message
|
|
@@ -556,18 +554,6 @@ async function connectToParent({
|
|
|
556
554
|
}
|
|
557
555
|
};
|
|
558
556
|
}
|
|
559
|
-
function getByteSize(val) {
|
|
560
|
-
if (!val || typeof Blob === "undefined") {
|
|
561
|
-
return 0;
|
|
562
|
-
}
|
|
563
|
-
try {
|
|
564
|
-
const serialized = JSON.stringify(val);
|
|
565
|
-
const size = new Blob([serialized]).size;
|
|
566
|
-
return size;
|
|
567
|
-
} catch (error) {
|
|
568
|
-
throw new Error("Error calculating object size: " + error.message);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
557
|
|
|
572
558
|
// src/sdkWindow.ts
|
|
573
559
|
var import_imagesloaded = __toESM(require("imagesloaded"));
|
|
@@ -838,9 +824,27 @@ async function initializeUniformMeshSDK({
|
|
|
838
824
|
return sdk;
|
|
839
825
|
}
|
|
840
826
|
}
|
|
827
|
+
|
|
828
|
+
// src/user.ts
|
|
829
|
+
var hasPermissions = (permissions, user) => {
|
|
830
|
+
if (user.isAdmin)
|
|
831
|
+
return true;
|
|
832
|
+
if (Array.isArray(permissions)) {
|
|
833
|
+
return permissions.every((permission) => user.permissions.includes(permission));
|
|
834
|
+
} else {
|
|
835
|
+
return user.permissions.includes(permissions);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
var hasRole = (role, user) => {
|
|
839
|
+
if (user.isAdmin)
|
|
840
|
+
return true;
|
|
841
|
+
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
842
|
+
};
|
|
841
843
|
// Annotate the CommonJS export names for ESM import in node:
|
|
842
844
|
0 && (module.exports = {
|
|
843
845
|
IntegrationDefinitionClient,
|
|
844
846
|
IntegrationInstallationClient,
|
|
847
|
+
hasPermissions,
|
|
848
|
+
hasRole,
|
|
845
849
|
initializeUniformMeshSDK
|
|
846
850
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -480,10 +480,6 @@ async function connectToParent({
|
|
|
480
480
|
await client.request("setValue", value);
|
|
481
481
|
},
|
|
482
482
|
openDialog: async (message) => {
|
|
483
|
-
var _a;
|
|
484
|
-
if (getByteSize((_a = message.options) == null ? void 0 : _a.params) > 1e5) {
|
|
485
|
-
throw new Error(`Dialog parameters object is too large, maximum size is 100KB`);
|
|
486
|
-
}
|
|
487
483
|
const res = await client.request(
|
|
488
484
|
"openDialog",
|
|
489
485
|
message
|
|
@@ -519,18 +515,6 @@ async function connectToParent({
|
|
|
519
515
|
}
|
|
520
516
|
};
|
|
521
517
|
}
|
|
522
|
-
function getByteSize(val) {
|
|
523
|
-
if (!val || typeof Blob === "undefined") {
|
|
524
|
-
return 0;
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
const serialized = JSON.stringify(val);
|
|
528
|
-
const size = new Blob([serialized]).size;
|
|
529
|
-
return size;
|
|
530
|
-
} catch (error) {
|
|
531
|
-
throw new Error("Error calculating object size: " + error.message);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
518
|
|
|
535
519
|
// src/sdkWindow.ts
|
|
536
520
|
import imagesLoaded from "imagesloaded";
|
|
@@ -801,8 +785,26 @@ async function initializeUniformMeshSDK({
|
|
|
801
785
|
return sdk;
|
|
802
786
|
}
|
|
803
787
|
}
|
|
788
|
+
|
|
789
|
+
// src/user.ts
|
|
790
|
+
var hasPermissions = (permissions, user) => {
|
|
791
|
+
if (user.isAdmin)
|
|
792
|
+
return true;
|
|
793
|
+
if (Array.isArray(permissions)) {
|
|
794
|
+
return permissions.every((permission) => user.permissions.includes(permission));
|
|
795
|
+
} else {
|
|
796
|
+
return user.permissions.includes(permissions);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
var hasRole = (role, user) => {
|
|
800
|
+
if (user.isAdmin)
|
|
801
|
+
return true;
|
|
802
|
+
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
803
|
+
};
|
|
804
804
|
export {
|
|
805
805
|
IntegrationDefinitionClient,
|
|
806
806
|
IntegrationInstallationClient,
|
|
807
|
+
hasPermissions,
|
|
808
|
+
hasRole,
|
|
807
809
|
initializeUniformMeshSDK
|
|
808
810
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk",
|
|
3
|
-
"version": "19.79.1-alpha.
|
|
3
|
+
"version": "19.79.1-alpha.18+12234b9350",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/canvas": "19.79.1-alpha.
|
|
37
|
-
"@uniformdev/context": "19.79.1-alpha.
|
|
38
|
-
"@uniformdev/project-map": "19.79.1-alpha.
|
|
36
|
+
"@uniformdev/canvas": "19.79.1-alpha.18+12234b9350",
|
|
37
|
+
"@uniformdev/context": "19.79.1-alpha.18+12234b9350",
|
|
38
|
+
"@uniformdev/project-map": "19.79.1-alpha.18+12234b9350",
|
|
39
39
|
"imagesloaded": "^5.0.0",
|
|
40
40
|
"mitt": "^3.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/imagesloaded": "^4.1.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "12234b9350cfa4209bc7e242701d2dc535ece19e"
|
|
46
46
|
}
|