@oino-ts/db-bunsqlite 0.0.14 → 0.0.16

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/README.md CHANGED
@@ -10,15 +10,15 @@
10
10
  # GETTING STARTED
11
11
 
12
12
  ### Setup
13
- Install the `@oino-ts/core` npm package and necessary database packages and import them in your code.
13
+ Install the `@oino-ts/db` npm package and necessary database packages and import them in your code.
14
14
  ```
15
- bun install @oino-ts/core
16
- bun install @oino-ts/bunsqlite
15
+ bun install @oino-ts/db
16
+ bun install @oino-ts/db-bunsqlite
17
17
  ```
18
18
 
19
19
  ```
20
- import { OINODb, OINOApi, OINOFactory } from "@oino-ts/core";
21
- import { OINODbBunSqlite } from "@oino-ts/bunsqlite"
20
+ import { OINODb, OINOApi, OINOFactory } from "@oino-ts/db";
21
+ import { OINODbBunSqlite } from "@oino-ts/db-bunsqlite"
22
22
  ```
23
23
 
24
24
  ### Register database and logger
@@ -51,7 +51,7 @@
51
51
  ### Write results back to HTTP Response
52
52
  The results for a GET request will contain [`OINOModelSet`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbModelSet.html) data that can be written out as JSON or CSV as needed. For other requests result is just success or error with messages.
53
53
  ```
54
- return new Response(result.modelset.writeString(OINOContentType.json))
54
+ return new Response(result.data.writeString(OINOContentType.json))
55
55
  ```
56
56
 
57
57
 
@@ -129,12 +129,13 @@
129
129
  - Bun Sqlite through Bun native implementation
