Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename build version #423

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@dfinity/identity": "^0.20.2",
"@dfinity/principal": "^0.20.2",
"@dfinity/utils": "next",
"@junobuild/admin": "^0.0.44-next-2024-02-01",
"@junobuild/admin": "^0.0.44-next-2024-02-02.1",
"@junobuild/ledger": "^0.0.28-next-2024-01-30",
"@junobuild/utils": "^0.0.17-next-2024-01-30",
"buffer": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/satellite/satellite.did.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export interface UploadChunkResult {
chunk_id: bigint;
}
export interface _SERVICE {
build_version: ActorMethod<[], string>;
commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
count_assets: ActorMethod<[string], bigint>;
count_docs: ActorMethod<[string], bigint>;
Expand Down Expand Up @@ -236,6 +237,5 @@ export interface _SERVICE {
set_rule: ActorMethod<[RulesType, string, SetRule], undefined>;
upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>;
version: ActorMethod<[], string>;
version_build: ActorMethod<[], string>;
}
export declare const idlFactory: IDL.InterfaceFactory;
4 changes: 2 additions & 2 deletions src/declarations/satellite/satellite.factory.did.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const idlFactory = ({ IDL }) => {
});
const UploadChunkResult = IDL.Record({ chunk_id: IDL.Nat });
return IDL.Service({
build_version: IDL.Func([], [IDL.Text], ['query']),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
Expand Down Expand Up @@ -252,8 +253,7 @@ export const idlFactory = ({ IDL }) => {
),
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
version: IDL.Func([], [IDL.Text], ['query']),
version_build: IDL.Func([], [IDL.Text], ['query'])
version: IDL.Func([], [IDL.Text], ['query'])
});
};
// @ts-ignore
Expand Down
4 changes: 2 additions & 2 deletions src/declarations/satellite/satellite.factory.did.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export const idlFactory = ({ IDL }) => {
});
const UploadChunkResult = IDL.Record({ chunk_id: IDL.Nat });
return IDL.Service({
build_version: IDL.Func([], [IDL.Text], ['query']),
commit_asset_upload: IDL.Func([CommitBatch], [], []),
count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
Expand Down Expand Up @@ -252,8 +253,7 @@ export const idlFactory = ({ IDL }) => {
),
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
version: IDL.Func([], [IDL.Text], ['query']),
version_build: IDL.Func([], [IDL.Text], ['query'])
version: IDL.Func([], [IDL.Text], ['query'])
});
};
// @ts-ignore
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/lib/api/satellites.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ export const satelliteVersion = async ({
return version();
};

export const satelliteVersionBuild = async ({
export const satelliteBuildVersion = async ({
satelliteId,
identity
}: {
satelliteId: Principal;
identity: OptionIdentity;
}): Promise<string> => {
const { version_build } = await getSatelliteActor({ satelliteId, identity });
return version_build();
const { build_version } = await getSatelliteActor({ satelliteId, identity });
return build_version();
};

export const setCustomDomain = async ({
Expand Down
17 changes: 8 additions & 9 deletions src/frontend/src/lib/services/console.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Orbiter } from '$declarations/mission_control/mission_control.did'
import { initMissionControl as initMissionControlApi, releasesVersion } from '$lib/api/console.api';
import { missionControlVersion } from '$lib/api/mission-control.api';
import { orbiterVersion } from '$lib/api/orbiter.api';
import { satelliteVersion, satelliteVersionBuild } from '$lib/api/satellites.api';
import { satelliteBuildVersion, satelliteVersion } from '$lib/api/satellites.api';
import { authStore } from '$lib/stores/auth.store';
import { toasts } from '$lib/stores/toasts.store';
import { versionStore, type ReleaseVersionSatellite } from '$lib/stores/version.store';
Expand Down Expand Up @@ -100,18 +100,17 @@ export const loadVersion = async ({
satelliteId: Principal
): Promise<Omit<ReleaseVersionSatellite, 'release'> | undefined> => {
// Backwards compatibility for Satellite <= 0.0.14 which did not expose the end point "version_build"
const queryVersionBuild = async (): Promise<string | undefined> => {
const queryBuildVersion = async (): Promise<string | undefined> => {
try {
const version = await satelliteVersionBuild({ satelliteId, identity });
return version;
return await satelliteBuildVersion({ satelliteId, identity });
} catch (_: unknown) {
return undefined;
}
};

const [version, versionBuild, metadataBuild] = await Promise.allSettled([
const [version, buildVersion, buildType] = await Promise.allSettled([
satelliteVersion({ satelliteId, identity }),
queryVersionBuild(),
queryBuildVersion(),
satelliteBuildType({
satellite: {
satelliteId: satelliteId.toText(),
Expand All @@ -129,9 +128,9 @@ export const loadVersion = async ({

return {
current,
...(versionBuild.status === 'fulfilled' &&
nonNullish(versionBuild.value) && { currentBuild: versionBuild.value }),
build: metadataBuild.status === 'fulfilled' ? metadataBuild.value ?? 'stock' : 'stock'
...(buildVersion.status === 'fulfilled' &&
nonNullish(buildVersion.value) && { currentBuild: buildVersion.value }),
build: buildType.status === 'fulfilled' ? buildType.value ?? 'stock' : 'stock'
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/libs/satellite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ macro_rules! include_satellite {
};

#[ic_cdk::query]
pub fn version_build() -> String {
pub fn build_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
}

Expand Down
2 changes: 1 addition & 1 deletion src/satellite/satellite.did
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,5 @@ service : () -> {
set_rule : (RulesType, text, SetRule) -> ();
upload_asset_chunk : (UploadChunk) -> (UploadChunkResult);
version : () -> (text) query;
version_build : () -> (text) query;
build_version : () -> (text) query
}