@l4yercak3/cli 1.0.5 → 1.1.0

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.
@@ -0,0 +1,808 @@
1
+ # L4YERCAK3 CLI - Object Type Mappings
2
+
3
+ This document defines how external application models map to L4YERCAK3 object types.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ The CLI uses intelligent detection to map external application models to L4YERCAK3's universal ontology. Each L4YERCAK3 object type has specific properties and behaviors.
10
+
11
+ ---
12
+
13
+ ## L4YERCAK3 Object Types
14
+
15
+ ### Core Object Structure
16
+
17
+ All objects in L4YERCAK3 follow this base structure:
18
+
19
+ ```typescript
20
+ interface L4YERCAK3Object {
21
+ _id: Id<"objects">;
22
+ organizationId: Id<"organizations">;
23
+ type: string; // "contact", "event", "invoice", etc.
24
+ subtype?: string; // More specific categorization
25
+ status: string; // Lifecycle status
26
+ displayName: string; // Human-readable name
27
+ customProperties: Record<string, any>; // Type-specific data
28
+ createdAt: number;
29
+ updatedAt: number;
30
+ createdBy?: Id<"users">;
31
+ }
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Type: `contact`
37
+
38
+ ### Description
39
+ Represents a person in the CRM. Customers, leads, attendees, members.
40
+
41
+ ### Status Values
42
+ - `active` - Normal contact
43
+ - `archived` - Archived/inactive
44
+ - `blocked` - Blocked from communications
45
+
46
+ ### Custom Properties
47
+ ```typescript
48
+ {
49
+ email: string;
50
+ phone?: string;
51
+ firstName?: string;
52
+ lastName?: string;
53
+ company?: string;
54
+ jobTitle?: string;
55
+ addresses?: Address[];
56
+ tags?: string[];
57
+ source?: string; // "web", "import", "event", "api"
58
+ marketingConsent?: boolean;
59
+ notes?: string;
60
+ customFields?: Record<string, any>;
61
+ }
62
+ ```
63
+
64
+ ### Detection Patterns
65
+
66
+ **Model Name Matches:**
67
+ - `user`, `User`, `users`
68
+ - `customer`, `Customer`
69
+ - `member`, `Member`
70
+ - `subscriber`, `Subscriber`
71
+ - `lead`, `Lead`
72
+ - `attendee`, `Attendee`
73
+ - `person`, `Person`
74
+ - `contact`, `Contact`
75
+
76
+ **Field Indicators (presence increases confidence):**
77
+ - `email` (required indicator)
78
+ - `firstName`, `lastName`, `name`
79
+ - `phone`, `phoneNumber`, `mobile`
80
+ - `company`, `companyName`, `organization`
81
+
82
+ ### Example Mapping
83
+
84
+ ```yaml
85
+ External Model: User
86
+ L4YERCAK3 Type: contact
87
+ Confidence: 95%
88
+
89
+ Field Mappings:
90
+ email → email
91
+ name → displayName
92
+ firstName → customProperties.firstName
93
+ lastName → customProperties.lastName
94
+ phoneNumber → customProperties.phone
95
+ company → customProperties.company
96
+ createdAt → createdAt
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Type: `crm_organization`
102
+
103
+ ### Description
104
+ Represents a company/business in the CRM. B2B clients, partners, vendors.
105
+
106
+ ### Status Values
107
+ - `active` - Active organization
108
+ - `prospect` - Potential client
109
+ - `archived` - No longer active
110
+
111
+ ### Custom Properties
112
+ ```typescript
113
+ {
114
+ name: string;
115
+ website?: string;
116
+ industry?: string;
117
+ employeeCount?: number;
118
+ taxId?: string;
119
+ vatNumber?: string;
120
+ addresses?: {
121
+ billing?: Address;
122
+ shipping?: Address;
123
+ };
124
+ primaryContactId?: Id<"objects">;
125
+ annualRevenue?: number;
126
+ notes?: string;
127
+ }
128
+ ```
129
+
130
+ ### Detection Patterns
131
+
132
+ **Model Name Matches:**
133
+ - `company`, `Company`
134
+ - `organization`, `Organization`
135
+ - `business`, `Business`
136
+ - `client`, `Client`
137
+ - `account`, `Account`
138
+ - `vendor`, `Vendor`
139
+ - `partner`, `Partner`
140
+
141
+ **Field Indicators:**
142
+ - `companyName`, `name`
143
+ - `taxId`, `vatNumber`, `ein`
144
+ - `website`, `url`
145
+ - `industry`
146
+ - `employees`, `employeeCount`
147
+
148
+ ### Example Mapping
149
+
150
+ ```yaml
151
+ External Model: Company
152
+ L4YERCAK3 Type: crm_organization
153
+ Confidence: 92%
154
+
155
+ Field Mappings:
156
+ name → displayName
157
+ website → customProperties.website
158
+ taxId → customProperties.taxId
159
+ industry → customProperties.industry
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Type: `event`
165
+
166
+ ### Description
167
+ Represents gatherings - conferences, workshops, webinars, meetups.
168
+
169
+ ### Subtypes
170
+ - `conference` - Multi-day conference
171
+ - `workshop` - Interactive session
172
+ - `webinar` - Online event
173
+ - `meetup` - Informal gathering
174
+ - `concert` - Performance event
175
+
176
+ ### Status Values
177
+ - `draft` - Not yet published
178
+ - `published` - Open for registration
179
+ - `in_progress` - Currently happening
180
+ - `completed` - Event finished
181
+ - `cancelled` - Event cancelled
182
+
183
+ ### Custom Properties
184
+ ```typescript
185
+ {
186
+ startDate: string; // ISO 8601
187
+ endDate: string;
188
+ timezone?: string;
189
+ location?: string;
190
+ venue?: {
191
+ name: string;
192
+ address: Address;
193
+ coordinates?: { lat: number; lng: number };
194
+ };
195
+ isOnline?: boolean;
196
+ onlineUrl?: string;
197
+ capacity?: number;
198
+ registeredCount?: number;
199
+ description?: string;
200
+ agenda?: AgendaItem[];
201
+ sponsors?: Sponsor[];
202
+ speakers?: Speaker[];
203
+ imageUrl?: string;
204
+ }
205
+ ```
206
+
207
+ ### Detection Patterns
208
+
209
+ **Model Name Matches:**
210
+ - `event`, `Event`
211
+ - `conference`, `Conference`
212
+ - `workshop`, `Workshop`
213
+ - `webinar`, `Webinar`
214
+ - `meetup`, `Meetup`
215
+ - `session`, `Session`
216
+
217
+ **Field Indicators:**
218
+ - `startDate`, `startTime`, `eventDate`
219
+ - `endDate`, `endTime`
220
+ - `location`, `venue`
221
+ - `capacity`, `maxAttendees`
222
+
223
+ ### Example Mapping
224
+
225
+ ```yaml
226
+ External Model: Event
227
+ L4YERCAK3 Type: event
228
+ Confidence: 100%
229
+
230
+ Field Mappings:
231
+ title → displayName
232
+ startDate → customProperties.startDate
233
+ endDate → customProperties.endDate
234
+ venue → customProperties.location
235
+ maxCapacity → customProperties.capacity
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Type: `product`
241
+
242
+ ### Description
243
+ Sellable items - tickets, physical goods, digital products, services.
244
+
245
+ ### Subtypes
246
+ - `ticket` - Event ticket
247
+ - `physical` - Physical goods
248
+ - `digital` - Digital download/access
249
+ - `service` - Service offering
250
+ - `subscription` - Recurring product
251
+
252
+ ### Status Values
253
+ - `draft` - Not yet available
254
+ - `active` - Available for purchase
255
+ - `sold_out` - No inventory
256
+ - `archived` - Discontinued
257
+
258
+ ### Custom Properties
259
+ ```typescript
260
+ {
261
+ price: number; // In cents
262
+ currency: string; // "EUR", "USD"
263
+ quantity?: number; // -1 for unlimited
264
+ sold?: number;
265
+ description?: string;
266
+ images?: string[];
267
+ sku?: string;
268
+ taxCategory?: string;
269
+ taxRate?: number;
270
+ linkedEventId?: Id<"objects">;
271
+ variants?: ProductVariant[];
272
+ formId?: Id<"objects">; // Registration form
273
+ }
274
+ ```
275
+
276
+ ### Detection Patterns
277
+
278
+ **Model Name Matches:**
279
+ - `product`, `Product`
280
+ - `item`, `Item`
281
+ - `sku`, `SKU`
282
+ - `offering`, `Offering`
283
+ - `service`, `Service`
284
+ - `ticket`, `Ticket` (maps to product with subtype="ticket")
285
+
286
+ **Field Indicators:**
287
+ - `price`, `amount`, `cost`
288
+ - `currency`
289
+ - `quantity`, `stock`, `inventory`
290
+ - `sku`, `productCode`
291
+
292
+ ### Example Mapping
293
+
294
+ ```yaml
295
+ External Model: Product
296
+ L4YERCAK3 Type: product
297
+ Confidence: 98%
298
+
299
+ Field Mappings:
300
+ name → displayName
301
+ priceInCents → customProperties.price
302
+ stockCount → customProperties.quantity
303
+ productCode → customProperties.sku
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Type: `ticket`
309
+
310
+ ### Description
311
+ Event access ticket - issued after purchase, contains QR code.
312
+
313
+ ### Status Values
314
+ - `valid` - Can be used
315
+ - `redeemed` - Already used/checked-in
316
+ - `cancelled` - Cancelled ticket
317
+ - `expired` - Past validity date
318
+
319
+ ### Custom Properties
320
+ ```typescript
321
+ {
322
+ qrCode: string; // Unique scannable code
323
+ productId: Id<"objects">;
324
+ eventId: Id<"objects">;
325
+ attendeeName: string;
326
+ attendeeEmail: string;
327
+ purchasedAt: number;
328
+ validFrom?: string;
329
+ validUntil?: string;
330
+ checkedIn?: boolean;
331
+ checkedInAt?: number;
332
+ checkedInBy?: Id<"users">;
333
+ seatNumber?: string;
334
+ registrationData?: Record<string, any>;
335
+ pdfUrl?: string;
336
+ }
337
+ ```
338
+
339
+ ### Detection Patterns
340
+
341
+ **Model Name Matches:**
342
+ - `ticket`, `Ticket`
343
+ - `registration`, `Registration`
344
+ - `booking`, `Booking`
345
+ - `rsvp`, `RSVP`
346
+ - `admission`, `Admission`
347
+
348
+ **Field Indicators:**
349
+ - `qrCode`, `barcode`, `ticketCode`
350
+ - `eventId`, `event`
351
+ - `attendee`, `holder`
352
+ - `checkedIn`, `redeemed`
353
+
354
+ ---
355
+
356
+ ## Type: `invoice`
357
+
358
+ ### Description
359
+ B2B/B2C invoice for billing.
360
+
361
+ ### Status Values
362
+ - `draft` - Can be edited
363
+ - `sealed` - Locked, assigned number
364
+ - `sent` - Sent to client
365
+ - `paid` - Full payment received
366
+ - `partially_paid` - Partial payment
367
+ - `overdue` - Past due date
368
+ - `void` - Cancelled
369
+
370
+ ### Custom Properties
371
+ ```typescript
372
+ {
373
+ invoiceNumber: string;
374
+ clientId: Id<"objects">; // Contact or CRM org
375
+ clientName: string;
376
+ clientEmail: string;
377
+ clientAddress?: Address;
378
+ lineItems: {
379
+ description: string;
380
+ quantity: number;
381
+ unitPrice: number;
382
+ total: number;
383
+ taxRate?: number;
384
+ }[];
385
+ subtotal: number;
386
+ taxRate: number;
387
+ tax: number;
388
+ total: number;
389
+ currency: string;
390
+ issueDate: string;
391
+ dueDate: string;
392
+ paymentTerms: string; // "net30", "net60", "due_on_receipt"
393
+ paidAmount?: number;
394
+ paidAt?: number;
395
+ notes?: string;
396
+ pdfUrl?: string;
397
+ stripeInvoiceId?: string;
398
+ }
399
+ ```
400
+
401
+ ### Detection Patterns
402
+
403
+ **Model Name Matches:**
404
+ - `invoice`, `Invoice`
405
+ - `bill`, `Bill`
406
+ - `receipt`, `Receipt`
407
+
408
+ **Field Indicators:**
409
+ - `invoiceNumber`, `billNumber`
410
+ - `lineItems`, `items`
411
+ - `dueDate`, `paymentDue`
412
+ - `totalAmount`, `grandTotal`
413
+
414
+ ---
415
+
416
+ ## Type: `transaction`
417
+
418
+ ### Description
419
+ Financial transaction record (from checkout).
420
+
421
+ ### Subtypes
422
+ - `ticket_purchase` - Event ticket
423
+ - `product_purchase` - Product sale
424
+ - `service` - Service payment
425
+ - `subscription` - Recurring payment
426
+
427
+ ### Status Values
428
+ - `pending` - Awaiting payment
429
+ - `completed` - Payment successful
430
+ - `failed` - Payment failed
431
+ - `refunded` - Money returned
432
+ - `invoiced` - Linked to invoice
433
+
434
+ ### Custom Properties
435
+ ```typescript
436
+ {
437
+ lineItems: {
438
+ productId: Id<"objects">;
439
+ productName: string;
440
+ quantity: number;
441
+ unitPrice: number;
442
+ total: number;
443
+ taxAmount: number;
444
+ }[];
445
+ subtotal: number;
446
+ tax: number;
447
+ total: number;
448
+ currency: string;
449
+ customerEmail: string;
450
+ customerName?: string;
451
+ paymentMethod: string;
452
+ paymentIntentId?: string;
453
+ checkoutSessionId?: string;
454
+ invoiceId?: Id<"objects">;
455
+ }
456
+ ```
457
+
458
+ ### Detection Patterns
459
+
460
+ **Model Name Matches:**
461
+ - `transaction`, `Transaction`
462
+ - `payment`, `Payment`
463
+ - `order`, `Order`
464
+ - `purchase`, `Purchase`
465
+ - `sale`, `Sale`
466
+
467
+ ---
468
+
469
+ ## Type: `form`
470
+
471
+ ### Description
472
+ Data collection form (registration, survey, application).
473
+
474
+ ### Subtypes
475
+ - `registration` - Event/product registration
476
+ - `survey` - Feedback/research
477
+ - `application` - Job/grant application
478
+ - `contact` - Contact form
479
+
480
+ ### Status Values
481
+ - `draft` - Not accepting responses
482
+ - `published` - Accepting responses
483
+ - `archived` - Closed
484
+
485
+ ### Custom Properties
486
+ ```typescript
487
+ {
488
+ fields: {
489
+ id: string;
490
+ type: string; // "text", "email", "select", "checkbox", etc.
491
+ label: string;
492
+ required: boolean;
493
+ placeholder?: string;
494
+ options?: string[]; // For select/radio/checkbox
495
+ validation?: {
496
+ pattern?: string;
497
+ min?: number;
498
+ max?: number;
499
+ };
500
+ conditionalDisplay?: {
501
+ dependsOn: string;
502
+ showWhen: any;
503
+ };
504
+ }[];
505
+ responseCount?: number;
506
+ linkedProductId?: Id<"objects">;
507
+ linkedEventId?: Id<"objects">;
508
+ confirmationMessage?: string;
509
+ notifyEmail?: string;
510
+ }
511
+ ```
512
+
513
+ ### Detection Patterns
514
+
515
+ **Model Name Matches:**
516
+ - `form`, `Form`
517
+ - `survey`, `Survey`
518
+ - `questionnaire`, `Questionnaire`
519
+ - `application`, `Application`
520
+
521
+ ---
522
+
523
+ ## Type: `form_response`
524
+
525
+ ### Description
526
+ Submitted form data.
527
+
528
+ ### Status Values
529
+ - `partial` - Incomplete submission
530
+ - `complete` - Full submission
531
+ - `abandoned` - Started but not completed
532
+
533
+ ### Custom Properties
534
+ ```typescript
535
+ {
536
+ formId: Id<"objects">;
537
+ responses: Record<string, any>;
538
+ submittedAt: number;
539
+ submittedBy?: Id<"objects">; // Contact if known
540
+ ipAddress?: string;
541
+ userAgent?: string;
542
+ }
543
+ ```
544
+
545
+ ---
546
+
547
+ ## Type: `project`
548
+
549
+ ### Description
550
+ Client project with milestones and tasks.
551
+
552
+ ### Status Values
553
+ - `draft` - Planning phase
554
+ - `active` - In progress
555
+ - `on_hold` - Paused
556
+ - `completed` - Finished
557
+ - `cancelled` - Abandoned
558
+
559
+ ### Custom Properties
560
+ ```typescript
561
+ {
562
+ clientId: Id<"objects">; // Contact or CRM org
563
+ clientName: string;
564
+ description?: string;
565
+ budget?: number;
566
+ currency?: string;
567
+ startDate?: string;
568
+ endDate?: string;
569
+ progress?: number; // 0-100
570
+ milestones?: {
571
+ id: string;
572
+ name: string;
573
+ status: string;
574
+ dueDate?: string;
575
+ completedAt?: number;
576
+ }[];
577
+ tasks?: {
578
+ id: string;
579
+ title: string;
580
+ status: string;
581
+ assigneeId?: Id<"users">;
582
+ dueDate?: string;
583
+ priority: string;
584
+ }[];
585
+ teamMembers?: {
586
+ userId: Id<"users">;
587
+ role: string;
588
+ }[];
589
+ }
590
+ ```
591
+
592
+ ### Detection Patterns
593
+
594
+ **Model Name Matches:**
595
+ - `project`, `Project`
596
+ - `campaign`, `Campaign`
597
+ - `engagement`, `Engagement`
598
+ - `job`, `Job`
599
+
600
+ ---
601
+
602
+ ## Type: `template`
603
+
604
+ ### Description
605
+ Reusable templates for PDFs, emails, pages.
606
+
607
+ ### Subtypes
608
+ - `ticket_pdf` - Ticket PDF
609
+ - `invoice_pdf` - Invoice PDF
610
+ - `email` - Email template
611
+ - `sms` - SMS template
612
+ - `landing_page` - Web page
613
+
614
+ ### Custom Properties
615
+ ```typescript
616
+ {
617
+ // For email
618
+ subject?: string;
619
+ htmlContent?: string;
620
+ textContent?: string;
621
+
622
+ // For PDF
623
+ htmlTemplate?: string;
624
+ cssStyles?: string;
625
+
626
+ // Common
627
+ variables: string[]; // Available merge fields
628
+ previewImageUrl?: string;
629
+ }
630
+ ```
631
+
632
+ ---
633
+
634
+ ## Type: `workflow`
635
+
636
+ ### Description
637
+ Automation workflow with triggers and actions.
638
+
639
+ ### Status Values
640
+ - `draft` - Not active
641
+ - `active` - Running
642
+ - `paused` - Temporarily disabled
643
+
644
+ ### Custom Properties
645
+ ```typescript
646
+ {
647
+ trigger: {
648
+ type: string; // "contact_created", "form_submitted", etc.
649
+ conditions?: Record<string, any>;
650
+ };
651
+ actions: {
652
+ type: string; // "send_email", "create_contact", etc.
653
+ config: Record<string, any>;
654
+ delay?: number; // Minutes to wait
655
+ }[];
656
+ lastRunAt?: number;
657
+ runCount?: number;
658
+ }
659
+ ```
660
+
661
+ ---
662
+
663
+ ## Type: `page` (Web Publishing)
664
+
665
+ ### Description
666
+ Published web page/portal.
667
+
668
+ ### Subtypes
669
+ - `freelancer_portal` - Client portal
670
+ - `landing_page` - Marketing page
671
+ - `checkout_page` - Payment page
672
+ - `event_page` - Event info page
673
+
674
+ ### Status Values
675
+ - `draft` - Not published
676
+ - `published` - Live
677
+ - `archived` - Taken down
678
+
679
+ ### Custom Properties
680
+ ```typescript
681
+ {
682
+ slug: string;
683
+ publicUrl: string;
684
+ templateCode: string;
685
+ themeCode: string;
686
+ content: Record<string, any>;
687
+ customCss?: string;
688
+ metaTitle?: string;
689
+ metaDescription?: string;
690
+ ogImage?: string;
691
+ analyticsEnabled?: boolean;
692
+ viewCount?: number;
693
+ }
694
+ ```
695
+
696
+ ---
697
+
698
+ ## Type: `certificate`
699
+
700
+ ### Description
701
+ Achievement/completion certificate.
702
+
703
+ ### Status Values
704
+ - `issued` - Active certificate
705
+ - `revoked` - Invalidated
706
+
707
+ ### Custom Properties
708
+ ```typescript
709
+ {
710
+ recipientId: Id<"objects">; // Contact
711
+ recipientName: string;
712
+ title: string;
713
+ description: string;
714
+ issueDate: string;
715
+ expiryDate?: string;
716
+ certificateNumber: string;
717
+ verificationUrl: string;
718
+ pdfUrl?: string;
719
+ linkedEventId?: Id<"objects">;
720
+ linkedProductId?: Id<"objects">;
721
+ }
722
+ ```
723
+
724
+ ---
725
+
726
+ ## Type: `benefit`
727
+
728
+ ### Description
729
+ Membership/community benefit.
730
+
731
+ ### Status Values
732
+ - `active` - Available
733
+ - `inactive` - Not available
734
+ - `archived` - Removed
735
+
736
+ ### Custom Properties
737
+ ```typescript
738
+ {
739
+ title: string;
740
+ description: string;
741
+ category: string;
742
+ redemptionInstructions?: string;
743
+ partnerName?: string;
744
+ partnerUrl?: string;
745
+ discountCode?: string;
746
+ discountPercentage?: number;
747
+ validFrom?: string;
748
+ validUntil?: string;
749
+ imageUrl?: string;
750
+ }
751
+ ```
752
+
753
+ ---
754
+
755
+ ## Mapping Confidence Calculation
756
+
757
+ The CLI calculates mapping confidence based on:
758
+
759
+ 1. **Name Match Score (40%)**
760
+ - Exact match: 100
761
+ - Case-insensitive match: 90
762
+ - Plural/singular variant: 85
763
+ - Partial match: 60
764
+
765
+ 2. **Field Presence Score (40%)**
766
+ - Each indicator field present: +20
767
+ - Required field (e.g., email for contact): +30
768
+ - Cap at 100
769
+
770
+ 3. **Type Compatibility Score (20%)**
771
+ - Field types align with expected: +10 each
772
+ - Cap at 100
773
+
774
+ **Final Score = (Name * 0.4) + (Fields * 0.4) + (Types * 0.2)**
775
+
776
+ **Thresholds:**
777
+ - 90%+ : Auto-accept
778
+ - 70-89%: Suggest with confirmation
779
+ - 50-69%: Show as option
780
+ - <50%: Custom mapping required
781
+
782
+ ---
783
+
784
+ ## Custom Mapping
785
+
786
+ For models that don't match standard patterns:
787
+
788
+ ```yaml
789
+ # .l4yercak3/mappings.yaml
790
+
791
+ mappings:
792
+ - localModel: Subscription
793
+ layerCakeType: product
794
+ subtype: subscription
795
+ confidence: manual
796
+ fieldMappings:
797
+ planName: displayName
798
+ monthlyPrice: customProperties.price
799
+ features: customProperties.description
800
+ status: status
801
+ transforms:
802
+ monthlyPrice: "value * 100" # Convert to cents
803
+ ```
804
+
805
+ ---
806
+
807
+ *Document Version: 1.0*
808
+ *Last Updated: January 2025*