@contello/astro 1.3.0 → 1.3.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OperationMap } from '@contello/client';
2
- import { MediaResolverOptions, MediaResolver, ImageDef } from '@contello/media';
2
+ import { MediaResolverOptions, MediaResolver } from '@contello/media';
3
3
  import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, StoreRoute, SingletonDef, Singleton, SingletonSyncDef, SingletonSync, CollectionDef, Collection, CollectionSyncDef, CollectionSync, LazyCollectionDef, LazyCollection } from '@contello/store';
4
4
  import * as astro from 'astro';
5
5
  import { ExcludePattern } from '@astroscope/excludes';
@@ -20,31 +20,15 @@ type ContelloInitOptions = {
20
20
  load?: boolean | undefined;
21
21
  } | undefined;
22
22
  };
23
- /**
24
- * full `MediaResolverOptions` surface — everything is optional because astro
25
- * auto-defaults `baseUrl` to `''` (same-origin) and `imagesPath` / `videosPath`
26
- * to the assets middleware prefixes (`/_contello/i/`, `/_contello/v/`). all
27
- * other fields (`fallback`, `breakpoints`, `pictureFormats`) pass through as-is.
28
- */
29
23
  type ContelloMediaOptions = Partial<MediaResolverOptions>;
30
24
  type ContelloOptions<TOps extends OperationMap | undefined = undefined, TModels extends string = string> = Omit<CreateStoreOptions<TOps, TModels>, 'media'> & {
31
25
  assets?: AssetCollectionOptions | undefined;
32
26
  i18n?: ContelloI18nOptions | undefined;
33
27
  routes?: RouteCollectionOptions | undefined;
34
- /**
35
- * MediaResolver configuration. baseUrl / imagesPath / videosPath are
36
- * auto-defaulted to match the assets middleware proxy prefixes, so
37
- * `contello.media` is always available in astro projects.
38
- */
39
28
  media?: ContelloMediaOptions | undefined;
40
29
  };
41
- type HasMediaFallback<O> = O extends {
42
- media: {
43
- fallback: ImageDef;
44
- };
45
- } ? true : false;
46
30
  declare const runRequest: unique symbol;
47
- declare class Contello<TOps extends OperationMap | undefined = undefined, TModels extends string = string, THasMediaFallback extends boolean = false> {
31
+ declare class Contello<TOps extends OperationMap | undefined = undefined, TModels extends string = string> {
48
32
  private readonly _store;
49
33
  private readonly _options;
50
34
  private _assets;
@@ -60,7 +44,7 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
60
44
  get assets(): Assets;
61
45
  get routes(): Routes;
62
46
  get i18nMessages(): I18nMessages;
63
- get media(): MediaResolver<THasMediaFallback>;
47
+ get media(): MediaResolver;
64
48
  get request(): ContelloRequestContext;
65
49
  defineSingleton<TModel extends TModels, TRaw, TMapped>(def: SingletonDef<TOps, TModel, TRaw, TMapped, TModels>): Singleton<TMapped>;
66
50
  defineSingletonSync<TModel extends TModels, TRaw, TMapped>(def: SingletonSyncDef<TOps, TModel, TRaw, TMapped, TModels>): SingletonSync<TMapped>;
@@ -75,7 +59,7 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
75
59
  }>(def: LazyCollectionDef<TOps, TModel, TRaw, TMapped, TModels>): LazyCollection<TMapped>;
76
60
  [runRequest]<T>(ctx: ContelloRequestContext, fn: () => T): T;
77
61
  }
78
- declare function createContello<TOps extends OperationMap | undefined = undefined, TModels extends string = string, O extends ContelloOptions<TOps, TModels> = ContelloOptions<TOps, TModels>>(options: O): Contello<TOps, TModels, HasMediaFallback<O>>;
62
+ declare function createContello<TOps extends OperationMap | undefined = undefined, TModels extends string = string>(options: ContelloOptions<TOps, TModels>): Contello<TOps, TModels>;
79
63
 
80
64
  type ContelloAssetsImagesOptions = {
81
65
  cacheControl?: string | undefined;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OperationMap } from '@contello/client';
2
- import { MediaResolverOptions, MediaResolver, ImageDef } from '@contello/media';
2
+ import { MediaResolverOptions, MediaResolver } from '@contello/media';
3
3
  import { CreateStoreOptions, AssetCollectionOptions, RouteCollectionOptions, Loadable, Assets, Routes, I18nMessages, StoreRoute, SingletonDef, Singleton, SingletonSyncDef, SingletonSync, CollectionDef, Collection, CollectionSyncDef, CollectionSync, LazyCollectionDef, LazyCollection } from '@contello/store';
4
4
  import * as astro from 'astro';
5
5
  import { ExcludePattern } from '@astroscope/excludes';