130
130
  - Postgresql through [pg](https://www.npmjs.com/package/pg)-package
131
131
  - Mariadb / Mysql-support through [mariadb](https://www.npmjs.com/package/mariadb)-package
132
+ - Sql Server through [mssql](https://www.npmjs.com/package/mssql)-package
132
133
 
133
134
  ## Complex Keys
134
135
  To support tables with multipart primary keys OINO generates a composite key `_OINOID_` that is included in the result and can be used as the REST ID. For example in the example above table `OrderDetails` has two primary keys `OrderID` and `ProductID` making the `_OINOID_` of form `11077:99`.
135
136
 
136
137
  ## Power Of SQL
137
- Since OINO controls the SQL, WHERE-conditions can be defined with [`OINOSqlFilter`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlFilter.html) and order with [`OINOSqlOrder`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlOrder.html) that are passed as HTTP request parameters. No more API development where you make unique API endpoints for each filter that fetch all data with original API and filter in backend code. Every API can be filtered when and as needed without unnessecary data tranfer and utilizing SQL indexing when available.
138
+ Since OINO is just generating SQL, WHERE-conditions can be defined with [`OINOSqlFilter`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlFilter.html) and order with [`OINOSqlOrder`](https://pragmatta.github.io/oino-ts/classes/db_src.OINODbSqlOrder.html) that are passed as HTTP request parameters. No more API development where you make unique API endpoints for each filter that fetch all data with original API and filter in backend code. Every API can be filtered when and as needed without unnessecary data tranfer and utilizing SQL indexing when available.
138
139
 
139
140
  ## Swagger Support
140
141
  Swagger is great as long as the definitions are updated and with OINO you can automatically get a Swagger definition including a data model schema.
@@ -158,7 +159,7 @@
158
159
  # STATUS
159
160
  OINO is currently a hobby project which should and should considered in alpha status. That also means compatibility breaking changes can be made without prior notice when architectual issues are discovered.
160
161
 
161
- ## Beta
162
+ ## Beta
162
163
  For a beta status following milestones are planned:
163
164
 
164
165
  ### Realistic app
@@ -205,14 +206,16 @@
205
206
  # LINKS
206
207
  - [Github repository](https://github.com/pragmatta/oino-ts)
207
208
  - [NPM repository](https://www.npmjs.com/org/oino-ts)
208
-
209
+
209
210
 
210
211
  # ACKNOWLEDGEMENTS
211
212
 
212
213
  ## Libraries
213
214
  OINO uses the following open source libraries and npm packages and I would like to thank everyone for their contributions:
214
- - Postgresql support by [node-postgres package](https://www.npmjs.com/package/pg)
215
- - Mariadb / Mysql-support by [mariadb package](https://www.npmjs.com/package/mariadb)
215
+ - Postgresql [node-postgres package](https://www.npmjs.com/package/pg)
216
+ - Mariadb / Mysql [mariadb package](https://www.npmjs.com/package/mariadb)
217
+ - Sql Server [mssql package](https://www.npmjs.com/package/mssql)
218
+ - Custom base encoding [base-x package](https://www.npmjs.com/package/base-x)
216
219
 
217
220
  ## Bun
218
221
  OINO has been developed using the Bun runtime, not because of the speed improvements but for the first class Typescript support and integrated developper experience. Kudos on the bun team for making Typescript work more exiting again.
@@ -36,7 +36,7 @@ class OINODbBunSqlite extends db_1.OINODb {
36
36
  if (!this._params.url.startsWith("file://")) {
37
37
  throw new Error(db_1.OINO_ERROR_PREFIX + ": OINODbBunSqlite url must be a file://-url!");
38
38
  }
39
- db_1.OINOLog.debug("OINODbBunSqlite.constructor", { params: params });
39
+ // OINOLog.debug("OINODbBunSqlite.constructor", {params:params})
40
40
  if (this._params.type !== "OINODbBunSqlite") {
41
41
  throw new Error(db_1.OINO_ERROR_PREFIX + ": Not OINODbBunSqlite-type: " + this._params.type);
42
42
  }
@@ -134,7 +134,7 @@ class OINODbBunSqlite extends db_1.OINODb {
134
134
  connect() {
135
135
  const filepath = this._params.url.substring(7);
136
136
  try {
137
- db_1.OINOLog.debug("OINODbBunSqlite.connect", { params: this._params });
137
+ // OINOLog.debug("OINODbBunSqlite.connect", {params:this._params})
138
138
  this._db = bun_sqlite_1.Database.open(filepath, { create: true, readonly: false, readwrite: true });
139
139
  // OINOLog.debug("OINODbBunSqlite.connect done")
140
140
  return Promise.resolve(true);
@@ -33,7 +33,7 @@ export class OINODbBunSqlite extends OINODb {
33
33
  if (!this._params.url.startsWith("file://")) {
34
34
  throw new Error(OINO_ERROR_PREFIX + ": OINODbBunSqlite url must be a file://-url!");
35
35
  }
36
- OINOLog.debug("OINODbBunSqlite.constructor", { params: params });
36
+ // OINOLog.debug("OINODbBunSqlite.constructor", {params:params})
37
37
  if (this._params.type !== "OINODbBunSqlite") {
38
38
  throw new Error(OINO_ERROR_PREFIX + ": Not OINODbBunSqlite-type: " + this._params.type);
39
39
  }
@@ -131,7 +131,7 @@ export class OINODbBunSqlite extends OINODb {
131
131
  connect() {
132
132
  const filepath = this._params.url.substring(7);
133
133
  try {
134
- OINOLog.debug("OINODbBunSqlite.connect", { params: this._params });
134
+ // OINOLog.debug("OINODbBunSqlite.connect", {params:this._params})
135
135
  this._db = BunSqliteDb.open(filepath, { create: true, readonly: false, readwrite: true });
136
136
  // OINOLog.debug("OINODbBunSqlite.connect done")
137
137
  return Promise.resolve(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oino-ts/db-bunsqlite",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "OINO TS package for using Bun Sqlite databases.",
5
5
  "author": "Matias Kiviniemi (pragmatta)",
6
6
  "license": "MPL-2.0",
@@ -20,7 +20,7 @@
20
20
  "module": "./dist/esm/index.js",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "dependencies": {
23
- "@oino-ts/db": "^0.0.14"
23
+ "@oino-ts/db": "^0.0.16"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.12.7",
@@ -39,7 +39,7 @@ export class OINODbBunSqlite extends OINODb {
39
39
  if (!this._params.url.startsWith("file://")) {
40
40
  throw new Error(OINO_ERROR_PREFIX + ": OINODbBunSqlite url must be a file://-url!")
41
41
  }
42
- OINOLog.debug("OINODbBunSqlite.constructor", {params:params})
42
+ // OINOLog.debug("OINODbBunSqlite.constructor", {params:params})
43
43
 
44
44
  if (this._params.type !== "OINODbBunSqlite") {
45
45
  throw new Error(OINO_ERROR_PREFIX + ": Not OINODbBunSqlite-type: " + this._params.type)
@@ -144,7 +144,7 @@ export class OINODbBunSqlite extends OINODb {
144
144
  connect(): Promise<boolean> {
145
145
  const filepath:string = this._params.url.substring(7)
146
146
  try {
147
- OINOLog.debug("OINODbBunSqlite.connect", {params:this._params})
147
+ // OINOLog.debug("OINODbBunSqlite.connect", {params:this._params})
148
148
  this._db = BunSqliteDb.open(filepath, { create: true, readonly: false, readwrite: true })
149
149
  // OINOLog.debug("OINODbBunSqlite.connect done")
150
150
  return Promise.resolve(true)