feat: added createCRUDBuilder export #895
test-and-build.yml
on: pull_request
build-and-test
4m 48s
Matrix: integration-tests
Annotations
6 errors
|
build-and-test
Process completed with exit code 1.
|
|
tests/cli.test.ts > getGeneratedSchema > should skip generating table row types when skipTypes is true:
tests/cli.test.ts#L1304
AssertionError: expected '// This file was automatically genera…' to contain 'import { createBuilder } from "@rocic…'
- Expected
+ Received
- import { createBuilder } from "@rocicorp/zero";
+ // This file was automatically generated by drizzle-zero.
+ // You should NOT make any changes in this file as it will be overwritten.
+
+ import { createBuilder, createCRUDBuilder } from "@rocicorp/zero";
+
+ const usersTable = {
+ "name": "users",
+ "primaryKey": ["id"],
+ "columns": {
+ "id": {
+ "type": "number",
+ "optional": false,
+ "customType": undefined
+ }
+ }
+ } as const;
+ /**
+ * The Zero schema object.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const schema = {
+ "tables": {
+ "users": usersTable
+ },
+ "relationships": {}
+ } as const;
+
+ /**
+ * Represents the Zero schema type.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export type Schema = typeof schema;
+
+ /**
+ * Represents the ZQL query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const zql = createBuilder(schema);
+ /**
+ * Represents the Zero schema query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use `zql` instead.
+ */
+ export const builder = zql;
+ /**
+ * Represents the CRUD builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const crud = createCRUDBuilder(schema);
+
+ /** Defines the default types for Zero */
+ declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
+
❯ tests/cli.test.ts:1304:29
|
|
tests/cli.test.ts > getGeneratedSchema > should handle empty tables object gracefully:
tests/cli.test.ts#L1252
AssertionError: expected '// This file was automatically genera…' to contain 'import { createBuilder } from "@rocic…'
- Expected
+ Received
- import { createBuilder } from "@rocicorp/zero";
+ // This file was automatically generated by drizzle-zero.
+ // You should NOT make any changes in this file as it will be overwritten.
+
+ import { createBuilder, createCRUDBuilder } from "@rocicorp/zero";
+
+ /**
+ * The Zero schema object.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const schema = {
+ "tables": {},
+ "relationships": {}
+ } as const;
+
+ /**
+ * Represents the Zero schema type.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export type Schema = typeof schema;
+
+ /**
+ * Represents the ZQL query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const zql = createBuilder(schema);
+ /**
+ * Represents the Zero schema query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use `zql` instead.
+ */
+ export const builder = zql;
+ /**
+ * Represents the CRUD builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const crud = createCRUDBuilder(schema);
+
+ /** Defines the default types for Zero */
+ declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
+
❯ tests/cli.test.ts:1252:29
|
|
tests/cli.test.ts > getGeneratedSchema > should include all new features in drizzle-kit type schemas:
tests/cli.test.ts#L1210
AssertionError: expected '// This file was automatically genera…' to contain 'import { createBuilder } from "@rocic…'
- Expected
+ Received
- import { createBuilder } from "@rocicorp/zero";
+ // This file was automatically generated by drizzle-zero.
+ // You should NOT make any changes in this file as it will be overwritten.
+
+ import type { Row } from "@rocicorp/zero";
+ import { createBuilder, createCRUDBuilder } from "@rocicorp/zero";
+
+ const usersTable = {
+ "name": "users",
+ "primaryKey": ["id"],
+ "columns": {
+ "id": {
+ "type": "integer",
+ "optional": false,
+ "customType": undefined
+ }
+ }
+ } as const;
+ const postsTable = {
+ "name": "posts",
+ "primaryKey": ["id"],
+ "columns": {
+ "id": {
+ "type": "integer",
+ "optional": false,
+ "customType": undefined
+ }
+ }
+ } as const;
+ /**
+ * The Zero schema object.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const schema = {
+ "tables": {
+ "users": usersTable,
+ "posts": postsTable
+ },
+ "relationships": {}
+ } as const;
+
+ /**
+ * Represents the Zero schema type.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export type Schema = typeof schema;
+ /**
+ * Represents a row from the "users" table.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use Row["users"] instead from "@rocicorp/zero".
+ */
+ export type User = Row["users"];
+ /**
+ * Represents a row from the "posts" table.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use Row["posts"] instead from "@rocicorp/zero".
+ */
+ export type Post = Row["posts"];
+
+ /**
+ * Represents the ZQL query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const zql = createBuilder(schema);
+ /**
+ * Represents the Zero schema query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use `zql` instead.
+ */
+ export const builder = zql;
+ /**
+ * Represents the CRUD builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const crud = createCRUDBuilder(schema);
+
+ /** Defines the default types for Zero */
+ declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
+
❯ tests/cli.test.ts:1210:29
|
|
tests/cli.test.ts > getGeneratedSchema > should generate builder export with createBuilder from @rocicorp/zero:
tests/cli.test.ts#L1045
AssertionError: expected '// This file was automatically genera…' to contain 'import { createBuilder } from "@rocic…'
- Expected
+ Received
- import { createBuilder } from "@rocicorp/zero";
+ // This file was automatically generated by drizzle-zero.
+ // You should NOT make any changes in this file as it will be overwritten.
+
+ import type { Row } from "@rocicorp/zero";
+ import { createBuilder, createCRUDBuilder } from "@rocicorp/zero";
+
+ const usersTable = {
+ "name": "users",
+ "primaryKey": ["id"],
+ "columns": {
+ "id": {
+ "type": "number",
+ "optional": false,
+ "customType": undefined
+ },
+ "name": {
+ "type": "string",
+ "optional": false,
+ "customType": undefined
+ }
+ }
+ } as const;
+ /**
+ * The Zero schema object.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const schema = {
+ "tables": {
+ "users": usersTable
+ },
+ "relationships": {}
+ } as const;
+
+ /**
+ * Represents the Zero schema type.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export type Schema = typeof schema;
+ /**
+ * Represents a row from the "users" table.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use Row["users"] instead from "@rocicorp/zero".
+ */
+ export type User = Row["users"];
+
+ /**
+ * Represents the ZQL query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const zql = createBuilder(schema);
+ /**
+ * Represents the Zero schema query builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ *
+ * @deprecated Use `zql` instead.
+ */
+ export const builder = zql;
+ /**
+ * Represents the CRUD builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const crud = createCRUDBuilder(schema);
+
+ /** Defines the default types for Zero */
+ declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
+
❯ tests/cli.test.ts:1045:29
|
|
tests/cli.test.ts > getGeneratedSchema > should handle complex schema properties correctly:
tests/cli.test.ts#L135
Error: Snapshot `getGeneratedSchema > should handle complex schema properties correctly 1` mismatched
- Expected
+ Received
@@ -1,10 +1,10 @@
"// This file was automatically generated by drizzle-zero.
// You should NOT make any changes in this file as it will be overwritten.
import type { Row } from "@rocicorp/zero";
- import { createBuilder } from "@rocicorp/zero";
+ import { createBuilder, createCRUDBuilder } from "@rocicorp/zero";
import type { ZeroCustomType } from "drizzle-zero";
import type { schema as zeroSchema } from "./tests/schemas/one-to-one.zero";
const usersTable = {
"name": "users",
@@ -50,10 +50,15 @@
* Represents the Zero schema query builder.
* This type is auto-generated from your Drizzle schema definition.
*
* @deprecated Use `zql` instead.
*/
- export const builder = zql;
+ export const builder = zql;
+ /**
+ * Represents the CRUD builder.
+ * This type is auto-generated from your Drizzle schema definition.
+ */
+ export const crud = createCRUDBuilder(schema);
/** Defines the default types for Zero */
declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
"
❯ tests/cli.test.ts:135:29
|