@pipeline-builder/pipeline-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +69 -0
  3. package/lib/cdk.d.ts +38 -0
  4. package/lib/cdk.js +44 -0
  5. package/lib/config/app-config.d.ts +109 -0
  6. package/lib/config/app-config.js +197 -0
  7. package/lib/config/aws-config-cdk.d.ts +49 -0
  8. package/lib/config/aws-config-cdk.js +65 -0
  9. package/lib/config/billing-config.d.ts +24 -0
  10. package/lib/config/billing-config.js +497 -0
  11. package/lib/config/config-types.d.ts +346 -0
  12. package/lib/config/config-types.js +4 -0
  13. package/lib/config/entitlements.d.ts +23 -0
  14. package/lib/config/entitlements.js +46 -0
  15. package/lib/config/handler-constants.d.ts +10 -0
  16. package/lib/config/handler-constants.js +39 -0
  17. package/lib/config/infrastructure-config.d.ts +66 -0
  18. package/lib/config/infrastructure-config.js +197 -0
  19. package/lib/config/server-config.d.ts +53 -0
  20. package/lib/config/server-config.js +175 -0
  21. package/lib/config/service-client.d.ts +13 -0
  22. package/lib/config/service-client.js +20 -0
  23. package/lib/core/artifact-manager.d.ts +62 -0
  24. package/lib/core/artifact-manager.js +83 -0
  25. package/lib/core/id-generator.d.ts +50 -0
  26. package/lib/core/id-generator.js +50 -0
  27. package/lib/core/metadata-builder.d.ts +48 -0
  28. package/lib/core/metadata-builder.js +278 -0
  29. package/lib/core/metadata-helpers.d.ts +31 -0
  30. package/lib/core/metadata-helpers.js +55 -0
  31. package/lib/core/network-types.d.ts +200 -0
  32. package/lib/core/network-types.js +4 -0
  33. package/lib/core/network.d.ts +33 -0
  34. package/lib/core/network.js +112 -0
  35. package/lib/core/pipeline-helpers.d.ts +61 -0
  36. package/lib/core/pipeline-helpers.js +563 -0
  37. package/lib/core/pipeline-types.d.ts +118 -0
  38. package/lib/core/pipeline-types.js +131 -0
  39. package/lib/core/role-types.d.ts +254 -0
  40. package/lib/core/role-types.js +4 -0
  41. package/lib/core/role.d.ts +14 -0
  42. package/lib/core/role.js +117 -0
  43. package/lib/core/security-group-types.d.ts +84 -0
  44. package/lib/core/security-group-types.js +4 -0
  45. package/lib/core/security-group.d.ts +14 -0
  46. package/lib/core/security-group.js +33 -0
  47. package/lib/handlers/plugin-lookup-handler.d.ts +32 -0
  48. package/lib/handlers/plugin-lookup-handler.js +292 -0
  49. package/lib/handlers/pnpm-lock.yaml +12 -0
  50. package/lib/index.d.ts +45 -0
  51. package/lib/index.js +53 -0
  52. package/lib/pipeline/pipeline-builder.d.ts +123 -0
  53. package/lib/pipeline/pipeline-builder.js +476 -0
  54. package/lib/pipeline/pipeline-configuration.d.ts +81 -0
  55. package/lib/pipeline/pipeline-configuration.js +214 -0
  56. package/lib/pipeline/plugin-lookup.d.ts +131 -0
  57. package/lib/pipeline/plugin-lookup.js +316 -0
  58. package/lib/pipeline/plugin-spec.d.ts +138 -0
  59. package/lib/pipeline/plugin-spec.js +4 -0
  60. package/lib/pipeline/source-builder.d.ts +62 -0
  61. package/lib/pipeline/source-builder.js +164 -0
  62. package/lib/pipeline/source-types.d.ts +221 -0
  63. package/lib/pipeline/source-types.js +4 -0
  64. package/lib/pipeline/stage-builder.d.ts +78 -0
  65. package/lib/pipeline/stage-builder.js +129 -0
  66. package/lib/pipeline/step-types.d.ts +222 -0
  67. package/lib/pipeline/step-types.js +4 -0
  68. package/lib/template/evaluator.d.ts +42 -0
  69. package/lib/template/evaluator.js +164 -0
  70. package/lib/template/index.d.ts +34 -0
  71. package/lib/template/index.js +118 -0
  72. package/lib/template/metrics.d.ts +10 -0
  73. package/lib/template/metrics.js +43 -0
  74. package/lib/template/plugin-resolver.d.ts +8 -0
  75. package/lib/template/plugin-resolver.js +48 -0
  76. package/lib/template/tokenizer.d.ts +49 -0
  77. package/lib/template/tokenizer.js +233 -0
  78. package/lib/template/topo-sort.d.ts +17 -0
  79. package/lib/template/topo-sort.js +88 -0
  80. package/lib/template/validate.d.ts +45 -0
  81. package/lib/template/validate.js +96 -0
  82. package/lib/template/walker.d.ts +34 -0
  83. package/lib/template/walker.js +83 -0
  84. package/package.json +184 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
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 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 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 those 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
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @pipeline-builder/pipeline-core
2
+
3
+ 📖 **[View documentation](https://mwashburn160.github.io/pipeline-builder/)**
4
+
5
+ AWS CDK construct library for [Pipeline Builder](https://mwashburn160.github.io/pipeline-builder/): the `PipelineBuilder` construct that assembles plugin specs into a CodePipeline stack, the `PluginLookup` custom resource, pipeline/plugin domain types, and shared configuration.
6
+
7
+ > Internal workspace package — consumed by other packages via `workspace:*`.
8
+
9
+ ## Responsibilities
10
+
11
+ - Provides the CDK constructs that synthesize a CodePipeline stack from plugin specs (`PipelineBuilder`, `StageBuilder`, `PipelineConfiguration`, `ArtifactManager`).
12
+ - Resolves plugin specs at deploy time via the `PluginLookup` custom resource.
13
+ - Hosts the synth-time template engine that parameterizes pipeline config and plugin specs.
14
+ - Owns the pipeline/plugin domain types and the environment-driven application `Config`.
15
+ - Re-exports the `pipeline-data` database layer so consumers depend on a single package for both CDK and DB access.
16
+
17
+ ## Key exports
18
+
19
+ ### CDK constructs
20
+ | Export | Purpose |
21
+ |---|---|
22
+ | `PipelineBuilder` | Top-level construct that assembles plugin specs into a CodePipeline stack |
23
+ | `StageBuilder` | Composes pipeline stages from plugin steps |
24
+ | `PipelineConfiguration` | Resolves and merges pipeline config metadata |
25
+ | `ArtifactManager` | Manages build artifacts across stages |
26
+ | `PluginLookup` | Custom resource that resolves plugin specs at deploy time |
27
+
28
+ ### Template engine (synth-time)
29
+ | Export | Purpose |
30
+ |---|---|
31
+ | `tokenize`, `hasTemplate` | Parse template strings into tokens |
32
+ | `resolve`, `resolveString`, `dependencies`, `lookupPath` | Evaluate expressions and report dependencies |
33
+ | `resolveTemplates`, `resolveSelfReferencing` | Walk a document and resolve string fields in place |
34
+ | `walkAndBind`, `topoSort`, `validateTemplates`, `TokenCache` | Field binding, dependency ordering, validation, and token caching |
35
+
36
+ ### Domain types & config
37
+ | Export | Purpose |
38
+ |---|---|
39
+ | `Config`, `ConfigTypes` | Environment-driven application config singleton and typed interfaces |
40
+ | `PipelineType`, `ComputeType`, `PluginType`, `Visibility` | Pipeline domain enums |
41
+ | `SourceTypes`, `StepTypes`, `NetworkTypes`, `RoleTypes`, `SecurityGroupTypes` | Pipeline source/step and infrastructure type definitions |
42
+ | `IdGenerator`, `replaceNonAlphanumeric`, `extractMetadataEnv` | ID generation and string/metadata helpers |
43
+ | `buildConfigFromMetadata`, `metadataForCodePipeline`, `metadataForShellStep`, … | Metadata builders |
44
+
45
+ ### Re-exported from `pipeline-data`
46
+ `db`, `getConnection`, `closeConnection`, `schema`, `CrudService`, `runMigrations`, the tenant-context primitives (`tenantContext`, `runWithTenantContext`, `withTenantTx`), the query condition builders/filters, and `drizzleRows` / `drizzleCount`.
47
+
48
+ ## Usage
49
+
50
+ ```typescript
51
+ import { PipelineBuilder, Config } from '@pipeline-builder/pipeline-core';
52
+
53
+ const config = Config.getInstance();
54
+
55
+ new PipelineBuilder(this, 'Pipeline', {
56
+ // plugin specs + pipeline config resolved into a CodePipeline stack
57
+ });
58
+ ```
59
+
60
+ ## Development
61
+
62
+ ```bash
63
+ pnpm build # projen build (compile + lint + test + package)
64
+ pnpm test # run the Jest test suite
65
+ ```
66
+
67
+ ## License
68
+
69
+ Apache-2.0. See [LICENSE](./LICENSE).
package/lib/cdk.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @module @pipeline-builder/pipeline-core/cdk
3
+ *
4
+ * The AWS CDK surface: the constructs that assemble a pipeline into a
5
+ * CodePipeline stack, the synth-time authoring types they take, and the adapters
6
+ * that turn plain `AWSConfig` data into CDK value objects.
7
+ *
8
+ * Everything reachable from here pulls in `aws-cdk-lib`, which is why it is a
9
+ * separate entry point from the package root. Import from here only in code that
10
+ * actually synthesizes stacks — the CLI's CDK app. Services that just need config
11
+ * or domain types import `@pipeline-builder/pipeline-core` instead and never load
12
+ * the CDK. `aws-cdk-lib` and `constructs` are peer dependencies; the consuming app
13
+ * supplies them, so there is exactly one copy of each on the resolution graph.
14
+ *
15
+ * **Constructs**
16
+ * - PipelineBuilder — top-level CDK pipeline construct
17
+ * - StageBuilder — pipeline stage composition
18
+ * - PluginLookup — plugin resolution custom resource
19
+ * - ArtifactManager — build artifact management
20
+ * - PipelineConfiguration — pipeline config resolution
21
+ *
22
+ * **Authoring types**
23
+ * - SourceTypes, StepTypes — pipeline source and step configuration
24
+ * - NetworkTypes — VPC/subnet/security-group configuration
25
+ *
26
+ * **Config adapters**
27
+ * - lambdaRuntime, lambdaTimeout, logRetention, ... — `AWSConfig` → CDK values
28
+ */
29
+ export * from './config/aws-config-cdk.js';
30
+ export * from './core/network-types.js';
31
+ export * from './core/artifact-manager.js';
32
+ export { buildConfigFromMetadata, metadataForCodePipeline, metadataForCodeBuildStep, metadataForShellStep, metadataForBuildEnvironment, } from './core/metadata-builder.js';
33
+ export * from './pipeline/source-types.js';
34
+ export * from './pipeline/step-types.js';
35
+ export * from './pipeline/stage-builder.js';
36
+ export * from './pipeline/pipeline-builder.js';
37
+ export * from './pipeline/plugin-lookup.js';
38
+ export { PipelineConfiguration } from './pipeline/pipeline-configuration.js';
package/lib/cdk.js ADDED
@@ -0,0 +1,44 @@
1
+ // Copyright 2026 Pipeline Builder Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * @module @pipeline-builder/pipeline-core/cdk
5
+ *
6
+ * The AWS CDK surface: the constructs that assemble a pipeline into a
7
+ * CodePipeline stack, the synth-time authoring types they take, and the adapters
8
+ * that turn plain `AWSConfig` data into CDK value objects.
9
+ *
10
+ * Everything reachable from here pulls in `aws-cdk-lib`, which is why it is a
11
+ * separate entry point from the package root. Import from here only in code that
12
+ * actually synthesizes stacks — the CLI's CDK app. Services that just need config
13
+ * or domain types import `@pipeline-builder/pipeline-core` instead and never load
14
+ * the CDK. `aws-cdk-lib` and `constructs` are peer dependencies; the consuming app
15
+ * supplies them, so there is exactly one copy of each on the resolution graph.
16
+ *
17
+ * **Constructs**
18
+ * - PipelineBuilder — top-level CDK pipeline construct
19
+ * - StageBuilder — pipeline stage composition
20
+ * - PluginLookup — plugin resolution custom resource
21
+ * - ArtifactManager — build artifact management
22
+ * - PipelineConfiguration — pipeline config resolution
23
+ *
24
+ * **Authoring types**
25
+ * - SourceTypes, StepTypes — pipeline source and step configuration
26
+ * - NetworkTypes — VPC/subnet/security-group configuration
27
+ *
28
+ * **Config adapters**
29
+ * - lambdaRuntime, lambdaTimeout, logRetention, ... — `AWSConfig` → CDK values
30
+ */
31
+ // Config adapters (plain AWSConfig data → CDK value objects)
32
+ export * from './config/aws-config-cdk.js';
33
+ // Infrastructure types that reference CDK values
34
+ export * from './core/network-types.js';
35
+ export * from './core/artifact-manager.js';
36
+ export { buildConfigFromMetadata, metadataForCodePipeline, metadataForCodeBuildStep, metadataForShellStep, metadataForBuildEnvironment, } from './core/metadata-builder.js';
37
+ // Pipeline authoring types and CDK constructs
38
+ export * from './pipeline/source-types.js';
39
+ export * from './pipeline/step-types.js';
40
+ export * from './pipeline/stage-builder.js';
41
+ export * from './pipeline/pipeline-builder.js';
42
+ export * from './pipeline/plugin-lookup.js';
43
+ export { PipelineConfiguration } from './pipeline/pipeline-configuration.js';
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2RrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2Nkay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwrQ0FBK0M7QUFDL0Msc0NBQXNDO0FBRXRDOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0EyQkc7QUFFSCw2REFBNkQ7QUFD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V4cG9ydCAqIGZyb20gJy4vcGlwZWxpbmUvc3RhZ2UtYnVpbGRlci5qcyc7XG5leHBvcnQgKiBmcm9tICcuL3BpcGVsaW5lL3BpcGVsaW5lLWJ1aWxkZXIuanMnO1xuZXhwb3J0ICogZnJvbSAnLi9waXBlbGluZS9wbHVnaW4tbG9va3VwLmpzJztcbmV4cG9ydCB7IFBpcGVsaW5lQ29uZmlndXJhdGlvbiB9IGZyb20gJy4vcGlwZWxpbmUvcGlwZWxpbmUtY29uZmlndXJhdGlvbi5qcyc7XG4iXX0=
@@ -0,0 +1,109 @@
1
+ import type { Algorithm } from 'jsonwebtoken';
2
+ import type { AppConfig } from './config-types.js';
3
+ /**
4
+ * Core constants — configurable via environment variables with sensible defaults.
5
+ */
6
+ export declare class CoreConstants {
7
+ static readonly NAME_PATTERN: RegExp;
8
+ static readonly ALLOWED_JWT_ALGORITHMS: Algorithm[];
9
+ static readonly HANDLER_TIMEOUT_MS: number;
10
+ /** Default platform URL fallback when PLATFORM_BASE_URL is not set. */
11
+ static readonly DEFAULT_PLATFORM_URL = "https://localhost:8443";
12
+ static readonly HANDLER_DEFAULT_BASE_URL: string;
13
+ static readonly HANDLER_MAX_RETRIES: number;
14
+ static readonly HANDLER_RETRY_DELAY_MS: number;
15
+ static readonly PLUGIN_BUILD_QUEUE_NAME: string;
16
+ static readonly PLUGIN_BUILD_COMPLETED_RETENTION_SECS: number;
17
+ static readonly PLUGIN_BUILD_FAILED_RETENTION_SECS: number;
18
+ static readonly MAX_PAGE_LIMIT: number;
19
+ static readonly DEFAULT_PAGE_LIMIT: number;
20
+ static readonly MAX_PROMPT_LENGTH: number;
21
+ static readonly PLUGIN_MAX_UPLOAD_MB: number;
22
+ static readonly PIPELINE_NAME_MAX_LENGTH: number;
23
+ static readonly DEFAULT_PLUGIN_VERSION: string;
24
+ static readonly SSE_STREAM_TIMEOUT_MS: number;
25
+ static readonly GITHUB_API_BASE_URL: string;
26
+ static readonly BITBUCKET_API_BASE_URL: string;
27
+ static readonly MAX_BULK_ITEMS: number;
28
+ static readonly MAX_EVENTS_PER_BATCH: number;
29
+ static readonly DEFAULT_REPORT_RANGE_DAYS: number;
30
+ static readonly SECRETS_PATH_PREFIX: string;
31
+ /** Build a Secrets Manager path: {prefix}/{orgId}/{name} */
32
+ static secretPath(orgId: string, name: string): string;
33
+ static readonly DB_MAX_RETRIES: number;
34
+ static readonly DB_RETRY_DELAY_MS: number;
35
+ static readonly DB_TRANSACTION_TIMEOUT_MS: number;
36
+ static readonly DB_CLOSE_TIMEOUT_MS: number;
37
+ static readonly COMPRESSION_THRESHOLD_BYTES: number;
38
+ static readonly IDEMPOTENCY_TTL_MS: number;
39
+ static readonly IDEMPOTENCY_MAX_STORE_SIZE: number;
40
+ static readonly IDEMPOTENCY_CLEANUP_INTERVAL_MS: number;
41
+ static readonly CACHE_CLEANUP_INTERVAL_MS: number;
42
+ static readonly CACHE_TTL_ENTITY: number;
43
+ static readonly CACHE_TTL_MESSAGE: number;
44
+ static readonly CACHE_TTL_REPORT_INVENTORY: number;
45
+ static readonly CACHE_TTL_REPORT_TIMESERIES: number;
46
+ static readonly CACHE_TTL_COMPLIANCE_RULES: number;
47
+ static readonly CACHE_TTL_BILLING_PLANS: number;
48
+ static readonly SSE_BACKPRESSURE_THRESHOLD: number;
49
+ static readonly CACHE_CONTROL_LIST: string;
50
+ static readonly CACHE_CONTROL_DETAIL: string;
51
+ }
52
+ /**
53
+ * Configuration facade with lazy per-section loading.
54
+ *
55
+ * Each section is loaded and validated independently on first access,
56
+ * so requesting `Config.get('aws')` does not trigger loading of
57
+ * server, auth, or billing config (and their env var requirements).
58
+ *
59
+ * Usage: `Config.get('server')`, `Config.get('auth')`, etc.
60
+ */
61
+ export declare class Config {
62
+ private static cache;
63
+ /**
64
+ * Get a specific configuration section (loaded lazily on first access).
65
+ */
66
+ static get<K extends keyof AppConfig>(section: K): AppConfig[K];
67
+ /**
68
+ * Merge a partial override into a config section, taking precedence over the
69
+ * env-loaded values for all subsequent `Config.get(section)` calls.
70
+ *
71
+ * Used at CDK synth start to inject platform-sourced infrastructure config
72
+ * (e.g. the registry pull host derived from the platform's public URL) so the
73
+ * synth does not silently depend on the operator's local `process.env`.
74
+ * `undefined` fields in `partial` are ignored so they never clobber a loaded
75
+ * value. Loads (and validates) the section first so the override merges onto
76
+ * the real defaults.
77
+ */
78
+ static override<K extends keyof AppConfig>(section: K, partial: Partial<AppConfig[K]>): void;
79
+ /**
80
+ * Like {@link override}, but scoped: snapshots the current cache state for
81
+ * `section` and returns a restore function that reverts it. Use around a
82
+ * single unit of work (e.g. one CDK PipelineBuilder's synth) so a per-builder
83
+ * override does NOT leak into the process-wide cache and bleed into sibling
84
+ * builders in a multi-pipeline CDK app. Calling the returned function restores
85
+ * the exact prior state — the previously cached value, or an unloaded section
86
+ * if it had not been cached yet (so the next `get()` re-loads from env).
87
+ */
88
+ static overrideScoped<K extends keyof AppConfig>(section: K, partial: Partial<AppConfig[K]>): () => void;
89
+ /**
90
+ * Clear all cached config sections so the next `Config.get()` re-reads them
91
+ * from the current `process.env` (re-running each section's loader + validator).
92
+ *
93
+ * Use when env has been mutated in-process and the cache is now stale — e.g. a
94
+ * long-running CLI that reconfigures between operations. CDK synth runs in a
95
+ * fresh subprocess that already reads env on first access, so it does not need
96
+ * this. Note: this also drops any values set via {@link override}.
97
+ */
98
+ static reload(): void;
99
+ /**
100
+ * Validate auth configuration (JWT secrets, algorithms, expiration).
101
+ * Call this at server startup, not during CDK synthesis.
102
+ */
103
+ static validateAuth(): void;
104
+ /**
105
+ * Untyped config access — use when the published package types don't include a new section yet.
106
+ * Avoids the `(Config as unknown as ...).get(...)` cast pattern in consumers.
107
+ */
108
+ static getAny(section: string): unknown;
109
+ }