diff --git a/package-lock.json b/package-lock.json index 0c15fe1..ef08e8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "contentstack-cli-tsgen", - "version": "2.3.2", + "version": "2.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "contentstack-cli-tsgen", - "version": "2.3.2", + "version": "2.3.3", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.17", @@ -5507,9 +5507,9 @@ "dev": true }, "node_modules/ejs": { - "version": "3.1.9", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz", - "integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==", + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", "dependencies": { "jake": "^10.8.5" }, @@ -6886,9 +6886,9 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -8285,9 +8285,9 @@ } }, "node_modules/ip": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz", + "integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ==", "dev": true }, "node_modules/is-accessor-descriptor": { @@ -14683,14 +14683,14 @@ } }, "node_modules/tar": { - "version": "6.1.13", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz", - "integrity": "sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^4.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" @@ -14700,9 +14700,9 @@ } }, "node_modules/tar/node_modules/minipass": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", - "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", "dev": true, "engines": { "node": ">=8" diff --git a/package.json b/package.json index b81dbdd..238593f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "contentstack-cli-tsgen", "description": "Generate TypeScript typings from a Stack.", - "version": "2.3.2", + "version": "2.3.3", "author": "Michael Davis", "bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues", "dependencies": { diff --git a/src/lib/tsgen/factory.ts b/src/lib/tsgen/factory.ts index a48d65f..8b10343 100644 --- a/src/lib/tsgen/factory.ts +++ b/src/lib/tsgen/factory.ts @@ -240,7 +240,7 @@ export default function (userOptions: TSGenOptions) { define_interface(contentType, options.systemFields), '{', ['/**', "Version", '*/'].join(' '), - [`_version: `,contentType._version,';'].join(' '), + [`_version?: `,contentType._version,';'].join(' '), visit_fields(contentType.schema), '}', ] diff --git a/tests/tsgen/boolean.test.ts b/tests/tsgen/boolean.test.ts index 4fd1731..19b6a13 100644 --- a/tests/tsgen/boolean.test.ts +++ b/tests/tsgen/boolean.test.ts @@ -25,7 +25,7 @@ describe("builtin boolean field", () => { "export interface IBoolean { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; boolean?: boolean ; }" diff --git a/tests/tsgen/defaults.test.ts b/tests/tsgen/defaults.test.ts index b79145b..2e81318 100644 --- a/tests/tsgen/defaults.test.ts +++ b/tests/tsgen/defaults.test.ts @@ -18,7 +18,7 @@ describe("default single content block", () => { "export interface IMetadataSingleContentBlock { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; }" `); @@ -44,7 +44,7 @@ describe("default single webpage", () => { "export interface IMetadataSingleWebpage { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; url: string ; }" diff --git a/tests/tsgen/global.fields.test.ts b/tests/tsgen/global.fields.test.ts index f8c340c..78981ad 100644 --- a/tests/tsgen/global.fields.test.ts +++ b/tests/tsgen/global.fields.test.ts @@ -25,7 +25,7 @@ describe("global fields", () => { "export interface ISeo { /** Version */ - _version: ; + _version?: ; keywords?: string ; description?: string ; }" @@ -37,7 +37,7 @@ describe("global fields", () => { "export interface IGlobalFields { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; seo?: ISeo ; }" diff --git a/tests/tsgen/group.test.ts b/tests/tsgen/group.test.ts index 454ca4b..d530df9 100644 --- a/tests/tsgen/group.test.ts +++ b/tests/tsgen/group.test.ts @@ -24,7 +24,7 @@ describe("group", () => { "export interface Group { /** Version */ - _version: 3 ; + _version?: 3 ; title: string ; multiple_group_max_limit?: [{ number?: number | null ; diff --git a/tests/tsgen/isodate.test.ts b/tests/tsgen/isodate.test.ts index 6e44ab6..895438d 100644 --- a/tests/tsgen/isodate.test.ts +++ b/tests/tsgen/isodate.test.ts @@ -25,7 +25,7 @@ describe("builtin isodate field", () => { "export interface Isodate { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; date?: string | null ; date_required: string ; diff --git a/tests/tsgen/jsdoc.test.ts b/tests/tsgen/jsdoc.test.ts index 56a654c..62b991c 100644 --- a/tests/tsgen/jsdoc.test.ts +++ b/tests/tsgen/jsdoc.test.ts @@ -16,7 +16,7 @@ describe("jsdoc", () => { export interface Jsdoc { /** Version */ - _version: 3 ; + _version?: 3 ; /** Name */ title: string ; /** Age */ diff --git a/tests/tsgen/modular.blocks.test.ts b/tests/tsgen/modular.blocks.test.ts index 06cc63b..f8a7ad1 100644 --- a/tests/tsgen/modular.blocks.test.ts +++ b/tests/tsgen/modular.blocks.test.ts @@ -21,7 +21,7 @@ describe("modular blocks", () => { "export interface ModularBlocks { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; url: string ; modular_blocks?: ({string_block: {single_line?: string ; diff --git a/tests/tsgen/number.test.ts b/tests/tsgen/number.test.ts index 5273063..92ced7b 100644 --- a/tests/tsgen/number.test.ts +++ b/tests/tsgen/number.test.ts @@ -22,7 +22,7 @@ describe("builtin number field", () => { "export interface Number { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; url: string ; number?: number | null ; diff --git a/tests/tsgen/options.test.ts b/tests/tsgen/options.test.ts index 7846dea..d8d56e0 100644 --- a/tests/tsgen/options.test.ts +++ b/tests/tsgen/options.test.ts @@ -15,7 +15,7 @@ describe("all options", () => { "export interface Options { /** Version */ - _version: 4 ; + _version?: 4 ; title: string ; url: string ; single_line_textbox_not_required?: string ; diff --git a/tests/tsgen/references.test.ts b/tests/tsgen/references.test.ts index 9ceef14..84f5148 100644 --- a/tests/tsgen/references.test.ts +++ b/tests/tsgen/references.test.ts @@ -26,7 +26,7 @@ describe("references", () => { "export interface IReferenceParent { /** Version */ - _version: 5 ; + _version?: 5 ; title: string ; url: string ; single_reference: (IReferenceChild)[] ; diff --git a/tests/tsgen/select.test.ts b/tests/tsgen/select.test.ts index bc79bcf..b45c1ea 100644 --- a/tests/tsgen/select.test.ts +++ b/tests/tsgen/select.test.ts @@ -21,7 +21,7 @@ describe("select (dropdown)", () => { "export interface Select { /** Version */ - _version: 5 ; + _version?: 5 ; title: string ; select_single_value?: (\\"Option 1\\" | \\"Option 2\\" | \\"Option 3\\") | null ; select_single_value_required: (\\"Test 1\\" | \\"Test 2\\" | \\"Test 3\\") ; diff --git a/tests/tsgen/string.test.ts b/tests/tsgen/string.test.ts index 1659d4c..a74d769 100644 --- a/tests/tsgen/string.test.ts +++ b/tests/tsgen/string.test.ts @@ -22,7 +22,7 @@ describe("builtin string fields", () => { "export interface BuiltinStrings { /** Version */ - _version: 4 ; + _version?: 4 ; title: string ; single_line?: string ; multi_line?: string ; diff --git a/tests/tsgen/taxonomies.test.ts b/tests/tsgen/taxonomies.test.ts index 9817e4f..6897d07 100644 --- a/tests/tsgen/taxonomies.test.ts +++ b/tests/tsgen/taxonomies.test.ts @@ -27,7 +27,7 @@ describe("builtin taxonomies field", () => { "export interface ITaxonomy { /** Version */ - _version: 2 ; + _version?: 2 ; title: string ; boolean?: boolean ; taxonomies?: ITaxonomy[] ;