@shaxpir/duiduidui-models 1.5.4 → 1.5.7

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.
@@ -0,0 +1,18 @@
1
+ import { MultiTime } from '@shaxpir/shaxpir-common';
2
+ import { ContentId } from './Content';
3
+ export interface PhraseFlag {
4
+ _id: string;
5
+ user_id: ContentId;
6
+ text: string;
7
+ sense_rank: number;
8
+ phrase_id: string;
9
+ database_version: string;
10
+ flags: {
11
+ bad_translation: boolean;
12
+ bad_pinyin: boolean;
13
+ bad_speech: boolean;
14
+ bad_notes: boolean;
15
+ };
16
+ details: string;
17
+ created_at: MultiTime;
18
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,6 +8,7 @@ const ChangeModel_1 = require("./ChangeModel");
8
8
  class Model {
9
9
  constructor(doc, shouldAcquire, shareSync) {
10
10
  this._dataBeforeOpBatch = null;
11
+ this._hasEventListeners = false;
11
12
  this._setupEventListeners = null;
12
13
  this._clearEventListeners = null;
13
14
  this._subscribingPromise = null;
@@ -18,11 +19,6 @@ class Model {
18
19
  model._isDisposed = false;
19
20
  model._isForbidden = false;
20
21
  model._hasEventListeners = false;
21
- // When a model is newly created, or retrieved via a "fetch query", treat that as an implicit
22
- // call to "acquire", since the SharedDB doc object will eventually need to be disposed.
23
- if (shouldAcquire) {
24
- this._acquireCount++;
25
- }
26
22
  const onBeforeOpBatch = function (op, source) {
27
23
  if (model._shouldPerformModelChangeAnalysis) {
28
24
  model._dataBeforeOpBatch = shaxpir_common_1.Struct.clone(model.doc.data);
@@ -62,6 +58,11 @@ class Model {
62
58
  model._hasEventListeners = false;
63
59
  }
64
60
  };
61
+ if (shouldAcquire) {
62
+ this.acquire().catch((err) => {
63
+ console.error(`error during implicit acquire of model ${model.compoundKey}: ${err}`);
64
+ });
65
+ }
65
66
  }
66
67
  get kind() {
67
68
  // Defensive check in case doc isn't fully initialized
@@ -5,6 +5,7 @@ export * from './ChangeModel';
5
5
  export * from './Content';
6
6
  export * from './ContentKind';
7
7
  export * from './Device';
8
+ export * from './Flag';
8
9
  export * from './GeoLocation';
9
10
  export * from './Hanzi';
10
11
  export * from './Manifest';
@@ -22,6 +22,7 @@ __exportStar(require("./ChangeModel"), exports);
22
22
  __exportStar(require("./Content"), exports);
23
23
  __exportStar(require("./ContentKind"), exports);
24
24
  __exportStar(require("./Device"), exports);
25
+ __exportStar(require("./Flag"), exports);
25
26
  __exportStar(require("./GeoLocation"), exports);
26
27
  __exportStar(require("./Hanzi"), exports);
27
28
  __exportStar(require("./Manifest"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.5.4",
3
+ "version": "1.5.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"