@telepath-computer/autofile 0.4.0 → 0.5.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/store.d.ts CHANGED
@@ -26,11 +26,14 @@ export interface AutofileRecord {
26
26
  problems?: AutofileProblem[];
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
+ collections?: string[];
29
30
  value: JsonObject;
30
31
  }
31
32
  /** Optional filters and paging controls; where and fields apply only to value. */
32
33
  export interface RecordQuery {
33
34
  type?: string | string[];
35
+ /** A collection URI for its direct members, or null for records in no collection. */
36
+ collection?: string | null;
34
37
  q?: string;
35
38
  where?: JsonObject;
36
39
  fields?: string[];
@@ -64,6 +67,17 @@ export type TypeChanges = Partial<Omit<TypeDefinition, "titleField" | "title">>
64
67
  titleField?: string | null;
65
68
  title?: string | null;
66
69
  };
70
+ /** Metadata for a blob, including a read-only local file when available. */
71
+ export interface BlobStat {
72
+ size: number;
73
+ mimeType: string;
74
+ path?: string;
75
+ }
76
+ /** A half-open interval of attachment bytes, like Uint8Array.subarray. */
77
+ export interface BlobRange {
78
+ start: number;
79
+ end: number;
80
+ }
67
81
  /** A record or type was created, changed, or deleted. */
68
82
  export interface ChangeEvent {
69
83
  uri: string;
@@ -85,8 +99,11 @@ export declare class Autofile {
85
99
  get: (uri: string) => Promise<AutofileRecord | undefined>;
86
100
  create: (type: string, value: JsonObject, options?: {
87
101
  key?: string;
102
+ collections?: string[];
103
+ }) => Promise<AutofileRecord>;
104
+ update: (uri: string, patch: JsonObject, options?: {
105
+ collections?: string[];
88
106
  }) => Promise<AutofileRecord>;
89
- update: (uri: string, patch: JsonObject) => Promise<AutofileRecord>;
90
107
  delete: (uri: string) => Promise<void>;
91
108
  };
92
109
  readonly types: {
@@ -98,10 +115,13 @@ export declare class Autofile {
98
115
  };
99
116
  readonly blobs: {
100
117
  put: (bytes: Uint8Array, mediaType: string) => Promise<string>;
118
+ putStream: (chunks: AsyncIterable<Uint8Array>, mediaType: string) => Promise<string>;
101
119
  get: (uri: string) => Promise<{
102
120
  bytes: Uint8Array;
103
121
  mimeType: string;
104
122
  } | undefined>;
123
+ stat: (uri: string) => Promise<BlobStat | undefined>;
124
+ stream: (uri: string, range?: BlobRange) => Promise<ReadableStream<Uint8Array> | undefined>;
105
125
  };
106
126
  /** Checks a schema without accessing storage or checking link targets. */
107
127
  static prepareSchema(schema: JsonObject): Promise<PreparedSchema>;