mobx-lark 1.1.1 → 2.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitpod.yml +22 -0
- package/LICENSE +165 -0
- package/ReadMe.md +12 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/module/BITable/index.d.ts +100 -65
- package/dist/module/BITable/type.d.ts +2 -1
- package/dist/module/InstantMessenger/index.d.ts +16 -22
- package/dist/module/SpreadSheet/index.d.ts +1 -1
- package/dist/module/Task/index.d.ts +32 -44
- package/dist/module/base.d.ts +1 -1
- package/package.json +24 -19
- package/src/module/BITable/index.ts +80 -15
- package/src/module/BITable/type.ts +3 -0
- package/src/module/SpreadSheet/index.ts +3 -4
- package/tsconfig.json +3 -3
package/.gitpod.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This configuration file was automatically generated by Gitpod.
|
|
2
|
+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
|
|
3
|
+
# and commit this file to your remote git repository to share the goodness with others.
|
|
4
|
+
|
|
5
|
+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
|
|
6
|
+
|
|
7
|
+
vscode:
|
|
8
|
+
extensions:
|
|
9
|
+
- yzhang.markdown-all-in-one
|
|
10
|
+
- redhat.vscode-yaml
|
|
11
|
+
- akamud.vscode-caniuse
|
|
12
|
+
- visualstudioexptteam.intellicode-api-usage-examples
|
|
13
|
+
- pflannery.vscode-versionlens
|
|
14
|
+
- christian-kohler.npm-intellisense
|
|
15
|
+
- esbenp.prettier-vscode
|
|
16
|
+
- rangav.vscode-thunder-client
|
|
17
|
+
- eamodio.gitlens
|
|
18
|
+
- github.vscode-pull-request-github
|
|
19
|
+
- github.vscode-github-actions
|
|
20
|
+
tasks:
|
|
21
|
+
- init: pnpm i
|
|
22
|
+
command: pnpm build
|
package/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
package/ReadMe.md
CHANGED
|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Unofficial [TypeScript][1] SDK for [FeiShu/Lark API][2], which is based on [MobX-RESTful][3].
|
|
4
4
|
|
|
5
|
-
[][4]
|
|
6
6
|
[][5]
|
|
7
7
|
[][6]
|
|
8
8
|
|
|
9
9
|
[][7]
|
|
10
10
|
|
|
11
|
+
## Versions
|
|
12
|
+
|
|
13
|
+
| SemVer | branch | status | ES decorator | MobX |
|
|
14
|
+
| :--------: | :------: | :----------: | :----------: | :---------: |
|
|
15
|
+
| `>=2` | `main` | ✅developing | stage-3 | `>=6.11` |
|
|
16
|
+
| `>=0.8 <2` | `main` | ❌deprecated | stage-2 | `>=4 <6.11` |
|
|
17
|
+
| `<0.8` | `master` | ❌deprecated | | |
|
|
18
|
+
|
|
11
19
|
## Usage
|
|
12
20
|
|
|
13
21
|
- [Example](test/index.spec.ts)
|
|
14
22
|
- [API document](https://idea2app.github.io/MobX-Lark/)
|
|
15
23
|
|
|
24
|
+
> Some **Node.js** tips about the upstream `mobx-restful` you should know:
|
|
25
|
+
> https://github.com/idea2app/MobX-RESTful?tab=readme-ov-file#usage
|
|
26
|
+
|
|
16
27
|
## User cases
|
|
17
28
|
|
|
18
29
|
1. [idea2app web-site](https://github.com/idea2app/idea2app.github.io/tree/main/models)
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=require("@swc/helpers/cjs/_async_to_generator.cjs"),t=require("@swc/helpers/cjs/_class_call_check.cjs"),n=require("@swc/helpers/cjs/_create_class.cjs"),r=require("@swc/helpers/cjs/_object_spread.cjs"),a=require("@swc/helpers/cjs/_object_spread_props.cjs"),s=require("@swc/helpers/cjs/_ts_generator.cjs"),c=require("koajax"),u=require("web-utility"),i=require("@swc/helpers/cjs/_async_generator_delegate.cjs"),o=require("@swc/helpers/cjs/_async_iterator.cjs"),l=require("@swc/helpers/cjs/_await_async_generator.cjs"),_=require("@swc/helpers/cjs/_wrap_async_generator.cjs"),d=require("@swc/helpers/cjs/_ts_values.cjs"),f=require("@swc/helpers/cjs/_inherits.cjs"),h=require("@swc/helpers/cjs/_create_super.cjs"),p=require("@swc/helpers/cjs/_ts_decorate.cjs"),v=require("mobx-restful"),b=require("@swc/helpers/cjs/_object_without_properties.cjs"),y=require("@swc/helpers/cjs/_sliced_to_array.cjs"),g=require("@swc/helpers/cjs/_to_array.cjs"),k=require("@swc/helpers/cjs/_assert_this_initialized.cjs"),w=require("mobx");function m(e,t){return Object.keys(t).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})}),e}function j(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var R={};function I(e){return!!(null==e?void 0:e.code)}j(R,"isLarkError",function(){return I});var U={};j(U,"LarkApp",function(){return O});var O=function(){function i(n){var r,a,o=n.host,l=void 0===o?"https://open.feishu.cn/open-apis/":o,_=n.id,d=n.secret;(0,t._)(this,i);var f=this;this.getTenantAccessToken=(0,u.cache)((r=(0,e._)(function(e){var t,n,r;return(0,s._)(this,function(a){switch(a.label){case 0:return t=f.id,n=f.secret,console.assert(t&&n,"Id & Secret of Lark App are required"),[4,f.client.post("auth/v3/tenant_access_token/internal",{app_id:t,app_secret:n})];case 1:return setTimeout(function(){delete f.accessToken,e()},(r=a.sent().body).expire*u.Second),[2,f.accessToken=r.tenant_access_token]}})}),function(e){return r.apply(this,arguments)}),"Tenant Access Token");var h=this;this.getJSTicket=(0,u.cache)((a=(0,e._)(function(e){var t,n,r;return(0,s._)(this,function(a){switch(a.label){case 0:return[4,h.getAccessToken()];case 1:return a.sent(),[4,h.client.post("jssdk/ticket/get")];case 2:return n=(t=a.sent().body.data).expire_in,r=t.ticket,setTimeout(e,n*u.Second),[2,r]}})}),function(e){return a.apply(this,arguments)}),"JS ticket"),console.assert(!globalThis.window||!d,"App Secret can't be used in client"),this.host=l,this.id=_,this.secret=d,this.client=new c.HTTPClient({baseURI:l,responseType:"json"}),this.boot()}return(0,n._)(i,[{key:"boot",value:function(){var t,n=this;this.client.use((t=(0,e._)(function(e,t){var c,u,i,o,l,_;return(0,s._)(this,function(s){switch(s.label){case 0:c=e.request,u=e.response,(i=n.accessToken)&&(c.headers=(0,a._)((0,r._)({},c.headers),{Authorization:"Bearer ".concat(i)})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,t()];case 2:if(s.sent(),I(o=u.body))throw console.error(o),URIError(o.msg);return[3,4];case 3:throw l=s.sent(),_=c.method,console.error(_,c.path,u.status,u.body),l;case 4:return[2]}})}),function(e,n){return t.apply(this,arguments)}))}},{key:"getAccessToken",value:function(){return this.getTenantAccessToken()}},{key:"getWebSignInURL",value:function(e,t){return"".concat(this.client.baseURI,"authen/v1/index?").concat((0,u.buildURLData)({app_id:this.id,redirect_uri:e,state:t}))}},{key:"getUserMeta",value:function(t){var n=this;return(0,e._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:return[4,n.getAccessToken()];case 1:return e.sent(),[4,n.client.post("authen/v1/access_token",{grant_type:"authorization_code",code:t})];case 2:return[2,e.sent().body.data]}})})()}},{key:"downloadFile",value:function(t){var n=this;return(0,e._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:return[4,n.getAccessToken()];case 1:return e.sent(),[4,n.client.request({path:"drive/v1/medias/".concat(t,"/download"),responseType:"arraybuffer"})];case 2:return[2,e.sent().body]}})})()}},{key:"uploadFile",value:function(t,n,r){var a=this;return(0,e._)(function(){var e;return(0,s._)(this,function(s){switch(s.label){case 0:return[4,a.getAccessToken()];case 1:return s.sent(),e=(0,c.makeFormData)({file:t,file_name:t.name,size:t.size,parent_type:n,parent_node:r}),[4,a.client.post("drive/v1/medias/upload_all",e)];case 2:return[2,s.sent().body.data.file_token]}})})()}}]),i}(),S={},L={};function T(e,t,n){return q.apply(this,arguments)}function q(){return(q=(0,_._)(function(e,t,n){var c,_,f,h,p,v,b,y,g=arguments;return(0,s._)(this,function(s){switch(s.label){case 0:c=g.length>3&&void 0!==g[3]?g[3]:{},_=0,f="",s.label=1;case 1:return[4,(0,l._)(e.get("".concat(t,"?").concat((0,u.buildURLData)((0,a._)((0,r._)({},c),{page_size:100,page_token:f})))))];case 2:return p=(h=s.sent().body.data).items,v=h.total,b=h.has_more,y=h.page_token,null!=v?_=v:_+=(null==p?void 0:p.length)||0,f=y,n(b?1/0:_),[5,(0,d._)((0,i._)((0,o._)(p||[]),l._))];case 3:s.sent(),s.label=4;case 4:if(b)return[3,1];s.label=5;case 5:return[2]}})})).apply(this,arguments)}j(L,"createPageStream",function(){return T});var M={};j(M,"ChatListModel",function(){return C}),j(M,"MessageListModel",function(){return A});var x={};m(x,{});var C=function(r){(0,f._)(c,r);var a=(0,h._)(c);function c(){var e;return(0,t._)(this,c),e=a.apply(this,arguments),e.baseURI="im/v1/chats",e}return(0,n._)(c,[{key:"openStream",value:function(){var e=this;return(0,_._)(function(){var t,n,r,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:t=!1,n=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),a=(0,o._)(T(e.client,e.baseURI,function(t){return e.totalCount=t})),s.label=2;case 2:return[4,(0,l._)(a.next())];case 3:if(!(t=!(c=s.sent()).done))return[3,6];return[4,c.value];case 4:s.sent(),s.label=5;case 5:return t=!1,[3,2];case 6:return[3,13];case 7:return u=s.sent(),n=!0,r=u,[3,13];case 8:if(s.trys.push([8,,11,12]),!(t&&null!=a.return))return[3,10];return[4,a.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(n)throw r;return[7];case 12:return[7];case 13:return[2]}})})()}},{key:"updateOne",value:function(t){var n=t.chat_id,r=this;return(0,e._)(function(){var e;return(0,s._)(this,function(t){switch(t.label){case 0:return[4,n?r.client.put("".concat(r.baseURI,"/chats/").concat(n)):r.client.post("".concat(r.baseURI,"/chats?").concat((0,u.buildURLData)({set_bot_manager:!0})))];case 1:return e=t.sent().body,[2,r.currentOne=e.data]}})})()}}]),c}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("uploading")],C.prototype,"updateOne",null);var A=function(r){(0,f._)(c,r);var a=(0,h._)(c);function c(e){var n;return(0,t._)(this,c),(n=a.call(this)).chatId=e,n.baseURI="im/v1/messages",n}return(0,n._)(c,[{key:"openStream",value:function(){var e=this;return(0,_._)(function(){var t,n,r,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:t=!1,n=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),a=(0,o._)(T(e.client,e.baseURI,function(t){return e.totalCount=t})),s.label=2;case 2:return[4,(0,l._)(a.next())];case 3:if(!(t=!(c=s.sent()).done))return[3,6];return[4,c.value];case 4:s.sent(),s.label=5;case 5:return t=!1,[3,2];case 6:return[3,13];case 7:return u=s.sent(),n=!0,r=u,[3,13];case 8:if(s.trys.push([8,,11,12]),!(t&&null!=a.return))return[3,10];return[4,a.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(n)throw r;return[7];case 12:return[7];case 13:return[2]}})})()}},{key:"createOne",value:function(t){var n=t.msg_type,r=t.content,a=this;return(0,e._)(function(){var e;return(0,s._)(this,function(t){switch(t.label){case 0:return[4,a.client.post("".concat(a.baseURI,"?").concat((0,u.buildURLData)({receive_id_type:"chat_id"})),{receive_id:a.chatId,msg_type:n,content:JSON.stringify(r)})];case 1:return e=t.sent().body,[2,a.currentOne=e.data]}})})()}}]),c}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("uploading")],A.prototype,"createOne",null),m(M,x);var D={};j(D,"TaskModel",function(){return z}),j(D,"TaskListModel",function(){return F}),j(D,"TaskListSectionModel",function(){return V}),j(D,"TaskFieldModel",function(){return B});var z=function(a){(0,f._)(i,a);var c=(0,h._)(i);function i(){var e;return(0,t._)(this,i),e=c.apply(this,arguments),e.baseURI="task/v2/tasks",e}return(0,n._)(i,[{key:"openStream",value:function(e){var t=this;return(0,_._)(function(){var n,a,c,u,i,_,d,f,h,p,v,y,g,k,w,m,j,R,I,U,O;return(0,s._)(this,function(s){switch(s.label){case 0:if(a=void 0===(n=e.resource_type)?"my_tasks":n,c=e.resource_id,i=void 0===(u=e.user_id_type)?"union_id":u,_=(0,b._)(e,["resource_type","resource_id","user_id_type"]),"my_tasks"!==a)return[3,14];d=T(t.client,t.baseURI,function(e){return t.totalCount=e},(0,r._)({type:a,user_id_type:i},_)),f=!1,h=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),v=(0,o._)(d),s.label=2;case 2:return[4,(0,l._)(v.next())];case 3:if(!(f=!(y=s.sent()).done))return[3,6];return[4,y.value];case 4:s.sent(),s.label=5;case 5:return f=!1,[3,2];case 6:return[3,13];case 7:return g=s.sent(),h=!0,p=g,[3,13];case 8:if(s.trys.push([8,,11,12]),!(f&&null!=v.return))return[3,10];return[4,v.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(h)throw p;return[7];case 12:return[7];case 13:return[3,28];case 14:k=T(t.client,"task/v2/tasklists/".concat(c,"/tasks"),function(e){return t.totalCount=e},(0,r._)({user_id_type:i},_)),w=!1,m=!1,s.label=15;case 15:s.trys.push([15,22,23,28]),R=(0,o._)(k),s.label=16;case 16:return[4,(0,l._)(R.next())];case 17:if(!(w=!(I=s.sent()).done))return[3,21];return U=I.value.guid,[4,(0,l._)(t.getOne(U,i))];case 18:return[4,s.sent()];case 19:s.sent(),s.label=20;case 20:return w=!1,[3,16];case 21:return[3,28];case 22:return O=s.sent(),m=!0,j=O,[3,28];case 23:if(s.trys.push([23,,26,27]),!(w&&null!=R.return))return[3,25];return[4,R.return()];case 24:s.sent(),s.label=25;case 25:return[3,27];case 26:if(m)throw j;return[7];case 27:return[7];case 28:return[2]}})})()}},{key:"getOne",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"union_id",r=this;return(0,e._)(function(){var e;return(0,s._)(this,function(a){switch(a.label){case 0:return[4,r.client.get("".concat(r.baseURI,"/").concat(t,"?").concat((0,u.buildURLData)({user_id_type:n})))];case 1:return e=a.sent().body,[2,r.currentOne=e.data.task]}})})()}},{key:"updateOne",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"union_id",a=this;return(0,e._)(function(){var e,c;return(0,s._)(this,function(s){switch(s.label){case 0:if(e="task/v2/tasks?".concat((0,u.buildURLData)({user_id_type:r})),!n)return[3,2];return[4,a.client.patch(e,{task:t,update_fields:Object.keys(t)})];case 1:return c=s.sent(),[3,4];case 2:return[4,a.client.post(e,t)];case 3:c=s.sent(),s.label=4;case 4:return[2,c.body.data.task]}})})()}}]),i}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("downloading")],z.prototype,"getOne",null),(0,p._)([(0,v.toggle)("uploading")],z.prototype,"updateOne",null);var F=function(r){(0,f._)(c,r);var a=(0,h._)(c);function c(){var e;return(0,t._)(this,c),e=a.apply(this,arguments),e.baseURI="task/v2/tasklists",e}return(0,n._)(c,[{key:"openStream",value:function(e){var t=e.user_id_type,n=void 0===t?"union_id":t,r=this;return(0,_._)(function(){var e,t,a,c,u,i;return(0,s._)(this,function(s){switch(s.label){case 0:e=!1,t=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),c=(0,o._)(T(r.client,r.baseURI,function(e){return r.totalCount=e},{user_id_type:n})),s.label=2;case 2:return[4,(0,l._)(c.next())];case 3:if(!(e=!(u=s.sent()).done))return[3,6];return[4,u.value];case 4:s.sent(),s.label=5;case 5:return e=!1,[3,2];case 6:return[3,13];case 7:return i=s.sent(),t=!0,a=i,[3,13];case 8:if(s.trys.push([8,,11,12]),!(e&&null!=c.return))return[3,10];return[4,c.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(t)throw a;return[7];case 12:return[7];case 13:return[2]}})})()}},{key:"getOne",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"union_id",r=this;return(0,e._)(function(){var e;return(0,s._)(this,function(a){switch(a.label){case 0:return[4,r.client.get("".concat(r.baseURI,"/").concat(t,"?").concat((0,u.buildURLData)({user_id_type:n})))];case 1:return e=a.sent().body,[2,r.currentOne=e.data.tasklist]}})})()}},{key:"updateOne",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"union_id",a=this;return(0,e._)(function(){var e,c;return(0,s._)(this,function(s){switch(s.label){case 0:if(e="".concat(a.baseURI,"?").concat((0,u.buildURLData)({user_id_type:r})),!n)return[3,2];return[4,a.client.post(e,{tasklist:t,update_fields:Object.keys(t)})];case 1:return c=s.sent(),[3,4];case 2:return[4,a.client.post(e,t)];case 3:c=s.sent(),s.label=4;case 4:return[2,c.body.data.tasklist]}})})()}}]),c}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("downloading")],F.prototype,"getOne",null),(0,p._)([(0,v.toggle)("uploading")],F.prototype,"updateOne",null);var V=function(a){(0,f._)(i,a);var c=(0,h._)(i);function i(){var e;return(0,t._)(this,i),e=c.apply(this,arguments),e.baseURI="task/v2/sections",e}return(0,n._)(i,[{key:"openStream",value:function(e){var t=e.resource_type,n=void 0===t?"my_tasks":t,r=e.resource_id,a=e.user_id_type,c=void 0===a?"union_id":a,u=this;return(0,_._)(function(){var e,t,a,i,_,d,f,h;return(0,s._)(this,function(s){switch(s.label){case 0:e=T(u.client,u.baseURI,function(e){return u.totalCount=e},{resource_type:n,resource_id:r,user_id_type:c}),t=!1,a=!1,s.label=1;case 1:s.trys.push([1,8,9,14]),_=(0,o._)(e),s.label=2;case 2:return[4,(0,l._)(_.next())];case 3:if(!(t=!(d=s.sent()).done))return[3,7];return f=d.value.guid,[4,(0,l._)(u.getOne(f))];case 4:return[4,s.sent()];case 5:s.sent(),s.label=6;case 6:return t=!1,[3,2];case 7:return[3,14];case 8:return h=s.sent(),a=!0,i=h,[3,14];case 9:if(s.trys.push([9,,12,13]),!(t&&null!=_.return))return[3,11];return[4,_.return()];case 10:s.sent(),s.label=11;case 11:return[3,13];case 12:if(a)throw i;return[7];case 13:return[7];case 14:return[2]}})})()}},{key:"getOne",value:function(t){var n=this;return(0,e._)(function(){var e;return(0,s._)(this,function(r){switch(r.label){case 0:return[4,n.client.get("".concat(n.baseURI,"/").concat(t))];case 1:return e=r.sent().body,[2,n.currentOne=e.data.section]}})})()}},{key:"updateOne",value:function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"union_id",c=(0,y._)(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],1),i=c[0],o=this;return(0,e._)(function(){var e,c;return(0,s._)(this,function(s){switch(s.label){case 0:if(e="".concat(o.baseURI,"?").concat((0,u.buildURLData)({user_id_type:a})),!n)return[3,2];return[4,o.client.patch(e,{section:t,update_fields:Object.keys(t)})];case 1:return c=s.sent(),[3,4];case 2:return[4,o.client.post(e,(0,r._)({name:t.name},i))];case 3:c=s.sent(),s.label=4;case 4:return[2,c.body.data.section]}})})()}}]),i}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("downloading")],V.prototype,"getOne",null),(0,p._)([(0,v.toggle)("uploading")],V.prototype,"updateOne",null);var B=function(a){(0,f._)(i,a);var c=(0,h._)(i);function i(){var e;return(0,t._)(this,i),e=c.apply(this,arguments),e.baseURI="task/v2/custom_fields",e}return(0,n._)(i,[{key:"openStream",value:function(e){var t=e.resource_type,n=void 0===t?"tasklist":t,r=e.resource_id,a=e.user_id_type,c=void 0===a?"union_id":a,u=this;return(0,_._)(function(){var e,t,a,i,_,d;return(0,s._)(this,function(s){switch(s.label){case 0:e=!1,t=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),i=(0,o._)(T(u.client,u.baseURI,function(e){return u.totalCount=e},{resource_type:n,resource_id:r,user_id_type:c})),s.label=2;case 2:return[4,(0,l._)(i.next())];case 3:if(!(e=!(_=s.sent()).done))return[3,6];return[4,_.value];case 4:s.sent(),s.label=5;case 5:return e=!1,[3,2];case 6:return[3,13];case 7:return d=s.sent(),t=!0,a=d,[3,13];case 8:if(s.trys.push([8,,11,12]),!(e&&null!=i.return))return[3,10];return[4,i.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(t)throw a;return[7];case 12:return[7];case 13:return[2]}})})()}},{key:"updateOne",value:function(t,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"union_id",c=(0,g._)(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]),i=c[0],o=c.slice(1),l=this;return(0,e._)(function(){var e,c,_,d,f,h,p,v,b,y;return(0,s._)(this,function(s){switch(s.label){case 0:if(e="".concat(l.baseURI,"?").concat((0,u.buildURLData)({user_id_type:a})),!n)return[3,2];return[4,l.client.patch(e,{custom_field:t,update_fields:Object.keys(t)})];case 1:return c=s.sent(),[3,4];case 2:return[4,l.client.post(e,(0,r._)({},t,i))];case 3:c=s.sent(),s.label=4;case 4:_=c.body.data.custom_field,d=!0,f=!1,h=void 0,s.label=5;case 5:s.trys.push([5,10,11,12]),p=o[Symbol.iterator](),s.label=6;case 6:if(d=(v=p.next()).done)return[3,9];return b=v.value,[4,l.client.post("".concat(l.baseURI,"/").concat(_.guid,"/add"),b)];case 7:s.sent(),s.label=8;case 8:return d=!0,[3,6];case 9:return[3,12];case 10:return y=s.sent(),f=!0,h=y,[3,12];case 11:try{d||null==p.return||p.return()}finally{if(f)throw h}return[7];case 12:return[2,_]}})})()}}]),i}((0,v.Stream)(v.ListModel));(0,p._)([(0,v.toggle)("uploading")],B.prototype,"updateOne",null),m(D,{});var E={};j(E,"SpreadSheetModel",function(){return P});var P=function(r){(0,f._)(c,r);var a=(0,h._)(c);function c(e,n){var r,s;return(0,t._)(this,c),(r=a.call(this)).id=e,r.sheetId=n,r.baseURI="",r.offset=[0,0],null===(s=w.makeObservable)||void 0===s||s.call(w,(0,k._)(r)),r.baseURI="sheets/v2/spreadsheets/".concat(e),r}return(0,n._)(c,[{key:"getMeta",value:function(){var t=this;return(0,e._)(function(){var e,n,r;return(0,s._)(this,function(a){switch(a.label){case 0:if(t.meta)return[2,t.meta];return[4,t.client.get("".concat(t.baseURI,"/metainfo"))];case 1:return e=a.sent().body,n=t.sheetId,console.assert(r=e.data.sheets.find(function(e){return e.sheetId===n}),'Sheet "'.concat(n,'" is not found')),[2,t.meta=r]}})})()}},{key:"loadPage",value:function(t,n,r){var a=this;return(0,e._)(function(){var e,r,c,i,o,l,_,d,f,h,p;return(0,s._)(this,function(s){switch(s.label){case 0:return e=a.columnKeys,c=(r=(0,y._)(a.offset,2))[0],i=r[1],[4,a.getMeta()];case 1:return o=s.sent().rowCount,l=c+1,_=65+i,d=Math.min(l-1+n*t,o),f=_-1+e.length,h=String.fromCharCode(_),p=String.fromCharCode(f),[4,a.client.get("".concat(a.baseURI,"/values/").concat(a.sheetId,"!").concat(h).concat(l,":").concat(p).concat(d,"?").concat((0,u.buildURLData)({dateTimeRenderOption:"FormattedString"})))];case 2:return[2,{pageData:s.sent().body.data.valueRange.values.map(function(t){return(0,u.objectFrom)(t,e)}),totalCount:o-c}]}})})()}}]),c}(v.ListModel);(0,p._)([w.observable],P.prototype,"meta",void 0),(0,p._)([(0,v.toggle)("downloading")],P.prototype,"getMeta",null),m(E,{});var J={};function K(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contains",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AND",r=Object.entries(e).map(function(e){var n=(0,y._)(e,2),r=n[0],a=n[1];return null!=a&&(a instanceof Array?a:[a]).map(function(e){return"CurrentValue.[".concat(r,"]")+("contains"===t?'.contains("'.concat(e,'")'):"".concat(t).concat(JSON.stringify(e)))})}).filter(Boolean).flat();return r[1]?"".concat(n,"(").concat(r,")"):r[0]}j(J,"makeSimpleFilter",function(){return K}),j(J,"normalizeText",function(){return N}),j(J,"BiDataTable",function(){return H}),j(J,"BiTableView",function(){return W}),j(J,"BiTable",function(){return G});var N=function(e){return e&&"object"==typeof e&&"text"in e&&e.text||""};function H(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v.ListModel,c=function(a){(0,f._)(i,a);var c=(0,h._)(i);function i(e,n){var r;return(0,t._)(this,i),(r=c.call(this)).requiredKeys=[],r.sort={},r.baseURI="bitable/v1/apps/".concat(e,"/tables/").concat(n,"/records"),r}return(0,n._)(i,[{key:"normalize",value:function(e){var t=e.fields,n=(0,b._)(e,["fields"]);return(0,r._)({},n,t)}},{key:"getOne",value:function(t){var n=this;return(0,e._)(function(){var e;return(0,s._)(this,function(r){switch(r.label){case 0:return[4,n.client.get("".concat(n.baseURI,"/").concat(t))];case 1:return e=r.sent().body,[2,n.currentOne=n.normalize(e.data.record)]}})})()}},{key:"updateOne",value:function(t,n){var r=this;return(0,e._)(function(){var e;return(0,s._)(this,function(a){switch(a.label){case 0:return[4,n?r.client.put("".concat(r.baseURI,"/").concat(n),{fields:t}):r.client.post(r.baseURI,{fields:t})];case 1:return e=a.sent().body,[2,r.currentOne=r.normalize(e.data.record)]}})})()}},{key:"makeFilter",value:function(e){return[this.requiredKeys[0]&&K(Object.fromEntries(this.requiredKeys.map(function(e){return[e,""]})),"!="),!(0,u.isEmpty)(e)&&K(e)].filter(Boolean).join("&&")}},{key:"openStream",value:function(e){var t=this;return(0,_._)(function(){var n,r,a,c,u,i,_,d,f;return(0,s._)(this,function(s){switch(s.label){case 0:n=t.currentViewId,r=T(t.client,t.baseURI,function(e){return t.totalCount=e},n?{view_id:n}:{filter:t.makeFilter(e),sort:JSON.stringify(Object.entries(t.sort).map(function(e){var t=(0,y._)(e,2),n=t[0],r=t[1];return"".concat(n," ").concat(r)}))}),a=!1,c=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),i=(0,o._)(r),s.label=2;case 2:return[4,(0,l._)(i.next())];case 3:if(!(a=!(_=s.sent()).done))return[3,6];return d=_.value,[4,t.normalize(d)];case 4:s.sent(),s.label=5;case 5:return a=!1,[3,2];case 6:return[3,13];case 7:return f=s.sent(),c=!0,u=f,[3,13];case 8:if(s.trys.push([8,,11,12]),!(a&&null!=i.return))return[3,10];return[4,i.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(c)throw u;return[7];case 12:return[7];case 13:return[2]}})})()}},{key:"getViewList",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.pageIndex+1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.pageSize,a=this;return(0,e._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,,2,3]),a.currentViewId=t,[4,a.getList({},n,r)];case 1:return[2,e.sent()];case 2:return a.currentViewId=void 0,[7];case 3:return[2]}})})()}},{key:"getViewAll",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.pageSize,r=this;return(0,e._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:r.clearList(),e.label=1;case 1:if(r.noMore)return[3,3];return[4,r.getViewList(t,void 0,n)];case 2:return e.sent(),[3,1];case 3:return[2,r.allItems]}})})()}}]),i}((0,v.Stream)(a));return(0,p._)([(0,v.toggle)("downloading")],c.prototype,"getOne",null),(0,p._)([(0,v.toggle)("uploading")],c.prototype,"updateOne",null),c}function W(){return function(e){(0,f._)(a,e);var r=(0,h._)(a);function a(e,n){var s;return(0,t._)(this,a),(s=r.call(this)).baseURI="bitable/v1/apps/".concat(e,"/tables/").concat(n,"/views"),s}return(0,n._)(a,[{key:"openStream",value:function(){var e=this;return(0,_._)(function(){var t,n,r,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:t=!1,n=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),a=(0,o._)(T(e.client,e.baseURI,function(t){return e.totalCount=t})),s.label=2;case 2:return[4,(0,l._)(a.next())];case 3:if(!(t=!(c=s.sent()).done))return[3,6];return[4,c.value];case 4:s.sent(),s.label=5;case 5:return t=!1,[3,2];case 6:return[3,13];case 7:return u=s.sent(),n=!0,r=u,[3,13];case 8:if(s.trys.push([8,,11,12]),!(t&&null!=a.return))return[3,10];return[4,a.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(n)throw r;return[7];case 12:return[7];case 13:return[2]}})})()}}]),a}((0,v.Stream)(v.ListModel))}function G(){return function(r){(0,f._)(c,r);var a=(0,h._)(c);function c(e){var n;return(0,t._)(this,c),(n=a.call(this)).id=e,n.baseURI="bitable/v1/apps/".concat(e,"/tables"),n}return(0,n._)(c,[{key:"getOne",value:function(t,n){var r=this;return(0,e._)(function(){var e,a,c;return(0,s._)(this,function(s){switch(s.label){case 0:if(!(e=r.allItems)[0])return[3,1];return a=e,[3,3];case 1:return[4,r.getAll()];case 2:a=s.sent(),s.label=3;case 3:if(!(c=a.find(function(e){return e.name===t})))throw URIError('Table "'.concat(t,'" is not found'));return n instanceof Function&&(r.currentDataTable=Reflect.construct(n,[r.id,c.table_id])),[2,r.currentOne=c]}})})()}},{key:"openStream",value:function(){var e=this;return(0,_._)(function(){var t,n,r,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:t=!1,n=!1,s.label=1;case 1:s.trys.push([1,7,8,13]),a=(0,o._)(T(e.client,e.baseURI,function(t){return e.totalCount=t})),s.label=2;case 2:return[4,(0,l._)(a.next())];case 3:if(!(t=!(c=s.sent()).done))return[3,6];return[4,c.value];case 4:s.sent(),s.label=5;case 5:return t=!1,[3,2];case 6:return[3,13];case 7:return u=s.sent(),n=!0,r=u,[3,13];case 8:if(s.trys.push([8,,11,12]),!(t&&null!=a.return))return[3,10];return[4,a.return()];case 9:s.sent(),s.label=10;case 10:return[3,12];case 11:if(n)throw r;return[7];case 12:return[7];case 13:return[2]}})})()}}]),c}((0,v.Stream)(v.ListModel))}m(J,{}),m(S,L),m(S,M),m(S,D),m(S,E),m(S,J),m(module.exports,R),m(module.exports,U),m(module.exports,S);
|
|
1
|
+
var e,t,n,r,a,i,c,s,o,u,l,f,h,d,b,v,p,y,m,_,g,w,O,j,k,S,I,P,x,T,R,U,L,E,A,M,C,q,z,D,F,V,B,J,K,N,W=require("@swc/helpers/cjs/_class_call_check.cjs"),H=require("@swc/helpers/cjs/_create_class.cjs"),G=require("@swc/helpers/cjs/_ts_generator.cjs"),Q=require("koajax"),X=require("web-utility"),Y=require("@swc/helpers/cjs/_ts_values.cjs"),Z=require("@swc/helpers/cjs/_assert_this_initialized.cjs"),$=require("@swc/helpers/cjs/_inherits.cjs"),ee=require("@swc/helpers/cjs/_create_super.cjs"),et=require("mobx-restful"),en=require("@swc/helpers/cjs/_sliced_to_array.cjs"),er=require("@swc/helpers/cjs/_to_array.cjs"),ea=require("mobx");function ei(e,t){return Object.keys(t).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})}),e}function ec(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var es={};function eo(e){return!!(null==e?void 0:e.code)}ec(es,"isLarkError",function(){return eo});var eu={};ec(eu,"LarkApp",function(){return ef});var el=function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function c(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,s)}o((r=r.apply(e,t||[])).next())})},ef=/*#__PURE__*/function(){function e(t){var n=this,r=t.host,a=void 0===r?"https://open.feishu.cn/open-apis/":r,i=t.id,c=t.secret;(0,W._)(this,e),Object.defineProperty(this,"host",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"accessToken",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getTenantAccessToken",{enumerable:!0,configurable:!0,writable:!0,value:(0,X.cache)(function(e){return el(n,void 0,void 0,function(){var t,n,r,a,i;return(0,G._)(this,function(c){switch(c.label){case 0:return t=this,n=this,r=n.id,a=n.secret,console.assert(r&&a,"Id & Secret of Lark App are required"),[4,this.client.post("auth/v3/tenant_access_token/internal",{app_id:r,app_secret:a})];case 1:return setTimeout(function(){delete t.accessToken,e()},(i=c.sent().body).expire*X.Second),[2,this.accessToken=i.tenant_access_token]}})})},"Tenant Access Token")}),Object.defineProperty(this,"getJSTicket",{enumerable:!0,configurable:!0,writable:!0,value:(0,X.cache)(function(e){return el(n,void 0,void 0,function(){var t,n,r;return(0,G._)(this,function(a){switch(a.label){case 0:return[4,this.getAccessToken()];case 1:return a.sent(),[4,this.client.post("jssdk/ticket/get")];case 2:return n=(t=a.sent().body.data).expire_in,r=t.ticket,setTimeout(e,n*X.Second),[2,r]}})})},"JS ticket")}),console.assert(!globalThis.window||!c,"App Secret can't be used in client"),this.host=a,this.id=i,this.secret=c,this.client=new Q.HTTPClient({baseURI:a,responseType:"json"}),this.boot()}return(0,H._)(e,[{key:"boot",value:function(){var e=this;this.client.use(function(t,n){return el(e,[t,n],void 0,function(e,t){var n,r,a,i,c,s;return(0,G._)(this,function(o){switch(o.label){case 0:n=e.request,r=e.response,(a=this.accessToken)&&(n.headers=Object.assign(Object.assign({},n.headers),{Authorization:"Bearer ".concat(a)})),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,t()];case 2:if(o.sent(),eo(i=r.body))throw console.error(i),URIError(i.msg);return[3,4];case 3:throw c=o.sent(),s=n.method,console.error(s,n.path,r.status,r.body),c;case 4:return[2]}})})})}},{key:"getAccessToken",value:function(){return this.getTenantAccessToken()}},{key:"getWebSignInURL",value:function(e,t){return"".concat(this.client.baseURI,"authen/v1/index?").concat((0,X.buildURLData)({app_id:this.id,redirect_uri:e,state:t}))}},{key:"getUserMeta",value:function(e){return el(this,void 0,void 0,function(){return(0,G._)(this,function(t){switch(t.label){case 0:return[4,this.getAccessToken()];case 1:return t.sent(),[4,this.client.post("authen/v1/access_token",{grant_type:"authorization_code",code:e})];case 2:return[2,t.sent().body.data]}})})}},{key:"downloadFile",value:function(e){return el(this,void 0,void 0,function(){return(0,G._)(this,function(t){switch(t.label){case 0:return[4,this.getAccessToken()];case 1:return t.sent(),[4,this.client.request({path:"drive/v1/medias/".concat(e,"/download"),responseType:"arraybuffer"})];case 2:return[2,t.sent().body]}})})}},{key:"uploadFile",value:function(e,t,n){return el(this,void 0,void 0,function(){var r;return(0,G._)(this,function(a){switch(a.label){case 0:return[4,this.getAccessToken()];case 1:return a.sent(),r=(0,Q.makeFormData)({file:e,file_name:e.name,size:e.size,parent_type:t,parent_node:n}),[4,this.client.post("drive/v1/medias/upload_all",r)];case 2:return[2,a.sent().body.data.file_token]}})})}}]),e}(),eh={},ed={};ec(ed,"createPageStream",function(){return em});var eb=function(e){return this instanceof eb?(this.v=e,this):new eb(e)},ev=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,a,(t=e[n](t)).done,t.value)})}}},ep=function(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:eb(e[r](t)),done:!1}:a?a(t):t}:a}},ey=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function c(e,t){a[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof eb?Promise.resolve(n.value.v).then(o,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}}function o(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}};function em(e,t,n){return ey(this,arguments,function(e,t,n){var r,a,i,c,s,o,u,l,f=arguments;return(0,G._)(this,function(h){switch(h.label){case 0:r=f.length>3&&void 0!==f[3]?f[3]:{},a=0,i="",h.label=1;case 1:return[4,eb(e.get("".concat(t,"?").concat((0,X.buildURLData)(Object.assign(Object.assign({},r),{page_size:100,page_token:i})))))];case 2:return s=(c=h.sent().body.data).items,o=c.total,u=c.has_more,l=c.page_token,null!=o?a=o:a+=(null==s?void 0:s.length)||0,i=l,n(u?1/0:a),[5,(0,Y._)(ep(ev(s||[])))];case 3:return[4,eb.apply(void 0,[h.sent()])];case 4:h.sent(),h.label=5;case 5:if(u)return[3,1];h.label=6;case 6:return[2]}})})}var e_={};ec(e_,"ChatListModel",function(){return eP}),ec(e_,"MessageListModel",function(){return ex});var eg={};ei(eg,{});var ew=function(e,t,n){for(var r=arguments.length>2,a=0;a<t.length;a++)n=r?t[a].call(e,n):t[a].call(e);return r?n:void 0},eO=function(e,t,n,r,a,i){function c(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,o=r.kind,u="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?r.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var b={};for(var v in r)b[v]="access"===v?{}:r[v];for(var v in r.access)b.access[v]=r.access[v];b.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var p=(0,n[d])("accessor"===o?{get:f.get,set:f.set}:f[u],b);if("accessor"===o){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw TypeError("Object expected");(s=c(p.get))&&(f.get=s),(s=c(p.set))&&(f.set=s),(s=c(p.init))&&a.unshift(s)}else(s=c(p))&&("field"===o?a.unshift(s):f[u]=s)}l&&Object.defineProperty(l,r.name,f),h=!0},ej=function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function c(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,s)}o((r=r.apply(e,t||[])).next())})},ek=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,a,(t=e[n](t)).done,t.value)})}}},eS=function(e){return this instanceof eS?(this.v=e,this):new eS(e)},eI=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function c(e,t){a[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof eS?Promise.resolve(n.value.v).then(o,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}}function o(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}},eP=(t=(0,et.Stream)(et.ListModel),n=[],e=/*#__PURE__*/function(e){(0,$._)(r,e);var t=(0,ee._)(r);function r(){var e;return(0,W._)(this,r),e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments))),Object.defineProperty((0,Z._)(e),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:(ew((0,Z._)(e),n),"im/v1/chats")}),e}return(0,H._)(r,[{key:"openStream",value:function(){return eI(this,arguments,function(){var e,t,n,r,a,i,c,s;return(0,G._)(this,function(o){switch(o.label){case 0:e=this,o.label=1;case 1:o.trys.push([1,8,9,14]),i=!0,c=ek(em(this.client,this.baseURI,function(t){return e.totalCount=t})),o.label=2;case 2:return[4,eS(c.next())];case 3:if(t=(s=o.sent()).done)return[3,7];return a=s.value,i=!1,[4,eS(a)];case 4:return[4,o.sent()];case 5:o.sent(),o.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return n={error:o.sent()},[3,14];case 9:if(o.trys.push([9,,12,13]),!(!i&&!t&&(r=c.return)))return[3,11];return[4,eS(r.call(c))];case 10:o.sent(),o.label=11;case 11:return[3,13];case 12:if(n)throw n.error;return[7];case 13:return[7];case 14:return[2]}})})}},{key:"updateOne",value:function(e){return ej(this,arguments,void 0,function(e){var t,n;return(0,G._)(this,function(r){switch(r.label){case 0:return[4,(t=e.chat_id)?this.client.put("".concat(this.baseURI,"/chats/").concat(t)):this.client.post("".concat(this.baseURI,"/chats?").concat((0,X.buildURLData)({set_bot_manager:!0})))];case 1:return n=r.sent().body,[2,this.currentOne=n.data]}})})}}]),r}(t),a="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(r=t[Symbol.metadata])&&void 0!==r?r:null):void 0,eO(e,null,[(0,et.toggle)("uploading")],{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:a},null,n),a&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),e),ex=(c=(0,et.Stream)(et.ListModel),s=[],i=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(e){var r;return(0,W._)(this,n),r=t.call(this),Object.defineProperty((0,Z._)(r),"chatId",{enumerable:!0,configurable:!0,writable:!0,value:(ew((0,Z._)(r),s),e)}),Object.defineProperty((0,Z._)(r),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:"im/v1/messages"}),r}return(0,H._)(n,[{key:"openStream",value:function(){return eI(this,arguments,function(){var e,t,n,r,a,i,c,s;return(0,G._)(this,function(o){switch(o.label){case 0:e=this,o.label=1;case 1:o.trys.push([1,8,9,14]),i=!0,c=ek(em(this.client,this.baseURI,function(t){return e.totalCount=t})),o.label=2;case 2:return[4,eS(c.next())];case 3:if(t=(s=o.sent()).done)return[3,7];return a=s.value,i=!1,[4,eS(a)];case 4:return[4,o.sent()];case 5:o.sent(),o.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return n={error:o.sent()},[3,14];case 9:if(o.trys.push([9,,12,13]),!(!i&&!t&&(r=c.return)))return[3,11];return[4,eS(r.call(c))];case 10:o.sent(),o.label=11;case 11:return[3,13];case 12:if(n)throw n.error;return[7];case 13:return[7];case 14:return[2]}})})}},{key:"createOne",value:function(e){return ej(this,arguments,void 0,function(e){var t,n,r;return(0,G._)(this,function(a){switch(a.label){case 0:return t=e.msg_type,n=e.content,[4,this.client.post("".concat(this.baseURI,"?").concat((0,X.buildURLData)({receive_id_type:"chat_id"})),{receive_id:this.chatId,msg_type:t,content:JSON.stringify(n)})];case 1:return r=a.sent().body,[2,this.currentOne=r.data]}})})}}]),n}(c),u="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(o=c[Symbol.metadata])&&void 0!==o?o:null):void 0,eO(i,null,[(0,et.toggle)("uploading")],{kind:"method",name:"createOne",static:!1,private:!1,access:{has:function(e){return"createOne"in e},get:function(e){return e.createOne}},metadata:u},null,s),u&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u}),i);ei(e_,eg);var eT={};ec(eT,"TaskModel",function(){return eq}),ec(eT,"TaskListModel",function(){return ez}),ec(eT,"TaskListSectionModel",function(){return eD}),ec(eT,"TaskFieldModel",function(){return eF});var eR=function(e,t,n){for(var r=arguments.length>2,a=0;a<t.length;a++)n=r?t[a].call(e,n):t[a].call(e);return r?n:void 0},eU=function(e,t,n,r,a,i){function c(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,o=r.kind,u="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?r.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var b={};for(var v in r)b[v]="access"===v?{}:r[v];for(var v in r.access)b.access[v]=r.access[v];b.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var p=(0,n[d])("accessor"===o?{get:f.get,set:f.set}:f[u],b);if("accessor"===o){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw TypeError("Object expected");(s=c(p.get))&&(f.get=s),(s=c(p.set))&&(f.set=s),(s=c(p.init))&&a.unshift(s)}else(s=c(p))&&("field"===o?a.unshift(s):f[u]=s)}l&&Object.defineProperty(l,r.name,f),h=!0},eL=function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function c(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,s)}o((r=r.apply(e,t||[])).next())})},eE=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,a,(t=e[n](t)).done,t.value)})}}},eA=function(e){return this instanceof eA?(this.v=e,this):new eA(e)},eM=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},eC=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function c(e,t){a[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof eA?Promise.resolve(n.value.v).then(o,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}}function o(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}},eq=(d=(0,et.Stream)(et.ListModel),b=[],l=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(){var e;return(0,W._)(this,n),e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments))),Object.defineProperty((0,Z._)(e),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:(eR((0,Z._)(e),b),"task/v2/tasks")}),e}return(0,H._)(n,[{key:"openStream",value:function(e){return eC(this,arguments,function(e){var t,n,r,a,i,c,s,o,u,l,f,h,d,b,v,p,y,m,_,g,w,O,j,k;return(0,G._)(this,function(S){switch(S.label){case 0:if(t=this,f=void 0===(l=e.resource_type)?"my_tasks":l,h=e.resource_id,b=void 0===(d=e.user_id_type)?"union_id":d,v=eM(e,["resource_type","resource_id","user_id_type"]),"my_tasks"!==f)return[3,15];p=em(this.client,this.baseURI,function(e){return t.totalCount=e},Object.assign({type:f,user_id_type:b},v)),S.label=1;case 1:S.trys.push([1,8,9,14]),y=!0,m=eE(p),S.label=2;case 2:return[4,eA(m.next())];case 3:if(n=(_=S.sent()).done)return[3,7];return i=_.value,y=!1,[4,eA(i)];case 4:return[4,S.sent()];case 5:S.sent(),S.label=6;case 6:return y=!0,[3,2];case 7:return[3,14];case 8:return r={error:S.sent()},[3,14];case 9:if(S.trys.push([9,,12,13]),!(!y&&!n&&(a=m.return)))return[3,11];return[4,eA(a.call(m))];case 10:S.sent(),S.label=11;case 11:return[3,13];case 12:if(r)throw r.error;return[7];case 13:return[7];case 14:return[3,30];case 15:g=em(this.client,"task/v2/tasklists/".concat(h,"/tasks"),function(e){return t.totalCount=e},Object.assign({user_id_type:b},v)),S.label=16;case 16:S.trys.push([16,24,25,30]),w=!0,O=eE(g),S.label=17;case 17:return[4,eA(O.next())];case 18:if(c=(j=S.sent()).done)return[3,23];return u=j.value,w=!1,k=u.guid,[4,eA(this.getOne(k,b))];case 19:return[4,eA.apply(void 0,[S.sent()])];case 20:return[4,S.sent()];case 21:S.sent(),S.label=22;case 22:return w=!0,[3,17];case 23:return[3,30];case 24:return s={error:S.sent()},[3,30];case 25:if(S.trys.push([25,,28,29]),!(!w&&!c&&(o=O.return)))return[3,27];return[4,eA(o.call(O))];case 26:S.sent(),S.label=27;case 27:return[3,29];case 28:if(s)throw s.error;return[7];case 29:return[7];case 30:return[2]}})})}},{key:"getOne",value:function(e){return eL(this,arguments,void 0,function(e){var t,n,r=arguments;return(0,G._)(this,function(a){switch(a.label){case 0:return t=r.length>1&&void 0!==r[1]?r[1]:"union_id",[4,this.client.get("".concat(this.baseURI,"/").concat(e,"?").concat((0,X.buildURLData)({user_id_type:t})))];case 1:return n=a.sent().body,[2,this.currentOne=n.data.task]}})})}},{key:"updateOne",value:function(e,t){return eL(this,arguments,void 0,function(e,t){var n,r,a,i=arguments;return(0,G._)(this,function(c){switch(c.label){case 0:if(n=i.length>2&&void 0!==i[2]?i[2]:"union_id",r="task/v2/tasks?".concat((0,X.buildURLData)({user_id_type:n})),!t)return[3,2];return[4,this.client.patch(r,{task:e,update_fields:Object.keys(e)})];case 1:return a=c.sent(),[3,4];case 2:return[4,this.client.post(r,e)];case 3:a=c.sent(),c.label=4;case 4:return[2,a.body.data.task]}})})}}]),n}(d),p="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(v=d[Symbol.metadata])&&void 0!==v?v:null):void 0,f=[(0,et.toggle)("downloading")],h=[(0,et.toggle)("uploading")],eU(l,null,f,{kind:"method",name:"getOne",static:!1,private:!1,access:{has:function(e){return"getOne"in e},get:function(e){return e.getOne}},metadata:p},null,b),eU(l,null,h,{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:p},null,b),p&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),l),ez=(g=(0,et.Stream)(et.ListModel),w=[],y=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(){var e;return(0,W._)(this,n),e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments))),Object.defineProperty((0,Z._)(e),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:(eR((0,Z._)(e),w),"task/v2/tasklists")}),e}return(0,H._)(n,[{key:"openStream",value:function(e){return eC(this,arguments,function(e){var t,n,r,a,i,c,s,o,u,l;return(0,G._)(this,function(f){switch(f.label){case 0:t=this,r=void 0===(n=e.user_id_type)?"union_id":n,f.label=1;case 1:f.trys.push([1,8,9,14]),o=!0,u=eE(em(this.client,this.baseURI,function(e){return t.totalCount=e},{user_id_type:r})),f.label=2;case 2:return[4,eA(u.next())];case 3:if(a=(l=f.sent()).done)return[3,7];return s=l.value,o=!1,[4,eA(s)];case 4:return[4,f.sent()];case 5:f.sent(),f.label=6;case 6:return o=!0,[3,2];case 7:return[3,14];case 8:return i={error:f.sent()},[3,14];case 9:if(f.trys.push([9,,12,13]),!(!o&&!a&&(c=u.return)))return[3,11];return[4,eA(c.call(u))];case 10:f.sent(),f.label=11;case 11:return[3,13];case 12:if(i)throw i.error;return[7];case 13:return[7];case 14:return[2]}})})}},{key:"getOne",value:function(e){return eL(this,arguments,void 0,function(e){var t,n,r=arguments;return(0,G._)(this,function(a){switch(a.label){case 0:return t=r.length>1&&void 0!==r[1]?r[1]:"union_id",[4,this.client.get("".concat(this.baseURI,"/").concat(e,"?").concat((0,X.buildURLData)({user_id_type:t})))];case 1:return n=a.sent().body,[2,this.currentOne=n.data.tasklist]}})})}},{key:"updateOne",value:function(e,t){return eL(this,arguments,void 0,function(e,t){var n,r,a,i=arguments;return(0,G._)(this,function(c){switch(c.label){case 0:if(n=i.length>2&&void 0!==i[2]?i[2]:"union_id",r="".concat(this.baseURI,"?").concat((0,X.buildURLData)({user_id_type:n})),!t)return[3,2];return[4,this.client.post(r,{tasklist:e,update_fields:Object.keys(e)})];case 1:return a=c.sent(),[3,4];case 2:return[4,this.client.post(r,e)];case 3:a=c.sent(),c.label=4;case 4:return[2,a.body.data.tasklist]}})})}}]),n}(g),j="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(O=g[Symbol.metadata])&&void 0!==O?O:null):void 0,m=[(0,et.toggle)("downloading")],_=[(0,et.toggle)("uploading")],eU(y,null,m,{kind:"method",name:"getOne",static:!1,private:!1,access:{has:function(e){return"getOne"in e},get:function(e){return e.getOne}},metadata:j},null,w),eU(y,null,_,{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:j},null,w),j&&Object.defineProperty(y,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:j}),y),eD=(P=(0,et.Stream)(et.ListModel),x=[],k=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(){var e;return(0,W._)(this,n),e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments))),Object.defineProperty((0,Z._)(e),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:(eR((0,Z._)(e),x),"task/v2/sections")}),e}return(0,H._)(n,[{key:"openStream",value:function(e){return eC(this,arguments,function(e){var t,n,r,a,i,c,s,o,u,l,f,h,d,b,v;return(0,G._)(this,function(p){switch(p.label){case 0:t=this,r=void 0===(n=e.resource_type)?"my_tasks":n,a=e.resource_id,c=void 0===(i=e.user_id_type)?"union_id":i,f=em(this.client,this.baseURI,function(e){return t.totalCount=e},{resource_type:r,resource_id:a,user_id_type:c}),p.label=1;case 1:p.trys.push([1,9,10,15]),h=!0,d=eE(f),p.label=2;case 2:return[4,eA(d.next())];case 3:if(s=(b=p.sent()).done)return[3,8];return l=b.value,h=!1,v=l.guid,[4,eA(this.getOne(v))];case 4:return[4,eA.apply(void 0,[p.sent()])];case 5:return[4,p.sent()];case 6:p.sent(),p.label=7;case 7:return h=!0,[3,2];case 8:return[3,15];case 9:return o={error:p.sent()},[3,15];case 10:if(p.trys.push([10,,13,14]),!(!h&&!s&&(u=d.return)))return[3,12];return[4,eA(u.call(d))];case 11:p.sent(),p.label=12;case 12:return[3,14];case 13:if(o)throw o.error;return[7];case 14:return[7];case 15:return[2]}})})}},{key:"getOne",value:function(e){return eL(this,void 0,void 0,function(){var t;return(0,G._)(this,function(n){switch(n.label){case 0:return[4,this.client.get("".concat(this.baseURI,"/").concat(e))];case 1:return t=n.sent().body,[2,this.currentOne=t.data.section]}})})}},{key:"updateOne",value:function(e,t){return eL(this,arguments,void 0,function(e,t){var n,r,a,i,c=arguments;return(0,G._)(this,function(s){switch(s.label){case 0:if(n=c.length>2&&void 0!==c[2]?c[2]:"union_id",r=(0,en._)(c.length>3&&void 0!==c[3]?c[3]:[],1)[0],a="".concat(this.baseURI,"?").concat((0,X.buildURLData)({user_id_type:n})),!t)return[3,2];return[4,this.client.patch(a,{section:e,update_fields:Object.keys(e)})];case 1:return i=s.sent(),[3,4];case 2:return[4,this.client.post(a,Object.assign({name:e.name},r))];case 3:i=s.sent(),s.label=4;case 4:return[2,i.body.data.section]}})})}}]),n}(P),R="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(T=P[Symbol.metadata])&&void 0!==T?T:null):void 0,S=[(0,et.toggle)("downloading")],I=[(0,et.toggle)("uploading")],eU(k,null,S,{kind:"method",name:"getOne",static:!1,private:!1,access:{has:function(e){return"getOne"in e},get:function(e){return e.getOne}},metadata:R},null,x),eU(k,null,I,{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:R},null,x),R&&Object.defineProperty(k,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:R}),k),eF=(L=(0,et.Stream)(et.ListModel),E=[],U=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(){var e;return(0,W._)(this,n),e=t.call.apply(t,[this].concat(Array.prototype.slice.call(arguments))),Object.defineProperty((0,Z._)(e),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:(eR((0,Z._)(e),E),"task/v2/custom_fields")}),e}return(0,H._)(n,[{key:"openStream",value:function(e){return eC(this,arguments,function(e){var t,n,r,a,i,c,s,o,u,l,f,h,d;return(0,G._)(this,function(b){switch(b.label){case 0:t=this,r=void 0===(n=e.resource_type)?"tasklist":n,a=e.resource_id,c=void 0===(i=e.user_id_type)?"union_id":i,b.label=1;case 1:b.trys.push([1,8,9,14]),f=!0,h=eE(em(this.client,this.baseURI,function(e){return t.totalCount=e},{resource_type:r,resource_id:a,user_id_type:c})),b.label=2;case 2:return[4,eA(h.next())];case 3:if(s=(d=b.sent()).done)return[3,7];return l=d.value,f=!1,[4,eA(l)];case 4:return[4,b.sent()];case 5:b.sent(),b.label=6;case 6:return f=!0,[3,2];case 7:return[3,14];case 8:return o={error:b.sent()},[3,14];case 9:if(b.trys.push([9,,12,13]),!(!f&&!s&&(u=h.return)))return[3,11];return[4,eA(u.call(h))];case 10:b.sent(),b.label=11;case 11:return[3,13];case 12:if(o)throw o.error;return[7];case 13:return[7];case 14:return[2]}})})}},{key:"updateOne",value:function(e,t){return eL(this,arguments,void 0,function(e,t){var n,r,a,i,c,s,o,u,l,f,h,d,b,v,p=arguments;return(0,G._)(this,function(y){switch(y.label){case 0:if(n=p.length>2&&void 0!==p[2]?p[2]:"union_id",a=(r=(0,er._)(p.length>3&&void 0!==p[3]?p[3]:[]))[0],i=r.slice(1),c="".concat(this.baseURI,"?").concat((0,X.buildURLData)({user_id_type:n})),!t)return[3,2];return[4,this.client.patch(c,{custom_field:e,update_fields:Object.keys(e)})];case 1:return s=y.sent(),[3,4];case 2:return[4,this.client.post(c,Object.assign(Object.assign({},e),a))];case 3:s=y.sent(),y.label=4;case 4:o=s.body.data.custom_field,u=!0,l=!1,f=void 0,y.label=5;case 5:y.trys.push([5,10,11,12]),h=i[Symbol.iterator](),y.label=6;case 6:if(u=(d=h.next()).done)return[3,9];return b=d.value,[4,this.client.post("".concat(this.baseURI,"/").concat(o.guid,"/add"),b)];case 7:y.sent(),y.label=8;case 8:return u=!0,[3,6];case 9:return[3,12];case 10:return v=y.sent(),l=!0,f=v,[3,12];case 11:try{u||null==h.return||h.return()}finally{if(l)throw f}return[7];case 12:return[2,o]}})})}}]),n}(L),M="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(A=L[Symbol.metadata])&&void 0!==A?A:null):void 0,eU(U,null,[(0,et.toggle)("uploading")],{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:M},null,E),M&&Object.defineProperty(U,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:M}),U);ei(eT,{});var eV={};ec(eV,"SpreadSheetModel",function(){return eH});var eB=function(e,t,n){for(var r=arguments.length>2,a=0;a<t.length;a++)n=r?t[a].call(e,n):t[a].call(e);return r?n:void 0},eJ=function(e,t,n,r,a,i){function c(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,o=r.kind,u="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?r.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var b={};for(var v in r)b[v]="access"===v?{}:r[v];for(var v in r.access)b.access[v]=r.access[v];b.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var p=(0,n[d])("accessor"===o?{get:f.get,set:f.set}:f[u],b);if("accessor"===o){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw TypeError("Object expected");(s=c(p.get))&&(f.get=s),(s=c(p.set))&&(f.set=s),(s=c(p.init))&&a.unshift(s)}else(s=c(p))&&("field"===o?a.unshift(s):f[u]=s)}l&&Object.defineProperty(l,r.name,f),h=!0},eK=function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function c(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,s)}o((r=r.apply(e,t||[])).next())})},eN=function(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)},eW=function(e,t,n,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n},eH=(F=et.ListModel,V=[],B=[],J=[],C=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(e,r){var a;return(0,W._)(this,n),a=t.call(this),Object.defineProperty((0,Z._)(a),"id",{enumerable:!0,configurable:!0,writable:!0,value:(eB((0,Z._)(a),V),e)}),Object.defineProperty((0,Z._)(a),"sheetId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty((0,Z._)(a),"baseURI",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty((0,Z._)(a),"offset",{enumerable:!0,configurable:!0,writable:!0,value:[0,0]}),q.set((0,Z._)(a),eB((0,Z._)(a),B,void 0)),eB((0,Z._)(a),J),a.id=e,a.sheetId=r,a.baseURI="sheets/v2/spreadsheets/".concat(e),a}return(0,H._)(n,[{key:"meta",get:function(){return eN(this,q,"f")},set:function(e){eW(this,q,e,"f")}},{key:"getMeta",value:function(){return eK(this,void 0,void 0,function(){var e,t,n;return(0,G._)(this,function(r){switch(r.label){case 0:if(this.meta)return[2,this.meta];return[4,this.client.get("".concat(this.baseURI,"/metainfo"))];case 1:return e=r.sent().body,t=this.sheetId,console.assert(n=e.data.sheets.find(function(e){return e.sheetId===t}),'Sheet "'.concat(t,'" is not found')),[2,this.meta=n]}})})}},{key:"loadPage",value:function(e,t,n){return eK(this,void 0,void 0,function(){var n,r,a,i,c,s,o,u,l,f,h;return(0,G._)(this,function(d){switch(d.label){case 0:return n=this.columnKeys,a=(r=(0,en._)(this.offset,2))[0],i=r[1],[4,this.getMeta()];case 1:return c=d.sent().rowCount,s=a+1,o=65+i,u=Math.min(s-1+t*e,c),l=o-1+n.length,f=String.fromCharCode(o),h=String.fromCharCode(l),[4,this.client.get("".concat(this.baseURI,"/values/").concat(this.sheetId,"!").concat(f).concat(s,":").concat(h).concat(u,"?").concat((0,X.buildURLData)({dateTimeRenderOption:"FormattedString"})))];case 2:return[2,{pageData:d.sent().body.data.valueRange.values.map(function(e){return(0,X.objectFrom)(e,n)}),totalCount:c-a}]}})})}}]),n}(F),q=new WeakMap,N="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(K=F[Symbol.metadata])&&void 0!==K?K:null):void 0,z=[ea.observable],D=[(0,et.toggle)("downloading")],eJ(C,null,z,{kind:"accessor",name:"meta",static:!1,private:!1,access:{has:function(e){return"meta"in e},get:function(e){return e.meta},set:function(e,t){e.meta=t}},metadata:N},B,J),eJ(C,null,D,{kind:"method",name:"getMeta",static:!1,private:!1,access:{has:function(e){return"getMeta"in e},get:function(e){return e.getMeta}},metadata:N},null,V),N&&Object.defineProperty(C,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:N}),C);ei(eV,{});var eG={};ec(eG,"makeSimpleFilter",function(){return e2}),ec(eG,"normalizeText",function(){return e3}),ec(eG,"BiDataTable",function(){return e4}),ec(eG,"BiSearch",function(){return e7}),ec(eG,"BiTableView",function(){return e9}),ec(eG,"BiTable",function(){return e6});var eQ=function(e,t,n){for(var r=arguments.length>2,a=0;a<t.length;a++)n=r?t[a].call(e,n):t[a].call(e);return r?n:void 0},eX=function(e,t,n,r,a,i){function c(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,o=r.kind,u="getter"===o?"get":"setter"===o?"set":"value",l=!t&&e?r.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),h=!1,d=n.length-1;d>=0;d--){var b={};for(var v in r)b[v]="access"===v?{}:r[v];for(var v in r.access)b.access[v]=r.access[v];b.addInitializer=function(e){if(h)throw TypeError("Cannot add initializers after decoration has completed");i.push(c(e||null))};var p=(0,n[d])("accessor"===o?{get:f.get,set:f.set}:f[u],b);if("accessor"===o){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw TypeError("Object expected");(s=c(p.get))&&(f.get=s),(s=c(p.set))&&(f.set=s),(s=c(p.init))&&a.unshift(s)}else(s=c(p))&&("field"===o?a.unshift(s):f[u]=s)}l&&Object.defineProperty(l,r.name,f),h=!0},eY=function(e,t,n,r){return new(n||(n=Promise))(function(a,i){function c(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(c,s)}o((r=r.apply(e,t||[])).next())})},eZ=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n},e$=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,a,(t=e[n](t)).done,t.value)})}}},e0=function(e){return this instanceof e0?(this.v=e,this):new e0(e)},e1=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var r,a=n.apply(e,t||[]),i=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),r[Symbol.asyncIterator]=function(){return this},r;function c(e,t){a[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof e0?Promise.resolve(n.value.v).then(o,u):l(i[0][2],n)}catch(e){l(i[0][3],e)}}function o(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}};function e2(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contains",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"AND",r=Object.entries(e).map(function(e){var n=(0,en._)(e,2),r=n[0],a=n[1];return null!=a&&(a instanceof Array?a:[a]).map(function(e){return"CurrentValue.[".concat(r,"]")+("contains"===t?'.contains("'.concat(e,'")'):"".concat(t).concat(JSON.stringify(e)))})}).filter(Boolean).flat();return r[1]?"".concat(n,"(").concat(r,")"):r[0]}var e3=function(e){return e&&"object"==typeof e&&"text"in e&&e.text||""};function e4(){var e,t,n,r,a,i,c,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.ListModel;return r=(0,et.Stream)(s),a=[],e=/*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(e,r){var i;return(0,W._)(this,n),i=t.call(this),Object.defineProperty((0,Z._)(i),"requiredKeys",{enumerable:!0,configurable:!0,writable:!0,value:(eQ((0,Z._)(i),a),[])}),Object.defineProperty((0,Z._)(i),"sort",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty((0,Z._)(i),"queryOptions",{enumerable:!0,configurable:!0,writable:!0,value:{text_field_as_array:!0,automatic_fields:!0}}),Object.defineProperty((0,Z._)(i),"currentViewId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i.baseURI="bitable/v1/apps/".concat(e,"/tables/").concat(r,"/records"),i}return(0,H._)(n,[{key:"normalize",value:function(e){var t=e.fields;return Object.assign(Object.assign({},eZ(e,["fields"])),t)}},{key:"getOne",value:function(e){return eY(this,void 0,void 0,function(){var t;return(0,G._)(this,function(n){switch(n.label){case 0:return[4,this.client.get("".concat(this.baseURI,"/").concat(e,"?").concat((0,X.buildURLData)(this.queryOptions)))];case 1:return t=n.sent().body,[2,this.currentOne=this.normalize(t.data.record)]}})})}},{key:"updateOne",value:function(e,t){return eY(this,void 0,void 0,function(){var n;return(0,G._)(this,function(r){switch(r.label){case 0:return[4,t?this.client.put("".concat(this.baseURI,"/").concat(t),{fields:e}):this.client.post(this.baseURI,{fields:e})];case 1:return n=r.sent().body,[2,this.currentOne=this.normalize(n.data.record)]}})})}},{key:"makeFilter",value:function(e){return[this.requiredKeys[0]&&e2(Object.fromEntries(this.requiredKeys.map(function(e){return[e,""]})),"!="),!(0,X.isEmpty)(e)&&e2(e)].filter(Boolean).join("&&")}},{key:"openStream",value:function(e){return e1(this,arguments,function(){var t,n,r,a,i,c,s,o,u,l,f,h;return(0,G._)(this,function(d){switch(d.label){case 0:t=this,s=(c=this.currentViewId)?{view_id:c}:{filter:this.makeFilter(e),sort:JSON.stringify(Object.entries(this.sort).map(function(e){var t=(0,en._)(e,2),n=t[0],r=t[1];return"".concat(n," ").concat(r)}))},o=em(this.client,this.baseURI,function(e){return t.totalCount=e},Object.assign(Object.assign({},s),this.queryOptions)),d.label=1;case 1:d.trys.push([1,8,9,14]),u=!0,l=e$(o),d.label=2;case 2:return[4,e0(l.next())];case 3:if(n=(f=d.sent()).done)return[3,7];return i=f.value,u=!1,h=i,[4,e0(this.normalize(h))];case 4:return[4,d.sent()];case 5:d.sent(),d.label=6;case 6:return u=!0,[3,2];case 7:return[3,14];case 8:return r={error:d.sent()},[3,14];case 9:if(d.trys.push([9,,12,13]),!(!u&&!n&&(a=l.return)))return[3,11];return[4,e0(a.call(l))];case 10:d.sent(),d.label=11;case 11:return[3,13];case 12:if(r)throw r.error;return[7];case 13:return[7];case 14:return[2]}})})}},{key:"getViewList",value:function(e){return eY(this,arguments,void 0,function(e){var t,n,r=arguments;return(0,G._)(this,function(a){switch(a.label){case 0:t=r.length>1&&void 0!==r[1]?r[1]:this.pageIndex+1,n=r.length>2&&void 0!==r[2]?r[2]:this.pageSize,a.label=1;case 1:return a.trys.push([1,,3,4]),this.currentViewId=e,[4,this.getList({},t,n)];case 2:return[2,a.sent()];case 3:return this.currentViewId=void 0,[7];case 4:return[2]}})})}},{key:"getViewAll",value:function(e){return eY(this,arguments,void 0,function(e){var t,n=arguments;return(0,G._)(this,function(r){switch(r.label){case 0:t=n.length>1&&void 0!==n[1]?n[1]:this.pageSize,this.clearList(),r.label=1;case 1:if(this.noMore)return[3,3];return[4,this.getViewList(e,void 0,t)];case 2:return r.sent(),[3,1];case 3:return[2,this.allItems]}})})}}]),n}(r),c="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(i=r[Symbol.metadata])&&void 0!==i?i:null):void 0,t=[(0,et.toggle)("downloading")],n=[(0,et.toggle)("uploading")],eX(e,null,t,{kind:"method",name:"getOne",static:!1,private:!1,access:{has:function(e){return"getOne"in e},get:function(e){return e.getOne}},metadata:c},null,a),eX(e,null,n,{kind:"method",name:"updateOne",static:!1,private:!1,access:{has:function(e){return"updateOne"in e},get:function(e){return e.updateOne}},metadata:c},null,a),c&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:c}),e}function e7(e){return /*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(){return(0,W._)(this,n),t.apply(this,arguments)}return(0,H._)(n,[{key:"makeFilter",value:function(e){return(0,X.isEmpty)(e)?"":e2(e,"contains","OR")}},{key:"getSearchList",value:function(e){return eY(this,arguments,void 0,function(e){var t,n,r,a,i=arguments;return(0,G._)(this,function(c){return t=i.length>1&&void 0!==i[1]?i[1]:this.pageIndex+1,n=i.length>2&&void 0!==i[2]?i[2]:this.pageSize,r=e.split(/[\s,]+/),a=this.searchKeys.map(function(e){return[e,r]}),[2,this.getList(Object.fromEntries(a),t,n)]})})}}]),n}(e)}function e9(){return /*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(e,r){var a;return(0,W._)(this,n),(a=t.call(this)).baseURI="bitable/v1/apps/".concat(e,"/tables/").concat(r,"/views"),a}return(0,H._)(n,[{key:"openStream",value:function(){return e1(this,arguments,function(){var e,t,n,r,a,i,c,s;return(0,G._)(this,function(o){switch(o.label){case 0:e=this,o.label=1;case 1:o.trys.push([1,8,9,14]),i=!0,c=e$(em(this.client,this.baseURI,function(t){return e.totalCount=t})),o.label=2;case 2:return[4,e0(c.next())];case 3:if(t=(s=o.sent()).done)return[3,7];return a=s.value,i=!1,[4,e0(a)];case 4:return[4,o.sent()];case 5:o.sent(),o.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return n={error:o.sent()},[3,14];case 9:if(o.trys.push([9,,12,13]),!(!i&&!t&&(r=c.return)))return[3,11];return[4,e0(r.call(c))];case 10:o.sent(),o.label=11;case 11:return[3,13];case 12:if(n)throw n.error;return[7];case 13:return[7];case 14:return[2]}})})}}]),n}((0,et.Stream)(et.ListModel))}function e6(){return /*#__PURE__*/function(e){(0,$._)(n,e);var t=(0,ee._)(n);function n(e){var r;return(0,W._)(this,n),r=t.call(this),Object.defineProperty((0,Z._)(r),"id",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty((0,Z._)(r),"currentDataTable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.baseURI="bitable/v1/apps/".concat(e,"/tables"),r}return(0,H._)(n,[{key:"getOne",value:function(e,t){return eY(this,void 0,void 0,function(){var n,r,a;return(0,G._)(this,function(i){switch(i.label){case 0:if(!(n=this.allItems)[0])return[3,1];return r=n,[3,3];case 1:return[4,this.getAll()];case 2:r=i.sent(),i.label=3;case 3:if(!(a=r.find(function(t){return t.name===e})))throw URIError('Table "'.concat(e,'" is not found'));return t instanceof Function&&(this.currentDataTable=Reflect.construct(t,[this.id,a.table_id])),[2,this.currentOne=a]}})})}},{key:"openStream",value:function(){return e1(this,arguments,function(){var e,t,n,r,a,i,c,s;return(0,G._)(this,function(o){switch(o.label){case 0:e=this,o.label=1;case 1:o.trys.push([1,8,9,14]),i=!0,c=e$(em(this.client,this.baseURI,function(t){return e.totalCount=t})),o.label=2;case 2:return[4,e0(c.next())];case 3:if(t=(s=o.sent()).done)return[3,7];return a=s.value,i=!1,[4,e0(a)];case 4:return[4,o.sent()];case 5:o.sent(),o.label=6;case 6:return i=!0,[3,2];case 7:return[3,14];case 8:return n={error:o.sent()},[3,14];case 9:if(o.trys.push([9,,12,13]),!(!i&&!t&&(r=c.return)))return[3,11];return[4,e0(r.call(c))];case 10:o.sent(),o.label=11;case 11:return[3,13];case 12:if(n)throw n.error;return[7];case 13:return[7];case 14:return[2]}})})}}]),n}((0,et.Stream)(et.ListModel))}ei(eG,{}),ei(eh,ed),ei(eh,e_),ei(eh,eT),ei(eh,eV),ei(eh,eG),ei(module.exports,es),ei(module.exports,eu),ei(module.exports,eh);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|