@nocobase/plugin-api-keys 0.10.1-alpha.1
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/README.md +9 -0
- package/README.zh-CN.md +9 -0
- package/client.d.ts +4 -0
- package/client.js +30 -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 +19 -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 +19 -0
- package/lib/client/Configuration/ExpiresSelect.d.ts +3 -0
- package/lib/client/Configuration/ExpiresSelect.js +131 -0
- package/lib/client/Configuration/index.d.ts +2 -0
- package/lib/client/Configuration/index.js +47 -0
- package/lib/client/Configuration/roles.d.ts +3 -0
- package/lib/client/Configuration/roles.js +20 -0
- package/lib/client/Configuration/schema.d.ts +2 -0
- package/lib/client/Configuration/schema.js +319 -0
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.js +46 -0
- package/lib/client/locale/en-US.d.ts +2 -0
- package/lib/client/locale/en-US.js +9 -0
- package/lib/client/locale/index.d.ts +2 -0
- package/lib/client/locale/index.js +32 -0
- package/lib/client/locale/zh-CN.d.ts +19 -0
- package/lib/client/locale/zh-CN.js +26 -0
- package/lib/collections/api-keys.d.ts +3 -0
- package/lib/collections/api-keys.js +87 -0
- package/lib/collections/index.d.ts +1 -0
- package/lib/collections/index.js +13 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +8 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/locale.d.ts +1 -0
- package/lib/locale.js +10 -0
- package/lib/server/actions/api-keys.d.ts +3 -0
- package/lib/server/actions/api-keys.js +71 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +13 -0
- package/lib/server/locale/en-US.d.ts +2 -0
- package/lib/server/locale/en-US.js +8 -0
- package/lib/server/locale/index.d.ts +2 -0
- package/lib/server/locale/index.js +20 -0
- package/lib/server/locale/zh-CN.d.ts +4 -0
- package/lib/server/locale/zh-CN.js +10 -0
- package/lib/server/plugin.d.ts +10 -0
- package/lib/server/plugin.js +77 -0
- package/package.json +24 -0
- package/server.d.ts +4 -0
- package/server.js +30 -0
- package/src/client/Configuration/ExpiresSelect.tsx +80 -0
- package/src/client/Configuration/index.tsx +18 -0
- package/src/client/Configuration/roles.ts +9 -0
- package/src/client/Configuration/schema.tsx +264 -0
- package/src/client/index.tsx +29 -0
- package/src/client/locale/en-US.ts +3 -0
- package/src/client/locale/index.ts +13 -0
- package/src/client/locale/zh-CN.ts +21 -0
- package/src/collections/api-keys.ts +95 -0
- package/src/collections/index.ts +1 -0
- package/src/constants.ts +1 -0
- package/src/index.ts +1 -0
- package/src/locale.ts +5 -0
- package/src/server/__tests__/actions.test.ts +181 -0
- package/src/server/actions/api-keys.ts +49 -0
- package/src/server/index.ts +1 -0
- package/src/server/locale/en-US.ts +1 -0
- package/src/server/locale/index.ts +2 -0
- package/src/server/locale/zh-CN.ts +3 -0
- package/src/server/plugin.ts +53 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.configurationSchema = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("@formily/react");
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _shared() {
|
|
15
|
+
const data = require("@formily/shared");
|
|
16
|
+
_shared = function _shared() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _client() {
|
|
22
|
+
const data = require("@nocobase/client");
|
|
23
|
+
_client = function _client() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _antd() {
|
|
29
|
+
const data = require("antd");
|
|
30
|
+
_antd = function _antd() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
function _react2() {
|
|
36
|
+
const data = _interopRequireDefault(require("react"));
|
|
37
|
+
_react2 = function _react2() {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
var _locale = require("../../locale");
|
|
43
|
+
var _locale2 = require("../locale");
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
46
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
47
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
48
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
50
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
51
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
52
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
+
const useModal = _antd().Modal.useModal;
|
|
54
|
+
const useCreateAction = () => {
|
|
55
|
+
const form = (0, _react().useForm)();
|
|
56
|
+
const _useActionContext = (0, _client().useActionContext)(),
|
|
57
|
+
setVisible = _useActionContext.setVisible;
|
|
58
|
+
const _useBlockRequestConte = (0, _client().useBlockRequestContext)(),
|
|
59
|
+
resource = _useBlockRequestConte.resource,
|
|
60
|
+
service = _useBlockRequestConte.service;
|
|
61
|
+
const _useTranslation = (0, _locale2.useTranslation)(),
|
|
62
|
+
t = _useTranslation.t;
|
|
63
|
+
const _useModal = useModal(),
|
|
64
|
+
_useModal2 = _slicedToArray(_useModal, 2),
|
|
65
|
+
modalIns = _useModal2[0],
|
|
66
|
+
element = _useModal2[1];
|
|
67
|
+
return {
|
|
68
|
+
run() {
|
|
69
|
+
return _asyncToGenerator(function* () {
|
|
70
|
+
var _response$data, _response$data$data;
|
|
71
|
+
yield form.submit();
|
|
72
|
+
const response = yield resource.create({
|
|
73
|
+
values: form.values
|
|
74
|
+
});
|
|
75
|
+
modalIns.success({
|
|
76
|
+
title: t('API key created successfully'),
|
|
77
|
+
onOk: () => {
|
|
78
|
+
form.reset();
|
|
79
|
+
setVisible(false);
|
|
80
|
+
},
|
|
81
|
+
content: _react2().default.createElement(_antd().Space, {
|
|
82
|
+
direction: "vertical"
|
|
83
|
+
}, _react2().default.createElement(_antd().Alert, {
|
|
84
|
+
message: t('Make sure to copy your personal access key now as you will not be able to see this again.'),
|
|
85
|
+
type: "warning"
|
|
86
|
+
}), _react2().default.createElement(_antd().Typography.Text, {
|
|
87
|
+
copyable: true
|
|
88
|
+
}, (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$data = _response$data.data) === null || _response$data$data === void 0 ? void 0 : _response$data$data.token))
|
|
89
|
+
});
|
|
90
|
+
service === null || service === void 0 ? void 0 : service.refresh();
|
|
91
|
+
})();
|
|
92
|
+
},
|
|
93
|
+
element
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const useDestroyAction = () => {
|
|
97
|
+
const record = (0, _client().useRecord)();
|
|
98
|
+
const _useBlockRequestConte2 = (0, _client().useBlockRequestContext)(),
|
|
99
|
+
resource = _useBlockRequestConte2.resource,
|
|
100
|
+
service = _useBlockRequestConte2.service;
|
|
101
|
+
return {
|
|
102
|
+
run() {
|
|
103
|
+
return _asyncToGenerator(function* () {
|
|
104
|
+
yield resource.destroy({
|
|
105
|
+
filterByTk: record.id
|
|
106
|
+
});
|
|
107
|
+
service.refresh();
|
|
108
|
+
})();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
const configurationSchema = {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
configuration: {
|
|
116
|
+
type: 'void',
|
|
117
|
+
'x-decorator': 'TableBlockProvider',
|
|
118
|
+
'x-decorator-props': {
|
|
119
|
+
collection: 'apiKeys',
|
|
120
|
+
resource: 'apiKeys',
|
|
121
|
+
action: 'list',
|
|
122
|
+
params: {
|
|
123
|
+
pageSize: 20,
|
|
124
|
+
appends: ['role'],
|
|
125
|
+
sort: ['-createdAt']
|
|
126
|
+
},
|
|
127
|
+
rowKey: 'name',
|
|
128
|
+
showIndex: true
|
|
129
|
+
},
|
|
130
|
+
'x-component': 'CardItem',
|
|
131
|
+
properties: {
|
|
132
|
+
actions: {
|
|
133
|
+
type: 'void',
|
|
134
|
+
'x-component': 'ActionBar',
|
|
135
|
+
'x-component-props': {
|
|
136
|
+
style: {
|
|
137
|
+
marginBottom: 'var(--nb-spacing)'
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
properties: {
|
|
141
|
+
create: {
|
|
142
|
+
type: 'void',
|
|
143
|
+
'x-action': 'create',
|
|
144
|
+
title: (0, _locale.generateNTemplate)('Add API key'),
|
|
145
|
+
'x-component': 'Action',
|
|
146
|
+
'x-component-props': {
|
|
147
|
+
openMode: 'drawer',
|
|
148
|
+
type: 'primary'
|
|
149
|
+
},
|
|
150
|
+
properties: {
|
|
151
|
+
drawer: {
|
|
152
|
+
type: 'void',
|
|
153
|
+
title: (0, _locale.generateNTemplate)('Add API key'),
|
|
154
|
+
'x-decorator': 'Form',
|
|
155
|
+
'x-component': 'Action.Modal',
|
|
156
|
+
'x-component-props': {
|
|
157
|
+
maskClosable: false,
|
|
158
|
+
style: {
|
|
159
|
+
maxWidth: '520px',
|
|
160
|
+
width: '100%'
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
properties: {
|
|
164
|
+
name: {
|
|
165
|
+
type: 'string',
|
|
166
|
+
title: (0, _locale.generateNTemplate)('Key name'),
|
|
167
|
+
required: true,
|
|
168
|
+
'x-component': 'CollectionField',
|
|
169
|
+
'x-decorator': 'FormItem'
|
|
170
|
+
},
|
|
171
|
+
role: {
|
|
172
|
+
type: 'string',
|
|
173
|
+
title: (0, _locale.generateNTemplate)('Role'),
|
|
174
|
+
required: true,
|
|
175
|
+
'x-collection-field': 'apiKeys.role',
|
|
176
|
+
'x-component': 'CollectionField',
|
|
177
|
+
'x-decorator': 'FormItem'
|
|
178
|
+
},
|
|
179
|
+
expiresIn: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
title: (0, _locale.generateNTemplate)('Expiration'),
|
|
182
|
+
required: true,
|
|
183
|
+
'x-component': 'CollectionField',
|
|
184
|
+
'x-decorator': 'FormItem',
|
|
185
|
+
default: '30d'
|
|
186
|
+
},
|
|
187
|
+
footer: {
|
|
188
|
+
type: 'void',
|
|
189
|
+
'x-component': 'Action.Modal.Footer',
|
|
190
|
+
properties: {
|
|
191
|
+
cancel: {
|
|
192
|
+
title: '{{t("Cancel")}}',
|
|
193
|
+
'x-component': 'Action',
|
|
194
|
+
'x-component-props': {
|
|
195
|
+
useAction: '{{ cm.useCancelAction }}'
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
submit: {
|
|
199
|
+
title: '{{t("Submit")}}',
|
|
200
|
+
'x-component': 'Action',
|
|
201
|
+
'x-component-props': {
|
|
202
|
+
type: 'primary',
|
|
203
|
+
useAction: useCreateAction
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
'x-align': 'right'
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
[(0, _shared().uid)()]: {
|
|
216
|
+
type: 'array',
|
|
217
|
+
'x-component': 'TableV2',
|
|
218
|
+
'x-component-props': {
|
|
219
|
+
rowKey: 'id',
|
|
220
|
+
useProps: '{{ useTableBlockProps }}'
|
|
221
|
+
},
|
|
222
|
+
properties: {
|
|
223
|
+
column1: {
|
|
224
|
+
type: 'void',
|
|
225
|
+
'x-decorator': 'TableV2.Column.Decorator',
|
|
226
|
+
'x-component': 'TableV2.Column',
|
|
227
|
+
title: (0, _locale.generateNTemplate)('Key name'),
|
|
228
|
+
properties: {
|
|
229
|
+
name: {
|
|
230
|
+
type: 'string',
|
|
231
|
+
'x-component': 'CollectionField',
|
|
232
|
+
'x-read-pretty': true
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
column2: {
|
|
237
|
+
type: 'void',
|
|
238
|
+
'x-decorator': 'TableV2.Column.Decorator',
|
|
239
|
+
'x-component': 'TableV2.Column',
|
|
240
|
+
title: (0, _locale.generateNTemplate)('Role'),
|
|
241
|
+
properties: {
|
|
242
|
+
role: {
|
|
243
|
+
type: 'object',
|
|
244
|
+
'x-collection-field': 'apiKeys.role',
|
|
245
|
+
'x-component': 'CollectionField',
|
|
246
|
+
'x-component-props': {
|
|
247
|
+
enableLink: false
|
|
248
|
+
},
|
|
249
|
+
'x-read-pretty': true
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
column3: {
|
|
254
|
+
type: 'void',
|
|
255
|
+
'x-decorator': 'TableV2.Column.Decorator',
|
|
256
|
+
'x-component': 'TableV2.Column',
|
|
257
|
+
title: (0, _locale.generateNTemplate)('Expiration'),
|
|
258
|
+
properties: {
|
|
259
|
+
expiresIn: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
'x-component': 'CollectionField',
|
|
262
|
+
'x-read-pretty': true
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
column4: {
|
|
267
|
+
type: 'void',
|
|
268
|
+
'x-decorator': 'TableV2.Column.Decorator',
|
|
269
|
+
'x-component': 'TableV2.Column',
|
|
270
|
+
title: (0, _locale.generateNTemplate)('Created at'),
|
|
271
|
+
properties: {
|
|
272
|
+
createdAt: {
|
|
273
|
+
type: 'date',
|
|
274
|
+
// 'x-component': 'CollectionField',
|
|
275
|
+
'x-component': 'DatePicker',
|
|
276
|
+
'x-component-props': {
|
|
277
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
278
|
+
},
|
|
279
|
+
'x-read-pretty': true
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
actionColumn: {
|
|
284
|
+
type: 'void',
|
|
285
|
+
title: '{{ t("Actions") }}',
|
|
286
|
+
'x-action-column': 'actions',
|
|
287
|
+
'x-decorator': 'TableV2.Column.ActionBar',
|
|
288
|
+
'x-component': 'TableV2.Column',
|
|
289
|
+
properties: {
|
|
290
|
+
columnActions: {
|
|
291
|
+
type: 'void',
|
|
292
|
+
'x-component': 'Space',
|
|
293
|
+
'x-component-props': {
|
|
294
|
+
split: '|'
|
|
295
|
+
},
|
|
296
|
+
properties: {
|
|
297
|
+
delete: {
|
|
298
|
+
type: 'void',
|
|
299
|
+
title: '{{ t("Delete") }}',
|
|
300
|
+
'x-component': 'Action.Link',
|
|
301
|
+
'x-component-props': {
|
|
302
|
+
confirm: {
|
|
303
|
+
title: (0, _locale.generateNTemplate)('Delete API key'),
|
|
304
|
+
content: "{{t('Are you sure you want to delete it?')}}"
|
|
305
|
+
},
|
|
306
|
+
useAction: useDestroyAction
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
exports.configurationSchema = configurationSchema;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function _client() {
|
|
8
|
+
const data = require("@nocobase/client");
|
|
9
|
+
_client = function _client() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _react() {
|
|
15
|
+
const data = _interopRequireDefault(require("react"));
|
|
16
|
+
_react = function _react() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
var _Configuration = require("./Configuration");
|
|
22
|
+
var _locale = require("./locale");
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
const ApiKeysProvider = _react().default.memo(props => {
|
|
25
|
+
const _useTranslation = (0, _locale.useTranslation)(),
|
|
26
|
+
t = _useTranslation.t;
|
|
27
|
+
return _react().default.createElement(_client().SettingsCenterProvider, {
|
|
28
|
+
settings: {
|
|
29
|
+
['api-keys']: {
|
|
30
|
+
title: t('API keys'),
|
|
31
|
+
icon: 'EnvironmentOutlined',
|
|
32
|
+
tabs: {
|
|
33
|
+
configuration: {
|
|
34
|
+
title: t('Keys manager'),
|
|
35
|
+
component: _Configuration.Configuration
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
41
|
+
components: {}
|
|
42
|
+
}, props.children));
|
|
43
|
+
});
|
|
44
|
+
ApiKeysProvider.displayName = 'ApiKeysProvider';
|
|
45
|
+
var _default = ApiKeysProvider;
|
|
46
|
+
exports.default = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lang = lang;
|
|
7
|
+
exports.useTranslation = useTranslation;
|
|
8
|
+
function _client() {
|
|
9
|
+
const data = require("@nocobase/client");
|
|
10
|
+
_client = function _client() {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _reactI18next() {
|
|
16
|
+
const data = require("react-i18next");
|
|
17
|
+
_reactI18next = function _reactI18next() {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
var _constants = require("../../constants");
|
|
23
|
+
function lang(key) {
|
|
24
|
+
return _client().i18n.t(key, {
|
|
25
|
+
ns: _constants.NAMESPACE
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function useTranslation() {
|
|
29
|
+
return (0, _reactI18next().useTranslation)([_constants.NAMESPACE, 'client'], {
|
|
30
|
+
nsMode: 'fallback'
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const locale: {
|
|
2
|
+
'API key created successfully': string;
|
|
3
|
+
'Make sure to copy your personal access key now as you will not be able to see this again.': string;
|
|
4
|
+
'Key name': string;
|
|
5
|
+
Expiration: string;
|
|
6
|
+
'Delete API key': string;
|
|
7
|
+
Role: string;
|
|
8
|
+
'Keys manager': string;
|
|
9
|
+
'Created at': string;
|
|
10
|
+
'Add API key': string;
|
|
11
|
+
Never: string;
|
|
12
|
+
Custom: string;
|
|
13
|
+
'Never expires': string;
|
|
14
|
+
'1 Day': string;
|
|
15
|
+
'7 Days': string;
|
|
16
|
+
'30 Days': string;
|
|
17
|
+
'90 Days': string;
|
|
18
|
+
};
|
|
19
|
+
export default locale;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const locale = {
|
|
8
|
+
'API key created successfully': 'API key 创建成功',
|
|
9
|
+
'Make sure to copy your personal access key now as you will not be able to see this again.': '请确保现在复制你的个人访问密钥,因为你将无法再次看到这个密钥。',
|
|
10
|
+
'Key name': '密钥名称',
|
|
11
|
+
Expiration: '过期时间',
|
|
12
|
+
'Delete API key': '删除 API key',
|
|
13
|
+
Role: '角色',
|
|
14
|
+
'Keys manager': '密钥管理',
|
|
15
|
+
'Created at': '创建时间',
|
|
16
|
+
'Add API key': '添加 API key',
|
|
17
|
+
Never: '永不',
|
|
18
|
+
Custom: '自定义',
|
|
19
|
+
'Never expires': '永不过期',
|
|
20
|
+
'1 Day': '1 天',
|
|
21
|
+
'7 Days': '7 天',
|
|
22
|
+
'30 Days': '30 天',
|
|
23
|
+
'90 Days': '90 天'
|
|
24
|
+
};
|
|
25
|
+
var _default = locale;
|
|
26
|
+
exports.default = _default;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _locale = require("../locale");
|
|
8
|
+
var _default = {
|
|
9
|
+
namespace: 'api-keys',
|
|
10
|
+
duplicator: 'optional',
|
|
11
|
+
name: 'apiKeys',
|
|
12
|
+
title: '{{t("API keys")}}',
|
|
13
|
+
sortable: 'sort',
|
|
14
|
+
model: 'ApiKeyModel',
|
|
15
|
+
createdBy: true,
|
|
16
|
+
updatedAt: false,
|
|
17
|
+
updatedBy: false,
|
|
18
|
+
logging: true,
|
|
19
|
+
fields: [{
|
|
20
|
+
name: 'id',
|
|
21
|
+
type: 'bigInt',
|
|
22
|
+
autoIncrement: true,
|
|
23
|
+
primaryKey: true,
|
|
24
|
+
allowNull: false,
|
|
25
|
+
interface: 'id'
|
|
26
|
+
}, {
|
|
27
|
+
type: 'string',
|
|
28
|
+
name: 'name',
|
|
29
|
+
interface: 'input',
|
|
30
|
+
uiSchema: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
title: '{{t("name")}}',
|
|
33
|
+
'x-component': 'Input'
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
interface: 'obo',
|
|
37
|
+
type: 'belongsTo',
|
|
38
|
+
name: 'role',
|
|
39
|
+
target: 'roles',
|
|
40
|
+
foreignKey: 'roleName',
|
|
41
|
+
uiSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
title: '{{t("Roles")}}',
|
|
44
|
+
'x-component': 'Select',
|
|
45
|
+
'x-component-props': {
|
|
46
|
+
fieldNames: {
|
|
47
|
+
label: 'title',
|
|
48
|
+
value: 'name'
|
|
49
|
+
},
|
|
50
|
+
objectValue: true,
|
|
51
|
+
options: '{{ currentRoles }}'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
name: 'expiresIn',
|
|
56
|
+
type: 'string',
|
|
57
|
+
uiSchema: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
title: (0, _locale.generateNTemplate)('Expires'),
|
|
60
|
+
'x-component': 'ExpiresSelect',
|
|
61
|
+
enum: [{
|
|
62
|
+
label: (0, _locale.generateNTemplate)('1 Day'),
|
|
63
|
+
value: '1d'
|
|
64
|
+
}, {
|
|
65
|
+
label: (0, _locale.generateNTemplate)('7 Days'),
|
|
66
|
+
value: '7d'
|
|
67
|
+
}, {
|
|
68
|
+
label: (0, _locale.generateNTemplate)('30 Days'),
|
|
69
|
+
value: '30d'
|
|
70
|
+
}, {
|
|
71
|
+
label: (0, _locale.generateNTemplate)('90 Days'),
|
|
72
|
+
value: '90d'
|
|
73
|
+
}, {
|
|
74
|
+
label: (0, _locale.generateNTemplate)('Custom'),
|
|
75
|
+
value: 'custom'
|
|
76
|
+
}, {
|
|
77
|
+
label: (0, _locale.generateNTemplate)('Never'),
|
|
78
|
+
value: 'never'
|
|
79
|
+
}]
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
name: 'token',
|
|
83
|
+
type: 'string',
|
|
84
|
+
hidden: true
|
|
85
|
+
}]
|
|
86
|
+
};
|
|
87
|
+
exports.default = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as apiKeysCollection } from './api-keys';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "apiKeysCollection", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _apiKeys.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _apiKeys = _interopRequireDefault(require("./api-keys"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NAMESPACE = "api-keys";
|
package/lib/constants.js
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './server';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _server.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _server = _interopRequireDefault(require("./server"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/locale.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateNTemplate(key: string): string;
|
package/lib/locale.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.generateNTemplate = generateNTemplate;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
function generateNTemplate(key) {
|
|
9
|
+
return `{{t('${key}', { ns: '${_constants.NAMESPACE}', nsMode: 'fallback' })}}`;
|
|
10
|
+
}
|