@elevasis/sdk 1.49.0 → 1.51.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.
@@ -1,9 +1,9 @@
1
+ export { projectDeploymentSpec, projectTopologyRelationships, toSdkResourceDescriptor, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors } from '../chunk-VYWGWJRW.js';
1
2
  import { readFileSync, mkdirSync, writeFileSync, readdirSync } from 'fs';
2
3
  import { relative, dirname, resolve, join, extname } from 'path';
3
4
  import { compile } from '@mdx-js/mdx';
4
5
  import remarkGfm from 'remark-gfm';
5
6
 
6
- // src/knowledge-codegen.ts
7
7
  function targetFromNodeId(nodeId) {
8
8
  const [kind, ...idParts] = nodeId.split(":");
9
9
  return {
@@ -514,126 +514,4 @@ async function runKnowledgeCodegen(layout) {
514
514
  );
515
515
  }
516
516
 
517
- // src/project-deployment-spec.ts
518
- function toSdkResourceDescriptor(resource, getResourceOntologyBinding) {
519
- const ontologyBinding = getResourceOntologyBinding?.(resource.id);
520
- return {
521
- ...resource,
522
- ...ontologyBinding ?? {},
523
- systemId: resource.systemPath
524
- };
525
- }
526
- function withPlatformResourceDescriptor(workflow, getWorkflowResourceDescriptor, getResourceOntologyBinding) {
527
- const resource = getWorkflowResourceDescriptor(workflow.config.resourceId);
528
- const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
529
- return {
530
- ...workflow,
531
- config: {
532
- ...workflow.config,
533
- resource: sdkResource,
534
- resourceId: sdkResource.id,
535
- type: sdkResource.kind
536
- }
537
- };
538
- }
539
- function withPlatformResourceDescriptors(workflows, getWorkflowResourceDescriptor, getResourceOntologyBinding) {
540
- return workflows.map(
541
- (workflow) => withPlatformResourceDescriptor(workflow, getWorkflowResourceDescriptor, getResourceOntologyBinding)
542
- );
543
- }
544
- function withPlatformAgentResourceDescriptor(agent, getAgentResourceDescriptor, getResourceOntologyBinding) {
545
- const resource = getAgentResourceDescriptor(agent.config.resourceId);
546
- const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
547
- return {
548
- ...agent,
549
- config: {
550
- ...agent.config,
551
- resource: sdkResource,
552
- resourceId: sdkResource.id,
553
- type: sdkResource.kind
554
- }
555
- };
556
- }
557
- function withPlatformAgentResourceDescriptors(agents, getAgentResourceDescriptor, getResourceOntologyBinding) {
558
- return agents.map(
559
- (agent) => withPlatformAgentResourceDescriptor(agent, getAgentResourceDescriptor, getResourceOntologyBinding)
560
- );
561
- }
562
- function withPlatformIntegrationResourceDescriptor(integration, getIntegrationResourceDescriptor, getResourceOntologyBinding) {
563
- const resource = getIntegrationResourceDescriptor(integration.resourceId);
564
- const sdkResource = toSdkResourceDescriptor(resource, getResourceOntologyBinding);
565
- return {
566
- ...integration,
567
- resource: sdkResource,
568
- resourceId: sdkResource.id,
569
- type: sdkResource.kind
570
- };
571
- }
572
- function withPlatformIntegrationResourceDescriptors(integrations, getIntegrationResourceDescriptor, getResourceOntologyBinding) {
573
- return integrations.map(
574
- (integration) => withPlatformIntegrationResourceDescriptor(integration, getIntegrationResourceDescriptor, getResourceOntologyBinding)
575
- );
576
- }
577
- function projectTopologyRelationships(model) {
578
- const projected = {};
579
- function ensure(sourceId) {
580
- projected[sourceId] ??= {};
581
- return projected[sourceId];
582
- }
583
- for (const relationship of Object.values(model.topology.relationships)) {
584
- if (relationship.from.kind === "humanCheckpoint") continue;
585
- if (relationship.kind === "triggers" && relationship.to.kind === "resource") {
586
- const target = model.resources[relationship.to.id];
587
- if (target?.kind !== "workflow" && target?.kind !== "agent") continue;
588
- const source = ensure(relationship.from.id);
589
- source.triggers ??= {};
590
- if (target.kind === "workflow") {
591
- source.triggers.workflows ??= [];
592
- source.triggers.workflows.push(target.id);
593
- } else {
594
- source.triggers.agents ??= [];
595
- source.triggers.agents.push(target.id);
596
- }
597
- continue;
598
- }
599
- if (relationship.kind === "uses" && relationship.from.kind === "resource" && relationship.to.kind === "resource") {
600
- const target = model.resources[relationship.to.id];
601
- if (target?.kind !== "integration") continue;
602
- const source = ensure(relationship.from.id);
603
- source.uses ??= {};
604
- source.uses.integrations ??= [];
605
- source.uses.integrations.push(target.id);
606
- }
607
- }
608
- return projected;
609
- }
610
- function projectDeploymentSpec(options) {
611
- const workflows = withPlatformResourceDescriptors(
612
- options.workflows,
613
- options.getWorkflowResourceDescriptor,
614
- options.getResourceOntologyBinding
615
- );
616
- const integrations = withPlatformIntegrationResourceDescriptors(
617
- options.integrations ?? [],
618
- options.getIntegrationResourceDescriptor,
619
- options.getResourceOntologyBinding
620
- );
621
- const agents = options.getAgentResourceDescriptor === void 0 ? options.agents ?? [] : withPlatformAgentResourceDescriptors(
622
- options.agents ?? [],
623
- options.getAgentResourceDescriptor,
624
- options.getResourceOntologyBinding
625
- );
626
- return {
627
- version: options.version,
628
- organizationModel: options.organizationModel,
629
- workflows,
630
- agents,
631
- triggers: options.triggers,
632
- integrations,
633
- humanCheckpoints: options.humanCheckpoints,
634
- relationships: projectTopologyRelationships(options.organizationModel),
635
- ...options.externalResources ? { externalResources: options.externalResources } : {}
636
- };
637
- }
638
-
639
- export { generateKnowledgeBodies, generateKnowledgeNodes, generateKnowledgeNodesTs, projectDeploymentSpec, projectTopologyRelationships, readKnowledgeNodeMdx, runKnowledgeCodegen, toSdkResourceDescriptor, withPlatformAgentResourceDescriptor, withPlatformAgentResourceDescriptors, withPlatformIntegrationResourceDescriptor, withPlatformIntegrationResourceDescriptors, withPlatformResourceDescriptor, withPlatformResourceDescriptors };
517
+ export { generateKnowledgeBodies, generateKnowledgeNodes, generateKnowledgeNodesTs, readKnowledgeNodeMdx, runKnowledgeCodegen };