@embracesql/shared
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@embracesql/shared", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "EmbraceSQL shared types between browser and node.", | ||
@@ -17,3 +17,3 @@ "type": "module", | ||
}, | ||
"gitHead": "6f0191319a0be4f5ebddc92fe81fb0b729521e87" | ||
"gitHead": "8ea204346f819dd1a7cae4e0380f211b89eee243" | ||
} |
@@ -75,2 +75,3 @@ import { | ||
Parameters, | ||
Setting, | ||
} | ||
@@ -148,2 +149,3 @@ | ||
[ASTKind.Parameters]: ParametersNode; | ||
[ASTKind.Setting]: SettingNode; | ||
}; | ||
@@ -310,2 +312,8 @@ | ||
get settings() { | ||
return this.children.filter<SettingNode>((n): n is SettingNode => | ||
isNodeType(n, ASTKind.Setting), | ||
); | ||
} | ||
registerType(id: string | number, type: AbstractTypeNode) { | ||
@@ -405,3 +413,3 @@ const existing = this.types.get(`${id}`); | ||
public comment: string, | ||
private parser?: GeneratesTypeScript, | ||
public parser?: GeneratesTypeScript, | ||
) { | ||
@@ -423,2 +431,15 @@ super(name, kind, parent); | ||
} | ||
postgresWrapReadParameter(context: GenerationContext, expression: string) { | ||
return ( | ||
this.parser?.postgresWrapReadParameter(context, expression) ?? expression | ||
); | ||
} | ||
typescriptTypeOptions(context: GenerationContext) { | ||
return ( | ||
this.parser?.typescriptTypeOptions(context) ?? | ||
`export type Options = never;` | ||
); | ||
} | ||
} | ||
@@ -433,3 +454,3 @@ | ||
types: TypesNode, | ||
public id: string | number, | ||
id: string | number, | ||
comment: string, | ||
@@ -475,2 +496,6 @@ parser: GeneratesTypeScript, | ||
postgresWrapReadParameter(context: GenerationContext, expression: string) { | ||
return expression; | ||
} | ||
typescriptNullOrUndefined(context: GenerationContext) { | ||
@@ -918,2 +943,10 @@ console.assert(context); | ||
} | ||
postgresWrapReadParameter(context: GenerationContext, expression: string) { | ||
return this.baseType!.postgresWrapReadParameter(context, expression); | ||
} | ||
typescriptTypeOptions(context: GenerationContext) { | ||
return this.baseType!.typescriptTypeOptions(context); | ||
} | ||
} | ||
@@ -944,1 +977,14 @@ | ||
} | ||
/** | ||
* An individual setting. | ||
*/ | ||
export class SettingNode extends NamedASTNode { | ||
constructor( | ||
name: string, | ||
public setting: string, | ||
public database: DatabaseNode, | ||
) { | ||
super(name, ASTKind.Setting, database); | ||
} | ||
} |
@@ -52,2 +52,3 @@ import { DatabaseNode, VisitorMap } from "./ast"; | ||
handlers?: VisitorMap; | ||
currentSymbolName?: string; | ||
}; | ||
@@ -54,0 +55,0 @@ |
export * from "./shared"; | ||
export * from "./postgresarray"; | ||
export * from "./postgrescomposite"; | ||
export * from "./geometry"; |
@@ -53,2 +53,13 @@ import { GenerationContext, NamedASTNode } from "."; | ||
typescriptTypeDefinition(context: GenerationContext): string; | ||
/** | ||
* Generate wrapping code for the right hand side of a WHERE values predicate. | ||
*/ | ||
postgresWrapReadParameter( | ||
context: GenerationContext, | ||
expression: string, | ||
): string; | ||
/** | ||
* Generate type options used in SQL generation. | ||
*/ | ||
typescriptTypeOptions(context: GenerationContext): string; | ||
} |
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
49389
14
1721