@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-885031ab90ab9d313d893ad7cd0d3cedae46f14d-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: '', | ||
}; | ||
@@ -78,4 +75,3 @@ const trimNL = new common_tags_1.TemplateTag((0, common_tags_1.replaceResultTransformer)(/^[\r\n]*|[\r\n]*$/g, '')); | ||
const referencedInterface = modelNameToCamelCaseName(m.tables[f.references.resourceName].name); | ||
const nullable = f.required ? '' : '?'; | ||
return `{ __id: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
return `{ __id: ${referencedDataType}${f.required ? '' : ' | null'} } | [${referencedInterface}${f.required ? '' : '?'}]`; | ||
} | ||
@@ -82,0 +78,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-885031ab90ab9d313d893ad7cd0d3cedae46f14d-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:37:31.002Z" | ||
} | ||
} |
@@ -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: '', | ||
}; | ||
@@ -116,4 +113,3 @@ | ||
); | ||
const nullable = f.required ? '' : '?'; | ||
return `{ __id: ${referencedDataType} } | [${referencedInterface}${nullable}]`; | ||
return `{ __id: ${referencedDataType}${f.required ? '' : ' | null'} } | [${referencedInterface}${f.required ? '' : '?'}]`; | ||
} | ||
@@ -120,0 +116,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
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
197227
779