npgsqlrest 0.0.6 → 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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "npgsqlrest",
3
- "version": "0.0.6",
3
+ "version": "1.0.0",
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": "node_modules/.bin/npgsqlrest.exe",
9
+ "bin": "node_modules/.bin/npgsqlrest",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/vb-consulting/NpgsqlRest.git"
@@ -23,5 +23,5 @@
23
23
  "bugs": {
24
24
  "url": "https://github.com/vb-consulting/NpgsqlRest/issues"
25
25
  },
26
- "homepage": "https://github.com/vb-consulting/NpgsqlRest#readme"
26
+ "homepage": "https://github.com/vb-consulting/NpgsqlRest/blob/master/npm/readme.md"
27
27
  }
package/postinstall.js CHANGED
@@ -39,7 +39,7 @@ if (osType === "Windows_NT") {
39
39
  downloadTo = `${downloadDir}npgsqlrest.exe`;
40
40
  } else if (osType === "Linux") {
41
41
  downloadFileUrl = `${downloadFrom}npgsqlrest-linux64`;
42
- downloadTo = `${downloadDir}npgsqlrest.exe`;
42
+ downloadTo = `${downloadDir}npgsqlrest`;
43
43
  } else {
44
44
  console.error("Unsupported OS detected:", osType);
45
45
  process.exit(1);
package/readme.md ADDED
@@ -0,0 +1,126 @@
1
+ # npgsqlrest
2
+
3
+ ![npm version](https://badge.fury.io/js/npgsqlrest.svg)
4
+ ![build-test-publish](https://github.com/vb-consulting/NpgsqlRest/workflows/build-test-publish/badge.svg)
5
+ ![License](https://img.shields.io/badge/license-MIT-green)
6
+ ![GitHub Stars](https://img.shields.io/github/stars/vb-consulting/NpgsqlRest?style=social)
7
+ ![GitHub Forks](https://img.shields.io/github/forks/vb-consulting/NpgsqlRest?style=social)
8
+
9
+ ## Description
10
+
11
+ The `npgsqlrest` is an NPM distribution of AOT (ahead-of-time) native client build of the `NpgsqlRest` standalone client web application.
12
+
13
+ - Currently, only **Windows-64** and **Linux-64** builds are supported.
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:
18
+
19
+ ```console
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
37
+
38
+ vbilopav@DESKTOP-O3A6QK2:~/npgsqlrest-npm-test$
39
+ ```
40
+
41
+ - The command expects a list of configuration files in the argument list.
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
+ ```
91
+
92
+ Command:
93
+
94
+ ```console
95
+ vbilopav@DESKTOP-O3A6QK2:~/npgsqlrest-npm-test$ npx npgsqlrest ./node_modules/npgsqlrest/appsettings.json project-config.json
96
+ [15:04:49.409 INF] ----> Starting with configuration(s): ["EnvironmentVariablesConfigurationProvider", "JsonConfigurationProvider for 'appsettings.json' (Required)", "JsonConfigurationProvider for 'project-config.json' (Required)"] [Program]
97
+ [15:04:49.409 INF] Using Cookie Authentication with scheme Cookies. Cookie expires in 14 days. [Program]
98
+ [15:04:49.410 INF] Using Bearer Token Authentication with scheme BearerToken. Token expires in 1 hours and refresh token expires in 14 days. [Program]
99
+ [15:04:49.410 INF] Using connection: Host=127.0.0.1;Port=5432;Database=test;Username=postgres;Application Name=MyProject [Program]
100
+ [15:04:49.412 INF] Serving static files from /home/vbilopav/npgsqlrest-npm-test/wwwroot [Program]
101
+ [15:04:49.574 INF] Created endpoint POST /api/case-return-long-table1 [NpgsqlRest]
102
+ [15:04:49.574 INF] Created HTTP file: /home/vbilopav/npgsqlrest-npm-test/test_public.http [NpgsqlRest.HttpFiles]
103
+ [15:04:49.582 INF] Started in 00:00:00.1752748 [Program]
104
+ [15:04:49.582 INF] Listening on ["http://localhost:5001"] [Program]
105
+ ```
106
+
107
+ ## Features
108
+
109
+ - Automatic **generation of the HTTP REST endpoints** from PostgreSQL functions, procedures, tables or views.
110
+ - **Customization** of endpoints with comment annotations. You can easily configure any endpoint by adding comment annotation labels to [PostgreSQL Comments](https://www.postgresql.org/docs/current/sql-comment.html).
111
+ - **High performance** with or without native AOT, up to 6 times higher throughput than similar solutions.
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.
119
+
120
+ ## Installation
121
+
122
+ Install `npgsqlrest` using npm:
123
+
124
+ ```console
125
+ npm install npgsqlrest --save-dev
126
+ ```