From 011fa891880298dc0a312b38ca947f0be0ea2bf4 Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 8 Jan 2024 13:17:40 +0530 Subject: [PATCH 1/4] Revert: handling for ref multiple flag --- src/lib/stack/schema.ts | 9 ++------- src/lib/tsgen/factory.ts | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/lib/stack/schema.ts b/src/lib/stack/schema.ts index 087a4ba..5f87a8a 100644 --- a/src/lib/stack/schema.ts +++ b/src/lib/stack/schema.ts @@ -52,8 +52,7 @@ export type Field = GlobalField & ReferenceField & GroupField & EnumField & - BlockField & - { field_metadata: FieldMetaData }; + BlockField export type Schema = Array; export type ContentType = { @@ -63,8 +62,4 @@ export type ContentType = { reference_to?: string; data_type?: string; schema_type?: string; -} & Identifier; - -export type FieldMetaData = { - ref_multiple?: boolean; -} +} & Identifier; \ No newline at end of file diff --git a/src/lib/tsgen/factory.ts b/src/lib/tsgen/factory.ts index cf5355f..12f7c02 100644 --- a/src/lib/tsgen/factory.ts +++ b/src/lib/tsgen/factory.ts @@ -313,7 +313,7 @@ export default function (userOptions: TSGenOptions) { references.push(name_type(field.reference_to)) } - return ['(', references.join(' | '), ')', field.field_metadata?.ref_multiple ? '[]' : ''].join('') + return ["(", references.join(" | "), ")", "[]"].join(""); } return function (contentType: ContentstackTypes.ContentType): TSGenResult|any { From 1e1033c317f4b092c6448b06099b0f0ddffa7a82 Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 8 Jan 2024 13:22:59 +0530 Subject: [PATCH 2/4] test: Unit test case update --- tests/tsgen/references.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tsgen/references.test.ts b/tests/tsgen/references.test.ts index 2ef381e..a5b3b42 100644 --- a/tests/tsgen/references.test.ts +++ b/tests/tsgen/references.test.ts @@ -29,7 +29,7 @@ describe("references", () => { version: 5 ; title: string ; url: string ; - single_reference: (IReferenceChild) ; + single_reference: (IReferenceChild)[] ; multiple_reference?: (IReferenceChild | IBoolean | IBuiltinExample)[] ; }" `); From 2f27111766104e5ba5d6235cbc19d96a612bc7ad Mon Sep 17 00:00:00 2001 From: Antony Date: Mon, 8 Jan 2024 15:23:53 +0530 Subject: [PATCH 3/4] Version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4fb1c0d..b59ddbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "contentstack-cli-tsgen", - "version": "2.2.1", + "version": "2.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "contentstack-cli-tsgen", - "version": "2.2.1", + "version": "2.2.2", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.13", diff --git a/package.json b/package.json index 1b65b35..fdad0c2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "contentstack-cli-tsgen", "description": "Generate TypeScript typings from a Stack.", - "version": "2.2.1", + "version": "2.2.2", "author": "Michael Davis", "bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues", "dependencies": { From 1ef0a03c7acdeae6e25694cb7b3bb6747b7b2f28 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Tue, 9 Jan 2024 19:29:10 +0530 Subject: [PATCH 4/4] update license & audit fix --- LICENSE | 2 +- package-lock.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE b/LICENSE index 2ecf839..0c5a6fd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Contentstack Solutions +Copyright (c) 2024 Contentstack Solutions Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package-lock.json b/package-lock.json index b59ddbf..0288283 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6442,9 +6442,9 @@ "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual",