@flumens/models 0.0.2 → 0.0.3

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,43 @@
1
+ import Model from '../Model';
2
+ import Store from '../Stores/Store';
3
+
4
+ export default class Collection<T extends Model> extends Array<T> {
5
+ /**
6
+ * Remote server collection ID.
7
+ */
8
+ id?: string;
9
+
10
+ /**
11
+ * Key name of tdehe collection used to save and fetch the model from locally.
12
+ */
13
+ cid: string;
14
+
15
+ /**
16
+ * The offline store used to save and fetch the model from.
17
+ */
18
+ protected _store?: Store;
19
+
20
+ /**
21
+ * A promise to flag if all the models were initialised from the store.
22
+ */
23
+ ready?: Promise<boolean>;
24
+
25
+ Model?: typeof Model;
26
+
27
+ constructor(options: {
28
+ models?: T[];
29
+ id?: string;
30
+ cid?: string;
31
+ store?: Store;
32
+ Model?: typeof Model;
33
+ });
34
+
35
+ private _fromStore(): Promise<boolean>;
36
+
37
+ remove(model: T): any; // mobx
38
+
39
+ /**
40
+ * Reset whole collection to empty. Does delete the local cache from store.
41
+ */
42
+ reset(): Promise<void>;
43
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flumens/models",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -18,6 +18,7 @@
18
18
  "@rollup/plugin-json": "6.0.0",
19
19
  "@rollup/plugin-node-resolve": "13.3.0",
20
20
  "@rollup/plugin-typescript": "8.3.2",
21
+ "rollup-plugin-copy": "3.5.0",
21
22
  "@trivago/prettier-plugin-sort-imports": "4.3.0",
22
23
  "@types/react": "18.2.38",
23
24
  "@types/react-dom": "18.2.17",