@uniformdev/mesh-sdk 19.79.1-alpha.13 → 19.79.1-alpha.18
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/LICENSE.txt +1 -1
- package/dist/index.d.mts +141 -58
- package/dist/index.d.ts +141 -58
- package/dist/index.esm.js +18 -16
- package/dist/index.js +20 -16
- package/dist/index.mjs +18 -16
- package/package.json +5 -5
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2024 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ interface paths$1 {
|
|
|
32
32
|
/** @enum {string} */
|
|
33
33
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
34
34
|
public?: boolean;
|
|
35
|
+
scopes?: string[];
|
|
35
36
|
baseLocationUrl?: string;
|
|
36
37
|
locations: {
|
|
37
38
|
install?: {
|
|
@@ -183,6 +184,7 @@ interface paths$1 {
|
|
|
183
184
|
/** @enum {string} */
|
|
184
185
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
185
186
|
public?: boolean;
|
|
187
|
+
scopes?: string[];
|
|
186
188
|
baseLocationUrl?: string;
|
|
187
189
|
locations: {
|
|
188
190
|
install?: {
|
|
@@ -333,6 +335,7 @@ interface paths$1 {
|
|
|
333
335
|
badgeIconUrl?: string;
|
|
334
336
|
/** @enum {string} */
|
|
335
337
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
338
|
+
scopes?: string[];
|
|
336
339
|
baseLocationUrl?: string;
|
|
337
340
|
locations: {
|
|
338
341
|
install?: {
|
|
@@ -732,6 +735,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
|
|
|
732
735
|
badgeIconUrl?: string | undefined;
|
|
733
736
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown" | undefined;
|
|
734
737
|
public?: boolean | undefined;
|
|
738
|
+
scopes?: string[] | undefined;
|
|
735
739
|
baseLocationUrl?: string | undefined;
|
|
736
740
|
locations: {
|
|
737
741
|
install?: {
|
|
@@ -876,19 +880,11 @@ declare class IntegrationInstallationClient extends ApiClient {
|
|
|
876
880
|
remove(body: ExceptProject<IntegrationInstallationDeleteParameters>): Promise<void>;
|
|
877
881
|
}
|
|
878
882
|
|
|
879
|
-
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
880
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
881
|
-
settings: TIntegrationConfiguration;
|
|
882
|
-
/** The Uniform project ID */
|
|
883
|
-
projectId: string;
|
|
883
|
+
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
884
884
|
/** The current Uniform integration source ID */
|
|
885
885
|
sourceId: string;
|
|
886
|
-
}
|
|
887
|
-
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
888
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
889
|
-
settings: TIntegrationConfiguration;
|
|
890
|
-
/** The Uniform project ID */
|
|
891
|
-
projectId: string;
|
|
886
|
+
}, TIntegrationConfiguration>;
|
|
887
|
+
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
892
888
|
/** The current Uniform integration source ID */
|
|
893
889
|
sourceId: string;
|
|
894
890
|
/** The resolved data if this source is connected to a data resource */
|
|
@@ -899,7 +895,7 @@ type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
899
895
|
* Default: 1
|
|
900
896
|
*/
|
|
901
897
|
maxAssets?: number;
|
|
902
|
-
}
|
|
898
|
+
}, TIntegrationConfiguration>;
|
|
903
899
|
type AssetLibraryLocation = MeshLocationCore<unknown, AssetLibraryLocationMetadata, unknown, 'assetLibrary'> & GetDataResourceLocation;
|
|
904
900
|
type AssetParameterLocation = MeshLocationCore<AssetParamValue, AssetParameterLocationMetadata, AssetParamValue, 'assetParameter'> & GetDataResourceLocation;
|
|
905
901
|
|
|
@@ -908,11 +904,7 @@ type DataConnectorInfo = {
|
|
|
908
904
|
type: string;
|
|
909
905
|
displayName: string;
|
|
910
906
|
};
|
|
911
|
-
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
912
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
913
|
-
settings: TIntegrationConfiguration;
|
|
914
|
-
/** The Uniform project ID */
|
|
915
|
-
projectId: string;
|
|
907
|
+
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
916
908
|
/**
|
|
917
909
|
* The current data type's data source. NOTE: param and header values are not available in this context.
|
|
918
910
|
*/
|
|
@@ -921,13 +913,10 @@ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
921
913
|
dataConnector: DataConnectorInfo;
|
|
922
914
|
/** The data type's archetype value. */
|
|
923
915
|
archetype: string;
|
|
924
|
-
}
|
|
916
|
+
}, TIntegrationConfiguration>;
|
|
925
917
|
type DataTypeLocation = MeshLocationCore<DataTypeLocationValue, DataTypeLocationMetadata, DataTypeLocationValue, 'dataType'> & GetDataResourceLocation;
|
|
926
918
|
|
|
927
|
-
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
928
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
929
|
-
settings: TIntegrationConfiguration;
|
|
930
|
-
/** The current data resource's data type */
|
|
919
|
+
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
931
920
|
dataType: DataType;
|
|
932
921
|
/** The data type's archetype value. */
|
|
933
922
|
archetype: string;
|
|
@@ -937,32 +926,21 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
937
926
|
dataSource: DataSource;
|
|
938
927
|
/** The data connector type of the current data resource's data source */
|
|
939
928
|
dataConnector: DataConnectorInfo;
|
|
940
|
-
/** The Uniform project ID */
|
|
941
|
-
projectId: string;
|
|
942
929
|
/** Current dynamic inputs that are configured on the composition (if any). */
|
|
943
930
|
dynamicInputs: DynamicInputs;
|
|
944
|
-
}
|
|
931
|
+
}, TIntegrationConfiguration>;
|
|
945
932
|
type DataResourceLocation = MeshLocationCore<DataResourceVariables, DataResourceLocationMetadata, DataResourceVariables, 'dataResource'> & GetDataResourceLocation;
|
|
946
933
|
|
|
947
934
|
type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'customPublic' | 'headers' | 'parameters' | 'variables'>;
|
|
948
|
-
type DataSourceLocationMetadata<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;
|
|
953
|
-
};
|
|
935
|
+
type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<unknown, TIntegrationConfiguration>;
|
|
954
936
|
type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
|
|
955
937
|
|
|
956
|
-
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
|
|
938
|
+
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
957
939
|
rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
|
|
958
940
|
parameterConfiguration: TParamConfiguration;
|
|
959
941
|
component: Omit<ComponentInstance, 'slots'>;
|
|
960
942
|
componentDefinitions: Record<string, ComponentDefinition | undefined>;
|
|
961
943
|
parameterDefinition: ComponentDefinitionParameter;
|
|
962
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
963
|
-
settings: TIntegrationConfiguration;
|
|
964
|
-
/** The Uniform project ID */
|
|
965
|
-
projectId: string;
|
|
966
944
|
/**
|
|
967
945
|
* Current dynamic inputs that are configured on the composition (if any).
|
|
968
946
|
* Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
|
|
@@ -984,7 +962,7 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
|
|
|
984
962
|
* Note that setValue() always sets the target language automatically.
|
|
985
963
|
*/
|
|
986
964
|
targetLocale: string | undefined;
|
|
987
|
-
}
|
|
965
|
+
}, TIntegrationConfiguration>;
|
|
988
966
|
type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
|
|
989
967
|
/**
|
|
990
968
|
* Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
|
|
@@ -993,9 +971,7 @@ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TPa
|
|
|
993
971
|
editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
|
|
994
972
|
};
|
|
995
973
|
|
|
996
|
-
type SettingsLocationMetadata =
|
|
997
|
-
projectId: string;
|
|
998
|
-
};
|
|
974
|
+
type SettingsLocationMetadata = CommonMetadata;
|
|
999
975
|
type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, SettingsLocationMetadata, TSettingsType, 'settings'>;
|
|
1000
976
|
|
|
1001
977
|
/**
|
|
@@ -1041,6 +1017,12 @@ type OpenDialogResult = {
|
|
|
1041
1017
|
dialogLocation?: string;
|
|
1042
1018
|
};
|
|
1043
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
|
+
};
|
|
1044
1026
|
interface DialogOptions<TDialogParams = DialogParams> {
|
|
1045
1027
|
/**
|
|
1046
1028
|
* By default, dialogs will be closed when they set a value.
|
|
@@ -1052,9 +1034,12 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1052
1034
|
disableCloseDialogOnSetValue?: boolean;
|
|
1053
1035
|
/**
|
|
1054
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
|
+
*
|
|
1055
1040
|
* @deprecated Use `width` instead. This property will become ignored in a future release.
|
|
1056
1041
|
*/
|
|
1057
|
-
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;
|
|
1058
1043
|
/**
|
|
1059
1044
|
* Options for setting the width of the dialog.
|
|
1060
1045
|
*/
|
|
@@ -1064,6 +1049,10 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1064
1049
|
* the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
|
|
1065
1050
|
* Parameters should be simple (serializable) types, not functions or DOM
|
|
1066
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/
|
|
1067
1056
|
*/
|
|
1068
1057
|
params?: TDialogParams;
|
|
1069
1058
|
/**
|
|
@@ -1126,6 +1115,22 @@ type EditConnectedDataResponse = {
|
|
|
1126
1115
|
canceled: true;
|
|
1127
1116
|
editorCancelledContext: EditConnectedDataResponseCancellationContext;
|
|
1128
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
|
+
};
|
|
1129
1134
|
|
|
1130
1135
|
type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
|
|
1131
1136
|
initialize: () => Promise<MeshContextData>;
|
|
@@ -1188,6 +1193,86 @@ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TV
|
|
|
1188
1193
|
returnDialogValue: (value: unknown) => Promise<void>;
|
|
1189
1194
|
};
|
|
1190
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';
|
|
1191
1276
|
/**
|
|
1192
1277
|
* Known location types that can be passed to a mesh location
|
|
1193
1278
|
*/
|
|
@@ -1217,31 +1302,23 @@ type DynamicInput = {
|
|
|
1217
1302
|
/** Record of dynamic inputs keyed by the input name */
|
|
1218
1303
|
type DynamicInputs = Record<string, DynamicInput>;
|
|
1219
1304
|
|
|
1220
|
-
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1221
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1222
|
-
settings: TIntegrationConfiguration;
|
|
1223
|
-
/** The Uniform project ID */
|
|
1224
|
-
projectId: string;
|
|
1305
|
+
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1225
1306
|
prompt: string;
|
|
1226
1307
|
promptMetadata: Record<string, unknown>;
|
|
1227
1308
|
/** Useful to differentiate AI Generate UI between text and image */
|
|
1228
|
-
promptOutputType: 'text' | 'image';
|
|
1229
|
-
}
|
|
1230
|
-
type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1231
|
-
settings: TIntegrationConfiguration;
|
|
1309
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1310
|
+
}, TIntegrationConfiguration>;
|
|
1311
|
+
type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1232
1312
|
/** Useful to differentiate metadata settings between text and image generation */
|
|
1233
|
-
promptOutputType: 'text' | 'image';
|
|
1234
|
-
}
|
|
1313
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1314
|
+
}, TIntegrationConfiguration>;
|
|
1235
1315
|
type AIGenerateLocation<TType> = MeshLocationCore<TType, AIGenerateLocationMetadata, TType, 'aiGenerate'>;
|
|
1236
1316
|
type AIPromptMetadataLocation = MeshLocationCore<Record<string, unknown>, PromptSettingsLocationMetadata, Record<string, unknown>, 'aiMetadata'>;
|
|
1237
1317
|
|
|
1238
|
-
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1239
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1240
|
-
settings: TIntegrationConfiguration;
|
|
1318
|
+
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1241
1319
|
/** The Uniform project ID */
|
|
1242
|
-
projectId: string;
|
|
1243
1320
|
componentDefinition: ComponentDefinition;
|
|
1244
|
-
}
|
|
1321
|
+
}, TIntegrationConfiguration>;
|
|
1245
1322
|
type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
|
|
1246
1323
|
|
|
1247
1324
|
interface SdkWindow {
|
|
@@ -1341,4 +1418,10 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
|
|
|
1341
1418
|
autoResizingDisabled?: boolean;
|
|
1342
1419
|
}): Promise<UniformMeshSDK | undefined>;
|
|
1343
1420
|
|
|
1344
|
-
|
|
1421
|
+
declare const hasPermissions: (permissions: MeshLocationUserPermissions | MeshLocationUserPermissions[], user: UniformUser) => boolean;
|
|
1422
|
+
/**
|
|
1423
|
+
* Check if user has a role by both name and id
|
|
1424
|
+
*/
|
|
1425
|
+
declare const hasRole: (role: string, user: UniformUser) => boolean;
|
|
1426
|
+
|
|
1427
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ interface paths$1 {
|
|
|
32
32
|
/** @enum {string} */
|
|
33
33
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
34
34
|
public?: boolean;
|
|
35
|
+
scopes?: string[];
|
|
35
36
|
baseLocationUrl?: string;
|
|
36
37
|
locations: {
|
|
37
38
|
install?: {
|
|
@@ -183,6 +184,7 @@ interface paths$1 {
|
|
|
183
184
|
/** @enum {string} */
|
|
184
185
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
185
186
|
public?: boolean;
|
|
187
|
+
scopes?: string[];
|
|
186
188
|
baseLocationUrl?: string;
|
|
187
189
|
locations: {
|
|
188
190
|
install?: {
|
|
@@ -333,6 +335,7 @@ interface paths$1 {
|
|
|
333
335
|
badgeIconUrl?: string;
|
|
334
336
|
/** @enum {string} */
|
|
335
337
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
338
|
+
scopes?: string[];
|
|
336
339
|
baseLocationUrl?: string;
|
|
337
340
|
locations: {
|
|
338
341
|
install?: {
|
|
@@ -732,6 +735,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
|
|
|
732
735
|
badgeIconUrl?: string | undefined;
|
|
733
736
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown" | undefined;
|
|
734
737
|
public?: boolean | undefined;
|
|
738
|
+
scopes?: string[] | undefined;
|
|
735
739
|
baseLocationUrl?: string | undefined;
|
|
736
740
|
locations: {
|
|
737
741
|
install?: {
|
|
@@ -876,19 +880,11 @@ declare class IntegrationInstallationClient extends ApiClient {
|
|
|
876
880
|
remove(body: ExceptProject<IntegrationInstallationDeleteParameters>): Promise<void>;
|
|
877
881
|
}
|
|
878
882
|
|
|
879
|
-
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
880
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
881
|
-
settings: TIntegrationConfiguration;
|
|
882
|
-
/** The Uniform project ID */
|
|
883
|
-
projectId: string;
|
|
883
|
+
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
884
884
|
/** The current Uniform integration source ID */
|
|
885
885
|
sourceId: string;
|
|
886
|
-
}
|
|
887
|
-
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
888
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
889
|
-
settings: TIntegrationConfiguration;
|
|
890
|
-
/** The Uniform project ID */
|
|
891
|
-
projectId: string;
|
|
886
|
+
}, TIntegrationConfiguration>;
|
|
887
|
+
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
892
888
|
/** The current Uniform integration source ID */
|
|
893
889
|
sourceId: string;
|
|
894
890
|
/** The resolved data if this source is connected to a data resource */
|
|
@@ -899,7 +895,7 @@ type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
899
895
|
* Default: 1
|
|
900
896
|
*/
|
|
901
897
|
maxAssets?: number;
|
|
902
|
-
}
|
|
898
|
+
}, TIntegrationConfiguration>;
|
|
903
899
|
type AssetLibraryLocation = MeshLocationCore<unknown, AssetLibraryLocationMetadata, unknown, 'assetLibrary'> & GetDataResourceLocation;
|
|
904
900
|
type AssetParameterLocation = MeshLocationCore<AssetParamValue, AssetParameterLocationMetadata, AssetParamValue, 'assetParameter'> & GetDataResourceLocation;
|
|
905
901
|
|
|
@@ -908,11 +904,7 @@ type DataConnectorInfo = {
|
|
|
908
904
|
type: string;
|
|
909
905
|
displayName: string;
|
|
910
906
|
};
|
|
911
|
-
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
912
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
913
|
-
settings: TIntegrationConfiguration;
|
|
914
|
-
/** The Uniform project ID */
|
|
915
|
-
projectId: string;
|
|
907
|
+
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
916
908
|
/**
|
|
917
909
|
* The current data type's data source. NOTE: param and header values are not available in this context.
|
|
918
910
|
*/
|
|
@@ -921,13 +913,10 @@ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
921
913
|
dataConnector: DataConnectorInfo;
|
|
922
914
|
/** The data type's archetype value. */
|
|
923
915
|
archetype: string;
|
|
924
|
-
}
|
|
916
|
+
}, TIntegrationConfiguration>;
|
|
925
917
|
type DataTypeLocation = MeshLocationCore<DataTypeLocationValue, DataTypeLocationMetadata, DataTypeLocationValue, 'dataType'> & GetDataResourceLocation;
|
|
926
918
|
|
|
927
|
-
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
928
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
929
|
-
settings: TIntegrationConfiguration;
|
|
930
|
-
/** The current data resource's data type */
|
|
919
|
+
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
931
920
|
dataType: DataType;
|
|
932
921
|
/** The data type's archetype value. */
|
|
933
922
|
archetype: string;
|
|
@@ -937,32 +926,21 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
937
926
|
dataSource: DataSource;
|
|
938
927
|
/** The data connector type of the current data resource's data source */
|
|
939
928
|
dataConnector: DataConnectorInfo;
|
|
940
|
-
/** The Uniform project ID */
|
|
941
|
-
projectId: string;
|
|
942
929
|
/** Current dynamic inputs that are configured on the composition (if any). */
|
|
943
930
|
dynamicInputs: DynamicInputs;
|
|
944
|
-
}
|
|
931
|
+
}, TIntegrationConfiguration>;
|
|
945
932
|
type DataResourceLocation = MeshLocationCore<DataResourceVariables, DataResourceLocationMetadata, DataResourceVariables, 'dataResource'> & GetDataResourceLocation;
|
|
946
933
|
|
|
947
934
|
type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'customPublic' | 'headers' | 'parameters' | 'variables'>;
|
|
948
|
-
type DataSourceLocationMetadata<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;
|
|
953
|
-
};
|
|
935
|
+
type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<unknown, TIntegrationConfiguration>;
|
|
954
936
|
type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
|
|
955
937
|
|
|
956
|
-
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
|
|
938
|
+
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
957
939
|
rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
|
|
958
940
|
parameterConfiguration: TParamConfiguration;
|
|
959
941
|
component: Omit<ComponentInstance, 'slots'>;
|
|
960
942
|
componentDefinitions: Record<string, ComponentDefinition | undefined>;
|
|
961
943
|
parameterDefinition: ComponentDefinitionParameter;
|
|
962
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
963
|
-
settings: TIntegrationConfiguration;
|
|
964
|
-
/** The Uniform project ID */
|
|
965
|
-
projectId: string;
|
|
966
944
|
/**
|
|
967
945
|
* Current dynamic inputs that are configured on the composition (if any).
|
|
968
946
|
* Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
|
|
@@ -984,7 +962,7 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
|
|
|
984
962
|
* Note that setValue() always sets the target language automatically.
|
|
985
963
|
*/
|
|
986
964
|
targetLocale: string | undefined;
|
|
987
|
-
}
|
|
965
|
+
}, TIntegrationConfiguration>;
|
|
988
966
|
type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
|
|
989
967
|
/**
|
|
990
968
|
* Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
|
|
@@ -993,9 +971,7 @@ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TPa
|
|
|
993
971
|
editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
|
|
994
972
|
};
|
|
995
973
|
|
|
996
|
-
type SettingsLocationMetadata =
|
|
997
|
-
projectId: string;
|
|
998
|
-
};
|
|
974
|
+
type SettingsLocationMetadata = CommonMetadata;
|
|
999
975
|
type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, SettingsLocationMetadata, TSettingsType, 'settings'>;
|
|
1000
976
|
|
|
1001
977
|
/**
|
|
@@ -1041,6 +1017,12 @@ type OpenDialogResult = {
|
|
|
1041
1017
|
dialogLocation?: string;
|
|
1042
1018
|
};
|
|
1043
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
|
+
};
|
|
1044
1026
|
interface DialogOptions<TDialogParams = DialogParams> {
|
|
1045
1027
|
/**
|
|
1046
1028
|
* By default, dialogs will be closed when they set a value.
|
|
@@ -1052,9 +1034,12 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1052
1034
|
disableCloseDialogOnSetValue?: boolean;
|
|
1053
1035
|
/**
|
|
1054
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
|
+
*
|
|
1055
1040
|
* @deprecated Use `width` instead. This property will become ignored in a future release.
|
|
1056
1041
|
*/
|
|
1057
|
-
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;
|
|
1058
1043
|
/**
|
|
1059
1044
|
* Options for setting the width of the dialog.
|
|
1060
1045
|
*/
|
|
@@ -1064,6 +1049,10 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1064
1049
|
* the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
|
|
1065
1050
|
* Parameters should be simple (serializable) types, not functions or DOM
|
|
1066
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/
|
|
1067
1056
|
*/
|
|
1068
1057
|
params?: TDialogParams;
|
|
1069
1058
|
/**
|
|
@@ -1126,6 +1115,22 @@ type EditConnectedDataResponse = {
|
|
|
1126
1115
|
canceled: true;
|
|
1127
1116
|
editorCancelledContext: EditConnectedDataResponseCancellationContext;
|
|
1128
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
|
+
};
|
|
1129
1134
|
|
|
1130
1135
|
type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
|
|
1131
1136
|
initialize: () => Promise<MeshContextData>;
|
|
@@ -1188,6 +1193,86 @@ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TV
|
|
|
1188
1193
|
returnDialogValue: (value: unknown) => Promise<void>;
|
|
1189
1194
|
};
|
|
1190
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';
|
|
1191
1276
|
/**
|
|
1192
1277
|
* Known location types that can be passed to a mesh location
|
|
1193
1278
|
*/
|
|
@@ -1217,31 +1302,23 @@ type DynamicInput = {
|
|
|
1217
1302
|
/** Record of dynamic inputs keyed by the input name */
|
|
1218
1303
|
type DynamicInputs = Record<string, DynamicInput>;
|
|
1219
1304
|
|
|
1220
|
-
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1221
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1222
|
-
settings: TIntegrationConfiguration;
|
|
1223
|
-
/** The Uniform project ID */
|
|
1224
|
-
projectId: string;
|
|
1305
|
+
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1225
1306
|
prompt: string;
|
|
1226
1307
|
promptMetadata: Record<string, unknown>;
|
|
1227
1308
|
/** Useful to differentiate AI Generate UI between text and image */
|
|
1228
|
-
promptOutputType: 'text' | 'image';
|
|
1229
|
-
}
|
|
1230
|
-
type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1231
|
-
settings: TIntegrationConfiguration;
|
|
1309
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1310
|
+
}, TIntegrationConfiguration>;
|
|
1311
|
+
type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1232
1312
|
/** Useful to differentiate metadata settings between text and image generation */
|
|
1233
|
-
promptOutputType: 'text' | 'image';
|
|
1234
|
-
}
|
|
1313
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1314
|
+
}, TIntegrationConfiguration>;
|
|
1235
1315
|
type AIGenerateLocation<TType> = MeshLocationCore<TType, AIGenerateLocationMetadata, TType, 'aiGenerate'>;
|
|
1236
1316
|
type AIPromptMetadataLocation = MeshLocationCore<Record<string, unknown>, PromptSettingsLocationMetadata, Record<string, unknown>, 'aiMetadata'>;
|
|
1237
1317
|
|
|
1238
|
-
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1239
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1240
|
-
settings: TIntegrationConfiguration;
|
|
1318
|
+
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1241
1319
|
/** The Uniform project ID */
|
|
1242
|
-
projectId: string;
|
|
1243
1320
|
componentDefinition: ComponentDefinition;
|
|
1244
|
-
}
|
|
1321
|
+
}, TIntegrationConfiguration>;
|
|
1245
1322
|
type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
|
|
1246
1323
|
|
|
1247
1324
|
interface SdkWindow {
|
|
@@ -1341,4 +1418,10 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
|
|
|
1341
1418
|
autoResizingDisabled?: boolean;
|
|
1342
1419
|
}): Promise<UniformMeshSDK | undefined>;
|
|
1343
1420
|
|
|
1344
|
-
|
|
1421
|
+
declare const hasPermissions: (permissions: MeshLocationUserPermissions | MeshLocationUserPermissions[], user: UniformUser) => boolean;
|
|
1422
|
+
/**
|
|
1423
|
+
* Check if user has a role by both name and id
|
|
1424
|
+
*/
|
|
1425
|
+
declare const hasRole: (role: string, user: UniformUser) => boolean;
|
|
1426
|
+
|
|
1427
|
+
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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -480,10 +480,6 @@ async function connectToParent({
|
|
|
480
480
|
await client.request("setValue", value);
|
|
481
481
|
},
|
|
482
482
|
openDialog: async (message) => {
|
|
483
|
-
var _a;
|
|
484
|
-
if (getByteSize((_a = message.options) == null ? void 0 : _a.params) > 1e5) {
|
|
485
|
-
throw new Error(`Dialog parameters object is too large, maximum size is 100KB`);
|
|
486
|
-
}
|
|
487
483
|
const res = await client.request(
|
|
488
484
|
"openDialog",
|
|
489
485
|
message
|
|
@@ -519,18 +515,6 @@ async function connectToParent({
|
|
|
519
515
|
}
|
|
520
516
|
};
|
|
521
517
|
}
|
|
522
|
-
function getByteSize(val) {
|
|
523
|
-
if (!val || typeof Blob === "undefined") {
|
|
524
|
-
return 0;
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
const serialized = JSON.stringify(val);
|
|
528
|
-
const size = new Blob([serialized]).size;
|
|
529
|
-
return size;
|
|
530
|
-
} catch (error) {
|
|
531
|
-
throw new Error("Error calculating object size: " + error.message);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
518
|
|
|
535
519
|
// src/sdkWindow.ts
|
|
536
520
|
import imagesLoaded from "imagesloaded";
|
|
@@ -801,8 +785,26 @@ async function initializeUniformMeshSDK({
|
|
|
801
785
|
return sdk;
|
|
802
786
|
}
|
|
803
787
|
}
|
|
788
|
+
|
|
789
|
+
// src/user.ts
|
|
790
|
+
var hasPermissions = (permissions, user) => {
|
|
791
|
+
if (user.isAdmin)
|
|
792
|
+
return true;
|
|
793
|
+
if (Array.isArray(permissions)) {
|
|
794
|
+
return permissions.every((permission) => user.permissions.includes(permission));
|
|
795
|
+
} else {
|
|
796
|
+
return user.permissions.includes(permissions);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
var hasRole = (role, user) => {
|
|
800
|
+
if (user.isAdmin)
|
|
801
|
+
return true;
|
|
802
|
+
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
803
|
+
};
|
|
804
804
|
export {
|
|
805
805
|
IntegrationDefinitionClient,
|
|
806
806
|
IntegrationInstallationClient,
|
|
807
|
+
hasPermissions,
|
|
808
|
+
hasRole,
|
|
807
809
|
initializeUniformMeshSDK
|
|
808
810
|
};
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ var src_exports = {};
|
|
|
45
45
|
__export(src_exports, {
|
|
46
46
|
IntegrationDefinitionClient: () => IntegrationDefinitionClient,
|
|
47
47
|
IntegrationInstallationClient: () => IntegrationInstallationClient,
|
|
48
|
+
hasPermissions: () => hasPermissions,
|
|
49
|
+
hasRole: () => hasRole,
|
|
48
50
|
initializeUniformMeshSDK: () => initializeUniformMeshSDK
|
|
49
51
|
});
|
|
50
52
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -517,10 +519,6 @@ async function connectToParent({
|
|
|
517
519
|
await client.request("setValue", value);
|
|
518
520
|
},
|
|
519
521
|
openDialog: async (message) => {
|
|
520
|
-
var _a;
|
|
521
|
-
if (getByteSize((_a = message.options) == null ? void 0 : _a.params) > 1e5) {
|
|
522
|
-
throw new Error(`Dialog parameters object is too large, maximum size is 100KB`);
|
|
523
|
-
}
|
|
524
522
|
const res = await client.request(
|
|
525
523
|
"openDialog",
|
|
526
524
|
message
|
|
@@ -556,18 +554,6 @@ async function connectToParent({
|
|
|
556
554
|
}
|
|
557
555
|
};
|
|
558
556
|
}
|
|
559
|
-
function getByteSize(val) {
|
|
560
|
-
if (!val || typeof Blob === "undefined") {
|
|
561
|
-
return 0;
|
|
562
|
-
}
|
|
563
|
-
try {
|
|
564
|
-
const serialized = JSON.stringify(val);
|
|
565
|
-
const size = new Blob([serialized]).size;
|
|
566
|
-
return size;
|
|
567
|
-
} catch (error) {
|
|
568
|
-
throw new Error("Error calculating object size: " + error.message);
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
557
|
|
|
572
558
|
// src/sdkWindow.ts
|
|
573
559
|
var import_imagesloaded = __toESM(require("imagesloaded"));
|
|
@@ -838,9 +824,27 @@ async function initializeUniformMeshSDK({
|
|
|
838
824
|
return sdk;
|
|
839
825
|
}
|
|
840
826
|
}
|
|
827
|
+
|
|
828
|
+
// src/user.ts
|
|
829
|
+
var hasPermissions = (permissions, user) => {
|
|
830
|
+
if (user.isAdmin)
|
|
831
|
+
return true;
|
|
832
|
+
if (Array.isArray(permissions)) {
|
|
833
|
+
return permissions.every((permission) => user.permissions.includes(permission));
|
|
834
|
+
} else {
|
|
835
|
+
return user.permissions.includes(permissions);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
var hasRole = (role, user) => {
|
|
839
|
+
if (user.isAdmin)
|
|
840
|
+
return true;
|
|
841
|
+
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
842
|
+
};
|
|
841
843
|
// Annotate the CommonJS export names for ESM import in node:
|
|
842
844
|
0 && (module.exports = {
|
|
843
845
|
IntegrationDefinitionClient,
|
|
844
846
|
IntegrationInstallationClient,
|
|
847
|
+
hasPermissions,
|
|
848
|
+
hasRole,
|
|
845
849
|
initializeUniformMeshSDK
|
|
846
850
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -480,10 +480,6 @@ async function connectToParent({
|
|
|
480
480
|
await client.request("setValue", value);
|
|
481
481
|
},
|
|
482
482
|
openDialog: async (message) => {
|
|
483
|
-
var _a;
|
|
484
|
-
if (getByteSize((_a = message.options) == null ? void 0 : _a.params) > 1e5) {
|
|
485
|
-
throw new Error(`Dialog parameters object is too large, maximum size is 100KB`);
|
|
486
|
-
}
|
|
487
483
|
const res = await client.request(
|
|
488
484
|
"openDialog",
|
|
489
485
|
message
|
|
@@ -519,18 +515,6 @@ async function connectToParent({
|
|
|
519
515
|
}
|
|
520
516
|
};
|
|
521
517
|
}
|
|
522
|
-
function getByteSize(val) {
|
|
523
|
-
if (!val || typeof Blob === "undefined") {
|
|
524
|
-
return 0;
|
|
525
|
-
}
|
|
526
|
-
try {
|
|
527
|
-
const serialized = JSON.stringify(val);
|
|
528
|
-
const size = new Blob([serialized]).size;
|
|
529
|
-
return size;
|
|
530
|
-
} catch (error) {
|
|
531
|
-
throw new Error("Error calculating object size: " + error.message);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
518
|
|
|
535
519
|
// src/sdkWindow.ts
|
|
536
520
|
import imagesLoaded from "imagesloaded";
|
|
@@ -801,8 +785,26 @@ async function initializeUniformMeshSDK({
|
|
|
801
785
|
return sdk;
|
|
802
786
|
}
|
|
803
787
|
}
|
|
788
|
+
|
|
789
|
+
// src/user.ts
|
|
790
|
+
var hasPermissions = (permissions, user) => {
|
|
791
|
+
if (user.isAdmin)
|
|
792
|
+
return true;
|
|
793
|
+
if (Array.isArray(permissions)) {
|
|
794
|
+
return permissions.every((permission) => user.permissions.includes(permission));
|
|
795
|
+
} else {
|
|
796
|
+
return user.permissions.includes(permissions);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
var hasRole = (role, user) => {
|
|
800
|
+
if (user.isAdmin)
|
|
801
|
+
return true;
|
|
802
|
+
return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
|
|
803
|
+
};
|
|
804
804
|
export {
|
|
805
805
|
IntegrationDefinitionClient,
|
|
806
806
|
IntegrationInstallationClient,
|
|
807
|
+
hasPermissions,
|
|
808
|
+
hasRole,
|
|
807
809
|
initializeUniformMeshSDK
|
|
808
810
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/mesh-sdk",
|
|
3
|
-
"version": "19.79.1-alpha.
|
|
3
|
+
"version": "19.79.1-alpha.18+12234b9350",
|
|
4
4
|
"description": "Uniform Mesh Framework SDK",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uniformdev/canvas": "19.79.1-alpha.
|
|
37
|
-
"@uniformdev/context": "19.79.1-alpha.
|
|
38
|
-
"@uniformdev/project-map": "19.79.1-alpha.
|
|
36
|
+
"@uniformdev/canvas": "19.79.1-alpha.18+12234b9350",
|
|
37
|
+
"@uniformdev/context": "19.79.1-alpha.18+12234b9350",
|
|
38
|
+
"@uniformdev/project-map": "19.79.1-alpha.18+12234b9350",
|
|
39
39
|
"imagesloaded": "^5.0.0",
|
|
40
40
|
"mitt": "^3.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/imagesloaded": "^4.1.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "12234b9350cfa4209bc7e242701d2dc535ece19e"
|
|
46
46
|
}
|