@elevasis/core 0.10.0 → 0.11.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.
Files changed (58) hide show
  1. package/dist/index.d.ts +69 -159
  2. package/dist/index.js +324 -613
  3. package/dist/organization-model/index.d.ts +69 -159
  4. package/dist/organization-model/index.js +324 -613
  5. package/dist/test-utils/index.d.ts +192 -45
  6. package/dist/test-utils/index.js +260 -600
  7. package/package.json +1 -1
  8. package/src/__tests__/template-core-compatibility.test.ts +73 -91
  9. package/src/_gen/__tests__/__snapshots__/contracts.md.snap +94 -182
  10. package/src/auth/multi-tenancy/index.ts +20 -17
  11. package/src/auth/multi-tenancy/memberships/api-schemas.ts +142 -126
  12. package/src/auth/multi-tenancy/memberships/index.ts +26 -22
  13. package/src/auth/multi-tenancy/permissions.test.ts +42 -0
  14. package/src/auth/multi-tenancy/permissions.ts +104 -0
  15. package/src/organization-model/README.md +102 -97
  16. package/src/organization-model/__tests__/defaults.test.ts +19 -6
  17. package/src/organization-model/__tests__/domains/resource-mappings.test.ts +24 -93
  18. package/src/organization-model/__tests__/graph.test.ts +82 -894
  19. package/src/organization-model/__tests__/resolve.test.ts +59 -690
  20. package/src/organization-model/__tests__/schema.test.ts +83 -407
  21. package/src/organization-model/contracts.ts +4 -3
  22. package/src/organization-model/defaults.ts +277 -141
  23. package/src/organization-model/domains/features.ts +31 -22
  24. package/src/organization-model/domains/navigation.ts +27 -20
  25. package/src/organization-model/foundation.ts +42 -54
  26. package/src/organization-model/graph/build.ts +42 -217
  27. package/src/organization-model/graph/index.ts +4 -4
  28. package/src/organization-model/graph/link.ts +10 -0
  29. package/src/organization-model/graph/schema.ts +21 -16
  30. package/src/organization-model/graph/types.ts +10 -10
  31. package/src/organization-model/helpers.ts +74 -0
  32. package/src/organization-model/index.ts +7 -7
  33. package/src/organization-model/organization-graph.mdx +89 -272
  34. package/src/organization-model/organization-model.mdx +152 -320
  35. package/src/organization-model/published.ts +20 -19
  36. package/src/organization-model/resolve.ts +8 -33
  37. package/src/organization-model/schema.ts +63 -205
  38. package/src/organization-model/types.ts +12 -11
  39. package/src/platform/constants/versions.ts +3 -3
  40. package/src/platform/registry/__tests__/command-view.test.ts +6 -5
  41. package/src/platform/registry/__tests__/resource-link.test.ts +30 -0
  42. package/src/platform/registry/__tests__/resource-registry.integration.test.ts +15 -15
  43. package/src/platform/registry/command-view.ts +10 -12
  44. package/src/platform/registry/index.ts +93 -93
  45. package/src/platform/registry/resource-link.ts +32 -0
  46. package/src/platform/registry/resource-registry.ts +917 -876
  47. package/src/platform/registry/serialization.ts +56 -73
  48. package/src/platform/registry/serialized-types.ts +17 -12
  49. package/src/platform/registry/types.ts +14 -43
  50. package/src/reference/_generated/contracts.md +94 -182
  51. package/src/reference/glossary.md +71 -105
  52. package/src/scaffold-registry/__tests__/index.test.ts +125 -1
  53. package/src/scaffold-registry/__tests__/schema.test.ts +48 -20
  54. package/src/scaffold-registry/index.ts +236 -188
  55. package/src/scaffold-registry/schema.ts +47 -22
  56. package/src/supabase/database.types.ts +2880 -2719
  57. package/src/test-utils/fixtures/memberships.ts +82 -80
  58. package/src/platform/registry/domains.ts +0 -165
