@proteos/sdk 0.52.0 → 0.53.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/src/index.ts CHANGED
@@ -271,6 +271,7 @@ export type {
271
271
  ConsentStatus,
272
272
  Contact,
273
273
  ContactAddress,
274
+ ContactAddressKey,
274
275
  ContactAddressKind,
275
276
  ContactAddressSource,
276
277
  ContactErasureRequest,
@@ -278,6 +279,8 @@ export type {
278
279
  ContactGroupService,
279
280
  ContactGroupSource,
280
281
  ContactMergeProposal,
282
+ ContactRecordLink,
283
+ ContactRecordLinkSource,
281
284
  ContactRef,
282
285
  ContactService,
283
286
  ContactSource,
@@ -304,6 +307,7 @@ export type {
304
307
  CreateAgentListenerRequest,
305
308
  CreateConnectionRequest,
306
309
  CreateContactGroupRequest,
310
+ CreateContactRecordLinkRequest,
307
311
  CreateContactRequest,
308
312
  CreateConversationBriefRequest,
309
313
  CreateConversationFilterRequest,
@@ -345,6 +349,7 @@ export type {
345
349
  ListContactAddressesQuery,
346
350
  ListContactGroupsQuery,
347
351
  ListContactMergeProposalsQuery,
352
+ ListContactRecordLinksQuery,
348
353
  ListContactsQuery,
349
354
  ListConversationBriefsQuery,
350
355
  ListConversationFilterEventsQuery,
@@ -449,7 +454,9 @@ export type {
449
454
  BatchUpsertRecordsResponse,
450
455
  BatchUpsertTransaction,
451
456
  BatchUpsertTransactionResult,
457
+ ListRecordDuplicatesQuery,
452
458
  ListRecordsOptions,
459
+ PublishContactObservationsResponse,
453
460
  QueryExecuteMeta,
454
461
  QueryExecuteResponse,
455
462
  QueryRow,
@@ -457,6 +464,10 @@ export type {
457
464
  QueryValidateMeta,
458
465
  QueryValidateResponse,
459
466
  RecordData,
467
+ RecordDuplicate,
468
+ RecordDuplicateService,
469
+ RecordDuplicateSource,
470
+ RecordDuplicateStatus,
460
471
  RecordService,
461
472
  } from './data/index.js'
462
473
  // Data client (data-service)
@@ -602,6 +613,10 @@ export type {
602
613
  // Component types
603
614
  Component,
604
615
  ComponentService,
616
+ // Currency attribute meta + value
617
+ ContactAddressAttributeKind,
618
+ ContactAddressAttributeMeta,
619
+ ContactBindingDuplicatePolicy,
605
620
  CreateAppConfigurationRequest,
606
621
  CreateAppRequest,
607
622
  CreateComponentRequest,
@@ -616,7 +631,6 @@ export type {
616
631
  CreatePageExtensionRequest,
617
632
  CreatePageRequest,
618
633
  CreateVariableRequest,
619
- // Currency attribute meta + value
620
634
  CurrencyAttributeMeta,
621
635
  CurrencySymbolSide,
622
636
  CurrencyValue,
@@ -628,6 +642,7 @@ export type {
628
642
  DesignReferenceService,
629
643
  // Entity types
630
644
  Entity,
645
+ EntityContactBinding,
631
646
  EntityExtension,
632
647
  EntityExtensionService,
633
648
  EntityService,
@@ -726,12 +741,14 @@ export {
726
741
  allCurrencyCodes,
727
742
  ColumnSchema,
728
743
  ComponentSchema,
744
+ ContactAddressAttributeMetaSchema,
729
745
  CURRENT_USER_DEFAULT,
730
746
  CurrencyAttributeMetaSchema,
731
747
  currencyLabel,
732
748
  currencySymbol,
733
749
  currencySymbolSide,
734
750
  DesignReferenceSchema,
751
+ EntityContactBindingSchema,
735
752
  EntityExtensionSchema,
736
753
  EntitySchema,
737
754
  EntityWithSchemaSchema,
@@ -766,6 +783,7 @@ export {
766
783
  PageSchema,
767
784
  PLATFORM_ATTRIBUTE_NAMES,
768
785
  parseAmount,
786
+ parseContactAddressMeta,
769
787
  parseCurrencyMeta,
770
788
  parseFileMeta,
771
789
  parseRelationMeta,
package/src/meta/index.ts CHANGED
@@ -182,6 +182,10 @@ export type {
182
182
  ComparisonOperator,
183
183
  // Component types
184
184
  Component,
185
+ // Currency attribute meta + value
186
+ ContactAddressAttributeKind,
187
+ ContactAddressAttributeMeta,
188
+ ContactBindingDuplicatePolicy,
185
189
  CreateAppConfigurationRequest,
186
190
  CreateAppRequest,
187
191
  CreateComponentRequest,
@@ -196,7 +200,6 @@ export type {
196
200
  CreatePageExtensionRequest,
197
201
  CreatePageRequest,
198
202
  CreateVariableRequest,
199
- // Currency attribute meta + value
200
203
  CurrencyAttributeMeta,
201
204
  CurrencyValue,
202
205
  CurrentUserDefault,
@@ -208,6 +211,7 @@ export type {
208
211
  DesignReferenceContent,
209
212
  // Entity types
210
213
  Entity,
214
+ EntityContactBinding,
211
215
  // EntityExtension types
212
216
  EntityExtension,
213
217
  EntityWithSchema,
@@ -305,9 +309,11 @@ export {
305
309
  acceptsCurrentUserDefault,
306
310
  ColumnSchema,
307
311
  ComponentSchema,
312
+ ContactAddressAttributeMetaSchema,
308
313
  CURRENT_USER_DEFAULT,
309
314
  CurrencyAttributeMetaSchema,
310
315
  DesignReferenceSchema,
316
+ EntityContactBindingSchema,
311
317
  EntityExtensionSchema,
312
318
  EntitySchema,
313
319
  EntityWithSchemaSchema,
@@ -337,6 +343,7 @@ export {
337
343
  PageExtensionSchema,
338
344
  PageSchema,
339
345
  PLATFORM_ATTRIBUTE_NAMES,
346
+ parseContactAddressMeta,
340
347
  parseCurrencyMeta,
341
348
  parseFileMeta,
342
349
  parsePrincipalMeta,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_comment": "SOURCE OF TRUTH for the page-layout control registry. Each entry under `controls` declares the primary control slug and the full compatible list for one (type[+format|+items.type]) combination. Renderer dispatches off `primary`; inspector picker dispatches off `compatible`. Edit this file then run `go run ./scripts/codegen/page-layout-registry` from the repo root to regenerate packages/go/model/page_layout_registry_gen.go.",
3
- "_attributeTypes": "Top-level keys MUST match the Go canonical AttributeType union in packages/go/model/meta/attribute.go (string \u00b7 number \u00b7 integer \u00b7 boolean \u00b7 array \u00b7 object \u00b7 datetime \u00b7 enum \u00b7 relation \u00b7 user \u00b7 currency \u00b7 knowledge-text \u00b7 file). `byFormat` keys for `string` MUST match StringFormat (email \u00b7 uri \u00b7 uuid \u00b7 hostname \u00b7 ipv4 \u00b7 ipv6). `byFormat` keys for `datetime` MUST match DatetimeFormat (date-time \u00b7 date \u00b7 time \u00b7 duration). `byItemsType` for `array` keys on the item Attribute's type. A null `primary` with empty `compatible` means \"render-only fallback\" \u2014 see plan \u00a73.2.5.",
3
+ "_attributeTypes": "Top-level keys MUST match the Go canonical AttributeType union in packages/go/model/meta/attribute.go (string \u00b7 number \u00b7 integer \u00b7 boolean \u00b7 array \u00b7 object \u00b7 datetime \u00b7 enum \u00b7 relation \u00b7 user \u00b7 principal \u00b7 currency \u00b7 knowledge-text \u00b7 file \u00b7 contact-address). `byFormat` keys for `string` MUST match StringFormat (email \u00b7 uri \u00b7 uuid \u00b7 hostname \u00b7 ipv4 \u00b7 ipv6). `byFormat` keys for `datetime` MUST match DatetimeFormat (date-time \u00b7 date \u00b7 time \u00b7 duration). `byItemsType` for `array` keys on the item Attribute's type. A null `primary` with empty `compatible` means \"render-only fallback\" \u2014 see plan \u00a73.2.5.",
4
4
  "_slugRoster": "v1 ships only lib-backed slugs. Slugs without a backing @proteos/ui component (markdown \u00b7 json-editor \u00b7 slider \u00b7 stepper \u00b7 percent \u00b7 user-card) are intentionally omitted; they return when the matching lib primitive ships. See plan \u00a73.2.4 / \u00a77.3. The `user-picker` slug is backed by the web client's UserCombobox (account/user-service people picker). The `currency` slug is backed by the web client's currency control (CurrencyInput: decimal amount + ISO-4217 picker).",
5
5
  "builtInControls": [
6
6
  "text",
@@ -26,7 +26,8 @@
26
26
  "knowledge-text",
27
27
  "file",
28
28
  "file-viewer",
29
- "record-filter"
29
+ "record-filter",
30
+ "contact-address"
30
31
  ],
31
32
  "controls": {
32
33
  "string": {
@@ -175,6 +176,13 @@
175
176
  "currency"
176
177
  ]
177
178
  },
179
+ "contact-address": {
180
+ "primary": "contact-address",
181
+ "compatible": [
182
+ "contact-address",
183
+ "text"
184
+ ]
185
+ },
178
186
  "knowledge-text": {
179
187
  "primary": "knowledge-text",
180
188
  "compatible": [
package/src/meta/types.ts CHANGED
@@ -48,6 +48,7 @@ export type AttributeType =
48
48
  | 'currency'
49
49
  | 'knowledge-text'
50
50
  | 'file'
51
+ | 'contact-address'
51
52
 
52
53
  /**
53
54
  * Attribute-level permissions: restricting a FIELD rather than a record — a
@@ -287,6 +288,32 @@ export const CurrencyAttributeMetaSchema = z.object({
287
288
  allowed_currency_codes: z.array(z.string()).optional(),
288
289
  })
289
290
 
291
+ /**
292
+ * Which endpoint a `contact-address` attribute holds. The record-capable
293
+ * subset of the conversation contact-address kinds — what a human types.
294
+ */
295
+ export type ContactAddressAttributeKind = 'email' | 'phone' | 'linkedin_public_identifier'
296
+
297
+ /**
298
+ * Metadata for a `contact-address`-typed attribute: ONE canonical reachable
299
+ * address of the person the record represents. The stored value is a plain
300
+ * string canonicalized on write (lowercased email, E.164 phone with a leading
301
+ * `+`, LinkedIn public identifier — a pasted profile URL is reduced to its
302
+ * `/in/<slug>`; displayed as https://www.linkedin.com/in/<slug>; LinkedIn
303
+ * profile ids such as ACoAA… are refused — the platform learns them itself).
304
+ * Records carrying such values bind to exactly one conversation contact;
305
+ * `kind` is REQUIRED. Mirror of the Go `metamodel.ContactAddressAttributeMeta`.
306
+ */
307
+ export interface ContactAddressAttributeMeta {
308
+ kind: ContactAddressAttributeKind
309
+ description?: string
310
+ }
311
+
312
+ export const ContactAddressAttributeMetaSchema = z.object({
313
+ kind: z.enum(['email', 'phone', 'linkedin_public_identifier']),
314
+ description: z.string().optional(),
315
+ })
316
+
290
317
  /**
291
318
  * The value of a `knowledge-text`-typed attribute: a reference to the
292
319
  * knowledge node (knowledge-service) that owns the text body. The record
@@ -354,6 +381,7 @@ export type AttributeMeta =
354
381
  | CurrencyAttributeMeta
355
382
  | KnowledgeTextAttributeMeta
356
383
  | FileAttributeMeta
384
+ | ContactAddressAttributeMeta
357
385
 
358
386
  /**
359
387
  * Entity attribute definition. Mirrors `model.Attribute` in the Go SDK.
@@ -572,6 +600,18 @@ export function parseFileMeta(attr: Attribute): FileAttributeMeta | null {
572
600
  return parsed.success ? parsed.data : {}
573
601
  }
574
602
 
603
+ /**
604
+ * Returns the typed `ContactAddressAttributeMeta` when `attr` is a
605
+ * contact-address attribute with a valid kind; null otherwise. Unlike the
606
+ * `{}`-defaulting parsers, `kind` is required — an attribute without one
607
+ * cannot be canonicalized, so it resolves to null (shape of parseRelationMeta).
608
+ */
609
+ export function parseContactAddressMeta(attr: Attribute): ContactAddressAttributeMeta | null {
610
+ if (attr.type !== 'contact-address') return null
611
+ const parsed = ContactAddressAttributeMetaSchema.safeParse(attr.meta)
612
+ return parsed.success ? parsed.data : null
613
+ }
614
+
575
615
  /**
576
616
  * A single operation a resource may be publicly exposed for. Independent set
577
617
  * (not a level): a resource can be public for `write` without `read`. Only
@@ -585,6 +625,27 @@ export const PublicAccessOperationSchema = z.enum(['read', 'write', 'delete'])
585
625
  * Entity definition.
586
626
  * Note: Entity uses `slug` as its primary identifier, not `id`.
587
627
  */
628
+ /**
629
+ * What happens when a record's contact-address value already belongs to a
630
+ * contact linked to ANOTHER record of the same entity: `reject` fails the
631
+ * write (409 `record_duplicate`); `flag` (default) accepts it and raises a
632
+ * record duplicate pair for review.
633
+ */
634
+ export type ContactBindingDuplicatePolicy = 'reject' | 'flag'
635
+
636
+ /**
637
+ * The entity-level contact-binding setting — meaningful only for entities
638
+ * with `contact-address` attributes; absent on the wire means `flag`. Mirror
639
+ * of the Go `metamodel.ContactBinding`.
640
+ */
641
+ export interface EntityContactBinding {
642
+ duplicate_policy: ContactBindingDuplicatePolicy
643
+ }
644
+
645
+ export const EntityContactBindingSchema = z.object({
646
+ duplicate_policy: z.enum(['reject', 'flag']),
647
+ })
648
+
588
649
  export interface Entity extends AuditFields {
589
650
  slug: string
590
651
  name: string
@@ -598,6 +659,11 @@ export interface Entity extends AuditFields {
598
659
  * (default).
599
660
  */
600
661
  public_record_access: PublicAccessOperation[]
662
+ /**
663
+ * Contact-binding setting (see `EntityContactBinding`). Optional: a Go
664
+ * build that predates the setting omits it, which means `flag`.
665
+ */
666
+ contact_binding?: EntityContactBinding
601
667
  module_slug: string
602
668
  /**
603
669
  * Liquid template that renders a human-readable title for an instance
@@ -620,6 +686,7 @@ export const EntitySchema = AuditFieldsSchema.extend({
620
686
  // Default keeps older API responses (pre-`public_record_access` rollout)
621
687
  // parsing cleanly.
622
688
  public_record_access: z.array(PublicAccessOperationSchema).default([]),
689
+ contact_binding: EntityContactBindingSchema.optional(),
623
690
  module_slug: z.string(),
624
691
  // Default keeps older API responses (pre-`title_template` rollout) parsing
625
692
  // cleanly — the field is non-optional in the TS surface but tolerant on
@@ -662,6 +729,10 @@ export interface CreateEntityRequest {
662
729
  * the field resets it to private.
663
730
  */
664
731
  public_record_access?: PublicAccessOperation[]
732
+ /**
733
+ * Contact-binding setting; full-replacement on upsert (omitted = `flag`).
734
+ */
735
+ contact_binding?: EntityContactBinding
665
736
  module_slug: string
666
737
  description: string
667
738
  title_template?: string
@@ -675,6 +746,7 @@ export interface UpdateEntityRequest {
675
746
  name?: string
676
747
  is_remote?: boolean
677
748
  public_record_access?: PublicAccessOperation[]
749
+ contact_binding?: EntityContactBinding
678
750
  module_slug?: string
679
751
  description?: string
680
752
  title_template?: string