@uniformdev/mesh-sdk 19.62.0 → 19.62.1-alpha.127

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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ApiClient, ClientOptions, ExceptProject } from '@uniformdev/context/api';
2
2
  import { ProjectMapNode } from '@uniformdev/project-map';
3
- import { DataType, DataSource, DataResourceVariables, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataVariableDefinition } from '@uniformdev/canvas';
3
+ import { AssetParamValue, DataType, DataSource, DataResourceVariables, RootComponentInstance, ComponentInstance, ComponentDefinition, ComponentDefinitionParameter, DataVariableDefinition } from '@uniformdev/canvas';
4
+ export { AssetParamValue, AssetParamValueItem } from '@uniformdev/canvas';
4
5
  import { Emitter } from 'mitt';
5
6
 
6
7
  /**
@@ -31,6 +32,7 @@ interface paths$1 {
31
32
  /** @enum {string} */
32
33
  category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
33
34
  public?: boolean;
35
+ scopes?: string[];
34
36
  baseLocationUrl?: string;
35
37
  locations: {
36
38
  install?: {
@@ -63,6 +65,8 @@ interface paths$1 {
63
65
  };
64
66
  };
65
67
  renderableInPropertyPanel?: boolean;
68
+ /** @enum {string} */
69
+ localizable?: "default-yes" | "default-no" | "yes" | "no";
66
70
  }[];
67
71
  };
68
72
  dataConnectors?: {
@@ -93,10 +97,68 @@ interface paths$1 {
93
97
  };
94
98
  badgeIconUrl?: string;
95
99
  }[];
100
+ assetLibrary?: {
101
+ assetLibraryUrl: string;
102
+ assetParameterUrl: string;
103
+ unstable_dynamicAssets?: {
104
+ dataConnectorId: string;
105
+ assetsListArchetypeId: string;
106
+ singleAssetArchetypeId: string;
107
+ };
108
+ };
109
+ unstable_assetLibrary?: {
110
+ url: string;
111
+ dynamicAssets?: {
112
+ dataConnectorId: string;
113
+ assetsListArchetypeId: string;
114
+ singleAssetArchetypeId: string;
115
+ };
116
+ };
117
+ ai?: {
118
+ generateUrl: string;
119
+ metadataUrl?: string;
120
+ prompts?: {
121
+ /** Format: uuid */
122
+ id: string;
123
+ name: string;
124
+ text: string;
125
+ data?: {
126
+ arguments?: {
127
+ [key: string]: {
128
+ type: string;
129
+ displayName?: string | null;
130
+ helpText?: string | null;
131
+ default?: string | null;
132
+ };
133
+ } | null;
134
+ metadata?: unknown | null;
135
+ } | null;
136
+ parameterTypes: string[];
137
+ }[];
138
+ };
96
139
  unstable_ai?: {
97
140
  generateUrl: string;
141
+ metadataUrl?: string;
98
142
  };
99
143
  };
144
+ unstable_prompts?: {
145
+ /** Format: uuid */
146
+ id: string;
147
+ name: string;
148
+ text: string;
149
+ data?: {
150
+ arguments?: {
151
+ [key: string]: {
152
+ type: string;
153
+ displayName?: string | null;
154
+ helpText?: string | null;
155
+ default?: string | null;
156
+ };
157
+ } | null;
158
+ metadata?: unknown | null;
159
+ } | null;
160
+ parameterTypes: string[];
161
+ }[];
100
162
  }[];
101
163
  };
102
164
  };
@@ -122,6 +184,7 @@ interface paths$1 {
122
184
  /** @enum {string} */
123
185
  category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
124
186
  public?: boolean;
187
+ scopes?: string[];
125
188
  baseLocationUrl?: string;
126
189
  locations: {
127
190
  install?: {
@@ -154,6 +217,8 @@ interface paths$1 {
154
217
  };
155
218
  };
156
219
  renderableInPropertyPanel?: boolean;
220
+ /** @enum {string} */
221
+ localizable?: "default-yes" | "default-no" | "yes" | "no";
157
222
  }[];
158
223
  };
159
224
  dataConnectors?: {
@@ -184,10 +249,68 @@ interface paths$1 {
184
249
  };
185
250
  badgeIconUrl?: string;
186
251
  }[];
