@nocobase/plugin-workflow-aggregate 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.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流:聚合查询节点",
5
5
  "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.",
6
6
  "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。",
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/workflow-aggregate",
@@ -21,7 +21,7 @@
21
21
  "@nocobase/server": "1.x",
22
22
  "@nocobase/test": "1.x"
23
23
  },
24
- "gitHead": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2",
24
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
25
25
  "keywords": [
26
26
  "Workflow"
27
27
  ]
@@ -1,221 +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
- import { SchemaInitializerItemType, useCollectionDataSource } from '@nocobase/client';
11
- import { FilterDynamicComponent, Instruction } from '@nocobase/plugin-workflow/client';
12
- declare function AssociatedConfig({ value, onChange, ...props }: {
13
- [x: string]: any;
14
- value: any;
15
- onChange: any;
16
- }): JSX.Element;
17
- export default class extends Instruction {
18
- title: string;
19
- type: string;
20
- group: string;
21
- description: string;
22
- fieldset: {
23
- aggregator: {
24
- type: string;
25
- title: string;
26
- 'x-decorator': string;
27
- 'x-component': string;
28
- enum: {
29
- label: string;
30
- value: string;
31
- }[];
32
- required: boolean;
33
- default: string;
34
- };
35
- associated: {
36
- type: string;
37
- title: string;
38
- 'x-decorator': string;
39
- 'x-component': string;
40
- enum: {
41
- label: string;
42
- value: boolean;
43
- }[];
44
- required: boolean;
45
- default: boolean;
46
- 'x-reactions': {
47
- target: string;
48
- effects: string[];
49
- fulfill: {
50
- state: {
51
- value: any;
52
- };
53
- };
54
- }[];
55
- };
56
- collectionField: {
57
- type: string;
58
- 'x-decorator': string;
59
- 'x-decorator-props': {
60
- value: {
61
- designable: boolean;
62
- };
63
- };
64
- 'x-component': string;
65
- properties: {
66
- row: {
67
- type: string;
68
- 'x-component': string;
69
- properties: {
70
- target: {
71
- type: string;
72
- 'x-component': string;
73
- properties: {
74
- collection: {
75
- type: string;
76
- required: boolean;
77
- 'x-decorator': string;
78
- 'x-component': string;
79
- title: string;
80
- 'x-reactions': ({
81
- dependencies: string[];
82
- fulfill: {
83
- state: {
84
- display: string;
85
- value?: undefined;
86
- };
87
- };
88
- target?: undefined;
89
- effects?: undefined;
90
- } | {
91
- target: string;
92
- effects: string[];
93
- fulfill: {
94
- state: {
95
- value: any;
96
- display?: undefined;
97
- };
98
- };
99
- dependencies?: undefined;
100
- })[];
101
- };
102
- association: {
103
- type: string;
104
- title: string;
105
- 'x-decorator': string;
106
- 'x-component': string;
107
- 'x-component-props': {
108
- changeOnSelect: boolean;
109
- };
110
- 'x-reactions': {
111
- dependencies: string[];
112
- fulfill: {
113
- state: {
114
- visible: string;
115
- };
116
- };
117
- }[];
118
- required: boolean;
119
- };
120
- };
121
- };
122
- field: {
123
- type: string;
124
- 'x-component': string;
125
- properties: {
126
- 'params.field': {
127
- type: string;
128
- title: string;
129
- 'x-decorator': string;
130
- 'x-component': string;
131
- 'x-component-props': {
132
- filter(field: any): boolean;
133
- };
134
- required: boolean;
135
- 'x-reactions': {
136
- dependencies: string[];
137
- fulfill: {
138
- state: {
139
- visible: string;
140
- };
141
- };
142
- }[];
143
- };
144
- };
145
- };
146
- };
147
- };
148
- };
149
- };
150
- params: {
151
- type: string;
152
- properties: {
153
- distinct: {
154
- type: string;
155
- title: string;
156
- 'x-decorator': string;
157
- 'x-component': string;
158
- 'x-reactions': {
159
- dependencies: string[];
160
- fulfill: {
161
- state: {
162
- visible: string;
163
- };
164
- };
165
- }[];
166
- };
167
- filter: {
168
- type: string;
169
- title: string;
170
- 'x-decorator': string;
171
- 'x-component': string;
172
- 'x-use-component-props': () => {
173
- options: any[];
174
- className: string;
175
- };
176
- 'x-component-props': {
177
- dynamicComponent: string;
178
- };
179
- 'x-reactions': {
180
- dependencies: string[];
181
- fulfill: {
182
- state: {
183
- visible: string;
184
- };
185
- };
186
- }[];
187
- };
188
- };
189
- };
190
- };
191
- scope: {
192
- useCollectionDataSource: typeof useCollectionDataSource;
193
- };
194
- components: {
195
- SchemaComponentContext: React.Context<import("@nocobase/client").ISchemaComponentContext>;
196
- FilterDynamicComponent: typeof FilterDynamicComponent;
197
- FieldsSelect: React.MemoExoticComponent<import("@formily/react").ReactFC<Omit<any, "ref">>>;
198
- ValueBlock: (() => JSX.Element) & {
199
- Initializer: () => JSX.Element;
200
- Result: (props: any) => JSX.Element;
201
- Designer: () => JSX.Element;
202
- };
203
- AssociatedConfig: typeof AssociatedConfig;
204
- };
205
- useVariables({ key, title }: {
206
- key: any;
207
- title: any;
208
- }, { types, fieldNames }: {
209
- types: any;
210
- fieldNames?: {
211
- readonly label: "label";
212
- readonly value: "value";
213
- readonly children: "children";
214
- };
215
- }): {
216
- value: any;
217
- label: any;
218
- };
219
- useInitializers(node: any): SchemaInitializerItemType | null;
220
- }
221
- export {};
@@ -1,14 +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 default class extends Plugin {
11
- afterAdd(): Promise<void>;
12
- beforeLoad(): Promise<void>;
13
- load(): Promise<void>;
14
- }
@@ -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
-
10
- (function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@formily/react"),require("antd"),require("react"),require("@nocobase/plugin-workflow/client"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@formily/react","antd","react","@nocobase/plugin-workflow/client","react-i18next"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["@nocobase/plugin-workflow-aggregate"]={},t["@nocobase/client"],t.jsxRuntime,t["@formily/react"],t.antd,t.react,t["@nocobase/plugin-workflow"],t["react-i18next"]))})(this,function(t,e,o,r,S,h,s,b){"use strict";var J=Object.defineProperty,W=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var q=(t,e,o)=>e in t?J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,V=(t,e)=>{for(var o in e||(e={}))A.call(e,o)&&q(t,o,e[o]);if(I)for(var o of I(e))N.call(e,o)&&q(t,o,e[o]);return t},$=(t,e)=>W(t,Y(e));var G=(t,e)=>{var o={};for(var r in t)A.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&I)for(var r of I(t))e.indexOf(r)<0&&N.call(t,r)&&(o[r]=t[r]);return o};var g=(t,e,o)=>(q(t,typeof e!="symbol"?e+"":e,o),o);var C=(t,e,o)=>new Promise((r,S)=>{var h=i=>{try{b(o.next(i))}catch(v){S(v)}},s=i=>{try{b(o.throw(i))}catch(v){S(v)}},b=i=>i.done?r(i.value):Promise.resolve(i.value).then(h,s);b((o=o.apply(t,e)).next())});const i="workflow-aggregate";function v(l,c={}){const{t:n}=B(c);return n(l)}function B(l){return b.useTranslation(i,l)}function K(l){return["hasMany","belongsToMany"].includes(l.type)}function P(){const l=e.useCompile();return[s.nodesOptions,s.triggerOptions].map(c=>{var d;const n=(d=c.useOptions({types:[K],appends:null,depth:4}))==null?void 0:d.filter(Boolean);return{label:l(c.label),value:c.value,key:c.value,children:l(n),disabled:n&&!n.length}})}function R(d){var u=d,{value:l,onChange:c}=u,n=G(u,["value","onChange"]);const{setValuesIn:x}=r.useForm(),{getCollection:k}=e.useCollectionManager_deprecated(),M=P(),[F,D]=h.useState(M),{associatedKey:_="",name:z}=l!=null?l:{};let w=[];const O=_.match(/^{{(.*)}}$/);O&&(w=[...O[1].trim().split(".").slice(0,-1),z]);const U=m=>C(this,null,function*(){var p;const a=m[m.length-1];!((p=a.children)!=null&&p.length)&&!a.isLeaf&&a.loadChildren&&(yield a.loadChildren(a),D(f=>[...f]))});h.useEffect(()=>{C(this,null,function*(){var p;if(!w||F.length<=1)return;let a=null;for(let f=0;f<w.length;f++){const T=w[f];try{f===0?a=F.find(y=>y.value===T):(a.loadChildren&&!((p=a.children)!=null&&p.length)&&(yield a.loadChildren(a)),a=a.children.find(y=>y.value===T))}catch(y){console.error(y)}}D([...F])})},[l,F.length]);const Q=h.useCallback((m,a)=>{if(!(m!=null&&m.length)){x("collection",null),c({});return}const{field:p}=a.pop();if(!p||!["hasMany","belongsToMany"].includes(p.type))return;const{collectionName:f,target:T,name:y,dataSourceKey:j}=p,X=k(f,j).fields.find(H=>H.primaryKey);x("collection",e.joinCollectionName(j,T)),c({name:y,associatedKey:`{{${m.slice(0,-1).join(".")}.${X.name}}}`,associatedCollection:e.joinCollectionName(j,f)})},[c]);return o.jsx(S.Cascader,$(V({},n),{value:w,options:F,changeOnSelect:!0,onChange:Q,loadData:U}))}class E extends s.Instruction{constructor(){super(...arguments);g(this,"title",`{{t("Aggregate", { ns: "${i}" })}}`);g(this,"type","aggregate");g(this,"group","collection");g(this,"description",`{{t("Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.", { ns: "${i}" })}}`);g(this,"fieldset",{aggregator:{type:"string",title:`{{t("Aggregator function", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"COUNT",value:"count"},{label:"SUM",value:"sum"},{label:"AVG",value:"avg"},{label:"MIN",value:"min"},{label:"MAX",value:"max"}],required:!0,default:"count"},associated:{type:"boolean",title:`{{t("Target type", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Data of collection", { ns: "${i}" })}}`,value:!1},{label:`{{t("Data of associated collection", { ns: "${i}" })}}`,value:!0}],required:!0,default:!1,"x-reactions":[{target:"collection",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"association",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},collectionField:{type:"void","x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{target:{type:"void","x-component":"Grid.Col",properties:{collection:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader",title:`{{t("Data of collection", { ns: "${i}" })}}`,"x-reactions":[{dependencies:["associated"],fulfill:{state:{display:'{{$deps[0] ? "hidden" : "visible"}}'}}},{target:"params.field",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:null}}}]},association:{type:"object",title:`{{t("Data of associated collection", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"AssociatedConfig","x-component-props":{changeOnSelect:!0},"x-reactions":[{dependencies:["associated"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}],required:!0}}},field:{type:"void","x-component":"Grid.Col",properties:{"params.field":{type:"string",title:`{{t("Field to aggregate", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{filter(n){return!n.hidden&&n.interface&&!["belongsTo","hasOne","hasMany","belongsToMany"].includes(n.type)}},required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}}}}},params:{type:"object",properties:{distinct:{type:"boolean",title:`{{t("Distinct", { ns: "${i}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox","x-reactions":[{dependencies:["collection","aggregator"],fulfill:{state:{visible:'{{!!$deps[0] && ["count"].includes($deps[1])}}'}}}]},filter:{type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:n}=r.useForm(),[d,u]=e.parseCollectionName(n==null?void 0:n.collection);return{options:e.useCollectionFilterOptions(u,d),className:e.css`
11
- position: relative;
12
- width: 100%;
13
- `}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]}}}});g(this,"scope",{useCollectionDataSource:e.useCollectionDataSource});g(this,"components",{SchemaComponentContext:e.SchemaComponentContext,FilterDynamicComponent:s.FilterDynamicComponent,FieldsSelect:s.FieldsSelect,ValueBlock:s.ValueBlock,AssociatedConfig:R})}useVariables({key:n,title:d},{types:u,fieldNames:x=s.defaultFieldNames}){return u&&!u.some(k=>k in s.BaseTypeSets||Object.values(s.BaseTypeSets).some(M=>M.has(k)))?null:{[x.value]:n,[x.label]:d}}useInitializers(n){var u;const d=v("Query result");return n.config.collection?{name:`#${n.id}`,type:"item",title:(u=n.title)!=null?u:`#${n.id}`,Component:s.ValueBlock.Initializer,node:n,resultTitle:d}:null}}class L extends e.Plugin{afterAdd(){return C(this,null,function*(){})}beforeLoad(){return C(this,null,function*(){})}load(){return C(this,null,function*(){this.app.pm.get("workflow").registerInstruction("aggregate",E)})}}t.default=L,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,23 +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
- "@formily/react": "2.3.0",
12
- "antd": "5.12.8",
13
- "react": "18.2.0",
14
- "@nocobase/client": "1.2.13-alpha",
15
- "@nocobase/plugin-workflow": "1.2.13-alpha",
16
- "react-i18next": "11.18.6",
17
- "@nocobase/data-source-manager": "1.2.13-alpha",
18
- "@nocobase/database": "1.2.13-alpha",
19
- "@nocobase/server": "1.2.13-alpha",
20
- "@nocobase/plugin-workflow-test": "1.2.13-alpha",
21
- "@nocobase/test": "1.2.13-alpha",
22
- "@nocobase/utils": "1.2.13-alpha"
23
- };
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,12 +0,0 @@
1
- {
2
- "Aggregate": "Aggregate",
3
- "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.":
4
- "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.",
5
- "Aggregator function": "Aggregator function",
6
- "Target type": "Target type",
7
- "Data of collection": "Data of collection",
8
- "Data of associated collection": "Data of associated collection",
9
- "Field to aggregate": "Field to aggregate",
10
- "Distinct": "Distinct",
11
- "Query result": "Query result"
12
- }
@@ -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 NAMESPACE = "workflow-aggregate";
10
- export declare function useLang(key: string, options?: {}): string;
11
- export declare function usePluginTranslation(options: any): import("react-i18next").UseTranslationResponse<"workflow-aggregate", undefined>;
@@ -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 __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
- NAMESPACE: () => NAMESPACE,
30
- useLang: () => useLang,
31
- usePluginTranslation: () => usePluginTranslation
32
- });
33
- module.exports = __toCommonJS(locale_exports);
34
- var import_react_i18next = require("react-i18next");
35
- const NAMESPACE = "workflow-aggregate";
36
- function useLang(key, options = {}) {
37
- const { t } = usePluginTranslation(options);
38
- return t(key);
39
- }
40
- function usePluginTranslation(options) {
41
- return (0, import_react_i18next.useTranslation)(NAMESPACE, options);
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- NAMESPACE,
46
- useLang,
47
- usePluginTranslation
48
- });
@@ -1,12 +0,0 @@
1
- {
2
- "Aggregate": "집계 조회",
3
- "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.":
4
- "데이터 테이블의 여러 레코드 또는 레코드의 관련 데이터에 대한 카운트, 합계, 최대값, 최소값, 평균값을 찾습니다.",
5
- "Aggregator function": "집계 함수",
6
- "Target type": "대상 유형",
7
- "Data of collection": "데이터 테이블 데이터",
8
- "Data of associated collection": "관련 데이터 테이블 데이터",
9
- "Field to aggregate": "집계할 필드",
10
- "Distinct": "중복 제거",
11
- "Query result": "쿼리 결과"
12
- }
@@ -1,12 +0,0 @@
1
- {
2
- "Aggregate": "聚合查询",
3
- "Counting, summing, finding maximum, minimum, and average values for multiple records of a collection or associated data of a record.":
4
- "对一个数据表里的多条数据或者一条数据里的关系数据进行统计、求和、求最大值、最小值、平均值。",
5
- "Aggregator function": "聚合函数",
6
- "Target type": "目标类型",
7
- "Data of collection": "数据表数据",
8
- "Data of associated collection": "关联数据表数据",
9
- "Field to aggregate": "聚合字段",
10
- "Distinct": "去重",
11
- "Query result": "查询结果"
12
- }
@@ -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 { Processor, Instruction, FlowNodeModel } from '@nocobase/plugin-workflow';
10
- export default class extends Instruction {
11
- run(node: FlowNodeModel, input: any, processor: Processor): Promise<{
12
- result: any;
13
- status: 1;
14
- }>;
15
- }
@@ -1,65 +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 AggregateInstruction_exports = {};
28
- __export(AggregateInstruction_exports, {
29
- default: () => AggregateInstruction_default
30
- });
31
- module.exports = __toCommonJS(AggregateInstruction_exports);
32
- var import_data_source_manager = require("@nocobase/data-source-manager");
33
- var import_database = require("@nocobase/database");
34
- var import_plugin_workflow = require("@nocobase/plugin-workflow");
35
- const aggregators = {
36
- count: "count",
37
- sum: "sum",
38
- avg: "avg",
39
- min: "min",
40
- max: "max"
41
- };
42
- class AggregateInstruction_default extends import_plugin_workflow.Instruction {
43
- async run(node, input, processor) {
44
- const { aggregator, associated, collection, association = {}, params = {} } = node.config;
45
- const options = processor.getParsedValue(params, node.id);
46
- const [dataSourceName, collectionName] = (0, import_data_source_manager.parseCollectionName)(collection);
47
- const { collectionManager } = this.workflow.app.dataSourceManager.dataSources.get(dataSourceName);
48
- const repo = associated ? collectionManager.getRepository(
49
- `${association == null ? void 0 : association.associatedCollection}.${association.name}`,
50
- processor.getParsedValue(association == null ? void 0 : association.associatedKey, node.id)
51
- ) : collectionManager.getRepository(collectionName);
52
- if (!options.dataType && aggregator === "avg") {
53
- options.dataType = import_database.DataTypes.DOUBLE;
54
- }
55
- const result = await repo.aggregate({
56
- ...options,
57
- method: aggregators[aggregator]
58
- // transaction: processor.transaction,
59
- });
60
- return {
61
- result: options.dataType === import_database.DataTypes.DOUBLE ? Number(result) : result,
62
- status: import_plugin_workflow.JOB_STATUS.RESOLVED
63
- };
64
- }
65
- }
@@ -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
- import { Plugin } from '@nocobase/server';
10
- export default class extends Plugin {
11
- load(): Promise<void>;
12
- }
@@ -1,50 +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 Plugin_exports = {};
38
- __export(Plugin_exports, {
39
- default: () => Plugin_default
40
- });
41
- module.exports = __toCommonJS(Plugin_exports);
42
- var import_plugin_workflow = __toESM(require("@nocobase/plugin-workflow"));
43
- var import_server = require("@nocobase/server");
44
- var import_AggregateInstruction = __toESM(require("./AggregateInstruction"));
45
- class Plugin_default extends import_server.Plugin {
46
- async load() {
47
- const workflowPlugin = this.app.getPlugin(import_plugin_workflow.default);
48
- workflowPlugin.registerInstruction("aggregate", import_AggregateInstruction.default);
49
- }
50
- }
@@ -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"));