@revisium/client 0.1.0-alpha.1
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 +21 -0
- package/README.md +77 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/dist/revisium-client.d.ts +11 -0
- package/dist/revisium-client.d.ts.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 revisium
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do 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/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @revisium/client
|
|
4
|
+
|
|
5
|
+
[](https://sonarcloud.io/summary/new_code?id=revisium_revisium-client)
|
|
6
|
+
[](https://sonarcloud.io/summary/new_code?id=revisium_revisium-client)
|
|
7
|
+
[](https://github.com/revisium/revisium-client/blob/master/LICENSE)
|
|
8
|
+
[](https://github.com/revisium/revisium-client/releases)
|
|
9
|
+
|
|
10
|
+
TypeScript HTTP client for [Revisium](https://revisium.io) REST API.
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @revisium/client
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { RevisiumClient } from '@revisium/client';
|
|
24
|
+
|
|
25
|
+
const client = new RevisiumClient({ baseUrl: 'http://localhost:8080' });
|
|
26
|
+
|
|
27
|
+
// Authenticate
|
|
28
|
+
await client.login({ username: 'admin', password: 'admin' });
|
|
29
|
+
|
|
30
|
+
// Set project context
|
|
31
|
+
client.setProject({ organizationId: 'admin', projectName: 'my-project' });
|
|
32
|
+
|
|
33
|
+
// Work with data
|
|
34
|
+
const rows = await client.getRows('my-table', { first: 100 });
|
|
35
|
+
await client.createRow('my-table', 'row-1', { name: 'Test' });
|
|
36
|
+
await client.commit('Added test row');
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### Connection
|
|
42
|
+
|
|
43
|
+
| Method | Description |
|
|
44
|
+
|--------|-------------|
|
|
45
|
+
| `login(credentials)` | Authenticate with username/password |
|
|
46
|
+
| `loginWithToken(token)` | Authenticate with JWT token |
|
|
47
|
+
| `setProject(options)` | Set organization, project, and branch context |
|
|
48
|
+
|
|
49
|
+
### Data Operations
|
|
50
|
+
|
|
51
|
+
| Method | Description |
|
|
52
|
+
|--------|-------------|
|
|
53
|
+
| `getRows(tableId, options?)` | Get rows from a table |
|
|
54
|
+
| `getRow(tableId, rowId)` | Get a single row |
|
|
55
|
+
| `createRow(tableId, rowId, data)` | Create a new row |
|
|
56
|
+
| `updateRow(tableId, rowId, data)` | Update a row |
|
|
57
|
+
| `removeRow(tableId, rowId)` | Remove a row |
|
|
58
|
+
|
|
59
|
+
### Version Control
|
|
60
|
+
|
|
61
|
+
| Method | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `commit(comment?)` | Commit pending changes |
|
|
64
|
+
| `rollback()` | Revert uncommitted changes |
|
|
65
|
+
| `getChanges()` | Get pending changes summary |
|
|
66
|
+
|
|
67
|
+
### Schema
|
|
68
|
+
|
|
69
|
+
| Method | Description |
|
|
70
|
+
|--------|-------------|
|
|
71
|
+
| `getTables()` | List all tables |
|
|
72
|
+
| `getTableSchema(tableId)` | Get table JSON Schema |
|
|
73
|
+
| `createTable(tableId, schema)` | Create a new table |
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/revisium-client.ts
|
|
4
|
+
var RevisiumClient = class {
|
|
5
|
+
_baseUrl;
|
|
6
|
+
_token = null;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
const url = options.baseUrl;
|
|
9
|
+
this._baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
10
|
+
}
|
|
11
|
+
get baseUrl() {
|
|
12
|
+
return this._baseUrl;
|
|
13
|
+
}
|
|
14
|
+
isAuthenticated() {
|
|
15
|
+
return this._token !== null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.RevisiumClient = RevisiumClient;
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/revisium-client.ts"],"sourcesContent":["export interface RevisiumClientOptions {\n baseUrl: string;\n}\n\nexport class RevisiumClient {\n private readonly _baseUrl: string;\n private readonly _token: string | null = null;\n\n constructor(options: RevisiumClientOptions) {\n const url = options.baseUrl;\n this._baseUrl = url.endsWith('/') ? url.slice(0, -1) : url;\n }\n\n public get baseUrl(): string {\n return this._baseUrl;\n }\n\n public isAuthenticated(): boolean {\n return this._token !== null;\n }\n}\n"],"mappings":";;;AAIA,IAAa,iBAAb,MAA4B;CAC1B,AAAiB;CACjB,AAAiB,SAAwB;CAEzC,YAAY,SAAgC;EAC1C,MAAM,MAAM,QAAQ;AACpB,OAAK,WAAW,IAAI,SAAS,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG;;CAGzD,IAAW,UAAkB;AAC3B,SAAO,KAAK;;CAGd,AAAO,kBAA2B;AAChC,SAAO,KAAK,WAAW"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/revisium-client.ts
|
|
2
|
+
var RevisiumClient = class {
|
|
3
|
+
_baseUrl;
|
|
4
|
+
_token = null;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
const url = options.baseUrl;
|
|
7
|
+
this._baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
8
|
+
}
|
|
9
|
+
get baseUrl() {
|
|
10
|
+
return this._baseUrl;
|
|
11
|
+
}
|
|
12
|
+
isAuthenticated() {
|
|
13
|
+
return this._token !== null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { RevisiumClient };
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/revisium-client.ts"],"sourcesContent":["export interface RevisiumClientOptions {\n baseUrl: string;\n}\n\nexport class RevisiumClient {\n private readonly _baseUrl: string;\n private readonly _token: string | null = null;\n\n constructor(options: RevisiumClientOptions) {\n const url = options.baseUrl;\n this._baseUrl = url.endsWith('/') ? url.slice(0, -1) : url;\n }\n\n public get baseUrl(): string {\n return this._baseUrl;\n }\n\n public isAuthenticated(): boolean {\n return this._token !== null;\n }\n}\n"],"mappings":";AAIA,IAAa,iBAAb,MAA4B;CAC1B,AAAiB;CACjB,AAAiB,SAAwB;CAEzC,YAAY,SAAgC;EAC1C,MAAM,MAAM,QAAQ;AACpB,OAAK,WAAW,IAAI,SAAS,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG;;CAGzD,IAAW,UAAkB;AAC3B,SAAO,KAAK;;CAGd,AAAO,kBAA2B;AAChC,SAAO,KAAK,WAAW"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RevisiumClientOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class RevisiumClient {
|
|
5
|
+
private readonly _baseUrl;
|
|
6
|
+
private readonly _token;
|
|
7
|
+
constructor(options: RevisiumClientOptions);
|
|
8
|
+
get baseUrl(): string;
|
|
9
|
+
isAuthenticated(): boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=revisium-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revisium-client.d.ts","sourceRoot":"","sources":["../src/revisium-client.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAElC,OAAO,EAAE,qBAAqB;IAK1C,IAAW,OAAO,IAAI,MAAM,CAE3B;IAEM,eAAe,IAAI,OAAO;CAGlC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@revisium/client",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "TypeScript HTTP client for Revisium REST API",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"revisium",
|
|
7
|
+
"client",
|
|
8
|
+
"rest-api",
|
|
9
|
+
"typescript",
|
|
10
|
+
"headless-cms"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/revisium/revisium-client.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Anton Kashirov",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.cjs"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.cjs",
|
|
32
|
+
"module": "./dist/index.mjs",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsdown && npm run build:dts",
|
|
39
|
+
"build:dts": "tsc -p tsconfig.build.json",
|
|
40
|
+
"dev": "tsdown --watch",
|
|
41
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
42
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
|
|
43
|
+
"test:cov": "NODE_OPTIONS=--experimental-vm-modules jest --coverage --silent",
|
|
44
|
+
"lint:ci": "eslint . --max-warnings 0",
|
|
45
|
+
"lint:fix": "eslint . --fix",
|
|
46
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
47
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
48
|
+
"tsc": "tsc --noEmit",
|
|
49
|
+
"prepublishOnly": "npm run build && npm run tsc"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.15.0",
|
|
53
|
+
"@jest/globals": "^29.7.0",
|
|
54
|
+
"@types/jest": "^29.5.14",
|
|
55
|
+
"@types/node": "^24.10.7",
|
|
56
|
+
"eslint": "^9.15.0",
|
|
57
|
+
"eslint-config-prettier": "^10.1.8",
|
|
58
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
59
|
+
"eslint-plugin-sonarjs": "^3.0.5",
|
|
60
|
+
"globals": "^15.12.0",
|
|
61
|
+
"jest": "^29.7.0",
|
|
62
|
+
"prettier": "^3.4.2",
|
|
63
|
+
"ts-jest": "^29.2.5",
|
|
64
|
+
"tsdown": "^0.20.1",
|
|
65
|
+
"typescript": "^5.7.2",
|
|
66
|
+
"typescript-eslint": "^8.15.0"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=18.0.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
}
|
|
74
|
+
}
|