@90soft/parse-server-kit 2.2.0 → 2.3.0
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"routeDecorator.d.ts","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAiC1B;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,IAC5B,aAAa,QAAQ,UAuBvC;AAED;;GAEG;AACH,qBAAa,aAAa;IAExB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAqE;IAE3F,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkC;IAEzD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA0B;IAE3D,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAI1E;;;OAGG;IACH,MAAM,CAAC,UAAU;IA4BjB,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIrD,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOhD,MAAM,CAAC,WAAW,IAAI,MAAM,EAAE;CAG/B"}
|
|
@@ -15,7 +15,7 @@ const cloudRegistry_1 = require("./cloudRegistry");
|
|
|
15
15
|
* with RouteRegistry. At server init, the registry builds the route map.
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
|
-
* Convert PascalCase to kebab-case plural.
|
|
18
|
+
* Convert PascalCase to kebab-case plural for route prefix.
|
|
19
19
|
* 'Student' → 'students'
|
|
20
20
|
* 'MenuItem' → 'menu-items'
|
|
21
21
|
* 'MeetingMinute' → 'meeting-minutes'
|
|
@@ -32,64 +32,6 @@ function toKebabPlural(name) {
|
|
|
32
32
|
}
|
|
33
33
|
return kebab + 's';
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Convert PascalCase to kebab-case (no pluralization).
|
|
37
|
-
* 'TaskStatus' → 'task-status'
|
|
38
|
-
* 'UnreadCount' → 'unread-count'
|
|
39
|
-
*/
|
|
40
|
-
function toKebab(name) {
|
|
41
|
-
return name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extract action from function name by stripping the class name.
|
|
45
|
-
*
|
|
46
|
-
* Exact match (className or plural):
|
|
47
|
-
* createStudent → 'create'
|
|
48
|
-
* listStudents → 'list'
|
|
49
|
-
*
|
|
50
|
-
* Extended match (extra suffix after class name):
|
|
51
|
-
* updateTaskStatus → strip 'Task' → 'update-status'
|
|
52
|
-
* getUnreadCount → no class name found → 'get-unread-count'
|
|
53
|
-
*/
|
|
54
|
-
function extractAction(functionName, jsClassName) {
|
|
55
|
-
const singular = jsClassName;
|
|
56
|
-
const plural = toKebabPlural(singular).replace(/-/g, '');
|
|
57
|
-
const fnLower = functionName.toLowerCase();
|
|
58
|
-
const singularLower = singular.toLowerCase();
|
|
59
|
-
const pluralLower = plural.toLowerCase();
|
|
60
|
-
// Try to find where the class name appears in the function name
|
|
61
|
-
let classEnd = -1;
|
|
62
|
-
let matchLen = 0;
|
|
63
|
-
// Check plural first (listStudents → 'list')
|
|
64
|
-
const pluralIdx = fnLower.indexOf(pluralLower);
|
|
65
|
-
if (pluralIdx > 0) {
|
|
66
|
-
classEnd = pluralIdx + pluralLower.length;
|
|
67
|
-
matchLen = pluralLower.length;
|
|
68
|
-
}
|
|
69
|
-
// Check singular (createStudent → 'create')
|
|
70
|
-
if (classEnd === -1) {
|
|
71
|
-
const singularIdx = fnLower.indexOf(singularLower);
|
|
72
|
-
if (singularIdx > 0) {
|
|
73
|
-
classEnd = singularIdx + singularLower.length;
|
|
74
|
-
matchLen = singularLower.length;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (classEnd === -1) {
|
|
78
|
-
// Class name not found — kebab the entire function name
|
|
79
|
-
return toKebab(functionName);
|
|
80
|
-
}
|
|
81
|
-
// Extract prefix (before class name)
|
|
82
|
-
const prefixEnd = classEnd - matchLen;
|
|
83
|
-
const prefix = functionName.slice(0, prefixEnd).toLowerCase();
|
|
84
|
-
// Extract suffix (after class name)
|
|
85
|
-
const suffix = functionName.slice(classEnd);
|
|
86
|
-
if (!suffix) {
|
|
87
|
-
// Exact match: createStudent → 'create'
|
|
88
|
-
return prefix;
|
|
89
|
-
}
|
|
90
|
-
// Extended: updateTaskStatus → 'update-status'
|
|
91
|
-
return prefix + '-' + toKebab(suffix);
|
|
92
|
-
}
|
|
93
35
|
/**
|
|
94
36
|
* @Route class decorator.
|
|
95
37
|
* Accepts a Parse model class (reads JS class name) or a custom string.
|
|
@@ -142,9 +84,8 @@ class RouteRegistry {
|
|
|
142
84
|
break;
|
|
143
85
|
}
|
|
144
86
|
}
|
|
145
|
-
if (matchedPrefix
|
|
146
|
-
const
|
|
147
|
-
const routePath = `/${matchedPrefix}/${action}`;
|
|
87
|
+
if (matchedPrefix) {
|
|
88
|
+
const routePath = `/${matchedPrefix}/${fn.name}`;
|
|
148
89
|
this.routeMap.set(routePath, fn.name);
|
|
149
90
|
this.registeredPrefixes.add(`/${matchedPrefix}`);
|
|
150
91
|
fn.routePrefix = matchedPrefix;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeDecorator.js","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"routeDecorator.js","sourceRoot":"","sources":["../../src/decorators/routeDecorator.ts"],"names":[],"mappings":";;;AAqCA,sBAwBC;AA7DD,4BAA0B;AAC1B,mDAAsD;AAEtD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IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;gBACjD,EAAE,CAAC,WAAW,GAAG,aAAa,CAAC;gBAC/B,OAAO,CAAC,GAAG,CAAC,YAAY,SAAS,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,kBAAkB,CAAC,IAAY;QACpC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC3C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC7C,CAAC;;AAzDH,sCA0DC;AAzDC,wCAAwC;AACzB,qBAAO,GAA2D,IAAI,GAAG,EAAE,CAAC;AAC3F,6BAA6B;AACd,sBAAQ,GAAwB,IAAI,GAAG,EAAE,CAAC;AACzD,4BAA4B;AACb,gCAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@90soft/parse-server-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Complete decorator-driven development kit for Parse Server — models, cloud functions, triggers, cron, routing, ACL, Swagger, and more.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|