@wp-typia/project-tools 0.23.0 → 0.23.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 (109) hide show
  1. package/dist/runtime/ai-feature-artifacts.js +4 -1
  2. package/dist/runtime/block-generator-service-spec.js +2 -1
  3. package/dist/runtime/cli-add-block-json.js +5 -1
  4. package/dist/runtime/cli-add-help.js +4 -3
  5. package/dist/runtime/cli-add-types.d.ts +18 -6
  6. package/dist/runtime/cli-add-validation.d.ts +7 -0
  7. package/dist/runtime/cli-add-validation.js +9 -0
  8. package/dist/runtime/cli-add-workspace-ability-scaffold.js +4 -1
  9. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +5 -1
  10. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  11. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  12. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  13. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  14. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  15. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  16. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  17. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  18. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  19. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  20. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
  21. package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
  22. package/dist/runtime/cli-add-workspace-ai-anchors.js +4 -1
  23. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +17 -1
  24. package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
  25. package/dist/runtime/cli-add-workspace-integration-env.js +42 -5
  26. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +8 -0
  27. package/dist/runtime/cli-add-workspace-rest-anchors.js +41 -0
  28. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  29. package/dist/runtime/cli-add-workspace-rest-generated.js +158 -0
  30. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  31. package/dist/runtime/cli-add-workspace-rest-manual.js +279 -0
  32. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +24 -0
  33. package/dist/runtime/cli-add-workspace-rest-php-templates.js +678 -0
  34. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +8 -0
  35. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +25 -4
  36. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  37. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  38. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
  39. package/dist/runtime/cli-add-workspace-rest.js +33 -788
  40. package/dist/runtime/cli-core.d.ts +1 -1
  41. package/dist/runtime/cli-core.js +1 -1
  42. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  43. package/dist/runtime/cli-diagnostics.js +17 -5
  44. package/dist/runtime/cli-doctor-workspace-bindings.js +4 -1
  45. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  46. package/dist/runtime/cli-doctor-workspace-block-addons.js +134 -0
  47. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  48. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  49. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  50. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  51. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  52. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  53. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  54. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  55. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  56. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  57. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  58. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  59. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  60. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  61. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  62. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  63. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  64. package/dist/runtime/cli-doctor-workspace-features.js +14 -487
  65. package/dist/runtime/cli-doctor.d.ts +52 -3
  66. package/dist/runtime/cli-doctor.js +79 -8
  67. package/dist/runtime/cli-help.js +6 -3
  68. package/dist/runtime/cli-init-package-json.js +4 -2
  69. package/dist/runtime/cli-prompt.d.ts +16 -2
  70. package/dist/runtime/cli-prompt.js +29 -12
  71. package/dist/runtime/cli-scaffold.d.ts +2 -1
  72. package/dist/runtime/cli-scaffold.js +19 -10
  73. package/dist/runtime/external-template-guards.js +4 -6
  74. package/dist/runtime/index.d.ts +2 -2
  75. package/dist/runtime/index.js +1 -1
  76. package/dist/runtime/json-utils.d.ts +62 -4
  77. package/dist/runtime/json-utils.js +78 -4
  78. package/dist/runtime/local-dev-presets.js +4 -1
  79. package/dist/runtime/migration-ui-capability.js +4 -1
  80. package/dist/runtime/migration-utils.js +4 -1
  81. package/dist/runtime/package-managers.js +6 -1
  82. package/dist/runtime/package-versions.js +6 -1
  83. package/dist/runtime/scaffold-bootstrap.js +7 -2
  84. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  85. package/dist/runtime/scaffold-repository-reference.js +4 -2
  86. package/dist/runtime/scaffold-template-variables.js +2 -1
  87. package/dist/runtime/scaffold.d.ts +18 -1
  88. package/dist/runtime/scaffold.js +55 -2
  89. package/dist/runtime/temp-roots.js +4 -1
  90. package/dist/runtime/template-layers.js +4 -1
  91. package/dist/runtime/template-registry.js +9 -3
  92. package/dist/runtime/template-source-contracts.d.ts +2 -0
  93. package/dist/runtime/template-source-normalization.js +2 -1
  94. package/dist/runtime/template-source-remote.js +18 -5
  95. package/dist/runtime/template-source-seeds.js +10 -3
  96. package/dist/runtime/workspace-inventory-mutations.js +2 -1
  97. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  98. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  99. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  100. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  101. package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
  102. package/dist/runtime/workspace-inventory-parser.js +3 -581
  103. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  104. package/dist/runtime/workspace-inventory-section-descriptors.js +435 -0
  105. package/dist/runtime/workspace-inventory-templates.d.ts +1 -1
  106. package/dist/runtime/workspace-inventory-templates.js +1 -0
  107. package/dist/runtime/workspace-inventory-types.d.ts +1 -0
  108. package/dist/runtime/workspace-project.js +4 -6
  109. package/package.json +2 -2
