@wp-typia/project-tools 0.22.10 → 0.23.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.
- package/dist/runtime/cli-add-collision.d.ts +25 -0
- package/dist/runtime/cli-add-collision.js +76 -0
- package/dist/runtime/cli-add-help.js +11 -2
- package/dist/runtime/cli-add-kind-ids.d.ts +1 -1
- package/dist/runtime/cli-add-kind-ids.js +3 -0
- package/dist/runtime/cli-add-types.d.ts +117 -0
- package/dist/runtime/cli-add-types.js +26 -0
- package/dist/runtime/cli-add-validation.d.ts +90 -1
- package/dist/runtime/cli-add-validation.js +304 -1
- package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +74 -19
- package/dist/runtime/cli-add-workspace-admin-view-source.js +11 -2
- package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +20 -2
- package/dist/runtime/cli-add-workspace-admin-view-templates.js +359 -3
- package/dist/runtime/cli-add-workspace-admin-view-types.d.ts +21 -0
- package/dist/runtime/cli-add-workspace-admin-view-types.js +22 -0
- package/dist/runtime/cli-add-workspace-ai-anchors.js +121 -31
- package/dist/runtime/cli-add-workspace-contract-source-emitters.d.ts +15 -0
- package/dist/runtime/cli-add-workspace-contract-source-emitters.js +42 -0
- package/dist/runtime/cli-add-workspace-contract.d.ts +15 -0
- package/dist/runtime/cli-add-workspace-contract.js +65 -0
- package/dist/runtime/cli-add-workspace-integration-env.d.ts +24 -0
- package/dist/runtime/cli-add-workspace-integration-env.js +391 -0
- package/dist/runtime/cli-add-workspace-post-meta-anchors.d.ts +23 -0
- package/dist/runtime/cli-add-workspace-post-meta-anchors.js +244 -0
- package/dist/runtime/cli-add-workspace-post-meta-source-emitters.d.ts +63 -0
- package/dist/runtime/cli-add-workspace-post-meta-source-emitters.js +179 -0
- package/dist/runtime/cli-add-workspace-post-meta.d.ts +15 -0
- package/dist/runtime/cli-add-workspace-post-meta.js +107 -0
- package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +1 -0
- package/dist/runtime/cli-add-workspace-rest-anchors.js +285 -21
- package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +90 -2
- package/dist/runtime/cli-add-workspace-rest-source-emitters.js +302 -29
- package/dist/runtime/cli-add-workspace-rest.d.ts +15 -2
- package/dist/runtime/cli-add-workspace-rest.js +329 -21
- package/dist/runtime/cli-add-workspace.d.ts +15 -0
- package/dist/runtime/cli-add-workspace.js +15 -0
- package/dist/runtime/cli-add.d.ts +1 -1
- package/dist/runtime/cli-add.js +1 -1
- package/dist/runtime/cli-core.d.ts +2 -1
- package/dist/runtime/cli-core.js +2 -1
- package/dist/runtime/cli-doctor-environment.js +1 -3
- package/dist/runtime/cli-doctor-workspace-features.js +128 -10
- package/dist/runtime/cli-doctor-workspace-package.d.ts +25 -3
- package/dist/runtime/cli-doctor-workspace-package.js +35 -13
- package/dist/runtime/cli-doctor-workspace-shared.d.ts +2 -0
- package/dist/runtime/cli-doctor-workspace-shared.js +2 -0
- package/dist/runtime/cli-doctor-workspace.js +8 -3
- package/dist/runtime/cli-help.js +7 -0
- package/dist/runtime/cli-init-templates.js +11 -1
- package/dist/runtime/contract-artifacts.d.ts +14 -0
- package/dist/runtime/contract-artifacts.js +15 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/rest-resource-artifacts.d.ts +57 -1
- package/dist/runtime/rest-resource-artifacts.js +97 -1
- package/dist/runtime/template-render.d.ts +1 -1
- package/dist/runtime/template-render.js +1 -1
- package/dist/runtime/template-source-cache-markers.d.ts +37 -0
- package/dist/runtime/template-source-cache-markers.js +125 -0
- package/dist/runtime/template-source-cache.d.ts +1 -4
- package/dist/runtime/template-source-cache.js +16 -122
- package/dist/runtime/template-source-external.d.ts +4 -2
- package/dist/runtime/template-source-external.js +4 -2
- package/dist/runtime/template-source-remote.d.ts +8 -4
- package/dist/runtime/template-source-remote.js +8 -4
- package/dist/runtime/workspace-inventory-mutations.js +52 -3
- package/dist/runtime/workspace-inventory-parser.d.ts +3 -2
- package/dist/runtime/workspace-inventory-parser.js +126 -5
- package/dist/runtime/workspace-inventory-read.d.ts +9 -2
- package/dist/runtime/workspace-inventory-read.js +9 -2
- package/dist/runtime/workspace-inventory-templates.d.ts +16 -1
- package/dist/runtime/workspace-inventory-templates.js +74 -4
- package/dist/runtime/workspace-inventory-types.d.ts +51 -2
- package/dist/runtime/workspace-inventory.d.ts +2 -2
- package/dist/runtime/workspace-inventory.js +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ function ensureWorkspaceInventorySections(source) {
|
|
|
7
7
|
let nextSource = source.trimEnd();
|
|
8
8
|
for (const section of INVENTORY_SECTIONS) {
|
|
9
9
|
if (section.interface &&
|
|
10
|
-
!
|
|
10
|
+
!hasExportedTypeDeclaration(nextSource, section.interface.name)) {
|
|
11
11
|
nextSource += section.interface.section;
|
|
12
12
|
}
|
|
13
13
|
if (section.value && !hasExportedConst(nextSource, section.value.name)) {
|
|
@@ -16,8 +16,8 @@ function ensureWorkspaceInventorySections(source) {
|
|
|
16
16
|
}
|
|
17
17
|
return `${nextSource}\n`;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return new RegExp(`export\\s+interface\\s+${escapeRegex(interfaceName)}\\b`, "u").test(source);
|
|
19
|
+
function hasExportedTypeDeclaration(source, interfaceName) {
|
|
20
|
+
return new RegExp(`export\\s+(?:interface|type)\\s+${escapeRegex(interfaceName)}\\b`, "u").test(source);
|
|
21
21
|
}
|
|
22
22
|
function hasExportedConst(source, constName) {
|
|
23
23
|
return new RegExp(`export\\s+const\\s+${escapeRegex(constName)}\\b`, "u").test(source);
|
|
@@ -67,6 +67,36 @@ function ensureInterfaceField(source, interfaceName, fieldName, fieldSource) {
|
|
|
67
67
|
return `${start}${body}${body.length > 0 && !body.endsWith(lineEnding) ? lineEnding : ""}${formattedFieldSource}${end}`;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
function upsertInterfaceField(source, interfaceName, fieldName, fieldSource) {
|
|
71
|
+
const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
|
|
72
|
+
return source.replace(interfacePattern, (match, start, body, end) => {
|
|
73
|
+
const lineEnding = start.endsWith("\r\n") ? "\r\n" : "\n";
|
|
74
|
+
const formattedFieldSource = `${fieldSource
|
|
75
|
+
.replace(/\r?\n$/u, "")
|
|
76
|
+
.split("\n")
|
|
77
|
+
.join(lineEnding)}${lineEnding}`;
|
|
78
|
+
const existingFieldPattern = new RegExp(`(^[ \\t]*${escapeRegex(fieldName)}\\??:\\s*[^;\\r\\n]+;?\\r?\\n?)`, "mu");
|
|
79
|
+
const existingFieldMatch = existingFieldPattern.exec(body);
|
|
80
|
+
if (existingFieldMatch?.[0]) {
|
|
81
|
+
if (existingFieldMatch[0].trim() === fieldSource.trim()) {
|
|
82
|
+
return match;
|
|
83
|
+
}
|
|
84
|
+
return `${start}${body.slice(0, existingFieldMatch.index)}${formattedFieldSource}${body.slice(existingFieldMatch.index + existingFieldMatch[0].length)}${end}`;
|
|
85
|
+
}
|
|
86
|
+
const memberPattern = /^[ \t]*([A-Za-z_$][\w$]*)\??:/gmu;
|
|
87
|
+
for (const member of body.matchAll(memberPattern)) {
|
|
88
|
+
const memberIndex = member.index;
|
|
89
|
+
const memberName = member[1];
|
|
90
|
+
if (memberIndex === undefined || !memberName) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (memberName.localeCompare(fieldName) > 0) {
|
|
94
|
+
return `${start}${body.slice(0, memberIndex)}${formattedFieldSource}${body.slice(memberIndex)}${end}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return `${start}${body}${body.length > 0 && !body.endsWith(lineEnding) ? lineEnding : ""}${formattedFieldSource}${end}`;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
70
100
|
function normalizeInterfaceFieldBlock(source, interfaceName, fieldName, fieldSource, requiredFragments) {
|
|
71
101
|
const interfacePattern = new RegExp(`(export\\s+interface\\s+${escapeRegex(interfaceName)}\\s*\\{\\r?\\n)([\\s\\S]*?)(\\r?\\n\\})`, "u");
|
|
72
102
|
return source.replace(interfacePattern, (match, start, body, end) => {
|
|
@@ -112,6 +142,25 @@ export function updateWorkspaceInventorySource(source, options = {}) {
|
|
|
112
142
|
nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAbilityConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
|
|
113
143
|
nextSource = ensureInterfaceField(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD);
|
|
114
144
|
nextSource = normalizeInterfaceFieldBlock(nextSource, "WorkspaceAiFeatureConfig", "compatibility", WORKSPACE_COMPATIBILITY_CONFIG_FIELD, ["optionalFeatureIds: string[];", "requiredFeatureIds: string[];"]);
|
|
145
|
+
for (const [fieldName, fieldSource] of [
|
|
146
|
+
["auth", "\tauth?: 'authenticated' | 'public' | 'public-write-protected';"],
|
|
147
|
+
["bodyTypeName", "\tbodyTypeName?: string;"],
|
|
148
|
+
["controllerClass", "\tcontrollerClass?: string;"],
|
|
149
|
+
["controllerExtends", "\tcontrollerExtends?: string;"],
|
|
150
|
+
["dataFile", "\tdataFile?: string;"],
|
|
151
|
+
["method", "\tmethod?: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';"],
|
|
152
|
+
["mode", "\tmode?: 'generated' | 'manual';"],
|
|
153
|
+
["pathPattern", "\tpathPattern?: string;"],
|
|
154
|
+
["permissionCallback", "\tpermissionCallback?: string;"],
|
|
155
|
+
["phpFile", "\tphpFile?: string;"],
|
|
156
|
+
["queryTypeName", "\tqueryTypeName?: string;"],
|
|
157
|
+
["responseTypeName", "\tresponseTypeName?: string;"],
|
|
158
|
+
["routePattern", "\troutePattern?: string;"],
|
|
159
|
+
["secretFieldName", "\tsecretFieldName?: string;"],
|
|
160
|
+
["secretStateFieldName", "\tsecretStateFieldName?: string;"],
|
|
161
|
+
]) {
|
|
162
|
+
nextSource = upsertInterfaceField(nextSource, "WorkspaceRestResourceConfig", fieldName, fieldSource);
|
|
163
|
+
}
|
|
115
164
|
return nextSource;
|
|
116
165
|
}
|
|
117
166
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WorkspaceInventory, WorkspaceInventoryAppendOptionKey, WorkspaceInventoryEntriesKey, WorkspaceInventorySectionFlagKey } from "./workspace-inventory-types.js";
|
|
2
|
+
type InventoryEntryFieldValue = string | string[] | boolean | undefined;
|
|
2
3
|
type InventoryEntryFieldValidationContext = {
|
|
3
4
|
elementIndex: number;
|
|
4
5
|
entryName: string;
|
|
@@ -6,9 +7,9 @@ type InventoryEntryFieldValidationContext = {
|
|
|
6
7
|
};
|
|
7
8
|
type InventoryEntryFieldDescriptor = {
|
|
8
9
|
key: string;
|
|
9
|
-
kind?: "string" | "stringArray";
|
|
10
|
+
kind?: "boolean" | "string" | "stringArray";
|
|
10
11
|
required?: boolean;
|
|
11
|
-
validate?: (value:
|
|
12
|
+
validate?: (value: InventoryEntryFieldValue, context: InventoryEntryFieldValidationContext) => void;
|
|
12
13
|
};
|
|
13
14
|
type InventoryEntryParserDescriptor = {
|
|
14
15
|
entryName: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { REST_RESOURCE_METHOD_IDS } from "./cli-add-shared.js";
|
|
2
|
+
import { MANUAL_REST_CONTRACT_AUTH_IDS, MANUAL_REST_CONTRACT_HTTP_METHOD_IDS, REST_RESOURCE_METHOD_IDS, } from "./cli-add-shared.js";
|
|
3
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, 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, 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";
|
|
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
5
|
function defineInventoryEntryParser() {
|
|
6
6
|
return (descriptor) => descriptor;
|
|
7
7
|
}
|
|
@@ -160,6 +160,33 @@ export const INVENTORY_SECTIONS = [
|
|
|
160
160
|
section: BINDING_SOURCES_CONST_SECTION,
|
|
161
161
|
},
|
|
162
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
|
+
},
|
|
163
190
|
{
|
|
164
191
|
append: {
|
|
165
192
|
marker: REST_RESOURCE_CONFIG_ENTRY_MARKER,
|
|
@@ -175,8 +202,29 @@ export const INVENTORY_SECTIONS = [
|
|
|
175
202
|
entryName: "REST_RESOURCES",
|
|
176
203
|
fields: [
|
|
177
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" },
|
|
178
215
|
{ key: "clientFile", required: true },
|
|
179
|
-
{ key: "
|
|
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
|
+
},
|
|
180
228
|
{
|
|
181
229
|
key: "methods",
|
|
182
230
|
kind: "stringArray",
|
|
@@ -189,9 +237,26 @@ export const INVENTORY_SECTIONS = [
|
|
|
189
237
|
}
|
|
190
238
|
},
|
|
191
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
|
+
},
|
|
192
250
|
{ key: "namespace", required: true },
|
|
193
251
|
{ key: "openApiFile", required: true },
|
|
194
|
-
{ key: "
|
|
252
|
+
{ key: "pathPattern" },
|
|
253
|
+
{ key: "permissionCallback" },
|
|
254
|
+
{ key: "phpFile" },
|
|
255
|
+
{ key: "queryTypeName" },
|
|
256
|
+
{ key: "responseTypeName" },
|
|
257
|
+
{ key: "routePattern" },
|
|
258
|
+
{ key: "secretFieldName" },
|
|
259
|
+
{ key: "secretStateFieldName" },
|
|
195
260
|
{ key: "slug", required: true },
|
|
196
261
|
{ key: "typesFile", required: true },
|
|
197
262
|
{ key: "validatorsFile", required: true },
|
|
@@ -204,6 +269,37 @@ export const INVENTORY_SECTIONS = [
|
|
|
204
269
|
section: REST_RESOURCES_CONST_SECTION,
|
|
205
270
|
},
|
|
206
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
|
+
},
|
|
207
303
|
{
|
|
208
304
|
append: {
|
|
209
305
|
marker: ABILITY_CONFIG_ENTRY_MARKER,
|
|
@@ -392,6 +488,25 @@ function getOptionalStringArrayProperty(entryName, elementIndex, objectLiteral,
|
|
|
392
488
|
}
|
|
393
489
|
return undefined;
|
|
394
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
|
+
}
|
|
395
510
|
function isMissingRequiredInventoryValue(value) {
|
|
396
511
|
return (value === undefined || (typeof value === "string" && value.length === 0));
|
|
397
512
|
}
|
|
@@ -419,7 +534,9 @@ function parseInventoryEntries(arrayLiteral, descriptor) {
|
|
|
419
534
|
const kind = field.kind ?? "string";
|
|
420
535
|
const value = kind === "stringArray"
|
|
421
536
|
? getOptionalStringArrayProperty(descriptor.entryName, elementIndex, element, field.key)
|
|
422
|
-
:
|
|
537
|
+
: kind === "boolean"
|
|
538
|
+
? getOptionalBooleanProperty(descriptor.entryName, elementIndex, element, field.key)
|
|
539
|
+
: getOptionalStringProperty(descriptor.entryName, elementIndex, element, field.key);
|
|
423
540
|
field.validate?.(value, {
|
|
424
541
|
elementIndex,
|
|
425
542
|
entryName: descriptor.entryName,
|
|
@@ -480,6 +597,7 @@ export function parseWorkspaceInventorySource(source) {
|
|
|
480
597
|
blockStyles: [],
|
|
481
598
|
blockTransforms: [],
|
|
482
599
|
blocks: parseInventorySection(sourceFile, BLOCK_INVENTORY_SECTION).entries,
|
|
600
|
+
contracts: [],
|
|
483
601
|
editorPlugins: [],
|
|
484
602
|
hasAbilitiesSection: false,
|
|
485
603
|
hasAdminViewsSection: false,
|
|
@@ -487,11 +605,14 @@ export function parseWorkspaceInventorySource(source) {
|
|
|
487
605
|
hasBindingSourcesSection: false,
|
|
488
606
|
hasBlockStylesSection: false,
|
|
489
607
|
hasBlockTransformsSection: false,
|
|
608
|
+
hasContractsSection: false,
|
|
490
609
|
hasEditorPluginsSection: false,
|
|
491
610
|
hasPatternsSection: false,
|
|
611
|
+
hasPostMetaSection: false,
|
|
492
612
|
hasRestResourcesSection: false,
|
|
493
613
|
hasVariationsSection: false,
|
|
494
614
|
patterns: [],
|
|
615
|
+
postMeta: [],
|
|
495
616
|
restResources: [],
|
|
496
617
|
source,
|
|
497
618
|
variations: [],
|
|
@@ -6,6 +6,11 @@ import type { WorkspaceBlockSelectOption, WorkspaceInventory } from "./workspace
|
|
|
6
6
|
* synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
|
|
7
7
|
* paths so workspace reads do not block the event loop.
|
|
8
8
|
*
|
|
9
|
+
* @deprecated Since 0.22.10. Use `readWorkspaceInventoryAsync()` from async
|
|
10
|
+
* command paths. Removal target: not currently scheduled; this sync
|
|
11
|
+
* compatibility helper remains available until release notes announce a
|
|
12
|
+
* versioned target.
|
|
13
|
+
*
|
|
9
14
|
* @param projectDir Workspace root directory.
|
|
10
15
|
* @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
|
|
11
16
|
* @throws {Error} When `scripts/block-config.ts` is missing or invalid.
|
|
@@ -25,8 +30,10 @@ export declare function readWorkspaceInventoryAsync(projectDir: string): Promise
|
|
|
25
30
|
* The `description` field mirrors `block.typesFile`, while `name` and `value`
|
|
26
31
|
* both map to the block slug for use in interactive add flows.
|
|
27
32
|
*
|
|
28
|
-
* @deprecated Use `getWorkspaceBlockSelectOptionsAsync()` from
|
|
29
|
-
* paths.
|
|
33
|
+
* @deprecated Since 0.22.10. Use `getWorkspaceBlockSelectOptionsAsync()` from
|
|
34
|
+
* async command paths. Removal target: not currently scheduled; this sync
|
|
35
|
+
* compatibility helper remains available until release notes announce a
|
|
36
|
+
* versioned target.
|
|
30
37
|
*
|
|
31
38
|
* @param projectDir Workspace root directory.
|
|
32
39
|
* @returns Block options for variation-target selection.
|
|
@@ -10,6 +10,11 @@ import { parseWorkspaceInventorySource } from "./workspace-inventory-parser.js";
|
|
|
10
10
|
* synchronous APIs. Prefer `readWorkspaceInventoryAsync()` from async command
|
|
11
11
|
* paths so workspace reads do not block the event loop.
|
|
12
12
|
*
|
|
13
|
+
* @deprecated Since 0.22.10. Use `readWorkspaceInventoryAsync()` from async
|
|
14
|
+
* command paths. Removal target: not currently scheduled; this sync
|
|
15
|
+
* compatibility helper remains available until release notes announce a
|
|
16
|
+
* versioned target.
|
|
17
|
+
*
|
|
13
18
|
* @param projectDir Workspace root directory.
|
|
14
19
|
* @returns Parsed `WorkspaceInventory` including the resolved `blockConfigPath`.
|
|
15
20
|
* @throws {Error} When `scripts/block-config.ts` is missing or invalid.
|
|
@@ -68,8 +73,10 @@ function toWorkspaceBlockSelectOptions(blocks) {
|
|
|
68
73
|
* The `description` field mirrors `block.typesFile`, while `name` and `value`
|
|
69
74
|
* both map to the block slug for use in interactive add flows.
|
|
70
75
|
*
|
|
71
|
-
* @deprecated Use `getWorkspaceBlockSelectOptionsAsync()` from
|
|
72
|
-
* paths.
|
|
76
|
+
* @deprecated Since 0.22.10. Use `getWorkspaceBlockSelectOptionsAsync()` from
|
|
77
|
+
* async command paths. Removal target: not currently scheduled; this sync
|
|
78
|
+
* compatibility helper remains available until release notes announce a
|
|
79
|
+
* versioned target.
|
|
73
80
|
*
|
|
74
81
|
* @param projectDir Workspace root directory.
|
|
75
82
|
* @returns Block options for variation-target selection.
|
|
@@ -4,7 +4,12 @@ export declare const BLOCK_STYLE_CONFIG_ENTRY_MARKER = "\t// wp-typia add style
|
|
|
4
4
|
export declare const BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER = "\t// wp-typia add transform entries";
|
|
5
5
|
export declare const PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries";
|
|
6
6
|
export declare const BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries";
|
|
7
|
+
export declare const CONTRACT_CONFIG_ENTRY_MARKER = "\t// wp-typia add contract entries";
|
|
7
8
|
export declare const REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries";
|
|
9
|
+
/**
|
|
10
|
+
* Marker used to append generated post-meta entries into `POST_META`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const POST_META_CONFIG_ENTRY_MARKER = "\t// wp-typia add post-meta entries";
|
|
8
13
|
export declare const ABILITY_CONFIG_ENTRY_MARKER = "\t// wp-typia add ability entries";
|
|
9
14
|
export declare const AI_FEATURE_CONFIG_ENTRY_MARKER = "\t// wp-typia add ai-feature entries";
|
|
10
15
|
export declare const ADMIN_VIEW_CONFIG_ENTRY_MARKER = "\t// wp-typia add admin-view entries";
|
|
@@ -22,8 +27,18 @@ export declare const PATTERNS_INTERFACE_SECTION = "\n\nexport interface Workspac
|
|
|
22
27
|
export declare const PATTERNS_CONST_SECTION = "\n\nexport const PATTERNS: WorkspacePatternConfig[] = [\n\t// wp-typia add pattern entries\n];\n";
|
|
23
28
|
export declare const BINDING_SOURCES_INTERFACE_SECTION = "\n\nexport interface WorkspaceBindingSourceConfig {\n\tattribute?: string;\n\tblock?: string;\n\teditorFile: string;\n\tserverFile: string;\n\tslug: string;\n}\n";
|
|
24
29
|
export declare const BINDING_SOURCES_CONST_SECTION = "\n\nexport const BINDING_SOURCES: WorkspaceBindingSourceConfig[] = [\n\t// wp-typia add binding-source entries\n];\n";
|
|
25
|
-
export declare const
|
|
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
|
+
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";
|
|
26
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
|
+
/**
|
|
35
|
+
* Template inserted when repairing `WorkspacePostMetaConfig` in block-config.
|
|
36
|
+
*/
|
|
37
|
+
export declare const POST_META_INTERFACE_SECTION = "\n\nexport interface WorkspacePostMetaConfig {\n\tmetaKey: string;\n\tphpFile: string;\n\tpostType: string;\n\tschemaFile: string;\n\tshowInRest: boolean;\n\tslug: string;\n\tsourceTypeName: string;\n\ttypesFile: string;\n}\n";
|
|
38
|
+
/**
|
|
39
|
+
* Template inserted when repairing the `POST_META` inventory array.
|
|
40
|
+
*/
|
|
41
|
+
export declare const POST_META_CONST_SECTION = "\n\nexport const POST_META: WorkspacePostMetaConfig[] = [\n\t// wp-typia add post-meta entries\n];\n";
|
|
27
42
|
export declare const WORKSPACE_COMPATIBILITY_CONFIG_FIELD = "\tcompatibility?: {\n\t\thardMinimums: {\n\t\t\tphp?: string;\n\t\t\twordpress?: string;\n\t\t};\n\t\tmode: 'baseline' | 'optional' | 'required';\n\t\toptionalFeatureIds: string[];\n\t\toptionalFeatures: string[];\n\t\trequiredFeatureIds: string[];\n\t\trequiredFeatures: string[];\n\t\truntimeGates: string[];\n\t};\n";
|
|
28
43
|
export declare const ABILITIES_INTERFACE_SECTION = "\n\nexport interface WorkspaceAbilityConfig {\n\tclientFile: string;\n\tcompatibility?: {\n\t\thardMinimums: {\n\t\t\tphp?: string;\n\t\t\twordpress?: string;\n\t\t};\n\t\tmode: 'baseline' | 'optional' | 'required';\n\t\toptionalFeatureIds: string[];\n\t\toptionalFeatures: string[];\n\t\trequiredFeatureIds: string[];\n\t\trequiredFeatures: string[];\n\t\truntimeGates: string[];\n\t};\n\tconfigFile: string;\n\tdataFile: string;\n\tinputSchemaFile: string;\n\tinputTypeName: string;\n\toutputSchemaFile: string;\n\toutputTypeName: string;\n\tphpFile: string;\n\tslug: string;\n\ttypesFile: string;\n}\n";
|
|
29
44
|
export declare const ABILITIES_CONST_SECTION = "\n\nexport const ABILITIES: WorkspaceAbilityConfig[] = [\n\t// wp-typia add ability entries\n];\n";
|
|
@@ -4,7 +4,12 @@ export const BLOCK_STYLE_CONFIG_ENTRY_MARKER = "\t// wp-typia add style entries"
|
|
|
4
4
|
export const BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER = "\t// wp-typia add transform entries";
|
|
5
5
|
export const PATTERN_CONFIG_ENTRY_MARKER = "\t// wp-typia add pattern entries";
|
|
6
6
|
export const BINDING_SOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add binding-source entries";
|
|
7
|
+
export const CONTRACT_CONFIG_ENTRY_MARKER = "\t// wp-typia add contract entries";
|
|
7
8
|
export const REST_RESOURCE_CONFIG_ENTRY_MARKER = "\t// wp-typia add rest-resource entries";
|
|
9
|
+
/**
|
|
10
|
+
* Marker used to append generated post-meta entries into `POST_META`.
|
|
11
|
+
*/
|
|
12
|
+
export const POST_META_CONFIG_ENTRY_MARKER = "\t// wp-typia add post-meta entries";
|
|
8
13
|
export const ABILITY_CONFIG_ENTRY_MARKER = "\t// wp-typia add ability entries";
|
|
9
14
|
export const AI_FEATURE_CONFIG_ENTRY_MARKER = "\t// wp-typia add ai-feature entries";
|
|
10
15
|
export const ADMIN_VIEW_CONFIG_ENTRY_MARKER = "\t// wp-typia add admin-view entries";
|
|
@@ -85,23 +90,63 @@ export const BINDING_SOURCES: WorkspaceBindingSourceConfig[] = [
|
|
|
85
90
|
\t// wp-typia add binding-source entries
|
|
86
91
|
];
|
|
87
92
|
`;
|
|
93
|
+
export const CONTRACTS_INTERFACE_SECTION = `
|
|
94
|
+
|
|
95
|
+
export interface WorkspaceContractConfig {
|
|
96
|
+
\tschemaFile: string;
|
|
97
|
+
\tslug: string;
|
|
98
|
+
\tsourceTypeName: string;
|
|
99
|
+
\ttypesFile: string;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
export const CONTRACTS_CONST_SECTION = `
|
|
103
|
+
|
|
104
|
+
export const CONTRACTS: WorkspaceContractConfig[] = [
|
|
105
|
+
\t// wp-typia add contract entries
|
|
106
|
+
];
|
|
107
|
+
`;
|
|
88
108
|
export const REST_RESOURCES_INTERFACE_SECTION = `
|
|
89
109
|
|
|
90
|
-
export interface
|
|
110
|
+
export interface WorkspaceRestResourceBaseConfig {
|
|
91
111
|
\tapiFile: string;
|
|
112
|
+
\tauth?: 'authenticated' | 'public' | 'public-write-protected';
|
|
113
|
+
\tbodyTypeName?: string;
|
|
92
114
|
\tclientFile: string;
|
|
93
|
-
\
|
|
94
|
-
\
|
|
115
|
+
\tcontrollerClass?: string;
|
|
116
|
+
\tcontrollerExtends?: string;
|
|
95
117
|
\tnamespace: string;
|
|
96
118
|
\topenApiFile: string;
|
|
97
|
-
\
|
|
119
|
+
\tpermissionCallback?: string;
|
|
98
120
|
\trestManifest?: ReturnType<
|
|
99
121
|
\t\ttypeof import( '@wp-typia/block-runtime/metadata-core' ).defineEndpointManifest
|
|
100
122
|
\t>;
|
|
123
|
+
\tsecretFieldName?: string;
|
|
124
|
+
\tsecretStateFieldName?: string;
|
|
101
125
|
\tslug: string;
|
|
102
126
|
\ttypesFile: string;
|
|
103
127
|
\tvalidatorsFile: string;
|
|
104
128
|
}
|
|
129
|
+
|
|
130
|
+
export interface GeneratedWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {
|
|
131
|
+
\tdataFile: string;
|
|
132
|
+
\tmethods: Array< 'list' | 'read' | 'create' | 'update' | 'delete' >;
|
|
133
|
+
\tmode?: 'generated';
|
|
134
|
+
\tphpFile: string;
|
|
135
|
+
\troutePattern?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface ManualWorkspaceRestResourceConfig extends WorkspaceRestResourceBaseConfig {
|
|
139
|
+
\tmethod: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
|
|
140
|
+
\tmethods: [];
|
|
141
|
+
\tmode: 'manual';
|
|
142
|
+
\tpathPattern: string;
|
|
143
|
+
\tqueryTypeName: string;
|
|
144
|
+
\tresponseTypeName: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type WorkspaceRestResourceConfig =
|
|
148
|
+
\t| GeneratedWorkspaceRestResourceConfig
|
|
149
|
+
\t| ManualWorkspaceRestResourceConfig;
|
|
105
150
|
`;
|
|
106
151
|
export const REST_RESOURCES_CONST_SECTION = `
|
|
107
152
|
|
|
@@ -109,6 +154,31 @@ export const REST_RESOURCES: WorkspaceRestResourceConfig[] = [
|
|
|
109
154
|
\t// wp-typia add rest-resource entries
|
|
110
155
|
];
|
|
111
156
|
`;
|
|
157
|
+
/**
|
|
158
|
+
* Template inserted when repairing `WorkspacePostMetaConfig` in block-config.
|
|
159
|
+
*/
|
|
160
|
+
export const POST_META_INTERFACE_SECTION = `
|
|
161
|
+
|
|
162
|
+
export interface WorkspacePostMetaConfig {
|
|
163
|
+
\tmetaKey: string;
|
|
164
|
+
\tphpFile: string;
|
|
165
|
+
\tpostType: string;
|
|
166
|
+
\tschemaFile: string;
|
|
167
|
+
\tshowInRest: boolean;
|
|
168
|
+
\tslug: string;
|
|
169
|
+
\tsourceTypeName: string;
|
|
170
|
+
\ttypesFile: string;
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
173
|
+
/**
|
|
174
|
+
* Template inserted when repairing the `POST_META` inventory array.
|
|
175
|
+
*/
|
|
176
|
+
export const POST_META_CONST_SECTION = `
|
|
177
|
+
|
|
178
|
+
export const POST_META: WorkspacePostMetaConfig[] = [
|
|
179
|
+
\t// wp-typia add post-meta entries
|
|
180
|
+
];
|
|
181
|
+
`;
|
|
112
182
|
export const WORKSPACE_COMPATIBILITY_CONFIG_FIELD = `\tcompatibility?: {
|
|
113
183
|
\t\thardMinimums: {
|
|
114
184
|
\t\t\tphp?: string;
|
|
@@ -33,6 +33,19 @@ export interface WorkspaceBindingSourceInventoryEntry {
|
|
|
33
33
|
serverFile: string;
|
|
34
34
|
slug: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Standalone TypeScript contract entry parsed from `scripts/block-config.ts`.
|
|
38
|
+
*
|
|
39
|
+
* These contracts generate JSON Schema artifacts without owning a WordPress REST
|
|
40
|
+
* route, so smoke tests and external integrations can reference stable schema
|
|
41
|
+
* names from the workspace inventory.
|
|
42
|
+
*/
|
|
43
|
+
export interface WorkspaceContractInventoryEntry {
|
|
44
|
+
schemaFile: string;
|
|
45
|
+
slug: string;
|
|
46
|
+
sourceTypeName: string;
|
|
47
|
+
typesFile: string;
|
|
48
|
+
}
|
|
36
49
|
/**
|
|
37
50
|
* REST-resource entry parsed from `scripts/block-config.ts`.
|
|
38
51
|
*
|
|
@@ -42,16 +55,46 @@ export interface WorkspaceBindingSourceInventoryEntry {
|
|
|
42
55
|
*/
|
|
43
56
|
export interface WorkspaceRestResourceInventoryEntry {
|
|
44
57
|
apiFile: string;
|
|
58
|
+
auth?: string;
|
|
59
|
+
bodyTypeName?: string;
|
|
45
60
|
clientFile: string;
|
|
46
|
-
|
|
61
|
+
controllerClass?: string;
|
|
62
|
+
controllerExtends?: string;
|
|
63
|
+
dataFile?: string;
|
|
64
|
+
method?: string;
|
|
47
65
|
methods: string[];
|
|
66
|
+
mode?: "generated" | "manual";
|
|
48
67
|
namespace: string;
|
|
49
68
|
openApiFile: string;
|
|
50
|
-
|
|
69
|
+
pathPattern?: string;
|
|
70
|
+
permissionCallback?: string;
|
|
71
|
+
phpFile?: string;
|
|
72
|
+
queryTypeName?: string;
|
|
73
|
+
responseTypeName?: string;
|
|
74
|
+
routePattern?: string;
|
|
75
|
+
secretFieldName?: string;
|
|
76
|
+
secretStateFieldName?: string;
|
|
51
77
|
slug: string;
|
|
52
78
|
typesFile: string;
|
|
53
79
|
validatorsFile: string;
|
|
54
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Post-meta contract entry parsed from `scripts/block-config.ts`.
|
|
83
|
+
*
|
|
84
|
+
* The TypeScript source and schema artifact define the persisted meta value
|
|
85
|
+
* shape, while the PHP file registers the matching WordPress post-meta key for
|
|
86
|
+
* the declared post type scope.
|
|
87
|
+
*/
|
|
88
|
+
export interface WorkspacePostMetaInventoryEntry {
|
|
89
|
+
metaKey: string;
|
|
90
|
+
phpFile: string;
|
|
91
|
+
postType: string;
|
|
92
|
+
schemaFile: string;
|
|
93
|
+
showInRest: boolean;
|
|
94
|
+
slug: string;
|
|
95
|
+
sourceTypeName: string;
|
|
96
|
+
typesFile: string;
|
|
97
|
+
}
|
|
55
98
|
/**
|
|
56
99
|
* Ability entry parsed from `scripts/block-config.ts`.
|
|
57
100
|
*
|
|
@@ -124,6 +167,7 @@ export interface WorkspaceInventory {
|
|
|
124
167
|
blocks: WorkspaceBlockInventoryEntry[];
|
|
125
168
|
blockStyles: WorkspaceBlockStyleInventoryEntry[];
|
|
126
169
|
blockTransforms: WorkspaceBlockTransformInventoryEntry[];
|
|
170
|
+
contracts: WorkspaceContractInventoryEntry[];
|
|
127
171
|
abilities: WorkspaceAbilityInventoryEntry[];
|
|
128
172
|
aiFeatures: WorkspaceAiFeatureInventoryEntry[];
|
|
129
173
|
hasAbilitiesSection: boolean;
|
|
@@ -132,12 +176,15 @@ export interface WorkspaceInventory {
|
|
|
132
176
|
hasAiFeaturesSection: boolean;
|
|
133
177
|
hasBlockStylesSection: boolean;
|
|
134
178
|
hasBlockTransformsSection: boolean;
|
|
179
|
+
hasContractsSection: boolean;
|
|
135
180
|
hasEditorPluginsSection: boolean;
|
|
136
181
|
hasPatternsSection: boolean;
|
|
182
|
+
hasPostMetaSection: boolean;
|
|
137
183
|
hasRestResourcesSection: boolean;
|
|
138
184
|
hasVariationsSection: boolean;
|
|
139
185
|
editorPlugins: WorkspaceEditorPluginInventoryEntry[];
|
|
140
186
|
patterns: WorkspacePatternInventoryEntry[];
|
|
187
|
+
postMeta: WorkspacePostMetaInventoryEntry[];
|
|
141
188
|
restResources: WorkspaceRestResourceInventoryEntry[];
|
|
142
189
|
source: string;
|
|
143
190
|
variations: WorkspaceVariationInventoryEntry[];
|
|
@@ -162,8 +209,10 @@ export type WorkspaceInventoryUpdateOptions = {
|
|
|
162
209
|
blockStyleEntries?: string[];
|
|
163
210
|
blockTransformEntries?: string[];
|
|
164
211
|
bindingSourceEntries?: string[];
|
|
212
|
+
contractEntries?: string[];
|
|
165
213
|
editorPluginEntries?: string[];
|
|
166
214
|
patternEntries?: string[];
|
|
215
|
+
postMetaEntries?: string[];
|
|
167
216
|
restResourceEntries?: string[];
|
|
168
217
|
transformSource?: (source: string) => string;
|
|
169
218
|
variationEntries?: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ABILITY_CONFIG_ENTRY_MARKER, ADMIN_VIEW_CONFIG_ENTRY_MARKER, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERN_CONFIG_ENTRY_MARKER, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
|
|
1
|
+
export { ABILITY_CONFIG_ENTRY_MARKER, ADMIN_VIEW_CONFIG_ENTRY_MARKER, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, CONTRACT_CONFIG_ENTRY_MARKER, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERN_CONFIG_ENTRY_MARKER, POST_META_CONFIG_ENTRY_MARKER, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
|
|
2
2
|
export { parseWorkspaceInventorySource } from "./workspace-inventory-parser.js";
|
|
3
3
|
export { getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, readWorkspaceInventory, readWorkspaceInventoryAsync, } from "./workspace-inventory-read.js";
|
|
4
4
|
export { appendWorkspaceInventoryEntries, updateWorkspaceInventorySource, } from "./workspace-inventory-mutations.js";
|
|
5
|
-
export type { WorkspaceAbilityInventoryEntry, WorkspaceAdminViewInventoryEntry, WorkspaceAiFeatureInventoryEntry, WorkspaceBindingSourceInventoryEntry, WorkspaceBlockInventoryEntry, WorkspaceBlockSelectOption, WorkspaceBlockStyleInventoryEntry, WorkspaceBlockTransformInventoryEntry, WorkspaceEditorPluginInventoryEntry, WorkspaceInventory, WorkspacePatternInventoryEntry, WorkspaceRestResourceInventoryEntry, WorkspaceVariationInventoryEntry, } from "./workspace-inventory-types.js";
|
|
5
|
+
export type { WorkspaceAbilityInventoryEntry, WorkspaceAdminViewInventoryEntry, WorkspaceAiFeatureInventoryEntry, WorkspaceBindingSourceInventoryEntry, WorkspaceBlockInventoryEntry, WorkspaceBlockSelectOption, WorkspaceBlockStyleInventoryEntry, WorkspaceBlockTransformInventoryEntry, WorkspaceContractInventoryEntry, WorkspaceEditorPluginInventoryEntry, WorkspaceInventory, WorkspacePatternInventoryEntry, WorkspacePostMetaInventoryEntry, WorkspaceRestResourceInventoryEntry, WorkspaceVariationInventoryEntry, } from "./workspace-inventory-types.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ABILITY_CONFIG_ENTRY_MARKER, ADMIN_VIEW_CONFIG_ENTRY_MARKER, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERN_CONFIG_ENTRY_MARKER, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
|
|
1
|
+
export { ABILITY_CONFIG_ENTRY_MARKER, ADMIN_VIEW_CONFIG_ENTRY_MARKER, AI_FEATURE_CONFIG_ENTRY_MARKER, BINDING_SOURCE_CONFIG_ENTRY_MARKER, BLOCK_CONFIG_ENTRY_MARKER, BLOCK_STYLE_CONFIG_ENTRY_MARKER, BLOCK_TRANSFORM_CONFIG_ENTRY_MARKER, CONTRACT_CONFIG_ENTRY_MARKER, EDITOR_PLUGIN_CONFIG_ENTRY_MARKER, PATTERN_CONFIG_ENTRY_MARKER, POST_META_CONFIG_ENTRY_MARKER, REST_RESOURCE_CONFIG_ENTRY_MARKER, VARIATION_CONFIG_ENTRY_MARKER, } from "./workspace-inventory-templates.js";
|
|
2
2
|
export { parseWorkspaceInventorySource } from "./workspace-inventory-parser.js";
|
|
3
3
|
export { getWorkspaceBlockSelectOptions, getWorkspaceBlockSelectOptionsAsync, readWorkspaceInventory, readWorkspaceInventoryAsync, } from "./workspace-inventory-read.js";
|
|
4
4
|
export { appendWorkspaceInventoryEntries, updateWorkspaceInventorySource, } from "./workspace-inventory-mutations.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-typia/project-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
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.
|
|
164
|
+
"@wp-typia/block-runtime": "^0.6.0",
|
|
165
165
|
"@wp-typia/rest": "^0.3.13",
|
|
166
166
|
"@wp-typia/block-types": "^0.2.4",
|
|
167
167
|
"mustache": "^4.2.0",
|