@wp-typia/project-tools 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/runtime/ai-feature-artifacts.js +4 -1
  2. package/dist/runtime/block-generator-service-spec.js +2 -1
  3. package/dist/runtime/cli-add-block-json.js +5 -1
  4. package/dist/runtime/cli-add-help.js +4 -3
  5. package/dist/runtime/cli-add-types.d.ts +18 -6
  6. package/dist/runtime/cli-add-validation.d.ts +7 -0
  7. package/dist/runtime/cli-add-validation.js +9 -0
  8. package/dist/runtime/cli-add-workspace-ability-scaffold.js +4 -1
  9. package/dist/runtime/cli-add-workspace-admin-view-scaffold.js +5 -1
  10. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.d.ts +34 -0
  11. package/dist/runtime/cli-add-workspace-admin-view-templates-core-data.js +483 -0
  12. package/dist/runtime/cli-add-workspace-admin-view-templates-default.d.ts +30 -0
  13. package/dist/runtime/cli-add-workspace-admin-view-templates-default.js +310 -0
  14. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.d.ts +25 -0
  15. package/dist/runtime/cli-add-workspace-admin-view-templates-rest.js +124 -0
  16. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.d.ts +34 -0
  17. package/dist/runtime/cli-add-workspace-admin-view-templates-settings.js +370 -0
  18. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.d.ts +49 -0
  19. package/dist/runtime/cli-add-workspace-admin-view-templates-shared.js +259 -0
  20. package/dist/runtime/cli-add-workspace-admin-view-templates.d.ts +18 -27
  21. package/dist/runtime/cli-add-workspace-admin-view-templates.js +30 -1326
  22. package/dist/runtime/cli-add-workspace-ai-anchors.js +4 -1
  23. package/dist/runtime/cli-add-workspace-ai-source-emitters.js +17 -1
  24. package/dist/runtime/cli-add-workspace-integration-env.d.ts +3 -1
  25. package/dist/runtime/cli-add-workspace-integration-env.js +42 -5
  26. package/dist/runtime/cli-add-workspace-rest-anchors.d.ts +8 -0
  27. package/dist/runtime/cli-add-workspace-rest-anchors.js +41 -0
  28. package/dist/runtime/cli-add-workspace-rest-generated.d.ts +9 -0
  29. package/dist/runtime/cli-add-workspace-rest-generated.js +158 -0
  30. package/dist/runtime/cli-add-workspace-rest-manual.d.ts +8 -0
  31. package/dist/runtime/cli-add-workspace-rest-manual.js +279 -0
  32. package/dist/runtime/cli-add-workspace-rest-php-templates.d.ts +24 -0
  33. package/dist/runtime/cli-add-workspace-rest-php-templates.js +678 -0
  34. package/dist/runtime/cli-add-workspace-rest-source-emitters.d.ts +8 -0
  35. package/dist/runtime/cli-add-workspace-rest-source-emitters.js +25 -4
  36. package/dist/runtime/cli-add-workspace-rest-types.d.ts +108 -0
  37. package/dist/runtime/cli-add-workspace-rest-types.js +1 -0
  38. package/dist/runtime/cli-add-workspace-rest.d.ts +3 -20
  39. package/dist/runtime/cli-add-workspace-rest.js +33 -788
  40. package/dist/runtime/cli-core.d.ts +1 -1
  41. package/dist/runtime/cli-core.js +1 -1
  42. package/dist/runtime/cli-diagnostics.d.ts +3 -1
  43. package/dist/runtime/cli-diagnostics.js +17 -5
  44. package/dist/runtime/cli-doctor-workspace-bindings.js +4 -1
  45. package/dist/runtime/cli-doctor-workspace-block-addons.d.ts +12 -0
  46. package/dist/runtime/cli-doctor-workspace-block-addons.js +134 -0
  47. package/dist/runtime/cli-doctor-workspace-block-iframe.d.ts +9 -0
  48. package/dist/runtime/cli-doctor-workspace-block-iframe.js +228 -0
  49. package/dist/runtime/cli-doctor-workspace-block-metadata.d.ts +11 -0
  50. package/dist/runtime/cli-doctor-workspace-block-metadata.js +111 -0
  51. package/dist/runtime/cli-doctor-workspace-blocks.js +6 -424
  52. package/dist/runtime/cli-doctor-workspace-features-abilities.d.ts +11 -0
  53. package/dist/runtime/cli-doctor-workspace-features-abilities.js +112 -0
  54. package/dist/runtime/cli-doctor-workspace-features-admin-views.d.ts +11 -0
  55. package/dist/runtime/cli-doctor-workspace-features-admin-views.js +128 -0
  56. package/dist/runtime/cli-doctor-workspace-features-ai.d.ts +11 -0
  57. package/dist/runtime/cli-doctor-workspace-features-ai.js +57 -0
  58. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.d.ts +11 -0
  59. package/dist/runtime/cli-doctor-workspace-features-editor-plugins.js +80 -0
  60. package/dist/runtime/cli-doctor-workspace-features-post-meta.d.ts +11 -0
  61. package/dist/runtime/cli-doctor-workspace-features-post-meta.js +77 -0
  62. package/dist/runtime/cli-doctor-workspace-features-rest.d.ts +11 -0
  63. package/dist/runtime/cli-doctor-workspace-features-rest.js +120 -0
  64. package/dist/runtime/cli-doctor-workspace-features.js +14 -487
  65. package/dist/runtime/cli-doctor.d.ts +52 -3
  66. package/dist/runtime/cli-doctor.js +79 -8
  67. package/dist/runtime/cli-help.js +6 -3
  68. package/dist/runtime/cli-init-package-json.js +4 -2
  69. package/dist/runtime/cli-prompt.d.ts +16 -2
  70. package/dist/runtime/cli-prompt.js +29 -12
  71. package/dist/runtime/cli-scaffold.d.ts +2 -1
  72. package/dist/runtime/cli-scaffold.js +19 -10
  73. package/dist/runtime/external-template-guards.js +4 -6
  74. package/dist/runtime/index.d.ts +2 -2
  75. package/dist/runtime/index.js +1 -1
  76. package/dist/runtime/json-utils.d.ts +62 -4
  77. package/dist/runtime/json-utils.js +78 -4
  78. package/dist/runtime/local-dev-presets.js +4 -1
  79. package/dist/runtime/migration-ui-capability.js +4 -1
  80. package/dist/runtime/migration-utils.js +4 -1
  81. package/dist/runtime/package-managers.js +6 -1
  82. package/dist/runtime/package-versions.js +6 -1
  83. package/dist/runtime/scaffold-bootstrap.js +7 -2
  84. package/dist/runtime/scaffold-package-manager-files.js +5 -1
  85. package/dist/runtime/scaffold-repository-reference.js +4 -2
  86. package/dist/runtime/scaffold-template-variables.js +2 -1
  87. package/dist/runtime/scaffold.d.ts +18 -1
  88. package/dist/runtime/scaffold.js +55 -2
  89. package/dist/runtime/temp-roots.js +4 -1
  90. package/dist/runtime/template-layers.js +4 -1
  91. package/dist/runtime/template-registry.js +9 -3
  92. package/dist/runtime/template-source-contracts.d.ts +2 -0
  93. package/dist/runtime/template-source-normalization.js +2 -1
  94. package/dist/runtime/template-source-remote.js +18 -5
  95. package/dist/runtime/template-source-seeds.js +10 -3
  96. package/dist/runtime/workspace-inventory-mutations.js +2 -1
  97. package/dist/runtime/workspace-inventory-parser-entries.d.ts +17 -0
  98. package/dist/runtime/workspace-inventory-parser-entries.js +157 -0
  99. package/dist/runtime/workspace-inventory-parser-validation.d.ts +104 -0
  100. package/dist/runtime/workspace-inventory-parser-validation.js +34 -0
  101. package/dist/runtime/workspace-inventory-parser.d.ts +3 -45
  102. package/dist/runtime/workspace-inventory-parser.js +3 -581
  103. package/dist/runtime/workspace-inventory-section-descriptors.d.ts +19 -0
  104. package/dist/runtime/workspace-inventory-section-descriptors.js +435 -0
  105. package/dist/runtime/workspace-inventory-templates.d.ts +1 -1
  106. package/dist/runtime/workspace-inventory-templates.js +1 -0
  107. package/dist/runtime/workspace-inventory-types.d.ts +1 -0
  108. package/dist/runtime/workspace-project.js +4 -6
  109. package/package.json +2 -2
