diff --git a/package-lock.json b/package-lock.json index 4841de9c..dde4d4bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,12 +18,12 @@ "@commander-js/extra-typings": "^12.1.0", "@croct/cache": "^0.5.1", "@croct/content": "^1.1.0", - "@croct/content-model": "^0.21.1", + "@croct/content-model": "^0.21.4", "@croct/json": "^2.1.0", "@croct/json5-parser": "^0.2.1", "@croct/logging": "^0.2.3", "@croct/md-lite": "^0.3.1", - "@croct/sdk": "^0.18.2", + "@croct/sdk": "^0.20.0", "@croct/time": "^0.10.2", "@jsep-plugin/object": "^1.2.2", "@jsep-plugin/regex": "^1.0.4", @@ -790,12 +790,13 @@ } }, "node_modules/@croct/content-model": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@croct/content-model/-/content-model-0.21.1.tgz", - "integrity": "sha512-VDVicsvXqQoezveZSw0iysMzm8EN4ZZjyoZLtCM0Xsq4p6q34lYrtob/wvc0Tst3l0N6wIgSCq9f7L39mEzqxQ==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/@croct/content-model/-/content-model-0.21.4.tgz", + "integrity": "sha512-E75GzkHhi2CIkngC8Fwl6hFZ/cU0bxPPaqqez7JJfuP22wo8RUIrDwYCHIt9H0zZOqWqPPTaF7yPMezh+1oByA==", + "license": "MIT", "dependencies": { - "@croct/json": "^2.0", - "@croct/json-pointer": "^0.2.1", + "@croct/json": "^2.1", + "@croct/json-pointer": "^0.3.0", "@croct/logging": "^0.2", "json-schema-typed": "^8.0", "object-hash": "^3.0.0" @@ -836,9 +837,10 @@ "integrity": "sha512-UrWfjNQVlBxN+OVcFwHmkjARMW55MBN04E9KfGac8ac8z1QnFVuiOOFtMWXCk3UwsyRqhsNaFoYLZC+xxqsVjQ==" }, "node_modules/@croct/json-pointer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@croct/json-pointer/-/json-pointer-0.2.2.tgz", - "integrity": "sha512-alLaBP9fpEzNH30kdWglZmELy3GDlFeplK2pOK59U5OnBNYf8zC+4+HATdhnAFQYubNIIypnYRSnUnF8J0KI8g==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@croct/json-pointer/-/json-pointer-0.3.0.tgz", + "integrity": "sha512-uitWPqyZk9wiun8EwOnTms8MxqylYehi0xlnAh9cVhJdcYDGNEc6tOOzw9OGC0NQg6QbWTHDiRoDeivK2nS7Zw==", + "license": "MIT", "dependencies": { "@croct/json": "^2.1.0" } @@ -866,11 +868,12 @@ "integrity": "sha512-R0Fg9R/ZzRP/GNGDmtix4jT2BVTACO8wtKVPjT+vvEYu3sOmulSefb+6dyqMywoHregs3VkVtqenlzWc/cgofg==" }, "node_modules/@croct/sdk": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@croct/sdk/-/sdk-0.18.2.tgz", - "integrity": "sha512-+Dnr8bIxQF3ntzMm7Od/69fQJEu/czV6kz1gcmtHF3QsBb3RQUpjVHVJfmLUaZMPqysnpIyDVtUwJtTNEudTCg==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@croct/sdk/-/sdk-0.20.0.tgz", + "integrity": "sha512-wtRJl1JpXpS9EKL8sEWYAl1PghWxp5kug04fqsc4a8eQi0o2537sCPLpwxjpL7eg1HJ/Qr8zyf01dfYt7168sg==", "license": "MIT", "dependencies": { + "@croct/content-model": "^0.21.1", "@croct/json": "^2.0.1", "tslib": "^2.5.0" }, diff --git a/package.json b/package.json index ccccc523..998cce3b 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "@babel/types": "^7.28.5", "@croct/cache": "^0.5.1", "@croct/content": "^1.1.0", - "@croct/content-model": "^0.21.1", + "@croct/content-model": "^0.21.4", "@croct/json": "^2.1.0", "@croct/json5-parser": "^0.2.1", "@croct/logging": "^0.2.3", "@croct/md-lite": "^0.3.1", - "@croct/sdk": "^0.18.2", + "@croct/sdk": "^0.20.0", "@jsep-plugin/object": "^1.2.2", "@jsep-plugin/regex": "^1.0.4", "@jsep-plugin/spread": "^1.0.3", diff --git a/src/application/project/code/generation/slot/plugReactExampleGenerator.ts b/src/application/project/code/generation/slot/plugReactExampleGenerator.ts index af84186c..aaeb6955 100644 --- a/src/application/project/code/generation/slot/plugReactExampleGenerator.ts +++ b/src/application/project/code/generation/slot/plugReactExampleGenerator.ts @@ -23,8 +23,9 @@ export class PlugReactExampleGenerator extends ReactExampleGenerator { protected writeSlotFetch(writer: CodeWriter, definition: SlotDefinition): void { const variable = this.options.contentVariable; + const variableDeclaration = variable !== 'content' ? `content: ${variable}` : variable; - writer.write(`const ${variable} = useContent('${definition.id}@${definition.version}');`) + writer.write(`const ${variableDeclaration} = useContent('${definition.id}@${definition.version}');`) .newLine(); } diff --git a/src/infrastructure/application/validation/actions/createResourceOptionsValidator.ts b/src/infrastructure/application/validation/actions/createResourceOptionsValidator.ts index 0c966fdd..784d3df7 100644 --- a/src/infrastructure/application/validation/actions/createResourceOptionsValidator.ts +++ b/src/infrastructure/application/validation/actions/createResourceOptionsValidator.ts @@ -216,10 +216,14 @@ const structureContentSchema = z.strictObject({ const listContentSchema = z.strictObject({ type: z.literal('list'), - items: z.array(z.lazy((): ZodType => contentSchema)), + items: z.array(z.lazy( + (): ZodType => z.intersection(contentSchema, z.object({ + label: z.string().optional(), + })), + )), }) satisfies ZodType>; -const contentSchema: ZodType = z.discriminatedUnion('type', [ +const contentSchema = z.discriminatedUnion('type', [ textContentSchema, numberContentSchema, booleanContentSchema,