@venturekit/data 0.0.0-dev.20260307234057

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 (50) hide show
  1. package/LICENSE +191 -0
  2. package/dist/index.d.ts +12 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +14 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/migrations/index.d.ts +28 -0
  7. package/dist/migrations/index.d.ts.map +1 -0
  8. package/dist/migrations/index.js +44 -0
  9. package/dist/migrations/index.js.map +1 -0
  10. package/dist/query/index.d.ts +46 -0
  11. package/dist/query/index.d.ts.map +1 -0
  12. package/dist/query/index.js +51 -0
  13. package/dist/query/index.js.map +1 -0
  14. package/dist/query/mapper.d.ts +14 -0
  15. package/dist/query/mapper.d.ts.map +1 -0
  16. package/dist/query/mapper.js +39 -0
  17. package/dist/query/mapper.js.map +1 -0
  18. package/dist/query/pool.d.ts +14 -0
  19. package/dist/query/pool.d.ts.map +1 -0
  20. package/dist/query/pool.js +28 -0
  21. package/dist/query/pool.js.map +1 -0
  22. package/dist/query/transaction.d.ts +59 -0
  23. package/dist/query/transaction.d.ts.map +1 -0
  24. package/dist/query/transaction.js +88 -0
  25. package/dist/query/transaction.js.map +1 -0
  26. package/dist/rds/config.d.ts +31 -0
  27. package/dist/rds/config.d.ts.map +1 -0
  28. package/dist/rds/config.js +61 -0
  29. package/dist/rds/config.js.map +1 -0
  30. package/dist/rds/index.d.ts +9 -0
  31. package/dist/rds/index.d.ts.map +1 -0
  32. package/dist/rds/index.js +8 -0
  33. package/dist/rds/index.js.map +1 -0
  34. package/dist/rds/instance.d.ts +65 -0
  35. package/dist/rds/instance.d.ts.map +1 -0
  36. package/dist/rds/instance.js +51 -0
  37. package/dist/rds/instance.js.map +1 -0
  38. package/dist/types/index.d.ts +8 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +8 -0
  41. package/dist/types/index.js.map +1 -0
  42. package/dist/types/migration.d.ts +34 -0
  43. package/dist/types/migration.d.ts.map +1 -0
  44. package/dist/types/migration.js +13 -0
  45. package/dist/types/migration.js.map +1 -0
  46. package/dist/types/rds.d.ts +101 -0
  47. package/dist/types/rds.d.ts.map +1 -0
  48. package/dist/types/rds.js +8 -0
  49. package/dist/types/rds.js.map +1 -0
  50. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2025 VentureKit Contributors
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @venturekit/data
3
+ *
4
+ * Database and data layer for VentureKit.
5
+ */
6
+ export * from './types';
7
+ export { createRdsConfig, DEFAULT_RDS_CONFIG, buildRdsConfig, } from './rds';
8
+ export type { RdsOutputs, RdsInfraConfig } from './rds';
9
+ export { createMigrationConfig, DEFAULT_MIGRATION_CONFIG, getFlywayEnv, } from './migrations';
10
+ export { query, getPool, mapResults, mapRow, beginTransaction, withTransaction, buildTransaction, } from './query';
11
+ export type { Transaction, ResultsMapper } from './query';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,OAAO,CAAC;AACf,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @venturekit/data
3
+ *
4
+ * Database and data layer for VentureKit.
5
+ */
6
+ // Types
7
+ export * from './types';
8
+ // RDS
9
+ export { createRdsConfig, DEFAULT_RDS_CONFIG, buildRdsConfig, } from './rds';
10
+ // Migrations (recommends Flyway, golang-migrate, Prisma, or Drizzle)
11
+ export { createMigrationConfig, DEFAULT_MIGRATION_CONFIG, getFlywayEnv, } from './migrations';
12
+ // Query utility, result mapping, and transactions
13
+ export { query, getPool, mapResults, mapRow, beginTransaction, withTransaction, buildTransaction, } from './query';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAQ;AACR,cAAc,SAAS,CAAC;AAExB,MAAM;AACN,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,OAAO,CAAC;AAGf,qEAAqE;AACrE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,kDAAkD;AAClD,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Migrations
3
+ *
4
+ * VentureKit recommends using established migration tools rather than custom code.
5
+ * This module provides configuration helpers for integrating with popular tools.
6
+ *
7
+ * Recommended tools:
8
+ * - Flyway (https://flywaydb.org) - Java-based, widely used
9
+ * - golang-migrate (https://github.com/golang-migrate/migrate) - Lightweight CLI
10
+ * - Prisma Migrate (https://www.prisma.io/migrate) - If using Prisma ORM
11
+ * - Drizzle Kit (https://orm.drizzle.team/kit-docs/overview) - If using Drizzle ORM
12
+ */
13
+ import type { MigrationConfig, MigrationConfigInput } from '../types';
14
+ /**
15
+ * Default migration configuration
16
+ */
17
+ export declare const DEFAULT_MIGRATION_CONFIG: MigrationConfig;
18
+ /**
19
+ * Create migration configuration from input
20
+ */
21
+ export declare function createMigrationConfig(input?: MigrationConfigInput): MigrationConfig;
22
+ /**
23
+ * Get Flyway configuration for SST
24
+ *
25
+ * Returns environment variables to pass to Flyway container/Lambda
26
+ */
27
+ export declare function getFlywayEnv(config: MigrationConfig, dbUrl: string): Record<string, string>;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,eAAe,CAOnF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO3F"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Migrations
3
+ *
4
+ * VentureKit recommends using established migration tools rather than custom code.
5
+ * This module provides configuration helpers for integrating with popular tools.
6
+ *
7
+ * Recommended tools:
8
+ * - Flyway (https://flywaydb.org) - Java-based, widely used
9
+ * - golang-migrate (https://github.com/golang-migrate/migrate) - Lightweight CLI
10
+ * - Prisma Migrate (https://www.prisma.io/migrate) - If using Prisma ORM
11
+ * - Drizzle Kit (https://orm.drizzle.team/kit-docs/overview) - If using Drizzle ORM
12
+ */
13
+ /**
14
+ * Default migration configuration
15
+ */
16
+ export const DEFAULT_MIGRATION_CONFIG = {
17
+ tool: 'flyway',
18
+ migrationsDir: 'db/migrations',
19
+ };
20
+ /**
21
+ * Create migration configuration from input
22
+ */
23
+ export function createMigrationConfig(input) {
24
+ if (!input)
25
+ return DEFAULT_MIGRATION_CONFIG;
26
+ return {
27
+ ...DEFAULT_MIGRATION_CONFIG,
28
+ ...input,
29
+ };
30
+ }
31
+ /**
32
+ * Get Flyway configuration for SST
33
+ *
34
+ * Returns environment variables to pass to Flyway container/Lambda
35
+ */
36
+ export function getFlywayEnv(config, dbUrl) {
37
+ return {
38
+ FLYWAY_URL: dbUrl,
39
+ FLYWAY_LOCATIONS: `filesystem:${config.migrationsDir}`,
40
+ ...(config.schema && { FLYWAY_SCHEMAS: config.schema }),
41
+ ...(config.baselineVersion && { FLYWAY_BASELINE_VERSION: config.baselineVersion }),
42
+ };
43
+ }
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,eAAe;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAA4B;IAChE,IAAI,CAAC,KAAK;QAAE,OAAO,wBAAwB,CAAC;IAE5C,OAAO;QACL,GAAG,wBAAwB;QAC3B,GAAG,KAAK;KACT,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAuB,EAAE,KAAa;IACjE,OAAO;QACL,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,cAAc,MAAM,CAAC,aAAa,EAAE;QACtD,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QACvD,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,uBAAuB,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;KACnF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Query Module
3
+ *
4
+ * Provides database querying, result mapping, and transaction support.
5
+ */
6
+ import type { ResultsMapper } from './transaction';
7
+ export { getPool } from './pool';
8
+ export { mapResults, mapRow } from './mapper';
9
+ export { beginTransaction, withTransaction, buildTransaction, } from './transaction';
10
+ export type { Transaction, ResultsMapper } from './transaction';
11
+ /**
12
+ * Execute a SQL query against the connection pool.
13
+ *
14
+ * Columns with dot-notation aliases (e.g. "author.id") are
15
+ * automatically mapped into nested objects.
16
+ *
17
+ * @param sqlQuery - SQL with $1, $2, etc. placeholders
18
+ * @param queryParams - Parameter values
19
+ * @param resultsMapper - Optional function to transform mapped results
20
+ * @returns Mapped (and optionally transformed) rows
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Simple query
25
+ * const posts = await query('SELECT * FROM posts WHERE id = $1', [id]);
26
+ *
27
+ * // JOIN with dot-notation mapping
28
+ * const posts = await query(
29
+ * `SELECT p.id, p.title,
30
+ * u.id AS "author.id",
31
+ * u.name AS "author.name"
32
+ * FROM posts p
33
+ * JOIN users u ON u.id = p.author_id`,
34
+ * );
35
+ * // => [{ id: '1', title: 'Hello', author: { id: '5', name: 'Alice' } }]
36
+ *
37
+ * // Custom results mapper
38
+ * const titles = await query<string[]>(
39
+ * 'SELECT title FROM posts',
40
+ * [],
41
+ * (rows) => rows.map(r => r.title as string),
42
+ * );
43
+ * ```
44
+ */
45
+ export declare function query<T = Record<string, unknown>[]>(sqlQuery: string, queryParams?: unknown[], resultsMapper?: ResultsMapper<T>): Promise<T>;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACvD,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,EAAE,EACvB,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAKZ"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Query Module
3
+ *
4
+ * Provides database querying, result mapping, and transaction support.
5
+ */
6
+ import { getPool } from './pool';
7
+ import { mapResults } from './mapper';
8
+ export { getPool } from './pool';
9
+ export { mapResults, mapRow } from './mapper';
10
+ export { beginTransaction, withTransaction, buildTransaction, } from './transaction';
11
+ /**
12
+ * Execute a SQL query against the connection pool.
13
+ *
14
+ * Columns with dot-notation aliases (e.g. "author.id") are
15
+ * automatically mapped into nested objects.
16
+ *
17
+ * @param sqlQuery - SQL with $1, $2, etc. placeholders
18
+ * @param queryParams - Parameter values
19
+ * @param resultsMapper - Optional function to transform mapped results
20
+ * @returns Mapped (and optionally transformed) rows
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Simple query
25
+ * const posts = await query('SELECT * FROM posts WHERE id = $1', [id]);
26
+ *
27
+ * // JOIN with dot-notation mapping
28
+ * const posts = await query(
29
+ * `SELECT p.id, p.title,
30
+ * u.id AS "author.id",
31
+ * u.name AS "author.name"
32
+ * FROM posts p
33
+ * JOIN users u ON u.id = p.author_id`,
34
+ * );
35
+ * // => [{ id: '1', title: 'Hello', author: { id: '5', name: 'Alice' } }]
36
+ *
37
+ * // Custom results mapper
38
+ * const titles = await query<string[]>(
39
+ * 'SELECT title FROM posts',
40
+ * [],
41
+ * (rows) => rows.map(r => r.title as string),
42
+ * );
43
+ * ```
44
+ */
45
+ export async function query(sqlQuery, queryParams, resultsMapper) {
46
+ const pool = getPool();
47
+ const res = await pool.query(sqlQuery, queryParams);
48
+ const mapped = mapResults(res.rows);
49
+ return resultsMapper ? resultsMapper(mapped) : mapped;
50
+ }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/query/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAU,MAAM,UAAU,CAAC;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,QAAgB,EAChB,WAAuB,EACvB,aAAgC;IAEhC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,GAAG,GAAgB,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAsB,CAAC;AACxE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Result Mapper
3
+ *
4
+ * Maps flat database rows with dot-notation column aliases
5
+ * into nested objects.
6
+ *
7
+ * Example:
8
+ * { "id": 1, "author.id": 5, "author.name": "Alice" }
9
+ * becomes
10
+ * { id: 1, author: { id: 5, name: "Alice" } }
11
+ */
12
+ export declare function mapRow(row: Record<string, unknown>): Record<string, unknown>;
13
+ export declare function mapResults(rows: Record<string, unknown>[]): Record<string, unknown>[];
14
+ //# sourceMappingURL=mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../src/query/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAwB5E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAGrF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Result Mapper
3
+ *
4
+ * Maps flat database rows with dot-notation column aliases
5
+ * into nested objects.
6
+ *
7
+ * Example:
8
+ * { "id": 1, "author.id": 5, "author.name": "Alice" }
9
+ * becomes
10
+ * { id: 1, author: { id: 5, name: "Alice" } }
11
+ */
12
+ export function mapRow(row) {
13
+ const mapped = {};
14
+ for (const [key, value] of Object.entries(row)) {
15
+ if (key.indexOf('.') > 0) {
16
+ const parts = key.split('.');
17
+ let current = mapped;
18
+ let part = parts.shift();
19
+ while (parts.length > 0) {
20
+ if (!current[part]) {
21
+ current[part] = {};
22
+ }
23
+ current = current[part];
24
+ part = parts.shift();
25
+ }
26
+ current[part] = value;
27
+ }
28
+ else {
29
+ mapped[key] = value;
30
+ }
31
+ }
32
+ return mapped;
33
+ }
34
+ export function mapResults(rows) {
35
+ if (!rows || rows.length === 0)
36
+ return [];
37
+ return rows.map(mapRow);
38
+ }
39
+ //# sourceMappingURL=mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapper.js","sourceRoot":"","sources":["../../src/query/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,UAAU,MAAM,CAAC,GAA4B;IACjD,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,OAAO,GAA4B,MAAM,CAAC;YAC9C,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;YAE1B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACrB,CAAC;gBACD,OAAO,GAAG,OAAO,CAAC,IAAI,CAA4B,CAAC;gBACnD,IAAI,GAAG,KAAK,CAAC,KAAK,EAAG,CAAC;YACxB,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAA+B;IACxD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Database Connection Pool
3
+ *
4
+ * Creates a pg connection pool from environment variables.
5
+ * All credentials are loaded from env — never hardcoded.
6
+ *
7
+ * Required env vars:
8
+ * - DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
9
+ * Optional:
10
+ * - DB_SSL ("true" to enable), DB_POOL_MAX (default 10)
11
+ */
12
+ import { Pool } from 'pg';
13
+ export declare function getPool(): Pool;
14
+ //# sourceMappingURL=pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/query/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAI1B,wBAAgB,OAAO,IAAI,IAAI,CAa9B"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Database Connection Pool
3
+ *
4
+ * Creates a pg connection pool from environment variables.
5
+ * All credentials are loaded from env — never hardcoded.
6
+ *
7
+ * Required env vars:
8
+ * - DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
9
+ * Optional:
10
+ * - DB_SSL ("true" to enable), DB_POOL_MAX (default 10)
11
+ */
12
+ import { Pool } from 'pg';
13
+ let pool = null;
14
+ export function getPool() {
15
+ if (!pool) {
16
+ pool = new Pool({
17
+ host: process.env.DB_HOST,
18
+ port: Number(process.env.DB_PORT ?? 5432),
19
+ database: process.env.DB_NAME,
20
+ user: process.env.DB_USER,
21
+ password: process.env.DB_PASSWORD,
22
+ ssl: process.env.DB_SSL === 'true' ? { rejectUnauthorized: false } : undefined,
23
+ max: Number(process.env.DB_POOL_MAX ?? 10),
24
+ });
25
+ }
26
+ return pool;
27
+ }
28
+ //# sourceMappingURL=pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../src/query/pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,IAAI,IAAI,GAAgB,IAAI,CAAC;AAE7B,MAAM,UAAU,OAAO;IACrB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,IAAI,IAAI,CAAC;YACd,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YACzB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;YACzC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YAC7B,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;YACzB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;YACjC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;YAC9E,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;SAC3C,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Transaction Support
3
+ *
4
+ * Provides manual and automatic transaction management.
5
+ *
6
+ * - beginTransaction() — manual commit/rollback
7
+ * - withTransaction(fn) — auto commit on success, rollback on error
8
+ */
9
+ import type { PoolClient } from 'pg';
10
+ export type ResultsMapper<T> = (rows: Record<string, unknown>[]) => T;
11
+ /**
12
+ * A transaction handle providing query, commit, and rollback.
13
+ */
14
+ export interface Transaction {
15
+ /** Execute a query within the transaction */
16
+ query<T = Record<string, unknown>[]>(sqlQuery: string, queryParams?: unknown[], resultsMapper?: ResultsMapper<T>): Promise<T>;
17
+ /** Commit the transaction */
18
+ commit(): Promise<void>;
19
+ /** Roll back the transaction */
20
+ rollback(): Promise<void>;
21
+ }
22
+ /**
23
+ * Begin a manual transaction.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const tx = await beginTransaction();
28
+ * try {
29
+ * await tx.query('INSERT INTO posts (title) VALUES ($1)', ['Hello']);
30
+ * await tx.query('INSERT INTO audit_log (action) VALUES ($1)', ['post_created']);
31
+ * await tx.commit();
32
+ * } catch (err) {
33
+ * await tx.rollback();
34
+ * throw err;
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function beginTransaction(): Promise<Transaction>;
39
+ /**
40
+ * Execute a callback within a transaction.
41
+ * Commits on success, rolls back on error.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const [post, log] = await withTransaction(async (tx) => {
46
+ * const post = await tx.query('INSERT INTO posts ... RETURNING *', [...]);
47
+ * const log = await tx.query('INSERT INTO audit_log ...', [...]);
48
+ * return [post, log];
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function withTransaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>;
53
+ /**
54
+ * Build a Transaction object from a PoolClient.
55
+ * Used internally by beginTransaction and by the runtime
56
+ * handler's transactional option.
57
+ */
58
+ export declare function buildTransaction(client: PoolClient): Transaction;
59
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/query/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,IAAI,CAAC;AAIlD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,EAAE,EACvB,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAAC;IACd,6BAA6B;IAC7B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,gCAAgC;IAChC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAO7D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAUZ;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,CA4BhE"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Transaction Support
3
+ *
4
+ * Provides manual and automatic transaction management.
5
+ *
6
+ * - beginTransaction() — manual commit/rollback
7
+ * - withTransaction(fn) — auto commit on success, rollback on error
8
+ */
9
+ import { getPool } from './pool';
10
+ import { mapResults } from './mapper';
11
+ /**
12
+ * Begin a manual transaction.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const tx = await beginTransaction();
17
+ * try {
18
+ * await tx.query('INSERT INTO posts (title) VALUES ($1)', ['Hello']);
19
+ * await tx.query('INSERT INTO audit_log (action) VALUES ($1)', ['post_created']);
20
+ * await tx.commit();
21
+ * } catch (err) {
22
+ * await tx.rollback();
23
+ * throw err;
24
+ * }
25
+ * ```
26
+ */
27
+ export async function beginTransaction() {
28
+ const pool = getPool();
29
+ const client = await pool.connect();
30
+ await client.query('BEGIN');
31
+ return buildTransaction(client);
32
+ }
33
+ /**
34
+ * Execute a callback within a transaction.
35
+ * Commits on success, rolls back on error.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const [post, log] = await withTransaction(async (tx) => {
40
+ * const post = await tx.query('INSERT INTO posts ... RETURNING *', [...]);
41
+ * const log = await tx.query('INSERT INTO audit_log ...', [...]);
42
+ * return [post, log];
43
+ * });
44
+ * ```
45
+ */
46
+ export async function withTransaction(fn) {
47
+ const tx = await beginTransaction();
48
+ try {
49
+ const result = await fn(tx);
50
+ await tx.commit();
51
+ return result;
52
+ }
53
+ catch (err) {
54
+ await tx.rollback();
55
+ throw err;
56
+ }
57
+ }
58
+ /**
59
+ * Build a Transaction object from a PoolClient.
60
+ * Used internally by beginTransaction and by the runtime
61
+ * handler's transactional option.
62
+ */
63
+ export function buildTransaction(client) {
64
+ return {
65
+ async query(sqlQuery, queryParams, resultsMapper) {
66
+ const res = await client.query(sqlQuery, queryParams);
67
+ const mapped = mapResults(res.rows);
68
+ return resultsMapper ? resultsMapper(mapped) : mapped;
69
+ },
70
+ async commit() {
71
+ try {
72
+ await client.query('COMMIT');
73
+ }
74
+ finally {
75
+ client.release();
76
+ }
77
+ },
78
+ async rollback() {
79
+ try {
80
+ await client.query('ROLLBACK');
81
+ }
82
+ finally {
83
+ client.release();
84
+ }
85
+ },
86
+ };
87
+ }
88
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/query/transaction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAoBtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,MAAM,GAAe,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IAEhD,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE5B,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,EAAmC;IAEnC,MAAM,EAAE,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,OAAO;QACL,KAAK,CAAC,KAAK,CACT,QAAgB,EAChB,WAAuB,EACvB,aAAgC;YAEhC,MAAM,GAAG,GAAgB,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YACnE,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAsB,CAAC;QACxE,CAAC;QAED,KAAK,CAAC,MAAM;YACV,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACH,CAAC;QAED,KAAK,CAAC,QAAQ;YACZ,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;oBAAS,CAAC;gBACT,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * RDS Configuration
3
+ */
4
+ import type { RdsConfig, RdsConfigInput, DatabaseEngine } from '../types';
5
+ /**
6
+ * Default RDS configuration for PostgreSQL
7
+ *
8
+ * Security best practices enforced:
9
+ * - Storage encryption enabled by default
10
+ * - Public access disabled by default
11
+ * - Master username must be provided (no insecure defaults)
12
+ */
13
+ export declare const DEFAULT_RDS_CONFIG: Omit<RdsConfig, 'masterUsername'>;
14
+ /**
15
+ * Get default port for database engine
16
+ */
17
+ export declare function getDefaultPort(engine: DatabaseEngine): number;
18
+ /**
19
+ * Get default parameter group family
20
+ */
21
+ export declare function getDefaultParameterGroupFamily(engine: DatabaseEngine, version: string): string;
22
+ /**
23
+ * Create RDS configuration from input
24
+ *
25
+ * @param input - Configuration input (masterUsername is required)
26
+ * @throws Error if masterUsername is not provided
27
+ */
28
+ export declare function createRdsConfig(input: RdsConfigInput & {
29
+ masterUsername: string;
30
+ }): RdsConfig;
31
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/rds/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAahE,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAG9F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAiB7F"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * RDS Configuration
3
+ */
4
+ /**
5
+ * Default RDS configuration for PostgreSQL
6
+ *
7
+ * Security best practices enforced:
8
+ * - Storage encryption enabled by default
9
+ * - Public access disabled by default
10
+ * - Master username must be provided (no insecure defaults)
11
+ */
12
+ export const DEFAULT_RDS_CONFIG = {
13
+ engine: 'postgres',
14
+ engineVersion: '15.4',
15
+ instanceClass: 'db.t3.micro',
16
+ allocatedStorageGb: 20,
17
+ databaseName: 'app',
18
+ multiAz: false,
19
+ storageEncrypted: true,
20
+ deletionProtection: false,
21
+ backupRetentionDays: 7,
22
+ performanceInsightsEnabled: false,
23
+ autoMinorVersionUpgrade: true,
24
+ publiclyAccessible: false,
25
+ };
26
+ /**
27
+ * Get default port for database engine
28
+ */
29
+ export function getDefaultPort(engine) {
30
+ return engine === 'postgres' ? 5432 : 3306;
31
+ }
32
+ /**
33
+ * Get default parameter group family
34
+ */
35
+ export function getDefaultParameterGroupFamily(engine, version) {
36
+ const majorVersion = version.split('.')[0];
37
+ return engine === 'postgres' ? `postgres${majorVersion}` : `mysql${majorVersion}`;
38
+ }
39
+ /**
40
+ * Create RDS configuration from input
41
+ *
42
+ * @param input - Configuration input (masterUsername is required)
43
+ * @throws Error if masterUsername is not provided
44
+ */
45
+ export function createRdsConfig(input) {
46
+ if (!input.masterUsername) {
47
+ throw new Error('masterUsername is required - do not use default usernames like "admin" for security');
48
+ }
49
+ const engine = input.engine ?? DEFAULT_RDS_CONFIG.engine;
50
+ const engineVersion = input.engineVersion ?? DEFAULT_RDS_CONFIG.engineVersion;
51
+ return {
52
+ ...DEFAULT_RDS_CONFIG,
53
+ ...input,
54
+ masterUsername: input.masterUsername,
55
+ engine,
56
+ engineVersion,
57
+ port: input.port ?? getDefaultPort(engine),
58
+ parameterGroupFamily: input.parameterGroupFamily ?? getDefaultParameterGroupFamily(engine, engineVersion),
59
+ };
60
+ }
61
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/rds/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAsC;IACnE,MAAM,EAAE,UAAU;IAClB,aAAa,EAAE,MAAM;IACrB,aAAa,EAAE,aAAa;IAC5B,kBAAkB,EAAE,EAAE;IACtB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,IAAI;IACtB,kBAAkB,EAAE,KAAK;IACzB,mBAAmB,EAAE,CAAC;IACtB,0BAA0B,EAAE,KAAK;IACjC,uBAAuB,EAAE,IAAI;IAC7B,kBAAkB,EAAE,KAAK;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAsB,EAAE,OAAe;IACpF,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,YAAY,EAAE,CAAC,CAAC,CAAC,QAAQ,YAAY,EAAE,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkD;IAChF,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IACzG,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,kBAAkB,CAAC,MAAM,CAAC;IACzD,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,IAAI,kBAAkB,CAAC,aAAa,CAAC;IAE9E,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,KAAK;QACR,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,MAAM;QACN,aAAa;QACb,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,cAAc,CAAC,MAAM,CAAC;QAC1C,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,IAAI,8BAA8B,CAAC,MAAM,EAAE,aAAa,CAAC;KAC1G,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * RDS Construct
3
+ *
4
+ * Creates and configures AWS RDS instances for VentureKit.
5
+ */
6
+ export { createRdsConfig, DEFAULT_RDS_CONFIG } from './config';
7
+ export { buildRdsConfig } from './instance';
8
+ export type { RdsOutputs, RdsInfraConfig } from './instance';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rds/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * RDS Construct
3
+ *
4
+ * Creates and configures AWS RDS instances for VentureKit.
5
+ */
6
+ export { createRdsConfig, DEFAULT_RDS_CONFIG } from './config';
7
+ export { buildRdsConfig } from './instance';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rds/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * RDS Instance Configuration Builder
3
+ *
4
+ * @deprecated Use intent-based infrastructure instead:
5
+ * ```typescript
6
+ * defineVenture({
7
+ * infrastructure: {
8
+ * databases: [{ id: 'main', type: 'postgres', size: 'small', name: 'mydb' }]
9
+ * }
10
+ * })
11
+ * ```
12
+ *
13
+ * This file is kept for backward compatibility.
14
+ * New projects should use the intent-based API in @venturekit/infra.
15
+ */
16
+ import type { RdsConfig } from '../types';
17
+ /**
18
+ * RDS outputs (returned after infrastructure creation)
19
+ */
20
+ export interface RdsOutputs {
21
+ instanceId: string;
22
+ instanceArn: string;
23
+ endpoint: string;
24
+ port: number;
25
+ databaseName: string;
26
+ secretArn: string;
27
+ }
28
+ /**
29
+ * RDS configuration for infrastructure layer
30
+ */
31
+ export interface RdsInfraConfig {
32
+ name: string;
33
+ identifier: string;
34
+ engine: 'postgres' | 'mysql';
35
+ engineVersion: string;
36
+ instanceClass: string;
37
+ allocatedStorage: number;
38
+ maxAllocatedStorage?: number;
39
+ databaseName: string;
40
+ masterUsername: string;
41
+ multiAz: boolean;
42
+ storageEncrypted: boolean;
43
+ deletionProtection: boolean;
44
+ backupRetentionPeriod: number;
45
+ preferredBackupWindow?: string;
46
+ preferredMaintenanceWindow?: string;
47
+ performanceInsightsEnabled: boolean;
48
+ performanceInsightsRetentionPeriod?: number;
49
+ monitoringInterval?: number;
50
+ autoMinorVersionUpgrade: boolean;
51
+ publiclyAccessible: boolean;
52
+ port: number;
53
+ parameterGroupFamily: string;
54
+ parameters?: Record<string, string>;
55
+ subnetIds?: string[];
56
+ vpcId?: string;
57
+ }
58
+ /**
59
+ * Build RDS Instance configuration for infrastructure layer
60
+ *
61
+ * This returns a configuration object that @venturekit/infra uses
62
+ * to create the actual RDS resources via SST.
63
+ */
64
+ export declare function buildRdsConfig(name: string, config: RdsConfig, vpcId?: string, subnetIds?: string[]): RdsInfraConfig;
65
+ //# sourceMappingURL=instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/rds/instance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,0BAA0B,EAAE,OAAO,CAAC;IACpC,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,OAAO,CAAC;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,EACjB,KAAK,CAAC,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,cAAc,CA4BhB"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * RDS Instance Configuration Builder
3
+ *
4
+ * @deprecated Use intent-based infrastructure instead:
5
+ * ```typescript
6
+ * defineVenture({
7
+ * infrastructure: {
8
+ * databases: [{ id: 'main', type: 'postgres', size: 'small', name: 'mydb' }]
9
+ * }
10
+ * })
11
+ * ```
12
+ *
13
+ * This file is kept for backward compatibility.
14
+ * New projects should use the intent-based API in @venturekit/infra.
15
+ */
16
+ /**
17
+ * Build RDS Instance configuration for infrastructure layer
18
+ *
19
+ * This returns a configuration object that @venturekit/infra uses
20
+ * to create the actual RDS resources via SST.
21
+ */
22
+ export function buildRdsConfig(name, config, vpcId, subnetIds) {
23
+ return {
24
+ name: `${name}-db`,
25
+ identifier: `${name}-db`,
26
+ engine: config.engine === 'postgres' ? 'postgres' : 'mysql',
27
+ engineVersion: config.engineVersion,
28
+ instanceClass: config.instanceClass,
29
+ allocatedStorage: config.allocatedStorageGb,
30
+ maxAllocatedStorage: config.maxStorageGb,
31
+ databaseName: config.databaseName,
32
+ masterUsername: config.masterUsername,
33
+ multiAz: config.multiAz ?? false,
34
+ storageEncrypted: config.storageEncrypted ?? true,
35
+ deletionProtection: config.deletionProtection ?? false,
36
+ backupRetentionPeriod: config.backupRetentionDays ?? 7,
37
+ preferredBackupWindow: config.preferredBackupWindow,
38
+ preferredMaintenanceWindow: config.preferredMaintenanceWindow,
39
+ performanceInsightsEnabled: config.performanceInsightsEnabled ?? false,
40
+ performanceInsightsRetentionPeriod: config.performanceInsightsRetentionDays,
41
+ monitoringInterval: config.enhancedMonitoringIntervalSeconds,
42
+ autoMinorVersionUpgrade: config.autoMinorVersionUpgrade ?? true,
43
+ publiclyAccessible: config.publiclyAccessible ?? false,
44
+ port: config.port ?? (config.engine === 'postgres' ? 5432 : 3306),
45
+ parameterGroupFamily: config.parameterGroupFamily ?? `postgres${config.engineVersion.split('.')[0]}`,
46
+ parameters: config.parameters,
47
+ subnetIds,
48
+ vpcId,
49
+ };
50
+ }
51
+ //# sourceMappingURL=instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/rds/instance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA+CH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,MAAiB,EACjB,KAAc,EACd,SAAoB;IAEpB,OAAO;QACL,IAAI,EAAE,GAAG,IAAI,KAAK;QAClB,UAAU,EAAE,GAAG,IAAI,KAAK;QACxB,MAAM,EAAE,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;QAC3D,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,gBAAgB,EAAE,MAAM,CAAC,kBAAkB;QAC3C,mBAAmB,EAAE,MAAM,CAAC,YAAY;QACxC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;QAChC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,IAAI;QACjD,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,KAAK;QACtD,qBAAqB,EAAE,MAAM,CAAC,mBAAmB,IAAI,CAAC;QACtD,qBAAqB,EAAE,MAAM,CAAC,qBAAqB;QACnD,0BAA0B,EAAE,MAAM,CAAC,0BAA0B;QAC7D,0BAA0B,EAAE,MAAM,CAAC,0BAA0B,IAAI,KAAK;QACtE,kCAAkC,EAAE,MAAM,CAAC,gCAAgC;QAC3E,kBAAkB,EAAE,MAAM,CAAC,iCAAiC;QAC5D,uBAAuB,EAAE,MAAM,CAAC,uBAAuB,IAAI,IAAI;QAC/D,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,KAAK;QACtD,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,oBAAoB,EAAE,MAAM,CAAC,oBAAoB,IAAI,WAAW,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QACpG,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Data Types
3
+ *
4
+ * Database and data layer types for VentureKit.
5
+ */
6
+ export * from './rds';
7
+ export * from './migration';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Data Types
3
+ *
4
+ * Database and data layer types for VentureKit.
5
+ */
6
+ export * from './rds';
7
+ export * from './migration';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Migration Types
3
+ *
4
+ * VentureKit recommends using established migration tools:
5
+ * - Flyway (https://flywaydb.org) - Java-based, widely used
6
+ * - golang-migrate (https://github.com/golang-migrate/migrate) - Lightweight CLI
7
+ * - Prisma Migrate (https://www.prisma.io/migrate) - If using Prisma ORM
8
+ * - Drizzle Kit (https://orm.drizzle.team/kit-docs/overview) - If using Drizzle ORM
9
+ *
10
+ * These types are provided for integration with migration tools, not for custom implementation.
11
+ */
12
+ /**
13
+ * Migration tool configuration
14
+ */
15
+ export interface MigrationConfig {
16
+ /** Migration tool to use */
17
+ tool: 'flyway' | 'golang-migrate' | 'prisma' | 'drizzle' | 'custom';
18
+ /** Migrations directory path */
19
+ migrationsDir: string;
20
+ /** Schema to use */
21
+ schema?: string;
22
+ /** Baseline version (for existing databases) */
23
+ baselineVersion?: string;
24
+ }
25
+ /**
26
+ * Migration config input (partial for overrides)
27
+ */
28
+ export interface MigrationConfigInput {
29
+ tool?: 'flyway' | 'golang-migrate' | 'prisma' | 'drizzle' | 'custom';
30
+ migrationsDir?: string;
31
+ schema?: string;
32
+ baselineVersion?: string;
33
+ }
34
+ //# sourceMappingURL=migration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,IAAI,EAAE,QAAQ,GAAG,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IAEpE,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IAEtB,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Migration Types
3
+ *
4
+ * VentureKit recommends using established migration tools:
5
+ * - Flyway (https://flywaydb.org) - Java-based, widely used
6
+ * - golang-migrate (https://github.com/golang-migrate/migrate) - Lightweight CLI
7
+ * - Prisma Migrate (https://www.prisma.io/migrate) - If using Prisma ORM
8
+ * - Drizzle Kit (https://orm.drizzle.team/kit-docs/overview) - If using Drizzle ORM
9
+ *
10
+ * These types are provided for integration with migration tools, not for custom implementation.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * RDS Configuration Types
3
+ *
4
+ * For InstanceClass, use aws-cdk-lib/aws-rds InstanceClass and InstanceSize.
5
+ * Example: `ec2.InstanceClass.T3` + `ec2.InstanceSize.MICRO`
6
+ */
7
+ /**
8
+ * Database engine
9
+ */
10
+ export type DatabaseEngine = 'postgres' | 'mysql';
11
+ /**
12
+ * RDS configuration
13
+ */
14
+ export interface RdsConfig {
15
+ /** Database engine */
16
+ engine: DatabaseEngine;
17
+ /** Engine version */
18
+ engineVersion: string;
19
+ /** Instance class (e.g., 'db.t3.micro', 'db.r6g.large') */
20
+ instanceClass: string;
21
+ /** Allocated storage in GB */
22
+ allocatedStorageGb: number;
23
+ /** Maximum storage in GB (for autoscaling) */
24
+ maxStorageGb?: number;
25
+ /** Database name */
26
+ databaseName: string;
27
+ /** Master username */
28
+ masterUsername: string;
29
+ /** Enable Multi-AZ deployment */
30
+ multiAz: boolean;
31
+ /** Enable storage encryption */
32
+ storageEncrypted: boolean;
33
+ /** Enable deletion protection */
34
+ deletionProtection: boolean;
35
+ /** Backup retention period in days */
36
+ backupRetentionDays: number;
37
+ /** Preferred backup window (UTC) */
38
+ preferredBackupWindow?: string;
39
+ /** Preferred maintenance window (UTC) */
40
+ preferredMaintenanceWindow?: string;
41
+ /** Enable Performance Insights */
42
+ performanceInsightsEnabled: boolean;
43
+ /** Performance Insights retention in days */
44
+ performanceInsightsRetentionDays?: number;
45
+ /** Enable enhanced monitoring */
46
+ enhancedMonitoringIntervalSeconds?: number;
47
+ /** Enable auto minor version upgrade */
48
+ autoMinorVersionUpgrade: boolean;
49
+ /** Enable public accessibility (not recommended for production) */
50
+ publiclyAccessible: boolean;
51
+ /** Port (default: 5432 for postgres, 3306 for mysql) */
52
+ port?: number;
53
+ /** Parameter group family */
54
+ parameterGroupFamily?: string;
55
+ /** Custom parameters */
56
+ parameters?: Record<string, string>;
57
+ }
58
+ /**
59
+ * RDS configuration input (partial for overrides)
60
+ */
61
+ export interface RdsConfigInput {
62
+ engine?: DatabaseEngine;
63
+ engineVersion?: string;
64
+ instanceClass?: string;
65
+ allocatedStorageGb?: number;
66
+ maxStorageGb?: number;
67
+ databaseName?: string;
68
+ masterUsername?: string;
69
+ multiAz?: boolean;
70
+ storageEncrypted?: boolean;
71
+ deletionProtection?: boolean;
72
+ backupRetentionDays?: number;
73
+ preferredBackupWindow?: string;
74
+ preferredMaintenanceWindow?: string;
75
+ performanceInsightsEnabled?: boolean;
76
+ performanceInsightsRetentionDays?: number;
77
+ enhancedMonitoringIntervalSeconds?: number;
78
+ autoMinorVersionUpgrade?: boolean;
79
+ publiclyAccessible?: boolean;
80
+ port?: number;
81
+ parameterGroupFamily?: string;
82
+ parameters?: Record<string, string>;
83
+ }
84
+ /**
85
+ * RDS outputs
86
+ */
87
+ export interface RdsOutputs {
88
+ /** RDS instance identifier */
89
+ instanceId: string;
90
+ /** RDS instance ARN */
91
+ instanceArn: string;
92
+ /** Database endpoint hostname */
93
+ endpoint: string;
94
+ /** Database port */
95
+ port: number;
96
+ /** Database name */
97
+ databaseName: string;
98
+ /** Secret ARN containing credentials */
99
+ secretArn: string;
100
+ }
101
+ //# sourceMappingURL=rds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rds.d.ts","sourceRoot":"","sources":["../../src/types/rds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sBAAsB;IACtB,MAAM,EAAE,cAAc,CAAC;IAEvB,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IAEtB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IAEtB,8BAA8B;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAE3B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IAErB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;IAEvB,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IAEjB,gCAAgC;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAE1B,iCAAiC;IACjC,kBAAkB,EAAE,OAAO,CAAC;IAE5B,sCAAsC;IACtC,mBAAmB,EAAE,MAAM,CAAC;IAE5B,oCAAoC;IACpC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,yCAAyC;IACzC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAEpC,kCAAkC;IAClC,0BAA0B,EAAE,OAAO,CAAC;IAEpC,6CAA6C;IAC7C,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAE1C,iCAAiC;IACjC,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAE3C,wCAAwC;IACxC,uBAAuB,EAAE,OAAO,CAAC;IAEjC,mEAAmE;IACnE,kBAAkB,EAAE,OAAO,CAAC;IAE5B,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,wBAAwB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAC1C,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;IAEnB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IAEjB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IAEb,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IAErB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * RDS Configuration Types
3
+ *
4
+ * For InstanceClass, use aws-cdk-lib/aws-rds InstanceClass and InstanceSize.
5
+ * Example: `ec2.InstanceClass.T3` + `ec2.InstanceSize.MICRO`
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=rds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rds.js","sourceRoot":"","sources":["../../src/types/rds.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@venturekit/data",
3
+ "version": "0.0.0-dev.20260307234057",
4
+ "description": "Database and data layer for VentureKit",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/venturekit-dev/venturekit.private.git",
14
+ "directory": "packages/data"
15
+ },
16
+ "publishConfig": {
17
+ "registry": "https://registry.npmjs.org",
18
+ "access": "public"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/index.js",
24
+ "types": "./dist/index.d.ts"
25
+ }
26
+ },
27
+ "dependencies": {
28
+ "@venturekit/core": "0.0.0-dev.20260307234057",
29
+ "pg": "^8.12.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^20.10.0",
33
+ "@types/pg": "^8.11.0",
34
+ "typescript": "^5.3.0"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "dev": "tsc --watch",
39
+ "clean": "rm -rf dist"
40
+ }
41
+ }