@baseplate-dev/project-builder-server 0.6.1 → 1.0.7

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 (94) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +114 -123
  3. package/dist/actions/__tests__/action-test-utils.d.ts +7 -1
  4. package/dist/actions/__tests__/action-test-utils.d.ts.map +1 -1
  5. package/dist/actions/__tests__/action-test-utils.js +9 -0
  6. package/dist/actions/__tests__/action-test-utils.js.map +1 -1
  7. package/dist/actions/definition/apply-fix.action.d.ts +19 -0
  8. package/dist/actions/definition/apply-fix.action.d.ts.map +1 -0
  9. package/dist/actions/definition/apply-fix.action.js +53 -0
  10. package/dist/actions/definition/apply-fix.action.js.map +1 -0
  11. package/dist/actions/definition/commit-draft.action.d.ts +2 -0
  12. package/dist/actions/definition/commit-draft.action.d.ts.map +1 -1
  13. package/dist/actions/definition/commit-draft.action.js +12 -11
  14. package/dist/actions/definition/commit-draft.action.js.map +1 -1
  15. package/dist/actions/definition/configure-plugin.action.d.ts +20 -0
  16. package/dist/actions/definition/configure-plugin.action.d.ts.map +1 -0
  17. package/dist/actions/definition/configure-plugin.action.js +57 -0
  18. package/dist/actions/definition/configure-plugin.action.js.map +1 -0
  19. package/dist/actions/definition/disable-plugin.action.d.ts +19 -0
  20. package/dist/actions/definition/disable-plugin.action.d.ts.map +1 -0
  21. package/dist/actions/definition/disable-plugin.action.js +46 -0
  22. package/dist/actions/definition/disable-plugin.action.js.map +1 -0
  23. package/dist/actions/definition/entity-type-blacklist.d.ts +14 -0
  24. package/dist/actions/definition/entity-type-blacklist.d.ts.map +1 -0
  25. package/dist/actions/definition/entity-type-blacklist.js +19 -0
  26. package/dist/actions/definition/entity-type-blacklist.js.map +1 -0
  27. package/dist/actions/definition/index.d.ts +5 -0
  28. package/dist/actions/definition/index.d.ts.map +1 -1
  29. package/dist/actions/definition/index.js +5 -0
  30. package/dist/actions/definition/index.js.map +1 -1
  31. package/dist/actions/definition/list-entity-types.action.d.ts.map +1 -1
  32. package/dist/actions/definition/list-entity-types.action.js +4 -1
  33. package/dist/actions/definition/list-entity-types.action.js.map +1 -1
  34. package/dist/actions/definition/list-plugins.action.d.ts +16 -0
  35. package/dist/actions/definition/list-plugins.action.d.ts.map +1 -0
  36. package/dist/actions/definition/list-plugins.action.js +56 -0
  37. package/dist/actions/definition/list-plugins.action.js.map +1 -0
  38. package/dist/actions/definition/search-entities.action.d.ts +13 -0
  39. package/dist/actions/definition/search-entities.action.d.ts.map +1 -0
  40. package/dist/actions/definition/search-entities.action.js +55 -0
  41. package/dist/actions/definition/search-entities.action.js.map +1 -0
  42. package/dist/actions/definition/stage-create-entity.action.d.ts +2 -0
  43. package/dist/actions/definition/stage-create-entity.action.d.ts.map +1 -1
  44. package/dist/actions/definition/stage-create-entity.action.js +7 -18
  45. package/dist/actions/definition/stage-create-entity.action.js.map +1 -1
  46. package/dist/actions/definition/stage-delete-entity.action.d.ts +2 -0
  47. package/dist/actions/definition/stage-delete-entity.action.d.ts.map +1 -1
  48. package/dist/actions/definition/stage-delete-entity.action.js +7 -18
  49. package/dist/actions/definition/stage-delete-entity.action.js.map +1 -1
  50. package/dist/actions/definition/stage-update-entity.action.d.ts +2 -0
  51. package/dist/actions/definition/stage-update-entity.action.d.ts.map +1 -1
  52. package/dist/actions/definition/stage-update-entity.action.js +7 -18
  53. package/dist/actions/definition/stage-update-entity.action.js.map +1 -1
  54. package/dist/actions/definition/validate-draft.d.ts +56 -4
  55. package/dist/actions/definition/validate-draft.d.ts.map +1 -1
  56. package/dist/actions/definition/validate-draft.js +107 -6
  57. package/dist/actions/definition/validate-draft.js.map +1 -1
  58. package/dist/actions/registry.d.ts +46 -0
  59. package/dist/actions/registry.d.ts.map +1 -1
  60. package/dist/actions/registry.js +6 -1
  61. package/dist/actions/registry.js.map +1 -1
  62. package/dist/compiler/backend/authorizer-compiler.d.ts.map +1 -1
  63. package/dist/compiler/backend/authorizer-compiler.js +12 -4
  64. package/dist/compiler/backend/authorizer-compiler.js.map +1 -1
  65. package/dist/compiler/backend/backend-compiler.d.ts.map +1 -1
  66. package/dist/compiler/backend/backend-compiler.js +1 -0
  67. package/dist/compiler/backend/backend-compiler.js.map +1 -1
  68. package/dist/compiler/backend/fastify.d.ts.map +1 -1
  69. package/dist/compiler/backend/fastify.js +1 -4
  70. package/dist/compiler/backend/fastify.js.map +1 -1
  71. package/dist/compiler/backend/models.d.ts.map +1 -1
  72. package/dist/compiler/backend/models.js +6 -1
  73. package/dist/compiler/backend/models.js.map +1 -1
  74. package/dist/compiler/backend/query-filter-compiler.d.ts.map +1 -1
  75. package/dist/compiler/backend/query-filter-compiler.js +67 -11
  76. package/dist/compiler/backend/query-filter-compiler.js.map +1 -1
  77. package/dist/compiler/library/node-library-package-compiler.d.ts.map +1 -1
  78. package/dist/compiler/library/node-library-package-compiler.js +1 -0
  79. package/dist/compiler/library/node-library-package-compiler.js.map +1 -1
  80. package/dist/compiler/root/root-package-compiler.d.ts.map +1 -1
  81. package/dist/compiler/root/root-package-compiler.js +7 -2
  82. package/dist/compiler/root/root-package-compiler.js.map +1 -1
  83. package/dist/compiler/web/web-compiler.d.ts.map +1 -1
  84. package/dist/compiler/web/web-compiler.js +5 -6
  85. package/dist/compiler/web/web-compiler.js.map +1 -1
  86. package/dist/dev-server/mcp/fastify.js +1 -1
  87. package/dist/dev-server/mcp/fastify.js.map +1 -1
  88. package/dist/sync/sync-metadata-service.d.ts.map +1 -1
  89. package/dist/sync/sync-metadata-service.js +6 -3
  90. package/dist/sync/sync-metadata-service.js.map +1 -1
  91. package/dist/templates/utils/resolve-generator.d.ts.map +1 -1
  92. package/dist/templates/utils/resolve-generator.js +2 -5
  93. package/dist/templates/utils/resolve-generator.js.map +1 -1
  94. package/package.json +12 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @baseplate-dev/project-builder-server
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#830](https://github.com/halfdomelabs/baseplate/pull/830) [`c175429`](https://github.com/halfdomelabs/baseplate/commit/c175429101d8e902e178067785f2840cd22347cb) Thanks [@kingston](https://github.com/kingston)! - Add support for indexes on tables, mirroring the existing unique constraints implementation
8
+
9
+ - [#826](https://github.com/halfdomelabs/baseplate/pull/826) [`fdd496d`](https://github.com/halfdomelabs/baseplate/commit/fdd496da00348cd56b329a50f60d94597e063045) Thanks [@kingston](https://github.com/kingston)! - Extract Sentry into standalone plugin package `@baseplate-dev/plugin-observability` and add migration to auto-enable Sentry plugin on existing projects
10
+
11
+ - [#829](https://github.com/halfdomelabs/baseplate/pull/829) [`28517d6`](https://github.com/halfdomelabs/baseplate/commit/28517d60059070943a3d1ebdb99d0a2fabbe30a7) Thanks [@kingston](https://github.com/kingston)! - Extract Stripe into standalone `@baseplate-dev/plugin-payments` package. Stripe is now managed through the plugin system instead of the `enableStripe` boolean on backend app config. Includes migration to automatically convert existing projects. Overhaul Stripe implementation to provide billing support.
12
+
13
+ - [#823](https://github.com/halfdomelabs/baseplate/pull/823) [`34fc44e`](https://github.com/halfdomelabs/baseplate/commit/34fc44ec930c951c90edfbf2f658878a0cae8bb5) Thanks [@kingston](https://github.com/kingston)! - Support literal value comparisons in authorization expressions (e.g. `model.status === 'active'`, `model.isPublished !== false`)
14
+
15
+ - [#820](https://github.com/halfdomelabs/baseplate/pull/820) [`05b667f`](https://github.com/halfdomelabs/baseplate/commit/05b667fa0a21e78a6af3d553be1900f10e349c50) Thanks [@kingston](https://github.com/kingston)! - MCP server improvements: apply fixRefDeletions and applyDefinitionFixes when staging changes, add entity search action, expose auto-fix suggestions with apply-fix action, add plugin management actions (list, configure, disable), blacklist plugin entity type from generic entity operations
16
+
17
+ - Updated dependencies [[`1115ba0`](https://github.com/halfdomelabs/baseplate/commit/1115ba082d2288db9f233c459dde3f32b890ff67), [`69483b8`](https://github.com/halfdomelabs/baseplate/commit/69483b8b703a2b568f9dfcfc349046bf3a2bb948), [`c175429`](https://github.com/halfdomelabs/baseplate/commit/c175429101d8e902e178067785f2840cd22347cb), [`fdd496d`](https://github.com/halfdomelabs/baseplate/commit/fdd496da00348cd56b329a50f60d94597e063045), [`28517d6`](https://github.com/halfdomelabs/baseplate/commit/28517d60059070943a3d1ebdb99d0a2fabbe30a7), [`168793d`](https://github.com/halfdomelabs/baseplate/commit/168793d958e001de2eb8bebed03c2b42397da701), [`34fc44e`](https://github.com/halfdomelabs/baseplate/commit/34fc44ec930c951c90edfbf2f658878a0cae8bb5), [`05b667f`](https://github.com/halfdomelabs/baseplate/commit/05b667fa0a21e78a6af3d553be1900f10e349c50), [`55be8d4`](https://github.com/halfdomelabs/baseplate/commit/55be8d4d2994ff56ff580ff847f5271c6e8cdb25), [`ad028b5`](https://github.com/halfdomelabs/baseplate/commit/ad028b5b840d5bf45f3597e95145b75b0e4eb2b7), [`d5e0b23`](https://github.com/halfdomelabs/baseplate/commit/d5e0b2397ce2aacacfd9663fb33d4176ec61ca61), [`d87bad9`](https://github.com/halfdomelabs/baseplate/commit/d87bad97614bb626598916efb073d05c469ec336)]:
18
+ - @baseplate-dev/react-generators@1.0.0
19
+ - @baseplate-dev/fastify-generators@1.0.0
20
+ - @baseplate-dev/project-builder-lib@1.0.0
21
+ - @baseplate-dev/sync@1.0.0
22
+ - @baseplate-dev/core-generators@1.0.0
23
+ - @baseplate-dev/utils@1.0.0
24
+
25
+ ## 0.6.2
26
+
27
+ ### Patch Changes
28
+
29
+ - Reset version to 0.6.2 to fix accidental major version bumps caused by missing changeset fixed-group configuration.
30
+
3
31
  ## 0.6.1
4
32
 
5
33
  ### Patch Changes
package/LICENSE CHANGED
@@ -7,30 +7,30 @@ This project is licensed under the Mozilla Public License 2.0 (MPL-2.0) with the
7
7
  **Generated Code Exception**: All code generated by Baseplate generators and templates belongs entirely to the user who generated it. Half Dome Labs LLC disclaims any copyright interest in generated code. Users may use, modify, distribute, and license generated code under any terms they choose, including proprietary licenses, with no restrictions or attribution requirements.
8
8
 
9
9
  # Mozilla Public License Version 2.0
10
+ ==================================
10
11
 
11
12
  1. Definitions
12
-
13
- ---
13
+ --------------
14
14
 
15
15
  1.1. "Contributor"
16
- means each individual or legal entity that creates, contributes to
17
- the creation of, or owns Covered Software.
16
+ means each individual or legal entity that creates, contributes to
17
+ the creation of, or owns Covered Software.
18
18
 
19
19
  1.2. "Contributor Version"
20
- means the combination of the Contributions of others (if any) used
21
- by a Contributor and that particular Contributor's Contribution.
20
+ means the combination of the Contributions of others (if any) used
21
+ by a Contributor and that particular Contributor's Contribution.
22
22
 
23
23
  1.3. "Contribution"
24
- means Covered Software of a particular Contributor.
24
+ means Covered Software of a particular Contributor.
25
25
 
26
26
  1.4. "Covered Software"
27
- means Source Code Form to which the initial Contributor has attached
28
- the notice in Exhibit A, the Executable Form of such Source Code
29
- Form, and Modifications of such Source Code Form, in each case
30
- including portions thereof.
27
+ means Source Code Form to which the initial Contributor has attached
28
+ the notice in Exhibit A, the Executable Form of such Source Code
29
+ Form, and Modifications of such Source Code Form, in each case
30
+ including portions thereof.
31
31
 
32
32
  1.5. "Incompatible With Secondary Licenses"
33
- means
33
+ means
34
34
 
35
35
  (a) that the initial Contributor has attached the notice described
36
36
  in Exhibit B to the Covered Software; or
@@ -40,22 +40,22 @@ means
40
40
  terms of a Secondary License.
41
41
 
42
42
  1.6. "Executable Form"
43
- means any form of the work other than Source Code Form.
43
+ means any form of the work other than Source Code Form.
44
44
 
45
45
  1.7. "Larger Work"
46
- means a work that combines Covered Software with other material, in
47
- a separate file or files, that is not Covered Software.
46
+ means a work that combines Covered Software with other material, in
47
+ a separate file or files, that is not Covered Software.
48
48
 
49
49
  1.8. "License"
50
- means this document.
50
+ means this document.
51
51
 
52
52
  1.9. "Licensable"
53
- means having the right to grant, to the maximum extent possible,
54
- whether at the time of the initial grant or subsequently, any and
55
- all of the rights conveyed by this License.
53
+ means having the right to grant, to the maximum extent possible,
54
+ whether at the time of the initial grant or subsequently, any and
55
+ all of the rights conveyed by this License.
56
56
 
57
57
  1.10. "Modifications"
58
- means any of the following:
58
+ means any of the following:
59
59
 
60
60
  (a) any file in Source Code Form that results from an addition to,
61
61
  deletion from, or modification of the contents of Covered
@@ -65,35 +65,34 @@ means any of the following:
65
65
  Software.
66
66
 
67
67
  1.11. "Patent Claims" of a Contributor
68
- means any patent claim(s), including without limitation, method,
69
- process, and apparatus claims, in any patent Licensable by such
70
- Contributor that would be infringed, but for the grant of the
71
- License, by the making, using, selling, offering for sale, having
72
- made, import, or transfer of either its Contributions or its
73
- Contributor Version.
68
+ means any patent claim(s), including without limitation, method,
69
+ process, and apparatus claims, in any patent Licensable by such
70
+ Contributor that would be infringed, but for the grant of the
71
+ License, by the making, using, selling, offering for sale, having
72
+ made, import, or transfer of either its Contributions or its
73
+ Contributor Version.
74
74
 
75
75
  1.12. "Secondary License"
76
- means either the GNU General Public License, Version 2.0, the GNU
77
- Lesser General Public License, Version 2.1, the GNU Affero General
78
- Public License, Version 3.0, or any later versions of those
79
- licenses.
76
+ means either the GNU General Public License, Version 2.0, the GNU
77
+ Lesser General Public License, Version 2.1, the GNU Affero General
78
+ Public License, Version 3.0, or any later versions of those
79
+ licenses.
80
80
 
81
81
  1.13. "Source Code Form"
82
- means the form of the work preferred for making modifications.
82
+ means the form of the work preferred for making modifications.
83
83
 
84
84
  1.14. "You" (or "Your")
85
- means an individual or a legal entity exercising rights under this
86
- License. For legal entities, "You" includes any entity that
87
- controls, is controlled by, or is under common control with You. For
88
- purposes of this definition, "control" means (a) the power, direct
89
- or indirect, to cause the direction or management of such entity,
90
- whether by contract or otherwise, or (b) ownership of more than
91
- fifty percent (50%) of the outstanding shares or beneficial
92
- ownership of such entity.
85
+ means an individual or a legal entity exercising rights under this
86
+ License. For legal entities, "You" includes any entity that
87
+ controls, is controlled by, or is under common control with You. For
88
+ purposes of this definition, "control" means (a) the power, direct
89
+ or indirect, to cause the direction or management of such entity,
90
+ whether by contract or otherwise, or (b) ownership of more than
91
+ fifty percent (50%) of the outstanding shares or beneficial
92
+ ownership of such entity.
93
93
 
94
94
  2. License Grants and Conditions
95
-
96
- ---
95
+ --------------------------------
97
96
 
98
97
  2.1. Grants
99
98
 
@@ -101,14 +100,14 @@ Each Contributor hereby grants You a world-wide, royalty-free,
101
100
  non-exclusive license:
102
101
 
103
102
  (a) under intellectual property rights (other than patent or trademark)
104
- Licensable by such Contributor to use, reproduce, make available,
105
- modify, display, perform, distribute, and otherwise exploit its
106
- Contributions, either on an unmodified basis, with Modifications, or
107
- as part of a Larger Work; and
103
+ Licensable by such Contributor to use, reproduce, make available,
104
+ modify, display, perform, distribute, and otherwise exploit its
105
+ Contributions, either on an unmodified basis, with Modifications, or
106
+ as part of a Larger Work; and
108
107
 
109
108
  (b) under Patent Claims of such Contributor to make, use, sell, offer
110
- for sale, have made, import, and otherwise transfer either its
111
- Contributions or its Contributor Version.
109
+ for sale, have made, import, and otherwise transfer either its
110
+ Contributions or its Contributor Version.
112
111
 
113
112
  2.2. Effective Date
114
113
 
@@ -125,15 +124,15 @@ Notwithstanding Section 2.1(b) above, no patent license is granted by a
125
124
  Contributor:
126
125
 
127
126
  (a) for any code that a Contributor has removed from Covered Software;
128
- or
127
+ or
129
128
 
130
129
  (b) for infringements caused by: (i) Your and any other third party's
131
- modifications of Covered Software, or (ii) the combination of its
132
- Contributions with other software (except as part of its Contributor
133
- Version); or
130
+ modifications of Covered Software, or (ii) the combination of its
131
+ Contributions with other software (except as part of its Contributor
132
+ Version); or
134
133
 
135
134
  (c) under Patent Claims infringed by Covered Software in the absence of
136
- its Contributions.
135
+ its Contributions.
137
136
 
138
137
  This License does not grant any rights in the trademarks, service marks,
139
138
  or logos of any Contributor (except as may be necessary to comply with
@@ -164,8 +163,7 @@ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
164
163
  in Section 2.1.
165
164
 
166
165
  3. Responsibilities
167
-
168
- ---
166
+ -------------------
169
167
 
170
168
  3.1. Distribution of Source Form
171
169
 
@@ -182,15 +180,15 @@ Form.
182
180
  If You distribute Covered Software in Executable Form then:
183
181
 
184
182
  (a) such Covered Software must also be made available in Source Code
185
- Form, as described in Section 3.1, and You must inform recipients of
186
- the Executable Form how they can obtain a copy of such Source Code
187
- Form by reasonable means in a timely manner, at a charge no more
188
- than the cost of distribution to the recipient; and
183
+ Form, as described in Section 3.1, and You must inform recipients of
184
+ the Executable Form how they can obtain a copy of such Source Code
185
+ Form by reasonable means in a timely manner, at a charge no more
186
+ than the cost of distribution to the recipient; and
189
187
 
190
188
  (b) You may distribute such Executable Form under the terms of this
191
- License, or sublicense it under different terms, provided that the
192
- license for the Executable Form does not attempt to limit or alter
193
- the recipients' rights in the Source Code Form under this License.
189
+ License, or sublicense it under different terms, provided that the
190
+ license for the Executable Form does not attempt to limit or alter
191
+ the recipients' rights in the Source Code Form under this License.
194
192
 
195
193
  3.3. Distribution of a Larger Work
196
194
 
@@ -227,8 +225,7 @@ disclaimers of warranty and limitations of liability specific to any
227
225
  jurisdiction.
228
226
 
229
227
  4. Inability to Comply Due to Statute or Regulation
230
-
231
- ---
228
+ ---------------------------------------------------
232
229
 
233
230
  If it is impossible for You to comply with any of the terms of this
234
231
  License with respect to some or all of the Covered Software due to
@@ -241,8 +238,7 @@ or regulation, such description must be sufficiently detailed for a
241
238
  recipient of ordinary skill to be able to understand it.
242
239
 
243
240
  5. Termination
244
-
245
- ---
241
+ --------------
246
242
 
247
243
  5.1. The rights granted under this License will terminate automatically
248
244
  if You fail to comply with any of its terms. However, if You become
@@ -270,55 +266,50 @@ end user license agreements (excluding distributors and resellers) which
270
266
  have been validly granted by You or Your distributors under this License
271
267
  prior to termination shall survive termination.
272
268
 
273
- ---
274
-
275
- - *
276
- - 6. Disclaimer of Warranty \*
277
- - ------------------------- \*
278
- - *
279
- - Covered Software is provided under this License on an "as is" \*
280
- - basis, without warranty of any kind, either expressed, implied, or \*
281
- - statutory, including, without limitation, warranties that the \*
282
- - Covered Software is free of defects, merchantable, fit for a \*
283
- - particular purpose or non-infringing. The entire risk as to the \*
284
- - quality and performance of the Covered Software is with You. \*
285
- - Should any Covered Software prove defective in any respect, You \*
286
- - (not any Contributor) assume the cost of any necessary servicing, \*
287
- - repair, or correction. This disclaimer of warranty constitutes an \*
288
- - essential part of this License. No use of any Covered Software is \*
289
- - authorized under this License except under this disclaimer. \*
290
- - *
291
-
292
- ---
293
-
294
- ---
295
-
296
- - *
297
- - 7. Limitation of Liability \*
298
- - -------------------------- \*
299
- - *
300
- - Under no circumstances and under no legal theory, whether tort \*
301
- - (including negligence), contract, or otherwise, shall any \*
302
- - Contributor, or anyone who distributes Covered Software as \*
303
- - permitted above, be liable to You for any direct, indirect, \*
304
- - special, incidental, or consequential damages of any character \*
305
- - including, without limitation, damages for lost profits, loss of \*
306
- - goodwill, work stoppage, computer failure or malfunction, or any \*
307
- - and all other commercial damages or losses, even if such party \*
308
- - shall have been informed of the possibility of such damages. This \*
309
- - limitation of liability shall not apply to liability for death or \*
310
- - personal injury resulting from such party's negligence to the \*
311
- - extent applicable law prohibits such limitation. Some \*
312
- - jurisdictions do not allow the exclusion or limitation of \*
313
- - incidental or consequential damages, so this exclusion and \*
314
- - limitation may not apply to You. \*
315
- - *
316
-
317
- ---
269
+ ************************************************************************
270
+ * *
271
+ * 6. Disclaimer of Warranty *
272
+ * ------------------------- *
273
+ * *
274
+ * Covered Software is provided under this License on an "as is" *
275
+ * basis, without warranty of any kind, either expressed, implied, or *
276
+ * statutory, including, without limitation, warranties that the *
277
+ * Covered Software is free of defects, merchantable, fit for a *
278
+ * particular purpose or non-infringing. The entire risk as to the *
279
+ * quality and performance of the Covered Software is with You. *
280
+ * Should any Covered Software prove defective in any respect, You *
281
+ * (not any Contributor) assume the cost of any necessary servicing, *
282
+ * repair, or correction. This disclaimer of warranty constitutes an *
283
+ * essential part of this License. No use of any Covered Software is *
284
+ * authorized under this License except under this disclaimer. *
285
+ * *
286
+ ************************************************************************
287
+
288
+ ************************************************************************
289
+ * *
290
+ * 7. Limitation of Liability *
291
+ * -------------------------- *
292
+ * *
293
+ * Under no circumstances and under no legal theory, whether tort *
294
+ * (including negligence), contract, or otherwise, shall any *
295
+ * Contributor, or anyone who distributes Covered Software as *
296
+ * permitted above, be liable to You for any direct, indirect, *
297
+ * special, incidental, or consequential damages of any character *
298
+ * including, without limitation, damages for lost profits, loss of *
299
+ * goodwill, work stoppage, computer failure or malfunction, or any *
300
+ * and all other commercial damages or losses, even if such party *
301
+ * shall have been informed of the possibility of such damages. This *
302
+ * limitation of liability shall not apply to liability for death or *
303
+ * personal injury resulting from such party's negligence to the *
304
+ * extent applicable law prohibits such limitation. Some *
305
+ * jurisdictions do not allow the exclusion or limitation of *
306
+ * incidental or consequential damages, so this exclusion and *
307
+ * limitation may not apply to You. *
308
+ * *
309
+ ************************************************************************
318
310
 
319
311
  8. Litigation
320
-
321
- ---
312
+ -------------
322
313
 
323
314
  Any litigation relating to this License may be brought only in the
324
315
  courts of a jurisdiction where the defendant maintains its principal
@@ -328,8 +319,7 @@ Nothing in this Section shall prevent a party's ability to bring
328
319
  cross-claims or counter-claims.
329
320
 
330
321
  9. Miscellaneous
331
-
332
- ---
322
+ ----------------
333
323
 
334
324
  This License represents the complete agreement concerning the subject
335
325
  matter hereof. If any provision of this License is held to be
@@ -339,8 +329,7 @@ that the language of a contract shall be construed against the drafter
339
329
  shall not be used to construe this License against a Contributor.
340
330
 
341
331
  10. Versions of the License
342
-
343
- ---
332
+ ---------------------------
344
333
 
345
334
  10.1. New Versions
346
335
 
@@ -371,11 +360,12 @@ If You choose to distribute Source Code Form that is Incompatible With
371
360
  Secondary Licenses under the terms of this version of the License, the
372
361
  notice described in Exhibit B of this License must be attached.
373
362
 
374
- ## Exhibit A - Source Code Form License Notice
363
+ Exhibit A - Source Code Form License Notice
364
+ -------------------------------------------
375
365
 
376
- This Source Code Form is subject to the terms of the Mozilla Public
377
- License, v. 2.0. If a copy of the MPL was not distributed with this
378
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
366
+ This Source Code Form is subject to the terms of the Mozilla Public
367
+ License, v. 2.0. If a copy of the MPL was not distributed with this
368
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
379
369
 
380
370
  If it is not possible or desirable to put the notice in a particular
381
371
  file, then You may include the notice in a location (such as a LICENSE
@@ -384,7 +374,8 @@ for such a notice.
384
374
 
385
375
  You may add additional accurate notices of copyright ownership.
386
376
 
387
- ## Exhibit B - "Incompatible With Secondary Licenses" Notice
377
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
378
+ ---------------------------------------------------------
388
379
 
389
- This Source Code Form is "Incompatible With Secondary Licenses", as
390
- defined by the Mozilla Public License, v. 2.0.
380
+ This Source Code Form is "Incompatible With Secondary Licenses", as
381
+ defined by the Mozilla Public License, v. 2.0.
@@ -1,5 +1,6 @@
1
1
  import type { ProjectDefinitionInput, SchemaParserContext } from '@baseplate-dev/project-builder-lib';
2
- import type { ServiceActionContext } from '#src/actions/types.js';
2
+ import type z from 'zod';
3
+ import type { ServiceAction, ServiceActionContext } from '#src/actions/types.js';
3
4
  import type { EntityServiceContextResult } from '../definition/load-entity-service-context.js';
4
5
  /**
5
6
  * Creates a minimal ServiceActionContext for testing.
@@ -21,4 +22,9 @@ export interface TestEntityServiceContextResult extends EntityServiceContextResu
21
22
  parserContext: SchemaParserContext;
22
23
  }
23
24
  export declare function createTestEntityServiceContext(input?: Partial<ProjectDefinitionInput>): TestEntityServiceContextResult;
25
+ /**
26
+ * Invokes a service action for testing, validating input/output schemas
27
+ * but skipping CLI output formatting.
28
+ */
29
+ export declare function invokeServiceActionForTest<TInputType extends z.ZodType, TOutputType extends z.ZodType>(action: ServiceAction<TInputType, TOutputType>, input: z.input<TInputType>, context: ServiceActionContext): Promise<z.output<TOutputType>>;
24
30
  //# sourceMappingURL=action-test-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-test-utils.d.ts","sourceRoot":"","sources":["../../../src/actions/__tests__/action-test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAK5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE/F;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAkBtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;IAChF,aAAa,EAAE,mBAAmB,CAAC;CACpC;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC1C,8BAA8B,CAIhC"}
1
+ {"version":3,"file":"action-test-utils.d.ts","sourceRoot":"","sources":["../../../src/actions/__tests__/action-test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE/F;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAkBtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA+B,SAAQ,0BAA0B;IAChF,aAAa,EAAE,mBAAmB,CAAC;CACpC;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC1C,8BAA8B,CAIhC;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,SAAS,CAAC,CAAC,OAAO,EAC5B,WAAW,SAAS,CAAC,CAAC,OAAO,EAE7B,MAAM,EAAE,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,EAC9C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,EAC1B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAIhC"}
@@ -30,4 +30,13 @@ export function createTestEntityServiceContext(input = {}) {
30
30
  const entityContext = container.toEntityServiceContext();
31
31
  return { entityContext, container, parserContext: container.parserContext };
32
32
  }
33
+ /**
34
+ * Invokes a service action for testing, validating input/output schemas
35
+ * but skipping CLI output formatting.
36
+ */
37
+ export async function invokeServiceActionForTest(action, input, context) {
38
+ const parsedInput = action.inputSchema.parse(input);
39
+ const result = await action.handler(parsedInput, context);
40
+ return action.outputSchema.parse(result);
41
+ }
33
42
  //# sourceMappingURL=action-test-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-test-utils.js","sourceRoot":"","sources":["../../../src/actions/__tests__/action-test-utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAA2C,EAAE;IAE7C,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,EAAE,EAAE,cAAc;gBAClB,IAAI,EAAE,cAAc;gBACpB,SAAS,EAAE,eAAe;gBAC1B,kBAAkB,EAAE,yBAAyB;gBAC7C,IAAI,EAAE,MAAM;aACb;SACF;QACD,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC;QACnC,UAAU,EAAE,YAAY;QACxB,SAAS,EAAE,SAAS;QACpB,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAeD,MAAM,UAAU,8BAA8B,CAC5C,QAAyC,EAAE;IAE3C,MAAM,SAAS,GAAG,oCAAoC,CAAC,KA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M,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const applyFixAction: import("#src/actions/types.js").ServiceAction<z.ZodObject<{
3
+ project: z.ZodString;
4
+ fixId: z.ZodString;
5
+ }, z.core.$strip>, z.ZodObject<{
6
+ message: z.ZodString;
7
+ issues: z.ZodOptional<z.ZodArray<z.ZodObject<{
8
+ message: z.ZodString;
9
+ entityId: z.ZodOptional<z.ZodString>;
10
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
11
+ severity: z.ZodEnum<{
12
+ error: "error";
13
+ warning: "warning";
14
+ }>;
15
+ fixLabel: z.ZodOptional<z.ZodString>;
16
+ fixId: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>>>;
18
+ }, z.core.$strip>>;
19
+ //# sourceMappingURL=apply-fix.action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-fix.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/apply-fix.action.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;kBA6DzB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { collectDefinitionIssues, createIssueFixSetter, ProjectDefinitionContainer, serializeSchema, } from '@baseplate-dev/project-builder-lib';
2
+ import { produce } from 'immer';
3
+ import { z } from 'zod';
4
+ import { createServiceAction } from '#src/actions/types.js';
5
+ import { getOrCreateDraftSession } from './draft-session.js';
6
+ import { definitionIssueSchema, generateFixId, mapIssueToOutput, validateAndSaveDraft, writeIssuesCliOutput, } from './validate-draft.js';
7
+ const applyFixInputSchema = z.object({
8
+ project: z.string().describe('The name or ID of the project.'),
9
+ fixId: z
10
+ .string()
11
+ .describe('The deterministic fix ID returned by stage actions (e.g., "fix-a1b2c3d4").'),
12
+ });
13
+ const applyFixOutputSchema = z.object({
14
+ message: z.string().describe('A summary of the applied fix.'),
15
+ issues: z
16
+ .array(definitionIssueSchema)
17
+ .optional()
18
+ .describe('Remaining definition issues after applying the fix.'),
19
+ });
20
+ export const applyFixAction = createServiceAction({
21
+ name: 'apply-fix',
22
+ title: 'Apply Fix',
23
+ description: 'Apply an auto-fix for a definition issue in the current draft session.',
24
+ inputSchema: applyFixInputSchema,
25
+ outputSchema: applyFixOutputSchema,
26
+ handler: async (input, context) => {
27
+ const { session, parserContext, projectDirectory } = await getOrCreateDraftSession(input.project, context);
28
+ // Build container from draft definition to collect issues
29
+ const container = ProjectDefinitionContainer.fromSerializedConfig(session.draftDefinition, parserContext);
30
+ const issues = collectDefinitionIssues(container);
31
+ // Find the issue matching the fix ID
32
+ const matchingIssue = issues.find((issue) => issue.fix && generateFixId(issue) === input.fixId);
33
+ if (!matchingIssue) {
34
+ throw new Error(`No fixable issue found with ID "${input.fixId}". ` +
35
+ 'The fix may no longer be applicable or the ID may be incorrect.');
36
+ }
37
+ const setter = createIssueFixSetter(matchingIssue, container);
38
+ if (!setter) {
39
+ throw new Error(`Issue "${matchingIssue.message}" has no applicable fix.`);
40
+ }
41
+ // Apply the fix to the parsed definition
42
+ const fixedDefinition = produce(setter)(container.definition);
43
+ // Serialize back to name-based format via the schema
44
+ const fixedSerializedDef = serializeSchema(container.schema, fixedDefinition);
45
+ const { warnings } = await validateAndSaveDraft(fixedSerializedDef, parserContext, session, projectDirectory, 'Fix applied but resulted in definition errors');
46
+ return {
47
+ message: `Applied fix: ${matchingIssue.fix?.label ?? matchingIssue.message}`,
48
+ issues: warnings.length > 0 ? warnings.map(mapIssueToOutput) : undefined,
49
+ };
50
+ },
51
+ writeCliOutput: writeIssuesCliOutput,
52
+ });
53
+ //# sourceMappingURL=apply-fix.action.js.map
@@ -0,0 +1 @@
1
+ {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AAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;SACzE,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,oBAAoB;CACrC,CAAC,CAAC"}
@@ -11,6 +11,8 @@ export declare const commitDraftAction: import("#src/actions/types.js").ServiceA
11
11
  error: "error";
12
12
  warning: "warning";
13
13
  }>;
14
+ fixLabel: z.ZodOptional<z.ZodString>;
15
+ fixId: z.ZodOptional<z.ZodString>;
14
16
  }, z.core.$strip>>>;
15
17
  }, z.core.$strip>>;
16
18
  //# sourceMappingURL=commit-draft.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commit-draft.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/commit-draft.action.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;kBAkE5B,CAAC"}
1
+ {"version":3,"file":"commit-draft.action.d.ts","sourceRoot":"","sources":["../../../src/actions/definition/commit-draft.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;kBAoE5B,CAAC"}
@@ -1,4 +1,3 @@
1
- import { collectDefinitionIssues, ProjectDefinitionContainer, } from '@baseplate-dev/project-builder-lib';
2
1
  import { writeFile } from 'node:fs/promises';
3
2
  import path from 'node:path';
4
3
  import { z } from 'zod';
@@ -7,7 +6,7 @@ import { resolveBaseplateDir } from '#src/diff/snapshot/snapshot-utils.js';
7
6
  import { createNodeSchemaParserContext } from '#src/plugins/node-plugin-store.js';
8
7
  import { getProjectByNameOrId } from '../utils/projects.js';
9
8
  import { deleteDraftSession, loadDefinitionHash, loadDraftSession, } from './draft-session.js';
10
- import { definitionIssueSchema } from './validate-draft.js';
9
+ import { definitionIssueSchema, fixAndValidateDraftDefinition, mapIssueToOutput, } from './validate-draft.js';
11
10
  const commitDraftInputSchema = z.object({
12
11
  project: z.string().describe('The name or ID of the project.'),
13
12
  });
@@ -36,16 +35,18 @@ export const commitDraftAction = createServiceAction({
36
35
  throw new Error('The project definition has changed since the draft was created. ' +
37
36
  'Discard the draft with discard-draft and start over.');
38
37
  }
39
- // Convert the serialized draft back to a proper definition and serialize it
38
+ // Convert the serialized draft back to a proper definition and validate
40
39
  const parserContext = await createNodeSchemaParserContext(project, context.logger, context.plugins, context.cliVersion);
41
- const container = ProjectDefinitionContainer.fromSerializedConfig(session.draftDefinition, parserContext);
42
- // Validate the draft definition before committing
43
- const issues = collectDefinitionIssues(container);
44
- if (issues.length > 0) {
45
- const messages = issues
46
- .map((i) => `[${i.severity}] ${i.message}`)
47
- .join('; ');
48
- throw new Error(`Commit blocked by definition issues: ${messages}`);
40
+ const { container, errors, warnings } = fixAndValidateDraftDefinition(session.draftDefinition, parserContext);
41
+ if (errors.length > 0) {
42
+ const messages = errors.map((e) => e.message).join('; ');
43
+ throw new Error(`Commit blocked by definition errors: ${messages}`);
44
+ }
45
+ if (warnings.length > 0) {
46
+ return {
47
+ message: 'Commit blocked by definition warnings.',
48
+ issues: warnings.map(mapIssueToOutput),
49
+ };
49
50
  }
50
51
  const serializedContents = container.toSerializedContents();
51
52
  // Write to project-definition.json
@@ -1 +1 @@
1
- {"version":3,"file":"commit-draft.action.js","sourceRoot":"","sources":["../../../src/actions/definition/commit-draft.action.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,C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