@corsair-dev/commcare 0.0.0-stage → 0.1.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.
Files changed (52) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +61 -2
  3. package/dist/client.d.ts +48 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.test.d.ts +2 -0
  6. package/dist/client.test.d.ts.map +1 -0
  7. package/dist/docs-examples.test.d.ts +2 -0
  8. package/dist/docs-examples.test.d.ts.map +1 -0
  9. package/dist/endpoints/call.d.ts +21 -0
  10. package/dist/endpoints/call.d.ts.map +1 -0
  11. package/dist/endpoints/cases.d.ts +6 -0
  12. package/dist/endpoints/cases.d.ts.map +1 -0
  13. package/dist/endpoints/device.d.ts +4 -0
  14. package/dist/endpoints/device.d.ts.map +1 -0
  15. package/dist/endpoints/directory.d.ts +14 -0
  16. package/dist/endpoints/directory.d.ts.map +1 -0
  17. package/dist/endpoints/forms.d.ts +6 -0
  18. package/dist/endpoints/forms.d.ts.map +1 -0
  19. package/dist/endpoints/groups.d.ts +6 -0
  20. package/dist/endpoints/groups.d.ts.map +1 -0
  21. package/dist/endpoints/index.d.ts +619 -0
  22. package/dist/endpoints/index.d.ts.map +1 -0
  23. package/dist/endpoints/types.d.ts +1413 -0
  24. package/dist/endpoints/types.d.ts.map +1 -0
  25. package/dist/endpoints/users.d.ts +8 -0
  26. package/dist/endpoints/users.d.ts.map +1 -0
  27. package/dist/endpoints.test.d.ts +2 -0
  28. package/dist/endpoints.test.d.ts.map +1 -0
  29. package/dist/error-handlers.d.ts +42 -0
  30. package/dist/error-handlers.d.ts.map +1 -0
  31. package/dist/error-handlers.test.d.ts +2 -0
  32. package/dist/error-handlers.test.d.ts.map +1 -0
  33. package/dist/index.d.ts +761 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/integration.test.d.ts +2 -0
  37. package/dist/integration.test.d.ts.map +1 -0
  38. package/dist/jobs.test.d.ts +2 -0
  39. package/dist/jobs.test.d.ts.map +1 -0
  40. package/dist/plugin.test.d.ts +2 -0
  41. package/dist/plugin.test.d.ts.map +1 -0
  42. package/dist/retry.test.d.ts +2 -0
  43. package/dist/retry.test.d.ts.map +1 -0
  44. package/dist/schema/index.d.ts +5 -0
  45. package/dist/schema/index.d.ts.map +1 -0
  46. package/dist/schema.test.d.ts +2 -0
  47. package/dist/schema.test.d.ts.map +1 -0
  48. package/dist/test-fixtures.d.ts +209 -0
  49. package/dist/test-fixtures.d.ts.map +1 -0
  50. package/dist/tsup.config.d.ts +3 -0
  51. package/dist/tsup.config.d.ts.map +1 -0
  52. package/package.json +47 -3
