@lobehub/market-sdk 0.33.5 → 0.34.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 +387 -2
- package/dist/index.mjs +423 -72
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -112,16 +112,41 @@ var BaseSDK = class {
|
|
|
112
112
|
this.headers["x-lobe-trust-token"] = options.trustedClientToken;
|
|
113
113
|
log("Trusted client token configured");
|
|
114
114
|
}
|
|
115
|
+
if (options.ownerAccountId !== void 0) {
|
|
116
|
+
this.headers["x-lobe-owner-account-id"] = String(options.ownerAccountId);
|
|
117
|
+
log("Owner account id configured: %d", options.ownerAccountId);
|
|
118
|
+
}
|
|
115
119
|
log("BaseSDK instance created: %O", {
|
|
116
120
|
baseUrl: this.baseUrl,
|
|
117
121
|
defaultLocale: this.defaultLocale,
|
|
118
122
|
hasApiKey: !!apiKey,
|
|
119
123
|
hasInitialAccessToken: !!this.initialAccessToken,
|
|
120
124
|
hasM2MCredentials: !!this.clientId,
|
|
125
|
+
hasOwnerAccountId: options.ownerAccountId !== void 0,
|
|
121
126
|
hasSharedTokenState: !!this.sharedTokenState,
|
|
122
127
|
hasTrustedClientToken: !!options.trustedClientToken
|
|
123
128
|
});
|
|
124
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Sets the owner account id header for subsequent requests.
|
|
132
|
+
*
|
|
133
|
+
* Mirrors the constructor `ownerAccountId` option. Useful when the
|
|
134
|
+
* organization context is not known at SDK construction time.
|
|
135
|
+
*
|
|
136
|
+
* @param ownerAccountId - The organization account id to act on behalf of
|
|
137
|
+
*/
|
|
138
|
+
setOwnerAccountId(ownerAccountId) {
|
|
139
|
+
log("Setting owner account id: %d", ownerAccountId);
|
|
140
|
+
this.headers["x-lobe-owner-account-id"] = String(ownerAccountId);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Clears the owner account id header. Subsequent requests will be
|
|
144
|
+
* attributed to the actor's personal account.
|
|
145
|
+
*/
|
|
146
|
+
clearOwnerAccountId() {
|
|
147
|
+
log("Clearing owner account id");
|
|
148
|
+
delete this.headers["x-lobe-owner-account-id"];
|
|
149
|
+
}
|
|
125
150
|
/**
|
|
126
151
|
* Sends an HTTP request to the API and handles the response
|
|
127
152
|
*
|
|
@@ -1733,7 +1758,7 @@ var MarketAdmin = class extends BaseSDK {
|
|
|
1733
1758
|
};
|
|
1734
1759
|
|
|
1735
1760
|
// src/market/market-sdk.ts
|
|
1736
|
-
import
|
|
1761
|
+
import debug30 from "debug";
|
|
1737
1762
|
|
|
1738
1763
|
// src/market/services/AgentProfileService.ts
|
|
1739
1764
|
import debug11 from "debug";
|
|
@@ -4830,9 +4855,334 @@ var MarketSkillService = class extends BaseSDK {
|
|
|
4830
4855
|
}
|
|
4831
4856
|
};
|
|
4832
4857
|
|
|
4833
|
-
// src/market/services/
|
|
4858
|
+
// src/market/services/OrganizationCredsService.ts
|
|
4834
4859
|
import debug23 from "debug";
|
|
4835
|
-
var log23 = debug23("lobe-market-sdk:
|
|
4860
|
+
var log23 = debug23("lobe-market-sdk:org-creds");
|
|
4861
|
+
var OrganizationCredsService = class extends BaseSDK {
|
|
4862
|
+
constructor(orgId, options = {}, sharedHeaders, sharedTokenState) {
|
|
4863
|
+
super(options, sharedHeaders, sharedTokenState);
|
|
4864
|
+
if (!Number.isInteger(orgId) || orgId <= 0) {
|
|
4865
|
+
throw new Error(`OrganizationCredsService requires a positive integer orgId, got: ${orgId}`);
|
|
4866
|
+
}
|
|
4867
|
+
this.orgId = orgId;
|
|
4868
|
+
}
|
|
4869
|
+
base() {
|
|
4870
|
+
return `/v1/organizations/${this.orgId}/creds`;
|
|
4871
|
+
}
|
|
4872
|
+
// ===========================================================================
|
|
4873
|
+
// Read
|
|
4874
|
+
// ===========================================================================
|
|
4875
|
+
async list(options) {
|
|
4876
|
+
var _a;
|
|
4877
|
+
log23("Listing org %d credentials", this.orgId);
|
|
4878
|
+
const result = await this.request(this.base(), options);
|
|
4879
|
+
log23("Found %d credentials for org %d", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgId);
|
|
4880
|
+
return result;
|
|
4881
|
+
}
|
|
4882
|
+
async get(id, getOptions, options) {
|
|
4883
|
+
log23("Getting org %d credential %d (decrypt=%s)", this.orgId, id, getOptions == null ? void 0 : getOptions.decrypt);
|
|
4884
|
+
const queryString = this.buildQueryString((getOptions == null ? void 0 : getOptions.decrypt) ? { decrypt: "true" } : {});
|
|
4885
|
+
const result = await this.request(
|
|
4886
|
+
`${this.base()}/${id}${queryString}`,
|
|
4887
|
+
options
|
|
4888
|
+
);
|
|
4889
|
+
log23("Retrieved org credential: %s", result.key);
|
|
4890
|
+
return result;
|
|
4891
|
+
}
|
|
4892
|
+
// ===========================================================================
|
|
4893
|
+
// Create
|
|
4894
|
+
// ===========================================================================
|
|
4895
|
+
async createKV(data, options) {
|
|
4896
|
+
log23("Creating org %d KV credential: %s (type=%s)", this.orgId, data.key, data.type);
|
|
4897
|
+
return this.request(`${this.base()}/kv`, {
|
|
4898
|
+
body: JSON.stringify(data),
|
|
4899
|
+
headers: { "Content-Type": "application/json" },
|
|
4900
|
+
method: "POST",
|
|
4901
|
+
...options
|
|
4902
|
+
});
|
|
4903
|
+
}
|
|
4904
|
+
async createOAuth(data, options) {
|
|
4905
|
+
log23("Creating org %d OAuth credential: %s", this.orgId, data.key);
|
|
4906
|
+
return this.request(`${this.base()}/oauth`, {
|
|
4907
|
+
body: JSON.stringify(data),
|
|
4908
|
+
headers: { "Content-Type": "application/json" },
|
|
4909
|
+
method: "POST",
|
|
4910
|
+
...options
|
|
4911
|
+
});
|
|
4912
|
+
}
|
|
4913
|
+
async createFile(data, options) {
|
|
4914
|
+
log23("Creating org %d file credential: %s", this.orgId, data.key);
|
|
4915
|
+
return this.request(`${this.base()}/file`, {
|
|
4916
|
+
body: JSON.stringify(data),
|
|
4917
|
+
headers: { "Content-Type": "application/json" },
|
|
4918
|
+
method: "POST",
|
|
4919
|
+
...options
|
|
4920
|
+
});
|
|
4921
|
+
}
|
|
4922
|
+
// ===========================================================================
|
|
4923
|
+
// Update
|
|
4924
|
+
// ===========================================================================
|
|
4925
|
+
async update(id, data, options) {
|
|
4926
|
+
log23("Updating org %d credential %d", this.orgId, id);
|
|
4927
|
+
return this.request(`${this.base()}/${id}`, {
|
|
4928
|
+
body: JSON.stringify(data),
|
|
4929
|
+
headers: { "Content-Type": "application/json" },
|
|
4930
|
+
method: "PATCH",
|
|
4931
|
+
...options
|
|
4932
|
+
});
|
|
4933
|
+
}
|
|
4934
|
+
// ===========================================================================
|
|
4935
|
+
// Delete
|
|
4936
|
+
// ===========================================================================
|
|
4937
|
+
async delete(id, options) {
|
|
4938
|
+
log23("Deleting org %d credential %d", this.orgId, id);
|
|
4939
|
+
return this.request(`${this.base()}/${id}`, {
|
|
4940
|
+
method: "DELETE",
|
|
4941
|
+
...options
|
|
4942
|
+
});
|
|
4943
|
+
}
|
|
4944
|
+
async deleteByKey(key, options) {
|
|
4945
|
+
log23("Deleting org %d credential by key: %s", this.orgId, key);
|
|
4946
|
+
return this.request(`${this.base()}/key/${encodeURIComponent(key)}`, {
|
|
4947
|
+
method: "DELETE",
|
|
4948
|
+
...options
|
|
4949
|
+
});
|
|
4950
|
+
}
|
|
4951
|
+
// ===========================================================================
|
|
4952
|
+
// Skill cred status
|
|
4953
|
+
// ===========================================================================
|
|
4954
|
+
/**
|
|
4955
|
+
* Returns this org's credential status for a skill — which required creds
|
|
4956
|
+
* the org has bound vs. is missing. Reads only; any org member may call.
|
|
4957
|
+
*/
|
|
4958
|
+
async getSkillCredStatus(skillIdentifier, options) {
|
|
4959
|
+
log23("Getting org %d skill cred status: %s", this.orgId, skillIdentifier);
|
|
4960
|
+
const path = `/v1/organizations/${this.orgId}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
|
|
4961
|
+
const result = await this.request(
|
|
4962
|
+
path,
|
|
4963
|
+
options
|
|
4964
|
+
);
|
|
4965
|
+
return Array.isArray(result) ? result : result.data;
|
|
4966
|
+
}
|
|
4967
|
+
};
|
|
4968
|
+
|
|
4969
|
+
// src/market/services/OrganizationService.ts
|
|
4970
|
+
import debug24 from "debug";
|
|
4971
|
+
var log24 = debug24("lobe-market-sdk:organization");
|
|
4972
|
+
var OrganizationService = class extends BaseSDK {
|
|
4973
|
+
constructor(options = {}, sharedHeaders, sharedTokenState) {
|
|
4974
|
+
super(options, sharedHeaders, sharedTokenState);
|
|
4975
|
+
this.initOptions = options;
|
|
4976
|
+
this.tokenState = sharedTokenState;
|
|
4977
|
+
}
|
|
4978
|
+
/**
|
|
4979
|
+
* Returns an org-scoped credentials sub-service bound to `orgId`.
|
|
4980
|
+
*
|
|
4981
|
+
* The returned service hits `/v1/organizations/:orgId/creds/*` and shares
|
|
4982
|
+
* this `OrganizationService`'s headers + token state, so it inherits the
|
|
4983
|
+
* same auth context as the rest of the SDK (no need to re-attach an access
|
|
4984
|
+
* token).
|
|
4985
|
+
*
|
|
4986
|
+
* Returns a fresh instance per call; suitable for short-lived UIs where the
|
|
4987
|
+
* orgId varies. For long-lived use, cache the returned service.
|
|
4988
|
+
*
|
|
4989
|
+
* @example
|
|
4990
|
+
* ```typescript
|
|
4991
|
+
* const orgCreds = market.organizations.creds(42);
|
|
4992
|
+
* await orgCreds.list();
|
|
4993
|
+
* ```
|
|
4994
|
+
*/
|
|
4995
|
+
creds(orgId) {
|
|
4996
|
+
return new OrganizationCredsService(orgId, this.initOptions, this.headers, this.tokenState);
|
|
4997
|
+
}
|
|
4998
|
+
/**
|
|
4999
|
+
* Retrieves an organization's public profile and everything it has
|
|
5000
|
+
* published — agents, agent groups, skills, plugins.
|
|
5001
|
+
*
|
|
5002
|
+
* Public endpoint; authentication is optional. If the caller is an
|
|
5003
|
+
* authenticated admin of the organization, the response additionally
|
|
5004
|
+
* includes unpublished/private content (useful for the workspace owner's
|
|
5005
|
+
* own Community page).
|
|
5006
|
+
*
|
|
5007
|
+
* @param idOrNamespace - The account ID (number) or organization namespace string (e.g. `ws-acme`)
|
|
5008
|
+
* @param params - Query parameters for locale
|
|
5009
|
+
* @param options - Optional request options
|
|
5010
|
+
* @returns Promise resolving to the organization info response
|
|
5011
|
+
*/
|
|
5012
|
+
async getOrganizationInfo(idOrNamespace, params = {}, options) {
|
|
5013
|
+
const locale = params.locale || this.defaultLocale;
|
|
5014
|
+
const queryString = this.buildQueryString({ locale });
|
|
5015
|
+
log24("Getting organization info: %O", { idOrNamespace, ...params });
|
|
5016
|
+
const result = await this.request(
|
|
5017
|
+
`/v1/organizations/info/${idOrNamespace}${queryString}`,
|
|
5018
|
+
options
|
|
5019
|
+
);
|
|
5020
|
+
log24("Organization info retrieved for: %s", idOrNamespace);
|
|
5021
|
+
return result;
|
|
5022
|
+
}
|
|
5023
|
+
/**
|
|
5024
|
+
* Lists the organizations the authenticated user belongs to, each annotated
|
|
5025
|
+
* with the caller's membership role. Excludes archived organizations.
|
|
5026
|
+
*
|
|
5027
|
+
* @returns Promise resolving to the user's organizations
|
|
5028
|
+
*/
|
|
5029
|
+
async listMyOrganizations(options) {
|
|
5030
|
+
log24("Listing organizations for current user");
|
|
5031
|
+
const result = await this.request(
|
|
5032
|
+
"/v1/organizations/me",
|
|
5033
|
+
options
|
|
5034
|
+
);
|
|
5035
|
+
return result.data;
|
|
5036
|
+
}
|
|
5037
|
+
/**
|
|
5038
|
+
* Idempotently creates an organization (mirrors a cloud workspace).
|
|
5039
|
+
*
|
|
5040
|
+
* Trusted-client only — construct the SDK with `{ trustedClientToken }`. Uses
|
|
5041
|
+
* `clerkId` as the idempotency key; a second call with the same `clerkId`
|
|
5042
|
+
* returns the existing org with `created: false` (and revives it if archived).
|
|
5043
|
+
*
|
|
5044
|
+
* @param data - Organization fields + optional initial members
|
|
5045
|
+
* @returns The created/existing organization and whether it was newly created
|
|
5046
|
+
*/
|
|
5047
|
+
async createOrganization(data, options) {
|
|
5048
|
+
log24("Creating organization: %s", data.clerkId);
|
|
5049
|
+
return this.request("/v1/organizations", {
|
|
5050
|
+
...options,
|
|
5051
|
+
body: JSON.stringify(data),
|
|
5052
|
+
method: "POST"
|
|
5053
|
+
});
|
|
5054
|
+
}
|
|
5055
|
+
/**
|
|
5056
|
+
* Updates an organization's metadata. Requires org admin (or trusted client).
|
|
5057
|
+
*
|
|
5058
|
+
* @param orgId - Organization account id
|
|
5059
|
+
* @param data - Fields to update
|
|
5060
|
+
* @returns The updated organization
|
|
5061
|
+
*/
|
|
5062
|
+
async updateOrganization(orgId, data, options) {
|
|
5063
|
+
log24("Updating organization %d: %O", orgId, data);
|
|
5064
|
+
const result = await this.request(`/v1/organizations/${orgId}`, {
|
|
5065
|
+
...options,
|
|
5066
|
+
body: JSON.stringify(data),
|
|
5067
|
+
method: "PATCH"
|
|
5068
|
+
});
|
|
5069
|
+
return result.data;
|
|
5070
|
+
}
|
|
5071
|
+
/**
|
|
5072
|
+
* Soft-disables an organization (e.g. its cloud workspace was deleted).
|
|
5073
|
+
* Trusted-client only. Reversible; creds and published content are preserved.
|
|
5074
|
+
*
|
|
5075
|
+
* @param orgId - Organization account id
|
|
5076
|
+
* @returns The archived organization
|
|
5077
|
+
*/
|
|
5078
|
+
async archiveOrganization(orgId, options) {
|
|
5079
|
+
log24("Archiving organization %d", orgId);
|
|
5080
|
+
const result = await this.request(
|
|
5081
|
+
`/v1/organizations/${orgId}/archive`,
|
|
5082
|
+
{ ...options, method: "POST" }
|
|
5083
|
+
);
|
|
5084
|
+
return result.data;
|
|
5085
|
+
}
|
|
5086
|
+
/**
|
|
5087
|
+
* Reactivates a previously archived organization. Trusted-client only.
|
|
5088
|
+
*
|
|
5089
|
+
* @param orgId - Organization account id
|
|
5090
|
+
* @returns The reactivated organization
|
|
5091
|
+
*/
|
|
5092
|
+
async unarchiveOrganization(orgId, options) {
|
|
5093
|
+
log24("Unarchiving organization %d", orgId);
|
|
5094
|
+
const result = await this.request(
|
|
5095
|
+
`/v1/organizations/${orgId}/unarchive`,
|
|
5096
|
+
{ ...options, method: "POST" }
|
|
5097
|
+
);
|
|
5098
|
+
return result.data;
|
|
5099
|
+
}
|
|
5100
|
+
/**
|
|
5101
|
+
* Lists the members of an organization. Any authenticated org member may call.
|
|
5102
|
+
*
|
|
5103
|
+
* @param orgId - Organization account id
|
|
5104
|
+
* @returns Hydrated member rows
|
|
5105
|
+
*/
|
|
5106
|
+
async listMembers(orgId, options) {
|
|
5107
|
+
log24("Listing members of organization %d", orgId);
|
|
5108
|
+
const result = await this.request(
|
|
5109
|
+
`/v1/organizations/${orgId}/members`,
|
|
5110
|
+
options
|
|
5111
|
+
);
|
|
5112
|
+
return result.data;
|
|
5113
|
+
}
|
|
5114
|
+
/**
|
|
5115
|
+
* Adds a member to an organization. Trusted-client only. Idempotent: if the
|
|
5116
|
+
* user is already a member, the existing role is preserved (`added: false`).
|
|
5117
|
+
*
|
|
5118
|
+
* @param orgId - Organization account id
|
|
5119
|
+
* @param userAccountId - The user's account id
|
|
5120
|
+
* @param role - Role to grant (defaults server-side to `member`)
|
|
5121
|
+
* @returns Whether the member was newly added and their effective role
|
|
5122
|
+
*/
|
|
5123
|
+
async addMember(orgId, userAccountId, role, options) {
|
|
5124
|
+
log24("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
|
|
5125
|
+
return this.request(`/v1/organizations/${orgId}/members`, {
|
|
5126
|
+
...options,
|
|
5127
|
+
body: JSON.stringify({ role, userAccountId }),
|
|
5128
|
+
method: "POST"
|
|
5129
|
+
});
|
|
5130
|
+
}
|
|
5131
|
+
/**
|
|
5132
|
+
* Removes a member from an organization. Trusted-client only. Refuses to
|
|
5133
|
+
* remove the last admin (server returns 409).
|
|
5134
|
+
*
|
|
5135
|
+
* @param orgId - Organization account id
|
|
5136
|
+
* @param userAccountId - The user's account id
|
|
5137
|
+
* @returns Whether a membership row was removed
|
|
5138
|
+
*/
|
|
5139
|
+
async removeMember(orgId, userAccountId, options) {
|
|
5140
|
+
log24("Removing member %d from organization %d", userAccountId, orgId);
|
|
5141
|
+
return this.request(
|
|
5142
|
+
`/v1/organizations/${orgId}/members/${userAccountId}`,
|
|
5143
|
+
{ ...options, method: "DELETE" }
|
|
5144
|
+
);
|
|
5145
|
+
}
|
|
5146
|
+
/**
|
|
5147
|
+
* Updates a member's role. Trusted-client only. Refuses to demote the last
|
|
5148
|
+
* admin (server returns 409).
|
|
5149
|
+
*
|
|
5150
|
+
* @param orgId - Organization account id
|
|
5151
|
+
* @param userAccountId - The user's account id
|
|
5152
|
+
* @param role - The new role
|
|
5153
|
+
* @returns The effective role and whether it changed
|
|
5154
|
+
*/
|
|
5155
|
+
async updateMemberRole(orgId, userAccountId, role, options) {
|
|
5156
|
+
log24("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
|
|
5157
|
+
return this.request(
|
|
5158
|
+
`/v1/organizations/${orgId}/members/${userAccountId}`,
|
|
5159
|
+
{ ...options, body: JSON.stringify({ role }), method: "PATCH" }
|
|
5160
|
+
);
|
|
5161
|
+
}
|
|
5162
|
+
/**
|
|
5163
|
+
* Reconciles the full member list against a desired snapshot (idempotent).
|
|
5164
|
+
* Trusted-client only — the canonical way for Cloud to mirror a workspace's
|
|
5165
|
+
* complete membership: absent members are removed, missing ones added, and
|
|
5166
|
+
* changed roles updated, all in one transaction. Rejects a snapshot with no
|
|
5167
|
+
* admin (server returns 409).
|
|
5168
|
+
*
|
|
5169
|
+
* @param orgId - Organization account id
|
|
5170
|
+
* @param members - The complete desired member list
|
|
5171
|
+
* @returns Counts of added / removed / updated members and skipped ids
|
|
5172
|
+
*/
|
|
5173
|
+
async reconcileMembers(orgId, members, options) {
|
|
5174
|
+
log24("Reconciling %d members for organization %d", members.length, orgId);
|
|
5175
|
+
return this.request(`/v1/organizations/${orgId}/members`, {
|
|
5176
|
+
...options,
|
|
5177
|
+
body: JSON.stringify({ members }),
|
|
5178
|
+
method: "PUT"
|
|
5179
|
+
});
|
|
5180
|
+
}
|
|
5181
|
+
};
|
|
5182
|
+
|
|
5183
|
+
// src/market/services/UserService.ts
|
|
5184
|
+
import debug25 from "debug";
|
|
5185
|
+
var log25 = debug25("lobe-market-sdk:user");
|
|
4836
5186
|
var UserService = class extends BaseSDK {
|
|
4837
5187
|
/**
|
|
4838
5188
|
* Retrieves user information by account ID or userName
|
|
@@ -4849,12 +5199,12 @@ var UserService = class extends BaseSDK {
|
|
|
4849
5199
|
const locale = params.locale || this.defaultLocale;
|
|
4850
5200
|
const queryParams = { locale };
|
|
4851
5201
|
const queryString = this.buildQueryString(queryParams);
|
|
4852
|
-
|
|
5202
|
+
log25("Getting user info: %O", { idOrUserName, ...params });
|
|
4853
5203
|
const result = await this.request(
|
|
4854
5204
|
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
4855
5205
|
options
|
|
4856
5206
|
);
|
|
4857
|
-
|
|
5207
|
+
log25("User info successfully retrieved for: %s", idOrUserName);
|
|
4858
5208
|
return result;
|
|
4859
5209
|
}
|
|
4860
5210
|
/**
|
|
@@ -4869,7 +5219,7 @@ var UserService = class extends BaseSDK {
|
|
|
4869
5219
|
* @throws Error if userName is already taken or update fails
|
|
4870
5220
|
*/
|
|
4871
5221
|
async updateUserInfo(data, options) {
|
|
4872
|
-
|
|
5222
|
+
log25("Updating user info: %O", data);
|
|
4873
5223
|
const result = await this.request("/v1/user/update", {
|
|
4874
5224
|
body: JSON.stringify(data),
|
|
4875
5225
|
headers: {
|
|
@@ -4878,7 +5228,7 @@ var UserService = class extends BaseSDK {
|
|
|
4878
5228
|
method: "POST",
|
|
4879
5229
|
...options
|
|
4880
5230
|
});
|
|
4881
|
-
|
|
5231
|
+
log25("User info updated successfully");
|
|
4882
5232
|
return result;
|
|
4883
5233
|
}
|
|
4884
5234
|
/**
|
|
@@ -4908,7 +5258,7 @@ var UserService = class extends BaseSDK {
|
|
|
4908
5258
|
* ```
|
|
4909
5259
|
*/
|
|
4910
5260
|
async register(data, options) {
|
|
4911
|
-
|
|
5261
|
+
log25("Registering user: %O", {
|
|
4912
5262
|
followUserId: data.followUserId,
|
|
4913
5263
|
registerUserId: data.registerUserId
|
|
4914
5264
|
});
|
|
@@ -4920,14 +5270,14 @@ var UserService = class extends BaseSDK {
|
|
|
4920
5270
|
method: "POST",
|
|
4921
5271
|
...options
|
|
4922
5272
|
});
|
|
4923
|
-
|
|
5273
|
+
log25("User registered successfully: created=%s, userId=%s", result.created, result.user.clerkId);
|
|
4924
5274
|
return result;
|
|
4925
5275
|
}
|
|
4926
5276
|
};
|
|
4927
5277
|
|
|
4928
5278
|
// src/market/services/UserFollowService.ts
|
|
4929
|
-
import
|
|
4930
|
-
var
|
|
5279
|
+
import debug26 from "debug";
|
|
5280
|
+
var log26 = debug26("lobe-market-sdk:user-follow");
|
|
4931
5281
|
var UserFollowService = class extends BaseSDK {
|
|
4932
5282
|
/**
|
|
4933
5283
|
* Follow a user
|
|
@@ -4941,7 +5291,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
4941
5291
|
* @throws Error if already following or cannot follow yourself
|
|
4942
5292
|
*/
|
|
4943
5293
|
async follow(followingId, options) {
|
|
4944
|
-
|
|
5294
|
+
log26("Following user: %d", followingId);
|
|
4945
5295
|
const body = { followingId };
|
|
4946
5296
|
const result = await this.request("/v1/user/follows", {
|
|
4947
5297
|
body: JSON.stringify(body),
|
|
@@ -4951,7 +5301,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
4951
5301
|
method: "POST",
|
|
4952
5302
|
...options
|
|
4953
5303
|
});
|
|
4954
|
-
|
|
5304
|
+
log26("Successfully followed user: %d", followingId);
|
|
4955
5305
|
return result;
|
|
4956
5306
|
}
|
|
4957
5307
|
/**
|
|
@@ -4966,7 +5316,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
4966
5316
|
* @throws Error if follow relationship not found
|
|
4967
5317
|
*/
|
|
4968
5318
|
async unfollow(followingId, options) {
|
|
4969
|
-
|
|
5319
|
+
log26("Unfollowing user: %d", followingId);
|
|
4970
5320
|
const body = { followingId };
|
|
4971
5321
|
const result = await this.request("/v1/user/follows", {
|
|
4972
5322
|
body: JSON.stringify(body),
|
|
@@ -4976,7 +5326,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
4976
5326
|
method: "DELETE",
|
|
4977
5327
|
...options
|
|
4978
5328
|
});
|
|
4979
|
-
|
|
5329
|
+
log26("Successfully unfollowed user: %d", followingId);
|
|
4980
5330
|
return result;
|
|
4981
5331
|
}
|
|
4982
5332
|
/**
|
|
@@ -4990,13 +5340,13 @@ var UserFollowService = class extends BaseSDK {
|
|
|
4990
5340
|
* @returns Promise resolving to follow status (isFollowing, isMutual)
|
|
4991
5341
|
*/
|
|
4992
5342
|
async checkFollowStatus(targetUserId, options) {
|
|
4993
|
-
|
|
5343
|
+
log26("Checking follow status for user: %d", targetUserId);
|
|
4994
5344
|
const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
|
|
4995
5345
|
const result = await this.request(
|
|
4996
5346
|
`/v1/user/follows/check${queryString}`,
|
|
4997
5347
|
options
|
|
4998
5348
|
);
|
|
4999
|
-
|
|
5349
|
+
log26("Follow status retrieved: %O", result);
|
|
5000
5350
|
return result;
|
|
5001
5351
|
}
|
|
5002
5352
|
/**
|
|
@@ -5011,7 +5361,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5011
5361
|
* @returns Promise resolving to list of following users
|
|
5012
5362
|
*/
|
|
5013
5363
|
async getFollowing(userId, params = {}, options) {
|
|
5014
|
-
|
|
5364
|
+
log26("Getting following list for user: %d", userId);
|
|
5015
5365
|
const queryParams = {};
|
|
5016
5366
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5017
5367
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5020,7 +5370,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5020
5370
|
`/v1/user/follows/${userId}/following${queryString}`,
|
|
5021
5371
|
options
|
|
5022
5372
|
);
|
|
5023
|
-
|
|
5373
|
+
log26("Following list retrieved for user: %d", userId);
|
|
5024
5374
|
return result;
|
|
5025
5375
|
}
|
|
5026
5376
|
/**
|
|
@@ -5035,7 +5385,7 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5035
5385
|
* @returns Promise resolving to list of followers
|
|
5036
5386
|
*/
|
|
5037
5387
|
async getFollowers(userId, params = {}, options) {
|
|
5038
|
-
|
|
5388
|
+
log26("Getting followers list for user: %d", userId);
|
|
5039
5389
|
const queryParams = {};
|
|
5040
5390
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5041
5391
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5044,14 +5394,14 @@ var UserFollowService = class extends BaseSDK {
|
|
|
5044
5394
|
`/v1/user/follows/${userId}/followers${queryString}`,
|
|
5045
5395
|
options
|
|
5046
5396
|
);
|
|
5047
|
-
|
|
5397
|
+
log26("Followers list retrieved for user: %d", userId);
|
|
5048
5398
|
return result;
|
|
5049
5399
|
}
|
|
5050
5400
|
};
|
|
5051
5401
|
|
|
5052
5402
|
// src/market/services/UserFavoriteService.ts
|
|
5053
|
-
import
|
|
5054
|
-
var
|
|
5403
|
+
import debug27 from "debug";
|
|
5404
|
+
var log27 = debug27("lobe-market-sdk:user-favorite");
|
|
5055
5405
|
var UserFavoriteService = class extends BaseSDK {
|
|
5056
5406
|
/**
|
|
5057
5407
|
* Add to favorites
|
|
@@ -5066,7 +5416,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5066
5416
|
* @throws Error if already in favorites
|
|
5067
5417
|
*/
|
|
5068
5418
|
async addFavorite(targetType, targetId, options) {
|
|
5069
|
-
|
|
5419
|
+
log27("Adding favorite: %s %d", targetType, targetId);
|
|
5070
5420
|
const body = { targetId, targetType };
|
|
5071
5421
|
const result = await this.request("/v1/user/favorites", {
|
|
5072
5422
|
body: JSON.stringify(body),
|
|
@@ -5076,7 +5426,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5076
5426
|
method: "POST",
|
|
5077
5427
|
...options
|
|
5078
5428
|
});
|
|
5079
|
-
|
|
5429
|
+
log27("Successfully added favorite: %s %d", targetType, targetId);
|
|
5080
5430
|
return result;
|
|
5081
5431
|
}
|
|
5082
5432
|
/**
|
|
@@ -5092,7 +5442,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5092
5442
|
* @throws Error if favorite not found
|
|
5093
5443
|
*/
|
|
5094
5444
|
async removeFavorite(targetType, targetId, options) {
|
|
5095
|
-
|
|
5445
|
+
log27("Removing favorite: %s %d", targetType, targetId);
|
|
5096
5446
|
const body = { targetId, targetType };
|
|
5097
5447
|
const result = await this.request("/v1/user/favorites", {
|
|
5098
5448
|
body: JSON.stringify(body),
|
|
@@ -5102,7 +5452,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5102
5452
|
method: "DELETE",
|
|
5103
5453
|
...options
|
|
5104
5454
|
});
|
|
5105
|
-
|
|
5455
|
+
log27("Successfully removed favorite: %s %d", targetType, targetId);
|
|
5106
5456
|
return result;
|
|
5107
5457
|
}
|
|
5108
5458
|
/**
|
|
@@ -5117,7 +5467,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5117
5467
|
* @returns Promise resolving to favorite status
|
|
5118
5468
|
*/
|
|
5119
5469
|
async checkFavorite(targetType, targetId, options) {
|
|
5120
|
-
|
|
5470
|
+
log27("Checking favorite status: %s %d", targetType, targetId);
|
|
5121
5471
|
const queryString = this.buildQueryString({
|
|
5122
5472
|
targetId: String(targetId),
|
|
5123
5473
|
targetType
|
|
@@ -5126,7 +5476,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5126
5476
|
`/v1/user/favorites/check${queryString}`,
|
|
5127
5477
|
options
|
|
5128
5478
|
);
|
|
5129
|
-
|
|
5479
|
+
log27("Favorite status retrieved: %O", result);
|
|
5130
5480
|
return result;
|
|
5131
5481
|
}
|
|
5132
5482
|
/**
|
|
@@ -5140,7 +5490,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5140
5490
|
* @returns Promise resolving to list of favorites
|
|
5141
5491
|
*/
|
|
5142
5492
|
async getMyFavorites(params = {}, options) {
|
|
5143
|
-
|
|
5493
|
+
log27("Getting my favorites: %O", params);
|
|
5144
5494
|
const queryParams = {};
|
|
5145
5495
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5146
5496
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5150,7 +5500,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5150
5500
|
`/v1/user/favorites/me${queryString}`,
|
|
5151
5501
|
options
|
|
5152
5502
|
);
|
|
5153
|
-
|
|
5503
|
+
log27("My favorites retrieved");
|
|
5154
5504
|
return result;
|
|
5155
5505
|
}
|
|
5156
5506
|
/**
|
|
@@ -5165,7 +5515,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5165
5515
|
* @returns Promise resolving to list of favorites
|
|
5166
5516
|
*/
|
|
5167
5517
|
async getUserFavorites(userId, params = {}, options) {
|
|
5168
|
-
|
|
5518
|
+
log27("Getting favorites for user: %d", userId);
|
|
5169
5519
|
const queryParams = {};
|
|
5170
5520
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5171
5521
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5175,7 +5525,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5175
5525
|
`/v1/user/favorites/${userId}${queryString}`,
|
|
5176
5526
|
options
|
|
5177
5527
|
);
|
|
5178
|
-
|
|
5528
|
+
log27("Favorites retrieved for user: %d", userId);
|
|
5179
5529
|
return result;
|
|
5180
5530
|
}
|
|
5181
5531
|
/**
|
|
@@ -5190,7 +5540,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5190
5540
|
* @returns Promise resolving to list of favorite agents
|
|
5191
5541
|
*/
|
|
5192
5542
|
async getUserFavoriteAgents(userId, params = {}, options) {
|
|
5193
|
-
|
|
5543
|
+
log27("Getting favorite agents for user: %d", userId);
|
|
5194
5544
|
const queryParams = {};
|
|
5195
5545
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5196
5546
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5199,7 +5549,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5199
5549
|
`/v1/user/favorites/${userId}/agents${queryString}`,
|
|
5200
5550
|
options
|
|
5201
5551
|
);
|
|
5202
|
-
|
|
5552
|
+
log27("Favorite agents retrieved for user: %d", userId);
|
|
5203
5553
|
return result;
|
|
5204
5554
|
}
|
|
5205
5555
|
/**
|
|
@@ -5214,7 +5564,7 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5214
5564
|
* @returns Promise resolving to list of favorite plugins
|
|
5215
5565
|
*/
|
|
5216
5566
|
async getUserFavoritePlugins(userId, params = {}, options) {
|
|
5217
|
-
|
|
5567
|
+
log27("Getting favorite plugins for user: %d", userId);
|
|
5218
5568
|
const queryParams = {};
|
|
5219
5569
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5220
5570
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5223,14 +5573,14 @@ var UserFavoriteService = class extends BaseSDK {
|
|
|
5223
5573
|
`/v1/user/favorites/${userId}/plugins${queryString}`,
|
|
5224
5574
|
options
|
|
5225
5575
|
);
|
|
5226
|
-
|
|
5576
|
+
log27("Favorite plugins retrieved for user: %d", userId);
|
|
5227
5577
|
return result;
|
|
5228
5578
|
}
|
|
5229
5579
|
};
|
|
5230
5580
|
|
|
5231
5581
|
// src/market/services/UserLikeService.ts
|
|
5232
|
-
import
|
|
5233
|
-
var
|
|
5582
|
+
import debug28 from "debug";
|
|
5583
|
+
var log28 = debug28("lobe-market-sdk:user-like");
|
|
5234
5584
|
var UserLikeService = class extends BaseSDK {
|
|
5235
5585
|
/**
|
|
5236
5586
|
* Like content
|
|
@@ -5245,7 +5595,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5245
5595
|
* @throws Error if already liked
|
|
5246
5596
|
*/
|
|
5247
5597
|
async like(targetType, targetId, options) {
|
|
5248
|
-
|
|
5598
|
+
log28("Liking: %s %d", targetType, targetId);
|
|
5249
5599
|
const body = { targetId, targetType };
|
|
5250
5600
|
const result = await this.request("/v1/user/likes", {
|
|
5251
5601
|
body: JSON.stringify(body),
|
|
@@ -5255,7 +5605,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5255
5605
|
method: "POST",
|
|
5256
5606
|
...options
|
|
5257
5607
|
});
|
|
5258
|
-
|
|
5608
|
+
log28("Successfully liked: %s %d", targetType, targetId);
|
|
5259
5609
|
return result;
|
|
5260
5610
|
}
|
|
5261
5611
|
/**
|
|
@@ -5271,7 +5621,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5271
5621
|
* @throws Error if like not found
|
|
5272
5622
|
*/
|
|
5273
5623
|
async unlike(targetType, targetId, options) {
|
|
5274
|
-
|
|
5624
|
+
log28("Unliking: %s %d", targetType, targetId);
|
|
5275
5625
|
const body = { targetId, targetType };
|
|
5276
5626
|
const result = await this.request("/v1/user/likes", {
|
|
5277
5627
|
body: JSON.stringify(body),
|
|
@@ -5281,7 +5631,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5281
5631
|
method: "DELETE",
|
|
5282
5632
|
...options
|
|
5283
5633
|
});
|
|
5284
|
-
|
|
5634
|
+
log28("Successfully unliked: %s %d", targetType, targetId);
|
|
5285
5635
|
return result;
|
|
5286
5636
|
}
|
|
5287
5637
|
/**
|
|
@@ -5296,7 +5646,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5296
5646
|
* @returns Promise resolving to toggle response with new like status
|
|
5297
5647
|
*/
|
|
5298
5648
|
async toggleLike(targetType, targetId, options) {
|
|
5299
|
-
|
|
5649
|
+
log28("Toggling like: %s %d", targetType, targetId);
|
|
5300
5650
|
const body = { targetId, targetType };
|
|
5301
5651
|
const result = await this.request("/v1/user/likes/toggle", {
|
|
5302
5652
|
body: JSON.stringify(body),
|
|
@@ -5306,7 +5656,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5306
5656
|
method: "POST",
|
|
5307
5657
|
...options
|
|
5308
5658
|
});
|
|
5309
|
-
|
|
5659
|
+
log28("Like toggled, new status: %O", result);
|
|
5310
5660
|
return result;
|
|
5311
5661
|
}
|
|
5312
5662
|
/**
|
|
@@ -5321,7 +5671,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5321
5671
|
* @returns Promise resolving to like status
|
|
5322
5672
|
*/
|
|
5323
5673
|
async checkLike(targetType, targetId, options) {
|
|
5324
|
-
|
|
5674
|
+
log28("Checking like status: %s %d", targetType, targetId);
|
|
5325
5675
|
const queryString = this.buildQueryString({
|
|
5326
5676
|
targetId: String(targetId),
|
|
5327
5677
|
targetType
|
|
@@ -5330,7 +5680,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5330
5680
|
`/v1/user/likes/check${queryString}`,
|
|
5331
5681
|
options
|
|
5332
5682
|
);
|
|
5333
|
-
|
|
5683
|
+
log28("Like status retrieved: %O", result);
|
|
5334
5684
|
return result;
|
|
5335
5685
|
}
|
|
5336
5686
|
/**
|
|
@@ -5344,7 +5694,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5344
5694
|
* @returns Promise resolving to list of likes
|
|
5345
5695
|
*/
|
|
5346
5696
|
async getMyLikes(params = {}, options) {
|
|
5347
|
-
|
|
5697
|
+
log28("Getting my likes: %O", params);
|
|
5348
5698
|
const queryParams = {};
|
|
5349
5699
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5350
5700
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5354,7 +5704,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5354
5704
|
`/v1/user/likes/me${queryString}`,
|
|
5355
5705
|
options
|
|
5356
5706
|
);
|
|
5357
|
-
|
|
5707
|
+
log28("My likes retrieved");
|
|
5358
5708
|
return result;
|
|
5359
5709
|
}
|
|
5360
5710
|
/**
|
|
@@ -5369,7 +5719,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5369
5719
|
* @returns Promise resolving to list of likes
|
|
5370
5720
|
*/
|
|
5371
5721
|
async getUserLikes(userId, params = {}, options) {
|
|
5372
|
-
|
|
5722
|
+
log28("Getting likes for user: %d", userId);
|
|
5373
5723
|
const queryParams = {};
|
|
5374
5724
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5375
5725
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5379,7 +5729,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5379
5729
|
`/v1/user/likes/${userId}${queryString}`,
|
|
5380
5730
|
options
|
|
5381
5731
|
);
|
|
5382
|
-
|
|
5732
|
+
log28("Likes retrieved for user: %d", userId);
|
|
5383
5733
|
return result;
|
|
5384
5734
|
}
|
|
5385
5735
|
/**
|
|
@@ -5394,7 +5744,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5394
5744
|
* @returns Promise resolving to list of liked agents
|
|
5395
5745
|
*/
|
|
5396
5746
|
async getUserLikedAgents(userId, params = {}, options) {
|
|
5397
|
-
|
|
5747
|
+
log28("Getting liked agents for user: %d", userId);
|
|
5398
5748
|
const queryParams = {};
|
|
5399
5749
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5400
5750
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5403,7 +5753,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5403
5753
|
`/v1/user/likes/${userId}/agents${queryString}`,
|
|
5404
5754
|
options
|
|
5405
5755
|
);
|
|
5406
|
-
|
|
5756
|
+
log28("Liked agents retrieved for user: %d", userId);
|
|
5407
5757
|
return result;
|
|
5408
5758
|
}
|
|
5409
5759
|
/**
|
|
@@ -5418,7 +5768,7 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5418
5768
|
* @returns Promise resolving to list of liked plugins
|
|
5419
5769
|
*/
|
|
5420
5770
|
async getUserLikedPlugins(userId, params = {}, options) {
|
|
5421
|
-
|
|
5771
|
+
log28("Getting liked plugins for user: %d", userId);
|
|
5422
5772
|
const queryParams = {};
|
|
5423
5773
|
if (params.limit !== void 0) queryParams.limit = String(params.limit);
|
|
5424
5774
|
if (params.offset !== void 0) queryParams.offset = String(params.offset);
|
|
@@ -5427,14 +5777,14 @@ var UserLikeService = class extends BaseSDK {
|
|
|
5427
5777
|
`/v1/user/likes/${userId}/plugins${queryString}`,
|
|
5428
5778
|
options
|
|
5429
5779
|
);
|
|
5430
|
-
|
|
5780
|
+
log28("Liked plugins retrieved for user: %d", userId);
|
|
5431
5781
|
return result;
|
|
5432
5782
|
}
|
|
5433
5783
|
};
|
|
5434
5784
|
|
|
5435
5785
|
// src/market/services/UserPublishService.ts
|
|
5436
|
-
import
|
|
5437
|
-
var
|
|
5786
|
+
import debug29 from "debug";
|
|
5787
|
+
var log29 = debug29("lobe-market-sdk:user-publish");
|
|
5438
5788
|
var UserPublishService = class extends BaseSDK {
|
|
5439
5789
|
/**
|
|
5440
5790
|
* Lists all plugins owned by the authenticated user
|
|
@@ -5444,9 +5794,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5444
5794
|
*/
|
|
5445
5795
|
async listPlugins(options) {
|
|
5446
5796
|
var _a;
|
|
5447
|
-
|
|
5797
|
+
log29("Listing user plugins");
|
|
5448
5798
|
const result = await this.request("/v1/user/plugins", options);
|
|
5449
|
-
|
|
5799
|
+
log29("Found %d user plugins", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
5450
5800
|
return result;
|
|
5451
5801
|
}
|
|
5452
5802
|
/**
|
|
@@ -5457,9 +5807,9 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5457
5807
|
*/
|
|
5458
5808
|
async listSkills(options) {
|
|
5459
5809
|
var _a;
|
|
5460
|
-
|
|
5810
|
+
log29("Listing user skills");
|
|
5461
5811
|
const result = await this.request("/v1/user/skills", options);
|
|
5462
|
-
|
|
5812
|
+
log29("Found %d user skills", ((_a = result.data) == null ? void 0 : _a.length) || 0);
|
|
5463
5813
|
return result;
|
|
5464
5814
|
}
|
|
5465
5815
|
/**
|
|
@@ -5471,7 +5821,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5471
5821
|
* @returns Promise resolving to the publish result
|
|
5472
5822
|
*/
|
|
5473
5823
|
async publishSkillVersion(identifier, zipBuffer, options) {
|
|
5474
|
-
|
|
5824
|
+
log29("Publishing skill version for: %s", identifier);
|
|
5475
5825
|
const formData = new FormData();
|
|
5476
5826
|
const arrayBuffer = zipBuffer instanceof ArrayBuffer ? zipBuffer : zipBuffer.buffer.slice(
|
|
5477
5827
|
zipBuffer.byteOffset,
|
|
@@ -5487,7 +5837,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5487
5837
|
...options
|
|
5488
5838
|
}
|
|
5489
5839
|
);
|
|
5490
|
-
|
|
5840
|
+
log29("Published skill version: %s@%s", identifier, result.version);
|
|
5491
5841
|
return result;
|
|
5492
5842
|
}
|
|
5493
5843
|
/**
|
|
@@ -5498,11 +5848,11 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5498
5848
|
*/
|
|
5499
5849
|
async scanClaimableAssets(assetType) {
|
|
5500
5850
|
var _a;
|
|
5501
|
-
|
|
5851
|
+
log29("Scanning claimable %s", assetType);
|
|
5502
5852
|
const result = await this.request(
|
|
5503
5853
|
`/v1/user/claims/scan/${assetType}`
|
|
5504
5854
|
);
|
|
5505
|
-
|
|
5855
|
+
log29("Found %d claimable %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, assetType);
|
|
5506
5856
|
return result;
|
|
5507
5857
|
}
|
|
5508
5858
|
/**
|
|
@@ -5513,13 +5863,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5513
5863
|
* @returns Promise resolving to the claim result
|
|
5514
5864
|
*/
|
|
5515
5865
|
async claimAsset(assetId, assetType) {
|
|
5516
|
-
|
|
5866
|
+
log29("Claiming %s with id: %d", assetType, assetId);
|
|
5517
5867
|
const result = await this.request("/v1/user/claims", {
|
|
5518
5868
|
body: JSON.stringify({ assetId, assetType }),
|
|
5519
5869
|
headers: { "Content-Type": "application/json" },
|
|
5520
5870
|
method: "POST"
|
|
5521
5871
|
});
|
|
5522
|
-
|
|
5872
|
+
log29("Claim result for %s %d: %s", assetType, assetId, result.success);
|
|
5523
5873
|
return result;
|
|
5524
5874
|
}
|
|
5525
5875
|
/**
|
|
@@ -5531,7 +5881,7 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5531
5881
|
* @returns Promise resolving to the publish result
|
|
5532
5882
|
*/
|
|
5533
5883
|
async publishPluginVersion(identifier, data, options) {
|
|
5534
|
-
|
|
5884
|
+
log29("Publishing plugin version for: %s", identifier);
|
|
5535
5885
|
const result = await this.request(
|
|
5536
5886
|
`/v1/user/plugins/${encodeURIComponent(identifier)}/versions`,
|
|
5537
5887
|
{
|
|
@@ -5541,13 +5891,13 @@ var UserPublishService = class extends BaseSDK {
|
|
|
5541
5891
|
...options
|
|
5542
5892
|
}
|
|
5543
5893
|
);
|
|
5544
|
-
|
|
5894
|
+
log29("Published plugin version: %s@%s", identifier, result.version);
|
|
5545
5895
|
return result;
|
|
5546
5896
|
}
|
|
5547
5897
|
};
|
|
5548
5898
|
|
|
5549
5899
|
// src/market/market-sdk.ts
|
|
5550
|
-
var
|
|
5900
|
+
var log30 = debug30("lobe-market-sdk");
|
|
5551
5901
|
var MarketSDK = class extends BaseSDK {
|
|
5552
5902
|
/**
|
|
5553
5903
|
* Creates a new MarketSDK instance
|
|
@@ -5560,7 +5910,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
5560
5910
|
tokenExpiry: void 0
|
|
5561
5911
|
};
|
|
5562
5912
|
super(options, void 0, sharedTokenState);
|
|
5563
|
-
|
|
5913
|
+
log30("MarketSDK instance created");
|
|
5564
5914
|
this.agentProfile = new AgentProfileService(options, this.headers, sharedTokenState);
|
|
5565
5915
|
this.agents = new AgentService2(options, this.headers, sharedTokenState);
|
|
5566
5916
|
this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
|
|
@@ -5568,6 +5918,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
5568
5918
|
this.connect = new ConnectService(options, this.headers, sharedTokenState);
|
|
5569
5919
|
this.creds = new CredService(options, this.headers, sharedTokenState);
|
|
5570
5920
|
this.plugins = new PluginsService(options, this.headers, sharedTokenState);
|
|
5921
|
+
this.organizations = new OrganizationService(options, this.headers, sharedTokenState);
|
|
5571
5922
|
this.user = new UserService(options, this.headers, sharedTokenState);
|
|
5572
5923
|
this.userPublish = new UserPublishService(options, this.headers, sharedTokenState);
|
|
5573
5924
|
this.follows = new UserFollowService(options, this.headers, sharedTokenState);
|
|
@@ -5607,7 +5958,7 @@ var MarketSDK = class extends BaseSDK {
|
|
|
5607
5958
|
* @deprecated Use auth.registerClient() instead
|
|
5608
5959
|
*/
|
|
5609
5960
|
async registerClient(request) {
|
|
5610
|
-
|
|
5961
|
+
log30("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
|
|
5611
5962
|
return this.auth.registerClient(request);
|
|
5612
5963
|
}
|
|
5613
5964
|
};
|