@uniformdev/canvas 19.80.0 → 19.80.1-alpha.126
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 +151 -34
- package/dist/index.d.ts +151 -34
- package/dist/index.esm.js +51 -2
- package/dist/index.js +59 -2
- package/dist/index.mjs +51 -2
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
@@ -1372,6 +1372,12 @@ declare const EDGE_MAX_CACHE_TTL: number;
|
|
1372
1372
|
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
1373
1373
|
/** A value that indicates that Edgehancers caching is disabled */
|
1374
1374
|
declare const EDGE_CACHE_DISABLED = -1;
|
1375
|
+
/** This is the type value for the asset parameter or field */
|
1376
|
+
declare const ASSET_PARAMETER_TYPE = "asset";
|
1377
|
+
/** The _source for any assets coming from the Uniform Asset Library */
|
1378
|
+
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1379
|
+
/** The _source for any assets which have manually set fields */
|
1380
|
+
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1375
1381
|
|
1376
1382
|
/**
|
1377
1383
|
* This file was auto-generated by openapi-typescript.
|
@@ -4327,6 +4333,7 @@ type DeleteContentTypeOptions = paths$b['/api/v1/content-types']['delete']['requ
|
|
4327
4333
|
type PutContentTypeBody = paths$b['/api/v1/content-types']['put']['requestBody']['content']['application/json'];
|
4328
4334
|
type GetContentTypesResponse = paths$b['/api/v1/content-types']['get']['responses']['200']['content']['application/json'];
|
4329
4335
|
type Entry = components$3['schemas']['EntryApiResponse'];
|
4336
|
+
type EntryList = components$3['schemas']['EntryListResponse'];
|
4330
4337
|
type EntryData = Entry['entry'];
|
4331
4338
|
type GetEntriesOptions = paths$a['/api/v1/entries']['get']['parameters']['query'];
|
4332
4339
|
type GetEntriesResponse = paths$a['/api/v1/entries']['get']['responses']['200']['content']['application/json'];
|
@@ -12489,8 +12496,9 @@ interface paths$1 {
|
|
12489
12496
|
parameters: {
|
12490
12497
|
query: {
|
12491
12498
|
projectId: string;
|
12492
|
-
type: "definition";
|
12499
|
+
type: "definition" | "instance";
|
12493
12500
|
definitionIds?: string;
|
12501
|
+
instanceIds?: string;
|
12494
12502
|
withCompositions?: boolean | null;
|
12495
12503
|
};
|
12496
12504
|
};
|
@@ -12850,6 +12858,81 @@ type schemas = components$1['schemas'];
|
|
12850
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12851
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12852
12860
|
|
12861
|
+
type AssetParamValue = AssetParamValueItem[];
|
12862
|
+
type AssetParamValueItem = {
|
12863
|
+
type: string;
|
12864
|
+
_id: string;
|
12865
|
+
/**
|
12866
|
+
* Internal Uniform source ID or
|
12867
|
+
* dataType ID of the global integration library
|
12868
|
+
* which created this asset item
|
12869
|
+
*/
|
12870
|
+
_source?: string;
|
12871
|
+
fields: {
|
12872
|
+
url: {
|
12873
|
+
type: 'text';
|
12874
|
+
value: string;
|
12875
|
+
};
|
12876
|
+
id?: {
|
12877
|
+
type: 'text';
|
12878
|
+
value: string | undefined;
|
12879
|
+
};
|
12880
|
+
title?: {
|
12881
|
+
type: 'text';
|
12882
|
+
value: string | undefined;
|
12883
|
+
};
|
12884
|
+
description?: {
|
12885
|
+
type: 'text';
|
12886
|
+
value: string | undefined;
|
12887
|
+
};
|
12888
|
+
mediaType?: {
|
12889
|
+
type: 'text';
|
12890
|
+
value: string | undefined;
|
12891
|
+
};
|
12892
|
+
/**
|
12893
|
+
* The width of the original asset
|
12894
|
+
*
|
12895
|
+
* Should resolve to a number but might
|
12896
|
+
* be a string with a pointer reference
|
12897
|
+
*/
|
12898
|
+
width?: {
|
12899
|
+
type: 'number';
|
12900
|
+
value: number | string | undefined;
|
12901
|
+
};
|
12902
|
+
/**
|
12903
|
+
* The height of the original asset
|
12904
|
+
*
|
12905
|
+
* Should resolve to a number but might
|
12906
|
+
* be a string with a pointer reference
|
12907
|
+
*/
|
12908
|
+
height?: {
|
12909
|
+
type: 'number';
|
12910
|
+
value: number | string | undefined;
|
12911
|
+
};
|
12912
|
+
/**
|
12913
|
+
* The size in bytes of the original asset
|
12914
|
+
*
|
12915
|
+
* Should resolve to a number but might
|
12916
|
+
* be a string with a pointer reference
|
12917
|
+
*/
|
12918
|
+
size?: {
|
12919
|
+
type: 'number';
|
12920
|
+
value: number | string | undefined;
|
12921
|
+
};
|
12922
|
+
/**
|
12923
|
+
* Any key/value properties which the source
|
12924
|
+
* wants to attach to the asset data
|
12925
|
+
*/
|
12926
|
+
custom?: {
|
12927
|
+
type: string;
|
12928
|
+
value: Record<string, unknown>;
|
12929
|
+
};
|
12930
|
+
};
|
12931
|
+
_overrides?: {
|
12932
|
+
fields: ComponentOverride['parameters'];
|
12933
|
+
};
|
12934
|
+
};
|
12935
|
+
|
12853
12936
|
type LinkParameterType = 'projectMapNode' | 'url' | 'tel' | 'email';
|
12854
12937
|
type LinkTypeConfiguration = Partial<Record<LinkParameterType, boolean>>;
|
12855
12938
|
type LinkParamConfiguration = {
|
@@ -13137,37 +13220,6 @@ declare function enhance<TContext extends EnhancerContext = EnhancerContext>({ c
|
|
13137
13220
|
onErrors?: (errors: EnhancerError[]) => void;
|
13138
13221
|
}): Promise<void>;
|
13139
13222
|
|
13140
|
-
/** @deprecated use walkNodeTree */
|
13141
|
-
type ComponentLocationReference = {
|
13142
|
-
component: ComponentInstance;
|
13143
|
-
parentSlot?: string;
|
13144
|
-
parentSlotIndex?: number;
|
13145
|
-
};
|
13146
|
-
/** @deprecated use walkNodeTree and check for type = slot */
|
13147
|
-
type WalkComponentTreeActions<TContext> = {
|
13148
|
-
/** Replaces the component being visited with a new object */
|
13149
|
-
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13150
|
-
/** Removes the component being visited from the composition */
|
13151
|
-
removeComponent: () => void;
|
13152
|
-
/** Inserts a new component immediately after the current component in its parent slot */
|
13153
|
-
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13154
|
-
/** Aborts visitation of components that are in child slots of the current component */
|
13155
|
-
stopProcessingDescendants: () => void;
|
13156
|
-
/**
|
13157
|
-
* Set a new traversal context for descendants of this node.
|
13158
|
-
* If this is not called, `context` will automatically pass through.
|
13159
|
-
*/
|
13160
|
-
setDescendantsContext: (context: TContext) => void;
|
13161
|
-
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13162
|
-
};
|
13163
|
-
/**
|
13164
|
-
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13165
|
-
* @deprecated use walkNodeTree
|
13166
|
-
*/
|
13167
|
-
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13168
|
-
/** Traversal context for this node */
|
13169
|
-
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13170
|
-
|
13171
13223
|
/** Ancestor location that is in a slot on a component */
|
13172
13224
|
type ComponentLocationReferenceV2 = {
|
13173
13225
|
type: 'slot';
|
@@ -13235,8 +13287,63 @@ declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | Entr
|
|
13235
13287
|
/** Gets the typed value of a block parameter or block field */
|
13236
13288
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13237
13289
|
|
13290
|
+
interface FindInNodeTreeReference {
|
13291
|
+
key: string;
|
13292
|
+
pointer: string;
|
13293
|
+
/** This might be the composition parameter, or entry field */
|
13294
|
+
parameter: ComponentParameter;
|
13295
|
+
}
|
13296
|
+
/**
|
13297
|
+
* Walk a Composition or Entry tree to find parameters or fields
|
13298
|
+
* based on the predicate returning true
|
13299
|
+
*
|
13300
|
+
* @example
|
13301
|
+
*
|
13302
|
+
* const textReferences = findParameterInNodeTree(
|
13303
|
+
* composition,
|
13304
|
+
* (parameter) => parameter.type === 'text'
|
13305
|
+
* )
|
13306
|
+
*
|
13307
|
+
* @param data The composition or entry data
|
13308
|
+
* @param predicate Return true from this function to include the parameter in the results
|
13309
|
+
*/
|
13310
|
+
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13311
|
+
|
13312
|
+
/** @deprecated use walkNodeTree */
|
13313
|
+
type ComponentLocationReference = {
|
13314
|
+
component: ComponentInstance;
|
13315
|
+
parentSlot?: string;
|
13316
|
+
parentSlotIndex?: number;
|
13317
|
+
};
|
13318
|
+
/** @deprecated use walkNodeTree and check for type = slot */
|
13319
|
+
type WalkComponentTreeActions<TContext> = {
|
13320
|
+
/** Replaces the component being visited with a new object */
|
13321
|
+
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13322
|
+
/** Removes the component being visited from the composition */
|
13323
|
+
removeComponent: () => void;
|
13324
|
+
/** Inserts a new component immediately after the current component in its parent slot */
|
13325
|
+
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13326
|
+
/** Aborts visitation of components that are in child slots of the current component */
|
13327
|
+
stopProcessingDescendants: () => void;
|
13328
|
+
/**
|
13329
|
+
* Set a new traversal context for descendants of this node.
|
13330
|
+
* If this is not called, `context` will automatically pass through.
|
13331
|
+
*/
|
13332
|
+
setDescendantsContext: (context: TContext) => void;
|
13333
|
+
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13334
|
+
};
|
13335
|
+
/**
|
13336
|
+
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13337
|
+
* @deprecated use walkNodeTree
|
13338
|
+
*/
|
13339
|
+
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13340
|
+
/** Traversal context for this node */
|
13341
|
+
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13342
|
+
|
13238
13343
|
/** Returns the JSON pointer of a component based on its location */
|
13239
13344
|
declare function getComponentJsonPointer(ancestorsAndSelf: Array<NodeLocationReference | ComponentLocationReference>): string;
|
13345
|
+
declare function getNounForLocation(parentLocation: NodeLocationReference | ComponentLocationReference | undefined): "parameters" | "fields";
|
13346
|
+
declare function getNounForNode(node: ComponentInstance | EntryData | Array<NodeLocationReference>): "parameters" | "fields";
|
13240
13347
|
|
13241
13348
|
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference | NodeLocationReference>): string;
|
13242
13349
|
|
@@ -13694,7 +13801,17 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13694
13801
|
* Check to see if some generic composition data structure
|
13695
13802
|
* looks like Entry data
|
13696
13803
|
*/
|
13697
|
-
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13804
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13805
|
+
/**
|
13806
|
+
* A fast, non-exhaustive guard which checks that the value is an array
|
13807
|
+
* as well as the first item, if there is one, looks like an asset item
|
13808
|
+
*/
|
13809
|
+
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13810
|
+
/**
|
13811
|
+
* A fast, non-exhaustive guard which checks the
|
13812
|
+
* required structure of an asset item
|
13813
|
+
*/
|
13814
|
+
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13698
13815
|
|
13699
13816
|
declare const generateHash: ({ composition, secret, }: {
|
13700
13817
|
composition: RootComponentInstance;
|
@@ -13784,4 +13901,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13784
13901
|
|
13785
13902
|
declare const CanvasClientError: typeof ApiClientError;
|
13786
13903
|
|
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 };
|
13904
|
+
export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryList, type EventNames, type FindInNodeTreeReference, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, type ReportRenderedCompositionsMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type UsageTrackingApi, type UsageTrackingGetParameters, type UsageTrackingGetResponse, type UsageTrackingPostParameters, type UsageTrackingPostResponse, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.d.ts
CHANGED
@@ -1372,6 +1372,12 @@ declare const EDGE_MAX_CACHE_TTL: number;
|
|
1372
1372
|
declare const EDGE_DEFAULT_CACHE_TTL = 30;
|
1373
1373
|
/** A value that indicates that Edgehancers caching is disabled */
|
1374
1374
|
declare const EDGE_CACHE_DISABLED = -1;
|
1375
|
+
/** This is the type value for the asset parameter or field */
|
1376
|
+
declare const ASSET_PARAMETER_TYPE = "asset";
|
1377
|
+
/** The _source for any assets coming from the Uniform Asset Library */
|
1378
|
+
declare const ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1379
|
+
/** The _source for any assets which have manually set fields */
|
1380
|
+
declare const ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1375
1381
|
|
1376
1382
|
/**
|
1377
1383
|
* This file was auto-generated by openapi-typescript.
|
@@ -4327,6 +4333,7 @@ type DeleteContentTypeOptions = paths$b['/api/v1/content-types']['delete']['requ
|
|
4327
4333
|
type PutContentTypeBody = paths$b['/api/v1/content-types']['put']['requestBody']['content']['application/json'];
|
4328
4334
|
type GetContentTypesResponse = paths$b['/api/v1/content-types']['get']['responses']['200']['content']['application/json'];
|
4329
4335
|
type Entry = components$3['schemas']['EntryApiResponse'];
|
4336
|
+
type EntryList = components$3['schemas']['EntryListResponse'];
|
4330
4337
|
type EntryData = Entry['entry'];
|
4331
4338
|
type GetEntriesOptions = paths$a['/api/v1/entries']['get']['parameters']['query'];
|
4332
4339
|
type GetEntriesResponse = paths$a['/api/v1/entries']['get']['responses']['200']['content']['application/json'];
|
@@ -12489,8 +12496,9 @@ interface paths$1 {
|
|
12489
12496
|
parameters: {
|
12490
12497
|
query: {
|
12491
12498
|
projectId: string;
|
12492
|
-
type: "definition";
|
12499
|
+
type: "definition" | "instance";
|
12493
12500
|
definitionIds?: string;
|
12501
|
+
instanceIds?: string;
|
12494
12502
|
withCompositions?: boolean | null;
|
12495
12503
|
};
|
12496
12504
|
};
|
@@ -12850,6 +12858,81 @@ type schemas = components$1['schemas'];
|
|
12850
12858
|
type InvalidationPayload = schemas['InvalidationPayload'];
|
12851
12859
|
type BatchInvalidationPayload = schemas['BatchInvalidationPayload'];
|
12852
12860
|
|
12861
|
+
type AssetParamValue = AssetParamValueItem[];
|
12862
|
+
type AssetParamValueItem = {
|
12863
|
+
type: string;
|
12864
|
+
_id: string;
|
12865
|
+
/**
|
12866
|
+
* Internal Uniform source ID or
|
12867
|
+
* dataType ID of the global integration library
|
12868
|
+
* which created this asset item
|
12869
|
+
*/
|
12870
|
+
_source?: string;
|
12871
|
+
fields: {
|
12872
|
+
url: {
|
12873
|
+
type: 'text';
|
12874
|
+
value: string;
|
12875
|
+
};
|
12876
|
+
id?: {
|
12877
|
+
type: 'text';
|
12878
|
+
value: string | undefined;
|
12879
|
+
};
|
12880
|
+
title?: {
|
12881
|
+
type: 'text';
|
12882
|
+
value: string | undefined;
|
12883
|
+
};
|
12884
|
+
description?: {
|
12885
|
+
type: 'text';
|
12886
|
+
value: string | undefined;
|
12887
|
+
};
|
12888
|
+
mediaType?: {
|
12889
|
+
type: 'text';
|
12890
|
+
value: string | undefined;
|
12891
|
+
};
|
12892
|
+
/**
|
12893
|
+
* The width of the original asset
|
12894
|
+
*
|
12895
|
+
* Should resolve to a number but might
|
12896
|
+
* be a string with a pointer reference
|
12897
|
+
*/
|
12898
|
+
width?: {
|
12899
|
+
type: 'number';
|
12900
|
+
value: number | string | undefined;
|
12901
|
+
};
|
12902
|
+
/**
|
12903
|
+
* The height of the original asset
|
12904
|
+
*
|
12905
|
+
* Should resolve to a number but might
|
12906
|
+
* be a string with a pointer reference
|
12907
|
+
*/
|
12908
|
+
height?: {
|
12909
|
+
type: 'number';
|
12910
|
+
value: number | string | undefined;
|
12911
|
+
};
|
12912
|
+
/**
|
12913
|
+
* The size in bytes of the original asset
|
12914
|
+
*
|
12915
|
+
* Should resolve to a number but might
|
12916
|
+
* be a string with a pointer reference
|
12917
|
+
*/
|
12918
|
+
size?: {
|
12919
|
+
type: 'number';
|
12920
|
+
value: number | string | undefined;
|
12921
|
+
};
|
12922
|
+
/**
|
12923
|
+
* Any key/value properties which the source
|
12924
|
+
* wants to attach to the asset data
|
12925
|
+
*/
|
12926
|
+
custom?: {
|
12927
|
+
type: string;
|
12928
|
+
value: Record<string, unknown>;
|
12929
|
+
};
|
12930
|
+
};
|
12931
|
+
_overrides?: {
|
12932
|
+
fields: ComponentOverride['parameters'];
|
12933
|
+
};
|
12934
|
+
};
|
12935
|
+
|
12853
12936
|
type LinkParameterType = 'projectMapNode' | 'url' | 'tel' | 'email';
|
12854
12937
|
type LinkTypeConfiguration = Partial<Record<LinkParameterType, boolean>>;
|
12855
12938
|
type LinkParamConfiguration = {
|
@@ -13137,37 +13220,6 @@ declare function enhance<TContext extends EnhancerContext = EnhancerContext>({ c
|
|
13137
13220
|
onErrors?: (errors: EnhancerError[]) => void;
|
13138
13221
|
}): Promise<void>;
|
13139
13222
|
|
13140
|
-
/** @deprecated use walkNodeTree */
|
13141
|
-
type ComponentLocationReference = {
|
13142
|
-
component: ComponentInstance;
|
13143
|
-
parentSlot?: string;
|
13144
|
-
parentSlotIndex?: number;
|
13145
|
-
};
|
13146
|
-
/** @deprecated use walkNodeTree and check for type = slot */
|
13147
|
-
type WalkComponentTreeActions<TContext> = {
|
13148
|
-
/** Replaces the component being visited with a new object */
|
13149
|
-
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13150
|
-
/** Removes the component being visited from the composition */
|
13151
|
-
removeComponent: () => void;
|
13152
|
-
/** Inserts a new component immediately after the current component in its parent slot */
|
13153
|
-
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13154
|
-
/** Aborts visitation of components that are in child slots of the current component */
|
13155
|
-
stopProcessingDescendants: () => void;
|
13156
|
-
/**
|
13157
|
-
* Set a new traversal context for descendants of this node.
|
13158
|
-
* If this is not called, `context` will automatically pass through.
|
13159
|
-
*/
|
13160
|
-
setDescendantsContext: (context: TContext) => void;
|
13161
|
-
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13162
|
-
};
|
13163
|
-
/**
|
13164
|
-
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13165
|
-
* @deprecated use walkNodeTree
|
13166
|
-
*/
|
13167
|
-
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13168
|
-
/** Traversal context for this node */
|
13169
|
-
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13170
|
-
|
13171
13223
|
/** Ancestor location that is in a slot on a component */
|
13172
13224
|
type ComponentLocationReferenceV2 = {
|
13173
13225
|
type: 'slot';
|
@@ -13235,8 +13287,63 @@ declare function walkNodeTree<TContext = unknown>(node: ComponentInstance | Entr
|
|
13235
13287
|
/** Gets the typed value of a block parameter or block field */
|
13236
13288
|
declare function getBlockValue(component: ComponentInstance | EntryData, parameterName: string): BlockValue;
|
13237
13289
|
|
13290
|
+
interface FindInNodeTreeReference {
|
13291
|
+
key: string;
|
13292
|
+
pointer: string;
|
13293
|
+
/** This might be the composition parameter, or entry field */
|
13294
|
+
parameter: ComponentParameter;
|
13295
|
+
}
|
13296
|
+
/**
|
13297
|
+
* Walk a Composition or Entry tree to find parameters or fields
|
13298
|
+
* based on the predicate returning true
|
13299
|
+
*
|
13300
|
+
* @example
|
13301
|
+
*
|
13302
|
+
* const textReferences = findParameterInNodeTree(
|
13303
|
+
* composition,
|
13304
|
+
* (parameter) => parameter.type === 'text'
|
13305
|
+
* )
|
13306
|
+
*
|
13307
|
+
* @param data The composition or entry data
|
13308
|
+
* @param predicate Return true from this function to include the parameter in the results
|
13309
|
+
*/
|
13310
|
+
declare function findParameterInNodeTree(data: ComponentInstance | EntryData | Array<NodeLocationReference>, predicate: (parameter: ComponentParameter, parameterKey: string, node: ComponentInstance | EntryData | Array<NodeLocationReference>) => boolean): FindInNodeTreeReference[];
|
13311
|
+
|
13312
|
+
/** @deprecated use walkNodeTree */
|
13313
|
+
type ComponentLocationReference = {
|
13314
|
+
component: ComponentInstance;
|
13315
|
+
parentSlot?: string;
|
13316
|
+
parentSlotIndex?: number;
|
13317
|
+
};
|
13318
|
+
/** @deprecated use walkNodeTree and check for type = slot */
|
13319
|
+
type WalkComponentTreeActions<TContext> = {
|
13320
|
+
/** Replaces the component being visited with a new object */
|
13321
|
+
replaceComponent: (replacementComponent: ComponentInstance) => void;
|
13322
|
+
/** Removes the component being visited from the composition */
|
13323
|
+
removeComponent: () => void;
|
13324
|
+
/** Inserts a new component immediately after the current component in its parent slot */
|
13325
|
+
insertAfter: (components: ComponentInstance | ComponentInstance[]) => void;
|
13326
|
+
/** Aborts visitation of components that are in child slots of the current component */
|
13327
|
+
stopProcessingDescendants: () => void;
|
13328
|
+
/**
|
13329
|
+
* Set a new traversal context for descendants of this node.
|
13330
|
+
* If this is not called, `context` will automatically pass through.
|
13331
|
+
*/
|
13332
|
+
setDescendantsContext: (context: TContext) => void;
|
13333
|
+
setChildContext: (child: ComponentInstance, context: TContext) => void;
|
13334
|
+
};
|
13335
|
+
/**
|
13336
|
+
* Walks a composition's component tree, visiting each component instance depth-first, in order.
|
13337
|
+
* @deprecated use walkNodeTree
|
13338
|
+
*/
|
13339
|
+
declare function walkComponentTree<TContext = unknown>(component: ComponentInstance, visitor: (component: ComponentInstance, ancestorsAndSelf: Array<ComponentLocationReference>, actions: WalkComponentTreeActions<TContext>,
|
13340
|
+
/** Traversal context for this node */
|
13341
|
+
currentContext: TContext | undefined) => void, initialContext?: TContext): void;
|
13342
|
+
|
13238
13343
|
/** Returns the JSON pointer of a component based on its location */
|
13239
13344
|
declare function getComponentJsonPointer(ancestorsAndSelf: Array<NodeLocationReference | ComponentLocationReference>): string;
|
13345
|
+
declare function getNounForLocation(parentLocation: NodeLocationReference | ComponentLocationReference | undefined): "parameters" | "fields";
|
13346
|
+
declare function getNounForNode(node: ComponentInstance | EntryData | Array<NodeLocationReference>): "parameters" | "fields";
|
13240
13347
|
|
13241
13348
|
declare function getComponentPath(ancestorsAndSelf: Array<ComponentLocationReference | NodeLocationReference>): string;
|
13242
13349
|
|
@@ -13694,7 +13801,17 @@ declare function isRootEntryReference(root: NodeLocationReference): root is Root
|
|
13694
13801
|
* Check to see if some generic composition data structure
|
13695
13802
|
* looks like Entry data
|
13696
13803
|
*/
|
13697
|
-
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined): entryData is EntryData;
|
13804
|
+
declare function isEntryData(entryData: ComponentInstance | EntryData | null | undefined | unknown): entryData is EntryData;
|
13805
|
+
/**
|
13806
|
+
* A fast, non-exhaustive guard which checks that the value is an array
|
13807
|
+
* as well as the first item, if there is one, looks like an asset item
|
13808
|
+
*/
|
13809
|
+
declare function isAssetParamValue(value: unknown): value is AssetParamValue;
|
13810
|
+
/**
|
13811
|
+
* A fast, non-exhaustive guard which checks the
|
13812
|
+
* required structure of an asset item
|
13813
|
+
*/
|
13814
|
+
declare function isAssetParamValueItem(item: unknown): item is AssetParamValueItem;
|
13698
13815
|
|
13699
13816
|
declare const generateHash: ({ composition, secret, }: {
|
13700
13817
|
composition: RootComponentInstance;
|
@@ -13784,4 +13901,4 @@ declare function parseVariableExpression(serialized: string, onToken?: (token: s
|
|
13784
13901
|
|
13785
13902
|
declare const CanvasClientError: typeof ApiClientError;
|
13786
13903
|
|
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 };
|
13904
|
+
export { ASSETS_SOURCE_CUSTOM_URL, ASSETS_SOURCE_UNIFORM, ASSET_PARAMETER_TYPE, ATTRIBUTE_COMPONENT_ID, ATTRIBUTE_MULTILINE, ATTRIBUTE_PARAMETER_ID, ATTRIBUTE_PARAMETER_TYPE, ATTRIBUTE_PARAMETER_VALUE, ATTRIBUTE_PLACEHOLDER, type AddComponentMessage, type AssetParamValue, type AssetParamValueItem, type BatchEnhancer, BatchEntry, type BatchInvalidationPayload, type BindVariablesOptions, type BindVariablesResult, type BindVariablesToObjectOptions, type BlockLocationReference, type BlockValue, CANVAS_BLOCK_PARAM_TYPE, CANVAS_DRAFT_STATE, CANVAS_EDITOR_STATE, CANVAS_ENRICHMENT_TAG_PARAM, CANVAS_INTENT_TAG_PARAM, CANVAS_LOCALE_TAG_PARAM, CANVAS_LOCALIZATION_SLOT, CANVAS_LOCALIZATION_TYPE, CANVAS_PERSONALIZATION_PARAM, CANVAS_PERSONALIZE_SLOT, CANVAS_PERSONALIZE_TYPE, CANVAS_PUBLISHED_STATE, CANVAS_TEST_SLOT, CANVAS_TEST_TYPE, CANVAS_TEST_VARIANT_PARAM, CanvasClient, CanvasClientError, type CanvasDefinitions, type CategoriesDeleteParameters, type CategoriesGetParameters, type CategoriesGetResponse, type CategoriesPutParameters, type Category, CategoryClient, type Channel, type ChannelMessage, type ChannelSubscription, ChildEnhancerBuilder, type ComponentDefinition, type ComponentDefinitionDeleteParameters, type ComponentDefinitionGetParameters, type ComponentDefinitionGetResponse, type ComponentDefinitionParameter, type ComponentDefinitionPermission, type ComponentDefinitionPutParameters, type ComponentDefinitionSlot, type ComponentDefinitionSlugSettings, type ComponentDefinitionVariant, type ComponentEnhancer, type ComponentEnhancerFunction, type ComponentEnhancerOptions, type ComponentInstance, type ComponentInstanceContextualEditing, type ComponentInstanceHistoryEntry, type ComponentInstanceHistoryGetParameters, type ComponentInstanceHistoryGetResponse, type ComponentLocationReference, type ComponentLocationReferenceV2, type ComponentOverridability, type ComponentOverride, type ComponentOverrides, type ComponentParameter, type ComponentParameterBlock, type ComponentParameterContextualEditing, type ComponentParameterEnhancer, type ComponentParameterEnhancerFunction, type ComponentParameterEnhancerOptions, type CompositionDataDiagnostic, type CompositionDeleteParameters, type CompositionDiagnostics, type CompositionGetByComponentIdParameters, type CompositionGetByIdParameters, type CompositionGetByNodeIdParameters, type CompositionGetByNodePathParameters, type CompositionGetBySlugParameters, type CompositionGetListResponse, type CompositionGetOrderBy, type CompositionGetParameters, type CompositionGetResponse, type CompositionGetValidResponses, type CompositionIssue, type CompositionPatternIssue, type CompositionPutParameters, type CompositionRelationshipsClientOptions, type CompositionRelationshipsDDefinitionGetResponse, type CompositionRelationshipsDefinitionApi, type CompositionRelationshipsDefinitionGetParameters, type CompositionResolvedGetResponse, type CompositionResolvedListResponse, type CompositionUIStatus, ContentClient, type ContentType, type ContentTypeField, type ContextualEditingComponentReference, type DataDiagnostic, type DataElementBindingIssue, type DataElementConnectionDefinition, type DataResolutionConfigIssue, type DataResolutionIssue, type DataResolutionOption, type DataResolutionOptionNegative, type DataResolutionOptionPositive, type DataResolutionParameters, type DataResourceDefinition, type DataResourceDefinitions, type DataResourceIssue, type DataResourceVariables, type DataSource, DataSourceClient, type DataSourceDeleteParameters, type DataSourceGetParameters, type DataSourceGetResponse, type DataSourcePutParameters, type DataSourcesGetParameters, type DataSourcesGetResponse, type DataType, DataTypeClient, type DataTypeDeleteParameters, type DataTypeGetParameters, type DataTypeGetResponse, type DataTypePutParameters, type DataVariableDefinition, type DeleteContentTypeOptions, type DeleteEntryOptions, type DismissPlaceholderMessage, type DynamicInputIssue, EDGE_CACHE_DISABLED, EDGE_DEFAULT_CACHE_TTL, EDGE_MAX_CACHE_TTL, EDGE_MIN_CACHE_TTL, EMPTY_COMPOSITION, type EdgehancersDiagnostics, type EditorStateUpdatedMessage, EnhancerBuilder, type EnhancerContext, type EnhancerError, type EntriesGetParameters, type EntriesGetResponse, type EntriesHistoryGetParameters, type EntriesHistoryGetResponse, type EntriesResolvedListResponse, type Entry, type EntryData, type EntryList, type EventNames, type FindInNodeTreeReference, type GetContentTypesOptions, type GetContentTypesResponse, type GetEntriesOptions, type GetEntriesResponse, type GetParameterAttributesProps, IN_CONTEXT_EDITOR_COMPONENT_END_ROLE, IN_CONTEXT_EDITOR_COMPONENT_START_ROLE, IN_CONTEXT_EDITOR_CONFIG_CHECK_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID, IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM, IN_CONTEXT_EDITOR_QUERY_STRING_PARAM, IS_RENDERED_BY_UNIFORM_ATTRIBUTE, type InvalidationPayload, type LimitPolicy, type LinkComponentParameterValue, type LinkParamConfiguration, type LinkParamValue, type LinkParameterType, type LinkTypeConfiguration, type MessageHandler, type MoveComponentMessage, type NodeLocationReference, type NonProjectMapLinkParamValue, type OpenParameterEditorMessage, type OverrideOptions, PLACEHOLDER_ID, type PatternIssue, type PreviewEventBus, type PreviewPanelSettings, type ProjectMapLinkComponentParameterValue, type ProjectMapLinkParamValue, type Prompt, PromptClient, type PromptsDeleteParameters, type PromptsGetParameters, type PromptsGetResponse, type PromptsPutParameters, type PutContentTypeBody, type PutEntryBody, type ReadyMessage, type ReportRenderedCompositionsMessage, type ResolvedRouteGetResponse, type RichTextBuiltInElement, type RichTextBuiltInFormat, type RichTextParamConfiguration, type RichTextParamValue, type RootComponentInstance, type RootEntryReference, type RootLocationReference, RouteClient, type RouteDynamicInputs, type RouteGetParameters, type RouteGetResponse, type RouteGetResponseComposition, type RouteGetResponseEdgehancedComposition, type RouteGetResponseNotFound, type RouteGetResponseRedirect, SECRET_QUERY_STRING_PARAM, type SelectComponentMessage, type SelectParameterMessage, type SpecificProjectMap, type SubscribeToCompositionOptions, type TreeNodeInfoTypes, type TriggerComponentActionMessage, type TriggerCompositionActionMessage, UncachedCanvasClient, UncachedCategoryClient, UncachedContentClient, UniqueBatchEntries, type UnsubscribeCallback, type UpdateComponentParameterMessage, type UpdateComponentReferencesMessage, type UpdateCompositionInternalMessage, type UpdateCompositionMessage, type UpdateContextualEditingStateInternalMessage, type UpdateFeatureFlagsMessage, type UpdatePreviewSettingsMessage, type UsageTrackingApi, type UsageTrackingGetParameters, type UsageTrackingGetResponse, type UsageTrackingPostParameters, type UsageTrackingPostResponse, type WalkComponentTreeActions, type WalkNodeTreeActions, type WalkNodeTreeOptions, bindVariables, bindVariablesToObject, compose, convertEntryToPutEntry, createBatchEnhancer, createCanvasChannel, createEventBus, createLimitPolicy, createUniformApiEnhancer, createVariableReference, enhance, extractLocales, findParameterInNodeTree, generateComponentPlaceholderId, generateHash, getBlockValue, getChannelName, getComponentJsonPointer, getComponentPath, getNounForLocation, getNounForNode, getParameterAttributes, getPropertiesValue, isAddComponentMessage, isAllowedReferrer, isAssetParamValue, isAssetParamValueItem, isComponentActionMessage, isComponentPlaceholderId, isDismissPlaceholderMessage, isEntryData, isMovingComponentMessage, isOpenParameterEditorMessage, isReadyMessage, isReportRenderedCompositionsMessage, isRootEntryReference, isSelectComponentMessage, isSelectParameterMessage, isSystemComponentDefinition, isTriggerCompositionActionMessage, isUpdateComponentParameterMessage, isUpdateComponentReferencesMessage, isUpdateCompositionInternalMessage, isUpdateCompositionMessage, isUpdateContextualEditingStateInternalMessage, isUpdateFeatureFlagsMessage, isUpdatePreviewSettingsMessage, localize, mapSlotToPersonalizedVariations, mapSlotToTestVariations, nullLimitPolicy, parseVariableExpression, subscribeToComposition, unstable_CompositionRelationshipClient, walkComponentTree, walkNodeTree };
|
package/dist/index.esm.js
CHANGED
@@ -1000,6 +1000,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1000
1000
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1001
1001
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1002
1002
|
var EDGE_CACHE_DISABLED = -1;
|
1003
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1004
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1003
1006
|
|
1004
1007
|
// src/utils/entryConverter.ts
|
1005
1008
|
function convertEntryToPutEntry(entry) {
|
@@ -1027,6 +1030,14 @@ function isRootEntryReference(root) {
|
|
1027
1030
|
function isEntryData(entryData) {
|
1028
1031
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
1032
|
}
|
1033
|
+
function isAssetParamValue(value) {
|
1034
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1035
|
+
}
|
1036
|
+
function isAssetParamValueItem(item) {
|
1037
|
+
return Boolean(
|
1038
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1039
|
+
);
|
1040
|
+
}
|
1030
1041
|
|
1031
1042
|
// src/enhancement/walkNodeTree.ts
|
1032
1043
|
function walkNodeTree(node, visitor, options) {
|
@@ -1567,6 +1578,31 @@ function getNounForLocation(parentLocation) {
|
|
1567
1578
|
}
|
1568
1579
|
return noun;
|
1569
1580
|
}
|
1581
|
+
function getNounForNode(node) {
|
1582
|
+
let noun = "parameters";
|
1583
|
+
if (isEntryData(node)) {
|
1584
|
+
noun = "fields";
|
1585
|
+
}
|
1586
|
+
return noun;
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
// src/enhancement/findInNodeTree.ts
|
1590
|
+
function findParameterInNodeTree(data, predicate) {
|
1591
|
+
const results = [];
|
1592
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1593
|
+
const parameters = getPropertiesValue(node);
|
1594
|
+
if (parameters) {
|
1595
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1596
|
+
results.push({
|
1597
|
+
key,
|
1598
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1599
|
+
parameter: field
|
1600
|
+
});
|
1601
|
+
});
|
1602
|
+
}
|
1603
|
+
});
|
1604
|
+
return results;
|
1605
|
+
}
|
1570
1606
|
|
1571
1607
|
// src/enhancement/localize.ts
|
1572
1608
|
function extractLocales({ component }) {
|
@@ -2317,9 +2353,14 @@ function parseVariableExpression(serialized, onToken) {
|
|
2317
2353
|
continue;
|
2318
2354
|
}
|
2319
2355
|
if (char === variableSuffix && state === "variable") {
|
2356
|
+
if (serialized[index - 1] === escapeCharacter) {
|
2357
|
+
bufferEndIndex++;
|
2358
|
+
continue;
|
2359
|
+
}
|
2320
2360
|
state = "text";
|
2321
2361
|
if (bufferEndIndex > bufferStartIndex) {
|
2322
|
-
|
2362
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2363
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
2323
2364
|
return tokenCount;
|
2324
2365
|
}
|
2325
2366
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
@@ -2379,7 +2420,7 @@ import { produce } from "immer";
|
|
2379
2420
|
|
2380
2421
|
// src/utils/variables/createVariableReference.ts
|
2381
2422
|
function createVariableReference(variableName) {
|
2382
|
-
return `\${${variableName}}`;
|
2423
|
+
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
2383
2424
|
}
|
2384
2425
|
|
2385
2426
|
// src/utils/variables/bindVariablesToObject.ts
|
@@ -2463,6 +2504,9 @@ function handleRichTextNodeBinding(object, options) {
|
|
2463
2504
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
2464
2505
|
var CanvasClientError = ApiClientError2;
|
2465
2506
|
export {
|
2507
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2508
|
+
ASSETS_SOURCE_UNIFORM,
|
2509
|
+
ASSET_PARAMETER_TYPE,
|
2466
2510
|
ATTRIBUTE_COMPONENT_ID,
|
2467
2511
|
ATTRIBUTE_MULTILINE,
|
2468
2512
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2526,16 +2570,21 @@ export {
|
|
2526
2570
|
createVariableReference,
|
2527
2571
|
enhance,
|
2528
2572
|
extractLocales,
|
2573
|
+
findParameterInNodeTree,
|
2529
2574
|
generateComponentPlaceholderId,
|
2530
2575
|
generateHash,
|
2531
2576
|
getBlockValue,
|
2532
2577
|
getChannelName,
|
2533
2578
|
getComponentJsonPointer,
|
2534
2579
|
getComponentPath,
|
2580
|
+
getNounForLocation,
|
2581
|
+
getNounForNode,
|
2535
2582
|
getParameterAttributes,
|
2536
2583
|
getPropertiesValue,
|
2537
2584
|
isAddComponentMessage,
|
2538
2585
|
isAllowedReferrer,
|
2586
|
+
isAssetParamValue,
|
2587
|
+
isAssetParamValueItem,
|
2539
2588
|
isComponentActionMessage,
|
2540
2589
|
isComponentPlaceholderId,
|
2541
2590
|
isDismissPlaceholderMessage,
|
package/dist/index.js
CHANGED
@@ -277,6 +277,9 @@ var require_retry2 = __commonJS({
|
|
277
277
|
// src/index.ts
|
278
278
|
var src_exports = {};
|
279
279
|
__export(src_exports, {
|
280
|
+
ASSETS_SOURCE_CUSTOM_URL: () => ASSETS_SOURCE_CUSTOM_URL,
|
281
|
+
ASSETS_SOURCE_UNIFORM: () => ASSETS_SOURCE_UNIFORM,
|
282
|
+
ASSET_PARAMETER_TYPE: () => ASSET_PARAMETER_TYPE,
|
280
283
|
ATTRIBUTE_COMPONENT_ID: () => ATTRIBUTE_COMPONENT_ID,
|
281
284
|
ATTRIBUTE_MULTILINE: () => ATTRIBUTE_MULTILINE,
|
282
285
|
ATTRIBUTE_PARAMETER_ID: () => ATTRIBUTE_PARAMETER_ID,
|
@@ -340,16 +343,21 @@ __export(src_exports, {
|
|
340
343
|
createVariableReference: () => createVariableReference,
|
341
344
|
enhance: () => enhance,
|
342
345
|
extractLocales: () => extractLocales,
|
346
|
+
findParameterInNodeTree: () => findParameterInNodeTree,
|
343
347
|
generateComponentPlaceholderId: () => generateComponentPlaceholderId,
|
344
348
|
generateHash: () => generateHash,
|
345
349
|
getBlockValue: () => getBlockValue,
|
346
350
|
getChannelName: () => getChannelName,
|
347
351
|
getComponentJsonPointer: () => getComponentJsonPointer,
|
348
352
|
getComponentPath: () => getComponentPath,
|
353
|
+
getNounForLocation: () => getNounForLocation,
|
354
|
+
getNounForNode: () => getNounForNode,
|
349
355
|
getParameterAttributes: () => getParameterAttributes,
|
350
356
|
getPropertiesValue: () => getPropertiesValue,
|
351
357
|
isAddComponentMessage: () => isAddComponentMessage,
|
352
358
|
isAllowedReferrer: () => isAllowedReferrer,
|
359
|
+
isAssetParamValue: () => isAssetParamValue,
|
360
|
+
isAssetParamValueItem: () => isAssetParamValueItem,
|
353
361
|
isComponentActionMessage: () => isComponentActionMessage,
|
354
362
|
isComponentPlaceholderId: () => isComponentPlaceholderId,
|
355
363
|
isDismissPlaceholderMessage: () => isDismissPlaceholderMessage,
|
@@ -1114,6 +1122,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1114
1122
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1115
1123
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1116
1124
|
var EDGE_CACHE_DISABLED = -1;
|
1125
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1126
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1127
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1117
1128
|
|
1118
1129
|
// src/utils/entryConverter.ts
|
1119
1130
|
function convertEntryToPutEntry(entry) {
|
@@ -1141,6 +1152,14 @@ function isRootEntryReference(root) {
|
|
1141
1152
|
function isEntryData(entryData) {
|
1142
1153
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1143
1154
|
}
|
1155
|
+
function isAssetParamValue(value) {
|
1156
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1157
|
+
}
|
1158
|
+
function isAssetParamValueItem(item) {
|
1159
|
+
return Boolean(
|
1160
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1161
|
+
);
|
1162
|
+
}
|
1144
1163
|
|
1145
1164
|
// src/enhancement/walkNodeTree.ts
|
1146
1165
|
function walkNodeTree(node, visitor, options) {
|
@@ -1681,6 +1700,31 @@ function getNounForLocation(parentLocation) {
|
|
1681
1700
|
}
|
1682
1701
|
return noun;
|
1683
1702
|
}
|
1703
|
+
function getNounForNode(node) {
|
1704
|
+
let noun = "parameters";
|
1705
|
+
if (isEntryData(node)) {
|
1706
|
+
noun = "fields";
|
1707
|
+
}
|
1708
|
+
return noun;
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
// src/enhancement/findInNodeTree.ts
|
1712
|
+
function findParameterInNodeTree(data, predicate) {
|
1713
|
+
const results = [];
|
1714
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1715
|
+
const parameters = getPropertiesValue(node);
|
1716
|
+
if (parameters) {
|
1717
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1718
|
+
results.push({
|
1719
|
+
key,
|
1720
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1721
|
+
parameter: field
|
1722
|
+
});
|
1723
|
+
});
|
1724
|
+
}
|
1725
|
+
});
|
1726
|
+
return results;
|
1727
|
+
}
|
1684
1728
|
|
1685
1729
|
// src/enhancement/localize.ts
|
1686
1730
|
function extractLocales({ component }) {
|
@@ -2431,9 +2475,14 @@ function parseVariableExpression(serialized, onToken) {
|
|
2431
2475
|
continue;
|
2432
2476
|
}
|
2433
2477
|
if (char === variableSuffix && state === "variable") {
|
2478
|
+
if (serialized[index - 1] === escapeCharacter) {
|
2479
|
+
bufferEndIndex++;
|
2480
|
+
continue;
|
2481
|
+
}
|
2434
2482
|
state = "text";
|
2435
2483
|
if (bufferEndIndex > bufferStartIndex) {
|
2436
|
-
|
2484
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2485
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
2437
2486
|
return tokenCount;
|
2438
2487
|
}
|
2439
2488
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
@@ -2493,7 +2542,7 @@ var import_immer = require("immer");
|
|
2493
2542
|
|
2494
2543
|
// src/utils/variables/createVariableReference.ts
|
2495
2544
|
function createVariableReference(variableName) {
|
2496
|
-
return `\${${variableName}}`;
|
2545
|
+
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
2497
2546
|
}
|
2498
2547
|
|
2499
2548
|
// src/utils/variables/bindVariablesToObject.ts
|
@@ -2578,6 +2627,9 @@ var import_api10 = require("@uniformdev/context/api");
|
|
2578
2627
|
var CanvasClientError = import_api10.ApiClientError;
|
2579
2628
|
// Annotate the CommonJS export names for ESM import in node:
|
2580
2629
|
0 && (module.exports = {
|
2630
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2631
|
+
ASSETS_SOURCE_UNIFORM,
|
2632
|
+
ASSET_PARAMETER_TYPE,
|
2581
2633
|
ATTRIBUTE_COMPONENT_ID,
|
2582
2634
|
ATTRIBUTE_MULTILINE,
|
2583
2635
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2641,16 +2693,21 @@ var CanvasClientError = import_api10.ApiClientError;
|
|
2641
2693
|
createVariableReference,
|
2642
2694
|
enhance,
|
2643
2695
|
extractLocales,
|
2696
|
+
findParameterInNodeTree,
|
2644
2697
|
generateComponentPlaceholderId,
|
2645
2698
|
generateHash,
|
2646
2699
|
getBlockValue,
|
2647
2700
|
getChannelName,
|
2648
2701
|
getComponentJsonPointer,
|
2649
2702
|
getComponentPath,
|
2703
|
+
getNounForLocation,
|
2704
|
+
getNounForNode,
|
2650
2705
|
getParameterAttributes,
|
2651
2706
|
getPropertiesValue,
|
2652
2707
|
isAddComponentMessage,
|
2653
2708
|
isAllowedReferrer,
|
2709
|
+
isAssetParamValue,
|
2710
|
+
isAssetParamValueItem,
|
2654
2711
|
isComponentActionMessage,
|
2655
2712
|
isComponentPlaceholderId,
|
2656
2713
|
isDismissPlaceholderMessage,
|
package/dist/index.mjs
CHANGED
@@ -1000,6 +1000,9 @@ var EDGE_MIN_CACHE_TTL = 10;
|
|
1000
1000
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
1001
1001
|
var EDGE_DEFAULT_CACHE_TTL = 30;
|
1002
1002
|
var EDGE_CACHE_DISABLED = -1;
|
1003
|
+
var ASSET_PARAMETER_TYPE = "asset";
|
1004
|
+
var ASSETS_SOURCE_UNIFORM = "uniform-assets";
|
1005
|
+
var ASSETS_SOURCE_CUSTOM_URL = "custom-url";
|
1003
1006
|
|
1004
1007
|
// src/utils/entryConverter.ts
|
1005
1008
|
function convertEntryToPutEntry(entry) {
|
@@ -1027,6 +1030,14 @@ function isRootEntryReference(root) {
|
|
1027
1030
|
function isEntryData(entryData) {
|
1028
1031
|
return Boolean(entryData && typeof entryData === "object" && "fields" in entryData);
|
1029
1032
|
}
|
1033
|
+
function isAssetParamValue(value) {
|
1034
|
+
return Array.isArray(value) && (value.length > 0 ? isAssetParamValueItem(value[0]) : true);
|
1035
|
+
}
|
1036
|
+
function isAssetParamValueItem(item) {
|
1037
|
+
return Boolean(
|
1038
|
+
item instanceof Object && "_source" in item && "fields" in item && item.fields instanceof Object && "url" in item.fields && item.fields.url instanceof Object
|
1039
|
+
);
|
1040
|
+
}
|
1030
1041
|
|
1031
1042
|
// src/enhancement/walkNodeTree.ts
|
1032
1043
|
function walkNodeTree(node, visitor, options) {
|
@@ -1567,6 +1578,31 @@ function getNounForLocation(parentLocation) {
|
|
1567
1578
|
}
|
1568
1579
|
return noun;
|
1569
1580
|
}
|
1581
|
+
function getNounForNode(node) {
|
1582
|
+
let noun = "parameters";
|
1583
|
+
if (isEntryData(node)) {
|
1584
|
+
noun = "fields";
|
1585
|
+
}
|
1586
|
+
return noun;
|
1587
|
+
}
|
1588
|
+
|
1589
|
+
// src/enhancement/findInNodeTree.ts
|
1590
|
+
function findParameterInNodeTree(data, predicate) {
|
1591
|
+
const results = [];
|
1592
|
+
walkNodeTree(data, ({ node, ancestorsAndSelf }) => {
|
1593
|
+
const parameters = getPropertiesValue(node);
|
1594
|
+
if (parameters) {
|
1595
|
+
Object.entries(parameters).filter(([key, field]) => predicate(field, key, node)).forEach(([key, field]) => {
|
1596
|
+
results.push({
|
1597
|
+
key,
|
1598
|
+
pointer: (ancestorsAndSelf.length === 1 ? "" : getComponentJsonPointer(ancestorsAndSelf)) + `/${getNounForNode(node)}/${key}`,
|
1599
|
+
parameter: field
|
1600
|
+
});
|
1601
|
+
});
|
1602
|
+
}
|
1603
|
+
});
|
1604
|
+
return results;
|
1605
|
+
}
|
1570
1606
|
|
1571
1607
|
// src/enhancement/localize.ts
|
1572
1608
|
function extractLocales({ component }) {
|
@@ -2317,9 +2353,14 @@ function parseVariableExpression(serialized, onToken) {
|
|
2317
2353
|
continue;
|
2318
2354
|
}
|
2319
2355
|
if (char === variableSuffix && state === "variable") {
|
2356
|
+
if (serialized[index - 1] === escapeCharacter) {
|
2357
|
+
bufferEndIndex++;
|
2358
|
+
continue;
|
2359
|
+
}
|
2320
2360
|
state = "text";
|
2321
2361
|
if (bufferEndIndex > bufferStartIndex) {
|
2322
|
-
|
2362
|
+
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
2363
|
+
if (handleToken(unescapedVariableName, "variable") === false) {
|
2323
2364
|
return tokenCount;
|
2324
2365
|
}
|
2325
2366
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
@@ -2379,7 +2420,7 @@ import { produce } from "immer";
|
|
2379
2420
|
|
2380
2421
|
// src/utils/variables/createVariableReference.ts
|
2381
2422
|
function createVariableReference(variableName) {
|
2382
|
-
return `\${${variableName}}`;
|
2423
|
+
return `\${${variableName.replace(/([${}])/g, "\\$1")}}`;
|
2383
2424
|
}
|
2384
2425
|
|
2385
2426
|
// src/utils/variables/bindVariablesToObject.ts
|
@@ -2463,6 +2504,9 @@ function handleRichTextNodeBinding(object, options) {
|
|
2463
2504
|
import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
|
2464
2505
|
var CanvasClientError = ApiClientError2;
|
2465
2506
|
export {
|
2507
|
+
ASSETS_SOURCE_CUSTOM_URL,
|
2508
|
+
ASSETS_SOURCE_UNIFORM,
|
2509
|
+
ASSET_PARAMETER_TYPE,
|
2466
2510
|
ATTRIBUTE_COMPONENT_ID,
|
2467
2511
|
ATTRIBUTE_MULTILINE,
|
2468
2512
|
ATTRIBUTE_PARAMETER_ID,
|
@@ -2526,16 +2570,21 @@ export {
|
|
2526
2570
|
createVariableReference,
|
2527
2571
|
enhance,
|
2528
2572
|
extractLocales,
|
2573
|
+
findParameterInNodeTree,
|
2529
2574
|
generateComponentPlaceholderId,
|
2530
2575
|
generateHash,
|
2531
2576
|
getBlockValue,
|
2532
2577
|
getChannelName,
|
2533
2578
|
getComponentJsonPointer,
|
2534
2579
|
getComponentPath,
|
2580
|
+
getNounForLocation,
|
2581
|
+
getNounForNode,
|
2535
2582
|
getParameterAttributes,
|
2536
2583
|
getPropertiesValue,
|
2537
2584
|
isAddComponentMessage,
|
2538
2585
|
isAllowedReferrer,
|
2586
|
+
isAssetParamValue,
|
2587
|
+
isAssetParamValueItem,
|
2539
2588
|
isComponentActionMessage,
|
2540
2589
|
isComponentPlaceholderId,
|
2541
2590
|
isDismissPlaceholderMessage,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.80.
|
3
|
+
"version": "19.80.1-alpha.126+d56efea3e7",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -31,16 +31,16 @@
|
|
31
31
|
"document": "api-extractor run --local"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
|
-
"@types/retry": "0.12.
|
34
|
+
"@types/retry": "0.12.5",
|
35
35
|
"lexical": "^0.12.0",
|
36
36
|
"p-retry": "5.1.2",
|
37
37
|
"p-throttle": "5.0.0",
|
38
38
|
"pusher-js": "8.2.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "19.80.
|
42
|
-
"@uniformdev/context": "19.80.
|
43
|
-
"immer": "
|
41
|
+
"@uniformdev/assets": "19.80.1-alpha.126+d56efea3e7",
|
42
|
+
"@uniformdev/context": "19.80.1-alpha.126+d56efea3e7",
|
43
|
+
"immer": "10.0.3"
|
44
44
|
},
|
45
45
|
"files": [
|
46
46
|
"/dist"
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"publishConfig": {
|
49
49
|
"access": "public"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "d56efea3e70e67bae1bad2f6f181c93d3dfb857c"
|
52
52
|
}
|