@@ -34,13 +34,17 @@ export declare function buildRestResourceConfigEntry(options: {
34
34
  export declare function buildManualRestContractConfigEntry(options: {
35
35
  auth: ManualRestContractAuthId;
36
36
  bodyTypeName?: string;
37
+ controllerClass?: string;
38
+ controllerExtends?: string;
37
39
  method: ManualRestContractHttpMethodId;
38
40
  namespace: string;
39
41
  pathPattern: string;
42
+ permissionCallback?: string;
40
43
  queryTypeName: string;
41
44
  responseTypeName: string;
42
45
  restResourceSlug: string;
43
46
  secretFieldName?: string;
47
+ secretPreserveOnEmpty?: boolean;
44
48
  secretStateFieldName?: string;
45
49
  }): string;
46
50
  /**
@@ -48,6 +52,8 @@ export declare function buildManualRestContractConfigEntry(options: {
48
52
  *
49
53
  * @param options Manual contract type naming metadata.
50
54
  * @param options.bodyTypeName Optional exported body type name.
55
+ * @param options.pathParameterNames Route named captures that should be present
56
+ * in the starter query type so generated clients can fill provider paths.
51
57
  * @param options.queryTypeName Exported query type name.
52
58
  * @param options.responseTypeName Exported response type name.
53
59
  * @param options.restResourceSlug Normalized workspace REST contract slug.
@@ -57,10 +63,12 @@ export declare function buildManualRestContractConfigEntry(options: {
57
63
  */
58
64
  export declare function buildManualRestContractTypesSource(options: {
59
65
  bodyTypeName?: string;
66
+ pathParameterNames?: string[];
60
67
  queryTypeName: string;
61
68
  responseTypeName: string;
62
69
  restResourceSlug: string;
63
70
  secretFieldName?: string;
71
+ secretPreserveOnEmpty?: boolean;
64
72
  secretStateFieldName?: string;
65
73
  }): string;
66
74
  /**
@@ -93,12 +93,21 @@ export function buildManualRestContractConfigEntry(options) {
93
93
  ? [`\t\tbodyTypeName: ${quoteTsString(options.bodyTypeName)},`]
94
94
  : []),
95
95
  `\t\tclientFile: ${quoteTsString(`src/rest/${options.restResourceSlug}/api-client.ts`)},`,
96
+ ...(options.controllerClass
97
+ ? [`\t\tcontrollerClass: ${quoteTsString(options.controllerClass)},`]
98
+ : []),
99
+ ...(options.controllerExtends
100
+ ? [`\t\tcontrollerExtends: ${quoteTsString(options.controllerExtends)},`]
101
+ : []),
96
102
  `\t\tmethod: ${quoteTsString(options.method)},`,
97
103
  "\t\tmethods: [],",
98
104
  "\t\tmode: 'manual',",
99
105
  `\t\tnamespace: ${quoteTsString(options.namespace)},`,
100
106
  `\t\topenApiFile: ${quoteTsString(`src/rest/${options.restResourceSlug}/api.openapi.json`)},`,
101
107
  `\t\tpathPattern: ${quoteTsString(options.pathPattern)},`,
108
+ ...(options.permissionCallback
109
+ ? [`\t\tpermissionCallback: ${quoteTsString(options.permissionCallback)},`]
110
+ : []),
102
111
  `\t\tqueryTypeName: ${quoteTsString(options.queryTypeName)},`,
103
112
  "\t\trestManifest: defineEndpointManifest(",
104
113
  indentMultiline(JSON.stringify(manifest, null, "\t"), "\t\t\t"),
@@ -107,6 +116,9 @@ export function buildManualRestContractConfigEntry(options) {
107
116
  ...(options.secretFieldName
108
117
  ? [`\t\tsecretFieldName: ${quoteTsString(options.secretFieldName)},`]
109
118
  : []),
119
+ ...(options.secretPreserveOnEmpty !== undefined
120
+ ? [`\t\tsecretPreserveOnEmpty: ${options.secretPreserveOnEmpty},`]
121
+ : []),
110
122
  ...(options.secretStateFieldName
111
123
  ? [`\t\tsecretStateFieldName: ${quoteTsString(options.secretStateFieldName)},`]
112
124
  : []),
@@ -121,6 +133,8 @@ export function buildManualRestContractConfigEntry(options) {
121
133
  *
122
134
  * @param options Manual contract type naming metadata.
123
135
  * @param options.bodyTypeName Optional exported body type name.
136
+ * @param options.pathParameterNames Route named captures that should be present
137
+ * in the starter query type so generated clients can fill provider paths.
124
138
  * @param options.queryTypeName Exported query type name.
125
139
  * @param options.responseTypeName Exported response type name.
126
140
  * @param options.restResourceSlug Normalized workspace REST contract slug.
@@ -130,19 +144,26 @@ export function buildManualRestContractConfigEntry(options) {
130
144
  */
131
145
  export function buildManualRestContractTypesSource(options) {
132
146
  const title = toTitleCase(options.restResourceSlug);
147
+ const pathParameterNames = Array.from(new Set(options.pathParameterNames ?? []));
148
+ const queryFields = pathParameterNames.length > 0
149
+ ? pathParameterNames.map((parameterName) => `\t${parameterName}: string & tags.MinLength< 1 >;`)
150
+ : ["\tid?: string & tags.MinLength< 1 >;"];
133
151
  const lines = [
134
152
  "import type { tags } from '@wp-typia/block-runtime/typia-tags';",
135
153
  "",
136
154
  `export interface ${options.queryTypeName} {`,
137
- "\tid?: string & tags.MinLength< 1 >;",
138
- "\tpreview?: boolean;",
155
+ ...queryFields,
156
+ ...(pathParameterNames.includes("preview") ? [] : ["\tpreview?: boolean;"]),
139
157
  "}",
140
158
  ];
141
159
  if (options.bodyTypeName) {
160
+ const secretPreserveOnEmpty = options.secretPreserveOnEmpty ?? true;
142
161
  const secretLines = options.secretFieldName && options.secretStateFieldName
143
162
  ? [
144
- `\t${options.secretFieldName}?: string & tags.MinLength< 1 > & tags.MaxLength< 4096 > & tags.Secret< ${quoteTsString(options.secretStateFieldName)} >;`,
145
- `\t// ${options.secretFieldName} is write-only: persist it server-side and expose ${options.secretStateFieldName} in responses instead of returning the raw value.`,
163
+ `\t${options.secretFieldName}?: string${secretPreserveOnEmpty ? " & tags.MinLength< 1 >" : ""} & tags.MaxLength< 4096 > & tags.Secret< ${quoteTsString(options.secretStateFieldName)} >${secretPreserveOnEmpty ? " & tags.PreserveOnEmpty< true >" : ""};`,
164
+ secretPreserveOnEmpty
165
+ ? `\t// ${options.secretFieldName} is write-only: omit or submit an empty value to preserve the stored secret, and expose ${options.secretStateFieldName} in responses instead of returning the raw value.`
166
+ : `\t// ${options.secretFieldName} is write-only: persist it server-side and expose ${options.secretStateFieldName} in responses instead of returning the raw value.`,
146
167
  ]
147
168
  : [];
148
169
  lines.push("", `export interface ${options.bodyTypeName} {`, ...secretLines, "\tpayload: string & tags.MinLength< 1 >;", "\tcomment?: string & tags.MaxLength< 500 >;", "}");
@@ -0,0 +1,108 @@
1
+ import type { ManualRestContractAuthId, ManualRestContractHttpMethodId, RestResourceMethodId } from "./cli-add-shared.js";
2
+ import type { WorkspaceProject } from "./workspace-project.js";
3
+ /**
4
+ * Normalized metadata returned after `wp-typia add rest-resource` completes.
5
+ *
6
+ * @property auth Manual-mode authentication policy when `mode` is `"manual"`.
7
+ * @property bodyTypeName Optional manual-mode request body type export.
8
+ * @property controllerClass Optional PHP controller class reference. Generated
9
+ * mode uses it for callbacks; manual mode records it as route-owner metadata.
10
+ * @property methods Generated-mode REST operation ids, or an empty array for
11
+ * manual contracts.
12
+ * @property mode Whether the scaffold wrote generated REST glue or a type-only
13
+ * manual contract.
14
+ * @property namespace REST namespace in `vendor/v1` format.
15
+ * @property projectDir Absolute workspace project directory.
16
+ * @property restResourceSlug Normalized kebab-case REST resource slug.
17
+ * @property secretPreserveOnEmpty Whether blank settings secret submissions
18
+ * should preserve the stored value when `secretFieldName` is set.
19
+ */
20
+ export interface RunAddRestResourceCommandResult {
21
+ auth?: ManualRestContractAuthId;
22
+ bodyTypeName?: string;
23
+ controllerClass?: string;
24
+ controllerExtends?: string;
25
+ method?: ManualRestContractHttpMethodId;
26
+ methods: RestResourceMethodId[];
27
+ mode: "generated" | "manual";
28
+ namespace: string;
29
+ permissionCallback?: string;
30
+ pathPattern?: string;
31
+ projectDir: string;
32
+ queryTypeName?: string;
33
+ restResourceSlug: string;
34
+ responseTypeName?: string;
35
+ routePattern?: string;
36
+ secretFieldName?: string;
37
+ secretHasValueFieldName?: string;
38
+ secretMaskedResponseFieldName?: string;
39
+ secretPreserveOnEmpty?: boolean;
40
+ secretStateFieldName?: string;
41
+ }
42
+ /**
43
+ * Raw command options passed from the REST orchestrator into manual-mode
44
+ * contract scaffolding.
45
+ *
46
+ * @property auth Optional raw manual authentication id, validated before use.
47
+ * @property bodyTypeName Optional exported request body type name.
48
+ * @property method Optional raw HTTP method id, validated as a manual REST
49
+ * contract method.
50
+ * @property namespace Resolved REST namespace in `vendor/v1` format.
51
+ * @property pathPattern Optional manual route path pattern relative to the
52
+ * namespace.
53
+ * @property permissionCallback Optional manual route-owner permission callback
54
+ * metadata.
55
+ * @property restResourceSlug Normalized kebab-case REST resource slug.
56
+ * @property routePattern Optional manual route path alias for `pathPattern`.
57
+ * @property secretHasValueFieldName Optional alias for `secretStateFieldName`.
58
+ * @property secretMaskedResponseFieldName Optional alias for
59
+ * `secretStateFieldName`.
60
+ * @property secretFieldName Optional write-only request secret field.
61
+ * @property secretPreserveOnEmpty Optional true/false string or boolean for
62
+ * blank-secret preservation. Defaults to true when `secretFieldName` is set.
63
+ * @property workspace Resolved official workspace project.
64
+ */
65
+ export interface ManualRestContractScaffoldOptions {
66
+ auth: string | undefined;
67
+ bodyTypeName: string | undefined;
68
+ controllerClass: string | undefined;
69
+ controllerExtends: string | undefined;
70
+ method: string | undefined;
71
+ namespace: string;
72
+ pathPattern: string | undefined;
73
+ permissionCallback: string | undefined;
74
+ queryTypeName: string | undefined;
75
+ responseTypeName: string | undefined;
76
+ restResourceSlug: string;
77
+ routePattern: string | undefined;
78
+ secretFieldName: string | undefined;
79
+ secretHasValueFieldName: string | undefined;
80
+ secretMaskedResponseFieldName: string | undefined;
81
+ secretPreserveOnEmpty: boolean | string | undefined;
82
+ secretStateFieldName: string | undefined;
83
+ workspace: WorkspaceProject;
84
+ }
85
+ /**
86
+ * Raw command options passed from the REST orchestrator into generated-mode
87
+ * resource scaffolding.
88
+ *
89
+ * @property controllerClass Optional PHP controller class reference.
90
+ * @property controllerExtends Optional PHP base class reference; requires
91
+ * `controllerClass`.
92
+ * @property methods Optional comma-separated REST method list validated into
93
+ * `RestResourceMethodId` values.
94
+ * @property namespace Resolved REST namespace in `vendor/v1` format.
95
+ * @property permissionCallback Optional PHP permission callback reference.
96
+ * @property restResourceSlug Normalized kebab-case REST resource slug.
97
+ * @property workspace Resolved official workspace project.
98
+ */
99
+ export interface GeneratedRestResourceScaffoldOptions {
100
+ controllerClass: string | undefined;
101
+ controllerExtends: string | undefined;
102
+ methods: string | undefined;
103
+ namespace: string;
104
+ permissionCallback: string | undefined;
105
+ restResourceSlug: string;
106
+ routePattern: string | undefined;
107
+ workspace: WorkspaceProject;
108
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
- import { type ManualRestContractAuthId, type ManualRestContractHttpMethodId, type RestResourceMethodId, type RunAddRestResourceCommandOptions } from "./cli-add-shared.js";
1
+ import { type RunAddRestResourceCommandOptions } from "./cli-add-shared.js";
2
+ import { type RunAddRestResourceCommandResult } from "./cli-add-workspace-rest-types.js";
2
3
  /**
3
4
  * Scaffold a workspace-level REST resource and synchronize its generated
4
5
  * TypeScript and PHP artifacts.
@@ -6,22 +7,4 @@ import { type ManualRestContractAuthId, type ManualRestContractHttpMethodId, typ
6
7
  * @param options Command options for the REST resource scaffold workflow.
7
8
  * @returns Resolved scaffold metadata for the created REST resource.
8
9
  */
9
- export declare function runAddRestResourceCommand({ auth, bodyTypeName, controllerClass, controllerExtends, cwd, manual, method, methods, namespace, permissionCallback, pathPattern, queryTypeName, restResourceName, responseTypeName, routePattern, secretFieldName, secretStateFieldName, }: RunAddRestResourceCommandOptions): Promise<{
10
- auth?: ManualRestContractAuthId;
11
- bodyTypeName?: string;
12
- controllerClass?: string;
13
- controllerExtends?: string;
14
- method?: ManualRestContractHttpMethodId;
15
- methods: RestResourceMethodId[];
16
- mode: "generated" | "manual";
17
- namespace: string;
18
- permissionCallback?: string;
19
- pathPattern?: string;
20
- projectDir: string;
21
- queryTypeName?: string;
22
- restResourceSlug: string;
23
- responseTypeName?: string;
24
- routePattern?: string;
25
- secretFieldName?: string;
26
- secretStateFieldName?: string;
27
- }>;
10
+ export declare function runAddRestResourceCommand({ auth, bodyTypeName, controllerClass, controllerExtends, cwd, manual, method, methods, namespace, permissionCallback, pathPattern, queryTypeName, restResourceName, responseTypeName, routePattern, secretFieldName, secretHasValueFieldName, secretMaskedResponseFieldName, secretPreserveOnEmpty, secretStateFieldName, }: RunAddRestResourceCommandOptions): Promise<RunAddRestResourceCommandResult>;