@contello/store 1.4.2 → 1.5.1
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.
- package/dist/index.cjs +2 -5
- package/dist/index.d.cts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +2 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,6 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
|
|
38
38
|
// src/store.ts
|
|
39
39
|
var import_client = require("@contello/client");
|
|
40
|
-
var import_media = require("@contello/media");
|
|
41
40
|
|
|
42
41
|
// src/assets.ts
|
|
43
42
|
var import_projected = require("projected");
|
|
@@ -664,7 +663,7 @@ function createCollectionSync(def, client, updates$, resolver) {
|
|
|
664
663
|
const base = createCollection(def, client, updates$, resolver);
|
|
665
664
|
function assertSync(value, method) {
|
|
666
665
|
if (value instanceof Promise) {
|
|
667
|
-
throw new Error(`collection "${
|
|
666
|
+
throw new Error(`collection "${base.name}".${method}() is not initialized yet \u2014 call collection.load() first`);
|
|
668
667
|
}
|
|
669
668
|
return value;
|
|
670
669
|
}
|
|
@@ -1165,7 +1164,7 @@ function createSingletonSync(def, client, updates$, resolver) {
|
|
|
1165
1164
|
get() {
|
|
1166
1165
|
const result = base.get();
|
|
1167
1166
|
if (result instanceof Promise) {
|
|
1168
|
-
throw new Error(`singleton "${
|
|
1167
|
+
throw new Error(`singleton "${base.name}" is not initialized yet \u2014 call singleton.load() first`);
|
|
1169
1168
|
}
|
|
1170
1169
|
return result;
|
|
1171
1170
|
}
|
|
@@ -1300,7 +1299,6 @@ var Store = class {
|
|
|
1300
1299
|
_resolver;
|
|
1301
1300
|
_watcher;
|
|
1302
1301
|
updates$;
|
|
1303
|
-
media;
|
|
1304
1302
|
constructor(options) {
|
|
1305
1303
|
const { url, project, token, operations } = options;
|
|
1306
1304
|
this._client = (0, import_client.createContelloClient)({
|
|
@@ -1317,7 +1315,6 @@ var Store = class {
|
|
|
1317
1315
|
this._resolver = new ModelResolver(options.models);
|
|
1318
1316
|
this._watcher = createInternalWatcher(this._client, this._resolver);
|
|
1319
1317
|
this.updates$ = this._watcher.updates$;
|
|
1320
|
-
this.media = (0, import_media.createMediaResolver)(options.media ?? {});
|
|
1321
1318
|
this.ping = () => this._client.ping();
|
|
1322
1319
|
}
|
|
1323
1320
|
async init() {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OperationMap, ContelloClient, ConnectionEvents, UploadData, UploadMetadata, UploadOptions, DownloadResult, ProxyResult } from '@contello/client';
|
|
2
|
-
import { MediaResolverOptions, MediaResolver } from '@contello/media';
|
|
3
2
|
import { Observable } from 'rxjs';
|
|
4
3
|
import { MaybePromise } from 'projected';
|
|
5
4
|
|
|
@@ -113,7 +112,6 @@ type CreateStoreOptions<TOps extends OperationMap | undefined = undefined, TMode
|
|
|
113
112
|
onReconnecting?: (() => void) | undefined;
|
|
114
113
|
onError?: ((error: unknown) => void) | undefined;
|
|
115
114
|
connectionEvents?: ConnectionEvents | undefined;
|
|
116
|
-
media?: MediaResolverOptions | undefined;
|
|
117
115
|
};
|
|
118
116
|
/** Cache options for non-lazy collections and singletons. */
|
|
119
117
|
type CacheOptions = {
|
|
@@ -318,7 +316,6 @@ declare class Store<TOps extends OperationMap | undefined = undefined, TModels e
|
|
|
318
316
|
private _resolver;
|
|
319
317
|
private _watcher;
|
|
320
318
|
readonly updates$: Observable<UpdateBatch>;
|
|
321
|
-
readonly media: MediaResolver;
|
|
322
319
|
constructor(options: CreateStoreOptions<TOps, TModels>);
|
|
323
320
|
init(): Promise<void>;
|
|
324
321
|
destroy(): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OperationMap, ContelloClient, ConnectionEvents, UploadData, UploadMetadata, UploadOptions, DownloadResult, ProxyResult } from '@contello/client';
|
|
2
|
-
import { MediaResolverOptions, MediaResolver } from '@contello/media';
|
|
3
2
|
import { Observable } from 'rxjs';
|
|
4
3
|
import { MaybePromise } from 'projected';
|
|
5
4
|
|
|
@@ -113,7 +112,6 @@ type CreateStoreOptions<TOps extends OperationMap | undefined = undefined, TMode
|
|
|
113
112
|
onReconnecting?: (() => void) | undefined;
|
|
114
113
|
onError?: ((error: unknown) => void) | undefined;
|
|
115
114
|
connectionEvents?: ConnectionEvents | undefined;
|
|
116
|
-
media?: MediaResolverOptions | undefined;
|
|
117
115
|
};
|
|
118
116
|
/** Cache options for non-lazy collections and singletons. */
|
|
119
117
|
type CacheOptions = {
|
|
@@ -318,7 +316,6 @@ declare class Store<TOps extends OperationMap | undefined = undefined, TModels e
|
|
|
318
316
|
private _resolver;
|
|
319
317
|
private _watcher;
|
|
320
318
|
readonly updates$: Observable<UpdateBatch>;
|
|
321
|
-
readonly media: MediaResolver;
|
|
322
319
|
constructor(options: CreateStoreOptions<TOps, TModels>);
|
|
323
320
|
init(): Promise<void>;
|
|
324
321
|
destroy(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/store.ts
|
|
2
2
|
import { createContelloClient } from "@contello/client";
|
|
3
|
-
import { createMediaResolver } from "@contello/media";
|
|
4
3
|
|
|
5
4
|
// src/assets.ts
|
|
6
5
|
import { ProjectedLazyMap } from "projected";
|
|
@@ -627,7 +626,7 @@ function createCollectionSync(def, client, updates$, resolver) {
|
|
|
627
626
|
const base = createCollection(def, client, updates$, resolver);
|
|
628
627
|
function assertSync(value, method) {
|
|
629
628
|
if (value instanceof Promise) {
|
|
630
|
-
throw new Error(`collection "${
|
|
629
|
+
throw new Error(`collection "${base.name}".${method}() is not initialized yet \u2014 call collection.load() first`);
|
|
631
630
|
}
|
|
632
631
|
return value;
|
|
633
632
|
}
|
|
@@ -1128,7 +1127,7 @@ function createSingletonSync(def, client, updates$, resolver) {
|
|
|
1128
1127
|
get() {
|
|
1129
1128
|
const result = base.get();
|
|
1130
1129
|
if (result instanceof Promise) {
|
|
1131
|
-
throw new Error(`singleton "${
|
|
1130
|
+
throw new Error(`singleton "${base.name}" is not initialized yet \u2014 call singleton.load() first`);
|
|
1132
1131
|
}
|
|
1133
1132
|
return result;
|
|
1134
1133
|
}
|
|
@@ -1263,7 +1262,6 @@ var Store = class {
|
|
|
1263
1262
|
_resolver;
|
|
1264
1263
|
_watcher;
|
|
1265
1264
|
updates$;
|
|
1266
|
-
media;
|
|
1267
1265
|
constructor(options) {
|
|
1268
1266
|
const { url, project, token, operations } = options;
|
|
1269
1267
|
this._client = createContelloClient({
|
|
@@ -1280,7 +1278,6 @@ var Store = class {
|
|
|
1280
1278
|
this._resolver = new ModelResolver(options.models);
|
|
1281
1279
|
this._watcher = createInternalWatcher(this._client, this._resolver);
|
|
1282
1280
|
this.updates$ = this._watcher.updates$;
|
|
1283
|
-
this.media = createMediaResolver(options.media ?? {});
|
|
1284
1281
|
this.ping = () => this._client.ping();
|
|
1285
1282
|
}
|
|
1286
1283
|
async init() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contello/store",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Framework-agnostic store for Contello CMS with reactive collections and automatic dependency tracking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"projected": "^2.0.0",
|
|
15
15
|
"rxjs": "^7.0.0",
|
|
16
|
-
"@contello/client": "^1.1.
|
|
16
|
+
"@contello/client": "^1.1.1",
|
|
17
17
|
"@contello/media": "^1.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"projected": "^2.2.1",
|
|
25
25
|
"rxjs": "^7.8.2",
|
|
26
|
-
"@contello/client": "^1.1.
|
|
26
|
+
"@contello/client": "^1.1.1",
|
|
27
27
|
"@contello/media": "^1.0.0"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|