@narrative.io/data-collaboration-sdk-ts 0.0.33 → 0.0.34
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/build/attributes/types.d.ts +6 -7
- package/build/datasets/types.d.ts +2 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +3 -2
- package/build/resources/index.d.ts +38 -0
- package/build/resources/index.js +42 -0
- package/build/resources/types.d.ts +31 -0
- package/build/resources/types.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Attribute = PrimitiveAttribute | ArrayAttribute | ObjectAttribute;
|
|
2
|
-
interface BaseAttribute {
|
|
2
|
+
export interface BaseAttribute {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
|
5
5
|
display_name?: string;
|
|
@@ -7,26 +7,25 @@ interface BaseAttribute {
|
|
|
7
7
|
type: string;
|
|
8
8
|
validations?: string[];
|
|
9
9
|
}
|
|
10
|
-
interface PrimitiveAttribute extends BaseAttribute {
|
|
10
|
+
export interface PrimitiveAttribute extends BaseAttribute {
|
|
11
11
|
type: 'string' | 'boolean' | 'double' | 'long' | 'timestamptz';
|
|
12
12
|
enum?: string[] | number[] | boolean[];
|
|
13
13
|
is_join_key?: boolean;
|
|
14
14
|
}
|
|
15
|
-
type SubAttribute = Partial<Omit<Attribute, 'name' | 'id'>> & {
|
|
15
|
+
export type SubAttribute = Partial<Omit<Attribute, 'name' | 'id'>> & {
|
|
16
16
|
type: string;
|
|
17
17
|
enum?: string[] | number[] | boolean[];
|
|
18
18
|
is_join_key?: boolean;
|
|
19
19
|
};
|
|
20
|
-
interface RefAttribute {
|
|
20
|
+
export interface RefAttribute {
|
|
21
21
|
$ref: number;
|
|
22
22
|
}
|
|
23
|
-
interface ArrayAttribute extends BaseAttribute {
|
|
23
|
+
export interface ArrayAttribute extends BaseAttribute {
|
|
24
24
|
type: 'array';
|
|
25
25
|
items: SubAttribute;
|
|
26
26
|
}
|
|
27
|
-
interface ObjectAttribute extends BaseAttribute {
|
|
27
|
+
export interface ObjectAttribute extends BaseAttribute {
|
|
28
28
|
type: 'object';
|
|
29
29
|
properties: Record<string, SubAttribute | RefAttribute>;
|
|
30
30
|
required?: string[];
|
|
31
31
|
}
|
|
32
|
-
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type DatasetTableSummaryAPIResponse, type Dataset, type DatasetTableSum
|
|
|
7
7
|
import { type HealthCheckResult } from './health/types';
|
|
8
8
|
import { type SampleRecords } from './rosetta-stone/types';
|
|
9
9
|
import { AttributeApi } from './attributes';
|
|
10
|
+
import { type Resource, ResourceApi, type BucketCreationRequest, type UpdateAccessTypeRequest } from './resources';
|
|
10
11
|
import { type Attribute } from './attributes/types';
|
|
11
12
|
import { PingApi } from './ping';
|
|
12
13
|
import { UploadsApi } from './uploads';
|
|
@@ -17,6 +18,6 @@ import { CompanyInfoApi, type CompanyInfo } from './company-info';
|
|
|
17
18
|
import { InstallationsApi, type Installation } from './installations';
|
|
18
19
|
declare class NarrativeApi extends BaseApi {
|
|
19
20
|
}
|
|
20
|
-
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi {
|
|
21
|
+
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi {
|
|
21
22
|
}
|
|
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, type FilePerSnapshotResponse };
|
|
23
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, type Resource, 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, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest };
|
package/build/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { HealthCheckApi } from './health';
|
|
|
4
4
|
import { RosettaStoneApi } from './rosetta-stone';
|
|
5
5
|
import { applyMixins } from './utils';
|
|
6
6
|
import { AttributeApi } from './attributes';
|
|
7
|
+
import { ResourceApi } from './resources';
|
|
7
8
|
import { PingApi } from './ping';
|
|
8
9
|
import { UploadsApi } from './uploads';
|
|
9
10
|
import { ProductsApi } from './products';
|
|
@@ -11,5 +12,5 @@ import { CompanyInfoApi } from './company-info';
|
|
|
11
12
|
import { InstallationsApi } from './installations';
|
|
12
13
|
class NarrativeApi extends BaseApi {
|
|
13
14
|
}
|
|
14
|
-
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi]);
|
|
15
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi };
|
|
15
|
+
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi]);
|
|
16
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview This module provides methods for fetching resources.
|
|
3
|
+
* @author Your Name
|
|
4
|
+
*/
|
|
5
|
+
import { type ApiRecords } from '../types';
|
|
6
|
+
import { BaseApi } from '../base-api';
|
|
7
|
+
import { type Resource, type BucketCreationRequest, type UpdateAccessTypeRequest } from './types';
|
|
8
|
+
export { type Resource, type BucketCreationRequest, type UpdateAccessTypeRequest };
|
|
9
|
+
/**
|
|
10
|
+
* @class ResourceApi
|
|
11
|
+
* @extends {BaseApi}
|
|
12
|
+
* @description This class provides methods for fetching resources.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ResourceApi extends BaseApi {
|
|
15
|
+
/**
|
|
16
|
+
* @function getBuckets
|
|
17
|
+
* @memberof ResourceApi
|
|
18
|
+
* @description Fetches a list of buckets for a given datasetId.
|
|
19
|
+
* @returns {Promise<ApiRecords<Resource>>} A promise that resolves to the list of resources.
|
|
20
|
+
*/
|
|
21
|
+
getBuckets(): Promise<ApiRecords<Resource>>;
|
|
22
|
+
/**
|
|
23
|
+
* @function createBucket
|
|
24
|
+
* @memberof ResourceApi
|
|
25
|
+
* @description Creates a new bucket.
|
|
26
|
+
* @param {BucketCreationRequest} request - The bucket creation request object.
|
|
27
|
+
* @returns {Promise<Resource>} A promise that resolves to the created resource.
|
|
28
|
+
*/
|
|
29
|
+
createBucket(request: BucketCreationRequest): Promise<Resource>;
|
|
30
|
+
/**
|
|
31
|
+
* @function updateAccessType
|
|
32
|
+
* @memberof ResourceApi
|
|
33
|
+
* @description Updates the access type of a resource.
|
|
34
|
+
* @param {UpdateAccessTypeRequest} request - The update access type request object.
|
|
35
|
+
* @returns {Promise<Resource>} A promise that resolves to the updated resource.
|
|
36
|
+
*/
|
|
37
|
+
updateAccessType(request: UpdateAccessTypeRequest): Promise<Resource>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview This module provides methods for fetching resources.
|
|
3
|
+
* @author Your Name
|
|
4
|
+
*/
|
|
5
|
+
import { BaseApi } from '../base-api';
|
|
6
|
+
const resourceName = 'resources';
|
|
7
|
+
/**
|
|
8
|
+
* @class ResourceApi
|
|
9
|
+
* @extends {BaseApi}
|
|
10
|
+
* @description This class provides methods for fetching resources.
|
|
11
|
+
*/
|
|
12
|
+
export class ResourceApi extends BaseApi {
|
|
13
|
+
/**
|
|
14
|
+
* @function getBuckets
|
|
15
|
+
* @memberof ResourceApi
|
|
16
|
+
* @description Fetches a list of buckets for a given datasetId.
|
|
17
|
+
* @returns {Promise<ApiRecords<Resource>>} A promise that resolves to the list of resources.
|
|
18
|
+
*/
|
|
19
|
+
async getBuckets() {
|
|
20
|
+
return await this.get(`${resourceName}/buckets`);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @function createBucket
|
|
24
|
+
* @memberof ResourceApi
|
|
25
|
+
* @description Creates a new bucket.
|
|
26
|
+
* @param {BucketCreationRequest} request - The bucket creation request object.
|
|
27
|
+
* @returns {Promise<Resource>} A promise that resolves to the created resource.
|
|
28
|
+
*/
|
|
29
|
+
async createBucket(request) {
|
|
30
|
+
return await this.post(`${resourceName}/buckets`, request);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @function updateAccessType
|
|
34
|
+
* @memberof ResourceApi
|
|
35
|
+
* @description Updates the access type of a resource.
|
|
36
|
+
* @param {UpdateAccessTypeRequest} request - The update access type request object.
|
|
37
|
+
* @returns {Promise<Resource>} A promise that resolves to the updated resource.
|
|
38
|
+
*/
|
|
39
|
+
async updateAccessType(request) {
|
|
40
|
+
return await this.post(`${resourceName}/buckets/access`, request);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface Resource {
|
|
2
|
+
id: string;
|
|
3
|
+
company_id: number;
|
|
4
|
+
auth: {
|
|
5
|
+
type: 'bucket_policy' | 'role';
|
|
6
|
+
account_id: string;
|
|
7
|
+
external_id?: string;
|
|
8
|
+
role?: string;
|
|
9
|
+
};
|
|
10
|
+
name: string;
|
|
11
|
+
created_at: string;
|
|
12
|
+
updated_at: string;
|
|
13
|
+
is_access_mutable: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface RoleBasedBucketAccess {
|
|
16
|
+
type: 'role';
|
|
17
|
+
external_id: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PolicyBasedBucketAccess {
|
|
20
|
+
type: 'bucket_policy';
|
|
21
|
+
}
|
|
22
|
+
export interface UpdateAccessTypeRequest {
|
|
23
|
+
bucket_name: string;
|
|
24
|
+
new_access: BucketAccess;
|
|
25
|
+
}
|
|
26
|
+
export type BucketAccess = RoleBasedBucketAccess | PolicyBasedBucketAccess;
|
|
27
|
+
export interface BucketCreationRequest {
|
|
28
|
+
account_id: string;
|
|
29
|
+
resource_id: string;
|
|
30
|
+
access: BucketAccess;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|