@veltdev/types-dev 6.0.20 → 6.0.21

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.
@@ -3,6 +3,7 @@ import { PartialAttachment } from "./attachment-resolver.data.model";
3
3
  import { BaseMetadata } from "./base-metadata.data.model";
4
4
  import { CommentAnnotation } from "./comment-annotation.data.model";
5
5
  import { ResolverConfig, ResolverResponse } from "./resolver.data.model";
6
+ import { SuggestionData } from "./suggestion.data.model";
6
7
  export interface CommentAnnotationDataProvider {
7
8
  get?: (request: GetCommentResolverRequest) => Promise<ResolverResponse<Record<string, PartialCommentAnnotation>>>;
8
9
  save?: (request: SaveCommentResolverRequest) => Promise<ResolverResponse<undefined>>;
@@ -29,6 +30,11 @@ export interface SaveCommentResolverRequest {
29
30
  * The save event. One of the 4 core PII events (`ResolverActions`) or, when the customer
30
31
  * opts in via `ResolverConfig.additionalSaveEvents`, a non-core annotation-level event
31
32
  * (`CommentResolverSaveEvent`). See specs/comment-resolver iteration-2.
33
+ *
34
+ * Exception (comment-resolver iteration-3): `comment_annotation.suggestion_reject` is sent WITHOUT
35
+ * opt-in whenever the annotation carries a `suggestion` — it is the only suggestion transition that
36
+ * carries new content (`rejectReason`). A backend must answer 2xx and upsert for ANY event value,
37
+ * and an event name alone never means "apply the change": read `suggestion.status`.
32
38
  */
33
39
  event?: ResolverActions | CommentResolverSaveEvent;
34
40
  metadata?: BaseMetadata;
@@ -73,6 +79,13 @@ export interface PartialCommentAnnotationResult {
73
79
  * `CommonDbUtilsService` forwards it to the Velt-DB filter as `keepContextText`.
74
80
  */
75
81
  veltCopyKeepsContextText?: boolean;
82
+ /**
83
+ * INTERNAL (SDK write path only, never sent to a resolver). True when `originalData.suggestion`
84
+ * still carries its content keys on purpose (comment-resolver AC-032): a legacy row whose resolver
85
+ * copy does not hold them yet and this save is not a core hand-off. Forwarded by
86
+ * `CommonDbUtilsService` to the Velt-DB filter as `keepSuggestionContent`.
87
+ */
88
+ veltCopyKeepsSuggestionContent?: boolean;
76
89
  }
77
90
  export interface PartialTargetTextRange {
78
91
  text: string;
@@ -103,5 +116,14 @@ export interface PartialCommentAnnotation {
103
116
  };
104
117
  targetTextRange?: PartialTargetTextRange;
105
118
  resolvedByUserId?: string | null;
119
+ /**
120
+ * The suggestion (comment-resolver iteration-3) — present when the annotation carries one. Its
121
+ * content keys (`oldValue`, `newValue`, `summary`, `rejectReason`) are PII: they live only here,
122
+ * never in Velt. When sent it is always COMPLETE (the content your store already holds plus this
123
+ * write), so a backend may replace the stored value wholesale. `resolvedBy` may be `{ userId }`
124
+ * under a user resolver. On `get`, only the content keys are read back — Velt stays authoritative
125
+ * for `status`, `resolvedBy` and `resolvedAt`. Backends must persist and return it.
126
+ */
127
+ suggestion?: Partial<SuggestionData>;
106
128
  [key: string]: any;
107
129
  }
@@ -116,7 +116,7 @@ export interface TargetEditCommitResult {
116
116
  * attributes are preserved.
117
117
  */
118
118
  summaryHtml?: string;
119
- /** Customer metadata persisted on the resulting Suggestion. */
119
+ /** Customer metadata persisted on the resulting suggestion (`Suggestion.metadata`). */
120
120
  metadata?: Record<string, unknown>;
121
121
  }
122
122
  /**
@@ -204,6 +204,11 @@ export interface SuggestionData {
204
204
  */
205
205
  resolvedBy: User | null;
206
206
  resolvedAt: number | null;
207
+ /**
208
+ * Customer metadata from `CommitSuggestionConfig.metadata` (a JSON clone; absent when none was given).
209
+ * Self-hosting: content — with a comment resolver it is stored by the resolver only.
210
+ */
211
+ metadata?: Record<string, unknown>;
207
212
  }
208
213
  /**
209
214
  * Fields shared across every Suggestion regardless of status.
@@ -222,7 +227,10 @@ interface SuggestionBase<T = unknown> {
222
227
  newValue: T;
223
228
  /** Optional human-readable description. */
224
229
  summary: string | null;
225
- /** Customer-defined metadata supplied via CommitSuggestionConfig.metadata. */
230
+ /**
231
+ * Customer-defined metadata supplied via CommitSuggestionConfig.metadata (always an object;
232
+ * `{}` when none was given). Contains only the customer's keys.
233
+ */
226
234
  metadata: Record<string, any>;
227
235
  /** True iff the live value at approve time differed from oldValue. */
228
236
  driftDetected: boolean;
@@ -297,7 +305,11 @@ export interface CommitSuggestionConfig<T = unknown> {
297
305
  * `style` attributes are preserved so rich diff styling survives.
298
306
  */
299
307
  summaryHtml?: string;
300
- /** Optional customer-defined metadata. Stored on Suggestion.metadata. */
308
+ /**
309
+ * Optional customer-defined metadata (a plain JSON object). Stored on the suggestion
310
+ * (`annotation.suggestion.metadata`) and returned as `Suggestion.metadata`. With a comment
311
+ * resolver (self-hosting) it is stored by the resolver only.
312
+ */
301
313
  metadata?: Record<string, unknown>;
302
314
  }
303
315
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/types-dev",
3
- "version": "6.0.20",
3
+ "version": "6.0.21",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [