@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 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.7.6 release line.
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
@@ -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
  }
@@ -2591,6 +2530,7 @@ var init_client = __esm({
2591
2530
  "name",
2592
2531
  "job_to_be_done",
2593
2532
  "short_description",
2533
+ "description",
2594
2534
  "category",
2595
2535
  "docs_url",
2596
2536
  "documentation_url",
@@ -2603,13 +2543,18 @@ var init_client = __esm({
2603
2543
  "permission_class",
2604
2544
  "approval_mode",
2605
2545
  "dry_run_supported",
2606
- "required_connected_accounts"
2546
+ "required_connected_accounts",
2547
+ "permission_scopes",
2548
+ "compatibility_tags"
2607
2549
  ]) {
2608
2550
  const value = manifestPayload[fieldName];
2609
2551
  if (value !== void 0 && value !== null) {
2610
2552
  payload[fieldName] = value;
2611
2553
  }
2612
2554
  }
2555
+ if (payload.manifest && typeof payload.manifest === "object") {
2556
+ delete payload.manifest.version;
2557
+ }
2613
2558
  const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
2614
2559
  const supportContact = String(manifestPayload.support_contact ?? "").trim();
2615
2560
  const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
@@ -4224,105 +4169,6 @@ ${details}` : summary;
4224
4169
  fetchNext: next_cursor ? (cursor) => this.list_support_cases({ ...options, cursor }) : void 0
4225
4170
  });
4226
4171
  }
4227
- async issue_partial_refund(options) {
4228
- const receipt_id = String(options.receipt_id ?? "").trim();
4229
- const idempotency_key = String(options.idempotency_key ?? "").trim();
4230
- if (!receipt_id) {
4231
- throw new SiglumeClientError("receipt_id is required.");
4232
- }
4233
- if (!idempotency_key) {
4234
- throw new SiglumeClientError("idempotency_key is required.");
4235
- }
4236
- if (!Number.isFinite(options.amount_minor)) {
4237
- throw new SiglumeClientError("amount_minor must be a finite number.");
4238
- }
4239
- const amount_minor = Math.trunc(options.amount_minor);
4240
- if (amount_minor <= 0) {
4241
- throw new SiglumeClientError("amount_minor must be positive.");
4242
- }
4243
- if (typeof options.original_amount_minor === "number" && amount_minor > Math.trunc(options.original_amount_minor)) {
4244
- throw new SiglumeClientError("amount_minor cannot exceed the original receipt amount.");
4245
- }
4246
- const [data] = await this.request("POST", "/market/refunds", {
4247
- json_body: {
4248
- receipt_id,
4249
- amount_minor,
4250
- reason_code: options.reason ?? "customer-request",
4251
- note: options.note,
4252
- idempotency_key
4253
- }
4254
- });
4255
- return parseRefund(data);
4256
- }
4257
- async issue_full_refund(options) {
4258
- const receipt_id = String(options.receipt_id ?? "").trim();
4259
- if (!receipt_id) {
4260
- throw new SiglumeClientError("receipt_id is required.");
4261
- }
4262
- const provided_key = String(options.idempotency_key ?? "").trim();
4263
- const idempotency_key = provided_key || `full-refund:${receipt_id}`;
4264
- const [data] = await this.request("POST", "/market/refunds", {
4265
- json_body: {
4266
- receipt_id,
4267
- reason_code: options.reason ?? "customer-request",
4268
- note: options.note,
4269
- idempotency_key
4270
- }
4271
- });
4272
- return parseRefund(data);
4273
- }
4274
- async list_refunds(options = {}) {
4275
- const [data] = await this.requestAny("GET", "/market/refunds", {
4276
- params: {
4277
- receipt_id: options.receipt_id,
4278
- limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
4279
- }
4280
- });
4281
- if (!Array.isArray(data)) {
4282
- throw new SiglumeClientError("Expected refunds to be returned as an array.");
4283
- }
4284
- return data.filter((item) => isRecord(item)).map(parseRefund);
4285
- }
4286
- async get_refund(refund_id) {
4287
- const [data] = await this.request("GET", `/market/refunds/${refund_id}`);
4288
- return parseRefund(data);
4289
- }
4290
- async get_refunds_for_receipt(receipt_id, options = {}) {
4291
- return this.list_refunds({ receipt_id, limit: options.limit });
4292
- }
4293
- async list_disputes(options = {}) {
4294
- const [data] = await this.requestAny("GET", "/market/disputes", {
4295
- params: {
4296
- receipt_id: options.receipt_id,
4297
- limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100))
4298
- }
4299
- });
4300
- if (!Array.isArray(data)) {
4301
- throw new SiglumeClientError("Expected disputes to be returned as an array.");
4302
- }
4303
- return data.filter((item) => isRecord(item)).map(parseDispute);
4304
- }
4305
- async get_dispute(dispute_id) {
4306
- const [data] = await this.request("GET", `/market/disputes/${dispute_id}`);
4307
- return parseDispute(data);
4308
- }
4309
- async respond_to_dispute(options) {
4310
- const dispute_id = String(options.dispute_id ?? "").trim();
4311
- if (!dispute_id) {
4312
- throw new SiglumeClientError("dispute_id is required.");
4313
- }
4314
- if (!isRecord(options.evidence)) {
4315
- throw new SiglumeClientError("evidence must be an object.");
4316
- }
4317
- const [data] = await this.request("POST", `/market/disputes/${dispute_id}/respond`, {
4318
- json_body: {
4319
- response: options.response,
4320
- evidence: toRecord(options.evidence),
4321
- note: options.note
4322
- }
4323
- });
4324
- return parseDispute(data);
4325
- }
4326
4172
  async create_webhook_subscription(options) {
4327
4173
  const normalizedEventTypes = options.event_types.map((item) => String(item).trim()).filter((item) => item.length > 0);
4328
4174
  if (normalizedEventTypes.length === 0) {