@wix/cli-app 1.1.53 → 1.1.55
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/README.md +45 -0
- package/build/{CreateVersionCommand-2W37YQW4.js → CreateVersionCommand-XTZT5DED.js} +2 -2
- package/build/{DevCommand-JDHE7RQB.js → DevCommand-Q5XLAGMG.js} +2 -2
- package/build/DevCommand-Q5XLAGMG.js.map +1 -0
- package/build/GenerateCommand-HNFICZJA.js +128 -0
- package/build/{GenerateCommand-3PPXF4B6.js.map → GenerateCommand-HNFICZJA.js.map} +1 -1
- package/build/LogsCommand-XJHE75L2.js +4 -0
- package/build/LogsCommand-XJHE75L2.js.map +1 -0
- package/build/PreviewCommand-JKPFMGWV.js +4 -0
- package/build/ServeCommand-CPZOI7DC.js +4 -0
- package/build/ServeCommand-CPZOI7DC.js.map +1 -0
- package/build/build-3RXHADZD.js +4 -0
- package/build/build-3RXHADZD.js.map +1 -0
- package/build/{chunk-FVG3T57Z.js → chunk-2FB5F5QF.js} +2 -2
- package/build/{chunk-TSAKYUDG.js → chunk-4BHNJVL2.js} +2 -2
- package/build/{chunk-PSQ4AQFG.js → chunk-6HSUK2A2.js} +2 -2
- package/build/{chunk-QXIKCJLU.js → chunk-7VOKCPZP.js} +3 -3
- package/build/{chunk-QXIKCJLU.js.map → chunk-7VOKCPZP.js.map} +1 -1
- package/build/{chunk-WXOIL7LC.js → chunk-B4SDDVMV.js} +2 -2
- package/build/{chunk-DLQYJEV6.js → chunk-C4SXZWXS.js} +2 -2
- package/build/{chunk-4CCKO52Z.js → chunk-FKBCPMYK.js} +3 -3
- package/build/chunk-FKBCPMYK.js.map +1 -0
- package/build/chunk-FMIXY6J5.js +115 -0
- package/build/chunk-FMIXY6J5.js.map +1 -0
- package/build/{chunk-YIGHU6O6.js → chunk-GWU77DPO.js} +2 -2
- package/build/chunk-GWU77DPO.js.map +1 -0
- package/build/{chunk-SZ5JWJ4Q.js → chunk-HDXLQ34N.js} +2 -2
- package/build/{chunk-2W2YJZP5.js → chunk-JXE3LQ2S.js} +15 -15
- package/build/chunk-JXE3LQ2S.js.map +1 -0
- package/build/chunk-K2A77MMN.js +4 -0
- package/build/chunk-K2A77MMN.js.map +1 -0
- package/build/{chunk-C3O7WWDR.js → chunk-KG7BHEJG.js} +2 -2
- package/build/chunk-LJEYXY4V.js +4 -0
- package/build/chunk-LJEYXY4V.js.map +1 -0
- package/build/{chunk-B5P4JHUW.js → chunk-N5D4TFKX.js} +132 -130
- package/build/chunk-N5D4TFKX.js.map +1 -0
- package/build/{chunk-AXAJ7DJ4.js → chunk-QOUZ6J7N.js} +2 -2
- package/build/{chunk-HILXNAWZ.js → chunk-X4BLMM2K.js} +2 -2
- package/build/chunk-X4BLMM2K.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +300 -48
- package/build/cloudflare-runtime/getRegisteredExtensions.js +299 -47
- package/build/index.js +2 -2
- package/build/platform-sdk/chunk-GZP4Z76C.js +2 -0
- package/build/platform-sdk/chunk-GZP4Z76C.js.map +1 -0
- package/build/platform-sdk/chunk-KGLNBMRO.js +2 -0
- package/build/platform-sdk/chunk-KGLNBMRO.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/editor.js +2 -2
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/platform-sdk/site.js.map +1 -1
- package/build/preview-TM7JAWFS.js +4 -0
- package/build/preview-TM7JAWFS.js.map +1 -0
- package/build/render-command-QEQ3L7OX.js +4 -0
- package/build/render-command-QEQ3L7OX.js.map +1 -0
- package/package.json +7 -6
- package/templates/dashboard-plugin/files/plugin.tsx.ejs +8 -18
- package/build/DevCommand-JDHE7RQB.js.map +0 -1
- package/build/GenerateCommand-3PPXF4B6.js +0 -128
- package/build/LogsCommand-LQKTBY6D.js +0 -4
- package/build/LogsCommand-LQKTBY6D.js.map +0 -1
- package/build/PreviewCommand-H3HVD7DH.js +0 -4
- package/build/ServeCommand-RHONEHTF.js +0 -4
- package/build/ServeCommand-RHONEHTF.js.map +0 -1
- package/build/build-QN6TGE3Q.js +0 -4
- package/build/build-QN6TGE3Q.js.map +0 -1
- package/build/chunk-2W2YJZP5.js.map +0 -1
- package/build/chunk-4CCKO52Z.js.map +0 -1
- package/build/chunk-B5P4JHUW.js.map +0 -1
- package/build/chunk-F6MVNSX2.js +0 -4
- package/build/chunk-F6MVNSX2.js.map +0 -1
- package/build/chunk-HILXNAWZ.js.map +0 -1
- package/build/chunk-LDGXTJLC.js +0 -4
- package/build/chunk-LDGXTJLC.js.map +0 -1
- package/build/chunk-YIGHU6O6.js.map +0 -1
- package/build/chunk-YMRYABCG.js +0 -115
- package/build/chunk-YMRYABCG.js.map +0 -1
- package/build/platform-sdk/chunk-32RIHE6N.js +0 -2
- package/build/platform-sdk/chunk-32RIHE6N.js.map +0 -1
- package/build/platform-sdk/chunk-DGX4CFXG.js +0 -2
- package/build/platform-sdk/chunk-DGX4CFXG.js.map +0 -1
- package/build/preview-457BTAHF.js +0 -4
- package/build/preview-457BTAHF.js.map +0 -1
- package/build/render-command-W6CY3R4Q.js +0 -4
- package/build/render-command-W6CY3R4Q.js.map +0 -1
- /package/build/{CreateVersionCommand-2W37YQW4.js.map → CreateVersionCommand-XTZT5DED.js.map} +0 -0
- /package/build/{PreviewCommand-H3HVD7DH.js.map → PreviewCommand-JKPFMGWV.js.map} +0 -0
- /package/build/{chunk-FVG3T57Z.js.map → chunk-2FB5F5QF.js.map} +0 -0
- /package/build/{chunk-TSAKYUDG.js.map → chunk-4BHNJVL2.js.map} +0 -0
- /package/build/{chunk-PSQ4AQFG.js.map → chunk-6HSUK2A2.js.map} +0 -0
- /package/build/{chunk-WXOIL7LC.js.map → chunk-B4SDDVMV.js.map} +0 -0
- /package/build/{chunk-DLQYJEV6.js.map → chunk-C4SXZWXS.js.map} +0 -0
- /package/build/{chunk-SZ5JWJ4Q.js.map → chunk-HDXLQ34N.js.map} +0 -0
- /package/build/{chunk-C3O7WWDR.js.map → chunk-KG7BHEJG.js.map} +0 -0
- /package/build/{chunk-AXAJ7DJ4.js.map → chunk-QOUZ6J7N.js.map} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as J}from"./chunk-7VOKCPZP.js";import"./chunk-WJTPY35F.js";import{$a as U,Ab as V,C as N,Ta as z,Ua as G,Va as H,_a as q}from"./chunk-FMIXY6J5.js";import{A as f,P as D,S as F,W as A,X as R,b as k,c as _,e as h,f as x,m as r,x as d}from"./chunk-JXE3LQ2S.js";import{e as L,h as g}from"./chunk-V4TR6DCM.js";g();g();var e=L(k(),1),E=L(_(),1);g();var l=L(k(),1);import{createServer as ie}from"node:http";var Y=L(_(),1);g();var y=L(_(),1),Z=r.any(),ee=r.enum(["info","error","warn","debug","log"]),oe=r.object({message:r.array(Z),level:ee,timestamp:r.number()}),re=r.object({stack:r.string(),name:r.string(),message:r.string(),timestamp:r.number()}),te=r.object({_type:r.literal("log"),exceptions:r.array(re),logs:r.array(oe)}).passthrough(),ne=r.object({_type:r.literal("session-timeout")}).passthrough(),se=r.discriminatedUnion("_type",[te,ne]),K=(0,y.variant)({Log:(0,y.fields)(),Exception:(0,y.fields)()}),B="/logs",$=(n,s)=>{let i,u;if(n.method==="POST"&&n.url===B){let m="";n.on("data",t=>{m+=t.toString()}),n.on("end",()=>{let t;try{t=se.parse(JSON.parse(m))}catch(o){return u(x.FailedToParseLog(),o,{body:m}),s.statusCode=400,s.end()}let p=[];t._type==="log"&&(p.push(...t.exceptions.map(o=>K.Exception(o))),p.push(...t.logs.map(o=>K.Log(o)))),(0,y.match)(t._type,{log:()=>{i(p)},"session-timeout":()=>{s.statusCode=200,s.end(),u(x.LogsConnectionTimeout(),{},{body:m})}}),s.statusCode=200,s.end()})}else s.statusCode=404,s.end("Not Found");let c={onLog:m=>(i=m,c),onError:m=>(u=m,c)};return c};var me=/([0-9a-f-]{36})/,Q=({onLog:n,version:s,appId:i})=>{let{reportError:u}=N(),{getAppByVersion:c}=H(),m=J(),t=G({type:"backoffice"}),p=(0,l.useRef)(),o=(0,l.useMemo)(()=>ie((a,w)=>{$(a,w).onLog(n).onError((I,M,v)=>{throw o.close(),new h({code:I,cause:M,info:v})})}),[n]),O=(0,l.useMemo)(()=>new Promise(a=>{p.current=a}),[]);(0,l.useEffect)(()=>(o.listen(0,async()=>{let a=o.address().port;p.current?.(a)}),()=>{o.listening&&o.close()}),[o]);let{status:S}=F(async()=>{let a=await O,{url:w}=await m(a),{data:I}=await c({appId:i,version:s}),M=I.components.find(b=>b.compType===z.TOPOLOGY),v=me.exec(M?.compData.topology.topology.backendApiUrl??"");if(!v?.[1])throw new h({code:x.FailedToGetLogsTopology(),cause:null});let j=v[1],X={appId:i,deploymentId:j,destinationUrl:new URL(B,w).href};try{await t.request(q(X))}catch(b){throw o.close(),new h({code:x.FailedToConnectToLogsService(),cause:b})}return j},[]);return(0,l.useEffect)(()=>()=>{(0,Y.isType)(S,"Success")&&t.request(U({appId:i,deploymentId:S.result})).catch(u)},[]),S};g();var W=L(k(),1);var P=({message:n,level:s})=>{let i="unknown";return typeof n=="object"?i=JSON.stringify(n):i=String(n),W.default.createElement(f,{skin:s==="error"?"error":"standard"},i)};var pe=({version:n})=>{let{model:s}=V(),{t:i}=R(),[u,c]=(0,e.useState)([]),m=Q({appId:s.config.appId,version:n,onLog:(0,e.useCallback)(t=>{c(p=>[...p,...t])},[c])});return(0,E.match)(m,{Success:()=>e.default.createElement(d,{marginTop:1,marginBottom:1,flexDirection:"column"},e.default.createElement(d,{marginBottom:1,flexDirection:"column"},e.default.createElement(f,null,e.default.createElement(A,{i18nKey:"logs_command.listening_to_logs"})),e.default.createElement(f,null,e.default.createElement(A,{i18nKey:"logs_command.prod_env_logs",values:{version:n}}))),u.map((t,p)=>e.default.createElement(d,{key:p,flexDirection:"column"},e.default.createElement(d,{columnGap:1},e.default.createElement(d,{flexShrink:0},e.default.createElement(f,{skin:"secondary"},new Date(t.timestamp).toLocaleTimeString())),e.default.createElement(d,{columnGap:1},(0,E.match)(t,{Log:({message:o,level:O})=>o.map((S,a)=>e.default.createElement(P,{key:`${p}-${a}`,message:S,level:O})),Exception:({message:o})=>e.default.createElement(P,{key:p,message:o,level:"error"})}))),(0,E.match)(t,{Log:()=>null,Exception:({stack:o})=>e.default.createElement(f,{skin:"error"},o)})))),Loading:()=>e.default.createElement(D,{text:i("logs_command.connecting")}),Error:()=>null})};export{pe as LogsCommand};
|
|
4
|
+
//# sourceMappingURL=LogsCommand-XJHE75L2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/LogsCommand/index.ts","../src/components/LogsCommand/LogsCommand.tsx","../src/components/LogsCommand/useLogsServer.ts","../src/components/LogsCommand/logsReqHandler.ts","../src/components/LogsCommand/ServerLogMessage.tsx"],"sourcesContent":["export { LogsCommand } from './LogsCommand.js';\n","import type { FC } from 'react';\nimport React, { useState, useCallback } from 'react';\nimport { match } from 'variant';\nimport { Spinner, Box, Text } from '@wix/cli-ui-kit';\nimport { useTranslation, Trans } from '@wix/cli-i18n';\nimport { useLogsServer } from './useLogsServer.js';\nimport type { AggregatedLog } from './logsReqHandler.js';\nimport { ServerLogMessage } from './ServerLogMessage.js';\nimport { useProjectModel } from '../../model.js';\n\nexport const LogsCommand: FC<{\n version: string;\n}> = ({ version }) => {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const [logs, setLogs] = useState<AggregatedLog[]>([]);\n const serverResult = useLogsServer({\n appId: model.config.appId,\n version,\n onLog: useCallback(\n (serverLogs) => {\n setLogs((prevLogs) => {\n return [...prevLogs, ...serverLogs];\n });\n },\n [setLogs]\n ),\n });\n\n return match(serverResult, {\n Success: () => (\n <Box marginTop={1} marginBottom={1} flexDirection=\"column\">\n <Box marginBottom={1} flexDirection=\"column\">\n <Text>\n <Trans i18nKey=\"logs_command.listening_to_logs\" />\n </Text>\n <Text>\n <Trans i18nKey=\"logs_command.prod_env_logs\" values={{ version }} />\n </Text>\n </Box>\n\n {logs.map((log, logIdx) => (\n <Box key={logIdx} flexDirection=\"column\">\n <Box columnGap={1}>\n <Box flexShrink={0}>\n <Text skin=\"secondary\">\n {new Date(log.timestamp).toLocaleTimeString()}\n </Text>\n </Box>\n <Box columnGap={1}>\n {match(log, {\n Log: ({ message, level }) =>\n message.map((msgItem, idx) => (\n <ServerLogMessage\n key={`${logIdx}-${idx}`}\n message={msgItem}\n level={level}\n />\n )),\n Exception: ({ message }) => (\n <ServerLogMessage\n key={logIdx}\n message={message}\n level=\"error\"\n />\n ),\n })}\n </Box>\n </Box>\n {match(log, {\n Log: () => null,\n Exception: ({ stack }) => <Text skin=\"error\">{stack}</Text>,\n })}\n </Box>\n ))}\n </Box>\n ),\n Loading: () => <Spinner text={t('logs_command.connecting')} />,\n Error: () => null,\n });\n};\n","import { useEffect, useMemo, useRef } from 'react';\nimport { createServer } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { useAsync } from '@wix/cli-ui-kit';\nimport { useErrorReporter } from '@wix/cli-error-reporting';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport {\n attachLogger,\n deattachLogger,\n} from '@wix/ambassador-ctp-app-cloud-backend-service-v1-app-cloud-backend-deployment/http';\nimport { useTunnel } from '@wix/cli-tunnel';\nimport { useDevCenterClient, ComponentType } from '@wix/dev-center-client';\nimport type { TopologyComponent } from '@wix/dev-center-client';\nimport { isType } from 'variant';\nimport type { OnLog } from './logsReqHandler.js';\nimport { LOGS_ENDPOINT, logsReqHandler } from './logsReqHandler.js';\n\nconst deploymentIdRegex = /([0-9a-f-]{36})/;\n\nexport const useLogsServer = ({\n onLog,\n version,\n appId,\n}: {\n onLog: OnLog;\n version: string;\n appId: string;\n}) => {\n const { reportError } = useErrorReporter();\n const { getAppByVersion } = useDevCenterClient();\n const createTunnelClient = useTunnel();\n const httpClient = useHttpClient({ type: 'backoffice' });\n const localServerPortResolverRef = useRef<(port: number) => void>();\n\n const server = useMemo(() => {\n return createServer((req, res) => {\n logsReqHandler(req, res)\n .onLog(onLog)\n .onError((code, err, info) => {\n server.close();\n throw new CliError({ code, cause: err, info });\n });\n });\n }, [onLog]);\n\n const localServerPortPromise = useMemo(() => {\n return new Promise<number>((resolve) => {\n localServerPortResolverRef.current = resolve;\n });\n }, []);\n\n useEffect(() => {\n server.listen(0, async () => {\n const port = (server.address() as AddressInfo).port;\n localServerPortResolverRef.current?.(port);\n });\n return () => {\n if (server.listening) {\n server.close();\n }\n };\n }, [server]);\n\n const { status } = useAsync(async () => {\n const localServerPort = await localServerPortPromise;\n const { url: tunnelUrl } = await createTunnelClient(localServerPort);\n const { data } = await getAppByVersion({ appId, version });\n\n const topologyComponent = data.components.find(\n (component): component is TopologyComponent => {\n return component.compType === ComponentType.TOPOLOGY;\n }\n );\n const match = deploymentIdRegex.exec(\n topologyComponent?.compData.topology.topology.backendApiUrl ?? ''\n );\n\n if (!match?.[1]) {\n throw new CliError({\n code: CliErrorCode.FailedToGetLogsTopology(),\n cause: null,\n });\n }\n const deploymentId = match[1];\n\n const loggerReq = {\n appId,\n deploymentId,\n destinationUrl: new URL(LOGS_ENDPOINT, tunnelUrl).href,\n };\n\n try {\n await httpClient.request(attachLogger(loggerReq));\n } catch (error) {\n server.close();\n throw new CliError({\n code: CliErrorCode.FailedToConnectToLogsService(),\n cause: error,\n });\n }\n\n return deploymentId;\n }, []);\n\n useEffect(() => {\n // Logs should be deattached only on unmount.\n // This is why this `useEffect` has only `return` statement.\n return () => {\n if (isType(status, 'Success')) {\n httpClient\n .request(\n deattachLogger({\n appId,\n deploymentId: status.result,\n })\n )\n .catch(reportError);\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return status;\n};\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport type { CliErrorCodeType } from '@wix/cli-error';\nimport { CliErrorCode } from '@wix/cli-error';\nimport { z } from 'zod';\nimport { variant, fields, match } from 'variant';\nimport type { VariantOf } from 'variant';\n\nconst LogMessageSchema = z.any();\nexport type LogMessage = z.infer<typeof LogMessageSchema>;\n\nconst LogMessageLevelSchema = z.enum(['info', 'error', 'warn', 'debug', 'log']);\nexport type LogMessageLevel = z.infer<typeof LogMessageLevelSchema>;\n\nconst LogItemSchema = z.object({\n message: z.array(LogMessageSchema),\n level: LogMessageLevelSchema,\n timestamp: z.number(),\n});\n\ntype LogItem = z.infer<typeof LogItemSchema>;\n\nconst ExceptionItemSchema = z.object({\n stack: z.string(),\n name: z.string(),\n message: z.string(),\n timestamp: z.number(),\n});\n\ntype ExceptionItem = z.infer<typeof ExceptionItemSchema>;\n\nconst LogResponseSchema = z\n .object({\n _type: z.literal('log'),\n exceptions: z.array(ExceptionItemSchema),\n logs: z.array(LogItemSchema),\n })\n .passthrough();\n\nconst SessionTimeoutResponseSchema = z\n .object({\n _type: z.literal('session-timeout'),\n })\n .passthrough();\n\nconst ServerLogResponseSchema = z.discriminatedUnion('_type', [\n LogResponseSchema,\n SessionTimeoutResponseSchema,\n]);\n\ntype ServerLogResponse = z.infer<typeof ServerLogResponseSchema>;\n\nconst AggregatedLog = variant({\n Log: fields<LogItem>(),\n Exception: fields<ExceptionItem>(),\n});\nexport type AggregatedLog = VariantOf<typeof AggregatedLog>;\n\nexport type OnLog = (data: AggregatedLog[]) => void;\ntype OnError = (\n errType: CliErrorCodeType,\n err: unknown,\n info?: Record<string, unknown>\n) => void;\n\nexport const LOGS_ENDPOINT = '/logs';\n\nexport const logsReqHandler = (req: IncomingMessage, res: ServerResponse) => {\n let onLog: OnLog;\n let onError: OnError;\n\n if (req.method === 'POST' && req.url === LOGS_ENDPOINT) {\n let body = '';\n\n req.on('data', (chunk) => {\n body += chunk.toString();\n });\n\n req.on('end', () => {\n let parsedBody: ServerLogResponse;\n try {\n parsedBody = ServerLogResponseSchema.parse(JSON.parse(body));\n } catch (err) {\n onError(CliErrorCode.FailedToParseLog(), err, { body });\n res.statusCode = 400;\n return res.end();\n }\n\n const resultLogs: AggregatedLog[] = [];\n\n if (parsedBody._type === 'log') {\n resultLogs.push(\n ...parsedBody.exceptions.map((exception) =>\n AggregatedLog.Exception(exception)\n )\n );\n resultLogs.push(\n ...parsedBody.logs.map((log) => AggregatedLog.Log(log))\n );\n }\n\n match(parsedBody._type, {\n log: () => {\n onLog(resultLogs);\n },\n 'session-timeout': () => {\n res.statusCode = 200;\n res.end();\n\n onError(CliErrorCode.LogsConnectionTimeout(), {}, { body });\n },\n });\n\n res.statusCode = 200;\n res.end();\n });\n } else {\n res.statusCode = 404;\n res.end('Not Found');\n }\n\n const api = {\n onLog: (callback: OnLog) => {\n onLog = callback;\n return api;\n },\n onError: (callback: OnError) => {\n onError = callback;\n return api;\n },\n };\n\n return api;\n};\n","import React from 'react';\nimport type { FC } from 'react';\nimport { Text } from '@wix/cli-ui-kit';\nimport type { LogMessage, LogMessageLevel } from './logsReqHandler.js';\n\nexport const ServerLogMessage: FC<{\n message: LogMessage;\n level: LogMessageLevel;\n}> = ({ message, level }) => {\n let content = 'unknown';\n\n if (typeof message === 'object') {\n content = JSON.stringify(message);\n } else {\n content = String(message);\n }\n\n return <Text skin={level === 'error' ? 'error' : 'standard'}>{content}</Text>;\n};\n"],"mappings":";;yTAAAA,ICAAC,IACA,IAAAC,EAA6C,SAC7CC,EAAsB,SCFtBC,IAAA,IAAAC,EAA2C,SAC3C,OAAS,gBAAAC,OAAoB,YAa7B,IAAAC,EAAuB,SCdvBC,IAIA,IAAAC,EAAuC,SAGjCC,EAAmBC,EAAE,IAAI,EAGzBC,GAAwBD,EAAE,KAAK,CAAC,OAAQ,QAAS,OAAQ,QAAS,KAAK,CAAC,EAGxEE,GAAgBF,EAAE,OAAO,CAC7B,QAASA,EAAE,MAAMD,CAAgB,EACjC,MAAOE,GACP,UAAWD,EAAE,OAAO,CACtB,CAAC,EAIKG,GAAsBH,EAAE,OA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ACrB,QAASD,EACT,MAAOD,EACT,CACD,EACH,UAAW,CAAC,CAAE,QAAAD,CAAQ,IACpB,EAAAN,QAAA,cAACU,EAAA,CACC,IAAKL,EACL,QAASC,EACT,MAAM,QACR,CAEJ,CAAC,CACH,CACF,KACC,SAAMF,EAAK,CACV,IAAK,IAAM,KACX,UAAW,CAAC,CAAE,MAAAO,CAAM,IAAM,EAAAX,QAAA,cAACE,EAAA,CAAK,KAAK,SAASS,CAAM,CACtD,CAAC,CACH,CACD,CACH,EAEF,QAAS,IAAM,EAAAX,QAAA,cAACY,EAAA,CAAQ,KAAMpB,EAAE,yBAAyB,EAAG,EAC5D,MAAO,IAAM,IACf,CAAC,CACH","names":["init_esm_shims","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","createServer","import_variant","init_esm_shims","import_variant","LogMessageSchema","z","LogMessageLevelSchema","LogItemSchema","ExceptionItemSchema","LogResponseSchema","SessionTimeoutResponseSchema","ServerLogResponseSchema","AggregatedLog","LOGS_ENDPOINT","logsReqHandler","req","res","onLog","onError","body","chunk","parsedBody","err","CliErrorCode","resultLogs","exception","log","api","callback","deploymentIdRegex","useLogsServer","onLog","version","appId","reportError","useErrorReporter","getAppByVersion","useDevCenterClient","createTunnelClient","useTunnel","httpClient","useHttpClient","localServerPortResolverRef","server","createServer","req","res","logsReqHandler","code","err","info","CliError","localServerPortPromise","resolve","port","status","useAsync","localServerPort","tunnelUrl","data","topologyComponent","component","ComponentType","match","CliErrorCode","deploymentId","loggerReq","LOGS_ENDPOINT","attachLogger","error","deattachLogger","init_esm_shims","import_react","ServerLogMessage","message","level","content","React","Text","LogsCommand","version","model","useProjectModel","t","useTranslation","logs","setLogs","serverResult","useLogsServer","serverLogs","prevLogs","React","Box_default","Text","Trans","log","logIdx","message","level","msgItem","idx","ServerLogMessage","stack","Spinner"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a}from"./chunk-X4BLMM2K.js";import"./chunk-K2A77MMN.js";import"./chunk-GWU77DPO.js";import"./chunk-4BHNJVL2.js";import"./chunk-QOUZ6J7N.js";import"./chunk-LJEYXY4V.js";import"./chunk-B4SDDVMV.js";import"./chunk-7VOKCPZP.js";import"./chunk-WJTPY35F.js";import"./chunk-FKBCPMYK.js";import"./chunk-N5D4TFKX.js";import"./chunk-C4SXZWXS.js";import"./chunk-FMIXY6J5.js";import"./chunk-JXE3LQ2S.js";import"./chunk-V4TR6DCM.js";export{a as PreviewCommand};
|
|
4
|
+
//# sourceMappingURL=PreviewCommand-JKPFMGWV.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as W,b as q}from"./chunk-K2A77MMN.js";import{c as L}from"./chunk-GWU77DPO.js";import{a as b}from"./chunk-HDXLQ34N.js";import{b as U}from"./chunk-QOUZ6J7N.js";import{g as k,h as K,j as N,k as V,l as f,m as D}from"./chunk-LJEYXY4V.js";import"./chunk-B4SDDVMV.js";import"./chunk-7VOKCPZP.js";import"./chunk-WJTPY35F.js";import"./chunk-FKBCPMYK.js";import{a as M,b as h,e as j}from"./chunk-N5D4TFKX.js";import"./chunk-C4SXZWXS.js";import{Ab as u}from"./chunk-FMIXY6J5.js";import{A as y,B,C as I,E as T,O as _,P as O,S as A,W as c,X as F,b as a,c as ee,x as m}from"./chunk-JXE3LQ2S.js";import{e as s,h as o}from"./chunk-V4TR6DCM.js";o();o();var g=s(a(),1);o();var n=s(a(),1),G=s(ee(),1);o();var i=s(a(),1);import{preview as re}from"vite";function z(){let t=(0,i.useRef)(),{model:r}=u();(0,i.useEffect)(()=>()=>{t.current?.httpServer.close()},[]);let v=(0,i.useMemo)(()=>b({timestamp:!0}),[]);return(0,i.useCallback)(async()=>{let p=await re(await h(r,{type:"build",customLogger:v}));return t.current=p,M(p)},[r,v])}var H=(0,n.createContext)(null),w=({children:t})=>{let{model:r}=u(),{t:v}=F(),{site:p}=f(),Q=k(),{createOverride:X}=N(),Y=z(),{status:Z}=A(async()=>{await W(r.projectFolder);let d=await Y(),x=await U(r.projectFolder),P=j(x,d),$=await Q.createAppRelease(P,r.config.projectId),E=V(r),{id:R}=E?await X({appId:r.config.appId,siteId:p.id,overrides:E}):await Promise.resolve({id:void 0});return{armTag:$,serverUrl:d,siteOverrideId:R}},[]);return(0,G.match)(Z,{Error:()=>null,Loading:()=>n.default.createElement(O,{text:v("serve_command.starting_serve_environment")}),Success:({result:{armTag:d,serverUrl:x,siteOverrideId:P}})=>n.default.createElement(H.Provider,{value:{serverUrl:x}},n.default.createElement(D,{siteOverrideId:P},n.default.createElement(K,{armTag:d},t)))})};function C(){let t=(0,n.useContext)(H);if(t==null)throw new Error("useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>");return t}o();var e=s(a(),1);function J(){let{site:t}=f(),{serverUrl:r}=C();return e.default.createElement(m,{flexDirection:"column"},e.default.createElement(m,{gap:1},e.default.createElement(y,{skin:"success"},e.default.createElement(T,null)),e.default.createElement(c,{i18nKey:"serve_command.starting_serve_environment_success",components:[e.default.createElement(_,{url:r})]})),e.default.createElement(m,{gap:1},e.default.createElement(B,null),e.default.createElement(c,{i18nKey:"serve_command.production_build"})),e.default.createElement(m,{gap:1,paddingTop:1,paddingBottom:1},e.default.createElement(I,null),e.default.createElement(c,{i18nKey:"general.dev_site.current",values:{name:t.displayName}})),e.default.createElement(m,{paddingBottom:1,flexDirection:"column"},e.default.createElement(q,null)))}var oe=()=>g.default.createElement(L,null,g.default.createElement(w,null,g.default.createElement(J,null)));export{oe as ServeCommand,w as ServeEnvironmentProvider,C as useServeEnvironment};
|
|
4
|
+
//# sourceMappingURL=ServeCommand-CPZOI7DC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/ServeEnvironment.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts","../src/components/ServeCommand/ServeCommandScreen.tsx"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\nexport {\n ServeEnvironmentProvider,\n useServeEnvironment,\n} from './ServeEnvironment.js';\n","import React from 'react';\nimport type { FC } from 'react';\nimport { SiteProvider } from '../../site/SiteProvider.js';\nimport { ServeEnvironmentProvider } from './ServeEnvironment.js';\nimport { ServeCommandScreen } from './ServeCommandScreen.js';\n\nexport const ServeCommand: FC = () => {\n return (\n <SiteProvider>\n <ServeEnvironmentProvider>\n <ServeCommandScreen />\n </ServeEnvironmentProvider>\n </SiteProvider>\n );\n};\n","import React, { createContext, useContext } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Spinner, useAsync } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { useSiteOverrideClient } from '@wix/site-override-client';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\nimport { useProjectModel } from '../../model.js';\nimport { useSite } from '../../site/index.js';\nimport { createSiteOverrides } from '../../site-override/createSiteOverrides.js';\nimport { SiteOverrideProvider } from '../../context/siteOverride.js';\n\ninterface ServeEnvironment {\n serverUrl: string;\n}\n\nconst ServeEnvironmentContext = createContext<ServeEnvironment | null>(null);\n\nexport const ServeEnvironmentProvider: FC<{\n children: ReactNode;\n}> = ({ children }) => {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const { site } = useSite();\n const arm = useARMClient();\n const { createOverride } = useSiteOverrideClient();\n const createPreviewServer = usePreviewServer();\n\n const { status } = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = await createPreviewServer();\n\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n\n const armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n const overrides = createSiteOverrides(model);\n const { id: siteOverrideId } = overrides\n ? await createOverride({\n appId: model.config.appId,\n siteId: site.id,\n overrides,\n })\n : await Promise.resolve({ id: undefined });\n\n return { armTag, serverUrl, siteOverrideId };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Success: ({ result: { armTag, serverUrl, siteOverrideId } }) => (\n <ServeEnvironmentContext.Provider value={{ serverUrl }}>\n <SiteOverrideProvider siteOverrideId={siteOverrideId}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </SiteOverrideProvider>\n </ServeEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useServeEnvironment(): ServeEnvironment {\n const context = useContext(ServeEnvironmentContext);\n if (context == null) {\n throw new Error(\n 'useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>'\n );\n }\n return context;\n}\n","import { preview } from 'vite';\nimport type { PreviewServer } from 'vite';\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useProjectModel } from '../../../model.js';\nimport { getClientViteConfig } from '../../../vite/index.js';\nimport { getViteServerUrl } from '../../../vite/vite-server-url.js';\nimport { ConfigType } from '../../../vite/vite-config-options.js';\nimport { createLogger } from '../../../vite/logger.js';\n\nexport function usePreviewServer() {\n const previewServerRef = useRef<PreviewServer>();\n const { model } = useProjectModel();\n\n useEffect(() => {\n return () => {\n previewServerRef.current?.httpServer.close();\n };\n }, []);\n\n const logger = useMemo(() => createLogger({ timestamp: true }), []);\n\n return useCallback(async () => {\n const previewServer = await preview(\n await getClientViteConfig(model, {\n type: ConfigType.build,\n customLogger: logger,\n })\n );\n\n previewServerRef.current = previewServer;\n\n return getViteServerUrl(previewServer);\n }, [model, logger]);\n}\n","import {\n Box,\n InfoIcon,\n Link,\n PointerIcon,\n SuccessIcon,\n Text,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSite } from '../../site/useSite.js';\nimport { useServeEnvironment } from './ServeEnvironment.js';\nimport { PlatformViewer } from '../Platform/PlatformViewer.js';\n\nexport function ServeCommandScreen() {\n const { site } = useSite();\n const { serverUrl } = useServeEnvironment();\n\n return (\n <Box flexDirection=\"column\">\n <Box gap={1}>\n <Text skin=\"success\">\n <SuccessIcon />\n </Text>\n <Trans\n i18nKey=\"serve_command.starting_serve_environment_success\"\n components={[<Link url={serverUrl} />]}\n />\n </Box>\n <Box gap={1}>\n <InfoIcon />\n <Trans i18nKey=\"serve_command.production_build\" />\n </Box>\n <Box gap={1} paddingTop={1} paddingBottom={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box paddingBottom={1} flexDirection=\"column\">\n <PlatformViewer />\n </Box>\n </Box>\n );\n}\n"],"mappings":";;6nBAAAA,ICAAC,IAAA,IAAAC,EAAkB,SCAlBC,IAAA,IAAAC,EAAiD,SAEjDC,EAAsB,UCFtBC,IAEA,IAAAC,EAAwD,SAFxD,OAAS,WAAAC,OAAe,OASjB,SAASC,GAAmB,CACjC,IAAMC,KAAmB,UAAsB,EACzC,CAAE,MAAAC,CAAM,EAAIC,EAAgB,KAElC,aAAU,IACD,IAAM,CACXF,EAAiB,SAAS,WAAW,MAAM,CAC7C,EACC,CAAC,CAAC,EAEL,IAAMG,KAAS,WAAQ,IAAMC,EAAa,CAAE,UAAW,EAAK,CAAC,EAAG,CAAC,CAAC,EAElE,SAAO,eAAY,SAAY,CAC7B,IAAMC,EAAgB,MAAMC,GAC1B,MAAMC,EAAoBN,EAAO,CAC/B,aACA,aAAcE,CAChB,CAAC,CACH,EAEA,OAAAH,EAAiB,QAAUK,EAEpBG,EAAiBH,CAAa,CACvC,EAAG,CA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AAQP,GAASrB,CAAS,CAC5C,CACF,CAEJ,CAAC,CACH,EAEO,SAAS6B,GAAwC,CACtD,IAAMC,KAAU,cAAWhC,CAAuB,EAClD,GAAIgC,GAAW,KACb,MAAM,IAAI,MACR,4EACF,EAEF,OAAOA,CACT,CEhFAC,IAQA,IAAAC,EAAkB,SAMX,SAASC,GAAqB,CACnC,GAAM,CAAE,KAAAC,CAAK,EAAIC,EAAQ,EACnB,CAAE,UAAAC,CAAU,EAAIC,EAAoB,EAE1C,OACE,EAAAC,QAAA,cAACC,EAAA,CAAI,cAAc,UACjB,EAAAD,QAAA,cAACC,EAAA,CAAI,IAAK,GACR,EAAAD,QAAA,cAACE,EAAA,CAAK,KAAK,WACT,EAAAF,QAAA,cAACG,EAAA,IAAY,CACf,EACA,EAAAH,QAAA,cAACI,EAAA,CACC,QAAQ,mDACR,WAAY,CAAC,EAAAJ,QAAA,cAACK,EAAA,CAAK,IAAKP,EAAW,CAAE,EACvC,CACF,EACA,EAAAE,QAAA,cAACC,EAAA,CAAI,IAAK,GACR,EAAAD,QAAA,cAACM,EAAA,IAAS,EACV,EAAAN,QAAA,cAACI,EAAA,CAAM,QAAQ,iCAAiC,CAClD,EACA,EAAAJ,QAAA,cAACC,EAAA,CAAI,IAAK,EAAG,WAAY,EAAG,cAAe,GACzC,EAAAD,QAAA,cAACO,EAAA,IAAY,EACb,EAAAP,QAAA,cAACI,EAAA,CACC,QAAQ,2BACR,OAAQ,CAAE,KAAMR,EAAK,WAAY,EACnC,CACF,EACA,EAAAI,QAAA,cAACC,EAAA,CAAI,cAAe,EAAG,cAAc,UACnC,EAAAD,QAAA,cAACQ,EAAA,IAAe,CAClB,CACF,CAEJ,CHvCO,IAAMC,GAAmB,IAE5B,EAAAC,QAAA,cAACC,EAAA,KACC,EAAAD,QAAA,cAACE,EAAA,KACC,EAAAF,QAAA,cAACG,EAAA,IAAmB,CACtB,CACF","names":["init_esm_shims","init_esm_shims","import_react","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","preview","usePreviewServer","previewServerRef","model","useProjectModel","logger","createLogger","previewServer","preview","getViteConfig","getViteServerUrl","ServeEnvironmentContext","ServeEnvironmentProvider","children","model","useProjectModel","t","useTranslation","site","useSite","arm","useARMClient","createOverride","useSiteOverrideClient","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","armTag","overrides","createSiteOverrides","siteOverrideId","React","Spinner","SiteOverrideProvider","ArmTagProvider","useServeEnvironment","context","init_esm_shims","import_react","ServeCommandScreen","site","useSite","serverUrl","useServeEnvironment","React","Box_default","Text","SuccessIcon","Trans","Link","InfoIcon","PointerIcon","PlatformViewer","ServeCommand","React","SiteProvider","ServeEnvironmentProvider","ServeCommandScreen"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as g}from"./chunk-HDXLQ34N.js";import{a as s}from"./chunk-QOUZ6J7N.js";import{b as c,c as u,h as f,j as l,k as d}from"./chunk-N5D4TFKX.js";import"./chunk-C4SXZWXS.js";import{Ba as n,bb as a}from"./chunk-FMIXY6J5.js";import{c as y,e,f as i}from"./chunk-JXE3LQ2S.js";import{e as b,h as p}from"./chunk-V4TR6DCM.js";p();import{build as w}from"vite";var r=b(y(),1);async function K(o){if(o.components.length===0)throw new e({code:i.NoExtensionsFound(),cause:null});f(o.components);let C=o.components.filter(t=>(0,r.isType)(t,n.Api)||(0,r.isType)(t,n.Event)||(0,r.isType)(t,n.ServicePlugin)),m=g(),_=C.length>0?await w(await u(o,{type:"build",customLogger:m},{appSecret:"__APP_SECRET__",webhookPublicKey:"__WEBHOOK_PUBLIC_KEY__"})).catch(t=>{throw new e({code:i.FailedToBuildApp(),cause:t})}):void 0,B=await w(await c(o,{type:"build",customLogger:m},{baseBackendUrl:a})).catch(t=>{throw new e({code:i.FailedToBuildApp(),cause:t})}),E=await l({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:d(o,{clientBuildOutput:B},{backendBuildOutput:_})});await s({projectFolder:o.projectFolder,manifest:E})}export{K as build};
|
|
4
|
+
//# sourceMappingURL=build-3RXHADZD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/build.ts"],"sourcesContent":["import { build as viteBuild } from 'vite';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { isType } from 'variant';\nimport type { ProjectModel } from './model.js';\nimport { getBackendViteConfig, getClientViteConfig } from './vite/index.js';\nimport { writeAppManifestFile } from './app-manifest/file.js';\nimport { createAppManifest } from './app-manifest/create.js';\nimport { getComponentSourceBuilder } from './app-manifest/component-source.js';\nimport { ConfigType } from './vite/vite-config-options.js';\nimport { validateComponents } from './app-manifest/validate.js';\nimport { API_BASEURL_PLACEHOLDER } from './hosting/upload-application.js';\nimport { DevCenterComponent } from './dev-center/components/dev-center-component.js';\nimport { createLogger } from './vite/logger.js';\n\nexport async function build(projectModel: ProjectModel) {\n // Validate before building the project, to fail fast in case of a validation issue\n if (projectModel.components.length === 0) {\n throw new CliError({\n code: CliErrorCode.NoExtensionsFound(),\n cause: null,\n });\n }\n\n validateComponents(projectModel.components);\n\n const backendComponents = projectModel.components.filter(\n (component) =>\n isType(component, DevCenterComponent.Api) ||\n isType(component, DevCenterComponent.Event) ||\n isType(component, DevCenterComponent.ServicePlugin)\n );\n\n const logger = createLogger();\n\n const backendBuildOutput =\n backendComponents.length > 0\n ? await viteBuild(\n await getBackendViteConfig(\n projectModel,\n { type: ConfigType.build, customLogger: logger },\n {\n appSecret: '__APP_SECRET__',\n webhookPublicKey: '__WEBHOOK_PUBLIC_KEY__',\n }\n )\n ).catch((e: unknown) => {\n throw new CliError({\n code: CliErrorCode.FailedToBuildApp(),\n cause: e,\n });\n })\n : undefined;\n\n const clientBuildOutput = await viteBuild(\n await getClientViteConfig(\n projectModel,\n {\n type: ConfigType.build,\n customLogger: logger,\n },\n {\n baseBackendUrl: API_BASEURL_PLACEHOLDER,\n }\n )\n ).catch((e: unknown) => {\n throw new CliError({\n code: CliErrorCode.FailedToBuildApp(),\n cause: e,\n });\n });\n\n const manifest = await createAppManifest({\n appId: projectModel.config.appId,\n components: projectModel.components,\n sentryDSN: projectModel.config.sentryDSN,\n componentSourceBuilder: getComponentSourceBuilder(\n projectModel,\n { clientBuildOutput },\n { backendBuildOutput }\n ),\n });\n\n await writeAppManifestFile({\n projectFolder: projectModel.projectFolder,\n manifest,\n });\n}\n"],"mappings":";;iUAAAA,IAAA,OAAS,SAASC,MAAiB,OAEnC,IAAAC,EAAuB,SAYvB,eAAsBC,EAAMC,EAA4B,CAEtD,GAAIA,EAAa,WAAW,SAAW,EACrC,MAAM,IAAIC,EAAS,CACjB,KAAMC,EAAa,kBAAkB,EACrC,MAAO,IACT,CAAC,EAGHC,EAAmBH,EAAa,UAAU,EAE1C,IAAMI,EAAoBJ,EAAa,WAAW,OAC/CK,MACC,UAAOA,EAAWC,EAAmB,GAAG,MACxC,UAAOD,EAAWC,EAAmB,KAAK,MAC1C,UAAOD,EAAWC,EAAmB,aAAa,CACtD,EAEMC,EAASC,EAAa,EAEtBC,EACJL,EAAkB,OAAS,EACvB,MAAMM,EACJ,MAAMC,EACJX,EACA,CAAE,aAAwB,aAAcO,CAAO,EAC/C,CACE,UAAW,iBACX,iBAAkB,wBACpB,CACF,CACF,EAAE,MAAOK,GAAe,CACtB,MAAM,IAAIX,EAAS,CACjB,KAAMC,EAAa,iBAAiB,EACpC,MAAOU,CACT,CAAC,CACH,CAAC,EACD,OAEAC,EAAoB,MAAMH,EAC9B,MAAMC,EACJX,EACA,CACE,aACA,aAAcO,CAChB,EACA,CACE,eAAgBO,CAClB,CACF,CACF,EAAE,MAAOF,GAAe,CACtB,MAAM,IAAIX,EAAS,CACjB,KAAMC,EAAa,iBAAiB,EACpC,MAAOU,CACT,CAAC,CACH,CAAC,EAEKG,EAAW,MAAMC,EAAkB,CACvC,MAAOhB,EAAa,OAAO,MAC3B,WAAYA,EAAa,WACzB,UAAWA,EAAa,OAAO,UAC/B,uBAAwBiB,EACtBjB,EACA,CAAE,kBAAAa,CAAkB,EACpB,CAAE,mBAAAJ,CAAmB,CACvB,CACF,CAAC,EAED,MAAMS,EAAqB,CACzB,cAAelB,EAAa,cAC5B,SAAAe,CACF,CAAC,CACH","names":["init_esm_shims","viteBuild","import_variant","build","projectModel","CliError","CliErrorCode","validateComponents","backendComponents","component","DevCenterComponent","logger","createLogger","backendBuildOutput","viteBuild","getViteConfig","e","clientBuildOutput","API_BASEURL_PLACEHOLDER","manifest","createAppManifest","getComponentSourceBuilder","writeAppManifestFile"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{a as n}from"./chunk-5OZZ7R6I.js";import{Y as t}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as n}from"./chunk-5OZZ7R6I.js";import{Y as t}from"./chunk-JXE3LQ2S.js";import{h as r}from"./chunk-V4TR6DCM.js";r();function s(){let e=t(n);return e.t.bind(e)}export{s as a};
|
|
4
|
+
//# sourceMappingURL=chunk-2FB5F5QF.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{b as p}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{b as p}from"./chunk-QOUZ6J7N.js";import{e as i,f as r,g as n}from"./chunk-N5D4TFKX.js";import{h as e}from"./chunk-V4TR6DCM.js";e();var j=async({model:t,arm:a,serveUrl:m,backendServerUrl:o,topologyComponentId:s,monitoringData:d,monitoringComponentId:g})=>{let l=await p(t.projectFolder),c=r(n(i(l,m,o),{id:s,baseApiUrl:o}),{id:g,monitoring:d});return a.createAppRelease(c,t.config.projectId)};export{j as a};
|
|
4
|
+
//# sourceMappingURL=chunk-4BHNJVL2.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{v as u,w as m}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{v as u,w as m}from"./chunk-FMIXY6J5.js";import{g as d,h as f,w as k}from"./chunk-JXE3LQ2S.js";import{e as _,h as t}from"./chunk-V4TR6DCM.js";t();import{randomUUID as N}from"node:crypto";function U(r,o){r.updateDefaults(j(o))}function j(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:N()}}t();import{uptime as J}from"node:process";t();var w=_(k(),1);import L from"node:os";import{platform as V,version as b}from"node:process";function y({cliVersion:r,flow:o}){return{...o?{flow:o}:{},cliVersion:r,isCI:w.default,nodeVersion:b,osName:B(),osVersion:L.release()}}function B(){switch(V){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var x=()=>Math.round(J()*1e3);function h({biLogger:r,command:o,flow:C,cliVersion:S,projectId:p,extensions:i,extraFields:l}){let E=o.opts(),v=o.args,F=new Set(["apiKey"]),c=Object.fromEntries(Object.entries(E).map(([e,s])=>{let O=F.has(e)?"<censored>":s;return[e,O]})),n={command:o.name(),arguments:v.join(","),flags:Object.keys(c).length?JSON.stringify(c):""};return r.report(u({...y({cliVersion:S,flow:C}),...n,...p?{projectId:p}:{},...l?{extraFields:JSON.stringify(l)}:{},isValid:!0})),{succeed(){r.report(m({...n,...i?{extensions:JSON.stringify(i)}:{},duration:x(),isSuccess:!0,isValid:!0}))},failed(e){let s=d(e)?{errorType:f(e)?"SystemError":"UserError",errorName:e.name,errorMessage:e.message}:e instanceof Error?{errorType:"UnknownError",errorName:e.name,errorMessage:e.message}:{errorType:"UnknownError",errorMessage:JSON.stringify(e)};r.report(m({...n,...s,...i?{extensions:JSON.stringify(i)}:{},duration:x(),isSuccess:!1,isValid:!0}))}}}t();export{U as a,h as b};
|
|
4
|
+
//# sourceMappingURL=chunk-6HSUK2A2.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{a as G}from"./chunk-WJTPY35F.js";import{Ta as Ee,Xa as ye,a as Y,b as ge,c as he,d as L,m as xe,u as we}from"./chunk-YMRYABCG.js";import{b as ve,e as N,f as A,m as j,n as F}from"./chunk-2W2YJZP5.js";import{a as x,c as O,e as X,g as d,h as a}from"./chunk-V4TR6DCM.js";var U=O((Vt,Re)=>{"use strict";a();var mr=Object.create,k=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,gr=Object.getOwnPropertyNames,hr=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty,wr=(e,r)=>{for(var t in r)k(e,t,{get:r[t],enumerable:!0})},Oe=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of gr(r))!xr.call(e,n)&&n!==t&&k(e,n,{get:()=>r[n],enumerable:!(o=vr(r,n))||o.enumerable});return e},Er=(e,r,t)=>(t=e!=null?mr(hr(e)):{},Oe(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e)),yr=e=>Oe(k({},"__esModule",{value:!0}),e),Se={};wr(Se,{CLOUDFLARED_VERSION:()=>br,DEFAULT_CLOUDFLARED_BIN:()=>be,RELEASE_BASE:()=>Pr,bin:()=>Pe,use:()=>Sr});Re.exports=yr(Se);var Or=Er(x("node:path")),be=Or.default.join(d,"..","bin",process.platform==="win32"?"cloudflared.exe":"cloudflared"),Pe=process.env.CLOUDFLARED_BIN||be;function Sr(e){Pe=e}var br=process.env.CLOUDFLARED_VERSION||"latest",Pr="https://github.com/cloudflare/cloudflared/releases/"});var Ie=O((kt,Te)=>{"use strict";a();var K=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Cr=Object.getOwnPropertyNames,Tr=Object.prototype.hasOwnProperty,Ir=(e,r)=>{for(var t in r)K(e,t,{get:r[t],enumerable:!0})},Dr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Cr(r))!Tr.call(e,n)&&n!==t&&K(e,n,{get:()=>r[n],enumerable:!(o=Rr(r,n))||o.enumerable});return e},Lr=e=>Dr(K({},"__esModule",{value:!0}),e),Ce={};Ir(Ce,{UnsupportedError:()=>Z});Te.exports=Lr(Ce);var Z=class extends Error{constructor(r){super(r)}}});var qe=O((Mt,Ue)=>{"use strict";a();var Nr=Object.create,B=Object.defineProperty,Ar=Object.getOwnPropertyDescriptor,jr=Object.getOwnPropertyNames,Ur=Object.getPrototypeOf,qr=Object.prototype.hasOwnProperty,$r=(e,r)=>{for(var t in r)B(e,t,{get:r[t],enumerable:!0})},De=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of jr(r))!qr.call(e,n)&&n!==t&&B(e,n,{get:()=>r[n],enumerable:!(o=Ar(r,n))||o.enumerable});return e},Q=(e,r,t)=>(t=e!=null?Nr(Ur(e)):{},De(r||!e||!e.__esModule?B(t,"default",{value:e,enumerable:!0}):t,e)),Vr=e=>De(B({},"__esModule",{value:!0}),e),Le={};$r(Le,{install:()=>Hr,install_linux:()=>Ne,install_macos:()=>Ae,install_windows:()=>je});Ue.exports=Vr(Le);var S=Q(x("node:fs")),q=Q(x("node:path")),Fr=Q(x("node:https")),kr=x("node:child_process"),C=U(),M=Ie(),Br={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},Mr={arm64:"cloudflared-darwin-amd64.tgz",x64:"cloudflared-darwin-amd64.tgz"},Jr={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe"};function ee(e){return e==="latest"?`${C.RELEASE_BASE}latest/download/`:`${C.RELEASE_BASE}download/${e}/`}async function Hr(e,r=C.CLOUDFLARED_VERSION){if(process.platform==="linux")return Ne(e,r);if(process.platform==="darwin")return Ae(e,r);if(process.platform==="win32")return je(e,r);throw new M.UnsupportedError("Unsupported platform: "+process.platform)}async function Ne(e,r=C.CLOUDFLARED_VERSION){let t=Br[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,e),S.default.chmodSync(e,"755"),e}async function Ae(e,r=C.CLOUDFLARED_VERSION){let t=Mr[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,`${e}.tgz`),process.env.VERBOSE&&console.log(`Extracting to ${e}`),(0,kr.execSync)(`tar -xzf ${q.default.basename(`${e}.tgz`)}`,{cwd:q.default.dirname(e)}),S.default.unlinkSync(`${e}.tgz`),S.default.renameSync(`${q.default.dirname(e)}/cloudflared`,e),e}async function je(e,r=C.CLOUDFLARED_VERSION){let t=Jr[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,e),e}function J(e,r,t=0){return t===0?process.env.VERBOSE&&console.log(`Downloading ${e} to ${r}`):process.env.VERBOSE&&console.log(`Redirecting to ${e}`),S.default.existsSync(q.default.dirname(r))||S.default.mkdirSync(q.default.dirname(r),{recursive:!0}),new Promise((o,n)=>{let i=Fr.default.get(e,s=>{if([301,302,303,307,308].includes(s.statusCode)&&s.headers.location!==void 0){i.destroy();let l=s.headers.location;o(J(l,r,t+1));return}if(s.statusCode&&s.statusCode>=200&&s.statusCode<300){let l=S.default.createWriteStream(r);l.on("finish",()=>{l.close(()=>o(r))}),l.on("error",v=>{S.default.unlink(r,()=>n(v))}),s.pipe(l)}else i.destroy(),n(new Error(`HTTP response with status code: ${s.statusCode}`))});i.on("error",s=>{n(s)}),i.end()})}});var te=O((Ht,Ve)=>{"use strict";a();var re=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Wr=Object.getOwnPropertyNames,Xr=Object.prototype.hasOwnProperty,Yr=(e,r)=>{for(var t in r)re(e,t,{get:r[t],enumerable:!0})},Gr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Wr(r))!Xr.call(e,n)&&n!==t&&re(e,n,{get:()=>r[n],enumerable:!(o=zr(r,n))||o.enumerable});return e},Zr=e=>Gr(re({},"__esModule",{value:!0}),e),$e={};Yr($e,{config_regex:()=>at,conn_regex:()=>Kr,connectorID_regex:()=>ot,disconnect_regex:()=>tt,index_regex:()=>rt,ip_regex:()=>Qr,location_regex:()=>et,metrics_regex:()=>st,tunnelID_regex:()=>nt});Ve.exports=Zr($e);var Kr=/connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,Qr=/ip=([0-9.]+)/,et=/location=([A-Za-z0-9]+)/,rt=/connIndex=(\d)/,tt=/Unregistered tunnel connection connIndex=(\d)/i,nt=/tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,ot=/Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,st=/metrics server on ([0-9.:]+\/metrics)/,at=/config="(.+[^\\])"/});var Be=O((Wt,ke)=>{"use strict";a();var ne=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,lt=Object.prototype.hasOwnProperty,ut=(e,r)=>{for(var t in r)ne(e,t,{get:r[t],enumerable:!0})},pt=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ct(r))!lt.call(e,n)&&n!==t&&ne(e,n,{get:()=>r[n],enumerable:!(o=it(r,n))||o.enumerable});return e},dt=e=>pt(ne({},"__esModule",{value:!0}),e),Fe={};ut(Fe,{tunnel:()=>mt});ke.exports=dt(Fe);var _t=x("node:child_process"),ft=U(),H=te();function mt(e={}){let r=["tunnel"];for(let[_,g]of Object.entries(e))typeof g=="string"?r.push(`${_}`,g):typeof g=="number"?r.push(`${_}`,g.toString()):g===null&&r.push(`${_}`);r.length===1&&r.push("--url","localhost:8080");let t=(0,_t.spawn)(ft.bin,r,{stdio:["ignore","pipe","pipe"]});process.env.VERBOSE&&(t.stdout.pipe(process.stdout),t.stderr.pipe(process.stderr));let o=/\|\s+(https?:\/\/[^\s]+)/,n=()=>{},i=()=>{},s=new Promise((..._)=>[n,i]=_),u=[],l=[],v=[];for(let _=0;_<1;_++)v.push(new Promise((...g)=>[u[_],l[_]]=g));let c=_=>{var g;let y=_.toString(),pe=y.match(o);pe&&n(pe[1]);let de=y.match(H.conn_regex),_e=y.match(H.ip_regex),fe=y.match(H.location_regex),me=y.match(H.index_regex);if(de&&_e&&fe&&me){let[,pr]=de,[,dr]=_e,[,_r]=fe,[,fr]=me;(g=u[+fr])==null||g.call(u,{id:pr,ip:dr,location:_r})}};return t.stdout.on("data",c).on("error",i),t.stderr.on("data",c).on("error",i),{url:s,connections:v,child:t,stop:()=>t.kill("SIGINT")}}});var Qe=O((Yt,Ke)=>{"use strict";a();var vt=Object.create,z=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=Object.getOwnPropertyNames,xt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty,Et=(e,r)=>{for(var t in r)z(e,t,{get:r[t],enumerable:!0})},Me=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ht(r))!wt.call(e,n)&&n!==t&&z(e,n,{get:()=>r[n],enumerable:!(o=gt(r,n))||o.enumerable});return e},Je=(e,r,t)=>(t=e!=null?vt(xt(e)):{},Me(r||!e||!e.__esModule?z(t,"default",{value:e,enumerable:!0}):t,e)),yt=e=>Me(z({},"__esModule",{value:!0}),e),He={};Et(He,{AlreadyInstalledError:()=>$,LINUX_SERVICE_PATH:()=>P,MACOS_SERVICE_PATH:()=>w,NotInstalledError:()=>R,clean:()=>Ze,current:()=>Ge,err:()=>ce,exists:()=>E,identifier:()=>b,install:()=>We,journal:()=>le,log:()=>Ye,service:()=>Ot,service_name:()=>ie,uninstall:()=>Xe});Ke.exports=yt(He);var oe=Je(x("node:os")),m=Je(x("node:fs")),ae=x("node:child_process"),ze=U(),p=te(),b="com.cloudflare.cloudflared",ie="cloudflared.service",w={PLIST:se()?`/Library/LaunchDaemons/${b}.plist`:`${oe.default.homedir()}/Library/LaunchAgents/${b}.plist`,OUT:se()?`/Library/Logs/${b}.out.log`:`${oe.default.homedir()}/Library/Logs/${b}.out.log`,ERR:se()?`/Library/Logs/${b}.err.log`:`${oe.default.homedir()}/Library/Logs/${b}.err.log`},P={SYSTEMD:`/etc/systemd/system/${ie}`,SERVICE:"/etc/init.d/cloudflared",SERVICE_OUT:"/var/log/cloudflared.log",SERVICE_ERR:"/var/log/cloudflared.err"},Ot={install:We,uninstall:Xe,exists:E,log:Ye,err:ce,current:Ge,clean:Ze,journal:le},$=class extends Error{constructor(){super("service is already installed")}},R=class extends Error{constructor(){super("service is not installed")}};function We(e){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(E())throw new $;let r=["service","install"];e&&r.push(e);let t=(0,ae.spawnSync)(ze.bin,r);if(t.status!==0)throw new Error(`service install failed: ${t.stderr.toString()}`)}function Xe(){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!E())throw new R;let e=(0,ae.spawnSync)(ze.bin,["service","uninstall"]);if(e.status!==0)throw new Error(`service uninstall failed: ${e.stderr.toString()}`);process.platform==="darwin"?(m.default.rmSync(w.OUT),m.default.rmSync(w.ERR)):process.platform==="linux"&&!T()&&(m.default.rmSync(P.SERVICE_OUT),m.default.rmSync(P.SERVICE_ERR))}function Ye(){if(!E())throw new R;if(process.platform==="darwin")return m.default.readFileSync(w.OUT,"utf8");if(process.platform==="linux"&&!T())return m.default.readFileSync(P.SERVICE_OUT,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function ce(){if(!E())throw new R;if(process.platform==="darwin")return m.default.readFileSync(w.ERR,"utf8");if(process.platform==="linux"&&!T())return m.default.readFileSync(P.SERVICE_ERR,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function le(e=300){if(process.platform==="linux"&&T()){let r=["-u",ie,"-o","cat","-n",e.toString()];return(0,ae.spawnSync)("journalctl",r).stdout.toString()}throw new Error(`Not Implemented on platform ${process.platform}`)}function Ge(){var e,r,t,o;if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!E())throw new R;let n=T()?le():ce(),i="",s="",u=[],l="",v={};for(let c of n.split(`
|
|
4
|
-
`))try{if(c.match(p.tunnelID_regex))i=((e=c.match(p.tunnelID_regex))==null?void 0:e[1])??"";else if(c.match(p.connectorID_regex))s=((r=c.match(p.connectorID_regex))==null?void 0:r[1])??"";else if(c.match(p.conn_regex)&&c.match(p.location_regex)&&c.match(p.ip_regex)&&c.match(p.index_regex)){let[,h]=c.match(p.conn_regex)??[],[,_]=c.match(p.location_regex)??[],[,g]=c.match(p.ip_regex)??[],[,y]=c.match(p.index_regex)??[];u[parseInt(y)]={id:h,ip:g,location:_}}else if(c.match(p.disconnect_regex)){let[,h]=c.match(p.disconnect_regex)??[];parseInt(h)in u&&(u[parseInt(h)]={id:"",ip:"",location:""})}else c.match(p.metrics_regex)?l=((t=c.match(p.metrics_regex))==null?void 0:t[1])??"":c.match(p.config_regex)&&(v=JSON.parse(((o=c.match(p.config_regex))==null?void 0:o[1].replace(/\\/g,""))??"{}"))}catch(h){process.env.VERBOSE&&console.error("log parsing failed",h)}return{tunnelID:i,connectorID:s,connections:u,metrics:l,config:v}}function Ze(){if(process.platform!=="darwin")throw new Error(`Not Implemented on platform ${process.platform}`);if(E())throw new $;m.default.rmSync(w.OUT,{force:!0}),m.default.rmSync(w.ERR,{force:!0})}function E(){if(process.platform==="darwin")return m.default.existsSync(w.PLIST);if(process.platform==="linux")return T()?m.default.existsSync(P.SYSTEMD):m.default.existsSync(P.SERVICE);throw new Error(`Not Implemented on platform ${process.platform}`)}function se(){var e;return((e=process.getuid)==null?void 0:e.call(process))===0}function T(){return process.platform==="linux"&&m.default.existsSync("/run/systemd/system")}});var tr=O((Zt,rr)=>{"use strict";a();var ue=Object.defineProperty,St=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Pt=Object.prototype.hasOwnProperty,Rt=(e,r)=>{for(var t in r)ue(e,t,{get:r[t],enumerable:!0})},Ct=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of bt(r))!Pt.call(e,n)&&n!==t&&ue(e,n,{get:()=>r[n],enumerable:!(o=St(r,n))||o.enumerable});return e},Tt=e=>Ct(ue({},"__esModule",{value:!0}),e),er={};Rt(er,{AlreadyInstalledError:()=>V.AlreadyInstalledError,MACOS_SERVICE_PATH:()=>V.MACOS_SERVICE_PATH,NotInstalledError:()=>V.NotInstalledError,bin:()=>It.bin,identifier:()=>V.identifier,install:()=>Dt.install,service:()=>V.service,tunnel:()=>Lt.tunnel});rr.exports=Tt(er);var It=U(),Dt=qe(),Lt=Be(),V=Qe()});a();var D=X(ve(),1);a();import{dirname as Nt}from"node:path";var I=X(tr(),1);async function nr(e,r){let{localTunnel:t}=F();if(!t&&!await xe(I.bin))try{await(0,I.install)(I.bin)}catch(s){let u=s;throw s instanceof Error&&u.code==="EACCES"?new N({code:A.FailedInstallCloudflareNoAccess({path:Nt(u.path)}),cause:s}):s}let o=await r.createTunnel({port:e}),n=`http${t?"":"s"}://${o.domain}`,i=new Promise((s,u)=>{let l=t?G("echo",[o.domain,o.token],{detached:!0}):G(I.bin,["tunnel","run","--token",o.token]),v=()=>{l.kill()},c=async h=>{h.toString().match(o.domain)?.[0]&&s({domain:n,close:v})};l.stderr?.on("data",c),l.stdout?.on("data",c),l.on("error",h=>{u(h)})});return{domain:n,close:async()=>(await i).close()}}a();var or=e=>({tunnel:()=>{let r=Date.now();return{finish:({isSuccess:t,failureReason:o})=>{e.report(ye({isSuccess:t,failureReason:o,tunnelCreationTime:Date.now()-r}))}}}});a();var lr=X(ve(),1);a();a();var At={},jt={},Ut={},qt={};function sr(e){var r={"bo._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"wixbo.ai":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"manage._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}]};return ge(Object.assign(e,{domainToMappings:r}))}function ar(e){var r=L(At,{}),t=r.toJSON,o=r.fromJSON,n=L(jt,{}).fromJSON;function i(s){var u=s.host,l=t(e),v={entityFqdn:"wix.apps.hosting.v1.deployment",method:"POST",methodFqn:"wix.apps.hosting.v1.BackendService.CreateTunnel",url:sr({protoPath:"/v1/tunnel",data:l,host:u}),data:l,transformResponse:n};return v}return i.fromReq=o,i.__isAmbassador=!0,i}function ir(e){var r=L(Ut,{}),t=r.toJSON,o=r.fromJSON,n=L(qt,{}).fromJSON;function i(s){var u=s.host,l=t(e),v={entityFqdn:"wix.apps.hosting.v1.deployment",method:"DELETE",methodFqn:"wix.apps.hosting.v1.BackendService.DeleteTunnel",url:sr({protoPath:"/v1/tunnel",data:l,host:u}),params:he(l),transformResponse:n};return v}return i.fromReq=o,i.__isAmbassador=!0,i}a();var cr=j.object({id:j.string(),token:j.string(),domain:j.string()});var W=class{constructor(r){this.httpClient=r;let{minRetryTimeout:t}=F();this.retryOptions={retries:3,minTimeout:t,maxTimeout:3*1e3}}retryOptions;createTunnel=async({port:r})=>{try{let{data:t}=await Y(()=>this.httpClient.request(ar({port:r})),this.retryOptions);return cr.parse(t)}catch(t){throw new N({code:A.FailedToCreateTunnel(),cause:t})}};deleteTunnel=async r=>{try{await Y(()=>this.httpClient.request(ir({id:r})),this.retryOptions)}catch(t){throw new N({code:A.FailedToDeleteTunnel(),cause:t})}}};function ur(){let e=Ee({type:"backoffice"});return(0,lr.useMemo)(()=>new W(e),[e])}function $t(){let e=(0,D.useRef)(),r=ur(),t=we();return(0,D.useEffect)(()=>()=>{e.current?.close()},[]),(0,D.useCallback)(async o=>{let i=or(t).tunnel();try{let s=await nr(o,r);return e.current=s,i.finish({isSuccess:!0}),{url:s.domain}}catch(s){throw i.finish({isSuccess:!1,failureReason:s instanceof Error?s.message:"Unknown error"}),s}},[r,t])}a();export{$t as a};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as G}from"./chunk-WJTPY35F.js";import{Ua as Ee,Ya as ye,a as Y,b as ge,c as he,d as L,m as xe,u as we}from"./chunk-FMIXY6J5.js";import{b as ve,e as N,f as A,m as j,n as F}from"./chunk-JXE3LQ2S.js";import{a as x,c as O,e as X,g as d,h as a}from"./chunk-V4TR6DCM.js";var U=O((Vt,Re)=>{"use strict";a();var mr=Object.create,k=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,gr=Object.getOwnPropertyNames,hr=Object.getPrototypeOf,xr=Object.prototype.hasOwnProperty,wr=(e,r)=>{for(var t in r)k(e,t,{get:r[t],enumerable:!0})},Oe=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of gr(r))!xr.call(e,n)&&n!==t&&k(e,n,{get:()=>r[n],enumerable:!(o=vr(r,n))||o.enumerable});return e},Er=(e,r,t)=>(t=e!=null?mr(hr(e)):{},Oe(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e)),yr=e=>Oe(k({},"__esModule",{value:!0}),e),Se={};wr(Se,{CLOUDFLARED_VERSION:()=>br,DEFAULT_CLOUDFLARED_BIN:()=>be,RELEASE_BASE:()=>Pr,bin:()=>Pe,use:()=>Sr});Re.exports=yr(Se);var Or=Er(x("node:path")),be=Or.default.join(d,"..","bin",process.platform==="win32"?"cloudflared.exe":"cloudflared"),Pe=process.env.CLOUDFLARED_BIN||be;function Sr(e){Pe=e}var br=process.env.CLOUDFLARED_VERSION||"latest",Pr="https://github.com/cloudflare/cloudflared/releases/"});var Ie=O((kt,Te)=>{"use strict";a();var K=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Cr=Object.getOwnPropertyNames,Tr=Object.prototype.hasOwnProperty,Ir=(e,r)=>{for(var t in r)K(e,t,{get:r[t],enumerable:!0})},Dr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Cr(r))!Tr.call(e,n)&&n!==t&&K(e,n,{get:()=>r[n],enumerable:!(o=Rr(r,n))||o.enumerable});return e},Lr=e=>Dr(K({},"__esModule",{value:!0}),e),Ce={};Ir(Ce,{UnsupportedError:()=>Z});Te.exports=Lr(Ce);var Z=class extends Error{constructor(r){super(r)}}});var qe=O((Mt,Ue)=>{"use strict";a();var Nr=Object.create,B=Object.defineProperty,Ar=Object.getOwnPropertyDescriptor,jr=Object.getOwnPropertyNames,Ur=Object.getPrototypeOf,qr=Object.prototype.hasOwnProperty,$r=(e,r)=>{for(var t in r)B(e,t,{get:r[t],enumerable:!0})},De=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of jr(r))!qr.call(e,n)&&n!==t&&B(e,n,{get:()=>r[n],enumerable:!(o=Ar(r,n))||o.enumerable});return e},Q=(e,r,t)=>(t=e!=null?Nr(Ur(e)):{},De(r||!e||!e.__esModule?B(t,"default",{value:e,enumerable:!0}):t,e)),Vr=e=>De(B({},"__esModule",{value:!0}),e),Le={};$r(Le,{install:()=>Hr,install_linux:()=>Ne,install_macos:()=>Ae,install_windows:()=>je});Ue.exports=Vr(Le);var S=Q(x("node:fs")),q=Q(x("node:path")),Fr=Q(x("node:https")),kr=x("node:child_process"),C=U(),M=Ie(),Br={arm64:"cloudflared-linux-arm64",arm:"cloudflared-linux-arm",x64:"cloudflared-linux-amd64",ia32:"cloudflared-linux-386"},Mr={arm64:"cloudflared-darwin-amd64.tgz",x64:"cloudflared-darwin-amd64.tgz"},Jr={x64:"cloudflared-windows-amd64.exe",ia32:"cloudflared-windows-386.exe"};function ee(e){return e==="latest"?`${C.RELEASE_BASE}latest/download/`:`${C.RELEASE_BASE}download/${e}/`}async function Hr(e,r=C.CLOUDFLARED_VERSION){if(process.platform==="linux")return Ne(e,r);if(process.platform==="darwin")return Ae(e,r);if(process.platform==="win32")return je(e,r);throw new M.UnsupportedError("Unsupported platform: "+process.platform)}async function Ne(e,r=C.CLOUDFLARED_VERSION){let t=Br[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,e),S.default.chmodSync(e,"755"),e}async function Ae(e,r=C.CLOUDFLARED_VERSION){let t=Mr[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,`${e}.tgz`),process.env.VERBOSE&&console.log(`Extracting to ${e}`),(0,kr.execSync)(`tar -xzf ${q.default.basename(`${e}.tgz`)}`,{cwd:q.default.dirname(e)}),S.default.unlinkSync(`${e}.tgz`),S.default.renameSync(`${q.default.dirname(e)}/cloudflared`,e),e}async function je(e,r=C.CLOUDFLARED_VERSION){let t=Jr[process.arch];if(t===void 0)throw new M.UnsupportedError("Unsupported architecture: "+process.arch);return await J(ee(r)+t,e),e}function J(e,r,t=0){return t===0?process.env.VERBOSE&&console.log(`Downloading ${e} to ${r}`):process.env.VERBOSE&&console.log(`Redirecting to ${e}`),S.default.existsSync(q.default.dirname(r))||S.default.mkdirSync(q.default.dirname(r),{recursive:!0}),new Promise((o,n)=>{let i=Fr.default.get(e,s=>{if([301,302,303,307,308].includes(s.statusCode)&&s.headers.location!==void 0){i.destroy();let l=s.headers.location;o(J(l,r,t+1));return}if(s.statusCode&&s.statusCode>=200&&s.statusCode<300){let l=S.default.createWriteStream(r);l.on("finish",()=>{l.close(()=>o(r))}),l.on("error",v=>{S.default.unlink(r,()=>n(v))}),s.pipe(l)}else i.destroy(),n(new Error(`HTTP response with status code: ${s.statusCode}`))});i.on("error",s=>{n(s)}),i.end()})}});var te=O((Ht,Ve)=>{"use strict";a();var re=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Wr=Object.getOwnPropertyNames,Xr=Object.prototype.hasOwnProperty,Yr=(e,r)=>{for(var t in r)re(e,t,{get:r[t],enumerable:!0})},Gr=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Wr(r))!Xr.call(e,n)&&n!==t&&re(e,n,{get:()=>r[n],enumerable:!(o=zr(r,n))||o.enumerable});return e},Zr=e=>Gr(re({},"__esModule",{value:!0}),e),$e={};Yr($e,{config_regex:()=>at,conn_regex:()=>Kr,connectorID_regex:()=>ot,disconnect_regex:()=>tt,index_regex:()=>rt,ip_regex:()=>Qr,location_regex:()=>et,metrics_regex:()=>st,tunnelID_regex:()=>nt});Ve.exports=Zr($e);var Kr=/connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,Qr=/ip=([0-9.]+)/,et=/location=([A-Za-z0-9]+)/,rt=/connIndex=(\d)/,tt=/Unregistered tunnel connection connIndex=(\d)/i,nt=/tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,ot=/Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i,st=/metrics server on ([0-9.:]+\/metrics)/,at=/config="(.+[^\\])"/});var Be=O((Wt,ke)=>{"use strict";a();var ne=Object.defineProperty,it=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,lt=Object.prototype.hasOwnProperty,ut=(e,r)=>{for(var t in r)ne(e,t,{get:r[t],enumerable:!0})},pt=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ct(r))!lt.call(e,n)&&n!==t&&ne(e,n,{get:()=>r[n],enumerable:!(o=it(r,n))||o.enumerable});return e},dt=e=>pt(ne({},"__esModule",{value:!0}),e),Fe={};ut(Fe,{tunnel:()=>mt});ke.exports=dt(Fe);var _t=x("node:child_process"),ft=U(),H=te();function mt(e={}){let r=["tunnel"];for(let[_,g]of Object.entries(e))typeof g=="string"?r.push(`${_}`,g):typeof g=="number"?r.push(`${_}`,g.toString()):g===null&&r.push(`${_}`);r.length===1&&r.push("--url","localhost:8080");let t=(0,_t.spawn)(ft.bin,r,{stdio:["ignore","pipe","pipe"]});process.env.VERBOSE&&(t.stdout.pipe(process.stdout),t.stderr.pipe(process.stderr));let o=/\|\s+(https?:\/\/[^\s]+)/,n=()=>{},i=()=>{},s=new Promise((..._)=>[n,i]=_),u=[],l=[],v=[];for(let _=0;_<1;_++)v.push(new Promise((...g)=>[u[_],l[_]]=g));let c=_=>{var g;let y=_.toString(),pe=y.match(o);pe&&n(pe[1]);let de=y.match(H.conn_regex),_e=y.match(H.ip_regex),fe=y.match(H.location_regex),me=y.match(H.index_regex);if(de&&_e&&fe&&me){let[,pr]=de,[,dr]=_e,[,_r]=fe,[,fr]=me;(g=u[+fr])==null||g.call(u,{id:pr,ip:dr,location:_r})}};return t.stdout.on("data",c).on("error",i),t.stderr.on("data",c).on("error",i),{url:s,connections:v,child:t,stop:()=>t.kill("SIGINT")}}});var Qe=O((Yt,Ke)=>{"use strict";a();var vt=Object.create,z=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,ht=Object.getOwnPropertyNames,xt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty,Et=(e,r)=>{for(var t in r)z(e,t,{get:r[t],enumerable:!0})},Me=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ht(r))!wt.call(e,n)&&n!==t&&z(e,n,{get:()=>r[n],enumerable:!(o=gt(r,n))||o.enumerable});return e},Je=(e,r,t)=>(t=e!=null?vt(xt(e)):{},Me(r||!e||!e.__esModule?z(t,"default",{value:e,enumerable:!0}):t,e)),yt=e=>Me(z({},"__esModule",{value:!0}),e),He={};Et(He,{AlreadyInstalledError:()=>$,LINUX_SERVICE_PATH:()=>P,MACOS_SERVICE_PATH:()=>w,NotInstalledError:()=>R,clean:()=>Ze,current:()=>Ge,err:()=>ce,exists:()=>E,identifier:()=>b,install:()=>We,journal:()=>le,log:()=>Ye,service:()=>Ot,service_name:()=>ie,uninstall:()=>Xe});Ke.exports=yt(He);var oe=Je(x("node:os")),m=Je(x("node:fs")),ae=x("node:child_process"),ze=U(),p=te(),b="com.cloudflare.cloudflared",ie="cloudflared.service",w={PLIST:se()?`/Library/LaunchDaemons/${b}.plist`:`${oe.default.homedir()}/Library/LaunchAgents/${b}.plist`,OUT:se()?`/Library/Logs/${b}.out.log`:`${oe.default.homedir()}/Library/Logs/${b}.out.log`,ERR:se()?`/Library/Logs/${b}.err.log`:`${oe.default.homedir()}/Library/Logs/${b}.err.log`},P={SYSTEMD:`/etc/systemd/system/${ie}`,SERVICE:"/etc/init.d/cloudflared",SERVICE_OUT:"/var/log/cloudflared.log",SERVICE_ERR:"/var/log/cloudflared.err"},Ot={install:We,uninstall:Xe,exists:E,log:Ye,err:ce,current:Ge,clean:Ze,journal:le},$=class extends Error{constructor(){super("service is already installed")}},R=class extends Error{constructor(){super("service is not installed")}};function We(e){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(E())throw new $;let r=["service","install"];e&&r.push(e);let t=(0,ae.spawnSync)(ze.bin,r);if(t.status!==0)throw new Error(`service install failed: ${t.stderr.toString()}`)}function Xe(){if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!E())throw new R;let e=(0,ae.spawnSync)(ze.bin,["service","uninstall"]);if(e.status!==0)throw new Error(`service uninstall failed: ${e.stderr.toString()}`);process.platform==="darwin"?(m.default.rmSync(w.OUT),m.default.rmSync(w.ERR)):process.platform==="linux"&&!T()&&(m.default.rmSync(P.SERVICE_OUT),m.default.rmSync(P.SERVICE_ERR))}function Ye(){if(!E())throw new R;if(process.platform==="darwin")return m.default.readFileSync(w.OUT,"utf8");if(process.platform==="linux"&&!T())return m.default.readFileSync(P.SERVICE_OUT,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function ce(){if(!E())throw new R;if(process.platform==="darwin")return m.default.readFileSync(w.ERR,"utf8");if(process.platform==="linux"&&!T())return m.default.readFileSync(P.SERVICE_ERR,"utf8");throw new Error(`Not Implemented on platform ${process.platform}`)}function le(e=300){if(process.platform==="linux"&&T()){let r=["-u",ie,"-o","cat","-n",e.toString()];return(0,ae.spawnSync)("journalctl",r).stdout.toString()}throw new Error(`Not Implemented on platform ${process.platform}`)}function Ge(){var e,r,t,o;if(!["darwin","linux"].includes(process.platform))throw new Error(`Not Implemented on platform ${process.platform}`);if(!E())throw new R;let n=T()?le():ce(),i="",s="",u=[],l="",v={};for(let c of n.split(`
|
|
4
|
+
`))try{if(c.match(p.tunnelID_regex))i=((e=c.match(p.tunnelID_regex))==null?void 0:e[1])??"";else if(c.match(p.connectorID_regex))s=((r=c.match(p.connectorID_regex))==null?void 0:r[1])??"";else if(c.match(p.conn_regex)&&c.match(p.location_regex)&&c.match(p.ip_regex)&&c.match(p.index_regex)){let[,h]=c.match(p.conn_regex)??[],[,_]=c.match(p.location_regex)??[],[,g]=c.match(p.ip_regex)??[],[,y]=c.match(p.index_regex)??[];u[parseInt(y)]={id:h,ip:g,location:_}}else if(c.match(p.disconnect_regex)){let[,h]=c.match(p.disconnect_regex)??[];parseInt(h)in u&&(u[parseInt(h)]={id:"",ip:"",location:""})}else c.match(p.metrics_regex)?l=((t=c.match(p.metrics_regex))==null?void 0:t[1])??"":c.match(p.config_regex)&&(v=JSON.parse(((o=c.match(p.config_regex))==null?void 0:o[1].replace(/\\/g,""))??"{}"))}catch(h){process.env.VERBOSE&&console.error("log parsing failed",h)}return{tunnelID:i,connectorID:s,connections:u,metrics:l,config:v}}function Ze(){if(process.platform!=="darwin")throw new Error(`Not Implemented on platform ${process.platform}`);if(E())throw new $;m.default.rmSync(w.OUT,{force:!0}),m.default.rmSync(w.ERR,{force:!0})}function E(){if(process.platform==="darwin")return m.default.existsSync(w.PLIST);if(process.platform==="linux")return T()?m.default.existsSync(P.SYSTEMD):m.default.existsSync(P.SERVICE);throw new Error(`Not Implemented on platform ${process.platform}`)}function se(){var e;return((e=process.getuid)==null?void 0:e.call(process))===0}function T(){return process.platform==="linux"&&m.default.existsSync("/run/systemd/system")}});var tr=O((Zt,rr)=>{"use strict";a();var ue=Object.defineProperty,St=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,Pt=Object.prototype.hasOwnProperty,Rt=(e,r)=>{for(var t in r)ue(e,t,{get:r[t],enumerable:!0})},Ct=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of bt(r))!Pt.call(e,n)&&n!==t&&ue(e,n,{get:()=>r[n],enumerable:!(o=St(r,n))||o.enumerable});return e},Tt=e=>Ct(ue({},"__esModule",{value:!0}),e),er={};Rt(er,{AlreadyInstalledError:()=>V.AlreadyInstalledError,MACOS_SERVICE_PATH:()=>V.MACOS_SERVICE_PATH,NotInstalledError:()=>V.NotInstalledError,bin:()=>It.bin,identifier:()=>V.identifier,install:()=>Dt.install,service:()=>V.service,tunnel:()=>Lt.tunnel});rr.exports=Tt(er);var It=U(),Dt=qe(),Lt=Be(),V=Qe()});a();var D=X(ve(),1);a();import{dirname as Nt}from"node:path";var I=X(tr(),1);async function nr(e,r){let{localTunnel:t}=F();if(!t&&!await xe(I.bin))try{await(0,I.install)(I.bin)}catch(s){let u=s;throw s instanceof Error&&u.code==="EACCES"?new N({code:A.FailedInstallCloudflareNoAccess({path:Nt(u.path)}),cause:s}):s}let o=await r.createTunnel({port:e}),n=`http${t?"":"s"}://${o.domain}`,i=new Promise((s,u)=>{let l=t?G("echo",[o.domain,o.token],{detached:!0}):G(I.bin,["tunnel","run","--token",o.token]),v=()=>{l.kill()},c=async h=>{h.toString().match(o.domain)?.[0]&&s({domain:n,close:v})};l.stderr?.on("data",c),l.stdout?.on("data",c),l.on("error",h=>{u(h)})});return{domain:n,close:async()=>(await i).close()}}a();var or=e=>({tunnel:()=>{let r=Date.now();return{finish:({isSuccess:t,failureReason:o})=>{e.report(ye({isSuccess:t,failureReason:o,tunnelCreationTime:Date.now()-r}))}}}});a();var lr=X(ve(),1);a();a();var At={},jt={},Ut={},qt={};function sr(e){var r={"bo._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"wixbo.ai":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"wix-bo.com":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}],"manage._base_domain_":[{srcPath:"/_serverless/wix-app-backend-manager",destPath:""}]};return ge(Object.assign(e,{domainToMappings:r}))}function ar(e){var r=L(At,{}),t=r.toJSON,o=r.fromJSON,n=L(jt,{}).fromJSON;function i(s){var u=s.host,l=t(e),v={entityFqdn:"wix.apps.hosting.v1.deployment",method:"POST",methodFqn:"wix.apps.hosting.v1.BackendService.CreateTunnel",url:sr({protoPath:"/v1/tunnel",data:l,host:u}),data:l,transformResponse:n};return v}return i.fromReq=o,i.__isAmbassador=!0,i}function ir(e){var r=L(Ut,{}),t=r.toJSON,o=r.fromJSON,n=L(qt,{}).fromJSON;function i(s){var u=s.host,l=t(e),v={entityFqdn:"wix.apps.hosting.v1.deployment",method:"DELETE",methodFqn:"wix.apps.hosting.v1.BackendService.DeleteTunnel",url:sr({protoPath:"/v1/tunnel",data:l,host:u}),params:he(l),transformResponse:n};return v}return i.fromReq=o,i.__isAmbassador=!0,i}a();var cr=j.object({id:j.string(),token:j.string(),domain:j.string()});var W=class{constructor(r){this.httpClient=r;let{minRetryTimeout:t}=F();this.retryOptions={retries:3,minTimeout:t,maxTimeout:3*1e3}}retryOptions;createTunnel=async({port:r})=>{try{let{data:t}=await Y(()=>this.httpClient.request(ar({port:r})),this.retryOptions);return cr.parse(t)}catch(t){throw new N({code:A.FailedToCreateTunnel(),cause:t})}};deleteTunnel=async r=>{try{await Y(()=>this.httpClient.request(ir({id:r})),this.retryOptions)}catch(t){throw new N({code:A.FailedToDeleteTunnel(),cause:t})}}};function ur(){let e=Ee({type:"backoffice"});return(0,lr.useMemo)(()=>new W(e),[e])}function $t(){let e=(0,D.useRef)(),r=ur(),t=we();return(0,D.useEffect)(()=>()=>{e.current?.close()},[]),(0,D.useCallback)(async o=>{let i=or(t).tunnel();try{let s=await nr(o,r);return e.current=s,i.finish({isSuccess:!0}),{url:s.domain}}catch(s){throw i.finish({isSuccess:!1,failureReason:s instanceof Error?s.message:"Unknown error"}),s}},[r,t])}a();export{$t as a};
|
|
5
|
+
//# sourceMappingURL=chunk-7VOKCPZP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/cloudflared/lib/constants.js","../../../node_modules/cloudflared/lib/error.js","../../../node_modules/cloudflared/lib/install.js","../../../node_modules/cloudflared/lib/regex.js","../../../node_modules/cloudflared/lib/tunnel.js","../../../node_modules/cloudflared/lib/service.js","../../../node_modules/cloudflared/lib/lib.js","../../cli-tunnel/src/useTunnel.ts","../../cli-tunnel/src/tunnel.ts","../../cli-tunnel/src/bi/events.ts","../../cli-tunnel/src/useTunnelClient.ts","../../cli-tunnel/src/client.ts","../../../node_modules/@wix/ambassador-apps-hosting-v1-deployment/http.impl.ts","../../cli-tunnel/src/schemas.ts","../../cli-tunnel/src/index.ts"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar constants_exports = {};\n__export(constants_exports, {\n CLOUDFLARED_VERSION: () => CLOUDFLARED_VERSION,\n DEFAULT_CLOUDFLARED_BIN: () => DEFAULT_CLOUDFLARED_BIN,\n RELEASE_BASE: () => RELEASE_BASE,\n bin: () => bin,\n use: () => use\n});\nmodule.exports = __toCommonJS(constants_exports);\nvar import_node_path = __toESM(require(\"node:path\"));\nconst DEFAULT_CLOUDFLARED_BIN = import_node_path.default.join(__dirname, \"..\", \"bin\", process.platform === \"win32\" ? \"cloudflared.exe\" : \"cloudflared\");\nlet bin = process.env.CLOUDFLARED_BIN || DEFAULT_CLOUDFLARED_BIN;\nfunction use(executable) {\n bin = executable;\n}\nconst CLOUDFLARED_VERSION = process.env.CLOUDFLARED_VERSION || \"latest\";\nconst RELEASE_BASE = \"https://github.com/cloudflare/cloudflared/releases/\";\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n CLOUDFLARED_VERSION,\n DEFAULT_CLOUDFLARED_BIN,\n RELEASE_BASE,\n bin,\n use\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar error_exports = {};\n__export(error_exports, {\n UnsupportedError: () => UnsupportedError\n});\nmodule.exports = __toCommonJS(error_exports);\nclass UnsupportedError extends Error {\n constructor(message) {\n super(message);\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n UnsupportedError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar install_exports = {};\n__export(install_exports, {\n install: () => install,\n install_linux: () => install_linux,\n install_macos: () => install_macos,\n install_windows: () => install_windows\n});\nmodule.exports = __toCommonJS(install_exports);\nvar import_node_fs = __toESM(require(\"node:fs\"));\nvar import_node_path = __toESM(require(\"node:path\"));\nvar import_node_https = __toESM(require(\"node:https\"));\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants\");\nvar import_error = require(\"./error\");\nconst LINUX_URL = {\n arm64: \"cloudflared-linux-arm64\",\n arm: \"cloudflared-linux-arm\",\n x64: \"cloudflared-linux-amd64\",\n ia32: \"cloudflared-linux-386\"\n};\nconst MACOS_URL = {\n arm64: \"cloudflared-darwin-amd64.tgz\",\n x64: \"cloudflared-darwin-amd64.tgz\"\n};\nconst WINDOWS_URL = {\n x64: \"cloudflared-windows-amd64.exe\",\n ia32: \"cloudflared-windows-386.exe\"\n};\nfunction resolve_base(version) {\n if (version === \"latest\") {\n return `${import_constants.RELEASE_BASE}latest/download/`;\n }\n return `${import_constants.RELEASE_BASE}download/${version}/`;\n}\nasync function install(to, version = import_constants.CLOUDFLARED_VERSION) {\n if (process.platform === \"linux\") {\n return install_linux(to, version);\n } else if (process.platform === \"darwin\") {\n return install_macos(to, version);\n } else if (process.platform === \"win32\") {\n return install_windows(to, version);\n } else {\n throw new import_error.UnsupportedError(\"Unsupported platform: \" + process.platform);\n }\n}\nasync function install_linux(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = LINUX_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, to);\n import_node_fs.default.chmodSync(to, \"755\");\n return to;\n}\nasync function install_macos(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = MACOS_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, `${to}.tgz`);\n process.env.VERBOSE && console.log(`Extracting to ${to}`);\n (0, import_node_child_process.execSync)(`tar -xzf ${import_node_path.default.basename(`${to}.tgz`)}`, { cwd: import_node_path.default.dirname(to) });\n import_node_fs.default.unlinkSync(`${to}.tgz`);\n import_node_fs.default.renameSync(`${import_node_path.default.dirname(to)}/cloudflared`, to);\n return to;\n}\nasync function install_windows(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = WINDOWS_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, to);\n return to;\n}\nfunction download(url, to, redirect = 0) {\n if (redirect === 0) {\n process.env.VERBOSE && console.log(`Downloading ${url} to ${to}`);\n } else {\n process.env.VERBOSE && console.log(`Redirecting to ${url}`);\n }\n if (!import_node_fs.default.existsSync(import_node_path.default.dirname(to))) {\n import_node_fs.default.mkdirSync(import_node_path.default.dirname(to), { recursive: true });\n }\n return new Promise((resolve, reject) => {\n const request = import_node_https.default.get(url, (res) => {\n const redirect_code = [301, 302, 303, 307, 308];\n if (redirect_code.includes(res.statusCode) && res.headers.location !== void 0) {\n request.destroy();\n const redirection = res.headers.location;\n resolve(download(redirection, to, redirect + 1));\n return;\n }\n if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {\n const file = import_node_fs.default.createWriteStream(to);\n file.on(\"finish\", () => {\n file.close(() => resolve(to));\n });\n file.on(\"error\", (err) => {\n import_node_fs.default.unlink(to, () => reject(err));\n });\n res.pipe(file);\n } else {\n request.destroy();\n reject(new Error(`HTTP response with status code: ${res.statusCode}`));\n }\n });\n request.on(\"error\", (err) => {\n reject(err);\n });\n request.end();\n });\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n install,\n install_linux,\n install_macos,\n install_windows\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar regex_exports = {};\n__export(regex_exports, {\n config_regex: () => config_regex,\n conn_regex: () => conn_regex,\n connectorID_regex: () => connectorID_regex,\n disconnect_regex: () => disconnect_regex,\n index_regex: () => index_regex,\n ip_regex: () => ip_regex,\n location_regex: () => location_regex,\n metrics_regex: () => metrics_regex,\n tunnelID_regex: () => tunnelID_regex\n});\nmodule.exports = __toCommonJS(regex_exports);\nconst conn_regex = /connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst ip_regex = /ip=([0-9.]+)/;\nconst location_regex = /location=([A-Za-z0-9]+)/;\nconst index_regex = /connIndex=(\\d)/;\nconst disconnect_regex = /Unregistered tunnel connection connIndex=(\\d)/i;\nconst tunnelID_regex = /tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst connectorID_regex = /Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst metrics_regex = /metrics server on ([0-9.:]+\\/metrics)/;\nconst config_regex = /config=\"(.+[^\\\\])\"/;\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n config_regex,\n conn_regex,\n connectorID_regex,\n disconnect_regex,\n index_regex,\n ip_regex,\n location_regex,\n metrics_regex,\n tunnelID_regex\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar tunnel_exports = {};\n__export(tunnel_exports, {\n tunnel: () => tunnel\n});\nmodule.exports = __toCommonJS(tunnel_exports);\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants.js\");\nvar import_regex = require(\"./regex.js\");\nfunction tunnel(options = {}) {\n const args = [\"tunnel\"];\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === \"string\") {\n args.push(`${key}`, value);\n } else if (typeof value === \"number\") {\n args.push(`${key}`, value.toString());\n } else if (value === null) {\n args.push(`${key}`);\n }\n }\n if (args.length === 1) {\n args.push(\"--url\", \"localhost:8080\");\n }\n const child = (0, import_node_child_process.spawn)(import_constants.bin, args, { stdio: [\"ignore\", \"pipe\", \"pipe\"] });\n if (process.env.VERBOSE) {\n child.stdout.pipe(process.stdout);\n child.stderr.pipe(process.stderr);\n }\n const url_regex = /\\|\\s+(https?:\\/\\/[^\\s]+)/;\n let url_resolver = () => void 0;\n let url_rejector = () => void 0;\n const url = new Promise((...pair) => [url_resolver, url_rejector] = pair);\n const connection_resolvers = [];\n const connection_rejectors = [];\n const connections = [];\n for (let i = 0; i < 1; i++) {\n connections.push(new Promise((...pair) => [connection_resolvers[i], connection_rejectors[i]] = pair));\n }\n const parser = (data) => {\n var _a;\n const str = data.toString();\n const url_match = str.match(url_regex);\n url_match && url_resolver(url_match[1]);\n const conn_match = str.match(import_regex.conn_regex);\n const ip_match = str.match(import_regex.ip_regex);\n const location_match = str.match(import_regex.location_regex);\n const index_match = str.match(import_regex.index_regex);\n if (conn_match && ip_match && location_match && index_match) {\n const [, id] = conn_match;\n const [, ip] = ip_match;\n const [, location] = location_match;\n const [, idx] = index_match;\n (_a = connection_resolvers[+idx]) == null ? void 0 : _a.call(connection_resolvers, { id, ip, location });\n }\n };\n child.stdout.on(\"data\", parser).on(\"error\", url_rejector);\n child.stderr.on(\"data\", parser).on(\"error\", url_rejector);\n const stop = () => child.kill(\"SIGINT\");\n return { url, connections, child, stop };\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n tunnel\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar service_exports = {};\n__export(service_exports, {\n AlreadyInstalledError: () => AlreadyInstalledError,\n LINUX_SERVICE_PATH: () => LINUX_SERVICE_PATH,\n MACOS_SERVICE_PATH: () => MACOS_SERVICE_PATH,\n NotInstalledError: () => NotInstalledError,\n clean: () => clean,\n current: () => current,\n err: () => err,\n exists: () => exists,\n identifier: () => identifier,\n install: () => install,\n journal: () => journal,\n log: () => log,\n service: () => service,\n service_name: () => service_name,\n uninstall: () => uninstall\n});\nmodule.exports = __toCommonJS(service_exports);\nvar import_node_os = __toESM(require(\"node:os\"));\nvar import_node_fs = __toESM(require(\"node:fs\"));\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants.js\");\nvar import_regex = require(\"./regex.js\");\nconst identifier = \"com.cloudflare.cloudflared\";\nconst service_name = \"cloudflared.service\";\nconst MACOS_SERVICE_PATH = {\n PLIST: is_root() ? `/Library/LaunchDaemons/${identifier}.plist` : `${import_node_os.default.homedir()}/Library/LaunchAgents/${identifier}.plist`,\n OUT: is_root() ? `/Library/Logs/${identifier}.out.log` : `${import_node_os.default.homedir()}/Library/Logs/${identifier}.out.log`,\n ERR: is_root() ? `/Library/Logs/${identifier}.err.log` : `${import_node_os.default.homedir()}/Library/Logs/${identifier}.err.log`\n};\nconst LINUX_SERVICE_PATH = {\n SYSTEMD: `/etc/systemd/system/${service_name}`,\n SERVICE: \"/etc/init.d/cloudflared\",\n SERVICE_OUT: \"/var/log/cloudflared.log\",\n SERVICE_ERR: \"/var/log/cloudflared.err\"\n};\nconst service = { install, uninstall, exists, log, err, current, clean, journal };\nclass AlreadyInstalledError extends Error {\n constructor() {\n super(\"service is already installed\");\n }\n}\nclass NotInstalledError extends Error {\n constructor() {\n super(\"service is not installed\");\n }\n}\nfunction install(token) {\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (exists()) {\n throw new AlreadyInstalledError();\n }\n const args = [\"service\", \"install\"];\n if (token) {\n args.push(token);\n }\n const result = (0, import_node_child_process.spawnSync)(import_constants.bin, args);\n if (result.status !== 0) {\n throw new Error(`service install failed: ${result.stderr.toString()}`);\n }\n}\nfunction uninstall() {\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (!exists()) {\n throw new NotInstalledError();\n }\n const result = (0, import_node_child_process.spawnSync)(import_constants.bin, [\"service\", \"uninstall\"]);\n if (result.status !== 0) {\n throw new Error(`service uninstall failed: ${result.stderr.toString()}`);\n }\n if (process.platform === \"darwin\") {\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.OUT);\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.ERR);\n } else if (process.platform === \"linux\" && !is_systemd()) {\n import_node_fs.default.rmSync(LINUX_SERVICE_PATH.SERVICE_OUT);\n import_node_fs.default.rmSync(LINUX_SERVICE_PATH.SERVICE_ERR);\n }\n}\nfunction log() {\n if (!exists()) {\n throw new NotInstalledError();\n }\n if (process.platform === \"darwin\") {\n return import_node_fs.default.readFileSync(MACOS_SERVICE_PATH.OUT, \"utf8\");\n }\n if (process.platform === \"linux\" && !is_systemd()) {\n return import_node_fs.default.readFileSync(LINUX_SERVICE_PATH.SERVICE_OUT, \"utf8\");\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction err() {\n if (!exists()) {\n throw new NotInstalledError();\n }\n if (process.platform === \"darwin\") {\n return import_node_fs.default.readFileSync(MACOS_SERVICE_PATH.ERR, \"utf8\");\n }\n if (process.platform === \"linux\" && !is_systemd()) {\n return import_node_fs.default.readFileSync(LINUX_SERVICE_PATH.SERVICE_ERR, \"utf8\");\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction journal(n = 300) {\n if (process.platform === \"linux\" && is_systemd()) {\n const args = [\"-u\", service_name, \"-o\", \"cat\", \"-n\", n.toString()];\n return (0, import_node_child_process.spawnSync)(\"journalctl\", args).stdout.toString();\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction current() {\n var _a, _b, _c, _d;\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (!exists()) {\n throw new NotInstalledError();\n }\n const log2 = is_systemd() ? journal() : err();\n let tunnelID = \"\";\n let connectorID = \"\";\n const connections = [];\n let metrics = \"\";\n let config = {};\n for (const line of log2.split(\"\\n\")) {\n try {\n if (line.match(import_regex.tunnelID_regex)) {\n tunnelID = ((_a = line.match(import_regex.tunnelID_regex)) == null ? void 0 : _a[1]) ?? \"\";\n } else if (line.match(import_regex.connectorID_regex)) {\n connectorID = ((_b = line.match(import_regex.connectorID_regex)) == null ? void 0 : _b[1]) ?? \"\";\n } else if (line.match(import_regex.conn_regex) && line.match(import_regex.location_regex) && line.match(import_regex.ip_regex) && line.match(import_regex.index_regex)) {\n const [, id] = line.match(import_regex.conn_regex) ?? [];\n const [, location] = line.match(import_regex.location_regex) ?? [];\n const [, ip] = line.match(import_regex.ip_regex) ?? [];\n const [, idx] = line.match(import_regex.index_regex) ?? [];\n connections[parseInt(idx)] = { id, ip, location };\n } else if (line.match(import_regex.disconnect_regex)) {\n const [, idx] = line.match(import_regex.disconnect_regex) ?? [];\n if (parseInt(idx) in connections) {\n connections[parseInt(idx)] = { id: \"\", ip: \"\", location: \"\" };\n }\n } else if (line.match(import_regex.metrics_regex)) {\n metrics = ((_c = line.match(import_regex.metrics_regex)) == null ? void 0 : _c[1]) ?? \"\";\n } else if (line.match(import_regex.config_regex)) {\n config = JSON.parse(((_d = line.match(import_regex.config_regex)) == null ? void 0 : _d[1].replace(/\\\\/g, \"\")) ?? \"{}\");\n }\n } catch (err2) {\n if (process.env.VERBOSE) {\n console.error(\"log parsing failed\", err2);\n }\n }\n }\n return { tunnelID, connectorID, connections, metrics, config };\n}\nfunction clean() {\n if (process.platform !== \"darwin\") {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (exists()) {\n throw new AlreadyInstalledError();\n }\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.OUT, { force: true });\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.ERR, { force: true });\n}\nfunction exists() {\n if (process.platform === \"darwin\") {\n return import_node_fs.default.existsSync(MACOS_SERVICE_PATH.PLIST);\n } else if (process.platform === \"linux\") {\n return is_systemd() ? import_node_fs.default.existsSync(LINUX_SERVICE_PATH.SYSTEMD) : import_node_fs.default.existsSync(LINUX_SERVICE_PATH.SERVICE);\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction is_root() {\n var _a;\n return ((_a = process.getuid) == null ? void 0 : _a.call(process)) === 0;\n}\nfunction is_systemd() {\n return process.platform === \"linux\" && import_node_fs.default.existsSync(\"/run/systemd/system\");\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AlreadyInstalledError,\n LINUX_SERVICE_PATH,\n MACOS_SERVICE_PATH,\n NotInstalledError,\n clean,\n current,\n err,\n exists,\n identifier,\n install,\n journal,\n log,\n service,\n service_name,\n uninstall\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar lib_exports = {};\n__export(lib_exports, {\n AlreadyInstalledError: () => import_service.AlreadyInstalledError,\n MACOS_SERVICE_PATH: () => import_service.MACOS_SERVICE_PATH,\n NotInstalledError: () => import_service.NotInstalledError,\n bin: () => import_constants.bin,\n identifier: () => import_service.identifier,\n install: () => import_install.install,\n service: () => import_service.service,\n tunnel: () => import_tunnel.tunnel\n});\nmodule.exports = __toCommonJS(lib_exports);\nvar import_constants = require(\"./constants.js\");\nvar import_install = require(\"./install.js\");\nvar import_tunnel = require(\"./tunnel.js\");\nvar import_service = require(\"./service.js\");\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AlreadyInstalledError,\n MACOS_SERVICE_PATH,\n NotInstalledError,\n bin,\n identifier,\n install,\n service,\n tunnel\n});\n","import { useCallback, useEffect, useRef } from 'react';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { launchTunnel } from './tunnel.js';\nimport type { Connection } from './tunnel.js';\nimport { wixCliTunnelBiEvents } from './bi/events.js';\nimport { useTunnelClient } from './useTunnelClient.js';\n\nexport function useTunnel() {\n const connectionRef = useRef<Connection>();\n const tunnelClient = useTunnelClient();\n const biLogger = useBiLogger();\n\n useEffect(() => {\n return () => {\n connectionRef.current?.close();\n };\n }, []);\n\n return useCallback(\n async (port: number) => {\n const biEvents = wixCliTunnelBiEvents(biLogger);\n const tunnelCreationBi = biEvents.tunnel();\n try {\n const tunnel = await launchTunnel(port, tunnelClient);\n connectionRef.current = tunnel;\n tunnelCreationBi.finish({ isSuccess: true });\n return { url: tunnel.domain };\n } catch (ex: unknown) {\n tunnelCreationBi.finish({\n isSuccess: false,\n failureReason: ex instanceof Error ? ex.message : 'Unknown error',\n });\n\n throw ex;\n }\n },\n [tunnelClient, biLogger]\n );\n}\n","import { execa } from 'execa';\nimport { pathExists } from '@wix/cli-fs';\nimport { dirname } from 'node:path';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { bin, install } from 'cloudflared';\nimport type { TunnelClient } from './client.js';\n\nexport interface Connection {\n close: () => void;\n domain: string;\n}\n\nexport async function launchTunnel(\n port: number,\n tunnelClient: TunnelClient\n): Promise<Connection> {\n const { localTunnel } = getTestOverrides();\n\n if (!localTunnel && !(await pathExists(bin))) {\n try {\n await install(bin);\n } catch (e) {\n const err = e as NodeJS.ErrnoException;\n if (e instanceof Error && err.code === 'EACCES') {\n throw new CliError({\n code: CliErrorCode.FailedInstallCloudflareNoAccess({\n path: dirname(err.path!),\n }),\n cause: e,\n });\n }\n throw e;\n }\n }\n\n const tunnel = await tunnelClient.createTunnel({ port });\n const domain = `http${localTunnel ? '' : 's'}://${tunnel.domain}`;\n\n const createTunnelPromise = new Promise<Connection>((resolve, reject) => {\n const tunnelProcess = localTunnel\n ? execa('echo', [tunnel.domain, tunnel.token], { detached: true })\n : execa(bin, ['tunnel', 'run', '--token', tunnel.token]);\n\n const close = () => {\n tunnelProcess.kill();\n };\n\n const listener = async (data: Buffer) => {\n const output = data.toString();\n const match = output.match(tunnel.domain)?.[0];\n\n if (match) {\n resolve({\n domain,\n close,\n });\n }\n };\n\n tunnelProcess.stderr?.on('data', listener);\n tunnelProcess.stdout?.on('data', listener);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tunnelProcess.on('error', (err) => {\n reject(err);\n });\n });\n\n return {\n domain,\n close: async () => {\n const tunnel = await createTunnelPromise;\n return tunnel.close();\n },\n };\n}\n","import { wixCliAppsFlowTunnelCreationStatusSrc11Evid5233 } from '@wix/bi-logger-dev-tools-data/v2';\nimport type { BiLogger } from '@wix/cli-telemetry';\n\nexport const wixCliTunnelBiEvents = (biLogger: BiLogger) => ({\n tunnel: () => {\n const startTimestamp = Date.now();\n return {\n finish: ({\n isSuccess,\n failureReason,\n }: {\n isSuccess: boolean;\n failureReason?: string;\n }) => {\n void biLogger.report(\n wixCliAppsFlowTunnelCreationStatusSrc11Evid5233({\n isSuccess,\n failureReason,\n tunnelCreationTime: Date.now() - startTimestamp,\n })\n );\n },\n };\n },\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { TunnelClient } from './client.js';\n\nexport function useTunnelClient(): TunnelClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new TunnelClient(httpClient), [httpClient]);\n}\n","import type { HttpClient } from '@wix/cli-http-client';\nimport type { Options } from 'p-retry';\nimport pRetry from 'p-retry';\nimport {\n createTunnel,\n deleteTunnel,\n} from '@wix/ambassador-apps-hosting-v1-deployment/http';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { createTunnelSchema } from './schemas.js';\n\nexport class TunnelClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n public createTunnel = async ({ port }: { port: number }) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(createTunnel({ port })),\n this.retryOptions\n );\n\n return createTunnelSchema.parse(data);\n } catch (error) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateTunnel(),\n cause: error,\n });\n }\n };\n\n public deleteTunnel = async (tunnelId: string) => {\n try {\n await pRetry(\n () => this.httpClient.request(deleteTunnel({ id: tunnelId })),\n this.retryOptions\n );\n } catch (error) {\n throw new CliError({\n code: CliErrorCode.FailedToDeleteTunnel(),\n cause: error,\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nexport const createTunnelSchema = z.object({\n id: z.string(),\n token: z.string(),\n domain: z.string(),\n});\n","export { useTunnel } from './useTunnel.js';\n"],"mappings":";;kRAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,cAAAC,IACA,IAAIC,GAAW,OAAO,OAClBC,EAAY,OAAO,eACnBC,GAAmB,OAAO,yBAC1BC,GAAoB,OAAO,oBAC3BC,GAAe,OAAO,eACtBC,GAAe,OAAO,UAAU,eAChCC,GAAW,CAACC,EAAQC,IAAQ,CAC9B,QAASC,KAAQD,EACfP,EAAUM,EAAQE,EAAM,CAAE,IAAKD,EAAIC,CAAI,EAAG,WAAY,EAAK,CAAC,CAChE,EACIC,GAAc,CAACC,EAAIC,EAAMC,EAAQC,IAAS,CAC5C,GAAIF,GAAQ,OAAOA,GAAS,UAAY,OAAOA,GAAS,WACtD,QAASG,KAAOZ,GAAkBS,CAAI,EAChC,CAACP,GAAa,KAAKM,EAAII,CAAG,GAAKA,IAAQF,GACzCZ,EAAUU,EAAII,EAAK,CAAE,IAAK,IAAMH,EAAKG,CAAG,EAAG,WAAY,EAAED,EAAOZ,GAAiBU,EAAMG,CAAG,IAAMD,EAAK,UAAW,CAAC,EAEvH,OAAOH,CACT,EACIK,GAAU,CAACC,EAAKC,EAAYX,KAAYA,EAASU,GAAO,KAAOjB,GAASI,GAAaa,CAAG,CAAC,EAAI,CAAC,EAAGP,GAAYQ,GAAc,CAACD,GAAO,CAACA,EAAI,WAAahB,EAAUM,EAAQ,UAAW,CAAE,MAAOU,EAAK,WAAY,EAAK,CAAC,EAAIV,EAAQU,CAAG,GACjOE,GAAgBF,GAAQP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AMC,EAAaC,GAAc,CAAE,KAAM,YAAa,CAAC,EACvD,SAAO,YAAQ,IAAM,IAAIC,EAAaF,CAAU,EAAG,CAACA,CAAU,CAAC,CACjE,CHAO,SAASG,IAAY,CAC1B,IAAMC,KAAgB,UAAmB,EACnCC,EAAeC,GAAgB,EAC/BC,EAAWC,GAAY,EAE7B,sBAAU,IACD,IAAM,CACXJ,EAAc,SAAS,MAAM,CAC/B,EACC,CAAC,CAAC,KAEE,eACL,MAAOK,GAAiB,CAEtB,IAAMC,EADWC,GAAqBJ,CAAQ,EACZ,OAAO,EACzC,GAAI,CACF,IAAMK,EAAS,MAAMC,GAAaJ,EAAMJ,CAAY,EACpD,OAAAD,EAAc,QAAUQ,EACxBF,EAAiB,OAAO,CAAE,UAAW,EAAK,CAAC,EACpC,CAAE,IAAKE,EAAO,MAAO,CAC9B,OAASE,EAAa,CACpB,MAAAJ,EAAiB,OAAO,CACtB,UAAW,GACX,cAAeI,aAAc,MAAQA,EAAG,QAAU,eACpD,CAAC,EAEKA,CACR,CACF,EACA,CAACT,EAAcE,CAAQ,CACzB,CACF,COtCAQ","names":["require_constants","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","constants_exports","CLOUDFLARED_VERSION","DEFAULT_CLOUDFLARED_BIN","RELEASE_BASE","bin","use","import_node_path","__dirname","executable","require_error","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","error_exports","UnsupportedError","message","require_install","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","install_exports","install","install_linux","install_macos","install_windows","import_node_fs","import_node_path","import_node_https","import_node_child_process","import_constants","import_error","LINUX_URL","MACOS_URL","WINDOWS_URL","resolve_base","version","file","download","url","redirect","resolve","reject","request","res","redirection","err","require_regex","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","regex_exports","config_regex","conn_regex","connectorID_regex","disconnect_regex","index_regex","ip_regex","location_regex","metrics_regex","tunnelID_regex","require_tunnel","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","tunnel_exports","tunnel","import_node_child_process","import_constants","import_regex","options","args","value","child","url_regex","url_resolver","url_rejector","url","pair","connection_resolvers","connection_rejectors","connections","i","parser","data","_a","str","url_match","conn_match","ip_match","location_match","index_match","id","ip","location","idx","require_service","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","service_exports","AlreadyInstalledError","LINUX_SERVICE_PATH","MACOS_SERVICE_PATH","NotInstalledError","clean","current","err","exists","identifier","install","journal","log","service","service_name","uninstall","import_node_os","import_node_fs","import_node_child_process","import_constants","import_regex","is_root","token","args","result","is_systemd","n","_a","_b","_c","_d","log2","tunnelID","connectorID","connections","metrics","config","line","id","location","ip","idx","err2","require_lib","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","lib_exports","import_service","import_constants","import_install","import_tunnel","init_esm_shims","import_react","init_esm_shims","dirname","import_cloudflared","launchTunnel","port","tunnelClient","localTunnel","getTestOverrides","pathExists","e","err","CliError","CliErrorCode","dirname","tunnel","domain","createTunnelPromise","resolve","reject","tunnelProcess","execa","close","listener","data","init_esm_shims","wixCliTunnelBiEvents","biLogger","startTimestamp","isSuccess","failureReason","wixCliAppsFlowTunnelCreationStatusSrc11Evid5233","init_esm_shims","import_react","init_esm_shims","init_esm_shims","_createTunnelRequest","_createTunnelResponse","_deleteTunnelRequest","_deleteTunnelResponse","resolveWixAppsHostingV1BackendServiceUrl","opts","domainToMappings","resolveUrl","createTunnel","payload","_a","serializer","_createTunnelRequest","toReq","fromReq","fromRes","_createTunnelResponse","__createTunnel","host","serializedData","metadata","deleteTunnel","_deleteTunnelRequest","_deleteTunnelResponse","__deleteTunnel","toURLSearchParams","init_esm_shims","createTunnelSchema","z","TunnelClient","httpClient","minRetryTimeout","getTestOverrides","port","data","pRetry","createTunnel","createTunnelSchema","error","CliError","CliErrorCode","tunnelId","deleteTunnel","useTunnelClient","httpClient","useHttpClient","TunnelClient","useTunnel","connectionRef","tunnelClient","useTunnelClient","biLogger","useBiLogger","port","tunnelCreationBi","wixCliTunnelBiEvents","tunnel","launchTunnel","ex","init_esm_shims"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/cloudflared/lib/constants.js","../../../node_modules/cloudflared/lib/error.js","../../../node_modules/cloudflared/lib/install.js","../../../node_modules/cloudflared/lib/regex.js","../../../node_modules/cloudflared/lib/tunnel.js","../../../node_modules/cloudflared/lib/service.js","../../../node_modules/cloudflared/lib/lib.js","../../cli-tunnel/src/useTunnel.ts","../../cli-tunnel/src/tunnel.ts","../../cli-tunnel/src/bi/events.ts","../../cli-tunnel/src/useTunnelClient.ts","../../cli-tunnel/src/client.ts","../../../node_modules/@wix/ambassador-apps-hosting-v1-deployment/http.impl.ts","../../cli-tunnel/src/schemas.ts","../../cli-tunnel/src/index.ts"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar constants_exports = {};\n__export(constants_exports, {\n CLOUDFLARED_VERSION: () => CLOUDFLARED_VERSION,\n DEFAULT_CLOUDFLARED_BIN: () => DEFAULT_CLOUDFLARED_BIN,\n RELEASE_BASE: () => RELEASE_BASE,\n bin: () => bin,\n use: () => use\n});\nmodule.exports = __toCommonJS(constants_exports);\nvar import_node_path = __toESM(require(\"node:path\"));\nconst DEFAULT_CLOUDFLARED_BIN = import_node_path.default.join(__dirname, \"..\", \"bin\", process.platform === \"win32\" ? \"cloudflared.exe\" : \"cloudflared\");\nlet bin = process.env.CLOUDFLARED_BIN || DEFAULT_CLOUDFLARED_BIN;\nfunction use(executable) {\n bin = executable;\n}\nconst CLOUDFLARED_VERSION = process.env.CLOUDFLARED_VERSION || \"latest\";\nconst RELEASE_BASE = \"https://github.com/cloudflare/cloudflared/releases/\";\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n CLOUDFLARED_VERSION,\n DEFAULT_CLOUDFLARED_BIN,\n RELEASE_BASE,\n bin,\n use\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar error_exports = {};\n__export(error_exports, {\n UnsupportedError: () => UnsupportedError\n});\nmodule.exports = __toCommonJS(error_exports);\nclass UnsupportedError extends Error {\n constructor(message) {\n super(message);\n }\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n UnsupportedError\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar install_exports = {};\n__export(install_exports, {\n install: () => install,\n install_linux: () => install_linux,\n install_macos: () => install_macos,\n install_windows: () => install_windows\n});\nmodule.exports = __toCommonJS(install_exports);\nvar import_node_fs = __toESM(require(\"node:fs\"));\nvar import_node_path = __toESM(require(\"node:path\"));\nvar import_node_https = __toESM(require(\"node:https\"));\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants\");\nvar import_error = require(\"./error\");\nconst LINUX_URL = {\n arm64: \"cloudflared-linux-arm64\",\n arm: \"cloudflared-linux-arm\",\n x64: \"cloudflared-linux-amd64\",\n ia32: \"cloudflared-linux-386\"\n};\nconst MACOS_URL = {\n arm64: \"cloudflared-darwin-amd64.tgz\",\n x64: \"cloudflared-darwin-amd64.tgz\"\n};\nconst WINDOWS_URL = {\n x64: \"cloudflared-windows-amd64.exe\",\n ia32: \"cloudflared-windows-386.exe\"\n};\nfunction resolve_base(version) {\n if (version === \"latest\") {\n return `${import_constants.RELEASE_BASE}latest/download/`;\n }\n return `${import_constants.RELEASE_BASE}download/${version}/`;\n}\nasync function install(to, version = import_constants.CLOUDFLARED_VERSION) {\n if (process.platform === \"linux\") {\n return install_linux(to, version);\n } else if (process.platform === \"darwin\") {\n return install_macos(to, version);\n } else if (process.platform === \"win32\") {\n return install_windows(to, version);\n } else {\n throw new import_error.UnsupportedError(\"Unsupported platform: \" + process.platform);\n }\n}\nasync function install_linux(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = LINUX_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, to);\n import_node_fs.default.chmodSync(to, \"755\");\n return to;\n}\nasync function install_macos(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = MACOS_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, `${to}.tgz`);\n process.env.VERBOSE && console.log(`Extracting to ${to}`);\n (0, import_node_child_process.execSync)(`tar -xzf ${import_node_path.default.basename(`${to}.tgz`)}`, { cwd: import_node_path.default.dirname(to) });\n import_node_fs.default.unlinkSync(`${to}.tgz`);\n import_node_fs.default.renameSync(`${import_node_path.default.dirname(to)}/cloudflared`, to);\n return to;\n}\nasync function install_windows(to, version = import_constants.CLOUDFLARED_VERSION) {\n const file = WINDOWS_URL[process.arch];\n if (file === void 0) {\n throw new import_error.UnsupportedError(\"Unsupported architecture: \" + process.arch);\n }\n await download(resolve_base(version) + file, to);\n return to;\n}\nfunction download(url, to, redirect = 0) {\n if (redirect === 0) {\n process.env.VERBOSE && console.log(`Downloading ${url} to ${to}`);\n } else {\n process.env.VERBOSE && console.log(`Redirecting to ${url}`);\n }\n if (!import_node_fs.default.existsSync(import_node_path.default.dirname(to))) {\n import_node_fs.default.mkdirSync(import_node_path.default.dirname(to), { recursive: true });\n }\n return new Promise((resolve, reject) => {\n const request = import_node_https.default.get(url, (res) => {\n const redirect_code = [301, 302, 303, 307, 308];\n if (redirect_code.includes(res.statusCode) && res.headers.location !== void 0) {\n request.destroy();\n const redirection = res.headers.location;\n resolve(download(redirection, to, redirect + 1));\n return;\n }\n if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {\n const file = import_node_fs.default.createWriteStream(to);\n file.on(\"finish\", () => {\n file.close(() => resolve(to));\n });\n file.on(\"error\", (err) => {\n import_node_fs.default.unlink(to, () => reject(err));\n });\n res.pipe(file);\n } else {\n request.destroy();\n reject(new Error(`HTTP response with status code: ${res.statusCode}`));\n }\n });\n request.on(\"error\", (err) => {\n reject(err);\n });\n request.end();\n });\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n install,\n install_linux,\n install_macos,\n install_windows\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar regex_exports = {};\n__export(regex_exports, {\n config_regex: () => config_regex,\n conn_regex: () => conn_regex,\n connectorID_regex: () => connectorID_regex,\n disconnect_regex: () => disconnect_regex,\n index_regex: () => index_regex,\n ip_regex: () => ip_regex,\n location_regex: () => location_regex,\n metrics_regex: () => metrics_regex,\n tunnelID_regex: () => tunnelID_regex\n});\nmodule.exports = __toCommonJS(regex_exports);\nconst conn_regex = /connection[= ]([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst ip_regex = /ip=([0-9.]+)/;\nconst location_regex = /location=([A-Za-z0-9]+)/;\nconst index_regex = /connIndex=(\\d)/;\nconst disconnect_regex = /Unregistered tunnel connection connIndex=(\\d)/i;\nconst tunnelID_regex = /tunnelID=([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst connectorID_regex = /Connector ID: ([0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12})/i;\nconst metrics_regex = /metrics server on ([0-9.:]+\\/metrics)/;\nconst config_regex = /config=\"(.+[^\\\\])\"/;\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n config_regex,\n conn_regex,\n connectorID_regex,\n disconnect_regex,\n index_regex,\n ip_regex,\n location_regex,\n metrics_regex,\n tunnelID_regex\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar tunnel_exports = {};\n__export(tunnel_exports, {\n tunnel: () => tunnel\n});\nmodule.exports = __toCommonJS(tunnel_exports);\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants.js\");\nvar import_regex = require(\"./regex.js\");\nfunction tunnel(options = {}) {\n const args = [\"tunnel\"];\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === \"string\") {\n args.push(`${key}`, value);\n } else if (typeof value === \"number\") {\n args.push(`${key}`, value.toString());\n } else if (value === null) {\n args.push(`${key}`);\n }\n }\n if (args.length === 1) {\n args.push(\"--url\", \"localhost:8080\");\n }\n const child = (0, import_node_child_process.spawn)(import_constants.bin, args, { stdio: [\"ignore\", \"pipe\", \"pipe\"] });\n if (process.env.VERBOSE) {\n child.stdout.pipe(process.stdout);\n child.stderr.pipe(process.stderr);\n }\n const url_regex = /\\|\\s+(https?:\\/\\/[^\\s]+)/;\n let url_resolver = () => void 0;\n let url_rejector = () => void 0;\n const url = new Promise((...pair) => [url_resolver, url_rejector] = pair);\n const connection_resolvers = [];\n const connection_rejectors = [];\n const connections = [];\n for (let i = 0; i < 1; i++) {\n connections.push(new Promise((...pair) => [connection_resolvers[i], connection_rejectors[i]] = pair));\n }\n const parser = (data) => {\n var _a;\n const str = data.toString();\n const url_match = str.match(url_regex);\n url_match && url_resolver(url_match[1]);\n const conn_match = str.match(import_regex.conn_regex);\n const ip_match = str.match(import_regex.ip_regex);\n const location_match = str.match(import_regex.location_regex);\n const index_match = str.match(import_regex.index_regex);\n if (conn_match && ip_match && location_match && index_match) {\n const [, id] = conn_match;\n const [, ip] = ip_match;\n const [, location] = location_match;\n const [, idx] = index_match;\n (_a = connection_resolvers[+idx]) == null ? void 0 : _a.call(connection_resolvers, { id, ip, location });\n }\n };\n child.stdout.on(\"data\", parser).on(\"error\", url_rejector);\n child.stderr.on(\"data\", parser).on(\"error\", url_rejector);\n const stop = () => child.kill(\"SIGINT\");\n return { url, connections, child, stop };\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n tunnel\n});\n","\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target, mod));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar service_exports = {};\n__export(service_exports, {\n AlreadyInstalledError: () => AlreadyInstalledError,\n LINUX_SERVICE_PATH: () => LINUX_SERVICE_PATH,\n MACOS_SERVICE_PATH: () => MACOS_SERVICE_PATH,\n NotInstalledError: () => NotInstalledError,\n clean: () => clean,\n current: () => current,\n err: () => err,\n exists: () => exists,\n identifier: () => identifier,\n install: () => install,\n journal: () => journal,\n log: () => log,\n service: () => service,\n service_name: () => service_name,\n uninstall: () => uninstall\n});\nmodule.exports = __toCommonJS(service_exports);\nvar import_node_os = __toESM(require(\"node:os\"));\nvar import_node_fs = __toESM(require(\"node:fs\"));\nvar import_node_child_process = require(\"node:child_process\");\nvar import_constants = require(\"./constants.js\");\nvar import_regex = require(\"./regex.js\");\nconst identifier = \"com.cloudflare.cloudflared\";\nconst service_name = \"cloudflared.service\";\nconst MACOS_SERVICE_PATH = {\n PLIST: is_root() ? `/Library/LaunchDaemons/${identifier}.plist` : `${import_node_os.default.homedir()}/Library/LaunchAgents/${identifier}.plist`,\n OUT: is_root() ? `/Library/Logs/${identifier}.out.log` : `${import_node_os.default.homedir()}/Library/Logs/${identifier}.out.log`,\n ERR: is_root() ? `/Library/Logs/${identifier}.err.log` : `${import_node_os.default.homedir()}/Library/Logs/${identifier}.err.log`\n};\nconst LINUX_SERVICE_PATH = {\n SYSTEMD: `/etc/systemd/system/${service_name}`,\n SERVICE: \"/etc/init.d/cloudflared\",\n SERVICE_OUT: \"/var/log/cloudflared.log\",\n SERVICE_ERR: \"/var/log/cloudflared.err\"\n};\nconst service = { install, uninstall, exists, log, err, current, clean, journal };\nclass AlreadyInstalledError extends Error {\n constructor() {\n super(\"service is already installed\");\n }\n}\nclass NotInstalledError extends Error {\n constructor() {\n super(\"service is not installed\");\n }\n}\nfunction install(token) {\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (exists()) {\n throw new AlreadyInstalledError();\n }\n const args = [\"service\", \"install\"];\n if (token) {\n args.push(token);\n }\n const result = (0, import_node_child_process.spawnSync)(import_constants.bin, args);\n if (result.status !== 0) {\n throw new Error(`service install failed: ${result.stderr.toString()}`);\n }\n}\nfunction uninstall() {\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (!exists()) {\n throw new NotInstalledError();\n }\n const result = (0, import_node_child_process.spawnSync)(import_constants.bin, [\"service\", \"uninstall\"]);\n if (result.status !== 0) {\n throw new Error(`service uninstall failed: ${result.stderr.toString()}`);\n }\n if (process.platform === \"darwin\") {\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.OUT);\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.ERR);\n } else if (process.platform === \"linux\" && !is_systemd()) {\n import_node_fs.default.rmSync(LINUX_SERVICE_PATH.SERVICE_OUT);\n import_node_fs.default.rmSync(LINUX_SERVICE_PATH.SERVICE_ERR);\n }\n}\nfunction log() {\n if (!exists()) {\n throw new NotInstalledError();\n }\n if (process.platform === \"darwin\") {\n return import_node_fs.default.readFileSync(MACOS_SERVICE_PATH.OUT, \"utf8\");\n }\n if (process.platform === \"linux\" && !is_systemd()) {\n return import_node_fs.default.readFileSync(LINUX_SERVICE_PATH.SERVICE_OUT, \"utf8\");\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction err() {\n if (!exists()) {\n throw new NotInstalledError();\n }\n if (process.platform === \"darwin\") {\n return import_node_fs.default.readFileSync(MACOS_SERVICE_PATH.ERR, \"utf8\");\n }\n if (process.platform === \"linux\" && !is_systemd()) {\n return import_node_fs.default.readFileSync(LINUX_SERVICE_PATH.SERVICE_ERR, \"utf8\");\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction journal(n = 300) {\n if (process.platform === \"linux\" && is_systemd()) {\n const args = [\"-u\", service_name, \"-o\", \"cat\", \"-n\", n.toString()];\n return (0, import_node_child_process.spawnSync)(\"journalctl\", args).stdout.toString();\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction current() {\n var _a, _b, _c, _d;\n if (![\"darwin\", \"linux\"].includes(process.platform)) {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (!exists()) {\n throw new NotInstalledError();\n }\n const log2 = is_systemd() ? journal() : err();\n let tunnelID = \"\";\n let connectorID = \"\";\n const connections = [];\n let metrics = \"\";\n let config = {};\n for (const line of log2.split(\"\\n\")) {\n try {\n if (line.match(import_regex.tunnelID_regex)) {\n tunnelID = ((_a = line.match(import_regex.tunnelID_regex)) == null ? void 0 : _a[1]) ?? \"\";\n } else if (line.match(import_regex.connectorID_regex)) {\n connectorID = ((_b = line.match(import_regex.connectorID_regex)) == null ? void 0 : _b[1]) ?? \"\";\n } else if (line.match(import_regex.conn_regex) && line.match(import_regex.location_regex) && line.match(import_regex.ip_regex) && line.match(import_regex.index_regex)) {\n const [, id] = line.match(import_regex.conn_regex) ?? [];\n const [, location] = line.match(import_regex.location_regex) ?? [];\n const [, ip] = line.match(import_regex.ip_regex) ?? [];\n const [, idx] = line.match(import_regex.index_regex) ?? [];\n connections[parseInt(idx)] = { id, ip, location };\n } else if (line.match(import_regex.disconnect_regex)) {\n const [, idx] = line.match(import_regex.disconnect_regex) ?? [];\n if (parseInt(idx) in connections) {\n connections[parseInt(idx)] = { id: \"\", ip: \"\", location: \"\" };\n }\n } else if (line.match(import_regex.metrics_regex)) {\n metrics = ((_c = line.match(import_regex.metrics_regex)) == null ? void 0 : _c[1]) ?? \"\";\n } else if (line.match(import_regex.config_regex)) {\n config = JSON.parse(((_d = line.match(import_regex.config_regex)) == null ? void 0 : _d[1].replace(/\\\\/g, \"\")) ?? \"{}\");\n }\n } catch (err2) {\n if (process.env.VERBOSE) {\n console.error(\"log parsing failed\", err2);\n }\n }\n }\n return { tunnelID, connectorID, connections, metrics, config };\n}\nfunction clean() {\n if (process.platform !== \"darwin\") {\n throw new Error(`Not Implemented on platform ${process.platform}`);\n }\n if (exists()) {\n throw new AlreadyInstalledError();\n }\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.OUT, { force: true });\n import_node_fs.default.rmSync(MACOS_SERVICE_PATH.ERR, { force: true });\n}\nfunction exists() {\n if (process.platform === \"darwin\") {\n return import_node_fs.default.existsSync(MACOS_SERVICE_PATH.PLIST);\n } else if (process.platform === \"linux\") {\n return is_systemd() ? import_node_fs.default.existsSync(LINUX_SERVICE_PATH.SYSTEMD) : import_node_fs.default.existsSync(LINUX_SERVICE_PATH.SERVICE);\n }\n throw new Error(`Not Implemented on platform ${process.platform}`);\n}\nfunction is_root() {\n var _a;\n return ((_a = process.getuid) == null ? void 0 : _a.call(process)) === 0;\n}\nfunction is_systemd() {\n return process.platform === \"linux\" && import_node_fs.default.existsSync(\"/run/systemd/system\");\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AlreadyInstalledError,\n LINUX_SERVICE_PATH,\n MACOS_SERVICE_PATH,\n NotInstalledError,\n clean,\n current,\n err,\n exists,\n identifier,\n install,\n journal,\n log,\n service,\n service_name,\n uninstall\n});\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar lib_exports = {};\n__export(lib_exports, {\n AlreadyInstalledError: () => import_service.AlreadyInstalledError,\n MACOS_SERVICE_PATH: () => import_service.MACOS_SERVICE_PATH,\n NotInstalledError: () => import_service.NotInstalledError,\n bin: () => import_constants.bin,\n identifier: () => import_service.identifier,\n install: () => import_install.install,\n service: () => import_service.service,\n tunnel: () => import_tunnel.tunnel\n});\nmodule.exports = __toCommonJS(lib_exports);\nvar import_constants = require(\"./constants.js\");\nvar import_install = require(\"./install.js\");\nvar import_tunnel = require(\"./tunnel.js\");\nvar import_service = require(\"./service.js\");\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AlreadyInstalledError,\n MACOS_SERVICE_PATH,\n NotInstalledError,\n bin,\n identifier,\n install,\n service,\n tunnel\n});\n","import { useCallback, useEffect, useRef } from 'react';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { launchTunnel } from './tunnel.js';\nimport type { Connection } from './tunnel.js';\nimport { wixCliTunnelBiEvents } from './bi/events.js';\nimport { useTunnelClient } from './useTunnelClient.js';\n\nexport function useTunnel() {\n const connectionRef = useRef<Connection>();\n const tunnelClient = useTunnelClient();\n const biLogger = useBiLogger();\n\n useEffect(() => {\n return () => {\n connectionRef.current?.close();\n };\n }, []);\n\n return useCallback(\n async (port: number) => {\n const biEvents = wixCliTunnelBiEvents(biLogger);\n const tunnelCreationBi = biEvents.tunnel();\n try {\n const tunnel = await launchTunnel(port, tunnelClient);\n connectionRef.current = tunnel;\n tunnelCreationBi.finish({ isSuccess: true });\n return { url: tunnel.domain };\n } catch (ex: unknown) {\n tunnelCreationBi.finish({\n isSuccess: false,\n failureReason: ex instanceof Error ? ex.message : 'Unknown error',\n });\n\n throw ex;\n }\n },\n [tunnelClient, biLogger]\n );\n}\n","import { execa } from 'execa';\nimport { pathExists } from '@wix/cli-fs';\nimport { dirname } from 'node:path';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { bin, install } from 'cloudflared';\nimport type { TunnelClient } from './client.js';\n\nexport interface Connection {\n close: () => void;\n domain: string;\n}\n\nexport async function launchTunnel(\n port: number,\n tunnelClient: TunnelClient\n): Promise<Connection> {\n const { localTunnel } = getTestOverrides();\n\n if (!localTunnel && !(await pathExists(bin))) {\n try {\n await install(bin);\n } catch (e) {\n const err = e as NodeJS.ErrnoException;\n if (e instanceof Error && err.code === 'EACCES') {\n throw new CliError({\n code: CliErrorCode.FailedInstallCloudflareNoAccess({\n path: dirname(err.path!),\n }),\n cause: e,\n });\n }\n throw e;\n }\n }\n\n const tunnel = await tunnelClient.createTunnel({ port });\n const domain = `http${localTunnel ? '' : 's'}://${tunnel.domain}`;\n\n const createTunnelPromise = new Promise<Connection>((resolve, reject) => {\n const tunnelProcess = localTunnel\n ? execa('echo', [tunnel.domain, tunnel.token], { detached: true })\n : execa(bin, ['tunnel', 'run', '--token', tunnel.token]);\n\n const close = () => {\n tunnelProcess.kill();\n };\n\n const listener = async (data: Buffer) => {\n const output = data.toString();\n const match = output.match(tunnel.domain)?.[0];\n\n if (match) {\n resolve({\n domain,\n close,\n });\n }\n };\n\n tunnelProcess.stderr?.on('data', listener);\n tunnelProcess.stdout?.on('data', listener);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n tunnelProcess.on('error', (err) => {\n reject(err);\n });\n });\n\n return {\n domain,\n close: async () => {\n const tunnel = await createTunnelPromise;\n return tunnel.close();\n },\n };\n}\n","import { wixCliAppsFlowTunnelCreationStatusSrc11Evid5233 } from '@wix/bi-logger-dev-tools-data/v2';\nimport type { BiLogger } from '@wix/cli-telemetry';\n\nexport const wixCliTunnelBiEvents = (biLogger: BiLogger) => ({\n tunnel: () => {\n const startTimestamp = Date.now();\n return {\n finish: ({\n isSuccess,\n failureReason,\n }: {\n isSuccess: boolean;\n failureReason?: string;\n }) => {\n void biLogger.report(\n wixCliAppsFlowTunnelCreationStatusSrc11Evid5233({\n isSuccess,\n failureReason,\n tunnelCreationTime: Date.now() - startTimestamp,\n })\n );\n },\n };\n },\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { TunnelClient } from './client.js';\n\nexport function useTunnelClient(): TunnelClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new TunnelClient(httpClient), [httpClient]);\n}\n","import type { HttpClient } from '@wix/cli-http-client';\nimport type { Options } from 'p-retry';\nimport pRetry from 'p-retry';\nimport {\n createTunnel,\n deleteTunnel,\n} from '@wix/ambassador-apps-hosting-v1-deployment/http';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { createTunnelSchema } from './schemas.js';\n\nexport class TunnelClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n public createTunnel = async ({ port }: { port: number }) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(createTunnel({ port })),\n this.retryOptions\n );\n\n return createTunnelSchema.parse(data);\n } catch (error) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateTunnel(),\n cause: error,\n });\n }\n };\n\n public deleteTunnel = async (tunnelId: string) => {\n try {\n await pRetry(\n () => this.httpClient.request(deleteTunnel({ id: tunnelId })),\n this.retryOptions\n );\n } catch (error) {\n throw new CliError({\n code: CliErrorCode.FailedToDeleteTunnel(),\n cause: error,\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nexport const createTunnelSchema = z.object({\n id: z.string(),\n token: z.string(),\n domain: z.string(),\n});\n","export { useTunnel } from './useTunnel.js';\n"],"mappings":";;kRAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,cAAAC,IACA,IAAIC,GAAW,OAAO,OAClBC,EAAY,OAAO,eACnBC,GAAmB,OAAO,yBAC1BC,GAAoB,OAAO,oBAC3BC,GAAe,OAAO,eACtBC,GAAe,OAAO,UAAU,eAChCC,GAAW,CAACC,EAAQC,IAAQ,CAC9B,QAASC,KAAQD,EACfP,EAAUM,EAAQE,EAAM,CAAE,IAAKD,EAAIC,CAAI,EAAG,WAAY,EAAK,CAAC,CAChE,EACIC,GAAc,CAACC,EAAIC,EAAMC,EAAQC,IAAS,CAC5C,GAAIF,GAAQ,OAAOA,GAAS,UAAY,OAAOA,GAAS,WACtD,QAASG,KAAOZ,GAAkBS,CAAI,EAChC,CAACP,GAAa,KAAKM,EAAII,CAAG,GAAKA,IAAQF,GACzCZ,EAAUU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C,EACpD,KAAK,YACP,EAEA,OAAOI,GAAmB,MAAMH,CAAI,CACtC,OAASI,EAAO,CACd,MAAM,IAAIC,EAAS,CACjB,KAAMC,EAAa,qBAAqB,EACxC,MAAOF,CACT,CAAC,CACH,CACF,EAEO,aAAe,MAAOG,GAAqB,CAChD,GAAI,CACF,MAAMN,EACJ,IAAM,KAAK,WAAW,QAAQO,GAAa,CAAE,GAAID,CAAS,CAAC,CAAC,EAC5D,KAAK,YACP,CACF,OAASH,EAAO,CACd,MAAM,IAAIC,EAAS,CACjB,KAAMC,EAAa,qBAAqB,EACxC,MAAOF,CACT,CAAC,CACH,CACF,CACF,EDjDO,SAASK,IAAgC,CAC9C,IAAMC,EAAaC,GAAc,CAAE,KAAM,YAAa,CAAC,EACvD,SAAO,YAAQ,IAAM,IAAIC,EAAaF,CAAU,EAAG,CAACA,CAAU,CAAC,CACjE,CHAO,SAASG,IAAY,CAC1B,IAAMC,KAAgB,UAAmB,EACnCC,EAAeC,GAAgB,EAC/BC,EAAWC,GAAY,EAE7B,sBAAU,IACD,IAAM,CACXJ,EAAc,SAAS,MAAM,CAC/B,EACC,CAAC,CAAC,KAEE,eACL,MAAOK,GAAiB,CAEtB,IAAMC,EADWC,GAAqBJ,CAAQ,EACZ,OAAO,EACzC,GAAI,CACF,IAAMK,EAAS,MAAMC,GAAaJ,EAAMJ,CAAY,EACpD,OAAAD,EAAc,QAAUQ,EACxBF,EAAiB,OAAO,CAAE,UAAW,EAAK,CAAC,EACpC,CAAE,IAAKE,EAAO,MAAO,CAC9B,OAASE,EAAa,CACpB,MAAAJ,EAAiB,OAAO,CACtB,UAAW,GACX,cAAeI,aAAc,MAAQA,EAAG,QAAU,eACpD,CAAC,EAEKA,CACR,CACF,EACA,CAACT,EAAcE,CAAQ,CACzB,CACF,COtCAQ","names":["require_constants","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","constants_exports","CLOUDFLARED_VERSION","DEFAULT_CLOUDFLARED_BIN","RELEASE_BASE","bin","use","import_node_path","__dirname","executable","require_error","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","error_exports","UnsupportedError","message","require_install","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","install_exports","install","install_linux","install_macos","install_windows","import_node_fs","import_node_path","import_node_https","import_node_child_process","import_constants","import_error","LINUX_URL","MACOS_URL","WINDOWS_URL","resolve_base","version","file","download","url","redirect","resolve","reject","request","res","redirection","err","require_regex","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","regex_exports","config_regex","conn_regex","connectorID_regex","disconnect_regex","index_regex","ip_regex","location_regex","metrics_regex","tunnelID_regex","require_tunnel","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","tunnel_exports","tunnel","import_node_child_process","import_constants","import_regex","options","args","value","child","url_regex","url_resolver","url_rejector","url","pair","connection_resolvers","connection_rejectors","connections","i","parser","data","_a","str","url_match","conn_match","ip_match","location_match","index_match","id","ip","location","idx","require_service","__commonJSMin","exports","module","init_esm_shims","__create","__defProp","__getOwnPropDesc","__getOwnPropNames","__getProtoOf","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toESM","mod","isNodeMode","__toCommonJS","service_exports","AlreadyInstalledError","LINUX_SERVICE_PATH","MACOS_SERVICE_PATH","NotInstalledError","clean","current","err","exists","identifier","install","journal","log","service","service_name","uninstall","import_node_os","import_node_fs","import_node_child_process","import_constants","import_regex","is_root","token","args","result","is_systemd","n","_a","_b","_c","_d","log2","tunnelID","connectorID","connections","metrics","config","line","id","location","ip","idx","err2","require_lib","__commonJSMin","exports","module","init_esm_shims","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","target","all","name","__copyProps","to","from","except","desc","key","__toCommonJS","mod","lib_exports","import_service","import_constants","import_install","import_tunnel","init_esm_shims","import_react","init_esm_shims","dirname","import_cloudflared","launchTunnel","port","tunnelClient","localTunnel","getTestOverrides","pathExists","e","err","CliError","CliErrorCode","dirname","tunnel","domain","createTunnelPromise","resolve","reject","tunnelProcess","execa","close","listener","data","init_esm_shims","wixCliTunnelBiEvents","biLogger","startTimestamp","isSuccess","failureReason","wixCliAppsFlowTunnelCreationStatusSrc11Evid5233","init_esm_shims","import_react","init_esm_shims","init_esm_shims","_createTunnelRequest","_createTunnelResponse","_deleteTunnelRequest","_deleteTunnelResponse","resolveWixAppsHostingV1BackendServiceUrl","opts","domainToMappings","resolveUrl","createTunnel","payload","_a","serializer","_createTunnelRequest","toReq","fromReq","fromRes","_createTunnelResponse","__createTunnel","host","serializedData","metadata","deleteTunnel","_deleteTunnelRequest","_deleteTunnelResponse","__deleteTunnel","toURLSearchParams","init_esm_shims","createTunnelSchema","z","TunnelClient","httpClient","minRetryTimeout","getTestOverrides","port","data","pRetry","createTunnel","createTunnelSchema","error","CliError","CliErrorCode","tunnelId","deleteTunnel","useTunnelClient","httpClient","useHttpClient","TunnelClient","useTunnel","connectionRef","tunnelClient","useTunnelClient","biLogger","useBiLogger","port","tunnelCreationBi","wixCliTunnelBiEvents","tunnel","launchTunnel","ex","init_esm_shims"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{Ab as p,Ba as r}from"./chunk-FMIXY6J5.js";import{b as v,c as f}from"./chunk-JXE3LQ2S.js";import{e as m,h as c}from"./chunk-V4TR6DCM.js";c();var s=m(v(),1),i=m(f(),1);function k(){let{model:t}=p(),n=(0,s.useMemo)(()=>{let l=t.components.filter((0,i.isType)(r.Api)).sort((e,o)=>e.title.localeCompare(o.title)),a=t.components.filter((0,i.isType)(r.Event)).sort((e,o)=>e.title.localeCompare(o.title)),u=t.components.filter((0,i.isType)(r.ServicePlugin)).sort((e,o)=>e.servicePlugin.name.localeCompare(o.servicePlugin.name));return{Api:l,Event:a,ServicePlugin:u}},[t.components]);return{backendComponents:[...n.Api,...n.Event,...n.ServicePlugin],backendComponentsByType:n}}export{k as a};
|
|
4
|
+
//# sourceMappingURL=chunk-B4SDDVMV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{sa as L,ta as U,ua as w,va as Z}from"./chunk-FMIXY6J5.js";import{c as u,h as n}from"./chunk-V4TR6DCM.js";var v=u((he,b)=>{"use strict";n();function j(e,r,i,t){for(var s=e.length,f=i+(t?1:-1);t?f--:++f<s;)if(r(e[f],f,e))return f;return-1}b.exports=j});var a=u((oe,N)=>{"use strict";n();function k(e){return e!==e}N.exports=k});var S=u((qe,A)=>{"use strict";n();function z(e,r,i){for(var t=i-1,s=e.length;++t<s;)if(e[t]===r)return t;return-1}A.exports=z});var F=u((de,O)=>{"use strict";n();var B=v(),D=a(),J=S();function K(e,r,i){return r===r?J(e,r,i):B(e,D,i)}O.exports=K});var C=u((pe,T)=>{"use strict";n();var M=F();function P(e,r){var i=e==null?0:e.length;return!!i&&M(e,r,0)>-1}T.exports=P});var R=u((be,E)=>{"use strict";n();function Q(e,r,i){for(var t=-1,s=e==null?0:e.length;++t<s;)if(i(r,e[t]))return!0;return!1}E.exports=Q});var Y=u((Ne,W)=>{"use strict";n();function V(){}W.exports=V});var G=u((Ae,_)=>{"use strict";n();var d=Z(),X=Y(),$=w(),y=1/0,m=d&&1/$(new d([,-0]))[1]==y?function(e){return new d(e)}:X;_.exports=m});var le=u((Oe,H)=>{"use strict";n();var ee=L(),ne=C(),re=R(),ie=U(),te=G(),se=w(),ue=200;function fe(e,r,i){var t=-1,s=ne,f=e.length,I=!0,c=[],l=c;if(i)I=!1,s=re;else if(f>=ue){var g=r?null:te(e);if(g)return se(g);I=!1,s=ie,l=new ee}else l=r?[]:c;e:for(;++t<f;){var o=e[t],q=r?r(o):o;if(o=i||o!==0?o:0,I&&q===q){for(var p=l.length;p--;)if(l[p]===q)continue e;r&&l.push(q),c.push(o)}else s(l,q,i)||(l!==c&&l.push(q),c.push(o))}return c}H.exports=fe});export{le as a};
|
|
4
|
+
//# sourceMappingURL=chunk-C4SXZWXS.js.map
|