@fractal_cloud/sdk 1.5.0 → 1.5.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.
package/dist/index.mjs CHANGED
@@ -5496,18 +5496,109 @@ function buildContainerPlatformType() {
5496
5496
  function pushParam$85(params, key, value) {
5497
5497
  params.push(key, value);
5498
5498
  }
5499
- function makeContainerPlatformComponent(platform, workloadNodes) {
5499
+ function appendDep(bp, dep) {
5500
+ return {
5501
+ ...bp,
5502
+ dependencies: [...bp.dependencies, dep]
5503
+ };
5504
+ }
5505
+ const emptyCollections = {
5506
+ workloads: [],
5507
+ apiGateway: void 0,
5508
+ brokers: [],
5509
+ searches: [],
5510
+ monitoring: void 0,
5511
+ tracing: void 0,
5512
+ logging: void 0,
5513
+ serviceMesh: void 0
5514
+ };
5515
+ function makeContainerPlatformComponent(platform, caas) {
5500
5516
  const platformDep = { id: platform.id };
5517
+ const wiredWorkloads = caas.workloads.map((w) => ({
5518
+ ...w,
5519
+ component: appendDep(w.component, platformDep)
5520
+ }));
5521
+ const wiredBrokers = caas.brokers.map((b) => {
5522
+ const broker = appendDep(b.broker, platformDep);
5523
+ return {
5524
+ ...b,
5525
+ broker
5526
+ };
5527
+ });
5528
+ const wiredSearches = caas.searches.map((s) => {
5529
+ const search = appendDep(s.search, platformDep);
5530
+ return {
5531
+ ...s,
5532
+ search
5533
+ };
5534
+ });
5535
+ const wireSingleton = (node) => {
5536
+ if (!node) return;
5537
+ const component = appendDep(node.component, platformDep);
5538
+ return {
5539
+ ...node,
5540
+ component,
5541
+ components: [component]
5542
+ };
5543
+ };
5544
+ const wiredApiGateway = wireSingleton(caas.apiGateway);
5545
+ const wiredMonitoring = wireSingleton(caas.monitoring);
5546
+ const wiredTracing = wireSingleton(caas.tracing);
5547
+ const wiredLogging = wireSingleton(caas.logging);
5548
+ const wiredServiceMesh = wireSingleton(caas.serviceMesh);
5501
5549
  return {
5502
5550
  platform,
5503
- workloads: workloadNodes.map((w) => ({
5504
- ...w,
5505
- component: {
5506
- ...w.component,
5507
- dependencies: [...w.component.dependencies, platformDep]
5508
- }
5509
- })),
5510
- withWorkloads: (newWorkloads) => makeContainerPlatformComponent(platform, newWorkloads)
5551
+ workloads: wiredWorkloads,
5552
+ apiGateway: wiredApiGateway,
5553
+ brokers: wiredBrokers,
5554
+ searches: wiredSearches,
5555
+ monitoring: wiredMonitoring,
5556
+ tracing: wiredTracing,
5557
+ logging: wiredLogging,
5558
+ serviceMesh: wiredServiceMesh,
5559
+ components: [
5560
+ platform,
5561
+ ...wiredWorkloads.map((w) => w.component),
5562
+ ...wiredApiGateway ? [wiredApiGateway.component] : [],
5563
+ ...wiredBrokers.flatMap((b) => [b.broker, ...b.entities.map((e) => e.component)]),
5564
+ ...wiredSearches.flatMap((s) => [s.search, ...s.entities.map((e) => e.component)]),
5565
+ ...wiredMonitoring ? [wiredMonitoring.component] : [],
5566
+ ...wiredTracing ? [wiredTracing.component] : [],
5567
+ ...wiredLogging ? [wiredLogging.component] : [],
5568
+ ...wiredServiceMesh ? [wiredServiceMesh.component] : []
5569
+ ],
5570
+ withWorkloads: (workloads) => makeContainerPlatformComponent(platform, {
5571
+ ...caas,
5572
+ workloads
5573
+ }),
5574
+ withApiGateway: (apiGateway) => makeContainerPlatformComponent(platform, {
5575
+ ...caas,
5576
+ apiGateway
5577
+ }),
5578
+ withBrokers: (brokers) => makeContainerPlatformComponent(platform, {
5579
+ ...caas,
5580
+ brokers
5581
+ }),
5582
+ withSearches: (searches) => makeContainerPlatformComponent(platform, {
5583
+ ...caas,
5584
+ searches
5585
+ }),
5586
+ withMonitoring: (monitoring) => makeContainerPlatformComponent(platform, {
5587
+ ...caas,
5588
+ monitoring
5589
+ }),
5590
+ withTracing: (tracing) => makeContainerPlatformComponent(platform, {
5591
+ ...caas,
5592
+ tracing
5593
+ }),
5594
+ withLogging: (logging) => makeContainerPlatformComponent(platform, {
5595
+ ...caas,
5596
+ logging
5597
+ }),
5598
+ withServiceMesh: (serviceMesh) => makeContainerPlatformComponent(platform, {
5599
+ ...caas,
5600
+ serviceMesh
5601
+ })
5511
5602
  };
5512
5603
  }
5513
5604
  let ContainerPlatform;
@@ -5544,7 +5635,7 @@ let ContainerPlatform;
5544
5635
  const b = getBuilder().withId(config.id).withVersion(config.version.major, config.version.minor, config.version.patch).withDisplayName(config.displayName);
5545
5636
  if (config.description) b.withDescription(config.description);
5546
5637
  if (config.nodePools) b.withNodePools(config.nodePools);
5547
- return makeContainerPlatformComponent(b.build(), []);
5638
+ return makeContainerPlatformComponent(b.build(), emptyCollections);
5548
5639
  };
5549
5640
  })(ContainerPlatform || (ContainerPlatform = {}));
