@proteos/sdk 0.45.0 → 0.47.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.
Files changed (41) hide show
  1. package/dist/{chunk-IGIAJVX6.js → chunk-5KEJKXO5.js} +220 -34
  2. package/dist/chunk-5KEJKXO5.js.map +1 -0
  3. package/dist/{chunk-33EULWIM.cjs → chunk-Z7LC3GGU.cjs} +224 -33
  4. package/dist/chunk-Z7LC3GGU.cjs.map +1 -0
  5. package/dist/index.cjs +437 -179
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +659 -18
  8. package/dist/index.d.ts +659 -18
  9. package/dist/index.js +339 -97
  10. package/dist/index.js.map +1 -1
  11. package/dist/meta/index.cjs +69 -53
  12. package/dist/meta/index.d.cts +1 -1
  13. package/dist/meta/index.d.ts +1 -1
  14. package/dist/meta/index.js +1 -1
  15. package/dist/{types-BTdBFq34.d.cts → types-oECz4xTQ.d.cts} +578 -32
  16. package/dist/{types-BTdBFq34.d.ts → types-oECz4xTQ.d.ts} +578 -32
  17. package/package.json +1 -1
  18. package/src/auth/index.ts +58 -1
  19. package/src/auth/me.ts +14 -1
  20. package/src/auth/platform-entities.ts +27 -0
  21. package/src/auth/roles.ts +3 -1
  22. package/src/auth/shares.ts +181 -0
  23. package/src/auth/teams.ts +135 -0
  24. package/src/auth/types.ts +192 -4
  25. package/src/auth/user-role-assignments.ts +65 -0
  26. package/src/functions/actions.ts +29 -0
  27. package/src/functions/types.ts +6 -4
  28. package/src/index.ts +36 -0
  29. package/src/knowledge/graph.ts +6 -2
  30. package/src/knowledge/index.ts +15 -0
  31. package/src/knowledge/nodes.ts +4 -1
  32. package/src/knowledge/spaces.ts +86 -0
  33. package/src/knowledge/types.ts +89 -0
  34. package/src/meta/index.ts +11 -0
  35. package/src/meta/layout/control-registry.json +154 -27
  36. package/src/meta/layout/elements.ts +86 -0
  37. package/src/meta/layout/index.ts +2 -0
  38. package/src/meta/types.ts +245 -17
  39. package/src/workflow/types.ts +20 -3
  40. package/dist/chunk-33EULWIM.cjs.map +0 -1
  41. package/dist/chunk-IGIAJVX6.js.map +0 -1
@@ -638,52 +638,179 @@ var control_registry_default = {
638
638
  "tag-input",
639
639
  "entity-picker",
640
640
  "user-picker",
641
+ "principal-picker",
641
642
  "currency",
642
643
  "knowledge-text",
643
644
  "file",
644
- "file-viewer"
645
+ "file-viewer",
646
+ "record-filter"
645
647
  ],
