@embracesql/shared
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "@embracesql/shared", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "EmbraceSQL shared types between browser and node.", | ||
@@ -17,3 +17,3 @@ "type": "module", | ||
}, | ||
"gitHead": "92c10ccba1bac0a6e94cd89576f0c73d16cf5bcf" | ||
"gitHead": "149e4adeacf43a8b41c906a492e5ddeb4ed0114b" | ||
} |
@@ -12,2 +12,7 @@ import { | ||
/** | ||
* Common name for primary key operations. | ||
*/ | ||
export const BY_PRIMARY_KEY = "ByPrimaryKey"; | ||
/** | ||
* Common name for return results. | ||
@@ -51,2 +56,3 @@ * | ||
CreateOperation, | ||
AllOperation, | ||
ReadOperation, | ||
@@ -123,2 +129,3 @@ UpdateOperation, | ||
[ASTKind.CreateOperation]: CreateOperationNode; | ||
[ASTKind.AllOperation]: AllOperationNode; | ||
[ASTKind.ReadOperation]: ReadOperationNode; | ||
@@ -518,2 +525,3 @@ [ASTKind.UpdateOperation]: UpdateOperationNode; | ||
new CreateOperationNode(this); | ||
new AllOperationNode(this); | ||
} | ||
@@ -696,2 +704,11 @@ | ||
/** | ||
* Operation to read all the rows in a table. Each table gets one. | ||
*/ | ||
export class AllOperationNode extends OperationNode { | ||
constructor(public table: TableNode) { | ||
super("all", ASTKind.AllOperation, table); | ||
} | ||
} | ||
/** | ||
* Shared base class for index operations. | ||
@@ -916,3 +933,3 @@ * | ||
console.assert(context); | ||
const recordAttributes = this.children | ||
const attributes = this.children | ||
.filter<AttributeNode>( | ||
@@ -930,3 +947,3 @@ (c): c is AttributeNode => c.kind === ASTKind.Attribute, | ||
}); | ||
return ` { ${recordAttributes.join("\n")} } `; | ||
return ` { ${attributes.join("\n")} } `; | ||
} | ||
@@ -969,3 +986,3 @@ | ||
public index: number, | ||
public type: TypeNode, | ||
public type: AbstractTypeNode, | ||
public required: boolean, | ||
@@ -972,0 +989,0 @@ public nullable: boolean, |
@@ -8,2 +8,4 @@ import { DatabaseNode, VisitorMap } from "./ast"; | ||
export let NEVER: never; | ||
/** | ||
@@ -90,5 +92,5 @@ * Message format for EmbraceSQL. | ||
*/ | ||
export function nullIsUndefined<T>(value: T | null) { | ||
export function nullIsUndefined<T>(value: unknown) { | ||
if (value === null) return undefined; | ||
return value; | ||
return value as T; | ||
} | ||
@@ -113,2 +115,14 @@ | ||
export type NullableRecursive<T> = T extends object | ||
? { | ||
[Member in keyof T]: NullableRecursive<T[Member]> | null; | ||
} | ||
: T | null; | ||
export type PartialRecursive<T> = T extends object | ||
? { | ||
[Member in keyof T]: PartialRecursive<T[Member]> | undefined; | ||
} | ||
: T | undefined; | ||
export * from "./uuid"; | ||
@@ -145,1 +159,6 @@ | ||
Omit<T, CommonKeys<T, U>>; | ||
/** | ||
* Result sets will be a mixture of one or multiple rows. | ||
*/ | ||
export type OneOrMany<T> = T | T[]; |
@@ -13,5 +13,6 @@ { | ||
"jsx": "react-jsxdev", | ||
"sourceMap": true | ||
"sourceMap": true, | ||
"skipLibCheck": true | ||
}, | ||
"exclude": ["node_modules", "dist"] | ||
} |
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
41095
1405