feat: 文档目录结构更新

This commit is contained in:
miaosiyu 2023-12-03 21:09:35 +08:00
parent 6b891817c7
commit 95cc9c2797
22 changed files with 555 additions and 4375 deletions

View File

@ -1,7 +0,0 @@
#### Access
[toc]
##### deny(message)
权限拒绝
* message 提示消息

View File

@ -1,14 +0,0 @@
## 函数事件流函数
```js
function(event, op) {
}
```
### 参数
* event [FunctionEvent](./FunctionEvent.md)
事件,函数上下文
* op [Operation](./Operation.md)
操作,函数操作

View File

@ -1,7 +0,0 @@
#### FunctionEvent
##### user [User](./User.md)
用户
##### request [Request](./Request.md)
请求

View File

@ -1,11 +0,0 @@
#### Notification
[toc]
##### sendEmail(to, title, content)
发送电子邮件
* to 对方e-mail地址
* title 发送邮件的标题
* content 邮件内容

View File

@ -1,268 +0,0 @@
#### Operation
[toc]
##### notifycation [Notification](./Notification.md)
通知类
##### access [Access](./Access.md)
通道管理类
##### api [IDaasApi](./IDaasApi.md)
接口类
##### request(config)
请求网络方法
* config 请求参数
```json
{
// `url` is the server URL that will be used for the request
url: '/user',
// `method` is the request method to be used when making the request
method: 'get', // default
// `baseURL` will be prepended to `url` unless `url` is absolute.
// It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
// to methods of that instance.
baseURL: 'https://some-domain.com/api/',
// `transformRequest` allows changes to the request data before it is sent to the server
// This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
// The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
// FormData or Stream
// You may modify the headers object.
transformRequest: [function (data, headers) {
// Do whatever you want to transform the data
return data;
}],
// `transformResponse` allows changes to the response data to be made before
// it is passed to then/catch
transformResponse: [function (data) {
// Do whatever you want to transform the data
return data;
}],
// `headers` are custom headers to be sent
headers: {'X-Requested-With': 'XMLHttpRequest'},
// `params` are the URL parameters to be sent with the request
// Must be a plain object or a URLSearchParams object
params: {
ID: 12345
},
// `paramsSerializer` is an optional config that allows you to customize serializing `params`.
paramsSerializer: {
//Custom encoder function which sends key/value pairs in an iterative fashion.
encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
// Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour.
serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
//Configuration for formatting array indexes in the params.
indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
},
// `data` is the data to be sent as the request body
// Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH'
// When no `transformRequest` is set, must be of one of the following types:
// - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
// - Browser only: FormData, File, Blob
// - Node only: Stream, Buffer, FormData (form-data package)
data: {
firstName: 'Fred'
},
// syntax alternative to send data into the body
// method post
// only the value is sent, not the key
data: 'Country=Brasil&City=Belo Horizonte',
// `timeout` specifies the number of milliseconds before the request times out.
// If the request takes longer than `timeout`, the request will be aborted.
timeout: 1000, // default is `0` (no timeout)
// `withCredentials` indicates whether or not cross-site Access-Control requests
// should be made using credentials
withCredentials: false, // default
// `adapter` allows custom handling of requests which makes testing easier.
// Return a promise and supply a valid response (see lib/adapters/README.md).
adapter: function (config) {
/* ... */
},
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
// This will set an `Authorization` header, overwriting any existing
// `Authorization` custom headers you have set using `headers`.
// Please note that only HTTP Basic auth is configurable through this parameter.
// For Bearer tokens and such, use `Authorization` custom headers instead.
auth: {
username: 'janedoe',
password: 's00pers3cret'
},
// `responseType` indicates the type of data that the server will respond with
// options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
// browser only: 'blob'
responseType: 'json', // default
// `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
// Note: Ignored for `responseType` of 'stream' or client-side requests
responseEncoding: 'utf8', // default
// `xsrfCookieName` is the name of the cookie to use as a value for xsrf token
xsrfCookieName: 'XSRF-TOKEN', // default
// `xsrfHeaderName` is the name of the http header that carries the xsrf token value
xsrfHeaderName: 'X-XSRF-TOKEN', // default
// `undefined` (default) - set XSRF header only for the same origin requests
withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
// `onUploadProgress` allows handling of progress events for uploads
// browser & node.js
onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
// Do whatever you want with the Axios progress event
},
// `onDownloadProgress` allows handling of progress events for downloads
// browser & node.js
onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) {
// Do whatever you want with the Axios progress event
},
// `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
maxContentLength: 2000,
// `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
maxBodyLength: 2000,
// `validateStatus` defines whether to resolve or reject the promise for a given
// HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
// or `undefined`), the promise will be resolved; otherwise, the promise will be
// rejected.
validateStatus: function (status) {
return status >= 200 && status < 300; // default
},
// `maxRedirects` defines the maximum number of redirects to follow in node.js.
// If set to 0, no redirects will be followed.
maxRedirects: 21, // default
// `beforeRedirect` defines a function that will be called before redirect.
// Use this to adjust the request options upon redirecting,
// to inspect the latest response headers,
// or to cancel the request by throwing an error
// If maxRedirects is set to 0, `beforeRedirect` is not used.
beforeRedirect: (options, { headers }) => {
if (options.hostname === "example.com") {
options.auth = "user:password";
}
},
// `socketPath` defines a UNIX Socket to be used in node.js.
// e.g. '/var/run/docker.sock' to send requests to the docker daemon.
// Only either `socketPath` or `proxy` can be specified.
// If both are specified, `socketPath` is used.
socketPath: null, // default
// `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects.
transport: undefined, // default
// `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
// and https requests, respectively, in node.js. This allows options to be added like
// `keepAlive` that are not enabled by default.
httpAgent: new http.Agent({ keepAlive: true }),
httpsAgent: new https.Agent({ keepAlive: true }),
// `proxy` defines the hostname, port, and protocol of the proxy server.
// You can also define your proxy using the conventional `http_proxy` and
// `https_proxy` environment variables. If you are using environment variables
// for your proxy configuration, you can also define a `no_proxy` environment
// variable as a comma-separated list of domains that should not be proxied.
// Use `false` to disable proxies, ignoring environment variables.
// `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
// supplies credentials.
// This will set an `Proxy-Authorization` header, overwriting any existing
// `Proxy-Authorization` custom headers you have set using `headers`.
// If the proxy server uses HTTPS, then you must set the protocol to `https`.
proxy: {
protocol: 'https',
host: '127.0.0.1',
// hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined
port: 9000,
auth: {
username: 'mikeymike',
password: 'rapunz3l'
}
},
// `cancelToken` specifies a cancel token that can be used to cancel the request
// (see Cancellation section below for details)
cancelToken: new CancelToken(function (cancel) {
}),
// an alternative way to cancel Axios requests using AbortController
signal: new AbortController().signal,
// `decompress` indicates whether or not the response body should be decompressed
// automatically. If set to `true` will also remove the 'content-encoding' header
// from the responses objects of all decompressed responses
// - Node only (XHR cannot turn off decompression)
decompress: true, // default
// `insecureHTTPParser` boolean.
// Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
// This may allow interoperability with non-conformant HTTP implementations.
// Using the insecure parser should be avoided.
// see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
// see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
insecureHTTPParser: undefined, // default
// transitional options for backward compatibility that may be removed in the newer versions
transitional: {
// silent JSON parsing mode
// `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
// `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json')
silentJSONParsing: true, // default value for the current Axios version
// try to parse the response string as JSON even if `responseType` is not 'json'
forcedJSONParsing: true,
// throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
clarifyTimeoutError: false,
},
env: {
// The FormData class to be used to automatically serialize the payload into a FormData object
FormData: window?.FormData || global?.FormData
},
formSerializer: {
visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values
dots: boolean; // use dots instead of brackets format
metaTokens: boolean; // keep special endings like {} in parameter key
indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
},
// http adapter only (node.js)
maxRate: [
100 * 1024, // 100KB/s upload limit,
100 * 1024 // 100KB/s download limit
]
}
```
##### utils [Utils](./Utils.md)

64
README.md Normal file
View File

@ -0,0 +1,64 @@
# Flow / 同步组件文档
## op
`op` 是为函数事件流、同步组件等一系列场景所提供的工具,可以使用它请求一系列 IDMesh 接口,使用它进行一系列数据处理等等。
``` js
const onSyncTask = async (config, env, op, eventData) => {
op.api.init('<AK>', '<SK>');
op.api.user.disable({ id: '<User_ID>' });
};
```
### IDMesh 接口封装
op.api 封装了一系列 IDMesh 的接口请求。
详情参见:[op.api 文档](./op/API.md)
### 通知类
op.notification 封装了通知操作。
详情参见:[op.notification 文档](./op/Notification.md)
### 网路请求
op.request 封装了网络请求方法,你可以使用它调用第三方接口。
详情参见:[op.request 文档](./op/Request.md)
### 工具类
op.utils 封装了一系列工具方法。
详情参见:[op.utils 文档](./op/Utils.md)
### Access 访问控制
op.access 封装了访问控制操作。
详情参见:[op.access 文档](./op/Access.md)
### 日志打印
使用 log 方法打印日志:
``` js
const onSyncTask = async (config, env, op, eventData) => {
op.api.init('<AK>', '<SK>');
const { data } = await op.api.user.disable({ id: '<User_ID>' });
log('用户禁用请求返回', new Date().toISOString(), data);
};
```
## Flow 场景文档
详情参见:[op.access 文档](./flow/README.md)

View File

@ -1,3 +0,0 @@
#### Request
TODO

View File

@ -1,3 +0,0 @@
#### User
TODO

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
#### Authentication
[toc]

View File

@ -1,768 +0,0 @@
### UserApi
[toc]
#### create(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>username</td>
<td>string</td>
<td>false</td>
<td>用户名,唯一,不传后台自动生成</td>
</tr>
<tr>
<td>password</td>
<td>string</td>
<td>false</td>
<td>密码,不传后台生成默认密码</td>
</tr>
<tr>
<td>display_name</td>
<td>string</td>
<td>false</td>
<td>显示名称</td>
</tr>
<tr>
<td>firstname</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>lastname</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>realname</td>
<td>string</td>
<td>false</td>
<td>真实姓名</td>
</tr>
<tr>
<td>pinyin</td>
<td>string</td>
<td>false</td>
<td>拼音</td>
</tr>
<tr>
<td>nickname</td>
<td>string</td>
<td>false</td>
<td>昵称</td>
</tr>
<tr>
<td>user_type</td>
<td>string</td>
<td>false</td>
<td>用户类型,不传后台设置系统默认类型</td>
</tr>
<tr>
<td>mobile</td>
<td>string</td>
<td>false</td>
<td>手机</td>
</tr>
<tr>
<td>email</td>
<td>string</td>
<td>false</td>
<td>邮箱</td>
</tr>
<tr>
<td>gender</td>
<td>string</td>
<td>false</td>
<td>性别</td>
</tr>
<tr>
<td>cert_type</td>
<td>string</td>
<td>false</td>
<td>证件类型</td>
</tr>
<tr>
<td>cert_number</td>
<td>string</td>
<td>false</td>
<td>证件号</td>
</tr>
<tr>
<td>region</td>
<td>string</td>
<td>false</td>
<td>区域</td>
</tr>
<tr>
<td>work_time</td>
<td>string</td>
<td>false</td>
<td>加入时间</td>
</tr>
<tr>
<td>work_title</td>
<td>string</td>
<td>false</td>
<td>职位</td>
</tr>
<tr>
<td>ext_prop</td>
<td>json</td>
<td>false</td>
<td>扩展信息json对象{&#34;age&#34;: 18, &#34;love&#34;: &#34;足球&#34;}</td>
</tr>
<tr>
<td>status</td>
<td>string</td>
<td>false</td>
<td>状态1正常0禁用后期扩展离职、休假、借调。</td>
</tr>
<tr>
<td>password_status</td>
<td>string</td>
<td>false</td>
<td>密码状态valid/invalid</td>
</tr>
<tr>
<td>idp_config_id</td>
<td>number</td>
<td>true</td>
<td>身份源ID作为创建时记录不做更新</td>
</tr>
</tbody>
</table>
#### disable(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### enable(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### batchDisable(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>ids</td>
<td>array</td>
<td>true</td>
<td></td>
</tr>
</tbody>
</table>
#### batchEnable(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>ids</td>
<td>array</td>
<td>true</td>
<td></td>
</tr>
</tbody>
</table>
#### modify(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>username</td>
<td>string</td>
<td>false</td>
<td>用户名,验证唯一</td>
</tr>
<tr>
<td>password</td>
<td>string</td>
<td>false</td>
<td>密码</td>
</tr>
<tr>
<td>display_name</td>
<td>string</td>
<td>false</td>
<td>显示名称</td>
</tr>
<tr>
<td>firstname</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>lastname</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>realname</td>
<td>string</td>
<td>false</td>
<td>真实姓名</td>
</tr>
<tr>
<td>pinyin</td>
<td>string</td>
<td>false</td>
<td>拼音</td>
</tr>
<tr>
<td>nickname</td>
<td>string</td>
<td>false</td>
<td>昵称</td>
</tr>
<tr>
<td>mobile</td>
<td>string</td>
<td>false</td>
<td>手机</td>
</tr>
<tr>
<td>email</td>
<td>string</td>
<td>false</td>
<td>邮箱</td>
</tr>
<tr>
<td>gender</td>
<td>string</td>
<td>false</td>
<td>性别1男0女</td>
</tr>
<tr>
<td>cert_type</td>
<td>string</td>
<td>false</td>
<td>证件类型</td>
</tr>
<tr>
<td>cert_number</td>
<td>string</td>
<td>false</td>
<td>证件号</td>
</tr>
<tr>
<td>region</td>
<td>string</td>
<td>false</td>
<td>区域</td>
</tr>
<tr>
<td>work_time</td>
<td>string</td>
<td>false</td>
<td>加入时间</td>
</tr>
<tr>
<td>work_title</td>
<td>string</td>
<td>false</td>
<td>职位</td>
</tr>
<tr>
<td>ext_prop</td>
<td>json</td>
<td>false</td>
<td>扩展信息json对象{&#34;age&#34;: 18, &#34;love&#34;: &#34;足球&#34;}</td>
</tr>
<tr>
<td>last_login_ipaddr</td>
<td>string</td>
<td>false</td>
<td>上次登录IP</td>
</tr>
<tr>
<td>last_login_time</td>
<td>string</td>
<td>false</td>
<td>上次登录时间</td>
</tr>
<tr>
<td>status</td>
<td>string</td>
<td>false</td>
<td>状态,正常、禁用,后期扩展:离职、休假、借调。</td>
</tr>
</tbody>
</table>
#### delete(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### batchDelete(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>ids</td>
<td>array</td>
<td>true</td>
<td></td>
</tr>
</tbody>
</table>
#### list(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<tr>
<td>page_size</td>
<td>integer</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>page_num</td>
<td>integer</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>search_type</td>
<td>string</td>
<td>false</td>
<td>默认按用户字段搜索当值为generic时全文检索</td>
</tr>
<tr>
<td>keyword</td>
<td>string</td>
<td>false</td>
<td>检索值</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### get(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### modifyPassword(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>old_password</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>new_password</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
</tbody>
</table>
#### getStoredCredentials(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<tr>
<td>user_id</td>
<td>number</td>
<td>false</td>
<td>用户id标识</td>
</tr>
<tr>
<td>provider_code</td>
<td>string</td>
<td>false</td>
<td>社会化登录提供者的code</td>
</tr>
<tr>
<td>idp_config_id</td>
<td>number</td>
<td>false</td>
<td>社会化登录配置的ID</td>
</tr>
<tr>
<td>id1</td>
<td>string</td>
<td>false</td>
<td>社会化身份标识1约定此字段保存用户唯一标识如openid</td>
</tr>
<tr>
<td>id2</td>
<td>string</td>
<td>false</td>
<td>社会化身份标识2如unionid</td>
</tr>
<tr>
<td>metadata</td>
<td>string</td>
<td>false</td>
<td>更多社会化身份标识</td>
</tr>
<tr>
<td>status</td>
<td>string</td>
<td>false</td>
<td>状态</td>
</tr>
<tr>
<td>username</td>
<td>string</td>
<td>false</td>
<td>用户名</td>
</tr>
<tr>
<td>display_name</td>
<td>string</td>
<td>false</td>
<td>显示名</td>
</tr>
<tr>
<td>page_size</td>
<td>integer</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>page_num</td>
<td>integer</td>
<td>false</td>
<td></td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### createStoreCredential(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>provider_code</td>
<td>string</td>
<td>false</td>
<td>社会化身份源code</td>
</tr>
<tr>
<td>id1</td>
<td>string</td>
<td>false</td>
<td>社会化身份标识1如openid</td>
</tr>
<tr>
<td>id2</td>
<td>string</td>
<td>false</td>
<td>社会化身份标识2如unionid</td>
</tr>
<tr>
<td>metadata</td>
<td>string</td>
<td>false</td>
<td>更多社会化身份标识</td>
</tr>
<tr>
<td>status</td>
<td>string</td>
<td>false</td>
<td>状态</td>
</tr>
<tr>
<td>nickname</td>
<td>string</td>
<td>false</td>
<td>昵称</td>
</tr>
<tr>
<td>avatar</td>
<td>string</td>
<td>false</td>
<td>头像</td>
</tr>
<tr>
<td>id_provider_connection</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>idp_config_id</td>
<td>number</td>
<td>false</td>
<td>社会化登录配置的ID</td>
</tr>
<tr>
<td>realname</td>
<td>string</td>
<td>false</td>
<td>真实姓名</td>
</tr>
<tr>
<td>mobile</td>
<td>string</td>
<td>false</td>
<td>手机</td>
</tr>
<tr>
<td>email</td>
<td>string</td>
<td>false</td>
<td>邮箱</td>
</tr>
<tr>
<td>gender</td>
<td>string</td>
<td>false</td>
<td>性别</td>
</tr>
</tbody>
</table>

View File

@ -1,726 +0,0 @@
### OrganizationApi
[toc]
#### createOrganization(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### getNodeParent(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### deleteNode(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<tr>
<td>object_code</td>
<td>string</td>
<td>true</td>
<td>树对象code</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### getOrganizations(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### updateOrganization(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### getOrganization(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<tr>
<td>code</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### deleteOrganization(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### addUserToNode(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>relation_data</td>
<td>string</td>
<td>false</td>
<td>关联扩展信息</td>
</tr>
<tr>
<td>relation_type</td>
<td>string</td>
<td>false</td>
<td>用于区分多重关联</td>
</tr>
<tr>
<td>is_default</td>
<td>string</td>
<td>false</td>
<td>1是0否</td>
</tr>
<tr>
<td>node_id</td>
<td>string</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td>user_ids</td>
<td>array</td>
<td>false</td>
<td></td>
</tr>
</tbody>
</table>
#### updateMember(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td></td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>is_default</td>
<td>string</td>
<td>false</td>
<td>1是0否</td>
</tr>
<tr>
<td>action</td>
<td>string</td>
<td>true</td>
<td>移动节点move, 设置为默认关系as-default</td>
</tr>
<tr>
<td>source_node_id</td>
<td>string</td>
<td>false</td>
<td>移动前节点ID</td>
</tr>
<tr>
<td>dest_node_id</td>
<td>string</td>
<td>false</td>
<td>移动后节点ID</td>
</tr>
</tbody>
</table>
#### getMembers(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<tr>
<td>user_id</td>
<td>string</td>
<td>true</td>
<td>用户ID</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### getNodeMembers(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td>node id</td>
</tr>
<!-- query 参数 -->
<tr>
<td>relation_type</td>
<td>string</td>
<td>false</td>
<td>关联类型,用于区分多重关联</td>
</tr>
<tr>
<td>is_default</td>
<td>string</td>
<td>false</td>
<td>是否默认关系 1是0否</td>
</tr>
<tr>
<td>display_name</td>
<td>string</td>
<td>false</td>
<td>用户显示名</td>
</tr>
<tr>
<td>username</td>
<td>string</td>
<td>false</td>
<td>用户名,支持模糊搜索(仅前缀)</td>
</tr>
<tr>
<td>mode</td>
<td>string</td>
<td>false</td>
<td>// mode - 低-&gt;高 bit
// 第1位是否获得指针节点所对应的真实结点1-是0-否
// 第2位是否展开WeakNode即节点中类型不同的节点1-展开0-不展开
// 第3位是否递归地展开节点不建议</td>
</tr>
<tr>
<td>page_num</td>
<td>integer</td>
<td>false</td>
<td>起始页默认1</td>
</tr>
<tr>
<td>page_size</td>
<td>integer</td>
<td>false</td>
<td>页大小默认10</td>
</tr>
<tr>
<td>page_sort</td>
<td>string</td>
<td>false</td>
<td>排序方式,格式:字段[排序方式]</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### deleteNodeMembers(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>node_id</td>
<td>string</td>
<td>true</td>
<td>node id</td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>ids</td>
<td>array</td>
<td>true</td>
<td></td>
</tr>
</tbody>
</table>
#### deleteMember(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td>用户节点ID</td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>ids</td>
<td>array</td>
<td>false</td>
<td>用户与组织的关系ID</td>
</tr>
<tr>
<td>node_id</td>
<td>string</td>
<td>false</td>
<td>节点ID</td>
</tr>
<tr>
<td>user_id</td>
<td>string</td>
<td>false</td>
<td>用户原始ID</td>
</tr>
</tbody>
</table>
#### deleteMembers(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
<tr>
<td>node_id</td>
<td>string</td>
<td>false</td>
<td>节点ID</td>
</tr>
<tr>
<td>user_id</td>
<td>string</td>
<td>false</td>
<td>用户原始ID</td>
</tr>
</tbody>
</table>
#### createNode(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### updateNode(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td>更新树节点</td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### deleteChildrenNodes(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<tr>
<td>object_code</td>
<td>string</td>
<td>true</td>
<td>树对象code</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### getNodes(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<!-- query 参数 -->
<tr>
<td>object_code</td>
<td>string</td>
<td>true</td>
<td>创建树时的object_code</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>false</td>
<td>名字,支持前缀搜索</td>
</tr>
<tr>
<td>code</td>
<td>string</td>
<td>false</td>
<td>编号</td>
</tr>
<tr>
<td>tag</td>
<td>string</td>
<td>false</td>
<td>标签</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>
#### getNode(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<!-- body 参数 -->
</tbody>
</table>
#### getChildrenNodes(param)
##### param properties
<table class="param-table">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>是否必须</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<!-- path 参数 -->
<tr>
<td>id</td>
<td>string</td>
<td>true</td>
<td></td>
</tr>
<!-- query 参数 -->
<tr>
<td>mode</td>
<td>string</td>
<td>true</td>
<td>// mode - 低-&gt;高 bit
// 第1位是否获得指针节点所对应的真实结点1-是0-否
// 第2位是否展开WeakNode即节点中类型不同的节点1-展开0-不展开
// 第3位是否递归地展开节点不建议</td>
</tr>
<tr>
<td>object_code</td>
<td>string</td>
<td>true</td>
<td>当id = 0时必填创建树时的object_code</td>
</tr>
<!-- body 参数 -->
</tbody>
</table>

File diff suppressed because it is too large Load Diff

9
flow/FunctionEvent.md Normal file
View File

@ -0,0 +1,9 @@
# FunctionEvent
## user [User](./events/User.md)
用户
## request [Request](./events/Request.md)
请求

13
flow/README.md Normal file
View File

@ -0,0 +1,13 @@
# 函数事件流函数
```js
function(event, op) {
//
}
```
## 参数说明
* event事件既函数上下文。具体请参见 [FunctionEvent](./FunctionEvent.md)
* op封装的一系列工具方法。具体请参见 [op 文档](../README.md)

3
flow/events/Request.md Normal file
View File

@ -0,0 +1,3 @@
# Request
TODO

3
flow/events/User.md Normal file
View File

@ -0,0 +1,3 @@
# User
TODO

File diff suppressed because it is too large Load Diff

18
op/Access.md Normal file
View File

@ -0,0 +1,18 @@
# Access
op.access 封装了访问控制方法。
## 权限拒绝
`deny(message)`
参数说明:
* message 提示消息
``` js
const onSyncTask = async (config, env, op, eventData) => {
op.access.deny('<message>');
// 调用 deny 会抛出异常,之后的代码将不会执行
};
```

20
op/Notification.md Normal file
View File

@ -0,0 +1,20 @@
# Notification
通知
## 发送电子邮件
`sendEmail(to, title, content)`
参数说明:
* to对方的 email 地址
* title邮件标题
* content邮件内容
``` js
const onSyncTask = async (config, env, op, eventData) => {
op.notification.sendEmail('<to@email.com>', '<mail_title>', 'mail_content');
};
```

37
op/Request.md Normal file
View File

@ -0,0 +1,37 @@
# Request
op.request 提供了 http 请求的封装。
## 参数说明
``` js
{
// 请求接口
url: '/api/user',
// 请求方法
method: 'get',
headers: { 'X-Requested-With': 'XMLHttpRequest' },
// query 参数
params: {
id: '12345'
},
// body 参数
data: {
firstName: 'Fred'
},
}
```
## 示例代码
``` js
const onSyncTask = async (config, env, op, eventData) => {
const url = '<URL>';
const { data, headers } = await op.request({
url,
method: 'POST',
data: { ... },
});
log(`${url} 接口响应`, headers, data);
};
```

View File

@ -1,9 +1,15 @@
# Utils
工具类
## parseXML: (xmlStr: string, options?: OpParseXMLOptions) => any
## XML 解析
op.utils.parseXML 用来解析 XML 字符串并返回一个 JSON 对象。
```
parseXML: (xmlStr: string, options?: OpParseXMLOptions) => any
```
参数说明:
TODO
@ -11,7 +17,7 @@ TODO
示例代码:
```javaScript
exports.run = async (ctx, op) => {
const onSyncTask = async (config, env, op, eventData) => {
const data = `
<oauth>
<data>
@ -30,7 +36,7 @@ exports.run = async (ctx, op) => {
};
```
以上代码返回:
以上代码返回:
```javaScript
{
@ -56,11 +62,21 @@ exports.run = async (ctx, op) => {
```
## formatString: (data: any, from: string | undefined, to: string) => string
## 字符串编码转换utf-8hexbase64等
op.utils.formatString 用以将字符串在 utf8、hex、base64 等格式之间进行转换。
```
formatString: (data: any, from: string | undefined, to: string) => string
```
示例代码:
TODO
``` js
const hexStr = op.utils.formatString('Hello IDMesh', 'utf8', 'hex');
const base64Str = op.utils.formatString(hexStr, 'hex', 'base64');
const hello = op.utils.formatString(base64Str, 'base64', 'utf8');
```
## SM4
@ -72,12 +88,13 @@ encodeSM4(key: string, data: string, opts?: { mode?: string, iv?: string, inputE
```
参数说明:
TODO
示例代码:
```javaScript
exports.run = async (ctx, op) => {
const onSyncTask = async (config, env, op, eventData) => {
// 子账号加密示例
const secret = 'YOUR_SECRET';
const key = op.utils.formatString(secret, 'utf8', 'hex').slice(0, 32);
@ -92,10 +109,12 @@ exports.run = async (ctx, op) => {
## crypto
op.utils.crypto 提供了 MD5、SHA256、AES、TripleDES 等算法的使用。
示例代码:
```javascript
exports.run = async (ctx, op) => {
const onSyncTask = async (config, env, op, eventData) => {
const list = [];
let msg;
const key = 'aesEncryptionKey';