646
648
  controls: {
647
649
  string: {
648
650
  primary: "text",
649
- compatible: ["text", "textarea", "password"],
651
+ compatible: [
652
+ "text",
653
+ "textarea",
654
+ "password",
655
+ "record-filter"
656
+ ],
650
657
  byFormat: {
651
- email: { primary: "email", compatible: ["email", "text"] },
652
- uri: { primary: "url", compatible: ["url", "text"] },
653
- uuid: { primary: "text", compatible: ["text"] },
654
- hostname: { primary: "text", compatible: ["text"] },
655
- ipv4: { primary: "text", compatible: ["text"] },
656
- ipv6: { primary: "text", compatible: ["text"] }
658
+ email: {
659
+ primary: "email",
660
+ compatible: [
661
+ "email",
662
+ "text"
663
+ ]
664
+ },
665
+ uri: {
666
+ primary: "url",
667
+ compatible: [
668
+ "url",
669
+ "text"
670
+ ]
671
+ },
672
+ uuid: {
673
+ primary: "text",
674
+ compatible: [
675
+ "text"
676
+ ]
677
+ },
678
+ hostname: {
679
+ primary: "text",
680
+ compatible: [
681
+ "text"
682
+ ]
683
+ },
684
+ ipv4: {
685
+ primary: "text",
686
+ compatible: [
687
+ "text"
688
+ ]
689
+ },
690
+ ipv6: {
691
+ primary: "text",
692
+ compatible: [
693
+ "text"
694
+ ]
695
+ }
657
696
  }
658
697
  },
659
- number: { primary: "number", compatible: ["number"] },
660
- integer: { primary: "number", compatible: ["number"] },
661
- boolean: { primary: "switch", compatible: ["switch", "checkbox"] },
662
- enum: { primary: "select", compatible: ["select", "radio-group", "chip-group"] },
698
+ number: {
699
+ primary: "number",
700
+ compatible: [
701
+ "number"
702
+ ]
703
+ },
704
+ integer: {
705
+ primary: "number",
706
+ compatible: [
707
+ "number"
708
+ ]
709
+ },
710
+ boolean: {
711
+ primary: "switch",
712
+ compatible: [
713
+ "switch",
714
+ "checkbox"
715
+ ]
716
+ },
717
+ enum: {
718
+ primary: "select",
719
+ compatible: [
720
+ "select",
721
+ "radio-group",
722
+ "chip-group"
723
+ ]
724
+ },
663
725
  array: {
664
726
  primary: "tag-input",
665
- compatible: ["tag-input"],
727
+ compatible: [
728
+ "tag-input"
729
+ ],
666
730
  byItemsType: {
667
- string: { primary: "tag-input", compatible: ["tag-input"] },
668
- enum: { primary: "multi-select", compatible: ["multi-select"] }
731
+ string: {
732
+ primary: "tag-input",
733
+ compatible: [
734
+ "tag-input"
735
+ ]
736
+ },
737
+ enum: {
738
+ primary: "multi-select",
739
+ compatible: [
740
+ "multi-select"
741
+ ]
742
+ }
669
743
  }
670
744
  },
671
745
  datetime: {
672
746
  primary: null,
673
747
  compatible: [],
674
748
  byFormat: {
675
- date: { primary: "date-picker", compatible: ["date-picker"] },
676
- "date-time": { primary: "datetime-picker", compatible: ["datetime-picker"] },
677
- time: { primary: "time-picker", compatible: ["time-picker"] },
678
- duration: { primary: null, compatible: [] }
749
+ date: {
750
+ primary: "date-picker",
751
+ compatible: [
752
+ "date-picker"
753
+ ]
754
+ },
755
+ "date-time": {
756
+ primary: "datetime-picker",
757
+ compatible: [
758
+ "datetime-picker"
759
+ ]
760
+ },
761
+ time: {
762
+ primary: "time-picker",
763
+ compatible: [
764
+ "time-picker"
765
+ ]
766
+ },
767
+ duration: {
768
+ primary: null,
769
+ compatible: []
770
+ }
679
771
  }
680
772
  },
681
- object: { primary: null, compatible: [] },
682
- relation: { primary: "entity-picker", compatible: ["entity-picker"] },
683
- user: { primary: "user-picker", compatible: ["user-picker"] },
684
- currency: { primary: "currency", compatible: ["currency"] },
685
- "knowledge-text": { primary: "knowledge-text", compatible: ["knowledge-text"] },
686
- file: { primary: "file", compatible: ["file", "file-viewer"] }
773
+ object: {
774
+ primary: null,
775
+ compatible: []
776
+ },
777
+ relation: {
778
+ primary: "entity-picker",
779
+ compatible: [
780
+ "entity-picker"
781
+ ]
782
+ },
783
+ user: {
784
+ primary: "user-picker",
785
+ compatible: [
786
+ "user-picker"
787
+ ]
788
+ },
789
+ currency: {
790
+ primary: "currency",
791
+ compatible: [
792
+ "currency"
793
+ ]
794
+ },
795
+ "knowledge-text": {
796
+ primary: "knowledge-text",
797
+ compatible: [
798
+ "knowledge-text"
799
+ ]
800
+ },
801
+ file: {
802
+ primary: "file",
803
+ compatible: [
804
+ "file",
805
+ "file-viewer"
806
+ ]
807
+ },
808
+ principal: {
809
+ primary: "principal-picker",
810
+ compatible: [
811
+ "principal-picker"
812
+ ]
813
+ }
687
814
  }
