diff --git a/Access.md b/Access.md deleted file mode 100644 index 49ec210..0000000 --- a/Access.md +++ /dev/null @@ -1,7 +0,0 @@ -#### Access - -[toc] - -##### deny(message) -权限拒绝 -* message 提示消息 diff --git a/Function.md b/Function.md deleted file mode 100644 index f2d5012..0000000 --- a/Function.md +++ /dev/null @@ -1,14 +0,0 @@ -## 函数事件流函数 - -```js -function(event, op) { - -} -``` - -### 参数 -* event [FunctionEvent](./FunctionEvent.md) -事件,函数上下文 - -* op [Operation](./Operation.md) -操作,函数操作 \ No newline at end of file diff --git a/FunctionEvent.md b/FunctionEvent.md deleted file mode 100644 index 72cd2d7..0000000 --- a/FunctionEvent.md +++ /dev/null @@ -1,7 +0,0 @@ -#### FunctionEvent - -##### user [User](./User.md) -用户 - -##### request [Request](./Request.md) -请求 diff --git a/Notification.md b/Notification.md deleted file mode 100644 index b8379a2..0000000 --- a/Notification.md +++ /dev/null @@ -1,11 +0,0 @@ -#### Notification -[toc] - -##### sendEmail(to, title, content) - -发送电子邮件 - -* to 对方e-mail地址 -* title 发送邮件的标题 -* content 邮件内容 - diff --git a/Operation.md b/Operation.md deleted file mode 100644 index c057bc0..0000000 --- a/Operation.md +++ /dev/null @@ -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, 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) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f4f433b --- /dev/null +++ b/README.md @@ -0,0 +1,64 @@ +# Flow / 同步组件文档 + +## op + +`op` 是为函数事件流、同步组件等一系列场景所提供的工具,可以使用它请求一系列 IDMesh 接口,使用它进行一系列数据处理等等。 + +``` js +const onSyncTask = async (config, env, op, eventData) => { + op.api.init('', ''); + op.api.user.disable({ 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('', ''); + const { data } = await op.api.user.disable({ id: '' }); + log('用户禁用请求返回', new Date().toISOString(), data); +}; +``` + +## Flow 场景文档 + +详情参见:[op.access 文档](./flow/README.md) + + + + + + diff --git a/Request.md b/Request.md deleted file mode 100644 index 6cb4e92..0000000 --- a/Request.md +++ /dev/null @@ -1,3 +0,0 @@ -#### Request - -TODO \ No newline at end of file diff --git a/User.md b/User.md deleted file mode 100644 index 81b4b53..0000000 --- a/User.md +++ /dev/null @@ -1,3 +0,0 @@ -#### User - -TODO \ No newline at end of file diff --git a/api/ModuleApplication.md b/api/ModuleApplication.md deleted file mode 100644 index 0bfda30..0000000 --- a/api/ModuleApplication.md +++ /dev/null @@ -1,1270 +0,0 @@ -### AppApi -[toc] -#### create(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
namestringfalse应用名称
typestringfalse应用类型1,自建应用,2模板应用(市场应用)
template_idstringfalse模板id,不填写则代表自建应用
categorystringfalse应用分类,1 标准web应用,2单页web应用,3客户端应用,4后端服务
descrstringfalse应用描述
logostringfalselogo路径,格式为:http://ip:port/logo.png
login_urlstringfalse登录路径
redirect_urlstringfalse重定向路径
logout_urlstringfalse登出路径
sub_account_policystringfalse子账号策略,1启用,0不启用,启用后单点登录返回
propobjectfalsekv字典数据
protocol_typestringfalse如果不传默认是oidc
protocol_propobjectfalse单点登录协议属性,如果不存在则为oidc的配置
config_propobjectfalse应用配置属性
domain_snstringfalse域名
- -#### modify(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
namestringfalse应用名称
typestringfalse应用类型,1自建应用,2市场应用
app_idstringfalse应用key
app_secretstringfalse应用secret,拥有管理员权限时返回
categorystringfalse应用分类
descrstringfalse应用描述
logonullfalselogo路径
login_urlstringfalse登录路径
redirect_urlstringfalse重定向路径
logout_urlstringfalse登出路径
sub_account_policystringfalse子账号策略
propobjectfalse扩展属性
statusstringfalse状态,0禁用,1启用
domain_snstringfalse应用 Domain SN
- -#### getTemplate(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
namestringtrue应用名称
- -#### list(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
namestringfalse应用名称
typestringfalse应用类型
page_sortstringfalse排序,格式:字段名[顺序]
typesstringfalse应用类型列表,逗号分隔
- -#### getByDomain(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
domainstringfalse域名
domain_snstringfalse域名简写
- -#### get(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue唯一标识
- -#### enable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用标识
- -#### disable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用标识
- -#### delete(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### createSecrets(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### getConfig(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用ID
- -#### modifyConfig(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
allowed_login_methodstringfalse允许的登录方式,格式为:["password", "vercode"]
default_login_methodstringfalse默认登录方式,格式为:password
allowed_reg_methodstringfalse允许注册方式,格式为:["mobile", "email"]
default_reg_methodstringfalse默认注册方式,格式为:mobile
default_protocolstringfalse默认登录协议
access_policystringfalse应用级访问控制权限,all: 所有人可访问 permitted: 拒绝未授权访问
reg_policystringfalse新用户注册策略(是否允许自动注册,注册验证方式等),1是,2否,
- -#### disableSSO(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用标识
- -#### enableSSO(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用标识
- -#### createMFA(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idtrue应用id
config_idstringtrue已配置的idp conn id
- -#### deleteMFA(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idstringtrue应用id
config_idtrue
- -#### createIDP(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idtrue应用id
config_idstringtrue已配置的idp conn id
- -#### deleteIDPConfig(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idstringtrue应用id
config_idtrue
- -#### enableProtocol(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用 id
protocol_typetrue协议名称,如 oidc
- -#### disableProtocol(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用 id
protocol_typetrue协议名称,如 oidc
- -#### getProtocols(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue应用唯一标识ID
statusstringfalse启用状态 1, 0
- -#### getProtocol(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用id
protocol_typetrue单点类型,cas、oauth2、saml、oidc、sxp
- -#### modifyProtocol(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用id
protocol_typetrue单点类型,cas、oauth2、saml、oidc、sxp
config_contentobjectfalse配置参数
- -#### createAccount(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idtrue应用id
user_idstringfalse用户唯一标识
app_idstringfalse应用唯一标识
acc_namestringfalse帐号名
acc_name_displayedstringfalse显示名
acc_sourcestringfalse帐号来源
acc_passwordstringfalse帐号密码
acc_statusstringfalse帐号状态,1启用,0禁用
acc_propobjectfalse扩展属性
usernmaestringfalse用户名称
- -#### modifyAccount(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idstringtrue应用id
idtrue子账号id
user_idstringfalse用户唯一标识
app_idstringfalse应用唯一标识
acc_namestringfalse帐号名
acc_name_displayedstringfalse显示名
acc_sourcestringfalse帐号来源
acc_passwordstringfalse密码
acc_statusstringfalse状态,1启用,0禁用
acc_propobjectfalse扩展属性
- -#### enableAccount(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用id
idstringtrue子账号id
idstringtrue
- -#### disableAccount(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用id
idstringtrue子账号id
- -#### deleteAccount(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idtrue应用id
idstringtrue子账号id
- -#### getAccounts(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
app_idstringfalse应用id
user_idstringfalse用户id
acc_statusstringfalse账号状态 1-活跃 0-冻结
page_numintegerfalse页数
page_sizeintegerfalse页大小
page_sortstringfalse排序字段
- \ No newline at end of file diff --git a/api/ModuleAuthentication.md b/api/ModuleAuthentication.md deleted file mode 100644 index 66501ee..0000000 --- a/api/ModuleAuthentication.md +++ /dev/null @@ -1,2 +0,0 @@ -#### Authentication -[toc] \ No newline at end of file diff --git a/api/ModuleIdentity.md b/api/ModuleIdentity.md deleted file mode 100644 index 5cb5958..0000000 --- a/api/ModuleIdentity.md +++ /dev/null @@ -1,768 +0,0 @@ -### UserApi -[toc] -#### create(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
usernamestringfalse用户名,唯一,不传后台自动生成
passwordstringfalse密码,不传后台生成默认密码
display_namestringfalse显示名称
firstnamestringfalse
lastnamestringfalse
realnamestringfalse真实姓名
pinyinstringfalse拼音
nicknamestringfalse昵称
user_typestringfalse用户类型,不传后台设置系统默认类型
mobilestringfalse手机
emailstringfalse邮箱
genderstringfalse性别
cert_typestringfalse证件类型
cert_numberstringfalse证件号
regionstringfalse区域
work_timestringfalse加入时间
work_titlestringfalse职位
ext_propjsonfalse扩展信息,json对象{"age": 18, "love": "足球"}
statusstringfalse状态:1正常,0禁用,后期扩展:离职、休假、借调。
password_statusstringfalse密码状态(valid/invalid)
idp_config_idnumbertrue身份源ID,作为创建时记录,不做更新
- -#### disable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### enable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### batchDisable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idsarraytrue
- -#### batchEnable(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idsarraytrue
- -#### modify(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
usernamestringfalse用户名,验证唯一
passwordstringfalse密码
display_namestringfalse显示名称
firstnamestringfalse
lastnamestringfalse
realnamestringfalse真实姓名
pinyinstringfalse拼音
nicknamestringfalse昵称
mobilestringfalse手机
emailstringfalse邮箱
genderstringfalse性别:1男,0女
cert_typestringfalse证件类型
cert_numberstringfalse证件号
regionstringfalse区域
work_timestringfalse加入时间
work_titlestringfalse职位
ext_propjsonfalse扩展信息,json对象{"age": 18, "love": "足球"}
last_login_ipaddrstringfalse上次登录IP
last_login_timestringfalse上次登录时间
statusstringfalse状态,正常、禁用,后期扩展:离职、休假、借调。
- -#### delete(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### batchDelete(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idsarraytrue
- -#### list(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
page_sizeintegerfalse
page_numintegerfalse
search_typestringfalse默认按用户字段搜索,当值为:generic时,全文检索
keywordstringfalse检索值
- -#### get(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### modifyPassword(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
old_passwordstringfalse
new_passwordstringfalse
- -#### getStoredCredentials(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
user_idnumberfalse用户id标识
provider_codestringfalse社会化登录提供者的code
idp_config_idnumberfalse社会化登录配置的ID
id1stringfalse社会化身份标识1,约定此字段保存用户唯一标识,如openid
id2stringfalse社会化身份标识2,如unionid
metadatastringfalse更多社会化身份标识
statusstringfalse状态
usernamestringfalse用户名
display_namestringfalse显示名
page_sizeintegerfalse
page_numintegerfalse
- -#### createStoreCredential(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
provider_codestringfalse社会化身份源code
id1stringfalse社会化身份标识1,如openid
id2stringfalse社会化身份标识2,如unionid
metadatastringfalse更多社会化身份标识
statusstringfalse状态
nicknamestringfalse昵称
avatarstringfalse头像
id_provider_connectionstringfalse
idp_config_idnumberfalse社会化登录配置的ID
realnamestringfalse真实姓名
mobilestringfalse手机
emailstringfalse邮箱
genderstringfalse性别
- \ No newline at end of file diff --git a/api/ModuleOranization.md b/api/ModuleOranization.md deleted file mode 100644 index 6e01772..0000000 --- a/api/ModuleOranization.md +++ /dev/null @@ -1,726 +0,0 @@ - -### OrganizationApi -[toc] - -#### createOrganization(param) - - - -##### param properties - - - - - - - - - - - - - - - -
名称类型是否必须描述
- -#### getNodeParent(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### deleteNode(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
object_codestringtrue树对象code
- -#### getOrganizations(param) - - - -##### param properties - - - - - - - - - - - - - - - -
名称类型是否必须描述
- -#### updateOrganization(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### getOrganization(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
codestringtrue
- -#### deleteOrganization(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### addUserToNode(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
relation_datastringfalse关联扩展信息
relation_typestringfalse用于区分多重关联
is_defaultstringfalse1是,0否
node_idstringfalse
user_idsarrayfalse
- -#### updateMember(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idtrue
is_defaultstringfalse1是,0否
actionstringtrue移动节点move, 设置为默认关系as-default
source_node_idstringfalse移动前节点ID
dest_node_idstringfalse移动后节点ID
- -#### getMembers(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
user_idstringtrue用户ID
- -#### getNodeMembers(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtruenode id
relation_typestringfalse关联类型,用于区分多重关联
is_defaultstringfalse是否默认关系 1是,0否
display_namestringfalse用户显示名
usernamestringfalse用户名,支持模糊搜索(仅前缀)
modestringfalse// mode - 低->高 bit -// 第1位:是否获得指针节点所对应的真实结点,1-是,0-否 -// 第2位:是否展开WeakNode,即节点中类型不同的节点,1-展开,0-不展开 -// 第3位:是否递归地展开节点(不建议)
page_numintegerfalse起始页,默认1
page_sizeintegerfalse页大小,默认10
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### deleteNodeMembers(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
node_idstringtruenode id
idsarraytrue
- -#### deleteMember(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue用户节点ID
idsarrayfalse用户与组织的关系ID
node_idstringfalse节点ID
user_idstringfalse用户原始ID
- -#### deleteMembers(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
node_idstringfalse节点ID
user_idstringfalse用户原始ID
- -#### createNode(param) - - - -##### param properties - - - - - - - - - - - - - - - -
名称类型是否必须描述
- -#### updateNode(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue更新树节点
- -#### deleteChildrenNodes(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
object_codestringtrue树对象code
- -#### getNodes(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
object_codestringtrue创建树时的object_code
namestringfalse名字,支持前缀搜索
codestringfalse编号
tagstringfalse标签
- -#### getNode(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
- -#### getChildrenNodes(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue
modestringtrue// mode - 低->高 bit -// 第1位:是否获得指针节点所对应的真实结点,1-是,0-否 -// 第2位:是否展开WeakNode,即节点中类型不同的节点,1-展开,0-不展开 -// 第3位:是否递归地展开节点(不建议)
object_codestringtrue当id = 0时必填,创建树时的object_code
- diff --git a/api/ModulePermission.md b/api/ModulePermission.md deleted file mode 100644 index f1cbbbe..0000000 --- a/api/ModulePermission.md +++ /dev/null @@ -1,1109 +0,0 @@ -### PermissionApi -[toc] - -#### getPrivileges(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
identity_idstringfalse主体id
identity_typestringfalse主体类型
identity_namestringfalse主体名称
application_idstringtrue应用id
object_typestringfalse对象类型(可选值: data, api, ui, res_set, app)
object_codestringfalse对象代码
affectstringfalse作用方式(affect,deny)
page_numstringfalse起始页,默认1
page_sizestringfalse页大小,默认20
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### getAuthUnits(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
identity_idstringfalse主体id
identity_typestringfalse主体类型
identity_namestringfalse主体名称
page_numstringfalse起始页,默认1
page_sizestringfalse页大小,默认20
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### getAuthUnit(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrueau id
- -#### createAuthUnitRules(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
identitiesarrayfalse
rulesarrayfalse
- -#### modifyAuthUnit(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
ridstringtrueAU id
tidstringtrue规则id
- -#### getAuthUnitsRules(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
ridstringtrueAU id
application_idstringfalse应用id
typestringfalse规则类型
codestringfalse资源或资源集合code
self_onlystringfalse只查询指定主体下的授权
resource_idstringfalse资源id,当type=api,ui,data时有效
resource_match_all_resourcesstringfalse匹配所有资源,当type=res时有效
resource_match_all_actionsstringfalse匹配所有资源操作,当type=res时有效
resource_set_idstringfalse资源集合id,当type=res_set
- -#### queryAuthUnitsRules(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
application_idstringfalse应用id
typestringfalse规则类型
codestringfalse资源或资源集合code
identity_idstringtrue主体id
identity_typestringtrue主体类型
identity_namestringfalse主体名称
self_onlystringfalse只查询指定主体下的授权
resource_idstringfalse资源id,当type=api,ui,data时有效
resource_match_all_resourcesstringfalse匹配所有资源,当type=res时有效
resource_match_all_actionsstringfalse匹配所有资源操作,当type=res时有效
resource_set_idstringfalse资源集合id,当type=res_set
- -#### deleteAuthUnitRules(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idsarraytrue
- -#### createResource(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
descriptionstringfalse描述
codestringfalse资源代码
application_idnumberfalse应用id
typestringfalse资源类型,data/api/ui
uristringfalse资源URI, 当type=api/ui 时有效
actionsarrayfalse
- -#### modifyResource(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue资源id
descriptionstringfalse描述
uristringfalse资源URI, 当type=api/ui 时有效
actionsarrayfalse
- -#### getResources(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
application_idstringtrue应用id
typestringfalse资源类型
codestringfalse资源代码
include_globalstringfalse是否查询包含全局资源
page_numstringfalse起始页,默认1
page_sizestringfalse页大小,默认20
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### getResource(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue资源id
application_idstringtrue应用id
- -#### deleteResources(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idsarraytrue
- -#### createResourceSet(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
codestringfalse集合代码
descriptionstringfalse描述
application_idstringfalse应用id
- -#### modifyResourceSet(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue集合id
codestringfalse集合代码
descriptionstringfalse描述
- -#### getResourceSets(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
codestringfalse集合代码
application_idstringtrue应用id
include_globalstringfalse查询是否包含全局资源集合
page_numstringfalse起始页,默认1
page_sizestringfalse页大小,默认20
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### getResourceSet(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue资源集合id
- -#### createResourceSetMember(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
idstringtrue集合id
resource_idnumberfalse
resource_scopestringfalse
resource_actionsarrayfalse
match_all_actionsbooleanfalse
- -#### modifyResourceSetMember(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
sidstringtrue资源集合id
midstringtrue资源集合成员id
resource_idnumberfalse
resource_scopestringfalse
ResourceActionsarrayfalse
match_all_actionsbooleanfalse
- -#### getResourceMembers(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
sidstringtrue资源集合id
resource_codestringfalse资源代码
resource_typestringfalse资源类型
page_numstringfalse起始页,默认1
page_sizestringfalse页大小,默认20
page_sortstringfalse排序方式,格式:字段[排序方式]
- -#### getResourceMember(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
sidstringtrue资源集合id
midstringtrue成员id
- -#### authorizeApplications(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
identitiesarrayfalse
application_idstringfalse
affectstringfalseallow, deny
- -#### listAuthorizedApplications(param) - - - -##### param properties - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称类型是否必须描述
identity_idstringtrue授权主体 id
identity_typestringtrue授权主体类型
typestringfalse应用类型: 0-默认应用 1-自建应用 2-模板应用 3-组件应用
- \ No newline at end of file diff --git a/flow/FunctionEvent.md b/flow/FunctionEvent.md new file mode 100644 index 0000000..9d05fd3 --- /dev/null +++ b/flow/FunctionEvent.md @@ -0,0 +1,9 @@ +# FunctionEvent + +## user [User](./events/User.md) + +用户 + +## request [Request](./events/Request.md) + +请求 diff --git a/flow/README.md b/flow/README.md new file mode 100644 index 0000000..6d34ea4 --- /dev/null +++ b/flow/README.md @@ -0,0 +1,13 @@ +# 函数事件流函数 + +```js +function(event, op) { + // +} +``` + +## 参数说明 + +* event:事件,既函数上下文。具体请参见 [FunctionEvent](./FunctionEvent.md) + +* op:封装的一系列工具方法。具体请参见 [op 文档](../README.md) diff --git a/flow/events/Request.md b/flow/events/Request.md new file mode 100644 index 0000000..193b8fd --- /dev/null +++ b/flow/events/Request.md @@ -0,0 +1,3 @@ +# Request + +TODO \ No newline at end of file diff --git a/flow/events/User.md b/flow/events/User.md new file mode 100644 index 0000000..da79604 --- /dev/null +++ b/flow/events/User.md @@ -0,0 +1,3 @@ +# User + +TODO \ No newline at end of file diff --git a/IDaasApi.md b/op/API.md similarity index 91% rename from IDaasApi.md rename to op/API.md index 613df0f..b3acfbe 100644 --- a/IDaasApi.md +++ b/op/API.md @@ -1,20 +1,30 @@ -# IDaasApi -[toc] +# IDMesh API -## init(ak, sk) +op.api 对 IDMesh API 进行了封装。op.api 会自行对请求进行签名,因此使用前需要先通过 op.api.init 设置开发者账号。 -初始化 +## op.api.init -* ak accessKey 编程者账号key -* sk secretKey 编程者账号密钥 +``` js +/** 注意!! + * 在使用任何 op.api 封装的接口之前, + * 你需要使用 op.api.init 初始化接口 + * AK、SK 来自开发者账号 + */ +const onSyncTask = async (config, env, op, eventData) => { + op.api.init('', ''); + op.api.user.disable({ id: '' }); +}; +``` ## api ### user -#### create(param) +#### 创建用户 -创建用户 +``` js +const { data } = await op.api.user.create(params) ; +``` POST /v1/users @@ -169,9 +179,11 @@ POST /v1/users -#### disable(param) +#### 锁定用户 -锁定用户 +``` js +const { data } = await op.api.user.disable(params) ; +``` PATCH /v1/users/{id}/disable @@ -200,9 +212,11 @@ PATCH /v1/users/{id}/disable -#### enable(param) +#### 解锁用户 -解锁用户 +``` js +const { data } = await op.api.user.enable(params) ; +``` PATCH /v1/users/{id}/enable @@ -231,9 +245,11 @@ PATCH /v1/users/{id}/enable -#### batchDisable(param) +#### 批量锁定用户 -批量锁定用户 +``` js +const { data } = await op.api.user.batchDisable(params) ; +``` POST /v1/jobs/users-disable @@ -262,9 +278,11 @@ POST /v1/jobs/users-disable -#### batchEnable(param) +#### 批量解锁用户 -批量解锁用户 +``` js +const { data } = await op.api.user.batchEnable(params) ; +``` POST /v1/jobs/users-enable @@ -293,9 +311,11 @@ POST /v1/jobs/users-enable -#### modify(param) +#### 编辑用户 -编辑用户 +``` js +const { data } = await op.api.user.modify(params) ; +``` PATCH /v1/users/{id} @@ -432,9 +452,11 @@ PATCH /v1/users/{id} -#### delete(param) +#### 删除用户 -删除用户 +``` js +const { data } = await op.api.user.delete(params) ; +``` DELETE /v1/users/{id} @@ -463,9 +485,11 @@ DELETE /v1/users/{id} -#### batchDelete(param) +#### 批量删除用户 -批量删除用户 +``` js +const { data } = await op.api.user.batchDelete(params) ; +``` DELETE /v1/users @@ -494,9 +518,11 @@ DELETE /v1/users -#### list(param) +#### 查询用户列表 -查询用户列表 +``` js +const { data } = await op.api.user.list(params) ; +``` GET /v1/users @@ -543,9 +569,11 @@ GET /v1/users -#### get(param) +#### 查询用户详情 -查询用户详情 +``` js +const { data } = await op.api.user.get(params) ; +``` GET /v1/users/{id} @@ -574,9 +602,11 @@ GET /v1/users/{id} -#### modifyPassword(param) +#### 修改密码 -修改密码 +``` js +const { data } = await op.api.user.modifyPassword(params) ; +``` PATCH /v1/users/{id}/passwords @@ -617,9 +647,11 @@ PATCH /v1/users/{id}/passwords -#### getStoredCredentials(param) +#### 查询用户存储凭证列表 -查询用户存储凭证列表 +``` js +const { data } = await op.api.user.getStoredCredentials(params) ; +``` GET /v1/user-stored-credentials @@ -708,9 +740,11 @@ GET /v1/user-stored-credentials -#### createStoreCredential(param) +#### 创建用户存储凭证 -创建用户存储凭证 +``` js +const { data } = await op.api.user.createStoreCredential(params) ; +``` POST /v1/user-stored-credentials @@ -813,9 +847,11 @@ POST /v1/user-stored-credentials ### authentication ### app -#### create(param) +#### 创建应用 -创建应用 +``` js +const { data } = await op.api.app.create(params) ; +``` POST /v1/applications @@ -928,9 +964,11 @@ POST /v1/applications -#### modify(param) +#### 更新应用基本信息 -更新应用基本信息 +``` js +const { data } = await op.api.app.modify(params) ; +``` PATCH /v1/applications/{id} @@ -1043,9 +1081,11 @@ PATCH /v1/applications/{id} -#### getTemplate(param) +#### 查询应用模板列表 -查询应用模板列表 +``` js +const { data } = await op.api.app.getTemplate(params) ; +``` GET /v1/application-templates @@ -1074,9 +1114,11 @@ GET /v1/application-templates -#### list(param) +#### 查询应用列表 -查询应用列表 +``` js +const { data } = await op.api.app.list(params) ; +``` GET /v1/applications @@ -1123,9 +1165,11 @@ GET /v1/applications -#### getByDomain(param) +#### 按条件查询应用 -按条件查询应用 +``` js +const { data } = await op.api.app.getByDomain(params) ; +``` GET /v1/application @@ -1160,9 +1204,11 @@ GET /v1/application -#### get(param) +#### 按 ID 查询应用 -按 ID 查询应用 +``` js +const { data } = await op.api.app.get(params) ; +``` GET /v1/applications/{id} @@ -1191,9 +1237,11 @@ GET /v1/applications/{id} -#### enable(param) +#### 启用应用 -启用应用 +``` js +const { data } = await op.api.app.enable(params) ; +``` POST /v1/applications/{id}/enable @@ -1222,9 +1270,11 @@ POST /v1/applications/{id}/enable -#### disable(param) +#### 禁用应用 -禁用应用 +``` js +const { data } = await op.api.app.disable(params) ; +``` POST /v1/applications/{id}/disable @@ -1253,9 +1303,11 @@ POST /v1/applications/{id}/disable -#### delete(param) +#### 删除应用 -删除应用 +``` js +const { data } = await op.api.app.delete(params) ; +``` DELETE /v1/applications/{id} @@ -1284,9 +1336,11 @@ DELETE /v1/applications/{id} -#### createSecrets(param) +#### 刷新应用安全码 -刷新应用安全码 +``` js +const { data } = await op.api.app.createSecrets(params) ; +``` POST /v1/applications/{id}/secrets @@ -1315,9 +1369,11 @@ POST /v1/applications/{id}/secrets -#### getConfig(param) +#### 查询应用配置信息 -查询应用配置信息 +``` js +const { data } = await op.api.app.getConfig(params) ; +``` GET /v1/applications/{id}/configs @@ -1346,9 +1402,11 @@ GET /v1/applications/{id}/configs -#### modifyConfig(param) +#### 更新应用配置 -更新应用配置 +``` js +const { data } = await op.api.app.modifyConfig(params) ; +``` PATCH /v1/applications/{id}/configs @@ -1419,9 +1477,11 @@ PATCH /v1/applications/{id}/configs -#### disableSSO(param) +#### 禁用应用单点登录 -禁用应用单点登录 +``` js +const { data } = await op.api.app.disableSSO(params) ; +``` POST /v1/applications/{id}/sso/disable @@ -1450,9 +1510,11 @@ POST /v1/applications/{id}/sso/disable -#### enableSSO(param) +#### 启用应用单点登录 -启用应用单点登录 +``` js +const { data } = await op.api.app.enableSSO(params) ; +``` POST /v1/applications/{id}/sso/enable @@ -1481,9 +1543,11 @@ POST /v1/applications/{id}/sso/enable -#### createMFA(param) +#### 创建应用多因素认证配置 -创建应用多因素认证配置 +``` js +const { data } = await op.api.app.createMFA(params) ; +``` POST /v1/applications/{id}/mfa @@ -1518,9 +1582,11 @@ POST /v1/applications/{id}/mfa -#### deleteMFA(param) +#### 删除应用多因素认证配置 -删除应用多因素认证配置 +``` js +const { data } = await op.api.app.deleteMFA(params) ; +``` DELETE /v1/applications/{app_id}/mfa/{config_id} @@ -1555,9 +1621,11 @@ DELETE /v1/applications/{app_id}/mfa/{config_id} -#### createIDP(param) +#### 创建应用认证源 -创建应用认证源 +``` js +const { data } = await op.api.app.createIDP(params) ; +``` POST /v1/applications/{id}/idp @@ -1592,9 +1660,11 @@ POST /v1/applications/{id}/idp -#### deleteIDPConfig(param) +#### 删除应用认证源 -删除应用认证源 +``` js +const { data } = await op.api.app.deleteIDPConfig(params) ; +``` DELETE /v1/applications/{app_id}/idp/{config_id} @@ -1629,9 +1699,11 @@ DELETE /v1/applications/{app_id}/idp/{config_id} -#### enableProtocol(param) +#### 启用应用认证协议 -启用应用认证协议 +``` js +const { data } = await op.api.app.enableProtocol(params) ; +``` POST /v1/applications/{app_id}/protocols/{protocol_type}/enable @@ -1666,9 +1738,11 @@ POST /v1/applications/{app_id}/protocols/{protocol_type}/enable -#### disableProtocol(param) +#### 禁用应用认证协议 -禁用应用认证协议 +``` js +const { data } = await op.api.app.disableProtocol(params) ; +``` POST /v1/applications/{app_id}/protocols/{protocol_type}/disable @@ -1703,9 +1777,11 @@ POST /v1/applications/{app_id}/protocols/{protocol_type}/disable -#### getProtocols(param) +#### 查询应用认证协议列表 -查询应用认证协议列表 +``` js +const { data } = await op.api.app.getProtocols(params) ; +``` GET /v1/applications/{id}/protocols @@ -1740,9 +1816,11 @@ GET /v1/applications/{id}/protocols -#### getProtocol(param) +#### 查询应用认证协议 -查询应用认证协议 +``` js +const { data } = await op.api.app.getProtocol(params) ; +``` GET /v1/applications/{app_id}/protocols/{protocol_type} @@ -1777,9 +1855,11 @@ GET /v1/applications/{app_id}/protocols/{protocol_type} -#### modifyProtocol(param) +#### 更新应用认证协议 -更新应用认证协议 +``` js +const { data } = await op.api.app.modifyProtocol(params) ; +``` PUT /v1/applications/{app_id}/protocols/{protocol_type} @@ -1820,9 +1900,11 @@ PUT /v1/applications/{app_id}/protocols/{protocol_type} -#### createAccount(param) +#### 创建应用子账号 -创建应用子账号 +``` js +const { data } = await op.api.app.createAccount(params) ; +``` POST /v1/applications/{id}/accounts @@ -1905,9 +1987,11 @@ POST /v1/applications/{id}/accounts -#### modifyAccount(param) +#### 更新应用子账号 -更新应用子账号 +``` js +const { data } = await op.api.app.modifyAccount(params) ; +``` PUT /v1/applications/{app_id}/accounts/{id} @@ -1990,9 +2074,11 @@ PUT /v1/applications/{app_id}/accounts/{id} -#### enableAccount(param) +#### 启用应用子账号 -启用应用子账号 +``` js +const { data } = await op.api.app.enableAccount(params) ; +``` POST /v1/applications/{app_id}/accounts/{id}/enable @@ -2033,9 +2119,11 @@ POST /v1/applications/{app_id}/accounts/{id}/enable -#### disableAccount(param) +#### 禁用应用子账号 -禁用应用子账号 +``` js +const { data } = await op.api.app.disableAccount(params) ; +``` POST /v1/applications/{app_id}/accounts/{id}/disable @@ -2070,9 +2158,11 @@ POST /v1/applications/{app_id}/accounts/{id}/disable -#### deleteAccount(param) +#### 删除应用子账号 -删除应用子账号 +``` js +const { data } = await op.api.app.deleteAccount(params) ; +``` DELETE /v1/applications/{app_id}/accounts/{id} @@ -2107,9 +2197,11 @@ DELETE /v1/applications/{app_id}/accounts/{id} -#### getAccountsByApp(param) +#### 按 APP ID 查询应用子账号列表 -按 APP ID 查询应用子账号列表 +``` js +const { data } = await op.api.app.getAccountsByApp(params) ; +``` GET /v1/applications/{app_id}/accounts @@ -2174,9 +2266,11 @@ GET /v1/applications/{app_id}/accounts -#### getAccounts(param) +#### 查询应用子账号列表 -查询应用子账号列表 +``` js +const { data } = await op.api.app.getAccounts(params) ; +``` GET /v1/application-accounts @@ -2241,9 +2335,11 @@ GET /v1/application-accounts -#### getAccount(param) +#### 按 ID 查询应用子账号 -按 ID 查询应用子账号 +``` js +const { data } = await op.api.app.getAccount(params) ; +``` GET /v1/applications/{app_id}/accounts/{id} @@ -2279,9 +2375,11 @@ GET /v1/applications/{app_id}/accounts/{id} ### permission -#### getPrivileges(param) +#### 获取权限列表 -获取权限列表 +``` js +const { data } = await op.api.permission.getPrivileges(params) ; +``` GET /v1/privileges @@ -2364,9 +2462,11 @@ GET /v1/privileges -#### getAuthUnits(param) +#### 获取授权单元列表 -获取授权单元列表 +``` js +const { data } = await op.api.permission.getAuthUnits(params) ; +``` GET /v1/auth-units @@ -2425,9 +2525,11 @@ GET /v1/auth-units -#### getAuthUnit(param) +#### 按 ID 查询授权单元 -按 ID 查询授权单元 +``` js +const { data } = await op.api.permission.getAuthUnit(params) ; +``` GET /v1/auth-units/{id} @@ -2456,9 +2558,11 @@ GET /v1/auth-units/{id} -#### createAuthUnitRules(param) +#### 批量创建授权规则 -批量创建授权规则 +``` js +const { data } = await op.api.permission.createAuthUnitRules(params) ; +``` POST /v1/batch/auth-unit-rules @@ -2493,9 +2597,11 @@ POST /v1/batch/auth-unit-rules -#### modifyAuthUnit(param) +#### 更新授权规则 -更新授权规则 +``` js +const { data } = await op.api.permission.modifyAuthUnit(params) ; +``` PUT /v1/auth-units/{rid}/rules/{tid} @@ -2530,9 +2636,11 @@ PUT /v1/auth-units/{rid}/rules/{tid} -#### getAuthUnitsRules(param) +#### 查询授权单元下的授权规则列表 -查询授权单元下的授权规则列表 +``` js +const { data } = await op.api.permission.getAuthUnitsRules(params) ; +``` GET /v1/auth-units/{rid}/rules @@ -2609,9 +2717,11 @@ GET /v1/auth-units/{rid}/rules -#### queryAuthUnitsRules(param) +#### 查询授权规则列表 -查询授权规则列表 +``` js +const { data } = await op.api.permission.queryAuthUnitsRules(params) ; +``` GET /v1/auth-unit-rules @@ -2700,9 +2810,11 @@ GET /v1/auth-unit-rules -#### deleteAuthUnitRules(param) +#### 批量删除授权规则 -批量删除授权规则 +``` js +const { data } = await op.api.permission.deleteAuthUnitRules(params) ; +``` DELETE /v1/batch/auth-unit-rules @@ -2731,9 +2843,11 @@ DELETE /v1/batch/auth-unit-rules -#### createResource(param) +#### 创建资源 -创建资源 +``` js +const { data } = await op.api.permission.createResource(params) ; +``` POST /v1/resources @@ -2792,9 +2906,11 @@ POST /v1/resources -#### modifyResource(param) +#### 更新资源 -更新资源 +``` js +const { data } = await op.api.permission.modifyResource(params) ; +``` PUT /v1/resources/{id} @@ -2841,9 +2957,11 @@ PUT /v1/resources/{id} -#### getResources(param) +#### 查询资源列表 -查询资源列表 +``` js +const { data } = await op.api.permission.getResources(params) ; +``` GET /v1/resources @@ -2908,9 +3026,11 @@ GET /v1/resources -#### getResource(param) +#### 按 ID 查询资源 -按 ID 查询资源 +``` js +const { data } = await op.api.permission.getResource(params) ; +``` GET /v1/resources/{id} @@ -2945,9 +3065,11 @@ GET /v1/resources/{id} -#### deleteResources(param) +#### 删除资源 -删除资源 +``` js +const { data } = await op.api.permission.deleteResources(params) ; +``` DELETE /v1/batch/resources @@ -2976,9 +3098,11 @@ DELETE /v1/batch/resources -#### createResourceSet(param) +#### 创建资源集合 -创建资源集合 +``` js +const { data } = await op.api.permission.createResourceSet(params) ; +``` POST /v1/resource-sets @@ -3019,9 +3143,11 @@ POST /v1/resource-sets -#### modifyResourceSet(param) +#### 更新资源集合 -更新资源集合 +``` js +const { data } = await op.api.permission.modifyResourceSet(params) ; +``` PUT /v1/resource-sets/{id} @@ -3062,9 +3188,11 @@ PUT /v1/resource-sets/{id} -#### getResourceSets(param) +#### 查询资源集合列表 -查询资源集合列表 +``` js +const { data } = await op.api.permission.getResourceSets(params) ; +``` GET /v1/resource-sets @@ -3123,9 +3251,11 @@ GET /v1/resource-sets -#### getResourceSet(param) +#### 按 ID 查询资源集合 -按 ID 查询资源集合 +``` js +const { data } = await op.api.permission.getResourceSet(params) ; +``` GET /v1/resource-sets/{id} @@ -3154,9 +3284,11 @@ GET /v1/resource-sets/{id} -#### createResourceSetMember(param) +#### 创建资源集合成员 -创建资源集合成员 +``` js +const { data } = await op.api.permission.createResourceSetMember(params) ; +``` POST /v1/resource-sets/{id}/members @@ -3209,9 +3341,11 @@ POST /v1/resource-sets/{id}/members -#### modifyResourceSetMember(param) +#### 更新资源集合成员 -更新资源集合成员 +``` js +const { data } = await op.api.permission.modifyResourceSetMember(params) ; +``` PUT /v1/resource-sets/{sid}/members/{mid} @@ -3270,9 +3404,11 @@ PUT /v1/resource-sets/{sid}/members/{mid} -#### getResourceMembers(param) +#### 查询资源集合成员列表 -查询资源集合成员列表 +``` js +const { data } = await op.api.permission.getResourceMembers(params) ; +``` GET /v1/resource-sets/{sid}/members @@ -3331,9 +3467,11 @@ GET /v1/resource-sets/{sid}/members -#### getResourceMember(param) +#### 按 ID 查询资源集合成员 -按 ID 查询资源集合成员 +``` js +const { data } = await op.api.permission.getResourceMember(params) ; +``` GET /v1/resource-sets/{sid}/members/{mid} @@ -3368,9 +3506,11 @@ GET /v1/resource-sets/{sid}/members/{mid} -#### authorizeApplications(param) +#### 授权应用 -授权应用 +``` js +const { data } = await op.api.permission.authorizeApplications(params) ; +``` POST /v1/batch/authz-apps @@ -3411,9 +3551,11 @@ POST /v1/batch/authz-apps -#### listAuthorizedApplications(param) +#### 查询已授权应用列表 -查询已授权应用列表 +``` js +const { data } = await op.api.permission.listAuthorizedApplications(params) ; +``` GET /v1/authz-apps @@ -3455,9 +3597,11 @@ GET /v1/authz-apps ### organization -#### createOrganization(param) +#### 创建组织关系 -创建组织关系 +``` js +const { data } = await op.api.organization.createOrganization(params) ; +``` POST /v1/core-objects @@ -3480,9 +3624,11 @@ POST /v1/core-objects -#### getNodeParent(param) +#### 查询父节点 -查询父节点 +``` js +const { data } = await op.api.organization.getNodeParent(params) ; +``` GET /v1/tree-nodes/{id}/parent @@ -3511,9 +3657,11 @@ GET /v1/tree-nodes/{id}/parent -#### deleteNode(param) +#### 删除节点 -删除节点 +``` js +const { data } = await op.api.organization.deleteNode(params) ; +``` DELETE /v1/tree-nodes/{id} @@ -3548,9 +3696,11 @@ DELETE /v1/tree-nodes/{id} -#### getOrganizations(param) +#### 获取组织关系列表 -获取组织关系列表 +``` js +const { data } = await op.api.organization.getOrganizations(params) ; +``` GET /v1/core-objects @@ -3573,9 +3723,11 @@ GET /v1/core-objects -#### updateOrganization(param) +#### 修改组织关系基本信息 -修改组织关系基本信息 +``` js +const { data } = await op.api.organization.updateOrganization(params) ; +``` PATCH /v1/core-objects/{id} @@ -3604,9 +3756,11 @@ PATCH /v1/core-objects/{id} -#### getOrganization(param) +#### 获取组织关系基本信息 -获取组织关系基本信息 +``` js +const { data } = await op.api.organization.getOrganization(params) ; +``` GET /v1/core-objects/{id} @@ -3641,9 +3795,11 @@ GET /v1/core-objects/{id} -#### deleteOrganization(param) +#### 删除组织关系 -删除组织关系 +``` js +const { data } = await op.api.organization.deleteOrganization(params) ; +``` DELETE /v1/core-objects/{id} @@ -3672,9 +3828,11 @@ DELETE /v1/core-objects/{id} -#### addUserToNode(param) +#### 添加用户到节点 -添加用户到节点 +``` js +const { data } = await op.api.organization.addUserToNode(params) ; +``` POST /v1/tree-users @@ -3727,9 +3885,11 @@ POST /v1/tree-users -#### updateMember(param) +#### 更新用户节点 -更新用户节点 +``` js +const { data } = await op.api.organization.updateMember(params) ; +``` PATCH /v1/tree-users/{id} @@ -3782,9 +3942,11 @@ PATCH /v1/tree-users/{id} -#### getMembers(param) +#### 获取与用户关联的组织关系列表 -获取与用户关联的组织关系列表 +``` js +const { data } = await op.api.organization.getMembers(params) ; +``` GET /v1/tree-users @@ -3813,9 +3975,11 @@ GET /v1/tree-users -#### getNodeMembers(param) +#### 获取成员信息列表 -获取成员信息列表 +``` js +const { data } = await op.api.organization.getNodeMembers(params) ; +``` GET /v1/tree-nodes/{id}/tree-users @@ -3895,9 +4059,11 @@ GET /v1/tree-nodes/{id}/tree-users -#### deleteNodeMembers(param) +#### 批量从组织关系中移除用户-内部使用 -批量从组织关系中移除用户-内部使用 +``` js +const { data } = await op.api.organization.deleteNodeMembers(params) ; +``` DELETE /v1/tree-nodes/{node_id}/tree-users @@ -3932,9 +4098,11 @@ DELETE /v1/tree-nodes/{node_id}/tree-users -#### deleteMember(param) +#### 从组织关系中移除用户-内部使用 -从组织关系中移除用户-内部使用 +``` js +const { data } = await op.api.organization.deleteMember(params) ; +``` DELETE /v1/tree-users/{id} @@ -3981,9 +4149,11 @@ DELETE /v1/tree-users/{id} -#### deleteMembers(param) +#### 从节点移除用户 -从节点移除用户 +``` js +const { data } = await op.api.organization.deleteMembers(params) ; +``` DELETE /v1/tree-users @@ -4018,9 +4188,11 @@ DELETE /v1/tree-users -#### createNode(param) +#### 创建节点 -创建节点 +``` js +const { data } = await op.api.organization.createNode(params) ; +``` POST /v1/tree-nodes @@ -4043,9 +4215,11 @@ POST /v1/tree-nodes -#### updateNode(param) +#### 编辑节点 -编辑节点 +``` js +const { data } = await op.api.organization.updateNode(params) ; +``` PATCH /v1/tree-nodes/{id} @@ -4074,9 +4248,11 @@ PATCH /v1/tree-nodes/{id} -#### deleteChildrenNodes(param) +#### 删除节点 -删除节点 +``` js +const { data } = await op.api.organization.deleteChildrenNodes(params) ; +``` DELETE /v1/tree-nodes/{id}/children @@ -4111,9 +4287,11 @@ DELETE /v1/tree-nodes/{id}/children -#### getNodes(param) +#### 查询节点信息列表 -查询节点信息列表 +``` js +const { data } = await op.api.organization.getNodes(params) ; +``` GET /v1/tree-nodes @@ -4160,9 +4338,11 @@ GET /v1/tree-nodes -#### getNode(param) +#### 查询节点信息 -查询节点信息 +``` js +const { data } = await op.api.organization.getNode(params) ; +``` GET /v1/tree-nodes/{id} @@ -4191,9 +4371,11 @@ GET /v1/tree-nodes/{id} -#### getChildrenNodes(param) +#### 获取子节点列表 -获取子节点列表 +``` js +const { data } = await op.api.organization.getChildrenNodes(params) ; +``` GET /v1/tree-nodes/{id}/children diff --git a/op/Access.md b/op/Access.md new file mode 100644 index 0000000..5864c91 --- /dev/null +++ b/op/Access.md @@ -0,0 +1,18 @@ +# Access + +op.access 封装了访问控制方法。 + +## 权限拒绝 + +`deny(message)` + +参数说明: + +* message 提示消息 + +``` js +const onSyncTask = async (config, env, op, eventData) => { + op.access.deny(''); + // 调用 deny 会抛出异常,之后的代码将不会执行 +}; +``` diff --git a/op/Notification.md b/op/Notification.md new file mode 100644 index 0000000..374dd24 --- /dev/null +++ b/op/Notification.md @@ -0,0 +1,20 @@ +# Notification + +通知 + +## 发送电子邮件 + +`sendEmail(to, title, content)` + +参数说明: + +* to:对方的 email 地址 +* title:邮件标题 +* content:邮件内容 + +``` js +const onSyncTask = async (config, env, op, eventData) => { + op.notification.sendEmail('', '', 'mail_content'); +}; +``` + diff --git a/op/Request.md b/op/Request.md new file mode 100644 index 0000000..d77bf7a --- /dev/null +++ b/op/Request.md @@ -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 = ''; + const { data, headers } = await op.request({ + url, + method: 'POST', + data: { ... }, + }); + log(`${url} 接口响应`, headers, data); +}; +``` diff --git a/Utils.md b/op/Utils.md similarity index 81% rename from Utils.md rename to op/Utils.md index 7d68fbd..1113b37 100644 --- a/Utils.md +++ b/op/Utils.md @@ -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 = ` @@ -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-8,hex,base64等) + 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';