252
+ assetLibrary?: {
253
+ assetLibraryUrl: string;
254
+ assetParameterUrl: string;
255
+ unstable_dynamicAssets?: {
256
+ dataConnectorId: string;
257
+ assetsListArchetypeId: string;
258
+ singleAssetArchetypeId: string;
259
+ };
260
+ };
261
+ unstable_assetLibrary?: {
262
+ url: string;
263
+ dynamicAssets?: {
264
+ dataConnectorId: string;
265
+ assetsListArchetypeId: string;
266
+ singleAssetArchetypeId: string;
267
+ };
268
+ };
269
+ ai?: {
270
+ generateUrl: string;
271
+ metadataUrl?: string;
272
+ prompts?: {
273
+ /** Format: uuid */
274
+ id: string;
275
+ name: string;
276
+ text: string;
277
+ data?: {
278
+ arguments?: {
279
+ [key: string]: {
280
+ type: string;
281
+ displayName?: string | null;
282
+ helpText?: string | null;
283
+ default?: string | null;
284
+ };
285
+ } | null;
286
+ metadata?: unknown | null;
287
+ } | null;
288
+ parameterTypes: string[];
289
+ }[];
290
+ };
187
291
  unstable_ai?: {
188
292
  generateUrl: string;
293
+ metadataUrl?: string;
189
294
  };
190
295
  };
296
+ unstable_prompts?: {
297
+ /** Format: uuid */
298
+ id: string;
299
+ name: string;
300
+ text: string;
301
+ data?: {
302
+ arguments?: {
303
+ [key: string]: {
304
+ type: string;
305
+ displayName?: string | null;
306
+ helpText?: string | null;
307
+ default?: string | null;
308
+ };
309
+ } | null;
310
+ metadata?: unknown | null;
311
+ } | null;
312
+ parameterTypes: string[];
313
+ }[];
191
314
  };
192
315
  };
193
316
  };
@@ -212,6 +335,7 @@ interface paths$1 {
212
335
  badgeIconUrl?: string;
213
336
  /** @enum {string} */
214
337
  category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
338
+ scopes?: string[];
215
339
  baseLocationUrl?: string;
216
340
  locations: {
217
341
  install?: {
@@ -244,6 +368,8 @@ interface paths$1 {
244
368
  };
245
369
  };
246
370
  renderableInPropertyPanel?: boolean;
371
+ /** @enum {string} */
372
+ localizable?: "default-yes" | "default-no" | "yes" | "no";
247
373
  }[];
248
374
  };
249
375
  dataConnectors?: {
@@ -274,10 +400,68 @@ interface paths$1 {
274
400
  };
275
401
  badgeIconUrl?: string;
276
402
  }[];
403
+ assetLibrary?: {
404
+ assetLibraryUrl: string;
405
+ assetParameterUrl: string;
406
+ unstable_dynamicAssets?: {
407
+ dataConnectorId: string;
408
+ assetsListArchetypeId: string;
409
+ singleAssetArchetypeId: string;
410
+ };
411
+ };
412
+ unstable_assetLibrary?: {
413
+ url: string;
414
+ dynamicAssets?: {
415
+ dataConnectorId: string;
416
+ assetsListArchetypeId: string;
417
+ singleAssetArchetypeId: string;
418
+ };
419
+ };
420
+ ai?: {
421
+ generateUrl: string;
422
+ metadataUrl?: string;
423
+ prompts?: {
424
+ /** Format: uuid */
425
+ id: string;
426
+ name: string;
427
+ text: string;
428
+ data?: {
429
+ arguments?: {
430
+ [key: string]: {
431
+ type: string;
432
+ displayName?: string | null;
433
+ helpText?: string | null;
434
+ default?: string | null;
435
+ };
436
+ } | null;
437
+ metadata?: unknown | null;
438
+ } | null;
439
+ parameterTypes: string[];
440
+ }[];
441
+ };
277
442
  unstable_ai?: {
278
443
  generateUrl: string;
444
+ metadataUrl?: string;
279
445
  };
280
446
  };
447
+ unstable_prompts?: {
448
+ /** Format: uuid */
449
+ id: string;
450
+ name: string;
451
+ text: string;
452
+ data?: {
453
+ arguments?: {
454
+ [key: string]: {
455
+ type: string;
456
+ displayName?: string | null;
457
+ helpText?: string | null;
458
+ default?: string | null;
459
+ };
460
+ } | null;
461
+ metadata?: unknown | null;
462
+ } | null;
463
+ parameterTypes: string[];
464
+ }[];
281
465
  };
