@nlabs/reaktor 0.3.0 → 0.4.1

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 (128) hide show
  1. package/lib/actions/conversations.d.ts +14 -0
  2. package/lib/actions/conversations.js +333 -0
  3. package/lib/actions/dynamodb.js +155 -0
  4. package/lib/actions/email.js +177 -0
  5. package/lib/actions/files.js +319 -0
  6. package/lib/{data → actions}/groups.d.ts +4 -3
  7. package/lib/actions/groups.js +282 -0
  8. package/lib/actions/images.d.ts +22 -0
  9. package/lib/actions/images.js +682 -0
  10. package/lib/actions/index.js +40 -0
  11. package/lib/{data → actions}/ios.d.ts +2 -1
  12. package/lib/actions/ios.js +179 -0
  13. package/lib/actions/locations.js +112 -0
  14. package/lib/actions/messages.d.ts +13 -0
  15. package/lib/actions/messages.js +216 -0
  16. package/lib/actions/notifications.js +63 -0
  17. package/lib/{data → actions}/payments.d.ts +2 -2
  18. package/lib/actions/payments.js +491 -0
  19. package/lib/actions/posts.d.ts +19 -0
  20. package/lib/actions/posts.js +538 -0
  21. package/lib/actions/reactions.d.ts +30 -0
  22. package/lib/actions/reactions.js +340 -0
  23. package/lib/{data → actions}/s3.d.ts +1 -1
  24. package/lib/actions/s3.js +122 -0
  25. package/lib/{data → actions}/search.d.ts +2 -2
  26. package/lib/actions/search.js +99 -0
  27. package/lib/actions/sms.js +76 -0
  28. package/lib/actions/statistics.d.ts +2 -0
  29. package/lib/actions/statistics.js +63 -0
  30. package/lib/actions/subscription.js +209 -0
  31. package/lib/actions/tags.d.ts +26 -0
  32. package/lib/actions/tags.js +340 -0
  33. package/lib/actions/users.d.ts +44 -0
  34. package/lib/actions/users.js +571 -0
  35. package/lib/{data → actions}/websockets.d.ts +1 -1
  36. package/lib/actions/websockets.js +156 -0
  37. package/lib/config.d.ts +2 -3
  38. package/lib/config.js +120 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.js +23 -0
  41. package/lib/templates/email/layout.d.ts +2 -0
  42. package/lib/templates/email/layout.js +292 -0
  43. package/lib/templates/email/passwordForgot.d.ts +2 -0
  44. package/lib/templates/email/passwordForgot.js +28 -0
  45. package/lib/templates/email/passwordRecovery.d.ts +2 -0
  46. package/lib/templates/email/passwordRecovery.js +25 -0
  47. package/lib/templates/email/verifyEmail.d.ts +2 -0
  48. package/lib/templates/email/verifyEmail.js +28 -0
  49. package/lib/templates/email/welcome.d.ts +2 -0
  50. package/lib/templates/email/welcome.js +28 -0
  51. package/lib/templates/sms/passwordForgot.d.ts +2 -0
  52. package/lib/templates/sms/passwordForgot.js +14 -0
  53. package/lib/templates/sms/passwordRecovery.d.ts +2 -0
  54. package/lib/templates/sms/passwordRecovery.js +14 -0
  55. package/lib/templates/sms/verifyEmail.d.ts +2 -0
  56. package/lib/templates/sms/verifyEmail.js +14 -0
  57. package/lib/templates/sms/verifyPhone.d.ts +2 -0
  58. package/lib/templates/sms/verifyPhone.js +14 -0
  59. package/lib/templates/sms/welcome.d.ts +2 -0
  60. package/lib/templates/sms/welcome.js +14 -0
  61. package/lib/types/apps.d.ts +2 -2
  62. package/lib/types/apps.js +4 -0
  63. package/lib/types/arangodb.js +4 -0
  64. package/lib/types/auth.d.ts +4 -8
  65. package/lib/types/auth.js +4 -0
  66. package/lib/types/conversations.d.ts +5 -3
  67. package/lib/types/conversations.js +4 -0
  68. package/lib/types/email.d.ts +2 -2
  69. package/lib/types/email.js +4 -0
  70. package/lib/types/files.js +4 -0
  71. package/lib/types/google.js +4 -0
  72. package/lib/types/groups.d.ts +2 -1
  73. package/lib/types/groups.js +4 -0
  74. package/lib/types/images.d.ts +8 -5
  75. package/lib/types/images.js +4 -0
  76. package/lib/types/index.d.ts +1 -1
  77. package/lib/types/index.js +37 -0
  78. package/lib/types/locations.js +4 -0
  79. package/lib/types/messages.d.ts +12 -2
  80. package/lib/types/messages.js +4 -0
  81. package/lib/types/notifications.d.ts +2 -2
  82. package/lib/types/notifications.js +4 -0
  83. package/lib/types/payments.js +4 -0
  84. package/lib/types/posts.d.ts +18 -1
  85. package/lib/types/posts.js +4 -0
  86. package/lib/types/statistics.d.ts +3 -0
  87. package/lib/types/statistics.js +4 -0
  88. package/lib/types/tags.d.ts +6 -0
  89. package/lib/types/tags.js +4 -0
  90. package/lib/types/users.d.ts +15 -10
  91. package/lib/types/users.js +4 -0
  92. package/lib/utils/analytics.d.ts +7 -0
  93. package/lib/utils/analytics.js +107 -0
  94. package/lib/utils/arangodb.d.ts +1 -1
  95. package/lib/utils/arangodb.js +122 -0
  96. package/lib/utils/auth.js +78 -0
  97. package/lib/utils/graphql.js +40 -0
  98. package/lib/utils/index.d.ts +1 -1
  99. package/lib/utils/index.js +26 -0
  100. package/lib/utils/objects.js +53 -0
  101. package/lib/utils/session.d.ts +18 -0
  102. package/lib/utils/session.js +42 -0
  103. package/package.json +35 -33
  104. package/lib/data/conversations.d.ts +0 -8
  105. package/lib/data/images.d.ts +0 -21
  106. package/lib/data/messages.d.ts +0 -9
  107. package/lib/data/posts.d.ts +0 -23
  108. package/lib/data/reactions.d.ts +0 -14
  109. package/lib/data/tags.d.ts +0 -14
  110. package/lib/data/users.d.ts +0 -17
  111. package/lib/types/reactions.d.ts +0 -15
  112. package/lib/utils/redis.d.ts +0 -1
  113. package/templates/email/layout.html +0 -279
  114. package/templates/email/passwordForgot.html +0 -15
  115. package/templates/email/passwordRecovery.html +0 -12
  116. package/templates/email/verifyEmail.html +0 -15
  117. package/templates/sms/passwordForgot.txt +0 -1
  118. package/templates/sms/passwordRecovery.txt +0 -1
  119. package/templates/sms/verifyEmail.txt +0 -1
  120. package/templates/sms/verifyPhone.txt +0 -1
  121. /package/lib/{data → actions}/dynamodb.d.ts +0 -0
  122. /package/lib/{data → actions}/email.d.ts +0 -0
  123. /package/lib/{data → actions}/files.d.ts +0 -0
  124. /package/lib/{data → actions}/index.d.ts +0 -0
  125. /package/lib/{data → actions}/locations.d.ts +0 -0
  126. /package/lib/{data → actions}/notifications.d.ts +0 -0
  127. /package/lib/{data → actions}/sms.d.ts +0 -0
  128. /package/lib/{data → actions}/subscription.d.ts +0 -0
