@ductape/sdk 0.0.4-v42 → 0.0.4-v43
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/dist/apps/services/app.service.d.ts +10 -0
- package/dist/apps/services/app.service.js +22 -0
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/database/adapters/base.adapter.d.ts +176 -0
- package/dist/database/adapters/base.adapter.js +31 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +83 -0
- package/dist/database/adapters/dynamodb.adapter.js +1237 -0
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
- package/dist/database/adapters/mongodb.adapter.d.ts +70 -0
- package/dist/database/adapters/mongodb.adapter.js +717 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +141 -0
- package/dist/database/adapters/mysql.adapter.js +1221 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +142 -0
- package/dist/database/adapters/postgresql.adapter.js +1288 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/database.service.d.ts +190 -0
- package/dist/database/database.service.js +552 -0
- package/dist/database/database.service.js.map +1 -0
- package/dist/database/index.d.ts +18 -0
- package/dist/database/index.js +98 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/types/aggregation.types.d.ts +202 -0
- package/dist/database/types/aggregation.types.js +21 -0
- package/dist/database/types/aggregation.types.js.map +1 -0
- package/dist/database/types/connection.types.d.ts +132 -0
- package/dist/database/types/connection.types.js +6 -0
- package/dist/database/types/connection.types.js.map +1 -0
- package/dist/database/types/database.types.d.ts +173 -0
- package/dist/database/types/database.types.js +73 -0
- package/dist/database/types/database.types.js.map +1 -0
- package/dist/database/types/index.d.ts +12 -0
- package/dist/database/types/index.js +37 -0
- package/dist/database/types/index.js.map +1 -0
- package/dist/database/types/index.types.d.ts +220 -0
- package/dist/database/types/index.types.js +27 -0
- package/dist/database/types/index.types.js.map +1 -0
- package/dist/database/types/migration.types.d.ts +205 -0
- package/dist/database/types/migration.types.js +44 -0
- package/dist/database/types/migration.types.js.map +1 -0
- package/dist/database/types/query.types.d.ts +274 -0
- package/dist/database/types/query.types.js +57 -0
- package/dist/database/types/query.types.js.map +1 -0
- package/dist/database/types/result.types.d.ts +218 -0
- package/dist/database/types/result.types.js +6 -0
- package/dist/database/types/result.types.js.map +1 -0
- package/dist/database/types/schema.types.d.ts +190 -0
- package/dist/database/types/schema.types.js +69 -0
- package/dist/database/types/schema.types.js.map +1 -0
- package/dist/database/utils/helpers.d.ts +66 -0
- package/dist/database/utils/helpers.js +501 -0
- package/dist/database/utils/helpers.js.map +1 -0
- package/dist/database/utils/migration.utils.d.ts +151 -0
- package/dist/database/utils/migration.utils.js +476 -0
- package/dist/database/utils/migration.utils.js.map +1 -0
- package/dist/database/utils/transaction.d.ts +64 -0
- package/dist/database/utils/transaction.js +130 -0
- package/dist/database/utils/transaction.js.map +1 -0
- package/dist/database/validators/connection.validator.d.ts +20 -0
- package/dist/database/validators/connection.validator.js +267 -0
- package/dist/database/validators/connection.validator.js.map +1 -0
- package/dist/database/validators/query.validator.d.ts +31 -0
- package/dist/database/validators/query.validator.js +305 -0
- package/dist/database/validators/query.validator.js.map +1 -0
- package/dist/database/validators/schema.validator.d.ts +31 -0
- package/dist/database/validators/schema.validator.js +334 -0
- package/dist/database/validators/schema.validator.js.map +1 -0
- package/dist/index.d.ts +25 -4
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/processor/services/processor.service.js +10 -8
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/types/processor.types.d.ts +2 -2
- package/package.json +3 -1
|
@@ -0,0 +1,73 @@
|
|
|
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 || (exports.DatabaseErrorType = DatabaseErrorType = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Database error class
|
|
43
|
+
*/
|
|
44
|
+
class DatabaseError extends Error {
|
|
45
|
+
constructor(type, message, originalError) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.type = type;
|
|
48
|
+
this.originalError = originalError;
|
|
49
|
+
this.name = 'DatabaseError';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.DatabaseError = DatabaseError;
|
|
53
|
+
/**
|
|
54
|
+
* Transaction isolation levels
|
|
55
|
+
*/
|
|
56
|
+
var TransactionIsolationLevel;
|
|
57
|
+
(function (TransactionIsolationLevel) {
|
|
58
|
+
TransactionIsolationLevel["READ_UNCOMMITTED"] = "READ_UNCOMMITTED";
|
|
59
|
+
TransactionIsolationLevel["READ_COMMITTED"] = "READ_COMMITTED";
|
|
60
|
+
TransactionIsolationLevel["REPEATABLE_READ"] = "REPEATABLE_READ";
|
|
61
|
+
TransactionIsolationLevel["SERIALIZABLE"] = "SERIALIZABLE";
|
|
62
|
+
})(TransactionIsolationLevel || (exports.TransactionIsolationLevel = TransactionIsolationLevel = {}));
|
|
63
|
+
/**
|
|
64
|
+
* Transaction status
|
|
65
|
+
*/
|
|
66
|
+
var TransactionStatus;
|
|
67
|
+
(function (TransactionStatus) {
|
|
68
|
+
TransactionStatus["ACTIVE"] = "active";
|
|
69
|
+
TransactionStatus["COMMITTED"] = "committed";
|
|
70
|
+
TransactionStatus["ROLLED_BACK"] = "rolled_back";
|
|
71
|
+
TransactionStatus["FAILED"] = "failed";
|
|
72
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
|
73
|
+
//# 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,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,0DAAqC,CAAA;IACrC,gDAA2B,CAAA;IAC3B,0DAAqC,CAAA;IACrC,wDAAmC,CAAA;IACnC,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;AAC7B,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;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"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index type definitions for database indexes
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Index type
|
|
6
|
+
*/
|
|
7
|
+
export declare enum IndexType {
|
|
8
|
+
/** B-Tree index (default for most databases) */
|
|
9
|
+
BTREE = "btree",
|
|
10
|
+
/** Hash index */
|
|
11
|
+
HASH = "hash",
|
|
12
|
+
/** GIN (Generalized Inverted Index) - PostgreSQL */
|
|
13
|
+
GIN = "gin",
|
|
14
|
+
/** GiST (Generalized Search Tree) - PostgreSQL */
|
|
15
|
+
GIST = "gist",
|
|
16
|
+
/** Full-text index */
|
|
17
|
+
FULLTEXT = "fulltext",
|
|
18
|
+
/** Spatial index */
|
|
19
|
+
SPATIAL = "spatial",
|
|
20
|
+
/** Unique index */
|
|
21
|
+
UNIQUE = "unique"
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Index column definition
|
|
25
|
+
*/
|
|
26
|
+
export interface IIndexColumn {
|
|
27
|
+
/** Column name */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Sort order */
|
|
30
|
+
order?: 'ASC' | 'DESC';
|
|
31
|
+
/** Length (for partial indexes on string columns) */
|
|
32
|
+
length?: number;
|
|
33
|
+
/** Expression (for expression-based indexes) */
|
|
34
|
+
expression?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Index definition
|
|
38
|
+
*/
|
|
39
|
+
export interface IIndexDefinition {
|
|
40
|
+
/** Index name */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Table name */
|
|
43
|
+
table: string;
|
|
44
|
+
/** Columns in the index */
|
|
45
|
+
columns: IIndexColumn[];
|
|
46
|
+
/** Index type */
|
|
47
|
+
type?: IndexType;
|
|
48
|
+
/** Is unique index */
|
|
49
|
+
unique?: boolean;
|
|
50
|
+
/** Partial index condition (WHERE clause) */
|
|
51
|
+
where?: string;
|
|
52
|
+
/** Index method (database-specific) */
|
|
53
|
+
method?: string;
|
|
54
|
+
/** Include columns (PostgreSQL covering indexes) */
|
|
55
|
+
include?: string[];
|
|
56
|
+
/** Comment */
|
|
57
|
+
comment?: string;
|
|
58
|
+
/** Storage parameters */
|
|
59
|
+
storageParams?: Record<string, any>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create index options
|
|
63
|
+
*/
|
|
64
|
+
export interface ICreateIndexOptions {
|
|
65
|
+
/** Table name */
|
|
66
|
+
table: string;
|
|
67
|
+
/** Environment slug */
|
|
68
|
+
env: string;
|
|
69
|
+
/** Product tag */
|
|
70
|
+
product?: string;
|
|
71
|
+
/** Database tag */
|
|
72
|
+
database?: string;
|
|
73
|
+
/** Index definition */
|
|
74
|
+
index: IIndexDefinition;
|
|
75
|
+
/** Create if not exists */
|
|
76
|
+
ifNotExists?: boolean;
|
|
77
|
+
/** Create concurrently (PostgreSQL - doesn't lock table) */
|
|
78
|
+
concurrent?: boolean;
|
|
79
|
+
/** Generate migration */
|
|
80
|
+
generateMigration?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Drop index options
|
|
84
|
+
*/
|
|
85
|
+
export interface IDropIndexOptions {
|
|
86
|
+
/** Index name */
|
|
87
|
+
indexName: string;
|
|
88
|
+
/** Table name */
|
|
89
|
+
table: string;
|
|
90
|
+
/** Environment slug */
|
|
91
|
+
env: string;
|
|
92
|
+
/** Product tag */
|
|
93
|
+
product?: string;
|
|
94
|
+
/** Database tag */
|
|
95
|
+
database?: string;
|
|
96
|
+
/** Drop if exists */
|
|
97
|
+
ifExists?: boolean;
|
|
98
|
+
/** Drop concurrently (PostgreSQL) */
|
|
99
|
+
concurrent?: boolean;
|
|
100
|
+
/** Cascade drop (also drop dependent objects) */
|
|
101
|
+
cascade?: boolean;
|
|
102
|
+
/** Generate migration */
|
|
103
|
+
generateMigration?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* List indexes options
|
|
107
|
+
*/
|
|
108
|
+
export interface IListIndexesOptions {
|
|
109
|
+
/** Table name */
|
|
110
|
+
table: string;
|
|
111
|
+
/** Environment slug */
|
|
112
|
+
env: string;
|
|
113
|
+
/** Product tag */
|
|
114
|
+
product?: string;
|
|
115
|
+
/** Database tag */
|
|
116
|
+
database?: string;
|
|
117
|
+
/** Include system indexes */
|
|
118
|
+
includeSystem?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Index info (returned when listing indexes)
|
|
122
|
+
*/
|
|
123
|
+
export interface IIndexInfo {
|
|
124
|
+
/** Index name */
|
|
125
|
+
name: string;
|
|
126
|
+
/** Table name */
|
|
127
|
+
table: string;
|
|
128
|
+
/** Column names */
|
|
129
|
+
columns: string[];
|
|
130
|
+
/** Column definitions with details */
|
|
131
|
+
columnDetails: IIndexColumn[];
|
|
132
|
+
/** Is unique */
|
|
133
|
+
unique: boolean;
|
|
134
|
+
/** Is primary key */
|
|
135
|
+
primaryKey: boolean;
|
|
136
|
+
/** Index type */
|
|
137
|
+
type: string;
|
|
138
|
+
/** Index size (in bytes, if available) */
|
|
139
|
+
size?: number;
|
|
140
|
+
/** Number of rows in index */
|
|
141
|
+
rowCount?: number;
|
|
142
|
+
/** Partial index condition */
|
|
143
|
+
where?: string;
|
|
144
|
+
/** Comment */
|
|
145
|
+
comment?: string;
|
|
146
|
+
/** Additional metadata */
|
|
147
|
+
metadata?: Record<string, any>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Index statistics
|
|
151
|
+
*/
|
|
152
|
+
export interface IIndexStatistics {
|
|
153
|
+
/** Index name */
|
|
154
|
+
indexName: string;
|
|
155
|
+
/** Table name */
|
|
156
|
+
table: string;
|
|
157
|
+
/** Number of index scans */
|
|
158
|
+
scans?: number;
|
|
159
|
+
/** Number of tuples/rows read */
|
|
160
|
+
tuplesRead?: number;
|
|
161
|
+
/** Number of tuples fetched */
|
|
162
|
+
tuplesFetched?: number;
|
|
163
|
+
/** Index size in bytes */
|
|
164
|
+
size: number;
|
|
165
|
+
/** Index size (human-readable) */
|
|
166
|
+
sizeFormatted?: string;
|
|
167
|
+
/** Last used timestamp */
|
|
168
|
+
lastUsed?: Date | string;
|
|
169
|
+
/** Is index bloated */
|
|
170
|
+
bloated?: boolean;
|
|
171
|
+
/** Bloat percentage */
|
|
172
|
+
bloatPercentage?: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Analyze index options
|
|
176
|
+
*/
|
|
177
|
+
export interface IAnalyzeIndexOptions {
|
|
178
|
+
/** Index name */
|
|
179
|
+
indexName?: string;
|
|
180
|
+
/** Table name */
|
|
181
|
+
table: string;
|
|
182
|
+
/** Environment slug */
|
|
183
|
+
env: string;
|
|
184
|
+
/** Product tag */
|
|
185
|
+
product?: string;
|
|
186
|
+
/** Database tag */
|
|
187
|
+
database?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Rebuild index options
|
|
191
|
+
*/
|
|
192
|
+
export interface IRebuildIndexOptions {
|
|
193
|
+
/** Index name */
|
|
194
|
+
indexName: string;
|
|
195
|
+
/** Table name */
|
|
196
|
+
table: string;
|
|
197
|
+
/** Environment slug */
|
|
198
|
+
env: string;
|
|
199
|
+
/** Product tag */
|
|
200
|
+
product?: string;
|
|
201
|
+
/** Database tag */
|
|
202
|
+
database?: string;
|
|
203
|
+
/** Rebuild concurrently (PostgreSQL) */
|
|
204
|
+
concurrent?: boolean;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Index recommendation
|
|
208
|
+
*/
|
|
209
|
+
export interface IIndexRecommendation {
|
|
210
|
+
/** Recommended index definition */
|
|
211
|
+
index: IIndexDefinition;
|
|
212
|
+
/** Reason for recommendation */
|
|
213
|
+
reason: string;
|
|
214
|
+
/** Estimated performance impact */
|
|
215
|
+
impact: 'high' | 'medium' | 'low';
|
|
216
|
+
/** Query patterns that would benefit */
|
|
217
|
+
affectedQueries?: string[];
|
|
218
|
+
/** Estimated index size */
|
|
219
|
+
estimatedSize?: number;
|
|
220
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Index type definitions for database indexes
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IndexType = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Index type
|
|
9
|
+
*/
|
|
10
|
+
var IndexType;
|
|
11
|
+
(function (IndexType) {
|
|
12
|
+
/** B-Tree index (default for most databases) */
|
|
13
|
+
IndexType["BTREE"] = "btree";
|
|
14
|
+
/** Hash index */
|
|
15
|
+
IndexType["HASH"] = "hash";
|
|
16
|
+
/** GIN (Generalized Inverted Index) - PostgreSQL */
|
|
17
|
+
IndexType["GIN"] = "gin";
|
|
18
|
+
/** GiST (Generalized Search Tree) - PostgreSQL */
|
|
19
|
+
IndexType["GIST"] = "gist";
|
|
20
|
+
/** Full-text index */
|
|
21
|
+
IndexType["FULLTEXT"] = "fulltext";
|
|
22
|
+
/** Spatial index */
|
|
23
|
+
IndexType["SPATIAL"] = "spatial";
|
|
24
|
+
/** Unique index */
|
|
25
|
+
IndexType["UNIQUE"] = "unique";
|
|
26
|
+
})(IndexType || (exports.IndexType = IndexType = {}));
|
|
27
|
+
//# sourceMappingURL=index.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../../src/database/types/index.types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,IAAY,SAeX;AAfD,WAAY,SAAS;IACnB,gDAAgD;IAChD,4BAAe,CAAA;IACf,iBAAiB;IACjB,0BAAa,CAAA;IACb,oDAAoD;IACpD,wBAAW,CAAA;IACX,kDAAkD;IAClD,0BAAa,CAAA;IACb,sBAAsB;IACtB,kCAAqB,CAAA;IACrB,oBAAoB;IACpB,gCAAmB,CAAA;IACnB,mBAAmB;IACnB,8BAAiB,CAAA;AACnB,CAAC,EAfW,SAAS,yBAAT,SAAS,QAepB"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration type definitions for database schema versioning
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Migration status
|
|
6
|
+
*/
|
|
7
|
+
export declare enum MigrationStatus {
|
|
8
|
+
PENDING = "pending",
|
|
9
|
+
RUNNING = "running",
|
|
10
|
+
COMPLETED = "completed",
|
|
11
|
+
FAILED = "failed",
|
|
12
|
+
ROLLED_BACK = "rolled_back"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Migration direction
|
|
16
|
+
*/
|
|
17
|
+
export declare enum MigrationDirection {
|
|
18
|
+
UP = "up",
|
|
19
|
+
DOWN = "down"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Migration operation type
|
|
23
|
+
*/
|
|
24
|
+
export declare enum MigrationOperationType {
|
|
25
|
+
CREATE_TABLE = "create_table",
|
|
26
|
+
DROP_TABLE = "drop_table",
|
|
27
|
+
ALTER_TABLE = "alter_table",
|
|
28
|
+
ADD_COLUMN = "add_column",
|
|
29
|
+
DROP_COLUMN = "drop_column",
|
|
30
|
+
MODIFY_COLUMN = "modify_column",
|
|
31
|
+
RENAME_COLUMN = "rename_column",
|
|
32
|
+
ADD_INDEX = "add_index",
|
|
33
|
+
DROP_INDEX = "drop_index",
|
|
34
|
+
ADD_CONSTRAINT = "add_constraint",
|
|
35
|
+
DROP_CONSTRAINT = "drop_constraint",
|
|
36
|
+
RAW_SQL = "raw_sql"
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Migration operation
|
|
40
|
+
*/
|
|
41
|
+
export interface IMigrationOperation {
|
|
42
|
+
/** Operation type */
|
|
43
|
+
type: MigrationOperationType;
|
|
44
|
+
/** Table name */
|
|
45
|
+
table?: string;
|
|
46
|
+
/** Raw SQL (for RAW_SQL type) */
|
|
47
|
+
sql?: string;
|
|
48
|
+
/** Operation parameters */
|
|
49
|
+
params?: Record<string, any>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Migration definition
|
|
53
|
+
*/
|
|
54
|
+
export interface IMigrationDefinition {
|
|
55
|
+
/** Migration name */
|
|
56
|
+
name: string;
|
|
57
|
+
/** Migration description */
|
|
58
|
+
description?: string;
|
|
59
|
+
/** Migration tag/identifier */
|
|
60
|
+
tag: string;
|
|
61
|
+
/** Up operations */
|
|
62
|
+
up: IMigrationOperation[];
|
|
63
|
+
/** Down operations (rollback) */
|
|
64
|
+
down: IMigrationOperation[];
|
|
65
|
+
/** Migration dependencies (tags of migrations that must run first) */
|
|
66
|
+
dependencies?: string[];
|
|
67
|
+
/** Created timestamp */
|
|
68
|
+
createdAt?: Date | string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Migration execution result
|
|
72
|
+
*/
|
|
73
|
+
export interface IMigrationResult {
|
|
74
|
+
/** Migration tag */
|
|
75
|
+
tag: string;
|
|
76
|
+
/** Execution status */
|
|
77
|
+
status: MigrationStatus;
|
|
78
|
+
/** Direction executed */
|
|
79
|
+
direction: MigrationDirection;
|
|
80
|
+
/** Executed at timestamp */
|
|
81
|
+
executedAt: Date | string;
|
|
82
|
+
/** Duration in milliseconds */
|
|
83
|
+
duration?: number;
|
|
84
|
+
/** Error message (if failed) */
|
|
85
|
+
error?: string;
|
|
86
|
+
/** SQL statements executed */
|
|
87
|
+
statements?: string[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Migration history entry
|
|
91
|
+
*/
|
|
92
|
+
export interface IMigrationHistory {
|
|
93
|
+
/** Migration tag */
|
|
94
|
+
tag: string;
|
|
95
|
+
/** Migration name */
|
|
96
|
+
name: string;
|
|
97
|
+
/** Environment slug */
|
|
98
|
+
env: string;
|
|
99
|
+
/** Product tag */
|
|
100
|
+
product?: string;
|
|
101
|
+
/** Database tag */
|
|
102
|
+
database?: string;
|
|
103
|
+
/** Status */
|
|
104
|
+
status: MigrationStatus;
|
|
105
|
+
/** Last direction executed */
|
|
106
|
+
direction: MigrationDirection;
|
|
107
|
+
/** Applied at timestamp */
|
|
108
|
+
appliedAt: Date | string;
|
|
109
|
+
/** Duration in milliseconds */
|
|
110
|
+
duration?: number;
|
|
111
|
+
/** Error details (if failed) */
|
|
112
|
+
error?: {
|
|
113
|
+
message: string;
|
|
114
|
+
stack?: string;
|
|
115
|
+
};
|
|
116
|
+
/** Batch number (for grouping migrations) */
|
|
117
|
+
batch?: number;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Migration generation options
|
|
121
|
+
*/
|
|
122
|
+
export interface IMigrationGenerationOptions {
|
|
123
|
+
/** Migration name */
|
|
124
|
+
name: string;
|
|
125
|
+
/** Table name (if applicable) */
|
|
126
|
+
table?: string;
|
|
127
|
+
/** Description */
|
|
128
|
+
description?: string;
|
|
129
|
+
/** Auto-generate based on schema changes */
|
|
130
|
+
autoGenerate?: boolean;
|
|
131
|
+
/** Include timestamp in filename */
|
|
132
|
+
timestamp?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Migration execution options
|
|
136
|
+
*/
|
|
137
|
+
export interface IMigrationExecutionOptions {
|
|
138
|
+
/** Environment slug */
|
|
139
|
+
env: string;
|
|
140
|
+
/** Product tag */
|
|
141
|
+
product?: string;
|
|
142
|
+
/** Database tag */
|
|
143
|
+
database?: string;
|
|
144
|
+
/** Run specific migration tag */
|
|
145
|
+
tag?: string;
|
|
146
|
+
/** Run up to specific migration */
|
|
147
|
+
to?: string;
|
|
148
|
+
/** Batch mode */
|
|
149
|
+
batch?: boolean;
|
|
150
|
+
/** Dry run (don't execute, just show what would run) */
|
|
151
|
+
dryRun?: boolean;
|
|
152
|
+
/** Force execution even if migration already ran */
|
|
153
|
+
force?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Migration rollback options
|
|
157
|
+
*/
|
|
158
|
+
export interface IMigrationRollbackOptions {
|
|
159
|
+
/** Environment slug */
|
|
160
|
+
env: string;
|
|
161
|
+
/** Product tag */
|
|
162
|
+
product?: string;
|
|
163
|
+
/** Database tag */
|
|
164
|
+
database?: string;
|
|
165
|
+
/** Rollback specific migration */
|
|
166
|
+
tag?: string;
|
|
167
|
+
/** Rollback last N migrations */
|
|
168
|
+
steps?: number;
|
|
169
|
+
/** Rollback last batch */
|
|
170
|
+
batch?: boolean;
|
|
171
|
+
/** Dry run */
|
|
172
|
+
dryRun?: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Pending migration info
|
|
176
|
+
*/
|
|
177
|
+
export interface IPendingMigration {
|
|
178
|
+
/** Migration tag */
|
|
179
|
+
tag: string;
|
|
180
|
+
/** Migration name */
|
|
181
|
+
name: string;
|
|
182
|
+
/** Description */
|
|
183
|
+
description?: string;
|
|
184
|
+
/** Created at */
|
|
185
|
+
createdAt: Date | string;
|
|
186
|
+
/** Dependencies */
|
|
187
|
+
dependencies?: string[];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Migration status summary
|
|
191
|
+
*/
|
|
192
|
+
export interface IMigrationStatus {
|
|
193
|
+
/** Total migrations */
|
|
194
|
+
total: number;
|
|
195
|
+
/** Completed migrations */
|
|
196
|
+
completed: number;
|
|
197
|
+
/** Pending migrations */
|
|
198
|
+
pending: number;
|
|
199
|
+
/** Failed migrations */
|
|
200
|
+
failed: number;
|
|
201
|
+
/** Last migration applied */
|
|
202
|
+
lastApplied?: IMigrationHistory;
|
|
203
|
+
/** Pending migrations list */
|
|
204
|
+
pendingMigrations: IPendingMigration[];
|
|
205
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Migration type definitions for database schema versioning
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MigrationOperationType = exports.MigrationDirection = exports.MigrationStatus = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Migration status
|
|
9
|
+
*/
|
|
10
|
+
var MigrationStatus;
|
|
11
|
+
(function (MigrationStatus) {
|
|
12
|
+
MigrationStatus["PENDING"] = "pending";
|
|
13
|
+
MigrationStatus["RUNNING"] = "running";
|
|
14
|
+
MigrationStatus["COMPLETED"] = "completed";
|
|
15
|
+
MigrationStatus["FAILED"] = "failed";
|
|
16
|
+
MigrationStatus["ROLLED_BACK"] = "rolled_back";
|
|
17
|
+
})(MigrationStatus || (exports.MigrationStatus = MigrationStatus = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Migration direction
|
|
20
|
+
*/
|
|
21
|
+
var MigrationDirection;
|
|
22
|
+
(function (MigrationDirection) {
|
|
23
|
+
MigrationDirection["UP"] = "up";
|
|
24
|
+
MigrationDirection["DOWN"] = "down";
|
|
25
|
+
})(MigrationDirection || (exports.MigrationDirection = MigrationDirection = {}));
|
|
26
|
+
/**
|
|
27
|
+
* Migration operation type
|
|
28
|
+
*/
|
|
29
|
+
var MigrationOperationType;
|
|
30
|
+
(function (MigrationOperationType) {
|
|
31
|
+
MigrationOperationType["CREATE_TABLE"] = "create_table";
|
|
32
|
+
MigrationOperationType["DROP_TABLE"] = "drop_table";
|
|
33
|
+
MigrationOperationType["ALTER_TABLE"] = "alter_table";
|
|
34
|
+
MigrationOperationType["ADD_COLUMN"] = "add_column";
|
|
35
|
+
MigrationOperationType["DROP_COLUMN"] = "drop_column";
|
|
36
|
+
MigrationOperationType["MODIFY_COLUMN"] = "modify_column";
|
|
37
|
+
MigrationOperationType["RENAME_COLUMN"] = "rename_column";
|
|
38
|
+
MigrationOperationType["ADD_INDEX"] = "add_index";
|
|
39
|
+
MigrationOperationType["DROP_INDEX"] = "drop_index";
|
|
40
|
+
MigrationOperationType["ADD_CONSTRAINT"] = "add_constraint";
|
|
41
|
+
MigrationOperationType["DROP_CONSTRAINT"] = "drop_constraint";
|
|
42
|
+
MigrationOperationType["RAW_SQL"] = "raw_sql";
|
|
43
|
+
})(MigrationOperationType || (exports.MigrationOperationType = MigrationOperationType = {}));
|
|
44
|
+
//# sourceMappingURL=migration.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.types.js","sourceRoot":"","sources":["../../../src/database/types/migration.types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,8CAA2B,CAAA;AAC7B,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED;;GAEG;AACH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,+BAAS,CAAA;IACT,mCAAa,CAAA;AACf,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED;;GAEG;AACH,IAAY,sBAaX;AAbD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,mDAAyB,CAAA;IACzB,qDAA2B,CAAA;IAC3B,yDAA+B,CAAA;IAC/B,yDAA+B,CAAA;IAC/B,iDAAuB,CAAA;IACvB,mDAAyB,CAAA;IACzB,2DAAiC,CAAA;IACjC,6DAAmC,CAAA;IACnC,6CAAmB,CAAA;AACrB,CAAC,EAbW,sBAAsB,sCAAtB,sBAAsB,QAajC"}
|