@nohead/sdk 0.9.0 → 0.10.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/CHANGELOG.md +9 -0
- package/README.md +21 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.js +2 -2
- package/dist/core.d.ts +27 -5
- package/dist/core.js +9 -1
- package/dist/generated/operations.gen.d.ts +2 -0
- package/dist/generated/operations.gen.js +24 -0
- package/dist/generated/types.gen.d.ts +165 -33
- package/dist/index.d.ts +1 -1
- package/dist/resources/drafts.d.ts +9 -9
- package/dist/resources/records.d.ts +14 -14
- package/dist/types.d.ts +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ Changes to `@nohead/sdk` that you can notice. Versions follow
|
|
|
5
5
|
releases; a change that could break your code is a major one. Each release's
|
|
6
6
|
section is its GitHub release's notes.
|
|
7
7
|
|
|
8
|
+
## 0.10.0
|
|
9
|
+
|
|
10
|
+
- Rich text reads as HTML or Markdown: `richText: "html"` (or `"markdown"`)
|
|
11
|
+
on the client, or in a request's options, sends the API's `rich_text`
|
|
12
|
+
query parameter on the methods that return records or drafts, so a rich
|
|
13
|
+
text field's value in `data` is a string instead of the document. A
|
|
14
|
+
request's `richText` overrides the client's, and `withOptions` can change
|
|
15
|
+
it. Writing Markdown already worked: `data` is sent as it is.
|
|
16
|
+
|
|
8
17
|
## 0.9.0
|
|
9
18
|
|
|
10
19
|
- **Breaking:** the client no longer reads `NOHEAD_API_URL`: a stray value
|
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ for await (const post of nohead.records.list("posts", {
|
|
|
22
22
|
- [Configuration](#configuration)
|
|
23
23
|
- [Records](#records)
|
|
24
24
|
- [Drafts](#drafts)
|
|
25
|
+
- [Rich text](#rich-text)
|
|
25
26
|
- [Pagination](#pagination)
|
|
26
27
|
- [Errors](#errors)
|
|
27
28
|
- [Retries and idempotency](#retries-and-idempotency)
|
|
@@ -65,10 +66,11 @@ const nohead = new Nohead({
|
|
|
65
66
|
| `headers` | `{}` | Added to every request. |
|
|
66
67
|
| `warnings` | `true` | Logs deprecation and plan usage warnings, once each. |
|
|
67
68
|
| `onRetry` | | Called before each retry. See [retries](#retries-and-idempotency). |
|
|
69
|
+
| `richText` | `"document"` | How rich text reads: `"html"` or `"markdown"`. See [rich text](#rich-text). |
|
|
68
70
|
|
|
69
71
|
An empty option counts as unset, as an empty environment variable does: `apiKey: ""` falls back to `NOHEAD_API_KEY`, and `baseUrl: ""` to `https://api.nohead.io`. The base URL comes only from `baseUrl`, never from the environment. A `baseUrl` that isn't an `http` or `https` URL throws.
|
|
70
72
|
|
|
71
|
-
`withOptions` copies a client with another `timeout`, `maxRetries` or `
|
|
73
|
+
`withOptions` copies a client with another `timeout`, `maxRetries`, `onRetry` or `richText`, or more `headers` (added to the client's). The copy shares the key's project, so it doesn't look it up again:
|
|
72
74
|
|
|
73
75
|
```ts
|
|
74
76
|
const patient = nohead.withOptions({ timeout: 120_000, maxRetries: 5 })
|
|
@@ -142,6 +144,24 @@ await nohead.drafts.merge(draft.id) // or drafts.schedule(draft.id, { merge_at }
|
|
|
142
144
|
- `drafts.discard` deletes one for good.
|
|
143
145
|
- Drafts take the type of their data as records do: `drafts.get<Post>(id)` is a `Nohead.Draft<Post>` (also exported as `NoheadDraft`).
|
|
144
146
|
|
|
147
|
+
## Rich text
|
|
148
|
+
|
|
149
|
+
A rich text field takes Markdown or a ProseMirror document, and reads as the document. To read it as HTML or Markdown, set `richText` on the client, or on one request:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
await nohead.records.update(id, { data: { body: "Hello **world**" } })
|
|
153
|
+
|
|
154
|
+
const site = nohead.withOptions({ richText: "html" })
|
|
155
|
+
const post = await site.records.get<{ body: string }>(id)
|
|
156
|
+
const html = `<article>${post.data.body}</article>` // safe to put in a page as it is
|
|
157
|
+
|
|
158
|
+
await nohead.drafts.get(draftId, {}, { richText: "markdown" })
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- A rich text field's value is then a string: type it as one in the data's type, as above.
|
|
162
|
+
- It applies to the methods that return records or drafts, and to the records they embed with `expand`; a request's `richText` overrides the client's. History (`revisions`) and webhooks keep documents.
|
|
163
|
+
- A string you write is read as Markdown, so write back Markdown or the document, never the HTML: with `richText: "html"` on the client, writes answer with HTML too.
|
|
164
|
+
|
|
145
165
|
## Pagination
|
|
146
166
|
|
|
147
167
|
List methods return a promise of the first page that you can also loop over:
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PagePromise } from "./api-promise.ts";
|
|
2
|
-
import { type ClientOptions, type CopyOptions, type
|
|
2
|
+
import { type ClientOptions, type CopyOptions, type RichTextOptions } from "./core.ts";
|
|
3
3
|
import type * as G from "./generated/types.gen.ts";
|
|
4
4
|
import { Assets } from "./resources/assets.ts";
|
|
5
5
|
import { Drafts } from "./resources/drafts.ts";
|
|
@@ -32,8 +32,8 @@ export declare class Nohead {
|
|
|
32
32
|
readonly health: Health;
|
|
33
33
|
constructor(options?: ClientOptions);
|
|
34
34
|
/**
|
|
35
|
-
* A copy of the client with another `timeout`, `maxRetries` or
|
|
36
|
-
* or more `headers` (added to this client's). It shares the key's project,
|
|
35
|
+
* A copy of the client with another `timeout`, `maxRetries`, `onRetry` or
|
|
36
|
+
* `richText`, or more `headers` (added to this client's). It shares the key's project,
|
|
37
37
|
* so it doesn't look it up again.
|
|
38
38
|
*
|
|
39
39
|
* await nohead.withOptions({ timeout: 5_000 }).records.get(id)
|
|
@@ -43,7 +43,7 @@ export declare class Nohead {
|
|
|
43
43
|
* Full-text search across the key's project (or some of its
|
|
44
44
|
* collections), most relevant first, through the first 1,000 hits.
|
|
45
45
|
*/
|
|
46
|
-
search<D = RecordData>(query: string, params?: ProjectSearchParams, options?:
|
|
46
|
+
search<D = RecordData>(query: string, params?: ProjectSearchParams, options?: RichTextOptions): PagePromise<NoheadRecord<D>, SearchMeta>;
|
|
47
47
|
}
|
|
48
48
|
/** The main types, also reachable as `Nohead.Record`, `Nohead.Collection`… */
|
|
49
49
|
export declare namespace Nohead {
|
package/dist/client.js
CHANGED
|
@@ -44,8 +44,8 @@ export class Nohead {
|
|
|
44
44
|
this.health = new Health(core);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* A copy of the client with another `timeout`, `maxRetries` or
|
|
48
|
-
* or more `headers` (added to this client's). It shares the key's project,
|
|
47
|
+
* A copy of the client with another `timeout`, `maxRetries`, `onRetry` or
|
|
48
|
+
* `richText`, or more `headers` (added to this client's). It shares the key's project,
|
|
49
49
|
* so it doesn't look it up again.
|
|
50
50
|
*
|
|
51
51
|
* await nohead.withOptions({ timeout: 5_000 }).records.get(id)
|
package/dist/core.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { APIPromise, PagePromise } from "./api-promise.ts";
|
|
|
2
2
|
import { NoheadError } from "./errors.ts";
|
|
3
3
|
import { type OperationId, type Operations } from "./generated/operations.gen.ts";
|
|
4
4
|
import type { ListMeta } from "./generated/types.gen.ts";
|
|
5
|
+
import type { RichText } from "./types.ts";
|
|
5
6
|
export declare const DEFAULT_BASE_URL = "https://api.nohead.io";
|
|
6
7
|
export interface ClientOptions {
|
|
7
8
|
/**
|
|
@@ -31,9 +32,15 @@ export interface ClientOptions {
|
|
|
31
32
|
warnings?: boolean;
|
|
32
33
|
/** Called before each retry, for example to report it. */
|
|
33
34
|
onRetry?: (retry: RetryEvent) => void;
|
|
35
|
+
/**
|
|
36
|
+
* How rich text fields read in the records and drafts returned: as HTML
|
|
37
|
+
* or Markdown strings, or as the stored document (the API's default). A
|
|
38
|
+
* request's `richText` overrides it.
|
|
39
|
+
*/
|
|
40
|
+
richText?: RichText;
|
|
34
41
|
}
|
|
35
42
|
/** What `withOptions` changes in a client's copy. */
|
|
36
|
-
export type CopyOptions = Pick<ClientOptions, "timeout" | "maxRetries" | "headers" | "onRetry">;
|
|
43
|
+
export type CopyOptions = Pick<ClientOptions, "timeout" | "maxRetries" | "headers" | "onRetry" | "richText">;
|
|
37
44
|
/** A retry about to happen (`onRetry`). */
|
|
38
45
|
export interface RetryEvent {
|
|
39
46
|
/** 1 for the first retry of the request, 2 for the second… */
|
|
@@ -57,6 +64,15 @@ export interface RequestOptions {
|
|
|
57
64
|
maxRetries?: number;
|
|
58
65
|
headers?: Record<string, string>;
|
|
59
66
|
}
|
|
67
|
+
/** Options of operations that return records or drafts. */
|
|
68
|
+
export interface RichTextOptions extends RequestOptions {
|
|
69
|
+
/**
|
|
70
|
+
* How rich text fields read in the records or drafts returned (and in
|
|
71
|
+
* records they embed with `expand`), overriding the client's `richText`:
|
|
72
|
+
* `"html"` or `"markdown"` strings, or the stored `"document"`.
|
|
73
|
+
*/
|
|
74
|
+
richText?: RichText;
|
|
75
|
+
}
|
|
60
76
|
/** Options of writes that change records or the schema. */
|
|
61
77
|
export interface WriteOptions extends RequestOptions {
|
|
62
78
|
/**
|
|
@@ -83,15 +99,21 @@ export interface ConditionalWriteOptions extends WriteOptions, ConditionalReques
|
|
|
83
99
|
type HeadersOf<Op extends OperationId> = Operations[Op]["data"] extends {
|
|
84
100
|
headers?: infer H;
|
|
85
101
|
} ? keyof NonNullable<H> : never;
|
|
102
|
+
/** The query parameters an operation declares. */
|
|
103
|
+
type QueryOf<Op extends OperationId> = Operations[Op]["data"] extends {
|
|
104
|
+
query?: infer Q;
|
|
105
|
+
} ? keyof NonNullable<Q> : never;
|
|
86
106
|
/**
|
|
87
|
-
* The options an operation takes: `ifMatch` and `
|
|
88
|
-
* declares `If-Match
|
|
89
|
-
* elsewhere.
|
|
107
|
+
* The options an operation takes: `ifMatch`, `changeNote` and `richText`
|
|
108
|
+
* only where it declares `If-Match`, `Nohead-Change-Note` and `rich_text`,
|
|
109
|
+
* so a method can't offer them elsewhere.
|
|
90
110
|
*/
|
|
91
111
|
export type OptionsOf<Op extends OperationId> = RequestOptions & ("If-Match" extends HeadersOf<Op> ? Pick<ConditionalRequestOptions, "ifMatch"> : {
|
|
92
112
|
ifMatch?: never;
|
|
93
113
|
}) & ("Nohead-Change-Note" extends HeadersOf<Op> ? Pick<WriteOptions, "changeNote"> : {
|
|
94
114
|
changeNote?: never;
|
|
115
|
+
}) & ("rich_text" extends QueryOf<Op> ? Pick<RichTextOptions, "richText"> : {
|
|
116
|
+
richText?: never;
|
|
95
117
|
});
|
|
96
118
|
export interface RequestInput {
|
|
97
119
|
path?: Record<string, string | number | undefined>;
|
|
@@ -109,7 +131,7 @@ export declare class Core {
|
|
|
109
131
|
projectId(): Promise<string>;
|
|
110
132
|
request<Op extends OperationId>(operation: Op, input?: RequestInput, options?: OptionsOf<Op>): APIPromise<Operations[Op]["response"]>;
|
|
111
133
|
/** A list operation as pages of `Item`. */
|
|
112
|
-
paginate<Item, Meta extends ListMeta = ListMeta>(operation:
|
|
134
|
+
paginate<Item, Meta extends ListMeta = ListMeta, Op extends OperationId = OperationId>(operation: Op, input: RequestInput, options?: OptionsOf<Op>): PagePromise<Item, Meta>;
|
|
113
135
|
/**
|
|
114
136
|
* `fetch` with this client's retries, for an upload's presigned URL. fetch
|
|
115
137
|
* shows no upload progress, so each attempt may take as long as sending
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIPromise, Page, PagePromise, } from "./api-promise.js";
|
|
2
2
|
import { AbortError, ConnectionError, NoheadError, TimeoutError, apiError, isObject, retryAfterSeconds, } from "./errors.js";
|
|
3
|
-
import { OPERATIONS, } from "./generated/operations.gen.js";
|
|
3
|
+
import { OPERATIONS, RICH_TEXT_OPERATIONS, } from "./generated/operations.gen.js";
|
|
4
4
|
import { VERSION } from "./version.js";
|
|
5
5
|
export const DEFAULT_BASE_URL = "https://api.nohead.io";
|
|
6
6
|
const RETRYABLE_STATUSES = new Set([429, 500, 502, 503, 504]);
|
|
@@ -18,6 +18,7 @@ export class Core {
|
|
|
18
18
|
#timeout;
|
|
19
19
|
#warnings;
|
|
20
20
|
#onRetry;
|
|
21
|
+
#richText;
|
|
21
22
|
// The project lookup, shared with the client's copies (`withOptions`).
|
|
22
23
|
#project;
|
|
23
24
|
constructor(options, project = {}) {
|
|
@@ -34,6 +35,7 @@ export class Core {
|
|
|
34
35
|
this.#timeout = options.timeout ?? 60_000;
|
|
35
36
|
this.#warnings = options.warnings ?? true;
|
|
36
37
|
this.#onRetry = options.onRetry;
|
|
38
|
+
this.#richText = options.richText;
|
|
37
39
|
this.#project = project;
|
|
38
40
|
if (options.projectId)
|
|
39
41
|
project.id ??= Promise.resolve(options.projectId);
|
|
@@ -49,6 +51,7 @@ export class Core {
|
|
|
49
51
|
timeout: options.timeout ?? this.#timeout,
|
|
50
52
|
warnings: this.#warnings,
|
|
51
53
|
onRetry: options.onRetry ?? this.#onRetry,
|
|
54
|
+
richText: options.richText || this.#richText,
|
|
52
55
|
}, this.#project);
|
|
53
56
|
}
|
|
54
57
|
/** The API key's project, from `GET /v1/me` the first time. */
|
|
@@ -117,6 +120,11 @@ export class Core {
|
|
|
117
120
|
const { method, path } = OPERATIONS[operation];
|
|
118
121
|
const url = new URL(this.#baseUrl + (await this.#path(path, input.path)));
|
|
119
122
|
appendQuery(url.searchParams, input.query);
|
|
123
|
+
// The call's, else the client's, and only where the operation takes it.
|
|
124
|
+
const richText = options.richText || this.#richText;
|
|
125
|
+
if (richText && RICH_TEXT_OPERATIONS.has(operation)) {
|
|
126
|
+
url.searchParams.set("rich_text", richText);
|
|
127
|
+
}
|
|
120
128
|
// Each name once, whatever its case: the defaults, then the client's
|
|
121
129
|
// headers, the call's, and those of the request options, which win.
|
|
122
130
|
const headers = {};
|
|
@@ -326,6 +326,8 @@ export declare const OPERATIONS: {
|
|
|
326
326
|
};
|
|
327
327
|
};
|
|
328
328
|
export type OperationId = keyof typeof OPERATIONS;
|
|
329
|
+
/** The operations that take `rich_text`: those returning records or drafts. */
|
|
330
|
+
export declare const RICH_TEXT_OPERATIONS: ReadonlySet<OperationId>;
|
|
329
331
|
export interface Operations {
|
|
330
332
|
assets_complete: {
|
|
331
333
|
data: T.AssetsCompleteData;
|
|
@@ -81,3 +81,27 @@ export const OPERATIONS = {
|
|
|
81
81
|
webhooks_test: { method: "POST", path: "/v1/webhooks/{webhook_id}/test" },
|
|
82
82
|
webhooks_update: { method: "PATCH", path: "/v1/webhooks/{webhook_id}" },
|
|
83
83
|
};
|
|
84
|
+
/** The operations that take `rich_text`: those returning records or drafts. */
|
|
85
|
+
export const RICH_TEXT_OPERATIONS = new Set([
|
|
86
|
+
"collections_search",
|
|
87
|
+
"drafts_create",
|
|
88
|
+
"drafts_discard",
|
|
89
|
+
"drafts_get",
|
|
90
|
+
"drafts_list",
|
|
91
|
+
"drafts_merge",
|
|
92
|
+
"drafts_schedule",
|
|
93
|
+
"drafts_unschedule",
|
|
94
|
+
"drafts_update",
|
|
95
|
+
"projects_search",
|
|
96
|
+
"record_drafts_list",
|
|
97
|
+
"record_revisions_revert",
|
|
98
|
+
"records_bulk",
|
|
99
|
+
"records_create",
|
|
100
|
+
"records_delete",
|
|
101
|
+
"records_get",
|
|
102
|
+
"records_list",
|
|
103
|
+
"records_publish",
|
|
104
|
+
"records_restore",
|
|
105
|
+
"records_unpublish",
|
|
106
|
+
"records_update",
|
|
107
|
+
]);
|
|
@@ -219,6 +219,9 @@ export type LongTextFieldConfiguration = {
|
|
|
219
219
|
min_length?: number;
|
|
220
220
|
max_length?: number;
|
|
221
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* A rich text document up to 1,000,000 bytes (`too_large`), written as Markdown or a document (see `RecordData`).
|
|
224
|
+
*/
|
|
222
225
|
export type RichTextFieldConfiguration = {
|
|
223
226
|
/**
|
|
224
227
|
* Help text for editors.
|
|
@@ -388,6 +391,9 @@ export type RelationFieldConfiguration = {
|
|
|
388
391
|
*/
|
|
389
392
|
target_collection_id: string;
|
|
390
393
|
};
|
|
394
|
+
/**
|
|
395
|
+
* Any JSON value up to 100,000 bytes (`too_large`), nested at most 32 levels deep (`too_deep`): for data with a shape of its own, such as settings or another service's payload. Content belongs in typed fields, and large data in an asset.
|
|
396
|
+
*/
|
|
391
397
|
export type JsonFieldConfiguration = {
|
|
392
398
|
/**
|
|
393
399
|
* Help text for editors.
|
|
@@ -595,6 +601,9 @@ export type CollectionCreate = {
|
|
|
595
601
|
slug: string;
|
|
596
602
|
description?: string | null;
|
|
597
603
|
public_search?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* At most 100 (`too_many`).
|
|
606
|
+
*/
|
|
598
607
|
fields?: Array<FieldCreate>;
|
|
599
608
|
};
|
|
600
609
|
export type CollectionUpdate = {
|
|
@@ -967,14 +976,38 @@ export type MergedDraft = {
|
|
|
967
976
|
edited_by: Array<Actor>;
|
|
968
977
|
};
|
|
969
978
|
/**
|
|
970
|
-
* Field values keyed by field `key`.
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
* "
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
*
|
|
979
|
+
* Field values keyed by field `key`.
|
|
980
|
+
*
|
|
981
|
+
* A rich text value is written as Markdown (GitHub Flavored, a string)
|
|
982
|
+
* or as a ProseMirror JSON document (`{"type": "doc", "content": [...]}`),
|
|
983
|
+
* and stored and read as the document (`rich_text` reads it as HTML or
|
|
984
|
+
* Markdown). Markdown is converted as closely as the vocabulary allows:
|
|
985
|
+
* headings below h3 become h3, task list items plain items, footnotes and
|
|
986
|
+
* raw HTML text. A document uses the web editor's vocabulary (Tiptap's
|
|
987
|
+
* StarterKit and tables) and nothing else; another name is refused with
|
|
988
|
+
* `invalid_format`, naming ours where one fits (`strong` is `bold`):
|
|
989
|
+
*
|
|
990
|
+
* - blocks: `paragraph`, `heading` (`level` 1-3), `blockquote`,
|
|
991
|
+
* `bulletList` and `orderedList` (`start`, `type`) of `listItem`
|
|
992
|
+
* (starting with a paragraph), `codeBlock` (`language`),
|
|
993
|
+
* `horizontalRule`, and `table` of `tableRow` of `tableHeader` or
|
|
994
|
+
* `tableCell` (`colspan`, `rowspan`, `colwidth`, `align`); any block
|
|
995
|
+
* may have `dir` (`auto`, `ltr`, `rtl`);
|
|
996
|
+
* - inline: `text` (non-empty) and `hardBreak`;
|
|
997
|
+
* - marks on text: `bold`, `italic`, `strike`, `underline`, `code` (alone),
|
|
998
|
+
* and `link` (`href`, and `target`, `rel`, `class`, `title`); a link's
|
|
999
|
+
* `href` is an `http`, `https`, `mailto`, `tel` or relative URL.
|
|
1000
|
+
*
|
|
1001
|
+
* An image of an asset is `{"type": "image", "attrs": {"asset_id":
|
|
1002
|
+
* "ast_...", "alt": "..."}}` (in Markdown ``, or the
|
|
1003
|
+
* asset's `image_url`), between the document's blocks (not inside a list,
|
|
1004
|
+
* quote or table), at most 100 per document (`too_many_images`); a newly
|
|
1005
|
+
* shown image must be an uploaded JPEG, PNG, GIF, WebP, AVIF or SVG of
|
|
1006
|
+
* the project (`invalid_reference`, `type_not_accepted`). `expand` embeds
|
|
1007
|
+
* the assets, and published-only keys can read the images of published
|
|
1008
|
+
* records. A record holds at
|
|
1009
|
+
* most 2,000,000 bytes of values, all fields together (`too_large` on
|
|
1010
|
+
* `data`); one already larger can still be edited without growing.
|
|
978
1011
|
*
|
|
979
1012
|
*/
|
|
980
1013
|
export type RecordData = {
|
|
@@ -1523,9 +1556,11 @@ export type AssetProperties = {
|
|
|
1523
1556
|
*/
|
|
1524
1557
|
purge_after: NullableTimestamp;
|
|
1525
1558
|
/**
|
|
1526
|
-
* The URL of the whole image, for ready images (JPEG, PNG, GIF, WebP
|
|
1527
|
-
* or
|
|
1528
|
-
* otherwise. Image URLs are open and never expire.
|
|
1559
|
+
* The URL of the whole image, for ready images (JPEG, PNG, GIF, WebP,
|
|
1560
|
+
* AVIF or SVG), deleted ones included until they are purged; null
|
|
1561
|
+
* otherwise. Image URLs are open and never expire. An SVG is served
|
|
1562
|
+
* as SVG without its scripts, unless a format such as `@webp`
|
|
1563
|
+
* rasterizes it. For a rendition,
|
|
1529
1564
|
* write [imgproxy processing options](https://docs.imgproxy.net/usage/processing)
|
|
1530
1565
|
* before `/plain/`, and a format after `@`: for example
|
|
1531
1566
|
* `https://images.nohead.io/rs:fill:800:600/g:sm/plain/…@webp`. Renditions
|
|
@@ -1536,7 +1571,7 @@ export type AssetProperties = {
|
|
|
1536
1571
|
*/
|
|
1537
1572
|
image_url: string | null;
|
|
1538
1573
|
/**
|
|
1539
|
-
* The URL of a small rendition (fits in 640×640, WebP), for ready images and SVGs (rasterized
|
|
1574
|
+
* The URL of a small rendition (fits in 640×640, WebP), for ready images and SVGs (rasterized), deleted ones included until they are purged; null otherwise.
|
|
1540
1575
|
*/
|
|
1541
1576
|
preview_url: string | null;
|
|
1542
1577
|
/**
|
|
@@ -1687,6 +1722,10 @@ export type RevisionId = string;
|
|
|
1687
1722
|
* Per-record revision number.
|
|
1688
1723
|
*/
|
|
1689
1724
|
export type RevisionNumber = number;
|
|
1725
|
+
/**
|
|
1726
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
1727
|
+
*/
|
|
1728
|
+
export type RichText = 'document' | 'html' | 'markdown';
|
|
1690
1729
|
/**
|
|
1691
1730
|
* Comma-separated relation, asset or rich text field keys whose records or assets to embed under `expanded` (at most 5); for a rich text field, the assets its images show. Embedding needs permission to read what is embedded: `records:read` for relations, `assets:read` for assets and rich text (`403` otherwise).
|
|
1692
1731
|
*/
|
|
@@ -1695,8 +1734,7 @@ export type Expand = string;
|
|
|
1695
1734
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
1696
1735
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
1697
1736
|
* `deleted` (`true` lists soft-deleted records instead) and, in record
|
|
1698
|
-
* lists and counts, `created_at` and `updated_at`.
|
|
1699
|
-
* `published_at` takes only `exists`.
|
|
1737
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
1700
1738
|
*
|
|
1701
1739
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
1702
1740
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -1836,12 +1874,15 @@ export type RecordsListData = {
|
|
|
1836
1874
|
collection_id: string;
|
|
1837
1875
|
};
|
|
1838
1876
|
query?: {
|
|
1877
|
+
/**
|
|
1878
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
1879
|
+
*/
|
|
1880
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
1839
1881
|
/**
|
|
1840
1882
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
1841
1883
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
1842
1884
|
* `deleted` (`true` lists soft-deleted records instead) and, in record
|
|
1843
|
-
* lists and counts, `created_at` and `updated_at`.
|
|
1844
|
-
* `published_at` takes only `exists`.
|
|
1885
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
1845
1886
|
*
|
|
1846
1887
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
1847
1888
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -1964,7 +2005,12 @@ export type RecordsCreateData = {
|
|
|
1964
2005
|
*/
|
|
1965
2006
|
collection_id: string;
|
|
1966
2007
|
};
|
|
1967
|
-
query?:
|
|
2008
|
+
query?: {
|
|
2009
|
+
/**
|
|
2010
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2011
|
+
*/
|
|
2012
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2013
|
+
};
|
|
1968
2014
|
url: '/v1/collections/{collection_id}/records';
|
|
1969
2015
|
};
|
|
1970
2016
|
export type RecordsCreateErrors = {
|
|
@@ -2063,7 +2109,12 @@ export type RecordsDeleteData = {
|
|
|
2063
2109
|
path: {
|
|
2064
2110
|
record_id: string;
|
|
2065
2111
|
};
|
|
2066
|
-
query?:
|
|
2112
|
+
query?: {
|
|
2113
|
+
/**
|
|
2114
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2115
|
+
*/
|
|
2116
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2117
|
+
};
|
|
2067
2118
|
url: '/v1/records/{record_id}';
|
|
2068
2119
|
};
|
|
2069
2120
|
export type RecordsDeleteErrors = {
|
|
@@ -2119,6 +2170,10 @@ export type RecordsGetData = {
|
|
|
2119
2170
|
record_id: string;
|
|
2120
2171
|
};
|
|
2121
2172
|
query?: {
|
|
2173
|
+
/**
|
|
2174
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2175
|
+
*/
|
|
2176
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2122
2177
|
/**
|
|
2123
2178
|
* Comma-separated relation, asset or rich text field keys whose records or assets to embed under `expanded` (at most 5); for a rich text field, the assets its images show. Embedding needs permission to read what is embedded: `records:read` for relations, `assets:read` for assets and rich text (`403` otherwise).
|
|
2124
2179
|
*/
|
|
@@ -2198,7 +2253,12 @@ export type RecordsUpdateData = {
|
|
|
2198
2253
|
path: {
|
|
2199
2254
|
record_id: string;
|
|
2200
2255
|
};
|
|
2201
|
-
query?:
|
|
2256
|
+
query?: {
|
|
2257
|
+
/**
|
|
2258
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2259
|
+
*/
|
|
2260
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2261
|
+
};
|
|
2202
2262
|
url: '/v1/records/{record_id}';
|
|
2203
2263
|
};
|
|
2204
2264
|
export type RecordsUpdateErrors = {
|
|
@@ -2265,8 +2325,7 @@ export type RecordsCountData = {
|
|
|
2265
2325
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
2266
2326
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
2267
2327
|
* `deleted` (`true` lists soft-deleted records instead) and, in record
|
|
2268
|
-
* lists and counts, `created_at` and `updated_at`.
|
|
2269
|
-
* `published_at` takes only `exists`.
|
|
2328
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
2270
2329
|
*
|
|
2271
2330
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
2272
2331
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -2365,7 +2424,12 @@ export type RecordsBulkData = {
|
|
|
2365
2424
|
*/
|
|
2366
2425
|
collection_id: string;
|
|
2367
2426
|
};
|
|
2368
|
-
query?:
|
|
2427
|
+
query?: {
|
|
2428
|
+
/**
|
|
2429
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2430
|
+
*/
|
|
2431
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2432
|
+
};
|
|
2369
2433
|
url: '/v1/collections/{collection_id}/record-batches';
|
|
2370
2434
|
};
|
|
2371
2435
|
export type RecordsBulkErrors = {
|
|
@@ -2448,7 +2512,12 @@ export type RecordsRestoreData = {
|
|
|
2448
2512
|
path: {
|
|
2449
2513
|
record_id: string;
|
|
2450
2514
|
};
|
|
2451
|
-
query?:
|
|
2515
|
+
query?: {
|
|
2516
|
+
/**
|
|
2517
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2518
|
+
*/
|
|
2519
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2520
|
+
};
|
|
2452
2521
|
url: '/v1/records/{record_id}/restore';
|
|
2453
2522
|
};
|
|
2454
2523
|
export type RecordsRestoreErrors = {
|
|
@@ -2539,7 +2608,12 @@ export type RecordsUnpublishData = {
|
|
|
2539
2608
|
path: {
|
|
2540
2609
|
record_id: string;
|
|
2541
2610
|
};
|
|
2542
|
-
query?:
|
|
2611
|
+
query?: {
|
|
2612
|
+
/**
|
|
2613
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2614
|
+
*/
|
|
2615
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2616
|
+
};
|
|
2543
2617
|
url: '/v1/records/{record_id}/publication';
|
|
2544
2618
|
};
|
|
2545
2619
|
export type RecordsUnpublishErrors = {
|
|
@@ -2669,7 +2743,12 @@ export type RecordsPublishData = {
|
|
|
2669
2743
|
path: {
|
|
2670
2744
|
record_id: string;
|
|
2671
2745
|
};
|
|
2672
|
-
query?:
|
|
2746
|
+
query?: {
|
|
2747
|
+
/**
|
|
2748
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
2749
|
+
*/
|
|
2750
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2751
|
+
};
|
|
2673
2752
|
url: '/v1/records/{record_id}/publication';
|
|
2674
2753
|
};
|
|
2675
2754
|
export type RecordsPublishErrors = {
|
|
@@ -3155,6 +3234,10 @@ export type RecordRevisionsRevertData = {
|
|
|
3155
3234
|
revision: number;
|
|
3156
3235
|
};
|
|
3157
3236
|
query?: {
|
|
3237
|
+
/**
|
|
3238
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3239
|
+
*/
|
|
3240
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3158
3241
|
dry_run?: boolean;
|
|
3159
3242
|
};
|
|
3160
3243
|
url: '/v1/records/{record_id}/revisions/{revision}/revert';
|
|
@@ -3264,6 +3347,10 @@ export type RecordDraftsListData = {
|
|
|
3264
3347
|
record_id: string;
|
|
3265
3348
|
};
|
|
3266
3349
|
query?: {
|
|
3350
|
+
/**
|
|
3351
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3352
|
+
*/
|
|
3353
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3267
3354
|
/**
|
|
3268
3355
|
* Page size.
|
|
3269
3356
|
*/
|
|
@@ -3333,7 +3420,12 @@ export type DraftsCreateData = {
|
|
|
3333
3420
|
path: {
|
|
3334
3421
|
record_id: string;
|
|
3335
3422
|
};
|
|
3336
|
-
query?:
|
|
3423
|
+
query?: {
|
|
3424
|
+
/**
|
|
3425
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3426
|
+
*/
|
|
3427
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3428
|
+
};
|
|
3337
3429
|
url: '/v1/records/{record_id}/drafts';
|
|
3338
3430
|
};
|
|
3339
3431
|
export type DraftsCreateErrors = {
|
|
@@ -3390,6 +3482,10 @@ export type DraftsListData = {
|
|
|
3390
3482
|
collection_id: string;
|
|
3391
3483
|
};
|
|
3392
3484
|
query?: {
|
|
3485
|
+
/**
|
|
3486
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3487
|
+
*/
|
|
3488
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3393
3489
|
sort?: 'updated_at' | '-updated_at';
|
|
3394
3490
|
/**
|
|
3395
3491
|
* Page size.
|
|
@@ -3464,7 +3560,12 @@ export type DraftsDiscardData = {
|
|
|
3464
3560
|
path: {
|
|
3465
3561
|
draft_id: string;
|
|
3466
3562
|
};
|
|
3467
|
-
query?:
|
|
3563
|
+
query?: {
|
|
3564
|
+
/**
|
|
3565
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3566
|
+
*/
|
|
3567
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3568
|
+
};
|
|
3468
3569
|
url: '/v1/drafts/{draft_id}';
|
|
3469
3570
|
};
|
|
3470
3571
|
export type DraftsDiscardErrors = {
|
|
@@ -3520,6 +3621,10 @@ export type DraftsGetData = {
|
|
|
3520
3621
|
draft_id: string;
|
|
3521
3622
|
};
|
|
3522
3623
|
query?: {
|
|
3624
|
+
/**
|
|
3625
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3626
|
+
*/
|
|
3627
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3523
3628
|
/**
|
|
3524
3629
|
* Comma-separated relation, asset or rich text field keys whose records or assets to embed under `expanded` (at most 5); for a rich text field, the assets its images show. Embedding needs permission to read what is embedded: `records:read` for relations, `assets:read` for assets and rich text (`403` otherwise).
|
|
3525
3630
|
*/
|
|
@@ -3589,7 +3694,12 @@ export type DraftsUpdateData = {
|
|
|
3589
3694
|
path: {
|
|
3590
3695
|
draft_id: string;
|
|
3591
3696
|
};
|
|
3592
|
-
query?:
|
|
3697
|
+
query?: {
|
|
3698
|
+
/**
|
|
3699
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3700
|
+
*/
|
|
3701
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3702
|
+
};
|
|
3593
3703
|
url: '/v1/drafts/{draft_id}';
|
|
3594
3704
|
};
|
|
3595
3705
|
export type DraftsUpdateErrors = {
|
|
@@ -3678,7 +3788,12 @@ export type DraftsMergeData = {
|
|
|
3678
3788
|
path: {
|
|
3679
3789
|
draft_id: string;
|
|
3680
3790
|
};
|
|
3681
|
-
query?:
|
|
3791
|
+
query?: {
|
|
3792
|
+
/**
|
|
3793
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3794
|
+
*/
|
|
3795
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3796
|
+
};
|
|
3682
3797
|
url: '/v1/drafts/{draft_id}/merge';
|
|
3683
3798
|
};
|
|
3684
3799
|
export type DraftsMergeErrors = {
|
|
@@ -3753,7 +3868,12 @@ export type DraftsUnscheduleData = {
|
|
|
3753
3868
|
path: {
|
|
3754
3869
|
draft_id: string;
|
|
3755
3870
|
};
|
|
3756
|
-
query?:
|
|
3871
|
+
query?: {
|
|
3872
|
+
/**
|
|
3873
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3874
|
+
*/
|
|
3875
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3876
|
+
};
|
|
3757
3877
|
url: '/v1/drafts/{draft_id}/schedule';
|
|
3758
3878
|
};
|
|
3759
3879
|
export type DraftsUnscheduleErrors = {
|
|
@@ -3818,7 +3938,12 @@ export type DraftsScheduleData = {
|
|
|
3818
3938
|
path: {
|
|
3819
3939
|
draft_id: string;
|
|
3820
3940
|
};
|
|
3821
|
-
query?:
|
|
3941
|
+
query?: {
|
|
3942
|
+
/**
|
|
3943
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
3944
|
+
*/
|
|
3945
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3946
|
+
};
|
|
3822
3947
|
url: '/v1/drafts/{draft_id}/schedule';
|
|
3823
3948
|
};
|
|
3824
3949
|
export type DraftsScheduleErrors = {
|
|
@@ -5938,6 +6063,10 @@ export type CollectionsSearchData = {
|
|
|
5938
6063
|
collection_id: string;
|
|
5939
6064
|
};
|
|
5940
6065
|
query?: {
|
|
6066
|
+
/**
|
|
6067
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
6068
|
+
*/
|
|
6069
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
5941
6070
|
/**
|
|
5942
6071
|
* The words to search for; empty matches everything.
|
|
5943
6072
|
*/
|
|
@@ -5954,8 +6083,7 @@ export type CollectionsSearchData = {
|
|
|
5954
6083
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
5955
6084
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
5956
6085
|
* `deleted` (`true` lists soft-deleted records instead) and, in record
|
|
5957
|
-
* lists and counts, `created_at` and `updated_at`.
|
|
5958
|
-
* `published_at` takes only `exists`.
|
|
6086
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
5959
6087
|
*
|
|
5960
6088
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
5961
6089
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -6039,6 +6167,10 @@ export type ProjectsSearchData = {
|
|
|
6039
6167
|
project_id: string;
|
|
6040
6168
|
};
|
|
6041
6169
|
query?: {
|
|
6170
|
+
/**
|
|
6171
|
+
* How rich text fields read in the records and drafts returned (and in records they embed with `expand`): `document`, the stored ProseMirror JSON document; `html`, an HTML fragment of known elements with every text and attribute escaped, to put in a page as it is; or `markdown` (GitHub Flavored), which reads back as the same document when written. Images render with their URLs, so they need no `expand`: in HTML a WebP rendition at most 1600 pixels wide with its `width` and `height` (an SVG as itself), in Markdown the asset's `image_url`. An image whose asset was deleted is left out of HTML, and written as its asset ID in Markdown. Record history keeps documents.
|
|
6172
|
+
*/
|
|
6173
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
6042
6174
|
/**
|
|
6043
6175
|
* The words to search for; empty matches everything.
|
|
6044
6176
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Nohead } from "./client.ts";
|
|
2
2
|
export { APIPromise, Page, PagePromise, type APIResponse, } from "./api-promise.ts";
|
|
3
|
-
export { DEFAULT_BASE_URL, type ClientOptions, type ConditionalRequestOptions, type ConditionalWriteOptions, type CopyOptions, type RequestOptions, type RetryEvent, type WriteOptions, } from "./core.ts";
|
|
3
|
+
export { DEFAULT_BASE_URL, type ClientOptions, type ConditionalRequestOptions, type ConditionalWriteOptions, type CopyOptions, type RequestOptions, type RetryEvent, type RichTextOptions, type WriteOptions, } from "./core.ts";
|
|
4
4
|
export { APIError, AbortError, AuthenticationError, AuthorizationError, ConflictError, ConnectionError, InternalServerError, InvalidRequestError, NoheadError, NotFoundError, PlanLimitExceededError, PreconditionFailedError, RateLimitError, ServiceUnavailableError, TimeoutError, UploadError, ValidationError, WebhookVerificationError, } from "./errors.ts";
|
|
5
5
|
export type { Uploadable, UploadParams } from "./resources/assets.ts";
|
|
6
6
|
export type * from "./types.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { APIPromise, PagePromise } from "../api-promise.ts";
|
|
2
|
-
import type { ConditionalRequestOptions, ConditionalWriteOptions,
|
|
2
|
+
import type { ConditionalRequestOptions, ConditionalWriteOptions, RichTextOptions } from "../core.ts";
|
|
3
3
|
import type { RecordData } from "../generated/types.gen.ts";
|
|
4
4
|
import type { DraftCreateParams, DraftGetParams, DraftListParams, DraftScheduleParams, DraftUpdateParams, NoheadDraft, NoheadRecord } from "../types.ts";
|
|
5
5
|
import { Resource } from "./resource.ts";
|
|
@@ -17,24 +17,24 @@ export declare class Drafts extends Resource {
|
|
|
17
17
|
* `ConflictError` (detail code `draft_exists`, with its `draft_id`): update
|
|
18
18
|
* that one instead.
|
|
19
19
|
*/
|
|
20
|
-
create<D = RecordData>(record: string, params?: DraftCreateParams<D>, options?:
|
|
20
|
+
create<D = RecordData>(record: string, params?: DraftCreateParams<D>, options?: RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
21
21
|
/**
|
|
22
22
|
* A collection's drafts, most recently changed first. One record's draft
|
|
23
23
|
* is `records.drafts(record)`.
|
|
24
24
|
*/
|
|
25
|
-
list<D = RecordData>(collection: string, params?: DraftListParams, options?:
|
|
25
|
+
list<D = RecordData>(collection: string, params?: DraftListParams, options?: RichTextOptions): PagePromise<NoheadDraft<D>>;
|
|
26
26
|
/** With `data` as the record reads after the merge, for previews. */
|
|
27
|
-
get<D = RecordData>(draft: string, params?: DraftGetParams, options?:
|
|
27
|
+
get<D = RecordData>(draft: string, params?: DraftGetParams, options?: RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
28
28
|
/** Sets the given fields (`null` clears one), as a record update does. */
|
|
29
|
-
update<D = RecordData>(draft: string, params: DraftUpdateParams<D>, options?: ConditionalRequestOptions): APIPromise<NoheadDraft<D>>;
|
|
29
|
+
update<D = RecordData>(draft: string, params: DraftUpdateParams<D>, options?: ConditionalRequestOptions & RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
30
30
|
/** Deletes the draft for good; returns it as it was. */
|
|
31
|
-
discard<D = RecordData>(draft: string, options?: ConditionalRequestOptions): APIPromise<NoheadDraft<D>>;
|
|
31
|
+
discard<D = RecordData>(draft: string, options?: ConditionalRequestOptions & RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
32
32
|
/**
|
|
33
33
|
* Applies the draft to its record now, as one `merge` revision, and
|
|
34
34
|
* returns the record. Content only: the record stays live or not.
|
|
35
35
|
*/
|
|
36
|
-
merge<D = RecordData>(draft: string, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
36
|
+
merge<D = RecordData>(draft: string, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
37
37
|
/** Merges the draft at `merge_at`, a future time; returns the draft. */
|
|
38
|
-
schedule<D = RecordData>(draft: string, params: DraftScheduleParams, options?:
|
|
39
|
-
unschedule<D = RecordData>(draft: string, options?:
|
|
38
|
+
schedule<D = RecordData>(draft: string, params: DraftScheduleParams, options?: RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
39
|
+
unschedule<D = RecordData>(draft: string, options?: RichTextOptions): APIPromise<NoheadDraft<D>>;
|
|
40
40
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { APIPromise, PagePromise } from "../api-promise.ts";
|
|
2
|
-
import type { ConditionalWriteOptions, RequestOptions, WriteOptions } from "../core.ts";
|
|
2
|
+
import type { ConditionalWriteOptions, RequestOptions, RichTextOptions, WriteOptions } from "../core.ts";
|
|
3
3
|
import type { RecordData, RecordDiff, RecordRevision, RecordRevisionDetail, RevertPreview, RecordBatch, RecordCount, RecordPublication, RecordSchedule, ScheduledChange } from "../generated/types.gen.ts";
|
|
4
4
|
import type { DryRunParams, NoheadDraft, NoheadRecord, RecordBulkParams, RecordCountParams, RecordCreateParams, RecordDiffParams, RecordGetParams, RecordListParams, RecordScheduleParams, RecordSearchParams, RecordUpdateParams, ListParams, RevisionListParams, ScheduledChangeListParams, SearchMeta } from "../types.ts";
|
|
5
5
|
import { Resource } from "./resource.ts";
|
|
@@ -10,28 +10,28 @@ import { Resource } from "./resource.ts";
|
|
|
10
10
|
export declare class Records extends Resource {
|
|
11
11
|
readonly revisions: Revisions;
|
|
12
12
|
/** A collection's records, newest first by default. */
|
|
13
|
-
list<D = RecordData>(collection: string, params?: RecordListParams, options?:
|
|
14
|
-
get<D = RecordData>(record: string, params?: RecordGetParams, options?:
|
|
13
|
+
list<D = RecordData>(collection: string, params?: RecordListParams, options?: RichTextOptions): PagePromise<NoheadRecord<D>>;
|
|
14
|
+
get<D = RecordData>(record: string, params?: RecordGetParams, options?: RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
15
15
|
/**
|
|
16
16
|
* Creates an unpublished record. With `upsert_on`, updates the record
|
|
17
17
|
* holding that unique value instead, if one exists, so a sync can run
|
|
18
18
|
* again without duplicates; `ifMatch` then applies to that update.
|
|
19
19
|
*/
|
|
20
|
-
create<D = RecordData>(collection: string, params: RecordCreateParams<D>, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
20
|
+
create<D = RecordData>(collection: string, params: RecordCreateParams<D>, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
21
21
|
/** Sets the given fields (`null` clears one); others keep their values. */
|
|
22
|
-
update<D = RecordData>(record: string, params: RecordUpdateParams<D>, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
22
|
+
update<D = RecordData>(record: string, params: RecordUpdateParams<D>, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
23
23
|
/**
|
|
24
24
|
* Soft-deletes the record: `restore` brings it back until its
|
|
25
25
|
* `purge_after`. Deleting a deleted record changes nothing.
|
|
26
26
|
*/
|
|
27
|
-
delete<D = RecordData>(record: string, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
28
|
-
restore<D = RecordData>(record: string, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
27
|
+
delete<D = RecordData>(record: string, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
28
|
+
restore<D = RecordData>(record: string, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
29
29
|
/**
|
|
30
30
|
* A live record with a pending draft is a `ConflictError` (detail code
|
|
31
31
|
* `draft_pending`): publishing never merges a draft (`drafts.merge` does).
|
|
32
32
|
*/
|
|
33
|
-
publish<D = RecordData>(record: string, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
34
|
-
unpublish<D = RecordData>(record: string, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
33
|
+
publish<D = RecordData>(record: string, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
34
|
+
unpublish<D = RecordData>(record: string, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
35
35
|
/**
|
|
36
36
|
* What is live: since when, by whom, and the revision. A record that
|
|
37
37
|
* isn't published is a `NotFoundError` (detail code `not_published`).
|
|
@@ -43,7 +43,7 @@ export declare class Records extends Resource {
|
|
|
43
43
|
*/
|
|
44
44
|
getSchedule(record: string, options?: RequestOptions): APIPromise<RecordSchedule>;
|
|
45
45
|
/** The record's drafts: at most one for now. */
|
|
46
|
-
drafts<D = RecordData>(record: string, params?: ListParams, options?:
|
|
46
|
+
drafts<D = RecordData>(record: string, params?: ListParams, options?: RichTextOptions): PagePromise<NoheadDraft<D>>;
|
|
47
47
|
/**
|
|
48
48
|
* Sets when the record publishes and unpublishes on its own. This is the
|
|
49
49
|
* whole schedule: a time left out is cleared (`{}` clears both, as
|
|
@@ -63,14 +63,14 @@ export declare class Records extends Resource {
|
|
|
63
63
|
* Publishes, unpublishes, deletes, restores or updates up to 100 records.
|
|
64
64
|
* Each record succeeds or fails on its own; see `results`.
|
|
65
65
|
*/
|
|
66
|
-
bulk(collection: string, params: RecordBulkParams, options?: WriteOptions): APIPromise<RecordBatch>;
|
|
66
|
+
bulk(collection: string, params: RecordBulkParams, options?: WriteOptions & RichTextOptions): APIPromise<RecordBatch>;
|
|
67
67
|
/** The changes between two revisions. */
|
|
68
68
|
diff(record: string, params: RecordDiffParams, options?: RequestOptions): APIPromise<RecordDiff>;
|
|
69
69
|
/**
|
|
70
70
|
* Full-text search in one collection, matching its `searchable` fields.
|
|
71
71
|
* Pages through the first 1,000 hits, most relevant first.
|
|
72
72
|
*/
|
|
73
|
-
search<D = RecordData>(collection: string, query: string, params?: RecordSearchParams, options?:
|
|
73
|
+
search<D = RecordData>(collection: string, query: string, params?: RecordSearchParams, options?: RichTextOptions): PagePromise<NoheadRecord<D>, SearchMeta>;
|
|
74
74
|
}
|
|
75
75
|
/** A record's version history. `revision` is a revision number. */
|
|
76
76
|
export declare class Revisions extends Resource {
|
|
@@ -80,8 +80,8 @@ export declare class Revisions extends Resource {
|
|
|
80
80
|
/** Restores the record's data as of `revision`, as a new revision. */
|
|
81
81
|
revert(record: string, revision: number, params: {
|
|
82
82
|
dry_run: true;
|
|
83
|
-
}, options?: ConditionalWriteOptions): APIPromise<RevertPreview>;
|
|
84
|
-
revert<D = RecordData>(record: string, revision: number, params?: DryRunParams, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
83
|
+
}, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<RevertPreview>;
|
|
84
|
+
revert<D = RecordData>(record: string, revision: number, params?: DryRunParams, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* A revision by its own ID (`rev_…`), as webhooks and the activity log name
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export type NoheadDraft<D = G.RecordData> = Omit<G.Draft, "data"> & {
|
|
|
21
21
|
export type RecordDataUpdate<D> = {
|
|
22
22
|
[K in keyof D]?: D[K] | null;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* How rich text fields read (`richText`): `"document"`, the stored
|
|
26
|
+
* ProseMirror JSON document (the default); `"html"`, an HTML fragment safe
|
|
27
|
+
* to put in a page as it is; or `"markdown"` (GitHub Flavored). As HTML or
|
|
28
|
+
* Markdown, a rich text field's value is a string.
|
|
29
|
+
*/
|
|
30
|
+
export type RichText = G.RichText;
|
|
24
31
|
export type FilterValue = string | number | boolean | Date;
|
|
25
32
|
/**
|
|
26
33
|
* Operators for one key. `ne` matches records without a value; on fields
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.10.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.10.0";
|