@gadgetinc/ggt 1.4.2 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/add-XHMGXWYX.js +81 -0
- package/dist/add-XHMGXWYX.js.map +7 -0
- package/dist/{chunk-JOWMHVPF.js → chunk-3B2GY4UU.js} +2 -2
- package/dist/{chunk-JOWMHVPF.js.map → chunk-3B2GY4UU.js.map} +1 -1
- package/dist/{chunk-PRAA2FG3.js → chunk-5VLIBRPJ.js} +2 -2
- package/dist/chunk-7DYQUG5M.js +2 -0
- package/dist/chunk-7DYQUG5M.js.map +7 -0
- package/dist/{chunk-GKAC6HNS.js → chunk-A75V6SNW.js} +17 -10
- package/dist/chunk-A75V6SNW.js.map +7 -0
- package/dist/{chunk-P7E7PAMQ.js → chunk-GFQYFEEH.js} +2 -2
- package/dist/{chunk-L4OG4HIV.js → chunk-HAYHNB7Q.js} +2 -2
- package/dist/{chunk-L4OG4HIV.js.map → chunk-HAYHNB7Q.js.map} +1 -1
- package/dist/chunk-HN3YKQ3C.js +6 -0
- package/dist/chunk-HN3YKQ3C.js.map +7 -0
- package/dist/chunk-KW4V2PJW.js +18 -0
- package/dist/chunk-KW4V2PJW.js.map +7 -0
- package/dist/chunk-LPIHKY3M.js +50 -0
- package/dist/chunk-LPIHKY3M.js.map +7 -0
- package/dist/chunk-SX5LO3XQ.js +2 -0
- package/dist/{chunk-OTYPO33S.js → chunk-U5I2YBJK.js} +2 -2
- package/dist/{chunk-M5HB5SEG.js → chunk-WQ4SFIE4.js} +2 -2
- package/dist/{chunk-M5HB5SEG.js.map → chunk-WQ4SFIE4.js.map} +1 -1
- package/dist/chunk-XE5GH5GR.js +2 -0
- package/dist/{chunk-ZCRXH55K.js.map → chunk-XE5GH5GR.js.map} +1 -1
- package/dist/chunk-XOSBJSTW.js +65 -0
- package/dist/chunk-XOSBJSTW.js.map +7 -0
- package/dist/chunk-Z7JIVKEF.js +8 -0
- package/dist/{chunk-KP35JQJ7.js.map → chunk-Z7JIVKEF.js.map} +1 -1
- package/dist/{deploy-T5ZUHHLZ.js → deploy-QW6KPNDB.js} +2 -2
- package/dist/{deploy-T5ZUHHLZ.js.map → deploy-QW6KPNDB.js.map} +1 -1
- package/dist/{dev-5CVDVGE3.js → dev-KUTYS7OU.js} +4 -4
- package/dist/{dev-5CVDVGE3.js.map → dev-KUTYS7OU.js.map} +1 -1
- package/dist/esm-PLVGBDRY.js +38 -0
- package/dist/esm-PLVGBDRY.js.map +7 -0
- package/dist/{list-BV7QOWA2.js → list-OSMGHITM.js} +2 -2
- package/dist/{list-BV7QOWA2.js.map → list-OSMGHITM.js.map} +1 -1
- package/dist/login-UU4MWB6Y.js +2 -0
- package/dist/logout-XPKPHMRV.js +7 -0
- package/dist/{logout-QLW45MMK.js.map → logout-XPKPHMRV.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/{open-TKGHV5HA.js → open-SP5XOXPG.js} +2 -2
- package/dist/{open-TKGHV5HA.js.map → open-SP5XOXPG.js.map} +1 -1
- package/dist/{pull-RRR7ISUG.js → pull-7JMGBM4A.js} +2 -2
- package/dist/{pull-RRR7ISUG.js.map → pull-7JMGBM4A.js.map} +1 -1
- package/dist/push-7S6V2HSB.js +2 -0
- package/dist/{status-BKCHGWJO.js → status-CJVN2UZ6.js} +2 -2
- package/dist/{status-BKCHGWJO.js.map → status-CJVN2UZ6.js.map} +1 -1
- package/dist/{version-LUMBTKD4.js → version-NFFT7WG5.js} +2 -2
- package/dist/{version-LUMBTKD4.js.map → version-NFFT7WG5.js.map} +1 -1
- package/dist/{whoami-ONJCZDTX.js → whoami-MU3POPXB.js} +2 -2
- package/dist/{whoami-ONJCZDTX.js.map → whoami-MU3POPXB.js.map} +1 -1
- package/package.json +14 -14
- package/dist/add-Q2YM34TO.js +0 -78
- package/dist/add-Q2YM34TO.js.map +0 -7
- package/dist/chunk-56W5U2JG.js +0 -2
- package/dist/chunk-56W5U2JG.js.map +0 -7
- package/dist/chunk-BWIVLBZY.js +0 -18
- package/dist/chunk-BWIVLBZY.js.map +0 -7
- package/dist/chunk-GKAC6HNS.js.map +0 -7
- package/dist/chunk-HVJWUXJL.js +0 -65
- package/dist/chunk-HVJWUXJL.js.map +0 -7
- package/dist/chunk-KP35JQJ7.js +0 -8
- package/dist/chunk-O63J4YN5.js +0 -2
- package/dist/chunk-YINVPQ2V.js +0 -6
- package/dist/chunk-YINVPQ2V.js.map +0 -7
- package/dist/chunk-ZCRXH55K.js +0 -2
- package/dist/chunk-ZN6HRN6U.js +0 -50
- package/dist/chunk-ZN6HRN6U.js.map +0 -7
- package/dist/esm-BEXWGPJL.js +0 -37
- package/dist/esm-BEXWGPJL.js.map +0 -7
- package/dist/login-M6YPWB3H.js +0 -2
- package/dist/logout-QLW45MMK.js +0 -7
- package/dist/push-KUORLNK6.js +0 -2
- /package/dist/{chunk-PRAA2FG3.js.map → chunk-5VLIBRPJ.js.map} +0 -0
- /package/dist/{chunk-P7E7PAMQ.js.map → chunk-GFQYFEEH.js.map} +0 -0
- /package/dist/{chunk-O63J4YN5.js.map → chunk-SX5LO3XQ.js.map} +0 -0
- /package/dist/{chunk-OTYPO33S.js.map → chunk-U5I2YBJK.js.map} +0 -0
- /package/dist/{login-M6YPWB3H.js.map → login-UU4MWB6Y.js.map} +0 -0
- /package/dist/{push-KUORLNK6.js.map → push-7S6V2HSB.js.map} +0 -0
package/README.md
CHANGED
|
@@ -253,6 +253,9 @@ Examples
|
|
|
253
253
|
Add a new model 'post' with 2 new 'string' type fields 'title' and 'body':
|
|
254
254
|
$ ggt add model post title:string body:string
|
|
255
255
|
|
|
256
|
+
Add a new 'boolean' type field 'published' to an existing model
|
|
257
|
+
ggt add field post/published:boolean
|
|
258
|
+
|
|
256
259
|
Add new action 'publish' to the 'post' model:
|
|
257
260
|
ggt add action model/post/publish
|
|
258
261
|
|
|
@@ -262,8 +265,8 @@ Examples
|
|
|
262
265
|
Add a new route 'howdy'
|
|
263
266
|
ggt add route GET howdy
|
|
264
267
|
|
|
265
|
-
|
|
266
|
-
ggt add
|
|
268
|
+
Clone the `development` environment into a new `staging` environment
|
|
269
|
+
ggt add environment staging --environment development
|
|
267
270
|
```
|
|
268
271
|
|
|
269
272
|
### `ggt open`
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import{f as O,g as R,h as M,i as j,j as k,k as P,p as b}from"./chunk-A75V6SNW.js";import{g as N,l as J,m as D,n as _,o as E}from"./chunk-3B2GY4UU.js";import"./chunk-HAYHNB7Q.js";import"./chunk-Z7JIVKEF.js";import{c as f}from"./chunk-U5I2YBJK.js";import"./chunk-HN3YKQ3C.js";import"./chunk-KW4V2PJW.js";import{b as T,g as C,h as S,k as w,o as B,q as y,y as U,z as L}from"./chunk-LPIHKY3M.js";import"./chunk-5VLIBRPJ.js";import{b as m,ga as d,ia as p,m as F}from"./chunk-XOSBJSTW.js";import"./chunk-GFQYFEEH.js";import{a as g,h as $}from"./chunk-7DYQUG5M.js";$();var h=class extends S{static{g(this,"AddClientError")}isBug=C.NO;constructor(o){let i="";if(F(o.cause)){let a=B(o.cause.map(e=>e.message));i=d` • ${a.map(e=>e.split(`
|
|
2
|
+
`).join(`
|
|
3
|
+
\u200E \u2022 `)).join(`
|
|
4
|
+
`)}`}else i=d`${o.cause}`;super(i)}render(){return`${m.redBright(w.cross)} Failed to add:
|
|
5
|
+
`+this.message}},ue={...D},G=g(()=>d`
|
|
6
|
+
Adds models, fields, actions and routes to your app.
|
|
7
|
+
|
|
8
|
+
This command first performs a sync to ensure that your local and environment directories match, changes are tracked since last sync.
|
|
9
|
+
If any conflicts are detected, they must be resolved before adding models, fields, actions or routes.
|
|
10
|
+
|
|
11
|
+
{gray Usage}
|
|
12
|
+
ggt add model <model_name> [field_name:field_type ...]
|
|
13
|
+
|
|
14
|
+
ggt add action [CONTEXT]/<action_name>
|
|
15
|
+
CONTEXT:Specifies the kind of action. Use "model" for model actions otherwise use "action".
|
|
16
|
+
|
|
17
|
+
ggt add route <HTTP_METHOD> <route_path>
|
|
18
|
+
|
|
19
|
+
ggt add field <model_path>/<field_name>:<field_type>
|
|
20
|
+
|
|
21
|
+
{gray Options}
|
|
22
|
+
-e, --env <env_name> Selects the environment to add to. Default set on ".gadget/sync.json"
|
|
23
|
+
|
|
24
|
+
{gray Examples}
|
|
25
|
+
Add a new model 'post' with out fields:
|
|
26
|
+
{cyanBright $ ggt add model modelA}
|
|
27
|
+
|
|
28
|
+
Add a new model 'post' with 2 new 'string' type fields 'title' and 'body':
|
|
29
|
+
{cyanBright $ ggt add model post title:string body:string}
|
|
30
|
+
|
|
31
|
+
Add a new 'boolean' type field 'published' to an existing model
|
|
32
|
+
{cyanBright ggt add field post/published:boolean}
|
|
33
|
+
|
|
34
|
+
Add new action 'publish' to the 'post' model:
|
|
35
|
+
{cyanBright ggt add action model/post/publish}
|
|
36
|
+
|
|
37
|
+
Add a new action 'audit'
|
|
38
|
+
{cyanBright ggt add action action/audit}
|
|
39
|
+
|
|
40
|
+
Add a new route 'howdy'
|
|
41
|
+
{cyanBright ggt add route GET howdy}
|
|
42
|
+
|
|
43
|
+
Clone the \`development\` environment into a new \`staging\` environment
|
|
44
|
+
{cyanBright ggt add environment staging --environment development}
|
|
45
|
+
`,"usage"),fe=g(async(t,o)=>{let i=await E(process.cwd()),a=await _.load(t,{command:"add",args:o,directory:i});if(!a)throw new N({command:"add",args:o,directory:i});let e=new b(a),r=await e.hashes(t,!0);switch(r.inSync||await e.merge(t,{hashes:r,printEnvironmentChangesOptions:{limit:5},printLocalChangesOptions:{limit:5},quietly:!0}),p({ensureEmptyLineAbove:!0,content:`${m.greenBright(w.tick)} Sync completed ${P()}`}),o._[0]){case"model":await H(t,{args:o,filesync:e});break;case"action":await X(t,{args:o,filesync:e});break;case"route":await q(t,{args:o,filesync:e});break;case"field":await z(t,{args:o,filesync:e});break;case"environment":case"env":await Q(t,{args:o,filesync:e});break;default:p(G(t));return}},"run"),I=g(t=>{let o=[],i=[];return t.forEach(a=>{let e=/^(.*):+(.*)$/.exec(a);!e||e.length!==3||!e[1]||!e[2]?o.push(d`${a} is not a valid field definition`):i.push({name:e[1].replace(/:+/g,""),fieldType:e[2]})}),[i,o]},"parseFieldValues"),H=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1];if(!e)throw new f(d`Failed to add model, missing model path
|
|
46
|
+
|
|
47
|
+
{gray Usage}
|
|
48
|
+
{cyanBright ggt add model <model_name> [field_name:field_type ...]}`);let r=[];if(o._.length>2){let[c,u]=I(o._.slice(2));if(u.length>0)throw new f(d`
|
|
49
|
+
Failed to add model:
|
|
50
|
+
• ${u.join(`
|
|
51
|
+
\u2022 `)}
|
|
52
|
+
|
|
53
|
+
{gray Usage}
|
|
54
|
+
{cyanBright ggt add model ${e} [field_name:field_type ...]}`);r.push(...c)}let n;try{n=(await a.edit.mutate({mutation:O,variables:{path:e,fields:r.map(c=>({name:c.name,fieldType:c.fieldType}))}})).createModel}catch(c){throw c instanceof y?new h(c):c}p({ensureEmptyLineAbove:!0,content:m.gray("New model created in environment.")}),await i.writeToLocalFilesystem(t,{filesVersion:n.remoteFilesVersion,files:n.changed,delete:[]});let s=T.isSupported?T(e,`https://${a.environment.application.primaryDomain}/edit/${a.environment.name}/model/${e}/schema`):e;p({ensureEmptyLineAbove:!0,content:`${m.greenBright(w.tick)} Model ${m.cyanBright(s)} added successfully.`})},"modelSubCommand"),X=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1];if(!e)throw new f(d`Failed to add action, missing action path
|
|
55
|
+
|
|
56
|
+
{gray Usage}
|
|
57
|
+
{cyanBright ggt add action [CONTEXT]/<action_name>
|
|
58
|
+
CONTEXT:Specifies the kind of action. Use "model" for model actions otherwise use "action".}`);let r=await U(t,a.environment),n=await L(t,a.environment),s=e.split("/"),c,u=s.length>1?s.slice(0,s.length-1):s,A=s[s.length-1],V=r.find(l=>{let v=u[u.length-1];return l.apiIdentifier.toUpperCase()===v?.toUpperCase()&&l.namespace?.join("/")===u.slice(0,u.length-1).join("/")}),x=n.find(l=>l.namespace?.join("/")===u.join("/"));if(V&&x){let l=u.join("/");c=await J({choices:["models","actions"],content:d`
|
|
59
|
+
{bold Namespace Conflict:} The action '${A}.js' cannot be automatically added due to a namespace conflict.
|
|
60
|
+
|
|
61
|
+
How would you like to proceed?:
|
|
62
|
+
`,formatChoice:g(v=>{switch(v){case"models":return`As a Model action in ${m.gray(`models/${l}/${A}.js`)}`;case"actions":return`As an Action in ${m.gray(`actions/${l}/${A}.js`)}`}},"formatChoice")}),p({ensureEmptyLineAbove:!0,content:d`${m.yellowBright(w.info)} You can override the context of the action by specifying the context in the path. For example: {gray ggt add action ${c}/${e}}`})}try{let l=(await a.edit.mutate({mutation:R,variables:{path:c?`${c}/`+e:e}})).createAction;await i.writeToLocalFilesystem(t,{filesVersion:l.remoteFilesVersion,files:l.changed,delete:[]})}catch(l){throw l instanceof y?new h(l):l}p({ensureEmptyLineAbove:!0,content:`Action ${m.cyanBright(e)} added successfully.`})},"actionSubCommand"),q=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1],r=o._[2];if(!e)throw new f(d`Failed to add route, missing route method
|
|
63
|
+
|
|
64
|
+
{gray Usage}
|
|
65
|
+
{cyanBright ggt add route <HTTP_METHOD> <route_path>}`);if(!r)throw new f(d`Failed to add route, missing route path
|
|
66
|
+
|
|
67
|
+
{gray Usage}
|
|
68
|
+
{cyanBright ggt add route ${e} <route_path>}`);try{let n=(await a.edit.mutate({mutation:M,variables:{method:e,path:r}})).createRoute;await i.writeToLocalFilesystem(t,{filesVersion:n.remoteFilesVersion,files:n.changed,delete:[]})}catch(n){throw n instanceof y?new h(n):n}p({ensureEmptyLineAbove:!0,content:`Route ${m.cyanBright(r)} added successfully.`})},"routeSubCommand"),z=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1]?.split("/");if(!e)throw new f(d`Failed to add field, invalid field path definition
|
|
69
|
+
|
|
70
|
+
{gray Usage}
|
|
71
|
+
{cyanBright ggt add field <model_path>/<field_name>:<field_type>}`);let r=[];if(e[1]){let[n,s]=I([e[1]]);if(s.length>0)throw new f(d`
|
|
72
|
+
Failed to add field:
|
|
73
|
+
• ${s.join(`
|
|
74
|
+
\u2022`)}
|
|
75
|
+
|
|
76
|
+
{gray Usage}
|
|
77
|
+
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);r.push(...n)}else throw new f(d`Failed to add field, invalid field definition
|
|
78
|
+
|
|
79
|
+
{gray Usage}
|
|
80
|
+
{cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let n=(await a.edit.mutate({mutation:j,variables:{path:e[0],fields:r.map(s=>({name:s.name,fieldType:s.fieldType}))}})).createModelFields;await i.writeToLocalFilesystem(t,{filesVersion:n.remoteFilesVersion,files:n.changed,delete:[]})}catch(n){throw n instanceof y?new h(n):n}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(r[0]?.name)} added successfully.`})},"fieldSubCommand"),Q=g(async(t,{args:o,filesync:i})=>{let a=i.syncJson,e=o._[1]??Y();try{await a.edit.mutate({mutation:k,variables:{environment:{slug:e,sourceSlug:a.environment.name}}})}catch(n){throw n instanceof y?new h(n):n}if(p({ensureEmptyLineAbove:!0,content:`Environment ${m.cyanBright(e)} added successfully.`}),await _.load(t,{command:"pull",args:{_:[],"--app":void 0,"--allow-unknown-directory":void 0,"--allow-different-app":void 0,"--env":e},directory:await E(process.cwd())})){let n=new b(a),s=await n.hashes(t);if(s.environmentChangesToPull.size===0){p({ensureEmptyLineAbove:!0,content:"Nothing to pull."});return}s.localChangesToPush.size>0&&await n.print(t,{hashes:s}),await n.pull(t,{hashes:s,force:!0})}},"envSubCommand"),Y=g(()=>{let t=new Date;return`env-${t.toISOString().slice(0,10).replace(/-/g,"")}-${t.toLocaleTimeString("en-US",{hour12:!1}).replace(/:/g,"")}`},"makeDefaultEnvName");export{h as AddClientError,ue as args,fe as run,G as usage};
|
|
81
|
+
//# sourceMappingURL=add-XHMGXWYX.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/add.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-case-declarations */\nimport chalk from \"chalk\";\nimport terminalLink from \"terminal-link\";\nimport { getGlobalActions, getModels } from \"../services/app/app.js\";\nimport {\n CREATE_ACTION_MUTATION,\n CREATE_ENVIRONMENT_MUTATION,\n CREATE_MODEL_FIELDS_MUTATION,\n CREATE_MODEL_MUTATION,\n CREATE_ROUTE_MUTATION,\n} from \"../services/app/edit/operation.js\";\nimport { ClientError } from \"../services/app/error.js\";\nimport { ArgError, type ArgsDefinitionResult } from \"../services/command/arg.js\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport type { Context } from \"../services/command/context.js\";\nimport { UnknownDirectoryError } from \"../services/filesync/error.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { GGTError, IsBug } from \"../services/output/report.js\";\nimport { select } from \"../services/output/select.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { symbol } from \"../services/output/symbols.js\";\nimport { ts } from \"../services/output/timestamp.js\";\nimport { uniq } from \"../services/util/collection.js\";\nimport { isGraphQLErrors } from \"../services/util/is.js\";\n\nexport class AddClientError extends GGTError {\n isBug = IsBug.NO;\n\n constructor(error: ClientError) {\n let template = \"\";\n\n if (isGraphQLErrors(error.cause)) {\n const errors = uniq(error.cause.map((x) => x.message));\n\n template = sprint` \u2022 ${errors.map((e) => e.split(\"\\n\").join(\"\\n\u200E \u2022 \")).join(\"\\n\")}`; // Why in gods name do I have to put an empty character for the tab to work?\n } else {\n template = sprint`${error.cause}`;\n }\n\n super(template);\n }\n\n protected override render(): string {\n return `${chalk.redBright(symbol.cross)} Failed to add:\\n ` + this.message;\n }\n}\n\nexport type AddArgs = typeof args;\nexport type AddArgsResult = ArgsDefinitionResult<AddArgs>;\n\nexport const args = { ...SyncJsonArgs };\n\nexport const usage: Usage = () => {\n return sprint`\n Adds models, fields, actions and routes to your app.\n\n This command first performs a sync to ensure that your local and environment directories match, changes are tracked since last sync.\n If any conflicts are detected, they must be resolved before adding models, fields, actions or routes.\n\n {gray Usage}\n ggt add model <model_name> [field_name:field_type ...]\n\n ggt add action [CONTEXT]/<action_name>\n CONTEXT:Specifies the kind of action. Use \"model\" for model actions otherwise use \"action\".\n\n ggt add route <HTTP_METHOD> <route_path>\n\n ggt add field <model_path>/<field_name>:<field_type>\n\n {gray Options}\n -e, --env <env_name> Selects the environment to add to. Default set on \".gadget/sync.json\"\n\n {gray Examples}\n Add a new model 'post' with out fields:\n {cyanBright $ ggt add model modelA}\n\n Add a new model 'post' with 2 new 'string' type fields 'title' and 'body':\n {cyanBright $ ggt add model post title:string body:string}\n\n Add a new 'boolean' type field 'published' to an existing model\n {cyanBright ggt add field post/published:boolean}\n\n Add new action 'publish' to the 'post' model:\n {cyanBright ggt add action model/post/publish}\n\n Add a new action 'audit'\n {cyanBright ggt add action action/audit}\n\n Add a new route 'howdy'\n {cyanBright ggt add route GET howdy}\n\n Clone the \\`development\\` environment into a new \\`staging\\` environment\n {cyanBright ggt add environment staging --environment development}\n `;\n};\n\nexport const run: Run<AddArgs> = async (ctx, args) => {\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.load(ctx, { command: \"add\", args, directory });\n if (!syncJson) {\n throw new UnknownDirectoryError({ command: \"add\", args, directory });\n }\n\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx, true);\n\n if (!hashes.inSync) {\n await filesync.merge(ctx, {\n hashes,\n printEnvironmentChangesOptions: { limit: 5 },\n printLocalChangesOptions: { limit: 5 },\n quietly: true,\n });\n }\n\n println({ ensureEmptyLineAbove: true, content: `${chalk.greenBright(symbol.tick)} Sync completed ${ts()}` });\n\n switch (args._[0]) {\n case \"model\":\n await modelSubCommand(ctx, { args, filesync });\n break;\n case \"action\":\n await actionSubCommand(ctx, { args, filesync });\n break;\n case \"route\":\n await routeSubCommand(ctx, { args, filesync });\n break;\n case \"field\":\n await fieldSubCommand(ctx, { args, filesync });\n break;\n case \"environment\":\n case \"env\":\n await envSubCommand(ctx, { args, filesync });\n break;\n default:\n println(usage(ctx));\n return;\n }\n};\n\nconst parseFieldValues = (fields: string[]): [{ name: string; fieldType: string }[], problems: string[]] => {\n const problems: string[] = [];\n const modelFields: { name: string; fieldType: string }[] = [];\n\n fields.forEach((field) => {\n const matches = /^(.*):+(.*)$/.exec(field);\n if (!matches || matches.length !== 3 || !matches[1] || !matches[2]) {\n problems.push(sprint`${field} is not a valid field definition`);\n } else {\n modelFields.push({ name: matches[1].replace(/:+/g, \"\"), fieldType: matches[2] });\n }\n });\n\n return [modelFields, problems];\n};\n\nconst modelSubCommand = async (ctx: Context, { args, filesync }: { args: AddArgsResult; filesync: FileSync }): Promise<void> => {\n const syncJson = filesync.syncJson;\n const modelApiIdentifier = args._[1];\n\n if (!modelApiIdentifier) {\n throw new ArgError(sprint`Failed to add model, missing model path\n\n {gray Usage}\n {cyanBright ggt add model <model_name> [field_name:field_type ...]}`);\n }\n\n const modelFieldsList: { name: string; fieldType: string }[] = [];\n if (args._.length > 2) {\n const [modelFields, problems] = parseFieldValues(args._.slice(2));\n\n if (problems.length > 0) {\n throw new ArgError(sprint`\n Failed to add model:\n \u2022 ${problems.join(\"\\n \u2022 \")}\n\n {gray Usage}\n {cyanBright ggt add model ${modelApiIdentifier} [field_name:field_type ...]}`);\n }\n\n modelFieldsList.push(...modelFields);\n }\n\n let result;\n\n try {\n result = (\n await syncJson.edit.mutate({\n mutation: CREATE_MODEL_MUTATION,\n variables: {\n path: modelApiIdentifier,\n fields: modelFieldsList.map((fields) => ({ name: fields.name, fieldType: fields.fieldType })),\n },\n })\n ).createModel;\n } catch (error) {\n if (error instanceof ClientError) {\n throw new AddClientError(error);\n } else {\n throw error;\n }\n }\n\n println({ ensureEmptyLineAbove: true, content: chalk.gray(\"New model created in environment.\") });\n\n await filesync.writeToLocalFilesystem(ctx, { filesVersion: result.remoteFilesVersion, files: result.changed, delete: [] });\n\n const modelPrintout = terminalLink.isSupported\n ? terminalLink(\n modelApiIdentifier,\n `https://${syncJson.environment.application.primaryDomain}/edit/${syncJson.environment.name}/model/${modelApiIdentifier}/schema`,\n )\n : modelApiIdentifier;\n\n println({\n ensureEmptyLineAbove: true,\n content: `${chalk.greenBright(symbol.tick)} Model ${chalk.cyanBright(modelPrintout)} added successfully.`,\n });\n};\n\nconst actionSubCommand = async (ctx: Context, { args, filesync }: { args: AddArgsResult; filesync: FileSync }): Promise<void> => {\n const syncJson = filesync.syncJson;\n const path = args._[1];\n\n if (!path) {\n throw new ArgError(sprint`Failed to add action, missing action path\n\n {gray Usage}\n {cyanBright ggt add action [CONTEXT]/<action_name>\n CONTEXT:Specifies the kind of action. Use \"model\" for model actions otherwise use \"action\".}`);\n }\n\n const models = await getModels(ctx, syncJson.environment);\n const globalActions = await getGlobalActions(ctx, syncJson.environment);\n const splitPath = path.split(\"/\");\n\n let overrideContextAction: \"models\" | \"actions\" | undefined;\n\n const parsedPaths = splitPath.length > 1 ? splitPath.slice(0, splitPath.length - 1) : splitPath;\n const parsedAction = splitPath[splitPath.length - 1];\n\n const conflictingModel = models.find((model) => {\n const modelName = parsedPaths[parsedPaths.length - 1];\n\n return (\n model.apiIdentifier.toUpperCase() === modelName?.toUpperCase() &&\n model.namespace?.join(\"/\") === parsedPaths.slice(0, parsedPaths.length - 1).join(\"/\")\n );\n });\n\n const conflictingActionNamespace = globalActions.find((action) => {\n return action.namespace?.join(\"/\") === parsedPaths.join(\"/\");\n });\n\n if (conflictingModel && conflictingActionNamespace) {\n const joinedParsedPaths = parsedPaths.join(\"/\");\n overrideContextAction = await select({\n choices: [\"models\", \"actions\"] as const,\n content: sprint`\n {bold Namespace Conflict:} The action '${parsedAction}.js' cannot be automatically added due to a namespace conflict.\n\n How would you like to proceed?:\n `,\n formatChoice: (choice) => {\n switch (choice) {\n case \"models\": {\n return `As a Model action in ${chalk.gray(`models/${joinedParsedPaths}/${parsedAction}.js`)}`;\n }\n case \"actions\": {\n return `As an Action in ${chalk.gray(`actions/${joinedParsedPaths}/${parsedAction}.js`)}`;\n }\n }\n },\n });\n\n println({\n ensureEmptyLineAbove: true,\n content: sprint`${chalk.yellowBright(symbol.info)} You can override the context of the action by specifying the context in the path. For example: {gray ggt add action ${overrideContextAction}/${path}}`,\n });\n }\n\n try {\n const result = (\n await syncJson.edit.mutate({\n mutation: CREATE_ACTION_MUTATION,\n variables: { path: overrideContextAction ? `${overrideContextAction}/` + path : path },\n })\n ).createAction;\n\n await filesync.writeToLocalFilesystem(ctx, { filesVersion: result.remoteFilesVersion, files: result.changed, delete: [] });\n } catch (error) {\n if (error instanceof ClientError) {\n throw new AddClientError(error);\n } else {\n throw error;\n }\n }\n\n println({ ensureEmptyLineAbove: true, content: `Action ${chalk.cyanBright(path)} added successfully.` });\n};\n\nconst routeSubCommand = async (ctx: Context, { args, filesync }: { args: AddArgsResult; filesync: FileSync }): Promise<void> => {\n const syncJson = filesync.syncJson;\n const routeMethod = args._[1];\n const routePath = args._[2];\n\n if (!routeMethod) {\n throw new ArgError(sprint`Failed to add route, missing route method\n\n {gray Usage}\n {cyanBright ggt add route <HTTP_METHOD> <route_path>}`);\n }\n\n if (!routePath) {\n throw new ArgError(sprint`Failed to add route, missing route path\n\n {gray Usage}\n {cyanBright ggt add route ${routeMethod} <route_path>}`);\n }\n\n try {\n const result = (await syncJson.edit.mutate({ mutation: CREATE_ROUTE_MUTATION, variables: { method: routeMethod, path: routePath } }))\n .createRoute;\n\n await filesync.writeToLocalFilesystem(ctx, { filesVersion: result.remoteFilesVersion, files: result.changed, delete: [] });\n } catch (error) {\n if (error instanceof ClientError) {\n throw new AddClientError(error);\n } else {\n throw error;\n }\n }\n\n println({ ensureEmptyLineAbove: true, content: `Route ${chalk.cyanBright(routePath)} added successfully.` });\n};\n\nconst fieldSubCommand = async (ctx: Context, { args, filesync }: { args: AddArgsResult; filesync: FileSync }): Promise<void> => {\n const syncJson = filesync.syncJson;\n\n const splitPathAndField = args._[1]?.split(\"/\");\n\n if (!splitPathAndField) {\n throw new ArgError(sprint`Failed to add field, invalid field path definition\n\n {gray Usage}\n {cyanBright ggt add field <model_path>/<field_name>:<field_type>}`);\n }\n\n const modelFieldsList: { name: string; fieldType: string }[] = [];\n\n if (splitPathAndField[1]) {\n const [modelFields, problems] = parseFieldValues([splitPathAndField[1]]);\n\n if (problems.length > 0) {\n throw new ArgError(sprint`\n Failed to add field:\n \u2022 ${problems.join(\"\\n \u2022\")}\n\n {gray Usage}\n {cyanBright ggt add field ${splitPathAndField[0]}/<field_name>:<field_type>}`);\n }\n\n modelFieldsList.push(...modelFields);\n } else {\n throw new ArgError(sprint`Failed to add field, invalid field definition\n\n {gray Usage}\n {cyanBright ggt add field ${splitPathAndField[0]}/<field_name>:<field_type>}`);\n }\n\n try {\n const result = (\n await syncJson.edit.mutate({\n mutation: CREATE_MODEL_FIELDS_MUTATION,\n variables: {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n path: splitPathAndField[0]!,\n fields: modelFieldsList.map((field) => ({ name: field.name, fieldType: field.fieldType })),\n },\n })\n ).createModelFields;\n\n await filesync.writeToLocalFilesystem(ctx, { filesVersion: result.remoteFilesVersion, files: result.changed, delete: [] });\n } catch (error) {\n if (error instanceof ClientError) {\n throw new AddClientError(error);\n } else {\n throw error;\n }\n }\n\n println({ ensureEmptyLineAbove: true, content: `Field ${chalk.cyanBright(modelFieldsList[0]?.name)} added successfully.` });\n};\n\nconst envSubCommand = async (ctx: Context, { args, filesync }: { args: AddArgsResult; filesync: FileSync }): Promise<void> => {\n const syncJson = filesync.syncJson;\n const newEnvName = args._[1] ?? makeDefaultEnvName();\n\n try {\n await syncJson.edit.mutate({\n mutation: CREATE_ENVIRONMENT_MUTATION,\n variables: { environment: { slug: newEnvName, sourceSlug: syncJson.environment.name } },\n });\n } catch (error) {\n if (error instanceof ClientError) {\n throw new AddClientError(error);\n } else {\n throw error;\n }\n }\n\n println({ ensureEmptyLineAbove: true, content: `Environment ${chalk.cyanBright(newEnvName)} added successfully.` });\n\n // Try to switch to newly made env\n const pullFromNewEnvSyncJson = await SyncJson.load(ctx, {\n command: \"pull\",\n args: { _: [], \"--app\": undefined, \"--allow-unknown-directory\": undefined, \"--allow-different-app\": undefined, \"--env\": newEnvName },\n directory: await loadSyncJsonDirectory(process.cwd()),\n });\n if (pullFromNewEnvSyncJson) {\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n if (hashes.environmentChangesToPull.size === 0) {\n println({ ensureEmptyLineAbove: true, content: \"Nothing to pull.\" });\n return;\n }\n if (hashes.localChangesToPush.size > 0) {\n // show them the local changes they will discard\n await filesync.print(ctx, { hashes });\n }\n await filesync.pull(ctx, { hashes, force: true });\n }\n};\n\n/**\n * Creates a default environment name based on the current date and time.\n */\nconst makeDefaultEnvName = (): string => {\n const currentDate = new Date();\n return `env-${currentDate.toISOString().slice(0, 10).replace(/-/g, \"\")}-${currentDate.toLocaleTimeString(\"en-US\", { hour12: false }).replace(/:/g, \"\")}`;\n};\n"],
|
|
5
|
+
"mappings": "6iBAAAA,IA2BO,IAAMC,EAAN,cAA6BC,CAAS,CA3B7C,MA2B6C,CAAAC,EAAA,uBAC3C,MAAQC,EAAM,GAEd,YAAYC,EAAoB,CAC9B,IAAIC,EAAW,GAEf,GAAIC,EAAgBF,EAAM,KAAK,EAAG,CAChC,IAAMG,EAASC,EAAKJ,EAAM,MAAM,IAAKK,GAAMA,EAAE,OAAO,CAAC,EAErDJ,EAAWK,WAAgBH,EAAO,IAAK,GAAM,EAAE,MAAM;AAAA,CAAI,EAAE,KAAK;AAAA,mBAAY,CAAC,EAAE,KAAK;AAAA,CAAI,CAAC,EAC3F,MACEF,EAA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AAUoD,EACV,UAAW,CAAE,YAAa,CAAE,KAAMF,EAAY,WAAYlD,EAAS,YAAY,IAAK,CAAE,CACxF,CAAC,CACH,OAAShB,EAAO,CACd,MAAIA,aAAiBwC,EACb,IAAI5C,EAAeI,CAAK,EAExBA,CAEV,CAUA,GARAsB,EAAQ,CAAE,qBAAsB,GAAM,QAAS,eAAef,EAAM,WAAW2D,CAAU,CAAC,sBAAuB,CAAC,EAGnF,MAAMjD,EAAS,KAAKJ,EAAK,CACtD,QAAS,OACT,KAAM,CAAE,EAAG,CAAC,EAAG,QAAS,OAAW,4BAA6B,OAAW,wBAAyB,OAAW,QAASqD,CAAW,EACnI,UAAW,MAAMnD,EAAsB,QAAQ,IAAI,CAAC,CACtD,CAAC,EAC2B,CAC1B,IAAMI,EAAW,IAAIC,EAASJ,CAAQ,EAChCK,EAAS,MAAMF,EAAS,OAAON,CAAG,EACxC,GAAIQ,EAAO,yBAAyB,OAAS,EAAG,CAC9CC,EAAQ,CAAE,qBAAsB,GAAM,QAAS,kBAAmB,CAAC,EACnE,MACF,CACID,EAAO,mBAAmB,KAAO,GAEnC,MAAMF,EAAS,MAAMN,EAAK,CAAE,OAAAQ,CAAO,CAAC,EAEtC,MAAMF,EAAS,KAAKN,EAAK,CAAE,OAAAQ,EAAQ,MAAO,EAAK,CAAC,CAClD,CACF,EAtCsB,iBA2ChB8C,EAAqBrE,EAAA,IAAc,CACvC,IAAMuE,EAAc,IAAI,KACxB,MAAO,OAAOA,EAAY,YAAY,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,KAAM,EAAE,CAAC,IAAIA,EAAY,mBAAmB,QAAS,CAAE,OAAQ,EAAM,CAAC,EAAE,QAAQ,KAAM,EAAE,CAAC,EACxJ,EAH2B",
|
|
6
|
+
"names": ["init_cjs", "AddClientError", "GGTError", "__name", "IsBug", "error", "template", "isGraphQLErrors", "errors", "uniq", "x", "sprint", "source_default", "symbol", "args", "SyncJsonArgs", "usage", "run", "ctx", "directory", "loadSyncJsonDirectory", "syncJson", "SyncJson", "UnknownDirectoryError", "filesync", "FileSync", "hashes", "println", "ts", "modelSubCommand", "actionSubCommand", "routeSubCommand", "fieldSubCommand", "envSubCommand", "parseFieldValues", "fields", "problems", "modelFields", "field", "matches", "modelApiIdentifier", "ArgError", "modelFieldsList", "result", "CREATE_MODEL_MUTATION", "ClientError", "modelPrintout", "terminalLink", "path", "models", "getModels", "globalActions", "getGlobalActions", "splitPath", "overrideContextAction", "parsedPaths", "parsedAction", "conflictingModel", "model", "modelName", "conflictingActionNamespace", "action", "joinedParsedPaths", "select", "choice", "CREATE_ACTION_MUTATION", "routeMethod", "routePath", "CREATE_ROUTE_MUTATION", "splitPathAndField", "CREATE_MODEL_FIELDS_MUTATION", "newEnvName", "makeDefaultEnvName", "CREATE_ENVIRONMENT_MUTATION", "currentDate"]
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Z}from"./chunk-
|
|
1
|
+
import{c as Z}from"./chunk-U5I2YBJK.js";import{a as uo,b as co}from"./chunk-HN3YKQ3C.js";import{a as Br,b as Nr,i as Gr}from"./chunk-KW4V2PJW.js";import{A as Tt,b as mt,d as jr,g as _t,h as kt,k as Bt,m as lo,n as Dr,p as be,q as tt,u as Mr,v as we,w as _e,x as Ir}from"./chunk-LPIHKY3M.js";import{a as Lr}from"./chunk-5VLIBRPJ.js";import{M as bt,T as wt,Y as ve,_ as Fr,b as W,ba as It,e as J,ea as $r,g as Cr,ga as S,h as Sr,ha as A,ia as X,l as xr,m as Er,t as Or,u as Pr,v as Rr,y as Ar,z as ao}from"./chunk-XOSBJSTW.js";import{a as oo}from"./chunk-GFQYFEEH.js";import{a as n,b as ye,d as it,f as ft,h as T}from"./chunk-7DYQUG5M.js";var Wr=it(N=>{"use strict";T();var mo=N&&N.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N,"__esModule",{value:!0});var ho=ye("fs"),go=mo(co()),ht=go.default("@kwsites/file-exists");function yo(t,e,r){ht("checking %s",t);try{let s=ho.statSync(t);return s.isFile()&&e?(ht("[OK] path represents a file"),!0):s.isDirectory()&&r?(ht("[OK] path represents a directory"),!0):(ht("[FAIL] path represents something other than a file or directory"),!1)}catch(s){if(s.code==="ENOENT")return ht("[FAIL] path is not accessible: %o",s),!1;throw ht("[FATAL] %o",s),s}}n(yo,"check");function vo(t,e=N.READABLE){return yo(t,(e&N.FILE)>0,(e&N.FOLDER)>0)}n(vo,"exists");N.exists=vo;N.FILE=1;N.FOLDER=2;N.READABLE=N.FILE+N.FOLDER});var Qr=it(Gt=>{"use strict";T();function bo(t){for(var e in t)Gt.hasOwnProperty(e)||(Gt[e]=t[e])}n(bo,"__export");Object.defineProperty(Gt,"__esModule",{value:!0});bo(Wr())});var xe=it((Nl,Hr)=>{T();function wo(t){r.debug=r,r.default=r,r.coerce=c,r.disable=o,r.enable=i,r.enabled=a,r.humanize=oo(),r.destroy=h,Object.keys(t).forEach(p=>{r[p]=t[p]}),r.names=[],r.skips=[],r.formatters={};function e(p){let m=0;for(let d=0;d<p.length;d++)m=(m<<5)-m+p.charCodeAt(d),m|=0;return r.colors[Math.abs(m)%r.colors.length]}n(e,"selectColor"),r.selectColor=e;function r(p){let m,d=null,g,B;function q(...D){if(!q.enabled)return;let K=q,lt=Number(new Date),me=lt-(m||lt);K.diff=me,K.prev=m,K.curr=lt,m=lt,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let pt=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(vt,he)=>{if(vt==="%%")return"%";pt++;let Mt=r.formatters[he];if(typeof Mt=="function"){let de=D[pt];vt=Mt.call(K,de),D.splice(pt,1),pt--}return vt}),r.formatArgs.call(K,D),(K.log||r.log).apply(K,D)}return n(q,"debug"),q.namespace=p,q.useColors=r.useColors(),q.color=r.selectColor(p),q.extend=s,q.destroy=r.destroy,Object.defineProperty(q,"enabled",{enumerable:!0,configurable:!1,get:n(()=>d!==null?d:(g!==r.namespaces&&(g=r.namespaces,B=r.enabled(p)),B),"get"),set:n(D=>{d=D},"set")}),typeof r.init=="function"&&r.init(q),q}n(r,"createDebug");function s(p,m){let d=r(this.namespace+(typeof m>"u"?":":m)+p);return d.log=this.log,d}n(s,"extend");function i(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let m,d=(typeof p=="string"?p:"").split(/[\s,]+/),g=d.length;for(m=0;m<g;m++)d[m]&&(p=d[m].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.slice(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}n(i,"enable");function o(){let p=[...r.names.map(u),...r.skips.map(u).map(m=>"-"+m)].join(",");return r.enable(""),p}n(o,"disable");function a(p){if(p[p.length-1]==="*")return!0;let m,d;for(m=0,d=r.skips.length;m<d;m++)if(r.skips[m].test(p))return!1;for(m=0,d=r.names.length;m<d;m++)if(r.names[m].test(p))return!0;return!1}n(a,"enabled");function u(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}n(u,"toNamespace");function c(p){return p instanceof Error?p.stack||p.message:p}n(c,"coerce");function h(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n(h,"destroy"),r.enable(r.load()),r}n(wo,"setup");Hr.exports=wo});var Yr=it((G,Ut)=>{T();G.formatArgs=ko;G.save=To;G.load=Co;G.useColors=_o;G.storage=So();G.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();G.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function _o(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}n(_o,"useColors");function ko(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ut.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(s=r))}),t.splice(s,0,e)}n(ko,"formatArgs");G.log=console.debug||console.log||(()=>{});function To(t){try{t?G.storage.setItem("debug",t):G.storage.removeItem("debug")}catch{}}n(To,"save");function Co(){let t;try{t=G.storage.getItem("debug")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}n(Co,"load");function So(){try{return localStorage}catch{}}n(So,"localstorage");Ut.exports=xe()(G);var{formatters:xo}=Ut.exports;xo.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Xr=it((R,Jt)=>{T();var Eo=ye("tty"),qt=ye("util");R.init=jo;R.log=Ao;R.formatArgs=Po;R.save=Fo;R.load=$o;R.useColors=Oo;R.destroy=qt.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R.colors=[6,2,3,4,5,1];try{let t=uo();t&&(t.stderr||t).level>=2&&(R.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}R.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),s=process.env[e];return/^(yes|on|true|enabled)$/i.test(s)?s=!0:/^(no|off|false|disabled)$/i.test(s)?s=!1:s==="null"?s=null:s=Number(s),t[r]=s,t},{});function Oo(){return"colors"in R.inspectOpts?!!R.inspectOpts.colors:Eo.isatty(process.stderr.fd)}n(Oo,"useColors");function Po(t){let{namespace:e,useColors:r}=this;if(r){let s=this.color,i="\x1B[3"+(s<8?s:"8;5;"+s),o=` ${i};1m${e} \x1B[0m`;t[0]=o+t[0].split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
`+o),t.push(i+"m+"+Jt.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Ro()+e+" "+t[0]}n(Po,"formatArgs");function Ro(){return R.inspectOpts.hideDate?"":new Date().toISOString()+" "}n(Ro,"getDate");function Ao(...t){return process.stderr.write(qt.formatWithOptions(R.inspectOpts,...t)+`
|
|
4
4
|
`)}n(Ao,"log");function Fo(t){t?process.env.DEBUG=t:delete process.env.DEBUG}n(Fo,"save");function $o(){return process.env.DEBUG}n($o,"load");function jo(t){t.inspectOpts={};let e=Object.keys(R.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=R.inspectOpts[e[r]]}n(jo,"init");Jt.exports=xe()(R);var{formatters:Kr}=Jt.exports;Kr.o=function(t){return this.inspectOpts.colors=this.useColors,qt.inspect(t,this.inspectOpts).split(`
|
|
@@ -118,4 +118,4 @@ import{c as Z}from"./chunk-OTYPO33S.js";import{a as uo,b as co}from"./chunk-YINV
|
|
|
118
118
|
• ${u.join(`
|
|
119
119
|
\u2022 `)}
|
|
120
120
|
`)},"loadEnvironment"),Wc=n(async(t,{directory:e})=>{try{return await ji(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},"loadBranch"),Qc=J.object({application:J.string(),environment:J.string(),environments:J.record(J.object({filesVersion:J.string()}))}),Hc=J.object({app:J.string(),filesVersion:J.string(),mtime:J.number()}),Yc=J.union([Qc,Hc]),Kc=Yc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{nl as a,ke as b,sl as c,il as d,ol as e,qr as f,Nt as g,Jr as h,zr as i,fo as j,yl as k,Se as l,mf as m,_r as n,hf as o};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
//# sourceMappingURL=chunk-3B2GY4UU.js.map
|