@aeriajs/builtins 0.0.136 → 0.0.138

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.
@@ -154,7 +154,11 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
154
154
  what: {
155
155
  content: string;
156
156
  } & Pick<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof description>>, "_id" | "name" | "owner" | "absolute_path">;
157
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
157
+ }, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
158
+ readonly _tag: "Error";
159
+ readonly error: import("@aeriajs/types").ACError;
160
+ readonly result: undefined;
161
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
158
162
  readonly $id: "file";
159
163
  readonly icon: "paperclip";
160
164
  readonly owned: "always";
@@ -214,24 +218,24 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
214
218
  } & {
215
219
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
216
220
  }> | import("fs").ReadStream>;
217
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
218
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
219
- } & {
220
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
221
- }> | {
221
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
222
222
  readonly _tag: "Result";
223
223
  readonly error: undefined;
224
224
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
225
- }>;
226
- readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
225
+ } | import("@aeriajs/types").Result.Error<{
227
226
  readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
228
227
  } & {
229
228
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
230
- }> | {
229
+ }>>;
230
+ readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
231
231
  readonly _tag: "Result";
232
232
  readonly error: undefined;
233
233
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
234
- }>;
234
+ } | import("@aeriajs/types").Result.Error<{
235
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
236
+ } & {
237
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
238
+ }>>;
235
239
  };
236
240
  exposedFunctions: {
237
241
  readonly get: "unauthenticated";
@@ -349,7 +353,11 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
349
353
  what: {
350
354
  content: string;
351
355
  } & Pick<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof description>>, "_id" | "name" | "owner" | "absolute_path">;
352
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
356
+ }, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
357
+ readonly _tag: "Error";
358
+ readonly error: import("@aeriajs/types").ACError;
359
+ readonly result: undefined;
360
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
353
361
  readonly $id: "file";
354
362
  readonly icon: "paperclip";
355
363
  readonly owned: "always";
@@ -409,24 +417,24 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
409
417
  } & {
410
418
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
411
419
  }> | import("fs").ReadStream>;
412
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
413
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
414
- } & {
415
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
416
- }> | {
420
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
417
421
  readonly _tag: "Result";
418
422
  readonly error: undefined;
419
423
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
420
- }>;
421
- readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
424
+ } | import("@aeriajs/types").Result.Error<{
422
425
  readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
423
426
  } & {
424
427
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
425
- }> | {
428
+ }>>;
429
+ readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
426
430
  readonly _tag: "Result";
427
431
  readonly error: undefined;
428
432
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
429
- }>;
433
+ } | import("@aeriajs/types").Result.Error<{
434
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
435
+ } & {
436
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
437
+ }>>;
430
438
  };
