@spiffcommerce/core 0.2.9 → 0.3.1

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/types.d.ts CHANGED
@@ -21,6 +21,45 @@ interface WorkflowScenesConfiguration {
21
21
  finishScene: boolean;
22
22
  finishSceneTitle: string;
23
23
  }
24
+ /**
25
+ * A queue promise is a container for a promise that can be
26
+ * executed at a later time.
27
+ */
28
+ export abstract class QueueablePromise {
29
+ readonly timestamp: number;
30
+ abstract execute(): Promise<any>;
31
+ }
32
+ /**
33
+ * A promise queue contains any number of QueuePromise objects. These objects are stored within a PromiseQueue and executed
34
+ * as quickly as possible in order. This is ideal in situations where a specific operation should be
35
+ * applied in an ordered way while still making.
36
+ */
37
+ export class PromiseQueue<T extends QueueablePromise> {
38
+ /**
39
+ * Constructs a new promise queue.
40
+ * @param queueMaxSize An optional maximum size, when the max size is hit.
41
+ * The older promises will be discarded.
42
+ */
43
+ constructor(queueMaxSize?: number);
44
+ /**
45
+ * Enqueue a new promise.
46
+ * @param promise A new promise to add to the queue.
47
+ */
48
+ enqueue(promise: T): Promise<void>;
49
+ /**
50
+ * @returns Returns true when work is being actively processed by this queue.
51
+ */
52
+ hasActivePromise(): boolean;
53
+ /**
54
+ * @returns The number of unexecuted jobs remaining in the queue. Not including the active job.
55
+ */
56
+ getRemainingQueueSize(): number;
57
+ /**
58
+ * Finalize the queue, any jobs that come in while this is in progress will result
59
+ * in the promise being extended.
60
+ */
61
+ finalize(): Promise<void>;
62
+ }
24
63
  export class FrameService {
25
64
  minZoomScale: number;
26
65
  maxZoomScale: number;
@@ -632,7 +671,7 @@ interface TextMetadata {
632
671
  color?: string;
633
672
  text: string;
634
673
  }
635
- interface SelectionStorage {
674
+ export interface SelectionStorage {
636
675
  selectedVariants?: VariantResource[];
637
676
  }
638
677
  interface TextStepStorage extends SelectionStorage {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",