@aeriajs/core 0.0.277 → 0.0.278
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.
- package/dist/__scripts__/postinstall.js +2 -37
- package/dist/accessControl.js +14 -18
- package/dist/assets.js +25 -31
- package/dist/collection/cascadingRemove.js +14 -19
- package/dist/collection/define.js +5 -10
- package/dist/collection/description.js +2 -7
- package/dist/collection/index.js +8 -24
- package/dist/collection/makePagination.js +5 -9
- package/dist/collection/normalizeProjection.js +1 -5
- package/dist/collection/preload.js +13 -18
- package/dist/collection/reference.js +19 -26
- package/dist/collection/traverseDocument.js +90 -127
- package/dist/context.js +16 -53
- package/dist/database.js +12 -52
- package/dist/endpoints.js +11 -48
- package/dist/functions/count.js +11 -15
- package/dist/functions/get.js +20 -24
- package/dist/functions/getAll.js +8 -12
- package/dist/functions/index.js +9 -27
- package/dist/functions/insert.js +19 -23
- package/dist/functions/remove.js +15 -19
- package/dist/functions/removeAll.js +11 -15
- package/dist/functions/removeFile.js +7 -11
- package/dist/functions/unpaginatedGetAll.js +15 -19
- package/dist/functions/upload.js +19 -57
- package/dist/index.js +11 -51
- package/dist/presets/add.js +1 -4
- package/dist/presets/crud.js +1 -4
- package/dist/presets/duplicate.js +1 -4
- package/dist/presets/index.js +17 -20
- package/dist/presets/owned.js +1 -4
- package/dist/presets/remove.js +1 -4
- package/dist/presets/removeAll.js +1 -4
- package/dist/presets/timestamped.js +1 -4
- package/dist/presets/view.js +1 -4
- package/dist/token.js +7 -15
- package/package.json +12 -17
- package/dist/__scripts__/postinstall.mjs +0 -50
- package/dist/accessControl.mjs +0 -31
- package/dist/assets.mjs +0 -67
- package/dist/collection/cascadingRemove.mjs +0 -71
- package/dist/collection/define.mjs +0 -13
- package/dist/collection/description.mjs +0 -8
- package/dist/collection/index.mjs +0 -9
- package/dist/collection/makePagination.mjs +0 -20
- package/dist/collection/normalizeProjection.mjs +0 -17
- package/dist/collection/preload.mjs +0 -88
- package/dist/collection/reference.mjs +0 -374
- package/dist/collection/traverseDocument.mjs +0 -454
- package/dist/context.mjs +0 -120
- package/dist/database.mjs +0 -49
- package/dist/endpoints.mjs +0 -52
- package/dist/functions/count.mjs +0 -50
- package/dist/functions/get.mjs +0 -89
- package/dist/functions/getAll.mjs +0 -14
- package/dist/functions/index.mjs +0 -12
- package/dist/functions/insert.mjs +0 -102
- package/dist/functions/remove.mjs +0 -41
- package/dist/functions/removeAll.mjs +0 -40
- package/dist/functions/removeFile.mjs +0 -29
- package/dist/functions/unpaginatedGetAll.mjs +0 -123
- package/dist/functions/upload.mjs +0 -91
- package/dist/index.mjs +0 -14
- package/dist/presets/add.mjs +0 -12
- package/dist/presets/crud.mjs +0 -35
- package/dist/presets/duplicate.mjs +0 -11
- package/dist/presets/index.mjs +0 -19
- package/dist/presets/owned.mjs +0 -9
- package/dist/presets/remove.mjs +0 -11
- package/dist/presets/removeAll.mjs +0 -11
- package/dist/presets/timestamped.mjs +0 -19
- package/dist/presets/view.mjs +0 -14
- package/dist/token.mjs +0 -31
package/dist/presets/owned.mjs
DELETED
package/dist/presets/remove.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const timestamped = {
|
|
3
|
-
properties: {
|
|
4
|
-
created_at: {
|
|
5
|
-
type: "string",
|
|
6
|
-
format: "date-time",
|
|
7
|
-
noForm: true,
|
|
8
|
-
readOnly: true,
|
|
9
|
-
isTimestamp: true
|
|
10
|
-
},
|
|
11
|
-
updated_at: {
|
|
12
|
-
type: "string",
|
|
13
|
-
format: "date-time",
|
|
14
|
-
noForm: true,
|
|
15
|
-
readOnly: true,
|
|
16
|
-
isTimestamp: true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
package/dist/presets/view.mjs
DELETED
package/dist/token.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { getConfig } from "@aeriajs/entrypoint";
|
|
3
|
-
import jwt from "jsonwebtoken";
|
|
4
|
-
const getTokenConfig = async () => {
|
|
5
|
-
const config = await getConfig();
|
|
6
|
-
if (!config.secret) {
|
|
7
|
-
throw new Error("application secret is not set");
|
|
8
|
-
}
|
|
9
|
-
return {
|
|
10
|
-
name: config.name,
|
|
11
|
-
secret: config.secret,
|
|
12
|
-
tokenExpiration: config.security.tokenExpiration
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export const signToken = async ({ iat, exp, ...payload }, secret, options) => {
|
|
16
|
-
const tokenConfig = await getTokenConfig();
|
|
17
|
-
if (tokenConfig.name) {
|
|
18
|
-
payload.aud = tokenConfig.name;
|
|
19
|
-
}
|
|
20
|
-
const tokenOptions = options || {};
|
|
21
|
-
if (!options) {
|
|
22
|
-
if (tokenConfig.tokenExpiration) {
|
|
23
|
-
tokenOptions.expiresIn = tokenConfig.tokenExpiration;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return jwt.sign(payload, secret || tokenConfig.secret, tokenOptions);
|
|
27
|
-
};
|
|
28
|
-
export const decodeToken = async (token, secret) => {
|
|
29
|
-
const tokenConfig = await getTokenConfig();
|
|
30
|
-
return jwt.verify(token, secret || tokenConfig.secret);
|
|
31
|
-
};
|