@leaddreamer/inventorylogic 0.0.3-beta.39 → 0.0.3-beta.40

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/README.md CHANGED
@@ -62,6 +62,10 @@ users</p>
62
62
  <dd><p>Typedefs, constants, support functions and database operations related to usage Units
63
63
  and conversions</p>
64
64
  </dd>
65
+ <dt><a href="#module_Utilities">Utilities</a></dt>
66
+ <dd><p>Typedefs, constants, support functions and database operations for
67
+ general Utilities</p>
68
+ </dd>
65
69
  <dt><a href="#module_Boilerplate">Boilerplate</a></dt>
66
70
  <dd><p>Shared constants and symbols</p>
67
71
  </dd>
@@ -2422,11 +2426,29 @@ and conversions
2422
2426
  * [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
2423
2427
  * [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
2424
2428
  * [.choicesForm(fieldname)](#module_Utilities.choicesForm) ⇒ <code>object</code>
2429
+ * [.saveHost(host)](#module_Utilities.saveHost) ⇒ <code>Promise.OrganizationType</code>
2430
+ * [.simpleObjectCompare(object1, object2)](#module_Utilities.simpleObjectCompare) ⇒ <code>boolean</code>
2431
+ * [.formatItem(thisItem, thisFormat)](#module_Utilities.formatItem) ⇒ <code>string</code>
2432
+ * [.compare(thisItem, anotherItem, sort)](#module_Utilities.compare) ⇒ <code>string</code>
2433
+ * [.anyInAny(findFrom, findIn)](#module_Utilities.anyInAny) ⇒ <code>boolean</code>
2434
+ * [.PromisePoolRunner(entryArray, actionFunction, promiseOptions)](#module_Utilities.PromisePoolRunner) ⇒ <code>Promise</code>
2435
+ * [.lesserOf(args)](#module_Utilities.lesserOf) ⇒ <code>number</code>
2436
+ * [.largerOf(args)](#module_Utilities.largerOf) ⇒ <code>number</code>
2437
+ * [.archiveRecord(record)](#module_Utilities.archiveRecord) ⇒ <code>Promise</code>
2438
+ * [.refPathToBaseRecord(refPath)](#module_Utilities.refPathToBaseRecord) ⇒ <code>RecordDocument</code>
2439
+ * [.bound(value, lowerBound, upperBound)](#module_Utilities.bound) ⇒ <code>number</code>
2440
+ * [.blindPush(targetArray, newObject)](#module_Utilities.blindPush)
2441
+ * [.addToArrayObject(arrayObject, key, object)](#module_Utilities.addToArrayObject)
2442
+ * [.makeHexAsNeeded(color)](#module_Utilities.makeHexAsNeeded) ⇒ <code>string</code>
2425
2443
  * _inner_
2444
+ * [~PromisePool](#module_Utilities..PromisePool)
2445
+ * [~promiseOptionsDefault](#module_Utilities..promiseOptionsDefault) : <code>PromiseOptions</code>
2426
2446
  * [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
2427
2447
  * [~UpdateChange
2428
2448
  Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject)](#module_Utilities..UpdateChange
2429
2449
  Function Signature for UpdateChange functions) ⇒ <code>object</code>
2450
+ * [~generateIterator(entryArray, actionFunction)](#module_Utilities..generateIterator)
2451
+ * [~PromiseOptions](#module_Utilities..PromiseOptions) : <code>object</code>
2430
2452
 
2431
2453
  <a name="module_Utilities.recordByIdAndType"></a>
2432
2454
 
@@ -2677,6 +2699,182 @@ usage are defined in business logic elsewhere
2677
2699
  | --- | --- | --- |
2678
2700
  | fieldname | <code>string</code> | which business type is being processes |
2679
2701
 
2702
+ <a name="module_Utilities.saveHost"></a>
2703
+
2704
+ ### Utilities.saveHost(host) ⇒ <code>Promise.OrganizationType</code>
2705
+ A convenience function for some shared artist/host front-end pages
2706
+
2707
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2708
+
2709
+ | Param | Type |
2710
+ | --- | --- |
2711
+ | host | <code>OrganizationType</code> |
2712
+
2713
+ <a name="module_Utilities.simpleObjectCompare"></a>
2714
+
2715
+ ### Utilities.simpleObjectCompare(object1, object2) ⇒ <code>boolean</code>
2716
+ Simple top-level object compare - assumes objects have similar structure - or
2717
+ AT LEAST all the fields of object1 are present in object2
2718
+
2719
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2720
+
2721
+ | Param | Type |
2722
+ | --- | --- |
2723
+ | object1 | <code>object</code> |
2724
+ | object2 | <code>object</code> |
2725
+
2726
+ <a name="module_Utilities.formatItem"></a>
2727
+
2728
+ ### Utilities.formatItem(thisItem, thisFormat) ⇒ <code>string</code>
2729
+ Allows string substitution from an object
2730
+ field names support Dot notation
2731
+ field names allow ":" extension for alternate formatting
2732
+
2733
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2734
+
2735
+ | Param | Type | Description |
2736
+ | --- | --- | --- |
2737
+ | thisItem | <code>object</code> | object to create formated string from |
2738
+ | thisFormat | <code>string</code> | string describing formatted output - fieldname wrapped in {} will be substituted. DOT notation allowed for fields. |
2739
+
2740
+ <a name="module_Utilities.compare"></a>
2741
+
2742
+ ### Utilities.compare(thisItem, anotherItem, sort) ⇒ <code>string</code>
2743
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2744
+
2745
+ | Param | Type | Description |
2746
+ | --- | --- | --- |
2747
+ | thisItem | <code>object</code> | one of two objects being compared |
2748
+ | anotherItem | <code>object</code> | the other of two objects being compared |
2749
+ | sort | <code>string</code> | string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |
2750
+
2751
+ <a name="module_Utilities.anyInAny"></a>
2752
+
2753
+ ### Utilities.anyInAny(findFrom, findIn) ⇒ <code>boolean</code>
2754
+ An array based compare function - is any entry of findFrom present in findIn
2755
+
2756
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2757
+
2758
+ | Param | Type |
2759
+ | --- | --- |
2760
+ | findFrom | <code>Array.any</code> |
2761
+ | findIn | <code>Array.any</code> |
2762
+
2763
+ <a name="module_Utilities.PromisePoolRunner"></a>
2764
+
2765
+ ### Utilities.PromisePoolRunner(entryArray, actionFunction, promiseOptions) ⇒ <code>Promise</code>
2766
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2767
+
2768
+ | Param | Type |
2769
+ | --- | --- |
2770
+ | entryArray | <code>Array.object</code> |
2771
+ | actionFunction | <code>callback</code> |
2772
+ | promiseOptions | <code>PromiseOptions</code> |
2773
+
2774
+ <a name="module_Utilities.lesserOf"></a>
2775
+
2776
+ ### Utilities.lesserOf(args) ⇒ <code>number</code>
2777
+ A convenience function for legibility
2778
+
2779
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2780
+ **Returns**: <code>number</code> - the least of any of the arguments
2781
+ b
2782
+
2783
+ | Param | Type | Description |
2784
+ | --- | --- | --- |
2785
+ | args | <code>any</code> | unbounded list of arguments |
2786
+
2787
+ <a name="module_Utilities.largerOf"></a>
2788
+
2789
+ ### Utilities.largerOf(args) ⇒ <code>number</code>
2790
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2791
+ **Returns**: <code>number</code> - the largest of any of the arguments
2792
+
2793
+ | Param | Type | Description |
2794
+ | --- | --- | --- |
2795
+ | args | <code>any</code> | unbounded list of arguments |
2796
+
2797
+ <a name="module_Utilities.archiveRecord"></a>
2798
+
2799
+ ### Utilities.archiveRecord(record) ⇒ <code>Promise</code>
2800
+ "Moves" a record from our standard tree structureto a parallel archival
2801
+ structure, by prepending a "_" to the collection names in the path
2802
+ This prevents the archived record from appearing in collectionGroup queries
2803
+
2804
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2805
+
2806
+ | Param | Type |
2807
+ | --- | --- |
2808
+ | record | <code>RecordDocument</code> |
2809
+ | record.refPath | <code>string</code> |
2810
+
2811
+ <a name="module_Utilities.refPathToBaseRecord"></a>
2812
+
2813
+ ### Utilities.refPathToBaseRecord(refPath) ⇒ <code>RecordDocument</code>
2814
+ uses a passed refPath to create the most basic document record form
2815
+
2816
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2817
+
2818
+ | Param | Type | Description |
2819
+ | --- | --- | --- |
2820
+ | refPath | <code>string</code> | "/" separated document path reference |
2821
+
2822
+ <a name="module_Utilities.bound"></a>
2823
+
2824
+ ### Utilities.bound(value, lowerBound, upperBound) ⇒ <code>number</code>
2825
+ clips value to given bounds
2826
+
2827
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2828
+
2829
+ | Param | Type |
2830
+ | --- | --- |
2831
+ | value | <code>number</code> |
2832
+ | lowerBound | <code>number</code> |
2833
+ | upperBound | <code>number</code> |
2834
+
2835
+ <a name="module_Utilities.blindPush"></a>
2836
+
2837
+ ### Utilities.blindPush(targetArray, newObject)
2838
+ function to push an element to an array which may not be initialized
2839
+
2840
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2841
+
2842
+ | Param | Type |
2843
+ | --- | --- |
2844
+ | targetArray | <code>Array.object</code> |
2845
+ | newObject | <code>object</code> |
2846
+
2847
+ <a name="module_Utilities.addToArrayObject"></a>
2848
+
2849
+ ### Utilities.addToArrayObject(arrayObject, key, object)
2850
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2851
+
2852
+ | Param | Type | Description |
2853
+ | --- | --- | --- |
2854
+ | arrayObject | <code>Array.Array.object</code> | |
2855
+ | key | <code>string</code> | key or index to choose which Array.object to add *this* object to |
2856
+ | object | <code>object</code> | |
2857
+
2858
+ <a name="module_Utilities.makeHexAsNeeded"></a>
2859
+
2860
+ ### Utilities.makeHexAsNeeded(color) ⇒ <code>string</code>
2861
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2862
+ **Returns**: <code>string</code> - hex value of named color
2863
+
2864
+ | Param | Type | Description |
2865
+ | --- | --- | --- |
2866
+ | color | <code>string</code> | name of color |
2867
+
2868
+ <a name="module_Utilities..PromisePool"></a>
2869
+
2870
+ ### Utilities~PromisePool
2871
+ **Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)
2872
+ <a name="module_Utilities..promiseOptionsDefault"></a>
2873
+
2874
+ ### Utilities~promiseOptionsDefault : <code>PromiseOptions</code>
2875
+ **Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)
2876
+ **Default**: <code>{&quot;concurrency&quot;:3,&quot;rate&quot;:10}</code>
2877
+ **Read only**: true
2680
2878
  <a name="module_Utilities..stripDocIdFromRefPath"></a>
2681
2879
 
2682
2880
  ### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>
@@ -2703,6 +2901,560 @@ Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceOb
2703
2901
  | itemFor | <code>string</code> |
2704
2902
  | fullChoiceObject | <code>object</code> |
2705
2903
 
2904
+ <a name="module_Utilities..generateIterator"></a>
2905
+
2906
+ ### Utilities~generateIterator(entryArray, actionFunction)
2907
+ An Action Iterator Generator. Cycles through the entries in the passed array,
2908
+ yielding the result of a function for each entry.
2909
+ Only cares that inputs are an array, and a function that returns a
2910
+ promise
2911
+
2912
+ **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
2913
+
2914
+ | Param | Type |
2915
+ | --- | --- |
2916
+ | entryArray | <code>Array.any</code> |
2917
+ | actionFunction | <code>callback</code> |
2918
+
2919
+ <a name="module_Utilities..PromiseOptions"></a>
2920
+
2921
+ ### Utilities~PromiseOptions : <code>object</code>
2922
+ **Kind**: inner typedef of [<code>Utilities</code>](#module_Utilities)
2923
+ **Properties**
2924
+
2925
+ | Name | Type |
2926
+ | --- | --- |
2927
+ | concurrency | <code>number</code> |
2928
+ | rate | <code>number</code> |
2929
+
2930
+ <a name="module_Utilities"></a>
2931
+
2932
+ ## Utilities
2933
+ Typedefs, constants, support functions and database operations for
2934
+ general Utilities
2935
+
2936
+
2937
+ * [Utilities](#module_Utilities)
2938
+ * _static_
2939
+ * [.recordByIdAndType](#module_Utilities.recordByIdAndType) ⇒ <code>AccountType</code>
2940
+ * [.fetchLinkedItem(type, link, refPath)](#module_Utilities.fetchLinkedItem) ⇒ <code>Promise.RecordDocument</code>
2941
+ * [.fetchSubItem(type, refPath)](#module_Utilities.fetchSubItem) ⇒ <code>Promise.RecordDocument</code>
2942
+ * [.fetchType(type, refPath)](#module_Utilities.fetchType) ⇒ <code>Promise.Array.RecordDocument</code>
2943
+ * [.searchType(type, parent, prompt, limit)](#module_Utilities.searchType) ⇒ <code>Promise.Array.OrganizationType</code>
2944
+ * [.typedRecordFromChild(type, child)](#module_Utilities.typedRecordFromChild) ⇒ <code>Record</code>
2945
+ * [.typedSortArray(type)](#module_Utilities.typedSortArray) ⇒ <code>Array.SortObject</code>
2946
+ * [.processItemType(item, type, refPath)](#module_Utilities.processItemType) ⇒ <code>Promise.RecordDocument</code>
2947
+ * [.formatLinkedItem(link, type, refPath)](#module_Utilities.formatLinkedItem) ⇒ <code>Promise.string</code>
2948
+ * [.summarizeItem(item, type)](#module_Utilities.summarizeItem) ⇒ <code>string</code>
2949
+ * [.baseItem(type)](#module_Utilities.baseItem) ⇒ <code>object</code>
2950
+ * [.baseForm(type)](#module_Utilities.baseForm) ⇒ <code>object</code>
2951
+ * [.dataForm(type)](#module_Utilities.dataForm) ⇒ <code>object</code>
2952
+ * [.createForm(type)](#module_Utilities.createForm) ⇒ <code>object</code>
2953
+ * [.accountForm(type)](#module_Utilities.accountForm) ⇒ <code>object</code>
2954
+ * [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
2955
+ * [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
2956
+ * [.choicesForm(fieldname)](#module_Utilities.choicesForm) ⇒ <code>object</code>
2957
+ * [.saveHost(host)](#module_Utilities.saveHost) ⇒ <code>Promise.OrganizationType</code>
2958
+ * [.simpleObjectCompare(object1, object2)](#module_Utilities.simpleObjectCompare) ⇒ <code>boolean</code>
2959
+ * [.formatItem(thisItem, thisFormat)](#module_Utilities.formatItem) ⇒ <code>string</code>
2960
+ * [.compare(thisItem, anotherItem, sort)](#module_Utilities.compare) ⇒ <code>string</code>
2961
+ * [.anyInAny(findFrom, findIn)](#module_Utilities.anyInAny) ⇒ <code>boolean</code>
2962
+ * [.PromisePoolRunner(entryArray, actionFunction, promiseOptions)](#module_Utilities.PromisePoolRunner) ⇒ <code>Promise</code>
2963
+ * [.lesserOf(args)](#module_Utilities.lesserOf) ⇒ <code>number</code>
2964
+ * [.largerOf(args)](#module_Utilities.largerOf) ⇒ <code>number</code>
2965
+ * [.archiveRecord(record)](#module_Utilities.archiveRecord) ⇒ <code>Promise</code>
2966
+ * [.refPathToBaseRecord(refPath)](#module_Utilities.refPathToBaseRecord) ⇒ <code>RecordDocument</code>
2967
+ * [.bound(value, lowerBound, upperBound)](#module_Utilities.bound) ⇒ <code>number</code>
2968
+ * [.blindPush(targetArray, newObject)](#module_Utilities.blindPush)
2969
+ * [.addToArrayObject(arrayObject, key, object)](#module_Utilities.addToArrayObject)
2970
+ * [.makeHexAsNeeded(color)](#module_Utilities.makeHexAsNeeded) ⇒ <code>string</code>
2971
+ * _inner_
2972
+ * [~PromisePool](#module_Utilities..PromisePool)
2973
+ * [~promiseOptionsDefault](#module_Utilities..promiseOptionsDefault) : <code>PromiseOptions</code>
2974
+ * [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
2975
+ * [~UpdateChange
2976
+ Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject)](#module_Utilities..UpdateChange
2977
+ Function Signature for UpdateChange functions) ⇒ <code>object</code>
2978
+ * [~generateIterator(entryArray, actionFunction)](#module_Utilities..generateIterator)
2979
+ * [~PromiseOptions](#module_Utilities..PromiseOptions) : <code>object</code>
2980
+
2981
+ <a name="module_Utilities.recordByIdAndType"></a>
2982
+
2983
+ ### Utilities.recordByIdAndType ⇒ <code>AccountType</code>
2984
+ creates and returns a minimal record from an Id and `type`
2985
+
2986
+ **Kind**: static constant of [<code>Utilities</code>](#module_Utilities)
2987
+
2988
+ | Param | Type |
2989
+ | --- | --- |
2990
+ | Id | <code>string</code> |
2991
+ | Type | <code>string</code> |
2992
+
2993
+ <a name="module_Utilities.fetchLinkedItem"></a>
2994
+
2995
+ ### Utilities.fetchLinkedItem(type, link, refPath) ⇒ <code>Promise.RecordDocument</code>
2996
+ used generic for constructing forms for input and display
2997
+
2998
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
2999
+
3000
+ | Param | Type | Description |
3001
+ | --- | --- | --- |
3002
+ | type | <code>string</code> | refers to the sub-collection name |
3003
+ | link | <code>string</code> | refers to the linking "value" - a documentID |
3004
+ | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
3005
+
3006
+ <a name="module_Utilities.fetchSubItem"></a>
3007
+
3008
+ ### Utilities.fetchSubItem(type, refPath) ⇒ <code>Promise.RecordDocument</code>
3009
+ some items are stored in the database as a single-record collection, using
3010
+ the same Id as the parent
3011
+
3012
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3013
+
3014
+ | Param | Type | Description |
3015
+ | --- | --- | --- |
3016
+ | type | <code>string</code> | refers to the sub-collection name |
3017
+ | refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
3018
+
3019
+ <a name="module_Utilities.fetchType"></a>
3020
+
3021
+ ### Utilities.fetchType(type, refPath) ⇒ <code>Promise.Array.RecordDocument</code>
3022
+ returns an entire sub-collection by "type" (sub-collection name).
3023
+ If refpath is omitted, assumes "type" is a top-level collection
3024
+
3025
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3026
+
3027
+ | Param | Type | Description |
3028
+ | --- | --- | --- |
3029
+ | type | <code>string</code> | refers to the sub-collection name |
3030
+ | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
3031
+
3032
+ <a name="module_Utilities.searchType"></a>
3033
+
3034
+ ### Utilities.searchType(type, parent, prompt, limit) ⇒ <code>Promise.Array.OrganizationType</code>
3035
+ returns a Promise which resolves to an array of all Type's whose
3036
+ name begins with the provided prompt, optionally limited to a provided number
3037
+ CASE SENSITIVE FOR NOW
3038
+
3039
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3040
+
3041
+ | Param | Type | Description |
3042
+ | --- | --- | --- |
3043
+ | type | <code>string</code> | type of record to search |
3044
+ | parent | <code>Record</code> | parent object of records, if any |
3045
+ | prompt | <code>string</code> | Used to query for matching records |
3046
+ | limit | <code>string</code> \| <code>number</code> | Used to limit the number of results |
3047
+
3048
+ <a name="module_Utilities.typedRecordFromChild"></a>
3049
+
3050
+ ### Utilities.typedRecordFromChild(type, child) ⇒ <code>Record</code>
3051
+ builds a representation of a parent from a child, by type
3052
+
3053
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3054
+
3055
+ | Param | Type |
3056
+ | --- | --- |
3057
+ | type | <code>string</code> |
3058
+ | child | <code>Record</code> |
3059
+
3060
+ <a name="module_Utilities.typedSortArray"></a>
3061
+
3062
+ ### Utilities.typedSortArray(type) ⇒ <code>Array.SortObject</code>
3063
+ Firebase query support - builds default sort options
3064
+
3065
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3066
+
3067
+ | Param | Type |
3068
+ | --- | --- |
3069
+ | type | <code>string</code> |
3070
+
3071
+ <a name="module_Utilities.processItemType"></a>
3072
+
3073
+ ### Utilities.processItemType(item, type, refPath) ⇒ <code>Promise.RecordDocument</code>
3074
+ generic form data processing for database by "type" (collection name)
3075
+
3076
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3077
+
3078
+ | Param | Type | Description |
3079
+ | --- | --- | --- |
3080
+ | item | <code>RecordDocument</code> | |
3081
+ | type | <code>string</code> | refers to the sub-collection name |
3082
+ | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
3083
+
3084
+ <a name="module_Utilities.formatLinkedItem"></a>
3085
+
3086
+ ### Utilities.formatLinkedItem(link, type, refPath) ⇒ <code>Promise.string</code>
3087
+ fetches a sub-record from the database and returns the result as a summary string
3088
+
3089
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3090
+
3091
+ | Param | Type | Description |
3092
+ | --- | --- | --- |
3093
+ | link | <code>string</code> | refers to the linking "value" - a documentID |
3094
+ | type | <code>string</code> | refers to the sub-collection name |
3095
+ | refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
3096
+
3097
+ <a name="module_Utilities.summarizeItem"></a>
3098
+
3099
+ ### Utilities.summarizeItem(item, type) ⇒ <code>string</code>
3100
+ parameterized function to return string summary of an object
3101
+ By default, returns the "name" property of the item.
3102
+
3103
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3104
+
3105
+ | Param | Type | Description |
3106
+ | --- | --- | --- |
3107
+ | item | <code>object</code> | data object to summarize |
3108
+ | type | <code>String</code> \| <code>&quot;User&quot;</code> \| <code>&quot;Product&quot;</code> \| <code>&quot;LineItem&quot;</code> \| <code>&quot;Commodities&quot;</code> \| <code>&quot;Units&quot;</code> | - type of the object to summarize |
3109
+
3110
+ <a name="module_Utilities.baseItem"></a>
3111
+
3112
+ ### Utilities.baseItem(type) ⇒ <code>object</code>
3113
+ Convenience function to mask actual Forms array from the front-end
3114
+ This version returns the "base" item sample for a business-object type,
3115
+ where the keys are the field/property names, and the values are the
3116
+ default values as defined in the business logic
3117
+
3118
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3119
+ **Returns**: <code>object</code> - keys and default values
3120
+
3121
+ | Param | Type |
3122
+ | --- | --- |
3123
+ | type | <code>string</code> |
3124
+
3125
+ <a name="module_Utilities.baseForm"></a>
3126
+
3127
+ ### Utilities.baseForm(type) ⇒ <code>object</code>
3128
+ Convenience function to mask actual Forms array from the front-end
3129
+ This version returns the "baseForm" withe keys/properties, and
3130
+ values are strings with ":" separated definitions for EditForm and
3131
+ similar functionality - see "EditForm" for more details
3132
+
3133
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3134
+ **Returns**: <code>object</code> - keys and default values
3135
+
3136
+ | Param | Type |
3137
+ | --- | --- |
3138
+ | type | <code>string</code> |
3139
+
3140
+ <a name="module_Utilities.dataForm"></a>
3141
+
3142
+ ### Utilities.dataForm(type) ⇒ <code>object</code>
3143
+ Convenience function to mask actual Forms array from the front-end
3144
+ This version returns the "Data" object with keys/properties, and
3145
+ values are strings with ":" separated definitions for Faker and
3146
+ similar functionality - to generate "fake" simulated data for testing
3147
+
3148
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3149
+ **Returns**: <code>object</code> - keys and default values
3150
+
3151
+ | Param | Type |
3152
+ | --- | --- |
3153
+ | type | <code>string</code> |
3154
+
3155
+ <a name="module_Utilities.createForm"></a>
3156
+
3157
+ ### Utilities.createForm(type) ⇒ <code>object</code>
3158
+ Convenience function to mask actual Forms array from the front-end
3159
+ This version returns the "createForm" withe keys/properties, and
3160
+ values are strings with ":" separated definitions for EditForm and
3161
+ similar functionality - see "EditForm" for more details
3162
+ Specifically for limited "front-end" use to CREATE new
3163
+ business-objects with the minimum entries necessary
3164
+
3165
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3166
+ **Returns**: <code>object</code> - keys and default values
3167
+
3168
+ | Param | Type |
3169
+ | --- | --- |
3170
+ | type | <code>string</code> |
3171
+
3172
+ <a name="module_Utilities.accountForm"></a>
3173
+
3174
+ ### Utilities.accountForm(type) ⇒ <code>object</code>
3175
+ Convenience function to mask actual Forms array from the front-end
3176
+ This version returns the "createForm" withe keys/properties, and
3177
+ values are strings with ":" separated definitions for EditForm and
3178
+ similar functionality - see "EditForm" for more details
3179
+ Specifically for limited "front-end" use on ACCOUNT business-objects
3180
+ with the minimum entries necessary
3181
+
3182
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3183
+ **Returns**: <code>object</code> - keys and default values
3184
+
3185
+ | Param | Type |
3186
+ | --- | --- |
3187
+ | type | <code>string</code> |
3188
+
3189
+ <a name="module_Utilities.saveForm"></a>
3190
+
3191
+ ### Utilities.saveForm(type) ⇒ <code>callback</code>
3192
+ Convenience function to mask actual Forms array from the front-end
3193
+ This version returns a FUNCTION to use for saving a business-object
3194
+ to the database - abstracting type-specific features and functionality
3195
+ from the front end
3196
+
3197
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3198
+
3199
+ | Param | Type |
3200
+ | --- | --- |
3201
+ | type | <code>string</code> |
3202
+
3203
+ <a name="module_Utilities.updateChangeForm"></a>
3204
+
3205
+ ### Utilities.updateChangeForm(type) ⇒ <code>callback</code>
3206
+ Convenience function to mask actual Forms array from the front-end
3207
+ This version returns a FUNCTION to respond to cross-field dependent
3208
+ chnages during editing with EditForm, reactdatagrid, etc
3209
+
3210
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3211
+
3212
+ | Param | Type |
3213
+ | --- | --- |
3214
+ | type | <code>string</code> |
3215
+
3216
+ <a name="module_Utilities.choicesForm"></a>
3217
+
3218
+ ### Utilities.choicesForm(fieldname) ⇒ <code>object</code>
3219
+ Returns an object whose keys are the available choices for a
3220
+ business-object field, and whose values represent the sort order
3221
+ Most fieldname have no such choices. Both the definitions and
3222
+ usage are defined in business logic elsewhere
3223
+
3224
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3225
+
3226
+ | Param | Type | Description |
3227
+ | --- | --- | --- |
3228
+ | fieldname | <code>string</code> | which business type is being processes |
3229
+
3230
+ <a name="module_Utilities.saveHost"></a>
3231
+
3232
+ ### Utilities.saveHost(host) ⇒ <code>Promise.OrganizationType</code>
3233
+ A convenience function for some shared artist/host front-end pages
3234
+
3235
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3236
+
3237
+ | Param | Type |
3238
+ | --- | --- |
3239
+ | host | <code>OrganizationType</code> |
3240
+
3241
+ <a name="module_Utilities.simpleObjectCompare"></a>
3242
+
3243
+ ### Utilities.simpleObjectCompare(object1, object2) ⇒ <code>boolean</code>
3244
+ Simple top-level object compare - assumes objects have similar structure - or
3245
+ AT LEAST all the fields of object1 are present in object2
3246
+
3247
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3248
+
3249
+ | Param | Type |
3250
+ | --- | --- |
3251
+ | object1 | <code>object</code> |
3252
+ | object2 | <code>object</code> |
3253
+
3254
+ <a name="module_Utilities.formatItem"></a>
3255
+
3256
+ ### Utilities.formatItem(thisItem, thisFormat) ⇒ <code>string</code>
3257
+ Allows string substitution from an object
3258
+ field names support Dot notation
3259
+ field names allow ":" extension for alternate formatting
3260
+
3261
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3262
+
3263
+ | Param | Type | Description |
3264
+ | --- | --- | --- |
3265
+ | thisItem | <code>object</code> | object to create formated string from |
3266
+ | thisFormat | <code>string</code> | string describing formatted output - fieldname wrapped in {} will be substituted. DOT notation allowed for fields. |
3267
+
3268
+ <a name="module_Utilities.compare"></a>
3269
+
3270
+ ### Utilities.compare(thisItem, anotherItem, sort) ⇒ <code>string</code>
3271
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3272
+
3273
+ | Param | Type | Description |
3274
+ | --- | --- | --- |
3275
+ | thisItem | <code>object</code> | one of two objects being compared |
3276
+ | anotherItem | <code>object</code> | the other of two objects being compared |
3277
+ | sort | <code>string</code> | string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |
3278
+
3279
+ <a name="module_Utilities.anyInAny"></a>
3280
+
3281
+ ### Utilities.anyInAny(findFrom, findIn) ⇒ <code>boolean</code>
3282
+ An array based compare function - is any entry of findFrom present in findIn
3283
+
3284
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3285
+
3286
+ | Param | Type |
3287
+ | --- | --- |
3288
+ | findFrom | <code>Array.any</code> |
3289
+ | findIn | <code>Array.any</code> |
3290
+
3291
+ <a name="module_Utilities.PromisePoolRunner"></a>
3292
+
3293
+ ### Utilities.PromisePoolRunner(entryArray, actionFunction, promiseOptions) ⇒ <code>Promise</code>
3294
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3295
+
3296
+ | Param | Type |
3297
+ | --- | --- |
3298
+ | entryArray | <code>Array.object</code> |
3299
+ | actionFunction | <code>callback</code> |
3300
+ | promiseOptions | <code>PromiseOptions</code> |
3301
+
3302
+ <a name="module_Utilities.lesserOf"></a>
3303
+
3304
+ ### Utilities.lesserOf(args) ⇒ <code>number</code>
3305
+ A convenience function for legibility
3306
+
3307
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3308
+ **Returns**: <code>number</code> - the least of any of the arguments
3309
+ b
3310
+
3311
+ | Param | Type | Description |
3312
+ | --- | --- | --- |
3313
+ | args | <code>any</code> | unbounded list of arguments |
3314
+
3315
+ <a name="module_Utilities.largerOf"></a>
3316
+
3317
+ ### Utilities.largerOf(args) ⇒ <code>number</code>
3318
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3319
+ **Returns**: <code>number</code> - the largest of any of the arguments
3320
+
3321
+ | Param | Type | Description |
3322
+ | --- | --- | --- |
3323
+ | args | <code>any</code> | unbounded list of arguments |
3324
+
3325
+ <a name="module_Utilities.archiveRecord"></a>
3326
+
3327
+ ### Utilities.archiveRecord(record) ⇒ <code>Promise</code>
3328
+ "Moves" a record from our standard tree structureto a parallel archival
3329
+ structure, by prepending a "_" to the collection names in the path
3330
+ This prevents the archived record from appearing in collectionGroup queries
3331
+
3332
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3333
+
3334
+ | Param | Type |
3335
+ | --- | --- |
3336
+ | record | <code>RecordDocument</code> |
3337
+ | record.refPath | <code>string</code> |
3338
+
3339
+ <a name="module_Utilities.refPathToBaseRecord"></a>
3340
+
3341
+ ### Utilities.refPathToBaseRecord(refPath) ⇒ <code>RecordDocument</code>
3342
+ uses a passed refPath to create the most basic document record form
3343
+
3344
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3345
+
3346
+ | Param | Type | Description |
3347
+ | --- | --- | --- |
3348
+ | refPath | <code>string</code> | "/" separated document path reference |
3349
+
3350
+ <a name="module_Utilities.bound"></a>
3351
+
3352
+ ### Utilities.bound(value, lowerBound, upperBound) ⇒ <code>number</code>
3353
+ clips value to given bounds
3354
+
3355
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3356
+
3357
+ | Param | Type |
3358
+ | --- | --- |
3359
+ | value | <code>number</code> |
3360
+ | lowerBound | <code>number</code> |
3361
+ | upperBound | <code>number</code> |
3362
+
3363
+ <a name="module_Utilities.blindPush"></a>
3364
+
3365
+ ### Utilities.blindPush(targetArray, newObject)
3366
+ function to push an element to an array which may not be initialized
3367
+
3368
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3369
+
3370
+ | Param | Type |
3371
+ | --- | --- |
3372
+ | targetArray | <code>Array.object</code> |
3373
+ | newObject | <code>object</code> |
3374
+
3375
+ <a name="module_Utilities.addToArrayObject"></a>
3376
+
3377
+ ### Utilities.addToArrayObject(arrayObject, key, object)
3378
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3379
+
3380
+ | Param | Type | Description |
3381
+ | --- | --- | --- |
3382
+ | arrayObject | <code>Array.Array.object</code> | |
3383
+ | key | <code>string</code> | key or index to choose which Array.object to add *this* object to |
3384
+ | object | <code>object</code> | |
3385
+
3386
+ <a name="module_Utilities.makeHexAsNeeded"></a>
3387
+
3388
+ ### Utilities.makeHexAsNeeded(color) ⇒ <code>string</code>
3389
+ **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3390
+ **Returns**: <code>string</code> - hex value of named color
3391
+
3392
+ | Param | Type | Description |
3393
+ | --- | --- | --- |
3394
+ | color | <code>string</code> | name of color |
3395
+
3396
+ <a name="module_Utilities..PromisePool"></a>
3397
+
3398
+ ### Utilities~PromisePool
3399
+ **Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)
3400
+ <a name="module_Utilities..promiseOptionsDefault"></a>
3401
+
3402
+ ### Utilities~promiseOptionsDefault : <code>PromiseOptions</code>
3403
+ **Kind**: inner constant of [<code>Utilities</code>](#module_Utilities)
3404
+ **Default**: <code>{&quot;concurrency&quot;:3,&quot;rate&quot;:10}</code>
3405
+ **Read only**: true
3406
+ <a name="module_Utilities..stripDocIdFromRefPath"></a>
3407
+
3408
+ ### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>
3409
+ pulls the document Id from a passed refPath string (firebase dependent)
3410
+
3411
+ **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
3412
+ **Returns**: <code>string</code> - Id
3413
+
3414
+ | Param | Type |
3415
+ | --- | --- |
3416
+ | refPath | <code>string</code> |
3417
+
3418
+ <a name="module_Utilities..UpdateChange
3419
+ Function Signature for UpdateChange functions"></a>
3420
+
3421
+ ### Utilities~UpdateChange
3422
+ Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject) ⇒ <code>object</code>
3423
+ **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
3424
+
3425
+ | Param | Type |
3426
+ | --- | --- |
3427
+ | prev | <code>object</code> |
3428
+ | value | <code>object</code> |
3429
+ | itemFor | <code>string</code> |
3430
+ | fullChoiceObject | <code>object</code> |
3431
+
3432
+ <a name="module_Utilities..generateIterator"></a>
3433
+
3434
+ ### Utilities~generateIterator(entryArray, actionFunction)
3435
+ An Action Iterator Generator. Cycles through the entries in the passed array,
3436
+ yielding the result of a function for each entry.
3437
+ Only cares that inputs are an array, and a function that returns a
3438
+ promise
3439
+
3440
+ **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
3441
+
3442
+ | Param | Type |
3443
+ | --- | --- |
3444
+ | entryArray | <code>Array.any</code> |
3445
+ | actionFunction | <code>callback</code> |
3446
+
3447
+ <a name="module_Utilities..PromiseOptions"></a>
3448
+
3449
+ ### Utilities~PromiseOptions : <code>object</code>
3450
+ **Kind**: inner typedef of [<code>Utilities</code>](#module_Utilities)
3451
+ **Properties**
3452
+
3453
+ | Name | Type |
3454
+ | --- | --- |
3455
+ | concurrency | <code>number</code> |
3456
+ | rate | <code>number</code> |
3457
+
2706
3458
  <a name="module_Boilerplate"></a>
2707
3459
 
2708
3460
  ## Boilerplate