create-astrale-domain 0.3.0-beta.21 → 0.3.0-beta.211

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.
Files changed (55) hide show
  1. package/README.md +54 -3
  2. package/dist/index.js +382 -135
  3. package/package.json +17 -12
  4. package/template/.env.example +9 -8
  5. package/template/.gitignore.template +8 -2
  6. package/template/.variants/custom/README.md +19 -9
  7. package/template/.variants/custom/__tests__/variant.test.ts +4 -4
  8. package/template/.variants/custom/domain.ts +28 -0
  9. package/template/.variants/custom/{views/application/app → frontend}/index.html +1 -0
  10. package/template/.variants/custom/{views/application/app → frontend}/main.ts +1 -1
  11. package/template/.variants/custom/frontend/package.json +11 -0
  12. package/template/.variants/custom/frontend/public/favicon.svg +4 -0
  13. package/template/.variants/custom/frontend/tsconfig.json +17 -0
  14. package/template/.variants/custom/schema/schema.ts +15 -0
  15. package/template/.variants/custom/views/application/index.ts +1 -0
  16. package/template/.variants/custom/views/index.ts +1 -1
  17. package/template/.variants/custom/vite.config.ts +11 -2
  18. package/template/.variants/none/README.md +13 -4
  19. package/template/.variants/none/__tests__/variant.test.ts +3 -3
  20. package/template/.variants/none/domain.ts +18 -0
  21. package/template/.variants/none/schema/schema.ts +11 -0
  22. package/template/.variants/react/README.md +20 -10
  23. package/template/.variants/react/__tests__/variant.test.ts +4 -4
  24. package/template/.variants/react/domain.ts +28 -0
  25. package/template/.variants/react/frontend/index.html +1 -0
  26. package/template/.variants/react/frontend/package.json +7 -1
  27. package/template/.variants/react/frontend/public/favicon.svg +4 -0
  28. package/template/.variants/react/frontend/src/styles.css +1 -1
  29. package/template/.variants/react/frontend/tsconfig.json +19 -0
  30. package/template/.variants/react/schema/schema.ts +15 -0
  31. package/template/.variants/react/vite.config.ts +2 -3
  32. package/template/CLAUDE.md +43 -5
  33. package/template/index.ts +1 -1
  34. package/template/package.json +15 -31
  35. package/template/pnpm-workspace.yaml +5 -21
  36. package/template/runtime.ts +1 -2
  37. package/template/schema/__tests__/schema.test.ts +14 -0
  38. package/template/schema/index.ts +1 -1
  39. package/template/tests/datasets/demo.ts +21 -0
  40. package/template/tests/e2e/domain.test.ts +9 -0
  41. package/template/tsconfig.json +8 -17
  42. package/template/.variants/custom/application.ts +0 -9
  43. package/template/.variants/custom/schema/application/index.ts +0 -8
  44. package/template/.variants/custom/views/application/__tests__/routes.test.ts +0 -7
  45. package/template/.variants/custom/views/application/routes.ts +0 -12
  46. package/template/.variants/none/application.ts +0 -8
  47. package/template/.variants/none/schema/application/index.ts +0 -5
  48. package/template/.variants/react/application.ts +0 -9
  49. package/template/.variants/react/schema/application/index.ts +0 -8
  50. package/template/.variants/react/views/application/__tests__/routes.test.ts +0 -7
  51. package/template/.variants/react/views/application/routes.ts +0 -12
  52. package/template/.variants/react/views/index.ts +0 -1
  53. package/template/schema/application/__tests__/schema.test.ts +0 -11
  54. package/template/tests/e2e/application.test.ts +0 -10
  55. package/template/tsconfig.package.json +0 -29
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrale-domain",
3
- "version": "0.1.0",
3
+ "version": "0.1.0-alpha.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -8,26 +8,22 @@
8
8
  "main": "./schema/index.ts",
9
9
  "types": "./schema/index.ts",
