cloudcommerce 0.0.3 → 0.0.6

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 (42) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/package.json +5 -2
  3. package/packages/api/lib/index.d.ts +134 -0
  4. package/packages/api/lib/index.js +100 -0
  5. package/packages/api/lib/index.js.map +1 -0
  6. package/packages/api/{dist → lib}/types/applications.d.ts +0 -0
  7. package/packages/api/{dist → lib}/types/authentications.d.ts +0 -0
  8. package/packages/api/{dist → lib}/types/brands.d.ts +0 -0
  9. package/packages/api/{dist → lib}/types/carts.d.ts +0 -0
  10. package/packages/api/{dist → lib}/types/categories.d.ts +0 -0
  11. package/packages/api/{dist → lib}/types/collections.d.ts +0 -0
  12. package/packages/api/{dist → lib}/types/customers.d.ts +0 -0
  13. package/packages/api/{dist → lib}/types/grids.d.ts +0 -0
  14. package/packages/api/{dist → lib}/types/orders.d.ts +0 -0
  15. package/packages/api/{dist → lib}/types/products.d.ts +0 -0
  16. package/packages/api/{dist → lib}/types/stores.d.ts +0 -0
  17. package/packages/api/{dist → lib}/types.d.ts +7 -32
  18. package/packages/api/lib/types.js +2 -0
  19. package/packages/api/{dist → lib}/types.js.map +0 -0
  20. package/packages/api/package.json +5 -5
  21. package/packages/api/scripts/build.sh +6 -0
  22. package/packages/api/src/index.ts +45 -28
  23. package/packages/api/src/types.ts +14 -11
  24. package/packages/api/tests/fetch-polyfill.js +21 -0
  25. package/packages/api/tests/index.test.ts +30 -0
  26. package/packages/api/tsconfig.json +6 -0
  27. package/packages/apps/discounts/package.json +1 -1
  28. package/packages/storefront/package.json +3 -2
  29. package/tsconfig.json +2 -1
  30. package/tsconfig.test.json +11 -0
  31. package/turbo.json +6 -1
  32. package/vite.config.ts +12 -0
  33. package/packages/api/dist/index.d.ts +0 -65
  34. package/packages/api/dist/index.js +0 -91
  35. package/packages/api/dist/index.js.map +0 -1
  36. package/packages/api/dist/types/procedures.d.ts +0 -139
  37. package/packages/api/dist/types/triggers.d.ts +0 -79
  38. package/packages/api/dist/types.js +0 -2
  39. package/packages/api/scripts/build.mjs +0 -5
  40. package/packages/api/src/types/procedures.d.ts +0 -139
  41. package/packages/api/src/types/triggers.d.ts +0 -79
  42. package/packages/api/tests/types.test.ts +0 -13
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
5
5
  "main": "functions/dist/index.js",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -18,6 +18,7 @@
18
18
  "build": "echo '@ecomplus/storefront'"
19
19
  },
20
20
  "dependencies": {
21
- "@cloudcommerce/api": "workspace:*"
21
+ "@cloudcommerce/api": "workspace:*",
22
+ "astro": "1.0.0-beta.46"
22
23
  }
23
24
  }
package/tsconfig.json CHANGED
@@ -99,8 +99,9 @@
99
99
  "skipLibCheck": true /* Skip type checking all .d.ts files. */
100
100
  },
101
101
  "exclude": [
102
- "**/dist/**",
103
102
  "**/node_modules/**",
103
+ "**/dist/**",
104
+ "**/scripts/**",
104
105
  "**/tests/**"
105
106
  ]
106
107
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ },
6
+ "include": [
7
+ "packages/*/tests/**/*.ts"
8
+ ],
9
+ "exclude": [
10
+ ]
11
+ }
package/turbo.json CHANGED
@@ -13,5 +13,10 @@
13
13
  "test": {
14
14
  "outputs": []
15
15
  }
16
- }
16
+ },
17
+ "globalDependencies": [
18
+ ".env",
19
+ "tsconfig.json",
20
+ "vite.config.ts"
21
+ ]
17
22
  }