@@ -20,31 +20,15 @@ type ContelloInitOptions = {
20
20
  load?: boolean | undefined;
21
21
  } | undefined;
22
22
  };
23
- /**
24
- * full `MediaResolverOptions` surface — everything is optional because astro
25
- * auto-defaults `baseUrl` to `''` (same-origin) and `imagesPath` / `videosPath`
26
- * to the assets middleware prefixes (`/_contello/i/`, `/_contello/v/`). all
27
- * other fields (`fallback`, `breakpoints`, `pictureFormats`) pass through as-is.
28
- */
29
23
  type ContelloMediaOptions = Partial<MediaResolverOptions>;
30
24
  type ContelloOptions<TOps extends OperationMap | undefined = undefined, TModels extends string = string> = Omit<CreateStoreOptions<TOps, TModels>, 'media'> & {
31
25
  assets?: AssetCollectionOptions | undefined;
32
26
  i18n?: ContelloI18nOptions | undefined;
33
27
  routes?: RouteCollectionOptions | undefined;
34
- /**
35
- * MediaResolver configuration. baseUrl / imagesPath / videosPath are
36
- * auto-defaulted to match the assets middleware proxy prefixes, so
37
- * `contello.media` is always available in astro projects.
38
- */
39
28
  media?: ContelloMediaOptions | undefined;
40
29
  };
41
- type HasMediaFallback<O> = O extends {
42
- media: {
43
- fallback: ImageDef;
44
- };
45
- } ? true : false;
46
30
  declare const runRequest: unique symbol;
47
- declare class Contello<TOps extends OperationMap | undefined = undefined, TModels extends string = string, THasMediaFallback extends boolean = false> {
31
+ declare class Contello<TOps extends OperationMap | undefined = undefined, TModels extends string = string> {
48
32
  private readonly _store;
49
33
  private readonly _options;
50
34
  private _assets;
@@ -60,7 +44,7 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
60
44
  get assets(): Assets;
61
45
  get routes(): Routes;
62
46
  get i18nMessages(): I18nMessages;
63
- get media(): MediaResolver<THasMediaFallback>;
47
+ get media(): MediaResolver;
64
48
  get request(): ContelloRequestContext;
65
49
  defineSingleton<TModel extends TModels, TRaw, TMapped>(def: SingletonDef<TOps, TModel, TRaw, TMapped, TModels>): Singleton<TMapped>;
66
50
  defineSingletonSync<TModel extends TModels, TRaw, TMapped>(def: SingletonSyncDef<TOps, TModel, TRaw, TMapped, TModels>): SingletonSync<TMapped>;
@@ -75,7 +59,7 @@ declare class Contello<TOps extends OperationMap | undefined = undefined, TModel
75
59
  }>(def: LazyCollectionDef<TOps, TModel, TRaw, TMapped, TModels>): LazyCollection<TMapped>;
76
60
  [runRequest]<T>(ctx: ContelloRequestContext, fn: () => T): T;
77
61
  }
78
- declare function createContello<TOps extends OperationMap | undefined = undefined, TModels extends string = string, O extends ContelloOptions<TOps, TModels> = ContelloOptions<TOps, TModels>>(options: O): Contello<TOps, TModels, HasMediaFallback<O>>;
62
+ declare function createContello<TOps extends OperationMap | undefined = undefined, TModels extends string = string>(options: ContelloOptions<TOps, TModels>): Contello<TOps, TModels>;
79
63
 
80
64
  type ContelloAssetsImagesOptions = {
81
65
  cacheControl?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contello/astro",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Astro integration for Contello CMS — route middleware and i18n bridge",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -13,22 +13,23 @@
13
13
  "peerDependencies": {
14
14
  "@astroscope/excludes": ">=0.1.0",
15
15
  "@astroscope/i18n": ">=0.3.0",
16
- "astro": "^6.0.0"
16
+ "astro": "^6.0.0",
17
+ "@contello/client": "^1.1.0",
18
+ "@contello/media": "^1.0.0",
19
+ "@contello/store": "^1.4.2"
17
20
  },
18
21
  "peerDependenciesMeta": {
19
22
  "@astroscope/i18n": {
20
23
  "optional": true
21
24
  }
22
25
  },
23
- "dependencies": {
24
- "@contello/client": "^1.1.0",
25
- "@contello/store": "^1.4.0",
26
- "@contello/media": "^1.0.0"
27
- },
28
26
  "devDependencies": {
29
27
  "@astroscope/excludes": "^0.3.2",
30
28
  "@astroscope/i18n": "^0.4.5",
31
- "astro": "^6.1.8"
29
+ "astro": "^6.1.8",
30
+ "@contello/client": "^1.1.0",
31
+ "@contello/media": "^1.0.0",
32
+ "@contello/store": "^1.4.2"
32
33
  },
33
34
  "files": [
34
35
  "dist"