@concord-consortium/object-storage 1.0.0-pre.7 → 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.
@@ -15,7 +15,7 @@ export declare class DemoObjectStorage implements IObjectStorage {
15
15
  * Invokes callback at start and on any change
16
16
  * Returns a function to stop monitoring
17
17
  */
18
- monitor(questionId: string, callback: MonitorCallback): DemonitorFunction;
18
+ monitor(questionId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
19
19
  /**
20
20
  * Adds both metadata and data documents for a new object
21
21
  * Returns the StoredObject that was added
@@ -28,7 +28,7 @@ class DemoObjectStorage {
28
28
  * Invokes callback at start and on any change
29
29
  * Returns a function to stop monitoring
30
30
  */
31
- monitor(questionId, callback) {
31
+ async monitor(questionId, callback) {
32
32
  if (!this.monitors.has(questionId)) {
33
33
  this.monitors.set(questionId, []);
34
34
  }
@@ -33,7 +33,7 @@ export declare class FirebaseObjectStorage implements IObjectStorage {
33
33
  * Invokes callback at start and on any change
34
34
  * Returns a function to stop monitoring
35
35
  */
36
- monitor(questionOrRefId: string, callback: MonitorCallback): DemonitorFunction;
36
+ monitor(questionOrRefId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
37
37
  /**
38
38
  * Adds both metadata and data documents for a new object
39
39
  * Returns the StoredObject that was added
@@ -132,8 +132,8 @@ class FirebaseObjectStorage {
132
132
  * Invokes callback at start and on any change
133
133
  * Returns a function to stop monitoring
134
134
  */
135
- monitor(questionOrRefId, callback) {
136
- // await this.ensureInitialized();
135
+ async monitor(questionOrRefId, callback) {
136
+ await this.ensureInitialized();
137
137
  const query = this.getMetadataQuery(questionOrRefId);
138
138
  const unsub = query.onSnapshot(snapshot => {
139
139
  const results = [];
package/dist/types.d.ts CHANGED
@@ -27,7 +27,7 @@ export interface FirebaseObjectStorageConfig {
27
27
  export type ObjectStorageConfig = DemoObjectStorageConfig | FirebaseObjectStorageConfig;
28
28
  export interface IObjectStorage {
29
29
  list(questionOrRefId: string): Promise<StoredObjectMetadataWithId[]>;
30
- monitor(questionOrRefId: string, callback: MonitorCallback): DemonitorFunction;
30
+ monitor(questionOrRefId: string, callback: MonitorCallback): Promise<DemonitorFunction>;
31
31
  add(object: StoredObject): Promise<StoredObject>;
32
32
  read(objectId: string): Promise<StoredObject | undefined>;
33
33
  readMetadata(objectId: string): Promise<StoredObjectMetadata | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concord-consortium/object-storage",
3
- "version": "1.0.0-pre.7",
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",