@@ -0,0 +1,122 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ __markAsModule(target);
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __reExport = (target, module2, desc) => {
14
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
+ for (let key of __getOwnPropNames(module2))
16
+ if (!__hasOwnProp.call(target, key) && key !== "default")
17
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
+ }
19
+ return target;
20
+ };
21
+ var __toModule = (module2) => {
22
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
+ };
24
+ __export(exports, {
25
+ dbPathObjItem: () => dbPathObjItem,
26
+ dbPathObjJson: () => dbPathObjJson,
27
+ dbPathObjList: () => dbPathObjList,
28
+ getLimit: () => getLimit,
29
+ getRange: () => getRange,
30
+ selectReactionCountByType: () => selectReactionCountByType,
31
+ useDb: () => useDb
32
+ });
33
+ var import_utils = __toModule(require("@nlabs/utils"));
34
+ var import_arangojs = __toModule(require("arangojs"));
35
+ var import_config = __toModule(require("../config"));
36
+ const useDb = (databaseName) => new import_arangojs.Database({
37
+ auth: { password: import_config.Config.get("arangodb.password"), username: import_config.Config.get("arangodb.username") },
38
+ databaseName,
39
+ url: import_config.Config.get("arangodb.url")
40
+ });
41
+ const dbPathObjItem = (pathSet) => {
42
+ const routeKey = pathSet[0];
43
+ const collection = routeKey.replace("ById", "");
44
+ const keys = pathSet[1];
45
+ const props = pathSet[2];
46
+ return {
47
+ collection,
48
+ keys,
49
+ props,
50
+ routeKey
51
+ };
52
+ };
53
+ const dbPathObjJson = (json) => {
54
+ const collectionKeys = Object.keys(json);
55
+ const routeKey = collectionKeys[0];
56
+ const collection = routeKey.replace("ById", "");
57
+ const itemObj = json[routeKey];
58
+ const keys = Object.keys(itemObj);
59
+ return {
60
+ collection,
61
+ itemObj,
62
+ keys,
63
+ routeKey
64
+ };
65
+ };
66
+ const dbPathObjList = (pathSet) => {
67
+ const routeKey = pathSet[0];
68
+ const ranges = pathSet[1];
69
+ const props = pathSet[2];
70
+ return {
71
+ props,
72
+ ranges,
73
+ routeKey
74
+ };
75
+ };
76
+ const getLimit = (start = 0, to = 30) => {
77
+ let num = (0, import_utils.parseNum)(to) - (0, import_utils.parseNum)(start);
78
+ console.log("getLimit", { start, to, num });
79
+ if (num > 50) {
80
+ num = 50;
81
+ }
82
+ return { aql: to >= 0 ? `LIMIT ${start}, ${num}` : "", num, start };
83
+ };
84
+ const getRange = (from, to) => {
85
+ let updatedFrom = from || 0;
86
+ let updatedTo = to || 15;
87
+ updatedTo = updatedTo - 1;
88
+ if (updatedTo < 0) {
89
+ updatedTo = 0;
90
+ } else if (to > 50) {
91
+ updatedTo = 50;
92
+ }
93
+ if (updatedFrom < 0) {
94
+ updatedFrom = 0;
95
+ }
96
+ if (updatedFrom > updatedTo) {
97
+ updatedFrom = updatedTo;
98
+ }
99
+ return { from: updatedFrom, to: updatedTo };
100
+ };
101
+ const selectReactionCountByType = (objectType, objectKey, field, selects) => {
102
+ const reactionType = field.substr(0, field.indexOf("Count"));
103
+ selects.queries.push(`LET ${field} = FIRST(
104
+ FOR obj, r IN INBOUND ${objectKey}._id hasReactions
105
+ FILTER r.name == "${reactionType}" && r.type == "${objectType}"
106
+ COLLECT WITH COUNT INTO count
107
+ RETURN count
108
+ )`);
109
+ selects.objects.push(`${field}:${field}`);
110
+ return selects;
111
+ };
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ dbPathObjItem,
115
+ dbPathObjJson,
116
+ dbPathObjList,
117
+ getLimit,
118
+ getRange,
119
+ selectReactionCountByType,
120
+ useDb
121
+ });
122
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL2FyYW5nb2RiLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIENvcHlyaWdodCAoYykgMjAxOS1QcmVzZW50LCBOaXRyb2dlbiBMYWJzLCBJbmMuXG4gKiBDb3B5cmlnaHRzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgTGljZW5zZS4gU2VlIHRoZSBhY2NvbXBhbnlpbmcgTElDRU5TRSBmaWxlIGZvciB0ZXJtcy5cbiAqL1xuaW1wb3J0IHtwYXJzZU51bX0gZnJvbSAnQG5sYWJzL3V0aWxzJztcbmltcG9ydCB7RGF0YWJhc2V9IGZyb20gJ2FyYW5nb2pzJztcblxuaW1wb3J0IHtDb25maWd9IGZyb20gJy4uL2NvbmZpZyc7XG5pbXBvcnQge0FyYW5nb0RCTGltaXQsIEFyYW5nb0RCUGF0aE9iamVjdCwgUmFuZ2VUeXBlfSBmcm9tICcuLi90eXBlcy9hcmFuZ29kYic7XG5cbi8vIENyZWF0ZSBkYXRhYmFzZVxuZXhwb3J0IGNvbnN0IHVzZURiID0gKGRhdGFiYXNlTmFtZTogc3RyaW5nKTogRGF0YWJhc2UgPT4gbmV3IERhdGFiYXNlKHtcbiAgYXV0aDoge3Bhc3N3b3JkOiBDb25maWcuZ2V0KCdhcmFuZ29kYi5wYXNzd29yZCcpLCB1c2VybmFtZTogQ29uZmlnLmdldCgnYXJhbmdvZGIudXNlcm5hbWUnKX0sXG4gIGRhdGFiYXNlTmFtZSxcbiAgdXJsOiB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xRQUFRLElBQUksS0FBSztBQUFBO0FBR3RELE1BQU0sV0FBVyxDQUFDLE1BQWMsT0FBMEI7QUFDL0QsTUFBSSxjQUFzQixRQUFRO0FBQ2xDLE1BQUksWUFBb0IsTUFBTTtBQUM5QixjQUFZLFlBQVk7QUFFeEIsTUFBRyxZQUFZLEdBQUc7QUFDaEIsZ0JBQVk7QUFBQSxhQUNKLEtBQUssSUFBSTtBQUNqQixnQkFBWTtBQUFBO0FBR2QsTUFBRyxjQUFjLEdBQUc7QUFDbEIsa0JBQWM7QUFBQTtBQUVoQixNQUFHLGNBQWMsV0FBVztBQUMxQixrQkFBYztBQUFBO0FBR2hCLFNBQU8sRUFBQyxNQUFNLGFBQWEsSUFBSTtBQUFBO0FBRzFCLE1BQU0sNEJBQTRCLENBQUMsWUFBb0IsV0FBbUIsT0FBZSxZQUFpQjtBQUMvRyxRQUFNLGVBQXVCLE1BQU0sT0FBTyxHQUFHLE1BQU0sUUFBUTtBQUMzRCxVQUFRLFFBQVEsS0FBSyxPQUFPO0FBQUEsOEJBQ0E7QUFBQSwwQkFDSiwrQkFBK0I7QUFBQTtBQUFBO0FBQUE7QUFJdkQsVUFBUSxRQUFRLEtBQUssR0FBRyxTQUFTO0FBQ2pDLFNBQU87QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K
@@ -0,0 +1,78 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __export = (target, all) => {
26
+ __markAsModule(target);
27
+ for (var name in all)
28
+ __defProp(target, name, { get: all[name], enumerable: true });
29
+ };
30
+ var __reExport = (target, module2, desc) => {
31
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
32
+ for (let key of __getOwnPropNames(module2))
33
+ if (!__hasOwnProp.call(target, key) && key !== "default")
34
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
35
+ }
36
+ return target;
37
+ };
38
+ var __toModule = (module2) => {
39
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
40
+ };
41
+ __export(exports, {
42
+ getLambdaData: () => getLambdaData,
43
+ parseJsonData: () => parseJsonData
44
+ });
45
+ var import_isPlainObject = __toModule(require("lodash/isPlainObject"));
46
+ var import_isString = __toModule(require("lodash/isString"));
47
+ const parseJsonData = (data) => {
48
+ try {
49
+ return JSON.parse(data);
50
+ } catch (error) {
51
+ return data;
52
+ }
53
+ };
54
+ const getLambdaData = (data) => {
55
+ if ((0, import_isPlainObject.default)(data)) {
56
+ const queryData = data.body || data["body-json"];
57
+ const { requestContext, isOffline } = data;
58
+ return {
59
+ body: queryData ? parseJsonData(queryData) : data,
60
+ context: requestContext ? __spreadProps(__spreadValues({}, requestContext), { isOffline }) : { isOffline }
61
+ };
62
+ } else if ((0, import_isString.default)(data)) {
63
+ return {
64
+ body: parseJsonData(data),
65
+ context: {}
66
+ };
67
+ }
68
+ return {
69
+ body: {},
70
+ context: {}
71
+ };
72
+ };
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ getLambdaData,
76
+ parseJsonData
77
+ });
78
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL2F1dGgudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LVByZXNlbnQsIE5pdHJvZ2VuIExhYnMsIEluYy5cbiAqIENvcHlyaWdodHMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBMaWNlbnNlLiBTZWUgdGhlIGFjY29tcGFueWluZyBMSUNFTlNFIGZpbGUgZm9yIHRlcm1zLlxuICovXG5pbXBvcnQgaXNQbGFpbk9iamVjdCBmcm9tICdsb2Rhc2gvaXNQbGFpbk9iamVjdCc7XG5pbXBvcnQgaXNTdHJpbmcgZnJvbSAnbG9kYXNoL2lzU3RyaW5nJztcblxuZXhwb3J0IGNvbnN0IHBhcnNlSnNvbkRhdGEgPSAoZGF0YSk6IGFueSA9PiB7XG4gIHRyeSB7XG4gICAgcmV0dXJuIEpTT04ucGFyc2UoZGF0YSk7XG4gIH0gY2F0Y2goZXJyb3IpIHtcbiAgICByZXR1cm4gZGF0YTtcbiAgfVxufTtcblxuZXhwb3J0IGNvbnN0IGdldExhbWJkYURhdGEgPSAoZGF0YTogYW55KSA9PiB7XG4gIGlmKGlzUGxhaW5PYmplY3QoZGF0YSkpIHtcbiAgICBjb25zdCBxdWVyeURhdGEgPSBkYXRhLmJvZHkgfHwgZGF0YVsnYm9keS1qc29uJ107XG4gICAgY29uc3Qge3JlcXVlc3RDb250ZXh0LCBpc09mZmxpbmV9ID0gZGF0YTtc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FTO0FBQUE7QUFBQTtBQUliLFNBQU87QUFBQSxJQUNMLE1BQU07QUFBQSxJQUNOLFNBQVM7QUFBQTtBQUFBOyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -0,0 +1,40 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ __markAsModule(target);
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __reExport = (target, module2, desc) => {
14
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
+ for (let key of __getOwnPropNames(module2))
16
+ if (!__hasOwnProp.call(target, key) && key !== "default")
17
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
+ }
19
+ return target;
20
+ };
21
+ var __toModule = (module2) => {
22
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
+ };
24
+ __export(exports, {
25
+ getGqlFields: () => getGqlFields
26
+ });
27
+ var import_graphql_fields = __toModule(require("graphql-fields"));
28
+ const getGqlFields = (info) => {
29
+ const fields = (0, import_graphql_fields.default)(info) || {};
30
+ const methodName = Object.keys(fields)[0];
31
+ if (methodName) {
32
+ return Object.keys(fields[methodName]);
33
+ }
34
+ return [];
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ getGqlFields
39
+ });
40
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL2dyYXBocWwudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCBncmFwaHFsRmllbGRzIGZyb20gJ2dyYXBocWwtZmllbGRzJztcblxuZXhwb3J0IGNvbnN0IGdldEdxbEZpZWxkcyA9IChpbmZvKSA9PiB7XG4gIGNvbnN0IGZpZWxkcyA9IGdyYXBocWxGaWVsZHMoaW5mbykgfHwge307XG4gIGNvbnN0IG1ldGhvZE5hbWU6IHN0cmluZyA9IE9iamVjdC5rZXlzKGZpZWxkcylbMF07XG5cbiAgaWYobWV0aG9kTmFtZSkge1xuICAgIHJldHVybiBPYmplY3Qua2V5cyhmaWVsZHNbbWV0aG9kTmFtZV0pO1xuICB9XG5cbiAgcmV0dXJuIFtdO1xufTtcbiJdLAogICJtYXBwaW5ncyI6ICI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7QUFBQTtBQUFBO0FBQUEsNEJBQTBCO0FBRW5CLE1BQU0sZUFBZSxDQUFDLFNBQVM7QUFDcEMsUUFBTSxTQUFTLG1DQUFjLFNBQVM7QUFDdEMsUUFBTSxhQUFxQixPQUFPLEtBQUssUUFBUTtBQUUvQyxNQUFHLFlBQVk7QUFDYixXQUFPLE9BQU8sS0FBSyxPQUFPO0FBQUE7QUFHNUIsU0FBTztBQUFBOyIsCiAgIm5hbWVzIjogW10KfQo=
@@ -3,4 +3,4 @@ export * from './arangodb';
3
3
  export * from './auth';