package/vite.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ /// <reference types="vitest" />
3
+ // Configure Vitest (https://vitest.dev/config/)
4
+
5
+ import { defineConfig } from 'vite';
6
+
7
+ export default defineConfig({
8
+ test: {
9
+ globals: true,
10
+ reporters: 'verbose',
11
+ },
12
+ });
@@ -1,65 +0,0 @@
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, };
@@ -1,91 +0,0 @@
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
- if (!url) {
9
- const storeId = config.storeId || env.ECOM_STORE_ID;
10
- if (!storeId) {
11
- throw new Error('`storeId` must be set in config or `ECOM_STORE_ID` env var');
12
- }
13
- url += `/:${storeId}`;
14
- const lang = config.lang || env.ECOM_LANG;
15
- if (lang) {
16
- url += `,lang:${lang}`;
17
- }
18
- }
19
- if (config.params) {
20
- if (typeof config.params === 'string') {
21
- url += `?${config.params}`;
22
- }
23
- else {
24
- // https://github.com/microsoft/TypeScript/issues/32951
25
- url += `?${new URLSearchParams(config.params)}`;
26
- }
27
- }
28
- return `${url}/${config.endpoint}`;
29
- },
30
- };
31
- // eslint-disable-next-line no-unused-vars
32
- const setMiddleware = (middleware) => {
33
- def.middleware = middleware;
34
- };
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;
57
- };
58
- const get = (endpoint, config) => callApi({
59
- ...config,
60
- method: 'get',
61
- endpoint,
62
- });
63
- const post = (endpoint, config) => callApi({
64
- ...config,
65
- method: 'post',
66
- endpoint,
67
- });
68
- const put = (endpoint, config) => callApi({
69
- ...config,
70
- method: 'put',
71
- endpoint,
72
- });
73
- const patch = (endpoint, config) => callApi({
74
- ...config,
75
- method: 'patch',
76
- endpoint,
77
- });
78
- const del = (endpoint, config) => callApi({
79
- ...config,
80
- method: 'delete',
81
- endpoint,
82
- });
83
- callApi.get = get;
84
- callApi.post = post;
85
- callApi.put = put;
86
- callApi.patch = patch;
87
- callApi.del = del;
88
- callApi.delete = del;
89
- export default callApi;
90
- export { setMiddleware, get, post, put, patch, del, };
91
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,aAAa,CAAC;YACpD,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;aAC/E;YACD,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,SAAS,CAAC;YAC1C,IAAI,IAAI,EAAE;gBACR,GAAG,IAAI,SAAS,IAAI,EAAE,CAAC;aACxB;SACF;QACD,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,IAAI,OAAO,MAAM,CAAC,MAA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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
- /**
9
- * Procedure object model
10
- */
11
- export interface Procedures {
12
- _id: string;
13
- created_at: string;
14
- updated_at: string;
15
- store_id: number;
16
- /**
17
- * Procedure title
18
- */
19
- title: string;
20
- /**
21
- * Short procedure description in plain text
22
- */
23
- short_description?: string;
24
- /**
25
- * List of events that call this procedure
26
- */
27
- triggers: {
28
- /**
29
- * Method (HTTP verb) of the event, if undefined will match any method
30
- */
31
- method?: 'POST' | 'PATCH' | 'PUT' | 'DELETE';
32
- /**
33
- * Type of action taken, if undefined will match any action
34
- */
35
- action?: 'create' | 'change' | 'delete';
36
- /**
37
- * API resource
38
- */
39
- resource:
40
- | 'authentications'
41
- | 'products'
42
- | 'categories'
43
- | 'brands'
44
- | 'collections'
45
- | 'grids'
46
- | 'customers'
47
- | 'carts'
48
- | 'orders'
49
- | 'applications'
50
- | 'stores';
51
- /**
52
- * Resource ID, if specified
53
- */
54
- resource_id?: string;
55
- /**
56
- * Subresource slug (URL path), use wildcard `*` to match either none or any subresource
57
- */
58
- subresource?: string | null;
59
- /**
60
- * Subresource ID, if specified
61
- */
62
- subresource_id?: string;
63
- /**
64
- * Property created or updated with the event, if undefined will match any fields
65
- */
66
- field?: string;
67
- }[];
68
- /**
69
- * List of notifications to be sent when this procedure is called. In some properties you can use variables from trigger object with (tr.*) notation, eg.: (tr.body.name)
70
- */
71
- webhooks: {
72
- /**
73
- * API where notification should be sent
74
- */
75
- api: {
76
- /**
77
- * Use this property if webhook is to store API (api.e-com.plus)
78
- */
79
- store_api?: {
80
- /**
81
- * API endpoint, such as /products.json, you can also include variables
82
- */
83
- endpoint?: string;
84
- /**
85
- * API version
86
- */
87
- version?: 'v1' | 'current';
88
- };
89
- /**
90
- * Use this property if webhook is to any external API (not api.e-com.plus)
91
- */
92
- external_api?: {
93
- /**
94
- * Full URL to external API endpoint, you can also use variables here
95
- */
96
- uri: string;
97
- /**
98
- * List of headers to be sent on the request
99
- */
100
- headers?: {
101
- /**
102
- * Header field name, eg.: X-Access-Token
103
- */
104
- name: string;
105
- /**
106
- * Header field value, you can also use variables here
107
- */
108
- value: string;
109
- }[];
110
- };
111
- };
112
- /**
113
- * Method (HTTP verb) to send request
114
- */
115
- method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
116
- /**
117
- * Send body on notification, if true and map_body undefined, trigger object will be sent
118
- */
119
- send_body?: boolean;
120
- /**
121
- * Object to send, it is possible to use variables as properties values
122
- */
123
- map_body?: {
124
- [k: string]: unknown;
125
- };
126
- }[];
127
- /**
128
- * Tag to identify object, use only lowercase letters, digits and underscore
129
- */
130
- tag?: string;
131
- /**
132
- * Flags to associate additional info
133
- */
134
- flags?: string[];
135
- /**
136
- * Optional notes with additional info about this procedure
137
- */
138
- notes?: string;
139
- }
@@ -1,79 +0,0 @@
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
- /**
9
- * Trigger object model
10
- */
11
- export interface Triggers {
12
- _id: string;
13
- created_at: string;
14
- updated_at: string;
15
- store_id: number;
16
- /**
17
- * When event occurred, date and time in ISO 8601 standard representation
18
- */
19
- datetime: string;
20
- /**
21
- * ID of used authentication, should be a valid hexadecimal
22
- */
23
- authentication_id?: string | null;
24
- /**
25
- * Method (HTTP verb) of the event
26
- */
27
- method: 'POST' | 'PATCH' | 'PUT' | 'DELETE';
28
- /**
29
- * Type of action taken
30
- */
31
- action: 'create' | 'change' | 'delete';
32
- /**
33
- * API resource
34
- */
35
- resource:
36
- | 'authentications'
37
- | 'products'
38
- | 'categories'
39
- | 'brands'
40
- | 'collections'
41
- | 'grids'
42
- | 'customers'
43
- | 'carts'
44
- | 'orders'
45
- | 'applications'
46
- | 'stores';
47
- /**
48
- * Resource ID, if specified
49
- */
50
- resource_id?: string;
51
- /**
52
- * Subresource slug (which appears in the URL), if specified
53
- */
54
- subresource?: string;
55
- /**
56
- * Subresource ID, if specified
57
- */
58
- subresource_id?: string;
59
- /**
60
- * Document fields involved (created or updated) with the event
61
- */
62
- fields?: string[];
63
- /**
64
- * Unique ID of created object, only for POST method
65
- */
66
- inserted_id?: string;
67
- /**
68
- * Request body, limitations: https://docs.mongodb.com/manual/reference/limits/#bson-documents
69
- */
70
- body?: {
71
- [k: string]: unknown;
72
- };
73
- /**
74
- * Response received, limits: https://docs.mongodb.com/manual/reference/limits/#bson-documents
75
- */
76
- response?: {
77
- [k: string]: unknown;
78
- };
79
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1,5 +0,0 @@
1
- /* global $ */
2
-
3
- await $`rm -rf dist`;
4
- await $`tsc -p ../../tsconfig.json --outDir dist --declaration`;
5
- await $`cp -r src/types dist/`;
@@ -1,139 +0,0 @@
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
- /**
9
- * Procedure object model
10
- */
11
- export interface Procedures {
12
- _id: string;
13
- created_at: string;
14
- updated_at: string;
15
- store_id: number;
16
- /**
17
- * Procedure title
18
- */
19
- title: string;
20
- /**
21
- * Short procedure description in plain text
22
- */
23
- short_description?: string;
24
- /**
25
- * List of events that call this procedure
26
- */
27
- triggers: {
28
- /**
29
- * Method (HTTP verb) of the event, if undefined will match any method
30
- */
31
- method?: 'POST' | 'PATCH' | 'PUT' | 'DELETE';
32
- /**
33
- * Type of action taken, if undefined will match any action
34
- */
35
- action?: 'create' | 'change' | 'delete';
36
- /**
37
- * API resource
38
- */
39
- resource:
40
- | 'authentications'
41
- | 'products'
42
- | 'categories'
43
- | 'brands'
44
- | 'collections'
45
- | 'grids'
46
- | 'customers'
47
- | 'carts'
48
- | 'orders'
49
- | 'applications'
50
- | 'stores';
51
- /**
52
- * Resource ID, if specified
53
- */
54
- resource_id?: string;
55
- /**
56
- * Subresource slug (URL path), use wildcard `*` to match either none or any subresource
57
- */
58
- subresource?: string | null;
59
- /**
60
- * Subresource ID, if specified
61
- */
62
- subresource_id?: string;
63
- /**
64
- * Property created or updated with the event, if undefined will match any fields
65
- */
66
- field?: string;
67
- }[];
68
- /**
69
- * List of notifications to be sent when this procedure is called. In some properties you can use variables from trigger object with (tr.*) notation, eg.: (tr.body.name)
70
- */
71
- webhooks: {
72
- /**
73
- * API where notification should be sent
74
- */
75
- api: {
76
- /**
77
- * Use this property if webhook is to store API (api.e-com.plus)
78
- */
79
- store_api?: {
80
- /**
81
- * API endpoint, such as /products.json, you can also include variables
82
- */
83
- endpoint?: string;
84
- /**
85
- * API version
86
- */
87
- version?: 'v1' | 'current';
88
- };
89
- /**
90
- * Use this property if webhook is to any external API (not api.e-com.plus)
91
- */
92
- external_api?: {
93
- /**
94
- * Full URL to external API endpoint, you can also use variables here
95
- */
96
- uri: string;
97
- /**
98
- * List of headers to be sent on the request
99
- */
100
- headers?: {
101
- /**
102
- * Header field name, eg.: X-Access-Token
103
- */
104
- name: string;
105
- /**
106
- * Header field value, you can also use variables here
107
- */
108
- value: string;
109
- }[];
110
- };
111
- };
112
- /**
113
- * Method (HTTP verb) to send request
114
- */
115
- method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
116
- /**
117
- * Send body on notification, if true and map_body undefined, trigger object will be sent
118
- */
119
- send_body?: boolean;
120
- /**
121
- * Object to send, it is possible to use variables as properties values
122
- */
123
- map_body?: {
124
- [k: string]: unknown;
125
- };
126
- }[];
127
- /**
128
- * Tag to identify object, use only lowercase letters, digits and underscore
129
- */
130
- tag?: string;
131
- /**
132
- * Flags to associate additional info
133
- */
134
- flags?: string[];
135
- /**
136
- * Optional notes with additional info about this procedure
137
- */
138
- notes?: string;
139
- }
@@ -1,79 +0,0 @@
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
- /**
9
- * Trigger object model
10
- */
11
- export interface Triggers {
12
- _id: string;
13
- created_at: string;
14
- updated_at: string;
15
- store_id: number;
16
- /**
17
- * When event occurred, date and time in ISO 8601 standard representation
18
- */
19
- datetime: string;
20
- /**
21
- * ID of used authentication, should be a valid hexadecimal
22
- */
23
- authentication_id?: string | null;
24
- /**
25
- * Method (HTTP verb) of the event
26
- */
27
- method: 'POST' | 'PATCH' | 'PUT' | 'DELETE';
28
- /**
29
- * Type of action taken
30
- */
31
- action: 'create' | 'change' | 'delete';
32
- /**
33
- * API resource
34
- */
35
- resource:
36
- | 'authentications'
37
- | 'products'
38
- | 'categories'
39
- | 'brands'
40
- | 'collections'
41
- | 'grids'
42
- | 'customers'
43
- | 'carts'
44
- | 'orders'
45
- | 'applications'
46
- | 'stores';
47
- /**
48
- * Resource ID, if specified
49
- */
50
- resource_id?: string;
51
- /**
52
- * Subresource slug (which appears in the URL), if specified
53
- */
54
- subresource?: string;
55
- /**
56
- * Subresource ID, if specified
57
- */
58
- subresource_id?: string;
59
- /**
60
- * Document fields involved (created or updated) with the event
61
- */
62
- fields?: string[];
63
- /**
64
- * Unique ID of created object, only for POST method
65
- */
66
- inserted_id?: string;
67
- /**
68
- * Request body, limitations: https://docs.mongodb.com/manual/reference/limits/#bson-documents
69
- */
70
- body?: {
71
- [k: string]: unknown;
72
- };
73
- /**
74
- * Response received, limits: https://docs.mongodb.com/manual/reference/limits/#bson-documents
75
- */
76
- response?: {
77
- [k: string]: unknown;
78
- };
79
- }