282
466
  };
283
467
  };
@@ -551,6 +735,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
551
735
  badgeIconUrl?: string | undefined;
552
736
  category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown" | undefined;
553
737
  public?: boolean | undefined;
738
+ scopes?: string[] | undefined;
554
739
  baseLocationUrl?: string | undefined;
555
740
  locations: {
556
741
  install?: {
@@ -583,6 +768,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
583
768
  };
584
769
  } | undefined;
585
770
  renderableInPropertyPanel?: boolean | undefined;
771
+ localizable?: "default-yes" | "default-no" | "yes" | "no" | undefined;
586
772
  }[];
587
773
  } | undefined;
588
774
  dataConnectors?: {
@@ -613,10 +799,66 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
613
799
  } | undefined;
614
800
  badgeIconUrl?: string | undefined;
615
801
  }[] | undefined;
802
+ assetLibrary?: {
803
+ assetLibraryUrl: string;
804
+ assetParameterUrl: string;
805
+ unstable_dynamicAssets?: {
806
+ dataConnectorId: string;
807
+ assetsListArchetypeId: string;
808
+ singleAssetArchetypeId: string;
809
+ } | undefined;
810
+ } | undefined;
811
+ unstable_assetLibrary?: {
812
+ url: string;
813
+ dynamicAssets?: {
814
+ dataConnectorId: string;
815
+ assetsListArchetypeId: string;
816
+ singleAssetArchetypeId: string;
817
+ } | undefined;
818
+ } | undefined;
819
+ ai?: {
820
+ generateUrl: string;
821
+ metadataUrl?: string | undefined;
822
+ prompts?: {
823
+ id: string;
824
+ name: string;
825
+ text: string;
826
+ data?: {
827
+ arguments?: {
828
+ [key: string]: {
829
+ type: string;
830
+ displayName?: string | null | undefined;
831
+ helpText?: string | null | undefined;
832
+ default?: string | null | undefined;
833
+ };
834
+ } | null | undefined;
835
+ metadata?: unknown;
836
+ } | null | undefined;
837
+ parameterTypes: string[];
838
+ }[] | undefined;
839
+ } | undefined;
616
840
  unstable_ai?: {
617
841
  generateUrl: string;
842
+ metadataUrl?: string | undefined;
618
843
  } | undefined;
619
844
  };
845
+ unstable_prompts?: {
846
+ id: string;
847
+ name: string;
848
+ text: string;
849
+ data?: {
850
+ arguments?: {
851
+ [key: string]: {
852
+ type: string;
853
+ displayName?: string | null | undefined;
854
+ helpText?: string | null | undefined;
855
+ default?: string | null | undefined;
856
+ };
857
+ } | null | undefined;
858
+ metadata?: unknown;
859
+ } | null | undefined;
860
+ parameterTypes: string[];
861
+ }[] | undefined;
620
862
  }>;
621
863
  /** Deletes a mesh app from a team */
622
864
  remove(body: Omit<IntegrationDefinitionDeleteParameters, 'teamId'>): Promise<void>;
@@ -638,16 +880,31 @@ declare class IntegrationInstallationClient extends ApiClient {
638
880
  remove(body: ExceptProject<IntegrationInstallationDeleteParameters>): Promise<void>;
639
881
  }
640
882
 
883
+ type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
884
+ /** The current Uniform integration source ID */
885
+ sourceId: string;
886
+ }, TIntegrationConfiguration>;
887
+ type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
888
+ /** The current Uniform integration source ID */
889
+ sourceId: string;
890
+ /** The resolved data if this source is connected to a data resource */
891
+ dataResourceData?: unknown;
892
+ /**
893
+ * The maximum number of assets that can be selected in the Asset Library.
894
+ *
895
+ * Default: 1
896
+ */
897
+ maxAssets?: number;
898
+ }, TIntegrationConfiguration>;
899
+ type AssetLibraryLocation = MeshLocationCore<unknown, AssetLibraryLocationMetadata, unknown, 'assetLibrary'> & GetDataResourceLocation;
900
+ type AssetParameterLocation = MeshLocationCore<AssetParamValue, AssetParameterLocationMetadata, AssetParamValue, 'assetParameter'> & GetDataResourceLocation;
901
+
641
902
  type DataTypeLocationValue = Pick<DataType, 'body' | 'method' | 'path' | 'custom' | 'headers' | 'parameters' | 'variables'>;
