Skip to content

Commit 49100e7

Browse files
committed
feat: add PackageInfoDisplay schema and update related components
在ll-cli list --json中添加install_time字段,用于表示包的安装时间
1 parent 62a3474 commit 49100e7

15 files changed

Lines changed: 337 additions & 28 deletions

File tree

api/schema/v1.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,27 @@
644644
}
645645
}
646646
},
647+
"PackageInfoDisplay": {
648+
"title": "PackageInfoDisplay",
649+
"description": "this is the each item output of ll-cli list --json",
650+
"allOf": [
651+
{
652+
"$ref": "#/$defs/PackageInfoV2"
653+
},
654+
{
655+
"type": "object",
656+
"requested": [
657+
"info"
658+
],
659+
"properties": {
660+
"install_time": {
661+
"type": "integer",
662+
"description": "package install time"
663+
}
664+
}
665+
}
666+
]
667+
},
647668
"PackageInfoV2": {
648669
"title": "PackageInfoV2",
649670
"description": "this is the each item output of ll-cli list --json",
@@ -1417,6 +1438,9 @@
14171438
"PackageManager1Package": {
14181439
"$ref": "#/$defs/PackageManager1Package"
14191440
},
1441+
"PackageInfoDisplay": {
1442+
"$ref": "#/$defs/PackageInfoDisplay"
1443+
},
14201444
"PackageInfoV2": {
14211445
"$ref": "#/$defs/PackageInfoV2"
14221446
},

api/schema/v1.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,18 @@ $defs:
508508
module:
509509
type: string
510510
description: module of package manager
511+
PackageInfoDisplay:
512+
title: PackageInfoDisplay
513+
description: this is the each item output of ll-cli list --json
514+
allOf:
515+
- $ref: '#/$defs/PackageInfoV2'
516+
- type: object
517+
requested:
518+
- info
519+
properties:
520+
install_time:
521+
type: integer
522+
description: package install time
511523
PackageInfoV2:
512524
title: PackageInfoV2
513525
description: this is the each item output of ll-cli list --json

libs/api/src/linglong/api/types/v1/Generators.hpp

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "linglong/api/types/v1/PackageManager1GetRepoInfoResult.hpp"
4747
#include "linglong/api/types/v1/PackageManager1GetRepoInfoResultRepoInfo.hpp"
4848
#include "linglong/api/types/v1/PackageInfoV2.hpp"
49+
#include "linglong/api/types/v1/PackageInfoDisplay.hpp"
4950
#include "linglong/api/types/v1/PackageInfo.hpp"
5051
#include "linglong/api/types/v1/OciConfigurationPatch.hpp"
5152
#include "linglong/api/types/v1/LayerInfo.hpp"
@@ -164,6 +165,9 @@ void to_json(json & j, const OciConfigurationPatch & x);
164165
void from_json(const json & j, PackageInfo & x);
165166
void to_json(json & j, const PackageInfo & x);
166167

168+
void from_json(const json & j, PackageInfoDisplay & x);
169+
void to_json(json & j, const PackageInfoDisplay & x);
170+
167171
void from_json(const json & j, PackageInfoV2 & x);
168172
void to_json(json & j, const PackageInfoV2 & x);
169173

@@ -730,6 +734,69 @@ j["size"] = x.size;
730734
j["version"] = x.version;
731735
}
732736

737+
inline void from_json(const json & j, PackageInfoDisplay& x) {
738+
x.arch = j.at("arch").get<std::vector<std::string>>();
739+
x.base = j.at("base").get<std::string>();
740+
x.channel = j.at("channel").get<std::string>();
741+
x.command = get_stack_optional<std::vector<std::string>>(j, "command");
742+
x.compatibleVersion = get_stack_optional<std::string>(j, "compatible_version");
743+
x.description = get_stack_optional<std::string>(j, "description");
744+
x.extImpl = get_stack_optional<ExtensionImpl>(j, "ext_impl");
745+
x.extensions = get_stack_optional<std::vector<ExtensionDefine>>(j, "extensions");
746+
x.id = j.at("id").get<std::string>();
747+
x.kind = j.at("kind").get<std::string>();
748+
x.packageInfoDisplayModule = j.at("module").get<std::string>();
749+
x.name = j.at("name").get<std::string>();
750+
x.permissions = get_stack_optional<ApplicationConfigurationPermissions>(j, "permissions");
751+
x.runtime = get_stack_optional<std::string>(j, "runtime");
752+
x.schemaVersion = j.at("schema_version").get<std::string>();
753+
x.size = j.at("size").get<int64_t>();
754+
x.uuid = get_stack_optional<std::string>(j, "uuid");
755+
x.version = j.at("version").get<std::string>();
756+
x.installTime = get_stack_optional<int64_t>(j, "install_time");
757+
}
758+
759+
inline void to_json(json & j, const PackageInfoDisplay & x) {
760+
j = json::object();
761+
j["arch"] = x.arch;
762+
j["base"] = x.base;
763+
j["channel"] = x.channel;
764+
if (x.command) {
765+
j["command"] = x.command;
766+
}
767+
if (x.compatibleVersion) {
768+
j["compatible_version"] = x.compatibleVersion;
769+
}
770+
if (x.description) {
771+
j["description"] = x.description;
772+
}
773+
if (x.extImpl) {
774+
j["ext_impl"] = x.extImpl;
775+
}
776+
if (x.extensions) {
777+
j["extensions"] = x.extensions;
778+
}
779+
j["id"] = x.id;
780+
j["kind"] = x.kind;
781+
j["module"] = x.packageInfoDisplayModule;
782+
j["name"] = x.name;
783+
if (x.permissions) {
784+
j["permissions"] = x.permissions;
785+
}
786+
if (x.runtime) {
787+
j["runtime"] = x.runtime;
788+
}
789+
j["schema_version"] = x.schemaVersion;
790+
j["size"] = x.size;
791+
if (x.uuid) {
792+
j["uuid"] = x.uuid;
793+
}
794+
j["version"] = x.version;
795+
if (x.installTime) {
796+
j["install_time"] = x.installTime;
797+
}
798+
}
799+
733800
inline void from_json(const json & j, PackageInfoV2& x) {
734801
x.arch = j.at("arch").get<std::vector<std::string>>();
735802
x.base = j.at("base").get<std::string>();
@@ -1169,6 +1236,7 @@ x.interactionRequest = get_stack_optional<InteractionRequest>(j, "InteractionReq
11691236
x.layerInfo = get_stack_optional<LayerInfo>(j, "LayerInfo");
11701237
x.ociConfigurationPatch = get_stack_optional<OciConfigurationPatch>(j, "OCIConfigurationPatch");
11711238
x.packageInfo = get_stack_optional<PackageInfo>(j, "PackageInfo");
1239+
x.packageInfoDisplay = get_stack_optional<PackageInfoDisplay>(j, "PackageInfoDisplay");
11721240
x.packageInfoV2 = get_stack_optional<PackageInfoV2>(j, "PackageInfoV2");
11731241
x.packageManager1GetRepoInfoResult = get_stack_optional<PackageManager1GetRepoInfoResult>(j, "PackageManager1GetRepoInfoResult");
11741242
x.packageManager1InstallLayerFDResult = get_stack_optional<CommonResult>(j, "PackageManager1InstallLayerFDResult");
@@ -1260,6 +1328,9 @@ j["OCIConfigurationPatch"] = x.ociConfigurationPatch;
12601328
if (x.packageInfo) {
12611329
j["PackageInfo"] = x.packageInfo;
12621330
}
1331+
if (x.packageInfoDisplay) {
1332+
j["PackageInfoDisplay"] = x.packageInfoDisplay;
1333+
}
12631334
if (x.packageInfoV2) {
12641335
j["PackageInfoV2"] = x.packageInfoV2;
12651336
}

libs/api/src/linglong/api/types/v1/LinglongAPIV1.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "linglong/api/types/v1/LayerInfo.hpp"
3838
#include "linglong/api/types/v1/OciConfigurationPatch.hpp"
3939
#include "linglong/api/types/v1/PackageInfo.hpp"
40+
#include "linglong/api/types/v1/PackageInfoDisplay.hpp"
4041
#include "linglong/api/types/v1/PackageInfoV2.hpp"
4142
#include "linglong/api/types/v1/PackageManager1GetRepoInfoResult.hpp"
4243
#include "linglong/api/types/v1/PackageManager1InstallParameters.hpp"
@@ -107,6 +108,7 @@ std::optional<InteractionRequest> interactionRequest;
107108
std::optional<LayerInfo> layerInfo;
108109
std::optional<OciConfigurationPatch> ociConfigurationPatch;
109110
std::optional<PackageInfo> packageInfo;
111+
std::optional<PackageInfoDisplay> packageInfoDisplay;
110112
std::optional<PackageInfoV2> packageInfoV2;
111113
std::optional<PackageManager1GetRepoInfoResult> packageManager1GetRepoInfoResult;
112114
std::optional<CommonResult> packageManager1InstallLayerFDResult;
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// This file is generated by tools/codegen.sh
2+
// DO NOT EDIT IT.
3+
4+
// clang-format off
5+
6+
// To parse this JSON data, first install
7+
//
8+
// json.hpp https://github.com/nlohmann/json
9+
//
10+
// Then include this file, and then do
11+
//
12+
// PackageInfoDisplay.hpp data = nlohmann::json::parse(jsonString);
13+
14+
#pragma once
15+
16+
#include <optional>
17+
#include <nlohmann/json.hpp>
18+
#include "linglong/api/types/v1/helper.hpp"
19+
20+
#include "linglong/api/types/v1/ExtensionImpl.hpp"
21+
#include "linglong/api/types/v1/ExtensionDefine.hpp"
22+
#include "linglong/api/types/v1/ApplicationConfigurationPermissions.hpp"
23+
24+
namespace linglong {
25+
namespace api {
26+
namespace types {
27+
namespace v1 {
28+
/**
29+
* this is the each item output of ll-cli list --json
30+
*
31+
* package info of package manager search
32+
*/
33+
34+
using nlohmann::json;
35+
36+
/**
37+
* this is the each item output of ll-cli list --json
38+
*
39+
* package info of package manager search
40+
*/
41+
struct PackageInfoDisplay {
42+
/**
43+
* arch of package info
44+
*/
45+
std::vector<std::string> arch;
46+
/**
47+
* base of package info
48+
*/
49+
std::string base;
50+
/**
51+
* channel of package info
52+
*/
53+
std::string channel;
54+
/**
55+
* command of package info
56+
*/
57+
std::optional<std::vector<std::string>> command;
58+
/**
59+
* record linyaps package is compatible with linyaps component version
60+
*/
61+
std::optional<std::string> compatibleVersion;
62+
/**
63+
* description of package info
64+
*/
65+
std::optional<std::string> description;
66+
std::optional<ExtensionImpl> extImpl;
67+
/**
68+
* description of extension
69+
*/
70+
std::optional<std::vector<ExtensionDefine>> extensions;
71+
/**
72+
* id of package info
73+
*/
74+
std::string id;
75+
/**
76+
* kind of package info
77+
*/
78+
std::string kind;
79+
/**
80+
* module of package info
81+
*/
82+
std::string packageInfoDisplayModule;
83+
/**
84+
* name of package info
85+
*/
86+
std::string name;
87+
std::optional<ApplicationConfigurationPermissions> permissions;
88+
/**
89+
* runtime of package info
90+
*/
91+
std::optional<std::string> runtime;
92+
/**
93+
* version of 'PackageInfo'
94+
*/
95+
std::string schemaVersion;
96+
/**
97+
* Uncompressed package size in bytes
98+
*/
99+
int64_t size;
100+
/**
101+
* this property is only used for app which instead from UAB and it should be null in other
102+
* conditions.
103+
*/
104+
std::optional<std::string> uuid;
105+
/**
106+
* version of package info
107+
*/
108+
std::string version;
109+
/**
110+
* package install time
111+
*/
112+
std::optional<int64_t> installTime;
113+
};
114+
}
115+
}
116+
}
117+
}
118+
119+
// clang-format on

0 commit comments

Comments
 (0)