@siglume/api-sdk 0.7.5 → 0.8.0

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/dist/index.cjs CHANGED
@@ -1663,6 +1663,9 @@ function parseListing(data) {
1663
1663
  short_description: stringOrNull2(data.short_description),
1664
1664
  docs_url: stringOrNull2(data.docs_url),
1665
1665
  support_contact: stringOrNull2(data.support_contact),
1666
+ seller_display_name: stringOrNull2(data.seller_display_name),
1667
+ seller_homepage_url: stringOrNull2(data.seller_homepage_url),
1668
+ seller_social_url: stringOrNull2(data.seller_social_url),
1666
1669
  review_status: stringOrNull2(data.review_status),
1667
1670
  review_note: stringOrNull2(data.review_note),
1668
1671
  submission_blockers: Array.isArray(data.submission_blockers) ? data.submission_blockers.filter((item) => typeof item === "string") : [],
@@ -2844,11 +2847,15 @@ var init_client = __esm({
2844
2847
  max_retries;
2845
2848
  fetchImpl;
2846
2849
  pendingConfirmations = /* @__PURE__ */ new Map();
2847
- constructor(options) {
2848
- if (!options.api_key) {
2849
- throw new SiglumeClientError("SIGLUME_API_KEY is required.");
2850
+ constructor(options = {}) {
2851
+ const envApiKey = typeof process !== "undefined" ? process.env?.SIGLUME_API_KEY : void 0;
2852
+ const resolvedApiKey = (options.api_key ?? envApiKey ?? "").trim();
2853
+ if (!resolvedApiKey) {
2854
+ throw new SiglumeClientError(
2855
+ "SIGLUME_API_KEY is required. Pass it as the api_key option or set the SIGLUME_API_KEY env var."
2856
+ );
2850
2857
  }
2851
- this.api_key = options.api_key;
2858
+ this.api_key = resolvedApiKey;
2852
2859
  this.agent_key = options.agent_key?.trim() || void 0;
2853
2860
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
2854
2861
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
@@ -2875,6 +2882,13 @@ var init_client = __esm({
2875
2882
  if (options.runtime_validation) {
2876
2883
  payload.runtime_validation = coerceMapping(options.runtime_validation, "runtime_validation");
2877
2884
  }
2885
+ if (options.oauth_credentials) {
2886
+ payload.oauth_credentials = Array.isArray(options.oauth_credentials) ? {
2887
+ items: options.oauth_credentials.map(
2888
+ (item, index) => coerceMapping(item, `oauth_credentials[${index}]`)
2889
+ )
2890
+ } : coerceMapping(options.oauth_credentials, "oauth_credentials");
2891
+ }
2878
2892
  if (options.metadata) {
2879
2893
  payload.metadata = coerceMapping(options.metadata, "metadata");
2880
2894
  }
@@ -2893,6 +2907,8 @@ var init_client = __esm({
2893
2907
  "docs_url",
2894
2908
  "documentation_url",
2895
2909
  "support_contact",
2910
+ "seller_homepage_url",
2911
+ "seller_social_url",
2896
2912
  "jurisdiction",
2897
2913
  "price_model",
2898
2914
  "price_value_minor",
@@ -2908,10 +2924,14 @@ var init_client = __esm({
2908
2924
  }
2909
2925
  const docsUrl = String(manifestPayload.docs_url ?? manifestPayload.documentation_url ?? "").trim();
2910
2926
  const supportContact = String(manifestPayload.support_contact ?? "").trim();
2911
- if (docsUrl || supportContact) {
2927
+ const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
2928
+ const sellerSocialUrl = String(manifestPayload.seller_social_url ?? "").trim();
2929
+ if (docsUrl || supportContact || sellerHomepageUrl || sellerSocialUrl) {
2912
2930
  const publisherIdentity = {
2913
2931
  documentation_url: docsUrl || null,
2914
- support_contact: supportContact || null
2932
+ support_contact: supportContact || null,
2933
+ seller_homepage_url: sellerHomepageUrl || null,
2934
+ seller_social_url: sellerSocialUrl || null
2915
2935
  };
2916
2936
  payload.publisher_identity = publisherIdentity;
2917
2937
  payload.legal = { publisher_identity: publisherIdentity };
@@ -2925,36 +2945,30 @@ var init_client = __esm({
2925
2945
  return {
2926
2946
  listing_id,
2927
2947
  status: String(data.status ?? "draft"),
2948
+ registration_mode: stringOrNull2(data.registration_mode),
2949
+ listing_status: stringOrNull2(data.listing_status),
2928
2950
  auto_manifest: toRecord2(data.auto_manifest),
2929
2951
  confidence: toRecord2(data.confidence),
2930
2952
  validation_report: toRecord2(data.validation_report),
2953
+ oauth_status: toRecord2(data.oauth_status),
2931
2954
  review_url: stringOrNull2(data.review_url),
2932
2955
  trace_id: meta.trace_id,
2933
2956
  request_id: meta.request_id
2934
2957
  };
2935
2958
  }
2936
2959
  async confirm_registration(listing_id, options = {}) {
2937
- const pending = this.pendingConfirmations.get(listing_id);
2938
- const manifestPayload = options.manifest ? coerceMapping(options.manifest, "manifest") : pending?.manifest ?? {};
2939
- const toolManualPayload = options.tool_manual ? coerceMapping(options.tool_manual, "tool_manual") : pending?.tool_manual ?? {};
2940
- const overrides = {};
2941
- for (const fieldName of ["name", "job_to_be_done"]) {
2942
- if (manifestPayload[fieldName]) {
2943
- overrides[fieldName] = manifestPayload[fieldName];
2944
- }
2945
- }
2946
- if (Object.keys(toolManualPayload).length > 0) {
2947
- overrides.tool_manual = toolManualPayload;
2948
- }
2960
+ void options;
2949
2961
  const payload = { approved: true };
2950
- if (Object.keys(overrides).length > 0) {
2951
- payload.overrides = overrides;
2952
- }
2953
2962
  const [data, meta] = await this.request("POST", `/market/capabilities/${listing_id}/confirm-auto-register`, { json_body: payload });
2954
2963
  this.pendingConfirmations.delete(listing_id);
2964
+ const checklist = isRecord2(data.checklist) ? Object.fromEntries(
2965
+ Object.entries(data.checklist).map(([key, value]) => [key, Boolean(value)])
2966
+ ) : {};
2955
2967
  return {
2956
2968
  listing_id: String(data.listing_id ?? listing_id),
2957
2969
  status: String(data.status ?? ""),
2970
+ message: stringOrNull2(data.message),
2971
+ checklist,
2958
2972
  release: toRecord2(data.release),
2959
2973
  quality: parseRegistrationQuality(toRecord2(data.quality)),
2960
2974
  trace_id: meta.trace_id,
@@ -4911,7 +4925,7 @@ ${details}` : summary;
4911
4925
  const headers = new Headers({
4912
4926
  Authorization: `Bearer ${this.api_key}`,
4913
4927
  Accept: "application/json",
4914
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4928
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4915
4929
  });
4916
4930
  if (options.headers) {
4917
4931
  for (const [key, value] of Object.entries(options.headers)) {
@@ -5113,7 +5127,7 @@ var init_metering = __esm({
5113
5127
  fetchImpl;
5114
5128
  constructor(options) {
5115
5129
  this.client = new SiglumeClient(options);
5116
- this.api_key = options.api_key;
5130
+ this.api_key = this.client.api_key;
5117
5131
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
5118
5132
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
5119
5133
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -5159,7 +5173,7 @@ var init_metering = __esm({
5159
5173
  const headers = new Headers({
5160
5174
  Authorization: `Bearer ${this.api_key}`,
5161
5175
  Accept: "application/json",
5162
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
5176
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
5163
5177
  });
5164
5178
  let body;
5165
5179
  if (options.json_body) {
@@ -5351,7 +5365,7 @@ var SiglumeBuyerClient = class {
5351
5365
  warnedFeatures = /* @__PURE__ */ new Set();
5352
5366
  constructor(options) {
5353
5367
  this.client = new SiglumeClient(options);
5354
- this.api_key = options.api_key;
5368
+ this.api_key = this.client.api_key;
5355
5369
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
5356
5370
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
5357
5371
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -5528,7 +5542,7 @@ var SiglumeBuyerClient = class {
5528
5542
  const headers = new Headers({
5529
5543
  Authorization: `Bearer ${this.api_key}`,
5530
5544
  Accept: "application/json",
5531
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
5545
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
5532
5546
  });
5533
5547
  let body;
5534
5548
  if (options.json_body) {