@aeriajs/builtins 0.0.277 → 0.0.279

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 (53) hide show
  1. package/dist/authentication.js +6 -11
  2. package/dist/collections/file/description.js +10 -14
  3. package/dist/collections/file/download.js +21 -25
  4. package/dist/collections/file/index.js +15 -18
  5. package/dist/collections/file/insert.js +8 -12
  6. package/dist/collections/file/remove.js +7 -11
  7. package/dist/collections/file/removeAll.js +5 -9
  8. package/dist/collections/index.js +4 -20
  9. package/dist/collections/log/index.js +5 -8
  10. package/dist/collections/resourceUsage/index.js +2 -5
  11. package/dist/collections/user/activate.js +31 -35
  12. package/dist/collections/user/authenticate.js +29 -33
  13. package/dist/collections/user/createAccount.js +25 -29
  14. package/dist/collections/user/description.js +5 -8
  15. package/dist/collections/user/editProfile.js +12 -16
  16. package/dist/collections/user/getActivationLink.js +21 -26
  17. package/dist/collections/user/getCurrentUser.js +12 -16
  18. package/dist/collections/user/getInfo.js +22 -26
  19. package/dist/collections/user/getRedefinePasswordLink.js +15 -19
  20. package/dist/collections/user/index.d.ts +10 -10
  21. package/dist/collections/user/index.js +39 -42
  22. package/dist/collections/user/insert.js +16 -20
  23. package/dist/collections/user/redefinePassword.js +31 -35
  24. package/dist/functions/describe.js +21 -25
  25. package/dist/functions/index.js +1 -17
  26. package/dist/index.d.ts +15 -15
  27. package/dist/index.js +11 -29
  28. package/package.json +11 -17
  29. package/dist/authentication.mjs +0 -58
  30. package/dist/collections/file/description.mjs +0 -75
  31. package/dist/collections/file/download.mjs +0 -115
  32. package/dist/collections/file/index.mjs +0 -59
  33. package/dist/collections/file/insert.mjs +0 -44
  34. package/dist/collections/file/remove.mjs +0 -21
  35. package/dist/collections/file/removeAll.mjs +0 -22
  36. package/dist/collections/index.mjs +0 -5
  37. package/dist/collections/log/index.mjs +0 -55
  38. package/dist/collections/resourceUsage/index.mjs +0 -39
  39. package/dist/collections/user/activate.mjs +0 -119
  40. package/dist/collections/user/authenticate.mjs +0 -165
  41. package/dist/collections/user/createAccount.mjs +0 -93
  42. package/dist/collections/user/description.mjs +0 -149
  43. package/dist/collections/user/editProfile.mjs +0 -52
  44. package/dist/collections/user/getActivationLink.mjs +0 -88
  45. package/dist/collections/user/getCurrentUser.mjs +0 -57
  46. package/dist/collections/user/getInfo.mjs +0 -85
  47. package/dist/collections/user/getRedefinePasswordLink.mjs +0 -63
  48. package/dist/collections/user/index.mjs +0 -71
  49. package/dist/collections/user/insert.mjs +0 -70
  50. package/dist/collections/user/redefinePassword.mjs +0 -110
  51. package/dist/functions/describe.mjs +0 -95
  52. package/dist/functions/index.mjs +0 -2
  53. package/dist/index.mjs +0 -21
