@starbemtech/star-db-query-builder 1.3.0 → 1.4.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 (75) hide show
  1. package/.claude/skills/star-db-query-builder/SKILL.md +104 -0
  2. package/CHANGELOG.md +81 -46
  3. package/LICENSE +21 -0
  4. package/README.md +194 -94
  5. package/bin/install-skill.js +53 -0
  6. package/dist/src/core/repository.d.ts +92 -9
  7. package/dist/src/core/repository.js +275 -27
  8. package/dist/src/core/repository.js.map +1 -1
  9. package/dist/src/core/types.d.ts +17 -2
  10. package/dist/src/core/utils.d.ts +102 -0
  11. package/dist/src/core/utils.js +287 -70
  12. package/dist/src/core/utils.js.map +1 -1
  13. package/dist/src/db/initDb.d.ts +60 -50
  14. package/dist/src/db/initDb.js +96 -64
  15. package/dist/src/db/initDb.js.map +1 -1
  16. package/dist/src/db/mysqlClient.d.ts +3 -8
  17. package/dist/src/db/mysqlClient.js +9 -11
  18. package/dist/src/db/mysqlClient.js.map +1 -1
  19. package/dist/src/db/pgClient.js +0 -2
  20. package/dist/src/db/pgClient.js.map +1 -1
  21. package/dist/src/monitor/monitor.js +7 -0
  22. package/dist/src/monitor/monitor.js.map +1 -1
  23. package/package.json +28 -20
  24. package/.github/workflows/publish.yml +0 -118
  25. package/.prettierignore +0 -3
  26. package/.prettierrc +0 -5
  27. package/ARCHITECTURE.md +0 -313
  28. package/coverage/base.css +0 -224
  29. package/coverage/block-navigation.js +0 -87
  30. package/coverage/favicon.png +0 -0
  31. package/coverage/index.html +0 -131
  32. package/coverage/lcov-report/base.css +0 -224
  33. package/coverage/lcov-report/block-navigation.js +0 -87
  34. package/coverage/lcov-report/favicon.png +0 -0
  35. package/coverage/lcov-report/index.html +0 -131
  36. package/coverage/lcov-report/mysqlClient.ts.html +0 -685
  37. package/coverage/lcov-report/pgClient.ts.html +0 -823
  38. package/coverage/lcov-report/prettify.css +0 -1
  39. package/coverage/lcov-report/prettify.js +0 -2
  40. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  41. package/coverage/lcov-report/sorter.js +0 -210
  42. package/coverage/lcov.info +0 -533
  43. package/coverage/mysqlClient.ts.html +0 -685
  44. package/coverage/pgClient.ts.html +0 -823
  45. package/coverage/prettify.css +0 -1
  46. package/coverage/prettify.js +0 -2
  47. package/coverage/sort-arrow-sprite.png +0 -0
  48. package/coverage/sorter.js +0 -210
  49. package/dist/src/setupTests.d.ts +0 -26
  50. package/dist/src/setupTests.js +0 -43
  51. package/dist/src/setupTests.js.map +0 -1
  52. package/docs/INDEX.md +0 -145
  53. package/docs/methods/findFirst.md +0 -394
  54. package/docs/methods/findMany.md +0 -587
  55. package/docs/methods/insert.md +0 -536
  56. package/docs/methods/insertMany.md +0 -627
  57. package/docs/methods/joins.md +0 -781
  58. package/docs/methods/rawQuery.md +0 -284
  59. package/docs/methods/transactions.md +0 -737
  60. package/eslint.config.mjs +0 -77
  61. package/index.ts +0 -16
  62. package/jest.config.ts +0 -194
  63. package/scripts/release.sh +0 -123
  64. package/src/core/repository.ts +0 -865
  65. package/src/core/types.ts +0 -97
  66. package/src/core/utils.ts +0 -357
  67. package/src/db/IDatabaseClient.ts +0 -16
  68. package/src/db/__tests__/mysqlClient.test.ts +0 -262
  69. package/src/db/__tests__/pgClient.test.ts +0 -260
  70. package/src/db/initDb.ts +0 -181
  71. package/src/db/mysqlClient.ts +0 -200
  72. package/src/db/pgClient.ts +0 -246
  73. package/src/monitor/monitor.ts +0 -16
  74. package/src/setupTests.ts +0 -45
  75. package/tsconfig.test.json +0 -21
