deepspace 0.19.5 → 0.20.0

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/worker.d.ts CHANGED
@@ -2848,13 +2848,9 @@ declare const UPLOAD_PART_BYTES: number;
2848
2848
  /**
2849
2849
  * The highest part number the server accepts.
2850
2850
  *
2851
- * The handler holds no per-session state, so this — not the declared total —
2852
- * is what bounds an in-flight upload. It is computed against
2853
- * {@link UPLOAD_PART_BYTES}, which is why the server refuses a part larger
2854
- * than that even though a whole small file may be 25 MiB: admitting 25 MiB
2855
- * parts would make the real in-flight bound 52 × 25 MiB = 1300 MiB while the
2856
- * advertised ceiling stayed 1 GiB. With both numbers agreeing, a session's
2857
- * worst case is 52 × 20 MiB = 1040 MiB — the ceiling plus one part.
2851
+ * The server derives the only valid part number and byte length from the
2852
+ * declared total and {@link UPLOAD_PART_BYTES}. The maximum part count is
2853
+ * therefore the exact number needed to reach the file ceiling.
2858
2854
  *
2859
2855
  * R2 allows 10,000 parts, so this is far inside what the API permits.
2860
2856
  */
@@ -2909,6 +2905,25 @@ declare function storageQuotaMessage(incomingBytes: number, usedBytes: number, l
2909
2905
  declare const MAX_DEPLOY_ASSET_FILE_BYTES: number;
2910
2906
  declare function formatBytes(bytes: number): string;
2911
2907
 
2908
+ /**
2909
+ * Everything the files handler needs to enforce one account allocation.
2910
+ *
2911
+ * `quotaKey` is required because an exact scan followed by an uncoordinated
2912
+ * write cannot enforce a limit under concurrency. Callers that do not want a
2913
+ * quota omit `storage`; callers that do want one must name its serialized
2914
+ * summary.
2915
+ */
2916
+ interface StorageAdmission {
2917
+ /** The app prefix receiving this request's write. */
2918
+ prefix: string;
2919
+ /** Internal R2 key for the account's ETag-serialized usage summary. */
2920
+ quotaKey: string;
2921
+ /** Resolve the account's limit. `null` fails writes closed. */
2922
+ limitBytes: () => Promise<number | null>;
2923
+ /** Resolve the other app prefixes in the account. `null` fails closed. */
2924
+ siblingPrefixes?: () => Promise<string[] | null>;
2925
+ }
2926
+
2912
2927
  /**
2913
2928
  * Shared Scoped R2 Files Handler
2914
2929
  *
@@ -2952,6 +2967,7 @@ interface ScopeContext {
2952
2967
  }
2953
2968
  type PrefixResult = {
2954
2969
  prefix: string;
2970
+ excludedPrefixes?: readonly string[];
2955
2971
  error?: undefined;
2956
2972
  } | {
2957
2973
  prefix?: undefined;
@@ -2974,32 +2990,12 @@ interface ScopedR2Config {
2974
2990
  * mount. The handler is the enforcer; the mount only knows whose limit
2975
2991
  * applies.
2976
2992
  */
2977
- interface StorageAdmission {
2978
- /** This app's own prefix — the one the incoming write lands under. */
2979
- prefix: string;
2980
- /**
2981
- * Resolve the owner's limit in bytes. `null` means the lookup failed;
2982
- * writes then fail closed (503) rather than admitting unmetered storage.
2983
- */
2984
- limitBytes: () => Promise<number | null>;
2985
- /**
2986
- * The OTHER app prefixes this owner's storage spans, if any.
2987
- *
2988
- * The limit is per ACCOUNT, not per app: an owner's allocation is the total
2989
- * across everything they own, so admission has to see the siblings too. `[]`
2990
- * for an owner with one app, which is the common case and costs exactly what
2991
- * it did when this was a per-app limit.
2992
- *
2993
- * Returning `null` means the owner's apps could not be enumerated. Like a
2994
- * failed limit lookup that fails the write closed rather than admitting a
2995
- * write against an allocation we cannot measure.
2996
- */
2997
- siblingPrefixes?: () => Promise<string[] | null>;
2998
- }
2999
2993
  interface ScopedR2Auth {
3000
2994
  userId: string | null;
3001
2995
  /** Absent = no quota on this mount (e.g. an app's own bucket). */
3002
2996
  storage?: StorageAdmission;
2997
+ /** Account-wide quota details are private to an authorized owner surface. */
2998
+ includeStorageUsage?: boolean;
3003
2999
  }
3004
3000
  type ScopedR2Handler = (request: Request, url: URL, bucket: R2Bucket, auth: ScopedR2Auth) => Promise<Response>;
3005
3001
  declare function isFilesVerbPath(method: string, subpath: string): boolean;