cloudcommerce 0.0.2 → 0.0.5
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/{.eslintrc.js → .eslintrc.cjs} +4 -4
- package/.github/renovate.json +2 -1
- package/CHANGELOG.md +34 -0
- package/README.md +2 -2
- package/package.json +11 -7
- package/packages/api/lib/index.d.ts +134 -0
- package/packages/api/lib/index.js +89 -0
- package/packages/api/lib/index.js.map +1 -0
- package/packages/api/lib/types/applications.d.ts +208 -0
- package/packages/api/lib/types/authentications.d.ts +97 -0
- package/packages/api/lib/types/brands.d.ts +148 -0
- package/packages/api/lib/types/carts.d.ts +292 -0
- package/packages/api/lib/types/categories.d.ts +190 -0
- package/packages/api/lib/types/collections.d.ts +151 -0
- package/packages/api/lib/types/customers.d.ts +495 -0
- package/packages/api/lib/types/grids.d.ts +149 -0
- package/packages/api/lib/types/orders.d.ts +1588 -0
- package/packages/api/lib/types/products.d.ts +1284 -0
- package/packages/api/lib/types/stores.d.ts +120 -0
- package/packages/api/lib/types.d.ts +39 -0
- package/packages/api/lib/types.js +2 -0
- package/packages/api/lib/types.js.map +1 -0
- package/packages/api/package.json +5 -3
- package/packages/api/scripts/build.sh +6 -0
- package/packages/api/src/index.ts +66 -72
- package/packages/api/src/types/applications.d.ts +208 -0
- package/packages/api/src/types/authentications.d.ts +97 -0
- package/packages/api/src/types/brands.d.ts +148 -0
- package/packages/api/src/types/carts.d.ts +292 -0
- package/packages/api/src/types/categories.d.ts +190 -0
- package/packages/api/src/types/collections.d.ts +151 -0
- package/packages/api/src/types/customers.d.ts +495 -0
- package/packages/api/src/types/grids.d.ts +149 -0
- package/packages/api/src/types/orders.d.ts +1588 -0
- package/packages/api/src/types/products.d.ts +1284 -0
- package/packages/api/src/types/stores.d.ts +120 -0
- package/packages/api/src/types.ts +76 -0
- package/packages/api/tests/fetch-polyfill.js +21 -0
- package/packages/api/tests/index.test.ts +30 -0
- package/packages/api/tsconfig.json +2 -97
- package/packages/apps/discounts/package.json +1 -1
- package/packages/storefront/package.json +3 -2
- package/tsconfig.json +107 -0
- package/tsconfig.test.json +11 -0
- package/turbo.json +9 -1
- package/vite.config.ts +12 -0
- package/packages/api/dist/index.js +0 -73
- package/packages/api/dist/index.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
env: {
|
|
3
3
|
browser: true,
|
|
4
|
-
|
|
4
|
+
es2020: true,
|
|
5
5
|
node: true,
|
|
6
6
|
},
|
|
7
7
|
extends: [
|
|
@@ -9,7 +9,7 @@ module.exports = {
|
|
|
9
9
|
'airbnb-base',
|
|
10
10
|
],
|
|
11
11
|
parserOptions: {
|
|
12
|
-
ecmaVersion:
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
13
|
parser: '@typescript-eslint/parser',
|
|
14
14
|
sourceType: 'module',
|
|
15
15
|
},
|
|
@@ -21,10 +21,10 @@ module.exports = {
|
|
|
21
21
|
'**/dist',
|
|
22
22
|
],
|
|
23
23
|
rules: {
|
|
24
|
-
'no-param-reassign': 'warn',
|
|
25
24
|
'no-await-in-loop': 'warn',
|
|
26
25
|
'no-shadow': 'warn',
|
|
27
|
-
'no-
|
|
26
|
+
'no-param-reassign': 'warn',
|
|
27
|
+
'no-underscore-dangle': 'off',
|
|
28
28
|
'no-continue': 'off',
|
|
29
29
|
'import/extensions': [
|
|
30
30
|
'error',
|
package/.github/renovate.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
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.5](https://github.com/ecomplus/cloud-commerce/compare/v0.0.4...v0.0.5) (2022-06-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **api:** Error object (not 2xx) includes `statusCode` property (as Fastify errors) ([a9681f2](https://github.com/ecomplus/cloud-commerce/commit/a9681f23ceb9b007f90e95351ca133fdac865f1b))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **api:** Config object is optional on abstracted method functions ([2eebbe7](https://github.com/ecomplus/cloud-commerce/commit/2eebbe771971b5ac87b85f6068a36d7e1f647aba))
|
|
16
|
+
* **api:** Resolve with resource type on read without method (get is default) ([52b1a9b](https://github.com/ecomplus/cloud-commerce/commit/52b1a9b7cb48210b155ac620eaa6b3c8d95d681e))
|
|
17
|
+
|
|
18
|
+
### [0.0.4](https://github.com/ecomplus/cloud-commerce/compare/v0.0.3...v0.0.4) (2022-06-15)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **api:** Fix adding `:storeId` to default API base URL ([d424760](https://github.com/ecomplus/cloud-commerce/commit/d4247602168078acc0b05f5d1bbf5980f636bd71))
|
|
24
|
+
* **api:** No `procedures` and `triggers` resources on Store API v2 (remove from default types) ([66281d4](https://github.com/ecomplus/cloud-commerce/commit/66281d41f25a707fabda2233d2404724ba6b53f4))
|
|
25
|
+
|
|
26
|
+
### [0.0.3](https://github.com/ecomplus/cloud-commerce/compare/v0.0.2...v0.0.3) (2022-06-14)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **api:** Add `timeout` req option with 20s default ([9544225](https://github.com/ecomplus/cloud-commerce/commit/954422567d1e77c95522e7c02758cb4fda6cbfd0))
|
|
32
|
+
* **api:** Set response body type for each resource on read by id ([7330537](https://github.com/ecomplus/cloud-commerce/commit/733053770cd62a7f07ee6753e06b461e168e25da))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **api:** Fix success payload with full fetch response object ([083b51d](https://github.com/ecomplus/cloud-commerce/commit/083b51da0864c040b323b26d5635b574bbbb26bf))
|
|
38
|
+
|
|
5
39
|
### [0.0.2](https://github.com/ecomplus/cloud-commerce/compare/v0.0.2-alpha.0...v0.0.2) (2022-06-11)
|
|
6
40
|
|
|
7
41
|
### [0.0.2-alpha.0](https://github.com/ecomplus/cloud-commerce/compare/v1.0.0-alpha.8...v0.0.2-alpha.0) (2022-06-11)
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# E-Com Plus Open Cloud Commerce
|
|
2
2
|
|
|
3
3
|
Open fair-code eCommerce platform to use on top of headless commerce APIs, it includes:
|
|
4
|
-
- High performant Astro PWA & Jamstack storefront;
|
|
4
|
+
- High performant [Astro](https://astro.build/) + [Vue](https://vuejs.org/) PWA & Jamstack storefront;
|
|
5
5
|
- Storefront CMS and page builder;
|
|
6
6
|
- Integrations for payments, shipping, ERPs, CRMs and others.
|
|
7
7
|
|
|
8
|
-
Easy deployment on Firebase, plug & play with [E-Com Plus APIs](https://developers.e-com.plus/)
|
|
8
|
+
Easy deployment on [Firebase](https://firebase.google.com/), plug & play with **[E-Com Plus APIs](https://developers.e-com.plus/)**.
|
|
9
9
|
|
|
10
10
|
## Concepts
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"postinstall": "husky install",
|
|
14
14
|
"build": "turbo run build",
|
|
15
|
-
"
|
|
15
|
+
"test": "turbo run test",
|
|
16
|
+
"release": "pnpm build && pnpm test && standard-version --commit-all",
|
|
16
17
|
"postpublish": "zx scripts/release.mjs --publish"
|
|
17
18
|
},
|
|
18
19
|
"standard-version": {
|
|
@@ -24,18 +25,21 @@
|
|
|
24
25
|
"@commitlint/cli": "^17.0.2",
|
|
25
26
|
"@commitlint/config-conventional": "^17.0.2",
|
|
26
27
|
"@commitlint/rules": "^17.0.0",
|
|
27
|
-
"@types/node": "^17.0.
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
29
|
-
"@typescript-eslint/parser": "^5.
|
|
28
|
+
"@types/node": "^17.0.42",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^5.28.0",
|
|
30
|
+
"@typescript-eslint/parser": "^5.28.0",
|
|
30
31
|
"esbuild": "^0.14.43",
|
|
31
32
|
"eslint": "^8.17.0",
|
|
32
33
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
33
34
|
"eslint-plugin-import": "^2.26.0",
|
|
34
|
-
"eslint-plugin-vue": "^9.1.
|
|
35
|
+
"eslint-plugin-vue": "^9.1.1",
|
|
35
36
|
"husky": "^8.0.1",
|
|
37
|
+
"node-fetch": "^3.2.6",
|
|
36
38
|
"standard-version": "^9.5.0",
|
|
37
39
|
"turbo": "^1.2.16",
|
|
38
40
|
"typescript": "^4.7.3",
|
|
39
|
-
"
|
|
41
|
+
"vite": "^2.9.12",
|
|
42
|
+
"vitest": "^0.15.1",
|
|
43
|
+
"zx": "^6.2.5"
|
|
40
44
|
}
|
|
41
45
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Endpoint, Config, ResponseBody } from './types';
|
|
2
|
+
declare const def: {
|
|
3
|
+
middleware(config: Config): string;
|
|
4
|
+
};
|
|
5
|
+
declare const setMiddleware: (middleware: (config: Config) => string) => void;
|
|
6
|
+
declare const api: {
|
|
7
|
+
<T extends Config>(config: T): Promise<Response & {
|
|
8
|
+
config: Config;
|
|
9
|
+
data: ResponseBody<T>;
|
|
10
|
+
}>;
|
|
11
|
+
get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
|
|
12
|
+
config: Config;
|
|
13
|
+
data: {
|
|
14
|
+
endpoint: E;
|
|
15
|
+
} extends infer T_1 ? T_1 extends {
|
|
16
|
+
endpoint: E;
|
|
17
|
+
} ? T_1 extends Config & {
|
|
18
|
+
method?: "get" | undefined;
|
|
19
|
+
endpoint: `products/${string}`;
|
|
20
|
+
} ? import("./types").Products : T_1 extends Config & {
|
|
21
|
+
method?: "get" | undefined;
|
|
22
|
+
endpoint: `categories/${string}`;
|
|
23
|
+
} ? import("./types").Categories : T_1 extends Config & {
|
|
24
|
+
method?: "get" | undefined;
|
|
25
|
+
endpoint: `brands/${string}`;
|
|
26
|
+
} ? import("./types").Brands : T_1 extends Config & {
|
|
27
|
+
method?: "get" | undefined;
|
|
28
|
+
endpoint: `collections/${string}`;
|
|
29
|
+
} ? import("./types").Collections : T_1 extends Config & {
|
|
30
|
+
method?: "get" | undefined;
|
|
31
|
+
endpoint: `grids/${string}`;
|
|
32
|
+
} ? import("./types").Grids : T_1 extends Config & {
|
|
33
|
+
method?: "get" | undefined;
|
|
34
|
+
endpoint: `carts/${string}`;
|
|
35
|
+
} ? import("./types").Carts : T_1 extends Config & {
|
|
36
|
+
method?: "get" | undefined;
|
|
37
|
+
endpoint: `orders/${string}`;
|
|
38
|
+
} ? import("./types").Orders : T_1 extends Config & {
|
|
39
|
+
method?: "get" | undefined;
|
|
40
|
+
endpoint: `customers/${string}`;
|
|
41
|
+
} ? import("./types").Customers : T_1 extends Config & {
|
|
42
|
+
method?: "get" | undefined;
|
|
43
|
+
endpoint: `stores/${string}`;
|
|
44
|
+
} ? import("./types").Stores : T_1 extends Config & {
|
|
45
|
+
method?: "get" | undefined;
|
|
46
|
+
endpoint: `applications/${string}`;
|
|
47
|
+
} ? import("./types").Applications : any : never : never;
|
|
48
|
+
}>;
|
|
49
|
+
post: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
50
|
+
config: Config;
|
|
51
|
+
data: {
|
|
52
|
+
_id: string & {
|
|
53
|
+
length: 24;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}>;
|
|
57
|
+
put: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
58
|
+
config: Config;
|
|
59
|
+
data: null;
|
|
60
|
+
}>;
|
|
61
|
+
patch: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
62
|
+
config: Config;
|
|
63
|
+
data: null;
|
|
64
|
+
}>;
|
|
65
|
+
del: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
66
|
+
config: Config;
|
|
67
|
+
data: null;
|
|
68
|
+
}>;
|
|
69
|
+
delete: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
70
|
+
config: Config;
|
|
71
|
+
data: null;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
declare type AbstractedConfig = Omit<Config, 'endpoint' | 'method'>;
|
|
75
|
+
declare const get: <E extends Endpoint, C extends AbstractedConfig>(endpoint: E, config?: C | undefined) => Promise<Response & {
|
|
76
|
+
config: Config;
|
|
77
|
+
data: {
|
|
78
|
+
endpoint: E;
|
|
79
|
+
} extends infer T_1 ? T_1 extends {
|
|
80
|
+
endpoint: E;
|
|
81
|
+
} ? T_1 extends Config & {
|
|
82
|
+
method?: "get" | undefined;
|
|
83
|
+
endpoint: `products/${string}`;
|
|
84
|
+
} ? import("./types").Products : T_1 extends Config & {
|
|
85
|
+
method?: "get" | undefined;
|
|
86
|
+
endpoint: `categories/${string}`;
|
|
87
|
+
} ? import("./types").Categories : T_1 extends Config & {
|
|
88
|
+
method?: "get" | undefined;
|
|
89
|
+
endpoint: `brands/${string}`;
|
|
90
|
+
} ? import("./types").Brands : T_1 extends Config & {
|
|
91
|
+
method?: "get" | undefined;
|
|
92
|
+
endpoint: `collections/${string}`;
|
|
93
|
+
} ? import("./types").Collections : T_1 extends Config & {
|
|
94
|
+
method?: "get" | undefined;
|
|
95
|
+
endpoint: `grids/${string}`;
|
|
96
|
+
} ? import("./types").Grids : T_1 extends Config & {
|
|
97
|
+
method?: "get" | undefined;
|
|
98
|
+
endpoint: `carts/${string}`;
|
|
99
|
+
} ? import("./types").Carts : T_1 extends Config & {
|
|
100
|
+
method?: "get" | undefined;
|
|
101
|
+
endpoint: `orders/${string}`;
|
|
102
|
+
} ? import("./types").Orders : T_1 extends Config & {
|
|
103
|
+
method?: "get" | undefined;
|
|
104
|
+
endpoint: `customers/${string}`;
|
|
105
|
+
} ? import("./types").Customers : T_1 extends Config & {
|
|
106
|
+
method?: "get" | undefined;
|
|
107
|
+
endpoint: `stores/${string}`;
|
|
108
|
+
} ? import("./types").Stores : T_1 extends Config & {
|
|
109
|
+
method?: "get" | undefined;
|
|
110
|
+
endpoint: `applications/${string}`;
|
|
111
|
+
} ? import("./types").Applications : any : never : never;
|
|
112
|
+
}>;
|
|
113
|
+
declare const post: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
114
|
+
config: Config;
|
|
115
|
+
data: {
|
|
116
|
+
_id: string & {
|
|
117
|
+
length: 24;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}>;
|
|
121
|
+
declare const put: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
122
|
+
config: Config;
|
|
123
|
+
data: null;
|
|
124
|
+
}>;
|
|
125
|
+
declare const patch: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
126
|
+
config: Config;
|
|
127
|
+
data: null;
|
|
128
|
+
}>;
|
|
129
|
+
declare const del: (endpoint: Endpoint, config?: AbstractedConfig) => Promise<Response & {
|
|
130
|
+
config: Config;
|
|
131
|
+
data: null;
|
|
132
|
+
}>;
|
|
133
|
+
export default api;
|
|
134
|
+
export { setMiddleware, get, post, put, patch, del, };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
const env = (typeof window === 'object' && window)
|
|
3
|
+
|| (typeof process === 'object' && process && process.env)
|
|
4
|
+
|| {};
|
|
5
|
+
const def = {
|
|
6
|
+
middleware(config) {
|
|
7
|
+
let url = config.baseUrl || env.API_BASE_URL || 'https://ecomplus.io/v2';
|
|
8
|
+
const storeId = config.storeId || env.ECOM_STORE_ID;
|
|
9
|
+
if (!storeId) {
|
|
10
|
+
throw new Error('`storeId` must be set in config or `ECOM_STORE_ID` env var');
|
|
11
|
+
}
|
|
12
|
+
url += `/:${storeId}`;
|
|
13
|
+
const lang = config.lang || env.ECOM_LANG;
|
|
14
|
+
if (lang) {
|
|
15
|
+
url += `,lang:${lang}`;
|
|
16
|
+
}
|
|
17
|
+
if (config.params) {
|
|
18
|
+
if (typeof config.params === 'string') {
|
|
19
|
+
url += `?${config.params}`;
|
|
20
|
+
} else {
|
|
21
|
+
// https://github.com/microsoft/TypeScript/issues/32951
|
|
22
|
+
url += `?${new URLSearchParams(config.params)}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return `${url}/${config.endpoint}`;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
// eslint-disable-next-line no-unused-vars
|
|
29
|
+
const setMiddleware = (middleware) => {
|
|
30
|
+
def.middleware = middleware;
|
|
31
|
+
};
|
|
32
|
+
const api = async (config) => {
|
|
33
|
+
const url = def.middleware(config);
|
|
34
|
+
const { method, headers, timeout = 20000 } = config;
|
|
35
|
+
const abortController = new AbortController();
|
|
36
|
+
const timer = setTimeout(() => abortController.abort(), timeout);
|
|
37
|
+
const response = await fetch(url, {
|
|
38
|
+
method,
|
|
39
|
+
headers,
|
|
40
|
+
signal: abortController.signal,
|
|
41
|
+
});
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
if (response.ok) {
|
|
44
|
+
return {
|
|
45
|
+
...response,
|
|
46
|
+
config,
|
|
47
|
+
data: await response.json(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const error = new Error(response.statusText);
|
|
51
|
+
error.config = config;
|
|
52
|
+
error.response = response;
|
|
53
|
+
error.statusCode = response.status;
|
|
54
|
+
throw error;
|
|
55
|
+
};
|
|
56
|
+
const get = (endpoint, config) => api({ ...config, endpoint });
|
|
57
|
+
const post = (endpoint, config) => api({
|
|
58
|
+
...config,
|
|
59
|
+
method: 'post',
|
|
60
|
+
endpoint,
|
|
61
|
+
});
|
|
62
|
+
const put = (endpoint, config) => api({
|
|
63
|
+
...config,
|
|
64
|
+
method: 'put',
|
|
65
|
+
endpoint,
|
|
66
|
+
});
|
|
67
|
+
const patch = (endpoint, config) => api({
|
|
68
|
+
...config,
|
|
69
|
+
method: 'patch',
|
|
70
|
+
endpoint,
|
|
71
|
+
});
|
|
72
|
+
const del = (endpoint, config) => api({
|
|
73
|
+
...config,
|
|
74
|
+
method: 'delete',
|
|
75
|
+
endpoint,
|
|
76
|
+
});
|
|
77
|
+
api.get = get;
|
|
78
|
+
api.post = post;
|
|
79
|
+
api.put = put;
|
|
80
|
+
api.patch = patch;
|
|
81
|
+
api.del = del;
|
|
82
|
+
api.delete = del;
|
|
83
|
+
|
|
84
|
+
export default api;
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
setMiddleware, get, post, put, patch, del,
|
|
88
|
+
};
|
|
89
|
+
// # sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,aAAa;AACb,MAAM,GAAG,GAA8B,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC;OACxE,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;OACvD,EAAE,CAAC;AAER,MAAM,GAAG,GAAG;IACV,UAAU,CAAC,MAAc;QACvB,IAAI,GAAG,GAAG,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,YAAY,IAAI,wBAAwB,CAAC;QACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,aAAa,CAAC;QACpD,IAAI,CAAC,OAAO,E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AAChB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;AACd,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;AAClB,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC;AACd,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;AAEjB,eAAe,GAAG,CAAC;AAEnB,OAAO,EACL,aAAa,EACb,GAAG,EACH,IAAI,EACJ,GAAG,EACH,KAAK,EACL,GAAG,GACJ,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface Applications {
|
|
9
|
+
_id: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
store_id: number;
|
|
13
|
+
/**
|
|
14
|
+
* ID of application on marketplace
|
|
15
|
+
*/
|
|
16
|
+
app_id: number;
|
|
17
|
+
/**
|
|
18
|
+
* The working state of this app in the shop
|
|
19
|
+
*/
|
|
20
|
+
state?: 'inactive' | 'active' | 'test';
|
|
21
|
+
/**
|
|
22
|
+
* App title
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
/**
|
|
26
|
+
* App unique slug on marketplace, only lowercase letters, numbers and hyphen
|
|
27
|
+
*/
|
|
28
|
+
slug?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether this app is paid
|
|
31
|
+
*/
|
|
32
|
+
paid?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Installed application version, semver e.g. 1.0.0
|
|
35
|
+
*/
|
|
36
|
+
version: string;
|
|
37
|
+
/**
|
|
38
|
+
* When app installation was updated, date and time in ISO 8601 standard representation
|
|
39
|
+
*/
|
|
40
|
+
version_date?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Type of app
|
|
43
|
+
*/
|
|
44
|
+
type: 'dashboard' | 'storefront' | 'external';
|
|
45
|
+
/**
|
|
46
|
+
* Modules handled by this app
|
|
47
|
+
*/
|
|
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
|
+
};
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Configuration options for staff on admin dashboard, saved on app data
|
|
143
|
+
*/
|
|
144
|
+
admin_settings?: {
|
|
145
|
+
/**
|
|
146
|
+
* Configuration field object, property name same as saved on data object
|
|
147
|
+
*
|
|
148
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
149
|
+
* via the `patternProperty` "^[a-z0-9_]{2,30}$".
|
|
150
|
+
*/
|
|
151
|
+
[k: string]: {
|
|
152
|
+
/**
|
|
153
|
+
* JSON Schema (https://json-schema.org/specification.html) for field model
|
|
154
|
+
*/
|
|
155
|
+
schema: {
|
|
156
|
+
[k: string]: unknown;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Whether the field value is private, saved in `hidden_data`
|
|
160
|
+
*/
|
|
161
|
+
hide?: boolean;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Link to client side script (JS) to load on storefront
|
|
166
|
+
*/
|
|
167
|
+
storefront_script_uri?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Endpoint that receives POST back with authentication credentials, must be HTTPS
|
|
170
|
+
*/
|
|
171
|
+
auth_callback_uri?: string;
|
|
172
|
+
/**
|
|
173
|
+
* If this app uses authentication, list the needed permissions
|
|
174
|
+
*/
|
|
175
|
+
auth_scope?: {
|
|
176
|
+
/**
|
|
177
|
+
* Special scope to read authentications
|
|
178
|
+
*/
|
|
179
|
+
authentications?: 'GET'[];
|
|
180
|
+
/**
|
|
181
|
+
* Requested resource, cannot be 'applications', 'authentications' or '$update' here
|
|
182
|
+
*
|
|
183
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
184
|
+
* via the `patternProperty` "^([$]?(?!app|aut|upd)([a-z][a-z0-9/_]{1,60}[^/]))$".
|
|
185
|
+
*/
|
|
186
|
+
[k: string]: ('all' | 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE')[];
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Application object data, schema free
|
|
190
|
+
*/
|
|
191
|
+
data?: {
|
|
192
|
+
[k: string]: unknown;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Application private data, available only with authentication
|
|
196
|
+
*/
|
|
197
|
+
hidden_data?: {
|
|
198
|
+
[k: string]: unknown;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Flags to associate additional info
|
|
202
|
+
*/
|
|
203
|
+
flags?: string[];
|
|
204
|
+
/**
|
|
205
|
+
* Optional notes with additional info about this user
|
|
206
|
+
*/
|
|
207
|
+
notes?: string;
|
|
208
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface Authentications {
|
|
9
|
+
_id: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
store_ids: number[];
|
|
13
|
+
/**
|
|
14
|
+
* Simple username for identification, only numbers and lowercase letters
|
|
15
|
+
*/
|
|
16
|
+
username: string;
|
|
17
|
+
/**
|
|
18
|
+
* User language two letter code, sometimes with region, eg.: pt_br, fr, en_us
|
|
19
|
+
*/
|
|
20
|
+
locale?: string;
|
|
21
|
+
/**
|
|
22
|
+
* User email address
|
|
23
|
+
*/
|
|
24
|
+
email?: string;
|
|
25
|
+
/**
|
|
26
|
+
* User full name
|
|
27
|
+
*/
|
|
28
|
+
name?: string;
|
|
29
|
+
/**
|
|
30
|
+
* User phone number
|
|
31
|
+
*/
|
|
32
|
+
phone?: string;
|
|
33
|
+
/**
|
|
34
|
+
* MD5 hash generated with the user's password
|
|
35
|
+
*/
|
|
36
|
+
pass_md5_hash?: string;
|
|
37
|
+
/**
|
|
38
|
+
* API key as a random 128 bytes hexadecimal number
|
|
39
|
+
*/
|
|
40
|
+
api_key?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Collection of resources allowed to user, each resource uri as object property
|
|
43
|
+
*/
|
|
44
|
+
permissions?: {
|
|
45
|
+
/**
|
|
46
|
+
* Resource/Subresources/Third-level/ID
|
|
47
|
+
*
|
|
48
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
49
|
+
* via the `patternProperty` "^(([^/_][a-z0-9/_@:$+]{1,60}[^/])|[*])$".
|
|
50
|
+
*/
|
|
51
|
+
[k: string]: ('all' | 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE')[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* List of dashboard cards chosen by user
|
|
55
|
+
*/
|
|
56
|
+
panel_cards?: {
|
|
57
|
+
/**
|
|
58
|
+
* Unique identifier, card name using only lowercase, numbers and underscore
|
|
59
|
+
*/
|
|
60
|
+
card_id: string;
|
|
61
|
+
/**
|
|
62
|
+
* Card title
|
|
63
|
+
*/
|
|
64
|
+
title?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Card text, usually a brief description
|
|
67
|
+
*/
|
|
68
|
+
paragraph?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Custom card calling MongoDB aggregate
|
|
71
|
+
*/
|
|
72
|
+
custom_aggregation?: {
|
|
73
|
+
/**
|
|
74
|
+
* API resource
|
|
75
|
+
*/
|
|
76
|
+
resource: 'products' | 'categories' | 'brands' | 'collections' | 'grids' | 'customers' | 'carts' | 'orders';
|
|
77
|
+
/**
|
|
78
|
+
* Aggregation pipeline
|
|
79
|
+
*/
|
|
80
|
+
pipeline: {
|
|
81
|
+
[k: string]: unknown;
|
|
82
|
+
}[];
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
/**
|
|
86
|
+
* Whether the user is able to use builder and file manager to edit storefront
|
|
87
|
+
*/
|
|
88
|
+
edit_storefront?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Flags to associate additional info
|
|
91
|
+
*/
|
|
92
|
+
flags?: string[];
|
|
93
|
+
/**
|
|
94
|
+
* Optional notes with additional info about this user
|
|
95
|
+
*/
|
|
96
|
+
notes?: string;
|
|
97
|
+
}
|