642
903
  type DataConnectorInfo = {
643
904
  type: string;
644
905
  displayName: string;
645
906
  };
646
- type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
647
- /** Settings defined at the integration level (arbitrary type used on settings location) */
648
- settings: TIntegrationConfiguration;
649
- /** The Uniform project ID */
650
- projectId: string;
907
+ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
651
908
  /**
652
909
  * The current data type's data source. NOTE: param and header values are not available in this context.
653
910
  */
@@ -656,13 +913,10 @@ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
656
913
  dataConnector: DataConnectorInfo;
657
914
  /** The data type's archetype value. */
658
915
  archetype: string;
659
- };
916
+ }, TIntegrationConfiguration>;
660
917
  type DataTypeLocation = MeshLocationCore<DataTypeLocationValue, DataTypeLocationMetadata, DataTypeLocationValue, 'dataType'> & GetDataResourceLocation;
661
918
 
662
- type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
663
- /** Settings defined at the integration level (arbitrary type used on settings location) */
664
- settings: TIntegrationConfiguration;
665
- /** The current data resource's data type */
919
+ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
666
920
  dataType: DataType;
667
921
  /** The data type's archetype value. */
668
922
  archetype: string;
@@ -672,32 +926,21 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
672
926
  dataSource: DataSource;
673
927
  /** The data connector type of the current data resource's data source */
674
928
  dataConnector: DataConnectorInfo;
675
- /** The Uniform project ID */
676
- projectId: string;
677
929
  /** Current dynamic inputs that are configured on the composition (if any). */
678
930
  dynamicInputs: DynamicInputs;
679
- };
931
+ }, TIntegrationConfiguration>;
680
932
  type DataResourceLocation = MeshLocationCore<DataResourceVariables, DataResourceLocationMetadata, DataResourceVariables, 'dataResource'> & GetDataResourceLocation;
681
933
 
682
- type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'headers' | 'parameters' | 'variables'>;
683
- type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = {
684
- /** Settings defined at the integration level (arbitrary type used on settings location) */
685
- settings: TIntegrationConfiguration;
686
- /** The Uniform project ID */
687
- projectId: string;
688
- };
934
+ type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'customPublic' | 'headers' | 'parameters' | 'variables'>;
935
+ type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<unknown, TIntegrationConfiguration>;
689
936
  type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
690
937
 
691
- type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
938
+ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = CommonMetadata<{
692
939
  rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
693
940
  parameterConfiguration: TParamConfiguration;
694
941
  component: Omit<ComponentInstance, 'slots'>;
695
942
  componentDefinitions: Record<string, ComponentDefinition | undefined>;
696
943
  parameterDefinition: ComponentDefinitionParameter;
697
- /** Settings defined at the integration level (arbitrary type used on settings location) */
698
- settings: TIntegrationConfiguration;
699
- /** The Uniform project ID */
700
- projectId: string;
701
944
  /**
702
945
  * Current dynamic inputs that are configured on the composition (if any).
703
946
  * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
@@ -712,7 +955,14 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
712
955
  * Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
713
956
  */
714
957
  connectedData: Record<string, unknown>;
715
- };
958
+ /**
959
+ * The target locale being edited.
960
+ * If the parameter is not defined as localizable, then this is always undefined.
961
+ * If the parameter is localizable, then this is the current editor language.
962
+ * Note that setValue() always sets the target language automatically.
963
+ */
964
+ targetLocale: string | undefined;
965
+ }, TIntegrationConfiguration>;
716
966
  type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
717
967
  /**
718
968
  * Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
@@ -721,16 +971,14 @@ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TPa
721
971
  editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
722
972
  };
723
973
 
724
- type SettingsLocationMetadata = {
725
- projectId: string;
726
- };
974
+ type SettingsLocationMetadata = CommonMetadata;
727
975
  type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, SettingsLocationMetadata, TSettingsType, 'settings'>;
728
976
 
729
977
  /**
730
978
  * Defines methods used for interacting with a Mesh location
731
979
  * To receive useful typings, check the `type` property of the location to narrow the typing.
732
980
  */
