@procxo/shared 1.0.1 → 1.0.3

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.
Files changed (35) hide show
  1. package/dist/config/ormconfig.factory.d.ts.map +1 -1
  2. package/dist/config/ormconfig.factory.js +1 -0
  3. package/dist/config/ormconfig.factory.js.map +1 -1
  4. package/dist/database/entities/index.d.ts +3 -0
  5. package/dist/database/entities/index.d.ts.map +1 -1
  6. package/dist/database/entities/index.js +3 -0
  7. package/dist/database/entities/index.js.map +1 -1
  8. package/dist/database/entities/tenant-configuration.entity.d.ts +16 -0
  9. package/dist/database/entities/tenant-configuration.entity.d.ts.map +1 -0
  10. package/dist/database/entities/tenant-configuration.entity.js +77 -0
  11. package/dist/database/entities/tenant-configuration.entity.js.map +1 -0
  12. package/dist/database/entities/tenant-module.entity.d.ts +11 -0
  13. package/dist/database/entities/tenant-module.entity.d.ts.map +1 -0
  14. package/dist/database/entities/tenant-module.entity.js +50 -0
  15. package/dist/database/entities/tenant-module.entity.js.map +1 -0
  16. package/dist/database/entities/tenant-sub-module.entity.d.ts +9 -0
  17. package/dist/database/entities/tenant-sub-module.entity.d.ts.map +1 -0
  18. package/dist/database/entities/tenant-sub-module.entity.js +45 -0
  19. package/dist/database/entities/tenant-sub-module.entity.js.map +1 -0
  20. package/dist/database/migrations/{1770706648232-initialMigration.d.ts → 1770794314727-initialMigration.d.ts} +2 -2
  21. package/dist/database/migrations/1770794314727-initialMigration.d.ts.map +1 -0
  22. package/dist/database/migrations/{1770706648232-initialMigration.js → 1770794314727-initialMigration.js} +5 -5
  23. package/dist/database/migrations/{1770706648232-initialMigration.js.map → 1770794314727-initialMigration.js.map} +1 -1
  24. package/dist/database/migrations/1771421233389-initialTenantConfiguration_module_submodule_tables.d.ts +7 -0
  25. package/dist/database/migrations/1771421233389-initialTenantConfiguration_module_submodule_tables.d.ts.map +1 -0
  26. package/dist/database/migrations/1771421233389-initialTenantConfiguration_module_submodule_tables.js +26 -0
  27. package/dist/database/migrations/1771421233389-initialTenantConfiguration_module_submodule_tables.js.map +1 -0
  28. package/dist/database/migrations/1771494127263-added_tenantUserfieldInTenantConfigurationTable.d.ts +7 -0
  29. package/dist/database/migrations/1771494127263-added_tenantUserfieldInTenantConfigurationTable.d.ts.map +1 -0
  30. package/dist/database/migrations/1771494127263-added_tenantUserfieldInTenantConfigurationTable.js +14 -0
  31. package/dist/database/migrations/1771494127263-added_tenantUserfieldInTenantConfigurationTable.js.map +1 -0
  32. package/dist/tsconfig.build.tsbuildinfo +1 -1
  33. package/package.json +50 -68
  34. package/README.md +0 -250
  35. package/dist/database/migrations/1770706648232-initialMigration.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,68 +1,50 @@
