@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.
package/dist/artifacts.js CHANGED
@@ -1064,7 +1064,9 @@ function createKVResponseSchema(dataSchema) {
1064
1064
  var GenericKVResponseSchema = createKVResponseSchema(z.unknown());
1065
1065
  var KVListResponseSchema = z.object({
1066
1066
  /** Array of keys matching the list criteria */
1067
- keys: z.array(z.string())
1067
+ keys: z.array(z.string()),
1068
+ truncated: z.boolean().optional(),
1069
+ nextCursor: z.string().optional()
1068
1070
  });
1069
1071
  var KVListResultSchema = createResultSchema(KVListResponseSchema);
1070
1072
  var ServiceRequestEventSchema = z.object({
@@ -2326,7 +2328,10 @@ var KVService = class extends BaseService {
2326
2328
  KVAction.LIST,
2327
2329
  void 0,
2328
2330
  options?.signal,
2329
- options?.limit === void 0 ? void 0 : { "x-tinycloud-limit": String(options.limit) }
2331
+ options?.limit === void 0 && options?.cursor === void 0 ? void 0 : {
2332
+ ...options?.limit === void 0 ? {} : { "x-tinycloud-limit": String(options.limit) },
2333
+ ...options?.cursor === void 0 ? {} : { "x-tinycloud-cursor": options.cursor }
2334
+ }
2330
2335
  );
2331
2336
  if (!response.ok) {
2332
2337
  if (response.status === 401) {
@@ -2358,7 +2363,8 @@ var KVService = class extends BaseService {
2358
2363
  }
2359
2364
  return ok({
2360
2365
  keys,
2361
- ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" }
2366
+ ...response.headers.get("x-tinycloud-truncated") === null ? {} : { truncated: response.headers.get("x-tinycloud-truncated") === "true" },
2367
+ ...response.headers.get("x-tinycloud-next-cursor") === null ? {} : { nextCursor: response.headers.get("x-tinycloud-next-cursor") ?? void 0 }
2362
2368
  });
2363
2369
  } catch (error) {
2364
2370
  return err(wrapError("kv", error));
@@ -5017,6 +5023,10 @@ var DataVaultService = class extends BaseService {
5017
5023
  * @returns Result with array of key names (vault/ prefix stripped)
5018
5024
  */
5019
5025
  async list(options) {
5026
+ const page = await this.listPage(options);
5027
+ return page.ok ? { ok: true, data: page.data.keys } : page;
5028
+ }
5029
+ async listPage(options) {
5020
5030
  return this.withTelemetry("list", options?.prefix, async () => {
5021
5031
  if (!this.isUnlocked) {
5022
5032
  return vaultError({
@@ -5034,7 +5044,9 @@ var DataVaultService = class extends BaseService {
5034
5044
  const listPrefix = options?.prefix ? `vault/${options.prefix}` : "vault/";
5035
5045
  const listResult = await this.tc.kv.list({
5036
5046
  prefix: listPrefix,
5037
- removePrefix: true
5047
+ removePrefix: true,
5048
+ ...options?.limit === void 0 ? {} : { limit: options.limit },
5049
+ ...options?.cursor === void 0 ? {} : { cursor: options.cursor }
5038
5050
  });
5039
5051
  if (!listResult.ok) {
5040
5052
  return vaultError({
@@ -5051,7 +5063,11 @@ var DataVaultService = class extends BaseService {
5051
5063
  (k) => k.startsWith(userPrefix) ? k.slice(userPrefix.length) : k
5052
5064
  );
5053
5065
  }
5054
- return ok(keys);
5066
+ return ok({
5067
+ keys,
5068
+ truncated: listResult.data.truncated === true,
5069
+ ...listResult.data.nextCursor === void 0 ? {} : { nextCursor: listResult.data.nextCursor }
5070
+ });
5055
5071
  } catch (error) {
5056
5072
  return vaultError({
5057
5073
  code: "STORAGE_ERROR",