@shipstatic/ship 0.4.20 → 0.4.21
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/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Pe=Object.defineProperty;var v=(n,e)=>()=>(n&&(e=n(n=0)),e);var Ie=(n,e)=>{for(var t in e)Pe(n,t,{get:e[t],enumerable:!0})};function C(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function pe(n){return j.some(e=>n===e||n.startsWith(e))}function tt(n){if(!n.startsWith(w))throw p.validation(`API key must start with "${w}"`);if(n.length!==se)throw p.validation(`API key must be ${se} characters total (${w} + ${z} hex chars)`);let e=n.slice(w.length);if(!/^[a-f0-9]{64}$/i.test(e))throw p.validation(`API key must contain ${z} hexadecimal characters after "${w}" prefix`)}function nt(n){if(!n.startsWith(P))throw p.validation(`Deploy token must start with "${P}"`);if(n.length!==ae)throw p.validation(`Deploy token must be ${ae} characters total (${P} + ${K} hex chars)`);let e=n.slice(P.length);if(!/^[a-f0-9]{64}$/i.test(e))throw p.validation(`Deploy token must contain ${K} hexadecimal characters after "${P}" prefix`)}function it(n){try{let e=new URL(n);if(!["http:","https:"].includes(e.protocol))throw p.validation("API URL must use http:// or https:// protocol");if(e.pathname!=="/"&&e.pathname!=="")throw p.validation("API URL must not contain a path");if(e.search||e.hash)throw p.validation("API URL must not contain query parameters or fragments")}catch(e){throw C(e)?e:p.validation("API URL must be a valid URL")}}function ot(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}$/i.test(n)}function le(n,e){return n.endsWith(`.${e}`)}function rt(n,e){return!le(n,e)}function st(n,e){return le(n,e)?n.slice(0,-(e.length+1)):null}function at(n,e){return`https://${n}.${e||"shipstatic.com"}`}function pt(n){return`https://${n}`}function ut(n){return!n||n.length===0?null:JSON.stringify(n)}function ft(n){if(n)try{let e=JSON.parse(n);return Array.isArray(e)&&e.length>0?e:void 0}catch{return}}var Xe,Qe,Ze,u,B,p,j,w,z,se,P,K,ae,et,H,N,m,lt,ct,E=v(()=>{"use strict";Xe={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Qe={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},Ze={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"};(function(n){n.Validation="validation_failed",n.NotFound="not_found",n.RateLimit="rate_limit_exceeded",n.Authentication="authentication_failed",n.Business="business_logic_error",n.Api="internal_server_error",n.Network="network_error",n.Cancelled="operation_cancelled",n.File="file_error",n.Config="config_error"})(u||(u={}));B={client:new Set([u.Business,u.Config,u.File,u.Validation]),network:new Set([u.Network]),auth:new Set([u.Authentication])},p=class n extends Error{type;status;details;constructor(e,t,i,s){super(t),this.type=e,this.status=i,this.details=s,this.name="ShipError"}toResponse(){let e=this.type===u.Authentication&&this.details?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:e}}static fromResponse(e){return new n(e.error,e.message,e.status,e.details)}static validation(e,t){return new n(u.Validation,e,400,t)}static notFound(e,t){let i=t?`${e} ${t} not found`:`${e} not found`;return new n(u.NotFound,i,404)}static rateLimit(e="Too many requests"){return new n(u.RateLimit,e,429)}static authentication(e="Authentication required",t){return new n(u.Authentication,e,401,t)}static business(e,t=400){return new n(u.Business,e,t)}static network(e,t){return new n(u.Network,e,void 0,{cause:t})}static cancelled(e){return new n(u.Cancelled,e)}static file(e,t){return new n(u.File,e,void 0,{filePath:t})}static config(e,t){return new n(u.Config,e,void 0,t)}static api(e,t=500){return new n(u.Api,e,t)}static database(e,t=500){return new n(u.Api,e,t)}static storage(e,t=500){return new n(u.Api,e,t)}get filePath(){return this.details?.filePath}isClientError(){return B.client.has(this.type)}isNetworkError(){return B.network.has(this.type)}isAuthError(){return B.auth.has(this.type)}isValidationError(){return this.type===u.Validation}isFileError(){return this.type===u.File}isConfigError(){return this.type===u.Config}isType(e){return this.type===e}};j=["text/html","text/css","text/plain","text/markdown","text/xml","text/csv","text/yaml","text/vtt","text/calendar","text/javascript","text/typescript","text/tsx","text/jsx","text/x-scss","text/x-sass","text/x-less","text/stylus","text/x-vue","text/x-svelte","image/","audio/","video/","font/","application/javascript","application/ecmascript","application/x-javascript","application/wasm","application/json","application/ld+json","application/manifest+json","application/source-map","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/yaml","application/pdf","model/gltf+json","model/gltf-binary","application/mp4","application/font-woff","application/font-woff2","application/x-font-woff","application/x-woff","application/vnd.ms-fontobject","application/x-font-ttf","application/x-font-truetype","application/x-font-otf","application/x-font-opentype"];w="ship-",z=64,se=w.length+z,P="token-",K=64,ae=P.length+K,et={JWT:"jwt",API_KEY:"apiKey",TOKEN:"token",WEBHOOK:"webhook",SYSTEM:"system"},H="ship.json";N="https://api.shipstatic.com",m={PENDING:"pending",PROCESSING_ERROR:"processing_error",EMPTY_FILE:"empty_file",VALIDATION_FAILED:"validation_failed",READY:"ready"};lt={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},ct=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/});function V(n){G=n}function O(){if(G===null)throw p.config("Platform configuration not initialized. The SDK must fetch configuration from the API before performing operations.");return G}var G,$=v(()=>{"use strict";E();G=null});function Oe(n){q=n}function $e(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function T(){return q||$e()}var q,R=v(()=>{"use strict";q=null});async function be(n){let e=(await import("spark-md5")).default;return new Promise((t,i)=>{let o=Math.ceil(n.size/2097152),r=0,a=new e.ArrayBuffer,l=new FileReader,y=()=>{let g=r*2097152,c=Math.min(g+2097152,n.size);l.readAsArrayBuffer(n.slice(g,c))};l.onload=g=>{let c=g.target?.result;if(!c){i(p.business("Failed to read file chunk"));return}a.append(c),r++,r<o?y():t({md5:a.end()})},l.onerror=()=>{i(p.business("Failed to calculate MD5: FileReader error"))},y()})}async function Ne(n){let e=await import("crypto");if(Buffer.isBuffer(n)){let i=e.createHash("md5");return i.update(n),{md5:i.digest("hex")}}let t=await import("fs");return new Promise((i,s)=>{let o=e.createHash("md5"),r=t.createReadStream(n);r.on("error",a=>s(p.business(`Failed to read file for MD5: ${a.message}`))),r.on("data",a=>o.update(a)),r.on("end",()=>i({md5:o.digest("hex")}))})}async function M(n){let e=T();if(e==="browser"){if(!(n instanceof Blob))throw p.business("Invalid input for browser MD5 calculation: Expected Blob or File.");return be(n)}if(e==="node"){if(!(Buffer.isBuffer(n)||typeof n=="string"))throw p.business("Invalid input for Node.js MD5 calculation: Expected Buffer or file path string.");return Ne(n)}throw p.business("Unknown or unsupported execution environment for MD5 calculation.")}var _=v(()=>{"use strict";R();E()});import{z as b}from"zod";function ye(n){try{return Me.parse(n)}catch(e){if(e instanceof b.ZodError){let t=e.issues[0],i=t.path.length>0?` at ${t.path.join(".")}`:"";throw p.config(`Configuration validation failed${i}: ${t.message}`)}throw p.config("Configuration validation failed")}}async function _e(n){try{if(T()!=="node")return{};let{cosmiconfigSync:e}=await import("cosmiconfig"),t=await import("os"),i=e(W,{searchPlaces:[`.${W}rc`,"package.json",`${t.homedir()}/.${W}rc`],stopDir:t.homedir()}),s;if(n?s=i.load(n):s=i.search(),s&&s.config)return ye(s.config)}catch(e){if(C(e))throw e}return{}}async function J(n){if(T()!=="node")return{};let e={apiUrl:process.env.SHIP_API_URL,apiKey:process.env.SHIP_API_KEY,deployToken:process.env.SHIP_DEPLOY_TOKEN},t=await _e(n),i={apiUrl:e.apiUrl??t.apiUrl,apiKey:e.apiKey??t.apiKey,deployToken:e.deployToken??t.deployToken};return ye(i)}var W,Me,X=v(()=>{"use strict";E();R();W="ship",Me=b.object({apiUrl:b.string().url().optional(),apiKey:b.string().optional(),deployToken:b.string().optional()}).strict()});import{isJunk as Le}from"junk";function Se(n){return!n||n.length===0?[]:n.filter(e=>{if(!e)return!1;let t=e.replace(/\\/g,"/").split("/").filter(Boolean);if(t.length===0)return!0;let i=t[t.length-1];if(Le(i))return!1;let s=t.slice(0,-1);for(let o of s)if(Ue.some(r=>o.toLowerCase()===r.toLowerCase()))return!1;return!0})}var Ue,Z=v(()=>{"use strict";Ue=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function xe(n){if(!n||n.length===0)return"";let e=n.filter(o=>o&&typeof o=="string").map(o=>o.replace(/\\/g,"/"));if(e.length===0)return"";if(e.length===1)return e[0];let t=e.map(o=>o.split("/").filter(Boolean)),i=[],s=Math.min(...t.map(o=>o.length));for(let o=0;o<s;o++){let r=t[0][o];if(t.every(a=>a[o]===r))i.push(r);else break}return i.join("/")}function U(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var ee=v(()=>{"use strict"});function Te(n,e={}){if(e.flatten===!1)return n.map(i=>({path:U(i),name:te(i)}));let t=Be(n);return n.map(i=>{let s=U(i);if(t){let o=t.endsWith("/")?t:`${t}/`;s.startsWith(o)&&(s=s.substring(o.length))}return s||(s=te(i)),{path:s,name:te(i)}})}function Be(n){if(!n.length)return"";let t=n.map(o=>U(o)).map(o=>o.split("/")),i=[],s=Math.min(...t.map(o=>o.length));for(let o=0;o<s-1;o++){let r=t[0][o];if(t.every(a=>a[o]===r))i.push(r);else break}return i.join("/")}function te(n){return n.split(/[/\\]/).pop()||n}var ne=v(()=>{"use strict";ee()});var Re={};Ie(Re,{processFilesForNode:()=>Ce});import*as S from"fs";import*as D from"path";function ve(n,e=new Set){let t=[],i=S.realpathSync(n);if(e.has(i))return t;e.add(i);let s=S.readdirSync(n);for(let o of s){let r=D.join(n,o),a=S.statSync(r);if(a.isDirectory()){let l=ve(r,e);t.push(...l)}else a.isFile()&&t.push(r)}return t}async function Ce(n,e={}){if(T()!=="node")throw p.business("processFilesForNode can only be called in Node.js environment.");let t=n.flatMap(d=>{let h=D.resolve(d);try{return S.statSync(h).isDirectory()?ve(h):[h]}catch{throw p.file(`Path does not exist: ${d}`,d)}}),i=[...new Set(t)],s=Se(i);if(s.length===0)return[];let o=n.map(d=>D.resolve(d)),r=xe(o.map(d=>{try{return S.statSync(d).isDirectory()?d:D.dirname(d)}catch{return D.dirname(d)}})),a=s.map(d=>{if(r&&r.length>0){let h=D.relative(r,d);if(h&&typeof h=="string"&&!h.startsWith(".."))return h.replace(/\\/g,"/")}return D.basename(d)}),l=Te(a,{flatten:e.pathDetect!==!1}),y=[],g=0,c=O();for(let d=0;d<s.length;d++){let h=s[d],x=l[d].path;try{let A=S.statSync(h);if(A.size===0)continue;if(A.size>c.maxFileSize)throw p.business(`File ${h} is too large. Maximum allowed size is ${c.maxFileSize/(1024*1024)}MB.`);if(g+=A.size,g>c.maxTotalSize)throw p.business(`Total deploy size is too large. Maximum allowed is ${c.maxTotalSize/(1024*1024)}MB.`);let F=S.readFileSync(h),{md5:we}=await M(F);if(x.includes("\0")||x.includes("/../")||x.startsWith("../")||x.endsWith("/.."))throw p.business(`Security error: Unsafe file path "${x}" for file: ${h}`);y.push({path:x,content:F,size:F.length,md5:we})}catch(A){if(C(A))throw A;let F=A instanceof Error?A.message:String(A);throw p.file(`Failed to read file "${h}": ${F}`,h)}}if(y.length>c.maxFilesCount)throw p.business(`Too many files to deploy. Maximum allowed is ${c.maxFilesCount} files.`);return y}var oe=v(()=>{"use strict";R();_();Z();E();$();ne();ee()});E();var k=class{constructor(){this.handlers=new Map}on(e,t){this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t)}off(e,t){let i=this.handlers.get(e);i&&(i.delete(t),i.size===0&&this.handlers.delete(e))}emit(e,...t){let i=this.handlers.get(e);if(!i)return;let s=Array.from(i);for(let o of s)try{o(...t)}catch(r){i.delete(o),e!=="error"&&setTimeout(()=>{r instanceof Error?this.emit("error",r,String(e)):this.emit("error",new Error(String(r)),String(e))},0)}}transfer(e){this.handlers.forEach((t,i)=>{t.forEach(s=>{e.on(i,s)})})}clear(){this.handlers.clear()}};var f={DEPLOYMENTS:"/deployments",DOMAINS:"/domains",TOKENS:"/tokens",ACCOUNT:"/account",CONFIG:"/config",PING:"/ping",SPA_CHECK:"/spa-check"},Fe=3e4,I=class extends k{constructor(e){super(),this.apiUrl=e.apiUrl||N,this.getAuthHeadersCallback=e.getAuthHeaders,this.timeout=e.timeout??Fe,this.createDeployBody=e.createDeployBody}transferEventsTo(e){this.transfer(e)}async executeRequest(e,t,i){let s=this.mergeHeaders(t.headers),{signal:o,cleanup:r}=this.createTimeoutSignal(t.signal),a={...t,headers:s,credentials:s.Authorization?void 0:"include",signal:o};this.emit("request",e,a);try{let l=await fetch(e,a);return r(),l.ok||await this.handleResponseError(l,i),this.emit("response",this.safeClone(l),e),{data:await this.parseResponse(this.safeClone(l)),status:l.status}}catch(l){r();let y=l instanceof Error?l:new Error(String(l));this.emit("error",y,e),this.handleFetchError(l,i)}}async request(e,t,i){let{data:s}=await this.executeRequest(e,t,i);return s}async requestWithStatus(e,t,i){return this.executeRequest(e,t,i)}mergeHeaders(e={}){return{...e,...this.getAuthHeadersCallback()}}createTimeoutSignal(e){let t=new AbortController,i=setTimeout(()=>t.abort(),this.timeout);if(e){let s=()=>t.abort();e.addEventListener("abort",s),e.aborted&&t.abort()}return{signal:t.signal,cleanup:()=>clearTimeout(i)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async handleResponseError(e,t){let i={};try{if(e.headers.get("content-type")?.includes("application/json")){let r=await e.json();if(r&&typeof r=="object"){let a=r;typeof a.message=="string"&&(i.message=a.message),typeof a.error=="string"&&(i.error=a.error)}}else i={message:await e.text()}}catch{i={message:"Failed to parse error response"}}let s=i.message||i.error||`${t} failed`;throw e.status===401?p.authentication(s):p.api(s,e.status)}handleFetchError(e,t){throw C(e)?e:e instanceof Error&&e.name==="AbortError"?p.cancelled(`${t} was cancelled`):e instanceof TypeError&&e.message.includes("fetch")?p.network(`${t} failed: ${e.message}`,e):e instanceof Error?p.business(`${t} failed: ${e.message}`):p.business(`${t} failed: Unknown error`)}async deploy(e,t={}){if(!e.length)throw p.business("No files to deploy");for(let r of e)if(!r.md5)throw p.file(`MD5 checksum missing for file: ${r.path}`,r.path);let{body:i,headers:s}=await this.createDeployBody(e,t.tags,t.via),o={};return t.deployToken?o.Authorization=`Bearer ${t.deployToken}`:t.apiKey&&(o.Authorization=`Bearer ${t.apiKey}`),t.caller&&(o["X-Caller"]=t.caller),this.request(`${t.apiUrl||this.apiUrl}${f.DEPLOYMENTS}`,{method:"POST",body:i,headers:{...s,...o},signal:t.signal||null},"Deploy")}async listDeployments(){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"GET"},"Get deployment")}async updateDeploymentTags(e,t){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:t})},"Update deployment tags")}async removeDeployment(e){await this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove deployment")}async setDomain(e,t,i){let s={};t&&(s.deployment=t),i!==void 0&&(s.tags=i);let{data:o,status:r}=await this.requestWithStatus(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"Set domain");return{...o,isCreate:r===201}}async listDomains(){return this.request(`${this.apiUrl}${f.DOMAINS}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"GET"},"Get domain")}async updateDomainTags(e,t){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:t})},"Update domain tags")}async removeDomain(e){await this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/verify`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/dns`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/records`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/share`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,t){let i={};return e!==void 0&&(i.ttl=e),t!==void 0&&(i.tags=t),this.request(`${this.apiUrl}${f.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},"Create token")}async listTokens(){return this.request(`${this.apiUrl}${f.TOKENS}`,{method:"GET"},"List tokens")}async removeToken(e){await this.request(`${this.apiUrl}${f.TOKENS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove token")}async getAccount(){return this.request(`${this.apiUrl}${f.ACCOUNT}`,{method:"GET"},"Get account")}async getConfig(){return this.request(`${this.apiUrl}${f.CONFIG}`,{method:"GET"},"Get config")}async ping(){return(await this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping"))?.success||!1}async getPingResponse(){return this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping")}async checkSPA(e){let t=e.find(r=>r.path==="index.html"||r.path==="/index.html");if(!t||t.size>100*1024)return!1;let i;if(typeof Buffer<"u"&&Buffer.isBuffer(t.content))i=t.content.toString("utf-8");else if(typeof Blob<"u"&&t.content instanceof Blob)i=await t.content.text();else if(typeof File<"u"&&t.content instanceof File)i=await t.content.text();else return!1;let s={files:e.map(r=>r.path),index:i};return(await this.request(`${this.apiUrl}${f.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"SPA check")).isSPA}};E();$();E();E();function Y(n={},e={}){let t={apiUrl:n.apiUrl||e.apiUrl||N,apiKey:n.apiKey!==void 0?n.apiKey:e.apiKey,deployToken:n.deployToken!==void 0?n.deployToken:e.deployToken},i={apiUrl:t.apiUrl};return t.apiKey!==void 0&&(i.apiKey=t.apiKey),t.deployToken!==void 0&&(i.deployToken=t.deployToken),i}function ce(n,e){let t={...n};return t.apiUrl===void 0&&e.apiUrl!==void 0&&(t.apiUrl=e.apiUrl),t.apiKey===void 0&&e.apiKey!==void 0&&(t.apiKey=e.apiKey),t.deployToken===void 0&&e.deployToken!==void 0&&(t.deployToken=e.deployToken),t.timeout===void 0&&e.timeout!==void 0&&(t.timeout=e.timeout),t.maxConcurrency===void 0&&e.maxConcurrency!==void 0&&(t.maxConcurrency=e.maxConcurrency),t.onProgress===void 0&&e.onProgress!==void 0&&(t.onProgress=e.onProgress),t.caller===void 0&&e.caller!==void 0&&(t.caller=e.caller),t}E();_();async function ke(){let e=JSON.stringify({rewrites:[{source:"/(.*)",destination:"/index.html"}]},null,2),t;typeof Buffer<"u"?t=Buffer.from(e,"utf-8"):t=new Blob([e],{type:"application/json"});let{md5:i}=await M(t);return{path:H,content:t,size:e.length,md5:i}}async function ue(n,e,t){if(t.spaDetect===!1||n.some(i=>i.path===H))return n;try{if(await e.checkSPA(n)){let s=await ke();return[...n,s]}}catch{}return n}function fe(n){let{getApi:e,ensureInit:t,processInput:i,clientDefaults:s,hasAuth:o}=n;return{create:async(r,a={})=>{await t();let l=s?ce(a,s):a;if(o&&!o()&&!l.deployToken&&!l.apiKey)throw p.authentication("Authentication credentials are required for deployment. Please call setDeployToken() or setApiKey() first, or pass credentials in the deployment options.");if(!i)throw p.config("processInput function is not provided.");let y=e(),g=await i(r,l);return g=await ue(g,y,l),y.deploy(g,l)},list:async()=>(await t(),e().listDeployments()),get:async r=>(await t(),e().getDeployment(r)),set:async(r,a)=>(await t(),e().updateDeploymentTags(r,a.tags)),remove:async r=>{await t(),await e().removeDeployment(r)}}}function de(n){let{getApi:e,ensureInit:t}=n;return{set:async(i,s={})=>{await t();let{deployment:o,tags:r}=s;return o===void 0&&r&&r.length>0?e().updateDomainTags(i,r):e().setDomain(i,o,r)},list:async()=>(await t(),e().listDomains()),get:async i=>(await t(),e().getDomain(i)),remove:async i=>{await t(),await e().removeDomain(i)},verify:async i=>(await t(),e().verifyDomain(i)),validate:async i=>(await t(),e().validateDomain(i)),dns:async i=>(await t(),e().getDomainDns(i)),records:async i=>(await t(),e().getDomainRecords(i)),share:async i=>(await t(),e().getDomainShare(i))}}function me(n){let{getApi:e,ensureInit:t}=n;return{get:async()=>(await t(),e().getAccount())}}function he(n){let{getApi:e,ensureInit:t}=n;return{create:async(i={})=>(await t(),e().createToken(i.ttl,i.tags)),list:async()=>(await t(),e().listTokens()),remove:async i=>{await t(),await e().removeToken(i)}}}var L=class{constructor(e={}){this.initPromise=null;this._config=null;this.auth=null;this.clientOptions=e,e.deployToken?this.auth={type:"token",value:e.deployToken}:e.apiKey&&(this.auth={type:"apiKey",value:e.apiKey}),this.authHeadersCallback=()=>this.getAuthHeaders();let t=this.resolveInitialConfig(e);this.http=new I({...e,...t,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});let i={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this._deployments=fe({...i,processInput:(s,o)=>this.processInput(s,o),clientDefaults:this.clientOptions,hasAuth:()=>this.hasAuth()}),this._domains=de(i),this._account=me(i),this._tokens=he(i)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.loadFullConfig()),this.initPromise}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(e,t){return this.deployments.create(e,t)}async whoami(){return this.account.get()}get deployments(){return this._deployments}get domains(){return this._domains}get account(){return this._account}get tokens(){return this._tokens}async getConfig(){return this._config?this._config:(await this.ensureInitialized(),this._config=O(),this._config)}on(e,t){this.http.on(e,t)}off(e,t){this.http.off(e,t)}replaceHttpClient(e){if(this.http?.transferEventsTo)try{this.http.transferEventsTo(e)}catch(t){console.warn("Event transfer failed during client replacement:",t)}this.http=e}setDeployToken(e){if(!e||typeof e!="string")throw p.business("Invalid deploy token provided. Deploy token must be a non-empty string.");this.auth={type:"token",value:e}}setApiKey(e){if(!e||typeof e!="string")throw p.business("Invalid API key provided. API key must be a non-empty string.");this.auth={type:"apiKey",value:e}}getAuthHeaders(){return this.auth?{Authorization:`Bearer ${this.auth.value}`}:{}}hasAuth(){return this.clientOptions.useCredentials?!0:this.auth!==null}};E();R();X();$();E();import ge from"mime-db";var Q={};for(let n in ge){let e=ge[n];e&&e.extensions&&e.extensions.forEach(t=>{Q[t]||(Q[t]=n)})}function Ee(n){let e=n.includes(".")?n.substring(n.lastIndexOf(".")+1).toLowerCase():"";return Q[e]||"application/octet-stream"}async function De(n,e,t){let{FormData:i,File:s}=await import("formdata-node"),{FormDataEncoder:o}=await import("form-data-encoder"),r=new i,a=[];for(let c of n){let d=Ee(c.path),h;if(Buffer.isBuffer(c.content))h=new s([c.content],c.path,{type:d});else if(typeof Blob<"u"&&c.content instanceof Blob)h=new s([c.content],c.path,{type:d});else throw p.file(`Unsupported file.content type for Node.js: ${c.path}`,c.path);if(!c.md5)throw p.file(`File missing md5 checksum: ${c.path}`,c.path);let x=c.path.startsWith("/")?c.path:"/"+c.path;r.append("files[]",h,x),a.push(c.md5)}r.append("checksums",JSON.stringify(a)),e&&e.length>0&&r.append("tags",JSON.stringify(e)),t&&r.append("via",t);let l=new o(r),y=[];for await(let c of l.encode())y.push(Buffer.from(c));let g=Buffer.concat(y);return{body:g.buffer.slice(g.byteOffset,g.byteOffset+g.byteLength),headers:{"Content-Type":l.contentType,"Content-Length":Buffer.byteLength(g).toString()}}}_();function qt(n,e,t,i=!0){let s=n===1?e:t;return i?`${n} ${s}`:s}Z();ne();R();E();import ze from"mime-db";var Ae=ze,Ke=new Set(Object.keys(Ae)),je=new Map(Object.entries(Ae).filter(([n,e])=>e.extensions).map(([n,e])=>[n,new Set(e.extensions)]));var He=[[/File name cannot|Invalid file name|File name contains|File name uses|traversal/i,"Invalid File Name"],[/File size must be positive/i,"Invalid File Size"],[/MIME type is required/i,"Missing MIME Type"],[/Invalid MIME type/i,"Invalid MIME Type"],[/not allowed/i,"Invalid File Type"],[/extension does not match/i,"Extension Mismatch"],[/Total size/i,"Total Size Exceeded"],[/exceeds limit/i,"File Too Large"]];function Ge(n,e){if(n===m.PROCESSING_ERROR)return"Processing Error";if(n===m.EMPTY_FILE)return"Empty File";if(!e)return"Validation Failed";for(let[t,i]of He)if(t.test(e))return i;return"Validation Failed"}function ie(n,e=1){if(n===0)return"0 Bytes";let t=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(n)/Math.log(t));return parseFloat((n/Math.pow(t,s)).toFixed(e))+" "+i[s]}function Ve(n){if(/[?&#%<>\[\]{}|\\^~`;$()'"*\r\n\t]/.test(n))return{valid:!1,reason:"File name contains unsafe characters"};if(n.startsWith(" ")||n.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(n.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,i=n.split("/").pop()||n;return t.test(i)?{valid:!1,reason:"File name uses a reserved system name"}:n.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function qe(n,e){if(n.startsWith("."))return!0;let t=n.toLowerCase().split(".");if(t.length>1&&t[t.length-1]){let i=t[t.length-1],s=je.get(e);if(s&&!s.has(i))return!1}return!0}function nn(n,e){let t=[],i=[];if(n.length===0){let o="At least one file must be provided";return{files:[],validFiles:[],error:{error:"No Files Provided",details:o,errors:[o],isClientError:!0}}}if(n.length>e.maxFilesCount){let o=`Number of files (${n.length}) exceeds the limit of ${e.maxFilesCount}.`;return{files:n.map(r=>({...r,status:m.VALIDATION_FAILED,statusMessage:o})),validFiles:[],error:{error:"File Count Exceeded",details:o,errors:[o],isClientError:!0}}}let s=0;for(let o of n){let r=m.READY,a="Ready for upload",l=o.name?Ve(o.name):{valid:!1,reason:"File name cannot be empty"};o.status===m.PROCESSING_ERROR?(r=m.PROCESSING_ERROR,a=o.statusMessage||"A file failed during processing.",t.push(`${o.name}: ${a}`)):!o.name||o.name.trim().length===0?(r=m.VALIDATION_FAILED,a="File name cannot be empty",t.push(`${o.name||"(empty)"}: ${a}`)):o.name.includes("\0")?(r=m.VALIDATION_FAILED,a="File name contains invalid characters (null byte)",t.push(`${o.name}: ${a}`)):l.valid?o.size<=0?(r=m.EMPTY_FILE,a=o.size===0?"File is empty (0 bytes)":"File size must be positive",t.push(`${o.name}: ${a}`)):!o.type||o.type.trim().length===0?(r=m.VALIDATION_FAILED,a="File MIME type is required",t.push(`${o.name}: ${a}`)):pe(o.type)?!j.some(y=>o.type===y)&&!Ke.has(o.type)?(r=m.VALIDATION_FAILED,a=`Invalid MIME type "${o.type}"`,t.push(`${o.name}: ${a}`)):qe(o.name,o.type)?o.size>e.maxFileSize?(r=m.VALIDATION_FAILED,a=`File size (${ie(o.size)}) exceeds limit of ${ie(e.maxFileSize)}`,t.push(`${o.name}: ${a}`)):(s+=o.size,s>e.maxTotalSize&&(r=m.VALIDATION_FAILED,a=`Total size would exceed limit of ${ie(e.maxTotalSize)}`,t.push(`${o.name}: ${a}`))):(r=m.VALIDATION_FAILED,a="File extension does not match MIME type",t.push(`${o.name}: ${a}`)):(r=m.VALIDATION_FAILED,a=`File type "${o.type}" is not allowed`,t.push(`${o.name}: ${a}`)):(r=m.VALIDATION_FAILED,a=l.reason||"Invalid file name",t.push(`${o.name}: ${a}`)),i.push({...o,status:r,statusMessage:a})}if(t.length>0){let o=i.find(a=>a.status!==m.READY&&a.status!==m.PENDING),r=Ge(o?.status,o?.statusMessage);return{files:i.map(a=>({...a,status:m.VALIDATION_FAILED})),validFiles:[],error:{error:r,details:t.length===1?t[0]:`${t.length} file(s) failed validation`,errors:t,isClientError:!0}}}return{files:i,validFiles:i,error:null}}function Ye(n){return n.filter(e=>e.status===m.READY)}function on(n){return Ye(n).length>0}E();X();$();oe();R();var re=class extends L{constructor(e={}){if(T()!=="node")throw p.business("Node.js Ship class can only be used in Node.js environment.");super(e)}resolveInitialConfig(e){return Y(e,{})}async loadFullConfig(){try{let e=await J(this.clientOptions.configFile),t=Y(this.clientOptions,e);t.deployToken&&!this.clientOptions.deployToken?this.setDeployToken(t.deployToken):t.apiKey&&!this.clientOptions.apiKey&&this.setApiKey(t.apiKey);let i=new I({...this.clientOptions,...t,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});this.replaceHttpClient(i);let s=await this.http.getConfig();V(s)}catch(e){throw this.initPromise=null,e}}async processInput(e,t){let i=typeof e=="string"?[e]:e;if(!Array.isArray(i)||!i.every(o=>typeof o=="string"))throw p.business("Invalid input type for Node.js environment. Expected string or string[].");if(i.length===0)throw p.business("No files to deploy.");let{processFilesForNode:s}=await Promise.resolve().then(()=>(oe(),Re));return s(i,t)}getDeployBodyCreator(){return De}},We=re;export{j as ALLOWED_MIME_TYPES,z as API_KEY_HEX_LENGTH,w as API_KEY_PREFIX,se as API_KEY_TOTAL_LENGTH,Ze as AccountPlan,I as ApiHttp,et as AuthMethod,N as DEFAULT_API,H as DEPLOYMENT_CONFIG_FILENAME,K as DEPLOY_TOKEN_HEX_LENGTH,P as DEPLOY_TOKEN_PREFIX,ae as DEPLOY_TOKEN_TOTAL_LENGTH,Xe as DeploymentStatus,Qe as DomainStatus,u as ErrorType,m as FILE_VALIDATION_STATUS,m as FileValidationStatus,Ue as JUNK_DIRECTORIES,re as Ship,p as ShipError,lt as TAG_CONSTRAINTS,ct as TAG_PATTERN,Oe as __setTestEnvironment,on as allValidFilesReady,M as calculateMD5,me as createAccountResource,fe as createDeploymentResource,de as createDomainResource,he as createTokenResource,We as default,ft as deserializeTags,st as extractSubdomain,Se as filterJunk,ie as formatFileSize,at as generateDeploymentUrl,pt as generateDomainUrl,O as getCurrentConfig,T as getENV,Ye as getValidFiles,pe as isAllowedMimeType,rt as isCustomDomain,ot as isDeployment,le as isPlatformDomain,C as isShipError,J as loadConfig,ce as mergeDeployOptions,Te as optimizeDeployPaths,qt as pluralize,Ce as processFilesForNode,Y as resolveConfig,ut as serializeTags,V as setPlatformConfig,tt as validateApiKey,it as validateApiUrl,nt as validateDeployToken,nn as validateFiles};
|
|
1
|
+
var Pe=Object.defineProperty;var v=(n,e)=>()=>(n&&(e=n(n=0)),e);var Ie=(n,e)=>{for(var t in e)Pe(n,t,{get:e[t],enumerable:!0})};function C(n){return n!==null&&typeof n=="object"&&"name"in n&&n.name==="ShipError"&&"status"in n}function pe(n){return j.some(e=>n===e||n.startsWith(e))}function tt(n){if(!n.startsWith(w))throw p.validation(`API key must start with "${w}"`);if(n.length!==se)throw p.validation(`API key must be ${se} characters total (${w} + ${z} hex chars)`);let e=n.slice(w.length);if(!/^[a-f0-9]{64}$/i.test(e))throw p.validation(`API key must contain ${z} hexadecimal characters after "${w}" prefix`)}function nt(n){if(!n.startsWith(P))throw p.validation(`Deploy token must start with "${P}"`);if(n.length!==ae)throw p.validation(`Deploy token must be ${ae} characters total (${P} + ${K} hex chars)`);let e=n.slice(P.length);if(!/^[a-f0-9]{64}$/i.test(e))throw p.validation(`Deploy token must contain ${K} hexadecimal characters after "${P}" prefix`)}function it(n){try{let e=new URL(n);if(!["http:","https:"].includes(e.protocol))throw p.validation("API URL must use http:// or https:// protocol");if(e.pathname!=="/"&&e.pathname!=="")throw p.validation("API URL must not contain a path");if(e.search||e.hash)throw p.validation("API URL must not contain query parameters or fragments")}catch(e){throw C(e)?e:p.validation("API URL must be a valid URL")}}function ot(n){return/^[a-z]+-[a-z]+-[a-z0-9]{7}$/i.test(n)}function le(n,e){return n.endsWith(`.${e}`)}function rt(n,e){return!le(n,e)}function st(n,e){return le(n,e)?n.slice(0,-(e.length+1)):null}function at(n,e){return`https://${n}.${e||"shipstatic.com"}`}function pt(n){return`https://${n}`}function ut(n){return!n||n.length===0?null:JSON.stringify(n)}function ft(n){if(n)try{let e=JSON.parse(n);return Array.isArray(e)&&e.length>0?e:void 0}catch{return}}var Xe,Qe,Ze,u,B,p,j,w,z,se,P,K,ae,et,H,N,m,lt,ct,E=v(()=>{"use strict";Xe={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Qe={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},Ze={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"};(function(n){n.Validation="validation_failed",n.NotFound="not_found",n.RateLimit="rate_limit_exceeded",n.Authentication="authentication_failed",n.Business="business_logic_error",n.Api="internal_server_error",n.Network="network_error",n.Cancelled="operation_cancelled",n.File="file_error",n.Config="config_error"})(u||(u={}));B={client:new Set([u.Business,u.Config,u.File,u.Validation]),network:new Set([u.Network]),auth:new Set([u.Authentication])},p=class n extends Error{type;status;details;constructor(e,t,i,s){super(t),this.type=e,this.status=i,this.details=s,this.name="ShipError"}toResponse(){let e=this.type===u.Authentication&&this.details?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:e}}static fromResponse(e){return new n(e.error,e.message,e.status,e.details)}static validation(e,t){return new n(u.Validation,e,400,t)}static notFound(e,t){let i=t?`${e} ${t} not found`:`${e} not found`;return new n(u.NotFound,i,404)}static rateLimit(e="Too many requests"){return new n(u.RateLimit,e,429)}static authentication(e="Authentication required",t){return new n(u.Authentication,e,401,t)}static business(e,t=400){return new n(u.Business,e,t)}static network(e,t){return new n(u.Network,e,void 0,{cause:t})}static cancelled(e){return new n(u.Cancelled,e)}static file(e,t){return new n(u.File,e,void 0,{filePath:t})}static config(e,t){return new n(u.Config,e,void 0,t)}static api(e,t=500){return new n(u.Api,e,t)}static database(e,t=500){return new n(u.Api,e,t)}static storage(e,t=500){return new n(u.Api,e,t)}get filePath(){return this.details?.filePath}isClientError(){return B.client.has(this.type)}isNetworkError(){return B.network.has(this.type)}isAuthError(){return B.auth.has(this.type)}isValidationError(){return this.type===u.Validation}isFileError(){return this.type===u.File}isConfigError(){return this.type===u.Config}isType(e){return this.type===e}};j=["text/html","text/css","text/plain","text/markdown","text/xml","text/csv","text/yaml","text/vtt","text/calendar","text/javascript","text/typescript","text/tsx","text/jsx","text/x-scss","text/x-sass","text/x-less","text/stylus","text/x-vue","text/x-svelte","image/","audio/","video/","font/","application/javascript","application/ecmascript","application/x-javascript","application/wasm","application/json","application/ld+json","application/manifest+json","application/source-map","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/yaml","application/toml","application/pdf","model/gltf+json","model/gltf-binary","application/mp4","application/font-woff","application/font-woff2","application/x-font-woff","application/x-woff","application/vnd.ms-fontobject","application/x-font-ttf","application/x-font-truetype","application/x-font-otf","application/x-font-opentype"];w="ship-",z=64,se=w.length+z,P="token-",K=64,ae=P.length+K,et={JWT:"jwt",API_KEY:"apiKey",TOKEN:"token",WEBHOOK:"webhook",SYSTEM:"system"},H="ship.json";N="https://api.shipstatic.com",m={PENDING:"pending",PROCESSING_ERROR:"processing_error",EMPTY_FILE:"empty_file",VALIDATION_FAILED:"validation_failed",READY:"ready"};lt={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},ct=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/});function V(n){G=n}function O(){if(G===null)throw p.config("Platform configuration not initialized. The SDK must fetch configuration from the API before performing operations.");return G}var G,$=v(()=>{"use strict";E();G=null});function Oe(n){q=n}function $e(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function T(){return q||$e()}var q,R=v(()=>{"use strict";q=null});async function be(n){let e=(await import("spark-md5")).default;return new Promise((t,i)=>{let o=Math.ceil(n.size/2097152),r=0,a=new e.ArrayBuffer,l=new FileReader,y=()=>{let g=r*2097152,c=Math.min(g+2097152,n.size);l.readAsArrayBuffer(n.slice(g,c))};l.onload=g=>{let c=g.target?.result;if(!c){i(p.business("Failed to read file chunk"));return}a.append(c),r++,r<o?y():t({md5:a.end()})},l.onerror=()=>{i(p.business("Failed to calculate MD5: FileReader error"))},y()})}async function Ne(n){let e=await import("crypto");if(Buffer.isBuffer(n)){let i=e.createHash("md5");return i.update(n),{md5:i.digest("hex")}}let t=await import("fs");return new Promise((i,s)=>{let o=e.createHash("md5"),r=t.createReadStream(n);r.on("error",a=>s(p.business(`Failed to read file for MD5: ${a.message}`))),r.on("data",a=>o.update(a)),r.on("end",()=>i({md5:o.digest("hex")}))})}async function M(n){let e=T();if(e==="browser"){if(!(n instanceof Blob))throw p.business("Invalid input for browser MD5 calculation: Expected Blob or File.");return be(n)}if(e==="node"){if(!(Buffer.isBuffer(n)||typeof n=="string"))throw p.business("Invalid input for Node.js MD5 calculation: Expected Buffer or file path string.");return Ne(n)}throw p.business("Unknown or unsupported execution environment for MD5 calculation.")}var _=v(()=>{"use strict";R();E()});import{z as b}from"zod";function ye(n){try{return Me.parse(n)}catch(e){if(e instanceof b.ZodError){let t=e.issues[0],i=t.path.length>0?` at ${t.path.join(".")}`:"";throw p.config(`Configuration validation failed${i}: ${t.message}`)}throw p.config("Configuration validation failed")}}async function _e(n){try{if(T()!=="node")return{};let{cosmiconfigSync:e}=await import("cosmiconfig"),t=await import("os"),i=e(W,{searchPlaces:[`.${W}rc`,"package.json",`${t.homedir()}/.${W}rc`],stopDir:t.homedir()}),s;if(n?s=i.load(n):s=i.search(),s&&s.config)return ye(s.config)}catch(e){if(C(e))throw e}return{}}async function J(n){if(T()!=="node")return{};let e={apiUrl:process.env.SHIP_API_URL,apiKey:process.env.SHIP_API_KEY,deployToken:process.env.SHIP_DEPLOY_TOKEN},t=await _e(n),i={apiUrl:e.apiUrl??t.apiUrl,apiKey:e.apiKey??t.apiKey,deployToken:e.deployToken??t.deployToken};return ye(i)}var W,Me,X=v(()=>{"use strict";E();R();W="ship",Me=b.object({apiUrl:b.string().url().optional(),apiKey:b.string().optional(),deployToken:b.string().optional()}).strict()});import{isJunk as Le}from"junk";function Se(n){return!n||n.length===0?[]:n.filter(e=>{if(!e)return!1;let t=e.replace(/\\/g,"/").split("/").filter(Boolean);if(t.length===0)return!0;let i=t[t.length-1];if(Le(i))return!1;let s=t.slice(0,-1);for(let o of s)if(Ue.some(r=>o.toLowerCase()===r.toLowerCase()))return!1;return!0})}var Ue,Z=v(()=>{"use strict";Ue=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function xe(n){if(!n||n.length===0)return"";let e=n.filter(o=>o&&typeof o=="string").map(o=>o.replace(/\\/g,"/"));if(e.length===0)return"";if(e.length===1)return e[0];let t=e.map(o=>o.split("/").filter(Boolean)),i=[],s=Math.min(...t.map(o=>o.length));for(let o=0;o<s;o++){let r=t[0][o];if(t.every(a=>a[o]===r))i.push(r);else break}return i.join("/")}function U(n){return n.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var ee=v(()=>{"use strict"});function Te(n,e={}){if(e.flatten===!1)return n.map(i=>({path:U(i),name:te(i)}));let t=Be(n);return n.map(i=>{let s=U(i);if(t){let o=t.endsWith("/")?t:`${t}/`;s.startsWith(o)&&(s=s.substring(o.length))}return s||(s=te(i)),{path:s,name:te(i)}})}function Be(n){if(!n.length)return"";let t=n.map(o=>U(o)).map(o=>o.split("/")),i=[],s=Math.min(...t.map(o=>o.length));for(let o=0;o<s-1;o++){let r=t[0][o];if(t.every(a=>a[o]===r))i.push(r);else break}return i.join("/")}function te(n){return n.split(/[/\\]/).pop()||n}var ne=v(()=>{"use strict";ee()});var Re={};Ie(Re,{processFilesForNode:()=>Ce});import*as S from"fs";import*as D from"path";function ve(n,e=new Set){let t=[],i=S.realpathSync(n);if(e.has(i))return t;e.add(i);let s=S.readdirSync(n);for(let o of s){let r=D.join(n,o),a=S.statSync(r);if(a.isDirectory()){let l=ve(r,e);t.push(...l)}else a.isFile()&&t.push(r)}return t}async function Ce(n,e={}){if(T()!=="node")throw p.business("processFilesForNode can only be called in Node.js environment.");let t=n.flatMap(d=>{let h=D.resolve(d);try{return S.statSync(h).isDirectory()?ve(h):[h]}catch{throw p.file(`Path does not exist: ${d}`,d)}}),i=[...new Set(t)],s=Se(i);if(s.length===0)return[];let o=n.map(d=>D.resolve(d)),r=xe(o.map(d=>{try{return S.statSync(d).isDirectory()?d:D.dirname(d)}catch{return D.dirname(d)}})),a=s.map(d=>{if(r&&r.length>0){let h=D.relative(r,d);if(h&&typeof h=="string"&&!h.startsWith(".."))return h.replace(/\\/g,"/")}return D.basename(d)}),l=Te(a,{flatten:e.pathDetect!==!1}),y=[],g=0,c=O();for(let d=0;d<s.length;d++){let h=s[d],x=l[d].path;try{let A=S.statSync(h);if(A.size===0)continue;if(A.size>c.maxFileSize)throw p.business(`File ${h} is too large. Maximum allowed size is ${c.maxFileSize/(1024*1024)}MB.`);if(g+=A.size,g>c.maxTotalSize)throw p.business(`Total deploy size is too large. Maximum allowed is ${c.maxTotalSize/(1024*1024)}MB.`);let F=S.readFileSync(h),{md5:we}=await M(F);if(x.includes("\0")||x.includes("/../")||x.startsWith("../")||x.endsWith("/.."))throw p.business(`Security error: Unsafe file path "${x}" for file: ${h}`);y.push({path:x,content:F,size:F.length,md5:we})}catch(A){if(C(A))throw A;let F=A instanceof Error?A.message:String(A);throw p.file(`Failed to read file "${h}": ${F}`,h)}}if(y.length>c.maxFilesCount)throw p.business(`Too many files to deploy. Maximum allowed is ${c.maxFilesCount} files.`);return y}var oe=v(()=>{"use strict";R();_();Z();E();$();ne();ee()});E();var k=class{constructor(){this.handlers=new Map}on(e,t){this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t)}off(e,t){let i=this.handlers.get(e);i&&(i.delete(t),i.size===0&&this.handlers.delete(e))}emit(e,...t){let i=this.handlers.get(e);if(!i)return;let s=Array.from(i);for(let o of s)try{o(...t)}catch(r){i.delete(o),e!=="error"&&setTimeout(()=>{r instanceof Error?this.emit("error",r,String(e)):this.emit("error",new Error(String(r)),String(e))},0)}}transfer(e){this.handlers.forEach((t,i)=>{t.forEach(s=>{e.on(i,s)})})}clear(){this.handlers.clear()}};var f={DEPLOYMENTS:"/deployments",DOMAINS:"/domains",TOKENS:"/tokens",ACCOUNT:"/account",CONFIG:"/config",PING:"/ping",SPA_CHECK:"/spa-check"},Fe=3e4,I=class extends k{constructor(e){super(),this.apiUrl=e.apiUrl||N,this.getAuthHeadersCallback=e.getAuthHeaders,this.timeout=e.timeout??Fe,this.createDeployBody=e.createDeployBody}transferEventsTo(e){this.transfer(e)}async executeRequest(e,t,i){let s=this.mergeHeaders(t.headers),{signal:o,cleanup:r}=this.createTimeoutSignal(t.signal),a={...t,headers:s,credentials:s.Authorization?void 0:"include",signal:o};this.emit("request",e,a);try{let l=await fetch(e,a);return r(),l.ok||await this.handleResponseError(l,i),this.emit("response",this.safeClone(l),e),{data:await this.parseResponse(this.safeClone(l)),status:l.status}}catch(l){r();let y=l instanceof Error?l:new Error(String(l));this.emit("error",y,e),this.handleFetchError(l,i)}}async request(e,t,i){let{data:s}=await this.executeRequest(e,t,i);return s}async requestWithStatus(e,t,i){return this.executeRequest(e,t,i)}mergeHeaders(e={}){return{...e,...this.getAuthHeadersCallback()}}createTimeoutSignal(e){let t=new AbortController,i=setTimeout(()=>t.abort(),this.timeout);if(e){let s=()=>t.abort();e.addEventListener("abort",s),e.aborted&&t.abort()}return{signal:t.signal,cleanup:()=>clearTimeout(i)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async handleResponseError(e,t){let i={};try{if(e.headers.get("content-type")?.includes("application/json")){let r=await e.json();if(r&&typeof r=="object"){let a=r;typeof a.message=="string"&&(i.message=a.message),typeof a.error=="string"&&(i.error=a.error)}}else i={message:await e.text()}}catch{i={message:"Failed to parse error response"}}let s=i.message||i.error||`${t} failed`;throw e.status===401?p.authentication(s):p.api(s,e.status)}handleFetchError(e,t){throw C(e)?e:e instanceof Error&&e.name==="AbortError"?p.cancelled(`${t} was cancelled`):e instanceof TypeError&&e.message.includes("fetch")?p.network(`${t} failed: ${e.message}`,e):e instanceof Error?p.business(`${t} failed: ${e.message}`):p.business(`${t} failed: Unknown error`)}async deploy(e,t={}){if(!e.length)throw p.business("No files to deploy");for(let r of e)if(!r.md5)throw p.file(`MD5 checksum missing for file: ${r.path}`,r.path);let{body:i,headers:s}=await this.createDeployBody(e,t.tags,t.via),o={};return t.deployToken?o.Authorization=`Bearer ${t.deployToken}`:t.apiKey&&(o.Authorization=`Bearer ${t.apiKey}`),t.caller&&(o["X-Caller"]=t.caller),this.request(`${t.apiUrl||this.apiUrl}${f.DEPLOYMENTS}`,{method:"POST",body:i,headers:{...s,...o},signal:t.signal||null},"Deploy")}async listDeployments(){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"GET"},"Get deployment")}async updateDeploymentTags(e,t){return this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:t})},"Update deployment tags")}async removeDeployment(e){await this.request(`${this.apiUrl}${f.DEPLOYMENTS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove deployment")}async setDomain(e,t,i){let s={};t&&(s.deployment=t),i!==void 0&&(s.tags=i);let{data:o,status:r}=await this.requestWithStatus(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"Set domain");return{...o,isCreate:r===201}}async listDomains(){return this.request(`${this.apiUrl}${f.DOMAINS}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"GET"},"Get domain")}async updateDomainTags(e,t){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:t})},"Update domain tags")}async removeDomain(e){await this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/verify`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/dns`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/records`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${f.DOMAINS}/${encodeURIComponent(e)}/share`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${f.DOMAINS}/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,t){let i={};return e!==void 0&&(i.ttl=e),t!==void 0&&(i.tags=t),this.request(`${this.apiUrl}${f.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)},"Create token")}async listTokens(){return this.request(`${this.apiUrl}${f.TOKENS}`,{method:"GET"},"List tokens")}async removeToken(e){await this.request(`${this.apiUrl}${f.TOKENS}/${encodeURIComponent(e)}`,{method:"DELETE"},"Remove token")}async getAccount(){return this.request(`${this.apiUrl}${f.ACCOUNT}`,{method:"GET"},"Get account")}async getConfig(){return this.request(`${this.apiUrl}${f.CONFIG}`,{method:"GET"},"Get config")}async ping(){return(await this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping"))?.success||!1}async getPingResponse(){return this.request(`${this.apiUrl}${f.PING}`,{method:"GET"},"Ping")}async checkSPA(e){let t=e.find(r=>r.path==="index.html"||r.path==="/index.html");if(!t||t.size>100*1024)return!1;let i;if(typeof Buffer<"u"&&Buffer.isBuffer(t.content))i=t.content.toString("utf-8");else if(typeof Blob<"u"&&t.content instanceof Blob)i=await t.content.text();else if(typeof File<"u"&&t.content instanceof File)i=await t.content.text();else return!1;let s={files:e.map(r=>r.path),index:i};return(await this.request(`${this.apiUrl}${f.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)},"SPA check")).isSPA}};E();$();E();E();function Y(n={},e={}){let t={apiUrl:n.apiUrl||e.apiUrl||N,apiKey:n.apiKey!==void 0?n.apiKey:e.apiKey,deployToken:n.deployToken!==void 0?n.deployToken:e.deployToken},i={apiUrl:t.apiUrl};return t.apiKey!==void 0&&(i.apiKey=t.apiKey),t.deployToken!==void 0&&(i.deployToken=t.deployToken),i}function ce(n,e){let t={...n};return t.apiUrl===void 0&&e.apiUrl!==void 0&&(t.apiUrl=e.apiUrl),t.apiKey===void 0&&e.apiKey!==void 0&&(t.apiKey=e.apiKey),t.deployToken===void 0&&e.deployToken!==void 0&&(t.deployToken=e.deployToken),t.timeout===void 0&&e.timeout!==void 0&&(t.timeout=e.timeout),t.maxConcurrency===void 0&&e.maxConcurrency!==void 0&&(t.maxConcurrency=e.maxConcurrency),t.onProgress===void 0&&e.onProgress!==void 0&&(t.onProgress=e.onProgress),t.caller===void 0&&e.caller!==void 0&&(t.caller=e.caller),t}E();_();async function ke(){let e=JSON.stringify({rewrites:[{source:"/(.*)",destination:"/index.html"}]},null,2),t;typeof Buffer<"u"?t=Buffer.from(e,"utf-8"):t=new Blob([e],{type:"application/json"});let{md5:i}=await M(t);return{path:H,content:t,size:e.length,md5:i}}async function ue(n,e,t){if(t.spaDetect===!1||n.some(i=>i.path===H))return n;try{if(await e.checkSPA(n)){let s=await ke();return[...n,s]}}catch{}return n}function fe(n){let{getApi:e,ensureInit:t,processInput:i,clientDefaults:s,hasAuth:o}=n;return{create:async(r,a={})=>{await t();let l=s?ce(a,s):a;if(o&&!o()&&!l.deployToken&&!l.apiKey)throw p.authentication("Authentication credentials are required for deployment. Please call setDeployToken() or setApiKey() first, or pass credentials in the deployment options.");if(!i)throw p.config("processInput function is not provided.");let y=e(),g=await i(r,l);return g=await ue(g,y,l),y.deploy(g,l)},list:async()=>(await t(),e().listDeployments()),get:async r=>(await t(),e().getDeployment(r)),set:async(r,a)=>(await t(),e().updateDeploymentTags(r,a.tags)),remove:async r=>{await t(),await e().removeDeployment(r)}}}function de(n){let{getApi:e,ensureInit:t}=n;return{set:async(i,s={})=>{await t();let{deployment:o,tags:r}=s;return o===void 0&&r&&r.length>0?e().updateDomainTags(i,r):e().setDomain(i,o,r)},list:async()=>(await t(),e().listDomains()),get:async i=>(await t(),e().getDomain(i)),remove:async i=>{await t(),await e().removeDomain(i)},verify:async i=>(await t(),e().verifyDomain(i)),validate:async i=>(await t(),e().validateDomain(i)),dns:async i=>(await t(),e().getDomainDns(i)),records:async i=>(await t(),e().getDomainRecords(i)),share:async i=>(await t(),e().getDomainShare(i))}}function me(n){let{getApi:e,ensureInit:t}=n;return{get:async()=>(await t(),e().getAccount())}}function he(n){let{getApi:e,ensureInit:t}=n;return{create:async(i={})=>(await t(),e().createToken(i.ttl,i.tags)),list:async()=>(await t(),e().listTokens()),remove:async i=>{await t(),await e().removeToken(i)}}}var L=class{constructor(e={}){this.initPromise=null;this._config=null;this.auth=null;this.clientOptions=e,e.deployToken?this.auth={type:"token",value:e.deployToken}:e.apiKey&&(this.auth={type:"apiKey",value:e.apiKey}),this.authHeadersCallback=()=>this.getAuthHeaders();let t=this.resolveInitialConfig(e);this.http=new I({...e,...t,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});let i={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this._deployments=fe({...i,processInput:(s,o)=>this.processInput(s,o),clientDefaults:this.clientOptions,hasAuth:()=>this.hasAuth()}),this._domains=de(i),this._account=me(i),this._tokens=he(i)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.loadFullConfig()),this.initPromise}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(e,t){return this.deployments.create(e,t)}async whoami(){return this.account.get()}get deployments(){return this._deployments}get domains(){return this._domains}get account(){return this._account}get tokens(){return this._tokens}async getConfig(){return this._config?this._config:(await this.ensureInitialized(),this._config=O(),this._config)}on(e,t){this.http.on(e,t)}off(e,t){this.http.off(e,t)}replaceHttpClient(e){if(this.http?.transferEventsTo)try{this.http.transferEventsTo(e)}catch(t){console.warn("Event transfer failed during client replacement:",t)}this.http=e}setDeployToken(e){if(!e||typeof e!="string")throw p.business("Invalid deploy token provided. Deploy token must be a non-empty string.");this.auth={type:"token",value:e}}setApiKey(e){if(!e||typeof e!="string")throw p.business("Invalid API key provided. API key must be a non-empty string.");this.auth={type:"apiKey",value:e}}getAuthHeaders(){return this.auth?{Authorization:`Bearer ${this.auth.value}`}:{}}hasAuth(){return this.clientOptions.useCredentials?!0:this.auth!==null}};E();R();X();$();E();import ge from"mime-db";var Q={};for(let n in ge){let e=ge[n];e&&e.extensions&&e.extensions.forEach(t=>{Q[t]||(Q[t]=n)})}function Ee(n){let e=n.includes(".")?n.substring(n.lastIndexOf(".")+1).toLowerCase():"";return Q[e]||"application/octet-stream"}async function De(n,e,t){let{FormData:i,File:s}=await import("formdata-node"),{FormDataEncoder:o}=await import("form-data-encoder"),r=new i,a=[];for(let c of n){let d=Ee(c.path),h;if(Buffer.isBuffer(c.content))h=new s([c.content],c.path,{type:d});else if(typeof Blob<"u"&&c.content instanceof Blob)h=new s([c.content],c.path,{type:d});else throw p.file(`Unsupported file.content type for Node.js: ${c.path}`,c.path);if(!c.md5)throw p.file(`File missing md5 checksum: ${c.path}`,c.path);let x=c.path.startsWith("/")?c.path:"/"+c.path;r.append("files[]",h,x),a.push(c.md5)}r.append("checksums",JSON.stringify(a)),e&&e.length>0&&r.append("tags",JSON.stringify(e)),t&&r.append("via",t);let l=new o(r),y=[];for await(let c of l.encode())y.push(Buffer.from(c));let g=Buffer.concat(y);return{body:g.buffer.slice(g.byteOffset,g.byteOffset+g.byteLength),headers:{"Content-Type":l.contentType,"Content-Length":Buffer.byteLength(g).toString()}}}_();function qt(n,e,t,i=!0){let s=n===1?e:t;return i?`${n} ${s}`:s}Z();ne();R();E();import ze from"mime-db";var Ae=ze,Ke=new Set(Object.keys(Ae)),je=new Map(Object.entries(Ae).filter(([n,e])=>e.extensions).map(([n,e])=>[n,new Set(e.extensions)]));var He=[[/File name cannot|Invalid file name|File name contains|File name uses|traversal/i,"Invalid File Name"],[/File size must be positive/i,"Invalid File Size"],[/MIME type is required/i,"Missing MIME Type"],[/Invalid MIME type/i,"Invalid MIME Type"],[/not allowed/i,"Invalid File Type"],[/extension does not match/i,"Extension Mismatch"],[/Total size/i,"Total Size Exceeded"],[/exceeds limit/i,"File Too Large"]];function Ge(n,e){if(n===m.PROCESSING_ERROR)return"Processing Error";if(n===m.EMPTY_FILE)return"Empty File";if(!e)return"Validation Failed";for(let[t,i]of He)if(t.test(e))return i;return"Validation Failed"}function ie(n,e=1){if(n===0)return"0 Bytes";let t=1024,i=["Bytes","KB","MB","GB"],s=Math.floor(Math.log(n)/Math.log(t));return parseFloat((n/Math.pow(t,s)).toFixed(e))+" "+i[s]}function Ve(n){if(/[?&#%<>\[\]{}|\\^~`;$()'"*\r\n\t]/.test(n))return{valid:!1,reason:"File name contains unsafe characters"};if(n.startsWith(" ")||n.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(n.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,i=n.split("/").pop()||n;return t.test(i)?{valid:!1,reason:"File name uses a reserved system name"}:n.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function qe(n,e){if(n.startsWith("."))return!0;let t=n.toLowerCase().split(".");if(t.length>1&&t[t.length-1]){let i=t[t.length-1],s=je.get(e);if(s&&!s.has(i))return!1}return!0}function nn(n,e){let t=[],i=[];if(n.length===0){let o="At least one file must be provided";return{files:[],validFiles:[],error:{error:"No Files Provided",details:o,errors:[o],isClientError:!0}}}if(n.length>e.maxFilesCount){let o=`Number of files (${n.length}) exceeds the limit of ${e.maxFilesCount}.`;return{files:n.map(r=>({...r,status:m.VALIDATION_FAILED,statusMessage:o})),validFiles:[],error:{error:"File Count Exceeded",details:o,errors:[o],isClientError:!0}}}let s=0;for(let o of n){let r=m.READY,a="Ready for upload",l=o.name?Ve(o.name):{valid:!1,reason:"File name cannot be empty"};o.status===m.PROCESSING_ERROR?(r=m.PROCESSING_ERROR,a=o.statusMessage||"A file failed during processing.",t.push(`${o.name}: ${a}`)):!o.name||o.name.trim().length===0?(r=m.VALIDATION_FAILED,a="File name cannot be empty",t.push(`${o.name||"(empty)"}: ${a}`)):o.name.includes("\0")?(r=m.VALIDATION_FAILED,a="File name contains invalid characters (null byte)",t.push(`${o.name}: ${a}`)):l.valid?o.size<=0?(r=m.EMPTY_FILE,a=o.size===0?"File is empty (0 bytes)":"File size must be positive",t.push(`${o.name}: ${a}`)):!o.type||o.type.trim().length===0?(r=m.VALIDATION_FAILED,a="File MIME type is required",t.push(`${o.name}: ${a}`)):pe(o.type)?!j.some(y=>o.type===y)&&!Ke.has(o.type)?(r=m.VALIDATION_FAILED,a=`Invalid MIME type "${o.type}"`,t.push(`${o.name}: ${a}`)):qe(o.name,o.type)?o.size>e.maxFileSize?(r=m.VALIDATION_FAILED,a=`File size (${ie(o.size)}) exceeds limit of ${ie(e.maxFileSize)}`,t.push(`${o.name}: ${a}`)):(s+=o.size,s>e.maxTotalSize&&(r=m.VALIDATION_FAILED,a=`Total size would exceed limit of ${ie(e.maxTotalSize)}`,t.push(`${o.name}: ${a}`))):(r=m.VALIDATION_FAILED,a="File extension does not match MIME type",t.push(`${o.name}: ${a}`)):(r=m.VALIDATION_FAILED,a=`File type "${o.type}" is not allowed`,t.push(`${o.name}: ${a}`)):(r=m.VALIDATION_FAILED,a=l.reason||"Invalid file name",t.push(`${o.name}: ${a}`)),i.push({...o,status:r,statusMessage:a})}if(t.length>0){let o=i.find(a=>a.status!==m.READY&&a.status!==m.PENDING),r=Ge(o?.status,o?.statusMessage);return{files:i.map(a=>({...a,status:m.VALIDATION_FAILED})),validFiles:[],error:{error:r,details:t.length===1?t[0]:`${t.length} file(s) failed validation`,errors:t,isClientError:!0}}}return{files:i,validFiles:i,error:null}}function Ye(n){return n.filter(e=>e.status===m.READY)}function on(n){return Ye(n).length>0}E();X();$();oe();R();var re=class extends L{constructor(e={}){if(T()!=="node")throw p.business("Node.js Ship class can only be used in Node.js environment.");super(e)}resolveInitialConfig(e){return Y(e,{})}async loadFullConfig(){try{let e=await J(this.clientOptions.configFile),t=Y(this.clientOptions,e);t.deployToken&&!this.clientOptions.deployToken?this.setDeployToken(t.deployToken):t.apiKey&&!this.clientOptions.apiKey&&this.setApiKey(t.apiKey);let i=new I({...this.clientOptions,...t,getAuthHeaders:this.authHeadersCallback,createDeployBody:this.getDeployBodyCreator()});this.replaceHttpClient(i);let s=await this.http.getConfig();V(s)}catch(e){throw this.initPromise=null,e}}async processInput(e,t){let i=typeof e=="string"?[e]:e;if(!Array.isArray(i)||!i.every(o=>typeof o=="string"))throw p.business("Invalid input type for Node.js environment. Expected string or string[].");if(i.length===0)throw p.business("No files to deploy.");let{processFilesForNode:s}=await Promise.resolve().then(()=>(oe(),Re));return s(i,t)}getDeployBodyCreator(){return De}},We=re;export{j as ALLOWED_MIME_TYPES,z as API_KEY_HEX_LENGTH,w as API_KEY_PREFIX,se as API_KEY_TOTAL_LENGTH,Ze as AccountPlan,I as ApiHttp,et as AuthMethod,N as DEFAULT_API,H as DEPLOYMENT_CONFIG_FILENAME,K as DEPLOY_TOKEN_HEX_LENGTH,P as DEPLOY_TOKEN_PREFIX,ae as DEPLOY_TOKEN_TOTAL_LENGTH,Xe as DeploymentStatus,Qe as DomainStatus,u as ErrorType,m as FILE_VALIDATION_STATUS,m as FileValidationStatus,Ue as JUNK_DIRECTORIES,re as Ship,p as ShipError,lt as TAG_CONSTRAINTS,ct as TAG_PATTERN,Oe as __setTestEnvironment,on as allValidFilesReady,M as calculateMD5,me as createAccountResource,fe as createDeploymentResource,de as createDomainResource,he as createTokenResource,We as default,ft as deserializeTags,st as extractSubdomain,Se as filterJunk,ie as formatFileSize,at as generateDeploymentUrl,pt as generateDomainUrl,O as getCurrentConfig,T as getENV,Ye as getValidFiles,pe as isAllowedMimeType,rt as isCustomDomain,ot as isDeployment,le as isPlatformDomain,C as isShipError,J as loadConfig,ce as mergeDeployOptions,Te as optimizeDeployPaths,qt as pluralize,Ce as processFilesForNode,Y as resolveConfig,ut as serializeTags,V as setPlatformConfig,tt as validateApiKey,it as validateApiUrl,nt as validateDeployToken,nn as validateFiles};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|