@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/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
|
}
|
|
@@ -4231,105 +4170,6 @@ ${details}` : summary;
|
|
|
4231
4170
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4232
4171
|
});
|
|
4233
4172
|
}
|
|
4234
|
-
async issue_partial_refund(options) {
|
|
4235
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4236
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4237
|
-
if (!receipt_id) {
|
|
4238
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4239
|
-
}
|
|
4240
|
-
if (!idempotency_key) {
|
|
4241
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4242
|
-
}
|
|
4243
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4244
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4245
|
-
}
|
|
4246
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4247
|
-
if (amount_minor <= 0) {
|
|
4248
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4249
|
-
}
|
|
4250
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4251
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4252
|
-
}
|
|
4253
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4254
|
-
json_body: {
|
|
4255
|
-
receipt_id,
|
|
4256
|
-
amount_minor,
|
|
4257
|
-
reason_code: options.reason ?? "customer-request",
|
|
4258
|
-
note: options.note,
|
|
4259
|
-
idempotency_key
|
|
4260
|
-
}
|
|
4261
|
-
});
|
|
4262
|
-
return parseRefund(data);
|
|
4263
|
-
}
|
|
4264
|
-
async issue_full_refund(options) {
|
|
4265
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4266
|
-
if (!receipt_id) {
|
|
4267
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4268
|
-
}
|
|
4269
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4270
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4271
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4272
|
-
json_body: {
|
|
4273
|
-
receipt_id,
|
|
4274
|
-
reason_code: options.reason ?? "customer-request",
|
|
4275
|
-
note: options.note,
|
|
4276
|
-
idempotency_key
|
|
4277
|
-
}
|
|
4278
|
-
});
|
|
4279
|
-
return parseRefund(data);
|
|
4280
|
-
}
|
|
4281
|
-
async list_refunds(options = {}) {
|
|
4282
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4283
|
-
params: {
|
|
4284
|
-
receipt_id: options.receipt_id,
|
|
4285
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4286
|
-
}
|
|
4287
|
-
});
|
|
4288
|
-
if (!Array.isArray(data)) {
|
|
4289
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4290
|
-
}
|
|
4291
|
-
return data.filter((item) => isRecord(item)).map(parseRefund);
|
|
4292
|
-
}
|
|
4293
|
-
async get_refund(refund_id) {
|
|
4294
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4295
|
-
return parseRefund(data);
|
|
4296
|
-
}
|
|
4297
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4298
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4299
|
-
}
|
|
4300
|
-
async list_disputes(options = {}) {
|
|
4301
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4302
|
-
params: {
|
|
4303
|
-
receipt_id: options.receipt_id,
|
|
4304
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4305
|
-
}
|
|
4306
|
-
});
|
|
4307
|
-
if (!Array.isArray(data)) {
|
|
4308
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4309
|
-
}
|
|
4310
|
-
return data.filter((item) => isRecord(item)).map(parseDispute);
|
|
4311
|
-
}
|
|
4312
|
-
async get_dispute(dispute_id) {
|
|
4313
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4314
|
-
return parseDispute(data);
|
|
4315
|
-
}
|
|
4316
|
-
async respond_to_dispute(options) {
|
|
4317
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4318
|
-
if (!dispute_id) {
|
|
4319
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4320
|
-
}
|
|
4321
|
-
if (!isRecord(options.evidence)) {
|
|
4322
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4323
|
-
}
|
|
4324
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4325
|
-
json_body: {
|
|
4326
|
-
response: options.response,
|
|
4327
|
-
evidence: toRecord(options.evidence),
|
|
4328
|
-
note: options.note
|
|
4329
|
-
}
|
|
4330
|
-
});
|
|
4331
|
-
return parseDispute(data);
|
|
4332
|
-
}
|
|
4333
4173
|
async create_webhook_subscription(options) {
|
|
4334
4174
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4335
4175
|
if (normalizedEventTypes.length === 0) {
|