@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/bin/siglume.js
CHANGED
|
@@ -119,18 +119,6 @@ function camelCaseFromCapabilityKey(capabilityKey) {
|
|
|
119
119
|
}
|
|
120
120
|
return `${words.map((word) => word[0].toUpperCase() + word.slice(1)).join("")}App`;
|
|
121
121
|
}
|
|
122
|
-
function buildDefaultI18n(manifestPayload) {
|
|
123
|
-
const job = String(manifestPayload.job_to_be_done ?? "").trim();
|
|
124
|
-
const shortDescription = String(
|
|
125
|
-
manifestPayload.short_description ?? manifestPayload.job_to_be_done ?? manifestPayload.name ?? ""
|
|
126
|
-
).trim();
|
|
127
|
-
return {
|
|
128
|
-
job_to_be_done_en: job,
|
|
129
|
-
job_to_be_done_ja: job,
|
|
130
|
-
short_description_en: shortDescription,
|
|
131
|
-
short_description_ja: shortDescription
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
122
|
function buildRegistrationStubSource(manifestPayload, toolManualPayload) {
|
|
135
123
|
const capabilityKey = String(manifestPayload.capability_key ?? "generated-registration");
|
|
136
124
|
const jobToBeDone = String(
|
|
@@ -285,10 +273,8 @@ var init_webhooks = __esm({
|
|
|
285
273
|
"subscription.cancelled",
|
|
286
274
|
"subscription.paused",
|
|
287
275
|
"subscription.reinstated",
|
|
288
|
-
"refund.issued",
|
|
289
276
|
"payment.succeeded",
|
|
290
277
|
"payment.failed",
|
|
291
|
-
"payment.disputed",
|
|
292
278
|
"capability.published",
|
|
293
279
|
"capability.delisted",
|
|
294
280
|
"execution.completed",
|
|
@@ -1328,6 +1314,7 @@ function parseListing(data) {
|
|
|
1328
1314
|
price_value_minor: Number(data.price_value_minor ?? 0),
|
|
1329
1315
|
currency: String(data.currency ?? "USD"),
|
|
1330
1316
|
short_description: stringOrNull(data.short_description),
|
|
1317
|
+
description: stringOrNull(data.description),
|
|
1331
1318
|
docs_url: stringOrNull(data.docs_url),
|
|
1332
1319
|
support_contact: stringOrNull(data.support_contact),
|
|
1333
1320
|
seller_display_name: stringOrNull(data.seller_display_name),
|
|
@@ -2406,50 +2393,6 @@ function parseMarketProposalActionResult(execution) {
|
|
|
2406
2393
|
raw: { ...execution.raw }
|
|
2407
2394
|
};
|
|
2408
2395
|
}
|
|
2409
|
-
function parseRefund(data) {
|
|
2410
|
-
return {
|
|
2411
|
-
refund_id: String(data.refund_id ?? data.id ?? ""),
|
|
2412
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2413
|
-
owner_user_id: stringOrNull(data.owner_user_id) ?? void 0,
|
|
2414
|
-
payment_mandate_id: stringOrNull(data.payment_mandate_id) ?? void 0,
|
|
2415
|
-
usage_event_id: stringOrNull(data.usage_event_id) ?? void 0,
|
|
2416
|
-
chain_receipt_id: stringOrNull(data.chain_receipt_id) ?? void 0,
|
|
2417
|
-
amount_minor: Number(data.amount_minor ?? 0),
|
|
2418
|
-
currency: String(data.currency ?? "USD"),
|
|
2419
|
-
status: String(data.status ?? "issued"),
|
|
2420
|
-
reason_code: String(data.reason_code ?? "customer-request"),
|
|
2421
|
-
note: stringOrNull(data.note) ?? void 0,
|
|
2422
|
-
idempotency_key: stringOrNull(data.idempotency_key) ?? void 0,
|
|
2423
|
-
on_chain_tx_hash: stringOrNull(data.on_chain_tx_hash) ?? void 0,
|
|
2424
|
-
metadata: toRecord(data.metadata),
|
|
2425
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2426
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2427
|
-
updated_at: stringOrNull(data.updated_at) ?? void 0,
|
|
2428
|
-
raw: { ...data }
|
|
2429
|
-
};
|
|
2430
|
-
}
|
|
2431
|
-
function parseDispute(data) {
|
|
2432
|
-
return {
|
|
2433
|
-
dispute_id: String(data.dispute_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
|
-
external_dispute_id: stringOrNull(data.external_dispute_id) ?? void 0,
|
|
2439
|
-
status: String(data.status ?? "open"),
|
|
2440
|
-
reason_code: String(data.reason_code ?? "manual-review"),
|
|
2441
|
-
description: stringOrNull(data.description) ?? void 0,
|
|
2442
|
-
evidence: toRecord(data.evidence),
|
|
2443
|
-
response_decision: stringOrNull(data.response_decision) ?? void 0,
|
|
2444
|
-
response_note: stringOrNull(data.response_note) ?? void 0,
|
|
2445
|
-
responded_at: stringOrNull(data.responded_at) ?? 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
2396
|
function cloneJsonLike(value) {
|
|
2454
2397
|
if (Array.isArray(value)) {
|
|
2455
2398
|
return value.map((item) => cloneJsonLike(item));
|
|
@@ -2535,7 +2478,6 @@ var init_client = __esm({
|
|
|
2535
2478
|
const manifestPayload = coerceMapping(manifest, "manifest");
|
|
2536
2479
|
const toolManualPayload = coerceMapping(tool_manual, "tool_manual");
|
|
2537
2480
|
const payload = {
|
|
2538
|
-
i18n: buildDefaultI18n(manifestPayload),
|
|
2539
2481
|
manifest: { ...manifestPayload },
|
|
2540
2482
|
tool_manual: { ...toolManualPayload }
|
|
2541
2483
|
};
|
|
@@ -2556,9 +2498,6 @@ var init_client = __esm({
|
|
|
2556
2498
|
)
|
|
2557
2499
|
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2558
2500
|
}
|
|
2559
|
-
if (options.metadata) {
|
|
2560
|
-
payload.metadata = coerceMapping(options.metadata, "metadata");
|
|
2561
|
-
}
|
|
2562
2501
|
if (options.source_context) {
|
|
2563
2502
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2564
2503
|
}
|
|
@@ -2570,6 +2509,7 @@ var init_client = __esm({
|
|
|
2570
2509
|
"name",
|
|
2571
2510
|
"job_to_be_done",
|
|
2572
2511
|
"short_description",
|
|
2512
|
+
"description",
|
|
2573
2513
|
"category",
|
|
2574
2514
|
"docs_url",
|
|
2575
2515
|
"documentation_url",
|
|
@@ -2582,13 +2522,18 @@ var init_client = __esm({
|
|
|
2582
2522
|
"permission_class",
|
|
2583
2523
|
"approval_mode",
|
|
2584
2524
|
"dry_run_supported",
|
|
2585
|
-
"required_connected_accounts"
|
|
2525
|
+
"required_connected_accounts",
|
|
2526
|
+
"permission_scopes",
|
|
2527
|
+
"compatibility_tags"
|
|
2586
2528
|
]) {
|
|
2587
2529
|
const value = manifestPayload[fieldName];
|
|
2588
2530
|
if (value !== void 0 && value !== null) {
|
|
2589
2531
|
payload[fieldName] = value;
|
|
2590
2532
|
}
|
|
2591
2533
|
}
|
|
2534
|
+
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2535
|
+
delete payload.manifest.version;
|
|
2536
|
+
}
|
|
2592
2537
|
const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
|
|
2593
2538
|
const supportContact = String(manifestPayload.support_contact ?? "").trim();
|
|
2594
2539
|
const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
|
|
@@ -4203,105 +4148,6 @@ ${details}` : summary;
|
|
|
4203
4148
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4204
4149
|
});
|
|
4205
4150
|
}
|
|
4206
|
-
async issue_partial_refund(options) {
|
|
4207
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4208
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4209
|
-
if (!receipt_id) {
|
|
4210
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4211
|
-
}
|
|
4212
|
-
if (!idempotency_key) {
|
|
4213
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4214
|
-
}
|
|
4215
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4216
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4217
|
-
}
|
|
4218
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4219
|
-
if (amount_minor <= 0) {
|
|
4220
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4221
|
-
}
|
|
4222
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4223
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4224
|
-
}
|
|
4225
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4226
|
-
json_body: {
|
|
4227
|
-
receipt_id,
|
|
4228
|
-
amount_minor,
|
|
4229
|
-
reason_code: options.reason ?? "customer-request",
|
|
4230
|
-
note: options.note,
|
|
4231
|
-
idempotency_key
|
|
4232
|
-
}
|
|
4233
|
-
});
|
|
4234
|
-
return parseRefund(data);
|
|
4235
|
-
}
|
|
4236
|
-
async issue_full_refund(options) {
|
|
4237
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4238
|
-
if (!receipt_id) {
|
|
4239
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4240
|
-
}
|
|
4241
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4242
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4243
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4244
|
-
json_body: {
|
|
4245
|
-
receipt_id,
|
|
4246
|
-
reason_code: options.reason ?? "customer-request",
|
|
4247
|
-
note: options.note,
|
|
4248
|
-
idempotency_key
|
|
4249
|
-
}
|
|
4250
|
-
});
|
|
4251
|
-
return parseRefund(data);
|
|
4252
|
-
}
|
|
4253
|
-
async list_refunds(options = {}) {
|
|
4254
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4255
|
-
params: {
|
|
4256
|
-
receipt_id: options.receipt_id,
|
|
4257
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4258
|
-
}
|
|
4259
|
-
});
|
|
4260
|
-
if (!Array.isArray(data)) {
|
|
4261
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4262
|
-
}
|
|
4263
|
-
return data.filter((item) => isRecord(item)).map(parseRefund);
|
|
4264
|
-
}
|
|
4265
|
-
async get_refund(refund_id) {
|
|
4266
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4267
|
-
return parseRefund(data);
|
|
4268
|
-
}
|
|
4269
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4270
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4271
|
-
}
|
|
4272
|
-
async list_disputes(options = {}) {
|
|
4273
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4274
|
-
params: {
|
|
4275
|
-
receipt_id: options.receipt_id,
|
|
4276
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4277
|
-
}
|
|
4278
|
-
});
|
|
4279
|
-
if (!Array.isArray(data)) {
|
|
4280
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4281
|
-
}
|
|
4282
|
-
return data.filter((item) => isRecord(item)).map(parseDispute);
|
|
4283
|
-
}
|
|
4284
|
-
async get_dispute(dispute_id) {
|
|
4285
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4286
|
-
return parseDispute(data);
|
|
4287
|
-
}
|
|
4288
|
-
async respond_to_dispute(options) {
|
|
4289
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4290
|
-
if (!dispute_id) {
|
|
4291
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4292
|
-
}
|
|
4293
|
-
if (!isRecord(options.evidence)) {
|
|
4294
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4295
|
-
}
|
|
4296
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4297
|
-
json_body: {
|
|
4298
|
-
response: options.response,
|
|
4299
|
-
evidence: toRecord(options.evidence),
|
|
4300
|
-
note: options.note
|
|
4301
|
-
}
|
|
4302
|
-
});
|
|
4303
|
-
return parseDispute(data);
|
|
4304
|
-
}
|
|
4305
4151
|
async create_webhook_subscription(options) {
|
|
4306
4152
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4307
4153
|
if (normalizedEventTypes.length === 0) {
|