@gravito/pulse 1.0.0-beta.6 → 1.0.0
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/index.js +8079 -1631
- package/package.json +11 -4
- package/stubs/controller.resource.stub +52 -0
- package/stubs/controller.stub +7 -7
- package/stubs/migration.stub +11 -14
- package/stubs/model.stub +9 -5
- package/stubs/request.stub +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/pulse",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The official CLI for Gravito Galaxy Architecture. Scaffold projects and manage your universe.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gravito": "bin/gravito.mjs"
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "bun build ./src/index.ts --outdir ./dist --target bun --external giget --external cac --external @clack/prompts --external picocolors",
|
|
11
|
-
"dev": "bun run ./src/index.ts"
|
|
11
|
+
"dev": "bun run ./src/index.ts",
|
|
12
|
+
"test": "bun test",
|
|
13
|
+
"test:coverage": "bun test --coverage --coverage-threshold=80",
|
|
14
|
+
"test:ci": "bun test --coverage --coverage-threshold=80",
|
|
15
|
+
"typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck"
|
|
12
16
|
},
|
|
13
17
|
"files": [
|
|
14
18
|
"dist",
|
|
@@ -21,14 +25,14 @@
|
|
|
21
25
|
},
|
|
22
26
|
"dependencies": {
|
|
23
27
|
"@clack/prompts": "^0.7.0",
|
|
24
|
-
"@gravito/scaffold": "
|
|
28
|
+
"@gravito/scaffold": "workspace:*",
|
|
25
29
|
"cac": "^6.7.14",
|
|
26
30
|
"giget": "^1.2.5",
|
|
27
31
|
"node-fetch-native": "^1.6.7",
|
|
28
32
|
"picocolors": "^1.0.0"
|
|
29
33
|
},
|
|
30
34
|
"peerDependencies": {
|
|
31
|
-
"gravito
|
|
35
|
+
"@gravito/core": "workspace:*"
|
|
32
36
|
},
|
|
33
37
|
"author": "Carl Lee <carllee0520@gmail.com>",
|
|
34
38
|
"license": "MIT",
|
|
@@ -37,5 +41,8 @@
|
|
|
37
41
|
"type": "git",
|
|
38
42
|
"url": "git+https://github.com/gravito-framework/gravito.git",
|
|
39
43
|
"directory": "packages/cli"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"bun-types": "latest"
|
|
40
47
|
}
|
|
41
48
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Controller } from '@gravito/monolith'
|
|
2
|
+
|
|
3
|
+
export class {{ Name }}Controller extends Controller {
|
|
4
|
+
/**
|
|
5
|
+
* Display a listing of the resource.
|
|
6
|
+
*/
|
|
7
|
+
async index() {
|
|
8
|
+
return this.json({ message: '{{ Name }} listing' })
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Show the form for creating a new resource.
|
|
13
|
+
*/
|
|
14
|
+
async create() {
|
|
15
|
+
//
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Store a newly created resource in storage.
|
|
20
|
+
*/
|
|
21
|
+
async store() {
|
|
22
|
+
//
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Display the specified resource.
|
|
27
|
+
*/
|
|
28
|
+
async show() {
|
|
29
|
+
//
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Show the form for editing the specified resource.
|
|
34
|
+
*/
|
|
35
|
+
async edit() {
|
|
36
|
+
//
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Update the specified resource in storage.
|
|
41
|
+
*/
|
|
42
|
+
async update() {
|
|
43
|
+
//
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Remove the specified resource from storage.
|
|
48
|
+
*/
|
|
49
|
+
async destroy() {
|
|
50
|
+
//
|
|
51
|
+
}
|
|
52
|
+
}
|
package/stubs/controller.stub
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Context } from '@gravito/photon'
|
|
1
|
+
import { Controller } from '@gravito/monolith'
|
|
3
2
|
|
|
4
|
-
export class {{ Name }}Controller {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export class {{ Name }}Controller extends Controller {
|
|
4
|
+
/**
|
|
5
|
+
* Display a listing of the resource.
|
|
6
|
+
*/
|
|
7
|
+
async index() {
|
|
8
|
+
return this.json({ message: 'Hello from {{ Name }}' })
|
|
9
9
|
}
|
|
10
10
|
}
|
package/stubs/migration.stub
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { sql } from 'drizzle-orm'
|
|
2
|
-
import type {
|
|
2
|
+
import type { AtlasOrbit } from '@gravito/atlas'
|
|
3
3
|
|
|
4
|
-
export async function up(db:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// `)
|
|
4
|
+
export async function up(db: AtlasOrbit): Promise<void> {
|
|
5
|
+
await db.connection.execute(sql`
|
|
6
|
+
CREATE TABLE {{ name }}s (
|
|
7
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
8
|
+
name TEXT NOT NULL,
|
|
9
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
10
|
+
)
|
|
11
|
+
`)
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
export async function down(db:
|
|
16
|
-
|
|
17
|
-
// Example:
|
|
18
|
-
// await db.raw.execute(sql`DROP TABLE {{ name }}`)
|
|
14
|
+
export async function down(db: AtlasOrbit): Promise<void> {
|
|
15
|
+
await db.connection.execute(sql`DROP TABLE {{ name }}s`)
|
|
19
16
|
}
|
package/stubs/model.stub
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { Model } from '@gravito/atlas'
|
|
1
|
+
import { Model, Column, PrimaryKey } from '@gravito/atlas'
|
|
2
2
|
|
|
3
3
|
export class {{ Name }} extends Model {
|
|
4
4
|
static table = '{{ name }}s'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
@PrimaryKey()
|
|
7
|
+
id!: number
|
|
8
|
+
|
|
9
|
+
@Column()
|
|
10
|
+
name!: string
|
|
11
|
+
|
|
12
|
+
// @Column()
|
|
13
|
+
// createdAt!: Date
|
|
10
14
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormRequest, Schema } from '@gravito/monolith'
|
|
2
|
+
|
|
3
|
+
export class {{ Name }}Request extends FormRequest {
|
|
4
|
+
/**
|
|
5
|
+
* Determine if the user is authorized to make this request.
|
|
6
|
+
*/
|
|
7
|
+
authorize(): boolean {
|
|
8
|
+
return true
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the validation rules that apply to the request.
|
|
13
|
+
*/
|
|
14
|
+
schema() {
|
|
15
|
+
return Schema.Object({
|
|
16
|
+
// Define your validation rules here
|
|
17
|
+
// title: Schema.String(),
|
|
18
|
+
// body: Schema.String({ minLength: 10 }),
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|