@siglume/api-sdk 0.10.0 → 0.10.1
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/README.md +1 -1
- package/dist/bin/siglume.cjs +1 -161
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +1 -161
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +1 -161
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -116
- package/dist/cli/index.d.ts +3 -116
- package/dist/cli/index.js +1 -161
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +1 -222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -202
- package/dist/index.d.ts +4 -202
- package/dist/index.js +1 -222
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -340,10 +340,8 @@ var init_webhooks = __esm({
|
|
|
340
340
|
"subscription.cancelled",
|
|
341
341
|
"subscription.paused",
|
|
342
342
|
"subscription.reinstated",
|
|
343
|
-
"refund.issued",
|
|
344
343
|
"payment.succeeded",
|
|
345
344
|
"payment.failed",
|
|
346
|
-
"payment.disputed",
|
|
347
345
|
"capability.published",
|
|
348
346
|
"capability.delisted",
|
|
349
347
|
"execution.completed",
|
|
@@ -561,18 +559,6 @@ function camelCaseFromCapabilityKey(capabilityKey) {
|
|
|
561
559
|
}
|
|
562
560
|
return `${words.map((word) => word[0].toUpperCase() + word.slice(1)).join("")}App`;
|
|
563
561
|
}
|
|
564
|
-
function buildDefaultI18n(manifestPayload) {
|
|
565
|
-
const job = String(manifestPayload.job_to_be_done ?? "").trim();
|
|
566
|
-
const shortDescription = String(
|
|
567
|
-
manifestPayload.short_description ?? manifestPayload.job_to_be_done ?? manifestPayload.name ?? ""
|
|
568
|
-
).trim();
|
|
569
|
-
return {
|
|
570
|
-
job_to_be_done_en: job,
|
|
571
|
-
job_to_be_done_ja: job,
|
|
572
|
-
short_description_en: shortDescription,
|
|
573
|
-
short_description_ja: shortDescription
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
562
|
function buildRegistrationStubSource(manifestPayload, toolManualPayload) {
|
|
577
563
|
const capabilityKey = String(manifestPayload.capability_key ?? "generated-registration");
|
|
578
564
|
const jobToBeDone = String(
|
|
@@ -1639,6 +1625,7 @@ function parseListing(data) {
|
|
|
1639
1625
|
price_value_minor: Number(data.price_value_minor ?? 0),
|
|
1640
1626
|
currency: String(data.currency ?? "USD"),
|
|
1641
1627
|
short_description: stringOrNull2(data.short_description),
|
|
1628
|
+
description: stringOrNull2(data.description),
|
|
1642
1629
|
docs_url: stringOrNull2(data.docs_url),
|
|
1643
1630
|
support_contact: stringOrNull2(data.support_contact),
|
|
1644
1631
|
seller_display_name: stringOrNull2(data.seller_display_name),
|
|
@@ -2717,50 +2704,6 @@ function parseMarketProposalActionResult(execution) {
|
|
|
2717
2704
|
raw: { ...execution.raw }
|
|
2718
2705
|
};
|
|
2719
2706
|
}
|
|
2720
|
-
function parseRefund(data) {
|
|
2721
|
-
return {
|
|
2722
|
-
refund_id: String(data.refund_id ?? data.id ?? ""),
|
|
2723
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2724
|
-
owner_user_id: stringOrNull2(data.owner_user_id) ?? void 0,
|
|
2725
|
-
payment_mandate_id: stringOrNull2(data.payment_mandate_id) ?? void 0,
|
|
2726
|
-
usage_event_id: stringOrNull2(data.usage_event_id) ?? void 0,
|
|
2727
|
-
chain_receipt_id: stringOrNull2(data.chain_receipt_id) ?? void 0,
|
|
2728
|
-
amount_minor: Number(data.amount_minor ?? 0),
|
|
2729
|
-
currency: String(data.currency ?? "USD"),
|
|
2730
|
-
status: String(data.status ?? "issued"),
|
|
2731
|
-
reason_code: String(data.reason_code ?? "customer-request"),
|
|
2732
|
-
note: stringOrNull2(data.note) ?? void 0,
|
|
2733
|
-
idempotency_key: stringOrNull2(data.idempotency_key) ?? void 0,
|
|
2734
|
-
on_chain_tx_hash: stringOrNull2(data.on_chain_tx_hash) ?? void 0,
|
|
2735
|
-
metadata: toRecord2(data.metadata),
|
|
2736
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2737
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2738
|
-
updated_at: stringOrNull2(data.updated_at) ?? void 0,
|
|
2739
|
-
raw: { ...data }
|
|
2740
|
-
};
|
|
2741
|
-
}
|
|
2742
|
-
function parseDispute(data) {
|
|
2743
|
-
return {
|
|
2744
|
-
dispute_id: String(data.dispute_id ?? data.id ?? ""),
|
|
2745
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2746
|
-
owner_user_id: stringOrNull2(data.owner_user_id) ?? void 0,
|
|
2747
|
-
payment_mandate_id: stringOrNull2(data.payment_mandate_id) ?? void 0,
|
|
2748
|
-
usage_event_id: stringOrNull2(data.usage_event_id) ?? void 0,
|
|
2749
|
-
external_dispute_id: stringOrNull2(data.external_dispute_id) ?? void 0,
|
|
2750
|
-
status: String(data.status ?? "open"),
|
|
2751
|
-
reason_code: String(data.reason_code ?? "manual-review"),
|
|
2752
|
-
description: stringOrNull2(data.description) ?? void 0,
|
|
2753
|
-
evidence: toRecord2(data.evidence),
|
|
2754
|
-
response_decision: stringOrNull2(data.response_decision) ?? void 0,
|
|
2755
|
-
response_note: stringOrNull2(data.response_note) ?? void 0,
|
|
2756
|
-
responded_at: stringOrNull2(data.responded_at) ?? void 0,
|
|
2757
|
-
metadata: toRecord2(data.metadata),
|
|
2758
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2759
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2760
|
-
updated_at: stringOrNull2(data.updated_at) ?? void 0,
|
|
2761
|
-
raw: { ...data }
|
|
2762
|
-
};
|
|
2763
|
-
}
|
|
2764
2707
|
function cloneJsonLike(value) {
|
|
2765
2708
|
if (Array.isArray(value)) {
|
|
2766
2709
|
return value.map((item) => cloneJsonLike(item));
|
|
@@ -2846,7 +2789,6 @@ var init_client = __esm({
|
|
|
2846
2789
|
const manifestPayload = coerceMapping(manifest, "manifest");
|
|
2847
2790
|
const toolManualPayload = coerceMapping(tool_manual, "tool_manual");
|
|
2848
2791
|
const payload = {
|
|
2849
|
-
i18n: buildDefaultI18n(manifestPayload),
|
|
2850
2792
|
manifest: { ...manifestPayload },
|
|
2851
2793
|
tool_manual: { ...toolManualPayload }
|
|
2852
2794
|
};
|
|
@@ -2867,9 +2809,6 @@ var init_client = __esm({
|
|
|
2867
2809
|
)
|
|
2868
2810
|
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2869
2811
|
}
|
|
2870
|
-
if (options.metadata) {
|
|
2871
|
-
payload.metadata = coerceMapping(options.metadata, "metadata");
|
|
2872
|
-
}
|
|
2873
2812
|
if (options.source_context) {
|
|
2874
2813
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2875
2814
|
}
|
|
@@ -4520,105 +4459,6 @@ ${details}` : summary;
|
|
|
4520
4459
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4521
4460
|
});
|
|
4522
4461
|
}
|
|
4523
|
-
async issue_partial_refund(options) {
|
|
4524
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4525
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4526
|
-
if (!receipt_id) {
|
|
4527
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4528
|
-
}
|
|
4529
|
-
if (!idempotency_key) {
|
|
4530
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4531
|
-
}
|
|
4532
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4533
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4534
|
-
}
|
|
4535
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4536
|
-
if (amount_minor <= 0) {
|
|
4537
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4538
|
-
}
|
|
4539
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4540
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4541
|
-
}
|
|
4542
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4543
|
-
json_body: {
|
|
4544
|
-
receipt_id,
|
|
4545
|
-
amount_minor,
|
|
4546
|
-
reason_code: options.reason ?? "customer-request",
|
|
4547
|
-
note: options.note,
|
|
4548
|
-
idempotency_key
|
|
4549
|
-
}
|
|
4550
|
-
});
|
|
4551
|
-
return parseRefund(data);
|
|
4552
|
-
}
|
|
4553
|
-
async issue_full_refund(options) {
|
|
4554
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4555
|
-
if (!receipt_id) {
|
|
4556
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4557
|
-
}
|
|
4558
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4559
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4560
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4561
|
-
json_body: {
|
|
4562
|
-
receipt_id,
|
|
4563
|
-
reason_code: options.reason ?? "customer-request",
|
|
4564
|
-
note: options.note,
|
|
4565
|
-
idempotency_key
|
|
4566
|
-
}
|
|
4567
|
-
});
|
|
4568
|
-
return parseRefund(data);
|
|
4569
|
-
}
|
|
4570
|
-
async list_refunds(options = {}) {
|
|
4571
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4572
|
-
params: {
|
|
4573
|
-
receipt_id: options.receipt_id,
|
|
4574
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4575
|
-
}
|
|
4576
|
-
});
|
|
4577
|
-
if (!Array.isArray(data)) {
|
|
4578
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4579
|
-
}
|
|
4580
|
-
return data.filter((item) => isRecord2(item)).map(parseRefund);
|
|
4581
|
-
}
|
|
4582
|
-
async get_refund(refund_id) {
|
|
4583
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4584
|
-
return parseRefund(data);
|
|
4585
|
-
}
|
|
4586
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4587
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4588
|
-
}
|
|
4589
|
-
async list_disputes(options = {}) {
|
|
4590
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4591
|
-
params: {
|
|
4592
|
-
receipt_id: options.receipt_id,
|
|
4593
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4594
|
-
}
|
|
4595
|
-
});
|
|
4596
|
-
if (!Array.isArray(data)) {
|
|
4597
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4598
|
-
}
|
|
4599
|
-
return data.filter((item) => isRecord2(item)).map(parseDispute);
|
|
4600
|
-
}
|
|
4601
|
-
async get_dispute(dispute_id) {
|
|
4602
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4603
|
-
return parseDispute(data);
|
|
4604
|
-
}
|
|
4605
|
-
async respond_to_dispute(options) {
|
|
4606
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4607
|
-
if (!dispute_id) {
|
|
4608
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4609
|
-
}
|
|
4610
|
-
if (!isRecord2(options.evidence)) {
|
|
4611
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4612
|
-
}
|
|
4613
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4614
|
-
json_body: {
|
|
4615
|
-
response: options.response,
|
|
4616
|
-
evidence: toRecord2(options.evidence),
|
|
4617
|
-
note: options.note
|
|
4618
|
-
}
|
|
4619
|
-
});
|
|
4620
|
-
return parseDispute(data);
|
|
4621
|
-
}
|
|
4622
4462
|
async create_webhook_subscription(options) {
|
|
4623
4463
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4624
4464
|
if (normalizedEventTypes.length === 0) {
|
|
@@ -6484,42 +6324,6 @@ function toRecord3(value) {
|
|
|
6484
6324
|
init_metering();
|
|
6485
6325
|
init_operations();
|
|
6486
6326
|
|
|
6487
|
-
// src/refunds.ts
|
|
6488
|
-
init_client();
|
|
6489
|
-
var RefundClient = class {
|
|
6490
|
-
client;
|
|
6491
|
-
constructor(options) {
|
|
6492
|
-
this.client = new SiglumeClient(options);
|
|
6493
|
-
}
|
|
6494
|
-
close() {
|
|
6495
|
-
this.client.close();
|
|
6496
|
-
}
|
|
6497
|
-
async issue_partial_refund(options) {
|
|
6498
|
-
return this.client.issue_partial_refund(options);
|
|
6499
|
-
}
|
|
6500
|
-
async issue_full_refund(options) {
|
|
6501
|
-
return this.client.issue_full_refund(options);
|
|
6502
|
-
}
|
|
6503
|
-
async list_refunds(options = {}) {
|
|
6504
|
-
return this.client.list_refunds(options);
|
|
6505
|
-
}
|
|
6506
|
-
async get_refund(refund_id) {
|
|
6507
|
-
return this.client.get_refund(refund_id);
|
|
6508
|
-
}
|
|
6509
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
6510
|
-
return this.client.get_refunds_for_receipt(receipt_id, options);
|
|
6511
|
-
}
|
|
6512
|
-
async list_disputes(options = {}) {
|
|
6513
|
-
return this.client.list_disputes(options);
|
|
6514
|
-
}
|
|
6515
|
-
async get_dispute(dispute_id) {
|
|
6516
|
-
return this.client.get_dispute(dispute_id);
|
|
6517
|
-
}
|
|
6518
|
-
async respond_to_dispute(options) {
|
|
6519
|
-
return this.client.respond_to_dispute(options);
|
|
6520
|
-
}
|
|
6521
|
-
};
|
|
6522
|
-
|
|
6523
6327
|
// src/types.ts
|
|
6524
6328
|
var PermissionClass = {
|
|
6525
6329
|
READ_ONLY: "read-only",
|
|
@@ -6573,26 +6377,6 @@ var SettlementMode = {
|
|
|
6573
6377
|
POLYGON_MANDATE: "polygon_mandate",
|
|
6574
6378
|
EMBEDDED_WALLET_CHARGE: "embedded_wallet_charge"
|
|
6575
6379
|
};
|
|
6576
|
-
var RefundReason = {
|
|
6577
|
-
CUSTOMER_REQUEST: "customer-request",
|
|
6578
|
-
DUPLICATE: "duplicate",
|
|
6579
|
-
FRAUDULENT: "fraudulent",
|
|
6580
|
-
SERVICE_FAILURE: "service-failure",
|
|
6581
|
-
GOODWILL: "goodwill"
|
|
6582
|
-
};
|
|
6583
|
-
var DisputeResponse = {
|
|
6584
|
-
ACCEPT: "accept",
|
|
6585
|
-
CONTEST: "contest"
|
|
6586
|
-
};
|
|
6587
|
-
var RefundStatus = {
|
|
6588
|
-
ISSUED: "issued",
|
|
6589
|
-
FAILED: "failed"
|
|
6590
|
-
};
|
|
6591
|
-
var DisputeStatus = {
|
|
6592
|
-
OPEN: "open",
|
|
6593
|
-
ACCEPTED: "accepted",
|
|
6594
|
-
CONTESTED: "contested"
|
|
6595
|
-
};
|
|
6596
6380
|
|
|
6597
6381
|
// src/testing/recorder.ts
|
|
6598
6382
|
var CASSETTE_VERSION = 1;
|
|
@@ -8890,8 +8674,6 @@ export {
|
|
|
8890
8674
|
DEFAULT_OPERATION_AGENT_ID,
|
|
8891
8675
|
DEFAULT_SIGLUME_API_BASE,
|
|
8892
8676
|
DEFAULT_WEBHOOK_TOLERANCE_SECONDS,
|
|
8893
|
-
DisputeResponse,
|
|
8894
|
-
DisputeStatus,
|
|
8895
8677
|
Environment,
|
|
8896
8678
|
ExecutionKind,
|
|
8897
8679
|
InMemoryWebhookDedupe,
|
|
@@ -8902,9 +8684,6 @@ export {
|
|
|
8902
8684
|
PriceModel,
|
|
8903
8685
|
RecordMode,
|
|
8904
8686
|
Recorder,
|
|
8905
|
-
RefundClient,
|
|
8906
|
-
RefundReason,
|
|
8907
|
-
RefundStatus,
|
|
8908
8687
|
SettlementMode,
|
|
8909
8688
|
SiglumeAPIError,
|
|
8910
8689
|
SiglumeAssistError,
|