@elevasis/core 0.31.0 → 0.33.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/auth/index.d.ts +60 -2
- package/dist/auth/index.js +7 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +69 -4
- package/dist/knowledge/index.d.ts +10 -2
- package/dist/organization-model/index.d.ts +15 -3
- package/dist/organization-model/index.js +69 -4
- package/dist/test-utils/index.d.ts +55 -2
- package/dist/test-utils/index.js +69 -4
- package/package.json +1 -1
- package/src/auth/__tests__/access-keys.test.ts +16 -0
- package/src/auth/__tests__/access-model.test.ts +31 -0
- package/src/auth/access-keys.ts +1 -0
- package/src/auth/multi-tenancy/permissions.ts +19 -13
- package/src/organization-model/__tests__/define-domain-record.test.ts +31 -34
- package/src/organization-model/__tests__/domains/passthrough-extensibility.test.ts +199 -0
- package/src/organization-model/domains/branding.ts +58 -16
- package/src/organization-model/domains/identity.ts +122 -94
- package/src/supabase/database.types.ts +45 -0
|
@@ -1,94 +1,122 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { DescriptionSchema, LabelSchema } from './shared'
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Business hours — simplest shape that captures weekday ranges.
|
|
6
|
+
// Each day of the week is optional; when present it holds open/close times
|
|
7
|
+
// in "HH:MM" 24-hour format. An empty object (default) means "not configured".
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
export const BusinessHoursDaySchema = z.object({
|
|
11
|
+
open: z
|
|
12
|
+
.string()
|
|
13
|
+
.trim()
|
|
14
|
+
.regex(/^\d{2}:\d{2}$/, 'Expected HH:MM format'),
|
|
15
|
+
close: z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.regex(/^\d{2}:\d{2}$/, 'Expected HH:MM format')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export const BusinessHoursSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
monday: BusinessHoursDaySchema.optional(),
|
|
24
|
+
tuesday: BusinessHoursDaySchema.optional(),
|
|
25
|
+
wednesday: BusinessHoursDaySchema.optional(),
|
|
26
|
+
thursday: BusinessHoursDaySchema.optional(),
|
|
27
|
+
friday: BusinessHoursDaySchema.optional(),
|
|
28
|
+
saturday: BusinessHoursDaySchema.optional(),
|
|
29
|
+
sunday: BusinessHoursDaySchema.optional()
|
|
30
|
+
})
|
|
31
|
+
.default({})
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Identity domain schema — legal identity, mission/vision, industry anchors,
|
|
35
|
+
// and temporal/geographic context. Distinct from branding (display identity).
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
export const IdentityDomainSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
/** Why the organization exists — one or two plain-language sentences. */
|
|
41
|
+
mission: z.string().trim().max(1000).default(''),
|
|
42
|
+
/** Long-term direction the organization is moving toward. */
|
|
43
|
+
vision: z.string().trim().max(1000).default(''),
|
|
44
|
+
/** Legal registered name of the entity. */
|
|
45
|
+
legalName: z.string().trim().max(200).default(''),
|
|
46
|
+
/**
|
|
47
|
+
* Type of legal entity (e.g. "LLC", "Corporation", "Sole Proprietor",
|
|
48
|
+
* "Non-profit"). Free-form string so it covers any jurisdiction.
|
|
49
|
+
*/
|
|
50
|
+
entityType: z.string().trim().max(100).default(''),
|
|
51
|
+
/**
|
|
52
|
+
* Primary jurisdiction of registration or operation
|
|
53
|
+
* (e.g. "United States – Delaware", "Canada – Ontario").
|
|
54
|
+
*/
|
|
55
|
+
jurisdiction: z.string().trim().max(200).default(''),
|
|
56
|
+
/**
|
|
57
|
+
* Industry category — broad classification (e.g. "Marketing Agency",
|
|
58
|
+
* "Software / SaaS", "Professional Services").
|
|
59
|
+
*/
|
|
60
|
+
industryCategory: z.string().trim().max(200).default(''),
|
|
61
|
+
/**
|
|
62
|
+
* Geographic focus — where the organization primarily operates or serves
|
|
63
|
+
* (e.g. "North America", "Global", "Southeast Asia").
|
|
64
|
+
*/
|
|
65
|
+
geographicFocus: z.string().trim().max(200).default(''),
|
|
66
|
+
/**
|
|
67
|
+
* IANA timezone identifier for the organization's primary operating timezone
|
|
68
|
+
* (e.g. "America/Los_Angeles", "Europe/London", "UTC").
|
|
69
|
+
*/
|
|
70
|
+
timeZone: z.string().trim().max(100).default('UTC'),
|
|
71
|
+
/** Typical operating hours per day of week. Empty object means not configured. */
|
|
72
|
+
businessHours: BusinessHoursSchema,
|
|
73
|
+
/**
|
|
74
|
+
* Long-form markdown capturing client context, problem narrative, and domain
|
|
75
|
+
* background. Populated by /setup; surfaced to agents as organizational context.
|
|
76
|
+
* Optional — many projects have no external client.
|
|
77
|
+
*/
|
|
78
|
+
clientBrief: z.string().trim().default(''),
|
|
79
|
+
/**
|
|
80
|
+
* Display name of the organization as shown to end users.
|
|
81
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
82
|
+
* `branding.organizationName`. Falls back to `branding.organizationName` for
|
|
83
|
+
* legacy tenants that have not yet migrated.
|
|
84
|
+
*/
|
|
85
|
+
organizationName: LabelSchema.optional(),
|
|
86
|
+
/**
|
|
87
|
+
* Display name of the primary product or platform.
|
|
88
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
89
|
+
* `branding.productName`. Falls back to `branding.productName` for legacy tenants.
|
|
90
|
+
*/
|
|
91
|
+
productName: LabelSchema.optional(),
|
|
92
|
+
/**
|
|
93
|
+
* Short abbreviated name used in space-constrained UI surfaces (max 40 chars).
|
|
94
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
95
|
+
* `branding.shortName`. Falls back to `branding.shortName` for legacy tenants.
|
|
96
|
+
*/
|
|
97
|
+
shortName: z.string().trim().min(1).max(40).optional(),
|
|
98
|
+
/**
|
|
99
|
+
* Plain-language description of the organization for display and discovery.
|
|
100
|
+
* Recommended placement for display naming — prefer this over the deprecated
|
|
101
|
+
* `branding.description`. Falls back to `branding.description` for legacy tenants.
|
|
102
|
+
*/
|
|
103
|
+
description: DescriptionSchema.optional()
|
|
104
|
+
})
|
|
105
|
+
.passthrough()
|
|
106
|
+
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// Seed — placeholder defaults; external adapters override per organization.
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
export const DEFAULT_ORGANIZATION_MODEL_IDENTITY: z.infer<typeof IdentityDomainSchema> = {
|
|
112
|
+
mission: '',
|
|
113
|
+
vision: '',
|
|
114
|
+
legalName: '',
|
|
115
|
+
entityType: '',
|
|
116
|
+
jurisdiction: '',
|
|
117
|
+
industryCategory: '',
|
|
118
|
+
geographicFocus: '',
|
|
119
|
+
timeZone: 'UTC',
|
|
120
|
+
businessHours: {},
|
|
121
|
+
clientBrief: ''
|
|
122
|
+
}
|
|
@@ -1465,6 +1465,51 @@ export type Database = {
|
|
|
1465
1465
|
},
|
|
1466
1466
|
]
|
|
1467
1467
|
}
|
|
1468
|
+
deployment_organization_models: {
|
|
1469
|
+
Row: {
|
|
1470
|
+
created_at: string
|
|
1471
|
+
deployment_id: string
|
|
1472
|
+
model_hash: string | null
|
|
1473
|
+
organization_id: string
|
|
1474
|
+
organization_model: Json
|
|
1475
|
+
schema_version: string
|
|
1476
|
+
updated_at: string
|
|
1477
|
+
}
|
|
1478
|
+
Insert: {
|
|
1479
|
+
created_at?: string
|
|
1480
|
+
deployment_id: string
|
|
1481
|
+
model_hash?: string | null
|
|
1482
|
+
organization_id: string
|
|
1483
|
+
organization_model: Json
|
|
1484
|
+
schema_version?: string
|
|
1485
|
+
updated_at?: string
|
|
1486
|
+
}
|
|
1487
|
+
Update: {
|
|
1488
|
+
created_at?: string
|
|
1489
|
+
deployment_id?: string
|
|
1490
|
+
model_hash?: string | null
|
|
1491
|
+
organization_id?: string
|
|
1492
|
+
organization_model?: Json
|
|
1493
|
+
schema_version?: string
|
|
1494
|
+
updated_at?: string
|
|
1495
|
+
}
|
|
1496
|
+
Relationships: [
|
|
1497
|
+
{
|
|
1498
|
+
foreignKeyName: "deployment_organization_models_deployment_id_fkey"
|
|
1499
|
+
columns: ["deployment_id"]
|
|
1500
|
+
isOneToOne: true
|
|
1501
|
+
referencedRelation: "deployments"
|
|
1502
|
+
referencedColumns: ["id"]
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
foreignKeyName: "deployment_organization_models_organization_id_fkey"
|
|
1506
|
+
columns: ["organization_id"]
|
|
1507
|
+
isOneToOne: false
|
|
1508
|
+
referencedRelation: "organizations"
|
|
1509
|
+
referencedColumns: ["id"]
|
|
1510
|
+
},
|
|
1511
|
+
]
|
|
1512
|
+
}
|
|
1468
1513
|
deployments: {
|
|
1469
1514
|
Row: {
|
|
1470
1515
|
created_at: string
|