@aeriajs/builtins 0.0.74 → 0.0.76

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.
@@ -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,23 @@ 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
  },
43
+ exposedFunctions: {
44
+ authenticate: true,
45
+ },
37
46
  });
@@ -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,23 @@ 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
  }
40
+ },
41
+ exposedFunctions: {
42
+ authenticate: true
34
43
  }
35
44
  });
@@ -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;
@@ -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;
@@ -110,7 +110,7 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
110
110
  };
111
111
  };
112
112
  };
113
- }>, "name" | "active" | "roles" | "email"> & {
113
+ }>, "name" | "roles" | "email" | "active"> & {
114
114
  _id: import("@aeriajs/core").ObjectId | null;
115
115
  };
116
116
  token: import("@aeriajs/types").TokenRecipient;
@@ -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 = {};