@medplum/core 0.9.14 → 0.9.15
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/index.js +151 -151
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +151 -151
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -820,155 +820,6 @@
|
|
|
820
820
|
return decodePayload(payload);
|
|
821
821
|
}
|
|
822
822
|
|
|
823
|
-
const OK_ID = 'ok';
|
|
824
|
-
const CREATED_ID = 'created';
|
|
825
|
-
const GONE_ID = 'gone';
|
|
826
|
-
const NOT_MODIFIED_ID = 'not-modified';
|
|
827
|
-
const NOT_FOUND_ID = 'not-found';
|
|
828
|
-
const ACCESS_DENIED = 'access-denied';
|
|
829
|
-
const allOk = {
|
|
830
|
-
resourceType: 'OperationOutcome',
|
|
831
|
-
id: OK_ID,
|
|
832
|
-
issue: [
|
|
833
|
-
{
|
|
834
|
-
severity: 'information',
|
|
835
|
-
code: 'information',
|
|
836
|
-
details: {
|
|
837
|
-
text: 'All OK',
|
|
838
|
-
},
|
|
839
|
-
},
|
|
840
|
-
],
|
|
841
|
-
};
|
|
842
|
-
const created = {
|
|
843
|
-
resourceType: 'OperationOutcome',
|
|
844
|
-
id: CREATED_ID,
|
|
845
|
-
issue: [
|
|
846
|
-
{
|
|
847
|
-
severity: 'information',
|
|
848
|
-
code: 'information',
|
|
849
|
-
details: {
|
|
850
|
-
text: 'Created',
|
|
851
|
-
},
|
|
852
|
-
},
|
|
853
|
-
],
|
|
854
|
-
};
|
|
855
|
-
const notModified = {
|
|
856
|
-
resourceType: 'OperationOutcome',
|
|
857
|
-
id: NOT_MODIFIED_ID,
|
|
858
|
-
issue: [
|
|
859
|
-
{
|
|
860
|
-
severity: 'information',
|
|
861
|
-
code: 'information',
|
|
862
|
-
details: {
|
|
863
|
-
text: 'Not Modified',
|
|
864
|
-
},
|
|
865
|
-
},
|
|
866
|
-
],
|
|
867
|
-
};
|
|
868
|
-
const notFound = {
|
|
869
|
-
resourceType: 'OperationOutcome',
|
|
870
|
-
id: NOT_FOUND_ID,
|
|
871
|
-
issue: [
|
|
872
|
-
{
|
|
873
|
-
severity: 'error',
|
|
874
|
-
code: 'not-found',
|
|
875
|
-
details: {
|
|
876
|
-
text: 'Not found',
|
|
877
|
-
},
|
|
878
|
-
},
|
|
879
|
-
],
|
|
880
|
-
};
|
|
881
|
-
const gone = {
|
|
882
|
-
resourceType: 'OperationOutcome',
|
|
883
|
-
id: GONE_ID,
|
|
884
|
-
issue: [
|
|
885
|
-
{
|
|
886
|
-
severity: 'error',
|
|
887
|
-
code: 'gone',
|
|
888
|
-
details: {
|
|
889
|
-
text: 'Gone',
|
|
890
|
-
},
|
|
891
|
-
},
|
|
892
|
-
],
|
|
893
|
-
};
|
|
894
|
-
const accessDenied = {
|
|
895
|
-
resourceType: 'OperationOutcome',
|
|
896
|
-
id: ACCESS_DENIED,
|
|
897
|
-
issue: [
|
|
898
|
-
{
|
|
899
|
-
severity: 'error',
|
|
900
|
-
code: 'access-denied',
|
|
901
|
-
details: {
|
|
902
|
-
text: 'Access Denied',
|
|
903
|
-
},
|
|
904
|
-
},
|
|
905
|
-
],
|
|
906
|
-
};
|
|
907
|
-
function badRequest(details, expression) {
|
|
908
|
-
return {
|
|
909
|
-
resourceType: 'OperationOutcome',
|
|
910
|
-
issue: [
|
|
911
|
-
{
|
|
912
|
-
severity: 'error',
|
|
913
|
-
code: 'invalid',
|
|
914
|
-
details: {
|
|
915
|
-
text: details,
|
|
916
|
-
},
|
|
917
|
-
expression: expression ? [expression] : undefined,
|
|
918
|
-
},
|
|
919
|
-
],
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
function isOk(outcome) {
|
|
923
|
-
return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;
|
|
924
|
-
}
|
|
925
|
-
function isNotFound(outcome) {
|
|
926
|
-
return outcome.id === NOT_FOUND_ID;
|
|
927
|
-
}
|
|
928
|
-
function isGone(outcome) {
|
|
929
|
-
return outcome.id === GONE_ID;
|
|
930
|
-
}
|
|
931
|
-
function getStatus(outcome) {
|
|
932
|
-
if (outcome.id === OK_ID) {
|
|
933
|
-
return 200;
|
|
934
|
-
}
|
|
935
|
-
else if (outcome.id === CREATED_ID) {
|
|
936
|
-
return 201;
|
|
937
|
-
}
|
|
938
|
-
else if (outcome.id === NOT_MODIFIED_ID) {
|
|
939
|
-
return 304;
|
|
940
|
-
}
|
|
941
|
-
else if (outcome.id === ACCESS_DENIED) {
|
|
942
|
-
return 403;
|
|
943
|
-
}
|
|
944
|
-
else if (outcome.id === NOT_FOUND_ID) {
|
|
945
|
-
return 404;
|
|
946
|
-
}
|
|
947
|
-
else if (outcome.id === GONE_ID) {
|
|
948
|
-
return 410;
|
|
949
|
-
}
|
|
950
|
-
else {
|
|
951
|
-
return 400;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* Asserts that the operation completed successfully and that the resource is defined.
|
|
956
|
-
* @param outcome The operation outcome.
|
|
957
|
-
* @param resource The resource that may or may not have been returned.
|
|
958
|
-
*/
|
|
959
|
-
function assertOk(outcome, resource) {
|
|
960
|
-
if (!isOk(outcome) || resource === undefined) {
|
|
961
|
-
throw new OperationOutcomeError(outcome);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
class OperationOutcomeError extends Error {
|
|
965
|
-
constructor(outcome) {
|
|
966
|
-
var _a, _b;
|
|
967
|
-
super((_b = (_a = outcome === null || outcome === void 0 ? void 0 : outcome.issue) === null || _a === void 0 ? void 0 : _a[0].details) === null || _b === void 0 ? void 0 : _b.text);
|
|
968
|
-
this.outcome = outcome;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
|
|
972
823
|
var _ReadablePromise_suspender, _ReadablePromise_status, _ReadablePromise_response, _ReadablePromise_error, _a;
|
|
973
824
|
/**
|
|
974
825
|
* The ReadablePromise class wraps a request promise suitable for React Suspense.
|
|
@@ -2402,8 +2253,8 @@
|
|
|
2402
2253
|
return undefined;
|
|
2403
2254
|
}
|
|
2404
2255
|
const obj = yield response.json();
|
|
2405
|
-
if (
|
|
2406
|
-
|
|
2256
|
+
if (response.status >= 400) {
|
|
2257
|
+
throw obj;
|
|
2407
2258
|
}
|
|
2408
2259
|
return obj;
|
|
2409
2260
|
});
|
|
@@ -5192,6 +5043,155 @@
|
|
|
5192
5043
|
}
|
|
5193
5044
|
}
|
|
5194
5045
|
|
|
5046
|
+
const OK_ID = 'ok';
|
|
5047
|
+
const CREATED_ID = 'created';
|
|
5048
|
+
const GONE_ID = 'gone';
|
|
5049
|
+
const NOT_MODIFIED_ID = 'not-modified';
|
|
5050
|
+
const NOT_FOUND_ID = 'not-found';
|
|
5051
|
+
const ACCESS_DENIED = 'access-denied';
|
|
5052
|
+
const allOk = {
|
|
5053
|
+
resourceType: 'OperationOutcome',
|
|
5054
|
+
id: OK_ID,
|
|
5055
|
+
issue: [
|
|
5056
|
+
{
|
|
5057
|
+
severity: 'information',
|
|
5058
|
+
code: 'information',
|
|
5059
|
+
details: {
|
|
5060
|
+
text: 'All OK',
|
|
5061
|
+
},
|
|
5062
|
+
},
|
|
5063
|
+
],
|
|
5064
|
+
};
|
|
5065
|
+
const created = {
|
|
5066
|
+
resourceType: 'OperationOutcome',
|
|
5067
|
+
id: CREATED_ID,
|
|
5068
|
+
issue: [
|
|
5069
|
+
{
|
|
5070
|
+
severity: 'information',
|
|
5071
|
+
code: 'information',
|
|
5072
|
+
details: {
|
|
5073
|
+
text: 'Created',
|
|
5074
|
+
},
|
|
5075
|
+
},
|
|
5076
|
+
],
|
|
5077
|
+
};
|
|
5078
|
+
const notModified = {
|
|
5079
|
+
resourceType: 'OperationOutcome',
|
|
5080
|
+
id: NOT_MODIFIED_ID,
|
|
5081
|
+
issue: [
|
|
5082
|
+
{
|
|
5083
|
+
severity: 'information',
|
|
5084
|
+
code: 'information',
|
|
5085
|
+
details: {
|
|
5086
|
+
text: 'Not Modified',
|
|
5087
|
+
},
|
|
5088
|
+
},
|
|
5089
|
+
],
|
|
5090
|
+
};
|
|
5091
|
+
const notFound = {
|
|
5092
|
+
resourceType: 'OperationOutcome',
|
|
5093
|
+
id: NOT_FOUND_ID,
|
|
5094
|
+
issue: [
|
|
5095
|
+
{
|
|
5096
|
+
severity: 'error',
|
|
5097
|
+
code: 'not-found',
|
|
5098
|
+
details: {
|
|
5099
|
+
text: 'Not found',
|
|
5100
|
+
},
|
|
5101
|
+
},
|
|
5102
|
+
],
|
|
5103
|
+
};
|
|
5104
|
+
const gone = {
|
|
5105
|
+
resourceType: 'OperationOutcome',
|
|
5106
|
+
id: GONE_ID,
|
|
5107
|
+
issue: [
|
|
5108
|
+
{
|
|
5109
|
+
severity: 'error',
|
|
5110
|
+
code: 'gone',
|
|
5111
|
+
details: {
|
|
5112
|
+
text: 'Gone',
|
|
5113
|
+
},
|
|
5114
|
+
},
|
|
5115
|
+
],
|
|
5116
|
+
};
|
|
5117
|
+
const accessDenied = {
|
|
5118
|
+
resourceType: 'OperationOutcome',
|
|
5119
|
+
id: ACCESS_DENIED,
|
|
5120
|
+
issue: [
|
|
5121
|
+
{
|
|
5122
|
+
severity: 'error',
|
|
5123
|
+
code: 'access-denied',
|
|
5124
|
+
details: {
|
|
5125
|
+
text: 'Access Denied',
|
|
5126
|
+
},
|
|
5127
|
+
},
|
|
5128
|
+
],
|
|
5129
|
+
};
|
|
5130
|
+
function badRequest(details, expression) {
|
|
5131
|
+
return {
|
|
5132
|
+
resourceType: 'OperationOutcome',
|
|
5133
|
+
issue: [
|
|
5134
|
+
{
|
|
5135
|
+
severity: 'error',
|
|
5136
|
+
code: 'invalid',
|
|
5137
|
+
details: {
|
|
5138
|
+
text: details,
|
|
5139
|
+
},
|
|
5140
|
+
expression: expression ? [expression] : undefined,
|
|
5141
|
+
},
|
|
5142
|
+
],
|
|
5143
|
+
};
|
|
5144
|
+
}
|
|
5145
|
+
function isOk(outcome) {
|
|
5146
|
+
return outcome.id === OK_ID || outcome.id === CREATED_ID || outcome.id === NOT_MODIFIED_ID;
|
|
5147
|
+
}
|
|
5148
|
+
function isNotFound(outcome) {
|
|
5149
|
+
return outcome.id === NOT_FOUND_ID;
|
|
5150
|
+
}
|
|
5151
|
+
function isGone(outcome) {
|
|
5152
|
+
return outcome.id === GONE_ID;
|
|
5153
|
+
}
|
|
5154
|
+
function getStatus(outcome) {
|
|
5155
|
+
if (outcome.id === OK_ID) {
|
|
5156
|
+
return 200;
|
|
5157
|
+
}
|
|
5158
|
+
else if (outcome.id === CREATED_ID) {
|
|
5159
|
+
return 201;
|
|
5160
|
+
}
|
|
5161
|
+
else if (outcome.id === NOT_MODIFIED_ID) {
|
|
5162
|
+
return 304;
|
|
5163
|
+
}
|
|
5164
|
+
else if (outcome.id === ACCESS_DENIED) {
|
|
5165
|
+
return 403;
|
|
5166
|
+
}
|
|
5167
|
+
else if (outcome.id === NOT_FOUND_ID) {
|
|
5168
|
+
return 404;
|
|
5169
|
+
}
|
|
5170
|
+
else if (outcome.id === GONE_ID) {
|
|
5171
|
+
return 410;
|
|
5172
|
+
}
|
|
5173
|
+
else {
|
|
5174
|
+
return 400;
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
/**
|
|
5178
|
+
* Asserts that the operation completed successfully and that the resource is defined.
|
|
5179
|
+
* @param outcome The operation outcome.
|
|
5180
|
+
* @param resource The resource that may or may not have been returned.
|
|
5181
|
+
*/
|
|
5182
|
+
function assertOk(outcome, resource) {
|
|
5183
|
+
if (!isOk(outcome) || resource === undefined) {
|
|
5184
|
+
throw new OperationOutcomeError(outcome);
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
class OperationOutcomeError extends Error {
|
|
5188
|
+
constructor(outcome) {
|
|
5189
|
+
var _a, _b;
|
|
5190
|
+
super((_b = (_a = outcome === null || outcome === void 0 ? void 0 : outcome.issue) === null || _a === void 0 ? void 0 : _a[0].details) === null || _b === void 0 ? void 0 : _b.text);
|
|
5191
|
+
this.outcome = outcome;
|
|
5192
|
+
}
|
|
5193
|
+
}
|
|
5194
|
+
|
|
5195
5195
|
const DEFAULT_SEARCH_COUNT = 20;
|
|
5196
5196
|
/**
|
|
5197
5197
|
* Search operators.
|