Skip to content

Commit d1ec22c

Browse files
authored
Merge pull request #18 from code-store-platform/feat/optional-promise-for-getPublicationDate-and-getDisplayDate
feat/optional promise for getPublicationDate and getDisplayDate
2 parents 9928659 + 8e6a870 commit d1ec22c

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 4.43.2
4+
5+
### Patch Changes
6+
7+
- MaybePromise for getPublicationDate and getDisplayDate
8+
39
## 4.43.1
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "4.43.1",
3+
"version": "4.43.2",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
55
"type": "commonjs",
66
"main": "./dist/index.js",

src/mapper/doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ export abstract class Document<ANS extends ANSContent> {
115115
return date.toISOString();
116116
}
117117

118-
protected getDisplayDate(): Optional<Date> {
118+
protected getDisplayDate(): MaybePromise<Optional<Date>> {
119119
return new Date();
120120
}
121121

122122
protected async getContentElements(): Promise<ArcTypes.ContentElements.ContentElementType<any>[]> {
123123
return [];
124124
}
125125

126-
protected getPublicationDate(): Optional<Date> {
126+
protected getPublicationDate(): MaybePromise<Optional<Date>> {
127127
return new Date();
128128
}
129129

src/mapper/story.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export abstract class Story<ANS extends ANSContent = Types.Story.AStory> extends
2828
const id = await this.arcId();
2929
const version = this.version();
3030
const type = this.type();
31-
const publicationDate = this.getPublicationDate();
31+
const publicationDate = await this.getPublicationDate();
32+
const displayDate = await this.getDisplayDate();
3233
const headlines = this.getHeadlines();
3334
const subheadlines = this.getSubheadlines();
3435
const description = this.getDescription();
@@ -76,7 +77,7 @@ export abstract class Story<ANS extends ANSContent = Types.Story.AStory> extends
7677
created_date: this.formatDate(new Date()),
7778
first_publish_date: this.formatDate(publicationDate),
7879
publish_date: this.formatDate(publicationDate),
79-
display_date: this.formatDate(this.getDisplayDate()),
80+
display_date: this.formatDate(displayDate),
8081
source,
8182
comments,
8283
taxonomy: {

0 commit comments

Comments
 (0)