@proteos/sdk 0.93.1 → 0.94.1
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/dist/{chunk-DXF354K4.js → chunk-TJGUHXZP.js} +5 -3
- package/dist/chunk-TJGUHXZP.js.map +1 -0
- package/dist/{chunk-SUS4QR63.cjs → chunk-VKCPXFOR.cjs} +5 -2
- package/dist/chunk-VKCPXFOR.cjs.map +1 -0
- package/dist/index.cjs +487 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1125 -19
- package/dist/index.d.ts +1125 -19
- package/dist/index.js +358 -49
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +100 -96
- package/dist/meta/index.d.cts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.js +1 -1
- package/dist/{types-BbiiuHnH.d.cts → types-UHBpVQQI.d.cts} +19 -1
- package/dist/{types-BbiiuHnH.d.ts → types-UHBpVQQI.d.ts} +19 -1
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +9 -0
- package/src/conversation/types.ts +10 -0
- package/src/data/index.ts +10 -0
- package/src/data/record-drafts.ts +38 -7
- package/src/data/types.ts +135 -9
- package/src/enrichment/index.ts +512 -0
- package/src/enrichment/types.ts +836 -0
- package/src/index.ts +104 -0
- package/src/meta/index.ts +2 -0
- package/src/meta/types.ts +18 -0
- package/dist/chunk-DXF354K4.js.map +0 -1
- package/dist/chunk-SUS4QR63.cjs.map +0 -1
|
@@ -4002,6 +4002,17 @@ declare const PageActionSchema: z.ZodObject<{
|
|
|
4002
4002
|
* - `off` — rows can never be checked, even when the list carries actions.
|
|
4003
4003
|
*/
|
|
4004
4004
|
type SelectionMode = 'on_demand' | 'always' | 'off';
|
|
4005
|
+
/**
|
|
4006
|
+
* Whether a list offers the suggestions overlay (what open record drafts would
|
|
4007
|
+
* write to its rows), and whether it is on from the start:
|
|
4008
|
+
*
|
|
4009
|
+
* - `off` (default) — the list never offers suggestions; it is an opt-in.
|
|
4010
|
+
* - `on_demand` — a Suggestions toggle shows in the toolbar while the visible
|
|
4011
|
+
* rows have suggestions.
|
|
4012
|
+
* - `always` — the overlay is on from the start.
|
|
4013
|
+
*/
|
|
4014
|
+
type SuggestionsMode = 'off' | 'on_demand' | 'always';
|
|
4015
|
+
declare const SuggestionsModeSchema: z.ZodEnum<["off", "on_demand", "always"]>;
|
|
4005
4016
|
/**
|
|
4006
4017
|
* List configuration.
|
|
4007
4018
|
* Note: List uses `slug` as its primary identifier, not `id`.
|
|
@@ -4022,6 +4033,8 @@ interface List extends AuditFields {
|
|
|
4022
4033
|
actions?: PageAction[];
|
|
4023
4034
|
/** Row-selection affordance; absent normalizes to `on_demand`. */
|
|
4024
4035
|
selection_mode?: SelectionMode;
|
|
4036
|
+
/** Suggestions overlay; absent normalizes to `off`. */
|
|
4037
|
+
suggestions_mode?: SuggestionsMode;
|
|
4025
4038
|
/** Record page to open from this list; empty/absent = org default for the entity. */
|
|
4026
4039
|
sorting: SortConfig[];
|
|
4027
4040
|
filters: FilterGroup[];
|
|
@@ -4178,6 +4191,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4178
4191
|
context?: string | undefined;
|
|
4179
4192
|
}>, "many">>;
|
|
4180
4193
|
selection_mode: z.ZodOptional<z.ZodEnum<["on_demand", "always", "off"]>>;
|
|
4194
|
+
suggestions_mode: z.ZodOptional<z.ZodEnum<["off", "on_demand", "always"]>>;
|
|
4181
4195
|
sorting: z.ZodArray<z.ZodObject<{
|
|
4182
4196
|
attribute: z.ZodString;
|
|
4183
4197
|
direction: z.ZodEnum<["asc", "desc"]>;
|
|
@@ -4241,6 +4255,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4241
4255
|
context?: string | undefined;
|
|
4242
4256
|
}[] | undefined;
|
|
4243
4257
|
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4258
|
+
suggestions_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4244
4259
|
}, {
|
|
4245
4260
|
name: string;
|
|
4246
4261
|
created_at: string;
|
|
@@ -4293,6 +4308,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4293
4308
|
context?: string | undefined;
|
|
4294
4309
|
}[] | undefined;
|
|
4295
4310
|
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4311
|
+
suggestions_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4296
4312
|
}>;
|
|
4297
4313
|
/**
|
|
4298
4314
|
* Options for listing lists.
|
|
@@ -4314,6 +4330,7 @@ interface CreateListRequest {
|
|
|
4314
4330
|
columns: Column[];
|
|
4315
4331
|
actions?: PageAction[];
|
|
4316
4332
|
selection_mode?: SelectionMode;
|
|
4333
|
+
suggestions_mode?: SuggestionsMode;
|
|
4317
4334
|
sorting: SortConfig[];
|
|
4318
4335
|
filters: FilterGroup[];
|
|
4319
4336
|
}
|
|
@@ -4326,6 +4343,7 @@ interface UpdateListRequest {
|
|
|
4326
4343
|
columns?: Column[];
|
|
4327
4344
|
actions?: PageAction[];
|
|
4328
4345
|
selection_mode?: SelectionMode;
|
|
4346
|
+
suggestions_mode?: SuggestionsMode;
|
|
4329
4347
|
/** Set to '' to clear back to the org default. */
|
|
4330
4348
|
sorting?: SortConfig[];
|
|
4331
4349
|
filters?: FilterGroup[];
|
|
@@ -6567,4 +6585,4 @@ declare function isCurrentUserDefault(value: unknown): value is CurrentUserDefau
|
|
|
6567
6585
|
/** Only the identity-valued attribute types can carry the sentinel. */
|
|
6568
6586
|
declare function acceptsCurrentUserDefault(type: AttributeType): boolean;
|
|
6569
6587
|
|
|
6570
|
-
export { type CreatePageExtensionRequest as $, type AuditFields as A, ColumnSchema as B, CURRENT_USER as C, type ComparisonOperator as D, type Component as E, type FileRef as F, ComponentSchema as G, type ComponentService as H, type ContactAddressAttributeKind as I, type ContactAddressAttributeMeta as J, ContactAddressAttributeMetaSchema as K, type ListOptions as L, type ContactBindingDuplicatePolicy as M, type CreateAppConfigurationRequest as N, type CreateAppRequest as O, PageIterator as P, type CreateComponentRequest as Q, type RequestOptions as R, type CreateDesignReferenceRequest as S, type CreateEntityExtensionRequest as T, type UserRef as U, type CreateEntityRequest as V, type CreateListExtensionRequest as W, type CreateListRequest as X, type CreateListViewRequest as Y, type CreateMenuConfigurationExtensionRequest as Z, type CreateMenuConfigurationRequest as _, type Attribute as a, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as a$, type CreatePageRequest as a0, type CreateVariableRequest as a1, type CurrencyAttributeMeta as a2, CurrencyAttributeMetaSchema as a3, type CurrencySymbolSide as a4, type CurrencyValue as a5, type CurrentUserDefault as a6, DEFAULT_OPTIONS as a7, DEFAULT_PAGE_SIZE as a8, DONE as a9, type ListAppConfigurationsOptions as aA, type ListAppsOptions as aB, type ListComponentsOptions as aC, type ListDesignReferencesOptions as aD, type ListEntitiesOptions as aE, type ListEntityExtensionsOptions as aF, type ListExtension as aG, type ListExtensionColumnPlacement as aH, ListExtensionColumnPlacementSchema as aI, ListExtensionSchema as aJ, type ListExtensionService as aK, type ListFn as aL, type ListListExtensionsOptions as aM, type ListListViewsOptions as aN, type ListListsOptions as aO, type ListMenuConfigurationExtensionsOptions as aP, type ListMenuConfigurationsOptions as aQ, type ListModulesOptions as aR, type ListPageExtensionsOptions as aS, type ListPagesOptions as aT, ListSchema as aU, type ListService as aV, type ListVariablesOptions as aW, type ListView as aX, ListViewSchema as aY, type ListViewService as aZ, type LogicalOperator as a_, type DeployModuleRequest as aa, type DesignReference as ab, type DesignReferenceContent as ac, DesignReferenceSchema as ad, type DesignReferenceService as ae, type Done as af, type Entity as ag, type EntityContactBinding as ah, EntityContactBindingSchema as ai, type EntityExtension as aj, EntityExtensionSchema as ak, type EntityExtensionService as al, EntitySchema as am, type EntityService as an, type EntityWithSchema as ao, EntityWithSchemaSchema as ap, type EnumAttributeMeta as aq, type EnumValue as ar, type ExtensionPosition as as, ExtensionPositionSchema as at, type FileAttributeMeta as au, FileRefSchema as av, type FilterElement as aw, FilterElementSchema as ax, FilterGroupSchema as ay, type List as az, type ListResult as b, type
|
|
6588
|
+
export { type CreatePageExtensionRequest as $, type AuditFields as A, ColumnSchema as B, CURRENT_USER as C, type ComparisonOperator as D, type Component as E, type FileRef as F, ComponentSchema as G, type ComponentService as H, type ContactAddressAttributeKind as I, type ContactAddressAttributeMeta as J, ContactAddressAttributeMetaSchema as K, type ListOptions as L, type ContactBindingDuplicatePolicy as M, type CreateAppConfigurationRequest as N, type CreateAppRequest as O, PageIterator as P, type CreateComponentRequest as Q, type RequestOptions as R, type CreateDesignReferenceRequest as S, type CreateEntityExtensionRequest as T, type UserRef as U, type CreateEntityRequest as V, type CreateListExtensionRequest as W, type CreateListRequest as X, type CreateListViewRequest as Y, type CreateMenuConfigurationExtensionRequest as Z, type CreateMenuConfigurationRequest as _, type Attribute as a, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as a$, type CreatePageRequest as a0, type CreateVariableRequest as a1, type CurrencyAttributeMeta as a2, CurrencyAttributeMetaSchema as a3, type CurrencySymbolSide as a4, type CurrencyValue as a5, type CurrentUserDefault as a6, DEFAULT_OPTIONS as a7, DEFAULT_PAGE_SIZE as a8, DONE as a9, type ListAppConfigurationsOptions as aA, type ListAppsOptions as aB, type ListComponentsOptions as aC, type ListDesignReferencesOptions as aD, type ListEntitiesOptions as aE, type ListEntityExtensionsOptions as aF, type ListExtension as aG, type ListExtensionColumnPlacement as aH, ListExtensionColumnPlacementSchema as aI, ListExtensionSchema as aJ, type ListExtensionService as aK, type ListFn as aL, type ListListExtensionsOptions as aM, type ListListViewsOptions as aN, type ListListsOptions as aO, type ListMenuConfigurationExtensionsOptions as aP, type ListMenuConfigurationsOptions as aQ, type ListModulesOptions as aR, type ListPageExtensionsOptions as aS, type ListPagesOptions as aT, ListSchema as aU, type ListService as aV, type ListVariablesOptions as aW, type ListView as aX, ListViewSchema as aY, type ListViewService as aZ, type LogicalOperator as a_, type DeployModuleRequest as aa, type DesignReference as ab, type DesignReferenceContent as ac, DesignReferenceSchema as ad, type DesignReferenceService as ae, type Done as af, type Entity as ag, type EntityContactBinding as ah, EntityContactBindingSchema as ai, type EntityExtension as aj, EntityExtensionSchema as ak, type EntityExtensionService as al, EntitySchema as am, type EntityService as an, type EntityWithSchema as ao, EntityWithSchemaSchema as ap, type EnumAttributeMeta as aq, type EnumValue as ar, type ExtensionPosition as as, ExtensionPositionSchema as at, type FileAttributeMeta as au, FileRefSchema as av, type FilterElement as aw, FilterElementSchema as ax, FilterGroupSchema as ay, type List as az, type ListResult as b, type UpdateComponentRequest as b$, type MenuConfiguration as b0, type MenuConfigurationExtension as b1, type MenuConfigurationExtensionPlacement as b2, MenuConfigurationExtensionPlacementSchema as b3, type MenuConfigurationExtensionPosition as b4, MenuConfigurationExtensionPositionSchema as b5, MenuConfigurationExtensionSchema as b6, type MenuConfigurationExtensionService as b7, MenuConfigurationSchema as b8, type MenuConfigurationService as b9, type PageExtensionService as bA, type PageLayout as bB, PageLayoutSchema as bC, type PageMode as bD, PageSchema as bE, type PageService as bF, type PageType as bG, type PublicPageComponent as bH, type PublicPageResponse as bI, type RecordPageBinding as bJ, RecordPageBindingSchema as bK, type RelationAttributeMeta as bL, RelationAttributeMetaSchema as bM, type ResolvedClientOptions as bN, ResponseMetaSchema as bO, type SortConfig as bP, SortConfigSchema as bQ, type SortDirection as bR, type SuggestionsMode as bS, SuggestionsModeSchema as bT, type Timestamps as bU, type TokenProvider as bV, type TriggerPageBinding as bW, TriggerPageBindingSchema as bX, type TriggerPhase as bY, type UpdateAppConfigurationRequest as bZ, type UpdateAppRequest as b_, type MenuItem as ba, MenuItemSchema as bb, MenuItemType as bc, MetaClient as bd, type MetaListOptions as be, type Module as bf, ModuleSchema as bg, type ModuleService as bh, type ModuleStatus as bi, type OnDeleteAction as bj, OnDeleteActionSchema as bk, PAGE_ACTION_MATCH_MAX_LIMIT as bl, PAGE_EXTENSION_ANCHOR_MAIN as bm, PAGE_EXTENSION_ANCHOR_SIDE_PANEL as bn, PLATFORM_ATTRIBUTE_NAMES as bo, PLATFORM_USER_ID as bp, type Page as bq, type PageActionIntent as br, type PageActionKind as bs, type PageActionMatch as bt, PageActionMatchSchema as bu, PageActionSchema as bv, type PageExtension as bw, type PageExtensionPlacement as bx, PageExtensionPlacementSchema as by, PageExtensionSchema as bz, ProteosClient as c, type LayoutTab as c$, type UpdateDesignReferenceRequest as c0, type UpdateEntityExtensionRequest as c1, type UpdateEntityRequest as c2, type UpdateListExtensionRequest as c3, type UpdateListRequest as c4, type UpdateListViewRequest as c5, type UpdateMenuConfigurationExtensionRequest as c6, type UpdateMenuConfigurationRequest as c7, type UpdatePageExtensionRequest as c8, type UpdatePageRequest as c9, resolveOptions as cA, type AttributeForLookup as cB, type AttributeMeta as cC, BUILT_IN_CONTROLS as cD, type BuiltInControlSlug as cE, CALENDAR_MAX_OVERLAY_USERS as cF, CALENDAR_VIEW_KINDS as cG, type CalendarElement as cH, type CalendarViewKind as cI, type CardElement as cJ, type ColumnElement as cK, type CommonProps as cL, type ComponentElement as cM, type ControlBucket as cN, type DatetimeAttributeMeta as cO, type DatetimeFormat as cP, type DividerElement as cQ, type FieldElement as cR, FileAttributeMetaSchema as cS, type LayoutAlign as cT, type LayoutElement as cU, LayoutElementSchema as cV, LayoutElementType as cW, type LayoutGap as cX, type LayoutJustify as cY, type LayoutStep as cZ, LayoutStepSchema as c_, type UpdateVariableRequest as ca, UserRefSchema as cb, type UserType as cc, type Variable as cd, VariableSchema as ce, type VariableService as cf, acceptsCurrentUserDefault as cg, allCurrencyCodes as ch, bundleVersionOf as ci, createIterator as cj, createListResultSchema as ck, currencyLabel as cl, currencySymbol as cm, currencySymbolSide as cn, formatAmount as co, formatMoney as cp, isCurrentUser as cq, isCurrentUserDefault as cr, isPlatformAttributeName as cs, localeNumberSeparators as ct, parseAmount as cu, parseContactAddressMeta as cv, parseCurrencyMeta as cw, parseFileMeta as cx, parseRelationMeta as cy, platformAttributes as cz, type PrincipalRef as d, LayoutTabSchema as d0, type LengthValue as d1, LengthValueSchema as d2, type ListElement as d3, type NumberAttributeMeta as d4, type ObjectAttributeMeta as d5, PAGE_BACKGROUND_COLOR_RE as d6, PAGE_BACKGROUND_TOKENS as d7, PAGE_HEADERS as d8, type PageBackgroundToken as d9, type TextVariant as dA, type UserAttributeMeta as dB, UserAttributeMetaSchema as dC, type WorkflowTriggerElement as dD, isBuiltInControl as dE, isLengthValue as dF, isPageBackground as dG, isReservedAttributeName as dH, isStyleSizeValue as dI, isTitleQueryable as dJ, lookupCompatibleControls as dK, lookupControls as dL, lookupPrimaryControl as dM, parsePrincipalMeta as dN, parseUserMeta as dO, titleTemplateVariables as dP, type PageHeader as da, type PageLayoutSidePanel as db, PageLayoutSidePanelSchema as dc, type PageStyle as dd, PageStyleSchema as de, type PrincipalAttributeMeta as df, type PrincipalType as dg, RECORD_TITLE_FIELD as dh, type RecordFilterElement as di, type RelatedListElement as dj, type RelatedRecordElement as dk, type ResponsiveSizing as dl, type RowElement as dm, type SchedulingPickerElement as dn, type SectionElement as dp, type SizeValue as dq, SizeValueSchema as dr, type SizingProps as ds, type StepperElement as dt, type StringAttributeMeta as du, type StringFormat as dv, type StyleSizeValue as dw, StyleSizeValueSchema as dx, type TabsElement as dy, type TextElement as dz, type PageAction as e, type FilterGroup as f, type ResponseMeta as g, type AttributeType as h, type PublicAccessOperation as i, type App as j, type AppConfiguration as k, AppConfigurationSchema as l, type AppConfigurationService as m, type AppHome as n, AppHomeSchema as o, type AppHomeType as p, AppSchema as q, type AppService as r, type ArrayAttributeMeta as s, type AttributeAccessRule as t, type AttributeRestrictions as u, AttributeSchema as v, AuditFieldsSchema as w, CURRENT_USER_DEFAULT as x, type ClientOptions as y, type Column as z };
|
|
@@ -4002,6 +4002,17 @@ declare const PageActionSchema: z.ZodObject<{
|
|
|
4002
4002
|
* - `off` — rows can never be checked, even when the list carries actions.
|
|
4003
4003
|
*/
|
|
4004
4004
|
type SelectionMode = 'on_demand' | 'always' | 'off';
|
|
4005
|
+
/**
|
|
4006
|
+
* Whether a list offers the suggestions overlay (what open record drafts would
|
|
4007
|
+
* write to its rows), and whether it is on from the start:
|
|
4008
|
+
*
|
|
4009
|
+
* - `off` (default) — the list never offers suggestions; it is an opt-in.
|
|
4010
|
+
* - `on_demand` — a Suggestions toggle shows in the toolbar while the visible
|
|
4011
|
+
* rows have suggestions.
|
|
4012
|
+
* - `always` — the overlay is on from the start.
|
|
4013
|
+
*/
|
|
4014
|
+
type SuggestionsMode = 'off' | 'on_demand' | 'always';
|
|
4015
|
+
declare const SuggestionsModeSchema: z.ZodEnum<["off", "on_demand", "always"]>;
|
|
4005
4016
|
/**
|
|
4006
4017
|
* List configuration.
|
|
4007
4018
|
* Note: List uses `slug` as its primary identifier, not `id`.
|
|
@@ -4022,6 +4033,8 @@ interface List extends AuditFields {
|
|
|
4022
4033
|
actions?: PageAction[];
|
|
4023
4034
|
/** Row-selection affordance; absent normalizes to `on_demand`. */
|
|
4024
4035
|
selection_mode?: SelectionMode;
|
|
4036
|
+
/** Suggestions overlay; absent normalizes to `off`. */
|
|
4037
|
+
suggestions_mode?: SuggestionsMode;
|
|
4025
4038
|
/** Record page to open from this list; empty/absent = org default for the entity. */
|
|
4026
4039
|
sorting: SortConfig[];
|
|
4027
4040
|
filters: FilterGroup[];
|
|
@@ -4178,6 +4191,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4178
4191
|
context?: string | undefined;
|
|
4179
4192
|
}>, "many">>;
|
|
4180
4193
|
selection_mode: z.ZodOptional<z.ZodEnum<["on_demand", "always", "off"]>>;
|
|
4194
|
+
suggestions_mode: z.ZodOptional<z.ZodEnum<["off", "on_demand", "always"]>>;
|
|
4181
4195
|
sorting: z.ZodArray<z.ZodObject<{
|
|
4182
4196
|
attribute: z.ZodString;
|
|
4183
4197
|
direction: z.ZodEnum<["asc", "desc"]>;
|
|
@@ -4241,6 +4255,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4241
4255
|
context?: string | undefined;
|
|
4242
4256
|
}[] | undefined;
|
|
4243
4257
|
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4258
|
+
suggestions_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4244
4259
|
}, {
|
|
4245
4260
|
name: string;
|
|
4246
4261
|
created_at: string;
|
|
@@ -4293,6 +4308,7 @@ declare const ListSchema: z.ZodObject<{
|
|
|
4293
4308
|
context?: string | undefined;
|
|
4294
4309
|
}[] | undefined;
|
|
4295
4310
|
selection_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4311
|
+
suggestions_mode?: "on_demand" | "always" | "off" | undefined;
|
|
4296
4312
|
}>;
|
|
4297
4313
|
/**
|
|
4298
4314
|
* Options for listing lists.
|
|
@@ -4314,6 +4330,7 @@ interface CreateListRequest {
|
|
|
4314
4330
|
columns: Column[];
|
|
4315
4331
|
actions?: PageAction[];
|
|
4316
4332
|
selection_mode?: SelectionMode;
|
|
4333
|
+
suggestions_mode?: SuggestionsMode;
|
|
4317
4334
|
sorting: SortConfig[];
|
|
4318
4335
|
filters: FilterGroup[];
|
|
4319
4336
|
}
|
|
@@ -4326,6 +4343,7 @@ interface UpdateListRequest {
|
|
|
4326
4343
|
columns?: Column[];
|
|
4327
4344
|
actions?: PageAction[];
|
|
4328
4345
|
selection_mode?: SelectionMode;
|
|
4346
|
+
suggestions_mode?: SuggestionsMode;
|
|
4329
4347
|
/** Set to '' to clear back to the org default. */
|
|
4330
4348
|
sorting?: SortConfig[];
|
|
4331
4349
|
filters?: FilterGroup[];
|
|
@@ -6567,4 +6585,4 @@ declare function isCurrentUserDefault(value: unknown): value is CurrentUserDefau
|
|
|
6567
6585
|
/** Only the identity-valued attribute types can carry the sentinel. */
|
|
6568
6586
|
declare function acceptsCurrentUserDefault(type: AttributeType): boolean;
|
|
6569
6587
|
|
|
6570
|
-
export { type CreatePageExtensionRequest as $, type AuditFields as A, ColumnSchema as B, CURRENT_USER as C, type ComparisonOperator as D, type Component as E, type FileRef as F, ComponentSchema as G, type ComponentService as H, type ContactAddressAttributeKind as I, type ContactAddressAttributeMeta as J, ContactAddressAttributeMetaSchema as K, type ListOptions as L, type ContactBindingDuplicatePolicy as M, type CreateAppConfigurationRequest as N, type CreateAppRequest as O, PageIterator as P, type CreateComponentRequest as Q, type RequestOptions as R, type CreateDesignReferenceRequest as S, type CreateEntityExtensionRequest as T, type UserRef as U, type CreateEntityRequest as V, type CreateListExtensionRequest as W, type CreateListRequest as X, type CreateListViewRequest as Y, type CreateMenuConfigurationExtensionRequest as Z, type CreateMenuConfigurationRequest as _, type Attribute as a, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as a$, type CreatePageRequest as a0, type CreateVariableRequest as a1, type CurrencyAttributeMeta as a2, CurrencyAttributeMetaSchema as a3, type CurrencySymbolSide as a4, type CurrencyValue as a5, type CurrentUserDefault as a6, DEFAULT_OPTIONS as a7, DEFAULT_PAGE_SIZE as a8, DONE as a9, type ListAppConfigurationsOptions as aA, type ListAppsOptions as aB, type ListComponentsOptions as aC, type ListDesignReferencesOptions as aD, type ListEntitiesOptions as aE, type ListEntityExtensionsOptions as aF, type ListExtension as aG, type ListExtensionColumnPlacement as aH, ListExtensionColumnPlacementSchema as aI, ListExtensionSchema as aJ, type ListExtensionService as aK, type ListFn as aL, type ListListExtensionsOptions as aM, type ListListViewsOptions as aN, type ListListsOptions as aO, type ListMenuConfigurationExtensionsOptions as aP, type ListMenuConfigurationsOptions as aQ, type ListModulesOptions as aR, type ListPageExtensionsOptions as aS, type ListPagesOptions as aT, ListSchema as aU, type ListService as aV, type ListVariablesOptions as aW, type ListView as aX, ListViewSchema as aY, type ListViewService as aZ, type LogicalOperator as a_, type DeployModuleRequest as aa, type DesignReference as ab, type DesignReferenceContent as ac, DesignReferenceSchema as ad, type DesignReferenceService as ae, type Done as af, type Entity as ag, type EntityContactBinding as ah, EntityContactBindingSchema as ai, type EntityExtension as aj, EntityExtensionSchema as ak, type EntityExtensionService as al, EntitySchema as am, type EntityService as an, type EntityWithSchema as ao, EntityWithSchemaSchema as ap, type EnumAttributeMeta as aq, type EnumValue as ar, type ExtensionPosition as as, ExtensionPositionSchema as at, type FileAttributeMeta as au, FileRefSchema as av, type FilterElement as aw, FilterElementSchema as ax, FilterGroupSchema as ay, type List as az, type ListResult as b, type
|
|
6588
|
+
export { type CreatePageExtensionRequest as $, type AuditFields as A, ColumnSchema as B, CURRENT_USER as C, type ComparisonOperator as D, type Component as E, type FileRef as F, ComponentSchema as G, type ComponentService as H, type ContactAddressAttributeKind as I, type ContactAddressAttributeMeta as J, ContactAddressAttributeMetaSchema as K, type ListOptions as L, type ContactBindingDuplicatePolicy as M, type CreateAppConfigurationRequest as N, type CreateAppRequest as O, PageIterator as P, type CreateComponentRequest as Q, type RequestOptions as R, type CreateDesignReferenceRequest as S, type CreateEntityExtensionRequest as T, type UserRef as U, type CreateEntityRequest as V, type CreateListExtensionRequest as W, type CreateListRequest as X, type CreateListViewRequest as Y, type CreateMenuConfigurationExtensionRequest as Z, type CreateMenuConfigurationRequest as _, type Attribute as a, MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS as a$, type CreatePageRequest as a0, type CreateVariableRequest as a1, type CurrencyAttributeMeta as a2, CurrencyAttributeMetaSchema as a3, type CurrencySymbolSide as a4, type CurrencyValue as a5, type CurrentUserDefault as a6, DEFAULT_OPTIONS as a7, DEFAULT_PAGE_SIZE as a8, DONE as a9, type ListAppConfigurationsOptions as aA, type ListAppsOptions as aB, type ListComponentsOptions as aC, type ListDesignReferencesOptions as aD, type ListEntitiesOptions as aE, type ListEntityExtensionsOptions as aF, type ListExtension as aG, type ListExtensionColumnPlacement as aH, ListExtensionColumnPlacementSchema as aI, ListExtensionSchema as aJ, type ListExtensionService as aK, type ListFn as aL, type ListListExtensionsOptions as aM, type ListListViewsOptions as aN, type ListListsOptions as aO, type ListMenuConfigurationExtensionsOptions as aP, type ListMenuConfigurationsOptions as aQ, type ListModulesOptions as aR, type ListPageExtensionsOptions as aS, type ListPagesOptions as aT, ListSchema as aU, type ListService as aV, type ListVariablesOptions as aW, type ListView as aX, ListViewSchema as aY, type ListViewService as aZ, type LogicalOperator as a_, type DeployModuleRequest as aa, type DesignReference as ab, type DesignReferenceContent as ac, DesignReferenceSchema as ad, type DesignReferenceService as ae, type Done as af, type Entity as ag, type EntityContactBinding as ah, EntityContactBindingSchema as ai, type EntityExtension as aj, EntityExtensionSchema as ak, type EntityExtensionService as al, EntitySchema as am, type EntityService as an, type EntityWithSchema as ao, EntityWithSchemaSchema as ap, type EnumAttributeMeta as aq, type EnumValue as ar, type ExtensionPosition as as, ExtensionPositionSchema as at, type FileAttributeMeta as au, FileRefSchema as av, type FilterElement as aw, FilterElementSchema as ax, FilterGroupSchema as ay, type List as az, type ListResult as b, type UpdateComponentRequest as b$, type MenuConfiguration as b0, type MenuConfigurationExtension as b1, type MenuConfigurationExtensionPlacement as b2, MenuConfigurationExtensionPlacementSchema as b3, type MenuConfigurationExtensionPosition as b4, MenuConfigurationExtensionPositionSchema as b5, MenuConfigurationExtensionSchema as b6, type MenuConfigurationExtensionService as b7, MenuConfigurationSchema as b8, type MenuConfigurationService as b9, type PageExtensionService as bA, type PageLayout as bB, PageLayoutSchema as bC, type PageMode as bD, PageSchema as bE, type PageService as bF, type PageType as bG, type PublicPageComponent as bH, type PublicPageResponse as bI, type RecordPageBinding as bJ, RecordPageBindingSchema as bK, type RelationAttributeMeta as bL, RelationAttributeMetaSchema as bM, type ResolvedClientOptions as bN, ResponseMetaSchema as bO, type SortConfig as bP, SortConfigSchema as bQ, type SortDirection as bR, type SuggestionsMode as bS, SuggestionsModeSchema as bT, type Timestamps as bU, type TokenProvider as bV, type TriggerPageBinding as bW, TriggerPageBindingSchema as bX, type TriggerPhase as bY, type UpdateAppConfigurationRequest as bZ, type UpdateAppRequest as b_, type MenuItem as ba, MenuItemSchema as bb, MenuItemType as bc, MetaClient as bd, type MetaListOptions as be, type Module as bf, ModuleSchema as bg, type ModuleService as bh, type ModuleStatus as bi, type OnDeleteAction as bj, OnDeleteActionSchema as bk, PAGE_ACTION_MATCH_MAX_LIMIT as bl, PAGE_EXTENSION_ANCHOR_MAIN as bm, PAGE_EXTENSION_ANCHOR_SIDE_PANEL as bn, PLATFORM_ATTRIBUTE_NAMES as bo, PLATFORM_USER_ID as bp, type Page as bq, type PageActionIntent as br, type PageActionKind as bs, type PageActionMatch as bt, PageActionMatchSchema as bu, PageActionSchema as bv, type PageExtension as bw, type PageExtensionPlacement as bx, PageExtensionPlacementSchema as by, PageExtensionSchema as bz, ProteosClient as c, type LayoutTab as c$, type UpdateDesignReferenceRequest as c0, type UpdateEntityExtensionRequest as c1, type UpdateEntityRequest as c2, type UpdateListExtensionRequest as c3, type UpdateListRequest as c4, type UpdateListViewRequest as c5, type UpdateMenuConfigurationExtensionRequest as c6, type UpdateMenuConfigurationRequest as c7, type UpdatePageExtensionRequest as c8, type UpdatePageRequest as c9, resolveOptions as cA, type AttributeForLookup as cB, type AttributeMeta as cC, BUILT_IN_CONTROLS as cD, type BuiltInControlSlug as cE, CALENDAR_MAX_OVERLAY_USERS as cF, CALENDAR_VIEW_KINDS as cG, type CalendarElement as cH, type CalendarViewKind as cI, type CardElement as cJ, type ColumnElement as cK, type CommonProps as cL, type ComponentElement as cM, type ControlBucket as cN, type DatetimeAttributeMeta as cO, type DatetimeFormat as cP, type DividerElement as cQ, type FieldElement as cR, FileAttributeMetaSchema as cS, type LayoutAlign as cT, type LayoutElement as cU, LayoutElementSchema as cV, LayoutElementType as cW, type LayoutGap as cX, type LayoutJustify as cY, type LayoutStep as cZ, LayoutStepSchema as c_, type UpdateVariableRequest as ca, UserRefSchema as cb, type UserType as cc, type Variable as cd, VariableSchema as ce, type VariableService as cf, acceptsCurrentUserDefault as cg, allCurrencyCodes as ch, bundleVersionOf as ci, createIterator as cj, createListResultSchema as ck, currencyLabel as cl, currencySymbol as cm, currencySymbolSide as cn, formatAmount as co, formatMoney as cp, isCurrentUser as cq, isCurrentUserDefault as cr, isPlatformAttributeName as cs, localeNumberSeparators as ct, parseAmount as cu, parseContactAddressMeta as cv, parseCurrencyMeta as cw, parseFileMeta as cx, parseRelationMeta as cy, platformAttributes as cz, type PrincipalRef as d, LayoutTabSchema as d0, type LengthValue as d1, LengthValueSchema as d2, type ListElement as d3, type NumberAttributeMeta as d4, type ObjectAttributeMeta as d5, PAGE_BACKGROUND_COLOR_RE as d6, PAGE_BACKGROUND_TOKENS as d7, PAGE_HEADERS as d8, type PageBackgroundToken as d9, type TextVariant as dA, type UserAttributeMeta as dB, UserAttributeMetaSchema as dC, type WorkflowTriggerElement as dD, isBuiltInControl as dE, isLengthValue as dF, isPageBackground as dG, isReservedAttributeName as dH, isStyleSizeValue as dI, isTitleQueryable as dJ, lookupCompatibleControls as dK, lookupControls as dL, lookupPrimaryControl as dM, parsePrincipalMeta as dN, parseUserMeta as dO, titleTemplateVariables as dP, type PageHeader as da, type PageLayoutSidePanel as db, PageLayoutSidePanelSchema as dc, type PageStyle as dd, PageStyleSchema as de, type PrincipalAttributeMeta as df, type PrincipalType as dg, RECORD_TITLE_FIELD as dh, type RecordFilterElement as di, type RelatedListElement as dj, type RelatedRecordElement as dk, type ResponsiveSizing as dl, type RowElement as dm, type SchedulingPickerElement as dn, type SectionElement as dp, type SizeValue as dq, SizeValueSchema as dr, type SizingProps as ds, type StepperElement as dt, type StringAttributeMeta as du, type StringFormat as dv, type StyleSizeValue as dw, StyleSizeValueSchema as dx, type TabsElement as dy, type TextElement as dz, type PageAction as e, type FilterGroup as f, type ResponseMeta as g, type AttributeType as h, type PublicAccessOperation as i, type App as j, type AppConfiguration as k, AppConfigurationSchema as l, type AppConfigurationService as m, type AppHome as n, AppHomeSchema as o, type AppHomeType as p, AppSchema as q, type AppService as r, type ArrayAttributeMeta as s, type AttributeAccessRule as t, type AttributeRestrictions as u, AttributeSchema as v, AuditFieldsSchema as w, CURRENT_USER_DEFAULT as x, type ClientOptions as y, type Column as z };
|
package/package.json
CHANGED
|
@@ -147,6 +147,15 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
|
|
|
147
147
|
// Interview guides an admin writes; whoever reads a definition reads its
|
|
148
148
|
// interviews, and whoever writes it invites people.
|
|
149
149
|
{ slug: 'discovery-interview-definitions', name: 'Discovery Interview Definitions' },
|
|
150
|
+
// Enrichment (enrichment-service): filling fields through provider
|
|
151
|
+
// waterfalls on the platform's keys. write = start an enrichment run.
|
|
152
|
+
{ slug: 'enrichment-runs', name: 'Enrichment Runs' },
|
|
153
|
+
// An entity's enrichment configuration: which attributes get filled, from
|
|
154
|
+
// what, and on which triggers.
|
|
155
|
+
{ slug: 'enrichment-mappings', name: 'Enrichment Mappings' },
|
|
156
|
+
// Usage (usage-service): the metering ledger. Read-only and org-level —
|
|
157
|
+
// whoever reads usage reads all of the org's usage.
|
|
158
|
+
{ slug: 'usage-records', name: 'Usage Records' },
|
|
150
159
|
] as const
|
|
151
160
|
|
|
152
161
|
/** Just the platform entity slugs, in canonical order. */
|
|
@@ -2659,6 +2659,8 @@ export interface ContactPermissionEvent {
|
|
|
2659
2659
|
occurred_at: string
|
|
2660
2660
|
note?: string
|
|
2661
2661
|
evidence?: Record<string, unknown>
|
|
2662
|
+
/** The caller's key for the fact; unique per org when set. */
|
|
2663
|
+
external_ref?: string
|
|
2662
2664
|
created_at: string
|
|
2663
2665
|
created_by: UserRef
|
|
2664
2666
|
}
|
|
@@ -2673,6 +2675,8 @@ export interface ContactPurposeStatus {
|
|
|
2673
2675
|
is_inherited: boolean
|
|
2674
2676
|
/** Addresses opted out of this purpose (or all) on their own scope. */
|
|
2675
2677
|
opted_out_address_ids: string[]
|
|
2678
|
+
/** Addresses opted in to this purpose (or all) on their own scope, such as a double opt-in for one address. */
|
|
2679
|
+
opted_in_address_ids: string[]
|
|
2676
2680
|
/** Addresses with a double opt-in for this purpose waiting to be confirmed. */
|
|
2677
2681
|
pending_address_ids: string[]
|
|
2678
2682
|
/** Addresses whose double opt-in for this purpose was not confirmed in time. */
|
|
@@ -2888,6 +2892,12 @@ export interface RecordPermissionEventRequest {
|
|
|
2888
2892
|
occurred_at?: string
|
|
2889
2893
|
note?: string
|
|
2890
2894
|
evidence?: Record<string, unknown>
|
|
2895
|
+
/**
|
|
2896
|
+
* A key for the fact this event records (a sync's id for one upstream
|
|
2897
|
+
* status). When the org already has an event with this key, nothing is
|
|
2898
|
+
* recorded and the contact comes back unchanged.
|
|
2899
|
+
*/
|
|
2900
|
+
external_ref?: string
|
|
2891
2901
|
}
|
|
2892
2902
|
|
|
2893
2903
|
export interface BlockContactRequest {
|
package/src/data/index.ts
CHANGED
|
@@ -75,18 +75,26 @@ export type {
|
|
|
75
75
|
ListRecordDraftsQuery,
|
|
76
76
|
ListRecordDuplicatesQuery,
|
|
77
77
|
ListRecordsOptions,
|
|
78
|
+
ProposedValuesQuery,
|
|
78
79
|
PublishContactObservationsResponse,
|
|
79
80
|
RecordData,
|
|
80
81
|
RecordDraft,
|
|
81
82
|
RecordDraftChange,
|
|
82
83
|
RecordDraftChangeKind,
|
|
84
|
+
RecordDraftCitation,
|
|
85
|
+
RecordDraftEvidence,
|
|
83
86
|
RecordDraftIntent,
|
|
84
87
|
RecordDraftItem,
|
|
85
88
|
RecordDraftItemError,
|
|
86
89
|
RecordDraftItemInput,
|
|
87
90
|
RecordDraftItemResult,
|
|
88
91
|
RecordDraftItemResultStatus,
|
|
92
|
+
RecordDraftItemVerdict,
|
|
93
|
+
RecordDraftProposedValue,
|
|
94
|
+
RecordDraftReference,
|
|
95
|
+
RecordDraftScope,
|
|
89
96
|
RecordDraftStatus,
|
|
97
|
+
RecordDraftVerdict,
|
|
90
98
|
RecordDraftVersion,
|
|
91
99
|
RecordDraftVersionKind,
|
|
92
100
|
RecordDraftVersions,
|
|
@@ -103,7 +111,9 @@ export {
|
|
|
103
111
|
BatchUpsertRecordsResponseSchema,
|
|
104
112
|
BatchUpsertTransactionResultSchema,
|
|
105
113
|
BatchUpsertTransactionSchema,
|
|
114
|
+
isRecordDraftReference,
|
|
106
115
|
RecordDraftChangeSchema,
|
|
116
|
+
RecordDraftEvidenceSchema,
|
|
107
117
|
RecordDraftItemResultSchema,
|
|
108
118
|
RecordDraftItemSchema,
|
|
109
119
|
} from './types.js'
|
|
@@ -4,7 +4,9 @@ import type {
|
|
|
4
4
|
ApproveRecordDraftRequest,
|
|
5
5
|
CreateRecordDraftRequest,
|
|
6
6
|
ListRecordDraftsQuery,
|
|
7
|
+
ProposedValuesQuery,
|
|
7
8
|
RecordDraft,
|
|
9
|
+
RecordDraftProposedValue,
|
|
8
10
|
RecordDraftVersions,
|
|
9
11
|
RejectRecordDraftRequest,
|
|
10
12
|
UpdateRecordDraftRequest,
|
|
@@ -15,8 +17,10 @@ const RECORD_DRAFTS_BASE_PATH = '/data/v1/record-drafts'
|
|
|
15
17
|
/**
|
|
16
18
|
* Proposed record writes awaiting a verdict. `create` needs
|
|
17
19
|
* `record-drafts:write`; `approve` additionally needs `write` (create / update /
|
|
18
|
-
* upsert) or `delete` (delete) on
|
|
19
|
-
* caller.
|
|
20
|
+
* upsert) or `delete` (delete) on every entity whose items are applied,
|
|
21
|
+
* because the writes run as the caller. A draft can hold items of several
|
|
22
|
+
* entities that reference each other by `transaction_id`. The status is
|
|
23
|
+
* derived server-side from the per-item verdicts.
|
|
20
24
|
*/
|
|
21
25
|
export interface RecordDraftService {
|
|
22
26
|
/** The org's drafts — `proposed` by default. */
|
|
@@ -34,14 +38,27 @@ export interface RecordDraftService {
|
|
|
34
38
|
listVersions(id: string): Promise<RecordDraftVersions>
|
|
35
39
|
/**
|
|
36
40
|
* Applies the draft as the caller. No `items` = its items as they stand;
|
|
37
|
-
* `items` = the reviewer's edit, saved first.
|
|
38
|
-
* `
|
|
39
|
-
*
|
|
40
|
-
* `
|
|
41
|
+
* `items` = the reviewer's edit, saved first. `transaction_ids` /
|
|
42
|
+
* `attributes` apply only that part (plus the not-yet-written items it
|
|
43
|
+
* references). Always 200 with the draft: `status` is terminal once every
|
|
44
|
+
* item has a verdict, else still `proposed` with `verdicts` (what is
|
|
45
|
+
* decided) and per-item `results` (what failed, to fix and re-approve). 409
|
|
46
|
+
* `record_draft_not_proposed` once resolved, `record_draft_already_decided`
|
|
47
|
+
* when the scope holds nothing undecided.
|
|
41
48
|
*/
|
|
42
49
|
approve(id: string, request?: ApproveRecordDraftRequest): Promise<RecordDraft>
|
|
43
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Declines the draft, or the part `transaction_ids` / `attributes` name —
|
|
52
|
+
* nothing is written. 409 `record_draft_not_proposed` once resolved.
|
|
53
|
+
*/
|
|
44
54
|
reject(id: string, request?: RejectRecordDraftRequest): Promise<RecordDraft>
|
|
55
|
+
/**
|
|
56
|
+
* What proposed drafts would still write to records of one entity, one row
|
|
57
|
+
* per value, with the record's current value and the proposer's evidence.
|
|
58
|
+
* Needs `read` on the entity; records and attributes the caller may not
|
|
59
|
+
* read are left out.
|
|
60
|
+
*/
|
|
61
|
+
proposedValues(query: ProposedValuesQuery): Promise<RecordDraftProposedValue[]>
|
|
45
62
|
}
|
|
46
63
|
|
|
47
64
|
export class RecordDraftServiceImpl implements RecordDraftService {
|
|
@@ -96,4 +113,18 @@ export class RecordDraftServiceImpl implements RecordDraftService {
|
|
|
96
113
|
request,
|
|
97
114
|
)
|
|
98
115
|
}
|
|
116
|
+
|
|
117
|
+
async proposedValues(query: ProposedValuesQuery): Promise<RecordDraftProposedValue[]> {
|
|
118
|
+
const response = await this.client.requestWithQuery<{ data: RecordDraftProposedValue[] }>(
|
|
119
|
+
'GET',
|
|
120
|
+
`${RECORD_DRAFTS_BASE_PATH}/proposed-values`,
|
|
121
|
+
{
|
|
122
|
+
entity_slug: query.entity_slug,
|
|
123
|
+
...(query.record_ids && query.record_ids.length > 0
|
|
124
|
+
? { record_ids: query.record_ids.join(',') }
|
|
125
|
+
: {}),
|
|
126
|
+
},
|
|
127
|
+
)
|
|
128
|
+
return response.data ?? []
|
|
129
|
+
}
|
|
99
130
|
}
|
package/src/data/types.ts
CHANGED
|
@@ -151,8 +151,11 @@ export type RecordDraftIntent = 'create' | 'update' | 'delete' | 'upsert'
|
|
|
151
151
|
/** The review lifecycle: `proposed` awaits a verdict; `approved` was applied
|
|
152
152
|
* exactly as proposed; `approved_with_changes` was edited, then applied
|
|
153
153
|
* (`changes` says what the reviewer altered); `rejected` was never applied.
|
|
154
|
-
* The last three are terminal.
|
|
155
|
-
*
|
|
154
|
+
* The last three are terminal. The status is DERIVED by the server from the
|
|
155
|
+
* per-item `verdicts` and `changes` — a resolver never names the outcome: a
|
|
156
|
+
* draft stays `proposed` until every item has a verdict; then all accepted ⇒
|
|
157
|
+
* `approved`, all rejected ⇒ `rejected`, anything else ⇒
|
|
158
|
+
* `approved_with_changes`. */
|
|
156
159
|
export type RecordDraftStatus = 'proposed' | 'approved' | 'approved_with_changes' | 'rejected'
|
|
157
160
|
|
|
158
161
|
/**
|
|
@@ -161,11 +164,104 @@ export type RecordDraftStatus = 'proposed' | 'approved' | 'approved_with_changes
|
|
|
161
164
|
* upsert: `data`, `id` optional (present ⇒ update, absent ⇒ create). `id` never
|
|
162
165
|
* rides inside `data`. Update/upsert `data` is a partial merge (only the keys
|
|
163
166
|
* present change).
|
|
167
|
+
*
|
|
168
|
+
* `entity_slug` is the entity this item writes; absent = the draft's own. A
|
|
169
|
+
* relation attribute in `data` can point at ANOTHER ITEM of the draft instead
|
|
170
|
+
* of a record id — `{ transaction_id: '1' }` ({@link RecordDraftReference}) —
|
|
171
|
+
* and is resolved to that item's record id on approve, parents first.
|
|
172
|
+
* `evidence` says where a proposed value came from, per attribute of `data`.
|
|
164
173
|
*/
|
|
165
174
|
export interface RecordDraftItem {
|
|
166
175
|
transaction_id: string
|
|
176
|
+
entity_slug?: string
|
|
167
177
|
id?: string
|
|
168
178
|
data?: Record<string, unknown>
|
|
179
|
+
evidence?: Record<string, RecordDraftEvidence>
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A relation value pointing at another item of the same draft. */
|
|
183
|
+
export interface RecordDraftReference {
|
|
184
|
+
transaction_id: string
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Whether a proposed value is a {@link RecordDraftReference}: an object
|
|
188
|
+
* whose only key is a string `transaction_id`. */
|
|
189
|
+
export function isRecordDraftReference(value: unknown): value is RecordDraftReference {
|
|
190
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false
|
|
191
|
+
const keys = Object.keys(value)
|
|
192
|
+
return (
|
|
193
|
+
keys.length === 1 &&
|
|
194
|
+
keys[0] === 'transaction_id' &&
|
|
195
|
+
typeof (value as RecordDraftReference).transaction_id === 'string'
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** One source behind a proposed value. */
|
|
200
|
+
export interface RecordDraftCitation {
|
|
201
|
+
title?: string
|
|
202
|
+
url?: string
|
|
203
|
+
snippet?: string
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Why the proposer believes ONE proposed value: a short label, how sure it
|
|
207
|
+
* is (0..1) and the sources. All optional. */
|
|
208
|
+
export interface RecordDraftEvidence {
|
|
209
|
+
label?: string
|
|
210
|
+
confidence?: number
|
|
211
|
+
citations?: RecordDraftCitation[]
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** A reviewer's decision on an item or on one attribute of it. `edited` (items
|
|
215
|
+
* only): written, but not exactly as proposed. */
|
|
216
|
+
export type RecordDraftVerdict = 'accepted' | 'edited' | 'rejected'
|
|
217
|
+
|
|
218
|
+
/** What has been decided about ONE item so far. `verdict` is set once the
|
|
219
|
+
* whole item is decided; while only some attributes are, it is absent and
|
|
220
|
+
* `attributes` names them. */
|
|
221
|
+
export interface RecordDraftItemVerdict {
|
|
222
|
+
transaction_id: string
|
|
223
|
+
verdict?: RecordDraftVerdict
|
|
224
|
+
attributes?: Record<string, Exclude<RecordDraftVerdict, 'edited'>>
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Narrows an approve or a reject to part of a draft: `transaction_ids` picks
|
|
228
|
+
* the items (absent = every undecided item), `attributes` the attributes of
|
|
229
|
+
* those items (absent = all). An item that would create a record is decided
|
|
230
|
+
* whole — naming it together with attributes fails with 400
|
|
231
|
+
* `record_draft_scope_invalid`. */
|
|
232
|
+
export interface RecordDraftScope {
|
|
233
|
+
transaction_ids?: string[]
|
|
234
|
+
attributes?: string[]
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* ONE value a proposed draft would write, next to what the record holds now —
|
|
239
|
+
* the flat read model behind the suggestions overlay. `record_id` is absent
|
|
240
|
+
* for a value of a record the draft would create. Only undecided values of
|
|
241
|
+
* proposed drafts appear, never an attribute the reader may not read.
|
|
242
|
+
*/
|
|
243
|
+
export interface RecordDraftProposedValue {
|
|
244
|
+
record_id?: string
|
|
245
|
+
attribute: string
|
|
246
|
+
current: unknown
|
|
247
|
+
proposed: unknown
|
|
248
|
+
evidence?: RecordDraftEvidence
|
|
249
|
+
record_draft_id: string
|
|
250
|
+
transaction_id: string
|
|
251
|
+
created_at: string
|
|
252
|
+
/**
|
|
253
|
+
* The draft's `updated_at` when the value was read. Pass it as
|
|
254
|
+
* `expected_updated_at` when approving or rejecting this value: a draft
|
|
255
|
+
* revised since is refused (409 `record_draft_conflict`) instead of deciding
|
|
256
|
+
* a value nobody saw.
|
|
257
|
+
*/
|
|
258
|
+
record_draft_updated_at: string
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface ProposedValuesQuery {
|
|
262
|
+
entity_slug: string
|
|
263
|
+
/** At most 200. Values of records a draft would create are returned either way. */
|
|
264
|
+
record_ids?: string[]
|
|
169
265
|
}
|
|
170
266
|
|
|
171
267
|
export type RecordDraftItemResultStatus = 'success' | 'error'
|
|
@@ -220,15 +316,19 @@ export interface RecordDraftChange {
|
|
|
220
316
|
* message. `items` is the draft as it stands now: the proposal, as revised by
|
|
221
317
|
* its proposer and edited by reviewers while proposed (each save is a
|
|
222
318
|
* {@link RecordDraftVersion}; `version` is the newest one's number);
|
|
223
|
-
* `applied_items` what
|
|
224
|
-
*
|
|
225
|
-
*
|
|
319
|
+
* `applied_items` what approves have sent so far; `results` the latest outcome
|
|
320
|
+
* per transaction_id; `verdicts` what has been decided, per item and — for a
|
|
321
|
+
* scoped approve or reject — per attribute (an approve only sends what is
|
|
322
|
+
* undecided, so a re-approve never repeats a write); `changes` the reviewer's
|
|
323
|
+
* delta. `entity_slug` is the entity of every item that names none,
|
|
324
|
+
* `entity_slugs` every entity the items write. `source` is caller-supplied
|
|
226
325
|
* provenance (`agent_key`, `session_id`, …); `created_by` is the acting user.
|
|
227
326
|
*/
|
|
228
327
|
export interface RecordDraft {
|
|
229
328
|
id: string
|
|
230
329
|
org_id: string
|
|
231
330
|
entity_slug: string
|
|
331
|
+
entity_slugs: string[]
|
|
232
332
|
intent: RecordDraftIntent
|
|
233
333
|
status: RecordDraftStatus
|
|
234
334
|
summary: string
|
|
@@ -237,6 +337,7 @@ export interface RecordDraft {
|
|
|
237
337
|
applied_items?: RecordDraftItem[]
|
|
238
338
|
results?: RecordDraftItemResult[]
|
|
239
339
|
changes?: RecordDraftChange[]
|
|
340
|
+
verdicts?: RecordDraftItemVerdict[]
|
|
240
341
|
source?: Record<string, unknown>
|
|
241
342
|
reason?: string
|
|
242
343
|
resolved_by?: { type: string; id: string }
|
|
@@ -251,7 +352,9 @@ export interface RecordDraft {
|
|
|
251
352
|
}
|
|
252
353
|
|
|
253
354
|
export interface CreateRecordDraftRequest {
|
|
254
|
-
|
|
355
|
+
/** The entity of every item that names none. May be left out when every
|
|
356
|
+
* item carries its own `entity_slug`. */
|
|
357
|
+
entity_slug?: string
|
|
255
358
|
intent: RecordDraftIntent
|
|
256
359
|
/** 1..200 items; a missing `transaction_id` becomes the 1-based index. */
|
|
257
360
|
items: RecordDraftItem[]
|
|
@@ -267,8 +370,9 @@ export type RecordDraftItemInput = Omit<RecordDraftItem, 'transaction_id'> & {
|
|
|
267
370
|
}
|
|
268
371
|
|
|
269
372
|
/** `items` absent = apply the draft's items as they stand; present = save them
|
|
270
|
-
* first as the reviewer's edit, then apply them.
|
|
271
|
-
|
|
373
|
+
* first as the reviewer's edit, then apply them. `transaction_ids` /
|
|
374
|
+
* `attributes` apply only that part; the rest stays proposed. */
|
|
375
|
+
export interface ApproveRecordDraftRequest extends RecordDraftScope {
|
|
272
376
|
items?: RecordDraftItemInput[]
|
|
273
377
|
/** The `updated_at` the reviewer last saw: a draft that moved on since fails
|
|
274
378
|
* with 409 `record_draft_conflict` instead of applying what they never saw. */
|
|
@@ -322,11 +426,17 @@ export interface RecordDraftVersions {
|
|
|
322
426
|
changes: RecordDraftChange[]
|
|
323
427
|
}
|
|
324
428
|
|
|
325
|
-
|
|
429
|
+
/** `transaction_ids` / `attributes` decline only that part; without either
|
|
430
|
+
* everything still undecided is declined. */
|
|
431
|
+
export interface RejectRecordDraftRequest extends RecordDraftScope {
|
|
326
432
|
reason?: string
|
|
433
|
+
/** The `updated_at` the reviewer last saw: a draft that moved on since fails
|
|
434
|
+
* with 409 `record_draft_conflict` instead of declining what they never saw. */
|
|
435
|
+
expected_updated_at?: string
|
|
327
436
|
}
|
|
328
437
|
|
|
329
438
|
export interface ListRecordDraftsQuery {
|
|
439
|
+
/** Drafts holding an item of this entity. */
|
|
330
440
|
entity_slug?: string
|
|
331
441
|
/** Defaults to `proposed` on the server. */
|
|
332
442
|
status?: RecordDraftStatus
|
|
@@ -337,10 +447,26 @@ export interface ListRecordDraftsQuery {
|
|
|
337
447
|
page_size?: number
|
|
338
448
|
}
|
|
339
449
|
|
|
450
|
+
export const RecordDraftEvidenceSchema = z.object({
|
|
451
|
+
label: z.string().optional(),
|
|
452
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
453
|
+
citations: z
|
|
454
|
+
.array(
|
|
455
|
+
z.object({
|
|
456
|
+
title: z.string().optional(),
|
|
457
|
+
url: z.string().optional(),
|
|
458
|
+
snippet: z.string().optional(),
|
|
459
|
+
}),
|
|
460
|
+
)
|
|
461
|
+
.optional(),
|
|
462
|
+
})
|
|
463
|
+
|
|
340
464
|
export const RecordDraftItemSchema = z.object({
|
|
341
465
|
transaction_id: z.string(),
|
|
466
|
+
entity_slug: z.string().optional(),
|
|
342
467
|
id: z.string().optional(),
|
|
343
468
|
data: z.record(z.string(), z.unknown()).optional(),
|
|
469
|
+
evidence: z.record(z.string(), RecordDraftEvidenceSchema).optional(),
|
|
344
470
|
})
|
|
345
471
|
|
|
346
472
|
export const RecordDraftItemResultSchema = z.object({
|