@nocobase/plugin-api-keys 1.2.13-alpha → 1.3.0-alpha.20240710084543

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.
Files changed (38) hide show
  1. package/package.json +2 -2
  2. package/dist/client/Configuration/ExpiresSelect.d.ts +0 -11
  3. package/dist/client/Configuration/index.d.ts +0 -10
  4. package/dist/client/Configuration/roles.d.ts +0 -11
  5. package/dist/client/Configuration/schema.d.ts +0 -10
  6. package/dist/client/index.d.ts +0 -13
  7. package/dist/client/index.js +0 -15
  8. package/dist/client/locale/index.d.ts +0 -10
  9. package/dist/collections/apiKeys.d.ts +0 -11
  10. package/dist/collections/apiKeys.js +0 -124
  11. package/dist/constants.d.ts +0 -9
  12. package/dist/constants.js +0 -36
  13. package/dist/externalVersion.js +0 -22
  14. package/dist/index.d.ts +0 -10
  15. package/dist/index.js +0 -48
  16. package/dist/locale/en-US.json +0 -21
  17. package/dist/locale/ko_KR.json +0 -21
  18. package/dist/locale/zh-CN.json +0 -21
  19. package/dist/locale.d.ts +0 -9
  20. package/dist/locale.js +0 -39
  21. package/dist/server/actions/api-keys.d.ts +0 -11
  22. package/dist/server/actions/api-keys.js +0 -88
  23. package/dist/server/collections/apiKeys.d.ts +0 -10
  24. package/dist/server/collections/apiKeys.js +0 -43
  25. package/dist/server/index.d.ts +0 -9
  26. package/dist/server/index.js +0 -42
  27. package/dist/server/locale/en-US.d.ts +0 -10
  28. package/dist/server/locale/en-US.js +0 -32
  29. package/dist/server/locale/fr-FR.d.ts +0 -10
  30. package/dist/server/locale/fr-FR.js +0 -32
  31. package/dist/server/locale/index.d.ts +0 -10
  32. package/dist/server/locale/index.js +0 -49
  33. package/dist/server/locale/zh-CN.d.ts +0 -12
  34. package/dist/server/locale/zh-CN.js +0 -34
  35. package/dist/server/plugin.d.ts +0 -15
  36. package/dist/server/plugin.js +0 -76
  37. package/dist/swagger/index.d.ts +0 -114
  38. package/dist/swagger/index.js +0 -139
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.2.13-alpha",
7
+ "version": "1.3.0-alpha.20240710084543",
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": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2"
35
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4"
36
36
  }
