@nymphjs/tilmeld-client 1.0.0-beta.16 → 1.0.0-beta.17

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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.17](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.16...v1.0.0-beta.17) (2023-04-24)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld-client
9
+
6
10
  # [1.0.0-beta.16](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.15...v1.0.0-beta.16) (2023-03-31)
7
11
 
8
12
  **Note:** Version bump only for package @nymphjs/tilmeld-client
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,oBACR,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,mBAAoBJ,GACF,iBAAZC,QACdA,QAAQ,2BAA6BD,EAAQG,QAAQ,oBAErDJ,EAAK,2BAA6BC,EAAQD,EAAK,oBARjD,CASGO,MAAOC,G,wCCRVC,OAAOC,eAAeR,EAAS,aAAc,CAAES,OAAO,IACtD,MAAMC,EAAW,EAAQ,KACzB,MAAMC,UAAcD,EAASE,OACzBC,YAAYC,GACRC,MAAMD,GACM,MAARA,IACAT,KAAKW,MAAMC,SAAU,EACrBZ,KAAKW,MAAME,UAAY,IAG/B,qBAAqBJ,GACjB,aAAcC,MAAMhB,QAAQe,GAEhC,mBAAmBA,GACf,OAAOC,MAAMI,YAAYL,GAE7B,wBACI,aAAaT,KAAKe,YAAY,kBAAmB,IAAI,GAEzD,oBACI,aAAaf,KAAKe,YAAY,cAAe,IAAI,GAErD,mBACI,aAAaf,KAAK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,GAC9D,OAAQA,GAAOA,EAAIV,WAAcU,EAAM,CAAE,QAAWA,IAExDhI,OAAOC,eAAeR,EAAS,aAAc,CAAES,OAAO,IACtDT,EAAQ4B,KAAO5B,EAAQW,WAAQ,EAC/BsH,EAAa,EAAQ,KAAYjI,GACjC,MAAMwI,EAAUF,EAAgB,EAAQ,MACxCtI,EAAQW,MAAQ6H,EAAQC,QACxBR,EAAa,EAAQ,IAAcjI,GACnCiI,EAAa,EAAQ,KAAWjI,GAChC,MAAM0I,EAASJ,EAAgB,EAAQ,MACvCtI,EAAQ4B,KAAO8G,EAAOD,S,QC1BtBxI,EAAOD,QAAUM,ICCbqI,EAA2B,G,OAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB1E,IAAjB2E,EACH,OAAOA,EAAa9I,QAGrB,IAAIC,EAAS0I,EAAyBE,GAAY,CAGjD7I,QAAS,IAOV,OAHA+I,EAAoBF,GAAUR,KAAKpI,EAAOD,QAASC,EAAQA,EAAOD,QAAS4I,GAGpE3I,EAAOD,QClBW4I,CAAoB,M","sources":["webpack://@nymphjs/tilmeld-client/webpack/universalModuleDefinition","webpack://@nymphjs/tilmeld-client/./lib/Group.js","webpack://@nymphjs/tilmeld-client/./lib/User.js","webpack://@nymphjs/tilmeld-client/./lib/helpers.js","webpack://@nymphjs/tilmeld-client/./lib/index.js","webpack://@nymphjs/tilmeld-client/external umd \"@nymphjs/client\"","webpack://@nymphjs/tilmeld-client/webpack/bootstrap","webpack://@nymphjs/tilmeld-client/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@nymphjs/client\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@nymphjs/client\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@nymphjs/tilmeld-client\"] = factory(require(\"@nymphjs/client\"));\n\telse\n\t\troot[\"@nymphjs/tilmeld-client\"] = factory(root[\"@nymphjs/client\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__778__) => {\nreturn ","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst client_1 = require(\"@nymphjs/client\");\nclass Group extends client_1.Entity {\n constructor(guid) {\n super(guid);\n if (guid == null) {\n this.$data.enabled = true;\n this.$data.abilities = [];\n }\n }\n static async factory(guid) {\n return (await super.factory(guid));\n }\n static factorySync(guid) {\n return super.factorySync(guid);\n }\n async $checkGroupname() {\n return await this.$serverCall('$checkGroupname', [], true);\n }\n async $checkEmail() {\n return await this.$serverCall('$checkEmail', [], true);\n }\n async $getAvatar() {\n return await this.$serverCall('$getAvatar', [], true);\n }\n async $getChildren() {\n return await this.$serverCall('$getChildren', [], true);\n }\n async $getDescendants(andSelf = false) {\n return await this.$serverCall('$getDescendants', [andSelf], true);\n }\n async $getLevel() {\n return await this.$serverCall('$getLevel', [], true);\n }\n async $isDescendant(givenGroup) {\n return await this.$serverCall('$isDescendant', [givenGroup], true);\n }\n static async getPrimaryGroups(options, selectors) {\n return await this.serverCallStatic('getPrimaryGroups', [\n { options, class: this.class },\n selectors,\n ]);\n }\n static async getSecondaryGroups(options, selectors) {\n return await this.serverCallStatic('getSecondaryGroups', [\n { options, class: this.class },\n selectors,\n ]);\n }\n}\nGroup.class = 'Group';\nexports.default = Group;\n//# sourceMappingURL=Group.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst client_1 = require(\"@nymphjs/client\");\nlet currentToken = null;\nclass User extends client_1.Entity {\n static init(nymph) {\n let store = {\n registerCallbacks: [],\n loginCallbacks: [],\n logoutCallbacks: [],\n };\n if (User.stores.has(nymph)) {\n const storeVal = User.stores.get(nymph);\n if (storeVal) {\n store = storeVal;\n }\n }\n User.stores.set(nymph, store);\n if (store.removeNymphResponseListener) {\n store.removeNymphResponseListener();\n }\n store.removeNymphResponseListener = nymph.on('response', (response) => this.handleToken(response));\n this.handleToken();\n }\n constructor(guid) {\n super(guid);\n if (guid == null) {\n this.$data.enabled = true;\n this.$data.abilities = [];\n this.$data.groups = [];\n this.$data.inheritAbilities = true;\n }\n }\n static async factory(guid) {\n return (await super.factory(guid));\n }\n static async factoryUsername(username) {\n const entity = new this();\n if (username != null) {\n const entity = await this.nymph.getEntity({\n class: this,\n }, {\n type: '&',\n ilike: ['username', username.replace(/([\\\\%_])/g, (s) => `\\\\${s}`)],\n });\n if (entity != null) {\n return entity;\n }\n }\n return entity;\n }\n static factorySync(guid) {\n return super.factorySync(guid);\n }\n async $checkUsername() {\n return await this.$serverCall('$checkUsername', [], true);\n }\n async $checkEmail() {\n return await this.$serverCall('$checkEmail', [], true);\n }\n async $checkPhone() {\n return await this.$serverCall('$checkPhone', [], true);\n }\n async $getAvatar() {\n return await this.$serverCall('$getAvatar', [], true);\n }\n async $register(data) {\n const store = User.stores.get(this.$nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.$serverCall('$register', [data]);\n if (response.result) {\n for (let i = 0; i < store.registerCallbacks.length; i++) {\n store.registerCallbacks[i] && store.registerCallbacks[i](this);\n }\n }\n if (response.loggedin) {\n this.constructor.handleToken();\n for (let i = 0; i < store.loginCallbacks.length; i++) {\n store.loginCallbacks[i] && store.loginCallbacks[i](this);\n }\n }\n return response;\n }\n async $logout() {\n const store = User.stores.get(this.$nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.$serverCall('$logout', []);\n if (response.result) {\n this.constructor.handleToken();\n for (let i = 0; i < store.logoutCallbacks.length; i++) {\n store.logoutCallbacks[i] && store.logoutCallbacks[i](this);\n }\n }\n return response;\n }\n async $gatekeeper(ability) {\n return await this.$serverCall('$gatekeeper', [ability], true);\n }\n async $changePassword(data) {\n return await this.$serverCall('$changePassword', [data]);\n }\n static async current(returnObjectIfNotExist) {\n const currentUser = await this.serverCallStatic('current', [false]);\n if (currentUser == null) {\n return returnObjectIfNotExist ? this.factorySync() : null;\n }\n return currentUser;\n }\n static async loginUser(data) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.serverCallStatic('loginUser', [data]);\n if (response.result) {\n this.handleToken();\n for (let i = 0; i < store.loginCallbacks.length; i++) {\n store.loginCallbacks[i] && store.loginCallbacks[i](response.user);\n }\n }\n return response;\n }\n static async sendRecovery(data) {\n return await this.serverCallStatic('sendRecovery', [data]);\n }\n static async recover(data) {\n return await this.serverCallStatic('recover', [data]);\n }\n static async getClientConfig() {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n if (store.clientConfig) {\n return store.clientConfig;\n }\n if (!store.clientConfigPromise) {\n store.clientConfigPromise = this.serverCallStatic('getClientConfig', []).then((config) => {\n store.clientConfig = config;\n store.clientConfigPromise = undefined;\n return config;\n });\n }\n return await store.clientConfigPromise;\n }\n static handleToken(response) {\n let token = null;\n const authCookiePattern = /(?:(?:^|.*;\\s*)TILMELDAUTH\\s*=\\s*([^;]*).*$)|^.*$/;\n if (response && response.headers.has('X-TILMELDAUTH')) {\n token = response.headers.get('X-TILMELDAUTH');\n }\n else if (typeof document !== 'undefined' &&\n document.cookie.match(authCookiePattern)) {\n token = document.cookie.replace(authCookiePattern, '$1');\n }\n else {\n return;\n }\n if (currentToken !== token) {\n if (token == null || token === '') {\n if (currentToken != null) {\n this.nymph.setXsrfToken(null);\n if (this.nymph.pubsub) {\n this.nymph.pubsub.setToken(null);\n }\n currentToken = null;\n }\n }\n else {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const json = typeof atob === 'undefined'\n ? Buffer.from(base64, 'base64').toString('binary')\n : atob(base64);\n const jwt = JSON.parse(json);\n this.nymph.setXsrfToken(jwt.xsrfToken);\n if (this.nymph.pubsub) {\n this.nymph.pubsub.setToken(token);\n }\n currentToken = token;\n }\n }\n }\n static on(event, callback) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const prop = (event + 'Callbacks');\n if (!(prop in store)) {\n throw new Error('Invalid event type.');\n }\n store[prop].push(callback);\n return () => this.off(event, callback);\n }\n static off(event, callback) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const prop = (event + 'Callbacks');\n if (!(prop in store)) {\n return false;\n }\n const i = store[prop].indexOf(callback);\n if (i > -1) {\n store[prop].splice(i, 1);\n }\n return true;\n }\n}\nUser.stores = new WeakMap();\nUser.class = 'User';\nexports.default = User;\n//# sourceMappingURL=User.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkUsername = exports.register = exports.login = void 0;\nasync function login(User, username, password, additionalData) {\n if (username === '') {\n throw new Error('You need to enter a username.');\n }\n if (password === '') {\n throw new Error('You need to enter a password');\n }\n try {\n const { result, ...response } = await User.loginUser({\n username,\n password,\n ...(additionalData ? { additionalData } : {}),\n });\n if (!result) {\n throw new Error(response.message);\n }\n return response;\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.login = login;\nasync function register(User, userDetails, clientConfig) {\n if (userDetails.username === '') {\n throw new Error('You need to enter a username.');\n }\n if (!userDetails.usernameVerified) {\n throw new Error('The username you entered is not valid.');\n }\n if (userDetails.password !== userDetails.password2) {\n throw new Error('Your passwords do not match.');\n }\n if (userDetails.password === '') {\n throw new Error('You need to enter a password');\n }\n let user = User.factorySync();\n user.username = userDetails.username;\n const config = clientConfig || (await User.getClientConfig());\n if (config.emailUsernames) {\n user.email = userDetails.username;\n }\n else if (config.regFields.indexOf('email') !== -1) {\n user.email = userDetails.email;\n }\n if (config.regFields.indexOf('name') !== -1) {\n user.nameFirst = userDetails.nameFirst;\n user.nameLast = userDetails.nameLast;\n }\n if (config.regFields.indexOf('phone') !== -1) {\n user.phone = userDetails.phone;\n }\n try {\n const { result, ...response } = await user.$register({\n password: userDetails.password,\n ...(userDetails.additionalData\n ? { additionalData: userDetails.additionalData }\n : {}),\n });\n if (!result) {\n throw new Error(response.message);\n }\n return { ...response, user };\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.register = register;\nasync function checkUsername(User, username, clientConfig) {\n let user = User.factorySync();\n user.username = username;\n const config = clientConfig || (await User.getClientConfig());\n if (config.emailUsernames) {\n user.email = username;\n }\n try {\n const { result, ...response } = await user.$checkUsername();\n if (!result) {\n throw new Error(response.message);\n }\n return response;\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.checkUsername = checkUsername;\n//# sourceMappingURL=helpers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.User = exports.Group = void 0;\n__exportStar(require(\"./Group\"), exports);\nconst Group_1 = __importDefault(require(\"./Group\"));\nexports.Group = Group_1.default;\n__exportStar(require(\"./helpers\"), exports);\n__exportStar(require(\"./User\"), exports);\nconst User_1 = __importDefault(require(\"./User\"));\nexports.User = User_1.default;\n//# sourceMappingURL=index.js.map","module.exports = __WEBPACK_EXTERNAL_MODULE__778__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(568);\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__778__","Object","defineProperty","value","client_1","Group","Entity","constructor","guid","super","$data","enabled","abilities","factorySync","$serverCall","andSelf","givenGroup","options","selectors","serverCallStatic","class","currentToken","User","nymph","store","registerCallbacks","loginCallbacks","logoutCallbacks","stores","has","storeVal","get","set","removeNymphResponseListener","on","response","handleToken","groups","inheritAbilities","username","entity","getEntity","type","ilike","replace","s","data","$nymph","Error","result","i","length","loggedin","ability","returnObjectIfNotExist","currentUser","user","clientConfig","clientConfigPromise","then","config","undefined","token","authCookiePattern","headers","document","cookie","match","setXsrfToken","pubsub","setToken","base64","split","json","atob","Buffer","from","toString","jwt","JSON","parse","xsrfToken","event","callback","prop","push","off","indexOf","splice","WeakMap","checkUsername","register","login","async","password","additionalData","loginUser","message","e","userDetails","usernameVerified","password2","getClientConfig","emailUsernames","email","regFields","nameFirst","nameLast","phone","$register","$checkUsername","__createBinding","create","o","m","k","k2","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","__exportStar","p","prototype","hasOwnProperty","call","__importDefault","mod","Group_1","default","User_1","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZ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AAgB,EAAQ,MACvCvI,EAAQ8B,KAAO6G,EAAOD,O,UC1BtBzI,EAAOD,QAAUM,C,GCCbsI,EAA2B,CAAC,E,OAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBzE,IAAjB0E,EACH,OAAOA,EAAa/I,QAGrB,IAAIC,EAAS2I,EAAyBE,GAAY,CAGjD9I,QAAS,CAAC,GAOX,OAHAgJ,EAAoBF,GAAUR,KAAKrI,EAAOD,QAASC,EAAQA,EAAOD,QAAS6I,GAGpE5I,EAAOD,OACf,CCnB0B6I,CAAoB,I","sources":["webpack://@nymphjs/tilmeld-client/webpack/universalModuleDefinition","webpack://@nymphjs/tilmeld-client/./lib/Group.js","webpack://@nymphjs/tilmeld-client/./lib/User.js","webpack://@nymphjs/tilmeld-client/./lib/helpers.js","webpack://@nymphjs/tilmeld-client/./lib/index.js","webpack://@nymphjs/tilmeld-client/external umd \"@nymphjs/client\"","webpack://@nymphjs/tilmeld-client/webpack/bootstrap","webpack://@nymphjs/tilmeld-client/webpack/startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@nymphjs/client\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@nymphjs/client\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@nymphjs/tilmeld-client\"] = factory(require(\"@nymphjs/client\"));\n\telse\n\t\troot[\"@nymphjs/tilmeld-client\"] = factory(root[\"@nymphjs/client\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE__778__) => {\nreturn ","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst client_1 = require(\"@nymphjs/client\");\nclass Group extends client_1.Entity {\n constructor(guid) {\n super(guid);\n if (guid == null) {\n this.$data.enabled = true;\n this.$data.abilities = [];\n }\n }\n static async factory(guid) {\n return (await super.factory(guid));\n }\n static factorySync(guid) {\n return super.factorySync(guid);\n }\n async $checkGroupname() {\n return await this.$serverCall('$checkGroupname', [], true);\n }\n async $checkEmail() {\n return await this.$serverCall('$checkEmail', [], true);\n }\n async $getAvatar() {\n return await this.$serverCall('$getAvatar', [], true);\n }\n async $getChildren() {\n return await this.$serverCall('$getChildren', [], true);\n }\n async $getDescendants(andSelf = false) {\n return await this.$serverCall('$getDescendants', [andSelf], true);\n }\n async $getLevel() {\n return await this.$serverCall('$getLevel', [], true);\n }\n async $isDescendant(givenGroup) {\n return await this.$serverCall('$isDescendant', [givenGroup], true);\n }\n static async getPrimaryGroups(options, selectors) {\n return await this.serverCallStatic('getPrimaryGroups', [\n { options, class: this.class },\n selectors,\n ]);\n }\n static async getSecondaryGroups(options, selectors) {\n return await this.serverCallStatic('getSecondaryGroups', [\n { options, class: this.class },\n selectors,\n ]);\n }\n}\nGroup.class = 'Group';\nexports.default = Group;\n//# sourceMappingURL=Group.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst client_1 = require(\"@nymphjs/client\");\nlet currentToken = null;\nclass User extends client_1.Entity {\n static init(nymph) {\n let store = {\n registerCallbacks: [],\n loginCallbacks: [],\n logoutCallbacks: [],\n };\n if (User.stores.has(nymph)) {\n const storeVal = User.stores.get(nymph);\n if (storeVal) {\n store = storeVal;\n }\n }\n User.stores.set(nymph, store);\n if (store.removeNymphResponseListener) {\n store.removeNymphResponseListener();\n }\n store.removeNymphResponseListener = nymph.on('response', (response) => this.handleToken(response));\n this.handleToken();\n }\n constructor(guid) {\n super(guid);\n if (guid == null) {\n this.$data.enabled = true;\n this.$data.abilities = [];\n this.$data.groups = [];\n this.$data.inheritAbilities = true;\n }\n }\n static async factory(guid) {\n return (await super.factory(guid));\n }\n static async factoryUsername(username) {\n const entity = new this();\n if (username != null) {\n const entity = await this.nymph.getEntity({\n class: this,\n }, {\n type: '&',\n ilike: ['username', username.replace(/([\\\\%_])/g, (s) => `\\\\${s}`)],\n });\n if (entity != null) {\n return entity;\n }\n }\n return entity;\n }\n static factorySync(guid) {\n return super.factorySync(guid);\n }\n async $checkUsername() {\n return await this.$serverCall('$checkUsername', [], true);\n }\n async $checkEmail() {\n return await this.$serverCall('$checkEmail', [], true);\n }\n async $checkPhone() {\n return await this.$serverCall('$checkPhone', [], true);\n }\n async $getAvatar() {\n return await this.$serverCall('$getAvatar', [], true);\n }\n async $register(data) {\n const store = User.stores.get(this.$nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.$serverCall('$register', [data]);\n if (response.result) {\n for (let i = 0; i < store.registerCallbacks.length; i++) {\n store.registerCallbacks[i] && store.registerCallbacks[i](this);\n }\n }\n if (response.loggedin) {\n this.constructor.handleToken();\n for (let i = 0; i < store.loginCallbacks.length; i++) {\n store.loginCallbacks[i] && store.loginCallbacks[i](this);\n }\n }\n return response;\n }\n async $logout() {\n const store = User.stores.get(this.$nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.$serverCall('$logout', []);\n if (response.result) {\n this.constructor.handleToken();\n for (let i = 0; i < store.logoutCallbacks.length; i++) {\n store.logoutCallbacks[i] && store.logoutCallbacks[i](this);\n }\n }\n return response;\n }\n async $gatekeeper(ability) {\n return await this.$serverCall('$gatekeeper', [ability], true);\n }\n async $changePassword(data) {\n return await this.$serverCall('$changePassword', [data]);\n }\n static async current(returnObjectIfNotExist) {\n const currentUser = await this.serverCallStatic('current', [false]);\n if (currentUser == null) {\n return returnObjectIfNotExist ? this.factorySync() : null;\n }\n return currentUser;\n }\n static async loginUser(data) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const response = await this.serverCallStatic('loginUser', [data]);\n if (response.result) {\n this.handleToken();\n for (let i = 0; i < store.loginCallbacks.length; i++) {\n store.loginCallbacks[i] && store.loginCallbacks[i](response.user);\n }\n }\n return response;\n }\n static async sendRecovery(data) {\n return await this.serverCallStatic('sendRecovery', [data]);\n }\n static async recover(data) {\n return await this.serverCallStatic('recover', [data]);\n }\n static async getClientConfig() {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n if (store.clientConfig) {\n return store.clientConfig;\n }\n if (!store.clientConfigPromise) {\n store.clientConfigPromise = this.serverCallStatic('getClientConfig', []).then((config) => {\n store.clientConfig = config;\n store.clientConfigPromise = undefined;\n return config;\n });\n }\n return await store.clientConfigPromise;\n }\n static handleToken(response) {\n let token = null;\n const authCookiePattern = /(?:(?:^|.*;\\s*)TILMELDAUTH\\s*=\\s*([^;]*).*$)|^.*$/;\n if (response && response.headers.has('X-TILMELDAUTH')) {\n token = response.headers.get('X-TILMELDAUTH');\n }\n else if (typeof document !== 'undefined' &&\n document.cookie.match(authCookiePattern)) {\n token = document.cookie.replace(authCookiePattern, '$1');\n }\n else {\n return;\n }\n if (currentToken !== token) {\n if (token == null || token === '') {\n if (currentToken != null) {\n this.nymph.setXsrfToken(null);\n if (this.nymph.pubsub) {\n this.nymph.pubsub.setToken(null);\n }\n currentToken = null;\n }\n }\n else {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');\n const json = typeof atob === 'undefined'\n ? Buffer.from(base64, 'base64').toString('binary')\n : atob(base64);\n const jwt = JSON.parse(json);\n this.nymph.setXsrfToken(jwt.xsrfToken);\n if (this.nymph.pubsub) {\n this.nymph.pubsub.setToken(token);\n }\n currentToken = token;\n }\n }\n }\n static on(event, callback) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const prop = (event + 'Callbacks');\n if (!(prop in store)) {\n throw new Error('Invalid event type.');\n }\n store[prop].push(callback);\n return () => this.off(event, callback);\n }\n static off(event, callback) {\n const store = User.stores.get(this.nymph);\n if (store == null) {\n throw new Error('This user class was never initialized with an instance of Nymph');\n }\n const prop = (event + 'Callbacks');\n if (!(prop in store)) {\n return false;\n }\n const i = store[prop].indexOf(callback);\n if (i > -1) {\n store[prop].splice(i, 1);\n }\n return true;\n }\n}\nUser.stores = new WeakMap();\nUser.class = 'User';\nexports.default = User;\n//# sourceMappingURL=User.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkUsername = exports.register = exports.login = void 0;\nasync function login(User, username, password, additionalData) {\n if (username === '') {\n throw new Error('You need to enter a username.');\n }\n if (password === '') {\n throw new Error('You need to enter a password');\n }\n try {\n const { result, ...response } = await User.loginUser({\n username,\n password,\n ...(additionalData ? { additionalData } : {}),\n });\n if (!result) {\n throw new Error(response.message);\n }\n return response;\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.login = login;\nasync function register(User, userDetails, clientConfig) {\n if (userDetails.username === '') {\n throw new Error('You need to enter a username.');\n }\n if (!userDetails.usernameVerified) {\n throw new Error('The username you entered is not valid.');\n }\n if (userDetails.password !== userDetails.password2) {\n throw new Error('Your passwords do not match.');\n }\n if (userDetails.password === '') {\n throw new Error('You need to enter a password');\n }\n let user = User.factorySync();\n user.username = userDetails.username;\n const config = clientConfig || (await User.getClientConfig());\n if (config.emailUsernames) {\n user.email = userDetails.username;\n }\n else if (config.regFields.indexOf('email') !== -1) {\n user.email = userDetails.email;\n }\n if (config.regFields.indexOf('name') !== -1) {\n user.nameFirst = userDetails.nameFirst;\n user.nameLast = userDetails.nameLast;\n }\n if (config.regFields.indexOf('phone') !== -1) {\n user.phone = userDetails.phone;\n }\n try {\n const { result, ...response } = await user.$register({\n password: userDetails.password,\n ...(userDetails.additionalData\n ? { additionalData: userDetails.additionalData }\n : {}),\n });\n if (!result) {\n throw new Error(response.message);\n }\n return { ...response, user };\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.register = register;\nasync function checkUsername(User, username, clientConfig) {\n let user = User.factorySync();\n user.username = username;\n const config = clientConfig || (await User.getClientConfig());\n if (config.emailUsernames) {\n user.email = username;\n }\n try {\n const { result, ...response } = await user.$checkUsername();\n if (!result) {\n throw new Error(response.message);\n }\n return response;\n }\n catch (e) {\n throw new Error(e?.message ?? 'An error occurred.');\n }\n}\nexports.checkUsername = checkUsername;\n//# sourceMappingURL=helpers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.User = exports.Group = void 0;\n__exportStar(require(\"./Group\"), exports);\nconst Group_1 = __importDefault(require(\"./Group\"));\nexports.Group = Group_1.default;\n__exportStar(require(\"./helpers\"), exports);\n__exportStar(require(\"./User\"), exports);\nconst User_1 = __importDefault(require(\"./User\"));\nexports.User = User_1.default;\n//# sourceMappingURL=index.js.map","module.exports = __WEBPACK_EXTERNAL_MODULE__778__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(568);\n"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE__778__","Object","defineProperty","value","client_1","Group","Entity","constructor","guid","super","$data","enabled","abilities","static","factorySync","async","$serverCall","andSelf","givenGroup","options","selectors","serverCallStatic","class","currentToken","User","nymph","store","registerCallbacks","loginCallbacks","logoutCallbacks","stores","has","storeVal","get","set","removeNymphResponseListener","on","response","handleToken","groups","inheritAbilities","username","entity","getEntity","type","ilike","replace","s","data","$nymph","Error","result","i","length","loggedin","ability","returnObjectIfNotExist","currentUser","user","clientConfig","clientConfigPromise","then","config","undefined","token","authCookiePattern","headers","document","cookie","match","setXsrfToken","pubsub","setToken","base64","split","json","atob","Buffer","from","toString","jwt","JSON","parse","xsrfToken","event","callback","prop","push","off","indexOf","splice","WeakMap","checkUsername","register","login","password","additionalData","loginUser","message","e","userDetails","usernameVerified","password2","getClientConfig","emailUsernames","email","regFields","nameFirst","nameLast","phone","$register","$checkUsername","__createBinding","create","o","m","k","k2","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","__exportStar","p","prototype","hasOwnProperty","call","__importDefault","mod","Group_1","default","User_1","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nymphjs/tilmeld-client",
3
- "version": "1.0.0-beta.16",
3
+ "version": "1.0.0-beta.17",
4
4
  "description": "NymphJS - Tilmeld Client",
5
5
  "browser": "dist/index.js",
6
6
  "main": "lib/index.js",
@@ -37,16 +37,16 @@
37
37
  "license": "Apache-2.0",
38
38
  "devDependencies": {
39
39
  "@tsconfig/recommended": "^1.0.2",
40
- "@types/jest": "^29.5.0",
40
+ "@types/jest": "^29.5.1",
41
41
  "jest": "^29.5.0",
42
- "ts-jest": "^29.0.5",
42
+ "ts-jest": "^29.1.0",
43
43
  "ts-loader": "^9.4.2",
44
- "typescript": "^5.0.2",
45
- "webpack": "^5.77.0",
46
- "webpack-cli": "^5.0.1"
44
+ "typescript": "^5.0.4",
45
+ "webpack": "^5.80.0",
46
+ "webpack-cli": "^5.0.2"
47
47
  },
48
48
  "dependencies": {
49
- "@nymphjs/client": "^1.0.0-beta.16"
49
+ "@nymphjs/client": "^1.0.0-beta.17"
50
50
  },
51
- "gitHead": "d6843a9bfd837994ef12f0b1929f9d5e44659cbd"
51
+ "gitHead": "5cb62a425927116ac34340210235ccb50d190ff3"
52
52
  }