@nohead/sdk 0.9.0 → 0.11.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 +15 -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 +25 -0
- package/dist/generated/types.gen.d.ts +178 -33
- package/dist/index.d.ts +1 -1
- package/dist/resources/drafts.d.ts +9 -9
- package/dist/resources/records.d.ts +19 -16
- package/dist/resources/records.js +4 -1
- 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,21 @@ 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.11.0
|
|
9
|
+
|
|
10
|
+
- `records.diff` takes `richText`, and the client's `richText` now applies to
|
|
11
|
+
it: a rich text field's `before` and `after` read as HTML or Markdown
|
|
12
|
+
instead of documents. A revert preview's `changes` follow `richText` too.
|
|
13
|
+
|
|
14
|
+
## 0.10.0
|
|
15
|
+
|
|
16
|
+
- Rich text reads as HTML or Markdown: `richText: "html"` (or `"markdown"`)
|
|
17
|
+
on the client, or in a request's options, sends the API's `rich_text`
|
|
18
|
+
query parameter on the methods that return records or drafts, so a rich
|
|
19
|
+
text field's value in `data` is a string instead of the document. A
|
|
20
|
+
request's `richText` overrides the client's, and `withOptions` can change
|
|
21
|
+
it. Writing Markdown already worked: `data` is sent as it is.
|
|
22
|
+
|
|
8
23
|
## 0.9.0
|
|
9
24
|
|
|
10
25
|
- **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, to the records they embed with `expand`, and to the `before` and `after` of a `diff` or a revert preview's `changes`; 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,28 @@ 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_diff",
|
|
102
|
+
"records_get",
|
|
103
|
+
"records_list",
|
|
104
|
+
"records_publish",
|
|
105
|
+
"records_restore",
|
|
106
|
+
"records_unpublish",
|
|
107
|
+
"records_update",
|
|
108
|
+
]);
|
|
@@ -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 = {
|
|
@@ -1050,8 +1083,14 @@ export type RecordList = {
|
|
|
1050
1083
|
*
|
|
1051
1084
|
*/
|
|
1052
1085
|
export type Change = {
|
|
1086
|
+
/**
|
|
1087
|
+
* The field's key now, after any rename (its last key if it was deleted); null if the field no longer exists.
|
|
1088
|
+
*/
|
|
1053
1089
|
field?: string | null;
|
|
1054
1090
|
field_id?: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Whether the field has been deleted since.
|
|
1093
|
+
*/
|
|
1055
1094
|
field_deleted?: boolean;
|
|
1056
1095
|
attribute?: 'published_at' | 'deleted_at';
|
|
1057
1096
|
kind: 'added' | 'changed' | 'removed';
|
|
@@ -1108,6 +1147,9 @@ export type RevertPreview = {
|
|
|
1108
1147
|
record_id: string;
|
|
1109
1148
|
to_revision: number;
|
|
1110
1149
|
data: RecordData;
|
|
1150
|
+
/**
|
|
1151
|
+
* What the revert would change. Rich text values read as `rich_text` asks, like `data`; a change that HTML or Markdown can't show (an underline, in Markdown) reads the same on both sides.
|
|
1152
|
+
*/
|
|
1111
1153
|
changes: Array<Change>;
|
|
1112
1154
|
};
|
|
1113
1155
|
export type FeatureFlags = {
|
|
@@ -1523,9 +1565,11 @@ export type AssetProperties = {
|
|
|
1523
1565
|
*/
|
|
1524
1566
|
purge_after: NullableTimestamp;
|
|
1525
1567
|
/**
|
|
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.
|
|
1568
|
+
* The URL of the whole image, for ready images (JPEG, PNG, GIF, WebP,
|
|
1569
|
+
* AVIF or SVG), deleted ones included until they are purged; null
|
|
1570
|
+
* otherwise. Image URLs are open and never expire. An SVG is served
|
|
1571
|
+
* as SVG without its scripts, unless a format such as `@webp`
|
|
1572
|
+
* rasterizes it. For a rendition,
|
|
1529
1573
|
* write [imgproxy processing options](https://docs.imgproxy.net/usage/processing)
|
|
1530
1574
|
* before `/plain/`, and a format after `@`: for example
|
|
1531
1575
|
* `https://images.nohead.io/rs:fill:800:600/g:sm/plain/…@webp`. Renditions
|
|
@@ -1536,7 +1580,7 @@ export type AssetProperties = {
|
|
|
1536
1580
|
*/
|
|
1537
1581
|
image_url: string | null;
|
|
1538
1582
|
/**
|
|
1539
|
-
* The URL of a small rendition (fits in 640×640, WebP), for ready images and SVGs (rasterized
|
|
1583
|
+
* 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
1584
|
*/
|
|
1541
1585
|
preview_url: string | null;
|
|
1542
1586
|
/**
|
|
@@ -1687,6 +1731,10 @@ export type RevisionId = string;
|
|
|
1687
1731
|
* Per-record revision number.
|
|
1688
1732
|
*/
|
|
1689
1733
|
export type RevisionNumber = number;
|
|
1734
|
+
/**
|
|
1735
|
+
* 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.
|
|
1736
|
+
*/
|
|
1737
|
+
export type RichText = 'document' | 'html' | 'markdown';
|
|
1690
1738
|
/**
|
|
1691
1739
|
* 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
1740
|
*/
|
|
@@ -1695,8 +1743,7 @@ export type Expand = string;
|
|
|
1695
1743
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
1696
1744
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
1697
1745
|
* `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`.
|
|
1746
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
1700
1747
|
*
|
|
1701
1748
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
1702
1749
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -1836,12 +1883,15 @@ export type RecordsListData = {
|
|
|
1836
1883
|
collection_id: string;
|
|
1837
1884
|
};
|
|
1838
1885
|
query?: {
|
|
1886
|
+
/**
|
|
1887
|
+
* 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.
|
|
1888
|
+
*/
|
|
1889
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
1839
1890
|
/**
|
|
1840
1891
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
1841
1892
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
1842
1893
|
* `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`.
|
|
1894
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
1845
1895
|
*
|
|
1846
1896
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
1847
1897
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -1964,7 +2014,12 @@ export type RecordsCreateData = {
|
|
|
1964
2014
|
*/
|
|
1965
2015
|
collection_id: string;
|
|
1966
2016
|
};
|
|
1967
|
-
query?:
|
|
2017
|
+
query?: {
|
|
2018
|
+
/**
|
|
2019
|
+
* 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.
|
|
2020
|
+
*/
|
|
2021
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2022
|
+
};
|
|
1968
2023
|
url: '/v1/collections/{collection_id}/records';
|
|
1969
2024
|
};
|
|
1970
2025
|
export type RecordsCreateErrors = {
|
|
@@ -2063,7 +2118,12 @@ export type RecordsDeleteData = {
|
|
|
2063
2118
|
path: {
|
|
2064
2119
|
record_id: string;
|
|
2065
2120
|
};
|
|
2066
|
-
query?:
|
|
2121
|
+
query?: {
|
|
2122
|
+
/**
|
|
2123
|
+
* 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.
|
|
2124
|
+
*/
|
|
2125
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2126
|
+
};
|
|
2067
2127
|
url: '/v1/records/{record_id}';
|
|
2068
2128
|
};
|
|
2069
2129
|
export type RecordsDeleteErrors = {
|
|
@@ -2119,6 +2179,10 @@ export type RecordsGetData = {
|
|
|
2119
2179
|
record_id: string;
|
|
2120
2180
|
};
|
|
2121
2181
|
query?: {
|
|
2182
|
+
/**
|
|
2183
|
+
* 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.
|
|
2184
|
+
*/
|
|
2185
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2122
2186
|
/**
|
|
2123
2187
|
* 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
2188
|
*/
|
|
@@ -2198,7 +2262,12 @@ export type RecordsUpdateData = {
|
|
|
2198
2262
|
path: {
|
|
2199
2263
|
record_id: string;
|
|
2200
2264
|
};
|
|
2201
|
-
query?:
|
|
2265
|
+
query?: {
|
|
2266
|
+
/**
|
|
2267
|
+
* 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.
|
|
2268
|
+
*/
|
|
2269
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2270
|
+
};
|
|
2202
2271
|
url: '/v1/records/{record_id}';
|
|
2203
2272
|
};
|
|
2204
2273
|
export type RecordsUpdateErrors = {
|
|
@@ -2265,8 +2334,7 @@ export type RecordsCountData = {
|
|
|
2265
2334
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
2266
2335
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
2267
2336
|
* `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`.
|
|
2337
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
2270
2338
|
*
|
|
2271
2339
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
2272
2340
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -2365,7 +2433,12 @@ export type RecordsBulkData = {
|
|
|
2365
2433
|
*/
|
|
2366
2434
|
collection_id: string;
|
|
2367
2435
|
};
|
|
2368
|
-
query?:
|
|
2436
|
+
query?: {
|
|
2437
|
+
/**
|
|
2438
|
+
* 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.
|
|
2439
|
+
*/
|
|
2440
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2441
|
+
};
|
|
2369
2442
|
url: '/v1/collections/{collection_id}/record-batches';
|
|
2370
2443
|
};
|
|
2371
2444
|
export type RecordsBulkErrors = {
|
|
@@ -2448,7 +2521,12 @@ export type RecordsRestoreData = {
|
|
|
2448
2521
|
path: {
|
|
2449
2522
|
record_id: string;
|
|
2450
2523
|
};
|
|
2451
|
-
query?:
|
|
2524
|
+
query?: {
|
|
2525
|
+
/**
|
|
2526
|
+
* 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.
|
|
2527
|
+
*/
|
|
2528
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2529
|
+
};
|
|
2452
2530
|
url: '/v1/records/{record_id}/restore';
|
|
2453
2531
|
};
|
|
2454
2532
|
export type RecordsRestoreErrors = {
|
|
@@ -2539,7 +2617,12 @@ export type RecordsUnpublishData = {
|
|
|
2539
2617
|
path: {
|
|
2540
2618
|
record_id: string;
|
|
2541
2619
|
};
|
|
2542
|
-
query?:
|
|
2620
|
+
query?: {
|
|
2621
|
+
/**
|
|
2622
|
+
* 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.
|
|
2623
|
+
*/
|
|
2624
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2625
|
+
};
|
|
2543
2626
|
url: '/v1/records/{record_id}/publication';
|
|
2544
2627
|
};
|
|
2545
2628
|
export type RecordsUnpublishErrors = {
|
|
@@ -2669,7 +2752,12 @@ export type RecordsPublishData = {
|
|
|
2669
2752
|
path: {
|
|
2670
2753
|
record_id: string;
|
|
2671
2754
|
};
|
|
2672
|
-
query?:
|
|
2755
|
+
query?: {
|
|
2756
|
+
/**
|
|
2757
|
+
* 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.
|
|
2758
|
+
*/
|
|
2759
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
2760
|
+
};
|
|
2673
2761
|
url: '/v1/records/{record_id}/publication';
|
|
2674
2762
|
};
|
|
2675
2763
|
export type RecordsPublishErrors = {
|
|
@@ -3155,6 +3243,10 @@ export type RecordRevisionsRevertData = {
|
|
|
3155
3243
|
revision: number;
|
|
3156
3244
|
};
|
|
3157
3245
|
query?: {
|
|
3246
|
+
/**
|
|
3247
|
+
* 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.
|
|
3248
|
+
*/
|
|
3249
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3158
3250
|
dry_run?: boolean;
|
|
3159
3251
|
};
|
|
3160
3252
|
url: '/v1/records/{record_id}/revisions/{revision}/revert';
|
|
@@ -3218,6 +3310,10 @@ export type RecordsDiffData = {
|
|
|
3218
3310
|
query: {
|
|
3219
3311
|
from: number;
|
|
3220
3312
|
to: number;
|
|
3313
|
+
/**
|
|
3314
|
+
* How rich text values read in `changes`: `document`, the stored ProseMirror JSON document, or written as `html` or `markdown`, as records read with `rich_text`. Record history and webhooks keep documents. A change that HTML or Markdown can't show (an underline, in Markdown) reads the same on both sides. In HTML and Markdown, text from before a field became rich text reads as paragraphs; an older value that is no document of today's vocabulary, or a redacted one, is kept as stored.
|
|
3315
|
+
*/
|
|
3316
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3221
3317
|
};
|
|
3222
3318
|
url: '/v1/records/{record_id}/diff';
|
|
3223
3319
|
};
|
|
@@ -3264,6 +3360,10 @@ export type RecordDraftsListData = {
|
|
|
3264
3360
|
record_id: string;
|
|
3265
3361
|
};
|
|
3266
3362
|
query?: {
|
|
3363
|
+
/**
|
|
3364
|
+
* 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.
|
|
3365
|
+
*/
|
|
3366
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3267
3367
|
/**
|
|
3268
3368
|
* Page size.
|
|
3269
3369
|
*/
|
|
@@ -3333,7 +3433,12 @@ export type DraftsCreateData = {
|
|
|
3333
3433
|
path: {
|
|
3334
3434
|
record_id: string;
|
|
3335
3435
|
};
|
|
3336
|
-
query?:
|
|
3436
|
+
query?: {
|
|
3437
|
+
/**
|
|
3438
|
+
* 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.
|
|
3439
|
+
*/
|
|
3440
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3441
|
+
};
|
|
3337
3442
|
url: '/v1/records/{record_id}/drafts';
|
|
3338
3443
|
};
|
|
3339
3444
|
export type DraftsCreateErrors = {
|
|
@@ -3390,6 +3495,10 @@ export type DraftsListData = {
|
|
|
3390
3495
|
collection_id: string;
|
|
3391
3496
|
};
|
|
3392
3497
|
query?: {
|
|
3498
|
+
/**
|
|
3499
|
+
* 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.
|
|
3500
|
+
*/
|
|
3501
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3393
3502
|
sort?: 'updated_at' | '-updated_at';
|
|
3394
3503
|
/**
|
|
3395
3504
|
* Page size.
|
|
@@ -3464,7 +3573,12 @@ export type DraftsDiscardData = {
|
|
|
3464
3573
|
path: {
|
|
3465
3574
|
draft_id: string;
|
|
3466
3575
|
};
|
|
3467
|
-
query?:
|
|
3576
|
+
query?: {
|
|
3577
|
+
/**
|
|
3578
|
+
* 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.
|
|
3579
|
+
*/
|
|
3580
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3581
|
+
};
|
|
3468
3582
|
url: '/v1/drafts/{draft_id}';
|
|
3469
3583
|
};
|
|
3470
3584
|
export type DraftsDiscardErrors = {
|
|
@@ -3520,6 +3634,10 @@ export type DraftsGetData = {
|
|
|
3520
3634
|
draft_id: string;
|
|
3521
3635
|
};
|
|
3522
3636
|
query?: {
|
|
3637
|
+
/**
|
|
3638
|
+
* 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.
|
|
3639
|
+
*/
|
|
3640
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3523
3641
|
/**
|
|
3524
3642
|
* 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
3643
|
*/
|
|
@@ -3589,7 +3707,12 @@ export type DraftsUpdateData = {
|
|
|
3589
3707
|
path: {
|
|
3590
3708
|
draft_id: string;
|
|
3591
3709
|
};
|
|
3592
|
-
query?:
|
|
3710
|
+
query?: {
|
|
3711
|
+
/**
|
|
3712
|
+
* 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.
|
|
3713
|
+
*/
|
|
3714
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3715
|
+
};
|
|
3593
3716
|
url: '/v1/drafts/{draft_id}';
|
|
3594
3717
|
};
|
|
3595
3718
|
export type DraftsUpdateErrors = {
|
|
@@ -3678,7 +3801,12 @@ export type DraftsMergeData = {
|
|
|
3678
3801
|
path: {
|
|
3679
3802
|
draft_id: string;
|
|
3680
3803
|
};
|
|
3681
|
-
query?:
|
|
3804
|
+
query?: {
|
|
3805
|
+
/**
|
|
3806
|
+
* 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.
|
|
3807
|
+
*/
|
|
3808
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3809
|
+
};
|
|
3682
3810
|
url: '/v1/drafts/{draft_id}/merge';
|
|
3683
3811
|
};
|
|
3684
3812
|
export type DraftsMergeErrors = {
|
|
@@ -3753,7 +3881,12 @@ export type DraftsUnscheduleData = {
|
|
|
3753
3881
|
path: {
|
|
3754
3882
|
draft_id: string;
|
|
3755
3883
|
};
|
|
3756
|
-
query?:
|
|
3884
|
+
query?: {
|
|
3885
|
+
/**
|
|
3886
|
+
* 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.
|
|
3887
|
+
*/
|
|
3888
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3889
|
+
};
|
|
3757
3890
|
url: '/v1/drafts/{draft_id}/schedule';
|
|
3758
3891
|
};
|
|
3759
3892
|
export type DraftsUnscheduleErrors = {
|
|
@@ -3818,7 +3951,12 @@ export type DraftsScheduleData = {
|
|
|
3818
3951
|
path: {
|
|
3819
3952
|
draft_id: string;
|
|
3820
3953
|
};
|
|
3821
|
-
query?:
|
|
3954
|
+
query?: {
|
|
3955
|
+
/**
|
|
3956
|
+
* 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.
|
|
3957
|
+
*/
|
|
3958
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
3959
|
+
};
|
|
3822
3960
|
url: '/v1/drafts/{draft_id}/schedule';
|
|
3823
3961
|
};
|
|
3824
3962
|
export type DraftsScheduleErrors = {
|
|
@@ -5938,6 +6076,10 @@ export type CollectionsSearchData = {
|
|
|
5938
6076
|
collection_id: string;
|
|
5939
6077
|
};
|
|
5940
6078
|
query?: {
|
|
6079
|
+
/**
|
|
6080
|
+
* 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.
|
|
6081
|
+
*/
|
|
6082
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
5941
6083
|
/**
|
|
5942
6084
|
* The words to search for; empty matches everything.
|
|
5943
6085
|
*/
|
|
@@ -5954,8 +6096,7 @@ export type CollectionsSearchData = {
|
|
|
5954
6096
|
* `filter[<key>]=value` (equal), or `filter[<key>][<operator>]=value`;
|
|
5955
6097
|
* filters combine with AND. Keys are field keys, `published_at`,
|
|
5956
6098
|
* `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`.
|
|
6099
|
+
* lists and counts, `created_at` and `updated_at`.
|
|
5959
6100
|
*
|
|
5960
6101
|
* - `eq`, `ne`: equal, not equal. For fields with several values,
|
|
5961
6102
|
* "contains" and "does not contain". `ne` matches records with no value.
|
|
@@ -6039,6 +6180,10 @@ export type ProjectsSearchData = {
|
|
|
6039
6180
|
project_id: string;
|
|
6040
6181
|
};
|
|
6041
6182
|
query?: {
|
|
6183
|
+
/**
|
|
6184
|
+
* 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.
|
|
6185
|
+
*/
|
|
6186
|
+
rich_text?: 'document' | 'html' | 'markdown';
|
|
6042
6187
|
/**
|
|
6043
6188
|
* The words to search for; empty matches everything.
|
|
6044
6189
|
*/
|
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,17 @@ 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>;
|
|
67
|
-
/**
|
|
68
|
-
|
|
66
|
+
bulk(collection: string, params: RecordBulkParams, options?: WriteOptions & RichTextOptions): APIPromise<RecordBatch>;
|
|
67
|
+
/**
|
|
68
|
+
* The changes between two revisions; with `richText`, rich text fields'
|
|
69
|
+
* `before` and `after` read as HTML or Markdown.
|
|
70
|
+
*/
|
|
71
|
+
diff(record: string, params: RecordDiffParams, options?: RichTextOptions): APIPromise<RecordDiff>;
|
|
69
72
|
/**
|
|
70
73
|
* Full-text search in one collection, matching its `searchable` fields.
|
|
71
74
|
* Pages through the first 1,000 hits, most relevant first.
|
|
72
75
|
*/
|
|
73
|
-
search<D = RecordData>(collection: string, query: string, params?: RecordSearchParams, options?:
|
|
76
|
+
search<D = RecordData>(collection: string, query: string, params?: RecordSearchParams, options?: RichTextOptions): PagePromise<NoheadRecord<D>, SearchMeta>;
|
|
74
77
|
}
|
|
75
78
|
/** A record's version history. `revision` is a revision number. */
|
|
76
79
|
export declare class Revisions extends Resource {
|
|
@@ -80,8 +83,8 @@ export declare class Revisions extends Resource {
|
|
|
80
83
|
/** Restores the record's data as of `revision`, as a new revision. */
|
|
81
84
|
revert(record: string, revision: number, params: {
|
|
82
85
|
dry_run: true;
|
|
83
|
-
}, options?: ConditionalWriteOptions): APIPromise<RevertPreview>;
|
|
84
|
-
revert<D = RecordData>(record: string, revision: number, params?: DryRunParams, options?: ConditionalWriteOptions): APIPromise<NoheadRecord<D>>;
|
|
86
|
+
}, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<RevertPreview>;
|
|
87
|
+
revert<D = RecordData>(record: string, revision: number, params?: DryRunParams, options?: ConditionalWriteOptions & RichTextOptions): APIPromise<NoheadRecord<D>>;
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
87
90
|
* A revision by its own ID (`rev_…`), as webhooks and the activity log name
|
|
@@ -92,7 +92,10 @@ export class Records extends Resource {
|
|
|
92
92
|
bulk(collection, params, options) {
|
|
93
93
|
return this.core.request("records_bulk", { path: { collection_id: collection }, body: params }, options);
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* The changes between two revisions; with `richText`, rich text fields'
|
|
97
|
+
* `before` and `after` read as HTML or Markdown.
|
|
98
|
+
*/
|
|
96
99
|
diff(record, params, options) {
|
|
97
100
|
return this.core.request("records_diff", { path: { record_id: record }, query: params }, options);
|
|
98
101
|
}
|
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.11.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.11.0";
|