@akanjs/nest 0.9.55 → 0.9.57

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.
@@ -1,160 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __decorateClass = (decorators, target, key, kind) => {
29
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
30
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
31
- if (decorator = decorators[i])
32
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
33
- if (kind && result)
34
- __defProp(target, key, result);
35
- return result;
36
- };
37
- var authGuards_exports = {};
38
- __export(authGuards_exports, {
39
- Admin: () => Admin,
40
- Every: () => Every,
41
- None: () => None,
42
- Owner: () => Owner,
43
- Public: () => Public,
44
- SuperAdmin: () => SuperAdmin,
45
- User: () => User,
46
- getArgs: () => getArgs,
47
- getRequest: () => getRequest,
48
- getResponse: () => getResponse,
49
- getSocket: () => getSocket
50
- });
51
- module.exports = __toCommonJS(authGuards_exports);
52
- var import_common = require("@nestjs/common");
53
- var import_graphql = require("@nestjs/graphql");
54
- var Auth = __toESM(require("./authorization"));
55
- const getRequest = (context) => {
56
- const type = context.getType();
57
- if (type === "ws")
58
- throw new Error("Getting Request in Websocket is not allowed");
59
- return type === "http" ? context.switchToHttp().getRequest() : import_graphql.GqlExecutionContext.create(context).getContext().req;
60
- };
61
- const getResponse = (context) => {
62
- const type = context.getType();
63
- if (type === "ws")
64
- throw new Error("Getting Response in Websocket is not allowed");
65
- return type === "http" ? context.switchToHttp().getResponse() : import_graphql.GqlExecutionContext.create(context).getContext().req.res;
66
- };
67
- const getArgs = (context) => {
68
- const type = context.getType();
69
- if (type === "ws")
70
- throw new Error("Getting Args in Websocket is not allowed");
71
- if (type === "graphql")
72
- return import_graphql.GqlExecutionContext.create(context).getArgs();
73
- else if (type === "http") {
74
- const { params, query, body } = context.switchToHttp().getRequest();
75
- return { ...params, ...query, ...body };
76
- } else
77
- throw new Error("Getting Args in Unknown context is not allowed");
78
- };
79
- const getSocket = (context) => {
80
- const type = context.getType();
81
- if (type !== "ws")
82
- throw new Error("Getting Socket in Http or GraphQL is not allowed");
83
- const socket = context.getArgByIndex(0);
84
- return socket;
85
- };
86
- let Public = class {
87
- canActivate(context) {
88
- return true;
89
- }
90
- };
91
- Public = __decorateClass([
92
- (0, import_common.Injectable)()
93
- ], Public);
94
- let None = class {
95
- canActivate() {
96
- return false;
97
- }
98
- };
99
- None = __decorateClass([
100
- (0, import_common.Injectable)()
101
- ], None);
102
- let Every = class {
103
- canActivate(context) {
104
- const { account } = getRequest(context);
105
- return Auth.allow(account, ["user", "admin", "superAdmin"]);
106
- }
107
- };
108
- Every = __decorateClass([
109
- (0, import_common.Injectable)()
110
- ], Every);
111
- let Owner = class {
112
- canActivate(context) {
113
- const { account } = getRequest(context);
114
- return Auth.allow(account, ["user", "admin", "superAdmin"]);
115
- }
116
- };
117
- Owner = __decorateClass([
118
- (0, import_common.Injectable)()
119
- ], Owner);
120
- let Admin = class {
121
- canActivate(context) {
122
- const { account } = getRequest(context);
123
- return Auth.allow(account, ["admin", "superAdmin"]);
124
- }
125
- };
126
- Admin = __decorateClass([
127
- (0, import_common.Injectable)()
128
- ], Admin);
129
- let SuperAdmin = class {
130
- canActivate(context) {
131
- const { account } = getRequest(context);
132
- return Auth.allow(account, ["superAdmin"]);
133
- }
134
- };
135
- SuperAdmin = __decorateClass([
136
- (0, import_common.Injectable)()
137
- ], SuperAdmin);
138
- let User = class {
139
- canActivate(context) {
140
- const { account } = getRequest(context);
141
- return Auth.allow(account, ["user"]);
142
- }
143
- };
144
- User = __decorateClass([
145
- (0, import_common.Injectable)()
146
- ], User);
147
- // Annotate the CommonJS export names for ESM import in node:
148
- 0 && (module.exports = {
149
- Admin,
150
- Every,
151
- None,
152
- Owner,
153
- Public,
154
- SuperAdmin,
155
- User,
156
- getArgs,
157
- getRequest,
158
- getResponse,
159
- getSocket
160
- });
@@ -1,122 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var authentication_exports = {};
29
- __export(authentication_exports, {
30
- Access: () => Access,
31
- Account: () => Account,
32
- Me: () => Me,
33
- Req: () => Req,
34
- Res: () => Res,
35
- Self: () => Self,
36
- UserIp: () => UserIp,
37
- Ws: () => Ws
38
- });
39
- module.exports = __toCommonJS(authentication_exports);
40
- var import_base = require("@akanjs/base");
41
- var import_common = require("@nestjs/common");
42
- var import_ua_parser_js = __toESM(require("ua-parser-js"));
43
- var import_authGuards = require("./authGuards");
44
- const Account = (0, import_common.createParamDecorator)((option, context) => {
45
- const { account } = (0, import_authGuards.getRequest)(context);
46
- return account;
47
- });
48
- const Self = (0, import_common.createParamDecorator)((option, context) => {
49
- const { account } = (0, import_authGuards.getRequest)(context);
50
- const self = account.self;
51
- if (!self && !option.nullable)
52
- throw new import_common.UnauthorizedException("No or Invalid Account in Self (User)");
53
- return self;
54
- });
55
- const Me = (0, import_common.createParamDecorator)((option, context) => {
56
- const { account } = (0, import_authGuards.getRequest)(context);
57
- const me = account.me;
58
- if (!me && !option.nullable)
59
- throw new import_common.UnauthorizedException("No or Invalid Account in Me (Admin)");
60
- return me;
61
- });
62
- const UserIp = (0, import_common.createParamDecorator)((option, context) => {
63
- const req = (0, import_authGuards.getRequest)(context);
64
- const ip = req.ip;
65
- if (!ip && !option.nullable)
66
- throw new import_common.UnauthorizedException("Invalid IP");
67
- return { ip };
68
- });
69
- const Access = (0, import_common.createParamDecorator)((option, context) => {
70
- const req = (0, import_authGuards.getRequest)(context);
71
- const res = new import_ua_parser_js.default(req.userAgent).getResult();
72
- if (!req.userAgent && !option.nullable)
73
- throw new import_common.UnauthorizedException("Invalid UserAgent");
74
- return {
75
- ...req.geolocation ? JSON.parse(req.geolocation) : {},
76
- osName: res.os.name,
77
- osVersion: res.os.version,
78
- browserName: res.browser.name,
79
- browserVersion: res.browser.version,
80
- mobileModel: res.device.model,
81
- mobileVendor: res.device.vendor,
82
- deviceType: res.device.type ?? "desktop",
83
- at: (0, import_base.dayjs)(),
84
- period: 0
85
- };
86
- });
87
- const Req = (0, import_common.createParamDecorator)((option, context) => {
88
- return (0, import_authGuards.getRequest)(context);
89
- });
90
- const Res = (0, import_common.createParamDecorator)((option, context) => {
91
- return (0, import_authGuards.getResponse)(context);
92
- });
93
- const Ws = (0, import_common.createParamDecorator)((option, context) => {
94
- const socket = context.getArgByIndex(0);
95
- const { __subscribe__ } = context.getArgByIndex(1);
96
- return {
97
- socket,
98
- subscribe: __subscribe__,
99
- onDisconnect: (handler) => {
100
- socket.on("disconnect", handler);
101
- },
102
- onSubscribe: (handler) => {
103
- if (__subscribe__)
104
- handler();
105
- },
106
- onUnsubscribe: (handler) => {
107
- if (!__subscribe__)
108
- handler();
109
- }
110
- };
111
- });
112
- // Annotate the CommonJS export names for ESM import in node:
113
- 0 && (module.exports = {
114
- Access,
115
- Account,
116
- Me,
117
- Req,
118
- Res,
119
- Self,
120
- UserIp,
121
- Ws
122
- });
package/cjs/src/sso.js DELETED
@@ -1,187 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __decorateClass = (decorators, target, key, kind) => {
29
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
30
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
31
- if (decorator = decorators[i])
32
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
33
- if (kind && result)
34
- __defProp(target, key, result);
35
- return result;
36
- };
37
- var sso_exports = {};
38
- __export(sso_exports, {
39
- getSsoProviders: () => getSsoProviders,
40
- verifyAppleUser: () => verifyAppleUser
41
- });
42
- module.exports = __toCommonJS(sso_exports);
43
- var import_common = require("@nestjs/common");
44
- var import_passport = require("@nestjs/passport");
45
- var appleSignin = __toESM(require("apple-signin"));
46
- var jwt = __toESM(require("jsonwebtoken"));
47
- var import_passport_apple = require("passport-apple");
48
- var import_passport_facebook = require("passport-facebook");
49
- var import_passport_github = require("passport-github");
50
- var import_passport_google_oauth20 = require("passport-google-oauth20");
51
- var import_passport_kakao = require("passport-kakao");
52
- var import_passport_naver = require("passport-naver");
53
- const getSsoProviders = (host, ssoOptions) => {
54
- const origin = host === "localhost" ? "http://localhost:8080/backend" : `https://${host}/backend`;
55
- const providers = [];
56
- if (ssoOptions.kakao) {
57
- let KakaoOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_kakao.Strategy, "kakao") {
58
- constructor() {
59
- super({
60
- ...ssoOptions.kakao,
61
- callbackURL: `${origin}/user/kakao/callback`,
62
- scope: ["account_email", "profile_nickname"]
63
- });
64
- }
65
- validate(jwt2, refreshToken, profile) {
66
- return {
67
- name: profile.displayName,
68
- email: profile._json.kakao_account.email,
69
- password: profile.id
70
- };
71
- }
72
- };
73
- KakaoOauthStrategy = __decorateClass([
74
- (0, import_common.Injectable)()
75
- ], KakaoOauthStrategy);
76
- providers.push(KakaoOauthStrategy);
77
- }
78
- if (ssoOptions.naver) {
79
- let NaverOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_naver.Strategy, "naver") {
80
- constructor() {
81
- super({ ...ssoOptions.naver, callbackURL: `${origin}/user/naver/callback` });
82
- }
83
- validate(jwt2, refreshToken, profile) {
84
- return {
85
- name: profile.displayName,
86
- email: profile._json.email,
87
- password: profile.id
88
- };
89
- }
90
- };
91
- NaverOauthStrategy = __decorateClass([
92
- (0, import_common.Injectable)()
93
- ], NaverOauthStrategy);
94
- providers.push(NaverOauthStrategy);
95
- }
96
- if (ssoOptions.github) {
97
- let GithubOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_github.Strategy, "github") {
98
- constructor() {
99
- super({ ...ssoOptions.github, callbackURL: `${origin}/user/github/callback`, scope: ["user"] });
100
- }
101
- validate(accessToken, _refreshToken, profile) {
102
- return profile;
103
- }
104
- };
105
- GithubOauthStrategy = __decorateClass([
106
- (0, import_common.Injectable)()
107
- ], GithubOauthStrategy);
108
- providers.push(GithubOauthStrategy);
109
- }
110
- if (ssoOptions.google) {
111
- let GoogleOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_google_oauth20.Strategy, "google") {
112
- constructor() {
113
- super({ ...ssoOptions.google, callbackURL: `${origin}/user/google/callback`, scope: ["email", "profile"] });
114
- }
115
- validate(_accessToken, _refreshToken, profile) {
116
- return profile;
117
- }
118
- };
119
- GoogleOauthStrategy = __decorateClass([
120
- (0, import_common.Injectable)()
121
- ], GoogleOauthStrategy);
122
- providers.push(GoogleOauthStrategy);
123
- }
124
- if (ssoOptions.facebook) {
125
- let FacebookOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_facebook.Strategy, "facebook") {
126
- constructor() {
127
- super({
128
- ...ssoOptions.facebook,
129
- callbackURL: `${origin}/user/facebook/callback`,
130
- scope: ["email"],
131
- profileFields: ["emails", "name"]
132
- });
133
- }
134
- validate(_accessToken, _refreshToken, profile) {
135
- return profile;
136
- }
137
- };
138
- FacebookOauthStrategy = __decorateClass([
139
- (0, import_common.Injectable)()
140
- ], FacebookOauthStrategy);
141
- providers.push(FacebookOauthStrategy);
142
- }
143
- if (ssoOptions.apple) {
144
- let AppleOauthStrategy = class extends (0, import_passport.PassportStrategy)(import_passport_apple.Strategy, "apple") {
145
- constructor() {
146
- super({
147
- ...ssoOptions.apple,
148
- callbackURL: `${origin}/user/apple/callback`,
149
- passReqToCallback: true,
150
- scope: ["name", "email"]
151
- });
152
- }
153
- validate(req, accessToken, refreshToken, idToken, profile, cb) {
154
- cb(null, idToken);
155
- }
156
- };
157
- AppleOauthStrategy = __decorateClass([
158
- (0, import_common.Injectable)()
159
- ], AppleOauthStrategy);
160
- providers.push(AppleOauthStrategy);
161
- }
162
- return providers;
163
- };
164
- const verifyAppleUser = async (payload, origin, sso) => {
165
- const signinAgent = appleSignin;
166
- const clientSecret = signinAgent.getClientSecret({
167
- clientID: sso.clientID,
168
- teamId: sso.teamID,
169
- keyIdentifier: sso.keyID,
170
- privateKeyPath: sso.keyFilePath
171
- });
172
- const tokens = await signinAgent.getAuthorizationToken(payload.code, {
173
- clientID: sso.clientID,
174
- clientSecret,
175
- redirectUri: `${origin}/user/apple/callback`
176
- });
177
- if (!tokens.id_token) {
178
- throw new Error("No id_token found in Apple's response");
179
- }
180
- const data = jwt.decode(tokens.id_token);
181
- return { tokens, data };
182
- };
183
- // Annotate the CommonJS export names for ESM import in node:
184
- 0 && (module.exports = {
185
- getSsoProviders,
186
- verifyAppleUser
187
- });
@@ -1,50 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var verifyPayment_exports = {};
29
- __export(verifyPayment_exports, {
30
- verifyPayment: () => verifyPayment
31
- });
32
- module.exports = __toCommonJS(verifyPayment_exports);
33
- var import_iap = __toESM(require("iap"));
34
- const verifyPayment = async (payment) => {
35
- return new Promise(
36
- (resolve, reject) => (
37
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
38
- import_iap.default.verifyPayment(payment.platform, { ...payment }, (error, response) => {
39
- if (error)
40
- reject(`App Purchase Verify Failed. ${response}`);
41
- else
42
- resolve(response);
43
- })
44
- )
45
- );
46
- };
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- verifyPayment
50
- });
@@ -1,119 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
10
- return result;
11
- };
12
- import { Injectable } from "@nestjs/common";
13
- import { GqlExecutionContext } from "@nestjs/graphql";
14
- import * as Auth from "./authorization";
15
- const getRequest = (context) => {
16
- const type = context.getType();
17
- if (type === "ws")
18
- throw new Error("Getting Request in Websocket is not allowed");
19
- return type === "http" ? context.switchToHttp().getRequest() : GqlExecutionContext.create(context).getContext().req;
20
- };
21
- const getResponse = (context) => {
22
- const type = context.getType();
23
- if (type === "ws")
24
- throw new Error("Getting Response in Websocket is not allowed");
25
- return type === "http" ? context.switchToHttp().getResponse() : GqlExecutionContext.create(context).getContext().req.res;
26
- };
27
- const getArgs = (context) => {
28
- const type = context.getType();
29
- if (type === "ws")
30
- throw new Error("Getting Args in Websocket is not allowed");
31
- if (type === "graphql")
32
- return GqlExecutionContext.create(context).getArgs();
33
- else if (type === "http") {
34
- const { params, query, body } = context.switchToHttp().getRequest();
35
- return { ...params, ...query, ...body };
36
- } else
37
- throw new Error("Getting Args in Unknown context is not allowed");
38
- };
39
- const getSocket = (context) => {
40
- const type = context.getType();
41
- if (type !== "ws")
42
- throw new Error("Getting Socket in Http or GraphQL is not allowed");
43
- const socket = context.getArgByIndex(0);
44
- return socket;
45
- };
46
- let Public = class {
47
- canActivate(context) {
48
- return true;
49
- }
50
- };
51
- Public = __decorateClass([
52
- Injectable()
53
- ], Public);
54
- let None = class {
55
- canActivate() {
56
- return false;
57
- }
58
- };
59
- None = __decorateClass([
60
- Injectable()
61
- ], None);
62
- let Every = class {
63
- canActivate(context) {
64
- const { account } = getRequest(context);
65
- return Auth.allow(account, ["user", "admin", "superAdmin"]);
66
- }
67
- };
68
- Every = __decorateClass([
69
- Injectable()
70
- ], Every);
71
- let Owner = class {
72
- canActivate(context) {
73
- const { account } = getRequest(context);
74
- return Auth.allow(account, ["user", "admin", "superAdmin"]);
75
- }
76
- };
77
- Owner = __decorateClass([
78
- Injectable()
79
- ], Owner);
80
- let Admin = class {
81
- canActivate(context) {
82
- const { account } = getRequest(context);
83
- return Auth.allow(account, ["admin", "superAdmin"]);
84
- }
85
- };
86
- Admin = __decorateClass([
87
- Injectable()
88
- ], Admin);
89
- let SuperAdmin = class {
90
- canActivate(context) {
91
- const { account } = getRequest(context);
92
- return Auth.allow(account, ["superAdmin"]);
93
- }
94
- };
95
- SuperAdmin = __decorateClass([
96
- Injectable()
97
- ], SuperAdmin);
98
- let User = class {
99
- canActivate(context) {
100
- const { account } = getRequest(context);
101
- return Auth.allow(account, ["user"]);
102
- }
103
- };
104
- User = __decorateClass([
105
- Injectable()
106
- ], User);
107
- export {
108
- Admin,
109
- Every,
110
- None,
111
- Owner,
112
- Public,
113
- SuperAdmin,
114
- User,
115
- getArgs,
116
- getRequest,
117
- getResponse,
118
- getSocket
119
- };