package/eslint.config.mjs DELETED
@@ -1,77 +0,0 @@
1
- import js from "@eslint/js";
2
- import globals from "globals";
3
- import tseslint from "typescript-eslint";
4
- import prettier from "eslint-plugin-prettier";
5
- import { defineConfig } from "eslint/config";
6
-
7
- export default defineConfig([
8
- // Ignore patterns (replaces .eslintignore)
9
- {
10
- ignores: [
11
- "dist/**",
12
- "build/**",
13
- "coverage/**",
14
- "node_modules/**",
15
- "*.js",
16
- "*.d.ts",
17
- "examples/**",
18
- ],
19
- },
20
-
21
- // Base configuration for all files
22
- {
23
- files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
24
- languageOptions: {
25
- ecmaVersion: "latest",
26
- sourceType: "module",
27
- globals: {
28
- ...globals.node,
29
- ...globals.es2021,
30
- },
31
- parser: tseslint.parser,
32
- parserOptions: {
33
- ecmaVersion: "latest",
34
- sourceType: "module",
35
- },
36
- },
37
- plugins: {
38
- "@typescript-eslint": tseslint.plugin,
39
- prettier: prettier,
40
- },
41
- rules: {
42
- // Prettier
43
- "prettier/prettier": "error",
44
-
45
- // TypeScript rules
46
- "@typescript-eslint/explicit-function-return-type": "off",
47
- "@typescript-eslint/no-explicit-any": "off",
48
- "@typescript-eslint/explicit-module-boundary-types": "off",
49
- "@typescript-eslint/no-require-imports": "off",
50
- "@typescript-eslint/no-unused-vars": "warn",
51
-
52
- // General rules
53
- "import/prefer-default-export": "off",
54
- "no-param-reassign": "off",
55
- "no-console": "off",
56
- "no-return-assign": "off",
57
- "array-callback-return": "off",
58
- },
59
- },
60
-
61
- // TypeScript specific configuration
62
- ...tseslint.configs.recommended.map(config => ({
63
- ...config,
64
- rules: {
65
- ...config.rules,
66
- "@typescript-eslint/no-explicit-any": "off",
67
- },
68
- })),
69
-
70
- // Prettier configuration
71
- {
72
- files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
73
- rules: {
74
- "prettier/prettier": "error",
75
- },
76
- },
77
- ]);
package/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { PoolConfig as PgPoolConfig, PoolOptions as PgPoolOptions } from 'pg'
2
- import { PoolOptions as MySqlPoolOptions } from 'mysql2'
3
- import { Conditions as TypeConditions } from './src/core/types'
4
-
5
- // Configs
6
- export * from './src/db/initDb'
7
-
8
- // Generic Repository
9
- export * from './src/core/repository'
10
-
11
- // Monitor
12
- export * from './src/monitor/monitor'
13
-
14
- // Types Definition
15
- export type { PgPoolConfig, PgPoolOptions, MySqlPoolOptions, TypeConditions }
16
- export type * from './src/core/types'
package/jest.config.ts DELETED
@@ -1,194 +0,0 @@
1
- /**
2
- * For a detailed explanation regarding each configuration property, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- import type { Config } from 'jest'
7
-
8
- const config: Config = {
9
- // All imported modules in your tests should be mocked automatically
10
- // automock: false,
11
-
12
- // Stop running tests after `n` failures
13
- // bail: 0,
14
-
15
- // The directory where Jest should store its cached dependency information
16
- // cacheDirectory: "/private/var/folders/_3/bjt7nlhj13qd9dj4fnsdvwmc0000gn/T/jest_dx",
17
-
18
- // Automatically clear mock calls, instances, contexts and results before every test
19
- clearMocks: true,
20
-
21
- // Indicates whether the coverage information should be collected while executing the test
22
- collectCoverage: true,
23
-
24
- // An array of glob patterns indicating a set of files for which coverage information should be collected
25
- // collectCoverageFrom: undefined,
26
-
27
- // The directory where Jest should output its coverage files
28
- coverageDirectory: 'coverage',
29
-
30
- // An array of regexp pattern strings used to skip coverage collection
31
- // coveragePathIgnorePatterns: [
32
- // "/node_modules/"
33
- // ],
34
-
35
- // Indicates which provider should be used to instrument code for coverage
36
- coverageProvider: 'v8',
37
-
38
- // A list of reporter names that Jest uses when writing coverage reports
39
- coverageReporters: ['text', 'lcov', 'html'],
40
-
41
- // An object that configures minimum threshold enforcement for coverage results
42
- coverageThreshold: {
43
- global: {
44
- branches: 70,
45
- functions: 70,
46
- lines: 70,
47
- statements: 70,
48
- },
49
- },
50
-
51
- // A path to a custom dependency extractor
52
- // dependencyExtractor: undefined,
53
-
54
- // Make calling deprecated APIs throw helpful error messages
55
- // errorOnDeprecated: false,
56
-
57
- // The default configuration for fake timers
58
- // fakeTimers: {
59
- // "enableGlobally": false
60
- // },
61
-
62
- // Force coverage collection from ignored files using an array of glob patterns
63
- // forceCoverageMatch: [],
64
-
65
- // A path to a module which exports an async function that is triggered once before all test suites
66
- // globalSetup: undefined,
67
-
68
- // A path to a module which exports an async function that is triggered once after all test suites
69
- // globalTeardown: undefined,
70
-
71
- // A set of global variables that need to be available in all test environments
72
- // globals: {},
73
-
74
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
75
- // maxWorkers: "50%",
76
-
77
- // An array of directory names to be searched recursively up from the requiring module's location
78
- // moduleDirectories: [
79
- // "node_modules"
80
- // ],
81
-
82
- // An array of file extensions your modules use
83
- moduleFileExtensions: ['ts', 'js', 'json'],
84
-
85
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
86
- // moduleNameMapper: {},
87
-
88
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
89
- // modulePathIgnorePatterns: [],
90
-
91
- // Activates notifications for test results
92
- // notify: false,
93
-
94
- // An enum that specifies notification mode. Requires { notify: true }
95
- // notifyMode: "failure-change",
96
-
97
- // A preset that is used as a base for Jest's configuration
98
- // preset: undefined,
99
-
100
- // Run tests from one or more projects
101
- // projects: undefined,
102
-
103
- // Use this configuration option to add custom reporters to Jest
104
- // reporters: undefined,
105
-
106
- // Automatically reset mock state before every test
107
- // resetMocks: false,
108
-
109
- // Reset the module registry before running each individual test
110
- // resetModules: false,
111
-
112
- // A path to a custom resolver
113
- // resolver: undefined,
114
-
115
- // Automatically restore mock state and implementation before every test
116
- // restoreMocks: false,
117
-
118
- // The root directory that Jest should scan for tests and modules within
119
- // rootDir: undefined,
120
-
121
- // A list of paths to directories that Jest should use to search for files in
122
- // roots: [
123
- // "<rootDir>"
124
- // ],
125
-
126
- // Allows you to use a custom runner instead of Jest's default test runner
127
- // runner: "jest-runner",
128
-
129
- // The paths to modules that run some code to configure or set up the testing environment before each test
130
- // setupFiles: [],
131
-
132
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
133
- setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
134
-
135
- // The number of seconds after which a test is considered as slow and reported as such in the results.
136
- // slowTestThreshold: 5,
137
-
138
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
139
- // snapshotSerializers: [],
140
-
141
- // The test environment that will be used for testing
142
- testEnvironment: 'node',
143
-
144
- // Options that will be passed to the testEnvironment
145
- // testEnvironmentOptions: {},
146
-
147
- // Adds a location field to test results
148
- // testLocationInResults: false,
149
-
150
- // The glob patterns Jest uses to detect test files
151
- testMatch: ['**/__tests__/**/*.(ts|js)', '**/?(*.)+(spec|test).(ts|js)'],
152
-
153
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
154
- testPathIgnorePatterns: ['/node_modules/', '/dist/'],
155
-
156
- // The regexp pattern or array of patterns that Jest uses to detect test files
157
- // testRegex: [],
158
-
159
- // This option allows the use of a custom results processor
160
- // testResultsProcessor: undefined,
161
-
162
- // This option allows use of a custom test runner
163
- // testRunner: "jest-circus/runner",
164
-
165
- // A map from regular expressions to paths to transformers
166
- transform: {
167
- '^.+\\.(ts|tsx)$': [
168
- 'ts-jest',
169
- {
170
- tsconfig: 'tsconfig.test.json',
171
- },
172
- ],
173
- },
174
-
175
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
176
- // transformIgnorePatterns: [
177
- // "/node_modules/",
178
- // "\\.pnp\\.[^\\/]+$"
179
- // ],
180
-
181
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
182
- // unmockedModulePathPatterns: undefined,
183
-
184
- // Indicates whether each individual test should be reported during the run
185
- verbose: true,
186
-
187
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
188
- // watchPathIgnorePatterns: [],
189
-
190
- // Whether to use watchman for file crawling
191
- // watchman: true,
192
- }
193
-
194
- export default config
@@ -1,123 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Script para facilitar o processo de release da lib star-db-query-builder
4
-
5
- set -e
6
-
7
- # Cores para output
8
- RED='\033[0;31m'
9
- GREEN='\033[0;32m'
10
- YELLOW='\033[1;33m'
11
- NC='\033[0m' # No Color
12
-
13
- # Função para imprimir mensagens coloridas
14
- print_message() {
15
- echo -e "${GREEN}[INFO]${NC} $1"
16
- }
17
-
18
- print_warning() {
19
- echo -e "${YELLOW}[WARNING]${NC} $1"
20
- }
21
-
22
- print_error() {
23
- echo -e "${RED}[ERROR]${NC} $1"
24
- }
25
-
26
- # Verificar se estamos na branch main
27
- CURRENT_BRANCH=$(git branch --show-current)
28
- if [ "$CURRENT_BRANCH" != "main" ]; then
29
- print_error "Você deve estar na branch main para fazer um release"
30
- print_message "Execute: git checkout main"
31
- exit 1
32
- fi
33
-
34
- # Verificar se há mudanças não commitadas
35
- if [ -n "$(git status --porcelain)" ]; then
36
- print_error "Há mudanças não commitadas no repositório"
37
- print_message "Faça commit ou stash das mudanças antes de continuar"
38
- exit 1
39
- fi
40
-
41
- # Atualizar branch local
42
- print_message "Atualizando branch local..."
43
- git pull origin main
44
-
45
- # Executar testes
46
- print_message "Executando testes..."
47
- pnpm run test:ci
48
-
49
- # Executar linting
50
- print_message "Executando linting..."
51
- pnpm run lint
52
-
53
- # Build do projeto
54
- print_message "Fazendo build do projeto..."
55
- pnpm run build
56
-
57
- # Atualizar CHANGELOG
58
- print_message "Atualizando CHANGELOG..."
59
- CURRENT_DATE=$(date +%Y-%m-%d)
60
- sed -i.bak "s/## \[Unreleased\]/## [Unreleased]\n\n## [$NEW_VERSION] - $CURRENT_DATE/" CHANGELOG.md
61
- rm CHANGELOG.md.bak
62
-
63
- # Commit das mudanças do CHANGELOG
64
- git add CHANGELOG.md
65
- git commit -m "docs: update changelog for version $NEW_VERSION" || true
66
-
67
- # Perguntar tipo de versão
68
- echo ""
69
- print_message "Escolha o tipo de versão:"
70
- echo "1) Patch (1.1.0 → 1.1.1) - Correções de bugs"
71
- echo "2) Minor (1.1.0 → 1.2.0) - Novas funcionalidades"
72
- echo "3) Major (1.1.0 → 2.0.0) - Breaking changes"
73
- echo ""
74
- read -p "Digite o número da opção (1-3): " version_type
75
-
76
- case $version_type in
77
- 1)
78
- print_message "Criando versão patch..."
79
- pnpm run version:patch
80
- ;;
81
- 2)
82
- print_message "Criando versão minor..."
83
- pnpm run version:minor
84
- ;;
85
- 3)
86
- print_warning "Você está criando uma versão major. Isso pode quebrar compatibilidade!"
87
- read -p "Tem certeza? (y/N): " confirm
88
- if [[ $confirm =~ ^[Yy]$ ]]; then
89
- print_message "Criando versão major..."
90
- pnpm run version:major
91
- else
92
- print_message "Release cancelado"
93
- exit 0
94
- fi
95
- ;;
96
- *)
97
- print_error "Opção inválida"
98
- exit 1
99
- ;;
100
- esac
101
-
102
- # Obter a nova versão
103
- NEW_VERSION=$(node -p "require('./package.json').version")
104
- TAG_NAME="v$NEW_VERSION"
105
-
106
- print_message "Nova versão: $NEW_VERSION"
107
- print_message "Tag: $TAG_NAME"
108
-
109
- # Perguntar se quer fazer push da tag
110
- read -p "Fazer push da tag para o GitHub? (y/N): " push_tag
111
-
112
- if [[ $push_tag =~ ^[Yy]$ ]]; then
113
- print_message "Fazendo push da tag..."
114
- git push origin --tags
115
-
116
- print_message "✅ Release iniciado!"
117
- print_message "O GitHub Actions irá publicar automaticamente no npm"
118
- print_message "Acompanhe o progresso em: https://github.com/starbem/star-db-query-builder/actions"
119
- else
120
- print_message "Tag criada localmente. Execute 'git push origin --tags' quando estiver pronto"
121
- fi
122
-
123
- print_message "Processo concluído!"