cloudcommerce 0.0.24 → 0.0.27

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.
Files changed (43) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/CHANGELOG.md +21 -0
  3. package/package.json +10 -7
  4. package/packages/api/lib/types/applications.d.ts +100 -91
  5. package/packages/api/lib/types/authentications.d.ts +10 -0
  6. package/packages/api/lib/types/brands.d.ts +9 -0
  7. package/packages/api/lib/types/carts.d.ts +16 -0
  8. package/packages/api/lib/types/categories.d.ts +9 -0
  9. package/packages/api/lib/types/collections.d.ts +8 -0
  10. package/packages/api/lib/types/customers.d.ts +28 -0
  11. package/packages/api/lib/types/grids.d.ts +8 -0
  12. package/packages/api/lib/types/orders.d.ts +287 -222
  13. package/packages/api/lib/types/products.d.ts +69 -0
  14. package/packages/api/lib/types/stores.d.ts +3 -0
  15. package/packages/api/package.json +1 -1
  16. package/packages/api/src/types/applications.d.ts +100 -91
  17. package/packages/api/src/types/authentications.d.ts +10 -0
  18. package/packages/api/src/types/brands.d.ts +9 -0
  19. package/packages/api/src/types/carts.d.ts +16 -0
  20. package/packages/api/src/types/categories.d.ts +9 -0
  21. package/packages/api/src/types/collections.d.ts +8 -0
  22. package/packages/api/src/types/customers.d.ts +28 -0
  23. package/packages/api/src/types/grids.d.ts +8 -0
  24. package/packages/api/src/types/orders.d.ts +287 -222
  25. package/packages/api/src/types/products.d.ts +69 -0
  26. package/packages/api/src/types/stores.d.ts +3 -0
  27. package/packages/apps/discounts/package.json +1 -1
  28. package/packages/cli/package.json +1 -1
  29. package/packages/firebase/config.js +5 -0
  30. package/packages/firebase/lib/config.js +26 -0
  31. package/packages/firebase/lib/config.js.map +1 -0
  32. package/packages/firebase/lib/defaults.js +8 -0
  33. package/packages/firebase/lib/defaults.js.map +1 -0
  34. package/packages/firebase/lib/index.js +32 -0
  35. package/packages/firebase/lib/index.js.map +1 -0
  36. package/packages/firebase/package.json +10 -4
  37. package/packages/firebase/src/config.ts +29 -0
  38. package/packages/firebase/src/defaults.ts +7 -0
  39. package/packages/firebase/src/index.ts +32 -0
  40. package/packages/firebase/tsconfig.json +3 -0
  41. package/packages/storefront/package.json +2 -2
  42. package/pnpm-lock.yaml +294 -63
  43. package/packages/firebase/src/index.js +0 -0
package/.eslintrc.cjs CHANGED
@@ -19,6 +19,7 @@ module.exports = {
19
19
  ],
20
20
  ignorePatterns: [
21
21
  '**/dist',
22
+ '**/types/*.d.ts',
22
23
  ],
