stitch-ui
Version:
658 lines (648 loc) • 19.5 kB
JavaScript
import React from "react";
const generalExpansions = (
<div className="section" id="general">
<h2>General</h2>
<p>
The following expansions are available in any pipeline stage or rule in
any Stitch app.
</p>
<table border="1" className="docutils">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr className="row-odd">
<th className="head">Name</th>
<th className="head">Type</th>
<th className="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%true">
<code className="descname">%%true</code>
</dt>
<dd />
</dl>
</td>
<td>boolean</td>
<td>True.</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%false">
<code className="descname">%%false</code>
</dt>
<dd />
</dl>
</td>
<td>boolean</td>
<td>False.</td>
</tr>
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%user">
<code className="descname">%%user</code>
</dt>
<dd />
</dl>
</td>
<td>document</td>
<td>
Holds user information. See
<a className="reference internal" href="#user-object">
<span className="std std-ref">%%user object</span>
</a>.
</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%values">
<code className="descname">%%values</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>
Expand a value (e.g.
<code className="docutils literal">
<span className="pre">%%values.foo</span>
</code>)
</td>
</tr>
</tbody>
</table>
</div>
);
const stageSpecificExpansions = (
<div className="section" id="stage-specific">
<h2>Stage-Specific</h2>
<p>
For use within a
<code className="docutils literal">
<span className="pre"> let</span>
</code>
statement. These expansions can be used in any stage except those that do
not accept items as input (either single items or lists of items). Lists
of items can include literal expressions or the results of MongoDB read
operations.
</p>
<table border="1" className="docutils">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr className="row-odd">
<th className="head">Name</th>
<th className="head">Type</th>
<th className="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%args">
<code className="descname">%%args</code>
</dt>
<dd />
</dl>
</td>
<td>document</td>
<td>Arguments passed to the current pipeline stage.</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%item">
<code className="descname">%%item</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>Item currently exposed to pipeline stage.</td>
</tr>
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%vars">
<code className="descname">%%vars</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>
Contains the results of a
<code className="docutils literal">
<span className="pre"> let</span>
</code>
statement, which can be passed as arguments to a pipeline.
</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%pipelines">
<code className="descname">%%pipelines</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>
Expand a pipeline (e.g.
<code className="docutils literal">
<span className="pre"> %%piplines.my_pipeline</span>
</code>)
</td>
</tr>
</tbody>
</table>
</div>
);
const mongoDBSpecificExpansions = (
<div className="section" id="mongodb-specific">
<h2>MongoDB-Specific</h2>
<p>
The following expansions are for use in MongoDB <link> rules.
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%this </span>
</code>
and
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%prev </span>
</code>
represent document fields, while
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%root </span>
</code>
and
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %prevRoot </span>
</code>
represent documents.
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%prev </span>
</code>
and
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%prevRoot </span>
</code>
represent the original values of fields and documents which are changed
during a stage which includes write operations.
</p>
<table border="1" className="docutils">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr className="row-odd">
<th className="head">Name</th>
<th className="head">Type</th>
<th className="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%this">
<code className="descname">%%this</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>Field value as it exists at the end of a database operation.</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%root">
<code className="descname">%%root</code>
</dt>
<dd />
</dl>
</td>
<td>document</td>
<td>
Root document as it exists at the end of a database operation.
</td>
</tr>
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%prev">
<code className="descname">%%prev</code>
</dt>
<dd />
</dl>
</td>
<td>any</td>
<td>
Field value referenced in a rules expression before it is changed by
a write operation (<code className="docutils literal">
<span className="pre">insert</span>
</code>,
<code className="docutils literal">
<span className="pre"> update</span>
</code>,
<code className="docutils literal">
<span className="pre"> delete</span>
</code>).
</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%prevRoot">
<code className="descname">%%prevRoot</code>
</dt>
<dd />
</dl>
</td>
<td>document</td>
<td>
Root document referenced in a rules expression before it is changed
by a write operation.
</td>
</tr>
</tbody>
</table>
</div>
);
const userObjectExpansions = (
<div className="section" id="the-user-object">
<h2 id="user-object">
The
<code className="docutils literal">
<span className="pre"> %%user </span>
</code>
Object
</h2>
<p>
The
<code className="xref mongodb mongodb-expansion docutils literal">
<span className="pre"> %%user </span>
</code>
object has several fields with information about the app user.
</p>
<table border="1" className="docutils">
<colgroup>
<col width="33%" />
<col width="33%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr className="row-odd">
<th className="head">Name</th>
<th className="head">Type</th>
<th className="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%user.id">
<code className="descclassname">%%user.</code>
<code className="descname">id</code>
</dt>
<dd />
</dl>
</td>
<td>String</td>
<td>User’s ID.</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%user.type">
<code className="descclassname">%%user.</code>
<code className="descname">type</code>
</dt>
<dd />
</dl>
</td>
<td>String</td>
<td>
Evaluates to
<code className="docutils literal">
<span className="pre">
{"server"}
</span>
</code>
if the user request comes via an API key. Evaluates to
<code className="docutils literal">
<span className="pre">
{"normal"}
</span>
</code>
for other user requests (via OAuth2, SAML, local, or anonymous).
</td>
</tr>
<tr className="row-even">
<td>
<dl className="first last expansion">
<dt id="%%user.data">
<code className="descclassname">%%user.</code>
<code className="descname">data</code>
</dt>
<dd />
</dl>
</td>
<td>document</td>
<td>
User metadata, including name and email (via login authentication).
</td>
</tr>
<tr className="row-odd">
<td>
<dl className="first last expansion">
<dt id="%%user.identities">
<code className="descclassname">%%user.</code>
<code className="descname">identities</code>
</dt>
<dd />
</dl>
</td>
<td>array</td>
<td>
A list of all identities associated with a Stitch user. An identity
consists of a unique identifier given to a user by an authorization
provider along with the provider’s name.
</td>
</tr>
</tbody>
</table>
</div>
);
const s3Rules = (
<div>
<p>You can use the following arguments in S3 service rules.</p>
<div className="section" id="bucket">
<h3>
<code className="docutils literal">
<span className="pre">bucket</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> bucket </span>
</code>
argument is a string that corresponds to the S3 bucket name.
</p>
</div>
<div className="section" id="key">
<h3>
<code className="docutils literal">
<span className="pre">key</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> key </span>
</code>
argument is a string that corresponds to the object key, or
<em> key name</em>, which uniquely identifies the object in the bucket;
i.e. the path to the object in the bucket.
</p>
</div>
<div className="section" id="acl">
<h3>
<code className="docutils literal">
<span className="pre">acl</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> acl </span>
</code>
argument is a string that corresponds to the access control list (ACL)
permissions. The value can be one of the following strings:
</p>
<ul className="simple">
<li>
<code className="docutils literal">
<span className="pre">
{'"private"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"public-read"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"public-read-write"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"aws-exec-read"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"authenticated-read"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"bucket-owner-read"'}
</span>
</code>
</li>
<li>
<code className="docutils literal">
<span className="pre">
{'"bucket-owner-full-control"'}
</span>
</code>
</li>
</ul>
</div>
<div className="section" id="contenttype">
<h3>
<code className="docutils literal">
<span className="pre">contentType</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> contentType </span>
</code>
argument is a string that corresponds to the MIME type of the content,
such as
<code className="docutils literal">
<span className="pre"> text/plain </span>
</code>
or
<code className="docutils literal">
<span className="pre"> audio/mpeg </span>
</code>.
</p>
</div>
</div>
);
const sesRules = (
<div>
<p>You can use the following arguments in SES service rules.</p>
<div className="section" id="toAddress">
<h3>
<code className="docutils literal">
<span className="pre">toAddress</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> toAddress </span>
</code>
argument is a string that corresponds to the destination email address.
</p>
</div>
<div className="section" id="fromAddress">
<h3>
<code className="docutils literal">
<span className="pre">fromAddress</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> fromAddress </span>
</code>
argument is a string that corresponds to the originating email address.
</p>
</div>
<div className="section" id="subject">
<h3>
<code className="docutils literal">
<span className="pre">subject</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> subject </span>
</code>
argument is a string that corresponds to the subject of the message.
</p>
</div>
<div className="section" id="body">
<h3>
<code className="docutils literal">
<span className="pre">body</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> body </span>
</code>
argument is a string that corresponds to the body of the message.
</p>
</div>
</div>
);
const twilioRules = (
<div>
<p>You can use the following action arguments in Twilio service rules.</p>
<div className="section" id="to">
<h3>
<code className="docutils literal">
<span className="pre">to</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> to </span>
</code>
argument is a string that corresponds to the destination phone number in
E.164 format, such as {'"+15551112222"'}.
</p>
</div>
<div className="section" id="from">
<h3>
<code className="docutils literal">
<span className="pre">from</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> from </span>
</code>
argument is a string that corresponds to the originating phone number in
E.164 format, such as {'"+15551112222"'}.
</p>
</div>
<div className="section" id="body">
<h3>
<code className="docutils literal">
<span className="pre">body</span>
</code>
</h3>
<p>
The
<code className="docutils literal">
<span className="pre"> body </span>
</code>
argument is a string that corresponds to the body of the message.
</p>
</div>
</div>
);
const refPageSections = {
pipeline: [generalExpansions, stageSpecificExpansions, userObjectExpansions],
"mongodb-expansion": [
generalExpansions,
mongoDBSpecificExpansions,
userObjectExpansions
],
"aws-s3": [s3Rules, generalExpansions, userObjectExpansions],
"aws-ses": [sesRules, generalExpansions, userObjectExpansions],
http: [generalExpansions, userObjectExpansions],
twilio: [twilioRules, generalExpansions, userObjectExpansions],
default: [generalExpansions, userObjectExpansions]
};
export default function(refPage) {
return (
<div className="popout-window">
{refPageSections[refPage]
? refPageSections[refPage].map(e => e)
: refPageSections.default.map(e => e)}
</div>
);
}