Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contember/client-content-generator

Package Overview
Dependencies
Maintainers
0
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/client-content-generator - npm Package Compare versions

Comparing version 2.0.0-alpha.32 to 2.0.0-alpha.35

tests/__snapshots__/generateEnittyTypes.test.ts.snap

12

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc