@warmhub/sdk-ts 0.62.1 → 0.64.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.
@@ -7223,6 +7223,10 @@ function normalizeOptionalTypeSpec(spec) {
7223
7223
  }
7224
7224
  return { spec, optionalByType: false };
7225
7225
  }
7226
+ function isFieldOptional(fieldKey, typeSpec) {
7227
+ const optionalByKey = fieldKey !== void 0 && fieldKey.endsWith("?");
7228
+ return optionalByKey || normalizeOptionalTypeSpec(typeSpec).optionalByType;
7229
+ }
7226
7230
 
7227
7231
  // ../rules/src/shape-validation-runtime.ts
7228
7232
  function validateAgainstShape(data, shapeFields) {
@@ -7340,13 +7344,12 @@ function nestedObjectFields(typeDef) {
7340
7344
  }
7341
7345
  function compileObjectFields(shapeFields) {
7342
7346
  return Object.entries(shapeFields).map(([fieldSpec, rawTypeDef]) => {
7343
- const isOptionalByKey = fieldSpec.endsWith("?");
7344
- const fieldName = isOptionalByKey ? fieldSpec.slice(0, -1) : fieldSpec;
7347
+ const fieldName = fieldSpec.endsWith("?") ? fieldSpec.slice(0, -1) : fieldSpec;
7345
7348
  const normalized = normalizeOptionalTypeSpec(rawTypeDef);
7346
7349
  return {
7347
7350
  fieldName,
7348
7351
  displayName: escapeFieldNameForDisplay(fieldName),
7349
- isOptional: isOptionalByKey || normalized.optionalByType,
7352
+ isOptional: isFieldOptional(fieldSpec, rawTypeDef),
7350
7353
  validate: compileTypeValidator(normalized.spec)
7351
7354
  };
7352
7355
  });
@@ -8660,23 +8663,6 @@ async function verifyCliCall(request, secrets, opts) {
8660
8663
  args = { ...query };
8661
8664
  } else {
8662
8665
  query = {};
8663
- body = await request.text();
8664
- let parsed;
8665
- try {
8666
- parsed = JSON.parse(body);
8667
- } catch {
8668
- throw new CliCallVerificationError(
8669
- "invalid-body",
8670
- "POST body is not valid JSON"
8671
- );
8672
- }
8673
- if (!isArgsRecord(parsed)) {
8674
- throw new CliCallVerificationError(
8675
- "invalid-body",
8676
- "POST body must be a JSON object of primitive args (string / number / boolean)"
8677
- );
8678
- }
8679
- args = parsed;
8680
8666
  }
8681
8667
  if (hasSigning) {
8682
8668
  const signature = request.headers.get(CLI_SIGNATURE_HEADER);
@@ -8700,6 +8686,7 @@ async function verifyCliCall(request, secrets, opts) {
8700
8686
  `${CLI_TIMESTAMP_HEADER} must be an integer unix seconds value; got "${timestampHeader}"`
8701
8687
  );
8702
8688
  }
8689
+ body = await bodyTextForVerification(request, cliMethod, body);
8703
8690
  const verification = await verifyCliRequest({
8704
8691
  secret: secrets.CLI_SIGNING_SECRET,
8705
8692
  method: cliMethod,
@@ -8749,8 +8736,35 @@ async function verifyCliCall(request, secrets, opts) {
8749
8736
  );
8750
8737
  }
8751
8738
  }
8739
+ if (args === void 0) {
8740
+ body = await bodyTextForVerification(request, cliMethod, body);
8741
+ args = parseBodyArgs(body);
8742
+ }
8752
8743
  return { method: cliMethod, installRepo, args };
8753
8744
  }
8745
+ async function bodyTextForVerification(request, method, existing) {
8746
+ if (!cliMethodHasBody(method)) return "";
8747
+ if (existing !== void 0) return existing;
8748
+ return request.text();
8749
+ }
8750
+ function parseBodyArgs(body) {
8751
+ let parsed;
8752
+ try {
8753
+ parsed = JSON.parse(body);
8754
+ } catch {
8755
+ throw new CliCallVerificationError(
8756
+ "invalid-body",
8757
+ "POST body is not valid JSON"
8758
+ );
8759
+ }
8760
+ if (!isArgsRecord(parsed)) {
8761
+ throw new CliCallVerificationError(
8762
+ "invalid-body",
8763
+ "POST body must be a JSON object of primitive args (string / number / boolean)"
8764
+ );
8765
+ }
8766
+ return parsed;
8767
+ }
8754
8768
  function isNonEmpty(value) {
8755
8769
  return typeof value === "string" && value.length > 0;
8756
8770
  }
@@ -9327,7 +9341,7 @@ function validateWarmHubClientOptions(options) {
9327
9341
  throw new TypeError(`Unknown WarmHubClient option "${key}"${hint}`);
9328
9342
  }
9329
9343
  }
