@serptech/api 1.0.0
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/LICENSE.md +21 -0
- package/Makefile +12 -0
- package/README.md +39 -0
- package/dist/SerpApi.node.js +65 -0
- package/dist/SerpApi.web.js +65 -0
- package/eslint.config.mjs +51 -0
- package/mychange.diff +50452 -0
- package/package.json +62 -0
- package/packages/serp-rest-api/LICENSE.md +21 -0
- package/packages/serp-rest-api/README.md +30 -0
- package/packages/serp-rest-api/dist/index.node.js +1752 -0
- package/packages/serp-rest-api/dist/index.web.js +1282 -0
- package/packages/serp-rest-api/package.json +59 -0
- package/packages/serp-rest-api/src/base/api.ts +15 -0
- package/packages/serp-rest-api/src/base/auth-api.ts +25 -0
- package/packages/serp-rest-api/src/base/types.ts +33 -0
- package/packages/serp-rest-api/src/constants/index.js +13 -0
- package/packages/serp-rest-api/src/http-client.ts +207 -0
- package/packages/serp-rest-api/src/index.ts +3 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/auth/index.ts +50 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/base.ts +58 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/entries/index.ts +87 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/index.ts +106 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/licenses/index.ts +28 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/notifications/index.ts +40 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/persons/index.ts +60 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/persons-groups/index.ts +54 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/sources/index.ts +46 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/spaces/index.ts +27 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/stream-tokens/index.ts +37 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/thresholds/index.ts +17 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/tokens/index.ts +32 -0
- package/packages/serp-rest-api/src/serp-rest-api/api-facade/v1/utilities/index.ts +82 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/auth/v1/index.ts +58 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/entries/v1/index.ts +70 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/licenses/v1/index.ts +82 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/notifications/v1/index.ts +100 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/persons/v1/index.ts +110 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/persons-groups/v1/index.ts +128 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/sources/v1/index.ts +113 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/spaces/v1/index.ts +65 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/stream-tokens/v1/index.ts +76 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/thresholds/v1/index.ts +32 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/tokens/v1/index.ts +61 -0
- package/packages/serp-rest-api/src/serp-rest-api/features/utilities/v1/index.ts +114 -0
- package/packages/serp-rest-api/src/serp-rest-api/index.ts +82 -0
- package/packages/serp-rest-api/src/utils/data.ts +13 -0
- package/packages/serp-rest-api/src/utils/files.ts +83 -0
- package/packages/serp-rest-api/src/utils/index.ts +2 -0
- package/packages/serp-websocket/LICENSE.md +21 -0
- package/packages/serp-websocket/README.md +32 -0
- package/packages/serp-websocket/dist/index.node.js +400 -0
- package/packages/serp-websocket/dist/index.web.js +158 -0
- package/packages/serp-websocket/package.json +60 -0
- package/packages/serp-websocket/src/constants/index.ts +7 -0
- package/packages/serp-websocket/src/index.ts +43 -0
- package/packages/serp-websocket/src/v1/index.ts +183 -0
- package/src/index.js +7 -0
package/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (C) 2024, SERP, d@serptech.ru
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
10
|
+
so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/Makefile
ADDED
package/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Serp API JS library
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
### NPM
|
6
|
+
|
7
|
+
```bash
|
8
|
+
npm i --save @serp/api
|
9
|
+
```
|
10
|
+
|
11
|
+
### Yarn
|
12
|
+
|
13
|
+
```bash
|
14
|
+
yarn add @serp/api
|
15
|
+
```
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```js
|
20
|
+
// ES2015 module import:
|
21
|
+
import { createSerpRestApi, createSerpWsApi } from "@serp/api";
|
22
|
+
|
23
|
+
// CommonJS module require:
|
24
|
+
const { createSerpRestApi, createSerpWsApi } = require("@serp/api");
|
25
|
+
|
26
|
+
// REST
|
27
|
+
const SerpRestApi = createSerpRestApi({
|
28
|
+
version: 1,
|
29
|
+
token: "YOUR_SERP_TOKEN",
|
30
|
+
});
|
31
|
+
|
32
|
+
// WebSocket
|
33
|
+
const SerpWsApi = createSerpWsApi({
|
34
|
+
version: 1,
|
35
|
+
token: "YOUR_SERP_TOKEN",
|
36
|
+
});
|
37
|
+
|
38
|
+
SerpWsApi.connect();
|
39
|
+
```
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
6
|
+
* or disable the default devtool with "devtool: false".
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
8
|
+
*/
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
11
|
+
module.exports = factory();
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
13
|
+
define([], factory);
|
14
|
+
else if(typeof exports === 'object')
|
15
|
+
exports["SerpApi"] = factory();
|
16
|
+
else
|
17
|
+
root["SerpApi"] = factory();
|
18
|
+
})(this, () => {
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
20
|
+
/******/ var __webpack_modules__ = ({
|
21
|
+
|
22
|
+
/***/ "./src/index.js":
|
23
|
+
/***/ ((module) => {
|
24
|
+
|
25
|
+
eval("var _packagesSerpRes = \"../packages/serp-rest-api/dist/index.web.js\",\n createSerpRestApi = _packagesSerpRes.createSerpRestApi;\nvar _packagesSerpWeb = \"../packages/serp-websocket/dist/index.web.js\",\n createSerpWsApi = _packagesSerpWeb.createSerpWsApi;\nmodule.exports = {\n createSerpRestApi: createSerpRestApi,\n createSerpWsApi: createSerpWsApi\n};\n\n//# sourceURL=webpack://SerpApi/./src/index.js?");
|
26
|
+
|
27
|
+
/***/ })
|
28
|
+
|
29
|
+
/******/ });
|
30
|
+
/************************************************************************/
|
31
|
+
/******/ // The module cache
|
32
|
+
/******/ var __webpack_module_cache__ = {};
|
33
|
+
/******/
|
34
|
+
/******/ // The require function
|
35
|
+
/******/ function __webpack_require__(moduleId) {
|
36
|
+
/******/ // Check if module is in cache
|
37
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
38
|
+
/******/ if (cachedModule !== undefined) {
|
39
|
+
/******/ return cachedModule.exports;
|
40
|
+
/******/ }
|
41
|
+
/******/ // Create a new module (and put it into the cache)
|
42
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
43
|
+
/******/ // no module.id needed
|
44
|
+
/******/ // no module.loaded needed
|
45
|
+
/******/ exports: {}
|
46
|
+
/******/ };
|
47
|
+
/******/
|
48
|
+
/******/ // Execute the module function
|
49
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
50
|
+
/******/
|
51
|
+
/******/ // Return the exports of the module
|
52
|
+
/******/ return module.exports;
|
53
|
+
/******/ }
|
54
|
+
/******/
|
55
|
+
/************************************************************************/
|
56
|
+
/******/
|
57
|
+
/******/ // startup
|
58
|
+
/******/ // Load entry module and return exports
|
59
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
60
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
|
61
|
+
/******/
|
62
|
+
/******/ return __webpack_exports__;
|
63
|
+
/******/ })()
|
64
|
+
;
|
65
|
+
});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
/*
|
2
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
3
|
+
* This devtool is neither made for production nor for readable output files.
|
4
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
5
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
6
|
+
* or disable the default devtool with "devtool: false".
|
7
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
8
|
+
*/
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
11
|
+
module.exports = factory();
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
13
|
+
define([], factory);
|
14
|
+
else if(typeof exports === 'object')
|
15
|
+
exports["SerpApi"] = factory();
|
16
|
+
else
|
17
|
+
root["SerpApi"] = factory();
|
18
|
+
})(this, () => {
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
20
|
+
/******/ var __webpack_modules__ = ({
|
21
|
+
|
22
|
+
/***/ "./src/index.js":
|
23
|
+
/***/ ((module) => {
|
24
|
+
|
25
|
+
eval("var _packagesSerpRes = \"../packages/serp-rest-api/dist/index.web.js\",\n createSerpRestApi = _packagesSerpRes.createSerpRestApi;\nvar _packagesSerpWeb = \"../packages/serp-websocket/dist/index.web.js\",\n createSerpWsApi = _packagesSerpWeb.createSerpWsApi;\nmodule.exports = {\n createSerpRestApi: createSerpRestApi,\n createSerpWsApi: createSerpWsApi\n};\n\n//# sourceURL=webpack://SerpApi/./src/index.js?");
|
26
|
+
|
27
|
+
/***/ })
|
28
|
+
|
29
|
+
/******/ });
|
30
|
+
/************************************************************************/
|
31
|
+
/******/ // The module cache
|
32
|
+
/******/ var __webpack_module_cache__ = {};
|
33
|
+
/******/
|
34
|
+
/******/ // The require function
|
35
|
+
/******/ function __webpack_require__(moduleId) {
|
36
|
+
/******/ // Check if module is in cache
|
37
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
38
|
+
/******/ if (cachedModule !== undefined) {
|
39
|
+
/******/ return cachedModule.exports;
|
40
|
+
/******/ }
|
41
|
+
/******/ // Create a new module (and put it into the cache)
|
42
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
43
|
+
/******/ // no module.id needed
|
44
|
+
/******/ // no module.loaded needed
|
45
|
+
/******/ exports: {}
|
46
|
+
/******/ };
|
47
|
+
/******/
|
48
|
+
/******/ // Execute the module function
|
49
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
50
|
+
/******/
|
51
|
+
/******/ // Return the exports of the module
|
52
|
+
/******/ return module.exports;
|
53
|
+
/******/ }
|
54
|
+
/******/
|
55
|
+
/************************************************************************/
|
56
|
+
/******/
|
57
|
+
/******/ // startup
|
58
|
+
/******/ // Load entry module and return exports
|
59
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
60
|
+
/******/ var __webpack_exports__ = __webpack_require__("./src/index.js");
|
61
|
+
/******/
|
62
|
+
/******/ return __webpack_exports__;
|
63
|
+
/******/ })()
|
64
|
+
;
|
65
|
+
});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import prettier from "eslint-plugin-prettier";
|
2
|
+
import jest from "eslint-plugin-jest";
|
3
|
+
import globals from "globals";
|
4
|
+
import babelParser from "@babel/eslint-parser";
|
5
|
+
import path from "node:path";
|
6
|
+
import { fileURLToPath } from "node:url";
|
7
|
+
import js from "@eslint/js";
|
8
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
9
|
+
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
11
|
+
const __dirname = path.dirname(__filename);
|
12
|
+
const compat = new FlatCompat({
|
13
|
+
baseDirectory: __dirname,
|
14
|
+
recommendedConfig: js.configs.recommended,
|
15
|
+
allConfig: js.configs.all
|
16
|
+
});
|
17
|
+
|
18
|
+
export default [{
|
19
|
+
ignores: ["dist/*", "node_modules/*"],
|
20
|
+
}, ...compat.extends("eslint:recommended", "prettier", "plugin:jest/recommended"), {
|
21
|
+
settings: {
|
22
|
+
jest: {
|
23
|
+
version: jest.meta.version,
|
24
|
+
},
|
25
|
+
},
|
26
|
+
|
27
|
+
plugins: {
|
28
|
+
prettier,
|
29
|
+
jest,
|
30
|
+
},
|
31
|
+
|
32
|
+
languageOptions: {
|
33
|
+
globals: {
|
34
|
+
...globals.browser,
|
35
|
+
...globals.commonjs,
|
36
|
+
...globals.node,
|
37
|
+
...globals.jest,
|
38
|
+
},
|
39
|
+
|
40
|
+
parser: babelParser,
|
41
|
+
ecmaVersion: 5,
|
42
|
+
sourceType: "module",
|
43
|
+
|
44
|
+
parserOptions: {
|
45
|
+
requireConfigFile: false,
|
46
|
+
ecmaFeatures: {
|
47
|
+
modules: true,
|
48
|
+
},
|
49
|
+
},
|
50
|
+
},
|
51
|
+
}];
|