@aeriajs/builtins 0.0.76 → 0.0.78

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 (33) hide show
  1. package/dist/collections/file/download.js +3 -2
  2. package/dist/collections/file/download.mjs +3 -3
  3. package/dist/collections/file/index.d.ts +9 -2
  4. package/dist/collections/file/index.js +7 -0
  5. package/dist/collections/file/index.mjs +7 -0
  6. package/dist/collections/file/insert.js +3 -2
  7. package/dist/collections/file/insert.mjs +3 -3
  8. package/dist/collections/file/remove.js +3 -2
  9. package/dist/collections/file/remove.mjs +3 -3
  10. package/dist/collections/file/removeAll.js +3 -2
  11. package/dist/collections/file/removeAll.mjs +3 -3
  12. package/dist/collections/log/index.d.ts +6 -1
  13. package/dist/collections/log/index.js +5 -0
  14. package/dist/collections/log/index.mjs +5 -0
  15. package/dist/collections/resourceUsage/index.d.ts +1 -1
  16. package/dist/collections/user/activate.d.ts +1 -1
  17. package/dist/collections/user/activate.js +3 -2
  18. package/dist/collections/user/activate.mjs +3 -3
  19. package/dist/collections/user/authenticate.js +4 -8
  20. package/dist/collections/user/authenticate.mjs +0 -4
  21. package/dist/collections/user/createAccount.js +3 -3
  22. package/dist/collections/user/createAccount.mjs +2 -3
  23. package/dist/collections/user/getCurrentUser.js +3 -3
  24. package/dist/collections/user/getCurrentUser.mjs +2 -3
  25. package/dist/collections/user/getInfo.js +3 -2
  26. package/dist/collections/user/getInfo.mjs +3 -3
  27. package/dist/collections/user/index.d.ts +14 -3
  28. package/dist/collections/user/index.js +12 -1
  29. package/dist/collections/user/index.mjs +12 -1
  30. package/dist/collections/user/insert.js +0 -3
  31. package/dist/collections/user/insert.mjs +1 -4
  32. package/dist/index.d.ts +30 -7
  33. package/package.json +6 -6
@@ -9,7 +9,7 @@ var FileReadError;
9
9
  FileReadError["DocumentNotFound"] = "DOCUMENT_NOT_FOUND";
10
10
  FileReadError["FileNotFound"] = "FILE_NOT_FOUND";
11
11
  })(FileReadError || (exports.FileReadError = FileReadError = {}));
12
- exports.download = (0, core_1.defineExposedFunction)(async (payload, context) => {
12
+ const download = async (payload, context) => {
13
13
  const { fileId, options = [] } = payload;
14
14
  const file = await context.collection.model.findOne({
15
15
  _id: new core_1.ObjectId(fileId),
@@ -71,4 +71,5 @@ exports.download = (0, core_1.defineExposedFunction)(async (payload, context) =>
71
71
  });
72
72
  }
73
73
  return fs.createReadStream(file.absolute_path);
74
- });
74
+ };
75
+ exports.download = download;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineExposedFunction, ObjectId } from "@aeriajs/core";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left } from "@aeriajs/common";
4
4
  import * as fs from "fs";
5
5
  export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
@@ -7,7 +7,7 @@ export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
7
7
  FileReadError2["FileNotFound"] = "FILE_NOT_FOUND";
8
8
  return FileReadError2;
9
9
  })(FileReadError || {});
10
- export const download = defineExposedFunction(async (payload, context) => {
10
+ export const download = async (payload, context) => {
11
11
  const { fileId, options = [] } = payload;
12
12
  const file = await context.collection.model.findOne({
13
13
  _id: new ObjectId(fileId)
@@ -62,4 +62,4 @@ export const download = defineExposedFunction(async (payload, context) => {
62
62
  });
63
63
  }
64
64
  return fs.createReadStream(file.absolute_path);
65
- });
65
+ };
@@ -28,7 +28,7 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
28
28
  };
29
29
  };
30
30
  };
