Skip to content

Commit 3a47e48

Browse files
committed
Review: rename eventCreatedAt to eventTimestamp
1 parent 693adee commit 3a47e48

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

integrations/github/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ const handleSpaceContentUpdated: EventCallback<
354354
}
355355

356356
await triggerExport(context, spaceInstallation, {
357-
eventCreatedAt: new Date(revision.createdAt),
357+
eventTimestamp: new Date(revision.createdAt),
358358
});
359359
};
360360

integrations/github/src/sync.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ export async function triggerImport(
4545
updateGitInfo?: boolean;
4646

4747
/**
48-
* The date/time of the event that triggers the import.
48+
* The timestamp of the event that triggers the import.
4949
*
5050
* This is to help ensures that Git sync import and export operations are executed
5151
* in the same order on GitBook and on the remote repository.
5252
*/
53-
eventCreatedAt?: Date;
53+
eventTimestamp?: Date;
5454
} = {}
5555
) {
5656
const { api } = context;
57-
const { force = false, updateGitInfo = false, standalone, eventCreatedAt } = options;
57+
const { force = false, updateGitInfo = false, standalone, eventTimestamp } = options;
5858

5959
const config = getSpaceConfigOrThrow(spaceInstallation);
6060
assertIsDefined(config.branch, { label: 'config.branch' });
@@ -76,7 +76,7 @@ export async function triggerImport(
7676
repoProjectDirectory: config.projectDirectory,
7777
repoCacheID: config.key,
7878
force,
79-
timestamp: eventCreatedAt && !force ? eventCreatedAt.toISOString() : undefined,
79+
timestamp: eventTimestamp && !force ? eventTimestamp.toISOString() : undefined,
8080
standalone: !!standalone,
8181
...(updateGitInfo ? { gitInfo: { provider: 'github', url: repoURL } } : {}),
8282
});
@@ -96,16 +96,16 @@ export async function triggerExport(
9696
updateGitInfo?: boolean;
9797

9898
/**
99-
* The date/time of the event that triggers the export.
99+
* The timestamp of the event that triggers the export.
100100
*
101101
* This is to help ensures that Git sync import and export operations are executed
102102
* in the same order on GitBook and on the remote repository.
103103
*/
104-
eventCreatedAt?: Date;
104+
eventTimestamp?: Date;
105105
} = {}
106106
) {
107107
const { api } = context;
108-
const { force = false, updateGitInfo = false, eventCreatedAt } = options;
108+
const { force = false, updateGitInfo = false, eventTimestamp } = options;
109109

110110
const config = getSpaceConfigOrThrow(spaceInstallation);
111111
assertIsDefined(config.branch, { label: 'config.branch' });
@@ -129,7 +129,7 @@ export async function triggerExport(
129129
repoProjectDirectory: config.projectDirectory,
130130
repoCacheID: config.key,
131131
force,
132-
timestamp: eventCreatedAt && !force ? eventCreatedAt.toISOString() : undefined,
132+
timestamp: eventTimestamp && !force ? eventTimestamp.toISOString() : undefined,
133133
commitMessage: getCommitMessageForRevision(config, revision),
134134
...(updateGitInfo ? { gitInfo: { provider: 'github', url: repoURL } } : {}),
135135
});

integrations/github/src/webhooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export async function handlePushEvent(
8585
});
8686

8787
await triggerImport(context, spaceInstallation, {
88-
eventCreatedAt: payload.head_commit?.timestamp
88+
eventTimestamp: payload.head_commit?.timestamp
8989
? new Date(payload.head_commit?.timestamp)
9090
: undefined,
9191
});
@@ -151,7 +151,7 @@ export async function handlePullRequestEvents(
151151
standalone: {
152152
ref: headRef,
153153
},
154-
eventCreatedAt:
154+
eventTimestamp:
155155
payload.action === 'opened'
156156
? new Date(payload.pull_request.created_at)
157157
: new Date(payload.pull_request.updated_at),

integrations/gitlab/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const handleSpaceContentUpdated: EventCallback<
265265
}
266266

