@wp-typia/project-tools 0.11.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 (187) hide show
  1. package/README.md +32 -0
  2. package/dist/runtime/cli-add.d.ts +38 -0
  3. package/dist/runtime/cli-add.js +561 -0
  4. package/dist/runtime/cli-core.d.ts +25 -0
  5. package/dist/runtime/cli-core.js +25 -0
  6. package/dist/runtime/cli-doctor.d.ts +34 -0
  7. package/dist/runtime/cli-doctor.js +131 -0
  8. package/dist/runtime/cli-help.d.ts +9 -0
  9. package/dist/runtime/cli-help.js +37 -0
  10. package/dist/runtime/cli-prompt.d.ts +21 -0
  11. package/dist/runtime/cli-prompt.js +53 -0
  12. package/dist/runtime/cli-scaffold.d.ts +79 -0
  13. package/dist/runtime/cli-scaffold.js +206 -0
  14. package/dist/runtime/cli-templates.d.ts +30 -0
  15. package/dist/runtime/cli-templates.js +61 -0
  16. package/dist/runtime/index.d.ts +9 -0
  17. package/dist/runtime/index.js +7 -0
  18. package/dist/runtime/json-utils.d.ts +10 -0
  19. package/dist/runtime/json-utils.js +12 -0
  20. package/dist/runtime/local-dev-presets.d.ts +26 -0
  21. package/dist/runtime/local-dev-presets.js +132 -0
  22. package/dist/runtime/metadata-analysis.d.ts +11 -0
  23. package/dist/runtime/metadata-analysis.js +285 -0
  24. package/dist/runtime/metadata-model.d.ts +84 -0
  25. package/dist/runtime/metadata-model.js +59 -0
  26. package/dist/runtime/metadata-parser.d.ts +53 -0
  27. package/dist/runtime/metadata-parser.js +794 -0
  28. package/dist/runtime/metadata-php-render.d.ts +29 -0
  29. package/dist/runtime/metadata-php-render.js +549 -0
  30. package/dist/runtime/metadata-projection.d.ts +7 -0
  31. package/dist/runtime/metadata-projection.js +233 -0
  32. package/dist/runtime/migration-constants.d.ts +15 -0
  33. package/dist/runtime/migration-constants.js +16 -0
  34. package/dist/runtime/migration-diff.d.ts +2 -0
  35. package/dist/runtime/migration-diff.js +537 -0
  36. package/dist/runtime/migration-fixtures.d.ts +8 -0
  37. package/dist/runtime/migration-fixtures.js +94 -0
  38. package/dist/runtime/migration-fuzz-plan.d.ts +2 -0
  39. package/dist/runtime/migration-fuzz-plan.js +50 -0
  40. package/dist/runtime/migration-manifest.d.ts +19 -0
  41. package/dist/runtime/migration-manifest.js +129 -0
  42. package/dist/runtime/migration-project.d.ts +94 -0
  43. package/dist/runtime/migration-project.js +1101 -0
  44. package/dist/runtime/migration-render.d.ts +11 -0
  45. package/dist/runtime/migration-render.js +741 -0
  46. package/dist/runtime/migration-risk.d.ts +4 -0
  47. package/dist/runtime/migration-risk.js +52 -0
  48. package/dist/runtime/migration-types.d.ts +249 -0
  49. package/dist/runtime/migration-types.js +1 -0
  50. package/dist/runtime/migration-ui-capability.d.ts +17 -0
  51. package/dist/runtime/migration-ui-capability.js +190 -0
  52. package/dist/runtime/migration-utils.d.ts +69 -0
  53. package/dist/runtime/migration-utils.js +246 -0
  54. package/dist/runtime/migrations.d.ts +249 -0
  55. package/dist/runtime/migrations.js +1061 -0
  56. package/dist/runtime/object-utils.d.ts +12 -0
  57. package/dist/runtime/object-utils.js +14 -0
  58. package/dist/runtime/package-managers.d.ts +28 -0
  59. package/dist/runtime/package-managers.js +156 -0
  60. package/dist/runtime/package-versions.d.ts +10 -0
  61. package/dist/runtime/package-versions.js +68 -0
  62. package/dist/runtime/scaffold-onboarding.d.ts +32 -0
  63. package/dist/runtime/scaffold-onboarding.js +99 -0
  64. package/dist/runtime/scaffold.d.ts +146 -0
  65. package/dist/runtime/scaffold.js +612 -0
  66. package/dist/runtime/schema-core.d.ts +267 -0
  67. package/dist/runtime/schema-core.js +597 -0
  68. package/dist/runtime/starter-manifests.d.ts +25 -0
  69. package/dist/runtime/starter-manifests.js +383 -0
  70. package/dist/runtime/string-case.d.ts +36 -0
  71. package/dist/runtime/string-case.js +69 -0
  72. package/dist/runtime/template-builtins.d.ts +38 -0
  73. package/dist/runtime/template-builtins.js +72 -0
  74. package/dist/runtime/template-defaults.d.ts +75 -0
  75. package/dist/runtime/template-defaults.js +65 -0
  76. package/dist/runtime/template-registry.d.ts +36 -0
  77. package/dist/runtime/template-registry.js +94 -0
  78. package/dist/runtime/template-render.d.ts +24 -0
  79. package/dist/runtime/template-render.js +113 -0
  80. package/dist/runtime/template-source.d.ts +71 -0
  81. package/dist/runtime/template-source.js +821 -0
  82. package/dist/runtime/typia-tags.d.ts +1 -0
  83. package/dist/runtime/typia-tags.js +1 -0
  84. package/package.json +79 -0
  85. package/templates/_shared/base/languages/.gitkeep +1 -0
  86. package/templates/_shared/base/package.json.mustache +41 -0
  87. package/templates/_shared/base/scripts/sync-types-to-block-json.ts.mustache +118 -0
  88. package/templates/_shared/base/src/hooks.ts.mustache +19 -0
  89. package/templates/_shared/base/src/validator-toolkit.ts.mustache +31 -0
  90. package/templates/_shared/base/tsconfig.json.mustache +21 -0
  91. package/templates/_shared/base/webpack.config.js.mustache +99 -0
  92. package/templates/_shared/base/{{slugKebabCase}}.php.mustache +53 -0
  93. package/templates/_shared/compound/core/package.json.mustache +45 -0
  94. package/templates/_shared/compound/core/scripts/add-compound-child.ts.mustache +559 -0
  95. package/templates/_shared/compound/core/scripts/block-config.ts.mustache +13 -0
  96. package/templates/_shared/compound/core/scripts/sync-types-to-block-json.ts.mustache +53 -0
  97. package/templates/_shared/compound/core/webpack.config.js.mustache +141 -0
  98. package/templates/_shared/compound/core/{{slugKebabCase}}.php.mustache +51 -0
  99. package/templates/_shared/compound/persistence/package.json.mustache +50 -0
  100. package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +59 -0
  101. package/templates/_shared/compound/persistence/scripts/sync-rest-contracts.ts.mustache +101 -0
  102. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/api-types.ts.mustache +21 -0
  103. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/api-validators.ts.mustache +32 -0
  104. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/api.ts.mustache +68 -0
  105. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/block.json.mustache +52 -0
  106. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/data.ts.mustache +192 -0
  107. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/edit.tsx.mustache +123 -0
  108. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/hooks.ts.mustache +11 -0
  109. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/interactivity.ts.mustache +132 -0
  110. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/render.php.mustache +158 -0
  111. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/save.tsx.mustache +3 -0
  112. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/types.ts.mustache +56 -0
  113. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/validators.ts.mustache +32 -0
  114. package/templates/_shared/compound/persistence-auth/{{slugKebabCase}}.php.mustache +294 -0
  115. package/templates/_shared/compound/persistence-public/{{slugKebabCase}}.php.mustache +312 -0
  116. package/templates/_shared/migration-ui/common/src/admin/migration-dashboard.tsx +394 -0
  117. package/templates/_shared/migration-ui/common/src/migration-detector.ts +9 -0
  118. package/templates/_shared/migration-ui/common/src/migrations/helpers.ts +490 -0
  119. package/templates/_shared/migration-ui/common/src/migrations/index.ts +886 -0
  120. package/templates/_shared/persistence/auth/{{slugKebabCase}}.php.mustache +290 -0
  121. package/templates/_shared/persistence/core/package.json.mustache +46 -0
  122. package/templates/_shared/persistence/core/scripts/sync-rest-contracts.ts.mustache +113 -0
  123. package/templates/_shared/persistence/core/scripts/sync-types-to-block-json.ts.mustache +125 -0
  124. package/templates/_shared/persistence/core/src/api-types.ts.mustache +21 -0
  125. package/templates/_shared/persistence/core/src/api-validators.ts.mustache +32 -0
  126. package/templates/_shared/persistence/core/src/api.ts.mustache +68 -0
  127. package/templates/_shared/persistence/core/src/data.ts.mustache +192 -0
  128. package/templates/_shared/persistence/core/src/index.tsx.mustache +25 -0
  129. package/templates/_shared/persistence/core/src/interactivity.ts.mustache +134 -0
  130. package/templates/_shared/persistence/core/src/save.tsx.mustache +5 -0
  131. package/templates/_shared/persistence/core/src/validators.ts.mustache +32 -0
  132. package/templates/_shared/persistence/core/{{slugKebabCase}}.php.mustache +336 -0
  133. package/templates/_shared/persistence/public/{{slugKebabCase}}.php.mustache +308 -0
  134. package/templates/_shared/presets/test-preset/.wp-env.test.json.mustache +16 -0
  135. package/templates/_shared/presets/test-preset/playwright.config.ts.mustache +22 -0
  136. package/templates/_shared/presets/test-preset/scripts/wait-for-wp-env.mjs.mustache +102 -0
  137. package/templates/_shared/presets/test-preset/scripts/wp-env-utils.cjs.mustache +32 -0
  138. package/templates/_shared/presets/test-preset/tests/e2e/smoke.spec.ts.mustache +34 -0
  139. package/templates/_shared/presets/wp-env/.wp-env.json.mustache +16 -0
  140. package/templates/_shared/rest-helpers/auth/inc/rest-auth.php.mustache +37 -0
  141. package/templates/_shared/rest-helpers/public/inc/rest-public.php.mustache +314 -0
  142. package/templates/_shared/rest-helpers/shared/inc/rest-shared.php.mustache +58 -0
  143. package/templates/_shared/workspace/persistence-auth/inc/rest-auth.php.mustache +36 -0
  144. package/templates/_shared/workspace/persistence-auth/inc/rest-shared.php.mustache +55 -0
  145. package/templates/_shared/workspace/persistence-auth/server.php.mustache +237 -0
  146. package/templates/_shared/workspace/persistence-public/inc/rest-public.php.mustache +273 -0
  147. package/templates/_shared/workspace/persistence-public/inc/rest-shared.php.mustache +55 -0
  148. package/templates/_shared/workspace/persistence-public/server.php.mustache +252 -0
  149. package/templates/basic/src/block.json.mustache +51 -0
  150. package/templates/basic/src/edit.tsx.mustache +128 -0
  151. package/templates/basic/src/editor.scss.mustache +8 -0
  152. package/templates/basic/src/hooks.ts.mustache +18 -0
  153. package/templates/basic/src/index.tsx.mustache +45 -0
  154. package/templates/basic/src/save.tsx.mustache +30 -0
  155. package/templates/basic/src/style.scss.mustache +40 -0
  156. package/templates/basic/src/types.ts.mustache +56 -0
  157. package/templates/basic/src/validators.ts.mustache +26 -0
  158. package/templates/compound/src/blocks/{{slugKebabCase}}/block.json.mustache +37 -0
  159. package/templates/compound/src/blocks/{{slugKebabCase}}/children.ts.mustache +25 -0
  160. package/templates/compound/src/blocks/{{slugKebabCase}}/edit.tsx.mustache +93 -0
  161. package/templates/compound/src/blocks/{{slugKebabCase}}/hooks.ts.mustache +11 -0
  162. package/templates/compound/src/blocks/{{slugKebabCase}}/index.tsx.mustache +25 -0
  163. package/templates/compound/src/blocks/{{slugKebabCase}}/save.tsx.mustache +32 -0
  164. package/templates/compound/src/blocks/{{slugKebabCase}}/style.scss.mustache +31 -0
  165. package/templates/compound/src/blocks/{{slugKebabCase}}/types.ts.mustache +13 -0
  166. package/templates/compound/src/blocks/{{slugKebabCase}}/validators.ts.mustache +17 -0
  167. package/templates/compound/src/blocks/{{slugKebabCase}}-item/block.json.mustache +35 -0
  168. package/templates/compound/src/blocks/{{slugKebabCase}}-item/edit.tsx.mustache +50 -0
  169. package/templates/compound/src/blocks/{{slugKebabCase}}-item/hooks.ts.mustache +11 -0
  170. package/templates/compound/src/blocks/{{slugKebabCase}}-item/index.tsx.mustache +25 -0
  171. package/templates/compound/src/blocks/{{slugKebabCase}}-item/save.tsx.mustache +24 -0
  172. package/templates/compound/src/blocks/{{slugKebabCase}}-item/types.ts.mustache +12 -0
  173. package/templates/compound/src/blocks/{{slugKebabCase}}-item/validators.ts.mustache +17 -0
  174. package/templates/interactivity/package.json.mustache +42 -0
  175. package/templates/interactivity/src/block.json.mustache +73 -0
  176. package/templates/interactivity/src/edit.tsx.mustache +270 -0
  177. package/templates/interactivity/src/index.tsx.mustache +32 -0
  178. package/templates/interactivity/src/interactivity.ts.mustache +152 -0
  179. package/templates/interactivity/src/save.tsx.mustache +101 -0
  180. package/templates/interactivity/src/style.scss.mustache +60 -0
  181. package/templates/interactivity/src/types.ts.mustache +32 -0
  182. package/templates/interactivity/src/validators.ts.mustache +36 -0
  183. package/templates/persistence/src/block.json.mustache +52 -0
  184. package/templates/persistence/src/edit.tsx.mustache +165 -0
  185. package/templates/persistence/src/render.php.mustache +126 -0
  186. package/templates/persistence/src/style.scss.mustache +46 -0
  187. package/templates/persistence/src/types.ts.mustache +55 -0
