@lobehub/market-sdk 0.37.0 → 0.38.0-beta.0
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/dist/index.d.mts +70 -68
- package/dist/index.mjs +198 -225
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1840,7 +1840,7 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1840
1840
|
};
|
|
1841
1841
|
|
|
1842
1842
|
// src/market/market-sdk.ts
|
|
1843
|
-
import
|
|
1843
|
+
import debug32 from "debug";
|
|
1844
1844
|
|
|
1845
1845
|
// src/market/services/AgentProfileService.ts
|
|
1846
1846
|
import debug12 from "debug";
|
|
@@ -4406,9 +4406,47 @@ var SkillService = class extends BaseSDK {
|
|
|
4406
4406
|
}
|
|
4407
4407
|
};
|
|
4408
4408
|
|
|
4409
|
-
// src/market/services/
|
|
4409
|
+
// src/market/services/MarketTaskTemplateService.ts
|
|
4410
4410
|
import debug22 from "debug";
|
|
4411
|
-
var log22 = debug22("lobe-market-sdk:
|
|
4411
|
+
var log22 = debug22("lobe-market-sdk:task-templates");
|
|
4412
|
+
var MarketTaskTemplateService = class extends BaseSDK {
|
|
4413
|
+
/**
|
|
4414
|
+
* Retrieves personalized task template recommendations.
|
|
4415
|
+
*
|
|
4416
|
+
* Recommendations require user authentication on the Market API. Results are
|
|
4417
|
+
* deterministic for the same account, UTC day, and refresh seed.
|
|
4418
|
+
*
|
|
4419
|
+
* @param params - Recommendation inputs such as interests, count, enabled connectors, and refresh seed
|
|
4420
|
+
* @param options - Optional request options
|
|
4421
|
+
* @returns Promise resolving to recommended task templates
|
|
4422
|
+
*/
|
|
4423
|
+
async getTaskTemplateRecommendations(params, options) {
|
|
4424
|
+
const locale = params.locale || this.defaultLocale;
|
|
4425
|
+
const body = {
|
|
4426
|
+
count: params.count,
|
|
4427
|
+
enabledConnectors: params.enabledConnectors,
|
|
4428
|
+
excludeIds: params.excludeIds,
|
|
4429
|
+
interestKeys: params.interestKeys,
|
|
4430
|
+
locale,
|
|
4431
|
+
refreshSeed: params.refreshSeed
|
|
4432
|
+
};
|
|
4433
|
+
log22("Getting task template recommendations: %O", body);
|
|
4434
|
+
const result = await this.request(
|
|
4435
|
+
"/v1/task-templates/recommendations",
|
|
4436
|
+
{
|
|
4437
|
+
...options,
|
|
4438
|
+
body: JSON.stringify(body),
|
|
4439
|
+
method: "POST"
|
|
4440
|
+
}
|
|
4441
|
+
);
|
|
4442
|
+
log22("Retrieved %d task template recommendations", result.items.length);
|
|
4443
|
+
return result;
|
|
4444
|
+
}
|
|
4445
|
+
};
|
|
4446
|
+
|
|
4447
|
+
// src/market/services/MarketSkillCollectionService.ts
|
|
4448
|
+
import debug23 from "debug";
|
|
4449
|
+
var log23 = debug23("lobe-market-sdk:skill-collections");
|
|
4412
4450
|
var MarketSkillCollectionService = class extends BaseSDK {
|
|
4413
4451
|
async getSkillCollectionDetail(slug, params = {}, options) {
|
|
4414
4452
|
const locale = params.locale || this.defaultLocale;
|
|
@@ -4417,12 +4455,12 @@ var MarketSkillCollectionService = class extends BaseSDK {
|
|
|
4417
4455
|
locale
|
|
4418
4456
|
};
|
|
4419
4457
|
const queryString = this.buildQueryString(queryParams);
|
|
4420
|
-
|
|
4458
|
+
log23("Getting skill collection detail: %s %O", slug, queryParams);
|
|
4421
4459
|
const result = await this.request(
|
|
4422
4460
|
`/v1/skills/collections/${encodeURIComponent(slug)}${queryString}`,
|
|
4423
4461
|
options
|
|
4424
4462
|
);
|
|
4425
|
-
|
|
4463
|
+
log23("Skill collection detail retrieved: %s (%d items)", slug, result.items.length);
|
|
4426
4464
|
return result;
|
|
4427
4465
|
}
|
|
4428
4466
|
async getSkillCollections(params = {}, options) {
|
|
@@ -4432,19 +4470,19 @@ var MarketSkillCollectionService = class extends BaseSDK {
|
|
|
4432
4470
|
locale
|
|
4433
4471
|
};
|
|
4434
4472
|
const queryString = this.buildQueryString(queryParams);
|
|
4435
|
-
|
|
4473
|
+
log23("Getting skill collections: %O", queryParams);
|
|
4436
4474
|
const result = await this.request(
|
|
4437
4475
|
`/v1/skills/collections${queryString}`,
|
|
4438
4476
|
options
|
|
4439
4477
|
);
|
|
4440
|
-
|
|
4478
|
+
log23("Retrieved %d skill collections", result.length);
|
|
4441
4479
|
return result;
|
|
4442
4480
|
}
|
|
4443
4481
|
};
|
|
4444
4482
|
|
|
4445
4483
|
// src/market/services/MarketSkillService.ts
|
|
4446
|
-
import
|
|
4447
|
-
var
|
|
4484
|
+
import debug24 from "debug";
|
|
4485
|
+
var log24 = debug24("lobe-market-sdk:market-skills");
|
|
4448
4486
|
var MarketSkillService = class extends BaseSDK {
|
|
4449
4487
|
/**
|
|
4450
4488
|
* Retrieves a list of skills from the marketplace
|
|
@@ -4477,9 +4515,9 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4477
4515
|
const locale = params.locale || this.defaultLocale;
|
|
4478
4516
|
const queryParams = { ...params, locale };
|
|
4479
4517
|
const queryString = this.buildQueryString(queryParams);
|
|
4480
|
-
|
|
4518
|
+
log24("Getting skill list: %O", queryParams);
|
|
4481
4519
|
const result = await this.request(`/v1/skills${queryString}`, options);
|
|
4482
|
-
|
|
4520
|
+
log24(
|
|
4483
4521
|
"Retrieved %d skills (page %d/%d)",
|
|
4484
4522
|
result.items.length,
|
|
4485
4523
|
result.currentPage,
|
|
@@ -4518,12 +4556,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4518
4556
|
queryParams.version = params.version;
|
|
4519
4557
|
}
|
|
4520
4558
|
const queryString = this.buildQueryString(queryParams);
|
|
4521
|
-
|
|
4559
|
+
log24("Getting skill detail: %s %O", identifier, params);
|
|
4522
4560
|
const result = await this.request(
|
|
4523
4561
|
`/v1/skills/${encodeURIComponent(identifier)}${queryString}`,
|
|
4524
4562
|
options
|
|
4525
4563
|
);
|
|
4526
|
-
|
|
4564
|
+
log24("Skill detail retrieved: %s (v%s)", identifier, result.version);
|
|
4527
4565
|
return result;
|
|
4528
4566
|
}
|
|
4529
4567
|
/**
|
|
@@ -4554,7 +4592,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4554
4592
|
if (version) {
|
|
4555
4593
|
url += `?version=${encodeURIComponent(version)}`;
|
|
4556
4594
|
}
|
|
4557
|
-
|
|
4595
|
+
log24("Generated download URL: %s", url);
|
|
4558
4596
|
return url;
|
|
4559
4597
|
}
|
|
4560
4598
|
/**
|
|
@@ -4578,7 +4616,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4578
4616
|
* ```
|
|
4579
4617
|
*/
|
|
4580
4618
|
async downloadSkill(identifier, version, options) {
|
|
4581
|
-
|
|
4619
|
+
log24("Downloading skill: %s (version: %s)", identifier, version || "latest");
|
|
4582
4620
|
const queryParams = {};
|
|
4583
4621
|
if (version) {
|
|
4584
4622
|
queryParams.version = version;
|
|
@@ -4594,7 +4632,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4594
4632
|
});
|
|
4595
4633
|
if (!response.ok) {
|
|
4596
4634
|
const errorText = await response.text();
|
|
4597
|
-
|
|
4635
|
+
log24("Download failed: %s %s", response.status, errorText);
|
|
4598
4636
|
throw new Error(`Failed to download skill: ${response.statusText}`);
|
|
4599
4637
|
}
|
|
4600
4638
|
const contentDisposition = response.headers.get("content-disposition");
|
|
@@ -4606,7 +4644,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4606
4644
|
}
|
|
4607
4645
|
}
|
|
4608
4646
|
const buffer = await response.arrayBuffer();
|
|
4609
|
-
|
|
4647
|
+
log24("Downloaded skill: %s (%d bytes)", filename, buffer.byteLength);
|
|
4610
4648
|
return { buffer, filename };
|
|
4611
4649
|
}
|
|
4612
4650
|
/**
|
|
@@ -4634,12 +4672,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4634
4672
|
const locale = params.locale || this.defaultLocale;
|
|
4635
4673
|
const queryParams = { ...params, locale };
|
|
4636
4674
|
const queryString = this.buildQueryString(queryParams);
|
|
4637
|
-
|
|
4675
|
+
log24("Getting skill categories: %O", queryParams);
|
|
4638
4676
|
const result = await this.request(
|
|
4639
4677
|
`/v1/skills/categories${queryString}`,
|
|
4640
4678
|
options
|
|
4641
4679
|
);
|
|
4642
|
-
|
|
4680
|
+
log24("Retrieved %d categories", result.length);
|
|
4643
4681
|
return result;
|
|
4644
4682
|
}
|
|
4645
4683
|
/**
|
|
@@ -4654,12 +4692,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4654
4692
|
* @returns Promise resolving to an array of identifiers with last modified times
|
|
4655
4693
|
*/
|
|
4656
4694
|
async getPublishedIdentifiers(options) {
|
|
4657
|
-
|
|
4695
|
+
log24("Getting published skill identifiers");
|
|
4658
4696
|
const result = await this.request(
|
|
4659
4697
|
"/v1/skills/identifiers",
|
|
4660
4698
|
options
|
|
4661
4699
|
);
|
|
4662
|
-
|
|
4700
|
+
log24("Retrieved %d published skill identifiers", result.length);
|
|
4663
4701
|
return result;
|
|
4664
4702
|
}
|
|
4665
4703
|
/**
|
|
@@ -4670,9 +4708,9 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4670
4708
|
*/
|
|
4671
4709
|
async getSitemap(params = {}, options) {
|
|
4672
4710
|
const queryString = this.buildQueryString(params);
|
|
4673
|
-
|
|
4711
|
+
log24("Getting skill sitemap%s", queryString);
|
|
4674
4712
|
const result = await this.request(`/v1/skills/sitemap${queryString}`, options);
|
|
4675
|
-
|
|
4713
|
+
log24(
|
|
4676
4714
|
"Retrieved skill sitemap page %d/%d (%d items)",
|
|
4677
4715
|
result.currentPage,
|
|
4678
4716
|
result.totalPages,
|
|
@@ -4688,13 +4726,13 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4688
4726
|
* @returns Promise resolving to true if skill exists, false otherwise
|
|
4689
4727
|
*/
|
|
4690
4728
|
async checkSkillExists(identifier, options) {
|
|
4691
|
-
|
|
4729
|
+
log24("Checking if skill exists: %s", identifier);
|
|
4692
4730
|
try {
|
|
4693
4731
|
await this.getSkillDetail(identifier, {}, options);
|
|
4694
|
-
|
|
4732
|
+
log24("Skill exists: %s", identifier);
|
|
4695
4733
|
return true;
|
|
4696
4734
|
} catch (e) {
|
|
4697
|
-
|
|
4735
|
+
log24("Skill does not exist: %s", identifier);
|
|
4698
4736
|
return false;
|
|
4699
4737
|
}
|
|
4700
4738
|
}
|
|
@@ -4715,12 +4753,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4715
4753
|
* ```
|
|
4716
4754
|
*/
|
|
4717
4755
|
async getSkillVersions(identifier, options) {
|
|
4718
|
-
|
|
4756
|
+
log24("Getting skill versions: %s", identifier);
|
|
4719
4757
|
const result = await this.request(
|
|
4720
4758
|
`/v1/skills/${encodeURIComponent(identifier)}/versions`,
|
|
4721
4759
|
options
|
|
4722
4760
|
);
|
|
4723
|
-
|
|
4761
|
+
log24("Retrieved %d versions for skill %s", result.data.length, identifier);
|
|
4724
4762
|
return result.data;
|
|
4725
4763
|
}
|
|
4726
4764
|
/**
|
|
@@ -4744,12 +4782,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4744
4782
|
const locale = params.locale || this.defaultLocale;
|
|
4745
4783
|
const queryParams = { locale };
|
|
4746
4784
|
const queryString = this.buildQueryString(queryParams);
|
|
4747
|
-
|
|
4785
|
+
log24("Getting skill version: %s@%s", identifier, version);
|
|
4748
4786
|
const result = await this.request(
|
|
4749
4787
|
`/v1/skills/${encodeURIComponent(identifier)}/versions/${encodeURIComponent(version)}${queryString}`,
|
|
4750
4788
|
options
|
|
4751
4789
|
);
|
|
4752
|
-
|
|
4790
|
+
log24("Skill version detail retrieved: %s@%s", identifier, version);
|
|
4753
4791
|
return result;
|
|
4754
4792
|
}
|
|
4755
4793
|
/**
|
|
@@ -4778,13 +4816,13 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4778
4816
|
* ```
|
|
4779
4817
|
*/
|
|
4780
4818
|
async reportGitHubSkill(params, options) {
|
|
4781
|
-
|
|
4819
|
+
log24("Reporting GitHub skill: %s", params.gitUrl);
|
|
4782
4820
|
const result = await this.request("/v1/skills/report/github", {
|
|
4783
4821
|
...options,
|
|
4784
4822
|
body: JSON.stringify(params),
|
|
4785
4823
|
method: "POST"
|
|
4786
4824
|
});
|
|
4787
|
-
|
|
4825
|
+
log24("GitHub skill reported: %s (status: %s)", result.identifier, result.status);
|
|
4788
4826
|
return result;
|
|
4789
4827
|
}
|
|
4790
4828
|
/**
|
|
@@ -4809,7 +4847,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4809
4847
|
* ```
|
|
4810
4848
|
*/
|
|
4811
4849
|
async reportSkillInstall(params, options) {
|
|
4812
|
-
|
|
4850
|
+
log24("Reporting skill install: %s (success: %s)", params.identifier, params.success);
|
|
4813
4851
|
const result = await this.request(
|
|
4814
4852
|
"/v1/skills/report/installation",
|
|
4815
4853
|
{
|
|
@@ -4818,7 +4856,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4818
4856
|
method: "POST"
|
|
4819
4857
|
}
|
|
4820
4858
|
);
|
|
4821
|
-
|
|
4859
|
+
log24("Skill install reported: %s", result.message);
|
|
4822
4860
|
return result;
|
|
4823
4861
|
}
|
|
4824
4862
|
/**
|
|
@@ -4830,7 +4868,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4830
4868
|
* @returns Promise resolving to the submitted score
|
|
4831
4869
|
*/
|
|
4832
4870
|
async submitRating(identifier, score, options) {
|
|
4833
|
-
|
|
4871
|
+
log24("Submitting rating for skill %s: %d", identifier, score);
|
|
4834
4872
|
const result = await this.request(
|
|
4835
4873
|
`/v1/skills/${encodeURIComponent(identifier)}/ratings`,
|
|
4836
4874
|
{
|
|
@@ -4839,7 +4877,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4839
4877
|
method: "POST"
|
|
4840
4878
|
}
|
|
4841
4879
|
);
|
|
4842
|
-
|
|
4880
|
+
log24("Rating submitted for skill %s: %d", identifier, result.score);
|
|
4843
4881
|
return result;
|
|
4844
4882
|
}
|
|
4845
4883
|
/**
|
|
@@ -4850,12 +4888,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4850
4888
|
* @returns Promise resolving to the rating distribution
|
|
4851
4889
|
*/
|
|
4852
4890
|
async getRatingDistribution(identifier, options) {
|
|
4853
|
-
|
|
4891
|
+
log24("Getting rating distribution for skill: %s", identifier);
|
|
4854
4892
|
const result = await this.request(
|
|
4855
4893
|
`/v1/skills/${encodeURIComponent(identifier)}/ratings/distribution`,
|
|
4856
4894
|
options
|
|
4857
4895
|
);
|
|
4858
|
-
|
|
4896
|
+
log24("Rating distribution retrieved for skill %s: %d total", identifier, result.totalCount);
|
|
4859
4897
|
return result;
|
|
4860
4898
|
}
|
|
4861
4899
|
/**
|
|
@@ -4868,12 +4906,12 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4868
4906
|
*/
|
|
4869
4907
|
async getComments(identifier, params = {}, options) {
|
|
4870
4908
|
const queryString = this.buildQueryString(params);
|
|
4871
|
-
|
|
4909
|
+
log24("Getting comments for skill %s: %O", identifier, params);
|
|
4872
4910
|
const result = await this.request(
|
|
4873
4911
|
`/v1/skills/${encodeURIComponent(identifier)}/comments${queryString}`,
|
|
4874
4912
|
options
|
|
4875
4913
|
);
|
|
4876
|
-
|
|
4914
|
+
log24(
|
|
4877
4915
|
"Retrieved %d comments for skill %s (page %d/%d)",
|
|
4878
4916
|
result.items.length,
|
|
4879
4917
|
identifier,
|
|
@@ -4890,15 +4928,15 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4890
4928
|
* @returns Promise resolving to the latest own comment or null when none exists
|
|
4891
4929
|
*/
|
|
4892
4930
|
async getLatestOwnComment(identifier, options) {
|
|
4893
|
-
|
|
4931
|
+
log24("Getting latest own comment for skill %s", identifier);
|
|
4894
4932
|
const result = await this.request(
|
|
4895
4933
|
`/v1/skills/${encodeURIComponent(identifier)}/comments/latest`,
|
|
4896
4934
|
options
|
|
4897
4935
|
);
|
|
4898
4936
|
if (result) {
|
|
4899
|
-
|
|
4937
|
+
log24("Retrieved latest own comment for skill %s: id=%d", identifier, result.id);
|
|
4900
4938
|
} else {
|
|
4901
|
-
|
|
4939
|
+
log24("No own comments found for skill %s", identifier);
|
|
4902
4940
|
}
|
|
4903
4941
|
return result;
|
|
4904
4942
|
}
|
|
@@ -4911,7 +4949,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4911
4949
|
* @returns Promise resolving to the created comment (with optional rating field)
|
|
4912
4950
|
*/
|
|
4913
4951
|
async createComment(identifier, data, options) {
|
|
4914
|
-
|
|
4952
|
+
log24("Creating comment on skill %s", identifier);
|
|
4915
4953
|
const result = await this.request(
|
|
4916
4954
|
`/v1/skills/${encodeURIComponent(identifier)}/comments`,
|
|
4917
4955
|
{
|
|
@@ -4920,7 +4958,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4920
4958
|
method: "POST"
|
|
4921
4959
|
}
|
|
4922
4960
|
);
|
|
4923
|
-
|
|
4961
|
+
log24("Comment created on skill %s: id=%d", identifier, result.id);
|
|
4924
4962
|
return result;
|
|
4925
4963
|
}
|
|
4926
4964
|
/**
|
|
@@ -4932,7 +4970,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4932
4970
|
* @returns Promise resolving to success status
|
|
4933
4971
|
*/
|
|
4934
4972
|
async deleteComment(identifier, commentId, options) {
|
|
4935
|
-
|
|
4973
|
+
log24("Deleting comment %d from skill %s", commentId, identifier);
|
|
4936
4974
|
const result = await this.request(
|
|
4937
4975
|
`/v1/skills/${encodeURIComponent(identifier)}/comments/${commentId}`,
|
|
4938
4976
|
{
|
|
@@ -4940,7 +4978,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4940
4978
|
method: "DELETE"
|
|
4941
4979
|
}
|
|
4942
4980
|
);
|
|
4943
|
-
|
|
4981
|
+
log24("Comment %d deleted from skill %s", commentId, identifier);
|
|
4944
4982
|
return result;
|
|
4945
4983
|
}
|
|
4946
4984
|
/**
|
|
@@ -4952,7 +4990,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4952
4990
|
* @returns Promise resolving to the created reaction
|
|
4953
4991
|
*/
|
|
4954
4992
|
async addReaction(commentId, type, options) {
|
|
4955
|
-
|
|
4993
|
+
log24("Adding %s reaction to comment %d", type, commentId);
|
|
4956
4994
|
const result = await this.request(
|
|
4957
4995
|
`/v1/skills/comments/${commentId}/reactions`,
|
|
4958
4996
|
{
|
|
@@ -4961,7 +4999,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4961
4999
|
method: "POST"
|
|
4962
5000
|
}
|
|
4963
5001
|
);
|
|
4964
|
-
|
|
5002
|
+
log24("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
|
|
4965
5003
|
return result;
|
|
4966
5004
|
}
|
|
4967
5005
|
/**
|
|
@@ -4972,7 +5010,7 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4972
5010
|
* @returns Promise resolving to success status
|
|
4973
5011
|
*/
|
|
4974
5012
|
async removeReaction(commentId, options) {
|
|
4975
|
-
|
|
5013
|
+
log24("Removing reaction from comment %d", commentId);
|
|
4976
5014
|
const result = await this.request(
|
|
4977
5015
|
`/v1/skills/comments/${commentId}/reactions`,
|
|
4978
5016
|
{
|
|
@@ -4980,19 +5018,19 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4980
5018
|
method: "DELETE"
|
|
4981
5019
|
}
|
|
4982
5020
|
);
|
|
4983
|
-
|
|
5021
|
+
log24("Reaction removed from comment %d", commentId);
|
|
4984
5022
|
return result;
|
|
4985
5023
|
}
|
|
4986
5024
|
};
|
|
4987
5025
|
|
|
4988
5026
|
// src/market/services/OrganizationCredsService.ts
|
|
4989
|
-
import
|
|
5027
|
+
import debug25 from "debug";
|
|
4990
5028
|
|
|
4991
5029
|
// src/utils/orgRef.ts
|
|
4992
5030
|
var orgRefToPathSegment = (ref) => typeof ref === "number" ? String(ref) : `workspace:${encodeURIComponent(ref.workspaceId)}`;
|
|
4993
5031
|
|
|
4994
5032
|
// src/market/services/OrganizationCredsService.ts
|
|
4995
|
-
var
|
|
5033
|
+
var log25 = debug25("lobe-market-sdk:org-creds");
|
|
4996
5034
|
var OrganizationCredsService = class extends BaseSDK {
|
|
4997
5035
|
constructor(orgId, options = {}, sharedHeaders, sharedTokenState) {
|
|
4998
5036
|
super(options, sharedHeaders, sharedTokenState);
|
|
@@ -5017,26 +5055,26 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5017
5055
|
// ===========================================================================
|
|
5018
5056
|
async list(options) {
|
|
5019
5057
|
var _a;
|
|
5020
|
-
|
|
5058
|
+
log25("Listing org %s credentials", this.orgSegment);
|
|
5021
5059
|
const result = await this.request(this.base(), options);
|
|
5022
|
-
|
|
5060
|
+
log25("Found %d credentials for org %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgSegment);
|
|
5023
5061
|
return result;
|
|
5024
5062
|
}
|
|
5025
5063
|
async get(id, getOptions, options) {
|
|
5026
|
-
|
|
5064
|
+
log25("Getting org %s credential %d (decrypt=%s)", this.orgSegment, id, getOptions == null ? void 0 : getOptions.decrypt);
|
|
5027
5065
|
const queryString = this.buildQueryString((getOptions == null ? void 0 : getOptions.decrypt) ? { decrypt: "true" } : {});
|
|
5028
5066
|
const result = await this.request(
|
|
5029
5067
|
`${this.base()}/${id}${queryString}`,
|
|
5030
5068
|
options
|
|
5031
5069
|
);
|
|
5032
|
-
|
|
5070
|
+
log25("Retrieved org credential: %s", result.key);
|
|
5033
5071
|
return result;
|
|
5034
5072
|
}
|
|
5035
5073
|
// ===========================================================================
|
|
5036
5074
|
// Create
|
|
5037
5075
|
// ===========================================================================
|
|
5038
5076
|
async createKV(data, options) {
|
|
5039
|
-
|
|
5077
|
+
log25("Creating org %s KV credential: %s (type=%s)", this.orgSegment, data.key, data.type);
|
|
5040
5078
|
return this.request(`${this.base()}/kv`, {
|
|
5041
5079
|
body: JSON.stringify(data),
|
|
5042
5080
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5045,7 +5083,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5045
5083
|
});
|
|
5046
5084
|
}
|
|
5047
5085
|
async createOAuth(data, options) {
|
|
5048
|
-
|
|
5086
|
+
log25("Creating org %s OAuth credential: %s", this.orgSegment, data.key);
|
|
5049
5087
|
return this.request(`${this.base()}/oauth`, {
|
|
5050
5088
|
body: JSON.stringify(data),
|
|
5051
5089
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5054,7 +5092,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5054
5092
|
});
|
|
5055
5093
|
}
|
|
5056
5094
|
async createFile(data, options) {
|
|
5057
|
-
|
|
5095
|
+
log25("Creating org %s file credential: %s", this.orgSegment, data.key);
|
|
5058
5096
|
return this.request(`${this.base()}/file`, {
|
|
5059
5097
|
body: JSON.stringify(data),
|
|
5060
5098
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5066,7 +5104,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5066
5104
|
// Update
|
|
5067
5105
|
// ===========================================================================
|
|
5068
5106
|
async update(id, data, options) {
|
|
5069
|
-
|
|
5107
|
+
log25("Updating org %s credential %d", this.orgSegment, id);
|
|
5070
5108
|
return this.request(`${this.base()}/${id}`, {
|
|
5071
5109
|
body: JSON.stringify(data),
|
|
5072
5110
|
headers: { "Content-Type": "application/json" },
|
|
@@ -5078,14 +5116,14 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5078
5116
|
// Delete
|
|
5079
5117
|
// ===========================================================================
|
|
5080
5118
|
async delete(id, options) {
|
|
5081
|
-
|
|
5119
|
+
log25("Deleting org %s credential %d", this.orgSegment, id);
|
|
5082
5120
|
return this.request(`${this.base()}/${id}`, {
|
|
5083
5121
|
method: "DELETE",
|
|
5084
5122
|
...options
|
|
5085
5123
|
});
|
|
5086
5124
|
}
|
|
5087
5125
|
async deleteByKey(key, options) {
|
|
5088
|
-
|
|
5126
|
+
log25("Deleting org %s credential by key: %s", this.orgSegment, key);
|
|
5089
5127
|
return this.request(`${this.base()}/key/${encodeURIComponent(key)}`, {
|
|
5090
5128
|
method: "DELETE",
|
|
5091
5129
|
...options
|
|
@@ -5099,7 +5137,7 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5099
5137
|
* the org has bound vs. is missing. Reads only; any org member may call.
|
|
5100
5138
|
*/
|
|
5101
5139
|
async getSkillCredStatus(skillIdentifier, options) {
|
|
5102
|
-
|
|
5140
|
+
log25("Getting org %s skill cred status: %s", this.orgSegment, skillIdentifier);
|
|
5103
5141
|
const path = `/v1/organizations/${this.orgSegment}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
|
|
5104
5142
|
const result = await this.request(
|
|
5105
5143
|
path,
|
|
@@ -5110,8 +5148,8 @@ var OrganizationCredsService = class extends BaseSDK {
|
|
|
5110
5148
|
};
|
|
5111
5149
|
|
|
5112
5150
|
// src/market/services/OrganizationService.ts
|
|
5113
|
-
import
|
|
5114
|
-
var
|
|
5151
|
+
import debug26 from "debug";
|
|
5152
|
+
var log26 = debug26("lobe-market-sdk:organization");
|
|
5115
5153
|
var OrganizationService2 = class extends BaseSDK {
|
|
5116
5154
|
constructor(options = {}, sharedHeaders, sharedTokenState) {
|
|
5117
5155
|
super(options, sharedHeaders, sharedTokenState);
|
|
@@ -5159,12 +5197,12 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5159
5197
|
async getOrganizationInfo(idOrNamespace, params = {}, options) {
|
|
5160
5198
|
const locale = params.locale || this.defaultLocale;
|
|
5161
5199
|
const queryString = this.buildQueryString({ locale });
|
|
5162
|
-
|
|
5200
|
+
log26("Getting organization info: %O", { idOrNamespace, ...params });
|
|
5163
5201
|
const result = await this.request(
|
|
5164
5202
|
`/v1/organizations/info/${idOrNamespace}${queryString}`,
|
|
5165
5203
|
options
|
|
5166
5204
|
);
|
|
5167
|
-
|
|
5205
|
+
log26("Organization info retrieved for: %s", idOrNamespace);
|
|
5168
5206
|
return result;
|
|
5169
5207
|
}
|
|
5170
5208
|
/**
|
|
@@ -5174,7 +5212,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5174
5212
|
* @returns Promise resolving to the user's organizations
|
|
5175
5213
|
*/
|
|
5176
5214
|
async listMyOrganizations(options) {
|
|
5177
|
-
|
|
5215
|
+
log26("Listing organizations for current user");
|
|
5178
5216
|
const result = await this.request(
|
|
5179
5217
|
"/v1/organizations/me",
|
|
5180
5218
|
options
|
|
@@ -5192,7 +5230,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5192
5230
|
* @returns The created/existing organization and whether it was newly created
|
|
5193
5231
|
*/
|
|
5194
5232
|
async createOrganization(data, options) {
|
|
5195
|
-
|
|
5233
|
+
log26("Creating organization: %s", data.clerkId);
|
|
5196
5234
|
return this.request("/v1/organizations", {
|
|
5197
5235
|
...options,
|
|
5198
5236
|
body: JSON.stringify(data),
|
|
@@ -5207,7 +5245,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5207
5245
|
* @returns The updated organization
|
|
5208
5246
|
*/
|
|
5209
5247
|
async updateOrganization(orgId, data, options) {
|
|
5210
|
-
|
|
5248
|
+
log26("Updating organization %d: %O", orgId, data);
|
|
5211
5249
|
const result = await this.request(
|
|
5212
5250
|
`/v1/organizations/${orgRefToPathSegment(orgId)}`,
|
|
5213
5251
|
{
|
|
@@ -5226,7 +5264,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5226
5264
|
* @returns The archived organization
|
|
5227
5265
|
*/
|
|
5228
5266
|
async archiveOrganization(orgId, options) {
|
|
5229
|
-
|
|
5267
|
+
log26("Archiving organization %d", orgId);
|
|
5230
5268
|
const result = await this.request(
|
|
5231
5269
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/archive`,
|
|
5232
5270
|
{ ...options, method: "POST" }
|
|
@@ -5240,7 +5278,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5240
5278
|
* @returns The reactivated organization
|
|
5241
5279
|
*/
|
|
5242
5280
|
async unarchiveOrganization(orgId, options) {
|
|
5243
|
-
|
|
5281
|
+
log26("Unarchiving organization %d", orgId);
|
|
5244
5282
|
const result = await this.request(
|
|
5245
5283
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/unarchive`,
|
|
5246
5284
|
{ ...options, method: "POST" }
|
|
@@ -5254,7 +5292,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5254
5292
|
* @returns Hydrated member rows
|
|
5255
5293
|
*/
|
|
5256
5294
|
async listMembers(orgId, options) {
|
|
5257
|
-
|
|
5295
|
+
log26("Listing members of organization %d", orgId);
|
|
5258
5296
|
const result = await this.request(
|
|
5259
5297
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5260
5298
|
options
|
|
@@ -5271,7 +5309,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5271
5309
|
* @returns Whether the member was newly added and their effective role
|
|
5272
5310
|
*/
|
|
5273
5311
|
async addMember(orgId, userAccountId, role, options) {
|
|
5274
|
-
|
|
5312
|
+
log26("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
|
|
5275
5313
|
return this.request(
|
|
5276
5314
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5277
5315
|
{
|
|
@@ -5290,7 +5328,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5290
5328
|
* @returns Whether a membership row was removed
|
|
5291
5329
|
*/
|
|
5292
5330
|
async removeMember(orgId, userAccountId, options) {
|
|
5293
|
-
|
|
5331
|
+
log26("Removing member %d from organization %d", userAccountId, orgId);
|
|
5294
5332
|
return this.request(
|
|
5295
5333
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
|
|
5296
5334
|
{ ...options, method: "DELETE" }
|
|
@@ -5306,7 +5344,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5306
5344
|
* @returns The effective role and whether it changed
|
|
5307
5345
|
*/
|
|
5308
5346
|
async updateMemberRole(orgId, userAccountId, role, options) {
|
|
5309
|
-
|
|
5347
|
+
log26("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
|
|
5310
5348
|
return this.request(
|
|
5311
5349
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
|
|
5312
5350
|
{ ...options, body: JSON.stringify({ role }), method: "PATCH" }
|
|
@@ -5324,7 +5362,7 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5324
5362
|
* @returns Counts of added / removed / updated members and skipped ids
|
|
5325
5363
|
*/
|
|
5326
5364
|
async reconcileMembers(orgId, members, options) {
|
|
5327
|
-
|
|
5365
|
+
log26("Reconciling %d members for organization %d", members.length, orgId);
|
|
5328
5366
|
return this.request(
|
|
5329
5367
|
`/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
|
|
5330
5368
|
{
|
|
@@ -5337,8 +5375,8 @@ var OrganizationService2 = class extends BaseSDK {
|
|
|
5337
5375
|
};
|
|
5338
5376
|
|
|
5339
5377
|
// src/market/services/UserService.ts
|
|
5340
|
-
import
|
|
5341
|
-
var
|
|
5378
|
+
import debug27 from "debug";
|
|
5379
|
+
var log27 = debug27("lobe-market-sdk:user");
|
|
5342
5380
|
var UserService = class extends BaseSDK {
|
|
5343
5381
|
/**
|
|
5344
5382
|
* Retrieves user information by account ID or userName
|
|
@@ -5355,12 +5393,12 @@ var UserService = class extends BaseSDK {
|
|
|
5355
5393
|
const locale = params.locale || this.defaultLocale;
|
|
5356
5394
|
const queryParams = { locale };
|
|
5357
5395
|
const queryString = this.buildQueryString(queryParams);
|
|
5358
|
-
|
|
5396
|
+
log27("Getting user info: %O", { idOrUserName, ...params });
|
|
5359
5397
|
const result = await this.request(
|
|
5360
5398
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
5361
5399
|
options
|
|
5362
5400
|
);
|
|
5363
|
-
|
|
5401
|
+
log27("User info successfully retrieved for: %s", idOrUserName);
|
|
5364
5402
|
return result;
|
|
5365
5403
|
}
|
|
5366
5404
|
/**
|
|
@@ -5375,7 +5413,7 @@ var UserService = class extends BaseSDK {
|
|
|
5375
5413
|
* @throws Error if userName is already taken or update fails
|
|
5376
5414
|
*/
|
|
5377
5415
|
async updateUserInfo(data, options) {
|
|
5378
|
-
|
|
5416
|
+
log27("Updating user info: %O", data);
|
|
5379
5417
|
const result = await this.request("/v1/user/update", {
|
|
5380
5418
|
body: JSON.stringify(data),
|
|
5381
5419
|
headers: {
|
|
@@ -5384,7 +5422,7 @@ var UserService = class extends BaseSDK {
|
|
|
5384
5422
|
method: "POST",
|
|
5385
5423
|
...options
|
|
5386
5424
|
});
|
|
5387
|
-
|
|
5425
|
+
log27("User info updated successfully");
|
|
5388
5426
|
return result;
|
|
5389
5427
|
}
|
|
5390
5428
|
/**
|
|
@@ -5414,7 +5452,7 @@ var UserService = class extends BaseSDK {
|
|
|
5414
5452
|
* ```
|
|
5415
5453
|
*/
|
|
5416
5454
|
async register(data, options) {
|
|
5417
|
-
|
|
5455
|
+
log27("Registering user: %O", {
|
|
5418
5456
|
followUserId: data.followUserId,
|
|
5419
5457
|
registerUserId: data.registerUserId
|
|
5420
5458
|
});
|
|
@@ -5426,14 +5464,14 @@ var UserService = class extends BaseSDK {
|
|
|
5426
5464
|
method: "POST",
|
|
5427
5465
|
...options
|
|
5428
5466
|
});
|
|
5429
|
-
|
|
5467
|
+
log27("User registered successfully: created=%s, userId=%s", result.created, result.user.clerkId);
|
|
5430
5468
|
return result;
|
|
5431
5469
|
}
|
|
5432
5470
|
};
|
|
5433
5471
|
|
|
5434
5472
|
// src/market/services/UserFollowService.ts
|
|
5435
|
-
import
|
|
5436
|
-
var
|
|
5473
|
+
import debug28 from "debug";
|
|
5474
|
+
var log28 = debug28("lobe-market-sdk:user-follow");
|
|
5437
5475
|
var UserFollowService = class extends BaseSDK {
|
|
5438
5476
|
/**
|
|
5439
5477
|
* Follow a user
|
|
@@ -5447,7 +5485,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5447
5485
|
* @throws Error if already following or cannot follow yourself
|
|
5448
5486
|
*/
|
|
5449
5487
|
async follow(followingId, options) {
|
|
5450
|
-
|
|
5488
|
+
log28("Following user: %d", followingId);
|
|
5451
5489
|
const body = { followingId };
|
|
5452
5490
|
const result = await this.request("/v1/user/follows", {
|
|
5453
5491
|
body: JSON.stringify(body),
|
|
@@ -5457,7 +5495,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5457
5495
|
method: "POST",
|
|
5458
5496
|
...options
|
|
5459
5497
|
});
|
|
5460
|
-
|
|
5498
|
+
log28("Successfully followed user: %d", followingId);
|
|
5461
5499
|
return result;
|
|
5462
5500
|
}
|
|
5463
5501
|
/**
|
|
@@ -5472,7 +5510,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5472
5510
|
* @throws Error if follow relationship not found
|
|
5473
5511
|
*/
|
|
5474
5512
|
async unfollow(followingId, options) {
|
|
5475
|
-
|
|
5513
|
+
log28("Unfollowing user: %d", followingId);
|
|
5476
5514
|
const body = { followingId };
|
|
5477
5515
|
const result = await this.request("/v1/user/follows", {
|
|
5478
5516
|
body: JSON.stringify(body),
|
|
@@ -5482,7 +5520,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5482
5520
|
method: "DELETE",
|
|
5483
5521
|
...options
|
|
5484
5522
|
});
|
|
5485
|
-
|
|
5523
|
+
log28("Successfully unfollowed user: %d", followingId);
|
|
5486
5524
|
return result;
|
|
5487
5525
|
}
|
|
5488
5526
|
/**
|
|
@@ -5496,13 +5534,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5496
5534
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
5497
5535
|
*/
|
|
5498
5536
|
async checkFollowStatus(targetUserId, options) {
|
|
5499
|
-
|
|
5537
|
+
log28("Checking follow status for user: %d", targetUserId);
|
|
5500
5538
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
5501
5539
|
const result = await this.request(
|
|
5502
5540
|
`/v1/user/follows/check${queryString}`,
|
|
5503
5541
|
options
|
|
5504
5542
|
);
|
|
5505
|
-
|
|
5543
|
+
log28("Follow status retrieved: %O", result);
|
|
5506
5544
|
return result;
|
|
5507
5545
|
}
|
|
5508
5546
|
/**
|
|
@@ -5517,7 +5555,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5517
5555
|
* @returns Promise resolving to list of following users
|
|
5518
5556
|
*/
|
|
5519
5557
|
async getFollowing(userId, params = {}, options) {
|
|
5520
|
-
|
|
5558
|
+
log28("Getting following list for user: %d", userId);
|
|
5521
5559
|
const queryParams = {};
|
|
5522
5560
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5523
5561
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5526,7 +5564,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5526
5564
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
5527
5565
|
options
|
|
5528
5566
|
);
|
|
5529
|
-
|
|
5567
|
+
log28("Following list retrieved for user: %d", userId);
|
|
5530
5568
|
return result;
|
|
5531
5569
|
}
|
|
5532
5570
|
/**
|
|
@@ -5541,7 +5579,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5541
5579
|
* @returns Promise resolving to list of followers
|
|
5542
5580
|
*/
|
|
5543
5581
|
async getFollowers(userId, params = {}, options) {
|
|
5544
|
-
|
|
5582
|
+
log28("Getting followers list for user: %d", userId);
|
|
5545
5583
|
const queryParams = {};
|
|
5546
5584
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5547
5585
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5550,14 +5588,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5550
5588
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
5551
5589
|
options
|
|
5552
5590
|
);
|
|
5553
|
-
|
|
5591
|
+
log28("Followers list retrieved for user: %d", userId);
|
|
5554
5592
|
return result;
|
|
5555
5593
|
}
|
|
5556
5594
|
};
|
|
5557
5595
|
|
|
5558
5596
|
// src/market/services/UserFavoriteService.ts
|
|
5559
|
-
import
|
|
5560
|
-
var
|
|
5597
|
+
import debug29 from "debug";
|
|
5598
|
+
var log29 = debug29("lobe-market-sdk:user-favorite");
|
|
5561
5599
|
var UserFavoriteService = class extends BaseSDK {
|
|
5562
5600
|
/**
|
|
5563
5601
|
* Add to favorites
|
|
@@ -5572,7 +5610,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5572
5610
|
* @throws Error if already in favorites
|
|
5573
5611
|
*/
|
|
5574
5612
|
async addFavorite(targetType, targetId, options) {
|
|
5575
|
-
|
|
5613
|
+
log29("Adding favorite: %s %d", targetType, targetId);
|
|
5576
5614
|
const body = { targetId, targetType };
|
|
5577
5615
|
const result = await this.request("/v1/user/favorites", {
|
|
5578
5616
|
body: JSON.stringify(body),
|
|
@@ -5582,7 +5620,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5582
5620
|
method: "POST",
|
|
5583
5621
|
...options
|
|
5584
5622
|
});
|
|
5585
|
-
|
|
5623
|
+
log29("Successfully added favorite: %s %d", targetType, targetId);
|
|
5586
5624
|
return result;
|
|
5587
5625
|
}
|
|
5588
5626
|
/**
|
|
@@ -5598,7 +5636,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5598
5636
|
* @throws Error if favorite not found
|
|
5599
5637
|
*/
|
|
5600
5638
|
async removeFavorite(targetType, targetId, options) {
|
|
5601
|
-
|
|
5639
|
+
log29("Removing favorite: %s %d", targetType, targetId);
|
|
5602
5640
|
const body = { targetId, targetType };
|
|
5603
5641
|
const result = await this.request("/v1/user/favorites", {
|
|
5604
5642
|
body: JSON.stringify(body),
|
|
@@ -5608,7 +5646,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5608
5646
|
method: "DELETE",
|
|
5609
5647
|
...options
|
|
5610
5648
|
});
|
|
5611
|
-
|
|
5649
|
+
log29("Successfully removed favorite: %s %d", targetType, targetId);
|
|
5612
5650
|
return result;
|
|
5613
5651
|
}
|
|
5614
5652
|
/**
|
|
@@ -5623,7 +5661,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5623
5661
|
* @returns Promise resolving to favorite status
|
|
5624
5662
|
*/
|
|
5625
5663
|
async checkFavorite(targetType, targetId, options) {
|
|
5626
|
-
|
|
5664
|
+
log29("Checking favorite status: %s %d", targetType, targetId);
|
|
5627
5665
|
const queryString = this.buildQueryString({
|
|
5628
5666
|
targetId: String(targetId),
|
|
5629
5667
|
targetType
|
|
@@ -5632,7 +5670,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5632
5670
|
`/v1/user/favorites/check${queryString}`,
|
|
5633
5671
|
options
|
|
5634
5672
|
);
|
|
5635
|
-
|
|
5673
|
+
log29("Favorite status retrieved: %O", result);
|
|
5636
5674
|
return result;
|
|
5637
5675
|
}
|
|
5638
5676
|
/**
|
|
@@ -5646,7 +5684,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5646
5684
|
* @returns Promise resolving to list of favorites
|
|
5647
5685
|
*/
|
|
5648
5686
|
async getMyFavorites(params = {}, options) {
|
|
5649
|
-
|
|
5687
|
+
log29("Getting my favorites: %O", params);
|
|
5650
5688
|
const queryParams = {};
|
|
5651
5689
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5652
5690
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5656,7 +5694,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5656
5694
|
`/v1/user/favorites/me${queryString}`,
|
|
5657
5695
|
options
|
|
5658
5696
|
);
|
|
5659
|
-
|
|
5697
|
+
log29("My favorites retrieved");
|
|
5660
5698
|
return result;
|
|
5661
5699
|
}
|
|
5662
5700
|
/**
|
|
@@ -5671,7 +5709,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5671
5709
|
* @returns Promise resolving to list of favorites
|
|
5672
5710
|
*/
|
|
5673
5711
|
async getUserFavorites(userId, params = {}, options) {
|
|
5674
|
-
|
|
5712
|
+
log29("Getting favorites for user: %d", userId);
|
|
5675
5713
|
const queryParams = {};
|
|
5676
5714
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5677
5715
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5681,7 +5719,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5681
5719
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
5682
5720
|
options
|
|
5683
5721
|
);
|
|
5684
|
-
|
|
5722
|
+
log29("Favorites retrieved for user: %d", userId);
|
|
5685
5723
|
return result;
|
|
5686
5724
|
}
|
|
5687
5725
|
/**
|
|
@@ -5696,7 +5734,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5696
5734
|
* @returns Promise resolving to list of favorite agents
|
|
5697
5735
|
*/
|
|
5698
5736
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
5699
|
-
|
|
5737
|
+
log29("Getting favorite agents for user: %d", userId);
|
|
5700
5738
|
const queryParams = {};
|
|
5701
5739
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5702
5740
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5705,7 +5743,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5705
5743
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
5706
5744
|
options
|
|
5707
5745
|
);
|
|
5708
|
-
|
|
5746
|
+
log29("Favorite agents retrieved for user: %d", userId);
|
|
5709
5747
|
return result;
|
|
5710
5748
|
}
|
|
5711
5749
|
/**
|
|
@@ -5720,7 +5758,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5720
5758
|
* @returns Promise resolving to list of favorite plugins
|
|
5721
5759
|
*/
|
|
5722
5760
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
5723
|
-
|
|
5761
|
+
log29("Getting favorite plugins for user: %d", userId);
|
|
5724
5762
|
const queryParams = {};
|
|
5725
5763
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5726
5764
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5729,14 +5767,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5729
5767
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
5730
5768
|
options
|
|
5731
5769
|
);
|
|
5732
|
-
|
|
5770
|
+
log29("Favorite plugins retrieved for user: %d", userId);
|
|
5733
5771
|
return result;
|
|
5734
5772
|
}
|
|
5735
5773
|
};
|
|
5736
5774
|
|
|
5737
5775
|
// src/market/services/UserLikeService.ts
|
|
5738
|
-
import
|
|
5739
|
-
var
|
|
5776
|
+
import debug30 from "debug";
|
|
5777
|
+
var log30 = debug30("lobe-market-sdk:user-like");
|
|
5740
5778
|
var UserLikeService = class extends BaseSDK {
|
|
5741
5779
|
/**
|
|
5742
5780
|
* Like content
|
|
@@ -5751,7 +5789,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5751
5789
|
* @throws Error if already liked
|
|
5752
5790
|
*/
|
|
5753
5791
|
async like(targetType, targetId, options) {
|
|
5754
|
-
|
|
5792
|
+
log30("Liking: %s %d", targetType, targetId);
|
|
5755
5793
|
const body = { targetId, targetType };
|
|
5756
5794
|
const result = await this.request("/v1/user/likes", {
|
|
5757
5795
|
body: JSON.stringify(body),
|
|
@@ -5761,7 +5799,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5761
5799
|
method: "POST",
|
|
5762
5800
|
...options
|
|
5763
5801
|
});
|
|
5764
|
-
|
|
5802
|
+
log30("Successfully liked: %s %d", targetType, targetId);
|
|
5765
5803
|
return result;
|
|
5766
5804
|
}
|
|
5767
5805
|
/**
|
|
@@ -5777,7 +5815,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5777
5815
|
* @throws Error if like not found
|
|
5778
5816
|
*/
|
|
5779
5817
|
async unlike(targetType, targetId, options) {
|
|
5780
|
-
|
|
5818
|
+
log30("Unliking: %s %d", targetType, targetId);
|
|
5781
5819
|
const body = { targetId, targetType };
|
|
5782
5820
|
const result = await this.request("/v1/user/likes", {
|
|
5783
5821
|
body: JSON.stringify(body),
|
|
@@ -5787,7 +5825,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5787
5825
|
method: "DELETE",
|
|
5788
5826
|
...options
|
|
5789
5827
|
});
|
|
5790
|
-
|
|
5828
|
+
log30("Successfully unliked: %s %d", targetType, targetId);
|
|
5791
5829
|
return result;
|
|
5792
5830
|
}
|
|
5793
5831
|
/**
|
|
@@ -5802,7 +5840,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5802
5840
|
* @returns Promise resolving to toggle response with new like status
|
|
5803
5841
|
*/
|
|
5804
5842
|
async toggleLike(targetType, targetId, options) {
|
|
5805
|
-
|
|
5843
|
+
log30("Toggling like: %s %d", targetType, targetId);
|
|
5806
5844
|
const body = { targetId, targetType };
|
|
5807
5845
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
5808
5846
|
body: JSON.stringify(body),
|
|
@@ -5812,7 +5850,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5812
5850
|
method: "POST",
|
|
5813
5851
|
...options
|
|
5814
5852
|
});
|
|
5815
|
-
|
|
5853
|
+
log30("Like toggled, new status: %O", result);
|
|
5816
5854
|
return result;
|
|
5817
5855
|
}
|
|
5818
5856
|
/**
|
|
@@ -5827,7 +5865,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5827
5865
|
* @returns Promise resolving to like status
|
|
5828
5866
|
*/
|
|
5829
5867
|
async checkLike(targetType, targetId, options) {
|
|
5830
|
-
|
|
5868
|
+
log30("Checking like status: %s %d", targetType, targetId);
|
|
5831
5869
|
const queryString = this.buildQueryString({
|
|
5832
5870
|
targetId: String(targetId),
|
|
5833
5871
|
targetType
|
|
@@ -5836,7 +5874,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5836
5874
|
`/v1/user/likes/check${queryString}`,
|
|
5837
5875
|
options
|
|
5838
5876
|
);
|
|
5839
|
-
|
|
5877
|
+
log30("Like status retrieved: %O", result);
|
|
5840
5878
|
return result;
|
|
5841
5879
|
}
|
|
5842
5880
|
/**
|
|
@@ -5850,7 +5888,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5850
5888
|
* @returns Promise resolving to list of likes
|
|
5851
5889
|
*/
|
|
5852
5890
|
async getMyLikes(params = {}, options) {
|
|
5853
|
-
|
|
5891
|
+
log30("Getting my likes: %O", params);
|
|
5854
5892
|
const queryParams = {};
|
|
5855
5893
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5856
5894
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5860,7 +5898,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5860
5898
|
`/v1/user/likes/me${queryString}`,
|
|
5861
5899
|
options
|
|
5862
5900
|
);
|
|
5863
|
-
|
|
5901
|
+
log30("My likes retrieved");
|
|
5864
5902
|
return result;
|
|
5865
5903
|
}
|
|
5866
5904
|
/**
|
|
@@ -5875,7 +5913,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5875
5913
|
* @returns Promise resolving to list of likes
|
|
5876
5914
|
*/
|
|
5877
5915
|
async getUserLikes(userId, params = {}, options) {
|
|
5878
|
-
|
|
5916
|
+
log30("Getting likes for user: %d", userId);
|
|
5879
5917
|
const queryParams = {};
|
|
5880
5918
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5881
5919
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5885,7 +5923,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5885
5923
|
`/v1/user/likes/${userId}${queryString}`,
|
|
5886
5924
|
options
|
|
5887
5925
|
);
|
|
5888
|
-
|
|
5926
|
+
log30("Likes retrieved for user: %d", userId);
|
|
5889
5927
|
return result;
|
|
5890
5928
|
}
|
|
5891
5929
|
/**
|
|
@@ -5900,7 +5938,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5900
5938
|
* @returns Promise resolving to list of liked agents
|
|
5901
5939
|
*/
|
|
5902
5940
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
5903
|
-
|
|
5941
|
+
log30("Getting liked agents for user: %d", userId);
|
|
5904
5942
|
const queryParams = {};
|
|
5905
5943
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5906
5944
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5909,7 +5947,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5909
5947
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
5910
5948
|
options
|
|
5911
5949
|
);
|
|
5912
|
-
|
|
5950
|
+
log30("Liked agents retrieved for user: %d", userId);
|
|
5913
5951
|
return result;
|
|
5914
5952
|
}
|
|
5915
5953
|
/**
|
|
@@ -5924,7 +5962,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5924
5962
|
* @returns Promise resolving to list of liked plugins
|
|
5925
5963
|
*/
|
|
5926
5964
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
5927
|
-
|
|
5965
|
+
log30("Getting liked plugins for user: %d", userId);
|
|
5928
5966
|
const queryParams = {};
|
|
5929
5967
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5930
5968
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5933,14 +5971,14 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5933
5971
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
5934
5972
|
options
|
|
5935
5973
|
);
|
|
5936
|
-
|
|
5974
|
+
log30("Liked plugins retrieved for user: %d", userId);
|
|
5937
5975
|
return result;
|
|
5938
5976
|
}
|
|
5939
5977
|
};
|
|
5940
5978
|
|
|
5941
5979
|
// src/market/services/UserPublishService.ts
|
|
5942
|
-
import
|
|
5943
|
-
var
|
|
5980
|
+
import debug31 from "debug";
|
|
5981
|
+
var log31 = debug31("lobe-market-sdk:user-publish");
|
|
5944
5982
|
var UserPublishService = class extends BaseSDK {
|
|
5945
5983
|
/**
|
|
5946
5984
|
* Lists all plugins owned by the authenticated user
|
|
@@ -5950,9 +5988,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5950
5988
|
*/
|
|
5951
5989
|
async listPlugins(options) {
|
|
5952
5990
|
var _a;
|
|
5953
|
-
|
|
5991
|
+
log31("Listing user plugins");
|
|
5954
5992
|
const result = await this.request("/v1/user/plugins", options);
|
|
5955
|
-
|
|
5993
|
+
log31("Found %d user plugins", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
5956
5994
|
return result;
|
|
5957
5995
|
}
|
|
5958
5996
|
/**
|
|
@@ -5963,9 +6001,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5963
6001
|
*/
|
|
5964
6002
|
async listSkills(options) {
|
|
5965
6003
|
var _a;
|
|
5966
|
-
|
|
6004
|
+
log31("Listing user skills");
|
|
5967
6005
|
const result = await this.request("/v1/user/skills", options);
|
|
5968
|
-
|
|
6006
|
+
log31("Found %d user skills", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
5969
6007
|
return result;
|
|
5970
6008
|
}
|
|
5971
6009
|
/**
|
|
@@ -5977,7 +6015,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5977
6015
|
* @returns Promise resolving to the publish result
|
|
5978
6016
|
*/
|
|
5979
6017
|
async publishSkillVersion(identifier, zipBuffer, options) {
|
|
5980
|
-
|
|
6018
|
+
log31("Publishing skill version for: %s", identifier);
|
|
5981
6019
|
const formData = new FormData();
|
|
5982
6020
|
const arrayBuffer = zipBuffer instanceof ArrayBuffer ? zipBuffer : zipBuffer.buffer.slice(
|
|
5983
6021
|
zipBuffer.byteOffset,
|
|
@@ -5993,7 +6031,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5993
6031
|
...options
|
|
5994
6032
|
}
|
|
5995
6033
|
);
|
|
5996
|
-
|
|
6034
|
+
log31("Published skill version: %s@%s", identifier, result.version);
|
|
5997
6035
|
return result;
|
|
5998
6036
|
}
|
|
5999
6037
|
/**
|
|
@@ -6004,11 +6042,11 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6004
6042
|
*/
|
|
6005
6043
|
async scanClaimableAssets(assetType) {
|
|
6006
6044
|
var _a;
|
|
6007
|
-
|
|
6045
|
+
log31("Scanning claimable %s", assetType);
|
|
6008
6046
|
const result = await this.request(
|
|
6009
6047
|
`/v1/user/claims/scan/${assetType}`
|
|
6010
6048
|
);
|
|
6011
|
-
|
|
6049
|
+
log31("Found %d claimable %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, assetType);
|
|
6012
6050
|
return result;
|
|
6013
6051
|
}
|
|
6014
6052
|
/**
|
|
@@ -6019,13 +6057,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6019
6057
|
* @returns Promise resolving to the claim result
|
|
6020
6058
|
*/
|
|
6021
6059
|
async claimAsset(assetId, assetType) {
|
|
6022
|
-
|
|
6060
|
+
log31("Claiming %s with id: %d", assetType, assetId);
|
|
6023
6061
|
const result = await this.request("/v1/user/claims", {
|
|
6024
6062
|
body: JSON.stringify({ assetId, assetType }),
|
|
6025
6063
|
headers: { "Content-Type": "application/json" },
|
|
6026
6064
|
method: "POST"
|
|
6027
6065
|
});
|
|
6028
|
-
|
|
6066
|
+
log31("Claim result for %s %d: %s", assetType, assetId, result.success);
|
|
6029
6067
|
return result;
|
|
6030
6068
|
}
|
|
6031
6069
|
/**
|
|
@@ -6040,14 +6078,14 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6040
6078
|
* @returns Promise resolving to the submission result
|
|
6041
6079
|
*/
|
|
6042
6080
|
async submitRepo(params, options) {
|
|
6043
|
-
|
|
6081
|
+
log31("Submitting repository for import: %s (%s)", params.gitUrl, params.type);
|
|
6044
6082
|
const result = await this.request("/v1/user/claims/submit-repo", {
|
|
6045
6083
|
body: JSON.stringify(params),
|
|
6046
6084
|
headers: { "Content-Type": "application/json" },
|
|
6047
6085
|
method: "POST",
|
|
6048
6086
|
...options
|
|
6049
6087
|
});
|
|
6050
|
-
|
|
6088
|
+
log31("Submit result for %s: %s", params.gitUrl, result.success);
|
|
6051
6089
|
return result;
|
|
6052
6090
|
}
|
|
6053
6091
|
/**
|
|
@@ -6058,12 +6096,12 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6058
6096
|
* @returns Promise resolving to the delete result
|
|
6059
6097
|
*/
|
|
6060
6098
|
async deleteSkill(identifier, options) {
|
|
6061
|
-
|
|
6099
|
+
log31("Deleting skill: %s", identifier);
|
|
6062
6100
|
const result = await this.request(
|
|
6063
6101
|
`/v1/user/skills/${encodeURIComponent(identifier)}`,
|
|
6064
6102
|
{ method: "DELETE", ...options }
|
|
6065
6103
|
);
|
|
6066
|
-
|
|
6104
|
+
log31("Deleted skill: %s", identifier);
|
|
6067
6105
|
return result;
|
|
6068
6106
|
}
|
|
6069
6107
|
/**
|
|
@@ -6075,7 +6113,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6075
6113
|
* @returns Promise resolving to the updated status
|
|
6076
6114
|
*/
|
|
6077
6115
|
async updateSkillStatus(identifier, status, options) {
|
|
6078
|
-
|
|
6116
|
+
log31("Updating skill status: %s \u2192 %s", identifier, status);
|
|
6079
6117
|
const result = await this.request(
|
|
6080
6118
|
`/v1/user/skills/${encodeURIComponent(identifier)}/status`,
|
|
6081
6119
|
{
|
|
@@ -6085,7 +6123,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6085
6123
|
...options
|
|
6086
6124
|
}
|
|
6087
6125
|
);
|
|
6088
|
-
|
|
6126
|
+
log31("Updated skill status: %s \u2192 %s", identifier, result.status);
|
|
6089
6127
|
return result;
|
|
6090
6128
|
}
|
|
6091
6129
|
/**
|
|
@@ -6096,12 +6134,12 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6096
6134
|
* @returns Promise resolving to the delete result
|
|
6097
6135
|
*/
|
|
6098
6136
|
async deletePlugin(identifier, options) {
|
|
6099
|
-
|
|
6137
|
+
log31("Deleting plugin: %s", identifier);
|
|
6100
6138
|
const result = await this.request(
|
|
6101
6139
|
`/v1/user/plugins/${encodeURIComponent(identifier)}`,
|
|
6102
6140
|
{ method: "DELETE", ...options }
|
|
6103
6141
|
);
|
|
6104
|
-
|
|
6142
|
+
log31("Deleted plugin: %s", identifier);
|
|
6105
6143
|
return result;
|
|
6106
6144
|
}
|
|
6107
6145
|
/**
|
|
@@ -6113,7 +6151,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6113
6151
|
* @returns Promise resolving to the updated status
|
|
6114
6152
|
*/
|
|
6115
6153
|
async updatePluginStatus(identifier, status, options) {
|
|
6116
|
-
|
|
6154
|
+
log31("Updating plugin status: %s \u2192 %s", identifier, status);
|
|
6117
6155
|
const result = await this.request(
|
|
6118
6156
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/status`,
|
|
6119
6157
|
{
|
|
@@ -6123,7 +6161,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6123
6161
|
...options
|
|
6124
6162
|
}
|
|
6125
6163
|
);
|
|
6126
|
-
|
|
6164
|
+
log31("Updated plugin status: %s \u2192 %s", identifier, result.status);
|
|
6127
6165
|
return result;
|
|
6128
6166
|
}
|
|
6129
6167
|
/**
|
|
@@ -6135,7 +6173,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6135
6173
|
* @returns Promise resolving to the publish result
|
|
6136
6174
|
*/
|
|
6137
6175
|
async publishPluginVersion(identifier, data, options) {
|
|
6138
|
-
|
|
6176
|
+
log31("Publishing plugin version for: %s", identifier);
|
|
6139
6177
|
const result = await this.request(
|
|
6140
6178
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/versions`,
|
|
6141
6179
|
{
|
|
@@ -6145,79 +6183,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6145
6183
|
...options
|
|
6146
6184
|
}
|
|
6147
6185
|
);
|
|
6148
|
-
|
|
6149
|
-
return result;
|
|
6150
|
-
}
|
|
6151
|
-
/**
|
|
6152
|
-
* Lists the localizations of an owned plugin version
|
|
6153
|
-
*
|
|
6154
|
-
* @param identifier - The plugin identifier
|
|
6155
|
-
* @param version - Optional version (defaults to the latest version)
|
|
6156
|
-
* @param options - Optional request options (must include authentication)
|
|
6157
|
-
* @returns Promise resolving to the plugin's localizations
|
|
6158
|
-
*/
|
|
6159
|
-
async getPluginLocalizations(identifier, version, options) {
|
|
6160
|
-
var _a;
|
|
6161
|
-
log30("Listing localizations for plugin: %s", identifier);
|
|
6162
|
-
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6163
|
-
const result = await this.request(
|
|
6164
|
-
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations${query}`,
|
|
6165
|
-
options
|
|
6166
|
-
);
|
|
6167
|
-
log30("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
|
|
6168
|
-
return result;
|
|
6169
|
-
}
|
|
6170
|
-
/**
|
|
6171
|
-
* Creates or updates owner-provided localizations for a plugin version.
|
|
6172
|
-
*
|
|
6173
|
-
* Merge semantics per locale: only supplied fields overwrite. Creating a brand
|
|
6174
|
-
* new locale requires both name and description. Editing en-US also updates
|
|
6175
|
-
* the version row (source of truth).
|
|
6176
|
-
*
|
|
6177
|
-
* @param identifier - The plugin identifier
|
|
6178
|
-
* @param localizations - Per-locale content to upsert
|
|
6179
|
-
* @param version - Optional version (defaults to the latest version)
|
|
6180
|
-
* @param options - Optional request options (must include authentication)
|
|
6181
|
-
* @returns Promise resolving to the upsert result
|
|
6182
|
-
*/
|
|
6183
|
-
async updatePluginLocalizations(identifier, localizations, version, options) {
|
|
6184
|
-
log30("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
|
|
6185
|
-
const result = await this.request(
|
|
6186
|
-
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations`,
|
|
6187
|
-
{
|
|
6188
|
-
body: JSON.stringify({ localizations, version }),
|
|
6189
|
-
headers: { "Content-Type": "application/json" },
|
|
6190
|
-
method: "PUT",
|
|
6191
|
-
...options
|
|
6192
|
-
}
|
|
6193
|
-
);
|
|
6194
|
-
log30("Upserted localizations for %s@%s", identifier, result.version);
|
|
6195
|
-
return result;
|
|
6196
|
-
}
|
|
6197
|
-
/**
|
|
6198
|
-
* Deletes a single localization of a plugin version. The source locale (en-US)
|
|
6199
|
-
* cannot be deleted.
|
|
6200
|
-
*
|
|
6201
|
-
* @param identifier - The plugin identifier
|
|
6202
|
-
* @param locale - The locale to remove
|
|
6203
|
-
* @param version - Optional version (defaults to the latest version)
|
|
6204
|
-
* @param options - Optional request options (must include authentication)
|
|
6205
|
-
* @returns Promise resolving to the delete result
|
|
6206
|
-
*/
|
|
6207
|
-
async deletePluginLocalization(identifier, locale, version, options) {
|
|
6208
|
-
log30("Deleting localization %s for plugin: %s", locale, identifier);
|
|
6209
|
-
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6210
|
-
const result = await this.request(
|
|
6211
|
-
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations/${encodeURIComponent(locale)}${query}`,
|
|
6212
|
-
{ method: "DELETE", ...options }
|
|
6213
|
-
);
|
|
6214
|
-
log30("Deleted localization %s for %s", locale, identifier);
|
|
6186
|
+
log31("Published plugin version: %s@%s", identifier, result.version);
|
|
6215
6187
|
return result;
|
|
6216
6188
|
}
|
|
6217
6189
|
};
|
|
6218
6190
|
|
|
6219
6191
|
// src/market/market-sdk.ts
|
|
6220
|
-
var
|
|
6192
|
+
var log32 = debug32("lobe-market-sdk");
|
|
6221
6193
|
var MarketSDK = class extends BaseSDK {
|
|
6222
6194
|
/**
|
|
6223
6195
|
* Creates a new MarketSDK instance
|
|
@@ -6230,7 +6202,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6230
6202
|
tokenExpiry: void 0
|
|
6231
6203
|
};
|
|
6232
6204
|
super(options, void 0, sharedTokenState);
|
|
6233
|
-
|
|
6205
|
+
log32("MarketSDK instance created");
|
|
6234
6206
|
this.agentProfile = new AgentProfileService(options, this.headers, sharedTokenState);
|
|
6235
6207
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
6236
6208
|
this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
|
|
@@ -6252,6 +6224,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6252
6224
|
sharedTokenState
|
|
6253
6225
|
);
|
|
6254
6226
|
this.marketSkills = new MarketSkillService(options, this.headers, sharedTokenState);
|
|
6227
|
+
this.taskTemplates = new MarketTaskTemplateService(options, this.headers, sharedTokenState);
|
|
6255
6228
|
this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);
|
|
6256
6229
|
}
|
|
6257
6230
|
/**
|
|
@@ -6278,7 +6251,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
6278
6251
|
* @deprecated Use auth.registerClient() instead
|
|
6279
6252
|
*/
|
|
6280
6253
|
async registerClient(request) {
|
|
6281
|
-
|
|
6254
|
+
log32("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
6282
6255
|
return this.auth.registerClient(request);
|
|
6283
6256
|
}
|
|
6284
6257
|
};
|