@90soft/parse-server-kit 2.5.3 → 2.6.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.
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export type { AuthRole, MultiLangs, Filter } from './decorators/types/common';
15
15
  export { validateObject, validateOrThrow, getValidators, applyMongoValidators } from './decorators/types/fieldValidation';
16
16
  export { BaseModel } from './models/BaseModel';
17
17
  export { implementACL } from './utils/ACL';
18
+ export { syncImageAcl, cloneAcl } from './utils/imageAcl';
18
19
  export { UserRoles, roleKey, MAX_QUERY_LIMIT } from './utils/constants';
19
20
  export type { RoleString } from './utils/constants';
20
21
  export { catchError, getUserRoles, getUsersRoles, formatCount, generateRandomPassword, generateRandomInteger, generateRandomString, sleep } from './utils/helper';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjI,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC1G,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAC9E,WAAW,EAAE,UAAU,EAAE,WAAW,EACpC,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAChE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,IAAI,EAAE,YAAY,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AM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,cAAc,EACnE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGhI,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // @90soft/parse-server-kit — complete toolkit for Parse Server
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.importFiles = exports.sleep = exports.generateRandomString = exports.generateRandomInteger = exports.generateRandomPassword = exports.formatCount = exports.getUsersRoles = exports.getUserRoles = exports.catchError = exports.MAX_QUERY_LIMIT = exports.roleKey = exports.UserRoles = exports.implementACL = exports.BaseModel = exports.applyMongoValidators = exports.getValidators = exports.validateOrThrow = exports.validateObject = exports.classNames = exports.RouteRegistry = exports.Route = exports.CronRegistry = exports.CronSchedule = exports.Cron = exports.TriggerRegistry = 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 = exports.CloudFunctionRegistry = exports.onFunctionRegistered = exports.ProtectedCloudFunction = exports.CloudFunction = exports.onFieldRegistered = exports.onClassRegistered = exports.getSchemaDefinition = exports.ParseField = exports.ParseClass = void 0;
5
- exports.setupSwagger = exports.getSwaggerJson = exports.generateSwaggerSpec = exports.SwaggerRegistry = exports.getFieldIndexes = exports.getCompoundIndexes = exports.getUniqueIndexes = exports.applyUniqueIndexes = exports.applyAllIndexes = exports.createSchemaConfig = exports.checkRateLimit = exports.conditionalJsonMiddleware = exports.removeResultMiddleware = exports.restrictRoutes = exports.validateEntityRoutes = exports.validateFunctionRoutes = void 0;
4
+ exports.generateRandomString = exports.generateRandomInteger = exports.generateRandomPassword = exports.formatCount = exports.getUsersRoles = exports.getUserRoles = exports.catchError = exports.MAX_QUERY_LIMIT = exports.roleKey = exports.UserRoles = exports.cloneAcl = exports.syncImageAcl = exports.implementACL = exports.BaseModel = exports.applyMongoValidators = exports.getValidators = exports.validateOrThrow = exports.validateObject = exports.classNames = exports.RouteRegistry = exports.Route = exports.CronRegistry = exports.CronSchedule = exports.Cron = exports.TriggerRegistry = 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 = exports.CloudFunctionRegistry = exports.onFunctionRegistered = exports.ProtectedCloudFunction = exports.CloudFunction = exports.onFieldRegistered = exports.onClassRegistered = exports.getSchemaDefinition = exports.ParseField = exports.ParseClass = void 0;
5
+ exports.setupSwagger = exports.getSwaggerJson = exports.generateSwaggerSpec = exports.SwaggerRegistry = exports.getFieldIndexes = exports.getCompoundIndexes = exports.getUniqueIndexes = exports.applyUniqueIndexes = exports.applyAllIndexes = exports.createSchemaConfig = exports.checkRateLimit = exports.conditionalJsonMiddleware = exports.removeResultMiddleware = exports.restrictRoutes = exports.validateEntityRoutes = exports.validateFunctionRoutes = exports.importFiles = exports.sleep = void 0;
6
6
  // ── Decorators ──
7
7
  var parseDecorators_1 = require("./decorators/parseDecorators");
8
8
  Object.defineProperty(exports, "ParseClass", { enumerable: true, get: function () { return parseDecorators_1.ParseClass; } });
