@concord-consortium/object-storage 1.0.0-pre.6 → 1.0.0-pre.8

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/README.md CHANGED
@@ -39,7 +39,9 @@ function YourComponent() {
39
39
 
40
40
  // Use storage methods
41
41
  const handleAdd = async () => {
42
- const id = await storage.add({ metadata: {}, data: {} });
42
+ const object = new StoredObject();
43
+ const result = await storage.add(object);
44
+ console.log('Added object with id:', result.id);
43
45
  };
44
46
 
45
47
  return <div>Your component</div>;
@@ -1,4 +1,5 @@
1
- import { DemoObjectStorageConfig, IObjectStorage, ObjectMetadata, ObjectData, StoredObject, MonitorCallback, DemonitorFunction, AddOptions, ObjectMetadataWithId } from './types';
1
+ import { DemoObjectStorageConfig, IObjectStorage, MonitorCallback, DemonitorFunction, StoredObjectMetadataWithId } from './types';
2
+ import { StoredObject, StoredObjectMetadata, StoredObjectData } from './stored-object';
2
3
  export declare class DemoObjectStorage implements IObjectStorage {
3
4
  private config;
4
5
  private objects;
@@ -8,18 +9,18 @@ export declare class DemoObjectStorage implements IObjectStorage {
8
9
  /**
9
10
  * Lists metadata documents for objects associated with specific question IDs
10
11
  */
11
- list(questionId: string): Promise<ObjectMetadataWithId[]>;
12
+ list(questionId: string): Promise<StoredObjectMetadataWithId[]>;
12
13
  /**
13
14
  * Monitors metadata documents for objects associated with specific question IDs
14
15
  * Invokes callback at start and on any change
15
16
  * Returns a function to stop monitoring
16
17
  */
17
- monitor(questionId: string, callback: MonitorCallback): DemonitorFunction;
18
+ monitor(questionId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
18
19
  /**
19
20
  * Adds both metadata and data documents for a new object
20
- * Returns the generated object ID (nanoid) or the provided ID if specified in options
21
+ * Returns the StoredObject that was added
21
22
  */
22
- add(object: StoredObject, options?: AddOptions): Promise<string>;
23
+ add(object: StoredObject): Promise<StoredObject>;
23
24
  /**
24
25
  * Reads both metadata and data documents for an object
25
26
  * Returns undefined if the object is not found
@@ -29,16 +30,17 @@ export declare class DemoObjectStorage implements IObjectStorage {
29
30
  * Reads only the metadata document for an object
30
31
  * Returns undefined if the object is not found
31
32
  */
32
- readMetadata(objectId: string): Promise<ObjectMetadata | undefined>;
33
+ readMetadata(objectId: string): Promise<StoredObjectMetadata | undefined>;
33
34
  /**
34
35
  * Reads only the data document for an object
35
36
  * Returns undefined if the object is not found
36
37
  */
37
- readData(objectId: string): Promise<ObjectData | undefined>;
38
+ readData(objectId: string): Promise<StoredObjectData | undefined>;
38
39
  /**
39
- * Generates a new unique ID using nanoid
40
+ * Reads a single data item for an object
41
+ * Returns undefined if the object or item is not found
40
42
  */
41
- genId(): string;
43
+ readDataItem(objectId: string, itemId: string): Promise<any | undefined>;
42
44
  /**
43
45
  * Notifies all active monitors of changes
44
46
  */
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DemoObjectStorage = void 0;
4
- const nanoid_1 = require("nanoid");
5
4
  class DemoObjectStorage {
6
5
  constructor(config) {
7
6
  if (config.version !== 1) {
@@ -29,7 +28,7 @@ class DemoObjectStorage {
29
28
  * Invokes callback at start and on any change
30
29
  * Returns a function to stop monitoring
31
30
  */
32
- monitor(questionId, callback) {
31
+ async monitor(questionId, callback) {
33
32
  if (!this.monitors.has(questionId)) {
34
33
  this.monitors.set(questionId, []);
35
34
  }
@@ -48,28 +47,21 @@ class DemoObjectStorage {
48
47
  }
49
48
  /**
50
49
  * Adds both metadata and data documents for a new object
51
- * Returns the generated object ID (nanoid) or the provided ID if specified in options
50
+ * Returns the StoredObject that was added
52
51
  */
53
- async add(object, options) {
54
- const id = options?.id ?? (0, nanoid_1.nanoid)();
52
+ async add(object) {
53
+ const id = object.id;
55
54
  this.objects.set(id, object);
56
55
  // Notify all monitors
57
56
  this.notifyMonitors();
58
- return id;
57
+ return object;
59
58
  }
60
59
  /**
61
60
  * Reads both metadata and data documents for an object
62
61
  * Returns undefined if the object is not found
63
62
  */
64
63
  async read(objectId) {
65
- const obj = this.objects.get(objectId);
66
- if (!obj) {
67
- return undefined;
68
- }
69
- return {
70
- metadata: obj.metadata,
71
- data: obj.data
72
- };
64
+ return this.objects.get(objectId);
73
65
  }
74
66
  /**
75
67
  * Reads only the metadata document for an object
@@ -94,10 +86,15 @@ class DemoObjectStorage {
94
86
  return obj.data;
95
87
  }
96
88
  /**
97
- * Generates a new unique ID using nanoid
89
+ * Reads a single data item for an object
90
+ * Returns undefined if the object or item is not found
98
91
  */
99
- genId() {
100
- return (0, nanoid_1.nanoid)();
92
+ async readDataItem(objectId, itemId) {
93
+ const obj = this.objects.get(objectId);
94
+ if (!obj) {
95
+ return undefined;
96
+ }
97
+ return obj.data[itemId];
101
98
  }
102
99
  /**
103
100
  * Notifies all active monitors of changes
@@ -1,6 +1,7 @@
1
1
  import "firebase/compat/auth";
2
2
  import "firebase/compat/firestore";
3
- import { FirebaseObjectStorageConfig, IObjectStorage, ObjectMetadata, ObjectData, StoredObject, MonitorCallback, DemonitorFunction, AddOptions, ObjectMetadataWithId } from './types';
3
+ import { FirebaseObjectStorageConfig, IObjectStorage, MonitorCallback, DemonitorFunction, StoredObjectMetadataWithId } from './types';
4
+ import { StoredObject, StoredObjectMetadata, StoredObjectData } from './stored-object';
4
5
  export declare class FirebaseObjectStorage implements IObjectStorage {
5
6
  private config;
6
7
  private initPromise;
@@ -12,6 +13,7 @@ export declare class FirebaseObjectStorage implements IObjectStorage {
12
13
  private createDocument;
13
14
  private getPaths;
14
15
  private getRefs;
16
+ private getItemDataPath;
15
17
  private getMetadataQuery;
16
18
  /**
17
19
  * Ensures the provided ID is in question ID format as opposed to reference ID format
@@ -25,18 +27,18 @@ export declare class FirebaseObjectStorage implements IObjectStorage {
25
27
  /**
26
28
  * Lists metadata documents for objects associated with specific question IDs
27
29
  */
28
- list(questionOrRefId: string): Promise<ObjectMetadataWithId[]>;
30
+ list(questionOrRefId: string): Promise<StoredObjectMetadataWithId[]>;
29
31
  /**
30
32
  * Monitors metadata documents for objects associated with specific question IDs
31
33
  * Invokes callback at start and on any change
32
34
  * Returns a function to stop monitoring
33
35
  */
34
- monitor(questionOrRefId: string, callback: MonitorCallback): DemonitorFunction;
36
+ monitor(questionOrRefId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
35
37
  /**
36
38
  * Adds both metadata and data documents for a new object
37
- * Returns the generated object ID (nanoid) or the provided ID if specified in options
39
+ * Returns the StoredObject that was added
38
40
  */
39
- add(object: StoredObject, options?: AddOptions): Promise<string>;
41
+ add(object: StoredObject): Promise<StoredObject>;
40
42
  /**
41
43
  * Reads both metadata and data documents for an object
42
44
  */
@@ -44,13 +46,13 @@ export declare class FirebaseObjectStorage implements IObjectStorage {
44
46
  /**
45
47
  * Reads only the metadata document for an object
46
48
  */
47
- readMetadata(objectId: string): Promise<ObjectMetadata | undefined>;
49
+ readMetadata(objectId: string): Promise<StoredObjectMetadata | undefined>;
48
50
  /**
49
51
  * Reads only the data document for an object
50
52
  */
51
- readData(objectId: string): Promise<ObjectData | undefined>;
53
+ readData(objectId: string): Promise<StoredObjectData | undefined>;
52
54
  /**
53
- * Generates a new unique ID using nanoid
55
+ * Reads a single data item for an object
54
56
  */
55
- genId(): string;
57
+ readDataItem(objectId: string, itemId: string): Promise<any | undefined>;
56
58
  }
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FirebaseObjectStorage = void 0;
7
- const nanoid_1 = require("nanoid");
8
7
  const app_1 = __importDefault(require("firebase/compat/app"));
9
8
  require("firebase/compat/auth");
10
9
  require("firebase/compat/firestore");
10
+ const stored_object_1 = require("./stored-object");
11
11
  class FirebaseObjectStorage {
12
12
  constructor(config) {
13
13
  this.initialized = false;
@@ -74,6 +74,9 @@ class FirebaseObjectStorage {
74
74
  const dataRef = this.app.firestore().doc(dataPath);
75
75
  return { metadataRef, dataRef };
76
76
  }
77
+ getItemDataPath(objectId, itemId) {
78
+ return `${this.config.root}/object_store_data/${objectId}-${itemId}`;
79
+ }
77
80
  getMetadataQuery(questionOrRefId) {
78
81
  const questionId = this.ensureIdIsQuestionId(questionOrRefId);
79
82
  const { metadataPath } = this.getPaths();
@@ -129,8 +132,8 @@ class FirebaseObjectStorage {
129
132
  * Invokes callback at start and on any change
130
133
  * Returns a function to stop monitoring
131
134
  */
132
- monitor(questionOrRefId, callback) {
133
- // await this.ensureInitialized();
135
+ async monitor(questionOrRefId, callback) {
136
+ await this.ensureInitialized();
134
137
  const query = this.getMetadataQuery(questionOrRefId);
135
138
  const unsub = query.onSnapshot(snapshot => {
136
139
  const results = [];
@@ -145,20 +148,29 @@ class FirebaseObjectStorage {
145
148
  }
146
149
  /**
147
150
  * Adds both metadata and data documents for a new object
148
- * Returns the generated object ID (nanoid) or the provided ID if specified in options
151
+ * Returns the StoredObject that was added
149
152
  */
150
- async add(object, options) {
153
+ async add(object) {
151
154
  await this.ensureInitialized();
152
- const newObjectId = options?.id ?? (0, nanoid_1.nanoid)();
153
- const { data, metadata } = object;
154
- const { metadataRef, dataRef } = this.getRefs(newObjectId);
155
- const dataDoc = this.createDocument({ data });
155
+ const newObjectId = object.id;
156
+ const { metadata } = object;
157
+ const { metadataRef } = this.getRefs(newObjectId);
156
158
  const metadataDoc = this.createDocument({ metadata });
157
159
  const batch = this.app.firestore().batch();
158
- batch.set(dataRef, dataDoc);
159
160
  batch.set(metadataRef, metadataDoc);
161
+ // Write each item as a separate document
162
+ for (const itemId in object.data) {
163
+ const itemPath = this.getItemDataPath(newObjectId, itemId);
164
+ const itemRef = this.app.firestore().doc(itemPath);
165
+ const itemDoc = this.createDocument({
166
+ objectId: newObjectId,
167
+ itemId: itemId,
168
+ itemData: JSON.stringify(object.data[itemId])
169
+ });
170
+ batch.set(itemRef, itemDoc);
171
+ }
160
172
  await batch.commit();
161
- return newObjectId;
173
+ return object;
162
174
  }
163
175
  /**
164
176
  * Reads both metadata and data documents for an object
@@ -173,7 +185,7 @@ class FirebaseObjectStorage {
173
185
  if (!data) {
174
186
  return undefined;
175
187
  }
176
- return { metadata, data };
188
+ return stored_object_1.StoredObject.FromParts(objectId, metadata, data);
177
189
  }
178
190
  /**
179
191
  * Reads only the metadata document for an object
@@ -185,25 +197,44 @@ class FirebaseObjectStorage {
185
197
  if (!metadataSnapshot.exists) {
186
198
  return undefined;
187
199
  }
188
- return metadataSnapshot.data()?.metadata ?? {};
200
+ return metadataSnapshot.data()?.metadata;
189
201
  }
190
202
  /**
191
203
  * Reads only the data document for an object
192
204
  */
193
205
  async readData(objectId) {
194
206
  await this.ensureInitialized();
195
- const { dataRef } = this.getRefs(objectId);
196
- const dataSnapshot = await dataRef.get();
197
- if (!dataSnapshot.exists) {
207
+ const dataPath = `${this.config.root}/object_store_data`;
208
+ const query = this.app.firestore().collection(dataPath)
209
+ .where("objectId", "==", objectId);
210
+ const querySnapshot = await query.get();
211
+ if (querySnapshot.empty) {
198
212
  return undefined;
199
213
  }
200
- return dataSnapshot.data()?.data ?? {};
214
+ const data = {};
215
+ querySnapshot.forEach(doc => {
216
+ const docData = doc.data();
217
+ const itemId = docData.itemId;
218
+ const itemDataString = docData.itemData;
219
+ if (itemId && itemDataString) {
220
+ data[itemId] = JSON.parse(itemDataString);
221
+ }
222
+ });
223
+ return data;
201
224
  }
202
225
  /**
203
- * Generates a new unique ID using nanoid
226
+ * Reads a single data item for an object
204
227
  */
205
- genId() {
206
- return (0, nanoid_1.nanoid)();
228
+ async readDataItem(objectId, itemId) {
229
+ await this.ensureInitialized();
230
+ const itemPath = this.getItemDataPath(objectId, itemId);
231
+ const itemRef = this.app.firestore().doc(itemPath);
232
+ const itemSnapshot = await itemRef.get();
233
+ if (!itemSnapshot.exists) {
234
+ return undefined;
235
+ }
236
+ const itemDataString = itemSnapshot.data()?.itemData;
237
+ return itemDataString ? JSON.parse(itemDataString) : undefined;
207
238
  }
208
239
  }
209
240
  exports.FirebaseObjectStorage = FirebaseObjectStorage;
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { DemoObjectStorage } from './demo-object-storage';
2
2
  export { FirebaseObjectStorage } from './firebase-object-storage';
3
3
  export { createObjectStorage } from './object-storage';
4
4
  export { ObjectStorageProvider, useObjectStorage } from './object-storage-context';
5
- export { IObjectStorage, ObjectStorageConfig, DemoObjectStorageConfig, FirebaseObjectStorageUser, FirebaseObjectStorageConfig, ObjectMetadata, ObjectData, StoredObject, ObjectWithId, MonitorCallback, DemonitorFunction } from './types';
6
- export * from './typed-object';
5
+ export { IObjectStorage, ObjectStorageConfig, DemoObjectStorageConfig, FirebaseObjectStorageUser, FirebaseObjectStorageConfig, StoredObjectWithId as ObjectWithId, MonitorCallback, DemonitorFunction } from './types';
6
+ export * from './stored-object';
package/dist/index.js CHANGED
@@ -24,4 +24,4 @@ Object.defineProperty(exports, "createObjectStorage", { enumerable: true, get: f
24
24
  var object_storage_context_1 = require("./object-storage-context");
25
25
  Object.defineProperty(exports, "ObjectStorageProvider", { enumerable: true, get: function () { return object_storage_context_1.ObjectStorageProvider; } });
26
26
  Object.defineProperty(exports, "useObjectStorage", { enumerable: true, get: function () { return object_storage_context_1.useObjectStorage; } });
27
- __exportStar(require("./typed-object"), exports);
27
+ __exportStar(require("./stored-object"), exports);
@@ -0,0 +1,74 @@
1
+ export type AddImageOptions = {
2
+ id?: string;
3
+ name: string;
4
+ url: string;
5
+ width?: number;
6
+ height?: number;
7
+ description?: string;
8
+ subType?: string;
9
+ };
10
+ export type AddDataTableOptions = {
11
+ id?: string;
12
+ name: string;
13
+ cols: string[];
14
+ rows: any[][];
15
+ description?: string;
16
+ subType?: string;
17
+ };
18
+ export type AddTextOptions = {
19
+ id?: string;
20
+ name: string;
21
+ text: string;
22
+ description?: string;
23
+ subType?: string;
24
+ };
25
+ export type AddStoredObjectOptions = {
26
+ id?: string;
27
+ name: string;
28
+ data: Record<string, any>;
29
+ description?: string;
30
+ subType?: string;
31
+ };
32
+ export type StoredImageMetadata = {
33
+ type: "image";
34
+ } & Omit<AddImageOptions, "id" | "url">;
35
+ export type StoredObjectDataTableMetadata = {
36
+ type: "dataTable";
37
+ } & Omit<AddDataTableOptions, "id" | "rows">;
38
+ export type StoredTextMetadata = {
39
+ type: "text";
40
+ } & Omit<AddTextOptions, "id" | "text">;
41
+ export type StoredObjectItemMetadata = {
42
+ type: "object";
43
+ keys: string[];
44
+ } & Omit<AddStoredObjectOptions, "id" | "data">;
45
+ export type StoredMetadataItem = StoredImageMetadata | StoredObjectDataTableMetadata | StoredTextMetadata | StoredObjectItemMetadata;
46
+ export type StoredMetadataItems = Record<string, StoredMetadataItem>;
47
+ export type StoredObjectType = "simulation-recording" | "untyped";
48
+ export type StoredObjectMetadata = {
49
+ version: 1;
50
+ type: StoredObjectType;
51
+ subType?: string;
52
+ items: StoredMetadataItems;
53
+ name?: string;
54
+ description?: string;
55
+ };
56
+ export type StoredObjectData = Record<string, any>;
57
+ export type StoredObjectOptions = {
58
+ id?: string;
59
+ name?: string;
60
+ description?: string;
61
+ type?: StoredObjectType;
62
+ subType?: string;
63
+ };
64
+ export declare class StoredObject {
65
+ id: string;
66
+ metadata: StoredObjectMetadata;
67
+ data: StoredObjectData;
68
+ constructor(options?: StoredObjectOptions);
69
+ static FromParts(id: string, metadata: StoredObjectMetadata, data: StoredObjectData): StoredObject;
70
+ addImage(options: AddImageOptions): void;
71
+ addDataTable(options: AddDataTableOptions): void;
72
+ addText(options: AddTextOptions): void;
73
+ addObject(options: AddStoredObjectOptions): void;
74
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoredObject = void 0;
4
+ const nanoid_1 = require("nanoid");
5
+ class StoredObject {
6
+ constructor(options) {
7
+ this.id = options?.id || (0, nanoid_1.nanoid)();
8
+ this.metadata = {
9
+ version: 1,
10
+ type: options?.type || "untyped",
11
+ items: {},
12
+ };
13
+ if (options?.name !== undefined) {
14
+ this.metadata.name = options.name;
15
+ }
16
+ if (options?.description !== undefined) {
17
+ this.metadata.description = options.description;
18
+ }
19
+ if (options?.subType !== undefined) {
20
+ this.metadata.subType = options.subType;
21
+ }
22
+ this.data = {};
23
+ }
24
+ static FromParts(id, metadata, data) {
25
+ const typedObject = new StoredObject({ id });
26
+ typedObject.metadata = metadata;
27
+ typedObject.data = data;
28
+ return typedObject;
29
+ }
30
+ addImage(options) {
31
+ const id = options.id || (0, nanoid_1.nanoid)();
32
+ this.metadata.items[id] = {
33
+ type: "image",
34
+ name: options.name
35
+ };
36
+ if (options.subType !== undefined) {
37
+ this.metadata.items[id].subType = options.subType;
38
+ }
39
+ if (options.width !== undefined) {
40
+ this.metadata.items[id].width = options.width;
41
+ }
42
+ if (options.height !== undefined) {
43
+ this.metadata.items[id].height = options.height;
44
+ }
45
+ if (options.description !== undefined) {
46
+ this.metadata.items[id].description = options.description;
47
+ }
48
+ this.data[id] = {
49
+ url: options.url
50
+ };
51
+ }
52
+ addDataTable(options) {
53
+ const id = options.id || (0, nanoid_1.nanoid)();
54
+ this.metadata.items[id] = {
55
+ type: "dataTable",
56
+ name: options.name,
57
+ cols: options.cols,
58
+ };
59
+ if (options.subType !== undefined) {
60
+ this.metadata.items[id].subType = options.subType;
61
+ }
62
+ if (options.description !== undefined) {
63
+ this.metadata.items[id].description = options.description;
64
+ }
65
+ this.data[id] = {
66
+ rows: options.rows
67
+ };
68
+ }
69
+ addText(options) {
70
+ const id = options.id || (0, nanoid_1.nanoid)();
71
+ this.metadata.items[id] = {
72
+ type: "text",
73
+ name: options.name,
74
+ };
75
+ if (options.subType !== undefined) {
76
+ this.metadata.items[id].subType = options.subType;
77
+ }
78
+ if (options.description !== undefined) {
79
+ this.metadata.items[id].description = options.description;
80
+ }
81
+ this.data[id] = {
82
+ text: options.text
83
+ };
84
+ }
85
+ addObject(options) {
86
+ const id = options.id || (0, nanoid_1.nanoid)();
87
+ this.metadata.items[id] = {
88
+ type: "object",
89
+ name: options.name,
90
+ keys: Object.keys(options.data),
91
+ };
92
+ if (options.subType !== undefined) {
93
+ this.metadata.items[id].subType = options.subType;
94
+ }
95
+ if (options.description !== undefined) {
96
+ this.metadata.items[id].description = options.description;
97
+ }
98
+ this.data[id] = options.data;
99
+ }
100
+ }
101
+ exports.StoredObject = StoredObject;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { StoredObject, StoredObjectMetadata, StoredObjectData } from './stored-object';
1
2
  export interface DemoObjectStorageConfig {
2
3
  version: 1;
3
4
  type: "demo";
@@ -24,40 +25,27 @@ export interface FirebaseObjectStorageConfig {
24
25
  questionId: string;
25
26
  }
26
27
  export type ObjectStorageConfig = DemoObjectStorageConfig | FirebaseObjectStorageConfig;
27
- export interface AddOptions {
28
- id?: string;
29
- }
30
28
  export interface IObjectStorage {
31
- list(questionOrRefId: string): Promise<ObjectMetadataWithId[]>;
32
- monitor(questionOrRefId: string, callback: MonitorCallback): DemonitorFunction;
33
- add(object: StoredObject, options?: AddOptions): Promise<string>;
29
+ list(questionOrRefId: string): Promise<StoredObjectMetadataWithId[]>;
30
+ monitor(questionOrRefId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
31
+ add(object: StoredObject): Promise<StoredObject>;
34
32
  read(objectId: string): Promise<StoredObject | undefined>;
35
- readMetadata(objectId: string): Promise<ObjectMetadata | undefined>;
36
- readData(objectId: string): Promise<ObjectData | undefined>;
37
- genId(): string;
38
- }
39
- export interface ObjectMetadata {
40
- [key: string]: any;
41
- }
42
- export interface ObjectData {
43
- [key: string]: any;
44
- }
45
- export interface StoredObject {
46
- metadata: ObjectMetadata;
47
- data: ObjectData;
33
+ readMetadata(objectId: string): Promise<StoredObjectMetadata | undefined>;
34
+ readData(objectId: string): Promise<StoredObjectData | undefined>;
35
+ readDataItem(objectId: string, itemId: string): Promise<any | undefined>;
48
36
  }
49
- export interface ObjectMetadataWithId {
37
+ export interface StoredObjectMetadataWithId {
50
38
  id: string;
51
- metadata: ObjectMetadata;
39
+ metadata: StoredObjectMetadata;
52
40
  }
53
- export interface ObjectDataWithId {
41
+ export interface StoredObjectDataWithId {
54
42
  id: string;
55
- data: ObjectData;
43
+ data: StoredObjectData;
56
44
  }
57
- export interface ObjectWithId {
45
+ export interface StoredObjectWithId {
58
46
  id: string;
59
- metadata: ObjectMetadata;
60
- data: ObjectData;
47
+ metadata: StoredObjectMetadata;
48
+ data: StoredObjectData;
61
49
  }
62
- export type MonitorCallback = (objects: ObjectMetadataWithId[]) => void;
50
+ export type MonitorCallback = (objects: StoredObjectMetadataWithId[]) => void;
63
51
  export type DemonitorFunction = () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concord-consortium/object-storage",
3
- "version": "1.0.0-pre.6",
3
+ "version": "1.0.0-pre.8",
4
4
  "description": "A TypeScript library for object storage",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  "test": "jest",
11
11
  "test:watch": "jest --watch",
12
12
  "test:coverage": "jest --coverage",
13
- "prepublishOnly": "npm run build",
14
- "publish": "npm publish"
13
+ "prepare": "tsc",
14
+ "prepublishOnly": "npm run build"
15
15
  },
16
16
  "keywords": [
17
17
  "object-storage",