@uniformdev/canvas 19.80.0 → 19.81.2-alpha.22
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.mts +190 -39
- package/dist/index.d.ts +190 -39
- package/dist/index.esm.js +99 -20
- package/dist/index.js +111 -20
- package/dist/index.mjs +99 -20
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
@@ -1372,6 +1372,12 @@ declare const EDGE_MAX_CACHE_TTL: number;
|
|
1372
1372
|
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
1373
1373
|
/** A value that indicates that Edgehancers caching is disabled */
|
1374
1374
|
declare const EDGE_CACHE_DISABLED = -1;
|
1375
|
+
/** This is the type value for the asset parameter or field */
|
1376
|
+
declare const ASSET_PARAMETER_TYPE = "asset";
|
1377
|
+
/** The _source for any assets coming from the Uniform Asset Library */
|
1378
|
+
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1379
|
+
/** The _source for any assets which have manually set fields */
|
1380
|
+
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1375
1381
|
|
1376
1382
|
/**
|
1377
1383
|
* This file was auto-generated by openapi-typescript.
|
@@ -4327,6 +4333,7 @@ type DeleteContentTypeOptions = paths$b['/api/v1/content-types']['delete']['requ
|
|
4327
4333
|
type PutContentTypeBody = paths$b['/api/v1/content-types']['put']['requestBody']['content']['application/json'];
|
4328
4334
|
type GetContentTypesResponse = paths$b['/api/v1/content-types']['get']['responses']['200']['content']['application/json'];
|
4329
4335
|
type Entry = components$3['schemas']['EntryApiResponse'];
|
4336
|
+
type EntryList = components$3['schemas']['EntryListResponse'];
|
4330
4337
|
type EntryData = Entry['entry'];
|
4331
4338
|
type GetEntriesOptions = paths$a['/api/v1/entries']['get']['parameters']['query'];
|
4332
4339
|
type GetEntriesResponse = paths$a['/api/v1/entries']['get']['responses']['200']['content']['application/json'];
|
@@ -12489,8 +12496,9 @@ interface paths$1 {
|
|
12489
12496
|
parameters: {
|
12490
12497
|
query: {
|
12491
12498
|
projectId: string;
|
12492
|
-
type: "definition";
|
12499
|
+
type: "definition" | "instance";
|
12493
12500
|
definitionIds?: string;
|
12501
|
+
instanceIds?: string;
|
12494
12502
|
withCompositions?: boolean | null;
|
12495
12503
|
};
|
12496
12504
|
};
|
@@ -12850,6 +12858,81 @@ type schemas = components$1['schemas'];
|
|
12850
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12851
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12852
12860
|
|
12861
|
+
type AssetParamValue = AssetParamValueItem[];
|
12862
|
+
type AssetParamValueItem = {
|
12863
|
+
type: string;
|
12864
|
+
_id: string;
|
12865
|
+
/**
|
12866
|
+
* Internal Uniform source ID or
|
12867
|
+
* dataType ID of the global integration library
|
12868
|
+
* which created this asset item
|
12869
|
+
*/
|
12870
|
+
_source?: string;
|
12871
|
+
fields: {
|
12872
|
+
url: {
|
12873
|
+
type: 'text';
|
12874
|
+
value: string;
|
12875
|
+
};
|
12876
|
+
id?: {
|
12877
|
+
type: 'text';
|
12878
|
+
value: string | undefined;
|
12879
|
+
};
|
12880
|
+
title?: {
|
12881
|
+
type: 'text';
|
12882
|
+
value: string | undefined;
|
12883
|
+
};
|
12884
|
+
description?: {
|
12885
|
+
type: 'text';
|
12886
|
+
value: string | undefined;
|
12887
|
+
};
|
12888
|
+
mediaType?: {
|
12889
|
+
type: 'text';
|
12890
|
+
value: string | undefined;
|
12891
|
+
};
|
12892
|
+
/**
|
12893
|
+
* The width of the original asset
|
12894
|
+
*
|
12895
|
+
* Should resolve to a number but might
|
12896
|
+
* be a string with a pointer reference
|
12897
|
+
*/
|
12898
|
+
width?: {
|
12899
|
+
type: 'number';
|
12900
|
+
value: number | string | undefined;
|
12901
|
+
};
|
12902
|
+
/**
|
12903
|
+
* The height of the original asset
|
12904
|
+
*
|
12905
|
+
* Should resolve to a number but might
|
12906
|
+
* be a string with a pointer reference
|
12907
|
+
*/
|
12908
|
+
height?: {
|
12909
|
+
type: 'number';
|
12910
|
+
value: number | string | undefined;
|
12911
|
+
};
|
12912
|
+
/**
|
12913
|
+
* The size in bytes of the original asset
|
12914
|
+
*
|
12915
|
+
* Should resolve to a number but might
|
12916
|
+
* be a string with a pointer reference
|
12917
|
+
*/
|
12918
|
+
size?: {
|
12919
|
+
type: 'number';
|
12920
|
+
value: number | string | undefined;
|
12921
|
+
};
|
12922
|
+
/**
|
12923
|
+
* Any key/value properties which the source
|
12924
|
+
* wants to attach to the asset data
|
12925
|
+
*/
|
12926
|
+
custom?: {
|
12927
|
+
type: string;
|
12928
|
+
value: Record<string, unknown>;
|
12929
|
+
};
|
12930
|
+
};
|
12931
|
+
_overrides?: {
|
12932
|
+
fields: ComponentOverride['parameters'];
|
12933
|
+
};
|
12934
|
+
};
|
12935
|
+
|
12853
12936
|
type LinkParameterType = 'projectMapNode' | 'url' | 'tel' | 'email';
|
12854
12937
|
type LinkTypeConfiguration = Partial<Record<LinkParameterType, boolean>>;
|
12855
12938
|
type LinkParamConfiguration = {
|
@@ -13137,37 +13220,6 @@ declare function enhance<TContext extends EnhancerContext = EnhancerContext>({ c
|
|
13137
13220
|
onErrors?: (errors: EnhancerError[]) => void;
|
13138
13221
|
}): Promise<void>;
|
13139
13222
|
|
13140
|
-
/** @deprecated use walkNodeTree */
|
13141
|
-
type ComponentLocationReference = {
|
13142
|
-
component: ComponentInstance;
|
13143
|
-
parentSlot?: string;
|
13144
|
-
parentSlotIndex?: number;
|
13145
|
-
};
|
13146
|
-
/** @deprecated use walkNodeTree and check for type = slot */
|
13147
|
-
type WalkComponentTreeActions<TContext> = {
|
13148
|
-
/** Replaces the component being visited with a new object */
|
13149
|
-
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13150
|
-
/** Removes the component being visited from the composition */
|
13151
|
-
removeComponent: () => void;
|
13152
|
-
/** Inserts a new component immediately after the current component in its parent slot */
|
13153
|
-
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13154
|
-
/** Aborts visitation of components that are in child slots of the current component */
|
13155
|
-
stopProcessingDescendants: () => void;
|
13156
|
-
/**
|
13157
|
-
* Set a new traversal context for descendants of this node.
|
13158
|
-
* If this is not called, `context` will automatically pass through.
|
13159
|
-
*/
|
13160
|
-
setDescendantsContext: (context: TContext) => void;
|
13161
|
-
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13162
|
-
};
|
13163
|
-
/**
|
13164
|
-
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13165
|
-
* @deprecated use walkNodeTree
|
13166
|
-
*/
|
13167
|
-
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13168
|
-
/** Traversal context for this node */
|
13169
|
-
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13170
|
-
|
13171
13223
|
/** Ancestor location that is in a slot on a component */
|
13172
13224
|
type ComponentLocationReferenceV2 = {
|
13173
13225
|
type: 'slot';
|
@@ -13232,11 +13284,71 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13232
13284
|
};
|
13233
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13234
13286
|
declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
|
13287
|
+
/**
|
13288
|
+
* Any types which hold an array of nodes and
|
13289
|
+
* therefore should be iterated over as child nodes
|
13290
|
+
*/
|
13291
|
+
declare function isNestedNodeType(type: string): boolean;
|
13235
13292
|
/** Gets the typed value of a block parameter or block field */
|
13236
13293
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13237
13294
|
|
13295
|
+
interface FindInNodeTreeReference {
|
13296
|
+
key: string;
|
13297
|
+
pointer: string;
|
13298
|
+
/** This might be the composition parameter, or entry field */
|
13299
|
+
parameter: ComponentParameter;
|
13300
|
+
}
|
13301
|
+
/**
|
13302
|
+
* Walk a Composition or Entry tree to find parameters or fields
|
13303
|
+
* based on the predicate returning true
|
13304
|
+
*
|
13305
|
+
* @example
|
13306
|
+
*
|
13307
|
+
* const textReferences = findParameterInNodeTree(
|
13308
|
+
* composition,
|
13309
|
+
* (parameter) => parameter.type === 'text'
|
13310
|
+
* )
|
13311
|
+
*
|
13312
|
+
* @param data The composition or entry data
|
13313
|
+
* @param predicate Return true from this function to include the parameter in the results
|
13314
|
+
*/
|
13315
|
+
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13316
|
+
|
13317
|
+
/** @deprecated use walkNodeTree */
|
13318
|
+
type ComponentLocationReference = {
|
13319
|
+
component: ComponentInstance;
|
13320
|
+
parentSlot?: string;
|
13321
|
+
parentSlotIndex?: number;
|
13322
|
+
};
|
13323
|
+
/** @deprecated use walkNodeTree and check for type = slot */
|
13324
|
+
type WalkComponentTreeActions<TContext> = {
|
13325
|
+
/** Replaces the component being visited with a new object */
|
13326
|
+
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13327
|
+
/** Removes the component being visited from the composition */
|
13328
|
+
removeComponent: () => void;
|
13329
|
+
/** Inserts a new component immediately after the current component in its parent slot */
|
13330
|
+
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13331
|
+
/** Aborts visitation of components that are in child slots of the current component */
|
13332
|
+
stopProcessingDescendants: () => void;
|
13333
|
+
/**
|
13334
|
+
* Set a new traversal context for descendants of this node.
|
13335
|
+
* If this is not called, `context` will automatically pass through.
|
13336
|
+
*/
|
13337
|
+
setDescendantsContext: (context: TContext) => void;
|
13338
|
+
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13339
|
+
};
|
13340
|
+
/**
|
13341
|
+
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13342
|
+
* @deprecated use walkNodeTree
|
13343
|
+
*/
|
13344
|
+
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13345
|
+
/** Traversal context for this node */
|
13346
|
+
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13347
|
+
|
13238
13348
|
/** Returns the JSON pointer of a component based on its location */
|
13239
13349
|
declare function getComponentJsonPointer(ancestorsAndSelf: Array<NodeLocationReference | ComponentLocationReference>): string;
|
13350
|
+
declare function getNounForLocation(parentLocation: NodeLocationReference | ComponentLocationReference | undefined): "parameters" | "fields";
|
13351
|
+
declare function getNounForNode(node: ComponentInstance | EntryData | Array<NodeLocationReference>): "parameters" | "fields";
|
13240
13352
|
|
13241
13353
|
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference | NodeLocationReference>): string;
|
13242
13354
|
|
@@ -13651,11 +13763,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13651
13763
|
* Removes things like author, stats, etc.
|
13652
13764
|
*/
|
13653
13765
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13654
|
-
/**
|
13655
|
-
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13656
|
-
* If no properties are defined, returns undefined.
|
13657
|
-
*/
|
13658
|
-
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13659
13766
|
|
13660
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13661
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13694,7 +13801,17 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13694
13801
|
* Check to see if some generic composition data structure
|
13695
13802
|
* looks like Entry data
|
13696
13803
|
*/
|
13697
|
-
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13804
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13805
|
+
/**
|
13806
|
+
* A fast, non-exhaustive guard which checks that the value is an array
|
13807
|
+
* as well as the first item, if there is one, looks like an asset item
|
13808
|
+
*/
|
13809
|
+
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13810
|
+
/**
|
13811
|
+
* A fast, non-exhaustive guard which checks the
|
13812
|
+
* required structure of an asset item
|
13813
|
+
*/
|
13814
|
+
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13698
13815
|
|
13699
13816
|
declare const generateHash: ({ composition, secret, }: {
|
13700
13817
|
composition: RootComponentInstance;
|
@@ -13725,6 +13842,40 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13725
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13726
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13727
13844
|
|
13845
|
+
/**
|
13846
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13847
|
+
* If no properties are defined, returns undefined.
|
13848
|
+
*/
|
13849
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13850
|
+
interface GetNodeValuesOptions {
|
13851
|
+
/**
|
13852
|
+
* If the property has nested properties, like Blocks or Assets
|
13853
|
+
* can, then how many levels should we traverse.
|
13854
|
+
*
|
13855
|
+
* You can set this to `Infinity` although it would be more
|
13856
|
+
* advisable, for performance, to use the number you need in your code.
|
13857
|
+
*
|
13858
|
+
* Where:
|
13859
|
+
* levels=0 will only extract the properties of the current object
|
13860
|
+
* levels=1 will include any child blocks or assets on the current object
|
13861
|
+
* but not any grandchildren
|
13862
|
+
*
|
13863
|
+
* @default 1
|
13864
|
+
*/
|
13865
|
+
levels?: number;
|
13866
|
+
}
|
13867
|
+
/**
|
13868
|
+
* Get the data stored in the value of a component parameter
|
13869
|
+
* or a field attached to an Entry, Block or Asset
|
13870
|
+
*/
|
13871
|
+
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13872
|
+
declare function getPropertyValue(parameter: null): null;
|
13873
|
+
declare function getPropertyValue(parameter: undefined): undefined;
|
13874
|
+
type NodeWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13875
|
+
declare function getNodeValues(node: NodeWithProperties, options?: GetNodeValuesOptions): Record<string, unknown>;
|
13876
|
+
declare function getNodeValues(node: Array<NodeWithProperties>, options?: GetNodeValuesOptions): Array<Record<string, unknown>>;
|
13877
|
+
declare function getSingleNodeValues(node: NodeWithProperties, options?: GetNodeValuesOptions): Record<string, unknown>;
|
13878
|
+
|
13728
13879
|
type BindVariablesResult<TValue> = {
|
13729
13880
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13730
13881
|
boundCount: number;
|
@@ -13784,4 +13935,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13784
13935
|
|
13785
13936
|
declare const CanvasClientError: typeof ApiClientError;
|
13786
13937
|
|
13787
|
-
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
13938
|
+
export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, AssetParamValue, AssetParamValueItem, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EntryList, EventNames, FindInNodeTreeReference, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetNodeValuesOptions, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NodeWithProperties, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNodeValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, getSingleNodeValues, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.d.ts
CHANGED
@@ -1372,6 +1372,12 @@ declare const EDGE_MAX_CACHE_TTL: number;
|
|
1372
1372
|
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
1373
1373
|
/** A value that indicates that Edgehancers caching is disabled */
|
1374
1374
|
declare const EDGE_CACHE_DISABLED = -1;
|
1375
|
+
/** This is the type value for the asset parameter or field */
|
1376
|
+
declare const ASSET_PARAMETER_TYPE = "asset";
|
1377
|
+
/** The _source for any assets coming from the Uniform Asset Library */
|
1378
|
+
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1379
|
+
/** The _source for any assets which have manually set fields */
|
1380
|
+
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1375
1381
|
|
1376
1382
|
/**
|
1377
1383
|
* This file was auto-generated by openapi-typescript.
|
@@ -4327,6 +4333,7 @@ type DeleteContentTypeOptions = paths$b['/api/v1/content-types']['delete']['requ
|
|
4327
4333
|
type PutContentTypeBody = paths$b['/api/v1/content-types']['put']['requestBody']['content']['application/json'];
|
4328
4334
|
type GetContentTypesResponse = paths$b['/api/v1/content-types']['get']['responses']['200']['content']['application/json'];
|
4329
4335
|
type Entry = components$3['schemas']['EntryApiResponse'];
|
4336
|
+
type EntryList = components$3['schemas']['EntryListResponse'];
|
4330
4337
|
type EntryData = Entry['entry'];
|
4331
4338
|
type GetEntriesOptions = paths$a['/api/v1/entries']['get']['parameters']['query'];
|
4332
4339
|
type GetEntriesResponse = paths$a['/api/v1/entries']['get']['responses']['200']['content']['application/json'];
|
@@ -12489,8 +12496,9 @@ interface paths$1 {
|
|
12489
12496
|
parameters: {
|
12490
12497
|
query: {
|
12491
12498
|
projectId: string;
|
12492
|
-
type: "definition";
|
12499
|
+
type: "definition" | "instance";
|
12493
12500
|
definitionIds?: string;
|
12501
|
+
instanceIds?: string;
|
12494
12502
|
withCompositions?: boolean | null;
|
12495
12503
|
};
|
12496
12504
|
};
|
@@ -12850,6 +12858,81 @@ type schemas = components$1['schemas'];
|
|
12850
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12851
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12852
12860
|
|
12861
|
+
type AssetParamValue = AssetParamValueItem[];
|
12862
|
+
type AssetParamValueItem = {
|
12863
|
+
type: string;
|
12864
|
+
_id: string;
|
12865
|
+
/**
|
12866
|
+
* Internal Uniform source ID or
|
12867
|
+
* dataType ID of the global integration library
|
12868
|
+
* which created this asset item
|
12869
|
+
*/
|
12870
|
+
_source?: string;
|
12871
|
+
fields: {
|
12872
|
+
url: {
|
12873
|
+
type: 'text';
|
12874
|
+
value: string;
|
12875
|
+
};
|
12876
|
+
id?: {
|
12877
|
+
type: 'text';
|
12878
|
+
value: string | undefined;
|
12879
|
+
};
|
12880
|
+
title?: {
|
12881
|
+
type: 'text';
|
12882
|
+
value: string | undefined;
|
12883
|
+
};
|
12884
|
+
description?: {
|
12885
|
+
type: 'text';
|
12886
|
+
value: string | undefined;
|
12887
|
+
};
|
12888
|
+
mediaType?: {
|
12889
|
+
type: 'text';
|
12890
|
+
value: string | undefined;
|
12891
|
+
};
|
12892
|
+
/**
|
12893
|
+
* The width of the original asset
|
12894
|
+
*
|
12895
|
+
* Should resolve to a number but might
|
12896
|
+
* be a string with a pointer reference
|
12897
|
+
*/
|
12898
|
+
width?: {
|
12899
|
+
type: 'number';
|
12900
|
+
value: number | string | undefined;
|
12901
|
+
};
|
12902
|
+
/**
|
12903
|
+
* The height of the original asset
|
12904
|
+
*
|
12905
|
+
* Should resolve to a number but might
|
12906
|
+
* be a string with a pointer reference
|
12907
|
+
*/
|
12908
|
+
height?: {
|
12909
|
+
type: 'number';
|
12910
|
+
value: number | string | undefined;
|
12911
|
+
};
|
12912
|
+
/**
|
12913
|
+
* The size in bytes of the original asset
|
12914
|
+
*
|
12915
|
+
* Should resolve to a number but might
|
12916
|
+
* be a string with a pointer reference
|
12917
|
+
*/
|
12918
|
+
size?: {
|
12919
|
+
type: 'number';
|
12920
|
+
value: number | string | undefined;
|
12921
|
+
};
|
12922
|
+
/**
|
12923
|
+
* Any key/value properties which the source
|
12924
|
+
* wants to attach to the asset data
|
12925
|
+
*/
|
12926
|
+
custom?: {
|
12927
|
+
type: string;
|
12928
|
+
value: Record<string, unknown>;
|
12929
|
+
};
|
12930
|
+
};
|
12931
|
+
_overrides?: {
|
12932
|
+
fields: ComponentOverride['parameters'];
|
12933
|
+
};
|
12934
|
+
};
|
12935
|
+
|
12853
12936
|
type LinkParameterType = 'projectMapNode' | 'url' | 'tel' | 'email';
|
12854
12937
|
type LinkTypeConfiguration = Partial<Record<LinkParameterType, boolean>>;
|
12855
12938
|
type LinkParamConfiguration = {
|
@@ -13137,37 +13220,6 @@ declare function enhance<TContext extends EnhancerContext = EnhancerContext>({ c
|
|
13137
13220
|
onErrors?: (errors: EnhancerError[]) => void;
|
13138
13221
|
}): Promise<void>;
|
13139
13222
|
|
13140
|
-
/** @deprecated use walkNodeTree */
|
13141
|
-
type ComponentLocationReference = {
|
13142
|
-
component: ComponentInstance;
|
13143
|
-
parentSlot?: string;
|
13144
|
-
parentSlotIndex?: number;
|
13145
|
-
};
|
13146
|
-
/** @deprecated use walkNodeTree and check for type = slot */
|
13147
|
-
type WalkComponentTreeActions<TContext> = {
|
13148
|
-
/** Replaces the component being visited with a new object */
|
13149
|
-
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13150
|
-
/** Removes the component being visited from the composition */
|
13151
|
-
removeComponent: () => void;
|
13152
|
-
/** Inserts a new component immediately after the current component in its parent slot */
|
13153
|
-
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13154
|
-
/** Aborts visitation of components that are in child slots of the current component */
|
13155
|
-
stopProcessingDescendants: () => void;
|
13156
|
-
/**
|
13157
|
-
* Set a new traversal context for descendants of this node.
|
13158
|
-
* If this is not called, `context` will automatically pass through.
|
13159
|
-
*/
|
13160
|
-
setDescendantsContext: (context: TContext) => void;
|
13161
|
-
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13162
|
-
};
|
13163
|
-
/**
|
13164
|
-
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13165
|
-
* @deprecated use walkNodeTree
|
13166
|
-
*/
|
13167
|
-
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13168
|
-
/** Traversal context for this node */
|
13169
|
-
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13170
|
-
|
13171
13223
|
/** Ancestor location that is in a slot on a component */
|
13172
13224
|
type ComponentLocationReferenceV2 = {
|
13173
13225
|
type: 'slot';
|
@@ -13232,11 +13284,71 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13232
13284
|
};
|
13233
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13234
13286
|
declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
|
13287
|
+
/**
|
13288
|
+
* Any types which hold an array of nodes and
|
13289
|
+
* therefore should be iterated over as child nodes
|
13290
|
+
*/
|
13291
|
+
declare function isNestedNodeType(type: string): boolean;
|
13235
13292
|
/** Gets the typed value of a block parameter or block field */
|
13236
13293
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13237
13294
|
|
13295
|
+
interface FindInNodeTreeReference {
|
13296
|
+
key: string;
|
13297
|
+
pointer: string;
|
13298
|
+
/** This might be the composition parameter, or entry field */
|
13299
|
+
parameter: ComponentParameter;
|
13300
|
+
}
|
13301
|
+
/**
|
13302
|
+
* Walk a Composition or Entry tree to find parameters or fields
|
13303
|
+
* based on the predicate returning true
|
13304
|
+
*
|
13305
|
+
* @example
|
13306
|
+
*
|
13307
|
+
* const textReferences = findParameterInNodeTree(
|
13308
|
+
* composition,
|
13309
|
+
* (parameter) => parameter.type === 'text'
|
13310
|
+
* )
|
13311
|
+
*
|
13312
|
+
* @param data The composition or entry data
|
13313
|
+
* @param predicate Return true from this function to include the parameter in the results
|
13314
|
+
*/
|
13315
|
+
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13316
|
+
|
13317
|
+
/** @deprecated use walkNodeTree */
|
13318
|
+
type ComponentLocationReference = {
|
13319
|
+
component: ComponentInstance;
|
13320
|
+
parentSlot?: string;
|
13321
|
+
parentSlotIndex?: number;
|
13322
|
+
};
|
13323
|
+
/** @deprecated use walkNodeTree and check for type = slot */
|
13324
|
+
type WalkComponentTreeActions<TContext> = {
|
13325
|
+
/** Replaces the component being visited with a new object */
|
13326
|
+
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13327
|
+
/** Removes the component being visited from the composition */
|
13328
|
+
removeComponent: () => void;
|
13329
|
+
/** Inserts a new component immediately after the current component in its parent slot */
|
13330
|
+
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13331
|
+
/** Aborts visitation of components that are in child slots of the current component */
|
13332
|
+
stopProcessingDescendants: () => void;
|
13333
|
+
/**
|
13334
|
+
* Set a new traversal context for descendants of this node.
|
13335
|
+
* If this is not called, `context` will automatically pass through.
|
13336
|
+
*/
|
13337
|
+
setDescendantsContext: (context: TContext) => void;
|
13338
|
+
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13339
|
+
};
|
13340
|
+
/**
|
13341
|
+
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13342
|
+
* @deprecated use walkNodeTree
|
13343
|
+
*/
|
13344
|
+
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13345
|
+
/** Traversal context for this node */
|
13346
|
+
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13347
|
+
|
13238
13348
|
/** Returns the JSON pointer of a component based on its location */
|
13239
13349
|
declare function getComponentJsonPointer(ancestorsAndSelf: Array<NodeLocationReference | ComponentLocationReference>): string;
|
13350
|
+
declare function getNounForLocation(parentLocation: NodeLocationReference | ComponentLocationReference | undefined): "parameters" | "fields";
|
13351
|
+
declare function getNounForNode(node: ComponentInstance | EntryData | Array<NodeLocationReference>): "parameters" | "fields";
|
13240
13352
|
|
13241
13353
|
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference | NodeLocationReference>): string;
|
13242
13354
|
|
@@ -13651,11 +13763,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13651
13763
|
* Removes things like author, stats, etc.
|
13652
13764
|
*/
|
13653
13765
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13654
|
-
/**
|
13655
|
-
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13656
|
-
* If no properties are defined, returns undefined.
|
13657
|
-
*/
|
13658
|
-
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13659
13766
|
|
13660
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13661
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13694,7 +13801,17 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13694
13801
|
* Check to see if some generic composition data structure
|
13695
13802
|
* looks like Entry data
|
13696
13803
|
*/
|
13697
|
-
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13804
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13805
|
+
/**
|
13806
|
+
* A fast, non-exhaustive guard which checks that the value is an array
|
13807
|
+
* as well as the first item, if there is one, looks like an asset item
|
13808
|
+
*/
|
13809
|
+
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13810
|
+
/**
|
13811
|
+
* A fast, non-exhaustive guard which checks the
|
13812
|
+
* required structure of an asset item
|
13813
|
+
*/
|
13814
|
+
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13698
13815
|
|
13699
13816
|
declare const generateHash: ({ composition, secret, }: {
|
13700
13817
|
composition: RootComponentInstance;
|
@@ -13725,6 +13842,40 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13725
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13726
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13727
13844
|
|
13845
|
+
/**
|
13846
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13847
|
+
* If no properties are defined, returns undefined.
|
13848
|
+
*/
|
13849
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13850
|
+
interface GetNodeValuesOptions {
|
13851
|
+
/**
|
13852
|
+
* If the property has nested properties, like Blocks or Assets
|
13853
|
+
* can, then how many levels should we traverse.
|
13854
|
+
*
|
13855
|
+
* You can set this to `Infinity` although it would be more
|
13856
|
+
* advisable, for performance, to use the number you need in your code.
|
13857
|
+
*
|
13858
|
+
* Where:
|
13859
|
+
* levels=0 will only extract the properties of the current object
|
13860
|
+
* levels=1 will include any child blocks or assets on the current object
|
13861
|
+
* but not any grandchildren
|
13862
|
+
*
|
13863
|
+
* @default 1
|
13864
|
+
*/
|
13865
|
+
levels?: number;
|
13866
|
+
}
|
13867
|
+
/**
|
13868
|
+
* Get the data stored in the value of a component parameter
|
13869
|
+
* or a field attached to an Entry, Block or Asset
|
13870
|
+
*/
|
13871
|
+
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13872
|
+
declare function getPropertyValue(parameter: null): null;
|
13873
|
+
declare function getPropertyValue(parameter: undefined): undefined;
|
13874
|
+
type NodeWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13875
|
+
declare function getNodeValues(node: NodeWithProperties, options?: GetNodeValuesOptions): Record<string, unknown>;
|
13876
|
+
declare function getNodeValues(node: Array<NodeWithProperties>, options?: GetNodeValuesOptions): Array<Record<string, unknown>>;
|
13877
|
+
declare function getSingleNodeValues(node: NodeWithProperties, options?: GetNodeValuesOptions): Record<string, unknown>;
|
13878
|
+
|
13728
13879
|
type BindVariablesResult<TValue> = {
|
13729
13880
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13730
13881
|
boundCount: number;
|
@@ -13784,4 +13935,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13784
13935
|
|
13785
13936
|
declare const CanvasClientError: typeof ApiClientError;
|
13786
13937
|
|
13787
|
-
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
13938
|
+
export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, AssetParamValue, AssetParamValueItem, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EntryList, EventNames, FindInNodeTreeReference, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetNodeValuesOptions, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NodeWithProperties, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNodeValues, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, getSingleNodeValues, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isNestedNodeType, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.esm.js
CHANGED
@@ -1000,25 +1000,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1000
1000
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1001
1001
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1002
1002
|
var EDGE_CACHE_DISABLED = -1;
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
return {
|
1007
|
-
entry: {
|
1008
|
-
type: entry.entry.type,
|
1009
|
-
_dataResources: entry.entry._dataResources,
|
1010
|
-
_id: entry.entry._id,
|
1011
|
-
_name: entry.entry._name,
|
1012
|
-
_slug: entry.entry._slug,
|
1013
|
-
fields: entry.entry.fields
|
1014
|
-
},
|
1015
|
-
state: entry.state,
|
1016
|
-
projectId: entry.projectId
|
1017
|
-
};
|
1018
|
-
}
|
1019
|
-
function getPropertiesValue(entity) {
|
1020
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1021
|
-
}
|
1003
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1004
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1022
1006
|
|
1023
1007
|
// src/utils/guards.ts
|
1024
1008
|
function isRootEntryReference(root) {
|
@@ -1027,6 +1011,45 @@ function isRootEntryReference(root) {
|
|
1027
1011
|
function isEntryData(entryData) {
|
1028
1012
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
1013
|
}
|
1014
|
+
function isAssetParamValue(value) {
|
1015
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1016
|
+
}
|
1017
|
+
function isAssetParamValueItem(item) {
|
1018
|
+
return Boolean(
|
1019
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1020
|
+
);
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
// src/utils/properties.ts
|
1024
|
+
function getPropertiesValue(entity) {
|
1025
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1026
|
+
}
|
1027
|
+
function getPropertyValue(parameter) {
|
1028
|
+
return parameter ? parameter.value : parameter;
|
1029
|
+
}
|
1030
|
+
function getNodeValues(node, options = {}) {
|
1031
|
+
if (Array.isArray(node)) {
|
1032
|
+
return node.map((node2) => getSingleNodeValues(node2, options));
|
1033
|
+
} else {
|
1034
|
+
return getSingleNodeValues(node, options);
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
function getSingleNodeValues(node, options = {}) {
|
1038
|
+
const { levels = 1 } = options;
|
1039
|
+
const properties = getPropertiesValue(node);
|
1040
|
+
return properties ? Object.fromEntries(
|
1041
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1042
|
+
const value = getPropertyValue(parameter);
|
1043
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested node type
|
1044
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1045
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1046
|
+
return [id, value.map((item) => getNodeValues(item, nestedOptions))];
|
1047
|
+
} else {
|
1048
|
+
return [id, value];
|
1049
|
+
}
|
1050
|
+
})
|
1051
|
+
) : properties;
|
1052
|
+
}
|
1030
1053
|
|
1031
1054
|
// src/enhancement/walkNodeTree.ts
|
1032
1055
|
function walkNodeTree(node, visitor, options) {
|
@@ -1250,7 +1273,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1250
1273
|
const propertyEntries = Object.entries(properties);
|
1251
1274
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1252
1275
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1253
|
-
if (propObject.type
|
1276
|
+
if (!isNestedNodeType(propObject.type))
|
1254
1277
|
continue;
|
1255
1278
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1256
1279
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1276,6 +1299,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1276
1299
|
}
|
1277
1300
|
} while (componentQueue.length > 0);
|
1278
1301
|
}
|
1302
|
+
function isNestedNodeType(type) {
|
1303
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1304
|
+
}
|
1279
1305
|
function getBlockValue(component, parameterName) {
|
1280
1306
|
var _a;
|
1281
1307
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -1567,6 +1593,31 @@ function getNounForLocation(parentLocation) {
|
|
1567
1593
|
}
|
1568
1594
|
return noun;
|
1569
1595
|
}
|
1596
|
+
function getNounForNode(node) {
|
1597
|
+
let noun = "parameters";
|
1598
|
+
if (isEntryData(node)) {
|
1599
|
+
noun = "fields";
|
1600
|
+
}
|
1601
|
+
return noun;
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
// src/enhancement/findInNodeTree.ts
|
1605
|
+
function findParameterInNodeTree(data, predicate) {
|
1606
|
+
const results = [];
|
1607
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1608
|
+
const parameters = getPropertiesValue(node);
|
1609
|
+
if (parameters) {
|
1610
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1611
|
+
results.push({
|
1612
|
+
key,
|
1613
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1614
|
+
parameter: field
|
1615
|
+
});
|
1616
|
+
});
|
1617
|
+
}
|
1618
|
+
});
|
1619
|
+
return results;
|
1620
|
+
}
|
1570
1621
|
|
1571
1622
|
// src/enhancement/localize.ts
|
1572
1623
|
function extractLocales({ component }) {
|
@@ -2188,6 +2239,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2188
2239
|
};
|
2189
2240
|
};
|
2190
2241
|
|
2242
|
+
// src/utils/entryConverter.ts
|
2243
|
+
function convertEntryToPutEntry(entry) {
|
2244
|
+
return {
|
2245
|
+
entry: {
|
2246
|
+
type: entry.entry.type,
|
2247
|
+
_dataResources: entry.entry._dataResources,
|
2248
|
+
_id: entry.entry._id,
|
2249
|
+
_name: entry.entry._name,
|
2250
|
+
_slug: entry.entry._slug,
|
2251
|
+
fields: entry.entry.fields
|
2252
|
+
},
|
2253
|
+
state: entry.state,
|
2254
|
+
projectId: entry.projectId
|
2255
|
+
};
|
2256
|
+
}
|
2257
|
+
|
2191
2258
|
// src/utils/getParameterAttributes.ts
|
2192
2259
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2193
2260
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2463,6 +2530,9 @@ function handleRichTextNodeBinding(object, options) {
|
|
2463
2530
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
2464
2531
|
var CanvasClientError = ApiClientError2;
|
2465
2532
|
export {
|
2533
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2534
|
+
ASSETS_SOURCE_UNIFORM,
|
2535
|
+
ASSET_PARAMETER_TYPE,
|
2466
2536
|
ATTRIBUTE_COMPONENT_ID,
|
2467
2537
|
ATTRIBUTE_MULTILINE,
|
2468
2538
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2526,21 +2596,30 @@ export {
|
|
2526
2596
|
createVariableReference,
|
2527
2597
|
enhance,
|
2528
2598
|
extractLocales,
|
2599
|
+
findParameterInNodeTree,
|
2529
2600
|
generateComponentPlaceholderId,
|
2530
2601
|
generateHash,
|
2531
2602
|
getBlockValue,
|
2532
2603
|
getChannelName,
|
2533
2604
|
getComponentJsonPointer,
|
2534
2605
|
getComponentPath,
|
2606
|
+
getNodeValues,
|
2607
|
+
getNounForLocation,
|
2608
|
+
getNounForNode,
|
2535
2609
|
getParameterAttributes,
|
2536
2610
|
getPropertiesValue,
|
2611
|
+
getPropertyValue,
|
2612
|
+
getSingleNodeValues,
|
2537
2613
|
isAddComponentMessage,
|
2538
2614
|
isAllowedReferrer,
|
2615
|
+
isAssetParamValue,
|
2616
|
+
isAssetParamValueItem,
|
2539
2617
|
isComponentActionMessage,
|
2540
2618
|
isComponentPlaceholderId,
|
2541
2619
|
isDismissPlaceholderMessage,
|
2542
2620
|
isEntryData,
|
2543
2621
|
isMovingComponentMessage,
|
2622
|
+
isNestedNodeType,
|
2544
2623
|
isOpenParameterEditorMessage,
|
2545
2624
|
isReadyMessage,
|
2546
2625
|
isReportRenderedCompositionsMessage,
|
package/dist/index.js
CHANGED
@@ -277,6 +277,9 @@ var require_retry2 = __commonJS({
|
|
277
277
|
// src/index.ts
|
278
278
|
var src_exports = {};
|
279
279
|
__export(src_exports, {
|
280
|
+
ASSETS_SOURCE_CUSTOM_URL: () => ASSETS_SOURCE_CUSTOM_URL,
|
281
|
+
ASSETS_SOURCE_UNIFORM: () => ASSETS_SOURCE_UNIFORM,
|
282
|
+
ASSET_PARAMETER_TYPE: () => ASSET_PARAMETER_TYPE,
|
280
283
|
ATTRIBUTE_COMPONENT_ID: () => ATTRIBUTE_COMPONENT_ID,
|
281
284
|
ATTRIBUTE_MULTILINE: () => ATTRIBUTE_MULTILINE,
|
282
285
|
ATTRIBUTE_PARAMETER_ID: () => ATTRIBUTE_PARAMETER_ID,
|
@@ -340,21 +343,30 @@ __export(src_exports, {
|
|
340
343
|
createVariableReference: () => createVariableReference,
|
341
344
|
enhance: () => enhance,
|
342
345
|
extractLocales: () => extractLocales,
|
346
|
+
findParameterInNodeTree: () => findParameterInNodeTree,
|
343
347
|
generateComponentPlaceholderId: () => generateComponentPlaceholderId,
|
344
348
|
generateHash: () => generateHash,
|
345
349
|
getBlockValue: () => getBlockValue,
|
346
350
|
getChannelName: () => getChannelName,
|
347
351
|
getComponentJsonPointer: () => getComponentJsonPointer,
|
348
352
|
getComponentPath: () => getComponentPath,
|
353
|
+
getNodeValues: () => getNodeValues,
|
354
|
+
getNounForLocation: () => getNounForLocation,
|
355
|
+
getNounForNode: () => getNounForNode,
|
349
356
|
getParameterAttributes: () => getParameterAttributes,
|
350
357
|
getPropertiesValue: () => getPropertiesValue,
|
358
|
+
getPropertyValue: () => getPropertyValue,
|
359
|
+
getSingleNodeValues: () => getSingleNodeValues,
|
351
360
|
isAddComponentMessage: () => isAddComponentMessage,
|
352
361
|
isAllowedReferrer: () => isAllowedReferrer,
|
362
|
+
isAssetParamValue: () => isAssetParamValue,
|
363
|
+
isAssetParamValueItem: () => isAssetParamValueItem,
|
353
364
|
isComponentActionMessage: () => isComponentActionMessage,
|
354
365
|
isComponentPlaceholderId: () => isComponentPlaceholderId,
|
355
366
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
356
367
|
isEntryData: () => isEntryData,
|
357
368
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
369
|
+
isNestedNodeType: () => isNestedNodeType,
|
358
370
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
359
371
|
isReadyMessage: () => isReadyMessage,
|
360
372
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
@@ -1114,25 +1126,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1114
1126
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1115
1127
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1116
1128
|
var EDGE_CACHE_DISABLED = -1;
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
return {
|
1121
|
-
entry: {
|
1122
|
-
type: entry.entry.type,
|
1123
|
-
_dataResources: entry.entry._dataResources,
|
1124
|
-
_id: entry.entry._id,
|
1125
|
-
_name: entry.entry._name,
|
1126
|
-
_slug: entry.entry._slug,
|
1127
|
-
fields: entry.entry.fields
|
1128
|
-
},
|
1129
|
-
state: entry.state,
|
1130
|
-
projectId: entry.projectId
|
1131
|
-
};
|
1132
|
-
}
|
1133
|
-
function getPropertiesValue(entity) {
|
1134
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1135
|
-
}
|
1129
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1130
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1131
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1136
1132
|
|
1137
1133
|
// src/utils/guards.ts
|
1138
1134
|
function isRootEntryReference(root) {
|
@@ -1141,6 +1137,45 @@ function isRootEntryReference(root) {
|
|
1141
1137
|
function isEntryData(entryData) {
|
1142
1138
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1143
1139
|
}
|
1140
|
+
function isAssetParamValue(value) {
|
1141
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1142
|
+
}
|
1143
|
+
function isAssetParamValueItem(item) {
|
1144
|
+
return Boolean(
|
1145
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1146
|
+
);
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
// src/utils/properties.ts
|
1150
|
+
function getPropertiesValue(entity) {
|
1151
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1152
|
+
}
|
1153
|
+
function getPropertyValue(parameter) {
|
1154
|
+
return parameter ? parameter.value : parameter;
|
1155
|
+
}
|
1156
|
+
function getNodeValues(node, options = {}) {
|
1157
|
+
if (Array.isArray(node)) {
|
1158
|
+
return node.map((node2) => getSingleNodeValues(node2, options));
|
1159
|
+
} else {
|
1160
|
+
return getSingleNodeValues(node, options);
|
1161
|
+
}
|
1162
|
+
}
|
1163
|
+
function getSingleNodeValues(node, options = {}) {
|
1164
|
+
const { levels = 1 } = options;
|
1165
|
+
const properties = getPropertiesValue(node);
|
1166
|
+
return properties ? Object.fromEntries(
|
1167
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1168
|
+
const value = getPropertyValue(parameter);
|
1169
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested node type
|
1170
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1171
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1172
|
+
return [id, value.map((item) => getNodeValues(item, nestedOptions))];
|
1173
|
+
} else {
|
1174
|
+
return [id, value];
|
1175
|
+
}
|
1176
|
+
})
|
1177
|
+
) : properties;
|
1178
|
+
}
|
1144
1179
|
|
1145
1180
|
// src/enhancement/walkNodeTree.ts
|
1146
1181
|
function walkNodeTree(node, visitor, options) {
|
@@ -1364,7 +1399,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1364
1399
|
const propertyEntries = Object.entries(properties);
|
1365
1400
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1366
1401
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1367
|
-
if (propObject.type
|
1402
|
+
if (!isNestedNodeType(propObject.type))
|
1368
1403
|
continue;
|
1369
1404
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1370
1405
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1390,6 +1425,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1390
1425
|
}
|
1391
1426
|
} while (componentQueue.length > 0);
|
1392
1427
|
}
|
1428
|
+
function isNestedNodeType(type) {
|
1429
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1430
|
+
}
|
1393
1431
|
function getBlockValue(component, parameterName) {
|
1394
1432
|
var _a;
|
1395
1433
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -1681,6 +1719,31 @@ function getNounForLocation(parentLocation) {
|
|
1681
1719
|
}
|
1682
1720
|
return noun;
|
1683
1721
|
}
|
1722
|
+
function getNounForNode(node) {
|
1723
|
+
let noun = "parameters";
|
1724
|
+
if (isEntryData(node)) {
|
1725
|
+
noun = "fields";
|
1726
|
+
}
|
1727
|
+
return noun;
|
1728
|
+
}
|
1729
|
+
|
1730
|
+
// src/enhancement/findInNodeTree.ts
|
1731
|
+
function findParameterInNodeTree(data, predicate) {
|
1732
|
+
const results = [];
|
1733
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1734
|
+
const parameters = getPropertiesValue(node);
|
1735
|
+
if (parameters) {
|
1736
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1737
|
+
results.push({
|
1738
|
+
key,
|
1739
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1740
|
+
parameter: field
|
1741
|
+
});
|
1742
|
+
});
|
1743
|
+
}
|
1744
|
+
});
|
1745
|
+
return results;
|
1746
|
+
}
|
1684
1747
|
|
1685
1748
|
// src/enhancement/localize.ts
|
1686
1749
|
function extractLocales({ component }) {
|
@@ -2302,6 +2365,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2302
2365
|
};
|
2303
2366
|
};
|
2304
2367
|
|
2368
|
+
// src/utils/entryConverter.ts
|
2369
|
+
function convertEntryToPutEntry(entry) {
|
2370
|
+
return {
|
2371
|
+
entry: {
|
2372
|
+
type: entry.entry.type,
|
2373
|
+
_dataResources: entry.entry._dataResources,
|
2374
|
+
_id: entry.entry._id,
|
2375
|
+
_name: entry.entry._name,
|
2376
|
+
_slug: entry.entry._slug,
|
2377
|
+
fields: entry.entry.fields
|
2378
|
+
},
|
2379
|
+
state: entry.state,
|
2380
|
+
projectId: entry.projectId
|
2381
|
+
};
|
2382
|
+
}
|
2383
|
+
|
2305
2384
|
// src/utils/getParameterAttributes.ts
|
2306
2385
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2307
2386
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2578,6 +2657,9 @@ var import_api10 = require("@uniformdev/context/api");
|
|
2578
2657
|
var CanvasClientError = import_api10.ApiClientError;
|
2579
2658
|
// Annotate the CommonJS export names for ESM import in node:
|
2580
2659
|
0 && (module.exports = {
|
2660
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2661
|
+
ASSETS_SOURCE_UNIFORM,
|
2662
|
+
ASSET_PARAMETER_TYPE,
|
2581
2663
|
ATTRIBUTE_COMPONENT_ID,
|
2582
2664
|
ATTRIBUTE_MULTILINE,
|
2583
2665
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2641,21 +2723,30 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2641
2723
|
createVariableReference,
|
2642
2724
|
enhance,
|
2643
2725
|
extractLocales,
|
2726
|
+
findParameterInNodeTree,
|
2644
2727
|
generateComponentPlaceholderId,
|
2645
2728
|
generateHash,
|
2646
2729
|
getBlockValue,
|
2647
2730
|
getChannelName,
|
2648
2731
|
getComponentJsonPointer,
|
2649
2732
|
getComponentPath,
|
2733
|
+
getNodeValues,
|
2734
|
+
getNounForLocation,
|
2735
|
+
getNounForNode,
|
2650
2736
|
getParameterAttributes,
|
2651
2737
|
getPropertiesValue,
|
2738
|
+
getPropertyValue,
|
2739
|
+
getSingleNodeValues,
|
2652
2740
|
isAddComponentMessage,
|
2653
2741
|
isAllowedReferrer,
|
2742
|
+
isAssetParamValue,
|
2743
|
+
isAssetParamValueItem,
|
2654
2744
|
isComponentActionMessage,
|
2655
2745
|
isComponentPlaceholderId,
|
2656
2746
|
isDismissPlaceholderMessage,
|
2657
2747
|
isEntryData,
|
2658
2748
|
isMovingComponentMessage,
|
2749
|
+
isNestedNodeType,
|
2659
2750
|
isOpenParameterEditorMessage,
|
2660
2751
|
isReadyMessage,
|
2661
2752
|
isReportRenderedCompositionsMessage,
|
package/dist/index.mjs
CHANGED
@@ -1000,25 +1000,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1000
1000
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1001
1001
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1002
1002
|
var EDGE_CACHE_DISABLED = -1;
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
return {
|
1007
|
-
entry: {
|
1008
|
-
type: entry.entry.type,
|
1009
|
-
_dataResources: entry.entry._dataResources,
|
1010
|
-
_id: entry.entry._id,
|
1011
|
-
_name: entry.entry._name,
|
1012
|
-
_slug: entry.entry._slug,
|
1013
|
-
fields: entry.entry.fields
|
1014
|
-
},
|
1015
|
-
state: entry.state,
|
1016
|
-
projectId: entry.projectId
|
1017
|
-
};
|
1018
|
-
}
|
1019
|
-
function getPropertiesValue(entity) {
|
1020
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1021
|
-
}
|
1003
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1004
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1022
1006
|
|
1023
1007
|
// src/utils/guards.ts
|
1024
1008
|
function isRootEntryReference(root) {
|
@@ -1027,6 +1011,45 @@ function isRootEntryReference(root) {
|
|
1027
1011
|
function isEntryData(entryData) {
|
1028
1012
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
1013
|
}
|
1014
|
+
function isAssetParamValue(value) {
|
1015
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1016
|
+
}
|
1017
|
+
function isAssetParamValueItem(item) {
|
1018
|
+
return Boolean(
|
1019
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1020
|
+
);
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
// src/utils/properties.ts
|
1024
|
+
function getPropertiesValue(entity) {
|
1025
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1026
|
+
}
|
1027
|
+
function getPropertyValue(parameter) {
|
1028
|
+
return parameter ? parameter.value : parameter;
|
1029
|
+
}
|
1030
|
+
function getNodeValues(node, options = {}) {
|
1031
|
+
if (Array.isArray(node)) {
|
1032
|
+
return node.map((node2) => getSingleNodeValues(node2, options));
|
1033
|
+
} else {
|
1034
|
+
return getSingleNodeValues(node, options);
|
1035
|
+
}
|
1036
|
+
}
|
1037
|
+
function getSingleNodeValues(node, options = {}) {
|
1038
|
+
const { levels = 1 } = options;
|
1039
|
+
const properties = getPropertiesValue(node);
|
1040
|
+
return properties ? Object.fromEntries(
|
1041
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1042
|
+
const value = getPropertyValue(parameter);
|
1043
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested node type
|
1044
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1045
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1046
|
+
return [id, value.map((item) => getNodeValues(item, nestedOptions))];
|
1047
|
+
} else {
|
1048
|
+
return [id, value];
|
1049
|
+
}
|
1050
|
+
})
|
1051
|
+
) : properties;
|
1052
|
+
}
|
1030
1053
|
|
1031
1054
|
// src/enhancement/walkNodeTree.ts
|
1032
1055
|
function walkNodeTree(node, visitor, options) {
|
@@ -1250,7 +1273,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1250
1273
|
const propertyEntries = Object.entries(properties);
|
1251
1274
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1252
1275
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1253
|
-
if (propObject.type
|
1276
|
+
if (!isNestedNodeType(propObject.type))
|
1254
1277
|
continue;
|
1255
1278
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1256
1279
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1276,6 +1299,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1276
1299
|
}
|
1277
1300
|
} while (componentQueue.length > 0);
|
1278
1301
|
}
|
1302
|
+
function isNestedNodeType(type) {
|
1303
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1304
|
+
}
|
1279
1305
|
function getBlockValue(component, parameterName) {
|
1280
1306
|
var _a;
|
1281
1307
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -1567,6 +1593,31 @@ function getNounForLocation(parentLocation) {
|
|
1567
1593
|
}
|
1568
1594
|
return noun;
|
1569
1595
|
}
|
1596
|
+
function getNounForNode(node) {
|
1597
|
+
let noun = "parameters";
|
1598
|
+
if (isEntryData(node)) {
|
1599
|
+
noun = "fields";
|
1600
|
+
}
|
1601
|
+
return noun;
|
1602
|
+
}
|
1603
|
+
|
1604
|
+
// src/enhancement/findInNodeTree.ts
|
1605
|
+
function findParameterInNodeTree(data, predicate) {
|
1606
|
+
const results = [];
|
1607
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1608
|
+
const parameters = getPropertiesValue(node);
|
1609
|
+
if (parameters) {
|
1610
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1611
|
+
results.push({
|
1612
|
+
key,
|
1613
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1614
|
+
parameter: field
|
1615
|
+
});
|
1616
|
+
});
|
1617
|
+
}
|
1618
|
+
});
|
1619
|
+
return results;
|
1620
|
+
}
|
1570
1621
|
|
1571
1622
|
// src/enhancement/localize.ts
|
1572
1623
|
function extractLocales({ component }) {
|
@@ -2188,6 +2239,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2188
2239
|
};
|
2189
2240
|
};
|
2190
2241
|
|
2242
|
+
// src/utils/entryConverter.ts
|
2243
|
+
function convertEntryToPutEntry(entry) {
|
2244
|
+
return {
|
2245
|
+
entry: {
|
2246
|
+
type: entry.entry.type,
|
2247
|
+
_dataResources: entry.entry._dataResources,
|
2248
|
+
_id: entry.entry._id,
|
2249
|
+
_name: entry.entry._name,
|
2250
|
+
_slug: entry.entry._slug,
|
2251
|
+
fields: entry.entry.fields
|
2252
|
+
},
|
2253
|
+
state: entry.state,
|
2254
|
+
projectId: entry.projectId
|
2255
|
+
};
|
2256
|
+
}
|
2257
|
+
|
2191
2258
|
// src/utils/getParameterAttributes.ts
|
2192
2259
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2193
2260
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2463,6 +2530,9 @@ function handleRichTextNodeBinding(object, options) {
|
|
2463
2530
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
2464
2531
|
var CanvasClientError = ApiClientError2;
|
2465
2532
|
export {
|
2533
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2534
|
+
ASSETS_SOURCE_UNIFORM,
|
2535
|
+
ASSET_PARAMETER_TYPE,
|
2466
2536
|
ATTRIBUTE_COMPONENT_ID,
|
2467
2537
|
ATTRIBUTE_MULTILINE,
|
2468
2538
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2526,21 +2596,30 @@ export {
|
|
2526
2596
|
createVariableReference,
|
2527
2597
|
enhance,
|
2528
2598
|
extractLocales,
|
2599
|
+
findParameterInNodeTree,
|
2529
2600
|
generateComponentPlaceholderId,
|
2530
2601
|
generateHash,
|
2531
2602
|
getBlockValue,
|
2532
2603
|
getChannelName,
|
2533
2604
|
getComponentJsonPointer,
|
2534
2605
|
getComponentPath,
|
2606
|
+
getNodeValues,
|
2607
|
+
getNounForLocation,
|
2608
|
+
getNounForNode,
|
2535
2609
|
getParameterAttributes,
|
2536
2610
|
getPropertiesValue,
|
2611
|
+
getPropertyValue,
|
2612
|
+
getSingleNodeValues,
|
2537
2613
|
isAddComponentMessage,
|
2538
2614
|
isAllowedReferrer,
|
2615
|
+
isAssetParamValue,
|
2616
|
+
isAssetParamValueItem,
|
2539
2617
|
isComponentActionMessage,
|
2540
2618
|
isComponentPlaceholderId,
|
2541
2619
|
isDismissPlaceholderMessage,
|
2542
2620
|
isEntryData,
|
2543
2621
|
isMovingComponentMessage,
|
2622
|
+
isNestedNodeType,
|
2544
2623
|
isOpenParameterEditorMessage,
|
2545
2624
|
isReadyMessage,
|
2546
2625
|
isReportRenderedCompositionsMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.81.2-alpha.22+2fbda83df",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -38,8 +38,8 @@
|
|
38
38
|
"pusher-js": "8.2.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "19.
|
42
|
-
"@uniformdev/context": "19.
|
41
|
+
"@uniformdev/assets": "19.81.2-alpha.22+2fbda83df",
|
42
|
+
"@uniformdev/context": "19.81.2-alpha.22+2fbda83df",
|
43
43
|
"immer": "9.0.21"
|
44
44
|
},
|
45
45
|
"files": [
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "2fbda83df1085a9a91c7fbe9ac53056cc64707d2"
|
52
52
|
}
|