@aeriajs/builtins 0.0.256 → 0.0.258

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 (40) hide show
  1. package/dist/collections/file/download.d.ts +56 -16
  2. package/dist/collections/file/download.js +40 -1
  3. package/dist/collections/file/download.mjs +40 -1
  4. package/dist/collections/file/index.d.ts +461 -20
  5. package/dist/collections/file/index.js +3 -0
  6. package/dist/collections/file/index.mjs +4 -1
  7. package/dist/collections/file/remove.d.ts +2 -2
  8. package/dist/collections/user/activate.d.ts +67 -33
  9. package/dist/collections/user/activate.js +45 -1
  10. package/dist/collections/user/activate.mjs +45 -1
  11. package/dist/collections/user/authenticate.d.ts +136 -41
  12. package/dist/collections/user/authenticate.js +98 -2
  13. package/dist/collections/user/authenticate.mjs +98 -2
  14. package/dist/collections/user/createAccount.d.ts +124 -111
  15. package/dist/collections/user/createAccount.js +27 -1
  16. package/dist/collections/user/createAccount.mjs +27 -1
  17. package/dist/collections/user/editProfile.d.ts +95 -103
  18. package/dist/collections/user/editProfile.js +21 -1
  19. package/dist/collections/user/editProfile.mjs +21 -1
  20. package/dist/collections/user/getActivationLink.d.ts +92 -60
  21. package/dist/collections/user/getActivationLink.js +39 -4
  22. package/dist/collections/user/getActivationLink.mjs +39 -3
  23. package/dist/collections/user/getCurrentUser.d.ts +43 -113
  24. package/dist/collections/user/getCurrentUser.js +31 -1
  25. package/dist/collections/user/getCurrentUser.mjs +31 -1
  26. package/dist/collections/user/getInfo.d.ts +71 -26
  27. package/dist/collections/user/getInfo.js +47 -1
  28. package/dist/collections/user/getInfo.mjs +47 -1
  29. package/dist/collections/user/getRedefinePasswordLink.d.ts +91 -55
  30. package/dist/collections/user/getRedefinePasswordLink.js +32 -2
  31. package/dist/collections/user/getRedefinePasswordLink.mjs +33 -3
  32. package/dist/collections/user/index.d.ts +3493 -619
  33. package/dist/collections/user/index.js +9 -21
  34. package/dist/collections/user/index.mjs +18 -30
  35. package/dist/collections/user/redefinePassword.d.ts +98 -34
  36. package/dist/collections/user/redefinePassword.js +51 -6
  37. package/dist/collections/user/redefinePassword.mjs +51 -6
  38. package/dist/functions/describe.d.ts +38 -12
  39. package/dist/index.d.ts +4427 -1112
  40. package/package.json +6 -6
@@ -1,19 +1,59 @@
1
- import type { Context } from '@aeriajs/types';
2
- import type { description } from './description.js';
3
- import * as fs from 'node:fs';
1
+ import type { Context, ContractToFunction } from '@aeriajs/types';
2
+ import { type description } from './description.js';
4
3
  export declare const DownloadError: {
5
4
  readonly RangeNotSatisfiable: "RANGE_NOT_SATISFIABLE";
6
5
  };
