@jigx/core-sdk 1.2.0-next.2 → 1.2.0-next.20
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.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 +1103 -438
- 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
|
|
@@ -20487,8 +20620,10 @@
|
|
|
20487
20620
|
categorization and metadata
|
|
20488
20621
|
code: |-
|
|
20489
20622
|
// Basic application setup with metadata
|
|
20490
|
-
const customerApp = new ApplicationBuilder({
|
|
20491
|
-
|
|
20623
|
+
const customerApp = new ApplicationBuilder({
|
|
20624
|
+
name: 'customer-management',
|
|
20625
|
+
title: 'Customer Management',
|
|
20626
|
+
}).with({ category: 'business', description: 'Complete CRM solution for field sales teams' })
|
|
20492
20627
|
// Configure database tables for offline storage
|
|
20493
20628
|
customerApp.addDatabase.default
|
|
20494
20629
|
.table('customers', 'orders', 'products')
|
|
@@ -20573,8 +20708,10 @@
|
|
|
20573
20708
|
action: 'sync-customers',
|
|
20574
20709
|
})
|
|
20575
20710
|
// E-commerce application example
|
|
20576
|
-
const ecommerceApp = new ApplicationBuilder({
|
|
20577
|
-
|
|
20711
|
+
const ecommerceApp = new ApplicationBuilder({
|
|
20712
|
+
name: 'mobile-store',
|
|
20713
|
+
title: 'Mobile Store',
|
|
20714
|
+
}).with({ category: 'sales', description: 'Mobile shopping application with product catalog' })
|
|
20578
20715
|
// Product catalog database
|
|
20579
20716
|
ecommerceApp.addDatabase.default
|
|
20580
20717
|
.table('products', 'categories', 'cart')
|
|
@@ -20636,8 +20773,9 @@
|
|
|
20636
20773
|
application state. Use CTX helpers for building expressions with proper
|
|
20637
20774
|
syntax and validation
|
|
20638
20775
|
code: |-
|
|
20639
|
-
const contextApp = new ApplicationBuilder({ name: 'context-demo', title: 'Context Demo' })
|
|
20640
|
-
|
|
20776
|
+
const contextApp = new ApplicationBuilder({ name: 'context-demo', title: 'Context Demo' }).with(
|
|
20777
|
+
{ category: 'business', description: 'Demonstrates context and state management patterns' },
|
|
20778
|
+
)
|
|
20641
20779
|
// Setup application state and expressions
|
|
20642
20780
|
contextApp.expression('userRole', '=@ctx.solution.state.userRole')
|
|
20643
20781
|
contextApp.expression('isLoggedIn', '=@ctx.solution.state.isLoggedIn')
|
|
@@ -20655,11 +20793,14 @@
|
|
|
20655
20793
|
.query(
|
|
20656
20794
|
"SELECT id, json_extract(data, '$.message') AS message, json_extract(data, '$.read') AS read FROM [default/notifications]",
|
|
20657
20795
|
)
|
|
20658
|
-
contextApp.addDatasource.static({
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
20796
|
+
contextApp.addDatasource.static({
|
|
20797
|
+
datasourceId: 'settings',
|
|
20798
|
+
data: [
|
|
20799
|
+
{ key: 'theme', value: 'dark' },
|
|
20800
|
+
{ key: 'language', value: 'en' },
|
|
20801
|
+
{ key: 'notifications', value: true },
|
|
20802
|
+
],
|
|
20803
|
+
})
|
|
20663
20804
|
// Create screens that demonstrate context usage
|
|
20664
20805
|
const dashboard = contextApp.addScreen.default({
|
|
20665
20806
|
screenId: 'dashboard',
|
|
@@ -20709,7 +20850,10 @@
|
|
|
20709
20850
|
value: '=@ctx.datasources.settings[key = "language"].value',
|
|
20710
20851
|
})
|
|
20711
20852
|
// Advanced context usage examples
|
|
20712
|
-
const advancedApp = new ApplicationBuilder({
|
|
20853
|
+
const advancedApp = new ApplicationBuilder({
|
|
20854
|
+
name: 'advanced-context',
|
|
20855
|
+
title: 'Advanced Context',
|
|
20856
|
+
}).with({ category: 'analytics' })
|
|
20713
20857
|
// Complex expression using multiple context sources
|
|
20714
20858
|
advancedApp.expression(
|
|
20715
20859
|
'userStatus',
|
|
@@ -20724,7 +20868,11 @@
|
|
|
20724
20868
|
']',
|
|
20725
20869
|
)
|
|
20726
20870
|
// Function call with context parameters
|
|
20727
|
-
advancedApp.addFunction.rest({
|
|
20871
|
+
advancedApp.addFunction.rest({
|
|
20872
|
+
functionId: 'user-data',
|
|
20873
|
+
method: 'GET',
|
|
20874
|
+
url: 'https://api.example.com/users',
|
|
20875
|
+
})
|
|
20728
20876
|
advancedApp.expression('userData', '=@ctx.datasources.userData')
|
|
20729
20877
|
// Screen with complex state management
|
|
20730
20878
|
const analyticsScreen = advancedApp.addScreen.default({
|
|
@@ -20765,15 +20913,20 @@
|
|
|
20765
20913
|
visibility
|
|
20766
20914
|
code: |-
|
|
20767
20915
|
// Basic tab navigation setup
|
|
20768
|
-
const businessApp = new ApplicationBuilder({
|
|
20769
|
-
|
|
20916
|
+
const businessApp = new ApplicationBuilder({
|
|
20917
|
+
name: 'business-dashboard',
|
|
20918
|
+
title: 'Business Dashboard',
|
|
20919
|
+
}).with({ category: 'business', description: 'Complete business management application' })
|
|
20770
20920
|
// Core navigation tabs with icons and labels
|
|
20771
20921
|
businessApp.addTab({ screenId: 'home', icon: 'home', label: 'Dashboard' })
|
|
20772
20922
|
businessApp.addTab({ screenId: 'customers', icon: 'multiple-users-3', label: 'Customers' })
|
|
20773
20923
|
businessApp.addTab({ screenId: 'orders', icon: 'shopping-cart', label: 'Orders' })
|
|
20774
20924
|
businessApp.addTab({ screenId: 'reports', icon: 'analytics-graph-bar', label: 'Reports' })
|
|
20775
20925
|
// Advanced tab configuration with badges and conditions
|
|
20776
|
-
const messagingApp = new ApplicationBuilder({
|
|
20926
|
+
const messagingApp = new ApplicationBuilder({
|
|
20927
|
+
name: 'team-messenger',
|
|
20928
|
+
title: 'Team Messenger',
|
|
20929
|
+
}).with({ category: 'communications' })
|
|
20777
20930
|
// Message tab with unread count badge
|
|
20778
20931
|
messagingApp.addTab({
|
|
20779
20932
|
screenId: 'messages',
|
|
@@ -20798,7 +20951,9 @@
|
|
|
20798
20951
|
when: '=@ctx.solution.state.user.role = "admin"',
|
|
20799
20952
|
})
|
|
20800
20953
|
// E-commerce app with dynamic badges
|
|
20801
|
-
const shopApp = new ApplicationBuilder({ name: 'mobile-shop', title: 'Mobile Shop' }).with({
|
|
20954
|
+
const shopApp = new ApplicationBuilder({ name: 'mobile-shop', title: 'Mobile Shop' }).with({
|
|
20955
|
+
category: 'sales',
|
|
20956
|
+
})
|
|
20802
20957
|
// Product catalog tab
|
|
20803
20958
|
shopApp.addTab({ screenId: 'catalog', icon: 'grid-layout-module-1', label: 'Products' })
|
|
20804
20959
|
// Shopping cart with item count
|
|
@@ -20820,7 +20975,9 @@
|
|
|
20820
20975
|
// Account tab
|
|
20821
20976
|
shopApp.addTab({ screenId: 'account', icon: 'single-man-circle', label: 'Account' })
|
|
20822
20977
|
// Field service app with status-based badges
|
|
20823
|
-
const fieldApp = new ApplicationBuilder({ name: 'field-service', title: 'Field Service' }).with(
|
|
20978
|
+
const fieldApp = new ApplicationBuilder({ name: 'field-service', title: 'Field Service' }).with(
|
|
20979
|
+
{ category: 'field-services' },
|
|
20980
|
+
)
|
|
20824
20981
|
// Tasks tab with priority count
|
|
20825
20982
|
fieldApp.addTab({
|
|
20826
20983
|
screenId: 'tasks',
|
|
@@ -20950,7 +21107,10 @@
|
|
|
20950
21107
|
- category
|
|
20951
21108
|
- description
|
|
20952
21109
|
description: Create basic business application with title, category, and description
|
|
20953
|
-
code:
|
|
21110
|
+
code: |2-
|
|
21111
|
+
category: 'business',
|
|
21112
|
+
description: 'A test application',
|
|
21113
|
+
})
|
|
20954
21114
|
- id: application-example-2
|
|
20955
21115
|
name: Application with Tab Navigation Configuration
|
|
20956
21116
|
category: application
|
|
@@ -21009,7 +21169,10 @@
|
|
|
21009
21169
|
description: Build complete application with database tables, SQLite datasource,
|
|
21010
21170
|
and REST function
|
|
21011
21171
|
code: |-
|
|
21012
|
-
const app: ApplicationBuilder = new ApplicationBuilder({
|
|
21172
|
+
const app: ApplicationBuilder = new ApplicationBuilder({
|
|
21173
|
+
name: 'complete-app',
|
|
21174
|
+
title: 'Complete App',
|
|
21175
|
+
})
|
|
21013
21176
|
// Use the application's bound factories
|
|
21014
21177
|
app.addDatabase.default.table('users').table('orders')
|
|
21015
21178
|
app.addDatasource
|
|
@@ -21048,8 +21211,12 @@
|
|
|
21048
21211
|
- build
|
|
21049
21212
|
- properties
|
|
21050
21213
|
description: Create application with description property for app metadata
|
|
21051
|
-
code:
|
|
21052
|
-
|
|
21214
|
+
code: |-
|
|
21215
|
+
const app = new ApplicationBuilder({
|
|
21216
|
+
name: 'descriptive-app',
|
|
21217
|
+
title: 'Descriptive App',
|
|
21218
|
+
description: 'App with detailed description',
|
|
21219
|
+
})
|
|
21053
21220
|
- id: component.jc.left-right.element-1
|
|
21054
21221
|
name: Left-Side Element Components
|
|
21055
21222
|
category: component
|
|
@@ -23174,11 +23341,14 @@
|
|
|
23174
23341
|
.title('=@ctx.current.item.name')
|
|
23175
23342
|
.value('=@ctx.current.item.id')
|
|
23176
23343
|
// 2. Choice field with static datasource
|
|
23177
|
-
app.addDatasource.static({
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
|
|
23344
|
+
app.addDatasource.static({
|
|
23345
|
+
datasourceId: 'task-priorities',
|
|
23346
|
+
data: [
|
|
23347
|
+
{ id: 'low', name: 'Low Priority', color: 'green' },
|
|
23348
|
+
{ id: 'medium', name: 'Medium Priority', color: 'yellow' },
|
|
23349
|
+
{ id: 'high', name: 'High Priority', color: 'red' },
|
|
23350
|
+
],
|
|
23351
|
+
})
|
|
23182
23352
|
const priorityForm = screen.addControl.form({ instanceId: 'priority-form' })
|
|
23183
23353
|
const priorityChoice = priorityForm.addControl.choiceField({
|
|
23184
23354
|
instanceId: 'priority-field',
|
|
@@ -23378,27 +23548,30 @@
|
|
|
23378
23548
|
})
|
|
23379
23549
|
// 1. Payment method selector (single choice with icons)
|
|
23380
23550
|
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
|
-
|
|
23551
|
+
app.addDatasource.static({
|
|
23552
|
+
datasourceId: 'payment-methods',
|
|
23553
|
+
data: [
|
|
23554
|
+
{
|
|
23555
|
+
id: 'credit',
|
|
23556
|
+
name: 'Credit Card',
|
|
23557
|
+
icon: 'credit-card',
|
|
23558
|
+
description: 'Visa, MasterCard, Amex',
|
|
23559
|
+
},
|
|
23560
|
+
{
|
|
23561
|
+
id: 'debit',
|
|
23562
|
+
name: 'Debit Card',
|
|
23563
|
+
icon: 'credit-card-payment',
|
|
23564
|
+
description: 'Direct bank payment',
|
|
23565
|
+
},
|
|
23566
|
+
{
|
|
23567
|
+
id: 'paypal',
|
|
23568
|
+
name: 'PayPal',
|
|
23569
|
+
icon: 'payment-paypal-logo',
|
|
23570
|
+
description: 'PayPal account',
|
|
23571
|
+
},
|
|
23572
|
+
{ id: 'apple', name: 'Apple Pay', icon: 'apple', description: 'Touch ID payment' },
|
|
23573
|
+
],
|
|
23574
|
+
})
|
|
23402
23575
|
const paymentMethod = paymentForm.addControl.choiceField({
|
|
23403
23576
|
instanceId: 'payment-method',
|
|
23404
23577
|
label: 'Payment Method',
|
|
@@ -23452,13 +23625,16 @@
|
|
|
23452
23625
|
})
|
|
23453
23626
|
// 3. Size selection with custom layout
|
|
23454
23627
|
const sizeForm = screen.addControl.form({ instanceId: 'sizing' })
|
|
23455
|
-
app.addDatasource.static({
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23628
|
+
app.addDatasource.static({
|
|
23629
|
+
datasourceId: 'sizes',
|
|
23630
|
+
data: [
|
|
23631
|
+
{ code: 'XS', label: 'Extra Small', available: true },
|
|
23632
|
+
{ code: 'S', label: 'Small', available: true },
|
|
23633
|
+
{ code: 'M', label: 'Medium', available: true },
|
|
23634
|
+
{ code: 'L', label: 'Large', available: false },
|
|
23635
|
+
{ code: 'XL', label: 'Extra Large', available: true },
|
|
23636
|
+
],
|
|
23637
|
+
})
|
|
23462
23638
|
const sizeChoice = sizeForm.addControl.choiceField({
|
|
23463
23639
|
instanceId: 'size',
|
|
23464
23640
|
label: 'Size',
|
|
@@ -23515,12 +23691,15 @@
|
|
|
23515
23691
|
eligibilityCheck: true,
|
|
23516
23692
|
})
|
|
23517
23693
|
// Priority level with business constraints
|
|
23518
|
-
app.addDatasource.static({
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
|
|
23523
|
-
|
|
23694
|
+
app.addDatasource.static({
|
|
23695
|
+
datasourceId: 'priority-levels',
|
|
23696
|
+
data: [
|
|
23697
|
+
{ level: 'low', name: 'Low Priority', cost: 0 },
|
|
23698
|
+
{ level: 'normal', name: 'Normal Priority', cost: 10 },
|
|
23699
|
+
{ level: 'high', name: 'High Priority', cost: 25 },
|
|
23700
|
+
{ level: 'urgent', name: 'Urgent Priority', cost: 50 },
|
|
23701
|
+
],
|
|
23702
|
+
})
|
|
23524
23703
|
const priorityChoice = planForm.addControl.choiceField({
|
|
23525
23704
|
instanceId: 'priority-level',
|
|
23526
23705
|
label: 'Priority Level',
|
|
@@ -23608,13 +23787,16 @@
|
|
|
23608
23787
|
.title('=@ctx.current.item.name')
|
|
23609
23788
|
.value('=@ctx.current.item.id')
|
|
23610
23789
|
// Survey question with conditional follow-up
|
|
23611
|
-
app.addDatasource.static({
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23790
|
+
app.addDatasource.static({
|
|
23791
|
+
datasourceId: 'satisfaction-ratings',
|
|
23792
|
+
data: [
|
|
23793
|
+
{ rating: 1, label: 'Very Dissatisfied', followUp: true },
|
|
23794
|
+
{ rating: 2, label: 'Dissatisfied', followUp: true },
|
|
23795
|
+
{ rating: 3, label: 'Neutral', followUp: false },
|
|
23796
|
+
{ rating: 4, label: 'Satisfied', followUp: false },
|
|
23797
|
+
{ rating: 5, label: 'Very Satisfied', followUp: false },
|
|
23798
|
+
],
|
|
23799
|
+
})
|
|
23618
23800
|
const surveyChoice = configForm.addControl.choiceField({
|
|
23619
23801
|
instanceId: 'satisfaction',
|
|
23620
23802
|
label: 'How satisfied are you with our service?',
|
|
@@ -23629,12 +23811,15 @@
|
|
|
23629
23811
|
.title('=@ctx.current.item.label')
|
|
23630
23812
|
.value('=@ctx.current.item.rating')
|
|
23631
23813
|
// Accessibility preferences
|
|
23632
|
-
app.addDatasource.static({
|
|
23633
|
-
|
|
23634
|
-
|
|
23635
|
-
|
|
23636
|
-
|
|
23637
|
-
|
|
23814
|
+
app.addDatasource.static({
|
|
23815
|
+
datasourceId: 'accessibility-features',
|
|
23816
|
+
data: [
|
|
23817
|
+
{ feature: 'high-contrast', name: 'High Contrast Mode' },
|
|
23818
|
+
{ feature: 'large-text', name: 'Large Text' },
|
|
23819
|
+
{ feature: 'screen-reader', name: 'Screen Reader Support' },
|
|
23820
|
+
{ feature: 'reduced-motion', name: 'Reduced Motion' },
|
|
23821
|
+
],
|
|
23822
|
+
})
|
|
23638
23823
|
const accessibilityChoice = configForm.addControl.choiceField({
|
|
23639
23824
|
instanceId: 'accessibility',
|
|
23640
23825
|
isMultiple: true,
|
|
@@ -24563,11 +24748,14 @@
|
|
|
24563
24748
|
.subtitle('=@ctx.current.item.description')
|
|
24564
24749
|
// 2. Dropdown with icon elements
|
|
24565
24750
|
const priorityForm = screen.addControl.form({ instanceId: 'priority-form' })
|
|
24566
|
-
app.addDatasource.static({
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24751
|
+
app.addDatasource.static({
|
|
24752
|
+
datasourceId: 'task-priorities',
|
|
24753
|
+
data: [
|
|
24754
|
+
{ id: 'low', name: 'Low Priority', icon: 'arrow-down', color: 'green' },
|
|
24755
|
+
{ id: 'medium', name: 'Medium Priority', icon: 'minus', color: 'yellow' },
|
|
24756
|
+
{ id: 'high', name: 'High Priority', icon: 'arrow-up', color: 'red' },
|
|
24757
|
+
],
|
|
24758
|
+
})
|
|
24571
24759
|
const priorityDropdown = priorityForm.addControl.dropdown({
|
|
24572
24760
|
instanceId: 'priority-dropdown',
|
|
24573
24761
|
label: 'Task Priority',
|
|
@@ -24873,12 +25061,15 @@
|
|
|
24873
25061
|
// Icon with color coding for skill category
|
|
24874
25062
|
.leftElement.icon('=@ctx.current.item.categoryIcon')
|
|
24875
25063
|
// 3. Project priority with static datasource and time estimates
|
|
24876
|
-
app.addDatasource.static({
|
|
24877
|
-
|
|
24878
|
-
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
25064
|
+
app.addDatasource.static({
|
|
25065
|
+
datasourceId: 'project-priorities',
|
|
25066
|
+
data: [
|
|
25067
|
+
{ id: 'urgent', display: 'Urgent', sla: '2 hours', color: 'negative', impact: 'critical' },
|
|
25068
|
+
{ id: 'high', display: 'High Priority', sla: '1 day', color: 'warning', impact: 'major' },
|
|
25069
|
+
{ id: 'normal', display: 'Normal', sla: '3 days', color: 'primary', impact: 'moderate' },
|
|
25070
|
+
{ id: 'low', display: 'Low Priority', sla: '1 week', color: 'neutral', impact: 'minor' },
|
|
25071
|
+
],
|
|
25072
|
+
})
|
|
24882
25073
|
const priorityDropdown = form.addControl.dropdown({
|
|
24883
25074
|
instanceId: 'priority',
|
|
24884
25075
|
isRequired: true,
|
|
@@ -24962,11 +25153,14 @@
|
|
|
24962
25153
|
screenId: 'dropdown-test',
|
|
24963
25154
|
title: 'Dropdown Test',
|
|
24964
25155
|
})
|
|
24965
|
-
app.addDatasource.static({
|
|
24966
|
-
|
|
24967
|
-
|
|
24968
|
-
|
|
24969
|
-
|
|
25156
|
+
app.addDatasource.static({
|
|
25157
|
+
datasourceId: 'test-options',
|
|
25158
|
+
data: [
|
|
25159
|
+
{ title: 'Option 1', value: 'option1' },
|
|
25160
|
+
{ title: 'Option 2', value: 'option2' },
|
|
25161
|
+
{ title: 'Option 3', value: 'option3' },
|
|
25162
|
+
],
|
|
25163
|
+
})
|
|
24970
25164
|
const dropdown = form.addControl.dropdown({
|
|
24971
25165
|
instanceId: 'test-dropdown',
|
|
24972
25166
|
isMultiple: true,
|
|
@@ -25030,10 +25224,13 @@
|
|
|
25030
25224
|
screenId: 'inline-test',
|
|
25031
25225
|
title: 'Inline Test',
|
|
25032
25226
|
})
|
|
25033
|
-
app.addDatasource.static({
|
|
25034
|
-
|
|
25035
|
-
|
|
25036
|
-
|
|
25227
|
+
app.addDatasource.static({
|
|
25228
|
+
datasourceId: 'inline-options',
|
|
25229
|
+
data: [
|
|
25230
|
+
{ id: 1, name: 'Option 1', active: true },
|
|
25231
|
+
{ id: 2, name: 'Option 2', active: false },
|
|
25232
|
+
],
|
|
25233
|
+
})
|
|
25037
25234
|
const inlineDropdown = form.addControl.dropdown({
|
|
25038
25235
|
instanceId: 'inline',
|
|
25039
25236
|
when: '=@ctx.solution.state.canSelect',
|
|
@@ -25643,7 +25840,11 @@
|
|
|
25643
25840
|
const statusSection = screen.addControl.section({ instanceId: 'system-status' })
|
|
25644
25841
|
const statusEntity = statusSection.addControl.entity({ instanceId: 'status-entity' })
|
|
25645
25842
|
statusEntity.addControl
|
|
25646
|
-
.entityField({
|
|
25843
|
+
.entityField({
|
|
25844
|
+
instanceId: 'server-status',
|
|
25845
|
+
label: 'Server Status',
|
|
25846
|
+
value: '=@ctx.jig.inputs.status',
|
|
25847
|
+
})
|
|
25647
25848
|
.with({
|
|
25648
25849
|
style: {
|
|
25649
25850
|
isPositive: '=@ctx.jig.inputs.status = "Online"',
|
|
@@ -25755,7 +25956,10 @@
|
|
|
25755
25956
|
label: 'Total Revenue',
|
|
25756
25957
|
value: '="$" & $string(@ctx.jig.inputs.totalRevenue)',
|
|
25757
25958
|
})
|
|
25758
|
-
.with({
|
|
25959
|
+
.with({
|
|
25960
|
+
style: { isPrimary: true, isPositive: '=@ctx.jig.inputs.revenueGrowth > 0' },
|
|
25961
|
+
rightIcon: 'arrow-up',
|
|
25962
|
+
})
|
|
25759
25963
|
financialEntity.addControl.entityField({
|
|
25760
25964
|
instanceId: 'profit-margin',
|
|
25761
25965
|
label: 'Profit Margin',
|
|
@@ -25908,7 +26112,11 @@
|
|
|
25908
26112
|
rightIcon: 'hash',
|
|
25909
26113
|
})
|
|
25910
26114
|
productEntity.addControl
|
|
25911
|
-
.entityField({
|
|
26115
|
+
.entityField({
|
|
26116
|
+
instanceId: 'price',
|
|
26117
|
+
label: 'Price',
|
|
26118
|
+
value: '="$" & @ctx.entity.product.price',
|
|
26119
|
+
})
|
|
25912
26120
|
.with({ style: { isPositive: '=@ctx.entity.product.onSale' }, rightIcon: 'money-atm' })
|
|
25913
26121
|
productEntity.addControl.entityField({
|
|
25914
26122
|
instanceId: 'availability',
|
|
@@ -26038,7 +26246,8 @@
|
|
|
26038
26246
|
value: '=@ctx.entity.device.batteryLevel & "%"',
|
|
26039
26247
|
style: {
|
|
26040
26248
|
isPositive: '=@ctx.entity.device.batteryLevel > 50',
|
|
26041
|
-
isWarning:
|
|
26249
|
+
isWarning:
|
|
26250
|
+
'=@ctx.entity.device.batteryLevel > 20 and @ctx.entity.device.batteryLevel <= 50',
|
|
26042
26251
|
isNegative: '=@ctx.entity.device.batteryLevel <= 20',
|
|
26043
26252
|
},
|
|
26044
26253
|
rightIcon: 'battery-full',
|
|
@@ -26119,7 +26328,8 @@
|
|
|
26119
26328
|
value: '=@ctx.entity.customer.healthScore & "/100"',
|
|
26120
26329
|
style: {
|
|
26121
26330
|
isPositive: '=@ctx.entity.customer.healthScore >= 80',
|
|
26122
|
-
isWarning:
|
|
26331
|
+
isWarning:
|
|
26332
|
+
'=@ctx.entity.customer.healthScore >= 60 and @ctx.entity.customer.healthScore < 80',
|
|
26123
26333
|
isNegative: '=@ctx.entity.customer.healthScore < 60',
|
|
26124
26334
|
},
|
|
26125
26335
|
rightIcon: 'gift-heart',
|
|
@@ -26890,12 +27100,10 @@
|
|
|
26890
27100
|
value: '=@ctx.jig.state.price',
|
|
26891
27101
|
format: { numberStyle: 'currency', currency: 'USD' },
|
|
26892
27102
|
})
|
|
26893
|
-
app.addDatasource.static({
|
|
26894
|
-
|
|
26895
|
-
{ name: 'Clothing' },
|
|
26896
|
-
|
|
26897
|
-
{ name: 'Home' },
|
|
26898
|
-
] })
|
|
27103
|
+
app.addDatasource.static({
|
|
27104
|
+
datasourceId: 'product-categories',
|
|
27105
|
+
data: [{ name: 'Electronics' }, { name: 'Clothing' }, { name: 'Books' }, { name: 'Home' }],
|
|
27106
|
+
})
|
|
26899
27107
|
productRow.addControl
|
|
26900
27108
|
.dropdown({
|
|
26901
27109
|
instanceId: 'category',
|
|
@@ -27084,11 +27292,14 @@
|
|
|
27084
27292
|
const settingsForm = screen.addControl.form({ instanceId: 'app-settings' })
|
|
27085
27293
|
const appearanceSection = settingsForm.addControl.section({ instanceId: 'appearance' })
|
|
27086
27294
|
appearanceSection.title('Appearance')
|
|
27087
|
-
app.addDatasource.static({
|
|
27088
|
-
|
|
27089
|
-
|
|
27090
|
-
|
|
27091
|
-
|
|
27295
|
+
app.addDatasource.static({
|
|
27296
|
+
datasourceId: 'themes',
|
|
27297
|
+
data: [
|
|
27298
|
+
{ label: 'Light', value: 'light' },
|
|
27299
|
+
{ label: 'Dark', value: 'dark' },
|
|
27300
|
+
{ label: 'Auto', value: 'auto' },
|
|
27301
|
+
],
|
|
27302
|
+
})
|
|
27092
27303
|
const themeDropdown = appearanceSection.addControl.dropdown({
|
|
27093
27304
|
instanceId: 'theme',
|
|
27094
27305
|
label: 'Theme',
|
|
@@ -27147,12 +27358,15 @@
|
|
|
27147
27358
|
errorText: 'Please enter a valid email address',
|
|
27148
27359
|
})
|
|
27149
27360
|
// Dropdown with validation
|
|
27150
|
-
app.addDatasource.static({
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
|
|
27154
|
-
|
|
27155
|
-
|
|
27361
|
+
app.addDatasource.static({
|
|
27362
|
+
datasourceId: 'priorities',
|
|
27363
|
+
data: [
|
|
27364
|
+
{ label: 'Low', value: 'low' },
|
|
27365
|
+
{ label: 'Normal', value: 'normal' },
|
|
27366
|
+
{ label: 'High', value: 'high' },
|
|
27367
|
+
{ label: 'Urgent', value: 'urgent' },
|
|
27368
|
+
],
|
|
27369
|
+
})
|
|
27156
27370
|
const priorityDropdown = contactForm.addControl.dropdown({
|
|
27157
27371
|
instanceId: 'priority',
|
|
27158
27372
|
isRequired: true,
|
|
@@ -27193,11 +27407,14 @@
|
|
|
27193
27407
|
isDiscardChangesAlertEnabled: false,
|
|
27194
27408
|
})
|
|
27195
27409
|
// Account type selector affects other fields
|
|
27196
|
-
app.addDatasource.static({
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
|
|
27410
|
+
app.addDatasource.static({
|
|
27411
|
+
datasourceId: 'account-types',
|
|
27412
|
+
data: [
|
|
27413
|
+
{ label: 'Personal', value: 'personal' },
|
|
27414
|
+
{ label: 'Business', value: 'business' },
|
|
27415
|
+
{ label: 'Enterprise', value: 'enterprise' },
|
|
27416
|
+
],
|
|
27417
|
+
})
|
|
27201
27418
|
const accountTypeDropdown = dynamicForm.addControl.dropdown({
|
|
27202
27419
|
instanceId: 'account-type',
|
|
27203
27420
|
isRequired: true,
|
|
@@ -27554,7 +27771,10 @@
|
|
|
27554
27771
|
.interactiveImageItem({
|
|
27555
27772
|
instanceId: 'room-marker',
|
|
27556
27773
|
title: '=@ctx.current.item.roomName',
|
|
27557
|
-
percentageCoordinates: {
|
|
27774
|
+
percentageCoordinates: {
|
|
27775
|
+
x: '=@ctx.current.item.xPercent',
|
|
27776
|
+
y: '=@ctx.current.item.yPercent',
|
|
27777
|
+
},
|
|
27558
27778
|
})
|
|
27559
27779
|
.with({ color: '=@ctx.current.item.statusColor' })
|
|
27560
27780
|
roomItem.onPress.goto({
|
|
@@ -27650,7 +27870,10 @@
|
|
|
27650
27870
|
.interactiveImageItem({
|
|
27651
27871
|
instanceId: 'store-marker',
|
|
27652
27872
|
groupId: '=@ctx.current.item.category',
|
|
27653
|
-
percentageCoordinates: {
|
|
27873
|
+
percentageCoordinates: {
|
|
27874
|
+
x: '=@ctx.current.item.locationX',
|
|
27875
|
+
y: '=@ctx.current.item.locationY',
|
|
27876
|
+
},
|
|
27654
27877
|
})
|
|
27655
27878
|
.with({ title: '=@ctx.current.item.storeName' })
|
|
27656
27879
|
storeItem.onPress.goto({
|
|
@@ -27687,7 +27910,9 @@
|
|
|
27687
27910
|
title: '=@ctx.current.item.departmentName',
|
|
27688
27911
|
groupId: '=@ctx.current.item.zone',
|
|
27689
27912
|
})
|
|
27690
|
-
.with({
|
|
27913
|
+
.with({
|
|
27914
|
+
percentageCoordinates: { x: '=@ctx.current.item.coordX', y: '=@ctx.current.item.coordY' },
|
|
27915
|
+
})
|
|
27691
27916
|
departmentItem.onPress
|
|
27692
27917
|
.executeEntity({ instanceId: 'show-department-info' })
|
|
27693
27918
|
.dynamicData('default/departments', 'update')
|
|
@@ -27764,7 +27989,10 @@
|
|
|
27764
27989
|
instanceId: 'sensor-marker',
|
|
27765
27990
|
title: '=@ctx.current.item.sensorId',
|
|
27766
27991
|
groupId: '=@ctx.current.item.sensorType',
|
|
27767
|
-
percentageCoordinates: {
|
|
27992
|
+
percentageCoordinates: {
|
|
27993
|
+
x: '=@ctx.current.item.positionX',
|
|
27994
|
+
y: '=@ctx.current.item.positionY',
|
|
27995
|
+
},
|
|
27768
27996
|
color:
|
|
27769
27997
|
"=@ctx.current.item.alertLevel = 'critical' ? 'negative' : (@ctx.current.item.alertLevel = 'warning' ? 'warning' : 'positive')",
|
|
27770
27998
|
})
|
|
@@ -27863,10 +28091,12 @@
|
|
|
27863
28091
|
})
|
|
27864
28092
|
const locationHeader = locationScreen.header()
|
|
27865
28093
|
locationHeader.with({ height: 'small' })
|
|
27866
|
-
locationHeader.addControl.location({ instanceId: 'header-map' }).with({
|
|
27867
|
-
|
|
27868
|
-
|
|
27869
|
-
|
|
28094
|
+
locationHeader.addControl.location({ instanceId: 'header-map' }).with({
|
|
28095
|
+
viewPoint: {
|
|
28096
|
+
latitude: 40.7128,
|
|
28097
|
+
longitude: -74.006,
|
|
28098
|
+
},
|
|
28099
|
+
})
|
|
27870
28100
|
locationHeader.actions.goBack({ title: 'Back' })
|
|
27871
28101
|
locationHeader.actions.openUrl({
|
|
27872
28102
|
title: 'Directions',
|
|
@@ -27879,12 +28109,10 @@
|
|
|
27879
28109
|
})
|
|
27880
28110
|
const videoHeader = videoScreen.header()
|
|
27881
28111
|
videoHeader.with({ height: 'medium' })
|
|
27882
|
-
videoHeader.addControl
|
|
27883
|
-
|
|
27884
|
-
.
|
|
27885
|
-
|
|
27886
|
-
title: '=@ctx.solution.state.media.videoTitle',
|
|
27887
|
-
})
|
|
28112
|
+
videoHeader.addControl.videoPlayer({ instanceId: 'header-video' }).with({
|
|
28113
|
+
url: '=@ctx.solution.state.media.headerVideoUrl',
|
|
28114
|
+
title: '=@ctx.solution.state.media.videoTitle',
|
|
28115
|
+
})
|
|
27888
28116
|
videoHeader.actions.goto({ title: 'Full Video', linkTo: 'video-screen' })
|
|
27889
28117
|
// 4. Action screen with multiple actions
|
|
27890
28118
|
const actionScreen = app.addScreen.default({
|
|
@@ -27927,10 +28155,12 @@
|
|
|
27927
28155
|
})
|
|
27928
28156
|
const venueHeader = venueScreen.header()
|
|
27929
28157
|
venueHeader.with({ height: 'medium' })
|
|
27930
|
-
venueHeader.addControl.location({ instanceId: 'venue-location' }).with({
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
28158
|
+
venueHeader.addControl.location({ instanceId: 'venue-location' }).with({
|
|
28159
|
+
viewPoint: {
|
|
28160
|
+
latitude: '=@ctx.solution.state.venue.coordinates.latitude',
|
|
28161
|
+
longitude: '=@ctx.solution.state.venue.coordinates.longitude',
|
|
28162
|
+
},
|
|
28163
|
+
})
|
|
27934
28164
|
venueHeader.actions.goBack({ title: 'Back to List' })
|
|
27935
28165
|
venueHeader.actions.openUrl({
|
|
27936
28166
|
title: 'Get Directions',
|
|
@@ -27944,12 +28174,10 @@
|
|
|
27944
28174
|
})
|
|
27945
28175
|
const galleryHeader = galleryScreen.header()
|
|
27946
28176
|
galleryHeader.with({ height: 'medium' })
|
|
27947
|
-
galleryHeader.addControl
|
|
27948
|
-
|
|
27949
|
-
.
|
|
27950
|
-
|
|
27951
|
-
title: '=@ctx.solution.state.gallery.videoTitle',
|
|
27952
|
-
})
|
|
28177
|
+
galleryHeader.addControl.videoPlayer({ instanceId: 'gallery-preview' }).with({
|
|
28178
|
+
url: '=@ctx.solution.state.gallery.featuredVideoUrl',
|
|
28179
|
+
title: '=@ctx.solution.state.gallery.videoTitle',
|
|
28180
|
+
})
|
|
27953
28181
|
galleryHeader.actions.goBack({ title: 'Back to Gallery' })
|
|
27954
28182
|
galleryHeader.actions.goto({ title: 'Full Screen', linkTo: 'fullscreen-video' })
|
|
27955
28183
|
// Dashboard header with branding
|
|
@@ -28019,10 +28247,12 @@
|
|
|
28019
28247
|
})
|
|
28020
28248
|
const mapHeader = mapScreen.header()
|
|
28021
28249
|
mapHeader.with({ height: 'medium' })
|
|
28022
|
-
mapHeader.addControl.location({ instanceId: 'main-location' }).with({
|
|
28023
|
-
|
|
28024
|
-
|
|
28025
|
-
|
|
28250
|
+
mapHeader.addControl.location({ instanceId: 'main-location' }).with({
|
|
28251
|
+
viewPoint: {
|
|
28252
|
+
latitude: '=@ctx.solution.state.userLocation.latitude',
|
|
28253
|
+
longitude: '=@ctx.solution.state.userLocation.longitude',
|
|
28254
|
+
},
|
|
28255
|
+
})
|
|
28026
28256
|
mapHeader.actions.goBack({ title: 'Back' })
|
|
28027
28257
|
mapHeader.actions.goto({ title: 'Nearby', linkTo: 'nearby-screen' })
|
|
28028
28258
|
// Media header for entertainment apps
|
|
@@ -28032,12 +28262,10 @@
|
|
|
28032
28262
|
})
|
|
28033
28263
|
const mediaHeader = mediaScreen.header()
|
|
28034
28264
|
mediaHeader.with({ height: 'medium' })
|
|
28035
|
-
mediaHeader.addControl
|
|
28036
|
-
|
|
28037
|
-
.
|
|
28038
|
-
|
|
28039
|
-
title: '=@ctx.solution.state.media.videoTitle',
|
|
28040
|
-
})
|
|
28265
|
+
mediaHeader.addControl.videoPlayer({ instanceId: 'featured-content' }).with({
|
|
28266
|
+
url: '=@ctx.solution.state.media.featuredVideoUrl',
|
|
28267
|
+
title: '=@ctx.solution.state.media.videoTitle',
|
|
28268
|
+
})
|
|
28041
28269
|
mediaHeader.actions.goBack({ title: 'Back to Library' })
|
|
28042
28270
|
mediaHeader.actions.goto({ title: 'Related Content', linkTo: 'related-screen' })
|
|
28043
28271
|
// Minimal header for form screens
|
|
@@ -29051,7 +29279,8 @@
|
|
|
29051
29279
|
})
|
|
29052
29280
|
vehicleMarker.addIcon({
|
|
29053
29281
|
icon: "=@ctx.current.item.vehicleType = 'truck' ? 'truck' : 'car'",
|
|
29054
|
-
color:
|
|
29282
|
+
color:
|
|
29283
|
+
"=@ctx.current.item.status = 'active' ? 'positive' : (@ctx.current.item.status = 'maintenance' ? 'warning' : 'negative')",
|
|
29055
29284
|
})
|
|
29056
29285
|
// Field service territories
|
|
29057
29286
|
const serviceSection = screen.addControl.section({ instanceId: 'service-territories' })
|
|
@@ -29075,7 +29304,8 @@
|
|
|
29075
29304
|
})
|
|
29076
29305
|
appointmentMarker.addIcon({
|
|
29077
29306
|
icon: "=@ctx.current.item.priority = 'urgent' ? 'alert' : 'wrench'",
|
|
29078
|
-
color:
|
|
29307
|
+
color:
|
|
29308
|
+
"=@ctx.current.item.status = 'scheduled' ? 'color1' : (@ctx.current.item.status = 'in-progress' ? 'warning' : 'positive')",
|
|
29079
29309
|
})
|
|
29080
29310
|
// Emergency response system
|
|
29081
29311
|
const emergencySection = screen.addControl.section({ instanceId: 'emergency-response' })
|
|
@@ -29101,7 +29331,8 @@
|
|
|
29101
29331
|
})
|
|
29102
29332
|
incidentMarker.addIcon({
|
|
29103
29333
|
icon: "=@ctx.current.item.severity = 'critical' ? 'alert-triangle' : 'information-circle'",
|
|
29104
|
-
color:
|
|
29334
|
+
color:
|
|
29335
|
+
"=@ctx.current.item.severity = 'critical' ? 'negative' : (@ctx.current.item.severity = 'high' ? 'warning' : 'positive')",
|
|
29105
29336
|
})
|
|
29106
29337
|
// Asset tracking with geofencing
|
|
29107
29338
|
const assetSection = screen.addControl.section({ instanceId: 'asset-tracking' })
|
|
@@ -29160,18 +29391,16 @@
|
|
|
29160
29391
|
.dynamicData('default/selected_locations', 'update')
|
|
29161
29392
|
// Location-aware content
|
|
29162
29393
|
const contentSection = screen.addControl.section({ instanceId: 'location-content' })
|
|
29163
|
-
const contextMap = contentSection.addControl
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
},
|
|
29174
|
-
})
|
|
29394
|
+
const contextMap = contentSection.addControl.location({ instanceId: 'contextual-map' }).with({
|
|
29395
|
+
markersData: '=@ctx.datasources.nearby_points_of_interest',
|
|
29396
|
+
viewPoint: {
|
|
29397
|
+
latitude: '=@ctx.solution.state.userLatitude',
|
|
29398
|
+
longitude: '=@ctx.solution.state.userLongitude',
|
|
29399
|
+
zoomLevel: '=@ctx.solution.state.preferredZoom',
|
|
29400
|
+
centerPosition: 'middle',
|
|
29401
|
+
isFollowUserLocationEnabled: '=@ctx.solution.state.trackUserMovement',
|
|
29402
|
+
},
|
|
29403
|
+
})
|
|
29175
29404
|
const poiMarker = contextMap.addControl.markerItem({
|
|
29176
29405
|
instanceId: 'poi-marker',
|
|
29177
29406
|
latitude: '=@ctx.current.item.position.lat',
|
|
@@ -29203,7 +29432,8 @@
|
|
|
29203
29432
|
})
|
|
29204
29433
|
comparisonMarker.addIcon({
|
|
29205
29434
|
icon: "=@ctx.current.item.isSelected ? 'check-circle' : 'circle'",
|
|
29206
|
-
color:
|
|
29435
|
+
color:
|
|
29436
|
+
"=@ctx.current.item.rank <= 3 ? 'positive' : (@ctx.current.item.rank <= 6 ? 'warning' : 'color2')",
|
|
29207
29437
|
})
|
|
29208
29438
|
// Dynamic location clustering
|
|
29209
29439
|
const clusterSection = screen.addControl.section({ instanceId: 'location-clusters' })
|
|
@@ -29230,7 +29460,8 @@
|
|
|
29230
29460
|
})
|
|
29231
29461
|
clusterMarker.addIcon({
|
|
29232
29462
|
icon: "=@ctx.current.item.count > 10 ? 'layers' : 'pin-map'",
|
|
29233
|
-
color:
|
|
29463
|
+
color:
|
|
29464
|
+
"=@ctx.current.item.density = 'high' ? 'negative' : (@ctx.current.item.density = 'medium' ? 'warning' : 'positive')",
|
|
29234
29465
|
})
|
|
29235
29466
|
- id: component.component.marker-item-1
|
|
29236
29467
|
name: Map Marker Component
|
|
@@ -29270,7 +29501,9 @@
|
|
|
29270
29501
|
latitude: '=@ctx.current.item.latitude',
|
|
29271
29502
|
longitude: '=@ctx.current.item.longitude',
|
|
29272
29503
|
})
|
|
29273
|
-
.with({
|
|
29504
|
+
.with({
|
|
29505
|
+
radius: { value: '=@ctx.current.item.serviceRadius', unit: 'miles', color: 'positive' },
|
|
29506
|
+
})
|
|
29274
29507
|
customerMarker.addIcon({ icon: '=@ctx.current.item.markerIcon' })
|
|
29275
29508
|
- id: component.component.marker-item-2
|
|
29276
29509
|
name: Advanced Marker Configurations
|
|
@@ -29306,7 +29539,14 @@
|
|
|
29306
29539
|
latitude: '=@ctx.current.item.centerLat',
|
|
29307
29540
|
longitude: '=@ctx.current.item.centerLng',
|
|
29308
29541
|
})
|
|
29309
|
-
.with({
|
|
29542
|
+
.with({
|
|
29543
|
+
radius: {
|
|
29544
|
+
value: '=@ctx.current.item.coverageRadius',
|
|
29545
|
+
unit: 'meters',
|
|
29546
|
+
color: '=(@ctx.current.item.isActive) ? "positive" : "neutral"',
|
|
29547
|
+
isEnabled: '=@ctx.current.item.showCoverage',
|
|
29548
|
+
},
|
|
29549
|
+
})
|
|
29310
29550
|
dynamicZone.addIcon({ icon: '=@ctx.current.item.zoneType' })
|
|
29311
29551
|
- id: component.component.marker-item-3
|
|
29312
29552
|
name: Marker Builder Patterns
|
|
@@ -31154,11 +31394,13 @@
|
|
|
31154
31394
|
.with({
|
|
31155
31395
|
left: {
|
|
31156
31396
|
title: 'Last Month',
|
|
31157
|
-
subtitle:
|
|
31397
|
+
subtitle:
|
|
31398
|
+
'=@ctx.current.item.metrics.previousMonth.value & @ctx.current.item.metrics.unit',
|
|
31158
31399
|
},
|
|
31159
31400
|
right: {
|
|
31160
31401
|
title: 'This Month',
|
|
31161
|
-
subtitle:
|
|
31402
|
+
subtitle:
|
|
31403
|
+
'=@ctx.current.item.metrics.currentMonth.value & @ctx.current.item.metrics.unit',
|
|
31162
31404
|
},
|
|
31163
31405
|
})
|
|
31164
31406
|
performanceStage.onPress.goto({
|
|
@@ -33710,6 +33952,29 @@
|
|
|
33710
33952
|
size: 'small',
|
|
33711
33953
|
uri: 'https://example.com/user.png',
|
|
33712
33954
|
})
|
|
33955
|
+
- id: jc.banner-example
|
|
33956
|
+
name: Warning Banner with Icon and Action
|
|
33957
|
+
category: component
|
|
33958
|
+
tags:
|
|
33959
|
+
- component
|
|
33960
|
+
- banner
|
|
33961
|
+
- alert
|
|
33962
|
+
- warning
|
|
33963
|
+
- icon
|
|
33964
|
+
- action
|
|
33965
|
+
description: Show a warning banner with a left icon and a retry button on a default screen
|
|
33966
|
+
code: |-
|
|
33967
|
+
const syncBanner = screen.addControl.banner({
|
|
33968
|
+
instanceId: 'sync-banner',
|
|
33969
|
+
title: { text: 'Sync failed', isBold: true },
|
|
33970
|
+
subtitle: 'Some records were not uploaded',
|
|
33971
|
+
icon: 'hazard-warning-flasher',
|
|
33972
|
+
iconColor: 'warning',
|
|
33973
|
+
iconType: 'contained',
|
|
33974
|
+
iconShape: 'circle',
|
|
33975
|
+
isWarning: true,
|
|
33976
|
+
})
|
|
33977
|
+
syncBanner.addAction.executeAction({ title: 'Retry', action: 'retry-sync' })
|
|
33713
33978
|
- id: jc.bar-chart-example-1
|
|
33714
33979
|
name: Bar Chart with Quarterly Sales Data
|
|
33715
33980
|
category: component
|
|
@@ -33869,6 +34134,23 @@
|
|
|
33869
34134
|
const buyForm = productCard.addControl.form({ instanceId: 'buy-form' }) // Use form instead of button
|
|
33870
34135
|
buyForm.addControl.textField({ instanceId: 'quantity' }).label('Quantity')
|
|
33871
34136
|
- id: jc.card-example-3
|
|
34137
|
+
name: Card Component with a Section
|
|
34138
|
+
category: component
|
|
34139
|
+
tags:
|
|
34140
|
+
- component
|
|
34141
|
+
- card
|
|
34142
|
+
- section
|
|
34143
|
+
- container
|
|
34144
|
+
- grouping
|
|
34145
|
+
description: Group card content under a titled section
|
|
34146
|
+
code: |-
|
|
34147
|
+
const detailsCard = screen.addControl.card({ instanceId: 'details-card' })
|
|
34148
|
+
const contactSection = detailsCard.addControl.section({
|
|
34149
|
+
instanceId: 'contact',
|
|
34150
|
+
title: 'Contact',
|
|
34151
|
+
})
|
|
34152
|
+
contactSection.addControl.emailField({ instanceId: 'email', label: 'Email' })
|
|
34153
|
+
- id: jc.card-example-4
|
|
33872
34154
|
name: Styled Card Component with Gap and Color
|
|
33873
34155
|
category: component
|
|
33874
34156
|
tags:
|
|
@@ -34033,10 +34315,13 @@
|
|
|
34033
34315
|
description: Create choice field item referencing a static datasource with
|
|
34034
34316
|
dynamic title expressions
|
|
34035
34317
|
code: |-
|
|
34036
|
-
app.addDatasource.static({
|
|
34037
|
-
|
|
34038
|
-
|
|
34039
|
-
|
|
34318
|
+
app.addDatasource.static({
|
|
34319
|
+
datasourceId: 'inline-options',
|
|
34320
|
+
data: [
|
|
34321
|
+
{ id: 'x', label: 'X' },
|
|
34322
|
+
{ id: 'y', label: 'Y' },
|
|
34323
|
+
],
|
|
34324
|
+
})
|
|
34040
34325
|
const choices = screen.addControl.choiceField({
|
|
34041
34326
|
instanceId: 'inline-choices',
|
|
34042
34327
|
data: '=@ctx.datasources.inline-options',
|
|
@@ -34117,10 +34402,13 @@
|
|
|
34117
34402
|
- options
|
|
34118
34403
|
description: Create choice field referencing a static datasource
|
|
34119
34404
|
code: |-
|
|
34120
|
-
app.addDatasource.static({
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34405
|
+
app.addDatasource.static({
|
|
34406
|
+
datasourceId: 'choice-options',
|
|
34407
|
+
data: [
|
|
34408
|
+
{ id: 'a', label: 'A' },
|
|
34409
|
+
{ id: 'b', label: 'B' },
|
|
34410
|
+
],
|
|
34411
|
+
})
|
|
34124
34412
|
const choices = screen.addControl.choiceField({
|
|
34125
34413
|
instanceId: 'inline-choices',
|
|
34126
34414
|
label: 'Inline',
|
|
@@ -34608,11 +34896,14 @@
|
|
|
34608
34896
|
- required
|
|
34609
34897
|
description: Create required country dropdown referencing a static datasource
|
|
34610
34898
|
code: |-
|
|
34611
|
-
app.addDatasource.static({
|
|
34612
|
-
|
|
34613
|
-
|
|
34614
|
-
|
|
34615
|
-
|
|
34899
|
+
app.addDatasource.static({
|
|
34900
|
+
datasourceId: 'countries',
|
|
34901
|
+
data: [
|
|
34902
|
+
{ countryCode: 'US', countryName: 'United States' },
|
|
34903
|
+
{ countryCode: 'CA', countryName: 'Canada' },
|
|
34904
|
+
{ countryCode: 'MX', countryName: 'Mexico' },
|
|
34905
|
+
],
|
|
34906
|
+
})
|
|
34616
34907
|
const dropdown = screen.addControl.dropdown({
|
|
34617
34908
|
instanceId: 'country-select',
|
|
34618
34909
|
isRequired: true,
|
|
@@ -34794,7 +35085,11 @@
|
|
|
34794
35085
|
user profile display
|
|
34795
35086
|
code: |-
|
|
34796
35087
|
const userEntity = screen.addControl.entity()
|
|
34797
|
-
userEntity.addControl.entityField({
|
|
35088
|
+
userEntity.addControl.entityField({
|
|
35089
|
+
instanceId: 'name-field',
|
|
35090
|
+
label: 'Name',
|
|
35091
|
+
value: 'John Doe',
|
|
35092
|
+
})
|
|
34798
35093
|
userEntity.addControl
|
|
34799
35094
|
.entityField({ instanceId: 'email-field', label: 'Email' })
|
|
34800
35095
|
.with({ value: 'john@example.com' })
|
|
@@ -34816,11 +35111,19 @@
|
|
|
34816
35111
|
instanceId: 'product-entity',
|
|
34817
35112
|
isCompact: true,
|
|
34818
35113
|
})
|
|
34819
|
-
productEntity.addControl.entityField({
|
|
35114
|
+
productEntity.addControl.entityField({
|
|
35115
|
+
instanceId: 'product-name',
|
|
35116
|
+
label: 'Product Name',
|
|
35117
|
+
value: 'Laptop',
|
|
35118
|
+
})
|
|
34820
35119
|
productEntity.addControl
|
|
34821
35120
|
.entityField({ instanceId: 'product-price', label: 'Price' })
|
|
34822
35121
|
.with({ value: '$999.99' })
|
|
34823
|
-
productEntity.addControl.entityField({
|
|
35122
|
+
productEntity.addControl.entityField({
|
|
35123
|
+
instanceId: 'product-stock',
|
|
35124
|
+
label: 'In Stock',
|
|
35125
|
+
value: 'Yes',
|
|
35126
|
+
})
|
|
34824
35127
|
- id: jc.event-example-1
|
|
34825
35128
|
name: Team Meeting Event with Full Details
|
|
34826
35129
|
category: component
|
|
@@ -35468,6 +35771,42 @@
|
|
|
35468
35771
|
source: { uri: 'file://assets/logo.png' },
|
|
35469
35772
|
height: 100,
|
|
35470
35773
|
})
|
|
35774
|
+
- id: jc.image-example-3
|
|
35775
|
+
name: Image Inside a View with Fixed Size
|
|
35776
|
+
category: component
|
|
35777
|
+
tags:
|
|
35778
|
+
- component
|
|
35779
|
+
- image
|
|
35780
|
+
- view
|
|
35781
|
+
- size
|
|
35782
|
+
description: Inside a view an image is sized through one size option instead of
|
|
35783
|
+
height and width
|
|
35784
|
+
code: |-
|
|
35785
|
+
const view = component.addControl.view({})
|
|
35786
|
+
const image = view.addControl.image({
|
|
35787
|
+
source: { uri: 'https://example.com/hero.jpg' },
|
|
35788
|
+
resizeMode: 'cover',
|
|
35789
|
+
size: { height: 100, width: 200 },
|
|
35790
|
+
})
|
|
35791
|
+
- id: jc.image-example-4
|
|
35792
|
+
name: Image Inside a Custom Component with Fixed Size
|
|
35793
|
+
category: component
|
|
35794
|
+
tags:
|
|
35795
|
+
- component
|
|
35796
|
+
- image
|
|
35797
|
+
- custom-component
|
|
35798
|
+
- size
|
|
35799
|
+
description: Inside a custom component definition an image is sized through one
|
|
35800
|
+
size option, fixed or flexible
|
|
35801
|
+
code: |-
|
|
35802
|
+
const fixed = component.addControl.image({
|
|
35803
|
+
source: { uri: 'https://example.com/product.jpg' },
|
|
35804
|
+
size: { height: 114 },
|
|
35805
|
+
})
|
|
35806
|
+
const flexible = component.addControl.image({
|
|
35807
|
+
source: { uri: 'https://example.com/banner.jpg' },
|
|
35808
|
+
size: 'flexible',
|
|
35809
|
+
})
|
|
35471
35810
|
- id: jc.interactive-image-example-1
|
|
35472
35811
|
name: Interactive Image with Dynamic Data Source
|
|
35473
35812
|
category: component
|
|
@@ -36085,6 +36424,20 @@
|
|
|
36085
36424
|
.listItem({ instanceId: 'enabled-item' })
|
|
36086
36425
|
.title('Enabled Item')
|
|
36087
36426
|
.isDisabled(false)
|
|
36427
|
+
- id: jc.list-item-example-7
|
|
36428
|
+
name: List Item with Dynamic Height
|
|
36429
|
+
category: component
|
|
36430
|
+
tags:
|
|
36431
|
+
- component
|
|
36432
|
+
- list-item
|
|
36433
|
+
- dynamic-height
|
|
36434
|
+
description: Create a list item whose height follows its content in a vertical list
|
|
36435
|
+
code: |-
|
|
36436
|
+
const builder = screen.addControl.listItem({
|
|
36437
|
+
instanceId: 'dynamic-item',
|
|
36438
|
+
title: 'Long description item',
|
|
36439
|
+
hasDynamicHeight: true,
|
|
36440
|
+
})
|
|
36088
36441
|
- id: jc.list-example-1
|
|
36089
36442
|
name: List Component with Inline Static Data
|
|
36090
36443
|
category: component
|
|
@@ -36274,7 +36627,10 @@
|
|
|
36274
36627
|
},
|
|
36275
36628
|
markersData: '=@ctx.datasources.locations',
|
|
36276
36629
|
})
|
|
36277
|
-
.with({
|
|
36630
|
+
.with({
|
|
36631
|
+
isShowUserLocationEnabled: '=@ctx.jig.state.map.showUser',
|
|
36632
|
+
paths: '=@ctx.datasources.routes',
|
|
36633
|
+
})
|
|
36278
36634
|
- id: jc.location-example-8
|
|
36279
36635
|
name: Location Maps with Different Radius Unit Types
|
|
36280
36636
|
category: component
|
|
@@ -37802,7 +38158,10 @@
|
|
|
37802
38158
|
sync across devices and users
|
|
37803
38159
|
code: |-
|
|
37804
38160
|
// Dynamic SQLite datasource - synced across devices for collaborative data
|
|
37805
|
-
const customerData = app.addDatasource.sqlite({
|
|
38161
|
+
const customerData = app.addDatasource.sqlite({
|
|
38162
|
+
datasourceId: 'customers',
|
|
38163
|
+
provider: 'dynamic',
|
|
38164
|
+
})
|
|
37806
38165
|
customerData.entity('default/customers')
|
|
37807
38166
|
customerData.query(`
|
|
37808
38167
|
SELECT
|
|
@@ -37834,7 +38193,10 @@
|
|
|
37834
38193
|
orderData.queryParameter('minAmount', 100)
|
|
37835
38194
|
orderData.queryParameter('maxResults', 50)
|
|
37836
38195
|
// Multiple entities with relationships
|
|
37837
|
-
const inventoryData = app.addDatasource.sqlite({
|
|
38196
|
+
const inventoryData = app.addDatasource.sqlite({
|
|
38197
|
+
datasourceId: 'inventory',
|
|
38198
|
+
provider: 'dynamic',
|
|
38199
|
+
})
|
|
37838
38200
|
inventoryData.entity('default/products')
|
|
37839
38201
|
inventoryData.entity('default/categories')
|
|
37840
38202
|
inventoryData.query(`
|
|
@@ -37850,7 +38212,10 @@
|
|
|
37850
38212
|
WHERE json_extract(p.data, '$.active') = true
|
|
37851
38213
|
`)
|
|
37852
38214
|
// Single document mode - for detail views and singleton data
|
|
37853
|
-
const customerDetail = app.addDatasource.sqlite({
|
|
38215
|
+
const customerDetail = app.addDatasource.sqlite({
|
|
38216
|
+
datasourceId: 'customer-detail',
|
|
38217
|
+
provider: 'dynamic',
|
|
38218
|
+
})
|
|
37854
38219
|
customerDetail.entity('default/customers')
|
|
37855
38220
|
customerDetail.query(`
|
|
37856
38221
|
SELECT
|
|
@@ -37866,7 +38231,10 @@
|
|
|
37866
38231
|
customerDetail.jsonProperties('data')
|
|
37867
38232
|
customerDetail.isDocument(true) // Returns single document instead of array
|
|
37868
38233
|
// Dashboard statistics - single aggregated row
|
|
37869
|
-
const dashboardStats = app.addDatasource.sqlite({
|
|
38234
|
+
const dashboardStats = app.addDatasource.sqlite({
|
|
38235
|
+
datasourceId: 'dashboard-stats',
|
|
38236
|
+
provider: 'dynamic',
|
|
38237
|
+
})
|
|
37870
38238
|
dashboardStats.entity('default/orders')
|
|
37871
38239
|
dashboardStats.query(`
|
|
37872
38240
|
SELECT
|
|
@@ -37895,7 +38263,10 @@
|
|
|
37895
38263
|
device-specific information
|
|
37896
38264
|
code: |-
|
|
37897
38265
|
// Local SQLite datasource - device-only storage for preferences and temporary data
|
|
37898
|
-
const userPrefs = app.addDatasource.sqlite({
|
|
38266
|
+
const userPrefs = app.addDatasource.sqlite({
|
|
38267
|
+
datasourceId: 'user-preferences',
|
|
38268
|
+
provider: 'local',
|
|
38269
|
+
})
|
|
37899
38270
|
userPrefs.entity('preferences')
|
|
37900
38271
|
userPrefs.query(`
|
|
37901
38272
|
SELECT
|
|
@@ -37922,7 +38293,10 @@
|
|
|
37922
38293
|
`)
|
|
37923
38294
|
localCache.queryParameter('currentTime', '=@ctx.solution.state.currentTimestamp')
|
|
37924
38295
|
// Device-specific settings and configuration
|
|
37925
|
-
const deviceSettings = app.addDatasource.sqlite({
|
|
38296
|
+
const deviceSettings = app.addDatasource.sqlite({
|
|
38297
|
+
datasourceId: 'device-settings',
|
|
38298
|
+
provider: 'local',
|
|
38299
|
+
})
|
|
37926
38300
|
deviceSettings.entity('settings')
|
|
37927
38301
|
deviceSettings.query(`
|
|
37928
38302
|
SELECT
|
|
@@ -37951,99 +38325,111 @@
|
|
|
37951
38325
|
doesn't require database storage
|
|
37952
38326
|
code: |-
|
|
37953
38327
|
// Basic static datasource for dropdown options
|
|
37954
|
-
app.addDatasource.static({
|
|
37955
|
-
|
|
37956
|
-
|
|
37957
|
-
|
|
37958
|
-
|
|
37959
|
-
|
|
37960
|
-
|
|
38328
|
+
app.addDatasource.static({
|
|
38329
|
+
datasourceId: 'order-statuses',
|
|
38330
|
+
data: [
|
|
38331
|
+
{ id: 'pending', label: 'Pending Review', color: '#FFA500' },
|
|
38332
|
+
{ id: 'approved', label: 'Approved', color: '#28A745' },
|
|
38333
|
+
{ id: 'rejected', label: 'Rejected', color: '#DC3545' },
|
|
38334
|
+
{ id: 'processing', label: 'Processing', color: '#17A2B8' },
|
|
38335
|
+
{ id: 'completed', label: 'Completed', color: '#6F42C1' },
|
|
38336
|
+
],
|
|
38337
|
+
})
|
|
37961
38338
|
// 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
|
-
|
|
38339
|
+
app.addDatasource.static({
|
|
38340
|
+
datasourceId: 'theme-options',
|
|
38341
|
+
data: [
|
|
38342
|
+
{
|
|
38343
|
+
id: 'light',
|
|
38344
|
+
name: 'Light Theme',
|
|
38345
|
+
description: 'Clean bright interface',
|
|
38346
|
+
primaryColor: '#007BFF',
|
|
38347
|
+
backgroundColor: '#FFFFFF',
|
|
38348
|
+
},
|
|
38349
|
+
{
|
|
38350
|
+
id: 'dark',
|
|
38351
|
+
name: 'Dark Theme',
|
|
38352
|
+
description: 'Easy on the eyes',
|
|
38353
|
+
primaryColor: '#BB86FC',
|
|
38354
|
+
backgroundColor: '#121212',
|
|
38355
|
+
},
|
|
38356
|
+
{
|
|
38357
|
+
id: 'auto',
|
|
38358
|
+
name: 'System Default',
|
|
38359
|
+
description: 'Follows device setting',
|
|
38360
|
+
primaryColor: '#6C757D',
|
|
38361
|
+
backgroundColor: 'auto',
|
|
38362
|
+
},
|
|
38363
|
+
],
|
|
38364
|
+
})
|
|
37985
38365
|
// 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
|
-
|
|
38366
|
+
app.addDatasource.static({
|
|
38367
|
+
datasourceId: 'countries',
|
|
38368
|
+
data: [
|
|
38369
|
+
{
|
|
38370
|
+
id: 'us',
|
|
38371
|
+
name: 'United States',
|
|
38372
|
+
code: 'US',
|
|
38373
|
+
currency: { symbol: '$', code: 'USD' },
|
|
38374
|
+
regions: [
|
|
38375
|
+
{ id: 'north', name: 'North' },
|
|
38376
|
+
{ id: 'south', name: 'South' },
|
|
38377
|
+
{ id: 'east', name: 'East' },
|
|
38378
|
+
{ id: 'west', name: 'West' },
|
|
38379
|
+
],
|
|
38380
|
+
},
|
|
38381
|
+
{
|
|
38382
|
+
id: 'uk',
|
|
38383
|
+
name: 'United Kingdom',
|
|
38384
|
+
code: 'GB',
|
|
38385
|
+
currency: { symbol: '£', code: 'GBP' },
|
|
38386
|
+
regions: [
|
|
38387
|
+
{ id: 'england', name: 'England' },
|
|
38388
|
+
{ id: 'scotland', name: 'Scotland' },
|
|
38389
|
+
{ id: 'wales', name: 'Wales' },
|
|
38390
|
+
{ id: 'ni', name: 'Northern Ireland' },
|
|
38391
|
+
],
|
|
38392
|
+
},
|
|
38393
|
+
],
|
|
38394
|
+
})
|
|
38012
38395
|
// 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
|
-
|
|
38396
|
+
app.addDatasource.static({
|
|
38397
|
+
datasourceId: 'priority-levels',
|
|
38398
|
+
data: [
|
|
38399
|
+
{
|
|
38400
|
+
id: 1,
|
|
38401
|
+
name: 'Low',
|
|
38402
|
+
color: '#28A745',
|
|
38403
|
+
description: 'Nice to have',
|
|
38404
|
+
urgencyScore: 1,
|
|
38405
|
+
escalationDays: 30,
|
|
38406
|
+
},
|
|
38407
|
+
{
|
|
38408
|
+
id: 2,
|
|
38409
|
+
name: 'Medium',
|
|
38410
|
+
color: '#FFC107',
|
|
38411
|
+
description: 'Should be addressed',
|
|
38412
|
+
urgencyScore: 5,
|
|
38413
|
+
escalationDays: 7,
|
|
38414
|
+
},
|
|
38415
|
+
{
|
|
38416
|
+
id: 3,
|
|
38417
|
+
name: 'High',
|
|
38418
|
+
color: '#FD7E14',
|
|
38419
|
+
description: 'Important issue',
|
|
38420
|
+
urgencyScore: 8,
|
|
38421
|
+
escalationDays: 2,
|
|
38422
|
+
},
|
|
38423
|
+
{
|
|
38424
|
+
id: 4,
|
|
38425
|
+
name: 'Critical',
|
|
38426
|
+
color: '#DC3545',
|
|
38427
|
+
description: 'Immediate attention required',
|
|
38428
|
+
urgencyScore: 10,
|
|
38429
|
+
escalationDays: 0,
|
|
38430
|
+
},
|
|
38431
|
+
],
|
|
38432
|
+
})
|
|
38047
38433
|
- id: datasource.datasource.system
|
|
38048
38434
|
name: System Datasource Configuration
|
|
38049
38435
|
category: datasource
|
|
@@ -38240,8 +38626,10 @@
|
|
|
38240
38626
|
- entity
|
|
38241
38627
|
- object-form
|
|
38242
38628
|
description: Use entity({ entity }) to emit the explicit object shape for a table
|
|
38243
|
-
code:
|
|
38244
|
-
|
|
38629
|
+
code: |-
|
|
38630
|
+
app.addDatasource
|
|
38631
|
+
.sqlite({ datasourceId: 'test-ds', provider: 'local' })
|
|
38632
|
+
.entity({ entity: 'customers' })
|
|
38245
38633
|
- id: datasource.sqlite-example-7
|
|
38246
38634
|
name: SQLite Datasource Entity with Sync Function
|
|
38247
38635
|
category: datasource
|
|
@@ -38273,8 +38661,10 @@
|
|
|
38273
38661
|
- external
|
|
38274
38662
|
description: Use entityPackaged(name, packageName) to reference a table from an
|
|
38275
38663
|
external package
|
|
38276
|
-
code:
|
|
38277
|
-
|
|
38664
|
+
code: |-
|
|
38665
|
+
app.addDatasource
|
|
38666
|
+
.sqlite({ datasourceId: 'test-ds', provider: 'local' })
|
|
38667
|
+
.entityPackaged('users', 'erp')
|
|
38278
38668
|
- id: datasource.static-example-1
|
|
38279
38669
|
name: Static Datasource with Color Objects
|
|
38280
38670
|
category: datasource
|
|
@@ -38326,10 +38716,13 @@
|
|
|
38326
38716
|
- properties
|
|
38327
38717
|
description: Store color data with name and hex value properties
|
|
38328
38718
|
code: |-
|
|
38329
|
-
app.addDatasource.static({
|
|
38330
|
-
|
|
38331
|
-
|
|
38332
|
-
|
|
38719
|
+
app.addDatasource.static({
|
|
38720
|
+
datasourceId: 'colors',
|
|
38721
|
+
data: [
|
|
38722
|
+
{ name: 'Red', value: '#FF0000' },
|
|
38723
|
+
{ name: 'Green', value: '#00FF00' },
|
|
38724
|
+
],
|
|
38725
|
+
})
|
|
38333
38726
|
- id: datasource.static-example-5
|
|
38334
38727
|
name: Static Datasource with Number Array
|
|
38335
38728
|
category: datasource
|
|
@@ -38355,8 +38748,10 @@
|
|
|
38355
38748
|
- comma-delimiter
|
|
38356
38749
|
description: Parse comma-separated priority values into array using default
|
|
38357
38750
|
comma delimiter
|
|
38358
|
-
code:
|
|
38359
|
-
|
|
38751
|
+
code: |-
|
|
38752
|
+
app.addDatasource
|
|
38753
|
+
.static({ datasourceId: 'priorities', data: [] })
|
|
38754
|
+
.csv('urgent, high, medium, low')
|
|
38360
38755
|
- id: datasource.static-example-7
|
|
38361
38756
|
name: Static Datasource with Pipe-Delimited CSV Colors
|
|
38362
38757
|
category: datasource
|
|
@@ -38368,8 +38763,10 @@
|
|
|
38368
38763
|
- whitespace
|
|
38369
38764
|
- colors
|
|
38370
38765
|
description: Parse pipe-delimited color values with automatic whitespace trimming
|
|
38371
|
-
code:
|
|
38372
|
-
|
|
38766
|
+
code: |-
|
|
38767
|
+
app.addDatasource
|
|
38768
|
+
.static({ datasourceId: 'colors', data: [] })
|
|
38769
|
+
.csv(' red | green | blue ', '|')
|
|
38373
38770
|
- id: datasource.static-example-8
|
|
38374
38771
|
name: Static Datasource with JSON Array Parsing
|
|
38375
38772
|
category: datasource
|
|
@@ -38394,8 +38791,10 @@
|
|
|
38394
38791
|
- key-value-pairs
|
|
38395
38792
|
- configuration
|
|
38396
38793
|
description: Convert JSON configuration object to key-value pair array
|
|
38397
|
-
code:
|
|
38398
|
-
|
|
38794
|
+
code: |-
|
|
38795
|
+
app.addDatasource
|
|
38796
|
+
.static({ datasourceId: 'config', data: [] })
|
|
38797
|
+
.json('{"debug": true, "port": 3000}')
|
|
38399
38798
|
- id: datasource.system-example-1
|
|
38400
38799
|
name: System Datasource for Feature Flags
|
|
38401
38800
|
category: datasource
|
|
@@ -38458,7 +38857,11 @@
|
|
|
38458
38857
|
managing continuation tokens for REST APIs
|
|
38459
38858
|
code: |-
|
|
38460
38859
|
// 1. Basic REST function with simple pagination
|
|
38461
|
-
const getUsersFunction = app.addFunction.rest({
|
|
38860
|
+
const getUsersFunction = app.addFunction.rest({
|
|
38861
|
+
functionId: 'get-users',
|
|
38862
|
+
method: 'GET',
|
|
38863
|
+
url: 'https://api.example.com/users',
|
|
38864
|
+
})
|
|
38462
38865
|
getUsersFunction.params.query('page', { value: 1, type: 'number' })
|
|
38463
38866
|
getUsersFunction.params.header('Authorization', 'Bearer token123')
|
|
38464
38867
|
getUsersFunction.json()
|
|
@@ -38468,7 +38871,11 @@
|
|
|
38468
38871
|
usersContinuation.when('=$.hasMore')
|
|
38469
38872
|
usersContinuation.url('=$.nextPageUrl')
|
|
38470
38873
|
// 2. Microsoft Graph API with OAuth continuation
|
|
38471
|
-
const getGraphUsers = app.addFunction.rest({
|
|
38874
|
+
const getGraphUsers = app.addFunction.rest({
|
|
38875
|
+
functionId: 'get-graph-users',
|
|
38876
|
+
method: 'GET',
|
|
38877
|
+
url: 'https://graph.microsoft.com/v1.0/users',
|
|
38878
|
+
})
|
|
38472
38879
|
getGraphUsers.params.header('Authorization', '=@ctx.solution.state.user.graphToken')
|
|
38473
38880
|
getGraphUsers.json()
|
|
38474
38881
|
getGraphUsers.records('=$.value')
|
|
@@ -38477,7 +38884,11 @@
|
|
|
38477
38884
|
graphContinuation.when('=$."@odata.nextLink"')
|
|
38478
38885
|
graphContinuation.url('=$."@odata.nextLink"')
|
|
38479
38886
|
// 3. Advanced pagination with cursor-based continuation
|
|
38480
|
-
const searchCustomers = app.addFunction.rest({
|
|
38887
|
+
const searchCustomers = app.addFunction.rest({
|
|
38888
|
+
functionId: 'search-customers',
|
|
38889
|
+
method: 'POST',
|
|
38890
|
+
url: 'https://api.crm.com/customers/search',
|
|
38891
|
+
})
|
|
38481
38892
|
searchCustomers.params.body('query', { name: 'John', active: true })
|
|
38482
38893
|
searchCustomers.params.header('API-Key', '=@ctx.solution.state.crmApiKey')
|
|
38483
38894
|
searchCustomers.json()
|
|
@@ -38489,7 +38900,11 @@
|
|
|
38489
38900
|
'=@ctx.solution.state.apiUrl & "/customers/search?cursor=" & $.pagination.nextCursor',
|
|
38490
38901
|
)
|
|
38491
38902
|
// 4. Pagination with dynamic parameter updates
|
|
38492
|
-
const getOrderHistory = app.addFunction.rest({
|
|
38903
|
+
const getOrderHistory = app.addFunction.rest({
|
|
38904
|
+
functionId: 'get-order-history',
|
|
38905
|
+
method: 'GET',
|
|
38906
|
+
url: 'https://api.orders.com/history',
|
|
38907
|
+
})
|
|
38493
38908
|
getOrderHistory.params.query('limit', { value: 100, type: 'number' })
|
|
38494
38909
|
getOrderHistory.params.query('offset', { value: 0, type: 'number' })
|
|
38495
38910
|
getOrderHistory.params.header('X-API-Key', '=@ctx.solution.state.ordersApiKey')
|
|
@@ -38502,7 +38917,11 @@
|
|
|
38502
38917
|
'=@ctx.solution.state.ordersUrl & "/history?offset=" & ($.offset + $.limit) & "&limit=" & $.limit',
|
|
38503
38918
|
)
|
|
38504
38919
|
// 5. Complex continuation with authentication renewal
|
|
38505
|
-
const syncInventory = app.addFunction.rest({
|
|
38920
|
+
const syncInventory = app.addFunction.rest({
|
|
38921
|
+
functionId: 'sync-inventory',
|
|
38922
|
+
method: 'GET',
|
|
38923
|
+
url: 'https://api.inventory.com/items',
|
|
38924
|
+
})
|
|
38506
38925
|
syncInventory.params.header('Authorization', 'Bearer =@ctx.solution.state.inventoryToken')
|
|
38507
38926
|
syncInventory.params.query('pageSize', { value: 50, type: 'number' })
|
|
38508
38927
|
syncInventory.json()
|
|
@@ -38527,14 +38946,22 @@
|
|
|
38527
38946
|
PUT, DELETE methods with full parameter and header control
|
|
38528
38947
|
code: |-
|
|
38529
38948
|
// 1. Basic GET request with authentication
|
|
38530
|
-
const getUsersFunction = app.addFunction.rest({
|
|
38949
|
+
const getUsersFunction = app.addFunction.rest({
|
|
38950
|
+
functionId: 'get-users',
|
|
38951
|
+
method: 'GET',
|
|
38952
|
+
url: 'https://api.example.com/users',
|
|
38953
|
+
})
|
|
38531
38954
|
getUsersFunction.json()
|
|
38532
38955
|
getUsersFunction.params
|
|
38533
38956
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.token')
|
|
38534
38957
|
.query('page', { type: 'number', value: 1 })
|
|
38535
38958
|
.query('limit', { type: 'number', value: 10 })
|
|
38536
38959
|
// 2. POST request with body data and API key
|
|
38537
|
-
const createUserFunction = app.addFunction.rest({
|
|
38960
|
+
const createUserFunction = app.addFunction.rest({
|
|
38961
|
+
functionId: 'create-user',
|
|
38962
|
+
method: 'POST',
|
|
38963
|
+
url: 'https://api.example.com/users',
|
|
38964
|
+
})
|
|
38538
38965
|
createUserFunction.json()
|
|
38539
38966
|
createUserFunction.params.apiKey('=@ctx.solution.state.settings.apiKey').body('user', {
|
|
38540
38967
|
name: '=@ctx.components.name.state.value',
|
|
@@ -38542,7 +38969,11 @@
|
|
|
38542
38969
|
department: '=@ctx.solution.state.user.department',
|
|
38543
38970
|
})
|
|
38544
38971
|
// 3. Advanced configuration with output transformation and entity storage
|
|
38545
|
-
const getProductsFunction = app.addFunction.rest({
|
|
38972
|
+
const getProductsFunction = app.addFunction.rest({
|
|
38973
|
+
functionId: 'get-products',
|
|
38974
|
+
method: 'GET',
|
|
38975
|
+
url: 'https://api.example.com/products',
|
|
38976
|
+
})
|
|
38546
38977
|
getProductsFunction.json().outputTransform('$.data.products').entity('default/products')
|
|
38547
38978
|
getProductsFunction.params
|
|
38548
38979
|
.header('X-API-Version', '2.0')
|
|
@@ -38565,7 +38996,11 @@
|
|
|
38565
38996
|
response strategies
|
|
38566
38997
|
code: |-
|
|
38567
38998
|
// 1. Function with comprehensive error handling
|
|
38568
|
-
const syncDataFunction = app.addFunction.rest({
|
|
38999
|
+
const syncDataFunction = app.addFunction.rest({
|
|
39000
|
+
functionId: 'sync-data',
|
|
39001
|
+
method: 'POST',
|
|
39002
|
+
url: 'https://api.example.com/sync',
|
|
39003
|
+
})
|
|
38569
39004
|
syncDataFunction.json()
|
|
38570
39005
|
syncDataFunction.params.bearer('=@ctx.auth.accessToken').body('data', '=@ctx.pendingSync.data')
|
|
38571
39006
|
// Server error with retry
|
|
@@ -38598,7 +39033,11 @@
|
|
|
38598
39033
|
.icon('lock')
|
|
38599
39034
|
.notification(true)
|
|
38600
39035
|
// 2. Function with data conversion and error handling
|
|
38601
|
-
const uploadImageFunction = app.addFunction.rest({
|
|
39036
|
+
const uploadImageFunction = app.addFunction.rest({
|
|
39037
|
+
functionId: 'upload-image',
|
|
39038
|
+
method: 'POST',
|
|
39039
|
+
url: 'https://api.example.com/upload',
|
|
39040
|
+
})
|
|
38602
39041
|
uploadImageFunction.json().base64ToUri('image', 'uploaded-image.jpg')
|
|
38603
39042
|
uploadImageFunction.params
|
|
38604
39043
|
.header('Content-Type', 'application/json')
|
|
@@ -38633,7 +39072,11 @@
|
|
|
38633
39072
|
for mobile-optimized performance
|
|
38634
39073
|
code: |-
|
|
38635
39074
|
// 1. Paginated API with continuation logic
|
|
38636
|
-
const getOrdersFunction = app.addFunction.rest({
|
|
39075
|
+
const getOrdersFunction = app.addFunction.rest({
|
|
39076
|
+
functionId: 'get-orders',
|
|
39077
|
+
method: 'GET',
|
|
39078
|
+
url: 'https://api.example.com/orders',
|
|
39079
|
+
})
|
|
38637
39080
|
getOrdersFunction.json().outputTransform('$.orders').entity('default/orders')
|
|
38638
39081
|
getOrdersFunction.params
|
|
38639
39082
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.token')
|
|
@@ -38642,7 +39085,11 @@
|
|
|
38642
39085
|
// Continuation for next page
|
|
38643
39086
|
getOrdersFunction.continuation.when('=$.hasMore').url('=$.nextPageUrl')
|
|
38644
39087
|
// 2. Function with file conversion and row filtering
|
|
38645
|
-
const getCustomersFunction = app.addFunction.rest({
|
|
39088
|
+
const getCustomersFunction = app.addFunction.rest({
|
|
39089
|
+
functionId: 'get-customers',
|
|
39090
|
+
method: 'GET',
|
|
39091
|
+
url: 'https://api.example.com/customers',
|
|
39092
|
+
})
|
|
38646
39093
|
getCustomersFunction
|
|
38647
39094
|
.json()
|
|
38648
39095
|
.outputTransform('$.data.customers')
|
|
@@ -38654,7 +39101,11 @@
|
|
|
38654
39101
|
.query('includeInactive', { type: 'boolean', value: false })
|
|
38655
39102
|
.query('fields', { value: 'id,name,email,profileImage,status,lastLoginDays' })
|
|
38656
39103
|
// 3. Bulk data processing with transformation
|
|
38657
|
-
const getAnalyticsFunction = app.addFunction.rest({
|
|
39104
|
+
const getAnalyticsFunction = app.addFunction.rest({
|
|
39105
|
+
functionId: 'get-analytics',
|
|
39106
|
+
method: 'GET',
|
|
39107
|
+
url: 'https://api.example.com/analytics',
|
|
39108
|
+
})
|
|
38658
39109
|
getAnalyticsFunction.json().outputTransform('$.metrics')
|
|
38659
39110
|
getAnalyticsFunction.params
|
|
38660
39111
|
.query('dateFrom', { value: '=@ctx.jig.state.filter.startDate' })
|
|
@@ -38677,14 +39128,24 @@
|
|
|
38677
39128
|
construction, authentication, and XML response parsing
|
|
38678
39129
|
code: |-
|
|
38679
39130
|
// 1. Basic SOAP service call with authentication
|
|
38680
|
-
const getUserDetailsFunction = app.addFunction.soap({
|
|
39131
|
+
const getUserDetailsFunction = app.addFunction.soap({
|
|
39132
|
+
functionId: 'get-user-details',
|
|
39133
|
+
connection: 'legacy-service',
|
|
39134
|
+
method: 'GetUserDetails',
|
|
39135
|
+
wsdl: 'https://legacy-api.company.com/UserService.wsdl',
|
|
39136
|
+
})
|
|
38681
39137
|
getUserDetailsFunction.params
|
|
38682
39138
|
.header('SOAPAction', 'GetUserDetails')
|
|
38683
39139
|
.header('Authorization', 'Basic =@ctx.solution.state.auth.basicToken')
|
|
38684
39140
|
.body('UserId', '=@ctx.user.id')
|
|
38685
39141
|
.body('IncludeDetails', true)
|
|
38686
39142
|
// 2. SOAP service with complex parameters
|
|
38687
|
-
const createOrderFunction = app.addFunction.soap({
|
|
39143
|
+
const createOrderFunction = app.addFunction.soap({
|
|
39144
|
+
functionId: 'create-order',
|
|
39145
|
+
connection: 'erp-service',
|
|
39146
|
+
method: 'CreateOrder',
|
|
39147
|
+
wsdl: 'https://erp.company.com/OrderService.wsdl',
|
|
39148
|
+
})
|
|
38688
39149
|
createOrderFunction.params
|
|
38689
39150
|
.header('SOAPAction', 'CreateOrder')
|
|
38690
39151
|
.header('X-API-Key', '=@ctx.solution.state.settings.erpApiKey')
|
|
@@ -38696,7 +39157,12 @@
|
|
|
38696
39157
|
PaymentMethod: '=@ctx.jig.inputs.payment.method',
|
|
38697
39158
|
})
|
|
38698
39159
|
// 3. SOAP service with output transformation
|
|
38699
|
-
const getInventoryFunction = app.addFunction.soap({
|
|
39160
|
+
const getInventoryFunction = app.addFunction.soap({
|
|
39161
|
+
functionId: 'get-inventory',
|
|
39162
|
+
connection: 'wms-service',
|
|
39163
|
+
method: 'GetInventoryStatus',
|
|
39164
|
+
wsdl: 'https://wms.company.com/InventoryService.wsdl',
|
|
39165
|
+
})
|
|
38700
39166
|
getInventoryFunction
|
|
38701
39167
|
.outputTransform('$.Body.GetInventoryStatusResponse.InventoryItems.Item')
|
|
38702
39168
|
.entity('inventory')
|
|
@@ -38721,7 +39187,12 @@
|
|
|
38721
39187
|
authentication errors, and enterprise messaging patterns
|
|
38722
39188
|
code: |-
|
|
38723
39189
|
// 1. Enterprise service with comprehensive error handling
|
|
38724
|
-
const syncEmployeeDataFunction = app.addFunction.soap({
|
|
39190
|
+
const syncEmployeeDataFunction = app.addFunction.soap({
|
|
39191
|
+
functionId: 'sync-employee-data',
|
|
39192
|
+
connection: 'hr-service',
|
|
39193
|
+
method: 'SyncEmployeeData',
|
|
39194
|
+
wsdl: 'https://hr.company.com/EmployeeService.wsdl',
|
|
39195
|
+
})
|
|
38725
39196
|
syncEmployeeDataFunction.params
|
|
38726
39197
|
.header('SOAPAction', 'SyncEmployeeData')
|
|
38727
39198
|
.header('Authorization', 'Bearer =@ctx.solution.state.auth.enterpriseToken')
|
|
@@ -38754,7 +39225,12 @@
|
|
|
38754
39225
|
maxRetries: 2,
|
|
38755
39226
|
})
|
|
38756
39227
|
// 2. Legacy financial system integration
|
|
38757
|
-
const processPaymentFunction = app.addFunction.soap({
|
|
39228
|
+
const processPaymentFunction = app.addFunction.soap({
|
|
39229
|
+
functionId: 'process-payment',
|
|
39230
|
+
connection: 'finance-service',
|
|
39231
|
+
method: 'ProcessPayment',
|
|
39232
|
+
wsdl: 'https://finance.company.com/PaymentService.wsdl',
|
|
39233
|
+
})
|
|
38758
39234
|
processPaymentFunction.params
|
|
38759
39235
|
.header('SOAPAction', 'ProcessPayment')
|
|
38760
39236
|
.header('X-System-Id', 'MOBILE_APP')
|
|
@@ -38794,7 +39270,12 @@
|
|
|
38794
39270
|
integration, and enterprise data patterns
|
|
38795
39271
|
code: |-
|
|
38796
39272
|
// 1. Multi-step customer onboarding workflow
|
|
38797
|
-
const initiateCustomerOnboardingFunction = app.addFunction.soap({
|
|
39273
|
+
const initiateCustomerOnboardingFunction = app.addFunction.soap({
|
|
39274
|
+
functionId: 'initiate-customer-onboarding',
|
|
39275
|
+
connection: 'crm-service',
|
|
39276
|
+
method: 'InitiateOnboarding',
|
|
39277
|
+
wsdl: 'https://crm.company.com/OnboardingService.wsdl',
|
|
39278
|
+
})
|
|
38798
39279
|
initiateCustomerOnboardingFunction.outputTransform(
|
|
38799
39280
|
'$.Body.InitiateOnboardingResponse.OnboardingProcess',
|
|
38800
39281
|
)
|
|
@@ -38817,7 +39298,12 @@
|
|
|
38817
39298
|
ReferralSource: '=@ctx.jig.inputs.referral.source',
|
|
38818
39299
|
})
|
|
38819
39300
|
// 2. Document processing and approval workflow
|
|
38820
|
-
const submitDocumentForApprovalFunction = app.addFunction.soap({
|
|
39301
|
+
const submitDocumentForApprovalFunction = app.addFunction.soap({
|
|
39302
|
+
functionId: 'submit-document-approval',
|
|
39303
|
+
connection: 'workflow-service',
|
|
39304
|
+
method: 'SubmitForApproval',
|
|
39305
|
+
wsdl: 'https://workflow.company.com/ApprovalService.wsdl',
|
|
39306
|
+
})
|
|
38821
39307
|
submitDocumentForApprovalFunction.base64ToUri('documentContent', 'document.pdf')
|
|
38822
39308
|
submitDocumentForApprovalFunction.params
|
|
38823
39309
|
.header('SOAPAction', 'SubmitForApproval')
|
|
@@ -38834,7 +39320,12 @@
|
|
|
38834
39320
|
},
|
|
38835
39321
|
})
|
|
38836
39322
|
// 3. Complex reporting service with aggregated data
|
|
38837
|
-
const generateComplianceReportFunction = app.addFunction.soap({
|
|
39323
|
+
const generateComplianceReportFunction = app.addFunction.soap({
|
|
39324
|
+
functionId: 'generate-compliance-report',
|
|
39325
|
+
connection: 'compliance-service',
|
|
39326
|
+
method: 'GenerateComplianceReport',
|
|
39327
|
+
wsdl: 'https://compliance.company.com/ReportingService.wsdl',
|
|
39328
|
+
})
|
|
38838
39329
|
generateComplianceReportFunction.outputTransform(
|
|
38839
39330
|
'$.Body.GenerateComplianceReportResponse.ReportData.Sections',
|
|
38840
39331
|
)
|
|
@@ -38873,7 +39364,10 @@
|
|
|
38873
39364
|
input/output parameters
|
|
38874
39365
|
code: |-
|
|
38875
39366
|
// 1. Basic SELECT query with parameters
|
|
38876
|
-
const getCustomersFunction = app.addFunction.sql({
|
|
39367
|
+
const getCustomersFunction = app.addFunction.sql({
|
|
39368
|
+
functionId: 'get-customers',
|
|
39369
|
+
connection: 'customerDb',
|
|
39370
|
+
})
|
|
38877
39371
|
getCustomersFunction
|
|
38878
39372
|
.providerQuery('SELECT * FROM customers WHERE active = @active AND region = @region')
|
|
38879
39373
|
.entity('customers')
|
|
@@ -38881,7 +39375,11 @@
|
|
|
38881
39375
|
.input('active', 'boolean', { value: true })
|
|
38882
39376
|
.input('region', 'string', { value: '=@ctx.solution.state.user.region' })
|
|
38883
39377
|
// 2. Stored procedure with input and output parameters
|
|
38884
|
-
const updateCustomerFunction = app.addFunction.sql({
|
|
39378
|
+
const updateCustomerFunction = app.addFunction.sql({
|
|
39379
|
+
functionId: 'update-customer',
|
|
39380
|
+
connection: 'customerDb',
|
|
39381
|
+
method: 'execute',
|
|
39382
|
+
})
|
|
38885
39383
|
updateCustomerFunction.procedure('sp_UpdateCustomer')
|
|
38886
39384
|
updateCustomerFunction.params
|
|
38887
39385
|
.input('customerId', 'number', { value: '=@ctx.jig.inputs.customer.id' })
|
|
@@ -38890,7 +39388,10 @@
|
|
|
38890
39388
|
.output('result', 'string')
|
|
38891
39389
|
.output('affectedRows', 'number')
|
|
38892
39390
|
// 3. Complex query with data transformation
|
|
38893
|
-
const getOrderStatsFunction = app.addFunction.sql({
|
|
39391
|
+
const getOrderStatsFunction = app.addFunction.sql({
|
|
39392
|
+
functionId: 'get-order-stats',
|
|
39393
|
+
connection: 'analyticsDb',
|
|
39394
|
+
})
|
|
38894
39395
|
getOrderStatsFunction.providerQuery(`
|
|
38895
39396
|
SELECT
|
|
38896
39397
|
customerId,
|
|
@@ -38923,7 +39424,11 @@
|
|
|
38923
39424
|
handling of database constraints, locks, and file operations
|
|
38924
39425
|
code: |-
|
|
38925
39426
|
// 1. Insert operation with comprehensive error handling
|
|
38926
|
-
const createOrderFunction = app.addFunction.sql({
|
|
39427
|
+
const createOrderFunction = app.addFunction.sql({
|
|
39428
|
+
functionId: 'create-order',
|
|
39429
|
+
connection: 'ordersDb',
|
|
39430
|
+
method: 'execute',
|
|
39431
|
+
})
|
|
38927
39432
|
createOrderFunction.procedure('sp_CreateOrder')
|
|
38928
39433
|
createOrderFunction.params
|
|
38929
39434
|
.input('customerId', 'number', { value: '=@ctx.jig.inputs.customer.id' })
|
|
@@ -38949,7 +39454,10 @@
|
|
|
38949
39454
|
maxRetries: 3,
|
|
38950
39455
|
})
|
|
38951
39456
|
// 2. Function with file conversion and row operations
|
|
38952
|
-
const getProductsWithImagesFunction = app.addFunction.sql({
|
|
39457
|
+
const getProductsWithImagesFunction = app.addFunction.sql({
|
|
39458
|
+
functionId: 'get-products-with-images',
|
|
39459
|
+
connection: 'catalogDb',
|
|
39460
|
+
})
|
|
38953
39461
|
getProductsWithImagesFunction
|
|
38954
39462
|
.providerQuery('SELECT * FROM products WHERE categoryId = @categoryId')
|
|
38955
39463
|
.entity('products')
|
|
@@ -38959,7 +39467,11 @@
|
|
|
38959
39467
|
value: '=@ctx.current.item.category.id',
|
|
38960
39468
|
})
|
|
38961
39469
|
// 3. Bulk operation with table operations and conditions
|
|
38962
|
-
const syncInventoryFunction = app.addFunction.sql({
|
|
39470
|
+
const syncInventoryFunction = app.addFunction.sql({
|
|
39471
|
+
functionId: 'sync-inventory',
|
|
39472
|
+
connection: 'inventoryDb',
|
|
39473
|
+
method: 'execute',
|
|
39474
|
+
})
|
|
38963
39475
|
syncInventoryFunction.procedure('sp_SyncInventory')
|
|
38964
39476
|
syncInventoryFunction.params
|
|
38965
39477
|
.input('inventoryData', 'string', { value: '=JSON.stringify(@ctx.datasources.inventory)' })
|
|
@@ -38994,17 +39506,26 @@
|
|
|
38994
39506
|
operations
|
|
38995
39507
|
code: |-
|
|
38996
39508
|
// 1. Dynamic SELECT query with helper methods
|
|
38997
|
-
const getFilteredCustomersFunction = app.addFunction.sql({
|
|
39509
|
+
const getFilteredCustomersFunction = app.addFunction.sql({
|
|
39510
|
+
functionId: 'get-filtered-customers',
|
|
39511
|
+
connection: 'reportsDb',
|
|
39512
|
+
})
|
|
38998
39513
|
getFilteredCustomersFunction
|
|
38999
39514
|
.select(['id', 'name', 'email', 'region', 'lastOrderDate'], 'customers', 'active = @active')
|
|
39000
39515
|
.entity('customers')
|
|
39001
39516
|
getFilteredCustomersFunction.params.input('active', 'boolean', { value: true })
|
|
39002
39517
|
// 2. Simple SELECT ALL with conditions
|
|
39003
|
-
const getAllProductsFunction = app.addFunction.sql({
|
|
39518
|
+
const getAllProductsFunction = app.addFunction.sql({
|
|
39519
|
+
functionId: 'get-all-products',
|
|
39520
|
+
connection: 'catalogDb',
|
|
39521
|
+
})
|
|
39004
39522
|
getAllProductsFunction.selectAll('products', 'discontinued = @discontinued').entity('products')
|
|
39005
39523
|
getAllProductsFunction.params.input('discontinued', 'boolean', { value: false })
|
|
39006
39524
|
// 3. Complex analytics query
|
|
39007
|
-
const getSalesReportFunction = app.addFunction.sql({
|
|
39525
|
+
const getSalesReportFunction = app.addFunction.sql({
|
|
39526
|
+
functionId: 'get-sales-report',
|
|
39527
|
+
connection: 'analyticsDb',
|
|
39528
|
+
})
|
|
39008
39529
|
getSalesReportFunction.providerQuery(`
|
|
39009
39530
|
WITH monthly_sales AS (
|
|
39010
39531
|
SELECT
|
|
@@ -39032,7 +39553,11 @@
|
|
|
39032
39553
|
value: '=@ctx.jig.inputs.report.startDate',
|
|
39033
39554
|
})
|
|
39034
39555
|
// 4. Batch processing with file operations
|
|
39035
|
-
const processBatchUploadsFunction = app.addFunction.sql({
|
|
39556
|
+
const processBatchUploadsFunction = app.addFunction.sql({
|
|
39557
|
+
functionId: 'process-batch-uploads',
|
|
39558
|
+
connection: 'processingDb',
|
|
39559
|
+
method: 'execute',
|
|
39560
|
+
})
|
|
39036
39561
|
processBatchUploadsFunction.procedure('sp_ProcessBatch').uriToBase64('uploadFile')
|
|
39037
39562
|
processBatchUploadsFunction.params
|
|
39038
39563
|
.input('batchId', 'string', { value: '=@ctx.jig.inputs.batch.id' })
|
|
@@ -39053,7 +39578,11 @@
|
|
|
39053
39578
|
result expression
|
|
39054
39579
|
code: |-
|
|
39055
39580
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39056
|
-
const fn = app.addFunction.rest({
|
|
39581
|
+
const fn = app.addFunction.rest({
|
|
39582
|
+
functionId: 'test-function',
|
|
39583
|
+
method: 'POST',
|
|
39584
|
+
url: 'https://api.example.com/test',
|
|
39585
|
+
})
|
|
39057
39586
|
fn.guard('guard-function')
|
|
39058
39587
|
.parameters({
|
|
39059
39588
|
accessToken: 'acuerp',
|
|
@@ -39074,7 +39603,11 @@
|
|
|
39074
39603
|
tables with parameterized statements
|
|
39075
39604
|
code: |-
|
|
39076
39605
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39077
|
-
const fn = app.addFunction.rest({
|
|
39606
|
+
const fn = app.addFunction.rest({
|
|
39607
|
+
functionId: 'test-function',
|
|
39608
|
+
method: 'POST',
|
|
39609
|
+
url: 'https://api.example.com/test',
|
|
39610
|
+
})
|
|
39078
39611
|
const guard = fn
|
|
39079
39612
|
.guard('guard-function')
|
|
39080
39613
|
.parameters({ id: '=@ctx.parameters.id' })
|
|
@@ -39100,7 +39633,11 @@
|
|
|
39100
39633
|
replace records
|
|
39101
39634
|
code: |-
|
|
39102
39635
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39103
|
-
const fn = app.addFunction.rest({
|
|
39636
|
+
const fn = app.addFunction.rest({
|
|
39637
|
+
functionId: 'test-function',
|
|
39638
|
+
method: 'POST',
|
|
39639
|
+
url: 'https://api.example.com/test',
|
|
39640
|
+
})
|
|
39104
39641
|
const guard = fn.guard('guard-function').result('=true')
|
|
39105
39642
|
guard
|
|
39106
39643
|
.operation()
|
|
@@ -39117,7 +39654,11 @@
|
|
|
39117
39654
|
process response data
|
|
39118
39655
|
code: |-
|
|
39119
39656
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39120
|
-
const fn = app.addFunction.rest({
|
|
39657
|
+
const fn = app.addFunction.rest({
|
|
39658
|
+
functionId: 'test-function',
|
|
39659
|
+
method: 'GET',
|
|
39660
|
+
url: 'https://api.example.com/data',
|
|
39661
|
+
})
|
|
39121
39662
|
fn.operation('=@ctx.response.body.items').upsertMerge(
|
|
39122
39663
|
'items',
|
|
39123
39664
|
'=$map(@ctx.response.body.items, function($v) {$merge([$v, {"Remote": true}])})',
|
|
@@ -39133,7 +39674,11 @@
|
|
|
39133
39674
|
description: Configure function with root-level execute-sql operation to update local data
|
|
39134
39675
|
code: |-
|
|
39135
39676
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39136
|
-
const fn = app.addFunction.rest({
|
|
39677
|
+
const fn = app.addFunction.rest({
|
|
39678
|
+
functionId: 'test-function',
|
|
39679
|
+
method: 'GET',
|
|
39680
|
+
url: 'https://api.example.com/data',
|
|
39681
|
+
})
|
|
39137
39682
|
fn.operation().executeSql(
|
|
39138
39683
|
['items'],
|
|
39139
39684
|
'UPDATE items SET data = json_set(data, "$.Remote", false)',
|
|
@@ -39151,7 +39696,11 @@
|
|
|
39151
39696
|
execution based on parameters
|
|
39152
39697
|
code: |-
|
|
39153
39698
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39154
|
-
const fn = app.addFunction.rest({
|
|
39699
|
+
const fn = app.addFunction.rest({
|
|
39700
|
+
functionId: 'test-function',
|
|
39701
|
+
method: 'GET',
|
|
39702
|
+
url: 'https://api.example.com/data',
|
|
39703
|
+
})
|
|
39155
39704
|
fn.operation()
|
|
39156
39705
|
.when('=@ctx.parameters.deleteRequired = "y"')
|
|
39157
39706
|
.executeSql(['items'], 'DELETE FROM items WHERE json_extract(data, "$.Remote") is false')
|
|
@@ -39169,7 +39718,11 @@
|
|
|
39169
39718
|
and conditional execute-sql
|
|
39170
39719
|
code: |-
|
|
39171
39720
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39172
|
-
const fn = app.addFunction.rest({
|
|
39721
|
+
const fn = app.addFunction.rest({
|
|
39722
|
+
functionId: 'test-function',
|
|
39723
|
+
method: 'GET',
|
|
39724
|
+
url: 'https://api.example.com/data',
|
|
39725
|
+
})
|
|
39173
39726
|
fn.operation().upsertMerge('items', '=@ctx.response.body')
|
|
39174
39727
|
fn.operation()
|
|
39175
39728
|
.when('=@ctx.parameters.cleanup = true')
|
|
@@ -39224,7 +39777,11 @@
|
|
|
39224
39777
|
values from function execution
|
|
39225
39778
|
code: |-
|
|
39226
39779
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39227
|
-
const fn = app.addFunction.rest({
|
|
39780
|
+
const fn = app.addFunction.rest({
|
|
39781
|
+
functionId: 'test-function',
|
|
39782
|
+
method: 'POST',
|
|
39783
|
+
url: 'https://api.example.com/payment',
|
|
39784
|
+
})
|
|
39228
39785
|
fn.params
|
|
39229
39786
|
.body('amount', undefined, { type: 'number', required: true })
|
|
39230
39787
|
.output('prePaymentTransactionId', { type: 'string', required: false })
|
|
@@ -39242,7 +39799,11 @@
|
|
|
39242
39799
|
description: Configure guard with when condition to control when guard evaluation runs
|
|
39243
39800
|
code: |-
|
|
39244
39801
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39245
|
-
const fn = app.addFunction.rest({
|
|
39802
|
+
const fn = app.addFunction.rest({
|
|
39803
|
+
functionId: 'test-function',
|
|
39804
|
+
method: 'POST',
|
|
39805
|
+
url: 'https://api.example.com/test',
|
|
39806
|
+
})
|
|
39246
39807
|
fn.guard('guard-function').when('=@ctx.user.authenticated').result('=@ctx.guard.output.valid')
|
|
39247
39808
|
- id: function.guard-example-12
|
|
39248
39809
|
name: Guard with Retry and Continuation Lifecycle Options
|
|
@@ -39257,7 +39818,11 @@
|
|
|
39257
39818
|
robust sync workflows
|
|
39258
39819
|
code: |-
|
|
39259
39820
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39260
|
-
const fn = app.addFunction.rest({
|
|
39821
|
+
const fn = app.addFunction.rest({
|
|
39822
|
+
functionId: 'test-function',
|
|
39823
|
+
method: 'POST',
|
|
39824
|
+
url: 'https://api.example.com/test',
|
|
39825
|
+
})
|
|
39261
39826
|
fn.guard('guard-function').onRetry().onContinuation().result('=@ctx.guard.output.valid')
|
|
39262
39827
|
- id: function.guard-example-13
|
|
39263
39828
|
name: Guard with Dynamic onInitial Expression
|
|
@@ -39272,7 +39837,11 @@
|
|
|
39272
39837
|
initial guard evaluation
|
|
39273
39838
|
code: |-
|
|
39274
39839
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39275
|
-
const fn = app.addFunction.rest({
|
|
39840
|
+
const fn = app.addFunction.rest({
|
|
39841
|
+
functionId: 'test-function',
|
|
39842
|
+
method: 'POST',
|
|
39843
|
+
url: 'https://api.example.com/test',
|
|
39844
|
+
})
|
|
39276
39845
|
fn.guard('guard-function')
|
|
39277
39846
|
.onInitial('=@ctx.parameters.runGuard')
|
|
39278
39847
|
.result('=@ctx.guard.output.valid')
|
|
@@ -39288,7 +39857,11 @@
|
|
|
39288
39857
|
records in a table
|
|
39289
39858
|
code: |-
|
|
39290
39859
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39291
|
-
const fn = app.addFunction.rest({
|
|
39860
|
+
const fn = app.addFunction.rest({
|
|
39861
|
+
functionId: 'test-function',
|
|
39862
|
+
method: 'GET',
|
|
39863
|
+
url: 'https://api.example.com/data',
|
|
39864
|
+
})
|
|
39292
39865
|
fn.operation('=@ctx.response.body.items').upsertReplace('items', '=@ctx.response.body.items')
|
|
39293
39866
|
- id: function.guard-example-15
|
|
39294
39867
|
name: Function with Find-Replace Operation for Temp ID Resolution
|
|
@@ -39303,7 +39876,11 @@
|
|
|
39303
39876
|
server-assigned IDs across multiple tables including the command queue
|
|
39304
39877
|
code: |-
|
|
39305
39878
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39306
|
-
const fn = app.addFunction.rest({
|
|
39879
|
+
const fn = app.addFunction.rest({
|
|
39880
|
+
functionId: 'test-function',
|
|
39881
|
+
method: 'POST',
|
|
39882
|
+
url: 'https://api.example.com/data',
|
|
39883
|
+
})
|
|
39307
39884
|
fn.operation().findReplace(
|
|
39308
39885
|
'temp-id-123',
|
|
39309
39886
|
'=@ctx.response.body.id',
|
|
@@ -39323,7 +39900,11 @@
|
|
|
39323
39900
|
timestamp columns for conflict resolution
|
|
39324
39901
|
code: |-
|
|
39325
39902
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39326
|
-
const fn = app.addFunction.rest({
|
|
39903
|
+
const fn = app.addFunction.rest({
|
|
39904
|
+
functionId: 'test-function',
|
|
39905
|
+
method: 'GET',
|
|
39906
|
+
url: 'https://api.example.com/data',
|
|
39907
|
+
})
|
|
39327
39908
|
fn.operation('=@ctx.response.body')
|
|
39328
39909
|
.upsertMerge('items', '=@ctx.response.body')
|
|
39329
39910
|
.primaryKey('itemId')
|
|
@@ -39341,7 +39922,11 @@
|
|
|
39341
39922
|
formats during sync
|
|
39342
39923
|
code: |-
|
|
39343
39924
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39344
|
-
const fn = app.addFunction.rest({
|
|
39925
|
+
const fn = app.addFunction.rest({
|
|
39926
|
+
functionId: 'test-function',
|
|
39927
|
+
method: 'GET',
|
|
39928
|
+
url: 'https://api.example.com/data',
|
|
39929
|
+
})
|
|
39345
39930
|
fn.operation('=@ctx.response.body')
|
|
39346
39931
|
.upsertMerge('items', '=@ctx.response.body')
|
|
39347
39932
|
.conversions([{ property: 'image', from: 'base64', to: 'local-uri' }])
|
|
@@ -39358,7 +39943,11 @@
|
|
|
39358
39943
|
failed transactions from local tables
|
|
39359
39944
|
code: |-
|
|
39360
39945
|
const app = new ApplicationBuilder({ name: 'test-app' })
|
|
39361
|
-
const fn = app.addFunction.rest({
|
|
39946
|
+
const fn = app.addFunction.rest({
|
|
39947
|
+
functionId: 'test-function',
|
|
39948
|
+
method: 'POST',
|
|
39949
|
+
url: 'https://api.example.com/payment',
|
|
39950
|
+
})
|
|
39362
39951
|
fn.error('=@ctx.response.status = 500')
|
|
39363
39952
|
.operation('=@ctx.response.body')
|
|
39364
39953
|
.executeSql(
|
|
@@ -39407,7 +39996,11 @@
|
|
|
39407
39996
|
starting_after parameter and bearer token authentication
|
|
39408
39997
|
code: |-
|
|
39409
39998
|
const fn = app.addFunction
|
|
39410
|
-
.rest({
|
|
39999
|
+
.rest({
|
|
40000
|
+
functionId: 'stripe-api',
|
|
40001
|
+
method: 'GET',
|
|
40002
|
+
url: 'https://api.stripe.com/v1/customers',
|
|
40003
|
+
})
|
|
39411
40004
|
.json()
|
|
39412
40005
|
.bearerToken('=@ctx.solution.state.stripeApiKey')
|
|
39413
40006
|
fn.params.query('limit', { value: 100 })
|
|
@@ -39476,7 +40069,11 @@
|
|
|
39476
40069
|
notifications, data transformation, operations and retry logic
|
|
39477
40070
|
code: |-
|
|
39478
40071
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39479
|
-
const fn = app.addFunction.rest({
|
|
40072
|
+
const fn = app.addFunction.rest({
|
|
40073
|
+
functionId: 'comprehensive-api',
|
|
40074
|
+
method: 'GET',
|
|
40075
|
+
url: 'https://api.example.com/data',
|
|
40076
|
+
})
|
|
39480
40077
|
const errorHandler = fn
|
|
39481
40078
|
.error('=@ctx.response.status >= 500')
|
|
39482
40079
|
.title('Request Failed')
|
|
@@ -39508,7 +40105,11 @@
|
|
|
39508
40105
|
conditions and retry strategies
|
|
39509
40106
|
code: |-
|
|
39510
40107
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39511
|
-
const fn = app.addFunction.rest({
|
|
40108
|
+
const fn = app.addFunction.rest({
|
|
40109
|
+
functionId: 'api-with-errors',
|
|
40110
|
+
method: 'GET',
|
|
40111
|
+
url: 'https://api.example.com/data',
|
|
40112
|
+
})
|
|
39512
40113
|
fn.error(true).title('Default Error')
|
|
39513
40114
|
fn.error('=@ctx.response.status = 404').title('Not Found')
|
|
39514
40115
|
fn.error('=@ctx.response.status >= 500').title('Server Error').retry({ delay: 5000 })
|
|
@@ -39567,7 +40168,11 @@
|
|
|
39567
40168
|
description: Configure REST function pagination with continuation expressions
|
|
39568
40169
|
for hasNext and nextUrl
|
|
39569
40170
|
code: |-
|
|
39570
|
-
const fn = app.addFunction.rest({
|
|
40171
|
+
const fn = app.addFunction.rest({
|
|
40172
|
+
functionId: 'list-items',
|
|
40173
|
+
method: 'GET',
|
|
40174
|
+
url: 'https://api.example.com/items',
|
|
40175
|
+
})
|
|
39571
40176
|
fn.continuation.when(toExpression('=$.hasNext')).url(toExpression('=$.nextUrl'))
|
|
39572
40177
|
- id: function.rest-example-3
|
|
39573
40178
|
name: REST Function with Entity Storage and Data Conversions
|
|
@@ -39584,7 +40189,11 @@
|
|
|
39584
40189
|
from base64 to buffer and local URI
|
|
39585
40190
|
code: |-
|
|
39586
40191
|
app.addFunction
|
|
39587
|
-
.rest({
|
|
40192
|
+
.rest({
|
|
40193
|
+
functionId: 'get-products',
|
|
40194
|
+
method: 'GET',
|
|
40195
|
+
url: 'https://api.example.com/products',
|
|
40196
|
+
})
|
|
39588
40197
|
.entity('default/products')
|
|
39589
40198
|
.conversion('price', 'base64', 'buffer')
|
|
39590
40199
|
.conversion('image', 'base64', 'local-uri', 'product-image.jpg')
|
|
@@ -39684,7 +40293,12 @@
|
|
|
39684
40293
|
parameters and output transformation
|
|
39685
40294
|
code: |-
|
|
39686
40295
|
const fn = app.addFunction
|
|
39687
|
-
.soap({
|
|
40296
|
+
.soap({
|
|
40297
|
+
functionId: 'get-weather',
|
|
40298
|
+
connection: 'weather-service',
|
|
40299
|
+
method: 'GetWeather',
|
|
40300
|
+
wsdl: 'https://weather.com/wsdl',
|
|
40301
|
+
})
|
|
39688
40302
|
.outputTransform('$.Temperature')
|
|
39689
40303
|
fn.params.body('city', 'London').header('apiKey', 'secret-key')
|
|
39690
40304
|
- id: function.soap-example-2
|
|
@@ -39701,7 +40315,12 @@
|
|
|
39701
40315
|
storage for order processing
|
|
39702
40316
|
code: |-
|
|
39703
40317
|
app.addFunction
|
|
39704
|
-
.soap({
|
|
40318
|
+
.soap({
|
|
40319
|
+
functionId: 'create-order',
|
|
40320
|
+
connection: 'order-service',
|
|
40321
|
+
method: 'CreateOrder',
|
|
40322
|
+
wsdl: 'https://orders.com/wsdl',
|
|
40323
|
+
})
|
|
39705
40324
|
.inputTransform('="123"')
|
|
39706
40325
|
.entity('orders')
|
|
39707
40326
|
- id: function.soap-example-3
|
|
@@ -39719,7 +40338,12 @@
|
|
|
39719
40338
|
conversions for thumbnails and source images
|
|
39720
40339
|
code: |-
|
|
39721
40340
|
const fn = app.addFunction
|
|
39722
|
-
.soap({
|
|
40341
|
+
.soap({
|
|
40342
|
+
functionId: 'process-image',
|
|
40343
|
+
connection: 'image-service',
|
|
40344
|
+
method: 'ProcessImage',
|
|
40345
|
+
wsdl: 'https://image.com/wsdl',
|
|
40346
|
+
})
|
|
39723
40347
|
.base64ToUri('thumbnail', 'thumb.jpg')
|
|
39724
40348
|
.uriToBase64('source')
|
|
39725
40349
|
fn.params.body('image', '=@ctx.solution.state.imageData')
|
|
@@ -39738,7 +40362,12 @@
|
|
|
39738
40362
|
SOAP faults and network timeouts with retry logic
|
|
39739
40363
|
code: |-
|
|
39740
40364
|
const fn = app.addFunction
|
|
39741
|
-
.soap({
|
|
40365
|
+
.soap({
|
|
40366
|
+
functionId: 'weather-api',
|
|
40367
|
+
connection: 'weather-service',
|
|
40368
|
+
method: 'GetWeatherForecast',
|
|
40369
|
+
wsdl: 'https://weather.example.com/service?wsdl',
|
|
40370
|
+
})
|
|
39742
40371
|
.outputTransform('$.GetWeatherForecastResult')
|
|
39743
40372
|
fn.params
|
|
39744
40373
|
.body('city', '=@ctx.jig.inputs.location.city')
|
|
@@ -39775,7 +40404,8 @@
|
|
|
39775
40404
|
description: Create SQL query function for customers with boolean parameter and
|
|
39776
40405
|
entity storage
|
|
39777
40406
|
code: |-
|
|
39778
|
-
const fn = app.addFunction
|
|
40407
|
+
const fn = app.addFunction
|
|
40408
|
+
.sql({ functionId: 'get-customers', connection: 'mydb' })
|
|
39779
40409
|
.sql('SELECT * FROM customers WHERE active = @active')
|
|
39780
40410
|
fn.params.input('$active', 'boolean', { value: true })
|
|
39781
40411
|
fn.entity('customers')
|
|
@@ -39792,7 +40422,8 @@
|
|
|
39792
40422
|
description: Configure SQL function to execute stored procedure with input and
|
|
39793
40423
|
output parameters for customer updates
|
|
39794
40424
|
code: |-
|
|
39795
|
-
const fn = app.addFunction
|
|
40425
|
+
const fn = app.addFunction
|
|
40426
|
+
.sql({ functionId: 'update-customer', connection: 'mydb', method: 'execute' })
|
|
39796
40427
|
.sql('sp_UpdateCustomer', 'procedure')
|
|
39797
40428
|
fn.params
|
|
39798
40429
|
.input('$customerId', 'number', { value: 123 })
|
|
@@ -39811,7 +40442,8 @@
|
|
|
39811
40442
|
description: Generate SQL function with select helper for specific columns and
|
|
39812
40443
|
active status filter
|
|
39813
40444
|
code: |-
|
|
39814
|
-
const fn = app.addFunction
|
|
40445
|
+
const fn = app.addFunction
|
|
40446
|
+
.sql({ functionId: 'get-customers', connection: 'mydb' })
|
|
39815
40447
|
.select(['id', 'name', 'email'], 'customers', 'active = @active')
|
|
39816
40448
|
fn.params.input('active', 'boolean', { value: true })
|
|
39817
40449
|
- id: function.sql-example-4
|
|
@@ -39825,8 +40457,10 @@
|
|
|
39825
40457
|
- no-where-clause
|
|
39826
40458
|
description: Generate SQL function with select all helper to retrieve all
|
|
39827
40459
|
products without filtering
|
|
39828
|
-
code:
|
|
39829
|
-
|
|
40460
|
+
code: |-
|
|
40461
|
+
app.addFunction
|
|
40462
|
+
.sql({ functionId: 'get-all-products', connection: 'mydb' })
|
|
40463
|
+
.selectAll('products')
|
|
39830
40464
|
- id: function.sql-example-5
|
|
39831
40465
|
name: SQL Function with Select All Helper and WHERE Clause Filter
|
|
39832
40466
|
category: function
|
|
@@ -39840,7 +40474,8 @@
|
|
|
39840
40474
|
description: Generate SQL function with select all helper and status parameter
|
|
39841
40475
|
for active product filtering
|
|
39842
40476
|
code: |-
|
|
39843
|
-
const fn = app.addFunction
|
|
40477
|
+
const fn = app.addFunction
|
|
40478
|
+
.sql({ functionId: 'get-active-products', connection: 'mydb' })
|
|
39844
40479
|
.selectAll('products', 'status = @status')
|
|
39845
40480
|
fn.params.input('status', 'string', { value: 'active' })
|
|
39846
40481
|
- id: function.sql-example-6
|
|
@@ -39858,7 +40493,8 @@
|
|
|
39858
40493
|
description: Configure SQL order sync function with comprehensive database error
|
|
39859
40494
|
handling including constraint violations, lock errors and retry logic
|
|
39860
40495
|
code: |-
|
|
39861
|
-
const fn = app.addFunction
|
|
40496
|
+
const fn = app.addFunction
|
|
40497
|
+
.sql({ functionId: 'sync-orders', connection: 'orders_db' })
|
|
39862
40498
|
.sql(
|
|
39863
40499
|
'INSERT INTO orders (id, customer_id, total, status) VALUES (@id, @customer_id, @total, @status)',
|
|
39864
40500
|
)
|
|
@@ -39922,7 +40558,11 @@
|
|
|
39922
40558
|
description: Configure REST function header using branded ParameterName type
|
|
39923
40559
|
code: |-
|
|
39924
40560
|
const paramName = toParameterName('apiKey')
|
|
39925
|
-
const builder = app.addFunction.rest({
|
|
40561
|
+
const builder = app.addFunction.rest({
|
|
40562
|
+
functionId: 'test',
|
|
40563
|
+
method: 'GET',
|
|
40564
|
+
url: 'https://api.test.com',
|
|
40565
|
+
})
|
|
39926
40566
|
// Should not throw with valid parameter name
|
|
39927
40567
|
builder.params.header(paramName, 'secret')
|
|
39928
40568
|
- id: function-example-3
|
|
@@ -39943,7 +40583,11 @@
|
|
|
39943
40583
|
dependencies, and continuation support using config object
|
|
39944
40584
|
code: |-
|
|
39945
40585
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39946
|
-
const fn = app.addFunction.rest({
|
|
40586
|
+
const fn = app.addFunction.rest({
|
|
40587
|
+
functionId: 'config-query',
|
|
40588
|
+
method: 'GET',
|
|
40589
|
+
url: 'https://api.test.com',
|
|
40590
|
+
})
|
|
39947
40591
|
fn.query('items', {
|
|
39948
40592
|
statement: 'SELECT * FROM items WHERE active = 1',
|
|
39949
40593
|
resultType: 'records',
|
|
@@ -39967,7 +40611,11 @@
|
|
|
39967
40611
|
and scalar/record result type
|
|
39968
40612
|
code: |-
|
|
39969
40613
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39970
|
-
const fn = app.addFunction.rest({
|
|
40614
|
+
const fn = app.addFunction.rest({
|
|
40615
|
+
functionId: 'param-config-query',
|
|
40616
|
+
method: 'GET',
|
|
40617
|
+
url: 'https://api.test.com',
|
|
40618
|
+
})
|
|
39971
40619
|
fn.query('lookup', {
|
|
39972
40620
|
statement: 'SELECT * FROM items WHERE id = @id',
|
|
39973
40621
|
parameters: { id: '=@ctx.user.id' },
|
|
@@ -39984,7 +40632,11 @@
|
|
|
39984
40632
|
description: Set output expression to control what the function returns to its caller
|
|
39985
40633
|
code: |-
|
|
39986
40634
|
const app = new ApplicationBuilder({ name: 'test-application' })
|
|
39987
|
-
const fn = app.addFunction.rest({
|
|
40635
|
+
const fn = app.addFunction.rest({
|
|
40636
|
+
functionId: 'output-fn',
|
|
40637
|
+
method: 'GET',
|
|
40638
|
+
url: 'https://api.test.com',
|
|
40639
|
+
})
|
|
39988
40640
|
fn.output('=@ctx.response.body.result')
|
|
39989
40641
|
- id: screen.bottom-sheet-example-1
|
|
39990
40642
|
name: Bottom Sheet with Child Screens
|
|
@@ -40643,7 +41295,7 @@
|
|
|
40643
41295
|
template component
|
|
40644
41296
|
code: |-
|
|
40645
41297
|
const dynamicGridScreen = app.addScreen
|
|
40646
|
-
.dynamicGrid({ screenId: 'grid-1', title: 'Dynamic Grid'
|
|
41298
|
+
.dynamicGrid({ screenId: 'grid-1', title: 'Dynamic Grid' })
|
|
40647
41299
|
.data('=@ctx.datasources.dynamic')
|
|
40648
41300
|
// Add required item template
|
|
40649
41301
|
dynamicGridScreen.addControl.gridItem({ instanceId: 'item-1', size: '1x1' })
|
|
@@ -40663,7 +41315,7 @@
|
|
|
40663
41315
|
subtitle for dynamic content
|
|
40664
41316
|
code: |-
|
|
40665
41317
|
const dynamicGridWithWidget = app.addScreen
|
|
40666
|
-
.dynamicGrid({ screenId: 'dynamic-widget-test', title: 'Widget Test'
|
|
41318
|
+
.dynamicGrid({ screenId: 'dynamic-widget-test', title: 'Widget Test' })
|
|
40667
41319
|
.data('=@ctx.datasources.items') // Add required data
|
|
40668
41320
|
// Add required item template
|
|
40669
41321
|
dynamicGridWithWidget.addControl.gridItem({ instanceId: 'item-1', size: '1x1' })
|
|
@@ -40685,7 +41337,7 @@
|
|
|
40685
41337
|
data-bound items
|
|
40686
41338
|
code: |-
|
|
40687
41339
|
const screen = app.addScreen
|
|
40688
|
-
.dynamicGrid({ screenId: 'dynamic-item-test', title: 'Item Test'
|
|
41340
|
+
.dynamicGrid({ screenId: 'dynamic-item-test', title: 'Item Test' })
|
|
40689
41341
|
.data('=@ctx.datasources.items') // Add required data
|
|
40690
41342
|
screen.addControl.gridItem()
|
|
40691
41343
|
- id: screen.grid-dynamic-example-4
|
|
@@ -40703,7 +41355,7 @@
|
|
|
40703
41355
|
line chart series data
|
|
40704
41356
|
code: |-
|
|
40705
41357
|
const dynamicGridWithChart = app.addScreen
|
|
40706
|
-
.dynamicGrid({ screenId: 'dg', title: 'Dynamic Grid'
|
|
41358
|
+
.dynamicGrid({ screenId: 'dg', title: 'Dynamic Grid' })
|
|
40707
41359
|
.data('=@ctx.datasources.items') // Add required data
|
|
40708
41360
|
// Add item template and widget
|
|
40709
41361
|
dynamicGridWithChart.addControl.gridItem()
|
|
@@ -41579,7 +42231,7 @@
|
|
|
41579
42231
|
from solution state
|
|
41580
42232
|
code: |-
|
|
41581
42233
|
const gridWithDynamicSummary = app.addScreen
|
|
41582
|
-
.dynamicGrid({ screenId: 'dynamic-summary-test', title: 'Dynamic Summary'
|
|
42234
|
+
.dynamicGrid({ screenId: 'dynamic-summary-test', title: 'Dynamic Summary' })
|
|
41583
42235
|
.data('=@ctx.datasources.items')
|
|
41584
42236
|
gridWithDynamicSummary.addControl.gridItem({ size: '1x1' })
|
|
41585
42237
|
gridWithDynamicSummary.summary().addControl.default({
|
|
@@ -42023,7 +42675,9 @@
|
|
|
42023
42675
|
concurrency: 'parallel',
|
|
42024
42676
|
instanceId: 'load-data',
|
|
42025
42677
|
})
|
|
42026
|
-
const ds = screen.addDatasource
|
|
42678
|
+
const ds = screen.addDatasource
|
|
42679
|
+
.sqlite({ datasourceId: 'preferences', provider: 'local' })
|
|
42680
|
+
.entity('default/notifications')
|
|
42027
42681
|
onFocusAction.actions
|
|
42028
42682
|
.executeEntity({ instanceId: 'load-notifications' })
|
|
42029
42683
|
.dynamicData('default/notifications', 'update')
|
|
@@ -42690,7 +43344,11 @@
|
|
|
42690
43344
|
productPreview.title('Product Showcase')
|
|
42691
43345
|
productPreview.subtitle('Browse our product collection')
|
|
42692
43346
|
const productEntity = productPreview.addControl.entity({ instanceId: 'product-preview' })
|
|
42693
|
-
productEntity.addControl.entityField({
|
|
43347
|
+
productEntity.addControl.entityField({
|
|
43348
|
+
instanceId: 'name',
|
|
43349
|
+
label: 'Product Name',
|
|
43350
|
+
value: 'Premium Widget',
|
|
43351
|
+
})
|
|
42694
43352
|
productEntity.addControl.entityField({ instanceId: 'price', label: 'Price', value: '$99.99' })
|
|
42695
43353
|
// Dashboard screen with compact preview
|
|
42696
43354
|
const dashboard = app.addScreen.default({
|
|
@@ -44329,7 +44987,14 @@
|
|
|
44329
44987
|
instanceId: 'office-marker',
|
|
44330
44988
|
address: '=@ctx.current.item.address',
|
|
44331
44989
|
})
|
|
44332
|
-
officeMarker.with({
|
|
44990
|
+
officeMarker.with({
|
|
44991
|
+
radius: {
|
|
44992
|
+
value: 0.5,
|
|
44993
|
+
unit: 'kilometers',
|
|
44994
|
+
color: 'primary',
|
|
44995
|
+
isEnabled: '=@ctx.current.item.showCoverage',
|
|
44996
|
+
},
|
|
44997
|
+
})
|
|
44333
44998
|
officeMarker.addIcon({ icon: 'office-building-tall-1', color: 'info' })
|
|
44334
44999
|
// Create grid to display widgets (custom/static mode for map dashboard)
|
|
44335
45000
|
const staticGrid = screen.addControl.grid()
|