@colabo-knalledge/i-core-services 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.
@@ -0,0 +1,48 @@
1
+ import { Observable } from "rxjs";
2
+ import { HttpClient } from "@colabo-headless/i-core";
3
+ import { KNodeFrontend, IApiRequest } from "@colabo-knalledge/i-core";
4
+ import { CFServiceIsomorphic } from "./cf.service.isomorphic";
5
+ import { IEntity, ElementServiceIsomorphic } from "./element.service.isomorphic";
6
+ import { UtilsNotificationService } from "@colabo-headless/i-core/colabo-utils/f-notifications";
7
+ import { IKNode } from "@colabo-knalledge/i-core";
8
+ export declare class ColaboKnAllEdgeNodeService extends CFServiceIsomorphic implements ElementServiceIsomorphic {
9
+ protected http: HttpClient;
10
+ protected utilsNotificationService: UtilsNotificationService;
11
+ /** url of server (including port and folder)
12
+ * it is provided from the config data
13
+ */
14
+ protected serverAP: string;
15
+ /** the id of the current service instance */
16
+ id: number;
17
+ /** the full url to the service specific url including API path (sub-folder) */
18
+ protected apiUrl: string;
19
+ /** default API action used for standard (CRUD) calls */
20
+ protected defaultAction: string;
21
+ /**
22
+ * Initializes and constructs the service
23
+ * In the case of the DI support, it receives http client and notification service
24
+ * @param http DI-ed http client (primarily in the angular environment or testing), if missing it will be created internally
25
+ * @param utilsNotificationService notification service for reporting errors, info and warnings to user, TODO: if missing, should we create a default `console.*` equivalent?
26
+ */
27
+ constructor(http: HttpClient, utilsNotificationService: UtilsNotificationService);
28
+ /**
29
+ * Get a KN Node from the server by its `id`
30
+ * @param {string} id id of the node
31
+ * @param {function} callback Function to be called when the node is retrieved
32
+ * @returns {Promise<KNodeFrontend>} the retrieved node
33
+ * @throws `ColaboError (REQUEST_BAD | DATA_MISSING | DATA_INCORRECT_FORMAT)`
34
+ */
35
+ getById(id: string): Promise<KNodeFrontend>;
36
+ getVosWithColaboApi(request: IApiRequest): Promise<IKNode[]>;
37
+ updateSingleWithColaboApi(request: IApiRequest): Promise<IKNode>;
38
+ updateWithColaboApi(request: IApiRequest): Promise<IKNode[]>;
39
+ createSingle(kNode: IKNode): Promise<IKNode>;
40
+ /** creates a new Element (VO) */
41
+ create(kNode: IKNode, callback?: Function): Promise<IKNode[]>;
42
+ createWithColaboApi(request: IApiRequest): Promise<IKNode[]>;
43
+ /** destroys the Element (VO) with the `_id === id` */
44
+ destroy(id: string): Promise<boolean>;
45
+ destroyWithColaboApi(request: IApiRequest): Promise<Partial<IKNode[]>>;
46
+ /** gets Elements (VOs) to populate the list */
47
+ getVOs(type?: string): Observable<IEntity[] | undefined>;
48
+ }
@@ -0,0 +1,10 @@
1
+ export declare const MODULE_NAME: string;
2
+ /**
3
+ * Describes puzzle configuration
4
+ */
5
+ export interface IPuzzleConfig {
6
+ /** url to the server (backend) providing the KnAllEdge API */
7
+ serverUrl: string;
8
+ }
9
+ export declare const DEBUG: boolean;
10
+ export declare const DEBUG_VERBOSE: boolean;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@colabo-knalledge/i-core-services",
3
+ "version": "1.0.0",
4
+ "description": "Core isomorphic code for the KnAllEdge module - services",
5
+ "private": false,
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Cha-OS/colabo"
14
+ },
15
+ "scripts": {
16
+ "build": "node esbuild.mjs",
17
+ "build:rollup": "rollup -c",
18
+ "build:esbuild": "node esbuild.mjs",
19
+ "test": "mocha --watch --watch-extensions ts --reporter mocha-clearscreen-reporter -r ts-node/register -r tsconfig-paths/register tests/*.test.ts",
20
+ "test_single": "mocha --watch --watch-extensions ts --reporter mocha-clearscreen-reporter -r ts-node/register -r tsconfig-paths/register",
21
+ "test_single_no_clear": "mocha --watch --watch-extensions ts -r ts-node/register -r tsconfig-paths/register"
22
+ },
23
+ "main": "dist/cjs/index.js",
24
+ "peerDependencies": {
25
+ "rxjs": "^7.8.1"
26
+ },
27
+ "peerDependenciesLocal": {},
28
+ "devDependencies": {
29
+ "@types/chai-subset": "^1.3.3",
30
+ "chai-subset": "^1.6.0"
31
+ },
32
+ "dependencies": {
33
+ "axios-observable": "^1.1.3",
34
+ "esm": "^3.2.25",
35
+ "mocha-clearscreen-reporter": "^1.0.1",
36
+ "rxjs": "7.8.1",
37
+ "@colabo-knalledge/i-core": "1.0.0",
38
+ "@colabo-headless/i-core": "npm:@colabo-headless/f-core-frontend-vanilla@1.0.1",
39
+ "@colabo-utils/i-config": "1.0.0",
40
+ "@colabo-utils/i-notifications": "1.0.3"
41
+ },
42
+ "module": "dist/esm/index.js",
43
+ "exports": {
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "import": "./dist/esm/index.js",
47
+ "require": "./dist/cjs/index.js"
48
+ },
49
+ "./package.json": "./package.json"
50
+ },
51
+ "types": "dist/index.d.ts",
52
+ "typings": "dist/index.d.ts",
53
+ "files": [
54
+ "dist",
55
+ "README.md",
56
+ "LICENSE",
57
+ "CHANGELOG.md"
58
+ ],
59
+ "liveDependencies": {
60
+ "@colabo-knalledge/i-core": "1.0.0",
61
+ "@colabo-headless/i-core": "npm:@colabo-headless/f-core-frontend-vanilla@1.0.1",
62
+ "@colabo-utils/i-config": "1.0.0",
63
+ "@colabo-utils/i-notifications": "1.0.3"
64
+ }
65
+ }