npgsqlrest 1.0.0 → 1.1.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/config-copy.js +18 -0
- package/package.json +5 -2
- package/postinstall.js +8 -5
- package/readme.md +45 -100
package/config-copy.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// Get the destination directory from the command line arguments, or use the current directory
|
|
7
|
+
const destDir = process.argv[2] || process.cwd();
|
|
8
|
+
|
|
9
|
+
// Path to the source file
|
|
10
|
+
const srcFile = path.join(__dirname, 'node_modules', 'npgsqlrest', '.bin', 'appsettings.json');
|
|
11
|
+
|
|
12
|
+
// Path to the destination file
|
|
13
|
+
const destFile = path.join(destDir, 'appsettings.json');
|
|
14
|
+
|
|
15
|
+
// Copy the file
|
|
16
|
+
fs.copyFileSync(srcFile, destFile);
|
|
17
|
+
|
|
18
|
+
console.log(`Copied appsettings.json to ${destFile}`);
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "npgsqlrest",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Automatic REST API for PostgreSQL Databases Client Build",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node postinstall.js",
|
|
7
7
|
"start": "npx npgsqlrest ./appsettings.json ./npgsqlrest.json"
|
|
8
8
|
},
|
|
9
|
-
"bin":
|
|
9
|
+
"bin": {
|
|
10
|
+
"npgsqlrest": "./.bin/npgsqlrest",
|
|
11
|
+
"npgsqlrest-config-copy": "./config-copy.js"
|
|
12
|
+
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "git+https://github.com/vb-consulting/NpgsqlRest.git"
|
package/postinstall.js
CHANGED
|
@@ -3,8 +3,8 @@ const path = require("path");
|
|
|
3
3
|
const os = require("os");
|
|
4
4
|
const https = require("https");
|
|
5
5
|
|
|
6
|
-
const downloadDir = "
|
|
7
|
-
const downloadFrom = "https://github.com/vb-consulting/NpgsqlRest/releases/download/v2.7.0/";
|
|
6
|
+
const downloadDir = "./.bin/";
|
|
7
|
+
const downloadFrom = "https://github.com/vb-consulting/NpgsqlRest/releases/download/v2.7.1-client-v1.1.0/";
|
|
8
8
|
|
|
9
9
|
function download(url, to, done) {
|
|
10
10
|
https.get(url, (response) => {
|
|
@@ -50,11 +50,14 @@ if (!fs.existsSync(path.dirname(downloadTo))) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (!fs.existsSync(downloadTo)) {
|
|
53
|
-
|
|
53
|
+
fs.unlinkSync(downloadTo);
|
|
54
54
|
}
|
|
55
|
+
download(downloadFileUrl, downloadTo);
|
|
56
|
+
|
|
55
57
|
|
|
56
58
|
downloadFileUrl = `${downloadFrom}appsettings.json`;
|
|
57
59
|
downloadTo = "./appsettings.json";
|
|
58
|
-
if (!fs.existsSync(
|
|
59
|
-
|
|
60
|
+
if (!fs.existsSync(downloadFileUrl)) {
|
|
61
|
+
fs.unlinkSync(downloadFileUrl, downloadTo);
|
|
60
62
|
}
|
|
63
|
+
download(downloadFileUrl, downloadTo);
|
package/readme.md
CHANGED
|
@@ -8,114 +8,41 @@
|
|
|
8
8
|
|
|
9
9
|
## Description
|
|
10
10
|
|
|
11
|
-
The `npgsqlrest` is an NPM distribution of
|
|
11
|
+
The `npgsqlrest` is an NPM distribution of the self-contained ahead-of-time (AOT) compiled to native code executables of the [NpgsqlRest Client Web App](https://github.com/vb-consulting/NpgsqlRest/tree/master/NpgsqlRestClient).
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- The source code for this build can be found on this location: [NpgsqlRestTestWebApi](https://github.com/vb-consulting/NpgsqlRest/tree/master/NpgsqlRestTestWebApi).
|
|
15
|
-
- Executable files are distributed from the [release download page for the latest version](https://github.com/vb-consulting/NpgsqlRest/releases).
|
|
16
|
-
- NPM post-install script will download the appropriate build for the target OS (Windows-64v or Linux-64, sorry Mac bros) and the [default configuration file](https://github.com/vb-consulting/NpgsqlRest/blob/master/NpgsqlRestTestWebApi/appsettings.json).
|
|
17
|
-
- Executable will be available through the NPX interface after installation:
|
|
13
|
+
NpgsqlRest is an Automatic REST API for PostgreSQL Database as the .NET8 Middleware. See the [GitHub Readme](https://github.com/vb-consulting/NpgsqlRest) for more info.
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
vbilopav@DESKTOP-O3A6QK2:~/npgsqlrest-npm-test$ npx npgsqlrest --help
|
|
21
|
-
Usages
|
|
22
|
-
1: npgsqlrest-[os]
|
|
23
|
-
2: npgsqlrest-[os] [path to one or more configuration file(s)]
|
|
24
|
-
3: npgsqlrest-[os] [-v | --version | -h | --help]
|
|
25
|
-
|
|
26
|
-
Where
|
|
27
|
-
npgsqlrest-[os] is executable for the specific OS (like npgsqlrest-win64 or npgsqlrest-linux64)
|
|
28
|
-
1: run executable with default configuration files: appsettings.json (required) and appsettings.Development.json (optional).
|
|
29
|
-
2: run executable with optional configuration files from argument list.
|
|
30
|
-
3: show this screen.
|
|
31
|
-
|
|
32
|
-
Versions
|
|
33
|
-
Build 1.0.0.0
|
|
34
|
-
Npgsql 2.7.0.0
|
|
35
|
-
NpgsqlRest.HttpFiles 1.0.2.0
|
|
36
|
-
NpgsqlRest.TsClient 1.6.0.0
|
|
15
|
+
NpgsqlRest Client Web App is a command line utility that runs as a configurable Kestrel web server that can:
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
- Create an Automatic REST API for the PostgreSQL Databases.
|
|
18
|
+
- Generate TypeScript Code and HTTP files for testing.
|
|
19
|
+
- Configure security for use the of either encrypted cookies or JWT Bearer tokens or both.
|
|
20
|
+
- Expose REST API endpoints for the PostgreSQL Databases as Login/Logout.
|
|
21
|
+
- Use external authentication providers such as Google, LinkedIn or GitHub.
|
|
22
|
+
- Server static content.
|
|
23
|
+
- Use and configure built-in Serilog structured logging.
|
|
24
|
+
- Configure Cross-origin resource sharing (CORS) access, SSL, Server Certificates and more, everything needed for modern Web development.
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
- If no argument is provided, the command will try to load `appsettings.json` from the current location and optionally `appsettings.Development.json`
|
|
43
|
-
- When using multiple configuration files, the later configuration will override values from the previous one.
|
|
44
|
-
- The [default configuration file](https://github.com/vb-consulting/NpgsqlRest/blob/master/NpgsqlRestTestWebApi/appsettings.json) can be located in `node_modules` -> `/node_modules/npgsqlrest/appsettings.json`.
|
|
45
|
-
- The default configuration will try to connect the following database: `"Host=127.0.0.1;Port=5432;Database=test;Username=postgres;Password=postgres"`
|
|
46
|
-
- Recommended use:
|
|
47
|
-
1) Copy the default configuration into the project root and adjust it to project needs.
|
|
48
|
-
2) - OR - use the default configuration and override it with project configuration from the root.
|
|
49
|
-
|
|
50
|
-
Example, of new override config:
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"ApplicationName": "MyProject",
|
|
55
|
-
"EnvironmentName": "Production",
|
|
56
|
-
"Urls": "http://localhost:5001",
|
|
57
|
-
|
|
58
|
-
"ConnectionStrings": {
|
|
59
|
-
"Default": "Host=127.0.0.1;Port=5432;Database=test;Username=postgres;Password=postgres"
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
"Auth": {
|
|
63
|
-
"CookieAuth": true,
|
|
64
|
-
"BearerTokenAuth": true
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
"Log": {
|
|
68
|
-
"ToConsole": true,
|
|
69
|
-
"ToFile": true
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
"StaticFiles": {
|
|
73
|
-
"Enabled": true
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
"NpgsqlRest": {
|
|
77
|
-
"HttpFileOptions": {
|
|
78
|
-
"Enabled": true
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
"TsClient": {
|
|
82
|
-
"Enabled": true
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
"CrudSource": {
|
|
86
|
-
"Enabled": false
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
26
|
+
See the [default configuration file](https://vb-consulting.github.io/npgsqlrest/config/) with descriptions for more information.
|
|
91
27
|
|
|
92
|
-
|
|
28
|
+
## Usage
|
|
93
29
|
|
|
94
30
|
```console
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
[
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
[15:04:49.582 INF] Listening on ["http://localhost:5001"] [Program]
|
|
105
|
-
```
|
|
31
|
+
$ npx npgsqlrest --help
|
|
32
|
+
Usage:
|
|
33
|
+
npgsqlrest Run with the default configuration files: appsettings.json (required) and appsettings.Development.json (optional).
|
|
34
|
+
npgsqlrest [files...] Run with the custom configuration files. All configuration files are required.
|
|
35
|
+
npgsqlrest [file1 -o file2...] Use the -o switch to mark the next configuration file as optional. The first file after the -o switch is optional.
|
|
36
|
+
npgsqlrest [file1 --optional file2...] Use --optional switch to mark the next configuration file as optional. The first file after the --optional switch is optional.
|
|
37
|
+
|
|
38
|
+
npgsqlrest -v, --version Show version information.
|
|
39
|
+
npgsqlrest -h, --help Show command line help.
|
|
106
40
|
|
|
107
|
-
|
|
41
|
+
Note: Values in the later file will override the values in the previous one.
|
|
108
42
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- Authentication out of the box, encrypted cookies, or, bearer token or both.
|
|
113
|
-
- Logging to console or rolling files (Serilog implementation) with fine tuning.
|
|
114
|
-
- Serving static files.
|
|
115
|
-
- CORS configuration.
|
|
116
|
-
- HTTP file automatic generartion.
|
|
117
|
-
- TypeScript client automatic generation.
|
|
118
|
-
- And more.
|
|
43
|
+
Example: npgsqlrest appsettings.json appsettings.Development.json
|
|
44
|
+
Example: npgsqlrest appsettings.json -o appsettings.Development.json
|
|
45
|
+
```
|
|
119
46
|
|
|
120
47
|
## Installation
|
|
121
48
|
|
|
@@ -123,4 +50,22 @@ Install `npgsqlrest` using npm:
|
|
|
123
50
|
|
|
124
51
|
```console
|
|
125
52
|
npm install npgsqlrest --save-dev
|
|
126
|
-
```
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Changelog
|
|
56
|
+
|
|
57
|
+
### 1.1.1
|
|
58
|
+
|
|
59
|
+
- Move the download bin directory from share `/node_modules/.bin/` to package local `/node_modules/npgsqlrest/.bin/`
|
|
60
|
+
- Added copy default configuration command that, well, copies the default configuration `npx npgsqlrest-config-copy [optional dir]`
|
|
61
|
+
|
|
62
|
+
### 1.1.0
|
|
63
|
+
|
|
64
|
+
New build versions:
|
|
65
|
+
|
|
66
|
+
Client Build 1.1.0.0
|
|
67
|
+
Npgsql 2.7.1.0
|
|
68
|
+
NpgsqlRest.HttpFiles 1.0.2.0
|
|
69
|
+
NpgsqlRest.TsClient 1.6.0.0
|
|
70
|
+
|
|
71
|
+
https://github.com/vb-consulting/NpgsqlRest/releases/tag/v2.7.1-client-v1.1.0
|