@aeriajs/builtins 0.0.89 → 0.0.90

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAccount = void 0;
4
+ const types_1 = require("@aeriajs/types");
4
5
  const common_1 = require("@aeriajs/common");
5
6
  const validation_1 = require("@aeriajs/validation");
6
7
  const bcrypt = require("bcrypt");
@@ -38,7 +39,10 @@ const createAccount = async (payload, context) => {
38
39
  ],
39
40
  });
40
41
  if ((0, common_1.isLeft)(validationEither)) {
41
- return validationEither;
42
+ return context.error(types_1.HTTPStatus.BadRequest, {
43
+ code: types_1.ACError.MalformedInput,
44
+ details: (0, common_1.unwrapEither)(validationEither),
45
+ });
42
46
  }
43
47
  if (context.config.security.signupDefaults) {
44
48
  Object.assign(user, context.config.security.signupDefaults);
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
- import { isLeft } from "@aeriajs/common";
2
+ import { HTTPStatus, ACError } from "@aeriajs/types";
3
+ import { isLeft, unwrapEither } from "@aeriajs/common";
3
4
  import { validate } from "@aeriajs/validation";
4
5
  import * as bcrypt from "bcrypt";
5
6
  export const createAccount = async (payload, context) => {
@@ -36,7 +37,10 @@ export const createAccount = async (payload, context) => {
36
37
  ]
37
38
  });
38
39
  if (isLeft(validationEither)) {
39
- return validationEither;
40
+ return context.error(HTTPStatus.BadRequest, {
41
+ code: ACError.MalformedInput,
42
+ details: unwrapEither(validationEither)
43
+ });
40
44
  }
41
45
  if (context.config.security.signupDefaults) {
42
46
  Object.assign(user, context.config.security.signupDefaults);
@@ -103,7 +103,12 @@ export declare const user: {
103
103
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
104
104
  readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
105
105
  readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
106
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
106
+ readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
107
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
108
+ readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
109
+ } & {
110
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
111
+ }> | {
107
112
  tempId: any;
108
113
  }>;
109
114
  readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
@@ -1622,7 +1627,12 @@ export declare const user: {
1622
1627
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
1623
1628
  readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
1624
1629
  readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
1625
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
1630
+ readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
1631
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
1632
+ readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
1633
+ } & {
1634
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1635
+ }> | {
1626
1636
  tempId: any;
1627
1637
  }>;
1628
1638
  readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
package/dist/index.d.ts CHANGED
@@ -1308,7 +1308,12 @@ export declare const collections: {
1308
1308
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
1309
1309
  readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
1310
1310
  readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
1311
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
1311
+ readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
1312
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
1313
+ readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
1314
+ } & {
1315
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1316
+ }> | {
1312
1317
  tempId: any;
1313
1318
  }>;
1314
1319
  readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
@@ -2827,7 +2832,12 @@ export declare const collections: {
2827
2832
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<any>;
2828
2833
  readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<any>[]>;
2829
2834
  readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
2830
- readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
2835
+ readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").EndpointError<{
2836
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
2837
+ readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
2838
+ } & {
2839
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
2840
+ }> | {
2831
2841
  tempId: any;
2832
2842
  }>;
2833
2843
  readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.89",
3
+ "version": "0.0.90",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -45,11 +45,11 @@
45
45
  "mongodb": "^6.5.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "@aeriajs/core": "^0.0.89",
49
- "@aeriajs/common": "^0.0.55",
50
- "@aeriajs/entrypoint": "^0.0.55",
51
- "@aeriajs/types": "^0.0.52",
52
- "@aeriajs/validation": "^0.0.58"
48
+ "@aeriajs/core": "^0.0.90",
49
+ "@aeriajs/common": "^0.0.56",
50
+ "@aeriajs/entrypoint": "^0.0.56",
51
+ "@aeriajs/types": "^0.0.53",
52
+ "@aeriajs/validation": "^0.0.59"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "echo skipping",