package/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (which shall not include Communications that are clearly marked or
39
+ otherwise designated in writing by the copyright owner as "Not a Work").
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution".
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright (c) 2026 Corsair
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @corsair-dev/commcare
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ CommCare plugin for Corsair.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @corsair-dev/commcare
9
+ ```
10
+
11
+ ## Endpoints
12
+
13
+ | Operation | Operation ID | Risk | Description |
14
+ |-----------|--------------|------|-------------|
15
+ | `cases.bulkFetch` | `commcare.api.cases.bulkFetch` | `read` | Fetch many cases by ID in one call, optionally limited to specific fields and properties |
16
+ | `cases.get` | `commcare.api.cases.get` | `read` | Read one case with its properties and indices |
17
+ | `cases.getByExternalId` | `commcare.api.cases.getByExternalId` | `read` | Look up a case by the external id the application assigned it |
18
+ | `cases.list` | `commcare.api.cases.list` | `read` | List cases (Case Data API v2) with cursor paging and filters for case type, owner, name, closed state and indices |
19
+ | `detExports.list` | `commcare.api.detExports.list` | `read` | List the Data Export Tool export instances in the project |
20
+ | `fixtures.getItem` | `commcare.api.fixtures.getItem` | `read` | Read one fixture item by id |
21
+ | `fixtures.list` | `commcare.api.fixtures.list` | `read` | List lookup-table fixture items, optionally filtered by fixture type |
22
+ | `forms.bulkAction` | `commcare.api.forms.bulkAction` | `destructive` | Archive, unarchive, or permanently delete up to 5000 forms in one background job (delete needs the forms archived first); follow with forms.bulkActionStatus until status is complete or failed |
23
+ | `forms.bulkActionStatus` | `commcare.api.forms.bulkActionStatus` | `read` | Where a bulk form action stands: pending, complete, or failed, with processed and succeeded counts |
24
+ | `forms.get` | `commcare.api.forms.get` | `read` | Read one submitted form, including its XForm content and metadata |
25
+ | `forms.list` | `commcare.api.forms.list` | `read` | List submitted forms with paging and time-window or xmlns filters |
26
+ | `groups.create` | `commcare.api.groups.create` | `write` | Create a group, optionally with an initial member list |
27
+ | `groups.get` | `commcare.api.groups.get` | `read` | Read one group: name, reporting flag and member user ids |
28
+ | `groups.list` | `commcare.api.groups.list` | `read` | List the reporting and case-sharing groups in the project with their members |
29
+ | `groups.update` | `commcare.api.groups.update` | `write` | Rename a group, toggle reporting, or replace its member list |
30
+ | `locations.get` | `commcare.api.locations.get` | `read` | Read one location with its type and parent |
31
+ | `locations.list` | `commcare.api.locations.list` | `read` | List project locations with site code, name and location type filters |
32
+ | `locationTypes.get` | `commcare.api.locationTypes.get` | `read` | Read one location type by id |
33
+ | `locationTypes.list` | `commcare.api.locationTypes.list` | `read` | List the location types defined in the project |
34
+ | `lookupTables.get` | `commcare.api.lookupTables.get` | `read` | Read one lookup table with its field definitions |
35
+ | `lookupTables.list` | `commcare.api.lookupTables.list` | `read` | List the lookup tables defined in the project |
36
+ | `ota.restore` | `commcare.api.ota.restore` | `read` | Pull the OTA restore XML (user registration plus case blocks) for the API key owner in the domain; large payloads. HQ accepts the ApiKey header here and restores the account that owns the key. The password hash in the registration block is replaced with [removed] |
37
+ | `reports.getData` | `commcare.api.reports.getData` | `read` | Run a configurable report and read its rows, with offset, limit (max 50) and the report filter parameters |
38
+ | `reports.list` | `commcare.api.reports.list` | `read` | List the configurable reports defined in the project, with their ids |
39
+ | `submissions.submit` | `commcare.api.submissions.submit` | `write` | Submit a complete XForm XML document to the OpenRosa receiver. Fails when HQ received the form but did not process it (nature submit_error or processing_failure); otherwise answers the message and its nature |
40
+ | `users.create` | `commcare.api.users.create` | `write` | Create a mobile worker account with an initial password |
41
+ | `users.delete` | `commcare.api.users.delete` | `destructive` | Permanently delete a mobile worker account |
42
+ | `users.get` | `commcare.api.users.get` | `read` | Read one mobile worker: username, names, email, phones and user data |
43
+ | `users.list` | `commcare.api.users.list` | `read` | List the mobile workers in the project with paging |
44
+ | `users.sendPasswordReset` | `commcare.api.users.sendPasswordReset` | `write` | Email a password reset link to the mobile worker |
45
+ | `users.update` | `commcare.api.users.update` | `write` | Change a mobile worker: names, email, phone number or custom user data |
46
+ | `webUsers.list` | `commcare.api.webUsers.list` | `read` | List the web users (dashboard accounts) in the project with their roles |
47
+
48
+ ## Auth
49
+
50
+ Auth: API key. Corsair prompts your tenant for credentials on first use.
51
+
52
+ ## Webhooks
53
+
54
+ No webhooks.
55
+
56
+ ## Reference
57
+
58
+ Full docs, types, and examples: https://docs.corsair.dev/plugins/commcare
59
+
60
+ ## License
61
+
62
+ Apache-2.0
@@ -0,0 +1,48 @@
1
+ export declare const COMMCARE_API_BASE = "https://www.commcarehq.org";
2
+ /** Connection details every request needs; the key comes from the key builder. */
3
+ export type CommCareAuth = {
4
+ /** CommCare project (HQ domain), e.g. `my-project`. */
5
+ domain: string;
6
+ /** CommCare username the API key belongs to, e.g. `me@example.commcarehq.org`. */
7
+ username: string;
8
+ apiKey: string;
9
+ };
10
+ /**
11
+ * CommCare error bodies are not prominently documented; observed and
12
+ * documented fields are `message` and `error`.
13
+ */
14
+ export declare class CommCareAPIError extends Error {
15
+ readonly status?: number;
16
+ readonly body?: unknown;
17
+ readonly method?: string;
18
+ /** True when retrying the failed request cannot repeat its effect. */
19
+ readonly replaySafe?: boolean;
20
+ constructor(message: string, options?: {
21
+ cause?: Error;
22
+ status?: number;
23
+ body?: unknown;
24
+ replaySafe?: boolean;
25
+ });
26
+ }
27
+ export declare function describeCommCareError(status: number | undefined, body: unknown, fallback: string): string;
28
+ /**
29
+ * The cleaned `<title>` of an HTML document body ("" when it has none), or
30
+ * undefined when the body is not an HTML page.
31
+ */
32
+ export declare function htmlPageTitle(body: unknown): string | undefined;
33
+ export type CommCareQuery = Record<string, string | number | boolean | undefined>;
34
+ export type CommCareFormData = Record<string, string>;
35
+ export type CommCareRequest = {
36
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
37
+ path: string;
38
+ query?: CommCareQuery;
39
+ body?: unknown;
40
+ /** Multipart fields (the OpenRosa form submission); string values or file parts. */
41
+ formData?: Record<string, string | Blob>;
42
+ /** Marks reads whose 5xx failure can be retried without repeating an effect. */
43
+ replaySafe?: boolean;
44
+ };
45
+ /** Encodes one path segment. */
46
+ export declare function segment(value: string | number): string;
47
+ export declare function makeCommCareRequest(auth: CommCareAuth, { method, path, query, body, formData, replaySafe }: CommCareRequest): Promise<unknown>;
48
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,+BAA+B,CAAC;AAe9D,kFAAkF;AAClF,MAAM,MAAM,YAAY,GAAG;IAC1B,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;gBAG7B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACR,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAEhB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,UAAU,CAAC,EAAE,OAAO,CAAC;KAChB;CASP;AAiBD,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,GACd,MAAM,CAMR;AAED;;;GAGG;AAEH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAc/D;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CACjC,MAAM,EACN,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CACrC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC7B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,gFAAgF;IAChF,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,gCAAgC;AAChC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,YAAY,EAClB,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,eAAe,GAClE,OAAO,CAAC,OAAO,CAAC,CAiFlB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../client.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=docs-examples.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs-examples.test.d.ts","sourceRoot":"","sources":["../docs-examples.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import type { z } from 'zod';
2
+ import type { CommCareContext } from '..';
3
+ import type { CommCareRequest } from '../client';
4
+ type LogFields = Record<string, string | number | boolean | undefined>;
5
+ export declare function safeLog(ctx: CommCareContext, event: string, fields: () => LogFields): Promise<void>;
6
+ /**
7
+ * Resolves the connection details, validates the input, sends the request,
8
+ * shapes and validates the response, then logs the event. Inputs are not
9
+ * logged, because forms and cases carry field data; `log` picks the safe
10
+ * fields.
11
+ */
12
+ export declare function call<Input extends z.ZodType, Output extends z.ZodType>(ctx: CommCareContext, operation: {
13
+ event: string;
14
+ input: Input;
15
+ output: Output;
16
+ }, rawInput: unknown, toRequest: (domain: string, parsed: z.output<Input>) => CommCareRequest, options?: {
17
+ shape?: (raw: unknown, parsed: z.output<Input>) => unknown;
18
+ log?: (parsed: z.output<Input>, result: z.output<Output>) => LogFields;
19
+ }): Promise<z.output<Output>>;
20
+ export {};
21
+ //# sourceMappingURL=call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../endpoints/call.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,KAAK,EAAgB,eAAe,EAAE,MAAM,WAAW,CAAC;AAG/D,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEvE,wBAAsB,OAAO,CAC5B,GAAG,EAAE,eAAe,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,SAAS,GACrB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,EAC3E,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAE1D,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,eAAe,EACvE,OAAO,GAAE;IAGR,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC;IAC3D,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;CAClE,GACJ,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CA6B3B"}
@@ -0,0 +1,6 @@
1
+ import type { CommCareEndpoints } from '..';
2
+ export declare const list: CommCareEndpoints['casesList'];
3
+ export declare const get: CommCareEndpoints['casesGet'];
4
+ export declare const bulkFetch: CommCareEndpoints['casesBulkFetch'];
5
+ export declare const getByExternalId: CommCareEndpoints['casesGetByExternalId'];
6
+ //# sourceMappingURL=cases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cases.d.ts","sourceRoot":"","sources":["../../endpoints/cases.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AA6B5C,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,WAAW,CA6C9C,CAAC;AAEH,eAAO,MAAM,GAAG,EAAE,iBAAiB,CAAC,UAAU,CAc5C,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,gBAAgB,CA0BxD,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,sBAAsB,CAmBpE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CommCareEndpoints } from '..';
2
+ export declare const restore: CommCareEndpoints['otaRestore'];
3
+ export declare const submit: CommCareEndpoints['submissionsSubmit'];
4
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../endpoints/device.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AA0B5C,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAuBlD,CAAC;AASH,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,mBAAmB,CAsCxD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { CommCareEndpoints } from '..';
2
+ export declare const listWebUsers: CommCareEndpoints['webUsersList'];
3
+ export declare const listLocations: CommCareEndpoints['locationsList'];
4
+ export declare const getLocation: CommCareEndpoints['locationsGet'];
5
+ export declare const listLocationTypes: CommCareEndpoints['locationTypesList'];
6
+ export declare const getLocationType: CommCareEndpoints['locationTypesGet'];
7
+ export declare const listFixtures: CommCareEndpoints['fixturesList'];
8
+ export declare const getFixtureItem: CommCareEndpoints['fixturesGetItem'];
9
+ export declare const listLookupTables: CommCareEndpoints['lookupTablesList'];
10
+ export declare const getLookupTable: CommCareEndpoints['lookupTablesGet'];
11
+ export declare const listReports: CommCareEndpoints['reportsList'];
12
+ export declare const getReportData: CommCareEndpoints['reportsGetData'];
13
+ export declare const listDetExports: CommCareEndpoints['detExportsList'];
14
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../endpoints/directory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AA2B5C,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,cAAc,CAsBzD,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,eAAe,CA4B3D,CAAC;AAEH,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,cAAc,CAcxD,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,mBAAmB,CAyBnE,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,kBAAkB,CAiBhE,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,cAAc,CA0BzD,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,iBAAiB,CAiB9D,CAAC;AAEH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,kBAAkB,CAyBjE,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,iBAAiB,CAiB9D,CAAC;AAIH,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,aAAa,CA+BvD,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,gBAAgB,CAwB5D,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,gBAAgB,CA+B7D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { CommCareEndpoints } from '..';
2
+ export declare const list: CommCareEndpoints['formsList'];
3
+ export declare const get: CommCareEndpoints['formsGet'];
4
+ export declare const bulkAction: CommCareEndpoints['formsBulkAction'];
5
+ export declare const bulkActionStatus: CommCareEndpoints['formsBulkActionStatus'];
6
+ //# sourceMappingURL=forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../endpoints/forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AA2B5C,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,WAAW,CA4B9C,CAAC;AAEH,eAAO,MAAM,GAAG,EAAE,iBAAiB,CAAC,UAAU,CAc5C,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,iBAAiB,CAqB1D,CAAC;AAEH,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,uBAAuB,CAiBtE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { CommCareEndpoints } from '..';
2
+ export declare const list: CommCareEndpoints['groupsList'];
3
+ export declare const get: CommCareEndpoints['groupsGet'];
4
+ export declare const create: CommCareEndpoints['groupsCreate'];
5
+ export declare const update: CommCareEndpoints['groupsUpdate'];
6
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../endpoints/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AA0B5C,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,YAAY,CAsB/C,CAAC;AAEH,eAAO,MAAM,GAAG,EAAE,iBAAiB,CAAC,WAAW,CAc7C,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,cAAc,CAqBnD,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,cAAc,CAqBnD,CAAC"}