@travetto/schema 5.0.0-rc.2 → 5.0.0-rc.4

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/README.md CHANGED
@@ -198,7 +198,6 @@ export async function validate(): Promise<void> {
198
198
 
199
199
  const person = Person.from({
200
200
  name: 'Test',
201
- // @ts-expect-error
202
201
  age: 'abc',
203
202
  address: {
204
203
  street1: '1234 Fun'
package/__index__.ts CHANGED
@@ -13,5 +13,4 @@ export * from './src/validate/error';
13
13
  export * from './src/validate/types';
14
14
  export * from './src/bind-util';
15
15
  export * from './src/data';
16
- export * from './src/name';
17
- export * from './src/types';
16
+ export * from './src/name';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/schema",
3
- "version": "5.0.0-rc.2",
3
+ "version": "5.0.0-rc.4",
4
4
  "description": "Data type registry for runtime validation, reflection and binding.",
5
5
  "keywords": [
6
6
  "schema",
@@ -27,10 +27,10 @@
27
27
  "directory": "module/schema"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/registry": "^5.0.0-rc.2"
30
+ "@travetto/registry": "^5.0.0-rc.4"
31
31
  },
32
32
  "peerDependencies": {
33
- "@travetto/transformer": "^5.0.0-rc.2"
33
+ "@travetto/transformer": "^5.0.0-rc.3"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@travetto/transformer": {
@@ -1,9 +1,8 @@
1
- import { Class } from '@travetto/runtime';
1
+ import { Class, DeepPartial } from '@travetto/runtime';
2
2
 
3
3
  import { BindUtil } from '../bind-util';
4
4
  import { SchemaRegistry } from '../service/registry';
5
5
  import { ClassConfig, ViewFieldsConfig } from '../service/types';
6
- import { DeepPartial } from '../types';
7
6
  import { ValidatorFn } from '../validate/types';
8
7
 
9
8
  /**
package/src/global.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { Class } from '@travetto/runtime';
2
- import type { DeepPartial } from './types';
1
+ import type { Class, DeepPartial } from '@travetto/runtime';
3
2
 
4
3
  declare global {
5
4
  interface Function {
@@ -1,5 +1,4 @@
1
- import { Class } from '@travetto/runtime';
2
- import { Primitive } from '@travetto/schema';
1
+ import { Class, Primitive } from '@travetto/runtime';
3
2
 
4
3
  import { AllViewⲐ } from '../internal/types';
5
4
  import { ValidatorFn } from '../validate/types';
@@ -53,7 +53,12 @@ export class SchemaTransformUtil {
53
53
  ), { type: v, root })
54
54
  )
55
55
  );
56
- cls.getText = (): string => '';
56
+ cls.getText = (): string => [
57
+ `class ${uniqueId} {`,
58
+ ...Object.entries(type.fieldTypes)
59
+ .map(([k, v]) => ` ${k}${v.nullable ? '?' : ''}: ${v.name};`),
60
+ '}'
61
+ ].join('\n');
57
62
  state.addStatements([cls], root || node);
58
63
  }
59
64
  return id;
package/src/types.ts DELETED
@@ -1,7 +0,0 @@
1
- export type Primitive = number | bigint | boolean | string | Date;
2
-
3
- export type DeepPartial<T> = {
4
- [P in keyof T]?: (T[P] extends (Primitive | undefined) ? (T[P] | undefined) :
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- (T[P] extends any[] ? (DeepPartial<T[P][number]> | null | undefined)[] : DeepPartial<T[P]>));
7
- };