@wp-typia/project-tools 0.23.0 → 0.24.0

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 (228) 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/built-in-block-non-ts-basic-artifacts.d.ts +9 -0
  4. package/dist/runtime/built-in-block-non-ts-basic-artifacts.js +84 -0
  5. package/dist/runtime/built-in-block-non-ts-compound-artifacts.d.ts +9 -0
  6. package/dist/runtime/built-in-block-non-ts-compound-artifacts.js +36 -0
  7. package/dist/runtime/built-in-block-non-ts-compound-templates.d.ts +23 -0
  8. package/dist/runtime/built-in-block-non-ts-compound-templates.js +453 -0
  9. package/dist/runtime/built-in-block-non-ts-family-artifacts.d.ts +8 -26
  10. package/dist/runtime/built-in-block-non-ts-family-artifacts.js +8 -1034
  11. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.d.ts +9 -0
  12. package/dist/runtime/built-in-block-non-ts-interactivity-artifacts.js +83 -0
  13. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.d.ts +9 -0
  14. package/dist/runtime/built-in-block-non-ts-persistence-artifacts.js +33 -0
  15. package/dist/runtime/built-in-block-non-ts-persistence-templates.d.ts +23 -0
  16. package/dist/runtime/built-in-block-non-ts-persistence-templates.js +395 -0
  17. package/dist/runtime/cli-add-block-json.js +5 -1
  18. package/dist/runtime/cli-add-collision.js +8 -0
  19. package/dist/runtime/cli-add-help.js +14 -10
  20. package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
  21. package/dist/runtime/cli-add-kind-ids.js +1 -0
  22. package/dist/runtime/cli-add-types.d.ts +45 -6
  23. package/dist/runtime/cli-add-types.js +2 -0
  24. package/dist/runtime/cli-add-validation.d.ts +7 -0
  25. package/dist/runtime/cli-add-validation.js +9 -0
  26. package/dist/runtime/cli-add-workspace-ability-anchors.d.ts +24 -0
  27. package/dist/runtime/cli-add-workspace-ability-anchors.js +294 -0
  28. package/dist/runtime/cli-add-workspace-ability-registry.d.ts +10 -0
  29. package/dist/runtime/cli-add-workspace-ability-registry.js +51 -0
  30. package/dist/runtime/cli-add-workspace-ability-scaffold.d.ts +1 -1
  31. package/dist/runtime/cli-add-workspace-ability-scaffold.js +5 -308
  32. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +6 -2
  33. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  34. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  35. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  36. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  37. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  38. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  39. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  40. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  41. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  42. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  43. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
  44. package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
  45. package/dist/runtime/cli-add-workspace-ai-anchors.d.ts +4 -4
  46. package/dist/runtime/cli-add-workspace-ai-anchors.js +8 -233
  47. package/dist/runtime/cli-add-workspace-ai-scaffold.js +4 -2
  48. package/dist/runtime/cli-add-workspace-ai-source-emitters.d.ts +1 -4
  49. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +1 -129
  50. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.d.ts +5 -0
  51. package/dist/runtime/cli-add-workspace-ai-sync-rest-anchors.js +236 -0
  52. package/dist/runtime/cli-add-workspace-ai-sync-script-source.d.ts +4 -0
  53. package/dist/runtime/cli-add-workspace-ai-sync-script-source.js +145 -0
  54. package/dist/runtime/cli-add-workspace-assets.d.ts +6 -63
  55. package/dist/runtime/cli-add-workspace-assets.js +6 -950
  56. package/dist/runtime/cli-add-workspace-binding-source-anchors.d.ts +23 -0
  57. package/dist/runtime/cli-add-workspace-binding-source-anchors.js +112 -0
  58. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.d.ts +33 -0
  59. package/dist/runtime/cli-add-workspace-binding-source-source-emitters.js +436 -0
  60. package/dist/runtime/cli-add-workspace-binding-source-types.d.ts +20 -0
  61. package/dist/runtime/cli-add-workspace-binding-source-types.js +1 -0
  62. package/dist/runtime/cli-add-workspace-binding-source.d.ts +40 -0
  63. package/dist/runtime/cli-add-workspace-binding-source.js +275 -0
  64. package/dist/runtime/cli-add-workspace-block-style.d.ts +22 -0
  65. package/dist/runtime/cli-add-workspace-block-style.js +148 -0
  66. package/dist/runtime/cli-add-workspace-block-transform.d.ts +32 -0
  67. package/dist/runtime/cli-add-workspace-block-transform.js +197 -0
  68. package/dist/runtime/cli-add-workspace-contract.js +1 -1
  69. package/dist/runtime/cli-add-workspace-core-variation.d.ts +20 -0
  70. package/dist/runtime/cli-add-workspace-core-variation.js +322 -0
  71. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.d.ts +37 -0
  72. package/dist/runtime/cli-add-workspace-editor-plugin-anchors.js +206 -0
  73. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.d.ts +47 -0
  74. package/dist/runtime/cli-add-workspace-editor-plugin-source-emitters.js +219 -0
  75. package/dist/runtime/cli-add-workspace-editor-plugin.d.ts +22 -0
  76. package/dist/runtime/cli-add-workspace-editor-plugin.js +78 -0
  77. package/dist/runtime/cli-add-workspace-hooked-block.d.ts +23 -0
  78. package/dist/runtime/cli-add-workspace-hooked-block.js +57 -0
  79. package/dist/runtime/cli-add-workspace-integration-env-files.d.ts +33 -0
  80. package/dist/runtime/cli-add-workspace-integration-env-files.js +65 -0
  81. package/dist/runtime/cli-add-workspace-integration-env-package-json.d.ts +38 -0
  82. package/dist/runtime/cli-add-workspace-integration-env-package-json.js +122 -0
  83. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.d.ts +44 -0
  84. package/dist/runtime/cli-add-workspace-integration-env-source-emitters.js +262 -0
  85. package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
  86. package/dist/runtime/cli-add-workspace-integration-env.js +10 -313
  87. package/dist/runtime/cli-add-workspace-pattern-anchors.d.ts +10 -0
  88. package/dist/runtime/cli-add-workspace-pattern-anchors.js +95 -0
  89. package/dist/runtime/cli-add-workspace-pattern-options.d.ts +20 -0
  90. package/dist/runtime/cli-add-workspace-pattern-options.js +113 -0
  91. package/dist/runtime/cli-add-workspace-pattern-source-emitters.d.ts +20 -0
  92. package/dist/runtime/cli-add-workspace-pattern-source-emitters.js +57 -0
  93. package/dist/runtime/cli-add-workspace-pattern.d.ts +42 -0
  94. package/dist/runtime/cli-add-workspace-pattern.js +99 -0
  95. package/dist/runtime/cli-add-workspace-post-meta.js +1 -1
  96. package/dist/runtime/cli-add-workspace-registration-hooks.d.ts +50 -0
  97. package/dist/runtime/cli-add-workspace-registration-hooks.js +162 -0
  98. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +9 -4
  99. package/dist/runtime/cli-add-workspace-rest-anchors.js +9 -428
  100. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.d.ts +17 -0
  101. package/dist/runtime/cli-add-workspace-rest-bootstrap-anchors.js +108 -0
  102. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.d.ts +9 -0
  103. package/dist/runtime/cli-add-workspace-rest-contract-sync-anchors.js +142 -0
  104. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.d.ts +51 -0
  105. package/dist/runtime/cli-add-workspace-rest-generated-source-emitters.js +415 -0
  106. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  107. package/dist/runtime/cli-add-workspace-rest-generated.js +160 -0
  108. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.d.ts +80 -0
  109. package/dist/runtime/cli-add-workspace-rest-manual-source-emitters.js +238 -0
  110. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  111. package/dist/runtime/cli-add-workspace-rest-manual.js +266 -0
  112. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +18 -0
  113. package/dist/runtime/cli-add-workspace-rest-php-templates.js +359 -0
  114. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.d.ts +33 -0
  115. package/dist/runtime/cli-add-workspace-rest-resource-php-routing-template.js +145 -0
  116. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.d.ts +9 -0
  117. package/dist/runtime/cli-add-workspace-rest-resource-sync-anchors.js +162 -0
  118. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.d.ts +7 -0
  119. package/dist/runtime/cli-add-workspace-rest-schema-helper-php-template.js +193 -0
  120. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +5 -91
  121. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +5 -642
  122. package/dist/runtime/cli-add-workspace-rest-source-utils.d.ts +17 -0
  123. package/dist/runtime/cli-add-workspace-rest-source-utils.js +50 -0
  124. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.d.ts +56 -0
  125. package/dist/runtime/cli-add-workspace-rest-sync-script-shared.js +122 -0
  126. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  127. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  128. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
  129. package/dist/runtime/cli-add-workspace-rest.js +33 -788
  130. package/dist/runtime/cli-add-workspace-variation.d.ts +22 -0
  131. package/dist/runtime/cli-add-workspace-variation.js +162 -0
  132. package/dist/runtime/cli-add-workspace.d.ts +42 -107
  133. package/dist/runtime/cli-add-workspace.js +42 -674
  134. package/dist/runtime/cli-add.d.ts +3 -3
  135. package/dist/runtime/cli-add.js +2 -2
  136. package/dist/runtime/cli-core.d.ts +3 -2
  137. package/dist/runtime/cli-core.js +2 -2
  138. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  139. package/dist/runtime/cli-diagnostics.js +17 -5
  140. package/dist/runtime/cli-doctor-workspace-bindings.js +63 -1
  141. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  142. package/dist/runtime/cli-doctor-workspace-block-addons.js +162 -0
  143. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  144. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  145. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  146. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  147. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  148. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  149. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  150. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  151. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  152. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  153. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  154. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  155. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  156. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  157. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  158. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  159. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  160. package/dist/runtime/cli-doctor-workspace-features.js +14 -487
  161. package/dist/runtime/cli-doctor.d.ts +54 -3
  162. package/dist/runtime/cli-doctor.js +92 -10
  163. package/dist/runtime/cli-help.js +12 -7
  164. package/dist/runtime/cli-init-package-json.js +4 -2
  165. package/dist/runtime/cli-prompt.d.ts +16 -2
  166. package/dist/runtime/cli-prompt.js +29 -12
  167. package/dist/runtime/cli-scaffold.d.ts +2 -1
  168. package/dist/runtime/cli-scaffold.js +19 -10
  169. package/dist/runtime/external-template-guards.js +4 -6
  170. package/dist/runtime/index.d.ts +6 -3
  171. package/dist/runtime/index.js +4 -2
  172. package/dist/runtime/json-utils.d.ts +62 -4
  173. package/dist/runtime/json-utils.js +78 -4
  174. package/dist/runtime/local-dev-presets.js +6 -2
  175. package/dist/runtime/migration-ui-capability.js +4 -1
  176. package/dist/runtime/migration-utils.js +4 -1
  177. package/dist/runtime/package-managers.js +6 -1
  178. package/dist/runtime/package-versions.d.ts +1 -0
  179. package/dist/runtime/package-versions.js +16 -3
  180. package/dist/runtime/pattern-catalog.d.ts +122 -0
  181. package/dist/runtime/pattern-catalog.js +471 -0
  182. package/dist/runtime/post-meta-binding-fields.d.ts +46 -0
  183. package/dist/runtime/post-meta-binding-fields.js +135 -0
  184. package/dist/runtime/scaffold-bootstrap.js +7 -2
  185. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  186. package/dist/runtime/scaffold-repository-reference.js +4 -2
  187. package/dist/runtime/scaffold-template-variables.js +2 -1
  188. package/dist/runtime/scaffold.d.ts +18 -1
  189. package/dist/runtime/scaffold.js +55 -2
  190. package/dist/runtime/temp-roots.js +4 -1
  191. package/dist/runtime/template-layers.js +4 -1
  192. package/dist/runtime/template-registry.js +9 -3
  193. package/dist/runtime/template-source-contracts.d.ts +2 -0
  194. package/dist/runtime/template-source-normalization.js +2 -1
  195. package/dist/runtime/template-source-remote.js +18 -5
  196. package/dist/runtime/template-source-seeds.js +10 -3
  197. package/dist/runtime/typia-llm-json-schema.d.ts +24 -0
  198. package/dist/runtime/typia-llm-json-schema.js +33 -0
  199. package/dist/runtime/typia-llm-openapi-constraints.d.ts +20 -0
  200. package/dist/runtime/typia-llm-openapi-constraints.js +254 -0
  201. package/dist/runtime/typia-llm-projection.d.ts +25 -0
  202. package/dist/runtime/typia-llm-projection.js +58 -0
  203. package/dist/runtime/typia-llm-render.d.ts +21 -0
  204. package/dist/runtime/typia-llm-render.js +252 -0
  205. package/dist/runtime/typia-llm-sync.d.ts +10 -0
  206. package/dist/runtime/typia-llm-sync.js +63 -0
  207. package/dist/runtime/typia-llm-types.d.ts +197 -0
  208. package/dist/runtime/typia-llm-types.js +1 -0
  209. package/dist/runtime/typia-llm.d.ts +9 -255
  210. package/dist/runtime/typia-llm.js +5 -634
  211. package/dist/runtime/workspace-inventory-mutations.js +15 -1
  212. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  213. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  214. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  215. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  216. package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
  217. package/dist/runtime/workspace-inventory-parser.js +3 -581
  218. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  219. package/dist/runtime/workspace-inventory-section-descriptors.js +443 -0
  220. package/dist/runtime/workspace-inventory-templates.d.ts +3 -3
  221. package/dist/runtime/workspace-inventory-templates.js +10 -1
  222. package/dist/runtime/workspace-inventory-types.d.ts +10 -1
  223. package/dist/runtime/workspace-project.js +4 -6
  224. package/package.json +8 -3
  225. package/templates/_shared/compound/core/scripts/block-config.ts.mustache +22 -0
  226. package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +103 -2
  227. package/templates/_shared/compound/core/src/inner-blocks-templates.ts.mustache +13 -0
  228. package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +22 -1
