@gravito/pulse 3.0.1 → 3.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravito/pulse",
3
- "version": "3.0.1",
3
+ "version": "3.2.1",
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"
@@ -9,10 +9,12 @@
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
11
  "dev": "bun run ./src/index.ts",
12
- "test": "bun test",
13
- "test:coverage": "bun test --coverage --coverage-threshold=40",
14
- "test:ci": "bun test --coverage --coverage-threshold=40",
15
- "typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck"
12
+ "test": "bun test --timeout=10000",
13
+ "test:coverage": "bun test --timeout=10000 --coverage --coverage-reporter=lcov --coverage-dir coverage && bun run --bun scripts/check-coverage.ts",
14
+ "test:ci": "bun test --timeout=10000 --coverage --coverage-reporter=lcov --coverage-dir coverage && bun run --bun scripts/check-coverage.ts",
15
+ "typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
16
+ "test:unit": "bun test tests/ --timeout=10000",
17
+ "test:integration": "test $(find tests -name '*.integration.test.ts' 2>/dev/null | wc -l) -gt 0 && find tests -name '*.integration.test.ts' -print0 | xargs -0 bun test --timeout=10000 || echo 'No integration tests found'"
16
18
  },
17
19
  "files": [
18
20
  "dist",
@@ -25,14 +27,14 @@
25
27
  },
26
28
  "dependencies": {
27
29
  "@clack/prompts": "^0.7.0",
28
- "@gravito/scaffold": "workspace:*",
30
+ "@gravito/scaffold": "^3.1.1",
29
31
  "cac": "^6.7.14",
30
32
  "giget": "^1.2.5",
31
33
  "node-fetch-native": "^1.6.7",
32
34
  "picocolors": "^1.0.0"
33
35
  },
34
36
  "peerDependencies": {
35
- "@gravito/core": "workspace:*"
37
+ "@gravito/core": "^1.6.1"
36
38
  },
37
39
  "author": "Carl Lee <carllee0520@gmail.com>",
38
40
  "license": "MIT",
@@ -0,0 +1,10 @@
1
+ import { Command } from '@gravito/pulse'
2
+
3
+ export default class {{ Name }} extends Command {
4
+ static signature = '{{ command }}'
5
+ static description = 'Command description'
6
+
7
+ async handle() {
8
+ this.info('{{ Name }} executed successfully!')
9
+ }
10
+ }
@@ -0,0 +1,44 @@
1
+ import { Model, Column, PrimaryKey, HasMany, type HasManyRelation } from '@gravito/atlas'
2
+
3
+ /**
4
+ * {{ Name }} Model
5
+ *
6
+ * This model is configured for automatic GraphQL schema generation.
7
+ */
8
+ export class {{ Name }} extends Model {
9
+ static table = '{{ name }}s'
10
+
11
+ /**
12
+ * Fields that should be hidden from both JSON and GraphQL output.
13
+ */
14
+ static hidden = ['password']
15
+
16
+ /**
17
+ * Virtual fields to be appended to the model and exposed in GraphQL.
18
+ * Make sure to implement the corresponding getter: get[FieldName]Attribute().
19
+ */
20
+ static appends = ['full_name']
21
+
22
+ @PrimaryKey()
23
+ id!: number
24
+
25
+ @Column()
26
+ name!: string
27
+
28
+ @Column()
29
+ email!: string
30
+
31
+ /**
32
+ * Example relationship definition.
33
+ * Atlas will automatically resolve this, and OrbitGraphQL will expose it.
34
+ */
35
+ // @HasMany(() => OtherModel)
36
+ // declare others: HasManyRelation<OtherModel>
37
+
38
+ /**
39
+ * Accessor for the 'full_name' virtual field.
40
+ */
41
+ getFullNameAttribute(): string {
42
+ return `${this.name} (Virtual)`
43
+ }
44
+ }
package/stubs/model.stub CHANGED
@@ -1,14 +1,14 @@
1
- import { Model, Column, PrimaryKey } from '@gravito/atlas'
1
+ import { Model, column } from '@gravito/atlas'
2
2
 
3
3
  export class {{ Name }} extends Model {
4
4
  static table = '{{ name }}s'
5
5
 
6
- @PrimaryKey()
7
- id!: number
6
+ @column({ isPrimary: true })
7
+ declare id: number
8
8
 
9
- @Column()
10
- name!: string
9
+ @column()
10
+ declare name: string
11
11
 
12
- // @Column()
13
- // createdAt!: Date
12
+ // @column()
13
+ // declare createdAt: Date
14
14
  }