Skip to content

Commit 793c0f9

Browse files
committed
Filter out config entities from getEntityTypes()
1 parent 283e101 commit 793c0f9

File tree

8 files changed

+60
-25
lines changed

8 files changed

+60
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

77
#### [0.1.6](https://github.com/cinders-io/n8n-nodes-drupal/compare/0.1.6...0.1.6)
88

9-
- Add entity type and bundle lookups [`76bff69`](https://github.com/cinders-io/n8n-nodes-drupal/commit/76bff693d981528b25f61e2e397e1859cb04de53)
10-
11-
#### [0.1.6](https://github.com/cinders-io/n8n-nodes-drupal/compare/0.1.5...0.1.6)
12-
139
> 6 December 2025
1410
15-
- Add entity type and bundle lookups [`4b2efa8`](https://github.com/cinders-io/n8n-nodes-drupal/commit/4b2efa8df48cf8b206b4a14e471b4155466a6902)
11+
- Add entity type and bundle lookups [`76bff69`](https://github.com/cinders-io/n8n-nodes-drupal/commit/76bff693d981528b25f61e2e397e1859cb04de53)
1612

1713
#### [0.1.5](https://github.com/cinders-io/n8n-nodes-drupal/compare/0.1.4...0.1.5)
1814

dist/nodes/Drupal/Drupal.node.js

Lines changed: 21 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/nodes/Drupal/Drupal.node.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "n8n-nodes-drupal",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "Community node for Drupal",
55
"license": "MIT",
66
"homepage": "",
@@ -21,8 +21,8 @@
2121
"dev": "n8n-node dev",
2222
"lint": "n8n-node lint",
2323
"lint:fix": "n8n-node lint --fix",
24-
"release": "n8n-node release",
25-
"prepublishOnly": "n8n-node prerelease"
24+
"release:rc": "npm run build && npm version prerelease --preid=rc --no-git-tag-version && npm publish --tag rc",
25+
"release:stable": "npm run build && npm version patch --no-git-tag-version && npm publish"
2626
},
2727
"files": [
2828
"dist"

dist/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

nodes/Drupal/Drupal.node.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,41 @@ export class Drupal implements INodeType {
2727
const data = (await drupalApiRequest.call(this, 'GET', '/jsonapi')) as IDataObject;
2828
const links = (data.links ?? {}) as IDataObject;
2929

30-
const types = new Set<string>();
30+
// entityTypeId -> bundles seen
31+
const typeBundles = new Map<string, Set<string>>();
32+
33+
// Content entities that are often single-bundle (bundle == entity_type_id).
34+
// Keep these even though they look like "type--type".
35+
const singleBundleContentAllowList = new Set<string>([
36+
'file',
37+
'user',
38+
'comment',
39+
]);
3140

3241
for (const key of Object.keys(links)) {
3342
// Keys we care about look like "node--page", "media--image"
3443
if (!key.includes('--')) continue;
35-
const [entityTypeId] = key.split('--');
36-
if (entityTypeId) {
37-
types.add(entityTypeId);
44+
const [entityTypeId, bundle] = key.split('--');
45+
if (!entityTypeId || !bundle) continue;
46+
47+
if (!typeBundles.has(entityTypeId)) {
48+
typeBundles.set(entityTypeId, new Set<string>());
3849
}
50+
typeBundles.get(entityTypeId)!.add(bundle);
3951
}
4052

41-
const options: INodePropertyOptions[] = Array.from(types)
53+
const options: INodePropertyOptions[] = Array.from(typeBundles.entries())
54+
.filter(([entityTypeId, bundles]) => {
55+
// Keep allow-listed single-bundle content entity types.
56+
if (singleBundleContentAllowList.has(entityTypeId)) return true;
57+
58+
// Drop entity types that ONLY expose "type--type" (no real bundles).
59+
if (bundles.size === 1 && bundles.has(entityTypeId)) return false;
60+
61+
// Otherwise it's likely a real bundle-able content entity type.
62+
return true;
63+
})
64+
.map(([entityTypeId]) => entityTypeId)
4265
.sort()
4366
.map((entityTypeId) => ({
4467
name: entityTypeId,

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)