@90soft/parse-server-kit 1.0.0 → 2.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/README.md +424 -0
- package/dist/decorators/cloudDecorator.d.ts +7 -0
- package/dist/decorators/cloudDecorator.d.ts.map +1 -0
- package/dist/decorators/cloudDecorator.js +77 -0
- package/dist/decorators/cloudDecorator.js.map +1 -0
- package/dist/decorators/cloudRegistry.d.ts +9 -0
- package/dist/decorators/cloudRegistry.d.ts.map +1 -0
- package/dist/decorators/cloudRegistry.js +26 -0
- package/dist/decorators/cloudRegistry.js.map +1 -0
- package/dist/decorators/cronDecorator.d.ts +6 -0
- package/dist/decorators/cronDecorator.d.ts.map +1 -0
- package/dist/decorators/cronDecorator.js +28 -0
- package/dist/decorators/cronDecorator.js.map +1 -0
- package/dist/decorators/cronRegistry.d.ts +13 -0
- package/dist/decorators/cronRegistry.d.ts.map +1 -0
- package/dist/decorators/cronRegistry.js +96 -0
- package/dist/decorators/cronRegistry.js.map +1 -0
- package/dist/decorators/routeDecorator.d.ts +35 -0
- package/dist/decorators/routeDecorator.d.ts.map +1 -0
- package/dist/decorators/routeDecorator.js +160 -0
- package/dist/decorators/routeDecorator.js.map +1 -0
- package/dist/decorators/triggerDecorator.d.ts +19 -0
- package/dist/decorators/triggerDecorator.d.ts.map +1 -0
- package/dist/decorators/triggerDecorator.js +45 -0
- package/dist/decorators/triggerDecorator.js.map +1 -0
- package/dist/decorators/triggerRegistry.d.ts +10 -0
- package/dist/decorators/triggerRegistry.d.ts.map +1 -0
- package/dist/decorators/triggerRegistry.js +87 -0
- package/dist/decorators/triggerRegistry.js.map +1 -0
- package/dist/decorators/types/cloudTypes.d.ts +32 -0
- package/dist/decorators/types/cloudTypes.d.ts.map +1 -0
- package/dist/decorators/types/cloudTypes.js +3 -0
- package/dist/decorators/types/cloudTypes.js.map +1 -0
- package/dist/decorators/types/common.d.ts +14 -0
- package/dist/decorators/types/common.d.ts.map +1 -0
- package/dist/decorators/types/common.js +3 -0
- package/dist/decorators/types/common.js.map +1 -0
- package/dist/decorators/types/cronTypes.d.ts +32 -0
- package/dist/decorators/types/cronTypes.d.ts.map +1 -0
- package/dist/decorators/types/cronTypes.js +21 -0
- package/dist/decorators/types/cronTypes.js.map +1 -0
- package/dist/decorators/types/fieldValidation.d.ts +36 -0
- package/dist/decorators/types/fieldValidation.d.ts.map +1 -0
- package/dist/decorators/types/fieldValidation.js +135 -0
- package/dist/decorators/types/fieldValidation.js.map +1 -0
- package/dist/decorators/types/triggerTypes.d.ts +14 -0
- package/dist/decorators/types/triggerTypes.d.ts.map +1 -0
- package/dist/decorators/types/triggerTypes.js +3 -0
- package/dist/decorators/types/triggerTypes.js.map +1 -0
- package/dist/index.d.ts +25 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -6
- package/dist/index.js.map +1 -1
- package/dist/middleware/middleware.d.ts +41 -0
- package/dist/middleware/middleware.d.ts.map +1 -0
- package/dist/middleware/middleware.js +154 -0
- package/dist/middleware/middleware.js.map +1 -0
- package/dist/swagger/index.d.ts +9 -0
- package/dist/swagger/index.d.ts.map +1 -0
- package/dist/swagger/index.js +37 -0
- package/dist/swagger/index.js.map +1 -0
- package/dist/swagger/swaggerRegistry.d.ts +79 -0
- package/dist/swagger/swaggerRegistry.d.ts.map +1 -0
- package/dist/swagger/swaggerRegistry.js +115 -0
- package/dist/swagger/swaggerRegistry.js.map +1 -0
- package/dist/swagger/swaggerSpec.d.ts +69 -0
- package/dist/swagger/swaggerSpec.d.ts.map +1 -0
- package/dist/swagger/swaggerSpec.js +174 -0
- package/dist/swagger/swaggerSpec.js.map +1 -0
- package/dist/utils/ACL.d.ts +19 -0
- package/dist/utils/ACL.d.ts.map +1 -0
- package/dist/utils/ACL.js +35 -0
- package/dist/utils/ACL.js.map +1 -0
- package/dist/utils/constants.d.ts +13 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +19 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/dynamicImport.d.ts +2 -0
- package/dist/utils/dynamicImport.d.ts.map +1 -0
- package/dist/utils/dynamicImport.js +21 -0
- package/dist/utils/dynamicImport.js.map +1 -0
- package/dist/utils/helper.d.ts +15 -0
- package/dist/utils/helper.d.ts.map +1 -0
- package/dist/utils/helper.js +93 -0
- package/dist/utils/helper.js.map +1 -0
- package/package.json +21 -5
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronRegistry = void 0;
|
|
4
|
+
let cron;
|
|
5
|
+
try {
|
|
6
|
+
cron = require('node-cron');
|
|
7
|
+
}
|
|
8
|
+
catch { /* optional dependency */ }
|
|
9
|
+
class CronRegistry {
|
|
10
|
+
static register(metadata) {
|
|
11
|
+
if (this.jobs.has(metadata.name)) {
|
|
12
|
+
console.warn(`[Cron] Warning: Overwriting existing job '${metadata.name}'`);
|
|
13
|
+
}
|
|
14
|
+
this.jobs.set(metadata.name, { metadata, task: null });
|
|
15
|
+
}
|
|
16
|
+
static getJobs() {
|
|
17
|
+
return Array.from(this.jobs.values()).map(j => j.metadata);
|
|
18
|
+
}
|
|
19
|
+
static getJob(name) {
|
|
20
|
+
return this.jobs.get(name)?.metadata;
|
|
21
|
+
}
|
|
22
|
+
static initialize() {
|
|
23
|
+
if (!cron) {
|
|
24
|
+
console.warn('[Cron] node-cron not installed — skipping cron job registration');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const jobs = this.getJobs();
|
|
28
|
+
if (jobs.length === 0) {
|
|
29
|
+
console.log('[Cron] No cron jobs to register');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.log(`[Cron] Registering ${jobs.length} cron job(s)...`);
|
|
33
|
+
for (const metadata of jobs) {
|
|
34
|
+
const { name, schedule, handler, description, enabled = true, timezone = 'UTC' } = metadata;
|
|
35
|
+
if (!enabled) {
|
|
36
|
+
console.log(`[Cron] Skipping disabled job: ${name}`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (!cron.validate(schedule)) {
|
|
40
|
+
console.error(`[Cron] Invalid schedule for job '${name}': ${schedule}`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const task = cron.schedule(schedule, async () => {
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
console.log(`[Cron] Running job: ${name}`);
|
|
46
|
+
try {
|
|
47
|
+
await handler();
|
|
48
|
+
console.log(`[Cron] Job '${name}' completed in ${Date.now() - startTime}ms`);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error(`[Cron] Job '${name}' failed:`, error.message);
|
|
52
|
+
}
|
|
53
|
+
}, { timezone });
|
|
54
|
+
task.start();
|
|
55
|
+
const jobEntry = this.jobs.get(name);
|
|
56
|
+
if (jobEntry)
|
|
57
|
+
jobEntry.task = task;
|
|
58
|
+
const desc = description ? ` - ${description}` : '';
|
|
59
|
+
console.log(`[Cron] Registered: ${name} (${schedule})${desc}`);
|
|
60
|
+
}
|
|
61
|
+
console.log('[Cron] All cron jobs registered');
|
|
62
|
+
}
|
|
63
|
+
static stopJob(name) {
|
|
64
|
+
const job = this.jobs.get(name);
|
|
65
|
+
if (job?.task) {
|
|
66
|
+
job.task.stop();
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
static startJob(name) {
|
|
72
|
+
const job = this.jobs.get(name);
|
|
73
|
+
if (job?.task) {
|
|
74
|
+
job.task.start();
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
static stopAll() {
|
|
80
|
+
for (const [, job] of this.jobs) {
|
|
81
|
+
if (job.task)
|
|
82
|
+
job.task.stop();
|
|
83
|
+
}
|
|
84
|
+
console.log('[Cron] All jobs stopped');
|
|
85
|
+
}
|
|
86
|
+
static async runNow(name) {
|
|
87
|
+
const job = this.jobs.get(name);
|
|
88
|
+
if (!job)
|
|
89
|
+
throw new Error(`Job '${name}' not found`);
|
|
90
|
+
console.log(`[Cron] Manually running job: ${name}`);
|
|
91
|
+
await job.metadata.handler();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.CronRegistry = CronRegistry;
|
|
95
|
+
CronRegistry.jobs = new Map();
|
|
96
|
+
//# sourceMappingURL=cronRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronRegistry.js","sourceRoot":"","sources":["../../src/decorators/cronRegistry.ts"],"names":[],"mappings":";;;AAEA,IAAI,IAAS,CAAC;AACd,IAAI,CAAC;IAAC,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAAC,CAAC;AAAC,MAAM,CAAC,CAAC,yBAAyB,CAAC,CAAC;AAOxE,MAAa,YAAY;IAGvB,MAAM,CAAC,QAAQ,CAAC,QAAyB;QACvC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,6CAA6C,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;QAC9E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACvC,CAAC;IAED,MAAM,CAA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AC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,IAAI,GAAG,CAAC,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAY;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,aAAa,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;;AAnFH,oCAoFC;AAnFgB,iBAAI,GAA+B,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* @Route class decorator.
|
|
4
|
+
* Accepts a Parse model class (reads className) or a custom string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Route(target: Function | string): (constructor: Function) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Global route registry — maps route prefixes to function names.
|
|
9
|
+
* Built during decorator phase, consumed during server init.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RouteRegistry {
|
|
12
|
+
private static prefixes;
|
|
13
|
+
private static routeMap;
|
|
14
|
+
private static registeredPrefixes;
|
|
15
|
+
static register(className: string, prefix: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Called after CloudFunctionRegistry.initialize().
|
|
18
|
+
* Builds the route map by matching function names to route prefixes.
|
|
19
|
+
*/
|
|
20
|
+
static initialize(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Look up a cloud function name by route path.
|
|
23
|
+
* '/students/create' → 'createStudent'
|
|
24
|
+
*/
|
|
25
|
+
static resolve(routePath: string): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a path starts with a registered route prefix.
|
|
28
|
+
*/
|
|
29
|
+
static isRegisteredPrefix(path: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get all registered prefixes (for restrictRoutes middleware).
|
|
32
|
+
*/
|
|
33
|
+
static getPrefixes(): string[];
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=routeDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAyE1B;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,IAC5B,aAAa,QAAQ,UAiBvC;AAED;;;GAGG;AACH,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA0B;IAE3D,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAIjD;;;OAGG;IACH,MAAM,CAAC,UAAU;IA6BjB;;;OAGG;IACH,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIrD;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOhD;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,MAAM,EAAE;CAG/B"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RouteRegistry = void 0;
|
|
4
|
+
exports.Route = Route;
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const cloudRegistry_1 = require("./cloudRegistry");
|
|
7
|
+
/**
|
|
8
|
+
* @Route decorator — maps cloud functions to entity-based routes.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* @Route(Student) // reads className → 'Student' → /api/students/*
|
|
12
|
+
* @Route('school-students') // custom string → /api/school-students/*
|
|
13
|
+
*
|
|
14
|
+
* The decorator reads the class name (from @ParseClass metadata or string),
|
|
15
|
+
* converts it to a kebab-plural prefix, and tags all cloud functions in
|
|
16
|
+
* the decorated class with that prefix.
|
|
17
|
+
*
|
|
18
|
+
* At server init, CloudFunctionRegistry builds a route map:
|
|
19
|
+
* /students/create → createStudent
|
|
20
|
+
* /students/list → listStudents
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Convert PascalCase to kebab-case plural.
|
|
24
|
+
* 'Student' → 'students'
|
|
25
|
+
* 'MenuItem' → 'menu-items'
|
|
26
|
+
* 'MeetingMinute' → 'meeting-minutes'
|
|
27
|
+
*/
|
|
28
|
+
function toKebabPlural(name) {
|
|
29
|
+
const kebab = name
|
|
30
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
31
|
+
.toLowerCase();
|
|
32
|
+
// Simple pluralize: add 's' (covers most cases)
|
|
33
|
+
// Words ending in 'y' → 'ies', 's'/'sh'/'ch'/'x' → 'es'
|
|
34
|
+
if (kebab.endsWith('y') && !kebab.endsWith('ay') && !kebab.endsWith('ey') && !kebab.endsWith('oy')) {
|
|
35
|
+
return kebab.slice(0, -1) + 'ies';
|
|
36
|
+
}
|
|
37
|
+
if (kebab.endsWith('s') || kebab.endsWith('sh') || kebab.endsWith('ch') || kebab.endsWith('x')) {
|
|
38
|
+
return kebab + 'es';
|
|
39
|
+
}
|
|
40
|
+
return kebab + 's';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Extract action name from a cloud function name.
|
|
44
|
+
* 'createStudent' → 'create'
|
|
45
|
+
* 'listStudents' → 'list'
|
|
46
|
+
* 'getStudent' → 'get'
|
|
47
|
+
* 'updateStudent' → 'update'
|
|
48
|
+
* 'deleteStudent' → 'delete'
|
|
49
|
+
* 'searchStudents' → 'search'
|
|
50
|
+
* 'customAction' → 'customAction' (fallback: use full name)
|
|
51
|
+
*/
|
|
52
|
+
function extractAction(functionName, className) {
|
|
53
|
+
const classLower = className.toLowerCase();
|
|
54
|
+
const fnLower = functionName.toLowerCase();
|
|
55
|
+
// Standard CRUD prefixes
|
|
56
|
+
const prefixes = ['create', 'get', 'list', 'update', 'delete', 'search'];
|
|
57
|
+
for (const prefix of prefixes) {
|
|
58
|
+
if (fnLower.startsWith(prefix) && fnLower.includes(classLower)) {
|
|
59
|
+
return prefix;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Pluralized form (e.g., 'listStudents' where className is 'Student')
|
|
63
|
+
for (const prefix of prefixes) {
|
|
64
|
+
if (fnLower.startsWith(prefix)) {
|
|
65
|
+
return prefix;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Fallback: return the full function name as the action
|
|
69
|
+
return functionName;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @Route class decorator.
|
|
73
|
+
* Accepts a Parse model class (reads className) or a custom string.
|
|
74
|
+
*/
|
|
75
|
+
function Route(target) {
|
|
76
|
+
return function (constructor) {
|
|
77
|
+
let prefix;
|
|
78
|
+
let className;
|
|
79
|
+
if (typeof target === 'string') {
|
|
80
|
+
prefix = target;
|
|
81
|
+
className = target;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Read className from @ParseClass metadata
|
|
85
|
+
className = Reflect.getMetadata('parse:className', target) || target.name;
|
|
86
|
+
prefix = toKebabPlural(className);
|
|
87
|
+
}
|
|
88
|
+
// Tag all functions registered by this class with the route prefix
|
|
89
|
+
// We use a post-init hook: store the mapping, apply after CloudFunctionRegistry.initialize()
|
|
90
|
+
RouteRegistry.register(className, prefix);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Global route registry — maps route prefixes to function names.
|
|
95
|
+
* Built during decorator phase, consumed during server init.
|
|
96
|
+
*/
|
|
97
|
+
class RouteRegistry {
|
|
98
|
+
static register(className, prefix) {
|
|
99
|
+
this.prefixes.set(className.toLowerCase(), prefix);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Called after CloudFunctionRegistry.initialize().
|
|
103
|
+
* Builds the route map by matching function names to route prefixes.
|
|
104
|
+
*/
|
|
105
|
+
static initialize() {
|
|
106
|
+
const functions = cloudRegistry_1.CloudFunctionRegistry.getFunctions();
|
|
107
|
+
for (const fn of functions) {
|
|
108
|
+
// Find which prefix this function belongs to
|
|
109
|
+
let matchedPrefix = null;
|
|
110
|
+
let matchedClassName = null;
|
|
111
|
+
for (const [className, prefix] of this.prefixes) {
|
|
112
|
+
if (fn.name.toLowerCase().includes(className)) {
|
|
113
|
+
matchedPrefix = prefix;
|
|
114
|
+
matchedClassName = className;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (matchedPrefix && matchedClassName) {
|
|
119
|
+
const action = extractAction(fn.name, matchedClassName);
|
|
120
|
+
const routePath = `/${matchedPrefix}/${action}`;
|
|
121
|
+
this.routeMap.set(routePath, fn.name);
|
|
122
|
+
this.registeredPrefixes.add(`/${matchedPrefix}`);
|
|
123
|
+
fn.routePrefix = matchedPrefix;
|
|
124
|
+
console.log(` Route: ${routePath} → ${fn.name}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
console.log(`Route registry: ${this.routeMap.size} routes registered`);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Look up a cloud function name by route path.
|
|
131
|
+
* '/students/create' → 'createStudent'
|
|
132
|
+
*/
|
|
133
|
+
static resolve(routePath) {
|
|
134
|
+
return this.routeMap.get(routePath);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Check if a path starts with a registered route prefix.
|
|
138
|
+
*/
|
|
139
|
+
static isRegisteredPrefix(path) {
|
|
140
|
+
for (const prefix of this.registeredPrefixes) {
|
|
141
|
+
if (path.startsWith(prefix))
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get all registered prefixes (for restrictRoutes middleware).
|
|
148
|
+
*/
|
|
149
|
+
static getPrefixes() {
|
|
150
|
+
return Array.from(this.registeredPrefixes);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.RouteRegistry = RouteRegistry;
|
|
154
|
+
// className → route prefix
|
|
155
|
+
RouteRegistry.prefixes = new Map();
|
|
156
|
+
// route path → function name (built during initialize)
|
|
157
|
+
RouteRegistry.routeMap = new Map();
|
|
158
|
+
// all registered route prefixes (for middleware)
|
|
159
|
+
RouteRegistry.registeredPrefixes = new Set();
|
|
160
|
+
//# sourceMappingURL=routeDecorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeDecorator.js","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":";;;AA6EA,sBAkBC;AA/FD,4BAA0B;AAC1B,mDAAsD;AAEtD;;;;;;;;;;;;;;GAcG;AAEH;;;;;GAKG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,KAAK,GAAG,IAAI;SACf,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE,CAAC;IACjB,gDAAgD;IAChD,wDAAwD;IACxD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnG,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG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: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
4
|
+
export declare const AfterSave: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
5
|
+
export declare const BeforeDelete: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
6
|
+
export declare const AfterDelete: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
7
|
+
export declare const BeforeFind: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
8
|
+
export declare const AfterFind: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
9
|
+
export declare const BeforeLogin: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
10
|
+
export declare const AfterLogin: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
11
|
+
export declare const AfterLogout: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
12
|
+
export declare const BeforeSaveFile: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
13
|
+
export declare const AfterSaveFile: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
14
|
+
export declare const BeforeDeleteFile: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
15
|
+
export declare const AfterDeleteFile: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
16
|
+
export declare const BeforeConnect: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
17
|
+
export declare const BeforeSubscribe: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
18
|
+
export declare const AfterEvent: (config?: TriggerConfig) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
19
|
+
//# sourceMappingURL=triggerDecorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/triggerDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAc,MAAM,sBAAsB,CAAC;AA0BhE,eAAO,MAAM,UAAU,YAvBI,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAsBvB,CAAC;AAC/D,eAAO,MAAM,SAAS,YAxBK,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAuBzB,CAAC;AAC7D,eAAO,MAAM,YAAY,YAzBE,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAwBnB,CAAC;AACnE,eAAO,MAAM,WAAW,YA1BG,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAyBrB,CAAC;AACjE,eAAO,MAAM,UAAU,YA3BI,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA0BvB,CAAC;AAC/D,eAAO,MAAM,SAAS,YA5BK,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA2BzB,CAAC;AAG7D,eAAO,MAAM,WAAW,YA/BG,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA8BrB,CAAC;AACjE,eAAO,MAAM,UAAU,YAhCI,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA+BvB,CAAC;AAC/D,eAAO,MAAM,WAAW,YAjCG,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAgCrB,CAAC;AAGjE,eAAO,MAAM,cAAc,YApCA,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAmCf,CAAC;AACvE,eAAO,MAAM,aAAa,YArCC,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAoCjB,CAAC;AACrE,eAAO,MAAM,gBAAgB,YAtCF,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAqCX,CAAC;AAC3E,eAAO,MAAM,eAAe,YAvCD,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAsCb,CAAC;AAGzE,eAAO,MAAM,aAAa,YA1CC,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBAyCjB,CAAC;AACrE,eAAO,MAAM,eAAe,YA3CD,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA0Cb,CAAC;AACzE,eAAO,MAAM,UAAU,YA5CI,aAAa,MACnB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,uBA2CvB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AfterEvent = exports.BeforeSubscribe = exports.BeforeConnect = exports.AfterDeleteFile = exports.BeforeDeleteFile = exports.AfterSaveFile = exports.BeforeSaveFile = exports.AfterLogout = exports.AfterLogin = exports.BeforeLogin = exports.AfterFind = exports.BeforeFind = exports.AfterDelete = exports.BeforeDelete = exports.AfterSave = exports.BeforeSave = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
function createTriggerDecorator(type) {
|
|
6
|
+
return function (config = {}) {
|
|
7
|
+
return function (target, propertyKey, descriptor) {
|
|
8
|
+
const handler = descriptor.value;
|
|
9
|
+
if (typeof handler !== 'function') {
|
|
10
|
+
throw new Error(`@${type} decorator can only be applied to methods.`);
|
|
11
|
+
}
|
|
12
|
+
const constructor = typeof target === 'function' ? target : target.constructor;
|
|
13
|
+
const pendingTriggers = Reflect.getMetadata('parse:pendingTriggers', constructor) || [];
|
|
14
|
+
pendingTriggers.push({
|
|
15
|
+
type,
|
|
16
|
+
handler,
|
|
17
|
+
description: config.description,
|
|
18
|
+
validation: config.validation,
|
|
19
|
+
});
|
|
20
|
+
Reflect.defineMetadata('parse:pendingTriggers', pendingTriggers, constructor);
|
|
21
|
+
return descriptor;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// Object triggers
|
|
26
|
+
exports.BeforeSave = createTriggerDecorator('beforeSave');
|
|
27
|
+
exports.AfterSave = createTriggerDecorator('afterSave');
|
|
28
|
+
exports.BeforeDelete = createTriggerDecorator('beforeDelete');
|
|
29
|
+
exports.AfterDelete = createTriggerDecorator('afterDelete');
|
|
30
|
+
exports.BeforeFind = createTriggerDecorator('beforeFind');
|
|
31
|
+
exports.AfterFind = createTriggerDecorator('afterFind');
|
|
32
|
+
// User auth triggers
|
|
33
|
+
exports.BeforeLogin = createTriggerDecorator('beforeLogin');
|
|
34
|
+
exports.AfterLogin = createTriggerDecorator('afterLogin');
|
|
35
|
+
exports.AfterLogout = createTriggerDecorator('afterLogout');
|
|
36
|
+
// File triggers
|
|
37
|
+
exports.BeforeSaveFile = createTriggerDecorator('beforeSaveFile');
|
|
38
|
+
exports.AfterSaveFile = createTriggerDecorator('afterSaveFile');
|
|
39
|
+
exports.BeforeDeleteFile = createTriggerDecorator('beforeDeleteFile');
|
|
40
|
+
exports.AfterDeleteFile = createTriggerDecorator('afterDeleteFile');
|
|
41
|
+
// LiveQuery triggers
|
|
42
|
+
exports.BeforeConnect = createTriggerDecorator('beforeConnect');
|
|
43
|
+
exports.BeforeSubscribe = createTriggerDecorator('beforeSubscribe');
|
|
44
|
+
exports.AfterEvent = createTriggerDecorator('afterEvent');
|
|
45
|
+
//# sourceMappingURL=triggerDecorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerDecorator.js","sourceRoot":"","sources":["../../src/decorators/triggerDecorator.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAG1B,SAAS,sBAAsB,CAAC,IAAiB;IAC/C,OAAO,UAAU,SAAwB,EAAE;QACzC,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;YAC/E,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC;YACjC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,4CAA4C,CAAC,CAAC;YACxE,CAAC;YAED,MAAM,WAAW,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;YAC/E,MAAM,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,uBAAuB,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;YACxF,eAAe,CAAC,IAAI,CAAC;gBACnB,IAAI;gBACJ,OAAO;gBACP,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC,CAAC;YACH,OAAO,CAAC,cAAc,CAAC,uBAAuB,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;YAE9E,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,kBAAkB;AACL,QAAA,UAAU,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;AAClD,QAAA,SAAS,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC;AAChD,QAAA,YAAY,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;AACtD,QAAA,WAAW,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AACpD,QAAA,UAAU,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;AAClD,QAAA,SAAS,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC;AAE7D,qBAAqB;AACR,QAAA,WAAW,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AACpD,QAAA,UAAU,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC;AAClD,QAAA,WAAW,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;AAEjE,gBAAgB;AACH,QAAA,cAAc,GAAG,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;AAC1D,QAAA,aAAa,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AACxD,QAAA,gBAAgB,GAAG,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;AAC9D,QAAA,eAAe,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;AAEzE,qBAAqB;AACR,QAAA,aAAa,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AACxD,QAAA,eAAe,GAAG,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;AAC5D,QAAA,UAAU,GAAG,sBAAsB,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TriggerMetadata } from './types/triggerTypes';
|
|
2
|
+
export declare class TriggerRegistry {
|
|
3
|
+
private static triggers;
|
|
4
|
+
private static getKey;
|
|
5
|
+
static register(metadata: TriggerMetadata): void;
|
|
6
|
+
static getTriggers(): TriggerMetadata[];
|
|
7
|
+
static getTriggersForClass(className: string): TriggerMetadata[];
|
|
8
|
+
static initialize(): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=triggerRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerRegistry.d.ts","sourceRoot":"","sources":["../../src/decorators/triggerRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAc,MAAM,sBAAsB,CAAC;AAElE,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2C;IAElE,OAAO,CAAC,MAAM,CAAC,MAAM;IAIrB,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAQhD,MAAM,CAAC,WAAW,IAAI,eAAe,EAAE;IAIvC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE;IAIhE,MAAM,CAAC,UAAU,IAAI,IAAI;CAoC1B"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TriggerRegistry = void 0;
|
|
4
|
+
class TriggerRegistry {
|
|
5
|
+
static getKey(className, type) {
|
|
6
|
+
return `${className}:${type}`;
|
|
7
|
+
}
|
|
8
|
+
static register(metadata) {
|
|
9
|
+
const key = this.getKey(metadata.className, metadata.type);
|
|
10
|
+
if (this.triggers.has(key)) {
|
|
11
|
+
console.warn(`[Triggers] Warning: Overwriting existing ${metadata.type} trigger for ${metadata.className}`);
|
|
12
|
+
}
|
|
13
|
+
this.triggers.set(key, metadata);
|
|
14
|
+
}
|
|
15
|
+
static getTriggers() {
|
|
16
|
+
return Array.from(this.triggers.values());
|
|
17
|
+
}
|
|
18
|
+
static getTriggersForClass(className) {
|
|
19
|
+
return this.getTriggers().filter(t => t.className === className);
|
|
20
|
+
}
|
|
21
|
+
static initialize() {
|
|
22
|
+
const triggers = this.getTriggers();
|
|
23
|
+
if (triggers.length === 0) {
|
|
24
|
+
console.log('[Triggers] No triggers to register');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(`[Triggers] Registering ${triggers.length} trigger(s)...`);
|
|
28
|
+
for (const metadata of triggers) {
|
|
29
|
+
const { type, className, handler, validation } = metadata;
|
|
30
|
+
switch (type) {
|
|
31
|
+
case 'beforeSave':
|
|
32
|
+
Parse.Cloud.beforeSave(className, handler, validation);
|
|
33
|
+
break;
|
|
34
|
+
case 'afterSave':
|
|
35
|
+
Parse.Cloud.afterSave(className, handler, validation);
|
|
36
|
+
break;
|
|
37
|
+
case 'beforeDelete':
|
|
38
|
+
Parse.Cloud.beforeDelete(className, handler, validation);
|
|
39
|
+
break;
|
|
40
|
+
case 'afterDelete':
|
|
41
|
+
Parse.Cloud.afterDelete(className, handler, validation);
|
|
42
|
+
break;
|
|
43
|
+
case 'beforeFind':
|
|
44
|
+
Parse.Cloud.beforeFind(className, handler, validation);
|
|
45
|
+
break;
|
|
46
|
+
case 'afterFind':
|
|
47
|
+
Parse.Cloud.afterFind(className, handler, validation);
|
|
48
|
+
break;
|
|
49
|
+
case 'beforeLogin':
|
|
50
|
+
Parse.Cloud.beforeLogin(handler);
|
|
51
|
+
break;
|
|
52
|
+
case 'afterLogin':
|
|
53
|
+
Parse.Cloud.afterLogin(handler, validation);
|
|
54
|
+
break;
|
|
55
|
+
case 'afterLogout':
|
|
56
|
+
Parse.Cloud.afterLogout(handler, validation);
|
|
57
|
+
break;
|
|
58
|
+
case 'beforeSaveFile':
|
|
59
|
+
Parse.Cloud.beforeSaveFile(handler, validation);
|
|
60
|
+
break;
|
|
61
|
+
case 'afterSaveFile':
|
|
62
|
+
Parse.Cloud.afterSaveFile(handler, validation);
|
|
63
|
+
break;
|
|
64
|
+
case 'beforeDeleteFile':
|
|
65
|
+
Parse.Cloud.beforeDeleteFile(handler, validation);
|
|
66
|
+
break;
|
|
67
|
+
case 'afterDeleteFile':
|
|
68
|
+
Parse.Cloud.afterDeleteFile(handler, validation);
|
|
69
|
+
break;
|
|
70
|
+
case 'beforeConnect':
|
|
71
|
+
Parse.Cloud.beforeConnect(handler, validation);
|
|
72
|
+
break;
|
|
73
|
+
case 'beforeSubscribe':
|
|
74
|
+
Parse.Cloud.beforeSubscribe(className, handler, validation);
|
|
75
|
+
break;
|
|
76
|
+
case 'afterEvent':
|
|
77
|
+
Parse.Cloud.afterLiveQueryEvent(className, handler, validation);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
console.log(`[Triggers] Registered ${type} for: ${className}`);
|
|
81
|
+
}
|
|
82
|
+
console.log('[Triggers] All triggers registered');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.TriggerRegistry = TriggerRegistry;
|
|
86
|
+
TriggerRegistry.triggers = new Map();
|
|
87
|
+
//# sourceMappingURL=triggerRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerRegistry.js","sourceRoot":"","sources":["../../src/decorators/triggerRegistry.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IAGlB,MAAM,CAAC,MAAM,CAAC,SAAiB,EAAE,IAAiB;QACxD,OAAO,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,QAAyB;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,IAAI,CAAC,4CAA4C,QAAQ,CAAC,IAAI,gBAAgB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9G,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,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ED,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,SAAS,SAAS,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;;AA1DH,0CA2DC;AA1DgB,wBAAQ,GAAiC,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
2
|
+
export interface SwaggerDocConfig {
|
|
3
|
+
summary?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
tags?: string[];
|
|
6
|
+
deprecated?: boolean;
|
|
7
|
+
responses?: Record<string, {
|
|
8
|
+
description: string;
|
|
9
|
+
schema?: any;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export interface RouteConfig {
|
|
13
|
+
methods: HttpMethod[];
|
|
14
|
+
requiresAuth?: boolean;
|
|
15
|
+
rateLimit?: {
|
|
16
|
+
windowMs: number;
|
|
17
|
+
max: number;
|
|
18
|
+
};
|
|
19
|
+
validation?: Parse.Cloud.Validator;
|
|
20
|
+
description?: string;
|
|
21
|
+
requireRoles?: string[];
|
|
22
|
+
requireAllRoles?: boolean;
|
|
23
|
+
customErrorMessage?: string;
|
|
24
|
+
swagger?: SwaggerDocConfig;
|
|
25
|
+
}
|
|
26
|
+
export interface CloudFunctionMetadata {
|
|
27
|
+
name: string;
|
|
28
|
+
config: RouteConfig;
|
|
29
|
+
handler: (request: Parse.Cloud.FunctionRequest) => Promise<any> | any;
|
|
30
|
+
routePrefix?: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=cloudTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudTypes.d.ts","sourceRoot":"","sources":["../../../src/decorators/types/cloudTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,eAAe,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudTypes.js","sourceRoot":"","sources":["../../../src/decorators/types/cloudTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AuthRole {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface MultiLangs {
|
|
6
|
+
ar?: string;
|
|
7
|
+
en?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Filter {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string | number | string[];
|
|
12
|
+
type: 'string' | 'min' | 'max' | 'array' | 'text' | 'dropdown';
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/decorators/types/common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;CAChE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/decorators/types/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface CronJobMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
schedule: string;
|
|
4
|
+
handler: () => Promise<void> | void;
|
|
5
|
+
description?: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
timezone?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CronConfig {
|
|
10
|
+
schedule: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
timezone?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const CronSchedule: {
|
|
16
|
+
readonly EVERY_MINUTE: "* * * * *";
|
|
17
|
+
readonly EVERY_5_MINUTES: "*/5 * * * *";
|
|
18
|
+
readonly EVERY_10_MINUTES: "*/10 * * * *";
|
|
19
|
+
readonly EVERY_15_MINUTES: "*/15 * * * *";
|
|
20
|
+
readonly EVERY_30_MINUTES: "*/30 * * * *";
|
|
21
|
+
readonly EVERY_HOUR: "0 * * * *";
|
|
22
|
+
readonly EVERY_2_HOURS: "0 */2 * * *";
|
|
23
|
+
readonly EVERY_6_HOURS: "0 */6 * * *";
|
|
24
|
+
readonly EVERY_12_HOURS: "0 */12 * * *";
|
|
25
|
+
readonly DAILY_MIDNIGHT: "0 0 * * *";
|
|
26
|
+
readonly DAILY_NOON: "0 12 * * *";
|
|
27
|
+
readonly WEEKLY_SUNDAY: "0 0 * * 0";
|
|
28
|
+
readonly WEEKLY_MONDAY: "0 0 * * 1";
|
|
29
|
+
readonly MONTHLY_FIRST: "0 0 1 * *";
|
|
30
|
+
readonly YEARLY: "0 0 1 1 *";
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=cronTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronTypes.d.ts","sourceRoot":"","sources":["../../../src/decorators/types/cronTypes.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CAgBf,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronSchedule = void 0;
|
|
4
|
+
exports.CronSchedule = {
|
|
5
|
+
EVERY_MINUTE: '* * * * *',
|
|
6
|
+
EVERY_5_MINUTES: '*/5 * * * *',
|
|
7
|
+
EVERY_10_MINUTES: '*/10 * * * *',
|
|
8
|
+
EVERY_15_MINUTES: '*/15 * * * *',
|
|
9
|
+
EVERY_30_MINUTES: '*/30 * * * *',
|
|
10
|
+
EVERY_HOUR: '0 * * * *',
|
|
11
|
+
EVERY_2_HOURS: '0 */2 * * *',
|
|
12
|
+
EVERY_6_HOURS: '0 */6 * * *',
|
|
13
|
+
EVERY_12_HOURS: '0 */12 * * *',
|
|
14
|
+
DAILY_MIDNIGHT: '0 0 * * *',
|
|
15
|
+
DAILY_NOON: '0 12 * * *',
|
|
16
|
+
WEEKLY_SUNDAY: '0 0 * * 0',
|
|
17
|
+
WEEKLY_MONDAY: '0 0 * * 1',
|
|
18
|
+
MONTHLY_FIRST: '0 0 1 * *',
|
|
19
|
+
YEARLY: '0 0 1 1 *',
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=cronTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cronTypes.js","sourceRoot":"","sources":["../../../src/decorators/types/cronTypes.ts"],"names":[],"mappings":";;;AAgBa,QAAA,YAAY,GAAG;IAC1B,YAAY,EAAE,WAAW;IACzB,eAAe,EAAE,aAAa;IAC9B,gBAAgB,EAAE,cAAc;IAChC,gBAAgB,EAAE,cAAc;IAChC,gBAAgB,EAAE,cAAc;IAChC,UAAU,EAAE,WAAW;IACvB,aAAa,EAAE,aAAa;IAC5B,aAAa,EAAE,aAAa;IAC5B,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,WAAW;IAC3B,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,WAAW;IAC1B,aAAa,EAAE,WAAW;IAC1B,aAAa,EAAE,WAAW;IAC1B,MAAM,EAAE,WAAW;CACX,CAAC"}
|