733
- type MeshLocation<TValue = unknown, TSetValue = TValue> = ParamTypeLocation<TValue, unknown, TSetValue> | ParamTypeConfigLocation<TValue> | SettingsLocation<TValue> | DataSourceLocation | DataTypeLocation | DataResourceLocation | AIGenerateLocation<TValue>;
981
+ type MeshLocation<TValue = unknown, TSetValue = TValue> = ParamTypeLocation<TValue, unknown, TSetValue> | ParamTypeConfigLocation<TValue> | SettingsLocation<TValue> | AssetLibraryLocation | AssetParameterLocation | DataSourceLocation | DataTypeLocation | DataResourceLocation | AIGenerateLocation<TValue> | AIPromptMetadataLocation;
734
982
  interface MeshContextData {
735
983
  locationKey: string;
736
984
  locationType: MeshLocationTypes;
@@ -769,6 +1017,12 @@ type OpenDialogResult = {
769
1017
  dialogLocation?: string;
770
1018
  };
771
1019
  type DialogSizes = 'narrow' | 'medium' | 'wide';
1020
+ /**
1021
+ * Here we are using a trick to allow arbitrary max width values, also prioritizing enum from maxWidth.
1022
+ */
1023
+ type ArbitraryMaxWidth = string & {
1024
+ neverEverLetYouGo?: never;
1025
+ };
772
1026
  interface DialogOptions<TDialogParams = DialogParams> {
773
1027
  /**
774
1028
  * By default, dialogs will be closed when they set a value.
@@ -780,9 +1034,12 @@ interface DialogOptions<TDialogParams = DialogParams> {
780
1034
  disableCloseDialogOnSetValue?: boolean;
781
1035
  /**
782
1036
  * Options for setting the max width of the dialog.
1037
+ *
1038
+ * Custom string can be used for specific custom width .e.g "clamp(300px, 50%, 600px)"
1039
+ *
783
1040
  * @deprecated Use `width` instead. This property will become ignored in a future release.
784
1041
  */
785
- maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full';
1042
+ maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full' | ArbitraryMaxWidth;
786
1043
  /**
787
1044
  * Options for setting the width of the dialog.
788
1045
  */
@@ -792,6 +1049,10 @@ interface DialogOptions<TDialogParams = DialogParams> {
792
1049
  * the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
793
1050
  * Parameters should be simple (serializable) types, not functions or DOM
794
1051
  * elements or similar non-serializable objects.
1052
+ *
1053
+ * Best practice is to keep size of the params as small as possible.
1054
+ *
1055
+ * @see https://surma.dev/things/is-postmessage-slow/
795
1056
  */
796
1057
  params?: TDialogParams;
797
1058
  /**
@@ -829,7 +1090,7 @@ type CloseDialogMessage = {
829
1090
  dialogType: DialogType;
830
1091
  dialogData?: unknown;
831
1092
  };
832
- type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
1093
+ type GetDataResourceMessage = Pick<DataType, 'path' | 'archetype' | 'headers' | 'parameters' | 'body' | 'method'>;
833
1094
  /** Primitive data types that a parameter type accepts to be bound to composition data */
834
1095
  type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
835
1096
  /** Message to parent to create a data connection expression to insert in a param type */
@@ -854,6 +1115,22 @@ type EditConnectedDataResponse = {
854
1115
  canceled: true;
855
1116
  editorCancelledContext: EditConnectedDataResponseCancellationContext;
856
1117
  };
1118
+ type UniformUser = {
1119
+ /** Permissions the user has as per Team Admin assigned, can be used to do conditional rendering */
1120
+ permissions: MeshLocationUserPermissions[];
1121
+ /** Permissions the user has as per Team Admin created and assigned, can be used to do conditional rendering */
1122
+ roles: {
1123
+ id: string;
1124
+ name: string;
1125
+ }[];
1126
+ /** Name of the user assigned by Team Admin. Unless your Mesh integration was given permissions to expose User Name - it is not available */
1127
+ name?: string;
1128
+ /** Email of the user used to sign in. Unless your Mesh integration was given permissions to expose User Name - it is not available */
1129
+ email?: string;
1130
+ /** Unique ID of the user */
1131
+ id: string;
1132
+ isAdmin: boolean;
1133
+ };
857
1134
 
858
1135
  type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
859
1136
  initialize: () => Promise<MeshContextData>;
@@ -916,10 +1193,96 @@ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TV
916
1193
  returnDialogValue: (value: unknown) => Promise<void>;
917
1194
  };
918
1195
  }
1196
+ /** Common metadata for all mesh locations */
1197
+ type CommonMetadata<ExtendedMetadata = unknown, TIntegrationConfiguration = unknown> = {
1198
+ /** The current Uniform user context. Contains name, email and context to check for permissions */
1199
+ user: UniformUser;
1200
+ /** Current Uniform Project ID */
1201
+ projectId: string;
1202
+ /** Settings defined at the integration level (arbitrary type used on settings location) */
1203
+ settings: TIntegrationConfiguration;
1204
+ } & ExtendedMetadata;
1205
+ type MeshLocationUserPermissions =
1206
+ /** Uniform Context:Enrichments:Create */
1207
+ 'ENRICHMENTS_CREATE'
1208
+ /** Uniform Context:Enrichments:Update */
1209
+ | 'ENRICHMENTS_UPDATE'
1210
+ /** Uniform Context:Enrichments:Delete */
1211
+ | 'ENRICHMENTS_DELETE'
1212
+ /** Uniform Context:Intents & Audiences:Create */
1213
+ | 'INTENTS_CREATE'
1214
+ /** Uniform Context:Intents & Audiences:Update */
1215
+ | 'INTENTS_UPDATE'
1216
+ /** Uniform Context:Intents & Audiences:Delete */
1217
+ | 'INTENTS_DELETE'
1218
+ /** Uniform Context:Quirks:Create */
1219
+ | 'QUIRKS_CREATE'
1220
+ /** Uniform Context:Quirks:Update| */
1221
+ | 'QUIRKS_UPDATE'
1222
+ /** Uniform Context:Quirks:Delete */
1223
+ | 'QUIRKS_DELETE'
1224
+ /** Uniform Context:Signals:Create */
1225
+ | 'SIGNALS_CREATE'
1226
+ /** Uniform Context:Signals:Update */
1227
+ | 'SIGNALS_UPDATE'
1228
+ /** Uniform Context:Signals:Delete */
1229
+ | 'SIGNALS_DELETE'
1230
+ /** Uniform Context:Tests:Create */
1231
+ | 'TESTS_CREATE'
1232
+ /** Uniform Context:Tests:Update|Declare winners and close existing tests. */
1233
+ | 'TESTS_UPDATE'
1234
+ /** Uniform Context:Tests:Delete */
1235
+ | 'TESTS_DELETE'
1236
+ /** Uniform Context:Manifest:Read|Read the published manifest */
1237
+ | 'MANIFEST_READ'
1238
+ /** Uniform Context:Manifest:Publish|Publish the manifest */
1239
+ | 'MANIFEST_PUBLISH'
1240
+ /** Uniform Context:Read Drafts|Read all drafts and preview manifest */
1241
+ | 'MANIFEST_READ_DRAFT'
1242
+ /** Uniform Canvas:Project Map:Manage|Create, update, and delete Project Maps and nodes in Project Map trees. */
1243
+ | 'PROJECT_MAP_MANAGE'
1244
+ /** General:Read Project|See the project in the team dashboard. */
1245
+ | 'PROJECT_READ'
1246
+ /** Uniform Canvas:Redirects:Advanced|Grants access to advanced redirect features and options. */
1247
+ | 'REDIRECTS_ADVANCED'
1248
+ /** Uniform Canvas:Redirects:Create */
1249
+ | 'REDIRECTS_CREATE'
1250
+ /** Uniform Canvas:Redirects:Update */
1251
+ | 'REDIRECTS_UPDATE'
1252
+ /** Uniform Canvas:Redirects:Delete */
1253
+ | 'REDIRECTS_DELETE'
1254
+ /** Uniform Canvas:Data Sources:Manage|Create, update, and delete data sources. */
1255
+ | 'DATA_SOURCES_MANAGE'
1256
+ /** Uniform Canvas:Data Types:Manage|Create, update, and delete data types. */
1257
+ | 'DATA_TYPES_MANAGE'
1258
+ /** Uniform Canvas:Compositions:Create */
1259
+ | 'COMPOSITIONS_CREATE'
1260
+ /** Uniform Canvas:Compositions:Update */
1261
+ | 'COMPOSITIONS_WRITE'
1262
+ /** Uniform Canvas:Compositions:Delete */
1263
+ | 'COMPOSITIONS_DELETE'
1264
+ /** Uniform Canvas:Compositions:Read Published */
1265
+ | 'COMPOSITIONS_READ'
1266
+ /** Uniform Canvas:Compositions:Publish */
1267
+ | 'COMPOSITIONS_PUBLISH'
1268
+ /** Uniform Canvas::Read|Includes read access to all canvas assets */
1269
+ | 'COMPOSITIONS_READ_DRAFT'
1270
+ /** Uniform Canvas:Component Library:Manage|Create, update, and delete component library data */
1271
+ | 'COMPOSITIONS_MANAGE_SCHEMA'
1272
+ /** UTM Mapper:Read|Read UTM mapper configuration */
1273
+ | 'UTM_MAPPER_READ'
1274
+ /** Uniform Canvas:Releases:Launch|Launch a release */
1275
+ | 'RELEASES_LAUNCH'
1276
+ /** Uniform Canvas:Releases:Create */
1277
+ | 'RELEASES_CREATE'
1278
+ /** Uniform Canvas:Releases:Delete */
1279
+ | 'RELEASES_DELETE'
1280
+ /** Uniform Canvas:Releases:Update */
1281
+ | 'RELEASES_UPDATE';
919
1282
  /**
920
1283
  * Known location types that can be passed to a mesh location
921
1284
  */
922
- type MeshLocationTypes = 'paramType' | 'paramTypeConfig' | 'settings' | 'dataSource' | 'dataType' | 'dataResource' | 'unstable_ai';
1285
+ type MeshLocationTypes = 'paramType' | 'paramTypeConfig' | 'assetLibrary' | 'assetParameter' | 'settings' | 'dataSource' | 'dataType' | 'dataResource' | 'aiGenerate' | 'aiMetadata';
923
1286
  type SetValueOptions = ValidationResult;
924
1287
  type SetValueMessage = {
925
1288
  uniformMeshLocationValue: unknown;
@@ -945,23 +1308,23 @@ type DynamicInput = {
945
1308
  /** Record of dynamic inputs keyed by the input name */
946
1309
  type DynamicInputs = Record<string, DynamicInput>;
947
1310
 
948
- type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = {
949
- /** Settings defined at the integration level (arbitrary type used on settings location) */
950
- settings: TIntegrationConfiguration;
951
- /** The Uniform project ID */
952
- projectId: string;
1311
+ type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
953
1312
  prompt: string;
954
1313
  promptMetadata: Record<string, unknown>;
955
- };
956
- type AIGenerateLocation<TType> = MeshLocationCore<TType, AIGenerateLocationMetadata, TType, 'unstable_ai'>;
1314
+ /** Useful to differentiate AI Generate UI between text and image */
1315
+ promptOutputType: 'text' | 'image' | 'json';
1316
+ }, TIntegrationConfiguration>;
1317
+ type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
1318
+ /** Useful to differentiate metadata settings between text and image generation */
1319
+ promptOutputType: 'text' | 'image' | 'json';
1320
+ }, TIntegrationConfiguration>;
1321
+ type AIGenerateLocation<TType> = MeshLocationCore<TType, AIGenerateLocationMetadata, TType, 'aiGenerate'>;
1322
+ type AIPromptMetadataLocation = MeshLocationCore<Record<string, unknown>, PromptSettingsLocationMetadata, Record<string, unknown>, 'aiMetadata'>;
957
1323
 
958
- type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
959
- /** Settings defined at the integration level (arbitrary type used on settings location) */
960
- settings: TIntegrationConfiguration;
1324
+ type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
961
1325
  /** The Uniform project ID */
962
- projectId: string;
963
1326
  componentDefinition: ComponentDefinition;
964
- };
1327
+ }, TIntegrationConfiguration>;
965
1328
  type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