31
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
31
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
32
32
  item: import("@aeriajs/types").SchemaWithId<{
33
33
  readonly $id: "tempFile";
34
34
  readonly temporary: {
@@ -499,7 +499,14 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
499
499
  };
500
500
  }>) => Promise<any>;
501
501
  };
502
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
502
+ exposedFunctions: {
503
+ readonly get: "unauthenticated";
504
+ readonly insert: true;
505
+ readonly download: "unauthenticated";
506
+ readonly remove: true;
507
+ readonly removeAll: true;
508
+ };
509
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
503
510
  item: import("@aeriajs/types").SchemaWithId<{
504
511
  readonly $id: "file";
505
512
  readonly owned: "always";
@@ -46,4 +46,11 @@ exports.file = (0, core_1.defineCollection)({
46
46
  remove: remove_js_1.remove,
47
47
  removeAll: removeAll_js_1.removeAll,
48
48
  },
49
+ exposedFunctions: {
50
+ get: 'unauthenticated',
51
+ insert: true,
52
+ download: 'unauthenticated',
53
+ remove: true,
54
+ removeAll: true,
55
+ },
49
56
  });
@@ -43,5 +43,12 @@ export const file = defineCollection({
43
43
  download,
44
44
  remove,
45
45
  removeAll
46
+ },
47
+ exposedFunctions: {
48
+ get: "unauthenticated",
49
+ insert: true,
50
+ download: "unauthenticated",
51
+ remove: true,
52
+ removeAll: true
46
53
  }
47
54
  });
@@ -4,7 +4,7 @@ exports.insert = void 0;
4
4
  const crypto_1 = require("crypto");
5
5
  const promises_1 = require("fs/promises");
6
6
  const core_1 = require("@aeriajs/core");
7
- exports.insert = (0, core_1.defineExposedFunction)(async (payload, context) => {
7
+ const insert = async (payload, context) => {
8
8
  if (!context.token.authenticated) {
9
9
  throw new Error('');
10
10
  }
@@ -40,4 +40,5 @@ exports.insert = (0, core_1.defineExposedFunction)(async (payload, context) => {
40
40
  ...payload,
41
41
  what,
42
42
  }, context);
43
- });
43
+ };
44
+ exports.insert = insert;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  import { createHash } from "crypto";
3
3
  import { writeFile, unlink } from "fs/promises";
4
- import { defineExposedFunction, insert as originalInsert } from "@aeriajs/core";
5
- export const insert = defineExposedFunction(async (payload, context) => {
4
+ import { insert as originalInsert } from "@aeriajs/core";
5
+ export const insert = async (payload, context) => {
6
6
  if (!context.token.authenticated) {
7
7
  throw new Error("");
8
8
  }
@@ -39,4 +39,4 @@ export const insert = defineExposedFunction(async (payload, context) => {
39
39
  ...payload,
40
40
  what
41
41
  }, context);
42
- });
42
+ };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.remove = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
5
  const fs = require("fs/promises");
