Skip to content

Commit d226579

Browse files
committed
chore: wip
chore: wip
1 parent 26e805c commit d226579

File tree

44 files changed

+610
-607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+610
-607
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ buddy cloud:remove # removes cloud setup
265265
buddy cloud:cleanup # removes cloud setup & cleans up all potentially leftover resources
266266
buddy cloud:add --jump-box # adds a jump box to your cloud setup
267267

268-
269268
# select the example to run (follow CLI prompts)
270269
buddy example # prompts you to select which example to run
271270
buddy example:vue # runs the Vue example

app/actions/SendWelcomeEmail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default new Action({
1616
},
1717
})
1818

19-
function sendEmail({ to, subject, text }: { to: string; subject: string; text: string }) {
19+
function sendEmail({ to, subject, text }: { to: string, subject: string, text: string }) {
2020
log.info('Sending email', { to, subject, text })
2121
return Promise.resolve()
2222
}

resources/views/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<script setup lang="ts">
2+
defineOptions({
3+
name: 'IndexPage',
4+
})
5+
26
// import { app } from '@stacksjs/config'
37
48
// https://github.com/vueuse/head
@@ -23,10 +27,6 @@ useHead({
2327
],
2428
})
2529
26-
defineOptions({
27-
name: 'IndexPage',
28-
})
29-
3030
const user = useUserStore()
3131
const name = ref(user.savedName)
3232

