@narrative.io/data-collaboration-sdk-ts 0.0.29 → 0.0.30

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.
@@ -29,7 +29,7 @@ export declare abstract class BaseApi {
29
29
  * @template I - Type of the request data.
30
30
  * @template T - Type of the response data.
31
31
  */
32
- protected post<I, T>(endpoint: string, data: I): Promise<T>;
32
+ protected post<I, T>(endpoint: string, data?: I): Promise<T>;
33
33
  /**
34
34
  * Sends a DELETE request to the specified endpoint.
35
35
  *
package/build/index.d.ts CHANGED
@@ -9,12 +9,14 @@ import { type SampleRecords } from './rosetta-stone/types';
9
9
  import { AttributeApi } from './attributes';
10
10
  import { type Attribute } from './attributes/types';
11
11
  import { PingApi } from './ping';
12
+ import { UploadsApi } from './uploads';
13
+ import { type UploadsResponse } from './uploads/types';
12
14
  import { type PingStatus } from './ping/types';
13
15
  import { type Product, ProductsApi } from './products';
14
16
  import { CompanyInfoApi, type CompanyInfo } from './company-info';
15
17
  import { InstallationsApi, type Installation } from './installations';
16
18
  declare class NarrativeApi extends BaseApi {
17
19
  }
18
- interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi {
20
+ interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi {
19
21
  }
20
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, type PingStatus, type Attribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation };
22
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, type UploadsResponse, type PingStatus, type Attribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation };
package/build/index.js CHANGED
@@ -5,10 +5,11 @@ import { RosettaStoneApi } from './rosetta-stone';
5
5
  import { applyMixins } from './utils';
6
6
  import { AttributeApi } from './attributes';
7
7
  import { PingApi } from './ping';
8
+ import { UploadsApi } from './uploads';
8
9
  import { ProductsApi } from './products';
9
10
  import { CompanyInfoApi } from './company-info';
10
11
  import { InstallationsApi } from './installations';
11
12
  class NarrativeApi extends BaseApi {
12
13
  }
13
- applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi]);
14
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi };
14
+ applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi]);
15
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi };
@@ -0,0 +1,17 @@
1
+ import { BaseApi } from 'src/base-api';
2
+ import { type UploadsResponse } from './types';
3
+ /**
4
+ * API class for handling file uploads.
5
+ * @extends BaseApi
6
+ */
7
+ declare class UploadsApi extends BaseApi {
8
+ /**
9
+ * Retrieves an upload URL for a given upload path.
10
+ *
11
+ * @async
12
+ * @param {string} upload_path - The path of the upload resource.
13
+ * @returns {Promise<UploadsResponse>} - A Promise resolving to the response data.
14
+ */
15
+ getUploadUrl(uploadPath: string): Promise<UploadsResponse>;
16
+ }
17
+ export { type UploadsResponse, UploadsApi };
@@ -0,0 +1,25 @@
1
+ import { BaseApi } from 'src/base-api';
2
+ /**
3
+ * The name of the resource to be used in API requests.
4
+ * @constant
5
+ * @private
6
+ * @type {string}
7
+ */
8
+ const resourceName = 'uploads';
9
+ /**
10
+ * API class for handling file uploads.
11
+ * @extends BaseApi
12
+ */
13
+ class UploadsApi extends BaseApi {
14
+ /**
15
+ * Retrieves an upload URL for a given upload path.
16
+ *
17
+ * @async
18
+ * @param {string} upload_path - The path of the upload resource.
19
+ * @returns {Promise<UploadsResponse>} - A Promise resolving to the response data.
20
+ */
21
+ async getUploadUrl(uploadPath) {
22
+ return await this.post(`${resourceName}/${uploadPath}`);
23
+ }
24
+ }
25
+ export { UploadsApi };
@@ -0,0 +1,5 @@
1
+ export interface UploadsResponse {
2
+ path: string;
3
+ url: string;
4
+ expiry: string;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",