@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
@@ -636,52 +636,179 @@ var control_registry_default = {
636
636
  "tag-input",
637
637
  "entity-picker",
638
638
  "user-picker",
639
+ "principal-picker",
639
640
  "currency",
640
641
  "knowledge-text",
641
642
  "file",
642
- "file-viewer"
643
+ "file-viewer",
644
+ "record-filter"
643
645
  ],
644
646
  controls: {
645
647
  string: {
646
648
  primary: "text",
647
- compatible: ["text", "textarea", "password"],
649
+ compatible: [
650
+ "text",
651
+ "textarea",
652
+ "password",
653
+ "record-filter"
654
+ ],
648
655
  byFormat: {
649
- email: { primary: "email", compatible: ["email", "text"] },
650
- uri: { primary: "url", compatible: ["url", "text"] },
651
- uuid: { primary: "text", compatible: ["text"] },
652
- hostname: { primary: "text", compatible: ["text"] },
653
- ipv4: { primary: "text", compatible: ["text"] },
654
- ipv6: { primary: "text", compatible: ["text"] }
656
+ email: {
657
+ primary: "email",
658
+ compatible: [
659
+ "email",
660
+ "text"
661
+ ]
662
+ },
663
+ uri: {
664
+ primary: "url",
665
+ compatible: [
666
+ "url",
667
+ "text"
668
+ ]
669
+ },
670
+ uuid: {
671
+ primary: "text",
672
+ compatible: [
673
+ "text"
674
+ ]
675
+ },
676
+ hostname: {
677
+ primary: "text",
678
+ compatible: [
679
+ "text"
680
+ ]
681
+ },
682
+ ipv4: {
683
+ primary: "text",
684
+ compatible: [
685
+ "text"
686
+ ]
687
+ },
688
+ ipv6: {
689
+ primary: "text",
690
+ compatible: [
691
+ "text"
692
+ ]
693
+ }
655
694
  }
656
695
  },
657
- number: { primary: "number", compatible: ["number"] },
658
- integer: { primary: "number", compatible: ["number"] },
659
- boolean: { primary: "switch", compatible: ["switch", "checkbox"] },
660
- enum: { primary: "select", compatible: ["select", "radio-group", "chip-group"] },
696
+ number: {
697
+ primary: "number",
698
+ compatible: [
699
+ "number"
700
+ ]
701
+ },
702
+ integer: {
703
+ primary: "number",
704
+ compatible: [
705
+ "number"
706
+ ]
707
+ },
708
+ boolean: {
709
+ primary: "switch",
710
+ compatible: [
711
+ "switch",
712
+ "checkbox"
713
+ ]
714
+ },
715
+ enum: {
716
+ primary: "select",
717
+ compatible: [
718
+ "select",
719
+ "radio-group",
720
+ "chip-group"
721
+ ]
722
+ },
661
723
  array: {
662
724
  primary: "tag-input",
663
- compatible: ["tag-input"],
725
+ compatible: [
726
+ "tag-input"
727
+ ],
664
728
  byItemsType: {
665
- string: { primary: "tag-input", compatible: ["tag-input"] },
666
- enum: { primary: "multi-select", compatible: ["multi-select"] }
729
+ string: {
730
+ primary: "tag-input",
731
+ compatible: [
732
+ "tag-input"
733
+ ]
734
+ },
735
+ enum: {
736
+ primary: "multi-select",
737
+ compatible: [
738
+ "multi-select"
739
+ ]
740
+ }
667
741
  }
668
742
  },
669
743
  datetime: {
670
744
  primary: null,
671
745
  compatible: [],
672
746
  byFormat: {
673
- date: { primary: "date-picker", compatible: ["date-picker"] },
674
- "date-time": { primary: "datetime-picker", compatible: ["datetime-picker"] },
675
- time: { primary: "time-picker", compatible: ["time-picker"] },
676
- duration: { primary: null, compatible: [] }
747
+ date: {
748
+ primary: "date-picker",
749
+ compatible: [
750
+ "date-picker"
751
+ ]
752
+ },
753
+ "date-time": {
754
+ primary: "datetime-picker",
755
+ compatible: [
756
+ "datetime-picker"
757
+ ]
758
+ },
759
+ time: {
760
+ primary: "time-picker",
761
+ compatible: [
762
+ "time-picker"
763
+ ]
764
+ },
765
+ duration: {
766
+ primary: null,
767
+ compatible: []
768
+ }
677
769
  }
678
770
  },
679
- object: { primary: null, compatible: [] },
680
- relation: { primary: "entity-picker", compatible: ["entity-picker"] },
681
- user: { primary: "user-picker", compatible: ["user-picker"] },
682
- currency: { primary: "currency", compatible: ["currency"] },
683
- "knowledge-text": { primary: "knowledge-text", compatible: ["knowledge-text"] },
684
- file: { primary: "file", compatible: ["file", "file-viewer"] }
771
+ object: {
772
+ primary: null,
773
+ compatible: []
774
+ },
775
+ relation: {
776
+ primary: "entity-picker",
777
+ compatible: [
778
+ "entity-picker"
779
+ ]
780
+ },
781
+ user: {
782
+ primary: "user-picker",
783
+ compatible: [
784
+ "user-picker"
785
+ ]
786
+ },
787
+ currency: {
788
+ primary: "currency",
789
+ compatible: [
790
+ "currency"
791
+ ]
792
+ },
793
+ "knowledge-text": {
794
+ primary: "knowledge-text",
795
+ compatible: [
796
+ "knowledge-text"
797
+ ]
798
+ },
799
+ file: {
800
+ primary: "file",
801
+ compatible: [
802
+ "file",
803
+ "file-viewer"
804
+ ]
805
+ },
806
+ principal: {
807
+ primary: "principal-picker",
808
+ compatible: [
809
+ "principal-picker"
810
+ ]
811
+ }
685
812
  }
