@siglume/api-sdk 0.9.1 → 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 +8 -162
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +8 -162
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +8 -162
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +4 -102
- package/dist/cli/index.d.ts +4 -102
- package/dist/cli/index.js +8 -162
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +8 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -188
- package/dist/index.d.ts +5 -188
- package/dist/index.js +8 -223
- 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
|
}
|
|
@@ -2881,6 +2820,7 @@ var init_client = __esm({
|
|
|
2881
2820
|
"name",
|
|
2882
2821
|
"job_to_be_done",
|
|
2883
2822
|
"short_description",
|
|
2823
|
+
"description",
|
|
2884
2824
|
"category",
|
|
2885
2825
|
"docs_url",
|
|
2886
2826
|
"documentation_url",
|
|
@@ -2893,13 +2833,18 @@ var init_client = __esm({
|
|
|
2893
2833
|
"permission_class",
|
|
2894
2834
|
"approval_mode",
|
|
2895
2835
|
"dry_run_supported",
|
|
2896
|
-
"required_connected_accounts"
|
|
2836
|
+
"required_connected_accounts",
|
|
2837
|
+
"permission_scopes",
|
|
2838
|
+
"compatibility_tags"
|
|
2897
2839
|
]) {
|
|
2898
2840
|
const value = manifestPayload[fieldName];
|
|
2899
2841
|
if (value !== void 0 && value !== null) {
|
|
2900
2842
|
payload[fieldName] = value;
|
|
2901
2843
|
}
|
|
2902
2844
|
}
|
|
2845
|
+
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2846
|
+
delete payload.manifest.version;
|
|
2847
|
+
}
|
|
2903
2848
|
const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
|
|
2904
2849
|
const supportContact = String(manifestPayload.support_contact ?? "").trim();
|
|
2905
2850
|
const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
|
|
@@ -4514,105 +4459,6 @@ ${details}` : summary;
|
|
|
4514
4459
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4515
4460
|
});
|
|
4516
4461
|
}
|
|
4517
|
-
async issue_partial_refund(options) {
|
|
4518
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4519
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4520
|
-
if (!receipt_id) {
|
|
4521
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4522
|
-
}
|
|
4523
|
-
if (!idempotency_key) {
|
|
4524
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4525
|
-
}
|
|
4526
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4527
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4528
|
-
}
|
|
4529
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4530
|
-
if (amount_minor <= 0) {
|
|
4531
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4532
|
-
}
|
|
4533
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4534
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4535
|
-
}
|
|
4536
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4537
|
-
json_body: {
|
|
4538
|
-
receipt_id,
|
|
4539
|
-
amount_minor,
|
|
4540
|
-
reason_code: options.reason ?? "customer-request",
|
|
4541
|
-
note: options.note,
|
|
4542
|
-
idempotency_key
|
|
4543
|
-
}
|
|
4544
|
-
});
|
|
4545
|
-
return parseRefund(data);
|
|
4546
|
-
}
|
|
4547
|
-
async issue_full_refund(options) {
|
|
4548
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4549
|
-
if (!receipt_id) {
|
|
4550
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4551
|
-
}
|
|
4552
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4553
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4554
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4555
|
-
json_body: {
|
|
4556
|
-
receipt_id,
|
|
4557
|
-
reason_code: options.reason ?? "customer-request",
|
|
4558
|
-
note: options.note,
|
|
4559
|
-
idempotency_key
|
|
4560
|
-
}
|
|
4561
|
-
});
|
|
4562
|
-
return parseRefund(data);
|
|
4563
|
-
}
|
|
4564
|
-
async list_refunds(options = {}) {
|
|
4565
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4566
|
-
params: {
|
|
4567
|
-
receipt_id: options.receipt_id,
|
|
4568
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4569
|
-
}
|
|
4570
|
-
});
|
|
4571
|
-
if (!Array.isArray(data)) {
|
|
4572
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4573
|
-
}
|
|
4574
|
-
return data.filter((item) => isRecord2(item)).map(parseRefund);
|
|
4575
|
-
}
|
|
4576
|
-
async get_refund(refund_id) {
|
|
4577
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4578
|
-
return parseRefund(data);
|
|
4579
|
-
}
|
|
4580
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4581
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4582
|
-
}
|
|
4583
|
-
async list_disputes(options = {}) {
|
|
4584
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4585
|
-
params: {
|
|
4586
|
-
receipt_id: options.receipt_id,
|
|
4587
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4588
|
-
}
|
|
4589
|
-
});
|
|
4590
|
-
if (!Array.isArray(data)) {
|
|
4591
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4592
|
-
}
|
|
4593
|
-
return data.filter((item) => isRecord2(item)).map(parseDispute);
|
|
4594
|
-
}
|
|
4595
|
-
async get_dispute(dispute_id) {
|
|
4596
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4597
|
-
return parseDispute(data);
|
|
4598
|
-
}
|
|
4599
|
-
async respond_to_dispute(options) {
|
|
4600
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4601
|
-
if (!dispute_id) {
|
|
4602
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4603
|
-
}
|
|
4604
|
-
if (!isRecord2(options.evidence)) {
|
|
4605
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4606
|
-
}
|
|
4607
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4608
|
-
json_body: {
|
|
4609
|
-
response: options.response,
|
|
4610
|
-
evidence: toRecord2(options.evidence),
|
|
4611
|
-
note: options.note
|
|
4612
|
-
}
|
|
4613
|
-
});
|
|
4614
|
-
return parseDispute(data);
|
|
4615
|
-
}
|
|
4616
4462
|
async create_webhook_subscription(options) {
|
|
4617
4463
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4618
4464
|
if (normalizedEventTypes.length === 0) {
|
|
@@ -6478,42 +6324,6 @@ function toRecord3(value) {
|
|
|
6478
6324
|
init_metering();
|
|
6479
6325
|
init_operations();
|
|
6480
6326
|
|
|
6481
|
-
// src/refunds.ts
|
|
6482
|
-
init_client();
|
|
6483
|
-
var RefundClient = class {
|
|
6484
|
-
client;
|
|
6485
|
-
constructor(options) {
|
|
6486
|
-
this.client = new SiglumeClient(options);
|
|
6487
|
-
}
|
|
6488
|
-
close() {
|
|
6489
|
-
this.client.close();
|
|
6490
|
-
}
|
|
6491
|
-
async issue_partial_refund(options) {
|
|
6492
|
-
return this.client.issue_partial_refund(options);
|
|
6493
|
-
}
|
|
6494
|
-
async issue_full_refund(options) {
|
|
6495
|
-
return this.client.issue_full_refund(options);
|
|
6496
|
-
}
|
|
6497
|
-
async list_refunds(options = {}) {
|
|
6498
|
-
return this.client.list_refunds(options);
|
|
6499
|
-
}
|
|
6500
|
-
async get_refund(refund_id) {
|
|
6501
|
-
return this.client.get_refund(refund_id);
|
|
6502
|
-
}
|
|
6503
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
6504
|
-
return this.client.get_refunds_for_receipt(receipt_id, options);
|
|
6505
|
-
}
|
|
6506
|
-
async list_disputes(options = {}) {
|
|
6507
|
-
return this.client.list_disputes(options);
|
|
6508
|
-
}
|
|
6509
|
-
async get_dispute(dispute_id) {
|
|
6510
|
-
return this.client.get_dispute(dispute_id);
|
|
6511
|
-
}
|
|
6512
|
-
async respond_to_dispute(options) {
|
|
6513
|
-
return this.client.respond_to_dispute(options);
|
|
6514
|
-
}
|
|
6515
|
-
};
|
|
6516
|
-
|
|
6517
6327
|
// src/types.ts
|
|
6518
6328
|
var PermissionClass = {
|
|
6519
6329
|
READ_ONLY: "read-only",
|
|
@@ -6567,26 +6377,6 @@ var SettlementMode = {
|
|
|
6567
6377
|
POLYGON_MANDATE: "polygon_mandate",
|
|
6568
6378
|
EMBEDDED_WALLET_CHARGE: "embedded_wallet_charge"
|
|
6569
6379
|
};
|
|
6570
|
-
var RefundReason = {
|
|
6571
|
-
CUSTOMER_REQUEST: "customer-request",
|
|
6572
|
-
DUPLICATE: "duplicate",
|
|
6573
|
-
FRAUDULENT: "fraudulent",
|
|
6574
|
-
SERVICE_FAILURE: "service-failure",
|
|
6575
|
-
GOODWILL: "goodwill"
|
|
6576
|
-
};
|
|
6577
|
-
var DisputeResponse = {
|
|
6578
|
-
ACCEPT: "accept",
|
|
6579
|
-
CONTEST: "contest"
|
|
6580
|
-
};
|
|
6581
|
-
var RefundStatus = {
|
|
6582
|
-
ISSUED: "issued",
|
|
6583
|
-
FAILED: "failed"
|
|
6584
|
-
};
|
|
6585
|
-
var DisputeStatus = {
|
|
6586
|
-
OPEN: "open",
|
|
6587
|
-
ACCEPTED: "accepted",
|
|
6588
|
-
CONTESTED: "contested"
|
|
6589
|
-
};
|
|
6590
6380
|
|
|
6591
6381
|
// src/testing/recorder.ts
|
|
6592
6382
|
var CASSETTE_VERSION = 1;
|
|
@@ -8884,8 +8674,6 @@ export {
|
|
|
8884
8674
|
DEFAULT_OPERATION_AGENT_ID,
|
|
8885
8675
|
DEFAULT_SIGLUME_API_BASE,
|
|
8886
8676
|
DEFAULT_WEBHOOK_TOLERANCE_SECONDS,
|
|
8887
|
-
DisputeResponse,
|
|
8888
|
-
DisputeStatus,
|
|
8889
8677
|
Environment,
|
|
8890
8678
|
ExecutionKind,
|
|
8891
8679
|
InMemoryWebhookDedupe,
|
|
@@ -8896,9 +8684,6 @@ export {
|
|
|
8896
8684
|
PriceModel,
|
|
8897
8685
|
RecordMode,
|
|
8898
8686
|
Recorder,
|
|
8899
|
-
RefundClient,
|
|
8900
|
-
RefundReason,
|
|
8901
|
-
RefundStatus,
|
|
8902
8687
|
SettlementMode,
|
|
8903
8688
|
SiglumeAPIError,
|
|
8904
8689
|
SiglumeAssistError,
|