diff --git a/.talismanrc b/.talismanrc index 3762020..58042d7 100644 --- a/.talismanrc +++ b/.talismanrc @@ -5,5 +5,5 @@ fileignoreconfig: - filename: lib/commands/tsgen.js checksum: 02bab20fef5508565dbf38b5c12192c48ec27249b89d48c70303abaae17984ce - filename: package-lock.json - checksum: 44c6d643ffd404bad85ab55aedd739f1c9a09fa015745882968b572617637de4 + checksum: e7ea94799c4afab6e55935c79ac40d3cac38e2ce6e9882dbd4c2e5a3c551e087 version: "1.0" diff --git a/MIGRATION.md b/MIGRATION.md index da8f57f..aabc07e 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,7 +1,61 @@ +## Migrating from v3 to v4 + +This changelog documents a breaking change to the `ISystemFields` interface, specifically related to the `publish_details` field. + +## What Changed + +The `publish_details` field is no longer an array of objects. It is now represented as a single `IPublishDetails` object. + +This update aligns the generated types with the actual [Contentstack API](https://www.contentstack.com/docs/developers/apis/content-delivery-api) response. + +## Before + +```typescript +export interface ISystemFields { + uid?: string; + created_at?: string; + updated_at?: string; + created_by?: string; + updated_by?: string; + _content_type_uid?: string; + tags?: string[]; + ACL?: any[]; + _version?: number; + _in_progress?: boolean; + locale?: string; + publish_details?: IPublishDetails[]; // Incorrect: Array of IPublishDetails + title?: string; +} +``` + +## After + +```typescript +export interface ISystemFields { + uid?: string; + created_at?: string; + updated_at?: string; + created_by?: string; + updated_by?: string; + _content_type_uid?: string; + tags?: string[]; + ACL?: any[]; + _version?: number; + _in_progress?: boolean; + locale?: string; + publish_details?: IPublishDetails; // Corrected: Single IPublishDetails object + title?: string; +} +``` + +--- + ## Migrating from v2 to v3 + This document outlines the necessary changes to separate nested modular blocks into distinct interfaces. This update will affect how modular blocks are structured and used throughout the codebase. -## Before +## Before + ```typescript export interface Test { /** Version */ @@ -27,8 +81,8 @@ export interface Test { } ``` - ## After + ```typescript export interface Test { /** Version */ @@ -39,7 +93,6 @@ export interface Test { modular_blocks?: ModularBlocks[]; } - export interface ModularBlocks { /** Multi Line Textbox */ multi_line?: string; @@ -53,4 +106,4 @@ export interface ModularBlocks1 { /** Multi Line Textbox */ multi_line?: string; } -``` \ No newline at end of file +``` diff --git a/package-lock.json b/package-lock.json index cdded65..ec75f32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "contentstack-cli-tsgen", - "version": "3.5.1", + "version": "4.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "contentstack-cli-tsgen", - "version": "3.5.1", + "version": "4.0.0", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.5.0", "@contentstack/cli-utilities": "^1.11.0", - "@contentstack/types-generator": "^2.3.3", - "dotenv": "^16.5.0" + "@contentstack/types-generator": "^3.0.0", + "dotenv": "^16.4.7" }, "devDependencies": { "@oclif/plugin-help": "^6.2.27", @@ -1588,15 +1588,15 @@ } }, "node_modules/@contentstack/types-generator": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@contentstack/types-generator/-/types-generator-2.3.3.tgz", - "integrity": "sha512-cK7szBWJIZ3EWhtfgnPY2QraO8cKhU8v16GXPWOS007tsD03bqLX+91Q2v/hKEyRlvZ/0LhaVhDET3MPzNNzVw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@contentstack/types-generator/-/types-generator-3.0.0.tgz", + "integrity": "sha512-gINeFlpZ/bAZDRdfRBi8qX97EkYIYmEo7fZUZeO+Dvq8JhWRSz3p1YeFA6fxjyBzbXkRvQ7zWqyhZNM6wvlwKA==", "license": "MIT", "dependencies": { - "@contentstack/delivery-sdk": "^4.6.1", + "@contentstack/delivery-sdk": "^4.7.0", "@gql2ts/from-schema": "^2.0.0-4", "async": "^3.2.6", - "axios": "^1.8.4", + "axios": "^1.9.0", "lodash": "^4.17.21", "prettier": "^3.5.3" } diff --git a/package.json b/package.json index b9789a7..b3a3cdd 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "name": "contentstack-cli-tsgen", "description": "Generate TypeScript typings from a Stack.", - "version": "3.5.1", + "version": "4.0.0", "author": "Michael Davis", "bugs": "https://github.com/Contentstack-Solutions/contentstack-cli-tsgen/issues", "dependencies": { "@contentstack/cli-command": "^1.5.0", "@contentstack/cli-utilities": "^1.11.0", - "@contentstack/types-generator": "^2.3.3", - "dotenv": "^16.5.0" + "@contentstack/types-generator": "^3.0.0", + "dotenv": "^16.4.7" }, "devDependencies": { "@oclif/plugin-help": "^6.2.27",