phenoml 13.0.0 → 14.0.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/dist/cjs/BaseClient.d.ts +3 -0
- package/dist/cjs/BaseClient.js +17 -2
- package/dist/cjs/api/resources/agent/client/Client.d.ts +24 -12
- package/dist/cjs/api/resources/agent/client/Client.js +41 -21
- package/dist/cjs/api/resources/agent/client/requests/AgentChatRequest.d.ts +11 -0
- package/dist/cjs/api/resources/agent/client/requests/AgentStreamChatRequest.d.ts +1 -0
- package/dist/cjs/api/resources/agent/resources/prompts/client/Client.d.ts +13 -25
- package/dist/cjs/api/resources/agent/resources/prompts/client/Client.js +19 -70
- package/dist/cjs/api/resources/agent/resources/prompts/client/requests/AgentPromptsCreateRequest.d.ts +4 -1
- package/dist/cjs/api/resources/agent/resources/prompts/client/requests/AgentPromptsUpdateRequest.d.ts +7 -1
- package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.d.ts +4 -1
- package/dist/cjs/api/resources/authtoken/resources/auth/client/Client.js +5 -2
- package/dist/cjs/api/resources/authtoken/resources/auth/client/requests/ClientCredentialsRequest.d.ts +4 -1
- package/dist/cjs/api/resources/cohort/client/Client.js +1 -1
- package/dist/cjs/api/resources/construe/client/Client.d.ts +95 -11
- package/dist/cjs/api/resources/construe/client/Client.js +134 -22
- package/dist/cjs/api/resources/construe/client/requests/ExtractRequest.d.ts +60 -1
- package/dist/cjs/api/resources/construe/client/requests/FeedbackRequest.d.ts +14 -7
- package/dist/cjs/api/resources/construe/client/requests/UploadRequest.d.ts +18 -1
- package/dist/cjs/api/resources/fhir/client/Client.js +10 -6
- package/dist/cjs/api/resources/fhirProvider/client/Client.d.ts +10 -7
- package/dist/cjs/api/resources/fhirProvider/client/Client.js +17 -14
- package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.ts +5 -3
- package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.d.ts +1 -1
- package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.d.ts +1 -1
- package/dist/cjs/api/resources/fhirProvider/types/FhirProviderSandboxInfo.d.ts +6 -4
- package/dist/cjs/api/resources/fhirProvider/types/FhirProviderTemplate.d.ts +10 -5
- package/dist/cjs/api/resources/lang2Fhir/client/Client.d.ts +17 -6
- package/dist/cjs/api/resources/lang2Fhir/client/Client.js +23 -12
- package/dist/cjs/api/resources/lang2Fhir/client/requests/CreateMultiRequest.d.ts +2 -1
- package/dist/cjs/api/resources/lang2Fhir/client/requests/CreateRequest.d.ts +9 -2
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.ts +2 -1
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentRequest.d.ts +1 -1
- package/dist/cjs/api/resources/lang2Fhir/client/requests/ProfileUploadRequest.d.ts +3 -1
- package/dist/cjs/api/resources/lang2Fhir/types/SearchResponse.d.ts +2 -2
- package/dist/cjs/api/resources/summary/client/Client.d.ts +74 -9
- package/dist/cjs/api/resources/summary/client/Client.js +80 -15
- package/dist/cjs/api/resources/summary/client/requests/CreateSummaryRequest.d.ts +67 -11
- package/dist/cjs/api/resources/summary/client/requests/CreateSummaryTemplateRequest.d.ts +4 -4
- package/dist/cjs/api/resources/summary/client/requests/UpdateSummaryTemplateRequest.d.ts +4 -4
- package/dist/cjs/api/resources/summary/types/index.d.ts +0 -2
- package/dist/cjs/api/resources/summary/types/index.js +0 -2
- package/dist/cjs/api/resources/tools/client/Client.d.ts +7 -3
- package/dist/cjs/api/resources/tools/client/Client.js +11 -7
- package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateMultiRequest.d.ts +1 -0
- package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.ts +3 -2
- package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +3 -1
- package/dist/cjs/api/resources/tools/resources/mcpServer/client/Client.js +4 -4
- package/dist/cjs/api/resources/tools/resources/mcpServer/resources/tools/client/Client.js +4 -4
- package/dist/cjs/api/resources/tools/types/McpServer.d.ts +10 -0
- package/dist/cjs/api/resources/tools/types/McpServerResponse.d.ts +12 -16
- package/dist/cjs/api/resources/tools/types/McpServerTool.d.ts +14 -0
- package/dist/cjs/api/resources/tools/types/McpServerToolResponse.d.ts +7 -20
- package/dist/cjs/api/resources/tools/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/tools/types/index.js +2 -0
- package/dist/cjs/api/resources/workflows/client/Client.d.ts +21 -9
- package/dist/cjs/api/resources/workflows/client/Client.js +43 -15
- package/dist/cjs/api/resources/workflows/client/requests/CreateWorkflowRequest.d.ts +3 -2
- package/dist/cjs/api/resources/workflows/client/requests/ExecuteWorkflowRequest.d.ts +11 -1
- package/dist/cjs/api/resources/workflows/client/requests/UpdateWorkflowRequest.d.ts +6 -5
- package/dist/cjs/core/auth/AuthProvider.d.ts +1 -0
- package/dist/cjs/core/auth/AuthProvider.js +7 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +2 -2
- package/dist/cjs/core/auth/BasicAuth.js +7 -1
- package/dist/cjs/core/auth/index.d.ts +1 -1
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/fetcher/Fetcher.d.ts +8 -0
- package/dist/cjs/core/fetcher/Fetcher.js +13 -8
- package/dist/cjs/core/fetcher/requestWithRetries.js +4 -1
- package/dist/cjs/core/url/QueryStringBuilder.d.ts +47 -0
- package/dist/cjs/core/url/QueryStringBuilder.js +83 -0
- package/dist/cjs/core/url/index.d.ts +1 -0
- package/dist/cjs/core/url/index.js +3 -1
- package/dist/cjs/core/url/qs.d.ts +2 -1
- package/dist/cjs/core/url/qs.js +24 -12
- package/dist/cjs/errors/handleNonStatusCodeError.js +4 -1
- package/dist/cjs/errors/phenomlError.d.ts +3 -1
- package/dist/cjs/errors/phenomlError.js +4 -1
- package/dist/cjs/errors/phenomlTimeoutError.d.ts +4 -1
- package/dist/cjs/errors/phenomlTimeoutError.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +3 -0
- package/dist/esm/BaseClient.mjs +17 -2
- package/dist/esm/api/resources/agent/client/Client.d.mts +24 -12
- package/dist/esm/api/resources/agent/client/Client.mjs +41 -21
- package/dist/esm/api/resources/agent/client/requests/AgentChatRequest.d.mts +11 -0
- package/dist/esm/api/resources/agent/client/requests/AgentStreamChatRequest.d.mts +1 -0
- package/dist/esm/api/resources/agent/resources/prompts/client/Client.d.mts +13 -25
- package/dist/esm/api/resources/agent/resources/prompts/client/Client.mjs +19 -70
- package/dist/esm/api/resources/agent/resources/prompts/client/requests/AgentPromptsCreateRequest.d.mts +4 -1
- package/dist/esm/api/resources/agent/resources/prompts/client/requests/AgentPromptsUpdateRequest.d.mts +7 -1
- package/dist/esm/api/resources/authtoken/resources/auth/client/Client.d.mts +4 -1
- package/dist/esm/api/resources/authtoken/resources/auth/client/Client.mjs +5 -2
- package/dist/esm/api/resources/authtoken/resources/auth/client/requests/ClientCredentialsRequest.d.mts +4 -1
- package/dist/esm/api/resources/cohort/client/Client.mjs +1 -1
- package/dist/esm/api/resources/construe/client/Client.d.mts +95 -11
- package/dist/esm/api/resources/construe/client/Client.mjs +134 -22
- package/dist/esm/api/resources/construe/client/requests/ExtractRequest.d.mts +60 -1
- package/dist/esm/api/resources/construe/client/requests/FeedbackRequest.d.mts +14 -7
- package/dist/esm/api/resources/construe/client/requests/UploadRequest.d.mts +18 -1
- package/dist/esm/api/resources/fhir/client/Client.mjs +10 -6
- package/dist/esm/api/resources/fhirProvider/client/Client.d.mts +10 -7
- package/dist/esm/api/resources/fhirProvider/client/Client.mjs +17 -14
- package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.mts +5 -3
- package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderRemoveAuthConfigRequest.d.mts +1 -1
- package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderSetActiveAuthConfigRequest.d.mts +1 -1
- package/dist/esm/api/resources/fhirProvider/types/FhirProviderSandboxInfo.d.mts +6 -4
- package/dist/esm/api/resources/fhirProvider/types/FhirProviderTemplate.d.mts +10 -5
- package/dist/esm/api/resources/lang2Fhir/client/Client.d.mts +17 -6
- package/dist/esm/api/resources/lang2Fhir/client/Client.mjs +23 -12
- package/dist/esm/api/resources/lang2Fhir/client/requests/CreateMultiRequest.d.mts +2 -1
- package/dist/esm/api/resources/lang2Fhir/client/requests/CreateRequest.d.mts +9 -2
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.mts +2 -1
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentRequest.d.mts +1 -1
- package/dist/esm/api/resources/lang2Fhir/client/requests/ProfileUploadRequest.d.mts +3 -1
- package/dist/esm/api/resources/lang2Fhir/types/SearchResponse.d.mts +2 -2
- package/dist/esm/api/resources/summary/client/Client.d.mts +74 -9
- package/dist/esm/api/resources/summary/client/Client.mjs +80 -15
- package/dist/esm/api/resources/summary/client/requests/CreateSummaryRequest.d.mts +67 -11
- package/dist/esm/api/resources/summary/client/requests/CreateSummaryTemplateRequest.d.mts +4 -4
- package/dist/esm/api/resources/summary/client/requests/UpdateSummaryTemplateRequest.d.mts +4 -4
- package/dist/esm/api/resources/summary/types/index.d.mts +0 -2
- package/dist/esm/api/resources/summary/types/index.mjs +0 -2
- package/dist/esm/api/resources/tools/client/Client.d.mts +7 -3
- package/dist/esm/api/resources/tools/client/Client.mjs +11 -7
- package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateMultiRequest.d.mts +1 -0
- package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.mts +3 -2
- package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +3 -1
- package/dist/esm/api/resources/tools/resources/mcpServer/client/Client.mjs +4 -4
- package/dist/esm/api/resources/tools/resources/mcpServer/resources/tools/client/Client.mjs +4 -4
- package/dist/esm/api/resources/tools/types/McpServer.d.mts +10 -0
- package/dist/esm/api/resources/tools/types/McpServerResponse.d.mts +12 -16
- package/dist/esm/api/resources/tools/types/McpServerTool.d.mts +14 -0
- package/dist/esm/api/resources/tools/types/McpServerToolResponse.d.mts +7 -20
- package/dist/esm/api/resources/tools/types/index.d.mts +2 -0
- package/dist/esm/api/resources/tools/types/index.mjs +2 -0
- package/dist/esm/api/resources/workflows/client/Client.d.mts +21 -9
- package/dist/esm/api/resources/workflows/client/Client.mjs +43 -15
- package/dist/esm/api/resources/workflows/client/requests/CreateWorkflowRequest.d.mts +3 -2
- package/dist/esm/api/resources/workflows/client/requests/ExecuteWorkflowRequest.d.mts +11 -1
- package/dist/esm/api/resources/workflows/client/requests/UpdateWorkflowRequest.d.mts +6 -5
- package/dist/esm/core/auth/AuthProvider.d.mts +1 -0
- package/dist/esm/core/auth/AuthProvider.mjs +6 -1
- package/dist/esm/core/auth/BasicAuth.d.mts +2 -2
- package/dist/esm/core/auth/BasicAuth.mjs +7 -1
- package/dist/esm/core/auth/index.d.mts +1 -1
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +8 -0
- package/dist/esm/core/fetcher/Fetcher.mjs +13 -8
- package/dist/esm/core/fetcher/requestWithRetries.mjs +4 -1
- package/dist/esm/core/url/QueryStringBuilder.d.mts +47 -0
- package/dist/esm/core/url/QueryStringBuilder.mjs +80 -0
- package/dist/esm/core/url/index.d.mts +1 -0
- package/dist/esm/core/url/index.mjs +1 -0
- package/dist/esm/core/url/qs.d.mts +2 -1
- package/dist/esm/core/url/qs.mjs +24 -12
- package/dist/esm/errors/handleNonStatusCodeError.mjs +4 -1
- package/dist/esm/errors/phenomlError.d.mts +3 -1
- package/dist/esm/errors/phenomlError.mjs +4 -1
- package/dist/esm/errors/phenomlTimeoutError.d.mts +4 -1
- package/dist/esm/errors/phenomlTimeoutError.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +140 -124
- package/dist/cjs/api/resources/summary/types/FhirBundle.d.ts +0 -13
- package/dist/cjs/api/resources/summary/types/FhirResource.d.ts +0 -6
- package/dist/esm/api/resources/summary/types/FhirBundle.d.mts +0 -13
- package/dist/esm/api/resources/summary/types/FhirResource.d.mts +0 -6
- /package/dist/cjs/api/resources/{summary/types/FhirBundle.js → tools/types/McpServer.js} +0 -0
- /package/dist/cjs/api/resources/{summary/types/FhirResource.js → tools/types/McpServerTool.js} +0 -0
- /package/dist/esm/api/resources/{summary/types/FhirBundle.mjs → tools/types/McpServer.mjs} +0 -0
- /package/dist/esm/api/resources/{summary/types/FhirResource.mjs → tools/types/McpServerTool.mjs} +0 -0
|
@@ -18,7 +18,9 @@ __exportStar(require("./CohortResponse.js"), exports);
|
|
|
18
18
|
__exportStar(require("./Lang2FhirAndCreateMultiResponse.js"), exports);
|
|
19
19
|
__exportStar(require("./Lang2FhirAndCreateResponse.js"), exports);
|
|
20
20
|
__exportStar(require("./Lang2FhirAndSearchResponse.js"), exports);
|
|
21
|
+
__exportStar(require("./McpServer.js"), exports);
|
|
21
22
|
__exportStar(require("./McpServerResponse.js"), exports);
|
|
23
|
+
__exportStar(require("./McpServerTool.js"), exports);
|
|
22
24
|
__exportStar(require("./McpServerToolCallResponse.js"), exports);
|
|
23
25
|
__exportStar(require("./McpServerToolResponse.js"), exports);
|
|
24
26
|
__exportStar(require("./SearchConcept.js"), exports);
|
|
@@ -42,11 +42,12 @@ export declare class WorkflowsClient {
|
|
|
42
42
|
* await client.workflows.create({
|
|
43
43
|
* verbose: true,
|
|
44
44
|
* name: "Patient Data Mapping Workflow",
|
|
45
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
45
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
46
46
|
* sample_data: {
|
|
47
47
|
* "patient_last_name": "Rippin",
|
|
48
48
|
* "patient_first_name": "Clay",
|
|
49
|
-
* "diagnosis_code": "I10"
|
|
49
|
+
* "diagnosis_code": "I10",
|
|
50
|
+
* "encounter_date": "2024-01-15"
|
|
50
51
|
* },
|
|
51
52
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
52
53
|
* })
|
|
@@ -88,12 +89,13 @@ export declare class WorkflowsClient {
|
|
|
88
89
|
* @example
|
|
89
90
|
* await client.workflows.update("id", {
|
|
90
91
|
* verbose: true,
|
|
91
|
-
* name: "
|
|
92
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
92
|
+
* name: "Patient Data Mapping Workflow (v2)",
|
|
93
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
93
94
|
* sample_data: {
|
|
94
|
-
* "patient_last_name": "
|
|
95
|
-
* "patient_first_name": "
|
|
96
|
-
* "diagnosis_code": "
|
|
95
|
+
* "patient_last_name": "Rippin",
|
|
96
|
+
* "patient_first_name": "Clay",
|
|
97
|
+
* "diagnosis_code": "I10",
|
|
98
|
+
* "encounter_date": "2024-01-15"
|
|
97
99
|
* },
|
|
98
100
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
99
101
|
* })
|
|
@@ -130,14 +132,24 @@ export declare class WorkflowsClient {
|
|
|
130
132
|
* @throws {@link phenoml.workflows.InternalServerError}
|
|
131
133
|
*
|
|
132
134
|
* @example
|
|
133
|
-
* await client.workflows.execute("
|
|
135
|
+
* await client.workflows.execute("7a8b9c0d-1234-5678-abcd-ef9876543210", {
|
|
134
136
|
* input_data: {
|
|
135
137
|
* "patient_last_name": "Johnson",
|
|
136
138
|
* "patient_first_name": "Mary",
|
|
137
139
|
* "diagnosis_code": "M79.3",
|
|
138
|
-
* "encounter_date": "2024-
|
|
140
|
+
* "encounter_date": "2024-03-20"
|
|
139
141
|
* }
|
|
140
142
|
* })
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* await client.workflows.execute("7a8b9c0d-1234-5678-abcd-ef9876543210", {
|
|
146
|
+
* input_data: {
|
|
147
|
+
* "patient_last_name": "Johnson",
|
|
148
|
+
* "patient_first_name": "Mary",
|
|
149
|
+
* "diagnosis_code": "M79.3"
|
|
150
|
+
* },
|
|
151
|
+
* preview: true
|
|
152
|
+
* })
|
|
141
153
|
*/
|
|
142
154
|
execute(id: string, request: phenoml.workflows.ExecuteWorkflowRequest, requestOptions?: WorkflowsClient.RequestOptions): core.HttpResponsePromise<phenoml.workflows.ExecuteWorkflowResponse>;
|
|
143
155
|
private __execute;
|
|
@@ -97,7 +97,11 @@ class WorkflowsClient {
|
|
|
97
97
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "workflows"),
|
|
98
98
|
method: "GET",
|
|
99
99
|
headers: _headers,
|
|
100
|
-
|
|
100
|
+
queryString: core.url
|
|
101
|
+
.queryBuilder()
|
|
102
|
+
.addMany(_queryParams)
|
|
103
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
104
|
+
.build(),
|
|
101
105
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
102
106
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
103
107
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -144,11 +148,12 @@ class WorkflowsClient {
|
|
|
144
148
|
* await client.workflows.create({
|
|
145
149
|
* verbose: true,
|
|
146
150
|
* name: "Patient Data Mapping Workflow",
|
|
147
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
151
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
148
152
|
* sample_data: {
|
|
149
153
|
* "patient_last_name": "Rippin",
|
|
150
154
|
* "patient_first_name": "Clay",
|
|
151
|
-
* "diagnosis_code": "I10"
|
|
155
|
+
* "diagnosis_code": "I10",
|
|
156
|
+
* "encounter_date": "2024-01-15"
|
|
152
157
|
* },
|
|
153
158
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
154
159
|
* })
|
|
@@ -170,7 +175,11 @@ class WorkflowsClient {
|
|
|
170
175
|
method: "POST",
|
|
171
176
|
headers: _headers,
|
|
172
177
|
contentType: "application/json",
|
|
173
|
-
|
|
178
|
+
queryString: core.url
|
|
179
|
+
.queryBuilder()
|
|
180
|
+
.addMany(_queryParams)
|
|
181
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
182
|
+
.build(),
|
|
174
183
|
requestType: "json",
|
|
175
184
|
body: _body,
|
|
176
185
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
@@ -239,7 +248,11 @@ class WorkflowsClient {
|
|
|
239
248
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `workflows/${core.url.encodePathParam(id)}`),
|
|
240
249
|
method: "GET",
|
|
241
250
|
headers: _headers,
|
|
242
|
-
|
|
251
|
+
queryString: core.url
|
|
252
|
+
.queryBuilder()
|
|
253
|
+
.addMany(_queryParams)
|
|
254
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
255
|
+
.build(),
|
|
243
256
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
244
257
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
245
258
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -289,12 +302,13 @@ class WorkflowsClient {
|
|
|
289
302
|
* @example
|
|
290
303
|
* await client.workflows.update("id", {
|
|
291
304
|
* verbose: true,
|
|
292
|
-
* name: "
|
|
293
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
305
|
+
* name: "Patient Data Mapping Workflow (v2)",
|
|
306
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
294
307
|
* sample_data: {
|
|
295
|
-
* "patient_last_name": "
|
|
296
|
-
* "patient_first_name": "
|
|
297
|
-
* "diagnosis_code": "
|
|
308
|
+
* "patient_last_name": "Rippin",
|
|
309
|
+
* "patient_first_name": "Clay",
|
|
310
|
+
* "diagnosis_code": "I10",
|
|
311
|
+
* "encounter_date": "2024-01-15"
|
|
298
312
|
* },
|
|
299
313
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
300
314
|
* })
|
|
@@ -316,7 +330,11 @@ class WorkflowsClient {
|
|
|
316
330
|
method: "PUT",
|
|
317
331
|
headers: _headers,
|
|
318
332
|
contentType: "application/json",
|
|
319
|
-
|
|
333
|
+
queryString: core.url
|
|
334
|
+
.queryBuilder()
|
|
335
|
+
.addMany(_queryParams)
|
|
336
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
337
|
+
.build(),
|
|
320
338
|
requestType: "json",
|
|
321
339
|
body: _body,
|
|
322
340
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
@@ -380,7 +398,7 @@ class WorkflowsClient {
|
|
|
380
398
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `workflows/${core.url.encodePathParam(id)}`),
|
|
381
399
|
method: "DELETE",
|
|
382
400
|
headers: _headers,
|
|
383
|
-
|
|
401
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
384
402
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
385
403
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
386
404
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -428,14 +446,24 @@ class WorkflowsClient {
|
|
|
428
446
|
* @throws {@link phenoml.workflows.InternalServerError}
|
|
429
447
|
*
|
|
430
448
|
* @example
|
|
431
|
-
* await client.workflows.execute("
|
|
449
|
+
* await client.workflows.execute("7a8b9c0d-1234-5678-abcd-ef9876543210", {
|
|
432
450
|
* input_data: {
|
|
433
451
|
* "patient_last_name": "Johnson",
|
|
434
452
|
* "patient_first_name": "Mary",
|
|
435
453
|
* "diagnosis_code": "M79.3",
|
|
436
|
-
* "encounter_date": "2024-
|
|
454
|
+
* "encounter_date": "2024-03-20"
|
|
437
455
|
* }
|
|
438
456
|
* })
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* await client.workflows.execute("7a8b9c0d-1234-5678-abcd-ef9876543210", {
|
|
460
|
+
* input_data: {
|
|
461
|
+
* "patient_last_name": "Johnson",
|
|
462
|
+
* "patient_first_name": "Mary",
|
|
463
|
+
* "diagnosis_code": "M79.3"
|
|
464
|
+
* },
|
|
465
|
+
* preview: true
|
|
466
|
+
* })
|
|
439
467
|
*/
|
|
440
468
|
execute(id, request, requestOptions) {
|
|
441
469
|
return core.HttpResponsePromise.fromPromise(this.__execute(id, request, requestOptions));
|
|
@@ -450,7 +478,7 @@ class WorkflowsClient {
|
|
|
450
478
|
method: "POST",
|
|
451
479
|
headers: _headers,
|
|
452
480
|
contentType: "application/json",
|
|
453
|
-
|
|
481
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
454
482
|
requestType: "json",
|
|
455
483
|
body: request,
|
|
456
484
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* {
|
|
4
4
|
* verbose: true,
|
|
5
5
|
* name: "Patient Data Mapping Workflow",
|
|
6
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
6
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
7
7
|
* sample_data: {
|
|
8
8
|
* "patient_last_name": "Rippin",
|
|
9
9
|
* "patient_first_name": "Clay",
|
|
10
|
-
* "diagnosis_code": "I10"
|
|
10
|
+
* "diagnosis_code": "I10",
|
|
11
|
+
* "encounter_date": "2024-01-15"
|
|
11
12
|
* },
|
|
12
13
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
13
14
|
* }
|
|
@@ -5,9 +5,19 @@
|
|
|
5
5
|
* "patient_last_name": "Johnson",
|
|
6
6
|
* "patient_first_name": "Mary",
|
|
7
7
|
* "diagnosis_code": "M79.3",
|
|
8
|
-
* "encounter_date": "2024-
|
|
8
|
+
* "encounter_date": "2024-03-20"
|
|
9
9
|
* }
|
|
10
10
|
* }
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* {
|
|
14
|
+
* input_data: {
|
|
15
|
+
* "patient_last_name": "Johnson",
|
|
16
|
+
* "patient_first_name": "Mary",
|
|
17
|
+
* "diagnosis_code": "M79.3"
|
|
18
|
+
* },
|
|
19
|
+
* preview: true
|
|
20
|
+
* }
|
|
11
21
|
*/
|
|
12
22
|
export interface ExecuteWorkflowRequest {
|
|
13
23
|
/** Input data for workflow execution */
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
4
|
* verbose: true,
|
|
5
|
-
* name: "
|
|
6
|
-
* workflow_instructions: "Given diagnosis data, find the patient and create condition record",
|
|
5
|
+
* name: "Patient Data Mapping Workflow (v2)",
|
|
6
|
+
* workflow_instructions: "Given diagnosis data, find the patient and create a condition record linked to their encounter",
|
|
7
7
|
* sample_data: {
|
|
8
|
-
* "patient_last_name": "
|
|
9
|
-
* "patient_first_name": "
|
|
10
|
-
* "diagnosis_code": "
|
|
8
|
+
* "patient_last_name": "Rippin",
|
|
9
|
+
* "patient_first_name": "Clay",
|
|
10
|
+
* "diagnosis_code": "I10",
|
|
11
|
+
* "encounter_date": "2024-01-15"
|
|
11
12
|
* },
|
|
12
13
|
* fhir_provider_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
13
14
|
* }
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAuthProvider = isAuthProvider;
|
|
4
|
+
function isAuthProvider(value) {
|
|
5
|
+
return (typeof value === "object" &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
"getAuthRequest" in value &&
|
|
8
|
+
typeof value.getAuthRequest === "function");
|
|
9
|
+
}
|
|
@@ -5,10 +5,16 @@ const base64_js_1 = require("../base64.js");
|
|
|
5
5
|
const BASIC_AUTH_HEADER_PREFIX = /^Basic /i;
|
|
6
6
|
exports.BasicAuth = {
|
|
7
7
|
toAuthorizationHeader: (basicAuth) => {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
if (basicAuth == null) {
|
|
9
10
|
return undefined;
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
+
const username = (_a = basicAuth.username) !== null && _a !== void 0 ? _a : "";
|
|
13
|
+
const password = (_b = basicAuth.password) !== null && _b !== void 0 ? _b : "";
|
|
14
|
+
if (username === "" && password === "") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const token = (0, base64_js_1.base64Encode)(`${username}:${password}`);
|
|
12
18
|
return `Basic ${token}`;
|
|
13
19
|
},
|
|
14
20
|
fromAuthorizationHeader: (header) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export { type AuthProvider, isAuthProvider } from "./AuthProvider.js";
|
|
2
2
|
export type { AuthRequest } from "./AuthRequest.js";
|
|
3
3
|
export { BasicAuth } from "./BasicAuth.js";
|
|
4
4
|
export { BearerToken } from "./BearerToken.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = void 0;
|
|
3
|
+
exports.NoOpAuthProvider = exports.BearerToken = exports.BasicAuth = exports.isAuthProvider = void 0;
|
|
4
|
+
var AuthProvider_js_1 = require("./AuthProvider.js");
|
|
5
|
+
Object.defineProperty(exports, "isAuthProvider", { enumerable: true, get: function () { return AuthProvider_js_1.isAuthProvider; } });
|
|
4
6
|
var BasicAuth_js_1 = require("./BasicAuth.js");
|
|
5
7
|
Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return BasicAuth_js_1.BasicAuth; } });
|
|
6
8
|
var BearerToken_js_1 = require("./BearerToken.js");
|
|
@@ -8,7 +8,13 @@ export declare namespace Fetcher {
|
|
|
8
8
|
method: string;
|
|
9
9
|
contentType?: string;
|
|
10
10
|
headers?: Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`).
|
|
13
|
+
* Retained for backwards compatibility with custom fetchers and callers that
|
|
14
|
+
* still construct request args with a query-parameter object.
|
|
15
|
+
*/
|
|
11
16
|
queryParameters?: Record<string, unknown>;
|
|
17
|
+
queryString?: string;
|
|
12
18
|
body?: unknown;
|
|
13
19
|
timeoutMs?: number;
|
|
14
20
|
maxRetries?: number;
|
|
@@ -38,10 +44,12 @@ export declare namespace Fetcher {
|
|
|
38
44
|
}
|
|
39
45
|
interface TimeoutError {
|
|
40
46
|
reason: "timeout";
|
|
47
|
+
cause?: unknown;
|
|
41
48
|
}
|
|
42
49
|
interface UnknownError {
|
|
43
50
|
reason: "unknown";
|
|
44
51
|
errorMessage: string;
|
|
52
|
+
cause?: unknown;
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
export declare function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIResponse<R, Fetcher.Error>>;
|
|
@@ -75,16 +75,11 @@ const SENSITIVE_QUERY_PARAMS = new Set([
|
|
|
75
75
|
]);
|
|
76
76
|
function redactQueryParameters(queryParameters) {
|
|
77
77
|
if (queryParameters == null) {
|
|
78
|
-
return
|
|
78
|
+
return undefined;
|
|
79
79
|
}
|
|
80
80
|
const redacted = {};
|
|
81
81
|
for (const [key, value] of Object.entries(queryParameters)) {
|
|
82
|
-
|
|
83
|
-
redacted[key] = "[REDACTED]";
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
redacted[key] = value;
|
|
87
|
-
}
|
|
82
|
+
redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value;
|
|
88
83
|
}
|
|
89
84
|
return redacted;
|
|
90
85
|
}
|
|
@@ -186,7 +181,13 @@ function getHeaders(args) {
|
|
|
186
181
|
function fetcherImpl(args) {
|
|
187
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
183
|
var _a, _b, _c;
|
|
189
|
-
|
|
184
|
+
let url = args.url;
|
|
185
|
+
if (args.queryString != null && args.queryString.length > 0) {
|
|
186
|
+
url = `${url}?${args.queryString}`;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
url = (0, createRequestUrl_js_1.createRequestUrl)(args.url, args.queryParameters);
|
|
190
|
+
}
|
|
190
191
|
const requestBody = yield (0, getRequestBody_js_1.getRequestBody)({
|
|
191
192
|
body: args.body,
|
|
192
193
|
type: (_a = args.requestType) !== null && _a !== void 0 ? _a : "other",
|
|
@@ -261,6 +262,7 @@ function fetcherImpl(args) {
|
|
|
261
262
|
error: {
|
|
262
263
|
reason: "unknown",
|
|
263
264
|
errorMessage: "The user aborted a request",
|
|
265
|
+
cause: error,
|
|
264
266
|
},
|
|
265
267
|
rawResponse: RawResponse_js_1.abortRawResponse,
|
|
266
268
|
};
|
|
@@ -278,6 +280,7 @@ function fetcherImpl(args) {
|
|
|
278
280
|
ok: false,
|
|
279
281
|
error: {
|
|
280
282
|
reason: "timeout",
|
|
283
|
+
cause: error,
|
|
281
284
|
},
|
|
282
285
|
rawResponse: RawResponse_js_1.abortRawResponse,
|
|
283
286
|
};
|
|
@@ -296,6 +299,7 @@ function fetcherImpl(args) {
|
|
|
296
299
|
error: {
|
|
297
300
|
reason: "unknown",
|
|
298
301
|
errorMessage: error.message,
|
|
302
|
+
cause: error,
|
|
299
303
|
},
|
|
300
304
|
rawResponse: RawResponse_js_1.unknownRawResponse,
|
|
301
305
|
};
|
|
@@ -313,6 +317,7 @@ function fetcherImpl(args) {
|
|
|
313
317
|
error: {
|
|
314
318
|
reason: "unknown",
|
|
315
319
|
errorMessage: (0, json_js_1.toJson)(error),
|
|
320
|
+
cause: error,
|
|
316
321
|
},
|
|
317
322
|
rawResponse: RawResponse_js_1.unknownRawResponse,
|
|
318
323
|
};
|
|
@@ -14,6 +14,9 @@ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
|
14
14
|
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
15
15
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
16
|
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
17
|
+
function isRetryableStatusCode(statusCode) {
|
|
18
|
+
return [408, 429].includes(statusCode) || statusCode >= 500;
|
|
19
|
+
}
|
|
17
20
|
function addPositiveJitter(delay) {
|
|
18
21
|
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
19
22
|
return delay * jitterMultiplier;
|
|
@@ -53,7 +56,7 @@ function requestWithRetries(requestFn_1) {
|
|
|
53
56
|
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
54
57
|
let response = yield requestFn();
|
|
55
58
|
for (let i = 0; i < maxRetries; ++i) {
|
|
56
|
-
if (
|
|
59
|
+
if (isRetryableStatusCode(response.status)) {
|
|
57
60
|
const delay = getRetryDelayFromHeaders(response, i);
|
|
58
61
|
yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
59
62
|
response = yield requestFn();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
3
|
+
*
|
|
4
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
5
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
6
|
+
*
|
|
7
|
+
* Usage (generated code):
|
|
8
|
+
*
|
|
9
|
+
* const qs = core.url.queryBuilder()
|
|
10
|
+
* .add("limit", limit)
|
|
11
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
12
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
13
|
+
* .build();
|
|
14
|
+
*/
|
|
15
|
+
export declare function queryBuilder(): QueryStringBuilder;
|
|
16
|
+
declare class QueryStringBuilder {
|
|
17
|
+
private parts;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a query parameter, serializing it immediately.
|
|
20
|
+
*
|
|
21
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
22
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
23
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
24
|
+
*
|
|
25
|
+
* Null / undefined values are silently skipped.
|
|
26
|
+
*/
|
|
27
|
+
add(key: string, value: unknown, options?: {
|
|
28
|
+
style?: "comma";
|
|
29
|
+
}): this;
|
|
30
|
+
/**
|
|
31
|
+
* Adds multiple query parameters at once from a record.
|
|
32
|
+
* All parameters use the default "repeat" array format.
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
addMany(params: Record<string, unknown>): this;
|
|
36
|
+
/**
|
|
37
|
+
* Merges additional query parameters supplied at call-time via
|
|
38
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
39
|
+
*/
|
|
40
|
+
mergeAdditional(additionalParams?: Record<string, unknown>): this;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the assembled query string (without the leading `?`).
|
|
43
|
+
* Returns an empty string when no parameters were added.
|
|
44
|
+
*/
|
|
45
|
+
build(): string;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryBuilder = queryBuilder;
|
|
4
|
+
const qs_js_1 = require("./qs.js");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a fluent builder for constructing URL query strings.
|
|
7
|
+
*
|
|
8
|
+
* Each `.add()` call serializes its value immediately (like C#'s builder),
|
|
9
|
+
* so no format tracking is needed — the style is applied at add-time.
|
|
10
|
+
*
|
|
11
|
+
* Usage (generated code):
|
|
12
|
+
*
|
|
13
|
+
* const qs = core.url.queryBuilder()
|
|
14
|
+
* .add("limit", limit)
|
|
15
|
+
* .add("tags", tags, { style: "comma" }) // explode: false
|
|
16
|
+
* .mergeAdditional(requestOptions?.queryParams)
|
|
17
|
+
* .build();
|
|
18
|
+
*/
|
|
19
|
+
function queryBuilder() {
|
|
20
|
+
return new QueryStringBuilder();
|
|
21
|
+
}
|
|
22
|
+
class QueryStringBuilder {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.parts = new Map();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adds a query parameter, serializing it immediately.
|
|
28
|
+
*
|
|
29
|
+
* By default arrays use "repeat" format (`key=a&key=b`).
|
|
30
|
+
* Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters
|
|
31
|
+
* to get comma-separated values (`key=a,b,c`).
|
|
32
|
+
*
|
|
33
|
+
* Null / undefined values are silently skipped.
|
|
34
|
+
*/
|
|
35
|
+
add(key, value, options) {
|
|
36
|
+
if (value === undefined || value === null) {
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: (options === null || options === void 0 ? void 0 : options.style) === "comma" ? "comma" : "repeat" });
|
|
40
|
+
if (serialized.length > 0) {
|
|
41
|
+
this.parts.set(key, serialized);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adds multiple query parameters at once from a record.
|
|
47
|
+
* All parameters use the default "repeat" array format.
|
|
48
|
+
* Null / undefined values are silently skipped.
|
|
49
|
+
*/
|
|
50
|
+
addMany(params) {
|
|
51
|
+
if (params != null) {
|
|
52
|
+
for (const [key, value] of Object.entries(params)) {
|
|
53
|
+
this.add(key, value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Merges additional query parameters supplied at call-time via
|
|
60
|
+
* `requestOptions.queryParams`. Overrides existing keys (last-write-wins).
|
|
61
|
+
*/
|
|
62
|
+
mergeAdditional(additionalParams) {
|
|
63
|
+
if (additionalParams != null) {
|
|
64
|
+
for (const [key, value] of Object.entries(additionalParams)) {
|
|
65
|
+
if (value === undefined || value === null) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const serialized = (0, qs_js_1.toQueryString)({ [key]: value }, { arrayFormat: "repeat" });
|
|
69
|
+
if (serialized.length > 0) {
|
|
70
|
+
this.parts.set(key, serialized);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the assembled query string (without the leading `?`).
|
|
78
|
+
* Returns an empty string when no parameters were added.
|
|
79
|
+
*/
|
|
80
|
+
build() {
|
|
81
|
+
return [...this.parts.values()].join("&");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toQueryString = exports.join = exports.encodePathParam = void 0;
|
|
3
|
+
exports.toQueryString = exports.queryBuilder = exports.join = exports.encodePathParam = void 0;
|
|
4
4
|
var encodePathParam_js_1 = require("./encodePathParam.js");
|
|
5
5
|
Object.defineProperty(exports, "encodePathParam", { enumerable: true, get: function () { return encodePathParam_js_1.encodePathParam; } });
|
|
6
6
|
var join_js_1 = require("./join.js");
|
|
7
7
|
Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_js_1.join; } });
|
|
8
|
+
var QueryStringBuilder_js_1 = require("./QueryStringBuilder.js");
|
|
9
|
+
Object.defineProperty(exports, "queryBuilder", { enumerable: true, get: function () { return QueryStringBuilder_js_1.queryBuilder; } });
|
|
8
10
|
var qs_js_1 = require("./qs.js");
|
|
9
11
|
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_js_1.toQueryString; } });
|
package/dist/cjs/core/url/qs.js
CHANGED
|
@@ -26,19 +26,31 @@ function stringifyObject(obj, prefix = "", options) {
|
|
|
26
26
|
if (value.length === 0) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const effectiveFormat = options.arrayFormat;
|
|
30
|
+
if (effectiveFormat === "comma") {
|
|
31
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
32
|
+
const encodedValues = value
|
|
33
|
+
.filter((item) => item !== undefined && item !== null)
|
|
34
|
+
.map((item) => encodeValue(item, options.encode));
|
|
35
|
+
if (encodedValues.length > 0) {
|
|
36
|
+
parts.push(`${encodedKey}=${encodedValues.join(",")}`);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let i = 0; i < value.length; i++) {
|
|
41
|
+
const item = value[i];
|
|
42
|
+
if (item === undefined) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
46
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
47
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
51
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
52
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
}
|