ncloudchat 0.0.19-beta

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.
Files changed (104) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +69 -0
  3. package/esm/CloudChat.d.ts +38 -0
  4. package/esm/CloudChat.js +592 -0
  5. package/esm/CloudChat.js.map +1 -0
  6. package/esm/CoreManager.d.ts +5 -0
  7. package/esm/CoreManager.js +27 -0
  8. package/esm/CoreManager.js.map +1 -0
  9. package/esm/Dispatcher.d.ts +21 -0
  10. package/esm/Dispatcher.js +78 -0
  11. package/esm/Dispatcher.js.map +1 -0
  12. package/esm/Type.d.ts +35 -0
  13. package/esm/Type.js +12 -0
  14. package/esm/Type.js.map +1 -0
  15. package/esm/index.d.ts +2 -0
  16. package/esm/index.js +3 -0
  17. package/esm/index.js.map +1 -0
  18. package/esm/logger.d.ts +4 -0
  19. package/esm/logger.js +11 -0
  20. package/esm/logger.js.map +1 -0
  21. package/esm/mutations/channel.d.ts +4 -0
  22. package/esm/mutations/channel.js +162 -0
  23. package/esm/mutations/channel.js.map +1 -0
  24. package/esm/mutations/friend.d.ts +5 -0
  25. package/esm/mutations/friend.js +146 -0
  26. package/esm/mutations/friend.js.map +1 -0
  27. package/esm/mutations/index.d.ts +14 -0
  28. package/esm/mutations/index.js +15 -0
  29. package/esm/mutations/index.js.map +1 -0
  30. package/esm/mutations/invite.d.ts +1 -0
  31. package/esm/mutations/invite.js +71 -0
  32. package/esm/mutations/invite.js.map +1 -0
  33. package/esm/mutations/memberinvitation.d.ts +2 -0
  34. package/esm/mutations/memberinvitation.js +103 -0
  35. package/esm/mutations/memberinvitation.js.map +1 -0
  36. package/esm/mutations/memberreport.d.ts +10 -0
  37. package/esm/mutations/memberreport.js +110 -0
  38. package/esm/mutations/memberreport.js.map +1 -0
  39. package/esm/mutations/message.d.ts +2 -0
  40. package/esm/mutations/message.js +97 -0
  41. package/esm/mutations/message.js.map +1 -0
  42. package/esm/mutations/messageread.d.ts +1 -0
  43. package/esm/mutations/messageread.js +69 -0
  44. package/esm/mutations/messageread.js.map +1 -0
  45. package/esm/mutations/subscription.d.ts +4 -0
  46. package/esm/mutations/subscription.js +139 -0
  47. package/esm/mutations/subscription.js.map +1 -0
  48. package/esm/mutations/user.d.ts +1 -0
  49. package/esm/mutations/user.js +74 -0
  50. package/esm/mutations/user.js.map +1 -0
  51. package/esm/queries/channel.d.ts +2 -0
  52. package/esm/queries/channel.js +119 -0
  53. package/esm/queries/channel.js.map +1 -0
  54. package/esm/queries/friend.d.ts +1 -0
  55. package/esm/queries/friend.js +80 -0
  56. package/esm/queries/friend.js.map +1 -0
  57. package/esm/queries/index.d.ts +7 -0
  58. package/esm/queries/index.js +8 -0
  59. package/esm/queries/index.js.map +1 -0
  60. package/esm/queries/memberinvitation.d.ts +2 -0
  61. package/esm/queries/memberinvitation.js +110 -0
  62. package/esm/queries/memberinvitation.js.map +1 -0
  63. package/esm/queries/message.d.ts +2 -0
  64. package/esm/queries/message.js +117 -0
  65. package/esm/queries/message.js.map +1 -0
  66. package/esm/queries/messageread.d.ts +1 -0
  67. package/esm/queries/messageread.js +74 -0
  68. package/esm/queries/messageread.js.map +1 -0
  69. package/esm/queries/project.d.ts +1 -0
  70. package/esm/queries/project.js +74 -0
  71. package/esm/queries/project.js.map +1 -0
  72. package/esm/queries/subscription.d.ts +2 -0
  73. package/esm/queries/subscription.js +112 -0
  74. package/esm/queries/subscription.js.map +1 -0
  75. package/lib/CloudChat.js +1032 -0
  76. package/lib/CoreManager.js +35 -0
  77. package/lib/Dispatcher.js +109 -0
  78. package/lib/Type.js +25 -0
  79. package/lib/index.js +18 -0
  80. package/lib/logger.js +27 -0
  81. package/lib/mutations/channel.js +324 -0
  82. package/lib/mutations/friend.js +319 -0
  83. package/lib/mutations/index.js +128 -0
  84. package/lib/mutations/invite.js +208 -0
  85. package/lib/mutations/memberinvitation.js +271 -0
  86. package/lib/mutations/memberreport.js +272 -0
  87. package/lib/mutations/message.js +246 -0
  88. package/lib/mutations/messageread.js +215 -0
  89. package/lib/mutations/subscription.js +299 -0
  90. package/lib/mutations/user.js +207 -0
  91. package/lib/queries/channel.js +274 -0
  92. package/lib/queries/friend.js +220 -0
  93. package/lib/queries/index.js +102 -0
  94. package/lib/queries/memberinvitation.js +273 -0
  95. package/lib/queries/message.js +267 -0
  96. package/lib/queries/messageread.js +219 -0
  97. package/lib/queries/project.js +217 -0
  98. package/lib/queries/subscription.js +264 -0
  99. package/ncloudchat_javascript.md +290 -0
  100. package/package copy.json +74 -0
  101. package/package.json +76 -0
  102. package/tsconfig.json +31 -0
  103. package/types/exif.d.ts +10 -0
  104. package/types/window.d.ts +5 -0
