revdev 0.50.0 → 0.52.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.
@@ -3,12 +3,13 @@ import { FeLanguage } from "../language";
3
3
  import { FeList } from "../list";
4
4
  import { FeTable } from "../table";
5
5
  import { FeWord } from "../word";
6
- export interface FeWordKnowing {
6
+ export interface FeWordKnowledge {
7
7
  total: number;
8
8
  learn: number;
9
9
  known: number;
10
10
  unknown: number;
11
11
  }
12
+ export declare type FeWordKnowing = [number, number];
12
13
  export interface FeWordDirect {
13
14
  id: string;
14
15
  text: string;
@@ -1,5 +1,5 @@
1
1
  import { Knowing } from "../../general";
2
- import { FeWordKnowing } from "../common";
2
+ import { FeWordKnowledge } from "../common";
3
3
  import { FeWord } from "../word";
4
4
  export interface FeDiscoverProveData {
5
5
  word: FeWord;
@@ -8,16 +8,16 @@ export interface FeDiscoverProveData {
8
8
  }
9
9
  export interface FeDiscoverKnowingOld {
10
10
  words?: [string, Knowing][];
11
- tags?: [string, string, FeWordKnowing][];
12
- lists?: [string, FeWordKnowing][];
13
- tables?: [string, FeWordKnowing][];
14
- languages?: [string, FeWordKnowing][];
11
+ tags?: [string, string, FeWordKnowledge][];
12
+ lists?: [string, FeWordKnowledge][];
13
+ tables?: [string, FeWordKnowledge][];
14
+ languages?: [string, FeWordKnowledge][];
15
15
  }
16
- export interface FeEntityKnowing extends FeWordKnowing {
16
+ export interface FeEntityKnowing extends FeWordKnowledge {
17
17
  id: string;
18
18
  text: string;
19
19
  }
20
- export interface FeDiscoverMeta extends FeWordKnowing {
20
+ export interface FeDiscoverMeta extends FeWordKnowledge {
21
21
  columns: FeEntityKnowing[];
22
22
  }
23
23
  export interface ProveWordMeta extends FeWord {
@@ -1,4 +1,3 @@
1
- import { FeWordKnowing } from "..";
2
1
  import { Feed } from "../../feed";
3
2
  import { FeList } from "../list";
4
3
  import { FeTable } from "../table";
@@ -6,7 +5,8 @@ import { FeTag } from "../tag";
6
5
  import { FeUserRelationMeta } from "../user";
7
6
  export interface FeLanguage {
8
7
  code: string;
9
- knowing: FeWordKnowing;
8
+ wordCount: number;
9
+ knownWordCount: number;
10
10
  listCount: number;
11
11
  tableCount: number;
12
12
  tagCount: number;
@@ -1,4 +1,4 @@
1
- import { FeEntityAccess, FeEntityContribution, FeWordKnowing, EntryWord } from "../common";
1
+ import { FeEntityAccess, FeEntityContribution, EntryWord } from "../common";
2
2
  export interface FeList {
3
3
  id: string;
4
4
  slug: string;
@@ -24,7 +24,8 @@ export interface FeListEntity {
24
24
  metaKeywords?: string;
25
25
  contribution: FeEntityContribution;
26
26
  access: FeEntityAccess;
27
- knowing: FeWordKnowing;
27
+ wordCount: number;
28
+ knownWordCount: number;
28
29
  }
29
30
  export interface FeCreateListRequest {
30
31
  name: string;
@@ -1,4 +1,4 @@
1
- import { FeEntityAccess, FeEntityContribution, FeWordKnowing, RealWord } from "../common";
1
+ import { FeEntityAccess, FeEntityContribution, RealWord } from "../common";
2
2
  import { FeWord } from "../word";
3
3
  export interface BasicCellStruct<TWords> {
4
4
  columnIndex: number;
@@ -30,7 +30,8 @@ export interface FeTableEntity {
30
30
  metaKeywords: string;
31
31
  access: FeEntityAccess;
32
32
  contribution: FeEntityContribution;
33
- knowing: FeWordKnowing;
33
+ wordCount: number;
34
+ knownWordCount: number;
34
35
  columns: string[];
35
36
  }
36
37
  export interface FeCellInfo extends BasicCellStruct<RealWord[]> {
@@ -1,4 +1,4 @@
1
- import { FeEntityContribution, FeWordKnowing, EntryWord } from "../common";
1
+ import { FeEntityContribution, EntryWord } from "../common";
2
2
  export interface FeCreateTagRequest {
3
3
  code: string;
4
4
  }
@@ -17,5 +17,6 @@ export interface FeTagEntity {
17
17
  code: string;
18
18
  languageCode: string;
19
19
  contribution: FeEntityContribution;
20
- knowing: FeWordKnowing;
20
+ wordCount: number;
21
+ knownWordCount: number;
21
22
  }
@@ -1,8 +1,7 @@
1
- import { EntityWithCount, Feed } from "../feed";
1
+ import { 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 extends EntityWithCount>(data: TItem[], oldSkip?: number): Feed<Omit<TItem, "count">>;
5
- declare function newFeed<TItem = any>(data: TItem[], oldSkip: number, all: number): Feed<TItem>;
4
+ declare function newFeed<TItem = any>(data: TItem[], skip: number, total: number): Feed<TItem>;
6
5
  export declare const FeedUtil: {
7
6
  combine: (prevFeed?: Feed<any> | undefined, newFeed?: Feed<any> | undefined) => Feed;
8
7
  empty: typeof empty;
package/lib/utils/feed.js CHANGED
@@ -1,15 +1,4 @@
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
- };
13
2
  var __spreadArray = (this && this.__spreadArray) || function (to, from) {
14
3
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
15
4
  to[j] = from[i];
@@ -34,25 +23,10 @@ function pageSkip(skip, page, take) {
34
23
  return skip;
35
24
  }
36
25
  }
37
- function newFeed(data, p1, p2) {
38
- var _a;
39
- var oldSkip = 0;
40
- var total = data.length ? ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.count) || 0 : 0;
41
- if (typeof p1 === "number") {
42
- if (p2) {
43
- // all
44
- total = p2;
45
- }
46
- // oldSkip
47
- oldSkip = p1;
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;
26
+ function newFeed(data, skip, total) {
53
27
  return {
54
- data: newData,
55
- skip: oldSkip + data.length,
28
+ data: data,
29
+ skip: skip + data.length,
56
30
  total: total,
57
31
  };
58
32
  }
@@ -1,15 +1,4 @@
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
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  var feed_1 = require("../feed");
15
4
  var ITEM_COUNT = 5;
@@ -23,12 +12,6 @@ for (var i = 0; i < ITEM_COUNT; i++) {
23
12
  function testFeed(newFeed, matchFeed) {
24
13
  expect(newFeed).toMatchObject(matchFeed);
25
14
  }
26
- function cleanCount(data) {
27
- return data.map(function (_a) {
28
- var _c = _a.count, x = __rest(_a, ["count"]);
29
- return x;
30
- });
31
- }
32
15
  describe("feed", function () {
33
16
  test("empty", function () {
34
17
  testFeed(feed_1.FeedUtil.empty(), {
@@ -42,48 +25,17 @@ describe("feed", function () {
42
25
  expect(feed_1.FeedUtil.pageSkip(0, 1, 10)).toEqual(0);
43
26
  expect(feed_1.FeedUtil.pageSkip(0, 2, 10)).toEqual(10);
44
27
  });
45
- test("newFeed: 1 param", function () {
46
- testFeed(feed_1.FeedUtil.new(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),
56
- skip: ITEM_COUNT,
57
- total: ITEM_COUNT,
58
- });
59
- });
60
- test("newFeed: 2 params", function () {
61
- testFeed(feed_1.FeedUtil.new(data, 10), {
62
- data: cleanCount(data),
63
- skip: 10 + ITEM_COUNT,
64
- total: ITEM_COUNT,
65
- });
66
- });
67
28
  test("newFeed: 3 params", function () {
68
29
  var total = 100;
69
30
  testFeed(feed_1.FeedUtil.new(data, 0, total), {
70
- data: cleanCount(data),
31
+ data: data,
71
32
  skip: ITEM_COUNT,
72
33
  total: total,
73
34
  });
74
35
  testFeed(feed_1.FeedUtil.new(data, 10, total), {
75
- data: cleanCount(data),
36
+ data: data,
76
37
  skip: 10 + ITEM_COUNT,
77
38
  total: total,
78
39
  });
79
40
  });
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
- });
89
41
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev",
3
- "version": "0.50.0",
3
+ "version": "0.52.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",