@awell-health/awell-extensions 2.0.119 → 2.0.121
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.d.ts +1 -1
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js +2 -2
- package/dist/extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.js.map +1 -1
- package/package.json +7 -6
- package/dist/extensions/healthie/lib/sdk/genql/HealthieSdk.d.ts +0 -29
- package/dist/extensions/healthie/lib/sdk/genql/HealthieSdk.js +0 -30
- package/dist/extensions/healthie/lib/sdk/genql/HealthieSdk.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generateSdk.d.ts +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generateSdk.js +0 -21
- package/dist/extensions/healthie/lib/sdk/genql/generateSdk.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/index.d.ts +0 -29
- package/dist/extensions/healthie/lib/sdk/genql/generated/index.js +0 -51
- package/dist/extensions/healthie/lib/sdk/genql/generated/index.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/batcher.d.ts +0 -105
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/batcher.js +0 -205
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/batcher.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/createClient.d.ts +0 -23
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/createClient.js +0 -29
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/createClient.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/error.d.ts +0 -18
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/error.js +0 -20
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/error.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/fetcher.d.ts +0 -10
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/fetcher.js +0 -72
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/fetcher.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/generateGraphqlOperation.d.ts +0 -30
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/generateGraphqlOperation.js +0 -134
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/generateGraphqlOperation.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/index.d.ts +0 -11
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/index.js +0 -19
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/index.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/linkTypeMap.d.ts +0 -9
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/linkTypeMap.js +0 -102
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/linkTypeMap.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/typeSelection.d.ts +0 -28
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/typeSelection.js +0 -5
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/typeSelection.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/types.d.ts +0 -55
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/types.js +0 -4
- package/dist/extensions/healthie/lib/sdk/genql/generated/runtime/types.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/schema.d.ts +0 -44386
- package/dist/extensions/healthie/lib/sdk/genql/generated/schema.js +0 -5286
- package/dist/extensions/healthie/lib/sdk/genql/generated/schema.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/generated/types.d.ts +0 -15393
- package/dist/extensions/healthie/lib/sdk/genql/generated/types.js +0 -40654
- package/dist/extensions/healthie/lib/sdk/genql/generated/types.js.map +0 -1
- package/dist/extensions/healthie/lib/sdk/genql/index.d.ts +0 -2
- package/dist/extensions/healthie/lib/sdk/genql/index.js +0 -21
- package/dist/extensions/healthie/lib/sdk/genql/index.js.map +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import { type NewActivityPayload, type Pathway, type Patient } from '@awell-health/extensions-core';
|
2
2
|
import z from 'zod';
|
3
3
|
import { SettingsValidationSchema } from '../../settings';
|
4
|
-
import { HealthieSdk } from '
|
4
|
+
import { HealthieSdk } from '@awell-health/healthie-sdk';
|
5
5
|
import { getSdk } from './graphql-codegen/generated/sdk';
|
6
6
|
import { type Activity } from '@awell-health/extensions-core/dist/types/Activity';
|
7
7
|
type ValidatePayloadAndCreateSdk = <T extends z.ZodTypeAny, P extends NewActivityPayload<any, any>>(args: {
|
@@ -7,7 +7,7 @@ exports.validatePayloadAndCreateSdk = void 0;
|
|
7
7
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
8
8
|
const zod_1 = __importDefault(require("zod"));
|
9
9
|
const settings_1 = require("../../settings");
|
10
|
-
const
|
10
|
+
const healthie_sdk_1 = require("@awell-health/healthie-sdk");
|
11
11
|
const sdk_1 = require("./graphql-codegen/generated/sdk");
|
12
12
|
const graphqlClient_1 = require("./graphql-codegen/graphqlClient");
|
13
13
|
const validatePayloadAndCreateSdk = async ({ fieldsSchema, payload, }) => {
|
@@ -29,7 +29,7 @@ const validatePayloadAndCreateSdk = async ({ fieldsSchema, payload, }) => {
|
|
29
29
|
/**
|
30
30
|
* New sdk, generated with GenQL
|
31
31
|
*/
|
32
|
-
const healthieSdk = new
|
32
|
+
const healthieSdk = new healthie_sdk_1.HealthieSdk(settings);
|
33
33
|
return {
|
34
34
|
settings,
|
35
35
|
fields,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validatePayloadAndCreateSdk.js","sourceRoot":"","sources":["../../../../../extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.ts"],"names":[],"mappings":";;;;;;AAAA,mEAKsC;AACtC,8CAAmB;AACnB,6CAAyD;AACzD,
|
1
|
+
{"version":3,"file":"validatePayloadAndCreateSdk.js","sourceRoot":"","sources":["../../../../../extensions/healthie/lib/sdk/validatePayloadAndCreateSdk.ts"],"names":[],"mappings":";;;;;;AAAA,mEAKsC;AACtC,8CAAmB;AACnB,6CAAyD;AACzD,6DAAwD;AACxD,yDAAwD;AACxD,mEAAkE;AAuB3D,MAAM,2BAA2B,GAAgC,KAAK,EAAE,EAC7E,YAAY,EACZ,OAAO,GACR,EAAE,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAQ,EAAC;QACpC,MAAM,EAAE,aAAC,CAAC,MAAM,CAAC;YACf,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE,mCAAwB;SACnC,CAAC;QACF,OAAO;KACR,CAAC,CAAA;IAEF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAE9C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,QAAQ,CAAC,CAAA;IAEzC,IAAI,MAAM,KAAK,SAAS;QACtB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IAEzD;;OAEG;IACH,MAAM,aAAa,GAAG,IAAA,YAAM,EAAC,MAAM,CAAC,CAAA;IAEpC;;OAEG;IACH,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC,QAAQ,CAAC,CAAA;IAE7C,OAAO;QACL,QAAQ;QACR,MAAM;QACN,GAAG,EAAE,aAAa;QAClB,WAAW;QACX,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAA;AACH,CAAC,CAAA;AAtCY,QAAA,2BAA2B,+BAsCvC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@awell-health/awell-extensions",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.121",
|
4
4
|
"packageManager": "yarn@3.4.1",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"repository": {
|
@@ -20,8 +20,7 @@
|
|
20
20
|
"postinstall": "husky install",
|
21
21
|
"test": "jest --verbose",
|
22
22
|
"prepack": "yarn build",
|
23
|
-
"test-server": "ts-node-dev --respawn --transpile-only ./src/test-server.ts"
|
24
|
-
"generate-healthie-sdk": "ts-node ./extensions/healthie/lib/sdk/genql/generateSdk.ts"
|
23
|
+
"test-server": "ts-node-dev --respawn --transpile-only ./src/test-server.ts"
|
25
24
|
},
|
26
25
|
"types": "dist/src/index.d.ts",
|
27
26
|
"files": [
|
@@ -76,8 +75,8 @@
|
|
76
75
|
"dependencies": {
|
77
76
|
"@awell-health/awell-sdk": "^0.1.20",
|
78
77
|
"@awell-health/extensions-core": "1.0.11",
|
79
|
-
"@
|
80
|
-
"@
|
78
|
+
"@awell-health/healthie-sdk": "^0.1.1",
|
79
|
+
"@dropbox/sign": "^1.8.0",
|
81
80
|
"@hubspot/api-client": "^11.2.0",
|
82
81
|
"@langchain/core": "^0.3.1",
|
83
82
|
"@langchain/openai": "^0.3.0",
|
@@ -101,7 +100,6 @@
|
|
101
100
|
"graphql": "^16.8.1",
|
102
101
|
"graphql-request": "5.1.0",
|
103
102
|
"graphql-tag": "^2.12.6",
|
104
|
-
"json-schema-faker": "^0.5.6",
|
105
103
|
"jsonpath": "^1.1.1",
|
106
104
|
"langchain": "^0.3.2",
|
107
105
|
"libphonenumber-js": "^1.10.26",
|
@@ -120,5 +118,8 @@
|
|
120
118
|
"xml2js": "^0.6.2",
|
121
119
|
"zod": "^3.23.4",
|
122
120
|
"zod-validation-error": "^3.2.0"
|
121
|
+
},
|
122
|
+
"resolutions": {
|
123
|
+
"jsonpath-plus": "^10.2.0"
|
123
124
|
}
|
124
125
|
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { type Client } from './generated';
|
2
|
-
/**
|
3
|
-
* A class representing the Healthie SDK.
|
4
|
-
*/
|
5
|
-
export declare class HealthieSdk {
|
6
|
-
/**
|
7
|
-
* The API key used to authenticate API requests.
|
8
|
-
*/
|
9
|
-
readonly apiKey: string;
|
10
|
-
/**
|
11
|
-
* The client that calls the Healthie API.
|
12
|
-
*/
|
13
|
-
readonly client: Client;
|
14
|
-
/**
|
15
|
-
* The custom API URL to be used if provided.
|
16
|
-
*/
|
17
|
-
readonly apiUrl: string;
|
18
|
-
/**
|
19
|
-
* Creates an instance of the Healthie SDK.
|
20
|
-
*
|
21
|
-
* @param {Object} opts - The options for configuring the SDK.
|
22
|
-
* @param {string} [opts.apiUrl] - The API URL.
|
23
|
-
* @param {string} opts.apiKey - The API key to use for authentication.
|
24
|
-
*/
|
25
|
-
constructor(opts: {
|
26
|
-
apiKey: string;
|
27
|
-
apiUrl: string;
|
28
|
-
});
|
29
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.HealthieSdk = void 0;
|
4
|
-
const generated_1 = require("./generated");
|
5
|
-
/**
|
6
|
-
* A class representing the Healthie SDK.
|
7
|
-
*/
|
8
|
-
class HealthieSdk {
|
9
|
-
/**
|
10
|
-
* Creates an instance of the Healthie SDK.
|
11
|
-
*
|
12
|
-
* @param {Object} opts - The options for configuring the SDK.
|
13
|
-
* @param {string} [opts.apiUrl] - The API URL.
|
14
|
-
* @param {string} opts.apiKey - The API key to use for authentication.
|
15
|
-
*/
|
16
|
-
constructor(opts) {
|
17
|
-
this.apiKey = opts.apiKey;
|
18
|
-
this.apiUrl = opts.apiUrl;
|
19
|
-
const client = (0, generated_1.createClient)({
|
20
|
-
url: this.apiUrl,
|
21
|
-
headers: {
|
22
|
-
Authorization: `Basic ${this.apiKey}`,
|
23
|
-
AuthorizationSource: 'API',
|
24
|
-
},
|
25
|
-
});
|
26
|
-
this.client = client;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
exports.HealthieSdk = HealthieSdk;
|
30
|
-
//# sourceMappingURL=HealthieSdk.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"HealthieSdk.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/lib/sdk/genql/HealthieSdk.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAEvD;;GAEG;AACH,MAAa,WAAW;IAgBtB;;;;;;OAMG;IACH,YAAY,IAAwC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzB,MAAM,MAAM,GAAG,IAAA,wBAAY,EAAC;YAC1B,GAAG,EAAE,IAAI,CAAC,MAAM;YAChB,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,IAAI,CAAC,MAAM,EAAE;gBACrC,mBAAmB,EAAE,KAAK;aAC3B;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AArCD,kCAqCC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
import 'dotenv/config';
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const cli_1 = require("@genql/cli");
|
7
|
-
require("dotenv/config");
|
8
|
-
const path_1 = __importDefault(require("path"));
|
9
|
-
/**
|
10
|
-
* Run with the below command:
|
11
|
-
* yarn generate-healthie-sdk
|
12
|
-
*/
|
13
|
-
(0, cli_1.generate)({
|
14
|
-
endpoint: process.env.HEALTHIE_API_URL,
|
15
|
-
output: path_1.default.join(__dirname, 'generated'),
|
16
|
-
// headers: {
|
17
|
-
// Authorization: `Basic ${process.env.HEALTHIE_API_KEY ?? ''}`,
|
18
|
-
// AuthorizationSource: 'API',
|
19
|
-
// },
|
20
|
-
}).catch(console.error);
|
21
|
-
//# sourceMappingURL=generateSdk.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"generateSdk.js","sourceRoot":"","sources":["../../../../../../extensions/healthie/lib/sdk/genql/generateSdk.ts"],"names":[],"mappings":";;;;;AAAA,oCAAqC;AACrC,yBAAsB;AACtB,gDAAuB;AAEvB;;;GAGG;AACH,IAAA,cAAQ,EAAC;IACP,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;IACtC,MAAM,EAAE,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC;IACzC,aAAa;IACb,kEAAkE;IAClE,gCAAgC;IAChC,KAAK;CACN,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import type { QueryGenqlSelection, Query, MutationGenqlSelection, Mutation, SubscriptionGenqlSelection, Subscription } from './schema';
|
2
|
-
import { type FieldsSelection, type GraphqlOperation, type ClientOptions, GenqlError } from './runtime';
|
3
|
-
export type { FieldsSelection } from './runtime';
|
4
|
-
export { GenqlError };
|
5
|
-
export * from './schema';
|
6
|
-
export interface Client {
|
7
|
-
query<R extends QueryGenqlSelection>(request: R & {
|
8
|
-
__name?: string;
|
9
|
-
}): Promise<FieldsSelection<Query, R>>;
|
10
|
-
mutation<R extends MutationGenqlSelection>(request: R & {
|
11
|
-
__name?: string;
|
12
|
-
}): Promise<FieldsSelection<Mutation, R>>;
|
13
|
-
}
|
14
|
-
export declare const createClient: (options?: ClientOptions) => Client;
|
15
|
-
export declare const everything: {
|
16
|
-
__scalar: boolean;
|
17
|
-
};
|
18
|
-
export type QueryResult<fields extends QueryGenqlSelection> = FieldsSelection<Query, fields>;
|
19
|
-
export declare const generateQueryOp: (fields: QueryGenqlSelection & {
|
20
|
-
__name?: string;
|
21
|
-
}) => GraphqlOperation;
|
22
|
-
export type MutationResult<fields extends MutationGenqlSelection> = FieldsSelection<Mutation, fields>;
|
23
|
-
export declare const generateMutationOp: (fields: MutationGenqlSelection & {
|
24
|
-
__name?: string;
|
25
|
-
}) => GraphqlOperation;
|
26
|
-
export type SubscriptionResult<fields extends SubscriptionGenqlSelection> = FieldsSelection<Subscription, fields>;
|
27
|
-
export declare const generateSubscriptionOp: (fields: SubscriptionGenqlSelection & {
|
28
|
-
__name?: string;
|
29
|
-
}) => GraphqlOperation;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
18
|
-
};
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
20
|
-
exports.generateSubscriptionOp = exports.generateMutationOp = exports.generateQueryOp = exports.everything = exports.createClient = exports.GenqlError = void 0;
|
21
|
-
const runtime_1 = require("./runtime");
|
22
|
-
Object.defineProperty(exports, "GenqlError", { enumerable: true, get: function () { return runtime_1.GenqlError; } });
|
23
|
-
const types_1 = __importDefault(require("./types"));
|
24
|
-
__exportStar(require("./schema"), exports);
|
25
|
-
const typeMap = (0, runtime_1.linkTypeMap)(types_1.default);
|
26
|
-
const createClient = function (options) {
|
27
|
-
return (0, runtime_1.createClient)({
|
28
|
-
url: 'https://staging-api.gethealthie.com/graphql',
|
29
|
-
...options,
|
30
|
-
queryRoot: typeMap.Query,
|
31
|
-
mutationRoot: typeMap.Mutation,
|
32
|
-
subscriptionRoot: typeMap.Subscription,
|
33
|
-
});
|
34
|
-
};
|
35
|
-
exports.createClient = createClient;
|
36
|
-
exports.everything = {
|
37
|
-
__scalar: true,
|
38
|
-
};
|
39
|
-
const generateQueryOp = function (fields) {
|
40
|
-
return (0, runtime_1.generateGraphqlOperation)('query', typeMap.Query, fields);
|
41
|
-
};
|
42
|
-
exports.generateQueryOp = generateQueryOp;
|
43
|
-
const generateMutationOp = function (fields) {
|
44
|
-
return (0, runtime_1.generateGraphqlOperation)('mutation', typeMap.Mutation, fields);
|
45
|
-
};
|
46
|
-
exports.generateMutationOp = generateMutationOp;
|
47
|
-
const generateSubscriptionOp = function (fields) {
|
48
|
-
return (0, runtime_1.generateGraphqlOperation)('subscription', typeMap.Subscription, fields);
|
49
|
-
};
|
50
|
-
exports.generateSubscriptionOp = generateSubscriptionOp;
|
51
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../extensions/healthie/lib/sdk/genql/generated/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,uCAQkB;AAET,2FAHP,oBAAU,OAGO;AAEnB,oDAA2B;AAC3B,2CAAwB;AACxB,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,eAAY,CAAC,CAAA;AAYlC,MAAM,YAAY,GAAG,UAAU,OAAuB;IAC3D,OAAO,IAAA,sBAAoB,EAAC;QAC1B,GAAG,EAAE,6CAA6C;QAElD,GAAG,OAAO;QACV,SAAS,EAAE,OAAO,CAAC,KAAM;QACzB,YAAY,EAAE,OAAO,CAAC,QAAS;QAC/B,gBAAgB,EAAE,OAAO,CAAC,YAAa;KACxC,CAAQ,CAAA;AACX,CAAC,CAAA;AATY,QAAA,YAAY,gBASxB;AAEY,QAAA,UAAU,GAAG;IACxB,QAAQ,EAAE,IAAI;CACf,CAAA;AAMM,MAAM,eAAe,GAEJ,UAAU,MAAM;IACtC,OAAO,IAAA,kCAAwB,EAAC,OAAO,EAAE,OAAO,CAAC,KAAM,EAAE,MAAa,CAAC,CAAA;AACzE,CAAC,CAAA;AAJY,QAAA,eAAe,mBAI3B;AAIM,MAAM,kBAAkB,GAEP,UAAU,MAAM;IACtC,OAAO,IAAA,kCAAwB,EAAC,UAAU,EAAE,OAAO,CAAC,QAAS,EAAE,MAAa,CAAC,CAAA;AAC/E,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B;AAIM,MAAM,sBAAsB,GAEX,UAAU,MAAM;IACtC,OAAO,IAAA,kCAAwB,EAC7B,cAAc,EACd,OAAO,CAAC,YAAa,EACrB,MAAa,CACd,CAAA;AACH,CAAC,CAAA;AARY,QAAA,sBAAsB,0BAQlC"}
|
@@ -1,105 +0,0 @@
|
|
1
|
-
import type { GraphqlOperation } from './generateGraphqlOperation';
|
2
|
-
type Variables = Record<string, any>;
|
3
|
-
type QueryError = Error & {
|
4
|
-
message: string;
|
5
|
-
locations?: Array<{
|
6
|
-
line: number;
|
7
|
-
column: number;
|
8
|
-
}>;
|
9
|
-
path?: any;
|
10
|
-
rid: string;
|
11
|
-
details?: Record<string, any>;
|
12
|
-
};
|
13
|
-
type Result = {
|
14
|
-
data: Record<string, any>;
|
15
|
-
errors: Array<QueryError>;
|
16
|
-
};
|
17
|
-
type Fetcher = (batchedQuery: GraphqlOperation | Array<GraphqlOperation>) => Promise<Array<Result>>;
|
18
|
-
type Options = {
|
19
|
-
batchInterval?: number;
|
20
|
-
shouldBatch?: boolean;
|
21
|
-
maxBatchSize?: number;
|
22
|
-
};
|
23
|
-
type Queue = Array<{
|
24
|
-
request: GraphqlOperation;
|
25
|
-
resolve: (...args: Array<any>) => any;
|
26
|
-
reject: (...args: Array<any>) => any;
|
27
|
-
}>;
|
28
|
-
/**
|
29
|
-
* Create a batcher client.
|
30
|
-
* @param {Fetcher} fetcher - A function that can handle the network requests to graphql endpoint
|
31
|
-
* @param {Options} options - the options to be used by client
|
32
|
-
* @param {boolean} options.shouldBatch - should the client batch requests. (default true)
|
33
|
-
* @param {integer} options.batchInterval - duration (in MS) of each batch window. (default 6)
|
34
|
-
* @param {integer} options.maxBatchSize - max number of requests in a batch. (default 0)
|
35
|
-
* @param {boolean} options.defaultHeaders - default headers to include with every request
|
36
|
-
*
|
37
|
-
* @example
|
38
|
-
* const fetcher = batchedQuery => fetch('path/to/graphql', {
|
39
|
-
* method: 'post',
|
40
|
-
* headers: {
|
41
|
-
* Accept: 'application/json',
|
42
|
-
* 'Content-Type': 'application/json',
|
43
|
-
* },
|
44
|
-
* body: JSON.stringify(batchedQuery),
|
45
|
-
* credentials: 'include',
|
46
|
-
* })
|
47
|
-
* .then(response => response.json())
|
48
|
-
*
|
49
|
-
* const client = new QueryBatcher(fetcher, { maxBatchSize: 10 })
|
50
|
-
*/
|
51
|
-
export declare class QueryBatcher {
|
52
|
-
fetcher: Fetcher;
|
53
|
-
_options: Options;
|
54
|
-
_queue: Queue;
|
55
|
-
constructor(fetcher: Fetcher, { batchInterval, shouldBatch, maxBatchSize, }?: Options);
|
56
|
-
/**
|
57
|
-
* Fetch will send a graphql request and return the parsed json.
|
58
|
-
* @param {string} query - the graphql query.
|
59
|
-
* @param {Variables} variables - any variables you wish to inject as key/value pairs.
|
60
|
-
* @param {[string]} operationName - the graphql operationName.
|
61
|
-
* @param {Options} overrides - the client options overrides.
|
62
|
-
*
|
63
|
-
* @return {promise} resolves to parsed json of server response
|
64
|
-
*
|
65
|
-
* @example
|
66
|
-
* client.fetch(`
|
67
|
-
* query getHuman($id: ID!) {
|
68
|
-
* human(id: $id) {
|
69
|
-
* name
|
70
|
-
* height
|
71
|
-
* }
|
72
|
-
* }
|
73
|
-
* `, { id: "1001" }, 'getHuman')
|
74
|
-
* .then(human => {
|
75
|
-
* // do something with human
|
76
|
-
* console.log(human);
|
77
|
-
* });
|
78
|
-
*/
|
79
|
-
fetch(query: string, variables?: Variables, operationName?: string, overrides?: Options): Promise<Result>;
|
80
|
-
/**
|
81
|
-
* Fetch will send a graphql request and return the parsed json.
|
82
|
-
* @param {string} query - the graphql query.
|
83
|
-
* @param {Variables} variables - any variables you wish to inject as key/value pairs.
|
84
|
-
* @param {[string]} operationName - the graphql operationName.
|
85
|
-
* @param {Options} overrides - the client options overrides.
|
86
|
-
*
|
87
|
-
* @return {Promise<Array<Result>>} resolves to parsed json of server response
|
88
|
-
*
|
89
|
-
* @example
|
90
|
-
* client.forceFetch(`
|
91
|
-
* query getHuman($id: ID!) {
|
92
|
-
* human(id: $id) {
|
93
|
-
* name
|
94
|
-
* height
|
95
|
-
* }
|
96
|
-
* }
|
97
|
-
* `, { id: "1001" }, 'getHuman')
|
98
|
-
* .then(human => {
|
99
|
-
* // do something with human
|
100
|
-
* console.log(human);
|
101
|
-
* });
|
102
|
-
*/
|
103
|
-
forceFetch(query: string, variables?: Variables, operationName?: string, overrides?: Options): Promise<Result>;
|
104
|
-
}
|
105
|
-
export {};
|
@@ -1,205 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.QueryBatcher = void 0;
|
4
|
-
const error_1 = require("./error");
|
5
|
-
/**
|
6
|
-
* takes a list of requests (queue) and batches them into a single server request.
|
7
|
-
* It will then resolve each individual requests promise with the appropriate data.
|
8
|
-
* @private
|
9
|
-
* @param {QueryBatcher} client - the client to use
|
10
|
-
* @param {Queue} queue - the list of requests to batch
|
11
|
-
*/
|
12
|
-
function dispatchQueueBatch(client, queue) {
|
13
|
-
let batchedQuery = queue.map((item) => item.request);
|
14
|
-
if (batchedQuery.length === 1) {
|
15
|
-
batchedQuery = batchedQuery[0];
|
16
|
-
}
|
17
|
-
(() => {
|
18
|
-
try {
|
19
|
-
return client.fetcher(batchedQuery);
|
20
|
-
}
|
21
|
-
catch (e) {
|
22
|
-
return Promise.reject(e);
|
23
|
-
}
|
24
|
-
})().then((responses) => {
|
25
|
-
if (queue.length === 1 && !Array.isArray(responses)) {
|
26
|
-
if (responses.errors && responses.errors.length) {
|
27
|
-
queue[0].reject(new error_1.GenqlError(responses.errors, responses.data));
|
28
|
-
return;
|
29
|
-
}
|
30
|
-
queue[0].resolve(responses);
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
else if (responses.length !== queue.length) {
|
34
|
-
throw new Error('response length did not match query length');
|
35
|
-
}
|
36
|
-
for (let i = 0; i < queue.length; i++) {
|
37
|
-
if (responses[i].errors && responses[i].errors.length) {
|
38
|
-
queue[i].reject(new error_1.GenqlError(responses[i].errors, responses[i].data));
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
queue[i].resolve(responses[i]);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
})
|
45
|
-
.catch((e) => {
|
46
|
-
for (let i = 0; i < queue.length; i++) {
|
47
|
-
queue[i].reject(e);
|
48
|
-
}
|
49
|
-
});
|
50
|
-
}
|
51
|
-
/**
|
52
|
-
* creates a list of requests to batch according to max batch size.
|
53
|
-
* @private
|
54
|
-
* @param {QueryBatcher} client - the client to create list of requests from from
|
55
|
-
* @param {Options} options - the options for the batch
|
56
|
-
*/
|
57
|
-
function dispatchQueue(client, options) {
|
58
|
-
const queue = client._queue;
|
59
|
-
const maxBatchSize = options.maxBatchSize || 0;
|
60
|
-
client._queue = [];
|
61
|
-
if (maxBatchSize > 0 && maxBatchSize < queue.length) {
|
62
|
-
for (let i = 0; i < queue.length / maxBatchSize; i++) {
|
63
|
-
dispatchQueueBatch(client, queue.slice(i * maxBatchSize, (i + 1) * maxBatchSize));
|
64
|
-
}
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
dispatchQueueBatch(client, queue);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* Create a batcher client.
|
72
|
-
* @param {Fetcher} fetcher - A function that can handle the network requests to graphql endpoint
|
73
|
-
* @param {Options} options - the options to be used by client
|
74
|
-
* @param {boolean} options.shouldBatch - should the client batch requests. (default true)
|
75
|
-
* @param {integer} options.batchInterval - duration (in MS) of each batch window. (default 6)
|
76
|
-
* @param {integer} options.maxBatchSize - max number of requests in a batch. (default 0)
|
77
|
-
* @param {boolean} options.defaultHeaders - default headers to include with every request
|
78
|
-
*
|
79
|
-
* @example
|
80
|
-
* const fetcher = batchedQuery => fetch('path/to/graphql', {
|
81
|
-
* method: 'post',
|
82
|
-
* headers: {
|
83
|
-
* Accept: 'application/json',
|
84
|
-
* 'Content-Type': 'application/json',
|
85
|
-
* },
|
86
|
-
* body: JSON.stringify(batchedQuery),
|
87
|
-
* credentials: 'include',
|
88
|
-
* })
|
89
|
-
* .then(response => response.json())
|
90
|
-
*
|
91
|
-
* const client = new QueryBatcher(fetcher, { maxBatchSize: 10 })
|
92
|
-
*/
|
93
|
-
class QueryBatcher {
|
94
|
-
constructor(fetcher, { batchInterval = 6, shouldBatch = true, maxBatchSize = 0, } = {}) {
|
95
|
-
this.fetcher = fetcher;
|
96
|
-
this._options = {
|
97
|
-
batchInterval,
|
98
|
-
shouldBatch,
|
99
|
-
maxBatchSize,
|
100
|
-
};
|
101
|
-
this._queue = [];
|
102
|
-
}
|
103
|
-
/**
|
104
|
-
* Fetch will send a graphql request and return the parsed json.
|
105
|
-
* @param {string} query - the graphql query.
|
106
|
-
* @param {Variables} variables - any variables you wish to inject as key/value pairs.
|
107
|
-
* @param {[string]} operationName - the graphql operationName.
|
108
|
-
* @param {Options} overrides - the client options overrides.
|
109
|
-
*
|
110
|
-
* @return {promise} resolves to parsed json of server response
|
111
|
-
*
|
112
|
-
* @example
|
113
|
-
* client.fetch(`
|
114
|
-
* query getHuman($id: ID!) {
|
115
|
-
* human(id: $id) {
|
116
|
-
* name
|
117
|
-
* height
|
118
|
-
* }
|
119
|
-
* }
|
120
|
-
* `, { id: "1001" }, 'getHuman')
|
121
|
-
* .then(human => {
|
122
|
-
* // do something with human
|
123
|
-
* console.log(human);
|
124
|
-
* });
|
125
|
-
*/
|
126
|
-
fetch(query, variables, operationName, overrides = {}) {
|
127
|
-
const request = {
|
128
|
-
query,
|
129
|
-
};
|
130
|
-
const options = Object.assign({}, this._options, overrides);
|
131
|
-
if (variables) {
|
132
|
-
request.variables = variables;
|
133
|
-
}
|
134
|
-
if (operationName) {
|
135
|
-
request.operationName = operationName;
|
136
|
-
}
|
137
|
-
const promise = new Promise((resolve, reject) => {
|
138
|
-
this._queue.push({
|
139
|
-
request,
|
140
|
-
resolve,
|
141
|
-
reject,
|
142
|
-
});
|
143
|
-
if (this._queue.length === 1) {
|
144
|
-
if (options.shouldBatch) {
|
145
|
-
setTimeout(() => dispatchQueue(this, options), options.batchInterval);
|
146
|
-
}
|
147
|
-
else {
|
148
|
-
dispatchQueue(this, options);
|
149
|
-
}
|
150
|
-
}
|
151
|
-
});
|
152
|
-
return promise;
|
153
|
-
}
|
154
|
-
/**
|
155
|
-
* Fetch will send a graphql request and return the parsed json.
|
156
|
-
* @param {string} query - the graphql query.
|
157
|
-
* @param {Variables} variables - any variables you wish to inject as key/value pairs.
|
158
|
-
* @param {[string]} operationName - the graphql operationName.
|
159
|
-
* @param {Options} overrides - the client options overrides.
|
160
|
-
*
|
161
|
-
* @return {Promise<Array<Result>>} resolves to parsed json of server response
|
162
|
-
*
|
163
|
-
* @example
|
164
|
-
* client.forceFetch(`
|
165
|
-
* query getHuman($id: ID!) {
|
166
|
-
* human(id: $id) {
|
167
|
-
* name
|
168
|
-
* height
|
169
|
-
* }
|
170
|
-
* }
|
171
|
-
* `, { id: "1001" }, 'getHuman')
|
172
|
-
* .then(human => {
|
173
|
-
* // do something with human
|
174
|
-
* console.log(human);
|
175
|
-
* });
|
176
|
-
*/
|
177
|
-
forceFetch(query, variables, operationName, overrides = {}) {
|
178
|
-
const request = {
|
179
|
-
query,
|
180
|
-
};
|
181
|
-
const options = Object.assign({}, this._options, overrides, {
|
182
|
-
shouldBatch: false,
|
183
|
-
});
|
184
|
-
if (variables) {
|
185
|
-
request.variables = variables;
|
186
|
-
}
|
187
|
-
if (operationName) {
|
188
|
-
request.operationName = operationName;
|
189
|
-
}
|
190
|
-
const promise = new Promise((resolve, reject) => {
|
191
|
-
const client = new QueryBatcher(this.fetcher, this._options);
|
192
|
-
client._queue = [
|
193
|
-
{
|
194
|
-
request,
|
195
|
-
resolve,
|
196
|
-
reject,
|
197
|
-
},
|
198
|
-
];
|
199
|
-
dispatchQueue(client, options);
|
200
|
-
});
|
201
|
-
return promise;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
exports.QueryBatcher = QueryBatcher;
|
205
|
-
//# sourceMappingURL=batcher.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"batcher.js","sourceRoot":"","sources":["../../../../../../../../extensions/healthie/lib/sdk/genql/generated/runtime/batcher.ts"],"names":[],"mappings":";;;AAEA,mCAAoC;AAiCpC;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,MAAoB,EAAE,KAAY;IAC1D,IAAI,YAAY,GAAQ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAEzD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;KACjC;IACD,CAAC,GAAG,EAAE;QACF,IAAI;YACA,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;SACvC;QAAC,OAAM,CAAC,EAAE;YACP,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SAC5B;IACL,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,SAAc,EAAE,EAAE;QACzB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YACjD,IAAI,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC7C,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CACX,IAAI,kBAAU,CAAC,SAAS,C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|
@@ -1,23 +0,0 @@
|
|
1
|
-
import { type BatchOptions } from './fetcher';
|
2
|
-
import type { ExecutionResult, LinkedType } from './types';
|
3
|
-
import { type GraphqlOperation } from './generateGraphqlOperation';
|
4
|
-
export type Headers = HeadersInit | (() => HeadersInit) | (() => Promise<HeadersInit>);
|
5
|
-
export type BaseFetcher = (operation: GraphqlOperation | GraphqlOperation[]) => Promise<ExecutionResult | ExecutionResult[]>;
|
6
|
-
export type ClientOptions = Omit<RequestInit, 'body' | 'headers'> & {
|
7
|
-
url?: string;
|
8
|
-
batch?: BatchOptions | boolean;
|
9
|
-
fetcher?: BaseFetcher;
|
10
|
-
fetch?: Function;
|
11
|
-
headers?: Headers;
|
12
|
-
};
|
13
|
-
export declare const createClient: ({ queryRoot, mutationRoot, subscriptionRoot, ...options }: Omit<RequestInit, "headers" | "body"> & {
|
14
|
-
url?: string | undefined;
|
15
|
-
batch?: boolean | BatchOptions | undefined;
|
16
|
-
fetcher?: BaseFetcher | undefined;
|
17
|
-
fetch?: Function | undefined;
|
18
|
-
headers?: Headers | undefined;
|
19
|
-
} & {
|
20
|
-
queryRoot?: LinkedType | undefined;
|
21
|
-
mutationRoot?: LinkedType | undefined;
|
22
|
-
subscriptionRoot?: LinkedType | undefined;
|
23
|
-
}) => any;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
// @ts-nocheck
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
exports.createClient = void 0;
|
5
|
-
const fetcher_1 = require("./fetcher");
|
6
|
-
const generateGraphqlOperation_1 = require("./generateGraphqlOperation");
|
7
|
-
const createClient = ({ queryRoot, mutationRoot, subscriptionRoot, ...options }) => {
|
8
|
-
const fetcher = (0, fetcher_1.createFetcher)(options);
|
9
|
-
const client = {};
|
10
|
-
if (queryRoot) {
|
11
|
-
client.query = (request) => {
|
12
|
-
if (!queryRoot)
|
13
|
-
throw new Error('queryRoot argument is missing');
|
14
|
-
const resultPromise = fetcher((0, generateGraphqlOperation_1.generateGraphqlOperation)('query', queryRoot, request));
|
15
|
-
return resultPromise;
|
16
|
-
};
|
17
|
-
}
|
18
|
-
if (mutationRoot) {
|
19
|
-
client.mutation = (request) => {
|
20
|
-
if (!mutationRoot)
|
21
|
-
throw new Error('mutationRoot argument is missing');
|
22
|
-
const resultPromise = fetcher((0, generateGraphqlOperation_1.generateGraphqlOperation)('mutation', mutationRoot, request));
|
23
|
-
return resultPromise;
|
24
|
-
};
|
25
|
-
}
|
26
|
-
return client;
|
27
|
-
};
|
28
|
-
exports.createClient = createClient;
|
29
|
-
//# sourceMappingURL=createClient.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createClient.js","sourceRoot":"","sources":["../../../../../../../../extensions/healthie/lib/sdk/genql/generated/runtime/createClient.ts"],"names":[],"mappings":";AAAA,cAAc;;;AAEd,uCAA6D;AAE7D,yEAGmC;AAmB5B,MAAM,YAAY,GAAG,CAAC,EACzB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,GAAG,OAAO,EAKb,EAAE,EAAE;IACD,MAAM,OAAO,GAAG,IAAA,uBAAa,EAAC,OAAO,CAAC,CAAA;IACtC,MAAM,MAAM,GAGR,EAAE,CAAA;IAEN,IAAI,SAAS,EAAE;QACX,MAAM,CAAC,KAAK,GAAG,CAAC,OAAY,EAAE,EAAE;YAC5B,IAAI,CAAC,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;YAEhE,MAAM,aAAa,GAAG,OAAO,CACzB,IAAA,mDAAwB,EAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CACxD,CAAA;YAED,OAAO,aAAa,CAAA;QACxB,CAAC,CAAA;KACJ;IACD,IAAI,YAAY,EAAE;QACd,MAAM,CAAC,QAAQ,GAAG,CAAC,OAAY,EAAE,EAAE;YAC/B,IAAI,CAAC,YAAY;gBACb,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;YAEvD,MAAM,aAAa,GAAG,OAAO,CACzB,IAAA,mDAAwB,EAAC,UAAU,EAAE,YAAY,EAAE,OAAO,CAAC,CAC9D,CAAA;YAED,OAAO,aAAa,CAAA;QACxB,CAAC,CAAA;KACJ;IAED,OAAO,MAAa,CAAA;AACxB,CAAC,CAAA;AAzCY,QAAA,YAAY,gBAyCxB"}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
export declare class GenqlError extends Error {
|
2
|
-
errors: Array<GraphqlError>;
|
3
|
-
/**
|
4
|
-
* Partial data returned by the server
|
5
|
-
*/
|
6
|
-
data?: any;
|
7
|
-
constructor(errors: any[], data: any);
|
8
|
-
}
|
9
|
-
interface GraphqlError {
|
10
|
-
message: string;
|
11
|
-
locations?: Array<{
|
12
|
-
line: number;
|
13
|
-
column: number;
|
14
|
-
}>;
|
15
|
-
path?: string[];
|
16
|
-
extensions?: Record<string, any>;
|
17
|
-
}
|
18
|
-
export {};
|