@@ -1,585 +1,7 @@
1
1
  import ts from "typescript";
2
- import { MANUAL_REST_CONTRACT_AUTH_IDS, MANUAL_REST_CONTRACT_HTTP_METHOD_IDS, REST_RESOURCE_METHOD_IDS, } from "./cli-add-shared.js";
3
- import { getPropertyNameText } from "./ts-property-names.js";
4
- 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, CONTRACTS_CONST_SECTION, CONTRACTS_INTERFACE_SECTION, CONTRACT_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, 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";
5
- function defineInventoryEntryParser() {
6
- return (descriptor) => descriptor;
7
- }
8
- export const BLOCK_INVENTORY_SECTION = {
9
- append: {
10
- marker: BLOCK_CONFIG_ENTRY_MARKER,
11
- optionKey: "blockEntries",
12
- },
13
- parse: {
14
- entriesKey: "blocks",
15
- entry: defineInventoryEntryParser()({
16
- entryName: "BLOCKS",
17
- fields: [
18
- { key: "apiTypesFile" },
19
- { key: "attributeTypeName" },
20
- { key: "openApiFile" },
21
- { key: "slug", required: true },
22
- { key: "typesFile", required: true },
23
- ],
24
- }),
25
- exportName: "BLOCKS",
26
- required: true,
27
- },
28
- };
29
- export const INVENTORY_SECTIONS = [
30
- {
31
- append: {
32
- marker: VARIATION_CONFIG_ENTRY_MARKER,
33
- optionKey: "variationEntries",
34
- },
35
- interface: {
36
- name: "WorkspaceVariationConfig",
37
- section: VARIATIONS_INTERFACE_SECTION,
38
- },
39
- parse: {
40
- entriesKey: "variations",
41
- entry: defineInventoryEntryParser()({
42
- entryName: "VARIATIONS",
43
- fields: [
44
- { key: "block", required: true },
45
- { key: "file", required: true },
46
- { key: "slug", required: true },
47
- ],
48
- }),
49
- hasSectionKey: "hasVariationsSection",
50
- },
51
- value: {
52
- name: "VARIATIONS",
53
- section: VARIATIONS_CONST_SECTION,
54
- },
55
- },
56
- {
57
- append: {
58
- marker: BLOCK_STYLE_CONFIG_ENTRY_MARKER,
59
- optionKey: "blockStyleEntries",
60
- },
61
- interface: {
62
- name: "WorkspaceBlockStyleConfig",
63
- section: BLOCK_STYLES_INTERFACE_SECTION,
64
- },
65
- parse: {
66
- entriesKey: "blockStyles",
67
- entry: defineInventoryEntryParser()({
68
- entryName: "BLOCK_STYLES",
69
- fields: [
70
- { key: "block", required: true },
71
- { key: "file", required: true },
72
- { key: "slug", required: true },
73
- ],
74
- }),
75
- hasSectionKey: "hasBlockStylesSection",
76
- },
77
- value: {
78
- name: "BLOCK_STYLES",
79
- section: BLOCK_STYLES_CONST_SECTION,
80
- },
81
- },
82
- {
83
- append: {
84
- marker: BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER,
85
- optionKey: "blockTransformEntries",
86
- },
87
- interface: {
88
- name: "WorkspaceBlockTransformConfig",
89
- section: BLOCK_TRANSFORMS_INTERFACE_SECTION,
90
- },
91
- parse: {
92
- entriesKey: "blockTransforms",
93
- entry: defineInventoryEntryParser()({
94
- entryName: "BLOCK_TRANSFORMS",
95
- fields: [
96
- { key: "block", required: true },
97
- { key: "file", required: true },
98
- { key: "from", required: true },
99
- { key: "slug", required: true },
100
- { key: "to", required: true },
101
- ],
102
- }),
103
- hasSectionKey: "hasBlockTransformsSection",
104
- },
105
- value: {
106
- name: "BLOCK_TRANSFORMS",
107
- section: BLOCK_TRANSFORMS_CONST_SECTION,
108
- },
109
- },
110
- {
111
- append: {
112
- marker: PATTERN_CONFIG_ENTRY_MARKER,
113
- optionKey: "patternEntries",
114
- },
115
- interface: {
116
- name: "WorkspacePatternConfig",
117
- section: PATTERNS_INTERFACE_SECTION,
118
- },
119
- parse: {
120
- entriesKey: "patterns",
121
- entry: defineInventoryEntryParser()({
122
- entryName: "PATTERNS",
123
- fields: [
124
- { key: "file", required: true },
125
- { key: "slug", required: true },
126
- ],
127
- }),
128
- hasSectionKey: "hasPatternsSection",
129
- },
130
- value: {
131
- name: "PATTERNS",
132
- section: PATTERNS_CONST_SECTION,
133
- },
134
- },
135
- {
136
- append: {
137
- marker: BINDING_SOURCE_CONFIG_ENTRY_MARKER,
138
- optionKey: "bindingSourceEntries",
139
- },
140
- interface: {
141
- name: "WorkspaceBindingSourceConfig",
142
- section: BINDING_SOURCES_INTERFACE_SECTION,
143
- },
144
- parse: {
145
- entriesKey: "bindingSources",
146
- entry: defineInventoryEntryParser()({
147
- entryName: "BINDING_SOURCES",
148
- fields: [
149
- { key: "attribute" },
150
- { key: "block" },
151
- { key: "editorFile", required: true },
152
- { key: "serverFile", required: true },
153
- { key: "slug", required: true },
154
- ],
155
- }),
156
- hasSectionKey: "hasBindingSourcesSection",
157
- },
158
- value: {
159
- name: "BINDING_SOURCES",
160
- section: BINDING_SOURCES_CONST_SECTION,
161
- },
162
- },
163
- {
164
- append: {
165
- marker: CONTRACT_CONFIG_ENTRY_MARKER,
166
- optionKey: "contractEntries",
167
- },
168
- interface: {
169
- name: "WorkspaceContractConfig",
170
- section: CONTRACTS_INTERFACE_SECTION,
171
- },
172
- parse: {
173
- entriesKey: "contracts",
174
- entry: defineInventoryEntryParser()({
175
- entryName: "CONTRACTS",
176
- fields: [
177
- { key: "schemaFile", required: true },
178
- { key: "slug", required: true },
179
- { key: "sourceTypeName", required: true },
180
- { key: "typesFile", required: true },
181
- ],
182
- }),
183
- hasSectionKey: "hasContractsSection",
184
- },
185
- value: {
186
- name: "CONTRACTS",
187
- section: CONTRACTS_CONST_SECTION,
188
- },
189
- },
190
- {
191
- append: {
192
- marker: REST_RESOURCE_CONFIG_ENTRY_MARKER,
193
- optionKey: "restResourceEntries",
194
- },
195
- interface: {
196
- name: "WorkspaceRestResourceConfig",
197
- section: REST_RESOURCES_INTERFACE_SECTION,
198
- },
199
- parse: {
200
- entriesKey: "restResources",
201
- entry: defineInventoryEntryParser()({
202
- entryName: "REST_RESOURCES",
203
- fields: [
204
- { key: "apiFile", required: true },
205
- {
206
- key: "auth",
207
- validate: (value, context) => {
208
- if (typeof value === "string" &&
209
- !MANUAL_REST_CONTRACT_AUTH_IDS.includes(value)) {
210
- throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be one of: ${MANUAL_REST_CONTRACT_AUTH_IDS.join(", ")}.`);
211
- }
212
- },
213
- },
214
- { key: "bodyTypeName" },
215
- { key: "clientFile", required: true },
216
- { key: "controllerClass" },
217
- { key: "controllerExtends" },
218
- { key: "dataFile" },
219
- {
220
- key: "method",
221
- validate: (value, context) => {
222
- if (typeof value === "string" &&
223
- !MANUAL_REST_CONTRACT_HTTP_METHOD_IDS.includes(value)) {
224
- throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be one of: ${MANUAL_REST_CONTRACT_HTTP_METHOD_IDS.join(", ")}.`);
225
- }
226
- },
227
- },
228
- {
229
- key: "methods",
230
- kind: "stringArray",
231
- required: true,
232
- validate: (value, context) => {
233
- const methods = Array.isArray(value) ? value : [];
234
- const invalidMethods = methods.filter((method) => !REST_RESOURCE_METHOD_IDS.includes(method));
235
- if (invalidMethods.length > 0) {
236
- throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} includes unsupported values: ${invalidMethods.join(", ")}.`);
237
- }
238
- },
239
- },
240
- {
241
- key: "mode",
242
- validate: (value, context) => {
243
- if (typeof value === "string" &&
244
- value !== "generated" &&
245
- value !== "manual") {
246
- throw new Error(`${context.entryName}[${context.elementIndex}].${context.key} must be generated or manual.`);
247
- }
248
- },
249
- },
250
- { key: "namespace", required: true },
251
- { key: "openApiFile", required: true },
252
- { key: "pathPattern" },
253
- { key: "permissionCallback" },
254
- { key: "phpFile" },
255
- { key: "queryTypeName" },
256
- { key: "responseTypeName" },
257
- { key: "routePattern" },
258
- { key: "secretFieldName" },
259
- { key: "secretStateFieldName" },
260
- { key: "slug", required: true },
261
- { key: "typesFile", required: true },
262
- { key: "validatorsFile", required: true },
263
- ],
264
- }),
265
- hasSectionKey: "hasRestResourcesSection",
266
- },
267
- value: {
268
- name: "REST_RESOURCES",
269
- section: REST_RESOURCES_CONST_SECTION,
270
- },
271
- },
272
- {
273
- append: {
274
- marker: POST_META_CONFIG_ENTRY_MARKER,
275
- optionKey: "postMetaEntries",
276
- },
277
- interface: {
278
- name: "WorkspacePostMetaConfig",
279
- section: POST_META_INTERFACE_SECTION,
280
- },
281
- parse: {
282
- entriesKey: "postMeta",
283
- entry: defineInventoryEntryParser()({
284
- entryName: "POST_META",
285
- fields: [
286
- { key: "metaKey", required: true },
287
- { key: "phpFile", required: true },
288
- { key: "postType", required: true },
289
- { key: "schemaFile", required: true },
290
- { key: "showInRest", kind: "boolean", required: true },
291
- { key: "slug", required: true },
292
- { key: "sourceTypeName", required: true },
293
- { key: "typesFile", required: true },
294
- ],
295
- }),
296
- hasSectionKey: "hasPostMetaSection",
297
- },
298
- value: {
299
- name: "POST_META",
300
- section: POST_META_CONST_SECTION,
301
- },
302
- },
303
- {
304
- append: {
305
- marker: ABILITY_CONFIG_ENTRY_MARKER,
306
- optionKey: "abilityEntries",
307
- },
308
- interface: {
309
- name: "WorkspaceAbilityConfig",
310
- section: ABILITIES_INTERFACE_SECTION,
311
- },
312
- parse: {
313
- entriesKey: "abilities",
314
- entry: defineInventoryEntryParser()({
315
- entryName: "ABILITIES",
316
- fields: [
317
- { key: "clientFile", required: true },
318
- { key: "configFile", required: true },
319
- { key: "dataFile", required: true },
320
- { key: "inputSchemaFile", required: true },
321
- { key: "inputTypeName", required: true },
322
- { key: "outputSchemaFile", required: true },
323
- { key: "outputTypeName", required: true },
324
- { key: "phpFile", required: true },
325
- { key: "slug", required: true },
326
- { key: "typesFile", required: true },
327
- ],
328
- }),
329
- hasSectionKey: "hasAbilitiesSection",
330
- },
331
- value: {
332
- name: "ABILITIES",
333
- section: ABILITIES_CONST_SECTION,
334
- },
335
- },
336
- {
337
- append: {
338
- marker: AI_FEATURE_CONFIG_ENTRY_MARKER,
339
- optionKey: "aiFeatureEntries",
340
- },
341
- interface: {
342
- name: "WorkspaceAiFeatureConfig",
343
- section: AI_FEATURES_INTERFACE_SECTION,
344
- },
345
- parse: {
346
- entriesKey: "aiFeatures",
347
- entry: defineInventoryEntryParser()({
348
- entryName: "AI_FEATURES",
349
- fields: [
350
- { key: "aiSchemaFile", required: true },
351
- { key: "apiFile", required: true },
352
- { key: "clientFile", required: true },
353
- { key: "dataFile", required: true },
354
- { key: "namespace", required: true },
355
- { key: "openApiFile", required: true },
356
- { key: "phpFile", required: true },
357
- { key: "slug", required: true },
358
- { key: "typesFile", required: true },
359
- { key: "validatorsFile", required: true },
360
- ],
361
- }),
362
- hasSectionKey: "hasAiFeaturesSection",
363
- },
364
- value: {
365
- name: "AI_FEATURES",
366
- section: AI_FEATURES_CONST_SECTION,
367
- },
368
- },
369
- {
370
- append: {
371
- marker: ADMIN_VIEW_CONFIG_ENTRY_MARKER,
372
- optionKey: "adminViewEntries",
373
- },
374
- interface: {
375
- name: "WorkspaceAdminViewConfig",
376
- section: ADMIN_VIEWS_INTERFACE_SECTION,
377
- },
378
- parse: {
379
- entriesKey: "adminViews",
380
- entry: defineInventoryEntryParser()({
381
- entryName: "ADMIN_VIEWS",
382
- fields: [
383
- { key: "file", required: true },
384
- { key: "phpFile", required: true },
385
- { key: "slug", required: true },
386
- { key: "source" },
387
- ],
388
- }),
389
- hasSectionKey: "hasAdminViewsSection",
390
- },
391
- value: {
392
- name: "ADMIN_VIEWS",
393
- section: ADMIN_VIEWS_CONST_SECTION,
394
- },
395
- },
396
- {
397
- append: {
398
- marker: EDITOR_PLUGIN_CONFIG_ENTRY_MARKER,
399
- optionKey: "editorPluginEntries",
400
- },
401
- interface: {
402
- name: "WorkspaceEditorPluginConfig",
403
- section: EDITOR_PLUGINS_INTERFACE_SECTION,
404
- },
405
- parse: {
406
- entriesKey: "editorPlugins",
407
- entry: defineInventoryEntryParser()({
408
- entryName: "EDITOR_PLUGINS",
409
- fields: [
410
- { key: "file", required: true },
411
- { key: "slug", required: true },
412
- { key: "slot", required: true },
413
- ],
414
- }),
415
- hasSectionKey: "hasEditorPluginsSection",
416
- },
417
- value: {
418
- name: "EDITOR_PLUGINS",
419
- section: EDITOR_PLUGINS_CONST_SECTION,
420
- },
421
- },
422
- ];
423
- function findExportedArrayLiteral(sourceFile, exportName) {
424
- for (const statement of sourceFile.statements) {
425
- if (!ts.isVariableStatement(statement)) {
426
- continue;
427
- }
428
- if (!statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {
429
- continue;
430
- }
431
- for (const declaration of statement.declarationList.declarations) {
432
- if (!ts.isIdentifier(declaration.name) ||
433
- declaration.name.text !== exportName) {
434
- continue;
435
- }
436
- if (declaration.initializer &&
437
- ts.isArrayLiteralExpression(declaration.initializer)) {
438
- return {
439
- array: declaration.initializer,
440
- found: true,
441
- };
442
- }
443
- return {
444
- array: null,
445
- found: true,
446
- };
447
- }
448
- }
449
- return {
450
- array: null,
451
- found: false,
452
- };
453
- }
454
- function getOptionalStringProperty(entryName, elementIndex, objectLiteral, key) {
455
- for (const property of objectLiteral.properties) {
456
- if (!ts.isPropertyAssignment(property)) {
457
- continue;
458
- }
459
- const propertyName = getPropertyNameText(property.name);
460
- if (propertyName !== key) {
461
- continue;
462
- }
463
- if (ts.isStringLiteralLike(property.initializer)) {
464
- return property.initializer.text;
465
- }
466
- throw new Error(`${entryName}[${elementIndex}] must use a string literal for "${key}" in scripts/block-config.ts.`);
467
- }
468
- return undefined;
469
- }
470
- function getOptionalStringArrayProperty(entryName, elementIndex, objectLiteral, key) {
471
- for (const property of objectLiteral.properties) {
472
- if (!ts.isPropertyAssignment(property)) {
473
- continue;
474
- }
475
- const propertyName = getPropertyNameText(property.name);
476
- if (propertyName !== key) {
477
- continue;
478
- }
479
- if (!ts.isArrayLiteralExpression(property.initializer)) {
480
- throw new Error(`${entryName}[${elementIndex}] must use an array literal for "${key}" in scripts/block-config.ts.`);
481
- }
482
- return property.initializer.elements.map((element, itemIndex) => {
483
- if (!ts.isStringLiteralLike(element)) {
484
- throw new Error(`${entryName}[${elementIndex}].${key}[${itemIndex}] must use a string literal in scripts/block-config.ts.`);
485
- }
486
- return element.text;
487
- });
488
- }
489
- return undefined;
490
- }
491
- function getOptionalBooleanProperty(entryName, elementIndex, objectLiteral, key) {
492
- for (const property of objectLiteral.properties) {
493
- if (!ts.isPropertyAssignment(property)) {
494
- continue;
495
- }
496
- const propertyName = getPropertyNameText(property.name);
497
- if (propertyName !== key) {
498
- continue;
499
- }
500
- if (property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
501
- return true;
502
- }
503
- if (property.initializer.kind === ts.SyntaxKind.FalseKeyword) {
504
- return false;
505
- }
506
- throw new Error(`${entryName}[${elementIndex}] must use a boolean literal for "${key}" in scripts/block-config.ts.`);
507
- }
508
- return undefined;
509
- }
510
- function isMissingRequiredInventoryValue(value) {
511
- return (value === undefined || (typeof value === "string" && value.length === 0));
512
- }
513
- function formatMissingRequiredInventoryFields(keys) {
514
- return keys.length === 1
515
- ? `required "${keys[0]}"`
516
- : `required fields ${keys.map((key) => `"${key}"`).join(", ")}`;
517
- }
518
- function assertParsedInventoryEntry(entry, descriptor, elementIndex) {
519
- const missingRequiredKeys = descriptor.fields
520
- .filter((field) => field.required === true &&
521
- isMissingRequiredInventoryValue(entry[field.key]))
522
- .map((field) => field.key);
523
- if (missingRequiredKeys.length > 0) {
524
- throw new Error(`${descriptor.entryName}[${elementIndex}] is missing ${formatMissingRequiredInventoryFields(missingRequiredKeys)} in scripts/block-config.ts.`);
525
- }
526
- }
527
- function parseInventoryEntries(arrayLiteral, descriptor) {
528
- return arrayLiteral.elements.map((element, elementIndex) => {
529
- if (!ts.isObjectLiteralExpression(element)) {
530
- throw new Error(`${descriptor.entryName}[${elementIndex}] must be an object literal in scripts/block-config.ts.`);
531
- }
532
- const entry = {};
533
- for (const field of descriptor.fields) {
534
- const kind = field.kind ?? "string";
535
- const value = kind === "stringArray"
536
- ? getOptionalStringArrayProperty(descriptor.entryName, elementIndex, element, field.key)
537
- : kind === "boolean"
538
- ? getOptionalBooleanProperty(descriptor.entryName, elementIndex, element, field.key)
539
- : getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
540
- field.validate?.(value, {
541
- elementIndex,
542
- entryName: descriptor.entryName,
543
- key: field.key,
544
- });
545
- entry[field.key] = value;
546
- }
547
- assertParsedInventoryEntry(entry, descriptor, elementIndex);
548
- return entry;
549
- });
550
- }
551
- function parseInventorySection(sourceFile, descriptor) {
552
- if (!descriptor.parse) {
553
- return {
554
- entries: [],
555
- found: false,
556
- };
557
- }
558
- const exportName = descriptor.parse.exportName ?? descriptor.value?.name;
559
- if (!exportName) {
560
- throw new Error("Inventory parser descriptor is missing an export name.");
561
- }
562
- const exportedArray = findExportedArrayLiteral(sourceFile, exportName);
563
- if (!exportedArray.found) {
564
- if (descriptor.parse.required) {
565
- throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
566
- }
567
- return {
568
- entries: [],
569
- found: false,
570
- };
571
- }
572
- if (!exportedArray.array) {
573
- if (descriptor.parse.required) {
574
- throw new Error(`scripts/block-config.ts must export a ${exportName} array.`);
575
- }
576
- throw new Error(`scripts/block-config.ts must export ${exportName} as an array literal.`);
577
- }
578
- return {
579
- entries: parseInventoryEntries(exportedArray.array, descriptor.parse.entry),
580
- found: true,
581
- };
582
- }
2
+ import { parseInventorySection } from "./workspace-inventory-parser-entries.js";
3
+ import { BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS, } from "./workspace-inventory-section-descriptors.js";
4
+ export { BLOCK_INVENTORY_SECTION, INVENTORY_SECTIONS, } from "./workspace-inventory-section-descriptors.js";
583
5
  /**
584
6
  * Parse workspace inventory entries from the source of `scripts/block-config.ts`.
585
7
  *
@@ -0,0 +1,19 @@
1
+ import { type InventorySectionDescriptor } from "./workspace-inventory-parser-validation.js";
2
+ /**
3
+ * Descriptor for the required `BLOCKS` inventory section.
4
+ *
5
+ * Runtime readers use its `parse` contract to require the exported `BLOCKS`
6
+ * array and validate required block entry fields; mutation helpers use its
7
+ * `append` marker to insert generated block entries without duplicating section
8
+ * knowledge.
9
+ */
10
+ export declare const BLOCK_INVENTORY_SECTION: InventorySectionDescriptor;
11
+ /**
12
+ * Descriptors for optional workspace inventory sections beyond `BLOCKS`.
13
+ *
14
+ * Each descriptor centralizes append markers, exported interface/value repair
15
+ * sections, parser entry metadata such as `entriesKey` and `entryName`, and
16
+ * optional section flags so add, doctor, read, and mutation flows share one
17
+ * runtime contract when adding new inventory domains.
18
+ */
19
+ export declare const INVENTORY_SECTIONS: readonly InventorySectionDescriptor[];