Skip to content

feature/2519 added previously unsupported asset subtypes (without parsing) - #2520

Merged
JoernBerkefeld merged 33 commits into
developfrom
feature/2519-add-missing-asset-sub-sub-types
Sep 5, 2026
Merged

JoernBerkefeld merged 33 commits into
developfrom
feature/2519-add-missing-asset-sub-sub-types

Conversation

@JoernBerkefeld

Copy link
Copy Markdown
Contributor

PR details

What changes did you make? (Give an overview)

Further details (optional)

added to (new) asset-package:

packagedefinition
packagedeployment
added to asset-block:

enhanceddynamicblock
iccloudpageblock
einsteincontentselectionblock
einsteincontenttesting
added to asset-template:

jsonmessagetemplate (whatsapp)
jbtemplate (journey template)

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • test scripts updated
  • Wiki updated (if applicable)

added to (new) asset-package:

packagedefinition
packagedeployment
added to asset-block:

enhanceddynamicblock
iccloudpageblock
einsteincontentselectionblock
einsteincontenttesting
added to asset-template:

jsonmessagetemplate (whatsapp)
jbtemplate (journey template)
@JoernBerkefeld JoernBerkefeld added this to the 9.1.0 milestone Feb 27, 2026
@JoernBerkefeld JoernBerkefeld self-assigned this Feb 27, 2026
@JoernBerkefeld JoernBerkefeld added the c/asset COMPONENT label Feb 27, 2026
@JoernBerkefeld JoernBerkefeld linked an issue Feb 27, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story" label Feb 27, 2026
@github-actions

github-actions Bot commented Feb 28, 2026 •

Copy link
Copy Markdown

Coverage Report

Commit:4f07f79
Base: develop@c6c18a1

Type This PR
Total Statements Coverage  71.84%
Total Branches Coverage  71.46%
Total Functions Coverage  83.94%
Total Lines Coverage  71.84%
Details (changed files):
File Statements Branches Functions Lines
lib/Deployer.js  80.96%  76.04%  100%  80.96%
lib/MetadataTypeDefinitions.js  100%  100%  100%  100%
lib/MetadataTypeInfo.js  100%  100%  100%  100%
lib/cli.js  0%  0%  0%  0%
lib/metadataTypes/Asset.js  82.59%  75%  92%  82.59%
lib/metadataTypes/Journey.js  71.3%  67.13%  96.29%  71.3%
lib/metadataTypes/MobileKeyword.js  89.76%  75%  90.47%  89.76%
lib/metadataTypes/MobileMessage.js  91.25%  80.88%  100%  91.25%
lib/metadataTypes/MobilePush.js  91.68%  82.19%  100%  91.68%
lib/metadataTypes/MobilePushApp.js  89.91%  75%  50%  89.91%
lib/util/auth.js  61.65%  76.47%  66.66%  61.65%
lib/util/businessUnit.js  32.8%  100%  0%  32.8%
lib/util/util.js  85.22%  77.06%  86.79%  85.22%

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds additional SFMC Content Builder asset “sub-sub-types” to the Asset metadata definition (so they can be retrieved/grouped without special parsing), and updates test REST fixtures and generated TypeScript typings accordingly.

Changes:

  • Extended Asset.definition.js with new subtype mappings (notably package, additional block subtypes, and new template subtypes) and updated assetType ID mapping.
  • Updated generated @types definitions to reflect the new subtype/ID entries.
  • Added new REST mock response fixtures for the new/changed assetType.id IN (...) query combinations.

Reviewed changes

Copilot reviewed 1 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/metadataTypes/definitions/Asset.definition.js Adds new subtype(s) and extended subtype mappings + assetType ID mappings.
@types/lib/metadataTypes/definitions/Asset.definition.d.ts Updates generated type defs for the new subtype mappings.
@types/lib/metadataTypes/Asset.d.ts Updates generated Asset typings to include new extended subtypes and IDs.
@types/lib/metadataTypes/Asset.d.ts.map Updated sourcemap for the generated typings.
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN1,205,206,232.json New REST fixture for a revised assetType.id IN (...) query.
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN5,207,208,209,230.json New REST fixture for message-related assetType IDs (includes 230).
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN4,214,231,235.json New REST fixture for template-related assetType IDs.
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN3,195,196,197,198,199,200,201,202,203,210,211,212,213,229,233,234,238.json New REST fixture for block-related assetType IDs (incl. newly added ones).
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN223,224,225,226,227,228,229,231,232,233,234,235,238.json New REST fixture for updated cache/chunk query combinations.
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN225,226,227,228,229,232,233,234,238.json New REST fixture for updated cache/chunk query combinations.
test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,238,240,241,242,243,244,245.json New REST fixture for updated cache/chunk query combinations.

