@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.cjs
CHANGED
|
@@ -362,10 +362,8 @@ var init_webhooks = __esm({
|
|
|
362
362
|
"subscription.cancelled",
|
|
363
363
|
"subscription.paused",
|
|
364
364
|
"subscription.reinstated",
|
|
365
|
-
"refund.issued",
|
|
366
365
|
"payment.succeeded",
|
|
367
366
|
"payment.failed",
|
|
368
|
-
"payment.disputed",
|
|
369
367
|
"capability.published",
|
|
370
368
|
"capability.delisted",
|
|
371
369
|
"execution.completed",
|
|
@@ -583,18 +581,6 @@ function camelCaseFromCapabilityKey(capabilityKey) {
|
|
|
583
581
|
}
|
|
584
582
|
return `${words.map((word) => word[0].toUpperCase() + word.slice(1)).join("")}App`;
|
|
585
583
|
}
|
|
586
|
-
function buildDefaultI18n(manifestPayload) {
|
|
587
|
-
const job = String(manifestPayload.job_to_be_done ?? "").trim();
|
|
588
|
-
const shortDescription = String(
|
|
589
|
-
manifestPayload.short_description ?? manifestPayload.job_to_be_done ?? manifestPayload.name ?? ""
|
|
590
|
-
).trim();
|
|
591
|
-
return {
|
|
592
|
-
job_to_be_done_en: job,
|
|
593
|
-
job_to_be_done_ja: job,
|
|
594
|
-
short_description_en: shortDescription,
|
|
595
|
-
short_description_ja: shortDescription
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
584
|
function buildRegistrationStubSource(manifestPayload, toolManualPayload) {
|
|
599
585
|
const capabilityKey = String(manifestPayload.capability_key ?? "generated-registration");
|
|
600
586
|
const jobToBeDone = String(
|
|
@@ -1661,6 +1647,7 @@ function parseListing(data) {
|
|
|
1661
1647
|
price_value_minor: Number(data.price_value_minor ?? 0),
|
|
1662
1648
|
currency: String(data.currency ?? "USD"),
|
|
1663
1649
|
short_description: stringOrNull2(data.short_description),
|
|
1650
|
+
description: stringOrNull2(data.description),
|
|
1664
1651
|
docs_url: stringOrNull2(data.docs_url),
|
|
1665
1652
|
support_contact: stringOrNull2(data.support_contact),
|
|
1666
1653
|
seller_display_name: stringOrNull2(data.seller_display_name),
|
|
@@ -2739,50 +2726,6 @@ function parseMarketProposalActionResult(execution) {
|
|
|
2739
2726
|
raw: { ...execution.raw }
|
|
2740
2727
|
};
|
|
2741
2728
|
}
|
|
2742
|
-
function parseRefund(data) {
|
|
2743
|
-
return {
|
|
2744
|
-
refund_id: String(data.refund_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
|
-
chain_receipt_id: stringOrNull2(data.chain_receipt_id) ?? void 0,
|
|
2750
|
-
amount_minor: Number(data.amount_minor ?? 0),
|
|
2751
|
-
currency: String(data.currency ?? "USD"),
|
|
2752
|
-
status: String(data.status ?? "issued"),
|
|
2753
|
-
reason_code: String(data.reason_code ?? "customer-request"),
|
|
2754
|
-
note: stringOrNull2(data.note) ?? void 0,
|
|
2755
|
-
idempotency_key: stringOrNull2(data.idempotency_key) ?? void 0,
|
|
2756
|
-
on_chain_tx_hash: stringOrNull2(data.on_chain_tx_hash) ?? 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
|
-
function parseDispute(data) {
|
|
2765
|
-
return {
|
|
2766
|
-
dispute_id: String(data.dispute_id ?? data.id ?? ""),
|
|
2767
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2768
|
-
owner_user_id: stringOrNull2(data.owner_user_id) ?? void 0,
|
|
2769
|
-
payment_mandate_id: stringOrNull2(data.payment_mandate_id) ?? void 0,
|
|
2770
|
-
usage_event_id: stringOrNull2(data.usage_event_id) ?? void 0,
|
|
2771
|
-
external_dispute_id: stringOrNull2(data.external_dispute_id) ?? void 0,
|
|
2772
|
-
status: String(data.status ?? "open"),
|
|
2773
|
-
reason_code: String(data.reason_code ?? "manual-review"),
|
|
2774
|
-
description: stringOrNull2(data.description) ?? void 0,
|
|
2775
|
-
evidence: toRecord2(data.evidence),
|
|
2776
|
-
response_decision: stringOrNull2(data.response_decision) ?? void 0,
|
|
2777
|
-
response_note: stringOrNull2(data.response_note) ?? void 0,
|
|
2778
|
-
responded_at: stringOrNull2(data.responded_at) ?? void 0,
|
|
2779
|
-
metadata: toRecord2(data.metadata),
|
|
2780
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2781
|
-
created_at: stringOrNull2(data.created_at) ?? void 0,
|
|
2782
|
-
updated_at: stringOrNull2(data.updated_at) ?? void 0,
|
|
2783
|
-
raw: { ...data }
|
|
2784
|
-
};
|
|
2785
|
-
}
|
|
2786
2729
|
function cloneJsonLike(value) {
|
|
2787
2730
|
if (Array.isArray(value)) {
|
|
2788
2731
|
return value.map((item) => cloneJsonLike(item));
|
|
@@ -2868,7 +2811,6 @@ var init_client = __esm({
|
|
|
2868
2811
|
const manifestPayload = coerceMapping(manifest, "manifest");
|
|
2869
2812
|
const toolManualPayload = coerceMapping(tool_manual, "tool_manual");
|
|
2870
2813
|
const payload = {
|
|
2871
|
-
i18n: buildDefaultI18n(manifestPayload),
|
|
2872
2814
|
manifest: { ...manifestPayload },
|
|
2873
2815
|
tool_manual: { ...toolManualPayload }
|
|
2874
2816
|
};
|
|
@@ -2889,9 +2831,6 @@ var init_client = __esm({
|
|
|
2889
2831
|
)
|
|
2890
2832
|
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2891
2833
|
}
|
|
2892
|
-
if (options.metadata) {
|
|
2893
|
-
payload.metadata = coerceMapping(options.metadata, "metadata");
|
|
2894
|
-
}
|
|
2895
2834
|
if (options.source_context) {
|
|
2896
2835
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2897
2836
|
}
|
|
@@ -2903,6 +2842,7 @@ var init_client = __esm({
|
|
|
2903
2842
|
"name",
|
|
2904
2843
|
"job_to_be_done",
|
|
2905
2844
|
"short_description",
|
|
2845
|
+
"description",
|
|
2906
2846
|
"category",
|
|
2907
2847
|
"docs_url",
|
|
2908
2848
|
"documentation_url",
|
|
@@ -2915,13 +2855,18 @@ var init_client = __esm({
|
|
|
2915
2855
|
"permission_class",
|
|
2916
2856
|
"approval_mode",
|
|
2917
2857
|
"dry_run_supported",
|
|
2918
|
-
"required_connected_accounts"
|
|
2858
|
+
"required_connected_accounts",
|
|
2859
|
+
"permission_scopes",
|
|
2860
|
+
"compatibility_tags"
|
|
2919
2861
|
]) {
|
|
2920
2862
|
const value = manifestPayload[fieldName];
|
|
2921
2863
|
if (value !== void 0 && value !== null) {
|
|
2922
2864
|
payload[fieldName] = value;
|
|
2923
2865
|
}
|
|
2924
2866
|
}
|
|
2867
|
+
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2868
|
+
delete payload.manifest.version;
|
|
2869
|
+
}
|
|
2925
2870
|
const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
|
|
2926
2871
|
const supportContact = String(manifestPayload.support_contact ?? "").trim();
|
|
2927
2872
|
const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
|
|
@@ -4536,105 +4481,6 @@ ${details}` : summary;
|
|
|
4536
4481
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4537
4482
|
});
|
|
4538
4483
|
}
|
|
4539
|
-
async issue_partial_refund(options) {
|
|
4540
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4541
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4542
|
-
if (!receipt_id) {
|
|
4543
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4544
|
-
}
|
|
4545
|
-
if (!idempotency_key) {
|
|
4546
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4547
|
-
}
|
|
4548
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4549
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4550
|
-
}
|
|
4551
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4552
|
-
if (amount_minor <= 0) {
|
|
4553
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4554
|
-
}
|
|
4555
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4556
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4557
|
-
}
|
|
4558
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4559
|
-
json_body: {
|
|
4560
|
-
receipt_id,
|
|
4561
|
-
amount_minor,
|
|
4562
|
-
reason_code: options.reason ?? "customer-request",
|
|
4563
|
-
note: options.note,
|
|
4564
|
-
idempotency_key
|
|
4565
|
-
}
|
|
4566
|
-
});
|
|
4567
|
-
return parseRefund(data);
|
|
4568
|
-
}
|
|
4569
|
-
async issue_full_refund(options) {
|
|
4570
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4571
|
-
if (!receipt_id) {
|
|
4572
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4573
|
-
}
|
|
4574
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4575
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4576
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4577
|
-
json_body: {
|
|
4578
|
-
receipt_id,
|
|
4579
|
-
reason_code: options.reason ?? "customer-request",
|
|
4580
|
-
note: options.note,
|
|
4581
|
-
idempotency_key
|
|
4582
|
-
}
|
|
4583
|
-
});
|
|
4584
|
-
return parseRefund(data);
|
|
4585
|
-
}
|
|
4586
|
-
async list_refunds(options = {}) {
|
|
4587
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4588
|
-
params: {
|
|
4589
|
-
receipt_id: options.receipt_id,
|
|
4590
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4591
|
-
}
|
|
4592
|
-
});
|
|
4593
|
-
if (!Array.isArray(data)) {
|
|
4594
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4595
|
-
}
|
|
4596
|
-
return data.filter((item) => isRecord2(item)).map(parseRefund);
|
|
4597
|
-
}
|
|
4598
|
-
async get_refund(refund_id) {
|
|
4599
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4600
|
-
return parseRefund(data);
|
|
4601
|
-
}
|
|
4602
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4603
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4604
|
-
}
|
|
4605
|
-
async list_disputes(options = {}) {
|
|
4606
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4607
|
-
params: {
|
|
4608
|
-
receipt_id: options.receipt_id,
|
|
4609
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4610
|
-
}
|
|
4611
|
-
});
|
|
4612
|
-
if (!Array.isArray(data)) {
|
|
4613
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4614
|
-
}
|
|
4615
|
-
return data.filter((item) => isRecord2(item)).map(parseDispute);
|
|
4616
|
-
}
|
|
4617
|
-
async get_dispute(dispute_id) {
|
|
4618
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4619
|
-
return parseDispute(data);
|
|
4620
|
-
}
|
|
4621
|
-
async respond_to_dispute(options) {
|
|
4622
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4623
|
-
if (!dispute_id) {
|
|
4624
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4625
|
-
}
|
|
4626
|
-
if (!isRecord2(options.evidence)) {
|
|
4627
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4628
|
-
}
|
|
4629
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4630
|
-
json_body: {
|
|
4631
|
-
response: options.response,
|
|
4632
|
-
evidence: toRecord2(options.evidence),
|
|
4633
|
-
note: options.note
|
|
4634
|
-
}
|
|
4635
|
-
});
|
|
4636
|
-
return parseDispute(data);
|
|
4637
|
-
}
|
|
4638
4484
|
async create_webhook_subscription(options) {
|
|
4639
4485
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4640
4486
|
if (normalizedEventTypes.length === 0) {
|
|
@@ -5268,8 +5114,6 @@ __export(src_exports, {
|
|
|
5268
5114
|
DEFAULT_OPERATION_AGENT_ID: () => DEFAULT_OPERATION_AGENT_ID,
|
|
5269
5115
|
DEFAULT_SIGLUME_API_BASE: () => DEFAULT_SIGLUME_API_BASE,
|
|
5270
5116
|
DEFAULT_WEBHOOK_TOLERANCE_SECONDS: () => DEFAULT_WEBHOOK_TOLERANCE_SECONDS,
|
|
5271
|
-
DisputeResponse: () => DisputeResponse,
|
|
5272
|
-
DisputeStatus: () => DisputeStatus,
|
|
5273
5117
|
Environment: () => Environment,
|
|
5274
5118
|
ExecutionKind: () => ExecutionKind,
|
|
5275
5119
|
InMemoryWebhookDedupe: () => InMemoryWebhookDedupe,
|
|
@@ -5280,9 +5124,6 @@ __export(src_exports, {
|
|
|
5280
5124
|
PriceModel: () => PriceModel,
|
|
5281
5125
|
RecordMode: () => RecordMode,
|
|
5282
5126
|
Recorder: () => Recorder,
|
|
5283
|
-
RefundClient: () => RefundClient,
|
|
5284
|
-
RefundReason: () => RefundReason,
|
|
5285
|
-
RefundStatus: () => RefundStatus,
|
|
5286
5127
|
SettlementMode: () => SettlementMode,
|
|
5287
5128
|
SiglumeAPIError: () => SiglumeAPIError,
|
|
5288
5129
|
SiglumeAssistError: () => SiglumeAssistError,
|
|
@@ -6586,42 +6427,6 @@ function toRecord3(value) {
|
|
|
6586
6427
|
init_metering();
|
|
6587
6428
|
init_operations();
|
|
6588
6429
|
|
|
6589
|
-
// src/refunds.ts
|
|
6590
|
-
init_client();
|
|
6591
|
-
var RefundClient = class {
|
|
6592
|
-
client;
|
|
6593
|
-
constructor(options) {
|
|
6594
|
-
this.client = new SiglumeClient(options);
|
|
6595
|
-
}
|
|
6596
|
-
close() {
|
|
6597
|
-
this.client.close();
|
|
6598
|
-
}
|
|
6599
|
-
async issue_partial_refund(options) {
|
|
6600
|
-
return this.client.issue_partial_refund(options);
|
|
6601
|
-
}
|
|
6602
|
-
async issue_full_refund(options) {
|
|
6603
|
-
return this.client.issue_full_refund(options);
|
|
6604
|
-
}
|
|
6605
|
-
async list_refunds(options = {}) {
|
|
6606
|
-
return this.client.list_refunds(options);
|
|
6607
|
-
}
|
|
6608
|
-
async get_refund(refund_id) {
|
|
6609
|
-
return this.client.get_refund(refund_id);
|
|
6610
|
-
}
|
|
6611
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
6612
|
-
return this.client.get_refunds_for_receipt(receipt_id, options);
|
|
6613
|
-
}
|
|
6614
|
-
async list_disputes(options = {}) {
|
|
6615
|
-
return this.client.list_disputes(options);
|
|
6616
|
-
}
|
|
6617
|
-
async get_dispute(dispute_id) {
|
|
6618
|
-
return this.client.get_dispute(dispute_id);
|
|
6619
|
-
}
|
|
6620
|
-
async respond_to_dispute(options) {
|
|
6621
|
-
return this.client.respond_to_dispute(options);
|
|
6622
|
-
}
|
|
6623
|
-
};
|
|
6624
|
-
|
|
6625
6430
|
// src/types.ts
|
|
6626
6431
|
var PermissionClass = {
|
|
6627
6432
|
READ_ONLY: "read-only",
|
|
@@ -6675,26 +6480,6 @@ var SettlementMode = {
|
|
|
6675
6480
|
POLYGON_MANDATE: "polygon_mandate",
|
|
6676
6481
|
EMBEDDED_WALLET_CHARGE: "embedded_wallet_charge"
|
|
6677
6482
|
};
|
|
6678
|
-
var RefundReason = {
|
|
6679
|
-
CUSTOMER_REQUEST: "customer-request",
|
|
6680
|
-
DUPLICATE: "duplicate",
|
|
6681
|
-
FRAUDULENT: "fraudulent",
|
|
6682
|
-
SERVICE_FAILURE: "service-failure",
|
|
6683
|
-
GOODWILL: "goodwill"
|
|
6684
|
-
};
|
|
6685
|
-
var DisputeResponse = {
|
|
6686
|
-
ACCEPT: "accept",
|
|
6687
|
-
CONTEST: "contest"
|
|
6688
|
-
};
|
|
6689
|
-
var RefundStatus = {
|
|
6690
|
-
ISSUED: "issued",
|
|
6691
|
-
FAILED: "failed"
|
|
6692
|
-
};
|
|
6693
|
-
var DisputeStatus = {
|
|
6694
|
-
OPEN: "open",
|
|
6695
|
-
ACCEPTED: "accepted",
|
|
6696
|
-
CONTESTED: "contested"
|
|
6697
|
-
};
|
|
6698
6483
|
|
|
6699
6484
|
// src/testing/recorder.ts
|
|
6700
6485
|
var CASSETTE_VERSION = 1;
|