@vivoa/plugin-sdk 0.7.1 → 0.8.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.js CHANGED
@@ -572,6 +572,11 @@ var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
572
572
  ContentBlockType2["Stat"] = "stat";
573
573
  ContentBlockType2["Table"] = "table";
574
574
  ContentBlockType2["Chart"] = "chart";
575
+ ContentBlockType2["Filter"] = "filter";
576
+ ContentBlockType2["Grid"] = "grid";
577
+ ContentBlockType2["Search"] = "search";
578
+ ContentBlockType2["Details"] = "details";
579
+ ContentBlockType2["Toolbar"] = "toolbar";
575
580
  return ContentBlockType2;
576
581
  })(ContentBlockType || {});
577
582
  var UiSlot = {
@@ -619,12 +624,14 @@ var sCopyFieldBlock2 = (0, import_superstruct3.object)({
619
624
  value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
620
625
  computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
621
626
  });
627
+ var sPageParams = (0, import_superstruct3.record)((0, import_superstruct3.string)(), (0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.literal)(null)]));
622
628
  var sLinkBlock = (0, import_superstruct3.object)({
623
629
  type: (0, import_superstruct3.literal)("link" /* Link */),
624
630
  label: (0, import_superstruct3.string)(),
625
631
  href: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
626
632
  computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
627
- external: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
633
+ external: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
634
+ params: (0, import_superstruct3.optional)(sPageParams)
628
635
  });
629
636
  var sDividerBlock2 = (0, import_superstruct3.object)({ type: (0, import_superstruct3.literal)("divider" /* Divider */) });
630
637
  var sActionBlock2 = (0, import_superstruct3.object)({
@@ -633,7 +640,18 @@ var sActionBlock2 = (0, import_superstruct3.object)({
633
640
  label: (0, import_superstruct3.string)(),
634
641
  variant: (0, import_superstruct3.optional)(sContentActionVariant)
635
642
  });
636
- var sTableCell = (0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.number)(), (0, import_superstruct3.boolean)(), (0, import_superstruct3.literal)(null)]);
643
+ var sTableCell = (0, import_superstruct3.union)([
644
+ (0, import_superstruct3.string)(),
645
+ (0, import_superstruct3.number)(),
646
+ (0, import_superstruct3.boolean)(),
647
+ (0, import_superstruct3.literal)(null),
648
+ (0, import_superstruct3.object)({
649
+ text: (0, import_superstruct3.string)(),
650
+ caption: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
651
+ image: (0, import_superstruct3.optional)((0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.literal)(null)])),
652
+ tone: (0, import_superstruct3.optional)(sMessageVariant2)
653
+ })
654
+ ]);
637
655
  var sStatBlock = (0, import_superstruct3.object)({
638
656
  type: (0, import_superstruct3.literal)("stat" /* Stat */),
639
657
  label: (0, import_superstruct3.string)(),
@@ -641,7 +659,9 @@ var sStatBlock = (0, import_superstruct3.object)({
641
659
  computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
642
660
  hint: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
643
661
  variant: (0, import_superstruct3.optional)(sMessageVariant2),
644
- estimate: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
662
+ estimate: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
663
+ params: (0, import_superstruct3.optional)(sPageParams),
664
+ trend: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.union)([(0, import_superstruct3.number)(), (0, import_superstruct3.literal)(null)])))
645
665
  });
646
666
  var sTableBlock = (0, import_superstruct3.object)({
647
667
  type: (0, import_superstruct3.literal)("table" /* Table */),
@@ -650,30 +670,126 @@ var sTableBlock = (0, import_superstruct3.object)({
650
670
  (0, import_superstruct3.object)({
651
671
  key: (0, import_superstruct3.string)(),
652
672
  label: (0, import_superstruct3.string)(),
653
- align: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["left", "right"]))
673
+ align: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["left", "right"])),
674
+ hint: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
675
+ sort: (0, import_superstruct3.optional)(
676
+ (0, import_superstruct3.object)({
677
+ value: (0, import_superstruct3.string)(),
678
+ dir: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["asc", "desc"]))
679
+ })
680
+ )
654
681
  })
655
682
  ),
656
683
  rows: (0, import_superstruct3.array)((0, import_superstruct3.record)((0, import_superstruct3.string)(), sTableCell)),
