capdag 0.119.263 → 0.126.278
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cap-graph-renderer.js +721 -452
- package/capdag.js +147 -160
- package/capdag.test.js +774 -348
- package/package.json +1 -1
package/capdag.js
CHANGED
|
@@ -3008,7 +3008,7 @@ class CapSetEntry {
|
|
|
3008
3008
|
}
|
|
3009
3009
|
|
|
3010
3010
|
/**
|
|
3011
|
-
* Unified registry for cap sets (providers and
|
|
3011
|
+
* Unified registry for cap sets (providers and cartridges)
|
|
3012
3012
|
* Provides capability host discovery using subset matching.
|
|
3013
3013
|
*/
|
|
3014
3014
|
class CapMatrix {
|
|
@@ -3804,7 +3804,7 @@ const StdinSourceKind = {
|
|
|
3804
3804
|
|
|
3805
3805
|
/**
|
|
3806
3806
|
* Represents the source for stdin data.
|
|
3807
|
-
* For
|
|
3807
|
+
* For cartridges (via gRPC/XPC), using FileReference avoids size limits
|
|
3808
3808
|
* by letting the receiving side read the file locally.
|
|
3809
3809
|
*/
|
|
3810
3810
|
class StdinSource {
|
|
@@ -3838,7 +3838,7 @@ class StdinSource {
|
|
|
3838
3838
|
|
|
3839
3839
|
/**
|
|
3840
3840
|
* Create a StdinSource from a file reference
|
|
3841
|
-
* Used for
|
|
3841
|
+
* Used for cartridges to read files locally instead of sending bytes over the wire.
|
|
3842
3842
|
* @param {string} trackedFileId - ID for lifecycle management
|
|
3843
3843
|
* @param {string} originalPath - Original file path (for logging/debugging)
|
|
3844
3844
|
* @param {Uint8Array|Buffer|null} securityBookmark - Security bookmark data
|
|
@@ -3872,13 +3872,13 @@ class StdinSource {
|
|
|
3872
3872
|
}
|
|
3873
3873
|
|
|
3874
3874
|
// =============================================================================
|
|
3875
|
-
//
|
|
3875
|
+
// Cartridge Repository System
|
|
3876
3876
|
// =============================================================================
|
|
3877
3877
|
|
|
3878
3878
|
/**
|
|
3879
|
-
*
|
|
3879
|
+
* Cartridge capability summary from registry
|
|
3880
3880
|
*/
|
|
3881
|
-
class
|
|
3881
|
+
class CartridgeCapSummary {
|
|
3882
3882
|
constructor(urn, title, description = '') {
|
|
3883
3883
|
this.urn = urn;
|
|
3884
3884
|
this.title = title;
|
|
@@ -3887,9 +3887,9 @@ class PluginCapSummary {
|
|
|
3887
3887
|
}
|
|
3888
3888
|
|
|
3889
3889
|
/**
|
|
3890
|
-
*
|
|
3890
|
+
* Cartridge information from registry
|
|
3891
3891
|
*/
|
|
3892
|
-
class
|
|
3892
|
+
class CartridgeInfo {
|
|
3893
3893
|
constructor(data) {
|
|
3894
3894
|
this.id = data.id;
|
|
3895
3895
|
this.name = data.name;
|
|
@@ -3900,44 +3900,52 @@ class PluginInfo {
|
|
|
3900
3900
|
this.teamId = data.teamId || '';
|
|
3901
3901
|
this.signedAt = data.signedAt || '';
|
|
3902
3902
|
this.minAppVersion = data.minAppVersion || '';
|
|
3903
|
-
this.caps = (data.caps || []).map(c => new
|
|
3903
|
+
this.caps = (data.caps || []).map(c => new CartridgeCapSummary(c.urn, c.title, c.description || ''));
|
|
3904
3904
|
this.categories = data.categories || [];
|
|
3905
3905
|
this.tags = data.tags || [];
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
this.platform = data.platform || '';
|
|
3909
|
-
this.packageName = data.packageName || '';
|
|
3910
|
-
this.packageSha256 = data.packageSha256 || '';
|
|
3911
|
-
this.packageSize = data.packageSize || 0;
|
|
3912
|
-
this.binaryName = data.binaryName || '';
|
|
3913
|
-
this.binarySha256 = data.binarySha256 || '';
|
|
3914
|
-
this.binarySize = data.binarySize || 0;
|
|
3906
|
+
// Versions with platform-specific builds
|
|
3907
|
+
this.versions = data.versions || {};
|
|
3915
3908
|
this.availableVersions = data.availableVersions || [];
|
|
3916
3909
|
}
|
|
3917
3910
|
|
|
3918
3911
|
/**
|
|
3919
|
-
* Check if
|
|
3912
|
+
* Check if cartridge is signed (has team_id and signed_at)
|
|
3920
3913
|
*/
|
|
3921
3914
|
isSigned() {
|
|
3922
3915
|
return this.teamId.length > 0 && this.signedAt.length > 0;
|
|
3923
3916
|
}
|
|
3924
3917
|
|
|
3925
3918
|
/**
|
|
3926
|
-
*
|
|
3919
|
+
* Get the build for a specific platform from the latest version
|
|
3927
3920
|
*/
|
|
3928
|
-
|
|
3929
|
-
|
|
3921
|
+
buildForPlatform(platform) {
|
|
3922
|
+
const latestVersionData = this.versions[this.version];
|
|
3923
|
+
if (!latestVersionData) return null;
|
|
3924
|
+
return (latestVersionData.builds || []).find(b => b.platform === platform) || null;
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
/**
|
|
3928
|
+
* Get all platforms available across all versions
|
|
3929
|
+
*/
|
|
3930
|
+
availablePlatforms() {
|
|
3931
|
+
const platforms = new Set();
|
|
3932
|
+
for (const versionData of Object.values(this.versions)) {
|
|
3933
|
+
for (const build of (versionData.builds || [])) {
|
|
3934
|
+
platforms.add(build.platform);
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
return Array.from(platforms).sort();
|
|
3930
3938
|
}
|
|
3931
3939
|
}
|
|
3932
3940
|
|
|
3933
3941
|
/**
|
|
3934
|
-
*
|
|
3942
|
+
* Cartridge suggestion for a missing cap
|
|
3935
3943
|
*/
|
|
3936
|
-
class
|
|
3944
|
+
class CartridgeSuggestion {
|
|
3937
3945
|
constructor(data) {
|
|
3938
|
-
this.
|
|
3939
|
-
this.
|
|
3940
|
-
this.
|
|
3946
|
+
this.cartridgeId = data.cartridgeId;
|
|
3947
|
+
this.cartridgeName = data.cartridgeName;
|
|
3948
|
+
this.cartridgeDescription = data.cartridgeDescription;
|
|
3941
3949
|
this.capUrn = data.capUrn;
|
|
3942
3950
|
this.capTitle = data.capTitle;
|
|
3943
3951
|
this.latestVersion = data.latestVersion;
|
|
@@ -3947,23 +3955,23 @@ class PluginSuggestion {
|
|
|
3947
3955
|
}
|
|
3948
3956
|
|
|
3949
3957
|
/**
|
|
3950
|
-
*
|
|
3958
|
+
* Cartridge registry cache entry
|
|
3951
3959
|
*/
|
|
3952
|
-
class
|
|
3960
|
+
class CartridgeRepoCache {
|
|
3953
3961
|
constructor(repoUrl) {
|
|
3954
|
-
this.
|
|
3955
|
-
this.
|
|
3962
|
+
this.cartridges = new Map(); // cartridge_id -> CartridgeInfo
|
|
3963
|
+
this.capToCartridges = new Map(); // cap_urn -> [cartridge_ids]
|
|
3956
3964
|
this.lastUpdated = Date.now();
|
|
3957
3965
|
this.repoUrl = repoUrl;
|
|
3958
3966
|
}
|
|
3959
3967
|
}
|
|
3960
3968
|
|
|
3961
3969
|
/**
|
|
3962
|
-
*
|
|
3970
|
+
* Cartridge repository client - fetches and caches cartridge registry
|
|
3963
3971
|
*/
|
|
3964
|
-
class
|
|
3972
|
+
class CartridgeRepoClient {
|
|
3965
3973
|
constructor(cacheTtlSeconds = 3600) {
|
|
3966
|
-
this.caches = new Map(); // repo_url ->
|
|
3974
|
+
this.caches = new Map(); // repo_url -> CartridgeRepoCache
|
|
3967
3975
|
this.cacheTtl = cacheTtlSeconds * 1000; // Convert to milliseconds
|
|
3968
3976
|
}
|
|
3969
3977
|
|
|
@@ -3974,32 +3982,32 @@ class PluginRepoClient {
|
|
|
3974
3982
|
const response = await fetch(repoUrl);
|
|
3975
3983
|
|
|
3976
3984
|
if (!response.ok) {
|
|
3977
|
-
throw new Error(`
|
|
3985
|
+
throw new Error(`Cartridge registry request failed: HTTP ${response.status} from ${repoUrl}`);
|
|
3978
3986
|
}
|
|
3979
3987
|
|
|
3980
3988
|
const data = await response.json();
|
|
3981
3989
|
|
|
3982
|
-
if (!data.
|
|
3983
|
-
throw new Error(`Invalid
|
|
3990
|
+
if (!data.cartridges || !Array.isArray(data.cartridges)) {
|
|
3991
|
+
throw new Error(`Invalid cartridge registry response from ${repoUrl}: missing cartridges array`);
|
|
3984
3992
|
}
|
|
3985
3993
|
|
|
3986
|
-
return data.
|
|
3994
|
+
return data.cartridges.map(p => new CartridgeInfo(p));
|
|
3987
3995
|
}
|
|
3988
3996
|
|
|
3989
3997
|
/**
|
|
3990
3998
|
* Update cache from registry data
|
|
3991
3999
|
*/
|
|
3992
|
-
updateCache(repoUrl,
|
|
3993
|
-
const cache = new
|
|
4000
|
+
updateCache(repoUrl, cartridges) {
|
|
4001
|
+
const cache = new CartridgeRepoCache(repoUrl);
|
|
3994
4002
|
|
|
3995
|
-
for (const
|
|
3996
|
-
cache.
|
|
4003
|
+
for (const cartridge of cartridges) {
|
|
4004
|
+
cache.cartridges.set(cartridge.id, cartridge);
|
|
3997
4005
|
|
|
3998
|
-
for (const cap of
|
|
3999
|
-
if (!cache.
|
|
4000
|
-
cache.
|
|
4006
|
+
for (const cap of cartridge.caps) {
|
|
4007
|
+
if (!cache.capToCartridges.has(cap.urn)) {
|
|
4008
|
+
cache.capToCartridges.set(cap.urn, []);
|
|
4001
4009
|
}
|
|
4002
|
-
cache.
|
|
4010
|
+
cache.capToCartridges.get(cap.urn).push(cartridge.id);
|
|
4003
4011
|
}
|
|
4004
4012
|
}
|
|
4005
4013
|
|
|
@@ -4014,15 +4022,15 @@ class PluginRepoClient {
|
|
|
4014
4022
|
}
|
|
4015
4023
|
|
|
4016
4024
|
/**
|
|
4017
|
-
* Sync
|
|
4025
|
+
* Sync cartridge data from repository URLs
|
|
4018
4026
|
*/
|
|
4019
4027
|
async syncRepos(repoUrls) {
|
|
4020
4028
|
for (const repoUrl of repoUrls) {
|
|
4021
4029
|
try {
|
|
4022
|
-
const
|
|
4023
|
-
this.updateCache(repoUrl,
|
|
4030
|
+
const cartridges = await this.fetchRegistry(repoUrl);
|
|
4031
|
+
this.updateCache(repoUrl, cartridges);
|
|
4024
4032
|
} catch (e) {
|
|
4025
|
-
console.warn(`Failed to sync
|
|
4033
|
+
console.warn(`Failed to sync cartridge repo ${repoUrl}: ${e.message}`);
|
|
4026
4034
|
// Continue with other repos
|
|
4027
4035
|
}
|
|
4028
4036
|
}
|
|
@@ -4042,31 +4050,31 @@ class PluginRepoClient {
|
|
|
4042
4050
|
}
|
|
4043
4051
|
|
|
4044
4052
|
/**
|
|
4045
|
-
* Get
|
|
4053
|
+
* Get cartridge suggestions for a cap URN
|
|
4046
4054
|
*/
|
|
4047
4055
|
getSuggestionsForCap(capUrn) {
|
|
4048
4056
|
const suggestions = [];
|
|
4049
4057
|
|
|
4050
4058
|
for (const cache of this.caches.values()) {
|
|
4051
|
-
const
|
|
4052
|
-
if (!
|
|
4059
|
+
const cartridgeIds = cache.capToCartridges.get(capUrn);
|
|
4060
|
+
if (!cartridgeIds) continue;
|
|
4053
4061
|
|
|
4054
|
-
for (const
|
|
4055
|
-
const
|
|
4056
|
-
if (!
|
|
4062
|
+
for (const cartridgeId of cartridgeIds) {
|
|
4063
|
+
const cartridge = cache.cartridges.get(cartridgeId);
|
|
4064
|
+
if (!cartridge) continue;
|
|
4057
4065
|
|
|
4058
|
-
const capInfo =
|
|
4066
|
+
const capInfo = cartridge.caps.find(c => c.urn === capUrn);
|
|
4059
4067
|
if (!capInfo) continue;
|
|
4060
4068
|
|
|
4061
|
-
const pageUrl =
|
|
4069
|
+
const pageUrl = cartridge.pageUrl || cache.repoUrl;
|
|
4062
4070
|
|
|
4063
|
-
suggestions.push(new
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4071
|
+
suggestions.push(new CartridgeSuggestion({
|
|
4072
|
+
cartridgeId: cartridge.id,
|
|
4073
|
+
cartridgeName: cartridge.name,
|
|
4074
|
+
cartridgeDescription: cartridge.description,
|
|
4067
4075
|
capUrn: capUrn,
|
|
4068
4076
|
capTitle: capInfo.title,
|
|
4069
|
-
latestVersion:
|
|
4077
|
+
latestVersion: cartridge.version,
|
|
4070
4078
|
repoUrl: cache.repoUrl,
|
|
4071
4079
|
pageUrl: pageUrl
|
|
4072
4080
|
}));
|
|
@@ -4077,25 +4085,25 @@ class PluginRepoClient {
|
|
|
4077
4085
|
}
|
|
4078
4086
|
|
|
4079
4087
|
/**
|
|
4080
|
-
* Get all available
|
|
4088
|
+
* Get all available cartridges from all repos
|
|
4081
4089
|
*/
|
|
4082
|
-
|
|
4083
|
-
const
|
|
4090
|
+
getAllCartridges() {
|
|
4091
|
+
const cartridges = [];
|
|
4084
4092
|
for (const cache of this.caches.values()) {
|
|
4085
|
-
for (const [
|
|
4086
|
-
|
|
4093
|
+
for (const [cartridgeId, cartridgeInfo] of cache.cartridges) {
|
|
4094
|
+
cartridges.push([cartridgeId, cartridgeInfo]);
|
|
4087
4095
|
}
|
|
4088
4096
|
}
|
|
4089
|
-
return
|
|
4097
|
+
return cartridges;
|
|
4090
4098
|
}
|
|
4091
4099
|
|
|
4092
4100
|
/**
|
|
4093
|
-
* Get all available cap URNs from
|
|
4101
|
+
* Get all available cap URNs from cartridges
|
|
4094
4102
|
*/
|
|
4095
4103
|
getAllAvailableCaps() {
|
|
4096
4104
|
const caps = new Set();
|
|
4097
4105
|
for (const cache of this.caches.values()) {
|
|
4098
|
-
for (const capUrn of cache.
|
|
4106
|
+
for (const capUrn of cache.capToCartridges.keys()) {
|
|
4099
4107
|
caps.add(capUrn);
|
|
4100
4108
|
}
|
|
4101
4109
|
}
|
|
@@ -4103,13 +4111,13 @@ class PluginRepoClient {
|
|
|
4103
4111
|
}
|
|
4104
4112
|
|
|
4105
4113
|
/**
|
|
4106
|
-
* Get
|
|
4114
|
+
* Get cartridge info by ID
|
|
4107
4115
|
*/
|
|
4108
|
-
|
|
4116
|
+
getCartridge(cartridgeId) {
|
|
4109
4117
|
for (const cache of this.caches.values()) {
|
|
4110
|
-
const
|
|
4111
|
-
if (
|
|
4112
|
-
return
|
|
4118
|
+
const cartridge = cache.cartridges.get(cartridgeId);
|
|
4119
|
+
if (cartridge) {
|
|
4120
|
+
return cartridge;
|
|
4113
4121
|
}
|
|
4114
4122
|
}
|
|
4115
4123
|
return null;
|
|
@@ -4133,9 +4141,9 @@ class PluginRepoClient {
|
|
|
4133
4141
|
}
|
|
4134
4142
|
|
|
4135
4143
|
/**
|
|
4136
|
-
*
|
|
4144
|
+
* Cartridge repository server - serves registry data with queries
|
|
4137
4145
|
*/
|
|
4138
|
-
class
|
|
4146
|
+
class CartridgeRepoServer {
|
|
4139
4147
|
constructor(registry) {
|
|
4140
4148
|
this.registry = registry;
|
|
4141
4149
|
this.validateRegistry();
|
|
@@ -4148,11 +4156,11 @@ class PluginRepoServer {
|
|
|
4148
4156
|
if (!this.registry) {
|
|
4149
4157
|
throw new Error('Registry is required');
|
|
4150
4158
|
}
|
|
4151
|
-
if (this.registry.schemaVersion !== '
|
|
4152
|
-
throw new Error(`Unsupported registry schema version: ${this.registry.schemaVersion}. Required:
|
|
4159
|
+
if (this.registry.schemaVersion !== '4.0') {
|
|
4160
|
+
throw new Error(`Unsupported registry schema version: ${this.registry.schemaVersion}. Required: 4.0`);
|
|
4153
4161
|
}
|
|
4154
|
-
if (!this.registry.
|
|
4155
|
-
throw new Error('Registry must have
|
|
4162
|
+
if (!this.registry.cartridges || typeof this.registry.cartridges !== 'object') {
|
|
4163
|
+
throw new Error('Registry must have cartridges object');
|
|
4156
4164
|
}
|
|
4157
4165
|
}
|
|
4158
4166
|
|
|
@@ -4160,14 +4168,17 @@ class PluginRepoServer {
|
|
|
4160
4168
|
* Validate version data has all required fields
|
|
4161
4169
|
*/
|
|
4162
4170
|
validateVersionData(id, version, versionData) {
|
|
4163
|
-
if (!versionData.
|
|
4164
|
-
throw new Error(`
|
|
4171
|
+
if (!Array.isArray(versionData.builds) || versionData.builds.length === 0) {
|
|
4172
|
+
throw new Error(`Cartridge ${id} v${version}: no builds`);
|
|
4165
4173
|
}
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4174
|
+
for (let i = 0; i < versionData.builds.length; i++) {
|
|
4175
|
+
const build = versionData.builds[i];
|
|
4176
|
+
if (!build.platform) {
|
|
4177
|
+
throw new Error(`Cartridge ${id} v${version}: build[${i}] missing platform`);
|
|
4178
|
+
}
|
|
4179
|
+
if (!build.package || !build.package.name) {
|
|
4180
|
+
throw new Error(`Cartridge ${id} v${version}: build[${i}] (${build.platform}) missing package.name`);
|
|
4181
|
+
}
|
|
4171
4182
|
}
|
|
4172
4183
|
}
|
|
4173
4184
|
|
|
@@ -4189,98 +4200,74 @@ class PluginRepoServer {
|
|
|
4189
4200
|
}
|
|
4190
4201
|
|
|
4191
4202
|
/**
|
|
4192
|
-
*
|
|
4193
|
-
*/
|
|
4194
|
-
buildChangelogMap(versions) {
|
|
4195
|
-
const changelog = {};
|
|
4196
|
-
for (const [version, versionData] of Object.entries(versions)) {
|
|
4197
|
-
if (versionData.changelog && Array.isArray(versionData.changelog)) {
|
|
4198
|
-
changelog[version] = versionData.changelog;
|
|
4199
|
-
}
|
|
4200
|
-
}
|
|
4201
|
-
return changelog;
|
|
4202
|
-
}
|
|
4203
|
-
|
|
4204
|
-
/**
|
|
4205
|
-
* Transform registry to flat plugin array
|
|
4203
|
+
* Transform registry to flat cartridge array
|
|
4206
4204
|
*/
|
|
4207
|
-
|
|
4208
|
-
const
|
|
4209
|
-
const
|
|
4205
|
+
transformToCartridgeArray() {
|
|
4206
|
+
const cartridgesObject = this.registry.cartridges || {};
|
|
4207
|
+
const cartridges = [];
|
|
4210
4208
|
|
|
4211
|
-
for (const [id,
|
|
4212
|
-
const latestVersion =
|
|
4213
|
-
const versionData =
|
|
4209
|
+
for (const [id, cartridge] of Object.entries(cartridgesObject)) {
|
|
4210
|
+
const latestVersion = cartridge.latestVersion;
|
|
4211
|
+
const versionData = cartridge.versions[latestVersion];
|
|
4214
4212
|
|
|
4215
4213
|
if (!versionData) {
|
|
4216
|
-
throw new Error(`
|
|
4214
|
+
throw new Error(`Cartridge ${id}: latest version ${latestVersion} not found in versions`);
|
|
4217
4215
|
}
|
|
4218
4216
|
|
|
4219
4217
|
// Validate required fields - fail hard
|
|
4220
4218
|
this.validateVersionData(id, latestVersion, versionData);
|
|
4221
4219
|
|
|
4222
4220
|
// Get all version numbers sorted descending
|
|
4223
|
-
const availableVersions = Object.keys(
|
|
4221
|
+
const availableVersions = Object.keys(cartridge.versions).sort((a, b) => {
|
|
4224
4222
|
return this.compareVersions(b, a);
|
|
4225
4223
|
});
|
|
4226
4224
|
|
|
4227
|
-
|
|
4228
|
-
const packageUrl = `https://machinefabric.com/plugins/packages/${versionData.package.name}`;
|
|
4229
|
-
plugins.push({
|
|
4225
|
+
cartridges.push({
|
|
4230
4226
|
id,
|
|
4231
|
-
name:
|
|
4227
|
+
name: cartridge.name,
|
|
4232
4228
|
version: latestVersion,
|
|
4233
|
-
description:
|
|
4234
|
-
author:
|
|
4235
|
-
pageUrl:
|
|
4236
|
-
teamId:
|
|
4229
|
+
description: cartridge.description,
|
|
4230
|
+
author: cartridge.author,
|
|
4231
|
+
pageUrl: cartridge.pageUrl || '',
|
|
4232
|
+
teamId: cartridge.teamId,
|
|
4237
4233
|
signedAt: versionData.releaseDate,
|
|
4238
|
-
minAppVersion: versionData.minAppVersion ||
|
|
4239
|
-
caps:
|
|
4240
|
-
categories:
|
|
4241
|
-
tags:
|
|
4242
|
-
|
|
4243
|
-
// Distribution fields - ALL REQUIRED
|
|
4244
|
-
platform: versionData.platform,
|
|
4245
|
-
packageName: versionData.package.name,
|
|
4246
|
-
packageSha256: versionData.package.sha256,
|
|
4247
|
-
packageSize: versionData.package.size,
|
|
4248
|
-
binaryName: versionData.binary.name,
|
|
4249
|
-
binarySha256: versionData.binary.sha256,
|
|
4250
|
-
binarySize: versionData.binary.size,
|
|
4251
|
-
// All available versions
|
|
4234
|
+
minAppVersion: versionData.minAppVersion || cartridge.minAppVersion,
|
|
4235
|
+
caps: cartridge.caps || [],
|
|
4236
|
+
categories: cartridge.categories,
|
|
4237
|
+
tags: cartridge.tags,
|
|
4238
|
+
versions: cartridge.versions,
|
|
4252
4239
|
availableVersions
|
|
4253
4240
|
});
|
|
4254
4241
|
}
|
|
4255
4242
|
|
|
4256
|
-
return
|
|
4243
|
+
return cartridges;
|
|
4257
4244
|
}
|
|
4258
4245
|
|
|
4259
4246
|
/**
|
|
4260
|
-
* Get all
|
|
4247
|
+
* Get all cartridges (API response format)
|
|
4261
4248
|
*/
|
|
4262
|
-
|
|
4249
|
+
getCartridges() {
|
|
4263
4250
|
return {
|
|
4264
|
-
|
|
4251
|
+
cartridges: this.transformToCartridgeArray()
|
|
4265
4252
|
};
|
|
4266
4253
|
}
|
|
4267
4254
|
|
|
4268
4255
|
/**
|
|
4269
|
-
* Get
|
|
4256
|
+
* Get cartridge by ID
|
|
4270
4257
|
*/
|
|
4271
|
-
|
|
4272
|
-
const
|
|
4273
|
-
return
|
|
4258
|
+
getCartridgeById(id) {
|
|
4259
|
+
const cartridges = this.transformToCartridgeArray();
|
|
4260
|
+
return cartridges.find(p => p.id === id);
|
|
4274
4261
|
}
|
|
4275
4262
|
|
|
4276
4263
|
/**
|
|
4277
|
-
* Search
|
|
4264
|
+
* Search cartridges by query
|
|
4278
4265
|
*/
|
|
4279
|
-
|
|
4280
|
-
const
|
|
4266
|
+
searchCartridges(query) {
|
|
4267
|
+
const cartridges = this.transformToCartridgeArray();
|
|
4281
4268
|
const lowerQuery = query.toLowerCase();
|
|
4282
4269
|
|
|
4283
|
-
return
|
|
4270
|
+
return cartridges.filter(p =>
|
|
4284
4271
|
p.name.toLowerCase().includes(lowerQuery) ||
|
|
4285
4272
|
p.description.toLowerCase().includes(lowerQuery) ||
|
|
4286
4273
|
p.tags.some(t => t.toLowerCase().includes(lowerQuery)) ||
|
|
@@ -4289,19 +4276,19 @@ class PluginRepoServer {
|
|
|
4289
4276
|
}
|
|
4290
4277
|
|
|
4291
4278
|
/**
|
|
4292
|
-
* Get
|
|
4279
|
+
* Get cartridges by category
|
|
4293
4280
|
*/
|
|
4294
|
-
|
|
4295
|
-
const
|
|
4296
|
-
return
|
|
4281
|
+
getCartridgesByCategory(category) {
|
|
4282
|
+
const cartridges = this.transformToCartridgeArray();
|
|
4283
|
+
return cartridges.filter(p => p.categories.includes(category));
|
|
4297
4284
|
}
|
|
4298
4285
|
|
|
4299
4286
|
/**
|
|
4300
|
-
* Get
|
|
4287
|
+
* Get cartridges that provide a specific cap
|
|
4301
4288
|
*/
|
|
4302
|
-
|
|
4303
|
-
const
|
|
4304
|
-
return
|
|
4289
|
+
getCartridgesByCap(capUrn) {
|
|
4290
|
+
const cartridges = this.transformToCartridgeArray();
|
|
4291
|
+
return cartridges.filter(p => p.caps.some(c => c.urn === capUrn));
|
|
4305
4292
|
}
|
|
4306
4293
|
}
|
|
4307
4294
|
|
|
@@ -5515,13 +5502,13 @@ module.exports = {
|
|
|
5515
5502
|
CapGraph,
|
|
5516
5503
|
StdinSource,
|
|
5517
5504
|
StdinSourceKind,
|
|
5518
|
-
//
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5505
|
+
// Cartridge Repository
|
|
5506
|
+
CartridgeCapSummary,
|
|
5507
|
+
CartridgeInfo,
|
|
5508
|
+
CartridgeSuggestion,
|
|
5509
|
+
CartridgeRepoCache,
|
|
5510
|
+
CartridgeRepoClient,
|
|
5511
|
+
CartridgeRepoServer,
|
|
5525
5512
|
// Machine notation
|
|
5526
5513
|
MachineSyntaxError,
|
|
5527
5514
|
MachineSyntaxErrorCodes,
|