@aeriajs/builtins 0.0.63 → 0.0.65

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 (37) hide show
  1. package/dist/collections/file/description.js +2 -2
  2. package/dist/collections/file/description.mjs +1 -1
  3. package/dist/collections/file/download.js +2 -2
  4. package/dist/collections/file/download.mjs +1 -1
  5. package/dist/collections/file/index.d.ts +2 -2
  6. package/dist/collections/file/index.js +4 -4
  7. package/dist/collections/file/index.mjs +1 -1
  8. package/dist/collections/file/insert.js +2 -2
  9. package/dist/collections/file/insert.mjs +1 -1
  10. package/dist/collections/file/remove.js +2 -2
  11. package/dist/collections/file/remove.mjs +1 -1
  12. package/dist/collections/file/removeAll.js +2 -2
  13. package/dist/collections/file/removeAll.mjs +1 -1
  14. package/dist/collections/log/index.d.ts +6 -6
  15. package/dist/collections/log/index.js +5 -5
  16. package/dist/collections/log/index.mjs +1 -1
  17. package/dist/collections/resourceUsage/index.js +2 -2
  18. package/dist/collections/resourceUsage/index.mjs +1 -1
  19. package/dist/collections/user/activate.js +2 -2
  20. package/dist/collections/user/activate.mjs +1 -1
  21. package/dist/collections/user/authenticate.d.ts +4 -6
  22. package/dist/collections/user/authenticate.js +10 -6
  23. package/dist/collections/user/authenticate.mjs +5 -3
  24. package/dist/collections/user/description.js +2 -2
  25. package/dist/collections/user/description.mjs +1 -1
  26. package/dist/collections/user/getInfo.js +2 -2
  27. package/dist/collections/user/getInfo.mjs +1 -1
  28. package/dist/collections/user/index.d.ts +8 -12
  29. package/dist/collections/user/index.js +7 -7
  30. package/dist/collections/user/index.mjs +1 -1
  31. package/dist/collections/user/insert.js +2 -2
  32. package/dist/collections/user/insert.mjs +1 -1
  33. package/dist/functions/describe.d.ts +1 -4
  34. package/dist/functions/describe.js +4 -4
  35. package/dist/functions/describe.mjs +1 -1
  36. package/dist/index.d.ts +16 -20
  37. package/package.json +13 -13
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.description = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const entrypoint_1 = require("@aeriajs/entrypoint");
6
6
  const link = async (_id) => {
7
7
  const config = await (0, entrypoint_1.getConfig)();
@@ -10,7 +10,7 @@ const link = async (_id) => {
10
10
  const timestamp = (lastModified) => lastModified
11
11
  ? new Date(lastModified).getTime()
12
12
  : 'fresh';
13
- exports.description = (0, api_1.defineDescription)({
13
+ exports.description = (0, core_1.defineDescription)({
14
14
  $id: 'file',
15
15
  owned: 'always',
16
16
  presets: ['owned'],
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineDescription } from "@aeriajs/api";
2
+ import { defineDescription } from "@aeriajs/core";
3
3
  import { getConfig } from "@aeriajs/entrypoint";
4
4
  const link = async (_id) => {
5
5
  const config = await getConfig();
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.download = exports.FileReadError = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  var FileReadError;
@@ -15,7 +15,7 @@ var FileReadError;
15
15
  const download = async (payload, context) => {
16
16
  const { fileId, options = [] } = payload;
17
17
  const file = await context.collection.model.findOne({
18
- _id: new api_1.ObjectId(fileId),
18
+ _id: new core_1.ObjectId(fileId),
19
19
  }, {
20
20
  projection: {
21
21
  absolute_path: 1,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { ObjectId } from "@aeriajs/api";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left } from "@aeriajs/common";
4
4
  import fs from "fs";
5
5
  export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
@@ -142,7 +142,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
142
142
  };
143
143
  };
144
144
  functions: {
145
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
145
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
146
146
  readonly insert: (payload: {
147
147
  what: {
148
148
  content: string;
@@ -601,7 +601,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
601
601
  };
602
602
  };
603
603
  functions: {
604
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
604
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
605
605
  readonly insert: (payload: {
606
606
  what: {
607
607
  content: string;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.file = exports.tempFile = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const description_js_1 = require("./description.js");
6
6
  const insert_js_1 = require("./insert.js");
7
7
  const download_js_1 = require("./download.js");
8
8
  const remove_js_1 = require("./remove.js");
9
9
  const removeAll_js_1 = require("./removeAll.js");
10
- exports.tempFile = (0, api_1.defineCollection)({
10
+ exports.tempFile = (0, core_1.defineCollection)({
11
11
  description: {
12
12
  $id: 'tempFile',
13
13
  temporary: {
@@ -37,10 +37,10 @@ exports.tempFile = (0, api_1.defineCollection)({
37
37
  },
38
38
  },
39
39
  });
40
- exports.file = (0, api_1.defineCollection)({
40
+ exports.file = (0, core_1.defineCollection)({
41
41
  description: description_js_1.description,
42
42
  functions: {
43
- get: api_1.get,
43
+ get: core_1.get,
44
44
  insert: insert_js_1.insert,
45
45
  download: download_js_1.download,
46
46
  remove: remove_js_1.remove,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection, get } from "@aeriajs/api";
2
+ import { defineCollection, get } from "@aeriajs/core";
3
3
  import { description } from "./description.mjs";
4
4
  import { insert } from "./insert.mjs";
5
5
  import { download } from "./download.mjs";
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.insert = void 0;
4
4
  const crypto_1 = require("crypto");
5
5
  const promises_1 = require("fs/promises");
6
- const api_1 = require("@aeriajs/api");
6
+ const core_1 = require("@aeriajs/core");
7
7
  const insert = async (payload, context) => {
8
8
  if (!context.token.authenticated) {
9
9
  throw new Error('');
@@ -36,7 +36,7 @@ const insert = async (payload, context) => {
36
36
  .digest('hex');
37
37
  what.absolute_path = `${tempPath}/${filenameHash}.${extension}`;
38
38
  await (0, promises_1.writeFile)(what.absolute_path, Buffer.from(what.content.split(',').pop(), 'base64'));
39
- return (0, api_1.insert)({
39
+ return (0, core_1.insert)({
40
40
  ...payload,
41
41
  what,
42
42
  }, context);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  import { createHash } from "crypto";
3
3
  import { writeFile, unlink } from "fs/promises";
4
- import { insert as originalInsert } from "@aeriajs/api";
4
+ import { insert as originalInsert } from "@aeriajs/core";
5
5
  export const insert = async (payload, context) => {
6
6
  if (!context.token.authenticated) {
7
7
  throw new Error("");
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.remove = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const promises_1 = __importDefault(require("fs/promises"));
9
9
  const remove = async (payload, context) => {
10
10
  const file = await context.collection.model.findOne({
@@ -23,6 +23,6 @@ const remove = async (payload, context) => {
23
23
  catch (err) {
24
24
  console.trace(err);
25
25
  }
26
- return (0, api_1.remove)(payload, context);
26
+ return (0, core_1.remove)(payload, context);
27
27
  };
28
28
  exports.remove = remove;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { remove as originalRemove } from "@aeriajs/api";
2
+ import { remove as originalRemove } from "@aeriajs/core";
3
3
  import fs from "fs/promises";
4
4
  export const remove = async (payload, context) => {
5
5
  const file = await context.collection.model.findOne({
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.removeAll = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const promises_1 = __importDefault(require("fs/promises"));
9
9
  const removeAll = async (payload, context) => {
10
10
  const files = context.collection.model.find({
@@ -25,6 +25,6 @@ const removeAll = async (payload, context) => {
25
25
  console.trace(err);
26
26
  }
27
27
  }
28
- return (0, api_1.removeAll)(payload, context);
28
+ return (0, core_1.removeAll)(payload, context);
29
29
  };
30
30
  exports.removeAll = removeAll;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { removeAll as originalRemoveAll } from "@aeriajs/api";
2
+ import { removeAll as originalRemoveAll } from "@aeriajs/core";
3
3
  import fs from "fs/promises";
4
4
  export const removeAll = async (payload, context) => {
5
5
  const files = context.collection.model.find({
@@ -27,9 +27,9 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
27
27
  readonly filters: readonly ["context", "message", "owner"];
28
28
  };
29
29
  functions: {
30
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
31
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
32
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
30
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
31
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
32
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
33
33
  };
34
34
  }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
35
35
  item: import("@aeriajs/types").SchemaWithId<{
@@ -87,9 +87,9 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
87
87
  readonly filters: readonly ["context", "message", "owner"];
88
88
  };
89
89
  functions: {
90
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
91
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
92
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
90
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
91
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
92
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
93
93
  };
94
94
  functionContracts: {
95
95
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.log = void 0;
4
- const api_1 = require("@aeriajs/api");
5
- exports.log = (0, api_1.defineCollection)({
4
+ const core_1 = require("@aeriajs/core");
5
+ exports.log = (0, core_1.defineCollection)({
6
6
  description: {
7
7
  $id: 'log',
8
8
  required: [
@@ -39,8 +39,8 @@ exports.log = (0, api_1.defineCollection)({
39
39
  ],
40
40
  },
41
41
  functions: {
42
- get: api_1.get,
43
- getAll: api_1.getAll,
44
- insert: api_1.insert,
42
+ get: core_1.get,
43
+ getAll: core_1.getAll,
44
+ insert: core_1.insert,
45
45
  },
46
46
  });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection, get, getAll, insert } from "@aeriajs/api";
2
+ import { defineCollection, get, getAll, insert } from "@aeriajs/core";
3
3
  export const log = defineCollection({
4
4
  description: {
5
5
  $id: "log",
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resourceUsage = void 0;
4
- const api_1 = require("@aeriajs/api");
5
- exports.resourceUsage = (0, api_1.defineCollection)({
4
+ const core_1 = require("@aeriajs/core");
5
+ exports.resourceUsage = (0, core_1.defineCollection)({
6
6
  description: {
7
7
  $id: 'resourceUsage',
8
8
  required: ['usage'],
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection } from "@aeriajs/api";
2
+ import { defineCollection } from "@aeriajs/core";
3
3
  export const resourceUsage = defineCollection({
4
4
  description: {
5
5
  $id: "resourceUsage",
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.activate = exports.ActivationErrors = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const bcrypt_1 = __importDefault(require("bcrypt"));
10
10
  var ActivationErrors;
@@ -19,7 +19,7 @@ const activate = async (payload, context) => {
19
19
  return (0, common_1.left)(ActivationErrors.InvalidLink);
20
20
  }
21
21
  const user = await context.collection.model.findOne({
22
- _id: new api_1.ObjectId(userId),
22
+ _id: new core_1.ObjectId(userId),
23
23
  }, {
24
24
  projection: {
25
25
  password: 1,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { ObjectId } from "@aeriajs/api";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left, right } from "@aeriajs/common";
4
4
  import bcrypt from "bcrypt";
5
5
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
@@ -1,20 +1,18 @@
1
- import type { Context, SchemaWithId } from '@aeriajs/types';
1
+ import type { Context, SchemaWithId, TokenRecipient } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
- import type { ObjectId } from '@aeriajs/api';
3
+ import type { ObjectId } from '@aeriajs/core';
4
4
  type Props = {
5
5
  email: string;
6
6
  password: string;
7
7
  } | {
8
+ token?: TokenRecipient;
8
9
  revalidate: true;
9
10
  };
10
11
  type Return = {
11
12
  user: Pick<SchemaWithId<typeof description>, 'name' | 'email' | 'roles' | 'active'> & {
12
13
  _id: ObjectId | null;
13
14
  };
14
- token: {
15
- type: 'bearer';
16
- content: string;
17
- };
15
+ token: TokenRecipient;
18
16
  };
19
17
  export declare enum AuthenticationErrors {
20
18
  Unauthenticated = "UNAUTHENTICATED",
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authenticate = exports.getDefaultUser = exports.AuthenticationErrors = void 0;
4
4
  const bcrypt_1 = require("bcrypt");
5
- const api_1 = require("@aeriajs/api");
5
+ const core_1 = require("@aeriajs/core");
6
6
  const common_1 = require("@aeriajs/common");
7
7
  var AuthenticationErrors;
8
8
  (function (AuthenticationErrors) {
@@ -49,7 +49,7 @@ const getUser = async (userId, context) => {
49
49
  }, {});
50
50
  tokenContent.userinfo = pick(leanUser, context.config.tokenUserProperties);
51
51
  }
52
- const token = await (0, api_1.signToken)(tokenContent);
52
+ const token = await (0, core_1.signToken)(tokenContent);
53
53
  return {
54
54
  user: leanUser,
55
55
  token: {
@@ -59,7 +59,7 @@ const getUser = async (userId, context) => {
59
59
  };
60
60
  };
61
61
  const getDefaultUser = async () => {
62
- const token = await (0, api_1.signToken)({
62
+ const token = await (0, core_1.signToken)({
63
63
  _id: null,
64
64
  roles: ['root'],
65
65
  userinfo: {},
@@ -81,11 +81,15 @@ const getDefaultUser = async () => {
81
81
  exports.getDefaultUser = getDefaultUser;
82
82
  const authenticate = async (props, context) => {
83
83
  if ('revalidate' in props) {
84
- if (!context.token.authenticated) {
84
+ const { token } = props;
85
+ if (!token && !context.token.authenticated) {
85
86
  return (0, common_1.left)(AuthenticationErrors.Unauthenticated);
86
87
  }
87
- return (0, common_1.right)(context.token.sub
88
- ? await getUser(context.token.sub, context)
88
+ const decodedToken = token
89
+ ? await (0, core_1.decodeToken)(token.content)
90
+ : context.token;
91
+ return (0, common_1.right)(decodedToken.sub
92
+ ? await getUser(decodedToken.sub, context)
89
93
  : await (0, exports.getDefaultUser)());
90
94
  }
91
95
  if (typeof props.email !== 'string') {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  import { compare as bcryptCompare } from "bcrypt";
3
- import { signToken } from "@aeriajs/api";
3
+ import { signToken, decodeToken } from "@aeriajs/core";
4
4
  import { left, right } from "@aeriajs/common";
5
5
  export var AuthenticationErrors = /* @__PURE__ */ ((AuthenticationErrors2) => {
6
6
  AuthenticationErrors2["Unauthenticated"] = "UNAUTHENTICATED";
@@ -77,10 +77,12 @@ export const getDefaultUser = async () => {
77
77
  };
78
78
  export const authenticate = async (props, context) => {
79
79
  if ("revalidate" in props) {
80
- if (!context.token.authenticated) {
80
+ const { token } = props;
81
+ if (!token && !context.token.authenticated) {
81
82
  return left("UNAUTHENTICATED" /* Unauthenticated */);
82
83
  }
83
- return right(context.token.sub ? await getUser(context.token.sub, context) : await getDefaultUser());
84
+ const decodedToken = token ? await decodeToken(token.content) : context.token;
85
+ return right(decodedToken.sub ? await getUser(decodedToken.sub, context) : await getDefaultUser());
84
86
  }
85
87
  if (typeof props.email !== "string") {
86
88
  return left("INVALID_CREDENTIALS" /* InvalidCredentials */);
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.description = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  /**
6
6
  * This description complies with JWT claims specified in RFC-7519.
7
7
  * Reference: https://www.iana.org/assignments/jwt/jwt.xhtml#claims
8
8
  */
9
- exports.description = (0, api_1.defineDescription)({
9
+ exports.description = (0, core_1.defineDescription)({
10
10
  $id: 'user',
11
11
  required: [
12
12
  'name',
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineDescription } from "@aeriajs/api";
2
+ import { defineDescription } from "@aeriajs/core";
3
3
  export const description = defineDescription({
4
4
  $id: "user",
5
5
  required: [
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getInfo = exports.ActivationErrors = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const bcrypt_1 = __importDefault(require("bcrypt"));
10
10
  var ActivationErrors;
@@ -19,7 +19,7 @@ const getInfo = async (payload, context) => {
19
19
  return (0, common_1.left)(ActivationErrors.InvalidLink);
20
20
  }
21
21
  const user = await context.collection.model.findOne({
22
- _id: new api_1.ObjectId(userId),
22
+ _id: new core_1.ObjectId(userId),
23
23
  });
24
24
  if (!user) {
25
25
  return (0, common_1.left)(ActivationErrors.UserNotFound);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { ObjectId } from "@aeriajs/api";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left, right } from "@aeriajs/common";
4
4
  import bcrypt from "bcrypt";
5
5
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
@@ -101,8 +101,8 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
101
101
  };
102
102
  };
103
103
  functions: {
104
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
105
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
104
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
105
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
106
106
  readonly remove: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2) => Promise<any>;
107
107
  readonly upload: <TContext_3 extends import("@aeriajs/types").Context>(_props: unknown, context: TContext_3) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
108
108
  tempId: any;
@@ -415,6 +415,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
415
415
  email: string;
416
416
  password: string;
417
417
  } | {
418
+ token?: import("@aeriajs/types").TokenRecipient | undefined;
418
419
  revalidate: true;
419
420
  }, context: import("@aeriajs/types").Context<{
420
421
  readonly $id: "user";
@@ -620,10 +621,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
620
621
  }>, "name" | "roles" | "email" | "active"> & {
621
622
  _id: any;
622
623
  };
623
- token: {
624
- type: "bearer";
625
- content: string;
626
- };
624
+ token: import("@aeriajs/types").TokenRecipient;
627
625
  } | {
628
626
  user: {
629
627
  _id: null;
@@ -1399,8 +1397,8 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
1399
1397
  };
1400
1398
  };
1401
1399
  functions: {
1402
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1403
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1400
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1401
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1404
1402
  readonly remove: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2) => Promise<any>;
1405
1403
  readonly upload: <TContext_3 extends import("@aeriajs/types").Context>(_props: unknown, context: TContext_3) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
1406
1404
  tempId: any;
@@ -1713,6 +1711,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
1713
1711
  email: string;
1714
1712
  password: string;
1715
1713
  } | {
1714
+ token?: import("@aeriajs/types").TokenRecipient | undefined;
1716
1715
  revalidate: true;
1717
1716
  }, context: import("@aeriajs/types").Context<{
1718
1717
  readonly $id: "user";
@@ -1918,10 +1917,7 @@ export declare const user: Omit<import("@aeriajs/types").Collection<{
1918
1917
  }>, "name" | "roles" | "email" | "active"> & {
1919
1918
  _id: any;
1920
1919
  };
1921
- token: {
1922
- type: "bearer";
1923
- content: string;
1924
- };
1920
+ token: import("@aeriajs/types").TokenRecipient;
1925
1921
  } | {
1926
1922
  user: {
1927
1923
  _id: null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.user = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const description_js_1 = require("./description.js");
6
6
  const authenticate_js_1 = require("./authenticate.js");
7
7
  const activate_js_1 = require("./activate.js");
@@ -9,14 +9,14 @@ const insert_js_1 = require("./insert.js");
9
9
  const createAccount_js_1 = require("./createAccount.js");
10
10
  const getInfo_js_1 = require("./getInfo.js");
11
11
  const getActivationLink_js_1 = require("./getActivationLink.js");
12
- exports.user = (0, api_1.defineCollection)({
12
+ exports.user = (0, core_1.defineCollection)({
13
13
  description: description_js_1.description,
14
14
  functions: {
15
- get: api_1.get,
16
- getAll: api_1.getAll,
17
- remove: api_1.remove,
18
- upload: api_1.upload,
19
- removeFile: api_1.removeFile,
15
+ get: core_1.get,
16
+ getAll: core_1.getAll,
17
+ remove: core_1.remove,
18
+ upload: core_1.upload,
19
+ removeFile: core_1.removeFile,
20
20
  insert: insert_js_1.insert,
21
21
  authenticate: authenticate_js_1.authenticate,
22
22
  activate: activate_js_1.activate,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection, get, getAll, remove, upload, removeFile } from "@aeriajs/api";
2
+ import { defineCollection, get, getAll, remove, upload, removeFile } from "@aeriajs/core";
3
3
  import { description } from "./description.mjs";
4
4
  import { authenticate } from "./authenticate.mjs";
5
5
  import { activate } from "./activate.mjs";
@@ -25,11 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.insert = void 0;
27
27
  const bcrypt = __importStar(require("bcrypt"));
28
- const api_1 = require("@aeriajs/api");
28
+ const core_1 = require("@aeriajs/core");
29
29
  const insert = async (payload, context) => {
30
30
  if (payload.what.password) {
31
31
  payload.what.password = await bcrypt.hash(payload.what.password, 10);
32
32
  }
33
- return api_1.functions.insert(payload, context);
33
+ return core_1.functions.insert(payload, context);
34
34
  };
35
35
  exports.insert = insert;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  import * as bcrypt from "bcrypt";
3
- import { functions } from "@aeriajs/api";
3
+ import { functions } from "@aeriajs/core";
4
4
  export const insert = async (payload, context) => {
5
5
  if (payload.what.password) {
6
6
  payload.what.password = await bcrypt.hash(payload.what.password, 10);
@@ -114,10 +114,7 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
114
114
  }>, "name" | "roles" | "email" | "active"> & {
115
115
  _id: any;
116
116
  };
117
- token: {
118
- type: "bearer";
119
- content: string;
120
- };
117
+ token: import("@aeriajs/types").TokenRecipient;
121
118
  } | {
122
119
  user: {
123
120
  _id: null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describe = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const entrypoint_1 = require("@aeriajs/entrypoint");
6
6
  const common_1 = require("@aeriajs/common");
7
7
  const access_control_1 = require("@aeriajs/access-control");
@@ -14,7 +14,7 @@ const describe = async (contextOrPayload) => {
14
14
  if ('request' in contextOrPayload && props.revalidate) {
15
15
  const authEither = await (0, authenticate_js_1.authenticate)({
16
16
  revalidate: true,
17
- }, await (0, api_1.createContext)({
17
+ }, await (0, core_1.createContext)({
18
18
  collectionName: 'user',
19
19
  parentContext: contextOrPayload,
20
20
  }));
@@ -37,7 +37,7 @@ const describe = async (contextOrPayload) => {
37
37
  ? candidate()
38
38
  : candidate;
39
39
  const { description: rawDescription } = collection;
40
- const description = await (0, api_1.preloadDescription)(rawDescription);
40
+ const description = await (0, core_1.preloadDescription)(rawDescription);
41
41
  descriptions[description.$id] = description;
42
42
  }
43
43
  if (props.roles) {
@@ -52,7 +52,7 @@ const describe = async (contextOrPayload) => {
52
52
  result.roles = Array.from(new Set(userRoles.concat(await (0, access_control_1.getAvailableRoles)())));
53
53
  }
54
54
  if (props.router) {
55
- result.router = await (0, api_1.getEndpoints)();
55
+ result.router = await (0, core_1.getEndpoints)();
56
56
  }
57
57
  if (props.noSerialize || !('response' in contextOrPayload)) {
58
58
  return result;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { createContext, preloadDescription, getEndpoints } from "@aeriajs/api";
2
+ import { createContext, preloadDescription, getEndpoints } from "@aeriajs/core";
3
3
  import { getCollections } from "@aeriajs/entrypoint";
4
4
  import { serialize, isLeft, left, unwrapEither } from "@aeriajs/common";
5
5
  import { getAvailableRoles } from "@aeriajs/access-control";
package/dist/index.d.ts CHANGED
@@ -60,7 +60,7 @@ export declare const collections: {
60
60
  };
61
61
  };
62
62
  functions: {
63
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
63
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
64
64
  readonly insert: (payload: {
65
65
  what: {
66
66
  content: string;
@@ -519,7 +519,7 @@ export declare const collections: {
519
519
  };
520
520
  };
521
521
  functions: {
522
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
522
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
523
523
  readonly insert: (payload: {
524
524
  what: {
525
525
  content: string;
@@ -1004,9 +1004,9 @@ export declare const collections: {
1004
1004
  readonly filters: readonly ["context", "message", "owner"];
1005
1005
  };
1006
1006
  functions: {
1007
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1008
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1009
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
1007
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1008
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1009
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
1010
1010
  };
1011
1011
  }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
1012
1012
  item: import("@aeriajs/types").SchemaWithId<{
@@ -1064,9 +1064,9 @@ export declare const collections: {
1064
1064
  readonly filters: readonly ["context", "message", "owner"];
1065
1065
  };
1066
1066
  functions: {
1067
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1068
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1069
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
1067
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1068
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1069
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
1070
1070
  };
1071
1071
  functionContracts: {
1072
1072
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -1286,8 +1286,8 @@ export declare const collections: {
1286
1286
  };
1287
1287
  };
1288
1288
  functions: {
1289
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1290
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1289
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
1290
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
1291
1291
  readonly remove: <TContext_3 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext_3["description"]>>, context: TContext_3) => Promise<any>;
1292
1292
  readonly upload: <TContext_4 extends import("@aeriajs/types").Context>(_props: unknown, context: TContext_4) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
1293
1293
  tempId: any;
@@ -1600,6 +1600,7 @@ export declare const collections: {
1600
1600
  email: string;
1601
1601
  password: string;
1602
1602
  } | {
1603
+ token?: import("@aeriajs/types").TokenRecipient | undefined;
1603
1604
  revalidate: true;
1604
1605
  }, context: import("@aeriajs/types").Context<{
1605
1606
  readonly $id: "user";
@@ -1805,10 +1806,7 @@ export declare const collections: {
1805
1806
  }>, "name" | "roles" | "email" | "active"> & {
1806
1807
  _id: any;
1807
1808
  };
1808
- token: {
1809
- type: "bearer";
1810
- content: string;
1811
- };
1809
+ token: import("@aeriajs/types").TokenRecipient;
1812
1810
  } | {
1813
1811
  user: {
1814
1812
  _id: null;
@@ -2584,8 +2582,8 @@ export declare const collections: {
2584
2582
  };
2585
2583
  };
2586
2584
  functions: {
2587
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
2588
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
2585
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
2586
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
2589
2587
  readonly remove: <TContext_3 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<TContext_3["description"]>>, context: TContext_3) => Promise<any>;
2590
2588
  readonly upload: <TContext_4 extends import("@aeriajs/types").Context>(_props: unknown, context: TContext_4) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError> | {
2591
2589
  tempId: any;
@@ -2898,6 +2896,7 @@ export declare const collections: {
2898
2896
  email: string;
2899
2897
  password: string;
2900
2898
  } | {
2899
+ token?: import("@aeriajs/types").TokenRecipient | undefined;
2901
2900
  revalidate: true;
2902
2901
  }, context: import("@aeriajs/types").Context<{
2903
2902
  readonly $id: "user";
@@ -3103,10 +3102,7 @@ export declare const collections: {
3103
3102
  }>, "name" | "roles" | "email" | "active"> & {
3104
3103
  _id: any;
3105
3104
  };
3106
- token: {
3107
- type: "bearer";
3108
- content: string;
3109
- };
3105
+ token: import("@aeriajs/types").TokenRecipient;
3110
3106
  } | {
3111
3107
  user: {
3112
3108
  _id: null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
4
4
  "description": "## Installation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -36,22 +36,22 @@
36
36
  "bcrypt": "^5.1.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@aeriajs/access-control": "^0.0.34",
40
- "@aeriajs/api": "^0.0.63",
41
- "@aeriajs/common": "^0.0.34",
42
- "@aeriajs/entrypoint": "^0.0.34",
43
- "@aeriajs/types": "^0.0.31",
44
- "@aeriajs/validation": "^0.0.37",
39
+ "@aeriajs/access-control": "^0.0.36",
40
+ "@aeriajs/core": "^0.0.65",
41
+ "@aeriajs/common": "^0.0.36",
42
+ "@aeriajs/entrypoint": "^0.0.36",
43
+ "@aeriajs/types": "^0.0.33",
44
+ "@aeriajs/validation": "^0.0.39",
45
45
  "@types/bcrypt": "^5.0.2",
46
46
  "mongodb": "^6.5.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@aeriajs/access-control": "^0.0.34",
50
- "@aeriajs/api": "^0.0.63",
51
- "@aeriajs/common": "^0.0.34",
52
- "@aeriajs/entrypoint": "^0.0.34",
53
- "@aeriajs/types": "^0.0.31",
54
- "@aeriajs/validation": "^0.0.37"
49
+ "@aeriajs/access-control": "^0.0.36",
50
+ "@aeriajs/core": "^0.0.65",
51
+ "@aeriajs/common": "^0.0.36",
52
+ "@aeriajs/entrypoint": "^0.0.36",
53
+ "@aeriajs/types": "^0.0.33",
54
+ "@aeriajs/validation": "^0.0.39"
55
55
  },
56
56
  "scripts": {
57
57
  "test": "echo skipping",