@magentrix-corp/magentrix-sdk 1.1.6 → 1.1.8

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 (2) hide show
  1. package/README.md +341 -54
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,6 +21,21 @@ npm install @magentrix-corp/magentrix-sdk
21
21
 
22
22
  ## Quick Start
23
23
 
24
+ ### Vue 3 Project Template (Recommended)
25
+
26
+ The fastest way to start a new Vue.js project with Magentrix SDK:
27
+
28
+ ```bash
29
+ npm create @magentrix-corp/iris-app-template@latest my-app
30
+ cd my-app
31
+ npm install
32
+ npm run dev
33
+ ```
34
+
35
+ **Learn more**: [Create Iris App Template](https://www.npmjs.com/package/@magentrix-corp/create-iris-app-template?activeTab=readme)
36
+
37
+ ---
38
+
24
39
  ### JavaScript/TypeScript
25
40
 
26
41
  ```typescript
@@ -47,8 +62,13 @@ try {
47
62
 
48
63
  // Query data - session is automatically created when needed
49
64
  try {
50
- const results = await dataService.query('SELECT Id, Name FROM Account')
51
- console.log(results)
65
+ const result = await dataService.query('SELECT Id, Name FROM Account')
66
+ console.log(result.data) // Array of account objects
67
+
68
+ // Access individual records
69
+ result.data.forEach(account => {
70
+ console.log(account.Id, account.Name)
71
+ })
52
72
  } catch (error) {
53
73
  if (error instanceof MagentrixError) {
54
74
  console.error('Query failed:', error.message)
@@ -57,8 +77,9 @@ try {
57
77
 
58
78
  // Retrieve by ID
59
79
  try {
60
- const record = await dataService.retrieve('account-id-123')
61
- console.log(record)
80
+ const result = await dataService.retrieve('00I00000000003x0001')
81
+ console.log(result.record) // The account object
82
+ console.log('Name:', result.record.Name)
62
83
  } catch (error) {
63
84
  if (error instanceof MagentrixError) {
64
85
  console.error('Retrieve failed:', error.message)
@@ -87,7 +108,7 @@ const error = ref<string | null>(null)
87
108
  onMounted(async () => {
88
109
  try {
89
110
  // Session is automatically created when needed
90
- account.value = (await dataService.retrieve('006000000LJIxF70000')).record
111
+ account.value = (await dataService.retrieve('00I00000000003x0001')).record
91
112
  console.log(account.value)
92
113
  } catch (err) {
93
114
  if (err instanceof MagentrixError) {
@@ -167,6 +188,33 @@ const config: MagentrixConfig = {
167
188
  const dataService = new MagentrixClient(config)
168
189
  ```
169
190
 
191
+ ## Magentrix ID Format
192
+
193
+ Magentrix uses a unique 19-character base-62 identifier format that is case-sensitive.
194
+
195
+ ### ID Structure
196
+
197
+ A Magentrix ID consists of three parts:
198
+
199
+ 1. **First 3 characters**: Key Prefix - Identifies the entity type (e.g., "001" for Account, "003" for Contact)
200
+ 2. **Middle 12 characters**: Sequential base-62 number - Unique record identifier
201
+ 3. **Last 4 characters**: Organization ID - Unique identifier for the specific client
202
+
203
+ ### Example IDs
204
+
205
+ ```
206
+ 00I00000000003x0001 // Account record
207
+ 00300000000001A0001 // Contact record
208
+ 00500000000002B0001 // Opportunity record
209
+ ```
210
+
211
+ **Important**:
212
+ - IDs are case-sensitive
213
+ - Always use the full 19-character ID when referencing records
214
+ - The key prefix determines the entity type
215
+
216
+ ---
217
+
170
218
  ## API Reference
171
219
 
172
220
  ### Session Management
@@ -218,8 +266,42 @@ Execute a custom query using Magentrix query language.
218
266
  import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
219
267
 
220
268
  try {
221
- const results = await dataService.query('SELECT Id, Name, Email FROM Contact WHERE Status = "Active"')
222
- console.log(results)
269
+ // Standard query - returns object with 'data' property containing array of records
270
+ const result = await dataService.query('SELECT Id, Name, Email FROM Contact WHERE Status = "Active"')
271
+ console.log(result.data) // Array of contact objects
272
+
273
+ // Access individual records
274
+ result.data.forEach(contact => {
275
+ console.log(contact.Id, contact.Name, contact.Email)
276
+ })
277
+ } catch (error) {
278
+ if (error instanceof MagentrixError) {
279
+ console.error('Query failed:', error.message)
280
+ }
281
+ }
282
+
283
+ try {
284
+ // Aggregate query - returns object with 'data' property containing aggregate results
285
+ const result = await dataService.query('SELECT COUNT(Id) as TotalAccounts FROM Account')
286
+ console.log(result.data.TotalAccounts) // Number value
287
+ } catch (error) {
288
+ if (error instanceof MagentrixError) {
289
+ console.error('Query failed:', error.message)
290
+ }
291
+ }
292
+
293
+ try {
294
+ // Multiple aggregates
295
+ const result = await dataService.query(`
296
+ SELECT
297
+ COUNT(Id) as TotalAccounts,
298
+ SUM(AnnualRevenue) as TotalRevenue,
299
+ AVG(AnnualRevenue) as AverageRevenue
300
+ FROM Account
301
+ `)
302
+ console.log('Total:', result.data.TotalAccounts)
303
+ console.log('Sum:', result.data.TotalRevenue)
304
+ console.log('Average:', result.data.AverageRevenue)
223
305
  } catch (error) {
224
306
  if (error instanceof MagentrixError) {
225
307
  console.error('Query failed:', error.message)
@@ -230,7 +312,9 @@ try {
230
312
  **Parameters**:
231
313
  - `query`: Query string in Magentrix query language
232
314
 
233
- **Returns**: Query results
315
+ **Returns**: Object with the following structure:
316
+ - For standard queries: `{ data: Array<Object> }` - Array of records with selected fields
317
+ - For aggregate queries: `{ data: Object }` - Object with aggregate field names as properties
234
318
 
235
319
  **Throws**: `MagentrixError` if query is empty or invalid
236
320
 
@@ -244,8 +328,17 @@ Retrieve a single record by ID.
244
328
  import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
245
329
 
246
330
  try {
247
- const account = await dataService.retrieve('account-id-123')
248
- console.log(account.Name)
331
+ // Retrieve returns an object with a 'record' property
332
+ const result = await dataService.retrieve('00I00000000003x0001')
333
+ const account = result.record
334
+
335
+ console.log('Account Name:', account.Name)
336
+ console.log('Account Email:', account.Email)
337
+ console.log('Account Status:', account.Status)
338
+
339
+ // Or destructure directly
340
+ const { record } = await dataService.retrieve('00300000000001A0001')
341
+ console.log('Contact:', record.Name)
249
342
  } catch (error) {
250
343
  if (error instanceof MagentrixError) {
251
344
  console.error('Retrieve failed:', error.message)
@@ -256,7 +349,8 @@ try {
256
349
  **Parameters**:
257
350
  - `id`: Record ID to retrieve
258
351
 
259
- **Returns**: Record object
352
+ **Returns**: Object with the following structure:
353
+ - `{ record: Object }` - The record property contains the full record data with all fields
260
354
 
261
355
  **Throws**: `MagentrixError` if ID is not provided
262
356
 
@@ -264,13 +358,14 @@ try {
264
358
 
265
359
  ### CRUD Operations
266
360
 
267
- #### `create(entityName: string, data: any): Promise<any>`
361
+ #### `create(entityName: string, data: any | any[]): Promise<any>`
268
362
 
269
- Create a new record.
363
+ Create a new record or multiple records in a single API call.
270
364
 
271
365
  ```typescript
272
366
  import { MagentrixError, DatabaseError } from '@magentrix-corp/magentrix-sdk'
273
367
 
368
+ // Create a single record
274
369
  try {
275
370
  const newAccount = await dataService.create('Account', {
276
371
  Name: 'Acme Corporation',
@@ -288,28 +383,52 @@ try {
288
383
  console.error('Create failed:', error.message)
289
384
  }
290
385
  }
386
+
387
+ // Create multiple records in a single API call (RECOMMENDED for batch operations)
388
+ try {
389
+ const newAccounts = await dataService.create('Account', [
390
+ { Name: 'Account 1', Email: 'account1@example.com', Status: 'Active' },
391
+ { Name: 'Account 2', Email: 'account2@example.com', Status: 'Active' },
392
+ { Name: 'Account 3', Email: 'account3@example.com', Status: 'Active' }
393
+ ])
394
+ console.log('Created IDs:', newAccounts.map(a => a.Id))
395
+ } catch (error) {
396
+ if (error instanceof DatabaseError) {
397
+ console.error('Database error:', error.message)
398
+ error.getErrors().forEach(err => {
399
+ console.error(`Field: ${err.fieldName}, Message: ${err.message}`)
400
+ })
401
+ } else if (error instanceof MagentrixError) {
402
+ console.error('Batch create failed:', error.message)
403
+ }
404
+ }
291
405
  ```
292
406
 
293
407
  **Parameters**:
294
408
  - `entityName`: Name of the entity (e.g., 'Account', 'Contact')
295
- - `data`: Object containing the record data
409
+ - `data`: Single object or array of objects containing the record data
296
410
 
297
- **Returns**: Created record with ID
411
+ **Returns**:
412
+ - Single object: Created record with ID
413
+ - Array: Array of created records with IDs
298
414
 
299
415
  **Throws**: `MagentrixError` if entityName or data is missing, `DatabaseError` for validation errors
300
416
 
417
+ **Note**: When creating multiple records, pass an array to make a single optimized API call instead of multiple calls.
418
+
301
419
  ---
302
420
 
303
- #### `edit(entityName: string, data: any): Promise<any>`
421
+ #### `edit(entityName: string, data: any | any[]): Promise<any>`
304
422
 
305
- Update an existing record (requires `Id` in data).
423
+ Update an existing record or multiple records in a single API call (requires `Id` in data).
306
424
 
307
425
  ```typescript
308
426
  import { MagentrixError, DatabaseError } from '@magentrix-corp/magentrix-sdk'
309
427
 
428
+ // Update a single record
310
429
  try {
311
430
  const updated = await dataService.edit('Account', {
312
- Id: 'account-id-123',
431
+ Id: '00I00000000003x0001',
313
432
  Name: 'Updated Name',
314
433
  Status: 'Inactive'
315
434
  })
@@ -324,28 +443,52 @@ try {
324
443
  console.error('Edit failed:', error.message)
325
444
  }
326
445
  }
446
+
447
+ // Update multiple records in a single API call (RECOMMENDED for batch operations)
448
+ try {
449
+ const updated = await dataService.edit('Account', [
450
+ { Id: '00I00000000003x0001', Name: 'Updated Account 1', Status: 'Active' },
451
+ { Id: '00I00000000003y0001', Name: 'Updated Account 2', Status: 'Inactive' },
452
+ { Id: '00I00000000003z0001', Name: 'Updated Account 3', Status: 'Active' }
453
+ ])
454
+ console.log('Updated successfully:', updated.length, 'records')
455
+ } catch (error) {
456
+ if (error instanceof DatabaseError) {
457
+ console.error('Database error:', error.message)
458
+ error.getErrors().forEach(err => {
459
+ console.error(`Field: ${err.fieldName}, Message: ${err.message}`)
460
+ })
461
+ } else if (error instanceof MagentrixError) {
462
+ console.error('Batch edit failed:', error.message)
463
+ }
464
+ }
327
465
  ```
328
466
 
329
467
  **Parameters**:
330
468
  - `entityName`: Name of the entity
331
- - `data`: Object containing the record data with `Id`
469
+ - `data`: Single object or array of objects containing the record data with `Id`
332
470
 
333
- **Returns**: Updated record
471
+ **Returns**:
472
+ - Single object: Updated record
473
+ - Array: Array of updated records
334
474
 
335
475
  **Throws**: `MagentrixError` if entityName or data is missing, `DatabaseError` for validation errors
336
476
 
477
+ **Note**: When updating multiple records, pass an array to make a single optimized API call instead of multiple calls.
478
+
337
479
  ---
338
480
 
339
- #### `upsert(entityName: string, data: any): Promise<any>`
481
+ #### `upsert(entityName: string, data: any | any[]): Promise<any>`
340
482
 
341
- Create or update a record. If `Id` is provided and exists, updates the record; otherwise creates a new one.
483
+ Create or update a record or multiple records in a single API call. If `Id` is provided and exists, updates the record; otherwise creates a new one.
342
484
 
343
485
  ```typescript
344
486
  import { MagentrixError, DatabaseError } from '@magentrix-corp/magentrix-sdk'
345
487
 
488
+ // Upsert a single record
346
489
  try {
347
490
  const record = await dataService.upsert('Contact', {
348
- Id: 'contact-id-456', // Optional
491
+ Id: '00300000000001A0001', // Optional
349
492
  Name: 'John Doe',
350
493
  Email: 'john@example.com'
351
494
  })
@@ -360,16 +503,39 @@ try {
360
503
  console.error('Upsert failed:', error.message)
361
504
  }
362
505
  }
506
+
507
+ // Upsert multiple records in a single API call (RECOMMENDED for batch operations)
508
+ try {
509
+ const records = await dataService.upsert('Contact', [
510
+ { Id: '00300000000001A0001', Name: 'John Doe', Email: 'john@example.com' }, // Will update
511
+ { Name: 'Jane Smith', Email: 'jane@example.com' }, // Will create (no Id)
512
+ { Id: '00300000000001B0001', Name: 'Bob Johnson', Email: 'bob@example.com' } // Will update
513
+ ])
514
+ console.log('Upsert successful:', records.length, 'records')
515
+ } catch (error) {
516
+ if (error instanceof DatabaseError) {
517
+ console.error('Database error:', error.message)
518
+ error.getErrors().forEach(err => {
519
+ console.error(`Field: ${err.fieldName}, Message: ${err.message}`)
520
+ })
521
+ } else if (error instanceof MagentrixError) {
522
+ console.error('Batch upsert failed:', error.message)
523
+ }
524
+ }
363
525
  ```
364
526
 
365
527
  **Parameters**:
366
528
  - `entityName`: Name of the entity
367
- - `data`: Object containing the record data
529
+ - `data`: Single object or array of objects containing the record data (Id is optional)
368
530
 
369
- **Returns**: Created or updated record
531
+ **Returns**:
532
+ - Single object: Created or updated record
533
+ - Array: Array of created or updated records
370
534
 
371
535
  **Throws**: `MagentrixError` if entityName or data is missing, `DatabaseError` for validation errors
372
536
 
537
+ **Note**: When upserting multiple records, pass an array to make a single optimized API call instead of multiple calls.
538
+
373
539
  ---
374
540
 
375
541
  #### `delete(entityName: string, id: string, permanent?: boolean): Promise<any>`
@@ -381,7 +547,7 @@ import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
381
547
 
382
548
  try {
383
549
  // Soft delete (default)
384
- await dataService.delete('Account', 'account-id-123')
550
+ await dataService.delete('Account', '00I00000000003x0001')
385
551
  console.log('Account deleted successfully')
386
552
  } catch (error) {
387
553
  if (error instanceof MagentrixError) {
@@ -391,7 +557,7 @@ try {
391
557
 
392
558
  try {
393
559
  // Permanent delete
394
- await dataService.delete('Account', 'account-id-123', true)
560
+ await dataService.delete('Account', '00I00000000003x0001', true)
395
561
  console.log('Account permanently deleted')
396
562
  } catch (error) {
397
563
  if (error instanceof MagentrixError) {
@@ -419,7 +585,11 @@ Delete multiple records by IDs.
419
585
  import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
420
586
 
421
587
  try {
422
- await dataService.deleteMany('Contact', ['id-1', 'id-2', 'id-3'])
588
+ await dataService.deleteMany('Contact', [
589
+ '00300000000001A0001',
590
+ '00300000000001B0001',
591
+ '00300000000001C0001'
592
+ ])
423
593
  console.log('Contacts deleted successfully')
424
594
  } catch (error) {
425
595
  if (error instanceof MagentrixError) {
@@ -541,8 +711,8 @@ General SDK errors (authentication, validation, API errors).
541
711
  import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
542
712
 
543
713
  try {
544
- const results = await dataService.query('SELECT Id FROM Account')
545
- console.log(results)
714
+ const result = await dataService.query('SELECT Id FROM Account')
715
+ console.log(result.data) // Array of account objects
546
716
  } catch (error) {
547
717
  if (error instanceof MagentrixError) {
548
718
  console.error('Magentrix Error:', error.message)
@@ -798,8 +968,8 @@ const dataService = new MagentrixClient(config)
798
968
 
799
969
  // No need to call createSession() - the SDK handles it automatically
800
970
  try {
801
- const results = await dataService.query('SELECT Id FROM Account')
802
- console.log(results)
971
+ const result = await dataService.query('SELECT Id FROM Account')
972
+ console.log(result.data) // Array of account objects
803
973
  } catch (error) {
804
974
  if (error instanceof MagentrixError) {
805
975
  console.error('Query failed:', error.message)
@@ -838,32 +1008,69 @@ console.log(`Welcome ${userInfo.name}!`)
838
1008
 
839
1009
  ### Batch Operations
840
1010
 
841
- Perform multiple operations efficiently:
1011
+ The `create()`, `edit()`, and `upsert()` methods accept arrays for efficient batch operations in a single API call.
1012
+
1013
+ **✅ RECOMMENDED: Single API call with array**
842
1014
 
843
1015
  ```typescript
844
- import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
1016
+ import { MagentrixError, DatabaseError } from '@magentrix-corp/magentrix-sdk'
845
1017
 
846
- // Create multiple records
1018
+ // Create multiple records in a single API call (OPTIMIZED)
847
1019
  const accounts = [
848
- { Name: 'Account 1', Status: 'Active' },
849
- { Name: 'Account 2', Status: 'Active' },
850
- { Name: 'Account 3', Status: 'Active' }
1020
+ { Name: 'Account 1', Email: 'account1@example.com', Status: 'Active' },
1021
+ { Name: 'Account 2', Email: 'account2@example.com', Status: 'Active' },
1022
+ { Name: 'Account 3', Email: 'account3@example.com', Status: 'Active' }
851
1023
  ]
852
1024
 
853
1025
  try {
854
- const created = await Promise.all(
855
- accounts.map(account => dataService.create('Account', account))
856
- )
1026
+ const created = await dataService.create('Account', accounts)
857
1027
  console.log('Created IDs:', created.map(a => a.Id))
858
1028
  } catch (error) {
859
- if (error instanceof MagentrixError) {
1029
+ if (error instanceof DatabaseError) {
860
1030
  console.error('Batch create failed:', error.message)
1031
+ error.getErrors().forEach(err => {
1032
+ console.error(`Field: ${err.fieldName}, Message: ${err.message}`)
1033
+ })
1034
+ }
1035
+ }
1036
+
1037
+ // Update multiple records in a single API call (OPTIMIZED)
1038
+ try {
1039
+ const updates = [
1040
+ { Id: '00I00000000003x0001', Name: 'Updated Account 1', Status: 'Active' },
1041
+ { Id: '00I00000000003y0001', Name: 'Updated Account 2', Status: 'Inactive' },
1042
+ { Id: '00I00000000003z0001', Name: 'Updated Account 3', Status: 'Active' }
1043
+ ]
1044
+ const updated = await dataService.edit('Account', updates)
1045
+ console.log('Updated:', updated.length, 'records')
1046
+ } catch (error) {
1047
+ if (error instanceof DatabaseError) {
1048
+ console.error('Batch update failed:', error.message)
1049
+ }
1050
+ }
1051
+
1052
+ // Upsert multiple records in a single API call (OPTIMIZED)
1053
+ try {
1054
+ const records = [
1055
+ { Id: '00300000000001A0001', Name: 'John Doe', Email: 'john@example.com' }, // Updates
1056
+ { Name: 'Jane Smith', Email: 'jane@example.com' }, // Creates (no Id)
1057
+ { Id: '00300000000001B0001', Name: 'Bob Johnson', Email: 'bob@example.com' } // Updates
1058
+ ]
1059
+ const results = await dataService.upsert('Contact', records)
1060
+ console.log('Upserted:', results.length, 'records')
1061
+ } catch (error) {
1062
+ if (error instanceof DatabaseError) {
1063
+ console.error('Batch upsert failed:', error.message)
861
1064
  }
862
1065
  }
863
1066
 
864
1067
  // Delete multiple records
865
1068
  try {
866
- const idsToDelete = ['id-1', 'id-2', 'id-3']
1069
+ const idsToDelete = [
1070
+ '00I00000000003x0001',
1071
+ '00I00000000003y0001',
1072
+ '00I00000000003z0001'
1073
+ ]
867
1074
  await dataService.deleteMany('Account', idsToDelete)
868
1075
  console.log('Batch delete successful')
869
1076
  } catch (error) {
@@ -873,17 +1080,41 @@ try {
873
1080
  }
874
1081
  ```
875
1082
 
1083
+ **❌ NOT RECOMMENDED: Multiple API calls**
1084
+
1085
+ ```typescript
1086
+ // This makes multiple API calls - NOT optimized!
1087
+ const accounts = [
1088
+ { Name: 'Account 1', Status: 'Active' },
1089
+ { Name: 'Account 2', Status: 'Active' },
1090
+ { Name: 'Account 3', Status: 'Active' }
1091
+ ]
1092
+
1093
+ // DON'T DO THIS - makes 3 separate API calls
1094
+ const created = await Promise.all(
1095
+ accounts.map(account => dataService.create('Account', account))
1096
+ )
1097
+
1098
+ // INSTEAD DO THIS - makes 1 API call
1099
+ const created = await dataService.create('Account', accounts)
1100
+ ```
1101
+
876
1102
  ### Custom Query Examples
877
1103
 
878
1104
  ```typescript
879
1105
  import { MagentrixError } from '@magentrix-corp/magentrix-sdk'
880
1106
 
881
1107
  try {
882
- // Simple query
883
- const activeContacts = await dataService.query(
1108
+ // Simple query - returns array of records in 'data' property
1109
+ const result = await dataService.query(
884
1110
  'SELECT Id, Name, Email FROM Contact WHERE Status = "Active"'
885
1111
  )
886
- console.log('Active contacts:', activeContacts)
1112
+ console.log('Active contacts:', result.data)
1113
+
1114
+ // Iterate through results
1115
+ result.data.forEach(contact => {
1116
+ console.log(`${contact.Name} - ${contact.Email}`)
1117
+ })
887
1118
  } catch (error) {
888
1119
  if (error instanceof MagentrixError) {
889
1120
  console.error('Query failed:', error.message)
@@ -892,10 +1123,10 @@ try {
892
1123
 
893
1124
  try {
894
1125
  // Query with sorting
895
- const sortedAccounts = await dataService.query(
1126
+ const result = await dataService.query(
896
1127
  'SELECT Id, Name FROM Account ORDER BY Name ASC'
897
1128
  )
898
- console.log('Sorted accounts:', sortedAccounts)
1129
+ console.log('Sorted accounts:', result.data)
899
1130
  } catch (error) {
900
1131
  if (error instanceof MagentrixError) {
901
1132
  console.error('Query failed:', error.message)
@@ -904,10 +1135,44 @@ try {
904
1135
 
905
1136
  try {
906
1137
  // Query with limit
907
- const recentRecords = await dataService.query(
1138
+ const result = await dataService.query(
908
1139
  'SELECT Id, Name FROM Account LIMIT 10'
909
1140
  )
910
- console.log('Recent records:', recentRecords)
1141
+ console.log('Recent records:', result.data)
1142
+ console.log('Total records returned:', result.data.length)
1143
+ } catch (error) {
1144
+ if (error instanceof MagentrixError) {
1145
+ console.error('Query failed:', error.message)
1146
+ }
1147
+ }
1148
+
1149
+ try {
1150
+ // Aggregate query - returns object with aggregate values
1151
+ const result = await dataService.query(
1152
+ 'SELECT COUNT(Id) as TotalAccounts FROM Account'
1153
+ )
1154
+ console.log('Total accounts:', result.data.TotalAccounts)
1155
+ } catch (error) {
1156
+ if (error instanceof MagentrixError) {
1157
+ console.error('Query failed:', error.message)
1158
+ }
1159
+ }
1160
+
1161
+ try {
1162
+ // Multiple aggregates
1163
+ const result = await dataService.query(`
1164
+ SELECT
1165
+ COUNT(Id) as Total,
1166
+ SUM(AnnualRevenue) as Revenue,
1167
+ AVG(NumberOfEmployees) as AvgEmployees
1168
+ FROM Account
1169
+ WHERE Status = "Active"
1170
+ `)
1171
+ console.log('Statistics:', {
1172
+ total: result.data.Total,
1173
+ revenue: result.data.Revenue,
1174
+ avgEmployees: result.data.AvgEmployees
1175
+ })
911
1176
  } catch (error) {
912
1177
  if (error instanceof MagentrixError) {
913
1178
  console.error('Query failed:', error.message)
@@ -919,6 +1184,28 @@ try {
919
1184
 
920
1185
  ## Vue 3 Integration
921
1186
 
1187
+ ### Quick Start with Project Template
1188
+
1189
+ The fastest way to get started with a Vue.js project using the Magentrix SDK is to use the official project template:
1190
+
1191
+ ```bash
1192
+ npm create @magentrix-corp/iris-app-template@latest my-app
1193
+ cd my-app
1194
+ npm install
1195
+ npm run dev
1196
+ ```
1197
+
1198
+ This template provides:
1199
+ - ✅ Pre-configured Magentrix SDK integration
1200
+ - ✅ Vue 3 + TypeScript setup
1201
+ - ✅ Vite for fast development
1202
+ - ✅ Example components and best practices
1203
+ - ✅ Ready-to-use authentication flow
1204
+
1205
+ **Learn more**: [https://www.npmjs.com/package/@magentrix-corp/create-iris-app-template](https://www.npmjs.com/package/@magentrix-corp/create-iris-app-template?activeTab=readme)
1206
+
1207
+ ---
1208
+
922
1209
  ### Composable Usage
923
1210
 
924
1211
  The SDK provides a dedicated Vue 3 composable:
@@ -946,8 +1233,8 @@ const loadAccounts = async () => {
946
1233
 
947
1234
  try {
948
1235
  // Session is automatically created when needed
949
- const results = await dataService.query('SELECT Id, Name FROM Account')
950
- accounts.value = results
1236
+ const result = await dataService.query('SELECT Id, Name FROM Account')
1237
+ accounts.value = result.data // Extract the data array
951
1238
  } catch (err) {
952
1239
  if (err instanceof MagentrixError) {
953
1240
  error.value = err.message
@@ -1130,8 +1417,8 @@ const dataService = new MagentrixClient(config)
1130
1417
  // No need to call createSession()
1131
1418
  // Just use the dataService directly
1132
1419
  try {
1133
- const data = await dataService.query('SELECT Id FROM Account')
1134
- console.log(data)
1420
+ const result = await dataService.query('SELECT Id FROM Account')
1421
+ console.log(result.data) // Array of account objects
1135
1422
  } catch (error) {
1136
1423
  if (error instanceof MagentrixError) {
1137
1424
  console.error('Query failed:', error.message)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magentrix-corp/magentrix-sdk",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "TypeScript SDK for Magentrix APIs with dual authentication modes, automatic session management, CRUD operations, and Vue 3 integration",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",