@balena/abstract-sql-to-typescript
Advanced tools
Comparing version 2.1.5-build-fix-write-webresource-03e998b714de9497fef2eea778672b8a2952f926-1 to 2.1.5-build-otavio-fix-webresource-write-e5c6f1de2d5456c74b91cd91e67731d8c51ed6cc-1
@@ -9,3 +9,3 @@ # Change Log | ||
* Fix generated write typings when `WebResource` are included [Pagan Gazzard] | ||
* Fix WebResource write typings [Otavio Jacobi] | ||
@@ -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,6 +18,14 @@ read: ` | ||
}; | ||
${webResource} | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
}; | ||
`, | ||
write: ` | ||
${webResource} | ||
export interface WebResourceWrite extends Blob { | ||
name: string; | ||
}; | ||
`, | ||
@@ -86,3 +87,3 @@ }; | ||
case 'WebResource': | ||
return 'WebResource'; | ||
return opts.mode === 'read' ? 'WebResource' : 'WebResourceWrite'; | ||
default: | ||
@@ -89,0 +90,0 @@ throw new Error(`Unknown data type: '${f.dataType}'`); |
{ | ||
"name": "@balena/abstract-sql-to-typescript", | ||
"version": "2.1.5-build-fix-write-webresource-03e998b714de9497fef2eea778672b8a2952f926-1", | ||
"version": "2.1.5-build-otavio-fix-webresource-write-e5c6f1de2d5456c74b91cd91e67731d8c51ed6cc-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-12T13:43:48.667Z" | ||
} | ||
} |
@@ -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,6 +33,14 @@ read: ` | ||
}; | ||
${webResource} | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
}; | ||
`, | ||
write: ` | ||
${webResource} | ||
export interface WebResourceWrite extends Blob { | ||
name: string; | ||
}; | ||
`, | ||
@@ -124,3 +125,3 @@ }; | ||
case 'WebResource': | ||
return 'WebResource'; | ||
return opts.mode === 'read' ? 'WebResource' : 'WebResourceWrite'; | ||
default: | ||
@@ -127,0 +128,0 @@ throw new Error(`Unknown data type: '${f.dataType}'`); |
@@ -48,8 +48,4 @@ import type { AbstractSqlModel } from '@balena/abstract-sql-compiler'; | ||
expect(result).to.equal(source` | ||
export interface WebResource { | ||
filename: string; | ||
href: string; | ||
content_type?: string; | ||
content_disposition?: string; | ||
size?: number; | ||
export interface WebResourceWrite extends Blob { | ||
name: string; | ||
}; | ||
@@ -372,3 +368,3 @@ | ||
a_date: Date; | ||
a_file: WebResource; | ||
a_file: WebResourceWrite; | ||
parent: number; | ||
@@ -375,0 +371,0 @@ references__other: number; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
197580
794