10
10
  "imports": {
11
- "#actions": "./actions/index.ts",
12
- "#actions/*": "./actions/*/index.ts",
11
+ "#functions": "./functions/index.ts",
12
+ "#functions/*": "./functions/*/index.ts",
13
13
  "#integrations": "./integrations/index.ts",
14
14
  "#integrations/*": "./integrations/*/index.ts",
15
- "#migrations": "./migrations/index.ts",
16
- "#migrations/*": "./migrations/*/index.ts",
17
15
  "#mutations": "./mutations/index.ts",
18
16
  "#mutations/*": "./mutations/*/index.ts",
19
17
  "#queries": "./queries/index.ts",
20
18
  "#queries/*": "./queries/*/index.ts",
19
+ "#routes": "./routes/index.ts",
20
+ "#routes/*": "./routes/*/index.ts",
21
21
  "#providers": "./providers/index.ts",
22
22
  "#providers/*": "./providers/*/index.ts",
23
23
  "#rules": "./rules/index.ts",
24
24
  "#rules/*": "./rules/*/index.ts",
25
25
  "#schema": "./schema/index.ts",
26
26
  "#schema/*": "./schema/*/index.ts",
27
- "#scripts": "./scripts/index.ts",
28
- "#scripts/*": "./scripts/*/index.ts",
29
- "#states": "./states/index.ts",
30
- "#states/*": "./states/*/index.ts",
31
27
  "#tests": "./tests/index.ts",
32
28
  "#tests/*": "./tests/*/index.ts",
33
29
  "#ui": "./ui/index.ts",
@@ -35,19 +31,13 @@
35
31
  "#utils": "./utils/index.ts",
36
32
  "#utils/*": "./utils/*/index.ts",
37
33
  "#views": "./views/index.ts",
38
- "#views/*": "./views/*/index.ts",
39
- "#workflows": "./workflows/index.ts",
40
- "#workflows/*": "./workflows/*/index.ts"
34
+ "#views/*": "./views/*/index.ts"
41
35
  },
42
36
  "exports": {
43
37
  ".": {
44
38
  "types": "./schema/index.ts",
45
39
  "import": "./schema/index.ts"
46
40
  },
47
- "./runtime": {
48
- "types": "./runtime.ts",
49
- "import": "./runtime.ts"
50
- },
51
41
  "./package.json": "./package.json"
52
42
  },
53
43
  "publishConfig": {
@@ -58,17 +48,11 @@
58
48
  "types": "./dist/schema/index.d.ts",
59
49
  "import": "./dist/schema/index.js"
60
50
  },
61
- "./runtime": {
62
- "types": "./dist/runtime.d.ts",
63
- "import": "./dist/runtime.js"
64
- },
65
51
  "./package.json": "./package.json"
66
52
  },
67
53
  "access": "public"
68
54
  },
69
55
  "scripts": {
70
- "dev": "astrale-domain dev",
71
- "prod": "astrale-domain deploy prod",
72
56
  "deploy": "astrale-domain deploy",
73
57
  "build": "astrale-domain build",
74
58
  "lint": "astrale-domain lint",
@@ -76,25 +60,25 @@
76
60
  "package": "astrale-domain package",
77
61
  "prepack": "pnpm run package",
78
62
  "typecheck": "tsc --noEmit",
79
- "test": "vitest run --config vitest.config.ts"
63
+ "test": "astrale-domain test"
80
64
  },
81
65
  "dependencies": {
82
- "@astrale-os/sdk": ">=0.5.0-beta.16 <1.0.0",
83
- "zod": "^4.4.3"
66
+ "@astrale-os/sdk": "0.0.0-scaffold"
84
67
  },
85
68
  "devDependencies": {
86
- "@astrale-os/adapter-cloudflare": ">=0.5.0-beta.19 <1.0.0",
87
- "@astrale-os/ox": ">=0.1.3 <1.0.0",
88
- "@types/node": "^22.0.0",
69
+ "@astrale-os/ox": ">=0.1.4 <1.0.0",
70
+ "@types/node": "^24.0.0",
71
+ "bun": "1.4.4",
89
72
  "oxlint": ">=1.78.0 <2.0.0",
90
73
  "typescript": "7.0.2",
91
- "vitest": "^4.1.10"
74
+ "vitest": "^5.0.5"
92
75
  },
93
76
  "engines": {
94
- "node": ">=22.13"
77
+ "node": ">=24"
95
78
  },