@@ -0,0 +1,233 @@
1
+ import { cloneJsonValue } from "./json-utils.js";
2
+ import { getWordPressKind, } from "./metadata-model.js";
3
+ export function createBlockJsonAttribute(node, warnings) {
4
+ const attribute = {
5
+ type: getWordPressKind(node),
6
+ };
7
+ if (node.defaultValue !== undefined) {
8
+ attribute.default = cloneJsonValue(node.defaultValue);
9
+ }
10
+ if (node.enumValues !== null && node.enumValues.length > 0) {
11
+ attribute.enum = [...node.enumValues];
12
+ }
13
+ if (node.wp.source !== null) {
14
+ attribute.source = node.wp.source;
15
+ }
16
+ if (node.wp.selector !== null) {
17
+ attribute.selector = node.wp.selector;
18
+ }
19
+ const reasons = [];
20
+ if (node.constraints.exclusiveMaximum !== null)
21
+ reasons.push("exclusiveMaximum");
22
+ if (node.constraints.exclusiveMinimum !== null)
23
+ reasons.push("exclusiveMinimum");
24
+ if (node.constraints.format !== null)
25
+ reasons.push("format");
26
+ if (node.constraints.maxLength !== null)
27
+ reasons.push("maxLength");
28
+ if (node.constraints.maxItems !== null)
29
+ reasons.push("maxItems");
30
+ if (node.constraints.maximum !== null)
31
+ reasons.push("maximum");
32
+ if (node.constraints.minLength !== null)
33
+ reasons.push("minLength");
34
+ if (node.constraints.minItems !== null)
35
+ reasons.push("minItems");
36
+ if (node.constraints.minimum !== null)
37
+ reasons.push("minimum");
38
+ if (node.constraints.multipleOf !== null)
39
+ reasons.push("multipleOf");
40
+ if (node.constraints.pattern !== null)
41
+ reasons.push("pattern");
42
+ if (node.constraints.typeTag !== null)
43
+ reasons.push("typeTag");
44
+ if (node.kind === "array" && node.items !== undefined)
45
+ reasons.push("items");
46
+ if (node.kind === "object" && node.properties !== undefined)
47
+ reasons.push("properties");
48
+ if (node.kind === "union" && node.union !== null)
49
+ reasons.push("union");
50
+ if (reasons.length > 0) {
51
+ warnings.push(`${node.path}: ${reasons.join(", ")}`);
52
+ }
53
+ return attribute;
54
+ }
55
+ export function createManifestAttribute(node) {
56
+ return {
57
+ typia: {
58
+ constraints: { ...node.constraints },
59
+ defaultValue: node.defaultValue === undefined ? null : cloneJsonValue(node.defaultValue),
60
+ hasDefault: node.defaultValue !== undefined,
61
+ },
62
+ ts: {
63
+ items: node.items ? createManifestAttribute(node.items) : null,
64
+ kind: node.kind,
65
+ properties: node.properties
66
+ ? Object.fromEntries(Object.entries(node.properties).map(([key, property]) => [
67
+ key,
68
+ createManifestAttribute(property),
69
+ ]))
70
+ : null,
71
+ required: node.required,
72
+ union: node.union
73
+ ? {
74
+ branches: Object.fromEntries(Object.entries(node.union.branches).map(([key, branch]) => [
75
+ key,
76
+ createManifestAttribute(branch),
77
+ ])),
78
+ discriminator: node.union.discriminator,
79
+ }
80
+ : null,
81
+ },
82
+ wp: {
83
+ defaultValue: node.defaultValue === undefined ? null : cloneJsonValue(node.defaultValue),
84
+ enum: node.enumValues ? [...node.enumValues] : null,
85
+ hasDefault: node.defaultValue !== undefined,
86
+ ...(node.wp.selector !== null ? { selector: node.wp.selector } : {}),
87
+ ...(node.wp.source !== null ? { source: node.wp.source } : {}),
88
+ type: getWordPressKind(node),
89
+ },
90
+ };
91
+ }
92
+ export function createManifestDocument(sourceTypeName, attributes) {
93
+ return {
94
+ attributes: Object.fromEntries(Object.entries(attributes).map(([key, node]) => [
95
+ key,
96
+ createManifestAttribute(node),
97
+ ])),
98
+ manifestVersion: 2,
99
+ sourceType: sourceTypeName,
100
+ };
101
+ }
102
+ export function validateWordPressExtractionAttributes(attributes) {
103
+ for (const attribute of Object.values(attributes)) {
104
+ validateWordPressExtractionAttribute(attribute, true);
105
+ }
106
+ }
107
+ export function validateWordPressExtractionAttribute(node, isTopLevel = false) {
108
+ const hasSelector = node.wp.selector !== null;
109
+ const hasSource = node.wp.source !== null;
110
+ if (hasSelector || hasSource) {
111
+ if (!isTopLevel) {
112
+ throw new Error(`WordPress extraction tags are only supported on top-level block attributes at ${node.path}`);
113
+ }
114
+ if (!hasSelector || !hasSource) {
115
+ throw new Error(`WordPress extraction tags require both Source and Selector at ${node.path}`);
116
+ }
117
+ if (node.kind !== "string") {
118
+ throw new Error(`WordPress extraction tags are only supported on string attributes at ${node.path}`);
119
+ }
120
+ }
121
+ if (node.items !== undefined) {
122
+ validateWordPressExtractionAttribute(node.items, false);
123
+ }
124
+ if (node.properties !== undefined) {
125
+ for (const property of Object.values(node.properties)) {
126
+ validateWordPressExtractionAttribute(property, false);
127
+ }
128
+ }
129
+ if (node.union?.branches) {
130
+ for (const branch of Object.values(node.union.branches)) {
131
+ validateWordPressExtractionAttribute(branch, false);
132
+ }
133
+ }
134
+ }
135
+ export function createExampleValue(node, key) {
136
+ if (node.defaultValue !== undefined) {
137
+ return cloneJsonValue(node.defaultValue);
138
+ }
139
+ if (node.enumValues !== null && node.enumValues.length > 0) {
140
+ return cloneJsonValue(node.enumValues[0]);
141
+ }
142
+ switch (node.kind) {
143
+ case "string":
144
+ return fitStringExampleToConstraints(createFormattedStringExample(node.constraints.format, key), node.constraints);
145
+ case "number":
146
+ return createNumericExample(node);
147
+ case "boolean":
148
+ return true;
149
+ case "array":
150
+ return createArrayExample(node, key);
151
+ case "object":
152
+ return Object.fromEntries(Object.entries(node.properties ?? {}).map(([propertyKey, propertyNode]) => [
153
+ propertyKey,
154
+ createExampleValue(propertyNode, propertyKey),
155
+ ]));
156
+ case "union": {
157
+ const firstBranch = node.union
158
+ ? Object.values(node.union.branches)[0]
159
+ : undefined;
160
+ if (!firstBranch || firstBranch.kind !== "object") {
161
+ return {};
162
+ }
163
+ return Object.fromEntries(Object.entries(firstBranch.properties ?? {}).map(([propertyKey, propertyNode]) => [
164
+ propertyKey,
165
+ createExampleValue(propertyNode, propertyKey),
166
+ ]));
167
+ }
168
+ }
169
+ }
170
+ function createFormattedStringExample(format, key) {
171
+ switch (format) {
172
+ case "uuid":
173
+ return "00000000-0000-4000-8000-000000000000";
174
+ case "email":
175
+ return "example@example.com";
176
+ case "url":
177
+ case "uri":
178
+ return "https://example.com";
179
+ case "ipv4":
180
+ return "127.0.0.1";
181
+ case "ipv6":
182
+ return "::1";
183
+ case "date-time":
184
+ return "2024-01-01T00:00:00Z";
185
+ default:
186
+ return `Example ${key}`;
187
+ }
188
+ }
189
+ function fitStringExampleToConstraints(value, constraints) {
190
+ let nextValue = value;
191
+ if (constraints.maxLength !== null &&
192
+ nextValue.length > constraints.maxLength) {
193
+ nextValue = nextValue.slice(0, constraints.maxLength);
194
+ }
195
+ if (constraints.minLength !== null &&
196
+ nextValue.length < constraints.minLength) {
197
+ nextValue = nextValue.padEnd(constraints.minLength, "x");
198
+ }
199
+ return nextValue;
200
+ }
201
+ function createNumericExample(node) {
202
+ const { exclusiveMaximum, exclusiveMinimum, maximum, minimum, multipleOf, } = node.constraints;
203
+ const step = multipleOf && multipleOf !== 0 ? multipleOf : 1;
204
+ const minCandidate = minimum ?? (exclusiveMinimum !== null ? exclusiveMinimum + step : null);
205
+ const maxCandidate = maximum ?? (exclusiveMaximum !== null ? exclusiveMaximum - step : null);
206
+ let candidate = multipleOf && multipleOf !== 0
207
+ ? minCandidate !== null
208
+ ? Math.ceil(minCandidate / multipleOf) * multipleOf
209
+ : maxCandidate !== null
210
+ ? Math.floor(maxCandidate / multipleOf) * multipleOf
211
+ : multipleOf
212
+ : minCandidate ?? maxCandidate ?? 42;
213
+ if (maxCandidate !== null && candidate > maxCandidate) {
214
+ candidate =
215
+ multipleOf && multipleOf !== 0
216
+ ? Math.floor(maxCandidate / multipleOf) * multipleOf
217
+ : maxCandidate;
218
+ }
219
+ if (minCandidate !== null && candidate < minCandidate) {
220
+ candidate =
221
+ multipleOf && multipleOf !== 0
222
+ ? Math.ceil(minCandidate / multipleOf) * multipleOf
223
+ : minCandidate;
224
+ }
225
+ return candidate;
226
+ }
227
+ function createArrayExample(node, key) {
228
+ const minimumItems = Math.max(node.constraints.minItems ?? 0, 0);
229
+ if (minimumItems === 0 || node.items === undefined) {
230
+ return [];
231
+ }
232
+ return Array.from({ length: minimumItems }, (_value, index) => createExampleValue(node.items, `${key}${index + 1}`));
233
+ }
@@ -0,0 +1,15 @@
1
+ export declare const ROOT_BLOCK_JSON = "block.json";
2
+ export declare const ROOT_MANIFEST = "typia.manifest.json";
3
+ export declare const ROOT_PHP_MIGRATION_REGISTRY = "typia-migration-registry.php";
4
+ export declare const SRC_BLOCK_JSON: string;
5
+ export declare const SRC_MANIFEST: string;
6
+ export declare const ROOT_SAVE_FILE: string;
7
+ export declare const ROOT_TYPES_FILE: string;
8
+ export declare const MIGRATIONS_DIR: string;
9
+ export declare const CONFIG_FILE: string;
10
+ export declare const GENERATED_DIR: string;
11
+ export declare const FIXTURES_DIR: string;
12
+ export declare const RULES_DIR: string;
13
+ export declare const SNAPSHOT_DIR: string;
14
+ export declare const SUPPORTED_PROJECT_FILES: string[];
15
+ export declare const MIGRATION_TODO_PREFIX = "TODO MIGRATION:";
@@ -0,0 +1,16 @@
1
+ import path from "node:path";
2
+ export const ROOT_BLOCK_JSON = "block.json";
3
+ export const ROOT_MANIFEST = "typia.manifest.json";
4
+ export const ROOT_PHP_MIGRATION_REGISTRY = "typia-migration-registry.php";
5
+ export const SRC_BLOCK_JSON = path.join("src", "block.json");
6
+ export const SRC_MANIFEST = path.join("src", "typia.manifest.json");
7
+ export const ROOT_SAVE_FILE = path.join("src", "save.tsx");
8
+ export const ROOT_TYPES_FILE = path.join("src", "types.ts");
9
+ export const MIGRATIONS_DIR = path.join("src", "migrations");
10
+ export const CONFIG_FILE = path.join(MIGRATIONS_DIR, "config.ts");
11
+ export const GENERATED_DIR = path.join(MIGRATIONS_DIR, "generated");
12
+ export const FIXTURES_DIR = path.join(MIGRATIONS_DIR, "fixtures");
13
+ export const RULES_DIR = path.join(MIGRATIONS_DIR, "rules");
14
+ export const SNAPSHOT_DIR = path.join(MIGRATIONS_DIR, "versions");
15
+ export const SUPPORTED_PROJECT_FILES = ["package.json", ROOT_BLOCK_JSON, ROOT_SAVE_FILE, ROOT_TYPES_FILE];
16
+ export const MIGRATION_TODO_PREFIX = "TODO MIGRATION:";
@@ -0,0 +1,2 @@
1
+ import type { MigrationBlockConfig, MigrationDiff, MigrationProjectState, ResolvedMigrationBlockTarget } from "./migration-types.js";
2
+ export declare function createMigrationDiff(state: MigrationProjectState, blockOrFromVersion: MigrationBlockConfig | ResolvedMigrationBlockTarget | string, fromVersionOrToVersion: string, maybeToVersion?: string): MigrationDiff;