@aeriajs/builtins 0.0.75 → 0.0.77

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 (41) hide show
  1. package/dist/collections/file/description.d.ts +2 -2
  2. package/dist/collections/file/description.js +2 -2
  3. package/dist/collections/file/description.mjs +2 -2
  4. package/dist/collections/file/download.js +3 -2
  5. package/dist/collections/file/download.mjs +3 -3
  6. package/dist/collections/file/index.d.ts +36 -36
  7. package/dist/collections/file/insert.d.ts +2 -2
  8. package/dist/collections/file/insert.js +3 -2
  9. package/dist/collections/file/insert.mjs +3 -3
  10. package/dist/collections/file/remove.js +3 -2
  11. package/dist/collections/file/remove.mjs +3 -3
  12. package/dist/collections/file/removeAll.js +3 -2
  13. package/dist/collections/file/removeAll.mjs +3 -3
  14. package/dist/collections/log/index.d.ts +1 -1
  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/description.d.ts +2 -2
  24. package/dist/collections/user/description.js +2 -2
  25. package/dist/collections/user/description.mjs +2 -2
  26. package/dist/collections/user/getCurrentUser.d.ts +107 -0
  27. package/dist/collections/user/getCurrentUser.js +26 -0
  28. package/dist/collections/user/getCurrentUser.mjs +23 -0
  29. package/dist/collections/user/getInfo.js +3 -2
  30. package/dist/collections/user/getInfo.mjs +3 -3
  31. package/dist/collections/user/index.d.ts +486 -69
  32. package/dist/collections/user/index.js +14 -8
  33. package/dist/collections/user/index.mjs +14 -8
  34. package/dist/collections/user/insert.d.ts +2 -2
  35. package/dist/collections/user/insert.js +0 -3
  36. package/dist/collections/user/insert.mjs +1 -4
  37. package/dist/functions/describe.d.ts +2 -2
  38. package/dist/functions/describe.js +1 -2
  39. package/dist/functions/describe.mjs +1 -2
  40. package/dist/index.d.ts +524 -107
  41. package/package.json +6 -8
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.user = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
+ const common_1 = require("@aeriajs/common");
5
6
  const description_js_1 = require("./description.js");
6
7
  const authenticate_js_1 = require("./authenticate.js");
7
8
  const activate_js_1 = require("./activate.js");
8
9
  const insert_js_1 = require("./insert.js");
9
10
  const createAccount_js_1 = require("./createAccount.js");
10
11
  const getInfo_js_1 = require("./getInfo.js");
12
+ const getCurrentUser_js_1 = require("./getCurrentUser.js");
11
13
  const getActivationLink_js_1 = require("./getActivationLink.js");
