@aeriajs/builtins 0.0.62 → 0.0.64

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 (39) hide show
  1. package/dist/collections/file/description.d.ts +1 -1
  2. package/dist/collections/file/description.js +3 -3
  3. package/dist/collections/file/description.mjs +2 -2
  4. package/dist/collections/file/download.js +2 -2
  5. package/dist/collections/file/download.mjs +1 -1
  6. package/dist/collections/file/index.d.ts +21 -23
  7. package/dist/collections/file/index.js +4 -4
  8. package/dist/collections/file/index.mjs +1 -1
  9. package/dist/collections/file/insert.d.ts +1 -1
  10. package/dist/collections/file/insert.js +2 -2
  11. package/dist/collections/file/insert.mjs +1 -1
  12. package/dist/collections/file/remove.js +2 -2
  13. package/dist/collections/file/remove.mjs +1 -1
  14. package/dist/collections/file/removeAll.js +2 -2
  15. package/dist/collections/file/removeAll.mjs +1 -1
  16. package/dist/collections/log/index.d.ts +7 -8
  17. package/dist/collections/log/index.js +5 -5
  18. package/dist/collections/log/index.mjs +1 -1
  19. package/dist/collections/resourceUsage/index.d.ts +1 -2
  20. package/dist/collections/resourceUsage/index.js +2 -2
  21. package/dist/collections/resourceUsage/index.mjs +1 -1
  22. package/dist/collections/user/activate.js +2 -2
  23. package/dist/collections/user/activate.mjs +1 -1
  24. package/dist/collections/user/authenticate.d.ts +1 -1
  25. package/dist/collections/user/authenticate.js +3 -3
  26. package/dist/collections/user/authenticate.mjs +1 -1
  27. package/dist/collections/user/description.js +2 -2
  28. package/dist/collections/user/description.mjs +1 -1
  29. package/dist/collections/user/getInfo.js +2 -2
  30. package/dist/collections/user/getInfo.mjs +1 -1
  31. package/dist/collections/user/index.d.ts +10 -11
  32. package/dist/collections/user/index.js +7 -7
  33. package/dist/collections/user/index.mjs +1 -1
  34. package/dist/collections/user/insert.js +2 -2
  35. package/dist/collections/user/insert.mjs +1 -1
  36. package/dist/functions/describe.js +4 -4
  37. package/dist/functions/describe.mjs +1 -1
  38. package/dist/index.d.ts +39 -44
  39. package/package.json +13 -13
