@narrative.io/data-collaboration-sdk-ts 0.9.0 → 0.10.1

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.
@@ -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 string, number, boolean, or undefined values.
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 that are tagged with a specific tag.
18
- * Provide the tag string to fetch access rules associated with it.
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
- * Provide the company ID to fetch access rules related to that company.
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} [offset] - Optional pagination parameter that specifies the starting point for the list of results.
24
- * Provide an offset number to skip a specific number of records in the result set.
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, };
@@ -9,6 +9,10 @@ export interface AccessRule {
9
9
  pricing: AccessRulePricing;
10
10
  status: "active";
11
11
  updated_at: string;
12
+ query?: string;
13
+ display_name?: string;
14
+ image?: string;
15
+ tags?: string[];
12
16
  }
13
17
  type AccessRuleDatasetId = number;
14
18
  interface AccessRulePolicyDataset {
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("&")}` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",