@trailmix-cms/cms 0.0.1
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/auth.guard.d.ts +22 -0
- package/dist/auth.guard.d.ts.map +1 -0
- package/dist/auth.guard.js +109 -0
- package/dist/auth.guard.js.map +1 -0
- package/dist/cms.module.d.ts +7 -0
- package/dist/cms.module.d.ts.map +1 -0
- package/dist/cms.module.js +47 -0
- package/dist/cms.module.js.map +1 -0
- package/dist/cms.providers.d.ts +119 -0
- package/dist/cms.providers.d.ts.map +1 -0
- package/dist/cms.providers.js +122 -0
- package/dist/cms.providers.js.map +1 -0
- package/dist/collections/account.collection.d.ts +18 -0
- package/dist/collections/account.collection.d.ts.map +1 -0
- package/dist/collections/account.collection.js +52 -0
- package/dist/collections/account.collection.js.map +1 -0
- package/dist/collections/file.collection.d.ts +21 -0
- package/dist/collections/file.collection.d.ts.map +1 -0
- package/dist/collections/file.collection.js +59 -0
- package/dist/collections/file.collection.js.map +1 -0
- package/dist/collections/index.d.ts +4 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/index.js +10 -0
- package/dist/collections/index.js.map +1 -0
- package/dist/collections/text.collection.d.ts +20 -0
- package/dist/collections/text.collection.d.ts.map +1 -0
- package/dist/collections/text.collection.js +56 -0
- package/dist/collections/text.collection.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +31 -0
- package/dist/config.js.map +1 -0
- package/dist/constants/cms-collection-names.d.ts +7 -0
- package/dist/constants/cms-collection-names.d.ts.map +1 -0
- package/dist/constants/cms-collection-names.js +9 -0
- package/dist/constants/cms-collection-names.js.map +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +19 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/provider-symbols.d.ts +14 -0
- package/dist/constants/provider-symbols.d.ts.map +1 -0
- package/dist/constants/provider-symbols.js +17 -0
- package/dist/constants/provider-symbols.js.map +1 -0
- package/dist/controllers/account.controller.d.ts +10 -0
- package/dist/controllers/account.controller.d.ts.map +1 -0
- package/dist/controllers/account.controller.js +53 -0
- package/dist/controllers/account.controller.js.map +1 -0
- package/dist/controllers/file.controller.d.ts +2 -0
- package/dist/controllers/file.controller.d.ts.map +1 -0
- package/dist/controllers/file.controller.js +80 -0
- package/dist/controllers/file.controller.js.map +1 -0
- package/dist/controllers/text.controller.d.ts +2 -0
- package/dist/controllers/text.controller.d.ts.map +1 -0
- package/dist/controllers/text.controller.js +48 -0
- package/dist/controllers/text.controller.js.map +1 -0
- package/dist/decorators/account.decorator.d.ts +4 -0
- package/dist/decorators/account.decorator.d.ts.map +1 -0
- package/dist/decorators/account.decorator.js +16 -0
- package/dist/decorators/account.decorator.js.map +1 -0
- package/dist/decorators/audit-context.decorator.d.ts +2 -0
- package/dist/decorators/audit-context.decorator.d.ts.map +1 -0
- package/dist/decorators/audit-context.decorator.js +17 -0
- package/dist/decorators/audit-context.decorator.js.map +1 -0
- package/dist/decorators/auth.decorator.d.ts +9 -0
- package/dist/decorators/auth.decorator.d.ts.map +1 -0
- package/dist/decorators/auth.decorator.js +13 -0
- package/dist/decorators/auth.decorator.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/pipes/file.pipe.d.ts +8 -0
- package/dist/pipes/file.pipe.d.ts.map +1 -0
- package/dist/pipes/file.pipe.js +28 -0
- package/dist/pipes/file.pipe.js.map +1 -0
- package/dist/services/authorization.service.d.ts +14 -0
- package/dist/services/authorization.service.d.ts.map +1 -0
- package/dist/services/authorization.service.js +101 -0
- package/dist/services/authorization.service.js.map +1 -0
- package/dist/types/collection-config.d.ts +4 -0
- package/dist/types/collection-config.d.ts.map +1 -0
- package/dist/types/collection-config.js +3 -0
- package/dist/types/collection-config.js.map +1 -0
- package/package.json +44 -0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AAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACJ,CAAA;AAvBY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAMJ,WAAA,IAAA,eAAM,EAAC,4BAAgB,CAAC,2BAA2B,CAAC,CAAA;IACpD,WAAA,IAAA,eAAM,EAAC,4BAAgB,CAAC,0BAA0B,CAAC,CAAA;IACnD,WAAA,IAAA,eAAM,EAAC,4BAAgB,CAAC,2BAA2B,CAAC,CAAA;IACpD,WAAA,IAAA,uBAAkB,EAAC,cAAc,CAAC,CAAA;qCAHoD,aAAO,oBAG3B,oBAAU;QACzC,oBAAe,EACf,gBAAW,CAAC,eAAe;GAV1D,cAAc,CAuB1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextCollection = exports.FileCollection = exports.AccountCollection = void 0;
|
|
4
|
+
var account_collection_1 = require("./account.collection");
|
|
5
|
+
Object.defineProperty(exports, "AccountCollection", { enumerable: true, get: function () { return account_collection_1.AccountCollection; } });
|
|
6
|
+
var file_collection_1 = require("./file.collection");
|
|
7
|
+
Object.defineProperty(exports, "FileCollection", { enumerable: true, get: function () { return file_collection_1.FileCollection; } });
|
|
8
|
+
var text_collection_1 = require("./text.collection");
|
|
9
|
+
Object.defineProperty(exports, "TextCollection", { enumerable: true, get: function () { return text_collection_1.TextCollection; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA;AAC1B,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Collection, OptionalUnlessRequiredId } from 'mongodb';
|
|
2
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
3
|
+
import { ZodType } from 'zod';
|
|
4
|
+
import { Text } from '@trailmixcms/models';
|
|
5
|
+
import { Collections, DatabaseService, AuditedCollection } from '@trailmixcms/db';
|
|
6
|
+
import { CollectionConfig } from '../types/collection-config';
|
|
7
|
+
type Record = Text.Entity;
|
|
8
|
+
export declare class TextCollection<T extends Record = Record> extends AuditedCollection<T> implements OnModuleInit {
|
|
9
|
+
protected readonly entitySchema: ZodType<OptionalUnlessRequiredId<T>>;
|
|
10
|
+
protected readonly setup: (colection: Collection<T>) => Promise<void>;
|
|
11
|
+
protected readonly config: CollectionConfig;
|
|
12
|
+
protected readonly collection: Collection<T>;
|
|
13
|
+
protected readonly databaseService: DatabaseService;
|
|
14
|
+
protected readonly auditCollection: Collections.AuditCollection;
|
|
15
|
+
readonly collectionName: "text";
|
|
16
|
+
constructor(entitySchema: ZodType<OptionalUnlessRequiredId<T>>, setup: (colection: Collection<T>) => Promise<void>, config: CollectionConfig, collection: Collection<T>, databaseService: DatabaseService, auditCollection: Collections.AuditCollection);
|
|
17
|
+
onModuleInit(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=text.collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.collection.d.ts","sourceRoot":"","sources":["../../src/collections/text.collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;A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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TextCollection = void 0;
|
|
16
|
+
const mongodb_1 = require("mongodb");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const zod_1 = require("zod");
|
|
19
|
+
const db_1 = require("@trailmixcms/db");
|
|
20
|
+
const constants_1 = require("../constants");
|
|
21
|
+
const collectionName = constants_1.CMSCollectionName.Text;
|
|
22
|
+
let TextCollection = class TextCollection extends db_1.AuditedCollection {
|
|
23
|
+
entitySchema;
|
|
24
|
+
setup;
|
|
25
|
+
config;
|
|
26
|
+
collection;
|
|
27
|
+
databaseService;
|
|
28
|
+
auditCollection;
|
|
29
|
+
collectionName = collectionName;
|
|
30
|
+
constructor(entitySchema, setup, config, collection, databaseService, auditCollection) {
|
|
31
|
+
super(collection, databaseService, auditCollection);
|
|
32
|
+
this.entitySchema = entitySchema;
|
|
33
|
+
this.setup = setup;
|
|
34
|
+
this.config = config;
|
|
35
|
+
this.collection = collection;
|
|
36
|
+
this.databaseService = databaseService;
|
|
37
|
+
this.auditCollection = auditCollection;
|
|
38
|
+
}
|
|
39
|
+
async onModuleInit() {
|
|
40
|
+
if (!this.config.disableDefaultIndexes) {
|
|
41
|
+
await this.collection.createIndex({ guid: 1 }, { unique: true });
|
|
42
|
+
}
|
|
43
|
+
await this.setup(this.collection);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.TextCollection = TextCollection;
|
|
47
|
+
exports.TextCollection = TextCollection = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__param(0, (0, common_1.Inject)(constants_1.PROVIDER_SYMBOLS.TRAILMIXCMS_CMS_TEXT_SCHEMA)),
|
|
50
|
+
__param(1, (0, common_1.Inject)(constants_1.PROVIDER_SYMBOLS.TRAILMIXCMS_CMS_TEXT_SETUP)),
|
|
51
|
+
__param(2, (0, common_1.Inject)(constants_1.PROVIDER_SYMBOLS.TRAILMIXCMS_CMS_TEXT_CONFIG)),
|
|
52
|
+
__param(3, (0, db_1.DocumentCollection)(collectionName)),
|
|
53
|
+
__metadata("design:paramtypes", [zod_1.ZodType, Function, Object, mongodb_1.Collection,
|
|
54
|
+
db_1.DatabaseService, db_1.Collections.AuditCollection])
|
|
55
|
+
], TextCollection);
|
|
56
|
+
//# sourceMappingURL=text.collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.collection.js","sourceRoot":"","sources":["../../src/collections/text.collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,qCAA+D;AAC/D,2CAAkE;AAClE,6BAA8B;AAG9B,wCAAsG;AACtG,4CAAmE;AAInE,MAAM,cAAc,GAAG,6BAAiB,CAAC,IAAI,CAAC;AAGvC,IAAM,cAAc,GAApB,MAAM,cAA0C,SAAQ,sBAAoB;IAIF;IACD;IACC;IAClB;IACpC;IACA;IARP,cAAc,GAAG,cAAc,CAAC;IAEhD,YAC6E,YAAkD,EACnD,KAAk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isDev: boolean;
|
|
7
|
+
isTest: boolean;
|
|
8
|
+
isProduction: boolean;
|
|
9
|
+
isProd: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type AppConfig = ReturnType<typeof configuration>;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;CAwBzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configuration = void 0;
|
|
4
|
+
const envalid_1 = require("envalid");
|
|
5
|
+
const configuration = () => {
|
|
6
|
+
const config = (0, envalid_1.cleanEnv)(process.env, {
|
|
7
|
+
// MONGODB_CONNECTION_STRING: str({
|
|
8
|
+
// desc: 'Connection string to mongodb',
|
|
9
|
+
// ...(process.env.GENERATE_SPEC === 'true' ? { default: '', allowEmpty: true } : {}),
|
|
10
|
+
// }),
|
|
11
|
+
// MONGODB_DATABASE_NAME: str({
|
|
12
|
+
// desc: 'Database Name',
|
|
13
|
+
// default: 'main'
|
|
14
|
+
// }),
|
|
15
|
+
CLERK_SECRET_KEY: (0, envalid_1.str)({
|
|
16
|
+
desc: 'Clerk secret key',
|
|
17
|
+
example: 'sk_test_123456.....',
|
|
18
|
+
...(process.env.GENERATE_SPEC === 'true' ? { default: '', allowEmpty: true } : {}),
|
|
19
|
+
}),
|
|
20
|
+
GENERATE_SPEC: (0, envalid_1.bool)({
|
|
21
|
+
desc: 'Generate OpenAPI spec',
|
|
22
|
+
default: false
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
...config,
|
|
27
|
+
onModuleInit: false // Fix issue where nestjs checks for onModuleInit hook and fails if it doesn't exist
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.configuration = configuration;
|
|
31
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,qCAA8C;AAEvC,MAAM,aAAa,GAAG,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAG,IAAA,kBAAQ,EAAC,OAAO,CAAC,GAAG,EAAE;QACjC,mCAAmC;QACnC,4CAA4C;QAC5C,0FAA0F;QAC1F,MAAM;QACN,+BAA+B;QAC/B,6BAA6B;QAC7B,sBAAsB;QACtB,MAAM;QACN,gBAAgB,EAAE,IAAA,aAAG,EAAC;YAClB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,qBAAqB;YAC9B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrF,CAAC;QACF,aAAa,EAAE,IAAA,cAAI,EAAC;YAChB,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,KAAK;SACjB,CAAC;KACL,CAAC,CAAC;IACH,OAAO;QACH,GAAG,MAAM;QACT,YAAY,EAAE,KAAK,CAAC,oFAAoF;KAC3G,CAAC;AACN,CAAC,CAAC;AAxBW,QAAA,aAAa,iBAwBxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const CMSCollectionName: {
|
|
2
|
+
readonly Account: "account";
|
|
3
|
+
readonly File: "file";
|
|
4
|
+
readonly Text: "text";
|
|
5
|
+
};
|
|
6
|
+
export type CMSCollectionName = typeof CMSCollectionName[keyof typeof CMSCollectionName];
|
|
7
|
+
//# sourceMappingURL=cms-collection-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-collection-names.d.ts","sourceRoot":"","sources":["../../src/constants/cms-collection-names.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cms-collection-names.js","sourceRoot":"","sources":["../../src/constants/cms-collection-names.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG;IAC7B,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./cms-collection-names"), exports);
|
|
18
|
+
__exportStar(require("./provider-symbols"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,qDAAmC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const PROVIDER_SYMBOLS: {
|
|
2
|
+
readonly TRAILMIXCMS_CMS_ACCOUNT_CONFIG: "TRAILMIXCMS_CMS_ACCOUNT_CONFIG";
|
|
3
|
+
readonly TRAILMIXCMS_CMS_ACCOUNT_SCHEMA: "TRAILMIXCMS_CMS_ACCOUNT_SCHEMA";
|
|
4
|
+
readonly TRAILMIXCMS_CMS_ACCOUNT_SETUP: "TRAILMIXCMS_CMS_ACCOUNT_SETUP";
|
|
5
|
+
readonly TRAILMIXCMS_CMS_ACCOUNT_DTO_SCHEMA: "TRAILMIXCMS_CMS_ACCOUNT_DTO_SCHEMA";
|
|
6
|
+
readonly TRAILMIXCMS_CMS_ACCOUNT_MAP_ENTITY: "TRAILMIXCMS_CMS_ACCOUNT_MAP_ENTITY";
|
|
7
|
+
readonly TRAILMIXCMS_CMS_FILE_CONFIG: "TRAILMIXCMS_CMS_FILE_CONFIG";
|
|
8
|
+
readonly TRAILMIXCMS_CMS_FILE_SCHEMA: "TRAILMIXCMS_CMS_FILE_SCHEMA";
|
|
9
|
+
readonly TRAILMIXCMS_CMS_FILE_SETUP: "TRAILMIXCMS_CMS_FILE_SETUP";
|
|
10
|
+
readonly TRAILMIXCMS_CMS_TEXT_CONFIG: "TRAILMIXCMS_CMS_TEXT_CONFIG";
|
|
11
|
+
readonly TRAILMIXCMS_CMS_TEXT_SCHEMA: "TRAILMIXCMS_CMS_TEXT_SCHEMA";
|
|
12
|
+
readonly TRAILMIXCMS_CMS_TEXT_SETUP: "TRAILMIXCMS_CMS_TEXT_SETUP";
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=provider-symbols.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-symbols.d.ts","sourceRoot":"","sources":["../../src/constants/provider-symbols.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;CAYnB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PROVIDER_SYMBOLS = void 0;
|
|
4
|
+
exports.PROVIDER_SYMBOLS = {
|
|
5
|
+
TRAILMIXCMS_CMS_ACCOUNT_CONFIG: 'TRAILMIXCMS_CMS_ACCOUNT_CONFIG',
|
|
6
|
+
TRAILMIXCMS_CMS_ACCOUNT_SCHEMA: 'TRAILMIXCMS_CMS_ACCOUNT_SCHEMA',
|
|
7
|
+
TRAILMIXCMS_CMS_ACCOUNT_SETUP: 'TRAILMIXCMS_CMS_ACCOUNT_SETUP',
|
|
8
|
+
TRAILMIXCMS_CMS_ACCOUNT_DTO_SCHEMA: 'TRAILMIXCMS_CMS_ACCOUNT_DTO_SCHEMA',
|
|
9
|
+
TRAILMIXCMS_CMS_ACCOUNT_MAP_ENTITY: 'TRAILMIXCMS_CMS_ACCOUNT_MAP_ENTITY',
|
|
10
|
+
TRAILMIXCMS_CMS_FILE_CONFIG: 'TRAILMIXCMS_CMS_FILE_CONFIG',
|
|
11
|
+
TRAILMIXCMS_CMS_FILE_SCHEMA: 'TRAILMIXCMS_CMS_FILE_SCHEMA',
|
|
12
|
+
TRAILMIXCMS_CMS_FILE_SETUP: 'TRAILMIXCMS_CMS_FILE_SETUP',
|
|
13
|
+
TRAILMIXCMS_CMS_TEXT_CONFIG: 'TRAILMIXCMS_CMS_TEXT_CONFIG',
|
|
14
|
+
TRAILMIXCMS_CMS_TEXT_SCHEMA: 'TRAILMIXCMS_CMS_TEXT_SCHEMA',
|
|
15
|
+
TRAILMIXCMS_CMS_TEXT_SETUP: 'TRAILMIXCMS_CMS_TEXT_SETUP'
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=provider-symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-symbols.js","sourceRoot":"","sources":["../../src/constants/provider-symbols.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;IAC5B,8BAA8B,EAAE,gCAAgC;IAChE,8BAA8B,EAAE,gCAAgC;IAChE,6BAA6B,EAAE,+BAA+B;IAC9D,kCAAkC,EAAE,oCAAoC;IACxE,kCAAkC,EAAE,oCAAoC;IACxE,2BAA2B,EAAE,6BAA6B;IAC1D,2BAA2B,EAAE,6BAA6B;IAC1D,0BAA0B,EAAE,4BAA4B;IACxD,2BAA2B,EAAE,6BAA6B;IAC1D,2BAA2B,EAAE,6BAA6B;IAC1D,0BAA0B,EAAE,4BAA4B;CAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Logger } from '@nestjs/common';
|
|
2
|
+
import * as models from '@trailmixcms/models';
|
|
3
|
+
export declare function buildAccountController<AccountEntity extends models.Account.Entity = models.Account.Entity, AccountDtoEntity = AccountEntity>(accountDto: any): {
|
|
4
|
+
new (accountMapEntity: (entity: AccountEntity) => AccountDtoEntity): {
|
|
5
|
+
readonly logger: Logger;
|
|
6
|
+
readonly accountMapEntity: (entity: AccountEntity) => AccountDtoEntity;
|
|
7
|
+
info(account: AccountEntity): Promise<AccountDtoEntity>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=account.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/account.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAM9C,wBAAgB,sBAAsB,CAClC,aAAa,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EACnE,gBAAgB,GAAG,aAAa,EAClC,UAAU,EAAE,GAAG;2BAQmF,CAAC,MAAM,EAAE,aAAa,KAAK,gBAAgB;;mCAA3C,CAAC,MAAM,EAAE,aAAa,KAAK,gBAAgB;sBAMjG,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;;EAOtF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.buildAccountController = buildAccountController;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const auth_decorator_1 = require("../decorators/auth.decorator");
|
|
19
|
+
const provider_symbols_1 = require("../constants/provider-symbols");
|
|
20
|
+
const account_decorator_1 = require("../decorators/account.decorator");
|
|
21
|
+
function buildAccountController(accountDto) {
|
|
22
|
+
var AccountController_1;
|
|
23
|
+
let AccountController = AccountController_1 = class AccountController {
|
|
24
|
+
accountMapEntity;
|
|
25
|
+
logger = new common_1.Logger(AccountController_1.name);
|
|
26
|
+
constructor(accountMapEntity) {
|
|
27
|
+
this.accountMapEntity = accountMapEntity;
|
|
28
|
+
}
|
|
29
|
+
async info(account) {
|
|
30
|
+
this.logger.log('info');
|
|
31
|
+
this.logger.log(account);
|
|
32
|
+
return this.accountMapEntity(account);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, common_1.Get)(),
|
|
37
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get account info' }),
|
|
38
|
+
(0, swagger_1.ApiOkResponse)({ description: 'Account info.', type: accountDto }),
|
|
39
|
+
__param(0, (0, account_decorator_1.AccountContext)()),
|
|
40
|
+
__metadata("design:type", Function),
|
|
41
|
+
__metadata("design:paramtypes", [Object]),
|
|
42
|
+
__metadata("design:returntype", Promise)
|
|
43
|
+
], AccountController.prototype, "info", null);
|
|
44
|
+
AccountController = AccountController_1 = __decorate([
|
|
45
|
+
(0, auth_decorator_1.Auth)(),
|
|
46
|
+
(0, swagger_1.ApiTags)('account'),
|
|
47
|
+
(0, common_1.Controller)('account'),
|
|
48
|
+
__param(0, (0, common_1.Inject)(provider_symbols_1.PROVIDER_SYMBOLS.TRAILMIXCMS_CMS_ACCOUNT_MAP_ENTITY)),
|
|
49
|
+
__metadata("design:paramtypes", [Function])
|
|
50
|
+
], AccountController);
|
|
51
|
+
return AccountController;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=account.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.controller.js","sourceRoot":"","sources":["../../src/controllers/account.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA,wDAwBC;AAhCD,2CAAyE;AACzE,6CAAuE;AAEvE,iEAAoD;AAEpD,oEAAiE;AACjE,uEAA+F;AAE/F,SAAgB,sBAAsB,CAGpC,UAAe;;IAEb,IAGM,iBAAiB,yBAHvB,MAGM,iBAAiB;QAGuD;QAFjE,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;QACrD,YAC0E,gBAA6D;YAA7D,qBAAgB,GAAhB,gBAAgB,CAA6C;QACnI,CAAC;QAKC,AAAN,KAAK,CAAC,IAAI,CAAmB,OAAsB;YAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;KACJ,CAAA;IALS;QAHL,IAAA,YAAG,GAAE;QACL,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;QAC7C,IAAA,uBAAa,EAAC,EAAE,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QACtD,WAAA,IAAA,kCAAc,GAAE,CAAA;;;;iDAI3B;IAbC,iBAAiB;QAHtB,IAAA,qBAAI,GAAE;QACN,IAAA,iBAAO,EAAC,SAAS,CAAC;QAClB,IAAA,mBAAU,EAAC,SAAS,CAAC;QAIb,WAAA,IAAA,eAAM,EAAC,mCAAgB,CAAC,kCAAkC,CAAC,CAAA;;OAH9D,iBAAiB,CActB;IACD,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/file.controller.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Controller, Get, Res, Param, Query, BadRequestException } from '@nestjs/common';
|
|
3
|
+
// import { ApiOperation, ApiTags, ApiOkResponse, ApiParam, ApiExtraModels } from '@nestjs/swagger';
|
|
4
|
+
// import { FastifyReply } from 'fastify';
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// import * as models from '@trailmixcms/models';
|
|
7
|
+
// import { StorageService } from '@trailmixcms/storage';
|
|
8
|
+
// import { Collections } from '@trailmixcms/db';
|
|
9
|
+
// import { FileCollection } from '../collections/file.collection';
|
|
10
|
+
// import * as dto from '../dto/file';
|
|
11
|
+
// import { FileByIdPipe } from '../pipes/file.pipe';
|
|
12
|
+
// import { FileService } from '../services/file.service';
|
|
13
|
+
// import { Auth } from '../auth/auth.decorator';
|
|
14
|
+
// import { AccountAuthorization, AuthorizationService } from '../services/authorization.service';
|
|
15
|
+
// import { FileDto } from '../dto/file';
|
|
16
|
+
// @ApiExtraModels(FileDto)
|
|
17
|
+
// @Auth({ allowAnonymous: true })
|
|
18
|
+
// @ApiTags('file')
|
|
19
|
+
// @Controller('file')
|
|
20
|
+
// export class FileController {
|
|
21
|
+
// constructor(
|
|
22
|
+
// private readonly storageService: StorageService,
|
|
23
|
+
// private readonly fileService: FileService,
|
|
24
|
+
// private readonly fileCollection: FileCollection,
|
|
25
|
+
// private readonly authorizationService: AuthorizationService,
|
|
26
|
+
// ) { }
|
|
27
|
+
// @Get()
|
|
28
|
+
// @ApiOperation({ summary: 'Get all files' })
|
|
29
|
+
// @ApiOkResponse({ description: 'List of files.', type: dto.FileListResponseDto })
|
|
30
|
+
// async list(
|
|
31
|
+
// @Query() query: dto.FileListQueryDto,
|
|
32
|
+
// @AccountAuthorization() accountAuthorization: AccountAuthorization,
|
|
33
|
+
// ): Promise<dto.FileListResponseDto> {
|
|
34
|
+
// if (!query.guid) {
|
|
35
|
+
// throw new BadRequestException('Guid is required');
|
|
36
|
+
// }
|
|
37
|
+
// const files = await this.fileCollection.find({
|
|
38
|
+
// guid: query.guid,
|
|
39
|
+
// });
|
|
40
|
+
// return {
|
|
41
|
+
// items: files
|
|
42
|
+
// .filter(entity => this.authorizationService.checkAccountAuthorizationOnEntity(accountAuthorization, entity))
|
|
43
|
+
// .map((file: models.File.Entity) => ({
|
|
44
|
+
// ...models.File.entityToDto(file),
|
|
45
|
+
// cdn_url: this.fileService.getCDNUrl(file),
|
|
46
|
+
// direct_url: `/file/${file._id}/download`
|
|
47
|
+
// }))
|
|
48
|
+
// };
|
|
49
|
+
// }
|
|
50
|
+
// @Get(':id')
|
|
51
|
+
// @ApiParam({ name: 'id', type: String })
|
|
52
|
+
// @ApiOperation({ summary: 'Get file by id' })
|
|
53
|
+
// @ApiOkResponse({ description: 'File.', type: dto.FileResponseDto })
|
|
54
|
+
// async get(
|
|
55
|
+
// @Param('id', FileByIdPipe) entity: models.File.Entity,
|
|
56
|
+
// @AccountAuthorization() accountAuthorization: AccountAuthorization,
|
|
57
|
+
// ): Promise<dto.FileResponseDto> {
|
|
58
|
+
// await this.authorizationService.validateAuthorization(accountAuthorization, entity);
|
|
59
|
+
// return {
|
|
60
|
+
// ...models.File.entityToDto(entity),
|
|
61
|
+
// cdn_url: this.fileService.getCDNUrl(entity),
|
|
62
|
+
// direct_url: `/file/${entity._id}/download`
|
|
63
|
+
// };
|
|
64
|
+
// }
|
|
65
|
+
// @Get(':id/download')
|
|
66
|
+
// @ApiParam({ name: 'id', type: String })
|
|
67
|
+
// @ApiOperation({ summary: 'Get file contents by id' })
|
|
68
|
+
// async getRaw(
|
|
69
|
+
// @Param('id', FileByIdPipe) entity: models.File.Entity,
|
|
70
|
+
// @AccountAuthorization() accountAuthorization: AccountAuthorization,
|
|
71
|
+
// @Res() reply: FastifyReply,
|
|
72
|
+
// ) {
|
|
73
|
+
// await this.authorizationService.validateAuthorization(accountAuthorization, entity);
|
|
74
|
+
// reply.header('Content-Type', `application/${entity.file_extension}`);
|
|
75
|
+
// reply.header('Content-disposition', `attachment; filename=${entity.file_name}`);
|
|
76
|
+
// const fileStream = await this.fileService.downloadFile(entity);
|
|
77
|
+
// reply.send(fileStream);
|
|
78
|
+
// }
|
|
79
|
+
// }
|
|
80
|
+
//# sourceMappingURL=file.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.controller.js","sourceRoot":"","sources":["../../src/controllers/file.controller.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,oGAAoG;AACpG,0CAA0C;;AAE1C,iDAAiD;AACjD,yDAAyD;AACzD,iDAAiD;AACjD,mEAAmE;AAEnE,sCAAsC;AACtC,qDAAqD;AACrD,0DAA0D;AAC1D,iDAAiD;AACjD,kGAAkG;AAClG,yCAAyC;AAEzC,2BAA2B;AAC3B,kCAAkC;AAClC,mBAAmB;AACnB,sBAAsB;AACtB,gCAAgC;AAChC,mBAAmB;AACnB,2DAA2D;AAC3D,qDAAqD;AACrD,2DAA2D;AAC3D,uEAAuE;AACvE,YAAY;AAEZ,aAAa;AACb,kDAAkD;AAClD,uFAAuF;AACvF,kBAAkB;AAClB,gDAAgD;AAChD,8EAA8E;AAC9E,4CAA4C;AAC5C,6BAA6B;AAC7B,iEAAiE;AACjE,YAAY;AAEZ,yDAAyD;AACzD,gCAAgC;AAChC,cAAc;AAEd,mBAAmB;AACnB,2BAA2B;AAC3B,+HAA+H;AAC/H,wDAAwD;AACxD,wDAAwD;AACxD,iEAAiE;AACjE,+DAA+D;AAC/D,sBAAsB;AACtB,aAAa;AACb,QAAQ;AAER,kBAAkB;AAClB,8CAA8C;AAC9C,mDAAmD;AACnD,0EAA0E;AAC1E,iBAAiB;AACjB,iEAAiE;AACjE,8EAA8E;AAC9E,wCAAwC;AACxC,+FAA+F;AAE/F,mBAAmB;AACnB,kDAAkD;AAClD,2DAA2D;AAC3D,yDAAyD;AACzD,aAAa;AACb,QAAQ;AAER,2BAA2B;AAC3B,8CAA8C;AAC9C,4DAA4D;AAC5D,oBAAoB;AACpB,iEAAiE;AACjE,8EAA8E;AAC9E,sCAAsC;AACtC,UAAU;AACV,+FAA+F;AAE/F,gFAAgF;AAChF,2FAA2F;AAE3F,0EAA0E;AAC1E,kCAAkC;AAClC,QAAQ;AACR,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/text.controller.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { Controller, Get, Param, Query, BadRequestException, NotFoundException } from '@nestjs/common';
|
|
3
|
+
// import { ApiOperation, ApiTags, ApiOkResponse, ApiParam } from '@nestjs/swagger';
|
|
4
|
+
// import { Collections } from '@trailmixcms/db';
|
|
5
|
+
// import * as models from '@trailmixcms/models';
|
|
6
|
+
// import * as dto from '../dto/text';
|
|
7
|
+
// import { TextPipe } from '../pipes/text.pipe';
|
|
8
|
+
// import { Auth } from '../auth/auth.decorator';
|
|
9
|
+
// import { AccountAuthorization, AuthorizationService } from '../services/authorization.service';
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
// @Auth({ allowAnonymous: true })
|
|
12
|
+
// @ApiTags('text')
|
|
13
|
+
// @Controller('text')
|
|
14
|
+
// export class TextController {
|
|
15
|
+
// constructor(
|
|
16
|
+
// private readonly textCollection: Collections.TextCollection,
|
|
17
|
+
// private readonly authorizationService: AuthorizationService,
|
|
18
|
+
// ) { }
|
|
19
|
+
// @Get()
|
|
20
|
+
// @ApiOperation({ summary: 'Search texts by guid' })
|
|
21
|
+
// @ApiOkResponse({ description: 'Texts.', type: dto.TextListResponseDto })
|
|
22
|
+
// async list(
|
|
23
|
+
// @Query() query: dto.TextListQueryDto,
|
|
24
|
+
// @AccountAuthorization() accountAuthorization: AccountAuthorization,
|
|
25
|
+
// ) {
|
|
26
|
+
// if (!query.guid) {
|
|
27
|
+
// throw new BadRequestException('Guid is required');
|
|
28
|
+
// }
|
|
29
|
+
// const texts = await this.textCollection.find({ guid: query.guid });
|
|
30
|
+
// return {
|
|
31
|
+
// items: texts
|
|
32
|
+
// .filter(entity => this.authorizationService.checkAccountAuthorizationOnEntity(accountAuthorization, entity))
|
|
33
|
+
// .map((entity: models.Text.Entity) => models.Text.entityToDto(entity))
|
|
34
|
+
// };
|
|
35
|
+
// }
|
|
36
|
+
// @Get(':id')
|
|
37
|
+
// @ApiParam({ name: 'id', type: String })
|
|
38
|
+
// @ApiOperation({ summary: 'Get text by id' })
|
|
39
|
+
// @ApiOkResponse({ description: 'Text details.', type: dto.TextDto })
|
|
40
|
+
// async get(
|
|
41
|
+
// @Param('id', TextPipe) entity: models.Text.Entity,
|
|
42
|
+
// @AccountAuthorization() accountAuthorization: AccountAuthorization,
|
|
43
|
+
// ) {
|
|
44
|
+
// await this.authorizationService.validateAuthorization(accountAuthorization, entity);
|
|
45
|
+
// return models.Text.entityToDto(entity);
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
//# sourceMappingURL=text.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.controller.js","sourceRoot":"","sources":["../../src/controllers/text.controller.ts"],"names":[],"mappings":";AAAA,0GAA0G;AAC1G,oFAAoF;AACpF,iDAAiD;AACjD,iDAAiD;AACjD,sCAAsC;AACtC,iDAAiD;AACjD,iDAAiD;AACjD,kGAAkG;;AAElG,kCAAkC;AAClC,mBAAmB;AACnB,sBAAsB;AACtB,gCAAgC;AAChC,mBAAmB;AACnB,uEAAuE;AACvE,uEAAuE;AACvE,YAAY;AAEZ,aAAa;AACb,yDAAyD;AACzD,+EAA+E;AAC/E,kBAAkB;AAClB,gDAAgD;AAChD,8EAA8E;AAC9E,UAAU;AACV,6BAA6B;AAC7B,iEAAiE;AACjE,YAAY;AACZ,8EAA8E;AAE9E,mBAAmB;AACnB,2BAA2B;AAC3B,+HAA+H;AAC/H,wFAAwF;AACxF,aAAa;AACb,QAAQ;AAER,kBAAkB;AAClB,8CAA8C;AAC9C,mDAAmD;AACnD,0EAA0E;AAC1E,iBAAiB;AACjB,6DAA6D;AAC7D,8EAA8E;AAC9E,UAAU;AACV,+FAA+F;AAC/F,kDAAkD;AAClD,QAAQ;AACR,KAAK"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as models from '@trailmixcms/models';
|
|
2
|
+
export declare function buildAccountContextDecorator<T extends models.Account.Entity = models.Account.Entity>(): ParameterDecorator;
|
|
3
|
+
export declare const AccountContext: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
4
|
+
//# sourceMappingURL=account.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/account.decorator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAE9C,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,kBAAkB,CAO1H;AAED,eAAO,MAAM,cAAc,mDAK1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountContext = void 0;
|
|
4
|
+
exports.buildAccountContextDecorator = buildAccountContextDecorator;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
function buildAccountContextDecorator() {
|
|
7
|
+
return (0, common_1.createParamDecorator)((data, ctx) => {
|
|
8
|
+
const request = ctx.switchToHttp().getRequest();
|
|
9
|
+
return request.account;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.AccountContext = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
13
|
+
const request = ctx.switchToHttp().getRequest();
|
|
14
|
+
return request.account;
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=account.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.decorator.js","sourceRoot":"","sources":["../../src/decorators/account.decorator.ts"],"names":[],"mappings":";;;AAIA,oEAOC;AAXD,2CAAwE;AAIxE,SAAgB,4BAA4B;IACxC,OAAO,IAAA,6BAAoB,EACvB,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAkB,CAAC;QAChE,OAAO,OAAO,CAAC,OAAY,CAAC;IAChC,CAAC,CACJ,CAAC;AACN,CAAC;AAEY,QAAA,cAAc,GAAG,IAAA,6BAAoB,EAC9C,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACrC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAkB,CAAC;IAChE,OAAO,OAAO,CAAC,OAAc,CAAC;AAClC,CAAC,CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-context.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/audit-context.decorator.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,mDAaxB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuditContext = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.AuditContext = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
+
const request = ctx.switchToHttp().getRequest();
|
|
7
|
+
if (!request.account) {
|
|
8
|
+
// TODO: Log this error
|
|
9
|
+
throw new common_1.InternalServerErrorException('No account found in request');
|
|
10
|
+
}
|
|
11
|
+
const auditContext = {
|
|
12
|
+
account_id: request.account._id,
|
|
13
|
+
system: false,
|
|
14
|
+
};
|
|
15
|
+
return auditContext;
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=audit-context.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-context.decorator.js","sourceRoot":"","sources":["../../src/decorators/audit-context.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAsG;AAIzF,QAAA,YAAY,GAAG,IAAA,6BAAoB,EAC5C,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACrC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAkB,CAAC;IAChE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACnB,uBAAuB;QACvB,MAAM,IAAI,qCAA4B,CAAC,6BAA6B,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,YAAY,GAA8B;QAC5C,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;QAC/B,MAAM,EAAE,KAAK;KAChB,CAAC;IACF,OAAO,YAAY,CAAC;AACxB,CAAC,CACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Role } from '@trailmixcms/models';
|
|
2
|
+
export declare const ALLOW_ANONYMOUS_KEY = "allowAnonymous";
|
|
3
|
+
export declare const ROLES_KEY = "roles";
|
|
4
|
+
export interface AuthOptions {
|
|
5
|
+
roles?: Role[];
|
|
6
|
+
allowAnonymous?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function Auth({ roles, allowAnonymous }?: AuthOptions): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
9
|
+
//# sourceMappingURL=auth.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/auth.decorator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC,MAAM,WAAW,WAAW;IACxB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAU,EAAE,cAAsB,EAAE,GAAE,WAAgB,+IAO5E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROLES_KEY = exports.ALLOW_ANONYMOUS_KEY = void 0;
|
|
4
|
+
exports.Auth = Auth;
|
|
5
|
+
const auth_guard_1 = require("../auth.guard");
|
|
6
|
+
const common_1 = require("@nestjs/common");
|
|
7
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
8
|
+
exports.ALLOW_ANONYMOUS_KEY = 'allowAnonymous';
|
|
9
|
+
exports.ROLES_KEY = 'roles';
|
|
10
|
+
function Auth({ roles = [], allowAnonymous = false } = {}) {
|
|
11
|
+
return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(exports.ROLES_KEY, roles), (0, common_1.SetMetadata)(exports.ALLOW_ANONYMOUS_KEY, allowAnonymous), (0, common_1.UseGuards)(auth_guard_1.AuthGuard), (0, swagger_1.ApiBearerAuth)());
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=auth.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.decorator.js","sourceRoot":"","sources":["../../src/decorators/auth.decorator.ts"],"names":[],"mappings":";;;AAcA,oBAOC;AArBD,8CAAyC;AACzC,2CAAyE;AACzE,6CAAgD;AAInC,QAAA,mBAAmB,GAAG,gBAAgB,CAAC;AACvC,QAAA,SAAS,GAAG,OAAO,CAAC;AAOjC,SAAgB,IAAI,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,cAAc,GAAG,KAAK,KAAkB,EAAE;IACzE,OAAO,IAAA,wBAAe,EAClB,IAAA,oBAAW,EAAC,iBAAS,EAAE,KAAK,CAAC,EAC7B,IAAA,oBAAW,EAAC,2BAAmB,EAAE,cAAc,CAAC,EAChD,IAAA,kBAAS,EAAC,sBAAS,CAAC,EACpB,IAAA,uBAAa,GAAE,CAClB,CAAC;AACN,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,cAAc,CAAC"}
|