From c8c603e6f6cd627118ad3bed53b28b8f17b42e2c Mon Sep 17 00:00:00 2001 From: liuyafei Date: Thu, 16 Nov 2023 18:03:05 +0800 Subject: [PATCH] =?UTF-8?q?feat::sparkles:=20giegie=20=E5=90=83=E7=B3=96?= =?UTF-8?q?=E5=90=97=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Access.md | 7 + Function.md | 5 +- FunctionEvent.md | 5 + IDaasApi.md | 18 +++ Notification.md | 11 ++ Operation.md | 267 +++++++++++++++++++++++++++++++++++- Request.md | 3 + User.md | 3 + api/ModuleApplication.md | 3 + api/ModuleAuthentication.md | 3 + api/ModuleIdentity.md | 1 + api/ModuleOranization.md | 0 api/ModulePermission.md | 0 13 files changed, 322 insertions(+), 4 deletions(-) create mode 100644 Access.md create mode 100644 IDaasApi.md create mode 100644 Notification.md create mode 100644 Request.md create mode 100644 User.md create mode 100644 api/ModuleApplication.md create mode 100644 api/ModuleAuthentication.md create mode 100644 api/ModuleIdentity.md create mode 100644 api/ModuleOranization.md create mode 100644 api/ModulePermission.md diff --git a/Access.md b/Access.md new file mode 100644 index 0000000..49ec210 --- /dev/null +++ b/Access.md @@ -0,0 +1,7 @@ +#### Access + +[toc] + +##### deny(message) +权限拒绝 +* message 提示消息 diff --git a/Function.md b/Function.md index f7b71b0..3fd0b8e 100644 --- a/Function.md +++ b/Function.md @@ -5,11 +5,10 @@ function(event, op) { } ``` + ### 参数 * event class [FunctionEvent](./FunctionEvent.md) * op -class [Operation](./Operation.md) - - +class [Operation](./Operation.md) \ No newline at end of file diff --git a/FunctionEvent.md b/FunctionEvent.md index ef2faa3..b438d3d 100644 --- a/FunctionEvent.md +++ b/FunctionEvent.md @@ -1,4 +1,9 @@ #### FunctionEvent +##### user +class [User](./User.md) +##### request +class [Request](./Request.md) + diff --git a/IDaasApi.md b/IDaasApi.md new file mode 100644 index 0000000..e9bcce4 --- /dev/null +++ b/IDaasApi.md @@ -0,0 +1,18 @@ +#### IDaasApi +[toc] + +##### init(ak, sk) +初始化 +* ak accessKey 编程者账号key +* sk secretKey 编程者账号密钥 + +##### user [UserApi](./api/ModuleIdentity.md) +用户模块接口 +##### app [AppApi](./api/ModuleApplication.md) +应用模块接口 +##### permission [PermissionApi](./api/ModulePermission.md) +权限模块接口 +##### authentication [AuthenticationApi](./api/ModuleAuthentication.md) +认证模块接口 +##### organization [OrganizationApi](./api/ModuleOranization.md) +组织模块接口 diff --git a/Notification.md b/Notification.md new file mode 100644 index 0000000..b8379a2 --- /dev/null +++ b/Notification.md @@ -0,0 +1,11 @@ +#### Notification +[toc] + +##### sendEmail(to, title, content) + +发送电子邮件 + +* to 对方e-mail地址 +* title 发送邮件的标题 +* content 邮件内容 + diff --git a/Operation.md b/Operation.md index 38b604e..6bf31e6 100644 --- a/Operation.md +++ b/Operation.md @@ -1 +1,266 @@ -#### Operation \ No newline at end of file +#### 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 + ] +} + +``` \ No newline at end of file diff --git a/Request.md b/Request.md new file mode 100644 index 0000000..6cb4e92 --- /dev/null +++ b/Request.md @@ -0,0 +1,3 @@ +#### Request + +TODO \ No newline at end of file diff --git a/User.md b/User.md new file mode 100644 index 0000000..81b4b53 --- /dev/null +++ b/User.md @@ -0,0 +1,3 @@ +#### User + +TODO \ No newline at end of file diff --git a/api/ModuleApplication.md b/api/ModuleApplication.md new file mode 100644 index 0000000..99a5213 --- /dev/null +++ b/api/ModuleApplication.md @@ -0,0 +1,3 @@ +#### AppApi + +TODO \ No newline at end of file diff --git a/api/ModuleAuthentication.md b/api/ModuleAuthentication.md new file mode 100644 index 0000000..60cbea7 --- /dev/null +++ b/api/ModuleAuthentication.md @@ -0,0 +1,3 @@ +#### Authentication + +TODO \ No newline at end of file diff --git a/api/ModuleIdentity.md b/api/ModuleIdentity.md new file mode 100644 index 0000000..39396fc --- /dev/null +++ b/api/ModuleIdentity.md @@ -0,0 +1 @@ +#### OrganizationApi \ No newline at end of file diff --git a/api/ModuleOranization.md b/api/ModuleOranization.md new file mode 100644 index 0000000..e69de29 diff --git a/api/ModulePermission.md b/api/ModulePermission.md new file mode 100644 index 0000000..e69de29