@tachybase/plugin-api-keys 0.23.8
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/.turbo/turbo-build.log +14 -0
- package/LICENSE +201 -0
- package/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/client.d.ts +3 -0
- package/client.js +65 -0
- package/dist/client/Configuration/ExpiresSelect.d.ts +3 -0
- package/dist/client/Configuration/index.d.ts +2 -0
- package/dist/client/Configuration/roles.d.ts +3 -0
- package/dist/client/Configuration/schema.d.ts +2 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +6 -0
- package/dist/client/locale/index.d.ts +2 -0
- package/dist/collections/apiKeys.d.ts +3 -0
- package/dist/collections/apiKeys.js +120 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +27 -0
- package/dist/externalVersion.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +21 -0
- package/dist/locale/ko_KR.json +21 -0
- package/dist/locale/zh-CN.json +21 -0
- package/dist/locale.d.ts +1 -0
- package/dist/locale.js +30 -0
- package/dist/server/actions/api-keys.d.ts +3 -0
- package/dist/server/actions/api-keys.js +84 -0
- package/dist/server/collections/apiKeys.d.ts +2 -0
- package/dist/server/collections/apiKeys.js +34 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/locale/en-US.d.ts +2 -0
- package/dist/server/locale/en-US.js +23 -0
- package/dist/server/locale/fr-FR.d.ts +2 -0
- package/dist/server/locale/fr-FR.js +23 -0
- package/dist/server/locale/index.d.ts +2 -0
- package/dist/server/locale/index.js +40 -0
- package/dist/server/locale/zh-CN.d.ts +4 -0
- package/dist/server/locale/zh-CN.js +25 -0
- package/dist/server/plugin.d.ts +7 -0
- package/dist/server/plugin.js +85 -0
- package/dist/swagger/index.d.ts +106 -0
- package/dist/swagger/index.js +130 -0
- package/docs/en-US/changelog.md +1 -0
- package/docs/en-US/index.md +9 -0
- package/docs/en-US/tabs.json +14 -0
- package/docs/en-US/usage.md +21 -0
- package/docs/zh-CN/changelog.md +1 -0
- package/docs/zh-CN/index.md +10 -0
- package/docs/zh-CN/tabs.json +14 -0
- package/docs/zh-CN/usage.md +21 -0
- package/package.json +34 -0
- package/server.d.ts +3 -0
- package/server.js +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @tachybase/plugin-api-keys@0.23.2 build /Users/seal/Documents/projects/tachybase/packages/plugin-api-keys
|
|
4
|
+
> tachybase-build --no-dts @tachybase/plugin-api-keys
|
|
5
|
+
|
|
6
|
+
[33m[33mThe CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.[39m[39m
|
|
7
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: [1mplugin-api-keys[22m build start
|
|
8
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: build plugin client
|
|
9
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: build plugin server source
|
|
10
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: delete server files
|
|
11
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: build plugin server dependencies
|
|
12
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: These packages [33m@tachybase/database, @tachybase/server, @tachybase/actions[39m will be [3mexclude[23m.
|
|
13
|
+
[4m[95m@tachybase/plugin-api-keys[39m[24m: write external version
|
|
14
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2023-2024] [Tachybase team]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
package/README.zh-CN.md
ADDED
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
4
|
+
if (typeof WeakMap !== 'function') return null;
|
|
5
|
+
var cacheBabelInterop = new WeakMap();
|
|
6
|
+
var cacheNodeInterop = new WeakMap();
|
|
7
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
8
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
9
|
+
})(nodeInterop);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
13
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
17
|
+
return { default: obj };
|
|
18
|
+
}
|
|
19
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
20
|
+
if (cache && cache.has(obj)) {
|
|
21
|
+
return cache.get(obj);
|
|
22
|
+
}
|
|
23
|
+
var newObj = {};
|
|
24
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
25
|
+
for (var key in obj) {
|
|
26
|
+
if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
27
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
28
|
+
if (desc && (desc.get || desc.set)) {
|
|
29
|
+
Object.defineProperty(newObj, key, desc);
|
|
30
|
+
} else {
|
|
31
|
+
newObj[key] = obj[key];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
newObj.default = obj;
|
|
36
|
+
if (cache) {
|
|
37
|
+
cache.set(obj, newObj);
|
|
38
|
+
}
|
|
39
|
+
return newObj;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var _index = _interopRequireWildcard(require('./dist/client'));
|
|
43
|
+
|
|
44
|
+
Object.defineProperty(exports, '__esModule', {
|
|
45
|
+
value: true,
|
|
46
|
+
});
|
|
47
|
+
var _exportNames = {};
|
|
48
|
+
Object.defineProperty(exports, 'default', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _index.default;
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
Object.keys(_index).forEach(function (key) {
|
|
56
|
+
if (key === 'default' || key === '__esModule') return;
|
|
57
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
58
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
59
|
+
Object.defineProperty(exports, key, {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _index[key];
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@tachybase/client"),require("react/jsx-runtime"),require("@tachybase/schema"),require("react"),require("ahooks"),require("antd"),require("dayjs"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react/jsx-runtime","@tachybase/schema","react","ahooks","antd","dayjs","react-i18next"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["@tachybase/plugin-api-keys"]={},t["@tachybase/client"],t.jsxRuntime,t["@tachybase/schema"],t.react,t.ahooks,t.antd,t.dayjs,t["react-i18next"]))})(this,function(t,e,o,i,y,h,a,u,c){"use strict";var E=Object.defineProperty,Y=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var P=(t,e,o)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,D=(t,e)=>{for(var o in e||(e={}))W.call(e,o)&&P(t,o,e[o]);if(S)for(var o of S(e))$.call(e,o)&&P(t,o,e[o]);return t},w=(t,e)=>Y(t,H(e));var b=(t,e,o)=>new Promise((i,y)=>{var h=c=>{try{u(o.next(c))}catch(d){y(d)}},a=c=>{try{u(o.throw(c))}catch(d){y(d)}},u=c=>c.done?i(c.value):Promise.resolve(c.value).then(h,a);u((o=o.apply(t,e)).next())});const d="api-keys";function k(){return c.useTranslation([d,"core"],{nsMode:"fallback"})}const I=u().add(1,"days"),M=e.css`
|
|
2
|
+
width: 100%;
|
|
3
|
+
& > .ant-space-item {
|
|
4
|
+
flex: 1;
|
|
5
|
+
}
|
|
6
|
+
`,F=n=>{const{onChange:s}=n,[l,{toggle:m,setFalse:x}]=h.useBoolean(),g=p=>{if(p==="custom")return s("1d"),m();x(),s(p)},C=p=>{p=p.millisecond(0).second(0);const A=u().millisecond(0).second(0),f=`${p.diff(A,"d")}d`;s(f)};return o.jsxs(a.Space,{className:M,children:[o.jsx(a.Select,w(D({},n),{value:l?"custom":n.value,onChange:g})),l?o.jsx(a.DatePicker,{disabledDate:p=>p.isSameOrBefore(),defaultValue:I,onChange:C,showToday:!1,allowClear:!1}):null]})},K=()=>{const{expiresIn:n,createdAt:s}=e.useRecord(),{t:l}=k(),m=y.useMemo(()=>n==="never"?l("Never expires"):u(s).add((n==null?void 0:n.replace("d",""))||0,"days").format("YYYY-MM-DD HH:mm:ss"),[s,n]);return o.jsx(a.Typography.Text,{children:m})},V=i.connect(F,i.mapProps({dataSource:"options"}),i.mapReadPretty(K));function r(n){return`{{t('${n}', { ns: '${d}', nsMode: 'fallback' })}}`}const q={dumpRules:{group:"user"},shared:!0,name:"apiKeys",sortable:"sort",createdBy:!0,updatedAt:!1,updatedBy:!1,logging:!0,fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,interface:"id"},{type:"string",name:"name",interface:"input",uiSchema:{type:"string",title:'{{t("name")}}',"x-component":"Input"}},{interface:"obo",type:"belongsTo",name:"role",target:"roles",foreignKey:"roleName",uiSchema:{type:"object",title:'{{t("Roles")}}',"x-component":"Select","x-component-props":{fieldNames:{label:"title",value:"name"},objectValue:!0,options:"{{ currentRoles }}"}}},{name:"expiresIn",type:"string",uiSchema:{type:"string",title:r("Expires"),"x-component":"ExpiresSelect",enum:[{label:r("1 Day"),value:"1d"},{label:r("7 Days"),value:"7d"},{label:r("30 Days"),value:"30d"},{label:r("90 Days"),value:"90d"},{label:r("Custom"),value:"custom"},{label:r("Never"),value:"never"}]}},{name:"token",type:"string",hidden:!0},{name:"accessToken",type:"string",hidden:!0}]},{useModal:B}=a.Modal,j=()=>{const n=i.useForm(),{setVisible:s}=e.useActionContext(),{resource:l,service:m}=e.useBlockRequestContext(),{t:x}=k(),[g,C]=B();return{run(){return b(this,null,function*(){var f,T;yield n.submit();const A=yield l.create({values:n.values});g.success({title:x("API key created successfully"),onOk:()=>{n.reset(),s(!1)},content:o.jsxs(a.Space,{direction:"vertical",children:[o.jsx(a.Alert,{message:x("Make sure to copy your personal access key now as you will not be able to see this again."),type:"warning"}),o.jsx(a.Typography.Text,{copyable:!0,children:(T=(f=A.data)==null?void 0:f.data)==null?void 0:T.token})]})}),m==null||m.refresh()})},element:C}},O=()=>{const n=e.useRecord(),{resource:s,service:l}=e.useBlockRequestContext();return{run(){return b(this,null,function*(){yield s.destroy({filterByTk:n.id}),l.refresh()})}}},N={type:"object",properties:{configuration:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:q,resource:"apiKeys",action:"list",params:{pageSize:20,appends:["role"],sort:["-createdAt"]},rowKey:"name",showIndex:!0},"x-component":"CardItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--tb-spacing)"}},properties:{create:{type:"void","x-action":"create",title:r("Add API key"),"x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:r("Add API key"),"x-decorator":"Form","x-component":"Action.Modal","x-component-props":{maskClosable:!1,style:{maxWidth:"520px",width:"100%"}},properties:{name:{type:"string",title:r("Key name"),required:!0,"x-component":"CollectionField","x-decorator":"FormItem"},role:{type:"string",title:r("Role"),required:!0,"x-decorator-props":{tooltip:r("Allow only your own roles to be selected")},"x-collection-field":"apiKeys.role","x-component":"CollectionField","x-decorator":"FormItem"},expiresIn:{type:"string",title:r("Expiration"),required:!0,"x-component":"CollectionField","x-decorator":"FormItem",default:"30d"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:j}}}}}}},"x-align":"right"}}},[i.uid()]:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:"id"},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:r("Key name"),properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:r("Role"),properties:{role:{type:"object","x-collection-field":"apiKeys.role","x-component":"CollectionField","x-component-props":{enableLink:!1},"x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:r("Expiration"),properties:{expiresIn:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:r("Created at"),properties:{createdAt:{type:"date","x-component":"DatePicker","x-component-props":{format:"YYYY-MM-DD HH:mm:ss"},"x-read-pretty":!0}}},actionColumn:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-decorator":"TableV2.Column.ActionBar","x-component":"TableV2.Column",properties:{columnActions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:r("Delete API key"),content:"{{t('Are you sure you want to delete it?')}}"},useAction:O}}}}}}}}}}}},R=()=>{const n=e.useCurrentRoles();return o.jsx(e.SchemaComponentOptions,{scope:{currentRoles:n},components:{ExpiresSelect:V},children:o.jsx(i.RecursionField,{schema:N})})};class v extends e.Plugin{load(){return b(this,null,function*(){this.userSettingsManager.add(d,{icon:"KeyOutlined",title:this.t("API keys"),Component:R,aclSnippet:"pm.api-keys.configuration"})})}}t.PluginAPIKeysClient=v,t.default=v,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var apiKeys_exports = {};
|
|
19
|
+
__export(apiKeys_exports, {
|
|
20
|
+
default: () => apiKeys_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(apiKeys_exports);
|
|
23
|
+
var import_locale = require("../locale");
|
|
24
|
+
var apiKeys_default = {
|
|
25
|
+
dumpRules: {
|
|
26
|
+
group: "user"
|
|
27
|
+
},
|
|
28
|
+
shared: true,
|
|
29
|
+
name: "apiKeys",
|
|
30
|
+
sortable: "sort",
|
|
31
|
+
createdBy: true,
|
|
32
|
+
updatedAt: false,
|
|
33
|
+
updatedBy: false,
|
|
34
|
+
logging: true,
|
|
35
|
+
fields: [
|
|
36
|
+
{
|
|
37
|
+
name: "id",
|
|
38
|
+
type: "bigInt",
|
|
39
|
+
autoIncrement: true,
|
|
40
|
+
primaryKey: true,
|
|
41
|
+
allowNull: false,
|
|
42
|
+
interface: "id"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: "string",
|
|
46
|
+
name: "name",
|
|
47
|
+
interface: "input",
|
|
48
|
+
uiSchema: {
|
|
49
|
+
type: "string",
|
|
50
|
+
title: '{{t("name")}}',
|
|
51
|
+
"x-component": "Input"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
interface: "obo",
|
|
56
|
+
type: "belongsTo",
|
|
57
|
+
name: "role",
|
|
58
|
+
target: "roles",
|
|
59
|
+
foreignKey: "roleName",
|
|
60
|
+
uiSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
title: '{{t("Roles")}}',
|
|
63
|
+
"x-component": "Select",
|
|
64
|
+
"x-component-props": {
|
|
65
|
+
fieldNames: {
|
|
66
|
+
label: "title",
|
|
67
|
+
value: "name"
|
|
68
|
+
},
|
|
69
|
+
objectValue: true,
|
|
70
|
+
options: "{{ currentRoles }}"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "expiresIn",
|
|
76
|
+
type: "string",
|
|
77
|
+
uiSchema: {
|
|
78
|
+
type: "string",
|
|
79
|
+
title: (0, import_locale.generateNTemplate)("Expires"),
|
|
80
|
+
"x-component": "ExpiresSelect",
|
|
81
|
+
enum: [
|
|
82
|
+
{
|
|
83
|
+
label: (0, import_locale.generateNTemplate)("1 Day"),
|
|
84
|
+
value: "1d"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: (0, import_locale.generateNTemplate)("7 Days"),
|
|
88
|
+
value: "7d"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: (0, import_locale.generateNTemplate)("30 Days"),
|
|
92
|
+
value: "30d"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: (0, import_locale.generateNTemplate)("90 Days"),
|
|
96
|
+
value: "90d"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: (0, import_locale.generateNTemplate)("Custom"),
|
|
100
|
+
value: "custom"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: (0, import_locale.generateNTemplate)("Never"),
|
|
104
|
+
value: "never"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "token",
|
|
111
|
+
type: "string",
|
|
112
|
+
hidden: true
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "accessToken",
|
|
116
|
+
type: "string",
|
|
117
|
+
hidden: true
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NAMESPACE = "api-keys";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
NAMESPACE: () => NAMESPACE
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(constants_exports);
|
|
23
|
+
const NAMESPACE = "api-keys";
|
|
24
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
25
|
+
0 && (module.exports = {
|
|
26
|
+
NAMESPACE
|
|
27
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"@tachybase/client": "0.23.8",
|
|
3
|
+
"@tachybase/database": "0.23.8",
|
|
4
|
+
"@tachybase/server": "0.23.8",
|
|
5
|
+
"react": "18.3.1",
|
|
6
|
+
"@tachybase/schema": "0.23.8",
|
|
7
|
+
"ahooks": "3.8.4",
|
|
8
|
+
"antd": "5.22.5",
|
|
9
|
+
"dayjs": "1.11.13",
|
|
10
|
+
"react-i18next": "15.2.0",
|
|
11
|
+
"@tachybase/actions": "0.23.8"
|
|
12
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"API key created successfully": "API key created successfully",
|
|
3
|
+
"API keys": "API keys",
|
|
4
|
+
"Add API key": "Add API key",
|
|
5
|
+
"Allow only your own roles to be selected": "Allow only your own roles to be selected",
|
|
6
|
+
"Created at": "Created at",
|
|
7
|
+
"Custom": "Custom",
|
|
8
|
+
"Delete API key": "Delete API key",
|
|
9
|
+
"Expiration": "Expiration",
|
|
10
|
+
"Key name": "Key name",
|
|
11
|
+
"Keys manager": "Keys manager",
|
|
12
|
+
"Make sure to copy your personal access key now as you will not be able to see this again.": "Make sure to copy your personal access key now as you will not be able to see this again.",
|
|
13
|
+
"Never": "Never",
|
|
14
|
+
"Never expires": "Never expires",
|
|
15
|
+
"Role": "Role",
|
|
16
|
+
"Role not found": "Role not found",
|
|
17
|
+
"1 Day": "1 Day",
|
|
18
|
+
"7 Days": "7 Days",
|
|
19
|
+
"30 Days": "30 Days",
|
|
20
|
+
"90 Days": "90 Days"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"API key created successfully": "API 키가 성공적으로 생성되었습니다",
|
|
3
|
+
"API keys": "API 키",
|
|
4
|
+
"Add API key": "API 키 추가",
|
|
5
|
+
"Allow only your own roles to be selected": "자신의 역할만 선택할 수 있도록 허용",
|
|
6
|
+
"Created at": "생성일",
|
|
7
|
+
"Custom": "사용자 설정",
|
|
8
|
+
"Delete API key": "API 키 삭제",
|
|
9
|
+
"Expiration": "만료",
|
|
10
|
+
"Key name": "키 이름",
|
|
11
|
+
"Keys manager": "키 관리자",
|
|
12
|
+
"Make sure to copy your personal access key now as you will not be able to see this again.": "이제 개인 액세스 키를 복사해두십시오. 이후에는 다시 확인할 수 없습니다.",
|
|
13
|
+
"Never": "영원히",
|
|
14
|
+
"Never expires": "만료되지 않음",
|
|
15
|
+
"Role": "역할",
|
|
16
|
+
"Role not found": "역할을 찾을 수 없음",
|
|
17
|
+
"1 Day": "1 일",
|
|
18
|
+
"7 Days": "7 일",
|
|
19
|
+
"30 Days": "30 일",
|
|
20
|
+
"90 Days": "90 일"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"API key created successfully": "API 密钥创建成功",
|
|
3
|
+
"API keys": "API 密钥",
|
|
4
|
+
"Add API key": "添加 API 密钥",
|
|
5
|
+
"Allow only your own roles to be selected": "只允许选择你自己拥有的角色",
|
|
6
|
+
"Created at": "创建时间",
|
|
7
|
+
"Custom": "自定义",
|
|
8
|
+
"Delete API key": "删除 API 密钥",
|
|
9
|
+
"Expiration": "过期时间",
|
|
10
|
+
"Key name": "密钥名称",
|
|
11
|
+
"Keys manager": "密钥管理",
|
|
12
|
+
"Make sure to copy your personal access key now as you will not be able to see this again.": "请确保现在复制你的个人访问密钥,因为你将无法再次看到这个密钥。",
|
|
13
|
+
"Never": "永不",
|
|
14
|
+
"Never expires": "永不过期",
|
|
15
|
+
"Role": "角色",
|
|
16
|
+
"Role not found": "角色不存在",
|
|
17
|
+
"1 Day": "1 天",
|
|
18
|
+
"7 Days": "7 天",
|
|
19
|
+
"30 Days": "30 天",
|
|
20
|
+
"90 Days": "90 天"
|
|
21
|
+
}
|
package/dist/locale.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateNTemplate(key: string): string;
|