5550
5641
 
@@ -5587,6 +5678,13 @@ function buildPortLinkParams(fromPort, toPort, protocol) {
5587
5678
  if (protocol) p.push("protocol", protocol);
5588
5679
  return p;
5589
5680
  }
5681
+ function buildMessagingLinkParams$1(s) {
5682
+ const p = getParametersInstance();
5683
+ p.push("access", s.access);
5684
+ if (s.consumerGroup !== void 0) p.push("consumerGroup", s.consumerGroup);
5685
+ if (s.startingPosition !== void 0) p.push("startingPosition", s.startingPosition);
5686
+ return p;
5687
+ }
5590
5688
  function buildApiGatewayLinkParams(s) {
5591
5689
  const p = getParametersInstance();
5592
5690
  p.push("prefix", s.prefix);
@@ -5621,6 +5719,13 @@ function makeWorkloadComponent(component) {
5621
5719
  ...component,
5622
5720
  links: [...component.links, ...gwLinks]
5623
5721
  });
5722
+ },
5723
+ linkToMessagingEntity: (links) => {
5724
+ const msgLinks = links.map((l) => getLinkBuilder().withId(l.target.component.id).withType(l.target.component.type).withParameters(buildMessagingLinkParams$1(l)).build());
5725
+ return makeWorkloadComponent({
5726
+ ...component,
5727
+ links: [...component.links, ...msgLinks]
5728
+ });
5624
5729
  }
5625
5730
  };
5626
5731
  }
@@ -12775,6 +12880,11 @@ const PACKAGE_NAME_PARAM = "packageName";
12775
12880
  const ENTRY_POINT_PARAM = "entryPoint";
12776
12881
  const ENTRY_POINT_ARGS_PARAM = "entryPointArgs";
12777
12882
  const ARTIFACT_TYPE_PYTHON_WHEEL = "python_wheel";
12883
+ const DATALAKE_PURPOSE_PARAM = "purpose";
12884
+ const DATALAKE_PATH_PARAM = "path";
12885
+ const MESSAGING_ACCESS_PARAM = "access";
12886
+ const MESSAGING_CONSUMER_GROUP_PARAM = "consumerGroup";
12887
+ const MESSAGING_STARTING_POSITION_PARAM = "startingPosition";
12778
12888
  function buildId$45(id) {
12779
12889
  return getComponentIdBuilder().withValue(KebabCaseString$1.getBuilder().withValue(id).build()).build();
12780
12890
  }
@@ -12787,10 +12897,37 @@ function buildDataProcessingJobType() {
12787
12897
  function pushParam$27(params, key, value) {
12788
12898
  params.push(key, value);
12789
12899
  }
12900
+ function buildDatalakeLinkParams(s) {
12901
+ const p = getParametersInstance();
12902
+ p.push(DATALAKE_PURPOSE_PARAM, s.purpose);
12903
+ if (s.path !== void 0) p.push(DATALAKE_PATH_PARAM, s.path);
12904
+ return p;
12905
+ }
12906
+ function buildMessagingLinkParams(s) {
12907
+ const p = getParametersInstance();
12908
+ p.push(MESSAGING_ACCESS_PARAM, s.access);
12909
+ if (s.consumerGroup !== void 0) p.push(MESSAGING_CONSUMER_GROUP_PARAM, s.consumerGroup);
12910
+ if (s.startingPosition !== void 0) p.push(MESSAGING_STARTING_POSITION_PARAM, s.startingPosition);
12911
+ return p;
12912
+ }
12790
12913
  function makeDataProcessingJobComponent(component) {
12791
12914
  return {
12792
12915
  component,
12793
- components: [component]
12916
+ components: [component],
12917
+ linkToDatalake: (links) => {
12918
+ const lakeLinks = links.map((l) => getLinkBuilder().withId(l.target.component.id).withType(l.target.component.type).withParameters(buildDatalakeLinkParams(l)).build());
12919
+ return makeDataProcessingJobComponent({
12920
+ ...component,
12921
+ links: [...component.links, ...lakeLinks]
12922
+ });
12923
+ },
12924
+ linkToMessagingEntity: (links) => {
12925
+ const msgLinks = links.map((l) => getLinkBuilder().withId(l.target.component.id).withType(l.target.component.type).withParameters(buildMessagingLinkParams(l)).build());
12926
+ return makeDataProcessingJobComponent({
12927
+ ...component,
12928
+ links: [...component.links, ...msgLinks]
12929
+ });
12930
+ }
12794
12931
  };
12795
12932
  }
12796
12933
  let DataProcessingJob;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fractal_cloud/sdk",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "Typescript Fractal Cloud SDK",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "author": "Fractal Cloud",