657
- emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
684
+ emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
685
+ rowParams: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.union)([sPageParams, (0, import_superstruct3.literal)(null)]))),
686
+ sort: (0, import_superstruct3.optional)(
687
+ (0, import_superstruct3.object)({
688
+ param: (0, import_superstruct3.string)(),
689
+ value: (0, import_superstruct3.string)(),
690
+ resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
691
+ })
692
+ ),
693
+ pagination: (0, import_superstruct3.optional)(
694
+ (0, import_superstruct3.object)({
695
+ param: (0, import_superstruct3.string)(),
696
+ page: (0, import_superstruct3.number)(),
697
+ pageSize: (0, import_superstruct3.number)(),
698
+ total: (0, import_superstruct3.number)()
699
+ })
700
+ )
701
+ });
702
+ var sChartFormat = (0, import_superstruct3.enums)(["number", "currency", "percent"]);
703
+ var sChartAxis = (0, import_superstruct3.object)({
704
+ label: (0, import_superstruct3.string)(),
705
+ format: (0, import_superstruct3.optional)(sChartFormat),
706
+ scale: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["linear", "log"]))
658
707
  });
659
708
  var sChartBlock = (0, import_superstruct3.object)({
660
709
  type: (0, import_superstruct3.literal)("chart" /* Chart */),
661
- kind: (0, import_superstruct3.enums)(["bar", "line"]),
710
+ kind: (0, import_superstruct3.enums)(["bar", "line", "hbar", "area", "scatter"]),
662
711
  title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
712
+ summary: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
663
713
  labels: (0, import_superstruct3.array)((0, import_superstruct3.string)()),
664
714
  series: (0, import_superstruct3.array)(
665
715
  (0, import_superstruct3.object)({
666
716
  name: (0, import_superstruct3.string)(),
667
- data: (0, import_superstruct3.array)((0, import_superstruct3.union)([(0, import_superstruct3.number)(), (0, import_superstruct3.literal)(null)]))
717
+ data: (0, import_superstruct3.array)((0, import_superstruct3.union)([(0, import_superstruct3.number)(), (0, import_superstruct3.literal)(null)])),
718
+ tooltipOnly: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
719
+ format: (0, import_superstruct3.optional)(sChartFormat)
668
720
  })
669
721
  ),
670
722
  unit: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
671
- emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
723
+ format: (0, import_superstruct3.optional)(sChartFormat),
724
+ currency: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
725
+ emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
726
+ labelParams: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.union)([sPageParams, (0, import_superstruct3.literal)(null)]))),
727
+ highlight: (0, import_superstruct3.optional)((0, import_superstruct3.number)()),
728
+ references: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.object)({ value: (0, import_superstruct3.number)(), label: (0, import_superstruct3.string)() }))),
729
+ markers: (0, import_superstruct3.optional)(
730
+ (0, import_superstruct3.array)((0, import_superstruct3.object)({ label: (0, import_superstruct3.string)(), text: (0, import_superstruct3.string)(), tone: (0, import_superstruct3.optional)(sMessageVariant2) }))
731
+ ),
732
+ stacked: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
733
+ points: (0, import_superstruct3.optional)(
734
+ (0, import_superstruct3.array)(
735
+ (0, import_superstruct3.object)({
736
+ x: (0, import_superstruct3.number)(),
737
+ y: (0, import_superstruct3.number)(),
738
+ label: (0, import_superstruct3.string)(),
739
+ caption: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
740
+ params: (0, import_superstruct3.optional)(sPageParams),
741
+ muted: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
742
+ })
743
+ )
744
+ ),
745
+ xAxis: (0, import_superstruct3.optional)(sChartAxis),
746
+ yAxis: (0, import_superstruct3.optional)(sChartAxis),
747
+ quadrants: (0, import_superstruct3.optional)(
748
+ (0, import_superstruct3.object)({
749
+ x: (0, import_superstruct3.number)(),
750
+ y: (0, import_superstruct3.number)(),
751
+ names: (0, import_superstruct3.optional)((0, import_superstruct3.tuple)([(0, import_superstruct3.string)(), (0, import_superstruct3.string)(), (0, import_superstruct3.string)(), (0, import_superstruct3.string)()]))
752
+ })
753
+ )
754
+ });
755
+ var sFilterBlock = (0, import_superstruct3.object)({
756
+ type: (0, import_superstruct3.literal)("filter" /* Filter */),
757
+ param: (0, import_superstruct3.string)(),
758
+ label: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
759
+ value: (0, import_superstruct3.string)(),
760
+ options: (0, import_superstruct3.size)((0, import_superstruct3.array)((0, import_superstruct3.object)({ value: (0, import_superstruct3.string)(), label: (0, import_superstruct3.string)() })), 1, Infinity),
761
+ display: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["segmented", "select", "tabs"])),
762
+ resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
763
+ });
764
+ var sSearchBlock = (0, import_superstruct3.object)({
765
+ type: (0, import_superstruct3.literal)("search" /* Search */),
766
+ param: (0, import_superstruct3.string)(),
767
+ value: (0, import_superstruct3.string)(),
768
+ label: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
769
+ placeholder: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
770
+ resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
771
+ });
772
+ var sToolbarBlock = (0, import_superstruct3.object)({
773
+ type: (0, import_superstruct3.literal)("toolbar" /* Toolbar */),
774
+ blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
775
+ });
776
+ var sGridBlock = (0, import_superstruct3.object)({
777
+ type: (0, import_superstruct3.literal)("grid" /* Grid */),
778
+ columns: (0, import_superstruct3.union)([(0, import_superstruct3.literal)(2), (0, import_superstruct3.literal)(3), (0, import_superstruct3.literal)(4)]),
779
+ layout: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["even", "main-aside"])),
780
+ blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
781
+ });
782
+ var sDetailsBlock = (0, import_superstruct3.object)({
783
+ type: (0, import_superstruct3.literal)("details" /* Details */),
784
+ summary: (0, import_superstruct3.string)(),
785
+ blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock)),
786
+ open: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
672
787
  });
