@leaddreamer/inventorylogic 0.0.3-beta.39 → 0.0.3-beta.4
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 +9 -852
- package/business/Commodities/index.js +1 -1
- package/business/LineItem/index.js +2 -2
- package/business/Markups/index.js +2 -2
- package/business/Payment/index.js +1 -1
- package/business/Product/index.js +17 -160
- package/business/User/index.js +2 -2
- package/business/Utilities/index.js +1 -1
- package/business/boilerplate/index.js +3 -26
- package/business/index.js +9 -12
- package/business/units/index.js +1 -1
- package/index.js +1 -1
- package/package.json +8 -25
- package/business/Addresses/index.js +0 -181
- package/business/BusinessData/index.js +0 -300
- package/business/Fundamentals/index.js +0 -184
- package/business/PrivateData/index.js +0 -176
- package/dist/InventoryLogic.09daaeaa.js +0 -2
- package/dist/InventoryLogic.0ba84fa7.js +0 -2
- package/dist/InventoryLogic.0d599c03.js +0 -2
- package/dist/InventoryLogic.137e5482.js +0 -2
- package/dist/InventoryLogic.14a7860a.js +0 -2
- package/dist/InventoryLogic.14b7f292.js +0 -2
- package/dist/InventoryLogic.188504b1.js +0 -2
- package/dist/InventoryLogic.196261df.js +0 -2
- package/dist/InventoryLogic.1aa3d0be.js +0 -2
- package/dist/InventoryLogic.205007e9.js +0 -2
- package/dist/InventoryLogic.22a36cc8.js +0 -2
- package/dist/InventoryLogic.2642cf62.js +0 -2
- package/dist/InventoryLogic.2e2dcd29.js +0 -2
- package/dist/InventoryLogic.34455124.js +0 -2
- package/dist/InventoryLogic.3675b133.js +0 -2
- package/dist/InventoryLogic.3b10ccc5.js +0 -2
- package/dist/InventoryLogic.3ccd3412.js +0 -2
- package/dist/InventoryLogic.3cd7da47.js +0 -2
- package/dist/InventoryLogic.415ac613.js +0 -2
- package/dist/InventoryLogic.421e1e7c.js +0 -9
- package/dist/InventoryLogic.457956a7.js +0 -2
- package/dist/InventoryLogic.48cfeaff.js +0 -2
- package/dist/InventoryLogic.4e7559ed.js +0 -2
- package/dist/InventoryLogic.50cb471b.js +0 -2
- package/dist/InventoryLogic.53279d78.js +0 -2
- package/dist/InventoryLogic.58dceea1.js +0 -2
- package/dist/InventoryLogic.5baab4fe.js +0 -2
- package/dist/InventoryLogic.5c08e39a.js +0 -2
- package/dist/InventoryLogic.5c885f7a.js +0 -2
- package/dist/InventoryLogic.648c0930.js +0 -2
- package/dist/InventoryLogic.67c1b155.js +0 -2
- package/dist/InventoryLogic.6f8b7ae0.js +0 -2
- package/dist/InventoryLogic.724cdb7a.js +0 -2
- package/dist/InventoryLogic.7407f5ab.js +0 -2
- package/dist/InventoryLogic.7559452d.js +0 -2
- package/dist/InventoryLogic.81d4c177.js +0 -2
- package/dist/InventoryLogic.86caed3d.js +0 -2
- package/dist/InventoryLogic.89bc98ac.js +0 -2
- package/dist/InventoryLogic.95d27be0.js +0 -2
- package/dist/InventoryLogic.9899e841.js +0 -2
- package/dist/InventoryLogic.9a4b1e67.js +0 -2
- package/dist/InventoryLogic.9f07806b.js +0 -2
- package/dist/InventoryLogic.a08adebe.js +0 -2
- package/dist/InventoryLogic.a4e13ed0.js +0 -2
- package/dist/InventoryLogic.ac0345c3.js +0 -9
- package/dist/InventoryLogic.b6a32e7a.js +0 -2
- package/dist/InventoryLogic.bf7b624e.js +0 -2
- package/dist/InventoryLogic.c44fa152.js +0 -2
- package/dist/InventoryLogic.c5bdd6e0.js +0 -2
- package/dist/InventoryLogic.c72232ce.js +0 -2
- package/dist/InventoryLogic.c903d27c.js +0 -2
- package/dist/InventoryLogic.caf3c5cd.js +0 -2
- package/dist/InventoryLogic.ce72ae5e.js +0 -2
- package/dist/InventoryLogic.d14897a2.js +0 -2
- package/dist/InventoryLogic.d678c3ae.js +0 -2
- package/dist/InventoryLogic.d76d5857.js +0 -2
- package/dist/InventoryLogic.dda8477e.js +0 -2
- package/dist/InventoryLogic.df1596da.js +0 -2
- package/dist/InventoryLogic.e02cbd0d.js +0 -2
- package/dist/InventoryLogic.e1a6db03.js +0 -2
- package/dist/InventoryLogic.e7e04396.js +0 -2
- package/dist/InventoryLogic.e92db878.js +0 -2
- package/dist/InventoryLogic.eaecbd8b.js +0 -2
- package/dist/InventoryLogic.eed8150d.js +0 -2
- package/dist/InventoryLogic.f27b4a7e.js +0 -2
- package/dist/InventoryLogic.f27e2dc7.js +0 -2
- package/dist/InventoryLogic.f29bd369.js +0 -2
- package/dist/InventoryLogic.f3361cdd.js +0 -2
- package/dist/InventoryLogic.fb851384.js +0 -2
- package/dist/InventoryLogic.fcbfca1e.js +0 -2
- package/dist/InventoryLogic.ff65d86c.js +0 -2
- package/dist/index.js +0 -2
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "@leaddreamer/firebase-wrapper";
|
|
15
15
|
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
16
16
|
|
|
17
|
-
import { UNITS, MATERIAL, COMMODITIES, COMMODITY, COMPONENT_RANGE } from "../boilerplate
|
|
17
|
+
import { UNITS, MATERIAL, COMMODITIES, COMMODITY, COMPONENT_RANGE } from "../boilerplate";
|
|
18
18
|
|
|
19
19
|
//////////////////////////////////////////////////////////////////////
|
|
20
20
|
// Constants
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
UNITS,
|
|
22
22
|
COMPONENT_RANGE,
|
|
23
23
|
COMPONENT_COUNT_RANGE,
|
|
24
|
-
} from "../boilerplate
|
|
25
|
-
|
|
24
|
+
} from "../boilerplate";
|
|
25
|
+
import {StageLevels, MaterialLevels} from "../Markups";
|
|
26
26
|
|
|
27
27
|
//////////////////////////////////////////////////////////////////////
|
|
28
28
|
// Constants
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* users
|
|
4
4
|
* @module Markups
|
|
5
5
|
*/
|
|
6
|
-
import { updateRecord } from "@leaddreamer/firebase-wrapper";
|
|
6
|
+
import { updateRecord } from "@leaddreamer/firebase-wrapper";
|
|
7
7
|
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
8
8
|
|
|
9
|
-
import { MARKUPS, STAGE, FABRICATION, WHOLESALE, RETAIL, BASE, HIGHVALUE, SERVICE, MATERIAL } from "../boilerplate
|
|
9
|
+
import { MARKUPS, STAGE, FABRICATION, WHOLESALE, RETAIL, BASE, HIGHVALUE, SERVICE, MATERIAL } from "../boilerplate";
|
|
10
10
|
|
|
11
11
|
//////////////////////////////////////////////////////////////////////
|
|
12
12
|
// Constants
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "@leaddreamer/firebase-wrapper";
|
|
18
18
|
|
|
19
19
|
import { Forms, cleanType } from "@leaddreamer/staticforms";
|
|
20
|
-
import { PAYMENT, RECEIPTS, CARDS } from "../boilerplate
|
|
20
|
+
import { PAYMENT, RECEIPTS, CARDS } from "../boilerplate";
|
|
21
21
|
|
|
22
22
|
//////////////////////////////////////////////////////////////////////
|
|
23
23
|
// definitions
|
|
@@ -5,148 +5,23 @@
|
|
|
5
5
|
import { updateRecord} from "@leaddreamer/firebase-wrapper";
|
|
6
6
|
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
7
7
|
|
|
8
|
-
import { PRODUCT, MARKUPS, ISBN_LENGTH } from "../boilerplate
|
|
9
|
-
import { typedRecordFromChild } from "../Utilities
|
|
8
|
+
import { PRODUCT, MARKUPS, ISBN_LENGTH } from "../boilerplate";
|
|
9
|
+
import { typedRecordFromChild } from "../Utilities"
|
|
10
10
|
|
|
11
11
|
//////////////////////////////////////////////////////////////////////
|
|
12
12
|
// Constants
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* "recipe" related values - build-stage markups, product/project Flag, created/modified dates
|
|
16
|
-
* @typedef {object} Recipe_Data
|
|
17
|
-
* @property {module:Markups~Stage} markups
|
|
18
|
-
* @property {boolean} projectQ flag for product/project
|
|
19
|
-
* @property {dateTime} created
|
|
20
|
-
* @property {dateTime} modified
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* A list of attributes for a product
|
|
25
|
-
* @typedef {Array.String} AttributeList
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Array of attribute name/value pairs
|
|
30
|
-
* @typedef {object} AttributeValue
|
|
31
|
-
* @property {string} attibuteName attribute name from attribute list
|
|
32
|
-
* @property {string} value value for the particular attribute
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Image Descriptor
|
|
37
|
-
* @typedef {object} ProductImage
|
|
38
|
-
* @property {string} altText alt text for the image - SEO etc
|
|
39
|
-
* @property {Array.string} availableFormats Available image sizes.
|
|
40
|
-
* @property {string} id unique id for this productImage
|
|
41
|
-
* @property {integer} orderIndex Position of the image in the product's image list.
|
|
42
|
-
* @property {object} originalSize Image size when first uploaded.
|
|
43
|
-
* @property {MetaData} seoOptions
|
|
44
|
-
* @property {string} URL Absolute URL of the hosted image.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Currency Description ISO 4217 currency code
|
|
49
|
-
* @typedef {object} CurrencyDescription
|
|
50
|
-
* @property {string} currencyCode
|
|
51
|
-
* @property {integer} defaultFractionDigits
|
|
52
|
-
* @property {string} displayName
|
|
53
|
-
* @property {string} numericCodeAsString
|
|
54
|
-
* @property {string} symbol
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Monetary Value Specification
|
|
59
|
-
* @typedef {object} MonetaryValue
|
|
60
|
-
* @property {CurrencyDescription}
|
|
61
|
-
* @property {decimal} value Decimal monetary value
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Pricing Object
|
|
66
|
-
* @typedef {object} FullProductPricing
|
|
67
|
-
* @property {MonetaryValue} basePrice
|
|
68
|
-
* @property {boolean} onSale
|
|
69
|
-
* @property {MonetaryValue} salePrice
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Dimensions Object
|
|
74
|
-
* @typedef {object} ProductDimensions
|
|
75
|
-
* @property {float} height
|
|
76
|
-
* @property {float} width
|
|
77
|
-
* @property {float} length
|
|
78
|
-
* @property {text} unit //ProductDimensionsUnit
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
13
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @typedef {object} PriceObject
|
|
84
|
-
*
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Weight Object
|
|
89
|
-
* @typedef {object} ProductWeight
|
|
90
|
-
* @property {text} unit //ProductWeightUnitEnum
|
|
91
|
-
* @property {float} value
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Measurements of the variant when it's shipped. Present for PHYSICAL products only.
|
|
96
|
-
* @typedef {object} ProductMeasurements
|
|
97
|
-
* @property {ProductDimensions} dimensions
|
|
98
|
-
* @property {ProductWeight} weight
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Available stock for the variant. Present for PHYSICAL products only.
|
|
103
|
-
* @typedef {object} ProductStock
|
|
104
|
-
* @property {integer} quantity
|
|
105
|
-
* @property {boolean} unlimited
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* variant record (including inventory and pricing)
|
|
111
|
-
* @typedef {object} PhysicalProductVariant
|
|
112
|
-
* @property {Array.AttributeValue} attributes array of attribute/value pairs for a variant
|
|
113
|
-
* @property {string} sku
|
|
114
|
-
* @property {string} mpn manufacturer part number
|
|
115
|
-
* @property {string} gtin Global Trade Item Number
|
|
116
|
-
* @property {string} id unique ID for product variant
|
|
117
|
-
* @property {ProductImage} image Image associated with this variant
|
|
118
|
-
* @property {ProductMeasurements} shippingMeasurements
|
|
119
|
-
* @property {ProductStock} stock
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Meta Information for SEO
|
|
124
|
-
* @typedef {object} MetaData
|
|
125
|
-
* @property {string} title
|
|
126
|
-
* @property {string} description
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* a product record
|
|
14
|
+
* a record
|
|
131
15
|
* @typedef {object} Product
|
|
132
|
-
* @property {?string} Id
|
|
16
|
+
* @property {?string} Id Id of document (redundant for convenience)
|
|
133
17
|
* @property {?string} refPath if from database, full path to document
|
|
134
18
|
* @property {string} name name for the Product
|
|
135
|
-
* @property {string} description
|
|
136
|
-
* @property {
|
|
137
|
-
* @property {
|
|
138
|
-
* @property {
|
|
139
|
-
* @property {
|
|
140
|
-
* @property {
|
|
141
|
-
* @property {string} name name for the Product
|
|
142
|
-
* @property {MetaData} seoOptions
|
|
143
|
-
* @property {Array.string} tags
|
|
144
|
-
* @property {Array.string} materials
|
|
145
|
-
* @property {Array.string} patterns
|
|
146
|
-
* @property {string} URL
|
|
147
|
-
* @property {string} urlSlug
|
|
148
|
-
* @property {Array.string} variantAttributes
|
|
149
|
-
* @property {Array.PhysicalProductVariant} variants
|
|
19
|
+
* @property {string} description
|
|
20
|
+
* @property {string} sku
|
|
21
|
+
* @property {module:Markups~Stage} markups
|
|
22
|
+
* @property {boolean} projectQ flag for product/project
|
|
23
|
+
* @property {dateTime} created
|
|
24
|
+
* @property {dateTime} modified
|
|
150
25
|
*/
|
|
151
26
|
|
|
152
27
|
/**
|
|
@@ -156,33 +31,15 @@ import { typedRecordFromChild } from "../Utilities/index.js"
|
|
|
156
31
|
* @default
|
|
157
32
|
*/
|
|
158
33
|
const ProductDefault = {
|
|
34
|
+
Id: null,
|
|
35
|
+
refPath: null,
|
|
159
36
|
name: `A Product`,
|
|
160
37
|
description: null,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
image_links: [],
|
|
168
|
-
type: "",
|
|
169
|
-
google_product_type: "",
|
|
170
|
-
shipping_time: 0,
|
|
171
|
-
condition: "",
|
|
172
|
-
adultQ: false,
|
|
173
|
-
age_group: "adult",
|
|
174
|
-
color: [""],
|
|
175
|
-
material: [""],
|
|
176
|
-
gender: "unisex",
|
|
177
|
-
attributes_gemstones: [""],
|
|
178
|
-
pattern: "",
|
|
179
|
-
size: "",
|
|
180
|
-
weight: 0,
|
|
181
|
-
shippingMeasurements: {
|
|
182
|
-
shipping_length: 0,
|
|
183
|
-
shippin_width: 0,
|
|
184
|
-
shipping_height: 0
|
|
185
|
-
}
|
|
38
|
+
sku: null,
|
|
39
|
+
markups: null,
|
|
40
|
+
projectQ: false,
|
|
41
|
+
created: null,
|
|
42
|
+
modified: null,
|
|
186
43
|
};
|
|
187
44
|
|
|
188
45
|
/**
|
package/business/User/index.js
CHANGED
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
} from "@leaddreamer/firebase-wrapper";
|
|
18
18
|
import { Forms } from "@leaddreamer/staticforms";
|
|
19
19
|
|
|
20
|
-
import { USER, USERS } from "../boilerplate
|
|
21
|
-
import { typedRecordFromChild } from "../Utilities
|
|
20
|
+
import { USER, USERS } from "../boilerplate";
|
|
21
|
+
import { typedRecordFromChild } from "../Utilities"
|
|
22
22
|
|
|
23
23
|
//////////////////////////////////////////////////////////////////////
|
|
24
24
|
// Constants
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
writeRecord,
|
|
14
14
|
} from "@leaddreamer/firebase-wrapper";
|
|
15
15
|
import { Forms } from "@leaddreamer/staticforms";
|
|
16
|
-
import { ADDRESSES } from "../boilerplate
|
|
16
|
+
import { ADDRESSES } from "../boilerplate";
|
|
17
17
|
|
|
18
18
|
//////////////////////////////////////////////////////////////////////
|
|
19
19
|
|
|
@@ -7,14 +7,6 @@
|
|
|
7
7
|
// generic constants
|
|
8
8
|
export const UNSUBSCRIBEKEYS = `unsubscribeKeys`;
|
|
9
9
|
export const ADDRESSES = "Addresses";
|
|
10
|
-
export const BUSINESS = `Business`; //mostly used for URL of management tree
|
|
11
|
-
export const BRANDS = `Brands`;
|
|
12
|
-
export const MANAGEDBRANDS = `ManagedBrands`;
|
|
13
|
-
export const ORGANIZATIONS = `Organizations`;
|
|
14
|
-
export const MANAGEDORGANIZATIONS = `ManagedOrganizations`;
|
|
15
|
-
export const PRIVATEDATA = `PrivateData`;
|
|
16
|
-
export const BUSINESSDATA = `BusinessData`;
|
|
17
|
-
export const LOGISTICS = `logistics`;
|
|
18
10
|
export const COMMODITY = `Commodity`;
|
|
19
11
|
export const COMMODITIES = COMMODITY;
|
|
20
12
|
export const LINEITEM = `LineItem`;
|
|
@@ -22,22 +14,14 @@ export const LINEITEMS = LINEITEM;
|
|
|
22
14
|
export const LABORRATES = `LaborRates`;
|
|
23
15
|
export const PRODUCT = `Products`;
|
|
24
16
|
export const PRODUCTS = PRODUCT;
|
|
25
|
-
export const PAYMENT = `Payment`;
|
|
26
|
-
export const PAYMENTS = PAYMENT;
|
|
27
|
-
export const CARDS = `Cards`;
|
|
28
|
-
export const TRANSFERS = `Transfers`;
|
|
29
|
-
export const FUNDAMENTALS = `Fundamentals`;
|
|
30
|
-
export const PAYOUTRATES = `PayoutRates`;
|
|
31
|
-
export const RATES = `Rates`;
|
|
32
|
-
export const MCC = `MCC`;
|
|
33
|
-
export const BUSINESS_TYPE = `business_type`;
|
|
34
|
-
export const ACCESS = `access`;
|
|
35
|
-
export const ACCESSTO = `accessTo`;
|
|
36
17
|
export const STAGE = `stages`;
|
|
37
18
|
export const STAGES = STAGE;
|
|
38
19
|
export const MATERIAL = `material`;
|
|
39
20
|
export const MATERIALS = MATERIAL;
|
|
21
|
+
export const PAYMENT = `Payment`;
|
|
22
|
+
export const PAYMENTS = PAYMENT;
|
|
40
23
|
export const RECEIPTS = `Receipts`;
|
|
24
|
+
export const CARDS = `Cards`;
|
|
41
25
|
export const UNITS = "units";
|
|
42
26
|
export const UNIT = UNITS;
|
|
43
27
|
export const USER = "User";
|
|
@@ -53,13 +37,6 @@ export const FABRICATION = `fabrication`;
|
|
|
53
37
|
export const WHOLESALE = `wholesale`;
|
|
54
38
|
export const RETAIL = `retail`;
|
|
55
39
|
|
|
56
|
-
//Payment System Constants
|
|
57
|
-
export const PAYMENT_SUCCEEDED = `succeeded`;
|
|
58
|
-
|
|
59
|
-
//Stripe
|
|
60
|
-
export const CUSTOMER = `customer`;
|
|
61
|
-
export const CUSTOMERADDRESS = `customerAddress`;
|
|
62
|
-
|
|
63
40
|
export const fakerJSON = {
|
|
64
41
|
COMPONENT_RANGE: {
|
|
65
42
|
min: 0.01,
|
package/business/index.js
CHANGED
|
@@ -3,15 +3,12 @@
|
|
|
3
3
|
* frontEnd and NodeJS BackEnd
|
|
4
4
|
* @module InventoryLogic
|
|
5
5
|
*/
|
|
6
|
-
export * from "./boilerplate
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./Markups
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./Product/index.js";
|
|
16
|
-
export * from "./User/index.js";
|
|
17
|
-
export * from "./Utilities/index.js";
|
|
6
|
+
export * from "./boilerplate";
|
|
7
|
+
export * from "./Commodities";
|
|
8
|
+
export * from "./LineItem";
|
|
9
|
+
export * from "./Payment";
|
|
10
|
+
export * from "./User";
|
|
11
|
+
export * from "./Product";
|
|
12
|
+
export * from "./Markups";
|
|
13
|
+
export * from "./units";
|
|
14
|
+
export * from "./Utilities";
|
package/business/units/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { writeRecord, writeBack } from "@leaddreamer/firebase-wrapper";
|
|
7
7
|
import { Forms } from "@leaddreamer/staticforms";
|
|
8
8
|
|
|
9
|
-
import { UNITS } from "../boilerplate
|
|
9
|
+
import { UNITS } from "../boilerplate";
|
|
10
10
|
|
|
11
11
|
//////////////////////////////////////////////////////////////////////
|
|
12
12
|
// Constants
|
package/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export function databaseStart(firebase, config, thisLogger = null) {
|
|
|
54
54
|
return FirebaseWrapper(firebase, config, thisLogger);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export * from "./business
|
|
57
|
+
export * from "./business";
|
|
58
58
|
export * from "@leaddreamer/firebase-wrapper";
|
|
59
59
|
export * from "@leaddreamer/genericutilities";
|
|
60
60
|
export * from "@leaddreamer/staticforms";
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": ">=22"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.3-beta.
|
|
6
|
+
"version": "0.0.3-beta.4",
|
|
7
7
|
"description": "Business & Database Logic for Inventory Services",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -26,33 +26,17 @@
|
|
|
26
26
|
"*.md",
|
|
27
27
|
"/*/*.md"
|
|
28
28
|
],
|
|
29
|
-
"
|
|
30
|
-
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"node": {
|
|
33
|
-
"import": "./index.js",
|
|
34
|
-
"require": "./dist/index.js"
|
|
35
|
-
},
|
|
36
|
-
"default": "./index.js"
|
|
37
|
-
},
|
|
38
|
-
"./inventorylogic": {
|
|
39
|
-
"node": {
|
|
40
|
-
"import": "./index.js",
|
|
41
|
-
"require": "./dist/index.js"
|
|
42
|
-
},
|
|
43
|
-
"default": "./index.js"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
29
|
+
"module": "index.js",
|
|
46
30
|
"scripts": {
|
|
47
31
|
"reinstall": "rm -rf node_modules && npm install",
|
|
48
|
-
"mybuild": "parcel build
|
|
49
|
-
"
|
|
32
|
+
"mybuild": "parcel build",
|
|
33
|
+
"rebuild": "$npm_execpath version patch --git-tag-version && $npm_execpath run docs",
|
|
34
|
+
"beta:rebuild": "$npm_execpath version prerelease --git-tag-version --preid=beta && $npm_execpath run docs",
|
|
35
|
+
"release:rebuild": "$npm_execpath version minor --git-tag-version && $npm_execpath run docs",
|
|
50
36
|
"myprepublishOnly": "$npm_execpath run build",
|
|
51
37
|
"make_docs": "jsdoc2md -c jsdoc.conf.json --template README.hbs --files *.js ./business/*.js ./business/*/*.js > README.md",
|
|
52
38
|
"docs": "$npm_execpath run make_docs",
|
|
53
|
-
"beta:rebuild": "$npm_execpath version prerelease --git-tag-version --preid=beta && $npm_execpath run docs && $npm_execpath run mybuild",
|
|
54
39
|
"beta:publish": "$npm_execpath publish --tag=beta --access=restricted",
|
|
55
|
-
"package:rebuild": "$npm_execpath version patch --git-tag-version && $npm_execpath run docs",
|
|
56
40
|
"package:publish": "$npm_execpath publish --access=restricted",
|
|
57
41
|
"dry:publish": "$npm_execpath publish --dry-run"
|
|
58
42
|
},
|
|
@@ -61,8 +45,8 @@
|
|
|
61
45
|
},
|
|
62
46
|
"dependencies": {
|
|
63
47
|
"@leaddreamer/firebase-wrapper": "^2.1.2-beta.0",
|
|
64
|
-
"@leaddreamer/genericutilities": "^0.
|
|
65
|
-
"@leaddreamer/staticforms": "^1.
|
|
48
|
+
"@leaddreamer/genericutilities": "^0.1.6",
|
|
49
|
+
"@leaddreamer/staticforms": "^1.0.2-beta.0",
|
|
66
50
|
"lodash.clonedeep": "4.5.0",
|
|
67
51
|
"mathjs": "15.2.0",
|
|
68
52
|
"uuid": "14.0.1"
|
|
@@ -80,7 +64,6 @@
|
|
|
80
64
|
}
|
|
81
65
|
},
|
|
82
66
|
"devDependencies": {
|
|
83
|
-
"@parcel/bundler-library": "^2.16.4",
|
|
84
67
|
"accounting-js": "2.0.3",
|
|
85
68
|
"jsdoc-to-markdown": "9.1.3",
|
|
86
69
|
"parcel": "latest"
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types and functins for handling addresses
|
|
3
|
-
* @module Addresses
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
writeRecord,
|
|
9
|
-
writeBack,
|
|
10
|
-
deleteRecord,
|
|
11
|
-
deleteRecordByRefPath,
|
|
12
|
-
collectRecords,
|
|
13
|
-
} from "@leaddreamer/firebase-wrapper";
|
|
14
|
-
import { Forms } from "@leaddreamer/staticforms";
|
|
15
|
-
import { ADDRESSES } from "../boilerplate/index.js";
|
|
16
|
-
import { businessDataPath } from "../BusinessData/index.js";
|
|
17
|
-
|
|
18
|
-
//////////////////////////////////////////////////////////////////////
|
|
19
|
-
//Constants
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {object} AddressType
|
|
22
|
-
* @property {?string} Id - will be populated for existing record; null or
|
|
23
|
-
* missing for new/minimal object
|
|
24
|
-
* @property {?string} refPath - will be populated for existing record; null or
|
|
25
|
-
* missing for new/minimal object
|
|
26
|
-
* @property {string} address_line_1
|
|
27
|
-
* @property {?string} address_line_2
|
|
28
|
-
* @property {string} city
|
|
29
|
-
* @property {string} region - selected from a list of supported Cities/Regions
|
|
30
|
-
* @property {string} state
|
|
31
|
-
* @property {zip} zip
|
|
32
|
-
* @property {?maplink} mapLink - link to Google map location
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @constant
|
|
36
|
-
* @type {AddressType}
|
|
37
|
-
* @default
|
|
38
|
-
*/
|
|
39
|
-
export const AddressDefault = {
|
|
40
|
-
name: null,
|
|
41
|
-
tel: null,
|
|
42
|
-
address_line_1: null,
|
|
43
|
-
address_line_2: null,
|
|
44
|
-
city: null,
|
|
45
|
-
region: null,
|
|
46
|
-
state: null,
|
|
47
|
-
zip: null,
|
|
48
|
-
maplink: null,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @constant
|
|
53
|
-
* @type {AddressType}
|
|
54
|
-
* @default
|
|
55
|
-
*/
|
|
56
|
-
export const AddressForm = {
|
|
57
|
-
name: "text::6",
|
|
58
|
-
tel: "tel::6",
|
|
59
|
-
address_line_1: "text::6",
|
|
60
|
-
address_line_2: "text::6",
|
|
61
|
-
city: "text::6",
|
|
62
|
-
// region: "lookup:Regions:4",
|
|
63
|
-
state: "text::3",
|
|
64
|
-
zip: "number::3",
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const AddressSelectForm = {
|
|
68
|
-
address: `lookupLink:${ADDRESSES}`,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @typedef {object} MapLink
|
|
73
|
-
* @property {?string} placeId - as defined by Google
|
|
74
|
-
* @property {?object} latlng - coordinates tuple
|
|
75
|
-
* @property {string} latlng.lat - lattitude
|
|
76
|
-
* @property {string} latlng.lng - longitude
|
|
77
|
-
* @property {?string} url - link to place/map entry
|
|
78
|
-
* @property {?string} formatted_address - printable string of address
|
|
79
|
-
*/
|
|
80
|
-
/**
|
|
81
|
-
* @readonly
|
|
82
|
-
* @constant
|
|
83
|
-
* @type {MapLink}
|
|
84
|
-
* @default
|
|
85
|
-
*/
|
|
86
|
-
export const maplink = {
|
|
87
|
-
placeID: null,
|
|
88
|
-
latlng: {
|
|
89
|
-
lat: null,
|
|
90
|
-
lng: null,
|
|
91
|
-
},
|
|
92
|
-
url: null,
|
|
93
|
-
formatted_address: null,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
Forms.Base[ADDRESSES] = AddressDefault;
|
|
97
|
-
Forms.BaseForm[ADDRESSES] = AddressForm;
|
|
98
|
-
Forms.AccountForm[ADDRESSES] = AddressForm;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @external WriteBatch
|
|
102
|
-
* @external Transaction
|
|
103
|
-
* @typedef {WriteBatch|Transaction|void} ChainType
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
//////////////////////////////////////////////////////////////////////
|
|
107
|
-
//Business Logic
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Deletes an existing address record from the database, based on it's own refPath
|
|
111
|
-
* @param {AddressType} address
|
|
112
|
-
* @param {!string} address.refPath
|
|
113
|
-
* @returns {Promise<void>}
|
|
114
|
-
*/
|
|
115
|
-
export async function deleteAddress(address) {
|
|
116
|
-
//check for real reacord (i.e. refPath)
|
|
117
|
-
if (!address?.refPath) return null;
|
|
118
|
-
return deleteRecordByRefPath(address.refPath);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Deletes an existing address record from the database, based on it's parent
|
|
123
|
-
* record and Id
|
|
124
|
-
* @param {!string} addressId
|
|
125
|
-
* @param {OrganizationType} parent
|
|
126
|
-
* @param {!string} parent.refPath
|
|
127
|
-
* @param {ChainType} batch
|
|
128
|
-
* @returns {Promise.ChainType}
|
|
129
|
-
*/
|
|
130
|
-
export async function deleteAddressByIdAndParent(
|
|
131
|
-
addressId,
|
|
132
|
-
parent,
|
|
133
|
-
batch = null
|
|
134
|
-
) {
|
|
135
|
-
//check for real reacord (i.e. refPath)
|
|
136
|
-
return deleteRecord(ADDRESSES, addressId, parent?.refPath, batch);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
//////////////////////////////////////////////////////////////////////
|
|
140
|
-
//helpers
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Builds a formatted string from a provided address record
|
|
144
|
-
* @param {AddressType} address
|
|
145
|
-
* @returns {string}
|
|
146
|
-
*/
|
|
147
|
-
export function formatAddress(address) {
|
|
148
|
-
let formattedString = address
|
|
149
|
-
? (address.address_line_1 ? address.address_line_1 + ", " : "") +
|
|
150
|
-
(address.address_line_2 ? address.address_line_2 + ", " : "") +
|
|
151
|
-
(address.city ? address.city + ", " : "") +
|
|
152
|
-
(address.state ? address.state + " " : "") +
|
|
153
|
-
(address.zip ? address.zip : "") +
|
|
154
|
-
(address.region ? " ( " + address.region + " )" : "")
|
|
155
|
-
: null;
|
|
156
|
-
return formattedString;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Saves an address record to the database below the provided parentRefPath,
|
|
161
|
-
* whether exsiting or not
|
|
162
|
-
* @param {AddressType} address
|
|
163
|
-
* @param {?string} address.refPath - if present, writes back
|
|
164
|
-
* @param {string} paraentRefPath - required if new record
|
|
165
|
-
* @returns {Promise<AddressType>}
|
|
166
|
-
*/
|
|
167
|
-
export async function saveAddress(address, parentRefPath) {
|
|
168
|
-
return address?.refPath
|
|
169
|
-
? writeBack(address)
|
|
170
|
-
: writeRecord(ADDRESSES, address, parentRefPath);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Fetches all address records for an account
|
|
175
|
-
* @param {Record} account
|
|
176
|
-
* @param {!string} account.refPath
|
|
177
|
-
* @returns {Promise<Array.AddressType>}
|
|
178
|
-
*/
|
|
179
|
-
export async function fetchAddresses(account) {
|
|
180
|
-
return collectRecords(ADDRESSES, businessDataPath(account));
|
|
181
|
-
}
|