@jigx/core-sdk 1.2.0-next.2 → 1.2.0-next.21
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 +6 -82
- package/dist/PACKAGE.d.ts +1 -0
- package/dist/PACKAGE.d.ts.map +1 -1
- package/dist/PACKAGE.js +3 -2
- package/dist/abstract/sdk.text.d.ts +1 -0
- package/dist/abstract/sdk.text.d.ts.map +1 -1
- package/dist/abstract/sdk.text.js +8 -2
- package/dist/abstract/zod.types.d.ts +19 -1
- package/dist/abstract/zod.types.d.ts.map +1 -1
- package/dist/abstract/zod.types.js +6 -1
- package/dist/action/index.d.ts +1 -0
- package/dist/action/index.d.ts.map +1 -1
- package/dist/action/index.js +2 -1
- package/dist/action/ja.confirm.d.ts.map +1 -1
- package/dist/action/ja.confirm.js +15 -6
- package/dist/action/ja.evaluate.d.ts.map +1 -1
- package/dist/action/ja.evaluate.js +1 -1
- package/dist/action/ja.execute-entity.abstract.d.ts +5 -0
- package/dist/action/ja.execute-entity.abstract.d.ts.map +1 -1
- package/dist/action/ja.execute-entity.abstract.js +9 -1
- package/dist/action/ja.in-background.d.ts +7 -0
- package/dist/action/ja.in-background.d.ts.map +1 -1
- package/dist/action/ja.in-background.factory.d.ts +2 -0
- package/dist/action/ja.in-background.factory.d.ts.map +1 -1
- package/dist/action/ja.in-background.factory.js +3 -1
- package/dist/action/ja.in-background.js +12 -1
- package/dist/action/ja.on-button.factory.d.ts +2 -0
- package/dist/action/ja.on-button.factory.d.ts.map +1 -1
- package/dist/action/ja.on-button.factory.js +3 -1
- package/dist/action/ja.open-media-picker.abstract.d.ts +8 -0
- package/dist/action/ja.open-media-picker.abstract.d.ts.map +1 -1
- package/dist/action/ja.open-media-picker.abstract.js +1 -1
- package/dist/action/ja.open-media-picker.d.ts +8 -0
- package/dist/action/ja.open-media-picker.d.ts.map +1 -1
- package/dist/action/ja.open-media-picker.js +8 -1
- package/dist/action/ja.set-state.d.ts +22 -0
- package/dist/action/ja.set-state.d.ts.map +1 -0
- package/dist/action/ja.set-state.js +24 -0
- package/dist/action/ja.show-alert.d.ts +11 -29
- package/dist/action/ja.show-alert.d.ts.map +1 -1
- package/dist/action/ja.show-alert.js +16 -19
- package/dist/action/ja.submit-form.d.ts +8 -1
- package/dist/action/ja.submit-form.d.ts.map +1 -1
- package/dist/action/ja.submit-form.js +8 -2
- package/dist/action/ja.sync-entities.abstract.d.ts.map +1 -1
- package/dist/action/ja.sync-entities.abstract.js +1 -1
- package/dist/application/application.component.d.ts +81 -0
- package/dist/application/application.component.d.ts.map +1 -0
- package/dist/application/application.component.js +56 -0
- package/dist/application/application.sdk.d.ts +18 -3
- package/dist/application/application.sdk.d.ts.map +1 -1
- package/dist/application/application.sdk.js +34 -10
- package/dist/application/application.table-changed.d.ts +17 -0
- package/dist/application/application.table-changed.d.ts.map +1 -0
- package/dist/application/application.table-changed.js +20 -0
- package/dist/application/index.d.ts +2 -0
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +3 -1
- package/dist/assets/example-extraction-cache.json +4 -4
- package/dist/assets/extracted-core-sdk-examples.yaml +1113 -455
- package/dist/component/common/jc.component.types.d.ts +4 -2
- package/dist/component/common/jc.component.types.d.ts.map +1 -1
- package/dist/component/common/jc.component.types.js +1 -1
- package/dist/component/common/jc.left-right.element.icon.d.ts.map +1 -1
- package/dist/component/common/jc.left-right.element.icon.js +3 -8
- package/dist/component/common/jc.picker-field-options.types.d.ts +4 -0
- package/dist/component/common/jc.picker-field-options.types.d.ts.map +1 -1
- package/dist/component/common/jc.picker-field-options.types.js +1 -1
- package/dist/component/common/jc.validation.d.ts +1 -1
- package/dist/component/common/jc.validation.d.ts.map +1 -1
- package/dist/component/common/jc.validation.js +2 -2
- package/dist/component/index.d.ts +1 -0
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/index.js +2 -1
- package/dist/component/jc.avatar-field.d.ts.map +1 -1
- package/dist/component/jc.avatar-field.js +4 -1
- package/dist/component/jc.banner.d.ts +2 -0
- package/dist/component/jc.banner.d.ts.map +1 -1
- package/dist/component/jc.card.on-default.d.ts +2 -0
- package/dist/component/jc.card.on-default.d.ts.map +1 -1
- package/dist/component/jc.card.on-default.js +3 -1
- package/dist/component/jc.entity-field.d.ts.map +1 -1
- package/dist/component/jc.entity-field.js +1 -1
- package/dist/component/jc.image.d.ts +3 -2
- package/dist/component/jc.image.d.ts.map +1 -1
- package/dist/component/jc.image.js +1 -1
- package/dist/component/jc.image.on-custom-component.d.ts +53 -0
- package/dist/component/jc.image.on-custom-component.d.ts.map +1 -0
- package/dist/component/jc.image.on-custom-component.js +29 -0
- package/dist/component/jc.list-item.d.ts +2 -0
- package/dist/component/jc.list-item.d.ts.map +1 -1
- package/dist/component/jc.list-item.js +4 -1
- package/dist/component/jc.list.d.ts +1 -1
- package/dist/component/jc.list.d.ts.map +1 -1
- package/dist/component/jc.media-field.d.ts.map +1 -1
- package/dist/component/jc.media-field.js +4 -1
- package/dist/component/jc.menu-item.d.ts +2 -0
- package/dist/component/jc.menu-item.d.ts.map +1 -1
- package/dist/component/jc.section.abstract.d.ts +2 -0
- package/dist/component/jc.section.abstract.d.ts.map +1 -1
- package/dist/component/jc.text.d.ts +1 -1
- package/dist/component/jc.text.d.ts.map +1 -1
- package/dist/component/jc.text.js +1 -1
- package/dist/component/jc.view.d.ts +4 -2
- package/dist/component/jc.view.d.ts.map +1 -1
- package/dist/component/jc.view.js +5 -3
- package/dist/datasource/datasource.sdk.d.ts.map +1 -1
- package/dist/datasource/datasource.sdk.js +1 -1
- package/dist/datasource/datasource.static.d.ts +3 -2
- package/dist/datasource/datasource.static.d.ts.map +1 -1
- package/dist/datasource/datasource.static.js +7 -3
- package/dist/datasource/sqlite-normalizer.d.ts.map +1 -1
- package/dist/datasource/sqlite-normalizer.js +1 -1
- package/dist/datasource/sqlite-validator.d.ts +2 -1
- package/dist/datasource/sqlite-validator.d.ts.map +1 -1
- package/dist/datasource/sqlite-validator.js +47 -15
- package/dist/function/function.abstract.d.ts +15 -10
- package/dist/function/function.abstract.d.ts.map +1 -1
- package/dist/function/function.abstract.js +6 -3
- package/dist/function/function.operation.d.ts +3 -3
- package/dist/function/function.operation.d.ts.map +1 -1
- package/dist/function/function.operation.js +1 -1
- package/dist/function/function.rest.d.ts +2 -0
- package/dist/function/function.rest.d.ts.map +1 -1
- package/dist/function/function.rest.error-builder.d.ts +4 -4
- package/dist/function/function.rest.error-builder.d.ts.map +1 -1
- package/dist/function/function.rest.error-builder.js +4 -6
- package/dist/function/function.rest.js +6 -1
- package/dist/function/function.rest.types.d.ts.map +1 -1
- package/dist/function/function.rest.types.js +1 -1
- package/dist/jsonata/builder.d.ts +14 -3
- package/dist/jsonata/builder.d.ts.map +1 -1
- package/dist/jsonata/builder.js +127 -15
- package/dist/jsonata/context.d.ts.map +1 -1
- package/dist/jsonata/context.js +12 -3
- package/dist/screen/common/screen.default-children.d.ts +2 -1
- package/dist/screen/common/screen.default-children.d.ts.map +1 -1
- package/dist/screen/common/screen.default-children.js +3 -2
- package/dist/screen/common/screen.input-definition.d.ts.map +1 -1
- package/dist/screen/common/screen.input-definition.js +1 -1
- package/dist/screen/common/screen.placeholder.d.ts.map +1 -1
- package/dist/screen/common/screen.placeholder.js +1 -1
- package/dist/screen/common/screen.preview.d.ts.map +1 -1
- package/dist/screen/common/screen.preview.js +1 -1
- package/dist/screen/screen.default.d.ts +2 -1
- package/dist/screen/screen.default.d.ts.map +1 -1
- package/dist/screen/screen.grid.base.d.ts +1 -1
- package/dist/screen/screen.grid.base.d.ts.map +1 -1
- package/dist/screen/screen.list.d.ts +5 -3
- package/dist/screen/screen.list.d.ts.map +1 -1
- package/dist/screen/screen.list.js +10 -3
- package/dist/screen/screen.tabs.d.ts +1 -1
- package/dist/screen/screen.tabs.d.ts.map +1 -1
- package/dist/screen/screen.tabs.instance.d.ts +4 -1
- package/dist/screen/screen.tabs.instance.d.ts.map +1 -1
- package/dist/screen/screen.tabs.instance.js +6 -2
- package/dist/screen/screen.tabs.js +1 -1
- package/docs/pattern-build-deploy.md +2 -2
- package/package.json +2 -2
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
complex UI
|
|
14
14
|
code: |2-
|
|
15
15
|
// Main expense management application
|
|
16
|
-
const app = new ApplicationBuilder({
|
|
16
|
+
const app = new ApplicationBuilder({
|
|
17
|
+
name: 'expense-management',
|
|
18
|
+
title: 'Expense Management',
|
|
19
|
+
}).with({ category: 'business' })
|
|
17
20
|
// Main dashboard screen with complex component hierarchy
|
|
18
21
|
const homeScreen = app.addScreen.default({
|
|
19
22
|
screenId: 'home',
|
|
@@ -21,7 +24,11 @@
|
|
|
21
24
|
})
|
|
22
25
|
// REST function for fetching expense receipts with pagination
|
|
23
26
|
const restGetExpenseReceipt = app.addFunction
|
|
24
|
-
.rest({
|
|
27
|
+
.rest({
|
|
28
|
+
functionId: 'rest-get-expense-receipt',
|
|
29
|
+
method: 'GET',
|
|
30
|
+
url: 'https://{acumaticaurl}ExpenseReceipt',
|
|
31
|
+
})
|
|
25
32
|
.records('=$.data')
|
|
26
33
|
.forRowsWithMatchingIds(true)
|
|
27
34
|
.outputTransform(`=`, {
|
|
@@ -355,7 +362,11 @@
|
|
|
355
362
|
code: |-
|
|
356
363
|
// Function with pagination support
|
|
357
364
|
const fn = app.addFunction
|
|
358
|
-
.rest({
|
|
365
|
+
.rest({
|
|
366
|
+
functionId: 'rest-get-expense-receipt',
|
|
367
|
+
method: 'GET',
|
|
368
|
+
url: 'https://{acumaticaurl}ExpenseReceipt',
|
|
369
|
+
})
|
|
359
370
|
.records('=$.data')
|
|
360
371
|
.forRowsWithMatchingIds(true)
|
|
361
372
|
.outputTransform(`=`, {
|
|
@@ -443,7 +454,9 @@
|
|
|
443
454
|
// Create database tables
|
|
444
455
|
app.addDatabase.default.table('sales', 'inventory', 'customers')
|
|
445
456
|
// Create datasources
|
|
446
|
-
app.addDatasource
|
|
457
|
+
app.addDatasource
|
|
458
|
+
.sqlite({ datasourceId: 'sales-summary', provider: 'dynamic' })
|
|
459
|
+
.entity('default/sales').query(`
|
|
447
460
|
SELECT
|
|
448
461
|
id,
|
|
449
462
|
json_extract(data, '$.date') as date,
|
|
@@ -453,7 +466,9 @@
|
|
|
453
466
|
WHERE json_extract(data, '$.date') >= date('now', '-30 days')
|
|
454
467
|
ORDER BY json_extract(data, '$.date') DESC
|
|
455
468
|
`)
|
|
456
|
-
app.addDatasource
|
|
469
|
+
app.addDatasource
|
|
470
|
+
.sqlite({ datasourceId: 'low-inventory', provider: 'dynamic' })
|
|
471
|
+
.entity('default/inventory').query(`
|
|
457
472
|
SELECT
|
|
458
473
|
id,
|
|
459
474
|
json_extract(data, '$.name') as name,
|
|
@@ -521,7 +536,9 @@
|
|
|
521
536
|
in joins
|
|
522
537
|
code: |-
|
|
523
538
|
// 1. Declare entities in datasource
|
|
524
|
-
app.addDatasource
|
|
539
|
+
app.addDatasource
|
|
540
|
+
.sqlite({ datasourceId: 'customers', provider: 'local' })
|
|
541
|
+
.entities('customers', 'products') // Must match table names used in query
|
|
525
542
|
// 2. Ensure tables exist in database
|
|
526
543
|
app.addDatabase.default
|
|
527
544
|
- id: rest-function-integration-example
|
|
@@ -609,7 +626,12 @@
|
|
|
609
626
|
code: |-
|
|
610
627
|
// SOAP function for web service integration
|
|
611
628
|
const weatherFunction = app.addFunction
|
|
612
|
-
.soap({
|
|
629
|
+
.soap({
|
|
630
|
+
functionId: 'get-weather',
|
|
631
|
+
connection: 'weather-service',
|
|
632
|
+
method: 'GetWeather',
|
|
633
|
+
wsdl: 'https://weather.com/wsdl',
|
|
634
|
+
})
|
|
613
635
|
.outputTransform('$.Temperature')
|
|
614
636
|
weatherFunction.params
|
|
615
637
|
.body('city', 'London')
|
|
@@ -634,7 +656,8 @@
|
|
|
634
656
|
code: |-
|
|
635
657
|
// SQL function for database queries
|
|
636
658
|
const app = new ApplicationBuilder({ name: 'sql-function-example' })
|
|
637
|
-
const getCustomersFunction = app.addFunction
|
|
659
|
+
const getCustomersFunction = app.addFunction
|
|
660
|
+
.sql({ functionId: 'get-customers', connection: 'mydb' })
|
|
638
661
|
.sql('SELECT * FROM customers WHERE active = @active AND region = @region')
|
|
639
662
|
getCustomersFunction.params
|
|
640
663
|
.input('$active', 'boolean', { value: true })
|
|
@@ -648,7 +671,8 @@
|
|
|
648
671
|
"SELECT id, data FROM [default/customers] ORDER BY json_extract(data, '$.created_at') DESC",
|
|
649
672
|
)
|
|
650
673
|
// Stored procedure SQL functions
|
|
651
|
-
const updateCustomerFunction = app.addFunction
|
|
674
|
+
const updateCustomerFunction = app.addFunction
|
|
675
|
+
.sql({ functionId: 'update-customer', connection: 'mydb', method: 'execute' })
|
|
652
676
|
.sql('sp_UpdateCustomer', 'procedure')
|
|
653
677
|
updateCustomerFunction.params
|
|
654
678
|
.input('$customerId', 'number', { value: 123 })
|
|
@@ -678,7 +702,10 @@
|
|
|
678
702
|
datasource.query(`SELECT id, data FROM [default/products]`)
|
|
679
703
|
// Query patterns based on datasource naming:
|
|
680
704
|
// Single record - inferred from "customer", "get-customer", "customer-by-name"
|
|
681
|
-
const singleCustomer = app.addDatasource.sqlite({
|
|
705
|
+
const singleCustomer = app.addDatasource.sqlite({
|
|
706
|
+
datasourceId: 'customer-by-name',
|
|
707
|
+
provider: 'local',
|
|
708
|
+
})
|
|
682
709
|
singleCustomer.entity('default/customers')
|
|
683
710
|
singleCustomer.query(`
|
|
684
711
|
SELECT cus.id,
|
|
@@ -689,7 +716,10 @@
|
|
|
689
716
|
`)
|
|
690
717
|
singleCustomer.queryParameter('name', '=@ctx.jig.inputs.customerName')
|
|
691
718
|
// List records - inferred from "products", "all-products", "product-list"
|
|
692
|
-
const productList = app.addDatasource.sqlite({
|
|
719
|
+
const productList = app.addDatasource.sqlite({
|
|
720
|
+
datasourceId: 'product-list',
|
|
721
|
+
provider: 'local',
|
|
722
|
+
})
|
|
693
723
|
productList.entity('default/products')
|
|
694
724
|
productList.query(`
|
|
695
725
|
SELECT prd.id,
|
|
@@ -701,7 +731,10 @@
|
|
|
701
731
|
ORDER BY json_extract(prd.data, '$.name')
|
|
702
732
|
`)
|
|
703
733
|
// Sorted records - inferred from "contacts-sorted-by-name"
|
|
704
|
-
const sortedContacts = app.addDatasource.sqlite({
|
|
734
|
+
const sortedContacts = app.addDatasource.sqlite({
|
|
735
|
+
datasourceId: 'contacts-by-last-login',
|
|
736
|
+
provider: 'local',
|
|
737
|
+
})
|
|
705
738
|
sortedContacts.entity('default/contacts')
|
|
706
739
|
sortedContacts.query(`
|
|
707
740
|
SELECT con.id,
|
|
@@ -720,7 +753,10 @@
|
|
|
720
753
|
FROM [default/parts] AS prt
|
|
721
754
|
`)
|
|
722
755
|
// Complex joins with parameters
|
|
723
|
-
const customerOrders = app.addDatasource.sqlite({
|
|
756
|
+
const customerOrders = app.addDatasource.sqlite({
|
|
757
|
+
datasourceId: 'customer-orders',
|
|
758
|
+
provider: 'dynamic',
|
|
759
|
+
})
|
|
724
760
|
customerOrders.entity('default/customers')
|
|
725
761
|
customerOrders.entity('default/orders')
|
|
726
762
|
customerOrders.query(`
|
|
@@ -959,8 +995,14 @@
|
|
|
959
995
|
customerInfo.addControl
|
|
960
996
|
.entityField({ label: 'Name', value: '=@ctx.datasources.customer-detail.data.name' }) // Direct access, no [0]
|
|
961
997
|
.with({ style: { isPrimary: true } })
|
|
962
|
-
customerInfo.addControl.entityField({
|
|
963
|
-
|
|
998
|
+
customerInfo.addControl.entityField({
|
|
999
|
+
label: 'Email',
|
|
1000
|
+
value: '=@ctx.datasources.customer-detail.data.email',
|
|
1001
|
+
})
|
|
1002
|
+
customerInfo.addControl.entityField({
|
|
1003
|
+
label: 'Phone',
|
|
1004
|
+
value: '=@ctx.datasources.customer-detail.data.phone',
|
|
1005
|
+
})
|
|
964
1006
|
customerInfo.addControl.entityField({
|
|
965
1007
|
label: 'Address',
|
|
966
1008
|
value:
|
|
@@ -1082,8 +1124,9 @@
|
|
|
1082
1124
|
helperText: 'Between $1 and $10,000',
|
|
1083
1125
|
})
|
|
1084
1126
|
// Create datasource for validation errors (simulated)
|
|
1085
|
-
app.addDatasource
|
|
1086
|
-
.
|
|
1127
|
+
app.addDatasource
|
|
1128
|
+
.sqlite({ datasourceId: 'validation-errors', provider: 'local' })
|
|
1129
|
+
.entity('default/validation-errors').query(`
|
|
1087
1130
|
SELECT
|
|
1088
1131
|
id,
|
|
1089
1132
|
json_extract(data, '$.field') as field,
|
|
@@ -1131,7 +1174,11 @@
|
|
|
1131
1174
|
external sources on-demand or scheduled
|
|
1132
1175
|
code: |-
|
|
1133
1176
|
// 1. REST function to provide data
|
|
1134
|
-
const getUsersApi = app.addFunction.rest({
|
|
1177
|
+
const getUsersApi = app.addFunction.rest({
|
|
1178
|
+
functionId: 'get-users-api',
|
|
1179
|
+
method: 'GET',
|
|
1180
|
+
url: 'https://api.company.com/users',
|
|
1181
|
+
})
|
|
1135
1182
|
getUsersApi.params.header('Authorization', 'Bearer =@ctx.solution.state.apiToken')
|
|
1136
1183
|
getUsersApi.json()
|
|
1137
1184
|
getUsersApi.records('=$.data.users')
|
|
@@ -1139,7 +1186,10 @@
|
|
|
1139
1186
|
const usersData = app.addDatasource.sqlite({ datasourceId: 'users', provider: 'dynamic' })
|
|
1140
1187
|
usersData.entity('default/users')
|
|
1141
1188
|
// 3. SQL function for complex data processing
|
|
1142
|
-
const getSalesMetrics = app.addFunction.sql({
|
|
1189
|
+
const getSalesMetrics = app.addFunction.sql({
|
|
1190
|
+
functionId: 'sales-metrics',
|
|
1191
|
+
connection: 'analytics-db',
|
|
1192
|
+
})
|
|
1143
1193
|
getSalesMetrics.providerQuery(`
|
|
1144
1194
|
SELECT
|
|
1145
1195
|
region,
|
|
@@ -1155,14 +1205,24 @@
|
|
|
1155
1205
|
value: '=@ctx.jig.inputs.dateRange.start',
|
|
1156
1206
|
})
|
|
1157
1207
|
// 4. Function-driven datasource with SQL function
|
|
1158
|
-
const salesData = app.addDatasource.sqlite({
|
|
1208
|
+
const salesData = app.addDatasource.sqlite({
|
|
1209
|
+
datasourceId: 'sales-metrics',
|
|
1210
|
+
provider: 'dynamic',
|
|
1211
|
+
})
|
|
1159
1212
|
salesData.entity('default/sales')
|
|
1160
1213
|
// 5. Multiple REST endpoints combined
|
|
1161
|
-
const getInventoryApi = app.addFunction.rest({
|
|
1214
|
+
const getInventoryApi = app.addFunction.rest({
|
|
1215
|
+
functionId: 'inventory-api',
|
|
1216
|
+
method: 'GET',
|
|
1217
|
+
url: 'https://api.inventory.com/items',
|
|
1218
|
+
})
|
|
1162
1219
|
getInventoryApi.params.query('status', { value: 'active', type: 'string' })
|
|
1163
1220
|
getInventoryApi.params.header('API-Key', '=@ctx.solution.state.inventoryKey')
|
|
1164
1221
|
getInventoryApi.json()
|
|
1165
|
-
const inventoryData = app.addDatasource.sqlite({
|
|
1222
|
+
const inventoryData = app.addDatasource.sqlite({
|
|
1223
|
+
datasourceId: 'inventory',
|
|
1224
|
+
provider: 'dynamic',
|
|
1225
|
+
})
|
|
1166
1226
|
inventoryData.entity('default/inventory')
|
|
1167
1227
|
- id: entity-sync-and-queue-management-example
|
|
1168
1228
|
name: Entity Sync and Queue Management
|
|
@@ -1356,7 +1416,9 @@
|
|
|
1356
1416
|
automatically when connection is restored
|
|
1357
1417
|
code: |2-
|
|
1358
1418
|
// Configure datasource with offline support
|
|
1359
|
-
app.addDatasource
|
|
1419
|
+
app.addDatasource
|
|
1420
|
+
.sqlite({ datasourceId: 'customers', provider: 'local' })
|
|
1421
|
+
.entity('default/customers').query(`
|
|
1360
1422
|
SELECT id, data FROM [default/customers]
|
|
1361
1423
|
WHERE json_extract(data, '$.active') = true
|
|
1362
1424
|
ORDER BY json_extract(data, '$.lastModified') DESC
|
|
@@ -1819,7 +1881,9 @@
|
|
|
1819
1881
|
navigates to detail screen. Demonstrates master-detail pattern in Jigx"
|
|
1820
1882
|
code: |2-
|
|
1821
1883
|
// Create datasource for students
|
|
1822
|
-
app.addDatasource
|
|
1884
|
+
app.addDatasource
|
|
1885
|
+
.sqlite({ datasourceId: 'students', provider: 'dynamic' })
|
|
1886
|
+
.entity('default/students').query(`
|
|
1823
1887
|
SELECT
|
|
1824
1888
|
id,
|
|
1825
1889
|
json_extract(data, '$.firstName') as firstName,
|
|
@@ -2015,11 +2079,14 @@
|
|
|
2015
2079
|
value: '=@ctx.jig.inputs.city',
|
|
2016
2080
|
})
|
|
2017
2081
|
// Dropdown with static datasource
|
|
2018
|
-
app.addDatasource.static({
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2082
|
+
app.addDatasource.static({
|
|
2083
|
+
datasourceId: 'us-states',
|
|
2084
|
+
data: [
|
|
2085
|
+
{ id: 'WA', state: 'Washington' },
|
|
2086
|
+
{ id: 'CA', state: 'California' },
|
|
2087
|
+
{ id: 'NY', state: 'New York' },
|
|
2088
|
+
],
|
|
2089
|
+
})
|
|
2023
2090
|
const stateDropdown = step2Screen.addControl.dropdown({
|
|
2024
2091
|
instanceId: 'state',
|
|
2025
2092
|
label: 'State',
|
|
@@ -2125,7 +2192,9 @@
|
|
|
2125
2192
|
alerts"
|
|
2126
2193
|
code: |2-
|
|
2127
2194
|
// Auto-refreshing datasource
|
|
2128
|
-
app.addDatasource
|
|
2195
|
+
app.addDatasource
|
|
2196
|
+
.sqlite({ datasourceId: 'system-status', provider: 'dynamic' })
|
|
2197
|
+
.entity('default/status').query(`
|
|
2129
2198
|
SELECT
|
|
2130
2199
|
id,
|
|
2131
2200
|
json_extract(data, '$.health') as health,
|
|
@@ -2433,7 +2502,9 @@
|
|
|
2433
2502
|
tabs and widget grid. Support conditional display based on user roles
|
|
2434
2503
|
code: |-
|
|
2435
2504
|
// Configure home hub
|
|
2436
|
-
const app = new ApplicationBuilder({ name: 'my-app', title: 'My Business App' }).with({
|
|
2505
|
+
const app = new ApplicationBuilder({ name: 'my-app', title: 'My Business App' }).with({
|
|
2506
|
+
category: 'business',
|
|
2507
|
+
})
|
|
2437
2508
|
// Add home hub with navigation tabs
|
|
2438
2509
|
app.addTab({ screenId: 'dashboard', icon: 'home', label: 'Dashboard' })
|
|
2439
2510
|
app.addTab({ screenId: 'tasks', icon: 'task-checklist', label: 'Tasks' })
|
|
@@ -2453,7 +2524,7 @@
|
|
|
2453
2524
|
data
|
|
2454
2525
|
code: |-
|
|
2455
2526
|
// Widget with navigation
|
|
2456
|
-
const screen = app.addScreen.staticGrid({ screenId: 'grid-1', title: 'Static Grid'
|
|
2527
|
+
const screen = app.addScreen.staticGrid({ screenId: 'grid-1', title: 'Static Grid' })
|
|
2457
2528
|
// Add a grid item
|
|
2458
2529
|
screen.addControl.gridItem().addControl.widget().screenId('some-jig-id')
|
|
2459
2530
|
- id: widget-grid-configuration-example
|
|
@@ -2470,7 +2541,7 @@
|
|
|
2470
2541
|
different widget sizes and conditional display. Enable navigation and data
|
|
2471
2542
|
binding
|
|
2472
2543
|
code: |-
|
|
2473
|
-
const screen = app.addScreen.staticGrid({ screenId: 'grid-1', title: 'Static Grid'
|
|
2544
|
+
const screen = app.addScreen.staticGrid({ screenId: 'grid-1', title: 'Static Grid' })
|
|
2474
2545
|
// Add a grid item
|
|
2475
2546
|
screen.addControl
|
|
2476
2547
|
.gridItem()
|
|
@@ -2670,7 +2741,9 @@
|
|
|
2670
2741
|
authentication requirements. Support deep linking with parameters
|
|
2671
2742
|
code: |2-
|
|
2672
2743
|
// Create datasource for navigation items
|
|
2673
|
-
app.addDatasource
|
|
2744
|
+
app.addDatasource
|
|
2745
|
+
.sqlite({ datasourceId: 'nav-items', provider: 'local' })
|
|
2746
|
+
.entity('default/nav-items').query(`
|
|
2674
2747
|
SELECT
|
|
2675
2748
|
id,
|
|
2676
2749
|
json_extract(data, '$.title') as title,
|
|
@@ -2693,7 +2766,7 @@
|
|
|
2693
2766
|
listItem.subtitle('=@ctx.current.item.type')
|
|
2694
2767
|
// Conditional navigation based on item type
|
|
2695
2768
|
const buttons = screen.bottomPanel({ numberOfVisibleActions: 1 })
|
|
2696
|
-
const navButton = buttons.add.list({ concurrency: 'sequential',
|
|
2769
|
+
const navButton = buttons.add.list({ concurrency: 'sequential', title: 'Navigate' })
|
|
2697
2770
|
// Check if external URL
|
|
2698
2771
|
navButton.actions.openUrl({
|
|
2699
2772
|
instanceId: 'open-external',
|
|
@@ -2808,8 +2881,8 @@
|
|
|
2808
2881
|
// Common date formats
|
|
2809
2882
|
.value('=$fromMillis($now(), "[Y]-[M01]-[D01]")') // 2024-03-15
|
|
2810
2883
|
.value('=$fromMillis($now(), "[D] [MNn] [Y]")') // 15 Mar 2024
|
|
2811
|
-
|
|
2812
|
-
.value(`=(
|
|
2884
|
+
// 3:45 PM
|
|
2885
|
+
.value('=$fromMillis($now(), "[h]:[m01] [P]")').value(`=(
|
|
2813
2886
|
$diff := $now() - @ctx.jig.inputs.timestamp;
|
|
2814
2887
|
$days := $floor($diff / 86400000);
|
|
2815
2888
|
$hours := $floor($diff / 3600000);
|
|
@@ -3976,7 +4049,10 @@
|
|
|
3976
4049
|
intermediate results. Improve readability and debugging
|
|
3977
4050
|
code: |-
|
|
3978
4051
|
// Instead of one massive expression, use state
|
|
3979
|
-
const actions = screen.onFocus.list({
|
|
4052
|
+
const actions = screen.onFocus.list({
|
|
4053
|
+
concurrency: 'sequential',
|
|
4054
|
+
instanceId: 'simplify-logic',
|
|
4055
|
+
}).actions
|
|
3980
4056
|
actions.setScreenState({
|
|
3981
4057
|
instanceId: 'filter-items',
|
|
3982
4058
|
keys: {
|
|
@@ -4005,15 +4081,17 @@
|
|
|
4005
4081
|
related fields
|
|
4006
4082
|
code: |2-
|
|
4007
4083
|
// Create datasources for countries and states
|
|
4008
|
-
const countries = app.addDatasource
|
|
4009
|
-
.
|
|
4084
|
+
const countries = app.addDatasource
|
|
4085
|
+
.sqlite({ datasourceId: 'countries', provider: 'local' })
|
|
4086
|
+
.entity('default/countries').query(`
|
|
4010
4087
|
SELECT
|
|
4011
4088
|
id,
|
|
4012
4089
|
json_extract(data, '$.name') as name,
|
|
4013
4090
|
json_extract(data, '$.code') as code
|
|
4014
4091
|
FROM [default/countries]
|
|
4015
4092
|
`)
|
|
4016
|
-
app.addDatasource.sqlite({ datasourceId: 'states', provider: 'local' }).entity('default/states')
|
|
4093
|
+
app.addDatasource.sqlite({ datasourceId: 'states', provider: 'local' }).entity('default/states')
|
|
4094
|
+
.query(`
|
|
4017
4095
|
SELECT
|
|
4018
4096
|
id,
|
|
4019
4097
|
json_extract(data, '$.name') as name,
|
|
@@ -4304,7 +4382,7 @@
|
|
|
4304
4382
|
code: |-
|
|
4305
4383
|
// Example: One button that does multiple things
|
|
4306
4384
|
const buttons = screen.bottomPanel({ numberOfVisibleActions: 1 })
|
|
4307
|
-
const actionList = buttons.add.list({ concurrency: 'sequential',
|
|
4385
|
+
const actionList = buttons.add.list({ concurrency: 'sequential', title: 'Save and Close' })
|
|
4308
4386
|
const sequentialActions = actionList.actions
|
|
4309
4387
|
sequentialActions
|
|
4310
4388
|
.executeEntity({ instanceId: 'create-customer' })
|
|
@@ -4408,7 +4486,10 @@
|
|
|
4408
4486
|
code: |-
|
|
4409
4487
|
// 1. Sequential workflow for order processing (order matters)
|
|
4410
4488
|
const orderActions = orderScreen.bottomPanel({ numberOfVisibleActions: 2 })
|
|
4411
|
-
const processOrder = orderActions.add.list({
|
|
4489
|
+
const processOrder = orderActions.add.list({
|
|
4490
|
+
concurrency: 'sequential',
|
|
4491
|
+
title: 'Process Order',
|
|
4492
|
+
})
|
|
4412
4493
|
const sequentialActions = processOrder.actions
|
|
4413
4494
|
// Execute in order: validate → save → update status → notify
|
|
4414
4495
|
sequentialActions
|
|
@@ -4445,7 +4526,10 @@
|
|
|
4445
4526
|
},
|
|
4446
4527
|
})
|
|
4447
4528
|
// 2. Parallel batch operations for analytics (order doesn't matter)
|
|
4448
|
-
const analyticsActions = orderActions.add.list({
|
|
4529
|
+
const analyticsActions = orderActions.add.list({
|
|
4530
|
+
concurrency: 'parallel',
|
|
4531
|
+
title: 'Track Analytics',
|
|
4532
|
+
})
|
|
4449
4533
|
const parallelActions = analyticsActions.actions
|
|
4450
4534
|
// Execute simultaneously: user activity + system metrics + performance data
|
|
4451
4535
|
parallelActions
|
|
@@ -4479,7 +4563,7 @@
|
|
|
4479
4563
|
// These action lists execute automatically during app lifecycle events (onLoad, onFocus, onRefresh)
|
|
4480
4564
|
// Use app.onLoad.list({ concurrency: 'sequential' }) or app.onLoad.list({ concurrency: 'parallel' }) for background workflow orchestration
|
|
4481
4565
|
// 3. Application-level sequential sync on startup
|
|
4482
|
-
const appSync = app.onLoad.list({ concurrency: 'sequential',
|
|
4566
|
+
const appSync = app.onLoad.list({ concurrency: 'sequential', instanceId: 'app-startup-sync' })
|
|
4483
4567
|
const syncActions = appSync.actions
|
|
4484
4568
|
// Sync critical data first, then secondary data
|
|
4485
4569
|
syncActions
|
|
@@ -4508,7 +4592,8 @@
|
|
|
4508
4592
|
// More examples of user-triggered action lists with conditional logic
|
|
4509
4593
|
// 4. Conditional action list for error handling
|
|
4510
4594
|
const recoveryActions = errorScreen.bottomPanel({ numberOfVisibleActions: 1 })
|
|
4511
|
-
const retryWorkflow = recoveryActions.add.list({
|
|
4595
|
+
const retryWorkflow = recoveryActions.add.list({
|
|
4596
|
+
concurrency: 'sequential',
|
|
4512
4597
|
title: 'Retry Operation',
|
|
4513
4598
|
when: '=@ctx.response.status >= 500',
|
|
4514
4599
|
})
|
|
@@ -5030,7 +5115,10 @@
|
|
|
5030
5115
|
// These actions execute automatically during app lifecycle events (onLoad, onFocus, onRefresh)
|
|
5031
5116
|
// Use app.onLoad.list({ concurrency: 'sequential' }).actions.deleteSyncScope() for background scope cleanup
|
|
5032
5117
|
// 3. Background sync scope management
|
|
5033
|
-
const appActions = app.onLoad.list({
|
|
5118
|
+
const appActions = app.onLoad.list({
|
|
5119
|
+
concurrency: 'sequential',
|
|
5120
|
+
instanceId: 'sync-scope-cleanup',
|
|
5121
|
+
}).actions
|
|
5034
5122
|
// Auto-cleanup on app start
|
|
5035
5123
|
appActions.deleteSyncScope({
|
|
5036
5124
|
itemId: 'auto-cleanup-temp',
|
|
@@ -5115,7 +5203,10 @@
|
|
|
5115
5203
|
// These actions execute automatically during app lifecycle events (onLoad, onFocus, onRefresh)
|
|
5116
5204
|
// Use app.onLoad.list({ concurrency: 'sequential' }).actions.deleteSyncStatus() for background status management
|
|
5117
5205
|
// 3. Background sync status management
|
|
5118
|
-
const appActions = app.onLoad.list({
|
|
5206
|
+
const appActions = app.onLoad.list({
|
|
5207
|
+
concurrency: 'sequential',
|
|
5208
|
+
instanceId: 'cleanup-status',
|
|
5209
|
+
}).actions
|
|
5119
5210
|
// Auto-cleanup old statuses
|
|
5120
5211
|
appActions.deleteSyncStatus({
|
|
5121
5212
|
itemId: 'cleanup-old-statuses',
|
|
@@ -7624,7 +7715,7 @@
|
|
|
7624
7715
|
when: '=@ctx.solution.state.hasTimeSensitiveFailures',
|
|
7625
7716
|
})
|
|
7626
7717
|
// Screen-level retry on focus
|
|
7627
|
-
const screenActions = errorDashboard.onFocus.list({ concurrency: 'parallel'
|
|
7718
|
+
const screenActions = errorDashboard.onFocus.list({ concurrency: 'parallel' }).actions
|
|
7628
7719
|
// Retry on screen focus
|
|
7629
7720
|
screenActions.retryQueueCommand({
|
|
7630
7721
|
commandId: 'focus-retry-failed',
|
|
@@ -7815,7 +7906,8 @@
|
|
|
7815
7906
|
instanceId: 'track-app-start',
|
|
7816
7907
|
keys: {
|
|
7817
7908
|
lastAppStart: '=$now()',
|
|
7818
|
-
appStartCount:
|
|
7909
|
+
appStartCount:
|
|
7910
|
+
'=(@ctx.solution.state.appStartCount ? @ctx.solution.state.appStartCount : 0) + 1',
|
|
7819
7911
|
},
|
|
7820
7912
|
})
|
|
7821
7913
|
// Initialize default state
|
|
@@ -7842,7 +7934,8 @@
|
|
|
7842
7934
|
instanceId: 'cleanup-on-refresh',
|
|
7843
7935
|
keys: {
|
|
7844
7936
|
lastRefreshTime: '=$now()',
|
|
7845
|
-
refreshCount:
|
|
7937
|
+
refreshCount:
|
|
7938
|
+
'=(@ctx.solution.state.refreshCount ? @ctx.solution.state.refreshCount : 0) + 1',
|
|
7846
7939
|
},
|
|
7847
7940
|
})
|
|
7848
7941
|
- id: action.action.set-screen-state
|
|
@@ -7895,7 +7988,8 @@
|
|
|
7895
7988
|
instanceId: 'track-interaction',
|
|
7896
7989
|
keys: {
|
|
7897
7990
|
lastAction: '=@ctx.solution.state.lastAction',
|
|
7898
|
-
interactionCount:
|
|
7991
|
+
interactionCount:
|
|
7992
|
+
'=(@ctx.jig.state.interactionCount ? @ctx.jig.state.interactionCount : 0) + 1',
|
|
7899
7993
|
sessionTime: '=Date.now() - @ctx.jig.state.sessionStart',
|
|
7900
7994
|
},
|
|
7901
7995
|
})
|
|
@@ -8947,7 +9041,8 @@
|
|
|
8947
9041
|
- icon
|
|
8948
9042
|
description: Create parallel action list button with icon and primary styling
|
|
8949
9043
|
code: |-
|
|
8950
|
-
const parallel = screen.bottomPanel().add.list({
|
|
9044
|
+
const parallel = screen.bottomPanel().add.list({
|
|
9045
|
+
concurrency: 'parallel',
|
|
8951
9046
|
title: 'Execute Actions',
|
|
8952
9047
|
icon: 'play',
|
|
8953
9048
|
isPrimary: true,
|
|
@@ -8964,10 +9059,9 @@
|
|
|
8964
9059
|
- sequential
|
|
8965
9060
|
description: Execute navigation action sequentially in background workflow
|
|
8966
9061
|
code: |-
|
|
8967
|
-
const sequential = screen
|
|
8968
|
-
|
|
8969
|
-
instanceId: 'list-1'
|
|
8970
|
-
})
|
|
9062
|
+
const sequential = screen
|
|
9063
|
+
.bottomPanel()
|
|
9064
|
+
.add.list({ concurrency: 'sequential', title: 'Test Action List', instanceId: 'list-1' })
|
|
8971
9065
|
sequential.actions.goto({ linkTo: 'home' })
|
|
8972
9066
|
- id: action-list-example-2
|
|
8973
9067
|
name: Action List Sequential Execution Mode (background)
|
|
@@ -8981,7 +9075,8 @@
|
|
|
8981
9075
|
- conditional
|
|
8982
9076
|
description: Execute actions sequentially with conditional when expression
|
|
8983
9077
|
code: |-
|
|
8984
|
-
const sequential = screen.bottomPanel().add.list({
|
|
9078
|
+
const sequential = screen.bottomPanel().add.list({
|
|
9079
|
+
concurrency: 'sequential',
|
|
8985
9080
|
title: 'Sequential Actions',
|
|
8986
9081
|
when: '=@ctx.jig.state.canExecute',
|
|
8987
9082
|
})
|
|
@@ -8997,7 +9092,9 @@
|
|
|
8997
9092
|
- parallel
|
|
8998
9093
|
description: Execute multiple actions simultaneously in parallel mode
|
|
8999
9094
|
code: |-
|
|
9000
|
-
const parallel = screen
|
|
9095
|
+
const parallel = screen
|
|
9096
|
+
.bottomPanel()
|
|
9097
|
+
.add.list({ concurrency: 'parallel', title: 'Test Action List' })
|
|
9001
9098
|
parallel.actions.goto({ linkTo: 'home' })
|
|
9002
9099
|
- id: clear-queue.button-example-1
|
|
9003
9100
|
name: Clear Queue Button (button)
|
|
@@ -9348,7 +9445,7 @@
|
|
|
9348
9445
|
- background
|
|
9349
9446
|
- confirm
|
|
9350
9447
|
- modal
|
|
9351
|
-
description: Create confirm modal with title only
|
|
9448
|
+
description: Create confirm modal with title only; the runtime supplies the button texts
|
|
9352
9449
|
code: |-
|
|
9353
9450
|
const confirm = backgroundActions.confirm({
|
|
9354
9451
|
instanceId: 'confirm-modal-1',
|
|
@@ -17204,6 +17301,42 @@
|
|
|
17204
17301
|
lastRefresh: '=$now()',
|
|
17205
17302
|
},
|
|
17206
17303
|
})
|
|
17304
|
+
- id: set-state.button-example
|
|
17305
|
+
name: Toggle Photo Search Button (button)
|
|
17306
|
+
category: action
|
|
17307
|
+
tags:
|
|
17308
|
+
- action
|
|
17309
|
+
- button
|
|
17310
|
+
- set-state
|
|
17311
|
+
- solution-state
|
|
17312
|
+
- styling
|
|
17313
|
+
- icon
|
|
17314
|
+
description: Set a solution state flag from a primary button
|
|
17315
|
+
code: |-
|
|
17316
|
+
const setStateButton = buttonActions.add.setState({
|
|
17317
|
+
title: 'Search Photos',
|
|
17318
|
+
instanceId: 'btn-set-1',
|
|
17319
|
+
stateKey: '=@ctx.solution.state.showPhotoSearch',
|
|
17320
|
+
value: true,
|
|
17321
|
+
icon: 'search',
|
|
17322
|
+
isPrimary: true,
|
|
17323
|
+
})
|
|
17324
|
+
- id: set-state-example
|
|
17325
|
+
name: Remember Selected Appointment in Solution State (background)
|
|
17326
|
+
category: action
|
|
17327
|
+
tags:
|
|
17328
|
+
- action
|
|
17329
|
+
- background
|
|
17330
|
+
- set-state
|
|
17331
|
+
- solution-state
|
|
17332
|
+
- expressions
|
|
17333
|
+
description: Store the selected item id in a solution state key
|
|
17334
|
+
code: |-
|
|
17335
|
+
const setState = backgroundActions.setState({
|
|
17336
|
+
instanceId: 'set-1',
|
|
17337
|
+
stateKey: '=@ctx.solution.state.selectedAppointmentId',
|
|
17338
|
+
value: '=@ctx.current.item.id',
|
|
17339
|
+
})
|
|
17207
17340
|
- id: share.button-example-1
|
|
17208
17341
|
name: Basic Share Button
|
|
17209
17342
|
category: action
|
|
@@ -17750,18 +17883,16 @@
|
|
|
17750
17883
|
code: |-
|
|
17751
17884
|
const withActions = actions.showAlert({
|
|
17752
17885
|
instanceId: 'alert-10',
|
|
17753
|
-
|
|
17886
|
+
title: 'Upload needs attention',
|
|
17887
|
+
description: 'Some files could not be uploaded.',
|
|
17754
17888
|
presentAs: 'modal',
|
|
17755
|
-
|
|
17756
|
-
|
|
17757
|
-
|
|
17758
|
-
|
|
17759
|
-
|
|
17760
|
-
|
|
17761
|
-
|
|
17762
|
-
style: 'destructive',
|
|
17763
|
-
},
|
|
17764
|
-
],
|
|
17889
|
+
})
|
|
17890
|
+
withActions.addAction.goto({ title: 'Review sync', linkTo: 'sync-progress' })
|
|
17891
|
+
withActions.addAction.executeAction({
|
|
17892
|
+
title: 'Retry',
|
|
17893
|
+
icon: 'synchronize-arrows',
|
|
17894
|
+
action: 'retry-upload',
|
|
17895
|
+
isDanger: true,
|
|
17765
17896
|
})
|
|
17766
17897
|
- id: show-alert-example-7
|
|
17767
17898
|
name: Complete Action Structure Verification (background)
|
|
@@ -17789,17 +17920,12 @@
|
|
|
17789
17920
|
group: {
|
|
17790
17921
|
id: 'background-alerts',
|
|
17791
17922
|
},
|
|
17792
|
-
actions: [
|
|
17793
|
-
{
|
|
17794
|
-
title: 'Retry',
|
|
17795
|
-
style: 'default',
|
|
17796
|
-
},
|
|
17797
|
-
],
|
|
17798
17923
|
details: {
|
|
17799
17924
|
module: 'background-processor',
|
|
17800
17925
|
errorCode: 500,
|
|
17801
17926
|
},
|
|
17802
17927
|
})
|
|
17928
|
+
comprehensive.addAction.executeAction({ title: 'Retry', action: 'retry-upload' })
|
|
17803
17929
|
- id: start-location-sharing.button-example-1
|
|
17804
17930
|
name: Basic Start Location Sharing Button
|
|
17805
17931
|
category: action
|
|
@@ -20487,8 +20613,10 @@
|
|
|
20487
20613
|
categorization and metadata
|
|
20488
20614
|
code: |-
|
|
20489
20615
|
// Basic application setup with metadata
|
|
20490
|
-
const customerApp = new ApplicationBuilder({
|
|
20491
|
-
|
|
20616
|
+
const customerApp = new ApplicationBuilder({
|
|
20617
|
+
name: 'customer-management',
|
|
20618
|
+
title: 'Customer Management',
|
|
20619
|
+
}).with({ category: 'business', description: 'Complete CRM solution for field sales teams' })
|
|
20492
20620
|
// Configure database tables for offline storage
|
|
20493
20621
|
customerApp.addDatabase.default
|
|
20494
20622
|
.table('customers', 'orders', 'products')
|
|
@@ -20573,8 +20701,10 @@
|
|
|
20573
20701
|
action: 'sync-customers',
|
|
20574
20702
|
})
|
|
20575
20703
|
// E-commerce application example
|
|
20576
|
-
const ecommerceApp = new ApplicationBuilder({
|
|
20577
|
-
|
|
20704
|
+
const ecommerceApp = new ApplicationBuilder({
|
|
20705
|
+
name: 'mobile-store',
|
|
20706
|
+
title: 'Mobile Store',
|
|
20707
|
+
}).with({ category: 'sales', description: 'Mobile shopping application with product catalog' })
|
|
20578
20708
|
// Product catalog database
|
|
20579
20709
|
ecommerceApp.addDatabase.default
|
|
20580
20710
|
.table('products', 'categories', 'cart')
|
|
@@ -20636,8 +20766,9 @@
|
|
|
20636
20766
|
application state. Use CTX helpers for building expressions with proper
|
|
20637
20767
|
syntax and validation
|
|
20638
20768
|
code: |-
|
|
20639
|
-
const contextApp = new ApplicationBuilder({ name: 'context-demo', title: 'Context Demo' })
|
|
20640
|
-
|
|
20769
|
+
const contextApp = new ApplicationBuilder({ name: 'context-demo', title: 'Context Demo' }).with(
|
|
20770
|
+
{ category: 'business', description: 'Demonstrates context and state management patterns' },
|
|
20771
|
+
)
|
|
20641
20772
|
// Setup application state and expressions
|
|
20642
20773
|
contextApp.expression('userRole', '=@ctx.solution.state.userRole')
|
|
20643
20774
|
contextApp.expression('isLoggedIn', '=@ctx.solution.state.isLoggedIn')
|
|
@@ -20655,11 +20786,14 @@
|
|
|
20655
20786
|
.query(
|
|
20656
20787
|
"SELECT id, json_extract(data, '$.message') AS message, json_extract(data, '$.read') AS read FROM [default/notifications]",
|
|
20657
20788
|
)
|
|
20658
|
-
contextApp.addDatasource.static({
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
20789
|
+
contextApp.addDatasource.static({
|
|
20790
|
+
datasourceId: 'settings',
|
|
20791
|
+
data: [
|
|
20792
|
+
{ key: 'theme', value: 'dark' },
|
|
20793
|
+
{ key: 'language', value: 'en' },
|
|
20794
|
+
{ key: 'notifications', value: true },
|
|
20795
|
+
],
|
|
20796
|
+
})
|
|
20663
20797
|
// Create screens that demonstrate context usage
|
|
20664
20798
|
const dashboard = contextApp.addScreen.default({
|
|
20665
20799
|
screenId: 'dashboard',
|
|
@@ -20709,7 +20843,10 @@
|
|
|
20709
20843
|
value: '=@ctx.datasources.settings[key = "language"].value',
|
|
20710
20844
|
})
|
|
20711
20845
|
// Advanced context usage examples
|
|
20712
|
-
const advancedApp = new ApplicationBuilder({
|
|
20846
|
+
const advancedApp = new ApplicationBuilder({
|
|
20847
|
+
name: 'advanced-context',
|
|
20848
|
+
title: 'Advanced Context',
|
|
20849
|
+
}).with({ category: 'analytics' })
|
|
20713
20850
|
// Complex expression using multiple context sources
|
|
20714
20851
|
advancedApp.expression(
|
|
20715
20852
|
'userStatus',
|
|
@@ -20724,7 +20861,11 @@
|
|
|
20724
20861
|
']',
|
|
20725
20862
|
)
|
|
20726
20863
|
// Function call with context parameters
|
|
20727
|
-
advancedApp.addFunction.rest({
|
|
20864
|
+
advancedApp.addFunction.rest({
|
|
20865
|
+
functionId: 'user-data',
|
|
20866
|
+
method: 'GET',
|
|
20867
|
+
url: 'https://api.example.com/users',
|
|
20868
|
+
})
|
|
20728
20869
|
advancedApp.expression('userData', '=@ctx.datasources.userData')
|
|
20729
20870
|
// Screen with complex state management
|
|
20730
20871
|
const analyticsScreen = advancedApp.addScreen.default({
|
|
@@ -20765,15 +20906,20 @@
|
|
|
20765
20906
|
visibility
|
|
20766
20907
|
code: |-
|
|
20767
20908
|
// Basic tab navigation setup
|
|
20768
|
-
const businessApp = new ApplicationBuilder({
|
|
20769
|
-
|
|
20909
|
+
const businessApp = new ApplicationBuilder({
|
|
20910
|
+
name: 'business-dashboard',
|
|
20911
|
+
title: 'Business Dashboard',
|
|
20912
|
+
}).with({ category: 'business', description: 'Complete business management application' })
|
|
20770
20913
|
// Core navigation tabs with icons and labels
|
|
20771
20914
|
businessApp.addTab({ screenId: 'home', icon: 'home', label: 'Dashboard' })
|
|
20772
20915
|
businessApp.addTab({ screenId: 'customers', icon: 'multiple-users-3', label: 'Customers' })
|
|
20773
20916
|
businessApp.addTab({ screenId: 'orders', icon: 'shopping-cart', label: 'Orders' })
|
|
20774
20917
|
businessApp.addTab({ screenId: 'reports', icon: 'analytics-graph-bar', label: 'Reports' })
|
|
20775
20918
|
// Advanced tab configuration with badges and conditions
|
|
20776
|
-
const messagingApp = new ApplicationBuilder({
|
|
20919
|
+
const messagingApp = new ApplicationBuilder({
|
|
20920
|
+
name: 'team-messenger',
|
|
20921
|
+
title: 'Team Messenger',
|
|
20922
|
+
}).with({ category: 'communications' })
|
|
20777
20923
|
// Message tab with unread count badge
|
|
20778
20924
|
messagingApp.addTab({
|
|
20779
20925
|
screenId: 'messages',
|
|
@@ -20798,7 +20944,9 @@
|
|
|
20798
20944
|
when: '=@ctx.solution.state.user.role = "admin"',
|
|
20799
20945
|
})
|
|
20800
20946
|
// E-commerce app with dynamic badges
|
|
20801
|
-
const shopApp = new ApplicationBuilder({ name: 'mobile-shop', title: 'Mobile Shop' }).with({
|
|
20947
|
+
const shopApp = new ApplicationBuilder({ name: 'mobile-shop', title: 'Mobile Shop' }).with({
|
|
20948
|
+
category: 'sales',
|
|
20949
|
+
})
|
|
20802
20950
|
// Product catalog tab
|
|
20803
20951
|
shopApp.addTab({ screenId: 'catalog', icon: 'grid-layout-module-1', label: 'Products' })
|
|
20804
20952
|
// Shopping cart with item count
|
|
@@ -20820,7 +20968,9 @@
|
|
|
20820
20968
|
// Account tab
|
|
20821
20969
|
shopApp.addTab({ screenId: 'account', icon: 'single-man-circle', label: 'Account' })
|
|
20822
20970
|
// Field service app with status-based badges
|
|
20823
|
-
const fieldApp = new ApplicationBuilder({ name: 'field-service', title: 'Field Service' }).with(
|
|
20971
|
+
const fieldApp = new ApplicationBuilder({ name: 'field-service', title: 'Field Service' }).with(
|
|
20972
|
+
{ category: 'field-services' },
|
|
20973
|
+
)
|
|
20824
20974
|
// Tasks tab with priority count
|
|
20825
20975
|
fieldApp.addTab({
|
|
20826
20976
|
screenId: 'tasks',
|
|
@@ -20950,7 +21100,10 @@
|
|
|
20950
21100
|
- category
|
|
20951
21101
|
- description
|
|
20952
21102
|
description: Create basic business application with title, category, and description
|
|
20953
|
-
code:
|
|
21103
|
+
code: |2-
|
|
21104
|
+
category: 'business',
|
|
21105
|
+
description: 'A test application',
|
|
21106
|
+
})
|
|
20954
21107
|
- id: application-example-2
|
|
20955
21108
|
name: Application with Tab Navigation Configuration
|
|
20956
21109
|
category: application
|
|
@@ -21009,7 +21162,10 @@
|
|
|
21009
21162
|
description: Build complete application with database tables, SQLite datasource,
|
|
21010
21163
|
and REST function
|
|
21011
21164
|
code: |-
|
|
21012
|
-
const app: ApplicationBuilder = new ApplicationBuilder({
|
|
21165
|
+
const app: ApplicationBuilder = new ApplicationBuilder({
|
|
21166
|
+
name: 'complete-app',
|
|
21167
|
+
title: 'Complete App',
|
|
21168
|
+
})
|
|
21013
21169
|
// Use the application's bound factories
|
|
21014
21170
|
app.addDatabase.default.table('users').table('orders')
|
|
21015
21171
|
app.addDatasource
|
|
@@ -21048,8 +21204,12 @@
|
|
|
21048
21204
|
- build
|
|
21049
21205
|
- properties
|
|
21050
21206
|
description: Create application with description property for app metadata
|
|
21051
|
-
code:
|
|
21052
|
-
|
|
21207
|
+
code: |-
|
|
21208
|
+
const app = new ApplicationBuilder({
|
|
21209
|
+
name: 'descriptive-app',
|
|
21210
|
+
title: 'Descriptive App',
|
|
21211
|
+
description: 'App with detailed description',
|
|
21212
|
+
})
|
|
21053
21213
|
- id: component.jc.left-right.element-1
|
|
21054
21214
|
name: Left-Side Element Components
|
|
21055
21215
|
category: component
|
|
@@ -23174,11 +23334,14 @@
|
|
|
23174
23334
|
.title('=@ctx.current.item.name')
|
|
23175
23335
|
.value('=@ctx.current.item.id')
|
|
23176
23336
|
// 2. Choice field with static datasource
|
|
23177
|
-
app.addDatasource.static({
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
|
|
23337
|
+
app.addDatasource.static({
|
|
23338
|
+
datasourceId: 'task-priorities',
|
|
23339
|
+
data: [
|
|
23340
|
+
{ id: 'low', name: 'Low Priority', color: 'green' },
|
|
23341
|
+
{ id: 'medium', name: 'Medium Priority', color: 'yellow' },
|
|
23342
|
+
{ id: 'high', name: 'High Priority', color: 'red' },
|
|
23343
|
+
],
|
|
23344
|
+
})
|
|
23182
23345
|
const priorityForm = screen.addControl.form({ instanceId: 'priority-form' })
|
|
23183
23346
|
const priorityChoice = priorityForm.addControl.choiceField({
|
|
23184
23347
|
instanceId: 'priority-field',
|
|
@@ -23378,27 +23541,30 @@
|
|
|
23378
23541
|
})
|
|
23379
23542
|
// 1. Payment method selector (single choice with icons)
|
|
23380
23543
|
const paymentForm = screen.addControl.form({ instanceId: 'payment' })
|
|
23381
|
-
app.addDatasource.static({
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23544
|
+
app.addDatasource.static({
|
|
23545
|
+
datasourceId: 'payment-methods',
|
|
23546
|
+
data: [
|
|
23547
|
+
{
|
|
23548
|
+
id: 'credit',
|
|
23549
|
+
name: 'Credit Card',
|
|
23550
|
+
icon: 'credit-card',
|
|
23551
|
+
description: 'Visa, MasterCard, Amex',
|
|
23552
|
+
},
|
|
23553
|
+
{
|
|
23554
|
+
id: 'debit',
|
|
23555
|
+
name: 'Debit Card',
|
|
23556
|
+
icon: 'credit-card-payment',
|
|
23557
|
+
description: 'Direct bank payment',
|
|
23558
|
+
},
|
|
23559
|
+
{
|
|
23560
|
+
id: 'paypal',
|
|
23561
|
+
name: 'PayPal',
|
|
23562
|
+
icon: 'payment-paypal-logo',
|
|
23563
|
+
description: 'PayPal account',
|
|
23564
|
+
},
|
|
23565
|
+
{ id: 'apple', name: 'Apple Pay', icon: 'apple', description: 'Touch ID payment' },
|
|
23566
|
+
],
|
|
23567
|
+
})
|
|
23402
23568
|
const paymentMethod = paymentForm.addControl.choiceField({
|
|
23403
23569
|
instanceId: 'payment-method',
|
|
23404
23570
|
label: 'Payment Method',
|
|
@@ -23452,13 +23618,16 @@
|
|
|
23452
23618
|
})
|
|
23453
23619
|
// 3. Size selection with custom layout
|
|
23454
23620
|
const sizeForm = screen.addControl.form({ instanceId: 'sizing' })
|
|
23455
|
-
app.addDatasource.static({
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23621
|
+
app.addDatasource.static({
|
|
23622
|
+
datasourceId: 'sizes',
|
|
23623
|
+
data: [
|
|
23624
|
+
{ code: 'XS', label: 'Extra Small', available: true },
|
|
23625
|
+
{ code: 'S', label: 'Small', available: true },
|
|
23626
|
+
{ code: 'M', label: 'Medium', available: true },
|
|
23627
|
+
{ code: 'L', label: 'Large', available: false },
|
|
23628
|
+
{ code: 'XL', label: 'Extra Large', available: true },
|
|
23629
|
+
],
|
|
23630
|
+
})
|
|
23462
23631
|
const sizeChoice = sizeForm.addControl.choiceField({
|
|
23463
23632
|
instanceId: 'size',
|
|
23464
23633
|
label: 'Size',
|
|
@@ -23515,12 +23684,15 @@
|
|
|
23515
23684
|
eligibilityCheck: true,
|
|
23516
23685
|
})
|
|
23517
23686
|
// Priority level with business constraints
|
|
23518
|
-
app.addDatasource.static({
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
|
|
23523
|
-
|
|
23687
|
+
app.addDatasource.static({
|
|
23688
|
+
datasourceId: 'priority-levels',
|
|
23689
|
+
data: [
|
|
23690
|
+
{ level: 'low', name: 'Low Priority', cost: 0 },
|
|
23691
|
+
{ level: 'normal', name: 'Normal Priority', cost: 10 },
|
|
23692
|
+
{ level: 'high', name: 'High Priority', cost: 25 },
|
|
23693
|
+
{ level: 'urgent', name: 'Urgent Priority', cost: 50 },
|
|
23694
|
+
],
|
|
23695
|
+
})
|
|
23524
23696
|
const priorityChoice = planForm.addControl.choiceField({
|
|
23525
23697
|
instanceId: 'priority-level',
|
|
23526
23698
|
label: 'Priority Level',
|
|
@@ -23608,13 +23780,16 @@
|
|
|
23608
23780
|
.title('=@ctx.current.item.name')
|
|
23609
23781
|
.value('=@ctx.current.item.id')
|
|
23610
23782
|
// Survey question with conditional follow-up
|
|
23611
|
-
app.addDatasource.static({
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23783
|
+
app.addDatasource.static({
|
|
23784
|
+
datasourceId: 'satisfaction-ratings',
|
|
23785
|
+
data: [
|
|
23786
|
+
{ rating: 1, label: 'Very Dissatisfied', followUp: true },
|
|
23787
|
+
{ rating: 2, label: 'Dissatisfied', followUp: true },
|
|
23788
|
+
{ rating: 3, label: 'Neutral', followUp: false },
|
|
23789
|
+
{ rating: 4, label: 'Satisfied', followUp: false },
|
|
23790
|
+
{ rating: 5, label: 'Very Satisfied', followUp: false },
|
|
23791
|
+
],
|
|
23792
|
+
})
|
|
23618
23793
|
const surveyChoice = configForm.addControl.choiceField({
|
|
23619
23794
|
instanceId: 'satisfaction',
|
|
23620
23795
|
label: 'How satisfied are you with our service?',
|
|
@@ -23629,12 +23804,15 @@
|
|
|
23629
23804
|
.title('=@ctx.current.item.label')
|
|
23630
23805
|
.value('=@ctx.current.item.rating')
|
|
23631
23806
|
// Accessibility preferences
|
|
23632
|
-
app.addDatasource.static({
|
|
23633
|
-
|
|
23634
|
-
|
|
23635
|
-
|
|
23636
|
-
|
|
23637
|
-
|
|
23807
|
+
app.addDatasource.static({
|
|
23808
|
+
datasourceId: 'accessibility-features',
|
|
23809
|
+
data: [
|
|
23810
|
+
{ feature: 'high-contrast', name: 'High Contrast Mode' },
|
|
23811
|
+
{ feature: 'large-text', name: 'Large Text' },
|
|
23812
|
+
{ feature: 'screen-reader', name: 'Screen Reader Support' },
|
|
23813
|
+
{ feature: 'reduced-motion', name: 'Reduced Motion' },
|
|
23814
|
+
],
|
|
23815
|
+
})
|
|
23638
23816
|
const accessibilityChoice = configForm.addControl.choiceField({
|
|
23639
23817
|
instanceId: 'accessibility',
|
|
23640
23818
|
isMultiple: true,
|
|
@@ -24563,11 +24741,14 @@
|
|
|
24563
24741
|
.subtitle('=@ctx.current.item.description')
|
|
24564
24742
|
// 2. Dropdown with icon elements
|
|
24565
24743
|
const priorityForm = screen.addControl.form({ instanceId: 'priority-form' })
|
|
24566
|
-
app.addDatasource.static({
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24744
|
+
app.addDatasource.static({
|
|
24745
|
+
datasourceId: 'task-priorities',
|
|
24746
|
+
data: [
|
|
24747
|
+
{ id: 'low', name: 'Low Priority', icon: 'arrow-down', color: 'green' },
|
|
24748
|
+
{ id: 'medium', name: 'Medium Priority', icon: 'minus', color: 'yellow' },
|
|
24749
|
+
{ id: 'high', name: 'High Priority', icon: 'arrow-up', color: 'red' },
|
|
24750
|
+
],
|
|
24751
|
+
})
|
|
24571
24752
|
const priorityDropdown = priorityForm.addControl.dropdown({
|
|
24572
24753
|
instanceId: 'priority-dropdown',
|
|
24573
24754
|
label: 'Task Priority',
|
|
@@ -24873,12 +25054,15 @@
|
|
|
24873
25054
|
// Icon with color coding for skill category
|
|
24874
25055
|
.leftElement.icon('=@ctx.current.item.categoryIcon')
|
|
24875
25056
|
// 3. Project priority with static datasource and time estimates
|
|
24876
|
-
app.addDatasource.static({
|
|
24877
|
-
|
|
24878
|
-
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
25057
|
+
app.addDatasource.static({
|
|
25058
|
+
datasourceId: 'project-priorities',
|
|
25059
|
+
data: [
|
|
25060
|
+
{ id: 'urgent', display: 'Urgent', sla: '2 hours', color: 'negative', impact: 'critical' },
|
|
25061
|
+
{ id: 'high', display: 'High Priority', sla: '1 day', color: 'warning', impact: 'major' },
|
|
25062
|
+
{ id: 'normal', display: 'Normal', sla: '3 days', color: 'primary', impact: 'moderate' },
|
|
25063
|
+
{ id: 'low', display: 'Low Priority', sla: '1 week', color: 'neutral', impact: 'minor' },
|
|
25064
|
+
],
|
|
25065
|
+
})
|
|
24882
25066
|
const priorityDropdown = form.addControl.dropdown({
|
|
24883
25067
|
instanceId: 'priority',
|
|
24884
25068
|
isRequired: true,
|
|
@@ -24962,11 +25146,14 @@
|
|
|
24962
25146
|
screenId: 'dropdown-test',
|
|
24963
25147
|
title: 'Dropdown Test',
|
|
24964
25148
|
})
|
|
24965
|
-
app.addDatasource.static({
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
25149
|
+
app.addDatasource.static({
|
|
25150
|
+
datasourceId: 'test-options',
|
|
25151
|
+
data: [
|
|
25152
|
+
{ title: 'Option 1', value: 'option1' },
|
|
25153
|
+
{ title: 'Option 2', value: 'option2' },
|
|
25154
|
+
{ title: 'Option 3', value: 'option3' },
|
|
25155
|
+
],
|
|
25156
|
+
})
|
|
24970
25157
|
const dropdown = form.addControl.dropdown({
|
|
24971
25158
|
instanceId: 'test-dropdown',
|
|
24972
25159
|
isMultiple: true,
|
|
@@ -25030,10 +25217,13 @@
|
|
|
25030
25217
|
screenId: 'inline-test',
|
|
25031
25218
|
title: 'Inline Test',
|
|
25032
25219
|
})
|
|
25033
|
-
app.addDatasource.static({
|
|
25034
|
-
|
|
25035
|
-
|
|
25036
|
-
|
|
25220
|
+
app.addDatasource.static({
|
|
25221
|
+
datasourceId: 'inline-options',
|
|
25222
|
+
data: [
|
|
25223
|
+
{ id: 1, name: 'Option 1', active: true },
|
|
25224
|
+
{ id: 2, name: 'Option 2', active: false },
|
|
25225
|
+
],
|
|
25226
|
+
})
|
|
25037
25227
|
const inlineDropdown = form.addControl.dropdown({
|
|
25038
25228
|
instanceId: 'inline',
|
|
25039
25229
|
when: '=@ctx.solution.state.canSelect',
|
|
@@ -25643,7 +25833,11 @@
|
|
|
25643
25833
|
const statusSection = screen.addControl.section({ instanceId: 'system-status' })
|
|
25644
25834
|
const statusEntity = statusSection.addControl.entity({ instanceId: 'status-entity' })
|
|
25645
25835
|
statusEntity.addControl
|
|
25646
|
-
.entityField({
|
|
25836
|
+
.entityField({
|
|
25837
|
+
instanceId: 'server-status',
|
|
25838
|
+
label: 'Server Status',
|
|
25839
|
+
value: '=@ctx.jig.inputs.status',
|
|
25840
|
+
})
|
|
25647
25841
|
.with({
|
|
25648
25842
|
style: {
|
|
25649
25843
|
isPositive: '=@ctx.jig.inputs.status = "Online"',
|
|
@@ -25755,7 +25949,10 @@
|
|
|
25755
25949
|
label: 'Total Revenue',
|
|
25756
25950
|
value: '="$" & $string(@ctx.jig.inputs.totalRevenue)',
|
|
25757
25951
|
})
|
|
25758
|
-
.with({
|
|
25952
|
+
.with({
|
|
25953
|
+
style: { isPrimary: true, isPositive: '=@ctx.jig.inputs.revenueGrowth > 0' },
|
|
25954
|
+
rightIcon: 'arrow-up',
|
|
25955
|
+
})
|
|
25759
25956
|
financialEntity.addControl.entityField({
|
|
25760
25957
|
instanceId: 'profit-margin',
|
|
25761
25958
|
label: 'Profit Margin',
|
|
@@ -25908,7 +26105,11 @@
|
|
|
25908
26105
|
rightIcon: 'hash',
|
|
25909
26106
|
})
|
|
25910
26107
|
productEntity.addControl
|
|
25911
|
-
.entityField({
|
|
26108
|
+
.entityField({
|
|
26109
|
+
instanceId: 'price',
|
|
26110
|
+
label: 'Price',
|
|
26111
|
+
value: '="$" & @ctx.entity.product.price',
|
|
26112
|
+
})
|
|
25912
26113
|
.with({ style: { isPositive: '=@ctx.entity.product.onSale' }, rightIcon: 'money-atm' })
|
|
25913
26114
|
productEntity.addControl.entityField({
|
|
25914
26115
|
instanceId: 'availability',
|
|
@@ -26038,7 +26239,8 @@
|
|
|
26038
26239
|
value: '=@ctx.entity.device.batteryLevel & "%"',
|
|
26039
26240
|
style: {
|
|
26040
26241
|
isPositive: '=@ctx.entity.device.batteryLevel > 50',
|
|
26041
|
-
isWarning:
|
|
26242
|
+
isWarning:
|
|
26243
|
+
'=@ctx.entity.device.batteryLevel > 20 and @ctx.entity.device.batteryLevel <= 50',
|
|
26042
26244
|
isNegative: '=@ctx.entity.device.batteryLevel <= 20',
|
|
26043
26245
|
},
|
|
26044
26246
|
rightIcon: 'battery-full',
|
|
@@ -26119,7 +26321,8 @@
|
|
|
26119
26321
|
value: '=@ctx.entity.customer.healthScore & "/100"',
|
|
26120
26322
|
style: {
|
|
26121
26323
|
isPositive: '=@ctx.entity.customer.healthScore >= 80',
|
|
26122
|
-
isWarning:
|
|
26324
|
+
isWarning:
|
|
26325
|
+
'=@ctx.entity.customer.healthScore >= 60 and @ctx.entity.customer.healthScore < 80',
|
|
26123
26326
|
isNegative: '=@ctx.entity.customer.healthScore < 60',
|
|
26124
26327
|
},
|
|
26125
26328
|
rightIcon: 'gift-heart',
|
|
@@ -26890,12 +27093,10 @@
|
|
|
26890
27093
|
value: '=@ctx.jig.state.price',
|
|
26891
27094
|
format: { numberStyle: 'currency', currency: 'USD' },
|
|
26892
27095
|
})
|
|
26893
|
-
app.addDatasource.static({
|
|
26894
|
-
|
|
26895
|
-
{ name: 'Clothing' },
|
|
26896
|
-
|
|
26897
|
-
{ name: 'Home' },
|
|
26898
|
-
] })
|
|
27096
|
+
app.addDatasource.static({
|
|
27097
|
+
datasourceId: 'product-categories',
|
|
27098
|
+
data: [{ name: 'Electronics' }, { name: 'Clothing' }, { name: 'Books' }, { name: 'Home' }],
|
|
27099
|
+
})
|
|
26899
27100
|
productRow.addControl
|
|
26900
27101
|
.dropdown({
|
|
26901
27102
|
instanceId: 'category',
|
|
@@ -27084,11 +27285,14 @@
|
|
|
27084
27285
|
const settingsForm = screen.addControl.form({ instanceId: 'app-settings' })
|
|
27085
27286
|
const appearanceSection = settingsForm.addControl.section({ instanceId: 'appearance' })
|
|
27086
27287
|
appearanceSection.title('Appearance')
|
|
27087
|
-
app.addDatasource.static({
|
|
27088
|
-
|
|
27089
|
-
|
|
27090
|
-
|
|
27091
|
-
|
|
27288
|
+
app.addDatasource.static({
|
|
27289
|
+
datasourceId: 'themes',
|
|
27290
|
+
data: [
|
|
27291
|
+
{ label: 'Light', value: 'light' },
|
|
27292
|
+
{ label: 'Dark', value: 'dark' },
|
|
27293
|
+
{ label: 'Auto', value: 'auto' },
|
|
27294
|
+
],
|
|
27295
|
+
})
|
|
27092
27296
|
const themeDropdown = appearanceSection.addControl.dropdown({
|
|
27093
27297
|
instanceId: 'theme',
|
|
27094
27298
|
label: 'Theme',
|
|
@@ -27147,12 +27351,15 @@
|
|
|
27147
27351
|
errorText: 'Please enter a valid email address',
|
|
27148
27352
|
})
|
|
27149
27353
|
// Dropdown with validation
|
|
27150
|
-
app.addDatasource.static({
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
27154
|
-
|
|
27155
|
-
|
|
27354
|
+
app.addDatasource.static({
|
|
27355
|
+
datasourceId: 'priorities',
|
|
27356
|
+
data: [
|
|
27357
|
+
{ label: 'Low', value: 'low' },
|
|
27358
|
+
{ label: 'Normal', value: 'normal' },
|
|
27359
|
+
{ label: 'High', value: 'high' },
|
|
27360
|
+
{ label: 'Urgent', value: 'urgent' },
|
|
27361
|
+
],
|
|
27362
|
+
})
|
|
27156
27363
|
const priorityDropdown = contactForm.addControl.dropdown({
|
|
27157
27364
|
instanceId: 'priority',
|
|
27158
27365
|
isRequired: true,
|
|
@@ -27193,11 +27400,14 @@
|
|
|
27193
27400
|
isDiscardChangesAlertEnabled: false,
|
|
27194
27401
|
})
|
|
27195
27402
|
// Account type selector affects other fields
|
|
27196
|
-
app.addDatasource.static({
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
27403
|
+
app.addDatasource.static({
|
|
27404
|
+
datasourceId: 'account-types',
|
|
27405
|
+
data: [
|
|
27406
|
+
{ label: 'Personal', value: 'personal' },
|
|
27407
|
+
{ label: 'Business', value: 'business' },
|
|
27408
|
+
{ label: 'Enterprise', value: 'enterprise' },
|
|
27409
|
+
],
|
|
27410
|
+
})
|
|
27201
27411
|
const accountTypeDropdown = dynamicForm.addControl.dropdown({
|
|
27202
27412
|
instanceId: 'account-type',
|
|
27203
27413
|
isRequired: true,
|
|
@@ -27554,7 +27764,10 @@
|
|
|
27554
27764
|
.interactiveImageItem({
|
|
27555
27765
|
instanceId: 'room-marker',
|
|
27556
27766
|
title: '=@ctx.current.item.roomName',
|
|
27557
|
-
percentageCoordinates: {
|
|
27767
|
+
percentageCoordinates: {
|
|
27768
|
+
x: '=@ctx.current.item.xPercent',
|
|
27769
|
+
y: '=@ctx.current.item.yPercent',
|
|
27770
|
+
},
|
|
27558
27771
|
})
|
|
27559
27772
|
.with({ color: '=@ctx.current.item.statusColor' })
|
|
27560
27773
|
roomItem.onPress.goto({
|
|
@@ -27650,7 +27863,10 @@
|
|
|
27650
27863
|
.interactiveImageItem({
|
|
27651
27864
|
instanceId: 'store-marker',
|
|
27652
27865
|
groupId: '=@ctx.current.item.category',
|
|
27653
|
-
percentageCoordinates: {
|
|
27866
|
+
percentageCoordinates: {
|
|
27867
|
+
x: '=@ctx.current.item.locationX',
|
|
27868
|
+
y: '=@ctx.current.item.locationY',
|
|
27869
|
+
},
|
|
27654
27870
|
})
|
|
27655
27871
|
.with({ title: '=@ctx.current.item.storeName' })
|
|
27656
27872
|
storeItem.onPress.goto({
|
|
@@ -27687,7 +27903,9 @@
|
|
|
27687
27903
|
title: '=@ctx.current.item.departmentName',
|
|
27688
27904
|
groupId: '=@ctx.current.item.zone',
|
|
27689
27905
|
})
|
|
27690
|
-
.with({
|
|
27906
|
+
.with({
|
|
27907
|
+
percentageCoordinates: { x: '=@ctx.current.item.coordX', y: '=@ctx.current.item.coordY' },
|
|
27908
|
+
})
|
|
27691
27909
|
departmentItem.onPress
|
|
27692
27910
|
.executeEntity({ instanceId: 'show-department-info' })
|
|
27693
27911
|
.dynamicData('default/departments', 'update')
|
|
@@ -27764,7 +27982,10 @@
|
|
|
27764
27982
|
instanceId: 'sensor-marker',
|
|
27765
27983
|
title: '=@ctx.current.item.sensorId',
|
|
27766
27984
|
groupId: '=@ctx.current.item.sensorType',
|
|
27767
|
-
percentageCoordinates: {
|
|
27985
|
+
percentageCoordinates: {
|
|
27986
|
+
x: '=@ctx.current.item.positionX',
|
|
27987
|
+
y: '=@ctx.current.item.positionY',
|
|
27988
|
+
},
|
|
27768
27989
|
color:
|
|
27769
27990
|
"=@ctx.current.item.alertLevel = 'critical' ? 'negative' : (@ctx.current.item.alertLevel = 'warning' ? 'warning' : 'positive')",
|
|
27770
27991
|
})
|
|
@@ -27863,10 +28084,12 @@
|
|
|
27863
28084
|
})
|
|
27864
28085
|
const locationHeader = locationScreen.header()
|
|
27865
28086
|
locationHeader.with({ height: 'small' })
|
|
27866
|
-
locationHeader.addControl.location({ instanceId: 'header-map' }).with({
|
|
27867
|
-
|
|
27868
|
-
|
|
27869
|
-
|
|
28087
|
+
locationHeader.addControl.location({ instanceId: 'header-map' }).with({
|
|
28088
|
+
viewPoint: {
|
|
28089
|
+
latitude: 40.7128,
|
|
28090
|
+
longitude: -74.006,
|
|
28091
|
+
},
|
|
28092
|
+
})
|
|
27870
28093
|
locationHeader.actions.goBack({ title: 'Back' })
|
|
27871
28094
|
locationHeader.actions.openUrl({
|
|
27872
28095
|
title: 'Directions',
|
|
@@ -27879,12 +28102,10 @@
|
|
|
27879
28102
|
})
|
|
27880
28103
|
const videoHeader = videoScreen.header()
|
|
27881
28104
|
videoHeader.with({ height: 'medium' })
|
|
27882
|
-
videoHeader.addControl
|
|
27883
|
-
|
|
27884
|
-
.
|
|
27885
|
-
|
|
27886
|
-
title: '=@ctx.solution.state.media.videoTitle',
|
|
27887
|
-
})
|
|
28105
|
+
videoHeader.addControl.videoPlayer({ instanceId: 'header-video' }).with({
|
|
28106
|
+
url: '=@ctx.solution.state.media.headerVideoUrl',
|
|
28107
|
+
title: '=@ctx.solution.state.media.videoTitle',
|
|
28108
|
+
})
|
|
27888
28109
|
videoHeader.actions.goto({ title: 'Full Video', linkTo: 'video-screen' })
|
|
27889
28110
|
// 4. Action screen with multiple actions
|
|
27890
28111
|
const actionScreen = app.addScreen.default({
|
|
@@ -27927,10 +28148,12 @@
|
|
|
27927
28148
|
})
|
|
27928
28149
|
const venueHeader = venueScreen.header()
|
|
27929
28150
|
venueHeader.with({ height: 'medium' })
|
|
27930
|
-
venueHeader.addControl.location({ instanceId: 'venue-location' }).with({
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
28151
|
+
venueHeader.addControl.location({ instanceId: 'venue-location' }).with({
|
|
28152
|
+
viewPoint: {
|
|
28153
|
+
latitude: '=@ctx.solution.state.venue.coordinates.latitude',
|
|
28154
|
+
longitude: '=@ctx.solution.state.venue.coordinates.longitude',
|
|
28155
|
+
},
|
|
28156
|
+
})
|
|
27934
28157
|
venueHeader.actions.goBack({ title: 'Back to List' })
|
|
27935
28158
|
venueHeader.actions.openUrl({
|
|
27936
28159
|
title: 'Get Directions',
|
|
@@ -27944,12 +28167,10 @@
|
|
|
27944
28167
|
})
|
|
27945
28168
|
const galleryHeader = galleryScreen.header()
|
|
27946
28169
|
galleryHeader.with({ height: 'medium' })
|
|
27947
|
-
galleryHeader.addControl
|
|
27948
|
-
|
|
27949
|
-
.
|
|
27950
|
-
|
|
27951
|
-
title: '=@ctx.solution.state.gallery.videoTitle',
|
|
27952
|
-
})
|
|
28170
|
+
galleryHeader.addControl.videoPlayer({ instanceId: 'gallery-preview' }).with({
|
|
28171
|
+
url: '=@ctx.solution.state.gallery.featuredVideoUrl',
|
|
28172
|
+
title: '=@ctx.solution.state.gallery.videoTitle',
|
|
28173
|
+
})
|
|
27953
28174
|
galleryHeader.actions.goBack({ title: 'Back to Gallery' })
|
|
27954
28175
|
galleryHeader.actions.goto({ title: 'Full Screen', linkTo: 'fullscreen-video' })
|
|
27955
28176
|
// Dashboard header with branding
|
|
@@ -28019,10 +28240,12 @@
|
|
|
28019
28240
|
})
|
|
28020
28241
|
const mapHeader = mapScreen.header()
|
|
28021
28242
|
mapHeader.with({ height: 'medium' })
|
|
28022
|
-
mapHeader.addControl.location({ instanceId: 'main-location' }).with({
|
|
28023
|
-
|
|
28024
|
-
|
|
28025
|
-
|
|
28243
|
+
mapHeader.addControl.location({ instanceId: 'main-location' }).with({
|
|
28244
|
+
viewPoint: {
|
|
28245
|
+
latitude: '=@ctx.solution.state.userLocation.latitude',
|
|
28246
|
+
longitude: '=@ctx.solution.state.userLocation.longitude',
|
|
28247
|
+
},
|
|
28248
|
+
})
|
|
28026
28249
|
mapHeader.actions.goBack({ title: 'Back' })
|
|
28027
28250
|
mapHeader.actions.goto({ title: 'Nearby', linkTo: 'nearby-screen' })
|
|
28028
28251
|
// Media header for entertainment apps
|
|
@@ -28032,12 +28255,10 @@
|
|
|
28032
28255
|
})
|
|
28033
28256
|
const mediaHeader = mediaScreen.header()
|
|
28034
28257
|
mediaHeader.with({ height: 'medium' })
|
|
28035
|
-
mediaHeader.addControl
|
|
28036
|
-
|
|
28037
|
-
.
|
|
28038
|
-
|
|
28039
|
-
title: '=@ctx.solution.state.media.videoTitle',
|
|
28040
|
-
})
|
|
28258
|
+
mediaHeader.addControl.videoPlayer({ instanceId: 'featured-content' }).with({
|
|
28259
|
+
url: '=@ctx.solution.state.media.featuredVideoUrl',
|
|
28260
|
+
title: '=@ctx.solution.state.media.videoTitle',
|
|
28261
|
+
})
|
|
28041
28262
|
mediaHeader.actions.goBack({ title: 'Back to Library' })
|
|
28042
28263
|
mediaHeader.actions.goto({ title: 'Related Content', linkTo: 'related-screen' })
|
|
28043
28264
|
// Minimal header for form screens
|
|
@@ -29051,7 +29272,8 @@
|
|
|
29051
29272
|
})
|
|
29052
29273
|
vehicleMarker.addIcon({
|
|
29053
29274
|
icon: "=@ctx.current.item.vehicleType = 'truck' ? 'truck' : 'car'",
|
|
29054
|
-
color:
|
|
29275
|
+
color:
|
|
29276
|
+
"=@ctx.current.item.status = 'active' ? 'positive' : (@ctx.current.item.status = 'maintenance' ? 'warning' : 'negative')",
|
|
29055
29277
|
})
|
|
29056
29278
|
// Field service territories
|
|
29057
29279
|
const serviceSection = screen.addControl.section({ instanceId: 'service-territories' })
|
|
@@ -29075,7 +29297,8 @@
|
|
|
29075
29297
|
})
|
|
29076
29298
|
appointmentMarker.addIcon({
|
|
29077
29299
|
icon: "=@ctx.current.item.priority = 'urgent' ? 'alert' : 'wrench'",
|
|
29078
|
-
color:
|
|
29300
|
+
color:
|
|
29301
|
+
"=@ctx.current.item.status = 'scheduled' ? 'color1' : (@ctx.current.item.status = 'in-progress' ? 'warning' : 'positive')",
|
|
29079
29302
|
})
|
|
29080
29303
|
// Emergency response system
|
|
29081
29304
|
const emergencySection = screen.addControl.section({ instanceId: 'emergency-response' })
|
|
@@ -29101,7 +29324,8 @@
|
|
|
29101
29324
|
})
|
|
29102
29325
|
incidentMarker.addIcon({
|
|
29103
29326
|
icon: "=@ctx.current.item.severity = 'critical' ? 'alert-triangle' : 'information-circle'",
|
|
29104
|
-
color:
|
|
29327
|
+
color:
|
|
29328
|
+
"=@ctx.current.item.severity = 'critical' ? 'negative' : (@ctx.current.item.severity = 'high' ? 'warning' : 'positive')",
|
|
29105
29329
|
})
|
|
29106
29330
|
// Asset tracking with geofencing
|
|
29107
29331
|
const assetSection = screen.addControl.section({ instanceId: 'asset-tracking' })
|
|
@@ -29160,18 +29384,16 @@
|
|
|
29160
29384
|
.dynamicData('default/selected_locations', 'update')
|
|
29161
29385
|
// Location-aware content
|
|
29162
29386
|
const contentSection = screen.addControl.section({ instanceId: 'location-content' })
|
|
29163
|
-
const contextMap = contentSection.addControl
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
},
|
|
29174
|
-
})
|
|
29387
|
+
const contextMap = contentSection.addControl.location({ instanceId: 'contextual-map' }).with({
|
|
29388
|
+
markersData: '=@ctx.datasources.nearby_points_of_interest',
|
|
29389
|
+
viewPoint: {
|
|
29390
|
+
latitude: '=@ctx.solution.state.userLatitude',
|
|
29391
|
+
longitude: '=@ctx.solution.state.userLongitude',
|
|
29392
|
+
zoomLevel: '=@ctx.solution.state.preferredZoom',
|
|
29393
|
+
centerPosition: 'middle',
|
|
29394
|
+
isFollowUserLocationEnabled: '=@ctx.solution.state.trackUserMovement',
|
|
29395
|
+
},
|
|
29396
|
+
})
|
|
29175
29397
|
const poiMarker = contextMap.addControl.markerItem({
|
|
29176
29398
|
instanceId: 'poi-marker',
|
|
29177
29399
|
latitude: '=@ctx.current.item.position.lat',
|
|
@@ -29203,7 +29425,8 @@
|
|
|
29203
29425
|
})
|
|
29204
29426
|
comparisonMarker.addIcon({
|
|
29205
29427
|
icon: "=@ctx.current.item.isSelected ? 'check-circle' : 'circle'",
|
|
29206
|
-
color:
|
|
29428
|
+
color:
|
|
29429
|
+
"=@ctx.current.item.rank <= 3 ? 'positive' : (@ctx.current.item.rank <= 6 ? 'warning' : 'color2')",
|
|
29207
29430
|
})
|
|
29208
29431
|
// Dynamic location clustering
|
|
29209
29432
|
const clusterSection = screen.addControl.section({ instanceId: 'location-clusters' })
|
|
@@ -29230,7 +29453,8 @@
|
|
|
29230
29453
|
})
|
|
29231
29454
|
clusterMarker.addIcon({
|
|
29232
29455
|
icon: "=@ctx.current.item.count > 10 ? 'layers' : 'pin-map'",
|
|
29233
|
-
color:
|
|
29456
|
+
color:
|
|
29457
|
+
"=@ctx.current.item.density = 'high' ? 'negative' : (@ctx.current.item.density = 'medium' ? 'warning' : 'positive')",
|
|
29234
29458
|
})
|
|
29235
29459
|
- id: component.component.marker-item-1
|
|
29236
29460
|
name: Map Marker Component
|
|
@@ -29270,7 +29494,9 @@
|
|
|
29270
29494
|
latitude: '=@ctx.current.item.latitude',
|
|
29271
29495
|
longitude: '=@ctx.current.item.longitude',
|
|
29272
29496
|
})
|
|
29273
|
-
.with({
|
|
29497
|
+
.with({
|
|
29498
|
+
radius: { value: '=@ctx.current.item.serviceRadius', unit: 'miles', color: 'positive' },
|
|
29499
|
+
})
|
|
29274
29500
|
customerMarker.addIcon({ icon: '=@ctx.current.item.markerIcon' })
|
|
29275
29501
|
- id: component.component.marker-item-2
|
|
29276
29502
|
name: Advanced Marker Configurations
|
|
@@ -29306,7 +29532,14 @@
|
|
|
29306
29532
|
latitude: '=@ctx.current.item.centerLat',
|
|
29307
29533
|
longitude: '=@ctx.current.item.centerLng',
|
|
29308
29534
|
})
|
|
29309
|
-
.with({
|
|
29535
|
+
.with({
|
|
29536
|
+
radius: {
|
|
29537
|
+
value: '=@ctx.current.item.coverageRadius',
|
|
29538
|
+
unit: 'meters',
|
|
29539
|
+
color: '=(@ctx.current.item.isActive) ? "positive" : "neutral"',
|
|
29540
|
+
isEnabled: '=@ctx.current.item.showCoverage',
|
|
29541
|
+
},
|
|
29542
|
+
})
|
|
29310
29543
|
dynamicZone.addIcon({ icon: '=@ctx.current.item.zoneType' })
|
|
29311
29544
|
- id: component.component.marker-item-3
|
|
29312
29545
|
name: Marker Builder Patterns
|
|
@@ -31154,11 +31387,13 @@
|
|
|
31154
31387
|
.with({
|
|
31155
31388
|
left: {
|
|
31156
31389
|
title: 'Last Month',
|
|
31157
|
-
subtitle:
|
|
31390
|
+
subtitle:
|
|
31391
|
+
'=@ctx.current.item.metrics.previousMonth.value & @ctx.current.item.metrics.unit',
|
|
31158
31392
|
},
|
|
31159
31393
|
right: {
|
|
31160
31394
|
title: 'This Month',
|
|
31161
|
-
subtitle:
|
|
31395
|
+
subtitle:
|
|
31396
|
+
'=@ctx.current.item.metrics.currentMonth.value & @ctx.current.item.metrics.unit',
|
|
31162
31397
|
},
|
|
31163
31398
|
})
|
|
31164
31399
|
performanceStage.onPress.goto({
|
|
@@ -33710,6 +33945,29 @@
|
|
|
33710
33945
|
size: 'small',
|
|
33711
33946
|
uri: 'https://example.com/user.png',
|
|
33712
33947
|
})
|
|
33948
|
+
- id: jc.banner-example
|
|
33949
|
+
name: Warning Banner with Icon and Action
|
|
33950
|
+
category: component
|
|
33951
|
+
tags:
|
|
33952
|
+
- component
|
|
33953
|
+
- banner
|
|
33954
|
+
- alert
|
|
33955
|
+
- warning
|
|
33956
|
+
- icon
|
|
33957
|
+
- action
|
|
33958
|
+
description: Show a warning banner with a left icon and a retry button on a default screen
|
|
33959
|
+
code: |-
|
|
33960
|
+
const syncBanner = screen.addControl.banner({
|
|
33961
|
+
instanceId: 'sync-banner',
|
|
33962
|
+
title: { text: 'Sync failed', isBold: true },
|
|
33963
|
+
subtitle: 'Some records were not uploaded',
|
|
33964
|
+
icon: 'hazard-warning-flasher',
|
|
33965
|
+
iconColor: 'warning',
|
|
33966
|
+
iconType: 'contained',
|
|
33967
|
+
iconShape: 'circle',
|
|
33968
|
+
isWarning: true,
|
|
33969
|
+
})
|
|
33970
|
+
syncBanner.addAction.executeAction({ title: 'Retry', action: 'retry-sync' })
|
|
33713
33971
|
- id: jc.bar-chart-example-1
|
|
33714
33972
|
name: Bar Chart with Quarterly Sales Data
|
|
33715
33973
|
category: component
|
|
@@ -33869,6 +34127,23 @@
|
|
|
33869
34127
|
const buyForm = productCard.addControl.form({ instanceId: 'buy-form' }) // Use form instead of button
|
|
33870
34128
|
buyForm.addControl.textField({ instanceId: 'quantity' }).label('Quantity')
|
|
33871
34129
|
- id: jc.card-example-3
|
|
34130
|
+
name: Card Component with a Section
|
|
34131
|
+
category: component
|
|
34132
|
+
tags:
|
|
34133
|
+
- component
|
|
34134
|
+
- card
|
|
34135
|
+
- section
|
|
34136
|
+
- container
|
|
34137
|
+
- grouping
|
|
34138
|
+
description: Group card content under a titled section
|
|
34139
|
+
code: |-
|
|
34140
|
+
const detailsCard = screen.addControl.card({ instanceId: 'details-card' })
|
|
34141
|
+
const contactSection = detailsCard.addControl.section({
|
|
34142
|
+
instanceId: 'contact',
|
|
34143
|
+
title: 'Contact',
|
|
34144
|
+
})
|
|
34145
|
+
contactSection.addControl.emailField({ instanceId: 'email', label: 'Email' })
|
|
34146
|
+
- id: jc.card-example-4
|
|
33872
34147
|
name: Styled Card Component with Gap and Color
|
|
33873
34148
|
category: component
|
|
33874
34149
|
tags:
|
|
@@ -34033,10 +34308,13 @@
|
|
|
34033
34308
|
description: Create choice field item referencing a static datasource with
|
|
34034
34309
|
dynamic title expressions
|
|
34035
34310
|
code: |-
|
|
34036
|
-
app.addDatasource.static({
|
|
34037
|
-
|
|
34038
|
-
|
|
34039
|
-
|
|
34311
|
+
app.addDatasource.static({
|
|
34312
|
+
datasourceId: 'inline-options',
|
|
34313
|
+
data: [
|
|
34314
|
+
{ id: 'x', label: 'X' },
|
|
34315
|
+
{ id: 'y', label: 'Y' },
|
|
34316
|
+
],
|
|
34317
|
+
})
|
|
34040
34318
|
const choices = screen.addControl.choiceField({
|
|
34041
34319
|
instanceId: 'inline-choices',
|
|
34042
34320
|
data: '=@ctx.datasources.inline-options',
|
|
@@ -34117,10 +34395,13 @@
|
|
|
34117
34395
|
- options
|
|
34118
34396
|
description: Create choice field referencing a static datasource
|
|
34119
34397
|
code: |-
|
|
34120
|
-
app.addDatasource.static({
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34398
|
+
app.addDatasource.static({
|
|
34399
|
+
datasourceId: 'choice-options',
|
|
34400
|
+
data: [
|
|
34401
|
+
{ id: 'a', label: 'A' },
|
|
34402
|
+
{ id: 'b', label: 'B' },
|
|
34403
|
+
],
|
|
34404
|
+
})
|
|
34124
34405
|
const choices = screen.addControl.choiceField({
|
|
34125
34406
|
instanceId: 'inline-choices',
|
|
34126
34407
|
label: 'Inline',
|
|
@@ -34608,11 +34889,14 @@
|
|
|
34608
34889
|
- required
|
|
34609
34890
|
description: Create required country dropdown referencing a static datasource
|
|
34610
34891
|
code: |-
|
|
34611
|
-
app.addDatasource.static({
|
|
34612
|
-
|
|
34613
|
-
|
|
34614
|
-
|
|
34615
|
-
|
|
34892
|
+
app.addDatasource.static({
|
|
34893
|
+
datasourceId: 'countries',
|
|
34894
|
+
data: [
|
|
34895
|
+
{ countryCode: 'US', countryName: 'United States' },
|
|
34896
|
+
{ countryCode: 'CA', countryName: 'Canada' },
|
|
34897
|
+
{ countryCode: 'MX', countryName: 'Mexico' },
|
|
34898
|
+
],
|
|
34899
|
+
})
|
|
34616
34900
|
const dropdown = screen.addControl.dropdown({
|
|
34617
34901
|
instanceId: 'country-select',
|
|
34618
34902
|
isRequired: true,
|
|
@@ -34794,7 +35078,11 @@
|
|
|
34794
35078
|
user profile display
|
|
34795
35079
|
code: |-
|
|
34796
35080
|
const userEntity = screen.addControl.entity()
|
|
34797
|
-
userEntity.addControl.entityField({
|
|
35081
|
+
userEntity.addControl.entityField({
|
|
35082
|
+
instanceId: 'name-field',
|
|
35083
|
+
label: 'Name',
|
|
35084
|
+
value: 'John Doe',
|
|
35085
|
+
})
|
|
34798
35086
|
userEntity.addControl
|
|
34799
35087
|
.entityField({ instanceId: 'email-field', label: 'Email' })
|
|
34800
35088
|
.with({ value: 'john@example.com' })
|
|
@@ -34816,11 +35104,19 @@
|
|
|
34816
35104
|
instanceId: 'product-entity',
|
|
34817
35105
|
isCompact: true,
|
|
34818
35106
|
})
|
|
34819
|
-
productEntity.addControl.entityField({
|
|
35107
|
+
productEntity.addControl.entityField({
|
|
35108
|
+
instanceId: 'product-name',
|
|
35109
|
+
label: 'Product Name',
|
|
35110
|
+
value: 'Laptop',
|
|
35111
|
+
})
|
|
34820
35112
|
productEntity.addControl
|
|
34821
35113
|
.entityField({ instanceId: 'product-price', label: 'Price' })
|
|
34822
35114
|
.with({ value: '$999.99' })
|
|
34823
|
-
productEntity.addControl.entityField({
|
|
35115
|
+
productEntity.addControl.entityField({
|
|
35116
|
+
instanceId: 'product-stock',
|
|
35117
|
+
label: 'In Stock',
|
|
35118
|
+
value: 'Yes',
|
|
35119
|
+
})
|
|
34824
35120
|
- id: jc.event-example-1
|
|
34825
35121
|
name: Team Meeting Event with Full Details
|
|
34826
35122
|
category: component
|
|
@@ -35468,6 +35764,42 @@
|
|
|
35468
35764
|
source: { uri: 'file://assets/logo.png' },
|
|
35469
35765
|
height: 100,
|
|
35470
35766
|
})
|
|
35767
|
+
- id: jc.image-example-3
|
|
35768
|
+
name: Image Inside a View with Fixed Size
|
|
35769
|
+
category: component
|
|
35770
|
+
tags:
|
|
35771
|
+
- component
|
|
35772
|
+
- image
|
|
35773
|
+
- view
|
|
35774
|
+
- size
|
|
35775
|
+
description: Inside a view an image is sized through one size option instead of
|
|
35776
|
+
height and width
|
|
35777
|
+
code: |-
|
|
35778
|
+
const view = component.addControl.view({})
|
|
35779
|
+
const image = view.addControl.image({
|
|
35780
|
+
source: { uri: 'https://example.com/hero.jpg' },
|
|
35781
|
+
resizeMode: 'cover',
|
|
35782
|
+
size: { height: 100, width: 200 },
|
|
35783
|
+
})
|
|
35784
|
+
- id: jc.image-example-4
|
|
35785
|
+
name: Image Inside a Custom Component with Fixed Size
|
|
35786
|
+
category: component
|
|
35787
|
+
tags:
|
|
35788
|
+
- component
|
|
35789
|
+
- image
|
|
35790
|
+
- custom-component
|
|
35791
|
+
- size
|
|
35792
|
+
description: Inside a custom component definition an image is sized through one
|
|
35793
|
+
size option, fixed or flexible
|
|
35794
|
+
code: |-
|
|
35795
|
+
const fixed = component.addControl.image({
|
|
35796
|
+
source: { uri: 'https://example.com/product.jpg' },
|
|
35797
|
+
size: { height: 114 },
|
|
35798
|
+
})
|
|
35799
|
+
const flexible = component.addControl.image({
|
|
35800
|
+
source: { uri: 'https://example.com/banner.jpg' },
|
|
35801
|
+
size: 'flexible',
|
|
35802
|
+
})
|
|
35471
35803
|
- id: jc.interactive-image-example-1
|
|
35472
35804
|
name: Interactive Image with Dynamic Data Source
|
|
35473
35805
|
category: component
|
|
@@ -36085,6 +36417,20 @@
|
|
|
36085
36417
|
.listItem({ instanceId: 'enabled-item' })
|
|
36086
36418
|
.title('Enabled Item')
|
|
36087
36419
|
.isDisabled(false)
|
|
36420
|
+
- id: jc.list-item-example-7
|
|
36421
|
+
name: List Item with Dynamic Height
|
|
36422
|
+
category: component
|
|
36423
|
+
tags:
|
|
36424
|
+
- component
|
|
36425
|
+
- list-item
|
|
36426
|
+
- dynamic-height
|
|
36427
|
+
description: Create a list item whose height follows its content in a vertical list
|
|
36428
|
+
code: |-
|
|
36429
|
+
const builder = screen.addControl.listItem({
|
|
36430
|
+
instanceId: 'dynamic-item',
|
|
36431
|
+
title: 'Long description item',
|
|
36432
|
+
hasDynamicHeight: true,
|
|
36433
|
+
})
|
|
36088
36434
|
- id: jc.list-example-1
|
|
36089
36435
|
name: List Component with Inline Static Data
|
|
36090
36436
|
category: component
|
|
@@ -36274,7 +36620,10 @@
|
|
|
36274
36620
|
},
|
|
36275
36621
|
markersData: '=@ctx.datasources.locations',
|
|
36276
36622
|
})
|
|
36277
|
-
.with({
|
|
36623
|
+
.with({
|
|
36624
|
+
isShowUserLocationEnabled: '=@ctx.jig.state.map.showUser',
|
|
36625
|
+
paths: '=@ctx.datasources.routes',
|
|
36626
|
+
})
|
|
36278
36627
|
- id: jc.location-example-8
|
|
36279
36628
|
name: Location Maps with Different Radius Unit Types
|
|
36280
36629
|
category: component
|
|
@@ -37802,7 +38151,10 @@
|
|
|
37802
38151
|
sync across devices and users
|
|
37803
38152
|
code: |-
|
|
37804
38153
|
// Dynamic SQLite datasource - synced across devices for collaborative data
|
|
37805
|
-
const customerData = app.addDatasource.sqlite({
|
|
38154
|
+
const customerData = app.addDatasource.sqlite({
|
|
38155
|
+
datasourceId: 'customers',
|
|
38156
|
+
provider: 'dynamic',
|
|
38157
|
+
})
|
|
37806
38158
|
customerData.entity('default/customers')
|
|
37807
38159
|
customerData.query(`
|
|
37808
38160
|
SELECT
|
|
@@ -37834,7 +38186,10 @@
|
|
|
37834
38186
|
orderData.queryParameter('minAmount', 100)
|
|
37835
38187
|
orderData.queryParameter('maxResults', 50)
|
|
37836
38188
|
// Multiple entities with relationships
|
|
37837
|
-
const inventoryData = app.addDatasource.sqlite({
|
|
38189
|
+
const inventoryData = app.addDatasource.sqlite({
|
|
38190
|
+
datasourceId: 'inventory',
|
|
38191
|
+
provider: 'dynamic',
|
|
38192
|
+
})
|
|
37838
38193
|
inventoryData.entity('default/products')
|
|
37839
38194
|
inventoryData.entity('default/categories')
|
|
37840
38195
|
inventoryData.query(`
|
|
@@ -37850,7 +38205,10 @@
|
|
|
37850
38205
|
WHERE json_extract(p.data, '$.active') = true
|
|
37851
38206
|
`)
|
|
37852
38207
|
// Single document mode - for detail views and singleton data
|
|
37853
|
-
const customerDetail = app.addDatasource.sqlite({
|
|
38208
|
+
const customerDetail = app.addDatasource.sqlite({
|
|
38209
|
+
datasourceId: 'customer-detail',
|
|
38210
|
+
provider: 'dynamic',
|
|
38211
|
+
})
|
|
37854
38212
|
customerDetail.entity('default/customers')
|
|
37855
38213
|
customerDetail.query(`
|
|
37856
38214
|
SELECT
|
|
@@ -37866,7 +38224,10 @@
|
|
|
37866
38224
|
customerDetail.jsonProperties('data')
|
|
37867
38225
|
customerDetail.isDocument(true) // Returns single document instead of array
|
|
37868
38226
|
// Dashboard statistics - single aggregated row
|
|
37869
|
-
const dashboardStats = app.addDatasource.sqlite({
|
|
38227
|
+
const dashboardStats = app.addDatasource.sqlite({
|
|
38228
|
+
datasourceId: 'dashboard-stats',
|
|
38229
|
+
provider: 'dynamic',
|
|
38230
|
+
})
|
|
37870
38231
|
dashboardStats.entity('default/orders')
|
|
37871
38232
|
dashboardStats.query(`
|
|
37872
38233
|
SELECT
|
|
@@ -37895,7 +38256,10 @@
|
|
|
37895
38256
|
device-specific information
|
|
37896
38257
|
code: |-
|
|
37897
38258
|
// Local SQLite datasource - device-only storage for preferences and temporary data
|
|
37898
|
-
const userPrefs = app.addDatasource.sqlite({
|
|
38259
|
+
const userPrefs = app.addDatasource.sqlite({
|
|
38260
|
+
datasourceId: 'user-preferences',
|
|
38261
|
+
provider: 'local',
|
|
38262
|
+
})
|
|
37899
38263
|
userPrefs.entity('preferences')
|
|
37900
38264
|
userPrefs.query(`
|
|
37901
38265
|
SELECT
|
|
@@ -37922,7 +38286,10 @@
|
|
|
37922
38286
|
`)
|
|
37923
38287
|
localCache.queryParameter('currentTime', '=@ctx.solution.state.currentTimestamp')
|
|
37924
38288
|
// Device-specific settings and configuration
|
|
37925
|
-
const deviceSettings = app.addDatasource.sqlite({
|
|
38289
|
+
const deviceSettings = app.addDatasource.sqlite({
|
|
38290
|
+
datasourceId: 'device-settings',
|
|
38291
|
+
provider: 'local',
|
|
38292
|
+
})
|
|
37926
38293
|
deviceSettings.entity('settings')
|
|
37927
38294
|
deviceSettings.query(`
|
|
37928
38295
|
SELECT
|
|
@@ -37951,99 +38318,111 @@
|
|
|
37951
38318
|
doesn't require database storage
|
|
37952
38319
|
code: |-
|
|
37953
38320
|
// Basic static datasource for dropdown options
|
|
37954
|
-
app.addDatasource.static({
|
|
37955
|
-
|
|
37956
|
-
|
|
37957
|
-
|
|
37958
|
-
|
|
37959
|
-
|
|
37960
|
-
|
|
38321
|
+
app.addDatasource.static({
|
|
38322
|
+
datasourceId: 'order-statuses',
|
|
38323
|
+
data: [
|
|
38324
|
+
{ id: 'pending', label: 'Pending Review', color: '#FFA500' },
|
|
38325
|
+
{ id: 'approved', label: 'Approved', color: '#28A745' },
|
|
38326
|
+
{ id: 'rejected', label: 'Rejected', color: '#DC3545' },
|
|
38327
|
+
{ id: 'processing', label: 'Processing', color: '#17A2B8' },
|
|
38328
|
+
{ id: 'completed', label: 'Completed', color: '#6F42C1' },
|
|
38329
|
+
],
|
|
38330
|
+
})
|
|
37961
38331
|
// Configuration options for app settings
|
|
37962
|
-
app.addDatasource.static({
|
|
37963
|
-
|
|
37964
|
-
|
|
37965
|
-
|
|
37966
|
-
|
|
37967
|
-
|
|
37968
|
-
|
|
37969
|
-
|
|
37970
|
-
|
|
37971
|
-
|
|
37972
|
-
|
|
37973
|
-
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
37977
|
-
|
|
37978
|
-
|
|
37979
|
-
|
|
37980
|
-
|
|
37981
|
-
|
|
37982
|
-
|
|
37983
|
-
|
|
37984
|
-
|
|
38332
|
+
app.addDatasource.static({
|
|
38333
|
+
datasourceId: 'theme-options',
|
|
38334
|
+
data: [
|
|
38335
|
+
{
|
|
38336
|
+
id: 'light',
|
|
38337
|
+
name: 'Light Theme',
|
|
38338
|
+
description: 'Clean bright interface',
|
|
38339
|
+
primaryColor: '#007BFF',
|
|
38340
|
+
backgroundColor: '#FFFFFF',
|
|
38341
|
+
},
|
|
38342
|
+
{
|
|
38343
|
+
id: 'dark',
|
|
38344
|
+
name: 'Dark Theme',
|
|
38345
|
+
description: 'Easy on the eyes',
|
|
38346
|
+
primaryColor: '#BB86FC',
|
|
38347
|
+
backgroundColor: '#121212',
|
|
38348
|
+
},
|
|
38349
|
+
{
|
|
38350
|
+
id: 'auto',
|
|
38351
|
+
name: 'System Default',
|
|
38352
|
+
description: 'Follows device setting',
|
|
38353
|
+
primaryColor: '#6C757D',
|
|
38354
|
+
backgroundColor: 'auto',
|
|
38355
|
+
},
|
|
38356
|
+
],
|
|
38357
|
+
})
|
|
37985
38358
|
// Complex lookup data with nested properties
|
|
37986
|
-
app.addDatasource.static({
|
|
37987
|
-
|
|
37988
|
-
|
|
37989
|
-
|
|
37990
|
-
|
|
37991
|
-
|
|
37992
|
-
|
|
37993
|
-
{
|
|
37994
|
-
|
|
37995
|
-
|
|
37996
|
-
|
|
37997
|
-
|
|
37998
|
-
|
|
37999
|
-
|
|
38000
|
-
|
|
38001
|
-
|
|
38002
|
-
|
|
38003
|
-
|
|
38004
|
-
|
|
38005
|
-
{
|
|
38006
|
-
|
|
38007
|
-
|
|
38008
|
-
|
|
38009
|
-
|
|
38010
|
-
|
|
38011
|
-
|
|
38359
|
+
app.addDatasource.static({
|
|
38360
|
+
datasourceId: 'countries',
|
|
38361
|
+
data: [
|
|
38362
|
+
{
|
|
38363
|
+
id: 'us',
|
|
38364
|
+
name: 'United States',
|
|
38365
|
+
code: 'US',
|
|
38366
|
+
currency: { symbol: '$', code: 'USD' },
|
|
38367
|
+
regions: [
|
|
38368
|
+
{ id: 'north', name: 'North' },
|
|
38369
|
+
{ id: 'south', name: 'South' },
|
|
38370
|
+
{ id: 'east', name: 'East' },
|
|
38371
|
+
{ id: 'west', name: 'West' },
|
|
38372
|
+
],
|
|
38373
|
+
},
|
|
38374
|
+
{
|
|
38375
|
+
id: 'uk',
|
|
38376
|
+
name: 'United Kingdom',
|
|
38377
|
+
code: 'GB',
|
|
38378
|
+
currency: { symbol: '£', code: 'GBP' },
|
|
38379
|
+
regions: [
|
|
38380
|
+
{ id: 'england', name: 'England' },
|
|
38381
|
+
{ id: 'scotland', name: 'Scotland' },
|
|
38382
|
+
{ id: 'wales', name: 'Wales' },
|
|
38383
|
+
{ id: 'ni', name: 'Northern Ireland' },
|
|
38384
|
+
],
|
|
38385
|
+
},
|
|
38386
|
+
],
|
|
38387
|
+
})
|
|
38012
38388
|
// Priority levels for task management
|
|
38013
|
-
app.addDatasource.static({
|
|
38014
|
-
|
|
38015
|
-
|
|
38016
|
-
|
|
38017
|
-
|
|
38018
|
-
|
|
38019
|
-
|
|
38020
|
-
|
|
38021
|
-
|
|
38022
|
-
|
|
38023
|
-
|
|
38024
|
-
|
|
38025
|
-
|
|
38026
|
-
|
|
38027
|
-
|
|
38028
|
-
|
|
38029
|
-
|
|
38030
|
-
|
|
38031
|
-
|
|
38032
|
-
|
|
38033
|
-
|
|
38034
|
-
|
|
38035
|
-
|
|
38036
|
-
|
|
38037
|
-
|
|
38038
|
-
|
|
38039
|
-
|
|
38040
|
-
|
|
38041
|
-
|
|
38042
|
-
|
|
38043
|
-
|
|
38044
|
-
|
|
38045
|
-
|
|
38046
|
-
|
|
38389
|
+
app.addDatasource.static({
|
|
38390
|
+
datasourceId: 'priority-levels',
|
|
38391
|
+
data: [
|
|
38392
|
+
{
|
|
38393
|
+
id: 1,
|
|
38394
|
+
name: 'Low',
|
|
38395
|
+
color: '#28A745',
|
|
38396
|
+
description: 'Nice to have',
|
|
38397
|
+
urgencyScore: 1,
|
|
38398
|
+
escalationDays: 30,
|
|
38399
|
+
},
|
|
38400
|
+
{
|
|
38401
|
+
id: 2,
|
|
38402
|
+
name: 'Medium',
|
|
38403
|
+
color: '#FFC107',
|
|
38404
|
+
description: 'Should be addressed',
|
|
38405
|
+
urgencyScore: 5,
|
|
38406
|
+
escalationDays: 7,
|
|
38407
|
+
},
|
|
38408
|
+
{
|
|
38409
|
+
id: 3,
|
|
38410
|
+
name: 'High',
|
|
38411
|
+
color: '#FD7E14',
|
|
38412
|
+
description: 'Important issue',
|
|
38413
|
+
urgencyScore: 8,
|
|
38414
|
+
escalationDays: 2,
|
|
38415
|
+
},
|
|
38416
|
+
{
|
|
38417
|
+
id: 4,
|
|
38418
|
+
name: 'Critical',
|
|
38419
|
+
color: '#DC3545',
|
|
38420
|
+
description: 'Immediate attention required',
|
|
38421
|
+
urgencyScore: 10,
|
|
38422
|
+
escalationDays: 0,
|
|
38423
|
+
},
|
|
38424
|
+
],
|
|
38425
|
+
})
|
|
38047
38426
|
- id: datasource.datasource.system
|
|
38048
38427
|
name: System Datasource Configuration
|
|
38049
38428
|
category: datasource
|
|
@@ -38240,8 +38619,10 @@
|
|
|
38240
38619
|
- entity
|
|
38241
38620
|
- object-form
|
|
38242
38621
|
description: Use entity({ entity }) to emit the explicit object shape for a table
|
|
38243
|
-
code:
|
|
38244
|
-
|
|
38622
|
+
code: |-
|
|
38623
|
+
app.addDatasource
|
|
38624
|
+
.sqlite({ datasourceId: 'test-ds', provider: 'local' })
|
|
38625
|
+
.entity({ entity: 'customers' })
|
|
38245
38626
|
- id: datasource.sqlite-example-7
|
|
38246
38627
|
name: SQLite Datasource Entity with Sync Function
|
|
38247
38628
|
category: datasource
|
|
@@ -38273,8 +38654,10 @@
|
|
|
38273
38654
|
- external
|
|
38274
38655
|
description: Use entityPackaged(name, packageName) to reference a table from an
|
|
38275
38656
|
external package
|
|
38276
|
-
code:
|
|
38277
|
-
|
|
38657
|
+
code: |-
|
|
38658
|
+
app.addDatasource
|
|
38659
|
+
.sqlite({ datasourceId: 'test-ds', provider: 'local' })
|
|
38660
|
+
.entityPackaged('users', 'erp')
|
|
38278
38661
|
- id: datasource.static-example-1
|
|
38279
38662
|
name: Static Datasource with Color Objects
|
|
38280
38663
|
category: datasource
|
|
@@ -38326,10 +38709,13 @@
|
|
|
38326
38709
|
- properties
|
|
38327
38710
|
description: Store color data with name and hex value properties
|
|
38328
38711
|
code: |-
|
|
38329
|
-
app.addDatasource.static({
|
|
38330
|
-
|
|
38331
|
-
|
|
38332
|
-
|
|
38712
|
+
app.addDatasource.static({
|
|
38713
|
+
datasourceId: 'colors',
|
|
38714
|
+
data: [
|
|
38715
|
+
{ name: 'Red', value: '#FF0000' },
|
|
38716
|
+
{ name: 'Green', value: '#00FF00' },
|
|
38717
|
+
],
|
|
38718
|
+
})
|
|
38333
38719
|
- id: datasource.static-example-5
|
|
38334
38720
|
name: Static Datasource with Number Array
|
|
38335
38721
|
category: datasource
|
|
@@ -38355,8 +38741,10 @@
|
|
|
38355
38741
|
- comma-delimiter
|
|
38356
38742
|
description: Parse comma-separated priority values into array using default
|
|
38357
38743
|
comma delimiter
|
|
38358
|
-
code:
|
|
38359
|
-
|
|
38744
|
+
code: |-
|
|
38745
|
+
app.addDatasource
|
|
38746
|
+
.static({ datasourceId: 'priorities', data: [] })
|
|
38747
|
+
.csv('urgent, high, medium, low')
|
|
38360
38748
|
- id: datasource.static-example-7
|
|
38361
38749
|
name: Static Datasource with Pipe-Delimited CSV Colors
|
|
38362
38750
|
category: datasource
|
|
@@ -38368,8 +38756,10 @@
|
|
|
38368
38756
|
- whitespace
|
|
38369
38757
|
- colors
|
|
38370
38758
|
description: Parse pipe-delimited color values with automatic whitespace trimming
|
|
38371
|
-
code:
|
|
38372
|
-
|
|
38759
|
+
code: |-
|
|
38760
|
+
app.addDatasource
|
|
38761
|
+
.static({ datasourceId: 'colors', data: [] })
|
|
38762
|
+
.csv(' red | green | blue ', '|')
|
|
38373
38763
|
- id: datasource.static-example-8
|
|
38374
38764
|
name: Static Datasource with JSON Array Parsing
|
|
38375
38765
|
category: datasource
|
|
@@ -38394,8 +38784,10 @@
|
|
|
38394
38784
|
- key-value-pairs
|
|
38395
38785
|
- configuration
|
|
38396
38786
|
description: Convert JSON configuration object to key-value pair array
|
|
38397
|
-
code:
|
|
38398
|
-
|
|
38787
|
+
code: |-
|
|
38788
|
+
app.addDatasource
|
|
38789
|
+
.static({ datasourceId: 'config', data: [] })
|
|
38790
|
+
.json('{"debug": true, "port": 3000}')
|
|
38399
38791
|
- id: datasource.system-example-1
|
|
38400
38792
|
name: System Datasource for Feature Flags
|
|
38401
38793
|
category: datasource
|
|
@@ -38458,7 +38850,11 @@
|
|
|
38458
38850
|
managing continuation tokens for REST APIs
|
|
38459
38851
|
code: |-
|
|
38460
38852
|
// 1. Basic REST function with simple pagination
|
|
38461
|
-
const getUsersFunction = app.addFunction.rest({
|
|
38853
|
+
const getUsersFunction = app.addFunction.rest({
|
|
38854
|
+
functionId: 'get-users',
|
|
38855
|
+
method: 'GET',
|
|
38856
|
+
url: 'https://api.example.com/users',
|
|
38857
|
+
})
|
|
38462
38858
|
getUsersFunction.params.query('page', { value: 1, type: 'number' })
|
|
38463
38859
|
getUsersFunction.params.header('Authorization', 'Bearer token123')
|
|
38464
38860
|
getUsersFunction.json()
|
|
@@ -38468,7 +38864,11 @@
|
|
|
38468
38864
|
usersContinuation.when('=$.hasMore')
|
|
38469
38865
|
usersContinuation.url('=$.nextPageUrl')
|
|
38470
38866
|
// 2. Microsoft Graph API with OAuth continuation
|
|
38471
|
-
const getGraphUsers = app.addFunction.rest({
|
|
38867
|
+
const getGraphUsers = app.addFunction.rest({
|
|
38868
|
+
functionId: 'get-graph-users',
|
|
38869
|
+
method: 'GET',
|
|
38870
|
+
url: 'https://graph.microsoft.com/v1.0/users',
|
|
38871
|
+
})
|
|
38472
38872
|
getGraphUsers.params.header('Authorization', '=@ctx.solution.state.user.graphToken')
|
|
38473
38873
|
getGraphUsers.json()
|
|
38474
38874
|
getGraphUsers.records('=$.value')
|
|
@@ -38477,7 +38877,11 @@
|
|
|
38477
38877
|
graphContinuation.when('=$."@odata.nextLink"')
|
|
38478
38878
|
graphContinuation.url('=$."@odata.nextLink"')
|
|
38479
38879
|
// 3. Advanced pagination with cursor-based continuation
|
|
38480
|
-
const searchCustomers = app.addFunction.rest({
|
|
38880
|
+
const searchCustomers = app.addFunction.rest({
|
|
38881
|
+
functionId: 'search-customers',
|
|
38882
|
+
method: 'POST',
|
|
38883
|
+
url: 'https://api.crm.com/customers/search',
|
|
38884
|
+
})
|
|
38481
38885
|
searchCustomers.params.body('query', { name: 'John', active: true })
|
|
38482
38886
|
searchCustomers.params.header('API-Key', '=@ctx.solution.state.crmApiKey')
|
|
38483
38887
|
searchCustomers.json()
|
|
@@ -38489,7 +38893,11 @@
|
|
|
38489
38893
|
'=@ctx.solution.state.apiUrl & "/customers/search?cursor=" & $.pagination.nextCursor',
|
|
38490
38894
|
)
|
|
38491
38895
|
// 4. Pagination with dynamic parameter updates
|
|
38492
|
-
const getOrderHistory = app.addFunction.rest({
|
|
38896
|
+
const getOrderHistory = app.addFunction.rest({
|
|
38897
|
+
functionId: 'get-order-history',
|
|
38898
|
+
method: 'GET',
|
|
38899
|
+
url: 'https://api.orders.com/history',
|
|
38900
|
+
})
|
|
38493
38901
|
getOrderHistory.params.query('limit', { value: 100, type: 'number' })
|
|
38494
38902
|
getOrderHistory.params.query('offset', { value: 0, type: 'number' })
|
|
38495
38903
|
getOrderHistory.params.header('X-API-Key', '=@ctx.solution.state.ordersApiKey')
|
|
@@ -38502,7 +38910,11 @@
|
|
|
38502
38910
|
'=@ctx.solution.state.ordersUrl & "/history?offset=" & ($.offset + $.limit) & "&limit=" & $.limit',
|
|
38503
38911
|
)
|
|
38504
38912
|
// 5. Complex continuation with authentication renewal
|
|
38505
|
-
const syncInventory = app.addFunction.rest({
|
|
38913
|
+
const syncInventory = app.addFunction.rest({
|
|
38914
|
+
functionId: 'sync-inventory',
|
|
38915
|
+
method: 'GET',
|
|
38916
|
+
url: 'https://api.inventory.com/items',
|
|
38917
|
+
})
|
|
38506
38918
|
syncInventory.params.header('Authorization', 'Bearer =@ctx.solution.state.inventoryToken')
|
|
38507
38919
|
syncInventory.params.query('pageSize', { value: 50, type: 'number' })
|
|
38508
38920
|
syncInventory.json()
|
|
@@ -38527,14 +38939,22 @@
|
|
|
38527
38939
|
PUT, DELETE methods with full parameter and header control
|
|
38528
38940
|
code: |-
|
|
38529
38941
|
// 1. Basic GET request with authentication
|
|
38530
|
-
const getUsersFunction = app.addFunction.rest({
|
|
38942
|
+
const getUsersFunction = app.addFunction.rest({
|
|
38943
|
+
functionId: 'get-users',
|
|
38944
|
+
method: 'GET',
|
|
38945
|
+
url: 'https://api.example.com/users',
|
|
38946
|
+
})
|
|
38531
38947
|
getUsersFunction.json()
|
|
38532
38948
|
getUsersFunction.params
|
|
38533
38949
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.token')
|
|
38534
38950
|
.query('page', { type: 'number', value: 1 })
|
|
38535
38951
|
.query('limit', { type: 'number', value: 10 })
|
|
38536
38952
|
// 2. POST request with body data and API key
|
|
38537
|
-
const createUserFunction = app.addFunction.rest({
|
|
38953
|
+
const createUserFunction = app.addFunction.rest({
|
|
38954
|
+
functionId: 'create-user',
|
|
38955
|
+
method: 'POST',
|
|
38956
|
+
url: 'https://api.example.com/users',
|
|
38957
|
+
})
|
|
38538
38958
|
createUserFunction.json()
|
|
38539
38959
|
createUserFunction.params.apiKey('=@ctx.solution.state.settings.apiKey').body('user', {
|
|
38540
38960
|
name: '=@ctx.components.name.state.value',
|
|
@@ -38542,7 +38962,11 @@
|
|
|
38542
38962
|
department: '=@ctx.solution.state.user.department',
|
|
38543
38963
|
})
|
|
38544
38964
|
// 3. Advanced configuration with output transformation and entity storage
|
|
38545
|
-
const getProductsFunction = app.addFunction.rest({
|
|
38965
|
+
const getProductsFunction = app.addFunction.rest({
|
|
38966
|
+
functionId: 'get-products',
|
|
38967
|
+
method: 'GET',
|
|
38968
|
+
url: 'https://api.example.com/products',
|
|
38969
|
+
})
|
|
38546
38970
|
getProductsFunction.json().outputTransform('$.data.products').entity('default/products')
|
|
38547
38971
|
getProductsFunction.params
|
|
38548
38972
|
.header('X-API-Version', '2.0')
|
|
@@ -38565,7 +38989,11 @@
|
|
|
38565
38989
|
response strategies
|
|
38566
38990
|
code: |-
|
|
38567
38991
|
// 1. Function with comprehensive error handling
|
|
38568
|
-
const syncDataFunction = app.addFunction.rest({
|
|
38992
|
+
const syncDataFunction = app.addFunction.rest({
|
|
38993
|
+
functionId: 'sync-data',
|
|
38994
|
+
method: 'POST',
|
|
38995
|
+
url: 'https://api.example.com/sync',
|
|
38996
|
+
})
|
|
38569
38997
|
syncDataFunction.json()
|
|
38570
38998
|
syncDataFunction.params.bearer('=@ctx.auth.accessToken').body('data', '=@ctx.pendingSync.data')
|
|
38571
38999
|
// Server error with retry
|
|
@@ -38598,7 +39026,11 @@
|
|
|
38598
39026
|
.icon('lock')
|
|
38599
39027
|
.notification(true)
|
|
38600
39028
|
// 2. Function with data conversion and error handling
|
|
38601
|
-
const uploadImageFunction = app.addFunction.rest({
|
|
39029
|
+
const uploadImageFunction = app.addFunction.rest({
|
|
39030
|
+
functionId: 'upload-image',
|
|
39031
|
+
method: 'POST',
|
|
39032
|
+
url: 'https://api.example.com/upload',
|
|
39033
|
+
})
|
|
38602
39034
|
uploadImageFunction.json().base64ToUri('image', 'uploaded-image.jpg')
|
|
38603
39035
|
uploadImageFunction.params
|
|
38604
39036
|
.header('Content-Type', 'application/json')
|
|
@@ -38633,7 +39065,11 @@
|
|
|
38633
39065
|
for mobile-optimized performance
|
|
38634
39066
|
code: |-
|
|
38635
39067
|
// 1. Paginated API with continuation logic
|
|
38636
|
-
const getOrdersFunction = app.addFunction.rest({
|
|
39068
|
+
const getOrdersFunction = app.addFunction.rest({
|
|
39069
|
+
functionId: 'get-orders',
|
|
39070
|
+
method: 'GET',
|
|
39071
|
+
url: 'https://api.example.com/orders',
|
|
39072
|
+
})
|
|
38637
39073
|
getOrdersFunction.json().outputTransform('$.orders').entity('default/orders')
|
|
38638
39074
|
getOrdersFunction.params
|
|
38639
39075
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.token')
|
|
@@ -38642,7 +39078,11 @@
|
|
|
38642
39078
|
// Continuation for next page
|
|
38643
39079
|
getOrdersFunction.continuation.when('=$.hasMore').url('=$.nextPageUrl')
|
|
38644
39080
|
// 2. Function with file conversion and row filtering
|
|
38645
|
-
const getCustomersFunction = app.addFunction.rest({
|
|
39081
|
+
const getCustomersFunction = app.addFunction.rest({
|
|
39082
|
+
functionId: 'get-customers',
|
|
39083
|
+
method: 'GET',
|
|
39084
|
+
url: 'https://api.example.com/customers',
|
|
39085
|
+
})
|
|
38646
39086
|
getCustomersFunction
|
|
38647
39087
|
.json()
|
|
38648
39088
|
.outputTransform('$.data.customers')
|
|
@@ -38654,7 +39094,11 @@
|
|
|
38654
39094
|
.query('includeInactive', { type: 'boolean', value: false })
|
|
38655
39095
|
.query('fields', { value: 'id,name,email,profileImage,status,lastLoginDays' })
|
|
38656
39096
|
// 3. Bulk data processing with transformation
|
|
38657
|
-
const getAnalyticsFunction = app.addFunction.rest({
|
|
39097
|
+
const getAnalyticsFunction = app.addFunction.rest({
|
|
39098
|
+
functionId: 'get-analytics',
|
|
39099
|
+
method: 'GET',
|
|
39100
|
+
url: 'https://api.example.com/analytics',
|
|
39101
|
+
})
|
|
38658
39102
|
getAnalyticsFunction.json().outputTransform('$.metrics')
|
|
38659
39103
|
getAnalyticsFunction.params
|
|
38660
39104
|
.query('dateFrom', { value: '=@ctx.jig.state.filter.startDate' })
|
|
@@ -38677,14 +39121,24 @@
|
|
|
38677
39121
|
construction, authentication, and XML response parsing
|
|
38678
39122
|
code: |-
|
|
38679
39123
|
// 1. Basic SOAP service call with authentication
|
|
38680
|
-
const getUserDetailsFunction = app.addFunction.soap({
|
|
39124
|
+
const getUserDetailsFunction = app.addFunction.soap({
|
|
39125
|
+
functionId: 'get-user-details',
|
|
39126
|
+
connection: 'legacy-service',
|
|
39127
|
+
method: 'GetUserDetails',
|
|
39128
|
+
wsdl: 'https://legacy-api.company.com/UserService.wsdl',
|
|
39129
|
+
})
|
|
38681
39130
|
getUserDetailsFunction.params
|
|
38682
39131
|
.header('SOAPAction', 'GetUserDetails')
|
|
38683
39132
|
.header('Authorization', 'Basic =@ctx.solution.state.auth.basicToken')
|
|
38684
39133
|
.body('UserId', '=@ctx.user.id')
|
|
38685
39134
|
.body('IncludeDetails', true)
|
|
38686
39135
|
// 2. SOAP service with complex parameters
|
|
38687
|
-
const createOrderFunction = app.addFunction.soap({
|
|
39136
|
+
const createOrderFunction = app.addFunction.soap({
|
|
39137
|
+
functionId: 'create-order',
|
|
39138
|
+
connection: 'erp-service',
|
|
39139
|
+
method: 'CreateOrder',
|
|
39140
|
+
wsdl: 'https://erp.company.com/OrderService.wsdl',
|
|
39141
|
+
})
|
|
38688
39142
|
createOrderFunction.params
|
|
38689
39143
|
.header('SOAPAction', 'CreateOrder')
|
|
38690
39144
|
.header('X-API-Key', '=@ctx.solution.state.settings.erpApiKey')
|
|
@@ -38696,7 +39150,12 @@
|
|
|
38696
39150
|
PaymentMethod: '=@ctx.jig.inputs.payment.method',
|
|
38697
39151
|
})
|
|
38698
39152
|
// 3. SOAP service with output transformation
|
|
38699
|
-
const getInventoryFunction = app.addFunction.soap({
|
|
39153
|
+
const getInventoryFunction = app.addFunction.soap({
|
|
39154
|
+
functionId: 'get-inventory',
|
|
39155
|
+
connection: 'wms-service',
|
|
39156
|
+
method: 'GetInventoryStatus',
|
|
39157
|
+
wsdl: 'https://wms.company.com/InventoryService.wsdl',
|
|
39158
|
+
})
|
|
38700
39159
|
getInventoryFunction
|
|
38701
39160
|
.outputTransform('$.Body.GetInventoryStatusResponse.InventoryItems.Item')
|
|
38702
39161
|
.entity('inventory')
|
|
@@ -38721,7 +39180,12 @@
|
|
|
38721
39180
|
authentication errors, and enterprise messaging patterns
|
|
38722
39181
|
code: |-
|
|
38723
39182
|
// 1. Enterprise service with comprehensive error handling
|
|
38724
|
-
const syncEmployeeDataFunction = app.addFunction.soap({
|
|
39183
|
+
const syncEmployeeDataFunction = app.addFunction.soap({
|
|
39184
|
+
functionId: 'sync-employee-data',
|
|
39185
|
+
connection: 'hr-service',
|
|
39186
|
+
method: 'SyncEmployeeData',
|
|
39187
|
+
wsdl: 'https://hr.company.com/EmployeeService.wsdl',
|
|
39188
|
+
})
|
|
38725
39189
|
syncEmployeeDataFunction.params
|
|
38726
39190
|
.header('SOAPAction', 'SyncEmployeeData')
|
|
38727
39191
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.enterpriseToken')
|
|
@@ -38754,7 +39218,12 @@
|
|
|
38754
39218
|
maxRetries: 2,
|
|
38755
39219
|
})
|
|
38756
39220
|
// 2. Legacy financial system integration
|
|
38757
|
-
const processPaymentFunction = app.addFunction.soap({
|
|
39221
|
+
const processPaymentFunction = app.addFunction.soap({
|
|
39222
|
+
functionId: 'process-payment',
|
|
39223
|
+
connection: 'finance-service',
|
|
39224
|
+
method: 'ProcessPayment',
|
|
39225
|
+
wsdl: 'https://finance.company.com/PaymentService.wsdl',
|
|
39226
|
+
})
|
|
38758
39227
|
processPaymentFunction.params
|
|
38759
39228
|
.header('SOAPAction', 'ProcessPayment')
|
|
38760
39229
|
.header('X-System-Id', 'MOBILE_APP')
|
|
@@ -38794,7 +39263,12 @@
|
|
|
38794
39263
|
integration, and enterprise data patterns
|
|
38795
39264
|
code: |-
|
|
38796
39265
|
// 1. Multi-step customer onboarding workflow
|
|
38797
|
-
const initiateCustomerOnboardingFunction = app.addFunction.soap({
|
|
39266
|
+
const initiateCustomerOnboardingFunction = app.addFunction.soap({
|
|
39267
|
+
functionId: 'initiate-customer-onboarding',
|
|
39268
|
+
connection: 'crm-service',
|
|
39269
|
+
method: 'InitiateOnboarding',
|
|
39270
|
+
wsdl: 'https://crm.company.com/OnboardingService.wsdl',
|
|
39271
|
+
})
|
|
38798
39272
|
initiateCustomerOnboardingFunction.outputTransform(
|
|
38799
39273
|
'$.Body.InitiateOnboardingResponse.OnboardingProcess',
|
|
38800
39274
|
)
|
|
@@ -38817,7 +39291,12 @@
|
|
|
38817
39291
|
ReferralSource: '=@ctx.jig.inputs.referral.source',
|
|
38818
39292
|
})
|
|
38819
39293
|
// 2. Document processing and approval workflow
|
|
38820
|
-
const submitDocumentForApprovalFunction = app.addFunction.soap({
|
|
39294
|
+
const submitDocumentForApprovalFunction = app.addFunction.soap({
|
|
39295
|
+
functionId: 'submit-document-approval',
|
|
39296
|
+
connection: 'workflow-service',
|
|
39297
|
+
method: 'SubmitForApproval',
|
|
39298
|
+
wsdl: 'https://workflow.company.com/ApprovalService.wsdl',
|
|
39299
|
+
})
|
|
38821
39300
|
submitDocumentForApprovalFunction.base64ToUri('documentContent', 'document.pdf')
|
|
38822
39301
|
submitDocumentForApprovalFunction.params
|
|
38823
39302
|
.header('SOAPAction', 'SubmitForApproval')
|
|
@@ -38834,7 +39313,12 @@
|
|
|
38834
39313
|
},
|
|
38835
39314
|
})
|
|
38836
39315
|
// 3. Complex reporting service with aggregated data
|
|
38837
|
-
const generateComplianceReportFunction = app.addFunction.soap({
|
|
39316
|
+
const generateComplianceReportFunction = app.addFunction.soap({
|
|
39317
|
+
functionId: 'generate-compliance-report',
|
|
39318
|
+
connection: 'compliance-service',
|
|
39319
|
+
method: 'GenerateComplianceReport',
|
|
39320
|
+
wsdl: 'https://compliance.company.com/ReportingService.wsdl',
|
|
39321
|
+
})
|
|
38838
39322
|
generateComplianceReportFunction.outputTransform(
|
|
38839
39323
|
'$.Body.GenerateComplianceReportResponse.ReportData.Sections',
|
|
38840
39324
|
)
|
|
@@ -38873,7 +39357,10 @@
|
|
|
38873
39357
|
input/output parameters
|
|
38874
39358
|
code: |-
|
|
38875
39359
|
// 1. Basic SELECT query with parameters
|
|
38876
|
-
const getCustomersFunction = app.addFunction.sql({
|
|
39360
|
+
const getCustomersFunction = app.addFunction.sql({
|
|
39361
|
+
functionId: 'get-customers',
|
|
39362
|
+
connection: 'customerDb',
|
|
39363
|
+
})
|
|
38877
39364
|
getCustomersFunction
|
|
38878
39365
|
.providerQuery('SELECT * FROM customers WHERE active = @active AND region = @region')
|
|
38879
39366
|
.entity('customers')
|
|
@@ -38881,7 +39368,11 @@
|
|
|
38881
39368
|
.input('active', 'boolean', { value: true })
|
|
38882
39369
|
.input('region', 'string', { value: '=@ctx.solution.state.user.region' })
|
|
38883
39370
|
// 2. Stored procedure with input and output parameters
|
|
38884
|
-
const updateCustomerFunction = app.addFunction.sql({
|
|
39371
|
+
const updateCustomerFunction = app.addFunction.sql({
|
|
39372
|
+
functionId: 'update-customer',
|
|
39373
|
+
connection: 'customerDb',
|
|
39374
|
+
method: 'execute',
|
|
39375
|
+
})
|
|
38885
39376
|
updateCustomerFunction.procedure('sp_UpdateCustomer')
|
|
38886
39377
|
updateCustomerFunction.params
|
|
38887
39378
|
.input('customerId', 'number', { value: '=@ctx.jig.inputs.customer.id' })
|
|
@@ -38890,7 +39381,10 @@
|
|
|
38890
39381
|
.output('result', 'string')
|
|
38891
39382
|
.output('affectedRows', 'number')
|
|
38892
39383
|
// 3. Complex query with data transformation
|
|
38893
|
-
const getOrderStatsFunction = app.addFunction.sql({
|
|
39384
|
+
const getOrderStatsFunction = app.addFunction.sql({
|
|
39385
|
+
functionId: 'get-order-stats',
|
|
39386
|
+
connection: 'analyticsDb',
|
|
39387
|
+
})
|
|
38894
39388
|
getOrderStatsFunction.providerQuery(`
|
|
38895
39389
|
SELECT
|
|
38896
39390
|
customerId,
|
|
@@ -38923,7 +39417,11 @@
|
|
|
38923
39417
|
handling of database constraints, locks, and file operations
|
|
38924
39418
|
code: |-
|
|
38925
39419
|
// 1. Insert operation with comprehensive error handling
|
|
38926
|
-
const createOrderFunction = app.addFunction.sql({
|
|
39420
|
+
const createOrderFunction = app.addFunction.sql({
|
|
39421
|
+
functionId: 'create-order',
|
|
39422
|
+
connection: 'ordersDb',
|
|
39423
|
+
method: 'execute',
|
|
39424
|
+
})
|
|
38927
39425
|
createOrderFunction.procedure('sp_CreateOrder')
|
|
38928
39426
|
createOrderFunction.params
|
|
38929
39427
|
.input('customerId', 'number', { value: '=@ctx.jig.inputs.customer.id' })
|
|
@@ -38949,7 +39447,10 @@
|
|
|
38949
39447
|
maxRetries: 3,
|
|
38950
39448
|
})
|
|
38951
39449
|
// 2. Function with file conversion and row operations
|
|
38952
|
-
const getProductsWithImagesFunction = app.addFunction.sql({
|
|
39450
|
+
const getProductsWithImagesFunction = app.addFunction.sql({
|
|
39451
|
+
functionId: 'get-products-with-images',
|
|
39452
|
+
connection: 'catalogDb',
|
|
39453
|
+
})
|
|
38953
39454
|
getProductsWithImagesFunction
|
|
38954
39455
|
.providerQuery('SELECT * FROM products WHERE categoryId = @categoryId')
|
|
38955
39456
|
.entity('products')
|
|
@@ -38959,7 +39460,11 @@
|
|
|
38959
39460
|
value: '=@ctx.current.item.category.id',
|
|
38960
39461
|
})
|
|
38961
39462
|
// 3. Bulk operation with table operations and conditions
|
|
38962
|
-
const syncInventoryFunction = app.addFunction.sql({
|
|
39463
|
+
const syncInventoryFunction = app.addFunction.sql({
|
|
39464
|
+
functionId: 'sync-inventory',
|
|
39465
|
+
connection: 'inventoryDb',
|
|
39466
|
+
method: 'execute',
|
|
39467
|
+
})
|
|
38963
39468
|
syncInventoryFunction.procedure('sp_SyncInventory')
|
|
38964
39469
|
syncInventoryFunction.params
|
|
38965
39470
|
.input('inventoryData', 'string', { value: '=JSON.stringify(@ctx.datasources.inventory)' })
|
|
@@ -38994,17 +39499,26 @@
|
|
|
38994
39499
|
operations
|
|
38995
39500
|
code: |-
|
|
38996
39501
|
// 1. Dynamic SELECT query with helper methods
|
|
38997
|
-
const getFilteredCustomersFunction = app.addFunction.sql({
|
|
39502
|
+
const getFilteredCustomersFunction = app.addFunction.sql({
|
|
39503
|
+
functionId: 'get-filtered-customers',
|
|
39504
|
+
connection: 'reportsDb',
|
|
39505
|
+
})
|
|
38998
39506
|
getFilteredCustomersFunction
|
|
38999
39507
|
.select(['id', 'name', 'email', 'region', 'lastOrderDate'], 'customers', 'active = @active')
|
|
39000
39508
|
.entity('customers')
|
|
39001
39509
|
getFilteredCustomersFunction.params.input('active', 'boolean', { value: true })
|
|
39002
39510
|
// 2. Simple SELECT ALL with conditions
|
|
39003
|
-
const getAllProductsFunction = app.addFunction.sql({
|
|
39511
|
+
const getAllProductsFunction = app.addFunction.sql({
|
|
39512
|
+
functionId: 'get-all-products',
|
|
39513
|
+
connection: 'catalogDb',
|
|
39514
|
+
})
|
|
39004
39515
|
getAllProductsFunction.selectAll('products', 'discontinued = @discontinued').entity('products')
|
|
39005
39516
|
getAllProductsFunction.params.input('discontinued', 'boolean', { value: false })
|
|
39006
39517
|
// 3. Complex analytics query
|
|
39007
|
-
const getSalesReportFunction = app.addFunction.sql({
|
|
39518
|
+
const getSalesReportFunction = app.addFunction.sql({
|
|
39519
|
+
functionId: 'get-sales-report',
|
|
39520
|
+
connection: 'analyticsDb',
|
|
39521
|
+
})
|
|
39008
39522
|
getSalesReportFunction.providerQuery(`
|
|
39009
39523
|
WITH monthly_sales AS (
|
|
39010
39524
|
SELECT
|
|
@@ -39032,7 +39546,11 @@
|
|
|
39032
39546
|
value: '=@ctx.jig.inputs.report.startDate',
|
|
39033
39547
|
})
|
|
39034
39548
|
// 4. Batch processing with file operations
|
|
39035
|
-
const processBatchUploadsFunction = app.addFunction.sql({
|
|
39549
|
+
const processBatchUploadsFunction = app.addFunction.sql({
|
|
39550
|
+
functionId: 'process-batch-uploads',
|
|
39551
|
+
connection: 'processingDb',
|
|
39552
|
+
method: 'execute',
|
|
39553
|
+
})
|
|
39036
39554
|
processBatchUploadsFunction.procedure('sp_ProcessBatch').uriToBase64('uploadFile')
|
|
39037
39555
|
processBatchUploadsFunction.params
|
|
39038
39556
|
.input('batchId', 'string', { value: '=@ctx.jig.inputs.batch.id' })
|
|
@@ -39053,7 +39571,11 @@
|
|
|
39053
39571
|
result expression
|
|
39054
39572
|
code: |-
|
|
39055
39573
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39056
|
-
const fn = app.addFunction.rest({
|
|
39574
|
+
const fn = app.addFunction.rest({
|
|
39575
|
+
functionId: 'test-function',
|
|
39576
|
+
method: 'POST',
|
|
39577
|
+
url: 'https://api.example.com/test',
|
|
39578
|
+
})
|
|
39057
39579
|
fn.guard('guard-function')
|
|
39058
39580
|
.parameters({
|
|
39059
39581
|
accessToken: 'acuerp',
|
|
@@ -39074,7 +39596,11 @@
|
|
|
39074
39596
|
tables with parameterized statements
|
|
39075
39597
|
code: |-
|
|
39076
39598
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39077
|
-
const fn = app.addFunction.rest({
|
|
39599
|
+
const fn = app.addFunction.rest({
|
|
39600
|
+
functionId: 'test-function',
|
|
39601
|
+
method: 'POST',
|
|
39602
|
+
url: 'https://api.example.com/test',
|
|
39603
|
+
})
|
|
39078
39604
|
const guard = fn
|
|
39079
39605
|
.guard('guard-function')
|
|
39080
39606
|
.parameters({ id: '=@ctx.parameters.id' })
|
|
@@ -39100,7 +39626,11 @@
|
|
|
39100
39626
|
replace records
|
|
39101
39627
|
code: |-
|
|
39102
39628
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39103
|
-
const fn = app.addFunction.rest({
|
|
39629
|
+
const fn = app.addFunction.rest({
|
|
39630
|
+
functionId: 'test-function',
|
|
39631
|
+
method: 'POST',
|
|
39632
|
+
url: 'https://api.example.com/test',
|
|
39633
|
+
})
|
|
39104
39634
|
const guard = fn.guard('guard-function').result('=true')
|
|
39105
39635
|
guard
|
|
39106
39636
|
.operation()
|
|
@@ -39117,7 +39647,11 @@
|
|
|
39117
39647
|
process response data
|
|
39118
39648
|
code: |-
|
|
39119
39649
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39120
|
-
const fn = app.addFunction.rest({
|
|
39650
|
+
const fn = app.addFunction.rest({
|
|
39651
|
+
functionId: 'test-function',
|
|
39652
|
+
method: 'GET',
|
|
39653
|
+
url: 'https://api.example.com/data',
|
|
39654
|
+
})
|
|
39121
39655
|
fn.operation('=@ctx.response.body.items').upsertMerge(
|
|
39122
39656
|
'items',
|
|
39123
39657
|
'=$map(@ctx.response.body.items, function($v) {$merge([$v, {"Remote": true}])})',
|
|
@@ -39133,7 +39667,11 @@
|
|
|
39133
39667
|
description: Configure function with root-level execute-sql operation to update local data
|
|
39134
39668
|
code: |-
|
|
39135
39669
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39136
|
-
const fn = app.addFunction.rest({
|
|
39670
|
+
const fn = app.addFunction.rest({
|
|
39671
|
+
functionId: 'test-function',
|
|
39672
|
+
method: 'GET',
|
|
39673
|
+
url: 'https://api.example.com/data',
|
|
39674
|
+
})
|
|
39137
39675
|
fn.operation().executeSql(
|
|
39138
39676
|
['items'],
|
|
39139
39677
|
'UPDATE items SET data = json_set(data, "$.Remote", false)',
|
|
@@ -39151,7 +39689,11 @@
|
|
|
39151
39689
|
execution based on parameters
|
|
39152
39690
|
code: |-
|
|
39153
39691
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39154
|
-
const fn = app.addFunction.rest({
|
|
39692
|
+
const fn = app.addFunction.rest({
|
|
39693
|
+
functionId: 'test-function',
|
|
39694
|
+
method: 'GET',
|
|
39695
|
+
url: 'https://api.example.com/data',
|
|
39696
|
+
})
|
|
39155
39697
|
fn.operation()
|
|
39156
39698
|
.when('=@ctx.parameters.deleteRequired = "y"')
|
|
39157
39699
|
.executeSql(['items'], 'DELETE FROM items WHERE json_extract(data, "$.Remote") is false')
|
|
@@ -39169,7 +39711,11 @@
|
|
|
39169
39711
|
and conditional execute-sql
|
|
39170
39712
|
code: |-
|
|
39171
39713
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39172
|
-
const fn = app.addFunction.rest({
|
|
39714
|
+
const fn = app.addFunction.rest({
|
|
39715
|
+
functionId: 'test-function',
|
|
39716
|
+
method: 'GET',
|
|
39717
|
+
url: 'https://api.example.com/data',
|
|
39718
|
+
})
|
|
39173
39719
|
fn.operation().upsertMerge('items', '=@ctx.response.body')
|
|
39174
39720
|
fn.operation()
|
|
39175
39721
|
.when('=@ctx.parameters.cleanup = true')
|
|
@@ -39224,7 +39770,11 @@
|
|
|
39224
39770
|
values from function execution
|
|
39225
39771
|
code: |-
|
|
39226
39772
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39227
|
-
const fn = app.addFunction.rest({
|
|
39773
|
+
const fn = app.addFunction.rest({
|
|
39774
|
+
functionId: 'test-function',
|
|
39775
|
+
method: 'POST',
|
|
39776
|
+
url: 'https://api.example.com/payment',
|
|
39777
|
+
})
|
|
39228
39778
|
fn.params
|
|
39229
39779
|
.body('amount', undefined, { type: 'number', required: true })
|
|
39230
39780
|
.output('prePaymentTransactionId', { type: 'string', required: false })
|
|
@@ -39242,7 +39792,11 @@
|
|
|
39242
39792
|
description: Configure guard with when condition to control when guard evaluation runs
|
|
39243
39793
|
code: |-
|
|
39244
39794
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39245
|
-
const fn = app.addFunction.rest({
|
|
39795
|
+
const fn = app.addFunction.rest({
|
|
39796
|
+
functionId: 'test-function',
|
|
39797
|
+
method: 'POST',
|
|
39798
|
+
url: 'https://api.example.com/test',
|
|
39799
|
+
})
|
|
39246
39800
|
fn.guard('guard-function').when('=@ctx.user.authenticated').result('=@ctx.guard.output.valid')
|
|
39247
39801
|
- id: function.guard-example-12
|
|
39248
39802
|
name: Guard with Retry and Continuation Lifecycle Options
|
|
@@ -39257,7 +39811,11 @@
|
|
|
39257
39811
|
robust sync workflows
|
|
39258
39812
|
code: |-
|
|
39259
39813
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39260
|
-
const fn = app.addFunction.rest({
|
|
39814
|
+
const fn = app.addFunction.rest({
|
|
39815
|
+
functionId: 'test-function',
|
|
39816
|
+
method: 'POST',
|
|
39817
|
+
url: 'https://api.example.com/test',
|
|
39818
|
+
})
|
|
39261
39819
|
fn.guard('guard-function').onRetry().onContinuation().result('=@ctx.guard.output.valid')
|
|
39262
39820
|
- id: function.guard-example-13
|
|
39263
39821
|
name: Guard with Dynamic onInitial Expression
|
|
@@ -39272,7 +39830,11 @@
|
|
|
39272
39830
|
initial guard evaluation
|
|
39273
39831
|
code: |-
|
|
39274
39832
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39275
|
-
const fn = app.addFunction.rest({
|
|
39833
|
+
const fn = app.addFunction.rest({
|
|
39834
|
+
functionId: 'test-function',
|
|
39835
|
+
method: 'POST',
|
|
39836
|
+
url: 'https://api.example.com/test',
|
|
39837
|
+
})
|
|
39276
39838
|
fn.guard('guard-function')
|
|
39277
39839
|
.onInitial('=@ctx.parameters.runGuard')
|
|
39278
39840
|
.result('=@ctx.guard.output.valid')
|
|
@@ -39288,7 +39850,11 @@
|
|
|
39288
39850
|
records in a table
|
|
39289
39851
|
code: |-
|
|
39290
39852
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39291
|
-
const fn = app.addFunction.rest({
|
|
39853
|
+
const fn = app.addFunction.rest({
|
|
39854
|
+
functionId: 'test-function',
|
|
39855
|
+
method: 'GET',
|
|
39856
|
+
url: 'https://api.example.com/data',
|
|
39857
|
+
})
|
|
39292
39858
|
fn.operation('=@ctx.response.body.items').upsertReplace('items', '=@ctx.response.body.items')
|
|
39293
39859
|
- id: function.guard-example-15
|
|
39294
39860
|
name: Function with Find-Replace Operation for Temp ID Resolution
|
|
@@ -39303,7 +39869,11 @@
|
|
|
39303
39869
|
server-assigned IDs across multiple tables including the command queue
|
|
39304
39870
|
code: |-
|
|
39305
39871
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39306
|
-
const fn = app.addFunction.rest({
|
|
39872
|
+
const fn = app.addFunction.rest({
|
|
39873
|
+
functionId: 'test-function',
|
|
39874
|
+
method: 'POST',
|
|
39875
|
+
url: 'https://api.example.com/data',
|
|
39876
|
+
})
|
|
39307
39877
|
fn.operation().findReplace(
|
|
39308
39878
|
'temp-id-123',
|
|
39309
39879
|
'=@ctx.response.body.id',
|
|
@@ -39323,7 +39893,11 @@
|
|
|
39323
39893
|
timestamp columns for conflict resolution
|
|
39324
39894
|
code: |-
|
|
39325
39895
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39326
|
-
const fn = app.addFunction.rest({
|
|
39896
|
+
const fn = app.addFunction.rest({
|
|
39897
|
+
functionId: 'test-function',
|
|
39898
|
+
method: 'GET',
|
|
39899
|
+
url: 'https://api.example.com/data',
|
|
39900
|
+
})
|
|
39327
39901
|
fn.operation('=@ctx.response.body')
|
|
39328
39902
|
.upsertMerge('items', '=@ctx.response.body')
|
|
39329
39903
|
.primaryKey('itemId')
|
|
@@ -39341,7 +39915,11 @@
|
|
|
39341
39915
|
formats during sync
|
|
39342
39916
|
code: |-
|
|
39343
39917
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39344
|
-
const fn = app.addFunction.rest({
|
|
39918
|
+
const fn = app.addFunction.rest({
|
|
39919
|
+
functionId: 'test-function',
|
|
39920
|
+
method: 'GET',
|
|
39921
|
+
url: 'https://api.example.com/data',
|
|
39922
|
+
})
|
|
39345
39923
|
fn.operation('=@ctx.response.body')
|
|
39346
39924
|
.upsertMerge('items', '=@ctx.response.body')
|
|
39347
39925
|
.conversions([{ property: 'image', from: 'base64', to: 'local-uri' }])
|
|
@@ -39358,7 +39936,11 @@
|
|
|
39358
39936
|
failed transactions from local tables
|
|
39359
39937
|
code: |-
|
|
39360
39938
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39361
|
-
const fn = app.addFunction.rest({
|
|
39939
|
+
const fn = app.addFunction.rest({
|
|
39940
|
+
functionId: 'test-function',
|
|
39941
|
+
method: 'POST',
|
|
39942
|
+
url: 'https://api.example.com/payment',
|
|
39943
|
+
})
|
|
39362
39944
|
fn.error('=@ctx.response.status = 500')
|
|
39363
39945
|
.operation('=@ctx.response.body')
|
|
39364
39946
|
.executeSql(
|
|
@@ -39407,7 +39989,11 @@
|
|
|
39407
39989
|
starting_after parameter and bearer token authentication
|
|
39408
39990
|
code: |-
|
|
39409
39991
|
const fn = app.addFunction
|
|
39410
|
-
.rest({
|
|
39992
|
+
.rest({
|
|
39993
|
+
functionId: 'stripe-api',
|
|
39994
|
+
method: 'GET',
|
|
39995
|
+
url: 'https://api.stripe.com/v1/customers',
|
|
39996
|
+
})
|
|
39411
39997
|
.json()
|
|
39412
39998
|
.bearerToken('=@ctx.solution.state.stripeApiKey')
|
|
39413
39999
|
fn.params.query('limit', { value: 100 })
|
|
@@ -39476,7 +40062,11 @@
|
|
|
39476
40062
|
notifications, data transformation, operations and retry logic
|
|
39477
40063
|
code: |-
|
|
39478
40064
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39479
|
-
const fn = app.addFunction.rest({
|
|
40065
|
+
const fn = app.addFunction.rest({
|
|
40066
|
+
functionId: 'comprehensive-api',
|
|
40067
|
+
method: 'GET',
|
|
40068
|
+
url: 'https://api.example.com/data',
|
|
40069
|
+
})
|
|
39480
40070
|
const errorHandler = fn
|
|
39481
40071
|
.error('=@ctx.response.status >= 500')
|
|
39482
40072
|
.title('Request Failed')
|
|
@@ -39508,7 +40098,11 @@
|
|
|
39508
40098
|
conditions and retry strategies
|
|
39509
40099
|
code: |-
|
|
39510
40100
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39511
|
-
const fn = app.addFunction.rest({
|
|
40101
|
+
const fn = app.addFunction.rest({
|
|
40102
|
+
functionId: 'api-with-errors',
|
|
40103
|
+
method: 'GET',
|
|
40104
|
+
url: 'https://api.example.com/data',
|
|
40105
|
+
})
|
|
39512
40106
|
fn.error(true).title('Default Error')
|
|
39513
40107
|
fn.error('=@ctx.response.status = 404').title('Not Found')
|
|
39514
40108
|
fn.error('=@ctx.response.status >= 500').title('Server Error').retry({ delay: 5000 })
|
|
@@ -39567,7 +40161,11 @@
|
|
|
39567
40161
|
description: Configure REST function pagination with continuation expressions
|
|
39568
40162
|
for hasNext and nextUrl
|
|
39569
40163
|
code: |-
|
|
39570
|
-
const fn = app.addFunction.rest({
|
|
40164
|
+
const fn = app.addFunction.rest({
|
|
40165
|
+
functionId: 'list-items',
|
|
40166
|
+
method: 'GET',
|
|
40167
|
+
url: 'https://api.example.com/items',
|
|
40168
|
+
})
|
|
39571
40169
|
fn.continuation.when(toExpression('=$.hasNext')).url(toExpression('=$.nextUrl'))
|
|
39572
40170
|
- id: function.rest-example-3
|
|
39573
40171
|
name: REST Function with Entity Storage and Data Conversions
|
|
@@ -39584,7 +40182,11 @@
|
|
|
39584
40182
|
from base64 to buffer and local URI
|
|
39585
40183
|
code: |-
|
|
39586
40184
|
app.addFunction
|
|
39587
|
-
.rest({
|
|
40185
|
+
.rest({
|
|
40186
|
+
functionId: 'get-products',
|
|
40187
|
+
method: 'GET',
|
|
40188
|
+
url: 'https://api.example.com/products',
|
|
40189
|
+
})
|
|
39588
40190
|
.entity('default/products')
|
|
39589
40191
|
.conversion('price', 'base64', 'buffer')
|
|
39590
40192
|
.conversion('image', 'base64', 'local-uri', 'product-image.jpg')
|
|
@@ -39684,7 +40286,12 @@
|
|
|
39684
40286
|
parameters and output transformation
|
|
39685
40287
|
code: |-
|
|
39686
40288
|
const fn = app.addFunction
|
|
39687
|
-
.soap({
|
|
40289
|
+
.soap({
|
|
40290
|
+
functionId: 'get-weather',
|
|
40291
|
+
connection: 'weather-service',
|
|
40292
|
+
method: 'GetWeather',
|
|
40293
|
+
wsdl: 'https://weather.com/wsdl',
|
|
40294
|
+
})
|
|
39688
40295
|
.outputTransform('$.Temperature')
|
|
39689
40296
|
fn.params.body('city', 'London').header('apiKey', 'secret-key')
|
|
39690
40297
|
- id: function.soap-example-2
|
|
@@ -39701,7 +40308,12 @@
|
|
|
39701
40308
|
storage for order processing
|
|
39702
40309
|
code: |-
|
|
39703
40310
|
app.addFunction
|
|
39704
|
-
.soap({
|
|
40311
|
+
.soap({
|
|
40312
|
+
functionId: 'create-order',
|
|
40313
|
+
connection: 'order-service',
|
|
40314
|
+
method: 'CreateOrder',
|
|
40315
|
+
wsdl: 'https://orders.com/wsdl',
|
|
40316
|
+
})
|
|
39705
40317
|
.inputTransform('="123"')
|
|
39706
40318
|
.entity('orders')
|
|
39707
40319
|
- id: function.soap-example-3
|
|
@@ -39719,7 +40331,12 @@
|
|
|
39719
40331
|
conversions for thumbnails and source images
|
|
39720
40332
|
code: |-
|
|
39721
40333
|
const fn = app.addFunction
|
|
39722
|
-
.soap({
|
|
40334
|
+
.soap({
|
|
40335
|
+
functionId: 'process-image',
|
|
40336
|
+
connection: 'image-service',
|
|
40337
|
+
method: 'ProcessImage',
|
|
40338
|
+
wsdl: 'https://image.com/wsdl',
|
|
40339
|
+
})
|
|
39723
40340
|
.base64ToUri('thumbnail', 'thumb.jpg')
|
|
39724
40341
|
.uriToBase64('source')
|
|
39725
40342
|
fn.params.body('image', '=@ctx.solution.state.imageData')
|
|
@@ -39738,7 +40355,12 @@
|
|
|
39738
40355
|
SOAP faults and network timeouts with retry logic
|
|
39739
40356
|
code: |-
|
|
39740
40357
|
const fn = app.addFunction
|
|
39741
|
-
.soap({
|
|
40358
|
+
.soap({
|
|
40359
|
+
functionId: 'weather-api',
|
|
40360
|
+
connection: 'weather-service',
|
|
40361
|
+
method: 'GetWeatherForecast',
|
|
40362
|
+
wsdl: 'https://weather.example.com/service?wsdl',
|
|
40363
|
+
})
|
|
39742
40364
|
.outputTransform('$.GetWeatherForecastResult')
|
|
39743
40365
|
fn.params
|
|
39744
40366
|
.body('city', '=@ctx.jig.inputs.location.city')
|
|
@@ -39775,7 +40397,8 @@
|
|
|
39775
40397
|
description: Create SQL query function for customers with boolean parameter and
|
|
39776
40398
|
entity storage
|
|
39777
40399
|
code: |-
|
|
39778
|
-
const fn = app.addFunction
|
|
40400
|
+
const fn = app.addFunction
|
|
40401
|
+
.sql({ functionId: 'get-customers', connection: 'mydb' })
|
|
39779
40402
|
.sql('SELECT * FROM customers WHERE active = @active')
|
|
39780
40403
|
fn.params.input('$active', 'boolean', { value: true })
|
|
39781
40404
|
fn.entity('customers')
|
|
@@ -39792,7 +40415,8 @@
|
|
|
39792
40415
|
description: Configure SQL function to execute stored procedure with input and
|
|
39793
40416
|
output parameters for customer updates
|
|
39794
40417
|
code: |-
|
|
39795
|
-
const fn = app.addFunction
|
|
40418
|
+
const fn = app.addFunction
|
|
40419
|
+
.sql({ functionId: 'update-customer', connection: 'mydb', method: 'execute' })
|
|
39796
40420
|
.sql('sp_UpdateCustomer', 'procedure')
|
|
39797
40421
|
fn.params
|
|
39798
40422
|
.input('$customerId', 'number', { value: 123 })
|
|
@@ -39811,7 +40435,8 @@
|
|
|
39811
40435
|
description: Generate SQL function with select helper for specific columns and
|
|
39812
40436
|
active status filter
|
|
39813
40437
|
code: |-
|
|
39814
|
-
const fn = app.addFunction
|
|
40438
|
+
const fn = app.addFunction
|
|
40439
|
+
.sql({ functionId: 'get-customers', connection: 'mydb' })
|
|
39815
40440
|
.select(['id', 'name', 'email'], 'customers', 'active = @active')
|
|
39816
40441
|
fn.params.input('active', 'boolean', { value: true })
|
|
39817
40442
|
- id: function.sql-example-4
|
|
@@ -39825,8 +40450,10 @@
|
|
|
39825
40450
|
- no-where-clause
|
|
39826
40451
|
description: Generate SQL function with select all helper to retrieve all
|
|
39827
40452
|
products without filtering
|
|
39828
|
-
code:
|
|
39829
|
-
|
|
40453
|
+
code: |-
|
|
40454
|
+
app.addFunction
|
|
40455
|
+
.sql({ functionId: 'get-all-products', connection: 'mydb' })
|
|
40456
|
+
.selectAll('products')
|
|
39830
40457
|
- id: function.sql-example-5
|
|
39831
40458
|
name: SQL Function with Select All Helper and WHERE Clause Filter
|
|
39832
40459
|
category: function
|
|
@@ -39840,7 +40467,8 @@
|
|
|
39840
40467
|
description: Generate SQL function with select all helper and status parameter
|
|
39841
40468
|
for active product filtering
|
|
39842
40469
|
code: |-
|
|
39843
|
-
const fn = app.addFunction
|
|
40470
|
+
const fn = app.addFunction
|
|
40471
|
+
.sql({ functionId: 'get-active-products', connection: 'mydb' })
|
|
39844
40472
|
.selectAll('products', 'status = @status')
|
|
39845
40473
|
fn.params.input('status', 'string', { value: 'active' })
|
|
39846
40474
|
- id: function.sql-example-6
|
|
@@ -39858,7 +40486,8 @@
|
|
|
39858
40486
|
description: Configure SQL order sync function with comprehensive database error
|
|
39859
40487
|
handling including constraint violations, lock errors and retry logic
|
|
39860
40488
|
code: |-
|
|
39861
|
-
const fn = app.addFunction
|
|
40489
|
+
const fn = app.addFunction
|
|
40490
|
+
.sql({ functionId: 'sync-orders', connection: 'orders_db' })
|
|
39862
40491
|
.sql(
|
|
39863
40492
|
'INSERT INTO orders (id, customer_id, total, status) VALUES (@id, @customer_id, @total, @status)',
|
|
39864
40493
|
)
|
|
@@ -39922,7 +40551,11 @@
|
|
|
39922
40551
|
description: Configure REST function header using branded ParameterName type
|
|
39923
40552
|
code: |-
|
|
39924
40553
|
const paramName = toParameterName('apiKey')
|
|
39925
|
-
const builder = app.addFunction.rest({
|
|
40554
|
+
const builder = app.addFunction.rest({
|
|
40555
|
+
functionId: 'test',
|
|
40556
|
+
method: 'GET',
|
|
40557
|
+
url: 'https://api.test.com',
|
|
40558
|
+
})
|
|
39926
40559
|
// Should not throw with valid parameter name
|
|
39927
40560
|
builder.params.header(paramName, 'secret')
|
|
39928
40561
|
- id: function-example-3
|
|
@@ -39943,7 +40576,11 @@
|
|
|
39943
40576
|
dependencies, and continuation support using config object
|
|
39944
40577
|
code: |-
|
|
39945
40578
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39946
|
-
const fn = app.addFunction.rest({
|
|
40579
|
+
const fn = app.addFunction.rest({
|
|
40580
|
+
functionId: 'config-query',
|
|
40581
|
+
method: 'GET',
|
|
40582
|
+
url: 'https://api.test.com',
|
|
40583
|
+
})
|
|
39947
40584
|
fn.query('items', {
|
|
39948
40585
|
statement: 'SELECT * FROM items WHERE active = 1',
|
|
39949
40586
|
resultType: 'records',
|
|
@@ -39967,7 +40604,11 @@
|
|
|
39967
40604
|
and scalar/record result type
|
|
39968
40605
|
code: |-
|
|
39969
40606
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39970
|
-
const fn = app.addFunction.rest({
|
|
40607
|
+
const fn = app.addFunction.rest({
|
|
40608
|
+
functionId: 'param-config-query',
|
|
40609
|
+
method: 'GET',
|
|
40610
|
+
url: 'https://api.test.com',
|
|
40611
|
+
})
|
|
39971
40612
|
fn.query('lookup', {
|
|
39972
40613
|
statement: 'SELECT * FROM items WHERE id = @id',
|
|
39973
40614
|
parameters: { id: '=@ctx.user.id' },
|
|
@@ -39984,7 +40625,11 @@
|
|
|
39984
40625
|
description: Set output expression to control what the function returns to its caller
|
|
39985
40626
|
code: |-
|
|
39986
40627
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39987
|
-
const fn = app.addFunction.rest({
|
|
40628
|
+
const fn = app.addFunction.rest({
|
|
40629
|
+
functionId: 'output-fn',
|
|
40630
|
+
method: 'GET',
|
|
40631
|
+
url: 'https://api.test.com',
|
|
40632
|
+
})
|
|
39988
40633
|
fn.output('=@ctx.response.body.result')
|
|
39989
40634
|
- id: screen.bottom-sheet-example-1
|
|
39990
40635
|
name: Bottom Sheet with Child Screens
|
|
@@ -40643,7 +41288,7 @@
|
|
|
40643
41288
|
template component
|
|
40644
41289
|
code: |-
|
|
40645
41290
|
const dynamicGridScreen = app.addScreen
|
|
40646
|
-
.dynamicGrid({ screenId: 'grid-1', title: 'Dynamic Grid'
|
|
41291
|
+
.dynamicGrid({ screenId: 'grid-1', title: 'Dynamic Grid' })
|
|
40647
41292
|
.data('=@ctx.datasources.dynamic')
|
|
40648
41293
|
// Add required item template
|
|
40649
41294
|
dynamicGridScreen.addControl.gridItem({ instanceId: 'item-1', size: '1x1' })
|
|
@@ -40663,7 +41308,7 @@
|
|
|
40663
41308
|
subtitle for dynamic content
|
|
40664
41309
|
code: |-
|
|
40665
41310
|
const dynamicGridWithWidget = app.addScreen
|
|
40666
|
-
.dynamicGrid({ screenId: 'dynamic-widget-test', title: 'Widget Test'
|
|
41311
|
+
.dynamicGrid({ screenId: 'dynamic-widget-test', title: 'Widget Test' })
|
|
40667
41312
|
.data('=@ctx.datasources.items') // Add required data
|
|
40668
41313
|
// Add required item template
|
|
40669
41314
|
dynamicGridWithWidget.addControl.gridItem({ instanceId: 'item-1', size: '1x1' })
|
|
@@ -40685,7 +41330,7 @@
|
|
|
40685
41330
|
data-bound items
|
|
40686
41331
|
code: |-
|
|
40687
41332
|
const screen = app.addScreen
|
|
40688
|
-
.dynamicGrid({ screenId: 'dynamic-item-test', title: 'Item Test'
|
|
41333
|
+
.dynamicGrid({ screenId: 'dynamic-item-test', title: 'Item Test' })
|
|
40689
41334
|
.data('=@ctx.datasources.items') // Add required data
|
|
40690
41335
|
screen.addControl.gridItem()
|
|
40691
41336
|
- id: screen.grid-dynamic-example-4
|
|
@@ -40703,7 +41348,7 @@
|
|
|
40703
41348
|
line chart series data
|
|
40704
41349
|
code: |-
|
|
40705
41350
|
const dynamicGridWithChart = app.addScreen
|
|
40706
|
-
.dynamicGrid({ screenId: 'dg', title: 'Dynamic Grid'
|
|
41351
|
+
.dynamicGrid({ screenId: 'dg', title: 'Dynamic Grid' })
|
|
40707
41352
|
.data('=@ctx.datasources.items') // Add required data
|
|
40708
41353
|
// Add item template and widget
|
|
40709
41354
|
dynamicGridWithChart.addControl.gridItem()
|
|
@@ -41579,7 +42224,7 @@
|
|
|
41579
42224
|
from solution state
|
|
41580
42225
|
code: |-
|
|
41581
42226
|
const gridWithDynamicSummary = app.addScreen
|
|
41582
|
-
.dynamicGrid({ screenId: 'dynamic-summary-test', title: 'Dynamic Summary'
|
|
42227
|
+
.dynamicGrid({ screenId: 'dynamic-summary-test', title: 'Dynamic Summary' })
|
|
41583
42228
|
.data('=@ctx.datasources.items')
|
|
41584
42229
|
gridWithDynamicSummary.addControl.gridItem({ size: '1x1' })
|
|
41585
42230
|
gridWithDynamicSummary.summary().addControl.default({
|
|
@@ -42023,7 +42668,9 @@
|
|
|
42023
42668
|
concurrency: 'parallel',
|
|
42024
42669
|
instanceId: 'load-data',
|
|
42025
42670
|
})
|
|
42026
|
-
const ds = screen.addDatasource
|
|
42671
|
+
const ds = screen.addDatasource
|
|
42672
|
+
.sqlite({ datasourceId: 'preferences', provider: 'local' })
|
|
42673
|
+
.entity('default/notifications')
|
|
42027
42674
|
onFocusAction.actions
|
|
42028
42675
|
.executeEntity({ instanceId: 'load-notifications' })
|
|
42029
42676
|
.dynamicData('default/notifications', 'update')
|
|
@@ -42690,7 +43337,11 @@
|
|
|
42690
43337
|
productPreview.title('Product Showcase')
|
|
42691
43338
|
productPreview.subtitle('Browse our product collection')
|
|
42692
43339
|
const productEntity = productPreview.addControl.entity({ instanceId: 'product-preview' })
|
|
42693
|
-
productEntity.addControl.entityField({
|
|
43340
|
+
productEntity.addControl.entityField({
|
|
43341
|
+
instanceId: 'name',
|
|
43342
|
+
label: 'Product Name',
|
|
43343
|
+
value: 'Premium Widget',
|
|
43344
|
+
})
|
|
42694
43345
|
productEntity.addControl.entityField({ instanceId: 'price', label: 'Price', value: '$99.99' })
|
|
42695
43346
|
// Dashboard screen with compact preview
|
|
42696
43347
|
const dashboard = app.addScreen.default({
|
|
@@ -44329,7 +44980,14 @@
|
|
|
44329
44980
|
instanceId: 'office-marker',
|
|
44330
44981
|
address: '=@ctx.current.item.address',
|
|
44331
44982
|
})
|
|
44332
|
-
officeMarker.with({
|
|
44983
|
+
officeMarker.with({
|
|
44984
|
+
radius: {
|
|
44985
|
+
value: 0.5,
|
|
44986
|
+
unit: 'kilometers',
|
|
44987
|
+
color: 'primary',
|
|
44988
|
+
isEnabled: '=@ctx.current.item.showCoverage',
|
|
44989
|
+
},
|
|
44990
|
+
})
|
|
44333
44991
|
officeMarker.addIcon({ icon: 'office-building-tall-1', color: 'info' })
|
|
44334
44992
|
// Create grid to display widgets (custom/static mode for map dashboard)
|
|
44335
44993
|
const staticGrid = screen.addControl.grid()
|