@spiffcommerce/core 16.7.0 → 16.8.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.ts CHANGED
@@ -2913,4 +2913,27 @@ declare class InformationStepHandle extends StepHandle<InformationStepData> {
2913
2913
  getContent(): string;
2914
2914
  }
2915
2915
 
2916
- export { AssetNotFoundError, BulkPriceCalculationStrategy, BulkStepHandle, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, VariationRecord, Vector3, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, gatherVaryingStepAspects, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
2916
+ /**
2917
+ * A simple cache for promises. Helpful to avoid making multiple requests for the same data.
2918
+ */
2919
+ declare class PromiseCache {
2920
+ private cache;
2921
+ private disabled;
2922
+ /**
2923
+ * Gets a promise from the cache, or undefined if it doesn't exist.
2924
+ */
2925
+ get(key: object): Promise<any> | undefined;
2926
+ /**
2927
+ * Sets a promise in the cache and returns it.
2928
+ */
2929
+ set(key: object, promise: Promise<any>): Promise<any>;
2930
+ /**
2931
+ * Some environments don't want workflows to be cached. An example is a server
2932
+ * that doesn't launch a fresh instance per request. This method allows disabling
2933
+ * caching in a transparent way.
2934
+ */
2935
+ disable(value: boolean): void;
2936
+ }
2937
+ declare const promiseCache: PromiseCache;
2938
+
2939
+ export { AssetNotFoundError, BulkPriceCalculationStrategy, BulkStepHandle, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, VariationRecord, Vector3, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, gatherVaryingStepAspects, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
package/dist/index.js CHANGED
@@ -529,12 +529,14 @@ class LA {
529
529
  const T = new $t();
530
530
  class _t {
531
531
  constructor() {
532
- this.cache = {};
532
+ this.cache = {}, this.disabled = !1;
533
533
  }
534
534
  /**
535
535
  * Gets a promise from the cache, or undefined if it doesn't exist.
536
536
  */
537
537
  get(A) {
538
+ if (this.disabled)
539
+ return;
538
540
  const e = JSON.stringify(A);
539
541
  return this.cache[e];
540
542
  }
@@ -542,9 +544,19 @@ class _t {
542
544
  * Sets a promise in the cache and returns it.
543
545
  */
544
546
  set(A, e) {
547
+ if (this.disabled)
548
+ return e;
545
549
  const t = JSON.stringify(A);
546
550
  return this.cache[t] = e, e;
547
551
  }
552
+ /**
553
+ * Some environments don't want workflows to be cached. An example is a server
554
+ * that doesn't launch a fresh instance per request. This method allows disabling
555
+ * caching in a transparent way.
556
+ */
557
+ disable(A) {
558
+ this.disabled = A;
559
+ }
548
560
  }
549
561
  const BA = new _t(), je = y`
550
562
  fragment OptionFields on Option {
@@ -10795,6 +10807,7 @@ export {
10795
10807
  sa as ProductCameraRig,
10796
10808
  As as ProductCollection,
10797
10809
  De as ProductWorkflow,
10810
+ BA as PromiseCache,
10798
10811
  qe as PromiseQueue,
10799
10812
  en as QuestionStepHandle,
10800
10813
  Xe as QueueablePromise,