@@ -1,34 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.user = void 0;
4
- const core_1 = require("@aeriajs/core");
5
- const description_js_1 = require("./description.js");
6
- const authenticate_js_1 = require("./authenticate.js");
7
- const activate_js_1 = require("./activate.js");
8
- const insert_js_1 = require("./insert.js");
9
- const createAccount_js_1 = require("./createAccount.js");
10
- const getInfo_js_1 = require("./getInfo.js");
11
- const getCurrentUser_js_1 = require("./getCurrentUser.js");
12
- const getActivationLink_js_1 = require("./getActivationLink.js");
13
- const redefinePassword_js_1 = require("./redefinePassword.js");
14
- const getRedefinePasswordLink_js_1 = require("./getRedefinePasswordLink.js");
15
- const editProfile_js_1 = require("./editProfile.js");
1
+ import { defineCollection, get, getAll, remove, upload, removeFile } from '@aeriajs/core';
2
+ import { description } from './description.js';
3
+ import { authenticate, authenticateContract } from './authenticate.js';
4
+ import { activate, activateContract } from './activate.js';
5
+ import { insert } from './insert.js';
6
+ import { createAccount, createAccountContract } from './createAccount.js';
7
+ import { getInfo, getInfoContract } from './getInfo.js';
8
+ import { getCurrentUser, getCurrentUserContract } from './getCurrentUser.js';
9
+ import { getActivationLink, getActivationLinkContract } from './getActivationLink.js';
10
+ import { redefinePassword, redefinePasswordContract } from './redefinePassword.js';
11
+ import { getRedefinePasswordLink, getRedefinePasswordLinkContract } from './getRedefinePasswordLink.js';
12
+ import { editProfile, editProfileContract } from './editProfile.js';
16
13
  const functions = {
17
- get: core_1.get,
18
- getAll: core_1.getAll,
19
- remove: core_1.remove,
20
- upload: core_1.upload,
21
- removeFile: core_1.removeFile,
22
- insert: insert_js_1.insert,
23
- editProfile: editProfile_js_1.editProfile,
24
- authenticate: authenticate_js_1.authenticate,
25
- activate: activate_js_1.activate,
26
- createAccount: createAccount_js_1.createAccount,
27
- getInfo: getInfo_js_1.getInfo,
28
- getCurrentUser: getCurrentUser_js_1.getCurrentUser,
29
- getActivationLink: getActivationLink_js_1.getActivationLink,
30
- getRedefinePasswordLink: getRedefinePasswordLink_js_1.getRedefinePasswordLink,
31
- redefinePassword: redefinePassword_js_1.redefinePassword,
14
+ get,
15
+ getAll,
16
+ remove,
17
+ upload,
18
+ removeFile,
19
+ insert,
20
+ editProfile,
21
+ authenticate,
22
+ activate,
23
+ createAccount,
24
+ getInfo,
25
+ getCurrentUser,
26
+ getActivationLink,
27
+ getRedefinePasswordLink,
28
+ redefinePassword,
32
29
  };
33
30
  const exposedFunctions = {
34
31
  get: true,
@@ -53,21 +50,21 @@ const exposedFunctions = {
53
50
  'root',
54
51
  ],
55
52
  };