267267
await triggerExport(context, spaceInstallation, {
268-
eventCreatedAt: new Date(revision.createdAt),
268+
eventTimestamp: new Date(revision.createdAt),
269269
});
270270
};
271271

integrations/gitlab/src/sync.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ export async function triggerImport(
4545
updateGitInfo?: boolean;
4646

4747
/**
48-
* The date/time of the event that triggers the import.
48+
* The timestamp of the event that triggers the import.
4949
*
5050
* This is to help ensures that Git sync import and export operations are executed
5151
* in the same order on GitBook and on the remote repository.
5252
*/
53-
eventCreatedAt?: Date;
53+
eventTimestamp?: Date;
5454
} = {}
5555
) {
5656
const { api } = context;
57-
const { force = false, updateGitInfo = false, standalone, eventCreatedAt } = options;
57+
const { force = false, updateGitInfo = false, standalone, eventTimestamp } = options;
5858

5959
const config = getSpaceConfigOrThrow(spaceInstallation);
6060
assertIsDefined(config.branch, { label: 'config.branch' });
@@ -76,7 +76,7 @@ export async function triggerImport(
7676
repoProjectDirectory: config.projectDirectory,
7777
repoCacheID: config.key,
7878
force,
79-
timestamp: eventCreatedAt && !force ? eventCreatedAt.toISOString() : undefined,
79+
timestamp: eventTimestamp && !force ? eventTimestamp.toISOString() : undefined,
8080
standalone: !!standalone,
8181
...(updateGitInfo ? { gitInfo: { provider: 'gitlab', url: repoURL } } : {}),
8282
});
@@ -96,16 +96,16 @@ export async function triggerExport(
9696
updateGitInfo?: boolean;
9797

9898
/**
99-
* The date/time of the event that triggers the export.
99+
* The timestamp of the event that triggers the export.
100100
*
101101
* This is to help ensures that Git sync import and export operations are executed
102102
* in the same order on GitBook and on the remote repository.
103103
*/
104-
eventCreatedAt?: Date;
104+
eventTimestamp?: Date;
105105
} = {}
106106
) {
107107
const { api } = context;
108-
const { force = false, updateGitInfo = false, eventCreatedAt } = options;
108+
const { force = false, updateGitInfo = false, eventTimestamp } = options;
109109

110110
const config = getSpaceConfigOrThrow(spaceInstallation);
111111
assertIsDefined(config.branch, { label: 'config.branch' });
@@ -129,7 +129,7 @@ export async function triggerExport(
129129
repoProjectDirectory: config.projectDirectory,
130130
repoCacheID: config.key,
131131
force,
132-
timestamp: eventCreatedAt && !force ? eventCreatedAt.toISOString() : undefined,
132+
timestamp: eventTimestamp && !force ? eventTimestamp.toISOString() : undefined,
133133
commitMessage: getCommitMessageForRevision(config, revision),
134134
...(updateGitInfo ? { gitInfo: { provider: 'gitlab', url: repoURL } } : {}),
135135
});

integrations/gitlab/src/webhooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function handlePushEvent(context: GitLabRuntimeContext, payload: Gi
133133
});
134134

135135
await triggerImport(context, spaceInstallation, {
136-
eventCreatedAt: headCommit ? new Date(headCommit.timestamp) : undefined,
136+
eventTimestamp: headCommit ? new Date(headCommit.timestamp) : undefined,
137137
});
138138
} catch (error) {
139139
logger.error(
@@ -194,7 +194,7 @@ export async function handleMergeRequestEvent(
194194
standalone: {
195195
ref: sourceRef,
196196
},
197-
eventCreatedAt:
197+
eventTimestamp:
198198
payload.object_attributes.action === 'open'
199199
? new Date(payload.object_attributes.created_at)
200200
: new Date(payload.object_attributes.updated_at),

0 commit comments

Comments
 (0)