@photonhealth/client 0.0.0-stage → 2.0.0-rc.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.
- package/LICENSE +15 -0
- package/README.md +89 -2
- package/dist/api/changes/applyOption.d.ts +41 -0
- package/dist/api/changes/applyOption.d.ts.map +1 -0
- package/dist/api/changes/applyOption.js +76 -0
- package/dist/api/changes/applyOption.js.map +1 -0
- package/dist/api/changes/classifyChanges.d.ts +9 -0
- package/dist/api/changes/classifyChanges.d.ts.map +1 -0
- package/dist/api/changes/classifyChanges.js +2 -0
- package/dist/api/changes/classifyChanges.js.map +1 -0
- package/dist/api/changes/index.d.ts +3 -0
- package/dist/api/changes/index.d.ts.map +1 -0
- package/dist/api/changes/index.js +3 -0
- package/dist/api/changes/index.js.map +1 -0
- package/dist/api/client.d.ts +43 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +77 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/health.d.ts +4 -0
- package/dist/api/health.d.ts.map +1 -0
- package/dist/api/health.js +6 -0
- package/dist/api/health.js.map +1 -0
- package/dist/api/index.d.ts +22 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +21 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/order.d.ts +33 -0
- package/dist/api/order.d.ts.map +1 -0
- package/dist/api/order.js +33 -0
- package/dist/api/order.js.map +1 -0
- package/dist/api/patient.d.ts +33 -0
- package/dist/api/patient.d.ts.map +1 -0
- package/dist/api/patient.js +33 -0
- package/dist/api/patient.js.map +1 -0
- package/dist/api/prescription.d.ts +31 -0
- package/dist/api/prescription.d.ts.map +1 -0
- package/dist/api/prescription.js +30 -0
- package/dist/api/prescription.js.map +1 -0
- package/dist/api/results.d.ts +30 -0
- package/dist/api/results.d.ts.map +1 -0
- package/dist/api/results.js +26 -0
- package/dist/api/results.js.map +1 -0
- package/dist/gql/gql.d.ts +21 -0
- package/dist/gql/gql.d.ts.map +1 -0
- package/dist/gql/gql.js +13 -0
- package/dist/gql/gql.js.map +1 -0
- package/dist/gql/graphql.d.ts +9674 -0
- package/dist/gql/graphql.d.ts.map +1 -0
- package/dist/gql/graphql.js +4030 -0
- package/dist/gql/graphql.js.map +1 -0
- package/dist/gql/index.d.ts +2 -0
- package/dist/gql/index.d.ts.map +1 -0
- package/dist/gql/index.js +3 -0
- package/dist/gql/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/photon/auth.d.ts +48 -0
- package/dist/photon/auth.d.ts.map +1 -0
- package/dist/photon/auth.js +34 -0
- package/dist/photon/auth.js.map +1 -0
- package/dist/photon/choices.d.ts +44 -0
- package/dist/photon/choices.d.ts.map +1 -0
- package/dist/photon/choices.js +58 -0
- package/dist/photon/choices.js.map +1 -0
- package/dist/photon/context.d.ts +29 -0
- package/dist/photon/context.d.ts.map +1 -0
- package/dist/photon/context.js +2 -0
- package/dist/photon/context.js.map +1 -0
- package/dist/photon/environments.d.ts +26 -0
- package/dist/photon/environments.d.ts.map +1 -0
- package/dist/photon/environments.js +26 -0
- package/dist/photon/environments.js.map +1 -0
- package/dist/photon/errors.d.ts +26 -0
- package/dist/photon/errors.d.ts.map +1 -0
- package/dist/photon/errors.js +42 -0
- package/dist/photon/errors.js.map +1 -0
- package/dist/photon/index.d.ts +23 -0
- package/dist/photon/index.d.ts.map +1 -0
- package/dist/photon/index.js +11 -0
- package/dist/photon/index.js.map +1 -0
- package/dist/photon/inputs.d.ts +7 -0
- package/dist/photon/inputs.d.ts.map +1 -0
- package/dist/photon/inputs.js +25 -0
- package/dist/photon/inputs.js.map +1 -0
- package/dist/photon/links.d.ts +68 -0
- package/dist/photon/links.d.ts.map +1 -0
- package/dist/photon/links.js +187 -0
- package/dist/photon/links.js.map +1 -0
- package/dist/photon/live.d.ts +62 -0
- package/dist/photon/live.d.ts.map +1 -0
- package/dist/photon/live.js +107 -0
- package/dist/photon/live.js.map +1 -0
- package/dist/photon/map.d.ts +10 -0
- package/dist/photon/map.d.ts.map +1 -0
- package/dist/photon/map.js +211 -0
- package/dist/photon/map.js.map +1 -0
- package/dist/photon/order.d.ts +148 -0
- package/dist/photon/order.d.ts.map +1 -0
- package/dist/photon/order.js +491 -0
- package/dist/photon/order.js.map +1 -0
- package/dist/photon/patient.d.ts +78 -0
- package/dist/photon/patient.d.ts.map +1 -0
- package/dist/photon/patient.js +316 -0
- package/dist/photon/patient.js.map +1 -0
- package/dist/photon/photon.d.ts +150 -0
- package/dist/photon/photon.d.ts.map +1 -0
- package/dist/photon/photon.js +315 -0
- package/dist/photon/photon.js.map +1 -0
- package/dist/photon/prescription.d.ts +132 -0
- package/dist/photon/prescription.d.ts.map +1 -0
- package/dist/photon/prescription.js +381 -0
- package/dist/photon/prescription.js.map +1 -0
- package/dist/photon/session.d.ts +84 -0
- package/dist/photon/session.d.ts.map +1 -0
- package/dist/photon/session.js +350 -0
- package/dist/photon/session.js.map +1 -0
- package/dist/photon/types.d.ts +411 -0
- package/dist/photon/types.d.ts.map +1 -0
- package/dist/photon/types.js +7 -0
- package/dist/photon/types.js.map +1 -0
- package/dist/test-utils/msw.d.ts +23 -0
- package/dist/test-utils/msw.d.ts.map +1 -0
- package/dist/test-utils/msw.js +51 -0
- package/dist/test-utils/msw.js.map +1 -0
- package/dist/testing/fixtures.d.ts +51 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +166 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/scriptedClient.d.ts +38 -0
- package/dist/testing/scriptedClient.d.ts.map +1 -0
- package/dist/testing/scriptedClient.js +52 -0
- package/dist/testing/scriptedClient.js.map +1 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +10 -0
- package/dist/testing.js.map +1 -0
- package/package.json +67 -4
- package/src/api/changes/applyOption.ts +103 -0
- package/src/api/changes/classifyChanges.ts +10 -0
- package/src/api/changes/index.ts +2 -0
- package/src/api/client.ts +124 -0
- package/src/api/health.ts +7 -0
- package/src/api/index.ts +22 -0
- package/src/api/order.ts +64 -0
- package/src/api/patient.ts +58 -0
- package/src/api/prescription.ts +68 -0
- package/src/api/results.ts +45 -0
- package/src/gql/gql.ts +56 -0
- package/src/gql/graphql.ts +5344 -0
- package/src/gql/index.ts +2 -0
- package/src/index.ts +14 -0
- package/src/operations/fragments.graphql +351 -0
- package/src/operations/health.graphql +4 -0
- package/src/operations/order.graphql +42 -0
- package/src/operations/patient.graphql +36 -0
- package/src/operations/prescription.graphql +70 -0
- package/src/photon/auth.ts +70 -0
- package/src/photon/choices.ts +79 -0
- package/src/photon/context.ts +30 -0
- package/src/photon/environments.ts +47 -0
- package/src/photon/errors.ts +56 -0
- package/src/photon/index.ts +35 -0
- package/src/photon/inputs.ts +24 -0
- package/src/photon/links.ts +197 -0
- package/src/photon/live.ts +135 -0
- package/src/photon/map.ts +255 -0
- package/src/photon/order.ts +581 -0
- package/src/photon/patient.ts +346 -0
- package/src/photon/photon.ts +513 -0
- package/src/photon/prescription.ts +447 -0
- package/src/photon/session.ts +445 -0
- package/src/photon/types.ts +329 -0
- package/src/test-utils/msw.ts +61 -0
- package/src/testing/fixtures.ts +191 -0
- package/src/testing/scriptedClient.ts +52 -0
- package/src/testing.ts +22 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../src/gql/graphql.ts"],"names":[],"mappings":"AA8xCA,MAAM,OAAO,mBACX,SAAQ,MAAM;IAGd,SAAS,CAAyE;IAC1E,KAAK,CAAS;IACf,QAAQ,CAAmC;IAElD,YAAY,KAAa,EAAE,QAA0C;QACnE,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEQ,QAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsMhE,CAAoG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gql/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gql/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @photonhealth/client — Photon Rx without a UI framework. Zero runtime dependencies; runs in browsers,
|
|
3
|
+
* Node, workers and agents.
|
|
4
|
+
*
|
|
5
|
+
* const ph = photon({ environment: "boson", auth: { getToken } });
|
|
6
|
+
* const { patient, candidates, changes } = await ph.patient({ demographic: { … } });
|
|
7
|
+
*
|
|
8
|
+
* network-api's three upsert mutations — patient, prescription, order — one call each, returning live
|
|
9
|
+
* objects (state you can subscribe to; methods that await the web calls) with the workflow rules
|
|
10
|
+
* inside. See docs/CORE.md.
|
|
11
|
+
*
|
|
12
|
+
* This is the whole public surface. The GraphQL layer (api/, gql/) is internal.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./photon/index.ts";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @photonhealth/client — Photon Rx without a UI framework. Zero runtime dependencies; runs in browsers,
|
|
3
|
+
* Node, workers and agents.
|
|
4
|
+
*
|
|
5
|
+
* const ph = photon({ environment: "boson", auth: { getToken } });
|
|
6
|
+
* const { patient, candidates, changes } = await ph.patient({ demographic: { … } });
|
|
7
|
+
*
|
|
8
|
+
* network-api's three upsert mutations — patient, prescription, order — one call each, returning live
|
|
9
|
+
* objects (state you can subscribe to; methods that await the web calls) with the workflow rules
|
|
10
|
+
* inside. See docs/CORE.md.
|
|
11
|
+
*
|
|
12
|
+
* This is the whole public surface. The GraphQL layer (api/, gql/) is internal.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./photon/index.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a photon instance gets its token.
|
|
3
|
+
*
|
|
4
|
+
* SPA `{ clientId }` — core signs the prescriber in itself, in the browser (session.ts): `ph.session`.
|
|
5
|
+
* SPA `{ getToken }` — the host signs in (e.g. its own Auth0 SDK) and supplies the org-scoped token.
|
|
6
|
+
* M2M `{ clientId, clientSecret, organizationId }` — a backend's own credentials. Core will run the
|
|
7
|
+
* client-credentials grant, cache the token until shortly before it expires, share one refresh
|
|
8
|
+
* between concurrent calls and retry once on a 401. Not built yet (Photon-Health/prescribe#18): the shape is
|
|
9
|
+
* fixed now so it doesn't change later. Servers only: `photon()` refuses a secret in a browser.
|
|
10
|
+
*/
|
|
11
|
+
export type PhotonAuth = {
|
|
12
|
+
getToken: () => Promise<string>;
|
|
13
|
+
} | {
|
|
14
|
+
clientId: string;
|
|
15
|
+
} | {
|
|
16
|
+
clientId: string;
|
|
17
|
+
clientSecret: string;
|
|
18
|
+
organizationId: string;
|
|
19
|
+
};
|
|
20
|
+
/** Core's own browser sign-in: a client id alone. */
|
|
21
|
+
export declare const signsIn: (auth: PhotonAuth) => auth is {
|
|
22
|
+
clientId: string;
|
|
23
|
+
};
|
|
24
|
+
/** A client secret, in any shape it's given (M2M). */
|
|
25
|
+
export declare const hasSecret: (auth: object) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether this code runs in a browser — a page, or a worker one started — where everything in it, a secret too,
|
|
28
|
+
* is readable by whoever opens the page.
|
|
29
|
+
*/
|
|
30
|
+
export declare const inBrowser: () => boolean;
|
|
31
|
+
/** A client secret in a browser is a published secret: refused before anything else, and loudly. */
|
|
32
|
+
export declare function refuseSecretInBrowser(auth: object): void;
|
|
33
|
+
export declare function tokenSource(auth: PhotonAuth): () => Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* How links from an instance sign in (`FlowLink.auth`): an embed signs the prescriber in with the host's own
|
|
36
|
+
* client — `{ clientId }`'s — and any link opens in the instance's organization, when it has one. An M2M client
|
|
37
|
+
* makes webapp links only: its credentials are a server's, so its client id and secret never go in a link.
|
|
38
|
+
*/
|
|
39
|
+
export interface LinkAuth {
|
|
40
|
+
/** The client an embed signs in with: the instance's `{ clientId }`. Never an M2M client's. */
|
|
41
|
+
clientId: string | null;
|
|
42
|
+
/** The organization links open in: `photon({ organization })`, or M2M's `organizationId`. */
|
|
43
|
+
organization: string | null;
|
|
44
|
+
/** M2M: `frame()` is refused. */
|
|
45
|
+
machine: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function linkAuthOf(auth: PhotonAuth, organization?: string): LinkAuth;
|
|
48
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/photon/auth.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,GACnC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GACpB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,qDAAqD;AACrD,eAAO,MAAM,OAAO,GAAI,MAAM,UAAU,KAAG,IAAI,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAA;CAA4C,CAAC;AAElH,sDAAsD;AACtD,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,OAA4D,CAAC;AAEtG;;;GAGG;AACH,eAAO,MAAM,SAAS,QAAO,OACuF,CAAC;AAErH,oGAAoG;AACpG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQxD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAInE;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,+FAA+F;IAC/F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,6FAA6F;IAC7F,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,CAQ5E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PhotonError } from "./errors.js";
|
|
2
|
+
/** Core's own browser sign-in: a client id alone. */
|
|
3
|
+
export const signsIn = (auth) => "clientId" in auth && !hasSecret(auth);
|
|
4
|
+
/** A client secret, in any shape it's given (M2M). */
|
|
5
|
+
export const hasSecret = (auth) => "clientSecret" in auth || "client_secret" in auth;
|
|
6
|
+
/**
|
|
7
|
+
* Whether this code runs in a browser — a page, or a worker one started — where everything in it, a secret too,
|
|
8
|
+
* is readable by whoever opens the page.
|
|
9
|
+
*/
|
|
10
|
+
export const inBrowser = () => typeof document !== "undefined" || typeof globalThis.importScripts === "function";
|
|
11
|
+
/** A client secret in a browser is a published secret: refused before anything else, and loudly. */
|
|
12
|
+
export function refuseSecretInBrowser(auth) {
|
|
13
|
+
if (!hasSecret(auth) || !inBrowser())
|
|
14
|
+
return;
|
|
15
|
+
throw new PhotonError("invalid", "SECURITY: a client secret was passed to photon() in a browser. Anyone who opens this page can read it and " +
|
|
16
|
+
"act as your backend — treat it as leaked and rotate it now. Client credentials (M2M) are for servers only; " +
|
|
17
|
+
"in a browser use { clientId } (core signs the prescriber in) or { getToken }.");
|
|
18
|
+
}
|
|
19
|
+
export function tokenSource(auth) {
|
|
20
|
+
if ("getToken" in auth)
|
|
21
|
+
return auth.getToken;
|
|
22
|
+
refuseSecretInBrowser(auth);
|
|
23
|
+
throw new PhotonError("invalid", "Client-credentials (M2M) auth isn't supported yet — pass { getToken }.");
|
|
24
|
+
}
|
|
25
|
+
export function linkAuthOf(auth, organization) {
|
|
26
|
+
const machine = hasSecret(auth);
|
|
27
|
+
const orgOfMachine = machine ? auth.organizationId : undefined;
|
|
28
|
+
return {
|
|
29
|
+
clientId: signsIn(auth) ? auth.clientId : null,
|
|
30
|
+
organization: organization || orgOfMachine || null,
|
|
31
|
+
machine,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/photon/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiB1C,qDAAqD;AACrD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAgC,EAAE,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAElH,sDAAsD;AAC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ChangeSet), without parsing its prose.
|
|
4
|
+
*
|
|
5
|
+
* needsChoice AMBIGUOUS — nothing was written; the caller picks an option and sends again
|
|
6
|
+
* blocking REJECTED, or applied but BLOCKING — can't proceed until fixed
|
|
7
|
+
* advisories applied, but worth showing (COST_SAVINGS, PRODUCT_PREFERENCE, …)
|
|
8
|
+
* applied everything else that took effect
|
|
9
|
+
*/
|
|
10
|
+
export interface ClassifiedChanges {
|
|
11
|
+
needsChoice: Change[];
|
|
12
|
+
blocking: Change[];
|
|
13
|
+
advisories: Change[];
|
|
14
|
+
applied: Change[];
|
|
15
|
+
/** Nothing left open: no choice to make, nothing blocking. */
|
|
16
|
+
settled: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function classify(changes: Changes): ClassifiedChanges;
|
|
19
|
+
/** The changes waiting for a pick (e.g. which lisinopril), each with its options. Nothing was written for them. */
|
|
20
|
+
export declare const choicesIn: (changes: Changes) => Change[];
|
|
21
|
+
/**
|
|
22
|
+
* The one option the server has *declared* the match: a choice with a single option marked an exact name
|
|
23
|
+
* or RxNorm match. Taken without asking; anything else — fuzzy, several options, no match type — is the
|
|
24
|
+
* caller's (the prescriber's) pick.
|
|
25
|
+
*/
|
|
26
|
+
export declare function declaredChoice(changes: Changes): ChangeOption | null;
|
|
27
|
+
/**
|
|
28
|
+
* The input to send again with a pick applied — the option says where it goes (`path`) and what (`value`).
|
|
29
|
+
* Never parse an option's prose. (On a live object, `obj.choose(option)` does this for you.)
|
|
30
|
+
*
|
|
31
|
+
* const { changes } = await ph.prescription({ treatment: { name: "lisinopril" } });
|
|
32
|
+
* const option = choicesIn(changes)[0]!.options[1]!;
|
|
33
|
+
* await ph.prescription(withChoice({ patient: { id }, treatment: { name: "lisinopril" } }, option));
|
|
34
|
+
*/
|
|
35
|
+
export declare function withChoice<T>(input: T, option: ChangeOption): T;
|
|
36
|
+
/** A key for an option — the same pick gives the same key. */
|
|
37
|
+
export declare const optionKey: (option: ChangeOption) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Does the server want a mailing address for this patient? network-api says so either as an unapplied
|
|
40
|
+
* change under demographic.address (patient upserts) or in an error ("patient … has no address", at
|
|
41
|
+
* submit). Ask for one only when it does — a phone is often enough.
|
|
42
|
+
*/
|
|
43
|
+
export declare function asksForAddress(changes?: Changes | null, message?: string | null): boolean;
|
|
44
|
+
//# sourceMappingURL=choices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../../src/photon/choices.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAU5D;AAED,mHAAmH;AACnH,eAAO,MAAM,SAAS,GAAI,SAAS,OAAO,KAAG,MAAM,EAA+D,CAAC;AAInH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAMpE;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,GAAG,CAAC,CAG/D;AAED,8DAA8D;AAC9D,eAAO,MAAM,SAAS,GAAI,QAAQ,YAAY,WAAqD,CAAC;AAEpG;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAOzF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { applyAt } from "../api/index.js";
|
|
2
|
+
export function classify(changes) {
|
|
3
|
+
const result = { needsChoice: [], blocking: [], advisories: [], applied: [], settled: true };
|
|
4
|
+
for (const c of changes.unapplied)
|
|
5
|
+
(c.status === "AMBIGUOUS" ? result.needsChoice : result.blocking).push(c);
|
|
6
|
+
for (const c of changes.applied) {
|
|
7
|
+
if (c.severity === "BLOCKING")
|
|
8
|
+
result.blocking.push(c);
|
|
9
|
+
else if (c.severity === "ADVISORY")
|
|
10
|
+
result.advisories.push(c);
|
|
11
|
+
else
|
|
12
|
+
result.applied.push(c);
|
|
13
|
+
}
|
|
14
|
+
result.settled = result.needsChoice.length === 0 && result.blocking.length === 0;
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
/** The changes waiting for a pick (e.g. which lisinopril), each with its options. Nothing was written for them. */
|
|
18
|
+
export const choicesIn = (changes) => changes.unapplied.filter((c) => c.status === "AMBIGUOUS");
|
|
19
|
+
const DECLARED = ["EXACT_NAME_MATCH", "RXNORM_CODE_MATCH"];
|
|
20
|
+
/**
|
|
21
|
+
* The one option the server has *declared* the match: a choice with a single option marked an exact name
|
|
22
|
+
* or RxNorm match. Taken without asking; anything else — fuzzy, several options, no match type — is the
|
|
23
|
+
* caller's (the prescriber's) pick.
|
|
24
|
+
*/
|
|
25
|
+
export function declaredChoice(changes) {
|
|
26
|
+
for (const change of choicesIn(changes)) {
|
|
27
|
+
const [only, ...rest] = change.options;
|
|
28
|
+
if (only && !rest.length && only.matchReasons.some((r) => DECLARED.includes(r.type)))
|
|
29
|
+
return only;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The input to send again with a pick applied — the option says where it goes (`path`) and what (`value`).
|
|
35
|
+
* Never parse an option's prose. (On a live object, `obj.choose(option)` does this for you.)
|
|
36
|
+
*
|
|
37
|
+
* const { changes } = await ph.prescription({ treatment: { name: "lisinopril" } });
|
|
38
|
+
* const option = choicesIn(changes)[0]!.options[1]!;
|
|
39
|
+
* await ph.prescription(withChoice({ patient: { id }, treatment: { name: "lisinopril" } }, option));
|
|
40
|
+
*/
|
|
41
|
+
export function withChoice(input, option) {
|
|
42
|
+
if (!option.path)
|
|
43
|
+
throw new Error(`"${option.displayName}" calls ${option.operation}; it doesn't go in this input.`);
|
|
44
|
+
return applyAt(input, option.path, option.value);
|
|
45
|
+
}
|
|
46
|
+
/** A key for an option — the same pick gives the same key. */
|
|
47
|
+
export const optionKey = (option) => `${option.path}=${JSON.stringify(option.value)}`;
|
|
48
|
+
/**
|
|
49
|
+
* Does the server want a mailing address for this patient? network-api says so either as an unapplied
|
|
50
|
+
* change under demographic.address (patient upserts) or in an error ("patient … has no address", at
|
|
51
|
+
* submit). Ask for one only when it does — a phone is often enough.
|
|
52
|
+
*/
|
|
53
|
+
export function asksForAddress(changes, message) {
|
|
54
|
+
const fromChanges = (changes?.unapplied ?? []).some((c) => c.key.startsWith("demographic.address") ||
|
|
55
|
+
(c.category === "MISSING_INPUT" && /address/i.test(`${c.label} ${c.reason ?? ""}`)));
|
|
56
|
+
return fromChanges || /\baddress\b/i.test(message ?? "");
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=choices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choices.js","sourceRoot":"","sources":["../../src/photon/choices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAoB1C,MAAM,UAAU,QAAQ,CAAC,OAAgB;IACvC,MAAM,MAAM,GAAsB,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChH,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,SAAS;QAAE,CAAC,CAAC,CAAC,MAAM,KAAK,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AC,CAAC,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IACpG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAI,KAAQ,EAAE,MAAoB;IAC1D,IAAI,CAAC,MAAM,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,WAAW,WAAW,MAAM,CAAC,SAAS,gCAAgC,CAAC,CAAC;IACrH,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAoB,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAEpG;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAwB,EAAE,OAAuB;IAC9E,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CACjD,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,qBAAqB,CAAC;QACvC,CAAC,CAAC,CAAC,QAAQ,KAAK,eAAe,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,CAAC,CACtF,CAAC;IACF,OAAO,WAAW,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { NetworkClient } from "../api/index.ts";
|
|
2
|
+
import type { Order } from "./order.ts";
|
|
3
|
+
import type { Patient } from "./patient.ts";
|
|
4
|
+
import type { Prescription } from "./prescription.ts";
|
|
5
|
+
import type { Changes, OrderRecord, PatientRecord, PrescriptionRecord } from "./types.ts";
|
|
6
|
+
/**
|
|
7
|
+
* What a photon instance's objects share: the client, and one object per record. `patient(record)` gives
|
|
8
|
+
* the object for that record — the one already held (which takes this copy, if it's idle) or a new one.
|
|
9
|
+
*/
|
|
10
|
+
export interface Context {
|
|
11
|
+
client: NetworkClient;
|
|
12
|
+
patient(record: PatientRecord, changes?: Changes): Patient;
|
|
13
|
+
prescription(record: PrescriptionRecord, changes?: Changes): Prescription;
|
|
14
|
+
order(record: OrderRecord, changes?: Changes): Order;
|
|
15
|
+
/** The object for a record by id: the one held, or read (null when there's no such record). */
|
|
16
|
+
openPatient(id: string): Promise<Patient | null>;
|
|
17
|
+
openPrescription(id: string): Promise<Prescription | null>;
|
|
18
|
+
/** The app's link to an object's flow, and the embeddable one (ph.url / ph.frame). */
|
|
19
|
+
url(obj: Patient | Prescription | Order): string;
|
|
20
|
+
frame(obj: Patient | Prescription | Order): string;
|
|
21
|
+
/** An object made before its record just got one: hold it as that record's object (unless one is held). */
|
|
22
|
+
register(obj: Patient | Prescription | Order): void;
|
|
23
|
+
held: {
|
|
24
|
+
patients: Map<string, Patient>;
|
|
25
|
+
prescriptions: Map<string, Prescription>;
|
|
26
|
+
orders: Map<string, Order>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/photon/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC3D,YAAY,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;IAC1E,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACrD,+FAA+F;IAC/F,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACjD,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC3D,sFAAsF;IACtF,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;IACjD,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;IACnD,2GAA2G;IAE3G,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,KAAK,GAAG,IAAI,CAAC;IACpD,IAAI,EAAE;QACJ,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACzC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KAC5B,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/photon/context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photon environments, in code. Every URL is inferred from the environment name —
|
|
3
|
+
* `<service>.<env>.health` — so there's nothing to configure per deploy, in a browser or on a server.
|
|
4
|
+
* Mirrors Photon-Health/mcp src/config.ts. tau is locally running services; it signs in through
|
|
5
|
+
* boson's Auth0 tenant.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PHOTON_ENVIRONMENTS: readonly ["boson", "tau", "neutron", "photon"];
|
|
8
|
+
export type PhotonEnvironment = (typeof PHOTON_ENVIRONMENTS)[number];
|
|
9
|
+
export interface EnvironmentUrls {
|
|
10
|
+
name: PhotonEnvironment;
|
|
11
|
+
/** network-api's GraphQL endpoint (it allows cross-origin calls from browsers). */
|
|
12
|
+
networkApiUrl: string;
|
|
13
|
+
/** The Auth0 tenant that issues tokens for it. */
|
|
14
|
+
auth0Domain: string;
|
|
15
|
+
/** The token audience network-api accepts. */
|
|
16
|
+
auth0Audience: string;
|
|
17
|
+
/**
|
|
18
|
+
* The Photon Rx app: where `ph.url()` / `ph.frame()` links go unless the instance says (`photon({ appUrl })`) —
|
|
19
|
+
* `rx.new` in production, `rx.<env>.health` otherwise; tau's is the local dev server (`npm run dev:tau`).
|
|
20
|
+
*/
|
|
21
|
+
appUrl: string;
|
|
22
|
+
}
|
|
23
|
+
/** The environment whose Auth0 tenant `name` signs in through (itself, except tau → boson). */
|
|
24
|
+
export declare const authEnvironmentOf: (name: PhotonEnvironment) => PhotonEnvironment;
|
|
25
|
+
export declare function environmentUrls(name: PhotonEnvironment): EnvironmentUrls;
|
|
26
|
+
//# sourceMappingURL=environments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.d.ts","sourceRoot":"","sources":["../../src/photon/environments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,mBAAmB,gDAAiD,CAAC;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,iBAAiB,CAAC;IACxB,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAWD,+FAA+F;AAC/F,eAAO,MAAM,iBAAiB,GAAI,MAAM,iBAAiB,KAAG,iBAAmD,CAAC;AAEhH,wBAAgB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,eAAe,CASxE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Photon environments, in code. Every URL is inferred from the environment name —
|
|
3
|
+
* `<service>.<env>.health` — so there's nothing to configure per deploy, in a browser or on a server.
|
|
4
|
+
* Mirrors Photon-Health/mcp src/config.ts. tau is locally running services; it signs in through
|
|
5
|
+
* boson's Auth0 tenant.
|
|
6
|
+
*/
|
|
7
|
+
export const PHOTON_ENVIRONMENTS = ["boson", "tau", "neutron", "photon"];
|
|
8
|
+
/** Environments without their own Auth0 tenant. Local services (tau) sign in through boson's. */
|
|
9
|
+
const AUTH_ENVIRONMENT = { tau: "boson" };
|
|
10
|
+
/** The app's own domain, where it isn't `rx.<env>.health`. */
|
|
11
|
+
const APP_URL = { photon: "https://rx.new", tau: "http://localhost:3000" };
|
|
12
|
+
/** Local services are plain http (fine from http://localhost); every hosted environment is https. */
|
|
13
|
+
const scheme = (name) => (name === "tau" ? "http" : "https");
|
|
14
|
+
/** The environment whose Auth0 tenant `name` signs in through (itself, except tau → boson). */
|
|
15
|
+
export const authEnvironmentOf = (name) => AUTH_ENVIRONMENT[name] ?? name;
|
|
16
|
+
export function environmentUrls(name) {
|
|
17
|
+
const authEnv = authEnvironmentOf(name);
|
|
18
|
+
return {
|
|
19
|
+
name,
|
|
20
|
+
networkApiUrl: `${scheme(name)}://network.${name}.health/graphql`,
|
|
21
|
+
auth0Domain: `auth.${authEnv}.health`,
|
|
22
|
+
auth0Audience: `https://api.${authEnv}.health`,
|
|
23
|
+
appUrl: APP_URL[name] ?? `https://rx.${name}.health`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=environments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environments.js","sourceRoot":"","sources":["../../src/photon/environments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAkBlF,iGAAiG;AACjG,MAAM,gBAAgB,GAA0D,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAEjG,8DAA8D;AAC9D,MAAM,OAAO,GAA+C,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,uBAAuB,EAAE,CAAC;AAEvH,qGAAqG;AACrG,MAAM,MAAM,GAAG,CAAC,IAAuB,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAEhF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAuB,EAAqB,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAEhH,MAAM,UAAU,eAAe,CAAC,IAAuB;IACrD,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO;QACL,IAAI;QACJ,aAAa,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,iBAAiB;QACjE,WAAW,EAAE,QAAQ,OAAO,SAAS;QACrC,aAAa,EAAE,eAAe,OAAO,SAAS;QAC9C,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc,IAAI,SAAS;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one thing core throws. Anything the server *answers* about the data is a result (a null record,
|
|
3
|
+
* candidates, unapplied changes); a PhotonError is a failure that sending different data can't fix.
|
|
4
|
+
*
|
|
5
|
+
* network fetch failed or timed out — retryable
|
|
6
|
+
* unauthorized bad or expired token, or a permission the caller lacks
|
|
7
|
+
* upstream a network-api dependency failed — `retryable` says whether to try again
|
|
8
|
+
* invalid the server rejected the request's shape (a bug in the caller or in core)
|
|
9
|
+
* refused a live object's rule said no (sign a changed prescription, submit with an unsigned one,
|
|
10
|
+
* update a signed one) — not retryable as is
|
|
11
|
+
*/
|
|
12
|
+
export type PhotonErrorKind = "network" | "unauthorized" | "upstream" | "invalid" | "refused";
|
|
13
|
+
export declare class PhotonError extends Error {
|
|
14
|
+
readonly kind: PhotonErrorKind;
|
|
15
|
+
readonly retryable: boolean;
|
|
16
|
+
name: string;
|
|
17
|
+
constructor(kind: PhotonErrorKind, message: string, retryable?: boolean, options?: {
|
|
18
|
+
cause?: unknown;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** Any failure from the transport or network-api, as a PhotonError. */
|
|
22
|
+
export declare function toPhotonError(e: unknown): PhotonError;
|
|
23
|
+
/** Run a call, turning any failure into a PhotonError. */
|
|
24
|
+
export declare function guarded<T>(work: () => Promise<T>): Promise<T>;
|
|
25
|
+
export declare const refuse: (message: string) => PhotonError;
|
|
26
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/photon/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAE9F,qBAAa,WAAY,SAAQ,KAAK;IAGlC,QAAQ,CAAC,IAAI,EAAE,eAAe;IAE9B,QAAQ,CAAC,SAAS;IAJX,IAAI,SAAiB;gBAEnB,IAAI,EAAE,eAAe,EAC9B,OAAO,EAAE,MAAM,EACN,SAAS,UAAQ,EAC1B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIhC;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,WAAW,CAgBrD;AAED,0DAA0D;AAC1D,wBAAsB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAMnE;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,gBAAwC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { NetworkTransportError, OperationFailure } from "../api/index.js";
|
|
2
|
+
export class PhotonError extends Error {
|
|
3
|
+
kind;
|
|
4
|
+
retryable;
|
|
5
|
+
name = "PhotonError";
|
|
6
|
+
constructor(kind, message, retryable = false, options) {
|
|
7
|
+
super(message, options);
|
|
8
|
+
this.kind = kind;
|
|
9
|
+
this.retryable = retryable;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Any failure from the transport or network-api, as a PhotonError. */
|
|
13
|
+
export function toPhotonError(e) {
|
|
14
|
+
if (e instanceof PhotonError)
|
|
15
|
+
return e;
|
|
16
|
+
if (e instanceof OperationFailure) {
|
|
17
|
+
return e.type === "UNAUTHORIZED"
|
|
18
|
+
? new PhotonError("unauthorized", e.message, false, { cause: e })
|
|
19
|
+
: new PhotonError("upstream", e.message, e.retryable, { cause: e });
|
|
20
|
+
}
|
|
21
|
+
if (e instanceof NetworkTransportError) {
|
|
22
|
+
if (e.status === 401 || e.status === 403 || e.code === "UNAUTHENTICATED" || e.code === "FORBIDDEN")
|
|
23
|
+
return new PhotonError("unauthorized", e.message, false, { cause: e });
|
|
24
|
+
if (e.status !== undefined && e.status >= 500)
|
|
25
|
+
return new PhotonError("network", e.message, true, { cause: e });
|
|
26
|
+
return new PhotonError("invalid", e.message, false, { cause: e });
|
|
27
|
+
}
|
|
28
|
+
// fetch() itself failed (offline, DNS, CORS, aborted) — or the token source threw.
|
|
29
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
30
|
+
return new PhotonError("network", message, true, { cause: e });
|
|
31
|
+
}
|
|
32
|
+
/** Run a call, turning any failure into a PhotonError. */
|
|
33
|
+
export async function guarded(work) {
|
|
34
|
+
try {
|
|
35
|
+
return await work();
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
throw toPhotonError(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const refuse = (message) => new PhotonError("refused", message);
|
|
42
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/photon/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAe1E,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGzB;IAEA;IAJF,IAAI,GAAG,aAAa,CAAC;IAC9B,YACW,IAAqB,EAC9B,OAAe,EACN,YAAY,KAAK,EAC1B,OAA6B;QAE7B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QALf,SAAI,GAAJ,IAAI,CAAiB;QAErB,cAAS,GAAT,SAAS,CAAQ;IAI5B,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,IAAI,CAAC,YAAY,WAAW;QAAE,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,YAAY,gBAAgB,EAAE,CAAC;QAClC,OAAO,CAAC,CAAC,IAAI,KAAK,cAAc;YAC9B,CAAC,CAAC,IAAI,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YACjE,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,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,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public API: `photon()` and what it returns. network-api's three upsert mutations, one call each,
|
|
3
|
+
* returning live objects with the workflow rules inside — objects that can exist before their record. See
|
|
4
|
+
* docs/CORE.md.
|
|
5
|
+
*/
|
|
6
|
+
export { photon, Patient, Prescription, Order } from "./photon.ts";
|
|
7
|
+
export type { Photon, PhotonOptions, Calls, LinkTo, PatientResult, PrescriptionResult, OrderResult, LiveObject, AnySnapshot, PatientSnapshot, PrescriptionSnapshot, OrderSnapshot, } from "./photon.ts";
|
|
8
|
+
export type { PatientExtra } from "./patient.ts";
|
|
9
|
+
export type { PrescriptionExtra, PrescriptionUpdate } from "./prescription.ts";
|
|
10
|
+
export type { OrderExtra, OrderUpdate } from "./order.ts";
|
|
11
|
+
export type { LiveStatus, LiveSnapshot, LiveBase } from "./live.ts";
|
|
12
|
+
export type { PhotonAuth } from "./auth.ts";
|
|
13
|
+
export { Session } from "./session.ts";
|
|
14
|
+
export type { SessionStatus, SessionSnapshot, SessionUser, SessionConfig } from "./session.ts";
|
|
15
|
+
export { PhotonError } from "./errors.ts";
|
|
16
|
+
export type { Flow, FlowLink } from "./links.ts";
|
|
17
|
+
export type { PhotonErrorKind } from "./errors.ts";
|
|
18
|
+
export { PHOTON_ENVIRONMENTS, environmentUrls, authEnvironmentOf } from "./environments.ts";
|
|
19
|
+
export type { PhotonEnvironment, EnvironmentUrls } from "./environments.ts";
|
|
20
|
+
export { classify, choicesIn, declaredChoice, withChoice, asksForAddress } from "./choices.ts";
|
|
21
|
+
export type { ClassifiedChanges } from "./choices.ts";
|
|
22
|
+
export type * from "./types.ts";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public API: `photon()` and what it returns. network-api's three upsert mutations, one call each,
|
|
3
|
+
* returning live objects with the workflow rules inside — objects that can exist before their record. See
|
|
4
|
+
* docs/CORE.md.
|
|
5
|
+
*/
|
|
6
|
+
export { photon, Patient, Prescription, Order } from "./photon.js";
|
|
7
|
+
export { Session } from "./session.js";
|
|
8
|
+
export { PhotonError } from "./errors.js";
|
|
9
|
+
export { PHOTON_ENVIRONMENTS, environmentUrls, authEnvironmentOf } from "./environments.js";
|
|
10
|
+
export { classify, choicesIn, declaredChoice, withChoice, asksForAddress } from "./choices.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/photon/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAoBnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An input without its empty values — "" (and whitespace), null, undefined, {} and [] — so an empty field
|
|
3
|
+
* reads as "not known" rather than as a value to send. For syncs before a record exists (lookups, finding);
|
|
4
|
+
* once it does, "" can mean "clear this", so updates send what they're given.
|
|
5
|
+
*/
|
|
6
|
+
export declare function filled<T>(value: T): T;
|
|
7
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/photon/inputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAErC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An input without its empty values — "" (and whitespace), null, undefined, {} and [] — so an empty field
|
|
3
|
+
* reads as "not known" rather than as a value to send. For syncs before a record exists (lookups, finding);
|
|
4
|
+
* once it does, "" can mean "clear this", so updates send what they're given.
|
|
5
|
+
*/
|
|
6
|
+
export function filled(value) {
|
|
7
|
+
return (prune(value) ?? {});
|
|
8
|
+
}
|
|
9
|
+
function prune(value) {
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
const items = value.map(prune).filter((v) => v !== undefined);
|
|
12
|
+
return items.length ? items : undefined;
|
|
13
|
+
}
|
|
14
|
+
if (value && typeof value === "object") {
|
|
15
|
+
const entries = Object.entries(value).flatMap(([k, v]) => {
|
|
16
|
+
const kept = prune(v);
|
|
17
|
+
return kept === undefined ? [] : [[k, kept]];
|
|
18
|
+
});
|
|
19
|
+
return entries.length ? Object.fromEntries(entries) : undefined;
|
|
20
|
+
}
|
|
21
|
+
if (typeof value === "string" && !value.trim())
|
|
22
|
+
return undefined;
|
|
23
|
+
return value ?? undefined;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../src/photon/inputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAI,KAAQ;IAChC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAM,CAAC;AACnC,CAAC;AAED,SAAS,KAAK,CAAC,KAAc;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EA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