56
- exports.user = (0, core_1.defineCollection)({
57
- description: description_js_1.description,
53
+ export const user = defineCollection({
54
+ description,
58
55
  functions: functions,
59
56
  });
60
- Object.assign(exports.user, {
57
+ Object.assign(user, {
61
58
  exposedFunctions,
62
59
  contracts: {
63
- activate: activate_js_1.activateContract,
64
- authenticate: authenticate_js_1.authenticateContract,
65
- createAccount: createAccount_js_1.createAccountContract,
66
- editProfile: editProfile_js_1.editProfileContract,
67
- getActivationLink: getActivationLink_js_1.getActivationLinkContract,
68
- getCurrentUser: getCurrentUser_js_1.getCurrentUserContract,
69
- getInfo: getInfo_js_1.getInfoContract,
70
- getRedefinePasswordLink: getRedefinePasswordLink_js_1.getRedefinePasswordLinkContract,
71
- redefinePassword: redefinePassword_js_1.redefinePasswordContract,
60
+ activate: activateContract,
61
+ authenticate: authenticateContract,
62
+ createAccount: createAccountContract,
63
+ editProfile: editProfileContract,
64
+ getActivationLink: getActivationLinkContract,
65
+ getCurrentUser: getCurrentUserContract,
66
+ getInfo: getInfoContract,
67
+ getRedefinePasswordLink: getRedefinePasswordLinkContract,
68
+ redefinePassword: redefinePasswordContract,
72
69
  },
73
70
  });
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insert = void 0;
4
- const types_1 = require("@aeriajs/types");
5
- const common_1 = require("@aeriajs/common");
6
- const core_1 = require("@aeriajs/core");
7
- const bcrypt = require("bcryptjs");
1
+ import { HTTPStatus, ACError } from '@aeriajs/types';
2
+ import { arraysIntersect } from '@aeriajs/common';
3
+ import { ObjectId, insert as originalInsert } from '@aeriajs/core';
4
+ import * as bcrypt from 'bcryptjs';
8
5
  const isRoleAllowed = (targetRole, context) => {
9
6
  if (!context.config.security.rolesHierarchy) {
10
7
  return true;
@@ -25,23 +22,23 @@ const isRoleAllowed = (targetRole, context) => {
25
22
  }
26
23
  return false;
27
24
  };
28
- const insert = async (payload, context) => {
25
+ export const insert = async (payload, context) => {
29
26
  if (!context.token.authenticated) {
30
27
  throw new Error;
31
28
  }
32
29
  if ('roles' in payload.what) {
33
30
  if (context.config.security.rolesHierarchy) {
34
- if (!(0, common_1.arraysIntersect)(context.token.roles, Object.keys(context.config.security.rolesHierarchy))) {
35
- return context.error(types_1.HTTPStatus.Forbidden, {
36
- code: types_1.ACError.AuthorizationError,
31
+ if (!arraysIntersect(context.token.roles, Object.keys(context.config.security.rolesHierarchy))) {
32
+ return context.error(HTTPStatus.Forbidden, {
33
+ code: ACError.AuthorizationError,
37
34
  message: 'user is not allowed to edit other users roles',
38
35
  });
39
36
  }
40
37
  if (Array.isArray(payload.what.roles)) {
41
38
  const allowed = payload.what.roles.every((role) => isRoleAllowed(role, context));
42
39
  if (!allowed) {
43
- return context.error(types_1.HTTPStatus.Forbidden, {
44
- code: types_1.ACError.AuthorizationError,
40
+ return context.error(HTTPStatus.Forbidden, {
41
+ code: ACError.AuthorizationError,
45
42
  message: 'tried to set unallowed roles',
46
43
  });
47
44
  }
@@ -50,17 +47,17 @@ const insert = async (payload, context) => {
50
47
  }
51
48
  if ('_id' in payload.what && typeof payload.what._id === 'string') {
52
49
  const user = await context.collections.user.model.findOne({
53
- _id: new core_1.ObjectId(payload.what._id),
50
+ _id: new ObjectId(payload.what._id),
54
51
  });
55
52
  if (!user) {
56
- return context.error(types_1.HTTPStatus.NotFound, {
57
- code: types_1.ACError.ResourceNotFound,
53
+ return context.error(HTTPStatus.NotFound, {
54
+ code: ACError.ResourceNotFound,
58
55
  });
59
56
  }
60
57
  const allowed = user.roles.every((role) => isRoleAllowed(role, context));
61
58
  if (!allowed) {
62
- return context.error(types_1.HTTPStatus.Forbidden, {
63
- code: types_1.ACError.AuthorizationError,
59
+ return context.error(HTTPStatus.Forbidden, {
60
+ code: ACError.AuthorizationError,
64
61
  message: 'tried to edit an user with a role higher in the hierarchy',
65
62
  });
66
63
  }
@@ -68,6 +65,5 @@ const insert = async (payload, context) => {
68
65
  if ('password' in payload.what && typeof payload.what.password === 'string') {
69
66
  payload.what.password = await bcrypt.hash(payload.what.password, 10);
70
67
  }
71
- return (0, core_1.insert)(payload, context);
68
+ return originalInsert(payload, context);
72
69
  };
73
- exports.insert = insert;
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.redefinePassword = exports.redefinePasswordContract = exports.RedefinePasswordError = void 0;
4
- const core_1 = require("@aeriajs/core");
5
- const types_1 = require("@aeriajs/types");
6
- const bcrypt = require("bcryptjs");
7
- exports.RedefinePasswordError = {
1
+ import { decodeToken, ObjectId } from '@aeriajs/core';
2
+ import { Result, ACError, HTTPStatus, resultSchema, functionSchemas, endpointErrorSchema, defineContract } from '@aeriajs/types';
3
+ import * as bcrypt from 'bcryptjs';
4
+ export const RedefinePasswordError = {
8
5
  UserNotFound: 'USER_NOT_FOUND',
9
6
  UserNotActive: 'USER_NOT_ACTIVE',
10
7
  InvalidLink: 'INVALID_LINK',
11
8
  InvalidToken: 'INVALID_TOKEN',
12
9
  };
13
- exports.redefinePasswordContract = (0, types_1.defineContract)({
10
+ export const redefinePasswordContract = defineContract({
14
11
  payload: {
15
12
  type: 'object',
16
13
  required: [],
@@ -28,23 +25,23 @@ exports.redefinePasswordContract = (0, types_1.defineContract)({
28
25
  },
29
26
  },
30
27
  response: [
31
- types_1.functionSchemas.getError(),
32
- (0, types_1.endpointErrorSchema)({
28
+ functionSchemas.getError(),
29
+ endpointErrorSchema({
33
30
  httpStatus: [
34
- types_1.HTTPStatus.NotFound,
35
- types_1.HTTPStatus.Forbidden,
36
- types_1.HTTPStatus.Unauthorized,
37
- types_1.HTTPStatus.UnprocessableContent,
31
+ HTTPStatus.NotFound,
32
+ HTTPStatus.Forbidden,
33
+ HTTPStatus.Unauthorized,
34
+ HTTPStatus.UnprocessableContent,
38
35
  ],
39
36
  code: [
40
- types_1.ACError.MalformedInput,
41
- exports.RedefinePasswordError.InvalidLink,
42
- exports.RedefinePasswordError.InvalidToken,
43
- exports.RedefinePasswordError.UserNotFound,
44
- exports.RedefinePasswordError.UserNotActive,
37
+ ACError.MalformedInput,
38
+ RedefinePasswordError.InvalidLink,
39
+ RedefinePasswordError.InvalidToken,
40
+ RedefinePasswordError.UserNotFound,
41
+ RedefinePasswordError.UserNotActive,
45
42
  ],
46
43
  }),
47
- (0, types_1.resultSchema)({
44
+ resultSchema({
48
45
  type: 'object',
49
46
  properties: {
50
47
  userId: {
@@ -55,18 +52,18 @@ exports.redefinePasswordContract = (0, types_1.defineContract)({
55
52
  }),
56
53
  ],
57
54
  });
58
- const redefinePassword = async (payload, context) => {
55
+ export const redefinePassword = async (payload, context) => {
59
56
  const { userId, token, password, } = payload;
60
57
  if (!context.config.secret) {
61
58
  throw new Error('config.secret is not set');
62
59
  }
63
60
  if (!userId || !token) {
64
- return context.error(types_1.HTTPStatus.NotFound, {
65
- code: exports.RedefinePasswordError.InvalidLink,
61
+ return context.error(HTTPStatus.NotFound, {
62
+ code: RedefinePasswordError.InvalidLink,
66
63
  });
67
64
  }
68
65
  const user = await context.collection.model.findOne({
69
- _id: new core_1.ObjectId(userId),
66
+ _id: new ObjectId(userId),
70
67
  }, {
71
68
  projection: {
72
69
  password: 1,
@@ -74,24 +71,24 @@ const redefinePassword = async (payload, context) => {
74
71
  },
75
72
  });
76
73
  if (!user) {
77
- return context.error(types_1.HTTPStatus.NotFound, {
78
- code: exports.RedefinePasswordError.UserNotFound,
74
+ return context.error(HTTPStatus.NotFound, {
75
+ code: RedefinePasswordError.UserNotFound,
79
76
  });
80
77
  }
81
78
  if (!user.active) {
82
- return context.error(types_1.HTTPStatus.Forbidden, {
83
- code: exports.RedefinePasswordError.UserNotActive,
79
+ return context.error(HTTPStatus.Forbidden, {
80
+ code: RedefinePasswordError.UserNotActive,
84
81
  });
85
82
  }
86
- const decoded = await (0, core_1.decodeToken)(token, context.config.secret);
83
+ const decoded = await decodeToken(token, context.config.secret);
87
84
  if (!decoded) {
88
- return context.error(types_1.HTTPStatus.Unauthorized, {
89
- code: exports.RedefinePasswordError.InvalidToken,
85
+ return context.error(HTTPStatus.Unauthorized, {
86
+ code: RedefinePasswordError.InvalidToken,
90
87
  });
91
88
  }
92
89
  if (!password) {
93
- return context.error(types_1.HTTPStatus.UnprocessableContent, {
94
- code: types_1.ACError.MalformedInput,
90
+ return context.error(HTTPStatus.UnprocessableContent, {
91
+ code: ACError.MalformedInput,
95
92
  });
96
93
  }
97
94
  await context.collection.model.updateOne({
@@ -102,8 +99,7 @@ const redefinePassword = async (payload, context) => {
102
99
  password: await bcrypt.hash(password, 10),
103
100
  },
104
101
  });
105
- return types_1.Result.result({
102
+ return Result.result({
106
103
  userId: user._id,
107
104
  });
108
105
  };
109
- exports.redefinePassword = redefinePassword;
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.describe = void 0;
4
- const core_1 = require("@aeriajs/core");
5
- const entrypoint_1 = require("@aeriajs/entrypoint");
6
- const types_1 = require("@aeriajs/types");
7
- const common_1 = require("@aeriajs/common");
8
- const validation_1 = require("@aeriajs/validation");
9
- const authenticate_js_1 = require("../collections/user/authenticate.js");
10
- const [Payload, validatePayload] = (0, validation_1.validator)({
1
+ import { createContext, preloadDescription, getEndpoints } from '@aeriajs/core';
2
+ import { getCollections, getAvailableRoles } from '@aeriajs/entrypoint';
3
+ import { Result, ACError, HTTPStatus } from '@aeriajs/types';
4
+ import { serialize, endpointError, isValidCollection } from '@aeriajs/common';
5
+ import { validator } from '@aeriajs/validation';
6
+ import { authenticate } from '../collections/user/authenticate.js';
7
+ const [Payload, validatePayload] = validator({
11
8
  type: 'object',
12
9
  required: [],
13
10
  additionalProperties: true,
@@ -32,7 +29,7 @@ const [Payload, validatePayload] = (0, validation_1.validator)({
32
29
  },
33
30
  },
34
31
  });
35
- const describe = async (contextOrPayload) => {
32
+ export const describe = async (contextOrPayload) => {
36
33
  const result = {
37
34
  descriptions: {},
38
35
  };
@@ -40,9 +37,9 @@ const describe = async (contextOrPayload) => {
40
37
  if ('request' in contextOrPayload) {
41
38
  const { error, result: validatedPayload } = validatePayload(contextOrPayload.request.payload);
42
39
  if (error) {
43
- return (0, common_1.endpointError)({
44
- httpStatus: types_1.HTTPStatus.UnprocessableContent,
45
- code: types_1.ACError.MalformedInput,
40
+ return endpointError({
41
+ httpStatus: HTTPStatus.UnprocessableContent,
42
+ code: ACError.MalformedInput,
46
43
  details: error,
47
44
  });
48
45
  }
@@ -52,18 +49,18 @@ const describe = async (contextOrPayload) => {
52
49
  props = contextOrPayload;
53
50
  }
54
51
  if ('request' in contextOrPayload && props.revalidate) {
55
- const { error, result: auth } = await (0, authenticate_js_1.authenticate)({
52
+ const { error, result: auth } = await authenticate({
56
53
  revalidate: true,
57
- }, await (0, core_1.createContext)({
54
+ }, await createContext({
58
55
  collectionName: 'user',
59
56
  parentContext: contextOrPayload,
60
57
  }));
61
58
  if (error) {
62
- return types_1.Result.error(error);
59
+ return Result.error(error);
63
60
  }
64
61
  result.auth = JSON.parse(JSON.stringify(auth));
65
62
  }
66
- const collections = await (0, entrypoint_1.getCollections)();
63
+ const collections = await getCollections();
67
64
  const retrievedCollections = props.collections?.length
68
65
  ? Object.fromEntries(Object.entries(collections).filter(([key]) => props.collections.includes(key)))
69
66
  : collections;
@@ -74,11 +71,11 @@ const describe = async (contextOrPayload) => {
74
71
  const collection = typeof candidate === 'function'
75
72
  ? candidate()
76
73
  : candidate;
77
- if (!(0, common_1.isValidCollection)(collection)) {
74
+ if (!isValidCollection(collection)) {
78
75
  throw new Error(`The "${collectionName}" symbol exported from the entrypoint doesn't seem like a valid collection. Make sure only collections are exported from the "import('.').collections".`);
79
76
  }
80
77
  const { description: rawDescription } = collection;
81
- const description = await (0, core_1.preloadDescription)(rawDescription);
78
+ const description = await preloadDescription(rawDescription);
82
79
  descriptions[description.$id] = description;
83
80
  }
84
81
  if (props.roles) {
@@ -90,18 +87,17 @@ const describe = async (contextOrPayload) => {
90
87
  const userRoles = 'enum' in userRolesProperty.items
91
88
  ? userRolesProperty.items.enum
92
89
  : [];
93
- result.roles = Array.from(new Set(userRoles.concat(await (0, entrypoint_1.getAvailableRoles)())));
90
+ result.roles = Array.from(new Set(userRoles.concat(await getAvailableRoles())));
94
91
  if ('config' in contextOrPayload) {
95
92
  result.rolesHierarchy = contextOrPayload.config.security.rolesHierarchy;
96
93
  }
97
94
  }
98
95
  if (props.router) {
99
- result.router = await (0, core_1.getEndpoints)();
96
+ result.router = await getEndpoints();
100
97
  }
101
98
  if (props.noSerialize || !('response' in contextOrPayload)) {
102
- return types_1.Result.result(result);
99
+ return Result.result(result);
103
100
  }
104
101
  contextOrPayload.response.setHeader('content-type', 'application/bson');
105
- return contextOrPayload.response.end((0, common_1.serialize)(result));
102
+ return contextOrPayload.response.end(serialize(result));
106
103
  };
107
- exports.describe = describe;
@@ -1,17 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./describe.js"), exports);
1
+ export * from './describe.js';
package/dist/index.d.ts CHANGED
@@ -64,7 +64,7 @@ export declare const collections: {
64
64
  };
65
65
  };
66
66
  functions: {
67
- get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
67
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core/index.js").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
68
68
  insert: (payload: {
69
69
  what: {
70
70
  content: string;
@@ -445,7 +445,7 @@ export declare const collections: {
445
445
  };
446
446
  };
447
447
  functions: {
448
- get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
448
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core/index.js").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
449
449
  insert: (payload: {
450
450
  what: {
451
451
  content: string;
@@ -836,11 +836,11 @@ export declare const collections: {
836
836
  readonly filters: readonly ["context", "message", "owner"];
837
837
  };
838
838
  functions: {
839
- get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
839
+ get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core/index.js").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
840
840
  getAll: <TDescription extends import("@aeriajs/types").Description, TFunctions>(payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<TDescription>>, context: import("@aeriajs/types").Context<TDescription, undefined | (TFunctions & {
841
841
  count?: (...args: unknown[]) => Promise<import("@aeriajs/types").CountReturnType>;
842
- })>, options?: import("@aeriajs/core").GetAllOptions) => Promise<import("@aeriajs/types").GetAllReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
843
- insert: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
842
+ })>, options?: import("@aeriajs/core/index.js").GetAllOptions) => Promise<import("@aeriajs/types").GetAllReturnType<import("@aeriajs/types").SchemaWithId<TDescription>>>;
843
+ insert: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext, options?: import("@aeriajs/core/index.js").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<TContext["description"]>>>;
844
844
  };
845
845
  contracts: {
846
846
  get?: import("@aeriajs/types").Contract | undefined;
@@ -1263,7 +1263,7 @@ export declare const collections: {
1263
1263
  email: string;
1264
1264
  active: boolean;
1265
1265
  phone_number: string;
1266
- picture_file: import("mongodb").ObjectId;
1266
+ picture_file: import("bson").ObjectId;
1267
1267
  given_name: never;
1268
1268
  family_name: never;
1269
1269
  }, never>>, context: Omit<import("@aeriajs/types").Context, "token">) => ({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -2524,7 +2524,7 @@ export declare const collections: {
2524
2524
  readonly format: "objectid";
2525
2525
  };
2526
2526
  }, {}>> & {
2527
- userId: import("mongodb").ObjectId;
2527
+ userId: import("bson").ObjectId;
2528
2528
  }, never>;
2529
2529
  error: undefined;
2530
2530
  }, never>) | Promise<({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -2621,7 +2621,7 @@ export declare const collections: {
2621
2621
  readonly format: "objectid";
2622
2622
  };
2623
2623
  }, {}>> & {
2624
- userId: import("mongodb").ObjectId;
2624
+ userId: import("bson").ObjectId;
2625
2625
  }, never>;
2626
2626
  error: undefined;
2627
2627
  }, never>)>;
@@ -3911,7 +3911,7 @@ export declare const collections: {
3911
3911
  readonly type: "string";
3912
3912
  };
3913
3913
  }, {}>> & {
3914
- userId: import("mongodb").ObjectId;
3914
+ userId: import("bson").ObjectId;
3915
3915
  redirect: string;
3916
3916
  }, never>, "userId"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
3917
3917
  readonly userId: {
@@ -3922,7 +3922,7 @@ export declare const collections: {
3922
3922
  readonly type: "string";
3923
3923
  };
3924
3924
  }, {}>> & {
3925
- userId: import("mongodb").ObjectId;
3925
+ userId: import("bson").ObjectId;
3926
3926
  redirect: string;
3927
3927
  }, never>>, context: Omit<import("@aeriajs/types").Context, "token">) => ({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
3928
3928
  readonly _tag: {
@@ -4262,7 +4262,7 @@ export declare const collections: {
4262
4262
  readonly type: "string";
4263
4263
  };
4264
4264
  }, {}>> & {
4265
- userId: import("mongodb").ObjectId;
4265
+ userId: import("bson").ObjectId;
4266
4266
  redirect: string;
4267
4267
  }, never>, "userId"> & Partial<{} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
4268
4268
  readonly userId: {
@@ -4273,7 +4273,7 @@ export declare const collections: {
4273
4273
  readonly type: "string";
4274
4274
  };
4275
4275
  }, {}>> & {
4276
- userId: import("mongodb").ObjectId;
4276
+ userId: import("bson").ObjectId;
4277
4277
  redirect: string;
4278
4278
  }, never>>, context: Omit<import("@aeriajs/types").Context, "token">) => ({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
4279
4279
  readonly _tag: {
@@ -4618,7 +4618,7 @@ export declare const collections: {
4618
4618
  }, {}>> & {
4619
4619
  password: string;
4620
4620
  token: string;
4621
- userId: import("mongodb").ObjectId;
4621
+ userId: import("bson").ObjectId;
4622
4622
  }, never>>, context: Omit<import("@aeriajs/types").Context, "token">) => ({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
4623
4623
  readonly _tag: {
4624
4624
  readonly const: "Error";
@@ -4782,7 +4782,7 @@ export declare const collections: {
4782
4782
  readonly format: "objectid";
4783
4783
  };
4784
4784
  }, {}>> & {
4785
- userId: import("mongodb").ObjectId;
4785
+ userId: import("bson").ObjectId;
4786
4786
  }, never>;
4787
4787
  error: undefined;
4788
4788
  }, never>) | Promise<({} & Omit<Readonly<import("@aeriajs/types").FilterReadonlyProperties<{
@@ -4948,7 +4948,7 @@ export declare const collections: {
4948
4948
  readonly format: "objectid";
4949
4949
  };
4950
4950
  }, {}>> & {
4951
- userId: import("mongodb").ObjectId;
4951
+ userId: import("bson").ObjectId;
4952
4952
  }, never>;
4953
4953
  error: undefined;
4954
4954
  }, never>)>;
package/dist/index.js CHANGED
@@ -1,30 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.collections = exports.insertUser = exports.builtinFunctions = void 0;
18
- exports.builtinFunctions = require("./functions/index.js");
19
- __exportStar(require("./collections/index.js"), exports);
20
- __exportStar(require("./authentication.js"), exports);
21
- var insert_js_1 = require("./collections/user/insert.js");
22
- Object.defineProperty(exports, "insertUser", { enumerable: true, get: function () { return insert_js_1.insert; } });
23
- const index_js_1 = require("./collections/index.js");
24
- exports.collections = {
25
- file: index_js_1.file,
26
- tempFile: index_js_1.tempFile,
27
- log: index_js_1.log,
28
- resourceUsage: index_js_1.resourceUsage,
29
- user: index_js_1.user,
1
+ export * as builtinFunctions from './functions/index.js';
2
+ export * from './collections/index.js';
3
+ export * from './authentication.js';
4
+ export { insert as insertUser, } from './collections/user/insert.js';
5
+ import { file, tempFile, log, resourceUsage, user, } from './collections/index.js';
6
+ export const collections = {
7
+ file,
8
+ tempFile,
9
+ log,
10
+ resourceUsage,
11
+ user,
30
12
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.277",
3
+ "type": "module",
4
+ "version": "0.0.279",
4
5
  "description": "## Installation",
5
6
  "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -14,18 +14,15 @@
14
14
  "exports": {
15
15
  ".": {
16
16
  "types": "./dist/index.d.ts",
17
- "import": "./dist/index.mjs",
18
- "require": "./dist/index.js"
17
+ "default": "./dist/index.js"
19
18
  },
20
19
  "./collections": {
21
20
  "types": "./dist/collections/index.d.ts",
22
- "import": "./dist/collections/index.mjs",
23
- "require": "./dist/collections/index.js"
21
+ "default": "./dist/collections/index.js"
24
22
  },
25
23
  "./icons": {
26
24
  "types": "./dist/icons.d.ts",
27
- "import": "./dist/icons.mjs",
28
- "require": "./dist/icons.cjs"
25
+ "default": "./dist/icons.js"
29
26
  },
30
27
  "./*": "./dist/*"
31
28
  },
@@ -44,20 +41,17 @@
44
41
  "mongodb": "^6.17.0"
45
42
  },
46
43
  "peerDependencies": {
47
- "@aeriajs/common": "^0.0.157",
48
- "@aeriajs/core": "^0.0.277",
49
- "@aeriajs/entrypoint": "^0.0.163",
50
- "@aeriajs/types": "^0.0.135",
51
- "@aeriajs/validation": "^0.0.178"
44
+ "@aeriajs/common": "^0.0.158",
45
+ "@aeriajs/core": "^0.0.279",
46
+ "@aeriajs/entrypoint": "^0.0.165",
47
+ "@aeriajs/types": "^0.0.136",
48
+ "@aeriajs/validation": "^0.0.180"
52
49
  },
53
50
  "scripts": {
54
51
  "test": "echo skipping",
55
52
  "lint": "eslint .",
56
53
  "lint:fix": "eslint . --fix",
57
- "build": "pnpm build:cjs && pnpm build:esm",
58
- "build:cjs": "tsc",
59
- "build:esm": "esbuild './src/**/*.ts' --outdir=dist --out-extension:.js=.mjs && pnpm build:esm-transform",
60
- "build:esm-transform": "pnpm -w esm-transform $PWD/dist",
54
+ "build": "tsc",
61
55
  "write-icons": "pnpm -w write-icons"
62
56
  }
63
57
  }