966
1329
 
967
1330
  interface SdkWindow {
@@ -1061,4 +1424,10 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
1061
1424
  autoResizingDisabled?: boolean;
1062
1425
  }): Promise<UniformMeshSDK | undefined>;
1063
1426
 
1064
- export { AIGenerateLocation, AIGenerateLocationMetadata, BindableTypes, CSSHeight, CloseDialogMessage, CloseLocationDialogOptions, DataConnectorInfo, DataResourceLocation, DataResourceLocationMetadata, DataSourceLocation, DataSourceLocationMetadata, DataSourceLocationValue, DataTypeLocation, DataTypeLocationMetadata, DataTypeLocationValue, DialogContext, DialogOptions, DialogParamValue, DialogParams, DialogResponseData, DialogResponseHandler, DialogResponseHandlers, DialogType, DynamicInput, DynamicInputs, EditConnectedDataMessage, EditConnectedDataResponse, EditConnectedDataResponseCancellationContext, GetDataResourceLocation, GetDataResourceMessage, IntegrationDefinitionClient, IntegrationDefinitionDeleteParameters, IntegrationDefinitionGetParameters, IntegrationDefinitionGetResponse, IntegrationDefinitionPutParameters, IntegrationDefinitionPutResponse, IntegrationInstallationClient, IntegrationInstallationDeleteParameters, IntegrationInstallationGetParameters, IntegrationInstallationGetResponse, IntegrationInstallationPutParameters, LocationDialogResponse, MeshContextData, MeshLocation, MeshLocationCore, MeshLocationTypes, MeshSDKEventInterface, OpenConfirmationDialogOptions, OpenConfirmationDialogResult, OpenDialogMessage, OpenDialogResult, OpenLocationDialogOptions, ParamTypeConfigLocation, ParamTypeConfigLocationMetadata, ParamTypeLocation, ParamTypeLocationMetadata, SdkWindow, SetLocationFunction, SetValueMessage, SetValueOptions, SettingsLocation, SettingsLocationMetadata, UniformMeshSDK, UniformMeshSDKEvents, ValidationResult, initializeUniformMeshSDK };
1427
+ declare const hasPermissions: (permissions: MeshLocationUserPermissions | MeshLocationUserPermissions[], user: UniformUser) => boolean;
1428
+ /**
1429
+ * Check if user has a role by both name and id
1430
+ */
1431
+ declare const hasRole: (role: string, user: UniformUser) => boolean;
1432
+
1433
+ export { type AIGenerateLocation, type AIGenerateLocationMetadata, type AIPromptMetadataLocation, type AssetLibraryLocation, type AssetLibraryLocationMetadata, type AssetParameterLocation, type AssetParameterLocationMetadata, type BindableTypes, type CSSHeight, type CloseDialogMessage, type CloseLocationDialogOptions, type CommonMetadata, type DataConnectorInfo, type DataResourceLocation, type DataResourceLocationMetadata, type DataSourceLocation, type DataSourceLocationMetadata, type DataSourceLocationValue, type DataTypeLocation, type DataTypeLocationMetadata, type DataTypeLocationValue, type DialogContext, type DialogOptions, type DialogParamValue, type DialogParams, type DialogResponseData, type DialogResponseHandler, type DialogResponseHandlers, type DialogType, type DynamicInput, type DynamicInputs, type EditConnectedDataMessage, type EditConnectedDataResponse, type EditConnectedDataResponseCancellationContext, type GetDataResourceLocation, type GetDataResourceMessage, IntegrationDefinitionClient, type IntegrationDefinitionDeleteParameters, type IntegrationDefinitionGetParameters, type IntegrationDefinitionGetResponse, type IntegrationDefinitionPutParameters, type IntegrationDefinitionPutResponse, IntegrationInstallationClient, type IntegrationInstallationDeleteParameters, type IntegrationInstallationGetParameters, type IntegrationInstallationGetResponse, type IntegrationInstallationPutParameters, type LocationDialogResponse, type MeshContextData, type MeshLocation, type MeshLocationCore, type MeshLocationTypes, type MeshLocationUserPermissions, type MeshSDKEventInterface, type OpenConfirmationDialogOptions, type OpenConfirmationDialogResult, type OpenDialogMessage, type OpenDialogResult, type OpenLocationDialogOptions, type ParamTypeConfigLocation, type ParamTypeConfigLocationMetadata, type ParamTypeLocation, type ParamTypeLocationMetadata, type PromptSettingsLocationMetadata, type SdkWindow, type SetLocationFunction, type SetValueMessage, type SetValueOptions, type SettingsLocation, type SettingsLocationMetadata, type UniformMeshSDK, type UniformMeshSDKEvents, type UniformUser, type ValidationResult, hasPermissions, hasRole, initializeUniformMeshSDK };