6
- exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
6
+ const remove = async (payload, context) => {
7
7
  const file = await context.collection.model.findOne({
8
8
  _id: payload.filters._id,
9
9
  }, {
@@ -21,4 +21,5 @@ exports.remove = (0, core_1.defineExposedFunction)(async (payload, context) => {
21
21
  console.trace(err);
22
22
  }
23
23
  return (0, core_1.remove)(payload, context);
24
- });
24
+ };
25
+ exports.remove = remove;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- import { defineExposedFunction, remove as originalRemove } from "@aeriajs/core";
2
+ import { remove as originalRemove } from "@aeriajs/core";
3
3
  import * as fs from "fs/promises";
4
- export const remove = defineExposedFunction(async (payload, context) => {
4
+ export const remove = async (payload, context) => {
5
5
  const file = await context.collection.model.findOne({
6
6
  _id: payload.filters._id
7
7
  }, {
@@ -18,4 +18,4 @@ export const remove = defineExposedFunction(async (payload, context) => {
18
18
  console.trace(err);
19
19
  }
20
20
  return originalRemove(payload, context);
21
- });
21
+ };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeAll = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
5
  const fs = require("fs/promises");
6
- exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) => {
6
+ const removeAll = async (payload, context) => {
7
7
  const files = context.collection.model.find({
8
8
  _id: {
9
9
  $in: payload.filters,
@@ -23,4 +23,5 @@ exports.removeAll = (0, core_1.defineExposedFunction)(async (payload, context) =
23
23
  }
24
24
  }
25
25
  return (0, core_1.remove)(payload, context);
26
- });
26
+ };
27
+ exports.removeAll = removeAll;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- import { defineExposedFunction, remove as originalRemoveAll } from "@aeriajs/core";
2
+ import { remove as originalRemoveAll } from "@aeriajs/core";
3
3
  import * as fs from "fs/promises";
4
- export const removeAll = defineExposedFunction(async (payload, context) => {
4
+ export const removeAll = async (payload, context) => {
5
5
  const files = context.collection.model.find({
6
6
  _id: {
7
7
  $in: payload.filters
@@ -20,4 +20,4 @@ export const removeAll = defineExposedFunction(async (payload, context) => {
20
20
  }
21
21
  }
22
22
  return originalRemoveAll(payload, context);
23
- });
23
+ };
@@ -31,7 +31,12 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
31
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
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
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
34
+ exposedFunctions: {
35
+ readonly get: true;
36
+ readonly getAll: true;
37
+ readonly insert: true;
38
+ };
39
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
35
40
  item: import("@aeriajs/types").SchemaWithId<{
36
41
  readonly $id: "log";
37
42
  readonly required: readonly ["context", "message"];
@@ -43,4 +43,9 @@ exports.log = (0, core_1.defineCollection)({
43
43
  getAll: core_1.getAll,
44
44
  insert: core_1.insert,
45
45
  },
46
+ exposedFunctions: {
47
+ get: true,
48
+ getAll: true,
49
+ insert: true,
50
+ },
46
51
  });
@@ -40,5 +40,10 @@ export const log = defineCollection({
40
40
  get,
41
41
  getAll,
42
42
  insert
43
+ },
44
+ exposedFunctions: {
45
+ get: true,
46
+ getAll: true,
47
+ insert: true
43
48
  }
44
49
  });
@@ -33,7 +33,7 @@ export declare const resourceUsage: Omit<import("@aeriajs/types").Collection<{
33
33
  };
34
34
  };
35
35
  };
36
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
36
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
37
37
  item: import("@aeriajs/types").SchemaWithId<{
38
38
  readonly $id: "resourceUsage";
39
39
  readonly required: readonly ["usage"];
@@ -7,4 +7,4 @@ export declare enum ActivationErrors {
7
7
  }
8
8
  export declare const activate: (payload: {
9
9
  password: string;
10
- }, context: Context<typeof description>) => Promise<import("@aeriajs/types").Left<ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Right<true>>;
10
+ }, context: Context<typeof description>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
@@ -10,7 +10,7 @@ var ActivationErrors;
10
10
  ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
11
11
  ActivationErrors["InvalidLink"] = "INVALID_LINK";
12
12
  })(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
13
- exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) => {
13
+ const activate = async (payload, context) => {
14
14
  const { u: userId, t: token, } = context.request.query;
15
15
  if (!userId || !token) {
16
16
  return (0, common_1.left)(ActivationErrors.InvalidLink);
@@ -58,4 +58,5 @@ exports.activate = (0, core_1.defineExposedFunction)(async (payload, context) =>
58
58
  return context.response.writeHead(302, {
59
59
  location: '/user/activation',
60
60
  });
61
- });
61
+ };
62
+ exports.activate = activate;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineExposedFunction, ObjectId } from "@aeriajs/core";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left, right } from "@aeriajs/common";
4
4
  import * as bcrypt from "bcrypt";
5
5
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
@@ -8,7 +8,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
8
8
  ActivationErrors2["InvalidLink"] = "INVALID_LINK";
9
9
  return ActivationErrors2;
10
10
  })(ActivationErrors || {});
