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