@vibeiao/sdk 0.1.8 → 0.1.9
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.ts +7 -0
- package/dist/index.js +29 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -895,6 +895,12 @@ declare class VibeClient {
|
|
|
895
895
|
registerAgent(claimId: string, listing: ListingInput, ownerClaimId?: string): Promise<ApiResponse<ListingRecord>>;
|
|
896
896
|
updateListingStatus(listingId: string, claimId: string, status: ListingStatus): Promise<ApiResponse<ListingRecord>>;
|
|
897
897
|
updateListingPrice(listingId: string, claimId: string, priceUsdc: number): Promise<ApiResponse<ListingRecord>>;
|
|
898
|
+
deleteListing(listingId: string, claimId: string): Promise<ApiResponse<{
|
|
899
|
+
id: string;
|
|
900
|
+
deleted: boolean;
|
|
901
|
+
removedStorageObjects?: number;
|
|
902
|
+
storageCleanupErrors?: string[];
|
|
903
|
+
}>>;
|
|
898
904
|
transferOwner(listingId: string, claimId: string, signature: string): Promise<ApiResponse<{
|
|
899
905
|
listing_id: string;
|
|
900
906
|
owner_wallet_id: string;
|
|
@@ -945,6 +951,7 @@ declare class VibeClient {
|
|
|
945
951
|
}): Promise<TicketVerifyResponse>;
|
|
946
952
|
private get;
|
|
947
953
|
private post;
|
|
954
|
+
private del;
|
|
948
955
|
checkLatestVersion(force?: boolean): Promise<SdkUpdateStatus>;
|
|
949
956
|
private resolveUpdateStatus;
|
|
950
957
|
private ensureLatestVersion;
|
package/dist/index.js
CHANGED
|
@@ -114,7 +114,7 @@ var ReviewGate = class {
|
|
|
114
114
|
var DEFAULT_API_BASE = "https://api.vibeiao.com";
|
|
115
115
|
var DEFAULT_WEB_BASE = "https://vibeiao.com";
|
|
116
116
|
var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
|
|
117
|
-
var DEFAULT_SDK_VERSION = "0.1.
|
|
117
|
+
var DEFAULT_SDK_VERSION = "0.1.8" ? "0.1.8" : "0.1.4";
|
|
118
118
|
var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
|
|
119
119
|
var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
|
|
120
120
|
var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
|
|
@@ -329,6 +329,12 @@ var VibeClient = class {
|
|
|
329
329
|
async updateListingPrice(listingId, claimId, priceUsdc) {
|
|
330
330
|
return this.post(`/v1/listings/${listingId}/price`, { claimId, priceUsdc });
|
|
331
331
|
}
|
|
332
|
+
async deleteListing(listingId, claimId) {
|
|
333
|
+
return this.del(
|
|
334
|
+
`/v1/listings/${listingId}`,
|
|
335
|
+
{ claimId }
|
|
336
|
+
);
|
|
337
|
+
}
|
|
332
338
|
async transferOwner(listingId, claimId, signature) {
|
|
333
339
|
return this.post(
|
|
334
340
|
`/v1/listings/${listingId}/owner-transfer`,
|
|
@@ -539,6 +545,28 @@ var VibeClient = class {
|
|
|
539
545
|
}
|
|
540
546
|
return payload;
|
|
541
547
|
}
|
|
548
|
+
async del(path, body) {
|
|
549
|
+
await this.ensureLatestVersion();
|
|
550
|
+
const response = await this.fetcher(`${this.baseUrl}${path}`, {
|
|
551
|
+
method: "DELETE",
|
|
552
|
+
headers: { "Content-Type": "application/json" },
|
|
553
|
+
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
554
|
+
});
|
|
555
|
+
let payload = null;
|
|
556
|
+
try {
|
|
557
|
+
payload = await readJson(response);
|
|
558
|
+
} catch (error) {
|
|
559
|
+
const details = error instanceof Error && "details" in error ? error.details : void 0;
|
|
560
|
+
return { error: "invalid_json_response", details };
|
|
561
|
+
}
|
|
562
|
+
if (!response.ok) {
|
|
563
|
+
return { error: payload?.error || "request_failed", details: payload?.details };
|
|
564
|
+
}
|
|
565
|
+
if (!payload) {
|
|
566
|
+
return { error: "empty_response" };
|
|
567
|
+
}
|
|
568
|
+
return payload;
|
|
569
|
+
}
|
|
542
570
|
async checkLatestVersion(force = false) {
|
|
543
571
|
if (!force && this.lastUpdateStatus && Date.now() - this.lastUpdateCheckAt < this.updateCheckIntervalMs) {
|
|
544
572
|
return this.lastUpdateStatus;
|