@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.
@@ -1088,7 +1088,9 @@ function createKVResponseSchema(dataSchema) {
1088
1088
  var GenericKVResponseSchema = createKVResponseSchema(import_zod.z.unknown());
1089
1089
  var KVListResponseSchema = import_zod.z.object({
1090
1090
  /** Array of keys matching the list criteria */
1091
- keys: import_zod.z.array(import_zod.z.string())
1091
+ keys: import_zod.z.array(import_zod.z.string()),
1092
+ truncated: import_zod.z.boolean().optional(),
1093
+ nextCursor: import_zod.z.string().optional()
1092
1094
  });
1093
1095
  var KVListResultSchema = createResultSchema(KVListResponseSchema);
1094
1096
  var ServiceRequestEventSchema = import_zod.z.object({
@@ -2350,7 +2352,10 @@ var KVService = class extends BaseService {
2350
2352
  KVAction.LIST,
2351
2353
  void 0,
2352
2354
  options?.signal,
2353
- options?.limit === void 0 ? void 0 : { "x-tinycloud-limit": String(options.limit) }
2355
+ options?.limit === void 0 && options?.cursor === void 0 ? void 0 : {
2356
+ ...options?.limit === void 0 ? {} : { "x-tinycloud-limit": String(options.limit) },
2357
+ ...options?.cursor === void 0 ? {} : { "x-tinycloud-cursor": options.cursor }
2358
+ }
2354
2359
  );
2355
2360
  if (!response.ok) {
2356
2361
  if (response.status === 401) {
@@ -2382,7 +2387,8 @@ var KVService = class extends BaseService {
2382
2387
  }
2383
2388
  return ok({
2384
2389
  keys,
2385
- ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" }
2390
+ ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" },
2391
+ ...response.headers.get("x-tinycloud-next-cursor") === null ? {} : { nextCursor: response.headers.get("x-tinycloud-next-cursor") ?? void 0 }
2386
2392
  });
2387
2393
  } catch (error) {
2388
2394
  return err(wrapError("kv", error));
@@ -5041,6 +5047,10 @@ var DataVaultService = class extends BaseService {
5041
5047
  * @returns Result with array of key names (vault/ prefix stripped)
5042
5048
  */
5043
5049
  async list(options) {
5050
+ const page = await this.listPage(options);
5051
+ return page.ok ? { ok: true, data: page.data.keys } : page;
5052
+ }
5053
+ async listPage(options) {
5044
5054
  return this.withTelemetry("list", options?.prefix, async () => {
5045
5055
  if (!this.isUnlocked) {
5046
5056
  return vaultError({
@@ -5058,7 +5068,9 @@ var DataVaultService = class extends BaseService {
5058
5068
  const listPrefix = options?.prefix ? `vault/${options.prefix}` : "vault/";
5059
5069
  const listResult = await this.tc.kv.list({
5060
5070
  prefix: listPrefix,
5061
- removePrefix: true
5071
+ removePrefix: true,
5072
+ ...options?.limit === void 0 ? {} : { limit: options.limit },
5073
+ ...options?.cursor === void 0 ? {} : { cursor: options.cursor }
5062
5074
  });
5063
5075
  if (!listResult.ok) {
5064
5076
  return vaultError({
@@ -5075,7 +5087,11 @@ var DataVaultService = class extends BaseService {
5075
5087
  (k) => k.startsWith(userPrefix) ? k.slice(userPrefix.length) : k
5076
5088
  );
5077
5089
  }
5078
- return ok(keys);
5090
+ return ok({
5091
+ keys,
5092
+ truncated: listResult.data.truncated === true,
5093
+ ...listResult.data.nextCursor === void 0 ? {} : { nextCursor: listResult.data.nextCursor }
5094
+ });
5079
5095
  } catch (error) {
5080
5096
  return vaultError({
5081
5097
  code: "STORAGE_ERROR",