@elevasis/core 0.25.0 → 0.27.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 +171 -90
- package/dist/index.js +377 -1541
- package/dist/knowledge/index.d.ts +48 -59
- package/dist/knowledge/index.js +1 -1
- package/dist/organization-model/index.d.ts +171 -90
- package/dist/organization-model/index.js +377 -1541
- package/dist/test-utils/index.d.ts +25 -33
- package/dist/test-utils/index.js +250 -1357
- package/package.json +1 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +990 -1065
- package/src/business/acquisition/api-schemas.test.ts +1996 -1882
- package/src/business/acquisition/api-schemas.ts +1478 -1502
- package/src/business/acquisition/crm-next-action.test.ts +45 -25
- package/src/business/acquisition/crm-next-action.ts +227 -220
- package/src/business/acquisition/crm-priority.test.ts +41 -8
- package/src/business/acquisition/crm-priority.ts +365 -349
- package/src/business/acquisition/crm-state-actions.test.ts +208 -153
- package/src/business/acquisition/derive-actions.test.ts +101 -34
- package/src/business/acquisition/derive-actions.ts +8 -92
- package/src/business/acquisition/ontology-validation.ts +76 -162
- package/src/business/acquisition/types.ts +7 -8
- package/src/business/pdf/sections/investment.ts +1 -1
- package/src/business/pdf/sections/summary-investment.ts +1 -1
- package/src/execution/engine/tools/tool-maps.ts +872 -831
- package/src/knowledge/queries.ts +0 -1
- package/src/organization-model/__tests__/content-kinds-registry.test.ts +35 -210
- package/src/organization-model/__tests__/cross-ref.test.ts +167 -0
- package/src/organization-model/__tests__/defaults.test.ts +4 -4
- package/src/organization-model/__tests__/domains/actions.test.ts +12 -36
- package/src/organization-model/__tests__/domains/offerings.test.ts +13 -6
- package/src/organization-model/__tests__/domains/resources.test.ts +497 -350
- package/src/organization-model/__tests__/domains/systems.test.ts +6 -7
- package/src/organization-model/__tests__/flatten-additive-merge.test.ts +68 -80
- package/src/organization-model/__tests__/foundation.test.ts +81 -14
- package/src/organization-model/__tests__/graph.test.ts +662 -694
- package/src/organization-model/__tests__/knowledge.test.ts +31 -17
- package/src/organization-model/__tests__/lookup-helpers.test.ts +128 -438
- package/src/organization-model/__tests__/migration-helpers.test.ts +362 -591
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +68 -103
- package/src/organization-model/__tests__/published-zero-leak.test.ts +76 -0
- package/src/organization-model/__tests__/recursive-system-schema.test.ts +159 -532
- package/src/organization-model/__tests__/resolve.test.ts +79 -42
- package/src/organization-model/__tests__/schema-refinements.test.ts +72 -0
- package/src/organization-model/__tests__/schema.test.ts +65 -56
- package/src/organization-model/catalogs/lead-gen.ts +0 -103
- package/src/organization-model/cross-ref.ts +175 -0
- package/src/organization-model/defaults.ts +17 -702
- package/src/organization-model/domains/actions.ts +116 -333
- package/src/organization-model/domains/branding.ts +6 -6
- package/src/organization-model/domains/knowledge.ts +15 -7
- package/src/organization-model/domains/projects.ts +4 -4
- package/src/organization-model/domains/prospecting.ts +405 -395
- package/src/organization-model/domains/resources.ts +206 -135
- package/src/organization-model/domains/sales.test.ts +104 -218
- package/src/organization-model/domains/sales.ts +217 -380
- package/src/organization-model/domains/systems.ts +8 -23
- package/src/organization-model/graph/build.ts +223 -294
- package/src/organization-model/graph/schema.ts +2 -3
- package/src/organization-model/graph/types.ts +12 -14
- package/src/organization-model/helpers.ts +130 -218
- package/src/organization-model/index.ts +105 -124
- package/src/organization-model/migration-helpers.ts +211 -249
- package/src/organization-model/ontology.ts +0 -60
- package/src/organization-model/organization-graph.mdx +4 -5
- package/src/organization-model/organization-model.mdx +1 -1
- package/src/organization-model/published.ts +236 -226
- package/src/organization-model/resolve.ts +4 -5
- package/src/organization-model/schema-refinements.ts +667 -0
- package/src/organization-model/schema.ts +88 -889
- package/src/organization-model/types.ts +167 -161
- package/src/platform/registry/__tests__/validation.test.ts +23 -0
- package/src/platform/registry/validation.ts +13 -2
- package/src/reference/_generated/contracts.md +990 -1065
- package/src/organization-model/content-kinds/config.ts +0 -36
- package/src/organization-model/content-kinds/index.ts +0 -78
- package/src/organization-model/content-kinds/pipeline.ts +0 -68
- package/src/organization-model/content-kinds/registry.ts +0 -44
- package/src/organization-model/content-kinds/status.ts +0 -71
- package/src/organization-model/content-kinds/template.ts +0 -83
- package/src/organization-model/content-kinds/types.ts +0 -117
|
@@ -3,54 +3,109 @@ import { DescriptionSchema, LabelSchema, ModelIdSchema } from './shared'
|
|
|
3
3
|
import { SystemPathSchema, SystemLifecycleSchema } from './systems'
|
|
4
4
|
import { ActionInvocationSchema } from './actions'
|
|
5
5
|
import { OntologyIdSchema } from '../ontology'
|
|
6
|
-
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
//
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export const
|
|
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
|
-
|
|
6
|
+
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// ContractRef — portable, browser-safe ref string for workflow I/O contracts
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// Format: `package/subpath#ExportName`
|
|
12
|
+
// Examples:
|
|
13
|
+
// `@repo/elevasis-core/contracts/apollo-import#inputSchema`
|
|
14
|
+
// `@repo/elevasis-core/contracts/dtc-subscription-score#outputSchema`
|
|
15
|
+
//
|
|
16
|
+
// Tier-1 validation (schema.ts superRefine): ref-string SHAPE only — no import
|
|
17
|
+
// Tier-2 validation (om:verify): intra-@repo/elevasis-core typed-map resolution
|
|
18
|
+
|
|
19
|
+
/** Portable `package/subpath#ExportName` contract reference string. Browser-safe; no imports. */
|
|
20
|
+
export const ContractRefSchema = z
|
|
21
|
+
.string()
|
|
22
|
+
.trim()
|
|
23
|
+
.min(1)
|
|
24
|
+
.max(500)
|
|
25
|
+
.regex(
|
|
26
|
+
/^[A-Za-z0-9@](?:[A-Za-z0-9_./@-]*[A-Za-z0-9_])?\/?[A-Za-z0-9_./@-]*#[A-Za-z_$][A-Za-z0-9_$]*$/,
|
|
27
|
+
'ContractRef must be in the format package/subpath#ExportName (e.g. @repo/elevasis-core/contracts/apollo-import#inputSchema)'
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export type ContractRef = z.infer<typeof ContractRefSchema>
|
|
31
|
+
|
|
32
|
+
/** Parsed representation of a ContractRef string. */
|
|
33
|
+
export interface ParsedContractRef {
|
|
34
|
+
/** The full package + subpath portion before `#`. */
|
|
35
|
+
moduleSpecifier: string
|
|
36
|
+
/** The export name after `#`. */
|
|
37
|
+
exportName: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parse a `package/subpath#ExportName` contract ref string.
|
|
42
|
+
* Browser-safe — no module system interaction.
|
|
43
|
+
*
|
|
44
|
+
* @throws {Error} if the ref string does not match the expected format.
|
|
45
|
+
*/
|
|
46
|
+
export function parseContractRef(ref: string): ParsedContractRef {
|
|
47
|
+
const hashIndex = ref.lastIndexOf('#')
|
|
48
|
+
if (hashIndex === -1) {
|
|
49
|
+
throw new Error(`ContractRef "${ref}" is missing the required "#ExportName" suffix`)
|
|
50
|
+
}
|
|
51
|
+
const moduleSpecifier = ref.slice(0, hashIndex)
|
|
52
|
+
const exportName = ref.slice(hashIndex + 1)
|
|
53
|
+
if (!moduleSpecifier) {
|
|
54
|
+
throw new Error(`ContractRef "${ref}" has an empty module specifier before "#"`)
|
|
55
|
+
}
|
|
56
|
+
if (!exportName) {
|
|
57
|
+
throw new Error(`ContractRef "${ref}" has an empty export name after "#"`)
|
|
58
|
+
}
|
|
59
|
+
return { moduleSpecifier, exportName }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Resources domain
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
//
|
|
66
|
+
// Resources are governance-only OM descriptors. Runtime code imports these
|
|
67
|
+
// descriptors and attaches executable behavior; it does not re-author identity.
|
|
68
|
+
|
|
69
|
+
export const ResourceKindSchema = z
|
|
70
|
+
.enum(['workflow', 'agent', 'integration', 'script'])
|
|
71
|
+
.meta({ label: 'Resource kind', color: 'orange' })
|
|
72
|
+
export const ResourceGovernanceStatusSchema = z
|
|
73
|
+
.enum(['active', 'deprecated', 'archived'])
|
|
74
|
+
.meta({ label: 'Governance status', color: 'teal' })
|
|
75
|
+
export const AgentKindSchema = z
|
|
76
|
+
.enum(['orchestrator', 'specialist', 'utility', 'platform'])
|
|
77
|
+
.meta({ label: 'Agent kind', color: 'violet' })
|
|
78
|
+
export const ScriptResourceLanguageSchema = z.enum(['shell', 'sql', 'typescript', 'python']).meta({ label: 'Language' })
|
|
79
|
+
export const CodeReferenceRoleSchema = z
|
|
80
|
+
.enum(['entrypoint', 'handler', 'schema', 'test', 'docs', 'config'])
|
|
81
|
+
.meta({ label: 'Code reference role', color: 'blue' })
|
|
82
|
+
|
|
83
|
+
export const ResourceIdSchema = z
|
|
84
|
+
.string()
|
|
85
|
+
.trim()
|
|
86
|
+
.min(1)
|
|
87
|
+
.max(255)
|
|
88
|
+
.regex(/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*$/, 'Resource IDs must use letters, numbers, -, _, or . separators')
|
|
89
|
+
|
|
90
|
+
export const EventIdSchema = z
|
|
91
|
+
.string()
|
|
92
|
+
.trim()
|
|
93
|
+
.min(1)
|
|
94
|
+
.max(300)
|
|
95
|
+
.regex(
|
|
96
|
+
/^[A-Za-z0-9]+(?:[-._][A-Za-z0-9]+)*:[a-z0-9]+(?:[-._][a-z0-9]+)*$/,
|
|
97
|
+
'Event IDs must use <owner-id>:<event-key>'
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
export const EventKeySchema = ModelIdSchema
|
|
101
|
+
|
|
102
|
+
export const EventEmissionDescriptorSchema = z.object({
|
|
103
|
+
eventKey: EventKeySchema,
|
|
104
|
+
label: z.string().trim().min(1).max(120),
|
|
105
|
+
payloadSchema: ModelIdSchema.optional(),
|
|
106
|
+
lifecycle: SystemLifecycleSchema.optional()
|
|
107
|
+
})
|
|
108
|
+
|
|
54
109
|
export const EventDescriptorSchema = EventEmissionDescriptorSchema.extend({
|
|
55
110
|
id: EventIdSchema,
|
|
56
111
|
ownerId: z.union([ResourceIdSchema, ModelIdSchema]),
|
|
@@ -64,7 +119,22 @@ export const ResourceOntologyBindingSchema = z
|
|
|
64
119
|
reads: z.array(OntologyIdSchema).optional(),
|
|
65
120
|
writes: z.array(OntologyIdSchema).optional(),
|
|
66
121
|
usesCatalogs: z.array(OntologyIdSchema).optional(),
|
|
67
|
-
emits: z.array(OntologyIdSchema).optional()
|
|
122
|
+
emits: z.array(OntologyIdSchema).optional(),
|
|
123
|
+
/**
|
|
124
|
+
* Optional typed contract binding for this resource's workflow I/O.
|
|
125
|
+
* Each ref is a `package/subpath#ExportName` string that resolves to a
|
|
126
|
+
* Zod schema in `@repo/elevasis-core` (or the consumer's equivalent package).
|
|
127
|
+
*
|
|
128
|
+
* Absence of this field preserves all existing behavior — it is additive + optional.
|
|
129
|
+
* Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
|
|
130
|
+
* Tier-2 validation (om:verify): intra-package typed-map resolution asserts ZodType.
|
|
131
|
+
*/
|
|
132
|
+
contract: z
|
|
133
|
+
.object({
|
|
134
|
+
input: ContractRefSchema.optional(),
|
|
135
|
+
output: ContractRefSchema.optional()
|
|
136
|
+
})
|
|
137
|
+
.optional()
|
|
68
138
|
})
|
|
69
139
|
.superRefine((binding, ctx) => {
|
|
70
140
|
if (binding.primaryAction === undefined) return
|
|
@@ -89,29 +159,29 @@ type ResourceOntologyBindingInput = {
|
|
|
89
159
|
|
|
90
160
|
export const CodeReferenceSchema = z.object({
|
|
91
161
|
path: z
|
|
92
|
-
.string()
|
|
93
|
-
.trim()
|
|
94
|
-
.min(1)
|
|
95
|
-
.max(500)
|
|
96
|
-
.regex(/^[A-Za-z0-9_./$@()[\] -]+$/, 'Code reference paths must be repo-relative paths'),
|
|
97
|
-
role: CodeReferenceRoleSchema,
|
|
98
|
-
symbol: z.string().trim().min(1).max(200).optional(),
|
|
99
|
-
description: z.string().trim().min(1).max(300).optional()
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
const ResourceEntryBaseSchema = z.object({
|
|
103
|
-
/** Canonical resource id; runtime resourceId derives from this value. */
|
|
104
|
-
id: ResourceIdSchema,
|
|
105
|
-
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
106
|
-
order: z.number().default(0),
|
|
107
|
-
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
162
|
+
.string()
|
|
163
|
+
.trim()
|
|
164
|
+
.min(1)
|
|
165
|
+
.max(500)
|
|
166
|
+
.regex(/^[A-Za-z0-9_./$@()[\] -]+$/, 'Code reference paths must be repo-relative paths'),
|
|
167
|
+
role: CodeReferenceRoleSchema,
|
|
168
|
+
symbol: z.string().trim().min(1).max(200).optional(),
|
|
169
|
+
description: z.string().trim().min(1).max(300).optional()
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
const ResourceEntryBaseSchema = z.object({
|
|
173
|
+
/** Canonical resource id; runtime resourceId derives from this value. */
|
|
174
|
+
id: ResourceIdSchema,
|
|
175
|
+
/** Domain-map iteration order. Convention: multiples of 10 (10, 20, 30, ...) to allow easy insertion. */
|
|
176
|
+
order: z.number().default(0),
|
|
177
|
+
/** Required single System membership — value is a dot-separated system path (e.g. "sales.lead-gen"). */
|
|
108
178
|
systemPath: SystemPathSchema.meta({ ref: 'system' }),
|
|
109
179
|
/** Executable display title owned by the OM Resource descriptor. */
|
|
110
180
|
title: LabelSchema.optional(),
|
|
111
181
|
/** Executable display description owned by the OM Resource descriptor. */
|
|
112
182
|
description: DescriptionSchema.optional(),
|
|
113
|
-
/** Optional role responsible for maintaining this resource. */
|
|
114
|
-
ownerRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
|
|
183
|
+
/** Optional role responsible for maintaining this resource. */
|
|
184
|
+
ownerRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
|
|
115
185
|
status: ResourceGovernanceStatusSchema,
|
|
116
186
|
/**
|
|
117
187
|
* Ontology contract bindings for the semantic work this resource performs.
|
|
@@ -122,68 +192,68 @@ const ResourceEntryBaseSchema = z.object({
|
|
|
122
192
|
/** Repo-relative implementation breadcrumbs for agents and operators. */
|
|
123
193
|
codeRefs: z.array(CodeReferenceSchema).default([])
|
|
124
194
|
})
|
|
125
|
-
|
|
195
|
+
|
|
126
196
|
export const WorkflowResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
127
197
|
kind: z.literal('workflow'),
|
|
128
198
|
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
129
199
|
})
|
|
130
|
-
|
|
131
|
-
export const AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
132
|
-
kind: z.literal('agent'),
|
|
133
|
-
/** Mirrors code-side AgentConfig.kind. */
|
|
134
|
-
agentKind: AgentKindSchema,
|
|
135
|
-
/** Role this agent embodies, if any. */
|
|
136
|
-
actsAsRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
|
|
137
|
-
/** Mirrors AgentConfig.sessionCapable. */
|
|
138
|
-
sessionCapable: z.boolean(),
|
|
139
|
-
/** Broad/composite callable entry points orchestrated by this agent. */
|
|
140
|
-
invocations: z.array(ActionInvocationSchema).default([]),
|
|
141
|
-
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
export const IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
145
|
-
kind: z.literal('integration'),
|
|
146
|
-
provider: z.string().trim().min(1).max(100)
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
export const ScriptResourceSourceSchema = z.union([
|
|
150
|
-
z.string().trim().min(1).max(50_000),
|
|
151
|
-
z.object({
|
|
152
|
-
file: z.string().trim().min(1).max(500)
|
|
153
|
-
})
|
|
154
|
-
])
|
|
155
|
-
|
|
156
|
-
export const ScriptResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
157
|
-
kind: z.literal('script'),
|
|
158
|
-
language: ScriptResourceLanguageSchema,
|
|
159
|
-
source: ScriptResourceSourceSchema
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
export const ResourceEntrySchema = z.discriminatedUnion('kind', [
|
|
163
|
-
WorkflowResourceEntrySchema,
|
|
164
|
-
AgentResourceEntrySchema,
|
|
165
|
-
IntegrationResourceEntrySchema,
|
|
166
|
-
ScriptResourceEntrySchema
|
|
167
|
-
])
|
|
168
|
-
|
|
169
|
-
export const ResourcesDomainSchema = z
|
|
170
|
-
.record(z.string(), ResourceEntrySchema)
|
|
171
|
-
.refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
172
|
-
message: 'Each resource entry id must match its map key'
|
|
173
|
-
})
|
|
174
|
-
.default({})
|
|
175
|
-
|
|
176
|
-
export const DEFAULT_ORGANIZATION_MODEL_RESOURCES: z.infer<typeof ResourcesDomainSchema> = {}
|
|
177
|
-
|
|
178
|
-
export function defineResource<const TResource extends ResourceEntry>(resource: TResource): TResource {
|
|
179
|
-
return ResourceEntrySchema.parse(resource) as TResource
|
|
180
|
-
}
|
|
181
|
-
|
|
200
|
+
|
|
201
|
+
export const AgentResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
202
|
+
kind: z.literal('agent'),
|
|
203
|
+
/** Mirrors code-side AgentConfig.kind. */
|
|
204
|
+
agentKind: AgentKindSchema,
|
|
205
|
+
/** Role this agent embodies, if any. */
|
|
206
|
+
actsAsRoleId: ModelIdSchema.meta({ ref: 'role' }).optional(),
|
|
207
|
+
/** Mirrors AgentConfig.sessionCapable. */
|
|
208
|
+
sessionCapable: z.boolean(),
|
|
209
|
+
/** Broad/composite callable entry points orchestrated by this agent. */
|
|
210
|
+
invocations: z.array(ActionInvocationSchema).default([]),
|
|
211
|
+
emits: z.array(EventEmissionDescriptorSchema).optional()
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
export const IntegrationResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
215
|
+
kind: z.literal('integration'),
|
|
216
|
+
provider: z.string().trim().min(1).max(100)
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
export const ScriptResourceSourceSchema = z.union([
|
|
220
|
+
z.string().trim().min(1).max(50_000),
|
|
221
|
+
z.object({
|
|
222
|
+
file: z.string().trim().min(1).max(500)
|
|
223
|
+
})
|
|
224
|
+
])
|
|
225
|
+
|
|
226
|
+
export const ScriptResourceEntrySchema = ResourceEntryBaseSchema.extend({
|
|
227
|
+
kind: z.literal('script'),
|
|
228
|
+
language: ScriptResourceLanguageSchema,
|
|
229
|
+
source: ScriptResourceSourceSchema
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
export const ResourceEntrySchema = z.discriminatedUnion('kind', [
|
|
233
|
+
WorkflowResourceEntrySchema,
|
|
234
|
+
AgentResourceEntrySchema,
|
|
235
|
+
IntegrationResourceEntrySchema,
|
|
236
|
+
ScriptResourceEntrySchema
|
|
237
|
+
])
|
|
238
|
+
|
|
239
|
+
export const ResourcesDomainSchema = z
|
|
240
|
+
.record(z.string(), ResourceEntrySchema)
|
|
241
|
+
.refine((record) => Object.entries(record).every(([key, entry]) => entry.id === key), {
|
|
242
|
+
message: 'Each resource entry id must match its map key'
|
|
243
|
+
})
|
|
244
|
+
.default({})
|
|
245
|
+
|
|
246
|
+
export const DEFAULT_ORGANIZATION_MODEL_RESOURCES: z.infer<typeof ResourcesDomainSchema> = {}
|
|
247
|
+
|
|
248
|
+
export function defineResource<const TResource extends ResourceEntry>(resource: TResource): TResource {
|
|
249
|
+
return ResourceEntrySchema.parse(resource) as TResource
|
|
250
|
+
}
|
|
251
|
+
|
|
182
252
|
export function defineResources<const TResources extends Record<string, ResourceEntry>>(
|
|
183
253
|
resources: TResources
|
|
184
254
|
): TResources {
|
|
185
|
-
return Object.fromEntries(
|
|
186
|
-
Object.entries(resources).map(([key, resource]) => [key, ResourceEntrySchema.parse(resource)])
|
|
255
|
+
return Object.fromEntries(
|
|
256
|
+
Object.entries(resources).map(([key, resource]) => [key, ResourceEntrySchema.parse(resource)])
|
|
187
257
|
) as TResources
|
|
188
258
|
}
|
|
189
259
|
|
|
@@ -205,19 +275,20 @@ export function defineResourceOntology(input: ResourceOntologyBindingInput): Res
|
|
|
205
275
|
emits: ontologyIdArrayFrom(input.emits)
|
|
206
276
|
})
|
|
207
277
|
}
|
|
208
|
-
|
|
209
|
-
export type ResourceId = z.infer<typeof ResourceIdSchema>
|
|
210
|
-
export type ResourceKind = z.infer<typeof ResourceKindSchema>
|
|
211
|
-
export type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
|
|
212
|
-
export type ResourceAgentKind = z.infer<typeof AgentKindSchema>
|
|
278
|
+
|
|
279
|
+
export type ResourceId = z.infer<typeof ResourceIdSchema>
|
|
280
|
+
export type ResourceKind = z.infer<typeof ResourceKindSchema>
|
|
281
|
+
export type ResourceGovernanceStatus = z.infer<typeof ResourceGovernanceStatusSchema>
|
|
282
|
+
export type ResourceAgentKind = z.infer<typeof AgentKindSchema>
|
|
213
283
|
export type CodeReferenceRole = z.infer<typeof CodeReferenceRoleSchema>
|
|
214
284
|
export type ResourceOntologyBinding = z.infer<typeof ResourceOntologyBindingSchema>
|
|
285
|
+
export type ResourceOntologyBindingContract = NonNullable<ResourceOntologyBinding['contract']>
|
|
215
286
|
export type CodeReference = z.infer<typeof CodeReferenceSchema>
|
|
216
|
-
export type ScriptResourceLanguage = z.infer<typeof ScriptResourceLanguageSchema>
|
|
217
|
-
export type ScriptResourceSource = z.infer<typeof ScriptResourceSourceSchema>
|
|
218
|
-
export type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
|
|
219
|
-
export type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
|
|
220
|
-
export type IntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
|
|
221
|
-
export type ScriptResourceEntry = z.infer<typeof ScriptResourceEntrySchema>
|
|
222
|
-
export type ResourceEntry = z.infer<typeof ResourceEntrySchema>
|
|
223
|
-
export type ResourcesDomain = z.infer<typeof ResourcesDomainSchema>
|
|
287
|
+
export type ScriptResourceLanguage = z.infer<typeof ScriptResourceLanguageSchema>
|
|
288
|
+
export type ScriptResourceSource = z.infer<typeof ScriptResourceSourceSchema>
|
|
289
|
+
export type WorkflowResourceEntry = z.infer<typeof WorkflowResourceEntrySchema>
|
|
290
|
+
export type AgentResourceEntry = z.infer<typeof AgentResourceEntrySchema>
|
|
291
|
+
export type IntegrationResourceEntry = z.infer<typeof IntegrationResourceEntrySchema>
|
|
292
|
+
export type ScriptResourceEntry = z.infer<typeof ScriptResourceEntrySchema>
|
|
293
|
+
export type ResourceEntry = z.infer<typeof ResourceEntrySchema>
|
|
294
|
+
export type ResourcesDomain = z.infer<typeof ResourcesDomainSchema>
|