@matvdt/js-toolkit 0.0.1-canary.16 → 0.0.1-canary.17
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.
|
@@ -147,6 +147,10 @@ var payload = {
|
|
|
147
147
|
const payload2 = await getClient();
|
|
148
148
|
return payload2.findGlobal({ slug });
|
|
149
149
|
},
|
|
150
|
+
aggregate: async (collection, pipeline, options) => {
|
|
151
|
+
const payload2 = await getClient();
|
|
152
|
+
return payload2.db.collections[collection].aggregate(pipeline, options);
|
|
153
|
+
},
|
|
150
154
|
raw: getClient
|
|
151
155
|
};
|
|
152
156
|
|
|
@@ -117,6 +117,10 @@ var payload = {
|
|
|
117
117
|
const payload2 = await getClient();
|
|
118
118
|
return payload2.findGlobal({ slug });
|
|
119
119
|
},
|
|
120
|
+
aggregate: async (collection, pipeline, options) => {
|
|
121
|
+
const payload2 = await getClient();
|
|
122
|
+
return payload2.db.collections[collection].aggregate(pipeline, options);
|
|
123
|
+
},
|
|
120
124
|
raw: getClient
|
|
121
125
|
};
|
|
122
126
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CollectionSlug, DataFromCollectionSlug, DataFromGlobalSlug, GlobalSlug, PaginatedDocs, Where } from 'payload';
|
|
2
2
|
import { getPayload } from './get-payload';
|
|
3
|
+
import { PipelineStage, Aggregate, AggregateOptions } from "mongoose";
|
|
3
4
|
export type FindOptions = Omit<Parameters<Awaited<ReturnType<typeof getPayload>>['find']>[0], 'collection'>;
|
|
4
5
|
export type FindByIDOptions = Omit<Parameters<Awaited<ReturnType<typeof getPayload>>['findByID']>[0], 'collection' | 'id'>;
|
|
5
6
|
export type UpdateOptions = Omit<Parameters<Awaited<ReturnType<typeof getPayload>>['update']>[0], 'collection' | 'id' | 'data' | 'where'>;
|
|
@@ -17,5 +18,6 @@ export declare const payload: {
|
|
|
17
18
|
delete: <TSlug extends CollectionSlug>(collection: TSlug, id: string | number, options?: DeleteOptions) => Promise<import("payload").JsonObject & import("payload").TypeWithID>;
|
|
18
19
|
deleteMany: <TSlug extends CollectionSlug>(collection: TSlug, where: Where, options?: DeleteOptions) => Promise<import("payload").BulkOperationResult<TSlug, import("payload").SelectExcludeType | import("payload").SelectIncludeType>>;
|
|
19
20
|
global: <TSlug extends GlobalSlug>(slug: TSlug) => Promise<DataFromGlobalSlug<TSlug>>;
|
|
21
|
+
aggregate: <TSlug extends CollectionSlug, TData = any>(collection: TSlug, pipeline?: PipelineStage[], options?: AggregateOptions) => Promise<Aggregate<TData[]>>;
|
|
20
22
|
raw: () => Promise<import("payload").BasePayload>;
|
|
21
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matvdt/js-toolkit",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.17",
|
|
4
4
|
"description": "JS/TS toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsup && tsc",
|
|
30
30
|
"version:canary": "npm version prerelease --preid=canary",
|
|
31
|
-
"version:alpha"
|
|
32
|
-
"version:beta"
|
|
33
|
-
"version:rc"
|
|
31
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
32
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
33
|
+
"version:rc": "npm version prerelease --preid=rc",
|
|
34
34
|
"version:latest": "npm version patch",
|
|
35
35
|
"publish:canary": "npm publish --access public --tag canary",
|
|
36
|
-
"publish:alpha"
|
|
37
|
-
"publish:beta"
|
|
38
|
-
"publish:rc"
|
|
36
|
+
"publish:alpha": "npm publish --access public --tag alpha",
|
|
37
|
+
"publish:beta": "npm publish --access public --tag beta",
|
|
38
|
+
"publish:rc": "npm publish --access public --tag rc",
|
|
39
39
|
"publish:latest": "npm publish --access public",
|
|
40
40
|
"release:canary": "npm run version:canary && npm run publish:canary",
|
|
41
|
-
"release:alpha"
|
|
42
|
-
"release:beta"
|
|
43
|
-
"release:rc"
|
|
41
|
+
"release:alpha": "npm run version:alpha && npm run publish:alpha",
|
|
42
|
+
"release:beta": "npm run version:beta && npm run publish:beta",
|
|
43
|
+
"release:rc": "npm run version:rc && npm run publish:rc",
|
|
44
44
|
"release:latest": "npm run version:latest && npm run publish:latest",
|
|
45
45
|
"prepublishOnly": "npm run build"
|
|
46
46
|
},
|
|
@@ -54,14 +54,16 @@
|
|
|
54
54
|
"author": "Matteo Vidotto",
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"devDependencies": {
|
|
57
|
+
"@payloadcms/db-mongodb": "^3.88.0",
|
|
57
58
|
"@types/node": "^26.1.2",
|
|
58
59
|
"@types/react": "^19.2.17",
|
|
59
|
-
"payload": "^3.
|
|
60
|
+
"payload": "^3.88.0",
|
|
60
61
|
"react": "^19.2.8",
|
|
61
62
|
"tsup": "^8.5.1",
|
|
62
63
|
"typescript": "^7.0.2"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
66
|
+
"@payloadcms/db-mongodb": ">=3.0.0",
|
|
65
67
|
"payload": ">=3.0.0",
|
|
66
68
|
"react": ">=18.0.0"
|
|
67
69
|
},
|
|
@@ -69,6 +71,9 @@
|
|
|
69
71
|
"payload": {
|
|
70
72
|
"optional": true
|
|
71
73
|
},
|
|
74
|
+
"@payloadcms/db-mongodb": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
72
77
|
"react": {
|
|
73
78
|
"optional": true
|
|
74
79
|
}
|