@tachybase/plugin-api-keys 1.3.16 → 1.3.18
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/dist/client/index.js +2 -2
- package/dist/externalVersion.js +6 -6
- package/dist/index.js +4 -4
- package/package.json +10 -10
package/dist/client/index.js
CHANGED
|
@@ -1,6 +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,b,a,u,c){"use strict";var
|
|
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,b,a,u,c){"use strict";var N=Object.defineProperty,Y=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable;var D=(t,e,o)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,P=(t,e)=>{for(var o in e||(e={}))W.call(e,o)&&D(t,o,e[o]);if(S)for(var o of S(e))_.call(e,o)&&D(t,o,e[o]);return t},M=(t,e)=>Y(t,H(e));var h=(t,e,o)=>new Promise((i,y)=>{var b=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(b,a);u((o=o.apply(t,e)).next())});const d="api-keys";function k(){return c.useTranslation([d,"core"],{nsMode:"fallback"})}const w=u().add(1,"days"),I=e.css`
|
|
2
2
|
width: 100%;
|
|
3
3
|
& > .ant-space-item {
|
|
4
4
|
flex: 1;
|
|
5
5
|
}
|
|
6
|
-
`,F=n=>{const{onChange:s}=n,[l,{toggle:m,setFalse:x}]=b.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:
|
|
6
|
+
`,F=n=>{const{onChange:s}=n,[l,{toggle:m,setFalse:x}]=b.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:I,children:[o.jsx(a.Select,M(P({},n),{value:l?"custom":n.value,onChange:g})),l?o.jsx(a.DatePicker,{disabledDate:p=>p.isSameOrBefore(),defaultValue:w,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,length:512},{name:"accessToken",type:"string",hidden:!0}]},{useModal:B}=a.Modal,O=()=>{const n=i.useForm(),{setVisible:s}=e.useActionContext(),{resource:l,service:m}=e.useBlockRequestContext(),{t:x}=k(),[g,C]=B();return{run(){return h(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}},j=()=>{const n=e.useRecord(),{resource:s,service:l}=e.useBlockRequestContext();return{run(){return h(this,null,function*(){yield s.destroy({filterByTk:n.id}),l.refresh()})}}},R={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:e.OpenMode.DRAWER_MODE,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:O}}}}}}},"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:j}}}}}}}}}}}},E=()=>{const n=e.useCurrentRoles();return o.jsx(e.SchemaComponentOptions,{scope:{currentRoles:n},components:{ExpiresSelect:V},children:o.jsx(i.RecursionField,{schema:R})})};class v extends e.Plugin{load(){return h(this,null,function*(){this.userSettingsManager.add(d,{icon:"KeyOutlined",title:this.t("API keys"),Component:E,aclSnippet:"pm.api-keys.configuration"})})}}t.PluginAPIKeysClient=v,t.default=v,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@tachybase/database": "1.3.
|
|
4
|
-
"@tachybase/server": "1.3.
|
|
2
|
+
"@tachybase/client": "1.3.18",
|
|
3
|
+
"@tachybase/database": "1.3.18",
|
|
4
|
+
"@tachybase/server": "1.3.18",
|
|
5
5
|
"react": "18.3.1",
|
|
6
|
-
"@tachybase/schema": "1.3.
|
|
7
|
-
"ahooks": "3.
|
|
6
|
+
"@tachybase/schema": "1.3.18",
|
|
7
|
+
"ahooks": "3.9.0",
|
|
8
8
|
"antd": "5.22.5",
|
|
9
9
|
"dayjs": "1.11.13",
|
|
10
10
|
"react-i18next": "15.2.0",
|
|
11
|
-
"@tachybase/actions": "1.3.
|
|
11
|
+
"@tachybase/actions": "1.3.18"
|
|
12
12
|
};
|
package/dist/index.js
CHANGED
|
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
31
|
default: () => import_server.default
|
|
32
32
|
});
|
|
33
|
-
module.exports = __toCommonJS(
|
|
34
|
-
__reExport(
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
__reExport(index_exports, require("./server"), module.exports);
|
|
35
35
|
var import_server = __toESM(require("./server"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-api-keys",
|
|
3
3
|
"displayName": "Auth: API keys",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.18",
|
|
5
5
|
"description": "Allows users to use API key to access application's HTTP API",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Authentication"
|
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"ahooks": "^3.
|
|
13
|
+
"ahooks": "^3.9.0",
|
|
14
14
|
"antd": "5.22.5",
|
|
15
15
|
"dayjs": "1.11.13",
|
|
16
16
|
"react": "^18.3.1",
|
|
17
17
|
"react-dom": "^18.3.1",
|
|
18
18
|
"react-i18next": "^15.2.0",
|
|
19
|
-
"@tachybase/schema": "1.3.
|
|
19
|
+
"@tachybase/schema": "1.3.18"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@tachybase/actions": "1.3.
|
|
23
|
-
"@tachybase/client": "1.3.
|
|
24
|
-
"@tachybase/database": "1.3.
|
|
25
|
-
"@tachybase/
|
|
26
|
-
"@tachybase/server": "1.3.
|
|
27
|
-
"@tachybase/
|
|
28
|
-
"@tachybase/utils": "1.3.
|
|
22
|
+
"@tachybase/actions": "1.3.18",
|
|
23
|
+
"@tachybase/client": "1.3.18",
|
|
24
|
+
"@tachybase/database": "1.3.18",
|
|
25
|
+
"@tachybase/test": "1.3.18",
|
|
26
|
+
"@tachybase/server": "1.3.18",
|
|
27
|
+
"@tachybase/resourcer": "1.3.18",
|
|
28
|
+
"@tachybase/utils": "1.3.18"
|
|
29
29
|
},
|
|
30
30
|
"description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API",
|
|
31
31
|
"displayName.zh-CN": "认证:API 密钥",
|