@gudhub/core 1.1.121 → 1.1.122
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.
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
export class GroupInvitation {
|
|
2
2
|
constructor(gudhub, req) {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
this.req = req;
|
|
4
|
+
this.gudhub = gudhub;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
async groupInvitationCreate(sharingGroups, actions) {
|
|
8
8
|
try {
|
|
9
|
-
|
|
10
|
-
sharing_groups: sharingGroups,
|
|
11
|
-
actions,
|
|
12
|
-
token: await this.gudhub.auth.getToken(),
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const groupInvitation = await this.req.post({
|
|
9
|
+
return await this.req.post({
|
|
16
10
|
url: "/api/invitation/create",
|
|
17
|
-
form
|
|
11
|
+
form: {
|
|
12
|
+
sharing_groups: sharingGroups,
|
|
13
|
+
actions
|
|
14
|
+
}
|
|
18
15
|
});
|
|
19
|
-
|
|
20
|
-
return groupInvitation;
|
|
21
16
|
} catch (err) {
|
|
22
17
|
console.log(err);
|
|
23
18
|
return null;
|
|
@@ -26,16 +21,12 @@ export class GroupInvitation {
|
|
|
26
21
|
|
|
27
22
|
async groupInvitationGet(invitationId) {
|
|
28
23
|
try {
|
|
29
|
-
|
|
30
|
-
invitation_id: invitationId
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const groupInvitation = await this.req.post({
|
|
24
|
+
return await this.req.get({
|
|
34
25
|
url: "/api/invitation/get",
|
|
35
|
-
|
|
26
|
+
params: {
|
|
27
|
+
invitation_id: invitationId
|
|
28
|
+
}
|
|
36
29
|
});
|
|
37
|
-
|
|
38
|
-
return groupInvitation;
|
|
39
30
|
} catch (err) {
|
|
40
31
|
console.log(err);
|
|
41
32
|
return null;
|
|
@@ -44,16 +35,12 @@ export class GroupInvitation {
|
|
|
44
35
|
|
|
45
36
|
async groupInvitationAccept(invitationId) {
|
|
46
37
|
try {
|
|
47
|
-
|
|
48
|
-
invitation_id: invitationId
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const groupInvitation = await this.req.post({
|
|
38
|
+
return await this.req.get({
|
|
52
39
|
url: "/api/invitation/accept",
|
|
53
|
-
|
|
40
|
+
params: {
|
|
41
|
+
invitation_id: invitationId
|
|
42
|
+
}
|
|
54
43
|
});
|
|
55
|
-
|
|
56
|
-
return groupInvitation;
|
|
57
44
|
} catch (err) {
|
|
58
45
|
console.log(err);
|
|
59
46
|
return null;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// import should from "should";
|
|
2
1
|
import sinon from "sinon";
|
|
3
2
|
import { GroupInvitation } from "../GUDHUB/Utils/sharing/GroupInvitation.js";
|
|
4
3
|
|
|
5
4
|
describe("Invitation API", function () {
|
|
6
|
-
const token = "fgdr5rfd4e5hsjkdrkdemdxm6re5erl";
|
|
7
|
-
|
|
8
5
|
let gudhub;
|
|
9
6
|
let req;
|
|
10
7
|
let api;
|
|
@@ -12,12 +9,13 @@ describe("Invitation API", function () {
|
|
|
12
9
|
beforeEach(() => {
|
|
13
10
|
gudhub = {
|
|
14
11
|
auth: {
|
|
15
|
-
getToken: sinon.stub().resolves(
|
|
12
|
+
getToken: sinon.stub().resolves("fgdr5rfd4e5hsjkdrkdemdxm6re5erl")
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
15
|
|
|
19
16
|
req = {
|
|
20
|
-
post: sinon.stub()
|
|
17
|
+
post: sinon.stub(),
|
|
18
|
+
get: sinon.stub()
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
api = new GroupInvitation(gudhub, req);
|
|
@@ -48,21 +46,23 @@ describe("Invitation API", function () {
|
|
|
48
46
|
result.should.have.property("invitation_id", "r5fh587guj7r");
|
|
49
47
|
result.should.have.property("invitation_status", 0);
|
|
50
48
|
|
|
51
|
-
gudhub.auth.getToken.calledOnce.should.be.true();
|
|
52
49
|
req.post.calledOnce.should.be.true();
|
|
50
|
+
req.get.called.should.be.false();
|
|
53
51
|
|
|
54
52
|
const arg = req.post.firstCall.args[0];
|
|
55
53
|
arg.should.have.property("url", "/api/invitation/create");
|
|
56
54
|
arg.should.have.property("form");
|
|
57
|
-
arg.form.
|
|
55
|
+
arg.form.should.not.have.property("token");
|
|
58
56
|
arg.form.sharing_groups.should.eql(sharingGroups);
|
|
59
57
|
arg.form.actions.should.eql(actions);
|
|
58
|
+
|
|
59
|
+
gudhub.auth.getToken.called.should.be.false();
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it("groupInvitationGet should return full invitation structure", async function () {
|
|
63
63
|
const invitationId = "lknvzl3266bkjbkb";
|
|
64
64
|
|
|
65
|
-
req.
|
|
65
|
+
req.get.resolves({
|
|
66
66
|
invitation_id: invitationId,
|
|
67
67
|
invitation_status: 0,
|
|
68
68
|
Inviter_user: {
|
|
@@ -85,18 +85,19 @@ describe("Invitation API", function () {
|
|
|
85
85
|
result.Inviter_user.should.have.property("fullname", "Andrii Atlas");
|
|
86
86
|
result.sharing_groups.should.be.Array();
|
|
87
87
|
|
|
88
|
-
req.
|
|
88
|
+
req.get.calledOnce.should.be.true();
|
|
89
|
+
req.post.called.should.be.false();
|
|
89
90
|
|
|
90
|
-
const arg = req.
|
|
91
|
+
const arg = req.get.firstCall.args[0];
|
|
91
92
|
arg.should.have.property("url", "/api/invitation/get");
|
|
92
|
-
arg.should.have.property("
|
|
93
|
-
arg.
|
|
93
|
+
arg.should.have.property("params");
|
|
94
|
+
arg.params.invitation_id.should.equal(invitationId);
|
|
94
95
|
});
|
|
95
96
|
|
|
96
97
|
it("groupInvitationAccept should send invitation id and return accepted status", async function () {
|
|
97
98
|
const invitationId = "lknvzl3266bkjbkb";
|
|
98
99
|
|
|
99
|
-
req.
|
|
100
|
+
req.get.resolves({
|
|
100
101
|
invitation_id: invitationId,
|
|
101
102
|
invitation_status: 1
|
|
102
103
|
});
|
|
@@ -106,11 +107,12 @@ describe("Invitation API", function () {
|
|
|
106
107
|
result.should.have.property("invitation_id", invitationId);
|
|
107
108
|
result.should.have.property("invitation_status", 1);
|
|
108
109
|
|
|
109
|
-
req.
|
|
110
|
+
req.get.calledOnce.should.be.true();
|
|
111
|
+
req.post.called.should.be.false();
|
|
110
112
|
|
|
111
|
-
const arg = req.
|
|
113
|
+
const arg = req.get.firstCall.args[0];
|
|
112
114
|
arg.should.have.property("url", "/api/invitation/accept");
|
|
113
|
-
arg.should.have.property("
|
|
114
|
-
arg.
|
|
115
|
+
arg.should.have.property("params");
|
|
116
|
+
arg.params.invitation_id.should.equal(invitationId);
|
|
115
117
|
});
|
|
116
|
-
});
|
|
118
|
+
});
|
|
@@ -206,8 +206,8 @@ export default function (app) {
|
|
|
206
206
|
});
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
app.
|
|
210
|
-
const { invitation_id } = req.
|
|
209
|
+
app.get('/api/invitation/get', (req, res) => {
|
|
210
|
+
const { invitation_id } = req.query;
|
|
211
211
|
|
|
212
212
|
if (!invitation_id) {
|
|
213
213
|
return res.status(400).json({ error: "Missing invitation_id" });
|
|
@@ -216,26 +216,26 @@ export default function (app) {
|
|
|
216
216
|
res.status(200).json({
|
|
217
217
|
invitation_id,
|
|
218
218
|
invitation_status: 0,
|
|
219
|
-
|
|
219
|
+
inviter_user: {
|
|
220
220
|
fullname: "Andrii Atlas",
|
|
221
221
|
avatar_128: "https://gudhub.com/avatars/22_2289_128.jpg",
|
|
222
222
|
avatar_512: "https://gudhub.com/avatars/22_2289_512.jpg"
|
|
223
223
|
},
|
|
224
224
|
sharing_groups: [
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
{
|
|
226
|
+
group_name: "3D Rendering Team",
|
|
227
|
+
group_permission: 1
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
group_name: "Design Team",
|
|
231
|
+
group_permission: 2
|
|
232
|
+
}
|
|
233
233
|
]
|
|
234
234
|
});
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
-
app.
|
|
238
|
-
const { invitation_id } = req.
|
|
237
|
+
app.get('/api/invitation/accept', (req, res) => {
|
|
238
|
+
const { invitation_id } = req.query;
|
|
239
239
|
|
|
240
240
|
if (!invitation_id) {
|
|
241
241
|
return res.status(400).json({ error: "Missing invitation_id" });
|
package/package.json
CHANGED
package/umd/library.min.js
CHANGED
|
@@ -339,7 +339,7 @@ var t=arguments[3];Object.defineProperty(exports,"__esModule",{value:!0}),export
|
|
|
339
339
|
},{}],"LS0j":[function(require,module,exports) {
|
|
340
340
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GroupSharing=void 0;var r=require("../groupManager/GroupManager.js"),e=require("./AppGroupSharing.js");function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}function n(){var r,e,t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function p(t,n,u,i){var p=n&&n.prototype instanceof c?n:c,s=Object.create(p.prototype);return o(s,"_invoke",function(t,n,o){var u,i,p,c=0,s=o||[],f=!1,l={p:0,n:0,v:r,a:y,f:y.bind(r,4),d:function(e,t){return u=e,i=0,p=r,l.n=t,a}};function y(t,n){for(i=t,p=n,e=0;!f&&c&&!o&&e<s.length;e++){var o,u=s[e],y=l.p,g=u[2];t>3?(o=g===n)&&(p=u[(i=u[4])?5:(i=3,3)],u[4]=u[5]=r):u[0]<=y&&((o=t<2&&y<u[1])?(i=0,l.v=n,l.n=u[1]):y<g&&(o=t<3||u[0]>n||n>g)&&(u[4]=t,u[5]=n,l.n=g,i=0))}if(o||t>1)return a;throw f=!0,n}return function(o,s,g){if(c>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,g),i=s,p=g;(e=i<2?r:p)||!f;){u||(i?i<3?(i>1&&(l.n=-1),y(i,p)):l.n=p:l.v=p);try{if(c=2,u){if(i||(o="next"),e=u[o]){if(!(e=e.call(u,p)))throw TypeError("iterator result is not an object");if(!e.done)return e;p=e.value,i<2&&(i=0)}else 1===i&&(e=u.return)&&e.call(u),i<2&&(p=TypeError("The iterator does not provide a '"+o+"' method"),i=1);u=r}else if((e=(f=l.n<0)?p:t.call(n,l))!==a)break}catch(e){u=r,i=1,p=e}finally{c=1}}return{value:e,done:f}}}(t,u,i),!0),s}var a={};function c(){}function s(){}function f(){}e=Object.getPrototypeOf;var l=[][u]?e(e([][u]())):(o(e={},u,function(){return this}),e),y=f.prototype=c.prototype=Object.create(l);function g(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,f):(r.__proto__=f,o(r,i,"GeneratorFunction")),r.prototype=Object.create(y),r}return s.prototype=f,o(y,"constructor",f),o(f,"constructor",s),s.displayName="GeneratorFunction",o(f,i,"GeneratorFunction"),o(y),o(y,i,"Generator"),o(y,u,function(){return this}),o(y,"toString",function(){return"[object Generator]"}),(n=function(){return{w:p,m:g}})()}function o(r,e,t,n){var u=Object.defineProperty;try{u({},"",{})}catch(r){u=0}(o=function(r,e,t,n){function i(e,t){o(r,e,function(r){return this._invoke(e,t,r)})}e?u?u(r,e,{value:t,enumerable:!n,configurable:!n,writable:!n}):r[e]=t:(i("next",0),i("throw",1),i("return",2))})(r,e,t,n)}function u(r,e,t,n,o,u,i){try{var p=r[u](i),a=p.value}catch(r){return void t(r)}p.done?e(a):Promise.resolve(a).then(n,o)}function i(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function p(r){u(i,n,o,p,a,"next",r)}function a(r){u(i,n,o,p,a,"throw",r)}p(void 0)})}}function p(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function a(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,s(n.key),n)}}function c(r,e,t){return e&&a(r.prototype,e),t&&a(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function s(r){var e=f(r,"string");return"symbol"==t(e)?e:e+""}function f(r,e){if("object"!=t(r)||!r)return r;var n=r[Symbol.toPrimitive];if(void 0!==n){var o=n.call(r,e||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}var l=exports.GroupSharing=function(){return c(function t(n,o,u){p(this,t),this.req=o,this.gudhub=n,this.pipeService=u,this.groupManager=new r.GroupManager(n,o),this.appGroupSharing=new e.AppGroupSharing(n,o)},[{key:"createGroup",value:function(r){return this.groupManager.createGroupApi(r)}},{key:"updateGroup",value:function(r,e){return this.groupManager.updateGroupApi(r,e)}},{key:"deleteGroup",value:function(r){return this.groupManager.deleteGroupApi(r)}},{key:"addUserToGroup",value:function(){var r=i(n().m(function r(e,t,o){var u;return n().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this.groupManager.addUserToGroupApi(e,t,o);case 1:return u=r.v,this.pipeService.emit("group_members_add",{app_id:"group_sharing"},u),r.a(2,u)}},r,this)}));return function(e,t,n){return r.apply(this,arguments)}}()},{key:"getUsersByGroup",value:function(r){return this.groupManager.getUsersByGroupApi(r)}},{key:"updateUserInGroup",value:function(){var r=i(n().m(function r(e,t,o){var u;return n().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this.groupManager.updateUserInGroupApi(e,t,o);case 1:return u=r.v,this.pipeService.emit("group_members_update",{app_id:"group_sharing"},u),r.a(2,u)}},r,this)}));return function(e,t,n){return r.apply(this,arguments)}}()},{key:"deleteUserFromGroup",value:function(){var r=i(n().m(function r(e,t){var o;return n().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,this.groupManager.deleteUserFromGroupApi(e,t);case 1:return o=r.v,this.pipeService.emit("group_members_delete",{app_id:"group_sharing"},o),r.a(2,o)}},r,this)}));return function(e,t){return r.apply(this,arguments)}}()},{key:"getGroupsByUser",value:function(r){return this.groupManager.getGroupsByUserApi(r)}},{key:"addAppToGroup",value:function(r,e,t){return this.appGroupSharing.addAppToGroupApi(r,e,t)}},{key:"getAppsByGroup",value:function(r){return this.appGroupSharing.getAppsByGroupApi(r)}},{key:"updateAppInGroup",value:function(r,e,t){return this.appGroupSharing.updateAppInGroupApi(r,e,t)}},{key:"deleteAppFromGroup",value:function(r,e,t){return this.appGroupSharing.deleteAppFromGroupApi(r,e,t)}},{key:"getGroupsByApp",value:function(r){return this.appGroupSharing.getGroupsByAppApi(r)}}])}();
|
|
341
341
|
},{"../groupManager/GroupManager.js":"qJXG","./AppGroupSharing.js":"Z7AV"}],"kPfD":[function(require,module,exports) {
|
|
342
|
-
"use strict";function t(
|
|
342
|
+
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(){var t,e,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.toStringTag||"@@toStringTag";function a(r,o,i,u){var a=o&&o.prototype instanceof f?o:f,p=Object.create(a.prototype);return n(p,"_invoke",function(r,n,o){var i,u,a,f=0,p=o||[],l=!1,s={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(r,n){return i=r,u=0,a=t,s.n=n,c}};function v(r,n){for(u=r,a=n,e=0;!l&&f&&!o&&e<p.length;e++){var o,i=p[e],v=s.p,y=i[2];r>3?(o=y===n)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=v&&((o=r<2&&v<i[1])?(u=0,s.v=n,s.n=i[1]):v<y&&(o=r<3||i[0]>n||n>y)&&(i[4]=r,i[5]=n,s.n=y,u=0))}if(o||r>1)return c;throw l=!0,n}return function(o,p,y){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&v(p,y),u=p,a=y;(e=u<2?t:a)||!l;){i||(u?u<3?(u>1&&(s.n=-1),v(u,a)):s.n=a:s.v=a);try{if(f=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(l=s.n<0)?a:r.call(n,s))!==c)break}catch(e){i=t,u=1,a=e}finally{f=1}}return{value:e,done:l}}}(r,i,u),!0),p}var c={};function f(){}function p(){}function l(){}e=Object.getPrototypeOf;var s=[][i]?e(e([][i]())):(n(e={},i,function(){return this}),e),v=l.prototype=f.prototype=Object.create(s);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,n(t,u,"GeneratorFunction")),t.prototype=Object.create(v),t}return p.prototype=l,n(v,"constructor",l),n(l,"constructor",p),p.displayName="GeneratorFunction",n(l,u,"GeneratorFunction"),n(v),n(v,u,"Generator"),n(v,i,function(){return this}),n(v,"toString",function(){return"[object Generator]"}),(r=function(){return{w:a,m:y}})()}function n(t,r,e,o){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}(n=function(t,r,e,o){function u(r,e){n(t,r,function(t){return this._invoke(r,e,t)})}r?i?i(t,r,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[r]=e:(u("next",0),u("throw",1),u("return",2))})(t,r,e,o)}function e(t,r,n,e,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void n(t)}a.done?r(c):Promise.resolve(c).then(e,o)}function o(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function a(t){e(u,o,i,a,c,"next",t)}function c(t){e(u,o,i,a,c,"throw",t)}a(void 0)})}}function i(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function u(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,c(e.key),e)}}function a(t,r,n){return r&&u(t.prototype,r),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(r){var n=f(r,"string");return"symbol"==t(n)?n:n+""}function f(r,n){if("object"!=t(r)||!r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var o=e.call(r,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.GroupInvitation=void 0;var p=exports.GroupInvitation=function(){return a(function t(r,n){i(this,t),this.req=n,this.gudhub=r},[{key:"groupInvitationCreate",value:function(){var t=o(r().m(function t(n,e){var o;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.post({url:"/api/invitation/create",form:{sharing_groups:n,actions:e}});case 1:return t.a(2,t.v);case 2:return t.p=2,o=t.v,console.log(o),t.a(2,null)}},t,this,[[0,2]])}));return function(r,n){return t.apply(this,arguments)}}()},{key:"groupInvitationGet",value:function(){var t=o(r().m(function t(n){var e;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/invitation/get",params:{invitation_id:n}});case 1:return t.a(2,t.v);case 2:return t.p=2,e=t.v,console.log(e),t.a(2,null)}},t,this,[[0,2]])}));return function(r){return t.apply(this,arguments)}}()},{key:"groupInvitationAccept",value:function(){var t=o(r().m(function t(n){var e;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.req.get({url:"/api/invitation/accept",params:{invitation_id:n}});case 1:return t.a(2,t.v);case 2:return t.p=2,e=t.v,console.log(e),t.a(2,null)}},t,this,[[0,2]])}));return function(r){return t.apply(this,arguments)}}()}])}(),l=exports.default=p;
|
|
343
343
|
},{}],"XaHW":[function(require,module,exports) {
|
|
344
344
|
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(){var t,e,o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",i=o.toStringTag||"@@toStringTag";function a(r,o,u,i){var a=o&&o.prototype instanceof s?o:s,f=Object.create(a.prototype);return n(f,"_invoke",function(r,n,o){var u,i,a,s=0,f=o||[],p=!1,l={p:0,n:0,v:t,a:v,f:v.bind(t,4),d:function(r,n){return u=r,i=0,a=t,l.n=n,c}};function v(r,n){for(i=r,a=n,e=0;!p&&s&&!o&&e<f.length;e++){var o,u=f[e],v=l.p,h=u[2];r>3?(o=h===n)&&(a=u[(i=u[4])?5:(i=3,3)],u[4]=u[5]=t):u[0]<=v&&((o=r<2&&v<u[1])?(i=0,l.v=n,l.n=u[1]):v<h&&(o=r<3||u[0]>n||n>h)&&(u[4]=r,u[5]=n,l.n=h,i=0))}if(o||r>1)return c;throw p=!0,n}return function(o,f,h){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&v(f,h),i=f,a=h;(e=i<2?t:a)||!p;){u||(i?i<3?(i>1&&(l.n=-1),v(i,a)):l.n=a:l.v=a);try{if(s=2,u){if(i||(o="next"),e=u[o]){if(!(e=e.call(u,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,i<2&&(i=0)}else 1===i&&(e=u.return)&&e.call(u),i<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),i=1);u=t}else if((e=(p=l.n<0)?a:r.call(n,l))!==c)break}catch(e){u=t,i=1,a=e}finally{s=1}}return{value:e,done:p}}}(r,u,i),!0),f}var c={};function s(){}function f(){}function p(){}e=Object.getPrototypeOf;var l=[][u]?e(e([][u]())):(n(e={},u,function(){return this}),e),v=p.prototype=s.prototype=Object.create(l);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,n(t,i,"GeneratorFunction")),t.prototype=Object.create(v),t}return f.prototype=p,n(v,"constructor",p),n(p,"constructor",f),f.displayName="GeneratorFunction",n(p,i,"GeneratorFunction"),n(v),n(v,i,"Generator"),n(v,u,function(){return this}),n(v,"toString",function(){return"[object Generator]"}),(r=function(){return{w:a,m:h}})()}function n(t,r,e,o){var u=Object.defineProperty;try{u({},"",{})}catch(t){u=0}(n=function(t,r,e,o){function i(r,e){n(t,r,function(t){return this._invoke(r,e,t)})}r?u?u(t,r,{value:e,enumerable:!o,configurable:!o,writable:!o}):t[r]=e:(i("next",0),i("throw",1),i("return",2))})(t,r,e,o)}function e(t,r,n,e,o,u,i){try{var a=t[u](i),c=a.value}catch(t){return void n(t)}a.done?r(c):Promise.resolve(c).then(e,o)}function o(t){return function(){var r=this,n=arguments;return new Promise(function(o,u){var i=t.apply(r,n);function a(t){e(i,o,u,a,c,"next",t)}function c(t){e(i,o,u,a,c,"throw",t)}a(void 0)})}}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function i(t,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,c(e.key),e)}}function a(t,r,n){return r&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(r){var n=s(r,"string");return"symbol"==t(n)?n:n+""}function s(r,n){if("object"!=t(r)||!r)return r;var e=r[Symbol.toPrimitive];if(void 0!==e){var o=e.call(r,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.Sharing=void 0;var f=exports.Sharing=function(){return a(function t(r,n){u(this,t),this.req=n,this.gudhub=r},[{key:"add",value:function(){var t=o(r().m(function t(n,e,o){var u,i,a,c;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.gudhub.auth.getToken();case 1:return a=t.v,u={token:a,app_id:n,user_id:e,sharing_permission:o},t.n=2,this.req.post({url:"/sharing/add",form:u});case 2:return i=t.v,t.a(2,i);case 3:return t.p=3,c=t.v,console.log(c),t.a(2,null)}},t,this,[[0,3]])}));return function(r,n,e){return t.apply(this,arguments)}}()},{key:"update",value:function(){var t=o(r().m(function t(n,e,o){var u,i,a,c;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.gudhub.auth.getToken();case 1:return a=t.v,u={token:a,app_id:n,user_id:e,sharing_permission:o},t.n=2,this.req.post({url:"/sharing/update",form:u});case 2:return i=t.v,t.a(2,i);case 3:return t.p=3,c=t.v,console.log(c),t.a(2,null)}},t,this,[[0,3]])}));return function(r,n,e){return t.apply(this,arguments)}}()},{key:"delete",value:function(){var t=o(r().m(function t(n,e){var o,u,i,a;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.gudhub.auth.getToken();case 1:return i=t.v,o={token:i,app_id:n,user_id:e},t.n=2,this.req.post({url:"/sharing/delete",form:o});case 2:return u=t.v,t.a(2,u);case 3:return t.p=3,a=t.v,console.log(a),t.a(2,null)}},t,this,[[0,3]])}));return function(r,n){return t.apply(this,arguments)}}()},{key:"getAppUsers",value:function(){var t=o(r().m(function t(n){var e,o,u,i;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.gudhub.auth.getToken();case 1:return u=t.v,e={token:u,app_id:n},t.n=2,this.req.post({url:"/sharing/get-app-users",form:e});case 2:return o=t.v,t.a(2,o);case 3:return t.p=3,i=t.v,console.log(i),t.a(2,null)}},t,this,[[0,3]])}));return function(r){return t.apply(this,arguments)}}()},{key:"addInvitation",value:function(){var t=o(r().m(function t(n,e){var o,u,i,a;return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,this.gudhub.auth.getToken();case 1:return i=t.v,o={token:i,guests_emails:n,apps:e},t.n=2,this.req.post({url:"/api/invitation/add",form:o});case 2:return u=t.v,t.a(2,u);case 3:return t.p=3,a=t.v,console.log(a),t.a(2,null)}},t,this,[[0,3]])}));return function(r,n){return t.apply(this,arguments)}}()}])}();
|
|
345
345
|
},{}],"quyV":[function(require,module,exports) {
|