@replyke/core 6.0.4 → 6.0.6

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.
@@ -8,5 +8,6 @@ declare function useFetchManyComments(): (props: {
8
8
  page: number;
9
9
  limit?: number;
10
10
  includeEntity?: boolean;
11
+ sourceId?: string | null | undefined;
11
12
  }) => Promise<Comment[]>;
12
13
  export default useFetchManyComments;
@@ -46,11 +46,11 @@ function useFetchManyComments() {
46
46
  var _this = this;
47
47
  var projectId = (0, useProject_1.default)().projectId;
48
48
  var fetchComments = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
49
- var entityId, userId, parentId, sortBy, page, limit, includeEntity, response;
49
+ var entityId, userId, parentId, sortBy, page, limit, includeEntity, sourceId, params, response;
50
50
  return __generator(this, function (_a) {
51
51
  switch (_a.label) {
52
52
  case 0:
53
- entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, includeEntity = props.includeEntity;
53
+ entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, includeEntity = props.includeEntity, sourceId = props.sourceId;
54
54
  if (page === 0) {
55
55
  throw new Error("Can't fetch comments with page 0");
56
56
  }
@@ -60,21 +60,26 @@ function useFetchManyComments() {
60
60
  if (!sortBy) {
61
61
  throw new Error("Can't fetch without sortBy property");
62
62
  }
63
- if (!entityId && !userId && !parentId)
64
- throw new Error("Either entityId, userId or parentId properties are required to fetch comments");
65
63
  if (!projectId) {
66
64
  throw new Error("No project specified");
67
65
  }
66
+ params = {
67
+ sortBy: sortBy,
68
+ page: page,
69
+ limit: limit,
70
+ };
71
+ if (entityId)
72
+ params.entityId = entityId;
73
+ if (userId)
74
+ params.userId = userId;
75
+ if (parentId)
76
+ params.parentId = parentId;
77
+ if (includeEntity)
78
+ params.includeEntity = includeEntity;
79
+ if (sourceId)
80
+ params.sourceId = sourceId;
68
81
  return [4 /*yield*/, axios_1.default.get("/".concat(projectId, "/comments"), {
69
- params: {
70
- entityId: entityId,
71
- userId: userId,
72
- parentId: parentId,
73
- sortBy: sortBy,
74
- page: page,
75
- limit: limit,
76
- includeEntity: includeEntity,
77
- },
82
+ params: params,
78
83
  })];
79
84
  case 1:
80
85
  response = _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AAGpC,sEAAgD;AAChD,6DAAuC;AAEvC,SAAS,oBAAoB;IAA7B,iBAsDC;IArDS,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAO,KAQN;;;;;oBACS,QAAQ,GACd,KAAK,SADS,EAAE,MAAM,GACtB,KAAK,OADiB,EAAE,QAAQ,GAChC,KAAK,SAD2B,EAAE,MAAM,GACxC,KAAK,OADmC,EAAE,IAAI,GAC9C,KAAK,KADyC,EAAE,KAAK,GACrD,KAAK,MADgD,EAAE,aAAa,GACpE,KAAK,cAD+D,CAC9D;oBAER,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;oBACtD,CAAC;oBAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;wBAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;oBAC9C,CAAC;oBAED,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;oBACzD,CAAC;oBAED,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;wBACnC,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;oBAEJ,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAEgB,qBAAM,eAAK,CAAC,GAAG,CAAC,WAAI,SAAS,cAAW,EAAE;4BACzD,MAAM,EAAE;gCACN,QAAQ,UAAA;gCACR,MAAM,QAAA;gCACN,QAAQ,UAAA;gCACR,MAAM,QAAA;gCACN,IAAI,MAAA;gCACJ,KAAK,OAAA;gCACL,aAAa,eAAA;6BACd;yBACF,CAAC,EAAA;;oBAVI,QAAQ,GAAG,SAUf;oBACF,sBAAO,QAAQ,CAAC,IAAiB,EAAC;;;SACnC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AAGpC,sEAAgD;AAChD,6DAAuC;AAEvC,SAAS,oBAAoB;IAA7B,iBA8DC;IA7DS,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAO,KASN;;;;;oBAEG,QAAQ,GAQN,KAAK,SARC,EACR,MAAM,GAOJ,KAAK,OAPD,EACN,QAAQ,GAMN,KAAK,SANC,EACR,MAAM,GAKJ,KAAK,OALD,EACN,IAAI,GAIF,KAAK,KAJH,EACJ,KAAK,GAGH,KAAK,MAHF,EACL,aAAa,GAEX,KAAK,cAFM,EACb,QAAQ,GACN,KAAK,SADC,CACA;oBAEV,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;oBACtD,CAAC;oBAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;wBAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;oBAC9C,CAAC;oBAED,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;oBACzD,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAEK,MAAM,GAAwB;wBAClC,MAAM,QAAA;wBACN,IAAI,MAAA;wBACJ,KAAK,OAAA;qBACN,CAAC;oBAEF,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBACzC,IAAI,MAAM;wBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;oBACnC,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBACzC,IAAI,aAAa;wBAAE,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;oBACxD,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBAExB,qBAAM,eAAK,CAAC,GAAG,CAAC,WAAI,SAAS,cAAW,EAAE;4BACzD,MAAM,QAAA;yBACP,CAAC,EAAA;;oBAFI,QAAQ,GAAG,SAEf;oBACF,sBAAO,QAAQ,CAAC,IAAiB,EAAC;;;SACnC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,kBAAe,oBAAoB,CAAC"}
@@ -8,5 +8,6 @@ declare function useFetchManyComments(): (props: {
8
8
  page: number;
9
9
  limit?: number;
10
10
  includeEntity?: boolean;
11
+ sourceId?: string | null | undefined;
11
12
  }) => Promise<Comment[]>;
12
13
  export default useFetchManyComments;
@@ -41,11 +41,11 @@ function useFetchManyComments() {
41
41
  var _this = this;
42
42
  var projectId = useProject().projectId;
43
43
  var fetchComments = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
44
- var entityId, userId, parentId, sortBy, page, limit, includeEntity, response;
44
+ var entityId, userId, parentId, sortBy, page, limit, includeEntity, sourceId, params, response;
45
45
  return __generator(this, function (_a) {
46
46
  switch (_a.label) {
47
47
  case 0:
48
- entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, includeEntity = props.includeEntity;
48
+ entityId = props.entityId, userId = props.userId, parentId = props.parentId, sortBy = props.sortBy, page = props.page, limit = props.limit, includeEntity = props.includeEntity, sourceId = props.sourceId;
49
49
  if (page === 0) {
50
50
  throw new Error("Can't fetch comments with page 0");
51
51
  }
@@ -55,21 +55,26 @@ function useFetchManyComments() {
55
55
  if (!sortBy) {
56
56
  throw new Error("Can't fetch without sortBy property");
57
57
  }
58
- if (!entityId && !userId && !parentId)
59
- throw new Error("Either entityId, userId or parentId properties are required to fetch comments");
60
58
  if (!projectId) {
61
59
  throw new Error("No project specified");
62
60
  }
61
+ params = {
62
+ sortBy: sortBy,
63
+ page: page,
64
+ limit: limit,
65
+ };
66
+ if (entityId)
67
+ params.entityId = entityId;
68
+ if (userId)
69
+ params.userId = userId;
70
+ if (parentId)
71
+ params.parentId = parentId;
72
+ if (includeEntity)
73
+ params.includeEntity = includeEntity;
74
+ if (sourceId)
75
+ params.sourceId = sourceId;
63
76
  return [4 /*yield*/, axios.get("/".concat(projectId, "/comments"), {
64
- params: {
65
- entityId: entityId,
66
- userId: userId,
67
- parentId: parentId,
68
- sortBy: sortBy,
69
- page: page,
70
- limit: limit,
71
- includeEntity: includeEntity,
72
- },
77
+ params: params,
73
78
  })];
74
79
  case 1:
75
80
  response = _a.sent();
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,UAAU,MAAM,wBA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AAC,IAAiB,EAAC;;;SACnC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useFetchManyComments.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useFetchManyComments.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC,SAAS,oBAAoB;IAA7B,iBA8DC;IA7DS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,aAAa,GAAG,WAAW,CAC/B,UAAO,KASN;;;;;oBAEG,QAAQ,GAQN,KAAK,SARC,EACR,MAAM,GAOJ,KAAK,OAPD,EACN,QAAQ,GAMN,KAAK,SANC,EACR,MAAM,GAKJ,KAAK,OALD,EACN,IAAI,GAIF,KAAK,KAJH,EACJ,KAAK,GAGH,KAAK,MAHF,EACL,aAAa,GAEX,KAAK,cAFM,EACb,QAAQ,GACN,KAAK,SADC,CACA;oBAEV,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;oBACtD,CAAC;oBAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;wBAChB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;oBAC9C,CAAC;oBAED,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;oBACzD,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAEK,MAAM,GAAwB;wBAClC,MAAM,QAAA;wBACN,IAAI,MAAA;wBACJ,KAAK,OAAA;qBACN,CAAC;oBAEF,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBACzC,IAAI,MAAM;wBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;oBACnC,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBACzC,IAAI,aAAa;wBAAE,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;oBACxD,IAAI,QAAQ;wBAAE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;oBAExB,qBAAM,KAAK,CAAC,GAAG,CAAC,WAAI,SAAS,cAAW,EAAE;4BACzD,MAAM,QAAA;yBACP,CAAC,EAAA;;oBAFI,QAAQ,GAAG,SAEf;oBACF,sBAAO,QAAQ,CAAC,IAAiB,EAAC;;;SACnC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,eAAe,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@replyke/core",
3
- "version": "6.0.4",
3
+ "version": "6.0.6",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "author": "Replyke, maintained by Yanay Tsabary",