@contello/astro 1.4.1 → 2.0.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.
- package/dist/index.cjs +29 -20
- package/dist/index.d.cts +31 -18
- package/dist/index.d.ts +31 -18
- package/dist/index.js +29 -20
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -86,7 +86,7 @@ var Contello = class {
|
|
|
86
86
|
_assets;
|
|
87
87
|
_routes;
|
|
88
88
|
_i18nMessages;
|
|
89
|
-
|
|
89
|
+
_i18nUnsubscribe;
|
|
90
90
|
_initialized = false;
|
|
91
91
|
_als = new import_node_async_hooks.AsyncLocalStorage();
|
|
92
92
|
media;
|
|
@@ -120,7 +120,16 @@ var Contello = class {
|
|
|
120
120
|
if (load) {
|
|
121
121
|
await applyTranslations(this._i18nMessages);
|
|
122
122
|
const messages = this._i18nMessages;
|
|
123
|
-
|
|
123
|
+
const controller = new AbortController();
|
|
124
|
+
this._i18nUnsubscribe = () => controller.abort();
|
|
125
|
+
void (async () => {
|
|
126
|
+
for await (const _ of messages.refresh$) {
|
|
127
|
+
if (controller.signal.aborted) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
await applyTranslations(messages);
|
|
131
|
+
}
|
|
132
|
+
})();
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
if (options?.load) {
|
|
@@ -135,8 +144,8 @@ var Contello = class {
|
|
|
135
144
|
}
|
|
136
145
|
async destroy() {
|
|
137
146
|
this._initialized = false;
|
|
138
|
-
this.
|
|
139
|
-
this.
|
|
147
|
+
this._i18nUnsubscribe?.();
|
|
148
|
+
this._i18nUnsubscribe = void 0;
|
|
140
149
|
await this._store.destroy();
|
|
141
150
|
this._assets = void 0;
|
|
142
151
|
this._routes = void 0;
|
|
@@ -150,20 +159,20 @@ var Contello = class {
|
|
|
150
159
|
}
|
|
151
160
|
// --- pre-wired collections ---
|
|
152
161
|
get assets() {
|
|
153
|
-
if (!this.
|
|
154
|
-
throw new Error("@contello/astro: .assets accessed before init()
|
|
162
|
+
if (!this._assets) {
|
|
163
|
+
throw new Error("@contello/astro: .assets accessed before init()");
|
|
155
164
|
}
|
|
156
165
|
return this._assets;
|
|
157
166
|
}
|
|
158
167
|
get routes() {
|
|
159
|
-
if (!this.
|
|
160
|
-
throw new Error("@contello/astro: .routes accessed before init()
|
|
168
|
+
if (!this._routes) {
|
|
169
|
+
throw new Error("@contello/astro: .routes accessed before init()");
|
|
161
170
|
}
|
|
162
171
|
return this._routes;
|
|
163
172
|
}
|
|
164
173
|
get i18nMessages() {
|
|
165
|
-
if (!this.
|
|
166
|
-
throw new Error("@contello/astro: .i18nMessages accessed before init()
|
|
174
|
+
if (!this._i18nMessages) {
|
|
175
|
+
throw new Error("@contello/astro: .i18nMessages accessed before init() with i18n config");
|
|
167
176
|
}
|
|
168
177
|
return this._i18nMessages;
|
|
169
178
|
}
|
|
@@ -183,20 +192,20 @@ var Contello = class {
|
|
|
183
192
|
});
|
|
184
193
|
}
|
|
185
194
|
// --- store delegation ---
|
|
186
|
-
defineSingleton(
|
|
187
|
-
return this._store.defineSingleton(
|
|
195
|
+
defineSingleton(sourceOrKey, options) {
|
|
196
|
+
return this._store.defineSingleton(sourceOrKey, options);
|
|
188
197
|
}
|
|
189
|
-
defineSingletonSync(
|
|
190
|
-
return this._store.defineSingletonSync(
|
|
198
|
+
defineSingletonSync(sourceOrKey, options) {
|
|
199
|
+
return this._store.defineSingletonSync(sourceOrKey, options);
|
|
191
200
|
}
|
|
192
|
-
defineCollection(
|
|
193
|
-
return this._store.defineCollection(
|
|
201
|
+
defineCollection(sourceOrKey, options) {
|
|
202
|
+
return this._store.defineCollection(sourceOrKey, options);
|
|
194
203
|
}
|
|
195
|
-
defineCollectionSync(
|
|
196
|
-
return this._store.defineCollectionSync(
|
|
204
|
+
defineCollectionSync(sourceOrKey, options) {
|
|
205
|
+
return this._store.defineCollectionSync(sourceOrKey, options);
|
|
197
206
|
}
|
|
198
|
-
defineLazyCollection(
|
|
199
|
-
return this._store.defineLazyCollection(
|
|
207
|
+
defineLazyCollection(sourceOrKey, options) {
|
|
208
|
+
return this._store.defineLazyCollection(sourceOrKey, options);
|
|
200
209
|
}
|
|
201
210
|
// --- ALS run ---
|
|
202
211
|
[runRequest](ctx, fn) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema, SourceDef } from '@contello/client';
|
|
2
2
|
import { MediaResolverOptions, MediaResolver, ImageDef } from '@contello/media';
|
|
3
|
-
import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, StoreRoute,
|
|
3
|
+
import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, ReadonlyDeep, StoreRoute, SourceKeysOf, ExtractSourceResult, ResolveSource, SingletonOptions, Singleton, SingletonSyncOptions, SingletonSync, CollectionOptions, Collection, CollectionSyncOptions, CollectionSync, LazyCollectionOptions, LazyCollection } from '@contello/store';
|
|
4
4
|
import * as astro from 'astro';
|
|
5
5
|
import { ExcludePattern } from '@astroscope/excludes';
|
|
6
6
|
|
|
7
7
|
type ContelloRequestContext = {
|
|
8
8
|
url: URL;
|
|
9
|
-
route: StoreRoute | undefined;
|
|
9
|
+
route: ReadonlyDeep<StoreRoute> | undefined;
|
|
10
10
|
rewritten: boolean;
|
|
11
11
|
};
|
|
12
12
|
type ContelloI18nOptions = {
|
|
@@ -26,7 +26,7 @@ type ContelloMediaConfig = {
|
|
|
26
26
|
readonly videosPath: string;
|
|
27
27
|
readonly filesPath: string;
|
|
28
28
|
};
|
|
29
|
-
type ContelloOptions<
|
|
29
|
+
type ContelloOptions<TSchema extends Schema | undefined = undefined> = CreateStoreOptions<TSchema> & {
|
|
30
30
|
assets?: AssetCollectionOptions | undefined;
|
|
31
31
|
i18n?: ContelloI18nOptions | undefined;
|
|
32
32
|
routes?: RouteCollectionOptions | undefined;
|
|
@@ -36,17 +36,24 @@ type HasFallback<O> = O extends {
|
|
|
36
36
|
fallback: ImageDef;
|
|
37
37
|
} ? true : false;
|
|
38
38
|
declare const runRequest: unique symbol;
|
|
39
|
-
|
|
39
|
+
type ModelsOf<TSchema> = TSchema extends {
|
|
40
|
+
models: infer M;
|
|
41
|
+
} ? keyof M & string : string;
|
|
42
|
+
type CollectionArg<TSchema> = SourceKeysOf<TSchema, 'entity'> | SourceDef<ModelsOf<TSchema>, 'entity'>;
|
|
43
|
+
type SingletonArg<TSchema> = SourceKeysOf<TSchema, 'singleton'> | SourceDef<ModelsOf<TSchema>, 'singleton'>;
|
|
44
|
+
type CollectionRaw<TSchema, TArg> = ExtractSourceResult<Extract<ResolveSource<TSchema, TArg>, SourceDef<string, 'entity'>>>;
|
|
45
|
+
type SingletonRaw<TSchema, TArg> = ExtractSourceResult<Extract<ResolveSource<TSchema, TArg>, SourceDef<string, 'singleton'>>>;
|
|
46
|
+
declare class Contello<TSchema extends Schema | undefined = undefined> {
|
|
40
47
|
private readonly _store;
|
|
41
48
|
private readonly _options;
|
|
42
49
|
private _assets;
|
|
43
50
|
private _routes;
|
|
44
51
|
private _i18nMessages;
|
|
45
|
-
private
|
|
52
|
+
private _i18nUnsubscribe;
|
|
46
53
|
private _initialized;
|
|
47
54
|
private readonly _als;
|
|
48
55
|
readonly media: ContelloMediaConfig;
|
|
49
|
-
constructor(options: ContelloOptions<
|
|
56
|
+
constructor(options: ContelloOptions<TSchema>);
|
|
50
57
|
init(options?: ContelloInitOptions | undefined): Promise<void>;
|
|
51
58
|
destroy(): Promise<void>;
|
|
52
59
|
ping(): Promise<void>;
|
|
@@ -56,20 +63,26 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
|
|
|
56
63
|
get i18nMessages(): I18nMessages;
|
|
57
64
|
get request(): ContelloRequestContext;
|
|
58
65
|
defineMediaResolver<O extends Partial<MediaResolverOptions>>(options?: O): MediaResolver<HasFallback<O>>;
|
|
59
|
-
defineSingleton<
|
|
60
|
-
defineSingletonSync<
|
|
61
|
-
defineCollection<
|
|
66
|
+
defineSingleton<TArg extends SingletonArg<TSchema>, TMapped = SingletonRaw<TSchema, TArg>>(sourceOrKey: TArg, options?: SingletonOptions<SingletonRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): Singleton<TMapped>;
|
|
67
|
+
defineSingletonSync<TArg extends SingletonArg<TSchema>, TMapped = SingletonRaw<TSchema, TArg>>(sourceOrKey: TArg, options?: SingletonSyncOptions<SingletonRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): SingletonSync<TMapped>;
|
|
68
|
+
defineCollection<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
62
69
|
id: string;
|
|
63
|
-
}
|
|
64
|
-
defineCollectionSync<TModel extends TModels, TRaw, TMapped extends {
|
|
70
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
65
71
|
id: string;
|
|
66
|
-
}>(
|
|
67
|
-
|
|
72
|
+
}>(sourceOrKey: TArg, options?: CollectionOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): Collection<TMapped>;
|
|
73
|
+
defineCollectionSync<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
68
74
|
id: string;
|
|
69
|
-
}
|
|
75
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
76
|
+
id: string;
|
|
77
|
+
}>(sourceOrKey: TArg, options?: CollectionSyncOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): CollectionSync<TMapped>;
|
|
78
|
+
defineLazyCollection<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
79
|
+
id: string;
|
|
80
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
81
|
+
id: string;
|
|
82
|
+
}>(sourceOrKey: TArg, options?: LazyCollectionOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): LazyCollection<TMapped>;
|
|
70
83
|
[runRequest]<T>(ctx: ContelloRequestContext, fn: () => T): T;
|
|
71
84
|
}
|
|
72
|
-
declare function createContello<
|
|
85
|
+
declare function createContello<TSchema extends Schema | undefined = undefined>(options: ContelloOptions<TSchema>): Contello<TSchema>;
|
|
73
86
|
|
|
74
87
|
type ContelloAssetsImagesOptions = {
|
|
75
88
|
cacheControl?: string | undefined;
|
|
@@ -83,11 +96,11 @@ type ContelloAssetsMiddlewareOptions = {
|
|
|
83
96
|
files?: ContelloAssetsFilesOptions | undefined;
|
|
84
97
|
video?: ContelloAssetsVideoOptions | undefined;
|
|
85
98
|
};
|
|
86
|
-
declare function createAssetsMiddleware(instance: Contello<any
|
|
99
|
+
declare function createAssetsMiddleware(instance: Contello<any>, options?: ContelloAssetsMiddlewareOptions | undefined): astro.MiddlewareHandler;
|
|
87
100
|
|
|
88
101
|
type ContelloMiddlewareOptions = {
|
|
89
102
|
exclude?: ExcludePattern[] | undefined;
|
|
90
103
|
};
|
|
91
|
-
declare function createRoutingMiddleware(instance: Contello<any
|
|
104
|
+
declare function createRoutingMiddleware(instance: Contello<any>, options?: ContelloMiddlewareOptions | undefined): astro.MiddlewareHandler;
|
|
92
105
|
|
|
93
106
|
export { Contello, type ContelloAssetsFilesOptions, type ContelloAssetsImagesOptions, type ContelloAssetsMiddlewareOptions, type ContelloAssetsVideoOptions, type ContelloI18nOptions, type ContelloInitOptions, type ContelloMiddlewareOptions, type ContelloOptions, type ContelloRequestContext, createAssetsMiddleware, createContello, createRoutingMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema, SourceDef } from '@contello/client';
|
|
2
2
|
import { MediaResolverOptions, MediaResolver, ImageDef } from '@contello/media';
|
|
3
|
-
import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, StoreRoute,
|
|
3
|
+
import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, ReadonlyDeep, StoreRoute, SourceKeysOf, ExtractSourceResult, ResolveSource, SingletonOptions, Singleton, SingletonSyncOptions, SingletonSync, CollectionOptions, Collection, CollectionSyncOptions, CollectionSync, LazyCollectionOptions, LazyCollection } from '@contello/store';
|
|
4
4
|
import * as astro from 'astro';
|
|
5
5
|
import { ExcludePattern } from '@astroscope/excludes';
|
|
6
6
|
|
|
7
7
|
type ContelloRequestContext = {
|
|
8
8
|
url: URL;
|
|
9
|
-
route: StoreRoute | undefined;
|
|
9
|
+
route: ReadonlyDeep<StoreRoute> | undefined;
|
|
10
10
|
rewritten: boolean;
|
|
11
11
|
};
|
|
12
12
|
type ContelloI18nOptions = {
|
|
@@ -26,7 +26,7 @@ type ContelloMediaConfig = {
|
|
|
26
26
|
readonly videosPath: string;
|
|
27
27
|
readonly filesPath: string;
|
|
28
28
|
};
|
|
29
|
-
type ContelloOptions<
|
|
29
|
+
type ContelloOptions<TSchema extends Schema | undefined = undefined> = CreateStoreOptions<TSchema> & {
|
|
30
30
|
assets?: AssetCollectionOptions | undefined;
|
|
31
31
|
i18n?: ContelloI18nOptions | undefined;
|
|
32
32
|
routes?: RouteCollectionOptions | undefined;
|
|
@@ -36,17 +36,24 @@ type HasFallback<O> = O extends {
|
|
|
36
36
|
fallback: ImageDef;
|
|
37
37
|
} ? true : false;
|
|
38
38
|
declare const runRequest: unique symbol;
|
|
39
|
-
|
|
39
|
+
type ModelsOf<TSchema> = TSchema extends {
|
|
40
|
+
models: infer M;
|
|
41
|
+
} ? keyof M & string : string;
|
|
42
|
+
type CollectionArg<TSchema> = SourceKeysOf<TSchema, 'entity'> | SourceDef<ModelsOf<TSchema>, 'entity'>;
|
|
43
|
+
type SingletonArg<TSchema> = SourceKeysOf<TSchema, 'singleton'> | SourceDef<ModelsOf<TSchema>, 'singleton'>;
|
|
44
|
+
type CollectionRaw<TSchema, TArg> = ExtractSourceResult<Extract<ResolveSource<TSchema, TArg>, SourceDef<string, 'entity'>>>;
|
|
45
|
+
type SingletonRaw<TSchema, TArg> = ExtractSourceResult<Extract<ResolveSource<TSchema, TArg>, SourceDef<string, 'singleton'>>>;
|
|
46
|
+
declare class Contello<TSchema extends Schema | undefined = undefined> {
|
|
40
47
|
private readonly _store;
|
|
41
48
|
private readonly _options;
|
|
42
49
|
private _assets;
|
|
43
50
|
private _routes;
|
|
44
51
|
private _i18nMessages;
|
|
45
|
-
private
|
|
52
|
+
private _i18nUnsubscribe;
|
|
46
53
|
private _initialized;
|
|
47
54
|
private readonly _als;
|
|
48
55
|
readonly media: ContelloMediaConfig;
|
|
49
|
-
constructor(options: ContelloOptions<
|
|
56
|
+
constructor(options: ContelloOptions<TSchema>);
|
|
50
57
|
init(options?: ContelloInitOptions | undefined): Promise<void>;
|
|
51
58
|
destroy(): Promise<void>;
|
|
52
59
|
ping(): Promise<void>;
|
|
@@ -56,20 +63,26 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
|
|
|
56
63
|
get i18nMessages(): I18nMessages;
|
|
57
64
|
get request(): ContelloRequestContext;
|
|
58
65
|
defineMediaResolver<O extends Partial<MediaResolverOptions>>(options?: O): MediaResolver<HasFallback<O>>;
|
|
59
|
-
defineSingleton<
|
|
60
|
-
defineSingletonSync<
|
|
61
|
-
defineCollection<
|
|
66
|
+
defineSingleton<TArg extends SingletonArg<TSchema>, TMapped = SingletonRaw<TSchema, TArg>>(sourceOrKey: TArg, options?: SingletonOptions<SingletonRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): Singleton<TMapped>;
|
|
67
|
+
defineSingletonSync<TArg extends SingletonArg<TSchema>, TMapped = SingletonRaw<TSchema, TArg>>(sourceOrKey: TArg, options?: SingletonSyncOptions<SingletonRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): SingletonSync<TMapped>;
|
|
68
|
+
defineCollection<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
62
69
|
id: string;
|
|
63
|
-
}
|
|
64
|
-
defineCollectionSync<TModel extends TModels, TRaw, TMapped extends {
|
|
70
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
65
71
|
id: string;
|
|
66
|
-
}>(
|
|
67
|
-
|
|
72
|
+
}>(sourceOrKey: TArg, options?: CollectionOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): Collection<TMapped>;
|
|
73
|
+
defineCollectionSync<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
68
74
|
id: string;
|
|
69
|
-
}
|
|
75
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
76
|
+
id: string;
|
|
77
|
+
}>(sourceOrKey: TArg, options?: CollectionSyncOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): CollectionSync<TMapped>;
|
|
78
|
+
defineLazyCollection<TArg extends CollectionArg<TSchema>, TMapped extends {
|
|
79
|
+
id: string;
|
|
80
|
+
} = CollectionRaw<TSchema, TArg> & {
|
|
81
|
+
id: string;
|
|
82
|
+
}>(sourceOrKey: TArg, options?: LazyCollectionOptions<CollectionRaw<TSchema, TArg>, TMapped, ModelsOf<TSchema>>): LazyCollection<TMapped>;
|
|
70
83
|
[runRequest]<T>(ctx: ContelloRequestContext, fn: () => T): T;
|
|
71
84
|
}
|
|
72
|
-
declare function createContello<
|
|
85
|
+
declare function createContello<TSchema extends Schema | undefined = undefined>(options: ContelloOptions<TSchema>): Contello<TSchema>;
|
|
73
86
|
|
|
74
87
|
type ContelloAssetsImagesOptions = {
|
|
75
88
|
cacheControl?: string | undefined;
|
|
@@ -83,11 +96,11 @@ type ContelloAssetsMiddlewareOptions = {
|
|
|
83
96
|
files?: ContelloAssetsFilesOptions | undefined;
|
|
84
97
|
video?: ContelloAssetsVideoOptions | undefined;
|
|
85
98
|
};
|
|
86
|
-
declare function createAssetsMiddleware(instance: Contello<any
|
|
99
|
+
declare function createAssetsMiddleware(instance: Contello<any>, options?: ContelloAssetsMiddlewareOptions | undefined): astro.MiddlewareHandler;
|
|
87
100
|
|
|
88
101
|
type ContelloMiddlewareOptions = {
|
|
89
102
|
exclude?: ExcludePattern[] | undefined;
|
|
90
103
|
};
|
|
91
|
-
declare function createRoutingMiddleware(instance: Contello<any
|
|
104
|
+
declare function createRoutingMiddleware(instance: Contello<any>, options?: ContelloMiddlewareOptions | undefined): astro.MiddlewareHandler;
|
|
92
105
|
|
|
93
106
|
export { Contello, type ContelloAssetsFilesOptions, type ContelloAssetsImagesOptions, type ContelloAssetsMiddlewareOptions, type ContelloAssetsVideoOptions, type ContelloI18nOptions, type ContelloInitOptions, type ContelloMiddlewareOptions, type ContelloOptions, type ContelloRequestContext, createAssetsMiddleware, createContello, createRoutingMiddleware };
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ var Contello = class {
|
|
|
49
49
|
_assets;
|
|
50
50
|
_routes;
|
|
51
51
|
_i18nMessages;
|
|
52
|
-
|
|
52
|
+
_i18nUnsubscribe;
|
|
53
53
|
_initialized = false;
|
|
54
54
|
_als = new AsyncLocalStorage();
|
|
55
55
|
media;
|
|
@@ -83,7 +83,16 @@ var Contello = class {
|
|
|
83
83
|
if (load) {
|
|
84
84
|
await applyTranslations(this._i18nMessages);
|
|
85
85
|
const messages = this._i18nMessages;
|
|
86
|
-
|
|
86
|
+
const controller = new AbortController();
|
|
87
|
+
this._i18nUnsubscribe = () => controller.abort();
|
|
88
|
+
void (async () => {
|
|
89
|
+
for await (const _ of messages.refresh$) {
|
|
90
|
+
if (controller.signal.aborted) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await applyTranslations(messages);
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
if (options?.load) {
|
|
@@ -98,8 +107,8 @@ var Contello = class {
|
|
|
98
107
|
}
|
|
99
108
|
async destroy() {
|
|
100
109
|
this._initialized = false;
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
110
|
+
this._i18nUnsubscribe?.();
|
|
111
|
+
this._i18nUnsubscribe = void 0;
|
|
103
112
|
await this._store.destroy();
|
|
104
113
|
this._assets = void 0;
|
|
105
114
|
this._routes = void 0;
|
|
@@ -113,20 +122,20 @@ var Contello = class {
|
|
|
113
122
|
}
|
|
114
123
|
// --- pre-wired collections ---
|
|
115
124
|
get assets() {
|
|
116
|
-
if (!this.
|
|
117
|
-
throw new Error("@contello/astro: .assets accessed before init()
|
|
125
|
+
if (!this._assets) {
|
|
126
|
+
throw new Error("@contello/astro: .assets accessed before init()");
|
|
118
127
|
}
|
|
119
128
|
return this._assets;
|
|
120
129
|
}
|
|
121
130
|
get routes() {
|
|
122
|
-
if (!this.
|
|
123
|
-
throw new Error("@contello/astro: .routes accessed before init()
|
|
131
|
+
if (!this._routes) {
|
|
132
|
+
throw new Error("@contello/astro: .routes accessed before init()");
|
|
124
133
|
}
|
|
125
134
|
return this._routes;
|
|
126
135
|
}
|
|
127
136
|
get i18nMessages() {
|
|
128
|
-
if (!this.
|
|
129
|
-
throw new Error("@contello/astro: .i18nMessages accessed before init()
|
|
137
|
+
if (!this._i18nMessages) {
|
|
138
|
+
throw new Error("@contello/astro: .i18nMessages accessed before init() with i18n config");
|
|
130
139
|
}
|
|
131
140
|
return this._i18nMessages;
|
|
132
141
|
}
|
|
@@ -146,20 +155,20 @@ var Contello = class {
|
|
|
146
155
|
});
|
|
147
156
|
}
|
|
148
157
|
// --- store delegation ---
|
|
149
|
-
defineSingleton(
|
|
150
|
-
return this._store.defineSingleton(
|
|
158
|
+
defineSingleton(sourceOrKey, options) {
|
|
159
|
+
return this._store.defineSingleton(sourceOrKey, options);
|
|
151
160
|
}
|
|
152
|
-
defineSingletonSync(
|
|
153
|
-
return this._store.defineSingletonSync(
|
|
161
|
+
defineSingletonSync(sourceOrKey, options) {
|
|
162
|
+
return this._store.defineSingletonSync(sourceOrKey, options);
|
|
154
163
|
}
|
|
155
|
-
defineCollection(
|
|
156
|
-
return this._store.defineCollection(
|
|
164
|
+
defineCollection(sourceOrKey, options) {
|
|
165
|
+
return this._store.defineCollection(sourceOrKey, options);
|
|
157
166
|
}
|
|
158
|
-
defineCollectionSync(
|
|
159
|
-
return this._store.defineCollectionSync(
|
|
167
|
+
defineCollectionSync(sourceOrKey, options) {
|
|
168
|
+
return this._store.defineCollectionSync(sourceOrKey, options);
|
|
160
169
|
}
|
|
161
|
-
defineLazyCollection(
|
|
162
|
-
return this._store.defineLazyCollection(
|
|
170
|
+
defineLazyCollection(sourceOrKey, options) {
|
|
171
|
+
return this._store.defineLazyCollection(sourceOrKey, options);
|
|
163
172
|
}
|
|
164
173
|
// --- ALS run ---
|
|
165
174
|
[runRequest](ctx, fn) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contello/astro",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Astro integration for Contello CMS — route middleware and i18n bridge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"@astroscope/excludes": ">=0.1.0",
|
|
15
15
|
"@astroscope/i18n": ">=0.3.0",
|
|
16
16
|
"astro": "^6.0.0",
|
|
17
|
-
"@contello/client": "^
|
|
18
|
-
"@contello/media": "^1.0.
|
|
19
|
-
"@contello/store": "^
|
|
17
|
+
"@contello/client": "^2.0.0",
|
|
18
|
+
"@contello/media": "^1.0.1",
|
|
19
|
+
"@contello/store": "^2.0.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"@astroscope/i18n": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@astroscope/excludes": "^0.3.2",
|
|
28
28
|
"@astroscope/i18n": "^0.4.5",
|
|
29
29
|
"astro": "^6.1.8",
|
|
30
|
-
"@contello/
|
|
31
|
-
"@contello/
|
|
32
|
-
"@contello/
|
|
30
|
+
"@contello/client": "^2.0.0",
|
|
31
|
+
"@contello/media": "^1.0.1",
|
|
32
|
+
"@contello/store": "^2.0.0"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist"
|