@southwind-ai/storage 0.1.0 → 0.1.2

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": "@southwind-ai/storage",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,7 +37,7 @@ export interface CleanupResult {
37
37
  export class UploadService {
38
38
  private readonly now: () => Date;
39
39
  private readonly createId: (prefix: "upload" | "file") => string;
40
- private readonly policies: ReadonlyMap<string, UploadPolicy>;
40
+ private readonly policies: Map<string, UploadPolicy>;
41
41
 
42
42
  constructor(private readonly options: UploadServiceOptions) {
43
43
  this.now = options.now ?? (() => new Date());
@@ -47,6 +47,10 @@ export class UploadService {
47
47
  );
48
48
  }
49
49
 
50
+ setPolicy(policy: UploadPolicy): void {
51
+ this.policies.set(policy.purpose, { ...policy });
52
+ }
53
+
50
54
  async create(input: CreateUploadInput): Promise<UploadSession> {
51
55
  const policy = this.requirePolicy(input.purpose);
52
56
  const filename = validFilename(input.filename);