@balena/abstract-sql-to-typescript
Advanced tools
Comparing version 2.1.5-build-fix-write-webresource-03e998b714de9497fef2eea778672b8a2952f926-1 to 2.1.5-build-nullable-deferred-ccd5e294e05ca3cfc0219d523290c793cc005ec1-1
@@ -7,5 +7,5 @@ # Change Log | ||
## 2.1.5 - 2024-03-12 | ||
## 2.1.5 - 2024-03-22 | ||
* Fix generated write typings when `WebResource` are included [Pagan Gazzard] | ||
* Fix typing for deferred nullable foreign keys [Pagan Gazzard] | ||
@@ -12,0 +12,0 @@ ## 2.1.4 - 2024-03-04 |
@@ -6,9 +6,2 @@ "use strict"; | ||
const common_tags_1 = require("common-tags"); | ||
const webResource = `export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
};`; | ||
const typeHelpers = { | ||
@@ -25,7 +18,11 @@ read: ` | ||
}; | ||
${webResource} | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
}; | ||
`, | ||
write: ` | ||
${webResource} | ||
`, | ||
write: '', | ||
}; | ||
@@ -79,3 +76,3 @@ const trimNL = new common_tags_1.TemplateTag((0, common_tags_1.replaceResultTransformer)(/^[\r\n]*|[\r\n]*$/g, '')); | ||
const nullable = f.required ? '' : '?'; | ||
return `{ __id: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
return `{ __id${nullable}: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
} | ||
@@ -82,0 +79,0 @@ case 'File': |
{ | ||
"name": "@balena/abstract-sql-to-typescript", | ||
"version": "2.1.5-build-fix-write-webresource-03e998b714de9497fef2eea778672b8a2952f926-1", | ||
"version": "2.1.5-build-nullable-deferred-ccd5e294e05ca3cfc0219d523290c793cc005ec1-1", | ||
"description": "A translator for abstract sql into typescript types.", | ||
@@ -48,4 +48,4 @@ "main": "out/index.js", | ||
"versionist": { | ||
"publishedAt": "2024-03-12T11:36:03.499Z" | ||
"publishedAt": "2024-03-22T16:25:06.098Z" | ||
} | ||
} |
@@ -21,9 +21,2 @@ import type { | ||
const webResource = `export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
};`; | ||
const typeHelpers = { | ||
@@ -40,7 +33,11 @@ read: ` | ||
}; | ||
${webResource} | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
}; | ||
`, | ||
write: ` | ||
${webResource} | ||
`, | ||
write: '', | ||
}; | ||
@@ -117,3 +114,3 @@ | ||
const nullable = f.required ? '' : '?'; | ||
return `{ __id: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
return `{ __id${nullable}: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
} | ||
@@ -120,0 +117,0 @@ case 'File': |
@@ -47,13 +47,3 @@ import type { AbstractSqlModel } from '@balena/abstract-sql-compiler'; | ||
} else { | ||
expect(result).to.equal(source` | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
}; | ||
${expectation} | ||
`); | ||
expect(result).to.equal(expectation); | ||
} | ||
@@ -60,0 +50,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
197239
781