688
815
  };
689
816
 
@@ -789,7 +916,9 @@ var LayoutElementType = {
789
916
  RelatedRecord: "related_record",
790
917
  Component: "component",
791
918
  Divider: "divider",
792
- Text: "text"
919
+ Text: "text",
920
+ RecordFilter: "record_filter",
921
+ List: "list"
793
922
  };
794
923
  var LayoutElementSchema = zod.z.lazy(
795
924
  () => zod.z.discriminatedUnion("type", [
@@ -878,6 +1007,22 @@ var LayoutElementSchema = zod.z.lazy(
878
1007
  props: zod.z.record(zod.z.unknown()).optional(),
879
1008
  reserved_height: zod.z.number().positive().optional()
880
1009
  }),
1010
+ zod.z.object({
1011
+ type: zod.z.literal("record_filter"),
1012
+ ...commonPropsShape,
1013
+ subject_entity: zod.z.string().min(1).optional(),
1014
+ variant: zod.z.enum(["toolbar", "panel"]).optional(),
1015
+ is_complex_enabled: zod.z.boolean().optional()
1016
+ }),
1017
+ zod.z.object({
1018
+ type: zod.z.literal("list"),
1019
+ ...commonPropsShape,
1020
+ list_slugs: zod.z.array(zod.z.string().min(1)).min(1),
1021
+ filter_element_id: zod.z.string().min(1).optional(),
1022
+ filter_attribute: zod.z.string().min(1).optional(),
1023
+ subject_entity_attribute: zod.z.string().min(1).optional(),
1024
+ page_size: zod.z.number().int().positive().optional()
1025
+ }),
881
1026
  zod.z.object({
882
1027
  type: zod.z.literal("divider"),
883
1028
  ...commonPropsShape
@@ -956,6 +1101,14 @@ var AuditFieldsSchema = zod.z.object({
956
1101
  });
957
1102
 
958
1103
  // src/meta/types.ts
1104
+ var AttributeAccessRuleSchema = zod.z.object({
1105
+ roles: zod.z.array(zod.z.string()).optional(),
1106
+ teams: zod.z.array(zod.z.string()).optional()
1107
+ });
1108
+ var AttributeRestrictionsSchema = zod.z.object({
1109
+ read: AttributeAccessRuleSchema.optional(),
1110
+ write: AttributeAccessRuleSchema.optional()
1111
+ });
959
1112
  var OnDeleteActionSchema = zod.z.enum(["cascade", "restrict", "set-null"]);
960
1113
  var RelationAttributeMetaSchema = zod.z.object({
961
1114
  related_entity_slug: zod.z.string(),
@@ -967,6 +1120,15 @@ var RelationAttributeMetaSchema = zod.z.object({
967
1120
  var UserAttributeMetaSchema = zod.z.object({
968
1121
  description: zod.z.string().optional()
969
1122
  });
1123
+ var PrincipalAttributeMetaSchema = zod.z.object({
1124
+ description: zod.z.string().optional(),
1125
+ grants: zod.z.array(zod.z.enum(["read", "write", "delete", "share"])).optional(),
1126
+ allowed_types: zod.z.array(zod.z.enum(["person", "agent", "api", "team", "org"])).optional()
1127
+ });
1128
+ var PrincipalRefSchema = zod.z.object({
1129
+ type: zod.z.enum(["person", "agent", "api", "team", "org"]),
1130
+ id: zod.z.string()
1131
+ });
970
1132
  var CurrencyAttributeMetaSchema = zod.z.object({
971
1133
  default_currency_code: zod.z.string().optional(),
972
1134
  allowed_currency_codes: zod.z.array(zod.z.string()).optional()
@@ -1052,6 +1214,7 @@ var AttributeSchema = zod.z.object({
1052
1214
  is_nullable: zod.z.boolean().optional(),
1053
1215
  is_unique: zod.z.boolean(),
1054
1216
  is_read_only: zod.z.boolean().optional(),
1217
+ restrictions: AttributeRestrictionsSchema.optional(),
1055
1218
  default_value: zod.z.unknown().optional(),
1056
1219
  meta: zod.z.unknown().optional(),
1057
1220
  options: zod.z.record(zod.z.unknown()).optional()
@@ -1066,6 +1229,12 @@ function parseCurrencyMeta(attr) {
1066
1229
  const parsed = CurrencyAttributeMetaSchema.safeParse(attr.meta ?? {});
1067
1230
  return parsed.success ? parsed.data : null;
1068
1231
  }
1232
+ function parsePrincipalMeta(attr) {
1233
+ if (attr.type !== "principal") return null;
1234
+ if (attr.meta == null) return {};
1235
+ const parsed = PrincipalAttributeMetaSchema.safeParse(attr.meta);
1236
+ return parsed.success ? parsed.data : {};
1237
+ }
1069
1238
  function parseUserMeta(attr) {
1070
1239
  if (attr.type !== "user") return null;
1071
1240
  if (attr.meta == null) return {};
@@ -1125,6 +1294,17 @@ var ComponentSchema = AuditFieldsSchema.extend({
1125
1294
  props_schema: zod.z.record(zod.z.unknown()).nullable(),
1126
1295
  is_public: zod.z.boolean().default(false)
1127
1296
  });
1297
+ var PageActionSchema = zod.z.object({
1298
+ label: zod.z.string(),
1299
+ icon: zod.z.string(),
1300
+ kind: zod.z.enum(["action", "workflow"]).optional(),
1301
+ action: zod.z.string().optional(),
1302
+ workflow: zod.z.string().optional(),
1303
+ params: zod.z.record(zod.z.string()).optional(),
1304
+ inputs: zod.z.record(zod.z.string()).optional(),
1305
+ skip_confirmation: zod.z.boolean().optional()
1306
+ });
1307
+ var SelectionModeSchema = zod.z.enum(["on_demand", "always", "off"]);
1128
1308
  var ColumnSchema = zod.z.object({
1129
1309
  attribute: zod.z.string(),
1130
1310
  label: zod.z.string(),
@@ -1140,6 +1320,8 @@ var ListSchema = AuditFieldsSchema.extend({
1140
1320
  name: zod.z.string(),
1141
1321
  entity_slug: zod.z.string(),
1142
1322
  columns: zod.z.array(ColumnSchema),
1323
+ actions: zod.z.array(PageActionSchema).optional(),
1324
+ selection_mode: SelectionModeSchema.optional(),
1143
1325
  default_page_slug: zod.z.string().optional(),
1144
1326
  sorting: zod.z.array(SortConfigSchema),
1145
1327
  filters: zod.z.array(FilterGroupSchema)
@@ -1153,11 +1335,6 @@ var ListViewSchema = AuditFieldsSchema.extend({
1153
1335
  sorting: zod.z.array(SortConfigSchema),
1154
1336
  filters: zod.z.array(FilterGroupSchema)
1155
1337
  });
1156
- var PageActionSchema = zod.z.object({
1157
- label: zod.z.string(),
1158
- icon: zod.z.string(),
1159
- action: zod.z.string()
1160
- });
1161
1338
  var PageTypeSchema = zod.z.enum(["record", "platform", "kiosk", "public"]);
1162
1339
  var PageSchema = AuditFieldsSchema.extend({
1163
1340
  slug: zod.z.string(),
@@ -1209,6 +1386,15 @@ var DesignReferenceSchema = AuditFieldsSchema.extend({
1209
1386
  description: zod.z.string(),
1210
1387
  content: zod.z.string().optional()
1211
1388
  });
1389
+ var CURRENT_USER_DEFAULT = { type: "current_user" };
1390
+ function isCurrentUserDefault(value) {
1391
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1392
+ const keys = Object.keys(value);
1393
+ return keys.length === 1 && value.type === "current_user";
1394
+ }
1395
+ function acceptsCurrentUserDefault(type) {
1396
+ return type === "user" || type === "principal";
1397
+ }
1212
1398
 
1213
1399
  // src/meta/index.ts
1214
1400
  var MetaClient = class {
@@ -1275,6 +1461,7 @@ exports.AppSchema = AppSchema;
1275
1461
  exports.AttributeSchema = AttributeSchema;
1276
1462
  exports.AuditFieldsSchema = AuditFieldsSchema;
1277
1463
  exports.BUILT_IN_CONTROLS = BUILT_IN_CONTROLS;
1464
+ exports.CURRENT_USER_DEFAULT = CURRENT_USER_DEFAULT;
1278
1465
  exports.ColumnSchema = ColumnSchema;
1279
1466
  exports.ComponentSchema = ComponentSchema;
1280
1467
  exports.CurrencyAttributeMetaSchema = CurrencyAttributeMetaSchema;
@@ -1306,6 +1493,7 @@ exports.PageLayoutSchema = PageLayoutSchema;
1306
1493
  exports.PageLayoutSidePanelSchema = PageLayoutSidePanelSchema;
1307
1494
  exports.PageSchema = PageSchema;
1308
1495
  exports.PageStyleSchema = PageStyleSchema;
1496
+ exports.PrincipalRefSchema = PrincipalRefSchema;
1309
1497
  exports.RelationAttributeMetaSchema = RelationAttributeMetaSchema;
1310
1498
  exports.ResponseMetaSchema = ResponseMetaSchema;
1311
1499
  exports.SizeValueSchema = SizeValueSchema;
@@ -1313,6 +1501,7 @@ exports.SortConfigSchema = SortConfigSchema;
1313
1501
  exports.UserAttributeMetaSchema = UserAttributeMetaSchema;
1314
1502
  exports.UserRefSchema = UserRefSchema;
1315
1503
  exports.VariableSchema = VariableSchema;
1504
+ exports.acceptsCurrentUserDefault = acceptsCurrentUserDefault;
1316
1505
  exports.allCurrencyCodes = allCurrencyCodes;
1317
1506
  exports.createIterator = createIterator;
1318
1507
  exports.createListResultSchema = createListResultSchema;
@@ -1322,6 +1511,7 @@ exports.currencySymbolSide = currencySymbolSide;
1322
1511
  exports.formatAmount = formatAmount;
1323
1512
  exports.formatMoney = formatMoney;
1324
1513
  exports.isBuiltInControl = isBuiltInControl;
1514
+ exports.isCurrentUserDefault = isCurrentUserDefault;
1325
1515
  exports.isPlatformAttributeName = isPlatformAttributeName;
1326
1516
  exports.localeNumberSeparators = localeNumberSeparators;
1327
1517
  exports.lookupCompatibleControls = lookupCompatibleControls;
@@ -1330,8 +1520,9 @@ exports.lookupPrimaryControl = lookupPrimaryControl;
1330
1520
  exports.parseAmount = parseAmount;
1331
1521
  exports.parseCurrencyMeta = parseCurrencyMeta;
1332
1522
  exports.parseFileMeta = parseFileMeta;
1523
+ exports.parsePrincipalMeta = parsePrincipalMeta;
1333
1524
  exports.parseRelationMeta = parseRelationMeta;
1334
1525
  exports.parseUserMeta = parseUserMeta;
1335
1526
  exports.platformAttributes = platformAttributes;
1336
- //# sourceMappingURL=chunk-33EULWIM.cjs.map
1337
- //# sourceMappingURL=chunk-33EULWIM.cjs.map
1527
+ //# sourceMappingURL=chunk-Z7LC3GGU.cjs.map
1528
+ //# sourceMappingURL=chunk-Z7LC3GGU.cjs.map