@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/cli/index.cjs
CHANGED
|
@@ -141,18 +141,6 @@ function camelCaseFromCapabilityKey(capabilityKey) {
|
|
|
141
141
|
}
|
|
142
142
|
return `${words.map((word) => word[0].toUpperCase() + word.slice(1)).join("")}App`;
|
|
143
143
|
}
|
|
144
|
-
function buildDefaultI18n(manifestPayload) {
|
|
145
|
-
const job = String(manifestPayload.job_to_be_done ?? "").trim();
|
|
146
|
-
const shortDescription = String(
|
|
147
|
-
manifestPayload.short_description ?? manifestPayload.job_to_be_done ?? manifestPayload.name ?? ""
|
|
148
|
-
).trim();
|
|
149
|
-
return {
|
|
150
|
-
job_to_be_done_en: job,
|
|
151
|
-
job_to_be_done_ja: job,
|
|
152
|
-
short_description_en: shortDescription,
|
|
153
|
-
short_description_ja: shortDescription
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
144
|
function buildRegistrationStubSource(manifestPayload, toolManualPayload) {
|
|
157
145
|
const capabilityKey = String(manifestPayload.capability_key ?? "generated-registration");
|
|
158
146
|
const jobToBeDone = String(
|
|
@@ -307,10 +295,8 @@ var init_webhooks = __esm({
|
|
|
307
295
|
"subscription.cancelled",
|
|
308
296
|
"subscription.paused",
|
|
309
297
|
"subscription.reinstated",
|
|
310
|
-
"refund.issued",
|
|
311
298
|
"payment.succeeded",
|
|
312
299
|
"payment.failed",
|
|
313
|
-
"payment.disputed",
|
|
314
300
|
"capability.published",
|
|
315
301
|
"capability.delisted",
|
|
316
302
|
"execution.completed",
|
|
@@ -1350,6 +1336,7 @@ function parseListing(data) {
|
|
|
1350
1336
|
price_value_minor: Number(data.price_value_minor ?? 0),
|
|
1351
1337
|
currency: String(data.currency ?? "USD"),
|
|
1352
1338
|
short_description: stringOrNull(data.short_description),
|
|
1339
|
+
description: stringOrNull(data.description),
|
|
1353
1340
|
docs_url: stringOrNull(data.docs_url),
|
|
1354
1341
|
support_contact: stringOrNull(data.support_contact),
|
|
1355
1342
|
seller_display_name: stringOrNull(data.seller_display_name),
|
|
@@ -2428,50 +2415,6 @@ function parseMarketProposalActionResult(execution) {
|
|
|
2428
2415
|
raw: { ...execution.raw }
|
|
2429
2416
|
};
|
|
2430
2417
|
}
|
|
2431
|
-
function parseRefund(data) {
|
|
2432
|
-
return {
|
|
2433
|
-
refund_id: String(data.refund_id ?? data.id ?? ""),
|
|
2434
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2435
|
-
owner_user_id: stringOrNull(data.owner_user_id) ?? void 0,
|
|
2436
|
-
payment_mandate_id: stringOrNull(data.payment_mandate_id) ?? void 0,
|
|
2437
|
-
usage_event_id: stringOrNull(data.usage_event_id) ?? void 0,
|
|
2438
|
-
chain_receipt_id: stringOrNull(data.chain_receipt_id) ?? void 0,
|
|
2439
|
-
amount_minor: Number(data.amount_minor ?? 0),
|
|
2440
|
-
currency: String(data.currency ?? "USD"),
|
|
2441
|
-
status: String(data.status ?? "issued"),
|
|
2442
|
-
reason_code: String(data.reason_code ?? "customer-request"),
|
|
2443
|
-
note: stringOrNull(data.note) ?? void 0,
|
|
2444
|
-
idempotency_key: stringOrNull(data.idempotency_key) ?? void 0,
|
|
2445
|
-
on_chain_tx_hash: stringOrNull(data.on_chain_tx_hash) ?? void 0,
|
|
2446
|
-
metadata: toRecord(data.metadata),
|
|
2447
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2448
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2449
|
-
updated_at: stringOrNull(data.updated_at) ?? void 0,
|
|
2450
|
-
raw: { ...data }
|
|
2451
|
-
};
|
|
2452
|
-
}
|
|
2453
|
-
function parseDispute(data) {
|
|
2454
|
-
return {
|
|
2455
|
-
dispute_id: String(data.dispute_id ?? data.id ?? ""),
|
|
2456
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2457
|
-
owner_user_id: stringOrNull(data.owner_user_id) ?? void 0,
|
|
2458
|
-
payment_mandate_id: stringOrNull(data.payment_mandate_id) ?? void 0,
|
|
2459
|
-
usage_event_id: stringOrNull(data.usage_event_id) ?? void 0,
|
|
2460
|
-
external_dispute_id: stringOrNull(data.external_dispute_id) ?? void 0,
|
|
2461
|
-
status: String(data.status ?? "open"),
|
|
2462
|
-
reason_code: String(data.reason_code ?? "manual-review"),
|
|
2463
|
-
description: stringOrNull(data.description) ?? void 0,
|
|
2464
|
-
evidence: toRecord(data.evidence),
|
|
2465
|
-
response_decision: stringOrNull(data.response_decision) ?? void 0,
|
|
2466
|
-
response_note: stringOrNull(data.response_note) ?? void 0,
|
|
2467
|
-
responded_at: stringOrNull(data.responded_at) ?? void 0,
|
|
2468
|
-
metadata: toRecord(data.metadata),
|
|
2469
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2470
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2471
|
-
updated_at: stringOrNull(data.updated_at) ?? void 0,
|
|
2472
|
-
raw: { ...data }
|
|
2473
|
-
};
|
|
2474
|
-
}
|
|
2475
2418
|
function cloneJsonLike(value) {
|
|
2476
2419
|
if (Array.isArray(value)) {
|
|
2477
2420
|
return value.map((item) => cloneJsonLike(item));
|
|
@@ -2557,7 +2500,6 @@ var init_client = __esm({
|
|
|
2557
2500
|
const manifestPayload = coerceMapping(manifest, "manifest");
|
|
2558
2501
|
const toolManualPayload = coerceMapping(tool_manual, "tool_manual");
|
|
2559
2502
|
const payload = {
|
|
2560
|
-
i18n: buildDefaultI18n(manifestPayload),
|
|
2561
2503
|
manifest: { ...manifestPayload },
|
|
2562
2504
|
tool_manual: { ...toolManualPayload }
|
|
2563
2505
|
};
|
|
@@ -2578,9 +2520,6 @@ var init_client = __esm({
|
|
|
2578
2520
|
)
|
|
2579
2521
|
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2580
2522
|
}
|
|
2581
|
-
if (options.metadata) {
|
|
2582
|
-
payload.metadata = coerceMapping(options.metadata, "metadata");
|
|
2583
|
-
}
|
|
2584
2523
|
if (options.source_context) {
|
|
2585
2524
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2586
2525
|
}
|
|
@@ -2592,6 +2531,7 @@ var init_client = __esm({
|
|
|
2592
2531
|
"name",
|
|
2593
2532
|
"job_to_be_done",
|
|
2594
2533
|
"short_description",
|
|
2534
|
+
"description",
|
|
2595
2535
|
"category",
|
|
2596
2536
|
"docs_url",
|
|
2597
2537
|
"documentation_url",
|
|
@@ -2604,13 +2544,18 @@ var init_client = __esm({
|
|
|
2604
2544
|
"permission_class",
|
|
2605
2545
|
"approval_mode",
|
|
2606
2546
|
"dry_run_supported",
|
|
2607
|
-
"required_connected_accounts"
|
|
2547
|
+
"required_connected_accounts",
|
|
2548
|
+
"permission_scopes",
|
|
2549
|
+
"compatibility_tags"
|
|
2608
2550
|
]) {
|
|
2609
2551
|
const value = manifestPayload[fieldName];
|
|
2610
2552
|
if (value !== void 0 && value !== null) {
|
|
2611
2553
|
payload[fieldName] = value;
|
|
2612
2554
|
}
|
|
2613
2555
|
}
|
|
2556
|
+
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2557
|
+
delete payload.manifest.version;
|
|
2558
|
+
}
|
|
2614
2559
|
const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
|
|
2615
2560
|
const supportContact = String(manifestPayload.support_contact ?? "").trim();
|
|
2616
2561
|
const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
|
|
@@ -4225,105 +4170,6 @@ ${details}` : summary;
|
|
|
4225
4170
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4226
4171
|
});
|
|
4227
4172
|
}
|
|
4228
|
-
async issue_partial_refund(options) {
|
|
4229
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4230
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4231
|
-
if (!receipt_id) {
|
|
4232
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4233
|
-
}
|
|
4234
|
-
if (!idempotency_key) {
|
|
4235
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4236
|
-
}
|
|
4237
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4238
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4239
|
-
}
|
|
4240
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4241
|
-
if (amount_minor <= 0) {
|
|
4242
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4243
|
-
}
|
|
4244
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4245
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4246
|
-
}
|
|
4247
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4248
|
-
json_body: {
|
|
4249
|
-
receipt_id,
|
|
4250
|
-
amount_minor,
|
|
4251
|
-
reason_code: options.reason ?? "customer-request",
|
|
4252
|
-
note: options.note,
|
|
4253
|
-
idempotency_key
|
|
4254
|
-
}
|
|
4255
|
-
});
|
|
4256
|
-
return parseRefund(data);
|
|
4257
|
-
}
|
|
4258
|
-
async issue_full_refund(options) {
|
|
4259
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4260
|
-
if (!receipt_id) {
|
|
4261
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4262
|
-
}
|
|
4263
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4264
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4265
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4266
|
-
json_body: {
|
|
4267
|
-
receipt_id,
|
|
4268
|
-
reason_code: options.reason ?? "customer-request",
|
|
4269
|
-
note: options.note,
|
|
4270
|
-
idempotency_key
|
|
4271
|
-
}
|
|
4272
|
-
});
|
|
4273
|
-
return parseRefund(data);
|
|
4274
|
-
}
|
|
4275
|
-
async list_refunds(options = {}) {
|
|
4276
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4277
|
-
params: {
|
|
4278
|
-
receipt_id: options.receipt_id,
|
|
4279
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4280
|
-
}
|
|
4281
|
-
});
|
|
4282
|
-
if (!Array.isArray(data)) {
|
|
4283
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4284
|
-
}
|
|
4285
|
-
return data.filter((item) => isRecord(item)).map(parseRefund);
|
|
4286
|
-
}
|
|
4287
|
-
async get_refund(refund_id) {
|
|
4288
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4289
|
-
return parseRefund(data);
|
|
4290
|
-
}
|
|
4291
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4292
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4293
|
-
}
|
|
4294
|
-
async list_disputes(options = {}) {
|
|
4295
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4296
|
-
params: {
|
|
4297
|
-
receipt_id: options.receipt_id,
|
|
4298
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4299
|
-
}
|
|
4300
|
-
});
|
|
4301
|
-
if (!Array.isArray(data)) {
|
|
4302
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4303
|
-
}
|
|
4304
|
-
return data.filter((item) => isRecord(item)).map(parseDispute);
|
|
4305
|
-
}
|
|
4306
|
-
async get_dispute(dispute_id) {
|
|
4307
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4308
|
-
return parseDispute(data);
|
|
4309
|
-
}
|
|
4310
|
-
async respond_to_dispute(options) {
|
|
4311
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4312
|
-
if (!dispute_id) {
|
|
4313
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4314
|
-
}
|
|
4315
|
-
if (!isRecord(options.evidence)) {
|
|
4316
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4317
|
-
}
|
|
4318
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4319
|
-
json_body: {
|
|
4320
|
-
response: options.response,
|
|
4321
|
-
evidence: toRecord(options.evidence),
|
|
4322
|
-
note: options.note
|
|
4323
|
-
}
|
|
4324
|
-
});
|
|
4325
|
-
return parseDispute(data);
|
|
4326
|
-
}
|
|
4327
4173
|
async create_webhook_subscription(options) {
|
|
4328
4174
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4329
4175
|
if (normalizedEventTypes.length === 0) {
|