@@ -57,6 +57,9 @@ Object.defineProperty(exports, "BaseModel", { enumerable: true, get: function ()
57
57
  // ── ACL & Permissions ──
58
58
  var ACL_1 = require("./utils/ACL");
59
59
  Object.defineProperty(exports, "implementACL", { enumerable: true, get: function () { return ACL_1.implementACL; } });
60
+ var imageAcl_1 = require("./utils/imageAcl");
61
+ Object.defineProperty(exports, "syncImageAcl", { enumerable: true, get: function () { return imageAcl_1.syncImageAcl; } });
62
+ Object.defineProperty(exports, "cloneAcl", { enumerable: true, get: function () { return imageAcl_1.cloneAcl; } });
60
63
  var constants_1 = require("./utils/constants");
61
64
  Object.defineProperty(exports, "UserRoles", { enumerable: true, get: function () { return constants_1.UserRoles; } });
62
65
  Object.defineProperty(exports, "roleKey", { enumerable: true, get: function () { return constants_1.roleKey; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;;;;AAE/D,mBAAmB;AACnB,gEAAiI;AAAxH,6GAAA,UAAU,OAAA;AAAE,6GAAA,UAAU,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAG1F,8DAA0G;AAAjG,+GAAA,aAAa,OAAA;AAAE,wHAAA,sBAAsB,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AACpE,4DAAmE;AAA1D,sHAAA,qBAAqB,OAAA;AAE9B,kEAGoF;AAH3E,8GAAA,UAAU,OAAA;AAAE,6GAAA,SAAS,OAAA;AAAE,gHAAA,YAAY,O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AyB,OAAA;AACnD,oDAAwD;AAA/C,2GAAA,cAAc,OAAA;AAEvB,iBAAiB;AACjB,4CAAuD;AAA9C,4GAAA,kBAAkB,OAAA;AAE3B,8CAAgI;AAAvH,0GAAA,eAAe,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAAE,0GAAA,eAAe,OAAA;AAEnG,gBAAgB;AAChB,6DAA4D;AAAnD,kHAAA,eAAe,OAAA;AAExB,qDAA4E;AAAnE,kHAAA,mBAAmB,OAAA;AAAE,6GAAA,cAAc,OAAA;AAC5C,yCAA+C;AAAtC,qGAAA,YAAY,OAAA"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Make a parent's nested image(s) FOLLOW the parent's per-record ACL, so an
3
+ * image is visible to exactly whoever can see its parent (an active record →
4
+ * Member/public-readable image; a hidden one → hidden image).
5
+ *
6
+ * `handleImageLogic` stamps a new image with the parent CLASS's static ACL
7
+ * template, and nothing re-stamps it on later transitions — so without this,
8
+ * catalogues render blank images and hidden parents leak readable images.
9
+ *
10
+ * Call `syncImageAcl(parent, [fields])` AFTER setting the parent's per-record ACL
11
+ * and BEFORE saving the parent. It copies the parent's ACL onto each nested image
12
+ * (single Pointer or Array-of-Pointer, e.g. `images`), dirtying it so the
13
+ * parent's save cascades the change:
14
+ * - a NEW image (no id) is created with the ACL;
15
+ * - an EXISTING image gets an ACL-ONLY update (no file rewrite / re-process).
16
+ *
17
+ * The parent ACL must already carry its FINAL read grants when this is called.
18
+ * For collections whose visibility is derived from a status in a `beforeSave`
19
+ * trigger (e.g. `publicRead = status === 'active'`), pass that `publicRead` into
20
+ * `implementACL` at the call site — the trigger runs AFTER this helper.
21
+ *
22
+ * @param acl Optional ACL source override, for callers that hold the images on a
23
+ * PARTIAL save object (where `parent.getACL()` isn't the live ACL).
24
+ */
25
+ export declare function syncImageAcl(parent: Parse.Object, fields: string[], acl?: Parse.ACL): void;
26
+ /** Deep-copy a Parse.ACL (role, public `*`, and per-user grants). */
27
+ export declare function cloneAcl(acl: Parse.ACL): Parse.ACL;
28
+ //# sourceMappingURL=imageAcl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageAcl.d.ts","sourceRoot":"","sources":["../../src/utils/imageAcl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,MAAM,EAAE,EAChB,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GACd,IAAI,CAeN;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAqBlD"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.syncImageAcl = syncImageAcl;
4
+ exports.cloneAcl = cloneAcl;
5
+ /**
6
+ * Make a parent's nested image(s) FOLLOW the parent's per-record ACL, so an
7
+ * image is visible to exactly whoever can see its parent (an active record →
8
+ * Member/public-readable image; a hidden one → hidden image).
9
+ *
10
+ * `handleImageLogic` stamps a new image with the parent CLASS's static ACL
11
+ * template, and nothing re-stamps it on later transitions — so without this,
12
+ * catalogues render blank images and hidden parents leak readable images.
13
+ *
14
+ * Call `syncImageAcl(parent, [fields])` AFTER setting the parent's per-record ACL
15
+ * and BEFORE saving the parent. It copies the parent's ACL onto each nested image
16
+ * (single Pointer or Array-of-Pointer, e.g. `images`), dirtying it so the
17
+ * parent's save cascades the change:
18
+ * - a NEW image (no id) is created with the ACL;
19
+ * - an EXISTING image gets an ACL-ONLY update (no file rewrite / re-process).
20
+ *
21
+ * The parent ACL must already carry its FINAL read grants when this is called.
22
+ * For collections whose visibility is derived from a status in a `beforeSave`
23
+ * trigger (e.g. `publicRead = status === 'active'`), pass that `publicRead` into
24
+ * `implementACL` at the call site — the trigger runs AFTER this helper.
25
+ *
26
+ * @param acl Optional ACL source override, for callers that hold the images on a
27
+ * PARTIAL save object (where `parent.getACL()` isn't the live ACL).
28
+ */
29
+ function syncImageAcl(parent, fields, acl) {
30
+ const parentAcl = acl ?? parent.getACL();
31
+ if (!parentAcl)
32
+ return;
33
+ for (const field of fields) {
34
+ const value = parent.get(field);
35
+ const images = Array.isArray(value)
36
+ ? value
37
+ : value
38
+ ? [value]
39
+ : [];
40
+ for (const img of images) {
41
+ if (img)
42
+ img.setACL(cloneAcl(parentAcl));
43
+ }
44
+ }
45
+ }
46
+ /** Deep-copy a Parse.ACL (role, public `*`, and per-user grants). */
47
+ function cloneAcl(acl) {
48
+ const json = acl.toJSON();
49
+ const clone = new Parse.ACL();
50
+ for (const id of Object.keys(json)) {
51
+ const perms = json[id];
52
+ if (id === '*') {
53
+ if (perms.read)
54
+ clone.setPublicReadAccess(true);
55
+ if (perms.write)
56
+ clone.setPublicWriteAccess(true);
57
+ }
58
+ else if (id.startsWith('role:')) {
59
+ const role = id.slice(5);
60
+ if (perms.read)
61
+ clone.setRoleReadAccess(role, true);
62
+ if (perms.write)
63
+ clone.setRoleWriteAccess(role, true);
64
+ }
65
+ else {
66
+ if (perms.read)
67
+ clone.setReadAccess(id, true);
68
+ if (perms.write)
69
+ clone.setWriteAccess(id, true);
70
+ }
71
+ }
72
+ return clone;
73
+ }
74
+ //# sourceMappingURL=imageAcl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageAcl.js","sourceRoot":"","sources":["../../src/utils/imageAcl.ts"],"names":[],"mappings":";;AAwBA,oCAmBC;AAGD,4BAqBC;AAnED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,YAAY,CAC1B,MAAoB,EACpB,MAAgB,EAChB,GAAe;IAEf,MAAM,SAAS,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;IACzC,IAAI,CAAC,SAAS;QAAE,OAAO;IAEvB,KAAK,MAAM,KAA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AAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,IAAI,KAAK,CAAC,IAAI;gBAAE,KAAK,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YAC9C,IAAI,KAAK,CAAC,KAAK;gBAAE,KAAK,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@90soft/parse-server-kit",
3
- "version": "2.5.3",
3
+ "version": "2.6.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",