@supatype/cli 0.1.4 → 0.1.6
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +99 -97
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/app-vite-env.d.ts +4 -0
- package/dist/app-vite-env.d.ts.map +1 -0
- package/dist/app-vite-env.js +22 -0
- package/dist/app-vite-env.js.map +1 -0
- package/dist/augmentation-generator.d.ts.map +1 -1
- package/dist/augmentation-generator.js +26 -4
- package/dist/augmentation-generator.js.map +1 -1
- package/dist/binary-cache.d.ts +7 -5
- package/dist/binary-cache.d.ts.map +1 -1
- package/dist/binary-cache.js +28 -10
- package/dist/binary-cache.js.map +1 -1
- package/dist/cli-standalone.d.ts +10 -0
- package/dist/cli-standalone.d.ts.map +1 -0
- package/dist/cli-standalone.js +56 -0
- package/dist/cli-standalone.js.map +1 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/admin.js +10 -3
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +34 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +16 -0
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/self-update.d.ts +1 -1
- package/dist/commands/self-update.d.ts.map +1 -1
- package/dist/commands/self-update.js +33 -9
- package/dist/commands/self-update.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +9 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/components.d.ts +2 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -2
- package/dist/components.js.map +1 -1
- package/dist/dev-compose.d.ts.map +1 -1
- package/dist/dev-compose.js +122 -12
- package/dist/dev-compose.js.map +1 -1
- package/dist/project-config.d.ts +2 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js.map +1 -1
- package/dist/realtime-launch.d.ts +11 -0
- package/dist/realtime-launch.d.ts.map +1 -0
- package/dist/realtime-launch.js +39 -0
- package/dist/realtime-launch.js.map +1 -0
- package/dist/required-host-components.js +1 -1
- package/dist/required-host-components.js.map +1 -1
- package/dist/route-manifest.d.ts +3 -0
- package/dist/route-manifest.d.ts.map +1 -0
- package/dist/route-manifest.js +15 -0
- package/dist/route-manifest.js.map +1 -0
- package/dist/schema-push-lock.d.ts +17 -0
- package/dist/schema-push-lock.d.ts.map +1 -0
- package/dist/schema-push-lock.js +106 -0
- package/dist/schema-push-lock.js.map +1 -0
- package/dist/self-host-compose.d.ts.map +1 -1
- package/dist/self-host-compose.js +18 -0
- package/dist/self-host-compose.js.map +1 -1
- package/dist/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor.js +125 -13
- package/dist/type-extractor.js.map +1 -1
- package/package.json +1 -1
- package/scripts/build-release-bundle.mjs +27 -0
- package/src/app-vite-env.ts +27 -0
- package/src/augmentation-generator.ts +29 -5
- package/src/binary-cache.ts +29 -11
- package/src/cli-standalone.ts +62 -0
- package/src/commands/admin.ts +13 -3
- package/src/commands/dev.ts +38 -0
- package/src/commands/init.ts +3 -1
- package/src/commands/keys.ts +16 -0
- package/src/commands/self-update.ts +34 -13
- package/src/commands/update.ts +9 -1
- package/src/components.ts +2 -2
- package/src/dev-compose.ts +146 -14
- package/src/project-config.ts +2 -0
- package/src/realtime-launch.ts +52 -0
- package/src/required-host-components.ts +1 -1
- package/src/route-manifest.ts +17 -0
- package/src/schema-push-lock.ts +131 -0
- package/src/self-host-compose.ts +18 -0
- package/src/type-extractor.ts +156 -13
- package/tests/augmentation-generator.test.ts +44 -4
- package/tests/realtime-launch.test.ts +25 -0
- package/tests/required-host-components.test.ts +2 -0
- package/tests/route-manifest.test.ts +29 -0
- package/tests/type-extractor.test.ts +52 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -635,6 +635,7 @@ export type Message = Model<{
|
|
|
635
635
|
kind: "relation",
|
|
636
636
|
cardinality: "belongsTo",
|
|
637
637
|
target: "Profile",
|
|
638
|
+
required: true,
|
|
638
639
|
annotations: { db: { foreignKey: "created_by_id" } },
|
|
639
640
|
})
|
|
640
641
|
expect(room?.fields["created_at"]).toMatchObject({ kind: "datetime" })
|
|
@@ -647,12 +648,63 @@ export type Message = Model<{
|
|
|
647
648
|
kind: "relation",
|
|
648
649
|
cardinality: "belongsTo",
|
|
649
650
|
target: "Room",
|
|
651
|
+
required: true,
|
|
652
|
+
onDelete: "cascade",
|
|
650
653
|
annotations: { db: { foreignKey: "room_id" } },
|
|
651
654
|
})
|
|
652
655
|
expect(message?.fields["author"]).toMatchObject({
|
|
653
656
|
kind: "relation",
|
|
654
657
|
cardinality: "belongsTo",
|
|
655
658
|
target: "Profile",
|
|
659
|
+
required: true,
|
|
660
|
+
})
|
|
661
|
+
expect(message?.fields["body"]).toMatchObject({
|
|
662
|
+
kind: "text",
|
|
663
|
+
check: 'char_length("{name}") <= 2000',
|
|
664
|
+
})
|
|
665
|
+
const messageIndexes = message?.annotations.db.indexes as Array<Record<string, unknown>>
|
|
666
|
+
expect(messageIndexes).toHaveLength(1)
|
|
667
|
+
expect(messageIndexes?.[0]).toMatchObject({
|
|
668
|
+
using: "btree",
|
|
669
|
+
unique: false,
|
|
670
|
+
fields: ["room_id", "created_at"],
|
|
671
|
+
})
|
|
672
|
+
})
|
|
673
|
+
|
|
674
|
+
it("extracts ManyToMany relations with through table option", () => {
|
|
675
|
+
const dir = mkdtempSync(join(tmpdir(), "supatype-many-to-many-"))
|
|
676
|
+
dirs.push(dir)
|
|
677
|
+
const schemaPath = join(dir, "schema.ts")
|
|
678
|
+
writeFileSync(
|
|
679
|
+
schemaPath,
|
|
680
|
+
`
|
|
681
|
+
import type { Model, UUID, ManyToMany, Public, LoggedIn } from "@supatype/types"
|
|
682
|
+
|
|
683
|
+
export type Course = Model<{
|
|
684
|
+
id: UUID
|
|
685
|
+
title: string
|
|
686
|
+
}, {
|
|
687
|
+
access: { read: Public; create: LoggedIn }
|
|
688
|
+
}>
|
|
689
|
+
|
|
690
|
+
export type Student = Model<{
|
|
691
|
+
id: UUID
|
|
692
|
+
name: string
|
|
693
|
+
courses: ManyToMany<Course, { through: "enrollments" }>
|
|
694
|
+
}, {
|
|
695
|
+
access: { read: Public; create: LoggedIn }
|
|
696
|
+
}>
|
|
697
|
+
`,
|
|
698
|
+
"utf8",
|
|
699
|
+
)
|
|
700
|
+
|
|
701
|
+
const ast = extractSchemaAstFromTypes(schemaPath, dir)
|
|
702
|
+
const student = ast?.models.find((m) => m.name === "Student")
|
|
703
|
+
expect(student?.fields["courses"]).toMatchObject({
|
|
704
|
+
kind: "relation",
|
|
705
|
+
cardinality: "manyToMany",
|
|
706
|
+
target: "Course",
|
|
707
|
+
through: "enrollments",
|
|
656
708
|
})
|
|
657
709
|
})
|
|
658
710
|
|