@leaddreamer/inventorylogic 0.0.3-beta.4 → 0.0.3-beta.41
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 +1604 -9
- package/business/Addresses/index.js +181 -0
- package/business/BusinessData/index.js +300 -0
- package/business/Commodities/index.js +1 -1
- package/business/Fundamentals/index.js +184 -0
- package/business/LineItem/index.js +2 -2
- package/business/Markups/index.js +2 -2
- package/business/Payment/index.js +1 -1
- package/business/PrivateData/index.js +176 -0
- package/business/Product/index.js +160 -17
- package/business/User/index.js +2 -2
- package/business/Utilities/index.js +3 -1
- package/business/Utilities/other.js +469 -0
- package/business/Utilities/promise-queue/index.js +231 -0
- package/business/Utilities/rate-limited-queue/index.js +127 -0
- package/business/boilerplate/index.js +26 -3
- package/business/index.js +12 -9
- package/business/units/index.js +1 -1
- package/dist/InventoryLogic.05ef18c0.js +2 -0
- package/dist/InventoryLogic.09daaeaa.js +2 -0
- package/dist/InventoryLogic.0b64d0ad.js +2 -0
- package/dist/InventoryLogic.0ba84fa7.js +2 -0
- package/dist/InventoryLogic.0d599c03.js +2 -0
- package/dist/InventoryLogic.137e5482.js +2 -0
- package/dist/InventoryLogic.14a7860a.js +2 -0
- package/dist/InventoryLogic.14b7f292.js +2 -0
- package/dist/InventoryLogic.188504b1.js +2 -0
- package/dist/InventoryLogic.196261df.js +2 -0
- package/dist/InventoryLogic.1aa3d0be.js +2 -0
- package/dist/InventoryLogic.205007e9.js +2 -0
- package/dist/InventoryLogic.22a36cc8.js +2 -0
- package/dist/InventoryLogic.2433062e.js +2 -0
- package/dist/InventoryLogic.2642cf62.js +2 -0
- package/dist/InventoryLogic.2e2dcd29.js +2 -0
- package/dist/InventoryLogic.30ea2574.js +2 -0
- package/dist/InventoryLogic.34455124.js +2 -0
- package/dist/InventoryLogic.3675b133.js +2 -0
- package/dist/InventoryLogic.3b10ccc5.js +2 -0
- package/dist/InventoryLogic.3ccd3412.js +2 -0
- package/dist/InventoryLogic.3cd7da47.js +2 -0
- package/dist/InventoryLogic.415ac613.js +2 -0
- package/dist/InventoryLogic.421e1e7c.js +9 -0
- package/dist/InventoryLogic.457956a7.js +2 -0
- package/dist/InventoryLogic.48cfeaff.js +2 -0
- package/dist/InventoryLogic.4e7559ed.js +2 -0
- package/dist/InventoryLogic.50cb471b.js +2 -0
- package/dist/InventoryLogic.53279d78.js +2 -0
- package/dist/InventoryLogic.58dceea1.js +2 -0
- package/dist/InventoryLogic.5a96277c.js +2 -0
- package/dist/InventoryLogic.5baab4fe.js +2 -0
- package/dist/InventoryLogic.5c08e39a.js +2 -0
- package/dist/InventoryLogic.5c885f7a.js +2 -0
- package/dist/InventoryLogic.648c0930.js +2 -0
- package/dist/InventoryLogic.67c1b155.js +2 -0
- package/dist/InventoryLogic.69764b18.js +2 -0
- package/dist/InventoryLogic.6f8b7ae0.js +2 -0
- package/dist/InventoryLogic.708f773f.js +2 -0
- package/dist/InventoryLogic.724cdb7a.js +2 -0
- package/dist/InventoryLogic.7407f5ab.js +2 -0
- package/dist/InventoryLogic.7559452d.js +2 -0
- package/dist/InventoryLogic.81d4c177.js +2 -0
- package/dist/InventoryLogic.86caed3d.js +2 -0
- package/dist/InventoryLogic.89bc98ac.js +2 -0
- package/dist/InventoryLogic.8aa9c9eb.js +2 -0
- package/dist/InventoryLogic.926192ec.js +2 -0
- package/dist/InventoryLogic.95d27be0.js +2 -0
- package/dist/InventoryLogic.9899e841.js +2 -0
- package/dist/InventoryLogic.9a4b1e67.js +2 -0
- package/dist/InventoryLogic.9b53b460.js +2 -0
- package/dist/InventoryLogic.9f07806b.js +2 -0
- package/dist/InventoryLogic.a08adebe.js +2 -0
- package/dist/InventoryLogic.a4e13ed0.js +2 -0
- package/dist/InventoryLogic.ac0345c3.js +9 -0
- package/dist/InventoryLogic.aecbeacc.js +2 -0
- package/dist/InventoryLogic.b6a32e7a.js +2 -0
- package/dist/InventoryLogic.bf7b624e.js +2 -0
- package/dist/InventoryLogic.c44fa152.js +2 -0
- package/dist/InventoryLogic.c5bdd6e0.js +2 -0
- package/dist/InventoryLogic.c72232ce.js +2 -0
- package/dist/InventoryLogic.c903d27c.js +2 -0
- package/dist/InventoryLogic.caf3c5cd.js +2 -0
- package/dist/InventoryLogic.ce72ae5e.js +2 -0
- package/dist/InventoryLogic.d14897a2.js +2 -0
- package/dist/InventoryLogic.d678c3ae.js +2 -0
- package/dist/InventoryLogic.d76d5857.js +2 -0
- package/dist/InventoryLogic.dda8477e.js +2 -0
- package/dist/InventoryLogic.df1596da.js +2 -0
- package/dist/InventoryLogic.e02cbd0d.js +2 -0
- package/dist/InventoryLogic.e1a6db03.js +2 -0
- package/dist/InventoryLogic.e7e04396.js +2 -0
- package/dist/InventoryLogic.e92db878.js +2 -0
- package/dist/InventoryLogic.eaecbd8b.js +2 -0
- package/dist/InventoryLogic.eed8150d.js +2 -0
- package/dist/InventoryLogic.f27b4a7e.js +2 -0
- package/dist/InventoryLogic.f27e2dc7.js +2 -0
- package/dist/InventoryLogic.f29bd369.js +2 -0
- package/dist/InventoryLogic.f3361cdd.js +2 -0
- package/dist/InventoryLogic.fb851384.js +2 -0
- package/dist/InventoryLogic.fcbfca1e.js +2 -0
- package/dist/InventoryLogic.ff65d86c.js +2 -0
- package/dist/index.js +2 -0
- package/index.js +1 -1
- package/package.json +25 -8
package/README.md
CHANGED
|
@@ -19,10 +19,21 @@ services.</p>
|
|
|
19
19
|
<dd><p>A collection of Business logic and database functions. Shared between ReactJS
|
|
20
20
|
frontEnd and NodeJS BackEnd</p>
|
|
21
21
|
</dd>
|
|
22
|
+
<dt><a href="#module_Addresses">Addresses</a></dt>
|
|
23
|
+
<dd><p>Types and functins for handling addresses</p>
|
|
24
|
+
</dd>
|
|
25
|
+
<dt><a href="#module_BusinessData">BusinessData</a></dt>
|
|
26
|
+
<dd><p>Functions for managing (potentially)private data for an organization.
|
|
27
|
+
Unified structure as a sub-record of organization, or CityManager accounts</p>
|
|
28
|
+
</dd>
|
|
22
29
|
<dt><a href="#module_Commodities">Commodities</a></dt>
|
|
23
30
|
<dd><p>Typedefs, constants, support functions and database operations related to Commodity Matrials
|
|
24
31
|
users</p>
|
|
25
32
|
</dd>
|
|
33
|
+
<dt><a href="#module_Fundamentals">Fundamentals</a></dt>
|
|
34
|
+
<dd><p>Typedefs, constants, support functions and database operations related to Fundamental
|
|
35
|
+
setting from the Database *</p>
|
|
36
|
+
</dd>
|
|
26
37
|
<dt><a href="#module_LineItem">LineItem</a></dt>
|
|
27
38
|
<dd><p>Typedefs, constants, support functions and database operations related to LineItem Matrials
|
|
28
39
|
users</p>
|
|
@@ -36,6 +47,10 @@ users</p>
|
|
|
36
47
|
to an individual user. These do not <em>particularly</em> represent a paymentProvider - they are meant
|
|
37
48
|
as an abstraction above a specific payment processor.</p>
|
|
38
49
|
</dd>
|
|
50
|
+
<dt><a href="#module_PrivateData">PrivateData</a></dt>
|
|
51
|
+
<dd><p>Functions for managing (potentially)private data for a user or organization.
|
|
52
|
+
Unified structure as a sub-record of fan, organization, or CityManager accounts</p>
|
|
53
|
+
</dd>
|
|
39
54
|
<dt><a href="#module_Product">Product</a></dt>
|
|
40
55
|
<dd><p>Typedefs, constants, support functions and database operations related to Products</p>
|
|
41
56
|
</dd>
|
|
@@ -47,6 +62,10 @@ users</p>
|
|
|
47
62
|
<dd><p>Typedefs, constants, support functions and database operations related to usage Units
|
|
48
63
|
and conversions</p>
|
|
49
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>
|
|
50
69
|
<dt><a href="#module_Boilerplate">Boilerplate</a></dt>
|
|
51
70
|
<dd><p>Shared constants and symbols</p>
|
|
52
71
|
</dd>
|
|
@@ -178,6 +197,343 @@ called from a cloud environment
|
|
|
178
197
|
| measurementId: | <code>string</code> | (optional) Analytics/Measurement ID from Firebase Console |
|
|
179
198
|
| mapsAPIKey | <code>string</code> | (optional) App ID for Google Maps API, from Google |
|
|
180
199
|
|
|
200
|
+
<a name="module_Addresses"></a>
|
|
201
|
+
|
|
202
|
+
## Addresses
|
|
203
|
+
Types and functins for handling addresses
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
* [Addresses](#module_Addresses)
|
|
207
|
+
* _static_
|
|
208
|
+
* [.AddressDefault](#module_Addresses.AddressDefault) : <code>AddressType</code>
|
|
209
|
+
* [.AddressForm](#module_Addresses.AddressForm) : <code>AddressType</code>
|
|
210
|
+
* [.maplink](#module_Addresses.maplink) : <code>MapLink</code>
|
|
211
|
+
* [.deleteAddress(address)](#module_Addresses.deleteAddress) ⇒ <code>Promise.<void></code>
|
|
212
|
+
* [.deleteAddressByIdAndParent(addressId, parent, batch)](#module_Addresses.deleteAddressByIdAndParent) ⇒ <code>Promise.ChainType</code>
|
|
213
|
+
* [.formatAddress(address)](#module_Addresses.formatAddress) ⇒ <code>string</code>
|
|
214
|
+
* [.saveAddress(address, paraentRefPath)](#module_Addresses.saveAddress) ⇒ <code>Promise.<AddressType></code>
|
|
215
|
+
* [.fetchAddresses(account)](#module_Addresses.fetchAddresses) ⇒ <code>Promise.<Array.AddressType></code>
|
|
216
|
+
* _inner_
|
|
217
|
+
* [~AddressType](#module_Addresses..AddressType) : <code>object</code>
|
|
218
|
+
* [~MapLink](#module_Addresses..MapLink) : <code>object</code>
|
|
219
|
+
* [~ChainType](#module_Addresses..ChainType) : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
220
|
+
|
|
221
|
+
<a name="module_Addresses.AddressDefault"></a>
|
|
222
|
+
|
|
223
|
+
### Addresses.AddressDefault : <code>AddressType</code>
|
|
224
|
+
**Kind**: static constant of [<code>Addresses</code>](#module_Addresses)
|
|
225
|
+
<a name="module_Addresses.AddressForm"></a>
|
|
226
|
+
|
|
227
|
+
### Addresses.AddressForm : <code>AddressType</code>
|
|
228
|
+
**Kind**: static constant of [<code>Addresses</code>](#module_Addresses)
|
|
229
|
+
<a name="module_Addresses.maplink"></a>
|
|
230
|
+
|
|
231
|
+
### Addresses.maplink : <code>MapLink</code>
|
|
232
|
+
**Kind**: static constant of [<code>Addresses</code>](#module_Addresses)
|
|
233
|
+
**Read only**: true
|
|
234
|
+
<a name="module_Addresses.deleteAddress"></a>
|
|
235
|
+
|
|
236
|
+
### Addresses.deleteAddress(address) ⇒ <code>Promise.<void></code>
|
|
237
|
+
Deletes an existing address record from the database, based on it's own refPath
|
|
238
|
+
|
|
239
|
+
**Kind**: static method of [<code>Addresses</code>](#module_Addresses)
|
|
240
|
+
|
|
241
|
+
| Param | Type |
|
|
242
|
+
| --- | --- |
|
|
243
|
+
| address | <code>AddressType</code> |
|
|
244
|
+
| address.refPath | <code>string</code> |
|
|
245
|
+
|
|
246
|
+
<a name="module_Addresses.deleteAddressByIdAndParent"></a>
|
|
247
|
+
|
|
248
|
+
### Addresses.deleteAddressByIdAndParent(addressId, parent, batch) ⇒ <code>Promise.ChainType</code>
|
|
249
|
+
Deletes an existing address record from the database, based on it's parent
|
|
250
|
+
record and Id
|
|
251
|
+
|
|
252
|
+
**Kind**: static method of [<code>Addresses</code>](#module_Addresses)
|
|
253
|
+
|
|
254
|
+
| Param | Type |
|
|
255
|
+
| --- | --- |
|
|
256
|
+
| addressId | <code>string</code> |
|
|
257
|
+
| parent | <code>OrganizationType</code> |
|
|
258
|
+
| parent.refPath | <code>string</code> |
|
|
259
|
+
| batch | <code>ChainType</code> |
|
|
260
|
+
|
|
261
|
+
<a name="module_Addresses.formatAddress"></a>
|
|
262
|
+
|
|
263
|
+
### Addresses.formatAddress(address) ⇒ <code>string</code>
|
|
264
|
+
Builds a formatted string from a provided address record
|
|
265
|
+
|
|
266
|
+
**Kind**: static method of [<code>Addresses</code>](#module_Addresses)
|
|
267
|
+
|
|
268
|
+
| Param | Type |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| address | <code>AddressType</code> |
|
|
271
|
+
|
|
272
|
+
<a name="module_Addresses.saveAddress"></a>
|
|
273
|
+
|
|
274
|
+
### Addresses.saveAddress(address, paraentRefPath) ⇒ <code>Promise.<AddressType></code>
|
|
275
|
+
Saves an address record to the database below the provided parentRefPath,
|
|
276
|
+
whether exsiting or not
|
|
277
|
+
|
|
278
|
+
**Kind**: static method of [<code>Addresses</code>](#module_Addresses)
|
|
279
|
+
|
|
280
|
+
| Param | Type | Description |
|
|
281
|
+
| --- | --- | --- |
|
|
282
|
+
| address | <code>AddressType</code> | |
|
|
283
|
+
| address.refPath | <code>string</code> | if present, writes back |
|
|
284
|
+
| paraentRefPath | <code>string</code> | required if new record |
|
|
285
|
+
|
|
286
|
+
<a name="module_Addresses.fetchAddresses"></a>
|
|
287
|
+
|
|
288
|
+
### Addresses.fetchAddresses(account) ⇒ <code>Promise.<Array.AddressType></code>
|
|
289
|
+
Fetches all address records for an account
|
|
290
|
+
|
|
291
|
+
**Kind**: static method of [<code>Addresses</code>](#module_Addresses)
|
|
292
|
+
|
|
293
|
+
| Param | Type |
|
|
294
|
+
| --- | --- |
|
|
295
|
+
| account | <code>Record</code> |
|
|
296
|
+
| account.refPath | <code>string</code> |
|
|
297
|
+
|
|
298
|
+
<a name="module_Addresses..AddressType"></a>
|
|
299
|
+
|
|
300
|
+
### Addresses~AddressType : <code>object</code>
|
|
301
|
+
**Kind**: inner typedef of [<code>Addresses</code>](#module_Addresses)
|
|
302
|
+
**Properties**
|
|
303
|
+
|
|
304
|
+
| Name | Type | Description |
|
|
305
|
+
| --- | --- | --- |
|
|
306
|
+
| Id | <code>string</code> | will be populated for existing record; null or missing for new/minimal object |
|
|
307
|
+
| refPath | <code>string</code> | will be populated for existing record; null or missing for new/minimal object |
|
|
308
|
+
| address_line_1 | <code>string</code> | |
|
|
309
|
+
| address_line_2 | <code>string</code> | |
|
|
310
|
+
| city | <code>string</code> | |
|
|
311
|
+
| region | <code>string</code> | selected from a list of supported Cities/Regions |
|
|
312
|
+
| state | <code>string</code> | |
|
|
313
|
+
| zip | <code>zip</code> | |
|
|
314
|
+
| mapLink | <code>maplink</code> | link to Google map location |
|
|
315
|
+
|
|
316
|
+
<a name="module_Addresses..MapLink"></a>
|
|
317
|
+
|
|
318
|
+
### Addresses~MapLink : <code>object</code>
|
|
319
|
+
**Kind**: inner typedef of [<code>Addresses</code>](#module_Addresses)
|
|
320
|
+
**Properties**
|
|
321
|
+
|
|
322
|
+
| Name | Type | Description |
|
|
323
|
+
| --- | --- | --- |
|
|
324
|
+
| placeId | <code>string</code> | as defined by Google |
|
|
325
|
+
| latlng | <code>object</code> | coordinates tuple |
|
|
326
|
+
| latlng.lat | <code>string</code> | lattitude |
|
|
327
|
+
| latlng.lng | <code>string</code> | longitude |
|
|
328
|
+
| url | <code>string</code> | link to place/map entry |
|
|
329
|
+
| formatted_address | <code>string</code> | printable string of address |
|
|
330
|
+
|
|
331
|
+
<a name="module_Addresses..ChainType"></a>
|
|
332
|
+
|
|
333
|
+
### Addresses~ChainType : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
334
|
+
**Kind**: inner typedef of [<code>Addresses</code>](#module_Addresses)
|
|
335
|
+
<a name="module_BusinessData"></a>
|
|
336
|
+
|
|
337
|
+
## BusinessData
|
|
338
|
+
Functions for managing (potentially)private data for an organization.
|
|
339
|
+
Unified structure as a sub-record of organization, or CityManager accounts
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
* [BusinessData](#module_BusinessData)
|
|
343
|
+
* _static_
|
|
344
|
+
* [.fetchFullAccount(account)](#module_BusinessData.fetchFullAccount) ⇒ <code>Promise.AccountType</code>
|
|
345
|
+
* [.fetchBusinessData(account)](#module_BusinessData.fetchBusinessData) ⇒ <code>Promise.BusinessData</code>
|
|
346
|
+
* [.accountPage(account, origin)](#module_BusinessData.accountPage) ⇒ <code>string</code>
|
|
347
|
+
* [.createBusinessData(account, batch)](#module_BusinessData.createBusinessData) ⇒ <code>Promise.<ChainType></code>
|
|
348
|
+
* [.saveBusinessData(businessData)](#module_BusinessData.saveBusinessData) ⇒ <code>Promise.<BusinessData></code>
|
|
349
|
+
* [.deleteBusinessData(businessData)](#module_BusinessData.deleteBusinessData) ⇒ <code>Promise.<void></code>
|
|
350
|
+
* [.businessDataPath(account)](#module_BusinessData.businessDataPath) ⇒ <code>string</code>
|
|
351
|
+
* [.profileComplete(account, businessData)](#module_BusinessData.profileComplete) ⇒ <code>Boolean</code>
|
|
352
|
+
* [.profileIncomplete(account, businessData)](#module_BusinessData.profileIncomplete) ⇒ <code>string</code> \| <code>null</code>
|
|
353
|
+
* [.setOpenIssues(businessData)](#module_BusinessData.setOpenIssues) ⇒ <code>Promise.boolean</code>
|
|
354
|
+
* [.clearOpenIssues(businessData)](#module_BusinessData.clearOpenIssues) ⇒ <code>Promise.boolean</code>
|
|
355
|
+
* _inner_
|
|
356
|
+
* [~BusinessDefault](#module_BusinessData..BusinessDefault) : <code>BusinessData</code>
|
|
357
|
+
* [~BusinessAccountForm](#module_BusinessData..BusinessAccountForm) : <code>BusinessData</code>
|
|
358
|
+
* [~contact](#module_BusinessData..contact) : <code>object</code>
|
|
359
|
+
* [~BusinessData](#module_BusinessData..BusinessData) : <code>object</code>
|
|
360
|
+
* [~ChainType](#module_BusinessData..ChainType) : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
361
|
+
|
|
362
|
+
<a name="module_BusinessData.fetchFullAccount"></a>
|
|
363
|
+
|
|
364
|
+
### BusinessData.fetchFullAccount(account) ⇒ <code>Promise.AccountType</code>
|
|
365
|
+
Fetches a fulll object representation of an account, including BusinessData
|
|
366
|
+
|
|
367
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
368
|
+
|
|
369
|
+
| Param | Type |
|
|
370
|
+
| --- | --- |
|
|
371
|
+
| account | <code>AccountType</code> |
|
|
372
|
+
|
|
373
|
+
<a name="module_BusinessData.fetchBusinessData"></a>
|
|
374
|
+
|
|
375
|
+
### BusinessData.fetchBusinessData(account) ⇒ <code>Promise.BusinessData</code>
|
|
376
|
+
Fetches the BusinessData (corporate, addresses, etc) for an account
|
|
377
|
+
|
|
378
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
379
|
+
|
|
380
|
+
| Param | Type |
|
|
381
|
+
| --- | --- |
|
|
382
|
+
| account | <code>AccountType</code> |
|
|
383
|
+
|
|
384
|
+
<a name="module_BusinessData.accountPage"></a>
|
|
385
|
+
|
|
386
|
+
### BusinessData.accountPage(account, origin) ⇒ <code>string</code>
|
|
387
|
+
Composes a URL for an "account page" from the account, and passed base URL
|
|
388
|
+
|
|
389
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
390
|
+
**Returns**: <code>string</code> - full URL for business accouont
|
|
391
|
+
|
|
392
|
+
| Param | Type | Description |
|
|
393
|
+
| --- | --- | --- |
|
|
394
|
+
| account | <code>AccountType</code> | |
|
|
395
|
+
| origin | <code>string</code> | base URL for the application |
|
|
396
|
+
|
|
397
|
+
<a name="module_BusinessData.createBusinessData"></a>
|
|
398
|
+
|
|
399
|
+
### BusinessData.createBusinessData(account, batch) ⇒ <code>Promise.<ChainType></code>
|
|
400
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
401
|
+
**Returns**: <code>Promise.<ChainType></code> - WriteBatch, Transaction or Void
|
|
402
|
+
|
|
403
|
+
| Param | Type | Description |
|
|
404
|
+
| --- | --- | --- |
|
|
405
|
+
| account | <code>AccountType</code> | |
|
|
406
|
+
| batch | <code>ChainType</code> | batching object. Transaction will be added to the batch |
|
|
407
|
+
|
|
408
|
+
<a name="module_BusinessData.saveBusinessData"></a>
|
|
409
|
+
|
|
410
|
+
### BusinessData.saveBusinessData(businessData) ⇒ <code>Promise.<BusinessData></code>
|
|
411
|
+
Writes the "Business" data to the database
|
|
412
|
+
|
|
413
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
414
|
+
|
|
415
|
+
| Param | Type |
|
|
416
|
+
| --- | --- |
|
|
417
|
+
| businessData | <code>BusinessData</code> |
|
|
418
|
+
|
|
419
|
+
<a name="module_BusinessData.deleteBusinessData"></a>
|
|
420
|
+
|
|
421
|
+
### BusinessData.deleteBusinessData(businessData) ⇒ <code>Promise.<void></code>
|
|
422
|
+
Deletes a BusinessData record (rarely used if ever)
|
|
423
|
+
|
|
424
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
425
|
+
|
|
426
|
+
| Param | Type |
|
|
427
|
+
| --- | --- |
|
|
428
|
+
| businessData | <code>BusinessData</code> |
|
|
429
|
+
| businessData.refPath | <code>string</code> |
|
|
430
|
+
|
|
431
|
+
<a name="module_BusinessData.businessDataPath"></a>
|
|
432
|
+
|
|
433
|
+
### BusinessData.businessDataPath(account) ⇒ <code>string</code>
|
|
434
|
+
creates the "base path" (refPath) to store addresses based on an account (refPath)
|
|
435
|
+
|
|
436
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
437
|
+
|
|
438
|
+
| Param | Type |
|
|
439
|
+
| --- | --- |
|
|
440
|
+
| account | <code>Record</code> |
|
|
441
|
+
| account.refPath | <code>string</code> |
|
|
442
|
+
|
|
443
|
+
<a name="module_BusinessData.profileComplete"></a>
|
|
444
|
+
|
|
445
|
+
### BusinessData.profileComplete(account, businessData) ⇒ <code>Boolean</code>
|
|
446
|
+
verifies that all needed information has been filled in
|
|
447
|
+
|
|
448
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
449
|
+
|
|
450
|
+
| Param | Type | Description |
|
|
451
|
+
| --- | --- | --- |
|
|
452
|
+
| account | <code>AccountType</code> | |
|
|
453
|
+
| businessData | <code>BusinessData</code> | record |
|
|
454
|
+
|
|
455
|
+
<a name="module_BusinessData.profileIncomplete"></a>
|
|
456
|
+
|
|
457
|
+
### BusinessData.profileIncomplete(account, businessData) ⇒ <code>string</code> \| <code>null</code>
|
|
458
|
+
verifies that all needed information has been filled in
|
|
459
|
+
|
|
460
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
461
|
+
|
|
462
|
+
| Param | Type | Description |
|
|
463
|
+
| --- | --- | --- |
|
|
464
|
+
| account | <code>AccountType</code> | |
|
|
465
|
+
| businessData | <code>BusinessData</code> | record |
|
|
466
|
+
|
|
467
|
+
<a name="module_BusinessData.setOpenIssues"></a>
|
|
468
|
+
|
|
469
|
+
### BusinessData.setOpenIssues(businessData) ⇒ <code>Promise.boolean</code>
|
|
470
|
+
Sets the "openIssues" flag in an account's BUSINESSDATA record
|
|
471
|
+
The account's refPath is attached to the Payment system's record, and
|
|
472
|
+
used here to find the Payment Account
|
|
473
|
+
|
|
474
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
475
|
+
|
|
476
|
+
| Param | Type |
|
|
477
|
+
| --- | --- |
|
|
478
|
+
| businessData | <code>BusinessData</code> |
|
|
479
|
+
|
|
480
|
+
<a name="module_BusinessData.clearOpenIssues"></a>
|
|
481
|
+
|
|
482
|
+
### BusinessData.clearOpenIssues(businessData) ⇒ <code>Promise.boolean</code>
|
|
483
|
+
Clears the "openIssues" flag in an account's BUSINESSDATA record
|
|
484
|
+
The account's refPath is attached to the Payment system's record, and
|
|
485
|
+
used here to find the Payment Account
|
|
486
|
+
|
|
487
|
+
**Kind**: static method of [<code>BusinessData</code>](#module_BusinessData)
|
|
488
|
+
|
|
489
|
+
| Param | Type |
|
|
490
|
+
| --- | --- |
|
|
491
|
+
| businessData | <code>BusinessData</code> |
|
|
492
|
+
|
|
493
|
+
<a name="module_BusinessData..BusinessDefault"></a>
|
|
494
|
+
|
|
495
|
+
### BusinessData~BusinessDefault : <code>BusinessData</code>
|
|
496
|
+
**Kind**: inner constant of [<code>BusinessData</code>](#module_BusinessData)
|
|
497
|
+
**Default**: <code>{"Id":null,"email":null,"business_type":null,"contact":null,"business_address":null,"mailing_address":null,"billing_address":null,"tel":null,"mcc":null,"tax_rate":null,"openIssues":false}</code>
|
|
498
|
+
<a name="module_BusinessData..BusinessAccountForm"></a>
|
|
499
|
+
|
|
500
|
+
### BusinessData~BusinessAccountForm : <code>BusinessData</code>
|
|
501
|
+
**Kind**: inner constant of [<code>BusinessData</code>](#module_BusinessData)
|
|
502
|
+
**Default**: <code>{"refPath":"hidden:text","email":"email","business_type":"","contact":"","business_address":"","mailing_address":"","billing_address":"","tel":"tel","mcc":""}</code>
|
|
503
|
+
<a name="module_BusinessData..contact"></a>
|
|
504
|
+
|
|
505
|
+
### BusinessData~contact : <code>object</code>
|
|
506
|
+
**Kind**: inner typedef of [<code>BusinessData</code>](#module_BusinessData)
|
|
507
|
+
**Properties**
|
|
508
|
+
|
|
509
|
+
| Name | Type | Description |
|
|
510
|
+
| --- | --- | --- |
|
|
511
|
+
| contact.Id | <code>string</code> | |
|
|
512
|
+
| contact.first_name | <code>string</code> | |
|
|
513
|
+
| contact.last_name | <code>string</code> | |
|
|
514
|
+
| contact.tel | <code>string</code> | |
|
|
515
|
+
| contact.email | <code>string</code> | must be filled in to make profile public |
|
|
516
|
+
|
|
517
|
+
<a name="module_BusinessData..BusinessData"></a>
|
|
518
|
+
|
|
519
|
+
### BusinessData~BusinessData : <code>object</code>
|
|
520
|
+
**Kind**: inner typedef of [<code>BusinessData</code>](#module_BusinessData)
|
|
521
|
+
**Properties**
|
|
522
|
+
|
|
523
|
+
| Name | Type | Description |
|
|
524
|
+
| --- | --- | --- |
|
|
525
|
+
| email | <code>string</code> | must be filled in to make profile public |
|
|
526
|
+
| contact | <code>contact</code> | |
|
|
527
|
+
| tel | <code>string</code> | |
|
|
528
|
+
| business_type | <code>string</code> | |
|
|
529
|
+
| business_address | <code>AddressType</code> | |
|
|
530
|
+
| mailing_address | <code>AddressType</code> | |
|
|
531
|
+
| billing_address | <code>AddressType</code> | |
|
|
532
|
+
|
|
533
|
+
<a name="module_BusinessData..ChainType"></a>
|
|
534
|
+
|
|
535
|
+
### BusinessData~ChainType : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
536
|
+
**Kind**: inner typedef of [<code>BusinessData</code>](#module_BusinessData)
|
|
181
537
|
<a name="module_Commodities"></a>
|
|
182
538
|
|
|
183
539
|
## Commodities
|
|
@@ -389,6 +745,166 @@ An object to allow for paginating a table read from Firestore. REQUIRES a sortin
|
|
|
389
745
|
| PageForward | <code>method</code> | pages the fetch forward |
|
|
390
746
|
| PageBack | <code>method</code> | pages the fetch backward |
|
|
391
747
|
|
|
748
|
+
<a name="module_Fundamentals"></a>
|
|
749
|
+
|
|
750
|
+
## Fundamentals
|
|
751
|
+
Typedefs, constants, support functions and database operations related to Fundamental
|
|
752
|
+
setting from the Database *
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
* [Fundamentals](#module_Fundamentals)
|
|
756
|
+
* _static_
|
|
757
|
+
* [.fetchFundamentals()](#module_Fundamentals.fetchFundamentals) ⇒ <code>Promise.<Fundamentals></code>
|
|
758
|
+
* [.fetchRates()](#module_Fundamentals.fetchRates) ⇒ <code>Promise.<Rates></code>
|
|
759
|
+
* [.fetchPayoutRates()](#module_Fundamentals.fetchPayoutRates) ⇒ <code>Promise.<PaymentProcessor></code>
|
|
760
|
+
* [.fetchMCCs()](#module_Fundamentals.fetchMCCs) ⇒ <code>Promise.<Array.MCCType></code>
|
|
761
|
+
* [.fetchBusinessTypes()](#module_Fundamentals.fetchBusinessTypes) ⇒ <code>Promise.<Array.BusinessType></code>
|
|
762
|
+
* _inner_
|
|
763
|
+
* [~Rates](#module_Fundamentals..Rates) : <code>Rates</code>
|
|
764
|
+
* [~paymentProcessor](#module_Fundamentals..paymentProcessor) : <code>PaymentProcessor</code>
|
|
765
|
+
* [~MCCDefault](#module_Fundamentals..MCCDefault) : <code>MCCType</code>
|
|
766
|
+
* [~BusinessTypeDefault](#module_Fundamentals..BusinessTypeDefault) : <code>BusinessType</code>
|
|
767
|
+
* [~OrganizationFundamentals](#module_Fundamentals..OrganizationFundamentals) : <code>object</code>
|
|
768
|
+
* [~Rates](#module_Fundamentals..Rates) : <code>object</code>
|
|
769
|
+
* [~PaymentProcessor](#module_Fundamentals..PaymentProcessor) : <code>object</code>
|
|
770
|
+
* [~MCCType](#module_Fundamentals..MCCType) : <code>object</code>
|
|
771
|
+
* [~BusinessType](#module_Fundamentals..BusinessType) : <code>object</code>
|
|
772
|
+
* [~Fundamentals](#module_Fundamentals..Fundamentals) : <code>object</code>
|
|
773
|
+
|
|
774
|
+
<a name="module_Fundamentals.fetchFundamentals"></a>
|
|
775
|
+
|
|
776
|
+
### Fundamentals.fetchFundamentals() ⇒ <code>Promise.<Fundamentals></code>
|
|
777
|
+
returns a Promise which resolves with an
|
|
778
|
+
array of all Fundamentals Objects (or err)
|
|
779
|
+
|
|
780
|
+
**Kind**: static method of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
781
|
+
<a name="module_Fundamentals.fetchRates"></a>
|
|
782
|
+
|
|
783
|
+
### Fundamentals.fetchRates() ⇒ <code>Promise.<Rates></code>
|
|
784
|
+
returns a Promise that resolves with the Rates record from the database
|
|
785
|
+
|
|
786
|
+
**Kind**: static method of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
787
|
+
<a name="module_Fundamentals.fetchPayoutRates"></a>
|
|
788
|
+
|
|
789
|
+
### Fundamentals.fetchPayoutRates() ⇒ <code>Promise.<PaymentProcessor></code>
|
|
790
|
+
returns a Promise that resolves with the Rates record from the database
|
|
791
|
+
|
|
792
|
+
**Kind**: static method of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
793
|
+
<a name="module_Fundamentals.fetchMCCs"></a>
|
|
794
|
+
|
|
795
|
+
### Fundamentals.fetchMCCs() ⇒ <code>Promise.<Array.MCCType></code>
|
|
796
|
+
returns an array of all MCC (Merchant Commerce Code) available
|
|
797
|
+
|
|
798
|
+
**Kind**: static method of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
799
|
+
<a name="module_Fundamentals.fetchBusinessTypes"></a>
|
|
800
|
+
|
|
801
|
+
### Fundamentals.fetchBusinessTypes() ⇒ <code>Promise.<Array.BusinessType></code>
|
|
802
|
+
returns an array of all MCC (Merchant Commerce Code) available
|
|
803
|
+
|
|
804
|
+
**Kind**: static method of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
805
|
+
<a name="module_Fundamentals..Rates"></a>
|
|
806
|
+
|
|
807
|
+
### Fundamentals~Rates : <code>Rates</code>
|
|
808
|
+
**Kind**: inner constant of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
809
|
+
**Default**: <code>{"Id":null,"service_charge":""}</code>
|
|
810
|
+
<a name="module_Fundamentals..paymentProcessor"></a>
|
|
811
|
+
|
|
812
|
+
### Fundamentals~paymentProcessor : <code>PaymentProcessor</code>
|
|
813
|
+
**Kind**: inner constant of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
814
|
+
**Default**: <code>{"connected_active":200,"processing_concurrency":10,"processing_rate":25,"processing_time_window":1000,"per_payout":25,"rate_payout":25,"rate_payout_scale":10000}</code>
|
|
815
|
+
<a name="module_Fundamentals..MCCDefault"></a>
|
|
816
|
+
|
|
817
|
+
### Fundamentals~MCCDefault : <code>MCCType</code>
|
|
818
|
+
**Kind**: inner constant of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
819
|
+
**Default**: <code>{"Id":null,"MCC":null,"name":null,"description":null,"long":null,"type":null}</code>
|
|
820
|
+
<a name="module_Fundamentals..BusinessTypeDefault"></a>
|
|
821
|
+
|
|
822
|
+
### Fundamentals~BusinessTypeDefault : <code>BusinessType</code>
|
|
823
|
+
**Kind**: inner constant of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
824
|
+
**Default**: <code>{"Id":null,"business_type":null,"name":null,"description":null}</code>
|
|
825
|
+
<a name="module_Fundamentals..OrganizationFundamentals"></a>
|
|
826
|
+
|
|
827
|
+
### Fundamentals~OrganizationFundamentals : <code>object</code>
|
|
828
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
829
|
+
**Properties**
|
|
830
|
+
|
|
831
|
+
| Name | Type | Description |
|
|
832
|
+
| --- | --- | --- |
|
|
833
|
+
| Types | <code>Array.string</code> | Allowed organization types |
|
|
834
|
+
|
|
835
|
+
<a name="module_Fundamentals..Rates"></a>
|
|
836
|
+
|
|
837
|
+
### Fundamentals~Rates : <code>object</code>
|
|
838
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
839
|
+
**Properties**
|
|
840
|
+
|
|
841
|
+
| Name | Type | Description |
|
|
842
|
+
| --- | --- | --- |
|
|
843
|
+
| Id | <code>string</code> | |
|
|
844
|
+
| service_charge | <code>object</code> | |
|
|
845
|
+
| service_charge.minimum | <code>number</code> | |
|
|
846
|
+
| service_charge.rate | <code>number</code> | percentage |
|
|
847
|
+
| service_charge.rounding_factor | <code>number</code> | |
|
|
848
|
+
|
|
849
|
+
<a name="module_Fundamentals..PaymentProcessor"></a>
|
|
850
|
+
|
|
851
|
+
### Fundamentals~PaymentProcessor : <code>object</code>
|
|
852
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
853
|
+
**Properties**
|
|
854
|
+
|
|
855
|
+
| Name | Type | Description |
|
|
856
|
+
| --- | --- | --- |
|
|
857
|
+
| connected_active | <code>number</code> | allowed active connections |
|
|
858
|
+
| processing_concurrency | <code>number</code> | |
|
|
859
|
+
| processing_rate | <code>number</code> | |
|
|
860
|
+
| processing_time_window | <code>number</code> | |
|
|
861
|
+
| per_payout | <code>number</code> | |
|
|
862
|
+
| rate_payout | <code>number</code> | |
|
|
863
|
+
| rate_payout_scale | <code>number</code> | |
|
|
864
|
+
|
|
865
|
+
<a name="module_Fundamentals..MCCType"></a>
|
|
866
|
+
|
|
867
|
+
### Fundamentals~MCCType : <code>object</code>
|
|
868
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
869
|
+
**Properties**
|
|
870
|
+
|
|
871
|
+
| Name | Type | Description |
|
|
872
|
+
| --- | --- | --- |
|
|
873
|
+
| Id | <code>string</code> | |
|
|
874
|
+
| MCC | <code>string</code> | Merchant Class Code |
|
|
875
|
+
| name | <code>string</code> | Merchant Class Code |
|
|
876
|
+
| description | <code>string</code> | description of Merchant Class Code |
|
|
877
|
+
| long | <code>string</code> | long description of Merchant Class Code |
|
|
878
|
+
| type | <code>string</code> | Applicable business model - "Artists", "Venues" or "Brands" |
|
|
879
|
+
|
|
880
|
+
<a name="module_Fundamentals..BusinessType"></a>
|
|
881
|
+
|
|
882
|
+
### Fundamentals~BusinessType : <code>object</code>
|
|
883
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
884
|
+
**Properties**
|
|
885
|
+
|
|
886
|
+
| Name | Type | Description |
|
|
887
|
+
| --- | --- | --- |
|
|
888
|
+
| Id | <code>string</code> | |
|
|
889
|
+
| business_type | <code>string</code> | allowed business type value |
|
|
890
|
+
| name | <code>string</code> | business type value |
|
|
891
|
+
| description | <code>string</code> | description ofbusiness type value |
|
|
892
|
+
|
|
893
|
+
<a name="module_Fundamentals..Fundamentals"></a>
|
|
894
|
+
|
|
895
|
+
### Fundamentals~Fundamentals : <code>object</code>
|
|
896
|
+
**Kind**: inner typedef of [<code>Fundamentals</code>](#module_Fundamentals)
|
|
897
|
+
**Properties**
|
|
898
|
+
|
|
899
|
+
| Name | Type | Description |
|
|
900
|
+
| --- | --- | --- |
|
|
901
|
+
| Rates | <code>Rates</code> | |
|
|
902
|
+
| PaymentProcessor | <code>PaymentProcessor</code> | |
|
|
903
|
+
| Defaults | <code>object</code> | |
|
|
904
|
+
| Defaults.MCC | <code>MCCType</code> | |
|
|
905
|
+
| Organizations | <code>OrganizationFundamentals</code> | |
|
|
906
|
+
| Organizations.Types | <code>Array.string</code> | Allowed organization types |
|
|
907
|
+
|
|
392
908
|
<a name="module_LineItem"></a>
|
|
393
909
|
|
|
394
910
|
## LineItem
|
|
@@ -1136,6 +1652,127 @@ Changes the paidQ label on a receipt associated with a pledgeTicket
|
|
|
1136
1652
|
|
|
1137
1653
|
### Payment~AccountObject : <code>UserObject</code>
|
|
1138
1654
|
**Kind**: inner typedef of [<code>Payment</code>](#module_Payment)
|
|
1655
|
+
<a name="module_PrivateData"></a>
|
|
1656
|
+
|
|
1657
|
+
## PrivateData
|
|
1658
|
+
Functions for managing (potentially)private data for a user or organization.
|
|
1659
|
+
Unified structure as a sub-record of fan, organization, or CityManager accounts
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
* [PrivateData](#module_PrivateData)
|
|
1663
|
+
* _static_
|
|
1664
|
+
* [.fetchPrivateData(account)](#module_PrivateData.fetchPrivateData) ⇒ <code>Promise.PrivateData</code>
|
|
1665
|
+
* [.createPrivateData(account, batch)](#module_PrivateData.createPrivateData) ⇒ <code>Promise.<ChainType></code>
|
|
1666
|
+
* [.savePrivateData(privateData)](#module_PrivateData.savePrivateData) ⇒ <code>Promise.<PrivateData></code>
|
|
1667
|
+
* [.deletePrivateData(privateData)](#module_PrivateData.deletePrivateData) ⇒ <code>Promise.<void></code>
|
|
1668
|
+
* [.privateDataPath(account)](#module_PrivateData.privateDataPath) ⇒ <code>string</code>
|
|
1669
|
+
* _inner_
|
|
1670
|
+
* [~PrivateDefault](#module_PrivateData..PrivateDefault) : <code>PrivateData</code>
|
|
1671
|
+
* [~PrivateAccountForm](#module_PrivateData..PrivateAccountForm) : <code>PrivateData</code>
|
|
1672
|
+
* [~contact](#module_PrivateData..contact) : <code>object</code>
|
|
1673
|
+
* [~PrivateData](#module_PrivateData..PrivateData) : <code>object</code>
|
|
1674
|
+
* [~ChainType](#module_PrivateData..ChainType) : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
1675
|
+
|
|
1676
|
+
<a name="module_PrivateData.fetchPrivateData"></a>
|
|
1677
|
+
|
|
1678
|
+
### PrivateData.fetchPrivateData(account) ⇒ <code>Promise.PrivateData</code>
|
|
1679
|
+
Fecthes the PrivateData (email, tel, addresses, etc) for a Fan account
|
|
1680
|
+
|
|
1681
|
+
**Kind**: static method of [<code>PrivateData</code>](#module_PrivateData)
|
|
1682
|
+
|
|
1683
|
+
| Param | Type |
|
|
1684
|
+
| --- | --- |
|
|
1685
|
+
| account | <code>AccountType</code> |
|
|
1686
|
+
|
|
1687
|
+
<a name="module_PrivateData.createPrivateData"></a>
|
|
1688
|
+
|
|
1689
|
+
### PrivateData.createPrivateData(account, batch) ⇒ <code>Promise.<ChainType></code>
|
|
1690
|
+
**Kind**: static method of [<code>PrivateData</code>](#module_PrivateData)
|
|
1691
|
+
**Returns**: <code>Promise.<ChainType></code> - WriteBatch, Transaction or Void
|
|
1692
|
+
|
|
1693
|
+
| Param | Type | Description |
|
|
1694
|
+
| --- | --- | --- |
|
|
1695
|
+
| account | <code>AccountType</code> | |
|
|
1696
|
+
| batch | <code>ChainType</code> | batching object. Transaction will be added to the batch |
|
|
1697
|
+
|
|
1698
|
+
<a name="module_PrivateData.savePrivateData"></a>
|
|
1699
|
+
|
|
1700
|
+
### PrivateData.savePrivateData(privateData) ⇒ <code>Promise.<PrivateData></code>
|
|
1701
|
+
Writes the "private" data to the database
|
|
1702
|
+
|
|
1703
|
+
**Kind**: static method of [<code>PrivateData</code>](#module_PrivateData)
|
|
1704
|
+
|
|
1705
|
+
| Param | Type |
|
|
1706
|
+
| --- | --- |
|
|
1707
|
+
| privateData | <code>PrivateData</code> |
|
|
1708
|
+
|
|
1709
|
+
<a name="module_PrivateData.deletePrivateData"></a>
|
|
1710
|
+
|
|
1711
|
+
### PrivateData.deletePrivateData(privateData) ⇒ <code>Promise.<void></code>
|
|
1712
|
+
Deletes a PrivateData record (rarely used if ever)
|
|
1713
|
+
|
|
1714
|
+
**Kind**: static method of [<code>PrivateData</code>](#module_PrivateData)
|
|
1715
|
+
|
|
1716
|
+
| Param | Type |
|
|
1717
|
+
| --- | --- |
|
|
1718
|
+
| privateData | <code>PrivateData</code> |
|
|
1719
|
+
| privateData.refPath | <code>string</code> |
|
|
1720
|
+
|
|
1721
|
+
<a name="module_PrivateData.privateDataPath"></a>
|
|
1722
|
+
|
|
1723
|
+
### PrivateData.privateDataPath(account) ⇒ <code>string</code>
|
|
1724
|
+
creates the "base path" (refPath) to store addresses based on an account (refPath)
|
|
1725
|
+
|
|
1726
|
+
**Kind**: static method of [<code>PrivateData</code>](#module_PrivateData)
|
|
1727
|
+
|
|
1728
|
+
| Param | Type |
|
|
1729
|
+
| --- | --- |
|
|
1730
|
+
| account | <code>Record</code> |
|
|
1731
|
+
| account.refPath | <code>string</code> |
|
|
1732
|
+
|
|
1733
|
+
<a name="module_PrivateData..PrivateDefault"></a>
|
|
1734
|
+
|
|
1735
|
+
### PrivateData~PrivateDefault : <code>PrivateData</code>
|
|
1736
|
+
**Kind**: inner constant of [<code>PrivateData</code>](#module_PrivateData)
|
|
1737
|
+
**Default**: <code>{"Id":null,"email":null,"contact":null,"business_address":null,"mailing_address":null,"billing_address":null,"tel":null,"tax_rate":null,"openIssues":false}</code>
|
|
1738
|
+
<a name="module_PrivateData..PrivateAccountForm"></a>
|
|
1739
|
+
|
|
1740
|
+
### PrivateData~PrivateAccountForm : <code>PrivateData</code>
|
|
1741
|
+
**Kind**: inner constant of [<code>PrivateData</code>](#module_PrivateData)
|
|
1742
|
+
**Default**: <code>{"refPath":"hidden:text","email":"email","contact":"","business_address":"","mailing_address":"","billing_address":"","tel":"tel"}</code>
|
|
1743
|
+
<a name="module_PrivateData..contact"></a>
|
|
1744
|
+
|
|
1745
|
+
### PrivateData~contact : <code>object</code>
|
|
1746
|
+
**Kind**: inner typedef of [<code>PrivateData</code>](#module_PrivateData)
|
|
1747
|
+
**Properties**
|
|
1748
|
+
|
|
1749
|
+
| Name | Type | Description |
|
|
1750
|
+
| --- | --- | --- |
|
|
1751
|
+
| contact.Id | <code>string</code> | |
|
|
1752
|
+
| contact.first_name | <code>string</code> | |
|
|
1753
|
+
| contact.last_name | <code>string</code> | |
|
|
1754
|
+
| contact.tel | <code>string</code> | |
|
|
1755
|
+
| contact.email | <code>string</code> | must be filled in to make profile public |
|
|
1756
|
+
|
|
1757
|
+
<a name="module_PrivateData..PrivateData"></a>
|
|
1758
|
+
|
|
1759
|
+
### PrivateData~PrivateData : <code>object</code>
|
|
1760
|
+
**Kind**: inner typedef of [<code>PrivateData</code>](#module_PrivateData)
|
|
1761
|
+
**Properties**
|
|
1762
|
+
|
|
1763
|
+
| Name | Type | Description |
|
|
1764
|
+
| --- | --- | --- |
|
|
1765
|
+
| email | <code>string</code> | must be filled in to make profile public |
|
|
1766
|
+
| contact | <code>contact</code> | |
|
|
1767
|
+
| tel | <code>string</code> | |
|
|
1768
|
+
| business_address | <code>AddressType</code> | |
|
|
1769
|
+
| mailing_address | <code>AddressType</code> | |
|
|
1770
|
+
| billing_address | <code>AddressType</code> | |
|
|
1771
|
+
|
|
1772
|
+
<a name="module_PrivateData..ChainType"></a>
|
|
1773
|
+
|
|
1774
|
+
### PrivateData~ChainType : <code>WriteBatch</code> \| <code>Transaction</code> \| <code>void</code>
|
|
1775
|
+
**Kind**: inner typedef of [<code>PrivateData</code>](#module_PrivateData)
|
|
1139
1776
|
<a name="module_Product"></a>
|
|
1140
1777
|
|
|
1141
1778
|
## Product
|
|
@@ -1152,6 +1789,20 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
1152
1789
|
* [~ProductDefaultForm](#module_Product..ProductDefaultForm) : <code>Product</code>
|
|
1153
1790
|
* [~updateProduct(product, user)](#module_Product..updateProduct) ⇒ <code>promise.LineItem</code>
|
|
1154
1791
|
* [~summarizeProduct(product)](#module_Product..summarizeProduct) ⇒ <code>string</code>
|
|
1792
|
+
* [~Recipe_Data](#module_Product..Recipe_Data) : <code>object</code>
|
|
1793
|
+
* [~AttributeList](#module_Product..AttributeList) : <code>Array.String</code>
|
|
1794
|
+
* [~AttributeValue](#module_Product..AttributeValue) : <code>object</code>
|
|
1795
|
+
* [~ProductImage](#module_Product..ProductImage) : <code>object</code>
|
|
1796
|
+
* [~CurrencyDescription](#module_Product..CurrencyDescription) : <code>object</code>
|
|
1797
|
+
* [~MonetaryValue](#module_Product..MonetaryValue) : <code>object</code>
|
|
1798
|
+
* [~FullProductPricing](#module_Product..FullProductPricing) : <code>object</code>
|
|
1799
|
+
* [~ProductDimensions](#module_Product..ProductDimensions) : <code>object</code>
|
|
1800
|
+
* [~PriceObject](#module_Product..PriceObject) : <code>object</code>
|
|
1801
|
+
* [~ProductWeight](#module_Product..ProductWeight) : <code>object</code>
|
|
1802
|
+
* [~ProductMeasurements](#module_Product..ProductMeasurements) : <code>object</code>
|
|
1803
|
+
* [~ProductStock](#module_Product..ProductStock) : <code>object</code>
|
|
1804
|
+
* [~PhysicalProductVariant](#module_Product..PhysicalProductVariant) : <code>object</code>
|
|
1805
|
+
* [~MetaData](#module_Product..MetaData) : <code>object</code>
|
|
1155
1806
|
* [~Product](#module_Product..Product) : <code>object</code>
|
|
1156
1807
|
|
|
1157
1808
|
<a name="module_Product.createProduct"></a>
|
|
@@ -1178,7 +1829,7 @@ Creates a new Blank Product
|
|
|
1178
1829
|
|
|
1179
1830
|
### Product~ProductDefault : <code>Product</code>
|
|
1180
1831
|
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
1181
|
-
**Default**: <code>{"
|
|
1832
|
+
**Default**: <code>{"name":"","description":null,"recipe":"","image_links":"","type":"","google_product_type":"","shipping_time":0,"condition":"","adultQ":false,"age_group":"adult","color":"","material":"","gender":"unisex","attributes_gemstones":"","pattern":"","size":"","weight":0,"shippingMeasurements":""}</code>
|
|
1182
1833
|
**Read only**: true
|
|
1183
1834
|
<a name="module_Product..ProductDataForm"></a>
|
|
1184
1835
|
|
|
@@ -1217,26 +1868,222 @@ Returns a standardized formatted name string
|
|
|
1217
1868
|
| --- | --- |
|
|
1218
1869
|
| product | <code>Unit</code> |
|
|
1219
1870
|
|
|
1220
|
-
<a name="module_Product..
|
|
1871
|
+
<a name="module_Product..Recipe_Data"></a>
|
|
1221
1872
|
|
|
1222
|
-
### Product~
|
|
1223
|
-
|
|
1873
|
+
### Product~Recipe\_Data : <code>object</code>
|
|
1874
|
+
"recipe" related values - build-stage markups, product/project Flag, created/modified dates
|
|
1224
1875
|
|
|
1225
1876
|
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1226
1877
|
**Properties**
|
|
1227
1878
|
|
|
1228
1879
|
| Name | Type | Description |
|
|
1229
1880
|
| --- | --- | --- |
|
|
1230
|
-
| Id | <code>string</code> | Id of document (redundant for convenience) |
|
|
1231
|
-
| refPath | <code>string</code> | if from database, full path to document |
|
|
1232
|
-
| name | <code>string</code> | name for the Product |
|
|
1233
|
-
| description | <code>string</code> | |
|
|
1234
|
-
| sku | <code>string</code> | |
|
|
1235
1881
|
| markups | <code>module:Markups~Stage</code> | |
|
|
1236
1882
|
| projectQ | <code>boolean</code> | flag for product/project |
|
|
1237
1883
|
| created | <code>dateTime</code> | |
|
|
1238
1884
|
| modified | <code>dateTime</code> | |
|
|
1239
1885
|
|
|
1886
|
+
<a name="module_Product..AttributeList"></a>
|
|
1887
|
+
|
|
1888
|
+
### Product~AttributeList : <code>Array.String</code>
|
|
1889
|
+
A list of attributes for a product
|
|
1890
|
+
|
|
1891
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1892
|
+
<a name="module_Product..AttributeValue"></a>
|
|
1893
|
+
|
|
1894
|
+
### Product~AttributeValue : <code>object</code>
|
|
1895
|
+
Array of attribute name/value pairs
|
|
1896
|
+
|
|
1897
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1898
|
+
**Properties**
|
|
1899
|
+
|
|
1900
|
+
| Name | Type | Description |
|
|
1901
|
+
| --- | --- | --- |
|
|
1902
|
+
| attibuteName | <code>string</code> | attribute name from attribute list |
|
|
1903
|
+
| value | <code>string</code> | value for the particular attribute |
|
|
1904
|
+
|
|
1905
|
+
<a name="module_Product..ProductImage"></a>
|
|
1906
|
+
|
|
1907
|
+
### Product~ProductImage : <code>object</code>
|
|
1908
|
+
Image Descriptor
|
|
1909
|
+
|
|
1910
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1911
|
+
**Properties**
|
|
1912
|
+
|
|
1913
|
+
| Name | Type | Description |
|
|
1914
|
+
| --- | --- | --- |
|
|
1915
|
+
| altText | <code>string</code> | alt text for the image - SEO etc |
|
|
1916
|
+
| availableFormats | <code>Array.string</code> | Available image sizes. |
|
|
1917
|
+
| id | <code>string</code> | unique id for this productImage |
|
|
1918
|
+
| orderIndex | <code>integer</code> | Position of the image in the product's image list. |
|
|
1919
|
+
| originalSize | <code>object</code> | Image size when first uploaded. |
|
|
1920
|
+
| seoOptions | <code>MetaData</code> | |
|
|
1921
|
+
| URL | <code>string</code> | Absolute URL of the hosted image. |
|
|
1922
|
+
|
|
1923
|
+
<a name="module_Product..CurrencyDescription"></a>
|
|
1924
|
+
|
|
1925
|
+
### Product~CurrencyDescription : <code>object</code>
|
|
1926
|
+
Currency Description ISO 4217 currency code
|
|
1927
|
+
|
|
1928
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1929
|
+
**Properties**
|
|
1930
|
+
|
|
1931
|
+
| Name | Type |
|
|
1932
|
+
| --- | --- |
|
|
1933
|
+
| currencyCode | <code>string</code> |
|
|
1934
|
+
| defaultFractionDigits | <code>integer</code> |
|
|
1935
|
+
| displayName | <code>string</code> |
|
|
1936
|
+
| numericCodeAsString | <code>string</code> |
|
|
1937
|
+
| symbol | <code>string</code> |
|
|
1938
|
+
|
|
1939
|
+
<a name="module_Product..MonetaryValue"></a>
|
|
1940
|
+
|
|
1941
|
+
### Product~MonetaryValue : <code>object</code>
|
|
1942
|
+
Monetary Value Specification
|
|
1943
|
+
|
|
1944
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1945
|
+
**Properties**
|
|
1946
|
+
|
|
1947
|
+
| Name | Type | Description |
|
|
1948
|
+
| --- | --- | --- |
|
|
1949
|
+
| | <code>CurrencyDescription</code> | |
|
|
1950
|
+
| value | <code>decimal</code> | Decimal monetary value |
|
|
1951
|
+
|
|
1952
|
+
<a name="module_Product..FullProductPricing"></a>
|
|
1953
|
+
|
|
1954
|
+
### Product~FullProductPricing : <code>object</code>
|
|
1955
|
+
Pricing Object
|
|
1956
|
+
|
|
1957
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1958
|
+
**Properties**
|
|
1959
|
+
|
|
1960
|
+
| Name | Type |
|
|
1961
|
+
| --- | --- |
|
|
1962
|
+
| basePrice | <code>MonetaryValue</code> |
|
|
1963
|
+
| onSale | <code>boolean</code> |
|
|
1964
|
+
| salePrice | <code>MonetaryValue</code> |
|
|
1965
|
+
|
|
1966
|
+
<a name="module_Product..ProductDimensions"></a>
|
|
1967
|
+
|
|
1968
|
+
### Product~ProductDimensions : <code>object</code>
|
|
1969
|
+
Dimensions Object
|
|
1970
|
+
|
|
1971
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1972
|
+
**Properties**
|
|
1973
|
+
|
|
1974
|
+
| Name | Type | Description |
|
|
1975
|
+
| --- | --- | --- |
|
|
1976
|
+
| height | <code>float</code> | |
|
|
1977
|
+
| width | <code>float</code> | |
|
|
1978
|
+
| length | <code>float</code> | |
|
|
1979
|
+
| unit | <code>text</code> | //ProductDimensionsUnit |
|
|
1980
|
+
|
|
1981
|
+
<a name="module_Product..PriceObject"></a>
|
|
1982
|
+
|
|
1983
|
+
### Product~PriceObject : <code>object</code>
|
|
1984
|
+
Price Object
|
|
1985
|
+
|
|
1986
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1987
|
+
<a name="module_Product..ProductWeight"></a>
|
|
1988
|
+
|
|
1989
|
+
### Product~ProductWeight : <code>object</code>
|
|
1990
|
+
Weight Object
|
|
1991
|
+
|
|
1992
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
1993
|
+
**Properties**
|
|
1994
|
+
|
|
1995
|
+
| Name | Type | Description |
|
|
1996
|
+
| --- | --- | --- |
|
|
1997
|
+
| unit | <code>text</code> | //ProductWeightUnitEnum |
|
|
1998
|
+
| value | <code>float</code> | |
|
|
1999
|
+
|
|
2000
|
+
<a name="module_Product..ProductMeasurements"></a>
|
|
2001
|
+
|
|
2002
|
+
### Product~ProductMeasurements : <code>object</code>
|
|
2003
|
+
Measurements of the variant when it's shipped. Present for PHYSICAL products only.
|
|
2004
|
+
|
|
2005
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
2006
|
+
**Properties**
|
|
2007
|
+
|
|
2008
|
+
| Name | Type |
|
|
2009
|
+
| --- | --- |
|
|
2010
|
+
| dimensions | <code>ProductDimensions</code> |
|
|
2011
|
+
| weight | <code>ProductWeight</code> |
|
|
2012
|
+
|
|
2013
|
+
<a name="module_Product..ProductStock"></a>
|
|
2014
|
+
|
|
2015
|
+
### Product~ProductStock : <code>object</code>
|
|
2016
|
+
Available stock for the variant. Present for PHYSICAL products only.
|
|
2017
|
+
|
|
2018
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
2019
|
+
**Properties**
|
|
2020
|
+
|
|
2021
|
+
| Name | Type |
|
|
2022
|
+
| --- | --- |
|
|
2023
|
+
| quantity | <code>integer</code> |
|
|
2024
|
+
| unlimited | <code>boolean</code> |
|
|
2025
|
+
|
|
2026
|
+
<a name="module_Product..PhysicalProductVariant"></a>
|
|
2027
|
+
|
|
2028
|
+
### Product~PhysicalProductVariant : <code>object</code>
|
|
2029
|
+
variant record (including inventory and pricing)
|
|
2030
|
+
|
|
2031
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
2032
|
+
**Properties**
|
|
2033
|
+
|
|
2034
|
+
| Name | Type | Description |
|
|
2035
|
+
| --- | --- | --- |
|
|
2036
|
+
| attributes | <code>Array.AttributeValue</code> | array of attribute/value pairs for a variant |
|
|
2037
|
+
| sku | <code>string</code> | |
|
|
2038
|
+
| mpn | <code>string</code> | manufacturer part number |
|
|
2039
|
+
| gtin | <code>string</code> | Global Trade Item Number |
|
|
2040
|
+
| id | <code>string</code> | unique ID for product variant |
|
|
2041
|
+
| image | <code>ProductImage</code> | Image associated with this variant |
|
|
2042
|
+
| shippingMeasurements | <code>ProductMeasurements</code> | |
|
|
2043
|
+
| stock | <code>ProductStock</code> | |
|
|
2044
|
+
|
|
2045
|
+
<a name="module_Product..MetaData"></a>
|
|
2046
|
+
|
|
2047
|
+
### Product~MetaData : <code>object</code>
|
|
2048
|
+
Meta Information for SEO
|
|
2049
|
+
|
|
2050
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
2051
|
+
**Properties**
|
|
2052
|
+
|
|
2053
|
+
| Name | Type |
|
|
2054
|
+
| --- | --- |
|
|
2055
|
+
| title | <code>string</code> |
|
|
2056
|
+
| description | <code>string</code> |
|
|
2057
|
+
|
|
2058
|
+
<a name="module_Product..Product"></a>
|
|
2059
|
+
|
|
2060
|
+
### Product~Product : <code>object</code>
|
|
2061
|
+
a product record
|
|
2062
|
+
|
|
2063
|
+
**Kind**: inner typedef of [<code>Product</code>](#module_Product)
|
|
2064
|
+
**Properties**
|
|
2065
|
+
|
|
2066
|
+
| Name | Type | Description |
|
|
2067
|
+
| --- | --- | --- |
|
|
2068
|
+
| Id | <code>string</code> | Database Id of document (redundant for convenience) |
|
|
2069
|
+
| refPath | <code>string</code> | if from database, full path to document |
|
|
2070
|
+
| name | <code>string</code> | name for the Product |
|
|
2071
|
+
| description | <code>string</code> | Basic description of the product |
|
|
2072
|
+
| recipe | <code>Recipe\_Data</code> | pricing and fabrication data |
|
|
2073
|
+
| image_links | <code>Array:ImageLinks</code> | |
|
|
2074
|
+
| type | <code>text</code> | //ProductTypeV2Enum |
|
|
2075
|
+
| isVisible | <code>boolean</code> | |
|
|
2076
|
+
| seoOptions | <code>MetaData</code> | |
|
|
2077
|
+
| name | <code>string</code> | name for the Product |
|
|
2078
|
+
| seoOptions | <code>MetaData</code> | |
|
|
2079
|
+
| tags | <code>Array.string</code> | |
|
|
2080
|
+
| materials | <code>Array.string</code> | |
|
|
2081
|
+
| patterns | <code>Array.string</code> | |
|
|
2082
|
+
| URL | <code>string</code> | |
|
|
2083
|
+
| urlSlug | <code>string</code> | |
|
|
2084
|
+
| variantAttributes | <code>Array.string</code> | |
|
|
2085
|
+
| variants | <code>Array.PhysicalProductVariant</code> | |
|
|
2086
|
+
|
|
1240
2087
|
<a name="module_User"></a>
|
|
1241
2088
|
|
|
1242
2089
|
## User
|
|
@@ -1579,11 +2426,29 @@ and conversions
|
|
|
1579
2426
|
* [.saveForm(type)](#module_Utilities.saveForm) ⇒ <code>callback</code>
|
|
1580
2427
|
* [.updateChangeForm(type)](#module_Utilities.updateChangeForm) ⇒ <code>callback</code>
|
|
1581
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>
|
|
1582
2443
|
* _inner_
|
|
2444
|
+
* [~PromisePool](#module_Utilities..PromisePool)
|
|
2445
|
+
* [~promiseOptionsDefault](#module_Utilities..promiseOptionsDefault) : <code>PromiseOptions</code>
|
|
1583
2446
|
* [~stripDocIdFromRefPath(refPath)](#module_Utilities..stripDocIdFromRefPath) ⇒ <code>string</code>
|
|
1584
2447
|
* [~UpdateChange
|
|
1585
2448
|
Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceObject)](#module_Utilities..UpdateChange
|
|
1586
2449
|
Function Signature for UpdateChange functions) ⇒ <code>object</code>
|
|
2450
|
+
* [~generateIterator(entryArray, actionFunction)](#module_Utilities..generateIterator)
|
|
2451
|
+
* [~PromiseOptions](#module_Utilities..PromiseOptions) : <code>object</code>
|
|
1587
2452
|
|
|
1588
2453
|
<a name="module_Utilities.recordByIdAndType"></a>
|
|
1589
2454
|
|
|
@@ -1834,6 +2699,182 @@ usage are defined in business logic elsewhere
|
|
|
1834
2699
|
| --- | --- | --- |
|
|
1835
2700
|
| fieldname | <code>string</code> | which business type is being processes |
|
|
1836
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>{"concurrency":3,"rate":10}</code>
|
|
2877
|
+
**Read only**: true
|
|
1837
2878
|
<a name="module_Utilities..stripDocIdFromRefPath"></a>
|
|
1838
2879
|
|
|
1839
2880
|
### Utilities~stripDocIdFromRefPath(refPath) ⇒ <code>string</code>
|
|
@@ -1860,6 +2901,560 @@ Function Signature for UpdateChange functions(prev, value, itemFor, fullChoiceOb
|
|
|
1860
2901
|
| itemFor | <code>string</code> |
|
|
1861
2902
|
| fullChoiceObject | <code>object</code> |
|
|
1862
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>"User"</code> \| <code>"Product"</code> \| <code>"LineItem"</code> \| <code>"Commodities"</code> \| <code>"Units"</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>{"concurrency":3,"rate":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
|
+
|
|
1863
3458
|
<a name="module_Boilerplate"></a>
|
|
1864
3459
|
|
|
1865
3460
|
## Boilerplate
|