@atmyapp/cli 0.0.3 → 0.0.6
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/README.md
CHANGED
|
@@ -275,6 +275,21 @@ export type UserManual = AmaFileDef<"/docs/manual.pdf">;
|
|
|
275
275
|
export type ATMYAPP = [HeroImage, UserManual];
|
|
276
276
|
```
|
|
277
277
|
|
|
278
|
+
### Icon Definitions
|
|
279
|
+
|
|
280
|
+
Define icons with `AmaIconDef` (simpler than images, no configuration needed):
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
import { AmaIconDef } from "@atmyapp/core";
|
|
284
|
+
|
|
285
|
+
// Icon definitions
|
|
286
|
+
export type MenuIcon = AmaIconDef<"/icons/menu">;
|
|
287
|
+
export type SearchIcon = AmaIconDef<"/icons/search">;
|
|
288
|
+
export type UserIcon = AmaIconDef<"/icons/user">;
|
|
289
|
+
|
|
290
|
+
export type ATMYAPP = [MenuIcon, SearchIcon, UserIcon];
|
|
291
|
+
```
|
|
292
|
+
|
|
278
293
|
## 💡 Examples
|
|
279
294
|
|
|
280
295
|
### 🏪 E-commerce Setup
|
|
@@ -305,6 +320,11 @@ export type ProductImage = AmaImageDef<
|
|
|
305
320
|
}
|
|
306
321
|
>;
|
|
307
322
|
|
|
323
|
+
// UI Icons
|
|
324
|
+
export type CartIcon = AmaIconDef<"/icons/cart">;
|
|
325
|
+
export type WishlistIcon = AmaIconDef<"/icons/wishlist">;
|
|
326
|
+
export type CompareIcon = AmaIconDef<"/icons/compare">;
|
|
327
|
+
|
|
308
328
|
// E-commerce events
|
|
309
329
|
export type ProductViewEvent = AmaCustomEventDef<
|
|
310
330
|
"product_view",
|
|
@@ -326,6 +346,9 @@ export type ATMYAPP = [
|
|
|
326
346
|
ProductCatalog,
|
|
327
347
|
FeaturedProduct,
|
|
328
348
|
ProductImage,
|
|
349
|
+
CartIcon,
|
|
350
|
+
WishlistIcon,
|
|
351
|
+
CompareIcon,
|
|
329
352
|
ProductViewEvent,
|
|
330
353
|
AddToCartEvent,
|
|
331
354
|
PurchaseEvent,
|
|
@@ -336,7 +359,12 @@ export type ATMYAPP = [
|
|
|
336
359
|
|
|
337
360
|
```typescript
|
|
338
361
|
// types/blog.ts
|
|
339
|
-
import {
|
|
362
|
+
import {
|
|
363
|
+
AmaContentDef,
|
|
364
|
+
AmaCustomEventDef,
|
|
365
|
+
AmaImageDef,
|
|
366
|
+
AmaIconDef,
|
|
367
|
+
} from "@atmyapp/core";
|
|
340
368
|
|
|
341
369
|
// Blog content types
|
|
342
370
|
interface BlogPost {
|
|
@@ -375,6 +403,11 @@ export type BlogHeroImage = AmaImageDef<
|
|
|
375
403
|
}
|
|
376
404
|
>;
|
|
377
405
|
|
|
406
|
+
// Blog UI icons
|
|
407
|
+
export type ShareIcon = AmaIconDef<"/icons/share">;
|
|
408
|
+
export type LikeIcon = AmaIconDef<"/icons/like">;
|
|
409
|
+
export type CommentIcon = AmaIconDef<"/icons/comment">;
|
|
410
|
+
|
|
378
411
|
// Blog analytics events
|
|
379
412
|
export type ArticleReadEvent = AmaCustomEventDef<
|
|
380
413
|
"article_read",
|
|
@@ -396,6 +429,9 @@ export type ATMYAPP = [
|
|
|
396
429
|
FeaturedPost,
|
|
397
430
|
Categories,
|
|
398
431
|
BlogHeroImage,
|
|
432
|
+
ShareIcon,
|
|
433
|
+
LikeIcon,
|
|
434
|
+
CommentIcon,
|
|
399
435
|
ArticleReadEvent,
|
|
400
436
|
CommentEvent,
|
|
401
437
|
ShareEvent,
|
|
@@ -462,7 +498,8 @@ your-project/
|
|
|
462
498
|
├── types/
|
|
463
499
|
│ ├── content.ts # Content definitions
|
|
464
500
|
│ ├── events.ts # Event definitions
|
|
465
|
-
│
|
|
501
|
+
│ ├── media.ts # Image/file definitions
|
|
502
|
+
│ └── icons.ts # Icon definitions
|
|
466
503
|
├── .gitignore # Updated automatically
|
|
467
504
|
└── tsconfig.json # TypeScript config
|
|
468
505
|
```
|
|
@@ -520,7 +557,7 @@ uploadDefinitions(output)
|
|
|
520
557
|
### Built-in Processors
|
|
521
558
|
|
|
522
559
|
- **pathNormalizer** - Normalizes file paths across platforms
|
|
523
|
-
- **typeDetector** - Detects content, event, image, and
|
|
560
|
+
- **typeDetector** - Detects content, event, image, file, and icon types
|
|
524
561
|
- **duplicateValidator** - Prevents duplicate path definitions
|
|
525
562
|
- **metadataEnricher** - Adds processing metadata to output
|
|
526
563
|
|
|
@@ -585,35 +622,17 @@ tests/
|
|
|
585
622
|
### Example Test
|
|
586
623
|
|
|
587
624
|
```typescript
|
|
588
|
-
describe("
|
|
589
|
-
it("should
|
|
625
|
+
describe("Icon Processing", () => {
|
|
626
|
+
it("should detect and process icon definitions", () => {
|
|
590
627
|
const contents: Content[] = [
|
|
591
628
|
{
|
|
592
|
-
path: "
|
|
593
|
-
structure: {
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
path: "page_view_event",
|
|
597
|
-
structure: {
|
|
598
|
-
type: "event",
|
|
599
|
-
properties: {
|
|
600
|
-
id: { const: "page_view" },
|
|
601
|
-
columns: { const: ["page", "user_id", "timestamp"] },
|
|
602
|
-
type: { const: "event" },
|
|
603
|
-
},
|
|
604
|
-
},
|
|
629
|
+
path: "/icons/menu",
|
|
630
|
+
structure: { __amatype: "AmaIconDef" },
|
|
605
631
|
},
|
|
606
632
|
];
|
|
607
633
|
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
expect(output.definitions["hero.json"]).toBeDefined();
|
|
611
|
-
expect(output.events["page_view"]).toBeDefined();
|
|
612
|
-
expect(output.events["page_view"]).toHaveProperty("columns", [
|
|
613
|
-
"page",
|
|
614
|
-
"user_id",
|
|
615
|
-
"timestamp",
|
|
616
|
-
]);
|
|
634
|
+
const contentType = determineContentType(contents[0]);
|
|
635
|
+
expect(contentType).toBe("icon");
|
|
617
636
|
});
|
|
618
637
|
});
|
|
619
638
|
```
|
|
@@ -625,13 +644,13 @@ describe("Event Processing", () => {
|
|
|
625
644
|
✅ **Do:**
|
|
626
645
|
|
|
627
646
|
- Group related definitions in separate files
|
|
628
|
-
- Use descriptive type names
|
|
647
|
+
- Use descriptive type names for icons (e.g., `MenuIcon`, `SearchIcon`)
|
|
629
648
|
- Keep event column order consistent
|
|
630
649
|
- Include comprehensive type documentation
|
|
631
650
|
|
|
632
651
|
❌ **Don't:**
|
|
633
652
|
|
|
634
|
-
- Mix content and
|
|
653
|
+
- Mix content, event, and media definitions unnecessarily
|
|
635
654
|
- Use dynamic or computed type names
|
|
636
655
|
- Ignore TypeScript compiler errors
|
|
637
656
|
|
|
@@ -15,21 +15,28 @@ function initializePipeline() {
|
|
|
15
15
|
}
|
|
16
16
|
// Determines the content type based on its structure and path
|
|
17
17
|
function determineContentType(content) {
|
|
18
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
19
19
|
// Extract file extension
|
|
20
20
|
const fileExt = (_a = content.path.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
21
|
-
// Check for event types
|
|
21
|
+
// Check for event types - support both custom events and basic events
|
|
22
22
|
if (((_b = content.structure) === null || _b === void 0 ? void 0 : _b.type) === "event" ||
|
|
23
|
-
((
|
|
24
|
-
((_f = content.structure) === null || _f === void 0 ? void 0 : _f.
|
|
23
|
+
((_c = content.structure) === null || _c === void 0 ? void 0 : _c.type) === "basic_event" ||
|
|
24
|
+
((_f = (_e = (_d = content.structure) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.const) === "event" ||
|
|
25
|
+
((_j = (_h = (_g = content.structure) === null || _g === void 0 ? void 0 : _g.properties) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.const) === "basic_event" ||
|
|
26
|
+
((_k = content.structure) === null || _k === void 0 ? void 0 : _k.__amatype) === "AmaCustomEventDef" ||
|
|
27
|
+
((_l = content.structure) === null || _l === void 0 ? void 0 : _l.__amatype) === "AmaEventDef") {
|
|
25
28
|
return "event";
|
|
26
29
|
}
|
|
30
|
+
// Check for icon types based on structure
|
|
31
|
+
if (((_m = content.structure) === null || _m === void 0 ? void 0 : _m.__amatype) === "AmaIconDef") {
|
|
32
|
+
return "icon";
|
|
33
|
+
}
|
|
27
34
|
// Check for image types based on structure or extension
|
|
28
|
-
if (((
|
|
35
|
+
if (((_o = content.structure) === null || _o === void 0 ? void 0 : _o.__amatype) === "AmaImageDef") {
|
|
29
36
|
return "image";
|
|
30
37
|
}
|
|
31
38
|
// Check for file types
|
|
32
|
-
if (((
|
|
39
|
+
if (((_p = content.structure) === null || _p === void 0 ? void 0 : _p.__amatype) === "AmaFileDef") {
|
|
33
40
|
return "file";
|
|
34
41
|
}
|
|
35
42
|
// Default type for other content
|
|
@@ -59,7 +66,9 @@ function extractEventConfig(content) {
|
|
|
59
66
|
else if ((_m = content.structure) === null || _m === void 0 ? void 0 : _m.id) {
|
|
60
67
|
eventId = content.structure.id;
|
|
61
68
|
}
|
|
62
|
-
|
|
69
|
+
// For basic events, columns might be empty (they use Record<string, string>)
|
|
70
|
+
// So we allow empty columns array for basic events
|
|
71
|
+
if (eventId) {
|
|
63
72
|
return { columns };
|
|
64
73
|
}
|
|
65
74
|
}
|
|
@@ -133,7 +133,7 @@ exports.builtInProcessors = {
|
|
|
133
133
|
typeDetector: {
|
|
134
134
|
name: "type-detector",
|
|
135
135
|
process: (content, context) => {
|
|
136
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
137
137
|
const { logger } = context;
|
|
138
138
|
// Extract file extension
|
|
139
139
|
const fileExt = (_a = content.path.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
@@ -143,10 +143,13 @@ exports.builtInProcessors = {
|
|
|
143
143
|
((_f = content.structure) === null || _f === void 0 ? void 0 : _f.__amatype) === "AmaCustomEventDef") {
|
|
144
144
|
content.type = "event";
|
|
145
145
|
}
|
|
146
|
-
else if (((_g = content.structure) === null || _g === void 0 ? void 0 : _g.__amatype) === "
|
|
146
|
+
else if (((_g = content.structure) === null || _g === void 0 ? void 0 : _g.__amatype) === "AmaIconDef") {
|
|
147
|
+
content.type = "icon";
|
|
148
|
+
}
|
|
149
|
+
else if (((_h = content.structure) === null || _h === void 0 ? void 0 : _h.__amatype) === "AmaImageDef") {
|
|
147
150
|
content.type = "image";
|
|
148
151
|
}
|
|
149
|
-
else if (((
|
|
152
|
+
else if (((_j = content.structure) === null || _j === void 0 ? void 0 : _j.__amatype) === "AmaFileDef") {
|
|
150
153
|
content.type = "file";
|
|
151
154
|
}
|
|
152
155
|
else if (["jpg", "jpeg", "png", "gif", "svg", "webp"].includes(fileExt || "")) {
|
|
@@ -138,39 +138,58 @@ function extractEventInfoFromAST(file, definitionType, logger) {
|
|
|
138
138
|
logger.verbose_log(`Type alias ${definitionType} has no type node`);
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
141
|
-
// Check if this is a type reference (like AmaCustomEventDef<...>)
|
|
141
|
+
// Check if this is a type reference (like AmaCustomEventDef<...> or AmaEventDef<...>)
|
|
142
142
|
if (ts_morph_1.Node.isTypeReference(typeNode)) {
|
|
143
143
|
const typeName = typeNode.getTypeName();
|
|
144
144
|
const typeArguments = typeNode.getTypeArguments();
|
|
145
|
-
// Check if this is AmaCustomEventDef
|
|
146
|
-
if (ts_morph_1.Node.isIdentifier(typeName)
|
|
147
|
-
typeName.getText()
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
145
|
+
// Check if this is AmaCustomEventDef or AmaEventDef
|
|
146
|
+
if (ts_morph_1.Node.isIdentifier(typeName)) {
|
|
147
|
+
const typeNameText = typeName.getText();
|
|
148
|
+
if (typeNameText === "AmaCustomEventDef") {
|
|
149
|
+
if (typeArguments.length >= 2) {
|
|
150
|
+
// First argument should be the event ID (string literal)
|
|
151
|
+
const idArg = typeArguments[0];
|
|
152
|
+
let eventId = null;
|
|
153
|
+
if (ts_morph_1.Node.isLiteralTypeNode(idArg)) {
|
|
154
|
+
const literal = idArg.getLiteral();
|
|
155
|
+
if (ts_morph_1.Node.isStringLiteral(literal)) {
|
|
156
|
+
eventId = literal.getLiteralValue();
|
|
157
|
+
}
|
|
156
158
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
159
|
+
// Second argument should be the columns (tuple of string literals)
|
|
160
|
+
const columnsArg = typeArguments[1];
|
|
161
|
+
let columns = [];
|
|
162
|
+
if (ts_morph_1.Node.isTupleTypeNode(columnsArg)) {
|
|
163
|
+
columnsArg.getElements().forEach((element) => {
|
|
164
|
+
if (ts_morph_1.Node.isLiteralTypeNode(element)) {
|
|
165
|
+
const literal = element.getLiteral();
|
|
166
|
+
if (ts_morph_1.Node.isStringLiteral(literal)) {
|
|
167
|
+
columns.push(literal.getLiteralValue());
|
|
168
|
+
}
|
|
167
169
|
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (eventId && columns.length > 0) {
|
|
173
|
+
logger.verbose_log(`AST extraction successful for ${definitionType}: id=${eventId}, columns=[${columns.join(", ")}]`);
|
|
174
|
+
return { id: eventId, columns };
|
|
175
|
+
}
|
|
170
176
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
}
|
|
178
|
+
else if (typeNameText === "AmaEventDef") {
|
|
179
|
+
// Handle AmaEventDef (basic events) - only has ID argument
|
|
180
|
+
if (typeArguments.length >= 1) {
|
|
181
|
+
const idArg = typeArguments[0];
|
|
182
|
+
let eventId = null;
|
|
183
|
+
if (ts_morph_1.Node.isLiteralTypeNode(idArg)) {
|
|
184
|
+
const literal = idArg.getLiteral();
|
|
185
|
+
if (ts_morph_1.Node.isStringLiteral(literal)) {
|
|
186
|
+
eventId = literal.getLiteralValue();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (eventId) {
|
|
190
|
+
logger.verbose_log(`AST extraction successful for basic event ${definitionType}: id=${eventId}`);
|
|
191
|
+
return { id: eventId, columns: [] }; // Basic events have no predefined columns
|
|
192
|
+
}
|
|
174
193
|
}
|
|
175
194
|
}
|
|
176
195
|
}
|
|
@@ -185,7 +204,7 @@ function extractEventInfoFromAST(file, definitionType, logger) {
|
|
|
185
204
|
}
|
|
186
205
|
// Processes an ATMYAPP export to extract content definitions
|
|
187
206
|
function processAtmyappExport(atmyappType, file, tsconfigPath, logger) {
|
|
188
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
207
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
189
208
|
const contents = [];
|
|
190
209
|
logger.verbose_log(`Processing ATMYAPP export in ${file.getFilePath()}`);
|
|
191
210
|
// Extract individual definition types from the array
|
|
@@ -252,43 +271,45 @@ function processAtmyappExport(atmyappType, file, tsconfigPath, logger) {
|
|
|
252
271
|
logger.verbose_log(`Schema for ${definitionType}: ${JSON.stringify(properties, null, 2)}`);
|
|
253
272
|
// Check if this is an event definition
|
|
254
273
|
const isEventDef = ((_a = properties.type) === null || _a === void 0 ? void 0 : _a.const) === "event" ||
|
|
255
|
-
((
|
|
274
|
+
((_b = properties.type) === null || _b === void 0 ? void 0 : _b.const) === "basic_event" ||
|
|
275
|
+
(((_c = properties.__is_ATMYAPP_Object) === null || _c === void 0 ? void 0 : _c.const) === true &&
|
|
256
276
|
properties.id &&
|
|
257
|
-
properties.columns);
|
|
277
|
+
(properties.columns || ((_d = properties.type) === null || _d === void 0 ? void 0 : _d.const) === "basic_event"));
|
|
258
278
|
if (isEventDef) {
|
|
259
|
-
// Handle AmaCustomEventDef - use id as path and extract event structure
|
|
279
|
+
// Handle AmaCustomEventDef and AmaEventDef - use id as path and extract event structure
|
|
260
280
|
let eventId = null;
|
|
261
281
|
let columns = [];
|
|
262
282
|
// Extract event ID - try different possible structures
|
|
263
|
-
if ((
|
|
283
|
+
if ((_e = properties.id) === null || _e === void 0 ? void 0 : _e.const) {
|
|
264
284
|
eventId = properties.id.const;
|
|
265
285
|
}
|
|
266
|
-
else if (((
|
|
286
|
+
else if (((_f = properties.id) === null || _f === void 0 ? void 0 : _f.enum) && properties.id.enum.length === 1) {
|
|
267
287
|
eventId = properties.id.enum[0];
|
|
268
288
|
}
|
|
269
|
-
else if (((
|
|
289
|
+
else if (((_g = properties.id) === null || _g === void 0 ? void 0 : _g.type) === "string" && ((_h = properties.id) === null || _h === void 0 ? void 0 : _h.title)) {
|
|
270
290
|
// Fallback: try to extract from title or other metadata
|
|
271
291
|
eventId = properties.id.title;
|
|
272
292
|
}
|
|
273
293
|
// Extract columns - try different possible structures
|
|
274
|
-
|
|
294
|
+
// For basic events, columns might not exist (they use Record<string, string>)
|
|
295
|
+
if ((_j = properties.columns) === null || _j === void 0 ? void 0 : _j.const) {
|
|
275
296
|
columns = properties.columns.const;
|
|
276
297
|
}
|
|
277
|
-
else if ((
|
|
298
|
+
else if ((_l = (_k = properties.columns) === null || _k === void 0 ? void 0 : _k.items) === null || _l === void 0 ? void 0 : _l.const) {
|
|
278
299
|
columns = properties.columns.items.const;
|
|
279
300
|
}
|
|
280
|
-
else if (((
|
|
301
|
+
else if (((_m = properties.columns) === null || _m === void 0 ? void 0 : _m.items) &&
|
|
281
302
|
Array.isArray(properties.columns.items)) {
|
|
282
303
|
// Handle array of const items - extract const value from each item
|
|
283
304
|
columns = properties.columns.items
|
|
284
305
|
.map((item) => item.const)
|
|
285
306
|
.filter(Boolean);
|
|
286
307
|
}
|
|
287
|
-
else if ((
|
|
308
|
+
else if ((_p = (_o = properties.columns) === null || _o === void 0 ? void 0 : _o.items) === null || _p === void 0 ? void 0 : _p.enum) {
|
|
288
309
|
// Handle tuple type where each position has enum with single value
|
|
289
310
|
columns = properties.columns.items.enum;
|
|
290
311
|
}
|
|
291
|
-
else if (((
|
|
312
|
+
else if (((_q = properties.columns) === null || _q === void 0 ? void 0 : _q.enum) &&
|
|
292
313
|
Array.isArray(properties.columns.enum[0])) {
|
|
293
314
|
// Handle case where columns is an enum with array values
|
|
294
315
|
columns = properties.columns.enum[0];
|
|
@@ -299,20 +320,22 @@ function processAtmyappExport(atmyappType, file, tsconfigPath, logger) {
|
|
|
299
320
|
logger.warn(`Could not extract event ID from ${definitionType}`);
|
|
300
321
|
continue;
|
|
301
322
|
}
|
|
302
|
-
|
|
323
|
+
// For basic events, empty columns array is acceptable
|
|
324
|
+
const isBasicEvent = ((_r = properties.type) === null || _r === void 0 ? void 0 : _r.const) === "basic_event";
|
|
325
|
+
if (columns.length === 0 && !isBasicEvent) {
|
|
303
326
|
logger.warn(`Could not extract columns from ${definitionType}`);
|
|
304
327
|
continue;
|
|
305
328
|
}
|
|
306
|
-
logger.verbose_log(`Successfully extracted event: ${eventId} with columns: ${columns.join(", ")}`);
|
|
329
|
+
logger.verbose_log(`Successfully extracted ${isBasicEvent ? "basic " : ""}event: ${eventId}${columns.length > 0 ? ` with columns: ${columns.join(", ")}` : ""}`);
|
|
307
330
|
// Create event content with special structure
|
|
308
331
|
contents.push({
|
|
309
332
|
path: eventId, // Use event ID as path
|
|
310
333
|
structure: {
|
|
311
|
-
type: "event",
|
|
334
|
+
type: isBasicEvent ? "basic_event" : "event",
|
|
312
335
|
properties: {
|
|
313
336
|
id: { const: eventId },
|
|
314
337
|
columns: { const: columns },
|
|
315
|
-
type: { const: "event" },
|
|
338
|
+
type: { const: isBasicEvent ? "basic_event" : "event" },
|
|
316
339
|
},
|
|
317
340
|
},
|
|
318
341
|
});
|
|
@@ -322,10 +345,10 @@ function processAtmyappExport(atmyappType, file, tsconfigPath, logger) {
|
|
|
322
345
|
let path = null;
|
|
323
346
|
let structure = null;
|
|
324
347
|
// Look for path in different possible locations
|
|
325
|
-
if ((
|
|
348
|
+
if ((_s = properties.path) === null || _s === void 0 ? void 0 : _s.const) {
|
|
326
349
|
path = properties.path.const;
|
|
327
350
|
}
|
|
328
|
-
else if ((
|
|
351
|
+
else if ((_t = properties._path) === null || _t === void 0 ? void 0 : _t.const) {
|
|
329
352
|
path = properties._path.const;
|
|
330
353
|
}
|
|
331
354
|
// Look for structure/data in different possible locations
|
|
@@ -94,7 +94,7 @@ function processFileInWorker(filePath, tsconfigPath) {
|
|
|
94
94
|
// Optimized version that reuses TypeScript programs
|
|
95
95
|
function processAtmyappExportOptimized(atmyappType, file, tsconfigPath) {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
var _a, _b;
|
|
97
|
+
var _a, _b, _c, _d;
|
|
98
98
|
const contents = [];
|
|
99
99
|
const filePath = file.getFilePath();
|
|
100
100
|
// Extract definition types
|
|
@@ -146,9 +146,10 @@ function processAtmyappExportOptimized(atmyappType, file, tsconfigPath) {
|
|
|
146
146
|
}
|
|
147
147
|
const properties = result.schema.properties;
|
|
148
148
|
const isEventDef = ((_a = properties.type) === null || _a === void 0 ? void 0 : _a.const) === "event" ||
|
|
149
|
-
((
|
|
149
|
+
((_b = properties.type) === null || _b === void 0 ? void 0 : _b.const) === "basic_event" ||
|
|
150
|
+
(((_c = properties.__is_ATMYAPP_Object) === null || _c === void 0 ? void 0 : _c.const) === true &&
|
|
150
151
|
properties.id &&
|
|
151
|
-
properties.columns);
|
|
152
|
+
(properties.columns || ((_d = properties.type) === null || _d === void 0 ? void 0 : _d.const) === "basic_event"));
|
|
152
153
|
if (isEventDef) {
|
|
153
154
|
// Handle event definitions
|
|
154
155
|
const eventContent = processEventDefinition(properties, result.definitionType);
|
|
@@ -184,14 +185,14 @@ function extractDefinitionTypes(atmyappType) {
|
|
|
184
185
|
return elementTypes;
|
|
185
186
|
}
|
|
186
187
|
function processEventDefinition(properties, definitionType) {
|
|
187
|
-
var _a, _b, _c, _d, _e;
|
|
188
|
+
var _a, _b, _c, _d, _e, _f;
|
|
188
189
|
let eventId = null;
|
|
189
190
|
let columns = [];
|
|
190
191
|
// Extract event ID
|
|
191
192
|
if ((_a = properties.id) === null || _a === void 0 ? void 0 : _a.const) {
|
|
192
193
|
eventId = properties.id.const;
|
|
193
194
|
}
|
|
194
|
-
// Extract columns
|
|
195
|
+
// Extract columns (may be empty for basic events)
|
|
195
196
|
if ((_b = properties.columns) === null || _b === void 0 ? void 0 : _b.const) {
|
|
196
197
|
columns = properties.columns.const;
|
|
197
198
|
}
|
|
@@ -204,17 +205,24 @@ function processEventDefinition(properties, definitionType) {
|
|
|
204
205
|
.map((item) => item.const)
|
|
205
206
|
.filter(Boolean);
|
|
206
207
|
}
|
|
207
|
-
if
|
|
208
|
+
// Check if this is a basic event
|
|
209
|
+
const isBasicEvent = ((_f = properties.type) === null || _f === void 0 ? void 0 : _f.const) === "basic_event";
|
|
210
|
+
// For basic events, we don't require columns, but we still need an event ID
|
|
211
|
+
if (!eventId) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
// For custom events, we require columns, but for basic events columns can be empty
|
|
215
|
+
if (!isBasicEvent && columns.length === 0) {
|
|
208
216
|
return null;
|
|
209
217
|
}
|
|
210
218
|
return {
|
|
211
219
|
path: eventId,
|
|
212
220
|
structure: {
|
|
213
|
-
type: "event",
|
|
221
|
+
type: isBasicEvent ? "basic_event" : "event",
|
|
214
222
|
properties: {
|
|
215
223
|
id: { const: eventId },
|
|
216
224
|
columns: { const: columns },
|
|
217
|
-
type: { const: "event" },
|
|
225
|
+
type: { const: isBasicEvent ? "basic_event" : "event" },
|
|
218
226
|
},
|
|
219
227
|
},
|
|
220
228
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atmyapp/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"description": "",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@atmyapp/core": "^0.0.
|
|
31
|
+
"@atmyapp/core": "^0.0.6",
|
|
32
32
|
"@types/jest": "^29.5.14",
|
|
33
33
|
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
34
34
|
"@typescript-eslint/parser": "^8.32.1",
|