{"ast":null,"code":"\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _ParseACL = _interopRequireDefault(require(\"./ParseACL\"));\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _ParseObject = _interopRequireDefault(require(\"./ParseObject\"));\n/**\n * Represents a Role on the Parse server. Roles represent groupings of\n * Users for the purposes of granting permissions (e.g. specifying an ACL\n * for an Object). Roles are specified by their sets of child users and\n * child roles, all of which are granted any permissions that the parent\n * role has.\n *\n *

Roles must have a name (which cannot be changed after creation of the\n * role), and must specify an ACL.

\n *\n * @alias Parse.Role\n * @augments Parse.Object\n */\nclass ParseRole extends _ParseObject.default {\n /**\n * @param {string} name The name of the Role to create.\n * @param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.\n * A Parse.Role is a local representation of a role persisted to the Parse\n * cloud.\n */\n constructor(name, acl) {\n super('_Role');\n if (typeof name === 'string' && acl instanceof _ParseACL.default) {\n this.setName(name);\n this.setACL(acl);\n }\n }\n\n /**\n * Gets the name of the role. You can alternatively call role.get(\"name\")\n *\n * @returns {string} the name of the role.\n */\n getName() {\n const name = this.get('name');\n if (name == null || typeof name === 'string') {\n return name;\n }\n return '';\n }\n\n /**\n * Sets the name for a role. This value must be set before the role has\n * been saved to the server, and cannot be set once the role has been\n * saved.\n *\n *

\n * A role's name can only contain alphanumeric characters, _, -, and\n * spaces.\n *

\n *\n *

This is equivalent to calling role.set(\"name\", name)

\n *\n * @param {string} name The name of the role.\n * @param {object} options Standard options object with success and error\n * callbacks.\n * @returns {(ParseObject|boolean)} true if the set succeeded.\n */\n setName(name, options) {\n this._validateName(name);\n return this.set('name', name, options);\n }\n\n /**\n * Gets the Parse.Relation for the Parse.Users that are direct\n * children of this role. These users are granted any privileges that this\n * role has been granted (e.g. read or write access through ACLs). You can\n * add or remove users from the role through this relation.\n *\n *

This is equivalent to calling role.relation(\"users\")

\n *\n * @returns {Parse.Relation} the relation for the users belonging to this\n * role.\n */\n getUsers() {\n return this.relation('users');\n }\n\n /**\n * Gets the Parse.Relation for the Parse.Roles that are direct\n * children of this role. These roles' users are granted any privileges that\n * this role has been granted (e.g. read or write access through ACLs). You\n * can add or remove child roles from this role through this relation.\n *\n *

This is equivalent to calling role.relation(\"roles\")

\n *\n * @returns {Parse.Relation} the relation for the roles belonging to this\n * role.\n */\n getRoles() {\n return this.relation('roles');\n }\n _validateName(newName) {\n if (typeof newName !== 'string') {\n throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name must be a String.\");\n }\n if (!/^[0-9a-zA-Z\\-_ ]+$/.test(newName)) {\n throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name can be only contain alphanumeric characters, _, \" + '-, and spaces.');\n }\n }\n validate(attrs, options) {\n const isInvalid = super.validate(attrs, options);\n if (isInvalid) {\n return isInvalid;\n }\n if ('name' in attrs && attrs.name !== this.getName()) {\n const newName = attrs.name;\n if (this.id && this.id !== attrs.objectId) {\n // Check to see if the objectId being set matches this.id\n // This happens during a fetch -- the id is set before calling fetch\n // Let the name be set in this case\n return new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name can only be set before it has been saved.\");\n }\n try {\n this._validateName(newName);\n } catch (e) {\n return e;\n }\n }\n return false;\n }\n}\n_CoreManager.default.setParseRole(ParseRole);\n_ParseObject.default.registerSubclass('_Role', ParseRole);\nvar _default = exports.default = ParseRole;","map":{"version":3,"names":["_Object$defineProperty","require","_interopRequireDefault","exports","value","default","_CoreManager","_ParseACL","_ParseError","_ParseObject","ParseRole","constructor","name","acl","setName","setACL","getName","get","options","_validateName","set","getUsers","relation","getRoles","newName","OTHER_CAUSE","test","validate","attrs","isInvalid","id","objectId","e","setParseRole","registerSubclass","_default"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/parse/lib/browser/ParseRole.js"],"sourcesContent":["\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _ParseACL = _interopRequireDefault(require(\"./ParseACL\"));\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _ParseObject = _interopRequireDefault(require(\"./ParseObject\"));\n/**\n * Represents a Role on the Parse server. Roles represent groupings of\n * Users for the purposes of granting permissions (e.g. specifying an ACL\n * for an Object). Roles are specified by their sets of child users and\n * child roles, all of which are granted any permissions that the parent\n * role has.\n *\n *

Roles must have a name (which cannot be changed after creation of the\n * role), and must specify an ACL.

\n *\n * @alias Parse.Role\n * @augments Parse.Object\n */\nclass ParseRole extends _ParseObject.default {\n /**\n * @param {string} name The name of the Role to create.\n * @param {Parse.ACL} acl The ACL for this role. Roles must have an ACL.\n * A Parse.Role is a local representation of a role persisted to the Parse\n * cloud.\n */\n constructor(name, acl) {\n super('_Role');\n if (typeof name === 'string' && acl instanceof _ParseACL.default) {\n this.setName(name);\n this.setACL(acl);\n }\n }\n\n /**\n * Gets the name of the role. You can alternatively call role.get(\"name\")\n *\n * @returns {string} the name of the role.\n */\n getName() {\n const name = this.get('name');\n if (name == null || typeof name === 'string') {\n return name;\n }\n return '';\n }\n\n /**\n * Sets the name for a role. This value must be set before the role has\n * been saved to the server, and cannot be set once the role has been\n * saved.\n *\n *

\n * A role's name can only contain alphanumeric characters, _, -, and\n * spaces.\n *

\n *\n *

This is equivalent to calling role.set(\"name\", name)

\n *\n * @param {string} name The name of the role.\n * @param {object} options Standard options object with success and error\n * callbacks.\n * @returns {(ParseObject|boolean)} true if the set succeeded.\n */\n setName(name, options) {\n this._validateName(name);\n return this.set('name', name, options);\n }\n\n /**\n * Gets the Parse.Relation for the Parse.Users that are direct\n * children of this role. These users are granted any privileges that this\n * role has been granted (e.g. read or write access through ACLs). You can\n * add or remove users from the role through this relation.\n *\n *

This is equivalent to calling role.relation(\"users\")

\n *\n * @returns {Parse.Relation} the relation for the users belonging to this\n * role.\n */\n getUsers() {\n return this.relation('users');\n }\n\n /**\n * Gets the Parse.Relation for the Parse.Roles that are direct\n * children of this role. These roles' users are granted any privileges that\n * this role has been granted (e.g. read or write access through ACLs). You\n * can add or remove child roles from this role through this relation.\n *\n *

This is equivalent to calling role.relation(\"roles\")

\n *\n * @returns {Parse.Relation} the relation for the roles belonging to this\n * role.\n */\n getRoles() {\n return this.relation('roles');\n }\n _validateName(newName) {\n if (typeof newName !== 'string') {\n throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name must be a String.\");\n }\n if (!/^[0-9a-zA-Z\\-_ ]+$/.test(newName)) {\n throw new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name can be only contain alphanumeric characters, _, \" + '-, and spaces.');\n }\n }\n validate(attrs, options) {\n const isInvalid = super.validate(attrs, options);\n if (isInvalid) {\n return isInvalid;\n }\n if ('name' in attrs && attrs.name !== this.getName()) {\n const newName = attrs.name;\n if (this.id && this.id !== attrs.objectId) {\n // Check to see if the objectId being set matches this.id\n // This happens during a fetch -- the id is set before calling fetch\n // Let the name be set in this case\n return new _ParseError.default(_ParseError.default.OTHER_CAUSE, \"A role's name can only be set before it has been saved.\");\n }\n try {\n this._validateName(newName);\n } catch (e) {\n return e;\n }\n }\n return false;\n }\n}\n_CoreManager.default.setParseRole(ParseRole);\n_ParseObject.default.registerSubclass('_Role', ParseRole);\nvar _default = exports.default = ParseRole;"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,sBAAsB,GAAGC,OAAO,CAAC,8DAA8D,CAAC;AACpG,IAAIC,sBAAsB,GAAGD,OAAO,CAAC,sDAAsD,CAAC;AAC5FD,sBA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