431
439
  contracts: {
432
440
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -4,7 +4,11 @@ export declare const insert: (payload: {
4
4
  what: {
5
5
  content: string;
6
6
  } & Pick<PackReferences<SchemaWithId<typeof description>>, "_id" | "name" | "owner" | "absolute_path">;
7
- }, context: Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<SchemaWithId<{
7
+ }, context: Context<typeof description>) => Promise<{
8
+ readonly _tag: "Error";
9
+ readonly error: import("@aeriajs/types").ACError;
10
+ readonly result: undefined;
11
+ } | import("@aeriajs/types").InsertReturnType<SchemaWithId<{
8
12
  readonly $id: "file";
9
13
  readonly icon: "paperclip";
10
14
  readonly owned: "always";
@@ -1,11 +1,11 @@
1
1
  import type { Context, SchemaWithId, RemovePayload } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
- export declare const remove: (payload: RemovePayload<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
4
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
5
- } & {
6
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
7
- }> | {
3
+ export declare const remove: (payload: RemovePayload<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<{
8
4
  readonly _tag: "Result";
9
5
  readonly error: undefined;
10
6
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
11
- }>;
7
+ } | import("@aeriajs/types").Result.Error<{
8
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
9
+ } & {
10
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
11
+ }>>;
@@ -1,11 +1,11 @@
1
1
  import type { Context, SchemaWithId, PackReferences, RemoveAllPayload } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
- export declare const removeAll: (payload: RemoveAllPayload, context: Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
4
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
5
- } & {
6
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
7
- }> | {
3
+ export declare const removeAll: (payload: RemoveAllPayload, context: Context<typeof description>) => Promise<{
8
4
  readonly _tag: "Result";
9
5
  readonly error: undefined;
10
6
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
11
- }>;
7
+ } | import("@aeriajs/types").Result.Error<{
8
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
9
+ } & {
10
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
11
+ }>>;
@@ -28,12 +28,20 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
28
28
  };
29
29
  functions: {
30
30
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
31
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
31
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
32
+ readonly _tag: "Error";
33
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
34
+ readonly result: undefined;
35
+ } | {
32
36
  readonly _tag: "Result";
33
37
  readonly error: undefined;
34
38
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
35
39
  }>;
36
- readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
40
+ readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<{
41
+ readonly _tag: "Error";
42
+ readonly error: import("@aeriajs/types").ACError;
43
+ readonly result: undefined;
44
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
37
45
  };
38
46
  exposedFunctions: {
39
47
  readonly get: true;
@@ -97,12 +105,20 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
97
105
  };
98
106
  functions: {
99
107
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
100
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
108
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
109
+ readonly _tag: "Error";
110
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
111
+ readonly result: undefined;
112
+ } | {
101
113
  readonly _tag: "Result";
102
114
  readonly error: undefined;
103
115
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
104
116
  }>;
105
- readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
117
+ readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<{
118
+ readonly _tag: "Error";
119
+ readonly error: import("@aeriajs/types").ACError;
120
+ readonly result: undefined;
121
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
106
122
  };
107
123
  contracts: {
108
124
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -16,7 +16,7 @@ export declare const authenticate: (props: Props, context: Context<typeof descri
16
16
  }> | {
17
17
  readonly _tag: "Result";
18
18
  readonly error: undefined;
19
- readonly result: import("../../authentication.js").SuccessfulAuthentication | {
19
+ readonly result: {
20
20
  user: {
21
21
  _id: null;
22
22
  name: string;
@@ -29,6 +29,10 @@ export declare const authenticate: (props: Props, context: Context<typeof descri
29
29
  content: string;
30
30
  };
31
31
  };
32
+ } | {
33
+ readonly _tag: "Result";
34
+ readonly error: undefined;
35
+ readonly result: import("../../authentication.js").SuccessfulAuthentication;
32
36
  } | Result.Error<{
33
37
  readonly code: AuthenticationError.InvalidCredentials;
34
38
  } & {
@@ -4,6 +4,7 @@ exports.authenticate = void 0;
4
4
  const types_1 = require("@aeriajs/types");
5
5
  const bcrypt_1 = require("bcrypt");
6
6
  const core_1 = require("@aeriajs/core");
7
+ const common_1 = require("@aeriajs/common");
7
8
  const authentication_js_1 = require("../../authentication.js");
8
9
  const authenticate = async (props, context) => {
9
10
  if ('revalidate' in props) {
@@ -16,6 +17,9 @@ const authenticate = async (props, context) => {
16
17
  const decodedToken = token
17
18
  ? await (0, core_1.decodeToken)(token.content)
18
19
  : context.token;
20
+ if (!decodedToken.sub) {
21
+ return types_1.Result.result(await (0, authentication_js_1.defaultSuccessfulAuthentication)());
22
+ }
19
23
  const { error, result: user } = await context.collections.user.functions.get({
20
24
  filters: {
21
25
  _id: decodedToken.sub,
@@ -25,9 +29,7 @@ const authenticate = async (props, context) => {
25
29
  if (error) {
26
30
  throw new Error();
27
31
  }
28
- return types_1.Result.result(decodedToken.sub
29
- ? await (0, authentication_js_1.successfulAuthentication)(user, context)
30
- : await (0, authentication_js_1.defaultSuccessfulAuthentication)());
32
+ return types_1.Result.result(await (0, authentication_js_1.successfulAuthentication)(user, context));
31
33
  }
32
34
  if (typeof props.email !== 'string') {
33
35
  return context.error(types_1.HTTPStatus.Unauthorized, {
@@ -43,7 +45,6 @@ const authenticate = async (props, context) => {
43
45
  email: props.email,
44
46
  }, {
45
47
  projection: {
46
- email: 1,
47
48
  password: 1,
48
49
  active: 1,
49
50
  },
@@ -58,6 +59,12 @@ const authenticate = async (props, context) => {
58
59
  code: authentication_js_1.AuthenticationError.InactiveUser,
59
60
  });
60
61
  }
61
- return types_1.Result.result(await (0, authentication_js_1.successfulAuthentication)(user, context));
62
+ const completeUser = (0, common_1.throwIfError)(await (0, core_1.get)({
63
+ filters: {
64
+ _id: user._id,
65
+ },
66
+ populate: ['picture_file'],
67
+ }, context));
68
+ return types_1.Result.result(await (0, authentication_js_1.successfulAuthentication)(completeUser, context));
62
69
  };
63
70
  exports.authenticate = authenticate;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  import { Result, HTTPStatus, ACError } from "@aeriajs/types";
3
3
  import { compare as bcryptCompare } from "bcrypt";
4
- import { decodeToken } from "@aeriajs/core";
4
+ import { decodeToken, get } from "@aeriajs/core";
5
+ import { throwIfError } from "@aeriajs/common";
5
6
  import { successfulAuthentication, defaultSuccessfulAuthentication, AuthenticationError } from "../../authentication.mjs";
6
7
  export const authenticate = async (props, context) => {
7
8
  if ("revalidate" in props) {
@@ -12,6 +13,9 @@ export const authenticate = async (props, context) => {
12
13
  });
13
14
  }
14
15
  const decodedToken = token ? await decodeToken(token.content) : context.token;
16
+ if (!decodedToken.sub) {
17
+ return Result.result(await defaultSuccessfulAuthentication());
18
+ }
15
19
  const { error, result: user2 } = await context.collections.user.functions.get({
16
20
  filters: {
17
21
  _id: decodedToken.sub
@@ -21,7 +25,7 @@ export const authenticate = async (props, context) => {
21
25
  if (error) {
22
26
  throw new Error();
23
27
  }
24
- return Result.result(decodedToken.sub ? await successfulAuthentication(user2, context) : await defaultSuccessfulAuthentication());
28
+ return Result.result(await successfulAuthentication(user2, context));
25
29
  }
26
30
  if (typeof props.email !== "string") {
27
31
  return context.error(HTTPStatus.Unauthorized, {
@@ -39,7 +43,6 @@ export const authenticate = async (props, context) => {
39
43
  },
40
44
  {
41
45
  projection: {
42
- email: 1,
43
46
  password: 1,
44
47
  active: 1
45
48
  }
@@ -55,5 +58,11 @@ export const authenticate = async (props, context) => {
55
58
  code: AuthenticationError.InactiveUser
56
59
  });
57
60
  }
58
- return Result.result(await successfulAuthentication(user, context));
61
+ const completeUser = throwIfError(await get({
62
+ filters: {
63
+ _id: user._id
64
+ },
65
+ populate: ["picture_file"]
66
+ }, context));
67
+ return Result.result(await successfulAuthentication(completeUser, context));
59
68
  };
@@ -1,7 +1,7 @@
1
- import type { Context, Schema } from '@aeriajs/types';
1
+ import type { Context, SchemaWithId } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
3
  import { Result, HTTPStatus, ACError } from '@aeriajs/types';
4
- export declare const createAccount: (payload: Omit<Schema<typeof description>, "roles">, context: Context<typeof description>) => Promise<Result.Error<{
4
+ export declare const createAccount: (payload: Partial<SchemaWithId<typeof description>>, context: Context<typeof description>) => Promise<Result.Error<{
5
5
  readonly code: ACError.MalformedInput;
6
6
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
7
7
  } & {
@@ -5,11 +5,14 @@ const types_1 = require("@aeriajs/types");
5
5
  const validation_1 = require("@aeriajs/validation");
6
6
  const bcrypt = require("bcrypt");
7
7
  const createAccount = async (payload, context) => {
8
- const user = Object.assign({}, payload);
8
+ const userCandidate = Object.assign({}, payload);
9
9
  if (!context.config.security.allowSignup) {
10
10
  throw new Error('signup disallowed');
11
11
  }
12
- const { error } = (0, validation_1.validate)(user, {
12
+ delete userCandidate._id;
13
+ delete userCandidate.roles;
14
+ delete userCandidate.active;
15
+ const { error, result: user } = (0, validation_1.validate)(userCandidate, {
13
16
  type: 'object',
14
17
  required: [
15
18
  'name',
@@ -30,12 +33,6 @@ const createAccount = async (payload, context) => {
30
33
  type: 'string',
31
34
  },
32
35
  },
33
- }, {
34
- extraneous: [
35
- '_id',
36
- 'roles',
37
- 'active',
38
- ],
39
36
  });
40
37
  if (error) {
41
38
  return context.error(types_1.HTTPStatus.BadRequest, {
@@ -3,11 +3,14 @@ import { Result, HTTPStatus, ACError } from "@aeriajs/types";
3
3
  import { validate } from "@aeriajs/validation";
4
4
  import * as bcrypt from "bcrypt";
5
5
  export const createAccount = async (payload, context) => {
6
- const user = Object.assign({}, payload);
6
+ const userCandidate = Object.assign({}, payload);
7
7
  if (!context.config.security.allowSignup) {
8
8
  throw new Error("signup disallowed");
9
9
  }
10
- const { error } = validate(user, {
10
+ delete userCandidate._id;
11
+ delete userCandidate.roles;
12
+ delete userCandidate.active;
13
+ const { error, result: user } = validate(userCandidate, {
11
14
  type: "object",
12
15
  required: [
13
16
  "name",
@@ -28,12 +31,6 @@ export const createAccount = async (payload, context) => {
28
31
  type: "string"
29
32
  }
30
33
  }
31
- }, {
32
- extraneous: [
33
- "_id",
34
- "roles",
35
- "active"
36
- ]
37
34
  });
38
35
  if (error) {
39
36
  return context.error(HTTPStatus.BadRequest, {
@@ -102,20 +102,24 @@ export declare const user: {
102
102
  };
103
103
  functions: {
104
104
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
105
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
105
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
106
+ readonly _tag: "Error";
107
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
108
+ readonly result: undefined;
109
+ } | {
106
110
  readonly _tag: "Result";
107
111
  readonly error: undefined;
108
112
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
109
113
  }>;
110
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
111
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
112
- } & {
113
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
114
- }> | {
114
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
115
115
  readonly _tag: "Result";
116
116
  readonly error: undefined;
117
117
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
118
- }>;
118
+ } | import("@aeriajs/types").Result.Error<{
119
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
120
+ } & {
121
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
122
+ }>>;
119
123
  readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
120
124
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
121
125
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
@@ -128,14 +132,18 @@ export declare const user: {
128
132
  readonly tempId: any;
129
133
  };
130
134
  }>;
131
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<{
135
+ readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
132
136
  readonly _tag: "Result";
133
137
  readonly error: undefined;
134
138
  readonly result: any;
135
139
  }>;
136
140
  readonly insert: (payload: {
137
141
  what: Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof description>>, "roles">;
138
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
142
+ }, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
143
+ readonly _tag: "Error";
144
+ readonly error: import("@aeriajs/types").ACError;
145
+ readonly result: undefined;
146
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
139
147
  readonly $id: "user";
140
148
  readonly icon: "users";
141
149
  readonly required: readonly ["name", "roles", "email"];
@@ -248,7 +256,7 @@ export declare const user: {
248
256
  }> | {
249
257
  readonly _tag: "Result";
250
258
  readonly error: undefined;
251
- readonly result: import("../../authentication.js").SuccessfulAuthentication | {
259
+ readonly result: {
252
260
  user: {
253
261
  _id: null;
254
262
  name: string;
@@ -261,6 +269,10 @@ export declare const user: {
261
269
  content: string;
262
270
  };
263
271
  };
272
+ } | {
273
+ readonly _tag: "Result";
274
+ readonly error: undefined;
275
+ readonly result: import("../../authentication.js").SuccessfulAuthentication;
264
276
  } | import("@aeriajs/types").Result.Error<{
265
277
  readonly code: import("../../authentication.js").AuthenticationError.InvalidCredentials;
266
278
  } & {
@@ -305,7 +317,7 @@ export declare const user: {
305
317
  readonly userId: any;
306
318
  };
307
319
  } | undefined>;
308
- readonly createAccount: (payload: Omit<import("@aeriajs/types").Schema<typeof description>, "roles">, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
320
+ readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
309
321
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
310
322
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
311
323
  } & {
@@ -671,20 +683,24 @@ export declare const user: {
671
683
  };
672
684
  functions: {
673
685
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
674
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
686
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
687
+ readonly _tag: "Error";
688
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
689
+ readonly result: undefined;
690
+ } | {
675
691
  readonly _tag: "Result";
676
692
  readonly error: undefined;
677
693
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
678
694
  }>;
679
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
680
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
681
- } & {
682
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
683
- }> | {
695
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
684
696
  readonly _tag: "Result";
685
697
  readonly error: undefined;
686
698
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
687
- }>;
699
+ } | import("@aeriajs/types").Result.Error<{
700
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
701
+ } & {
702
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
703
+ }>>;
688
704
  readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
689
705
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
690
706
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
@@ -697,14 +713,18 @@ export declare const user: {
697
713
  readonly tempId: any;
698
714
  };
699
715
  }>;
700
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<{
716
+ readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
701
717
  readonly _tag: "Result";
702
718
  readonly error: undefined;
703
719
  readonly result: any;
704
720
  }>;
705
721
  readonly insert: (payload: {
706
722
  what: Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof description>>, "roles">;
707
- }, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
723
+ }, context: import("@aeriajs/types").Context<typeof description>) => Promise<{
724
+ readonly _tag: "Error";
725
+ readonly error: import("@aeriajs/types").ACError;
726
+ readonly result: undefined;
727
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
708
728
  readonly $id: "user";
709
729
  readonly icon: "users";
710
730
  readonly required: readonly ["name", "roles", "email"];
@@ -817,7 +837,7 @@ export declare const user: {
817
837
  }> | {
818
838
  readonly _tag: "Result";
819
839
  readonly error: undefined;
820
- readonly result: import("../../authentication.js").SuccessfulAuthentication | {
840
+ readonly result: {
821
841
  user: {
822
842
  _id: null;
823
843
  name: string;
@@ -830,6 +850,10 @@ export declare const user: {
830
850
  content: string;
831
851
  };
832
852
  };
853
+ } | {
854
+ readonly _tag: "Result";
855
+ readonly error: undefined;
856
+ readonly result: import("../../authentication.js").SuccessfulAuthentication;
833
857
  } | import("@aeriajs/types").Result.Error<{
834
858
  readonly code: import("../../authentication.js").AuthenticationError.InvalidCredentials;
835
859
  } & {
@@ -874,7 +898,7 @@ export declare const user: {
874
898
  readonly userId: any;
875
899
  };
876
900
  } | undefined>;
877
- readonly createAccount: (payload: Omit<import("@aeriajs/types").Schema<typeof description>, "roles">, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
901
+ readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof description>>, context: import("@aeriajs/types").Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
878
902
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
879
903
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
880
904
  } & {
@@ -2,7 +2,11 @@ import type { Context, SchemaWithId, PackReferences } from '@aeriajs/types';
2
2
  import type { description } from './description';
3
3
  export declare const insert: (payload: {
4
4
  what: Omit<PackReferences<SchemaWithId<typeof description>>, "roles">;
5
- }, context: Context<typeof description>) => Promise<import("@aeriajs/types").InsertReturnType<SchemaWithId<{
5
+ }, context: Context<typeof description>) => Promise<{
6
+ readonly _tag: "Error";
7
+ readonly error: import("@aeriajs/types").ACError;
8
+ readonly result: undefined;
9
+ } | import("@aeriajs/types").InsertReturnType<SchemaWithId<{
6
10
  readonly $id: "user";
7
11
  readonly icon: "users";
8
12
  readonly required: readonly ["name", "roles", "email"];
package/dist/index.d.ts CHANGED
@@ -66,7 +66,11 @@ export declare const collections: {
66
66
  what: {
67
67
  content: string;
68
68
  } & Pick<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, "_id" | "name" | "owner" | "absolute_path">;
69
- }, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
69
+ }, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
70
+ readonly _tag: "Error";
71
+ readonly error: import("@aeriajs/types").ACError;
72
+ readonly result: undefined;
73
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
70
74
  readonly $id: "file";
71
75
  readonly icon: "paperclip";
72
76
  readonly owned: "always";
@@ -126,24 +130,24 @@ export declare const collections: {
126
130
  } & {
127
131
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
128
132
  }> | import("fs").ReadStream>;
129
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
130
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
131
- } & {
132
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
133
- }> | {
133
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
134
134
  readonly _tag: "Result";
135
135
  readonly error: undefined;
136
136
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
137
- }>;
138
- readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
137
+ } | import("@aeriajs/types").Result.Error<{
139
138
  readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
140
139
  } & {
141
140
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
142
- }> | {
141
+ }>>;
142
+ readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
143
143
  readonly _tag: "Result";
144
144
  readonly error: undefined;
145
145
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
146
- }>;
146
+ } | import("@aeriajs/types").Result.Error<{
147
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
148
+ } & {
149
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
150
+ }>>;
147
151
  };
148
152
  exposedFunctions: {
149
153
  readonly get: "unauthenticated";
@@ -261,7 +265,11 @@ export declare const collections: {
261
265
  what: {
262
266
  content: string;
263
267
  } & Pick<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, "_id" | "name" | "owner" | "absolute_path">;
264
- }, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
268
+ }, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
269
+ readonly _tag: "Error";
270
+ readonly error: import("@aeriajs/types").ACError;
271
+ readonly result: undefined;
272
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
265
273
  readonly $id: "file";
266
274
  readonly icon: "paperclip";
267
275
  readonly owned: "always";
@@ -321,24 +329,24 @@ export declare const collections: {
321
329
  } & {
322
330
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
323
331
  }> | import("fs").ReadStream>;
324
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
325
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
326
- } & {
327
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
328
- }> | {
332
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<typeof import("./collections/file/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
329
333
  readonly _tag: "Result";
330
334
  readonly error: undefined;
331
335
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
332
- }>;
333
- readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
336
+ } | import("@aeriajs/types").Result.Error<{
334
337
  readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
335
338
  } & {
336
339
  httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
337
- }> | {
340
+ }>>;
341
+ readonly removeAll: (payload: import("@aeriajs/types").RemoveAllPayload, context: import("@aeriajs/types").Context<typeof import("./collections/file/description.js").description>) => Promise<{
338
342
  readonly _tag: "Result";
339
343
  readonly error: undefined;
340
344
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
341
- }>;
345
+ } | import("@aeriajs/types").Result.Error<{
346
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
347
+ } & {
348
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
349
+ }>>;
342
350
  };
343
351
  contracts: {
344
352
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -475,12 +483,20 @@ export declare const collections: {
475
483
  };
476
484
  functions: {
477
485
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
478
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
486
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
487
+ readonly _tag: "Error";
488
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
489
+ readonly result: undefined;
490
+ } | {
479
491
  readonly _tag: "Result";
480
492
  readonly error: undefined;
481
493
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
482
494
  }>;
483
- readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
495
+ readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<{
496
+ readonly _tag: "Error";
497
+ readonly error: import("@aeriajs/types").ACError;
498
+ readonly result: undefined;
499
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
484
500
  };
485
501
  exposedFunctions: {
486
502
  readonly get: true;
@@ -544,12 +560,20 @@ export declare const collections: {
544
560
  };
545
561
  functions: {
546
562
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
547
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
563
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
564
+ readonly _tag: "Error";
565
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
566
+ readonly result: undefined;
567
+ } | {
548
568
  readonly _tag: "Result";
549
569
  readonly error: undefined;
550
570
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
551
571
  }>;
552
- readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
572
+ readonly insert: (payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").InsertOptions) => Promise<{
573
+ readonly _tag: "Error";
574
+ readonly error: import("@aeriajs/types").ACError;
575
+ readonly result: undefined;
576
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
553
577
  };
554
578
  contracts: {
555
579
  readonly get?: import("@aeriajs/types").Contract | undefined;
@@ -772,20 +796,24 @@ export declare const collections: {
772
796
  };
773
797
  functions: {
774
798
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
775
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
799
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
800
+ readonly _tag: "Error";
801
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
802
+ readonly result: undefined;
803
+ } | {
776
804
  readonly _tag: "Result";
777
805
  readonly error: undefined;
778
806
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
779
807
  }>;
780
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
781
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
782
- } & {
783
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
784
- }> | {
808
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
785
809
  readonly _tag: "Result";
786
810
  readonly error: undefined;
787
811
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
788
- }>;
812
+ } | import("@aeriajs/types").Result.Error<{
813
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
814
+ } & {
815
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
816
+ }>>;
789
817
  readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
790
818
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
791
819
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
@@ -798,14 +826,18 @@ export declare const collections: {
798
826
  readonly tempId: any;
799
827
  };
800
828
  }>;
801
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<{
829
+ readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
802
830
  readonly _tag: "Result";
803
831
  readonly error: undefined;
804
832
  readonly result: any;
805
833
  }>;
806
834
  readonly insert: (payload: {
807
835
  what: Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, "roles">;
808
- }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
836
+ }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
837
+ readonly _tag: "Error";
838
+ readonly error: import("@aeriajs/types").ACError;
839
+ readonly result: undefined;
840
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
809
841
  readonly $id: "user";
810
842
  readonly icon: "users";
811
843
  readonly required: readonly ["name", "roles", "email"];
@@ -918,7 +950,7 @@ export declare const collections: {
918
950
  }> | {
919
951
  readonly _tag: "Result";
920
952
  readonly error: undefined;
921
- readonly result: import("./authentication.js").SuccessfulAuthentication | {
953
+ readonly result: {
922
954
  user: {
923
955
  _id: null;
924
956
  name: string;
@@ -931,6 +963,10 @@ export declare const collections: {
931
963
  content: string;
932
964
  };
933
965
  };
966
+ } | {
967
+ readonly _tag: "Result";
968
+ readonly error: undefined;
969
+ readonly result: import("./authentication.js").SuccessfulAuthentication;
934
970
  } | import("@aeriajs/types").Result.Error<{
935
971
  readonly code: import("./authentication.js").AuthenticationError.InvalidCredentials;
936
972
  } & {
@@ -975,7 +1011,7 @@ export declare const collections: {
975
1011
  readonly userId: any;
976
1012
  };
977
1013
  } | undefined>;
978
- readonly createAccount: (payload: Omit<import("@aeriajs/types").Schema<typeof import("./collections/user/description.js").description>, "roles">, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
1014
+ readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
979
1015
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
980
1016
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
981
1017
  } & {
@@ -1341,20 +1377,24 @@ export declare const collections: {
1341
1377
  };
1342
1378
  functions: {
1343
1379
  readonly get: (payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetOptions) => Promise<import("@aeriajs/types").GetReturnType<import("@aeriajs/types").SchemaWithId<any>>>;
1344
- readonly getAll: (_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
1380
+ readonly getAll: (payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").GetAllOptions) => Promise<{
1381
+ readonly _tag: "Error";
1382
+ readonly error: import("@aeriajs/types").ACError.InvalidLimit;
1383
+ readonly result: undefined;
1384
+ } | {
1345
1385
  readonly _tag: "Result";
1346
1386
  readonly error: undefined;
1347
1387
  readonly result: import("@aeriajs/types").SchemaWithId<any>[];
1348
1388
  }>;
1349
- readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
1350
- readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
1351
- } & {
1352
- httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1353
- }> | {
1389
+ readonly remove: (payload: import("@aeriajs/types").RemovePayload<import("@aeriajs/types").SchemaWithId<any>>, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveOptions) => Promise<{
1354
1390
  readonly _tag: "Result";
1355
1391
  readonly error: undefined;
1356
1392
  readonly result: import("mongodb").WithId<Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<import("@aeriajs/types").Description>>, "_id">> | null;
1357
- }>;
1393
+ } | import("@aeriajs/types").Result.Error<{
1394
+ readonly code: import("@aeriajs/types").ACError.ResourceNotFound;
1395
+ } & {
1396
+ httpStatus: import("@aeriajs/types").HTTPStatus.NotFound;
1397
+ }>>;
1358
1398
  readonly upload: (_props: unknown, context: import("@aeriajs/types").StrictContext<any>) => Promise<import("@aeriajs/types").Result.Error<{
1359
1399
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
1360
1400
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
@@ -1367,14 +1407,18 @@ export declare const collections: {
1367
1407
  readonly tempId: any;
1368
1408
  };
1369
1409
  }>;
1370
- readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>) => Promise<{
1410
+ readonly removeFile: (payload: import("@aeriajs/types").RemoveFilePayload, context: import("@aeriajs/types").StrictContext<any>, options?: import("@aeriajs/core").RemoveFileOptions) => Promise<{
1371
1411
  readonly _tag: "Result";
1372
1412
  readonly error: undefined;
1373
1413
  readonly result: any;
1374
1414
  }>;
1375
1415
  readonly insert: (payload: {
1376
1416
  what: Omit<import("@aeriajs/types").PackReferences<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, "roles">;
1377
- }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
1417
+ }, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<{
1418
+ readonly _tag: "Error";
1419
+ readonly error: import("@aeriajs/types").ACError;
1420
+ readonly result: undefined;
1421
+ } | import("@aeriajs/types").InsertReturnType<import("@aeriajs/types").SchemaWithId<{
1378
1422
  readonly $id: "user";
1379
1423
  readonly icon: "users";
1380
1424
  readonly required: readonly ["name", "roles", "email"];
@@ -1487,7 +1531,7 @@ export declare const collections: {
1487
1531
  }> | {
1488
1532
  readonly _tag: "Result";
1489
1533
  readonly error: undefined;
1490
- readonly result: import("./authentication.js").SuccessfulAuthentication | {
1534
+ readonly result: {
1491
1535
  user: {
1492
1536
  _id: null;
1493
1537
  name: string;
@@ -1500,6 +1544,10 @@ export declare const collections: {
1500
1544
  content: string;
1501
1545
  };
1502
1546
  };
1547
+ } | {
1548
+ readonly _tag: "Result";
1549
+ readonly error: undefined;
1550
+ readonly result: import("./authentication.js").SuccessfulAuthentication;
1503
1551
  } | import("@aeriajs/types").Result.Error<{
1504
1552
  readonly code: import("./authentication.js").AuthenticationError.InvalidCredentials;
1505
1553
  } & {
@@ -1544,7 +1592,7 @@ export declare const collections: {
1544
1592
  readonly userId: any;
1545
1593
  };
1546
1594
  } | undefined>;
1547
- readonly createAccount: (payload: Omit<import("@aeriajs/types").Schema<typeof import("./collections/user/description.js").description>, "roles">, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
1595
+ readonly createAccount: (payload: Partial<import("@aeriajs/types").SchemaWithId<typeof import("./collections/user/description.js").description>>, context: import("@aeriajs/types").Context<typeof import("./collections/user/description.js").description>) => Promise<import("@aeriajs/types").Result.Error<{
1548
1596
  readonly code: import("@aeriajs/types").ACError.MalformedInput;
1549
1597
  readonly details: import("@aeriajs/types").ValidationError | import("@aeriajs/types").PropertyValidationError;
1550
1598
  } & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/builtins",
3
- "version": "0.0.136",
3
+ "version": "0.0.138",
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.136",
49
- "@aeriajs/common": "^0.0.85",
50
- "@aeriajs/entrypoint": "^0.0.87",
51
- "@aeriajs/types": "^0.0.73",
52
- "@aeriajs/validation": "^0.0.88"
48
+ "@aeriajs/core": "^0.0.138",
49
+ "@aeriajs/common": "^0.0.87",
50
+ "@aeriajs/entrypoint": "^0.0.89",
51
+ "@aeriajs/types": "^0.0.75",
52
+ "@aeriajs/validation": "^0.0.90"
53
53
  },
54
54
  "scripts": {
55
55
  "test": "echo skipping",