You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/v3/http-trigger.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,7 +256,7 @@ For a full Rust SDK reference, see the [Rust Spin SDK documentation](https://doc
256
256
257
257
{{ startTab "TypeScript"}}
258
258
259
-
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/)
259
+
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/)
260
260
261
261
Building a Spin HTTP component with the JavaScript/TypeScript SDK now involves adding an event listener for the `fetch` event. This event listener handles incoming HTTP requests and allows you to construct and return HTTP responses.
Copy file name to clipboardExpand all lines: content/v3/javascript-components.md
+23-15Lines changed: 23 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ With JavaScript being a very popular language, Spin provides an SDK to support b
31
31
32
32
> All examples from this page can be found in [the JavaScript SDK repository on GitHub](https://github.com/spinframework/spin-js-sdk/tree/main/examples).
33
33
34
-
[**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/)
34
+
[**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/)
35
35
36
36
## Installing Templates
37
37
@@ -77,19 +77,18 @@ This creates a directory of the following structure:
77
77
78
78
```text
79
79
hello-world
80
-
├── config
81
-
│ └── knitwit.json
82
80
├── package.json
81
+
├── README.md
83
82
├── spin.toml
84
83
├── src
85
-
│ └── index.ts
84
+
│ └── index.ts
86
85
├── tsconfig.json
87
86
└── webpack.config.js
88
87
```
89
88
90
89
The source for the component is present in `src/index.ts`. [Webpack](https://webpack.js.org) is used to bundle the component into a single `.js` file which will then be compiled to a `.wasm` module.
91
90
92
-
{{ details "Going from JavaScript to Wasm" "The JS source is compiled to a `wasm` module using the `j2w` node executable provided by the `@fermyon/spin-sdk` which is a wrapper around `ComponentizeJS`. The `knitwit.json`is the configuration file used by [knitwit](https://github.com/fermyon/knitwit)to manage the WebAssembly dependencies of each package."}}
91
+
{{ details "Going from JavaScript to Wasm" "The JS source is compiled to a `wasm` module using the `j2w` node executable provided by the `@fermyon/spin-sdk` which is a wrapper around `ComponentizeJS` that is used to manage the dependencies."}}
93
92
94
93
## Building and Running the Template
95
94
@@ -259,13 +258,13 @@ You must [add `http://self` or `http://self.alt` to the component's `allowed_out
259
258
> You can find a complete example for using outbound Redis from an HTTP component
260
259
> in the [spin-js-sdk repository on GitHub](https://github.com/spinframework/spin-js-sdk/blob/main/examples/spin-host-apis/spin-redis).
261
260
262
-
Using the Spin's JS SDK, you can use the Redis key/value store and to publish messages to Redis channels.
261
+
We can install and use the `@spinframework/spin-redis` package to use the Redis key/value store and to publish messages to Redis channels.
263
262
264
263
Let's see how we can use the JS/TS SDK to connect to Redis:
265
264
266
265
```javascript
267
266
import { AutoRouter } from'itty-router';
268
-
import { Redis } from'@fermyon/spin-sdk';
267
+
import { Redis } from'@spinframework/spin-redis';
269
268
270
269
constencoder=newTextEncoder();
271
270
constredisAddress='redis://localhost:6379/';
@@ -314,14 +313,20 @@ Spin has a key-value store built in. For information about using it from TypeScr
314
313
315
314
## Storing Data in SQLite
316
315
316
+
We can use the `@spinframework/spin-sqlite` package to interact with Spin's SQLite interface.
317
+
317
318
For more information about using SQLite from TypeScript/Javascript, see [SQLite storage](sqlite-api-guide).
318
319
319
320
## Storing Data in MySQL and PostgreSQL Relational Databases
320
321
322
+
We can use the `@spinframework/spin-mysql`, `@spinframework/spin-postgres` package to interact with Spin's RDBMS interfaces.
323
+
321
324
For more information about using relational databases from TypeScript/JavaScript, see [Relational Databases](rdbms-storage).
322
325
323
326
## AI Inferencing From JS/TS Components
324
327
328
+
We can use the `@spinframework/spin-llm` package to interact with Spin's LLM interface.
329
+
325
330
For more information about using Serverless AI from JS/TS, see the [Serverless AI](serverless-ai-api-guide) API guide.
326
331
327
332
## Node.js Compatibility
@@ -331,21 +336,24 @@ The SDK does not support the full specification of `Node.js`. A limited set of A
331
336
<!-- @selectiveCpy -->
332
337
333
338
```bash
334
-
$ npm install @fermyon/wasi-ext
339
+
$ npm install @spinframework/wasi-ext
335
340
```
336
341
337
342
Once installed, the plugin provided by it can be added to the webpack config:
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/)
87
87
88
-
The key value functions can be accessed after opening a store using either [the `Kv.open` or the `Kv.openDefault`methods](https://spinframework.github.io/spin-js-sdk/stable/modules/Kv.html) which returns a [handle to the store](https://spinframework.github.io/spin-js-sdk/stable/interfaces/Kv.Store.html). For example:
88
+
The key value functions can be accessed after opening a store using either [the `open` or the `openDefault`functions](https://spinframework.github.io/spin-js-sdk/modules/_spinframework_spin-kv.html) which returns a [handle to the store](https://spinframework.github.io/spin-js-sdk/interfaces/_spinframework_spin-kv.Store.html). For example:
Copy file name to clipboardExpand all lines: content/v3/mqtt-outbound.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,11 +57,13 @@ You can find a complete Rust code example for using outbound MQTT from an HTTP c
57
57
58
58
{{ startTab "TypeScript"}}
59
59
60
-
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/modules/Mqtt.html)
60
+
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/modules/_spinframework_spin-mqtt.html)
61
61
62
-
To access an MQTT server, use the `Mqtt.open` function.
62
+
To access an MQTT server, use the `open` function.
Copy file name to clipboardExpand all lines: content/v3/rdbms-storage.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,14 +73,14 @@ For full information about the MySQL and PostgreSQL APIs, see [the Spin SDK refe
73
73
74
74
{{ startTab "TypeScript"}}
75
75
76
-
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/)
76
+
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/)
77
77
78
78
The code below is an [Outbound MySQL example](https://github.com/spinframework/spin-js-sdk/tree/main/examples/spin-host-apis/spin-mysql). There is also an outbound [PostgreSQL example](https://github.com/spinframework/spin-js-sdk/tree/main/examples/spin-host-apis/spin-postgres) available.
Copy file name to clipboardExpand all lines: content/v3/redis-outbound.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,14 +89,14 @@ You can find a complete Rust code example for using outbound Redis from an HTTP
89
89
90
90
{{ startTab "TypeScript"}}
91
91
92
-
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/)
92
+
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/)
93
93
94
-
Redis functions are available on [the `Redis` module](https://spinframework.github.io/spin-js-sdk/stable/modules/Redis.html). The function names match the operations above. For example:
94
+
Redis functions are available on [the `Redis` module](https://spinframework.github.io/spin-js-sdk/modules/_spinframework_spin-redis.html). The function names match the operations above. For example:
Copy file name to clipboardExpand all lines: content/v3/serverless-ai-api-guide.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,21 +116,21 @@ The `infer_with_options` examples, operation:
116
116
117
117
{{ startTab "Typescript"}}
118
118
119
-
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/stable/modules/Llm.html)
119
+
> [**Want to go straight to the reference documentation?** Find it here.](https://spinframework.github.io/spin-js-sdk/)
120
120
121
-
To use Serverless AI functions, [the `Llm` module](https://spinframework.github.io/spin-js-sdk/stable/modules/Llm.html) from the Spin SDK provides two methods: `infer` and `generateEmbeddings`. For example:
121
+
To use Serverless AI functions, [the `@spinframework/spin-llm` pacakge](https://spinframework.github.io/spin-js-sdk/modules/_spinframework_spin-llm.html) provides two methods: `infer` and `generateEmbeddings`. For example:
0 commit comments