liveapicreator-admin-cli
Version:
The NodeJS command line utility for 'CA Live API Creator' DevOps Administration from CA Technologies
142 lines • 6.83 kB
JSON
{
"{d}test": {
"{f}exportoptions.json": {
"passwordStyle": "SKIP",
"apiOptionStyle": "EMIT_ALL",
"authTokenStyle": "SKIP_AUTO",
"skipUrlFragmentWrapping": false,
"libraryStyle": "EMIT_ALL",
"schemaCacheStyle": "DO_NOT_EMIT",
"filters": {
"key": [
"rules"
]
}
},
"{d}rules": {
"{f}ReadMe.md": "This folder contains definitions for rules\n",
"{d}demo": {
"{f}ReadMe.md": "Rules for entities in prefix demo",
"{d}customer": {
"{f}event_citylookup.json": {
"name": "event_citylookup",
"entity": "customer",
"isActive": false,
"ruleType": "event",
"asynchronous": false,
"appliesTo": {
"insert": true,
"update": true,
"delete": false
},
"codeType": "JavaScript",
"isAutoTitle": false,
"title": "Lookup city and state from zip code",
"comments": null,
"topics": []
},
"{f}event_citylookup.js": "var detail = {\n filter: \"{_id: \\\"32751\\\"}\" ,\n order: \"\",\n pagesize: 30,\n offset: 0,\n verbose: false\n};\n\nvar response = SysUtility.getResource('zipcodes', detail);\nlog.debug(JSON.stringify(response,null,2));\nlog.debug(response[0].state);\nlog.debug(response[0].city);\n//log.debug(response[0].loc);\n",
"{f}sum_balance.json": {
"name": "sum_balance",
"entity": "customer",
"isActive": true,
"ruleType": "sum",
"attribute": "balance",
"roleToChildren": "PurchaseOrderList",
"childAttribute": "amount_total",
"qualification": "paid = false",
"isJIT": false,
"isAutoTitle": true,
"title": "balance = sum(PurchaseOrderList.amount_total where paid = false)",
"comments": "A rule is like a spreadsheet cell formula... it *reacts\" to changes in referenced data...\n* increased when order placed\n* decreased when order deleted... or paid\n* adjusted when order changed... or assigned to a new customer",
"topics": []
},
"{f}validation_balance.json": {
"name": "validation_balance",
"entity": "customer",
"isActive": true,
"ruleType": "validation",
"codeType": "JavaScript",
"errorMessage": "Customer {name}'s balance: {balance|#,##0.00} exceeds their credit limit: {credit_limit|#,##0.00}",
"problemAttributes": [],
"isAutoTitle": true,
"title": "Validation: return row.balance <= row.credit_limit;",
"comments": "balance cannot exceed credit limit, else throw exception",
"topics": []
},
"{f}validation_balance.js": "return row.balance <= row.credit_limit;\n"
},
"{d}LineItem": {
"{f}formula_amount.json": {
"name": "formula_amount",
"entity": "LineItem",
"isActive": true,
"ruleType": "formula",
"attribute": "amount",
"codeType": "JavaScript",
"isJIT": false,
"isAutoTitle": false,
"title": "Discounted price*qty",
"comments": "Reactive Logic is expressed in JavaScript, so you use...\n- conditional logic (as above),\n- standard JavaScript services (e.g., moment date functions - enable in Project > Libraries),\n- SQL / external services.... whatever is required.",
"topics": []
},
"{f}formula_amount.js": "if (row.qty_ordered <= 6) // discount (using conditional JavaScript logic)\n return row.product_price * row.qty_ordered;\nelse\n return row.product_price * row.qty_ordered * 0.8;\n",
"{f}parentCopy_product_price.json": {
"name": "parentCopy_product_price",
"entity": "LineItem",
"isActive": true,
"ruleType": "parentCopy",
"attribute": "product_price",
"roleToParent": "product",
"parentAttribute": "price",
"isAutoTitle": true,
"title": "product_price = parentcopy(product.price)",
"comments": "Parent copy means order unaffected by product price changes",
"topics": []
}
},
"{d}PurchaseOrder": {
"{f}event_audit_amount.json": {
"name": "event_audit_amount",
"entity": "PurchaseOrder",
"isActive": true,
"ruleType": "event",
"asynchronous": false,
"appliesTo": {
"insert": false,
"update": true,
"delete": false
},
"codeType": "JavaScript",
"isAutoTitle": false,
"title": "Audit Purchase Order amount changes",
"comments": "row, logicContext passed in from engine; initialVerb is *client* action (e.g., POST), irrespective of subsequent updates (e.g., from item adjustments)\nearly events execute before reactive expressions, events execute after reactive expressions, commit events execute after all rows are processed",
"topics": []
},
"{f}event_audit_amount.js": "if (row.amount_total != oldRow.amount_total) {\n var newPurchaseorder_audit = logicContext.createPersistentBean(\"demo:purchaseorder_audit\");\n newPurchaseorder_audit.amount_total = oldRow.amount_total; // set attributes from old values\n newPurchaseorder_audit.paid = oldRow.paid;\n newPurchaseorder_audit.customer_name = oldRow.customer_name;\n newPurchaseorder_audit.order_number = oldRow.order_number; // set the foreign key\n logicContext.insert(newPurchaseorder_audit); // saves (fires logic)\n}\n// better: re-use alternative using Loadable Libraries\n// if (row.amount_total != oldRow.amount_total)\n// SysLogic.insertChildFrom(\"purchaseorder_audit\", logicContext);\n",
"{f}sum_amount_total.json": {
"name": "sum_amount_total",
"entity": "PurchaseOrder",
"isActive": true,
"ruleType": "sum",
"attribute": "amount_total",
"roleToChildren": "LineItemList",
"childAttribute": "amount",
"qualification": null,
"isJIT": false,
"isAutoTitle": true,
"title": "amount_total = sum(LineItemList.amount)",
"comments": "sum of line item amounts",
"topics": []
}
}
},
"{d}finance": {
"{f}ReadMe.md": "Rules for entities in prefix finance"
},
"{d}mdemo": {
"{f}ReadMe.md": "Rules for entities in prefix mdemo"
}
}
}
}