@uniformdev/canvas 19.78.1 → 19.79.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 +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.esm.js +97 -78
- package/dist/index.js +99 -78
- package/dist/index.mjs +97 -78
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
@@ -2829,6 +2829,12 @@ interface paths$a {
|
|
2829
2829
|
withComponentIDs?: components$3["parameters"]["withComponentIDs"];
|
2830
2830
|
/** Performs keyword search on the entries. */
|
2831
2831
|
keyword?: components$3["parameters"]["keyword"];
|
2832
|
+
/**
|
2833
|
+
* If true, any pattern override data is not resolved by the API.
|
2834
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
2835
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
2836
|
+
*/
|
2837
|
+
skipOverridesResolution?: components$3["parameters"]["skipOverridesResolution"];
|
2832
2838
|
};
|
2833
2839
|
};
|
2834
2840
|
responses: {
|
@@ -3044,6 +3050,12 @@ interface components$3 {
|
|
3044
3050
|
withTotalCount: boolean;
|
3045
3051
|
/** @description Performs keyword search on the entries. */
|
3046
3052
|
keyword: string;
|
3053
|
+
/**
|
3054
|
+
* @description If true, any pattern override data is not resolved by the API.
|
3055
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
3056
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
3057
|
+
*/
|
3058
|
+
skipOverridesResolution: boolean;
|
3047
3059
|
};
|
3048
3060
|
}
|
3049
3061
|
interface external$b {
|
@@ -8824,7 +8836,7 @@ interface components$1 {
|
|
8824
8836
|
} & external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["schemas"]["EntryListResponse"];
|
8825
8837
|
EdgehancersResolutionInfo: {
|
8826
8838
|
diagnostics?: components$1["schemas"]["EdgehancersDiagnostics"] & {
|
8827
|
-
[
|
8839
|
+
data?: components$1["schemas"]["DataDiagnostic"][];
|
8828
8840
|
};
|
8829
8841
|
errors?: components$1["schemas"]["DataResolutionIssue"][];
|
8830
8842
|
warnings?: components$1["schemas"]["DataResolutionIssue"][];
|
@@ -10092,6 +10104,12 @@ interface external$3 {
|
|
10092
10104
|
withComponentIDs?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["withComponentIDs"];
|
10093
10105
|
/** Performs keyword search on the entries. */
|
10094
10106
|
keyword?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["keyword"];
|
10107
|
+
/**
|
10108
|
+
* If true, any pattern override data is not resolved by the API.
|
10109
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
10110
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
10111
|
+
*/
|
10112
|
+
skipOverridesResolution?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["skipOverridesResolution"];
|
10095
10113
|
};
|
10096
10114
|
};
|
10097
10115
|
responses: {
|
@@ -10307,6 +10325,12 @@ interface external$3 {
|
|
10307
10325
|
withTotalCount: boolean;
|
10308
10326
|
/** @description Performs keyword search on the entries. */
|
10309
10327
|
keyword: string;
|
10328
|
+
/**
|
10329
|
+
* @description If true, any pattern override data is not resolved by the API.
|
10330
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
10331
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
10332
|
+
*/
|
10333
|
+
skipOverridesResolution: boolean;
|
10310
10334
|
};
|
10311
10335
|
};
|
10312
10336
|
operations: {};
|
@@ -13163,7 +13187,11 @@ type RootLocationReference = {
|
|
13163
13187
|
type: 'root';
|
13164
13188
|
node: ComponentInstance;
|
13165
13189
|
};
|
13166
|
-
type
|
13190
|
+
type RootEntryReference = {
|
13191
|
+
type: 'root';
|
13192
|
+
node: EntryData;
|
13193
|
+
};
|
13194
|
+
type NodeLocationReference = ComponentLocationReferenceV2 | BlockLocationReference | RootLocationReference | RootEntryReference;
|
13167
13195
|
type WalkNodeTreeActions<TContext, TNodeType> = {
|
13168
13196
|
/** Replaces the node being visited with a new object */
|
13169
13197
|
replace: (replacement: TNodeType) => void;
|
@@ -13657,6 +13685,17 @@ type GetParameterAttributesProps = {
|
|
13657
13685
|
*/
|
13658
13686
|
declare const getParameterAttributes: ({ id, component, placeholder, isMultiline, }: GetParameterAttributesProps) => Record<string, string | boolean | undefined>;
|
13659
13687
|
|
13688
|
+
/**
|
13689
|
+
* When walking a node tree, is the node the root node
|
13690
|
+
* and look like Entry data
|
13691
|
+
*/
|
13692
|
+
declare function isRootEntryReference(root: NodeLocationReference): root is RootEntryReference;
|
13693
|
+
/**
|
13694
|
+
* Check to see if some generic composition data structure
|
13695
|
+
* looks like Entry data
|
13696
|
+
*/
|
13697
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13698
|
+
|
13660
13699
|
declare const generateHash: ({ composition, secret, }: {
|
13661
13700
|
composition: RootComponentInstance;
|
13662
13701
|
secret: string | undefined;
|
@@ -13745,4 +13784,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13745
13784
|
|
13746
13785
|
declare const CanvasClientError: typeof ApiClientError;
|
13747
13786
|
|
13748
|
-
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
13787
|
+
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.d.ts
CHANGED
@@ -2829,6 +2829,12 @@ interface paths$a {
|
|
2829
2829
|
withComponentIDs?: components$3["parameters"]["withComponentIDs"];
|
2830
2830
|
/** Performs keyword search on the entries. */
|
2831
2831
|
keyword?: components$3["parameters"]["keyword"];
|
2832
|
+
/**
|
2833
|
+
* If true, any pattern override data is not resolved by the API.
|
2834
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
2835
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
2836
|
+
*/
|
2837
|
+
skipOverridesResolution?: components$3["parameters"]["skipOverridesResolution"];
|
2832
2838
|
};
|
2833
2839
|
};
|
2834
2840
|
responses: {
|
@@ -3044,6 +3050,12 @@ interface components$3 {
|
|
3044
3050
|
withTotalCount: boolean;
|
3045
3051
|
/** @description Performs keyword search on the entries. */
|
3046
3052
|
keyword: string;
|
3053
|
+
/**
|
3054
|
+
* @description If true, any pattern override data is not resolved by the API.
|
3055
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
3056
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
3057
|
+
*/
|
3058
|
+
skipOverridesResolution: boolean;
|
3047
3059
|
};
|
3048
3060
|
}
|
3049
3061
|
interface external$b {
|
@@ -8824,7 +8836,7 @@ interface components$1 {
|
|
8824
8836
|
} & external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["schemas"]["EntryListResponse"];
|
8825
8837
|
EdgehancersResolutionInfo: {
|
8826
8838
|
diagnostics?: components$1["schemas"]["EdgehancersDiagnostics"] & {
|
8827
|
-
[
|
8839
|
+
data?: components$1["schemas"]["DataDiagnostic"][];
|
8828
8840
|
};
|
8829
8841
|
errors?: components$1["schemas"]["DataResolutionIssue"][];
|
8830
8842
|
warnings?: components$1["schemas"]["DataResolutionIssue"][];
|
@@ -10092,6 +10104,12 @@ interface external$3 {
|
|
10092
10104
|
withComponentIDs?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["withComponentIDs"];
|
10093
10105
|
/** Performs keyword search on the entries. */
|
10094
10106
|
keyword?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["keyword"];
|
10107
|
+
/**
|
10108
|
+
* If true, any pattern override data is not resolved by the API.
|
10109
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
10110
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
10111
|
+
*/
|
10112
|
+
skipOverridesResolution?: external$3["../../../lambda/functions/v1-entries.swagger.yml"]["components"]["parameters"]["skipOverridesResolution"];
|
10095
10113
|
};
|
10096
10114
|
};
|
10097
10115
|
responses: {
|
@@ -10307,6 +10325,12 @@ interface external$3 {
|
|
10307
10325
|
withTotalCount: boolean;
|
10308
10326
|
/** @description Performs keyword search on the entries. */
|
10309
10327
|
keyword: string;
|
10328
|
+
/**
|
10329
|
+
* @description If true, any pattern override data is not resolved by the API.
|
10330
|
+
* This is intended for internal use in the Canvas editor, and should not be used.
|
10331
|
+
* Passing this parameter automatically implies withComponentIDs to be true.
|
10332
|
+
*/
|
10333
|
+
skipOverridesResolution: boolean;
|
10310
10334
|
};
|
10311
10335
|
};
|
10312
10336
|
operations: {};
|
@@ -13163,7 +13187,11 @@ type RootLocationReference = {
|
|
13163
13187
|
type: 'root';
|
13164
13188
|
node: ComponentInstance;
|
13165
13189
|
};
|
13166
|
-
type
|
13190
|
+
type RootEntryReference = {
|
13191
|
+
type: 'root';
|
13192
|
+
node: EntryData;
|
13193
|
+
};
|
13194
|
+
type NodeLocationReference = ComponentLocationReferenceV2 | BlockLocationReference | RootLocationReference | RootEntryReference;
|
13167
13195
|
type WalkNodeTreeActions<TContext, TNodeType> = {
|
13168
13196
|
/** Replaces the node being visited with a new object */
|
13169
13197
|
replace: (replacement: TNodeType) => void;
|
@@ -13657,6 +13685,17 @@ type GetParameterAttributesProps = {
|
|
13657
13685
|
*/
|
13658
13686
|
declare const getParameterAttributes: ({ id, component, placeholder, isMultiline, }: GetParameterAttributesProps) => Record<string, string | boolean | undefined>;
|
13659
13687
|
|
13688
|
+
/**
|
13689
|
+
* When walking a node tree, is the node the root node
|
13690
|
+
* and look like Entry data
|
13691
|
+
*/
|
13692
|
+
declare function isRootEntryReference(root: NodeLocationReference): root is RootEntryReference;
|
13693
|
+
/**
|
13694
|
+
* Check to see if some generic composition data structure
|
13695
|
+
* looks like Entry data
|
13696
|
+
*/
|
13697
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13698
|
+
|
13660
13699
|
declare const generateHash: ({ composition, secret, }: {
|
13661
13700
|
composition: RootComponentInstance;
|
13662
13701
|
secret: string | undefined;
|
@@ -13745,4 +13784,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13745
13784
|
|
13746
13785
|
declare const CanvasClientError: typeof ApiClientError;
|
13747
13786
|
|
13748
|
-
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
13787
|
+
export { ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, AddComponentMessage, BatchEnhancer, BatchEntry, BatchInvalidationPayload, BindVariablesOptions, BindVariablesResult, BindVariablesToObjectOptions, BlockLocationReference, BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, CanvasDefinitions, CategoriesDeleteParameters, CategoriesGetParameters, CategoriesGetResponse, CategoriesPutParameters, Category, CategoryClient, Channel, ChannelMessage, ChannelSubscription, ChildEnhancerBuilder, ComponentDefinition, ComponentDefinitionDeleteParameters, ComponentDefinitionGetParameters, ComponentDefinitionGetResponse, ComponentDefinitionParameter, ComponentDefinitionPermission, ComponentDefinitionPutParameters, ComponentDefinitionSlot, ComponentDefinitionSlugSettings, ComponentDefinitionVariant, ComponentEnhancer, ComponentEnhancerFunction, ComponentEnhancerOptions, ComponentInstance, ComponentInstanceContextualEditing, ComponentInstanceHistoryEntry, ComponentInstanceHistoryGetParameters, ComponentInstanceHistoryGetResponse, ComponentLocationReference, ComponentLocationReferenceV2, ComponentOverridability, ComponentOverride, ComponentOverrides, ComponentParameter, ComponentParameterBlock, ComponentParameterContextualEditing, ComponentParameterEnhancer, ComponentParameterEnhancerFunction, ComponentParameterEnhancerOptions, CompositionDataDiagnostic, CompositionDeleteParameters, CompositionDiagnostics, CompositionGetByComponentIdParameters, CompositionGetByIdParameters, CompositionGetByNodeIdParameters, CompositionGetByNodePathParameters, CompositionGetBySlugParameters, CompositionGetListResponse, CompositionGetOrderBy, CompositionGetParameters, CompositionGetResponse, CompositionGetValidResponses, CompositionIssue, CompositionPatternIssue, CompositionPutParameters, CompositionRelationshipsClientOptions, CompositionRelationshipsDDefinitionGetResponse, CompositionRelationshipsDefinitionApi, CompositionRelationshipsDefinitionGetParameters, CompositionResolvedGetResponse, CompositionResolvedListResponse, CompositionUIStatus, ContentClient, ContentType, ContentTypeField, ContextualEditingComponentReference, DataDiagnostic, DataElementBindingIssue, DataElementConnectionDefinition, DataResolutionConfigIssue, DataResolutionIssue, DataResolutionOption, DataResolutionOptionNegative, DataResolutionOptionPositive, DataResolutionParameters, DataResourceDefinition, DataResourceDefinitions, DataResourceIssue, DataResourceVariables, DataSource, DataSourceClient, DataSourceDeleteParameters, DataSourceGetParameters, DataSourceGetResponse, DataSourcePutParameters, DataSourcesGetParameters, DataSourcesGetResponse, DataType, DataTypeClient, DataTypeDeleteParameters, DataTypeGetParameters, DataTypeGetResponse, DataTypePutParameters, DataVariableDefinition, DeleteContentTypeOptions, DeleteEntryOptions, DismissPlaceholderMessage, DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, EdgehancersDiagnostics, EditorStateUpdatedMessage, EnhancerBuilder, EnhancerContext, EnhancerError, EntriesGetParameters, EntriesGetResponse, EntriesHistoryGetParameters, EntriesHistoryGetResponse, EntriesResolvedListResponse, Entry, EntryData, EventNames, GetContentTypesOptions, GetContentTypesResponse, GetEntriesOptions, GetEntriesResponse, GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, InvalidationPayload, LimitPolicy, LinkComponentParameterValue, LinkParamConfiguration, LinkParamValue, LinkParameterType, LinkTypeConfiguration, MessageHandler, MoveComponentMessage, NodeLocationReference, NonProjectMapLinkParamValue, OpenParameterEditorMessage, OverrideOptions, PLACEHOLDER_ID, PatternIssue, PreviewEventBus, PreviewPanelSettings, ProjectMapLinkComponentParameterValue, ProjectMapLinkParamValue, Prompt, PromptClient, PromptsDeleteParameters, PromptsGetParameters, PromptsGetResponse, PromptsPutParameters, PutContentTypeBody, PutEntryBody, ReadyMessage, ReportRenderedCompositionsMessage, ResolvedRouteGetResponse, RichTextBuiltInElement, RichTextBuiltInFormat, RichTextParamConfiguration, RichTextParamValue, RootComponentInstance, RootEntryReference, RootLocationReference, RouteClient, RouteDynamicInputs, RouteGetParameters, RouteGetResponse, RouteGetResponseComposition, RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, SelectComponentMessage, SelectParameterMessage, SpecificProjectMap, SubscribeToCompositionOptions, TreeNodeInfoTypes, TriggerComponentActionMessage, TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, UnsubscribeCallback, UpdateComponentParameterMessage, UpdateComponentReferencesMessage, UpdateCompositionInternalMessage, UpdateCompositionMessage, UpdateContextualEditingStateInternalMessage, UpdateFeatureFlagsMessage, UpdatePreviewSettingsMessage, UsageTrackingApi, UsageTrackingGetParameters, UsageTrackingGetResponse, UsageTrackingPostParameters, UsageTrackingPostResponse, WalkComponentTreeActions, WalkNodeTreeActions, WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.esm.js
CHANGED
@@ -1020,6 +1020,14 @@ function getPropertiesValue(entity) {
|
|
1020
1020
|
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1021
1021
|
}
|
1022
1022
|
|
1023
|
+
// src/utils/guards.ts
|
1024
|
+
function isRootEntryReference(root) {
|
1025
|
+
return root.type === "root" && isEntryData(root.node);
|
1026
|
+
}
|
1027
|
+
function isEntryData(entryData) {
|
1028
|
+
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
|
+
}
|
1030
|
+
|
1023
1031
|
// src/enhancement/walkNodeTree.ts
|
1024
1032
|
function walkNodeTree(node, visitor, options) {
|
1025
1033
|
var _a, _b;
|
@@ -1038,7 +1046,83 @@ function walkNodeTree(node, visitor, options) {
|
|
1038
1046
|
let visitDescendants = true;
|
1039
1047
|
let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
|
1040
1048
|
let visitorInfo;
|
1041
|
-
if (currentComponent.type === "root" || currentComponent.type === "
|
1049
|
+
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
1050
|
+
visitorInfo = {
|
1051
|
+
type: "entry",
|
1052
|
+
node: currentComponent.node,
|
1053
|
+
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1054
|
+
actions: {
|
1055
|
+
replace: (replacementNode) => {
|
1056
|
+
Object.assign(currentComponent.node, replacementNode);
|
1057
|
+
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1058
|
+
propertiesToCheck.forEach((property) => {
|
1059
|
+
if (!replacementNode[property]) {
|
1060
|
+
delete currentComponent.node[property];
|
1061
|
+
}
|
1062
|
+
});
|
1063
|
+
},
|
1064
|
+
remove: () => {
|
1065
|
+
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1066
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1067
|
+
if (currentComponentLocation.type === "block") {
|
1068
|
+
const { fieldName, blockIndex } = currentComponentLocation;
|
1069
|
+
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1070
|
+
blockValue.splice(blockIndex, 1);
|
1071
|
+
if (blockValue.length === 0) {
|
1072
|
+
const properties2 = getPropertiesValue(parentComponent.node);
|
1073
|
+
delete properties2[fieldName];
|
1074
|
+
}
|
1075
|
+
} else {
|
1076
|
+
throw new Error("Unknown node type");
|
1077
|
+
}
|
1078
|
+
},
|
1079
|
+
insertAfter: (nodes) => {
|
1080
|
+
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1081
|
+
if (currentNodeInfo.type !== "block") {
|
1082
|
+
throw new Error("Unknown type");
|
1083
|
+
}
|
1084
|
+
const { fieldName, blockIndex } = currentNodeInfo;
|
1085
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1086
|
+
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1087
|
+
if (fieldName && typeof blockIndex !== "undefined") {
|
1088
|
+
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1089
|
+
blockIndex + 1,
|
1090
|
+
0,
|
1091
|
+
...nodesToInsert
|
1092
|
+
);
|
1093
|
+
componentQueue.unshift(
|
1094
|
+
...nodesToInsert.map((enqueueingComponent) => ({
|
1095
|
+
ancestorsAndSelf: [
|
1096
|
+
{
|
1097
|
+
type: "block",
|
1098
|
+
node: enqueueingComponent,
|
1099
|
+
fieldName,
|
1100
|
+
get blockIndex() {
|
1101
|
+
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1102
|
+
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1103
|
+
}
|
1104
|
+
},
|
1105
|
+
// slice removes 'self' since we are inserting a peer of self
|
1106
|
+
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1107
|
+
],
|
1108
|
+
context: descendantContext
|
1109
|
+
}))
|
1110
|
+
);
|
1111
|
+
}
|
1112
|
+
},
|
1113
|
+
stopProcessingDescendants() {
|
1114
|
+
visitDescendants = false;
|
1115
|
+
},
|
1116
|
+
setDescendantsContext(context) {
|
1117
|
+
descendantContext = context;
|
1118
|
+
},
|
1119
|
+
setChildContext(child, context) {
|
1120
|
+
childContexts.set(child, context);
|
1121
|
+
}
|
1122
|
+
},
|
1123
|
+
context: descendantContext
|
1124
|
+
};
|
1125
|
+
} else {
|
1042
1126
|
visitorInfo = {
|
1043
1127
|
type: "component",
|
1044
1128
|
node: currentComponent.node,
|
@@ -1129,82 +1213,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1129
1213
|
},
|
1130
1214
|
context: descendantContext
|
1131
1215
|
};
|
1132
|
-
} else {
|
1133
|
-
visitorInfo = {
|
1134
|
-
type: "entry",
|
1135
|
-
node: currentComponent.node,
|
1136
|
-
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1137
|
-
actions: {
|
1138
|
-
replace: (replacementNode) => {
|
1139
|
-
Object.assign(currentComponent.node, replacementNode);
|
1140
|
-
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1141
|
-
propertiesToCheck.forEach((property) => {
|
1142
|
-
if (!replacementNode[property]) {
|
1143
|
-
delete currentComponent.node[property];
|
1144
|
-
}
|
1145
|
-
});
|
1146
|
-
},
|
1147
|
-
remove: () => {
|
1148
|
-
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1149
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1150
|
-
if (currentComponentLocation.type === "block") {
|
1151
|
-
const { fieldName, blockIndex } = currentComponentLocation;
|
1152
|
-
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1153
|
-
blockValue.splice(blockIndex, 1);
|
1154
|
-
if (blockValue.length === 0) {
|
1155
|
-
const properties2 = getPropertiesValue(parentComponent.node);
|
1156
|
-
delete properties2[fieldName];
|
1157
|
-
}
|
1158
|
-
} else {
|
1159
|
-
throw new Error("Unknown node type");
|
1160
|
-
}
|
1161
|
-
},
|
1162
|
-
insertAfter: (nodes) => {
|
1163
|
-
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1164
|
-
if (currentNodeInfo.type !== "block") {
|
1165
|
-
throw new Error("Unknown type");
|
1166
|
-
}
|
1167
|
-
const { fieldName, blockIndex } = currentNodeInfo;
|
1168
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1169
|
-
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1170
|
-
if (fieldName && typeof blockIndex !== "undefined") {
|
1171
|
-
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1172
|
-
blockIndex + 1,
|
1173
|
-
0,
|
1174
|
-
...nodesToInsert
|
1175
|
-
);
|
1176
|
-
componentQueue.unshift(
|
1177
|
-
...nodesToInsert.map((enqueueingComponent) => ({
|
1178
|
-
ancestorsAndSelf: [
|
1179
|
-
{
|
1180
|
-
type: "block",
|
1181
|
-
node: enqueueingComponent,
|
1182
|
-
fieldName,
|
1183
|
-
get blockIndex() {
|
1184
|
-
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1185
|
-
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1186
|
-
}
|
1187
|
-
},
|
1188
|
-
// slice removes 'self' since we are inserting a peer of self
|
1189
|
-
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1190
|
-
],
|
1191
|
-
context: descendantContext
|
1192
|
-
}))
|
1193
|
-
);
|
1194
|
-
}
|
1195
|
-
},
|
1196
|
-
stopProcessingDescendants() {
|
1197
|
-
visitDescendants = false;
|
1198
|
-
},
|
1199
|
-
setDescendantsContext(context) {
|
1200
|
-
descendantContext = context;
|
1201
|
-
},
|
1202
|
-
setChildContext(child, context) {
|
1203
|
-
childContexts.set(child, context);
|
1204
|
-
}
|
1205
|
-
},
|
1206
|
-
context: descendantContext
|
1207
|
-
};
|
1208
1216
|
}
|
1209
1217
|
visitor(visitorInfo);
|
1210
1218
|
if (!visitDescendants) {
|
@@ -1536,7 +1544,7 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1536
1544
|
if (currentLocation.type === "block") {
|
1537
1545
|
const { fieldName: parameterName, blockIndex } = currentLocation;
|
1538
1546
|
if (parameterName && blockIndex !== void 0) {
|
1539
|
-
const noun = parentLocation
|
1547
|
+
const noun = getNounForLocation(parentLocation);
|
1540
1548
|
path.push(`${noun}/${parameterName}/value/${blockIndex}`);
|
1541
1549
|
}
|
1542
1550
|
} else {
|
@@ -1550,6 +1558,15 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1550
1558
|
}
|
1551
1559
|
return `/${path.join("/")}`;
|
1552
1560
|
}
|
1561
|
+
function getNounForLocation(parentLocation) {
|
1562
|
+
let noun = "parameters";
|
1563
|
+
if (parentLocation && "type" in parentLocation) {
|
1564
|
+
if (parentLocation.type === "block" || isRootEntryReference(parentLocation)) {
|
1565
|
+
noun = "fields";
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
return noun;
|
1569
|
+
}
|
1553
1570
|
|
1554
1571
|
// src/enhancement/localize.ts
|
1555
1572
|
function extractLocales({ component }) {
|
@@ -2522,10 +2539,12 @@ export {
|
|
2522
2539
|
isComponentActionMessage,
|
2523
2540
|
isComponentPlaceholderId,
|
2524
2541
|
isDismissPlaceholderMessage,
|
2542
|
+
isEntryData,
|
2525
2543
|
isMovingComponentMessage,
|
2526
2544
|
isOpenParameterEditorMessage,
|
2527
2545
|
isReadyMessage,
|
2528
2546
|
isReportRenderedCompositionsMessage,
|
2547
|
+
isRootEntryReference,
|
2529
2548
|
isSelectComponentMessage,
|
2530
2549
|
isSelectParameterMessage,
|
2531
2550
|
isSystemComponentDefinition,
|
package/dist/index.js
CHANGED
@@ -353,10 +353,12 @@ __export(src_exports, {
|
|
353
353
|
isComponentActionMessage: () => isComponentActionMessage,
|
354
354
|
isComponentPlaceholderId: () => isComponentPlaceholderId,
|
355
355
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
356
|
+
isEntryData: () => isEntryData,
|
356
357
|
isMovingComponentMessage: () => isMovingComponentMessage,
|
357
358
|
isOpenParameterEditorMessage: () => isOpenParameterEditorMessage,
|
358
359
|
isReadyMessage: () => isReadyMessage,
|
359
360
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
361
|
+
isRootEntryReference: () => isRootEntryReference,
|
360
362
|
isSelectComponentMessage: () => isSelectComponentMessage,
|
361
363
|
isSelectParameterMessage: () => isSelectParameterMessage,
|
362
364
|
isSystemComponentDefinition: () => isSystemComponentDefinition,
|
@@ -1132,6 +1134,14 @@ function getPropertiesValue(entity) {
|
|
1132
1134
|
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1133
1135
|
}
|
1134
1136
|
|
1137
|
+
// src/utils/guards.ts
|
1138
|
+
function isRootEntryReference(root) {
|
1139
|
+
return root.type === "root" && isEntryData(root.node);
|
1140
|
+
}
|
1141
|
+
function isEntryData(entryData) {
|
1142
|
+
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1143
|
+
}
|
1144
|
+
|
1135
1145
|
// src/enhancement/walkNodeTree.ts
|
1136
1146
|
function walkNodeTree(node, visitor, options) {
|
1137
1147
|
var _a, _b;
|
@@ -1150,7 +1160,83 @@ function walkNodeTree(node, visitor, options) {
|
|
1150
1160
|
let visitDescendants = true;
|
1151
1161
|
let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
|
1152
1162
|
let visitorInfo;
|
1153
|
-
if (currentComponent.type === "root" || currentComponent.type === "
|
1163
|
+
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
1164
|
+
visitorInfo = {
|
1165
|
+
type: "entry",
|
1166
|
+
node: currentComponent.node,
|
1167
|
+
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1168
|
+
actions: {
|
1169
|
+
replace: (replacementNode) => {
|
1170
|
+
Object.assign(currentComponent.node, replacementNode);
|
1171
|
+
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1172
|
+
propertiesToCheck.forEach((property) => {
|
1173
|
+
if (!replacementNode[property]) {
|
1174
|
+
delete currentComponent.node[property];
|
1175
|
+
}
|
1176
|
+
});
|
1177
|
+
},
|
1178
|
+
remove: () => {
|
1179
|
+
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1180
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1181
|
+
if (currentComponentLocation.type === "block") {
|
1182
|
+
const { fieldName, blockIndex } = currentComponentLocation;
|
1183
|
+
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1184
|
+
blockValue.splice(blockIndex, 1);
|
1185
|
+
if (blockValue.length === 0) {
|
1186
|
+
const properties2 = getPropertiesValue(parentComponent.node);
|
1187
|
+
delete properties2[fieldName];
|
1188
|
+
}
|
1189
|
+
} else {
|
1190
|
+
throw new Error("Unknown node type");
|
1191
|
+
}
|
1192
|
+
},
|
1193
|
+
insertAfter: (nodes) => {
|
1194
|
+
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1195
|
+
if (currentNodeInfo.type !== "block") {
|
1196
|
+
throw new Error("Unknown type");
|
1197
|
+
}
|
1198
|
+
const { fieldName, blockIndex } = currentNodeInfo;
|
1199
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1200
|
+
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1201
|
+
if (fieldName && typeof blockIndex !== "undefined") {
|
1202
|
+
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1203
|
+
blockIndex + 1,
|
1204
|
+
0,
|
1205
|
+
...nodesToInsert
|
1206
|
+
);
|
1207
|
+
componentQueue.unshift(
|
1208
|
+
...nodesToInsert.map((enqueueingComponent) => ({
|
1209
|
+
ancestorsAndSelf: [
|
1210
|
+
{
|
1211
|
+
type: "block",
|
1212
|
+
node: enqueueingComponent,
|
1213
|
+
fieldName,
|
1214
|
+
get blockIndex() {
|
1215
|
+
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1216
|
+
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1217
|
+
}
|
1218
|
+
},
|
1219
|
+
// slice removes 'self' since we are inserting a peer of self
|
1220
|
+
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1221
|
+
],
|
1222
|
+
context: descendantContext
|
1223
|
+
}))
|
1224
|
+
);
|
1225
|
+
}
|
1226
|
+
},
|
1227
|
+
stopProcessingDescendants() {
|
1228
|
+
visitDescendants = false;
|
1229
|
+
},
|
1230
|
+
setDescendantsContext(context) {
|
1231
|
+
descendantContext = context;
|
1232
|
+
},
|
1233
|
+
setChildContext(child, context) {
|
1234
|
+
childContexts.set(child, context);
|
1235
|
+
}
|
1236
|
+
},
|
1237
|
+
context: descendantContext
|
1238
|
+
};
|
1239
|
+
} else {
|
1154
1240
|
visitorInfo = {
|
1155
1241
|
type: "component",
|
1156
1242
|
node: currentComponent.node,
|
@@ -1241,82 +1327,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1241
1327
|
},
|
1242
1328
|
context: descendantContext
|
1243
1329
|
};
|
1244
|
-
} else {
|
1245
|
-
visitorInfo = {
|
1246
|
-
type: "entry",
|
1247
|
-
node: currentComponent.node,
|
1248
|
-
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1249
|
-
actions: {
|
1250
|
-
replace: (replacementNode) => {
|
1251
|
-
Object.assign(currentComponent.node, replacementNode);
|
1252
|
-
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1253
|
-
propertiesToCheck.forEach((property) => {
|
1254
|
-
if (!replacementNode[property]) {
|
1255
|
-
delete currentComponent.node[property];
|
1256
|
-
}
|
1257
|
-
});
|
1258
|
-
},
|
1259
|
-
remove: () => {
|
1260
|
-
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1261
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1262
|
-
if (currentComponentLocation.type === "block") {
|
1263
|
-
const { fieldName, blockIndex } = currentComponentLocation;
|
1264
|
-
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1265
|
-
blockValue.splice(blockIndex, 1);
|
1266
|
-
if (blockValue.length === 0) {
|
1267
|
-
const properties2 = getPropertiesValue(parentComponent.node);
|
1268
|
-
delete properties2[fieldName];
|
1269
|
-
}
|
1270
|
-
} else {
|
1271
|
-
throw new Error("Unknown node type");
|
1272
|
-
}
|
1273
|
-
},
|
1274
|
-
insertAfter: (nodes) => {
|
1275
|
-
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1276
|
-
if (currentNodeInfo.type !== "block") {
|
1277
|
-
throw new Error("Unknown type");
|
1278
|
-
}
|
1279
|
-
const { fieldName, blockIndex } = currentNodeInfo;
|
1280
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1281
|
-
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1282
|
-
if (fieldName && typeof blockIndex !== "undefined") {
|
1283
|
-
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1284
|
-
blockIndex + 1,
|
1285
|
-
0,
|
1286
|
-
...nodesToInsert
|
1287
|
-
);
|
1288
|
-
componentQueue.unshift(
|
1289
|
-
...nodesToInsert.map((enqueueingComponent) => ({
|
1290
|
-
ancestorsAndSelf: [
|
1291
|
-
{
|
1292
|
-
type: "block",
|
1293
|
-
node: enqueueingComponent,
|
1294
|
-
fieldName,
|
1295
|
-
get blockIndex() {
|
1296
|
-
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1297
|
-
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1298
|
-
}
|
1299
|
-
},
|
1300
|
-
// slice removes 'self' since we are inserting a peer of self
|
1301
|
-
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1302
|
-
],
|
1303
|
-
context: descendantContext
|
1304
|
-
}))
|
1305
|
-
);
|
1306
|
-
}
|
1307
|
-
},
|
1308
|
-
stopProcessingDescendants() {
|
1309
|
-
visitDescendants = false;
|
1310
|
-
},
|
1311
|
-
setDescendantsContext(context) {
|
1312
|
-
descendantContext = context;
|
1313
|
-
},
|
1314
|
-
setChildContext(child, context) {
|
1315
|
-
childContexts.set(child, context);
|
1316
|
-
}
|
1317
|
-
},
|
1318
|
-
context: descendantContext
|
1319
|
-
};
|
1320
1330
|
}
|
1321
1331
|
visitor(visitorInfo);
|
1322
1332
|
if (!visitDescendants) {
|
@@ -1648,7 +1658,7 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1648
1658
|
if (currentLocation.type === "block") {
|
1649
1659
|
const { fieldName: parameterName, blockIndex } = currentLocation;
|
1650
1660
|
if (parameterName && blockIndex !== void 0) {
|
1651
|
-
const noun = parentLocation
|
1661
|
+
const noun = getNounForLocation(parentLocation);
|
1652
1662
|
path.push(`${noun}/${parameterName}/value/${blockIndex}`);
|
1653
1663
|
}
|
1654
1664
|
} else {
|
@@ -1662,6 +1672,15 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1662
1672
|
}
|
1663
1673
|
return `/${path.join("/")}`;
|
1664
1674
|
}
|
1675
|
+
function getNounForLocation(parentLocation) {
|
1676
|
+
let noun = "parameters";
|
1677
|
+
if (parentLocation && "type" in parentLocation) {
|
1678
|
+
if (parentLocation.type === "block" || isRootEntryReference(parentLocation)) {
|
1679
|
+
noun = "fields";
|
1680
|
+
}
|
1681
|
+
}
|
1682
|
+
return noun;
|
1683
|
+
}
|
1665
1684
|
|
1666
1685
|
// src/enhancement/localize.ts
|
1667
1686
|
function extractLocales({ component }) {
|
@@ -2635,10 +2654,12 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2635
2654
|
isComponentActionMessage,
|
2636
2655
|
isComponentPlaceholderId,
|
2637
2656
|
isDismissPlaceholderMessage,
|
2657
|
+
isEntryData,
|
2638
2658
|
isMovingComponentMessage,
|
2639
2659
|
isOpenParameterEditorMessage,
|
2640
2660
|
isReadyMessage,
|
2641
2661
|
isReportRenderedCompositionsMessage,
|
2662
|
+
isRootEntryReference,
|
2642
2663
|
isSelectComponentMessage,
|
2643
2664
|
isSelectParameterMessage,
|
2644
2665
|
isSystemComponentDefinition,
|
package/dist/index.mjs
CHANGED
@@ -1020,6 +1020,14 @@ function getPropertiesValue(entity) {
|
|
1020
1020
|
return "parameters" in entity && entity.parameters ? entity.parameters : "fields" in entity && entity.fields ? entity.fields : void 0;
|
1021
1021
|
}
|
1022
1022
|
|
1023
|
+
// src/utils/guards.ts
|
1024
|
+
function isRootEntryReference(root) {
|
1025
|
+
return root.type === "root" && isEntryData(root.node);
|
1026
|
+
}
|
1027
|
+
function isEntryData(entryData) {
|
1028
|
+
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
|
+
}
|
1030
|
+
|
1023
1031
|
// src/enhancement/walkNodeTree.ts
|
1024
1032
|
function walkNodeTree(node, visitor, options) {
|
1025
1033
|
var _a, _b;
|
@@ -1038,7 +1046,83 @@ function walkNodeTree(node, visitor, options) {
|
|
1038
1046
|
let visitDescendants = true;
|
1039
1047
|
let descendantContext = (_a = childContexts.get(currentComponent.node)) != null ? _a : currentQueueEntry.context;
|
1040
1048
|
let visitorInfo;
|
1041
|
-
if (currentComponent.type === "root" || currentComponent.type === "
|
1049
|
+
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
1050
|
+
visitorInfo = {
|
1051
|
+
type: "entry",
|
1052
|
+
node: currentComponent.node,
|
1053
|
+
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1054
|
+
actions: {
|
1055
|
+
replace: (replacementNode) => {
|
1056
|
+
Object.assign(currentComponent.node, replacementNode);
|
1057
|
+
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1058
|
+
propertiesToCheck.forEach((property) => {
|
1059
|
+
if (!replacementNode[property]) {
|
1060
|
+
delete currentComponent.node[property];
|
1061
|
+
}
|
1062
|
+
});
|
1063
|
+
},
|
1064
|
+
remove: () => {
|
1065
|
+
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1066
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1067
|
+
if (currentComponentLocation.type === "block") {
|
1068
|
+
const { fieldName, blockIndex } = currentComponentLocation;
|
1069
|
+
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1070
|
+
blockValue.splice(blockIndex, 1);
|
1071
|
+
if (blockValue.length === 0) {
|
1072
|
+
const properties2 = getPropertiesValue(parentComponent.node);
|
1073
|
+
delete properties2[fieldName];
|
1074
|
+
}
|
1075
|
+
} else {
|
1076
|
+
throw new Error("Unknown node type");
|
1077
|
+
}
|
1078
|
+
},
|
1079
|
+
insertAfter: (nodes) => {
|
1080
|
+
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1081
|
+
if (currentNodeInfo.type !== "block") {
|
1082
|
+
throw new Error("Unknown type");
|
1083
|
+
}
|
1084
|
+
const { fieldName, blockIndex } = currentNodeInfo;
|
1085
|
+
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1086
|
+
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1087
|
+
if (fieldName && typeof blockIndex !== "undefined") {
|
1088
|
+
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1089
|
+
blockIndex + 1,
|
1090
|
+
0,
|
1091
|
+
...nodesToInsert
|
1092
|
+
);
|
1093
|
+
componentQueue.unshift(
|
1094
|
+
...nodesToInsert.map((enqueueingComponent) => ({
|
1095
|
+
ancestorsAndSelf: [
|
1096
|
+
{
|
1097
|
+
type: "block",
|
1098
|
+
node: enqueueingComponent,
|
1099
|
+
fieldName,
|
1100
|
+
get blockIndex() {
|
1101
|
+
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1102
|
+
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1103
|
+
}
|
1104
|
+
},
|
1105
|
+
// slice removes 'self' since we are inserting a peer of self
|
1106
|
+
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1107
|
+
],
|
1108
|
+
context: descendantContext
|
1109
|
+
}))
|
1110
|
+
);
|
1111
|
+
}
|
1112
|
+
},
|
1113
|
+
stopProcessingDescendants() {
|
1114
|
+
visitDescendants = false;
|
1115
|
+
},
|
1116
|
+
setDescendantsContext(context) {
|
1117
|
+
descendantContext = context;
|
1118
|
+
},
|
1119
|
+
setChildContext(child, context) {
|
1120
|
+
childContexts.set(child, context);
|
1121
|
+
}
|
1122
|
+
},
|
1123
|
+
context: descendantContext
|
1124
|
+
};
|
1125
|
+
} else {
|
1042
1126
|
visitorInfo = {
|
1043
1127
|
type: "component",
|
1044
1128
|
node: currentComponent.node,
|
@@ -1129,82 +1213,6 @@ function walkNodeTree(node, visitor, options) {
|
|
1129
1213
|
},
|
1130
1214
|
context: descendantContext
|
1131
1215
|
};
|
1132
|
-
} else {
|
1133
|
-
visitorInfo = {
|
1134
|
-
type: "entry",
|
1135
|
-
node: currentComponent.node,
|
1136
|
-
ancestorsAndSelf: currentQueueEntry.ancestorsAndSelf,
|
1137
|
-
actions: {
|
1138
|
-
replace: (replacementNode) => {
|
1139
|
-
Object.assign(currentComponent.node, replacementNode);
|
1140
|
-
const propertiesToCheck = ["fields", "_dataResources", "_author"];
|
1141
|
-
propertiesToCheck.forEach((property) => {
|
1142
|
-
if (!replacementNode[property]) {
|
1143
|
-
delete currentComponent.node[property];
|
1144
|
-
}
|
1145
|
-
});
|
1146
|
-
},
|
1147
|
-
remove: () => {
|
1148
|
-
const currentComponentLocation = currentQueueEntry.ancestorsAndSelf[0];
|
1149
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1150
|
-
if (currentComponentLocation.type === "block") {
|
1151
|
-
const { fieldName, blockIndex } = currentComponentLocation;
|
1152
|
-
const blockValue = getBlockValue(parentComponent.node, fieldName);
|
1153
|
-
blockValue.splice(blockIndex, 1);
|
1154
|
-
if (blockValue.length === 0) {
|
1155
|
-
const properties2 = getPropertiesValue(parentComponent.node);
|
1156
|
-
delete properties2[fieldName];
|
1157
|
-
}
|
1158
|
-
} else {
|
1159
|
-
throw new Error("Unknown node type");
|
1160
|
-
}
|
1161
|
-
},
|
1162
|
-
insertAfter: (nodes) => {
|
1163
|
-
const currentNodeInfo = currentQueueEntry.ancestorsAndSelf[0];
|
1164
|
-
if (currentNodeInfo.type !== "block") {
|
1165
|
-
throw new Error("Unknown type");
|
1166
|
-
}
|
1167
|
-
const { fieldName, blockIndex } = currentNodeInfo;
|
1168
|
-
const parentComponent = currentQueueEntry.ancestorsAndSelf[1];
|
1169
|
-
const nodesToInsert = Array.isArray(nodes) ? nodes : [nodes];
|
1170
|
-
if (fieldName && typeof blockIndex !== "undefined") {
|
1171
|
-
getPropertiesValue(parentComponent.node)[fieldName].value.splice(
|
1172
|
-
blockIndex + 1,
|
1173
|
-
0,
|
1174
|
-
...nodesToInsert
|
1175
|
-
);
|
1176
|
-
componentQueue.unshift(
|
1177
|
-
...nodesToInsert.map((enqueueingComponent) => ({
|
1178
|
-
ancestorsAndSelf: [
|
1179
|
-
{
|
1180
|
-
type: "block",
|
1181
|
-
node: enqueueingComponent,
|
1182
|
-
fieldName,
|
1183
|
-
get blockIndex() {
|
1184
|
-
const parentArray = getPropertiesValue(parentComponent.node)[fieldName].value;
|
1185
|
-
return parentArray.findIndex((x) => x === enqueueingComponent);
|
1186
|
-
}
|
1187
|
-
},
|
1188
|
-
// slice removes 'self' since we are inserting a peer of self
|
1189
|
-
...currentQueueEntry.ancestorsAndSelf.slice(1)
|
1190
|
-
],
|
1191
|
-
context: descendantContext
|
1192
|
-
}))
|
1193
|
-
);
|
1194
|
-
}
|
1195
|
-
},
|
1196
|
-
stopProcessingDescendants() {
|
1197
|
-
visitDescendants = false;
|
1198
|
-
},
|
1199
|
-
setDescendantsContext(context) {
|
1200
|
-
descendantContext = context;
|
1201
|
-
},
|
1202
|
-
setChildContext(child, context) {
|
1203
|
-
childContexts.set(child, context);
|
1204
|
-
}
|
1205
|
-
},
|
1206
|
-
context: descendantContext
|
1207
|
-
};
|
1208
1216
|
}
|
1209
1217
|
visitor(visitorInfo);
|
1210
1218
|
if (!visitDescendants) {
|
@@ -1536,7 +1544,7 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1536
1544
|
if (currentLocation.type === "block") {
|
1537
1545
|
const { fieldName: parameterName, blockIndex } = currentLocation;
|
1538
1546
|
if (parameterName && blockIndex !== void 0) {
|
1539
|
-
const noun = parentLocation
|
1547
|
+
const noun = getNounForLocation(parentLocation);
|
1540
1548
|
path.push(`${noun}/${parameterName}/value/${blockIndex}`);
|
1541
1549
|
}
|
1542
1550
|
} else {
|
@@ -1550,6 +1558,15 @@ function getComponentJsonPointer(ancestorsAndSelf) {
|
|
1550
1558
|
}
|
1551
1559
|
return `/${path.join("/")}`;
|
1552
1560
|
}
|
1561
|
+
function getNounForLocation(parentLocation) {
|
1562
|
+
let noun = "parameters";
|
1563
|
+
if (parentLocation && "type" in parentLocation) {
|
1564
|
+
if (parentLocation.type === "block" || isRootEntryReference(parentLocation)) {
|
1565
|
+
noun = "fields";
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
return noun;
|
1569
|
+
}
|
1553
1570
|
|
1554
1571
|
// src/enhancement/localize.ts
|
1555
1572
|
function extractLocales({ component }) {
|
@@ -2522,10 +2539,12 @@ export {
|
|
2522
2539
|
isComponentActionMessage,
|
2523
2540
|
isComponentPlaceholderId,
|
2524
2541
|
isDismissPlaceholderMessage,
|
2542
|
+
isEntryData,
|
2525
2543
|
isMovingComponentMessage,
|
2526
2544
|
isOpenParameterEditorMessage,
|
2527
2545
|
isReadyMessage,
|
2528
2546
|
isReportRenderedCompositionsMessage,
|
2547
|
+
isRootEntryReference,
|
2529
2548
|
isSelectComponentMessage,
|
2530
2549
|
isSelectParameterMessage,
|
2531
2550
|
isSystemComponentDefinition,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.79.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.79.0",
|
42
|
+
"@uniformdev/context": "19.79.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": "78f5ededbaa1a67d58d808eac23ab64769e14e10"
|
52
52
|
}
|