@elevasis/core 0.15.0 → 0.16.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/dist/index.d.ts +1718 -19
- package/dist/index.js +369 -25
- package/dist/organization-model/index.d.ts +1718 -19
- package/dist/organization-model/index.js +369 -25
- package/dist/test-utils/index.d.ts +1108 -371
- package/dist/test-utils/index.js +357 -17
- package/package.json +5 -1
- package/src/__tests__/publish.test.ts +14 -13
- package/src/__tests__/template-core-compatibility.test.ts +4 -4
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1109 -882
- package/src/auth/multi-tenancy/index.ts +3 -0
- package/src/auth/multi-tenancy/theme-presets.ts +45 -0
- package/src/auth/multi-tenancy/types.ts +57 -83
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -194
- package/src/business/acquisition/activity-events.ts +13 -4
- package/src/business/acquisition/api-schemas.test.ts +315 -4
- package/src/business/acquisition/api-schemas.ts +122 -8
- package/src/business/acquisition/build-templates.ts +44 -0
- package/src/business/acquisition/crm-next-action.test.ts +262 -0
- package/src/business/acquisition/crm-next-action.ts +220 -0
- package/src/business/acquisition/crm-priority.test.ts +216 -0
- package/src/business/acquisition/crm-priority.ts +349 -0
- package/src/business/acquisition/crm-state-actions.test.ts +151 -160
- package/src/business/acquisition/deal-ownership.test.ts +351 -0
- package/src/business/acquisition/deal-ownership.ts +120 -0
- package/src/business/acquisition/derive-actions.test.ts +101 -37
- package/src/business/acquisition/derive-actions.ts +102 -87
- package/src/business/acquisition/index.ts +10 -0
- package/src/business/acquisition/types.ts +400 -366
- package/src/business/crm/api-schemas.ts +40 -0
- package/src/business/crm/index.ts +1 -0
- package/src/business/deals/api-schemas.ts +79 -0
- package/src/business/deals/index.ts +1 -0
- package/src/business/projects/types.ts +124 -88
- package/src/execution/core/runner-types.ts +61 -80
- package/src/execution/engine/index.ts +4 -3
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -104
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1473
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -102
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -179
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -309
- package/src/execution/engine/tools/integration/tool.ts +255 -253
- package/src/execution/engine/tools/lead-service-types.ts +939 -924
- package/src/execution/engine/tools/messages.ts +43 -0
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
- package/src/execution/engine/tools/platform/acquisition/types.ts +5 -2
- package/src/execution/engine/tools/platform/email/types.ts +97 -96
- package/src/execution/engine/tools/registry.ts +4 -3
- package/src/execution/engine/tools/tool-maps.ts +3 -1
- package/src/execution/engine/tools/types.ts +234 -233
- package/src/execution/engine/workflow/types.ts +195 -193
- package/src/execution/external/api-schemas.ts +40 -0
- package/src/execution/external/index.ts +1 -0
- package/src/knowledge/README.md +32 -0
- package/src/knowledge/__tests__/queries.test.ts +504 -0
- package/src/knowledge/format.ts +99 -0
- package/src/knowledge/index.ts +5 -0
- package/src/knowledge/queries.ts +256 -0
- package/src/organization-model/__tests__/defaults.test.ts +172 -172
- package/src/organization-model/__tests__/foundation.test.ts +7 -7
- package/src/organization-model/__tests__/icons.test.ts +27 -0
- package/src/organization-model/__tests__/knowledge.test.ts +214 -0
- package/src/organization-model/contracts.ts +17 -15
- package/src/organization-model/defaults.ts +74 -19
- package/src/organization-model/domains/knowledge.ts +53 -0
- package/src/organization-model/domains/navigation.ts +416 -399
- package/src/organization-model/domains/prospecting.ts +204 -1
- package/src/organization-model/domains/sales.test.ts +29 -0
- package/src/organization-model/domains/sales.ts +102 -0
- package/src/organization-model/domains/shared.ts +6 -5
- package/src/organization-model/foundation.ts +10 -6
- package/src/organization-model/graph/build.ts +209 -182
- package/src/organization-model/graph/schema.ts +37 -34
- package/src/organization-model/graph/types.ts +47 -31
- package/src/organization-model/icons.ts +81 -0
- package/src/organization-model/index.ts +8 -3
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +103 -86
- package/src/organization-model/schema.ts +90 -85
- package/src/organization-model/types.ts +42 -35
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/index.ts +23 -27
- package/src/platform/registry/index.ts +0 -4
- package/src/platform/registry/resource-registry.ts +0 -77
- package/src/platform/registry/serialized-types.ts +148 -219
- package/src/platform/registry/stats-types.ts +60 -60
- package/src/reference/_generated/contracts.md +829 -595
- package/src/supabase/database.types.ts +2978 -2958
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
1
|
+
import { z } from 'zod'
|
|
2
2
|
import {
|
|
3
3
|
CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
|
|
4
4
|
CRM_DISCOVERY_LINK_SENT_STATE,
|
|
5
5
|
CRM_DISCOVERY_NUDGING_STATE,
|
|
6
6
|
CRM_DISCOVERY_REPLIED_STATE
|
|
7
7
|
} from '@repo/core/organization-model'
|
|
8
|
+
import { getDealOwnership, type DealOwnership } from './deal-ownership'
|
|
8
9
|
import type { AcqDealRow } from './types'
|
|
9
|
-
|
|
10
|
-
export interface Action {
|
|
11
|
-
key: string
|
|
12
|
-
label: string
|
|
13
|
-
payloadSchema?: z.ZodTypeAny
|
|
14
|
-
}
|
|
15
|
-
|
|
10
|
+
|
|
11
|
+
export interface Action {
|
|
12
|
+
key: string
|
|
13
|
+
label: string
|
|
14
|
+
payloadSchema?: z.ZodTypeAny
|
|
15
|
+
}
|
|
16
|
+
|
|
16
17
|
export interface ActionDef {
|
|
17
18
|
key: string
|
|
18
19
|
label: string
|
|
@@ -21,93 +22,107 @@ export interface ActionDef {
|
|
|
21
22
|
payloadSchema?: z.ZodTypeAny
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
25
|
+
type DealActionInput = AcqDealRow & {
|
|
26
|
+
ownership?: DealOwnership
|
|
27
|
+
nextAction?: string | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const SendReplyActionPayloadSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
replyBody: z.string().trim().min(1).max(10000)
|
|
33
|
+
})
|
|
34
|
+
.strict()
|
|
35
|
+
|
|
36
|
+
export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
37
|
+
{
|
|
38
|
+
key: 'move_to_proposal',
|
|
39
|
+
label: 'Move to Proposal',
|
|
40
|
+
isAvailableFor: (deal) => deal.stage_key === 'interested',
|
|
41
|
+
workflowId: 'move_to_proposal-workflow'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: 'move_to_closing',
|
|
45
|
+
label: 'Move to Closing',
|
|
46
|
+
isAvailableFor: (deal) => deal.stage_key === 'proposal',
|
|
47
|
+
workflowId: 'move_to_closing-workflow'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'move_to_closed_won',
|
|
51
|
+
label: 'Close Won',
|
|
52
|
+
isAvailableFor: (deal) => deal.stage_key === 'closing',
|
|
53
|
+
workflowId: 'move_to_closed_won-workflow'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'move_to_closed_lost',
|
|
57
|
+
label: 'Close Lost',
|
|
58
|
+
isAvailableFor: (deal) =>
|
|
59
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
|
|
60
|
+
workflowId: 'move_to_closed_lost-workflow'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'move_to_nurturing',
|
|
64
|
+
label: 'Move to Nurturing',
|
|
65
|
+
isAvailableFor: (deal) =>
|
|
66
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
|
|
67
|
+
workflowId: 'move_to_nurturing-workflow'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
64
70
|
key: 'send_reply',
|
|
65
71
|
label: 'Send Reply',
|
|
66
72
|
isAvailableFor: (deal) =>
|
|
67
73
|
deal.stage_key === 'interested' &&
|
|
74
|
+
isOurReplyAction(deal) &&
|
|
68
75
|
(deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
|
|
69
76
|
deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
70
77
|
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
71
|
-
workflowId: 'crm-send-reply-workflow',
|
|
72
|
-
payloadSchema: SendReplyActionPayloadSchema
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 'send_link',
|
|
76
|
-
label: 'Send Booking Link',
|
|
77
|
-
isAvailableFor: (deal) =>
|
|
78
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
79
|
-
workflowId: 'crm-send-booking-link-workflow'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
key: 'send_nudge',
|
|
83
|
-
label: 'Send Nudge',
|
|
84
|
-
isAvailableFor: (deal) =>
|
|
85
|
-
deal.stage_key === 'interested' &&
|
|
86
|
-
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
87
|
-
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
88
|
-
workflowId: 'crm-send-nudge-workflow'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: 'mark_no_show',
|
|
92
|
-
label: 'Mark No-Show',
|
|
93
|
-
isAvailableFor: (deal) =>
|
|
94
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
95
|
-
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
96
|
-
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
97
|
-
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
98
|
-
workflowId: 'mark_no_show-workflow'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
key: 'rebook',
|
|
102
|
-
label: 'Rebook',
|
|
103
|
-
isAvailableFor: (deal) =>
|
|
104
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
105
|
-
workflowId: 'crm-rebook-workflow'
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
|
|
109
|
-
export function deriveActions(deal:
|
|
78
|
+
workflowId: 'crm-send-reply-workflow',
|
|
79
|
+
payloadSchema: SendReplyActionPayloadSchema
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: 'send_link',
|
|
83
|
+
label: 'Send Booking Link',
|
|
84
|
+
isAvailableFor: (deal) =>
|
|
85
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
86
|
+
workflowId: 'crm-send-booking-link-workflow'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'send_nudge',
|
|
90
|
+
label: 'Send Nudge',
|
|
91
|
+
isAvailableFor: (deal) =>
|
|
92
|
+
deal.stage_key === 'interested' &&
|
|
93
|
+
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
94
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
95
|
+
workflowId: 'crm-send-nudge-workflow'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: 'mark_no_show',
|
|
99
|
+
label: 'Mark No-Show',
|
|
100
|
+
isAvailableFor: (deal) =>
|
|
101
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
102
|
+
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
103
|
+
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
104
|
+
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
105
|
+
workflowId: 'mark_no_show-workflow'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'rebook',
|
|
109
|
+
label: 'Rebook',
|
|
110
|
+
isAvailableFor: (deal) =>
|
|
111
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
112
|
+
workflowId: 'crm-rebook-workflow'
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
export function deriveActions(deal: DealActionInput, actions: ActionDef[] = DEFAULT_CRM_ACTIONS): Action[] {
|
|
110
117
|
return actions
|
|
111
118
|
.filter((a) => a.isAvailableFor(deal))
|
|
112
119
|
.map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }))
|
|
113
120
|
}
|
|
121
|
+
|
|
122
|
+
function isOurReplyAction(deal: DealActionInput): boolean {
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(deal, 'nextAction')) {
|
|
124
|
+
return deal.nextAction === 'send_reply'
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (deal.ownership ?? getDealOwnership(deal)) === 'us'
|
|
128
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from './types'
|
|
2
2
|
export * from './activity-events'
|
|
3
|
+
export * from './build-templates'
|
|
3
4
|
export * from './derive-actions'
|
|
5
|
+
export * from './crm-priority'
|
|
6
|
+
export * from './crm-next-action'
|
|
7
|
+
export * from './deal-ownership'
|
|
4
8
|
export * from './stateful'
|
|
5
9
|
// Export api-schemas selectively to avoid re-exporting names already defined in types.ts
|
|
6
10
|
// (DealStage, AcqDealTaskKind are declared as union types there; api-schemas re-infers them from Zod)
|
|
@@ -35,6 +39,7 @@ export {
|
|
|
35
39
|
ExecuteActionParamsSchema,
|
|
36
40
|
ExecuteActionRequestSchema,
|
|
37
41
|
DealContactSummarySchema,
|
|
42
|
+
DealPrioritySchema,
|
|
38
43
|
DealListItemSchema,
|
|
39
44
|
DealListResponseSchema,
|
|
40
45
|
DealDetailResponseSchema,
|
|
@@ -48,6 +53,10 @@ export {
|
|
|
48
53
|
IcpRubricSchema,
|
|
49
54
|
PipelineStageSchema,
|
|
50
55
|
PipelineConfigSchema,
|
|
56
|
+
BuildPlanSnapshotStepSchema,
|
|
57
|
+
BuildPlanSnapshotSchema,
|
|
58
|
+
AcqListMetadataSchema,
|
|
59
|
+
ProspectingBuildTemplateIdSchema,
|
|
51
60
|
ProcessingStageStatusSchema,
|
|
52
61
|
ListStageCountsSchema,
|
|
53
62
|
ListTelemetrySchema,
|
|
@@ -119,6 +128,7 @@ export {
|
|
|
119
128
|
type TransitionDealStateRequest,
|
|
120
129
|
type ExecuteActionParams,
|
|
121
130
|
type ExecuteActionRequest,
|
|
131
|
+
type DealPriorityResponse,
|
|
122
132
|
type DealListResponse,
|
|
123
133
|
type DealDetailResponse,
|
|
124
134
|
type DealNoteResponse,
|