@odatnurd/cf-requests 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +4 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -56,9 +56,6 @@ fields declared by the schema are present.
56
56
 
57
57
 
58
58
  ```js
59
- /******************************************************************************/
60
-
61
-
62
59
  import { validate, success, routeHandler } from '#lib/common';
63
60
 
64
61
  import * as testSchema from '#schemas/test';
@@ -79,7 +76,6 @@ export const $post = routeHandler(
79
76
  return success(ctx, 'request body validated', body);
80
77
  },
81
78
  );
82
-
83
79
  ```
84
80
 
85
81
  ## Methods
@@ -140,27 +136,6 @@ On success, the data is placed in the context. If the data does not pass the
140
136
  validation of the schema, the `fail()` method is invoked on it with a status of
141
137
  `422` to signify the issue directly.
142
138
 
143
- Execute a fetch operation on the provided database, using the data in `sqlargs`
144
- to create the statement(s) to be executed, and return the result(s) of the
145
- query after logging statistics such as the rows read and written, which will be
146
- annotated with the action string provided to give context to the operation.
147
-
148
- The provided `sqlargs` is a variable length list of arguments that consists of
149
- strings to be compiled to SQL, previously compiled statements, and/or arrays of
150
- values to bind to statements.
151
-
152
- For the purposes of binding, arrays will bind to the most recently seen
153
- statement, allowing you to compile one statement and bind it multiple times if
154
- desired.
155
-
156
- When more than one statement is provided, all statements will be executed as a
157
- batch operation, which implicitly runs as a transaction.
158
-
159
- The return value is the direct result of executing the query or queries given
160
- in `sqlargs`; this is either a (potentially empty) array of result rows, or an
161
- array of such arrays (if a batch). As with `dbRawQuery`, the `meta` is stripped
162
- from the results, providing you just the actual query result.
163
-
164
139
  ---
165
140
 
166
141
  ```js
@@ -184,6 +159,10 @@ export const $post = [
184
159
  body(async (ctx) => {
185
160
  const body = ctx.req.valid('json');
186
161
 
162
+ if (body.key1 != 69) {
163
+ throw new Error('key is not nice');
164
+ }
165
+
187
166
  return success(ctx, 'code test worked', body);
188
167
  }),
189
168
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatnurd/cf-requests",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Simple Cloudflare Hono request wrapper",
5
5
  "author": "OdatNurd (https://odatnurd.net)",
6
6
  "homepage": "https://github.com/OdatNurd/cf-requests",