11
- export const activate = defineExposedFunction(async (payload, context) => {
11
+ export const activate = async (payload, context) => {
12
12
  const {
13
13
  u: userId,
14
14
  t: token
@@ -65,4 +65,4 @@ export const activate = defineExposedFunction(async (payload, context) => {
65
65
  return context.response.writeHead(302, {
66
66
  location: "/user/activation"
67
67
  });
68
- });
68
+ };
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authenticate = exports.getDefaultUser = exports.AuthenticationErrors = void 0;
4
- const core_1 = require("@aeriajs/core");
5
4
  const bcrypt_1 = require("bcrypt");
6
- const core_2 = require("@aeriajs/core");
5
+ const core_1 = require("@aeriajs/core");
7
6
  const common_1 = require("@aeriajs/common");
8
7
  var AuthenticationErrors;
9
8
  (function (AuthenticationErrors) {
@@ -48,7 +47,7 @@ const getUser = async (userId, context) => {
48
47
  }, {});
49
48
  tokenContent.userinfo = pick(leanUser, context.config.tokenUserProperties);
50
49
  }
51
- const token = await (0, core_2.signToken)(tokenContent);
50
+ const token = await (0, core_1.signToken)(tokenContent);
52
51
  return {
53
52
  user: leanUser,
54
53
  token: {
@@ -58,7 +57,7 @@ const getUser = async (userId, context) => {
58
57
  };
59
58
  };
60
59
  const getDefaultUser = async () => {
61
- const token = await (0, core_2.signToken)({
60
+ const token = await (0, core_1.signToken)({
62
61
  _id: null,
63
62
  roles: ['root'],
64
63
  userinfo: {},
@@ -85,7 +84,7 @@ const authenticate = async (props, context) => {
85
84
  return (0, common_1.left)(AuthenticationErrors.Unauthenticated);
86
85
  }
87
86
  const decodedToken = token
88
- ? await (0, core_2.decodeToken)(token.content)
87
+ ? await (0, core_1.decodeToken)(token.content)
89
88
  : context.token;
90
89
  return (0, common_1.right)(decodedToken.sub
91
90
  ? await getUser(decodedToken.sub, context)
@@ -117,6 +116,3 @@ const authenticate = async (props, context) => {
117
116
  return (0, common_1.right)(await getUser(user._id, context));
118
117
  };
119
118
  exports.authenticate = authenticate;
120
- (0, core_1.defineFunctionAttributes)(exports.authenticate, {
121
- exposed: true,
122
- });
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- import { defineFunctionAttributes } from "@aeriajs/core";
3
2
  import { compare as bcryptCompare } from "bcrypt";
4
3
  import { signToken, decodeToken } from "@aeriajs/core";
5
4
  import { left, right } from "@aeriajs/common";
@@ -111,6 +110,3 @@ export const authenticate = async (props, context) => {
111
110
  }
112
111
  return right(await getUser(user._id, context));
113
112
  };
114
- defineFunctionAttributes(authenticate, {
115
- exposed: true
116
- });
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAccount = void 0;
4
- const core_1 = require("@aeriajs/core");
5
4
  const common_1 = require("@aeriajs/common");
6
5
  const validation_1 = require("@aeriajs/validation");
7
6
  const bcrypt = require("bcrypt");
8
- exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, context) => {
7
+ const createAccount = async (payload, context) => {
9
8
  const user = Object.assign({}, payload);
10
9
  if (!context.config.security.allowSignup) {
11
10
  throw new Error('signup disallowed');
@@ -60,4 +59,5 @@ exports.createAccount = (0, core_1.defineExposedFunction)(async (payload, contex
60
59
  throw new Error();
61
60
  }
62
61
  return (0, common_1.right)(newUser);
63
- });
62
+ };
63
+ exports.createAccount = createAccount;
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
- import { defineExposedFunction } from "@aeriajs/core";
3
2
  import { isLeft, unwrapEither, left, right } from "@aeriajs/common";
4
3
  import { validate } from "@aeriajs/validation";
5
4
  import * as bcrypt from "bcrypt";
6
- export const createAccount = defineExposedFunction(async (payload, context) => {
5
+ export const createAccount = async (payload, context) => {
7
6
  const user = Object.assign({}, payload);
8
7
  if (!context.config.security.allowSignup) {
9
8
  throw new Error("signup disallowed");
@@ -58,4 +57,4 @@ export const createAccount = defineExposedFunction(async (payload, context) => {
58
57
  throw new Error();
59
58
  }
60
59
  return right(newUser);
61
- });
60
+ };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCurrentUser = exports.ActivationErrors = void 0;
4
- const core_1 = require("@aeriajs/core");
5
4
  const common_1 = require("@aeriajs/common");
6
5
  var ActivationErrors;
7
6
  (function (ActivationErrors) {
@@ -9,7 +8,7 @@ var ActivationErrors;
9
8
  ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
10
9
  ActivationErrors["InvalidLink"] = "INVALID_LINK";
11
10
  })(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
12
- exports.getCurrentUser = (0, core_1.defineExposedFunction)(async (_payload, context) => {
11
+ const getCurrentUser = async (_payload, context) => {
13
12
  if (!context.token.authenticated) {
14
13
  return (0, common_1.left)({});
15
14
  }
@@ -23,4 +22,5 @@ exports.getCurrentUser = (0, core_1.defineExposedFunction)(async (_payload, cont
23
22
  }
24
23
  const nonNullableUser = user;
25
24
  return (0, common_1.right)(nonNullableUser);
26
- });
25
+ };
26
+ exports.getCurrentUser = getCurrentUser;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- import { defineExposedFunction } from "@aeriajs/core";
3
2
  import { left, right } from "@aeriajs/common";
4
3
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
5
4
  ActivationErrors2["UserNotFound"] = "USER_NOT_FOUND";
@@ -7,7 +6,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
7
6
  ActivationErrors2["InvalidLink"] = "INVALID_LINK";
8
7
  return ActivationErrors2;
9
8
  })(ActivationErrors || {});
10
- export const getCurrentUser = defineExposedFunction(async (_payload, context) => {
9
+ export const getCurrentUser = async (_payload, context) => {
11
10
  if (!context.token.authenticated) {
12
11
  return left({});
13
12
  }
@@ -21,4 +20,4 @@ export const getCurrentUser = defineExposedFunction(async (_payload, context) =>
21
20
  }
22
21
  const nonNullableUser = user;
23
22
  return right(nonNullableUser);
24
- });
23
+ };
@@ -10,7 +10,7 @@ var ActivationErrors;
10
10
  ActivationErrors["AlreadyActiveUser"] = "ALREADY_ACTIVE_USER";
11
11
  ActivationErrors["InvalidLink"] = "INVALID_LINK";
12
12
  })(ActivationErrors || (exports.ActivationErrors = ActivationErrors = {}));
13
- exports.getInfo = (0, core_1.defineExposedFunction)(async (payload, context) => {
13
+ const getInfo = async (payload, context) => {
14
14
  const { userId, token, } = payload;
15
15
  if (!userId || !token) {
16
16
  return (0, common_1.left)(ActivationErrors.InvalidLink);
@@ -32,4 +32,5 @@ exports.getInfo = (0, core_1.defineExposedFunction)(async (payload, context) =>
32
32
  name: user.name,
33
33
  email: user.email,
34
34
  });
35
- });
35
+ };
36
+ exports.getInfo = getInfo;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineExposedFunction, ObjectId } from "@aeriajs/core";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left, right } from "@aeriajs/common";
4
4
  import * as bcrypt from "bcrypt";
5
5
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
@@ -8,7 +8,7 @@ export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
8
8
  ActivationErrors2["InvalidLink"] = "INVALID_LINK";
9
9
  return ActivationErrors2;
10
10
  })(ActivationErrors || {});
11
- export const getInfo = defineExposedFunction(async (payload, context) => {
11
+ export const getInfo = async (payload, context) => {
12
12
  const {
13
13
  userId,
14
14
  token
@@ -33,4 +33,4 @@ export const getInfo = defineExposedFunction(async (payload, context) => {
33
33
  name: user.name,
34
34
  email: user.email
35
35
  });
36
- });
36
+ };
@@ -730,7 +730,7 @@ export declare const user: {
730
730
  };
731
731
  };
732
732
  };
733
- }>) => Promise<import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Right<true>>;
733
+ }>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
734
734
  readonly createAccount: (payload: Omit<Pick<{
735
735
  picture_file: import("@aeriajs/types").SchemaWithId<{
736
736
  readonly $id: "file";
@@ -1395,7 +1395,18 @@ export declare const user: {
1395
1395
  };
1396
1396
  };
1397
1397
  exposedFunctions: {
1398
- readonly authenticate: true;
1398
+ readonly get: true;
1399
+ readonly getAll: true;
1400
+ readonly remove: true;
1401
+ readonly upload: true;
1402
+ readonly removeFile: true;
1403
+ readonly insert: true;
1404
+ readonly authenticate: "unauthenticated";
1405
+ readonly activate: "unauthenticated-only";
1406
+ readonly createAccount: "unauthenticated-only";
1407
+ readonly getInfo: "unauthenticated";
1408
+ readonly getCurrentUser: true;
1409
+ readonly getActivationLink: true;
1399
1410
  };
1400
1411
  } & {
1401
1412
  item: import("@aeriajs/types").SchemaWithId<{
@@ -2229,7 +2240,7 @@ export declare const user: {
2229
2240
  };
2230
2241
  };
2231
2242
  };
2232
- }>) => Promise<import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Right<true>>;
2243
+ }>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
2233
2244
  readonly createAccount: (payload: Omit<Pick<{
2234
2245
  picture_file: import("@aeriajs/types").SchemaWithId<{
2235
2246
  readonly $id: "file";
@@ -41,6 +41,17 @@ exports.user = (0, core_1.defineCollection)({
41
41
  },
42
42
  },
43
43
  exposedFunctions: {
44
- authenticate: true,
44
+ get: true,
45
+ getAll: true,
46
+ remove: true,
47
+ upload: true,
48
+ removeFile: true,
49
+ insert: true,
50
+ authenticate: 'unauthenticated',
51
+ activate: 'unauthenticated-only',
52
+ createAccount: 'unauthenticated-only',
53
+ getInfo: 'unauthenticated',
54
+ getCurrentUser: true,
55
+ getActivationLink: true,
45
56
  },
46
57
  });
@@ -39,6 +39,17 @@ export const user = defineCollection({
39
39
  }
40
40
  },
41
41
  exposedFunctions: {
42
- authenticate: true
42
+ get: true,
43
+ getAll: true,
44
+ remove: true,
45
+ upload: true,
46
+ removeFile: true,
47
+ insert: true,
48
+ authenticate: "unauthenticated",
49
+ activate: "unauthenticated-only",
50
+ createAccount: "unauthenticated-only",
51
+ getInfo: "unauthenticated",
52
+ getCurrentUser: true,
53
+ getActivationLink: true
43
54
  }
44
55
  });