@@ -1,93 +1,93 @@
1
- /**
2
- * Resource Registry exports
3
- */
4
-
5
- export * from './domains'
6
-
7
- export { RESERVED_RESOURCE_IDS, SYSTEM_RESOURCE_IDS, isReservedResourceId } from './reserved'
8
-
9
- export { ResourceRegistry } from './resource-registry'
10
- export type { DeploymentSpec, OrganizationRegistry, RemoteOrgConfig } from './resource-registry'
11
-
12
- // Validation utilities
13
- export {
14
- validateDeploymentSpec,
15
- validateRelationships,
16
- validateExecutionInterface,
17
- RegistryValidationError
18
- } from './validation'
19
-
20
- // Serialization utilities
21
- export { serializeAllOrganizations, serializeOrganization, buildEdges } from './serialization'
22
-
23
- // Types
24
- export type {
25
- ResourceStatus,
26
- ResourceType,
27
- ExecutableResourceType,
28
- ResourceDefinition,
29
- ResourceList,
30
- TriggerDefinition,
31
- IntegrationDefinition,
32
- RelationshipDeclaration,
33
- ResourceRelationships,
34
- ExternalPlatform,
35
- ExternalResourceDefinition,
36
- HumanCheckpointDefinition,
37
- DomainDefinition,
38
- WebhookProviderType,
39
- WebhookTriggerConfig,
40
- ScheduleTriggerConfig,
41
- EventTriggerConfig,
42
- TriggerConfig
43
- } from './types'
44
-
45
- // Serialized Types (for API responses)
46
- export type {
47
- SerializedAgentDefinition,
48
- SerializedWorkflowDefinition,
49
- SerializedExecutionInterface,
50
- SerializedExecutionFormSchema,
51
- SerializedFormField,
52
- SerializedFormSchema,
53
- SerializedOrganizationData
54
- } from './serialized-types'
55
-
56
- // Command View Types (for graph visualization)
57
- export type {
58
- CommandViewAgent,
59
- CommandViewWorkflow,
60
- CommandViewNode,
61
- CommandViewNodeType,
62
- CommandViewEdge,
63
- CommandViewData,
64
- RelationshipType
65
- } from './command-view'
66
-
67
- // Command View Utilities
68
- export {
69
- isAgent,
70
- isWorkflow,
71
- isTrigger,
72
- isIntegration,
73
- isExternalResource,
74
- isHumanCheckpoint,
75
- getNodeId,
76
- getNodeType
77
- } from './command-view'
78
-
79
- // Command View Stats types (moved from command-view/)
80
- export type {
81
- StatsTimeRange,
82
- ResourceStats,
83
- ResourceErrorsResponse,
84
- ErrorSummary,
85
- CommandViewExecution,
86
- ResourceExecutionsResponse,
87
- HumanCheckpointStats,
88
- CommandViewStatsResponse
89
- } from './stats-types'
90
-
91
- // Resource Metadata (icon names, colors)
92
- export type { ResourceDefinitionType, NodeColorType } from './resource-metadata'
93
- export { resourceTypeIconNames, resourceTypeColors, getResourceIconName, getResourceColor } from './resource-metadata'
1
+ /**
2
+ * Resource Registry exports
3
+ */
4
+
5
+ export { ResourceCategorySchema, ResourceLinkSchema, kindPrefix, validateNodeId } from './resource-link'
6
+ export type { ResourceCategory, ResourceLink } from './resource-link'
7
+
8
+ export { RESERVED_RESOURCE_IDS, SYSTEM_RESOURCE_IDS, isReservedResourceId } from './reserved'
9
+
10
+ export { ResourceRegistry } from './resource-registry'
11
+ export type { DeploymentSpec, OrganizationRegistry, RemoteOrgConfig, SystemConfig } from './resource-registry'
12
+
13
+ // Validation utilities
14
+ export {
15
+ validateDeploymentSpec,
16
+ validateRelationships,
17
+ validateExecutionInterface,
18
+ RegistryValidationError
19
+ } from './validation'
20
+
21
+ // Serialization utilities
22
+ export { serializeAllOrganizations, serializeOrganization, buildEdges } from './serialization'
23
+
24
+ // Types
25
+ export type {
26
+ ResourceStatus,
27
+ ResourceType,
28
+ ExecutableResourceType,
29
+ ResourceDefinition,
30
+ ResourceList,
31
+ TriggerDefinition,
32
+ IntegrationDefinition,
33
+ RelationshipDeclaration,
34
+ ResourceRelationships,
35
+ ExternalPlatform,
36
+ ExternalResourceDefinition,
37
+ HumanCheckpointDefinition,
38
+ WebhookProviderType,
39
+ WebhookTriggerConfig,
40
+ ScheduleTriggerConfig,
41
+ EventTriggerConfig,
42
+ TriggerConfig
43
+ } from './types'
44
+
45
+ // Serialized Types (for API responses)
46
+ export type {
47
+ SerializedAgentDefinition,
48
+ SerializedWorkflowDefinition,
49
+ SerializedExecutionInterface,
50
+ SerializedExecutionFormSchema,
51
+ SerializedFormField,
52
+ SerializedFormSchema,
53
+ SerializedOrganizationData
54
+ } from './serialized-types'
55
+
56
+ // Command View Types (for graph visualization)
57
+ export type {
58
+ CommandViewAgent,
59
+ CommandViewWorkflow,
60
+ CommandViewNode,
61
+ CommandViewNodeType,
62
+ CommandViewEdge,
63
+ CommandViewData,
64
+ RelationshipType
65
+ } from './command-view'
66
+
67
+ // Command View Utilities
68
+ export {
69
+ isAgent,
70
+ isWorkflow,
71
+ isTrigger,
72
+ isIntegration,
73
+ isExternalResource,
74
+ isHumanCheckpoint,
75
+ getNodeId,
76
+ getNodeType
77
+ } from './command-view'
78
+
79
+ // Command View Stats types (moved from command-view/)
80
+ export type {
81
+ StatsTimeRange,
82
+ ResourceStats,
83
+ ResourceErrorsResponse,
84
+ ErrorSummary,
85
+ CommandViewExecution,
86
+ ResourceExecutionsResponse,
87
+ HumanCheckpointStats,
88
+ CommandViewStatsResponse
89
+ } from './stats-types'
90
+
91
+ // Resource Metadata (icon names, colors)
92
+ export type { ResourceDefinitionType, NodeColorType } from './resource-metadata'
93
+ export { resourceTypeIconNames, resourceTypeColors, getResourceIconName, getResourceColor } from './resource-metadata'
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod'
2
+ import { LinkSchema } from '../../organization-model/graph/link'
3
+ import type { OrganizationGraph } from '../../organization-model/graph/types'
4
+ import type { Link } from '../../organization-model/graph/link'
5
+
6
+ export const ResourceCategorySchema = z.enum(['production', 'diagnostic', 'internal', 'testing'])
7
+
8
+ export type ResourceCategory = z.infer<typeof ResourceCategorySchema>
9
+ export type ResourceLink = Link
10
+
11
+ export const ResourceLinkSchema = LinkSchema
12
+
13
+ export function kindPrefix(kind: string, sourceId: string): string {
14
+ return `${kind}:${sourceId}`
15
+ }
16
+
17
+ export function validateNodeId(nodeId: string, graph: OrganizationGraph): void {
18
+ if (graph.nodes.some((node) => node.id === nodeId)) {
19
+ return
20
+ }
21
+
22
+ const known = graph.nodes
23
+ .map((node) => node.id)
24
+ .filter((id) => id.includes(nodeId.split(':')[0] ?? ''))
25
+ .slice(0, 5)
26
+
27
+ throw new Error(
28
+ known.length > 0
29
+ ? `Unknown organization graph node "${nodeId}". Nearby known nodes: ${known.join(', ')}`
30
+ : `Unknown organization graph node "${nodeId}".`
31
+ )
32
+ }