Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions packages/content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ Get an Item from the content store.

`getItem(path: string, config?: CrafterConfig)`

| Parameters | |
| ------------- |:--------------:|
| path | The item’s path in the content store |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| ------------- |:--------------------------------------------------------------------------------------:|
| path | The item’s path in the content store |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

#### Returns

[Item](../models/README.md#Item) - from the content store
[Item](../models/src/item.ts) - from the content store

#### Examples

Expand Down Expand Up @@ -194,14 +194,14 @@ Get the list of Items directly under a folder in the content store.

`getChildren(path: string, config?: CrafterConfig)`

| Parameters | |
| ------------- |:--------------:|
| path | The folder’s path |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| ------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

#### Returns

[Item](../models/README.md#Item)[] - List of Items from the content store
[Item](../models/src/item.ts)[] - List of Items from the content store

#### Examples

Expand All @@ -226,15 +226,15 @@ Get the complete Item hierarchy under the specified folder in the content store.

`getTree(path: string, depth: number, config: CrafterConfig)`

| Parameters | |
| ------------- |:--------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| ------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

Comment on lines +229 to 234

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Signature/table mismatch for getTree: make depth and config optional or fix table

The table marks depth and config as optional, but the signature above shows both required. Align these.

Proposed fix:

-`getTree(path: string, depth: number, config: CrafterConfig)` 
+`getTree(path: string, depth?: number, config?: CrafterConfig)`

And keep the table as-is (with optional), plus the config phrasing nit:

-| config        | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
+| config        | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |

If the API truly requires both, then instead change the table to remove “Optional” and the default note.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Parameters | |
| ------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
`getTree(path: string, depth?: number, config?: CrafterConfig)`
| Parameters | |
| ------------- |:-----------------------------------------------------------------------------------------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| config | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |
🤖 Prompt for AI Agents
In packages/content/README.md around lines 229-234, the README table marks
getTree's depth and config parameters as optional but the function signature
above shows them required; either make the function signature match the table by
changing the getTree signature to accept optional parameters (e.g., depth?:
number with default 1 and config?: CrafterConfig with the existing default) or
update the table to show them as required (remove "Optional" and default note).
If choosing to make parameters optional, also update the config cell wording to
"Crafter configuration. Optional. Default value: see
../models/src/CrafterConfig.ts" so the documentation and signature are aligned.

#### Returns

[Item](../models/README.md#Item) - from the content store
[Item](../models/src/item.ts) - from the content store

#### Examples

Expand All @@ -259,33 +259,33 @@ Get the complete Item hierarchy under the specified folder in the content store.
### Get Navigation Tree
Returns the navigation tree with the specified depth for the specified store URL.

`getNavTree(path: string, depth: number, currentPageUrl: string, config: CrafterConfig)`
`getNavTree(path: string, depth?: number, currentPageUrl?: string, config?: CrafterConfig)`

| Parameters | |
| -------------- |:--------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| currentPageUrl | The URL of the current page. Optional. Default is `''` |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| -------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| depth | Amount of levels to include. Optional. Default is `1` |
| currentPageUrl | The URL of the current page. Optional. Default is `''` |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

#### Returns

[NavigationItem](../models/README.md#NavigationItem) - from the content store
[NavigationItem](../models/src/NavigationItem.ts) - from the content store

#### Examples

- Get the navigation tree of the root folder from the site (depth = 3):

```typescript
import { getTree } from '@craftercms/content';
import { getNavTree } from '@craftercms/content';

// Example 1: Config supplied inline
getTree('/site/website', 3, { site: 'editorial' }).subscribe((tree) => {
getNavTree('/site/website', 3, '', { site: 'editorial' }).subscribe((tree) => {
console.log(tree);
});

// Example 2: Services pre-configured (see "Usage" section above), config param omitted.
getTree('/site/website', 3).subscribe((tree) => {
// Example 2: Services pre-configured (see "Usage" section above); currentPageUrl omitted (defaults to '').
getNavTree('/site/website', 3).subscribe((tree) => {
console.log(tree);
});
```
Expand All @@ -295,15 +295,15 @@ Returns the navigation items that form the breadcrumb for the specified store UR

`getNavBreadcrumb(path: string, root: string, config: CrafterConfig)`

| Parameters | |
| -------------- |:--------------:|
| path | The folder’s path |
| root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| -------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

Comment on lines +298 to 303

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Signature/table mismatch for getNavBreadcrumb + minor grammar

Root and config are shown as optional in the table, but the signature above shows them required. Also, tighten the root description.

Apply:

-`getNavBreadcrumb(path: string, root: string, config: CrafterConfig)`
+`getNavBreadcrumb(path: string, root?: string, config?: CrafterConfig)`

And refine table wording:

-| root           |  the root URL, basically the starting point of the breadcrumb. Optional. Default is `''`  |
+| root           | The root URL; starting point of the breadcrumb. Optional. Default is `''`.                |
-| config        | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
+| config        | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Parameters | |
| -------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| root | the root URL, basically the starting point of the breadcrumb. Optional. Default is `''` |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
`getNavBreadcrumb(path: string, root?: string, config?: CrafterConfig)`
| Parameters | |
| -------------- |:-----------------------------------------------------------------------------------------:|
| path | The folder’s path |
| root | The root URL; starting point of the breadcrumb. Optional. Default is `''`. |
| config | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |
🧰 Tools
🪛 LanguageTool

[grammar] ~298-~298: There might be a mistake here.
Context: ... | | -------------- |:---------------------...

(QB_NEW_EN)


[grammar] ~299-~299: There might be a mistake here.
Context: ...--------------------------------------:| | path | ...

(QB_NEW_EN)


[grammar] ~300-~300: There might be a mistake here.
Context: ...th | | root | the root URL, basica...

(QB_NEW_EN)

#### Returns

[NavigationItem](../models/README.md#NavigationItem)[] - List of NavigationItem from the content store
[NavigationItem](../models/src/NavigationItem.ts)[] - List of NavigationItem from the content store

#### Examples

Expand All @@ -313,7 +313,7 @@ Returns the navigation items that form the breadcrumb for the specified store UR
import { getNavBreadcrumb } from '@craftercms/content';

// Example 1: Config supplied inline
getNavBreadcrumb('/site/website').subscribe((navBreadcrumb) => {
getNavBreadcrumb('/site/website', '/', { site: 'editorial' }).subscribe((navBreadcrumb) => {
console.log(navBreadcrumb);
});

Expand All @@ -328,11 +328,11 @@ Transforms a URL, based on the current site’s configuration.

- `transform(transformerName: string, path: string, config: CrafterConfig)`

| Parameters | |
| --------------- |:--------------:|
| transformerName | Name of the transformer to apply |
| path | URL that will be transformed |
| config | Crafter configuration. Optional. Default value in [here](../models/README.md#CrafterConfig). |
| Parameters | |
| --------------- |:-----------------------------------------------------------------------------------------:|
| transformerName | Name of the transformer to apply |
| path | URL that will be transformed |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |

Comment on lines +331 to 336

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Signature/table mismatch for transform config optionality

Table marks config optional; signature above shows it required. Align these and fix config phrasing.

- - `transform(transformerName: string, path: string, config: CrafterConfig)` 
+ - `transform(transformerName: string, path: string, config?: CrafterConfig)` 

And:

-| config        | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
+| config        | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Parameters | |
| --------------- |:-----------------------------------------------------------------------------------------:|
| transformerName | Name of the transformer to apply |
| path | URL that will be transformed |
| config | Crafter configuration. Optional. Default value in [here](../models/src/CrafterConfig.ts). |
`transform(transformerName: string, path: string, config?: CrafterConfig)`
| Parameters | |
| --------------- |:-----------------------------------------------------------------------------------------:|
| transformerName | Name of the transformer to apply |
| path | URL that will be transformed |
| config | Crafter configuration. Optional. Default in [CrafterConfig.ts](../models/src/CrafterConfig.ts). |
🤖 Prompt for AI Agents
In packages/content/README.md around lines 331-336, the parameter table marks
"config" as optional but the function signature shown earlier documents it as
required; make them consistent by updating the signature to show config as
optional (e.g., add the optional marker or provide a default) and reword the
table entry to a concise phrase such as "Crafter configuration — optional.
Defaults to the value in ../models/src/CrafterConfig.ts." Ensure both signature
and table use the same optional notation and identical phrasing for clarity.

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion packages/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@craftercms/content",
"version": "4.4.1",
"version": "4.4.2",
"description": "Crafter CMS services for content and navigation retrieval",
"main": "./bundles/content.umd.js",
"module": "./esm5/content.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"terser": "^5.30.1"
},
"dependencies": {
"@craftercms/models": "^0.0.0-PLACEHOLDER"
"@craftercms/models": "^4.3.0"
},
"peerDependencies": {
"react": "^18.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/models/src/CrafterConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface CrafterConfig {
contentTypeRegistry?: LookupTable;
// TODO: Remove this in favour of fetchConfig.headers? Most make all sdk service use fetch.
headers: LookupTable;
/** Controls whether to recursively include linked content items. Defaults to false. */
flatten: boolean;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"test": "mocha"
},
"dependencies": {
"@craftercms/classes": "^0.0.0-PLACEHOLDER",
"@craftercms/models": "^0.0.0-PLACEHOLDER",
"@craftercms/utils": "^0.0.0-PLACEHOLDER",
"@craftercms/classes": "^4.4.0",
"@craftercms/models": "^4.3.0",
"@craftercms/utils": "^4.3.0",
"rxjs": "^7.8.1",
"uuid": "^10.0.0"
},
Expand Down