96
- "packageManager": "pnpm@11.13.1",
79
+ "packageManager": "pnpm@12.1.0",
97
80
  "trustedDependencies": [
81
+ "bun",
98
82
  "esbuild",
99
83
  "sharp",
100
84
  "workerd"
@@ -9,33 +9,18 @@ blockExoticSubdeps: true
9
9
  lockfileIncludeTarballUrl: true
10
10
 
11
11
  # pnpm blocks dependency build scripts by default; these need their postinstall
12
- # to run (workerd is wrangler's runtime — without it `pnpm dev`/`pnpm prod`
13
- # fail). Internal guarded preinstalls are explicitly denied because they are
14
- # no-ops outside the umbrella workspace.
12
+ # to run (workerd is wrangler's runtime — without it `pnpm run deploy development` fails).
15
13
  allowBuilds:
14
+ bun: true
16
15
  esbuild: true
17
16
  sharp: true
18
17
  workerd: true
19
- # The authored package depends on the SDK facade; its guarded workspace
20
- # preinstall and the guarded preinstalls of its transitive Kernel packages
21
- # are intentionally disabled in generated consumers.
22
- '@astrale-os/sdk': false
23
- '@astrale-os/kernel-client': false
24
- '@astrale-os/kernel-core': false
25
- '@astrale-os/kernel-dsl': false
26
- '@astrale-os/kernel-protocol': false
27
- '@astrale-os/kernel-server': false
28
18
  # Optional native msgpack acceleration; the JS fallback is the portable
29
19
  # scaffold baseline and does not require executing a transitive build script.
30
20
  msgpackr-extract: false
31
21
 
32
- # The SDK ships a guarded no-op workspace preinstall. Generated Domains never
33
- # need to execute it.
34
- ignoredBuiltDependencies:
35
- - '@astrale-os/sdk'
36
-
37
22
  # Reject newly released third-party packages for seven days. First-party
38
- # public packages and Bun's exact supported type package are exempt.
23
+ # public packages are exempt.
39
24
  minimumReleaseAge: 10080
40
25
  minimumReleaseAgeStrict: true
41
26
  minimumReleaseAgeIgnoreMissingTime: false
@@ -44,9 +29,8 @@ minimumReleaseAgeExclude:
44
29
  - '@astrale-os/*'
45
30
  - '@astrale-domains/*'
46
31
  - '@astrale/*'
32
+ - '@jsr/astrale__*'
47
33
  - 'create-astrale-domain'
48
- - 'bun-types@1.4.0'
49
34
 
50
- # Never install implicitly before `pnpm run` or `pnpm exec`; ignored
51
- # preinstalls can otherwise make the dependency-status check misfire.
35
+ # Never install implicitly before `pnpm run` or `pnpm exec`.
52
36
  verifyDepsBeforeRun: false
@@ -6,8 +6,7 @@ import type { schema } from '#schema'
6
6
  const runtime = defineRuntime<typeof schema>()({
7
7
  integrations: {},
8
8
  initialize: () => ({ providers: {} }),
9
- actions: [],
10
- workflows: [],
9
+ functions: [],
11
10
  })
12
11
 
13
12
  export default runtime
@@ -0,0 +1,14 @@
1
+ import { K, KernelSchema, schema as language } from '@astrale-os/sdk/schema'
2
+
3
+ import { schema } from '../index.js'
4
+
5
+ describe('Domain schema', () => {
6
+ it('owns one canonical Domain schema', () => {
7
+ const domain = language.resolve(schema)
8
+ const kernel = language.resolve(KernelSchema)
9
+ expect(domain.source).toBe(schema)
10
+ expect(domain.origin).toBe(schema.origin)
11
+ expect(domain.dependencies.kernel.origin).toBe(K.origin)
12
+ expect(domain.dependencies.kernel.revision).toBe(kernel.revision)
13
+ })
14
+ })
@@ -1 +1 @@
1
- export { schema } from './application/index.js'
1
+ export { schema } from './schema.js'
@@ -0,0 +1,21 @@
1
+ import { defineDataset } from '@astrale-os/sdk/testing'
2
+
3
+ import { schema } from '#schema'
4
+
5
+ /**
6
+ * Demo facts the Domain Studio renders while you build the domain. Declared under `tests/` and
7
+ * referenced lazily from `astrale.config.ts`, so they never reach a Build, a Release, or an
8
+ * installation. Author them with the resolved Classes of `schema`, for example:
9
+ *
10
+ * graph({ classes: { Item, contains }, node, edge }) {
11
+ * const first = node(Item, { props: { name: 'First item' } })
12
+ * const second = node(Item, { props: { name: 'Second item' } })
13
+ * edge(contains, first, second)
14
+ * return { first }
15
+ * }
16
+ */
17
+ export default defineDataset(schema, {
18
+ id: 'demo',
19
+ title: 'Demo data',
20
+ graph() {},
21
+ })
@@ -0,0 +1,9 @@
1
+ import { domain, runtime, schema } from '../../index.js'
2
+
3
+ describe('domain composition', () => {
4
+ it('keeps authored Domain and Runtime composition exact', () => {
5
+ expect(domain.schema).toBe(schema)
6
+ expect(domain.runtime).toBe(runtime)
7
+ expect(runtime.functions).toEqual([])
8
+ })
9
+ })
@@ -7,26 +7,22 @@
7
7
  "jsx": "react-jsx",
8
8
  "types": ["node", "vitest/globals"],
9
9
  "paths": {
10
- "#actions": ["./actions/index.ts"],
11
- "#actions/*": ["./actions/*/index.ts"],
10
+ "#functions": ["./functions/index.ts"],
11
+ "#functions/*": ["./functions/*/index.ts"],
12
12
  "#integrations": ["./integrations/index.ts"],
13
13
  "#integrations/*": ["./integrations/*/index.ts"],
14
- "#migrations": ["./migrations/index.ts"],
15
- "#migrations/*": ["./migrations/*/index.ts"],
16
14
  "#mutations": ["./mutations/index.ts"],
17
15
  "#mutations/*": ["./mutations/*/index.ts"],
18
16
  "#queries": ["./queries/index.ts"],
19
17
  "#queries/*": ["./queries/*/index.ts"],
18
+ "#routes": ["./routes/index.ts"],
19
+ "#routes/*": ["./routes/*/index.ts"],
20
20
  "#providers": ["./providers/index.ts"],
21
21
  "#providers/*": ["./providers/*/index.ts"],
22
22
  "#rules": ["./rules/index.ts"],
23
23
  "#rules/*": ["./rules/*/index.ts"],
24
24
  "#schema": ["./schema/index.ts"],
25
25
  "#schema/*": ["./schema/*/index.ts"],
26
- "#scripts": ["./scripts/index.ts"],
27
- "#scripts/*": ["./scripts/*/index.ts"],
28
- "#states": ["./states/index.ts"],
29
- "#states/*": ["./states/*/index.ts"],
30
26
  "#tests": ["./tests/index.ts"],
31
27
  "#tests/*": ["./tests/*/index.ts"],
32
28
  "#ui": ["./ui/index.ts"],
@@ -34,9 +30,7 @@
34
30
  "#utils": ["./utils/index.ts"],
35
31
  "#utils/*": ["./utils/*/index.ts"],
36
32
  "#views": ["./views/index.ts"],
37
- "#views/*": ["./views/*/index.ts"],
38
- "#workflows": ["./workflows/index.ts"],
39
- "#workflows/*": ["./workflows/*/index.ts"]
33
+ "#views/*": ["./views/*/index.ts"]
40
34
  },
41
35
  "strict": true,
42
36
  "noEmit": true,
@@ -48,22 +42,19 @@
48
42
  },
