@nohead/sdk 0.5.0 → 0.7.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.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Image renditions without a request (`@nohead/sdk/images`). Image URLs are
3
+ * open: an image asset's `image_url` serves the whole image, and any of
4
+ * imgproxy's processing options written into it transform it
5
+ * (https://docs.imgproxy.net/usage/processing). No dependencies, so it suits
6
+ * browser bundles and frameworks' image components.
7
+ *
8
+ * imageUrl(asset, { width: 800, height: 600, fit: "cover", format: "webp" })
9
+ */
10
+ export interface ImageOptions {
11
+ width?: number;
12
+ height?: number;
13
+ /** `contain` fits inside the box (the default), `cover` fills it, cropping, `fill` stretches to it. */
14
+ fit?: "contain" | "cover" | "fill";
15
+ format?: "webp" | "avif" | "jpeg" | "png";
16
+ /** 1 to 100. */
17
+ quality?: number;
18
+ /** Pixel density: 2 for a 2x screen. */
19
+ dpr?: number;
20
+ /** What a crop keeps, as imgproxy's gravity: `sm` (smart), `ce`, `no`, or `fp:0.5:0.3` (a focal point). */
21
+ gravity?: string;
22
+ /** Any other processing options, as written in a URL: `["bl:2", "sh:0.5"]`. */
23
+ options?: string[];
24
+ }
25
+ /** An image asset, or its `image_url`. */
26
+ export type ImageSource = string | {
27
+ image_url: string | null;
28
+ };
29
+ /** A rendition of an image: its `image_url` with these options. */
30
+ export declare function imageUrl(image: ImageSource, options?: ImageOptions): string;
31
+ /** Whether a URL is a Nohead image's: the loaders leave any other alone. */
32
+ export declare function isImageUrl(src: unknown): src is string;
33
+ /**
34
+ * A Next.js image loader. In a file named by `images.loaderFile` in
35
+ * next.config: `export { nextImageLoader as default } from "@nohead/sdk/images"`,
36
+ * then `<Image src={asset.image_url} width={…} height={…} alt={asset.alt} />`.
37
+ * Other images (the site's own) are left as they are.
38
+ */
39
+ export declare function nextImageLoader({ src, width, quality, }: {
40
+ src: string;
41
+ width: number;
42
+ quality?: number;
43
+ }): string;
44
+ /**
45
+ * An Astro image service (an external one: Astro never fetches the image).
46
+ * In a module named by `image.service.entrypoint` in astro.config:
47
+ * `export { astroImageService as default } from "@nohead/sdk/images"`.
48
+ * Other images (the site's own, imported or remote) are served as they are.
49
+ */
50
+ export declare const astroImageService: {
51
+ getURL(options: {
52
+ src: unknown;
53
+ width?: number;
54
+ height?: number;
55
+ format?: string;
56
+ quality?: number | string;
57
+ fit?: string;
58
+ }): string;
59
+ };
60
+ /**
61
+ * Nuxt Image's custom provider (`getImage`). In a file named as a provider
62
+ * in nuxt.config's `image.providers`: on Nuxt Image 2,
63
+ * `export { nuxtImageProvider as default } from "@nohead/sdk/images"`; on
64
+ * Nuxt Image 1, `export { getImage } from "@nohead/sdk/images"`. Other
65
+ * images are left as they are.
66
+ */
67
+ export declare function getImage(src: string, { modifiers }?: {
68
+ modifiers?: Record<string, unknown>;
69
+ }): {
70
+ url: string;
71
+ };
72
+ /** Nuxt Image 2's provider: what its `defineProvider({ getImage })` returns. */
73
+ export declare const nuxtImageProvider: () => {
74
+ getImage: typeof getImage;
75
+ };
package/dist/images.js ADDED
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Image renditions without a request (`@nohead/sdk/images`). Image URLs are
3
+ * open: an image asset's `image_url` serves the whole image, and any of
4
+ * imgproxy's processing options written into it transform it
5
+ * (https://docs.imgproxy.net/usage/processing). No dependencies, so it suits
6
+ * browser bundles and frameworks' image components.
7
+ *
8
+ * imageUrl(asset, { width: 800, height: 600, fit: "cover", format: "webp" })
9
+ */
10
+ const FITS = { contain: "fit", cover: "fill", fill: "force" };
11
+ /** A rendition of an image: its `image_url` with these options. */
12
+ export function imageUrl(image, options = {}) {
13
+ const base = typeof image === "string" ? image : image.image_url;
14
+ if (!base)
15
+ throw new TypeError("Not a ready image: it has no image_url");
16
+ const at = base.indexOf("/plain/");
17
+ if (at < 0)
18
+ throw new TypeError(`Not a Nohead image URL: ${base}`);
19
+ const { width, height, fit = "contain", format, quality, dpr, gravity, } = options;
20
+ for (const option of [gravity, ...(options.options ?? [])])
21
+ if (option && /[/@?#]/.test(option))
22
+ throw new TypeError(`Not an imgproxy option: ${option}`);
23
+ const segments = [];
24
+ if (width || height)
25
+ segments.push(`rs:${FITS[fit]}:${width ?? 0}:${height ?? 0}`);
26
+ if (gravity)
27
+ segments.push(`g:${gravity}`);
28
+ if (dpr)
29
+ segments.push(`dpr:${dpr}`);
30
+ if (quality)
31
+ segments.push(`q:${quality}`);
32
+ segments.push(...(options.options ?? []));
33
+ // The source comes last; a format replaces any the URL already names.
34
+ let source = base.slice(at);
35
+ if (format)
36
+ source = `${source.replace(/@[a-z]+$/, "")}@${format}`;
37
+ return `${base.slice(0, at)}${segments.map((s) => `/${s}`).join("")}${source}`;
38
+ }
39
+ /** Whether a URL is a Nohead image's: the loaders leave any other alone. */
40
+ export function isImageUrl(src) {
41
+ return (typeof src === "string" && /^https?:\/\/[^/]+\/(.*\/)?plain\//.test(src));
42
+ }
43
+ /**
44
+ * A Next.js image loader. In a file named by `images.loaderFile` in
45
+ * next.config: `export { nextImageLoader as default } from "@nohead/sdk/images"`,
46
+ * then `<Image src={asset.image_url} width={…} height={…} alt={asset.alt} />`.
47
+ * Other images (the site's own) are left as they are.
48
+ */
49
+ export function nextImageLoader({ src, width, quality, }) {
50
+ return isImageUrl(src) ? imageUrl(src, { width, quality }) : src;
51
+ }
52
+ const FORMATS = new Set(["webp", "avif", "jpeg", "png"]);
53
+ // Astro's and Nuxt Image's fits, as imgproxy has them.
54
+ const FRAMEWORK_FITS = {
55
+ cover: "cover",
56
+ contain: "contain",
57
+ fill: "fill",
58
+ inside: "contain",
59
+ outside: "cover",
60
+ };
61
+ const fitOf = (fit) => typeof fit === "string" ? FRAMEWORK_FITS[fit] : undefined;
62
+ const formatOf = (format) => typeof format === "string" && FORMATS.has(format)
63
+ ? format
64
+ : undefined;
65
+ /**
66
+ * An Astro image service (an external one: Astro never fetches the image).
67
+ * In a module named by `image.service.entrypoint` in astro.config:
68
+ * `export { astroImageService as default } from "@nohead/sdk/images"`.
69
+ * Other images (the site's own, imported or remote) are served as they are.
70
+ */
71
+ export const astroImageService = {
72
+ getURL(options) {
73
+ const { src } = options;
74
+ if (!isImageUrl(src)) {
75
+ const own = typeof src === "string" ? src : src?.src;
76
+ return typeof own === "string" ? own : "";
77
+ }
78
+ return imageUrl(src, {
79
+ width: options.width,
80
+ height: options.height,
81
+ fit: fitOf(options.fit),
82
+ format: formatOf(options.format),
83
+ quality: typeof options.quality === "number" ? options.quality : undefined,
84
+ });
85
+ },
86
+ };
87
+ /**
88
+ * Nuxt Image's custom provider (`getImage`). In a file named as a provider
89
+ * in nuxt.config's `image.providers`: on Nuxt Image 2,
90
+ * `export { nuxtImageProvider as default } from "@nohead/sdk/images"`; on
91
+ * Nuxt Image 1, `export { getImage } from "@nohead/sdk/images"`. Other
92
+ * images are left as they are.
93
+ */
94
+ export function getImage(src, { modifiers = {} } = {}) {
95
+ const number = (value) => typeof value === "number"
96
+ ? value
97
+ : typeof value === "string" && value
98
+ ? Number(value)
99
+ : undefined;
100
+ if (!isImageUrl(src))
101
+ return { url: src };
102
+ return {
103
+ url: imageUrl(src, {
104
+ width: number(modifiers.width),
105
+ height: number(modifiers.height),
106
+ fit: fitOf(modifiers.fit),
107
+ format: formatOf(modifiers.format),
108
+ quality: number(modifiers.quality),
109
+ }),
110
+ };
111
+ }
112
+ /** Nuxt Image 2's provider: what its `defineProvider({ getImage })` returns. */
113
+ export const nuxtImageProvider = () => ({ getImage });
@@ -1,7 +1,7 @@
1
1
  import type { APIPromise, PagePromise } from "../api-promise.ts";
2
2
  import type { RequestOptions } from "../core.ts";
3
- import type { Asset, AssetUploadCreate, AssetWithUpload, AssetUsage, DownloadUrl, ImageUrl } from "../generated/types.gen.ts";
4
- import type { AssetListParams, ImageUrlParams } from "../types.ts";
3
+ import type { Asset, AssetUpdate, AssetUploadCreate, AssetWithUpload, AssetUsage, DownloadUrl } from "../generated/types.gen.ts";
4
+ import type { AssetListParams } from "../types.ts";
5
5
  import { Resource } from "./resource.ts";
6
6
  /** What `assets.upload` accepts. A stream needs `byte_size`. */
7
7
  export type Uploadable = Blob | ArrayBuffer | Uint8Array | ReadableStream;
@@ -13,7 +13,6 @@ export interface UploadParams {
13
13
  /** Required for a `ReadableStream`; known for everything else. */
14
14
  byte_size?: number;
15
15
  }
16
- /** Files of the key's project. `asset` is an asset ID (`ast_…`). */
17
16
  export declare class Assets extends Resource {
18
17
  /**
19
18
  * Uploads a file and returns the `ready` asset: creates the upload, sends
@@ -28,6 +27,9 @@ export declare class Assets extends Resource {
28
27
  *
29
28
  * import { openAsBlob } from "node:fs"
30
29
  * const asset = await nohead.assets.upload(await openAsBlob("a.jpg"), { filename: "a.jpg" })
30
+ *
31
+ * Without `content_type`, the type is the Blob's, or else the filename's
32
+ * extension's for common files.
31
33
  */
32
34
  upload(file: Uploadable, params?: UploadParams, options?: RequestOptions): Promise<Asset>;
33
35
  /**
@@ -38,8 +40,15 @@ export declare class Assets extends Resource {
38
40
  createUpload(params: AssetUploadCreate, options?: RequestOptions): APIPromise<AssetWithUpload>;
39
41
  /** Checks an uploaded file and marks the asset `ready`. */
40
42
  complete(asset: string, options?: RequestOptions): APIPromise<Asset>;
41
- list({ content_type, ...params }?: AssetListParams, options?: RequestOptions): PagePromise<Asset>;
43
+ list({ content_type, kind, ...params }?: AssetListParams, options?: RequestOptions): PagePromise<Asset>;
42
44
  get(asset: string, options?: RequestOptions): APIPromise<Asset>;
45
+ /**
46
+ * Renames the asset (`filename`) or sets its `alt` text (`null` or `""`
47
+ * clears it). The file itself can't change: upload a new asset for that.
48
+ * `alt` is the default wherever the asset is used. A deleted asset is a
49
+ * `ConflictError`: restore it first.
50
+ */
51
+ update(asset: string, params: AssetUpdate, options?: RequestOptions): APIPromise<Asset>;
43
52
  /**
44
53
  * Soft-deletes the asset: `restore` brings it back until its
45
54
  * `purge_after`, when the file is purged (or now, with `purge`).
@@ -60,8 +69,6 @@ export declare class Assets extends Resource {
60
69
  * updated with the fields that use it (`uses`). Needs `records:read` too.
61
70
  */
62
71
  usage(asset: string, options?: RequestOptions): APIPromise<AssetUsage>;
63
- /** A signed, cacheable URL of an image rendition (`url`). */
64
- imageUrl(asset: string, params?: ImageUrlParams, options?: RequestOptions): APIPromise<ImageUrl>;
65
- /** A 15-minute link to download the original file (`url`). */
72
+ /** A link to download the original file (`url`), valid for 2 minutes. */
66
73
  downloadUrl(asset: string, options?: RequestOptions): APIPromise<DownloadUrl>;
67
74
  }
@@ -1,6 +1,31 @@
1
1
  import { AbortError, UploadError } from "../errors.js";
2
2
  import { listQuery, Resource } from "./resource.js";
3
3
  /** Files of the key's project. `asset` is an asset ID (`ast_…`). */
4
+ /** Common files' types by extension, as the other SDKs guess them. */
5
+ const CONTENT_TYPES = {
6
+ avif: "image/avif",
7
+ gif: "image/gif",
8
+ jpeg: "image/jpeg",
9
+ jpg: "image/jpeg",
10
+ png: "image/png",
11
+ svg: "image/svg+xml",
12
+ webp: "image/webp",
13
+ pdf: "application/pdf",
14
+ json: "application/json",
15
+ txt: "text/plain",
16
+ md: "text/markdown",
17
+ csv: "text/csv",
18
+ mp3: "audio/mpeg",
19
+ mp4: "video/mp4",
20
+ webm: "video/webm",
21
+ zip: "application/zip",
22
+ };
23
+ function contentTypeOf(filename) {
24
+ const dot = filename.lastIndexOf(".");
25
+ return dot > 0
26
+ ? CONTENT_TYPES[filename.slice(dot + 1).toLowerCase()]
27
+ : undefined;
28
+ }
4
29
  export class Assets extends Resource {
5
30
  /**
6
31
  * Uploads a file and returns the `ready` asset: creates the upload, sends
@@ -15,19 +40,28 @@ export class Assets extends Resource {
15
40
  *
16
41
  * import { openAsBlob } from "node:fs"
17
42
  * const asset = await nohead.assets.upload(await openAsBlob("a.jpg"), { filename: "a.jpg" })
43
+ *
44
+ * Without `content_type`, the type is the Blob's, or else the filename's
45
+ * extension's for common files.
18
46
  */
19
47
  async upload(file, params = {}, options) {
20
48
  const byteSize = params.byte_size ?? sizeOf(file);
21
49
  if (byteSize === undefined) {
22
50
  throw new UploadError("Uploading a stream needs `byte_size`");
23
51
  }
52
+ const filename = params.filename ??
53
+ (typeof File !== "undefined" && file instanceof File
54
+ ? file.name
55
+ : "upload");
24
56
  const { upload, ...asset } = await this.createUpload({
25
- filename: params.filename ??
26
- (typeof File !== "undefined" && file instanceof File
27
- ? file.name
28
- : "upload"),
57
+ filename,
58
+ // The Blob's own type, or one the filename's extension implies (a
59
+ // Blob from Node's openAsBlob has none), as the Python and Ruby
60
+ // SDKs do.
29
61
  content_type: params.content_type ??
30
- ((file instanceof Blob && file.type) || "application/octet-stream"),
62
+ ((file instanceof Blob && file.type) ||
63
+ contentTypeOf(filename) ||
64
+ "application/octet-stream"),
31
65
  byte_size: byteSize,
32
66
  }, options);
33
67
  // A replayed start returns the first run's asset, which may be done.
@@ -74,19 +108,29 @@ export class Assets extends Resource {
74
108
  complete(asset, options) {
75
109
  return this.core.request("assets_complete", { path: { asset_id: asset } }, options);
76
110
  }
77
- list({ content_type, ...params } = {}, options) {
111
+ list({ content_type, kind, ...params } = {}, options) {
78
112
  return this.core.paginate("assets_list", {
79
113
  query: listQuery({
80
114
  ...params,
81
115
  content_type: Array.isArray(content_type)
82
116
  ? { in: content_type }
83
117
  : content_type,
84
- }, ["deleted", "content_type"]),
118
+ kind: Array.isArray(kind) ? { in: kind } : kind,
119
+ }, ["deleted", "content_type", "kind"]),
85
120
  }, options);
86
121
  }
87
122
  get(asset, options) {
88
123
  return this.core.request("assets_get", { path: { asset_id: asset } }, options);
89
124
  }
125
+ /**
126
+ * Renames the asset (`filename`) or sets its `alt` text (`null` or `""`
127
+ * clears it). The file itself can't change: upload a new asset for that.
128
+ * `alt` is the default wherever the asset is used. A deleted asset is a
129
+ * `ConflictError`: restore it first.
130
+ */
131
+ update(asset, params, options) {
132
+ return this.core.request("assets_update", { path: { asset_id: asset }, body: params }, options);
133
+ }
90
134
  /**
91
135
  * Soft-deletes the asset: `restore` brings it back until its
92
136
  * `purge_after`, when the file is purged (or now, with `purge`).
@@ -115,11 +159,7 @@ export class Assets extends Resource {
115
159
  usage(asset, options) {
116
160
  return this.core.request("assets_usage", { path: { asset_id: asset } }, options);
117
161
  }
118
- /** A signed, cacheable URL of an image rendition (`url`). */
119
- imageUrl(asset, params = {}, options) {
120
- return this.core.request("assets_image_url", { path: { asset_id: asset }, query: params }, options);
121
- }
122
- /** A 15-minute link to download the original file (`url`). */
162
+ /** A link to download the original file (`url`), valid for 2 minutes. */
123
163
  downloadUrl(asset, options) {
124
164
  return this.core.request("assets_download_url", { path: { asset_id: asset } }, options);
125
165
  }
@@ -12,8 +12,12 @@ export declare class Records extends Resource {
12
12
  /** A collection's records, newest first by default. */
13
13
  list<D = RecordData>(collection: string, params?: RecordListParams, options?: RequestOptions): PagePromise<NoheadRecord<D>>;
14
14
  get<D = RecordData>(record: string, params?: RecordGetParams, options?: RequestOptions): APIPromise<NoheadRecord<D>>;
15
- /** Creates an unpublished record. */
16
- create<D = RecordData>(collection: string, params: RecordCreateParams<D>, options?: WriteOptions): APIPromise<NoheadRecord<D>>;
15
+ /**
16
+ * Creates an unpublished record. With `upsert_on`, updates the record
17
+ * holding that unique value instead, if one exists, so a sync can run
18
+ * again without duplicates; `ifMatch` then applies to that update.
19
+ */
20
+ create<D = RecordData>(collection: string, params: RecordCreateParams<D>, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
17
21
  /** Sets the given fields (`null` clears one); others keep their values. */
18
22
  update<D = RecordData>(record: string, params: RecordUpdateParams<D>, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
19
23
  /**
@@ -49,9 +53,9 @@ export declare class Records extends Resource {
49
53
  /** Clears both scheduled times. */
50
54
  unschedule(record: string, options?: RequestOptions): APIPromise<RecordSchedule>;
51
55
  /**
52
- * A collection's pending scheduled publishes and unpublishes, soonest
53
- * first: one per change, so a record due to publish and later unpublish
54
- * appears twice.
56
+ * A collection's pending scheduled changes, soonest first: publishes,
57
+ * unpublishes and draft merges, one per change, so a record due to publish
58
+ * and later unpublish appears twice.
55
59
  */
56
60
  scheduledChanges(collection: string, params?: ScheduledChangeListParams, options?: RequestOptions): PagePromise<ScheduledChange>;
57
61
  count(collection: string, params?: RecordCountParams, options?: RequestOptions): APIPromise<RecordCount>;
@@ -63,7 +67,7 @@ export declare class Records extends Resource {
63
67
  /** The changes between two revisions. */
64
68
  diff(record: string, params: RecordDiffParams, options?: RequestOptions): APIPromise<RecordDiff>;
65
69
  /**
66
- * Full-text search in one collection (`search_enabled` collections).
70
+ * Full-text search in one collection, matching its `searchable` fields.
67
71
  * Pages through the first 1,000 hits, most relevant first.
68
72
  */
69
73
  search<D = RecordData>(collection: string, query: string, params?: RecordSearchParams, options?: RequestOptions): PagePromise<NoheadRecord<D>, SearchMeta>;
@@ -79,3 +83,10 @@ export declare class Revisions extends Resource {
79
83
  }, options?: ConditionalWriteOptions): APIPromise<RevertPreview>;
80
84
  revert<D = RecordData>(record: string, revision: number, params?: DryRunParams, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
81
85
  }
86
+ /**
87
+ * A revision by its own ID (`rev_…`), as webhooks and the activity log name
88
+ * it. Readable while its record is deleted.
89
+ */
90
+ export declare class RevisionsById extends Resource {
91
+ get(revision: string, options?: RequestOptions): APIPromise<RecordRevisionDetail>;
92
+ }
@@ -12,7 +12,11 @@ export class Records extends Resource {
12
12
  get(record, params = {}, options) {
13
13
  return this.core.request("records_get", { path: { record_id: record }, query: params }, options);
14
14
  }
15
- /** Creates an unpublished record. */
15
+ /**
16
+ * Creates an unpublished record. With `upsert_on`, updates the record
17
+ * holding that unique value instead, if one exists, so a sync can run
18
+ * again without duplicates; `ifMatch` then applies to that update.
19
+ */
16
20
  create(collection, params, options) {
17
21
  return this.core.request("records_create", { path: { collection_id: collection }, body: params }, options);
18
22
  }
@@ -71,9 +75,9 @@ export class Records extends Resource {
71
75
  return this.core.request("records_unschedule", { path: { record_id: record } }, options);
72
76
  }
73
77
  /**
74
- * A collection's pending scheduled publishes and unpublishes, soonest
75
- * first: one per change, so a record due to publish and later unpublish
76
- * appears twice.
78
+ * A collection's pending scheduled changes, soonest first: publishes,
79
+ * unpublishes and draft merges, one per change, so a record due to publish
80
+ * and later unpublish appears twice.
77
81
  */
78
82
  scheduledChanges(collection, params = {}, options) {
79
83
  return this.core.paginate("scheduled_changes_list", { path: { collection_id: collection }, query: params }, options);
@@ -93,7 +97,7 @@ export class Records extends Resource {
93
97
  return this.core.request("records_diff", { path: { record_id: record }, query: params }, options);
94
98
  }
95
99
  /**
96
- * Full-text search in one collection (`search_enabled` collections).
100
+ * Full-text search in one collection, matching its `searchable` fields.
97
101
  * Pages through the first 1,000 hits, most relevant first.
98
102
  */
99
103
  search(collection, query, params = {}, options) {
@@ -113,3 +117,12 @@ export class Revisions extends Resource {
113
117
  return this.core.request("record_revisions_revert", { path: { record_id: record, revision }, query: params }, options);
114
118
  }
115
119
  }
120
+ /**
121
+ * A revision by its own ID (`rev_…`), as webhooks and the activity log name
122
+ * it. Readable while its record is deleted.
123
+ */
124
+ export class RevisionsById extends Resource {
125
+ get(revision, options) {
126
+ return this.core.request("revisions_get", { path: { revision_id: revision } }, options);
127
+ }
128
+ }
package/dist/types.d.ts CHANGED
@@ -71,6 +71,11 @@ export interface RecordGetParams {
71
71
  }
72
72
  export interface RecordCreateParams<D = G.RecordData> {
73
73
  data: D;
74
+ /**
75
+ * The key of a `unique` field whose value `data` includes: the active
76
+ * record holding that value is updated instead, if there is one.
77
+ */
78
+ upsert_on?: string;
74
79
  }
75
80
  export interface RecordUpdateParams<D = G.RecordData> {
76
81
  data: RecordDataUpdate<D>;
@@ -152,6 +157,17 @@ export interface DeletedListParams extends ListParams {
152
157
  deleted?: boolean;
153
158
  }
154
159
  export interface AssetListParams extends DeletedListParams {
160
+ /**
161
+ * Words that must each appear in the filename or the alt text, ignoring
162
+ * case: `"hero jpg"` finds `Hero-banner.jpg`.
163
+ */
164
+ q?: string;
165
+ /**
166
+ * Only assets of a kind, or of any of several: `"image"`, `"video"` and
167
+ * `"audio"` by their types, `"document"` for PDFs, text and office files,
168
+ * `"other"` for every other file.
169
+ */
170
+ kind?: G.AssetKind | G.AssetKind[];
155
171
  /**
156
172
  * Only assets of a MIME type or `type/*` wildcard (`"image/*"`), or of any
157
173
  * of several: `["image/*", "application/pdf"]`, such as an asset
@@ -169,7 +185,6 @@ export interface FieldReorderParams {
169
185
  /** Every active field of the collection, once each, in the new order. */
170
186
  field_ids: string[];
171
187
  }
172
- export type ImageUrlParams = NonNullable<G.AssetsImageUrlData["query"]>;
173
188
  export interface DeliveryListParams extends ListParams {
174
189
  status?: "pending" | "succeeded" | "failed";
175
190
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.5.0";
1
+ export declare const VERSION = "0.7.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.5.0";
1
+ export const VERSION = "0.7.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nohead/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Official TypeScript SDK for the Nohead API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://nohead.io",
@@ -27,6 +27,10 @@
27
27
  "types": "./dist/webhooks.d.ts",
28
28
  "default": "./dist/webhooks.js"
29
29
  },
30
+ "./images": {
31
+ "types": "./dist/images.d.ts",
32
+ "default": "./dist/images.js"
33
+ },
30
34
  "./package.json": "./package.json"
31
35
  },
32
36
  "files": [