Skip to content

Commit

Permalink
feat: optional navigation type
Browse files Browse the repository at this point in the history
Signed-off-by: David Dal Busco <[email protected]>
  • Loading branch information
peterpeterparker committed Aug 18, 2024
1 parent cae5488 commit 26fab14
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions src/declarations/orbiter/orbiter.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export interface MemorySize {
stable: bigint;
heap: bigint;
}
export type NavigationType =
| { Navigate: null }
| { Restore: null }
| { Reload: null }
| { BackForward: null }
| { BackForwardCache: null }
| { Prerender: null };
export interface OrbiterSatelliteConfig {
updated_at: bigint;
created_at: bigint;
Expand Down Expand Up @@ -168,16 +175,9 @@ export interface TrackEvent {
export interface WebVitalsMetric {
id: string;
value: number;
navigation_type: WebVitalsMetricNavigationType;
navigation_type: [] | [NavigationType];
delta: number;
}
export type WebVitalsMetricNavigationType =
| { Navigate: null }
| { Restore: null }
| { Reload: null }
| { BackForward: null }
| { BackForwardCache: null }
| { Prerender: null };
export interface _SERVICE {
del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
del_satellite_config: ActorMethod<[Principal, DelSatelliteConfig], undefined>;
Expand Down
4 changes: 2 additions & 2 deletions src/declarations/orbiter/orbiter.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const idlFactory = ({ IDL }) => {
referrers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32)),
pages: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
});
const WebVitalsMetricNavigationType = IDL.Variant({
const NavigationType = IDL.Variant({
Navigate: IDL.Null,
Restore: IDL.Null,
Reload: IDL.Null,
Expand All @@ -89,7 +89,7 @@ export const idlFactory = ({ IDL }) => {
const WebVitalsMetric = IDL.Record({
id: IDL.Text,
value: IDL.Float64,
navigation_type: WebVitalsMetricNavigationType,
navigation_type: IDL.Opt(NavigationType),
delta: IDL.Float64
});
const PerformanceData = IDL.Variant({ WebVitalsMetric: WebVitalsMetric });
Expand Down
4 changes: 2 additions & 2 deletions src/declarations/orbiter/orbiter.factory.did.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const idlFactory = ({ IDL }) => {
referrers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32)),
pages: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
});
const WebVitalsMetricNavigationType = IDL.Variant({
const NavigationType = IDL.Variant({
Navigate: IDL.Null,
Restore: IDL.Null,
Reload: IDL.Null,
Expand All @@ -89,7 +89,7 @@ export const idlFactory = ({ IDL }) => {
const WebVitalsMetric = IDL.Record({
id: IDL.Text,
value: IDL.Float64,
navigation_type: WebVitalsMetricNavigationType,
navigation_type: IDL.Opt(NavigationType),
delta: IDL.Float64
});
const PerformanceData = IDL.Variant({ WebVitalsMetric: WebVitalsMetric });
Expand Down
18 changes: 9 additions & 9 deletions src/orbiter/orbiter.did
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ type GetAnalytics = record {
satellite_id : opt principal;
};
type MemorySize = record { stable : nat64; heap : nat64 };
type NavigationType = variant {
Navigate;
Restore;
Reload;
BackForward;
BackForwardCache;
Prerender;
};
type OrbiterSatelliteConfig = record {
updated_at : nat64;
created_at : nat64;
Expand Down Expand Up @@ -134,17 +142,9 @@ type TrackEvent = record {
type WebVitalsMetric = record {
id : text;
value : float64;
navigation_type : WebVitalsMetricNavigationType;
navigation_type : opt NavigationType;
delta : float64;
};
type WebVitalsMetricNavigationType = variant {
Navigate;
Restore;
Reload;
BackForward;
BackForwardCache;
Prerender;
};
service : () -> {
del_controllers : (DeleteControllersArgs) -> (
vec record { principal; Controller },
Expand Down
4 changes: 2 additions & 2 deletions src/orbiter/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ pub mod state {
pub value: f64,
pub delta: f64,
pub id: String,
pub navigation_type: WebVitalsMetricNavigationType,
pub navigation_type: Option<NavigationType>,
}

#[derive(CandidType, Serialize, Deserialize, Clone)]
pub enum WebVitalsMetricNavigationType {
pub enum NavigationType {
Navigate,
Reload,
BackForward,
Expand Down

0 comments on commit 26fab14

Please sign in to comment.