@tinycloud/operations 0.3.1-beta.0 → 0.3.1-beta.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.
@@ -2613,7 +2613,9 @@ var init_dist2 = __esm({
2613
2613
  GenericKVResponseSchema = createKVResponseSchema(z.unknown());
2614
2614
  KVListResponseSchema = z.object({
2615
2615
  /** Array of keys matching the list criteria */
2616
- keys: z.array(z.string())
2616
+ keys: z.array(z.string()),
2617
+ truncated: z.boolean().optional(),
2618
+ nextCursor: z.string().optional()
2617
2619
  });
2618
2620
  KVListResultSchema = createResultSchema(KVListResponseSchema);
2619
2621
  ServiceRequestEventSchema = z.object({
@@ -3765,7 +3767,10 @@ var init_dist2 = __esm({
3765
3767
  KVAction.LIST,
3766
3768
  void 0,
3767
3769
  options?.signal,
3768
- options?.limit === void 0 ? void 0 : { "x-tinycloud-limit": String(options.limit) }
3770
+ options?.limit === void 0 && options?.cursor === void 0 ? void 0 : {
3771
+ ...options?.limit === void 0 ? {} : { "x-tinycloud-limit": String(options.limit) },
3772
+ ...options?.cursor === void 0 ? {} : { "x-tinycloud-cursor": options.cursor }
3773
+ }
3769
3774
  );
3770
3775
  if (!response.ok) {
3771
3776
  if (response.status === 401) {
@@ -3797,7 +3802,8 @@ var init_dist2 = __esm({
3797
3802
  }
3798
3803
  return ok({
3799
3804
  keys,
3800
- ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" }
3805
+ ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" },
3806
+ ...response.headers.get("x-tinycloud-next-cursor") === null ? {} : { nextCursor: response.headers.get("x-tinycloud-next-cursor") ?? void 0 }
3801
3807
  });
3802
3808
  } catch (error) {
3803
3809
  return err(wrapError("kv", error));
@@ -5863,6 +5869,10 @@ var init_dist2 = __esm({
5863
5869
  * @returns Result with array of key names (vault/ prefix stripped)
5864
5870
  */
5865
5871
  async list(options) {
5872
+ const page = await this.listPage(options);
5873
+ return page.ok ? { ok: true, data: page.data.keys } : page;
5874
+ }
5875
+ async listPage(options) {
5866
5876
  return this.withTelemetry("list", options?.prefix, async () => {
5867
5877
  if (!this.isUnlocked) {
5868
5878
  return vaultError({
@@ -5880,7 +5890,9 @@ var init_dist2 = __esm({
5880
5890
  const listPrefix = options?.prefix ? `vault/${options.prefix}` : "vault/";
5881
5891
  const listResult = await this.tc.kv.list({
5882
5892
  prefix: listPrefix,
5883
- removePrefix: true
5893
+ removePrefix: true,
5894
+ ...options?.limit === void 0 ? {} : { limit: options.limit },
5895
+ ...options?.cursor === void 0 ? {} : { cursor: options.cursor }
5884
5896
  });
5885
5897
  if (!listResult.ok) {
5886
5898
  return vaultError({
@@ -5897,7 +5909,11 @@ var init_dist2 = __esm({
5897
5909
  (k) => k.startsWith(userPrefix) ? k.slice(userPrefix.length) : k
5898
5910
  );
5899
5911
  }
5900
- return ok(keys);
5912
+ return ok({
5913
+ keys,
5914
+ truncated: listResult.data.truncated === true,
5915
+ ...listResult.data.nextCursor === void 0 ? {} : { nextCursor: listResult.data.nextCursor }
5916
+ });
5901
5917
  } catch (error) {
5902
5918
  return vaultError({
5903
5919
  code: "STORAGE_ERROR",