@griddo/core 10.1.56 → 10.1.57

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.
@@ -1,5 +1,6 @@
1
1
  import { ImagePosition } from "../core";
2
2
  import { HTMLHeadingTag } from "../global";
3
+ import { ContentTypeNameOfUnion } from "../utilities";
3
4
  export type FieldsDivider = string;
4
5
  export type ArrayFieldGroup<Fields> = Array<Fields>;
5
6
  export type AsyncSelect<Relations, FromList, RelatedContentType, FromDistributor> = FromList extends true ? Relations extends true ? {
@@ -129,9 +130,7 @@ export interface Reference<ContentType> {
129
130
  mode?: "auto" | "manual" | "navigation";
130
131
  order?: string;
131
132
  fixed?: Array<number>;
132
- source?: ContentType extends {
133
- __contentTypeName: unknown;
134
- } ? Array<ContentType["__contentTypeName"]> : never;
133
+ source?: Array<ContentTypeNameOfUnion<ContentType>>;
135
134
  /** 0 means all */
136
135
  quantity?: number;
137
136
  filter?: Array<{
@@ -305,7 +305,7 @@ export interface FullPath {
305
305
  /** Slug for the compose url with the format `/language-name/` */
306
306
  compose?: string;
307
307
  }
308
- export type ListContentType<Item> = Omit<Item, "__contentTypeName" | "__relatedContentTypeNames"> & {
308
+ export type ListContentType<Item> = Omit<Item, "__contentTypeName" | "__relatedContentTypeNames" | "__contentTypeKind"> & {
309
309
  id: number;
310
310
  title: string;
311
311
  url: string;
@@ -1,4 +1,4 @@
1
- import { ListContentType } from "./core";
1
+ import { KeysOfUnion } from "./utilities";
2
2
  import { Fields } from "../index";
3
3
  export type HTMLHeadingTag = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
4
4
  export interface SetQueryProps<ContentType> {
@@ -15,7 +15,11 @@ export interface SetQueryProps<ContentType> {
15
15
  /** Site id, if not provided, will be obtained from the context */
16
16
  site?: number;
17
17
  /** String array of the keys/properties in order to restrict the query. */
18
- fields?: Array<keyof ListContentType<ContentType>>;
18
+ fields?: Array<Exclude<KeysOfUnion<ContentType & {
19
+ id: number;
20
+ title: string;
21
+ url: string;
22
+ }>, "__relatedContentTypeNames" | "__contentTypeKind" | "__contentTypeName">>;
19
23
  /** Array of filterIds or Object of arrays of content type ids to filter the query */
20
24
  filterIds?: ContentType extends {
21
25
  __contentTypeName: string;
@@ -1,3 +1,7 @@
1
1
  export type NonEmptyArray<T> = [T, ...T[]];
2
2
  export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
3
3
  export type PartiallyRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
4
+ export type KeysOfUnion<T> = T extends T ? keyof T : never;
5
+ export type ContentTypeNameOfUnion<T> = T extends {
6
+ __contentTypeName: string;
7
+ } ? T["__contentTypeName"] : never;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@griddo/core",
3
3
  "description": "Reload version of Griddo Core",
4
4
  "license": "UNLICENSED",
5
- "version": "10.1.56",
5
+ "version": "10.1.57",
6
6
  "authors": [
7
7
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
8
8
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -78,5 +78,5 @@
78
78
  "resolutions": {
79
79
  "colors": "1.4.0"
80
80
  },
81
- "gitHead": "3722410167d3e7ea849b2652636384e3b32ad471"
81
+ "gitHead": "0a2ad4b3e511ffcf458f1b51f5e6c60cb6442345"
82
82
  }