diff --git a/.repository-projection.json b/.repository-projection.json index 557c6eb..3717c4d 100644 --- a/.repository-projection.json +++ b/.repository-projection.json @@ -3,11 +3,11 @@ "projection": "api", "projectionSchemaVersion": 1, "sourceRepository": "dx-corp/mono", - "sourceSha": "2a7522b52a13fe770f480745fa7b41ac2188a9e7", + "sourceSha": "896601b95934732649448c8b302a834b3570527a", "destinationRepository": "dx-corp/api", - "priorProjectedBase": "65020664845801c739014b317649009eb2e93deb", + "priorProjectedBase": "53236c02b00840ddcc58cb5c67c06a0695f660b7", "definitionDigest": "4c1601bee99ccc8305013324608e9c146999b21427179d25fd342f69aebd37bd", - "toolDigest": "0b559427b4956119349f84f6b203c0877aaec738", - "contentDigest": "f1362d89f3cac276bd3d7addc592b4934dc40c2b67cbe218b232949e2350d928", + "toolDigest": "e416387d26f2b9d992678cbdd4b73eb10dfb071f", + "contentDigest": "37b6a72881c1306e34a0c52e7c32bd4683948dd3d932eb797df15e6e1987e1ee", "publicationEligible": true } diff --git a/openapi/deixicpublic/v1/sdk.openapi.yaml b/openapi/deixicpublic/v1/sdk.openapi.yaml index e6c031d..58a00dc 100644 --- a/openapi/deixicpublic/v1/sdk.openapi.yaml +++ b/openapi/deixicpublic/v1/sdk.openapi.yaml @@ -849,6 +849,44 @@ paths: application/json: schema: $ref: '#/components/schemas/deixicpublic.v1.UpsertBusinessObjectResponse' + /deixicpublic.v1.DeixicPublicService/TransitionBusinessObject: + post: + tags: + - deixicpublic.v1.DeixicPublicService + summary: TransitionBusinessObject + description: |- + Moves a record of a type with a lifecycle facet through one declared + transition at an exact revision. + operationId: deixicpublic.v1.DeixicPublicService.TransitionBusinessObject + parameters: + - name: Connect-Protocol-Version + in: header + required: true + schema: + $ref: '#/components/schemas/connect-protocol-version' + - name: Connect-Timeout-Ms + in: header + schema: + $ref: '#/components/schemas/connect-timeout-header' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/deixicpublic.v1.TransitionBusinessObjectRequest' + required: true + responses: + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/connect.error' + "200": + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/deixicpublic.v1.TransitionBusinessObjectResponse' /deixicpublic.v1.DeixicPublicService/ListBusinessBlueprints: post: tags: @@ -2211,6 +2249,23 @@ components: title: BusinessBlueprintOrigin additionalProperties: false description: Names the built-in blueprint member a tenant type was cloned from. + deixicpublic.v1.BusinessDisplayFacet: + type: object + properties: + icon: + type: string + title: icon + navSection: + type: string + title: nav_section + listFieldIds: + type: array + items: + type: string + title: list_field_ids + title: BusinessDisplayFacet + additionalProperties: false + description: Navigation and list presentation. deixicpublic.v1.BusinessFieldValue: type: object oneOf: @@ -2336,6 +2391,167 @@ components: title: field_id title: BusinessFieldValue additionalProperties: false + deixicpublic.v1.BusinessGraphFacet: + type: object + properties: + thingKind: + type: string + title: thing_kind + relations: + type: array + items: + $ref: '#/components/schemas/deixicpublic.v1.BusinessGraphRelation' + title: relations + title: BusinessGraphFacet + additionalProperties: false + description: How records project into the graph. + deixicpublic.v1.BusinessGraphRelation: + type: object + properties: + fieldId: + type: string + title: field_id + relation: + type: string + title: relation + inbound: + type: boolean + title: inbound + description: The referenced record is the edge's source. + title: BusinessGraphRelation + additionalProperties: false + description: The relation one reference field draws. + deixicpublic.v1.BusinessIndexFacet: + type: object + properties: + indexedFieldIds: + type: array + items: + type: string + title: indexed_field_ids + sortableFieldIds: + type: array + items: + type: string + title: sortable_field_ids + title: BusinessIndexFacet + additionalProperties: false + description: Fields readers filter and sort by. + deixicpublic.v1.BusinessLifecycleApproval: + type: object + properties: + reviewerEntitlement: + type: string + title: reviewer_entitlement + distinctFromCreator: + type: boolean + title: distinct_from_creator + notify: + type: string + title: notify + toState: + type: string + title: to_state + description: A declared state the approval also moves the record to. + title: BusinessLifecycleApproval + additionalProperties: false + deixicpublic.v1.BusinessLifecycleDue: + type: object + properties: + fieldId: + type: string + title: field_id + assigneeFieldId: + type: string + title: assignee_field_id + future: + type: boolean + title: future + maxDaysAhead: + type: integer + title: max_days_ahead + nullable: true + title: BusinessLifecycleDue + additionalProperties: false + deixicpublic.v1.BusinessLifecycleFacet: + type: object + properties: + states: + type: array + items: + $ref: '#/components/schemas/deixicpublic.v1.BusinessLifecycleState' + title: states + transitions: + type: array + items: + $ref: '#/components/schemas/deixicpublic.v1.BusinessLifecycleTransition' + title: transitions + approval: + title: approval + $ref: '#/components/schemas/deixicpublic.v1.BusinessLifecycleApproval' + due: + title: due + $ref: '#/components/schemas/deixicpublic.v1.BusinessLifecycleDue' + title: BusinessLifecycleFacet + additionalProperties: false + description: States, transitions, approval and due date. + deixicpublic.v1.BusinessLifecycleState: + type: object + properties: + stateId: + type: string + title: state_id + name: + type: string + title: name + initial: + type: boolean + title: initial + terminal: + type: boolean + title: terminal + title: BusinessLifecycleState + additionalProperties: false + deixicpublic.v1.BusinessLifecycleTransition: + type: object + properties: + transitionId: + type: string + title: transition_id + name: + type: string + title: name + fromStates: + type: array + items: + type: string + title: from_states + toState: + type: string + title: to_state + noteRequired: + type: boolean + title: note_required + requiresApproval: + type: boolean + title: requires_approval + description: Refused unless the record's current revision is approved. + entitlements: + type: array + items: + type: string + title: entitlements + description: Entitlements a workspace member needs, beyond write access. + createsKind: + type: string + title: creates_kind + description: Kind of the record this transition creates, if any. + notify: + type: string + title: notify + description: Event kind sent through the record notification owner, if any. + title: BusinessLifecycleTransition + additionalProperties: false deixicpublic.v1.BusinessMoney: type: object properties: @@ -2448,6 +2664,12 @@ components: description: type: string title: description + facets: + title: facets + description: |- + Optional behaviour of this revision; unset keeps the default behaviour. + Immutable with the published revision. + $ref: '#/components/schemas/deixicpublic.v1.BusinessTypeFacets' title: BusinessObjectType additionalProperties: false deixicpublic.v1.BusinessObjectTypeField: @@ -2508,6 +2730,18 @@ components: title: target_type_id title: BusinessObjectTypeRelationship additionalProperties: false + deixicpublic.v1.BusinessPermissionFacet: + type: object + properties: + readEntitlement: + type: string + title: read_entitlement + writeEntitlement: + type: string + title: write_entitlement + title: BusinessPermissionFacet + additionalProperties: false + description: Entitlement names a member needs to read or write records. deixicpublic.v1.BusinessSourceFieldMapping: type: object properties: @@ -2529,6 +2763,29 @@ components: title: values title: BusinessTextList additionalProperties: false + deixicpublic.v1.BusinessTypeFacets: + type: object + properties: + lifecycle: + title: lifecycle + $ref: '#/components/schemas/deixicpublic.v1.BusinessLifecycleFacet' + graph: + title: graph + $ref: '#/components/schemas/deixicpublic.v1.BusinessGraphFacet' + index: + title: index + $ref: '#/components/schemas/deixicpublic.v1.BusinessIndexFacet' + display: + title: display + $ref: '#/components/schemas/deixicpublic.v1.BusinessDisplayFacet' + permissions: + title: permissions + $ref: '#/components/schemas/deixicpublic.v1.BusinessPermissionFacet' + title: BusinessTypeFacets + additionalProperties: false + description: |- + Behaviour facets of one published type revision, in the workflow-record + grammar. Every facet is optional. deixicpublic.v1.ClientMcpPolicy: type: object properties: @@ -4677,6 +4934,62 @@ components: title: archived title: Thread additionalProperties: false + deixicpublic.v1.TransitionBusinessObjectRequest: + type: object + properties: + organizationId: + type: string + title: organization_id + workspaceId: + type: string + title: workspace_id + idempotencyKey: + type: string + title: idempotency_key + typeId: + type: string + title: type_id + objectId: + type: string + title: object_id + expectedRevision: + type: + - integer + - string + title: expected_revision + format: int64 + transitionId: + type: string + title: transition_id + note: + type: string + title: note + description: A person's reason; required when the transition declares note_required. + title: TransitionBusinessObjectRequest + additionalProperties: false + deixicpublic.v1.TransitionBusinessObjectResponse: + type: object + properties: + objectId: + type: string + title: object_id + revision: + type: + - integer + - string + title: revision + format: int64 + description: The record's revision after the transition. + state: + type: string + title: state + description: The state the record is now in. + createdObjectId: + type: string + title: created_object_id + description: The record the transition created, when it declares one. + title: TransitionBusinessObjectResponse + additionalProperties: false deixicpublic.v1.UpdateBusinessObjectRequest: type: object properties: diff --git a/proto/deixicpublic/v1/sdk.proto b/proto/deixicpublic/v1/sdk.proto index e19566a..f0c792e 100644 --- a/proto/deixicpublic/v1/sdk.proto +++ b/proto/deixicpublic/v1/sdk.proto @@ -39,6 +39,9 @@ service DeixicPublicService { // Creates the record whose declared unique field holds the given value, or // updates the one that already does, atomically on the server. rpc UpsertBusinessObject(UpsertBusinessObjectRequest) returns (UpsertBusinessObjectResponse); + // Moves a record of a type with a lifecycle facet through one declared + // transition at an exact revision. + rpc TransitionBusinessObject(TransitionBusinessObjectRequest) returns (TransitionBusinessObjectResponse); rpc ListBusinessBlueprints(ListBusinessBlueprintsRequest) returns (ListBusinessBlueprintsResponse); rpc BindBusinessObjectSource(BindBusinessObjectSourceRequest) returns (BindBusinessObjectSourceResponse); rpc ListBusinessObjectRelationships(ListBusinessObjectRelationshipsRequest) returns (ListBusinessObjectRelationshipsResponse); @@ -537,6 +540,94 @@ message BusinessObjectType { repeated BusinessObjectTypeRelationship relationships = 7; string plural_name = 8; string description = 9; + // Optional behaviour of this revision; unset keeps the default behaviour. + // Immutable with the published revision. + BusinessTypeFacets facets = 10; +} + +// Behaviour facets of one published type revision, in the workflow-record +// grammar. Every facet is optional. +message BusinessTypeFacets { + BusinessLifecycleFacet lifecycle = 1; + BusinessGraphFacet graph = 2; + BusinessIndexFacet index = 3; + BusinessDisplayFacet display = 4; + BusinessPermissionFacet permissions = 5; +} + +// States, transitions, approval and due date. +message BusinessLifecycleFacet { + repeated BusinessLifecycleState states = 1; + repeated BusinessLifecycleTransition transitions = 2; + BusinessLifecycleApproval approval = 3; + BusinessLifecycleDue due = 4; +} +message BusinessLifecycleState { + string state_id = 1; + string name = 2; + bool initial = 3; + bool terminal = 4; +} +message BusinessLifecycleTransition { + string transition_id = 1; + string name = 2; + repeated string from_states = 3; + string to_state = 4; + bool note_required = 5; + // Refused unless the record's current revision is approved. + bool requires_approval = 6; + // Entitlements a workspace member needs, beyond write access. + repeated string entitlements = 7; + // Kind of the record this transition creates, if any. + string creates_kind = 8; + // Event kind sent through the record notification owner, if any. + string notify = 9; +} +message BusinessLifecycleApproval { + string reviewer_entitlement = 1; + bool distinct_from_creator = 2; + string notify = 3; + // A declared state the approval also moves the record to. + string to_state = 4; +} +message BusinessLifecycleDue { + string field_id = 1; + string assignee_field_id = 2; + bool future = 3; + optional uint32 max_days_ahead = 4; +} + +// How records project into the graph. +message BusinessGraphFacet { + string thing_kind = 1; + repeated BusinessGraphRelation relations = 2; +} + +// The relation one reference field draws. +message BusinessGraphRelation { + string field_id = 1; + string relation = 2; + // The referenced record is the edge's source. + bool inbound = 3; +} + +// Fields readers filter and sort by. +message BusinessIndexFacet { + repeated string indexed_field_ids = 1; + repeated string sortable_field_ids = 2; +} + +// Navigation and list presentation. +message BusinessDisplayFacet { + string icon = 1; + string nav_section = 2; + repeated string list_field_ids = 3; +} + +// Entitlement names a member needs to read or write records. +message BusinessPermissionFacet { + string read_entitlement = 1; + string write_entitlement = 2; } message DefineBusinessObjectTypeRequest { string organization_id = 1; @@ -570,6 +661,26 @@ message UpsertBusinessObjectRequest { string unique_field_id = 6; repeated BusinessFieldValue values = 7; } +message TransitionBusinessObjectRequest { + string organization_id = 1; + string workspace_id = 2; + string idempotency_key = 3; + string type_id = 4; + string object_id = 5; + int64 expected_revision = 6; + string transition_id = 7; + // A person's reason; required when the transition declares note_required. + string note = 8; +} +message TransitionBusinessObjectResponse { + string object_id = 1; + // The record's revision after the transition. + int64 revision = 2; + // The state the record is now in. + string state = 3; + // The record the transition created, when it declares one. + string created_object_id = 4; +} message UpsertBusinessObjectResponse { BusinessObject object = 1; // True when this call created the record, false when it updated one.