@elevasis/core 0.12.0 → 0.13.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/test-utils/index.d.ts +17 -12
- package/dist/test-utils/index.js +19 -0
- package/package.json +1 -1
- package/src/auth/multi-tenancy/credentials/__tests__/encryption.test.ts +217 -216
- package/src/auth/multi-tenancy/credentials/server/encryption.ts +5 -19
- package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +3 -13
- package/src/auth/multi-tenancy/permissions.ts +12 -5
- package/src/business/acquisition/activity-events.ts +142 -0
- package/src/business/acquisition/api-schemas.ts +694 -689
- package/src/business/acquisition/derive-actions.ts +90 -0
- package/src/business/acquisition/index.ts +111 -109
- package/src/execution/engine/index.ts +434 -434
- package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +1 -2
- package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +0 -1
- package/src/execution/engine/tools/lead-service-types.ts +882 -879
- package/src/execution/engine/tools/registry.ts +699 -700
- package/src/execution/engine/tools/tool-maps.ts +777 -780
- package/src/organization-model/organization-graph.mdx +2 -2
- package/src/platform/constants/versions.ts +1 -1
- package/src/scaffold-registry/index.ts +10 -9
- package/src/scaffold-registry/schema.ts +68 -62
- package/src/supabase/database.types.ts +9 -7
- package/src/test-utils/rls/RLSTestContext.ts +585 -553
|
@@ -25,10 +25,10 @@ Node kinds:
|
|
|
25
25
|
|
|
26
26
|
- `organization`
|
|
27
27
|
- `feature`
|
|
28
|
+
- `surface`
|
|
28
29
|
- `entity`
|
|
29
30
|
- `capability`
|
|
30
31
|
- `resource`
|
|
31
|
-
- `integration`
|
|
32
32
|
|
|
33
33
|
Edge kinds:
|
|
34
34
|
|
|
@@ -62,7 +62,7 @@ interface BuildOrganizationGraphInput {
|
|
|
62
62
|
`buildOrganizationGraph`:
|
|
63
63
|
|
|
64
64
|
1. Reads flat Organization Model features and derives `feature:*` nodes.
|
|
65
|
-
2. Reads
|
|
65
|
+
2. Reads Command View resources, including integration resources, as `resource` nodes with `resourceType` metadata.
|
|
66
66
|
3. Emits authored graph links from resource/entity/capability metadata.
|
|
67
67
|
4. Bridges Command View runtime topology into resource nodes and relationship edges.
|
|
68
68
|
5. Returns a renderer-agnostic DTO.
|
|
@@ -142,9 +142,7 @@ export function compileScaffoldRegistry(): ScaffoldRegistry {
|
|
|
142
142
|
|
|
143
143
|
const emptySources = findEmptySourcePatterns(registry, root)
|
|
144
144
|
if (emptySources.length > 0) {
|
|
145
|
-
const formatted = emptySources
|
|
146
|
-
.map((source) => ` [${source.entryId}] ${source.pattern}`)
|
|
147
|
-
.join('\n')
|
|
145
|
+
const formatted = emptySources.map((source) => ` [${source.entryId}] ${source.pattern}`).join('\n')
|
|
148
146
|
throw new Error(
|
|
149
147
|
`scaffold-registry: ${emptySources.length} source pattern(s) match no files or directories:\n${formatted}\n` +
|
|
150
148
|
`Fix the stale source glob, create the scaffold surface, or add explicit registry support for intentional empty patterns.`
|
|
@@ -235,14 +233,17 @@ export function loadScaffoldRegistryFast(): ScaffoldRegistry {
|
|
|
235
233
|
|
|
236
234
|
/**
|
|
237
235
|
* Return all entries whose `sources` contain at least one pattern that matches
|
|
238
|
-
* the given file path
|
|
239
|
-
*
|
|
240
|
-
* is implemented.
|
|
236
|
+
* the given file path AND whose `excludes` contain no pattern that matches.
|
|
237
|
+
* Pattern matching is a simple substring/glob-prefix check suitable for hook
|
|
238
|
+
* use; Step 3 will upgrade to full micromatch when the hook is implemented.
|
|
241
239
|
*/
|
|
242
240
|
export function findMatchingEntries(registry: ScaffoldRegistry, filePath: string): ScaffoldRegistryEntry[] {
|
|
243
|
-
return registry.entries.filter((entry) =>
|
|
244
|
-
entry.sources.some((pattern) => scaffoldPathMatchesPattern(filePath, pattern))
|
|
245
|
-
|
|
241
|
+
return registry.entries.filter((entry) => {
|
|
242
|
+
const sourceMatch = entry.sources.some((pattern) => scaffoldPathMatchesPattern(filePath, pattern))
|
|
243
|
+
if (!sourceMatch) return false
|
|
244
|
+
const excluded = (entry.excludes ?? []).some((pattern) => scaffoldPathMatchesPattern(filePath, pattern))
|
|
245
|
+
return !excluded
|
|
246
|
+
})
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
// ---------------------------------------------------------------------------
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
// Kind taxonomy
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The kind of scaffold entry:
|
|
9
|
-
*
|
|
10
|
-
* - autogen: fully derivable from source; regen command is the fix
|
|
11
|
-
* - manual-scaffold: hand-authored structure that must be updated on source change
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Kind taxonomy
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The kind of scaffold entry:
|
|
9
|
+
*
|
|
10
|
+
* - autogen: fully derivable from source; regen command is the fix
|
|
11
|
+
* - manual-scaffold: hand-authored structure that must be updated on source change
|
|
12
12
|
* - sync-preservation: external-template files with a declared sync tier
|
|
13
13
|
* - validator: drift-detection scripts or CI checks (meta.json pages[] validators, etc.)
|
|
14
14
|
* - other: escape hatch; requires free-form notes
|
|
15
15
|
*/
|
|
16
|
-
export const ScaffoldEntryKindSchema = z.enum([
|
|
17
|
-
'autogen',
|
|
18
|
-
'manual-scaffold',
|
|
19
|
-
'sync-preservation',
|
|
20
|
-
'validator',
|
|
21
|
-
'other'
|
|
22
|
-
])
|
|
16
|
+
export const ScaffoldEntryKindSchema = z.enum(['autogen', 'manual-scaffold', 'sync-preservation', 'validator', 'other'])
|
|
23
17
|
|
|
24
18
|
export type ScaffoldEntryKind = z.infer<typeof ScaffoldEntryKindSchema>
|
|
25
19
|
|
|
@@ -55,35 +49,35 @@ export type ExternalSyncStrategy = z.infer<typeof ExternalSyncStrategySchema>
|
|
|
55
49
|
export const ExternalSyncDeletePolicySchema = z.enum(['none', 'manifest-only'])
|
|
56
50
|
|
|
57
51
|
export type ExternalSyncDeletePolicy = z.infer<typeof ExternalSyncDeletePolicySchema>
|
|
58
|
-
|
|
59
|
-
// ---------------------------------------------------------------------------
|
|
60
|
-
// Scaffold reference (a single downstream artifact that needs attention)
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
|
|
63
|
-
export const ScaffoldRefSchema = z.object({
|
|
64
|
-
/**
|
|
65
|
-
* File path, glob, or symbolic target (e.g. "docs: sync-preservation-matrix").
|
|
66
|
-
* Symbolic targets begin with "docs:" or "autogen-target:".
|
|
67
|
-
*/
|
|
68
|
-
path: z.string().min(1),
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Command to regenerate, or "manual" if human judgment is required.
|
|
72
|
-
*/
|
|
73
|
-
regen: z.string().min(1).optional(),
|
|
74
|
-
|
|
52
|
+
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Scaffold reference (a single downstream artifact that needs attention)
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
export const ScaffoldRefSchema = z.object({
|
|
58
|
+
/**
|
|
59
|
+
* File path, glob, or symbolic target (e.g. "docs: sync-preservation-matrix").
|
|
60
|
+
* Symbolic targets begin with "docs:" or "autogen-target:".
|
|
61
|
+
*/
|
|
62
|
+
path: z.string().min(1),
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Command to regenerate, or "manual" if human judgment is required.
|
|
66
|
+
*/
|
|
67
|
+
regen: z.string().min(1).optional(),
|
|
68
|
+
|
|
75
69
|
/**
|
|
76
70
|
* Human-readable hint shown in reminder messages.
|
|
77
71
|
*/
|
|
78
|
-
hint: z.string().optional()
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
export type ScaffoldRef = z.infer<typeof ScaffoldRefSchema>
|
|
82
|
-
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
// Registry entry
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
|
|
72
|
+
hint: z.string().optional()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
export type ScaffoldRef = z.infer<typeof ScaffoldRefSchema>
|
|
76
|
+
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Registry entry
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
|
|
87
81
|
export const ScaffoldRegistryEntrySchema = z
|
|
88
82
|
.object({
|
|
89
83
|
/**
|
|
@@ -106,6 +100,18 @@ export const ScaffoldRegistryEntrySchema = z
|
|
|
106
100
|
*/
|
|
107
101
|
sources: z.array(z.string().min(1)).min(1, 'At least one source pattern is required'),
|
|
108
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Optional glob patterns that suppress this entry's reminder when the
|
|
105
|
+
* touched file matches. Applied after `sources`: a path that matches any
|
|
106
|
+
* `sources` pattern AND any `excludes` pattern is treated as no-match.
|
|
107
|
+
*
|
|
108
|
+
* Use case: a broad source glob (e.g. `apps/docs/content/docs/**\/*.mdx`)
|
|
109
|
+
* that should not fire on a sub-tree where the dependent scaffold does not
|
|
110
|
+
* apply (e.g. `apps/docs/content/docs/in-progress/**`, where MDX docs do
|
|
111
|
+
* not take meta.json files).
|
|
112
|
+
*/
|
|
113
|
+
excludes: z.array(z.string().min(1)).optional(),
|
|
114
|
+
|
|
109
115
|
/**
|
|
110
116
|
* Downstream artifacts that need attention when a source changes.
|
|
111
117
|
*/
|
|
@@ -217,21 +223,21 @@ export const ScaffoldRegistryEntrySchema = z
|
|
|
217
223
|
}
|
|
218
224
|
}
|
|
219
225
|
})
|
|
220
|
-
|
|
221
|
-
export type ScaffoldRegistryEntry = z.infer<typeof ScaffoldRegistryEntrySchema>
|
|
222
|
-
|
|
223
|
-
// ---------------------------------------------------------------------------
|
|
224
|
-
// Top-level registry document
|
|
225
|
-
// ---------------------------------------------------------------------------
|
|
226
|
-
|
|
227
|
-
export const ScaffoldRegistrySchema = z.object({
|
|
228
|
-
/**
|
|
229
|
-
* Schema version for forward-compatibility detection.
|
|
230
|
-
* Bump when the shape changes in a breaking way.
|
|
231
|
-
*/
|
|
232
|
-
version: z.string().default('1'),
|
|
233
|
-
|
|
234
|
-
entries: z.array(ScaffoldRegistryEntrySchema).min(1)
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
export type ScaffoldRegistry = z.infer<typeof ScaffoldRegistrySchema>
|
|
226
|
+
|
|
227
|
+
export type ScaffoldRegistryEntry = z.infer<typeof ScaffoldRegistryEntrySchema>
|
|
228
|
+
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
// Top-level registry document
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
|
|
233
|
+
export const ScaffoldRegistrySchema = z.object({
|
|
234
|
+
/**
|
|
235
|
+
* Schema version for forward-compatibility detection.
|
|
236
|
+
* Bump when the shape changes in a breaking way.
|
|
237
|
+
*/
|
|
238
|
+
version: z.string().default('1'),
|
|
239
|
+
|
|
240
|
+
entries: z.array(ScaffoldRegistryEntrySchema).min(1)
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
export type ScaffoldRegistry = z.infer<typeof ScaffoldRegistrySchema>
|
|
@@ -414,7 +414,6 @@ export type Database = {
|
|
|
414
414
|
acq_deals: {
|
|
415
415
|
Row: {
|
|
416
416
|
activity_log: Json
|
|
417
|
-
cached_stage: string | null
|
|
418
417
|
closed_lost_at: string | null
|
|
419
418
|
closed_lost_reason: string | null
|
|
420
419
|
contact_email: string
|
|
@@ -429,6 +428,7 @@ export type Database = {
|
|
|
429
428
|
organization_id: string
|
|
430
429
|
payment_link_sent_at: string | null
|
|
431
430
|
payment_received_at: string | null
|
|
431
|
+
pipeline_key: string
|
|
432
432
|
proposal_data: Json | null
|
|
433
433
|
proposal_generated_at: string | null
|
|
434
434
|
proposal_pdf_url: string | null
|
|
@@ -436,10 +436,11 @@ export type Database = {
|
|
|
436
436
|
proposal_reviewed_by: string | null
|
|
437
437
|
proposal_sent_at: string | null
|
|
438
438
|
proposal_signed_at: string | null
|
|
439
|
-
proposal_status: string | null
|
|
440
439
|
signature_envelope_id: string | null
|
|
441
440
|
source_list_id: string | null
|
|
442
441
|
source_type: string | null
|
|
442
|
+
stage_key: string | null
|
|
443
|
+
state_key: string | null
|
|
443
444
|
stripe_payment_id: string | null
|
|
444
445
|
stripe_payment_link: string | null
|
|
445
446
|
stripe_payment_link_id: string | null
|
|
@@ -448,7 +449,6 @@ export type Database = {
|
|
|
448
449
|
}
|
|
449
450
|
Insert: {
|
|
450
451
|
activity_log?: Json
|
|
451
|
-
cached_stage?: string | null
|
|
452
452
|
closed_lost_at?: string | null
|
|
453
453
|
closed_lost_reason?: string | null
|
|
454
454
|
contact_email: string
|
|
@@ -463,6 +463,7 @@ export type Database = {
|
|
|
463
463
|
organization_id: string
|
|
464
464
|
payment_link_sent_at?: string | null
|
|
465
465
|
payment_received_at?: string | null
|
|
466
|
+
pipeline_key?: string
|
|
466
467
|
proposal_data?: Json | null
|
|
467
468
|
proposal_generated_at?: string | null
|
|
468
469
|
proposal_pdf_url?: string | null
|
|
@@ -470,10 +471,11 @@ export type Database = {
|
|
|
470
471
|
proposal_reviewed_by?: string | null
|
|
471
472
|
proposal_sent_at?: string | null
|
|
472
473
|
proposal_signed_at?: string | null
|
|
473
|
-
proposal_status?: string | null
|
|
474
474
|
signature_envelope_id?: string | null
|
|
475
475
|
source_list_id?: string | null
|
|
476
476
|
source_type?: string | null
|
|
477
|
+
stage_key?: string | null
|
|
478
|
+
state_key?: string | null
|
|
477
479
|
stripe_payment_id?: string | null
|
|
478
480
|
stripe_payment_link?: string | null
|
|
479
481
|
stripe_payment_link_id?: string | null
|
|
@@ -482,7 +484,6 @@ export type Database = {
|
|
|
482
484
|
}
|
|
483
485
|
Update: {
|
|
484
486
|
activity_log?: Json
|
|
485
|
-
cached_stage?: string | null
|
|
486
487
|
closed_lost_at?: string | null
|
|
487
488
|
closed_lost_reason?: string | null
|
|
488
489
|
contact_email?: string
|
|
@@ -497,6 +498,7 @@ export type Database = {
|
|
|
497
498
|
organization_id?: string
|
|
498
499
|
payment_link_sent_at?: string | null
|
|
499
500
|
payment_received_at?: string | null
|
|
501
|
+
pipeline_key?: string
|
|
500
502
|
proposal_data?: Json | null
|
|
501
503
|
proposal_generated_at?: string | null
|
|
502
504
|
proposal_pdf_url?: string | null
|
|
@@ -504,10 +506,11 @@ export type Database = {
|
|
|
504
506
|
proposal_reviewed_by?: string | null
|
|
505
507
|
proposal_sent_at?: string | null
|
|
506
508
|
proposal_signed_at?: string | null
|
|
507
|
-
proposal_status?: string | null
|
|
508
509
|
signature_envelope_id?: string | null
|
|
509
510
|
source_list_id?: string | null
|
|
510
511
|
source_type?: string | null
|
|
512
|
+
stage_key?: string | null
|
|
513
|
+
state_key?: string | null
|
|
511
514
|
stripe_payment_id?: string | null
|
|
512
515
|
stripe_payment_link?: string | null
|
|
513
516
|
stripe_payment_link_id?: string | null
|
|
@@ -2713,7 +2716,6 @@ export type Database = {
|
|
|
2713
2716
|
Args: { org_id: string; perm_key: string }
|
|
2714
2717
|
Returns: boolean
|
|
2715
2718
|
}
|
|
2716
|
-
is_org_admin: { Args: { org_id: string }; Returns: boolean }
|
|
2717
2719
|
is_org_member: { Args: { org_id: string }; Returns: boolean }
|
|
2718
2720
|
link_workos_membership_on_accept: {
|
|
2719
2721
|
Args: {
|