@proteos/sdk 0.87.0 → 0.88.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -772,6 +772,7 @@ export type {
772
772
  UpdateLinkRequest,
773
773
  UpdateNodeRequest,
774
774
  UpdateSpaceRequest,
775
+ WriteContentOptions,
775
776
  WriteContentResponse,
776
777
  } from './knowledge/index.js'
777
778
  // Knowledge client (knowledge-service: graph-native knowledge base)
@@ -101,6 +101,7 @@ export type {
101
101
  UpdateLinkRequest,
102
102
  UpdateNodeRequest,
103
103
  UpdateSpaceRequest,
104
+ WriteContentOptions,
104
105
  WriteContentResponse,
105
106
  } from './types.js'
106
107
  // Re-export the reserved space-filter sentinel (a value, not a type).
@@ -20,6 +20,7 @@ import type {
20
20
  SearchContentResponse,
21
21
  SearchNodesRequest,
22
22
  UpdateNodeRequest,
23
+ WriteContentOptions,
23
24
  WriteContentResponse,
24
25
  } from './types.js'
25
26
 
@@ -62,7 +63,11 @@ export interface NodeService {
62
63
  getContent(id: string): Promise<ContentResponse>
63
64
 
64
65
  /** Overwrites a node's content body. Rejects derived (file/url) nodes. */
65
- writeContent(id: string, content: string): Promise<WriteContentResponse>
66
+ writeContent(
67
+ id: string,
68
+ content: string,
69
+ options?: WriteContentOptions,
70
+ ): Promise<WriteContentResponse>
66
71
 
67
72
  /** Applies a surgical anchored edit to a node's content body. */
68
73
  editContent(id: string, request: EditContentRequest): Promise<EditContentResponse>
@@ -151,9 +156,14 @@ export class NodeServiceImpl implements NodeService {
151
156
  return this.client.request<ContentResponse>('GET', `${NODES_BASE_PATH}/${id}/content`)
152
157
  }
153
158
 
154
- async writeContent(id: string, content: string): Promise<WriteContentResponse> {
159
+ async writeContent(
160
+ id: string,
161
+ content: string,
162
+ options: WriteContentOptions = {},
163
+ ): Promise<WriteContentResponse> {
155
164
  return this.client.request<WriteContentResponse>('PUT', `${NODES_BASE_PATH}/${id}/content`, {
156
165
  content,
166
+ ...options,
157
167
  })
158
168
  }
159
169
 
@@ -228,11 +228,25 @@ export interface ContentResponse {
228
228
  id: string
229
229
  content: string
230
230
  lines_total: number
231
+ /** Hex SHA-256 of the body — the version token to pass back as
232
+ * `expected_content_hash` when writing, so a newer change is not overwritten. */
233
+ content_hash: string
234
+ }
235
+
236
+ /**
237
+ * Options for `nodes.writeContent`. `expected_content_hash` makes the write
238
+ * conditional: the server refuses it with 409 `content_conflict` when the
239
+ * stored body no longer hashes to it (someone else wrote it since).
240
+ */
241
+ export interface WriteContentOptions {
242
+ expected_content_hash?: string
231
243
  }
232
244
 
233
245
  export interface WriteContentResponse {
234
246
  id: string
235
247
  lines_total: number
248
+ /** Hash of the body just written. */
249
+ content_hash: string
236
250
  }
237
251
 
238
252
  /** A surgical anchored edit (mirrors Claude Code's `Edit`). */