fleetbo-svro 1.0.28 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +5 -4
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -90,9 +90,9 @@ VITE_FLEETBO_ENTERPRISE_ID=${i.enterpriseId}
|
|
|
90
90
|
VITE_FLEETBO_KEY_APP=${r}
|
|
91
91
|
${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
|
|
92
92
|
`:""}`;a.appendFileSync(n,l),f(".env file updated successfully with Fleetbo keys!")}function O(t){let o=p.join(t,"svro.d.ts");if(a.existsSync(o))try{a.unlinkSync(o),f("\u2192 Removed legacy svro.d.ts from project root.")}catch{}}function I(t,o){if(process.env.FLEETBO_SKIP_TYPECHECK_SETUP)return;let n=p.join(t,"tsconfig.json"),s=p.join(t,"jsconfig.json"),r=a.existsSync(n)?n:s,b=!a.existsSync(r),e={};if(!b)try{e=JSON.parse(a.readFileSync(r,"utf8"))}catch{u(`\u26A0\uFE0F Unable to read ${p.basename(r)} (Invalid JSON).`);return}e.compilerOptions=e.compilerOptions||{};let i=!1,l=S(o,"react"),c=S(o,"vite");b?(e.compilerOptions.checkJs=!0,e.compilerOptions.allowJs=!0,e.compilerOptions.target=e.compilerOptions.target||"ES2020",e.compilerOptions.module=e.compilerOptions.module||"ESNext",e.compilerOptions.moduleResolution=e.compilerOptions.moduleResolution||"bundler",e.include=e.include||["src"],i=!0):(e.compilerOptions.checkJs===void 0&&(e.compilerOptions.checkJs=!0,i=!0),e.compilerOptions.allowJs===void 0&&(e.compilerOptions.allowJs=!0,i=!0)),l&&e.compilerOptions.jsx===void 0&&(e.compilerOptions.jsx="react-jsx",i=!0),c&&e.compilerOptions.types===void 0&&(e.compilerOptions.types=["vite/client"],i=!0),i&&(a.writeFileSync(r,JSON.stringify(e,null,2)+`
|
|
93
|
-
`),f(`\u2192 Updated ${p.basename(r)}.`))}function
|
|
93
|
+
`),f(`\u2192 Updated ${p.basename(r)}.`))}function w(t){let o=["src/app/layout.tsx","src/app/layout.jsx","app/layout.tsx","app/layout.jsx","src/pages/_app.tsx","src/pages/_app.jsx","pages/_app.tsx","pages/_app.jsx","src/main.tsx","src/main.jsx","src/main.ts","src/main.js","src/index.tsx","src/index.jsx","src/index.ts","src/index.js","src/App.tsx","src/App.jsx","src/App.vue","app.vue","src/routes/+layout.svelte","src/routes/+layout.ts","src/main.singletons.ts"];for(let n of o){let s=p.join(t,n);if(a.existsSync(s)){let r=a.readFileSync(s,"utf8");r.includes("fleetbo-svro")||(r.startsWith('"use client"')||r.startsWith("'use client'")?r=r.replace(/(['"]use client['"];?\r?\n)/,`$1import 'fleetbo-svro';
|
|
94
94
|
`):r=`import 'fleetbo-svro';
|
|
95
|
-
`+r,a.writeFileSync(s,r));return}}}function
|
|
95
|
+
`+r,a.writeFileSync(s,r));return}}}function j(t,o){if(process.env.FLEETBO_SKIP_AUTOIMPORT_SETUP)return;let s=["vite.config.ts","vite.config.js","vite.config.mjs"].map(l=>p.join(t,l)).find(l=>a.existsSync(l));if(!s)return;let r;try{r=a.readFileSync(s,"utf8")}catch{return}let b="fleetbo-svro",e=r,i=`{
|
|
96
96
|
name: 'fleetbo-auto-runtime',
|
|
97
97
|
transform(code, id) {
|
|
98
98
|
if (!id.includes('node_modules') && !code.includes('fleetbo-svro') && /(src[\\\\/](main|index|App|root))\\.(jsx?|tsx?|vue|svelte)/i.test(id)) {
|
|
@@ -152,7 +152,7 @@ ${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
|
|
|
152
152
|
`;if(P){let m=P.index+P[0].length;e=e.slice(0,m)+`
|
|
153
153
|
`+v+e.slice(m)}else e=v+e}}}if(!e.includes("fleetbo-auto-runtime")){let l=e.match(/plugins\s*:\s*\[/);if(l){let c=l.index+l[0].length;e=e.slice(0,c)+`
|
|
154
154
|
`+i+e.slice(c)}}e!==r&&a.writeFileSync(s,e)}function K(t){let o=p.join(t,".vscode"),n=p.join(o,"settings.json");try{a.existsSync(o)||a.mkdirSync(o,{recursive:!0});let s={};if(a.existsSync(n))try{s=JSON.parse(a.readFileSync(n,"utf8"))}catch{s={}}s["workbench.colorCustomizations"]=s["workbench.colorCustomizations"]||{},s["workbench.colorCustomizations"]["editorInfo.foreground"]="#00feae",s["workbench.colorCustomizations"]["editorHint.foreground"]="#00feae",a.writeFileSync(n,JSON.stringify(s,null,2)+`
|
|
155
|
-
`),f("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function X(t,o,n={}){let{skipSelfInstall:s=!1}=n,r=p.join(__dirname,"..");s||U(t,o),B(t),M(r),q(t),K(t),O(t),I(t,o),
|
|
155
|
+
`),f("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function X(t,o,n={}){let{skipSelfInstall:s=!1}=n,r=p.join(__dirname,"..");s||U(t,o),B(t),M(r),q(t),K(t),O(t),I(t,o),j(t,o),w(t)}k.exports={touchTsConfig:V,log:f,logError:u,handleAuthAndEnv:W,detectDependency:S,cleanupLegacyRootDts:O,patchJsOrTsConfig:I,attemptViteAutoImportPatch:j,injectUniversalRuntime:w,runFullSetup:X}});var g=require("fs"),F=require("path"),_=require("https"),{runFullSetup:z,handleAuthAndEnv:Y,touchTsConfig:G,attemptViteAutoImportPatch:Q,injectUniversalRuntime:Z}=C(),ee="\x1B[34m",te="\x1B[31m",R="\x1B[0m";function d(t){console.log(`${ee}${t}${R}`)}function y(t){console.error(`${te}${t}${R}`)}function oe(t,o){return new Promise((n,s)=>{let r=JSON.stringify({enterpriseID:t,schema:o}),b={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},e=_.request(b,i=>{let l="";i.on("data",c=>{l+=c}),i.on("end",()=>{i.statusCode>=200&&i.statusCode<300?n(JSON.parse(l)):s(new Error(`Edge sync failed with HTTP ${i.statusCode}`))})});e.on("error",i=>s(i)),e.write(r),e.end()})}function ne(t){let o=F.join(t,".env");if(!g.existsSync(o))return{};let n=g.readFileSync(o,"utf8"),s={};return n.split(`
|
|
156
156
|
`).forEach(r=>{let[b,...e]=r.split("=");b&&e.length>0&&(s[b.trim()]=e.join("=").trim())}),s}function se(t){return new Promise((o,n)=>{let s=JSON.stringify({projectId:t,moduleName:"svro.schema.json"}),r={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},b=_.request(r,e=>{let i="";e.on("data",l=>{i+=l}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{let l=JSON.parse(i);if(l.success&&l.found&&l.module){let c=l.module.code||l.module.mockCode;o(typeof c=="string"?JSON.parse(c):c)}else n(new Error("Schema not found in Fleetbo Cloud."))}catch{n(new Error("Invalid JSON response received from Fleetbo server."))}else n(new Error(`Server error ${e.statusCode}`))})});b.on("error",e=>n(e)),b.write(s),b.end()})}var E=process.argv.slice(2),x=E[0];async function re(){let t=process.cwd(),o=F.join(t,"package.json");if(x==="init"||x==="doctor")d(`
|
|
157
157
|
[Fleetbo] Initializing and configuring Fleetbo...`),await Y(t,E),z(t,o),d(`
|
|
158
158
|
[Fleetbo] Configuration completed successfully!
|
|
@@ -424,7 +424,8 @@ type FleetboProp = {
|
|
|
424
424
|
};
|
|
425
425
|
|
|
426
426
|
declare global {
|
|
427
|
-
type
|
|
427
|
+
type KnownFleetboTables = ${P};
|
|
428
|
+
type FleetboTables = KnownFleetboTables | (string & { _fleetboPending?: never });
|
|
428
429
|
type FleetboPhoneOtpOptions = {
|
|
429
430
|
phoneNumber: string;
|
|
430
431
|
appName?: string;
|