@aeriajs/builtins 0.0.182 → 0.0.183
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.
|
@@ -250,7 +250,11 @@ export declare const file: Omit<import("@aeriajs/types").Collection<never>, "fun
|
|
|
250
250
|
readonly code: import("@aeriajs/types").ACError.OwnershipError;
|
|
251
251
|
} & {
|
|
252
252
|
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
253
|
-
}
|
|
253
|
+
}> | {
|
|
254
|
+
readonly _tag: "Error";
|
|
255
|
+
readonly error: import("@aeriajs/types").EndpointError<import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.MalformedInput, unknown, import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound>;
|
|
256
|
+
readonly result: undefined;
|
|
257
|
+
}>;
|
|
254
258
|
removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
|
|
255
259
|
readonly _tag: "Result";
|
|
256
260
|
readonly error: undefined;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Context, SchemaWithId, RemovePayload } from '@aeriajs/types';
|
|
2
2
|
import type { description } from './description.js';
|
|
3
|
+
import { Result } from '@aeriajs/types';
|
|
3
4
|
export declare const remove: (payload: RemovePayload<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<{
|
|
4
5
|
readonly _tag: "Result";
|
|
5
6
|
readonly error: undefined;
|
|
6
7
|
readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
|
|
7
|
-
} |
|
|
8
|
+
} | Result.Error<{
|
|
8
9
|
readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
|
|
9
10
|
} & {
|
|
10
11
|
httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
|
|
11
|
-
}> |
|
|
12
|
+
}> | Result.Error<{
|
|
12
13
|
readonly code: import("@aeriajs/types").ACError.OwnershipError;
|
|
13
14
|
} & {
|
|
14
15
|
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
15
|
-
}
|
|
16
|
+
}> | {
|
|
17
|
+
readonly _tag: "Error";
|
|
18
|
+
readonly error: import("@aeriajs/types").EndpointError<import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.MalformedInput, unknown, import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound>;
|
|
19
|
+
readonly result: undefined;
|
|
20
|
+
}>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.remove = void 0;
|
|
4
|
+
const types_1 = require("@aeriajs/types");
|
|
4
5
|
const core_1 = require("@aeriajs/core");
|
|
5
6
|
const fs = require("fs/promises");
|
|
6
7
|
const remove = async (payload, context) => {
|
|
7
|
-
const file = await
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
projection: {
|
|
11
|
-
absolute_path: 1,
|
|
8
|
+
const { error, result: file } = await (0, core_1.get)({
|
|
9
|
+
filters: {
|
|
10
|
+
_id: payload.filters._id,
|
|
12
11
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
project: ['absolute_path'],
|
|
13
|
+
}, context);
|
|
14
|
+
if (error) {
|
|
15
|
+
return types_1.Result.error(error);
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
18
|
await fs.unlink(file.absolute_path);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import {
|
|
2
|
+
import { Result } from "@aeriajs/types";
|
|
3
|
+
import { remove as originalRemove, get } from "@aeriajs/core";
|
|
3
4
|
import * as fs from "fs/promises";
|
|
4
5
|
export const remove = async (payload, context) => {
|
|
5
|
-
const file = await
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw new Error("");
|
|
6
|
+
const { error, result: file } = await get({
|
|
7
|
+
filters: {
|
|
8
|
+
_id: payload.filters._id
|
|
9
|
+
},
|
|
10
|
+
project: ["absolute_path"]
|
|
11
|
+
}, context);
|
|
12
|
+
if (error) {
|
|
13
|
+
return Result.error(error);
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
16
|
await fs.unlink(file.absolute_path);
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,11 @@ export declare const collections: {
|
|
|
194
194
|
readonly code: import("@aeriajs/types").ACError.OwnershipError;
|
|
195
195
|
} & {
|
|
196
196
|
httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
|
|
197
|
-
}
|
|
197
|
+
}> | {
|
|
198
|
+
readonly _tag: "Error";
|
|
199
|
+
readonly error: import("@aeriajs/types").EndpointError<import("@aeriajs/types").ACError.OwnershipError | import("@aeriajs/types").ACError.ResourceNotFound | import("@aeriajs/types").ACError.MalformedInput, unknown, import("@aeriajs/types").HTTPStatus.BadRequest | import("@aeriajs/types").HTTPStatus.Forbidden | import("@aeriajs/types").HTTPStatus.NotFound>;
|
|
200
|
+
readonly result: undefined;
|
|
201
|
+
}>;
|
|
198
202
|
removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
|
|
199
203
|
readonly _tag: "Result";
|
|
200
204
|
readonly error: undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/builtins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.183",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"mongodb": "^6.5.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@aeriajs/core": "^0.0.
|
|
48
|
+
"@aeriajs/core": "^0.0.183",
|
|
49
49
|
"@aeriajs/common": "^0.0.112",
|
|
50
50
|
"@aeriajs/entrypoint": "^0.0.115",
|
|
51
51
|
"@aeriajs/types": "^0.0.95",
|