@lark-apaas/fullstack-cli 1.1.22-alpha.22 → 1.1.22-alpha.24

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.
@@ -120,4 +120,100 @@ export const customTimestamptz = customType<{
120
120
  if(value instanceof Date) return value;
121
121
  return new Date(value);
122
122
  },
123
+ });
124
+
125
+ /**
126
+ * User type marker for user_profile_domain
127
+ * Simple marker type, no conversion needed - passes through as string
128
+ */
129
+ export const userType = customType<{
130
+ data: string;
131
+ driverData: string;
132
+ }>({
133
+ dataType() {
134
+ return 'user_profile_domain';
135
+ },
136
+ toDriver(value: string) {
137
+ return value;
138
+ },
139
+ fromDriver(value: string) {
140
+ return value;
141
+ },
142
+ });
143
+
144
+ /**
145
+ * File type marker for file_attachment_domain
146
+ * Simple marker type, no conversion needed - passes through as string
147
+ */
148
+ export const fileType = customType<{
149
+ data: string;
150
+ driverData: string;
151
+ }>({
152
+ dataType() {
153
+ return 'file_attachment_domain';
154
+ },
155
+ toDriver(value: string) {
156
+ return value;
157
+ },
158
+ fromDriver(value: string) {
159
+ return value;
160
+ },
161
+ });
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
+ },
123
219
  });
package/dist/index.js CHANGED
@@ -469,8 +469,18 @@ 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)
473
+ user_profile_domain: "userType",
474
+ file_attachment_domain: "fileType",
475
+ // Domain array types (new)
476
+ "user_profile_domain[]": "userTypeArray",
477
+ "file_attachment_domain[]": "fileTypeArray",
478
+ // Legacy composite types (deprecated but kept for compatibility)
472
479
  user_profile: "userProfile",
473
- file_attachment: "fileAttachment"
480
+ file_attachment: "fileAttachment",
481
+ // Legacy array types
482
+ "user_profile[]": "userProfile",
483
+ "file_attachment[]": "fileAttachment"
474
484
  };
475
485
  var KNOWN_ARRAY_TYPE_FACTORIES = {
476
486
  user_profile: "userProfileArray",
@@ -500,10 +510,11 @@ var replaceUnknownTransform = {
500
510
  const line = lines[i];
501
511
  const todoMatch = line.match(/\/\/ TODO: failed to parse database type '(?:\w+\.)?([\w_]+)(\[\])?'/);
502
512
  if (todoMatch) {
503
- const typeName = todoMatch[1];
513
+ const baseTypeName = todoMatch[1];
504
514
  isArrayType = todoMatch[2] === "[]";
505
- if (isArrayType && KNOWN_ARRAY_TYPE_FACTORIES[typeName]) {
506
- factoryName = KNOWN_ARRAY_TYPE_FACTORIES[typeName];
515
+ const typeName = baseTypeName + (todoMatch[2] || "");
516
+ if (isArrayType && KNOWN_ARRAY_TYPE_FACTORIES[baseTypeName]) {
517
+ factoryName = KNOWN_ARRAY_TYPE_FACTORIES[baseTypeName];
507
518
  foundKnownType = true;
508
519
  } else if (KNOWN_TYPE_FACTORIES[typeName]) {
509
520
  factoryName = KNOWN_TYPE_FACTORIES[typeName];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.22-alpha.22",
3
+ "version": "1.1.22-alpha.24",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",