Skip to content

[MOB-11549] creates IterableEmbeddedMessageMetadata class#654

Merged
evantk91 merged 3 commits into
evan/feature/embeddedfrom
evan/MOB-11549-iterable-embedded-metadata-class
Jun 10, 2025
Merged

[MOB-11549] creates IterableEmbeddedMessageMetadata class#654
evantk91 merged 3 commits into
evan/feature/embeddedfrom
evan/MOB-11549-iterable-embedded-metadata-class

Conversation

@evantk91
Copy link
Copy Markdown
Contributor

@evantk91 evantk91 commented Jun 9, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

This pull request creates the IterableEmbeddedMessageMetadata class.

@evantk91 evantk91 requested a review from lposen June 9, 2025 15:58
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 9, 2025

Lines Statements Branches Functions
Coverage: 39%
39.03% (187/479) 13.73% (25/182) 32.91% (52/158)

@qlty-cloud-legacy
Copy link
Copy Markdown

qlty-cloud-legacy Bot commented Jun 9, 2025

❌ 2 blocking issues (3 total)

Tool Category Rule Count
eslint Lint Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
2
qlty Structure Function with many parameters (count = 4): constructor 1

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@@ -0,0 +1,58 @@
import { IterableEmbeddedMessageMetadata } from '../embedded/classes/IterableEmbeddedMessageMetadata';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,65 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Comment on lines +22 to +26
constructor(
messageId: string,
placementId: number,
campaignId: number | undefined,
isProof: boolean = false
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 4): constructor [qlty:function-parameters]

Copy link
Copy Markdown
Contributor

@lposen lposen left a comment

Choose a reason for hiding this comment

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

Looks good. Please just address the commenting item.

* An interface defining the dictionary object containing the metadata properties for an embedded message.
*/
export interface EmbeddedMessageMetadataDict {
messageId: string;
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.

Please comment what each of the props are

*
* @returns A new instance of `IterableEmbeddedMessageMetadata` with the provided properties.
*/
static fromDict(
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.

Side rant:

Personally, I really don't like the fromDict functions. It's just not a typical javascript pattern, so my spidey sense goes off when I see it (though I can't exactly figure out why). To me, this should all just be handled in a constructor.

That being said, we use fromDict in so many places that we should follow the established pattern and keep it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hm yeah maybe that can be a future improvement.

Copy link
Copy Markdown
Contributor Author

@evantk91 evantk91 Jun 10, 2025

Choose a reason for hiding this comment

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

export class IterableEmbeddedMessageMetadata {
  readonly messageId: string;
  readonly placementId: number;
  readonly campaignId?: number;
  readonly isProof: boolean;

  constructor({
    messageId,
    placementId,
    campaignId,
    isProof = false
  }: EmbeddedMessageMetadataDict) {
    if (!messageId || !placementId) {
      throw new Error('messageId and placementId are required');
    }
    
    this.messageId = messageId;
    this.placementId = placementId;
    this.campaignId = campaignId;
    this.isProof = isProof;
  }
}

// Usage:
new IterableEmbeddedMessageMetadata({
  messageId: 'msg123',
  placementId: 456,
  campaignId: 789,
  isProof: false
});

Base automatically changed from evan/MOB-11561-enableEmbeddedMessaging-flag to evan/feature/embedded June 9, 2025 21:36
@@ -0,0 +1,58 @@
import { IterableEmbeddedMessageMetadata } from '../embedded/classes/IterableEmbeddedMessageMetadata';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,65 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Comment on lines +22 to +26
constructor(
messageId: string,
placementId: number,
campaignId: number | undefined,
isProof: boolean = false
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 4): constructor [qlty:function-parameters]

@@ -0,0 +1,58 @@
import { IterableEmbeddedMessageMetadata } from '../embedded/classes/IterableEmbeddedMessageMetadata';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

@@ -0,0 +1,65 @@
/**
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Error loading TSDoc config file:
Error encountered for /home/runner/work/react-native-sdk/tsdoc.json:
Unable to resolve "extends" reference to "typedoc/tsdoc.json": Cannot find module 'typedoc/tsdoc.json' from '/home/runner/work/react-native-sdk'
[eslint:tsdoc/syntax]

Comment on lines +22 to +26
constructor(
messageId: string,
placementId: number,
campaignId: number | undefined,
isProof: boolean = false
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function with many parameters (count = 4): constructor [qlty:function-parameters]

@evantk91 evantk91 merged commit ef639f5 into evan/feature/embedded Jun 10, 2025
4 of 5 checks passed
@evantk91 evantk91 deleted the evan/MOB-11549-iterable-embedded-metadata-class branch June 10, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants