@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/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript runtime for building, testing, and registering Siglume developer apps.
|
|
4
4
|
|
|
5
|
-
This package is prepared in the public SDK repo and ships with the current v0.
|
|
5
|
+
This package is prepared in the public SDK repo and ships with the current v0.10.x release line.
|
|
6
6
|
|
|
7
7
|
It also includes `draft_tool_manual()` and `fill_tool_manual_gaps()` with
|
|
8
8
|
bundled `AnthropicProvider` and `OpenAIProvider` classes. Provide
|
package/dist/bin/siglume.cjs
CHANGED
|
@@ -140,18 +140,6 @@ function camelCaseFromCapabilityKey(capabilityKey) {
|
|
|
140
140
|
}
|
|
141
141
|
return `${words.map((word) => word[0].toUpperCase() + word.slice(1)).join("")}App`;
|
|
142
142
|
}
|
|
143
|
-
function buildDefaultI18n(manifestPayload) {
|
|
144
|
-
const job = String(manifestPayload.job_to_be_done ?? "").trim();
|
|
145
|
-
const shortDescription = String(
|
|
146
|
-
manifestPayload.short_description ?? manifestPayload.job_to_be_done ?? manifestPayload.name ?? ""
|
|
147
|
-
).trim();
|
|
148
|
-
return {
|
|
149
|
-
job_to_be_done_en: job,
|
|
150
|
-
job_to_be_done_ja: job,
|
|
151
|
-
short_description_en: shortDescription,
|
|
152
|
-
short_description_ja: shortDescription
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
143
|
function buildRegistrationStubSource(manifestPayload, toolManualPayload) {
|
|
156
144
|
const capabilityKey = String(manifestPayload.capability_key ?? "generated-registration");
|
|
157
145
|
const jobToBeDone = String(
|
|
@@ -306,10 +294,8 @@ var init_webhooks = __esm({
|
|
|
306
294
|
"subscription.cancelled",
|
|
307
295
|
"subscription.paused",
|
|
308
296
|
"subscription.reinstated",
|
|
309
|
-
"refund.issued",
|
|
310
297
|
"payment.succeeded",
|
|
311
298
|
"payment.failed",
|
|
312
|
-
"payment.disputed",
|
|
313
299
|
"capability.published",
|
|
314
300
|
"capability.delisted",
|
|
315
301
|
"execution.completed",
|
|
@@ -1349,6 +1335,7 @@ function parseListing(data) {
|
|
|
1349
1335
|
price_value_minor: Number(data.price_value_minor ?? 0),
|
|
1350
1336
|
currency: String(data.currency ?? "USD"),
|
|
1351
1337
|
short_description: stringOrNull(data.short_description),
|
|
1338
|
+
description: stringOrNull(data.description),
|
|
1352
1339
|
docs_url: stringOrNull(data.docs_url),
|
|
1353
1340
|
support_contact: stringOrNull(data.support_contact),
|
|
1354
1341
|
seller_display_name: stringOrNull(data.seller_display_name),
|
|
@@ -2427,50 +2414,6 @@ function parseMarketProposalActionResult(execution) {
|
|
|
2427
2414
|
raw: { ...execution.raw }
|
|
2428
2415
|
};
|
|
2429
2416
|
}
|
|
2430
|
-
function parseRefund(data) {
|
|
2431
|
-
return {
|
|
2432
|
-
refund_id: String(data.refund_id ?? data.id ?? ""),
|
|
2433
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2434
|
-
owner_user_id: stringOrNull(data.owner_user_id) ?? void 0,
|
|
2435
|
-
payment_mandate_id: stringOrNull(data.payment_mandate_id) ?? void 0,
|
|
2436
|
-
usage_event_id: stringOrNull(data.usage_event_id) ?? void 0,
|
|
2437
|
-
chain_receipt_id: stringOrNull(data.chain_receipt_id) ?? void 0,
|
|
2438
|
-
amount_minor: Number(data.amount_minor ?? 0),
|
|
2439
|
-
currency: String(data.currency ?? "USD"),
|
|
2440
|
-
status: String(data.status ?? "issued"),
|
|
2441
|
-
reason_code: String(data.reason_code ?? "customer-request"),
|
|
2442
|
-
note: stringOrNull(data.note) ?? void 0,
|
|
2443
|
-
idempotency_key: stringOrNull(data.idempotency_key) ?? void 0,
|
|
2444
|
-
on_chain_tx_hash: stringOrNull(data.on_chain_tx_hash) ?? void 0,
|
|
2445
|
-
metadata: toRecord(data.metadata),
|
|
2446
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2447
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2448
|
-
updated_at: stringOrNull(data.updated_at) ?? void 0,
|
|
2449
|
-
raw: { ...data }
|
|
2450
|
-
};
|
|
2451
|
-
}
|
|
2452
|
-
function parseDispute(data) {
|
|
2453
|
-
return {
|
|
2454
|
-
dispute_id: String(data.dispute_id ?? data.id ?? ""),
|
|
2455
|
-
receipt_id: String(data.receipt_id ?? ""),
|
|
2456
|
-
owner_user_id: stringOrNull(data.owner_user_id) ?? void 0,
|
|
2457
|
-
payment_mandate_id: stringOrNull(data.payment_mandate_id) ?? void 0,
|
|
2458
|
-
usage_event_id: stringOrNull(data.usage_event_id) ?? void 0,
|
|
2459
|
-
external_dispute_id: stringOrNull(data.external_dispute_id) ?? void 0,
|
|
2460
|
-
status: String(data.status ?? "open"),
|
|
2461
|
-
reason_code: String(data.reason_code ?? "manual-review"),
|
|
2462
|
-
description: stringOrNull(data.description) ?? void 0,
|
|
2463
|
-
evidence: toRecord(data.evidence),
|
|
2464
|
-
response_decision: stringOrNull(data.response_decision) ?? void 0,
|
|
2465
|
-
response_note: stringOrNull(data.response_note) ?? void 0,
|
|
2466
|
-
responded_at: stringOrNull(data.responded_at) ?? void 0,
|
|
2467
|
-
metadata: toRecord(data.metadata),
|
|
2468
|
-
idempotent_replay: Boolean(data.idempotent_replay ?? false),
|
|
2469
|
-
created_at: stringOrNull(data.created_at) ?? void 0,
|
|
2470
|
-
updated_at: stringOrNull(data.updated_at) ?? void 0,
|
|
2471
|
-
raw: { ...data }
|
|
2472
|
-
};
|
|
2473
|
-
}
|
|
2474
2417
|
function cloneJsonLike(value) {
|
|
2475
2418
|
if (Array.isArray(value)) {
|
|
2476
2419
|
return value.map((item) => cloneJsonLike(item));
|
|
@@ -2556,7 +2499,6 @@ var init_client = __esm({
|
|
|
2556
2499
|
const manifestPayload = coerceMapping(manifest, "manifest");
|
|
2557
2500
|
const toolManualPayload = coerceMapping(tool_manual, "tool_manual");
|
|
2558
2501
|
const payload = {
|
|
2559
|
-
i18n: buildDefaultI18n(manifestPayload),
|
|
2560
2502
|
manifest: { ...manifestPayload },
|
|
2561
2503
|
tool_manual: { ...toolManualPayload }
|
|
2562
2504
|
};
|
|
@@ -2577,9 +2519,6 @@ var init_client = __esm({
|
|
|
2577
2519
|
)
|
|
2578
2520
|
} : coerceMapping(options.oauth_credentials, "oauth_credentials");
|
|
2579
2521
|
}
|
|
2580
|
-
if (options.metadata) {
|
|
2581
|
-
payload.metadata = coerceMapping(options.metadata, "metadata");
|
|
2582
|
-
}
|
|
2583
2522
|
if (options.source_context) {
|
|
2584
2523
|
payload.source_context = coerceMapping(options.source_context, "source_context");
|
|
2585
2524
|
}
|
|
@@ -4230,105 +4169,6 @@ ${details}` : summary;
|
|
|
4230
4169
|
fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
|
|
4231
4170
|
});
|
|
4232
4171
|
}
|
|
4233
|
-
async issue_partial_refund(options) {
|
|
4234
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4235
|
-
const idempotency_key = String(options.idempotency_key ?? "").trim();
|
|
4236
|
-
if (!receipt_id) {
|
|
4237
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4238
|
-
}
|
|
4239
|
-
if (!idempotency_key) {
|
|
4240
|
-
throw new SiglumeClientError("idempotency_key is required.");
|
|
4241
|
-
}
|
|
4242
|
-
if (!Number.isFinite(options.amount_minor)) {
|
|
4243
|
-
throw new SiglumeClientError("amount_minor must be a finite number.");
|
|
4244
|
-
}
|
|
4245
|
-
const amount_minor = Math.trunc(options.amount_minor);
|
|
4246
|
-
if (amount_minor <= 0) {
|
|
4247
|
-
throw new SiglumeClientError("amount_minor must be positive.");
|
|
4248
|
-
}
|
|
4249
|
-
if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
|
|
4250
|
-
throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
|
|
4251
|
-
}
|
|
4252
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4253
|
-
json_body: {
|
|
4254
|
-
receipt_id,
|
|
4255
|
-
amount_minor,
|
|
4256
|
-
reason_code: options.reason ?? "customer-request",
|
|
4257
|
-
note: options.note,
|
|
4258
|
-
idempotency_key
|
|
4259
|
-
}
|
|
4260
|
-
});
|
|
4261
|
-
return parseRefund(data);
|
|
4262
|
-
}
|
|
4263
|
-
async issue_full_refund(options) {
|
|
4264
|
-
const receipt_id = String(options.receipt_id ?? "").trim();
|
|
4265
|
-
if (!receipt_id) {
|
|
4266
|
-
throw new SiglumeClientError("receipt_id is required.");
|
|
4267
|
-
}
|
|
4268
|
-
const provided_key = String(options.idempotency_key ?? "").trim();
|
|
4269
|
-
const idempotency_key = provided_key || `full-refund:${receipt_id}`;
|
|
4270
|
-
const [data] = await this.request("POST", "/market/refunds", {
|
|
4271
|
-
json_body: {
|
|
4272
|
-
receipt_id,
|
|
4273
|
-
reason_code: options.reason ?? "customer-request",
|
|
4274
|
-
note: options.note,
|
|
4275
|
-
idempotency_key
|
|
4276
|
-
}
|
|
4277
|
-
});
|
|
4278
|
-
return parseRefund(data);
|
|
4279
|
-
}
|
|
4280
|
-
async list_refunds(options = {}) {
|
|
4281
|
-
const [data] = await this.requestAny("GET", "/market/refunds", {
|
|
4282
|
-
params: {
|
|
4283
|
-
receipt_id: options.receipt_id,
|
|
4284
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4285
|
-
}
|
|
4286
|
-
});
|
|
4287
|
-
if (!Array.isArray(data)) {
|
|
4288
|
-
throw new SiglumeClientError("Expected refunds to be returned as an array.");
|
|
4289
|
-
}
|
|
4290
|
-
return data.filter((item) => isRecord(item)).map(parseRefund);
|
|
4291
|
-
}
|
|
4292
|
-
async get_refund(refund_id) {
|
|
4293
|
-
const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
|
|
4294
|
-
return parseRefund(data);
|
|
4295
|
-
}
|
|
4296
|
-
async get_refunds_for_receipt(receipt_id, options = {}) {
|
|
4297
|
-
return this.list_refunds({ receipt_id, limit: options.limit });
|
|
4298
|
-
}
|
|
4299
|
-
async list_disputes(options = {}) {
|
|
4300
|
-
const [data] = await this.requestAny("GET", "/market/disputes", {
|
|
4301
|
-
params: {
|
|
4302
|
-
receipt_id: options.receipt_id,
|
|
4303
|
-
limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
|
|
4304
|
-
}
|
|
4305
|
-
});
|
|
4306
|
-
if (!Array.isArray(data)) {
|
|
4307
|
-
throw new SiglumeClientError("Expected disputes to be returned as an array.");
|
|
4308
|
-
}
|
|
4309
|
-
return data.filter((item) => isRecord(item)).map(parseDispute);
|
|
4310
|
-
}
|
|
4311
|
-
async get_dispute(dispute_id) {
|
|
4312
|
-
const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
|
|
4313
|
-
return parseDispute(data);
|
|
4314
|
-
}
|
|
4315
|
-
async respond_to_dispute(options) {
|
|
4316
|
-
const dispute_id = String(options.dispute_id ?? "").trim();
|
|
4317
|
-
if (!dispute_id) {
|
|
4318
|
-
throw new SiglumeClientError("dispute_id is required.");
|
|
4319
|
-
}
|
|
4320
|
-
if (!isRecord(options.evidence)) {
|
|
4321
|
-
throw new SiglumeClientError("evidence must be an object.");
|
|
4322
|
-
}
|
|
4323
|
-
const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
|
|
4324
|
-
json_body: {
|
|
4325
|
-
response: options.response,
|
|
4326
|
-
evidence: toRecord(options.evidence),
|
|
4327
|
-
note: options.note
|
|
4328
|
-
}
|
|
4329
|
-
});
|
|
4330
|
-
return parseDispute(data);
|
|
4331
|
-
}
|
|
4332
4172
|
async create_webhook_subscription(options) {
|
|
4333
4173
|
const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
|
|
4334
4174
|
if (normalizedEventTypes.length === 0) {
|