@@ -0,0 +1,78 @@
1
+ var DispatcherEvent = /** @class */ (function () {
2
+ function DispatcherEvent() {
3
+ this.callbacks = [];
4
+ }
5
+ DispatcherEvent.prototype.getCallbacks = function () {
6
+ return this.callbacks;
7
+ };
8
+ DispatcherEvent.prototype.register = function (cb) {
9
+ if (!this.callbacks.includes(cb)) {
10
+ this.callbacks.push(cb);
11
+ }
12
+ };
13
+ DispatcherEvent.prototype.unregister = function (cb) {
14
+ var index = this.callbacks.indexOf(cb);
15
+ if (index > -1) {
16
+ this.callbacks.splice(index, 1);
17
+ }
18
+ };
19
+ DispatcherEvent.prototype.execute = function (param1, param2, param3, param4, param5, param6) {
20
+ if (this.callbacks.length > 0) {
21
+ this.callbacks.slice(0).forEach(function (callback) {
22
+ if (!param2)
23
+ callback(param1);
24
+ else if (!param3)
25
+ callback(param1, param2);
26
+ else if (!param4)
27
+ callback(param1, param2, param3);
28
+ else if (!param5)
29
+ callback(param1, param2, param3, param4);
30
+ else if (!param6)
31
+ callback(param1, param2, param3, param4, param5);
32
+ else
33
+ callback(param1, param2, param3, param4, param5, param6);
34
+ });
35
+ }
36
+ };
37
+ return DispatcherEvent;
38
+ }());
39
+ var Dispatcher = /** @class */ (function () {
40
+ function Dispatcher() {
41
+ this.eventProvider = {};
42
+ }
43
+ Dispatcher.prototype.getProvider = function () {
44
+ return this.eventProvider;
45
+ };
46
+ Dispatcher.prototype.dispatch = function (name, param1, param2, param3, param4, param5, param6) {
47
+ var event = this.eventProvider[name];
48
+ if (event) {
49
+ event.execute(param1, param2, param3, param4, param5, param6);
50
+ }
51
+ };
52
+ Dispatcher.prototype.on = function (name, callback) {
53
+ var event = this.eventProvider[name];
54
+ if (!event) {
55
+ event = new DispatcherEvent();
56
+ this.eventProvider[name] = event;
57
+ }
58
+ event.register(callback);
59
+ };
60
+ Dispatcher.prototype.off = function (name, callback) {
61
+ var event = this.eventProvider[name];
62
+ if (event) {
63
+ event.unregister(callback);
64
+ if (event.getCallbacks().length === 0) {
65
+ delete this.eventProvider[name];
66
+ }
67
+ }
68
+ };
69
+ Dispatcher.prototype.offall = function (name) {
70
+ var event = this.eventProvider[name];
71
+ if (event) {
72
+ delete this.eventProvider[name];
73
+ }
74
+ };
75
+ return Dispatcher;
76
+ }());
77
+ export default Dispatcher;
78
+ //# sourceMappingURL=Dispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dispatcher.js","sourceRoot":"","sources":["../src/Dispatcher.ts"],"names":[],"mappings":"AAAA;IAEI;QACI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,sCAAY,GAAZ;QACI,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,kCAAQ,GAAR,UAAS,EAAO;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;YAC9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC3B;IACL,CAAC;IAED,oCAAU,GAAV,UAAW,EAAO;QACd,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE;YACZ,IAAI,CAAC,SAAS,CAAC,M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AK,EAAE;YACP,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;SACjE;IACL,CAAC;IAED,uBAAE,GAAF,UAAG,IAAY,EAAE,QAAa;QAC1B,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACR,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;YAC9B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;SACpC;QACD,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,wBAAG,GAAH,UAAI,IAAY,EAAE,QAAa;QAC3B,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAC3B,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;gBACnC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;aACnC;SACJ;IACL,CAAC;IAED,2BAAM,GAAN,UAAO,IAAY;QACf,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,KAAK,EAAE;YACP,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACnC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AA1CD,IA0CC"}
package/esm/Type.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ export declare enum ChannelType {
2
+ PRIVATE = "PRIVATE",
3
+ PUBLIC = "PUBLIC"
4
+ }
5
+ export interface MarkInput {
6
+ channelId: string;
7
+ userId: string;
8
+ messageId: string;
9
+ sortId: string;
10
+ }
11
+ export interface ChannelInput {
12
+ type: ChannelType;
13
+ id: string;
14
+ name: string;
15
+ uniqueId: string;
16
+ translation: boolean;
17
+ push: boolean;
18
+ linkUrl: string;
19
+ imageUrl: string;
20
+ members: string[];
21
+ }
22
+ export declare enum MessageType {
23
+ text = "text",
24
+ photo = "photo",
25
+ file = "file"
26
+ }
27
+ export interface MessageInput {
28
+ messageType: MessageType;
29
+ text: string;
30
+ imageUrls: string;
31
+ fileUrls: string;
32
+ thumbUrls: string;
33
+ mentiones: string;
34
+ customData: string[];
35
+ }
package/esm/Type.js ADDED
@@ -0,0 +1,12 @@
1
+ export var ChannelType;
2
+ (function (ChannelType) {
3
+ ChannelType["PRIVATE"] = "PRIVATE";
4
+ ChannelType["PUBLIC"] = "PUBLIC";
5
+ })(ChannelType || (ChannelType = {}));
6
+ export var MessageType;
7
+ (function (MessageType) {
8
+ MessageType["text"] = "text";
9
+ MessageType["photo"] = "photo";
10
+ MessageType["file"] = "file";
11
+ })(MessageType || (MessageType = {}));
12
+ //# sourceMappingURL=Type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Type.js","sourceRoot":"","sources":["../src/Type.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAkBD,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,4BAAa,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB"}
package/esm/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import Chat from './CloudChat';
2
+ export { Chat };
package/esm/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import Chat from './CloudChat';
2
+ export { Chat };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,aAAa,CAAC;AAG/B,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare const debug: (value: string) => void;
2
+ declare const error: (value: string) => void;
3
+ declare const info: (value: string) => void;
4
+ export { debug, error, info };
package/esm/logger.js ADDED
@@ -0,0 +1,11 @@
1
+ var debug = function (value) {
2
+ return console.log(value);
3
+ };
4
+ var error = function (value) {
5
+ return console.error(value);
6
+ };
7
+ var info = function (value) {
8
+ return console.log(value);
9
+ };
10
+ export { debug, error, info };
11
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,IAAM,KAAK,GAAG,UAAS,KAAa;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAA;AACD,IAAM,KAAK,GAAG,UAAS,KAAa;IAChC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC,CAAA;AACD,IAAM,IAAI,GAAG,UAAS,KAAa;IAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC,CAAA;AACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ChannelInput } from "../Type";
2
+ export declare const createChannel: (channel: ChannelInput) => Promise<any>;
3
+ export declare const updateChannel: (channelId: string, channel: ChannelInput) => Promise<any>;
4
+ export declare const deleteChannel: (channelId: string) => Promise<any>;
@@ -0,0 +1,162 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import CoreManager from '../CoreManager';
38
+ export var createChannel = function (channel) { return __awaiter(void 0, void 0, void 0, function () {
39
+ var token, projectId, endpoint, query;
40
+ return __generator(this, function (_a) {
41
+ switch (_a.label) {
42
+ case 0:
43
+ token = CoreManager.get("TOKEN");
44
+ projectId = CoreManager.get("PROJECT_ID");
45
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
46
+ if (!channel.members)
47
+ channel.members = [];
48
+ query = "\n mutation (\n $projectId: String!, \n $name: String!, \n $type: String!,\n $uniqueId: String,\n $translation: Boolean,\n $push: Boolean,\n $linkUrl: String,\n $imageUrl: String,\n $id: String,\n $members: [String]\n ) {\n createChannel(\n input: { \n projectId: $projectId, \n name: $name, \n type: $type,\n id: $id,\n members: $members,\n uniqueId: $uniqueId,\n translation:$translation,\n push:$push,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n }\n ) {\n channel {\n id\n project_id\n name\n user_id\n unique_id\n is_private\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n } \n ";
49
+ return [4 /*yield*/, fetch(endpoint, {
50
+ method: 'POST',
51
+ headers: {
52
+ 'Authorization': 'Bearer ' + token,
53
+ 'Content-Type': 'application/json',
54
+ 'Accept': 'application/json'
55
+ },
56
+ body: JSON.stringify({
57
+ query: query,
58
+ variables: {
59
+ projectId: projectId,
60
+ id: channel.id,
61
+ type: channel.type,
62
+ name: channel.name,
63
+ members: channel.members,
64
+ push: channel.push,
65
+ link_url: channel.linkUrl,
66
+ image_url: channel.imageUrl,
67
+ translation: channel.translation
68
+ }
69
+ })
70
+ })
71
+ .then(function (res) { return res.json(); })
72
+ .then(function (data) {
73
+ if (data.errors) {
74
+ throw data.errors[0];
75
+ }
76
+ return data.data.createChannel.channel;
77
+ })];
78
+ case 1: return [2 /*return*/, _a.sent()];
79
+ }
80
+ });
81
+ }); };
82
+ export var updateChannel = function (channelId, channel) { return __awaiter(void 0, void 0, void 0, function () {
83
+ var token, projectId, endpoint, query;
84
+ return __generator(this, function (_a) {
85
+ switch (_a.label) {
86
+ case 0:
87
+ token = CoreManager.get("TOKEN");
88
+ projectId = CoreManager.get("PROJECT_ID");
89
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
90
+ if (!channel.members)
91
+ channel.members = [];
92
+ console.log(channel);
93
+ query = "\n mutation (\n $projectId: String!, \n $name: String!, \n $type: String!,\n $uniqueId: String,\n $translation: Boolean,\n $push: Boolean,\n $linkUrl: String,\n $imageUrl: String,\n $id: String,\n $members: [String]\n ) {\n updateChannel(\n input: { \n projectId: $projectId, \n name: $name, \n type: $type,\n id: $id,\n members: $members,\n uniqueId: $uniqueId,\n translation:$translation,\n push:$push,\n linkUrl:$linkUrl,\n imageUrl:$imageUrl\n }\n ) {\n channel {\n id\n project_id\n name\n user_id\n unique_id\n is_private\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n } \n ";
94
+ return [4 /*yield*/, fetch(endpoint, {
95
+ method: 'POST',
96
+ headers: {
97
+ 'Authorization': 'Bearer ' + token,
98
+ 'Content-Type': 'application/json',
99
+ 'Accept': 'application/json'
100
+ },
101
+ body: JSON.stringify({
102
+ query: query,
103
+ variables: {
104
+ projectId: projectId,
105
+ id: channelId,
106
+ type: channel.type,
107
+ name: channel.name,
108
+ members: channel.members,
109
+ push: channel.push,
110
+ link_url: channel.linkUrl,
111
+ image_url: channel.imageUrl,
112
+ translation: channel.translation
113
+ }
114
+ })
115
+ })
116
+ .then(function (res) { return res.json(); })
117
+ .then(function (data) {
118
+ if (data.errors) {
119
+ throw data.errors[0];
120
+ }
121
+ return data.data.createChannel.channel;
122
+ })];
123
+ case 1: return [2 /*return*/, _a.sent()];
124
+ }
125
+ });
126
+ }); };
127
+ export var deleteChannel = function (channelId) { return __awaiter(void 0, void 0, void 0, function () {
128
+ var token, projectId, endpoint, query;
129
+ return __generator(this, function (_a) {
130
+ switch (_a.label) {
131
+ case 0:
132
+ token = CoreManager.get("TOKEN");
133
+ projectId = CoreManager.get("PROJECT_ID");
134
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
135
+ query = "\n mutation (\n $projectId: String!, \n $id: ID!\n ) {\n deleteChannel(\n input: { \n projectId: $projectId, \n id: $id,\n }\n ) {\n channel {\n id\n project_id\n name\n user_id\n unique_id\n is_private\n translation\n members\n push\n link_url\n image_url \n created_at\n updated_at\n }\n }\n } \n ";
136
+ return [4 /*yield*/, fetch(endpoint, {
137
+ method: 'POST',
138
+ headers: {
139
+ 'Authorization': 'Bearer ' + token,
140
+ 'Content-Type': 'application/json',
141
+ 'Accept': 'application/json'
142
+ },
143
+ body: JSON.stringify({
144
+ query: query,
145
+ variables: {
146
+ projectId: projectId,
147
+ id: channelId
148
+ }
149
+ })
150
+ })
151
+ .then(function (res) { return res.json(); })
152
+ .then(function (data) {
153
+ if (data.errors) {
154
+ throw data.errors[0];
155
+ }
156
+ return data.data.deleteChannel.channel;
157
+ })];
158
+ case 1: return [2 /*return*/, _a.sent()];
159
+ }
160
+ });
161
+ }); };
162
+ //# sourceMappingURL=channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/mutations/channel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,aAAa,GAAG,UAAO,OAAqB;;;;;gBAC/C,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACjC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBAC5D,IAAG,CAAC,OAAO,CAAC,OAAO;oBACf,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;gBACnB,KAAK,GAAG,wgCA4Cb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,eAAe,EAAG,SAAS,GAAG,KAAK;4BACnC,c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AK,GAAG,gjBA4Bb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,eAAe,EAAG,SAAS,GAAG,KAAK;4BACnC,cAAc,EAAE,kBAAkB;4BAClC,QAAQ,EAAE,kBAAkB;yBAC/B;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,KAAK,OAAA;4BACL,SAAS,EAAE;gCACP,SAAS,WAAA;gCACT,EAAE,EAAE,SAAS;6BACf;yBACH,CAAC;qBACP,CAAC;yBACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;yBACvB,IAAI,CAAC,UAAA,IAAI;wBACN,IAAG,IAAI,CAAC,MAAM,EAAE;4BACZ,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;yBACxB;wBACD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;oBAC3C,CAAC,CAAC,EAAA;oBAtBF,sBAAO,SAsBL,EAAC;;;KACN,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const createFriend: (channelId: string, friendIds: any) => Promise<any>;
2
+ export declare const acceptFriend: (friendId: string) => Promise<any>;
3
+ export declare const rejectFriend: (channelId: string, friendIds: any) => Promise<any>;
4
+ export declare const updateFriend: () => Promise<void>;
5
+ export declare const deleteFriend: () => Promise<void>;
@@ -0,0 +1,146 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import CoreManager from '../CoreManager';
38
+ export var createFriend = function (channelId, friendIds) { return __awaiter(void 0, void 0, void 0, function () {
39
+ var token, projectId, endpoint, query;
40
+ return __generator(this, function (_a) {
41
+ switch (_a.label) {
42
+ case 0:
43
+ token = CoreManager.get("TOKEN");
44
+ projectId = CoreManager.get("PROJECT_ID");
45
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
46
+ query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $friendIds: String!\n ) {\n requestFriend(\n input: {\n projectId: $projectId, \n channelId: $channelId,\n friendIds: $friendIds\n }\n ) {\n friendship {\n id\n }\n }\n }\n ";
47
+ return [4 /*yield*/, fetch(endpoint, {
48
+ method: 'POST',
49
+ headers: {
50
+ 'Authorization': 'Bearer ' + token,
51
+ 'Content-Type': 'application/json',
52
+ 'Accept': 'application/json'
53
+ },
54
+ body: JSON.stringify({
55
+ query: query,
56
+ variables: {
57
+ projectId: projectId,
58
+ channelId: channelId,
59
+ friendIds: friendIds
60
+ }
61
+ })
62
+ })
63
+ .then(function (res) { return res.json(); })
64
+ .then(function (data) {
65
+ return data.data.createFriend.friendship;
66
+ })];
67
+ case 1: return [2 /*return*/, _a.sent()];
68
+ }
69
+ });
70
+ }); };
71
+ export var acceptFriend = function (friendId) { return __awaiter(void 0, void 0, void 0, function () {
72
+ var token, projectId, endpoint, query;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ token = CoreManager.get("TOKEN");
77
+ projectId = CoreManager.get("PROJECT_ID");
78
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
79
+ query = "\n mutation (\n $projectId: String!, \n $friendId: String!\n ) {\n requestFriend(\n input: {\n projectId: $projectId, \n friendId: $friendId\n }\n ) {\n friendship {\n id\n }\n }\n }\n ";
80
+ return [4 /*yield*/, fetch(endpoint, {
81
+ method: 'POST',
82
+ headers: {
83
+ 'Authorization': 'Bearer ' + token,
84
+ 'Content-Type': 'application/json',
85
+ 'Accept': 'application/json'
86
+ },
87
+ body: JSON.stringify({
88
+ query: query,
89
+ variables: {
90
+ projectId: projectId,
91
+ friendId: friendId
92
+ }
93
+ })
94
+ })
95
+ .then(function (res) { return res.json(); })
96
+ .then(function (data) {
97
+ return data.data.createFriend.friendship;
98
+ })];
99
+ case 1: return [2 /*return*/, _a.sent()];
100
+ }
101
+ });
102
+ }); };
103
+ export var rejectFriend = function (channelId, friendIds) { return __awaiter(void 0, void 0, void 0, function () {
104
+ var token, projectId, endpoint, query;
105
+ return __generator(this, function (_a) {
106
+ switch (_a.label) {
107
+ case 0:
108
+ token = CoreManager.get("TOKEN");
109
+ projectId = CoreManager.get("PROJECT_ID");
110
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
111
+ query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $friendIds: String!\n ) {\n requestFriend(\n input: {\n projectId: $projectId, \n channelId: $channelId,\n friendIds: $friendIds\n }\n ) {\n friendship {\n id\n }\n }\n }\n ";
112
+ return [4 /*yield*/, fetch(endpoint, {
113
+ method: 'POST',
114
+ headers: {
115
+ 'Authorization': 'Bearer ' + token,
116
+ 'Content-Type': 'application/json',
117
+ 'Accept': 'application/json'
118
+ },
119
+ body: JSON.stringify({
120
+ query: query,
121
+ variables: {
122
+ projectId: projectId,
123
+ channelId: channelId,
124
+ friendIds: friendIds
125
+ }
126
+ })
127
+ })
128
+ .then(function (res) { return res.json(); })
129
+ .then(function (data) {
130
+ return data.data.createFriend.friendship;
131
+ })];
132
+ case 1: return [2 /*return*/, _a.sent()];
133
+ }
134
+ });
135
+ }); };
136
+ export var updateFriend = function () { return __awaiter(void 0, void 0, void 0, function () {
137
+ return __generator(this, function (_a) {
138
+ return [2 /*return*/];
139
+ });
140
+ }); };
141
+ export var deleteFriend = function () { return __awaiter(void 0, void 0, void 0, function () {
142
+ return __generator(this, function (_a) {
143
+ return [2 /*return*/];
144
+ });
145
+ }); };
146
+ //# sourceMappingURL=friend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/mutations/friend.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,I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AAI,CAAC,UAAA,IAAI;wBACN,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;oBAC7C,CAAC,CAAC,EAAA;oBApBF,sBAAO,SAoBL,EAAC;;;KACN,CAAC;AACF,MAAM,CAAC,IAAM,YAAY,GAAG;;;;KAE3B,CAAC;AACF,MAAM,CAAC,IAAM,YAAY,GAAG;;;;KAE3B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Node.js GraphQL API Starter Kit
3
+ * https://github.com/kriasoft/nodejs-api-starter
4
+ * Copyright © 2016-present Kriasoft | MIT License
5
+ */
6
+ export * from './user';
7
+ export * from './channel';
8
+ export * from './message';
9
+ export * from './friend';
10
+ export * from './invite';
11
+ export * from './subscription';
12
+ export * from './messageread';
13
+ export * from './memberinvitation';
14
+ export * from './memberreport';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Node.js GraphQL API Starter Kit
3
+ * https://github.com/kriasoft/nodejs-api-starter
4
+ * Copyright © 2016-present Kriasoft | MIT License
5
+ */
6
+ export * from './user';
7
+ export * from './channel';
8
+ export * from './message';
9
+ export * from './friend';
10
+ export * from './invite';
11
+ export * from './subscription';
12
+ export * from './messageread';
13
+ export * from './memberinvitation';
14
+ export * from './memberreport';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mutations/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const createInvite: (channelId: string, friendIds: any) => Promise<any>;
@@ -0,0 +1,71 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import CoreManager from '../CoreManager';
38
+ export var createInvite = function (channelId, friendIds) { return __awaiter(void 0, void 0, void 0, function () {
39
+ var token, projectId, endpoint, query;
40
+ return __generator(this, function (_a) {
41
+ switch (_a.label) {
42
+ case 0:
43
+ token = CoreManager.get("TOKEN");
44
+ projectId = CoreManager.get("PROJECT_ID");
45
+ endpoint = CoreManager.get('SERVER_URL') + '/graphql';
46
+ query = "\n mutation (\n $projectId: String!, \n $channelId: String!,\n $friendIds: String!\n ) {\n createInvite(\n input: {\n projectId: $projectId, \n channelId: $channelId,\n friendIds: $friendIds\n }\n ) {\n invite {\n id\n }\n }\n }\n ";
47
+ return [4 /*yield*/, fetch(endpoint, {
48
+ method: 'POST',
49
+ headers: {
50
+ 'Authorization': 'Bearer ' + token,
51
+ 'Content-Type': 'application/json',
52
+ 'Accept': 'application/json'
53
+ },
54
+ body: JSON.stringify({
55
+ query: query,
56
+ variables: {
57
+ projectId: projectId,
58
+ channelId: channelId,
59
+ friendIds: friendIds
60
+ }
61
+ })
62
+ })
63
+ .then(function (res) { return res.json(); })
64
+ .then(function (data) {
65
+ return data.data.createFriend.friendship;
66
+ })];
67
+ case 1: return [2 /*return*/, _a.sent()];
68
+ }
69
+ });
70
+ }); };
71
+ //# sourceMappingURL=invite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invite.js","sourceRoot":"","sources":["../../src/mutations/invite.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAGzC,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,SAAiB,EAAE,SAAc;;;;;gBAC1D,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACjC,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1C,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;gBACtD,KAAK,GAAG,uYAkBb,CAAC;gBAEK,qBAAM,KAAK,CACd,QAAQ,EAAE;wBACV,MAAM,EAAE,MAAM;wBACd,OAAO,EAAE;4BACL,eAAe,EAAG,SAAS,GAAG,KAAK;4BACnC,cAAc,EAAE,kBAAkB;4BAClC,QAAQ,EAAE,kBAAkB;yBAC/B;wBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACjB,KAAK,OAAA;4BACL,SAAS,EAAE;gCACP,SAAS,WAAA;gCACT,SAAS,WAAA;gCACT,SAAS,WAAA;6BACX;yBACH,CAAC;qBACP,CAAC;yBACD,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC;yBACvB,IAAI,CAAC,UAAA,IAAI;wBACN,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;oBAC7C,CAAC,CAAC,EAAA;oBApBF,sBAAO,SAoBL,EAAC;;;KACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const createInvitation: (channelId: string, url: string, inviteForm: string, inviterId: string, invitee: string, content: string) => Promise<any>;
2
+ export declare const updateInvitation: (sequenceId: string, inviteStatus?: string, subscribedId?: string) => Promise<any>;