1
- {
2
- "name": "@procxo/shared",
3
- "version": "1.0.1",
4
- "description": "Shared library for Invoice Management - centralized entities, migrations, and seeders",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc -p tsconfig.build.json",
9
- "build:watch": "tsc -p tsconfig.build.json --watch",
10
- "clean": "rimraf dist",
11
- "prebuild": "npm run clean",
12
- "typeorm": "cross-env NODE_ENV=migration ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d src/config/typeorm.config.ts",
13
- "migration:generate": "npm run typeorm -- migration:generate",
14
- "migration:create": "npm run typeorm -- migration:create",
15
- "migration:run": "npm run typeorm -- migration:run",
16
- "migration:revert": "npm run typeorm -- migration:revert",
17
- "migration:show": "npm run typeorm -- migration:show",
18
- "schema:create": "ts-node -r tsconfig-paths/register src/scripts/create-schema.ts",
19
- "seed:run": "ts-node -r tsconfig-paths/register src/database/seeder/seed-runner.ts"
20
- },
21
- "dependencies": {
22
- "class-transformer": "^0.5.1",
23
- "class-validator": "^0.14.1",
24
- "dotenv": "^16.4.7",
25
- "pg": "^8.14.0",
26
- "reflect-metadata": "^0.2.2",
27
- "typeorm": "^0.3.21"
28
- },
29
- "devDependencies": {
30
- "@jorgebodega/typeorm-seeding": "^7.1.0",
31
- "@nestjs/common": "^11.0.1",
32
- "@nestjs/typeorm": "^11.0.0",
33
- "cross-env": "^7.0.3",
34
- "rimraf": "^5.0.5",
35
- "ts-node": "^10.9.2",
36
- "tsconfig-paths": "^4.2.0",
37
- "typescript": "^5.7.3"
38
- },
39
- "peerDependencies": {
40
- "@nestjs/common": ">=11.0.0",
41
- "@nestjs/typeorm": ">=11.0.0",
42
- "typeorm": ">=0.3.21"
43
- },
44
- "files": [
45
- "dist/**/*"
46
- ],
47
- "keywords": [
48
- "typeorm",
49
- "database",
50
- "migrations",
51
- "seeders",
52
- "nestjs",
53
- "postgres",
54
- "entities",
55
- "invoice-management",
56
- "orm"
57
- ],
58
- "author": "Procxo hello@procxo.ai",
59
- "license": "UNLICENSED",
60
- "repository": {
61
- "type": "git",
62
- "url": "https://ntgitlab.novatechset.com/invoice_management/shared-lib.git"
63
- },
64
- "bugs": {
65
- "url": "https://ntgitlab.novatechset.com/invoice_management/shared-lib.git"
66
- },
67
- "homepage": "https://ntgitlab.novatechset.com/invoice_management/shared-lib.git#readme"
68
- }
1
+ {
2
+ "name": "@procxo/shared",
3
+ "version": "1.0.3",
4
+ "description": "Shared library for Invoice Management - centralized entities, migrations, and seeders",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "build:watch": "tsc -p tsconfig.build.json --watch",
10
+ "clean": "rimraf dist",
11
+ "prebuild": "npm run clean",
12
+ "typeorm": "cross-env NODE_ENV=migration ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js -d src/config/typeorm.config.ts",
13
+ "migration:generate": "npm run typeorm -- migration:generate",
14
+ "migration:create": "npm run typeorm -- migration:create",
15
+ "migration:run": "npm run typeorm -- migration:run",
16
+ "migration:revert": "npm run typeorm -- migration:revert",
17
+ "migration:show": "npm run typeorm -- migration:show",
18
+ "schema:create": "ts-node -r tsconfig-paths/register src/scripts/create-schema.ts",
19
+ "seed:run": "ts-node -r tsconfig-paths/register src/database/seeder/seed-runner.ts"
20
+ },
21
+ "dependencies": {
22
+ "class-transformer": "^0.5.1",
23
+ "class-validator": "^0.14.1",
24
+ "dotenv": "^16.4.7",
25
+ "pg": "^8.14.0",
26
+ "reflect-metadata": "^0.2.2",
27
+ "typeorm": "^0.3.21"
28
+ },
29
+ "devDependencies": {
30
+ "@jorgebodega/typeorm-seeding": "^7.1.0",
31
+ "@nestjs/common": "^11.0.1",
32
+ "@nestjs/typeorm": "^11.0.0",
33
+ "cross-env": "^7.0.3",
34
+ "rimraf": "^5.0.5",
35
+ "ts-node": "^10.9.2",
36
+ "tsconfig-paths": "^4.2.0",
37
+ "typescript": "^5.7.3"
38
+ },
39
+ "peerDependencies": {
40
+ "@nestjs/common": ">=11.0.0",
41
+ "@nestjs/typeorm": ">=11.0.0",
42
+ "typeorm": ">=0.3.21"
43
+ },
44
+ "files": [
45
+ "dist"
46
+ ],
47
+ "keywords": [],
48
+ "author": "",
49
+ "license": "UNLICENSED"
50
+ }
package/README.md DELETED
@@ -1,250 +0,0 @@
1
- # @invoice-management/shared
2
-
3
- A shared TypeORM library providing centralized database entities, migrations, and seeders for Invoice Management applications.
4
-
5
- ## Features
6
-
7
- - 🗄️ **70+ Pre-built TypeORM Entities** - Ready-to-use database models
8
- - 🔄 **Automatic Schema Management** - Create schemas across multiple databases
9
- - 📦 **Database Migrations** - Version-controlled schema changes
10
- - 🌱 **Smart Seeders** - Pre-configured data seeding with admin user
11
- - ⚙️ **Dynamic Configuration** - Flexible ORM config factory for NestJS
12
- - 📊 **Multi-Schema Support** - user, core, timesheet, notification schemas
13
-
14
- ## Installation
15
-
16
- ```bash
17
- npm install @invoice-management/shared
18
- ```
19
-
20
- ### Prerequisites
21
-
22
- - Node.js >= 16
23
- - PostgreSQL database
24
- - NestJS >= 11 (for integration)
25
- - TypeORM >= 0.3.21
26
-
27
- ## Quick Start
28
-
29
- ### 1. Configure Environment Variables
30
-
31
- Create a `.env` file in your project root:
32
-
33
- ```env
34
- DB_HOST=localhost
35
- DB_PORT=5432
36
- DB_USERNAME=postgres
37
- DB_PASSWORD=postgres
38
- DB_NAME=your_database
39
- NODE_ENV=development
40
- ```
41
-
42
- ### 2. Use in NestJS Application
43
-
44
- ```typescript
45
- import { Module } from '@nestjs/common';
46
- import { TypeOrmModule } from '@nestjs/typeorm';
47
- import { createOrmConfig } from '@invoice-management/shared';
48
-
49
- @Module({
50
- imports: [
51
- TypeOrmModule.forRoot(
52
- createOrmConfig({
53
- schema: 'core', // or 'user', 'timesheet', 'notification'
54
- synchronize: false,
55
- logging: true,
56
- })
57
- ),
58
- ],
59
- })
60
- export class AppModule {}
61
- ```
62
-
63
- ### 3. Import Entities
64
-
65
- ```typescript
66
- import {
67
- User,
68
- Role,
69
- Permission,
70
- Invoice,
71
- Task,
72
- Matter,
73
- Timesheet,
74
- } from '@invoice-management/shared';
75
-
76
- // Use entities in your services/repositories
77
- ```
78
-
79
- ## Database Setup
80
-
81
- Run these commands in order for initial setup:
82
-
83
- ```bash
84
- # 1. Create database schemas
85
- npm run schema:create
86
-
87
- # 2. Generate initial migration (first time only)
88
- npm run migration:generate -- src/database/migrations/initialMigration
89
-
90
- # 3. Run migrations
91
- npm run migration:run
92
-
93
- # 4. Seed initial data (admin user, roles, permissions)
94
- npm run seed:run
95
- ```
96
-
97
- ## Available Commands
98
-
99
- ### Schema Management
100
-
101
- ```bash
102
- npm run schema:create # Create all required database schemas
103
- ```
104
-
105
- ### Migrations
106
-
107
- ```bash
108
- npm run migration:generate -- <path> # Generate new migration from entity changes
109
- npm run migration:create -- <name> # Create empty migration file
110
- npm run migration:run # Execute pending migrations
111
- npm run migration:revert # Revert last migration
112
- npm run migration:show # Show migration status
113
- ```
114
-
115
- ### Seeding
116
-
117
- ```bash
118
- npm run seed:run # Run all seeders (departments, roles, admin user, etc.)
119
- ```
120
-
121
- ### Build
122
-
123
- ```bash
124
- npm run build # Compile TypeScript to dist/
125
- npm run build:watch # Watch mode for development
126
- ```
127
-
128
- ## API Reference
129
-
130
- ### `createOrmConfig(options: OrmConfigOptions)`
131
-
132
- Factory function to generate TypeORM configuration for NestJS.
133
-
134
- **Options:**
135
- - `schema` (required): Target database schema
136
- - `additionalEntities`: Extra entities specific to your service
137
- - `synchronize`: Auto-sync entities (default: false)
138
- - `logging`: Enable query logging
139
-
140
- **Example:**
141
- ```typescript
142
- createOrmConfig({
143
- schema: 'timesheet',
144
- additionalEntities: [CustomEntity],
145
- synchronize: false,
146
- logging: true,
147
- });
148
- ```
149
-
150
- ### `getAllSharedEntities()`
151
-
152
- Returns all entity classes from the shared library.
153
-
154
- ```typescript
155
- import { getAllSharedEntities } from '@invoice-management/shared';
156
-
157
- const entities = getAllSharedEntities(); // Returns array of entity classes
158
- ```
159
-
160
- ## Included Seeders
161
-
162
- The package includes pre-configured seeders for:
163
-
164
- - ✅ **Departments** - Default organizational departments
165
- - ✅ **Permissions** - System-wide permissions
166
- - ✅ **Roles** - Admin, User roles with hierarchies
167
- - ✅ **Admin User** - Default admin account
168
- - ✅ **Currency** - Common currencies
169
- - ✅ **Countries & Cities** - Geographic data
170
-
171
- ## Entity Categories
172
-
173
- | Schema | Entities |
174
- |--------|----------|
175
- | **User** | User, Role, Permission, Department, Leave, Approvals, Sessions |
176
- | **Core** | Client, Matter, Task, Invoice, Payment, Template, QuickBooks |
177
- | **Timesheet** | Timesheet, Event, Shift, Holiday |
178
- | **Notification** | Alert, Preferences, Channels |
179
-
180
- ## Publishing This Package
181
-
182
- ### Before Publishing
183
-
184
- 1. Update version in `package.json`:
185
- ```bash
186
- npm version patch # or minor/major
187
- ```
188
-
189
- 2. Build the package:
190
- ```bash
191
- npm run build
192
- ```
193
-
194
- 3. Verify build output in `dist/` folder
195
-
196
- ### Publish to npm Registry
197
-
198
- ```bash
199
- # Login to npm (first time)
200
- npm login
201
-
202
- # Publish package
203
- npm publish --access public
204
- ```
205
-
206
- ### Publish to GitHub Packages (Alternative)
207
-
208
- Add to `package.json`:
209
- ```json
210
- {
211
- "publishConfig": {
212
- "registry": "https://npm.pkg.github.com"
213
- }
214
- }
215
- ```
216
-
217
- Then publish:
218
- ```bash
219
- npm publish
220
- ```
221
-
222
- ## Development
223
-
224
- ```bash
225
- # Install dependencies
226
- npm install
227
-
228
- # Build package
229
- npm run build
230
-
231
- # Watch mode for development
232
- npm run build:watch
233
- ```
234
-
235
- ## Environment Support
236
-
237
- - **Development**: Full logging, synchronize enabled
238
- - **Production**: Minimal logging, synchronize disabled
239
-
240
- ## License
241
-
242
- UNLICENSED
243
-
244
- ## Support
245
-
246
- For issues or questions, please contact the development team.
247
-
248
- ---
249
-
250
- **Note**: This is an internal package for Invoice Management applications. Ensure database credentials are properly configured before running migrations or seeders.
@@ -1 +0,0 @@
1
- {"version":3,"file":"1770706648232-initialMigration.d.ts","sourceRoot":"","sources":["../../../src/database/migrations/1770706648232-initialMigration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,6BAA8B,YAAW,kBAAkB;IACpE,IAAI,SAAkC;IAEzB,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0O3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA0O7D"}