cloudcommerce 0.0.33 → 0.0.35
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/CHANGELOG.md +27 -0
- package/action.yml +4 -0
- package/package.json +6 -6
- package/packages/__skeleton/package.json +4 -1
- package/packages/__skeleton/src/{index.js → index.ts} +0 -0
- package/packages/__skeleton/tsconfig.json +3 -0
- package/packages/api/lib/index.d.ts +2 -112
- package/packages/api/lib/types.d.ts +1 -1
- package/packages/api/package.json +1 -1
- package/packages/api/src/types.ts +4 -0
- package/packages/apps/discounts/lib/index.js +4 -0
- package/packages/apps/discounts/lib/index.js.map +1 -0
- package/packages/apps/discounts/package.json +4 -1
- package/packages/apps/discounts/src/index.ts +7 -0
- package/packages/apps/discounts/tsconfig.json +3 -0
- package/packages/cli/lib/index.js +11 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/index.ts +12 -3
- package/packages/firebase/lib/config.d.ts +15 -0
- package/packages/firebase/lib/config.js +3 -0
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/defaults.d.ts +4 -0
- package/packages/firebase/lib/env.d.ts +8 -0
- package/packages/firebase/lib/handlers/check-store-events.d.ts +2 -0
- package/packages/firebase/lib/{methods → handlers}/check-store-events.js +11 -1
- package/packages/firebase/lib/handlers/check-store-events.js.map +1 -0
- package/packages/firebase/lib/index.d.ts +5 -0
- package/packages/firebase/lib/index.js +4 -4
- package/packages/firebase/lib/index.js.map +1 -1
- package/packages/firebase/lib/types.d.ts +6 -0
- package/packages/firebase/lib/types.js +2 -0
- package/packages/firebase/lib/types.js.map +1 -0
- package/packages/firebase/package.json +3 -1
- package/packages/firebase/src/config.ts +3 -0
- package/packages/firebase/src/{methods → handlers}/check-store-events.ts +11 -0
- package/packages/firebase/src/index.ts +4 -5
- package/packages/firebase/src/types.ts +11 -0
- package/packages/firebase/tsconfig.json +4 -1
- package/packages/modules/CHANGELOG.md +1 -0
- package/packages/modules/README.md +1 -0
- package/packages/modules/lib/firebase/index.js +16 -0
- package/packages/modules/lib/firebase/index.js.map +1 -0
- package/packages/modules/lib/index.js +21 -0
- package/packages/modules/lib/index.js.map +1 -0
- package/packages/modules/package.json +33 -0
- package/packages/modules/schemas/@checkout.cjs +1015 -0
- package/packages/modules/schemas/apply_discount.cjs +324 -0
- package/packages/modules/schemas/calculate_shipping.cjs +666 -0
- package/packages/modules/schemas/create_transaction.cjs +1001 -0
- package/packages/modules/schemas/list_payments.cjs +852 -0
- package/packages/modules/scripts/build-types.sh +33 -0
- package/packages/modules/src/firebase/index.ts +16 -0
- package/packages/modules/src/index.ts +21 -0
- package/packages/modules/tsconfig.json +3 -0
- package/packages/storefront/package.json +2 -2
- package/packages/types/CHANGELOG.md +1 -0
- package/packages/types/README.md +1 -0
- package/packages/types/index.ts +66 -0
- package/packages/types/modules/@checkout:params.d.ts +920 -0
- package/packages/types/modules/apply_discount:params.d.ts +154 -0
- package/packages/types/modules/apply_discount:response.d.ts +71 -0
- package/packages/types/modules/calculate_shipping:params.d.ts +275 -0
- package/packages/types/modules/calculate_shipping:response.d.ts +402 -0
- package/packages/types/modules/create_transaction:params.d.ts +515 -0
- package/packages/types/modules/create_transaction:response.d.ts +261 -0
- package/packages/types/modules/list_payments:params.d.ts +323 -0
- package/packages/types/modules/list_payments:response.d.ts +266 -0
- package/packages/types/package.json +21 -0
- package/pnpm-lock.yaml +503 -274
- package/packages/firebase/lib/methods/check-store-events.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
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.35](https://github.com/ecomplus/cloud-commerce/compare/v0.0.34...v0.0.35) (2022-07-27)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **modules:** Prevent cyclic dependencies moving types to `@cloudcommerce/types` pkg ([52f46ab](https://github.com/ecomplus/cloud-commerce/commit/52f46ab0332050b8e661e47c400a8084728d47e8))
|
|
11
|
+
|
|
12
|
+
### [0.0.34](https://github.com/ecomplus/cloud-commerce/compare/v0.0.33...v0.0.34) (2022-07-27)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **cli:** Suggest `npx kill-port` on serve "port taken" error ([99f955e](https://github.com/ecomplus/cloud-commerce/commit/99f955eeb1f11664a988d969c48de217921f35fd))
|
|
18
|
+
* **deps:** Update astro to RC and vite v3 ([4336f81](https://github.com/ecomplus/cloud-commerce/commit/4336f81d18d82654f638ba25fc618d6cb6612f24))
|
|
19
|
+
* **firebase:** Move base functions options (region) to config object ([b691149](https://github.com/ecomplus/cloud-commerce/commit/b691149c3744d56f2f472f86218cf72c4bc56669))
|
|
20
|
+
* GH Action also pass optional `ecom-store-id` input to functions .env ([ed7771f](https://github.com/ecomplus/cloud-commerce/commit/ed7771fe50e987ffff120d4061c5c73f85e3f091))
|
|
21
|
+
* **modules:** Add new `@cloudcommerce/modules` pkg for app modules schema and typedefs [[#29](https://github.com/ecomplus/cloud-commerce/issues/29)] ([a7b833c](https://github.com/ecomplus/cloud-commerce/commit/a7b833c53cc814d89a8137aeb49bc3a41f87a2ce))
|
|
22
|
+
* **modules:** Start setting modules Firebase Functions ([53bb594](https://github.com/ecomplus/cloud-commerce/commit/53bb594585966c56cfa36a8cd35c17e50eb704a7))
|
|
23
|
+
* **types:** Add new `@cloudcommerce/types` pkg for reusable types ([a5ca712](https://github.com/ecomplus/cloud-commerce/commit/a5ca7127c80a48fdbca6fec1c14badfc078f5aa8))
|
|
24
|
+
* **types:** Also exporting modules params and responses type interfaces ([57c207c](https://github.com/ecomplus/cloud-commerce/commit/57c207cb6f7af3c8c0007173cc49859e4ecba1f3))
|
|
25
|
+
* **types:** New `@cloudcommerce/types` pkg with reusable types ([fa59792](https://github.com/ecomplus/cloud-commerce/commit/fa59792ccc322d1b6f23766daefe4278f671775c))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **deps:** Update all non-major dependencies ([#33](https://github.com/ecomplus/cloud-commerce/issues/33)) ([ac90a64](https://github.com/ecomplus/cloud-commerce/commit/ac90a64ca72fda97d30c3b214a801f5947267e12))
|
|
31
|
+
|
|
5
32
|
### [0.0.33](https://github.com/ecomplus/cloud-commerce/compare/v0.0.32...v0.0.33) (2022-07-20)
|
|
6
33
|
|
|
7
34
|
|
package/action.yml
CHANGED
|
@@ -14,6 +14,8 @@ inputs:
|
|
|
14
14
|
ecom-api-key:
|
|
15
15
|
description: 'E-Com Plus store API key'
|
|
16
16
|
required: true
|
|
17
|
+
ecom-store-id:
|
|
18
|
+
description: 'Store ID if defined in config.json'
|
|
17
19
|
|
|
18
20
|
outputs: {}
|
|
19
21
|
|
|
@@ -47,11 +49,13 @@ runs:
|
|
|
47
49
|
FIREBASE_SERVICE_ACCOUNT: ${{ inputs.firebase-service-account }}
|
|
48
50
|
ECOM_AUTHENTICATION_ID: ${{ inputs.ecom-authentication-id }}
|
|
49
51
|
ECOM_API_KEY: ${{ inputs.ecom-api-key }}
|
|
52
|
+
ECOM_STORE_ID: ${{ inputs.ecom-store-id }}
|
|
50
53
|
run: |
|
|
51
54
|
export GAC_FILENAME=".gac-$RANDOM.json"
|
|
52
55
|
echo $FIREBASE_SERVICE_ACCOUNT > $GAC_FILENAME
|
|
53
56
|
printf "ECOM_AUTHENTICATION_ID=$ECOM_AUTHENTICATION_ID
|
|
54
57
|
ECOM_API_KEY=$ECOM_API_KEY
|
|
58
|
+
ECOM_STORE_ID=$ECOM_STORE_ID
|
|
55
59
|
GITHUB_TOKEN=$GITHUB_TOKEN
|
|
56
60
|
" > functions/.env
|
|
57
61
|
GOOGLE_APPLICATION_CREDENTIALS=$GAC_FILENAME npm run deploy
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
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>",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"@types/node": "^18.0.5",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
24
24
|
"@typescript-eslint/parser": "^5.30.7",
|
|
25
|
-
"esbuild": "^0.14.
|
|
25
|
+
"esbuild": "^0.14.50",
|
|
26
26
|
"eslint": "^8.20.0",
|
|
27
27
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
28
28
|
"eslint-plugin-import": "^2.26.0",
|
|
29
|
-
"eslint-plugin-vue": "^9.
|
|
29
|
+
"eslint-plugin-vue": "^9.3.0",
|
|
30
30
|
"husky": "^8.0.1",
|
|
31
31
|
"node-fetch": "^3.2.9",
|
|
32
32
|
"standard-version": "^9.5.0",
|
|
33
|
-
"turbo": "^1.3.
|
|
33
|
+
"turbo": "^1.3.4",
|
|
34
34
|
"typescript": "^4.7.4",
|
|
35
|
-
"vite": "
|
|
36
|
-
"vitest": "^0.
|
|
35
|
+
"vite": "3",
|
|
36
|
+
"vitest": "^0.19.1",
|
|
37
37
|
"zx": "^7.0.7"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "lib/index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/ecomplus/cloud-commerce.git",
|
|
@@ -20,5 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@cloudcommerce/api": "workspace:*"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@cloudcommerce/types": "workspace:*"
|
|
23
26
|
}
|
|
24
27
|
}
|
|
File without changes
|
|
@@ -26,62 +26,7 @@ declare const api: {
|
|
|
26
26
|
}>;
|
|
27
27
|
get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
|
|
28
28
|
config: Config;
|
|
29
|
-
data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types
|
|
30
|
-
result: E extends infer T_1 ? T_1 extends E ? T_1 extends "products" | `products?${string}` ? import("./types").Products[] : T_1 extends "categories" | `categories?${string}` ? import("./types").Categories[] : T_1 extends "brands" | `brands?${string}` ? import("./types").Brands[] : T_1 extends "collections" | `collections?${string}` ? import("./types").Collections[] : T_1 extends "grids" | `grids?${string}` ? import("./types").Grids[] : T_1 extends "carts" | `carts?${string}` ? import("./types").Carts[] : T_1 extends "orders" | `orders?${string}` ? import("./types").Orders[] : T_1 extends "customers" | `customers?${string}` ? import("./types").Customers[] : T_1 extends "stores" | `stores?${string}` ? import("./types").Stores[] : T_1 extends "applications" | `applications?${string}` ? import("./types").Applications[] : T_1 extends "authentications" | `authentications?${string}` ? import("./types/authentications").Authentications[] : never : never : never;
|
|
31
|
-
meta: {
|
|
32
|
-
offset: number;
|
|
33
|
-
limit: number;
|
|
34
|
-
fields: string[];
|
|
35
|
-
} & {
|
|
36
|
-
count?: number | undefined;
|
|
37
|
-
sort: {
|
|
38
|
-
field: string;
|
|
39
|
-
order: 1 | -1;
|
|
40
|
-
}[];
|
|
41
|
-
query: {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
} : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? {
|
|
46
|
-
result: ({
|
|
47
|
-
timestamp: string;
|
|
48
|
-
store_id?: number | undefined;
|
|
49
|
-
resource?: string | undefined;
|
|
50
|
-
authentication_id?: (string & {
|
|
51
|
-
length: 24;
|
|
52
|
-
}) | null | undefined;
|
|
53
|
-
resource_id?: (string & {
|
|
54
|
-
length: 24;
|
|
55
|
-
}) | undefined;
|
|
56
|
-
action: string;
|
|
57
|
-
modified_fields: string[];
|
|
58
|
-
method?: number | undefined;
|
|
59
|
-
endpoint?: string | undefined;
|
|
60
|
-
body?: any;
|
|
61
|
-
ip?: string | undefined;
|
|
62
|
-
} & (E extends infer T_2 ? T_2 extends E ? T_2 extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" ? {
|
|
63
|
-
resource_id: string & {
|
|
64
|
-
length: 24;
|
|
65
|
-
};
|
|
66
|
-
authentication_id: (string & {
|
|
67
|
-
length: 24;
|
|
68
|
-
}) | null;
|
|
69
|
-
} : T_2 extends `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` ? {
|
|
70
|
-
authentication_id: (string & {
|
|
71
|
-
length: 24;
|
|
72
|
-
}) | null;
|
|
73
|
-
} : T_2 extends "events/me" ? {
|
|
74
|
-
resource: import("./types").Resource;
|
|
75
|
-
resource_id: string & {
|
|
76
|
-
length: 24;
|
|
77
|
-
};
|
|
78
|
-
} : never : never : never))[];
|
|
79
|
-
meta: {
|
|
80
|
-
offset: number;
|
|
81
|
-
limit: number;
|
|
82
|
-
fields: string[];
|
|
83
|
-
};
|
|
84
|
-
} : any;
|
|
29
|
+
data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types").Authentications : E extends ResourceOpQuery ? import("./types").ResourceListResult<E> : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? import("./types").EventsResult<E> : any;
|
|
85
30
|
}>;
|
|
86
31
|
post: <E_1 extends Endpoint, C_1 extends AbstractedAuthConfig>(endpoint: E_1, body: E_1 extends "products" | `products/${string}` ? {
|
|
87
32
|
categories?: {
|
|
@@ -5089,62 +5034,7 @@ declare type AbstractedAuthConfig = AbstractedConfig & {
|
|
|
5089
5034
|
};
|
|
5090
5035
|
declare const get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
|
|
5091
5036
|
config: Config;
|
|
5092
|
-
data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types
|
|
5093
|
-
result: E extends infer T_1 ? T_1 extends E ? T_1 extends "products" | `products?${string}` ? import("./types").Products[] : T_1 extends "categories" | `categories?${string}` ? import("./types").Categories[] : T_1 extends "brands" | `brands?${string}` ? import("./types").Brands[] : T_1 extends "collections" | `collections?${string}` ? import("./types").Collections[] : T_1 extends "grids" | `grids?${string}` ? import("./types").Grids[] : T_1 extends "carts" | `carts?${string}` ? import("./types").Carts[] : T_1 extends "orders" | `orders?${string}` ? import("./types").Orders[] : T_1 extends "customers" | `customers?${string}` ? import("./types").Customers[] : T_1 extends "stores" | `stores?${string}` ? import("./types").Stores[] : T_1 extends "applications" | `applications?${string}` ? import("./types").Applications[] : T_1 extends "authentications" | `authentications?${string}` ? import("./types/authentications").Authentications[] : never : never : never;
|
|
5094
|
-
meta: {
|
|
5095
|
-
offset: number;
|
|
5096
|
-
limit: number;
|
|
5097
|
-
fields: string[];
|
|
5098
|
-
} & {
|
|
5099
|
-
count?: number | undefined;
|
|
5100
|
-
sort: {
|
|
5101
|
-
field: string;
|
|
5102
|
-
order: 1 | -1;
|
|
5103
|
-
}[];
|
|
5104
|
-
query: {
|
|
5105
|
-
[key: string]: any;
|
|
5106
|
-
};
|
|
5107
|
-
};
|
|
5108
|
-
} : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? {
|
|
5109
|
-
result: ({
|
|
5110
|
-
timestamp: string;
|
|
5111
|
-
store_id?: number | undefined;
|
|
5112
|
-
resource?: string | undefined;
|
|
5113
|
-
authentication_id?: (string & {
|
|
5114
|
-
length: 24;
|
|
5115
|
-
}) | null | undefined;
|
|
5116
|
-
resource_id?: (string & {
|
|
5117
|
-
length: 24;
|
|
5118
|
-
}) | undefined;
|
|
5119
|
-
action: string;
|
|
5120
|
-
modified_fields: string[];
|
|
5121
|
-
method?: number | undefined;
|
|
5122
|
-
endpoint?: string | undefined;
|
|
5123
|
-
body?: any;
|
|
5124
|
-
ip?: string | undefined;
|
|
5125
|
-
} & (E extends infer T_2 ? T_2 extends E ? T_2 extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" ? {
|
|
5126
|
-
resource_id: string & {
|
|
5127
|
-
length: 24;
|
|
5128
|
-
};
|
|
5129
|
-
authentication_id: (string & {
|
|
5130
|
-
length: 24;
|
|
5131
|
-
}) | null;
|
|
5132
|
-
} : T_2 extends `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` ? {
|
|
5133
|
-
authentication_id: (string & {
|
|
5134
|
-
length: 24;
|
|
5135
|
-
}) | null;
|
|
5136
|
-
} : T_2 extends "events/me" ? {
|
|
5137
|
-
resource: import("./types").Resource;
|
|
5138
|
-
resource_id: string & {
|
|
5139
|
-
length: 24;
|
|
5140
|
-
};
|
|
5141
|
-
} : never : never : never))[];
|
|
5142
|
-
meta: {
|
|
5143
|
-
offset: number;
|
|
5144
|
-
limit: number;
|
|
5145
|
-
fields: string[];
|
|
5146
|
-
};
|
|
5147
|
-
} : any;
|
|
5037
|
+
data: E extends `${string}/${string}/${string}` ? any : E extends `products/${string}` ? import("./types").Products : E extends `categories/${string}` ? import("./types").Categories : E extends `brands/${string}` ? import("./types").Brands : E extends `collections/${string}` ? import("./types").Collections : E extends `grids/${string}` ? import("./types").Grids : E extends `carts/${string}` ? import("./types").Carts : E extends `orders/${string}` ? import("./types").Orders : E extends `customers/${string}` ? import("./types").Customers : E extends `stores/${string}` ? import("./types").Stores : E extends `applications/${string}` ? import("./types").Applications : E extends `authentications/${string}` ? import("./types").Authentications : E extends ResourceOpQuery ? import("./types").ResourceListResult<E> : E extends "events/products" | "events/categories" | "events/brands" | "events/collections" | "events/grids" | "events/carts" | "events/orders" | "events/customers" | "events/stores" | "events/applications" | "events/authentications" | `events/products/${string}` | `events/categories/${string}` | `events/brands/${string}` | `events/collections/${string}` | `events/grids/${string}` | `events/carts/${string}` | `events/orders/${string}` | `events/customers/${string}` | `events/stores/${string}` | `events/applications/${string}` | `events/authentications/${string}` | "events/me" ? import("./types").EventsResult<E> : any;
|
|
5148
5038
|
}>;
|
|
5149
5039
|
declare const post: <E extends Endpoint, C extends AbstractedAuthConfig>(endpoint: E, body: E extends "products" | `products/${string}` ? {
|
|
5150
5040
|
categories?: {
|
|
@@ -91,4 +91,4 @@ declare type ResponseBody<TConfig extends Config> = TConfig['method'] extends 'p
|
|
|
91
91
|
declare type DocSchema<Document extends any> = Omit<Document, '_id' | 'store_id' | 'store_ids' | 'created_at' | 'updated_at'>;
|
|
92
92
|
declare type SetDocEndpoint<TResource extends Resource> = TResource | `${TResource}/${ResourceId}`;
|
|
93
93
|
declare type RequestBody<TConfig extends Config> = TConfig['method'] extends undefined | 'get' | 'delete' ? undefined : TConfig['method'] extends 'patch' ? any : TConfig['endpoint'] extends SetDocEndpoint<'products'> ? DocSchema<Products> : TConfig['endpoint'] extends SetDocEndpoint<'categories'> ? DocSchema<Categories> : TConfig['endpoint'] extends SetDocEndpoint<'brands'> ? DocSchema<Brands> : TConfig['endpoint'] extends SetDocEndpoint<'collections'> ? DocSchema<Collections> : TConfig['endpoint'] extends SetDocEndpoint<'grids'> ? DocSchema<Grids> : TConfig['endpoint'] extends SetDocEndpoint<'carts'> ? DocSchema<Carts> : TConfig['endpoint'] extends SetDocEndpoint<'orders'> ? DocSchema<Orders> : TConfig['endpoint'] extends SetDocEndpoint<'customers'> ? DocSchema<Customers> : TConfig['endpoint'] extends SetDocEndpoint<'stores'> ? DocSchema<Stores> : TConfig['endpoint'] extends SetDocEndpoint<'applications'> ? DocSchema<Applications> : TConfig['endpoint'] extends SetDocEndpoint<'authentications'> ? DocSchema<Authentications> : any;
|
|
94
|
-
export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Resource, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResponseBody, RequestBody, };
|
|
94
|
+
export type { Products, Categories, Brands, Collections, Grids, Carts, Orders, Customers, Stores, Applications, Authentications, Resource, ResourceId, ResourceAndId, ResourceOpQuery, Endpoint, Method, Config, ResourceListResult, EventsResult, ResponseBody, RequestBody, };
|
|
@@ -182,12 +182,16 @@ export type {
|
|
|
182
182
|
Customers,
|
|
183
183
|
Stores,
|
|
184
184
|
Applications,
|
|
185
|
+
Authentications,
|
|
185
186
|
Resource,
|
|
187
|
+
ResourceId,
|
|
186
188
|
ResourceAndId,
|
|
187
189
|
ResourceOpQuery,
|
|
188
190
|
Endpoint,
|
|
189
191
|
Method,
|
|
190
192
|
Config,
|
|
193
|
+
ResourceListResult,
|
|
194
|
+
EventsResult,
|
|
191
195
|
ResponseBody,
|
|
192
196
|
RequestBody,
|
|
193
197
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAiB,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-discounts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for complex discount rules",
|
|
6
6
|
"main": "functions/dist/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -20,5 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@cloudcommerce/api": "workspace:*"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@cloudcommerce/types": "workspace:*"
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -41,11 +41,20 @@ export default async () => {
|
|
|
41
41
|
}
|
|
42
42
|
return opts;
|
|
43
43
|
}, '');
|
|
44
|
-
const $firebase =
|
|
44
|
+
const $firebase = (cmd) => {
|
|
45
45
|
return $`firebase --project=${projectId} ${cmd}${options}`;
|
|
46
46
|
};
|
|
47
47
|
if (argv._.includes('serve')) {
|
|
48
|
-
return $firebase('emulators:start')
|
|
48
|
+
return $firebase('emulators:start').catch(async (err) => {
|
|
49
|
+
await echo`
|
|
50
|
+
Try killing open emulators with:
|
|
51
|
+
${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
|
|
52
|
+
`;
|
|
53
|
+
if (err.stdout.includes('port taken')) {
|
|
54
|
+
return process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
});
|
|
49
58
|
}
|
|
50
59
|
if (argv._.find((cmd) => /^(\w+:)?(shell|start)$/.test(cmd))) {
|
|
51
60
|
return $firebase('functions:shell');
|
|
@@ -54,13 +54,23 @@ export default async () => {
|
|
|
54
54
|
}
|
|
55
55
|
return opts;
|
|
56
56
|
}, '');
|
|
57
|
-
const $firebase =
|
|
57
|
+
const $firebase = (cmd: string) => {
|
|
58
58
|
return $`firebase --project=${projectId} ${cmd}${options}`;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
if (argv._.includes('serve')) {
|
|
62
|
-
return $firebase('emulators:start')
|
|
62
|
+
return $firebase('emulators:start').catch(async (err: any) => {
|
|
63
|
+
await echo`
|
|
64
|
+
Try killing open emulators with:
|
|
65
|
+
${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
|
|
66
|
+
`;
|
|
67
|
+
if (err.stdout.includes('port taken')) {
|
|
68
|
+
return process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
throw err;
|
|
71
|
+
});
|
|
63
72
|
}
|
|
73
|
+
|
|
64
74
|
if (argv._.find((cmd) => /^(\w+:)?(shell|start)$/.test(cmd))) {
|
|
65
75
|
return $firebase('functions:shell');
|
|
66
76
|
}
|
|
@@ -70,7 +80,6 @@ export default async () => {
|
|
|
70
80
|
if (argv._.includes('deploy')) {
|
|
71
81
|
return $firebase('deploy');
|
|
72
82
|
}
|
|
73
|
-
|
|
74
83
|
if (argv._.includes('login')) {
|
|
75
84
|
await $firebase('login');
|
|
76
85
|
return login();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
get(): {
|
|
3
|
+
hello: string;
|
|
4
|
+
lang: string;
|
|
5
|
+
currency: string;
|
|
6
|
+
currencySymbol: string;
|
|
7
|
+
countryCode: string;
|
|
8
|
+
storeId: number;
|
|
9
|
+
httpsFunctionOptions: {
|
|
10
|
+
region: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
set(config: any): void;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -12,6 +12,9 @@ const self = {
|
|
|
12
12
|
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
13
13
|
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
14
14
|
storeId: Number(process.env.ECOM_STORE_ID),
|
|
15
|
+
httpsFunctionOptions: {
|
|
16
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
17
|
+
},
|
|
15
18
|
},
|
|
16
19
|
};
|
|
17
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG;IACX,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAgB;QACvD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB;QAC3E,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG;IACX,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAgB;QACvD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB;QAC3E,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC1C,oBAAoB,EAAE;YACpB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;SAChD;KACF;CACF,CAAC;AAEF,eAAe;IACb,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,MAAM;QACR,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF,CAAC"}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import { firestore } from 'firebase-admin';
|
|
1
2
|
import { logger } from 'firebase-functions';
|
|
2
3
|
import api from '@cloudcommerce/api';
|
|
3
|
-
import getEnv from '../env
|
|
4
|
+
import getEnv from '../env';
|
|
4
5
|
|
|
5
6
|
export default async () => {
|
|
6
7
|
const { authenticationId, apiKey } = getEnv();
|
|
8
|
+
const eventsSubs = await firestore().collection('eventsSubs').get();
|
|
9
|
+
const listenedEvents = [];
|
|
10
|
+
eventsSubs.forEach((doc) => {
|
|
11
|
+
const eventSub = doc.data();
|
|
12
|
+
if (!listenedEvents.includes(eventSub.event)) {
|
|
13
|
+
listenedEvents.push(eventSub.event);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
logger.info({ listenedEvents });
|
|
7
17
|
[
|
|
8
18
|
'orders',
|
|
9
19
|
'products',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-store-events.js","sourceRoot":"","sources":["../../src/handlers/check-store-events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,eAAe,KAAK,IAAI,EAAE;IACxB,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9C,MAAM,UAAU,GAAG,MAAM,SAAS,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC;IACpE,MAAM,cAAc,GAAwB,EAAE,CAAC;IAC/C,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACzB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAc,CAAC;QACxC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;IAChC;QACE,QAAQ;QACR,UAAU;QACV,OAAO;KACR,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC3B,MAAM,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,GAAG,CAAC;YACrC,gBAAgB;YAChB,MAAM;YACN,QAAQ,EAAE,UAAU,QAAoB,EAAE;SAC3C,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,WAAW,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import 'source-map-support/register.js';
|
|
2
|
+
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
3
|
+
export declare const z: import("firebase-functions/v2/https").HttpsFunction;
|
|
4
|
+
export declare const ssr: import("firebase-functions/v2/https").HttpsFunction;
|
|
5
|
+
export declare const cronStoreEvents: import("firebase-functions/v1").CloudFunction<unknown>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import 'source-map-support/register.js';
|
|
2
2
|
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
3
|
+
import { initializeApp } from 'firebase-admin';
|
|
3
4
|
import { pubsub, logger } from 'firebase-functions';
|
|
4
5
|
// eslint-disable-next-line import/no-unresolved
|
|
5
6
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
6
7
|
import config from './config.js';
|
|
7
|
-
import checkStoreEvents from './
|
|
8
|
+
import checkStoreEvents from './handlers/check-store-events.js';
|
|
8
9
|
|
|
10
|
+
initializeApp();
|
|
9
11
|
const processId = String(Date.now());
|
|
10
|
-
const options =
|
|
11
|
-
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
12
|
-
};
|
|
12
|
+
const options = config.get().httpsFunctionOptions;
|
|
13
13
|
|
|
14
14
|
export const z = onRequest(options, ({ url }, response) => {
|
|
15
15
|
process.env.ECOM_API_KEY = '***';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,gBAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACpD,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAE7D,aAAa,EAAE,CAAC;AAChB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AACrC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE;IACxD,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;IACjC,IAAI,GAAG,KAAK,QAAQ,EAAE;QACpB,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE;YACzB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO;KACR;IACD,IAAI,GAAG,KAAK,MAAM,EAAE;QAClB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzB,OAAO;KACR;IACD,QAAQ,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;IACrE,OAAO,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./lib/index.js",
|
|
9
10
|
"./config": "./config.js"
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
"source-map-support": "^0.5.21"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
35
|
+
"@cloudcommerce/types": "workspace:*",
|
|
34
36
|
"@firebase/app-types": "^0.7.0"
|
|
35
37
|
}
|
|
36
38
|
}
|
|
@@ -16,6 +16,9 @@ const self = {
|
|
|
16
16
|
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
17
17
|
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
18
18
|
storeId: Number(process.env.ECOM_STORE_ID),
|
|
19
|
+
httpsFunctionOptions: {
|
|
20
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
21
|
+
},
|
|
19
22
|
},
|
|
20
23
|
};
|
|
21
24
|
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import type { EventSub } from '../types';
|
|
2
|
+
import { firestore } from 'firebase-admin';
|
|
1
3
|
import { logger } from 'firebase-functions';
|
|
2
4
|
import api from '@cloudcommerce/api';
|
|
3
5
|
import getEnv from '../env';
|
|
4
6
|
|
|
5
7
|
export default async () => {
|
|
6
8
|
const { authenticationId, apiKey } = getEnv();
|
|
9
|
+
const eventsSubs = await firestore().collection('eventsSubs').get();
|
|
10
|
+
const listenedEvents: EventSub['event'][] = [];
|
|
11
|
+
eventsSubs.forEach((doc) => {
|
|
12
|
+
const eventSub = doc.data() as EventSub;
|
|
13
|
+
if (!listenedEvents.includes(eventSub.event)) {
|
|
14
|
+
listenedEvents.push(eventSub.event);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
logger.info({ listenedEvents });
|
|
7
18
|
[
|
|
8
19
|
'orders',
|
|
9
20
|
'products',
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import 'source-map-support/register.js';
|
|
2
2
|
import '@cloudcommerce/api/fetch-polyfill.js';
|
|
3
|
+
import { initializeApp } from 'firebase-admin';
|
|
3
4
|
import { pubsub, logger } from 'firebase-functions';
|
|
4
5
|
// eslint-disable-next-line import/no-unresolved
|
|
5
6
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
6
7
|
import config from './config';
|
|
7
|
-
import checkStoreEvents from './
|
|
8
|
+
import checkStoreEvents from './handlers/check-store-events';
|
|
8
9
|
|
|
10
|
+
initializeApp();
|
|
9
11
|
const processId = String(Date.now());
|
|
10
|
-
|
|
11
|
-
const options = {
|
|
12
|
-
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
13
|
-
};
|
|
12
|
+
const options = config.get().httpsFunctionOptions;
|
|
14
13
|
|
|
15
14
|
export const z = onRequest(options, ({ url }, response) => {
|
|
16
15
|
process.env.ECOM_API_KEY = '***';
|