cloudcommerce 0.0.3 → 0.0.4
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 +8 -0
- package/package.json +3 -1
- package/packages/api/dist/index.d.ts +0 -0
- package/packages/api/dist/index.js +8 -10
- package/packages/api/dist/index.js.map +1 -1
- package/packages/api/dist/types/applications.d.ts +0 -0
- package/packages/api/dist/types/authentications.d.ts +0 -0
- package/packages/api/dist/types/brands.d.ts +0 -0
- package/packages/api/dist/types/carts.d.ts +0 -0
- package/packages/api/dist/types/categories.d.ts +0 -0
- package/packages/api/dist/types/collections.d.ts +0 -0
- package/packages/api/dist/types/customers.d.ts +0 -0
- package/packages/api/dist/types/grids.d.ts +0 -0
- package/packages/api/dist/types/orders.d.ts +0 -0
- package/packages/api/dist/types/products.d.ts +0 -0
- package/packages/api/dist/types/stores.d.ts +0 -0
- package/packages/api/dist/types.d.ts +0 -0
- package/packages/api/dist/types.js +0 -0
- package/packages/api/dist/types.js.map +0 -0
- package/packages/api/package.json +2 -2
- package/packages/api/scripts/test.mjs +4 -0
- package/packages/api/src/index.ts +8 -10
- package/packages/api/tests/fetch-polyfill.js +21 -0
- package/packages/api/tests/index.test.ts +14 -0
- package/packages/apps/discounts/package.json +1 -1
- package/packages/storefront/package.json +1 -1
- package/tsconfig.test.json +106 -0
- package/packages/api/dist/types/procedures.d.ts +0 -139
- package/packages/api/dist/types/triggers.d.ts +0 -79
- package/packages/api/src/types/procedures.d.ts +0 -139
- package/packages/api/src/types/triggers.d.ts +0 -79
- package/packages/api/tests/types.test.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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.4](https://github.com/ecomplus/cloud-commerce/compare/v0.0.3...v0.0.4) (2022-06-15)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **api:** Fix adding `:storeId` to default API base URL ([d424760](https://github.com/ecomplus/cloud-commerce/commit/d4247602168078acc0b05f5d1bbf5980f636bd71))
|
|
11
|
+
* **api:** No `procedures` and `triggers` resources on Store API v2 (remove from default types) ([66281d4](https://github.com/ecomplus/cloud-commerce/commit/66281d41f25a707fabda2233d2404724ba6b53f4))
|
|
12
|
+
|
|
5
13
|
### [0.0.3](https://github.com/ecomplus/cloud-commerce/compare/v0.0.2...v0.0.3) (2022-06-14)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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>",
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
"eslint-plugin-import": "^2.26.0",
|
|
35
35
|
"eslint-plugin-vue": "^9.1.1",
|
|
36
36
|
"husky": "^8.0.1",
|
|
37
|
+
"node-fetch": "^3.2.6",
|
|
37
38
|
"standard-version": "^9.5.0",
|
|
39
|
+
"tsx": "^3.4.2",
|
|
38
40
|
"turbo": "^1.2.16",
|
|
39
41
|
"typescript": "^4.7.3",
|
|
40
42
|
"zx": "^6.2.5"
|
|
File without changes
|
|
@@ -5,16 +5,14 @@ const env = (typeof window === 'object' && window)
|
|
|
5
5
|
const def = {
|
|
6
6
|
middleware(config) {
|
|
7
7
|
let url = config.baseUrl || env.API_BASE_URL || 'https://ecomplus.io/v2';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
url += `,lang:${lang}`;
|
|
17
|
-
}
|
|
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}`;
|
|
18
16
|
}
|
|
19
17
|
if (config.params) {
|
|
20
18
|
if (typeof config.params === 'string') {
|
|
@@ -1 +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,
|
|
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,EAAE;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,GAAG,CAAC;AAClB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;AACtB,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAClB,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC;AAErB,eAAe,OAAO,CAAC;AAEvB,OAAO,EACL,aAAa,EACb,GAAG,EACH,IAAI,EACJ,GAAG,EACH,KAAK,EACL,GAAG,GACJ,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "E-Com Plus Cloud Commerce APIs client/adapter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/api#readme",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "zx scripts/build.mjs",
|
|
20
|
-
"test": "
|
|
20
|
+
"test": "zx scripts/test.mjs"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -8,16 +8,14 @@ const env: { [key: string]: string } = (typeof window === 'object' && window)
|
|
|
8
8
|
const def = {
|
|
9
9
|
middleware(config: Config) {
|
|
10
10
|
let url = config.baseUrl || env.API_BASE_URL || 'https://ecomplus.io/v2';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
url += `,lang:${lang}`;
|
|
20
|
-
}
|
|
11
|
+
const storeId = config.storeId || env.ECOM_STORE_ID;
|
|
12
|
+
if (!storeId) {
|
|
13
|
+
throw new Error('`storeId` must be set in config or `ECOM_STORE_ID` env var');
|
|
14
|
+
}
|
|
15
|
+
url += `/:${storeId}`;
|
|
16
|
+
const lang = config.lang || env.ECOM_LANG;
|
|
17
|
+
if (lang) {
|
|
18
|
+
url += `,lang:${lang}`;
|
|
21
19
|
}
|
|
22
20
|
if (config.params) {
|
|
23
21
|
if (typeof config.params === 'string') {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies, no-unused-vars */
|
|
2
|
+
|
|
3
|
+
import fetch, {
|
|
4
|
+
Blob,
|
|
5
|
+
blobFrom,
|
|
6
|
+
blobFromSync,
|
|
7
|
+
File,
|
|
8
|
+
fileFrom,
|
|
9
|
+
fileFromSync,
|
|
10
|
+
FormData,
|
|
11
|
+
Headers,
|
|
12
|
+
Request,
|
|
13
|
+
Response,
|
|
14
|
+
} from 'node-fetch';
|
|
15
|
+
|
|
16
|
+
if (!globalThis.fetch) {
|
|
17
|
+
globalThis.fetch = fetch;
|
|
18
|
+
globalThis.Headers = Headers;
|
|
19
|
+
globalThis.Request = Request;
|
|
20
|
+
globalThis.Response = Response;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import './fetch-polyfill';
|
|
3
|
+
import callApi from '../src/index';
|
|
4
|
+
|
|
5
|
+
callApi({
|
|
6
|
+
storeId: 1056,
|
|
7
|
+
method: 'get',
|
|
8
|
+
endpoint: 'products/618041aa239b7206d3fc06de',
|
|
9
|
+
}).then(({ data }) => {
|
|
10
|
+
if (data.sku === 'string') {
|
|
11
|
+
console.log('\\o/');
|
|
12
|
+
}
|
|
13
|
+
console.info(`✓ Read product ${data.sku} and checked SKU type string`);
|
|
14
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "es2020", /* Specify what module code is generated. */
|
|
28
|
+
// "rootDir": "src", /* Specify the root folder within your source files. */
|
|
29
|
+
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
30
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
31
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
32
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
33
|
+
// "typeRoots": ["lib/app/src/@types"], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
34
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
35
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
36
|
+
"resolveJsonModule": true, /* Enable importing .json files */
|
|
37
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
38
|
+
|
|
39
|
+
/* JavaScript Support */
|
|
40
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
|
41
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
42
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
43
|
+
|
|
44
|
+
/* Emit */
|
|
45
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
46
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
47
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
48
|
+
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
49
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
50
|
+
// "outDir": "dist", /* Specify an output folder for all emitted files. */
|
|
51
|
+
"removeComments": false, /* Disable emitting comments. */
|
|
52
|
+
"noEmit": true, /* Disable emitting files from a compilation. */
|
|
53
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
54
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
55
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
56
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
57
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
58
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
60
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
61
|
+
"newLine": "lf", /* Set the newline character for emitting files. */
|
|
62
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
63
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
64
|
+
"noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
65
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
66
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
67
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
68
|
+
|
|
69
|
+
/* Interop Constraints */
|
|
70
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
71
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
72
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
|
73
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
74
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
75
|
+
|
|
76
|
+
/* Type Checking */
|
|
77
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
78
|
+
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
79
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
80
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
81
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
82
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
83
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
84
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
85
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
86
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
87
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
88
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
89
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
90
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
91
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
92
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
93
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
94
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
95
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
96
|
+
|
|
97
|
+
/* Completeness */
|
|
98
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
99
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
100
|
+
},
|
|
101
|
+
"exclude": [
|
|
102
|
+
"**/dist/**",
|
|
103
|
+
"**/node_modules/**",
|
|
104
|
+
"**/src/**"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
@@ -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
|
-
}
|
|
@@ -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
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import callApi from '../src/index';
|
|
2
|
-
|
|
3
|
-
callApi({
|
|
4
|
-
storeId: 1056,
|
|
5
|
-
method: 'get',
|
|
6
|
-
endpoint: 'products/618041aa239b7206d3fc06de',
|
|
7
|
-
}).then(({ data }) => {
|
|
8
|
-
if (data.sku === '123') {
|
|
9
|
-
console.log('123');
|
|
10
|
-
} else {
|
|
11
|
-
console.log(data._id);
|
|
12
|
-
}
|
|
13
|
-
});
|