12
14
  exports.user = (0, core_1.defineCollection)({
13
15
  description: description_js_1.description,
@@ -22,16 +24,20 @@ exports.user = (0, core_1.defineCollection)({
22
24
  activate: activate_js_1.activate,
23
25
  createAccount: createAccount_js_1.createAccount,
24
26
  getInfo: getInfo_js_1.getInfo,
27
+ getCurrentUser: getCurrentUser_js_1.getCurrentUser,
25
28
  getActivationLink: getActivationLink_js_1.getActivationLink,
26
29
  },
27
- accessControl: {
28
- roles: {
29
- root: {
30
- grantEverything: true,
31
- },
32
- guest: {
33
- grant: ['authenticate'],
34
- },
30
+ functionContracts: {
31
+ getCurrentUser: {
32
+ response: [
33
+ (0, common_1.leftSchema)({
34
+ type: 'object',
35
+ variable: true,
36
+ }),
37
+ (0, common_1.rightSchema)({
38
+ $ref: 'user',
39
+ }),
40
+ ],
35
41
  },
36
42
  },
37
43
  });
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  import { defineCollection, get, getAll, remove, upload, removeFile } from "@aeriajs/core";
3
+ import { leftSchema, rightSchema } from "@aeriajs/common";
3
4
  import { description } from "./description.mjs";
4
5
  import { authenticate } from "./authenticate.mjs";
5
6
  import { activate } from "./activate.mjs";
6
7
  import { insert } from "./insert.mjs";
7
8
  import { createAccount } from "./createAccount.mjs";
8
9
  import { getInfo } from "./getInfo.mjs";
10
+ import { getCurrentUser } from "./getCurrentUser.mjs";
9
11
  import { getActivationLink } from "./getActivationLink.mjs";
10
12
  export const user = defineCollection({
11
13
  description,
@@ -20,16 +22,20 @@ export const user = defineCollection({
20
22
  activate,
21
23
  createAccount,
22
24
  getInfo,
25
+ getCurrentUser,
23
26
  getActivationLink
24
27
  },
25
- accessControl: {
26
- roles: {
27
- root: {
28
- grantEverything: true
29
- },
30
- guest: {
31
- grant: ["authenticate"]
32
- }
28
+ functionContracts: {
29
+ getCurrentUser: {
30
+ response: [
31
+ leftSchema({
32
+ type: "object",
33
+ variable: true
34
+ }),
35
+ rightSchema({
36
+ $ref: "user"
37
+ })
38
+ ]
33
39
  }
34
40
  }
35
41
  });
@@ -76,12 +76,12 @@ export declare const insert: (payload: {
76
76
  };
77
77
  readonly individualActions: {
78
78
  readonly 'ui:spawnEdit': {
79
- readonly name: "action.edit";
79
+ readonly label: "action.edit";
80
80
  readonly icon: "pencil";
81
81
  readonly translate: true;
82
82
  };
83
83
  readonly 'route:/dashboard/user/changepass': {
84
- readonly name: "change_password";
84
+ readonly label: "change_password";
85
85
  readonly icon: "key";
86
86
  readonly fetchItem: true;
87
87
  readonly translate: true;
@@ -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
- });
@@ -85,12 +85,12 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
85
85
  };
86
86
  readonly individualActions: {
87
87
  readonly 'ui:spawnEdit': {
88
- readonly name: "action.edit";
88
+ readonly label: "action.edit";
89
89
  readonly icon: "pencil";
90
90
  readonly translate: true;
91
91
  };
92
92
  readonly 'route:/dashboard/user/changepass': {
93
- readonly name: "change_password";
93
+ readonly label: "change_password";
94
94
  readonly icon: "key";
95
95
  readonly fetchItem: true;
96
96
  readonly translate: true;
@@ -4,7 +4,6 @@ exports.describe = void 0;
4
4
  const core_1 = require("@aeriajs/core");
5
5
  const entrypoint_1 = require("@aeriajs/entrypoint");
6
6
  const common_1 = require("@aeriajs/common");
7
- const access_control_1 = require("@aeriajs/access-control");
8
7
  const authenticate_js_1 = require("../collections/user/authenticate.js");
9
8
  const describe = async (contextOrPayload) => {
10
9
  const result = {};
@@ -49,7 +48,7 @@ const describe = async (contextOrPayload) => {
49
48
  const userRoles = 'enum' in userRolesProperty.items
50
49
  ? userRolesProperty.items.enum
51
50
  : [];
52
- result.roles = Array.from(new Set(userRoles.concat(await (0, access_control_1.getAvailableRoles)())));
51
+ result.roles = Array.from(new Set(userRoles.concat(await (0, entrypoint_1.getAvailableRoles)())));
53
52
  }
54
53
  if (props.router) {
55
54
  result.router = await (0, core_1.getEndpoints)();
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  import { createContext, preloadDescription, getEndpoints } from "@aeriajs/core";
3
- import { getCollections } from "@aeriajs/entrypoint";
3
+ import { getCollections, getAvailableRoles } from "@aeriajs/entrypoint";
4
4
  import { serialize, isLeft, left, unwrapEither } from "@aeriajs/common";
5
- import { getAvailableRoles } from "@aeriajs/access-control";
6
5
  import { authenticate } from "../collections/user/authenticate.mjs";
7
6
  export const describe = async (contextOrPayload) => {
8
7
  const result = {};