23
24
  rules: {
24
25
  'no-await-in-loop': 'warn',
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.27](https://github.com/ecomplus/cloud-commerce/compare/v0.0.26...v0.0.27) (2022-07-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * **firebase:** Try to debug concurrency at function z `/pid` ([f9447ca](https://github.com/ecomplus/cloud-commerce/commit/f9447ca38e9669a8caedc08e5ce015428c92ce22))
11
+
12
+ ### [0.0.26](https://github.com/ecomplus/cloud-commerce/compare/v0.0.25...v0.0.26) (2022-07-13)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **firebase:** Use Cloud Functions v2, update initial functions (ssr, z*) and deploy region ([6f73696](https://github.com/ecomplus/cloud-commerce/commit/6f736961cbb76b6576d72dd27bcf5f8245f53ead))
18
+
19
+ ### [0.0.25](https://github.com/ecomplus/cloud-commerce/compare/v0.0.24...v0.0.25) (2022-07-13)
20
+
21
+
22
+ ### Features
23
+
24
+ * **firebase:** Setup initial (test) functions and config getter and setter ([420622e](https://github.com/ecomplus/cloud-commerce/commit/420622ee6292ecfacb29bb4eddbad5781657e23c))
25
+
5
26
  ### [0.0.24](https://github.com/ecomplus/cloud-commerce/compare/v0.0.23...v0.0.24) (2022-07-10)
6
27
 
7
28
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "0.0.24",
4
+ "version": "0.0.27",
5
5
  "description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
6
6
  "main": "packages/api/lib/index.js",
7
7
  "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
@@ -20,20 +20,20 @@
20
20
  "@commitlint/config-conventional": "^17.0.3",
21
21
  "@commitlint/rules": "^17.0.0",
22
22
  "@types/node": "^18.0.3",
23
- "@typescript-eslint/eslint-plugin": "^5.30.5",
24
- "@typescript-eslint/parser": "^5.30.5",
25
- "esbuild": "^0.14.48",
23
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
24
+ "@typescript-eslint/parser": "^5.30.6",
25
+ "esbuild": "^0.14.49",
26
26
  "eslint": "^8.19.0",
27
27
  "eslint-config-airbnb-base": "^15.0.0",
28
28
  "eslint-plugin-import": "^2.26.0",
29
29
  "eslint-plugin-vue": "^9.2.0",
30
30
  "husky": "^8.0.1",
31
- "node-fetch": "^3.2.6",
31
+ "node-fetch": "^3.2.8",
32
32
  "standard-version": "^9.5.0",
33
33
  "turbo": "^1.3.1",
34
34
  "typescript": "^4.7.4",
35
35
  "vite": "^2.9.14",
36
- "vitest": "^0.17.1",
36
+ "vitest": "^0.18.0",
37
37
  "zx": "^7.0.7"
38
38
  },
39
39
  "scripts": {
@@ -42,6 +42,9 @@
42
42
  "build": "turbo run build",
43
43
  "test": "turbo run test",
44
44
  "release": "bash scripts/version-and-release.sh",
45
- "deploy": "cd store && npm run deploy"
45
+ "store:run": "pnpm build && npm --prefix \"store\" run",
46
+ "start": "pnpm store:run start",
47
+ "serve": "pnpm store:run serve",
48
+ "deploy": "pnpm store:run deploy"
46
49
  }
47
50
  }
@@ -46,97 +46,13 @@ export interface Applications {
46
46
  * Modules handled by this app
47
47
  */
48
48
  modules?: {
49
- /**
50
- * Triggered after each term searched on storefront
51
- */
52
- term_searched?: {
53
- /**
54
- * Whether current app is enabled to handle the module requests
55
- */
56
- enabled: boolean;
57
- /**
58
- * URL to receive POST request of respective module
59
- */
60
- endpoint: string;
61
- };
62
- /**
63
- * Triggered after each cart saves on storefront, just before checkout
64
- */
65
- cart_confirmed?: {
66
- /**
67
- * Whether current app is enabled to handle the module requests
68
- */
69
- enabled: boolean;
70
- /**
71
- * URL to receive POST request of respective module
72
- */
73
- endpoint: string;
74
- };
75
- /**
76
- * Triggered to calculate shipping options, must return calculated values and times
77
- */
78
- calculate_shipping?: {
79
- /**
80
- * Whether current app is enabled to handle the module requests
81
- */
82
- enabled: boolean;
83
- /**
84
- * URL to receive POST request of respective module
85
- */
86
- endpoint: string;
87
- };
88
- /**
89
- * Triggered when listing payments, must return available methods
90
- */
91
- list_payments?: {
92
- /**
93
- * Whether current app is enabled to handle the module requests
94
- */
95
- enabled: boolean;
96
- /**
97
- * URL to receive POST request of respective module
98
- */
99
- endpoint: string;
100
- };
101
- /**
102
- * Triggered to validate and apply discout value, must return discount and conditions
103
- */
104
- apply_discount?: {
105
- /**
106
- * Whether current app is enabled to handle the module requests
107
- */
108
- enabled: boolean;
109
- /**
110
- * URL to receive POST request of respective module
111
- */
112
- endpoint: string;
113
- };
114
- /**
115
- * Triggered when order is being closed, must create payment transaction and return info
116
- */
117
- create_transaction?: {
118
- /**
119
- * Whether current app is enabled to handle the module requests
120
- */
121
- enabled: boolean;
122
- /**
123
- * URL to receive POST request of respective module
124
- */
125
- endpoint: string;
126
- };
127
- /**
128
- * Triggered after each order created from storefront, could return custom fields
129
- */
130
- checkout_done?: {
131
- /**
132
- * Whether current app is enabled to handle the module requests
133
- */
134
- enabled: boolean;
135
- /**
136
- * URL to receive POST request of respective module
137
- */
138
- endpoint: string;
139
- };
49
+ term_searched?: Module;
50
+ cart_confirmed?: Module1;
51
+ calculate_shipping?: Module2;
52
+ list_payments?: Module3;
53
+ apply_discount?: Module4;
54
+ create_transaction?: Module5;
55
+ checkout_done?: Module6;
140
56
  };
141
57
  /**
142
58
  * Configuration options for staff on admin dashboard, saved on app data
@@ -199,6 +115,8 @@ export interface Applications {
199
115
  };
200
116
  /**
201
117
  * Flags to associate additional info
118
+ *
119
+ * @maxItems 10
202
120
  */
203
121
  flags?: string[];
204
122
  /**
@@ -206,3 +124,94 @@ export interface Applications {
206
124
  */
207
125
  notes?: string;
208
126
  }
127
+ /**
128
+ * Triggered after each term searched on storefront
129
+ */
130
+ export interface Module {
131
+ /**
132
+ * Whether current app is enabled to handle the module requests
133
+ */
134
+ enabled: boolean;
135
+ /**
136
+ * URL to receive POST request of respective module
137
+ */
138
+ endpoint: string;
139
+ }
140
+ /**
141
+ * Triggered after each cart saves on storefront, just before checkout
142
+ */
143
+ export interface Module1 {
144
+ /**
145
+ * Whether current app is enabled to handle the module requests
146
+ */
147
+ enabled: boolean;
148
+ /**
149
+ * URL to receive POST request of respective module
150
+ */
151
+ endpoint: string;
152
+ }
153
+ /**
154
+ * Triggered to calculate shipping options, must return calculated values and times
155
+ */
156
+ export interface Module2 {
157
+ /**
158
+ * Whether current app is enabled to handle the module requests
159
+ */
160
+ enabled: boolean;
161
+ /**
162
+ * URL to receive POST request of respective module
163
+ */
164
+ endpoint: string;
165
+ }
166
+ /**
167
+ * Triggered when listing payments, must return available methods
168
+ */
169
+ export interface Module3 {
170
+ /**
171
+ * Whether current app is enabled to handle the module requests
172
+ */
173
+ enabled: boolean;
174
+ /**
175
+ * URL to receive POST request of respective module
176
+ */
177
+ endpoint: string;
178
+ }
179
+ /**
180
+ * Triggered to validate and apply discout value, must return discount and conditions
181
+ */
182
+ export interface Module4 {
183
+ /**
184
+ * Whether current app is enabled to handle the module requests
185
+ */
186
+ enabled: boolean;
187
+ /**
188
+ * URL to receive POST request of respective module
189
+ */
190
+ endpoint: string;
191
+ }
192
+ /**
193
+ * Triggered when order is being closed, must create payment transaction and return info
194
+ */
195
+ export interface Module5 {
196
+ /**
197
+ * Whether current app is enabled to handle the module requests
198
+ */
199
+ enabled: boolean;
200
+ /**
201
+ * URL to receive POST request of respective module
202
+ */
203
+ endpoint: string;
204
+ }
205
+ /**
206
+ * Triggered after each order created from storefront, could return custom fields
207
+ */
208
+ export interface Module6 {
209
+ /**
210
+ * Whether current app is enabled to handle the module requests
211
+ */
212
+ enabled: boolean;
213
+ /**
214
+ * URL to receive POST request of respective module
215
+ */
216
+ endpoint: string;
217
+ }
@@ -9,6 +9,9 @@ export interface Authentications {
9
9
  _id: string;
10
10
  created_at: string;
11
11
  updated_at: string;
12
+ /**
13
+ * @maxItems 500
14
+ */
12
15
  store_ids: number[];
13
16
  /**
14
17
  * Simple username for identification, only numbers and lowercase letters
@@ -52,6 +55,8 @@ export interface Authentications {
52
55
  };
53
56
  /**
54
57
  * List of dashboard cards chosen by user
58
+ *
59
+ * @maxItems 40
55
60
  */
56
61
  panel_cards?: {
57
62
  /**
@@ -76,6 +81,9 @@ export interface Authentications {
76
81
  resource: 'products' | 'categories' | 'brands' | 'collections' | 'grids' | 'customers' | 'carts' | 'orders';
77
82
  /**
78
83
  * Aggregation pipeline
84
+ *
85
+ * @minItems 1
86
+ * @maxItems 50
79
87
  */
80
88
  pipeline: {
81
89
  [k: string]: unknown;
@@ -88,6 +96,8 @@ export interface Authentications {
88
96
  edit_storefront?: boolean;
89
97
  /**
90
98
  * Flags to associate additional info
99
+ *
100
+ * @maxItems 10
91
101
  */
92
102
  flags?: string[];
93
103
  /**
@@ -10,6 +10,9 @@ export interface Brands {
10
10
  created_at: string;
11
11
  updated_at: string;
12
12
  store_id: number;
13
+ /**
14
+ * @maxItems 10
15
+ */
13
16
  channel_ids?: string[];
14
17
  /**
15
18
  * Brand full name
@@ -95,6 +98,8 @@ export interface Brands {
95
98
  };
96
99
  /**
97
100
  * List of brand images
101
+ *
102
+ * @maxItems 50
98
103
  */
99
104
  pictures?: {
100
105
  /**
@@ -120,6 +125,8 @@ export interface Brands {
120
125
  }[];
121
126
  /**
122
127
  * List of custom attributes
128
+ *
129
+ * @maxItems 100
123
130
  */
124
131
  metafields?: {
125
132
  /**
@@ -139,6 +146,8 @@ export interface Brands {
139
146
  }[];
140
147
  /**
141
148
  * Flags to associate additional info
149
+ *
150
+ * @maxItems 10
142
151
  */
143
152
  flags?: string[];
144
153
  /**
@@ -68,6 +68,8 @@ export interface Carts {
68
68
  affiliate_code?: string;
69
69
  /**
70
70
  * List of customers associated with this cart
71
+ *
72
+ * @maxItems 3000
71
73
  */
72
74
  customers?: string[];
73
75
  /**
@@ -76,6 +78,8 @@ export interface Carts {
76
78
  other_customers?: boolean;
77
79
  /**
78
80
  * Products composing the cart
81
+ *
82
+ * @maxItems 3000
79
83
  */
80
84
  items: {
81
85
  /**
@@ -125,6 +129,8 @@ export interface Carts {
125
129
  };
126
130
  /**
127
131
  * Item customization fields
132
+ *
133
+ * @maxItems 100
128
134
  */
129
135
  customizations?: {
130
136
  /**
@@ -184,6 +190,8 @@ export interface Carts {
184
190
  price?: number;
185
191
  /**
186
192
  * Current kit composition
193
+ *
194
+ * @maxItems 100
187
195
  */
188
196
  composition?: {
189
197
  /**
@@ -251,6 +259,8 @@ export interface Carts {
251
259
  final_price?: number;
252
260
  /**
253
261
  * Flags to associate additional info
262
+ *
263
+ * @maxItems 10
254
264
  */
255
265
  flags?: string[];
256
266
  }[];
@@ -260,10 +270,14 @@ export interface Carts {
260
270
  subtotal?: number;
261
271
  /**
262
272
  * List of orders completed with this cart
273
+ *
274
+ * @maxItems 3000
263
275
  */
264
276
  orders?: string[];
265
277
  /**
266
278
  * List of custom attributes
279
+ *
280
+ * @maxItems 100
267
281
  */
268
282
  metafields?: {
269
283
  /**
@@ -283,6 +297,8 @@ export interface Carts {
283
297
  }[];
284
298
  /**
285
299
  * Flags to associate additional info
300
+ *
301
+ * @maxItems 10
286
302
  */
287
303
  flags?: string[];
288
304
  /**
@@ -10,6 +10,9 @@ export interface Categories {
10
10
  created_at: string;
11
11
  updated_at: string;
12
12
  store_id: number;
13
+ /**
14
+ * @maxItems 10
15
+ */
13
16
  channel_ids?: string[];
14
17
  /**
15
18
  * Category full name
@@ -129,6 +132,8 @@ export interface Categories {
129
132
  };
130
133
  /**
131
134
  * List of category images
135
+ *
136
+ * @maxItems 50
132
137
  */
133
138
  pictures?: {
134
139
  /**
@@ -162,6 +167,8 @@ export interface Categories {
162
167
  google_product_category_id?: number;
163
168
  /**
164
169
  * List of custom attributes
170
+ *
171
+ * @maxItems 100
165
172
  */
166
173
  metafields?: {
167
174
  /**
@@ -181,6 +188,8 @@ export interface Categories {
181
188
  }[];
182
189
  /**
183
190
  * Flags to associate additional info
191
+ *
192
+ * @maxItems 10
184
193
  */
185
194
  flags?: string[];
186
195
  /**
@@ -77,6 +77,8 @@ export interface Collections {
77
77
  };
78
78
  /**
79
79
  * List of collection products
80
+ *
81
+ * @maxItems 3000
80
82
  */
81
83
  products?: string[];
82
84
  /**
@@ -98,6 +100,8 @@ export interface Collections {
98
100
  };
99
101
  /**
100
102
  * List of collection images
103
+ *
104
+ * @maxItems 50
101
105
  */
102
106
  pictures?: {
103
107
  /**
@@ -123,6 +127,8 @@ export interface Collections {
123
127
  }[];
124
128
  /**
125
129
  * List of custom attributes
130
+ *
131
+ * @maxItems 100
126
132
  */
127
133
  metafields?: {
128
134
  /**
@@ -142,6 +148,8 @@ export interface Collections {
142
148
  }[];
143
149
  /**
144
150
  * Flags to associate additional info
151
+ *
152
+ * @maxItems 10
145
153
  */
146
154
  flags?: string[];
147
155
  /**
@@ -64,6 +64,8 @@ export interface Customers {
64
64
  };
65
65
  /**
66
66
  * Providers for OAuth authentication
67
+ *
68
+ * @maxItems 20
67
69
  */
68
70
  oauth_providers?: {
69
71
  /**
@@ -85,6 +87,8 @@ export interface Customers {
85
87
  main_email: string;
86
88
  /**
87
89
  * Customer email addresses list
90
+ *
91
+ * @maxItems 20
88
92
  */
89
93
  emails?: {
90
94
  /**
@@ -148,10 +152,14 @@ export interface Customers {
148
152
  pronoun?: 'he' | 'she';
149
153
  /**
150
154
  * User profile pictures
155
+ *
156
+ * @maxItems 20
151
157
  */
152
158
  photos?: string[];
153
159
  /**
154
160
  * List of customer phone numbers
161
+ *
162
+ * @maxItems 20
155
163
  */
156
164
  phones?: {
157
165
  /**
@@ -193,6 +201,8 @@ export interface Customers {
193
201
  corporate_name?: string;
194
202
  /**
195
203
  * List of customer shipping addresses
204
+ *
205
+ * @maxItems 40
196
206
  */
197
207
  addresses?: {
198
208
  /**
@@ -271,14 +281,20 @@ export interface Customers {
271
281
  }[];
272
282
  /**
273
283
  * Products marked as favorites
284
+ *
285
+ * @maxItems 3000
274
286
  */
275
287
  favorites?: string[];
276
288
  /**
277
289
  * Last products visited by the customer
290
+ *
291
+ * @maxItems 100
278
292
  */
279
293
  last_visited_products?: string[];
280
294
  /**
281
295
  * Last terms searched on shop by the customer
296
+ *
297
+ * @maxItems 100
282
298
  */
283
299
  last_searched_terms?: string[];
284
300
  /**
@@ -299,6 +315,8 @@ export interface Customers {
299
315
  orders_total_value?: number;
300
316
  /**
301
317
  * List of customer accumulated loyalty points by program and expiration
318
+ *
319
+ * @maxItems 1000
302
320
  */
303
321
  loyalty_points_entries?: {
304
322
  /**
@@ -340,6 +358,8 @@ export interface Customers {
340
358
  total_cancelled?: number;
341
359
  /**
342
360
  * List of customer orders
361
+ *
362
+ * @maxItems 1000
343
363
  */
344
364
  orders?: {
345
365
  /**
@@ -406,6 +426,8 @@ export interface Customers {
406
426
  }[];
407
427
  /**
408
428
  * List of customer saved credit cards
429
+ *
430
+ * @maxItems 40
409
431
  */
410
432
  credit_cards?: {
411
433
  /**
@@ -444,6 +466,8 @@ export interface Customers {
444
466
  }[];
445
467
  /**
446
468
  * List of custom attributes
469
+ *
470
+ * @maxItems 100
447
471
  */
448
472
  metafields?: {
449
473
  /**
@@ -463,6 +487,8 @@ export interface Customers {
463
487
  }[];
464
488
  /**
465
489
  * List of custom attributes
490
+ *
491
+ * @maxItems 100
466
492
  */
467
493
  hidden_metafields?: {
468
494
  /**
@@ -482,6 +508,8 @@ export interface Customers {
482
508
  }[];
483
509
  /**
484
510
  * Flags to associate additional info
511
+ *
512
+ * @maxItems 10
485
513
  */
486
514
  flags?: string[];
487
515
  /**
@@ -37,6 +37,8 @@ export interface Grids {
37
37
  grid_id?: string;
38
38
  /**
39
39
  * Pre-defined options for this grid, used in specifications, customization and variations
40
+ *
41
+ * @maxItems 3000
40
42
  */
41
43
  options?: {
42
44
  /**
@@ -82,6 +84,8 @@ export interface Grids {
82
84
  };
83
85
  /**
84
86
  * Option color palette (if the grid involves colors), starting by main color
87
+ *
88
+ * @maxItems 6
85
89
  */
86
90
  colors?: string[];
87
91
  /**
@@ -121,6 +125,8 @@ export interface Grids {
121
125
  };
122
126
  /**
123
127
  * List of custom attributes
128
+ *
129
+ * @maxItems 100
124
130
  */
125
131
  metafields?: {
126
132
  /**
@@ -140,6 +146,8 @@ export interface Grids {
140
146
  }[];
141
147
  /**
142
148
  * Flags to associate additional info
149
+ *
150
+ * @maxItems 10
143
151
  */
144
152
  flags?: string[];
145
153
  /**