@authoric/handler-sdk 0.0.0-stage → 6.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 (3) hide show
  1. package/README.md +25 -2
  2. package/handler-sdk.d.ts +2753 -0
  3. package/package.json +14 -5
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # @authoric/handler-sdk
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
+ Types for [Authoric](https://authoric.com) handlers: the `sdk` and `ctx` every handler is given, so your
4
+ editor and your coding agent can check a handler before you deploy it.
5
+
6
+ ```sh
7
+ npm install --save-dev @authoric/handler-sdk
8
+ ```
9
+
10
+ Reference the types at the top of a handler (or list `@authoric/handler-sdk` under `compilerOptions.types`):
11
+
12
+ ```js
13
+ /// <reference types="@authoric/handler-sdk" />
14
+
15
+ /**
16
+ * @param {Record<string, unknown>} data The request body.
17
+ * @param {HandlerCtx} ctx The SDK, the caller and the request.
18
+ */
19
+ export default async function (data, ctx) {
20
+ const { sdk } = ctx;
21
+ const order = await sdk.read("orders", data.orderUid);
22
+ return { status: order.status };
23
+ }
24
+ ```
25
+
26
+ The package version is the handler SDK's version. Reference: https://authoric.com/docs/handlers/sdk-reference.