@nocobase/plugin-api-keys 1.6.0-alpha.3 → 1.6.0-alpha.31

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.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_api_keys=self.webpackChunk_nocobase_plugin_api_keys||[]).push([["562"],{795:function(e,t,n){n.r(t),n.d(t,{Configuration:function(){return D}});var r,o,a,i=n("772"),l=n("156"),c=n.n(l),u=n("505"),s=n("749"),p=n("721"),m=n("760"),d=n.n(m),y=n("238"),f="@nocobase/plugin-api-keys";function b(){return(0,y.useTranslation)([f,"client"],{nsMode:"fallback"})}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(){var e,t,n=(e=["\n width: 100%;\n & > .ant-space-item {\n flex: 1;\n }\n"],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return x=function(){return n},n}var g=d()().add(1,"days"),h=(0,i.css)(x()),w=(0,u.connect)(function(e){var t,n,r,o,a=e.onChange;var i=(t=(0,s.useBoolean)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(l)throw r}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=i[0],u=i[1],m=u.toggle,y=u.setFalse;return c().createElement(p.Space,{className:h},c().createElement(p.Select,(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,a;r=e,o=t,a=n[t],o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})}return e}({},e),o=(o={value:l?"custom":e.value,onChange:function(e){if("custom"===e)return a("1d"),m();y(),a(e)}},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r)),l?c().createElement(p.DatePicker,{disabledDate:function(e){return e.isSameOrBefore()},defaultValue:g,onChange:function(e){e=e.millisecond(0).second(0);var t=d()().millisecond(0).second(0);a("".concat(e.diff(t,"d"),"d"))},showToday:!1,allowClear:!1}):null)},(0,u.mapProps)({dataSource:"options"}),(0,u.mapReadPretty)(function(){var e=(0,i.useRecord)(),t=e.expiresIn,n=e.createdAt,r=b().t,o=(0,l.useMemo)(function(){return"never"===t?r("Never expires"):d()(n).add((null==t?void 0:t.replace("d",""))||0,"days").format("YYYY-MM-DD HH:mm:ss")},[n,t]);return c().createElement(p.Typography.Text,null,o)})),A=n("875");function C(e){return"{{t('".concat(e,"', { ns: '").concat(f,"', nsMode: 'fallback' })}}")}var k={dumpRules:{group:"user"},migrationRules:["schema-only"],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:C("Expires"),"x-component":"ExpiresSelect",enum:[{label:C("1 Day"),value:"1d"},{label:C("7 Days"),value:"7d"},{label:C("30 Days"),value:"30d"},{label:C("90 Days"),value:"90d"},{label:C("Custom"),value:"custom"},{label:C("Never"),value:"never"}]}},{name:"token",type:"string",hidden:!0}]};function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){S(a,r,o,i,l,"next",e)}function l(e){S(a,r,o,i,l,"throw",e)}i(void 0)})}}function P(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}var T=p.Modal.useModal;var I={type:"object",properties:{configuration:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:k,resource:"apiKeys",action:"list",params:{pageSize:20,appends:["role"],sort:["-createdAt"]},rowKey:"name",showIndex:!0},"x-component":"CardItem",properties:(r={actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{create:{type:"void","x-action":"create",title:C("Add API key"),"x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:C("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:C("Key name"),required:!0,"x-component":"CollectionField","x-decorator":"FormItem"},role:{type:"string",title:C("Role"),required:!0,"x-decorator-props":{tooltip:C("Allow only your own roles to be selected")},"x-collection-field":"apiKeys.role","x-component":"CollectionField","x-decorator":"FormItem"},expiresIn:{type:"string",title:C("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:function(){var e,t,n=(0,u.useForm)(),r=(0,i.useActionContext)().setVisible,o=(0,i.useBlockRequestContext)(),a=o.resource,l=o.service,s=b().t;var m=(e=T(),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{!i&&null!=o.return&&o.return()}finally{if(l)throw r}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=m[0];return{run:function(){return j(function(){var e,t,o;return P(this,function(i){switch(i.label){case 0:return[4,n.submit()];case 1:return i.sent(),[4,a.create({values:n.values})];case 2:return o=i.sent(),d.success({title:s("API key created successfully"),onOk:function(){n.reset(),r(!1)},content:c().createElement(p.Space,{direction:"vertical"},c().createElement(p.Alert,{message:s("Make sure to copy your personal access key now as you will not be able to see this again."),type:"warning"}),c().createElement(p.Typography.Text,{copyable:!0},null===(t=o.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.token))}),null==l||l.refresh(),[2]}})})()},element:m[1]}}}}}}}}},"x-align":"right"}}}},o=(0,A.uid)(),a={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:C("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:C("Role"),properties:{role:{type:"string","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:C("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:C("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:C("Delete API key"),content:"{{t('Are you sure you want to delete it?')}}"},useAction:function(){var e=(0,i.useRecord)(),t=(0,i.useBlockRequestContext)(),n=t.resource,r=t.service;return{run:function(){return j(function(){return P(this,function(t){switch(t.label){case 0:return[4,n.destroy({filterByTk:e.id})];case 1:return t.sent(),r.refresh(),[2]}})})()}}}}}}}}}}},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)}}},D=function(){var e=(0,i.useCurrentRoles)();return c().createElement(i.SchemaComponentOptions,{scope:{currentRoles:e},components:{ExpiresSelect:w}},c().createElement(i.NocoBaseRecursionField,{schema:I}))}}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("dayjs"),require("ahooks"),require("antd"),require("@formily/react"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-api-keys",["react-i18next","@formily/shared","@nocobase/client","dayjs","ahooks","antd","@formily/react","react"],t):"object"==typeof exports?exports["@nocobase/plugin-api-keys"]=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("dayjs"),require("ahooks"),require("antd"),require("@formily/react"),require("react")):e["@nocobase/plugin-api-keys"]=t(e["react-i18next"],e["@formily/shared"],e["@nocobase/client"],e.dayjs,e.ahooks,e.antd,e["@formily/react"],e.react)}(self,function(e,t,n,r,o,i,u,c){return function(){var a,f,s,l,p,d={581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},505:function(e){"use strict";e.exports=u},875:function(e){"use strict";e.exports=t},772:function(e){"use strict";e.exports=n},749:function(e){"use strict";e.exports=o},721:function(e){"use strict";e.exports=i},760:function(e){"use strict";e.exports=r},156:function(e){"use strict";e.exports=c},238:function(t){"use strict";t.exports=e}},y={};function b(e){var t=y[e];if(void 0!==t)return t.exports;var n=y[e]={exports:{}};return d[e](n,n.exports,b),n.exports}b.m=d,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return"5447e19963f5fac8.js"},b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},f="@nocobase/plugin-api-keys:",b.l=function(e,t,n,r){if(a[e]){a[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var s=u[c];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==f+n){o=s;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-webpack",f+n),o.src=e),a[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=a[e];if(delete a[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.p="/static/plugins/@nocobase/plugin-api-keys/dist/client/",s={909:0},b.f.j=function(e,t){var n=b.o(s,e)?s[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=s[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(s,e)&&(0!==(n=s[e])&&(s[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},l=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,c=0;if(n.some(function(e){return 0!==s[e]})){for(i in r)b.o(r,i)&&(b.m[i]=r[i]);o&&o(b)}for(e&&e(t);c<n.length;c++)u=n[c],b.o(s,u)&&s[u]&&s[u][0](),s[u]=0},(p=self.webpackChunk_nocobase_plugin_api_keys=self.webpackChunk_nocobase_plugin_api_keys||[]).forEach(l.bind(null,0)),p.push=l.bind(null,p.push.bind(p));var h={};return!function(){"use strict";b.r(h),b.d(h,{PluginAPIKeysClient:function(){return s}});var e=b(772),t=b(581);function n(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o}).apply(null,arguments)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return r(e,arguments,i(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),u(o,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var f=(0,e.lazy)(function(){return t("imported_-138s8db_component",b.e("562").then(b.bind(b,795)))},"Configuration").Configuration,s=function(e){var t,r,c;function s(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,s),e=this,t=s,n=arguments,t=i(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],i(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(s,e),t=s,r=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){return t.pluginSettingsManager.add("api-keys",{icon:"KeyOutlined",title:t.t("API keys"),Component:f,aclSnippet:"pm.api-keys.configuration"}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function c(e){n(u,o,i,c,a,"next",e)}function a(e){n(u,o,i,c,a,"throw",e)}c(void 0)})})()}}],o(t.prototype,r),s}(c(e.Plugin));h.default=s}(),h}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("dayjs"),require("ahooks"),require("antd"),require("@formily/react"),require("react")):"function"==typeof define&&define.amd?define("@nocobase/plugin-api-keys",["react-i18next","@formily/shared","@nocobase/client","dayjs","ahooks","antd","@formily/react","react"],t):"object"==typeof exports?exports["@nocobase/plugin-api-keys"]=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/client"),require("dayjs"),require("ahooks"),require("antd"),require("@formily/react"),require("react")):e["@nocobase/plugin-api-keys"]=t(e["react-i18next"],e["@formily/shared"],e["@nocobase/client"],e.dayjs,e.ahooks,e.antd,e["@formily/react"],e.react)}(self,function(e,t,n,r,o,i,u,c){return function(){var a,f,s,l,p,d,y={581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},505:function(e){"use strict";e.exports=u},875:function(e){"use strict";e.exports=t},772:function(e){"use strict";e.exports=n},749:function(e){"use strict";e.exports=o},721:function(e){"use strict";e.exports=i},760:function(e){"use strict";e.exports=r},156:function(e){"use strict";e.exports=c},238:function(t){"use strict";t.exports=e}},b={};function h(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return y[e](n,n.exports,h),n.exports}h.m=y,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return"387a95b44b9c1ec6.js"},h.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},f="@nocobase/plugin-api-keys:",h.l=function(e,t,n,r){if(a[e]){a[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var s=u[c];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==f+n){o=s;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-webpack",f+n),o.src=e),a[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=a[e];if(delete a[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.p=(!(s=window.__nocobase_public_path__||"/").endsWith("/")&&(s+="/"),s+"static/plugins/@nocobase/plugin-api-keys/dist/client/"),l={909:0},h.f.j=function(e,t){var n=h.o(l,e)?l[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},p=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,c=0;if(n.some(function(e){return 0!==l[e]})){for(i in r)h.o(r,i)&&(h.m[i]=r[i]);o&&o(h)}for(e&&e(t);c<n.length;c++)u=n[c],h.o(l,u)&&l[u]&&l[u][0](),l[u]=0},(d=self.webpackChunk_nocobase_plugin_api_keys=self.webpackChunk_nocobase_plugin_api_keys||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d));var v={};return!function(){"use strict";h.r(v),h.d(v,{PluginAPIKeysClient:function(){return s}});var e=h(772),t=h(581);function n(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=a()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&u(o,n.prototype),o}).apply(null,arguments)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return r(e,arguments,i(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),u(o,e)})(e)}function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var f=(0,e.lazy)(function(){return t("imported_-138s8db_component",h.e("562").then(h.bind(h,795)))},"Configuration").Configuration,s=function(e){var t,r,c;function s(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,s),e=this,t=s,n=arguments,t=i(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,a()?Reflect.construct(t,n||[],i(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(s,e),t=s,r=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){return t.pluginSettingsManager.add("api-keys",{icon:"KeyOutlined",title:t.t("API keys"),Component:f,aclSnippet:"pm.api-keys.configuration"}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function c(e){n(u,o,i,c,a,"next",e)}function a(e){n(u,o,i,c,a,"throw",e)}c(void 0)})})()}}],o(t.prototype,r),s}(c(e.Plugin));v.default=s}(),v}()});
@@ -34,6 +34,7 @@ var apiKeys_default = {
34
34
  dumpRules: {
35
35
  group: "user"
36
36
  },
37
+ migrationRules: ["schema-only"],
37
38
  shared: true,
38
39
  name: "apiKeys",
39
40
  sortable: "sort",
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.0-alpha.3",
12
- "@nocobase/database": "1.6.0-alpha.3",
13
- "@nocobase/server": "1.6.0-alpha.3",
11
+ "@nocobase/client": "1.6.0-alpha.31",
12
+ "@nocobase/database": "1.6.0-alpha.31",
13
+ "@nocobase/server": "1.6.0-alpha.31",
14
14
  "@formily/react": "2.3.0",
15
15
  "ahooks": "3.7.8",
16
16
  "antd": "5.12.8",
@@ -18,5 +18,5 @@ module.exports = {
18
18
  "react": "18.2.0",
19
19
  "@formily/shared": "2.3.2",
20
20
  "react-i18next": "11.18.6",
21
- "@nocobase/actions": "1.6.0-alpha.3"
21
+ "@nocobase/actions": "1.6.0-alpha.31"
22
22
  };
@@ -0,0 +1,21 @@
1
+ {
2
+ "API keys": "Chiavi API",
3
+ "API key created successfully": "Chiave API creata con successo",
4
+ "Make sure to copy your personal access key now as you will not be able to see this again.": "Assicurati di copiare ora la tua chiave di accesso personale poiché non potrai più vederla.",
5
+ "Key name": "Nome chiave",
6
+ "Expiration": "Scadenza",
7
+ "Delete API key": "Elimina chiave API",
8
+ "Role": "Ruolo",
9
+ "Keys manager": "Gestore chiavi",
10
+ "Created at": "Creato il",
11
+ "Add API key": "Aggiungi chiave API",
12
+ "Never": "Mai",
13
+ "Custom": "Personalizzato",
14
+ "Never expires": "Non scade mai",
15
+ "1 Day": "1 giorno",
16
+ "7 Days": "7 giorni",
17
+ "30 Days": "30 giorni",
18
+ "90 Days": "90 giorni",
19
+ "Role not found": "Ruolo non trovato",
20
+ "Allow only your own roles to be selected": "Consenti solo i tuoi ruoli essere selezionati"
21
+ }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "认证:API 密钥",
5
5
  "description": "Allows users to use API key to access application's HTTP API",
6
6
  "description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API",
7
- "version": "1.6.0-alpha.3",
7
+ "version": "1.6.0-alpha.31",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/api-keys",
@@ -32,5 +32,5 @@
32
32
  "@nocobase/test": "1.x",
33
33
  "@nocobase/utils": "1.x"
34
34
  },
35
- "gitHead": "205b4aca5556d5af70679fa401394943a9e51670"
35
+ "gitHead": "2f118f0a0691dd51c437f208b1166258a615b6a8"
36
36
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_api_keys=self.webpackChunk_nocobase_plugin_api_keys||[]).push([["562"],{795:function(e,t,n){n.r(t),n.d(t,{Configuration:function(){return D}});var r,o,a,l=n("772"),i=n("156"),c=n.n(i),u=n("505"),s=n("749"),p=n("721"),m=n("760"),d=n.n(m),y=n("238"),f="@nocobase/plugin-api-keys";function b(){return(0,y.useTranslation)([f,"client"],{nsMode:"fallback"})}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(){var e,t,n=(e=["\n width: 100%;\n & > .ant-space-item {\n flex: 1;\n }\n"],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return x=function(){return n},n}var h=d()().add(1,"days"),g=(0,l.css)(x()),w=(0,u.connect)(function(e){var t,n,r,o,a=e.onChange;var l=(t=(0,s.useBoolean)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{!l&&null!=o.return&&o.return()}finally{if(i)throw r}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=l[0],u=l[1],m=u.toggle,y=u.setFalse;return c().createElement(p.Space,{className:g},c().createElement(p.Select,(r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,a;r=e,o=t,a=n[t],o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})}return e}({},e),o=(o={value:i?"custom":e.value,onChange:function(e){if("custom"===e)return a("1d"),m();y(),a(e)}},o),Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}),r)),i?c().createElement(p.DatePicker,{disabledDate:function(e){return e.isSameOrBefore()},defaultValue:h,onChange:function(e){e=e.millisecond(0).second(0);var t=d()().millisecond(0).second(0);a("".concat(e.diff(t,"d"),"d"))},showToday:!1,allowClear:!1}):null)},(0,u.mapProps)({dataSource:"options"}),(0,u.mapReadPretty)(function(){var e=(0,l.useRecord)(),t=e.expiresIn,n=e.createdAt,r=b().t,o=(0,i.useMemo)(function(){return"never"===t?r("Never expires"):d()(n).add((null==t?void 0:t.replace("d",""))||0,"days").format("YYYY-MM-DD HH:mm:ss")},[n,t]);return c().createElement(p.Typography.Text,null,o)})),A=n("875");function C(e){return"{{t('".concat(e,"', { ns: '").concat(f,"', nsMode: 'fallback' })}}")}var k={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:C("Expires"),"x-component":"ExpiresSelect",enum:[{label:C("1 Day"),value:"1d"},{label:C("7 Days"),value:"7d"},{label:C("30 Days"),value:"30d"},{label:C("90 Days"),value:"90d"},{label:C("Custom"),value:"custom"},{label:C("Never"),value:"never"}]}},{name:"token",type:"string",hidden:!0}]};function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,o,a,l){try{var i=e[a](l),c=i.value}catch(e){n(e);return}i.done?t(c):Promise.resolve(c).then(r,o)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){S(a,r,o,l,i,"next",e)}function i(e){S(a,r,o,l,i,"throw",e)}l(void 0)})}}function P(e,t){var n,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}var T=p.Modal.useModal;var I={type:"object",properties:{configuration:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:k,resource:"apiKeys",action:"list",params:{pageSize:20,appends:["role"],sort:["-createdAt"]},rowKey:"name",showIndex:!0},"x-component":"CardItem",properties:(r={actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{create:{type:"void","x-action":"create",title:C("Add API key"),"x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:C("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:C("Key name"),required:!0,"x-component":"CollectionField","x-decorator":"FormItem"},role:{type:"string",title:C("Role"),required:!0,"x-decorator-props":{tooltip:C("Allow only your own roles to be selected")},"x-collection-field":"apiKeys.role","x-component":"CollectionField","x-decorator":"FormItem"},expiresIn:{type:"string",title:C("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:function(){var e,t,n=(0,u.useForm)(),r=(0,l.useActionContext)().setVisible,o=(0,l.useBlockRequestContext)(),a=o.resource,i=o.service,s=b().t;var m=(e=T(),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{!l&&null!=o.return&&o.return()}finally{if(i)throw r}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return O(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=m[0];return{run:function(){return j(function(){var e,t,o;return P(this,function(l){switch(l.label){case 0:return[4,n.submit()];case 1:return l.sent(),[4,a.create({values:n.values})];case 2:return o=l.sent(),d.success({title:s("API key created successfully"),onOk:function(){n.reset(),r(!1)},content:c().createElement(p.Space,{direction:"vertical"},c().createElement(p.Alert,{message:s("Make sure to copy your personal access key now as you will not be able to see this again."),type:"warning"}),c().createElement(p.Typography.Text,{copyable:!0},null===(t=o.data)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.token))}),null==i||i.refresh(),[2]}})})()},element:m[1]}}}}}}}}},"x-align":"right"}}}},o=(0,A.uid)(),a={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:C("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:C("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:C("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:C("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:C("Delete API key"),content:"{{t('Are you sure you want to delete it?')}}"},useAction:function(){var e=(0,l.useRecord)(),t=(0,l.useBlockRequestContext)(),n=t.resource,r=t.service;return{run:function(){return j(function(){return P(this,function(t){switch(t.label){case 0:return[4,n.destroy({filterByTk:e.id})];case 1:return t.sent(),r.refresh(),[2]}})})()}}}}}}}}}}},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)}}},D=function(){var e=(0,l.useCurrentRoles)();return c().createElement(l.SchemaComponentOptions,{scope:{currentRoles:e},components:{ExpiresSelect:w}},c().createElement(l.NocoBaseRecursionField,{schema:I}))}}}]);