@@ -2,7 +2,7 @@ export declare const description: {
2
2
  readonly $id: "file";
3
3
  readonly owned: "always";
4
4
  readonly presets: readonly ["owned"];
5
- readonly indexes: readonly ["name", "link", "mime"];
5
+ readonly indexes: readonly ["name", "link", "type"];
6
6
  readonly properties: {
7
7
  readonly type: {
8
8
  readonly type: "string";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.description = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const entrypoint_1 = require("@aeriajs/entrypoint");
6
6
  const link = async (_id) => {
7
7
  const config = await (0, entrypoint_1.getConfig)();
@@ -10,14 +10,14 @@ const link = async (_id) => {
10
10
  const timestamp = (lastModified) => lastModified
11
11
  ? new Date(lastModified).getTime()
12
12
  : 'fresh';
13
- exports.description = (0, api_1.defineDescription)({
13
+ exports.description = (0, core_1.defineDescription)({
14
14
  $id: 'file',
15
15
  owned: 'always',
16
16
  presets: ['owned'],
17
17
  indexes: [
18
18
  'name',
19
19
  'link',
20
- 'mime',
20
+ 'type',
21
21
  ],
22
22
  properties: {
23
23
  type: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineDescription } from "@aeriajs/api";
2
+ import { defineDescription } from "@aeriajs/core";
3
3
  import { getConfig } from "@aeriajs/entrypoint";
4
4
  const link = async (_id) => {
5
5
  const config = await getConfig();
@@ -13,7 +13,7 @@ export const description = defineDescription({
13
13
  indexes: [
14
14
  "name",
15
15
  "link",
16
- "mime"
16
+ "type"
17
17
  ],
18
18
  properties: {
19
19
  type: {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.download = exports.FileReadError = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  var FileReadError;
@@ -15,7 +15,7 @@ var FileReadError;
15
15
  const download = async (payload, context) => {
16
16
  const { fileId, options = [] } = payload;
17
17
  const file = await context.collection.model.findOne({
18
- _id: new api_1.ObjectId(fileId),
18
+ _id: new core_1.ObjectId(fileId),
19
19
  }, {
20
20
  projection: {
21
21
  absolute_path: 1,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { ObjectId } from "@aeriajs/api";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left } from "@aeriajs/common";
4
4
  import fs from "fs";
5
5
  export var FileReadError = /* @__PURE__ */ ((FileReadError2) => {
@@ -28,7 +28,7 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
28
28
  };
29
29
  };
30
30
  };
31
- }>, "description" | "functions" | "item"> & {
31
+ }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
32
32
  item: import("@aeriajs/types").SchemaWithId<{
33
33
  readonly $id: "tempFile";
34
34
  readonly temporary: {
@@ -89,14 +89,13 @@ export declare const tempFile: Omit<import("@aeriajs/types").Collection<{
89
89
  functionContracts: {
90
90
  [x: string]: import("@aeriajs/types").Contract | undefined;
91
91
  };
92
- accessControl: import("@aeriajs/types").AccessControl;
93
92
  };
94
93
  export declare const file: Omit<import("@aeriajs/types").Collection<{
95
94
  description: {
96
95
  readonly $id: "file";
97
96
  readonly owned: "always";
98
97
  readonly presets: readonly ["owned"];
99
- readonly indexes: readonly ["name", "link", "mime"];
98
+ readonly indexes: readonly ["name", "link", "type"];
100
99
  readonly properties: {
101
100
  readonly type: {
102
101
  readonly type: "string";
@@ -143,7 +142,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
143
142
  };
144
143
  };
145
144
  functions: {
146
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
145
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
147
146
  readonly insert: (payload: {
148
147
  what: {
149
148
  content: string;
@@ -151,7 +150,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
151
150
  readonly $id: "file";
152
151
  readonly owned: "always";
153
152
  readonly presets: readonly ["owned"];
154
- readonly indexes: readonly ["name", "link", "mime"];
153
+ readonly indexes: readonly ["name", "link", "type"];
155
154
  readonly properties: {
156
155
  readonly type: {
157
156
  readonly type: "string";
@@ -201,7 +200,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
201
200
  readonly $id: "file";
202
201
  readonly owned: "always";
203
202
  readonly presets: readonly ["owned"];
204
- readonly indexes: readonly ["name", "link", "mime"];
203
+ readonly indexes: readonly ["name", "link", "type"];
205
204
  readonly properties: {
206
205
  readonly type: {
207
206
  readonly type: "string";
@@ -250,7 +249,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
250
249
  readonly $id: "file";
251
250
  readonly owned: "always";
252
251
  readonly presets: readonly ["owned"];
253
- readonly indexes: readonly ["name", "link", "mime"];
252
+ readonly indexes: readonly ["name", "link", "type"];
254
253
  readonly properties: {
255
254
  readonly type: {
256
255
  readonly type: "string";
@@ -304,7 +303,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
304
303
  readonly $id: "file";
305
304
  readonly owned: "always";
306
305
  readonly presets: readonly ["owned"];
307
- readonly indexes: readonly ["name", "link", "mime"];
306
+ readonly indexes: readonly ["name", "link", "type"];
308
307
  readonly properties: {
309
308
  readonly type: {
310
309
  readonly type: "string";
@@ -354,7 +353,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
354
353
  readonly $id: "file";
355
354
  readonly owned: "always";
356
355
  readonly presets: readonly ["owned"];
357
- readonly indexes: readonly ["name", "link", "mime"];
356
+ readonly indexes: readonly ["name", "link", "type"];
358
357
  readonly properties: {
359
358
  readonly type: {
360
359
  readonly type: "string";
@@ -403,7 +402,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
403
402
  readonly $id: "file";
404
403
  readonly owned: "always";
405
404
  readonly presets: readonly ["owned"];
406
- readonly indexes: readonly ["name", "link", "mime"];
405
+ readonly indexes: readonly ["name", "link", "type"];
407
406
  readonly properties: {
408
407
  readonly type: {
409
408
  readonly type: "string";
@@ -453,7 +452,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
453
452
  readonly $id: "file";
454
453
  readonly owned: "always";
455
454
  readonly presets: readonly ["owned"];
456
- readonly indexes: readonly ["name", "link", "mime"];
455
+ readonly indexes: readonly ["name", "link", "type"];
457
456
  readonly properties: {
458
457
  readonly type: {
459
458
  readonly type: "string";
@@ -500,12 +499,12 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
500
499
  };
501
500
  }>) => Promise<any>;
502
501
  };
503
- }>, "description" | "functions" | "item"> & {
502
+ }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
504
503
  item: import("@aeriajs/types").SchemaWithId<{
505
504
  readonly $id: "file";
506
505
  readonly owned: "always";
507
506
  readonly presets: readonly ["owned"];
508
- readonly indexes: readonly ["name", "link", "mime"];
507
+ readonly indexes: readonly ["name", "link", "type"];
509
508
  readonly properties: {
510
509
  readonly type: {
511
510
  readonly type: "string";
@@ -555,7 +554,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
555
554
  readonly $id: "file";
556
555
  readonly owned: "always";
557
556
  readonly presets: readonly ["owned"];
558
- readonly indexes: readonly ["name", "link", "mime"];
557
+ readonly indexes: readonly ["name", "link", "type"];
559
558
  readonly properties: {
560
559
  readonly type: {
561
560
  readonly type: "string";
@@ -602,7 +601,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
602
601
  };
603
602
  };
604
603
  functions: {
605
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
604
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
606
605
  readonly insert: (payload: {
607
606
  what: {
608
607
  content: string;
@@ -610,7 +609,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
610
609
  readonly $id: "file";
611
610
  readonly owned: "always";
612
611
  readonly presets: readonly ["owned"];
613
- readonly indexes: readonly ["name", "link", "mime"];
612
+ readonly indexes: readonly ["name", "link", "type"];
614
613
  readonly properties: {
615
614
  readonly type: {
616
615
  readonly type: "string";
@@ -660,7 +659,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
660
659
  readonly $id: "file";
661
660
  readonly owned: "always";
662
661
  readonly presets: readonly ["owned"];
663
- readonly indexes: readonly ["name", "link", "mime"];
662
+ readonly indexes: readonly ["name", "link", "type"];
664
663
  readonly properties: {
665
664
  readonly type: {
666
665
  readonly type: "string";
@@ -709,7 +708,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
709
708
  readonly $id: "file";
710
709
  readonly owned: "always";
711
710
  readonly presets: readonly ["owned"];
712
- readonly indexes: readonly ["name", "link", "mime"];
711
+ readonly indexes: readonly ["name", "link", "type"];
713
712
  readonly properties: {
714
713
  readonly type: {
715
714
  readonly type: "string";
@@ -763,7 +762,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
763
762
  readonly $id: "file";
764
763
  readonly owned: "always";
765
764
  readonly presets: readonly ["owned"];
766
- readonly indexes: readonly ["name", "link", "mime"];
765
+ readonly indexes: readonly ["name", "link", "type"];
767
766
  readonly properties: {
768
767
  readonly type: {
769
768
  readonly type: "string";
@@ -813,7 +812,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
813
812
  readonly $id: "file";
814
813
  readonly owned: "always";
815
814
  readonly presets: readonly ["owned"];
816
- readonly indexes: readonly ["name", "link", "mime"];
815
+ readonly indexes: readonly ["name", "link", "type"];
817
816
  readonly properties: {
818
817
  readonly type: {
819
818
  readonly type: "string";
@@ -862,7 +861,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
862
861
  readonly $id: "file";
863
862
  readonly owned: "always";
864
863
  readonly presets: readonly ["owned"];
865
- readonly indexes: readonly ["name", "link", "mime"];
864
+ readonly indexes: readonly ["name", "link", "type"];
866
865
  readonly properties: {
867
866
  readonly type: {
868
867
  readonly type: "string";
@@ -912,7 +911,7 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
912
911
  readonly $id: "file";
913
912
  readonly owned: "always";
914
913
  readonly presets: readonly ["owned"];
915
- readonly indexes: readonly ["name", "link", "mime"];
914
+ readonly indexes: readonly ["name", "link", "type"];
916
915
  readonly properties: {
917
916
  readonly type: {
918
917
  readonly type: "string";
@@ -966,5 +965,4 @@ export declare const file: Omit<import("@aeriajs/types").Collection<{
966
965
  readonly remove?: import("@aeriajs/types").Contract | undefined;
967
966
  readonly removeAll?: import("@aeriajs/types").Contract | undefined;
968
967
  };
969
- accessControl: import("@aeriajs/types").AccessControl;
970
968
  };
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.file = exports.tempFile = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  const description_js_1 = require("./description.js");
6
6
  const insert_js_1 = require("./insert.js");
7
7
  const download_js_1 = require("./download.js");
8
8
  const remove_js_1 = require("./remove.js");
9
9
  const removeAll_js_1 = require("./removeAll.js");
10
- exports.tempFile = (0, api_1.defineCollection)({
10
+ exports.tempFile = (0, core_1.defineCollection)({
11
11
  description: {
12
12
  $id: 'tempFile',
13
13
  temporary: {
@@ -37,10 +37,10 @@ exports.tempFile = (0, api_1.defineCollection)({
37
37
  },
38
38
  },
39
39
  });
40
- exports.file = (0, api_1.defineCollection)({
40
+ exports.file = (0, core_1.defineCollection)({
41
41
  description: description_js_1.description,
42
42
  functions: {
43
- get: api_1.get,
43
+ get: core_1.get,
44
44
  insert: insert_js_1.insert,
45
45
  download: download_js_1.download,
46
46
  remove: remove_js_1.remove,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection, get } from "@aeriajs/api";
2
+ import { defineCollection, get } from "@aeriajs/core";
3
3
  import { description } from "./description.mjs";
4
4
  import { insert } from "./insert.mjs";
5
5
  import { download } from "./download.mjs";
@@ -8,7 +8,7 @@ export declare const insert: (payload: {
8
8
  readonly $id: "file";
9
9
  readonly owned: "always";
10
10
  readonly presets: readonly ["owned"];
11
- readonly indexes: readonly ["name", "link", "mime"];
11
+ readonly indexes: readonly ["name", "link", "type"];
12
12
  readonly properties: {
13
13
  readonly type: {
14
14
  readonly type: "string";
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.insert = void 0;
4
4
  const crypto_1 = require("crypto");
5
5
  const promises_1 = require("fs/promises");
6
- const api_1 = require("@aeriajs/api");
6
+ const core_1 = require("@aeriajs/core");
7
7
  const insert = async (payload, context) => {
8
8
  if (!context.token.authenticated) {
9
9
  throw new Error('');
@@ -36,7 +36,7 @@ const insert = async (payload, context) => {
36
36
  .digest('hex');
37
37
  what.absolute_path = `${tempPath}/${filenameHash}.${extension}`;
38
38
  await (0, promises_1.writeFile)(what.absolute_path, Buffer.from(what.content.split(',').pop(), 'base64'));
39
- return (0, api_1.insert)({
39
+ return (0, core_1.insert)({
40
40
  ...payload,
41
41
  what,
42
42
  }, context);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  import { createHash } from "crypto";
3
3
  import { writeFile, unlink } from "fs/promises";
4
- import { insert as originalInsert } from "@aeriajs/api";
4
+ import { insert as originalInsert } from "@aeriajs/core";
5
5
  export const insert = async (payload, context) => {
6
6
  if (!context.token.authenticated) {
7
7
  throw new Error("");
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.remove = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const promises_1 = __importDefault(require("fs/promises"));
9
9
  const remove = async (payload, context) => {
10
10
  const file = await context.collection.model.findOne({
@@ -23,6 +23,6 @@ const remove = async (payload, context) => {
23
23
  catch (err) {
24
24
  console.trace(err);
25
25
  }
26
- return (0, api_1.remove)(payload, context);
26
+ return (0, core_1.remove)(payload, context);
27
27
  };
28
28
  exports.remove = remove;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { remove as originalRemove } from "@aeriajs/api";
2
+ import { remove as originalRemove } from "@aeriajs/core";
3
3
  import fs from "fs/promises";
4
4
  export const remove = async (payload, context) => {
5
5
  const file = await context.collection.model.findOne({
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.removeAll = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const promises_1 = __importDefault(require("fs/promises"));
9
9
  const removeAll = async (payload, context) => {
10
10
  const files = context.collection.model.find({
@@ -25,6 +25,6 @@ const removeAll = async (payload, context) => {
25
25
  console.trace(err);
26
26
  }
27
27
  }
28
- return (0, api_1.removeAll)(payload, context);
28
+ return (0, core_1.removeAll)(payload, context);
29
29
  };
30
30
  exports.removeAll = removeAll;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { removeAll as originalRemoveAll } from "@aeriajs/api";
2
+ import { removeAll as originalRemoveAll } from "@aeriajs/core";
3
3
  import fs from "fs/promises";
4
4
  export const removeAll = async (payload, context) => {
5
5
  const files = context.collection.model.find({
@@ -27,11 +27,11 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
27
27
  readonly filters: readonly ["context", "message", "owner"];
28
28
  };
29
29
  functions: {
30
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
31
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
32
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
30
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
31
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
32
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
33
33
  };
34
- }>, "description" | "functions" | "item"> & {
34
+ }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
35
35
  item: import("@aeriajs/types").SchemaWithId<{
36
36
  readonly $id: "log";
37
37
  readonly required: readonly ["context", "message"];
@@ -87,14 +87,13 @@ export declare const log: Omit<import("@aeriajs/types").Collection<{
87
87
  readonly filters: readonly ["context", "message", "owner"];
88
88
  };
89
89
  functions: {
90
- readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/api").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
91
- readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/api").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
92
- readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/api").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
90
+ readonly get: <TContext extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").GetPayload<import("@aeriajs/types").SchemaWithId<TContext["description"]>>, context: TContext extends import("@aeriajs/types").Context<any> ? TContext : never, options?: import("@aeriajs/core").GetOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext["description"]> | null>;
91
+ readonly getAll: <TContext_1 extends import("@aeriajs/types").Context>(_payload: import("@aeriajs/types").GetAllPayload<import("@aeriajs/types").SchemaWithId<any>> | undefined, context: TContext_1, options?: import("@aeriajs/core").GetAllOptions | undefined) => Promise<import("@aeriajs/types").SchemaWithId<TContext_1["description"]>[]>;
92
+ readonly insert: <TContext_2 extends import("@aeriajs/types").Context>(payload: import("@aeriajs/types").InsertPayload<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>, context: TContext_2, options?: import("@aeriajs/core").InsertOptions | undefined) => Promise<import("@aeriajs/types").Left<import("@aeriajs/types").ACErrors | import("@aeriajs/types").ValidationError> | import("@aeriajs/types").Right<import("@aeriajs/types").SchemaWithId<TContext_2["description"]>>>;
93
93
  };
94
94
  functionContracts: {
95
95
  readonly get?: import("@aeriajs/types").Contract | undefined;
96
96
  readonly getAll?: import("@aeriajs/types").Contract | undefined;
97
97
  readonly insert?: import("@aeriajs/types").Contract | undefined;
98
98
  };
99
- accessControl: import("@aeriajs/types").AccessControl;
100
99
  };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.log = void 0;
4
- const api_1 = require("@aeriajs/api");
5
- exports.log = (0, api_1.defineCollection)({
4
+ const core_1 = require("@aeriajs/core");
5
+ exports.log = (0, core_1.defineCollection)({
6
6
  description: {
7
7
  $id: 'log',
8
8
  required: [
@@ -39,8 +39,8 @@ exports.log = (0, api_1.defineCollection)({
39
39
  ],
40
40
  },
41
41
  functions: {
42
- get: api_1.get,
43
- getAll: api_1.getAll,
44
- insert: api_1.insert,
42
+ get: core_1.get,
43
+ getAll: core_1.getAll,
44
+ insert: core_1.insert,
45
45
  },
46
46
  });
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection, get, getAll, insert } from "@aeriajs/api";
2
+ import { defineCollection, get, getAll, insert } from "@aeriajs/core";
3
3
  export const log = defineCollection({
4
4
  description: {
5
5
  $id: "log",
@@ -33,7 +33,7 @@ export declare const resourceUsage: Omit<import("@aeriajs/types").Collection<{
33
33
  };
34
34
  };
35
35
  };
36
- }>, "description" | "functions" | "item"> & {
36
+ }>, "description" | "functions" | "item" | "security" | "accessControl"> & {
37
37
  item: import("@aeriajs/types").SchemaWithId<{
38
38
  readonly $id: "resourceUsage";
39
39
  readonly required: readonly ["usage"];
@@ -106,5 +106,4 @@ export declare const resourceUsage: Omit<import("@aeriajs/types").Collection<{
106
106
  functionContracts: {
107
107
  [x: string]: import("@aeriajs/types").Contract | undefined;
108
108
  };
109
- accessControl: import("@aeriajs/types").AccessControl;
110
109
  };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resourceUsage = void 0;
4
- const api_1 = require("@aeriajs/api");
5
- exports.resourceUsage = (0, api_1.defineCollection)({
4
+ const core_1 = require("@aeriajs/core");
5
+ exports.resourceUsage = (0, core_1.defineCollection)({
6
6
  description: {
7
7
  $id: 'resourceUsage',
8
8
  required: ['usage'],
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineCollection } from "@aeriajs/api";
2
+ import { defineCollection } from "@aeriajs/core";
3
3
  export const resourceUsage = defineCollection({
4
4
  description: {
5
5
  $id: "resourceUsage",
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.activate = exports.ActivationErrors = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const bcrypt_1 = __importDefault(require("bcrypt"));
10
10
  var ActivationErrors;
@@ -19,7 +19,7 @@ const activate = async (payload, context) => {
19
19
  return (0, common_1.left)(ActivationErrors.InvalidLink);
20
20
  }
21
21
  const user = await context.collection.model.findOne({
22
- _id: new api_1.ObjectId(userId),
22
+ _id: new core_1.ObjectId(userId),
23
23
  }, {
24
24
  projection: {
25
25
  password: 1,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { ObjectId } from "@aeriajs/api";
2
+ import { ObjectId } from "@aeriajs/core";
3
3
  import { left, right } from "@aeriajs/common";
4
4
  import bcrypt from "bcrypt";
5
5
  export var ActivationErrors = /* @__PURE__ */ ((ActivationErrors2) => {
@@ -1,6 +1,6 @@
1
1
  import type { Context, SchemaWithId } from '@aeriajs/types';
2
2
  import type { description } from './description.js';
3
- import type { ObjectId } from '@aeriajs/api';
3
+ import type { ObjectId } from '@aeriajs/core';
4
4
  type Props = {
5
5
  email: string;
6
6
  password: string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.authenticate = exports.getDefaultUser = exports.AuthenticationErrors = void 0;
4
4
  const bcrypt_1 = require("bcrypt");
5
- const api_1 = require("@aeriajs/api");
5
+ const core_1 = require("@aeriajs/core");
6
6
  const common_1 = require("@aeriajs/common");
7
7
  var AuthenticationErrors;
8
8
  (function (AuthenticationErrors) {
@@ -49,7 +49,7 @@ const getUser = async (userId, context) => {
49
49
  }, {});
50
50
  tokenContent.userinfo = pick(leanUser, context.config.tokenUserProperties);
51
51
  }
52
- const token = await (0, api_1.signToken)(tokenContent);
52
+ const token = await (0, core_1.signToken)(tokenContent);
53
53
  return {
54
54
  user: leanUser,
55
55
  token: {
@@ -59,7 +59,7 @@ const getUser = async (userId, context) => {
59
59
  };
60
60
  };
61
61
  const getDefaultUser = async () => {
62
- const token = await (0, api_1.signToken)({
62
+ const token = await (0, core_1.signToken)({
63
63
  _id: null,
64
64
  roles: ['root'],
65
65
  userinfo: {},
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  import { compare as bcryptCompare } from "bcrypt";
3
- import { signToken } from "@aeriajs/api";
3
+ import { signToken } from "@aeriajs/core";
4
4
  import { left, right } from "@aeriajs/common";
5
5
  export var AuthenticationErrors = /* @__PURE__ */ ((AuthenticationErrors2) => {
6
6
  AuthenticationErrors2["Unauthenticated"] = "UNAUTHENTICATED";
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.description = void 0;
4
- const api_1 = require("@aeriajs/api");
4
+ const core_1 = require("@aeriajs/core");
5
5
  /**
6
6
  * This description complies with JWT claims specified in RFC-7519.
7
7
  * Reference: https://www.iana.org/assignments/jwt/jwt.xhtml#claims
8
8
  */
9
- exports.description = (0, api_1.defineDescription)({
9
+ exports.description = (0, core_1.defineDescription)({
10
10
  $id: 'user',
11
11
  required: [
12
12
  'name',
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- import { defineDescription } from "@aeriajs/api";
2
+ import { defineDescription } from "@aeriajs/core";
3
3
  export const description = defineDescription({
4
4
  $id: "user",
5
5
  required: [
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getInfo = exports.ActivationErrors = void 0;
7
- const api_1 = require("@aeriajs/api");
7
+ const core_1 = require("@aeriajs/core");
8
8
  const common_1 = require("@aeriajs/common");
9
9
  const bcrypt_1 = __importDefault(require("bcrypt"));
10
10
  var ActivationErrors;
@@ -19,7 +19,7 @@ const getInfo = async (payload, context) => {
19
19
  return (0, common_1.left)(ActivationErrors.InvalidLink);
20
20
  }
21
21
  const user = await context.collection.model.findOne({
22
- _id: new api_1.ObjectId(userId),
22
+ _id: new core_1.ObjectId(userId),
23
23
  });
24
24
  if (!user) {
25
25
  return (0, common_1.left)(ActivationErrors.UserNotFound);