@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
@@ -0,0 +1,145 @@
1
+ import { quotePhpString } from "./php-utils.js";
2
+ /**
3
+ * Build the `register_rest_route` calls for generated REST resource PHP files.
4
+ */
5
+ export function buildRestResourceRouteRegistrations(restResourceSlug, methods, functions, options) {
6
+ const collectionRoutes = [];
7
+ const itemRoutes = [];
8
+ const readPermissionCallback = options.permissionCallback
9
+ ? quotePhpString(options.permissionCallback)
10
+ : quotePhpString("__return_true");
11
+ const writePermissionCallback = options.permissionCallback
12
+ ? quotePhpString(options.permissionCallback)
13
+ : options.controllerVariableName
14
+ ? `array( ${options.controllerVariableName}, 'can_manage_rest_resource' )`
15
+ : quotePhpString(functions.canWriteFunctionName);
16
+ const buildRouteCallback = (functionName, methodName) => options.controllerVariableName
17
+ ? `array( ${options.controllerVariableName}, '${methodName}' )`
18
+ : quotePhpString(functionName);
19
+ if (methods.includes("list")) {
20
+ collectionRoutes.push(`\t\tarray(
21
+ \t\t\t'methods' => WP_REST_Server::READABLE,
22
+ \t\t\t'callback' => ${buildRouteCallback(functions.listHandlerName, "list_items")},
23
+ \t\t\t'permission_callback' => ${readPermissionCallback},
24
+ \t\t)`);
25
+ }
26
+ if (methods.includes("create")) {
27
+ collectionRoutes.push(`\t\tarray(
28
+ \t\t\t'methods' => WP_REST_Server::CREATABLE,
29
+ \t\t\t'callback' => ${buildRouteCallback(functions.createHandlerName, "create_item")},
30
+ \t\t\t'permission_callback' => ${writePermissionCallback},
31
+ \t\t)`);
32
+ }
33
+ if (methods.includes("read")) {
34
+ itemRoutes.push(`\t\tarray(
35
+ \t\t\t'methods' => WP_REST_Server::READABLE,
36
+ \t\t\t'callback' => ${buildRouteCallback(functions.readHandlerName, "read_item")},
37
+ \t\t\t'permission_callback' => ${readPermissionCallback},
38
+ \t\t)`);
39
+ }
40
+ if (methods.includes("update")) {
41
+ itemRoutes.push(`\t\tarray(
42
+ \t\t\t'methods' => WP_REST_Server::EDITABLE,
43
+ \t\t\t'callback' => ${buildRouteCallback(functions.updateHandlerName, "update_item")},
44
+ \t\t\t'permission_callback' => ${writePermissionCallback},
45
+ \t\t)`);
46
+ }
47
+ if (methods.includes("delete")) {
48
+ itemRoutes.push(`\t\tarray(
49
+ \t\t\t'methods' => WP_REST_Server::DELETABLE,
50
+ \t\t\t'callback' => ${buildRouteCallback(functions.deleteHandlerName, "delete_item")},
51
+ \t\t\t'permission_callback' => ${writePermissionCallback},
52
+ \t\t)`);
53
+ }
54
+ const registrations = [];
55
+ if (collectionRoutes.length > 0) {
56
+ registrations.push(`\tregister_rest_route(
57
+ \t\t$namespace,
58
+ \t\t'/${restResourceSlug}',
59
+ \t\tarray(
60
+ ${collectionRoutes.join(",\n")}
61
+ \t\t)
62
+ \t);`);
63
+ }
64
+ if (itemRoutes.length > 0) {
65
+ registrations.push(`\tregister_rest_route(
66
+ \t\t$namespace,
67
+ \t\t${quotePhpString(options.routePattern)},
68
+ \t\tarray(
69
+ ${itemRoutes.join(",\n")}
70
+ \t\t)
71
+ \t);`);
72
+ }
73
+ return registrations.join("\n\n");
74
+ }
75
+ function normalizeGlobalPhpClassName(classReference) {
76
+ const normalized = classReference.startsWith("\\")
77
+ ? classReference.slice(1)
78
+ : classReference;
79
+ return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(normalized) ? normalized : undefined;
80
+ }
81
+ /**
82
+ * Normalize a configured PHP class name into a global `::class` reference.
83
+ */
84
+ export function toPhpClassConstantReference(classReference) {
85
+ const normalized = classReference.startsWith("\\")
86
+ ? classReference
87
+ : `\\${classReference}`;
88
+ return `${normalized}::class`;
89
+ }
90
+ /**
91
+ * Build an optional controller shim class for generated REST resource handlers.
92
+ */
93
+ export function buildRestResourceControllerClassSource(options) {
94
+ const controllerClassName = normalizeGlobalPhpClassName(options.controllerClass);
95
+ if (!controllerClassName) {
96
+ return "";
97
+ }
98
+ const extendsClause = options.controllerExtends
99
+ ? ` extends ${options.controllerExtends.startsWith("\\") ? options.controllerExtends : `\\${options.controllerExtends}`}`
100
+ : "";
101
+ return `
102
+ if ( ! class_exists( ${quotePhpString(controllerClassName)} ) ) {
103
+ \tclass ${controllerClassName}${extendsClause} {
104
+ \t\tpublic function can_manage_rest_resource() {
105
+ \t\t\treturn ${options.functions.canWriteFunctionName}();
106
+ \t\t}
107
+
108
+ \t\tpublic function list_items( WP_REST_Request $request ) {
109
+ \t\t\treturn ${options.functions.listHandlerName}( $request );
110
+ \t\t}
111
+
112
+ \t\tpublic function read_item( WP_REST_Request $request ) {
113
+ \t\t\treturn ${options.functions.readHandlerName}( $request );
114
+ \t\t}
115
+
116
+ \t\tpublic function create_item( WP_REST_Request $request ) {
117
+ \t\t\treturn ${options.functions.createHandlerName}( $request );
118
+ \t\t}
119
+
120
+ \t\tpublic function update_item( WP_REST_Request $request ) {
121
+ \t\t\treturn ${options.functions.updateHandlerName}( $request );
122
+ \t\t}
123
+
124
+ \t\tpublic function delete_item( WP_REST_Request $request ) {
125
+ \t\t\treturn ${options.functions.deleteHandlerName}( $request );
126
+ \t\t}
127
+ \t}
128
+ }
129
+ `;
130
+ }
131
+ /**
132
+ * Build the controller instantiation block used inside REST route registration.
133
+ */
134
+ export function buildRestResourceControllerBootstrapSource(controllerClass) {
135
+ if (!controllerClass) {
136
+ return "";
137
+ }
138
+ return `\t\t$controller_class = ${toPhpClassConstantReference(controllerClass)};
139
+ \t\tif ( ! class_exists( $controller_class ) ) {
140
+ \t\t\treturn;
141
+ \t\t}
142
+ \t\t$controller = new $controller_class();
143
+
144
+ `;
145
+ }
@@ -0,0 +1,9 @@
1
+ import type { WorkspaceProject } from "./workspace-project.js";
2
+ /**
3
+ * Ensure sync-rest can repair and validate plugin-level REST resources.
4
+ *
5
+ * @param workspace Workspace project whose sync-rest script should be patched.
6
+ * @returns A promise that resolves after the sync-rest script is updated.
7
+ * @throws When the generated sync-rest anchors cannot be found.
8
+ */
9
+ export declare function ensureRestResourceSyncScriptAnchors(workspace: WorkspaceProject): Promise<void>;
@@ -0,0 +1,162 @@
1
+ import path from "node:path";
2
+ import { patchFile } from "./cli-add-shared.js";
3
+ import { buildNoResourcesGuard, replaceBlockConfigImport, replaceNoResourcesGuard, } from "./cli-add-workspace-rest-sync-script-shared.js";
4
+ function assertSyncRestAnchor(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath) {
5
+ if (!nextSource.includes(target) && !hasAnchor) {
6
+ throw new Error([
7
+ `ensureRestResourceSyncScriptAnchors could not patch ${path.basename(syncRestScriptPath)}.`,
8
+ `Missing expected ${anchorDescription} anchor in scripts/sync-rest-contracts.ts.`,
9
+ "Restore the generated template or add the REST_RESOURCES wiring manually before retrying.",
10
+ ].join(" "));
11
+ }
12
+ }
13
+ function replaceRequiredSyncRestSource(nextSource, target, anchor, replacement, anchorDescription, syncRestScriptPath) {
14
+ if (nextSource.includes(target)) {
15
+ return nextSource;
16
+ }
17
+ const hasAnchor = typeof anchor === "string" ? nextSource.includes(anchor) : anchor.test(nextSource);
18
+ assertSyncRestAnchor(nextSource, target, anchorDescription, hasAnchor, syncRestScriptPath);
19
+ return nextSource.replace(anchor, replacement);
20
+ }
21
+ function insertRestResourceNoResourcesGuard(nextSource, syncRestScriptPath) {
22
+ const hasStandaloneContracts = nextSource.includes("const standaloneContracts = CONTRACTS.filter( isWorkspaceStandaloneContract );");
23
+ const hasAiFeatures = nextSource.includes("const aiFeatures = AI_FEATURES.filter( isWorkspaceAiFeature );");
24
+ const hasPostMeta = nextSource.includes("const postMetaContracts = POST_META.filter( isWorkspacePostMetaContract );");
25
+ return replaceNoResourcesGuard(nextSource, buildNoResourcesGuard({
26
+ subjects: [
27
+ {
28
+ condition: "restBlocks.length === 0",
29
+ include: true,
30
+ subject: "REST-enabled workspace blocks",
31
+ },
32
+ {
33
+ condition: "standaloneContracts.length === 0",
34
+ include: hasStandaloneContracts,
35
+ subject: "standalone contracts",
36
+ },
37
+ {
38
+ condition: "postMetaContracts.length === 0",
39
+ include: hasPostMeta,
40
+ subject: "post meta contracts",
41
+ },
42
+ {
43
+ condition: "restResources.length === 0",
44
+ include: true,
45
+ subject: "plugin-level REST resources",
46
+ },
47
+ {
48
+ condition: "aiFeatures.length === 0",
49
+ include: hasAiFeatures,
50
+ subject: "AI features",
51
+ },
52
+ ],
53
+ }), "ensureRestResourceSyncScriptAnchors", syncRestScriptPath, "REST_RESOURCES");
54
+ }
55
+ /**
56
+ * Ensure sync-rest can repair and validate plugin-level REST resources.
57
+ *
58
+ * @param workspace Workspace project whose sync-rest script should be patched.
59
+ * @returns A promise that resolves after the sync-rest script is updated.
60
+ * @throws When the generated sync-rest anchors cannot be found.
61
+ */
62
+ export async function ensureRestResourceSyncScriptAnchors(workspace) {
63
+ const syncRestScriptPath = path.join(workspace.projectDir, "scripts", "sync-rest-contracts.ts");
64
+ await patchFile(syncRestScriptPath, (source) => {
65
+ let nextSource = replaceBlockConfigImport({
66
+ functionName: "ensureRestResourceSyncScriptAnchors",
67
+ nextSource: source,
68
+ subject: {
69
+ configTypeName: "WorkspaceRestResourceConfig",
70
+ constName: "REST_RESOURCES",
71
+ },
72
+ syncRestScriptPath,
73
+ });
74
+ const helperInsertionAnchor = "async function assertTypeArtifactsCurrent";
75
+ const restBlocksAnchor = "const restBlocks = BLOCKS.filter( isRestEnabledBlock );";
76
+ const consoleLogPattern = /\n\tconsole\.log\(\n\t\toptions\.check/u;
77
+ nextSource = replaceRequiredSyncRestSource(nextSource, "function isWorkspaceRestResource(", helperInsertionAnchor, [
78
+ "function isWorkspaceRestResource(",
79
+ "\tresource: WorkspaceRestResourceConfig",
80
+ "): resource is WorkspaceRestResourceConfig & {",
81
+ "\tclientFile: string;",
82
+ "\topenApiFile: string;",
83
+ "\trestManifest: NonNullable< WorkspaceRestResourceConfig[ 'restManifest' ] >;",
84
+ "\ttypesFile: string;",
85
+ "\tvalidatorsFile: string;",
86
+ "} {",
87
+ "\treturn (",
88
+ "\t\ttypeof resource.clientFile === 'string' &&",
89
+ "\t\ttypeof resource.openApiFile === 'string' &&",
90
+ "\t\ttypeof resource.typesFile === 'string' &&",
91
+ "\t\ttypeof resource.validatorsFile === 'string' &&",
92
+ "\t\ttypeof resource.restManifest === 'object' &&",
93
+ "\t\tresource.restManifest !== null",
94
+ "\t);",
95
+ "}",
96
+ "",
97
+ "async function assertTypeArtifactsCurrent",
98
+ ].join("\n"), "type artifact assertion helper", syncRestScriptPath);
99
+ nextSource = replaceRequiredSyncRestSource(nextSource, "const restResources = REST_RESOURCES.filter( isWorkspaceRestResource );", restBlocksAnchor, [
100
+ "const restBlocks = BLOCKS.filter( isRestEnabledBlock );",
101
+ "const restResources = REST_RESOURCES.filter( isWorkspaceRestResource );",
102
+ ].join("\n"), "restBlocks filter", syncRestScriptPath);
103
+ nextSource = insertRestResourceNoResourcesGuard(nextSource, syncRestScriptPath);
104
+ nextSource = replaceRequiredSyncRestSource(nextSource, "for ( const resource of restResources ) {", consoleLogPattern, [
105
+ "",
106
+ "\tfor ( const resource of restResources ) {",
107
+ "\t\tconst contracts = resource.restManifest.contracts;",
108
+ "",
109
+ "\t\tfor ( const [ baseName, contract ] of Object.entries( contracts ) ) {",
110
+ "\t\t\tawait syncTypeSchemas(",
111
+ "\t\t\t\t{",
112
+ "\t\t\t\t\tjsonSchemaFile: path.join(",
113
+ "\t\t\t\t\t\tpath.dirname( resource.typesFile ),",
114
+ "\t\t\t\t\t\t'api-schemas',",
115
+ "\t\t\t\t\t\t`${ baseName }.schema.json`",
116
+ "\t\t\t\t\t),",
117
+ "\t\t\t\t\topenApiFile: path.join(",
118
+ "\t\t\t\t\t\tpath.dirname( resource.typesFile ),",
119
+ "\t\t\t\t\t\t'api-schemas',",
120
+ "\t\t\t\t\t\t`${ baseName }.openapi.json`",
121
+ "\t\t\t\t\t),",
122
+ "\t\t\t\t\tsourceTypeName: contract.sourceTypeName,",
123
+ "\t\t\t\t\ttypesFile: resource.typesFile,",
124
+ "\t\t\t\t},",
125
+ "\t\t\t\t{",
126
+ "\t\t\t\t\tcheck: options.check,",
127
+ "\t\t\t\t}",
128
+ "\t\t\t);",
129
+ "\t\t}",
130
+ "",
131
+ "\t\tawait syncRestOpenApi(",
132
+ "\t\t\t{",
133
+ "\t\t\t\tmanifest: resource.restManifest,",
134
+ "\t\t\t\topenApiFile: resource.openApiFile,",
135
+ "\t\t\t\ttypesFile: resource.typesFile,",
136
+ "\t\t\t},",
137
+ "\t\t\t{",
138
+ "\t\t\t\tcheck: options.check,",
139
+ "\t\t\t}",
140
+ "\t\t);",
141
+ "",
142
+ "\t\tawait syncEndpointClient(",
143
+ "\t\t\t{",
144
+ "\t\t\t\tclientFile: resource.clientFile,",
145
+ "\t\t\t\tmanifest: resource.restManifest,",
146
+ "\t\t\t\ttypesFile: resource.typesFile,",
147
+ "\t\t\t\tvalidatorsFile: resource.validatorsFile,",
148
+ "\t\t\t},",
149
+ "\t\t\t{",
150
+ "\t\t\t\tcheck: options.check,",
151
+ "\t\t\t}",
152
+ "\t\t);",
153
+ "\t}",
154
+ "",
155
+ "\tconsole.log(",
156
+ "\t\toptions.check",
157
+ ].join("\n"), "success log insertion point", syncRestScriptPath);
158
+ nextSource = nextSource.replace("✅ REST contract schemas, portable API clients, and endpoint-aware OpenAPI documents are already up to date with the TypeScript types!", "✅ REST contract schemas, portable API clients, and endpoint-aware OpenAPI documents are already up to date for workspace blocks and plugin-level resources!");
159
+ nextSource = nextSource.replace("✅ REST contract schemas, portable API clients, and endpoint-aware OpenAPI documents generated from TypeScript types!", "✅ REST contract schemas, portable API clients, and endpoint-aware OpenAPI documents generated for workspace blocks and plugin-level resources!");
160
+ return nextSource;
161
+ });
162
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Build the shared PHP helper loaded by workspace bootstraps for generated REST schemas.
3
+ *
4
+ * @param phpPrefix Plugin-scoped PHP function prefix.
5
+ * @returns PHP source for `inc/rest-schema.php`.
6
+ */
7
+ export declare function buildWorkspaceRestSchemaHelperPhpSource(phpPrefix: string): string;
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Build the shared PHP helper loaded by workspace bootstraps for generated REST schemas.
3
+ *
4
+ * @param phpPrefix Plugin-scoped PHP function prefix.
5
+ * @returns PHP source for `inc/rest-schema.php`.
6
+ */
7
+ export function buildWorkspaceRestSchemaHelperPhpSource(phpPrefix) {
8
+ return `<?php
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ \treturn;
11
+ }
12
+
13
+ if ( ! function_exists( '${phpPrefix}_is_valid_rest_schema_key' ) ) {
14
+ \tfunction ${phpPrefix}_is_valid_rest_schema_key( $value ) {
15
+ \t\treturn is_string( $value ) && 1 === preg_match( '/\\A[A-Za-z0-9_-]+\\z/', $value );
16
+ \t}
17
+ }
18
+
19
+ if ( ! function_exists( '${phpPrefix}_is_valid_rest_resource_slug' ) ) {
20
+ \tfunction ${phpPrefix}_is_valid_rest_resource_slug( $value ) {
21
+ \t\treturn is_string( $value ) && 1 === preg_match( '/\\A[a-z0-9]+(?:-[a-z0-9]+)*\\z/', $value );
22
+ \t}
23
+ }
24
+
25
+ if ( ! function_exists( '${phpPrefix}_resolve_rest_schema_paths' ) ) {
26
+ \tfunction ${phpPrefix}_resolve_rest_schema_paths( $schema_name, $options = array() ) {
27
+ \t\tif ( ! ${phpPrefix}_is_valid_rest_schema_key( $schema_name ) ) {
28
+ \t\t\treturn new WP_Error(
29
+ \t\t\t\t'invalid_rest_schema_name',
30
+ \t\t\t\t'Invalid REST schema name.',
31
+ \t\t\t\tarray( 'status' => 500 )
32
+ \t\t\t);
33
+ \t\t}
34
+
35
+ \t\t$options = is_array( $options ) ? $options : array();
36
+ \t\t$project_root = dirname( __DIR__ );
37
+ \t\t$paths = array();
38
+
39
+ \t\tif ( isset( $options['resource'] ) && '' !== $options['resource'] ) {
40
+ \t\t\tif ( ! ${phpPrefix}_is_valid_rest_resource_slug( $options['resource'] ) ) {
41
+ \t\t\t\treturn new WP_Error(
42
+ \t\t\t\t\t'invalid_rest_schema_resource',
43
+ \t\t\t\t\t'Invalid REST schema resource slug.',
44
+ \t\t\t\t\tarray( 'status' => 500 )
45
+ \t\t\t\t);
46
+ \t\t\t}
47
+
48
+ \t\t\t$resource_slug = $options['resource'];
49
+ \t\t\t$paths[] = __DIR__ . '/rest-schemas/rest/' . $resource_slug . '/' . $schema_name . '.schema.json';
50
+ \t\t\t$paths[] = $project_root . '/src/rest/' . $resource_slug . '/api-schemas/' . $schema_name . '.schema.json';
51
+ \t\t}
52
+
53
+ \t\tif ( isset( $options['paths'] ) && is_array( $options['paths'] ) ) {
54
+ \t\t\tforeach ( $options['paths'] as $schema_path ) {
55
+ \t\t\t\tif ( is_string( $schema_path ) && '' !== $schema_path && ! in_array( $schema_path, $paths, true ) ) {
56
+ \t\t\t\t\t$paths[] = $schema_path;
57
+ \t\t\t\t}
58
+ \t\t\t}
59
+ \t\t}
60
+
61
+ \t\treturn $paths;
62
+ \t}
63
+ }
64
+
65
+ if ( ! function_exists( '${phpPrefix}_load_rest_schema' ) ) {
66
+ \tfunction ${phpPrefix}_load_rest_schema( $schema_name, $options = array() ) {
67
+ \t\t$schema_paths = ${phpPrefix}_resolve_rest_schema_paths( $schema_name, $options );
68
+ \t\tif ( is_wp_error( $schema_paths ) ) {
69
+ \t\t\treturn $schema_paths;
70
+ \t\t}
71
+
72
+ \t\tforeach ( $schema_paths as $schema_path ) {
73
+ \t\t\tif ( ! is_file( $schema_path ) ) {
74
+ \t\t\t\tcontinue;
75
+ \t\t\t}
76
+
77
+ \t\t\tif ( ! is_readable( $schema_path ) ) {
78
+ \t\t\t\treturn new WP_Error(
79
+ \t\t\t\t\t'unreadable_rest_schema',
80
+ \t\t\t\t\t'Generated REST schema is not readable.',
81
+ \t\t\t\t\tarray(
82
+ \t\t\t\t\t\t'path' => $schema_path,
83
+ \t\t\t\t\t\t'status' => 500,
84
+ \t\t\t\t\t)
85
+ \t\t\t\t);
86
+ \t\t\t}
87
+
88
+ \t\t\t$schema_json = file_get_contents( $schema_path );
89
+ \t\t\tif ( false === $schema_json ) {
90
+ \t\t\t\treturn new WP_Error(
91
+ \t\t\t\t\t'rest_schema_read_failed',
92
+ \t\t\t\t\t'Generated REST schema could not be read.',
93
+ \t\t\t\t\tarray(
94
+ \t\t\t\t\t\t'path' => $schema_path,
95
+ \t\t\t\t\t\t'status' => 500,
96
+ \t\t\t\t\t)
97
+ \t\t\t\t);
98
+ \t\t\t}
99
+
100
+ \t\t\t$decoded = json_decode( $schema_json, true );
101
+ \t\t\tif ( ! is_array( $decoded ) ) {
102
+ \t\t\t\treturn new WP_Error(
103
+ \t\t\t\t\t'malformed_rest_schema',
104
+ \t\t\t\t\t'Generated REST schema contains malformed JSON.',
105
+ \t\t\t\t\tarray(
106
+ \t\t\t\t\t\t'json_error' => json_last_error_msg(),
107
+ \t\t\t\t\t\t'path' => $schema_path,
108
+ \t\t\t\t\t\t'status' => 500,
109
+ \t\t\t\t\t)
110
+ \t\t\t\t);
111
+ \t\t\t}
112
+
113
+ \t\t\treturn $decoded;
114
+ \t\t}
115
+
116
+ \t\treturn new WP_Error(
117
+ \t\t\t'missing_rest_schema',
118
+ \t\t\t'Generated REST schema could not be found.',
119
+ \t\t\tarray(
120
+ \t\t\t\t'paths' => $schema_paths,
121
+ \t\t\t\t'schema' => $schema_name,
122
+ \t\t\t\t'status' => 500,
123
+ \t\t\t)
124
+ \t\t);
125
+ \t}
126
+ }
127
+
128
+ if ( ! function_exists( '${phpPrefix}_prepare_rest_schema_for_wordpress' ) ) {
129
+ \tfunction ${phpPrefix}_prepare_rest_schema_for_wordpress( $schema ) {
130
+ \t\tif ( ! is_array( $schema ) ) {
131
+ \t\t\treturn $schema;
132
+ \t\t}
133
+
134
+ \t\tunset( $schema['$schema'], $schema['title'] );
135
+
136
+ \t\tforeach ( array( 'properties', 'patternProperties', 'definitions', '$defs' ) as $schema_map_key ) {
137
+ \t\t\tif ( ! isset( $schema[ $schema_map_key ] ) || ! is_array( $schema[ $schema_map_key ] ) ) {
138
+ \t\t\t\tcontinue;
139
+ \t\t\t}
140
+
141
+ \t\t\tforeach ( $schema[ $schema_map_key ] as $key => $property_schema ) {
142
+ \t\t\t\t$schema[ $schema_map_key ][ $key ] = ${phpPrefix}_prepare_rest_schema_for_wordpress( $property_schema );
143
+ \t\t\t}
144
+ \t\t}
145
+
146
+ \t\tforeach ( array( 'items', 'additionalProperties', 'contains', 'propertyNames', 'not', 'if', 'then', 'else' ) as $nested_schema_key ) {
147
+ \t\t\tif ( isset( $schema[ $nested_schema_key ] ) && is_array( $schema[ $nested_schema_key ] ) ) {
148
+ \t\t\t\t$schema[ $nested_schema_key ] = ${phpPrefix}_prepare_rest_schema_for_wordpress( $schema[ $nested_schema_key ] );
149
+ \t\t\t}
150
+ \t\t}
151
+
152
+ \t\tforeach ( array( 'allOf', 'anyOf', 'oneOf' ) as $schema_list_key ) {
153
+ \t\t\tif ( ! isset( $schema[ $schema_list_key ] ) || ! is_array( $schema[ $schema_list_key ] ) ) {
154
+ \t\t\t\tcontinue;
155
+ \t\t\t}
156
+
157
+ \t\t\tforeach ( $schema[ $schema_list_key ] as $index => $variant_schema ) {
158
+ \t\t\t\t$schema[ $schema_list_key ][ $index ] = ${phpPrefix}_prepare_rest_schema_for_wordpress( $variant_schema );
159
+ \t\t\t}
160
+ \t\t}
161
+
162
+ \t\treturn $schema;
163
+ \t}
164
+ }
165
+
166
+ if ( ! function_exists( '${phpPrefix}_get_wordpress_rest_schema' ) ) {
167
+ \tfunction ${phpPrefix}_get_wordpress_rest_schema( $schema_name, $options = array() ) {
168
+ \t\t$schema = ${phpPrefix}_load_rest_schema( $schema_name, $options );
169
+ \t\tif ( is_wp_error( $schema ) ) {
170
+ \t\t\treturn $schema;
171
+ \t\t}
172
+
173
+ \t\treturn ${phpPrefix}_prepare_rest_schema_for_wordpress( $schema );
174
+ \t}
175
+ }
176
+
177
+ if ( ! function_exists( '${phpPrefix}_validate_and_sanitize_rest_payload' ) ) {
178
+ \tfunction ${phpPrefix}_validate_and_sanitize_rest_payload( $value, $schema_name, $param_name, $options = array() ) {
179
+ \t\t$rest_schema = ${phpPrefix}_get_wordpress_rest_schema( $schema_name, $options );
180
+ \t\tif ( is_wp_error( $rest_schema ) ) {
181
+ \t\t\treturn $rest_schema;
182
+ \t\t}
183
+
184
+ \t\t$validation = rest_validate_value_from_schema( $value, $rest_schema, $param_name );
185
+ \t\tif ( is_wp_error( $validation ) ) {
186
+ \t\t\treturn $validation;
187
+ \t\t}
188
+
189
+ \t\treturn rest_sanitize_value_from_schema( $value, $rest_schema, $param_name );
190
+ \t}
191
+ }
192
+ `;
193
+ }
@@ -1,94 +1,8 @@
1
- import { type ManualRestContractAuthId, type ManualRestContractHttpMethodId, type RestResourceMethodId } from "./cli-add-shared.js";
2
1
  /**
3
- * Build a generated REST resource config entry for `scripts/block-config.ts`.
2
+ * Compatibility facade for REST workspace source emitters.
4
3
  *
5
- * @param options REST resource metadata. `restResourceSlug`, `namespace`, and
6
- * `methods` are required; `controllerClass`, `controllerExtends`,
7
- * `permissionCallback`, and `routePattern` opt into generated controller,
8
- * permission, and item-route escape hatches.
9
- * @returns TypeScript object literal source for one generated REST resource entry.
4
+ * Keep the public runtime import path stable while generated-resource and
5
+ * manual-contract emitters live in focused modules.
10
6
  */
11
- export declare function buildRestResourceConfigEntry(options: {
12
- controllerClass?: string;
13
- controllerExtends?: string;
14
- methods: RestResourceMethodId[];
15
- namespace: string;
16
- permissionCallback?: string;
17
- restResourceSlug: string;
18
- routePattern?: string;
19
- }): string;
20
- /**
21
- * Build the `REST_RESOURCES` config entry appended for a manual REST contract.
22
- *
23
- * @param options Manual contract file, route, type, and auth metadata.
24
- * @param options.auth Auth intent stored in the endpoint manifest.
25
- * @param options.bodyTypeName Optional exported body type name.
26
- * @param options.method Uppercase HTTP method for the external route.
27
- * @param options.namespace REST namespace such as `vendor/v1`.
28
- * @param options.pathPattern Route pattern relative to the namespace.
29
- * @param options.queryTypeName Exported query type name.
30
- * @param options.responseTypeName Exported response type name.
31
- * @param options.restResourceSlug Normalized workspace REST contract slug.
32
- * @returns A TypeScript object literal string for `scripts/block-config.ts`.
33
- */
34
- export declare function buildManualRestContractConfigEntry(options: {
35
- auth: ManualRestContractAuthId;
36
- bodyTypeName?: string;
37
- method: ManualRestContractHttpMethodId;
38
- namespace: string;
39
- pathPattern: string;
40
- queryTypeName: string;
41
- responseTypeName: string;
42
- restResourceSlug: string;
43
- secretFieldName?: string;
44
- secretStateFieldName?: string;
45
- }): string;
46
- /**
47
- * Build the editable TypeScript type source for a manual REST contract.
48
- *
49
- * @param options Manual contract type naming metadata.
50
- * @param options.bodyTypeName Optional exported body type name.
51
- * @param options.queryTypeName Exported query type name.
52
- * @param options.responseTypeName Exported response type name.
53
- * @param options.restResourceSlug Normalized workspace REST contract slug.
54
- * @param options.secretFieldName Optional raw secret field included only in the request body.
55
- * @param options.secretStateFieldName Optional masked response boolean field.
56
- * @returns TypeScript source for `api-types.ts`.
57
- */
58
- export declare function buildManualRestContractTypesSource(options: {
59
- bodyTypeName?: string;
60
- queryTypeName: string;
61
- responseTypeName: string;
62
- restResourceSlug: string;
63
- secretFieldName?: string;
64
- secretStateFieldName?: string;
65
- }): string;
66
- /**
67
- * Build Typia validator source for a manual REST contract.
68
- *
69
- * @param options Manual contract type names to validate.
70
- * @param options.bodyTypeName Optional exported body type name.
71
- * @param options.queryTypeName Exported query type name.
72
- * @param options.responseTypeName Exported response type name.
73
- * @returns TypeScript source for `api-validators.ts`.
74
- */
75
- export declare function buildManualRestContractValidatorsSource(options: {
76
- bodyTypeName?: string;
77
- queryTypeName: string;
78
- responseTypeName: string;
79
- }): string;
80
- /**
81
- * Build the public API shim for a manual REST contract.
82
- *
83
- * @param options Manual REST contract operation and request type metadata.
84
- * @returns TypeScript source that re-exports the generated endpoint client.
85
- */
86
- export declare function buildManualRestContractApiSource(options: {
87
- bodyTypeName?: string;
88
- queryTypeName: string;
89
- restResourceSlug: string;
90
- }): string;
91
- export declare function buildRestResourceTypesSource(restResourceSlug: string, methods: RestResourceMethodId[]): string;
92
- export declare function buildRestResourceValidatorsSource(restResourceSlug: string, methods: RestResourceMethodId[]): string;
93
- export declare function buildRestResourceApiSource(restResourceSlug: string, methods: RestResourceMethodId[]): string;
94
- export declare function buildRestResourceDataSource(restResourceSlug: string, methods: RestResourceMethodId[]): string;
7
+ export { buildRestResourceApiSource, buildRestResourceConfigEntry, buildRestResourceDataSource, buildRestResourceTypesSource, buildRestResourceValidatorsSource, } from "./cli-add-workspace-rest-generated-source-emitters.js";
8
+ export { buildManualRestContractApiSource, buildManualRestContractConfigEntry, buildManualRestContractTypesSource, buildManualRestContractValidatorsSource, } from "./cli-add-workspace-rest-manual-source-emitters.js";