@@ -1,11 +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
- import React from 'react';
10
- declare const ExpiresSelect: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
11
- export { ExpiresSelect };
@@ -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
- import React from 'react';
10
- export declare const Configuration: () => React.JSX.Element;
@@ -1,11 +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
- export declare const useCurrentRolesProps: () => {
10
- options: any;
11
- };
@@ -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
- import { ISchema } from '@formily/react';
10
- export declare const configurationSchema: ISchema;
@@ -1,13 +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
- import { Plugin } from '@nocobase/client';
10
- export declare class PluginAPIKeysClient extends Plugin {
11
- load(): Promise<void>;
12
- }
13
- export default PluginAPIKeysClient;
@@ -1,15 +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
- (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/react"),require("ahooks"),require("antd"),require("dayjs"),require("react"),require("react-i18next"),require("@formily/shared")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/react","ahooks","antd","dayjs","react","react-i18next","@formily/shared"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-api-keys"]={},e["@nocobase/client"],e.jsxRuntime,e["@formily/react"],e.ahooks,e.antd,e.dayjs,e.react,e["react-i18next"],e["@formily/shared"]))})(this,function(e,t,o,p,x,s,d,m,i,y){"use strict";var Y=Object.defineProperty,H=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var D=(e,t,o)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))$.call(t,o)&&D(e,o,t[o]);if(P)for(var o of P(t))L.call(t,o)&&D(e,o,t[o]);return e},I=(e,t)=>H(e,W(t));var C=(e,t,o)=>new Promise((p,x)=>{var s=i=>{try{m(o.next(i))}catch(y){x(y)}},d=i=>{try{m(o.throw(i))}catch(y){x(y)}},m=i=>i.done?p(i.value):Promise.resolve(i.value).then(s,d);m((o=o.apply(e,t)).next())});const b="@nocobase/plugin-api-keys";function v(){return i.useTranslation([b,"client"],{nsMode:"fallback"})}const M=d().add(1,"days"),q=t.css`
11
- width: 100%;
12
- & > .ant-space-item {
13
- flex: 1;
14
- }
15
- `,F=n=>{const{onChange:a}=n,[c,{toggle:u,setFalse:f}]=x.useBoolean(),h=l=>{if(l==="custom")return a("1d"),u();f(),a(l)},A=l=>{l=l.millisecond(0).second(0);const k=d().millisecond(0).second(0),g=`${l.diff(k,"d")}d`;a(g)};return o.jsxs(s.Space,{className:q,children:[o.jsx(s.Select,I(w({},n),{value:c?"custom":n.value,onChange:h})),c?o.jsx(s.DatePicker,{disabledDate:l=>l.isSameOrBefore(),defaultValue:M,onChange:A,showToday:!1,allowClear:!1}):null]})},K=()=>{const{expiresIn:n,createdAt:a}=t.useRecord(),{t:c}=v(),u=m.useMemo(()=>n==="never"?c("Never expires"):d(a).add((n==null?void 0:n.replace("d",""))||0,"days").format("YYYY-MM-DD HH:mm:ss"),[a,n]);return o.jsx(s.Typography.Text,{children:u})},V=p.connect(F,p.mapProps({dataSource:"options"}),p.mapReadPretty(K));function r(n){return`{{t('${n}', { ns: '${b}', nsMode: 'fallback' })}}`}const B={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}]},{useModal:j}=s.Modal,O=()=>{const n=p.useForm(),{setVisible:a}=t.useActionContext(),{resource:c,service:u}=t.useBlockRequestContext(),{t:f}=v(),[h,A]=j();return{run(){return C(this,null,function*(){var g,S;yield n.submit();const k=yield c.create({values:n.values});h.success({title:f("API key created successfully"),onOk:()=>{n.reset(),a(!1)},content:o.jsxs(s.Space,{direction:"vertical",children:[o.jsx(s.Alert,{message:f("Make sure to copy your personal access key now as you will not be able to see this again."),type:"warning"}),o.jsx(s.Typography.Text,{copyable:!0,children:(S=(g=k.data)==null?void 0:g.data)==null?void 0:S.token})]})}),u==null||u.refresh()})},element:A}},N=()=>{const n=t.useRecord(),{resource:a,service:c}=t.useBlockRequestContext();return{run(){return C(this,null,function*(){yield a.destroy({filterByTk:n.id}),c.refresh()})}}},R={type:"object",properties:{configuration:{type:"void","x-decorator":"TableBlockProvider","x-decorator-props":{collection:B,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(--nb-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:O}}}}}}},"x-align":"right"}}},[y.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:N}}}}}}}}}}}},E=()=>{const n=t.useCurrentRoles();return o.jsx(t.SchemaComponentOptions,{scope:{currentRoles:n},components:{ExpiresSelect:V},children:o.jsx(p.RecursionField,{schema:R})})};class T extends t.Plugin{load(){return C(this,null,function*(){this.pluginSettingsManager.add(b,{icon:"KeyOutlined",title:this.t("API keys"),Component:E,aclSnippet:"pm.api-keys.configuration"})})}}e.PluginAPIKeysClient=T,e.default=T,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -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
- export declare function lang(key: string): string;
10
- export declare function useTranslation(): import("react-i18next").UseTranslationResponse<("@nocobase/plugin-api-keys" | "client")[], undefined>;
@@ -1,11 +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
- import type { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,124 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var apiKeys_exports = {};
28
- __export(apiKeys_exports, {
29
- default: () => apiKeys_default
30
- });
31
- module.exports = __toCommonJS(apiKeys_exports);
32
- var import_locale = require("../locale");
33
- var apiKeys_default = {
34
- dumpRules: {
35
- group: "user"
36
- },
37
- shared: true,
38
- name: "apiKeys",
39
- sortable: "sort",
40
- createdBy: true,
41
- updatedAt: false,
42
- updatedBy: false,
43
- logging: true,
44
- fields: [
45
- {
46
- name: "id",
47
- type: "bigInt",
48
- autoIncrement: true,
49
- primaryKey: true,
50
- allowNull: false,
51
- interface: "id"
52
- },
53
- {
54
- type: "string",
55
- name: "name",
56
- interface: "input",
57
- uiSchema: {
58
- type: "string",
59
- title: '{{t("name")}}',
60
- "x-component": "Input"
61
- }
62
- },
63
- {
64
- interface: "obo",
65
- type: "belongsTo",
66
- name: "role",
67
- target: "roles",
68
- foreignKey: "roleName",
69
- uiSchema: {
70
- type: "object",
71
- title: '{{t("Roles")}}',
72
- "x-component": "Select",
73
- "x-component-props": {
74
- fieldNames: {
75
- label: "title",
76
- value: "name"
77
- },
78
- objectValue: true,
79
- options: "{{ currentRoles }}"
80
- }
81
- }
82
- },
83
- {
84
- name: "expiresIn",
85
- type: "string",
86
- uiSchema: {
87
- type: "string",
88
- title: (0, import_locale.generateNTemplate)("Expires"),
89
- "x-component": "ExpiresSelect",
90
- enum: [
91
- {
92
- label: (0, import_locale.generateNTemplate)("1 Day"),
93
- value: "1d"
94
- },
95
- {
96
- label: (0, import_locale.generateNTemplate)("7 Days"),
97
- value: "7d"
98
- },
99
- {
100
- label: (0, import_locale.generateNTemplate)("30 Days"),
101
- value: "30d"
102
- },
103
- {
104
- label: (0, import_locale.generateNTemplate)("90 Days"),
105
- value: "90d"
106
- },
107
- {
108
- label: (0, import_locale.generateNTemplate)("Custom"),
109
- value: "custom"
110
- },
111
- {
112
- label: (0, import_locale.generateNTemplate)("Never"),
113
- value: "never"
114
- }
115
- ]
116
- }
117
- },
118
- {
119
- name: "token",
120
- type: "string",
121
- hidden: true
122
- }
123
- ]
124
- };
@@ -1,9 +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
- export declare const NAMESPACE = "@nocobase/plugin-api-keys";
package/dist/constants.js DELETED
@@ -1,36 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var constants_exports = {};
28
- __export(constants_exports, {
29
- NAMESPACE: () => NAMESPACE
30
- });
31
- module.exports = __toCommonJS(constants_exports);
32
- const NAMESPACE = "@nocobase/plugin-api-keys";
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- NAMESPACE
36
- });
@@ -1,22 +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
- module.exports = {
11
- "@nocobase/client": "1.2.13-alpha",
12
- "@nocobase/database": "1.2.13-alpha",
13
- "@nocobase/server": "1.2.13-alpha",
14
- "@formily/react": "2.3.0",
15
- "ahooks": "3.7.8",
16
- "antd": "5.12.8",
17
- "dayjs": "1.11.10",
18
- "react": "18.2.0",
19
- "@formily/shared": "2.3.0",
20
- "react-i18next": "11.18.6",
21
- "@nocobase/actions": "1.2.13-alpha"
22
- };
package/dist/index.d.ts DELETED
@@ -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
- export * from './server';
10
- export { default } from './server';
package/dist/index.js DELETED
@@ -1,48 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var src_exports = {};
39
- __export(src_exports, {
40
- default: () => import_server.default
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- __reExport(src_exports, require("./server"), module.exports);
44
- var import_server = __toESM(require("./server"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./server")
48
- });
@@ -1,21 +0,0 @@
1
- {
2
- "API keys": "API keys",
3
- "API key created successfully": "API key created successfully",
4
- "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.",
5
- "Key name": "Key name",
6
- "Expiration": "Expiration",
7
- "Delete API key": "Delete API key",
8
- "Role": "Role",
9
- "Keys manager": "Keys manager",
10
- "Created at": "Created at",
11
- "Add API key": "Add API key",
12
- "Never": "Never",
13
- "Custom": "Custom",
14
- "Never expires": "Never expires",
15
- "1 Day": "1 Day",
16
- "7 Days": "7 Days",
17
- "30 Days": "30 Days",
18
- "90 Days": "90 Days",
19
- "Role not found": "Role not found",
20
- "Allow only your own roles to be selected": "Allow only your own roles to be selected"
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "API keys": "API 키",
3
- "API key created successfully": "API 키가 성공적으로 생성되었습니다",
4
- "Make sure to copy your personal access key now as you will not be able to see this again.": "이제 개인 액세스 키를 복사해두십시오. 이후에는 다시 확인할 수 없습니다.",
5
- "Key name": "키 이름",
6
- "Expiration": "만료",
7
- "Delete API key": "API 키 삭제",
8
- "Role": "역할",
9
- "Keys manager": "키 관리자",
10
- "Created at": "생성일",
11
- "Add API key": "API 키 추가",
12
- "Never": "영원히",
13
- "Custom": "사용자 설정",
14
- "Never expires": "만료되지 않음",
15
- "1 Day": "1 일",
16
- "7 Days": "7 일",
17
- "30 Days": "30 일",
18
- "90 Days": "90 일",
19
- "Role not found": "역할을 찾을 수 없음",
20
- "Allow only your own roles to be selected": "자신의 역할만 선택할 수 있도록 허용"
21
- }
@@ -1,21 +0,0 @@
1
- {
2
- "API keys": "API 密钥",
3
- "API key created successfully": "API 密钥创建成功",
4
- "Make sure to copy your personal access key now as you will not be able to see this again.": "请确保现在复制你的个人访问密钥,因为你将无法再次看到这个密钥。",
5
- "Key name": "密钥名称",
6
- "Expiration": "过期时间",
7
- "Delete API key": "删除 API 密钥",
8
- "Role": "角色",
9
- "Keys manager": "密钥管理",
10
- "Created at": "创建时间",
11
- "Add API key": "添加 API 密钥",
12
- "Never": "永不",
13
- "Custom": "自定义",
14
- "Never expires": "永不过期",
15
- "1 Day": "1 天",
16
- "7 Days": "7 天",
17
- "30 Days": "30 天",
18
- "90 Days": "90 天",
19
- "Role not found": "角色不存在",
20
- "Allow only your own roles to be selected": "只允许选择你自己拥有的角色"
21
- }
package/dist/locale.d.ts DELETED
@@ -1,9 +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
- export declare function generateNTemplate(key: string): string;
package/dist/locale.js DELETED
@@ -1,39 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var locale_exports = {};
28
- __export(locale_exports, {
29
- generateNTemplate: () => generateNTemplate
30
- });
31
- module.exports = __toCommonJS(locale_exports);
32
- var import_constants = require("./constants");
33
- function generateNTemplate(key) {
34
- return `{{t('${key}', { ns: '${import_constants.NAMESPACE}', nsMode: 'fallback' })}}`;
35
- }
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- generateNTemplate
39
- });
@@ -1,11 +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
- import { Context, Next } from '@nocobase/actions';
10
- export declare function create(ctx: Context, next: Next): Promise<void>;
11
- export declare function destroy(ctx: Context, next: Next): Promise<void>;
@@ -1,88 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var api_keys_exports = {};
38
- __export(api_keys_exports, {
39
- create: () => create,
40
- destroy: () => destroy
41
- });
42
- module.exports = __toCommonJS(api_keys_exports);
43
- var import_actions = __toESM(require("@nocobase/actions"));
44
- async function create(ctx, next) {
45
- const { values } = ctx.action.params;
46
- if (!values.role) {
47
- return;
48
- }
49
- const repository = ctx.db.getRepository("users.roles", ctx.auth.user.id);
50
- const role = await repository.findOne({
51
- filter: {
52
- name: values.role.name
53
- }
54
- });
55
- if (!role) {
56
- throw ctx.throw(400, ctx.t("Role not found"));
57
- }
58
- const token = ctx.app.authManager.jwt.sign(
59
- { userId: ctx.auth.user.id, roleName: role.name },
60
- { expiresIn: values.expiresIn }
61
- );
62
- ctx.action.mergeParams({
63
- values: {
64
- token
65
- }
66
- });
67
- return import_actions.default.create(ctx, async () => {
68
- ctx.body = {
69
- token
70
- };
71
- await next();
72
- });
73
- }
74
- async function destroy(ctx, next) {
75
- const repo = ctx.db.getRepository(ctx.action.resourceName);
76
- const { filterByTk } = ctx.action.params;
77
- const data = await repo.findById(filterByTk);
78
- const token = data == null ? void 0 : data.get("token");
79
- if (token) {
80
- await ctx.app.authManager.jwt.block(token);
81
- }
82
- return import_actions.default.destroy(ctx, next);
83
- }
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- create,
87
- destroy
88
- });
@@ -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
- import apiKeys from '../../collections/apiKeys';
10
- export default apiKeys;
@@ -1,43 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var apiKeys_exports = {};
38
- __export(apiKeys_exports, {
39
- default: () => apiKeys_default
40
- });
41
- module.exports = __toCommonJS(apiKeys_exports);
42
- var import_apiKeys = __toESM(require("../../collections/apiKeys"));
43
- var apiKeys_default = import_apiKeys.default;
@@ -1,9 +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
- export { default } from './plugin';
@@ -1,42 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => import_plugin.default
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_plugin = __toESM(require("./plugin"));
@@ -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
- declare const _default: {};
10
- export default _default;
@@ -1,32 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var en_US_exports = {};
28
- __export(en_US_exports, {
29
- default: () => en_US_default
30
- });
31
- module.exports = __toCommonJS(en_US_exports);
32
- var en_US_default = {};
@@ -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
- declare const _default: {};
10
- export default _default;
@@ -1,32 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var fr_FR_exports = {};
28
- __export(fr_FR_exports, {
29
- default: () => fr_FR_default
30
- });
31
- module.exports = __toCommonJS(fr_FR_exports);
32
- var fr_FR_default = {};
@@ -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
- export { default as enUS } from './en-US';
10
- export { default as zhCN } from './zh-CN';
@@ -1,49 +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
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var locale_exports = {};
38
- __export(locale_exports, {
39
- enUS: () => import_en_US.default,
40
- zhCN: () => import_zh_CN.default
41
- });
42
- module.exports = __toCommonJS(locale_exports);
43
- var import_en_US = __toESM(require("./en-US"));
44
- var import_zh_CN = __toESM(require("./zh-CN"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- enUS,
48
- zhCN
49
- });
@@ -1,12 +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
- declare const _default: {
10
- 'Role not found': string;
11
- };
12
- export default _default;
@@ -1,34 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var zh_CN_exports = {};
28
- __export(zh_CN_exports, {
29
- default: () => zh_CN_default
30
- });
31
- module.exports = __toCommonJS(zh_CN_exports);
32
- var zh_CN_default = {
33
- "Role not found": "\u89D2\u8272\u4E0D\u5B58\u5728"
34
- };
@@ -1,15 +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
- import { Plugin } from '@nocobase/server';
10
- export declare class PluginAPIKeysServer extends Plugin {
11
- resourceName: string;
12
- beforeLoad(): Promise<void>;
13
- load(): Promise<void>;
14
- }
15
- export default PluginAPIKeysServer;
@@ -1,76 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var plugin_exports = {};
28
- __export(plugin_exports, {
29
- PluginAPIKeysServer: () => PluginAPIKeysServer,
30
- default: () => plugin_default
31
- });
32
- module.exports = __toCommonJS(plugin_exports);
33
- var import_server = require("@nocobase/server");
34
- var import_api_keys = require("./actions/api-keys");
35
- class PluginAPIKeysServer extends import_server.Plugin {
36
- resourceName = "apiKeys";
37
- async beforeLoad() {
38
- this.app.resourcer.define({
39
- name: this.resourceName,
40
- actions: {
41
- create: import_api_keys.create,
42
- destroy: import_api_keys.destroy
43
- },
44
- only: ["list", "create", "destroy"]
45
- });
46
- this.app.acl.registerSnippet({
47
- name: ["pm", this.name, "configuration"].join("."),
48
- actions: ["apiKeys:list", "apiKeys:create", "apiKeys:destroy"]
49
- });
50
- }
51
- async load() {
52
- this.app.resourcer.use(
53
- async (ctx, next) => {
54
- const { resourceName, actionName } = ctx.action;
55
- if (resourceName === this.resourceName && ["list", "destroy"].includes(actionName)) {
56
- ctx.action.mergeParams({
57
- filter: {
58
- createdById: ctx.auth.user.id
59
- }
60
- });
61
- }
62
- await next();
63
- },
64
- {
65
- group: "apiKeys",
66
- before: "acl",
67
- after: "auth"
68
- }
69
- );
70
- }
71
- }
72
- var plugin_default = PluginAPIKeysServer;
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- PluginAPIKeysServer
76
- });
@@ -1,114 +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
- declare const _default: {
10
- info: {
11
- title: string;
12
- };
13
- tags: any[];
14
- paths: {
15
- '/apiKeys:create': {
16
- post: {
17
- description: string;
18
- tags: string[];
19
- requestBody: {
20
- content: {
21
- 'application/json': {
22
- schema: {
23
- $ref: string;
24
- };
25
- };
26
- };
27
- };
28
- responses: {
29
- 200: {
30
- description: string;
31
- content: {
32
- 'application/json': {
33
- schema: {
34
- type: string;
35
- properties: {
36
- token: {
37
- type: string;
38
- };
39
- };
40
- };
41
- };
42
- };
43
- };
44
- };
45
- };
46
- };
47
- '/apiKeys:list': {
48
- get: {
49
- description: string;
50
- tags: string[];
51
- responses: {
52
- 200: {
53
- description: string;
54
- content: {
55
- 'application/json': {
56
- schema: {
57
- type: string;
58
- items: {
59
- $ref: string;
60
- };
61
- };
62
- };
63
- };
64
- };
65
- };
66
- };
67
- };
68
- '/apiKeys:destroy/{filterByTk}': {
69
- delete: {
70
- description: string;
71
- tags: string[];
72
- parameters: {
73
- name: string;
74
- description: string;
75
- required: boolean;
76
- in: string;
77
- schema: {
78
- type: string;
79
- example: number;
80
- };
81
- }[];
82
- responses: {
83
- 200: {
84
- description: string;
85
- };
86
- };
87
- };
88
- };
89
- };
90
- components: {
91
- schemas: {
92
- apiKeys: {
93
- type: string;
94
- properties: {
95
- id: {
96
- type: string;
97
- };
98
- name: {
99
- type: string;
100
- example: string;
101
- };
102
- role: {
103
- type: string;
104
- };
105
- expiresIn: {
106
- type: string;
107
- enum: string[];
108
- };
109
- };
110
- };
111
- };
112
- };
113
- };
114
- export default _default;
@@ -1,139 +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
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var swagger_exports = {};
28
- __export(swagger_exports, {
29
- default: () => swagger_default
30
- });
31
- module.exports = __toCommonJS(swagger_exports);
32
- var swagger_default = {
33
- info: {
34
- title: "NocoBase API - API keys plugin"
35
- },
36
- tags: [],
37
- paths: {
38
- "/apiKeys:create": {
39
- post: {
40
- description: "Create api key",
41
- tags: ["apiKeys"],
42
- requestBody: {
43
- content: {
44
- "application/json": {
45
- schema: {
46
- $ref: "#/components/schemas/apiKeys"
47
- }
48
- }
49
- }
50
- },
51
- responses: {
52
- 200: {
53
- description: "successful operation",
54
- content: {
55
- "application/json": {
56
- schema: {
57
- type: "object",
58
- properties: {
59
- token: {
60
- type: "string"
61
- }
62
- }
63
- }
64
- }
65
- }
66
- }
67
- }
68
- }
69
- },
70
- "/apiKeys:list": {
71
- get: {
72
- description: "get api keys",
73
- tags: ["apiKeys"],
74
- responses: {
75
- 200: {
76
- description: "successful operation",
77
- content: {
78
- "application/json": {
79
- schema: {
80
- type: "array",
81
- items: {
82
- $ref: "#/components/schemas/apiKeys"
83
- }
84
- }
85
- }
86
- }
87
- }
88
- }
89
- }
90
- },
91
- "/apiKeys:destroy/{filterByTk}": {
92
- delete: {
93
- description: "Create api key",
94
- tags: ["apiKeys"],
95
- parameters: [
96
- {
97
- name: "filterByTk",
98
- description: "primary key",
99
- required: true,
100
- in: "path",
101
- schema: {
102
- type: "integer",
103
- example: 1
104
- }
105
- }
106
- ],
107
- responses: {
108
- 200: {
109
- description: "successful operation"
110
- }
111
- }
112
- }
113
- }
114
- },
115
- components: {
116
- schemas: {
117
- apiKeys: {
118
- type: "object",
119
- properties: {
120
- id: {
121
- type: "integer"
122
- },
123
- name: {
124
- type: "string",
125
- example: "key-name"
126
- },
127
- role: {
128
- type: "object"
129
- // $ref: '#/components/schemas/roles'
130
- },
131
- expiresIn: {
132
- type: "string",
133
- enum: ["1d", "7d", "30d", "90d", "never"]
134
- }
135
- }
136
- }
137
- }
138
- }
139
- };