@aphro/schema-api
Advanced tools
Comparing version 0.1.1 to 0.1.2
# @aphro/schema-api | ||
## 0.1.2 | ||
### Patch Changes | ||
- allow ephemeral nodes. allow type expressions for fields. | ||
## 0.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -6,4 +6,4 @@ export declare type ValidationError = { | ||
}; | ||
export declare type StorageEngine = 'sqlite' | 'postgres' | 'memory'; | ||
export declare type StorageType = 'sql' | 'memory'; | ||
export declare type StorageEngine = 'sqlite' | 'postgres' | 'memory' | 'ephemeral'; | ||
export declare type StorageType = 'sql' | 'memory' | 'ephemeral'; | ||
export declare type SchemaFileAst = { | ||
@@ -13,3 +13,3 @@ preamble: { | ||
db: string; | ||
[key: string]: string; | ||
[key: string]: Object | string; | ||
}; | ||
@@ -30,3 +30,4 @@ entities: (NodeAst | EdgeAst | NodeTraitAst)[]; | ||
index?: Index; | ||
storage?: Storage; | ||
storage?: StorageConfig; | ||
replication?: ReplicationConfig; | ||
type?: TypeConfig; | ||
@@ -40,3 +41,4 @@ module?: ModuleConfig; | ||
index: Index; | ||
storage: Storage; | ||
storage: StorageConfig; | ||
replication: ReplicationConfig; | ||
traits: Traits; | ||
@@ -49,3 +51,3 @@ } | ||
fields: { | ||
[key: UnqalifiedFieldReference]: Field; | ||
[key: UnqalifiedFieldReference]: FieldDeclaration; | ||
}; | ||
@@ -58,3 +60,3 @@ extensions: NodeExtensions; | ||
readonly primaryKey: string; | ||
readonly storage: StorageConfig; | ||
readonly storage: RemoveNameField<StorageConfig>; | ||
readonly outboundEdges: { | ||
@@ -79,3 +81,3 @@ [key: string]: EdgeSpec; | ||
readonly type: 'junction'; | ||
readonly storage: StorageConfig; | ||
readonly storage: RemoveNameField<StorageConfig>; | ||
readonly sourceField: string; | ||
@@ -98,2 +100,3 @@ readonly destField: string; | ||
export declare type StorageConfig = { | ||
name: 'storage'; | ||
type: StorageType; | ||
@@ -105,2 +108,6 @@ db: string; | ||
}; | ||
export declare type ReplicationConfig = { | ||
name: 'replication'; | ||
replicated: boolean; | ||
}; | ||
export declare type SchemaEdge = { | ||
@@ -112,3 +119,3 @@ type: 'standaloneEdge'; | ||
fields: { | ||
[key: UnqalifiedFieldReference]: Field; | ||
[key: UnqalifiedFieldReference]: FieldDeclaration; | ||
}; | ||
@@ -129,4 +136,10 @@ extensions: EdgeExtensions; | ||
export declare type NodeExtension = SchemaNode['extensions'][keyof SchemaNode['extensions']]; | ||
export declare type FieldDeclaration = { | ||
name: string; | ||
type: TypeAtom[]; | ||
decorators?: string[]; | ||
}; | ||
export declare type NodeAst = { | ||
type: 'node'; | ||
as: 'Node' | 'UnmanagedNode'; | ||
} & NodeAstCommon; | ||
@@ -138,3 +151,3 @@ export declare type NodeTraitAst = { | ||
name: string; | ||
fields: Field[]; | ||
fields: FieldDeclaration[]; | ||
extensions: NodeAstExtension[]; | ||
@@ -146,3 +159,4 @@ }; | ||
constrain?: Constrain; | ||
storage?: Storage; | ||
storage?: StorageConfig; | ||
replication?: ReplicationConfig; | ||
} | ||
@@ -152,4 +166,5 @@ export interface EdgeAstExtensions { | ||
invert: Invert; | ||
storage: Storage; | ||
storage: StorageConfig; | ||
constraint: Constrain; | ||
replication: ReplicationConfig; | ||
} | ||
@@ -163,3 +178,3 @@ export declare type EdgeAstExtension = EdgeAstExtensions[keyof EdgeAstExtensions]; | ||
dest: NodeReferenceOrQualifiedColumn; | ||
fields: Field[]; | ||
fields: FieldDeclaration[]; | ||
extensions: EdgeExtension[]; | ||
@@ -192,3 +207,2 @@ }; | ||
declare type FieldBase = { | ||
decorators?: string[]; | ||
description?: string; | ||
@@ -261,20 +275,7 @@ nullable?: boolean; | ||
}; | ||
export declare type TypeAtom = { | ||
type: 'type'; | ||
name: RemoveNameField<Field> | string; | ||
} | { | ||
export declare type TypeAtom = RemoveNameField<Field> | string | { | ||
type: 'intersection'; | ||
} | { | ||
type: 'union'; | ||
} | { | ||
type: 'primitive'; | ||
subtype: PrimitiveSubtype; | ||
}; | ||
declare type Storage = { | ||
name: 'storage'; | ||
type?: StorageType; | ||
engine: StorageEngine; | ||
db?: string; | ||
table?: string; | ||
}; | ||
declare type Unique = { | ||
@@ -281,0 +282,0 @@ name: string; |
{ | ||
"name": "@aphro/schema-api", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -14,4 +14,6 @@ export type ValidationError = { | ||
export type StorageEngine = 'sqlite' | 'postgres' | 'memory'; | ||
export type StorageType = 'sql' | 'memory'; | ||
// "memory" nodes get stored into an in-memory DB and never cleared until they are deleted. | ||
// "ephemeral" nodes are in-memory only as well but not stored anywhere. | ||
export type StorageEngine = 'sqlite' | 'postgres' | 'memory' | 'ephemeral'; | ||
export type StorageType = 'sql' | 'memory' | 'ephemeral'; | ||
@@ -22,3 +24,3 @@ export type SchemaFileAst = { | ||
db: string; | ||
[key: string]: string; // other engine-specific values | ||
[key: string]: Object | string; // other engine-specific values | ||
}; | ||
@@ -41,3 +43,4 @@ entities: (NodeAst | EdgeAst | NodeTraitAst)[]; | ||
index?: Index; | ||
storage?: Storage; | ||
storage?: StorageConfig; | ||
replication?: ReplicationConfig; | ||
type?: TypeConfig; | ||
@@ -52,3 +55,4 @@ module?: ModuleConfig; | ||
index: Index; | ||
storage: Storage; | ||
storage: StorageConfig; | ||
replication: ReplicationConfig; | ||
traits: Traits; | ||
@@ -62,3 +66,3 @@ } | ||
fields: { | ||
[key: UnqalifiedFieldReference]: Field; | ||
[key: UnqalifiedFieldReference]: FieldDeclaration; | ||
}; | ||
@@ -72,3 +76,3 @@ extensions: NodeExtensions; | ||
readonly primaryKey: string; | ||
readonly storage: StorageConfig; | ||
readonly storage: RemoveNameField<StorageConfig>; | ||
readonly outboundEdges: { [key: string]: EdgeSpec }; | ||
@@ -97,3 +101,3 @@ }; | ||
readonly type: 'junction'; | ||
readonly storage: StorageConfig; | ||
readonly storage: RemoveNameField<StorageConfig>; | ||
readonly sourceField: string; | ||
@@ -121,2 +125,3 @@ readonly destField: string; | ||
export type StorageConfig = { | ||
name: 'storage'; | ||
type: StorageType; | ||
@@ -129,2 +134,8 @@ db: string; | ||
export type ReplicationConfig = { | ||
name: 'replication'; | ||
replicated: boolean; | ||
// other replication settings | ||
}; | ||
export type SchemaEdge = { | ||
@@ -136,3 +147,3 @@ type: 'standaloneEdge'; | ||
fields: { | ||
[key: UnqalifiedFieldReference]: Field; | ||
[key: UnqalifiedFieldReference]: FieldDeclaration; | ||
}; | ||
@@ -158,5 +169,11 @@ extensions: EdgeExtensions; | ||
export type NodeExtension = SchemaNode['extensions'][keyof SchemaNode['extensions']]; | ||
export type FieldDeclaration = { | ||
name: string; | ||
type: TypeAtom[]; | ||
decorators?: string[]; | ||
}; | ||
export type NodeAst = { | ||
type: 'node'; | ||
as: 'Node' | 'UnmanagedNode' | ||
} & NodeAstCommon; | ||
@@ -170,3 +187,3 @@ | ||
name: string; | ||
fields: Field[]; | ||
fields: FieldDeclaration[]; | ||
extensions: NodeAstExtension[]; | ||
@@ -179,3 +196,4 @@ }; | ||
constrain?: Constrain; | ||
storage?: Storage; | ||
storage?: StorageConfig; | ||
replication?: ReplicationConfig; | ||
} | ||
@@ -185,4 +203,5 @@ export interface EdgeAstExtensions { | ||
invert: Invert; | ||
storage: Storage; | ||
storage: StorageConfig; | ||
constraint: Constrain; | ||
replication: ReplicationConfig; | ||
} | ||
@@ -198,3 +217,3 @@ | ||
dest: NodeReferenceOrQualifiedColumn; | ||
fields: Field[]; | ||
fields: FieldDeclaration[]; | ||
extensions: EdgeExtension[]; | ||
@@ -234,3 +253,2 @@ }; | ||
type FieldBase = { | ||
decorators?: string[]; | ||
description?: string; | ||
@@ -332,20 +350,8 @@ nullable?: boolean; | ||
export type TypeAtom = | ||
| RemoveNameField<Field> | string | ||
| { | ||
type: 'type'; | ||
name: RemoveNameField<Field> | string; | ||
} | ||
| { | ||
type: 'intersection'; | ||
} | ||
| { type: 'union' } | ||
| { type: 'primitive'; subtype: PrimitiveSubtype }; | ||
| { type: 'union' }; | ||
type Storage = { | ||
name: 'storage'; | ||
type?: StorageType; | ||
engine: StorageEngine; | ||
db?: string; | ||
table?: string; | ||
}; | ||
type Unique = { | ||
@@ -352,0 +358,0 @@ name: string; |
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
28632
584