JoernBerkefeld and others added 16 commits April 6, 2026 12:53
Replace ~40 per-id get-response.json and idIN query POST fixtures with a single assets-pool.json (15 ids, full GET bodies) plus a dynamic read engine in resourceFactory.js that serves GET by-id, GET by-key and assetType.id-in query POSTs by projecting the pool to a canonical query column-set. Query projection retains data/legacyData so downstream types (journey, emailSend, triggeredSend, ContentBlock) resolve their email via the query-cached legacyId; asset 808714 carries a queryOverrides for its divergent query-view legacyId. Kept two file-based exceptions (slashfolder scenario, customerKey equal-op). Count assertions adjusted for the honest pollution-drop (off-type by-id GETs 1209971/950143 no longer forced). Full suite green (314 passing / 0 failing).
Fork's console runs git hooks with a pseudo-TTY, so chalk/eslint/listr
emit ANSI color codes that are hard to read in a plain-text log viewer.
Unset FORCE_COLOR and set NO_COLOR=1 at the top of each hook so output
stays plain text.
…th dynamic asset pool + engine

Replace the static per-combination `query/post-response-assetType.idIN*.json` asset
fixtures with a single one-body-per-id asset pool (`assets-pool.json`) plus a query
projection engine in `resourceFactory.js`. The engine serves each asset body from the
pool by-id / by-key and projects the `assetType.id-in` query responses dynamically,
instead of relying on hand-maintained idIN fixture files.

Add an optional `queryExclude` gate so pool entries that exist only to be resolved
by-id / by-key (e.g. an asset referenced by a mobilePush message) never surface in an
`assetType.id-in` query response.

The count-assertion deltas in the asset, automation and general tests are justified:
off-type by-id GETs are no longer fabricated, so retrieve/cache/API-history counts
reflect the real projected asset set.
…D coverage

Add dedicated test coverage and fixtures for the mobilePush and mobilePushApp types
(retrieve / CRUD via the push v1 API) and for journeys that reference a mobilePush
message. The old `legacy/v1/beta/push/application` response fixture is removed in
favor of the new `push/v1/application` path.

All fixtures are sanitized and contain no client data — keys such as
`testExisting_mobilePush_asset_DEV` and `testExisting_journey_Push` are synthetic.

The event.test count bump (5->6) is caused by the shared eventDefinitions fixture now
carrying an extra APIEvent entry used by the push-journey coverage.
… retrieve (async/await)

The mobilePush, mobilePushApp, mobileMessage and mobileKeyword retrieve paths wrapped an
`await`ed API call in a synchronous try/catch, so a rejected promise escaped the guard
and hard-failed the whole retrieve instead of degrading to `0 downloaded` when a key
does not exist or a BU list is empty. Await inside the catch guard so the expected error
is caught.

The two APIs report the not-found error differently, so the guards differ:
- MobilePush / MobilePushApp use the REST `/push/v1/...` API, whose 400 body carries
  `errorcode 10006`.
- MobileMessage / MobileKeyword use the legacy mobile API, whose 400 has no errorcode, so
  the guard falls back to the axios `ERR_BAD_REQUEST` code.
MobilePush additionally degrades a keyless empty-BU 500 (`ERR_BAD_RESPONSE`) to
`0 downloaded`.

Add the supporting REST error-injection harness (`addRestErrorOverride` /
`resetRestErrorOverrides` / `rejectWithAxiosError` in resourceFactory.js and the
`mockRESTError` wrapper in utils.js) plus the shared `rest400/rest400-validationError/
rest500` response fixtures, and regression `it` blocks in the mobileMessage and
mobileKeyword tests covering the graceful wrong-key path.
Fills the create-without-update gap in the mobilePush suite; exercises the upsert PUT /push/v1/message/<id> path (MetadataType.updateREST) instead of only create.
# Conflicts:
#	package-lock.json
#	package.json
@JoernBerkefeld
JoernBerkefeld merged commit e6df458 into develop Sep 5, 2026
10 checks passed
@JoernBerkefeld
JoernBerkefeld deleted the feature/2519-add-missing-asset-sub-sub-types branch September 5, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/asset COMPONENT enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] add missing asset sub-sub-types

2 participants