686
813
  };
687
814
 
@@ -787,7 +914,9 @@ var LayoutElementType = {
787
914
  RelatedRecord: "related_record",
788
915
  Component: "component",
789
916
  Divider: "divider",
790
- Text: "text"
917
+ Text: "text",
918
+ RecordFilter: "record_filter",
919
+ List: "list"
791
920
  };
792
921
  var LayoutElementSchema = z.lazy(
793
922
  () => z.discriminatedUnion("type", [
@@ -876,6 +1005,22 @@ var LayoutElementSchema = z.lazy(
876
1005
  props: z.record(z.unknown()).optional(),
877
1006
  reserved_height: z.number().positive().optional()
878
1007
  }),
1008
+ z.object({
1009
+ type: z.literal("record_filter"),
1010
+ ...commonPropsShape,
1011
+ subject_entity: z.string().min(1).optional(),
1012
+ variant: z.enum(["toolbar", "panel"]).optional(),
1013
+ is_complex_enabled: z.boolean().optional()
1014
+ }),
1015
+ z.object({
1016
+ type: z.literal("list"),
1017
+ ...commonPropsShape,
1018
+ list_slugs: z.array(z.string().min(1)).min(1),
1019
+ filter_element_id: z.string().min(1).optional(),
1020
+ filter_attribute: z.string().min(1).optional(),
1021
+ subject_entity_attribute: z.string().min(1).optional(),
1022
+ page_size: z.number().int().positive().optional()
1023
+ }),
879
1024
  z.object({
880
1025
  type: z.literal("divider"),
881
1026
  ...commonPropsShape
@@ -954,6 +1099,14 @@ var AuditFieldsSchema = z.object({
954
1099
  });
955
1100
 
956
1101
  // src/meta/types.ts
1102
+ var AttributeAccessRuleSchema = z.object({
1103
+ roles: z.array(z.string()).optional(),
1104
+ teams: z.array(z.string()).optional()
1105
+ });
1106
+ var AttributeRestrictionsSchema = z.object({
1107
+ read: AttributeAccessRuleSchema.optional(),
1108
+ write: AttributeAccessRuleSchema.optional()
1109
+ });
957
1110
  var OnDeleteActionSchema = z.enum(["cascade", "restrict", "set-null"]);
958
1111
  var RelationAttributeMetaSchema = z.object({
959
1112
  related_entity_slug: z.string(),
@@ -965,6 +1118,15 @@ var RelationAttributeMetaSchema = z.object({
965
1118
  var UserAttributeMetaSchema = z.object({
966
1119
  description: z.string().optional()
967
1120
  });
1121
+ var PrincipalAttributeMetaSchema = z.object({
1122
+ description: z.string().optional(),
1123
+ grants: z.array(z.enum(["read", "write", "delete", "share"])).optional(),
1124
+ allowed_types: z.array(z.enum(["person", "agent", "api", "team", "org"])).optional()
1125
+ });
1126
+ var PrincipalRefSchema = z.object({
1127
+ type: z.enum(["person", "agent", "api", "team", "org"]),
1128
+ id: z.string()
1129
+ });
968
1130
  var CurrencyAttributeMetaSchema = z.object({
969
1131
  default_currency_code: z.string().optional(),
970
1132
  allowed_currency_codes: z.array(z.string()).optional()
@@ -1050,6 +1212,7 @@ var AttributeSchema = z.object({
1050
1212
  is_nullable: z.boolean().optional(),
1051
1213
  is_unique: z.boolean(),
1052
1214
  is_read_only: z.boolean().optional(),
1215
+ restrictions: AttributeRestrictionsSchema.optional(),
1053
1216
  default_value: z.unknown().optional(),
1054
1217
  meta: z.unknown().optional(),
1055
1218
  options: z.record(z.unknown()).optional()
@@ -1064,6 +1227,12 @@ function parseCurrencyMeta(attr) {
1064
1227
  const parsed = CurrencyAttributeMetaSchema.safeParse(attr.meta ?? {});
1065
1228
  return parsed.success ? parsed.data : null;
1066
1229
  }
1230
+ function parsePrincipalMeta(attr) {
1231
+ if (attr.type !== "principal") return null;
1232
+ if (attr.meta == null) return {};
1233
+ const parsed = PrincipalAttributeMetaSchema.safeParse(attr.meta);
1234
+ return parsed.success ? parsed.data : {};
1235
+ }
1067
1236
  function parseUserMeta(attr) {
1068
1237
  if (attr.type !== "user") return null;
1069
1238
  if (attr.meta == null) return {};
@@ -1123,6 +1292,17 @@ var ComponentSchema = AuditFieldsSchema.extend({
1123
1292
  props_schema: z.record(z.unknown()).nullable(),
1124
1293
  is_public: z.boolean().default(false)
1125
1294
  });
1295
+ var PageActionSchema = z.object({
1296
+ label: z.string(),
1297
+ icon: z.string(),
1298
+ kind: z.enum(["action", "workflow"]).optional(),
1299
+ action: z.string().optional(),
1300
+ workflow: z.string().optional(),
1301
+ params: z.record(z.string()).optional(),
1302
+ inputs: z.record(z.string()).optional(),
1303
+ skip_confirmation: z.boolean().optional()
1304
+ });
1305
+ var SelectionModeSchema = z.enum(["on_demand", "always", "off"]);
1126
1306
  var ColumnSchema = z.object({
1127
1307
  attribute: z.string(),
1128
1308
  label: z.string(),
@@ -1138,6 +1318,8 @@ var ListSchema = AuditFieldsSchema.extend({
1138
1318
  name: z.string(),
1139
1319
  entity_slug: z.string(),
1140
1320
  columns: z.array(ColumnSchema),
1321
+ actions: z.array(PageActionSchema).optional(),
1322
+ selection_mode: SelectionModeSchema.optional(),
1141
1323
  default_page_slug: z.string().optional(),
1142
1324
  sorting: z.array(SortConfigSchema),
1143
1325
  filters: z.array(FilterGroupSchema)
@@ -1151,11 +1333,6 @@ var ListViewSchema = AuditFieldsSchema.extend({
1151
1333
  sorting: z.array(SortConfigSchema),
1152
1334
  filters: z.array(FilterGroupSchema)
1153
1335
  });
1154
- var PageActionSchema = z.object({
1155
- label: z.string(),
1156
- icon: z.string(),
1157
- action: z.string()
1158
- });
1159
1336
  var PageTypeSchema = z.enum(["record", "platform", "kiosk", "public"]);
1160
1337
  var PageSchema = AuditFieldsSchema.extend({
1161
1338
  slug: z.string(),
@@ -1207,6 +1384,15 @@ var DesignReferenceSchema = AuditFieldsSchema.extend({
1207
1384
  description: z.string(),
1208
1385
  content: z.string().optional()
1209
1386
  });
1387
+ var CURRENT_USER_DEFAULT = { type: "current_user" };
1388
+ function isCurrentUserDefault(value) {
1389
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1390
+ const keys = Object.keys(value);
1391
+ return keys.length === 1 && value.type === "current_user";
1392
+ }
1393
+ function acceptsCurrentUserDefault(type) {
1394
+ return type === "user" || type === "principal";
1395
+ }
1210
1396
 
1211
1397
  // src/meta/index.ts
1212
1398
  var MetaClient = class {
@@ -1269,6 +1455,6 @@ var MetaClient = class {
1269
1455
  }
1270
1456
  };
1271
1457
 
1272
- export { AppSchema, AttributeSchema, AuditFieldsSchema, BUILT_IN_CONTROLS, ColumnSchema, ComponentSchema, CurrencyAttributeMetaSchema, DEFAULT_PAGE_SIZE, DONE, DesignReferenceSchema, EntitySchema, EntityWithSchemaSchema, FileAttributeMetaSchema, FileRefSchema, FilterElementSchema, FilterGroupSchema, LayoutElementSchema, LayoutElementType, ListSchema, ListViewSchema, MenuConfigurationSchema, MenuItemSchema, MenuItemType, MetaClient, ModuleSchema, OnDeleteActionSchema, PAGE_BACKGROUND_TOKENS, PLATFORM_ATTRIBUTE_NAMES, PLATFORM_USER_ID, PageActionSchema, PageIterator, PageLayoutSchema, PageLayoutSidePanelSchema, PageSchema, PageStyleSchema, RelationAttributeMetaSchema, ResponseMetaSchema, SizeValueSchema, SortConfigSchema, UserAttributeMetaSchema, UserRefSchema, VariableSchema, allCurrencyCodes, createIterator, createListResultSchema, currencyLabel, currencySymbol, currencySymbolSide, formatAmount, formatMoney, isBuiltInControl, isPlatformAttributeName, localeNumberSeparators, lookupCompatibleControls, lookupControls, lookupPrimaryControl, parseAmount, parseCurrencyMeta, parseFileMeta, parseRelationMeta, parseUserMeta, platformAttributes };
1273
- //# sourceMappingURL=chunk-IGIAJVX6.js.map
1274
- //# sourceMappingURL=chunk-IGIAJVX6.js.map
1458
+ export { AppSchema, AttributeSchema, AuditFieldsSchema, BUILT_IN_CONTROLS, CURRENT_USER_DEFAULT, ColumnSchema, ComponentSchema, CurrencyAttributeMetaSchema, DEFAULT_PAGE_SIZE, DONE, DesignReferenceSchema, EntitySchema, EntityWithSchemaSchema, FileAttributeMetaSchema, FileRefSchema, FilterElementSchema, FilterGroupSchema, LayoutElementSchema, LayoutElementType, ListSchema, ListViewSchema, MenuConfigurationSchema, MenuItemSchema, MenuItemType, MetaClient, ModuleSchema, OnDeleteActionSchema, PAGE_BACKGROUND_TOKENS, PLATFORM_ATTRIBUTE_NAMES, PLATFORM_USER_ID, PageActionSchema, PageIterator, PageLayoutSchema, PageLayoutSidePanelSchema, PageSchema, PageStyleSchema, PrincipalRefSchema, RelationAttributeMetaSchema, ResponseMetaSchema, SizeValueSchema, SortConfigSchema, UserAttributeMetaSchema, UserRefSchema, VariableSchema, acceptsCurrentUserDefault, allCurrencyCodes, createIterator, createListResultSchema, currencyLabel, currencySymbol, currencySymbolSide, formatAmount, formatMoney, isBuiltInControl, isCurrentUserDefault, isPlatformAttributeName, localeNumberSeparators, lookupCompatibleControls, lookupControls, lookupPrimaryControl, parseAmount, parseCurrencyMeta, parseFileMeta, parsePrincipalMeta, parseRelationMeta, parseUserMeta, platformAttributes };
1459
+ //# sourceMappingURL=chunk-5KEJKXO5.js.map
1460
+ //# sourceMappingURL=chunk-5KEJKXO5.js.map