@leisuresaas/react-native 0.6.6-dev.2 → 0.6.7-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leisuresaas/react-native",
3
- "version": "0.6.6-dev.2",
3
+ "version": "0.6.7-dev.1",
4
4
  "description": "React Native SDK for LeisureSaas: OAuth, Public Ads/App Config, Drive User Plane (publishable keys). Frontend-only — no Integration Key.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -63,4 +63,18 @@ export type FsStorageUsage = {
63
63
  user_id?: string;
64
64
  /** Drive single-file limit of the product; -1 = unlimited. Check before picking a file. */
65
65
  max_file_bytes?: number;
66
+ /** Usage under the root folders passed as `roots`, in request order; absent when none were asked for. */
67
+ roots?: FsRootUsage[];
68
+ };
69
+
70
+ /**
71
+ * Usage under one root-level Drive folder: every descendant file, recursively, counted like
72
+ * `bytes_used` (active files only).
73
+ */
74
+ export type FsRootUsage = {
75
+ name: string;
76
+ /** false: no such folder at the Drive root (bytes_used and objects_used are 0). */
77
+ exists: boolean;
78
+ bytes_used: number;
79
+ objects_used: number;
66
80
  };
package/src/drive.ts CHANGED
@@ -17,6 +17,7 @@ export type {
17
17
  FsContentURLResult,
18
18
  FsNode,
19
19
  FsStorageUsage,
20
+ FsRootUsage,
20
21
  FsUploadSessionResult,
21
22
  UploadProgress,
22
23
  } from "./drive/types";
@@ -111,8 +112,14 @@ export async function listFsNodes(ctx: DriveRequestContext, parentId = ""): Prom
111
112
  }
112
113
 
113
114
  /** Tenant storage occupancy vs Plan Limit (User Plane GET /usage). */
114
- export async function getFsStorageUsage(ctx: DriveRequestContext): Promise<FsStorageUsage> {
115
- return driveRequest<FsStorageUsage>(ctx, "GET", "/usage");
115
+ /**
116
+ * `roots`: root folder names (max 10) whose subtree usage to report in `roots`. With
117
+ * `delegationId` they must be among the delegation's Drive roots.
118
+ */
119
+ export async function getFsStorageUsage(ctx: DriveRequestContext, roots: string[] = []): Promise<FsStorageUsage> {
120
+ const names = roots.map((r) => r.trim()).filter(Boolean);
121
+ const path = names.length ? `/usage?roots=${encodeURIComponent(names.join(","))}` : "/usage";
122
+ return driveRequest<FsStorageUsage>(ctx, "GET", path);
116
123
  }
117
124
 
118
125
  export async function getFsNode(ctx: DriveRequestContext, id: string): Promise<FsNode> {
package/src/index.ts CHANGED
@@ -142,6 +142,7 @@ export type {
142
142
  FsContentURLResult,
143
143
  FsNode,
144
144
  FsStorageUsage,
145
+ FsRootUsage,
145
146
  FsUploadSessionResult,
146
147
  UploadProgress,
147
148
  UploadProgressHandler,