@uniformdev/mesh-sdk 19.79.1-alpha.11 → 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 +199 -139
- package/dist/index.d.ts +199 -139
- 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/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 {
|
|
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?: {
|
|
@@ -102,6 +106,14 @@ interface paths$1 {
|
|
|
102
106
|
singleAssetArchetypeId: string;
|
|
103
107
|
};
|
|
104
108
|
};
|
|
109
|
+
unstable_assetLibrary?: {
|
|
110
|
+
url: string;
|
|
111
|
+
dynamicAssets?: {
|
|
112
|
+
dataConnectorId: string;
|
|
113
|
+
assetsListArchetypeId: string;
|
|
114
|
+
singleAssetArchetypeId: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
105
117
|
ai?: {
|
|
106
118
|
generateUrl: string;
|
|
107
119
|
metadataUrl?: string;
|
|
@@ -119,7 +131,7 @@ interface paths$1 {
|
|
|
119
131
|
default?: string | null;
|
|
120
132
|
};
|
|
121
133
|
} | null;
|
|
122
|
-
metadata?: unknown;
|
|
134
|
+
metadata?: unknown | null;
|
|
123
135
|
} | null;
|
|
124
136
|
parameterTypes: string[];
|
|
125
137
|
}[];
|
|
@@ -143,7 +155,7 @@ interface paths$1 {
|
|
|
143
155
|
default?: string | null;
|
|
144
156
|
};
|
|
145
157
|
} | null;
|
|
146
|
-
metadata?: unknown;
|
|
158
|
+
metadata?: unknown | null;
|
|
147
159
|
} | null;
|
|
148
160
|
parameterTypes: string[];
|
|
149
161
|
}[];
|
|
@@ -172,6 +184,7 @@ interface paths$1 {
|
|
|
172
184
|
/** @enum {string} */
|
|
173
185
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
174
186
|
public?: boolean;
|
|
187
|
+
scopes?: string[];
|
|
175
188
|
baseLocationUrl?: string;
|
|
176
189
|
locations: {
|
|
177
190
|
install?: {
|
|
@@ -204,6 +217,8 @@ interface paths$1 {
|
|
|
204
217
|
};
|
|
205
218
|
};
|
|
206
219
|
renderableInPropertyPanel?: boolean;
|
|
220
|
+
/** @enum {string} */
|
|
221
|
+
localizable?: "default-yes" | "default-no" | "yes" | "no";
|
|
207
222
|
}[];
|
|
208
223
|
};
|
|
209
224
|
dataConnectors?: {
|
|
@@ -243,6 +258,14 @@ interface paths$1 {
|
|
|
243
258
|
singleAssetArchetypeId: string;
|
|
244
259
|
};
|
|
245
260
|
};
|
|
261
|
+
unstable_assetLibrary?: {
|
|
262
|
+
url: string;
|
|
263
|
+
dynamicAssets?: {
|
|
264
|
+
dataConnectorId: string;
|
|
265
|
+
assetsListArchetypeId: string;
|
|
266
|
+
singleAssetArchetypeId: string;
|
|
267
|
+
};
|
|
268
|
+
};
|
|
246
269
|
ai?: {
|
|
247
270
|
generateUrl: string;
|
|
248
271
|
metadataUrl?: string;
|
|
@@ -260,7 +283,7 @@ interface paths$1 {
|
|
|
260
283
|
default?: string | null;
|
|
261
284
|
};
|
|
262
285
|
} | null;
|
|
263
|
-
metadata?: unknown;
|
|
286
|
+
metadata?: unknown | null;
|
|
264
287
|
} | null;
|
|
265
288
|
parameterTypes: string[];
|
|
266
289
|
}[];
|
|
@@ -284,7 +307,7 @@ interface paths$1 {
|
|
|
284
307
|
default?: string | null;
|
|
285
308
|
};
|
|
286
309
|
} | null;
|
|
287
|
-
metadata?: unknown;
|
|
310
|
+
metadata?: unknown | null;
|
|
288
311
|
} | null;
|
|
289
312
|
parameterTypes: string[];
|
|
290
313
|
}[];
|
|
@@ -312,6 +335,7 @@ interface paths$1 {
|
|
|
312
335
|
badgeIconUrl?: string;
|
|
313
336
|
/** @enum {string} */
|
|
314
337
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown";
|
|
338
|
+
scopes?: string[];
|
|
315
339
|
baseLocationUrl?: string;
|
|
316
340
|
locations: {
|
|
317
341
|
install?: {
|
|
@@ -344,6 +368,8 @@ interface paths$1 {
|
|
|
344
368
|
};
|
|
345
369
|
};
|
|
346
370
|
renderableInPropertyPanel?: boolean;
|
|
371
|
+
/** @enum {string} */
|
|
372
|
+
localizable?: "default-yes" | "default-no" | "yes" | "no";
|
|
347
373
|
}[];
|
|
348
374
|
};
|
|
349
375
|
dataConnectors?: {
|
|
@@ -383,6 +409,14 @@ interface paths$1 {
|
|
|
383
409
|
singleAssetArchetypeId: string;
|
|
384
410
|
};
|
|
385
411
|
};
|
|
412
|
+
unstable_assetLibrary?: {
|
|
413
|
+
url: string;
|
|
414
|
+
dynamicAssets?: {
|
|
415
|
+
dataConnectorId: string;
|
|
416
|
+
assetsListArchetypeId: string;
|
|
417
|
+
singleAssetArchetypeId: string;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
386
420
|
ai?: {
|
|
387
421
|
generateUrl: string;
|
|
388
422
|
metadataUrl?: string;
|
|
@@ -400,7 +434,7 @@ interface paths$1 {
|
|
|
400
434
|
default?: string | null;
|
|
401
435
|
};
|
|
402
436
|
} | null;
|
|
403
|
-
metadata?: unknown;
|
|
437
|
+
metadata?: unknown | null;
|
|
404
438
|
} | null;
|
|
405
439
|
parameterTypes: string[];
|
|
406
440
|
}[];
|
|
@@ -424,7 +458,7 @@ interface paths$1 {
|
|
|
424
458
|
default?: string | null;
|
|
425
459
|
};
|
|
426
460
|
} | null;
|
|
427
|
-
metadata?: unknown;
|
|
461
|
+
metadata?: unknown | null;
|
|
428
462
|
} | null;
|
|
429
463
|
parameterTypes: string[];
|
|
430
464
|
}[];
|
|
@@ -701,6 +735,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
|
|
|
701
735
|
badgeIconUrl?: string | undefined;
|
|
702
736
|
category?: "analytics" | "cdn" | "classic" | "commerce" | "content" | "comingSoon" | "data" | "deprecated" | "email" | "framework" | "search" | "starters" | "uniform" | "ai" | "unknown" | undefined;
|
|
703
737
|
public?: boolean | undefined;
|
|
738
|
+
scopes?: string[] | undefined;
|
|
704
739
|
baseLocationUrl?: string | undefined;
|
|
705
740
|
locations: {
|
|
706
741
|
install?: {
|
|
@@ -733,6 +768,7 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
|
|
|
733
768
|
};
|
|
734
769
|
} | undefined;
|
|
735
770
|
renderableInPropertyPanel?: boolean | undefined;
|
|
771
|
+
localizable?: "default-yes" | "default-no" | "yes" | "no" | undefined;
|
|
736
772
|
}[];
|
|
737
773
|
} | undefined;
|
|
738
774
|
dataConnectors?: {
|
|
@@ -772,6 +808,14 @@ declare class IntegrationDefinitionClient extends ApiClient<DefClientOptions> {
|
|
|
772
808
|
singleAssetArchetypeId: string;
|
|
773
809
|
} | undefined;
|
|
774
810
|
} | undefined;
|
|
811
|
+
unstable_assetLibrary?: {
|
|
812
|
+
url: string;
|
|
813
|
+
dynamicAssets?: {
|
|
814
|
+
dataConnectorId: string;
|
|
815
|
+
assetsListArchetypeId: string;
|
|
816
|
+
singleAssetArchetypeId: string;
|
|
817
|
+
} | undefined;
|
|
818
|
+
} | undefined;
|
|
775
819
|
ai?: {
|
|
776
820
|
generateUrl: string;
|
|
777
821
|
metadataUrl?: string | undefined;
|
|
@@ -836,19 +880,11 @@ declare class IntegrationInstallationClient extends ApiClient {
|
|
|
836
880
|
remove(body: ExceptProject<IntegrationInstallationDeleteParameters>): Promise<void>;
|
|
837
881
|
}
|
|
838
882
|
|
|
839
|
-
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
840
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
841
|
-
settings: TIntegrationConfiguration;
|
|
842
|
-
/** The Uniform project ID */
|
|
843
|
-
projectId: string;
|
|
883
|
+
type AssetLibraryLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
844
884
|
/** The current Uniform integration source ID */
|
|
845
885
|
sourceId: string;
|
|
846
|
-
}
|
|
847
|
-
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
848
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
849
|
-
settings: TIntegrationConfiguration;
|
|
850
|
-
/** The Uniform project ID */
|
|
851
|
-
projectId: string;
|
|
886
|
+
}, TIntegrationConfiguration>;
|
|
887
|
+
type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
852
888
|
/** The current Uniform integration source ID */
|
|
853
889
|
sourceId: string;
|
|
854
890
|
/** The resolved data if this source is connected to a data resource */
|
|
@@ -859,81 +895,7 @@ type AssetParameterLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
859
895
|
* Default: 1
|
|
860
896
|
*/
|
|
861
897
|
maxAssets?: number;
|
|
862
|
-
}
|
|
863
|
-
type AssetParamValue = AssetParamValueItem[];
|
|
864
|
-
type AssetParamValueItem = {
|
|
865
|
-
type: string;
|
|
866
|
-
_id: string;
|
|
867
|
-
/**
|
|
868
|
-
* Internal Uniform source ID or
|
|
869
|
-
* dataType ID of the global integration library
|
|
870
|
-
* which created this asset item
|
|
871
|
-
*/
|
|
872
|
-
_source?: string;
|
|
873
|
-
fields: {
|
|
874
|
-
url: {
|
|
875
|
-
type: 'text';
|
|
876
|
-
value: string;
|
|
877
|
-
};
|
|
878
|
-
id?: {
|
|
879
|
-
type: 'text';
|
|
880
|
-
value: string | undefined;
|
|
881
|
-
};
|
|
882
|
-
title?: {
|
|
883
|
-
type: 'text';
|
|
884
|
-
value: string | undefined;
|
|
885
|
-
};
|
|
886
|
-
description?: {
|
|
887
|
-
type: 'text';
|
|
888
|
-
value: string | undefined;
|
|
889
|
-
};
|
|
890
|
-
mediaType?: {
|
|
891
|
-
type: 'text';
|
|
892
|
-
value: string | undefined;
|
|
893
|
-
};
|
|
894
|
-
/**
|
|
895
|
-
* The width of the original asset
|
|
896
|
-
*
|
|
897
|
-
* Should resolve to a number but might
|
|
898
|
-
* be a string with a pointer reference
|
|
899
|
-
*/
|
|
900
|
-
width?: {
|
|
901
|
-
type: 'number';
|
|
902
|
-
value: number | string | undefined;
|
|
903
|
-
};
|
|
904
|
-
/**
|
|
905
|
-
* The height of the original asset
|
|
906
|
-
*
|
|
907
|
-
* Should resolve to a number but might
|
|
908
|
-
* be a string with a pointer reference
|
|
909
|
-
*/
|
|
910
|
-
height?: {
|
|
911
|
-
type: 'number';
|
|
912
|
-
value: number | string | undefined;
|
|
913
|
-
};
|
|
914
|
-
/**
|
|
915
|
-
* The size in bytes of the original asset
|
|
916
|
-
*
|
|
917
|
-
* Should resolve to a number but might
|
|
918
|
-
* be a string with a pointer reference
|
|
919
|
-
*/
|
|
920
|
-
size?: {
|
|
921
|
-
type: 'number';
|
|
922
|
-
value: number | string | undefined;
|
|
923
|
-
};
|
|
924
|
-
/**
|
|
925
|
-
* Any key/value properties which the source
|
|
926
|
-
* wants to attach to the asset data
|
|
927
|
-
*/
|
|
928
|
-
custom?: {
|
|
929
|
-
type: string;
|
|
930
|
-
value: Record<string, unknown>;
|
|
931
|
-
};
|
|
932
|
-
};
|
|
933
|
-
_overrides?: {
|
|
934
|
-
fields: ComponentOverride['parameters'];
|
|
935
|
-
};
|
|
936
|
-
};
|
|
898
|
+
}, TIntegrationConfiguration>;
|
|
937
899
|
type AssetLibraryLocation = MeshLocationCore<unknown, AssetLibraryLocationMetadata, unknown, 'assetLibrary'> & GetDataResourceLocation;
|
|
938
900
|
type AssetParameterLocation = MeshLocationCore<AssetParamValue, AssetParameterLocationMetadata, AssetParamValue, 'assetParameter'> & GetDataResourceLocation;
|
|
939
901
|
|
|
@@ -942,11 +904,7 @@ type DataConnectorInfo = {
|
|
|
942
904
|
type: string;
|
|
943
905
|
displayName: string;
|
|
944
906
|
};
|
|
945
|
-
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
946
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
947
|
-
settings: TIntegrationConfiguration;
|
|
948
|
-
/** The Uniform project ID */
|
|
949
|
-
projectId: string;
|
|
907
|
+
type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
950
908
|
/**
|
|
951
909
|
* The current data type's data source. NOTE: param and header values are not available in this context.
|
|
952
910
|
*/
|
|
@@ -955,13 +913,10 @@ type DataTypeLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
955
913
|
dataConnector: DataConnectorInfo;
|
|
956
914
|
/** The data type's archetype value. */
|
|
957
915
|
archetype: string;
|
|
958
|
-
}
|
|
916
|
+
}, TIntegrationConfiguration>;
|
|
959
917
|
type DataTypeLocation = MeshLocationCore<DataTypeLocationValue, DataTypeLocationMetadata, DataTypeLocationValue, 'dataType'> & GetDataResourceLocation;
|
|
960
918
|
|
|
961
|
-
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
962
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
963
|
-
settings: TIntegrationConfiguration;
|
|
964
|
-
/** The current data resource's data type */
|
|
919
|
+
type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
965
920
|
dataType: DataType;
|
|
966
921
|
/** The data type's archetype value. */
|
|
967
922
|
archetype: string;
|
|
@@ -971,32 +926,21 @@ type DataResourceLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
|
971
926
|
dataSource: DataSource;
|
|
972
927
|
/** The data connector type of the current data resource's data source */
|
|
973
928
|
dataConnector: DataConnectorInfo;
|
|
974
|
-
/** The Uniform project ID */
|
|
975
|
-
projectId: string;
|
|
976
929
|
/** Current dynamic inputs that are configured on the composition (if any). */
|
|
977
930
|
dynamicInputs: DynamicInputs;
|
|
978
|
-
}
|
|
931
|
+
}, TIntegrationConfiguration>;
|
|
979
932
|
type DataResourceLocation = MeshLocationCore<DataResourceVariables, DataResourceLocationMetadata, DataResourceVariables, 'dataResource'> & GetDataResourceLocation;
|
|
980
933
|
|
|
981
|
-
type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'headers' | 'parameters' | 'variables'>;
|
|
982
|
-
type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> =
|
|
983
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
984
|
-
settings: TIntegrationConfiguration;
|
|
985
|
-
/** The Uniform project ID */
|
|
986
|
-
projectId: string;
|
|
987
|
-
};
|
|
934
|
+
type DataSourceLocationValue = Pick<DataSource, 'baseUrl' | 'custom' | 'customPublic' | 'headers' | 'parameters' | 'variables'>;
|
|
935
|
+
type DataSourceLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<unknown, TIntegrationConfiguration>;
|
|
988
936
|
type DataSourceLocation = MeshLocationCore<DataSourceLocationValue, DataSourceLocationMetadata, DataSourceLocationValue, 'dataSource'>;
|
|
989
937
|
|
|
990
|
-
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = {
|
|
938
|
+
type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
991
939
|
rootNode: Omit<RootComponentInstance, 'slots' | '_data'>;
|
|
992
940
|
parameterConfiguration: TParamConfiguration;
|
|
993
941
|
component: Omit<ComponentInstance, 'slots'>;
|
|
994
942
|
componentDefinitions: Record<string, ComponentDefinition | undefined>;
|
|
995
943
|
parameterDefinition: ComponentDefinitionParameter;
|
|
996
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
997
|
-
settings: TIntegrationConfiguration;
|
|
998
|
-
/** The Uniform project ID */
|
|
999
|
-
projectId: string;
|
|
1000
944
|
/**
|
|
1001
945
|
* Current dynamic inputs that are configured on the composition (if any).
|
|
1002
946
|
* Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
|
|
@@ -1011,7 +955,14 @@ type ParamTypeLocationMetadata<TParamConfiguration = unknown, TIntegrationConfig
|
|
|
1011
955
|
* Use the <ParamTypeDynamicDataProvider> to wire up dynamic data in your parameter.
|
|
1012
956
|
*/
|
|
1013
957
|
connectedData: Record<string, unknown>;
|
|
1014
|
-
|
|
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>;
|
|
1015
966
|
type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TParamSetValue = TParamValue, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeLocationMetadata<TParamConfiguration, TIntegrationConfiguration>, TParamSetValue, 'paramType'> & {
|
|
1016
967
|
/**
|
|
1017
968
|
* Opens a dialog on the Uniform platform to edit or select a dynamic token to connect to.
|
|
@@ -1020,9 +971,7 @@ type ParamTypeLocation<TParamValue = unknown, TParamConfiguration = unknown, TPa
|
|
|
1020
971
|
editConnectedData: Awaited<ReturnType<typeof connectToParent>>['parent']['editConnectedData'];
|
|
1021
972
|
};
|
|
1022
973
|
|
|
1023
|
-
type SettingsLocationMetadata =
|
|
1024
|
-
projectId: string;
|
|
1025
|
-
};
|
|
974
|
+
type SettingsLocationMetadata = CommonMetadata;
|
|
1026
975
|
type SettingsLocation<TSettingsType> = MeshLocationCore<TSettingsType, SettingsLocationMetadata, TSettingsType, 'settings'>;
|
|
1027
976
|
|
|
1028
977
|
/**
|
|
@@ -1068,6 +1017,12 @@ type OpenDialogResult = {
|
|
|
1068
1017
|
dialogLocation?: string;
|
|
1069
1018
|
};
|
|
1070
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
|
+
};
|
|
1071
1026
|
interface DialogOptions<TDialogParams = DialogParams> {
|
|
1072
1027
|
/**
|
|
1073
1028
|
* By default, dialogs will be closed when they set a value.
|
|
@@ -1079,9 +1034,12 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1079
1034
|
disableCloseDialogOnSetValue?: boolean;
|
|
1080
1035
|
/**
|
|
1081
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
|
+
*
|
|
1082
1040
|
* @deprecated Use `width` instead. This property will become ignored in a future release.
|
|
1083
1041
|
*/
|
|
1084
|
-
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;
|
|
1085
1043
|
/**
|
|
1086
1044
|
* Options for setting the width of the dialog.
|
|
1087
1045
|
*/
|
|
@@ -1091,6 +1049,10 @@ interface DialogOptions<TDialogParams = DialogParams> {
|
|
|
1091
1049
|
* the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
|
|
1092
1050
|
* Parameters should be simple (serializable) types, not functions or DOM
|
|
1093
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/
|
|
1094
1056
|
*/
|
|
1095
1057
|
params?: TDialogParams;
|
|
1096
1058
|
/**
|
|
@@ -1128,7 +1090,7 @@ type CloseDialogMessage = {
|
|
|
1128
1090
|
dialogType: DialogType;
|
|
1129
1091
|
dialogData?: unknown;
|
|
1130
1092
|
};
|
|
1131
|
-
type GetDataResourceMessage = Pick<DataType, 'path' | 'headers' | 'parameters' | 'body' | 'method'>;
|
|
1093
|
+
type GetDataResourceMessage = Pick<DataType, 'path' | 'archetype' | 'headers' | 'parameters' | 'body' | 'method'>;
|
|
1132
1094
|
/** Primitive data types that a parameter type accepts to be bound to composition data */
|
|
1133
1095
|
type BindableTypes = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
1134
1096
|
/** Message to parent to create a data connection expression to insert in a param type */
|
|
@@ -1153,6 +1115,22 @@ type EditConnectedDataResponse = {
|
|
|
1153
1115
|
canceled: true;
|
|
1154
1116
|
editorCancelledContext: EditConnectedDataResponseCancellationContext;
|
|
1155
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
|
+
};
|
|
1156
1134
|
|
|
1157
1135
|
type MeshSDKEventInterface = Awaited<ReturnType<typeof connectToParent>>['parent'] & {
|
|
1158
1136
|
initialize: () => Promise<MeshContextData>;
|
|
@@ -1215,6 +1193,86 @@ interface MeshLocationCore<TValue = unknown, TMetadata = unknown, TSetValue = TV
|
|
|
1215
1193
|
returnDialogValue: (value: unknown) => Promise<void>;
|
|
1216
1194
|
};
|
|
1217
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';
|
|
1218
1276
|
/**
|
|
1219
1277
|
* Known location types that can be passed to a mesh location
|
|
1220
1278
|
*/
|
|
@@ -1244,27 +1302,23 @@ type DynamicInput = {
|
|
|
1244
1302
|
/** Record of dynamic inputs keyed by the input name */
|
|
1245
1303
|
type DynamicInputs = Record<string, DynamicInput>;
|
|
1246
1304
|
|
|
1247
|
-
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1248
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1249
|
-
settings: TIntegrationConfiguration;
|
|
1250
|
-
/** The Uniform project ID */
|
|
1251
|
-
projectId: string;
|
|
1305
|
+
type AIGenerateLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1252
1306
|
prompt: string;
|
|
1253
1307
|
promptMetadata: Record<string, unknown>;
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1308
|
+
/** Useful to differentiate AI Generate UI between text and image */
|
|
1309
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1310
|
+
}, TIntegrationConfiguration>;
|
|
1311
|
+
type PromptSettingsLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1312
|
+
/** Useful to differentiate metadata settings between text and image generation */
|
|
1313
|
+
promptOutputType: 'text' | 'image' | 'json';
|
|
1314
|
+
}, TIntegrationConfiguration>;
|
|
1258
1315
|
type AIGenerateLocation<TType> = MeshLocationCore<TType, AIGenerateLocationMetadata, TType, 'aiGenerate'>;
|
|
1259
1316
|
type AIPromptMetadataLocation = MeshLocationCore<Record<string, unknown>, PromptSettingsLocationMetadata, Record<string, unknown>, 'aiMetadata'>;
|
|
1260
1317
|
|
|
1261
|
-
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = {
|
|
1262
|
-
/** Settings defined at the integration level (arbitrary type used on settings location) */
|
|
1263
|
-
settings: TIntegrationConfiguration;
|
|
1318
|
+
type ParamTypeConfigLocationMetadata<TIntegrationConfiguration = unknown> = CommonMetadata<{
|
|
1264
1319
|
/** The Uniform project ID */
|
|
1265
|
-
projectId: string;
|
|
1266
1320
|
componentDefinition: ComponentDefinition;
|
|
1267
|
-
}
|
|
1321
|
+
}, TIntegrationConfiguration>;
|
|
1268
1322
|
type ParamTypeConfigLocation<TParamValue = unknown, TIntegrationConfiguration = unknown> = MeshLocationCore<TParamValue | undefined, ParamTypeConfigLocationMetadata<TIntegrationConfiguration>, TParamValue, 'paramTypeConfig'>;
|
|
1269
1323
|
|
|
1270
1324
|
interface SdkWindow {
|
|
@@ -1364,4 +1418,10 @@ declare function initializeUniformMeshSDK({ autoResizingDisabled, }?: {
|
|
|
1364
1418
|
autoResizingDisabled?: boolean;
|
|
1365
1419
|
}): Promise<UniformMeshSDK | undefined>;
|
|
1366
1420
|
|
|
1367
|
-
|
|
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
|
};
|