zync-nest-data-module 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.
Files changed (84) hide show
  1. package/README.md +672 -0
  2. package/dist/backup/backup.config.d.ts +4 -0
  3. package/dist/backup/backup.config.js +84 -0
  4. package/dist/backup/backup.config.js.map +1 -0
  5. package/dist/backup/backup.interface.d.ts +21 -0
  6. package/dist/backup/backup.interface.js +3 -0
  7. package/dist/backup/backup.interface.js.map +1 -0
  8. package/dist/backup/backup.module.d.ts +2 -0
  9. package/dist/backup/backup.module.js +24 -0
  10. package/dist/backup/backup.module.js.map +1 -0
  11. package/dist/backup/backup.service.d.ts +19 -0
  12. package/dist/backup/backup.service.js +229 -0
  13. package/dist/backup/backup.service.js.map +1 -0
  14. package/dist/backup/index.d.ts +4 -0
  15. package/dist/backup/index.js +21 -0
  16. package/dist/backup/index.js.map +1 -0
  17. package/dist/database/database.module.d.ts +2 -0
  18. package/dist/database/database.module.js +34 -0
  19. package/dist/database/database.module.js.map +1 -0
  20. package/dist/database/database.repository.d.ts +62 -0
  21. package/dist/database/database.repository.js +259 -0
  22. package/dist/database/database.repository.js.map +1 -0
  23. package/dist/database/database.scheme.d.ts +45 -0
  24. package/dist/database/database.scheme.js +187 -0
  25. package/dist/database/database.scheme.js.map +1 -0
  26. package/dist/database/database.service.d.ts +7 -0
  27. package/dist/database/database.service.js +39 -0
  28. package/dist/database/database.service.js.map +1 -0
  29. package/dist/database/database.sync.d.ts +10 -0
  30. package/dist/database/database.sync.js +44 -0
  31. package/dist/database/database.sync.js.map +1 -0
  32. package/dist/database/database.transaction.d.ts +17 -0
  33. package/dist/database/database.transaction.js +101 -0
  34. package/dist/database/database.transaction.js.map +1 -0
  35. package/dist/database/database.uniqueId.d.ts +25 -0
  36. package/dist/database/database.uniqueId.js +68 -0
  37. package/dist/database/database.uniqueId.js.map +1 -0
  38. package/dist/database/database.utils.d.ts +10 -0
  39. package/dist/database/database.utils.js +119 -0
  40. package/dist/database/database.utils.js.map +1 -0
  41. package/dist/database/index.d.ts +8 -0
  42. package/dist/database/index.js +25 -0
  43. package/dist/database/index.js.map +1 -0
  44. package/dist/index.d.ts +3 -0
  45. package/dist/index.js +20 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/service/index.d.ts +1 -0
  48. package/dist/service/index.js +18 -0
  49. package/dist/service/index.js.map +1 -0
  50. package/dist/service/service.d.ts +40 -0
  51. package/dist/service/service.js +182 -0
  52. package/dist/service/service.js.map +1 -0
  53. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  54. package/libs/src/app.controller.ts +84 -0
  55. package/libs/src/app.module.ts +31 -0
  56. package/libs/src/backup/backup.config.ts +45 -0
  57. package/libs/src/backup/backup.interface.ts +21 -0
  58. package/libs/src/backup/backup.module.ts +11 -0
  59. package/libs/src/backup/backup.service.ts +283 -0
  60. package/libs/src/backup/index.ts +4 -0
  61. package/libs/src/database/database.module.ts +26 -0
  62. package/libs/src/database/database.repository.ts +358 -0
  63. package/libs/src/database/database.scheme.ts +128 -0
  64. package/libs/src/database/database.service.ts +36 -0
  65. package/libs/src/database/database.sync.ts +61 -0
  66. package/libs/src/database/database.transaction.ts +101 -0
  67. package/libs/src/database/database.uniqueId.ts +59 -0
  68. package/libs/src/database/database.utils.ts +99 -0
  69. package/libs/src/database/index.ts +8 -0
  70. package/libs/src/index.ts +3 -0
  71. package/libs/src/main.ts +62 -0
  72. package/libs/src/service/index.ts +1 -0
  73. package/libs/src/service/service.ts +201 -0
  74. package/libs/src/test/test.dto.ts +41 -0
  75. package/libs/src/test/test.module.ts +20 -0
  76. package/libs/src/test/test.repository.ts +44 -0
  77. package/libs/src/test/test.resolver.ts +44 -0
  78. package/libs/src/test/test.schema.ts +21 -0
  79. package/libs/src/test/test.service.ts +19 -0
  80. package/libs/tsconfig.lib.json +19 -0
  81. package/nest-cli.json +16 -0
  82. package/package.json +89 -0
  83. package/tsconfig.json +29 -0
  84. package/update-links.js +159 -0
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "zync-nest-data-module",
3
+ "version": "1.0.0",
4
+ "description": "NestJS database module with database backup and file upload utilities",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "build": "tsc -p libs/tsconfig.lib.json",
10
+ "build:lib": "rimraf dist && tsc -p libs/tsconfig.lib.json",
11
+ "build:watch": "tsc -p libs/tsconfig.lib.json --watch",
12
+ "clean": "rimraf dist",
13
+ "prepublishOnly": "npm run build",
14
+ "start": "npm run build && node dist/main.js",
15
+ "start:dev": "npm run build:watch & nodemon dist/main.js",
16
+ "update-links": "node update-links.js",
17
+ "update-links:minor": "node update-links.js minor",
18
+ "update-links:major": "node update-links.js major",
19
+ "update-links:no-build": "node update-links.js --skip-build",
20
+ "update-links:no-version": "node update-links.js --skip-version --skip-build"
21
+ },
22
+ "keywords": [
23
+ "nestjs",
24
+ "database",
25
+ "backup",
26
+ "upload",
27
+ "utilities"
28
+ ],
29
+ "author": "sabiridwan",
30
+ "license": "ISC",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/zynctech/zync-nest-data-module.git"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "packageManager": "pnpm@10.14.0",
39
+ "dependencies": {
40
+ "@apollo/server": "^5.0.0",
41
+ "@as-integrations/express5": "^1.1.2",
42
+ "@graphql-tools/utils": "^10.9.1",
43
+ "@nestjs-modules/mailer": "^2.0.2",
44
+ "@nestjs/apollo": "^13.2.1",
45
+ "@nestjs/axios": "^4.0.1",
46
+ "@nestjs/common": "^11.1.6",
47
+ "@nestjs/config": "^4.0.2",
48
+ "@nestjs/event-emitter": "^3.0.1",
49
+ "@nestjs/graphql": "^13.1.0",
50
+ "@nestjs/mongoose": "^11.0.3",
51
+ "@nestjs/swagger": "^11.2.0",
52
+ "aws-sdk": "^2.1692.0",
53
+ "axios": "^1.11.0",
54
+ "child_process": "^1.0.2",
55
+ "class-transformer": "^0.5.1",
56
+ "class-validator": "^0.14.2",
57
+ "dotenv": "^17.2.2",
58
+ "ejs": "^3.1.10",
59
+ "express": "^5.1.0",
60
+ "firebase-admin": "^13.5.0",
61
+ "googleapis": "^159.0.0",
62
+ "graphql": "^16.11.0",
63
+ "graphql-upload-ts": "^2.1.3",
64
+ "moment": "^2.30.1",
65
+ "mongodb": "^6.20.0",
66
+ "mongoose": "^8.19.2",
67
+ "mongoose-delete": "^1.0.2",
68
+ "puppeteer": "^24.19.0",
69
+ "qs": "^6.14.0",
70
+ "razorpay": "^2.9.6",
71
+ "rxjs": "^7.8.2",
72
+ "sharp": "^0.34.3",
73
+ "shortid": "^2.2.17",
74
+ "slugify": "^1.6.6",
75
+ "uuid": "^11.1.0",
76
+ "xlsx": "^0.18.5",
77
+ "zync-nest-library": "^1.0.23"
78
+ },
79
+ "devDependencies": {
80
+ "@nestjs/cli": "^11.0.10",
81
+ "@nestjs/core": "^11.1.6",
82
+ "@nestjs/platform-express": "^11.1.6",
83
+ "@types/node": "^24.3.1",
84
+ "nodemon": "^3.0.2",
85
+ "rimraf": "^6.0.1",
86
+ "ts-morph": "^24.0.0",
87
+ "typescript": "^5.7.2"
88
+ }
89
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "target": "ES2021",
10
+ "sourceMap": true,
11
+ "outDir": "./dist",
12
+ "baseUrl": "./",
13
+ "incremental": true,
14
+ "skipLibCheck": true,
15
+ "strictNullChecks": false,
16
+ "noImplicitAny": false,
17
+ "strictBindCallApply": false,
18
+ "forceConsistentCasingInFileNames": false,
19
+ "noFallthroughCasesInSwitch": false,
20
+ "esModuleInterop": true
21
+ },
22
+ "include": [
23
+ "libs/**/*"
24
+ ],
25
+ "exclude": [
26
+ "node_modules",
27
+ "dist"
28
+ ]
29
+ }
@@ -0,0 +1,159 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+
7
+ /**
8
+ * Script to update pnpm links when changes are made to zync-nest-library
9
+ * This script will:
10
+ * 1. Build the library
11
+ * 2. Update the version in package.json
12
+ * 3. Re-link to consuming projects
13
+ */
14
+
15
+ // Configuration - projects that use this library
16
+ const CONSUMING_PROJECTS = [
17
+ "/Users/sabiridwan/Projects/Async/zyncount/zyncount-be",
18
+ "/Users/sabiridwan/Projects/MalikStream/ms-gold/msgld-be",
19
+ ];
20
+
21
+ const LIBRARY_PATH =
22
+ "/Users/sabiridwan/Projects/Async/zync-library/zync-nest-libary";
23
+
24
+ function execCommand(command, cwd = process.cwd()) {
25
+ try {
26
+ console.log(`\nšŸ”§ Executing: ${command}`);
27
+ console.log(`šŸ“ In directory: ${cwd}`);
28
+
29
+ const output = execSync(command, {
30
+ cwd,
31
+ stdio: "inherit",
32
+ encoding: "utf8",
33
+ });
34
+
35
+ return output;
36
+ } catch (error) {
37
+ console.error(`āŒ Error executing command: ${command}`);
38
+ console.error(error.message);
39
+ process.exit(1);
40
+ }
41
+ }
42
+
43
+ function updateLibraryVersion(versionType = "patch") {
44
+ console.log(`\nšŸ“¦ Updating library version (${versionType})...`);
45
+ execCommand(`npm version ${versionType} --no-git-tag-version`, LIBRARY_PATH);
46
+
47
+ // Get the new version
48
+ const packageJson = JSON.parse(
49
+ fs.readFileSync(path.join(LIBRARY_PATH, "package.json"), "utf8")
50
+ );
51
+ console.log(`āœ… Updated to version: ${packageJson.version}`);
52
+ return packageJson.version;
53
+ }
54
+
55
+ function buildLibrary() {
56
+ console.log("\nšŸ—ļø Building library...");
57
+ execCommand("pnpm run build", LIBRARY_PATH);
58
+ console.log("āœ… Library built successfully");
59
+ }
60
+
61
+ function linkLibraryGlobally() {
62
+ console.log("\nšŸ”— Linking library globally...");
63
+ execCommand("pnpm link --global", LIBRARY_PATH);
64
+ console.log("āœ… Library linked globally");
65
+ }
66
+
67
+ function updateConsumingProjects() {
68
+ console.log("\nšŸ”„ Updating consuming projects...");
69
+
70
+ for (const projectPath of CONSUMING_PROJECTS) {
71
+ if (!fs.existsSync(projectPath)) {
72
+ console.log(`āš ļø Project not found: ${projectPath}`);
73
+ continue;
74
+ }
75
+
76
+ console.log(`\nšŸ“‚ Updating project: ${path.basename(projectPath)}`);
77
+
78
+ // Unlink first (in case it's already linked)
79
+ try {
80
+ execCommand("pnpm unlink zync-nest-library", projectPath);
81
+ } catch (error) {
82
+ // Ignore errors if not linked
83
+ }
84
+
85
+ // Link the new version
86
+ execCommand("pnpm link zync-nest-library", projectPath);
87
+ console.log(`āœ… Updated ${path.basename(projectPath)}`);
88
+ }
89
+ }
90
+
91
+ function main() {
92
+ console.log("šŸš€ Starting pnpm link update process...");
93
+
94
+ const args = process.argv.slice(2);
95
+ const versionType = args[0] || "patch"; // patch, minor, major
96
+ const skipVersionUpdate = args.includes("--skip-version");
97
+ const skipBuild = args.includes("--skip-build");
98
+
99
+ try {
100
+ // Update version if not skipped
101
+ if (!skipVersionUpdate) {
102
+ updateLibraryVersion(versionType);
103
+ }
104
+
105
+ // Build library if not skipped
106
+ if (!skipBuild) {
107
+ buildLibrary();
108
+ }
109
+
110
+ // Link library globally
111
+ linkLibraryGlobally();
112
+
113
+ // Update consuming projects
114
+ updateConsumingProjects();
115
+
116
+ console.log("\nšŸŽ‰ Pnpm link update completed successfully!");
117
+
118
+ // Show usage information
119
+ console.log("\nšŸ“‹ Next steps:");
120
+ console.log("1. Test your changes in the consuming projects");
121
+ console.log("2. When ready, publish the library: npm publish");
122
+ console.log(
123
+ "3. Update consuming projects to use published version: pnpm update zync-nest-library"
124
+ );
125
+ } catch (error) {
126
+ console.error("\nāŒ Update process failed:", error.message);
127
+ process.exit(1);
128
+ }
129
+ }
130
+
131
+ // Show help
132
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
133
+ console.log(`
134
+ šŸ“– Pnpm Link Update Script
135
+
136
+ Usage:
137
+ node update-links.js [version-type] [options]
138
+
139
+ Arguments:
140
+ version-type Version bump type: patch (default), minor, major
141
+
142
+ Options:
143
+ --skip-version Skip version update
144
+ --skip-build Skip build step
145
+ --help, -h Show this help message
146
+
147
+ Examples:
148
+ node update-links.js # Patch version update with build
149
+ node update-links.js minor # Minor version update with build
150
+ node update-links.js --skip-build # Update links without building
151
+ node update-links.js patch --skip-version --skip-build # Only update links
152
+
153
+ Projects that will be updated:
154
+ ${CONSUMING_PROJECTS.map((p) => ` - ${p}`).join("\n")}
155
+ `);
156
+ process.exit(0);
157
+ }
158
+
159
+ main();