@contember/client-content-generator
Advanced tools
Comparing version 2.0.0-alpha.32 to 2.0.0-alpha.35
{ | ||
"name": "@contember/client-content-generator", | ||
"license": "Apache-2.0", | ||
"version": "2.0.0-alpha.32", | ||
"version": "2.0.0-alpha.35", | ||
"type": "module", | ||
@@ -36,8 +36,8 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@contember/client-content": "2.0.0-alpha.32", | ||
"@contember/schema": "2.0.0-alpha.32", | ||
"@contember/schema-utils": "2.0.0-alpha.32" | ||
"@contember/client-content": "2.0.0-alpha.35", | ||
"@contember/schema": "2.0.0-alpha.35", | ||
"@contember/schema-utils": "2.0.0-alpha.35" | ||
}, | ||
"devDependencies": { | ||
"@contember/schema-definition": "2.0.0-alpha.32", | ||
"@contember/schema-definition": "2.0.0-alpha.35", | ||
"@types/node": "^20.16.11" | ||
@@ -50,2 +50,2 @@ }, | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { describe, expect, test } from 'bun:test' | ||
import { EntityTypeSchemaGenerator } from '../src' | ||
@@ -11,41 +11,3 @@ import { schemas } from './schemas' | ||
expect(entityGenerator.generate(schemas.scalarsSchema.model)).toMatchInlineSnapshot(` | ||
" | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
columns: { | ||
id: string | ||
stringCol: string | null | ||
intCol: number | null | ||
doubleCol: number | null | ||
dateCol: string | null | ||
datetimeCol: string | null | ||
booleanCol: boolean | null | ||
jsonCol: JSONValue | null | ||
uuidCol: string | null | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.scalarsSchema.model)).toMatchSnapshot() | ||
}) | ||
@@ -55,88 +17,7 @@ | ||
expect(entityGenerator.generate(schemas.enumSchema.model)).toMatchInlineSnapshot(` | ||
"import type { FooEnumCol } from './enums' | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
columns: { | ||
id: string | ||
enumCol: FooEnumCol | null | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.enumSchema.model)).toMatchSnapshot() | ||
}) | ||
test('generate one has one', () => { | ||
expect(entityGenerator.generate(schemas.oneHasOneSchema.model)).toMatchInlineSnapshot(` | ||
" | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
| Omit<{ oneHasOneInverseRel: Bar['unique']}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
oneHasOneInverseRel: Bar | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type Bar <OverRelation extends string | never = never> = { | ||
name: 'Bar' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
| Omit<{ oneHasOneOwningRel: Foo['unique']}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
oneHasOneOwningRel: Foo | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
Bar: Bar | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.oneHasOneSchema.model)).toMatchSnapshot() | ||
}) | ||
@@ -146,51 +27,3 @@ | ||
expect(entityGenerator.generate(schemas.oneHasManySchema.model)).toMatchInlineSnapshot(` | ||
" | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
| Omit<{ oneHasManyRel: Bar['unique']}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
oneHasManyRel: Bar<'manyHasOneRel'> | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type Bar <OverRelation extends string | never = never> = { | ||
name: 'Bar' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
manyHasOneRel: Foo | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
Bar: Bar | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.oneHasManySchema.model)).toMatchSnapshot() | ||
}) | ||
@@ -200,50 +33,3 @@ | ||
expect(entityGenerator.generate(schemas.manyHasManySchema.model)).toMatchInlineSnapshot(` | ||
" | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
manyHasManyRel: Bar | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type Bar <OverRelation extends string | never = never> = { | ||
name: 'Bar' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
manyHasManyInverseRel: Foo | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
Bar: Bar | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.manyHasManySchema.model)).toMatchSnapshot() | ||
}) | ||
@@ -253,56 +39,5 @@ | ||
expect(entityGenerator.generate(schemas.reducedHasManySchema.model)).toMatchInlineSnapshot(` | ||
" | ||
export type JSONPrimitive = string | number | boolean | null | ||
export type JSONValue = JSONPrimitive | JSONObject | JSONArray | ||
export type JSONObject = { readonly [K in string]?: JSONValue } | ||
export type JSONArray = readonly JSONValue[] | ||
export type Foo <OverRelation extends string | never = never> = { | ||
name: 'Foo' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
| Omit<{ locales: FooLocale['unique']}, OverRelation> | ||
columns: { | ||
id: string | ||
} | ||
hasOne: { | ||
} | ||
hasMany: { | ||
locales: FooLocale<'foo'> | ||
} | ||
hasManyBy: { | ||
localesByLocale: { entity: FooLocale; by: {locale: string} } | ||
} | ||
} | ||
export type FooLocale <OverRelation extends string | never = never> = { | ||
name: 'FooLocale' | ||
unique: | ||
| Omit<{ id: string}, OverRelation> | ||
| Omit<{ locale: string, foo: Foo['unique']}, OverRelation> | ||
columns: { | ||
id: string | ||
locale: string | ||
} | ||
hasOne: { | ||
foo: Foo | ||
} | ||
hasMany: { | ||
} | ||
hasManyBy: { | ||
} | ||
} | ||
export type ContemberClientEntities = { | ||
Foo: Foo | ||
FooLocale: FooLocale | ||
} | ||
export type ContemberClientSchema = { | ||
entities: ContemberClientEntities | ||
} | ||
" | ||
`) | ||
expect(entityGenerator.generate(schemas.reducedHasManySchema.model)).toMatchSnapshot() | ||
}) | ||
}) |
@@ -1,2 +0,2 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { describe, expect, test } from 'bun:test' | ||
import { EnumTypeSchemaGenerator } from '../src' | ||
@@ -13,17 +13,3 @@ | ||
}, | ||
})).toMatchInlineSnapshot(` | ||
"export type OrderStatus = | ||
| "new" | ||
| "paid" | ||
| "cancelled" | ||
export type OrderType = | ||
| "normal" | ||
| "express" | ||
export type ContemberClientEnums = { | ||
OrderStatus: OrderStatus | ||
orderType: OrderType | ||
} | ||
" | ||
`) | ||
})).toMatchSnapshot() | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90
203209
1849
+ Added@contember/client-content@2.0.0-alpha.35(transitive)
+ Added@contember/graphql-builder@2.0.0-alpha.35(transitive)
+ Added@contember/graphql-client@2.0.0-alpha.35(transitive)
+ Added@contember/schema@2.0.0-alpha.35(transitive)
+ Added@contember/schema-utils@2.0.0-alpha.35(transitive)
+ Added@contember/typesafe@2.0.0-alpha.35(transitive)
- Removed@contember/client-content@2.0.0-alpha.32(transitive)
- Removed@contember/graphql-builder@2.0.0-alpha.32(transitive)
- Removed@contember/graphql-client@2.0.0-alpha.32(transitive)
- Removed@contember/schema@2.0.0-alpha.32(transitive)
- Removed@contember/schema-utils@2.0.0-alpha.32(transitive)
- Removed@contember/typesafe@2.0.0-alpha.32(transitive)