@rinse-dental/open-dental 2.4.11 → 2.4.12

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.
@@ -4,14 +4,15 @@ export default class Queries {
4
4
  private httpClient;
5
5
  constructor(httpClient: HttpClient);
6
6
  /**
7
- * Execute a ShortQuery (arbitrary SQL). Caller can provide a row type.
7
+ * Execute a ShortQuery (arbitrary read-only SQL).
8
+ * Open Dental: PUT /queries/ShortQuery?Offset=#
9
+ * Body: { SqlCommand }
10
+ * Returns at most 100 rows (use Queries POST for longer results).
11
+ *
8
12
  * Example:
9
- * shortQuery<{ PatNum: number; LName: string }>({
10
- * SqlCommand: "SELECT PatNum,LName FROM patient LIMIT 10"
13
+ * queries.shortQuery<{ PayPeriodNum: number; DateStart: string; DateStop: string; DatePaycheck: string }>({
14
+ * SqlCommand: "SELECT * FROM payperiod"
11
15
  * })
12
- *
13
- * Open Dental: PUT /queries/short/{SqlCommand}?Offset=#
14
- * @see https://www.opendental.com/site/apiqueries.html
15
16
  */
16
17
  shortQuery<Row = unknown>({ SqlCommand, Offset }: ShortQueryParams, opts?: {
17
18
  parse?: RowParser<Row>;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/api/queries.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;;;;;OASG;IACU,UAAU,CAAC,GAAG,GAAG,OAAO,EACnC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,gBAAgB,EACxC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;KAAE,GAChC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CAelC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/api/queries.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;;;;;;OAUG;IACU,UAAU,CAAC,GAAG,GAAG,OAAO,EACnC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,gBAAgB,EACxC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;KAAE,GAChC,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;CAclC"}
@@ -6,23 +6,23 @@ class Queries {
6
6
  this.httpClient = httpClient;
7
7
  }
8
8
  /**
9
- * Execute a ShortQuery (arbitrary SQL). Caller can provide a row type.
9
+ * Execute a ShortQuery (arbitrary read-only SQL).
10
+ * Open Dental: PUT /queries/ShortQuery?Offset=#
11
+ * Body: { SqlCommand }
12
+ * Returns at most 100 rows (use Queries POST for longer results).
13
+ *
10
14
  * Example:
11
- * shortQuery<{ PatNum: number; LName: string }>({
12
- * SqlCommand: "SELECT PatNum,LName FROM patient LIMIT 10"
15
+ * queries.shortQuery<{ PayPeriodNum: number; DateStart: string; DateStop: string; DatePaycheck: string }>({
16
+ * SqlCommand: "SELECT * FROM payperiod"
13
17
  * })
14
- *
15
- * Open Dental: PUT /queries/short/{SqlCommand}?Offset=#
16
- * @see https://www.opendental.com/site/apiqueries.html
17
18
  */
18
19
  async shortQuery({ SqlCommand, Offset }, opts) {
19
- // Build path with encoded SQL and optional Offset
20
- let path = `/queries/short/${encodeURIComponent(SqlCommand)}`;
20
+ let path = "/queries/ShortQuery";
21
21
  if (typeof Offset === "number") {
22
22
  path += `?Offset=${encodeURIComponent(String(Offset))}`;
23
23
  }
24
- // Your HttpClient.put only accepts (url, data), so send an empty object body
25
- const data = await this.httpClient.put(path, {});
24
+ // HttpClient.put(url, data) per your implementation
25
+ const data = await this.httpClient.put(path, { SqlCommand });
26
26
  if (opts?.parse) {
27
27
  return data.map(opts.parse);
28
28
  }
@@ -1,15 +1,16 @@
1
1
  /**
2
- * Parameters for ShortQuery (PUT /queries/short/{SqlCommand}?Offset=#)
2
+ * Parameters for Queries PUT ShortQuery
3
+ * Endpoint: PUT /queries/ShortQuery?Offset=#
4
+ * Body: { SqlCommand: string }
5
+ * Returns: up to 100 rows; use Queries POST for longer results.
3
6
  * @see https://www.opendental.com/site/apiqueries.html
4
7
  */
5
8
  export interface ShortQueryParams {
6
- /** Required in the URL path (will be URL-encoded) */
7
9
  SqlCommand: string;
8
- /** Optional pagination offset (goes in query string) */
9
10
  Offset?: number;
10
11
  }
11
12
  /** Generic result rows for ShortQuery; supply Row when you know the shape */
12
13
  export type ShortQueryResult<Row = unknown> = Row[];
13
- /** Optional runtime row parser if you want validation */
14
+ /** Optional runtime validator for rows (e.g., Zod) */
14
15
  export type RowParser<Row> = (value: unknown) => Row;
15
16
  //# sourceMappingURL=queryTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryTypes.d.ts","sourceRoot":"","sources":["../../src/types/queryTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,CAAC,GAAG,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC;AAEpD,yDAAyD;AACzD,MAAM,MAAM,SAAS,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"queryTypes.d.ts","sourceRoot":"","sources":["../../src/types/queryTypes.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,CAAC,GAAG,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC;AAEpD,sDAAsD;AACtD,MAAM,MAAM,SAAS,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinse-dental/open-dental",
3
- "version": "2.4.11",
3
+ "version": "2.4.12",
4
4
  "description": "A TypeScript library for easily accessing Open Dental APIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,27 +13,27 @@ export default class Queries {
13
13
  }
14
14
 
15
15
  /**
16
- * Execute a ShortQuery (arbitrary SQL). Caller can provide a row type.
16
+ * Execute a ShortQuery (arbitrary read-only SQL).
17
+ * Open Dental: PUT /queries/ShortQuery?Offset=#
18
+ * Body: { SqlCommand }
19
+ * Returns at most 100 rows (use Queries POST for longer results).
20
+ *
17
21
  * Example:
18
- * shortQuery<{ PatNum: number; LName: string }>({
19
- * SqlCommand: "SELECT PatNum,LName FROM patient LIMIT 10"
22
+ * queries.shortQuery<{ PayPeriodNum: number; DateStart: string; DateStop: string; DatePaycheck: string }>({
23
+ * SqlCommand: "SELECT * FROM payperiod"
20
24
  * })
21
- *
22
- * Open Dental: PUT /queries/short/{SqlCommand}?Offset=#
23
- * @see https://www.opendental.com/site/apiqueries.html
24
25
  */
25
26
  public async shortQuery<Row = unknown>(
26
27
  { SqlCommand, Offset }: ShortQueryParams,
27
28
  opts?: { parse?: RowParser<Row> }
28
29
  ): Promise<ShortQueryResult<Row>> {
29
- // Build path with encoded SQL and optional Offset
30
- let path = `/queries/short/${encodeURIComponent(SqlCommand)}`;
30
+ let path = "/queries/ShortQuery";
31
31
  if (typeof Offset === "number") {
32
32
  path += `?Offset=${encodeURIComponent(String(Offset))}`;
33
33
  }
34
34
 
35
- // Your HttpClient.put only accepts (url, data), so send an empty object body
36
- const data = await this.httpClient.put<unknown[]>(path, {});
35
+ // HttpClient.put(url, data) per your implementation
36
+ const data = await this.httpClient.put<unknown[]>(path, { SqlCommand });
37
37
 
38
38
  if (opts?.parse) {
39
39
  return (data as unknown[]).map(opts.parse);
@@ -1,16 +1,17 @@
1
1
  /**
2
- * Parameters for ShortQuery (PUT /queries/short/{SqlCommand}?Offset=#)
2
+ * Parameters for Queries PUT ShortQuery
3
+ * Endpoint: PUT /queries/ShortQuery?Offset=#
4
+ * Body: { SqlCommand: string }
5
+ * Returns: up to 100 rows; use Queries POST for longer results.
3
6
  * @see https://www.opendental.com/site/apiqueries.html
4
7
  */
5
8
  export interface ShortQueryParams {
6
- /** Required in the URL path (will be URL-encoded) */
7
- SqlCommand: string;
8
- /** Optional pagination offset (goes in query string) */
9
- Offset?: number;
9
+ SqlCommand: string; // Required (in request body)
10
+ Offset?: number; // Optional (in query string)
10
11
  }
11
12
 
12
13
  /** Generic result rows for ShortQuery; supply Row when you know the shape */
13
14
  export type ShortQueryResult<Row = unknown> = Row[];
14
15
 
15
- /** Optional runtime row parser if you want validation */
16
+ /** Optional runtime validator for rows (e.g., Zod) */
16
17
  export type RowParser<Row> = (value: unknown) => Row;