@lark-apaas/fullstack-cli 1.1.22-alpha.23 → 1.1.22-alpha.25
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/gen-dbschema-template/types.ts +0 -57
- package/dist/index.js +10 -16
- package/package.json +1 -1
|
@@ -160,60 +160,3 @@ export const fileType = customType<{
|
|
|
160
160
|
},
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
/**
|
|
164
|
-
* User type array for user_profile_domain[]
|
|
165
|
-
*/
|
|
166
|
-
export const userTypeArray = customType<{
|
|
167
|
-
data: string[];
|
|
168
|
-
driverData: string;
|
|
169
|
-
}>({
|
|
170
|
-
dataType() {
|
|
171
|
-
return 'user_profile_domain[]';
|
|
172
|
-
},
|
|
173
|
-
toDriver(value: string[]) {
|
|
174
|
-
return sql`${value}`;
|
|
175
|
-
},
|
|
176
|
-
fromDriver(value: string): string[] {
|
|
177
|
-
if (!value || value === '{}') return [];
|
|
178
|
-
// Parse PostgreSQL array format: {"item1","item2"}
|
|
179
|
-
const inner = value.slice(1, -1);
|
|
180
|
-
if (!inner) return [];
|
|
181
|
-
return inner.split(',').map(item => {
|
|
182
|
-
// Handle quoted strings
|
|
183
|
-
const trimmed = item.trim();
|
|
184
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
185
|
-
return trimmed.slice(1, -1).replace(/\\"/g, '"');
|
|
186
|
-
}
|
|
187
|
-
return trimmed;
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* File type array for file_attachment_domain[]
|
|
194
|
-
*/
|
|
195
|
-
export const fileTypeArray = customType<{
|
|
196
|
-
data: string[];
|
|
197
|
-
driverData: string;
|
|
198
|
-
}>({
|
|
199
|
-
dataType() {
|
|
200
|
-
return 'file_attachment_domain[]';
|
|
201
|
-
},
|
|
202
|
-
toDriver(value: string[]) {
|
|
203
|
-
return sql`${value}`;
|
|
204
|
-
},
|
|
205
|
-
fromDriver(value: string): string[] {
|
|
206
|
-
if (!value || value === '{}') return [];
|
|
207
|
-
// Parse PostgreSQL array format: {"item1","item2"}
|
|
208
|
-
const inner = value.slice(1, -1);
|
|
209
|
-
if (!inner) return [];
|
|
210
|
-
return inner.split(',').map(item => {
|
|
211
|
-
// Handle quoted strings
|
|
212
|
-
const trimmed = item.trim();
|
|
213
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
214
|
-
return trimmed.slice(1, -1).replace(/\\"/g, '"');
|
|
215
|
-
}
|
|
216
|
-
return trimmed;
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
});
|
package/dist/index.js
CHANGED
|
@@ -469,18 +469,12 @@ var patchDefectsTransform = {
|
|
|
469
469
|
// src/commands/db/gen-dbschema/transforms/ast/replace-unknown.ts
|
|
470
470
|
import { Node as Node5 } from "ts-morph";
|
|
471
471
|
var KNOWN_TYPE_FACTORIES = {
|
|
472
|
-
// Domain types (new)
|
|
472
|
+
// Domain types (new) - array handled natively via .array()
|
|
473
473
|
user_profile_domain: "userType",
|
|
474
474
|
file_attachment_domain: "fileType",
|
|
475
|
-
// Domain array types (new)
|
|
476
|
-
"user_profile_domain[]": "userTypeArray",
|
|
477
|
-
"file_attachment_domain[]": "fileTypeArray",
|
|
478
475
|
// Legacy composite types (deprecated but kept for compatibility)
|
|
479
476
|
user_profile: "userProfile",
|
|
480
|
-
file_attachment: "fileAttachment"
|
|
481
|
-
// Legacy array types
|
|
482
|
-
"user_profile[]": "userProfile",
|
|
483
|
-
"file_attachment[]": "fileAttachment"
|
|
477
|
+
file_attachment: "fileAttachment"
|
|
484
478
|
};
|
|
485
479
|
var KNOWN_ARRAY_TYPE_FACTORIES = {
|
|
486
480
|
user_profile: "userProfileArray",
|
|
@@ -505,19 +499,19 @@ var replaceUnknownTransform = {
|
|
|
505
499
|
const lines = textBefore.split("\n");
|
|
506
500
|
let factoryName = "text";
|
|
507
501
|
let foundKnownType = false;
|
|
508
|
-
let
|
|
502
|
+
let shouldRemoveArray = false;
|
|
509
503
|
for (let i = lines.length - 1; i >= Math.max(0, lines.length - 5); i--) {
|
|
510
504
|
const line = lines[i];
|
|
511
505
|
const todoMatch = line.match(/\/\/ TODO: failed to parse database type '(?:\w+\.)?([\w_]+)(\[\])?'/);
|
|
512
506
|
if (todoMatch) {
|
|
513
507
|
const baseTypeName = todoMatch[1];
|
|
514
|
-
isArrayType = todoMatch[2] === "[]";
|
|
515
|
-
const typeName = baseTypeName + (todoMatch[2] || "");
|
|
508
|
+
const isArrayType = todoMatch[2] === "[]";
|
|
516
509
|
if (isArrayType && KNOWN_ARRAY_TYPE_FACTORIES[baseTypeName]) {
|
|
517
510
|
factoryName = KNOWN_ARRAY_TYPE_FACTORIES[baseTypeName];
|
|
518
511
|
foundKnownType = true;
|
|
519
|
-
|
|
520
|
-
|
|
512
|
+
shouldRemoveArray = true;
|
|
513
|
+
} else if (KNOWN_TYPE_FACTORIES[baseTypeName]) {
|
|
514
|
+
factoryName = KNOWN_TYPE_FACTORIES[baseTypeName];
|
|
521
515
|
foundKnownType = true;
|
|
522
516
|
}
|
|
523
517
|
break;
|
|
@@ -527,13 +521,13 @@ var replaceUnknownTransform = {
|
|
|
527
521
|
expression,
|
|
528
522
|
factoryName,
|
|
529
523
|
foundKnownType,
|
|
530
|
-
|
|
524
|
+
shouldRemoveArray,
|
|
531
525
|
node
|
|
532
526
|
});
|
|
533
527
|
});
|
|
534
|
-
for (const { expression, factoryName, foundKnownType,
|
|
528
|
+
for (const { expression, factoryName, foundKnownType, shouldRemoveArray, node } of replacements) {
|
|
535
529
|
expression.replaceWithText(factoryName);
|
|
536
|
-
if (
|
|
530
|
+
if (shouldRemoveArray) {
|
|
537
531
|
const parent = node.getParent();
|
|
538
532
|
if (Node5.isPropertyAccessExpression(parent) && parent.getName() === "array") {
|
|
539
533
|
const grandParent = parent.getParent();
|