49
43
  "include": [
50
44
  "schema",
51
- "states",
52
45
  "rules",
53
46
  "queries",
47
+ "routes",
54
48
  "mutations",
55
- "workflows",
56
- "migrations",
57
- "actions",
49
+ "functions",
58
50
  "integrations",
59
51
  "providers",
60
52
  "frontend",
61
53
  "views",
62
54
  "ui",
63
55
  "utils",
64
- "scripts",
65
56
  "tests",
66
- "application.ts",
57
+ "domain.ts",
67
58
  "runtime.ts",
68
59
  "index.ts",
69
60
  "astrale.config.ts",
@@ -1,9 +0,0 @@
1
- import { defineApplication } from '@astrale-os/sdk/application'
2
-
3
- import { schema } from '#schema'
4
- import { frontend } from '#views'
5
-
6
- import runtime from './runtime.js'
7
-
8
- /** Build and publication composition; provider effects live in astrale.config.ts. */
9
- export const application = defineApplication({ schema, runtime, frontend })
@@ -1,8 +0,0 @@
1
- import { defineSchema, view } from '@astrale-os/sdk/schema'
2
-
3
- export const schema = defineSchema('astrale-domain.example.dev', {
4
- classes: {},
5
- views: {
6
- application: view({}),
7
- },
8
- })
@@ -1,7 +0,0 @@
1
- import { frontend } from '../routes.js'
2
-
3
- describe('application View routes', () => {
4
- it('owns the generated application entrypoint', () => {
5
- expect(frontend.entrypoint).toBe('application')
6
- })
7
- })
@@ -1,12 +0,0 @@
1
- import { defineFrontend, vite } from '@astrale-os/sdk/view'
2
-
3
- import { schema } from '#schema'
4
-
5
- /** Framework-neutral escape hatch: swap Vite or the browser implementation without changing Views. */
6
- export const frontend = defineFrontend({
7
- schema,
8
- source: vite(),
9
- routes: {
10
- application: { handshake: 'none' },
11
- },
12
- })
@@ -1,8 +0,0 @@
1
- import { defineApplication } from '@astrale-os/sdk/application'
2
-
3
- import { schema } from '#schema'
4
-
5
- import runtime from './runtime.js'
6
-
7
- /** Build and publication composition; provider effects live in astrale.config.ts. */
8
- export const application = defineApplication({ schema, runtime })
@@ -1,5 +0,0 @@
1
- import { defineSchema } from '@astrale-os/sdk/schema'
2
-
3
- export const schema = defineSchema('astrale-domain.example.dev', {
4
- classes: {},
5
- })
@@ -1,9 +0,0 @@
1
- import { defineApplication } from '@astrale-os/sdk/application'
2
-
3
- import { schema } from '#schema'
4
- import { frontend } from '#views'
5
-
6
- import runtime from './runtime.js'
7
-
8
- /** Build and publication composition; provider effects live in astrale.config.ts. */
9
- export const application = defineApplication({ schema, runtime, frontend })
@@ -1,8 +0,0 @@
1
- import { defineSchema, view } from '@astrale-os/sdk/schema'
2
-
3
- export const schema = defineSchema('astrale-domain.example.dev', {
4
- classes: {},
5
- views: {
6
- application: view({}),
7
- },
8
- })
@@ -1,7 +0,0 @@
1
- import { frontend } from '../routes.js'
2
-
3
- describe('application View routes', () => {
4
- it('owns the generated application entrypoint', () => {
5
- expect(frontend.entrypoint).toBe('application')
6
- })
7
- })
@@ -1,12 +0,0 @@
1
- import { defineFrontend, vite } from '@astrale-os/sdk/view'
2
-
3
- import { schema } from '#schema'
4
-
5
- /** The complete deploy contract; Vite and the browser application stay author-owned. */
6
- export const frontend = defineFrontend({
7
- schema,
8
- source: vite(),
9
- routes: {
10
- application: { handshake: 'none' },
11
- },
12
- })
@@ -1 +0,0 @@
1
- export { frontend } from './application/routes.js'
@@ -1,11 +0,0 @@
1
- import { schema as language } from '@astrale-os/sdk/schema'
2
-
3
- import { schema } from '../index.js'
4
-
5
- describe('application schema', () => {
6
- it('owns one canonical Domain schema', () => {
7
- const domain = language.resolve(schema)
8
- expect(domain.source).toBe(schema)
9
- expect(domain.origin).toBe(schema.origin)
10
- })
11
- })
@@ -1,10 +0,0 @@
1
- import { application, runtime, schema } from '../../index.js'
2
-
3
- describe('application composition', () => {
4
- it('keeps authored Application and Runtime composition exact', () => {
5
- expect(application.schema).toBe(schema)
6
- expect(application.runtime).toBe(runtime)
7
- expect(runtime.actions).toEqual([])
8
- expect(runtime.workflows).toEqual([])
9
- })
10
- })
@@ -1,29 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": ".",
5
- "outDir": "./dist",
6
- "noEmit": false,
7
- "declaration": true,
8
- "declarationMap": false,
9
- "sourceMap": false,
10
- "allowImportingTsExtensions": false,
11
- "types": ["node"],
12
- "jsx": "react-jsx"
13
- },
14
- "include": [
15
- "schema",
16
- "states",
17
- "rules",
18
- "queries",
19
- "mutations",
20
- "workflows",
21
- "migrations",
22
- "actions",
23
- "integrations",
24
- "providers",
25
- "utils",
26
- "runtime.ts"
27
- ],
28
- "exclude": ["**/__tests__/**", "tests", "node_modules", "dist", ".dist", ".wrangler"]
29
- }