Skip to content

Commit

Permalink
fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Oct 22, 2023
1 parent 98b5fa0 commit 03baa50
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 54 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.19.0

- Added `pb.filter(rawExpr, params?)` helper to constructs a filter string with binded placeholder parameters.
- Added `pb.filter(rawExpr, params?)` helper to construct a filter string with placeholder parameters populated from an object.

```js
const record = await pb.collection("example").getList(1, 20, {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ The SDK comes with a helper `pb.filter(expr, params)` method to generate a filte
**This method is also recommended when using the SDK in Node/Deno/Bun server-side list queries and accepting untrusted user input as `filter` string arguments, because it will take care to properly escape the generated string expression, avoiding eventual string injection attacks** (_on the client-side this is not much of an issue_).

```js
const record = await pb.collection("example").getList(1, 20, {
const records = await pb.collection("example").getList(1, 20, {
// the same as: "title ~ 'te\\'st' && (totalA = 123 || totalB = 123)"
filter: pb.filter("title ~ {:title} && (totalA = {:num} || totalB = {:num})", { title: "te'st", num: 123 })
})
```

The supported placeholder parameter values are:

- `string` (_single quotes will be autoescaped_)
- `string` (_single quotes are autoescaped_)
- `number`
- `boolean`
- `Date` object (_will be stringified into the format expected by PocketBase_)
- `null`
- anything else is converted to a string using `JSON.stringify()`
- everything else is converted to a string using `JSON.stringify()`


### File upload
Expand Down
24 changes: 14 additions & 10 deletions dist/pocketbase.cjs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1072,16 +1072,18 @@ declare class Client {
*/
cancelAllRequests(): Client;
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand All @@ -1093,16 +1095,18 @@ declare class Client {
* ```
*/
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* The following parameter values are supported:
*
* - `string` (_single quotes will be autoescaped_)
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.cjs.js.map

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions dist/pocketbase.es.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,16 +1078,18 @@ declare class Client {
*/
cancelAllRequests(): Client;
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down
12 changes: 7 additions & 5 deletions dist/pocketbase.es.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1078,16 +1078,18 @@ declare class Client {
*/
cancelAllRequests(): Client;
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.es.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/pocketbase.es.mjs.map

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions dist/pocketbase.iife.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1072,16 +1072,18 @@ declare class Client {
*/
cancelAllRequests(): Client;
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand All @@ -1093,16 +1095,18 @@ declare class Client {
* ```
*/
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* The following parameter values are supported:
*
* - `string` (_single quotes will be autoescaped_)
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.iife.js.map

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions dist/pocketbase.umd.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1072,16 +1072,18 @@ declare class Client {
*/
cancelAllRequests(): Client;
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand All @@ -1093,16 +1095,18 @@ declare class Client {
* ```
*/
/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* The following parameter values are supported:
*
* - `string` (_single quotes will be autoescaped_)
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.umd.js.map

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,18 @@ export default class Client {
}

/**
* Constructs a properly escaped filter expression.
* Constructs a filter expression with placeholders populated from a parameters object.
*
* Placeholder parameters should be added using the `{:paramName}` notation.
* Placeholder parameters are defined with the `{:paramName}` notation.
*
* - `string` (_single quotes will be autoescaped_)
* The following parameter values are supported:
*
* - `string` (_single quotes are autoescaped_)
* - `number`
* - `boolean`
* - `Date` object (_will be stringified into the format expected by PocketBase_)
* - `Date` object (_stringified into the PocketBase datetime format_)
* - `null`
* - anything else is converted to a string using `JSON.stringify()`
* - everything else is converted to a string using `JSON.stringify()`
*
* Example:
*
Expand Down

0 comments on commit 03baa50

Please sign in to comment.