Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: add `useDate=false` to ts-proto (#13908)

boojack8eb8fc39a508
diff --git a/frontend/src/components/AnomalyCenter/AnomalyTable.vue b/frontend/src/components/AnomalyCenter/AnomalyTable.vue
index d3242d877d..7c2628515c 100644
--- a/frontend/src/components/AnomalyCenter/AnomalyTable.vue
+++ b/frontend/src/components/AnomalyCenter/AnomalyTable.vue
@@ -43,10 +43,10 @@
</span>
</BBTableCell>
<BBTableCell>
- {{ humanizeTs((anomaly.updateTime?.getTime() ?? 0) / 1000) }}
+ {{ humanizeTs(getTimeForPbTimestamp(anomaly.updateTime, 0) / 1000) }}
</BBTableCell>
<BBTableCell>
- {{ humanizeTs((anomaly.createTime?.getTime() ?? 0) / 1000) }}
+ {{ humanizeTs(getTimeForPbTimestamp(anomaly.createTime, 0) / 1000) }}
</BBTableCell>
</template>
</BBTable>
@@ -85,6 +85,7 @@ import { BBModal, BBTable, BBTableCell, BBTableHeaderCell } from "@/bbkit";
import type { BBTableSectionDataSource } from "@/bbkit/types";
import { INSTANCE_ROUTE_DETAIL } from "@/router/dashboard/instance";
import { useDatabaseV1Store } from "@/store";
+import { getTimeForPbTimestamp } from "@/types";
import type { Anomaly } from "@/types/proto/v1/anomaly_service";
import {
Anomaly_AnomalyType,
diff --git a/frontend/src/components/AuditLog/AuditLogDataTable.vue b/frontend/src/components/AuditLog/AuditLogDataTable.vue
index 91af2f68c4..7659e4140e 100644
--- a/frontend/src/components/AuditLog/AuditLogDataTable.vue
+++ b/frontend/src/components/AuditLog/AuditLogDataTable.vue
@@ -16,6 +16,7 @@ import { useI18n } from "vue-i18n";
import BBAvatar from "@/bbkit/BBAvatar.vue";
import { extractUserEmail, useProjectV1Store, useUserStore } from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
+import { getDateForPbTimestamp } from "@/types";
import { AuditData, type AuditLog } from "@/types/proto/v1/audit_log_service";
import { Setting } from "@/types/proto/v1/setting_service";
import { extractProjectResourceName } from "@/utils";
@@ -47,7 +48,9 @@ const columnList = computed((): ProjectDataTableColumn[] => {
title: t("audit-log.table.created-ts"),
width: 240,
render: (auditLog) =>
- dayjs(auditLog.createTime).format("YYYY-MM-DD HH:mm:ss Z"),
+ dayjs(getDateForPbTimestamp(auditLog.createTime)).format(
+ "YYYY-MM-DD HH:mm:ss Z"
+ ),
},
{
key: "severity",
diff --git a/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue b/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue
index 53bffb7bde..98045a901c 100644
--- a/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue
+++ b/frontend/src/components/Branch/BranchDataTable/cells/BranchUpdatedCell.vue
@@ -16,6 +16,7 @@ import { computed } from "vue";
import UserAvatar from "@/components/User/UserAvatar.vue";
import { useUserStore } from "@/store";
import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";
+import { getTimeForPbTimestamp } from "@/types";
import type { Branch } from "@/types/proto/v1/branch_service";
const props = defineProps<{
@@ -31,7 +32,7 @@ const updater = computed(() => {
const updateTimeStr = computed(() => {
return dayjs
- .duration((props.branch.updateTime ?? new Date()).getTime() - Date.now())
+ .duration(getTimeForPbTimestamp(props.branch.updateTime) - Date.now())
.humanize(true);
});
</script>
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue
index 46654a8ac2..93a040acfe 100644
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue
+++ b/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue
@@ -21,6 +21,7 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { RouterLink } from "vue-router";
import { useUserStore } from "@/store";
+import { getDateForPbTimestamp } from "@/types";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
import {
ChangeHistory_Status,
@@ -190,7 +191,9 @@ const columnList = computed(() => {
resizable: true,
ellipsis: true,
render: (history) => {
- return <HumanizeDate date={history.createTime} />;
+ return (
+ <HumanizeDate date={getDateForPbTimestamp(history.createTime)} />
+ );
},
},
{
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
index 2d1d9e74a4..946d00283e 100644
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
+++ b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
@@ -55,7 +55,7 @@
<span class="textlabel"
>{{ $t("common.created-at") }}&nbsp;-&nbsp;</span
>
- {{ humanizeDate(changeHistory.createTime) }} by
+ {{ humanizeDate(getDateForPbTimestamp(changeHistory.createTime)) }} by
{{ `version ${changeHistory.releaseVersion}` }}
</dd>
</dl>
@@ -317,6 +317,7 @@ import {
extractChangeHistoryUID,
} from "@/utils";
import NoPermissionPlaceholder from "../misc/NoPermissionPlaceholder.vue";
+import { getDateForPbTimestamp } from "@/types";
interface LocalState {
showDiff: boolean;
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
index cbeeadbe18..7308034dbe 100644
--- a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
+++ b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDataTable.vue
@@ -22,6 +22,7 @@ import { I18nT, useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import HumanizeDate from "@/components/misc/HumanizeDate.vue";
import { useUserStore } from "@/store";
+import { getDateForPbTimestamp } from "@/types";
import type { Changelist } from "@/types/proto/v1/changelist_service";
import {
extractUserResourceName,
@@ -78,7 +79,11 @@ const columnList = computed((): ChangelistDataTableColumn[] => {
return (
<I18nT keypath="common.updated-at-by">
{{
- time: () => <HumanizeDate date={changelist.createTime} />,
+ time: () => (
+ <HumanizeDate
+ date={getDateForPbTimestamp(changelist.createTime)}
+ />
+ ),
user: () => getUser(changelist.creator)?.title,
}}
</I18nT>
@@ -93,7 +98,11 @@ const columnList = computed((): ChangelistDataTableColumn[] => {
return (
<I18nT keypath="common.created-at-by">
{{
- time: () => <HumanizeDate date={changelist.createTime} />,
+ time: () => (
+ <HumanizeDate
+ date={getDateForPbTimestamp(changelist.createTime)}
+ />
+ ),
user: () => getUser(changelist.creator)?.title,
}}
</I18nT>
diff --git a/frontend/src/components/Database/DatabaseOverviewInfo.vue b/frontend/src/components/Database/DatabaseOverviewInfo.vue
index 9793907399..2831ea06ac 100644
--- a/frontend/src/components/Database/DatabaseOverviewInfo.vue
+++ b/frontend/src/components/Database/DatabaseOverviewInfo.vue
@@ -49,7 +49,7 @@
{{ $t("database.last-successful-sync") }}
</dt>
<dd class="mt-1 text-sm text-main">
- {{ humanizeDate(database.successfulSyncTime) }}
+ {{ humanizeDate(getDateForPbTimestamp(database.successfulSyncTime)) }}
</dd>
</div>
</dl>
@@ -58,7 +58,7 @@
<script setup lang="ts">
import { computed } from "vue";
import { useDBSchemaV1Store } from "@/store";
-import type { ComposedDatabase } from "@/types";
+import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
import { Engine, State } from "@/types/proto/v1/common";
const props = defineProps<{
diff --git a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue b/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
index 128cb6a42c..3cbbdf0b6e 100644
--- a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
+++ b/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
@@ -86,7 +86,7 @@ import { NPopover } from "naive-ui";
import type { PropType } from "vue";
import { computed } from "vue";
import { useUserStore } from "@/store";
-import type { ComposedDatabase } from "@/types";
+import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
import {
extractUserResourceName,
@@ -112,8 +112,9 @@ const link = computed(() => {
});
const createdAt = computed(() => {
- const date = props.changeHistory.createTime ?? new Date(0);
- return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
+ return dayjs(getDateForPbTimestamp(props.changeHistory.createTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ );
});
const timezone = computed(() => "UTC" + dayjs().format("ZZ"));
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
index 4e8df66fd6..9ae5363fe9 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
@@ -12,7 +12,7 @@ import {
IssueCommentType,
type ComposedIssueComment,
} from "@/store";
-import type { ComposedIssue } from "@/types";
+import { getDateForPbTimestamp, type ComposedIssue } from "@/types";
import {
IssueComment_Approval,
IssueComment_Approval_Status,
@@ -174,8 +174,12 @@ const renderActionSentence = () => {
const timeFormat = "YYYY-MM-DD HH:mm:ss UTCZZ";
return t("activity.sentence.changed-from-to", {
name: t("task.rollout-time"),
- oldValue: oldVal ? dayjs(oldVal).format(timeFormat) : "Unset",
- newValue: newVal ? dayjs(newVal).format(timeFormat) : "Unset",
+ oldValue: oldVal
+ ? dayjs(getDateForPbTimestamp(oldVal)).format(timeFormat)
+ : "Unset",
+ newValue: newVal
+ ? dayjs(getDateForPbTimestamp(newVal)).format(timeFormat)
+ : "Unset",
});
}
} else if (issueComment.type === IssueCommentType.TASK_PRIOR_BACKUP) {
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
index f2cc08523f..9670afeaae 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
@@ -14,20 +14,20 @@
<ActionSentence :issue="issue" :issue-comment="issueComment" />
<HumanizeTs
- :ts="(issueComment.createTime?.getTime() ?? 0) / 1000"
+ :ts="getTimeForPbTimestamp(issueComment.createTime, 0) / 1000"
class="ml-1 text-gray-400"
/>
<span
v-if="
- issueComment.createTime?.getTime() !==
- issueComment.updateTime?.getTime() &&
+ getTimeForPbTimestamp(issueComment.createTime) !==
+ getTimeForPbTimestamp(issueComment.updateTime) &&
issueComment.type === IssueCommentType.USER_COMMENT
"
>
<span>({{ $t("common.edited") }}</span>
<HumanizeTs
- :ts="(issueComment.updateTime?.getTime() ?? 0) / 1000"
+ :ts="getTimeForPbTimestamp(issueComment.updateTime, 0) / 1000"
class="ml-1"
/>)
</span>
@@ -56,7 +56,7 @@
import HumanizeTs from "@/components/misc/HumanizeTs.vue";
import { IssueCommentType, type ComposedIssueComment } from "@/store";
import { useUserStore } from "@/store";
-import type { ComposedIssue } from "@/types";
+import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
import { extractUserResourceName } from "@/utils";
import ActionCreator from "./ActionCreator.vue";
import ActionSentence from "./ActionSentence.vue";
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
index 0a3b9c42a1..aa8abd0f6d 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue
@@ -23,7 +23,7 @@
<ActionCreator :creator="issue.creator" />
<span>{{ $t("activity.sentence.created-issue") }}</span>
<HumanizeTs
- :ts="(issue.createTime?.getTime() ?? 0) / 1000"
+ :ts="getTimeForPbTimestamp(issue.createTime, 0) / 1000"
class="ml-1 text-gray-400"
/>
</div>
@@ -36,7 +36,7 @@
<script lang="ts" setup>
import HumanizeTs from "@/components/misc/HumanizeTs.vue";
-import type { ComposedIssue } from "@/types";
+import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
import ActionCreator from "./ActionCreator.vue";
import type { DistinctIssueComment } from "./common";
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
index 4be4eda0b3..b5c7e3c43d 100644
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue
@@ -51,7 +51,7 @@ import CurrentApproverV1 from "@/components/IssueV1/components/CurrentApproverV1
import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";
import { emitWindowEvent } from "@/plugins";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import { type ComposedIssue } from "@/types";
+import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
import {
getHighlightHTMLByRegExp,
extractProjectResourceName,
@@ -141,7 +141,8 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
title: t("issue.table.updated"),
width: 150,
hide: !showExtendedColumns.value,
- render: (issue) => humanizeTs((issue.updateTime?.getTime() ?? 0) / 1000),
+ render: (issue) =>
+ humanizeTs(getTimeForPbTimestamp(issue.updateTime, 0) / 1000),
},
{
key: "approver",
diff --git a/frontend/src/components/IssueV1/components/Sidebar/EarliestAllowedTime.vue b/frontend/src/components/IssueV1/components/Sidebar/EarliestAllowedTime.vue
index 7492813428..9c83ba6739 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/EarliestAllowedTime.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/EarliestAllowedTime.vue
@@ -71,6 +71,8 @@ import ErrorList from "@/components/misc/ErrorList.vue";
import { planServiceClient } from "@/grpcweb";
import { emitWindowEvent } from "@/plugins";
import { hasFeature, pushNotification, useCurrentUserV1 } from "@/store";
+import { getTimeForPbTimestamp } from "@/types";
+import { Timestamp } from "@/types/proto/google/protobuf/timestamp";
import { IssueStatus } from "@/types/proto/v1/issue_service";
import type { Plan_Spec } from "@/types/proto/v1/plan_service";
import {
@@ -107,7 +109,9 @@ const shouldShowEarliestAllowedTime = computed(() => {
// `null` to "Unset"
const earliestAllowedTime = computed(() => {
const spec = specForTask(issue.value.planEntity, selectedTask.value);
- return spec?.earliestAllowedTime ? spec.earliestAllowedTime.getTime() : null;
+ return spec?.earliestAllowedTime
+ ? getTimeForPbTimestamp(spec.earliestAllowedTime)
+ : null;
});
const disallowEditReasons = computed(() => {
@@ -270,8 +274,9 @@ const handleUpdateEarliestAllowedTime = async (timestampMS: number | null) => {
if (!timestampMS) {
spec.earliestAllowedTime = undefined;
} else {
- spec.earliestAllowedTime = new Date();
- spec.earliestAllowedTime.setTime(timestampMS);
+ spec.earliestAllowedTime = Timestamp.fromPartial({
+ seconds: Math.floor(timestampMS / 1000),
+ });
}
} else {
const { target, tasks } = await chooseUpdateStatementTarget();
@@ -310,8 +315,9 @@ const handleUpdateEarliestAllowedTime = async (timestampMS: number | null) => {
if (!timestampMS) {
spec.earliestAllowedTime = undefined;
} else {
- spec.earliestAllowedTime = new Date();
- spec.earliestAllowedTime.setTime(timestampMS);
+ spec.earliestAllowedTime = Timestamp.fromPartial({
+ seconds: Math.floor(timestampMS / 1000),
+ });
}
}
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
index 618dd02e1f..34d52c3626 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
@@ -32,7 +32,12 @@ import { NEllipsis } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { getProjectIdRolloutUidStageUidTaskUid } from "@/store/modules/v1/common";
-import { unknownTask, isPostgresFamily, type ComposedTaskRun } from "@/types";
+import {
+ unknownTask,
+ isPostgresFamily,
+ type ComposedTaskRun,
+ getTimeForPbTimestamp,
+} from "@/types";
import { TaskRun_Status, Task_Type } from "@/types/proto/v1/rollout_service";
import {
databaseV1Url,
@@ -66,7 +71,9 @@ const task = computed(() => {
const earliestAllowedTime = computed(() => {
const spec = specForTask(issue.value.planEntity, task.value);
- return spec?.earliestAllowedTime ? spec.earliestAllowedTime.getTime() : null;
+ return spec?.earliestAllowedTime
+ ? getTimeForPbTimestamp(spec.earliestAllowedTime)
+ : null;
});
const comment = computed(() => {
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
index 8984898041..3bbbadf3bc 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/common.ts
@@ -1,4 +1,5 @@
import { t } from "@/plugins/i18n";
+import { getDateForPbTimestamp } from "@/types";
import {
TaskRunLogEntry_Type,
taskRunLogEntry_TypeToJSON,
@@ -74,7 +75,7 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.TASK_RUN_STATUS_UPDATE,
- startTime: entry.logTime,
+ startTime: getDateForPbTimestamp(entry.logTime),
endTime: undefined,
taskRunStatusUpdate,
});
@@ -85,8 +86,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.DATABASE_SYNC,
- startTime: databaseSync.startTime,
- endTime: databaseSync.endTime,
+ startTime: getDateForPbTimestamp(databaseSync.startTime),
+ endTime: getDateForPbTimestamp(databaseSync.endTime),
databaseSync,
});
}
@@ -96,7 +97,7 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.TRANSACTION_CONTROL,
- startTime: entry.logTime,
+ startTime: getDateForPbTimestamp(entry.logTime),
endTime: undefined,
transactionControl,
});
@@ -107,8 +108,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial: 0,
type: TaskRunLogEntry_Type.SCHEMA_DUMP,
- startTime: schemaDump.startTime,
- endTime: schemaDump.endTime,
+ startTime: getDateForPbTimestamp(schemaDump.startTime),
+ endTime: getDateForPbTimestamp(schemaDump.endTime),
schemaDump,
});
}
@@ -128,8 +129,8 @@ export const convertTaskRunLogEntryToFlattenLogEntries = (
deployId,
serial,
type: TaskRunLogEntry_Type.COMMAND_EXECUTE,
- startTime,
- endTime,
+ startTime: getDateForPbTimestamp(startTime),
+ endTime: getDateForPbTimestamp(endTime),
commandExecute: {
raw: commandExecute,
commandIndex,
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
index a5c4cd1eb2..89c007d5a5 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSession/PostgresSessionTable.vue
@@ -51,6 +51,7 @@
import { AlignHorizontalJustifyStartIcon } from "lucide-vue-next";
import { NDataTable, type DataTableColumn } from "naive-ui";
import { computed } from "vue";
+import { getDateForPbTimestamp } from "@/types";
import {
TaskRunSession_Postgres,
TaskRunSession_Postgres_Session,
@@ -170,7 +171,7 @@ const columns = computed(() => {
title: () => "backend_start",
width: 120,
render: (session) => {
- return <TimeCell date={session.backendStart} />;
+ return <TimeCell date={getDateForPbTimestamp(session.backendStart)} />;
},
},
{
@@ -178,7 +179,7 @@ const columns = computed(() => {
title: () => "xact_start",
width: 120,
render: (session) => {
- return <TimeCell date={session.xactStart} />;
+ return <TimeCell date={getDateForPbTimestamp(session.xactStart)} />;
},
},
{
@@ -186,7 +187,7 @@ const columns = computed(() => {
title: () => "query_start",
width: 120,
render: (session) => {
- return <TimeCell date={session.queryStart} />;
+ return <TimeCell date={getDateForPbTimestamp(session.queryStart)} />;
},
},
];
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
index 4c7ec385f2..07d80832ab 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
@@ -30,7 +30,11 @@ import type { BBGridRow } from "@/bbkit";
import HumanizeDate from "@/components/misc/HumanizeDate.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { useSheetV1Store } from "@/store";
-import type { ComposedTaskRun } from "@/types";
+import {
+ getDateForPbTimestamp,
+ getTimeForPbTimestamp,
+ type ComposedTaskRun,
+} from "@/types";
import { Duration } from "@/types/proto/google/protobuf/duration";
import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
import { humanizeDurationV1, sheetNameOfTaskV1 } from "@/utils";
@@ -118,7 +122,7 @@ const columnList = computed((): DataTableColumn<ComposedTaskRun>[] => {
title: t("task.created"),
width: 100,
render: (taskRun: ComposedTaskRun) => (
- <HumanizeDate date={taskRun.createTime} />
+ <HumanizeDate date={getDateForPbTimestamp(taskRun.createTime)} />
),
},
{
@@ -126,7 +130,7 @@ const columnList = computed((): DataTableColumn<ComposedTaskRun>[] => {
title: t("task.started"),
width: 100,
render: (taskRun: ComposedTaskRun) => (
- <HumanizeDate date={taskRun.startTime} />
+ <HumanizeDate date={getDateForPbTimestamp(taskRun.startTime)} />
),
},
{
@@ -161,18 +165,18 @@ const executionDurationOfTaskRun = (
if (!startTime || !updateTime) {
return undefined;
}
- if (startTime.getTime() === 0) {
+ if (startTime.seconds.isZero()) {
return undefined;
}
if (taskRun.status === TaskRun_Status.RUNNING) {
- const elapsedMS = Date.now() - startTime.getTime();
+ const elapsedMS = Date.now() - getTimeForPbTimestamp(startTime);
return Duration.fromPartial({
seconds: Math.floor(elapsedMS / 1000),
nanos: (elapsedMS % 1000) * 1e6,
});
}
- const startMS = startTime.getTime();
- const updateMS = updateTime.getTime();
+ const startMS = getTimeForPbTimestamp(startTime);
+ const updateMS = getTimeForPbTimestamp(updateTime);
const elapsedMS = updateMS - startMS;
return Duration.fromPartial({
seconds: Math.floor(elapsedMS / 1000),
diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
index ee6be81bf9..af22025bce 100644
--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
@@ -22,6 +22,7 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
+import { getTimeForPbTimestamp } from "@/types";
import type { ComposedPlan } from "@/types/v1/issue/plan";
import {
extractPlanUID,
@@ -83,7 +84,8 @@ const columnList = computed((): DataTableColumn<ComposedPlan>[] => {
width: 150,
resizable: true,
hide: !showExtendedColumns.value,
- render: (plan) => humanizeTs((plan.updateTime?.getTime() ?? 0) / 1000),
+ render: (plan) =>
+ humanizeTs(getTimeForPbTimestamp(plan.updateTime, 0) / 1000),
},
];
return columns.filter((column) => !column.hide);
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
index 27dd1cbbd7..c7b374a85c 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunPanel.vue
@@ -27,7 +27,7 @@ import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import type { TabFilterItem } from "@/components/v2";
import { TabFilter } from "@/components/v2";
-import { type ComposedDatabase } from "@/types";
+import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
import {
PlanCheckRun_Result_Status,
PlanCheckRun_Type,
@@ -102,7 +102,7 @@ const tabItemList = computed(() => {
i === 0
? t("common.latest")
: planCheckRun.createTime
- ? humanizeDate(planCheckRun.createTime)
+ ? humanizeDate(getDateForPbTimestamp(planCheckRun.createTime))
: `UID(${extractPlanCheckRunUID(planCheckRun.name)})`;
return {
label,
diff --git a/frontend/src/components/ProjectBranchesPanel.vue b/frontend/src/components/ProjectBranchesPanel.vue
index 63fd260d2e..340517048c 100644
--- a/frontend/src/components/ProjectBranchesPanel.vue
+++ b/frontend/src/components/ProjectBranchesPanel.vue
@@ -45,7 +45,7 @@ import { PROJECT_V1_ROUTE_BRANCH_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentUserV1 } from "@/store";
import { useBranchListByProject } from "@/store/modules/branch";
import { userNamePrefix } from "@/store/modules/v1/common";
-import type { ComposedProject } from "@/types";
+import { getTimeForPbTimestamp, type ComposedProject } from "@/types";
import { hasProjectPermissionV2 } from "@/utils";
import { SearchBox } from "./v2";
@@ -102,7 +102,8 @@ const currentUserBranches = computed(() => {
const activeBranches = computed(() => {
return filteredBranches.value.filter((branch) => {
return (
- branch.updateTime!.getTime() > Date.now() - BRANCH_DEFAULT_ACTIVE_DURATION
+ getTimeForPbTimestamp(branch.updateTime) >
+ Date.now() - BRANCH_DEFAULT_ACTIVE_DURATION
);
});
});
diff --git a/frontend/src/components/Release/ReleaseDataTable.vue b/frontend/src/components/Release/ReleaseDataTable.vue
index d5b2e35a65..0633915525 100644
--- a/frontend/src/components/Release/ReleaseDataTable.vue
+++ b/frontend/src/components/Release/ReleaseDataTable.vue
@@ -22,7 +22,7 @@ import { reactive, computed, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { BBAvatar } from "@/bbkit";
-import { type ComposedRelease } from "@/types";
+import { getTimeForPbTimestamp, type ComposedRelease } from "@/types";
import { humanizeTs } from "@/utils";
interface LocalState {
@@ -76,7 +76,7 @@ const columnList = computed((): DataTableColumn<ComposedRelease>[] => {
title: t("common.created-at"),
width: 150,
render: (release) =>
- humanizeTs((release.createTime?.getTime() ?? 0) / 1000),
+ humanizeTs(getTimeForPbTimestamp(release.createTime, 0) / 1000),
},
{
key: "creator",
diff --git a/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue b/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue
index c1f1703f61..3159a1bbef 100644
--- a/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue
+++ b/frontend/src/components/SchemaEditorLite/Aside/LastUpdate.vue
@@ -34,7 +34,11 @@
</div>
</div>
<div v-if="updateTime" class="flex justify-end gap-1 text-xs">
- {{ dayjs(updateTime).format("YYYY-MM-DD HH:mm:ss UTCZZ") }}
+ {{
+ dayjs(getDateForPbTimestamp(updateTime)).format(
+ "YYYY-MM-DD HH:mm:ss UTCZZ"
+ )
+ }}
</div>
</div>
</template>
@@ -47,6 +51,7 @@ import { computed } from "vue";
import { watchEffect } from "vue";
import UserAvatar from "@/components/User/UserAvatar.vue";
import { extractUserEmail, useBranchStore, useUserStore } from "@/store";
+import { getDateForPbTimestamp } from "@/types";
import type {
TreeNodeForFunction,
TreeNodeForProcedure,
diff --git a/frontend/src/components/SlowQuery/Panel/DetailPanel.vue b/frontend/src/components/SlowQuery/Panel/DetailPanel.vue
index b5176887e1..69243defcd 100644
--- a/frontend/src/components/SlowQuery/Panel/DetailPanel.vue
+++ b/frontend/src/components/SlowQuery/Panel/DetailPanel.vue
@@ -88,7 +88,11 @@
</NButton>
</div>
<div class="bb-grid-cell whitespace-nowrap !pr-4">
- {{ dayjs(detail.startTime).format("YYYY-MM-DD HH:mm:ss") }}
+ {{
+ dayjs(getDateForPbTimestamp(detail.startTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ )
+ }}
</div>
<div class="bb-grid-cell text-xs font-mono">
<div class="truncate">
@@ -138,7 +142,7 @@ import {
Drawer,
DrawerContent,
} from "@/components/v2";
-import type { ComposedSlowQueryLog } from "@/types";
+import { getDateForPbTimestamp, type ComposedSlowQueryLog } from "@/types";
import type { SlowQueryDetails } from "@/types/proto/v1/database_service";
import { instanceV1HasSlowQueryDetail } from "@/utils";
import { hasProjectPermissionV2 } from "@/utils";
diff --git a/frontend/src/components/SlowQuery/Panel/LogTable.vue b/frontend/src/components/SlowQuery/Panel/LogTable.vue
index 6170f18697..e710505311 100644
--- a/frontend/src/components/SlowQuery/Panel/LogTable.vue
+++ b/frontend/src/components/SlowQuery/Panel/LogTable.vue
@@ -39,7 +39,11 @@ import {
InstanceV1Name,
EnvironmentV1Name,
} from "@/components/v2";
-import type { ComposedSlowQueryLog } from "@/types";
+import {
+ getDateForPbTimestamp,
+ getTimeForPbTimestamp,
+ type ComposedSlowQueryLog,
+} from "@/types";
import type { Duration } from "@/types/proto/google/protobuf/duration";
import { instanceV1HasSlowQueryDetail } from "@/utils";
@@ -218,10 +222,12 @@ const dataTableColumns = computed(
title: t("slow-query.last-query-time"),
key: "last_query_time",
sorter: (rowA, rowB) =>
- (rowA.log.statistics?.latestLogTime?.getTime() ?? 0) -
- (rowB.log.statistics?.latestLogTime?.getTime() ?? 0),
+ getTimeForPbTimestamp(rowA.log.statistics?.latestLogTime, 0) -
+ getTimeForPbTimestamp(rowB.log.statistics?.latestLogTime, 0),
render: (item) =>
- dayjs(item.log.statistics?.latestLogTime).format("YYYY-MM-DD HH:mm:ss"),
+ dayjs(getDateForPbTimestamp(item.log.statistics?.latestLogTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ ),
});
return columns;
diff --git a/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue b/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
index 95536730bb..6c6d454288 100644
--- a/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
+++ b/frontend/src/components/SyncDatabaseSchema/DatabaseSchemaSelector.vue
@@ -93,7 +93,12 @@ import {
useSubscriptionV1Store,
useDBSchemaV1Store,
} from "@/store";
-import { UNKNOWN_ID, isValidDatabaseName, isValidProjectName } from "@/types";
+import {
+ UNKNOWN_ID,
+ getDateForPbTimestamp,
+ isValidDatabaseName,
+ isValidProjectName,
+} from "@/types";
import { Engine } from "@/types/proto/v1/common";
import type { ChangeHistory } from "@/types/proto/v1/database_service";
import {
@@ -273,7 +278,7 @@ const renderSchemaVersionLabel = (option: SelectOption) => {
if (updateTime) {
children.push(
h(HumanizeDate, {
- date: updateTime,
+ date: getDateForPbTimestamp(updateTime),
class: "text-control-light",
})
);
diff --git a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue b/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue
index 7a0d4abf0c..fa0a12e436 100644
--- a/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue
+++ b/frontend/src/components/TenantDatabaseTable/DatabaseMatrixItem.vue
@@ -53,7 +53,9 @@
<div class="px-4 py-2 flex items-center justify-between space-x-1">
<span>{{ $t("db.last-successful-sync") }}</span>
- <span>{{ humanizeDate(database.successfulSyncTime) }}</span>
+ <span>{{
+ humanizeDate(getDateForPbTimestamp(database.successfulSyncTime))
+ }}</span>
</div>
<div
@@ -82,7 +84,7 @@
import { NPopover } from "naive-ui";
import type { PropType } from "vue";
import { computed } from "vue";
-import type { ComposedDatabase } from "@/types";
+import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
import { State } from "@/types/proto/v1/common";
import {
convertLabelsToKVList,
diff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.ts
index fbac402cd3..5c3a8ea370 100644
--- a/frontend/src/store/modules/v1/subscription.ts
+++ b/frontend/src/store/modules/v1/subscription.ts
@@ -4,7 +4,7 @@ import type { Ref } from "vue";
import { computed } from "vue";
import { subscriptionServiceClient } from "@/grpcweb";
import type { FeatureType } from "@/types";
-import { PLANS, instanceLimitFeature } from "@/types";
+import { PLANS, getDateForPbTimestamp, instanceLimitFeature } from "@/types";
import type {
Instance,
InstanceResource,
@@ -73,9 +73,9 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
return "";
}
- return dayjs(state.subscription.expiresTime).format(
- "YYYY-MM-DD HH:mm:ss"
- );
+ return dayjs(
+ getDateForPbTimestamp(state.subscription.expiresTime)
+ ).format("YYYY-MM-DD HH:mm:ss");
},
isTrialing(state): boolean {
return !!state.subscription?.trialing;
@@ -88,7 +88,9 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
) {
return false;
}
- return dayjs(state.subscription.expiresTime).isBefore(new Date());
+ return dayjs(
+ getDateForPbTimestamp(state.subscription.expiresTime)
+ ).isBefore(new Date());
},
daysBeforeExpire(state): number {
if (
@@ -99,7 +101,9 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
return -1;
}
- const expiresTime = dayjs(state.subscription.expiresTime);
+ const expiresTime = dayjs(
+ getDateForPbTimestamp(state.subscription.expiresTime)
+ );
return Math.max(expiresTime.diff(new Date(), "day"), 0);
},
isNearExpireTime(state): boolean {
@@ -114,8 +118,13 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {
const daysBeforeExpire = this.daysBeforeExpire;
if (daysBeforeExpire <= 0) return false;
- const trialEndTime = dayjs(state.subscription.expiresTime);
- const total = trialEndTime.diff(state.subscription.startedTime, "day");
+ const trialEndTime = dayjs(
+ getDateForPbTimestamp(state.subscription.expiresTime)
+ );
+ const total = trialEndTime.diff(
+ getDateForPbTimestamp(state.subscription.startedTime),
+ "day"
+ );
return daysBeforeExpire / total < 0.5;
},
existTrialLicense(): boolean {
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index dab51caa48..823b0cb358 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -33,3 +33,4 @@ export * from "./appProfile";
export * from "./release";
export * from "./v1";
+export * from "./timestamp";
diff --git a/frontend/src/types/proto/google/api/expr/v1alpha1/syntax.ts b/frontend/src/types/proto/google/api/expr/v1alpha1/syntax.ts
index 4c38138598..1781aa62c2 100644
--- a/frontend/src/types/proto/google/api/expr/v1alpha1/syntax.ts
+++ b/frontend/src/types/proto/google/api/expr/v1alpha1/syntax.ts
@@ -325,7 +325,7 @@ export interface Constant {
*
* @deprecated
*/
- timestampValue?: Date | undefined;
+ timestampValue?: Timestamp | undefined;
}
/** Source information collected at parse time. */
@@ -1392,7 +1392,7 @@ export const Constant: MessageFns<Constant> = {
Duration.encode(message.durationValue, writer.uint32(66).fork()).join();
}
if (message.timestampValue !== undefined) {
- Timestamp.encode(toTimestamp(message.timestampValue), writer.uint32(74).fork()).join();
+ Timestamp.encode(message.timestampValue, writer.uint32(74).fork()).join();
}
return writer;
},
@@ -1465,7 +1465,7 @@ export const Constant: MessageFns<Constant> = {
break;
}
- message.timestampValue = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.timestampValue = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -1517,7 +1517,7 @@ export const Constant: MessageFns<Constant> = {
obj.durationValue = Duration.toJSON(message.durationValue);
}
if (message.timestampValue !== undefined) {
- obj.timestampValue = message.timestampValue.toISOString();
+ obj.timestampValue = fromTimestamp(message.timestampValue).toISOString();
}
return obj;
},
@@ -1541,7 +1541,9 @@ export const Constant: MessageFns<Constant> = {
message.durationValue = (object.durationValue !== undefined && object.durationValue !== null)
? Duration.fromPartial(object.durationValue)
: undefined;
- message.timestampValue = object.timestampValue ?? undefined;
+ message.timestampValue = (object.timestampValue !== undefined && object.timestampValue !== null)
+ ? Timestamp.fromPartial(object.timestampValue)
+ : undefined;
return message;
},
};
@@ -2006,13 +2008,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/database.ts b/frontend/src/types/proto/store/database.ts
index a6c464c905..a5d55eb877 100644
--- a/frontend/src/types/proto/store/database.ts
+++ b/frontend/src/types/proto/store/database.ts
@@ -15,7 +15,7 @@ export const protobufPackage = "bytebase.store";
/** DatabaseMetadata is the metadata for databases. */
export interface DatabaseMetadata {
labels: { [key: string]: string };
- lastSyncTime: Date | undefined;
+ lastSyncTime: Timestamp | undefined;
}
export interface DatabaseMetadata_LabelsEntry {
@@ -747,7 +747,7 @@ export interface TableConfig {
*/
sourceBranch: string;
/** The timestamp when the table is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface FunctionConfig {
@@ -764,7 +764,7 @@ export interface FunctionConfig {
*/
sourceBranch: string;
/** The timestamp when the function is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ProcedureConfig {
@@ -781,7 +781,7 @@ export interface ProcedureConfig {
*/
sourceBranch: string;
/** The timestamp when the procedure is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ViewConfig {
@@ -798,7 +798,7 @@ export interface ViewConfig {
*/
sourceBranch: string;
/** The timestamp when the view is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ColumnConfig {
@@ -839,7 +839,7 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
DatabaseMetadata_LabelsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
});
if (message.lastSyncTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastSyncTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.lastSyncTime, writer.uint32(18).fork()).join();
}
return writer;
},
@@ -866,7 +866,7 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
break;
}
- message.lastSyncTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastSyncTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -901,7 +901,7 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
}
}
if (message.lastSyncTime !== undefined) {
- obj.lastSyncTime = message.lastSyncTime.toISOString();
+ obj.lastSyncTime = fromTimestamp(message.lastSyncTime).toISOString();
}
return obj;
},
@@ -917,7 +917,9 @@ export const DatabaseMetadata: MessageFns<DatabaseMetadata> = {
}
return acc;
}, {});
- message.lastSyncTime = object.lastSyncTime ?? undefined;
+ message.lastSyncTime = (object.lastSyncTime !== undefined && object.lastSyncTime !== null)
+ ? Timestamp.fromPartial(object.lastSyncTime)
+ : undefined;
return message;
},
};
@@ -4172,7 +4174,7 @@ export const TableConfig: MessageFns<TableConfig> = {
writer.uint32(50).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(42).fork()).join();
}
return writer;
},
@@ -4224,7 +4226,7 @@ export const TableConfig: MessageFns<TableConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -4266,7 +4268,7 @@ export const TableConfig: MessageFns<TableConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -4281,7 +4283,9 @@ export const TableConfig: MessageFns<TableConfig> = {
message.classificationId = object.classificationId ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -4302,7 +4306,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -4340,7 +4344,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -4372,7 +4376,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -4385,7 +4389,9 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -4406,7 +4412,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -4444,7 +4450,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -4476,7 +4482,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -4489,7 +4495,9 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -4510,7 +4518,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -4548,7 +4556,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -4580,7 +4588,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -4593,7 +4601,9 @@ export const ViewConfig: MessageFns<ViewConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -4978,13 +4988,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/instance.ts b/frontend/src/types/proto/store/instance.ts
index 757ab52687..e46cc3eadc 100644
--- a/frontend/src/types/proto/store/instance.ts
+++ b/frontend/src/types/proto/store/instance.ts
@@ -32,7 +32,7 @@ export interface InstanceMetadata {
* It is used to determine whether the table names and database names are case sensitive.
*/
mysqlLowerCaseTableNames: number;
- lastSyncTime: Date | undefined;
+ lastSyncTime: Timestamp | undefined;
roles: InstanceRole[];
}
@@ -142,7 +142,7 @@ export const InstanceMetadata: MessageFns<InstanceMetadata> = {
writer.uint32(8).int32(message.mysqlLowerCaseTableNames);
}
if (message.lastSyncTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastSyncTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.lastSyncTime, writer.uint32(18).fork()).join();
}
for (const v of message.roles) {
InstanceRole.encode(v!, writer.uint32(26).fork()).join();
@@ -169,7 +169,7 @@ export const InstanceMetadata: MessageFns<InstanceMetadata> = {
break;
}
- message.lastSyncTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastSyncTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -203,7 +203,7 @@ export const InstanceMetadata: MessageFns<InstanceMetadata> = {
obj.mysqlLowerCaseTableNames = Math.round(message.mysqlLowerCaseTableNames);
}
if (message.lastSyncTime !== undefined) {
- obj.lastSyncTime = message.lastSyncTime.toISOString();
+ obj.lastSyncTime = fromTimestamp(message.lastSyncTime).toISOString();
}
if (message.roles?.length) {
obj.roles = message.roles.map((e) => InstanceRole.toJSON(e));
@@ -217,7 +217,9 @@ export const InstanceMetadata: MessageFns<InstanceMetadata> = {
fromPartial(object: DeepPartial<InstanceMetadata>): InstanceMetadata {
const message = createBaseInstanceMetadata();
message.mysqlLowerCaseTableNames = object.mysqlLowerCaseTableNames ?? 0;
- message.lastSyncTime = object.lastSyncTime ?? undefined;
+ message.lastSyncTime = (object.lastSyncTime !== undefined && object.lastSyncTime !== null)
+ ? Timestamp.fromPartial(object.lastSyncTime)
+ : undefined;
message.roles = object.roles?.map((e) => InstanceRole.fromPartial(e)) || [];
return message;
},
@@ -347,13 +349,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/issue_comment.ts b/frontend/src/types/proto/store/issue_comment.ts
index 81b4dea71e..5e38d61587 100644
--- a/frontend/src/types/proto/store/issue_comment.ts
+++ b/frontend/src/types/proto/store/issue_comment.ts
@@ -175,8 +175,8 @@ export interface IssueCommentPayload_TaskUpdate {
| undefined;
/** Format: projects/{project}/sheets/{sheet} */
toSheet?: string | undefined;
- fromEarliestAllowedTime?: Date | undefined;
- toEarliestAllowedTime?: Date | undefined;
+ fromEarliestAllowedTime?: Timestamp | undefined;
+ toEarliestAllowedTime?: Timestamp | undefined;
toStatus?: IssueCommentPayload_TaskUpdate_Status | undefined;
}
@@ -751,10 +751,10 @@ export const IssueCommentPayload_TaskUpdate: MessageFns<IssueCommentPayload_Task
writer.uint32(26).string(message.toSheet);
}
if (message.fromEarliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.fromEarliestAllowedTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.fromEarliestAllowedTime, writer.uint32(34).fork()).join();
}
if (message.toEarliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.toEarliestAllowedTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.toEarliestAllowedTime, writer.uint32(42).fork()).join();
}
if (message.toStatus !== undefined) {
writer.uint32(48).int32(issueCommentPayload_TaskUpdate_StatusToNumber(message.toStatus));
@@ -795,14 +795,14 @@ export const IssueCommentPayload_TaskUpdate: MessageFns<IssueCommentPayload_Task
break;
}
- message.fromEarliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.fromEarliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
- message.toEarliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.toEarliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 48) {
@@ -847,10 +847,10 @@ export const IssueCommentPayload_TaskUpdate: MessageFns<IssueCommentPayload_Task
obj.toSheet = message.toSheet;
}
if (message.fromEarliestAllowedTime !== undefined) {
- obj.fromEarliestAllowedTime = message.fromEarliestAllowedTime.toISOString();
+ obj.fromEarliestAllowedTime = fromTimestamp(message.fromEarliestAllowedTime).toISOString();
}
if (message.toEarliestAllowedTime !== undefined) {
- obj.toEarliestAllowedTime = message.toEarliestAllowedTime.toISOString();
+ obj.toEarliestAllowedTime = fromTimestamp(message.toEarliestAllowedTime).toISOString();
}
if (message.toStatus !== undefined) {
obj.toStatus = issueCommentPayload_TaskUpdate_StatusToJSON(message.toStatus);
@@ -866,8 +866,14 @@ export const IssueCommentPayload_TaskUpdate: MessageFns<IssueCommentPayload_Task
message.tasks = object.tasks?.map((e) => e) || [];
message.fromSheet = object.fromSheet ?? undefined;
message.toSheet = object.toSheet ?? undefined;
- message.fromEarliestAllowedTime = object.fromEarliestAllowedTime ?? undefined;
- message.toEarliestAllowedTime = object.toEarliestAllowedTime ?? undefined;
+ message.fromEarliestAllowedTime =
+ (object.fromEarliestAllowedTime !== undefined && object.fromEarliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.fromEarliestAllowedTime)
+ : undefined;
+ message.toEarliestAllowedTime =
+ (object.toEarliestAllowedTime !== undefined && object.toEarliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.toEarliestAllowedTime)
+ : undefined;
message.toStatus = object.toStatus ?? undefined;
return message;
},
@@ -1090,13 +1096,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/plan.ts b/frontend/src/types/proto/store/plan.ts
index 755166d19f..908544314b 100644
--- a/frontend/src/types/proto/store/plan.ts
+++ b/frontend/src/types/proto/store/plan.ts
@@ -39,7 +39,7 @@ export interface PlanConfig_Step {
export interface PlanConfig_Spec {
/** earliest_allowed_time the earliest execution time of the change. */
earliestAllowedTime:
- | Date
+ | Timestamp
| undefined;
/** A UUID4 string that uniquely identifies the Spec. */
id: string;
@@ -412,7 +412,7 @@ function createBasePlanConfig_Spec(): PlanConfig_Spec {
export const PlanConfig_Spec: MessageFns<PlanConfig_Spec> = {
encode(message: PlanConfig_Spec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.earliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.earliestAllowedTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.earliestAllowedTime, writer.uint32(34).fork()).join();
}
if (message.id !== "") {
writer.uint32(42).string(message.id);
@@ -444,7 +444,7 @@ export const PlanConfig_Spec: MessageFns<PlanConfig_Spec> = {
break;
}
- message.earliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.earliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
@@ -514,7 +514,7 @@ export const PlanConfig_Spec: MessageFns<PlanConfig_Spec> = {
toJSON(message: PlanConfig_Spec): unknown {
const obj: any = {};
if (message.earliestAllowedTime !== undefined) {
- obj.earliestAllowedTime = message.earliestAllowedTime.toISOString();
+ obj.earliestAllowedTime = fromTimestamp(message.earliestAllowedTime).toISOString();
}
if (message.id !== "") {
obj.id = message.id;
@@ -539,7 +539,9 @@ export const PlanConfig_Spec: MessageFns<PlanConfig_Spec> = {
},
fromPartial(object: DeepPartial<PlanConfig_Spec>): PlanConfig_Spec {
const message = createBasePlanConfig_Spec();
- message.earliestAllowedTime = object.earliestAllowedTime ?? undefined;
+ message.earliestAllowedTime = (object.earliestAllowedTime !== undefined && object.earliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.earliestAllowedTime)
+ : undefined;
message.id = object.id ?? "";
message.dependsOnSpecs = object.dependsOnSpecs?.map((e) => e) || [];
message.createDatabaseConfig = (object.createDatabaseConfig !== undefined && object.createDatabaseConfig !== null)
@@ -1325,13 +1327,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/slow_query.ts b/frontend/src/types/proto/store/slow_query.ts
index 677bc10aec..2680a49059 100644
--- a/frontend/src/types/proto/store/slow_query.ts
+++ b/frontend/src/types/proto/store/slow_query.ts
@@ -26,7 +26,7 @@ export interface SlowQueryStatisticsItem {
count: number;
/** latest_log_time is the time of the latest slow query with the same fingerprint. */
latestLogTime:
- | Date
+ | Timestamp
| undefined;
/** The total query time of the slow query log. */
totalQueryTime:
@@ -52,7 +52,7 @@ export interface SlowQueryStatisticsItem {
export interface SlowQueryDetails {
/** start_time is the start time of the slow query. */
startTime:
- | Date
+ | Timestamp
| undefined;
/** query_time is the query time of the slow query. */
queryTime:
@@ -155,7 +155,7 @@ export const SlowQueryStatisticsItem: MessageFns<SlowQueryStatisticsItem> = {
writer.uint32(16).int32(message.count);
}
if (message.latestLogTime !== undefined) {
- Timestamp.encode(toTimestamp(message.latestLogTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.latestLogTime, writer.uint32(26).fork()).join();
}
if (message.totalQueryTime !== undefined) {
Duration.encode(message.totalQueryTime, writer.uint32(34).fork()).join();
@@ -207,7 +207,7 @@ export const SlowQueryStatisticsItem: MessageFns<SlowQueryStatisticsItem> = {
break;
}
- message.latestLogTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.latestLogTime = Timestamp.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
@@ -293,7 +293,7 @@ export const SlowQueryStatisticsItem: MessageFns<SlowQueryStatisticsItem> = {
obj.count = Math.round(message.count);
}
if (message.latestLogTime !== undefined) {
- obj.latestLogTime = message.latestLogTime.toISOString();
+ obj.latestLogTime = fromTimestamp(message.latestLogTime).toISOString();
}
if (message.totalQueryTime !== undefined) {
obj.totalQueryTime = Duration.toJSON(message.totalQueryTime);
@@ -326,7 +326,9 @@ export const SlowQueryStatisticsItem: MessageFns<SlowQueryStatisticsItem> = {
const message = createBaseSlowQueryStatisticsItem();
message.sqlFingerprint = object.sqlFingerprint ?? "";
message.count = object.count ?? 0;
- message.latestLogTime = object.latestLogTime ?? undefined;
+ message.latestLogTime = (object.latestLogTime !== undefined && object.latestLogTime !== null)
+ ? Timestamp.fromPartial(object.latestLogTime)
+ : undefined;
message.totalQueryTime = (object.totalQueryTime !== undefined && object.totalQueryTime !== null)
? Duration.fromPartial(object.totalQueryTime)
: undefined;
@@ -349,7 +351,7 @@ function createBaseSlowQueryDetails(): SlowQueryDetails {
export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
encode(message: SlowQueryDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.startTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.startTime, writer.uint32(10).fork()).join();
}
if (message.queryTime !== undefined) {
Duration.encode(message.queryTime, writer.uint32(18).fork()).join();
@@ -381,7 +383,7 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
break;
}
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
@@ -441,7 +443,7 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
toJSON(message: SlowQueryDetails): unknown {
const obj: any = {};
if (message.startTime !== undefined) {
- obj.startTime = message.startTime.toISOString();
+ obj.startTime = fromTimestamp(message.startTime).toISOString();
}
if (message.queryTime !== undefined) {
obj.queryTime = Duration.toJSON(message.queryTime);
@@ -466,7 +468,9 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
},
fromPartial(object: DeepPartial<SlowQueryDetails>): SlowQueryDetails {
const message = createBaseSlowQueryDetails();
- message.startTime = object.startTime ?? undefined;
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
+ ? Timestamp.fromPartial(object.startTime)
+ : undefined;
message.queryTime = (object.queryTime !== undefined && object.queryTime !== null)
? Duration.fromPartial(object.queryTime)
: undefined;
@@ -500,13 +504,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/task_run.ts b/frontend/src/types/proto/store/task_run.ts
index 6cafe20ba0..84b795c680 100644
--- a/frontend/src/types/proto/store/task_run.ts
+++ b/frontend/src/types/proto/store/task_run.ts
@@ -59,7 +59,7 @@ export interface PriorBackupDetail_Item_Table {
}
export interface SchedulerInfo {
- reportTime: Date | undefined;
+ reportTime: Timestamp | undefined;
waitingCause: SchedulerInfo_WaitingCause | undefined;
}
@@ -576,7 +576,7 @@ function createBaseSchedulerInfo(): SchedulerInfo {
export const SchedulerInfo: MessageFns<SchedulerInfo> = {
encode(message: SchedulerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.reportTime !== undefined) {
- Timestamp.encode(toTimestamp(message.reportTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.reportTime, writer.uint32(10).fork()).join();
}
if (message.waitingCause !== undefined) {
SchedulerInfo_WaitingCause.encode(message.waitingCause, writer.uint32(18).fork()).join();
@@ -596,7 +596,7 @@ export const SchedulerInfo: MessageFns<SchedulerInfo> = {
break;
}
- message.reportTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.reportTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
@@ -624,7 +624,7 @@ export const SchedulerInfo: MessageFns<SchedulerInfo> = {
toJSON(message: SchedulerInfo): unknown {
const obj: any = {};
if (message.reportTime !== undefined) {
- obj.reportTime = message.reportTime.toISOString();
+ obj.reportTime = fromTimestamp(message.reportTime).toISOString();
}
if (message.waitingCause !== undefined) {
obj.waitingCause = SchedulerInfo_WaitingCause.toJSON(message.waitingCause);
@@ -637,7 +637,9 @@ export const SchedulerInfo: MessageFns<SchedulerInfo> = {
},
fromPartial(object: DeepPartial<SchedulerInfo>): SchedulerInfo {
const message = createBaseSchedulerInfo();
- message.reportTime = object.reportTime ?? undefined;
+ message.reportTime = (object.reportTime !== undefined && object.reportTime !== null)
+ ? Timestamp.fromPartial(object.reportTime)
+ : undefined;
message.waitingCause = (object.waitingCause !== undefined && object.waitingCause !== null)
? SchedulerInfo_WaitingCause.fromPartial(object.waitingCause)
: undefined;
@@ -739,13 +741,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/store/user.ts b/frontend/src/types/proto/store/user.ts
index 7e8fcbe585..c54895d343 100644
--- a/frontend/src/types/proto/store/user.ts
+++ b/frontend/src/types/proto/store/user.ts
@@ -24,9 +24,9 @@ export interface MFAConfig {
}
export interface UserProfile {
- lastLoginTime: Date | undefined;
+ lastLoginTime: Timestamp | undefined;
lastChangePasswordTime:
- | Date
+ | Timestamp
| undefined;
/** source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. */
source: string;
@@ -147,10 +147,10 @@ function createBaseUserProfile(): UserProfile {
export const UserProfile: MessageFns<UserProfile> = {
encode(message: UserProfile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.lastLoginTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastLoginTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.lastLoginTime, writer.uint32(10).fork()).join();
}
if (message.lastChangePasswordTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastChangePasswordTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.lastChangePasswordTime, writer.uint32(18).fork()).join();
}
if (message.source !== "") {
writer.uint32(26).string(message.source);
@@ -170,14 +170,14 @@ export const UserProfile: MessageFns<UserProfile> = {
break;
}
- message.lastLoginTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastLoginTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
- message.lastChangePasswordTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastChangePasswordTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -208,10 +208,10 @@ export const UserProfile: MessageFns<UserProfile> = {
toJSON(message: UserProfile): unknown {
const obj: any = {};
if (message.lastLoginTime !== undefined) {
- obj.lastLoginTime = message.lastLoginTime.toISOString();
+ obj.lastLoginTime = fromTimestamp(message.lastLoginTime).toISOString();
}
if (message.lastChangePasswordTime !== undefined) {
- obj.lastChangePasswordTime = message.lastChangePasswordTime.toISOString();
+ obj.lastChangePasswordTime = fromTimestamp(message.lastChangePasswordTime).toISOString();
}
if (message.source !== "") {
obj.source = message.source;
@@ -224,8 +224,13 @@ export const UserProfile: MessageFns<UserProfile> = {
},
fromPartial(object: DeepPartial<UserProfile>): UserProfile {
const message = createBaseUserProfile();
- message.lastLoginTime = object.lastLoginTime ?? undefined;
- message.lastChangePasswordTime = object.lastChangePasswordTime ?? undefined;
+ message.lastLoginTime = (object.lastLoginTime !== undefined && object.lastLoginTime !== null)
+ ? Timestamp.fromPartial(object.lastLoginTime)
+ : undefined;
+ message.lastChangePasswordTime =
+ (object.lastChangePasswordTime !== undefined && object.lastChangePasswordTime !== null)
+ ? Timestamp.fromPartial(object.lastChangePasswordTime)
+ : undefined;
message.source = object.source ?? "";
return message;
},
@@ -251,13 +256,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/actuator_service.ts b/frontend/src/types/proto/v1/actuator_service.ts
index b234c7179a..7b029556af 100644
--- a/frontend/src/types/proto/v1/actuator_service.ts
+++ b/frontend/src/types/proto/v1/actuator_service.ts
@@ -66,7 +66,7 @@ export interface ActuatorInfo {
disallowSignup: boolean;
/** last_active_time is the service last active time in UTC Time Format, any API calls will refresh this value. */
lastActiveTime:
- | Date
+ | Timestamp
| undefined;
/** require_2fa is the flag to require 2FA for all users. */
require2fa: boolean;
@@ -409,7 +409,7 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
writer.uint32(80).bool(message.disallowSignup);
}
if (message.lastActiveTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastActiveTime), writer.uint32(90).fork()).join();
+ Timestamp.encode(message.lastActiveTime, writer.uint32(90).fork()).join();
}
if (message.require2fa !== false) {
writer.uint32(96).bool(message.require2fa);
@@ -526,7 +526,7 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
break;
}
- message.lastActiveTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastActiveTime = Timestamp.decode(reader, reader.uint32());
continue;
case 12:
if (tag !== 96) {
@@ -672,7 +672,7 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
obj.disallowSignup = message.disallowSignup;
}
if (message.lastActiveTime !== undefined) {
- obj.lastActiveTime = message.lastActiveTime.toISOString();
+ obj.lastActiveTime = fromTimestamp(message.lastActiveTime).toISOString();
}
if (message.require2fa !== false) {
obj.require2fa = message.require2fa;
@@ -722,7 +722,9 @@ export const ActuatorInfo: MessageFns<ActuatorInfo> = {
message.externalUrl = object.externalUrl ?? "";
message.needAdminSetup = object.needAdminSetup ?? false;
message.disallowSignup = object.disallowSignup ?? false;
- message.lastActiveTime = object.lastActiveTime ?? undefined;
+ message.lastActiveTime = (object.lastActiveTime !== undefined && object.lastActiveTime !== null)
+ ? Timestamp.fromPartial(object.lastActiveTime)
+ : undefined;
message.require2fa = object.require2fa ?? false;
message.workspaceId = object.workspaceId ?? "";
message.gitopsWebhookUrl = object.gitopsWebhookUrl ?? "";
@@ -951,13 +953,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/anomaly_service.ts b/frontend/src/types/proto/v1/anomaly_service.ts
index dc920ec388..7176356944 100644
--- a/frontend/src/types/proto/v1/anomaly_service.ts
+++ b/frontend/src/types/proto/v1/anomaly_service.ts
@@ -63,8 +63,8 @@ export interface Anomaly {
instanceConnectionDetail?: Anomaly_InstanceConnectionDetail | undefined;
databaseConnectionDetail?: Anomaly_DatabaseConnectionDetail | undefined;
databaseSchemaDriftDetail?: Anomaly_DatabaseSchemaDriftDetail | undefined;
- createTime: Date | undefined;
- updateTime: Date | undefined;
+ createTime: Timestamp | undefined;
+ updateTime: Timestamp | undefined;
}
/** AnomalyType is the type of the anomaly. */
@@ -448,10 +448,10 @@ export const Anomaly: MessageFns<Anomaly> = {
Anomaly_DatabaseSchemaDriftDetail.encode(message.databaseSchemaDriftDetail, writer.uint32(66).fork()).join();
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(74).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(74).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(82).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(82).fork()).join();
}
return writer;
},
@@ -510,14 +510,14 @@ export const Anomaly: MessageFns<Anomaly> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 82) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -572,10 +572,10 @@ export const Anomaly: MessageFns<Anomaly> = {
obj.databaseSchemaDriftDetail = Anomaly_DatabaseSchemaDriftDetail.toJSON(message.databaseSchemaDriftDetail);
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -600,8 +600,12 @@ export const Anomaly: MessageFns<Anomaly> = {
(object.databaseSchemaDriftDetail !== undefined && object.databaseSchemaDriftDetail !== null)
? Anomaly_DatabaseSchemaDriftDetail.fromPartial(object.databaseSchemaDriftDetail)
: undefined;
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -879,13 +883,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/audit_log_service.ts b/frontend/src/types/proto/v1/audit_log_service.ts
index 1b47d12ea5..54a597685d 100644
--- a/frontend/src/types/proto/v1/audit_log_service.ts
+++ b/frontend/src/types/proto/v1/audit_log_service.ts
@@ -94,7 +94,7 @@ export interface AuditLog {
*/
name: string;
createTime:
- | Date
+ | Timestamp
| undefined;
/** Format: users/[email protected] */
user: string;
@@ -615,7 +615,7 @@ export const AuditLog: MessageFns<AuditLog> = {
writer.uint32(10).string(message.name);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(18).fork()).join();
}
if (message.user !== "") {
writer.uint32(26).string(message.user);
@@ -666,7 +666,7 @@ export const AuditLog: MessageFns<AuditLog> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -762,7 +762,7 @@ export const AuditLog: MessageFns<AuditLog> = {
obj.name = message.name;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.user !== "") {
obj.user = message.user;
@@ -800,7 +800,9 @@ export const AuditLog: MessageFns<AuditLog> = {
fromPartial(object: DeepPartial<AuditLog>): AuditLog {
const message = createBaseAuditLog();
message.name = object.name ?? "";
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
message.user = object.user ?? "";
message.method = object.method ?? "";
message.severity = object.severity ?? AuditLog_Severity.DEFAULT;
@@ -1205,13 +1207,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/auth_service.ts b/frontend/src/types/proto/v1/auth_service.ts
index c663e00c56..2aecdab32f 100644
--- a/frontend/src/types/proto/v1/auth_service.ts
+++ b/frontend/src/types/proto/v1/auth_service.ts
@@ -235,9 +235,9 @@ export interface User {
}
export interface User_Profile {
- lastLoginTime: Date | undefined;
+ lastLoginTime: Timestamp | undefined;
lastChangePasswordTime:
- | Date
+ | Timestamp
| undefined;
/** source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. */
source: string;
@@ -1500,10 +1500,10 @@ function createBaseUser_Profile(): User_Profile {
export const User_Profile: MessageFns<User_Profile> = {
encode(message: User_Profile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.lastLoginTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastLoginTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.lastLoginTime, writer.uint32(10).fork()).join();
}
if (message.lastChangePasswordTime !== undefined) {
- Timestamp.encode(toTimestamp(message.lastChangePasswordTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.lastChangePasswordTime, writer.uint32(18).fork()).join();
}
if (message.source !== "") {
writer.uint32(26).string(message.source);
@@ -1523,14 +1523,14 @@ export const User_Profile: MessageFns<User_Profile> = {
break;
}
- message.lastLoginTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastLoginTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
- message.lastChangePasswordTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.lastChangePasswordTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -1561,10 +1561,10 @@ export const User_Profile: MessageFns<User_Profile> = {
toJSON(message: User_Profile): unknown {
const obj: any = {};
if (message.lastLoginTime !== undefined) {
- obj.lastLoginTime = message.lastLoginTime.toISOString();
+ obj.lastLoginTime = fromTimestamp(message.lastLoginTime).toISOString();
}
if (message.lastChangePasswordTime !== undefined) {
- obj.lastChangePasswordTime = message.lastChangePasswordTime.toISOString();
+ obj.lastChangePasswordTime = fromTimestamp(message.lastChangePasswordTime).toISOString();
}
if (message.source !== "") {
obj.source = message.source;
@@ -1577,8 +1577,13 @@ export const User_Profile: MessageFns<User_Profile> = {
},
fromPartial(object: DeepPartial<User_Profile>): User_Profile {
const message = createBaseUser_Profile();
- message.lastLoginTime = object.lastLoginTime ?? undefined;
- message.lastChangePasswordTime = object.lastChangePasswordTime ?? undefined;
+ message.lastLoginTime = (object.lastLoginTime !== undefined && object.lastLoginTime !== null)
+ ? Timestamp.fromPartial(object.lastLoginTime)
+ : undefined;
+ message.lastChangePasswordTime =
+ (object.lastChangePasswordTime !== undefined && object.lastChangePasswordTime !== null)
+ ? Timestamp.fromPartial(object.lastChangePasswordTime)
+ : undefined;
message.source = object.source ?? "";
return message;
},
@@ -1889,13 +1894,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/branch_service.ts b/frontend/src/types/proto/v1/branch_service.ts
index bd5e015f05..8b8583276b 100644
--- a/frontend/src/types/proto/v1/branch_service.ts
+++ b/frontend/src/types/proto/v1/branch_service.ts
@@ -122,10 +122,10 @@ export interface Branch {
updater: string;
/** The timestamp when the branch was created. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** The timestamp when the branch was last updated. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface GetBranchRequest {
@@ -399,10 +399,10 @@ export const Branch: MessageFns<Branch> = {
writer.uint32(98).string(message.updater);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(106).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(106).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(114).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(114).fork()).join();
}
return writer;
},
@@ -503,14 +503,14 @@ export const Branch: MessageFns<Branch> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 14:
if (tag !== 114) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -581,10 +581,10 @@ export const Branch: MessageFns<Branch> = {
obj.updater = message.updater;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -611,8 +611,12 @@ export const Branch: MessageFns<Branch> = {
message.etag = object.etag ?? "";
message.creator = object.creator ?? "";
message.updater = object.updater ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -2268,13 +2272,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/changelist_service.ts b/frontend/src/types/proto/v1/changelist_service.ts
index 6378c674f6..ebdbaf3975 100644
--- a/frontend/src/types/proto/v1/changelist_service.ts
+++ b/frontend/src/types/proto/v1/changelist_service.ts
@@ -116,10 +116,10 @@ export interface Changelist {
updater: string;
/** The create time of the changelist. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** The last update time of the changelist. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
changes: Changelist_Change[];
}
@@ -610,10 +610,10 @@ export const Changelist: MessageFns<Changelist> = {
writer.uint32(34).string(message.updater);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
for (const v of message.changes) {
Changelist_Change.encode(v!, writer.uint32(58).fork()).join();
@@ -661,14 +661,14 @@ export const Changelist: MessageFns<Changelist> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -715,10 +715,10 @@ export const Changelist: MessageFns<Changelist> = {
obj.updater = message.updater;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.changes?.length) {
obj.changes = message.changes.map((e) => Changelist_Change.toJSON(e));
@@ -735,8 +735,12 @@ export const Changelist: MessageFns<Changelist> = {
message.description = object.description ?? "";
message.creator = object.creator ?? "";
message.updater = object.updater ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.changes = object.changes?.map((e) => Changelist_Change.fromPartial(e)) || [];
return message;
},
@@ -1300,13 +1304,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/database_service.ts b/frontend/src/types/proto/v1/database_service.ts
index aa3fc246ba..556d17d2a7 100644
--- a/frontend/src/types/proto/v1/database_service.ts
+++ b/frontend/src/types/proto/v1/database_service.ts
@@ -358,7 +358,7 @@ export interface Database {
syncState: State;
/** The latest synchronization time. */
successfulSyncTime:
- | Date
+ | Timestamp
| undefined;
/**
* The project for a database.
@@ -1100,7 +1100,7 @@ export interface TableConfig {
*/
sourceBranch: string;
/** The timestamp when the table is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface FunctionConfig {
@@ -1117,7 +1117,7 @@ export interface FunctionConfig {
*/
sourceBranch: string;
/** The timestamp when the function is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ProcedureConfig {
@@ -1134,7 +1134,7 @@ export interface ProcedureConfig {
*/
sourceBranch: string;
/** The timestamp when the procedure is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ViewConfig {
@@ -1151,7 +1151,7 @@ export interface ViewConfig {
*/
sourceBranch: string;
/** The timestamp when the view is updated in branch. */
- updateTime: Date | undefined;
+ updateTime: Timestamp | undefined;
}
export interface ColumnConfig {
@@ -1233,7 +1233,7 @@ export interface SlowQueryStatistics {
count: number;
/** The latest log time of the slow query log. */
latestLogTime:
- | Date
+ | Timestamp
| undefined;
/** The average query time of the slow query log. */
averageQueryTime:
@@ -1263,7 +1263,7 @@ export interface SlowQueryStatistics {
export interface SlowQueryDetails {
/** The start time of the slow query log. */
startTime:
- | Date
+ | Timestamp
| undefined;
/** The query time of the slow query log. */
queryTime:
@@ -1346,11 +1346,11 @@ export interface Secret {
name: string;
/** Not used. The timestamp when the secret resource was created initially. */
createdTime:
- | Date
+ | Timestamp
| undefined;
/** Not used. The timestamp when the secret resource was updated. */
updatedTime:
- | Date
+ | Timestamp
| undefined;
/** The value of the secret. */
value: string;
@@ -1383,9 +1383,9 @@ export interface ChangeHistory {
creator: string;
/** Format: users/[email protected] */
updater: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
updateTime:
- | Date
+ | Timestamp
| undefined;
/** release version of Bytebase */
releaseVersion: string;
@@ -1782,7 +1782,7 @@ export interface Revision {
/** Format: users/[email protected] */
creator: string;
createTime:
- | Date
+ | Timestamp
| undefined;
/**
* The sheet that holds the content.
@@ -2962,7 +2962,7 @@ export const Database: MessageFns<Database> = {
writer.uint32(24).int32(stateToNumber(message.syncState));
}
if (message.successfulSyncTime !== undefined) {
- Timestamp.encode(toTimestamp(message.successfulSyncTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.successfulSyncTime, writer.uint32(34).fork()).join();
}
if (message.project !== "") {
writer.uint32(42).string(message.project);
@@ -3014,7 +3014,7 @@ export const Database: MessageFns<Database> = {
break;
}
- message.successfulSyncTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.successfulSyncTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
@@ -3106,7 +3106,7 @@ export const Database: MessageFns<Database> = {
obj.syncState = stateToJSON(message.syncState);
}
if (message.successfulSyncTime !== undefined) {
- obj.successfulSyncTime = message.successfulSyncTime.toISOString();
+ obj.successfulSyncTime = fromTimestamp(message.successfulSyncTime).toISOString();
}
if (message.project !== "") {
obj.project = message.project;
@@ -3145,7 +3145,9 @@ export const Database: MessageFns<Database> = {
const message = createBaseDatabase();
message.name = object.name ?? "";
message.syncState = object.syncState ?? State.STATE_UNSPECIFIED;
- message.successfulSyncTime = object.successfulSyncTime ?? undefined;
+ message.successfulSyncTime = (object.successfulSyncTime !== undefined && object.successfulSyncTime !== null)
+ ? Timestamp.fromPartial(object.successfulSyncTime)
+ : undefined;
message.project = object.project ?? "";
message.schemaVersion = object.schemaVersion ?? "";
message.environment = object.environment ?? "";
@@ -6169,7 +6171,7 @@ export const TableConfig: MessageFns<TableConfig> = {
writer.uint32(50).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(42).fork()).join();
}
return writer;
},
@@ -6221,7 +6223,7 @@ export const TableConfig: MessageFns<TableConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -6263,7 +6265,7 @@ export const TableConfig: MessageFns<TableConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -6278,7 +6280,9 @@ export const TableConfig: MessageFns<TableConfig> = {
message.classificationId = object.classificationId ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -6299,7 +6303,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -6337,7 +6341,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -6369,7 +6373,7 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -6382,7 +6386,9 @@ export const FunctionConfig: MessageFns<FunctionConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -6403,7 +6409,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -6441,7 +6447,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -6473,7 +6479,7 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -6486,7 +6492,9 @@ export const ProcedureConfig: MessageFns<ProcedureConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -6507,7 +6515,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
writer.uint32(34).string(message.sourceBranch);
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(26).fork()).join();
}
return writer;
},
@@ -6545,7 +6553,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -6577,7 +6585,7 @@ export const ViewConfig: MessageFns<ViewConfig> = {
obj.sourceBranch = message.sourceBranch;
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
return obj;
},
@@ -6590,7 +6598,9 @@ export const ViewConfig: MessageFns<ViewConfig> = {
message.name = object.name ?? "";
message.updater = object.updater ?? "";
message.sourceBranch = object.sourceBranch ?? "";
- message.updateTime = object.updateTime ?? undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
return message;
},
};
@@ -7116,7 +7126,7 @@ export const SlowQueryStatistics: MessageFns<SlowQueryStatistics> = {
writer.uint32(16).int32(message.count);
}
if (message.latestLogTime !== undefined) {
- Timestamp.encode(toTimestamp(message.latestLogTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.latestLogTime, writer.uint32(26).fork()).join();
}
if (message.averageQueryTime !== undefined) {
Duration.encode(message.averageQueryTime, writer.uint32(34).fork()).join();
@@ -7174,7 +7184,7 @@ export const SlowQueryStatistics: MessageFns<SlowQueryStatistics> = {
break;
}
- message.latestLogTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.latestLogTime = Timestamp.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
@@ -7276,7 +7286,7 @@ export const SlowQueryStatistics: MessageFns<SlowQueryStatistics> = {
obj.count = Math.round(message.count);
}
if (message.latestLogTime !== undefined) {
- obj.latestLogTime = message.latestLogTime.toISOString();
+ obj.latestLogTime = fromTimestamp(message.latestLogTime).toISOString();
}
if (message.averageQueryTime !== undefined) {
obj.averageQueryTime = Duration.toJSON(message.averageQueryTime);
@@ -7315,7 +7325,9 @@ export const SlowQueryStatistics: MessageFns<SlowQueryStatistics> = {
const message = createBaseSlowQueryStatistics();
message.sqlFingerprint = object.sqlFingerprint ?? "";
message.count = object.count ?? 0;
- message.latestLogTime = object.latestLogTime ?? undefined;
+ message.latestLogTime = (object.latestLogTime !== undefined && object.latestLogTime !== null)
+ ? Timestamp.fromPartial(object.latestLogTime)
+ : undefined;
message.averageQueryTime = (object.averageQueryTime !== undefined && object.averageQueryTime !== null)
? Duration.fromPartial(object.averageQueryTime)
: undefined;
@@ -7340,7 +7352,7 @@ function createBaseSlowQueryDetails(): SlowQueryDetails {
export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
encode(message: SlowQueryDetails, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.startTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.startTime, writer.uint32(10).fork()).join();
}
if (message.queryTime !== undefined) {
Duration.encode(message.queryTime, writer.uint32(18).fork()).join();
@@ -7372,7 +7384,7 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
break;
}
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
@@ -7432,7 +7444,7 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
toJSON(message: SlowQueryDetails): unknown {
const obj: any = {};
if (message.startTime !== undefined) {
- obj.startTime = message.startTime.toISOString();
+ obj.startTime = fromTimestamp(message.startTime).toISOString();
}
if (message.queryTime !== undefined) {
obj.queryTime = Duration.toJSON(message.queryTime);
@@ -7457,7 +7469,9 @@ export const SlowQueryDetails: MessageFns<SlowQueryDetails> = {
},
fromPartial(object: DeepPartial<SlowQueryDetails>): SlowQueryDetails {
const message = createBaseSlowQueryDetails();
- message.startTime = object.startTime ?? undefined;
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
+ ? Timestamp.fromPartial(object.startTime)
+ : undefined;
message.queryTime = (object.queryTime !== undefined && object.queryTime !== null)
? Duration.fromPartial(object.queryTime)
: undefined;
@@ -7792,10 +7806,10 @@ export const Secret: MessageFns<Secret> = {
writer.uint32(10).string(message.name);
}
if (message.createdTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createdTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.createdTime, writer.uint32(18).fork()).join();
}
if (message.updatedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updatedTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.updatedTime, writer.uint32(26).fork()).join();
}
if (message.value !== "") {
writer.uint32(34).string(message.value);
@@ -7825,14 +7839,14 @@ export const Secret: MessageFns<Secret> = {
break;
}
- message.createdTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createdTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
- message.updatedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updatedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
@@ -7873,10 +7887,10 @@ export const Secret: MessageFns<Secret> = {
obj.name = message.name;
}
if (message.createdTime !== undefined) {
- obj.createdTime = message.createdTime.toISOString();
+ obj.createdTime = fromTimestamp(message.createdTime).toISOString();
}
if (message.updatedTime !== undefined) {
- obj.updatedTime = message.updatedTime.toISOString();
+ obj.updatedTime = fromTimestamp(message.updatedTime).toISOString();
}
if (message.value !== "") {
obj.value = message.value;
@@ -7893,8 +7907,12 @@ export const Secret: MessageFns<Secret> = {
fromPartial(object: DeepPartial<Secret>): Secret {
const message = createBaseSecret();
message.name = object.name ?? "";
- message.createdTime = object.createdTime ?? undefined;
- message.updatedTime = object.updatedTime ?? undefined;
+ message.createdTime = (object.createdTime !== undefined && object.createdTime !== null)
+ ? Timestamp.fromPartial(object.createdTime)
+ : undefined;
+ message.updatedTime = (object.updatedTime !== undefined && object.updatedTime !== null)
+ ? Timestamp.fromPartial(object.updatedTime)
+ : undefined;
message.value = object.value ?? "";
message.description = object.description ?? "";
return message;
@@ -8102,10 +8120,10 @@ export const ChangeHistory: MessageFns<ChangeHistory> = {
writer.uint32(34).string(message.updater);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
if (message.releaseVersion !== "") {
writer.uint32(58).string(message.releaseVersion);
@@ -8191,14 +8209,14 @@ export const ChangeHistory: MessageFns<ChangeHistory> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -8363,10 +8381,10 @@ export const ChangeHistory: MessageFns<ChangeHistory> = {
obj.updater = message.updater;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.releaseVersion !== "") {
obj.releaseVersion = message.releaseVersion;
@@ -8427,8 +8445,12 @@ export const ChangeHistory: MessageFns<ChangeHistory> = {
message.name = object.name ?? "";
message.creator = object.creator ?? "";
message.updater = object.updater ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.releaseVersion = object.releaseVersion ?? "";
message.source = object.source ?? ChangeHistory_Source.SOURCE_UNSPECIFIED;
message.type = object.type ?? ChangeHistory_Type.TYPE_UNSPECIFIED;
@@ -9520,7 +9542,7 @@ export const Revision: MessageFns<Revision> = {
writer.uint32(26).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(34).fork()).join();
}
if (message.sheet !== "") {
writer.uint32(42).string(message.sheet);
@@ -9576,7 +9598,7 @@ export const Revision: MessageFns<Revision> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
@@ -9656,7 +9678,7 @@ export const Revision: MessageFns<Revision> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.sheet !== "") {
obj.sheet = message.sheet;
@@ -9687,7 +9709,9 @@ export const Revision: MessageFns<Revision> = {
message.name = object.name ?? "";
message.release = object.release ?? "";
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
message.sheet = object.sheet ?? "";
message.sheetSha1 = object.sheetSha1 ?? "";
message.type = object.type ?? ReleaseFileType.TYPE_UNSPECIFIED;
@@ -11316,13 +11340,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/group.ts b/frontend/src/types/proto/v1/group.ts
index 3e36c75cd0..36375faea2 100644
--- a/frontend/src/types/proto/v1/group.ts
+++ b/frontend/src/types/proto/v1/group.ts
@@ -155,7 +155,7 @@ export interface Group {
members: GroupMember[];
/** The timestamp when the group was created. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** source means where the group comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID. */
source: string;
@@ -650,7 +650,7 @@ export const Group: MessageFns<Group> = {
GroupMember.encode(v!, writer.uint32(42).fork()).join();
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(50).fork()).join();
}
if (message.source !== "") {
writer.uint32(58).string(message.source);
@@ -705,7 +705,7 @@ export const Group: MessageFns<Group> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -753,7 +753,7 @@ export const Group: MessageFns<Group> = {
obj.members = message.members.map((e) => GroupMember.toJSON(e));
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.source !== "") {
obj.source = message.source;
@@ -771,7 +771,9 @@ export const Group: MessageFns<Group> = {
message.description = object.description ?? "";
message.creator = object.creator ?? "";
message.members = object.members?.map((e) => GroupMember.fromPartial(e)) || [];
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
message.source = object.source ?? "";
return message;
},
@@ -974,13 +976,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/issue_service.ts b/frontend/src/types/proto/v1/issue_service.ts
index 1cca96222f..3f3ab7a859 100644
--- a/frontend/src/types/proto/v1/issue_service.ts
+++ b/frontend/src/types/proto/v1/issue_service.ts
@@ -256,9 +256,9 @@ export interface Issue {
subscribers: string[];
/** Format: users/[email protected] */
creator: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
updateTime:
- | Date
+ | Timestamp
| undefined;
/**
* The plan associated with the issue.
@@ -786,9 +786,9 @@ export interface IssueComment {
comment: string;
/** TODO: use struct message instead. */
payload: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
updateTime:
- | Date
+ | Timestamp
| undefined;
/** Format: users/{email} */
creator: string;
@@ -887,8 +887,8 @@ export interface IssueComment_TaskUpdate {
| undefined;
/** Format: projects/{project}/sheets/{sheet} */
toSheet?: string | undefined;
- fromEarliestAllowedTime?: Date | undefined;
- toEarliestAllowedTime?: Date | undefined;
+ fromEarliestAllowedTime?: Timestamp | undefined;
+ toEarliestAllowedTime?: Timestamp | undefined;
toStatus?: IssueComment_TaskUpdate_Status | undefined;
}
@@ -2028,10 +2028,10 @@ export const Issue: MessageFns<Issue> = {
writer.uint32(114).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(122).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(122).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(130).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(130).fork()).join();
}
if (message.plan !== "") {
writer.uint32(138).string(message.plan);
@@ -2146,14 +2146,14 @@ export const Issue: MessageFns<Issue> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 16:
if (tag !== 130) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 17:
if (tag !== 138) {
@@ -2294,10 +2294,10 @@ export const Issue: MessageFns<Issue> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.plan !== "") {
obj.plan = message.plan;
@@ -2345,8 +2345,12 @@ export const Issue: MessageFns<Issue> = {
message.approvalFindingError = object.approvalFindingError ?? "";
message.subscribers = object.subscribers?.map((e) => e) || [];
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.plan = object.plan ?? "";
message.rollout = object.rollout ?? "";
message.grantRequest = (object.grantRequest !== undefined && object.grantRequest !== null)
@@ -3334,10 +3338,10 @@ export const IssueComment: MessageFns<IssueComment> = {
writer.uint32(26).string(message.payload);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(34).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(42).fork()).join();
}
if (message.creator !== "") {
writer.uint32(58).string(message.creator);
@@ -3393,14 +3397,14 @@ export const IssueComment: MessageFns<IssueComment> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -3483,10 +3487,10 @@ export const IssueComment: MessageFns<IssueComment> = {
obj.payload = message.payload;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.creator !== "") {
obj.creator = message.creator;
@@ -3517,8 +3521,12 @@ export const IssueComment: MessageFns<IssueComment> = {
message.name = object.name ?? "";
message.comment = object.comment ?? "";
message.payload = object.payload ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.creator = object.creator ?? "";
message.approval = (object.approval !== undefined && object.approval !== null)
? IssueComment_Approval.fromPartial(object.approval)
@@ -3855,10 +3863,10 @@ export const IssueComment_TaskUpdate: MessageFns<IssueComment_TaskUpdate> = {
writer.uint32(26).string(message.toSheet);
}
if (message.fromEarliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.fromEarliestAllowedTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.fromEarliestAllowedTime, writer.uint32(34).fork()).join();
}
if (message.toEarliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.toEarliestAllowedTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.toEarliestAllowedTime, writer.uint32(42).fork()).join();
}
if (message.toStatus !== undefined) {
writer.uint32(48).int32(issueComment_TaskUpdate_StatusToNumber(message.toStatus));
@@ -3899,14 +3907,14 @@ export const IssueComment_TaskUpdate: MessageFns<IssueComment_TaskUpdate> = {
break;
}
- message.fromEarliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.fromEarliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
- message.toEarliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.toEarliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 48) {
@@ -3951,10 +3959,10 @@ export const IssueComment_TaskUpdate: MessageFns<IssueComment_TaskUpdate> = {
obj.toSheet = message.toSheet;
}
if (message.fromEarliestAllowedTime !== undefined) {
- obj.fromEarliestAllowedTime = message.fromEarliestAllowedTime.toISOString();
+ obj.fromEarliestAllowedTime = fromTimestamp(message.fromEarliestAllowedTime).toISOString();
}
if (message.toEarliestAllowedTime !== undefined) {
- obj.toEarliestAllowedTime = message.toEarliestAllowedTime.toISOString();
+ obj.toEarliestAllowedTime = fromTimestamp(message.toEarliestAllowedTime).toISOString();
}
if (message.toStatus !== undefined) {
obj.toStatus = issueComment_TaskUpdate_StatusToJSON(message.toStatus);
@@ -3970,8 +3978,14 @@ export const IssueComment_TaskUpdate: MessageFns<IssueComment_TaskUpdate> = {
message.tasks = object.tasks?.map((e) => e) || [];
message.fromSheet = object.fromSheet ?? undefined;
message.toSheet = object.toSheet ?? undefined;
- message.fromEarliestAllowedTime = object.fromEarliestAllowedTime ?? undefined;
- message.toEarliestAllowedTime = object.toEarliestAllowedTime ?? undefined;
+ message.fromEarliestAllowedTime =
+ (object.fromEarliestAllowedTime !== undefined && object.fromEarliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.fromEarliestAllowedTime)
+ : undefined;
+ message.toEarliestAllowedTime =
+ (object.toEarliestAllowedTime !== undefined && object.toEarliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.toEarliestAllowedTime)
+ : undefined;
message.toStatus = object.toStatus ?? undefined;
return message;
},
@@ -5105,13 +5119,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/plan_service.ts b/frontend/src/types/proto/v1/plan_service.ts
index 1262869747..5c159584e5 100644
--- a/frontend/src/types/proto/v1/plan_service.ts
+++ b/frontend/src/types/proto/v1/plan_service.ts
@@ -146,9 +146,9 @@ export interface Plan {
| undefined;
/** Format: users/[email protected] */
creator: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
updateTime:
- | Date
+ | Timestamp
| undefined;
/**
* The status count of the latest plan check runs.
@@ -168,7 +168,7 @@ export interface Plan_Step {
export interface Plan_Spec {
/** earliest_allowed_time the earliest execution time of the change. */
earliestAllowedTime:
- | Date
+ | Timestamp
| undefined;
/** A UUID4 string that uniquely identifies the Spec. */
id: string;
@@ -451,7 +451,7 @@ export interface PlanCheckRun {
results: PlanCheckRun_Result[];
/** error is set if the Status is FAILED. */
error: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
}
export enum PlanCheckRun_Type {
@@ -1277,10 +1277,10 @@ export const Plan: MessageFns<Plan> = {
writer.uint32(66).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(74).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(74).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(82).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(82).fork()).join();
}
Object.entries(message.planCheckRunStatusCount).forEach(([key, value]) => {
Plan_PlanCheckRunStatusCountEntry.encode({ key: key as any, value }, writer.uint32(90).fork()).join();
@@ -1349,14 +1349,14 @@ export const Plan: MessageFns<Plan> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 82) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 11:
if (tag !== 90) {
@@ -1421,10 +1421,10 @@ export const Plan: MessageFns<Plan> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.planCheckRunStatusCount) {
const entries = Object.entries(message.planCheckRunStatusCount);
@@ -1452,8 +1452,12 @@ export const Plan: MessageFns<Plan> = {
? Plan_VCSSource.fromPartial(object.vcsSource)
: undefined;
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.planCheckRunStatusCount = Object.entries(object.planCheckRunStatusCount ?? {}).reduce<
{ [key: string]: number }
>((acc, [key, value]) => {
@@ -1554,7 +1558,7 @@ function createBasePlan_Spec(): Plan_Spec {
export const Plan_Spec: MessageFns<Plan_Spec> = {
encode(message: Plan_Spec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.earliestAllowedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.earliestAllowedTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.earliestAllowedTime, writer.uint32(34).fork()).join();
}
if (message.id !== "") {
writer.uint32(42).string(message.id);
@@ -1586,7 +1590,7 @@ export const Plan_Spec: MessageFns<Plan_Spec> = {
break;
}
- message.earliestAllowedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.earliestAllowedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
@@ -1656,7 +1660,7 @@ export const Plan_Spec: MessageFns<Plan_Spec> = {
toJSON(message: Plan_Spec): unknown {
const obj: any = {};
if (message.earliestAllowedTime !== undefined) {
- obj.earliestAllowedTime = message.earliestAllowedTime.toISOString();
+ obj.earliestAllowedTime = fromTimestamp(message.earliestAllowedTime).toISOString();
}
if (message.id !== "") {
obj.id = message.id;
@@ -1681,7 +1685,9 @@ export const Plan_Spec: MessageFns<Plan_Spec> = {
},
fromPartial(object: DeepPartial<Plan_Spec>): Plan_Spec {
const message = createBasePlan_Spec();
- message.earliestAllowedTime = object.earliestAllowedTime ?? undefined;
+ message.earliestAllowedTime = (object.earliestAllowedTime !== undefined && object.earliestAllowedTime !== null)
+ ? Timestamp.fromPartial(object.earliestAllowedTime)
+ : undefined;
message.id = object.id ?? "";
message.dependsOnSpecs = object.dependsOnSpecs?.map((e) => e) || [];
message.createDatabaseConfig = (object.createDatabaseConfig !== undefined && object.createDatabaseConfig !== null)
@@ -2998,7 +3004,7 @@ export const PlanCheckRun: MessageFns<PlanCheckRun> = {
writer.uint32(66).string(message.error);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(74).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(74).fork()).join();
}
return writer;
},
@@ -3064,7 +3070,7 @@ export const PlanCheckRun: MessageFns<PlanCheckRun> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -3116,7 +3122,7 @@ export const PlanCheckRun: MessageFns<PlanCheckRun> = {
obj.error = message.error;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
return obj;
},
@@ -3133,7 +3139,9 @@ export const PlanCheckRun: MessageFns<PlanCheckRun> = {
message.sheet = object.sheet ?? "";
message.results = object.results?.map((e) => PlanCheckRun_Result.fromPartial(e)) || [];
message.error = object.error ?? "";
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
return message;
},
};
@@ -4132,13 +4140,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/release_service.ts b/frontend/src/types/proto/v1/release_service.ts
index e93156e5d7..adb43c0b80 100644
--- a/frontend/src/types/proto/v1/release_service.ts
+++ b/frontend/src/types/proto/v1/release_service.ts
@@ -117,7 +117,7 @@ export interface Release {
| undefined;
/** Format: users/[email protected] */
creator: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
}
export interface Release_File {
@@ -536,7 +536,7 @@ export const Release: MessageFns<Release> = {
writer.uint32(42).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(50).fork()).join();
}
return writer;
},
@@ -588,7 +588,7 @@ export const Release: MessageFns<Release> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -628,7 +628,7 @@ export const Release: MessageFns<Release> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
return obj;
},
@@ -645,7 +645,9 @@ export const Release: MessageFns<Release> = {
? Release_VCSSource.fromPartial(object.vcsSource)
: undefined;
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
return message;
},
};
@@ -1124,13 +1126,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/review_config_service.ts b/frontend/src/types/proto/v1/review_config_service.ts
index 98675e3e13..d28feb6f4a 100644
--- a/frontend/src/types/proto/v1/review_config_service.ts
+++ b/frontend/src/types/proto/v1/review_config_service.ts
@@ -85,8 +85,8 @@ export interface ReviewConfig {
enabled: boolean;
/** Format: users/[email protected] */
creator: string;
- createTime: Date | undefined;
- updateTime: Date | undefined;
+ createTime: Timestamp | undefined;
+ updateTime: Timestamp | undefined;
rules: SQLReviewRule[];
/**
* resources using the config.
@@ -522,10 +522,10 @@ export const ReviewConfig: MessageFns<ReviewConfig> = {
writer.uint32(34).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
for (const v of message.rules) {
SQLReviewRule.encode(v!, writer.uint32(58).fork()).join();
@@ -576,14 +576,14 @@ export const ReviewConfig: MessageFns<ReviewConfig> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -638,10 +638,10 @@ export const ReviewConfig: MessageFns<ReviewConfig> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.rules?.length) {
obj.rules = message.rules.map((e) => SQLReviewRule.toJSON(e));
@@ -661,8 +661,12 @@ export const ReviewConfig: MessageFns<ReviewConfig> = {
message.title = object.title ?? "";
message.enabled = object.enabled ?? false;
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.rules = object.rules?.map((e) => SQLReviewRule.fromPartial(e)) || [];
message.resources = object.resources?.map((e) => e) || [];
return message;
@@ -1117,13 +1121,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/rollout_service.ts b/frontend/src/types/proto/v1/rollout_service.ts
index fb9103e2f4..1ef6ff9444 100644
--- a/frontend/src/types/proto/v1/rollout_service.ts
+++ b/frontend/src/types/proto/v1/rollout_service.ts
@@ -461,8 +461,8 @@ export interface TaskRun {
creator: string;
/** Format: user/[email protected] */
updater: string;
- createTime: Date | undefined;
- updateTime: Date | undefined;
+ createTime: Timestamp | undefined;
+ updateTime: Timestamp | undefined;
title: string;
status: TaskRun_Status;
/** Below are the results of a task run. */
@@ -473,7 +473,7 @@ export interface TaskRun {
*/
changeHistory: string;
schemaVersion: string;
- startTime: Date | undefined;
+ startTime: Timestamp | undefined;
exportArchiveStatus: TaskRun_ExportArchiveStatus;
/** The prior backup detail that will be used to rollback the task run. */
priorBackupDetail: TaskRun_PriorBackupDetail | undefined;
@@ -636,7 +636,7 @@ export interface TaskRun_PriorBackupDetail_Item_Table {
}
export interface TaskRun_SchedulerInfo {
- reportTime: Date | undefined;
+ reportTime: Timestamp | undefined;
waitingCause: TaskRun_SchedulerInfo_WaitingCause | undefined;
}
@@ -660,7 +660,7 @@ export interface TaskRunLog {
export interface TaskRunLogEntry {
type: TaskRunLogEntry_Type;
- logTime: Date | undefined;
+ logTime: Timestamp | undefined;
deployId: string;
schemaDump: TaskRunLogEntry_SchemaDump | undefined;
commandExecute: TaskRunLogEntry_CommandExecute | undefined;
@@ -747,14 +747,14 @@ export function taskRunLogEntry_TypeToNumber(object: TaskRunLogEntry_Type): numb
}
export interface TaskRunLogEntry_SchemaDump {
- startTime: Date | undefined;
- endTime: Date | undefined;
+ startTime: Timestamp | undefined;
+ endTime: Timestamp | undefined;
error: string;
}
export interface TaskRunLogEntry_CommandExecute {
logTime:
- | Date
+ | Timestamp
| undefined;
/** The indexes of the executed commands. */
commandIndexes: number[];
@@ -762,7 +762,7 @@ export interface TaskRunLogEntry_CommandExecute {
}
export interface TaskRunLogEntry_CommandExecute_CommandResponse {
- logTime: Date | undefined;
+ logTime: Timestamp | undefined;
error: string;
affectedRows: number;
/**
@@ -773,8 +773,8 @@ export interface TaskRunLogEntry_CommandExecute_CommandResponse {
}
export interface TaskRunLogEntry_DatabaseSync {
- startTime: Date | undefined;
- endTime: Date | undefined;
+ startTime: Timestamp | undefined;
+ endTime: Timestamp | undefined;
error: string;
}
@@ -946,9 +946,9 @@ export interface TaskRunSession_Postgres_Session {
applicationName: string;
clientAddr?: string | undefined;
clientPort?: string | undefined;
- backendStart: Date | undefined;
- xactStart?: Date | undefined;
- queryStart?: Date | undefined;
+ backendStart: Timestamp | undefined;
+ xactStart?: Timestamp | undefined;
+ queryStart?: Timestamp | undefined;
}
export interface PreviewTaskRunRollbackRequest {
@@ -2856,10 +2856,10 @@ export const TaskRun: MessageFns<TaskRun> = {
writer.uint32(34).string(message.updater);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
if (message.title !== "") {
writer.uint32(58).string(message.title);
@@ -2877,7 +2877,7 @@ export const TaskRun: MessageFns<TaskRun> = {
writer.uint32(90).string(message.schemaVersion);
}
if (message.startTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(114).fork()).join();
+ Timestamp.encode(message.startTime, writer.uint32(114).fork()).join();
}
if (message.exportArchiveStatus !== TaskRun_ExportArchiveStatus.EXPORT_ARCHIVE_STATUS_UNSPECIFIED) {
writer.uint32(128).int32(taskRun_ExportArchiveStatusToNumber(message.exportArchiveStatus));
@@ -2924,14 +2924,14 @@ export const TaskRun: MessageFns<TaskRun> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -2973,7 +2973,7 @@ export const TaskRun: MessageFns<TaskRun> = {
break;
}
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startTime = Timestamp.decode(reader, reader.uint32());
continue;
case 16:
if (tag !== 128) {
@@ -3040,10 +3040,10 @@ export const TaskRun: MessageFns<TaskRun> = {
obj.updater = message.updater;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.title !== "") {
obj.title = message.title;
@@ -3061,7 +3061,7 @@ export const TaskRun: MessageFns<TaskRun> = {
obj.schemaVersion = message.schemaVersion;
}
if (message.startTime !== undefined) {
- obj.startTime = message.startTime.toISOString();
+ obj.startTime = fromTimestamp(message.startTime).toISOString();
}
if (message.exportArchiveStatus !== TaskRun_ExportArchiveStatus.EXPORT_ARCHIVE_STATUS_UNSPECIFIED) {
obj.exportArchiveStatus = taskRun_ExportArchiveStatusToJSON(message.exportArchiveStatus);
@@ -3083,14 +3083,20 @@ export const TaskRun: MessageFns<TaskRun> = {
message.name = object.name ?? "";
message.creator = object.creator ?? "";
message.updater = object.updater ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.title = object.title ?? "";
message.status = object.status ?? TaskRun_Status.STATUS_UNSPECIFIED;
message.detail = object.detail ?? "";
message.changeHistory = object.changeHistory ?? "";
message.schemaVersion = object.schemaVersion ?? "";
- message.startTime = object.startTime ?? undefined;
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
+ ? Timestamp.fromPartial(object.startTime)
+ : undefined;
message.exportArchiveStatus = object.exportArchiveStatus ??
TaskRun_ExportArchiveStatus.EXPORT_ARCHIVE_STATUS_UNSPECIFIED;
message.priorBackupDetail = (object.priorBackupDetail !== undefined && object.priorBackupDetail !== null)
@@ -3376,7 +3382,7 @@ function createBaseTaskRun_SchedulerInfo(): TaskRun_SchedulerInfo {
export const TaskRun_SchedulerInfo: MessageFns<TaskRun_SchedulerInfo> = {
encode(message: TaskRun_SchedulerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.reportTime !== undefined) {
- Timestamp.encode(toTimestamp(message.reportTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.reportTime, writer.uint32(10).fork()).join();
}
if (message.waitingCause !== undefined) {
TaskRun_SchedulerInfo_WaitingCause.encode(message.waitingCause, writer.uint32(18).fork()).join();
@@ -3396,7 +3402,7 @@ export const TaskRun_SchedulerInfo: MessageFns<TaskRun_SchedulerInfo> = {
break;
}
- message.reportTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.reportTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
@@ -3426,7 +3432,7 @@ export const TaskRun_SchedulerInfo: MessageFns<TaskRun_SchedulerInfo> = {
toJSON(message: TaskRun_SchedulerInfo): unknown {
const obj: any = {};
if (message.reportTime !== undefined) {
- obj.reportTime = message.reportTime.toISOString();
+ obj.reportTime = fromTimestamp(message.reportTime).toISOString();
}
if (message.waitingCause !== undefined) {
obj.waitingCause = TaskRun_SchedulerInfo_WaitingCause.toJSON(message.waitingCause);
@@ -3439,7 +3445,9 @@ export const TaskRun_SchedulerInfo: MessageFns<TaskRun_SchedulerInfo> = {
},
fromPartial(object: DeepPartial<TaskRun_SchedulerInfo>): TaskRun_SchedulerInfo {
const message = createBaseTaskRun_SchedulerInfo();
- message.reportTime = object.reportTime ?? undefined;
+ message.reportTime = (object.reportTime !== undefined && object.reportTime !== null)
+ ? Timestamp.fromPartial(object.reportTime)
+ : undefined;
message.waitingCause = (object.waitingCause !== undefined && object.waitingCause !== null)
? TaskRun_SchedulerInfo_WaitingCause.fromPartial(object.waitingCause)
: undefined;
@@ -3692,7 +3700,7 @@ export const TaskRunLogEntry: MessageFns<TaskRunLogEntry> = {
writer.uint32(8).int32(taskRunLogEntry_TypeToNumber(message.type));
}
if (message.logTime !== undefined) {
- Timestamp.encode(toTimestamp(message.logTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.logTime, writer.uint32(50).fork()).join();
}
if (message.deployId !== "") {
writer.uint32(98).string(message.deployId);
@@ -3734,7 +3742,7 @@ export const TaskRunLogEntry: MessageFns<TaskRunLogEntry> = {
break;
}
- message.logTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.logTime = Timestamp.decode(reader, reader.uint32());
continue;
case 12:
if (tag !== 98) {
@@ -3812,7 +3820,7 @@ export const TaskRunLogEntry: MessageFns<TaskRunLogEntry> = {
obj.type = taskRunLogEntry_TypeToJSON(message.type);
}
if (message.logTime !== undefined) {
- obj.logTime = message.logTime.toISOString();
+ obj.logTime = fromTimestamp(message.logTime).toISOString();
}
if (message.deployId !== "") {
obj.deployId = message.deployId;
@@ -3841,7 +3849,9 @@ export const TaskRunLogEntry: MessageFns<TaskRunLogEntry> = {
fromPartial(object: DeepPartial<TaskRunLogEntry>): TaskRunLogEntry {
const message = createBaseTaskRunLogEntry();
message.type = object.type ?? TaskRunLogEntry_Type.TYPE_UNSPECIFIED;
- message.logTime = object.logTime ?? undefined;
+ message.logTime = (object.logTime !== undefined && object.logTime !== null)
+ ? Timestamp.fromPartial(object.logTime)
+ : undefined;
message.deployId = object.deployId ?? "";
message.schemaDump = (object.schemaDump !== undefined && object.schemaDump !== null)
? TaskRunLogEntry_SchemaDump.fromPartial(object.schemaDump)
@@ -3869,10 +3879,10 @@ function createBaseTaskRunLogEntry_SchemaDump(): TaskRunLogEntry_SchemaDump {
export const TaskRunLogEntry_SchemaDump: MessageFns<TaskRunLogEntry_SchemaDump> = {
encode(message: TaskRunLogEntry_SchemaDump, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.startTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.startTime, writer.uint32(10).fork()).join();
}
if (message.endTime !== undefined) {
- Timestamp.encode(toTimestamp(message.endTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.endTime, writer.uint32(18).fork()).join();
}
if (message.error !== "") {
writer.uint32(26).string(message.error);
@@ -3892,14 +3902,14 @@ export const TaskRunLogEntry_SchemaDump: MessageFns<TaskRunLogEntry_SchemaDump>
break;
}
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
- message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.endTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -3928,10 +3938,10 @@ export const TaskRunLogEntry_SchemaDump: MessageFns<TaskRunLogEntry_SchemaDump>
toJSON(message: TaskRunLogEntry_SchemaDump): unknown {
const obj: any = {};
if (message.startTime !== undefined) {
- obj.startTime = message.startTime.toISOString();
+ obj.startTime = fromTimestamp(message.startTime).toISOString();
}
if (message.endTime !== undefined) {
- obj.endTime = message.endTime.toISOString();
+ obj.endTime = fromTimestamp(message.endTime).toISOString();
}
if (message.error !== "") {
obj.error = message.error;
@@ -3944,8 +3954,12 @@ export const TaskRunLogEntry_SchemaDump: MessageFns<TaskRunLogEntry_SchemaDump>
},
fromPartial(object: DeepPartial<TaskRunLogEntry_SchemaDump>): TaskRunLogEntry_SchemaDump {
const message = createBaseTaskRunLogEntry_SchemaDump();
- message.startTime = object.startTime ?? undefined;
- message.endTime = object.endTime ?? undefined;
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
+ ? Timestamp.fromPartial(object.startTime)
+ : undefined;
+ message.endTime = (object.endTime !== undefined && object.endTime !== null)
+ ? Timestamp.fromPartial(object.endTime)
+ : undefined;
message.error = object.error ?? "";
return message;
},
@@ -3958,7 +3972,7 @@ function createBaseTaskRunLogEntry_CommandExecute(): TaskRunLogEntry_CommandExec
export const TaskRunLogEntry_CommandExecute: MessageFns<TaskRunLogEntry_CommandExecute> = {
encode(message: TaskRunLogEntry_CommandExecute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.logTime !== undefined) {
- Timestamp.encode(toTimestamp(message.logTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.logTime, writer.uint32(10).fork()).join();
}
writer.uint32(18).fork();
for (const v of message.commandIndexes) {
@@ -3983,7 +3997,7 @@ export const TaskRunLogEntry_CommandExecute: MessageFns<TaskRunLogEntry_CommandE
break;
}
- message.logTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.logTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag === 16) {
@@ -4033,7 +4047,7 @@ export const TaskRunLogEntry_CommandExecute: MessageFns<TaskRunLogEntry_CommandE
toJSON(message: TaskRunLogEntry_CommandExecute): unknown {
const obj: any = {};
if (message.logTime !== undefined) {
- obj.logTime = message.logTime.toISOString();
+ obj.logTime = fromTimestamp(message.logTime).toISOString();
}
if (message.commandIndexes?.length) {
obj.commandIndexes = message.commandIndexes.map((e) => Math.round(e));
@@ -4049,7 +4063,9 @@ export const TaskRunLogEntry_CommandExecute: MessageFns<TaskRunLogEntry_CommandE
},
fromPartial(object: DeepPartial<TaskRunLogEntry_CommandExecute>): TaskRunLogEntry_CommandExecute {
const message = createBaseTaskRunLogEntry_CommandExecute();
- message.logTime = object.logTime ?? undefined;
+ message.logTime = (object.logTime !== undefined && object.logTime !== null)
+ ? Timestamp.fromPartial(object.logTime)
+ : undefined;
message.commandIndexes = object.commandIndexes?.map((e) => e) || [];
message.response = (object.response !== undefined && object.response !== null)
? TaskRunLogEntry_CommandExecute_CommandResponse.fromPartial(object.response)
@@ -4070,7 +4086,7 @@ export const TaskRunLogEntry_CommandExecute_CommandResponse: MessageFns<
writer: BinaryWriter = new BinaryWriter(),
): BinaryWriter {
if (message.logTime !== undefined) {
- Timestamp.encode(toTimestamp(message.logTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.logTime, writer.uint32(10).fork()).join();
}
if (message.error !== "") {
writer.uint32(18).string(message.error);
@@ -4098,7 +4114,7 @@ export const TaskRunLogEntry_CommandExecute_CommandResponse: MessageFns<
break;
}
- message.logTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.logTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
@@ -4154,7 +4170,7 @@ export const TaskRunLogEntry_CommandExecute_CommandResponse: MessageFns<
toJSON(message: TaskRunLogEntry_CommandExecute_CommandResponse): unknown {
const obj: any = {};
if (message.logTime !== undefined) {
- obj.logTime = message.logTime.toISOString();
+ obj.logTime = fromTimestamp(message.logTime).toISOString();
}
if (message.error !== "") {
obj.error = message.error;
@@ -4177,7 +4193,9 @@ export const TaskRunLogEntry_CommandExecute_CommandResponse: MessageFns<
object: DeepPartial<TaskRunLogEntry_CommandExecute_CommandResponse>,
): TaskRunLogEntry_CommandExecute_CommandResponse {
const message = createBaseTaskRunLogEntry_CommandExecute_CommandResponse();
- message.logTime = object.logTime ?? undefined;
+ message.logTime = (object.logTime !== undefined && object.logTime !== null)
+ ? Timestamp.fromPartial(object.logTime)
+ : undefined;
message.error = object.error ?? "";
message.affectedRows = object.affectedRows ?? 0;
message.allAffectedRows = object.allAffectedRows?.map((e) => e) || [];
@@ -4192,10 +4210,10 @@ function createBaseTaskRunLogEntry_DatabaseSync(): TaskRunLogEntry_DatabaseSync
export const TaskRunLogEntry_DatabaseSync: MessageFns<TaskRunLogEntry_DatabaseSync> = {
encode(message: TaskRunLogEntry_DatabaseSync, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.startTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startTime), writer.uint32(10).fork()).join();
+ Timestamp.encode(message.startTime, writer.uint32(10).fork()).join();
}
if (message.endTime !== undefined) {
- Timestamp.encode(toTimestamp(message.endTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.endTime, writer.uint32(18).fork()).join();
}
if (message.error !== "") {
writer.uint32(26).string(message.error);
@@ -4215,14 +4233,14 @@ export const TaskRunLogEntry_DatabaseSync: MessageFns<TaskRunLogEntry_DatabaseSy
break;
}
- message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startTime = Timestamp.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
- message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.endTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
@@ -4251,10 +4269,10 @@ export const TaskRunLogEntry_DatabaseSync: MessageFns<TaskRunLogEntry_DatabaseSy
toJSON(message: TaskRunLogEntry_DatabaseSync): unknown {
const obj: any = {};
if (message.startTime !== undefined) {
- obj.startTime = message.startTime.toISOString();
+ obj.startTime = fromTimestamp(message.startTime).toISOString();
}
if (message.endTime !== undefined) {
- obj.endTime = message.endTime.toISOString();
+ obj.endTime = fromTimestamp(message.endTime).toISOString();
}
if (message.error !== "") {
obj.error = message.error;
@@ -4267,8 +4285,12 @@ export const TaskRunLogEntry_DatabaseSync: MessageFns<TaskRunLogEntry_DatabaseSy
},
fromPartial(object: DeepPartial<TaskRunLogEntry_DatabaseSync>): TaskRunLogEntry_DatabaseSync {
const message = createBaseTaskRunLogEntry_DatabaseSync();
- message.startTime = object.startTime ?? undefined;
- message.endTime = object.endTime ?? undefined;
+ message.startTime = (object.startTime !== undefined && object.startTime !== null)
+ ? Timestamp.fromPartial(object.startTime)
+ : undefined;
+ message.endTime = (object.endTime !== undefined && object.endTime !== null)
+ ? Timestamp.fromPartial(object.endTime)
+ : undefined;
message.error = object.error ?? "";
return message;
},
@@ -4695,13 +4717,13 @@ export const TaskRunSession_Postgres_Session: MessageFns<TaskRunSession_Postgres
writer.uint32(90).string(message.clientPort);
}
if (message.backendStart !== undefined) {
- Timestamp.encode(toTimestamp(message.backendStart), writer.uint32(98).fork()).join();
+ Timestamp.encode(message.backendStart, writer.uint32(98).fork()).join();
}
if (message.xactStart !== undefined) {
- Timestamp.encode(toTimestamp(message.xactStart), writer.uint32(106).fork()).join();
+ Timestamp.encode(message.xactStart, writer.uint32(106).fork()).join();
}
if (message.queryStart !== undefined) {
- Timestamp.encode(toTimestamp(message.queryStart), writer.uint32(114).fork()).join();
+ Timestamp.encode(message.queryStart, writer.uint32(114).fork()).join();
}
return writer;
},
@@ -4795,21 +4817,21 @@ export const TaskRunSession_Postgres_Session: MessageFns<TaskRunSession_Postgres
break;
}
- message.backendStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.backendStart = Timestamp.decode(reader, reader.uint32());
continue;
case 13:
if (tag !== 106) {
break;
}
- message.xactStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.xactStart = Timestamp.decode(reader, reader.uint32());
continue;
case 14:
if (tag !== 114) {
break;
}
- message.queryStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.queryStart = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -4877,13 +4899,13 @@ export const TaskRunSession_Postgres_Session: MessageFns<TaskRunSession_Postgres
obj.clientPort = message.clientPort;
}
if (message.backendStart !== undefined) {
- obj.backendStart = message.backendStart.toISOString();
+ obj.backendStart = fromTimestamp(message.backendStart).toISOString();
}
if (message.xactStart !== undefined) {
- obj.xactStart = message.xactStart.toISOString();
+ obj.xactStart = fromTimestamp(message.xactStart).toISOString();
}
if (message.queryStart !== undefined) {
- obj.queryStart = message.queryStart.toISOString();
+ obj.queryStart = fromTimestamp(message.queryStart).toISOString();
}
return obj;
},
@@ -4904,9 +4926,15 @@ export const TaskRunSession_Postgres_Session: MessageFns<TaskRunSession_Postgres
message.applicationName = object.applicationName ?? "";
message.clientAddr = object.clientAddr ?? undefined;
message.clientPort = object.clientPort ?? undefined;
- message.backendStart = object.backendStart ?? undefined;
- message.xactStart = object.xactStart ?? undefined;
- message.queryStart = object.queryStart ?? undefined;
+ message.backendStart = (object.backendStart !== undefined && object.backendStart !== null)
+ ? Timestamp.fromPartial(object.backendStart)
+ : undefined;
+ message.xactStart = (object.xactStart !== undefined && object.xactStart !== null)
+ ? Timestamp.fromPartial(object.xactStart)
+ : undefined;
+ message.queryStart = (object.queryStart !== undefined && object.queryStart !== null)
+ ? Timestamp.fromPartial(object.queryStart)
+ : undefined;
return message;
},
};
@@ -5887,13 +5915,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/setting_service.ts b/frontend/src/types/proto/v1/setting_service.ts
index 8a85f6d4c3..c98db0fca3 100644
--- a/frontend/src/types/proto/v1/setting_service.ts
+++ b/frontend/src/types/proto/v1/setting_service.ts
@@ -525,8 +525,8 @@ export interface SchemaTemplateSetting_TableTemplate {
export interface WorkspaceTrialSetting {
instanceCount: number;
- expireTime: Date | undefined;
- issuedTime: Date | undefined;
+ expireTime: Timestamp | undefined;
+ issuedTime: Timestamp | undefined;
subject: string;
orgName: string;
plan: PlanType;
@@ -3282,10 +3282,10 @@ export const WorkspaceTrialSetting: MessageFns<WorkspaceTrialSetting> = {
writer.uint32(8).int32(message.instanceCount);
}
if (message.expireTime !== undefined) {
- Timestamp.encode(toTimestamp(message.expireTime), writer.uint32(18).fork()).join();
+ Timestamp.encode(message.expireTime, writer.uint32(18).fork()).join();
}
if (message.issuedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.issuedTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.issuedTime, writer.uint32(26).fork()).join();
}
if (message.subject !== "") {
writer.uint32(34).string(message.subject);
@@ -3318,14 +3318,14 @@ export const WorkspaceTrialSetting: MessageFns<WorkspaceTrialSetting> = {
break;
}
- message.expireTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.expireTime = Timestamp.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
- message.issuedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.issuedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
@@ -3374,10 +3374,10 @@ export const WorkspaceTrialSetting: MessageFns<WorkspaceTrialSetting> = {
obj.instanceCount = Math.round(message.instanceCount);
}
if (message.expireTime !== undefined) {
- obj.expireTime = message.expireTime.toISOString();
+ obj.expireTime = fromTimestamp(message.expireTime).toISOString();
}
if (message.issuedTime !== undefined) {
- obj.issuedTime = message.issuedTime.toISOString();
+ obj.issuedTime = fromTimestamp(message.issuedTime).toISOString();
}
if (message.subject !== "") {
obj.subject = message.subject;
@@ -3397,8 +3397,12 @@ export const WorkspaceTrialSetting: MessageFns<WorkspaceTrialSetting> = {
fromPartial(object: DeepPartial<WorkspaceTrialSetting>): WorkspaceTrialSetting {
const message = createBaseWorkspaceTrialSetting();
message.instanceCount = object.instanceCount ?? 0;
- message.expireTime = object.expireTime ?? undefined;
- message.issuedTime = object.issuedTime ?? undefined;
+ message.expireTime = (object.expireTime !== undefined && object.expireTime !== null)
+ ? Timestamp.fromPartial(object.expireTime)
+ : undefined;
+ message.issuedTime = (object.issuedTime !== undefined && object.issuedTime !== null)
+ ? Timestamp.fromPartial(object.issuedTime)
+ : undefined;
message.subject = object.subject ?? "";
message.orgName = object.orgName ?? "";
message.plan = object.plan ?? PlanType.PLAN_TYPE_UNSPECIFIED;
@@ -5195,13 +5199,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/sheet_service.ts b/frontend/src/types/proto/v1/sheet_service.ts
index e7d80fdffd..ab116dda3f 100644
--- a/frontend/src/types/proto/v1/sheet_service.ts
+++ b/frontend/src/types/proto/v1/sheet_service.ts
@@ -77,11 +77,11 @@ export interface Sheet {
creator: string;
/** The create time of the sheet. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** The last update time of the sheet. */
updateTime:
- | Date
+ | Timestamp
| undefined;
/**
* The content of the sheet.
@@ -415,10 +415,10 @@ export const Sheet: MessageFns<Sheet> = {
writer.uint32(34).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
if (message.content.length !== 0) {
writer.uint32(58).bytes(message.content);
@@ -475,14 +475,14 @@ export const Sheet: MessageFns<Sheet> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -551,10 +551,10 @@ export const Sheet: MessageFns<Sheet> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.content.length !== 0) {
obj.content = base64FromBytes(message.content);
@@ -580,8 +580,12 @@ export const Sheet: MessageFns<Sheet> = {
message.database = object.database ?? "";
message.title = object.title ?? "";
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.content = object.content ?? new Uint8Array(0);
message.contentSize = (object.contentSize !== undefined && object.contentSize !== null)
? Long.fromValue(object.contentSize)
@@ -1004,13 +1008,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/sql_service.ts b/frontend/src/types/proto/v1/sql_service.ts
index 63464ca856..6879deea01 100644
--- a/frontend/src/types/proto/v1/sql_service.ts
+++ b/frontend/src/types/proto/v1/sql_service.ts
@@ -177,7 +177,7 @@ export interface RowValue {
| undefined;
/** value_value is used for Spanner and TUPLE ARRAY MAP in Clickhouse only. */
valueValue?: any | undefined;
- timestampValue?: Date | undefined;
+ timestampValue?: Timestamp | undefined;
}
export interface Advice {
@@ -476,7 +476,7 @@ export interface QueryHistory {
*/
database: string;
creator: string;
- createTime: Date | undefined;
+ createTime: Timestamp | undefined;
statement: string;
error?: string | undefined;
duration: Duration | undefined;
@@ -1829,7 +1829,7 @@ export const RowValue: MessageFns<RowValue> = {
Value.encode(Value.wrap(message.valueValue), writer.uint32(90).fork()).join();
}
if (message.timestampValue !== undefined) {
- Timestamp.encode(toTimestamp(message.timestampValue), writer.uint32(98).fork()).join();
+ Timestamp.encode(message.timestampValue, writer.uint32(98).fork()).join();
}
return writer;
},
@@ -1923,7 +1923,7 @@ export const RowValue: MessageFns<RowValue> = {
break;
}
- message.timestampValue = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.timestampValue = Timestamp.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
@@ -1987,7 +1987,7 @@ export const RowValue: MessageFns<RowValue> = {
obj.valueValue = message.valueValue;
}
if (message.timestampValue !== undefined) {
- obj.timestampValue = message.timestampValue.toISOString();
+ obj.timestampValue = fromTimestamp(message.timestampValue).toISOString();
}
return obj;
},
@@ -2012,7 +2012,9 @@ export const RowValue: MessageFns<RowValue> = {
? Long.fromValue(object.uint64Value)
: undefined;
message.valueValue = object.valueValue ?? undefined;
- message.timestampValue = object.timestampValue ?? undefined;
+ message.timestampValue = (object.timestampValue !== undefined && object.timestampValue !== null)
+ ? Timestamp.fromPartial(object.timestampValue)
+ : undefined;
return message;
},
};
@@ -3212,7 +3214,7 @@ export const QueryHistory: MessageFns<QueryHistory> = {
writer.uint32(26).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(34).fork()).join();
}
if (message.statement !== "") {
writer.uint32(42).string(message.statement);
@@ -3262,7 +3264,7 @@ export const QueryHistory: MessageFns<QueryHistory> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
@@ -3326,7 +3328,7 @@ export const QueryHistory: MessageFns<QueryHistory> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.statement !== "") {
obj.statement = message.statement;
@@ -3351,7 +3353,9 @@ export const QueryHistory: MessageFns<QueryHistory> = {
message.name = object.name ?? "";
message.database = object.database ?? "";
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
message.statement = object.statement ?? "";
message.error = object.error ?? undefined;
message.duration = (object.duration !== undefined && object.duration !== null)
@@ -4209,13 +4213,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/subscription_service.ts b/frontend/src/types/proto/v1/subscription_service.ts
index d4cdcd3603..faa1e9be65 100644
--- a/frontend/src/types/proto/v1/subscription_service.ts
+++ b/frontend/src/types/proto/v1/subscription_service.ts
@@ -88,8 +88,8 @@ export interface PatchSubscription {
export interface Subscription {
instanceCount: number;
- expiresTime: Date | undefined;
- startedTime: Date | undefined;
+ expiresTime: Timestamp | undefined;
+ startedTime: Timestamp | undefined;
plan: PlanType;
trialing: boolean;
orgId: string;
@@ -332,10 +332,10 @@ export const Subscription: MessageFns<Subscription> = {
writer.uint32(16).int32(message.instanceCount);
}
if (message.expiresTime !== undefined) {
- Timestamp.encode(toTimestamp(message.expiresTime), writer.uint32(26).fork()).join();
+ Timestamp.encode(message.expiresTime, writer.uint32(26).fork()).join();
}
if (message.startedTime !== undefined) {
- Timestamp.encode(toTimestamp(message.startedTime), writer.uint32(34).fork()).join();
+ Timestamp.encode(message.startedTime, writer.uint32(34).fork()).join();
}
if (message.plan !== PlanType.PLAN_TYPE_UNSPECIFIED) {
writer.uint32(40).int32(planTypeToNumber(message.plan));
@@ -371,14 +371,14 @@ export const Subscription: MessageFns<Subscription> = {
break;
}
- message.expiresTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.expiresTime = Timestamp.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
- message.startedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.startedTime = Timestamp.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 40) {
@@ -435,10 +435,10 @@ export const Subscription: MessageFns<Subscription> = {
obj.instanceCount = Math.round(message.instanceCount);
}
if (message.expiresTime !== undefined) {
- obj.expiresTime = message.expiresTime.toISOString();
+ obj.expiresTime = fromTimestamp(message.expiresTime).toISOString();
}
if (message.startedTime !== undefined) {
- obj.startedTime = message.startedTime.toISOString();
+ obj.startedTime = fromTimestamp(message.startedTime).toISOString();
}
if (message.plan !== PlanType.PLAN_TYPE_UNSPECIFIED) {
obj.plan = planTypeToJSON(message.plan);
@@ -461,8 +461,12 @@ export const Subscription: MessageFns<Subscription> = {
fromPartial(object: DeepPartial<Subscription>): Subscription {
const message = createBaseSubscription();
message.instanceCount = object.instanceCount ?? 0;
- message.expiresTime = object.expiresTime ?? undefined;
- message.startedTime = object.startedTime ?? undefined;
+ message.expiresTime = (object.expiresTime !== undefined && object.expiresTime !== null)
+ ? Timestamp.fromPartial(object.expiresTime)
+ : undefined;
+ message.startedTime = (object.startedTime !== undefined && object.startedTime !== null)
+ ? Timestamp.fromPartial(object.startedTime)
+ : undefined;
message.plan = object.plan ?? PlanType.PLAN_TYPE_UNSPECIFIED;
message.trialing = object.trialing ?? false;
message.orgId = object.orgId ?? "";
@@ -799,13 +803,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/vcs_connector_service.ts b/frontend/src/types/proto/v1/vcs_connector_service.ts
index 320690e82e..e5f334f474 100644
--- a/frontend/src/types/proto/v1/vcs_connector_service.ts
+++ b/frontend/src/types/proto/v1/vcs_connector_service.ts
@@ -117,11 +117,11 @@ export interface VCSConnector {
updater: string;
/** The create time of the vcsConnector. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** The last update time of the vcsConnector. */
updateTime:
- | Date
+ | Timestamp
| undefined;
/**
* The name of the VCS.
@@ -627,10 +627,10 @@ export const VCSConnector: MessageFns<VCSConnector> = {
writer.uint32(34).string(message.updater);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(42).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(42).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(50).fork()).join();
}
if (message.vcsProvider !== "") {
writer.uint32(58).string(message.vcsProvider);
@@ -696,14 +696,14 @@ export const VCSConnector: MessageFns<VCSConnector> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
@@ -796,10 +796,10 @@ export const VCSConnector: MessageFns<VCSConnector> = {
obj.updater = message.updater;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.vcsProvider !== "") {
obj.vcsProvider = message.vcsProvider;
@@ -834,8 +834,12 @@ export const VCSConnector: MessageFns<VCSConnector> = {
message.title = object.title ?? "";
message.creator = object.creator ?? "";
message.updater = object.updater ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.vcsProvider = object.vcsProvider ?? "";
message.externalId = object.externalId ?? "";
message.baseDirectory = object.baseDirectory ?? "";
@@ -1391,13 +1395,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/proto/v1/worksheet_service.ts b/frontend/src/types/proto/v1/worksheet_service.ts
index 037b57192d..67b03b1b42 100644
--- a/frontend/src/types/proto/v1/worksheet_service.ts
+++ b/frontend/src/types/proto/v1/worksheet_service.ts
@@ -150,11 +150,11 @@ export interface Worksheet {
creator: string;
/** The create time of the worksheet. */
createTime:
- | Date
+ | Timestamp
| undefined;
/** The last update time of the worksheet. */
updateTime:
- | Date
+ | Timestamp
| undefined;
/**
* The content of the worksheet.
@@ -831,10 +831,10 @@ export const Worksheet: MessageFns<Worksheet> = {
writer.uint32(42).string(message.creator);
}
if (message.createTime !== undefined) {
- Timestamp.encode(toTimestamp(message.createTime), writer.uint32(50).fork()).join();
+ Timestamp.encode(message.createTime, writer.uint32(50).fork()).join();
}
if (message.updateTime !== undefined) {
- Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(58).fork()).join();
+ Timestamp.encode(message.updateTime, writer.uint32(58).fork()).join();
}
if (message.content.length !== 0) {
writer.uint32(66).bytes(message.content);
@@ -898,14 +898,14 @@ export const Worksheet: MessageFns<Worksheet> = {
break;
}
- message.createTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.createTime = Timestamp.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
- message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ message.updateTime = Timestamp.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
@@ -980,10 +980,10 @@ export const Worksheet: MessageFns<Worksheet> = {
obj.creator = message.creator;
}
if (message.createTime !== undefined) {
- obj.createTime = message.createTime.toISOString();
+ obj.createTime = fromTimestamp(message.createTime).toISOString();
}
if (message.updateTime !== undefined) {
- obj.updateTime = message.updateTime.toISOString();
+ obj.updateTime = fromTimestamp(message.updateTime).toISOString();
}
if (message.content.length !== 0) {
obj.content = base64FromBytes(message.content);
@@ -1010,8 +1010,12 @@ export const Worksheet: MessageFns<Worksheet> = {
message.database = object.database ?? "";
message.title = object.title ?? "";
message.creator = object.creator ?? "";
- message.createTime = object.createTime ?? undefined;
- message.updateTime = object.updateTime ?? undefined;
+ message.createTime = (object.createTime !== undefined && object.createTime !== null)
+ ? Timestamp.fromPartial(object.createTime)
+ : undefined;
+ message.updateTime = (object.updateTime !== undefined && object.updateTime !== null)
+ ? Timestamp.fromPartial(object.updateTime)
+ : undefined;
message.content = object.content ?? new Uint8Array(0);
message.contentSize = (object.contentSize !== undefined && object.contentSize !== null)
? Long.fromValue(object.contentSize)
@@ -1462,13 +1466,13 @@ function fromTimestamp(t: Timestamp): Date {
return new globalThis.Date(millis);
}
-function fromJsonTimestamp(o: any): Date {
+function fromJsonTimestamp(o: any): Timestamp {
if (o instanceof globalThis.Date) {
- return o;
+ return toTimestamp(o);
} else if (typeof o === "string") {
- return new globalThis.Date(o);
+ return toTimestamp(new globalThis.Date(o));
} else {
- return fromTimestamp(Timestamp.fromJSON(o));
+ return Timestamp.fromJSON(o);
}
}
diff --git a/frontend/src/types/timestamp.ts b/frontend/src/types/timestamp.ts
new file mode 100644
index 0000000000..4c763a0232
--- /dev/null
+++ b/frontend/src/types/timestamp.ts
@@ -0,0 +1,20 @@
+import { Timestamp } from "./proto/google/protobuf/timestamp";
+
+export const getTimeForPbTimestamp = (
+ timestamp?: Timestamp,
+ defaultValue = Date.now()
+): number => {
+ if (!timestamp) {
+ return defaultValue;
+ }
+ return timestamp.seconds.toNumber() * 1000 + timestamp.nanos / 1000000;
+};
+
+export const getDateForPbTimestamp = (
+ timestamp?: Timestamp
+): Date | undefined => {
+ if (!timestamp) {
+ return undefined;
+ }
+ return new Date(getTimeForPbTimestamp(timestamp));
+};
diff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.ts
index 55426dbd2f..4f2d8b0bc4 100644
--- a/frontend/src/utils/v1/sql.ts
+++ b/frontend/src/utils/v1/sql.ts
@@ -1,5 +1,6 @@
import dayjs from "dayjs";
import Long from "long";
+import { getDateForPbTimestamp } from "@/types";
import { NullValue } from "@/types/proto/google/protobuf/struct";
import { Engine } from "@/types/proto/v1/common";
import { RowValue } from "@/types/proto/v1/sql_service";
@@ -50,7 +51,9 @@ export const extractSQLRowValue = (
if (value.timestampValue) {
const timestampValue = value.timestampValue;
return {
- plain: dayjs(timestampValue).format("YYYY-MM-DDTHH:mm:ss.SSSZ"),
+ plain: dayjs(getDateForPbTimestamp(timestampValue)).format(
+ "YYYY-MM-DDTHH:mm:ss.SSSZ"
+ ),
raw: timestampValue,
};
}
diff --git a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
index e8f36435ed..cac36376ef 100644
--- a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
+++ b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue
@@ -31,7 +31,7 @@ import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
import { emitWindowEvent } from "@/plugins";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useSheetV1Store } from "@/store";
-import { type ComposedIssue } from "@/types";
+import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
import {
extractProjectResourceName,
humanizeTs,
@@ -134,7 +134,8 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
width: 150,
resizable: true,
hide: !showExtendedColumns.value,
- render: (issue) => humanizeTs((issue.updateTime?.getTime() ?? 0) / 1000),
+ render: (issue) =>
+ humanizeTs(getTimeForPbTimestamp(issue.updateTime, 0) / 1000),
},
];
return columns.filter((column) => !column.hide);
diff --git a/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue b/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
index 32e998f327..3d7a75d26b 100644
--- a/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
+++ b/frontend/src/views/ReviewCenter/SQLReviewIssueDataTable/SQLReviewIssueDataTable.vue
@@ -30,7 +30,7 @@ import IssueStatusIconWithTaskSummary from "@/components/IssueV1/components/Issu
import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
import { emitWindowEvent } from "@/plugins";
import { useSheetV1Store } from "@/store";
-import { type ComposedIssue } from "@/types";
+import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";
import { humanizeTs, flattenSpecList, extractIssueUID } from "@/utils";
const { t } = useI18n();
@@ -127,7 +127,8 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
width: 150,
resizable: true,
hide: !showExtendedColumns.value,
- render: (issue) => humanizeTs((issue.updateTime?.getTime() ?? 0) / 1000),
+ render: (issue) =>
+ humanizeTs(getTimeForPbTimestamp(issue.updateTime, 0) / 1000),
},
];
return columns.filter((column) => !column.hide);
diff --git a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue
index 4ff3f7296a..dab7992b7d 100644
--- a/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/HistoryPane/HistoryPane.vue
@@ -67,7 +67,7 @@ import {
useSQLEditorQueryHistoryStore,
useSQLEditorTabStore,
} from "@/store";
-import type { SQLEditorTab } from "@/types";
+import { getDateForPbTimestamp, type SQLEditorTab } from "@/types";
import type { QueryHistory } from "@/types/proto/v1/sql_service";
import { getHighlightHTMLByKeyWords, defer } from "@/utils";
@@ -117,7 +117,9 @@ const data = computed(() => {
});
const titleOfQueryHistory = (history: QueryHistory) => {
- return dayjs(history.createTime).format("YYYY-MM-DD HH:mm:ss");
+ return dayjs(getDateForPbTimestamp(history.createTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ );
};
const notifyMessage = computed(() => {
diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SyncSchemaButton.vue b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SyncSchemaButton.vue
index ab80c93de5..dd396229f2 100644
--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SyncSchemaButton.vue
+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/SyncSchemaButton.vue
@@ -19,7 +19,9 @@
<div class="flex flex-col gap-1">
<i18n-t tag="div" keypath="sql-editor.last-synced">
<template #time>
- <HumanizeDate :date="database.successfulSyncTime" />
+ <HumanizeDate
+ :date="getDateForPbTimestamp(database.successfulSyncTime)"
+ />
</template>
</i18n-t>
<div v-if="!isSyncing">{{ $t("sql-editor.click-to-sync-now") }}</div>
@@ -39,7 +41,7 @@ import {
useDBSchemaV1Store,
useDatabaseV1Store,
} from "@/store";
-import { isValidDatabaseName } from "@/types";
+import { getDateForPbTimestamp, isValidDatabaseName } from "@/types";
import { DatabaseMetadataView } from "@/types/proto/v1/database_service";
defineOptions({
diff --git a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
index 2b9d6fd536..72e0faf979 100644
--- a/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
+++ b/frontend/src/views/sql-editor/SheetPanel/SheetTable/SheetTable.vue
@@ -23,7 +23,7 @@
{{ creatorForSheet(sheet) }}
</div>
<div class="bb-grid-cell">
- <HumanizeDate :date="sheet.updateTime" />
+ <HumanizeDate :date="getDateForPbTimestamp(sheet.updateTime)" />
</div>
<div class="bb-grid-cell" @click.stop>
<Dropdown :sheet="sheet" :view="view" />
@@ -41,6 +41,7 @@ import { BBGrid } from "@/bbkit";
import HumanizeDate from "@/components/misc/HumanizeDate.vue";
import { ProjectV1Name } from "@/components/v2";
import { useUserStore, useProjectV1Store } from "@/store";
+import { getDateForPbTimestamp } from "@/types";
import type { Worksheet } from "@/types/proto/v1/worksheet_service";
import { Worksheet_Visibility } from "@/types/proto/v1/worksheet_service";
import { getHighlightHTMLByRegExp } from "@/utils";
diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml
index f88e8f664a..3f96603818 100644
--- a/proto/buf.gen.yaml
+++ b/proto/buf.gen.yaml
@@ -18,6 +18,7 @@ plugins:
- esModuleInterop=true
- forceLong=long
- stringEnums=true
+ - useDate=false
- remote: buf.build/community/pseudomuto-doc:v1.5.1
out: gen/grpc-doc
opt: markdown,README.md,source_relative