@@ -10,6 +10,3 @@ const insert = async (payload, context) => {
10
10
  return (0, core_1.insert)(payload, context);
11
11
  };
12
12
  exports.insert = insert;
13
- (0, core_1.defineFunctionAttributes)(exports.insert, {
14
- exposed: true,
15
- });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineFunctionAttributes, insert as originalInsert } from "@aeriajs/core";
2
+ import { insert as originalInsert } from "@aeriajs/core";
3
3
  import * as bcrypt from "bcrypt";
4
4
  export const insert = async (payload, context) => {
5
5
  if (payload.what.password) {
@@ -7,6 +7,3 @@ export const insert = async (payload, context) => {
7
7
  }
8
8
  return originalInsert(payload, context);
9
9
  };
10
- defineFunctionAttributes(insert, {
11
- exposed: true
12
- });
package/dist/index.d.ts CHANGED
@@ -417,7 +417,14 @@ export declare const collections: {
417
417
  };
418
418
  }>) => Promise<any>;
419
419
  };
420
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
420
+ exposedFunctions: {
421
+ readonly get: "unauthenticated";
422
+ readonly insert: true;
423
+ readonly download: "unauthenticated";
424
+ readonly remove: true;
425
+ readonly removeAll: true;
426
+ };
427
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
421
428
  item: import("@aeriajs/types").SchemaWithId<{
422
429
  readonly $id: "file";
423
430
  readonly owned: "always";
@@ -913,7 +920,7 @@ export declare const collections: {
913
920
  };
914
921
  };