673
788
  var sCardBlock2 = (0, import_superstruct3.object)({
674
789
  type: (0, import_superstruct3.literal)("card" /* Card */),
675
790
  title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
676
791
  description: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
792
+ image: (0, import_superstruct3.optional)((0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.literal)(null)])),
677
793
  blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
678
794
  });
679
795
  var sContentBlock = (0, import_superstruct3.union)([
@@ -688,7 +804,12 @@ var sContentBlock = (0, import_superstruct3.union)([
688
804
  sCardBlock2,
689
805
  sStatBlock,
690
806
  sTableBlock,
691
- sChartBlock
807
+ sChartBlock,
808
+ sFilterBlock,
809
+ sGridBlock,
810
+ sSearchBlock,
811
+ sDetailsBlock,
812
+ sToolbarBlock
692
813
  ]);
693
814
  var sUiContribution = (0, import_superstruct3.object)({
694
815
  slot: (0, import_superstruct3.string)(),
@@ -789,7 +910,7 @@ function checkPermissions(required, grantedRaw) {
789
910
  }
790
911
 
791
912
  // src/version.ts
792
- var SDK_VERSION = "0.7.1";
913
+ var SDK_VERSION = "0.8.0";
793
914
  function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
794
915
  const parse = (v) => {
795
916
  const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
package/dist/index.mjs CHANGED
@@ -518,7 +518,9 @@ import {
518
518
  object as object2,
519
519
  optional as optional3,
520
520
  record,
521
+ size,
521
522
  string as string3,
523
+ tuple,
522
524
  union as union2,
523
525
  validate as validate3
524
526
  } from "superstruct";
@@ -535,6 +537,11 @@ var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
535
537
  ContentBlockType2["Stat"] = "stat";
536
538
  ContentBlockType2["Table"] = "table";
537
539
  ContentBlockType2["Chart"] = "chart";
540
+ ContentBlockType2["Filter"] = "filter";
541
+ ContentBlockType2["Grid"] = "grid";
542
+ ContentBlockType2["Search"] = "search";
543
+ ContentBlockType2["Details"] = "details";
544
+ ContentBlockType2["Toolbar"] = "toolbar";
538
545
  return ContentBlockType2;
539
546
  })(ContentBlockType || {});
540
547
  var UiSlot = {
@@ -582,12 +589,14 @@ var sCopyFieldBlock2 = object2({
582
589
  value: optional3(string3()),
583
590
  computedKey: optional3(string3())
584
591
  });
592
+ var sPageParams = record(string3(), union2([string3(), literal2(null)]));
585
593
  var sLinkBlock = object2({
586
594
  type: literal2("link" /* Link */),
587
595
  label: string3(),
588
596
  href: optional3(string3()),
589
597
  computedKey: optional3(string3()),
590
- external: optional3(boolean3())
598
+ external: optional3(boolean3()),
599
+ params: optional3(sPageParams)
591
600
  });
592
601
  var sDividerBlock2 = object2({ type: literal2("divider" /* Divider */) });
593
602
  var sActionBlock2 = object2({
@@ -596,7 +605,18 @@ var sActionBlock2 = object2({
596
605
  label: string3(),
597
606
  variant: optional3(sContentActionVariant)
598
607
  });
599
- var sTableCell = union2([string3(), number3(), boolean3(), literal2(null)]);
608
+ var sTableCell = union2([
609
+ string3(),
610
+ number3(),
611
+ boolean3(),
612
+ literal2(null),
613
+ object2({
614
+ text: string3(),
615
+ caption: optional3(string3()),
616
+ image: optional3(union2([string3(), literal2(null)])),
617
+ tone: optional3(sMessageVariant2)
618
+ })
619
+ ]);
600
620
  var sStatBlock = object2({
601
621
  type: literal2("stat" /* Stat */),
602
622
  label: string3(),
@@ -604,7 +624,9 @@ var sStatBlock = object2({
604
624
  computedKey: optional3(string3()),
605
625
  hint: optional3(string3()),
606
626
  variant: optional3(sMessageVariant2),
607
- estimate: optional3(boolean3())
627
+ estimate: optional3(boolean3()),
628
+ params: optional3(sPageParams),
629
+ trend: optional3(array2(union2([number3(), literal2(null)])))
608
630
  });
609
631
  var sTableBlock = object2({
610
632
  type: literal2("table" /* Table */),
@@ -613,30 +635,126 @@ var sTableBlock = object2({
613
635
  object2({
614
636
  key: string3(),
615
637
  label: string3(),
616
- align: optional3(enums3(["left", "right"]))
638
+ align: optional3(enums3(["left", "right"])),
639
+ hint: optional3(string3()),
640
+ sort: optional3(
641
+ object2({
642
+ value: string3(),
643
+ dir: optional3(enums3(["asc", "desc"]))
644
+ })
645
+ )
617
646
  })
618
647
  ),
619
648
  rows: array2(record(string3(), sTableCell)),
620
- emptyText: optional3(string3())
649
+ emptyText: optional3(string3()),
650
+ rowParams: optional3(array2(union2([sPageParams, literal2(null)]))),
651
+ sort: optional3(
652
+ object2({
653
+ param: string3(),
654
+ value: string3(),
655
+ resets: optional3(array2(string3()))
656
+ })
657
+ ),
658
+ pagination: optional3(
659
+ object2({
660
+ param: string3(),
661
+ page: number3(),
662
+ pageSize: number3(),
663
+ total: number3()
664
+ })
665
+ )
666
+ });
667
+ var sChartFormat = enums3(["number", "currency", "percent"]);
668
+ var sChartAxis = object2({
669
+ label: string3(),
670
+ format: optional3(sChartFormat),
671
+ scale: optional3(enums3(["linear", "log"]))
621
672
  });
622
673
  var sChartBlock = object2({
623
674
  type: literal2("chart" /* Chart */),
624
- kind: enums3(["bar", "line"]),
675
+ kind: enums3(["bar", "line", "hbar", "area", "scatter"]),
625
676
  title: optional3(string3()),
677
+ summary: optional3(string3()),
626
678
  labels: array2(string3()),
627
679
  series: array2(
628
680
  object2({
629
681
  name: string3(),
630
- data: array2(union2([number3(), literal2(null)]))
682
+ data: array2(union2([number3(), literal2(null)])),
683
+ tooltipOnly: optional3(boolean3()),
684
+ format: optional3(sChartFormat)
631
685
  })
632
686
  ),
633
687
  unit: optional3(string3()),
634
- emptyText: optional3(string3())
688
+ format: optional3(sChartFormat),
689
+ currency: optional3(string3()),
690
+ emptyText: optional3(string3()),
691
+ labelParams: optional3(array2(union2([sPageParams, literal2(null)]))),
692
+ highlight: optional3(number3()),
693
+ references: optional3(array2(object2({ value: number3(), label: string3() }))),
694
+ markers: optional3(
695
+ array2(object2({ label: string3(), text: string3(), tone: optional3(sMessageVariant2) }))
696
+ ),
697
+ stacked: optional3(boolean3()),
698
+ points: optional3(
699
+ array2(
700
+ object2({
701
+ x: number3(),
702
+ y: number3(),
703
+ label: string3(),
704
+ caption: optional3(string3()),
705
+ params: optional3(sPageParams),
706
+ muted: optional3(boolean3())
707
+ })
708
+ )
709
+ ),
710
+ xAxis: optional3(sChartAxis),
711
+ yAxis: optional3(sChartAxis),
712
+ quadrants: optional3(
713
+ object2({
714
+ x: number3(),
715
+ y: number3(),
716
+ names: optional3(tuple([string3(), string3(), string3(), string3()]))
717
+ })
718
+ )
719
+ });
720
+ var sFilterBlock = object2({
721
+ type: literal2("filter" /* Filter */),
722
+ param: string3(),
723
+ label: optional3(string3()),
724
+ value: string3(),
725
+ options: size(array2(object2({ value: string3(), label: string3() })), 1, Infinity),
726
+ display: optional3(enums3(["segmented", "select", "tabs"])),
727
+ resets: optional3(array2(string3()))
728
+ });
729
+ var sSearchBlock = object2({
730
+ type: literal2("search" /* Search */),
731
+ param: string3(),
732
+ value: string3(),
733
+ label: optional3(string3()),
734
+ placeholder: optional3(string3()),
735
+ resets: optional3(array2(string3()))
736
+ });
737
+ var sToolbarBlock = object2({
738
+ type: literal2("toolbar" /* Toolbar */),
739
+ blocks: array2(lazy2(() => sContentBlock))
740
+ });
741
+ var sGridBlock = object2({
742
+ type: literal2("grid" /* Grid */),
743
+ columns: union2([literal2(2), literal2(3), literal2(4)]),
744
+ layout: optional3(enums3(["even", "main-aside"])),
745
+ blocks: array2(lazy2(() => sContentBlock))
746
+ });
747
+ var sDetailsBlock = object2({
748
+ type: literal2("details" /* Details */),
749
+ summary: string3(),
750
+ blocks: array2(lazy2(() => sContentBlock)),
751
+ open: optional3(boolean3())
635
752
  });
636
753
  var sCardBlock2 = object2({
637
754
  type: literal2("card" /* Card */),
638
755
  title: optional3(string3()),
639
756
  description: optional3(string3()),
757
+ image: optional3(union2([string3(), literal2(null)])),
640
758
  blocks: array2(lazy2(() => sContentBlock))
641
759
  });
642
760
  var sContentBlock = union2([
@@ -651,7 +769,12 @@ var sContentBlock = union2([
651
769
  sCardBlock2,
652
770
  sStatBlock,
653
771
  sTableBlock,
654
- sChartBlock
772
+ sChartBlock,
773
+ sFilterBlock,
774
+ sGridBlock,
775
+ sSearchBlock,
776
+ sDetailsBlock,
777
+ sToolbarBlock
655
778
  ]);
656
779
  var sUiContribution = object2({
657
780
  slot: string3(),
@@ -720,7 +843,7 @@ function isPluginFactory(value) {
720
843
  }
721
844
 
722
845
  // src/version.ts
723
- var SDK_VERSION = "0.7.1";
846
+ var SDK_VERSION = "0.8.0";
724
847
  function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
725
848
  const parse = (v) => {
726
849
  const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
@@ -1,4 +1,4 @@
1
- import { a6 as HostApi, a8 as HttpRequest, Z as DomainEventName, v as Capability, Y as DomainEventHandler, a9 as HttpResponse, W as DispatchContext } from '../host-api-DVbKGytN.mjs';
1
+ import { ai as HostApi, ak as HttpRequest, a5 as DomainEventName, v as Capability, a4 as DomainEventHandler, al as HttpResponse, bt as SourcedProduct, a2 as DispatchContext } from '../host-api-D9g2w27d.mjs';
2
2
 
3
3
  /** Every recorded interaction, keyed by `"port.method"`. */
4
4
  interface MockHostCalls {
@@ -10,6 +10,7 @@ interface MockHostCalls {
10
10
  body: Uint8Array | string;
11
11
  }>;
12
12
  'sequence.next': string[];
13
+ 'catalog.listSourcedProducts': string[];
13
14
  'host.on': DomainEventName[];
14
15
  }
15
16
  interface MockHostOptions {
@@ -29,6 +30,11 @@ interface MockHostOptions {
29
30
  httpResponses?: Record<string, HttpResponse>;
30
31
  /** Seed values for named sequence scopes (monotonic from here). */
31
32
  sequences?: Record<string, number>;
33
+ /**
34
+ * Canned store products by supplier code (sourced products). When set, the mock exposes
35
+ * `catalog`; omit it to test a plugin against a host without that port.
36
+ */
37
+ sourcedProducts?: Record<string, SourcedProduct[]>;
32
38
  }
33
39
  interface MockHostApi extends HostApi {
34
40
  /** Every port call recorded in order. */
@@ -1,4 +1,4 @@
1
- import { a6 as HostApi, a8 as HttpRequest, Z as DomainEventName, v as Capability, Y as DomainEventHandler, a9 as HttpResponse, W as DispatchContext } from '../host-api-DVbKGytN.js';
1
+ import { ai as HostApi, ak as HttpRequest, a5 as DomainEventName, v as Capability, a4 as DomainEventHandler, al as HttpResponse, bt as SourcedProduct, a2 as DispatchContext } from '../host-api-D9g2w27d.js';
2
2
 
3
3
  /** Every recorded interaction, keyed by `"port.method"`. */
4
4
  interface MockHostCalls {
@@ -10,6 +10,7 @@ interface MockHostCalls {
10
10
  body: Uint8Array | string;
11
11
  }>;
12
12
  'sequence.next': string[];
13
+ 'catalog.listSourcedProducts': string[];
13
14
  'host.on': DomainEventName[];
14
15
  }
15
16
  interface MockHostOptions {
@@ -29,6 +30,11 @@ interface MockHostOptions {
29
30
  httpResponses?: Record<string, HttpResponse>;
30
31
  /** Seed values for named sequence scopes (monotonic from here). */
31
32
  sequences?: Record<string, number>;
33
+ /**
34
+ * Canned store products by supplier code (sourced products). When set, the mock exposes
35
+ * `catalog`; omit it to test a plugin against a host without that port.
36
+ */
37
+ sourcedProducts?: Record<string, SourcedProduct[]>;
32
38
  }
33
39
  interface MockHostApi extends HostApi {
34
40
  /** Every port call recorded in order. */
@@ -66,6 +66,7 @@ function createMockHostApi(opts = {}) {
66
66
  "storage.getUrl": [],
67
67
  "storage.put": [],
68
68
  "sequence.next": [],
69
+ "catalog.listSourcedProducts": [],
69
70
  "host.on": []
70
71
  };
71
72
  const registered = [];
@@ -128,12 +129,20 @@ function createMockHostApi(opts = {}) {
128
129
  return Promise.resolve(next);
129
130
  }
130
131
  };
132
+ const listings = opts.sourcedProducts;
133
+ const catalog = listings ? {
134
+ listSourcedProducts: (code) => {
135
+ calls["catalog.listSourcedProducts"].push(code);
136
+ return Promise.resolve(listings[code] ?? []);
137
+ }
138
+ } : void 0;
131
139
  const host = {
132
140
  logger,
133
141
  http,
134
142
  secrets,
135
143
  storage,
136
144
  sequence,
145
+ ...catalog ? { catalog } : {},
137
146
  calls,
138
147
  registered,
139
148
  handlers,
@@ -11,6 +11,7 @@ function createMockHostApi(opts = {}) {
11
11
  "storage.getUrl": [],
12
12
  "storage.put": [],
13
13
  "sequence.next": [],
14
+ "catalog.listSourcedProducts": [],
14
15
  "host.on": []
15
16
  };
16
17
  const registered = [];
@@ -73,12 +74,20 @@ function createMockHostApi(opts = {}) {
73
74
  return Promise.resolve(next);
74
75
  }
75
76
  };
77
+ const listings = opts.sourcedProducts;
78
+ const catalog = listings ? {
79
+ listSourcedProducts: (code) => {
80
+ calls["catalog.listSourcedProducts"].push(code);
81
+ return Promise.resolve(listings[code] ?? []);
82
+ }
83
+ } : void 0;
76
84
  const host = {
77
85
  logger,
78
86
  http,
79
87
  secrets,
80
88
  storage,
81
89
  sequence,
90
+ ...catalog ? { catalog } : {},
82
91
  calls,
83
92
  registered,
84
93
  handlers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivoa/plugin-sdk",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Public contracts for Vivoa plugins (types, DI tokens, config + setup-layout validators)",
5
5
  "license": "MIT",
6
6
  "author": "Vivoa",