@stacksjs/actions 0.70.45 → 0.70.53
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/LICENSE.md +21 -0
- package/dist/action.d.ts +104 -17
- package/dist/blog.d.ts +12 -0
- package/dist/build/frontend-static.d.ts +16 -0
- package/dist/chunk-00qp27jy.js +93 -0
- package/dist/{chunk-jd1yzkq5.js → chunk-23thftnv.js} +1 -1
- package/dist/{chunk-jbvvb45k.js → chunk-4qzb8g3z.js} +1 -1
- package/dist/{chunk-s03z9zn3.js → chunk-5dfz9en9.js} +2 -2
- package/dist/{chunk-3beht8ja.js → chunk-5hwp0frq.js} +1 -1
- package/dist/{chunk-cqedfbaf.js → chunk-5pwpk005.js} +2 -2
- package/dist/chunk-604jy79b.js +5 -0
- package/dist/{chunk-yh15ydty.js → chunk-63swek9d.js} +2 -2
- package/dist/chunk-67am4dae.js +688 -0
- package/dist/{chunk-gt77jmb5.js → chunk-8gbewxns.js} +1 -1
- package/dist/chunk-8r76qydb.js +240 -0
- package/dist/{chunk-zbhjh5sz.js → chunk-9x17v4x2.js} +2 -2
- package/dist/chunk-aazd6qpv.js +3 -0
- package/dist/{chunk-n2fd1d0m.js → chunk-ag4fy7cx.js} +1 -1
- package/dist/{chunk-2qchdrf9.js → chunk-badehrwa.js} +1 -1
- package/dist/chunk-dbz9dp2h.js +3 -0
- package/dist/{chunk-v0wnrnaa.js → chunk-e8505qz8.js} +2 -2
- package/dist/chunk-jv7ry09n.js +3 -0
- package/dist/{chunk-w418anbq.js → chunk-jve1p4dz.js} +2 -2
- package/dist/chunk-mcwfmqzb.js +283 -0
- package/dist/chunk-n24m8prb.js +3 -0
- package/dist/{chunk-d5yxdz7e.js → chunk-nm9h5rye.js} +2 -2
- package/dist/{chunk-h0hfqr1p.js → chunk-ny1racy0.js} +2 -2
- package/dist/{chunk-2gh7kgpc.js → chunk-p601xr03.js} +1 -1
- package/dist/{chunk-yvva7qsg.js → chunk-pqnzp7x8.js} +2 -2
- package/dist/chunk-rj1cbghx.js +17 -0
- package/dist/chunk-rzhs51h1.js +3 -0
- package/dist/{chunk-tzx3h4r8.js → chunk-sp5cjdhd.js} +213 -76
- package/dist/chunk-tqax3gbq.js +16 -0
- package/dist/{chunk-c8qt2xst.js → chunk-vsj8ns4p.js} +1 -1
- package/dist/{chunk-zaw01rqz.js → chunk-x8nrbsk1.js} +2 -2
- package/dist/dev/dashboard-utils.d.ts +19 -1
- package/dist/dev/migrate-watcher.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/make.d.ts +19 -0
- package/dist/queue/dlq-purge.d.ts +1 -0
- package/dist/queue/dlq-retry.d.ts +1 -0
- package/dist/queue/dlq.d.ts +1 -0
- package/dist/queue/list.d.ts +1 -0
- package/dist/queue/pause.d.ts +1 -0
- package/dist/queue/quarantine.d.ts +1 -0
- package/dist/queue/resume.d.ts +1 -0
- package/dist/queue/unquarantine.d.ts +1 -0
- package/dist/src/action.js +1 -1
- package/dist/src/actions.js +1 -1
- package/dist/src/add.js +1 -1
- package/dist/src/ai/request-model-access.js +1 -1
- package/dist/src/auth/setup.js +82 -24
- package/dist/src/blog.js +102 -0
- package/dist/src/build/core.js +1 -1
- package/dist/src/build/frontend-static.js +9 -0
- package/dist/src/build/views.js +1 -1
- package/dist/src/build.js +1 -1
- package/dist/src/commit.js +1 -1
- package/dist/src/database/seed.js +1 -1
- package/dist/src/deploy/index.js +38 -45
- package/dist/src/dev/api.js +4 -4
- package/dist/src/dev/dashboard-globals.js +1 -1
- package/dist/src/dev/dashboard-utils.js +1 -1
- package/dist/src/dev/dashboard.js +6 -6
- package/dist/src/dev/docs.js +1 -1
- package/dist/src/dev/index.js +1 -1
- package/dist/src/dev/migrate-watcher.js +2 -0
- package/dist/src/dev/views.js +1 -1
- package/dist/src/discover-packages.js +1 -1
- package/dist/src/examples.js +1 -1
- package/dist/src/generate/component-meta.js +1 -1
- package/dist/src/generate/env-files.js +1 -1
- package/dist/src/generate/ide-helpers.js +1 -1
- package/dist/src/generate/index.js +1 -1
- package/dist/src/generate/lib-entries.js +1 -1
- package/dist/src/generate/vscode-custom-data.js +1 -1
- package/dist/src/helpers/component-meta.js +1 -1
- package/dist/src/helpers/index.js +1 -1
- package/dist/src/helpers/lib-entries.js +1 -1
- package/dist/src/helpers/package-json.js +1 -1
- package/dist/src/helpers/utils.js +1 -1
- package/dist/src/helpers/vscode-custom-data.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/key-generate.js +1 -1
- package/dist/src/make-command.js +1 -1
- package/dist/src/make-job.js +1 -1
- package/dist/src/make-policy.js +1 -1
- package/dist/src/make-resource.js +1 -1
- package/dist/src/make.js +1 -1
- package/dist/src/migrate/fresh.js +1 -1
- package/dist/src/orm/base.js +1 -1
- package/dist/src/queue/dlq-purge.js +2 -0
- package/dist/src/queue/dlq-retry.js +2 -0
- package/dist/src/queue/dlq.js +5 -0
- package/dist/src/queue/failed.js +4 -4
- package/dist/src/queue/list.js +5 -0
- package/dist/src/queue/pause.js +2 -0
- package/dist/src/queue/quarantine.js +3 -0
- package/dist/src/queue/resume.js +2 -0
- package/dist/src/queue/unquarantine.js +2 -0
- package/dist/src/release.js +1 -1
- package/dist/src/run-action.js +1 -1
- package/dist/src/scaffold-crud.js +1 -1
- package/dist/src/serve/api.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/ssl.js +1 -1
- package/dist/src/stacks.js +1 -1
- package/dist/src/templates.js +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/upgrade/dependencies.js +1 -1
- package/dist/src/upgrade/framework-utils.js +1 -1
- package/dist/src/upgrade/framework.js +5 -5
- package/dist/src/upgrade/index.js +1 -1
- package/dist/src/upgrade.js +1 -1
- package/dist/upgrade/framework-utils.d.ts +48 -0
- package/package.json +18 -18
- package/dist/chunk-2kaj93p5.js +0 -3
- package/dist/chunk-3086k7zk.js +0 -184
- package/dist/chunk-4fz2qb8b.js +0 -17
- package/dist/chunk-4p0rjazd.js +0 -101
- package/dist/chunk-77pta9ww.js +0 -93
- package/dist/chunk-d4srk6ma.js +0 -3
- package/dist/chunk-h5rff0v9.js +0 -658
- package/dist/chunk-kr2k0h74.js +0 -16
- package/dist/chunk-kzhgexj4.js +0 -3
- package/dist/chunk-sxp97zys.js +0 -3
- package/dist/chunk-vek18p55.js +0 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/actions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.53",
|
|
5
5
|
"description": "The Stacks actions.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -54,27 +54,27 @@
|
|
|
54
54
|
"prepublishOnly": "bun run build"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@stacksjs/bunpress": "^0.1.
|
|
58
|
-
"@stacksjs/ts-cloud": "^0.
|
|
57
|
+
"@stacksjs/bunpress": "^0.1.11",
|
|
58
|
+
"@stacksjs/ts-cloud": "^0.7.12",
|
|
59
59
|
"@stacksjs/ts-md": "^0.1.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@stacksjs/api": "
|
|
63
|
-
"@stacksjs/cli": "
|
|
64
|
-
"@stacksjs/config": "
|
|
65
|
-
"@stacksjs/database": "
|
|
62
|
+
"@stacksjs/api": "0.70.53",
|
|
63
|
+
"@stacksjs/cli": "0.70.53",
|
|
64
|
+
"@stacksjs/config": "0.70.53",
|
|
65
|
+
"@stacksjs/database": "0.70.53",
|
|
66
66
|
"@stacksjs/tlsx": "^0.13.2",
|
|
67
67
|
"better-dx": "^0.2.12",
|
|
68
|
-
"@stacksjs/dns": "
|
|
69
|
-
"@stacksjs/enums": "
|
|
70
|
-
"@stacksjs/env": "
|
|
71
|
-
"@stacksjs/error-handling": "
|
|
72
|
-
"@stacksjs/logging": "
|
|
73
|
-
"@stacksjs/path": "
|
|
74
|
-
"@stacksjs/security": "
|
|
75
|
-
"@stacksjs/storage": "
|
|
76
|
-
"@stacksjs/strings": "
|
|
77
|
-
"@stacksjs/utils": "
|
|
78
|
-
"@stacksjs/validation": "
|
|
68
|
+
"@stacksjs/dns": "0.70.53",
|
|
69
|
+
"@stacksjs/enums": "0.70.53",
|
|
70
|
+
"@stacksjs/env": "0.70.53",
|
|
71
|
+
"@stacksjs/error-handling": "0.70.53",
|
|
72
|
+
"@stacksjs/logging": "0.70.53",
|
|
73
|
+
"@stacksjs/path": "0.70.53",
|
|
74
|
+
"@stacksjs/security": "0.70.53",
|
|
75
|
+
"@stacksjs/storage": "0.70.53",
|
|
76
|
+
"@stacksjs/strings": "0.70.53",
|
|
77
|
+
"@stacksjs/utils": "0.70.53",
|
|
78
|
+
"@stacksjs/validation": "0.70.53"
|
|
79
79
|
}
|
|
80
80
|
}
|
package/dist/chunk-2kaj93p5.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{existsSync as T,readdirSync as $,readFileSync as X,statSync as z,writeFileSync as J}from"fs";import{homedir as Q}from"os";import{join as Y,resolve as I}from"path";import A from"process";function m(q,B){let D=q.version;if(D)return{channel:"stable",ref:D.startsWith("v")?D:`v${D}`,targetVersion:D};if(q.canary)return{channel:"canary",ref:"canary"};if(q.stable)return{channel:"stable",ref:"main"};if(B==="canary")return{channel:"canary",ref:"canary"};return{channel:"stable",ref:"main"}}function F(q,B="storage/framework/core"){return`github:stacksjs/stacks#${q}/${B}`}function S(q){try{if(T(q))return JSON.parse(X(q,"utf-8")).version||null}catch{}return null}function v(q){try{if(T(q)){if(X(q,"utf-8").trim()==="canary")return"canary"}}catch{}return"stable"}function P(q,B){try{J(q,B,"utf-8")}catch{}}function g(q,B,D){if(q.targetVersion)return`Installing Stacks v${q.targetVersion.replace(/^v/,"")}...`;if(q.channel==="canary")return"Upgrading to the latest canary build...";if(D&&B==="canary")return"Switching back to the latest stable release...";return"Upgrading to the latest version..."}function w(q,B,D,G,H){if(q.targetVersion){let E=q.targetVersion.replace(/^v/,"");if(B===E&&!H)return`Stacks is already at v${E}`;if(B)return`Installed Stacks v${E} (was v${B})`;return`Installed Stacks v${E}`}if(B&&D&&B===D&&!H){if(q.channel==="canary")return`Stacks is already up to date (canary ${B})`;return`Stacks is already up to date (v${B})`}if(B&&D){let E=G==="canary"?`canary ${B}`:`v${B}`,K=q.channel==="canary"?`canary ${D}`:`v${D}`;return`Upgraded Stacks from ${E} to ${K}`}if(D)return`Upgraded Stacks to ${q.channel==="canary"?`canary ${D}`:`v${D}`}`;return`Upgraded Stacks to ${q.ref} (latest)`}var b=[{localPath:"storage/framework/core",subPath:"storage/framework/core",label:"core",skip:["node_modules","dist","bun.lock",".DS_Store"]},{localPath:"storage/framework/defaults",subPath:"storage/framework/defaults",label:"defaults",skip:["node_modules","dist",".DS_Store",".discovered-models.json"]},{localPath:"buddy",subPath:"buddy",label:"buddy",isFile:!0},{localPath:"bootstrap",subPath:"bootstrap",label:"bootstrap",isFile:!0}];function x(q){let B=[A.env.STACKS_LOCAL_PATH,I(q,"..","stacks"),I(q,"..","..","stacks"),I(Q(),"Code","stacks"),I(Q(),"code","stacks"),I(Q(),"projects","stacks"),I(Q(),"src","stacks")];for(let D of B){if(!D)continue;let G=Y(D,"storage","framework","core","buddy","package.json");try{if(T(G)&&I(D)!==I(q))return I(D)}catch{}}return null}async function f(q,B=[]){let D=new Map;if(!T(q))return D;let G=new Set(B),H=[{abs:q,rel:""}],E=[];while(H.length>0){let{abs:K,rel:M}=H.pop(),L;try{L=$(K)}catch{continue}for(let N of L){if(G.has(N))continue;let U=Y(K,N),W=M?`${M}/${N}`:N,O;try{O=z(U)}catch{continue}if(O.isDirectory())H.push({abs:U,rel:W});else if(O.isFile()){let Z=O.size;E.push((async()=>{let _=await C(U);D.set(W,{size:Z,hash:_})})())}}}return await Promise.all(E),D}function p(q,B){let D=0,G=0,H=0;for(let[K,M]of B){let L=q.get(K);if(!L)D++;else if(L.size!==M.size||L.hash!==M.hash)G++;else H++}let E=0;for(let K of q.keys())if(!B.has(K))E++;return{added:D,changed:G,removed:E,unchanged:H}}async function C(q){try{let B=await Bun.file(q).arrayBuffer();return Bun.hash(B)}catch{return 0n}}
|
|
3
|
-
export{m as a,F as b,S as c,v as d,P as e,g as f,w as g,b as h,x as i,f as j,p as k};
|
package/dist/chunk-3086k7zk.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var b={action:`import { Action } from '@stacksjs/actions'
|
|
3
|
-
|
|
4
|
-
export default new Action({
|
|
5
|
-
name: '{0}',
|
|
6
|
-
description: '{0} action',
|
|
7
|
-
|
|
8
|
-
handle() {
|
|
9
|
-
return 'Hello World action'
|
|
10
|
-
},
|
|
11
|
-
})`,actionWithValidation:`import { Action } from '@stacksjs/actions'
|
|
12
|
-
import { schema, validate } from '@stacksjs/validation'
|
|
13
|
-
|
|
14
|
-
export default new Action({
|
|
15
|
-
name: '{0}',
|
|
16
|
-
description: '{0} action',
|
|
17
|
-
|
|
18
|
-
async handle(request) {
|
|
19
|
-
// Replace these rules with whatever this action expects. The
|
|
20
|
-
// returned object is typed to the rule shape; type-narrow further
|
|
21
|
-
// by passing a generic to validate<Payload>().
|
|
22
|
-
const data = await validate(request, {
|
|
23
|
-
// example: title: schema.string().required().min(1),
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
return { ok: true, data }
|
|
27
|
-
},
|
|
28
|
-
})`,actionWithAuth:`import { Action } from '@stacksjs/actions'
|
|
29
|
-
|
|
30
|
-
export default new Action({
|
|
31
|
-
name: '{0}',
|
|
32
|
-
description: '{0} action (authenticated)',
|
|
33
|
-
|
|
34
|
-
async handle(request) {
|
|
35
|
-
const user = await request.user()
|
|
36
|
-
if (!user) {
|
|
37
|
-
return new Response('Unauthorized', { status: 401 })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return { ok: true, userId: user.id }
|
|
41
|
-
},
|
|
42
|
-
})`,actionWithBoth:`import { Action } from '@stacksjs/actions'
|
|
43
|
-
import { schema, validate } from '@stacksjs/validation'
|
|
44
|
-
|
|
45
|
-
export default new Action({
|
|
46
|
-
name: '{0}',
|
|
47
|
-
description: '{0} action (authenticated + validated)',
|
|
48
|
-
|
|
49
|
-
async handle(request) {
|
|
50
|
-
const user = await request.user()
|
|
51
|
-
if (!user) {
|
|
52
|
-
return new Response('Unauthorized', { status: 401 })
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const data = await validate(request, {
|
|
56
|
-
// example: title: schema.string().required().min(1),
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
return { ok: true, userId: user.id, data }
|
|
60
|
-
},
|
|
61
|
-
})`,component:`<script setup lang="ts">
|
|
62
|
-
console.log('Hello World component created')
|
|
63
|
-
</script>
|
|
64
|
-
|
|
65
|
-
<template>
|
|
66
|
-
<div>
|
|
67
|
-
Some HTML block
|
|
68
|
-
</div>
|
|
69
|
-
</template>`,page:`<script setup lang="ts">
|
|
70
|
-
console.log('Hello World page created')
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<template>
|
|
74
|
-
<div>
|
|
75
|
-
Visit http://127.0.0.1/{0}
|
|
76
|
-
</div>
|
|
77
|
-
</template>`,function:`// reactive state
|
|
78
|
-
const {0} = ref(0)
|
|
79
|
-
|
|
80
|
-
// functions that mutate state and trigger updates
|
|
81
|
-
function increment() {
|
|
82
|
-
{0}.value++
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export {
|
|
86
|
-
{0},
|
|
87
|
-
increment,
|
|
88
|
-
}`,language:`button:
|
|
89
|
-
text: Copy`,notification:`import type { {0} } from '@stacksjs/types'
|
|
90
|
-
|
|
91
|
-
function content(): string {
|
|
92
|
-
return 'example'
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function send(): {0} {
|
|
96
|
-
return {
|
|
97
|
-
content: content(),
|
|
98
|
-
}
|
|
99
|
-
}`,middleware:`import type { Request } from '@stacksjs/router'
|
|
100
|
-
import { Middleware } from '@stacksjs/router'
|
|
101
|
-
|
|
102
|
-
export default new Middleware({
|
|
103
|
-
name: '{0}',
|
|
104
|
-
priority: 1,
|
|
105
|
-
async handle(request: Request) {
|
|
106
|
-
// Your middleware logic here
|
|
107
|
-
},
|
|
108
|
-
})`,model:`import { defineModel } from '@stacksjs/orm'
|
|
109
|
-
import { schema } from '@stacksjs/validation'
|
|
110
|
-
|
|
111
|
-
export default defineModel({
|
|
112
|
-
name: '{0}',
|
|
113
|
-
table: '{1}',
|
|
114
|
-
primaryKey: 'id',
|
|
115
|
-
autoIncrement: true,
|
|
116
|
-
|
|
117
|
-
traits: {
|
|
118
|
-
useTimestamps: true,
|
|
119
|
-
|
|
120
|
-
useSeeder: {
|
|
121
|
-
count: 10,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
attributes: {
|
|
126
|
-
// your attributes here
|
|
127
|
-
},
|
|
128
|
-
} as const)`,migration:`import type { Database } from '@stacksjs/database'
|
|
129
|
-
|
|
130
|
-
export async function up(db: Database): Promise<void> {
|
|
131
|
-
await db.schema
|
|
132
|
-
.createTable('{0}')
|
|
133
|
-
.addColumn('id', 'integer', col => col.autoIncrement().primaryKey())
|
|
134
|
-
.execute()
|
|
135
|
-
}`,stackPackageJson:`{
|
|
136
|
-
"name": "{0}",
|
|
137
|
-
"version": "0.0.1",
|
|
138
|
-
"type": "module",
|
|
139
|
-
"stacks": {
|
|
140
|
-
"name": "{1}",
|
|
141
|
-
"description": "A Stacks extension"
|
|
142
|
-
}
|
|
143
|
-
}`,job:`import { Job } from '@stacksjs/jobs'
|
|
144
|
-
|
|
145
|
-
export default new Job({
|
|
146
|
-
name: '{0}',
|
|
147
|
-
description: '{0} job',
|
|
148
|
-
|
|
149
|
-
async handle() {
|
|
150
|
-
// Your job logic here
|
|
151
|
-
console.log('Job executed')
|
|
152
|
-
},
|
|
153
|
-
})`,event:`import { Event } from '@stacksjs/events'
|
|
154
|
-
|
|
155
|
-
export default new Event({
|
|
156
|
-
name: '{0}',
|
|
157
|
-
description: '{0} event',
|
|
158
|
-
|
|
159
|
-
async handle(data: any) {
|
|
160
|
-
// Your event handler logic here
|
|
161
|
-
console.log('Event handled:', data)
|
|
162
|
-
},
|
|
163
|
-
})`,listener:`import { Listener } from '@stacksjs/events'
|
|
164
|
-
|
|
165
|
-
export default new Listener({
|
|
166
|
-
name: '{0}',
|
|
167
|
-
description: '{0} listener',
|
|
168
|
-
|
|
169
|
-
async handle(data: any) {
|
|
170
|
-
// Your listener logic here
|
|
171
|
-
console.log('Listener triggered:', data)
|
|
172
|
-
},
|
|
173
|
-
})`,command:`import { Command } from '@stacksjs/cli'
|
|
174
|
-
|
|
175
|
-
export default new Command({
|
|
176
|
-
name: '{0}',
|
|
177
|
-
description: '{0} command',
|
|
178
|
-
|
|
179
|
-
async handle() {
|
|
180
|
-
// Your command logic here
|
|
181
|
-
console.log('Command executed')
|
|
182
|
-
},
|
|
183
|
-
})`};
|
|
184
|
-
export{b as aa};
|
package/dist/chunk-4fz2qb8b.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{aa as R}from"./chunk-3086k7zk.js";import{Ya as L}from"./chunk-sxp97zys.js";import{ib as b}from"./chunk-jbvvb45k.js";import J from"process";import{italic as X,runCommand as V}from"@stacksjs/cli";import{ExitCode as Y}from"@stacksjs/types";import{localUrl as j}from"@stacksjs/config";import{Action as P}from"@stacksjs/enums";import{handleError as W}from"@stacksjs/error-handling";import{log as B}from"@stacksjs/logging";import{frameworkPath as D,path as Z,resolve as U}from"@stacksjs/path";import{createFolder as _,doesFolderExist as K,writeTextFile as w}from"@stacksjs/storage";import{template as f}from"@stacksjs/strings";var M=!1;function Iq(z){M=Boolean(z)}function Jq(){return M}function x(z,...q){return f(R[z],...q)}async function A(z,q){if(M){let G=q.split(`
|
|
3
|
-
`),H=G.slice(0,60).map((I)=>` ${I}`).join(`
|
|
4
|
-
`),Q=G.length>60?`
|
|
5
|
-
${X(`\u2026 ${G.length-60} more lines elided`)}`:"";B.info(`[dry-run] would write ${z} (${G.length} lines)`),J.stdout.write(`${H}${Q}
|
|
6
|
-
|
|
7
|
-
`);return}await w({path:z,data:q})}async function $(z,q,...G){await A(z,x(q,...G))}async function T(z){if(z.component)await u(z);if(z.database)y(z);if(z.function)await h(z);if(z.language)await g(z);if(z.middleware)await r(z);if(z.notification)await F(z);if(z.page)await N(z);if(z.stack)await m(z)}async function Qq(z){return await T(z)}async function Xq(z){try{let q=z.name;B.info("Creating your action..."),await C(z),B.success(`Created ${X(q)} action`)}catch(q){B.error("There was an error creating your action",q),J.exit(Y.FatalError)}}async function u(z){try{let q=z.name;B.info("Creating your component..."),await E(z),B.success(`Created ${X(q)} component`)}catch(q){B.error("There was an error creating your component",q),J.exit(Y.FatalError)}}async function C(z){let q=z.name,G=z,H=Boolean(G.withValidation||z["with-validation"]),Q=Boolean(G.withAuth||z["with-auth"]),I=H&&Q?"actionWithBoth":H?"actionWithValidation":Q?"actionWithAuth":"action";await $(Z.userActionsPath(q),I,q)}async function E(z){let q=z.name;await $(Z.userComponentsPath(`${q}.vue`),"component",q)}function y(z){try{let q=z.name;B.info(`Creating your ${X(q)} database...`),O(z),B.success(`Created ${X(q)} database`)}catch(q){B.error("There was an error creating your database",q),J.exit(Y.FatalError)}}function O(z){B.debug("createDatabase options",z)}function Yq(z){try{let q=z.name;B.info(`Creating your ${X(q)} factory...`),O(z),B.success(`Created ${X(q)} factory`)}catch(q){B.error("There was an error creating your factory",q),J.exit(Y.FatalError)}}async function Zq(z){let q=z.name||"MyFactory",G=q.endsWith("Factory")?q:`${q}Factory`;try{let{path:H}=await import("@stacksjs/path"),I=`${H.userDatabasePath("factories")}/${G}.ts`;if(await Bun.file(I).exists()){B.warn(`Factory ${G} already exists at ${I}`);return}let S=q.replace(/Factory$/,""),v=`import type { ${S}Model } from '@stacksjs/orm'
|
|
8
|
-
|
|
9
|
-
export function ${G}(): Partial<${S}Model> {
|
|
10
|
-
return {
|
|
11
|
-
// Define your factory attributes here
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default ${G}
|
|
16
|
-
`;await A(I,v),B.success(`Created factory: ${I}`)}catch(H){throw B.error(`Failed to create factory ${G}`,H),H}}async function F(z){try{let q=z.name;B.info(`Creating your ${X(q)} notification...`),await l(z),B.success(`Created ${X(q)} notification`)}catch(q){B.error("There was an error creating your notification",q),J.exit(Y.FatalError)}}async function N(z){try{let q=z.name;B.info("Creating your page..."),await k(z),B.success(`Created ${q} page`)}catch(q){B.error("There was an error creating your page",q),J.exit(Y.FatalError)}}async function k(z){let q=z.name;await $(Z.userViewsPath(`${q}.vue`),"page",q)}async function h(z){try{let q=z.name;B.info("Creating your function..."),await d(z),B.success(`Created ${q} function`)}catch(q){B.error("There was an error creating your function",q),J.exit(Y.FatalError)}}async function d(z){let q=z.name;await $(Z.userFunctionsPath(`${q}.ts`),"function",q)}async function g(z){try{let q=z.name;B.info("Creating your translation file..."),await c(z),B.success(`Created ${q} translation file`)}catch(q){B.error("There was an error creating your language.",q),J.exit(Y.FatalError)}}async function c(z){let q=z.name;await $(Z.resourcesPath(`lang/${q}.yml`),"language",q)}async function m(z){try{let q=z.name;B.info(`Creating your ${q} stack...`);let G=U(J.cwd(),q);if(K(G))B.error(`Directory "${q}" already exists`),J.exit(Y.FatalError);await _(G);let H=["app/Actions","app/Models","config","database/migrations","resources/views","resources/components","resources/functions","routes","public"];for(let I of H)await _(U(G,I));let Q=q.replace(/^@[^/]+\//,"").replace(/-stack$/,"");await $(U(G,"package.json"),"stackPackageJson",q,Q),B.success(`Successfully scaffolded your "${q}" stack`),B.info(""),B.info(` cd ${q}`),B.info(" # Add your models, actions, views, etc."),B.info(" # Then publish: bun publish"),B.info(""),B.info(" Users install it with:"),B.info(` buddy stack:install ${q}`)}catch(q){B.error("There was an error creating your stack",q),J.exit(Y.FatalError)}}async function l(z){let q=z.name;try{let G="EmailOptions";if(!K("notifications"))await _("./notifications");if(z.chat)G="ChatOptions";if(z.sms)G="SMSOptions";return await $(Z.userNotificationsPath(`${q}.ts`),"notification",G),!0}catch(G){return W("Error creating notification",G),!1}}async function $q(z){let q=z.name,G="dummy-name";if(!q[0])throw Error("options.name is required and cannot be empty");let H=q[0].toUpperCase()+q.slice(1),Q=D(`database/migrations/${H}.ts`);try{await $(Q,"migration","dummy-name"),B.success(`Successfully created your migration file at stacks/database/migrations/${H}.ts`)}catch(I){B.error(I)}}async function Uq(){await L(P.QueueTable)}async function _q(){let z=await j();B.info("Creating SSL certificate..."),await V(`tlsx ${z}`,{cwd:Z.storagePath("keys")}),B.success("Certificate created"),B.info("Installing SSL certificate..."),await V("tlsx -install",{cwd:Z.storagePath("keys")}),B.success("Certificate installed")}async function Mq(z){let q=z.name;if(!q[0])throw Error("options.name is required and cannot be empty");let G=q[0].toUpperCase()+q.slice(1),H=G.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"").replace(/([^s])$/,"$1s"),Q=Z.userModelsPath(`${G}.ts`);try{await $(Q,"model",G,H),B.success(`Model created: ${X(`app/Models/${G}.ts`)}`)}catch(I){B.error(I)}}async function r(z){let q=z.name;await $(Z.userMiddlewarePath(`${q}.ts`),"middleware",q)}
|
|
17
|
-
export{Iq as C,Jq as D,T as E,Qq as F,Xq as G,u as H,C as I,E as J,y as K,O as L,Yq as M,Zq as N,F as O,N as P,k as Q,h as R,d as S,g as T,c as U,m as V,l as W,$q as X,Uq as Y,_q as Z,Mq as _,r as $};
|