@cloudcommerce/api 0.0.2 → 0.0.3
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/.turbo/turbo-build.log +6 -3
- package/.turbo/turbo-test.log +5 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +42 -24
- package/dist/index.js.map +1 -1
- package/dist/types/applications.d.ts +208 -0
- package/dist/types/authentications.d.ts +97 -0
- package/dist/types/brands.d.ts +148 -0
- package/dist/types/carts.d.ts +292 -0
- package/dist/types/categories.d.ts +190 -0
- package/dist/types/collections.d.ts +151 -0
- package/dist/types/customers.d.ts +495 -0
- package/dist/types/grids.d.ts +149 -0
- package/dist/types/orders.d.ts +1588 -0
- package/dist/types/procedures.d.ts +139 -0
- package/dist/types/products.d.ts +1284 -0
- package/dist/types/stores.d.ts +120 -0
- package/dist/types/triggers.d.ts +79 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +4 -2
- package/scripts/build.mjs +5 -0
- package/src/index.ts +46 -55
- package/src/types/applications.d.ts +208 -0
- package/src/types/authentications.d.ts +97 -0
- package/src/types/brands.d.ts +148 -0
- package/src/types/carts.d.ts +292 -0
- package/src/types/categories.d.ts +190 -0
- package/src/types/collections.d.ts +151 -0
- package/src/types/customers.d.ts +495 -0
- package/src/types/grids.d.ts +149 -0
- package/src/types/orders.d.ts +1588 -0
- package/src/types/procedures.d.ts +139 -0
- package/src/types/products.d.ts +1284 -0
- package/src/types/stores.d.ts +120 -0
- package/src/types/triggers.d.ts +79 -0
- package/src/types.ts +74 -0
- package/tests/types.test.ts +13 -0
- package/tsconfig.json +0 -101
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
@cloudcommerce/api:build: cache hit, replaying output [
|
|
1
|
+
@cloudcommerce/api:build: cache hit, replaying output [2mc6ecc3b3745374a3[0m
|
|
2
2
|
[35m@cloudcommerce/api:build: [0m
|
|
3
|
-
[35m@cloudcommerce/api:build: [0m> @cloudcommerce/api@0.0.2
|
|
4
|
-
[35m@cloudcommerce/api:build: [0m>
|
|
3
|
+
[35m@cloudcommerce/api:build: [0m> @cloudcommerce/api@0.0.2 build /home/leo/code/ecomplus/cloud-commerce/packages/api
|
|
4
|
+
[35m@cloudcommerce/api:build: [0m> zx scripts/build.mjs
|
|
5
5
|
[35m@cloudcommerce/api:build: [0m
|
|
6
|
+
[35m@cloudcommerce/api:build: [0m$ rm -rf dist
|
|
7
|
+
[35m@cloudcommerce/api:build: [0m$ tsc -p ../../tsconfig.json --outDir dist --declaration
|
|
8
|
+
[35m@cloudcommerce/api:build: [0m$ cp -r src/types dist/
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
@cloudcommerce/api:test: cache hit, replaying output [2m8753ebb5d2a206b8[0m
|
|
2
|
+
[33m@cloudcommerce/api:test: [0m
|
|
3
|
+
[33m@cloudcommerce/api:test: [0m> @cloudcommerce/api@0.0.2 test /home/leo/code/ecomplus/cloud-commerce/packages/api
|
|
4
|
+
[33m@cloudcommerce/api:test: [0m> tsc --noEmit --noImplicitAny
|
|
5
|
+
[33m@cloudcommerce/api:test: [0m
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
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 callApi: {
|
|
7
|
+
<T extends Config>(config: T): Promise<Response & {
|
|
8
|
+
config: Config;
|
|
9
|
+
data: ResponseBody<T>;
|
|
10
|
+
}>;
|
|
11
|
+
get: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
12
|
+
config: Config;
|
|
13
|
+
data: any;
|
|
14
|
+
}>;
|
|
15
|
+
post: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
16
|
+
config: Config;
|
|
17
|
+
data: {
|
|
18
|
+
_id: string & {
|
|
19
|
+
length: 24;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
put: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
24
|
+
config: Config;
|
|
25
|
+
data: null;
|
|
26
|
+
}>;
|
|
27
|
+
patch: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
28
|
+
config: Config;
|
|
29
|
+
data: null;
|
|
30
|
+
}>;
|
|
31
|
+
del: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
32
|
+
config: Config;
|
|
33
|
+
data: null;
|
|
34
|
+
}>;
|
|
35
|
+
delete: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
36
|
+
config: Config;
|
|
37
|
+
data: null;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
declare const get: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
41
|
+
config: Config;
|
|
42
|
+
data: any;
|
|
43
|
+
}>;
|
|
44
|
+
declare const post: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
45
|
+
config: Config;
|
|
46
|
+
data: {
|
|
47
|
+
_id: string & {
|
|
48
|
+
length: 24;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
declare const put: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
53
|
+
config: Config;
|
|
54
|
+
data: null;
|
|
55
|
+
}>;
|
|
56
|
+
declare const patch: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
57
|
+
config: Config;
|
|
58
|
+
data: null;
|
|
59
|
+
}>;
|
|
60
|
+
declare const del: (endpoint: Endpoint, config: Exclude<Config, 'method'>) => Promise<Response & {
|
|
61
|
+
config: Config;
|
|
62
|
+
data: null;
|
|
63
|
+
}>;
|
|
64
|
+
export default callApi;
|
|
65
|
+
export { setMiddleware, get, post, put, patch, del, };
|
package/dist/index.js
CHANGED
|
@@ -3,62 +3,80 @@ const env = (typeof window === 'object' && window)
|
|
|
3
3
|
|| (typeof process === 'object' && process && process.env)
|
|
4
4
|
|| {};
|
|
5
5
|
const def = {
|
|
6
|
-
middleware(
|
|
7
|
-
let url =
|
|
6
|
+
middleware(config) {
|
|
7
|
+
let url = config.baseUrl || env.API_BASE_URL || 'https://ecomplus.io/v2';
|
|
8
8
|
if (!url) {
|
|
9
|
-
const storeId =
|
|
9
|
+
const storeId = config.storeId || env.ECOM_STORE_ID;
|
|
10
10
|
if (!storeId) {
|
|
11
|
-
throw new Error('`storeId` must be set in
|
|
11
|
+
throw new Error('`storeId` must be set in config or `ECOM_STORE_ID` env var');
|
|
12
12
|
}
|
|
13
13
|
url += `/:${storeId}`;
|
|
14
|
-
const lang =
|
|
14
|
+
const lang = config.lang || env.ECOM_LANG;
|
|
15
15
|
if (lang) {
|
|
16
16
|
url += `,lang:${lang}`;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
if (
|
|
20
|
-
if (typeof
|
|
21
|
-
url += `?${
|
|
19
|
+
if (config.params) {
|
|
20
|
+
if (typeof config.params === 'string') {
|
|
21
|
+
url += `?${config.params}`;
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
// https://github.com/microsoft/TypeScript/issues/32951
|
|
25
|
-
url += `?${new URLSearchParams(
|
|
25
|
+
url += `?${new URLSearchParams(config.params)}`;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
return `${url}/${
|
|
28
|
+
return `${url}/${config.endpoint}`;
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
// eslint-disable-next-line no-unused-vars
|
|
32
32
|
const setMiddleware = (middleware) => {
|
|
33
33
|
def.middleware = middleware;
|
|
34
34
|
};
|
|
35
|
-
const callApi = (
|
|
36
|
-
const url = def.middleware(
|
|
37
|
-
const { method, headers } =
|
|
38
|
-
|
|
35
|
+
const callApi = async (config) => {
|
|
36
|
+
const url = def.middleware(config);
|
|
37
|
+
const { method, headers, timeout = 20000 } = config;
|
|
38
|
+
const abortController = new AbortController();
|
|
39
|
+
const timer = setTimeout(() => abortController.abort(), timeout);
|
|
40
|
+
const response = await fetch(url, {
|
|
41
|
+
method,
|
|
42
|
+
headers,
|
|
43
|
+
signal: abortController.signal,
|
|
44
|
+
});
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
if (response.ok) {
|
|
47
|
+
return {
|
|
48
|
+
...response,
|
|
49
|
+
config,
|
|
50
|
+
data: await response.json(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const error = new Error(response.statusText);
|
|
54
|
+
error.config = config;
|
|
55
|
+
error.response = response;
|
|
56
|
+
throw error;
|
|
39
57
|
};
|
|
40
|
-
const get = (endpoint,
|
|
41
|
-
...
|
|
58
|
+
const get = (endpoint, config) => callApi({
|
|
59
|
+
...config,
|
|
42
60
|
method: 'get',
|
|
43
61
|
endpoint,
|
|
44
62
|
});
|
|
45
|
-
const post = (endpoint,
|
|
46
|
-
...
|
|
63
|
+
const post = (endpoint, config) => callApi({
|
|
64
|
+
...config,
|
|
47
65
|
method: 'post',
|
|
48
66
|
endpoint,
|
|
49
67
|
});
|
|
50
|
-
const put = (endpoint,
|
|
51
|
-
...
|
|
68
|
+
const put = (endpoint, config) => callApi({
|
|
69
|
+
...config,
|
|
52
70
|
method: 'put',
|
|
53
71
|
endpoint,
|
|
54
72
|
});
|
|
55
|
-
const patch = (endpoint,
|
|
56
|
-
...
|
|
73
|
+
const patch = (endpoint, config) => callApi({
|
|
74
|
+
...config,
|
|
57
75
|
method: 'patch',
|
|
58
76
|
endpoint,
|
|
59
77
|
});
|
|
60
|
-
const del = (endpoint,
|
|
61
|
-
...
|
|
78
|
+
const del = (endpoint, config) => callApi({
|
|
79
|
+
...config,
|
|
62
80
|
method: 'delete',
|
|
63
81
|
endpoint,
|
|
64
82
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 Brands {
|
|
9
|
+
_id: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
store_id: number;
|
|
13
|
+
channel_ids?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Brand full name
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Slug to complete page URL, starting with number or lowercase letter
|
|
20
|
+
*/
|
|
21
|
+
slug?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Short brand description in plain text
|
|
24
|
+
*/
|
|
25
|
+
short_description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Full brand description, may use HTML tags
|
|
28
|
+
*/
|
|
29
|
+
body_html?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Full brand description, plain text only
|
|
32
|
+
*/
|
|
33
|
+
body_text?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Title tag for page SEO
|
|
36
|
+
*/
|
|
37
|
+
meta_title?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Meta description tag for page SEO
|
|
40
|
+
*/
|
|
41
|
+
meta_description?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Text translations for internationalization
|
|
44
|
+
*/
|
|
45
|
+
i18n?: {
|
|
46
|
+
/**
|
|
47
|
+
* Language specific text fields
|
|
48
|
+
*
|
|
49
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
50
|
+
* via the `patternProperty` "^[a-z]{2}(_[a-z]{2})?$".
|
|
51
|
+
*/
|
|
52
|
+
[k: string]: {
|
|
53
|
+
/**
|
|
54
|
+
* Brand full name
|
|
55
|
+
*/
|
|
56
|
+
name?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Short brand description in plain text
|
|
59
|
+
*/
|
|
60
|
+
short_description?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Full brand description, may use HTML tags
|
|
63
|
+
*/
|
|
64
|
+
body_html?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Full brand description, plain text only
|
|
67
|
+
*/
|
|
68
|
+
body_text?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Title tag for page SEO
|
|
71
|
+
*/
|
|
72
|
+
meta_title?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Meta description tag for page SEO
|
|
75
|
+
*/
|
|
76
|
+
meta_description?: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Brand logo
|
|
81
|
+
*/
|
|
82
|
+
logo?: {
|
|
83
|
+
/**
|
|
84
|
+
* Image link
|
|
85
|
+
*/
|
|
86
|
+
url: string;
|
|
87
|
+
/**
|
|
88
|
+
* Image size (width x height) in px, such as 100x50 (100px width, 50px height)
|
|
89
|
+
*/
|
|
90
|
+
size?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Alternative text, HTML alt tag (important for SEO)
|
|
93
|
+
*/
|
|
94
|
+
alt?: string;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* List of brand images
|
|
98
|
+
*/
|
|
99
|
+
pictures?: {
|
|
100
|
+
/**
|
|
101
|
+
* Picture ID (ObjectID) [auto]
|
|
102
|
+
*/
|
|
103
|
+
_id?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Tag to identify object, use only lowercase letters, digits and underscore
|
|
106
|
+
*/
|
|
107
|
+
tag?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Image link
|
|
110
|
+
*/
|
|
111
|
+
url: string;
|
|
112
|
+
/**
|
|
113
|
+
* Image size (width x height) in px, such as 100x50 (100px width, 50px height)
|
|
114
|
+
*/
|
|
115
|
+
size?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Alternative text, HTML alt tag (important for SEO)
|
|
118
|
+
*/
|
|
119
|
+
alt?: string;
|
|
120
|
+
}[];
|
|
121
|
+
/**
|
|
122
|
+
* List of custom attributes
|
|
123
|
+
*/
|
|
124
|
+
metafields?: {
|
|
125
|
+
/**
|
|
126
|
+
* String to help distinguish who (or which app) created and can use the metafield
|
|
127
|
+
*/
|
|
128
|
+
namespace?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Field name
|
|
131
|
+
*/
|
|
132
|
+
field?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Custom property value
|
|
135
|
+
*/
|
|
136
|
+
value: {
|
|
137
|
+
[k: string]: unknown;
|
|
138
|
+
};
|
|
139
|
+
}[];
|
|
140
|
+
/**
|
|
141
|
+
* Flags to associate additional info
|
|
142
|
+
*/
|
|
143
|
+
flags?: string[];
|
|
144
|
+
/**
|
|
145
|
+
* Optional notes with additional info about this brand
|
|
146
|
+
*/
|
|
147
|
+
notes?: string;
|
|
148
|
+
}
|