@ductape/sdk 0.0.4-v42 → 0.0.4-v44

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 (85) hide show
  1. package/dist/apps/services/app.service.d.ts +10 -0
  2. package/dist/apps/services/app.service.js +38 -69
  3. package/dist/apps/services/app.service.js.map +1 -1
  4. package/dist/apps/validators/joi-validators/create.appWebhook.validator.d.ts +1 -2
  5. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +2 -15
  6. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +1 -1
  7. package/dist/apps/validators/joi-validators/update.appWebhook.validator.d.ts +1 -2
  8. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js +2 -14
  9. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js.map +1 -1
  10. package/dist/database/adapters/base.adapter.d.ts +176 -0
  11. package/dist/database/adapters/base.adapter.js +31 -0
  12. package/dist/database/adapters/base.adapter.js.map +1 -0
  13. package/dist/database/adapters/dynamodb.adapter.d.ts +91 -0
  14. package/dist/database/adapters/dynamodb.adapter.js +1469 -0
  15. package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
  16. package/dist/database/adapters/mongodb.adapter.d.ts +71 -0
  17. package/dist/database/adapters/mongodb.adapter.js +882 -0
  18. package/dist/database/adapters/mongodb.adapter.js.map +1 -0
  19. package/dist/database/adapters/mysql.adapter.d.ts +146 -0
  20. package/dist/database/adapters/mysql.adapter.js +1417 -0
  21. package/dist/database/adapters/mysql.adapter.js.map +1 -0
  22. package/dist/database/adapters/postgresql.adapter.d.ts +147 -0
  23. package/dist/database/adapters/postgresql.adapter.js +1472 -0
  24. package/dist/database/adapters/postgresql.adapter.js.map +1 -0
  25. package/dist/database/database.service.d.ts +195 -0
  26. package/dist/database/database.service.js +502 -0
  27. package/dist/database/database.service.js.map +1 -0
  28. package/dist/database/index.d.ts +18 -0
  29. package/dist/database/index.js +98 -0
  30. package/dist/database/index.js.map +1 -0
  31. package/dist/database/types/aggregation.types.d.ts +202 -0
  32. package/dist/database/types/aggregation.types.js +21 -0
  33. package/dist/database/types/aggregation.types.js.map +1 -0
  34. package/dist/database/types/connection.types.d.ts +132 -0
  35. package/dist/database/types/connection.types.js +6 -0
  36. package/dist/database/types/connection.types.js.map +1 -0
  37. package/dist/database/types/database.types.d.ts +174 -0
  38. package/dist/database/types/database.types.js +74 -0
  39. package/dist/database/types/database.types.js.map +1 -0
  40. package/dist/database/types/index.d.ts +12 -0
  41. package/dist/database/types/index.js +37 -0
  42. package/dist/database/types/index.js.map +1 -0
  43. package/dist/database/types/index.types.d.ts +220 -0
  44. package/dist/database/types/index.types.js +27 -0
  45. package/dist/database/types/index.types.js.map +1 -0
  46. package/dist/database/types/migration.types.d.ts +205 -0
  47. package/dist/database/types/migration.types.js +44 -0
  48. package/dist/database/types/migration.types.js.map +1 -0
  49. package/dist/database/types/query.types.d.ts +305 -0
  50. package/dist/database/types/query.types.js +57 -0
  51. package/dist/database/types/query.types.js.map +1 -0
  52. package/dist/database/types/result.types.d.ts +218 -0
  53. package/dist/database/types/result.types.js +6 -0
  54. package/dist/database/types/result.types.js.map +1 -0
  55. package/dist/database/types/schema.types.d.ts +190 -0
  56. package/dist/database/types/schema.types.js +69 -0
  57. package/dist/database/types/schema.types.js.map +1 -0
  58. package/dist/database/utils/helpers.d.ts +66 -0
  59. package/dist/database/utils/helpers.js +501 -0
  60. package/dist/database/utils/helpers.js.map +1 -0
  61. package/dist/database/utils/migration.utils.d.ts +151 -0
  62. package/dist/database/utils/migration.utils.js +476 -0
  63. package/dist/database/utils/migration.utils.js.map +1 -0
  64. package/dist/database/utils/transaction.d.ts +64 -0
  65. package/dist/database/utils/transaction.js +130 -0
  66. package/dist/database/utils/transaction.js.map +1 -0
  67. package/dist/database/validators/connection.validator.d.ts +20 -0
  68. package/dist/database/validators/connection.validator.js +267 -0
  69. package/dist/database/validators/connection.validator.js.map +1 -0
  70. package/dist/database/validators/query.validator.d.ts +31 -0
  71. package/dist/database/validators/query.validator.js +305 -0
  72. package/dist/database/validators/query.validator.js.map +1 -0
  73. package/dist/database/validators/schema.validator.d.ts +31 -0
  74. package/dist/database/validators/schema.validator.js +334 -0
  75. package/dist/database/validators/schema.validator.js.map +1 -0
  76. package/dist/index.d.ts +194 -146
  77. package/dist/index.js +232 -173
  78. package/dist/index.js.map +1 -1
  79. package/dist/processor/services/processor.service.js +61 -43
  80. package/dist/processor/services/processor.service.js.map +1 -1
  81. package/dist/test/test.processor.js +1 -3
  82. package/dist/test/test.processor.js.map +1 -1
  83. package/dist/types/appBuilder.types.d.ts +1 -1
  84. package/dist/types/processor.types.d.ts +2 -2
  85. package/package.json +3 -1
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Aggregation type definitions for database operations
3
+ */
4
+ import { WhereClause, IOrderBy } from './query.types';
5
+ /**
6
+ * Aggregation function types
7
+ */
8
+ export declare enum AggregationFunction {
9
+ COUNT = "count",
10
+ SUM = "sum",
11
+ AVG = "avg",
12
+ MIN = "min",
13
+ MAX = "max",
14
+ GROUP_CONCAT = "group_concat",// MySQL
15
+ STRING_AGG = "string_agg",// PostgreSQL
16
+ ARRAY_AGG = "array_agg"
17
+ }
18
+ /**
19
+ * Single aggregation operation
20
+ */
21
+ export interface IAggregationOperation {
22
+ /** Aggregation function */
23
+ function: AggregationFunction;
24
+ /** Column to aggregate */
25
+ column: string;
26
+ /** Alias for the result */
27
+ alias?: string;
28
+ /** Distinct values only */
29
+ distinct?: boolean;
30
+ }
31
+ /**
32
+ * Count options
33
+ */
34
+ export interface ICountOptions {
35
+ /** Table/Collection name */
36
+ table: string;
37
+ /** Environment slug (optional if connection is already established) */
38
+ env?: string;
39
+ /** Product tag (optional if connection is already established) */
40
+ product?: string;
41
+ /** Database tag (optional if connection is already established) */
42
+ database?: string;
43
+ /** Where clause */
44
+ where?: WhereClause;
45
+ /** Column to count (default: '*') */
46
+ column?: string;
47
+ /** Count distinct values only */
48
+ distinct?: boolean;
49
+ }
50
+ /**
51
+ * Sum options
52
+ */
53
+ export interface ISumOptions {
54
+ /** Table/Collection name */
55
+ table: string;
56
+ /** Environment slug (optional if connection is already established) */
57
+ env?: string;
58
+ /** Product tag (optional if connection is already established) */
59
+ product?: string;
60
+ /** Database tag (optional if connection is already established) */
61
+ database?: string;
62
+ /** Column to sum */
63
+ column: string;
64
+ /** Where clause */
65
+ where?: WhereClause;
66
+ }
67
+ /**
68
+ * Average options
69
+ */
70
+ export interface IAvgOptions {
71
+ /** Table/Collection name */
72
+ table: string;
73
+ /** Environment slug (optional if connection is already established) */
74
+ env?: string;
75
+ /** Product tag (optional if connection is already established) */
76
+ product?: string;
77
+ /** Database tag (optional if connection is already established) */
78
+ database?: string;
79
+ /** Column to average */
80
+ column: string;
81
+ /** Where clause */
82
+ where?: WhereClause;
83
+ }
84
+ /**
85
+ * Min options
86
+ */
87
+ export interface IMinOptions {
88
+ /** Table/Collection name */
89
+ table: string;
90
+ /** Environment slug (optional if connection is already established) */
91
+ env?: string;
92
+ /** Product tag (optional if connection is already established) */
93
+ product?: string;
94
+ /** Database tag (optional if connection is already established) */
95
+ database?: string;
96
+ /** Column to find minimum */
97
+ column: string;
98
+ /** Where clause */
99
+ where?: WhereClause;
100
+ }
101
+ /**
102
+ * Max options
103
+ */
104
+ export interface IMaxOptions {
105
+ /** Table/Collection name */
106
+ table: string;
107
+ /** Environment slug (optional if connection is already established) */
108
+ env?: string;
109
+ /** Product tag (optional if connection is already established) */
110
+ product?: string;
111
+ /** Database tag (optional if connection is already established) */
112
+ database?: string;
113
+ /** Column to find maximum */
114
+ column: string;
115
+ /** Where clause */
116
+ where?: WhereClause;
117
+ }
118
+ /**
119
+ * Group by options
120
+ */
121
+ export interface IGroupByOptions {
122
+ /** Table/Collection name */
123
+ table: string;
124
+ /** Environment slug (optional if connection is already established) */
125
+ env?: string;
126
+ /** Product tag (optional if connection is already established) */
127
+ product?: string;
128
+ /** Database tag (optional if connection is already established) */
129
+ database?: string;
130
+ /** Columns to group by */
131
+ groupBy: string[];
132
+ /** Aggregation operations */
133
+ aggregate?: Record<string, IAggregationOperation>;
134
+ /** Where clause (applied before grouping) */
135
+ where?: WhereClause;
136
+ /** Having clause (applied after grouping) */
137
+ having?: WhereClause;
138
+ /** Order by */
139
+ orderBy?: IOrderBy | IOrderBy[];
140
+ /** Limit results */
141
+ limit?: number;
142
+ /** Offset */
143
+ offset?: number;
144
+ }
145
+ /**
146
+ * Aggregate options (multiple aggregations)
147
+ */
148
+ export interface IAggregateOptions {
149
+ /** Table/Collection name */
150
+ table: string;
151
+ /** Environment slug (optional if connection is already established) */
152
+ env?: string;
153
+ /** Product tag (optional if connection is already established) */
154
+ product?: string;
155
+ /** Database tag (optional if connection is already established) */
156
+ database?: string;
157
+ /** Aggregation operations */
158
+ operations: Record<string, IAggregationOperation>;
159
+ /** Where clause */
160
+ where?: WhereClause;
161
+ /** Group by columns (optional) */
162
+ groupBy?: string[];
163
+ /** Having clause */
164
+ having?: WhereClause;
165
+ }
166
+ /**
167
+ * Aggregation result for a single operation
168
+ */
169
+ export interface IAggregationResult {
170
+ /** Result value */
171
+ value: number | string | null;
172
+ /** Column that was aggregated */
173
+ column?: string;
174
+ /** Function used */
175
+ function: AggregationFunction;
176
+ }
177
+ /**
178
+ * Group by result
179
+ */
180
+ export interface IGroupByResult {
181
+ /** Grouped columns and their values */
182
+ groupedBy: Record<string, any>;
183
+ /** Aggregated values */
184
+ aggregates: Record<string, number | string | null>;
185
+ }
186
+ /**
187
+ * Statistics result (multiple aggregations)
188
+ */
189
+ export interface IStatisticsResult {
190
+ /** Count */
191
+ count?: number;
192
+ /** Sum */
193
+ sum?: number;
194
+ /** Average */
195
+ avg?: number;
196
+ /** Minimum */
197
+ min?: number | string;
198
+ /** Maximum */
199
+ max?: number | string;
200
+ /** Additional custom aggregations */
201
+ [key: string]: any;
202
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Aggregation type definitions for database operations
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AggregationFunction = void 0;
7
+ /**
8
+ * Aggregation function types
9
+ */
10
+ var AggregationFunction;
11
+ (function (AggregationFunction) {
12
+ AggregationFunction["COUNT"] = "count";
13
+ AggregationFunction["SUM"] = "sum";
14
+ AggregationFunction["AVG"] = "avg";
15
+ AggregationFunction["MIN"] = "min";
16
+ AggregationFunction["MAX"] = "max";
17
+ AggregationFunction["GROUP_CONCAT"] = "group_concat";
18
+ AggregationFunction["STRING_AGG"] = "string_agg";
19
+ AggregationFunction["ARRAY_AGG"] = "array_agg";
20
+ })(AggregationFunction || (exports.AggregationFunction = AggregationFunction = {}));
21
+ //# sourceMappingURL=aggregation.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregation.types.js","sourceRoot":"","sources":["../../../src/database/types/aggregation.types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH;;GAEG;AACH,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,kCAAW,CAAA;IACX,kCAAW,CAAA;IACX,kCAAW,CAAA;IACX,kCAAW,CAAA;IACX,oDAA6B,CAAA;IAC7B,gDAAyB,CAAA;IACzB,8CAAuB,CAAA;AACzB,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Connection configuration types for different database systems
3
+ */
4
+ import { DatabaseType } from './database.types';
5
+ /**
6
+ * Base connection configuration
7
+ */
8
+ export interface IBaseConnectionConfig {
9
+ /** Database type */
10
+ type: DatabaseType;
11
+ /** Environment slug */
12
+ env: string;
13
+ /** Optional connection tag */
14
+ connectionTag?: string;
15
+ }
16
+ /**
17
+ * Product-based connection configuration
18
+ * Connects using a configured database in a product
19
+ */
20
+ export interface IProductConnectionConfig {
21
+ /** Environment slug */
22
+ env: string;
23
+ /** Product tag */
24
+ product: string;
25
+ /** Database tag within the product */
26
+ database: string;
27
+ }
28
+ /**
29
+ * PostgreSQL connection configuration
30
+ */
31
+ export interface IPostgreSQLConfig extends IBaseConnectionConfig {
32
+ type: DatabaseType.POSTGRESQL;
33
+ host: string;
34
+ port?: number;
35
+ database: string;
36
+ user: string;
37
+ password: string;
38
+ ssl?: boolean | {
39
+ [key: string]: any;
40
+ };
41
+ poolSize?: number;
42
+ connectionTimeout?: number;
43
+ }
44
+ /**
45
+ * MySQL connection configuration
46
+ */
47
+ export interface IMySQLConfig extends IBaseConnectionConfig {
48
+ type: DatabaseType.MYSQL;
49
+ host: string;
50
+ port?: number;
51
+ database: string;
52
+ user: string;
53
+ password: string;
54
+ ssl?: boolean | {
55
+ [key: string]: any;
56
+ };
57
+ poolSize?: number;
58
+ connectionTimeout?: number;
59
+ charset?: string;
60
+ }
61
+ /**
62
+ * MongoDB connection configuration
63
+ */
64
+ export interface IMongoDBConfig extends IBaseConnectionConfig {
65
+ type: DatabaseType.MONGODB;
66
+ uri: string;
67
+ database: string;
68
+ options?: {
69
+ useNewUrlParser?: boolean;
70
+ useUnifiedTopology?: boolean;
71
+ poolSize?: number;
72
+ serverSelectionTimeoutMS?: number;
73
+ [key: string]: any;
74
+ };
75
+ }
76
+ /**
77
+ * DynamoDB connection configuration
78
+ */
79
+ export interface IDynamoDBConfig extends IBaseConnectionConfig {
80
+ type: DatabaseType.DYNAMODB;
81
+ region: string;
82
+ accessKeyId: string;
83
+ secretAccessKey: string;
84
+ endpoint?: string;
85
+ options?: {
86
+ maxRetries?: number;
87
+ httpOptions?: {
88
+ timeout?: number;
89
+ };
90
+ [key: string]: any;
91
+ };
92
+ }
93
+ /**
94
+ * SQLite connection configuration
95
+ */
96
+ export interface ISQLiteConfig extends IBaseConnectionConfig {
97
+ type: DatabaseType.SQLITE;
98
+ filename: string;
99
+ mode?: number;
100
+ options?: {
101
+ readonly?: boolean;
102
+ fileMustExist?: boolean;
103
+ timeout?: number;
104
+ [key: string]: any;
105
+ };
106
+ }
107
+ /**
108
+ * Union type for all connection configurations
109
+ */
110
+ export type DatabaseConnectionConfig = IPostgreSQLConfig | IMySQLConfig | IMongoDBConfig | IDynamoDBConfig | ISQLiteConfig | IProductConnectionConfig;
111
+ /**
112
+ * Connection pool configuration
113
+ */
114
+ export interface IConnectionPoolConfig {
115
+ min?: number;
116
+ max?: number;
117
+ idleTimeoutMillis?: number;
118
+ connectionTimeoutMillis?: number;
119
+ }
120
+ /**
121
+ * Connection options
122
+ */
123
+ export interface IConnectionOptions {
124
+ /** Auto-retry connection on failure */
125
+ autoRetry?: boolean;
126
+ /** Max retry attempts */
127
+ maxRetries?: number;
128
+ /** Retry delay in milliseconds */
129
+ retryDelay?: number;
130
+ /** Connection pool configuration */
131
+ pool?: IConnectionPoolConfig;
132
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Connection configuration types for different database systems
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=connection.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.types.js","sourceRoot":"","sources":["../../../src/database/types/connection.types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Core database type definitions for the Ductape Database ORM
3
+ * Provides unified interface for SQL and NoSQL databases
4
+ */
5
+ /**
6
+ * Supported database types
7
+ */
8
+ export declare enum DatabaseType {
9
+ POSTGRESQL = "postgresql",
10
+ MYSQL = "mysql",
11
+ MONGODB = "mongodb",
12
+ DYNAMODB = "dynamodb",
13
+ SQLITE = "sqlite"
14
+ }
15
+ /**
16
+ * Database connection status
17
+ */
18
+ export declare enum ConnectionStatus {
19
+ DISCONNECTED = "disconnected",
20
+ CONNECTING = "connecting",
21
+ CONNECTED = "connected",
22
+ ERROR = "error"
23
+ }
24
+ /**
25
+ * Base database configuration
26
+ */
27
+ export interface IDatabaseConfig {
28
+ /** Database type */
29
+ type: DatabaseType;
30
+ /** Environment slug */
31
+ env: string;
32
+ /** Optional connection tag for reusing existing connections */
33
+ connectionTag?: string;
34
+ /** Optional database name */
35
+ database?: string;
36
+ /** Custom connection options */
37
+ options?: Record<string, any>;
38
+ }
39
+ /**
40
+ * Database connection interface
41
+ */
42
+ export interface IConnection {
43
+ /** Unique connection ID */
44
+ id: string;
45
+ /** Database type */
46
+ type: DatabaseType;
47
+ /** Connection status */
48
+ status: ConnectionStatus;
49
+ /** Connect to database */
50
+ connect(): Promise<void>;
51
+ /** Disconnect from database */
52
+ disconnect(): Promise<void>;
53
+ /** Check if connected */
54
+ isConnected(): boolean;
55
+ /** Get native client */
56
+ getClient<T = any>(): T;
57
+ }
58
+ /**
59
+ * Base database adapter interface
60
+ * All database-specific adapters must implement this interface
61
+ */
62
+ export interface IDatabaseAdapter {
63
+ /** Database type this adapter handles */
64
+ readonly type: DatabaseType;
65
+ /** Create a connection */
66
+ createConnection(config: IDatabaseConfig): Promise<IConnection>;
67
+ /** Close a connection */
68
+ closeConnection(connection: IConnection): Promise<void>;
69
+ /** Execute a query */
70
+ executeQuery(connection: IConnection, query: string, params?: any[]): Promise<any>;
71
+ /** Begin transaction */
72
+ beginTransaction(connection: IConnection): Promise<any>;
73
+ /** Commit transaction */
74
+ commitTransaction(connection: IConnection, transaction: any): Promise<void>;
75
+ /** Rollback transaction */
76
+ rollbackTransaction(connection: IConnection, transaction: any): Promise<void>;
77
+ }
78
+ /**
79
+ * Database error types
80
+ */
81
+ export declare enum DatabaseErrorType {
82
+ CONNECTION_ERROR = "connection_error",
83
+ QUERY_ERROR = "query_error",
84
+ VALIDATION_ERROR = "validation_error",
85
+ MIGRATION_ERROR = "migration_error",
86
+ SCHEMA_ERROR = "schema_error",
87
+ INDEX_ERROR = "index_error",
88
+ TRANSACTION_ERROR = "TRANSACTION_ERROR"
89
+ }
90
+ /**
91
+ * Database error class
92
+ */
93
+ export declare class DatabaseError extends Error {
94
+ type: DatabaseErrorType;
95
+ originalError?: Error;
96
+ constructor(type: DatabaseErrorType, message: string, originalError?: Error);
97
+ }
98
+ /**
99
+ * Transaction isolation levels
100
+ */
101
+ export declare enum TransactionIsolationLevel {
102
+ READ_UNCOMMITTED = "READ_UNCOMMITTED",
103
+ READ_COMMITTED = "READ_COMMITTED",
104
+ REPEATABLE_READ = "REPEATABLE_READ",
105
+ SERIALIZABLE = "SERIALIZABLE"
106
+ }
107
+ /**
108
+ * Transaction status
109
+ */
110
+ export declare enum TransactionStatus {
111
+ ACTIVE = "active",
112
+ COMMITTED = "committed",
113
+ ROLLED_BACK = "rolled_back",
114
+ FAILED = "failed"
115
+ }
116
+ /**
117
+ * Transaction interface
118
+ */
119
+ export interface ITransaction {
120
+ /** Unique transaction ID */
121
+ id: string;
122
+ /** Connection this transaction belongs to */
123
+ connection: IConnection;
124
+ /** Transaction status */
125
+ status: TransactionStatus;
126
+ /** Isolation level */
127
+ isolationLevel?: TransactionIsolationLevel;
128
+ /** Parent transaction (for nested transactions) */
129
+ parent?: ITransaction;
130
+ /** Created timestamp */
131
+ createdAt: Date;
132
+ /** Native transaction object */
133
+ native: any;
134
+ /** Commit the transaction */
135
+ commit(): Promise<void>;
136
+ /** Rollback the transaction */
137
+ rollback(): Promise<void>;
138
+ /** Create a savepoint (for nested transactions) */
139
+ savepoint(name: string): Promise<ISavepoint>;
140
+ /** Check if transaction is active */
141
+ isActive(): boolean;
142
+ }
143
+ /**
144
+ * Savepoint interface
145
+ */
146
+ export interface ISavepoint {
147
+ /** Savepoint name */
148
+ name: string;
149
+ /** Transaction this savepoint belongs to */
150
+ transaction: ITransaction;
151
+ /** Created timestamp */
152
+ createdAt: Date;
153
+ /** Rollback to this savepoint */
154
+ rollback(): Promise<void>;
155
+ /** Release this savepoint */
156
+ release(): Promise<void>;
157
+ }
158
+ /**
159
+ * Transaction options
160
+ */
161
+ export interface ITransactionOptions {
162
+ /** Isolation level */
163
+ isolationLevel?: TransactionIsolationLevel;
164
+ /** Read only transaction */
165
+ readOnly?: boolean;
166
+ /** Timeout in milliseconds */
167
+ timeout?: number;
168
+ /** Deferrable (PostgreSQL) */
169
+ deferrable?: boolean;
170
+ }
171
+ /**
172
+ * Transaction callback function
173
+ */
174
+ export type TransactionCallback<T> = (transaction: ITransaction) => Promise<T>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * Core database type definitions for the Ductape Database ORM
4
+ * Provides unified interface for SQL and NoSQL databases
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.TransactionStatus = exports.TransactionIsolationLevel = exports.DatabaseError = exports.DatabaseErrorType = exports.ConnectionStatus = exports.DatabaseType = void 0;
8
+ /**
9
+ * Supported database types
10
+ */
11
+ var DatabaseType;
12
+ (function (DatabaseType) {
13
+ DatabaseType["POSTGRESQL"] = "postgresql";
14
+ DatabaseType["MYSQL"] = "mysql";
15
+ DatabaseType["MONGODB"] = "mongodb";
16
+ DatabaseType["DYNAMODB"] = "dynamodb";
17
+ DatabaseType["SQLITE"] = "sqlite";
18
+ })(DatabaseType || (exports.DatabaseType = DatabaseType = {}));
19
+ /**
20
+ * Database connection status
21
+ */
22
+ var ConnectionStatus;
23
+ (function (ConnectionStatus) {
24
+ ConnectionStatus["DISCONNECTED"] = "disconnected";
25
+ ConnectionStatus["CONNECTING"] = "connecting";
26
+ ConnectionStatus["CONNECTED"] = "connected";
27
+ ConnectionStatus["ERROR"] = "error";
28
+ })(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
29
+ /**
30
+ * Database error types
31
+ */
32
+ var DatabaseErrorType;
33
+ (function (DatabaseErrorType) {
34
+ DatabaseErrorType["CONNECTION_ERROR"] = "connection_error";
35
+ DatabaseErrorType["QUERY_ERROR"] = "query_error";
36
+ DatabaseErrorType["VALIDATION_ERROR"] = "validation_error";
37
+ DatabaseErrorType["MIGRATION_ERROR"] = "migration_error";
38
+ DatabaseErrorType["SCHEMA_ERROR"] = "schema_error";
39
+ DatabaseErrorType["INDEX_ERROR"] = "index_error";
40
+ DatabaseErrorType["TRANSACTION_ERROR"] = "TRANSACTION_ERROR";
41
+ })(DatabaseErrorType || (exports.DatabaseErrorType = DatabaseErrorType = {}));
42
+ /**
43
+ * Database error class
44
+ */
45
+ class DatabaseError extends Error {
46
+ constructor(type, message, originalError) {
47
+ super(message);
48
+ this.type = type;
49
+ this.originalError = originalError;
50
+ this.name = 'DatabaseError';
51
+ }
52
+ }
53
+ exports.DatabaseError = DatabaseError;
54
+ /**
55
+ * Transaction isolation levels
56
+ */
57
+ var TransactionIsolationLevel;
58
+ (function (TransactionIsolationLevel) {
59
+ TransactionIsolationLevel["READ_UNCOMMITTED"] = "READ_UNCOMMITTED";
60
+ TransactionIsolationLevel["READ_COMMITTED"] = "READ_COMMITTED";
61
+ TransactionIsolationLevel["REPEATABLE_READ"] = "REPEATABLE_READ";
62
+ TransactionIsolationLevel["SERIALIZABLE"] = "SERIALIZABLE";
63
+ })(TransactionIsolationLevel || (exports.TransactionIsolationLevel = TransactionIsolationLevel = {}));
64
+ /**
65
+ * Transaction status
66
+ */
67
+ var TransactionStatus;
68
+ (function (TransactionStatus) {
69
+ TransactionStatus["ACTIVE"] = "active";
70
+ TransactionStatus["COMMITTED"] = "committed";
71
+ TransactionStatus["ROLLED_BACK"] = "rolled_back";
72
+ TransactionStatus["FAILED"] = "failed";
73
+ })(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
74
+ //# sourceMappingURL=database.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.types.js","sourceRoot":"","sources":["../../../src/database/types/database.types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED;;GAEG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,iDAA6B,CAAA;IAC7B,6CAAyB,CAAA;IACzB,2CAAuB,CAAA;IACvB,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAiED;;GAEG;AACH,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,0DAAqC,CAAA;IACrC,gDAA2B,CAAA;IAC3B,0DAAqC,CAAA;IACrC,wDAAmC,CAAA;IACnC,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;IAC3B,4DAAuC,CAAA;AACzC,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;AAED;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtC,YACS,IAAuB,EAC9B,OAAe,EACR,aAAqB;QAE5B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAmB;QAEvB,kBAAa,GAAb,aAAa,CAAQ;QAG5B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AATD,sCASC;AAED;;GAEG;AACH,IAAY,yBAKX;AALD,WAAY,yBAAyB;IACnC,kEAAqC,CAAA;IACrC,8DAAiC,CAAA;IACjC,gEAAmC,CAAA;IACnC,0DAA6B,CAAA;AAC/B,CAAC,EALW,yBAAyB,yCAAzB,yBAAyB,QAKpC;AAED;;GAEG;AACH,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,gDAA2B,CAAA;IAC3B,sCAAiB,CAAA;AACnB,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Database types index
3
+ * Exports all type definitions for the Ductape Database ORM
4
+ */
5
+ export * from './database.types';
6
+ export * from './connection.types';
7
+ export * from './schema.types';
8
+ export * from './migration.types';
9
+ export * from './query.types';
10
+ export * from './aggregation.types';
11
+ export * from './result.types';
12
+ export * from './index.types';
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Database types index
4
+ * Exports all type definitions for the Ductape Database ORM
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ // Core database types
22
+ __exportStar(require("./database.types"), exports);
23
+ // Connection types
24
+ __exportStar(require("./connection.types"), exports);
25
+ // Schema types
26
+ __exportStar(require("./schema.types"), exports);
27
+ // Migration types
28
+ __exportStar(require("./migration.types"), exports);
29
+ // Query types
30
+ __exportStar(require("./query.types"), exports);
31
+ // Aggregation types
32
+ __exportStar(require("./aggregation.types"), exports);
33
+ // Result types
34
+ __exportStar(require("./result.types"), exports);
35
+ // Index types
36
+ __exportStar(require("./index.types"), exports);
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/database/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,sBAAsB;AACtB,mDAAiC;AAEjC,mBAAmB;AACnB,qDAAmC;AAEnC,eAAe;AACf,iDAA+B;AAE/B,kBAAkB;AAClB,oDAAkC;AAElC,cAAc;AACd,gDAA8B;AAE9B,oBAAoB;AACpB,sDAAoC;AAEpC,eAAe;AACf,iDAA+B;AAE/B,cAAc;AACd,gDAA8B"}