revdev 0.48.0 → 0.50.0

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.
@@ -5,10 +5,10 @@ export interface FeList {
5
5
  languageCode: string;
6
6
  name: string;
7
7
  wordCount: number;
8
+ knownWordCount: number;
8
9
  userCount: number;
9
10
  contribution: FeEntityContribution;
10
11
  access: FeEntityAccess;
11
- knowing: FeWordKnowing;
12
12
  }
13
13
  export interface FeListLinkWordRequest {
14
14
  listId: string;
@@ -10,10 +10,10 @@ export interface FeTable {
10
10
  languageCode: string;
11
11
  name: string;
12
12
  wordCount: number;
13
+ knownWordCount: number;
13
14
  userCount: number;
14
15
  contribution: FeEntityContribution;
15
16
  access: FeEntityAccess;
16
- knowing: FeWordKnowing;
17
17
  }
18
18
  export interface FeCell extends BasicCellStruct<FeWord[]> {
19
19
  }
@@ -5,7 +5,7 @@ export interface FeCreateTagRequest {
5
5
  export interface FeTag {
6
6
  code: string;
7
7
  wordCount: number;
8
- knowing: FeWordKnowing;
8
+ knownWordCount: number;
9
9
  }
10
10
  export interface FeTagLinkWordRequest {
11
11
  tagCode: string;
@@ -1,7 +1,7 @@
1
1
  import { EntityWithCount, Feed } from "../feed";
2
2
  declare function empty<TItem = any>(): Feed<TItem>;
3
3
  declare function pageSkip(skip: number, page: number | undefined, take: number): number;
4
- declare function newFeed<TItem = any>(data: (TItem & EntityWithCount)[], oldSkip?: number): Feed<TItem>;
4
+ declare function newFeed<TItem extends EntityWithCount>(data: TItem[], oldSkip?: number): Feed<Omit<TItem, "count">>;
5
5
  declare function newFeed<TItem = any>(data: TItem[], oldSkip: number, all: number): Feed<TItem>;
6
6
  export declare const FeedUtil: {
7
7
  combine: (prevFeed?: Feed<any> | undefined, newFeed?: Feed<any> | undefined) => Feed;
package/lib/utils/feed.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
14
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
4
15
  to[j] = from[i];
@@ -35,8 +46,12 @@ function newFeed(data, p1, p2) {
35
46
  // oldSkip
36
47
  oldSkip = p1;
37
48
  }
49
+ var newData = data.every(function (x) { return x.count === total; }) ? data.map(function (_a) {
50
+ var _c = _a.count, x = __rest(_a, ["count"]);
51
+ return x;
52
+ }) : data;
38
53
  return {
39
- data: data,
54
+ data: newData,
40
55
  skip: oldSkip + data.length,
41
56
  total: total,
42
57
  };
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  var feed_1 = require("../feed");
4
15
  var ITEM_COUNT = 5;
@@ -12,6 +23,12 @@ for (var i = 0; i < ITEM_COUNT; i++) {
12
23
  function testFeed(newFeed, matchFeed) {
13
24
  expect(newFeed).toMatchObject(matchFeed);
14
25
  }
26
+ function cleanCount(data) {
27
+ return data.map(function (_a) {
28
+ var _c = _a.count, x = __rest(_a, ["count"]);
29
+ return x;
30
+ });
31
+ }
15
32
  describe("feed", function () {
16
33
  test("empty", function () {
17
34
  testFeed(feed_1.FeedUtil.empty(), {
@@ -27,14 +44,22 @@ describe("feed", function () {
27
44
  });
28
45
  test("newFeed: 1 param", function () {
29
46
  testFeed(feed_1.FeedUtil.new(data), {
30
- data: data,
47
+ data: cleanCount(data),
48
+ skip: ITEM_COUNT,
49
+ total: ITEM_COUNT,
50
+ });
51
+ });
52
+ test("newFeed: 1 param: no count", function () {
53
+ var feed = feed_1.FeedUtil.new(data);
54
+ testFeed(feed, {
55
+ data: cleanCount(data),
31
56
  skip: ITEM_COUNT,
32
57
  total: ITEM_COUNT,
33
58
  });
34
59
  });
35
60
  test("newFeed: 2 params", function () {
36
61
  testFeed(feed_1.FeedUtil.new(data, 10), {
37
- data: data,
62
+ data: cleanCount(data),
38
63
  skip: 10 + ITEM_COUNT,
39
64
  total: ITEM_COUNT,
40
65
  });
@@ -42,14 +67,23 @@ describe("feed", function () {
42
67
  test("newFeed: 3 params", function () {
43
68
  var total = 100;
44
69
  testFeed(feed_1.FeedUtil.new(data, 0, total), {
45
- data: data,
70
+ data: cleanCount(data),
46
71
  skip: ITEM_COUNT,
47
72
  total: total,
48
73
  });
49
74
  testFeed(feed_1.FeedUtil.new(data, 10, total), {
50
- data: data,
75
+ data: cleanCount(data),
51
76
  skip: 10 + ITEM_COUNT,
52
77
  total: total,
53
78
  });
54
79
  });
80
+ test("newFeed: 3 params; no count", function () {
81
+ var total = 100;
82
+ var feedData = cleanCount(data);
83
+ testFeed(feed_1.FeedUtil.new(feedData, 0, total), {
84
+ data: feedData,
85
+ skip: ITEM_COUNT,
86
+ total: total,
87
+ });
88
+ });
55
89
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",