notu 0.3.4 → 0.3.5

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/notu.mjs CHANGED
@@ -1834,6 +1834,7 @@ class Tag extends ModelWithState {
1834
1834
  super();
1835
1835
  __publicField(this, "_id", 0);
1836
1836
  __publicField(this, "_spaceId", 0);
1837
+ __publicField(this, "_space", null);
1837
1838
  __publicField(this, "_name", "");
1838
1839
  __publicField(this, "_color", null);
1839
1840
  this._name = name, this._spaceId = spaceId;
@@ -1847,6 +1848,18 @@ class Tag extends ModelWithState {
1847
1848
  get spaceId() {
1848
1849
  return this._spaceId;
1849
1850
  }
1851
+ get space() {
1852
+ return this._space;
1853
+ }
1854
+ set space(value) {
1855
+ if (value === null) {
1856
+ this._space = null;
1857
+ return;
1858
+ }
1859
+ if (value.id !== this.spaceId)
1860
+ throw Error("Attempted to set space on Tag where spaceId doesnt match");
1861
+ this._space = value;
1862
+ }
1850
1863
  get name() {
1851
1864
  return this._name;
1852
1865
  }
@@ -1861,7 +1874,7 @@ class Tag extends ModelWithState {
1861
1874
  }
1862
1875
  duplicate() {
1863
1876
  const output = new Tag(this.name, this.spaceId);
1864
- return output.id = this.id, output.state = this.state, output;
1877
+ return output.id = this.id, output.state = this.state, output.color = this.color, output.space = this.space, output;
1865
1878
  }
1866
1879
  validate(throwError = !1) {
1867
1880
  let output = null;
package/dist/notu.umd.js CHANGED
@@ -2,4 +2,4 @@
2
2
  `).forEach(function(line){i=line.indexOf(":"),key=line.substring(0,i).trim().toLowerCase(),val=line.substring(i+1).trim(),!(!key||parsed[key]&&ignoreDuplicateOf[key])&&(key==="set-cookie"?parsed[key]?parsed[key].push(val):parsed[key]=[val]:parsed[key]=parsed[key]?parsed[key]+", "+val:val)}),parsed},$internals=Symbol("internals");function normalizeHeader(header){return header&&String(header).trim().toLowerCase()}function normalizeValue(value){return value===!1||value==null?value:utils.isArray(value)?value.map(normalizeValue):String(value)}function parseTokens(str){const tokens=Object.create(null),tokensRE=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let match;for(;match=tokensRE.exec(str);)tokens[match[1]]=match[2];return tokens}const isValidHeaderName=str=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());function matchHeaderValue(context,value,header,filter,isHeaderNameFilter){if(utils.isFunction(filter))return filter.call(this,value,header);if(isHeaderNameFilter&&(value=header),!!utils.isString(value)){if(utils.isString(filter))return value.indexOf(filter)!==-1;if(utils.isRegExp(filter))return filter.test(value)}}function formatHeader(header){return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(w,char,str)=>char.toUpperCase()+str)}function buildAccessors(obj,header){const accessorName=utils.toCamelCase(" "+header);["get","set","has"].forEach(methodName=>{Object.defineProperty(obj,methodName+accessorName,{value:function(arg1,arg2,arg3){return this[methodName].call(this,header,arg1,arg2,arg3)},configurable:!0})})}class AxiosHeaders{constructor(headers){headers&&this.set(headers)}set(header,valueOrRewrite,rewrite){const self2=this;function setHeader(_value,_header,_rewrite){const lHeader=normalizeHeader(_header);if(!lHeader)throw new Error("header name must be a non-empty string");const key=utils.findKey(self2,lHeader);(!key||self2[key]===void 0||_rewrite===!0||_rewrite===void 0&&self2[key]!==!1)&&(self2[key||_header]=normalizeValue(_value))}const setHeaders=(headers,_rewrite)=>utils.forEach(headers,(_value,_header)=>setHeader(_value,_header,_rewrite));return utils.isPlainObject(header)||header instanceof this.constructor?setHeaders(header,valueOrRewrite):utils.isString(header)&&(header=header.trim())&&!isValidHeaderName(header)?setHeaders(parseHeaders(header),valueOrRewrite):header!=null&&setHeader(valueOrRewrite,header,rewrite),this}get(header,parser){if(header=normalizeHeader(header),header){const key=utils.findKey(this,header);if(key){const value=this[key];if(!parser)return value;if(parser===!0)return parseTokens(value);if(utils.isFunction(parser))return parser.call(this,value,key);if(utils.isRegExp(parser))return parser.exec(value);throw new TypeError("parser must be boolean|regexp|function")}}}has(header,matcher){if(header=normalizeHeader(header),header){const key=utils.findKey(this,header);return!!(key&&this[key]!==void 0&&(!matcher||matchHeaderValue(this,this[key],key,matcher)))}return!1}delete(header,matcher){const self2=this;let deleted=!1;function deleteHeader(_header){if(_header=normalizeHeader(_header),_header){const key=utils.findKey(self2,_header);key&&(!matcher||matchHeaderValue(self2,self2[key],key,matcher))&&(delete self2[key],deleted=!0)}}return utils.isArray(header)?header.forEach(deleteHeader):deleteHeader(header),deleted}clear(matcher){const keys=Object.keys(this);let i=keys.length,deleted=!1;for(;i--;){const key=keys[i];(!matcher||matchHeaderValue(this,this[key],key,matcher,!0))&&(delete this[key],deleted=!0)}return deleted}normalize(format){const self2=this,headers={};return utils.forEach(this,(value,header)=>{const key=utils.findKey(headers,header);if(key){self2[key]=normalizeValue(value),delete self2[header];return}const normalized=format?formatHeader(header):String(header).trim();normalized!==header&&delete self2[header],self2[normalized]=normalizeValue(value),headers[normalized]=!0}),this}concat(...targets){return this.constructor.concat(this,...targets)}toJSON(asStrings){const obj=Object.create(null);return utils.forEach(this,(value,header)=>{value!=null&&value!==!1&&(obj[header]=asStrings&&utils.isArray(value)?value.join(", "):value)}),obj}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([header,value])=>header+": "+value).join(`
3
3
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(thing){return thing instanceof this?thing:new this(thing)}static concat(first,...targets){const computed=new this(first);return targets.forEach(target=>computed.set(target)),computed}static accessor(header){const accessors=(this[$internals]=this[$internals]={accessors:{}}).accessors,prototype2=this.prototype;function defineAccessor(_header){const lHeader=normalizeHeader(_header);accessors[lHeader]||(buildAccessors(prototype2,_header),accessors[lHeader]=!0)}return utils.isArray(header)?header.forEach(defineAccessor):defineAccessor(header),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),utils.reduceDescriptors(AxiosHeaders.prototype,({value},key)=>{let mapped=key[0].toUpperCase()+key.slice(1);return{get:()=>value,set(headerValue){this[mapped]=headerValue}}}),utils.freezeMethods(AxiosHeaders);const AxiosHeaders$1=AxiosHeaders;function transformData(fns,response){const config=this||defaults$1,context=response||config,headers=AxiosHeaders$1.from(context.headers);let data=context.data;return utils.forEach(fns,function(fn){data=fn.call(config,data,headers.normalize(),response?response.status:void 0)}),headers.normalize(),data}function isCancel(value){return!!(value&&value.__CANCEL__)}function CanceledError(message,config,request){AxiosError.call(this,message??"canceled",AxiosError.ERR_CANCELED,config,request),this.name="CanceledError"}utils.inherits(CanceledError,AxiosError,{__CANCEL__:!0});function settle(resolve,reject,response){const validateStatus=response.config.validateStatus;!response.status||!validateStatus||validateStatus(response.status)?resolve(response):reject(new AxiosError("Request failed with status code "+response.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status/100)-4],response.config,response.request,response))}const cookies=platform.isStandardBrowserEnv?function(){return{write:function(name,value,expires,path,domain,secure){const cookie=[];cookie.push(name+"="+encodeURIComponent(value)),utils.isNumber(expires)&&cookie.push("expires="+new Date(expires).toGMTString()),utils.isString(path)&&cookie.push("path="+path),utils.isString(domain)&&cookie.push("domain="+domain),secure===!0&&cookie.push("secure"),document.cookie=cookie.join("; ")},read:function(name){const match=document.cookie.match(new RegExp("(^|;\\s*)("+name+")=([^;]*)"));return match?decodeURIComponent(match[3]):null},remove:function(name){this.write(name,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function isAbsoluteURL(url){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(url)}function combineURLs(baseURL,relativeURL){return relativeURL?baseURL.replace(/\/+$/,"")+"/"+relativeURL.replace(/^\/+/,""):baseURL}function buildFullPath(baseURL,requestedURL){return baseURL&&!isAbsoluteURL(requestedURL)?combineURLs(baseURL,requestedURL):requestedURL}const isURLSameOrigin=platform.isStandardBrowserEnv?function(){const msie=/(msie|trident)/i.test(navigator.userAgent),urlParsingNode=document.createElement("a");let originURL;function resolveURL(url){let href=url;return msie&&(urlParsingNode.setAttribute("href",href),href=urlParsingNode.href),urlParsingNode.setAttribute("href",href),{href:urlParsingNode.href,protocol:urlParsingNode.protocol?urlParsingNode.protocol.replace(/:$/,""):"",host:urlParsingNode.host,search:urlParsingNode.search?urlParsingNode.search.replace(/^\?/,""):"",hash:urlParsingNode.hash?urlParsingNode.hash.replace(/^#/,""):"",hostname:urlParsingNode.hostname,port:urlParsingNode.port,pathname:urlParsingNode.pathname.charAt(0)==="/"?urlParsingNode.pathname:"/"+urlParsingNode.pathname}}return originURL=resolveURL(window.location.href),function(requestURL){const parsed=utils.isString(requestURL)?resolveURL(requestURL):requestURL;return parsed.protocol===originURL.protocol&&parsed.host===originURL.host}}():function(){return function(){return!0}}();function parseProtocol(url){const match=/^([-+\w]{1,25})(:?\/\/|:)/.exec(url);return match&&match[1]||""}function speedometer(samplesCount,min){samplesCount=samplesCount||10;const bytes=new Array(samplesCount),timestamps=new Array(samplesCount);let head=0,tail=0,firstSampleTS;return min=min!==void 0?min:1e3,function(chunkLength){const now=Date.now(),startedAt=timestamps[tail];firstSampleTS||(firstSampleTS=now),bytes[head]=chunkLength,timestamps[head]=now;let i=tail,bytesCount=0;for(;i!==head;)bytesCount+=bytes[i++],i=i%samplesCount;if(head=(head+1)%samplesCount,head===tail&&(tail=(tail+1)%samplesCount),now-firstSampleTS<min)return;const passed=startedAt&&now-startedAt;return passed?Math.round(bytesCount*1e3/passed):void 0}}function progressEventReducer(listener,isDownloadStream){let bytesNotified=0;const _speedometer=speedometer(50,250);return e=>{const loaded=e.loaded,total=e.lengthComputable?e.total:void 0,progressBytes=loaded-bytesNotified,rate=_speedometer(progressBytes),inRange=loaded<=total;bytesNotified=loaded;const data={loaded,total,progress:total?loaded/total:void 0,bytes:progressBytes,rate:rate||void 0,estimated:rate&&total&&inRange?(total-loaded)/rate:void 0,event:e};data[isDownloadStream?"download":"upload"]=!0,listener(data)}}const knownAdapters={http:httpAdapter,xhr:typeof XMLHttpRequest<"u"&&function(config){return new Promise(function(resolve,reject){let requestData=config.data;const requestHeaders=AxiosHeaders$1.from(config.headers).normalize(),responseType=config.responseType;let onCanceled;function done(){config.cancelToken&&config.cancelToken.unsubscribe(onCanceled),config.signal&&config.signal.removeEventListener("abort",onCanceled)}let contentType;utils.isFormData(requestData)&&(platform.isStandardBrowserEnv||platform.isStandardBrowserWebWorkerEnv?requestHeaders.setContentType(!1):requestHeaders.getContentType(/^\s*multipart\/form-data/)?utils.isString(contentType=requestHeaders.getContentType())&&requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/,"$1")):requestHeaders.setContentType("multipart/form-data"));let request=new XMLHttpRequest;if(config.auth){const username=config.auth.username||"",password=config.auth.password?unescape(encodeURIComponent(config.auth.password)):"";requestHeaders.set("Authorization","Basic "+btoa(username+":"+password))}const fullPath=buildFullPath(config.baseURL,config.url);request.open(config.method.toUpperCase(),buildURL(fullPath,config.params,config.paramsSerializer),!0),request.timeout=config.timeout;function onloadend(){if(!request)return;const responseHeaders=AxiosHeaders$1.from("getAllResponseHeaders"in request&&request.getAllResponseHeaders()),response={data:!responseType||responseType==="text"||responseType==="json"?request.responseText:request.response,status:request.status,statusText:request.statusText,headers:responseHeaders,config,request};settle(function(value){resolve(value),done()},function(err){reject(err),done()},response),request=null}if("onloadend"in request?request.onloadend=onloadend:request.onreadystatechange=function(){!request||request.readyState!==4||request.status===0&&!(request.responseURL&&request.responseURL.indexOf("file:")===0)||setTimeout(onloadend)},request.onabort=function(){request&&(reject(new AxiosError("Request aborted",AxiosError.ECONNABORTED,config,request)),request=null)},request.onerror=function(){reject(new AxiosError("Network Error",AxiosError.ERR_NETWORK,config,request)),request=null},request.ontimeout=function(){let timeoutErrorMessage=config.timeout?"timeout of "+config.timeout+"ms exceeded":"timeout exceeded";const transitional=config.transitional||transitionalDefaults;config.timeoutErrorMessage&&(timeoutErrorMessage=config.timeoutErrorMessage),reject(new AxiosError(timeoutErrorMessage,transitional.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,config,request)),request=null},platform.isStandardBrowserEnv){const xsrfValue=(config.withCredentials||isURLSameOrigin(fullPath))&&config.xsrfCookieName&&cookies.read(config.xsrfCookieName);xsrfValue&&requestHeaders.set(config.xsrfHeaderName,xsrfValue)}requestData===void 0&&requestHeaders.setContentType(null),"setRequestHeader"in request&&utils.forEach(requestHeaders.toJSON(),function(val,key){request.setRequestHeader(key,val)}),utils.isUndefined(config.withCredentials)||(request.withCredentials=!!config.withCredentials),responseType&&responseType!=="json"&&(request.responseType=config.responseType),typeof config.onDownloadProgress=="function"&&request.addEventListener("progress",progressEventReducer(config.onDownloadProgress,!0)),typeof config.onUploadProgress=="function"&&request.upload&&request.upload.addEventListener("progress",progressEventReducer(config.onUploadProgress)),(config.cancelToken||config.signal)&&(onCanceled=cancel=>{request&&(reject(!cancel||cancel.type?new CanceledError(null,config,request):cancel),request.abort(),request=null)},config.cancelToken&&config.cancelToken.subscribe(onCanceled),config.signal&&(config.signal.aborted?onCanceled():config.signal.addEventListener("abort",onCanceled)));const protocol=parseProtocol(fullPath);if(protocol&&platform.protocols.indexOf(protocol)===-1){reject(new AxiosError("Unsupported protocol "+protocol+":",AxiosError.ERR_BAD_REQUEST,config));return}request.send(requestData||null)})}};utils.forEach(knownAdapters,(fn,value)=>{if(fn){try{Object.defineProperty(fn,"name",{value})}catch{}Object.defineProperty(fn,"adapterName",{value})}});const renderReason=reason=>`- ${reason}`,isResolvedHandle=adapter=>utils.isFunction(adapter)||adapter===null||adapter===!1,adapters={getAdapter:adapters2=>{adapters2=utils.isArray(adapters2)?adapters2:[adapters2];const{length}=adapters2;let nameOrAdapter,adapter;const rejectedReasons={};for(let i=0;i<length;i++){nameOrAdapter=adapters2[i];let id;if(adapter=nameOrAdapter,!isResolvedHandle(nameOrAdapter)&&(adapter=knownAdapters[(id=String(nameOrAdapter)).toLowerCase()],adapter===void 0))throw new AxiosError(`Unknown adapter '${id}'`);if(adapter)break;rejectedReasons[id||"#"+i]=adapter}if(!adapter){const reasons=Object.entries(rejectedReasons).map(([id,state])=>`adapter ${id} `+(state===!1?"is not supported by the environment":"is not available in the build"));let s=length?reasons.length>1?`since :
4
4
  `+reasons.map(renderReason).join(`
5
- `):" "+renderReason(reasons[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return adapter},adapters:knownAdapters};function throwIfCancellationRequested(config){if(config.cancelToken&&config.cancelToken.throwIfRequested(),config.signal&&config.signal.aborted)throw new CanceledError(null,config)}function dispatchRequest(config){return throwIfCancellationRequested(config),config.headers=AxiosHeaders$1.from(config.headers),config.data=transformData.call(config,config.transformRequest),["post","put","patch"].indexOf(config.method)!==-1&&config.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(config.adapter||defaults$1.adapter)(config).then(function(response){return throwIfCancellationRequested(config),response.data=transformData.call(config,config.transformResponse,response),response.headers=AxiosHeaders$1.from(response.headers),response},function(reason){return isCancel(reason)||(throwIfCancellationRequested(config),reason&&reason.response&&(reason.response.data=transformData.call(config,config.transformResponse,reason.response),reason.response.headers=AxiosHeaders$1.from(reason.response.headers))),Promise.reject(reason)})}const headersToObject=thing=>thing instanceof AxiosHeaders$1?thing.toJSON():thing;function mergeConfig(config1,config2){config2=config2||{};const config={};function getMergedValue(target,source,caseless){return utils.isPlainObject(target)&&utils.isPlainObject(source)?utils.merge.call({caseless},target,source):utils.isPlainObject(source)?utils.merge({},source):utils.isArray(source)?source.slice():source}function mergeDeepProperties(a,b,caseless){if(utils.isUndefined(b)){if(!utils.isUndefined(a))return getMergedValue(void 0,a,caseless)}else return getMergedValue(a,b,caseless)}function valueFromConfig2(a,b){if(!utils.isUndefined(b))return getMergedValue(void 0,b)}function defaultToConfig2(a,b){if(utils.isUndefined(b)){if(!utils.isUndefined(a))return getMergedValue(void 0,a)}else return getMergedValue(void 0,b)}function mergeDirectKeys(a,b,prop){if(prop in config2)return getMergedValue(a,b);if(prop in config1)return getMergedValue(void 0,a)}const mergeMap={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(a,b)=>mergeDeepProperties(headersToObject(a),headersToObject(b),!0)};return utils.forEach(Object.keys(Object.assign({},config1,config2)),function(prop){const merge2=mergeMap[prop]||mergeDeepProperties,configValue=merge2(config1[prop],config2[prop],prop);utils.isUndefined(configValue)&&merge2!==mergeDirectKeys||(config[prop]=configValue)}),config}const VERSION="1.5.1",validators$1={};["object","boolean","number","function","string","symbol"].forEach((type,i)=>{validators$1[type]=function(thing){return typeof thing===type||"a"+(i<1?"n ":" ")+type}});const deprecatedWarnings={};validators$1.transitional=function(validator2,version,message){function formatMessage(opt,desc){return"[Axios v"+VERSION+"] Transitional option '"+opt+"'"+desc+(message?". "+message:"")}return(value,opt,opts)=>{if(validator2===!1)throw new AxiosError(formatMessage(opt," has been removed"+(version?" in "+version:"")),AxiosError.ERR_DEPRECATED);return version&&!deprecatedWarnings[opt]&&(deprecatedWarnings[opt]=!0,console.warn(formatMessage(opt," has been deprecated since v"+version+" and will be removed in the near future"))),validator2?validator2(value,opt,opts):!0}};function assertOptions(options,schema,allowUnknown){if(typeof options!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const keys=Object.keys(options);let i=keys.length;for(;i-- >0;){const opt=keys[i],validator2=schema[opt];if(validator2){const value=options[opt],result=value===void 0||validator2(value,opt,options);if(result!==!0)throw new AxiosError("option "+opt+" must be "+result,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(allowUnknown!==!0)throw new AxiosError("Unknown option "+opt,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(instanceConfig){this.defaults=instanceConfig,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(configOrUrl,config){typeof configOrUrl=="string"?(config=config||{},config.url=configOrUrl):config=configOrUrl||{},config=mergeConfig(this.defaults,config);const{transitional,paramsSerializer,headers}=config;transitional!==void 0&&validator.assertOptions(transitional,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),paramsSerializer!=null&&(utils.isFunction(paramsSerializer)?config.paramsSerializer={serialize:paramsSerializer}:validator.assertOptions(paramsSerializer,{encode:validators.function,serialize:validators.function},!0)),config.method=(config.method||this.defaults.method||"get").toLowerCase();let contextHeaders=headers&&utils.merge(headers.common,headers[config.method]);headers&&utils.forEach(["delete","get","head","post","put","patch","common"],method=>{delete headers[method]}),config.headers=AxiosHeaders$1.concat(contextHeaders,headers);const requestInterceptorChain=[];let synchronousRequestInterceptors=!0;this.interceptors.request.forEach(function(interceptor){typeof interceptor.runWhen=="function"&&interceptor.runWhen(config)===!1||(synchronousRequestInterceptors=synchronousRequestInterceptors&&interceptor.synchronous,requestInterceptorChain.unshift(interceptor.fulfilled,interceptor.rejected))});const responseInterceptorChain=[];this.interceptors.response.forEach(function(interceptor){responseInterceptorChain.push(interceptor.fulfilled,interceptor.rejected)});let promise,i=0,len;if(!synchronousRequestInterceptors){const chain=[dispatchRequest.bind(this),void 0];for(chain.unshift.apply(chain,requestInterceptorChain),chain.push.apply(chain,responseInterceptorChain),len=chain.length,promise=Promise.resolve(config);i<len;)promise=promise.then(chain[i++],chain[i++]);return promise}len=requestInterceptorChain.length;let newConfig=config;for(i=0;i<len;){const onFulfilled=requestInterceptorChain[i++],onRejected=requestInterceptorChain[i++];try{newConfig=onFulfilled(newConfig)}catch(error){onRejected.call(this,error);break}}try{promise=dispatchRequest.call(this,newConfig)}catch(error){return Promise.reject(error)}for(i=0,len=responseInterceptorChain.length;i<len;)promise=promise.then(responseInterceptorChain[i++],responseInterceptorChain[i++]);return promise}getUri(config){config=mergeConfig(this.defaults,config);const fullPath=buildFullPath(config.baseURL,config.url);return buildURL(fullPath,config.params,config.paramsSerializer)}}utils.forEach(["delete","get","head","options"],function(method){Axios.prototype[method]=function(url,config){return this.request(mergeConfig(config||{},{method,url,data:(config||{}).data}))}}),utils.forEach(["post","put","patch"],function(method){function generateHTTPMethod(isForm){return function(url,data,config){return this.request(mergeConfig(config||{},{method,headers:isForm?{"Content-Type":"multipart/form-data"}:{},url,data}))}}Axios.prototype[method]=generateHTTPMethod(),Axios.prototype[method+"Form"]=generateHTTPMethod(!0)});const Axios$1=Axios;class CancelToken{constructor(executor){if(typeof executor!="function")throw new TypeError("executor must be a function.");let resolvePromise;this.promise=new Promise(function(resolve){resolvePromise=resolve});const token=this;this.promise.then(cancel=>{if(!token._listeners)return;let i=token._listeners.length;for(;i-- >0;)token._listeners[i](cancel);token._listeners=null}),this.promise.then=onfulfilled=>{let _resolve;const promise=new Promise(resolve=>{token.subscribe(resolve),_resolve=resolve}).then(onfulfilled);return promise.cancel=function(){token.unsubscribe(_resolve)},promise},executor(function(message,config,request){token.reason||(token.reason=new CanceledError(message,config,request),resolvePromise(token.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(listener){if(this.reason){listener(this.reason);return}this._listeners?this._listeners.push(listener):this._listeners=[listener]}unsubscribe(listener){if(!this._listeners)return;const index=this._listeners.indexOf(listener);index!==-1&&this._listeners.splice(index,1)}static source(){let cancel;return{token:new CancelToken(function(c){cancel=c}),cancel}}}const CancelToken$1=CancelToken;function spread(callback){return function(arr){return callback.apply(null,arr)}}function isAxiosError(payload){return utils.isObject(payload)&&payload.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([key,value])=>{HttpStatusCode[value]=key});const HttpStatusCode$1=HttpStatusCode;function createInstance(defaultConfig){const context=new Axios$1(defaultConfig),instance=bind(Axios$1.prototype.request,context);return utils.extend(instance,Axios$1.prototype,context,{allOwnKeys:!0}),utils.extend(instance,context,null,{allOwnKeys:!0}),instance.create=function(instanceConfig){return createInstance(mergeConfig(defaultConfig,instanceConfig))},instance}const axios=createInstance(defaults$1);axios.Axios=Axios$1,axios.CanceledError=CanceledError,axios.CancelToken=CancelToken$1,axios.isCancel=isCancel,axios.VERSION=VERSION,axios.toFormData=toFormData,axios.AxiosError=AxiosError,axios.Cancel=axios.CanceledError,axios.all=function(promises){return Promise.all(promises)},axios.spread=spread,axios.isAxiosError=isAxiosError,axios.mergeConfig=mergeConfig,axios.AxiosHeaders=AxiosHeaders$1,axios.formToJSON=thing=>formDataToJSON(utils.isHTMLForm(thing)?new FormData(thing):thing),axios.getAdapter=adapters.getAdapter,axios.HttpStatusCode=HttpStatusCode$1,axios.default=axios;const axios$1=axios;class HttpClient{constructor(url,httpRequester=null){__publicField(this,"_url",null);__publicField(this,"_token",null);__publicField(this,"_httpRequester");if(!url)throw Error("Endpoint URL must be passed in to NotuClient constructor");this._url=url,this._httpRequester=httpRequester??axios$1}get url(){return this._url}get token(){return this._token}set token(value){this._token=value}async login(username,password){try{const result=await this._httpRequester({method:"post",url:(this.url+"/login").replace("//","/"),data:{username,password}});return this._token=result.data,{success:!0,error:null,token:result.data}}catch(ex){if(ex.response.status==401)return{success:!1,error:"Invalid username & password.",token:null};throw ex}}async getSpaces(){return(await this._httpRequester({method:"get",url:(this.url+"/spaces").replace("//","/"),headers:{Authorization:"Bearer "+this.token}})).data}async saveSpace(space){return(await this._httpRequester({method:"post",url:(this.url+"/spaces").replace("//","/"),data:space,headers:{Authorization:"Bearer "+this.token}})).data}async getNotes(query,spaceId){return(await this._httpRequester({method:"get",url:(this.url+"/notes").replace("//","/"),data:{query,spaceId},headers:{Authorization:"Bearer "+this.token}})).data}async getNoteCount(query,spaceId){return(await this._httpRequester({method:"get",url:(this.url+"/notes").replace("//","/"),data:{query,spaceId},headers:{Authorization:"Bearer "+this.token}})).data}async saveNotes(notes){return(await this._httpRequester({method:"post",url:(this.url+"/notes").replace("//","/"),data:{notes},headers:{Authorization:"Bearer "+this.token}})).data}async customJob(name,data){return(await this._httpRequester({method:"post",url:(this.url+"customjob").replace("//","/"),data:{name,data},headers:{Authorization:"Bearer "+this.token}})).data}}class NoteAttr extends ModelWithState{constructor(note,attr,value){super();__publicField(this,"_noteId",0);__publicField(this,"_note",null);__publicField(this,"_attrId",0);__publicField(this,"_attr",null);__publicField(this,"_value",null);__publicField(this,"_tagId",null);__publicField(this,"_tag",null);note!=null&&note!=null&&(typeof note=="number"?this.noteId=note:this.note=note),attr!=null&&attr!=null&&(typeof attr=="number"?this.attrId=attr:this.attr=attr),value!=null&&value!=null&&(this.value=value)}get noteId(){return this._noteId}set noteId(value){var _a;value!==this._noteId&&(this._noteId=value,value!==((_a=this.note)==null?void 0:_a.id)&&(this._note=null),this.isClean&&this.dirty())}get note(){return this._note}set note(value){this._note=value,this.noteId=(value==null?void 0:value.id)??0}get attrId(){return this._attrId}set attrId(value){var _a;value!==this._attrId&&(this._attrId=value,value!==((_a=this.attr)==null?void 0:_a.id)&&(this._attr=null),this.isClean&&this.dirty())}get attr(){return this._attr}set attr(newAttr){const oldAttr=this._attr;this._attr=newAttr,newAttr?(!oldAttr||newAttr.type!=oldAttr.type)&&(this.value=newAttr.defaultValue):this.value=null,this.attrId=(newAttr==null?void 0:newAttr.id)??0}get value(){return this._value}set value(newVal){newVal!=this._value&&(this._value=newVal,this.isClean&&this.dirty())}withValue(value){return this.value=value,this}get tagId(){return this._tagId}set tagId(value){var _a;value!==this._tagId&&(this._tagId=value,value!==((_a=this.tag)==null?void 0:_a.id)&&(this._tag=null),this.isClean&&this.dirty())}get tag(){return this._tag}set tag(value){this._tag=value,this.tagId=(value==null?void 0:value.id)??null}onTag(tag){return typeof tag=="number"?this.tagId=tag:this.tag=tag,this}duplicate(){const output=new NoteAttr;return output.noteId=this.noteId,output.note=this.note,output.attrId=this.attrId,output.attr=this.attr,output.tagId=this.tagId,output.tag=this.tag,output.value=this.value,output}validate(throwError=!1){let output=null;if(this.noteId<=0&&!this.isNew?output="NoteAttr noteId must be greater than zero":this.attrId<=0&&(output="NoteAttr attrId must be greater than zero"),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,noteId:this.noteId,attrId:this.attrId,tagId:this.tagId,value:this.value}}}class NoteTag extends ModelWithState{constructor(note,tag){super();__publicField(this,"_noteId",0);__publicField(this,"_note",null);__publicField(this,"_tagId",0);__publicField(this,"_tag",null);note!=null&&note!=null&&(typeof note=="number"?this.noteId=note:this.note=note),tag!=null&&tag!=null&&(typeof tag=="number"?this.tagId=tag:this.tag=tag)}get noteId(){return this._noteId}set noteId(value){var _a;value!==this._noteId&&(this._noteId=value,value!==((_a=this.note)==null?void 0:_a.id)&&(this._note=null),this.isClean&&this.dirty())}get note(){return this._note}set note(value){this._note=value,this.noteId=(value==null?void 0:value.id)??0}get tagId(){return this._tagId}set tagId(value){var _a;value!==this._tagId&&(this._tagId=value,value!==((_a=this.tag)==null?void 0:_a.id)&&(this._tag=null),this.isClean&&this.dirty())}get tag(){return this._tag}set tag(value){this._tag=value,this.tagId=(value==null?void 0:value.id)??0}get attrs(){return this.note.attrs.filter(x=>x.tagId==this.tagId)}addAttr(attr){if(!this.note)throw new Error("Cannot call addAttr on NoteTag where note property has not been set");const na=this.note.addAttr(attr);return na.tag=this.tag,na}duplicate(){const output=new NoteTag;return output.noteId=this.noteId,output.tagId=this.tagId,output}validate(throwError=!1){let output=null;if(this.noteId<=0&&!this.isNew?output="NoteTag noteId must be greater than zero":this.tagId<=0?output="NoteTag tagId must be greater than zero":this.noteId==this.tagId&&(output="NoteTag cannot link a note to its own tag"),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,noteId:this.noteId,tagId:this.tagId}}}class Tag extends ModelWithState{constructor(name="",spaceId=0){super();__publicField(this,"_id",0);__publicField(this,"_spaceId",0);__publicField(this,"_name","");__publicField(this,"_color",null);this._name=name,this._spaceId=spaceId}get id(){return this._id}set id(value){value!==this._id&&(this._id=value,this.isClean&&this.dirty())}get spaceId(){return this._spaceId}get name(){return this._name}set name(value){value!==this._name&&(this._name=value,this.isClean&&this.dirty())}get color(){return this._color}set color(value){value!==this._color&&(this._color=value,this.isClean&&this.dirty())}duplicate(){const output=new Tag(this.name,this.spaceId);return output.id=this.id,output.state=this.state,output}validate(throwError=!1){let output=null;if(!this.isNew&&this.id<=0?output="Tag id must be greater than zero if in non-new state.":!this.name||!/^[a-zA-Z][a-zA-Z0-9 ]*[a-zA-Z0-9]?$/.test(this.name)?output="Tag name is invalid, must only contain letters, numbers, and spaces, starting with a letter":this.color&&!/^#?[A-z0-9]{6}$/.test(this.color)&&(output="Tag color is invalid, must be a 6 character hexadecimal."),throwError&&output!=null)throw Error(output);return output==null}getColorInt(){let hex=this.color;return hex?(hex.startsWith("#")&&(hex=hex.substring(1)),parseInt(hex,16)):null}toJSON(){return{state:this.state,id:this.id,name:this.name,spaceId:this.spaceId,color:this.color}}}class Note extends ModelWithState{constructor(text){super();__publicField(this,"_id",0);__publicField(this,"_date",new Date);__publicField(this,"_text","");__publicField(this,"_archived",!1);__publicField(this,"_spaceId",0);__publicField(this,"_space",null);__publicField(this,"_ownTag",null);__publicField(this,"_tags",[]);__publicField(this,"_attrs",[]);text&&(this.text=text)}get id(){return this._id}set id(value){this._id=value,this.ownTag&&(this.ownTag.id=value)}get date(){return this._date}set date(value){value!==this._date&&(this._date=value,this.isClean&&this.dirty())}at(value){return this.date=value,this}get text(){return this._text}set text(value){value!==this._text&&(this._text=value,this.isClean&&this.dirty())}get archived(){return this._archived}set archived(value){value!==this._archived&&(this._archived=value,this.isClean&&this.dirty())}get spaceId(){return this._spaceId}set spaceId(value){var _a;value!==this._spaceId&&(this._spaceId=value,value!==((_a=this.space)==null?void 0:_a.id)&&(this._space=null),this.isClean&&this.dirty())}get space(){return this._space}set space(value){this._space=value,this.spaceId=(value==null?void 0:value.id)??0}in(space){return typeof space=="number"?this.spaceId=space:this.space=space,this}get ownTag(){return this._ownTag}setOwnTag(tag){if(typeof tag=="string")this.ownTag==null&&(this._ownTag=new Tag),this.ownTag.name=tag,this.ownTag.id=this.id;else{if(this.ownTag)throw new Error("Note has already had its tag set. If you would like to change the tag name, call setTag with just a string specifying the new tag name.");if(tag.id!=0&&tag.id!=this.id)throw new Error("Attempted to set tag to note with non-matching ID. Added tag id must either match the note id, which indicates that the tag has already been added to the note. Otherwise the tag id must be zero, indicating that the tag still needs to be added.");this._ownTag=tag}return this}removeOwnTag(){this.ownTag&&(this.ownTag.isNew?this._ownTag=null:this.ownTag.delete())}get tags(){return this._tags}addTag(tag){if(tag.isDeleted)throw Error("Cannot add a tag marked as deleted to a note");if(tag.isNew)throw Error("Cannot add a tag that hasn't yet been saved to a note");if(tag.id==this.id)throw Error("Note cannot add its own tag as a linked tag");let nt=this.tags.find(x=>x.tagId==tag.id);return nt?(nt.isDeleted&&nt.dirty(),nt):(nt=new NoteTag,nt.note=this,nt.tag=tag,this._tags.push(nt),nt)}removeTag(tag){const nt=this.tags.find(x=>x.tagId==tag.id);return nt?(nt.isNew?this._tags=this._tags.filter(x=>x!==nt):nt.delete(),this):this}get attrs(){return this._attrs}addAttr(attr){if(attr.isDeleted)throw Error("Cannot add an attribute marked as deleted to a note");if(attr.isNew)throw Error("Cannot add an attribute that hasn't yet been saved to a note");let na=this.attrs.find(x=>x.attrId==attr.id);return na?(na.isDeleted&&na.dirty(),na):(na=new NoteAttr,na.note=this,na.attr=attr,this._attrs.push(na),na)}removeAttr(attr){const na=this.attrs.find(x=>x.attrId==attr.id);return na?(na.isNew?this._attrs=this._attrs.filter(x=>x!==na):na.delete(),this):this}duplicate(){const output=new Note;return output.id=this.id,output.date=this.date,output.text=this.text,output.archived=this.archived,output.space=this.space,output.state=this.state,output}toJSON(){return{state:this.state,id:this.id,date:this.date,text:this.text,archived:this.archived,spaceId:this.spaceId,ownTag:this.ownTag,tags:this.tags,attrs:this.attrs}}validate(throwError=!1){let output=null;if(this.spaceId<=0?output="Note spaceId must be greater than zero.":!this.isNew&&this.id<=0&&(output="Note id must be greater than zero if in non-new state."),throwError&&output!=null)throw Error(output);if(this.ownTag&&!this.ownTag.validate(throwError))return!1;for(const nt of this.tags)if(!nt.validate(throwError))return!1;for(const na of this.attrs)if(!na.validate(throwError))return!1;return output==null}}class ParsedQuery{constructor(){__publicField(this,"where",null);__publicField(this,"order",null);__publicField(this,"tags",[]);__publicField(this,"attrs",[])}}class ParsedTag{constructor(){__publicField(this,"space",null);__publicField(this,"name",null);__publicField(this,"searchDepth",0);__publicField(this,"strictSearchDepth",!0);__publicField(this,"includeOwner",!1)}}class ParsedAttr{constructor(){__publicField(this,"space",null);__publicField(this,"name",null);__publicField(this,"exists",!1);__publicField(this,"tagNameFilters",null)}}function parseQuery(query){const output=splitQuery(query);return output.where=identifyTags(output.where,output),output.order=identifyTags(output.order,output),output.where=identifyAttrs(output.where,output),output.order=identifyAttrs(output.order,output),output}function splitQuery(query){query=" "+query+" ";const output=new ParsedQuery,orderByIndex=query.toUpperCase().indexOf(" ORDER BY ");return orderByIndex<0?output.where=query.trim():(output.where=query.substring(0,orderByIndex).trim(),output.order=query.substring(orderByIndex+10).trim()),output.where==""&&(output.where=null),output}function identifyTags(query,parsedQuery){const regexes=[/(#+\??~?|~)([\w\d]+\.)?([\w\d]+)/,/(#+\??~?|~)\[([\w\d\s]+\.)?([\w\d\s]+)\]/];for(const regex of regexes)for(;;){const match=regex.exec(query);if(!match)break;const hashPrefix=match[1],parsedTag=new ParsedTag;parsedTag.space=match[2]?match[2].substring(0,match[2].length-1):null,parsedTag.name=match[3],parsedTag.includeOwner=hashPrefix.includes("~"),parsedTag.searchDepth=(hashPrefix.match(/#/g)||[]).length,parsedTag.strictSearchDepth=!hashPrefix.includes("?");const fullMatch=match[0],matchStart=query.indexOf(fullMatch),matchEnd=matchStart+fullMatch.length;query=query.substring(0,matchStart)+`{tag${parsedQuery.tags.length}}`+query.substring(matchEnd),parsedQuery.tags.push(parsedTag)}return query}function identifyAttrs(query,parsedQuery){const regexes=[/@([\w\d]+\.(?!Exists\(|On\())?([\w\d]+)/,/@\[([\w\d\s]+\.)?([\w\d\s]+)\]/];for(const regex of regexes)for(;;){const match=regex.exec(query);if(!match)break;const parsedAttr=new ParsedAttr;parsedAttr.space=match[1]?match[1].substring(0,match[1].length-1):null,parsedAttr.name=match[2];const matchStart=query.indexOf(match[0]);let matchEnd=matchStart+match[0].length;if(query.substring(matchEnd,matchEnd+9)==".Exists()"&&(parsedAttr.exists=!0,matchEnd+=9),query.substring(matchEnd,matchEnd+4)==".On("){let tagFilterStart=matchEnd+4;if(matchEnd=query.indexOf(")",tagFilterStart),matchEnd<0)throw Error("Unclosed bracket detected");let tagNameFilters=query.substring(tagFilterStart,matchEnd).split("|");const dummyParsedQuery=new ParsedQuery;for(let tagNameFilter of tagNameFilters)tagNameFilter.startsWith("~")||(tagNameFilter="~"+tagNameFilter),identifyTags(tagNameFilter,dummyParsedQuery);parsedAttr.tagNameFilters=dummyParsedQuery.tags,matchEnd++}query=query.substring(0,matchStart)+`{attr${parsedQuery.attrs.length}}`+query.substring(matchEnd),parsedQuery.attrs.push(parsedAttr)}return query}class Space extends ModelWithState{constructor(name=""){super();__publicField(this,"id",0);__publicField(this,"_name","");this._name=name}get name(){return this._name}set name(value){value!==this._name&&(this._name=value,this.isClean&&this.dirty())}duplicate(){const output=new Space;return output.id=this.id,output.name=this.name,output.state=this.state,output}validate(throwError=!1){let output=null;if(!this.isNew&&this.id<=0&&(output="Space id must be greater than zero if in non-new state."),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,id:this.id,name:this.name}}}exports2.Attr=Attr,exports2.Environment=Environment,exports2.HttpClient=HttpClient,exports2.Note=Note,exports2.NoteAttr=NoteAttr,exports2.NoteTag=NoteTag,exports2.ParsedAttr=ParsedAttr,exports2.ParsedQuery=ParsedQuery,exports2.ParsedTag=ParsedTag,exports2.Space=Space,exports2.Tag=Tag,exports2.parseQuery=parseQuery,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
5
+ `):" "+renderReason(reasons[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return adapter},adapters:knownAdapters};function throwIfCancellationRequested(config){if(config.cancelToken&&config.cancelToken.throwIfRequested(),config.signal&&config.signal.aborted)throw new CanceledError(null,config)}function dispatchRequest(config){return throwIfCancellationRequested(config),config.headers=AxiosHeaders$1.from(config.headers),config.data=transformData.call(config,config.transformRequest),["post","put","patch"].indexOf(config.method)!==-1&&config.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(config.adapter||defaults$1.adapter)(config).then(function(response){return throwIfCancellationRequested(config),response.data=transformData.call(config,config.transformResponse,response),response.headers=AxiosHeaders$1.from(response.headers),response},function(reason){return isCancel(reason)||(throwIfCancellationRequested(config),reason&&reason.response&&(reason.response.data=transformData.call(config,config.transformResponse,reason.response),reason.response.headers=AxiosHeaders$1.from(reason.response.headers))),Promise.reject(reason)})}const headersToObject=thing=>thing instanceof AxiosHeaders$1?thing.toJSON():thing;function mergeConfig(config1,config2){config2=config2||{};const config={};function getMergedValue(target,source,caseless){return utils.isPlainObject(target)&&utils.isPlainObject(source)?utils.merge.call({caseless},target,source):utils.isPlainObject(source)?utils.merge({},source):utils.isArray(source)?source.slice():source}function mergeDeepProperties(a,b,caseless){if(utils.isUndefined(b)){if(!utils.isUndefined(a))return getMergedValue(void 0,a,caseless)}else return getMergedValue(a,b,caseless)}function valueFromConfig2(a,b){if(!utils.isUndefined(b))return getMergedValue(void 0,b)}function defaultToConfig2(a,b){if(utils.isUndefined(b)){if(!utils.isUndefined(a))return getMergedValue(void 0,a)}else return getMergedValue(void 0,b)}function mergeDirectKeys(a,b,prop){if(prop in config2)return getMergedValue(a,b);if(prop in config1)return getMergedValue(void 0,a)}const mergeMap={url:valueFromConfig2,method:valueFromConfig2,data:valueFromConfig2,baseURL:defaultToConfig2,transformRequest:defaultToConfig2,transformResponse:defaultToConfig2,paramsSerializer:defaultToConfig2,timeout:defaultToConfig2,timeoutMessage:defaultToConfig2,withCredentials:defaultToConfig2,adapter:defaultToConfig2,responseType:defaultToConfig2,xsrfCookieName:defaultToConfig2,xsrfHeaderName:defaultToConfig2,onUploadProgress:defaultToConfig2,onDownloadProgress:defaultToConfig2,decompress:defaultToConfig2,maxContentLength:defaultToConfig2,maxBodyLength:defaultToConfig2,beforeRedirect:defaultToConfig2,transport:defaultToConfig2,httpAgent:defaultToConfig2,httpsAgent:defaultToConfig2,cancelToken:defaultToConfig2,socketPath:defaultToConfig2,responseEncoding:defaultToConfig2,validateStatus:mergeDirectKeys,headers:(a,b)=>mergeDeepProperties(headersToObject(a),headersToObject(b),!0)};return utils.forEach(Object.keys(Object.assign({},config1,config2)),function(prop){const merge2=mergeMap[prop]||mergeDeepProperties,configValue=merge2(config1[prop],config2[prop],prop);utils.isUndefined(configValue)&&merge2!==mergeDirectKeys||(config[prop]=configValue)}),config}const VERSION="1.5.1",validators$1={};["object","boolean","number","function","string","symbol"].forEach((type,i)=>{validators$1[type]=function(thing){return typeof thing===type||"a"+(i<1?"n ":" ")+type}});const deprecatedWarnings={};validators$1.transitional=function(validator2,version,message){function formatMessage(opt,desc){return"[Axios v"+VERSION+"] Transitional option '"+opt+"'"+desc+(message?". "+message:"")}return(value,opt,opts)=>{if(validator2===!1)throw new AxiosError(formatMessage(opt," has been removed"+(version?" in "+version:"")),AxiosError.ERR_DEPRECATED);return version&&!deprecatedWarnings[opt]&&(deprecatedWarnings[opt]=!0,console.warn(formatMessage(opt," has been deprecated since v"+version+" and will be removed in the near future"))),validator2?validator2(value,opt,opts):!0}};function assertOptions(options,schema,allowUnknown){if(typeof options!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const keys=Object.keys(options);let i=keys.length;for(;i-- >0;){const opt=keys[i],validator2=schema[opt];if(validator2){const value=options[opt],result=value===void 0||validator2(value,opt,options);if(result!==!0)throw new AxiosError("option "+opt+" must be "+result,AxiosError.ERR_BAD_OPTION_VALUE);continue}if(allowUnknown!==!0)throw new AxiosError("Unknown option "+opt,AxiosError.ERR_BAD_OPTION)}}const validator={assertOptions,validators:validators$1},validators=validator.validators;class Axios{constructor(instanceConfig){this.defaults=instanceConfig,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(configOrUrl,config){typeof configOrUrl=="string"?(config=config||{},config.url=configOrUrl):config=configOrUrl||{},config=mergeConfig(this.defaults,config);const{transitional,paramsSerializer,headers}=config;transitional!==void 0&&validator.assertOptions(transitional,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),paramsSerializer!=null&&(utils.isFunction(paramsSerializer)?config.paramsSerializer={serialize:paramsSerializer}:validator.assertOptions(paramsSerializer,{encode:validators.function,serialize:validators.function},!0)),config.method=(config.method||this.defaults.method||"get").toLowerCase();let contextHeaders=headers&&utils.merge(headers.common,headers[config.method]);headers&&utils.forEach(["delete","get","head","post","put","patch","common"],method=>{delete headers[method]}),config.headers=AxiosHeaders$1.concat(contextHeaders,headers);const requestInterceptorChain=[];let synchronousRequestInterceptors=!0;this.interceptors.request.forEach(function(interceptor){typeof interceptor.runWhen=="function"&&interceptor.runWhen(config)===!1||(synchronousRequestInterceptors=synchronousRequestInterceptors&&interceptor.synchronous,requestInterceptorChain.unshift(interceptor.fulfilled,interceptor.rejected))});const responseInterceptorChain=[];this.interceptors.response.forEach(function(interceptor){responseInterceptorChain.push(interceptor.fulfilled,interceptor.rejected)});let promise,i=0,len;if(!synchronousRequestInterceptors){const chain=[dispatchRequest.bind(this),void 0];for(chain.unshift.apply(chain,requestInterceptorChain),chain.push.apply(chain,responseInterceptorChain),len=chain.length,promise=Promise.resolve(config);i<len;)promise=promise.then(chain[i++],chain[i++]);return promise}len=requestInterceptorChain.length;let newConfig=config;for(i=0;i<len;){const onFulfilled=requestInterceptorChain[i++],onRejected=requestInterceptorChain[i++];try{newConfig=onFulfilled(newConfig)}catch(error){onRejected.call(this,error);break}}try{promise=dispatchRequest.call(this,newConfig)}catch(error){return Promise.reject(error)}for(i=0,len=responseInterceptorChain.length;i<len;)promise=promise.then(responseInterceptorChain[i++],responseInterceptorChain[i++]);return promise}getUri(config){config=mergeConfig(this.defaults,config);const fullPath=buildFullPath(config.baseURL,config.url);return buildURL(fullPath,config.params,config.paramsSerializer)}}utils.forEach(["delete","get","head","options"],function(method){Axios.prototype[method]=function(url,config){return this.request(mergeConfig(config||{},{method,url,data:(config||{}).data}))}}),utils.forEach(["post","put","patch"],function(method){function generateHTTPMethod(isForm){return function(url,data,config){return this.request(mergeConfig(config||{},{method,headers:isForm?{"Content-Type":"multipart/form-data"}:{},url,data}))}}Axios.prototype[method]=generateHTTPMethod(),Axios.prototype[method+"Form"]=generateHTTPMethod(!0)});const Axios$1=Axios;class CancelToken{constructor(executor){if(typeof executor!="function")throw new TypeError("executor must be a function.");let resolvePromise;this.promise=new Promise(function(resolve){resolvePromise=resolve});const token=this;this.promise.then(cancel=>{if(!token._listeners)return;let i=token._listeners.length;for(;i-- >0;)token._listeners[i](cancel);token._listeners=null}),this.promise.then=onfulfilled=>{let _resolve;const promise=new Promise(resolve=>{token.subscribe(resolve),_resolve=resolve}).then(onfulfilled);return promise.cancel=function(){token.unsubscribe(_resolve)},promise},executor(function(message,config,request){token.reason||(token.reason=new CanceledError(message,config,request),resolvePromise(token.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(listener){if(this.reason){listener(this.reason);return}this._listeners?this._listeners.push(listener):this._listeners=[listener]}unsubscribe(listener){if(!this._listeners)return;const index=this._listeners.indexOf(listener);index!==-1&&this._listeners.splice(index,1)}static source(){let cancel;return{token:new CancelToken(function(c){cancel=c}),cancel}}}const CancelToken$1=CancelToken;function spread(callback){return function(arr){return callback.apply(null,arr)}}function isAxiosError(payload){return utils.isObject(payload)&&payload.isAxiosError===!0}const HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach(([key,value])=>{HttpStatusCode[value]=key});const HttpStatusCode$1=HttpStatusCode;function createInstance(defaultConfig){const context=new Axios$1(defaultConfig),instance=bind(Axios$1.prototype.request,context);return utils.extend(instance,Axios$1.prototype,context,{allOwnKeys:!0}),utils.extend(instance,context,null,{allOwnKeys:!0}),instance.create=function(instanceConfig){return createInstance(mergeConfig(defaultConfig,instanceConfig))},instance}const axios=createInstance(defaults$1);axios.Axios=Axios$1,axios.CanceledError=CanceledError,axios.CancelToken=CancelToken$1,axios.isCancel=isCancel,axios.VERSION=VERSION,axios.toFormData=toFormData,axios.AxiosError=AxiosError,axios.Cancel=axios.CanceledError,axios.all=function(promises){return Promise.all(promises)},axios.spread=spread,axios.isAxiosError=isAxiosError,axios.mergeConfig=mergeConfig,axios.AxiosHeaders=AxiosHeaders$1,axios.formToJSON=thing=>formDataToJSON(utils.isHTMLForm(thing)?new FormData(thing):thing),axios.getAdapter=adapters.getAdapter,axios.HttpStatusCode=HttpStatusCode$1,axios.default=axios;const axios$1=axios;class HttpClient{constructor(url,httpRequester=null){__publicField(this,"_url",null);__publicField(this,"_token",null);__publicField(this,"_httpRequester");if(!url)throw Error("Endpoint URL must be passed in to NotuClient constructor");this._url=url,this._httpRequester=httpRequester??axios$1}get url(){return this._url}get token(){return this._token}set token(value){this._token=value}async login(username,password){try{const result=await this._httpRequester({method:"post",url:(this.url+"/login").replace("//","/"),data:{username,password}});return this._token=result.data,{success:!0,error:null,token:result.data}}catch(ex){if(ex.response.status==401)return{success:!1,error:"Invalid username & password.",token:null};throw ex}}async getSpaces(){return(await this._httpRequester({method:"get",url:(this.url+"/spaces").replace("//","/"),headers:{Authorization:"Bearer "+this.token}})).data}async saveSpace(space){return(await this._httpRequester({method:"post",url:(this.url+"/spaces").replace("//","/"),data:space,headers:{Authorization:"Bearer "+this.token}})).data}async getNotes(query,spaceId){return(await this._httpRequester({method:"get",url:(this.url+"/notes").replace("//","/"),data:{query,spaceId},headers:{Authorization:"Bearer "+this.token}})).data}async getNoteCount(query,spaceId){return(await this._httpRequester({method:"get",url:(this.url+"/notes").replace("//","/"),data:{query,spaceId},headers:{Authorization:"Bearer "+this.token}})).data}async saveNotes(notes){return(await this._httpRequester({method:"post",url:(this.url+"/notes").replace("//","/"),data:{notes},headers:{Authorization:"Bearer "+this.token}})).data}async customJob(name,data){return(await this._httpRequester({method:"post",url:(this.url+"customjob").replace("//","/"),data:{name,data},headers:{Authorization:"Bearer "+this.token}})).data}}class NoteAttr extends ModelWithState{constructor(note,attr,value){super();__publicField(this,"_noteId",0);__publicField(this,"_note",null);__publicField(this,"_attrId",0);__publicField(this,"_attr",null);__publicField(this,"_value",null);__publicField(this,"_tagId",null);__publicField(this,"_tag",null);note!=null&&note!=null&&(typeof note=="number"?this.noteId=note:this.note=note),attr!=null&&attr!=null&&(typeof attr=="number"?this.attrId=attr:this.attr=attr),value!=null&&value!=null&&(this.value=value)}get noteId(){return this._noteId}set noteId(value){var _a;value!==this._noteId&&(this._noteId=value,value!==((_a=this.note)==null?void 0:_a.id)&&(this._note=null),this.isClean&&this.dirty())}get note(){return this._note}set note(value){this._note=value,this.noteId=(value==null?void 0:value.id)??0}get attrId(){return this._attrId}set attrId(value){var _a;value!==this._attrId&&(this._attrId=value,value!==((_a=this.attr)==null?void 0:_a.id)&&(this._attr=null),this.isClean&&this.dirty())}get attr(){return this._attr}set attr(newAttr){const oldAttr=this._attr;this._attr=newAttr,newAttr?(!oldAttr||newAttr.type!=oldAttr.type)&&(this.value=newAttr.defaultValue):this.value=null,this.attrId=(newAttr==null?void 0:newAttr.id)??0}get value(){return this._value}set value(newVal){newVal!=this._value&&(this._value=newVal,this.isClean&&this.dirty())}withValue(value){return this.value=value,this}get tagId(){return this._tagId}set tagId(value){var _a;value!==this._tagId&&(this._tagId=value,value!==((_a=this.tag)==null?void 0:_a.id)&&(this._tag=null),this.isClean&&this.dirty())}get tag(){return this._tag}set tag(value){this._tag=value,this.tagId=(value==null?void 0:value.id)??null}onTag(tag){return typeof tag=="number"?this.tagId=tag:this.tag=tag,this}duplicate(){const output=new NoteAttr;return output.noteId=this.noteId,output.note=this.note,output.attrId=this.attrId,output.attr=this.attr,output.tagId=this.tagId,output.tag=this.tag,output.value=this.value,output}validate(throwError=!1){let output=null;if(this.noteId<=0&&!this.isNew?output="NoteAttr noteId must be greater than zero":this.attrId<=0&&(output="NoteAttr attrId must be greater than zero"),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,noteId:this.noteId,attrId:this.attrId,tagId:this.tagId,value:this.value}}}class NoteTag extends ModelWithState{constructor(note,tag){super();__publicField(this,"_noteId",0);__publicField(this,"_note",null);__publicField(this,"_tagId",0);__publicField(this,"_tag",null);note!=null&&note!=null&&(typeof note=="number"?this.noteId=note:this.note=note),tag!=null&&tag!=null&&(typeof tag=="number"?this.tagId=tag:this.tag=tag)}get noteId(){return this._noteId}set noteId(value){var _a;value!==this._noteId&&(this._noteId=value,value!==((_a=this.note)==null?void 0:_a.id)&&(this._note=null),this.isClean&&this.dirty())}get note(){return this._note}set note(value){this._note=value,this.noteId=(value==null?void 0:value.id)??0}get tagId(){return this._tagId}set tagId(value){var _a;value!==this._tagId&&(this._tagId=value,value!==((_a=this.tag)==null?void 0:_a.id)&&(this._tag=null),this.isClean&&this.dirty())}get tag(){return this._tag}set tag(value){this._tag=value,this.tagId=(value==null?void 0:value.id)??0}get attrs(){return this.note.attrs.filter(x=>x.tagId==this.tagId)}addAttr(attr){if(!this.note)throw new Error("Cannot call addAttr on NoteTag where note property has not been set");const na=this.note.addAttr(attr);return na.tag=this.tag,na}duplicate(){const output=new NoteTag;return output.noteId=this.noteId,output.tagId=this.tagId,output}validate(throwError=!1){let output=null;if(this.noteId<=0&&!this.isNew?output="NoteTag noteId must be greater than zero":this.tagId<=0?output="NoteTag tagId must be greater than zero":this.noteId==this.tagId&&(output="NoteTag cannot link a note to its own tag"),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,noteId:this.noteId,tagId:this.tagId}}}class Tag extends ModelWithState{constructor(name="",spaceId=0){super();__publicField(this,"_id",0);__publicField(this,"_spaceId",0);__publicField(this,"_space",null);__publicField(this,"_name","");__publicField(this,"_color",null);this._name=name,this._spaceId=spaceId}get id(){return this._id}set id(value){value!==this._id&&(this._id=value,this.isClean&&this.dirty())}get spaceId(){return this._spaceId}get space(){return this._space}set space(value){if(value===null){this._space=null;return}if(value.id!==this.spaceId)throw Error("Attempted to set space on Tag where spaceId doesnt match");this._space=value}get name(){return this._name}set name(value){value!==this._name&&(this._name=value,this.isClean&&this.dirty())}get color(){return this._color}set color(value){value!==this._color&&(this._color=value,this.isClean&&this.dirty())}duplicate(){const output=new Tag(this.name,this.spaceId);return output.id=this.id,output.state=this.state,output.color=this.color,output.space=this.space,output}validate(throwError=!1){let output=null;if(!this.isNew&&this.id<=0?output="Tag id must be greater than zero if in non-new state.":!this.name||!/^[a-zA-Z][a-zA-Z0-9 ]*[a-zA-Z0-9]?$/.test(this.name)?output="Tag name is invalid, must only contain letters, numbers, and spaces, starting with a letter":this.color&&!/^#?[A-z0-9]{6}$/.test(this.color)&&(output="Tag color is invalid, must be a 6 character hexadecimal."),throwError&&output!=null)throw Error(output);return output==null}getColorInt(){let hex=this.color;return hex?(hex.startsWith("#")&&(hex=hex.substring(1)),parseInt(hex,16)):null}toJSON(){return{state:this.state,id:this.id,name:this.name,spaceId:this.spaceId,color:this.color}}}class Note extends ModelWithState{constructor(text){super();__publicField(this,"_id",0);__publicField(this,"_date",new Date);__publicField(this,"_text","");__publicField(this,"_archived",!1);__publicField(this,"_spaceId",0);__publicField(this,"_space",null);__publicField(this,"_ownTag",null);__publicField(this,"_tags",[]);__publicField(this,"_attrs",[]);text&&(this.text=text)}get id(){return this._id}set id(value){this._id=value,this.ownTag&&(this.ownTag.id=value)}get date(){return this._date}set date(value){value!==this._date&&(this._date=value,this.isClean&&this.dirty())}at(value){return this.date=value,this}get text(){return this._text}set text(value){value!==this._text&&(this._text=value,this.isClean&&this.dirty())}get archived(){return this._archived}set archived(value){value!==this._archived&&(this._archived=value,this.isClean&&this.dirty())}get spaceId(){return this._spaceId}set spaceId(value){var _a;value!==this._spaceId&&(this._spaceId=value,value!==((_a=this.space)==null?void 0:_a.id)&&(this._space=null),this.isClean&&this.dirty())}get space(){return this._space}set space(value){this._space=value,this.spaceId=(value==null?void 0:value.id)??0}in(space){return typeof space=="number"?this.spaceId=space:this.space=space,this}get ownTag(){return this._ownTag}setOwnTag(tag){if(typeof tag=="string")this.ownTag==null&&(this._ownTag=new Tag),this.ownTag.name=tag,this.ownTag.id=this.id;else{if(this.ownTag)throw new Error("Note has already had its tag set. If you would like to change the tag name, call setTag with just a string specifying the new tag name.");if(tag.id!=0&&tag.id!=this.id)throw new Error("Attempted to set tag to note with non-matching ID. Added tag id must either match the note id, which indicates that the tag has already been added to the note. Otherwise the tag id must be zero, indicating that the tag still needs to be added.");this._ownTag=tag}return this}removeOwnTag(){this.ownTag&&(this.ownTag.isNew?this._ownTag=null:this.ownTag.delete())}get tags(){return this._tags}addTag(tag){if(tag.isDeleted)throw Error("Cannot add a tag marked as deleted to a note");if(tag.isNew)throw Error("Cannot add a tag that hasn't yet been saved to a note");if(tag.id==this.id)throw Error("Note cannot add its own tag as a linked tag");let nt=this.tags.find(x=>x.tagId==tag.id);return nt?(nt.isDeleted&&nt.dirty(),nt):(nt=new NoteTag,nt.note=this,nt.tag=tag,this._tags.push(nt),nt)}removeTag(tag){const nt=this.tags.find(x=>x.tagId==tag.id);return nt?(nt.isNew?this._tags=this._tags.filter(x=>x!==nt):nt.delete(),this):this}get attrs(){return this._attrs}addAttr(attr){if(attr.isDeleted)throw Error("Cannot add an attribute marked as deleted to a note");if(attr.isNew)throw Error("Cannot add an attribute that hasn't yet been saved to a note");let na=this.attrs.find(x=>x.attrId==attr.id);return na?(na.isDeleted&&na.dirty(),na):(na=new NoteAttr,na.note=this,na.attr=attr,this._attrs.push(na),na)}removeAttr(attr){const na=this.attrs.find(x=>x.attrId==attr.id);return na?(na.isNew?this._attrs=this._attrs.filter(x=>x!==na):na.delete(),this):this}duplicate(){const output=new Note;return output.id=this.id,output.date=this.date,output.text=this.text,output.archived=this.archived,output.space=this.space,output.state=this.state,output}toJSON(){return{state:this.state,id:this.id,date:this.date,text:this.text,archived:this.archived,spaceId:this.spaceId,ownTag:this.ownTag,tags:this.tags,attrs:this.attrs}}validate(throwError=!1){let output=null;if(this.spaceId<=0?output="Note spaceId must be greater than zero.":!this.isNew&&this.id<=0&&(output="Note id must be greater than zero if in non-new state."),throwError&&output!=null)throw Error(output);if(this.ownTag&&!this.ownTag.validate(throwError))return!1;for(const nt of this.tags)if(!nt.validate(throwError))return!1;for(const na of this.attrs)if(!na.validate(throwError))return!1;return output==null}}class ParsedQuery{constructor(){__publicField(this,"where",null);__publicField(this,"order",null);__publicField(this,"tags",[]);__publicField(this,"attrs",[])}}class ParsedTag{constructor(){__publicField(this,"space",null);__publicField(this,"name",null);__publicField(this,"searchDepth",0);__publicField(this,"strictSearchDepth",!0);__publicField(this,"includeOwner",!1)}}class ParsedAttr{constructor(){__publicField(this,"space",null);__publicField(this,"name",null);__publicField(this,"exists",!1);__publicField(this,"tagNameFilters",null)}}function parseQuery(query){const output=splitQuery(query);return output.where=identifyTags(output.where,output),output.order=identifyTags(output.order,output),output.where=identifyAttrs(output.where,output),output.order=identifyAttrs(output.order,output),output}function splitQuery(query){query=" "+query+" ";const output=new ParsedQuery,orderByIndex=query.toUpperCase().indexOf(" ORDER BY ");return orderByIndex<0?output.where=query.trim():(output.where=query.substring(0,orderByIndex).trim(),output.order=query.substring(orderByIndex+10).trim()),output.where==""&&(output.where=null),output}function identifyTags(query,parsedQuery){const regexes=[/(#+\??~?|~)([\w\d]+\.)?([\w\d]+)/,/(#+\??~?|~)\[([\w\d\s]+\.)?([\w\d\s]+)\]/];for(const regex of regexes)for(;;){const match=regex.exec(query);if(!match)break;const hashPrefix=match[1],parsedTag=new ParsedTag;parsedTag.space=match[2]?match[2].substring(0,match[2].length-1):null,parsedTag.name=match[3],parsedTag.includeOwner=hashPrefix.includes("~"),parsedTag.searchDepth=(hashPrefix.match(/#/g)||[]).length,parsedTag.strictSearchDepth=!hashPrefix.includes("?");const fullMatch=match[0],matchStart=query.indexOf(fullMatch),matchEnd=matchStart+fullMatch.length;query=query.substring(0,matchStart)+`{tag${parsedQuery.tags.length}}`+query.substring(matchEnd),parsedQuery.tags.push(parsedTag)}return query}function identifyAttrs(query,parsedQuery){const regexes=[/@([\w\d]+\.(?!Exists\(|On\())?([\w\d]+)/,/@\[([\w\d\s]+\.)?([\w\d\s]+)\]/];for(const regex of regexes)for(;;){const match=regex.exec(query);if(!match)break;const parsedAttr=new ParsedAttr;parsedAttr.space=match[1]?match[1].substring(0,match[1].length-1):null,parsedAttr.name=match[2];const matchStart=query.indexOf(match[0]);let matchEnd=matchStart+match[0].length;if(query.substring(matchEnd,matchEnd+9)==".Exists()"&&(parsedAttr.exists=!0,matchEnd+=9),query.substring(matchEnd,matchEnd+4)==".On("){let tagFilterStart=matchEnd+4;if(matchEnd=query.indexOf(")",tagFilterStart),matchEnd<0)throw Error("Unclosed bracket detected");let tagNameFilters=query.substring(tagFilterStart,matchEnd).split("|");const dummyParsedQuery=new ParsedQuery;for(let tagNameFilter of tagNameFilters)tagNameFilter.startsWith("~")||(tagNameFilter="~"+tagNameFilter),identifyTags(tagNameFilter,dummyParsedQuery);parsedAttr.tagNameFilters=dummyParsedQuery.tags,matchEnd++}query=query.substring(0,matchStart)+`{attr${parsedQuery.attrs.length}}`+query.substring(matchEnd),parsedQuery.attrs.push(parsedAttr)}return query}class Space extends ModelWithState{constructor(name=""){super();__publicField(this,"id",0);__publicField(this,"_name","");this._name=name}get name(){return this._name}set name(value){value!==this._name&&(this._name=value,this.isClean&&this.dirty())}duplicate(){const output=new Space;return output.id=this.id,output.name=this.name,output.state=this.state,output}validate(throwError=!1){let output=null;if(!this.isNew&&this.id<=0&&(output="Space id must be greater than zero if in non-new state."),throwError&&output!=null)throw Error(output);return output==null}toJSON(){return{state:this.state,id:this.id,name:this.name}}}exports2.Attr=Attr,exports2.Environment=Environment,exports2.HttpClient=HttpClient,exports2.Note=Note,exports2.NoteAttr=NoteAttr,exports2.NoteTag=NoteTag,exports2.ParsedAttr=ParsedAttr,exports2.ParsedQuery=ParsedQuery,exports2.ParsedTag=ParsedTag,exports2.Space=Space,exports2.Tag=Tag,exports2.parseQuery=parseQuery,Object.defineProperty(exports2,Symbol.toStringTag,{value:"Module"})});
@@ -1,3 +1,4 @@
1
+ import { Space } from '..';
1
2
  import ModelWithState from './ModelWithState';
2
3
  export default class Tag extends ModelWithState<Tag> {
3
4
  private _id;
@@ -5,6 +6,9 @@ export default class Tag extends ModelWithState<Tag> {
5
6
  set id(value: number);
6
7
  private _spaceId;
7
8
  get spaceId(): number;
9
+ private _space;
10
+ get space(): Space;
11
+ set space(value: Space);
8
12
  private _name;
9
13
  get name(): string;
10
14
  set name(value: string);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notu",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "main": "dist/notu.mjs",
5
5
  "unpkg": "dist/notu.mjs",
6
6
  "types": "dist/types/index.d.ts",