@opencxh/domain 1.239.0 → 1.240.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.
@@ -3,6 +3,10 @@ import { OwnerScope } from '../scope/types';
3
3
  export interface CompanySource {
4
4
  providerId: string;
5
5
  readOnly?: boolean;
6
+ /** A headline index rather than a copy; see `ContactSource.mode`. */
7
+ mode?: "proxy";
8
+ /** → `SyncConnection.id`; see `ContactSource.connectionId`. */
9
+ connectionId?: string;
6
10
  }
7
11
  /**
8
12
  * A company we own a row for.
@@ -10,6 +10,19 @@ export interface ContactSource {
10
10
  providerId: string;
11
11
  externalId?: string;
12
12
  readOnly?: boolean;
13
+ /**
14
+ * This row is a **headline index**, not a copy: its truth stays at the source.
15
+ *
16
+ * Absent = an ordinary row, which is what every row made before this field existed is — and the
17
+ * right default, because sending those outward would write to a connection that is not there.
18
+ * Set by the landing and only by the landing. Same field, same meaning as `WorkItemSource.mode`.
19
+ */
20
+ mode?: "proxy";
21
+ /**
22
+ * → `SyncConnection.id`. Which connection, not just which product: it carries the credential,
23
+ * and two links to the same CRM are two different answers.
24
+ */
25
+ connectionId?: string;
13
26
  }
14
27
  /**
15
28
  * Where a contact row came from.
package/dist/index.d.ts CHANGED
@@ -55,9 +55,9 @@ export * from './platform/common';
55
55
  export * from './platform/communication';
56
56
  export * from './platform/connector';
57
57
  export * from './platform/context';
58
- export * from './platform/document-operations';
59
58
  export * from './platform/document-blocks';
60
59
  export * from './platform/document-markdown';
60
+ export * from './platform/document-operations';
61
61
  export * from './platform/document-parse';
62
62
  export * from './platform/document-text';
63
63
  export * from './platform/documents';
@@ -13,7 +13,7 @@ export declare const CONNECTOR_PROVIDER_GROUP = "connector";
13
13
  * headline deliberately omits — a Jira issue has a description, comments and custom fields; a
14
14
  * To Do task has nothing the headline leaves out, and declares none.
15
15
  */
16
- export type ConnectorCapability = "list" | "get" | "fields" | "write" | "create" | "comment" | "attach" | "options";
16
+ export type ConnectorCapability = "list" | "get" | "fields" | "write" | "create" | "delete" | "comment" | "attach" | "options";
17
17
  /**
18
18
  * Continuous or one-off — a real difference, not a label.
19
19
  *
@@ -281,10 +281,16 @@ export interface ConnectorCreateRequest {
281
281
  /**
282
282
  * Where the new record goes, in the source's own id space: the project, the board, the list.
283
283
  *
284
- * Required, and there is no "somewhere sensible" fallback. A connector that guessed a container
285
- * would put work in a project nobody is looking at, and report success.
284
+ * **Never guessed.** A connector that invented a container would put work in a project nobody is
285
+ * looking at, and report success. So a caller that does not know one leaves it out rather than
286
+ * filling in something plausible.
287
+ *
288
+ * Optional because not every record kind has a container: a Jira issue is always inside a
289
+ * project, a CRM contact is a top-level object with an optional company beside it. Absent means
290
+ * "at the top", and a connector whose kind genuinely needs one refuses the create — which is the
291
+ * loud failure the required field used to buy, now stated by the side that knows.
286
292
  */
287
- containerExternalId: string;
293
+ containerExternalId?: string;
288
294
  /** The new record, in the **target app's** field names — same vocabulary as `patch`. */
289
295
  data: Record<string, unknown>;
290
296
  }
@@ -300,6 +306,43 @@ export interface ConnectorCreateResponse {
300
306
  externalId: string;
301
307
  data: Record<string, unknown>;
302
308
  }
309
+ /**
310
+ * `POST /provider/connector/delete` — remove a record in the system that owns it.
311
+ *
312
+ * The third of the write trio, and the one whose absence was a hole rather than a limitation:
313
+ * without it, deleting a proxy row here removed our index of a record that still exists there,
314
+ * and the next round landed it straight back. Two rounds later the person who deleted it is
315
+ * looking at it again, with no way to tell why.
316
+ *
317
+ * Separate from a write with a `deleted: true` patch for the same reason a create is separate:
318
+ * the vendor call is a different one (usually an archive), and a contract that expresses a delete
319
+ * as a field lets a connector implement the field and quietly not delete.
320
+ *
321
+ * A connector that cannot delete does not declare the capability, and the caller then refuses the
322
+ * delete with a reason instead of removing its own row alone.
323
+ */
324
+ export interface ConnectorDeleteRequest {
325
+ /** → {@link ConnectorDefinition.id} */
326
+ sourceId: string;
327
+ connectionId: string;
328
+ /** The {@link ManagedAccount} to talk with. Absent when no credential is needed. */
329
+ accountId?: string;
330
+ settings?: Record<string, unknown>;
331
+ /** From {@link ConnectorDefinition.kinds}. */
332
+ kind: string;
333
+ /** The record to remove, in the source system's own id space. */
334
+ externalId: string;
335
+ }
336
+ /**
337
+ * Answer to `POST /provider/connector/delete`. Wrapped in `ResponseFactory`.
338
+ *
339
+ * `deleted: false` is a real answer and not an error: a record that was already gone is the
340
+ * outcome the caller wanted, and saying so lets it log the difference without failing.
341
+ */
342
+ export interface ConnectorDeleteResponse {
343
+ externalId: string;
344
+ deleted: boolean;
345
+ }
303
346
  /**
304
347
  * One editable field of a **record**, as the connector describes it.
305
348
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.239.0",
3
+ "version": "1.240.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",