9330
- var SDK_VERSION = "0.62.1" ;
9344
+ var SDK_VERSION = "0.64.0" ;
9331
9345
  var DEFAULT_API_URL = "https://api.warmhub.ai";
9332
9346
  var UNBATCHED_TRPC_PATHS = /* @__PURE__ */ new Set([
9333
9347
  "repo.shapeInstanceCounts",
@@ -9760,6 +9774,21 @@ var WarmHubClient = class _WarmHubClient {
9760
9774
  }
9761
9775
  }
9762
9776
  };
9777
+ /**
9778
+ * Homepage surfaces.
9779
+ */
9780
+ homepage = {
9781
+ /**
9782
+ * Return manually curated featured homepage lists.
9783
+ */
9784
+ featuredLists: async () => {
9785
+ try {
9786
+ return await this.trpc.homepage.featuredLists.query();
9787
+ } catch (error) {
9788
+ throw toWarmHubError(error);
9789
+ }
9790
+ }
9791
+ };
9763
9792
  /**
9764
9793
  * Effective-access resolution for UI gating and service-side authorization.
9765
9794
  * First-party surface (web UI + whedge edge); the underlying `access.resolve`
@@ -11154,14 +11183,15 @@ var WarmHubClient = class _WarmHubClient {
11154
11183
  }
11155
11184
  },
11156
11185
  /**
11157
- * Claim one action delivery run for processing.
11186
+ * Claim one action delivery for processing.
11158
11187
  */
11159
- claimDelivery: async (orgName, repoName, runId, holderId) => {
11188
+ claimDelivery: async (orgName, repoName, target, holderId) => {
11189
+ const deliveryTarget = typeof target === "string" ? { runId: target } : target;
11160
11190
  try {
11161
11191
  return await this.trpc.action.claimDelivery.mutate({
11162
11192
  orgName,
11163
11193
  repoName,
11164
- runId,
11194
+ ...deliveryTarget,
11165
11195
  holderId
11166
11196
  });
11167
11197
  } catch (error) {
@@ -11169,14 +11199,15 @@ var WarmHubClient = class _WarmHubClient {
11169
11199
  }
11170
11200
  },
11171
11201
  /**
11172
- * Mark one claimed action delivery run as complete.
11202
+ * Mark one claimed action delivery as complete.
11173
11203
  */
11174
- completeDelivery: async (orgName, repoName, runId, holderId) => {
11204
+ completeDelivery: async (orgName, repoName, target, holderId) => {
11205
+ const deliveryTarget = typeof target === "string" ? { runId: target } : target;
11175
11206
  try {
11176
11207
  return await this.trpc.action.completeDelivery.mutate({
11177
11208
  orgName,
11178
11209
  repoName,
11179
- runId,
11210
+ ...deliveryTarget,
11180
11211
  holderId
11181
11212
  });
11182
11213
  } catch (error) {
@@ -12582,5 +12613,5 @@ re2js/build/index.js:
12582
12613
  */
12583
12614
 
12584
12615
  export { AllStreamOperationsFailedError, CLI_INSTALL_REPO_HEADER, CLI_SIGNATURE_HEADER, CLI_TIMESTAMP_HEADER, CONTENT_FIELD_LIMIT_ERROR, CliCallVerificationError, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT2 as MAX_STREAM_APPEND_OPERATION_COUNT, OperationBuilder, PartialStreamSubmissionError, SDK_VERSION, WarmHubClient, WarmHubError, connectionErrorMessage, contentFieldLimitError, countStreamAppendResultStatuses, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, sdkVersionIsBelowMinimum, streamAppendResultStatus, submitOperationsViaStream, toWarmHubError, validateAgainstShape, verifyCliCall };
12585
- //# sourceMappingURL=chunk-XMQSHDUV.js.map
12586
- //# sourceMappingURL=chunk-XMQSHDUV.js.map
12616
+ //# sourceMappingURL=chunk-CJWKJDVX.js.map
12617
+ //# sourceMappingURL=chunk-CJWKJDVX.js.map