octopian-configuration-apis 1.0.39 → 1.0.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopian-configuration-apis",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "a configuration api sdk",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -2767,7 +2767,7 @@ export async function GetKnowledgeList(AuthToken = null, Timeout = 30000) {
2767
2767
  */
2768
2768
  export async function GetKnowledgeByOntologyId(Input, AuthToken = null, Timeout = 30000) {
2769
2769
  let APIResponse = await apiHandler.GetMethod(
2770
- ConfigurationAPIConstants.uriGetKnowledgeByOntologyId(Input.ontologyId, Input.conceptId),
2770
+ ConfigurationAPIConstants.uriGetKnowledgeByOntologyId(Input.ontologyId, Input.conceptId, Input.page, Input.pageSize),
2771
2771
  AuthToken,
2772
2772
  Timeout
2773
2773
  );
@@ -3184,4 +3184,31 @@ export async function GetKnowledgeObjectDetail(Input, AuthToken = null, Timeout
3184
3184
  return APIResponse;
3185
3185
  }
3186
3186
 
3187
+ /**
3188
+ * Export knowledge for a model, optionally filtered by concept GUID.
3189
+ * Calls GET /ontology/api/ExportKnowledge and returns a storage FilePath.
3190
+ *
3191
+ * @param {ExportKnowledgeInput} Input - The input for the API (modelId required, conceptGuid optional).
3192
+ * @param {string} AuthToken - The authentication token.
3193
+ * @param {number} Timeout - The timeout in milliseconds.
3194
+ * @returns {Promise<BaseResponse<ExportKnowledgeOutput | BaseErrorResponse>>} - The response from the API.
3195
+ */
3196
+ export async function ExportKnowledge(Input, AuthToken = null, Timeout = 30000) {
3197
+ // Validate required query parameter before building the request URI.
3198
+ if (!Input || typeof Input.modelId !== "string" || Input.modelId.trim() === "") {
3199
+ return {
3200
+ Message: "Error",
3201
+ StatusCode: 400,
3202
+ Result: "modelId is required to export knowledge.",
3203
+ };
3204
+ }
3205
+
3206
+ let APIResponse = await apiHandler.GetMethod(
3207
+ ConfigurationAPIConstants.uriExportKnowledge(Input.modelId, Input.conceptGuid),
3208
+ AuthToken,
3209
+ Timeout
3210
+ );
3211
+ return APIResponse;
3212
+ }
3213
+
3187
3214
  //#endregion
package/src/index.d.ts CHANGED
@@ -135,6 +135,8 @@ import { GetKnowledgeObjectDetailInput } from "./modals/input-modals/GetKnowledg
135
135
  import { GetOntologyConceptListOutput } from "./modals/output-modals/GetOntologyConceptListOutput";
136
136
  import { GetKnowledgeObjectListOutput } from "./modals/output-modals/GetKnowledgeObjectListOutput";
137
137
  import { GetKnowledgeObjectDetailOutput } from "./modals/output-modals/GetKnowledgeObjectDetailOutput";
138
+ import { ExportKnowledgeInput } from "./modals/input-modals/ExportKnowledgeInput";
139
+ import { ExportKnowledgeOutput } from "./modals/output-modals/ExportKnowledgeOutput";
138
140
  // Define each module with its specific functions
139
141
  interface ConfigurationServices {
140
142
  /**
@@ -2332,6 +2334,19 @@ interface ConfigurationServices {
2332
2334
  AuthToken?: string | null,
2333
2335
  Timeout?: number | null,
2334
2336
  ) => BaseResponse<GetKnowledgeObjectDetailOutput | BaseErrorResponse>;
2337
+
2338
+ /**
2339
+ * Export knowledge for a model, optionally filtered by concept GUID.
2340
+ * @param {ExportKnowledgeInput} Input - The input for the API
2341
+ * @param {string} AuthToken - The authentication token
2342
+ * @param {number} Timeout - The timeout in milliseconds
2343
+ * @returns {Promise<BaseResponse<ExportKnowledgeOutput | BaseErrorResponse>>} - The response from the API
2344
+ */
2345
+ ExportKnowledge: (
2346
+ Input: ExportKnowledgeInput,
2347
+ AuthToken?: string | null,
2348
+ Timeout?: number | null,
2349
+ ) => BaseResponse<ExportKnowledgeOutput | BaseErrorResponse>;
2335
2350
  }
2336
2351
 
2337
2352
  // interface DABConfigurationServices {
@@ -2596,4 +2611,6 @@ export {
2596
2611
  GetOntologyConceptListOutput,
2597
2612
  GetKnowledgeObjectListOutput,
2598
2613
  GetKnowledgeObjectDetailOutput,
2614
+ ExportKnowledgeInput,
2615
+ ExportKnowledgeOutput,
2599
2616
  };
package/src/index.js CHANGED
@@ -99,7 +99,8 @@ const {
99
99
  GetOntologyConceptList,
100
100
  GetModelConceptList,
101
101
  GetKnowledgeObjectList,
102
- GetKnowledgeObjectDetail
102
+ GetKnowledgeObjectDetail,
103
+ ExportKnowledge
103
104
  } = require("./CoreServices/configurationServices");
104
105
  // const {
105
106
  // GetEnglishNewsList,
@@ -222,7 +223,8 @@ const ConfigurationServices = {
222
223
  GetOntologyConceptList,
223
224
  GetModelConceptList,
224
225
  GetKnowledgeObjectList,
225
- GetKnowledgeObjectDetail
226
+ GetKnowledgeObjectDetail,
227
+ ExportKnowledge
226
228
  };
227
229
 
228
230
  // const DABConfigurationServices = {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Input for exporting knowledge for a model, optionally scoped to a concept.
3
+ */
4
+ export interface ExportKnowledgeInput {
5
+ /** Model ID used in the query string (for example "model:guid"). */
6
+ modelId: string;
7
+ /** Optional concept GUID used to narrow the export. */
8
+ conceptGuid?: string;
9
+ }
@@ -1,4 +1,6 @@
1
1
  export interface GetKnowledgeByOntologyIdInput {
2
2
  ontologyId: string;
3
3
  conceptId?: string;
4
+ page?: number;
5
+ pageSize?: number;
4
6
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Result payload for ExportKnowledge.
3
+ * Contains a blob URL to the exported knowledge file.
4
+ */
5
+ export interface ExportKnowledgeOutput {
6
+ /** Absolute URL of the exported knowledge file in storage. */
7
+ FilePath: string;
8
+ }
@@ -216,8 +216,8 @@ export class ConfigurationAPIConstants {
216
216
  static uriGetKnowledgeList() {
217
217
  return ontologyURI + "/api/GetKnowledgeList";
218
218
  }
219
- static uriGetKnowledgeByOntologyId( id,conceptId = null ) {
220
- return ontologyURI + `/api/GetKnowledgeByOntologyId?modelId=${id}` + (conceptId ? `&conceptGuid=${conceptId}` : '');
219
+ static uriGetKnowledgeByOntologyId( id,conceptId = null, page = 0, pageSize = 0 ) {
220
+ return ontologyURI + `/api/GetKnowledgeByOntologyId?modelId=${id}` + (conceptId ? `&conceptGuid=${conceptId}` : '') + `&pageIndex=${page}&pageSize=${pageSize}`;
221
221
  }
222
222
  static uriUpdateKnowledge() {
223
223
  return ontologyURI + "/api/UpdateKnowledge";
@@ -334,6 +334,20 @@ export class ConfigurationAPIConstants {
334
334
  static uriGetKnowledgeObjectDetail(objectGuid) {
335
335
  return ontologyURI + `/api/GetKnowledgeObjectDetail?objectGuid=${objectGuid}`;
336
336
  }
337
+
338
+ /**
339
+ * Builds the ExportKnowledge URI with required modelId and optional conceptGuid.
340
+ * @param {string} modelId - Ontology model identifier.
341
+ * @param {string | null} [conceptGuid=null] - Optional concept GUID filter.
342
+ * @returns {string} Relative ontology ExportKnowledge path with query string.
343
+ */
344
+ static uriExportKnowledge(modelId, conceptGuid = null) {
345
+ const queryParts = [`modelId=${encodeURIComponent(modelId)}`];
346
+ if (conceptGuid !== null && conceptGuid !== undefined && conceptGuid !== "") {
347
+ queryParts.push(`conceptGuid=${encodeURIComponent(conceptGuid)}`);
348
+ }
349
+ return ontologyURI + `/api/ExportKnowledge?${queryParts.join("&")}`;
350
+ }
337
351
  }
338
352
 
339
353
  //#region BaseConstants