@leaddreamer/inventorylogic 0.0.3-beta.82 → 0.0.3-beta.84

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
@@ -74,10 +74,6 @@ users</p>
74
74
  <dd><p>Typedefs, constants, support functions and database operations related to usage Units
75
75
  and conversions</p>
76
76
  </dd>
77
- <dt><a href="#module_Utilities">Utilities</a></dt>
78
- <dd><p>Typedefs, constants, support functions and database operations for
79
- general Utilities</p>
80
- </dd>
81
77
  <dt><a href="#module_Boilerplate">Boilerplate</a></dt>
82
78
  <dd><p>Shared constants and symbols</p>
83
79
  </dd>
@@ -922,36 +918,26 @@ users
922
918
 
923
919
  * [LineItem](#module_LineItem)
924
920
  * _static_
925
- * [.createLineItem](#module_LineItem.createLineItem) ⇒ <code>Promise.LineItem</code>
926
921
  * [.deleteLineItem(lineItem, product)](#module_LineItem.deleteLineItem) ⇒ <code>Promise.&lt;void&gt;</code>
927
922
  * [.deleteLineItemById(lineItem, product)](#module_LineItem.deleteLineItemById) ⇒ <code>Promise.&lt;void&gt;</code>
923
+ * [.createLineItem(lineItem, product)](#module_LineItem.createLineItem) ⇒ <code>Promise.LineItem</code>
928
924
  * [.knownLineItem(Id, product)](#module_LineItem.knownLineItem) ⇒ <code>Promise.boolean</code>
929
925
  * [.fetchLineItems()](#module_LineItem.fetchLineItems) ⇒ <code>Array.LineItem</code>
930
926
  * [.fetchProductLineItems(product, stage)](#module_LineItem.fetchProductLineItems) ⇒ <code>Array.LineItem</code>
931
927
  * [.paginateProductLineItems(product, stage, limit)](#module_LineItem.paginateProductLineItems) ⇒ <code>PaginatedFetch</code>
932
928
  * [.fetchLineItem(lineItemId, product)](#module_LineItem.fetchLineItem) ⇒ <code>Promise.LineItem</code>
933
929
  * [.fetchLineItemName(lineItemId, product)](#module_LineItem.fetchLineItemName) ⇒ <code>Promise.string</code>
930
+ * [.lineItem_lineSum(lineItem)](#module_LineItem.lineItem_lineSum) ⇒ <code>number</code>
934
931
  * _inner_
935
932
  * [~LineItemDefault](#module_LineItem..LineItemDefault) : <code>LineItem</code>
936
933
  * [~LineItemData](#module_LineItem..LineItemData) : <code>LineItem</code>
937
934
  * [~LineItemDefaultForm](#module_LineItem..LineItemDefaultForm) : <code>LineItem</code>
938
935
  * [~updateLineItem(lineItem, product)](#module_LineItem..updateLineItem) ⇒ <code>promise.LineItem</code>
939
936
  * [~summarizeLineItem(lineItem)](#module_LineItem..summarizeLineItem) ⇒ <code>string</code>
940
- * [~lineItem_lineSum(lineItem)](#module_LineItem..lineItem_lineSum) ⇒ <code>number</code>
941
937
  * [~UpdateChange(prev, value, itemFor, fullChoiceObject)](#module_LineItem..UpdateChange) ⇒ <code>object</code>
942
938
  * [~LineItem](#module_LineItem..LineItem) : <code>object</code>
943
939
  * [~PaginatedFetch](#module_LineItem..PaginatedFetch) : <code>object</code>
944
940
 
945
- <a name="module_LineItem.createLineItem"></a>
946
-
947
- ### LineItem.createLineItem ⇒ <code>Promise.LineItem</code>
948
- **Kind**: static constant of [<code>LineItem</code>](#module_LineItem)
949
-
950
- | Param | Type | Description |
951
- | --- | --- | --- |
952
- | lineItem | <code>LineItem</code> | minimal record of user account |
953
- | product | <code>Product</code> | minimal record of product this lineItem belongs to |
954
-
955
941
  <a name="module_LineItem.deleteLineItem"></a>
956
942
 
957
943
  ### LineItem.deleteLineItem(lineItem, product) ⇒ <code>Promise.&lt;void&gt;</code>
@@ -979,6 +965,16 @@ from database
979
965
  | product | <code>Product</code> | minimal record of product this lineItem belongs to |
980
966
  | product.refPath | <code>string</code> | required as a minimum |
981
967
 
968
+ <a name="module_LineItem.createLineItem"></a>
969
+
970
+ ### LineItem.createLineItem(lineItem, product) ⇒ <code>Promise.LineItem</code>
971
+ **Kind**: static method of [<code>LineItem</code>](#module_LineItem)
972
+
973
+ | Param | Type | Description |
974
+ | --- | --- | --- |
975
+ | lineItem | <code>LineItem</code> | minimal record of user account |
976
+ | product | <code>Product</code> | minimal record of product this lineItem belongs to |
977
+
982
978
  <a name="module_LineItem.knownLineItem"></a>
983
979
 
984
980
  ### LineItem.knownLineItem(Id, product) ⇒ <code>Promise.boolean</code>
@@ -1050,6 +1046,19 @@ Fetches and returns the summarized name from a LineItem record
1050
1046
  | lineItemId | <code>string</code> | |
1051
1047
  | product | <code>Product</code> | minimal record of product this lineItem belongs to |
1052
1048
 
1049
+ <a name="module_LineItem.lineItem_lineSum"></a>
1050
+
1051
+ ### LineItem.lineItem\_lineSum(lineItem) ⇒ <code>number</code>
1052
+ Calculates the lineSum (total) for a lineItem
1053
+
1054
+ **Kind**: static method of [<code>LineItem</code>](#module_LineItem)
1055
+
1056
+ | Param | Type |
1057
+ | --- | --- |
1058
+ | lineItem | <code>object</code> |
1059
+ | lineItem.rate | <code>number</code> |
1060
+ | lineItem.count | <code>number</code> |
1061
+
1053
1062
  <a name="module_LineItem..LineItemDefault"></a>
1054
1063
 
1055
1064
  ### LineItem~LineItemDefault : <code>LineItem</code>
@@ -1099,19 +1108,6 @@ Returns a standardized formatted name string
1099
1108
  | --- | --- |
1100
1109
  | lineItem | <code>LineItem</code> |
1101
1110
 
1102
- <a name="module_LineItem..lineItem_lineSum"></a>
1103
-
1104
- ### LineItem~lineItem\_lineSum(lineItem) ⇒ <code>number</code>
1105
- Calculates the lineSum (total) for a lineItem
1106
-
1107
- **Kind**: inner method of [<code>LineItem</code>](#module_LineItem)
1108
-
1109
- | Param | Type |
1110
- | --- | --- |
1111
- | lineItem | <code>object</code> |
1112
- | lineItem.rate | <code>number</code> |
1113
- | lineItem.count | <code>number</code> |
1114
-
1115
1111
  <a name="module_LineItem..UpdateChange"></a>
1116
1112
 
1117
1113
  ### LineItem~UpdateChange(prev, value, itemFor, fullChoiceObject) ⇒ <code>object</code>
@@ -3710,19 +3706,6 @@ and conversions
3710
3706
  * [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
3711
3707
  * [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
3712
3708
  * [.choicesForm(fieldname)](#module_Utilities.choicesForm) ⇒ <code>object</code>
3713
- * [.saveHost(host)](#module_Utilities.saveHost) ⇒ <code>Promise.OrganizationType</code>
3714
- * [.simpleObjectCompare(object1, object2)](#module_Utilities.simpleObjectCompare) ⇒ <code>boolean</code>
3715
- * [.formatItem(thisItem, thisFormat)](#module_Utilities.formatItem) ⇒ <code>string</code>
3716
- * [.compare(thisItem, anotherItem, sort)](#module_Utilities.compare) ⇒ <code>string</code>
3717
- * [.anyInAny(findFrom, findIn)](#module_Utilities.anyInAny) ⇒ <code>boolean</code>
3718
- * [.lesserOf(args)](#module_Utilities.lesserOf) ⇒ <code>number</code>
3719
- * [.largerOf(args)](#module_Utilities.largerOf) ⇒ <code>number</code>
3720
- * [.archiveRecord(record)](#module_Utilities.archiveRecord) ⇒ <code>Promise</code>
3721
- * [.refPathToBaseRecord(refPath)](#module_Utilities.refPathToBaseRecord) ⇒ <code>RecordDocument</code>
3722
- * [.bound(value, lowerBound, upperBound)](#module_Utilities.bound) ⇒ <code>number</code>
3723
- * [.blindPush(targetArray, newObject)](#module_Utilities.blindPush)
3724
- * [.addToArrayObject(arrayObject, key, object)](#module_Utilities.addToArrayObject)
3725
- * [.makeHexAsNeeded(color)](#module_Utilities.makeHexAsNeeded) ⇒ <code>string</code>
3726
3709
  * _inner_
3727
3710
  * [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
3728
3711
  * [~UpdateChange
@@ -3978,637 +3961,6 @@ usage are defined in business logic elsewhere
3978
3961
  | --- | --- | --- |
3979
3962
  | fieldname | <code>string</code> | which business type is being processes |
3980
3963
 
3981
- <a name="module_Utilities.saveHost"></a>
3982
-
3983
- ### Utilities.saveHost(host) ⇒ <code>Promise.OrganizationType</code>
3984
- A convenience function for some shared artist/host front-end pages
3985
-
3986
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3987
-
3988
- | Param | Type |
3989
- | --- | --- |
3990
- | host | <code>OrganizationType</code> |
3991
-
3992
- <a name="module_Utilities.simpleObjectCompare"></a>
3993
-
3994
- ### Utilities.simpleObjectCompare(object1, object2) ⇒ <code>boolean</code>
3995
- Simple top-level object compare - assumes objects have similar structure - or
3996
- AT LEAST all the fields of object1 are present in object2
3997
-
3998
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
3999
-
4000
- | Param | Type |
4001
- | --- | --- |
4002
- | object1 | <code>object</code> |
4003
- | object2 | <code>object</code> |
4004
-
4005
- <a name="module_Utilities.formatItem"></a>
4006
-
4007
- ### Utilities.formatItem(thisItem, thisFormat) ⇒ <code>string</code>
4008
- Allows string substitution from an object
4009
- field names support Dot notation
4010
- field names allow ":" extension for alternate formatting
4011
-
4012
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4013
-
4014
- | Param | Type | Description |
4015
- | --- | --- | --- |
4016
- | thisItem | <code>object</code> | object to create formated string from |
4017
- | thisFormat | <code>string</code> | string describing formatted output - fieldname wrapped in {} will be substituted. DOT notation allowed for fields. |
4018
-
4019
- <a name="module_Utilities.compare"></a>
4020
-
4021
- ### Utilities.compare(thisItem, anotherItem, sort) ⇒ <code>string</code>
4022
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4023
-
4024
- | Param | Type | Description |
4025
- | --- | --- | --- |
4026
- | thisItem | <code>object</code> | one of two objects being compared |
4027
- | anotherItem | <code>object</code> | the other of two objects being compared |
4028
- | sort | <code>string</code> | string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |
4029
-
4030
- <a name="module_Utilities.anyInAny"></a>
4031
-
4032
- ### Utilities.anyInAny(findFrom, findIn) ⇒ <code>boolean</code>
4033
- An array based compare function - is any entry of findFrom present in findIn
4034
-
4035
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4036
-
4037
- | Param | Type |
4038
- | --- | --- |
4039
- | findFrom | <code>Array.any</code> |
4040
- | findIn | <code>Array.any</code> |
4041
-
4042
- <a name="module_Utilities.lesserOf"></a>
4043
-
4044
- ### Utilities.lesserOf(args) ⇒ <code>number</code>
4045
- A convenience function for legibility
4046
-
4047
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4048
- **Returns**: <code>number</code> - the least of any of the arguments
4049
- b
4050
-
4051
- | Param | Type | Description |
4052
- | --- | --- | --- |
4053
- | args | <code>any</code> | unbounded list of arguments |
4054
-
4055
- <a name="module_Utilities.largerOf"></a>
4056
-
4057
- ### Utilities.largerOf(args) ⇒ <code>number</code>
4058
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4059
- **Returns**: <code>number</code> - the largest of any of the arguments
4060
-
4061
- | Param | Type | Description |
4062
- | --- | --- | --- |
4063
- | args | <code>any</code> | unbounded list of arguments |
4064
-
4065
- <a name="module_Utilities.archiveRecord"></a>
4066
-
4067
- ### Utilities.archiveRecord(record) ⇒ <code>Promise</code>
4068
- "Moves" a record from our standard tree structureto a parallel archival
4069
- structure, by prepending a "_" to the collection names in the path
4070
- This prevents the archived record from appearing in collectionGroup queries
4071
-
4072
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4073
-
4074
- | Param | Type |
4075
- | --- | --- |
4076
- | record | <code>RecordDocument</code> |
4077
- | record.refPath | <code>string</code> |
4078
-
4079
- <a name="module_Utilities.refPathToBaseRecord"></a>
4080
-
4081
- ### Utilities.refPathToBaseRecord(refPath) ⇒ <code>RecordDocument</code>
4082
- uses a passed refPath to create the most basic document record form
4083
-
4084
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4085
-
4086
- | Param | Type | Description |
4087
- | --- | --- | --- |
4088
- | refPath | <code>string</code> | "/" separated document path reference |
4089
-
4090
- <a name="module_Utilities.bound"></a>
4091
-
4092
- ### Utilities.bound(value, lowerBound, upperBound) ⇒ <code>number</code>
4093
- clips value to given bounds
4094
-
4095
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4096
-
4097
- | Param | Type |
4098
- | --- | --- |
4099
- | value | <code>number</code> |
4100
- | lowerBound | <code>number</code> |
4101
- | upperBound | <code>number</code> |
4102
-
4103
- <a name="module_Utilities.blindPush"></a>
4104
-
4105
- ### Utilities.blindPush(targetArray, newObject)
4106
- function to push an element to an array which may not be initialized
4107
-
4108
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4109
-
4110
- | Param | Type |
4111
- | --- | --- |
4112
- | targetArray | <code>Array.object</code> |
4113
- | newObject | <code>object</code> |
4114
-
4115
- <a name="module_Utilities.addToArrayObject"></a>
4116
-
4117
- ### Utilities.addToArrayObject(arrayObject, key, object)
4118
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4119
-
4120
- | Param | Type | Description |
4121
- | --- | --- | --- |
4122
- | arrayObject | <code>Array.Array.object</code> | |
4123
- | key | <code>string</code> | key or index to choose which Array.object to add *this* object to |
4124
- | object | <code>object</code> | |
4125
-
4126
- <a name="module_Utilities.makeHexAsNeeded"></a>
4127
-
4128
- ### Utilities.makeHexAsNeeded(color) ⇒ <code>string</code>
4129
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4130
- **Returns**: <code>string</code> - hex value of named color
4131
-
4132
- | Param | Type | Description |
4133
- | --- | --- | --- |
4134
- | color | <code>string</code> | name of color |
4135
-
4136
- <a name="module_Utilities..stripDocIdFromRefPath"></a>
4137
-
4138
- ### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>
4139
- pulls the document Id from a passed refPath string (firebase dependent)
4140
-
4141
- **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
4142
- **Returns**: <code>string</code> - Id
4143
-
4144
- | Param | Type |
4145
- | --- | --- |
4146
- | refPath | <code>string</code> |
4147
-
4148
- <a name="module_Utilities..UpdateChange
4149
- Function Signature for UpdateChange functions"></a>
4150
-
4151
- ### Utilities~UpdateChange
4152
- Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject) ⇒ <code>object</code>
4153
- **Kind**: inner method of [<code>Utilities</code>](#module_Utilities)
4154
-
4155
- | Param | Type |
4156
- | --- | --- |
4157
- | prev | <code>object</code> |
4158
- | value | <code>object</code> |
4159
- | itemFor | <code>string</code> |
4160
- | fullChoiceObject | <code>object</code> |
4161
-
4162
- <a name="module_Utilities"></a>
4163
-
4164
- ## Utilities
4165
- Typedefs, constants, support functions and database operations for
4166
- general Utilities
4167
-
4168
-
4169
- * [Utilities](#module_Utilities)
4170
- * _static_
4171
- * [.recordByIdAndType](#module_Utilities.recordByIdAndType) ⇒ <code>AccountType</code>
4172
- * [.fetchLinkedItem(type, link, refPath)](#module_Utilities.fetchLinkedItem) ⇒ <code>Promise.RecordDocument</code>
4173
- * [.fetchSubItem(type, refPath)](#module_Utilities.fetchSubItem) ⇒ <code>Promise.RecordDocument</code>
4174
- * [.fetchType(type, refPath)](#module_Utilities.fetchType) ⇒ <code>Promise.Array.RecordDocument</code>
4175
- * [.searchType(type, parent, prompt, limit)](#module_Utilities.searchType) ⇒ <code>Promise.Array.OrganizationType</code>
4176
- * [.typedRecordFromChild(type, child)](#module_Utilities.typedRecordFromChild) ⇒ <code>Record</code>
4177
- * [.typedSortArray(type)](#module_Utilities.typedSortArray) ⇒ <code>Array.SortObject</code>
4178
- * [.processItemType(item, type, refPath)](#module_Utilities.processItemType) ⇒ <code>Promise.RecordDocument</code>
4179
- * [.formatLinkedItem(link, type, refPath)](#module_Utilities.formatLinkedItem) ⇒ <code>Promise.string</code>
4180
- * [.summarizeItem(item, type)](#module_Utilities.summarizeItem) ⇒ <code>string</code>
4181
- * [.baseItem(type)](#module_Utilities.baseItem) ⇒ <code>object</code>
4182
- * [.baseForm(type)](#module_Utilities.baseForm) ⇒ <code>object</code>
4183
- * [.dataForm(type)](#module_Utilities.dataForm) ⇒ <code>object</code>
4184
- * [.createForm(type)](#module_Utilities.createForm) ⇒ <code>object</code>
4185
- * [.accountForm(type)](#module_Utilities.accountForm) ⇒ <code>object</code>
4186
- * [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
4187
- * [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
4188
- * [.choicesForm(fieldname)](#module_Utilities.choicesForm) ⇒ <code>object</code>
4189
- * [.saveHost(host)](#module_Utilities.saveHost) ⇒ <code>Promise.OrganizationType</code>
4190
- * [.simpleObjectCompare(object1, object2)](#module_Utilities.simpleObjectCompare) ⇒ <code>boolean</code>
4191
- * [.formatItem(thisItem, thisFormat)](#module_Utilities.formatItem) ⇒ <code>string</code>
4192
- * [.compare(thisItem, anotherItem, sort)](#module_Utilities.compare) ⇒ <code>string</code>
4193
- * [.anyInAny(findFrom, findIn)](#module_Utilities.anyInAny) ⇒ <code>boolean</code>
4194
- * [.lesserOf(args)](#module_Utilities.lesserOf) ⇒ <code>number</code>
4195
- * [.largerOf(args)](#module_Utilities.largerOf) ⇒ <code>number</code>
4196
- * [.archiveRecord(record)](#module_Utilities.archiveRecord) ⇒ <code>Promise</code>
4197
- * [.refPathToBaseRecord(refPath)](#module_Utilities.refPathToBaseRecord) ⇒ <code>RecordDocument</code>
4198
- * [.bound(value, lowerBound, upperBound)](#module_Utilities.bound) ⇒ <code>number</code>
4199
- * [.blindPush(targetArray, newObject)](#module_Utilities.blindPush)
4200
- * [.addToArrayObject(arrayObject, key, object)](#module_Utilities.addToArrayObject)
4201
- * [.makeHexAsNeeded(color)](#module_Utilities.makeHexAsNeeded) ⇒ <code>string</code>
4202
- * _inner_
4203
- * [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
4204
- * [~UpdateChange
4205
- Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject)](#module_Utilities..UpdateChange
4206
- Function Signature for UpdateChange functions) ⇒ <code>object</code>
4207
-
4208
- <a name="module_Utilities.recordByIdAndType"></a>
4209
-
4210
- ### Utilities.recordByIdAndType ⇒ <code>AccountType</code>
4211
- creates and returns a minimal record from an Id and `type`
4212
-
4213
- **Kind**: static constant of [<code>Utilities</code>](#module_Utilities)
4214
-
4215
- | Param | Type |
4216
- | --- | --- |
4217
- | Id | <code>string</code> |
4218
- | Type | <code>string</code> |
4219
-
4220
- <a name="module_Utilities.fetchLinkedItem"></a>
4221
-
4222
- ### Utilities.fetchLinkedItem(type, link, refPath) ⇒ <code>Promise.RecordDocument</code>
4223
- used generic for constructing forms for input and display
4224
-
4225
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4226
-
4227
- | Param | Type | Description |
4228
- | --- | --- | --- |
4229
- | type | <code>string</code> | refers to the sub-collection name |
4230
- | link | <code>string</code> | refers to the linking "value" - a documentID |
4231
- | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
4232
-
4233
- <a name="module_Utilities.fetchSubItem"></a>
4234
-
4235
- ### Utilities.fetchSubItem(type, refPath) ⇒ <code>Promise.RecordDocument</code>
4236
- some items are stored in the database as a single-record collection, using
4237
- the same Id as the parent
4238
-
4239
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4240
-
4241
- | Param | Type | Description |
4242
- | --- | --- | --- |
4243
- | type | <code>string</code> | refers to the sub-collection name |
4244
- | refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
4245
-
4246
- <a name="module_Utilities.fetchType"></a>
4247
-
4248
- ### Utilities.fetchType(type, refPath) ⇒ <code>Promise.Array.RecordDocument</code>
4249
- returns an entire sub-collection by "type" (sub-collection name).
4250
- If refpath is omitted, assumes "type" is a top-level collection
4251
-
4252
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4253
-
4254
- | Param | Type | Description |
4255
- | --- | --- | --- |
4256
- | type | <code>string</code> | refers to the sub-collection name |
4257
- | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
4258
-
4259
- <a name="module_Utilities.searchType"></a>
4260
-
4261
- ### Utilities.searchType(type, parent, prompt, limit) ⇒ <code>Promise.Array.OrganizationType</code>
4262
- returns a Promise which resolves to an array of all Type's whose
4263
- name begins with the provided prompt, optionally limited to a provided number
4264
- CASE SENSITIVE FOR NOW
4265
-
4266
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4267
-
4268
- | Param | Type | Description |
4269
- | --- | --- | --- |
4270
- | type | <code>string</code> | type of record to search |
4271
- | parent | <code>Record</code> | parent object of records, if any |
4272
- | prompt | <code>string</code> | Used to query for matching records |
4273
- | limit | <code>string</code> \| <code>number</code> | Used to limit the number of results |
4274
-
4275
- <a name="module_Utilities.typedRecordFromChild"></a>
4276
-
4277
- ### Utilities.typedRecordFromChild(type, child) ⇒ <code>Record</code>
4278
- builds a representation of a parent from a child, by type
4279
-
4280
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4281
-
4282
- | Param | Type |
4283
- | --- | --- |
4284
- | type | <code>string</code> |
4285
- | child | <code>Record</code> |
4286
-
4287
- <a name="module_Utilities.typedSortArray"></a>
4288
-
4289
- ### Utilities.typedSortArray(type) ⇒ <code>Array.SortObject</code>
4290
- Firebase query support - builds default sort options
4291
-
4292
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4293
-
4294
- | Param | Type |
4295
- | --- | --- |
4296
- | type | <code>string</code> |
4297
-
4298
- <a name="module_Utilities.processItemType"></a>
4299
-
4300
- ### Utilities.processItemType(item, type, refPath) ⇒ <code>Promise.RecordDocument</code>
4301
- generic form data processing for database by "type" (collection name)
4302
-
4303
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4304
-
4305
- | Param | Type | Description |
4306
- | --- | --- | --- |
4307
- | item | <code>RecordDocument</code> | |
4308
- | type | <code>string</code> | refers to the sub-collection name |
4309
- | refPath | <code>string</code> | optionally refers to the "/" separate path to the parent document in firebase |
4310
-
4311
- <a name="module_Utilities.formatLinkedItem"></a>
4312
-
4313
- ### Utilities.formatLinkedItem(link, type, refPath) ⇒ <code>Promise.string</code>
4314
- fetches a sub-record from the database and returns the result as a summary string
4315
-
4316
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4317
-
4318
- | Param | Type | Description |
4319
- | --- | --- | --- |
4320
- | link | <code>string</code> | refers to the linking "value" - a documentID |
4321
- | type | <code>string</code> | refers to the sub-collection name |
4322
- | refPath | <code>string</code> | refers to the "/" separate path to the required parent document in firebase |
4323
-
4324
- <a name="module_Utilities.summarizeItem"></a>
4325
-
4326
- ### Utilities.summarizeItem(item, type) ⇒ <code>string</code>
4327
- parameterized function to return string summary of an object
4328
- By default, returns the "name" property of the item.
4329
-
4330
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4331
-
4332
- | Param | Type | Description |
4333
- | --- | --- | --- |
4334
- | item | <code>object</code> | data object to summarize |
4335
- | 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 |
4336
-
4337
- <a name="module_Utilities.baseItem"></a>
4338
-
4339
- ### Utilities.baseItem(type) ⇒ <code>object</code>
4340
- Convenience function to mask actual Forms array from the front-end
4341
- This version returns the "base" item sample for a business-object type,
4342
- where the keys are the field/property names, and the values are the
4343
- default values as defined in the business logic
4344
-
4345
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4346
- **Returns**: <code>object</code> - keys and default values
4347
-
4348
- | Param | Type |
4349
- | --- | --- |
4350
- | type | <code>string</code> |
4351
-
4352
- <a name="module_Utilities.baseForm"></a>
4353
-
4354
- ### Utilities.baseForm(type) ⇒ <code>object</code>
4355
- Convenience function to mask actual Forms array from the front-end
4356
- This version returns the "baseForm" withe keys/properties, and
4357
- values are strings with ":" separated definitions for EditForm and
4358
- similar functionality - see "EditForm" for more details
4359
-
4360
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4361
- **Returns**: <code>object</code> - keys and default values
4362
-
4363
- | Param | Type |
4364
- | --- | --- |
4365
- | type | <code>string</code> |
4366
-
4367
- <a name="module_Utilities.dataForm"></a>
4368
-
4369
- ### Utilities.dataForm(type) ⇒ <code>object</code>
4370
- Convenience function to mask actual Forms array from the front-end
4371
- This version returns the "Data" object with keys/properties, and
4372
- values are strings with ":" separated definitions for Faker and
4373
- similar functionality - to generate "fake" simulated data for testing
4374
-
4375
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4376
- **Returns**: <code>object</code> - keys and default values
4377
-
4378
- | Param | Type |
4379
- | --- | --- |
4380
- | type | <code>string</code> |
4381
-
4382
- <a name="module_Utilities.createForm"></a>
4383
-
4384
- ### Utilities.createForm(type) ⇒ <code>object</code>
4385
- Convenience function to mask actual Forms array from the front-end
4386
- This version returns the "createForm" withe keys/properties, and
4387
- values are strings with ":" separated definitions for EditForm and
4388
- similar functionality - see "EditForm" for more details
4389
- Specifically for limited "front-end" use to CREATE new
4390
- business-objects with the minimum entries necessary
4391
-
4392
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4393
- **Returns**: <code>object</code> - keys and default values
4394
-
4395
- | Param | Type |
4396
- | --- | --- |
4397
- | type | <code>string</code> |
4398
-
4399
- <a name="module_Utilities.accountForm"></a>
4400
-
4401
- ### Utilities.accountForm(type) ⇒ <code>object</code>
4402
- Convenience function to mask actual Forms array from the front-end
4403
- This version returns the "createForm" withe keys/properties, and
4404
- values are strings with ":" separated definitions for EditForm and
4405
- similar functionality - see "EditForm" for more details
4406
- Specifically for limited "front-end" use on ACCOUNT business-objects
4407
- with the minimum entries necessary
4408
-
4409
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4410
- **Returns**: <code>object</code> - keys and default values
4411
-
4412
- | Param | Type |
4413
- | --- | --- |
4414
- | type | <code>string</code> |
4415
-
4416
- <a name="module_Utilities.saveForm"></a>
4417
-
4418
- ### Utilities.saveForm(type) ⇒ <code>callback</code>
4419
- Convenience function to mask actual Forms array from the front-end
4420
- This version returns a FUNCTION to use for saving a business-object
4421
- to the database - abstracting type-specific features and functionality
4422
- from the front end
4423
-
4424
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4425
-
4426
- | Param | Type |
4427
- | --- | --- |
4428
- | type | <code>string</code> |
4429
-
4430
- <a name="module_Utilities.updateChangeForm"></a>
4431
-
4432
- ### Utilities.updateChangeForm(type) ⇒ <code>callback</code>
4433
- Convenience function to mask actual Forms array from the front-end
4434
- This version returns a FUNCTION to respond to cross-field dependent
4435
- chnages during editing with EditForm, reactdatagrid, etc
4436
-
4437
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4438
-
4439
- | Param | Type |
4440
- | --- | --- |
4441
- | type | <code>string</code> |
4442
-
4443
- <a name="module_Utilities.choicesForm"></a>
4444
-
4445
- ### Utilities.choicesForm(fieldname) ⇒ <code>object</code>
4446
- Returns an object whose keys are the available choices for a
4447
- business-object field, and whose values represent the sort order
4448
- Most fieldname have no such choices. Both the definitions and
4449
- usage are defined in business logic elsewhere
4450
-
4451
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4452
-
4453
- | Param | Type | Description |
4454
- | --- | --- | --- |
4455
- | fieldname | <code>string</code> | which business type is being processes |
4456
-
4457
- <a name="module_Utilities.saveHost"></a>
4458
-
4459
- ### Utilities.saveHost(host) ⇒ <code>Promise.OrganizationType</code>
4460
- A convenience function for some shared artist/host front-end pages
4461
-
4462
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4463
-
4464
- | Param | Type |
4465
- | --- | --- |
4466
- | host | <code>OrganizationType</code> |
4467
-
4468
- <a name="module_Utilities.simpleObjectCompare"></a>
4469
-
4470
- ### Utilities.simpleObjectCompare(object1, object2) ⇒ <code>boolean</code>
4471
- Simple top-level object compare - assumes objects have similar structure - or
4472
- AT LEAST all the fields of object1 are present in object2
4473
-
4474
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4475
-
4476
- | Param | Type |
4477
- | --- | --- |
4478
- | object1 | <code>object</code> |
4479
- | object2 | <code>object</code> |
4480
-
4481
- <a name="module_Utilities.formatItem"></a>
4482
-
4483
- ### Utilities.formatItem(thisItem, thisFormat) ⇒ <code>string</code>
4484
- Allows string substitution from an object
4485
- field names support Dot notation
4486
- field names allow ":" extension for alternate formatting
4487
-
4488
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4489
-
4490
- | Param | Type | Description |
4491
- | --- | --- | --- |
4492
- | thisItem | <code>object</code> | object to create formated string from |
4493
- | thisFormat | <code>string</code> | string describing formatted output - fieldname wrapped in {} will be substituted. DOT notation allowed for fields. |
4494
-
4495
- <a name="module_Utilities.compare"></a>
4496
-
4497
- ### Utilities.compare(thisItem, anotherItem, sort) ⇒ <code>string</code>
4498
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4499
-
4500
- | Param | Type | Description |
4501
- | --- | --- | --- |
4502
- | thisItem | <code>object</code> | one of two objects being compared |
4503
- | anotherItem | <code>object</code> | the other of two objects being compared |
4504
- | sort | <code>string</code> | string describing sort - format "fieldName:sortType" - sort Type is "string, "date" or "number" (default) |
4505
-
4506
- <a name="module_Utilities.anyInAny"></a>
4507
-
4508
- ### Utilities.anyInAny(findFrom, findIn) ⇒ <code>boolean</code>
4509
- An array based compare function - is any entry of findFrom present in findIn
4510
-
4511
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4512
-
4513
- | Param | Type |
4514
- | --- | --- |
4515
- | findFrom | <code>Array.any</code> |
4516
- | findIn | <code>Array.any</code> |
4517
-
4518
- <a name="module_Utilities.lesserOf"></a>
4519
-
4520
- ### Utilities.lesserOf(args) ⇒ <code>number</code>
4521
- A convenience function for legibility
4522
-
4523
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4524
- **Returns**: <code>number</code> - the least of any of the arguments
4525
- b
4526
-
4527
- | Param | Type | Description |
4528
- | --- | --- | --- |
4529
- | args | <code>any</code> | unbounded list of arguments |
4530
-
4531
- <a name="module_Utilities.largerOf"></a>
4532
-
4533
- ### Utilities.largerOf(args) ⇒ <code>number</code>
4534
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4535
- **Returns**: <code>number</code> - the largest of any of the arguments
4536
-
4537
- | Param | Type | Description |
4538
- | --- | --- | --- |
4539
- | args | <code>any</code> | unbounded list of arguments |
4540
-
4541
- <a name="module_Utilities.archiveRecord"></a>
4542
-
4543
- ### Utilities.archiveRecord(record) ⇒ <code>Promise</code>
4544
- "Moves" a record from our standard tree structureto a parallel archival
4545
- structure, by prepending a "_" to the collection names in the path
4546
- This prevents the archived record from appearing in collectionGroup queries
4547
-
4548
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4549
-
4550
- | Param | Type |
4551
- | --- | --- |
4552
- | record | <code>RecordDocument</code> |
4553
- | record.refPath | <code>string</code> |
4554
-
4555
- <a name="module_Utilities.refPathToBaseRecord"></a>
4556
-
4557
- ### Utilities.refPathToBaseRecord(refPath) ⇒ <code>RecordDocument</code>
4558
- uses a passed refPath to create the most basic document record form
4559
-
4560
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4561
-
4562
- | Param | Type | Description |
4563
- | --- | --- | --- |
4564
- | refPath | <code>string</code> | "/" separated document path reference |
4565
-
4566
- <a name="module_Utilities.bound"></a>
4567
-
4568
- ### Utilities.bound(value, lowerBound, upperBound) ⇒ <code>number</code>
4569
- clips value to given bounds
4570
-
4571
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4572
-
4573
- | Param | Type |
4574
- | --- | --- |
4575
- | value | <code>number</code> |
4576
- | lowerBound | <code>number</code> |
4577
- | upperBound | <code>number</code> |
4578
-
4579
- <a name="module_Utilities.blindPush"></a>
4580
-
4581
- ### Utilities.blindPush(targetArray, newObject)
4582
- function to push an element to an array which may not be initialized
4583
-
4584
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4585
-
4586
- | Param | Type |
4587
- | --- | --- |
4588
- | targetArray | <code>Array.object</code> |
4589
- | newObject | <code>object</code> |
4590
-
4591
- <a name="module_Utilities.addToArrayObject"></a>
4592
-
4593
- ### Utilities.addToArrayObject(arrayObject, key, object)
4594
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4595
-
4596
- | Param | Type | Description |
4597
- | --- | --- | --- |
4598
- | arrayObject | <code>Array.Array.object</code> | |
4599
- | key | <code>string</code> | key or index to choose which Array.object to add *this* object to |
4600
- | object | <code>object</code> | |
4601
-
4602
- <a name="module_Utilities.makeHexAsNeeded"></a>
4603
-
4604
- ### Utilities.makeHexAsNeeded(color) ⇒ <code>string</code>
4605
- **Kind**: static method of [<code>Utilities</code>](#module_Utilities)
4606
- **Returns**: <code>string</code> - hex value of named color
4607
-
4608
- | Param | Type | Description |
4609
- | --- | --- | --- |
4610
- | color | <code>string</code> | name of color |
4611
-
4612
3964
  <a name="module_Utilities..stripDocIdFromRefPath"></a>
4613
3965
 
4614
3966
  ### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>