@narrative.io/data-collaboration-sdk-ts 0.9.0 → 0.10.0
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/access-rules/index.d.ts +15 -16
- package/build/base-api.js +6 -1
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { ApiRecords, ApiRecordsV2 } from "../types";
|
|
1
|
+
import type { ApiRecords, ApiRecordsV2, PaginationOptions } from "../types";
|
|
2
2
|
import { BaseApi } from "../base-api";
|
|
3
3
|
import type { AccessRule, AccessRuleV2 } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Represents the parameters used to retrieve access rules.
|
|
6
|
-
* This interface extends a generic record allowing for
|
|
6
|
+
* This interface extends a generic record allowing for a range of value types including arrays.
|
|
7
|
+
* It's primarily used to filter access rules.
|
|
7
8
|
*
|
|
8
9
|
* @interface GetAccessRulesParameters
|
|
9
|
-
* @extends {Record<string, string | number | boolean | undefined>}
|
|
10
|
+
* @extends {Record<string, string | number | boolean | undefined | string[] | number[]>}
|
|
10
11
|
*
|
|
11
12
|
* @property {boolean} [owned_only] - Optional filter to retrieve only the access rules owned by the user.
|
|
12
13
|
* Setting this to true will fetch only the access rules that are owned.
|
|
@@ -14,23 +15,21 @@ import type { AccessRule, AccessRuleV2 } from "./types";
|
|
|
14
15
|
* @property {boolean} [shared_only] - Optional filter to retrieve only the access rules shared with the user.
|
|
15
16
|
* Setting this to true will fetch only the access rules that are shared.
|
|
16
17
|
*
|
|
17
|
-
* @property {string} [tag] - Optional filter to retrieve access rules
|
|
18
|
-
*
|
|
18
|
+
* @property {string | string[]} [tag] - Optional filter to retrieve access rules tagged with a specific tag or tags.
|
|
19
|
+
* Provide a single tag or an array of tags to fetch access rules associated with them.
|
|
19
20
|
*
|
|
20
|
-
* @property {number} [company_id] - Optional filter to retrieve access rules associated with a specific company.
|
|
21
|
-
*
|
|
21
|
+
* @property {number | number[]} [company_id] - Optional filter to retrieve access rules associated with a specific company or companies.
|
|
22
|
+
* Provide a company ID or an array of IDs to fetch access rules related to those companies.
|
|
22
23
|
*
|
|
23
|
-
* @property {number} [
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @property {number} [per_page] - Optional pagination parameter that specifies the number of records to return per page.
|
|
27
|
-
* Provide a number to set the maximum number of records returned in one page of results.
|
|
24
|
+
* @property {number | number[]} [dataset_id] - Optional filter to retrieve access rules associated with a specific dataset or datasets.
|
|
25
|
+
* Provide a dataset ID or an array of IDs to fetch access rules related to those datasets.
|
|
28
26
|
*/
|
|
29
|
-
interface GetAccessRulesParameters extends Record<string, string | number | boolean | undefined> {
|
|
27
|
+
interface GetAccessRulesParameters extends Record<string, string | number | boolean | undefined | string[] | number[]> {
|
|
30
28
|
owned_only?: boolean;
|
|
31
29
|
shared_only?: boolean;
|
|
32
|
-
tag?: string;
|
|
33
|
-
company_id?: number;
|
|
30
|
+
tag?: string | string[];
|
|
31
|
+
company_id?: number | number[];
|
|
32
|
+
dataset_id?: number | number[];
|
|
34
33
|
}
|
|
35
34
|
/**
|
|
36
35
|
* @module AccessRulesApi
|
|
@@ -105,6 +104,6 @@ declare class AccessRulesApi extends BaseApi {
|
|
|
105
104
|
* @description This method fetches access rules based on the specified filters and pagination options provided in the parameters.
|
|
106
105
|
* It returns a promise that resolves to a list of access rules that match the criteria.
|
|
107
106
|
*/
|
|
108
|
-
getAccessableAccessRules(parameters: GetAccessRulesParameters): Promise<ApiRecordsV2<AccessRuleV2>>;
|
|
107
|
+
getAccessableAccessRules(parameters: GetAccessRulesParameters & PaginationOptions): Promise<ApiRecordsV2<AccessRuleV2>>;
|
|
109
108
|
}
|
|
110
109
|
export { AccessRulesApi, type AccessRule, type AccessRuleV2, type GetAccessRulesParameters, };
|
package/build/base-api.js
CHANGED
|
@@ -157,9 +157,14 @@ export class BaseApi {
|
|
|
157
157
|
const queryParameters = [];
|
|
158
158
|
if (parameters != null) {
|
|
159
159
|
for (const [key, value] of Object.entries(parameters)) {
|
|
160
|
-
if (value !== undefined && value !== null) {
|
|
160
|
+
if (value !== undefined && value !== null && !Array.isArray(value)) {
|
|
161
161
|
queryParameters.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
162
162
|
}
|
|
163
|
+
if (Array.isArray(value)) {
|
|
164
|
+
for (const val of value) {
|
|
165
|
+
queryParameters.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
return queryParameters.length > 0 ? `?${queryParameters.join("&")}` : "";
|