duckdb-tinyorm 1.0.23 → 1.0.24
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/.github/workflows/publish.yml +43 -43
- package/README.md +79 -79
- package/package.json +43 -43
- package/tsconfig.json +23 -23
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
name: Publish npm Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*.*.*' # This triggers the action only when a tag with the format 'vX.X.X' is pushed
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout repository
|
|
14
|
-
uses: actions/checkout@v3
|
|
15
|
-
|
|
16
|
-
- name: Set up Node.js
|
|
17
|
-
uses: actions/setup-node@v3
|
|
18
|
-
with:
|
|
19
|
-
node-version: '22' # Use the version you prefer
|
|
20
|
-
cache: 'npm'
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: npm install
|
|
24
|
-
|
|
25
|
-
- name: Run tests
|
|
26
|
-
run: npm test
|
|
27
|
-
|
|
28
|
-
- name: Build the library
|
|
29
|
-
run: npm run build
|
|
30
|
-
|
|
31
|
-
- name: Publish to npm
|
|
32
|
-
env:
|
|
33
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
|
-
run: npm publish
|
|
35
|
-
if: startsWith(github.ref, 'refs/tags/v')
|
|
36
|
-
|
|
37
|
-
- name: Bump version
|
|
38
|
-
run: |
|
|
39
|
-
npm version patch
|
|
40
|
-
git config user.name "Naim Sulejmani"
|
|
41
|
-
git config user.email "naim.sulejmani@gmail.com"
|
|
42
|
-
git push origin HEAD --tags
|
|
43
|
-
|
|
1
|
+
name: Publish npm Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*' # This triggers the action only when a tag with the format 'vX.X.X' is pushed
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repository
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
|
|
16
|
+
- name: Set up Node.js
|
|
17
|
+
uses: actions/setup-node@v3
|
|
18
|
+
with:
|
|
19
|
+
node-version: '22' # Use the version you prefer
|
|
20
|
+
cache: 'npm'
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm install
|
|
24
|
+
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: npm test
|
|
27
|
+
|
|
28
|
+
- name: Build the library
|
|
29
|
+
run: npm run build
|
|
30
|
+
|
|
31
|
+
- name: Publish to npm
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
34
|
+
run: npm publish
|
|
35
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
36
|
+
|
|
37
|
+
- name: Bump version
|
|
38
|
+
run: |
|
|
39
|
+
npm version patch
|
|
40
|
+
git config user.name "Naim Sulejmani"
|
|
41
|
+
git config user.email "naim.sulejmani@gmail.com"
|
|
42
|
+
git push origin HEAD --tags
|
|
43
|
+
|
package/README.md
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
# DuckDB Tiny ORM
|
|
2
|
-
|
|
3
|
-
Usage:
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import 'reflect-metadata';
|
|
7
|
-
import { DuckDbRepository, Entity, Repository, DataTypeDecorator, BaseRepository, Id ,DuckDbLocation, DuckDbConfig } from 'duckdb-tinyorm';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//create instance in memory or use File, if File is specfied need to specify the filename
|
|
12
|
-
const duckDbRepository: DuckDbRepository = DuckDbRepository.getInstances({name: 'default', location: DuckDbLocation.Memory, filename: undefined})
|
|
13
|
-
|
|
14
|
-
@Entity
|
|
15
|
-
export class Subject {
|
|
16
|
-
|
|
17
|
-
constructor(id: string = "", name?: string, description?: string, year: number = (new Date()).getFullYear()) {
|
|
18
|
-
this.Id = id;
|
|
19
|
-
this.Name = name;
|
|
20
|
-
this.Description = description;
|
|
21
|
-
this.Year = year;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Id()
|
|
25
|
-
@DataTypeDecorator('VARCHAR')
|
|
26
|
-
Id: string ;
|
|
27
|
-
|
|
28
|
-
@DataTypeDecorator('VARCHAR')
|
|
29
|
-
Name?: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@DataTypeDecorator('VARCHAR')
|
|
33
|
-
Description?: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@DataTypeDecorator('INT')
|
|
37
|
-
Year: number;
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Repository(Subject)
|
|
42
|
-
class SubjectRepository extends BaseRepository<Subject, string> {
|
|
43
|
-
constructor() {
|
|
44
|
-
super(duckDbRepository);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
async function test() {
|
|
50
|
-
const subjectRepository = new SubjectRepository();
|
|
51
|
-
|
|
52
|
-
const subject1 = new Subject('JB', "Java Basic", "Java Basic", 2024);
|
|
53
|
-
const subject2 = new Subject('OOP', "Java OOP", "Java Object Oriented Programming", 2024);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//save records (as for now just insert a new record)
|
|
57
|
-
await subjectRepository.save(subject1);
|
|
58
|
-
await subjectRepository.save(subject2);
|
|
59
|
-
|
|
60
|
-
//find all records
|
|
61
|
-
const result = await subjectRepository.findAll();
|
|
62
|
-
console.table(result);
|
|
63
|
-
|
|
64
|
-
//find records by primary key
|
|
65
|
-
const subjectFound1: Subject = await subjectRepository.findById("JB");
|
|
66
|
-
console.info(subjectFound1);
|
|
67
|
-
const subjectFound2: Subject = await subjectRepository.findById("OOP");
|
|
68
|
-
console.info(subjectFound2);
|
|
69
|
-
|
|
70
|
-
//delete one record by primary key
|
|
71
|
-
|
|
72
|
-
await subjectRepository.removeById("JB");
|
|
73
|
-
|
|
74
|
-
const amenities = await subjectRepository.findBy({ Year: 2024 }, ["Year"]);
|
|
75
|
-
console.table(amenities);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
test();
|
|
79
|
-
```
|
|
1
|
+
# DuckDB Tiny ORM
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import 'reflect-metadata';
|
|
7
|
+
import { DuckDbRepository, Entity, Repository, DataTypeDecorator, BaseRepository, Id ,DuckDbLocation, DuckDbConfig } from 'duckdb-tinyorm';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
//create instance in memory or use File, if File is specfied need to specify the filename
|
|
12
|
+
const duckDbRepository: DuckDbRepository = DuckDbRepository.getInstances({name: 'default', location: DuckDbLocation.Memory, filename: undefined})
|
|
13
|
+
|
|
14
|
+
@Entity
|
|
15
|
+
export class Subject {
|
|
16
|
+
|
|
17
|
+
constructor(id: string = "", name?: string, description?: string, year: number = (new Date()).getFullYear()) {
|
|
18
|
+
this.Id = id;
|
|
19
|
+
this.Name = name;
|
|
20
|
+
this.Description = description;
|
|
21
|
+
this.Year = year;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Id()
|
|
25
|
+
@DataTypeDecorator('VARCHAR')
|
|
26
|
+
Id: string ;
|
|
27
|
+
|
|
28
|
+
@DataTypeDecorator('VARCHAR')
|
|
29
|
+
Name?: string;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@DataTypeDecorator('VARCHAR')
|
|
33
|
+
Description?: string;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@DataTypeDecorator('INT')
|
|
37
|
+
Year: number;
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Repository(Subject)
|
|
42
|
+
class SubjectRepository extends BaseRepository<Subject, string> {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(duckDbRepository);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
async function test() {
|
|
50
|
+
const subjectRepository = new SubjectRepository();
|
|
51
|
+
|
|
52
|
+
const subject1 = new Subject('JB', "Java Basic", "Java Basic", 2024);
|
|
53
|
+
const subject2 = new Subject('OOP', "Java OOP", "Java Object Oriented Programming", 2024);
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
//save records (as for now just insert a new record)
|
|
57
|
+
await subjectRepository.save(subject1);
|
|
58
|
+
await subjectRepository.save(subject2);
|
|
59
|
+
|
|
60
|
+
//find all records
|
|
61
|
+
const result = await subjectRepository.findAll();
|
|
62
|
+
console.table(result);
|
|
63
|
+
|
|
64
|
+
//find records by primary key
|
|
65
|
+
const subjectFound1: Subject = await subjectRepository.findById("JB");
|
|
66
|
+
console.info(subjectFound1);
|
|
67
|
+
const subjectFound2: Subject = await subjectRepository.findById("OOP");
|
|
68
|
+
console.info(subjectFound2);
|
|
69
|
+
|
|
70
|
+
//delete one record by primary key
|
|
71
|
+
|
|
72
|
+
await subjectRepository.removeById("JB");
|
|
73
|
+
|
|
74
|
+
const amenities = await subjectRepository.findBy({ Year: 2024 }, ["Year"]);
|
|
75
|
+
console.table(amenities);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
test();
|
|
79
|
+
```
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "duckdb-tinyorm",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "TinyORM for Duckdb, easy setup",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"prepublishOnly": "npm run build",
|
|
10
|
-
"test": "echo 'Test not implemented'",
|
|
11
|
-
"dev": "nodemon --exec ts-node src/test.ts",
|
|
12
|
-
"start": "node dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/naimsulejmani/duckdb-tinyorm.git"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"duckdb",
|
|
20
|
-
"orm",
|
|
21
|
-
"tinyorm",
|
|
22
|
-
"database"
|
|
23
|
-
],
|
|
24
|
-
"author": "Naim Sulejmani",
|
|
25
|
-
"license": "ISC",
|
|
26
|
-
"bugs": {
|
|
27
|
-
"url": "https://github.com/naimsulejmani/duckdb-tinyorm/issues"
|
|
28
|
-
},
|
|
29
|
-
"homepage": "https://github.com/naimsulejmani/duckdb-tinyorm#readme",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@types/node": "^22.7.4",
|
|
32
|
-
"dotenv": "^16.4.5",
|
|
33
|
-
"duckdb": "^1.1.0",
|
|
34
|
-
"duckdb-tinyorm": "^1.0.10",
|
|
35
|
-
"globals": "^15.9.0",
|
|
36
|
-
"nodemon": "^3.1.7",
|
|
37
|
-
"npm": "^10.8.3",
|
|
38
|
-
"reflect-metadata": "^0.2.2",
|
|
39
|
-
"rimraf": "^6.0.1",
|
|
40
|
-
"ts-node": "^10.9.2",
|
|
41
|
-
"typescript": "^5.6.2"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "duckdb-tinyorm",
|
|
3
|
+
"version": "1.0.24",
|
|
4
|
+
"description": "TinyORM for Duckdb, easy setup",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"test": "echo 'Test not implemented'",
|
|
11
|
+
"dev": "nodemon --exec ts-node src/test.ts",
|
|
12
|
+
"start": "node dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/naimsulejmani/duckdb-tinyorm.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"duckdb",
|
|
20
|
+
"orm",
|
|
21
|
+
"tinyorm",
|
|
22
|
+
"database"
|
|
23
|
+
],
|
|
24
|
+
"author": "Naim Sulejmani",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/naimsulejmani/duckdb-tinyorm/issues"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://github.com/naimsulejmani/duckdb-tinyorm#readme",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@types/node": "^22.7.4",
|
|
32
|
+
"dotenv": "^16.4.5",
|
|
33
|
+
"duckdb": "^1.1.0",
|
|
34
|
+
"duckdb-tinyorm": "^1.0.10",
|
|
35
|
+
"globals": "^15.9.0",
|
|
36
|
+
"nodemon": "^3.1.7",
|
|
37
|
+
"npm": "^10.8.3",
|
|
38
|
+
"reflect-metadata": "^0.2.2",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
40
|
+
"ts-node": "^10.9.2",
|
|
41
|
+
"typescript": "^5.6.2"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": [
|
|
4
|
-
"ES2023"
|
|
5
|
-
],
|
|
6
|
-
"module": "Node16",
|
|
7
|
-
"target": "ESNext",
|
|
8
|
-
"moduleResolution": "Node16",
|
|
9
|
-
"moduleDetection": "force",
|
|
10
|
-
"outDir": "./dist",
|
|
11
|
-
"rootDir": "./src",
|
|
12
|
-
"strict": true, // Enabled for better type safety
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"allowJs": true,
|
|
15
|
-
"declaration": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"experimentalDecorators": true,
|
|
18
|
-
"allowSyntheticDefaultImports": true,
|
|
19
|
-
"forceConsistentCasingInFileNames": true,
|
|
20
|
-
"skipDefaultLibCheck": true,
|
|
21
|
-
"sourceMap": true,
|
|
22
|
-
"emitDecoratorMetadata": true
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": [
|
|
4
|
+
"ES2023"
|
|
5
|
+
],
|
|
6
|
+
"module": "Node16",
|
|
7
|
+
"target": "ESNext",
|
|
8
|
+
"moduleResolution": "Node16",
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"rootDir": "./src",
|
|
12
|
+
"strict": true, // Enabled for better type safety
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"allowSyntheticDefaultImports": true,
|
|
19
|
+
"forceConsistentCasingInFileNames": true,
|
|
20
|
+
"skipDefaultLibCheck": true,
|
|
21
|
+
"sourceMap": true,
|
|
22
|
+
"emitDecoratorMetadata": true
|
|
23
|
+
}
|
|
24
24
|
}
|