@uniformdev/canvas 19.81.1 → 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 +64 -13
- package/dist/index.d.ts +64 -13
- package/dist/index.esm.js +58 -25
- package/dist/index.js +62 -25
- package/dist/index.mjs +58 -25
- 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'];
|
@@ -12851,10 +12858,6 @@ type schemas = components$1['schemas'];
|
|
12851
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12852
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12853
12860
|
|
12854
|
-
/** This is the type value for the asset parameter or field */
|
12855
|
-
declare const ASSET_PARAMETER_TYPE = "asset";
|
12856
|
-
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
12857
|
-
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
12858
12861
|
type AssetParamValue = AssetParamValueItem[];
|
12859
12862
|
type AssetParamValueItem = {
|
12860
12863
|
type: string;
|
@@ -13281,6 +13284,11 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13281
13284
|
};
|
13282
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13283
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;
|
13284
13292
|
/** Gets the typed value of a block parameter or block field */
|
13285
13293
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13286
13294
|
|
@@ -13290,6 +13298,20 @@ interface FindInNodeTreeReference {
|
|
13290
13298
|
/** This might be the composition parameter, or entry field */
|
13291
13299
|
parameter: ComponentParameter;
|
13292
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
|
+
*/
|
13293
13315
|
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13294
13316
|
|
13295
13317
|
/** @deprecated use walkNodeTree */
|
@@ -13741,11 +13763,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13741
13763
|
* Removes things like author, stats, etc.
|
13742
13764
|
*/
|
13743
13765
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13744
|
-
/**
|
13745
|
-
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13746
|
-
* If no properties are defined, returns undefined.
|
13747
|
-
*/
|
13748
|
-
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13749
13766
|
|
13750
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13751
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13786,13 +13803,13 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13786
13803
|
*/
|
13787
13804
|
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13788
13805
|
/**
|
13789
|
-
* A fast, non-exhaustive guard which checks the value is an array
|
13790
|
-
* as well as the first item if there is one
|
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
|
13791
13808
|
*/
|
13792
13809
|
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13793
13810
|
/**
|
13794
13811
|
* A fast, non-exhaustive guard which checks the
|
13795
|
-
* required structure
|
13812
|
+
* required structure of an asset item
|
13796
13813
|
*/
|
13797
13814
|
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13798
13815
|
|
@@ -13825,6 +13842,40 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13825
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13826
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13827
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
|
+
|
13828
13879
|
type BindVariablesResult<TValue> = {
|
13829
13880
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13830
13881
|
boundCount: number;
|
@@ -13884,4 +13935,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13884
13935
|
|
13885
13936
|
declare const CanvasClientError: typeof ApiClientError;
|
13886
13937
|
|
13887
|
-
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, EventNames, FindInNodeTreeReference, 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, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, 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'];
|
@@ -12851,10 +12858,6 @@ type schemas = components$1['schemas'];
|
|
12851
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12852
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12853
12860
|
|
12854
|
-
/** This is the type value for the asset parameter or field */
|
12855
|
-
declare const ASSET_PARAMETER_TYPE = "asset";
|
12856
|
-
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
12857
|
-
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
12858
12861
|
type AssetParamValue = AssetParamValueItem[];
|
12859
12862
|
type AssetParamValueItem = {
|
12860
12863
|
type: string;
|
@@ -13281,6 +13284,11 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13281
13284
|
};
|
13282
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13283
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;
|
13284
13292
|
/** Gets the typed value of a block parameter or block field */
|
13285
13293
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13286
13294
|
|
@@ -13290,6 +13298,20 @@ interface FindInNodeTreeReference {
|
|
13290
13298
|
/** This might be the composition parameter, or entry field */
|
13291
13299
|
parameter: ComponentParameter;
|
13292
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
|
+
*/
|
13293
13315
|
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13294
13316
|
|
13295
13317
|
/** @deprecated use walkNodeTree */
|
@@ -13741,11 +13763,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13741
13763
|
* Removes things like author, stats, etc.
|
13742
13764
|
*/
|
13743
13765
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13744
|
-
/**
|
13745
|
-
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13746
|
-
* If no properties are defined, returns undefined.
|
13747
|
-
*/
|
13748
|
-
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13749
13766
|
|
13750
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13751
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13786,13 +13803,13 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13786
13803
|
*/
|
13787
13804
|
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13788
13805
|
/**
|
13789
|
-
* A fast, non-exhaustive guard which checks the value is an array
|
13790
|
-
* as well as the first item if there is one
|
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
|
13791
13808
|
*/
|
13792
13809
|
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13793
13810
|
/**
|
13794
13811
|
* A fast, non-exhaustive guard which checks the
|
13795
|
-
* required structure
|
13812
|
+
* required structure of an asset item
|
13796
13813
|
*/
|
13797
13814
|
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13798
13815
|
|
@@ -13825,6 +13842,40 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13825
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13826
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13827
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
|
+
|
13828
13879
|
type BindVariablesResult<TValue> = {
|
13829
13880
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13830
13881
|
boundCount: number;
|
@@ -13884,4 +13935,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13884
13935
|
|
13885
13936
|
declare const CanvasClientError: typeof ApiClientError;
|
13886
13937
|
|
13887
|
-
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, EventNames, FindInNodeTreeReference, 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, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, 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) {
|
@@ -1036,6 +1020,37 @@ function isAssetParamValueItem(item) {
|
|
1036
1020
|
);
|
1037
1021
|
}
|
1038
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
|
+
}
|
1053
|
+
|
1039
1054
|
// src/enhancement/walkNodeTree.ts
|
1040
1055
|
function walkNodeTree(node, visitor, options) {
|
1041
1056
|
var _a, _b;
|
@@ -1258,7 +1273,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1258
1273
|
const propertyEntries = Object.entries(properties);
|
1259
1274
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1260
1275
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1261
|
-
if (propObject.type
|
1276
|
+
if (!isNestedNodeType(propObject.type))
|
1262
1277
|
continue;
|
1263
1278
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1264
1279
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1284,6 +1299,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1284
1299
|
}
|
1285
1300
|
} while (componentQueue.length > 0);
|
1286
1301
|
}
|
1302
|
+
function isNestedNodeType(type) {
|
1303
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1304
|
+
}
|
1287
1305
|
function getBlockValue(component, parameterName) {
|
1288
1306
|
var _a;
|
1289
1307
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2199,11 +2217,6 @@ var RouteClient = class extends ApiClient8 {
|
|
2199
2217
|
}
|
2200
2218
|
};
|
2201
2219
|
|
2202
|
-
// src/types/parameters/assetParameterTypes.ts
|
2203
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
2204
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
2205
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
2206
|
-
|
2207
2220
|
// src/utils/createApiEnhancer.ts
|
2208
2221
|
var createUniformApiEnhancer = ({ apiUrl }) => {
|
2209
2222
|
return async (message) => {
|
@@ -2226,6 +2239,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2226
2239
|
};
|
2227
2240
|
};
|
2228
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
|
+
|
2229
2258
|
// src/utils/getParameterAttributes.ts
|
2230
2259
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2231
2260
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2574,10 +2603,13 @@ export {
|
|
2574
2603
|
getChannelName,
|
2575
2604
|
getComponentJsonPointer,
|
2576
2605
|
getComponentPath,
|
2606
|
+
getNodeValues,
|
2577
2607
|
getNounForLocation,
|
2578
2608
|
getNounForNode,
|
2579
2609
|
getParameterAttributes,
|
2580
2610
|
getPropertiesValue,
|
2611
|
+
getPropertyValue,
|
2612
|
+
getSingleNodeValues,
|
2581
2613
|
isAddComponentMessage,
|
2582
2614
|
isAllowedReferrer,
|
2583
2615
|
isAssetParamValue,
|
@@ -2587,6 +2619,7 @@ export {
|
|
2587
2619
|
isDismissPlaceholderMessage,
|
2588
2620
|
isEntryData,
|
2589
2621
|
isMovingComponentMessage,
|
2622
|
+
isNestedNodeType,
|
2590
2623
|
isOpenParameterEditorMessage,
|
2591
2624
|
isReadyMessage,
|
2592
2625
|
isReportRenderedCompositionsMessage,
|
package/dist/index.js
CHANGED
@@ -350,10 +350,13 @@ __export(src_exports, {
|
|
350
350
|
getChannelName: () => getChannelName,
|
351
351
|
getComponentJsonPointer: () => getComponentJsonPointer,
|
352
352
|
getComponentPath: () => getComponentPath,
|
353
|
+
getNodeValues: () => getNodeValues,
|
353
354
|
getNounForLocation: () => getNounForLocation,
|
354
355
|
getNounForNode: () => getNounForNode,
|
355
356
|
getParameterAttributes: () => getParameterAttributes,
|
356
357
|
getPropertiesValue: () => getPropertiesValue,
|
358
|
+
getPropertyValue: () => getPropertyValue,
|
359
|
+
getSingleNodeValues: () => getSingleNodeValues,
|
357
360
|
isAddComponentMessage: () => isAddComponentMessage,
|
358
361
|
isAllowedReferrer: () => isAllowedReferrer,
|
359
362
|
isAssetParamValue: () => isAssetParamValue,
|
@@ -363,6 +366,7 @@ __export(src_exports, {
|
|
363
366
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
364
367
|
isEntryData: () => isEntryData,
|
365
368
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
369
|
+
isNestedNodeType: () => isNestedNodeType,
|
366
370
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
367
371
|
isReadyMessage: () => isReadyMessage,
|
368
372
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
@@ -1122,25 +1126,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1122
1126
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1123
1127
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1124
1128
|
var EDGE_CACHE_DISABLED = -1;
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
return {
|
1129
|
-
entry: {
|
1130
|
-
type: entry.entry.type,
|
1131
|
-
_dataResources: entry.entry._dataResources,
|
1132
|
-
_id: entry.entry._id,
|
1133
|
-
_name: entry.entry._name,
|
1134
|
-
_slug: entry.entry._slug,
|
1135
|
-
fields: entry.entry.fields
|
1136
|
-
},
|
1137
|
-
state: entry.state,
|
1138
|
-
projectId: entry.projectId
|
1139
|
-
};
|
1140
|
-
}
|
1141
|
-
function getPropertiesValue(entity) {
|
1142
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1143
|
-
}
|
1129
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1130
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1131
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1144
1132
|
|
1145
1133
|
// src/utils/guards.ts
|
1146
1134
|
function isRootEntryReference(root) {
|
@@ -1158,6 +1146,37 @@ function isAssetParamValueItem(item) {
|
|
1158
1146
|
);
|
1159
1147
|
}
|
1160
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
|
+
}
|
1179
|
+
|
1161
1180
|
// src/enhancement/walkNodeTree.ts
|
1162
1181
|
function walkNodeTree(node, visitor, options) {
|
1163
1182
|
var _a, _b;
|
@@ -1380,7 +1399,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1380
1399
|
const propertyEntries = Object.entries(properties);
|
1381
1400
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1382
1401
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1383
|
-
if (propObject.type
|
1402
|
+
if (!isNestedNodeType(propObject.type))
|
1384
1403
|
continue;
|
1385
1404
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1386
1405
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1406,6 +1425,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1406
1425
|
}
|
1407
1426
|
} while (componentQueue.length > 0);
|
1408
1427
|
}
|
1428
|
+
function isNestedNodeType(type) {
|
1429
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1430
|
+
}
|
1409
1431
|
function getBlockValue(component, parameterName) {
|
1410
1432
|
var _a;
|
1411
1433
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2321,11 +2343,6 @@ var RouteClient = class extends import_api9.ApiClient {
|
|
2321
2343
|
}
|
2322
2344
|
};
|
2323
2345
|
|
2324
|
-
// src/types/parameters/assetParameterTypes.ts
|
2325
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
2326
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
2327
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
2328
|
-
|
2329
2346
|
// src/utils/createApiEnhancer.ts
|
2330
2347
|
var createUniformApiEnhancer = ({ apiUrl }) => {
|
2331
2348
|
return async (message) => {
|
@@ -2348,6 +2365,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2348
2365
|
};
|
2349
2366
|
};
|
2350
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
|
+
|
2351
2384
|
// src/utils/getParameterAttributes.ts
|
2352
2385
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2353
2386
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2697,10 +2730,13 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2697
2730
|
getChannelName,
|
2698
2731
|
getComponentJsonPointer,
|
2699
2732
|
getComponentPath,
|
2733
|
+
getNodeValues,
|
2700
2734
|
getNounForLocation,
|
2701
2735
|
getNounForNode,
|
2702
2736
|
getParameterAttributes,
|
2703
2737
|
getPropertiesValue,
|
2738
|
+
getPropertyValue,
|
2739
|
+
getSingleNodeValues,
|
2704
2740
|
isAddComponentMessage,
|
2705
2741
|
isAllowedReferrer,
|
2706
2742
|
isAssetParamValue,
|
@@ -2710,6 +2746,7 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2710
2746
|
isDismissPlaceholderMessage,
|
2711
2747
|
isEntryData,
|
2712
2748
|
isMovingComponentMessage,
|
2749
|
+
isNestedNodeType,
|
2713
2750
|
isOpenParameterEditorMessage,
|
2714
2751
|
isReadyMessage,
|
2715
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) {
|
@@ -1036,6 +1020,37 @@ function isAssetParamValueItem(item) {
|
|
1036
1020
|
);
|
1037
1021
|
}
|
1038
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
|
+
}
|
1053
|
+
|
1039
1054
|
// src/enhancement/walkNodeTree.ts
|
1040
1055
|
function walkNodeTree(node, visitor, options) {
|
1041
1056
|
var _a, _b;
|
@@ -1258,7 +1273,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1258
1273
|
const propertyEntries = Object.entries(properties);
|
1259
1274
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1260
1275
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1261
|
-
if (propObject.type
|
1276
|
+
if (!isNestedNodeType(propObject.type))
|
1262
1277
|
continue;
|
1263
1278
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1264
1279
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1284,6 +1299,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1284
1299
|
}
|
1285
1300
|
} while (componentQueue.length > 0);
|
1286
1301
|
}
|
1302
|
+
function isNestedNodeType(type) {
|
1303
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1304
|
+
}
|
1287
1305
|
function getBlockValue(component, parameterName) {
|
1288
1306
|
var _a;
|
1289
1307
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2199,11 +2217,6 @@ var RouteClient = class extends ApiClient8 {
|
|
2199
2217
|
}
|
2200
2218
|
};
|
2201
2219
|
|
2202
|
-
// src/types/parameters/assetParameterTypes.ts
|
2203
|
-
var ASSET_PARAMETER_TYPE = "asset";
|
2204
|
-
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
2205
|
-
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
2206
|
-
|
2207
2220
|
// src/utils/createApiEnhancer.ts
|
2208
2221
|
var createUniformApiEnhancer = ({ apiUrl }) => {
|
2209
2222
|
return async (message) => {
|
@@ -2226,6 +2239,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2226
2239
|
};
|
2227
2240
|
};
|
2228
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
|
+
|
2229
2258
|
// src/utils/getParameterAttributes.ts
|
2230
2259
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2231
2260
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2574,10 +2603,13 @@ export {
|
|
2574
2603
|
getChannelName,
|
2575
2604
|
getComponentJsonPointer,
|
2576
2605
|
getComponentPath,
|
2606
|
+
getNodeValues,
|
2577
2607
|
getNounForLocation,
|
2578
2608
|
getNounForNode,
|
2579
2609
|
getParameterAttributes,
|
2580
2610
|
getPropertiesValue,
|
2611
|
+
getPropertyValue,
|
2612
|
+
getSingleNodeValues,
|
2581
2613
|
isAddComponentMessage,
|
2582
2614
|
isAllowedReferrer,
|
2583
2615
|
isAssetParamValue,
|
@@ -2587,6 +2619,7 @@ export {
|
|
2587
2619
|
isDismissPlaceholderMessage,
|
2588
2620
|
isEntryData,
|
2589
2621
|
isMovingComponentMessage,
|
2622
|
+
isNestedNodeType,
|
2590
2623
|
isOpenParameterEditorMessage,
|
2591
2624
|
isReadyMessage,
|
2592
2625
|
isReportRenderedCompositionsMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.81.
|
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.81.
|
42
|
-
"@uniformdev/context": "19.81.
|
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
|
}
|