@nexushub/client 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  // src/config.ts
2
- var DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
2
+ var DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
3
3
  var DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
4
- var LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
4
+ var LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
5
5
  var LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
6
6
  var getEnvConfig = () => {
7
7
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/config.ts
2
- var DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
2
+ var DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
3
3
  var DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
4
- var LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
4
+ var LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
5
5
  var LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
6
6
  var getEnvConfig = () => {
7
7
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
package/dist/cli.cjs CHANGED
@@ -23,12 +23,12 @@ ${t}`,mf=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),gf=Objec
23
23
  `||o==="\r"},rl=function(){m(this,Te)||(D(this,Te,setTimeout(()=>{D(this,Te,void 0),this.isSpinning&&K(this,F,Ni).call(this)},Xf)),typeof m(this,Te)?.unref=="function"&&m(this,Te).unref())},Li=function(){m(this,Te)&&(clearTimeout(m(this,Te)),D(this,Te,void 0))},Bi=function(t,o,i,a){let l=K(this,F,Fi).call(this,i," "),d=typeof o=="string"?(t?" ":"")+o:"",g=K(this,F,$i).call(this,a," ");return l+t+d+g},ji=function(t,o,i=!1){let a=typeof t=="function"?t():t;return typeof a=="string"&&a!==""?i?o+a:a+o:""},Fi=function(t=m(this,N).prefixText,o=" "){return K(this,F,ji).call(this,t,o,!1)},$i=function(t=m(this,N).suffixText,o=" "){return K(this,F,ji).call(this,t,o,!0)},to=function(t,o){let i=0;for(let a of(0,Za.stripVTControlCharacters)(t).split(`
24
24
  `))i+=Math.max(1,Math.ceil(Ai(a)/o));return i},nl=function(t){if(!t||m(this,xt).has(t)||!t.isTTY||typeof t.write!="function")return;eo.has(t)&&console.warn("[ora] Multiple concurrent spinners detected. This may cause visual corruption. Use one spinner at a time.");let o=t.write;m(this,xt).set(t,o),eo.set(t,this),t.write=(i,a,l)=>K(this,F,sl).call(this,t,o,i,a,l)},ol=function(){if(!this.isEnabled||m(this,xt).size>0)return;let t=new Set([m(this,re),Rr.default.stdout,Rr.default.stderr]);for(let o of t)K(this,F,nl).call(this,o)},il=function(){for(let[t,o]of m(this,xt))t.write=o,eo.get(t)===this&&eo.delete(t);m(this,xt).clear()},sl=function(t,o,i,a,l){if(typeof a=="function"&&(l=a,a=void 0),m(this,Tr))return o.call(t,i,a,l);this.clear();let u=K(this,F,el).call(this,i,a),d=K(this,F,tl).call(this,u),g=o.call(t,i,a,l);return d?K(this,F,Li).call(this):u.length>0&&K(this,F,rl).call(this),this.isSpinning&&!m(this,Te)&&this.render(),g};function J(n){return new ki(n)}var E=Y(require("fs-extra"),1),C=Y(require("path"),1),Yi=Y(require("dotenv"),1),Xi=Y(require("figlet"),1),Ji=Y(require("cli-table3"),1),Qi=Y(require("gradient-string"),1),Zi=Y(require("inquirer"),1);var Ul=Y(require("http"),1),Wl=Y(require("https"),1),er=Y(require("zlib"),1),ve=Y(require("stream"),1),ln=require("buffer");function Zf(n){if(!/^data:/i.test(n))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');n=n.replace(/\r?\n/g,"");let t=n.indexOf(",");if(t===-1||t<=4)throw new TypeError("malformed data: URI");let o=n.substring(5,t).split(";"),i="",a=!1,l=o[0]||"text/plain",u=l;for(let p=1;p<o.length;p++)o[p]==="base64"?a=!0:o[p]&&(u+=`;${o[p]}`,o[p].indexOf("charset=")===0&&(i=o[p].substring(8)));!o[0]&&!i.length&&(u+=";charset=US-ASCII",i="US-ASCII");let d=a?"base64":"ascii",g=unescape(n.substring(t+1)),f=Buffer.from(g,d);return f.type=l,f.typeFull=u,f.charset=i,f}var al=Zf;var Le=Y(require("stream"),1),ut=require("util"),Ce=require("buffer");Zr();oo();var ct=class extends Error{constructor(t,o){super(t),Error.captureStackTrace(this,this.constructor),this.type=o}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var ye=class extends ct{constructor(t,o,i){super(t,o),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var io=Symbol.toStringTag,qi=n=>typeof n=="object"&&typeof n.append=="function"&&typeof n.delete=="function"&&typeof n.get=="function"&&typeof n.getAll=="function"&&typeof n.has=="function"&&typeof n.set=="function"&&typeof n.sort=="function"&&n[io]==="URLSearchParams",nn=n=>n&&typeof n=="object"&&typeof n.arrayBuffer=="function"&&typeof n.type=="string"&&typeof n.stream=="function"&&typeof n.constructor=="function"&&/^(Blob|File)$/.test(n[io]),bl=n=>typeof n=="object"&&(n[io]==="AbortSignal"||n[io]==="EventTarget"),_l=(n,t)=>{let o=new URL(t).hostname,i=new URL(n).hostname;return o===i||o.endsWith(`.${i}`)},wl=(n,t)=>{let o=new URL(t).protocol,i=new URL(n).protocol;return o===i};var md=(0,ut.promisify)(Le.default.pipeline),be=Symbol("Body internals"),Xe=class{constructor(t,{size:o=0}={}){let i=null;t===null?t=null:qi(t)?t=Ce.Buffer.from(t.toString()):nn(t)||Ce.Buffer.isBuffer(t)||(ut.types.isAnyArrayBuffer(t)?t=Ce.Buffer.from(t):ArrayBuffer.isView(t)?t=Ce.Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof Le.default||(t instanceof Jt?(t=yl(t),i=t.type.split("=")[1]):t=Ce.Buffer.from(String(t))));let a=t;Ce.Buffer.isBuffer(t)?a=Le.default.Readable.from(t):nn(t)&&(a=Le.default.Readable.from(t.stream())),this[be]={body:t,stream:a,boundary:i,disturbed:!1,error:null},this.size=o,t instanceof Le.default&&t.on("error",l=>{let u=l instanceof ct?l:new ye(`Invalid response body while trying to fetch ${this.url}: ${l.message}`,"system",l);this[be].error=u})}get body(){return this[be].stream}get bodyUsed(){return this[be].disturbed}async arrayBuffer(){let{buffer:t,byteOffset:o,byteLength:i}=await Ki(this);return t.slice(o,o+i)}async formData(){let t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){let i=new Jt,a=new URLSearchParams(await this.text());for(let[l,u]of a)i.append(l,u);return i}let{toFormData:o}=await Promise.resolve().then(()=>(Cl(),Tl));return o(this.body,t)}async blob(){let t=this.headers&&this.headers.get("content-type")||this[be].body&&this[be].body.type||"",o=await this.arrayBuffer();return new lt([o],{type:t})}async json(){let t=await this.text();return JSON.parse(t)}async text(){let t=await Ki(this);return new TextDecoder().decode(t)}buffer(){return Ki(this)}};Xe.prototype.buffer=(0,ut.deprecate)(Xe.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Xe.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,ut.deprecate)(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Ki(n){if(n[be].disturbed)throw new TypeError(`body used already for: ${n.url}`);if(n[be].disturbed=!0,n[be].error)throw n[be].error;let{body:t}=n;if(t===null)return Ce.Buffer.alloc(0);if(!(t instanceof Le.default))return Ce.Buffer.alloc(0);let o=[],i=0;try{for await(let a of t){if(n.size>0&&i+a.length>n.size){let l=new ye(`content size at ${n.url} over limit: ${n.size}`,"max-size");throw t.destroy(l),l}i+=a.length,o.push(a)}}catch(a){throw a instanceof ct?a:new ye(`Invalid response body while trying to fetch ${n.url}: ${a.message}`,"system",a)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return o.every(a=>typeof a=="string")?Ce.Buffer.from(o.join("")):Ce.Buffer.concat(o,i)}catch(a){throw new ye(`Could not create Buffer from response body for ${n.url}: ${a.message}`,"system",a)}else throw new ye(`Premature close of server response while trying to fetch ${n.url}`)}var Pr=(n,t)=>{let o,i,{body:a}=n[be];if(n.bodyUsed)throw new Error("cannot clone body after it is used");return a instanceof Le.default&&typeof a.getBoundary!="function"&&(o=new Le.PassThrough({highWaterMark:t}),i=new Le.PassThrough({highWaterMark:t}),a.pipe(o),a.pipe(i),n[be].stream=o,a=i),a},gd=(0,ut.deprecate)(n=>n.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),co=(n,t)=>n===null?null:typeof n=="string"?"text/plain;charset=UTF-8":qi(n)?"application/x-www-form-urlencoded;charset=UTF-8":nn(n)?n.type||null:Ce.Buffer.isBuffer(n)||ut.types.isAnyArrayBuffer(n)||ArrayBuffer.isView(n)?null:n instanceof Jt?`multipart/form-data; boundary=${t[be].boundary}`:n&&typeof n.getBoundary=="function"?`multipart/form-data;boundary=${gd(n)}`:n instanceof Le.default?null:"text/plain;charset=UTF-8",xl=n=>{let{body:t}=n[be];return t===null?0:nn(t)?t.size:Ce.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync=="function"&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},vl=async(n,{body:t})=>{t===null?n.end():await md(t,n)};var Gi=require("util"),sn=Y(require("http"),1),uo=typeof sn.default.validateHeaderName=="function"?sn.default.validateHeaderName:n=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(n)){let t=new TypeError(`Header name must be a valid HTTP token [${n}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},Vi=typeof sn.default.validateHeaderValue=="function"?sn.default.validateHeaderValue:(n,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let o=new TypeError(`Invalid character in header content ["${n}"]`);throw Object.defineProperty(o,"code",{value:"ERR_INVALID_CHAR"}),o}},xe=class n extends URLSearchParams{constructor(t){let o=[];if(t instanceof n){let i=t.raw();for(let[a,l]of Object.entries(i))o.push(...l.map(u=>[a,u]))}else if(t!=null)if(typeof t=="object"&&!Gi.types.isBoxedPrimitive(t)){let i=t[Symbol.iterator];if(i==null)o.push(...Object.entries(t));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");o=[...t].map(a=>{if(typeof a!="object"||Gi.types.isBoxedPrimitive(a))throw new TypeError("Each header pair must be an iterable object");return[...a]}).map(a=>{if(a.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...a]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return o=o.length>0?o.map(([i,a])=>(uo(i),Vi(i,String(a)),[String(i).toLowerCase(),String(a)])):void 0,super(o),new Proxy(this,{get(i,a,l){switch(a){case"append":case"set":return(u,d)=>(uo(u),Vi(u,String(d)),URLSearchParams.prototype[a].call(i,String(u).toLowerCase(),String(d)));case"delete":case"has":case"getAll":return u=>(uo(u),URLSearchParams.prototype[a].call(i,String(u).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,a,l)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){let o=this.getAll(t);if(o.length===0)return null;let i=o.join(", ");return/^content-encoding$/i.test(t)&&(i=i.toLowerCase()),i}forEach(t,o=void 0){for(let i of this.keys())Reflect.apply(t,o,[this.get(i),i,this])}*values(){for(let t of this.keys())yield this.get(t)}*entries(){for(let t of this.keys())yield[t,this.get(t)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((t,o)=>(t[o]=this.getAll(o),t),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((t,o)=>{let i=this.getAll(o);return o==="host"?t[o]=i[0]:t[o]=i.length>1?i:i[0],t},{})}};Object.defineProperties(xe.prototype,["get","entries","forEach","values"].reduce((n,t)=>(n[t]={enumerable:!0},n),{}));function Pl(n=[]){return new xe(n.reduce((t,o,i,a)=>(i%2===0&&t.push(a.slice(i,i+2)),t),[]).filter(([t,o])=>{try{return uo(t),Vi(t,String(o)),!0}catch{return!1}}))}var yd=new Set([301,302,303,307,308]),fo=n=>yd.has(n);var qe=Symbol("Response internals"),Be=class n extends Xe{constructor(t=null,o={}){super(t,o);let i=o.status!=null?o.status:200,a=new xe(o.headers);if(t!==null&&!a.has("Content-Type")){let l=co(t,this);l&&a.append("Content-Type",l)}this[qe]={type:"default",url:o.url,status:i,statusText:o.statusText||"",headers:a,counter:o.counter,highWaterMark:o.highWaterMark}}get type(){return this[qe].type}get url(){return this[qe].url||""}get status(){return this[qe].status}get ok(){return this[qe].status>=200&&this[qe].status<300}get redirected(){return this[qe].counter>0}get statusText(){return this[qe].statusText}get headers(){return this[qe].headers}get highWaterMark(){return this[qe].highWaterMark}clone(){return new n(Pr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,o=302){if(!fo(o))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new n(null,{headers:{location:new URL(t).toString()},status:o})}static error(){let t=new n(null,{status:0,statusText:""});return t[qe].type="error",t}static json(t=void 0,o={}){let i=JSON.stringify(t);if(i===void 0)throw new TypeError("data is not JSON serializable");let a=new xe(o&&o.headers);return a.has("content-type")||a.set("content-type","application/json"),new n(i,{...o,headers:a})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(Be.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var jl=require("url"),Fl=require("util");var Al=n=>{if(n.search)return n.search;let t=n.href.length-1,o=n.hash||(n.href[t]==="#"?"#":"");return n.href[t-o.length]==="?"?"?":""};var Ol=require("net");function Il(n,t=!1){return n==null||(n=new URL(n),/^(about|blob|data):$/.test(n.protocol))?"no-referrer":(n.username="",n.password="",n.hash="",t&&(n.pathname="",n.search=""),n)}var Dl=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),kl="strict-origin-when-cross-origin";function Nl(n){if(!Dl.has(n))throw new TypeError(`Invalid referrerPolicy: ${n}`);return n}function bd(n){if(/^(http|ws)s:$/.test(n.protocol))return!0;let t=n.host.replace(/(^\[)|(]$)/g,""),o=(0,Ol.isIP)(t);return o===4&&/^127\./.test(t)||o===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:n.host==="localhost"||n.host.endsWith(".localhost")?!1:n.protocol==="file:"}function Ar(n){return/^about:(blank|srcdoc)$/.test(n)||n.protocol==="data:"||/^(blob|filesystem):$/.test(n.protocol)?!0:bd(n)}function Ll(n,{referrerURLCallback:t,referrerOriginCallback:o}={}){if(n.referrer==="no-referrer"||n.referrerPolicy==="")return null;let i=n.referrerPolicy;if(n.referrer==="about:client")return"no-referrer";let a=n.referrer,l=Il(a),u=Il(a,!0);l.toString().length>4096&&(l=u),t&&(l=t(l)),o&&(u=o(u));let d=new URL(n.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return u;case"unsafe-url":return l;case"strict-origin":return Ar(l)&&!Ar(d)?"no-referrer":u.toString();case"strict-origin-when-cross-origin":return l.origin===d.origin?l:Ar(l)&&!Ar(d)?"no-referrer":u;case"same-origin":return l.origin===d.origin?l:"no-referrer";case"origin-when-cross-origin":return l.origin===d.origin?l:u;case"no-referrer-when-downgrade":return Ar(l)&&!Ar(d)?"no-referrer":l;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function Bl(n){let t=(n.get("referrer-policy")||"").split(/[,\s]+/),o="";for(let i of t)i&&Dl.has(i)&&(o=i);return o}var ce=Symbol("Request internals"),an=n=>typeof n=="object"&&typeof n[ce]=="object",_d=(0,Fl.deprecate)(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),Zt=class n extends Xe{constructor(t,o={}){let i;if(an(t)?i=new URL(t.url):(i=new URL(t),t={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentials.`);let a=o.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(a)&&(a=a.toUpperCase()),!an(o)&&"data"in o&&_d(),(o.body!=null||an(t)&&t.body!==null)&&(a==="GET"||a==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let l=o.body?o.body:an(t)&&t.body!==null?Pr(t):null;super(l,{size:o.size||t.size||0});let u=new xe(o.headers||t.headers||{});if(l!==null&&!u.has("Content-Type")){let f=co(l,this);f&&u.set("Content-Type",f)}let d=an(t)?t.signal:null;if("signal"in o&&(d=o.signal),d!=null&&!bl(d))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let g=o.referrer==null?t.referrer:o.referrer;if(g==="")g="no-referrer";else if(g){let f=new URL(g);g=/^about:(\/\/)?client$/.test(f)?"client":f}else g=void 0;this[ce]={method:a,redirect:o.redirect||t.redirect||"follow",headers:u,parsedURL:i,signal:d,referrer:g},this.follow=o.follow===void 0?t.follow===void 0?20:t.follow:o.follow,this.compress=o.compress===void 0?t.compress===void 0?!0:t.compress:o.compress,this.counter=o.counter||t.counter||0,this.agent=o.agent||t.agent,this.highWaterMark=o.highWaterMark||t.highWaterMark||16384,this.insecureHTTPParser=o.insecureHTTPParser||t.insecureHTTPParser||!1,this.referrerPolicy=o.referrerPolicy||t.referrerPolicy||""}get method(){return this[ce].method}get url(){return(0,jl.format)(this[ce].parsedURL)}get headers(){return this[ce].headers}get redirect(){return this[ce].redirect}get signal(){return this[ce].signal}get referrer(){if(this[ce].referrer==="no-referrer")return"";if(this[ce].referrer==="client")return"about:client";if(this[ce].referrer)return this[ce].referrer.toString()}get referrerPolicy(){return this[ce].referrerPolicy}set referrerPolicy(t){this[ce].referrerPolicy=Nl(t)}clone(){return new n(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(Zt.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var $l=n=>{let{parsedURL:t}=n[ce],o=new xe(n[ce].headers);o.has("Accept")||o.set("Accept","*/*");let i=null;if(n.body===null&&/^(post|put)$/i.test(n.method)&&(i="0"),n.body!==null){let d=xl(n);typeof d=="number"&&!Number.isNaN(d)&&(i=String(d))}i&&o.set("Content-Length",i),n.referrerPolicy===""&&(n.referrerPolicy=kl),n.referrer&&n.referrer!=="no-referrer"?n[ce].referrer=Ll(n):n[ce].referrer="no-referrer",n[ce].referrer instanceof URL&&o.set("Referer",n.referrer),o.has("User-Agent")||o.set("User-Agent","node-fetch"),n.compress&&!o.has("Accept-Encoding")&&o.set("Accept-Encoding","gzip, deflate, br");let{agent:a}=n;typeof a=="function"&&(a=a(t));let l=Al(t),u={path:t.pathname+l,method:n.method,headers:o[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:n.insecureHTTPParser,agent:a};return{parsedURL:t,options:u}};var ho=class extends ct{constructor(t,o="aborted"){super(t,o)}};oo();zi();var wd=new Set(["data:","http:","https:"]);async function po(n,t){return new Promise((o,i)=>{let a=new Zt(n,t),{parsedURL:l,options:u}=$l(a);if(!wd.has(l.protocol))throw new TypeError(`node-fetch cannot load ${n}. URL scheme "${l.protocol.replace(/:$/,"")}" is not supported.`);if(l.protocol==="data:"){let y=al(a.url),R=new Be(y,{headers:{"Content-Type":y.typeFull}});o(R);return}let d=(l.protocol==="https:"?Wl.default:Ul.default).request,{signal:g}=a,f=null,p=()=>{let y=new ho("The operation was aborted.");i(y),a.body&&a.body instanceof ve.default.Readable&&a.body.destroy(y),!(!f||!f.body)&&f.body.emit("error",y)};if(g&&g.aborted){p();return}let T=()=>{p(),A()},v=d(l.toString(),u);g&&g.addEventListener("abort",T);let A=()=>{v.abort(),g&&g.removeEventListener("abort",T)};v.on("error",y=>{i(new ye(`request to ${a.url} failed, reason: ${y.message}`,"system",y)),A()}),Sd(v,y=>{f&&f.body&&f.body.destroy(y)}),process.version<"v14"&&v.on("socket",y=>{let R;y.prependListener("end",()=>{R=y._eventsCount}),y.prependListener("close",I=>{if(f&&R<y._eventsCount&&!I){let O=new Error("Premature close");O.code="ERR_STREAM_PREMATURE_CLOSE",f.body.emit("error",O)}})}),v.on("response",y=>{v.setTimeout(0);let R=Pl(y.rawHeaders);if(fo(y.statusCode)){let P=R.get("Location"),B=null;try{B=P===null?null:new URL(P,a.url)}catch{if(a.redirect!=="manual"){i(new ye(`uri requested responds with an invalid redirect URL: ${P}`,"invalid-redirect")),A();return}}switch(a.redirect){case"error":i(new ye(`uri requested responds with a redirect, redirect mode is set to error: ${a.url}`,"no-redirect")),A();return;case"manual":break;case"follow":{if(B===null)break;if(a.counter>=a.follow){i(new ye(`maximum redirect reached at: ${a.url}`,"max-redirect")),A();return}let H={headers:new xe(a.headers),follow:a.follow,counter:a.counter+1,agent:a.agent,compress:a.compress,method:a.method,body:Pr(a),signal:a.signal,size:a.size,referrer:a.referrer,referrerPolicy:a.referrerPolicy};if(!_l(a.url,B)||!wl(a.url,B))for(let dt of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(dt);if(y.statusCode!==303&&a.body&&t.body instanceof ve.default.Readable){i(new ye("Cannot follow redirect with body being a readable stream","unsupported-redirect")),A();return}(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&a.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let ue=Bl(R);ue&&(H.referrerPolicy=ue),o(po(new Zt(B,H))),A();return}default:return i(new TypeError(`Redirect option '${a.redirect}' is not a valid value of RequestRedirect`))}}g&&y.once("end",()=>{g.removeEventListener("abort",T)});let I=(0,ve.pipeline)(y,new ve.PassThrough,P=>{P&&i(P)});process.version<"v12.10"&&y.on("aborted",T);let O={url:a.url,status:y.statusCode,statusText:y.statusMessage,headers:R,size:a.size,counter:a.counter,highWaterMark:a.highWaterMark},$=R.get("Content-Encoding");if(!a.compress||a.method==="HEAD"||$===null||y.statusCode===204||y.statusCode===304){f=new Be(I,O),o(f);return}let V={flush:er.default.Z_SYNC_FLUSH,finishFlush:er.default.Z_SYNC_FLUSH};if($==="gzip"||$==="x-gzip"){I=(0,ve.pipeline)(I,er.default.createGunzip(V),P=>{P&&i(P)}),f=new Be(I,O),o(f);return}if($==="deflate"||$==="x-deflate"){let P=(0,ve.pipeline)(y,new ve.PassThrough,B=>{B&&i(B)});P.once("data",B=>{(B[0]&15)===8?I=(0,ve.pipeline)(I,er.default.createInflate(),H=>{H&&i(H)}):I=(0,ve.pipeline)(I,er.default.createInflateRaw(),H=>{H&&i(H)}),f=new Be(I,O),o(f)}),P.once("end",()=>{f||(f=new Be(I,O),o(f))});return}if($==="br"){I=(0,ve.pipeline)(I,er.default.createBrotliDecompress(),P=>{P&&i(P)}),f=new Be(I,O),o(f);return}f=new Be(I,O),o(f)}),vl(v,a).catch(i)})}function Sd(n,t){let o=ln.Buffer.from(`0\r
25
25
  \r
26
- `),i=!1,a=!1,l;n.on("response",u=>{let{headers:d}=u;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),n.on("socket",u=>{let d=()=>{if(i&&!a){let f=new Error("Premature close");f.code="ERR_STREAM_PREMATURE_CLOSE",t(f)}},g=f=>{a=ln.Buffer.compare(f.slice(-5),o)===0,!a&&l&&(a=ln.Buffer.compare(l.slice(-3),o.slice(0,3))===0&&ln.Buffer.compare(f.slice(-2),o.slice(3))===0),l=f};u.prependListener("close",d),u.on("data",g),n.on("close",()=>{u.removeListener("close",d),u.removeListener("data",g)})})}var Qe=require("child_process"),es=Y(require("semver"),1),Hl=Y(require("crypto"),1),Kl=Y(require("http"),1);var _e=Y(require("crypto"),1),ae=class{static deriveKeys(t){let i=_e.createHash("sha256").update(t).digest(),a=_e.createHmac("sha256",t).update("nexus-integrity-key").digest();return{encryptionKey:i,hmacKey:a}}static compile(t,o,i,a={}){let{encryptionKey:l,hmacKey:u}=this.deriveKeys(o),d={version:"2.0.0",compiledAt:new Date().toISOString(),projectId:i,...a},g=JSON.stringify(d),f=Buffer.from(g,"utf-8"),p=_e.randomBytes(16),T=_e.createCipheriv(this.ALGORITHM,l,p),v=JSON.stringify(t),A=T.update(v,"utf8");A=Buffer.concat([A,T.final()]);let y=Buffer.concat([p,A]),R=Buffer.from(this.MAGIC_HEADER,"ascii"),I=Buffer.alloc(4);I.writeUInt32BE(f.length,0);let O=Buffer.alloc(4);O.writeUInt32BE(y.length,0);let $=Buffer.concat([R,I,f,O,y]),V=_e.createHmac("sha256",u);V.update($);let P=V.digest();return Buffer.concat([$,P])}static decompile(t,o){if(t.length<44)throw new Error("Corrupted File: Binary payload is too short to be a valid Nexus node.");let{encryptionKey:i,hmacKey:a}=this.deriveKeys(o),l=t.length-32,u=t.subarray(0,l),d=t.subarray(l),g=_e.createHmac("sha256",a);g.update(u);let f=g.digest();if(!_e.timingSafeEqual(d,f))throw new Error("DATA_INTEGRITY_VIOLATION: Cryptographic signature mismatch. This local node has been modified externally or tampered with.");if(u.subarray(0,4).toString("ascii")!==this.MAGIC_HEADER)throw new Error("Invalid Format: File lacks the correct Nexus binary magic header.");let T=u.readUInt32BE(4),v=8,A=v+T,y=u.subarray(v,A).toString("utf-8"),R=JSON.parse(y),I=u.readUInt32BE(A),O=A+4,$=O+I,V=u.subarray(O,$),P=V.subarray(0,16),B=V.subarray(16),H=_e.createDecipheriv(this.ALGORITHM,i,P),ue=H.update(B);return ue=Buffer.concat([ue,H.final()]),{data:JSON.parse(ue.toString("utf8")),metadata:R}}};ae.MAGIC_HEADER="NEXS",ae.ALGORITHM="aes-256-cbc";var Je=Y(require("fs"),1),ft=Y(require("path"),1);var Rd="https://endpoints.gnexus.co.tz",Ed="https://sentry.gnexus.co.tz",Td="https://endpoints.gnexus.co.tz",Cd="https://sentry.gnexus.co.tz",Ml=()=>{let n=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_ID:void 0,t=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_KEY:void 0,o=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_API_URL:void 0,i=typeof process<"u"?process.env.NEXUS_PROJECT_ID:void 0,a=typeof process<"u"?process.env.NEXUS_API_KEY:void 0,l=typeof process<"u"?process.env.NEXUS_API_URL:void 0,d=(typeof process<"u"?process.env.NODE_ENV:"production")==="development"||typeof window<"u"&&window.location.hostname==="localhost",g=n??i,f=t??a,p=o??l??(d?Td:Rd),T=p.includes("localhost")?Cd:Ed;return{projectId:g,apiKey:f,apiUrl:p,analyticsUrl:T}};var cn=class{constructor(t,o){this.apiKey="";this.baseDir=t||".nexus/local";let i=Ml();this.apiKey=o||i.apiKey||""}isLoaded(){return Je.default.existsSync(ft.default.resolve(process.cwd(),this.baseDir))}decompileFile(t){if(!this.apiKey)return process.env.NODE_ENV==="development"&&console.warn("\u26A0\uFE0F NexusHub: Missing NEXUS_API_KEY. Local decryption bypassed."),null;try{let o=Je.default.readFileSync(t);return ae.decompile(o,this.apiKey).data}catch(o){return process.env.NODE_ENV==="development"&&console.error(`
26
+ `),i=!1,a=!1,l;n.on("response",u=>{let{headers:d}=u;i=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),n.on("socket",u=>{let d=()=>{if(i&&!a){let f=new Error("Premature close");f.code="ERR_STREAM_PREMATURE_CLOSE",t(f)}},g=f=>{a=ln.Buffer.compare(f.slice(-5),o)===0,!a&&l&&(a=ln.Buffer.compare(l.slice(-3),o.slice(0,3))===0&&ln.Buffer.compare(f.slice(-2),o.slice(3))===0),l=f};u.prependListener("close",d),u.on("data",g),n.on("close",()=>{u.removeListener("close",d),u.removeListener("data",g)})})}var Qe=require("child_process"),es=Y(require("semver"),1),Hl=Y(require("crypto"),1),Kl=Y(require("http"),1);var _e=Y(require("crypto"),1),ae=class{static deriveKeys(t){let i=_e.createHash("sha256").update(t).digest(),a=_e.createHmac("sha256",t).update("nexus-integrity-key").digest();return{encryptionKey:i,hmacKey:a}}static compile(t,o,i,a={}){let{encryptionKey:l,hmacKey:u}=this.deriveKeys(o),d={version:"2.0.0",compiledAt:new Date().toISOString(),projectId:i,...a},g=JSON.stringify(d),f=Buffer.from(g,"utf-8"),p=_e.randomBytes(16),T=_e.createCipheriv(this.ALGORITHM,l,p),v=JSON.stringify(t),A=T.update(v,"utf8");A=Buffer.concat([A,T.final()]);let y=Buffer.concat([p,A]),R=Buffer.from(this.MAGIC_HEADER,"ascii"),I=Buffer.alloc(4);I.writeUInt32BE(f.length,0);let O=Buffer.alloc(4);O.writeUInt32BE(y.length,0);let $=Buffer.concat([R,I,f,O,y]),V=_e.createHmac("sha256",u);V.update($);let P=V.digest();return Buffer.concat([$,P])}static decompile(t,o){if(t.length<44)throw new Error("Corrupted File: Binary payload is too short to be a valid Nexus node.");let{encryptionKey:i,hmacKey:a}=this.deriveKeys(o),l=t.length-32,u=t.subarray(0,l),d=t.subarray(l),g=_e.createHmac("sha256",a);g.update(u);let f=g.digest();if(!_e.timingSafeEqual(d,f))throw new Error("DATA_INTEGRITY_VIOLATION: Cryptographic signature mismatch. This local node has been modified externally or tampered with.");if(u.subarray(0,4).toString("ascii")!==this.MAGIC_HEADER)throw new Error("Invalid Format: File lacks the correct Nexus binary magic header.");let T=u.readUInt32BE(4),v=8,A=v+T,y=u.subarray(v,A).toString("utf-8"),R=JSON.parse(y),I=u.readUInt32BE(A),O=A+4,$=O+I,V=u.subarray(O,$),P=V.subarray(0,16),B=V.subarray(16),H=_e.createDecipheriv(this.ALGORITHM,i,P),ue=H.update(B);return ue=Buffer.concat([ue,H.final()]),{data:JSON.parse(ue.toString("utf8")),metadata:R}}};ae.MAGIC_HEADER="NEXS",ae.ALGORITHM="aes-256-cbc";var Je=Y(require("fs"),1),ft=Y(require("path"),1);var Rd="https://gnapex.gnexus.co.tz",Ed="https://sentry.gnexus.co.tz",Td="https://gnapex.gnexus.co.tz",Cd="https://sentry.gnexus.co.tz",Ml=()=>{let n=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_ID:void 0,t=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_KEY:void 0,o=typeof process<"u"?process.env.NEXT_PUBLIC_NEXUS_API_URL:void 0,i=typeof process<"u"?process.env.NEXUS_PROJECT_ID:void 0,a=typeof process<"u"?process.env.NEXUS_API_KEY:void 0,l=typeof process<"u"?process.env.NEXUS_API_URL:void 0,d=(typeof process<"u"?process.env.NODE_ENV:"production")==="development"||typeof window<"u"&&window.location.hostname==="localhost",g=n??i,f=t??a,p=o??l??(d?Td:Rd),T=p.includes("localhost")?Cd:Ed;return{projectId:g,apiKey:f,apiUrl:p,analyticsUrl:T}};var cn=class{constructor(t,o){this.apiKey="";this.baseDir=t||".nexus/local";let i=Ml();this.apiKey=o||i.apiKey||""}isLoaded(){return Je.default.existsSync(ft.default.resolve(process.cwd(),this.baseDir))}decompileFile(t){if(!this.apiKey)return process.env.NODE_ENV==="development"&&console.warn("\u26A0\uFE0F NexusHub: Missing NEXUS_API_KEY. Local decryption bypassed."),null;try{let o=Je.default.readFileSync(t);return ae.decompile(o,this.apiKey).data}catch(o){return process.env.NODE_ENV==="development"&&console.error(`
27
27
  \u{1F6A8} NexusHub Security Alert: Data Integrity Violation in file:
28
28
  ${t}
29
29
  Error: ${o.message}
30
30
  This file has been disabled until regenerated via npx nexus pull.
31
- `),null}}async getPage(t){let o=ft.default.resolve(process.cwd(),this.baseDir,"pages",`${t}.nx`);if(Je.default.existsSync(o)){let i=this.decompileFile(o);if(!i)return null;let a=i;for(;a&&typeof a=="object"&&a.data!==void 0;)a=a.data;return a}return null}async getCollection(t){let o=ft.default.resolve(process.cwd(),this.baseDir,"collections",`${t}.nx`);return Je.default.existsSync(o)?this.decompileFile(o):null}async getGlobals(){let t=ft.default.resolve(process.cwd(),this.baseDir,"globals.nx");return Je.default.existsSync(t)?this.decompileFile(t):null}async getAllData(){let t={},o={},i={};try{let a=ft.default.resolve(process.cwd(),this.baseDir,"pages");if(Je.default.existsSync(a)){for(let u of Je.default.readdirSync(a))if(u.endsWith(".nx")){let d=ft.default.basename(u,".nx");t[d]=await this.getPage(d)}}let l=ft.default.resolve(process.cwd(),this.baseDir,"collections");if(Je.default.existsSync(l)){for(let u of Je.default.readdirSync(l))if(u.endsWith(".nx")){let d=ft.default.basename(u,".nx");o[d]=await this.getCollection(d)||[]}}i=await this.getGlobals()||{}}catch{}return{pages:t,collections:o,globals:i}}};var Gl=Qi.default.default||Qi.default,Pt=Zi.default.default||Zi.default,xd=Xi.default.default||Xi.default,At=Ji.default.default||Ji.default,go=es.default.default||es.default,It="2.0.0",Ot=".nexus",wo=C.default.join(Ot,".nexus-lock"),ns=C.default.join(Ot,"nexus.config.nx"),So=C.default.join(Ot,"schema.nx"),bo=C.default.join(Ot,"origin.nx"),me=C.default.join(Ot,"local"),ts="https://endpoints.gnexus.co.tz",vd=w.bold.hex("#00D4FF"),S=w.hex("#666666"),G=w.hex("#00FF88"),le=w.hex("#FFB800"),Q=w.hex("#FF4444"),Pd=new Set(["init","help","--help","-h","--version","-V"]);function we(n=""){let t=xd.textSync("NEXUS",{font:"Doom",horizontalLayout:"full"}),o=Gl(["#00D4FF","#7B2FFF","#FF00AA"])(t);console.log(`
31
+ `),null}}async getPage(t){let o=ft.default.resolve(process.cwd(),this.baseDir,"pages",`${t}.nx`);if(Je.default.existsSync(o)){let i=this.decompileFile(o);if(!i)return null;let a=i;for(;a&&typeof a=="object"&&a.data!==void 0;)a=a.data;return a}return null}async getCollection(t){let o=ft.default.resolve(process.cwd(),this.baseDir,"collections",`${t}.nx`);return Je.default.existsSync(o)?this.decompileFile(o):null}async getGlobals(){let t=ft.default.resolve(process.cwd(),this.baseDir,"globals.nx");return Je.default.existsSync(t)?this.decompileFile(t):null}async getAllData(){let t={},o={},i={};try{let a=ft.default.resolve(process.cwd(),this.baseDir,"pages");if(Je.default.existsSync(a)){for(let u of Je.default.readdirSync(a))if(u.endsWith(".nx")){let d=ft.default.basename(u,".nx");t[d]=await this.getPage(d)}}let l=ft.default.resolve(process.cwd(),this.baseDir,"collections");if(Je.default.existsSync(l)){for(let u of Je.default.readdirSync(l))if(u.endsWith(".nx")){let d=ft.default.basename(u,".nx");o[d]=await this.getCollection(d)||[]}}i=await this.getGlobals()||{}}catch{}return{pages:t,collections:o,globals:i}}};var Gl=Qi.default.default||Qi.default,Pt=Zi.default.default||Zi.default,xd=Xi.default.default||Xi.default,At=Ji.default.default||Ji.default,go=es.default.default||es.default,It="2.0.0",Ot=".nexus",wo=C.default.join(Ot,".nexus-lock"),ns=C.default.join(Ot,"nexus.config.nx"),So=C.default.join(Ot,"schema.nx"),bo=C.default.join(Ot,"origin.nx"),me=C.default.join(Ot,"local"),ts="https://gnapex.gnexus.co.tz",vd=w.bold.hex("#00D4FF"),S=w.hex("#666666"),G=w.hex("#00FF88"),le=w.hex("#FFB800"),Q=w.hex("#FF4444"),Pd=new Set(["init","help","--help","-h","--version","-V"]);function we(n=""){let t=xd.textSync("NEXUS",{font:"Doom",horizontalLayout:"full"}),o=Gl(["#00D4FF","#7B2FFF","#FF00AA"])(t);console.log(`
32
32
  `+o),console.log(S(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),n&&console.log(" "+w.bold.white(n)),console.log(S(` SDK CLI v${It} \xB7 Platform by G-Nexus \xB7 Enterprise Edition`)),console.log(S(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
33
33
  `))}async function Or(){let n=process.cwd(),t=C.default.join(n,wo);await E.default.pathExists(t)||(console.log(`
34
34
  `+Q("\u2716 Project not initialized.")),console.log(S(" This project has not been set up with the NexusHub SDK.")),console.log(S(` Run the following command to get started:
@@ -208,7 +208,7 @@ Empty schema values are intentional placeholders \u2014 fill them with your cont
208
208
  \u2728 NexusHub is managing the build. Check your dashboard for progress.
209
209
  `))}catch(R){y.fail(Q(R.message)),process.exit(1)}return}let f=Gd(),p=E.default.existsSync(C.default.join(process.cwd(),"open-next.config.ts"))||E.default.existsSync(C.default.join(process.cwd(),"open-next.config.js"));if(!f&&!p){let y=J("[2/5] Provisioning NexusHub Edge Adapter...").start();try{(0,Qe.execSync)(`${a==="npm"?"npm install -D":a+" add -D"} @opennextjs/cloudflare`,{stdio:"pipe"}),(0,Qe.execSync)(`${l} opennextjs-cloudflare init --yes`,{stdio:"pipe"}),y.succeed(G("NexusHub Edge Adapter installed"))}catch{y.fail(Q("Adapter provisioning failed")),process.exit(1)}}let T=d.cloudflareProjectName||d.subdomain||"",v=C.default.resolve(process.cwd(),"wrangler.json"),A=!1;try{if(!f&&!E.default.existsSync(v)){let P={name:T,main:".open-next/worker.js",compatibility_date:"2026-06-25",compatibility_flags:["nodejs_compat"],assets:{directory:".open-next/assets"},vars:{NEXT_PUBLIC_NEXUS_ID:o,NEXT_PUBLIC_NEXUS_KEY:t,NEXT_PUBLIC_NEXUS_API_URL:i}};await E.default.writeJson(v,P,{spaces:2}),A=!0}if(f){let P=J("[2/5] Building static production artifacts...").start();try{(0,Qe.execSync)(`${a} run build`,{stdio:"pipe",env:{...process.env,NODE_ENV:"production"}}),P.succeed(G("Build complete"))}catch{P.fail(Q("Build failed")),process.exit(1)}}else{let P=J("[2/5] Compiling and adapting Next.js for the Edge...").start();try{(0,Qe.execSync)(`${l} opennextjs-cloudflare build`,{stdio:"pipe",env:{...process.env,NODE_ENV:"production"}}),P.succeed(G("Edge adaptation and compilation complete"))}catch(B){P.fail(Q(`Edge adaptation failed: ${B.message}`)),process.exit(1)}}let y=J("[3/5] Requesting ephemeral deploy token...").start(),R,I;try{let P=await de(`${i}/devops/projects/${o}/deploy/token`,t,{method:"POST",timeout:6e4});R=P.token,I=P.accountId,y.succeed(w.gray("Token issued (15min validity)"))}catch(P){y.fail(Q("Token request failed: "+P.message)),process.exit(1)}let O=J("[4/5] Deploying live to NexusHub Global Edge...").start();try{let P=require.resolve("wrangler/package.json"),B=await E.default.readJson(P),H=typeof B.bin=="string"?B.bin:B.bin?.wrangler||"bin/wrangler.js",ue=C.default.resolve(C.default.dirname(P),H);(0,Qe.execSync)(`node ${ue} deploy`,{stdio:"pipe",env:{...process.env,CLOUDFLARE_API_TOKEN:R,CLOUDFLARE_ACCOUNT_ID:I,WRANGLER_OUTPUT_FILE_PATH:"/dev/null",NO_COLOR:"1",CI:"true"}}),O.succeed(G("Edge deployment complete"))}catch(P){O.fail(Q("Edge transfer failed")),P.stderr&&console.error(S(` Error Details: ${P.stderr.toString()}`)),process.exit(1)}let $=J("[5/5] Synchronizing global edge routing...").start();try{await de(`${i}/devops/projects/${o}/deploy/complete`,t,{method:"POST",body:{status:"success"}}),$.succeed(G("Global routing synchronized"))}catch{$.warn(le("Synchronized partially (Site is live, DNS propagation pending)"))}let V=d.liveUrl||`https://${d.subdomain}.gnexus.co.tz`;console.log(w.gray(`
210
210
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`)),console.log(` ${G("\u2714")} Platform successfully compiled and active on the Edge.`),console.log(` \u{1F30D} ${w.bold.white("Live URL:")} ${w.bold.cyan(V)}`),console.log(w.gray(` \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
211
- `))}finally{A&&(await E.default.remove(v).catch(()=>{}),await E.default.remove(C.default.resolve(process.cwd(),".wrangler")).catch(()=>{}))}}function Gd(){for(let n of["next.config.ts","next.config.mjs","next.config.js"])try{let t=E.default.readFileSync(C.default.join(process.cwd(),n),"utf8");if(/output\s*[:=]\s*['"]export['"]/.test(t))return!0}catch{}return!1}function Vd(){we("Local Workspace Manager"),console.log(` Your local staging database is fully compiled and secured inside the
211
+ `))}finally{let y=[v,C.default.resolve(process.cwd(),".wrangler"),C.default.resolve(process.cwd(),".open-next")];for(let R of y)try{await E.default.pathExists(R)&&await E.default.remove(R)}catch{}}}function Gd(){for(let n of["next.config.ts","next.config.mjs","next.config.js"])try{let t=E.default.readFileSync(C.default.join(process.cwd(),n),"utf8");if(/output\s*[:=]\s*['"]export['"]/.test(t))return!0}catch{}return!1}function Vd(){we("Local Workspace Manager"),console.log(` Your local staging database is fully compiled and secured inside the
212
212
  ${w.cyan(".nexus/local/")} directory using cryptographic ${w.bold(".nx")} binary files.
213
213
  This keeps your local sandbox 100% secure and offline-ready.
214
214
  `);let n=new At({head:[w.bold.cyan("Command"),w.bold.cyan("Description")],style:{head:[],border:[]}});n.push([w.white("npx nexus local list"),S("Browse decrypted local pages, collections, and item counts")],[w.white("npx nexus local init-templates"),S("Scaffold empty default files based on your schema.json")],[w.white("npx nexus local reset"),S("Purge all local data and reset files to empty schema defaults")],[w.white("npx nexus studio"),S("Launch the interactive, visual offline Content Studio")]),console.log(n.toString()+`
@@ -37,9 +37,9 @@ var import_fs = __toESM(require("fs"), 1);
37
37
  var import_path = __toESM(require("path"), 1);
38
38
 
39
39
  // src/config.ts
40
- var DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
40
+ var DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
41
41
  var DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
42
- var LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
42
+ var LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
43
43
  var LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
44
44
  var getEnvConfig = () => {
45
45
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
@@ -3,9 +3,9 @@ import fs from "fs";
3
3
  import path from "path";
4
4
 
5
5
  // src/config.ts
6
- var DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
6
+ var DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
7
7
  var DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
8
- var LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
8
+ var LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
9
9
  var LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
10
10
  var getEnvConfig = () => {
11
11
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
package/dist/index.cjs CHANGED
@@ -35,9 +35,9 @@ var DEFAULT_API_URL, DEFAULT_ANALYTICS_URL, LOCAL_NEST_URL, LOCAL_RUST_URL, getE
35
35
  var init_config = __esm({
36
36
  "src/config.ts"() {
37
37
  "use strict";
38
- DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
38
+ DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
39
39
  DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
40
- LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
40
+ LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
41
41
  LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
42
42
  getEnvConfig = () => {
43
43
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
@@ -936,7 +936,7 @@ var ContentEngine = class {
936
936
  });
937
937
  this.requestBatcher = new RequestBatcher(20, 50);
938
938
  this.circuitBreaker = new CircuitBreaker();
939
- this.defaultRevalidate = config.revalidateTime || 60;
939
+ this.defaultRevalidate = config.revalidateTime || false;
940
940
  this.cacheStrategy = config.cacheStrategy || "memory";
941
941
  if (!this.isServer) {
942
942
  window.addEventListener("beforeunload", this.cleanup.bind(this));
@@ -1062,7 +1062,7 @@ var ContentEngine = class {
1062
1062
  }
1063
1063
  this.memoryCache.set(cacheKey, result, {
1064
1064
  tags: [...tags, CacheTags.collection(collectionId)],
1065
- revalidate
1065
+ revalidate: revalidate === false ? void 0 : revalidate
1066
1066
  });
1067
1067
  return result;
1068
1068
  }
@@ -1125,7 +1125,7 @@ var ContentEngine = class {
1125
1125
  if (localGlobals) {
1126
1126
  this.memoryCache.set(cacheKey, localGlobals, {
1127
1127
  tags: [CacheTags.global],
1128
- revalidate
1128
+ revalidate: revalidate === false ? void 0 : revalidate
1129
1129
  });
1130
1130
  return localGlobals;
1131
1131
  }
@@ -1333,54 +1333,15 @@ var ContentEngine = class {
1333
1333
  return null;
1334
1334
  }
1335
1335
  writeCache(key, data, options) {
1336
+ const numericRevalidate = options.revalidate === false ? 31536e5 : options.revalidate;
1336
1337
  if (this.cacheStrategy === "memory") {
1337
1338
  this.memoryCache.set(key, data, {
1338
1339
  tags: options.tags,
1339
- revalidate: options.revalidate
1340
+ revalidate: numericRevalidate
1340
1341
  });
1341
1342
  }
1342
1343
  if (!this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
1343
- this.browserCache.set(key, data, options.revalidate * 1e3);
1344
- }
1345
- }
1346
- // packages/client-sdk/src/content/index.ts
1347
- /**
1348
- * ⚡ THE PULSE: Next.js Cache Revalidation Receiver
1349
- * Used in app/api/nexus-revalidate/route.ts to handle instant updates from the NexusHub backend.
1350
- *
1351
- * @param req The incoming Request object from Next.js
1352
- * @param revalidateFn The revalidateTag function imported from 'next/cache'
1353
- */
1354
- async handleRevalidation(req, revalidateFn) {
1355
- try {
1356
- if (!req.body) {
1357
- return { success: false, message: "Missing Pulse Payload" };
1358
- }
1359
- const body = await req.json();
1360
- const { secret, tag } = body;
1361
- if (!secret || secret !== this.config.projectId) {
1362
- if (this.config.debug) {
1363
- console.warn(`[NexusHub] \u26A0\uFE0F Blocked unauthorized Pulse request.`);
1364
- }
1365
- return { success: false, message: "Invalid Pulse Signature" };
1366
- }
1367
- const targetTag = tag || "content_all";
1368
- revalidateFn(targetTag);
1369
- this.invalidateCache([targetTag]);
1370
- if (this.config.debug) {
1371
- console.log(
1372
- `[NexusHub] \u26A1 Pulse Received: Successfully revalidated tag [${targetTag}]`
1373
- );
1374
- }
1375
- return { success: true, now: Date.now() };
1376
- } catch (e) {
1377
- if (this.config.debug) {
1378
- console.error(`[NexusHub] \u274C Pulse Processing Error:`, e.message);
1379
- }
1380
- return {
1381
- success: false,
1382
- message: "Malformed Pulse Payload or Processing Error"
1383
- };
1344
+ this.browserCache.set(key, data, numericRevalidate * 1e3);
1384
1345
  }
1385
1346
  }
1386
1347
  /**
@@ -1425,6 +1386,7 @@ var ContentEngine = class {
1425
1386
  if (this.config.debug) {
1426
1387
  console.log(`[NexusHub] \u{1F310} Fetching: ${url}`);
1427
1388
  }
1389
+ const expiresAt = revalidate === false ? Infinity : Date.now() + revalidate * 1e3;
1428
1390
  const res = await this.fetchWithTimeout(url, {
1429
1391
  method: "GET",
1430
1392
  headers: this.getHeaders(),
@@ -1446,7 +1408,7 @@ var ContentEngine = class {
1446
1408
  metadata: {
1447
1409
  timestamp: Date.now(),
1448
1410
  etag: etag || void 0,
1449
- expiresAt: Date.now() + revalidate * 1e3,
1411
+ expiresAt,
1450
1412
  tags: [...tags, CacheTags.content(slug)]
1451
1413
  }
1452
1414
  };
@@ -1477,12 +1439,13 @@ var ContentEngine = class {
1477
1439
  }
1478
1440
  const json = await res.json();
1479
1441
  const etag = res.headers.get("etag");
1442
+ const expiresAt = revalidate === false ? Infinity : Date.now() + revalidate * 1e3;
1480
1443
  const cacheEntry = {
1481
1444
  data: json,
1482
1445
  metadata: {
1483
1446
  timestamp: Date.now(),
1484
1447
  etag: etag || void 0,
1485
- expiresAt: Date.now() + revalidate * 1e3,
1448
+ expiresAt,
1486
1449
  tags: [...tags, CacheTags.collection(collectionId)]
1487
1450
  }
1488
1451
  };
@@ -2585,7 +2548,7 @@ var NexusClient = class {
2585
2548
  this.config = {
2586
2549
  debug: config?.debug ?? false,
2587
2550
  cacheStrategy: config?.cacheStrategy ?? "memory",
2588
- revalidateTime: config?.revalidateTime ?? 60,
2551
+ revalidateTime: config?.revalidateTime ?? false,
2589
2552
  timeout: config?.timeout ?? 1e4,
2590
2553
  retries: config?.retries ?? 3,
2591
2554
  ...fullConfig
package/dist/index.d.cts CHANGED
@@ -6,9 +6,9 @@ interface MinimalNexusConfig {
6
6
  apiKey?: string;
7
7
  projectId?: string;
8
8
  }
9
- declare const DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
9
+ declare const DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
10
10
  declare const DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
11
- declare const LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
11
+ declare const LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
12
12
  declare const LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
13
13
  declare const getEnvConfig: () => MinimalNexusConfig;
14
14
  declare const mergeConfigs: (base: MinimalNexusConfig, override: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
@@ -17,8 +17,8 @@ declare const validateConfig: (config: MinimalNexusConfig) => string[];
17
17
 
18
18
  interface NexusConfig extends MinimalNexusConfig {
19
19
  debug?: boolean;
20
- cacheStrategy?: 'memory' | 'localStorage' | 'none';
21
- revalidateTime?: number;
20
+ cacheStrategy?: "memory" | "localStorage" | "none";
21
+ revalidateTime?: number | false;
22
22
  timeout?: number;
23
23
  retries?: number;
24
24
  }
@@ -34,7 +34,7 @@ interface ContentResponse<T = any> {
34
34
  version: number;
35
35
  updatedAt: string;
36
36
  locale?: string;
37
- cacheStatus: 'hit' | 'miss' | 'stale';
37
+ cacheStatus: "hit" | "miss" | "stale";
38
38
  };
39
39
  }
40
40
  interface CollectionResponse<T = any> {
@@ -65,7 +65,7 @@ interface CollectionQuery {
65
65
  page?: number;
66
66
  limit?: number;
67
67
  sort?: string;
68
- order?: 'asc' | 'desc';
68
+ order?: "asc" | "desc";
69
69
  filter?: Record<string, any>;
70
70
  fields?: string[];
71
71
  search?: string;
@@ -96,7 +96,7 @@ declare class ContentEngine {
96
96
  * Fetch a Single Page with full strategy pipeline
97
97
  */
98
98
  getPage<T = any>(slug: string, options?: {
99
- revalidate?: number;
99
+ revalidate?: number | false;
100
100
  tags?: string[];
101
101
  forceRefresh?: boolean;
102
102
  includeMetadata?: boolean;
@@ -106,7 +106,7 @@ declare class ContentEngine {
106
106
  * Fetch a Collection (Optimized)
107
107
  */
108
108
  getCollection<T = any>(collectionId: string, query?: CollectionQuery, options?: {
109
- revalidate?: number;
109
+ revalidate?: number | false;
110
110
  tags?: string[];
111
111
  forceRefresh?: boolean;
112
112
  includeMetadata?: boolean;
@@ -117,7 +117,7 @@ declare class ContentEngine {
117
117
  */
118
118
  getGlobals<T = any>(options?: {
119
119
  include?: string[];
120
- revalidate?: number;
120
+ revalidate?: number | false;
121
121
  forceRefresh?: boolean;
122
122
  }): Promise<T>;
123
123
  /**
@@ -125,7 +125,7 @@ declare class ContentEngine {
125
125
  * If you call this 10 times in a loop, it sends 1 HTTP request.
126
126
  */
127
127
  getItem<T = any>(collectionId: string, itemId: string, options?: {
128
- revalidate?: number;
128
+ revalidate?: number | false;
129
129
  tags?: string[];
130
130
  include?: string[];
131
131
  }): Promise<T>;
@@ -136,7 +136,7 @@ declare class ContentEngine {
136
136
  collections?: string[];
137
137
  fields?: string[];
138
138
  limit?: number;
139
- revalidate?: number;
139
+ revalidate?: number | false;
140
140
  }): Promise<{
141
141
  results: T[];
142
142
  total: number;
@@ -154,18 +154,6 @@ declare class ContentEngine {
154
154
  */
155
155
  private checkCaches;
156
156
  private writeCache;
157
- /**
158
- * ⚡ THE PULSE: Next.js Cache Revalidation Receiver
159
- * Used in app/api/nexus-revalidate/route.ts to handle instant updates from the NexusHub backend.
160
- *
161
- * @param req The incoming Request object from Next.js
162
- * @param revalidateFn The revalidateTag function imported from 'next/cache'
163
- */
164
- handleRevalidation(req: Request, revalidateFn: (tag: string) => void): Promise<{
165
- success: boolean;
166
- message?: string;
167
- now?: number;
168
- }>;
169
157
  /**
170
158
  * Invalidate cache by tags
171
159
  */
package/dist/index.d.ts CHANGED
@@ -6,9 +6,9 @@ interface MinimalNexusConfig {
6
6
  apiKey?: string;
7
7
  projectId?: string;
8
8
  }
9
- declare const DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
9
+ declare const DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
10
10
  declare const DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
11
- declare const LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
11
+ declare const LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
12
12
  declare const LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
13
13
  declare const getEnvConfig: () => MinimalNexusConfig;
14
14
  declare const mergeConfigs: (base: MinimalNexusConfig, override: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
@@ -17,8 +17,8 @@ declare const validateConfig: (config: MinimalNexusConfig) => string[];
17
17
 
18
18
  interface NexusConfig extends MinimalNexusConfig {
19
19
  debug?: boolean;
20
- cacheStrategy?: 'memory' | 'localStorage' | 'none';
21
- revalidateTime?: number;
20
+ cacheStrategy?: "memory" | "localStorage" | "none";
21
+ revalidateTime?: number | false;
22
22
  timeout?: number;
23
23
  retries?: number;
24
24
  }
@@ -34,7 +34,7 @@ interface ContentResponse<T = any> {
34
34
  version: number;
35
35
  updatedAt: string;
36
36
  locale?: string;
37
- cacheStatus: 'hit' | 'miss' | 'stale';
37
+ cacheStatus: "hit" | "miss" | "stale";
38
38
  };
39
39
  }
40
40
  interface CollectionResponse<T = any> {
@@ -65,7 +65,7 @@ interface CollectionQuery {
65
65
  page?: number;
66
66
  limit?: number;
67
67
  sort?: string;
68
- order?: 'asc' | 'desc';
68
+ order?: "asc" | "desc";
69
69
  filter?: Record<string, any>;
70
70
  fields?: string[];
71
71
  search?: string;
@@ -96,7 +96,7 @@ declare class ContentEngine {
96
96
  * Fetch a Single Page with full strategy pipeline
97
97
  */
98
98
  getPage<T = any>(slug: string, options?: {
99
- revalidate?: number;
99
+ revalidate?: number | false;
100
100
  tags?: string[];
101
101
  forceRefresh?: boolean;
102
102
  includeMetadata?: boolean;
@@ -106,7 +106,7 @@ declare class ContentEngine {
106
106
  * Fetch a Collection (Optimized)
107
107
  */
108
108
  getCollection<T = any>(collectionId: string, query?: CollectionQuery, options?: {
109
- revalidate?: number;
109
+ revalidate?: number | false;
110
110
  tags?: string[];
111
111
  forceRefresh?: boolean;
112
112
  includeMetadata?: boolean;
@@ -117,7 +117,7 @@ declare class ContentEngine {
117
117
  */
118
118
  getGlobals<T = any>(options?: {
119
119
  include?: string[];
120
- revalidate?: number;
120
+ revalidate?: number | false;
121
121
  forceRefresh?: boolean;
122
122
  }): Promise<T>;
123
123
  /**
@@ -125,7 +125,7 @@ declare class ContentEngine {
125
125
  * If you call this 10 times in a loop, it sends 1 HTTP request.
126
126
  */
127
127
  getItem<T = any>(collectionId: string, itemId: string, options?: {
128
- revalidate?: number;
128
+ revalidate?: number | false;
129
129
  tags?: string[];
130
130
  include?: string[];
131
131
  }): Promise<T>;
@@ -136,7 +136,7 @@ declare class ContentEngine {
136
136
  collections?: string[];
137
137
  fields?: string[];
138
138
  limit?: number;
139
- revalidate?: number;
139
+ revalidate?: number | false;
140
140
  }): Promise<{
141
141
  results: T[];
142
142
  total: number;
@@ -154,18 +154,6 @@ declare class ContentEngine {
154
154
  */
155
155
  private checkCaches;
156
156
  private writeCache;
157
- /**
158
- * ⚡ THE PULSE: Next.js Cache Revalidation Receiver
159
- * Used in app/api/nexus-revalidate/route.ts to handle instant updates from the NexusHub backend.
160
- *
161
- * @param req The incoming Request object from Next.js
162
- * @param revalidateFn The revalidateTag function imported from 'next/cache'
163
- */
164
- handleRevalidation(req: Request, revalidateFn: (tag: string) => void): Promise<{
165
- success: boolean;
166
- message?: string;
167
- now?: number;
168
- }>;
169
157
  /**
170
158
  * Invalidate cache by tags
171
159
  */
package/dist/index.js CHANGED
@@ -13,9 +13,9 @@ var DEFAULT_API_URL, DEFAULT_ANALYTICS_URL, LOCAL_NEST_URL, LOCAL_RUST_URL, getE
13
13
  var init_config = __esm({
14
14
  "src/config.ts"() {
15
15
  "use strict";
16
- DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
16
+ DEFAULT_API_URL = "https://gnapex.gnexus.co.tz";
17
17
  DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
18
- LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
18
+ LOCAL_NEST_URL = "https://gnapex.gnexus.co.tz";
19
19
  LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
20
20
  getEnvConfig = () => {
21
21
  const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
@@ -890,7 +890,7 @@ var ContentEngine = class {
890
890
  });
891
891
  this.requestBatcher = new RequestBatcher(20, 50);
892
892
  this.circuitBreaker = new CircuitBreaker();
893
- this.defaultRevalidate = config.revalidateTime || 60;
893
+ this.defaultRevalidate = config.revalidateTime || false;
894
894
  this.cacheStrategy = config.cacheStrategy || "memory";
895
895
  if (!this.isServer) {
896
896
  window.addEventListener("beforeunload", this.cleanup.bind(this));
@@ -1016,7 +1016,7 @@ var ContentEngine = class {
1016
1016
  }
1017
1017
  this.memoryCache.set(cacheKey, result, {
1018
1018
  tags: [...tags, CacheTags.collection(collectionId)],
1019
- revalidate
1019
+ revalidate: revalidate === false ? void 0 : revalidate
1020
1020
  });
1021
1021
  return result;
1022
1022
  }
@@ -1079,7 +1079,7 @@ var ContentEngine = class {
1079
1079
  if (localGlobals) {
1080
1080
  this.memoryCache.set(cacheKey, localGlobals, {
1081
1081
  tags: [CacheTags.global],
1082
- revalidate
1082
+ revalidate: revalidate === false ? void 0 : revalidate
1083
1083
  });
1084
1084
  return localGlobals;
1085
1085
  }
@@ -1287,54 +1287,15 @@ var ContentEngine = class {
1287
1287
  return null;
1288
1288
  }
1289
1289
  writeCache(key, data, options) {
1290
+ const numericRevalidate = options.revalidate === false ? 31536e5 : options.revalidate;
1290
1291
  if (this.cacheStrategy === "memory") {
1291
1292
  this.memoryCache.set(key, data, {
1292
1293
  tags: options.tags,
1293
- revalidate: options.revalidate
1294
+ revalidate: numericRevalidate
1294
1295
  });
1295
1296
  }
1296
1297
  if (!this.isServer && this.cacheStrategy === "localStorage" && this.browserCache) {
1297
- this.browserCache.set(key, data, options.revalidate * 1e3);
1298
- }
1299
- }
1300
- // packages/client-sdk/src/content/index.ts
1301
- /**
1302
- * ⚡ THE PULSE: Next.js Cache Revalidation Receiver
1303
- * Used in app/api/nexus-revalidate/route.ts to handle instant updates from the NexusHub backend.
1304
- *
1305
- * @param req The incoming Request object from Next.js
1306
- * @param revalidateFn The revalidateTag function imported from 'next/cache'
1307
- */
1308
- async handleRevalidation(req, revalidateFn) {
1309
- try {
1310
- if (!req.body) {
1311
- return { success: false, message: "Missing Pulse Payload" };
1312
- }
1313
- const body = await req.json();
1314
- const { secret, tag } = body;
1315
- if (!secret || secret !== this.config.projectId) {
1316
- if (this.config.debug) {
1317
- console.warn(`[NexusHub] \u26A0\uFE0F Blocked unauthorized Pulse request.`);
1318
- }
1319
- return { success: false, message: "Invalid Pulse Signature" };
1320
- }
1321
- const targetTag = tag || "content_all";
1322
- revalidateFn(targetTag);
1323
- this.invalidateCache([targetTag]);
1324
- if (this.config.debug) {
1325
- console.log(
1326
- `[NexusHub] \u26A1 Pulse Received: Successfully revalidated tag [${targetTag}]`
1327
- );
1328
- }
1329
- return { success: true, now: Date.now() };
1330
- } catch (e) {
1331
- if (this.config.debug) {
1332
- console.error(`[NexusHub] \u274C Pulse Processing Error:`, e.message);
1333
- }
1334
- return {
1335
- success: false,
1336
- message: "Malformed Pulse Payload or Processing Error"
1337
- };
1298
+ this.browserCache.set(key, data, numericRevalidate * 1e3);
1338
1299
  }
1339
1300
  }
1340
1301
  /**
@@ -1379,6 +1340,7 @@ var ContentEngine = class {
1379
1340
  if (this.config.debug) {
1380
1341
  console.log(`[NexusHub] \u{1F310} Fetching: ${url}`);
1381
1342
  }
1343
+ const expiresAt = revalidate === false ? Infinity : Date.now() + revalidate * 1e3;
1382
1344
  const res = await this.fetchWithTimeout(url, {
1383
1345
  method: "GET",
1384
1346
  headers: this.getHeaders(),
@@ -1400,7 +1362,7 @@ var ContentEngine = class {
1400
1362
  metadata: {
1401
1363
  timestamp: Date.now(),
1402
1364
  etag: etag || void 0,
1403
- expiresAt: Date.now() + revalidate * 1e3,
1365
+ expiresAt,
1404
1366
  tags: [...tags, CacheTags.content(slug)]
1405
1367
  }
1406
1368
  };
@@ -1431,12 +1393,13 @@ var ContentEngine = class {
1431
1393
  }
1432
1394
  const json = await res.json();
1433
1395
  const etag = res.headers.get("etag");
1396
+ const expiresAt = revalidate === false ? Infinity : Date.now() + revalidate * 1e3;
1434
1397
  const cacheEntry = {
1435
1398
  data: json,
1436
1399
  metadata: {
1437
1400
  timestamp: Date.now(),
1438
1401
  etag: etag || void 0,
1439
- expiresAt: Date.now() + revalidate * 1e3,
1402
+ expiresAt,
1440
1403
  tags: [...tags, CacheTags.collection(collectionId)]
1441
1404
  }
1442
1405
  };
@@ -2539,7 +2502,7 @@ var NexusClient = class {
2539
2502
  this.config = {
2540
2503
  debug: config?.debug ?? false,
2541
2504
  cacheStrategy: config?.cacheStrategy ?? "memory",
2542
- revalidateTime: config?.revalidateTime ?? 60,
2505
+ revalidateTime: config?.revalidateTime ?? false,
2543
2506
  timeout: config?.timeout ?? 1e4,
2544
2507
  retries: config?.retries ?? 3,
2545
2508
  ...fullConfig