@flexacms/client 0.1.0 → 0.2.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.d.cts CHANGED
@@ -14,6 +14,10 @@ type EntryValues = Record<string, unknown>;
14
14
  * workspace with `npx @flexacms/cli generate` to get typed `client.entity()`.
15
15
  */
16
16
  type ContentSchema = Record<string, EntryValues>;
17
+ /** A file URL, a list of them, translations of them, or repeater items holding them. */
18
+ type EntryMedia = string | null | (string | null)[] | {
19
+ [locale: string]: string | string[] | null;
20
+ } | Record<string, string | string[] | null>[];
17
21
  interface Category {
18
22
  id: number;
19
23
  name: string;
@@ -35,6 +39,12 @@ interface Entry<TValues extends object = EntryValues> {
35
39
  order: number | null;
36
40
  categories: Category[];
37
41
  values: TValues;
42
+ /**
43
+ * Absolute URLs of the files in image and file fields, keyed by field key
44
+ * and shaped like their values (`values` keeps the stored paths).
45
+ * Repeaters list their media sub-fields per item. Sent by Flexa 0.2+.
46
+ */
47
+ media?: Record<string, EntryMedia>;
38
48
  /** Present when the request includes `relations`. */
39
49
  relations?: Record<string, RelatedEntry[]>;
40
50
  created_at: string | null;
@@ -287,4 +297,4 @@ declare function isLocalized(value: unknown, locales?: readonly string[]): value
287
297
  */
288
298
  declare function localize<T>(value: Localized<T> | T | null | undefined, locale: string, fallbacks?: readonly string[]): T | null;
289
299
 
290
- export { type Category, type ContentSchema, EntityClient, type EntitySchema, type EntitySummary, type Entry, type EntryInput, type EntryStatus, type EntryValues, type FieldGroupSchema, type FieldSchema, type FieldType, FlexaClient, type FlexaClientOptions, FlexaError, type GetParams, type ListParams, type Localized, type Paginated, type PaginationMeta, type RelatedEntry, type RepeaterSubfield, type RequestOptions, createClient, isFlexaError, isLocalized, localize };
300
+ export { type Category, type ContentSchema, EntityClient, type EntitySchema, type EntitySummary, type Entry, type EntryInput, type EntryMedia, type EntryStatus, type EntryValues, type FieldGroupSchema, type FieldSchema, type FieldType, FlexaClient, type FlexaClientOptions, FlexaError, type GetParams, type ListParams, type Localized, type Paginated, type PaginationMeta, type RelatedEntry, type RepeaterSubfield, type RequestOptions, createClient, isFlexaError, isLocalized, localize };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,10 @@ type EntryValues = Record<string, unknown>;
14
14
  * workspace with `npx @flexacms/cli generate` to get typed `client.entity()`.
15
15
  */
16
16
  type ContentSchema = Record<string, EntryValues>;
17
+ /** A file URL, a list of them, translations of them, or repeater items holding them. */
18
+ type EntryMedia = string | null | (string | null)[] | {
19
+ [locale: string]: string | string[] | null;
20
+ } | Record<string, string | string[] | null>[];
17
21
  interface Category {
18
22
  id: number;
19
23
  name: string;
@@ -35,6 +39,12 @@ interface Entry<TValues extends object = EntryValues> {
35
39
  order: number | null;
36
40
  categories: Category[];
37
41
  values: TValues;
42
+ /**
43
+ * Absolute URLs of the files in image and file fields, keyed by field key
44
+ * and shaped like their values (`values` keeps the stored paths).
45
+ * Repeaters list their media sub-fields per item. Sent by Flexa 0.2+.
46
+ */
47
+ media?: Record<string, EntryMedia>;
38
48
  /** Present when the request includes `relations`. */
39
49
  relations?: Record<string, RelatedEntry[]>;
40
50
  created_at: string | null;
@@ -287,4 +297,4 @@ declare function isLocalized(value: unknown, locales?: readonly string[]): value
287
297
  */
288
298
  declare function localize<T>(value: Localized<T> | T | null | undefined, locale: string, fallbacks?: readonly string[]): T | null;
289
299
 
290
- export { type Category, type ContentSchema, EntityClient, type EntitySchema, type EntitySummary, type Entry, type EntryInput, type EntryStatus, type EntryValues, type FieldGroupSchema, type FieldSchema, type FieldType, FlexaClient, type FlexaClientOptions, FlexaError, type GetParams, type ListParams, type Localized, type Paginated, type PaginationMeta, type RelatedEntry, type RepeaterSubfield, type RequestOptions, createClient, isFlexaError, isLocalized, localize };
300
+ export { type Category, type ContentSchema, EntityClient, type EntitySchema, type EntitySummary, type Entry, type EntryInput, type EntryMedia, type EntryStatus, type EntryValues, type FieldGroupSchema, type FieldSchema, type FieldType, FlexaClient, type FlexaClientOptions, FlexaError, type GetParams, type ListParams, type Localized, type Paginated, type PaginationMeta, type RelatedEntry, type RepeaterSubfield, type RequestOptions, createClient, isFlexaError, isLocalized, localize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexacms/client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Typed, dependency-free client for the Flexa headless CMS content API.",
5
5
  "keywords": [
6
6
  "api-client",