915
922
  };
916
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
923
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
917
924
  item: import("@aeriajs/types").SchemaWithId<{
918
925
  readonly $id: "tempFile";
919
926
  readonly temporary: {
@@ -1008,7 +1015,12 @@ export declare const collections: {
1008
1015
  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
1016
  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
1017
  };
1011
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
1018
+ exposedFunctions: {
1019
+ readonly get: true;
1020
+ readonly getAll: true;
1021
+ readonly insert: true;
1022
+ };
1023
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
1012
1024
  item: import("@aeriajs/types").SchemaWithId<{
1013
1025
  readonly $id: "log";
1014
1026
  readonly required: readonly ["context", "message"];
@@ -1109,7 +1121,7 @@ export declare const collections: {
1109
1121
  };
1110
1122
  };
1111
1123
  };
1112
- }>, "description" | "functions" | "exposedFunctions" | "item" | "security"> & {
1124
+ }>, "description" | "functions" | "item" | "security" | "exposedFunctions"> & {
1113
1125
  item: import("@aeriajs/types").SchemaWithId<{
1114
1126
  readonly $id: "resourceUsage";
1115
1127
  readonly required: readonly ["usage"];
@@ -1915,7 +1927,7 @@ export declare const collections: {
1915
1927
  };
1916
1928
  };
1917
1929
  };
