@saplingai/sapling-js 1.0.1 → 1.0.5
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.
- package/README.md +16 -12
- package/index.d.ts +1 -0
- package/index.ts +1 -0
- package/observer/index.d.ts +1 -0
- package/observer/index.ts +1 -0
- package/package.json +22 -8
- package/sapling/client.d.ts +20 -0
- package/sapling/observer.d.ts +20 -0
- package/sapling/observer.js +1 -1
- package/sapling/sapling-sdk-v1.0.2.min.js +3 -0
- package/sapling/sapling-sdk-v1.0.1.min.js +0 -40306
package/README.md
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Node.js client for the [Sapling.ai API](https://sapling.ai/api).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Try out a [grammar check demo](https://sapling.ai/grammar-check).
|
|
6
|
+
Compare against grammar checking tools and APIs like Grammarly (Grammerly), LanguageTool, ProWritingAid and Ginger.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Functionality
|
|
8
9
|
--------
|
|
9
10
|
|
|
10
|
-
Sapling is an AI
|
|
11
|
+
Sapling is an AI messaging assistant.
|
|
12
|
+
The API currently offers spelling and grammar checking endpoints.
|
|
11
13
|
|
|
14
|
+
Benefits include:
|
|
12
15
|
- **60% more grammar corrections**: compared to [other systems](https://sapling.ai/comparison/api) at similar accuracy using state-of-the-art machine learning systems for natural language processing.
|
|
13
16
|
- **Low Latency**: Achieve the same real-time performance that users of Sapling's own interface experience.
|
|
14
17
|
- **Over 20 error types**: Error categories such as preposition, noun form, and verb tense, including both high-level and fine-grained error information.
|
|
15
18
|
- **Custom Models**: Get corrections and edits tuned to the domain of your text—for example academic writing vs. subtitles.
|
|
16
|
-
- **Enterprise Security**:
|
|
17
|
-
- **Rich Text Editor Support**: TinyMCE, CKEditor, QuillJS, Trix, ProseMirror, WordPress, Draft.js, Froala, Lexical and others.
|
|
19
|
+
- **Enterprise Security**: Contact us for our no data retention policies, [self-hosted/on-premises](https://sapling.ai/onprem) deployment options, and other [cybersecurity policies and procedures](https://sapling.ai/security).
|
|
20
|
+
- **Rich Text Editor Support**: TinyMCE, CKEditor, QuillJS, Trix, ProseMirror, WordPress, Draft.js, Froala, Lexical and others. Consider using [Sapling's JavaScript SDK](https://sapling.ai/docs/sdk/JavaScript/quickstart) for displaying the API's outputs on webpage editors.
|
|
21
|
+
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
Installation
|
|
@@ -22,8 +26,8 @@ Installation
|
|
|
22
26
|
|
|
23
27
|
`npm install @saplingai/sapling-js`
|
|
24
28
|
|
|
25
|
-
- Register for an account at [Sapling.ai](https://sapling.ai).
|
|
26
|
-
- After registering and signing in, generate a development API key in your [dashboard](https://sapling.ai/user_settings)
|
|
29
|
+
- Register for an account at [Sapling.ai](https://sapling.ai/user/register).
|
|
30
|
+
- After registering and signing in, generate a development API key in your [dashboard](https://sapling.ai/user_settings).
|
|
27
31
|
|
|
28
32
|
|
|
29
33
|
Quickstart - Backend
|
|
@@ -48,7 +52,7 @@ Quickstart - Frontend
|
|
|
48
52
|
|
|
49
53
|
The SDK provides a way to automatically apply edit suggestions to any HTML contenteditable and textarea elements.
|
|
50
54
|
|
|
51
|
-
Do not serve a page like this publicly, as it exposes the API key. See documentation [Deploying to Production](https://sapling.ai/docs/sdk/quickstart#deploying-to-production) for an example of setting up the API key
|
|
55
|
+
Do **not** serve a page like this publicly, as it exposes the API key. See documentation [Deploying to Production](https://sapling.ai/docs/sdk/quickstart#deploying-to-production) for an example of setting up the API key with a separate backend environment.
|
|
52
56
|
|
|
53
57
|
```javscript
|
|
54
58
|
import { useEffect } from 'react';
|
|
@@ -78,10 +82,10 @@ function App() {
|
|
|
78
82
|
```
|
|
79
83
|
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
Documentation
|
|
82
86
|
-------------
|
|
83
87
|
|
|
84
|
-
-
|
|
85
|
-
- Complete Sapling SDK and HTTP API [documentation](https://sapling.ai/docs).
|
|
86
|
-
- More information on [request options and response structure](https://sapling.ai/docs/api/edits-overview)
|
|
88
|
+
- Complete Sapling HTTP API and SDK [documentation](https://sapling.ai/docs).
|
|
87
89
|
- Get a production key by following [these instructions](https://sapling.ai/docs/api/api-access).
|
|
90
|
+
- JavaScript, HTML, and Python [starter code](https://github.com/saplingai/sapling-samples).
|
|
91
|
+
- More information on [request options and response structure](https://sapling.ai/docs/api/edits-overview).
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../sapling/client';
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../sapling/client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../sapling/observer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../sapling/observer';
|
package/package.json
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saplingai/sapling-js",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"type":"module",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "JavaScript library for using the Sapling.ai API.",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"axios": "^0.26.1",
|
|
8
8
|
"uuid": "^8.3.2"
|
|
9
9
|
},
|
|
10
10
|
"main": "./sapling/client.js",
|
|
11
|
+
"types": "./sapling/client.d.ts",
|
|
11
12
|
"author": "Sapling Intelligence",
|
|
12
13
|
"email": "info@sapling.ai",
|
|
13
14
|
"url": "https://sapling.ai",
|
|
14
15
|
"homepage": "https://sapling.ai/docs/",
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/saplingai/sapling-samples.git"
|
|
18
19
|
},
|
|
19
20
|
"bugs": {
|
|
20
|
-
"url"
|
|
21
|
-
"email"
|
|
21
|
+
"url": "https://github.com/saplingai/sapling-samples/issues",
|
|
22
|
+
"email": "support@sapling.ai"
|
|
22
23
|
},
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"licenses": [
|
|
26
|
+
{
|
|
27
|
+
"type": "Apache-2.0",
|
|
28
|
+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
23
31
|
"exports": {
|
|
24
|
-
"./client":
|
|
25
|
-
|
|
32
|
+
"./client": {
|
|
33
|
+
"types": "./sapling/client.d.ts",
|
|
34
|
+
"default": "./sapling/client.js"
|
|
35
|
+
},
|
|
36
|
+
"./observer": {
|
|
37
|
+
"types": "./sapling/observer.d.ts",
|
|
38
|
+
"default": "./sapling/observer.js"
|
|
39
|
+
}
|
|
26
40
|
}
|
|
27
41
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
|
|
3
|
+
type ConstructorOptions = {
|
|
4
|
+
timeout?: number,
|
|
5
|
+
hostname?: string,
|
|
6
|
+
pathname?: string,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type EditOptions = {
|
|
10
|
+
variety?: string,
|
|
11
|
+
autoApply?: boolean,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class Client {
|
|
15
|
+
constructor(apiKey: string, options?: ConstructorOptions);
|
|
16
|
+
|
|
17
|
+
edits(text: string, sessionId: string, options?: EditOptions): Promise<AxiosResponse>;
|
|
18
|
+
accept(editUUID: string, sessionId: string): void;
|
|
19
|
+
reject(editUUID: string, sessionId: string): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type InitSettings = {
|
|
2
|
+
endpointHostname?: string,
|
|
3
|
+
editPathname?: string,
|
|
4
|
+
completePathname?: string,
|
|
5
|
+
statusBadge?: boolean,
|
|
6
|
+
lang?: string,
|
|
7
|
+
autocomplete?: boolean,
|
|
8
|
+
mode?: string,
|
|
9
|
+
key?: string,
|
|
10
|
+
variety?: string,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface SaplingInterface {
|
|
14
|
+
init(settings: InitSettings): void;
|
|
15
|
+
observe(elem: HTMLElement): void;
|
|
16
|
+
unobserve(elem: HTMLElement): void;
|
|
17
|
+
checkOnce(elem: HTMLElement): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Sapling: SaplingInterface;
|
package/sapling/observer.js
CHANGED