Created
July 19, 2023 13:32
-
-
Save tveimo/9ed80c181d80c449cc95dcf079c47cd6 to your computer and use it in GitHub Desktop.
test.mts, causes "RangeError: Maximum call stack size exceeded" with kontent-ai/kontent-delivery-node-parser, run with ts-node --esm test.mts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createRichTextHtmlResolver, Elements } from "@kontent-ai/delivery-sdk"; | |
import { nodeParser } from "@kontent-ai/delivery-node-parser"; | |
function test() { | |
const richTextElement = { | |
"images": [], | |
"linkedItemCodenames": [], | |
"linkedItems": [], | |
"links": [{ | |
"codename": "n2023_24_budget", | |
"linkId": "3014dc43-8638-4109-89ed-f0f2d4b8e47a", | |
"urlSlug": "2023-24-budget", | |
"type": "standardpage" | |
}], | |
"name": "Add Content", | |
"type": "rich_text", | |
"value": "<p>Australia's most sustainable region: <em>Healthy. Smart. Creative</em>. That is our vision for the Sunshine Coast and it guides our decisions every day. These attributes are helping council to provide a balanced approach to plan for the future and ensure our region is well equipped to meet the needs of our growing population now and into the future.</p>\n<h2>Corporate plan</h2>\n<p>Our <a data-asset-id=\"16d4a3fe-3e99-450f-8e17-619e6e4fa26c\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/4e093407-cc52-4668-8839-a90954b9d3c8/Corporate%20Plan%202023-2027.pdf\">Corporate Plan 2023-2027</a> (PDF, 10.42MB) provides the blueprint to advance our vision over the next five years on behalf of our community through five strategic goals:</p>\n<ul>\n <li>Our Strong Community - our communities are connected and thriving places where people are included, treated with respect and opportunities are available for all</li>\n <li>Our Environment and Liveability - our natural assets, healthy environment and liveability credentials are maintained and enhanced</li>\n <li>Our Resilient Economy - our resilient, high-value economy of choice drives business performance, investment and enduring employment</li>\n <li>Our Service Excellence - our services are inclusive and responsive to the needs of our community and deliver positive experiences for our customers</li>\n <li>Our Outstanding Organisation - our organisation lives its values and is high performing, sustainable, innovative and community focused, marked by great people, good governance and regional leadership.</li>\n</ul>\n<p>The <a data-asset-id=\"ff6175c6-d978-4e54-bf50-c7083000d2d3\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/5834fd87-a421-45e8-a9fa-123fed23e6fe/Corporate%20Plan%202023-2027_Shortform.pdf\">corporate plan snapshot</a> (PDF, 6.98MB) is a condensed version of the Corporate Plan 2023-2027 and provides a simple overview, making it more accessible across our community.</p>\n<h2>Operational plan</h2>\n<p>The <a data-asset-id=\"415b259c-a7b9-5d13-948e-d1fc0336ec2b\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/3bd9fd71-b97a-4a82-b001-08b458f645ad/DF5026FC-E9DE-4315-89A3-9107DFC1D55F\">Operational Plan 2022/23</a> (PDF, 4.87MB) guides the allocation of resources and assigns corporate responsibility to progress the implementation of the corporate plan and advance the vision over the next financial year.</p>\n<p>This plan informs the annual budget, which directs funding to our core service delivery and major projects.</p>\n<p>Our <a data-asset-id=\"dddc8b6b-e9b4-4d79-87e3-7cf993882581\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/4dcb623a-323f-4d3b-87a8-a110cc0bd987/Operational%20Plan%202023-24.pdf\">Operational Plan 2023/24</a> (PDF, 3.81 MB) was adopted alongside council’s <a data-item-id=\"3014dc43-8638-4109-89ed-f0f2d4b8e47a\" href=\"\">Budget 2023/24</a> on 22 June 2023. The Operational Plan 2023/24 will become active as of 1 July 2023.</p>\n<h2>Quarterly reports</h2>\n<p>Our quarterly reports provide information to council and the community on implementation of the corporate and operational plans.</p>\n<ul>\n <li><a data-asset-id=\"bbee2bf5-8079-4a41-af38-434c0eda9786\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/aaf52ce0-cd87-4792-9e29-0e06c78503f8/Quarter%203%202022-23%20quarterly%20highlights%20report.pdf\">Quarter 3 2022/23 quarterly highlights report</a> (PDF, 2.28MB).</li>\n</ul>\n<h2>Previous reports</h2>\n<ul>\n <li><a data-asset-id=\"f78402ce-f930-46b8-901c-d8e1276611e2\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/74b3a288-3fb8-4b58-ab6e-edb7ffd24913/Quarter%202%202022-23%20Quarterly%20Highlights%20Report.pdf\">Quarter 2 2022/23 quarterly highlights report</a> (PDF, 4.53MB)</li>\n <li><a data-asset-id=\"5966cfbd-7828-5199-8652-f8cd4726c442\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/39e73509-f1df-434d-89b8-c2c0e5bd5157/0B5ADE80-2DE9-49A7-A125-D3A40A64871B\">Quarter 1 2022/23 quarterly highlights report</a> (PDF, 3.36MB)</li>\n <li><a data-asset-id=\"7f7513f9-c1ab-4f86-9794-e8d4d3b5cf5d\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/4598dbe9-6b5e-4c6d-9702-0485a3ceda95/Q4%202021-22.pdf\">Quarter 4 2021/22 quarterly highlights report</a> (PDF, 4.44MB).</li>\n</ul>\n<p>The activities and services outlined in council’s Operational Plan 2022/23; and reported on in the quarterly progress reports for the 2022/23 financial year, are aligned to council’s <a data-asset-id=\"042162cf-5fb3-447a-9ddf-9e68bc23f94b\" href=\"https://preview-assets-us-01.kc-usercontent.com:443/c631baf8-1b46-001f-580c-d0001b68b4a8/9ab382f7-fae1-4df6-8373-f0f2d128c40f/Corporate%20Plan%202022-2026.pdf\">Corporate Plan 2022-2026</a> (PDF, 5.58MB). Council’s Operational Plan 2023/24 will align to the recently adopted Corporate Plan 2023-2027 from 1 July 2023.</p>" | |
} as Elements.RichTextElement | |
const resolvedRichText = createRichTextHtmlResolver(nodeParser).resolveRichText({ | |
element: richTextElement, | |
urlResolver: (linkId: string, linkText: string, link: any) => { | |
const path = "/somewhere/there" | |
return { | |
linkHtml: `<a data-item-id="${linkId}" href="${path.replace(/\/en\//g, "/")}">${linkText}</a>`, | |
linkUrl: path, | |
}; | |
}, | |
}); | |
} | |
test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment