@nohead/sdk 0.10.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 CHANGED
@@ -5,6 +5,12 @@ 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
+
8
14
  ## 0.10.0
9
15
 
10
16
  - Rich text reads as HTML or Markdown: `richText: "html"` (or `"markdown"`)
package/README.md CHANGED
@@ -159,7 +159,7 @@ await nohead.drafts.get(draftId, {}, { richText: "markdown" })
159
159
  ```
160
160
 
161
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.
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
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
164
 
165
165
  ## Pagination
@@ -98,6 +98,7 @@ export const RICH_TEXT_OPERATIONS = new Set([
98
98
  "records_bulk",
99
99
  "records_create",
100
100
  "records_delete",
101
+ "records_diff",
101
102
  "records_get",
102
103
  "records_list",
103
104
  "records_publish",
@@ -1083,8 +1083,14 @@ export type RecordList = {
1083
1083
  *
1084
1084
  */
1085
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
+ */
1086
1089
  field?: string | null;
1087
1090
  field_id?: string;
1091
+ /**
1092
+ * Whether the field has been deleted since.
1093
+ */
1088
1094
  field_deleted?: boolean;
1089
1095
  attribute?: 'published_at' | 'deleted_at';
1090
1096
  kind: 'added' | 'changed' | 'removed';
@@ -1141,6 +1147,9 @@ export type RevertPreview = {
1141
1147
  record_id: string;
1142
1148
  to_revision: number;
1143
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
+ */
1144
1153
  changes: Array<Change>;
1145
1154
  };
1146
1155
  export type FeatureFlags = {
@@ -3301,6 +3310,10 @@ export type RecordsDiffData = {
3301
3310
  query: {
3302
3311
  from: number;
3303
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';
3304
3317
  };
3305
3318
  url: '/v1/records/{record_id}/diff';
3306
3319
  };
@@ -64,8 +64,11 @@ export declare class Records extends Resource {
64
64
  * Each record succeeds or fails on its own; see `results`.
65
65
  */
66
66
  bulk(collection: string, params: RecordBulkParams, options?: WriteOptions & RichTextOptions): APIPromise<RecordBatch>;
67
- /** The changes between two revisions. */
68
- diff(record: string, params: RecordDiffParams, options?: RequestOptions): APIPromise<RecordDiff>;
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.
@@ -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
- /** The changes between two revisions. */
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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.10.0";
1
+ export declare const VERSION = "0.11.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.10.0";
1
+ export const VERSION = "0.11.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nohead/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Official TypeScript SDK for the Nohead API",
5
5
  "license": "MIT",
6
6
  "homepage": "https://nohead.io",