@uniformdev/canvas 19.82.2-alpha.19 → 19.83.0
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 +6 -49
- package/dist/index.d.ts +6 -49
- package/dist/index.esm.js +20 -58
- package/dist/index.js +20 -61
- package/dist/index.mjs +20 -58
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
@@ -13284,11 +13284,6 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13284
13284
|
};
|
13285
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13286
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;
|
13292
13287
|
/** Gets the typed value of a block parameter or block field */
|
13293
13288
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13294
13289
|
|
@@ -13763,6 +13758,11 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13763
13758
|
* Removes things like author, stats, etc.
|
13764
13759
|
*/
|
13765
13760
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13761
|
+
/**
|
13762
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13763
|
+
* If no properties are defined, returns undefined.
|
13764
|
+
*/
|
13765
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13766
13766
|
|
13767
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13768
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13842,49 +13842,6 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13842
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13843
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13844
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 FlattenValuesOptions {
|
13851
|
-
/**
|
13852
|
-
* Take only the first item from an array
|
13853
|
-
* of values, flatten it and return it as a single object
|
13854
|
-
*/
|
13855
|
-
toSingle?: boolean;
|
13856
|
-
/**
|
13857
|
-
* If the property has nested properties, like Blocks or Assets
|
13858
|
-
* can, then how many levels should we traverse.
|
13859
|
-
*
|
13860
|
-
* You can set this to `Infinity` although it would be more
|
13861
|
-
* advisable, for performance, to use the number you need in your code.
|
13862
|
-
*
|
13863
|
-
* Where:
|
13864
|
-
* levels=0 will only extract the properties of the current object
|
13865
|
-
* levels=1 will include any child blocks or assets on the current object
|
13866
|
-
* but not any grandchildren
|
13867
|
-
*
|
13868
|
-
* @default 1
|
13869
|
-
*/
|
13870
|
-
levels?: number;
|
13871
|
-
}
|
13872
|
-
/**
|
13873
|
-
* Get the data stored in the value of a component parameter
|
13874
|
-
* or a field attached to an Entry, Block or Asset
|
13875
|
-
*/
|
13876
|
-
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13877
|
-
declare function getPropertyValue(parameter: null): null;
|
13878
|
-
declare function getPropertyValue(parameter: undefined): undefined;
|
13879
|
-
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13880
|
-
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
13881
|
-
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
13882
|
-
declare function flattenValues(data: DataWithProperties, options?: FlattenValuesOptions): Record<string, unknown>;
|
13883
|
-
declare function flattenValues(data: Array<DataWithProperties>, options: {
|
13884
|
-
toSingle: true;
|
13885
|
-
} & Omit<FlattenValuesOptions, 'toSingle'>): Record<string, unknown>;
|
13886
|
-
declare function flattenValues(data: Array<DataWithProperties>, options?: FlattenValuesOptions): Array<Record<string, unknown>>;
|
13887
|
-
|
13888
13845
|
type BindVariablesResult<TValue> = {
|
13889
13846
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13890
13847
|
boundCount: number;
|
@@ -13944,4 +13901,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13944
13901
|
|
13945
13902
|
declare const CanvasClientError: typeof ApiClientError;
|
13946
13903
|
|
13947
|
-
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, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type 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, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type
|
13904
|
+
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, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type 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, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryList, type EventNames, type FindInNodeTreeReference, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type 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, type InvalidationPayload, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, type ReportRenderedCompositionsMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type UsageTrackingApi, type UsageTrackingGetParameters, type UsageTrackingGetResponse, type UsageTrackingPostParameters, type UsageTrackingPostResponse, type WalkComponentTreeActions, type WalkNodeTreeActions, type 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 };
|
package/dist/index.d.ts
CHANGED
@@ -13284,11 +13284,6 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13284
13284
|
};
|
13285
13285
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13286
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;
|
13292
13287
|
/** Gets the typed value of a block parameter or block field */
|
13293
13288
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13294
13289
|
|
@@ -13763,6 +13758,11 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13763
13758
|
* Removes things like author, stats, etc.
|
13764
13759
|
*/
|
13765
13760
|
declare function convertEntryToPutEntry(entry: Entry): PutEntryBody;
|
13761
|
+
/**
|
13762
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13763
|
+
* If no properties are defined, returns undefined.
|
13764
|
+
*/
|
13765
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13766
13766
|
|
13767
13767
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13768
13768
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13842,49 +13842,6 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13842
13842
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13843
13843
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13844
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 FlattenValuesOptions {
|
13851
|
-
/**
|
13852
|
-
* Take only the first item from an array
|
13853
|
-
* of values, flatten it and return it as a single object
|
13854
|
-
*/
|
13855
|
-
toSingle?: boolean;
|
13856
|
-
/**
|
13857
|
-
* If the property has nested properties, like Blocks or Assets
|
13858
|
-
* can, then how many levels should we traverse.
|
13859
|
-
*
|
13860
|
-
* You can set this to `Infinity` although it would be more
|
13861
|
-
* advisable, for performance, to use the number you need in your code.
|
13862
|
-
*
|
13863
|
-
* Where:
|
13864
|
-
* levels=0 will only extract the properties of the current object
|
13865
|
-
* levels=1 will include any child blocks or assets on the current object
|
13866
|
-
* but not any grandchildren
|
13867
|
-
*
|
13868
|
-
* @default 1
|
13869
|
-
*/
|
13870
|
-
levels?: number;
|
13871
|
-
}
|
13872
|
-
/**
|
13873
|
-
* Get the data stored in the value of a component parameter
|
13874
|
-
* or a field attached to an Entry, Block or Asset
|
13875
|
-
*/
|
13876
|
-
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13877
|
-
declare function getPropertyValue(parameter: null): null;
|
13878
|
-
declare function getPropertyValue(parameter: undefined): undefined;
|
13879
|
-
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13880
|
-
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
13881
|
-
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
13882
|
-
declare function flattenValues(data: DataWithProperties, options?: FlattenValuesOptions): Record<string, unknown>;
|
13883
|
-
declare function flattenValues(data: Array<DataWithProperties>, options: {
|
13884
|
-
toSingle: true;
|
13885
|
-
} & Omit<FlattenValuesOptions, 'toSingle'>): Record<string, unknown>;
|
13886
|
-
declare function flattenValues(data: Array<DataWithProperties>, options?: FlattenValuesOptions): Array<Record<string, unknown>>;
|
13887
|
-
|
13888
13845
|
type BindVariablesResult<TValue> = {
|
13889
13846
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13890
13847
|
boundCount: number;
|
@@ -13944,4 +13901,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13944
13901
|
|
13945
13902
|
declare const CanvasClientError: typeof ApiClientError;
|
13946
13903
|
|
13947
|
-
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, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type 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, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type
|
13904
|
+
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, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type 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, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryList, type EventNames, type FindInNodeTreeReference, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type 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, type InvalidationPayload, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, type ReportRenderedCompositionsMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type UsageTrackingApi, type UsageTrackingGetParameters, type UsageTrackingGetResponse, type UsageTrackingPostParameters, type UsageTrackingPostResponse, type WalkComponentTreeActions, type WalkNodeTreeActions, type 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 };
|
package/dist/index.esm.js
CHANGED
@@ -1004,6 +1004,25 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1004
1004
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
1005
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1006
1006
|
|
1007
|
+
// src/utils/entryConverter.ts
|
1008
|
+
function convertEntryToPutEntry(entry) {
|
1009
|
+
return {
|
1010
|
+
entry: {
|
1011
|
+
type: entry.entry.type,
|
1012
|
+
_dataResources: entry.entry._dataResources,
|
1013
|
+
_id: entry.entry._id,
|
1014
|
+
_name: entry.entry._name,
|
1015
|
+
_slug: entry.entry._slug,
|
1016
|
+
fields: entry.entry.fields
|
1017
|
+
},
|
1018
|
+
state: entry.state,
|
1019
|
+
projectId: entry.projectId
|
1020
|
+
};
|
1021
|
+
}
|
1022
|
+
function getPropertiesValue(entity) {
|
1023
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1024
|
+
}
|
1025
|
+
|
1007
1026
|
// src/utils/guards.ts
|
1008
1027
|
function isRootEntryReference(root) {
|
1009
1028
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1020,41 +1039,6 @@ function isAssetParamValueItem(item) {
|
|
1020
1039
|
);
|
1021
1040
|
}
|
1022
1041
|
|
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 flattenValues(data, options = {}) {
|
1031
|
-
if (!data) {
|
1032
|
-
return data;
|
1033
|
-
} else if (Array.isArray(data) && options.toSingle) {
|
1034
|
-
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1035
|
-
} else if (Array.isArray(data)) {
|
1036
|
-
return data.map((node) => flattenSingleNodeValues(node, options));
|
1037
|
-
} else {
|
1038
|
-
return flattenSingleNodeValues(data, options);
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
function flattenSingleNodeValues(data, options = {}) {
|
1042
|
-
const { levels = 1 } = options;
|
1043
|
-
const properties = getPropertiesValue(data);
|
1044
|
-
return properties ? Object.fromEntries(
|
1045
|
-
Object.entries(properties).map(([id, parameter]) => {
|
1046
|
-
const value = getPropertyValue(parameter);
|
1047
|
-
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1048
|
-
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1049
|
-
const nestedOptions = { ...options, levels: levels - 1 };
|
1050
|
-
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1051
|
-
} else {
|
1052
|
-
return [id, value];
|
1053
|
-
}
|
1054
|
-
})
|
1055
|
-
) : properties;
|
1056
|
-
}
|
1057
|
-
|
1058
1042
|
// src/enhancement/walkNodeTree.ts
|
1059
1043
|
function walkNodeTree(node, visitor, options) {
|
1060
1044
|
var _a, _b;
|
@@ -1277,7 +1261,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1277
1261
|
const propertyEntries = Object.entries(properties);
|
1278
1262
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1279
1263
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1280
|
-
if (
|
1264
|
+
if (propObject.type !== CANVAS_BLOCK_PARAM_TYPE)
|
1281
1265
|
continue;
|
1282
1266
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1283
1267
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1303,9 +1287,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1303
1287
|
}
|
1304
1288
|
} while (componentQueue.length > 0);
|
1305
1289
|
}
|
1306
|
-
function isNestedNodeType(type) {
|
1307
|
-
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1308
|
-
}
|
1309
1290
|
function getBlockValue(component, parameterName) {
|
1310
1291
|
var _a;
|
1311
1292
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2243,22 +2224,6 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2243
2224
|
};
|
2244
2225
|
};
|
2245
2226
|
|
2246
|
-
// src/utils/entryConverter.ts
|
2247
|
-
function convertEntryToPutEntry(entry) {
|
2248
|
-
return {
|
2249
|
-
entry: {
|
2250
|
-
type: entry.entry.type,
|
2251
|
-
_dataResources: entry.entry._dataResources,
|
2252
|
-
_id: entry.entry._id,
|
2253
|
-
_name: entry.entry._name,
|
2254
|
-
_slug: entry.entry._slug,
|
2255
|
-
fields: entry.entry.fields
|
2256
|
-
},
|
2257
|
-
state: entry.state,
|
2258
|
-
projectId: entry.projectId
|
2259
|
-
};
|
2260
|
-
}
|
2261
|
-
|
2262
2227
|
// src/utils/getParameterAttributes.ts
|
2263
2228
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2264
2229
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2601,7 +2566,6 @@ export {
|
|
2601
2566
|
enhance,
|
2602
2567
|
extractLocales,
|
2603
2568
|
findParameterInNodeTree,
|
2604
|
-
flattenValues,
|
2605
2569
|
generateComponentPlaceholderId,
|
2606
2570
|
generateHash,
|
2607
2571
|
getBlockValue,
|
@@ -2612,7 +2576,6 @@ export {
|
|
2612
2576
|
getNounForNode,
|
2613
2577
|
getParameterAttributes,
|
2614
2578
|
getPropertiesValue,
|
2615
|
-
getPropertyValue,
|
2616
2579
|
isAddComponentMessage,
|
2617
2580
|
isAllowedReferrer,
|
2618
2581
|
isAssetParamValue,
|
@@ -2622,7 +2585,6 @@ export {
|
|
2622
2585
|
isDismissPlaceholderMessage,
|
2623
2586
|
isEntryData,
|
2624
2587
|
isMovingComponentMessage,
|
2625
|
-
isNestedNodeType,
|
2626
2588
|
isOpenParameterEditorMessage,
|
2627
2589
|
isReadyMessage,
|
2628
2590
|
isReportRenderedCompositionsMessage,
|
package/dist/index.js
CHANGED
@@ -344,7 +344,6 @@ __export(src_exports, {
|
|
344
344
|
enhance: () => enhance,
|
345
345
|
extractLocales: () => extractLocales,
|
346
346
|
findParameterInNodeTree: () => findParameterInNodeTree,
|
347
|
-
flattenValues: () => flattenValues,
|
348
347
|
generateComponentPlaceholderId: () => generateComponentPlaceholderId,
|
349
348
|
generateHash: () => generateHash,
|
350
349
|
getBlockValue: () => getBlockValue,
|
@@ -355,7 +354,6 @@ __export(src_exports, {
|
|
355
354
|
getNounForNode: () => getNounForNode,
|
356
355
|
getParameterAttributes: () => getParameterAttributes,
|
357
356
|
getPropertiesValue: () => getPropertiesValue,
|
358
|
-
getPropertyValue: () => getPropertyValue,
|
359
357
|
isAddComponentMessage: () => isAddComponentMessage,
|
360
358
|
isAllowedReferrer: () => isAllowedReferrer,
|
361
359
|
isAssetParamValue: () => isAssetParamValue,
|
@@ -365,7 +363,6 @@ __export(src_exports, {
|
|
365
363
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
366
364
|
isEntryData: () => isEntryData,
|
367
365
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
368
|
-
isNestedNodeType: () => isNestedNodeType,
|
369
366
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
370
367
|
isReadyMessage: () => isReadyMessage,
|
371
368
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
@@ -1129,6 +1126,25 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1129
1126
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1130
1127
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1131
1128
|
|
1129
|
+
// src/utils/entryConverter.ts
|
1130
|
+
function convertEntryToPutEntry(entry) {
|
1131
|
+
return {
|
1132
|
+
entry: {
|
1133
|
+
type: entry.entry.type,
|
1134
|
+
_dataResources: entry.entry._dataResources,
|
1135
|
+
_id: entry.entry._id,
|
1136
|
+
_name: entry.entry._name,
|
1137
|
+
_slug: entry.entry._slug,
|
1138
|
+
fields: entry.entry.fields
|
1139
|
+
},
|
1140
|
+
state: entry.state,
|
1141
|
+
projectId: entry.projectId
|
1142
|
+
};
|
1143
|
+
}
|
1144
|
+
function getPropertiesValue(entity) {
|
1145
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1146
|
+
}
|
1147
|
+
|
1132
1148
|
// src/utils/guards.ts
|
1133
1149
|
function isRootEntryReference(root) {
|
1134
1150
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1145,41 +1161,6 @@ function isAssetParamValueItem(item) {
|
|
1145
1161
|
);
|
1146
1162
|
}
|
1147
1163
|
|
1148
|
-
// src/utils/properties.ts
|
1149
|
-
function getPropertiesValue(entity) {
|
1150
|
-
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1151
|
-
}
|
1152
|
-
function getPropertyValue(parameter) {
|
1153
|
-
return parameter ? parameter.value : parameter;
|
1154
|
-
}
|
1155
|
-
function flattenValues(data, options = {}) {
|
1156
|
-
if (!data) {
|
1157
|
-
return data;
|
1158
|
-
} else if (Array.isArray(data) && options.toSingle) {
|
1159
|
-
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1160
|
-
} else if (Array.isArray(data)) {
|
1161
|
-
return data.map((node) => flattenSingleNodeValues(node, options));
|
1162
|
-
} else {
|
1163
|
-
return flattenSingleNodeValues(data, options);
|
1164
|
-
}
|
1165
|
-
}
|
1166
|
-
function flattenSingleNodeValues(data, options = {}) {
|
1167
|
-
const { levels = 1 } = options;
|
1168
|
-
const properties = getPropertiesValue(data);
|
1169
|
-
return properties ? Object.fromEntries(
|
1170
|
-
Object.entries(properties).map(([id, parameter]) => {
|
1171
|
-
const value = getPropertyValue(parameter);
|
1172
|
-
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1173
|
-
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1174
|
-
const nestedOptions = { ...options, levels: levels - 1 };
|
1175
|
-
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1176
|
-
} else {
|
1177
|
-
return [id, value];
|
1178
|
-
}
|
1179
|
-
})
|
1180
|
-
) : properties;
|
1181
|
-
}
|
1182
|
-
|
1183
1164
|
// src/enhancement/walkNodeTree.ts
|
1184
1165
|
function walkNodeTree(node, visitor, options) {
|
1185
1166
|
var _a, _b;
|
@@ -1402,7 +1383,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1402
1383
|
const propertyEntries = Object.entries(properties);
|
1403
1384
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1404
1385
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1405
|
-
if (
|
1386
|
+
if (propObject.type !== CANVAS_BLOCK_PARAM_TYPE)
|
1406
1387
|
continue;
|
1407
1388
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1408
1389
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1428,9 +1409,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1428
1409
|
}
|
1429
1410
|
} while (componentQueue.length > 0);
|
1430
1411
|
}
|
1431
|
-
function isNestedNodeType(type) {
|
1432
|
-
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1433
|
-
}
|
1434
1412
|
function getBlockValue(component, parameterName) {
|
1435
1413
|
var _a;
|
1436
1414
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2368,22 +2346,6 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2368
2346
|
};
|
2369
2347
|
};
|
2370
2348
|
|
2371
|
-
// src/utils/entryConverter.ts
|
2372
|
-
function convertEntryToPutEntry(entry) {
|
2373
|
-
return {
|
2374
|
-
entry: {
|
2375
|
-
type: entry.entry.type,
|
2376
|
-
_dataResources: entry.entry._dataResources,
|
2377
|
-
_id: entry.entry._id,
|
2378
|
-
_name: entry.entry._name,
|
2379
|
-
_slug: entry.entry._slug,
|
2380
|
-
fields: entry.entry.fields
|
2381
|
-
},
|
2382
|
-
state: entry.state,
|
2383
|
-
projectId: entry.projectId
|
2384
|
-
};
|
2385
|
-
}
|
2386
|
-
|
2387
2349
|
// src/utils/getParameterAttributes.ts
|
2388
2350
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2389
2351
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2727,7 +2689,6 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2727
2689
|
enhance,
|
2728
2690
|
extractLocales,
|
2729
2691
|
findParameterInNodeTree,
|
2730
|
-
flattenValues,
|
2731
2692
|
generateComponentPlaceholderId,
|
2732
2693
|
generateHash,
|
2733
2694
|
getBlockValue,
|
@@ -2738,7 +2699,6 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2738
2699
|
getNounForNode,
|
2739
2700
|
getParameterAttributes,
|
2740
2701
|
getPropertiesValue,
|
2741
|
-
getPropertyValue,
|
2742
2702
|
isAddComponentMessage,
|
2743
2703
|
isAllowedReferrer,
|
2744
2704
|
isAssetParamValue,
|
@@ -2748,7 +2708,6 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2748
2708
|
isDismissPlaceholderMessage,
|
2749
2709
|
isEntryData,
|
2750
2710
|
isMovingComponentMessage,
|
2751
|
-
isNestedNodeType,
|
2752
2711
|
isOpenParameterEditorMessage,
|
2753
2712
|
isReadyMessage,
|
2754
2713
|
isReportRenderedCompositionsMessage,
|
package/dist/index.mjs
CHANGED
@@ -1004,6 +1004,25 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1004
1004
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
1005
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1006
1006
|
|
1007
|
+
// src/utils/entryConverter.ts
|
1008
|
+
function convertEntryToPutEntry(entry) {
|
1009
|
+
return {
|
1010
|
+
entry: {
|
1011
|
+
type: entry.entry.type,
|
1012
|
+
_dataResources: entry.entry._dataResources,
|
1013
|
+
_id: entry.entry._id,
|
1014
|
+
_name: entry.entry._name,
|
1015
|
+
_slug: entry.entry._slug,
|
1016
|
+
fields: entry.entry.fields
|
1017
|
+
},
|
1018
|
+
state: entry.state,
|
1019
|
+
projectId: entry.projectId
|
1020
|
+
};
|
1021
|
+
}
|
1022
|
+
function getPropertiesValue(entity) {
|
1023
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1024
|
+
}
|
1025
|
+
|
1007
1026
|
// src/utils/guards.ts
|
1008
1027
|
function isRootEntryReference(root) {
|
1009
1028
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1020,41 +1039,6 @@ function isAssetParamValueItem(item) {
|
|
1020
1039
|
);
|
1021
1040
|
}
|
1022
1041
|
|
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 flattenValues(data, options = {}) {
|
1031
|
-
if (!data) {
|
1032
|
-
return data;
|
1033
|
-
} else if (Array.isArray(data) && options.toSingle) {
|
1034
|
-
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1035
|
-
} else if (Array.isArray(data)) {
|
1036
|
-
return data.map((node) => flattenSingleNodeValues(node, options));
|
1037
|
-
} else {
|
1038
|
-
return flattenSingleNodeValues(data, options);
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
function flattenSingleNodeValues(data, options = {}) {
|
1042
|
-
const { levels = 1 } = options;
|
1043
|
-
const properties = getPropertiesValue(data);
|
1044
|
-
return properties ? Object.fromEntries(
|
1045
|
-
Object.entries(properties).map(([id, parameter]) => {
|
1046
|
-
const value = getPropertyValue(parameter);
|
1047
|
-
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1048
|
-
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1049
|
-
const nestedOptions = { ...options, levels: levels - 1 };
|
1050
|
-
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1051
|
-
} else {
|
1052
|
-
return [id, value];
|
1053
|
-
}
|
1054
|
-
})
|
1055
|
-
) : properties;
|
1056
|
-
}
|
1057
|
-
|
1058
1042
|
// src/enhancement/walkNodeTree.ts
|
1059
1043
|
function walkNodeTree(node, visitor, options) {
|
1060
1044
|
var _a, _b;
|
@@ -1277,7 +1261,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1277
1261
|
const propertyEntries = Object.entries(properties);
|
1278
1262
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1279
1263
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1280
|
-
if (
|
1264
|
+
if (propObject.type !== CANVAS_BLOCK_PARAM_TYPE)
|
1281
1265
|
continue;
|
1282
1266
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1283
1267
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1303,9 +1287,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1303
1287
|
}
|
1304
1288
|
} while (componentQueue.length > 0);
|
1305
1289
|
}
|
1306
|
-
function isNestedNodeType(type) {
|
1307
|
-
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1308
|
-
}
|
1309
1290
|
function getBlockValue(component, parameterName) {
|
1310
1291
|
var _a;
|
1311
1292
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2243,22 +2224,6 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2243
2224
|
};
|
2244
2225
|
};
|
2245
2226
|
|
2246
|
-
// src/utils/entryConverter.ts
|
2247
|
-
function convertEntryToPutEntry(entry) {
|
2248
|
-
return {
|
2249
|
-
entry: {
|
2250
|
-
type: entry.entry.type,
|
2251
|
-
_dataResources: entry.entry._dataResources,
|
2252
|
-
_id: entry.entry._id,
|
2253
|
-
_name: entry.entry._name,
|
2254
|
-
_slug: entry.entry._slug,
|
2255
|
-
fields: entry.entry.fields
|
2256
|
-
},
|
2257
|
-
state: entry.state,
|
2258
|
-
projectId: entry.projectId
|
2259
|
-
};
|
2260
|
-
}
|
2261
|
-
|
2262
2227
|
// src/utils/getParameterAttributes.ts
|
2263
2228
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2264
2229
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2601,7 +2566,6 @@ export {
|
|
2601
2566
|
enhance,
|
2602
2567
|
extractLocales,
|
2603
2568
|
findParameterInNodeTree,
|
2604
|
-
flattenValues,
|
2605
2569
|
generateComponentPlaceholderId,
|
2606
2570
|
generateHash,
|
2607
2571
|
getBlockValue,
|
@@ -2612,7 +2576,6 @@ export {
|
|
2612
2576
|
getNounForNode,
|
2613
2577
|
getParameterAttributes,
|
2614
2578
|
getPropertiesValue,
|
2615
|
-
getPropertyValue,
|
2616
2579
|
isAddComponentMessage,
|
2617
2580
|
isAllowedReferrer,
|
2618
2581
|
isAssetParamValue,
|
@@ -2622,7 +2585,6 @@ export {
|
|
2622
2585
|
isDismissPlaceholderMessage,
|
2623
2586
|
isEntryData,
|
2624
2587
|
isMovingComponentMessage,
|
2625
|
-
isNestedNodeType,
|
2626
2588
|
isOpenParameterEditorMessage,
|
2627
2589
|
isReadyMessage,
|
2628
2590
|
isReportRenderedCompositionsMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.83.0",
|
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.83.0",
|
42
|
+
"@uniformdev/context": "19.83.0",
|
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": "bcadc9d652227a57ec901f94b4d2d166986fd5c0"
|
52
52
|
}
|