This document is going to document the elusive nature of executing code from the builder to make it less elusive and easy to do. Also as the thin client continues to grow we need to make a migration towards a new pattern on how we execute code. So going forward this education should be helpful.
The main issue with the current model is that as we increase the uses of the platform the current code execution framework cannot scale as the platform scales. For example the current interface to the execution framework looks like.
function(activeCase, user, toaster, validate, $http, $q, callback)
As we increase our usage we need to add new arguments to this code and then go back and change existing code to make sure we are matching the new patterns. This is just not scalable. Another issue is the interface to executing code is different in many things, lets consolidate the this into one interface that works for all scenarios.
function(activeCase, session, services, locals) {
...
}
//activeCase / activeAsset: the current case or asset depending on the context you are in.
//session: the current context of the person who is executing this code session has currently looks like
//services: see below
//locals: These are things that pertain to the individual thing executing the code, for example the checkoutDirective might put on some meta to help with the execution of code
- AccountService
- ApplicationService
- AssetService
- AssetMasterTemplateService
- AssetTemplateService
- CaseService
- DomainService
- GlobalSearchService
- IdpService
- MemorizeService
- NewportService
- OrderService
- PasswordService
- SKUService
- ShowdayService
- WorkflowService
- WorkflowTplService
- NotificationService
- getReport(guid) ⇒
*
⏏ get the report given a case guid
- getXReport(guid) ⇒
*
⏏ get a case given the guid or xguid
- getV2(id) ⇒
*
⏏ gets a doc by mongo id
- superDelete(id) ⇒
*
⏏ Deletes a case from the Db, only executable by a Super Admin
- superSave(id, body) ⇒
*
⏏ Saves a case to the Db, only executable by a Super Admin
- AccountService
- findByEmail(email) ⇒
*
⏏ - query(query) ⇒
*
⏏ - save(account) ⏏
- search(account) ⇒
*
⏏ - update(account) ⇒
*
⏏ - remove(account) ⇒
*
⏏ - findById(id, params) ⇒
*
⏏ - getV2(id) ⇒
*
⏏ - superSave(id, body) ⇒
*
⏏ - superDelete(id) ⇒
*
⏏ - getUsers(id) ⇒
*
⏏
- findByEmail(email) ⇒
find an account given an email
Kind: Exported function
Param |
---|
find an account given a query
Kind: Exported function
Param |
---|
query |
save an account and then update the current session
Kind: Exported function
Param |
---|
account |
Search using elasticsearch
Kind: Exported function
Param |
---|
account |
update an account
Kind: Exported function
Param |
---|
account |
remove an account
Kind: Exported function
Param |
---|
account |
find an account by id and additional optionsla params
Kind: Exported function
Param |
---|
id |
params |
gets a doc by mongo id
Kind: Exported function
Param | Description |
---|---|
id | mongo id |
Saves a Account from the DB, super admin only
Kind: Exported function
Param |
---|
id |
body |
Deletes a Account from the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
gets the users for a given account
Kind: Exported function
Param |
---|
id |
- ApplicationService
- findById(id, params) ⇒
Application
⏏ - byType(type) ⇒
*
⏏ - query(params) ⇒
*
⏏ - create(application) ⇒
*
⏏ - update(application) ⇒
*
⏏ - remove(application) ⇒
*
⏏ - paged(params) ⇒
*
⏏ - populate(ids) ⇒
*
⏏ - getV2(id) ⇒
*
⏏ - superSave(id, body) ⇒
*
⏏ - superDelete(id) ⇒
*
⏏
- findById(id, params) ⇒
finds an application given an ID
Kind: Exported function
Param |
---|
id |
params |
finds a service by its type
Kind: Exported function
Param |
---|
type |
queries the DB bringing a paged output back
Kind: Exported function
Param |
---|
params |
Creates an application
Kind: Exported function
Param |
---|
application |
updates an application
Kind: Exported function
Param |
---|
application |
removes an application
Kind: Exported function
Param |
---|
application |
gets a pages list of Services
Kind: Exported function
Param | Type |
---|---|
params | Object |
returns a hashmap of services with the key being the id
Kind: Exported function
Param | Type | Description |
---|---|---|
ids | Array.<string> |
a list of ids |
gets a doc by mongo id
Kind: Exported function
Param | Description |
---|---|
id | mongo id |
Deletes a Service from the DB, super admin only
Kind: Exported function
Param |
---|
id |
body |
Deletes a Service from the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
- AssetService
- save(asset) ⇒
*
⏏ - query(queryParams) ⇒
*
⏏ - paged(queryParams) ⇒
*
⏏ - create(asset) ⇒
*
⏏ - countTypes(subtypes) ⇒
*
⏏ - remove(asset) ⇒
*
⏏ - aggregation(aggregation, [domainWide]) ⇒
Array.<Object>
⏏ aggregate(pipeline) ⇒*
⏏- findById(id, params) ⇒
*
⏏ - populateGuids(guids) ⇒
*
⏏ - createAsset(user, selections) ⇒
newAsset
⏏
- save(asset) ⇒
Saves an Asset
Kind: Exported function
Param |
---|
asset |
Query's for an asset
Kind: Exported function
Param |
---|
queryParams |
querys for an asset bringing a paged list back
Kind: Exported function
Param |
---|
queryParams |
Create an asset
Kind: Exported function
Param |
---|
asset |
Given an array of subtypes bring back a count of each subtype
Kind: Exported function
Param |
---|
subtypes |
remove an asset
Kind: Exported function
Param |
---|
asset |
Send an aggregation pipeline to return asset data
Kind: Exported function
Param | Type | Default | Description |
---|---|---|---|
aggregation | Array.<Object> |
the aggregation pipeline | |
[domainWide] | boolean |
false |
Executes the aggregation domainWide |
Deprecated
Send an aggregation pipeline to return asset data
Kind: Exported function
Param |
---|
pipeline |
Find an asset by guid
Kind: Exported function
Param | Description |
---|---|
id | is a guid |
params |
Given a list of guids bring back the assets for those guids
Kind: Exported function
Param |
---|
guids |
create an asset given a assetTemplate
Kind: Exported function
Param |
---|
user |
selections |
- AssetMasterTemplateService
- findById(id) ⇒
*
⏏ - create(template) ⇒
*
⏏ - query(searchParams) ⇒
*
⏏ - getByType(type) ⇒
*
⏏
- findById(id) ⇒
find an asset master template by Id
Kind: Exported function
Param |
---|
id |
Create an asset Master Template
Kind: Exported function
Param |
---|
template |
query for an asset master template
Kind: Exported function
Param |
---|
searchParams |
get an asset master template by type
Kind: Exported function
Param |
---|
type |
- AssetTemplateService
- create(template) ⇒
*
⏏ - update(template) ⇒
*
⏏ - createFromMaster(masterTemplate, accountId, domainId) ⇒
*
⏏ - findById(id) ⇒
*
⏏ - updateById(id, body) ⇒
*
⏏ - query(params) ⇒
*
⏏ - deleteById(id) ⇒
*
⏏ - getByType(type, params) ⇒
*
⏏ - getByAccount(accountId, params) ⇒
*
⏏
- create(template) ⇒
Create an asset template
Kind: Exported function
Param |
---|
template |
update an asset template
Kind: Exported function
Param |
---|
template |
create an asset template from a master template
Kind: Exported function
Param |
---|
masterTemplate |
accountId |
domainId |
find an asset template by id
Kind: Exported function
Param |
---|
id |
update an asset template by id
Kind: Exported function
Param |
---|
id |
body |
query for an asset template
Kind: Exported function
Param |
---|
params |
delete an asset template
Kind: Exported function
Param |
---|
id |
get by a type
Kind: Exported function
Param |
---|
type |
params |
get asset templates by account
Kind: Exported function
Param |
---|
accountId |
params |
- CaseService
- populate(ids) ⇒
*
⏏ - superDelete(id) ⇒
*
⏏ - superSave(id, body) ⇒
*
⏏ - getV2(id) ⇒
*
⏏ - create(workflow, data, name) ⇒
*
⏏ - leanQuery(query) ⇒
*
⏏ - get(guid) ⇒
*
⏏ aggregation(aggregation) ⇒*
⏏- aggregationV2(aggregation, [domainWide]) ⇒
*
⏏ - aggregationV2Binary(aggregation, fields, fieldNames, outputFormat) ⇒
*
⏏ - aggregationV2Email(aggregation, fields, fieldNames, outputFormat, email) ⇒
*
⏏ - trello(query) ⇒
*
⏏ aggregate(pipeline) ⇒*
⏏- save(aCase, useV1) ⇒
*
⏏ - paged(params) ⇒
*
⏏ - query(query, [projection]) ⇒
*
⏏ - remove(aCase) ⇒
*
⏏ - createStateChangeOptions(nextStates, srcState) ⏏
- populate(ids) ⇒
given a list of ids bring back the docs
Kind: Exported function
Param | Type | Description |
---|---|---|
ids | Array.<Object> |
the ids of the objects to bring back |
Deletes a case from the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
Saves a case to the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
body |
gets a doc by mongo id
Kind: Exported function
Param | Description |
---|---|
id | mongo id |
Creates a case
Kind: Exported function
Param |
---|
workflow |
data |
name |
Brings a minified set of props of a case
Kind: Exported function
Param |
---|
query |
get a case by guid
Kind: Exported function
Param |
---|
guid |
Deprecated
send an aggregation pipeline
Kind: Exported function
Param |
---|
aggregation |
send an aggregation pipeline
Kind: Exported function
Param | Type | Default | Description |
---|---|---|---|
aggregation | Array.<Object> |
the aggregation pipeline | |
[domainWide] | boolean |
false |
Executes the aggregation domainWide |
returns an aggregation in binary
Kind: Exported function
Param |
---|
aggregation |
fields |
fieldNames |
outputFormat |
sends an aggregation to an email
Kind: Exported function
Param |
---|
aggregation |
fields |
fieldNames |
outputFormat |
Trello view for workspace call
Kind: Exported function
Param |
---|
query |
Deprecated
send an aggregation pipeline
Kind: Exported function
Param |
---|
pipeline |
save a case
Kind: Exported function
Param |
---|
aCase |
useV1 |
get a paged list of cases
Kind: Exported function
Param |
---|
params |
query for a case
Kind: Exported function
Param |
---|
query |
[projection] |
remove a case
Kind: Exported function
Param |
---|
aCase |
creates a map of state changes a current case can do
Kind: Exported function
Param |
---|
nextStates |
srcState |
- DomainService
- superDelete(id) ⇒
*
⏏ - superSave(id, body) ⇒
*
⏏ - populate(ids) ⇒
*
⏏ - paged(params) ⇒
*
⏏ - getV2(id) ⇒
*
⏏
- superDelete(id) ⇒
Deletes a case from the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
Saves a case to the Db, only executable by a Super Admin
Kind: Exported function
Param |
---|
id |
body |
Given a list of ids bring back docs
Kind: Exported function
Param | Type | Description |
---|---|---|
ids | Array.<string> |
a list of ids |
Returns a paged object
Kind: Exported function
Param |
---|
params |
gets a doc by mongo id
Kind: Exported function
Param | Description |
---|---|
id | mongo id |
finds an application given an ID
Kind: Exported function
Param | Description |
---|---|
query | a search query |
creates an IDP account
Kind: Exported function
Param |
---|
password |
other |
updates an Idp Account
Kind: Exported function
Param |
---|
userId |
data |
- MemorizeService
- query(query) ⇒
*
⏏ - save(memorizeObject) ⇒
*
⏏ - create(memorizeObject) ⇒
*
⏏
- query(query) ⇒
query for memorizes
Kind: Exported function
Param |
---|
query |
save a memorize
Kind: Exported function
Param |
---|
memorizeObject |
create a memorize object
Kind: Exported function
Param |
---|
memorizeObject |
- OrderService
- findById(id, params) ⇒
*
⏏ - create(order) ⇒
*
⏏ - pay(order) ⇒
*
⏏ - manual(order) ⇒
*
⏏ - update(order) ⇒
*
⏏
- findById(id, params) ⇒
find an order by id
Kind: Exported function
Param |
---|
id |
params |
Create an order
Kind: Exported function
Param |
---|
order |
pay an order
Kind: Exported function
Param |
---|
order |
Manually pay an order
Kind: Exported function
Param |
---|
order |
update an order
Kind: Exported function
Param |
---|
order |
- PasswordService
- reset(email) ⇒
*
⏏ - activate(token, password) ⇒
*
⏏
- reset(email) ⇒
reset a password given an email
Kind: Exported function
Param |
---|
activate a password
Kind: Exported function
Param |
---|
token |
password |
Finds a sku by id
Kind: Exported function
Param |
---|
id |
params |
create a showday membership
Kind: Exported function
Param |
---|
asset |
accountId |
determines if the horse name is taken
Kind: Exported function
Param |
---|
name |
get similar horse names
Kind: Exported function
Param |
---|
name |
- WorkflowService
- create(template) ⇒
*
⏏ - update(template) ⇒
*
⏏ - findById(id, params) ⇒
*
⏏ - query(query) ⇒
*
⏏ - getByAccount(accountId) ⇒
*
⏏ - getByType(type, params) ⇒
*
⏏ - list() ⇒
*
⏏
- create(template) ⇒
create a workflow
Kind: Exported function
Param |
---|
template |
update a workflow
Kind: Exported function
Param |
---|
template |
find a workflow by id
Kind: Exported function
Param |
---|
id |
params |
query for a workflow
Kind: Exported function
Param |
---|
query |
get workflows by account
Kind: Exported function
Param |
---|
accountId |
get a workflow by type
Kind: Exported function
Param |
---|
type |
params |
list workflows
- WorkflowTplService
- findById(id) ⇒
*
⏏ - create(template) ⇒
*
⏏ - getByType(type) ⇒
*
⏏
- findById(id) ⇒
Find a workflow template by id
Kind: Exported function
Param |
---|
id |
create a workflow template
Kind: Exported function
Param |
---|
template |
get workflow templates by type
Kind: Exported function
Param |
---|
type |
Creates a toast
Kind: Exported function
Param |
---|
msg |
Creates an alert
Kind: Exported function
Param |
---|
msg |
Kind: Exported function
Param | Type | Default |
---|---|---|
msg | ||
[params] | Object |
|
[params.title] | string |
"Are you sure" |
[params.okTest] | string |
"Ok" |
[params.cancelText] | string |
"Cancel" |