@@ -0,0 +1,435 @@
1
+ import { MANUAL_REST_CONTRACT_AUTH_IDS, MANUAL_REST_CONTRACT_HTTP_METHOD_IDS, REST_RESOURCE_METHOD_IDS, } from "./cli-add-shared.js";
2
+ import { ABILITY_CONFIG_ENTRY_MARKER, ABILITIES_CONST_SECTION, ABILITIES_INTERFACE_SECTION, ADMIN_VIEW_CONFIG_ENTRY_MARKER, ADMIN_VIEWS_CONST_SECTION, ADMIN_VIEWS_INTERFACE_SECTION, AI_FEATURES_CONST_SECTION, AI_FEATURES_INTERFACE_SECTION, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCES_CONST_SECTION, BINDING_SOURCES_INTERFACE_SECTION, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLES_CONST_SECTION, BLOCK_STYLES_INTERFACE_SECTION, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORMS_CONST_SECTION, BLOCK_TRANSFORMS_INTERFACE_SECTION, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, CONTRACTS_CONST_SECTION, CONTRACTS_INTERFACE_SECTION, CONTRACT_CONFIG_ENTRY_MARKER, EDITOR_PLUGINS_CONST_SECTION, EDITOR_PLUGINS_INTERFACE_SECTION, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERNS_CONST_SECTION, PATTERNS_INTERFACE_SECTION, PATTERN_CONFIG_ENTRY_MARKER, POST_META_CONFIG_ENTRY_MARKER, POST_META_CONST_SECTION, POST_META_INTERFACE_SECTION, REST_RESOURCES_CONST_SECTION, REST_RESOURCES_INTERFACE_SECTION, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATIONS_CONST_SECTION, VARIATIONS_INTERFACE_SECTION, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
3
+ import { defineInventoryEntryParser, } from "./workspace-inventory-parser-validation.js";
4
+ /**
5
+ * Descriptor for the required `BLOCKS` inventory section.
6
+ *
7
+ * Runtime readers use its `parse` contract to require the exported `BLOCKS`
8
+ * array and validate required block entry fields; mutation helpers use its
9
+ * `append` marker to insert generated block entries without duplicating section
10
+ * knowledge.
11
+ */
12
+ export const BLOCK_INVENTORY_SECTION = {
13
+ append: {
14
+ marker: BLOCK_CONFIG_ENTRY_MARKER,
15
+ optionKey: "blockEntries",
16
+ },
17
+ parse: {
18
+ entriesKey: "blocks",
19
+ entry: defineInventoryEntryParser()({
20
+ entryName: "BLOCKS",
21
+ fields: [
22
+ { key: "apiTypesFile" },
23
+ { key: "attributeTypeName" },
24
+ { key: "openApiFile" },
25
+ { key: "slug", required: true },
26
+ { key: "typesFile", required: true },
27
+ ],
28
+ }),
29
+ exportName: "BLOCKS",
30
+ required: true,
31
+ },
32
+ };
33
+ /**
34
+ * Descriptors for optional workspace inventory sections beyond `BLOCKS`.
35
+ *
36
+ * Each descriptor centralizes append markers, exported interface/value repair
37
+ * sections, parser entry metadata such as `entriesKey` and `entryName`, and
38
+ * optional section flags so add, doctor, read, and mutation flows share one
39
+ * runtime contract when adding new inventory domains.
40
+ */
41
+ export const INVENTORY_SECTIONS = [
42
+ {
43
+ append: {
44
+ marker: VARIATION_CONFIG_ENTRY_MARKER,
45
+ optionKey: "variationEntries",
46
+ },
47
+ interface: {
48
+ name: "WorkspaceVariationConfig",
49
+ section: VARIATIONS_INTERFACE_SECTION,
50
+ },
51
+ parse: {
52
+ entriesKey: "variations",
53
+ entry: defineInventoryEntryParser()({
54
+ entryName: "VARIATIONS",
55
+ fields: [
56
+ { key: "block", required: true },
57
+ { key: "file", required: true },
58
+ { key: "slug", required: true },
59
+ ],
60
+ }),
61
+ hasSectionKey: "hasVariationsSection",
62
+ },
63
+ value: {
64
+ name: "VARIATIONS",
65
+ section: VARIATIONS_CONST_SECTION,
66
+ },
67
+ },
68
+ {
69
+ append: {
70
+ marker: BLOCK_STYLE_CONFIG_ENTRY_MARKER,
71
+ optionKey: "blockStyleEntries",
72
+ },
73
+ interface: {
74
+ name: "WorkspaceBlockStyleConfig",
75
+ section: BLOCK_STYLES_INTERFACE_SECTION,
76
+ },
77
+ parse: {
78
+ entriesKey: "blockStyles",
79
+ entry: defineInventoryEntryParser()({
80
+ entryName: "BLOCK_STYLES",
81
+ fields: [
82
+ { key: "block", required: true },
83
+ { key: "file", required: true },
84
+ { key: "slug", required: true },
85
+ ],
86
+ }),
87
+ hasSectionKey: "hasBlockStylesSection",
88
+ },
89
+ value: {
90
+ name: "BLOCK_STYLES",
91
+ section: BLOCK_STYLES_CONST_SECTION,
92
+ },
93
+ },
94
+ {
95
+ append: {
96
+ marker: BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER,
97
+ optionKey: "blockTransformEntries",
98
+ },
99
+ interface: {
100
+ name: "WorkspaceBlockTransformConfig",
101
+ section: BLOCK_TRANSFORMS_INTERFACE_SECTION,
102
+ },
103
+ parse: {
104
+ entriesKey: "blockTransforms",
105
+ entry: defineInventoryEntryParser()({
106
+ entryName: "BLOCK_TRANSFORMS",
107
+ fields: [
108
+ { key: "block", required: true },
109
+ { key: "file", required: true },
110
+ { key: "from", required: true },
111
+ { key: "slug", required: true },
112
+ { key: "to", required: true },
113
+ ],
114
+ }),
115
+ hasSectionKey: "hasBlockTransformsSection",
116
+ },
117
+ value: {
118
+ name: "BLOCK_TRANSFORMS",
119
+ section: BLOCK_TRANSFORMS_CONST_SECTION,
120
+ },
121
+ },
122
+ {
123
+ append: {
124
+ marker: PATTERN_CONFIG_ENTRY_MARKER,
125
+ optionKey: "patternEntries",
126
+ },
127
+ interface: {
128
+ name: "WorkspacePatternConfig",
129
+ section: PATTERNS_INTERFACE_SECTION,
130
+ },
131
+ parse: {
132
+ entriesKey: "patterns",
133
+ entry: defineInventoryEntryParser()({
134
+ entryName: "PATTERNS",
135
+ fields: [
136
+ { key: "file", required: true },
137
+ { key: "slug", required: true },
138
+ ],
139
+ }),
140
+ hasSectionKey: "hasPatternsSection",
141
+ },
142
+ value: {
143
+ name: "PATTERNS",
144
+ section: PATTERNS_CONST_SECTION,
145
+ },
146
+ },
147
+ {
148
+ append: {
149
+ marker: BINDING_SOURCE_CONFIG_ENTRY_MARKER,
150
+ optionKey: "bindingSourceEntries",
151
+ },
152
+ interface: {
153
+ name: "WorkspaceBindingSourceConfig",
154
+ section: BINDING_SOURCES_INTERFACE_SECTION,
155
+ },
156
+ parse: {
157
+ entriesKey: "bindingSources",
158
+ entry: defineInventoryEntryParser()({
159
+ entryName: "BINDING_SOURCES",
160
+ fields: [
161
+ { key: "attribute" },
162
+ { key: "block" },
163
+ { key: "editorFile", required: true },
164
+ { key: "serverFile", required: true },
165
+ { key: "slug", required: true },
166
+ ],
167
+ }),
168
+ hasSectionKey: "hasBindingSourcesSection",
169
+ },
170
+ value: {
171
+ name: "BINDING_SOURCES",
172
+ section: BINDING_SOURCES_CONST_SECTION,
173
+ },
174
+ },
175
+ {
176
+ append: {
177
+ marker: CONTRACT_CONFIG_ENTRY_MARKER,
178
+ optionKey: "contractEntries",
179
+ },
180
+ interface: {
181
+ name: "WorkspaceContractConfig",
182
+ section: CONTRACTS_INTERFACE_SECTION,
183
+ },
184
+ parse: {
185
+ entriesKey: "contracts",
186
+ entry: defineInventoryEntryParser()({
187
+ entryName: "CONTRACTS",
188
+ fields: [
189
+ { key: "schemaFile", required: true },
190
+ { key: "slug", required: true },
191
+ { key: "sourceTypeName", required: true },
192
+ { key: "typesFile", required: true },
193
+ ],
194
+ }),
195
+ hasSectionKey: "hasContractsSection",
196
+ },
197
+ value: {
198
+ name: "CONTRACTS",
199
+ section: CONTRACTS_CONST_SECTION,
200
+ },
201
+ },
202
+ {
203
+ append: {
204
+ marker: REST_RESOURCE_CONFIG_ENTRY_MARKER,
205
+ optionKey: "restResourceEntries",
206
+ },
207
+ interface: {
208
+ name: "WorkspaceRestResourceConfig",
209
+ section: REST_RESOURCES_INTERFACE_SECTION,
210
+ },
211
+ parse: {
212
+ entriesKey: "restResources",
213
+ entry: defineInventoryEntryParser()({
214
+ entryName: "REST_RESOURCES",
215
+ fields: [
216
+ { key: "apiFile", required: true },
217
+ {
218
+ key: "auth",
219
+ validate: (value, context) => {
220
+ if (typeof value === "string" &&
221
+ !MANUAL_REST_CONTRACT_AUTH_IDS.includes(value)) {
222
+ throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be one of: ${MANUAL_REST_CONTRACT_AUTH_IDS.join(", ")}.`);
223
+ }
224
+ },
225
+ },
226
+ { key: "bodyTypeName" },
227
+ { key: "clientFile", required: true },
228
+ { key: "controllerClass" },
229
+ { key: "controllerExtends" },
230
+ { key: "dataFile" },
231
+ {
232
+ key: "method",
233
+ validate: (value, context) => {
234
+ if (typeof value === "string" &&
235
+ !MANUAL_REST_CONTRACT_HTTP_METHOD_IDS.includes(value)) {
236
+ throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be one of: ${MANUAL_REST_CONTRACT_HTTP_METHOD_IDS.join(", ")}.`);
237
+ }
238
+ },
239
+ },
240
+ {
241
+ key: "methods",
242
+ kind: "stringArray",
243
+ required: true,
244
+ validate: (value, context) => {
245
+ const methods = Array.isArray(value) ? value : [];
246
+ const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
247
+ if (invalidMethods.length > 0) {
248
+ throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} includes unsupported values: ${invalidMethods.join(", ")}.`);
249
+ }
250
+ },
251
+ },
252
+ {
253
+ key: "mode",
254
+ validate: (value, context) => {
255
+ if (typeof value === "string" &&
256
+ value !== "generated" &&
257
+ value !== "manual") {
258
+ throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be generated or manual.`);
259
+ }
260
+ },
261
+ },
262
+ { key: "namespace", required: true },
263
+ { key: "openApiFile", required: true },
264
+ { key: "pathPattern" },
265
+ { key: "permissionCallback" },
266
+ { key: "phpFile" },
267
+ { key: "queryTypeName" },
268
+ { key: "responseTypeName" },
269
+ { key: "routePattern" },
270
+ { key: "secretFieldName" },
271
+ { key: "secretPreserveOnEmpty", kind: "boolean" },
272
+ { key: "secretStateFieldName" },
273
+ { key: "slug", required: true },
274
+ { key: "typesFile", required: true },
275
+ { key: "validatorsFile", required: true },
276
+ ],
277
+ }),
278
+ hasSectionKey: "hasRestResourcesSection",
279
+ },
280
+ value: {
281
+ name: "REST_RESOURCES",
282
+ section: REST_RESOURCES_CONST_SECTION,
283
+ },
284
+ },
285
+ {
286
+ append: {
287
+ marker: POST_META_CONFIG_ENTRY_MARKER,
288
+ optionKey: "postMetaEntries",
289
+ },
290
+ interface: {
291
+ name: "WorkspacePostMetaConfig",
292
+ section: POST_META_INTERFACE_SECTION,
293
+ },
294
+ parse: {
295
+ entriesKey: "postMeta",
296
+ entry: defineInventoryEntryParser()({
297
+ entryName: "POST_META",
298
+ fields: [
299
+ { key: "metaKey", required: true },
300
+ { key: "phpFile", required: true },
301
+ { key: "postType", required: true },
302
+ { key: "schemaFile", required: true },
303
+ { key: "showInRest", kind: "boolean", required: true },
304
+ { key: "slug", required: true },
305
+ { key: "sourceTypeName", required: true },
306
+ { key: "typesFile", required: true },
307
+ ],
308
+ }),
309
+ hasSectionKey: "hasPostMetaSection",
310
+ },
311
+ value: {
312
+ name: "POST_META",
313
+ section: POST_META_CONST_SECTION,
314
+ },
315
+ },
316
+ {
317
+ append: {
318
+ marker: ABILITY_CONFIG_ENTRY_MARKER,
319
+ optionKey: "abilityEntries",
320
+ },
321
+ interface: {
322
+ name: "WorkspaceAbilityConfig",
323
+ section: ABILITIES_INTERFACE_SECTION,
324
+ },
325
+ parse: {
326
+ entriesKey: "abilities",
327
+ entry: defineInventoryEntryParser()({
328
+ entryName: "ABILITIES",
329
+ fields: [
330
+ { key: "clientFile", required: true },
331
+ { key: "configFile", required: true },
332
+ { key: "dataFile", required: true },
333
+ { key: "inputSchemaFile", required: true },
334
+ { key: "inputTypeName", required: true },
335
+ { key: "outputSchemaFile", required: true },
336
+ { key: "outputTypeName", required: true },
337
+ { key: "phpFile", required: true },
338
+ { key: "slug", required: true },
339
+ { key: "typesFile", required: true },
340
+ ],
341
+ }),
342
+ hasSectionKey: "hasAbilitiesSection",
343
+ },
344
+ value: {
345
+ name: "ABILITIES",
346
+ section: ABILITIES_CONST_SECTION,
347
+ },
348
+ },
349
+ {
350
+ append: {
351
+ marker: AI_FEATURE_CONFIG_ENTRY_MARKER,
352
+ optionKey: "aiFeatureEntries",
353
+ },
354
+ interface: {
355
+ name: "WorkspaceAiFeatureConfig",
356
+ section: AI_FEATURES_INTERFACE_SECTION,
357
+ },
358
+ parse: {
359
+ entriesKey: "aiFeatures",
360
+ entry: defineInventoryEntryParser()({
361
+ entryName: "AI_FEATURES",
362
+ fields: [
363
+ { key: "aiSchemaFile", required: true },
364
+ { key: "apiFile", required: true },
365
+ { key: "clientFile", required: true },
366
+ { key: "dataFile", required: true },
367
+ { key: "namespace", required: true },
368
+ { key: "openApiFile", required: true },
369
+ { key: "phpFile", required: true },
370
+ { key: "slug", required: true },
371
+ { key: "typesFile", required: true },
372
+ { key: "validatorsFile", required: true },
373
+ ],
374
+ }),
375
+ hasSectionKey: "hasAiFeaturesSection",
376
+ },
377
+ value: {
378
+ name: "AI_FEATURES",
379
+ section: AI_FEATURES_CONST_SECTION,
380
+ },
381
+ },
382
+ {
383
+ append: {
384
+ marker: ADMIN_VIEW_CONFIG_ENTRY_MARKER,
385
+ optionKey: "adminViewEntries",
386
+ },
387
+ interface: {
388
+ name: "WorkspaceAdminViewConfig",
389
+ section: ADMIN_VIEWS_INTERFACE_SECTION,
390
+ },
391
+ parse: {
392
+ entriesKey: "adminViews",
393
+ entry: defineInventoryEntryParser()({
394
+ entryName: "ADMIN_VIEWS",
395
+ fields: [
396
+ { key: "file", required: true },
397
+ { key: "phpFile", required: true },
398
+ { key: "slug", required: true },
399
+ { key: "source" },
400
+ ],
401
+ }),
402
+ hasSectionKey: "hasAdminViewsSection",
403
+ },
404
+ value: {
405
+ name: "ADMIN_VIEWS",
406
+ section: ADMIN_VIEWS_CONST_SECTION,
407
+ },
408
+ },
409
+ {
410
+ append: {
411
+ marker: EDITOR_PLUGIN_CONFIG_ENTRY_MARKER,
412
+ optionKey: "editorPluginEntries",
413
+ },
414
+ interface: {
415
+ name: "WorkspaceEditorPluginConfig",
416
+ section: EDITOR_PLUGINS_INTERFACE_SECTION,
417
+ },
418
+ parse: {
419
+ entriesKey: "editorPlugins",
420
+ entry: defineInventoryEntryParser()({
421
+ entryName: "EDITOR_PLUGINS",
422
+ fields: [
423
+ { key: "file", required: true },
424
+ { key: "slug", required: true },
425
+ { key: "slot", required: true },
426
+ ],
427
+ }),
428
+ hasSectionKey: "hasEditorPluginsSection",
429
+ },
430
+ value: {
431
+ name: "EDITOR_PLUGINS",
432
+ section: EDITOR_PLUGINS_CONST_SECTION,
433
+ },
434
+ },
435
+ ];
@@ -29,7 +29,7 @@ export declare const BINDING_SOURCES_INTERFACE_SECTION = "\n\nexport interface W
29
29
  export declare const BINDING_SOURCES_CONST_SECTION = "\n\nexport const BINDING_SOURCES: WorkspaceBindingSourceConfig[] = [\n\t// wp-typia add binding-source entries\n];\n";