1918
- }>) => Promise<import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Right<true>>;
1930
+ }>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
1919
1931
  readonly createAccount: (payload: Omit<Pick<{
1920
1932
  picture_file: import("@aeriajs/types").SchemaWithId<{
1921
1933
  readonly $id: "file";
@@ -2580,7 +2592,18 @@ export declare const collections: {
2580
2592
  };
2581
2593
  };
2582
2594
  exposedFunctions: {
2583
- readonly authenticate: true;
2595
+ readonly get: true;
2596
+ readonly getAll: true;
2597
+ readonly remove: true;
2598
+ readonly upload: true;
2599
+ readonly removeFile: true;
2600
+ readonly insert: true;
2601
+ readonly authenticate: "unauthenticated";
2602
+ readonly activate: "unauthenticated-only";
2603
+ readonly createAccount: "unauthenticated-only";
2604
+ readonly getInfo: "unauthenticated";
2605
+ readonly getCurrentUser: true;
2606
+ readonly getActivationLink: true;
2584
2607
  };
2585
2608
  } & {
2586
2609
  item: import("@aeriajs/types").SchemaWithId<{
@@ -3414,7 +3437,7 @@ export declare const collections: {
3414
3437
  };
3415
3438
  };
3416
3439
  };
3417
- }>) => Promise<import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Right<true>>;
3440
+ }>) => Promise<import("@aeriajs/types").GenericResponse | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.InvalidLink> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.UserNotFound> | import("@aeriajs/types").Left<import("./collections/user/activate.js").ActivationErrors.AlreadyActiveUser> | import("@aeriajs/types").Right<true>>;
3418
3441
  readonly createAccount: (payload: Omit<Pick<{
3419
3442
  picture_file: import("@aeriajs/types").SchemaWithId<{
3420
3443
  readonly $id: "file";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
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.76",
49
- "@aeriajs/common": "^0.0.43",
50
- "@aeriajs/entrypoint": "^0.0.43",
51
- "@aeriajs/types": "^0.0.40",
52
- "@aeriajs/validation": "^0.0.46"
48
+ "@aeriajs/core": "^0.0.78",
49
+ "@aeriajs/common": "^0.0.45",
50
+ "@aeriajs/entrypoint": "^0.0.45",
51
+ "@aeriajs/types": "^0.0.42",
52
+ "@aeriajs/validation": "^0.0.48"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "echo skipping",