4
4
  export * from './graphql';
5
5
  export * from './objects';
6
- export * from './redis';
6
+ export * from './session';
@@ -0,0 +1,26 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __reExport = (target, module2, desc) => {
9
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
10
+ for (let key of __getOwnPropNames(module2))
11
+ if (!__hasOwnProp.call(target, key) && key !== "default")
12
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
13
+ }
14
+ return target;
15
+ };
16
+ var __toModule = (module2) => {
17
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
18
+ };
19
+ __markAsModule(exports);
20
+ __reExport(exports, __toModule(require("./analytics")));
21
+ __reExport(exports, __toModule(require("./arangodb")));
22
+ __reExport(exports, __toModule(require("./auth")));
23
+ __reExport(exports, __toModule(require("./graphql")));
24
+ __reExport(exports, __toModule(require("./objects")));
25
+ __reExport(exports, __toModule(require("./session")));
26
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL2luZGV4LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvKipcbiAqIENvcHlyaWdodCAoYykgMjAxOS1QcmVzZW50LCBOaXRyb2dlbiBMYWJzLCBJbmMuXG4gKiBDb3B5cmlnaHRzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgTGljZW5zZS4gU2VlIHRoZSBhY2NvbXBhbnlpbmcgTElDRU5TRSBmaWxlIGZvciB0ZXJtcy5cbiAqL1xuZXhwb3J0ICogZnJvbSAnLi9hbmFseXRpY3MnO1xuZXhwb3J0ICogZnJvbSAnLi9hcmFuZ29kYic7XG5leHBvcnQgKiBmcm9tICcuL2F1dGgnO1xuZXhwb3J0ICogZnJvbSAnLi9ncmFwaHFsJztcbmV4cG9ydCAqIGZyb20gJy4vb2JqZWN0cyc7XG5leHBvcnQgKiBmcm9tICcuL3Nlc3Npb24nO1xuIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7QUFJQSxvQkFBYztBQUNkLG9CQUFjO0FBQ2Qsb0JBQWM7QUFDZCxvQkFBYztBQUNkLG9CQUFjO0FBQ2Qsb0JBQWM7IiwKICAibmFtZXMiOiBbXQp9Cg==
@@ -0,0 +1,53 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ __markAsModule(target);
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __reExport = (target, module2, desc) => {
14
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
+ for (let key of __getOwnPropNames(module2))
16
+ if (!__hasOwnProp.call(target, key) && key !== "default")
17
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
+ }
19
+ return target;
20
+ };
21
+ var __toModule = (module2) => {
22
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
+ };
24
+ __export(exports, {
25
+ defaultObject: () => defaultObject,
26
+ lowerCaseKeys: () => lowerCaseKeys,
27
+ toQueryString: () => toQueryString
28
+ });
29
+ var import_cloneDeep = __toModule(require("lodash/cloneDeep"));
30
+ var import_isPlainObject = __toModule(require("lodash/isPlainObject"));
31
+ var import_mapValues = __toModule(require("lodash/mapValues"));
32
+ const defaultObject = (item) => item || {};
33
+ const lowerCaseKeys = (obj = {}) => {
34
+ const newObj = (0, import_cloneDeep.default)(obj);
35
+ (0, import_mapValues.default)(obj, (value, key = "") => {
36
+ let updatedValue;
37
+ if ((0, import_isPlainObject.default)(value)) {
38
+ updatedValue = lowerCaseKeys(value);
39
+ } else {
40
+ updatedValue = value;
41
+ }
42
+ newObj[key.toLowerCase()] = updatedValue;
43
+ });
44
+ return newObj;
45
+ };
46
+ const toQueryString = (json = {}) => Object.keys(json).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(json[key])}`).join("&");
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ defaultObject,
50
+ lowerCaseKeys,
51
+ toQueryString
52
+ });
53
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL29iamVjdHMudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LVByZXNlbnQsIE5pdHJvZ2VuIExhYnMsIEluYy5cbiAqIENvcHlyaWdodHMgbGljZW5zZWQgdW5kZXIgdGhlIE1JVCBMaWNlbnNlLiBTZWUgdGhlIGFjY29tcGFueWluZyBMSUNFTlNFIGZpbGUgZm9yIHRlcm1zLlxuICovXG5pbXBvcnQgY2xvbmVEZWVwIGZyb20gJ2xvZGFzaC9jbG9uZURlZXAnO1xuaW1wb3J0IGlzUGxhaW5PYmplY3QgZnJvbSAnbG9kYXNoL2lzUGxhaW5PYmplY3QnO1xuaW1wb3J0IG1hcFZhbHVlcyBmcm9tICdsb2Rhc2gvbWFwVmFsdWVzJztcblxuZXhwb3J0IGNvbnN0IGRlZmF1bHRPYmplY3QgPSAoaXRlbTogb2JqZWN0KTogYW55ID0+IGl0ZW0gfHwge307XG5cbmV4cG9ydCBjb25zdCBsb3dlckNhc2VLZXlzID0gKG9iaiA9IHt9KTogb2JqZWN0ID0+IHtcbiAgY29uc3QgbmV3T2JqID0gY2xvbmVEZWVwKG9iaik7XG5cbiAgbWFwVmFsdWVzKG9iai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BQUFBO0FBR0YsTUFBTSxnQkFBZ0IsQ0FBQyxPQUFZLE9BQWUsT0FDdEQsS0FBSyxNQUNMLElBQUksQ0FBQyxRQUFnQixHQUFHLG1CQUFtQixRQUFRLG1CQUFtQixLQUFLLFNBQzNFLEtBQUs7IiwKICAibmFtZXMiOiBbXQp9Cg==
@@ -0,0 +1,18 @@
1
+ export interface Session {
2
+ readonly errors?: string[];
3
+ readonly exp?: number;
4
+ readonly iat?: number;
5
+ readonly username: string;
6
+ readonly userAccess: number;
7
+ readonly userId: string;
8
+ }
9
+ export interface SessionToken {
10
+ readonly expires: number;
11
+ readonly issued: number;
12
+ readonly token: string;
13
+ }
14
+ export interface SessionError {
15
+ readonly errors?: string[];
16
+ }
17
+ export declare const setSession: (session: Session) => string;
18
+ export declare const getSession: (token: string) => any;
@@ -0,0 +1,42 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ __markAsModule(target);
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __reExport = (target, module2, desc) => {
14
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
+ for (let key of __getOwnPropNames(module2))
16
+ if (!__hasOwnProp.call(target, key) && key !== "default")
17
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
+ }
19
+ return target;
20
+ };
21
+ var __toModule = (module2) => {
22
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
+ };
24
+ __export(exports, {
25
+ getSession: () => getSession,
26
+ setSession: () => setSession
27
+ });
28
+ var import_jsonwebtoken = __toModule(require("jsonwebtoken"));
29
+ const setSession = (session) => import_jsonwebtoken.default.sign(session, process.env.SESSION_SECRET);
30
+ const getSession = (token) => {
31
+ try {
32
+ return import_jsonwebtoken.default.verify(token, process.env.SESSION_SECRET);
33
+ } catch (error) {
34
+ return { errors: [error.message] };
35
+ }
36
+ };
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ getSession,
40
+ setSession
41
+ });
42
+ //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3V0aWxzL3Nlc3Npb24udHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCBqd3QgZnJvbSAnanNvbndlYnRva2VuJztcblxuZXhwb3J0IGludGVyZmFjZSBTZXNzaW9uIHtcbiAgcmVhZG9ubHkgZXJyb3JzPzogc3RyaW5nW107XG4gIHJlYWRvbmx5IGV4cD86IG51bWJlcjtcbiAgcmVhZG9ubHkgaWF0PzogbnVtYmVyO1xuICByZWFkb25seSB1c2VybmFtZTogc3RyaW5nO1xuICByZWFkb25seSB1c2VyQWNjZXNzOiBudW1iZXI7XG4gIHJlYWRvbmx5IHVzZXJJZDogc3RyaW5nO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIFNlc3Npb25Ub2tlbiB7XG4gIHJlYWRvbmx5IGV4cGlyZXM6IG51bWJlcjtcbiAgcmVhZG9ubHkgaXNzdWVkOiBudW1iZXI7XG4gIHJlYWRvbmx5IHRva2VuOiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgU2Vzc2lvbkVycm9yIHtcbiAgcmVhZG9ubHkgZXJyb3JzPzogc3RyaW5nW107XG59XG5cbmV4cG9ydCBjb25zdCBzZXRTZXNzaW9uID0gKHNlc3Npb246IFNlc3Npb24pOiBzdHJpbmcgPT4gand0LnNpZ24oc2Vzc2lvbiwgcHJvY2Vzcy5lbnYuU0VTU0lPTl9TRUNSRVQpO1xuXG5leHBvcnQgY29uc3QgZ2V0U2Vzc2lvbiA9ICh0b2tlbjogc3RyaW5nKSA9PiB7XG4gIHRyeSB7XG4gICAgcmV0dXJuIGp3dC52ZXJpZnkodG9rZW4sIHByb2Nlc3MuZW52LlNFU1NJT05fU0VDUkVUKTtcbiAgfSBjYXRjaChlcnJvcikge1xuICAgIHJldHVybiB7ZXJyb3JzOiBbZXJyb3IubWVzc2FnZV19O1xuICB9XG59O1xuIl0sCiAgIm1hcHBpbmdzIjogIjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBLDBCQUFnQjtBQXFCVCxNQUFNLGFBQWEsQ0FBQyxZQUE2Qiw0QkFBSSxLQUFLLFNBQVMsUUFBUSxJQUFJO0FBRS9FLE1BQU0sYUFBYSxDQUFDLFVBQWtCO0FBQzNDLE1BQUk7QUFDRixXQUFPLDRCQUFJLE9BQU8sT0FBTyxRQUFRLElBQUk7QUFBQSxXQUMvQixPQUFOO0FBQ0EsV0FBTyxFQUFDLFFBQVEsQ0FBQyxNQUFNO0FBQUE7QUFBQTsiLAogICJuYW1lcyI6IFtdCn0K
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@nlabs/reaktor",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Reaktor",
5
- "main": "./index.js",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
6
7
  "types": "./lib/index.d.js",
7
8
  "keywords": [
8
9
  "reaktor",
@@ -35,49 +36,50 @@
35
36
  "publish:patch": "npm version patch && npm run publish:tags && npm publish",
36
37
  "publish:tags": "git push --tags && git push origin HEAD",
37
38
  "test": "stage=test jest",
38
- "update": "lex update -i"
39
+ "update": "lex update -i",
40
+ "watch": "lex compile -r -w"
39
41
  },
40
42
  "dependencies": {
41
- "@nlabs/arkhamjs": "^3.17.5",
42
- "@nlabs/rip-hunter": "^2.0.3",
43
- "@nlabs/utils": "^1.3.0",
43
+ "@nlabs/arkhamjs": "^3.22.0",
44
+ "@nlabs/rip-hunter": "^2.5.2",
45
+ "@nlabs/utils": "^1.4.1",
44
46
  "apn": "^2.2.0",
45
- "arangojs": "^6.14.1",
46
- "aws-sdk": "^2.700.0",
47
- "core-js": "^3.6.5",
48
- "file-type": "^14.6.2",
47
+ "arangojs": "^7.5.0",
48
+ "aws-sdk": "^2.980.0",
49
+ "core-js": "^3.16.4",
50
+ "file-type": "^16.5.3",
49
51
  "gm": "^1.23.1",
50
- "google-libphonenumber": "^3.2.10",
51
- "googleapis": "^52.1.0",
52
- "graphql": "^15.1.0",
52
+ "google-libphonenumber": "^3.2.22",
53
+ "googleapis": "^85.0.0",
54
+ "graphql": "^15.5.2",
53
55
  "graphql-errors": "^2.1.0",
54
56
  "graphql-fields": "^2.0.3",
55
- "hiredis": "^0.5.0",
56
- "lodash": "^4.17.15",
57
- "luxon": "^1.24.1",
58
- "node-yelp": "0.0.3",
57
+ "jsonwebtoken": "^8.5.1",
58
+ "lodash": "^4.17.21",
59
+ "luxon": "^2.0.2",
60
+ "mime-types": "^2.1.32",
61
+ "node-yelp": "^0.0.2",
59
62
  "numeral": "^2.0.6",
60
- "redis": "^3.0.2",
61
- "request-promise": "^4.2.5",
62
- "stripe": "^8.64.0",
63
+ "request-promise": "^4.2.6",
64
+ "stripe": "^8.172.0",
63
65
  "to": "^0.2.9",
64
- "twilio": "^3.46.0",
66
+ "twilio": "^3.67.1",
65
67
  "typed-promisify": "^0.4.0",
66
- "universal-analytics": "^0.4.20",
68
+ "universal-analytics": "^0.4.23",
67
69
  "update": "^0.7.4"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@types/graphql": "^14.5.0",
71
- "@types/history": "^4.7.6",
72
- "@types/jest": "^26.0.0",
73
- "@types/luxon": "^1.24.0",
74
- "@types/node": "^13.13.4",
75
- "@types/stripe": "^7.13.23",
76
- "@types/twilio": "^2.11.0",
77
- "eslint": "^7.2.0",
78
- "eslint-config-styleguidejs": "^1.3.4",
79
- "graphql-tools": "^6.0.10",
80
- "source-map-loader": "^1.0.0",
81
- "typescript": "^3.9.5"
73
+ "@types/history": "^4.7.9",
74
+ "@types/jest": "^27.0.1",
75
+ "@types/luxon": "^2.0.2",
76
+ "@types/node": "^16.7.10",
77
+ "@types/stripe": "^8.0.416",
78
+ "@types/twilio": "^3.19.2",
79
+ "eslint": "^7.32.0",
80
+ "eslint-config-styleguidejs": "^1.5.3",
81
+ "graphql-tools": "^8.2.0",
82
+ "source-map-loader": "^3.0.0",
83
+ "typescript": "^4.4.2"
82
84
  }
83
85
  }
@@ -1,8 +0,0 @@
1
- import { ApiContext } from 'types/auth';
2
- import { ConversationType } from '../types';
3
- export declare const getConversationList: (context: ApiContext, from: number, to: number) => Promise<ConversationType[]>;
4
- export declare const getDirectConversation: (context: ApiContext, userId: string) => Promise<ConversationType>;
5
- export declare const getConversation: (context: ApiContext, convoId: string) => Promise<ConversationType>;
6
- export declare const updateConversation: (context: ApiContext, conversation: any) => Promise<ConversationType>;
7
- export declare const addUserToConversation: (context: ApiContext, convoId: string, userId: string) => Promise<any>;
8
- export declare const removeUserToConversation: (context: ApiContext, convoId: string, userId: string) => Promise<any>;
@@ -1,21 +0,0 @@
1
- /// <reference types="node" />
2
- import { PutObjectRequest } from 'aws-sdk/clients/s3';
3
- import { ApiContext, AppCollectionTypes, ArangoDBLimit, ImageEdgeType, ImageOptions, ImageType, ImageUrlData } from '../types';
4
- export declare const parseImageOptions: (options?: ImageOptions) => {
5
- limit: ArangoDBLimit;
6
- type: string;
7
- };
8
- export declare const getImageOptional: (fields: string[]) => any;
9
- export declare const getImageListByUser: (context: ApiContext, userId: string, from: number, to: number) => Promise<ImageType[]>;
10
- export declare const getImageListByLink: (context: ApiContext, itemId: string, itemType: AppCollectionTypes, options: ImageOptions) => Promise<ImageType[]>;
11
- export declare const getImageListByGroup: (context: ApiContext, params: any) => Promise<ImageType[]>;
12
- export declare const getImage: (context: ApiContext, id: string) => Promise<ImageType>;
13
- export declare const getPathUserImages: (sub: string, imgId: string, type: string, dir?: string) => string;
14
- export declare const getAppImageUrl: (data: ImageUrlData) => string;
15
- export declare const getUserImageUrl: (data: ImageUrlData) => string;
16
- export declare const getSavedImages: (context: ApiContext, params: any) => Promise<any>;
17
- export declare const resizeSaveImage: (context: ApiContext, imgId: string, buffer: Buffer, type?: string, s3Options?: PutObjectRequest) => Promise<ImageType>;
18
- export declare const addImage: (context: ApiContext, image: ImageType, s3Options: PutObjectRequest) => Promise<ImageType>;
19
- export declare const addImageEdge: (context: ApiContext, imageEdge: ImageEdgeType) => Promise<object>;
20
- export declare const updateImage: (context: ApiContext, item: ImageType, s3Options: PutObjectRequest) => Promise<ImageType>;
21
- export declare const deleteImage: (context: ApiContext, imgId: string) => Promise<ImageType>;
@@ -1,9 +0,0 @@
1
- import { ApiContext } from '../types/auth';
2
- import { MessageInputType, MessageType } from '../types/messages';
3
- export declare const getMessageList: (context: ApiContext, convoId: string, from: number, to: number) => Promise<MessageType[]>;
4
- export declare const updateMessage: (context: ApiContext, message: MessageInputType) => Promise<MessageType>;
5
- export declare const saveMessage: (context: ApiContext, msgId: string, convoId: string) => Promise<MessageType>;
6
- export declare const unsaveMessage: (context: ApiContext, msgId: string, convoId: string) => Promise<MessageType>;
7
- export declare const deleteMessage: (context: ApiContext, msgId: string, convoId: string) => Promise<MessageType>;
8
- export declare const getMessage: (data: MessageType) => MessageType;
9
- export declare const cleanMessages: (database: string) => Promise<number>;
@@ -1,23 +0,0 @@
1
- import { Database } from 'arangojs';
2
- import { ApiContext, FileType, PostOptions, PostType } from '../types';
3
- export declare const parsePostOptions: (options?: PostOptions) => {
4
- latitude: number;
5
- limit: import("../types").ArangoDBLimit;
6
- longitude: number;
7
- type: string;
8
- };
9
- export declare const getPostOptional: (fields: string[], sessionId: string) => any;
10
- export declare const getPost: (context: ApiContext, itemId: string) => Promise<PostType>;
11
- export declare const getPostList: (context: ApiContext, options?: PostOptions) => Promise<PostType[]>;
12
- export declare const getPostsByArea: (context: ApiContext, latitude: number, longitude: number, options?: PostOptions) => Promise<PostType[]>;
13
- export declare const getPostsByGroup: (context: ApiContext, groupId: string, options?: PostOptions) => Promise<PostType[]>;
14
- export declare const getPostsByLatest: (context: ApiContext, options?: PostOptions) => Promise<PostType[]>;
15
- export declare const getPostsByReaction: (context: ApiContext, reactionName: string, options?: PostOptions) => Promise<PostType>;
16
- export declare const getPostsByTags: (context: ApiContext, tagNames: string[], options?: PostOptions) => Promise<PostType[]>;
17
- export declare const getPostsByUser: (context: ApiContext, userId: string, options?: PostOptions) => Promise<PostType[]>;
18
- export declare const getPostComments: (context: ApiContext, itemId: string, options?: PostOptions) => Promise<PostType[]>;
19
- export declare const addPost: (context: ApiContext, item: PostType) => Promise<PostType>;
20
- export declare const updatePost: (context: ApiContext, item: PostType) => Promise<PostType>;
21
- export declare const deletePost: (context: ApiContext, itemId: string) => Promise<PostType>;
22
- export declare const cleanPosts: (database: string) => Promise<number>;
23
- export declare const createPostEdge: (db: Database, file: FileType, postId: string) => Promise<FileType>;
@@ -1,14 +0,0 @@
1
- import { ApiContext, ReactionDirection, ReactionOptions, ReactionType, UserReactionQuery, UserType } from '../types';
2
- export declare const parseReactionOptions: (options?: ReactionOptions) => {
3
- limit: import("../types").ArangoDBLimit;
4
- };
5
- export declare const addReaction: (context: ApiContext, itemId: string, itemType?: string, reaction?: ReactionType, allowDuplicate?: boolean) => Promise<ReactionType>;
6
- export declare const removeReaction: (context: ApiContext, reactionId: string) => Promise<ReactionType>;
7
- export declare const removeReactionByItem: (context: ApiContext, itemId: string, itemType: string, reactionName: string) => Promise<ReactionType>;
8
- export declare const updateReaction: (context: ApiContext, reaction?: ReactionType) => Promise<ReactionType>;
9
- export declare const getReactionCount: (context: ApiContext, itemId: string, itemType: string, reactionName: string) => Promise<ReactionType>;
10
- export declare const getReactionCountByUser: (context: ApiContext, itemId: string, itemType: string, reactionName: string) => Promise<ReactionType[]>;
11
- export declare const getGroupUsersByReaction: (context: ApiContext, params?: UserReactionQuery) => Promise<UserType[]>;
12
- export declare const getReactionsByItem: (context: ApiContext, itemId: string, itemType: string, reactionName: string, options: ReactionOptions) => Promise<UserType[]>;
13
- export declare const getItemsByReaction: (context: ApiContext, itemId: string, itemType: string, reactionName: string, options: ReactionOptions) => Promise<ReactionType[]>;
14
- export declare const hasReaction: (context: ApiContext, itemId: string, itemType: string, reactionName: string, direction?: ReactionDirection) => Promise<boolean>;
@@ -1,14 +0,0 @@
1
- import { Database } from 'arangojs';
2
- import { ApiContext } from '../types/auth';
3
- import { PostType } from '../types/posts';
4
- import { TagType } from '../types/tags';
5
- export declare const getTagList: (context: ApiContext, from?: number, to?: number) => Promise<TagType[]>;
6
- export declare const getTag: (context: ApiContext, tagId: string) => Promise<TagType>;
7
- export declare const addTag: (context: ApiContext, tag: TagType) => Promise<TagType>;
8
- export declare const tagPost: (context: ApiContext, tagId: any, postId: any) => Promise<PostType>;
9
- export declare const updateTag: (context: ApiContext, item?: TagType) => Promise<TagType>;
10
- export declare const deleteTag: (context: ApiContext, tagId: string) => Promise<TagType>;
11
- export declare const createTag: (db: Database, tagName: string) => Promise<TagType>;
12
- export declare const createTagEdge: (db: Database, tag: TagType, itemType: string, itemId: string) => Promise<TagType>;
13
- export declare const linkTags: (db: Database, tagNames: string[], itemType: string, itemId: string) => Promise<TagType[]>;
14
- export declare const extractTags: (db: Database, itemType: string, itemId: any, content: any) => Promise<TagType[]>;
@@ -1,17 +0,0 @@
1
- import { ApiContext } from '../types/auth';
2
- import { UserOptions, UserType } from '../types/users';
3
- export declare const getUserOptional: (fields: string[]) => any;
4
- export declare const parseUserOptions: (options?: UserOptions) => {
5
- limit: import("..").ArangoDBLimit;
6
- };
7
- export declare const addUser: (context: ApiContext, user: UserType) => Promise<UserType>;
8
- export declare const updateUser: (context: ApiContext, user: UserType) => Promise<UserType>;
9
- export declare const deleteUser: (context: ApiContext, userId: string) => Promise<UserType>;
10
- export declare const deactivateUser: (context: ApiContext, userId: string) => Promise<UserType>;
11
- export declare const getSessionUser: (context: ApiContext) => Promise<UserType>;
12
- export declare const getUser: (context: ApiContext, userId: string) => Promise<UserType>;
13
- export declare const getUserList: (context: ApiContext, options?: UserOptions) => Promise<UserType>;
14
- export declare const getUsersByReaction: (context: ApiContext, reactionName: string, options?: UserOptions) => Promise<UserType>;
15
- export declare const getUsersByRecent: (context: ApiContext, options?: UserOptions) => Promise<UserType>;
16
- export declare const getUsersByUsername: (context: ApiContext, query: string, options?: UserOptions) => Promise<UserType>;
17
- export declare const getDisplayName: (user?: UserType) => string;