30
30
  export declare const CONTRACTS_INTERFACE_SECTION = "\n\nexport interface WorkspaceContractConfig {\n\tschemaFile: string;\n\tslug: string;\n\tsourceTypeName: string;\n\ttypesFile: string;\n}\n";
31
31
  export declare const CONTRACTS_CONST_SECTION = "\n\nexport const CONTRACTS: WorkspaceContractConfig[] = [\n\t// wp-typia add contract entries\n];\n";
32
- export declare const REST_RESOURCES_INTERFACE_SECTION = "\n\nexport interface WorkspaceRestResourceBaseConfig {\n\tapiFile: string;\n\tauth?: 'authenticated' | 'public' | 'public-write-protected';\n\tbodyTypeName?: string;\n\tclientFile: string;\n\tcontrollerClass?: string;\n\tcontrollerExtends?: string;\n\tnamespace: string;\n\topenApiFile: string;\n\tpermissionCallback?: string;\n\trestManifest?: ReturnType<\n\t\ttypeof import( '@wp-typia/block-runtime/metadata-core' ).defineEndpointManifest\n\t>;\n\tsecretFieldName?: string;\n\tsecretStateFieldName?: string;\n\tslug: string;\n\ttypesFile: string;\n\tvalidatorsFile: string;\n}\n\nexport interface GeneratedWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {\n\tdataFile: string;\n\tmethods: Array< 'list' | 'read' | 'create' | 'update' | 'delete' >;\n\tmode?: 'generated';\n\tphpFile: string;\n\troutePattern?: string;\n}\n\nexport interface ManualWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {\n\tmethod: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';\n\tmethods: [];\n\tmode: 'manual';\n\tpathPattern: string;\n\tqueryTypeName: string;\n\tresponseTypeName: string;\n}\n\nexport type WorkspaceRestResourceConfig =\n\t| GeneratedWorkspaceRestResourceConfig\n\t| ManualWorkspaceRestResourceConfig;\n";
32
+ export declare const REST_RESOURCES_INTERFACE_SECTION = "\n\nexport interface WorkspaceRestResourceBaseConfig {\n\tapiFile: string;\n\tauth?: 'authenticated' | 'public' | 'public-write-protected';\n\tbodyTypeName?: string;\n\tclientFile: string;\n\tcontrollerClass?: string;\n\tcontrollerExtends?: string;\n\tnamespace: string;\n\topenApiFile: string;\n\tpermissionCallback?: string;\n\trestManifest?: ReturnType<\n\t\ttypeof import( '@wp-typia/block-runtime/metadata-core' ).defineEndpointManifest\n\t>;\n\tsecretFieldName?: string;\n\tsecretPreserveOnEmpty?: boolean;\n\tsecretStateFieldName?: string;\n\tslug: string;\n\ttypesFile: string;\n\tvalidatorsFile: string;\n}\n\nexport interface GeneratedWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {\n\tdataFile: string;\n\tmethods: Array< 'list' | 'read' | 'create' | 'update' | 'delete' >;\n\tmode?: 'generated';\n\tphpFile: string;\n\troutePattern?: string;\n}\n\nexport interface ManualWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {\n\tmethod: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';\n\tmethods: [];\n\tmode: 'manual';\n\tpathPattern: string;\n\tqueryTypeName: string;\n\tresponseTypeName: string;\n}\n\nexport type WorkspaceRestResourceConfig =\n\t| GeneratedWorkspaceRestResourceConfig\n\t| ManualWorkspaceRestResourceConfig;\n";
33
33
  export declare const REST_RESOURCES_CONST_SECTION = "\n\nexport const REST_RESOURCES: WorkspaceRestResourceConfig[] = [\n\t// wp-typia add rest-resource entries\n];\n";
