@uniformdev/canvas 19.80.1-alpha.126 → 19.80.1-alpha.170
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 +62 -7
- package/dist/index.d.ts +62 -7
- package/dist/index.esm.js +62 -22
- package/dist/index.js +65 -22
- package/dist/index.mjs +62 -22
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
@@ -12497,6 +12497,7 @@ interface paths$1 {
|
|
12497
12497
|
query: {
|
12498
12498
|
projectId: string;
|
12499
12499
|
type: "definition" | "instance";
|
12500
|
+
entityType?: "composition" | "entry";
|
12500
12501
|
definitionIds?: string;
|
12501
12502
|
instanceIds?: string;
|
12502
12503
|
withCompositions?: boolean | null;
|
@@ -12516,6 +12517,8 @@ interface paths$1 {
|
|
12516
12517
|
_name: string;
|
12517
12518
|
};
|
12518
12519
|
pattern: boolean;
|
12520
|
+
/** @enum {string} */
|
12521
|
+
type: "entry" | "composition";
|
12519
12522
|
}[];
|
12520
12523
|
totalCount: number;
|
12521
12524
|
}[];
|
@@ -12721,9 +12724,10 @@ type CompositionRelationshipsClientOptions = ClientOptions;
|
|
12721
12724
|
declare class unstable_CompositionRelationshipClient extends ApiClient<CompositionRelationshipsClientOptions> {
|
12722
12725
|
private readonly _options;
|
12723
12726
|
constructor(options: CompositionRelationshipsClientOptions);
|
12724
|
-
getDefinitionsRelationships: ({ definitionIds, withCompositions, }: {
|
12727
|
+
getDefinitionsRelationships: ({ definitionIds, withCompositions, entityType, }: {
|
12725
12728
|
definitionIds: string[];
|
12726
12729
|
withCompositions?: boolean | undefined;
|
12730
|
+
entityType?: "entry" | "composition" | undefined;
|
12727
12731
|
}) => Promise<CompositionRelationshipsDDefinitionGetResponse>;
|
12728
12732
|
clearAllRelationships: () => Promise<{
|
12729
12733
|
success: boolean;
|
@@ -13284,6 +13288,11 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13284
13288
|
};
|
13285
13289
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13286
13290
|
declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
|
13291
|
+
/**
|
13292
|
+
* Any types which hold an array of nodes and
|
13293
|
+
* therefore should be iterated over as child nodes
|
13294
|
+
*/
|
13295
|
+
declare function isNestedNodeType(type: string): boolean;
|
13287
13296
|
/** Gets the typed value of a block parameter or block field */
|
13288
13297
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13289
13298
|
|
@@ -13758,11 +13767,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13758
13767
|
* Removes things like author, stats, etc.
|
13759
13768
|
*/
|
13760
13769
|
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
13770
|
|
13767
13771
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13768
13772
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13842,6 +13846,57 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13842
13846
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13843
13847
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13844
13848
|
|
13849
|
+
type FlattenProperty<P> = P extends {
|
13850
|
+
value: unknown;
|
13851
|
+
} ? P['value'] : P;
|
13852
|
+
type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInstance, 'parameters'> ? Record<string, unknown> & {
|
13853
|
+
[Property in keyof T['parameters']]: FlattenProperty<T['parameters'][Property]>;
|
13854
|
+
} : T extends Pick<EntryData, 'fields'> ? Record<string, unknown> & {
|
13855
|
+
[Property in keyof T['fields']]: FlattenProperty<T['fields'][Property]>;
|
13856
|
+
} : unknown;
|
13857
|
+
/**
|
13858
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13859
|
+
* If no properties are defined, returns undefined.
|
13860
|
+
*/
|
13861
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13862
|
+
interface FlattenValuesOptions {
|
13863
|
+
/**
|
13864
|
+
* Take only the first item from an array
|
13865
|
+
* of values, flatten it and return it as a single object
|
13866
|
+
*/
|
13867
|
+
toSingle?: boolean;
|
13868
|
+
/**
|
13869
|
+
* If the property has nested properties, like Blocks or Assets
|
13870
|
+
* can, then how many levels should we traverse.
|
13871
|
+
*
|
13872
|
+
* You can set this to `Infinity` although it would be more
|
13873
|
+
* advisable, for performance, to use the number you need in your code.
|
13874
|
+
*
|
13875
|
+
* Where:
|
13876
|
+
* levels=0 will only extract the properties of the current object
|
13877
|
+
* levels=1 will include any child blocks or assets on the current object
|
13878
|
+
* but not any grandchildren
|
13879
|
+
*
|
13880
|
+
* @default 1
|
13881
|
+
*/
|
13882
|
+
levels?: number;
|
13883
|
+
}
|
13884
|
+
/**
|
13885
|
+
* Get the data stored in the value of a component parameter
|
13886
|
+
* or a field attached to an Entry, Block or Asset
|
13887
|
+
*/
|
13888
|
+
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13889
|
+
declare function getPropertyValue(parameter: null): null;
|
13890
|
+
declare function getPropertyValue(parameter: undefined): undefined;
|
13891
|
+
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13892
|
+
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
13893
|
+
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
13894
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Data | null | undefined, options?: FlattenValuesOptions): FlattenValues<Data> | null | undefined;
|
13895
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options: {
|
13896
|
+
toSingle: true;
|
13897
|
+
} & Omit<FlattenValuesOptions, 'toSingle'>): FlattenValues<Data> | null | undefined;
|
13898
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options?: FlattenValuesOptions): Array<FlattenValues<Data>> | null | undefined;
|
13899
|
+
|
13845
13900
|
type BindVariablesResult<TValue> = {
|
13846
13901
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13847
13902
|
boundCount: number;
|
@@ -13901,4 +13956,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13901
13956
|
|
13902
13957
|
declare const CanvasClientError: typeof ApiClientError;
|
13903
13958
|
|
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 };
|
13959
|
+
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 DataWithProperties, 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 FlattenProperty, type FlattenValues, type FlattenValuesOptions, 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, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, 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
@@ -12497,6 +12497,7 @@ interface paths$1 {
|
|
12497
12497
|
query: {
|
12498
12498
|
projectId: string;
|
12499
12499
|
type: "definition" | "instance";
|
12500
|
+
entityType?: "composition" | "entry";
|
12500
12501
|
definitionIds?: string;
|
12501
12502
|
instanceIds?: string;
|
12502
12503
|
withCompositions?: boolean | null;
|
@@ -12516,6 +12517,8 @@ interface paths$1 {
|
|
12516
12517
|
_name: string;
|
12517
12518
|
};
|
12518
12519
|
pattern: boolean;
|
12520
|
+
/** @enum {string} */
|
12521
|
+
type: "entry" | "composition";
|
12519
12522
|
}[];
|
12520
12523
|
totalCount: number;
|
12521
12524
|
}[];
|
@@ -12721,9 +12724,10 @@ type CompositionRelationshipsClientOptions = ClientOptions;
|
|
12721
12724
|
declare class unstable_CompositionRelationshipClient extends ApiClient<CompositionRelationshipsClientOptions> {
|
12722
12725
|
private readonly _options;
|
12723
12726
|
constructor(options: CompositionRelationshipsClientOptions);
|
12724
|
-
getDefinitionsRelationships: ({ definitionIds, withCompositions, }: {
|
12727
|
+
getDefinitionsRelationships: ({ definitionIds, withCompositions, entityType, }: {
|
12725
12728
|
definitionIds: string[];
|
12726
12729
|
withCompositions?: boolean | undefined;
|
12730
|
+
entityType?: "entry" | "composition" | undefined;
|
12727
12731
|
}) => Promise<CompositionRelationshipsDDefinitionGetResponse>;
|
12728
12732
|
clearAllRelationships: () => Promise<{
|
12729
12733
|
success: boolean;
|
@@ -13284,6 +13288,11 @@ type WalkNodeTreeOptions<TContext> = {
|
|
13284
13288
|
};
|
13285
13289
|
/** Walks a composition's content tree, visiting each component in a slot or block parameter/field depth-first, in order. */
|
13286
13290
|
declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | EntryData | Array<NodeLocationReference>, visitor: (info: TreeNodeInfoTypes<TContext>) => void, options?: WalkNodeTreeOptions<TContext>): void;
|
13291
|
+
/**
|
13292
|
+
* Any types which hold an array of nodes and
|
13293
|
+
* therefore should be iterated over as child nodes
|
13294
|
+
*/
|
13295
|
+
declare function isNestedNodeType(type: string): boolean;
|
13287
13296
|
/** Gets the typed value of a block parameter or block field */
|
13288
13297
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13289
13298
|
|
@@ -13758,11 +13767,6 @@ declare const createUniformApiEnhancer: ({ apiUrl }: {
|
|
13758
13767
|
* Removes things like author, stats, etc.
|
13759
13768
|
*/
|
13760
13769
|
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
13770
|
|
13767
13771
|
declare const ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
13768
13772
|
declare const ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -13842,6 +13846,57 @@ declare function mapSlotToTestVariations(slot: ComponentInstance[] | undefined):
|
|
13842
13846
|
declare const isComponentPlaceholderId: (id: string | undefined) => boolean;
|
13843
13847
|
declare const generateComponentPlaceholderId: (randomId: string, sdkVersion: number | undefined) => string;
|
13844
13848
|
|
13849
|
+
type FlattenProperty<P> = P extends {
|
13850
|
+
value: unknown;
|
13851
|
+
} ? P['value'] : P;
|
13852
|
+
type FlattenValues<T extends DataWithProperties> = T extends Pick<ComponentInstance, 'parameters'> ? Record<string, unknown> & {
|
13853
|
+
[Property in keyof T['parameters']]: FlattenProperty<T['parameters'][Property]>;
|
13854
|
+
} : T extends Pick<EntryData, 'fields'> ? Record<string, unknown> & {
|
13855
|
+
[Property in keyof T['fields']]: FlattenProperty<T['fields'][Property]>;
|
13856
|
+
} : unknown;
|
13857
|
+
/**
|
13858
|
+
* Gets the object holding the properties (fields or parameters) of an entry or component instance
|
13859
|
+
* If no properties are defined, returns undefined.
|
13860
|
+
*/
|
13861
|
+
declare function getPropertiesValue(entity: Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>): ComponentInstance['parameters'];
|
13862
|
+
interface FlattenValuesOptions {
|
13863
|
+
/**
|
13864
|
+
* Take only the first item from an array
|
13865
|
+
* of values, flatten it and return it as a single object
|
13866
|
+
*/
|
13867
|
+
toSingle?: boolean;
|
13868
|
+
/**
|
13869
|
+
* If the property has nested properties, like Blocks or Assets
|
13870
|
+
* can, then how many levels should we traverse.
|
13871
|
+
*
|
13872
|
+
* You can set this to `Infinity` although it would be more
|
13873
|
+
* advisable, for performance, to use the number you need in your code.
|
13874
|
+
*
|
13875
|
+
* Where:
|
13876
|
+
* levels=0 will only extract the properties of the current object
|
13877
|
+
* levels=1 will include any child blocks or assets on the current object
|
13878
|
+
* but not any grandchildren
|
13879
|
+
*
|
13880
|
+
* @default 1
|
13881
|
+
*/
|
13882
|
+
levels?: number;
|
13883
|
+
}
|
13884
|
+
/**
|
13885
|
+
* Get the data stored in the value of a component parameter
|
13886
|
+
* or a field attached to an Entry, Block or Asset
|
13887
|
+
*/
|
13888
|
+
declare function getPropertyValue<TValue, T extends ComponentParameter<TValue>>(parameter: T): TValue;
|
13889
|
+
declare function getPropertyValue(parameter: null): null;
|
13890
|
+
declare function getPropertyValue(parameter: undefined): undefined;
|
13891
|
+
type DataWithProperties = Pick<ComponentInstance, 'parameters'> | Pick<EntryData, 'fields'>;
|
13892
|
+
declare function flattenValues(data: null, options?: FlattenValuesOptions): null;
|
13893
|
+
declare function flattenValues(data: undefined, options?: FlattenValuesOptions): undefined;
|
13894
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Data | null | undefined, options?: FlattenValuesOptions): FlattenValues<Data> | null | undefined;
|
13895
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options: {
|
13896
|
+
toSingle: true;
|
13897
|
+
} & Omit<FlattenValuesOptions, 'toSingle'>): FlattenValues<Data> | null | undefined;
|
13898
|
+
declare function flattenValues<Data extends DataWithProperties>(data: Array<Data> | null | undefined, options?: FlattenValuesOptions): Array<FlattenValues<Data>> | null | undefined;
|
13899
|
+
|
13845
13900
|
type BindVariablesResult<TValue> = {
|
13846
13901
|
/** Number of dynamic expressions that attempted to be bound (regardless of the success of the binding) */
|
13847
13902
|
boundCount: number;
|
@@ -13901,4 +13956,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13901
13956
|
|
13902
13957
|
declare const CanvasClientError: typeof ApiClientError;
|
13903
13958
|
|
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 };
|
13959
|
+
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 DataWithProperties, 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 FlattenProperty, type FlattenValues, type FlattenValuesOptions, 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, flattenValues, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, getPropertyValue, 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
@@ -634,13 +634,15 @@ var unstable_CompositionRelationshipClient = class extends ApiClient3 {
|
|
634
634
|
super(options);
|
635
635
|
this.getDefinitionsRelationships = async ({
|
636
636
|
definitionIds,
|
637
|
-
withCompositions
|
637
|
+
withCompositions,
|
638
|
+
entityType = "composition"
|
638
639
|
}) => {
|
639
640
|
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
640
641
|
type: "definition",
|
641
642
|
projectId: this._options.projectId,
|
642
643
|
definitionIds: definitionIds.join(","),
|
643
|
-
withCompositions
|
644
|
+
withCompositions,
|
645
|
+
entityType
|
644
646
|
});
|
645
647
|
return this.apiClient(url);
|
646
648
|
};
|
@@ -1004,25 +1006,6 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1004
1006
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
1007
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1006
1008
|
|
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
|
-
|
1026
1009
|
// src/utils/guards.ts
|
1027
1010
|
function isRootEntryReference(root) {
|
1028
1011
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1039,6 +1022,41 @@ function isAssetParamValueItem(item) {
|
|
1039
1022
|
);
|
1040
1023
|
}
|
1041
1024
|
|
1025
|
+
// src/utils/properties.ts
|
1026
|
+
function getPropertiesValue(entity) {
|
1027
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1028
|
+
}
|
1029
|
+
function getPropertyValue(parameter) {
|
1030
|
+
return parameter ? parameter.value : parameter;
|
1031
|
+
}
|
1032
|
+
function flattenValues(data, options = {}) {
|
1033
|
+
if (!data) {
|
1034
|
+
return data;
|
1035
|
+
} else if (Array.isArray(data) && options.toSingle) {
|
1036
|
+
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1037
|
+
} else if (Array.isArray(data)) {
|
1038
|
+
return data.map((node) => flattenSingleNodeValues(node, options));
|
1039
|
+
} else {
|
1040
|
+
return flattenSingleNodeValues(data, options);
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
function flattenSingleNodeValues(data, options = {}) {
|
1044
|
+
const { levels = 1 } = options;
|
1045
|
+
const properties = getPropertiesValue(data);
|
1046
|
+
return properties ? Object.fromEntries(
|
1047
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1048
|
+
const value = getPropertyValue(parameter);
|
1049
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1050
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1051
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1052
|
+
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1053
|
+
} else {
|
1054
|
+
return [id, value];
|
1055
|
+
}
|
1056
|
+
})
|
1057
|
+
) : properties;
|
1058
|
+
}
|
1059
|
+
|
1042
1060
|
// src/enhancement/walkNodeTree.ts
|
1043
1061
|
function walkNodeTree(node, visitor, options) {
|
1044
1062
|
var _a, _b;
|
@@ -1261,7 +1279,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1261
1279
|
const propertyEntries = Object.entries(properties);
|
1262
1280
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1263
1281
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1264
|
-
if (propObject.type
|
1282
|
+
if (!isNestedNodeType(propObject.type))
|
1265
1283
|
continue;
|
1266
1284
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1267
1285
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1287,6 +1305,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1287
1305
|
}
|
1288
1306
|
} while (componentQueue.length > 0);
|
1289
1307
|
}
|
1308
|
+
function isNestedNodeType(type) {
|
1309
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1310
|
+
}
|
1290
1311
|
function getBlockValue(component, parameterName) {
|
1291
1312
|
var _a;
|
1292
1313
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2224,6 +2245,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2224
2245
|
};
|
2225
2246
|
};
|
2226
2247
|
|
2248
|
+
// src/utils/entryConverter.ts
|
2249
|
+
function convertEntryToPutEntry(entry) {
|
2250
|
+
return {
|
2251
|
+
entry: {
|
2252
|
+
type: entry.entry.type,
|
2253
|
+
_dataResources: entry.entry._dataResources,
|
2254
|
+
_id: entry.entry._id,
|
2255
|
+
_name: entry.entry._name,
|
2256
|
+
_slug: entry.entry._slug,
|
2257
|
+
fields: entry.entry.fields
|
2258
|
+
},
|
2259
|
+
state: entry.state,
|
2260
|
+
projectId: entry.projectId
|
2261
|
+
};
|
2262
|
+
}
|
2263
|
+
|
2227
2264
|
// src/utils/getParameterAttributes.ts
|
2228
2265
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2229
2266
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2571,6 +2608,7 @@ export {
|
|
2571
2608
|
enhance,
|
2572
2609
|
extractLocales,
|
2573
2610
|
findParameterInNodeTree,
|
2611
|
+
flattenValues,
|
2574
2612
|
generateComponentPlaceholderId,
|
2575
2613
|
generateHash,
|
2576
2614
|
getBlockValue,
|
@@ -2581,6 +2619,7 @@ export {
|
|
2581
2619
|
getNounForNode,
|
2582
2620
|
getParameterAttributes,
|
2583
2621
|
getPropertiesValue,
|
2622
|
+
getPropertyValue,
|
2584
2623
|
isAddComponentMessage,
|
2585
2624
|
isAllowedReferrer,
|
2586
2625
|
isAssetParamValue,
|
@@ -2590,6 +2629,7 @@ export {
|
|
2590
2629
|
isDismissPlaceholderMessage,
|
2591
2630
|
isEntryData,
|
2592
2631
|
isMovingComponentMessage,
|
2632
|
+
isNestedNodeType,
|
2593
2633
|
isOpenParameterEditorMessage,
|
2594
2634
|
isReadyMessage,
|
2595
2635
|
isReportRenderedCompositionsMessage,
|
package/dist/index.js
CHANGED
@@ -344,6 +344,7 @@ __export(src_exports, {
|
|
344
344
|
enhance: () => enhance,
|
345
345
|
extractLocales: () => extractLocales,
|
346
346
|
findParameterInNodeTree: () => findParameterInNodeTree,
|
347
|
+
flattenValues: () => flattenValues,
|
347
348
|
generateComponentPlaceholderId: () => generateComponentPlaceholderId,
|
348
349
|
generateHash: () => generateHash,
|
349
350
|
getBlockValue: () => getBlockValue,
|
@@ -354,6 +355,7 @@ __export(src_exports, {
|
|
354
355
|
getNounForNode: () => getNounForNode,
|
355
356
|
getParameterAttributes: () => getParameterAttributes,
|
356
357
|
getPropertiesValue: () => getPropertiesValue,
|
358
|
+
getPropertyValue: () => getPropertyValue,
|
357
359
|
isAddComponentMessage: () => isAddComponentMessage,
|
358
360
|
isAllowedReferrer: () => isAllowedReferrer,
|
359
361
|
isAssetParamValue: () => isAssetParamValue,
|
@@ -363,6 +365,7 @@ __export(src_exports, {
|
|
363
365
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
364
366
|
isEntryData: () => isEntryData,
|
365
367
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
368
|
+
isNestedNodeType: () => isNestedNodeType,
|
366
369
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
367
370
|
isReadyMessage: () => isReadyMessage,
|
368
371
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
@@ -756,13 +759,15 @@ var unstable_CompositionRelationshipClient = class extends import_api4.ApiClient
|
|
756
759
|
super(options);
|
757
760
|
this.getDefinitionsRelationships = async ({
|
758
761
|
definitionIds,
|
759
|
-
withCompositions
|
762
|
+
withCompositions,
|
763
|
+
entityType = "composition"
|
760
764
|
}) => {
|
761
765
|
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
762
766
|
type: "definition",
|
763
767
|
projectId: this._options.projectId,
|
764
768
|
definitionIds: definitionIds.join(","),
|
765
|
-
withCompositions
|
769
|
+
withCompositions,
|
770
|
+
entityType
|
766
771
|
});
|
767
772
|
return this.apiClient(url);
|
768
773
|
};
|
@@ -1126,25 +1131,6 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1126
1131
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1127
1132
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1128
1133
|
|
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
|
-
|
1148
1134
|
// src/utils/guards.ts
|
1149
1135
|
function isRootEntryReference(root) {
|
1150
1136
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1161,6 +1147,41 @@ function isAssetParamValueItem(item) {
|
|
1161
1147
|
);
|
1162
1148
|
}
|
1163
1149
|
|
1150
|
+
// src/utils/properties.ts
|
1151
|
+
function getPropertiesValue(entity) {
|
1152
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1153
|
+
}
|
1154
|
+
function getPropertyValue(parameter) {
|
1155
|
+
return parameter ? parameter.value : parameter;
|
1156
|
+
}
|
1157
|
+
function flattenValues(data, options = {}) {
|
1158
|
+
if (!data) {
|
1159
|
+
return data;
|
1160
|
+
} else if (Array.isArray(data) && options.toSingle) {
|
1161
|
+
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1162
|
+
} else if (Array.isArray(data)) {
|
1163
|
+
return data.map((node) => flattenSingleNodeValues(node, options));
|
1164
|
+
} else {
|
1165
|
+
return flattenSingleNodeValues(data, options);
|
1166
|
+
}
|
1167
|
+
}
|
1168
|
+
function flattenSingleNodeValues(data, options = {}) {
|
1169
|
+
const { levels = 1 } = options;
|
1170
|
+
const properties = getPropertiesValue(data);
|
1171
|
+
return properties ? Object.fromEntries(
|
1172
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1173
|
+
const value = getPropertyValue(parameter);
|
1174
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1175
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1176
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1177
|
+
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1178
|
+
} else {
|
1179
|
+
return [id, value];
|
1180
|
+
}
|
1181
|
+
})
|
1182
|
+
) : properties;
|
1183
|
+
}
|
1184
|
+
|
1164
1185
|
// src/enhancement/walkNodeTree.ts
|
1165
1186
|
function walkNodeTree(node, visitor, options) {
|
1166
1187
|
var _a, _b;
|
@@ -1383,7 +1404,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1383
1404
|
const propertyEntries = Object.entries(properties);
|
1384
1405
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1385
1406
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1386
|
-
if (propObject.type
|
1407
|
+
if (!isNestedNodeType(propObject.type))
|
1387
1408
|
continue;
|
1388
1409
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1389
1410
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1409,6 +1430,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1409
1430
|
}
|
1410
1431
|
} while (componentQueue.length > 0);
|
1411
1432
|
}
|
1433
|
+
function isNestedNodeType(type) {
|
1434
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1435
|
+
}
|
1412
1436
|
function getBlockValue(component, parameterName) {
|
1413
1437
|
var _a;
|
1414
1438
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2346,6 +2370,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2346
2370
|
};
|
2347
2371
|
};
|
2348
2372
|
|
2373
|
+
// src/utils/entryConverter.ts
|
2374
|
+
function convertEntryToPutEntry(entry) {
|
2375
|
+
return {
|
2376
|
+
entry: {
|
2377
|
+
type: entry.entry.type,
|
2378
|
+
_dataResources: entry.entry._dataResources,
|
2379
|
+
_id: entry.entry._id,
|
2380
|
+
_name: entry.entry._name,
|
2381
|
+
_slug: entry.entry._slug,
|
2382
|
+
fields: entry.entry.fields
|
2383
|
+
},
|
2384
|
+
state: entry.state,
|
2385
|
+
projectId: entry.projectId
|
2386
|
+
};
|
2387
|
+
}
|
2388
|
+
|
2349
2389
|
// src/utils/getParameterAttributes.ts
|
2350
2390
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2351
2391
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2694,6 +2734,7 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2694
2734
|
enhance,
|
2695
2735
|
extractLocales,
|
2696
2736
|
findParameterInNodeTree,
|
2737
|
+
flattenValues,
|
2697
2738
|
generateComponentPlaceholderId,
|
2698
2739
|
generateHash,
|
2699
2740
|
getBlockValue,
|
@@ -2704,6 +2745,7 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2704
2745
|
getNounForNode,
|
2705
2746
|
getParameterAttributes,
|
2706
2747
|
getPropertiesValue,
|
2748
|
+
getPropertyValue,
|
2707
2749
|
isAddComponentMessage,
|
2708
2750
|
isAllowedReferrer,
|
2709
2751
|
isAssetParamValue,
|
@@ -2713,6 +2755,7 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2713
2755
|
isDismissPlaceholderMessage,
|
2714
2756
|
isEntryData,
|
2715
2757
|
isMovingComponentMessage,
|
2758
|
+
isNestedNodeType,
|
2716
2759
|
isOpenParameterEditorMessage,
|
2717
2760
|
isReadyMessage,
|
2718
2761
|
isReportRenderedCompositionsMessage,
|
package/dist/index.mjs
CHANGED
@@ -634,13 +634,15 @@ var unstable_CompositionRelationshipClient = class extends ApiClient3 {
|
|
634
634
|
super(options);
|
635
635
|
this.getDefinitionsRelationships = async ({
|
636
636
|
definitionIds,
|
637
|
-
withCompositions
|
637
|
+
withCompositions,
|
638
|
+
entityType = "composition"
|
638
639
|
}) => {
|
639
640
|
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
640
641
|
type: "definition",
|
641
642
|
projectId: this._options.projectId,
|
642
643
|
definitionIds: definitionIds.join(","),
|
643
|
-
withCompositions
|
644
|
+
withCompositions,
|
645
|
+
entityType
|
644
646
|
});
|
645
647
|
return this.apiClient(url);
|
646
648
|
};
|
@@ -1004,25 +1006,6 @@ var ASSET_PARAMETER_TYPE = "asset";
|
|
1004
1006
|
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
1007
|
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1006
1008
|
|
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
|
-
|
1026
1009
|
// src/utils/guards.ts
|
1027
1010
|
function isRootEntryReference(root) {
|
1028
1011
|
return root.type === "root" && isEntryData(root.node);
|
@@ -1039,6 +1022,41 @@ function isAssetParamValueItem(item) {
|
|
1039
1022
|
);
|
1040
1023
|
}
|
1041
1024
|
|
1025
|
+
// src/utils/properties.ts
|
1026
|
+
function getPropertiesValue(entity) {
|
1027
|
+
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1028
|
+
}
|
1029
|
+
function getPropertyValue(parameter) {
|
1030
|
+
return parameter ? parameter.value : parameter;
|
1031
|
+
}
|
1032
|
+
function flattenValues(data, options = {}) {
|
1033
|
+
if (!data) {
|
1034
|
+
return data;
|
1035
|
+
} else if (Array.isArray(data) && options.toSingle) {
|
1036
|
+
return data.length > 0 ? flattenSingleNodeValues(data[0]) : void 0;
|
1037
|
+
} else if (Array.isArray(data)) {
|
1038
|
+
return data.map((node) => flattenSingleNodeValues(node, options));
|
1039
|
+
} else {
|
1040
|
+
return flattenSingleNodeValues(data, options);
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
function flattenSingleNodeValues(data, options = {}) {
|
1044
|
+
const { levels = 1 } = options;
|
1045
|
+
const properties = getPropertiesValue(data);
|
1046
|
+
return properties ? Object.fromEntries(
|
1047
|
+
Object.entries(properties).map(([id, parameter]) => {
|
1048
|
+
const value = getPropertyValue(parameter);
|
1049
|
+
if (levels > 0 && Array.isArray(value) && // In the future ASSET_PARAMETER_TYPE will be a nested data type
|
1050
|
+
(isNestedNodeType(parameter.type) || parameter.type === ASSET_PARAMETER_TYPE)) {
|
1051
|
+
const nestedOptions = { ...options, levels: levels - 1 };
|
1052
|
+
return [id, value.map((item) => flattenValues(item, nestedOptions))];
|
1053
|
+
} else {
|
1054
|
+
return [id, value];
|
1055
|
+
}
|
1056
|
+
})
|
1057
|
+
) : properties;
|
1058
|
+
}
|
1059
|
+
|
1042
1060
|
// src/enhancement/walkNodeTree.ts
|
1043
1061
|
function walkNodeTree(node, visitor, options) {
|
1044
1062
|
var _a, _b;
|
@@ -1261,7 +1279,7 @@ function walkNodeTree(node, visitor, options) {
|
|
1261
1279
|
const propertyEntries = Object.entries(properties);
|
1262
1280
|
for (let propIndex = propertyEntries.length - 1; propIndex >= 0; propIndex--) {
|
1263
1281
|
const [propKey, propObject] = propertyEntries[propIndex];
|
1264
|
-
if (propObject.type
|
1282
|
+
if (!isNestedNodeType(propObject.type))
|
1265
1283
|
continue;
|
1266
1284
|
const blocks = (_b = propObject.value) != null ? _b : [];
|
1267
1285
|
for (let blockIndex = blocks.length - 1; blockIndex >= 0; blockIndex--) {
|
@@ -1287,6 +1305,9 @@ function walkNodeTree(node, visitor, options) {
|
|
1287
1305
|
}
|
1288
1306
|
} while (componentQueue.length > 0);
|
1289
1307
|
}
|
1308
|
+
function isNestedNodeType(type) {
|
1309
|
+
return type === CANVAS_BLOCK_PARAM_TYPE;
|
1310
|
+
}
|
1290
1311
|
function getBlockValue(component, parameterName) {
|
1291
1312
|
var _a;
|
1292
1313
|
const parameter = (_a = getPropertiesValue(component)) == null ? void 0 : _a[parameterName];
|
@@ -2224,6 +2245,22 @@ var createUniformApiEnhancer = ({ apiUrl }) => {
|
|
2224
2245
|
};
|
2225
2246
|
};
|
2226
2247
|
|
2248
|
+
// src/utils/entryConverter.ts
|
2249
|
+
function convertEntryToPutEntry(entry) {
|
2250
|
+
return {
|
2251
|
+
entry: {
|
2252
|
+
type: entry.entry.type,
|
2253
|
+
_dataResources: entry.entry._dataResources,
|
2254
|
+
_id: entry.entry._id,
|
2255
|
+
_name: entry.entry._name,
|
2256
|
+
_slug: entry.entry._slug,
|
2257
|
+
fields: entry.entry.fields
|
2258
|
+
},
|
2259
|
+
state: entry.state,
|
2260
|
+
projectId: entry.projectId
|
2261
|
+
};
|
2262
|
+
}
|
2263
|
+
|
2227
2264
|
// src/utils/getParameterAttributes.ts
|
2228
2265
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
2229
2266
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
@@ -2571,6 +2608,7 @@ export {
|
|
2571
2608
|
enhance,
|
2572
2609
|
extractLocales,
|
2573
2610
|
findParameterInNodeTree,
|
2611
|
+
flattenValues,
|
2574
2612
|
generateComponentPlaceholderId,
|
2575
2613
|
generateHash,
|
2576
2614
|
getBlockValue,
|
@@ -2581,6 +2619,7 @@ export {
|
|
2581
2619
|
getNounForNode,
|
2582
2620
|
getParameterAttributes,
|
2583
2621
|
getPropertiesValue,
|
2622
|
+
getPropertyValue,
|
2584
2623
|
isAddComponentMessage,
|
2585
2624
|
isAllowedReferrer,
|
2586
2625
|
isAssetParamValue,
|
@@ -2590,6 +2629,7 @@ export {
|
|
2590
2629
|
isDismissPlaceholderMessage,
|
2591
2630
|
isEntryData,
|
2592
2631
|
isMovingComponentMessage,
|
2632
|
+
isNestedNodeType,
|
2593
2633
|
isOpenParameterEditorMessage,
|
2594
2634
|
isReadyMessage,
|
2595
2635
|
isReportRenderedCompositionsMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.80.1-alpha.
|
3
|
+
"version": "19.80.1-alpha.170+07c5014817",
|
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.80.1-alpha.
|
42
|
-
"@uniformdev/context": "19.80.1-alpha.
|
41
|
+
"@uniformdev/assets": "19.80.1-alpha.170+07c5014817",
|
42
|
+
"@uniformdev/context": "19.80.1-alpha.170+07c5014817",
|
43
43
|
"immer": "10.0.3"
|
44
44
|
},
|
45
45
|
"files": [
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "07c5014817c7acefceb653dc48d26a3b53341c1e"
|
52
52
|
}
|