storage/framework/.stacks/core/actions/src/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export class Action {
33
description: string
44
handle: () => Promise<string>
55

6-
constructor({ name, description, handle }: { name: string; description: string; handle: () => Promise<string> }) {
6+
constructor({ name, description, handle }: { name: string, description: string, handle: () => Promise<string> }) {
77
this.name = name
88
this.description = description
99
this.handle = handle
Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as AWS4 from 'aws4'
2+
23
// todo: Remove axios and use the AWS SDK instead if possible, but I couldn't get it to work. At least, move to our own fetch wrapper
34
import axios from 'axios'
45
import { config } from 'aws-sdk'
@@ -10,61 +11,61 @@ import { ai } from '@stacksjs/config'
1011
process.env.AWS_REGION = 'us-east-1'
1112

1213
config.getCredentials((err) => {
13-
if (err) console.log(err.stack)
14+
if (err) { console.log(err.stack) }
1415
else if (config.credentials) {
15-
const { accessKeyId, secretAccessKey, sessionToken } = config.credentials
16-
console.log('AWS credentials are set', accessKeyId, secretAccessKey, sessionToken)
16+
const { accessKeyId, secretAccessKey, sessionToken } = config.credentials
17+
console.log('AWS credentials are set', accessKeyId, secretAccessKey, sessionToken)
1718

18-
const endpoint = 'https://bedrock.us-east-1.amazonaws.com/foundation-model-entitlement'
19-
const region = 'us-east-1'
20-
const service = 'bedrock'
19+
const endpoint = 'https://bedrock.us-east-1.amazonaws.com/foundation-model-entitlement'
20+
const region = 'us-east-1'
21+
const service = 'bedrock'
2122

22-
const models = ai.models
23+
const models = ai.models
2324

24-
if (!models) {
25-
log.error('No AI models found. Please set ./config/ai.ts values.')
26-
return
27-
}
25+
if (!models) {
26+
log.error('No AI models found. Please set ./config/ai.ts values.')
27+
return
28+
}
2829

29-
for (const model of models) {
30-
console.log(`Requesting access to model ${model}`)
31-
const request = {
32-
host: 'bedrock.us-east-1.amazonaws.com',
33-
method: 'POST',
34-
url: endpoint,
35-
path: '/foundation-model-entitlement',
36-
headers: {
37-
'Content-Type': 'application/json',
38-
'authority': 'http://bedrock.us-east-1.amazonaws.com',
39-
},
40-
body: JSON.stringify({ modelId: model }), // use the current model in the loop
41-
service,
42-
region,
43-
}
30+
for (const model of models) {
31+
console.log(`Requesting access to model ${model}`)
32+
const request = {
33+
host: 'bedrock.us-east-1.amazonaws.com',
34+
method: 'POST',
35+
url: endpoint,
36+
path: '/foundation-model-entitlement',
37+
headers: {
38+
'Content-Type': 'application/json',
39+
'authority': 'http://bedrock.us-east-1.amazonaws.com',
40+
},
41+
body: JSON.stringify({ modelId: model }), // use the current model in the loop
42+
service,
43+
region,
44+
}
4445

45-
// Sign the request
46-
const signedRequest = AWS4.sign(request, { accessKeyId, secretAccessKey, sessionToken })
46+
// Sign the request
47+
const signedRequest = AWS4.sign(request, { accessKeyId, secretAccessKey, sessionToken })
4748

48-
// Convert headers to the correct type
49-
const axiosHeaders = Object.fromEntries(
50-
Object.entries(signedRequest.headers || {}).map(([key, value]) => [key, String(value)])
51-
)
49+
// Convert headers to the correct type
50+
const axiosHeaders = Object.fromEntries(
51+
Object.entries(signedRequest.headers || {}).map(([key, value]) => [key, String(value)]),
52+
)
5253

53-
const url = `https://${signedRequest.host}${signedRequest.path}`
54+
const url = `https://${signedRequest.host}${signedRequest.path}`
5455

55-
// Send the request
56-
axios({
57-
method: signedRequest.method,
58-
url,
59-
headers: axiosHeaders,
60-
data: signedRequest.body,
56+
// Send the request
57+
axios({
58+
method: signedRequest.method,
59+
url,
60+
headers: axiosHeaders,
61+
data: signedRequest.body,
62+
})
63+
.then((response) => {
64+
console.log(response.data)
6165
})
62-
.then((response) => {
63-
console.log(response.data)
64-
})
65-
.catch((error) => {
66-
console.error(error.data)
67-
})
68-
}
66+
.catch((error) => {
67+
console.error(error.data)
68+
})
69+
}
6970
}
7071
})

storage/framework/.stacks/core/api/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { log, runCommand } from '@stacksjs/cli'
1+
import { runCommand } from '@stacksjs/cli'
22

33
const command: string = 'bun build ./src/index.ts --outdir dist --format esm --target bun'
44
const result = await runCommand(command, {

storage/framework/.stacks/core/api/src/index.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ export async function useHttpFetch(endpoint = '') {
1616
baseURL = endpoint
1717

1818
async function post(url: string, params?: Params): Promise<any> {
19-
const headers: any = { Accept: 'application/json' };
19+
const headers: any = { Accept: 'application/json' }
2020

21-
if (token.value) {
22-
headers.Authorization = `Bearer ${token.value}`;
23-
}
21+
if (token.value)
22+
headers.Authorization = `Bearer ${token.value}`
2423

2524
const parameters: FetchOptions = {
2625
...params,
@@ -48,12 +47,11 @@ export async function useHttpFetch(endpoint = '') {
4847
}
4948

5049
async function get(url: string, params?: Params): Promise<any> {
51-
const headers: any = { Accept: 'application/json' };
50+
const headers: any = { Accept: 'application/json' }
51+
52+
if (token.value)
53+
headers.Authorization = `Bearer ${token.value}`
5254

53-
if (token.value) {
54-
headers.Authorization = `Bearer ${token.value}`;
55-
}
56-
5755
const parameters: FetchOptions = {
5856
...params,
5957
...{
@@ -74,11 +72,10 @@ export async function useHttpFetch(endpoint = '') {
7472
}
7573

7674
async function patch(url: string, params?: Params): Promise<any> {
77-
const headers: any = { Accept: 'application/json' };
75+
const headers: any = { Accept: 'application/json' }
7876

79-
if (token.value) {
80-
headers.Authorization = `Bearer ${token.value}`;
81-
}
77+
if (token.value)
78+
headers.Authorization = `Bearer ${token.value}`
8279

8380
const parameters: FetchOptions = {
8481
...params,
@@ -103,11 +100,10 @@ export async function useHttpFetch(endpoint = '') {
103100
}
104101

105102
async function destroy(url: string, params?: Params): Promise<any> {
106-
const headers: any = { Accept: 'application/json' };
103+
const headers: any = { Accept: 'application/json' }
107104

108-
if (token.value) {
109-
headers.Authorization = `Bearer ${token.value}`;
110-
}
105+
if (token.value)
106+
headers.Authorization = `Bearer ${token.value}`
111107

112108
const parameters: FetchOptions = {
113109
...params,

storage/framework/.stacks/core/buddy/src/commands/dns.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { runCommand } from '@stacksjs/cli'
66
// import { Action } from '@stacksjs/enums'
77
// import { runAction } from '@stacksjs/actions'
88

9-
type DnsOptions = {
9+
interface DnsOptions {
1010
query?: string
1111
type?: string
1212
nameserver?: string
@@ -70,7 +70,7 @@ export function dns(buddy: CLI) {
7070
.map(([key, value]) => `--${key} ${value}`)
7171
.join(' ')
7272

73-
await runCommand(`dog ${domain || config.app.url } ${optionsString}`)
73+
await runCommand(`dog ${domain || config.app.url} ${optionsString}`)
7474

7575
process.exit(ExitCode.Success)
7676
})

storage/framework/.stacks/core/buddy/src/commands/http.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { ExitCode } from '@stacksjs/types'
22
import type { CLI } from '@stacksjs/types'
33
import { config } from '@stacksjs/config'
4+
45
// import { path } from '@stacksjs/path'
56
import { runCommandSync } from '@stacksjs/cli'
67

7-
import { exec } from 'child_process'
8-
98
// function runCommand(command: string): Promise<string> {
109
// return new Promise((resolve, reject) => {
1110
// exec(command, { shell: true, cwd: path.projectPath() }, (error, stdout, stderr) => {
@@ -23,7 +22,7 @@ import { exec } from 'child_process'
2322
// import { Action } from '@stacksjs/enums'
2423
// import { runAction } from '@stacksjs/actions'
2524

26-
type HttpOptions = {
25+
interface HttpOptions {
2726
verbose?: boolean
2827
}
2928

@@ -43,7 +42,7 @@ export function http(buddy: CLI) {
4342
.map(([key, value]) => `--${key} ${value}`)
4443
.join(' ')
4544

46-
const command = `http GET ${domain || config.app.url } ${optionsString}`
45+
const command = `http GET ${domain || config.app.url} ${optionsString}`
4746
console.log(`Running command: ${command}`)
4847
runCommandSync(command)
4948

storage/framework/.stacks/core/buddy/src/commands/migrate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function migrate(buddy: CLI) {
3030
process.exit(ExitCode.Success)
3131
})
3232

33-
buddy
33+
buddy
3434
.command('migrate:dns', descriptions.migrate)
3535
.option('--verbose', descriptions.verbose, { default: false })
3636
.action(async (options: MigrateOptions) => {

0 commit comments

Comments
 (0)