34
34
  /**
35
35
  * Template inserted when repairing `WorkspacePostMetaConfig` in block-config.
@@ -121,6 +121,7 @@ export interface WorkspaceRestResourceBaseConfig {
121
121
  \t\ttypeof import( '@wp-typia/block-runtime/metadata-core' ).defineEndpointManifest
122
122
  \t>;
123
123
  \tsecretFieldName?: string;
124
+ \tsecretPreserveOnEmpty?: boolean;
124
125
  \tsecretStateFieldName?: string;
125
126
  \tslug: string;
126
127
  \ttypesFile: string;
@@ -73,6 +73,7 @@ export interface WorkspaceRestResourceInventoryEntry {
73
73
  responseTypeName?: string;
74
74
  routePattern?: string;
75
75
  secretFieldName?: string;
76
+ secretPreserveOnEmpty?: boolean;
76
77
  secretStateFieldName?: string;
77
78
  slug: string;
78
79
  typesFile: string;
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { parsePackageManagerField, } from "./package-managers.js";
4
+ import { readJsonFileSync } from "./json-utils.js";
4
5
  export const WORKSPACE_TEMPLATE_PACKAGE = "@wp-typia/create-workspace-template";
5
6
  function hasNonEmptyString(value) {
6
7
  return typeof value === "string" && value.trim().length > 0;
@@ -17,12 +18,9 @@ export function parseWorkspacePackageJson(projectDirOrManifestPath) {
17
18
  const packageJsonPath = path.basename(projectDirOrManifestPath) === "package.json"
18
19
  ? projectDirOrManifestPath
19
20
  : path.join(projectDirOrManifestPath, "package.json");
20
- try {
21
- return JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
22
- }
23
- catch (error) {
24
- throw new Error(`Failed to parse workspace package manifest at ${packageJsonPath}: ${error instanceof Error ? error.message : String(error)}`);
25
- }
21
+ return readJsonFileSync(packageJsonPath, {
22
+ context: "workspace package manifest",
23
+ });
26
24
  }
27
25
  function getWorkspaceMetadataIssues(packageJson) {
28
26
  if (!packageJson.wpTypia) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/project-tools",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Project orchestration and programmatic tooling for wp-typia",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -161,7 +161,7 @@
161
161
  },
162
162
  "dependencies": {
163
163
  "@wp-typia/api-client": "^0.4.5",
164
- "@wp-typia/block-runtime": "^0.6.0",
164
+ "@wp-typia/block-runtime": "^0.6.1",
165
165
  "@wp-typia/rest": "^0.3.13",
166
166
  "@wp-typia/block-types": "^0.2.4",
167
167
  "mustache": "^4.2.0",