7
- export declare const download: (payload: {
8
- fileId: string;
9
- options: readonly ("picture" | "download")[];
10
- noHeaders?: boolean;
11
- }, context: Context<typeof description>) => Promise<import("@aeriajs/types").Result.Error<{
12
- readonly code: "RESOURCE_NOT_FOUND";
13
- } & {
14
- httpStatus: 404;
15
- }> | import("@aeriajs/types").Result.Error<{
16
- readonly code: "RANGE_NOT_SATISFIABLE";
17
- } & {
18
- httpStatus: 416;
19
- }> | fs.ReadStream>;
6
+ export declare const downloadContract: {
7
+ readonly payload: {
8
+ readonly type: "object";
9
+ readonly required: readonly ["fileId"];
10
+ readonly properties: {
11
+ readonly fileId: {
12
+ readonly type: "string";
13
+ };
14
+ readonly options: {
15
+ readonly type: "array";
16
+ readonly items: {
17
+ readonly enum: readonly ["picture", "download"];
18
+ };
19
+ };
20
+ readonly noHeaders: {
21
+ readonly type: "boolean";
22
+ };
23
+ };
24
+ };
25
+ readonly response: [{
26
+ readonly type: "object";
27
+ readonly properties: {
28
+ readonly _tag: {
29
+ readonly const: "Error";
30
+ };
31
+ readonly result: {
32
+ readonly const: undefined;
33
+ };
34
+ readonly error: {
35
+ readonly type: "object";
36
+ readonly required: readonly ["httpStatus", "code"];
37
+ readonly properties: {
38
+ readonly httpStatus: {
39
+ readonly enum: [404, 416];
40
+ };
41
+ readonly code: {
42
+ readonly enum: ["RESOURCE_NOT_FOUND", "RANGE_NOT_SATISFIABLE"];
43
+ };
44
+ readonly message: {
45
+ readonly type: "string";
46
+ };
47
+ readonly details: {
48
+ readonly type: "object";
49
+ readonly additionalProperties: true;
50
+ };
51
+ };
52
+ };
53
+ };
54
+ }, {
55
+ readonly type: "object";
56
+ readonly additionalProperties: true;
57
+ }];
58
+ };
59
+ export declare const download: ContractToFunction<typeof downloadContract, Context<typeof description>>;
@@ -1,12 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.download = exports.DownloadError = void 0;
3
+ exports.download = exports.downloadContract = exports.DownloadError = void 0;
4
4
  const types_1 = require("@aeriajs/types");
5
5
  const core_1 = require("@aeriajs/core");
6
6
  const fs = require("node:fs");
7
7
  exports.DownloadError = {
8
8
  RangeNotSatisfiable: 'RANGE_NOT_SATISFIABLE',
9
9
  };
10
+ exports.downloadContract = (0, types_1.defineContract)({
11
+ payload: {
12
+ type: 'object',
13
+ required: ['fileId'],
14
+ properties: {
15
+ fileId: {
16
+ type: 'string',
17
+ },
18
+ options: {
19
+ type: 'array',
20
+ items: {
21
+ enum: [
22
+ 'picture',
23
+ 'download',
24
+ ],
25
+ },
26
+ },
27
+ noHeaders: {
28
+ type: 'boolean',
29
+ },
30
+ },
31
+ },
32
+ response: [
33
+ (0, types_1.endpointErrorSchema)({
34
+ httpStatus: [
35
+ types_1.HTTPStatus.NotFound,
36
+ types_1.HTTPStatus.RangeNotSatisfiable,
37
+ ],
38
+ code: [
39
+ types_1.ACError.ResourceNotFound,
40
+ exports.DownloadError.RangeNotSatisfiable,
41
+ ],
42
+ }),
43
+ {
44
+ type: 'object',
45
+ additionalProperties: true,
46
+ },
47
+ ],
48
+ });
10
49
  const download = async (payload, context) => {
11
50
  const { fileId, options = [] } = payload;
12
51
  const file = await context.collection.model.findOne({
@@ -1,10 +1,49 @@
1
1
  "use strict";
2
- import { HTTPStatus, ACError } from "@aeriajs/types";
2
+ import { HTTPStatus, ACError, defineContract, endpointErrorSchema } from "@aeriajs/types";
3
3
  import { ObjectId } from "@aeriajs/core";
4
4
  import * as fs from "node:fs";
5
5
  export const DownloadError = {
6
6
  RangeNotSatisfiable: "RANGE_NOT_SATISFIABLE"
7
7
  };
8
+ export const downloadContract = defineContract({
9
+ payload: {
10
+ type: "object",
11
+ required: ["fileId"],
12
+ properties: {
13
+ fileId: {
14
+ type: "string"
15
+ },
16
+ options: {
17
+ type: "array",
18
+ items: {
19
+ enum: [
20
+ "picture",
21
+ "download"
22
+ ]
23
+ }
24
+ },
25
+ noHeaders: {
26
+ type: "boolean"
27
+ }
28
+ }
29
+ },
30
+ response: [
31
+ endpointErrorSchema({
32
+ httpStatus: [
33
+ HTTPStatus.NotFound,
34
+ HTTPStatus.RangeNotSatisfiable
35
+ ],
36
+ code: [
37
+ ACError.ResourceNotFound,
38
+ DownloadError.RangeNotSatisfiable
39
+ ]
40
+ }),
41
+ {
42
+ type: "object",
43
+ additionalProperties: true
44
+ }
45
+ ]
46
+ });
8
47
  export const download = async (payload, context) => {
9
48
  const { fileId, options = [] } = payload;
10
49
  const file = await context.collection.model.findOne({