@capacitor-mlkit/genai-rewriting 8.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.
- package/CapacitorMlkitGenaiRewriting.podspec +17 -0
- package/LICENSE +201 -0
- package/README.md +429 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/GenAiRewriting.java +159 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/GenAiRewritingPlugin.java +145 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/events/DownloadProgressEvent.java +22 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/events/InferenceProgressEvent.java +23 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/options/FeatureOptions.java +72 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/options/RewriteOptions.java +30 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/results/CheckFeatureStatusResult.java +37 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/classes/results/RewriteResult.java +29 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/interfaces/Callback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/interfaces/EmptyCallback.java +5 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/interfaces/NonEmptyResultCallback.java +7 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/mlkit/genairewriting/interfaces/Result.java +7 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +589 -0
- package/dist/esm/definitions.d.ts +251 -0
- package/dist/esm/definitions.js +107 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +8 -0
- package/dist/esm/web.js +16 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +137 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +140 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/GenAiRewritingPlugin.m +10 -0
- package/ios/Plugin/GenAiRewritingPlugin.swift +21 -0
- package/ios/Plugin/Info.plist +24 -0
- package/package.json +99 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import type { PluginListenerHandle } from '@capacitor/core';
|
|
2
|
+
/**
|
|
3
|
+
* @since 8.2.0
|
|
4
|
+
*/
|
|
5
|
+
export interface GenAiRewritingPlugin {
|
|
6
|
+
/**
|
|
7
|
+
* Check the current availability status of the rewriting feature.
|
|
8
|
+
*
|
|
9
|
+
* If the status is `DOWNLOADABLE`, you can download the feature
|
|
10
|
+
* using `downloadFeature(...)`.
|
|
11
|
+
*
|
|
12
|
+
* Only available on Android.
|
|
13
|
+
*
|
|
14
|
+
* @since 8.2.0
|
|
15
|
+
*/
|
|
16
|
+
checkFeatureStatus(options?: FeatureOptions): Promise<CheckFeatureStatusResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Download the rewriting feature.
|
|
19
|
+
*
|
|
20
|
+
* The `downloadProgress` event listener will notify you about
|
|
21
|
+
* the download progress. The returned promise resolves when
|
|
22
|
+
* the download is complete or the feature is already available.
|
|
23
|
+
*
|
|
24
|
+
* Only available on Android.
|
|
25
|
+
*
|
|
26
|
+
* @since 8.2.0
|
|
27
|
+
*/
|
|
28
|
+
downloadFeature(options?: FeatureOptions): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Rewrite the given text in the configured style.
|
|
31
|
+
*
|
|
32
|
+
* The `inferenceProgress` event listener will notify you about
|
|
33
|
+
* partial results as they are generated. The returned promise
|
|
34
|
+
* resolves with the full result.
|
|
35
|
+
*
|
|
36
|
+
* Only available on Android.
|
|
37
|
+
*
|
|
38
|
+
* @since 8.2.0
|
|
39
|
+
*/
|
|
40
|
+
rewrite(options: RewriteOptions): Promise<RewriteResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Called while the rewriting feature is being downloaded.
|
|
43
|
+
*
|
|
44
|
+
* Only available on Android.
|
|
45
|
+
*
|
|
46
|
+
* @since 8.2.0
|
|
47
|
+
*/
|
|
48
|
+
addListener(eventName: 'downloadProgress', listenerFunc: (event: DownloadProgressEvent) => void): Promise<PluginListenerHandle>;
|
|
49
|
+
/**
|
|
50
|
+
* Called when a new partial result is available during inference.
|
|
51
|
+
*
|
|
52
|
+
* Only available on Android.
|
|
53
|
+
*
|
|
54
|
+
* @since 8.2.0
|
|
55
|
+
*/
|
|
56
|
+
addListener(eventName: 'inferenceProgress', listenerFunc: (event: InferenceProgressEvent) => void): Promise<PluginListenerHandle>;
|
|
57
|
+
/**
|
|
58
|
+
* Remove all listeners for this plugin.
|
|
59
|
+
*
|
|
60
|
+
* @since 8.2.0
|
|
61
|
+
*/
|
|
62
|
+
removeAllListeners(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @since 8.2.0
|
|
66
|
+
*/
|
|
67
|
+
export interface CheckFeatureStatusResult {
|
|
68
|
+
/**
|
|
69
|
+
* The current availability status of the rewriting feature.
|
|
70
|
+
*
|
|
71
|
+
* @since 8.2.0
|
|
72
|
+
* @example 'AVAILABLE'
|
|
73
|
+
*/
|
|
74
|
+
featureStatus: FeatureStatus;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @since 8.2.0
|
|
78
|
+
*/
|
|
79
|
+
export interface DownloadProgressEvent {
|
|
80
|
+
/**
|
|
81
|
+
* The total number of bytes downloaded so far.
|
|
82
|
+
*
|
|
83
|
+
* @since 8.2.0
|
|
84
|
+
* @example 1024
|
|
85
|
+
*/
|
|
86
|
+
totalBytesDownloaded: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The feature availability depends on the configured output type
|
|
90
|
+
* and language. Therefore, `checkFeatureStatus(...)` and
|
|
91
|
+
* `downloadFeature(...)` take the same base options as `rewrite(...)`.
|
|
92
|
+
*
|
|
93
|
+
* @since 8.2.0
|
|
94
|
+
*/
|
|
95
|
+
export interface FeatureOptions {
|
|
96
|
+
/**
|
|
97
|
+
* The language of the input text.
|
|
98
|
+
*
|
|
99
|
+
* @since 8.2.0
|
|
100
|
+
* @default Language.English
|
|
101
|
+
*/
|
|
102
|
+
language?: Language;
|
|
103
|
+
/**
|
|
104
|
+
* The style in which the input text should be rewritten.
|
|
105
|
+
*
|
|
106
|
+
* @since 8.2.0
|
|
107
|
+
* @default OutputType.Elaborate
|
|
108
|
+
*/
|
|
109
|
+
outputType?: OutputType;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @since 8.2.0
|
|
113
|
+
*/
|
|
114
|
+
export interface InferenceProgressEvent {
|
|
115
|
+
/**
|
|
116
|
+
* The new text of the partial result.
|
|
117
|
+
*
|
|
118
|
+
* @since 8.2.0
|
|
119
|
+
* @example 'Capacitor is an open source native runtime.'
|
|
120
|
+
*/
|
|
121
|
+
text: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @since 8.2.0
|
|
125
|
+
*/
|
|
126
|
+
export interface RewriteOptions extends FeatureOptions {
|
|
127
|
+
/**
|
|
128
|
+
* The text to rewrite.
|
|
129
|
+
*
|
|
130
|
+
* The input must be under 256 tokens.
|
|
131
|
+
*
|
|
132
|
+
* @since 8.2.0
|
|
133
|
+
* @example 'Capacitor is an open source native runtime for building Web Native apps.'
|
|
134
|
+
*/
|
|
135
|
+
text: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @since 8.2.0
|
|
139
|
+
*/
|
|
140
|
+
export interface RewriteResult {
|
|
141
|
+
/**
|
|
142
|
+
* The rewritten text suggestions, sorted in descending order of confidence.
|
|
143
|
+
*
|
|
144
|
+
* @since 8.2.0
|
|
145
|
+
* @example ['Capacitor is an open source native runtime for building Web Native apps.']
|
|
146
|
+
*/
|
|
147
|
+
results: string[];
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @since 8.2.0
|
|
151
|
+
*/
|
|
152
|
+
export declare enum FeatureStatus {
|
|
153
|
+
/**
|
|
154
|
+
* The feature is available to use.
|
|
155
|
+
*
|
|
156
|
+
* @since 8.2.0
|
|
157
|
+
*/
|
|
158
|
+
Available = "AVAILABLE",
|
|
159
|
+
/**
|
|
160
|
+
* The feature can be downloaded using `downloadFeature(...)`.
|
|
161
|
+
*
|
|
162
|
+
* @since 8.2.0
|
|
163
|
+
*/
|
|
164
|
+
Downloadable = "DOWNLOADABLE",
|
|
165
|
+
/**
|
|
166
|
+
* The feature is currently being downloaded.
|
|
167
|
+
*
|
|
168
|
+
* @since 8.2.0
|
|
169
|
+
*/
|
|
170
|
+
Downloading = "DOWNLOADING",
|
|
171
|
+
/**
|
|
172
|
+
* The feature is not available on this device.
|
|
173
|
+
*
|
|
174
|
+
* @since 8.2.0
|
|
175
|
+
*/
|
|
176
|
+
Unavailable = "UNAVAILABLE"
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @since 8.2.0
|
|
180
|
+
*/
|
|
181
|
+
export declare enum Language {
|
|
182
|
+
/**
|
|
183
|
+
* @since 8.2.0
|
|
184
|
+
*/
|
|
185
|
+
English = "ENGLISH",
|
|
186
|
+
/**
|
|
187
|
+
* @since 8.2.0
|
|
188
|
+
*/
|
|
189
|
+
French = "FRENCH",
|
|
190
|
+
/**
|
|
191
|
+
* @since 8.2.0
|
|
192
|
+
*/
|
|
193
|
+
German = "GERMAN",
|
|
194
|
+
/**
|
|
195
|
+
* @since 8.2.0
|
|
196
|
+
*/
|
|
197
|
+
Italian = "ITALIAN",
|
|
198
|
+
/**
|
|
199
|
+
* @since 8.2.0
|
|
200
|
+
*/
|
|
201
|
+
Japanese = "JAPANESE",
|
|
202
|
+
/**
|
|
203
|
+
* @since 8.2.0
|
|
204
|
+
*/
|
|
205
|
+
Korean = "KOREAN",
|
|
206
|
+
/**
|
|
207
|
+
* @since 8.2.0
|
|
208
|
+
*/
|
|
209
|
+
Spanish = "SPANISH"
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* @since 8.2.0
|
|
213
|
+
*/
|
|
214
|
+
export declare enum OutputType {
|
|
215
|
+
/**
|
|
216
|
+
* Elaborate the input text.
|
|
217
|
+
*
|
|
218
|
+
* @since 8.2.0
|
|
219
|
+
*/
|
|
220
|
+
Elaborate = "ELABORATE",
|
|
221
|
+
/**
|
|
222
|
+
* Insert appropriate emojis into the input text.
|
|
223
|
+
*
|
|
224
|
+
* @since 8.2.0
|
|
225
|
+
*/
|
|
226
|
+
Emojify = "EMOJIFY",
|
|
227
|
+
/**
|
|
228
|
+
* Shorten the input text.
|
|
229
|
+
*
|
|
230
|
+
* @since 8.2.0
|
|
231
|
+
*/
|
|
232
|
+
Shorten = "SHORTEN",
|
|
233
|
+
/**
|
|
234
|
+
* Make the input text more friendly.
|
|
235
|
+
*
|
|
236
|
+
* @since 8.2.0
|
|
237
|
+
*/
|
|
238
|
+
Friendly = "FRIENDLY",
|
|
239
|
+
/**
|
|
240
|
+
* Make the input text more professional.
|
|
241
|
+
*
|
|
242
|
+
* @since 8.2.0
|
|
243
|
+
*/
|
|
244
|
+
Professional = "PROFESSIONAL",
|
|
245
|
+
/**
|
|
246
|
+
* Rephrase the input text.
|
|
247
|
+
*
|
|
248
|
+
* @since 8.2.0
|
|
249
|
+
*/
|
|
250
|
+
Rephrase = "REPHRASE"
|
|
251
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 8.2.0
|
|
3
|
+
*/
|
|
4
|
+
export var FeatureStatus;
|
|
5
|
+
(function (FeatureStatus) {
|
|
6
|
+
/**
|
|
7
|
+
* The feature is available to use.
|
|
8
|
+
*
|
|
9
|
+
* @since 8.2.0
|
|
10
|
+
*/
|
|
11
|
+
FeatureStatus["Available"] = "AVAILABLE";
|
|
12
|
+
/**
|
|
13
|
+
* The feature can be downloaded using `downloadFeature(...)`.
|
|
14
|
+
*
|
|
15
|
+
* @since 8.2.0
|
|
16
|
+
*/
|
|
17
|
+
FeatureStatus["Downloadable"] = "DOWNLOADABLE";
|
|
18
|
+
/**
|
|
19
|
+
* The feature is currently being downloaded.
|
|
20
|
+
*
|
|
21
|
+
* @since 8.2.0
|
|
22
|
+
*/
|
|
23
|
+
FeatureStatus["Downloading"] = "DOWNLOADING";
|
|
24
|
+
/**
|
|
25
|
+
* The feature is not available on this device.
|
|
26
|
+
*
|
|
27
|
+
* @since 8.2.0
|
|
28
|
+
*/
|
|
29
|
+
FeatureStatus["Unavailable"] = "UNAVAILABLE";
|
|
30
|
+
})(FeatureStatus || (FeatureStatus = {}));
|
|
31
|
+
/**
|
|
32
|
+
* @since 8.2.0
|
|
33
|
+
*/
|
|
34
|
+
export var Language;
|
|
35
|
+
(function (Language) {
|
|
36
|
+
/**
|
|
37
|
+
* @since 8.2.0
|
|
38
|
+
*/
|
|
39
|
+
Language["English"] = "ENGLISH";
|
|
40
|
+
/**
|
|
41
|
+
* @since 8.2.0
|
|
42
|
+
*/
|
|
43
|
+
Language["French"] = "FRENCH";
|
|
44
|
+
/**
|
|
45
|
+
* @since 8.2.0
|
|
46
|
+
*/
|
|
47
|
+
Language["German"] = "GERMAN";
|
|
48
|
+
/**
|
|
49
|
+
* @since 8.2.0
|
|
50
|
+
*/
|
|
51
|
+
Language["Italian"] = "ITALIAN";
|
|
52
|
+
/**
|
|
53
|
+
* @since 8.2.0
|
|
54
|
+
*/
|
|
55
|
+
Language["Japanese"] = "JAPANESE";
|
|
56
|
+
/**
|
|
57
|
+
* @since 8.2.0
|
|
58
|
+
*/
|
|
59
|
+
Language["Korean"] = "KOREAN";
|
|
60
|
+
/**
|
|
61
|
+
* @since 8.2.0
|
|
62
|
+
*/
|
|
63
|
+
Language["Spanish"] = "SPANISH";
|
|
64
|
+
})(Language || (Language = {}));
|
|
65
|
+
/**
|
|
66
|
+
* @since 8.2.0
|
|
67
|
+
*/
|
|
68
|
+
export var OutputType;
|
|
69
|
+
(function (OutputType) {
|
|
70
|
+
/**
|
|
71
|
+
* Elaborate the input text.
|
|
72
|
+
*
|
|
73
|
+
* @since 8.2.0
|
|
74
|
+
*/
|
|
75
|
+
OutputType["Elaborate"] = "ELABORATE";
|
|
76
|
+
/**
|
|
77
|
+
* Insert appropriate emojis into the input text.
|
|
78
|
+
*
|
|
79
|
+
* @since 8.2.0
|
|
80
|
+
*/
|
|
81
|
+
OutputType["Emojify"] = "EMOJIFY";
|
|
82
|
+
/**
|
|
83
|
+
* Shorten the input text.
|
|
84
|
+
*
|
|
85
|
+
* @since 8.2.0
|
|
86
|
+
*/
|
|
87
|
+
OutputType["Shorten"] = "SHORTEN";
|
|
88
|
+
/**
|
|
89
|
+
* Make the input text more friendly.
|
|
90
|
+
*
|
|
91
|
+
* @since 8.2.0
|
|
92
|
+
*/
|
|
93
|
+
OutputType["Friendly"] = "FRIENDLY";
|
|
94
|
+
/**
|
|
95
|
+
* Make the input text more professional.
|
|
96
|
+
*
|
|
97
|
+
* @since 8.2.0
|
|
98
|
+
*/
|
|
99
|
+
OutputType["Professional"] = "PROFESSIONAL";
|
|
100
|
+
/**
|
|
101
|
+
* Rephrase the input text.
|
|
102
|
+
*
|
|
103
|
+
* @since 8.2.0
|
|
104
|
+
*/
|
|
105
|
+
OutputType["Rephrase"] = "REPHRASE";
|
|
106
|
+
})(OutputType || (OutputType = {}));
|
|
107
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAoKA;;GAEG;AACH,MAAM,CAAN,IAAY,aAyBX;AAzBD,WAAY,aAAa;IACvB;;;;OAIG;IACH,wCAAuB,CAAA;IACvB;;;;OAIG;IACH,8CAA6B,CAAA;IAC7B;;;;OAIG;IACH,4CAA2B,CAAA;IAC3B;;;;OAIG;IACH,4CAA2B,CAAA;AAC7B,CAAC,EAzBW,aAAa,KAAb,aAAa,QAyBxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,QA6BX;AA7BD,WAAY,QAAQ;IAClB;;OAEG;IACH,+BAAmB,CAAA;IACnB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,+BAAmB,CAAA;IACnB;;OAEG;IACH,iCAAqB,CAAA;IACrB;;OAEG;IACH,6BAAiB,CAAA;IACjB;;OAEG;IACH,+BAAmB,CAAA;AACrB,CAAC,EA7BW,QAAQ,KAAR,QAAQ,QA6BnB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,UAqCX;AArCD,WAAY,UAAU;IACpB;;;;OAIG;IACH,qCAAuB,CAAA;IACvB;;;;OAIG;IACH,iCAAmB,CAAA;IACnB;;;;OAIG;IACH,iCAAmB,CAAA;IACnB;;;;OAIG;IACH,mCAAqB,CAAA;IACrB;;;;OAIG;IACH,2CAA6B,CAAA;IAC7B;;;;OAIG;IACH,mCAAqB,CAAA;AACvB,CAAC,EArCW,UAAU,KAAV,UAAU,QAqCrB","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * @since 8.2.0\n */\nexport interface GenAiRewritingPlugin {\n /**\n * Check the current availability status of the rewriting feature.\n *\n * If the status is `DOWNLOADABLE`, you can download the feature\n * using `downloadFeature(...)`.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n */\n checkFeatureStatus(\n options?: FeatureOptions,\n ): Promise<CheckFeatureStatusResult>;\n /**\n * Download the rewriting feature.\n *\n * The `downloadProgress` event listener will notify you about\n * the download progress. The returned promise resolves when\n * the download is complete or the feature is already available.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n */\n downloadFeature(options?: FeatureOptions): Promise<void>;\n /**\n * Rewrite the given text in the configured style.\n *\n * The `inferenceProgress` event listener will notify you about\n * partial results as they are generated. The returned promise\n * resolves with the full result.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n */\n rewrite(options: RewriteOptions): Promise<RewriteResult>;\n /**\n * Called while the rewriting feature is being downloaded.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n */\n addListener(\n eventName: 'downloadProgress',\n listenerFunc: (event: DownloadProgressEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Called when a new partial result is available during inference.\n *\n * Only available on Android.\n *\n * @since 8.2.0\n */\n addListener(\n eventName: 'inferenceProgress',\n listenerFunc: (event: InferenceProgressEvent) => void,\n ): Promise<PluginListenerHandle>;\n /**\n * Remove all listeners for this plugin.\n *\n * @since 8.2.0\n */\n removeAllListeners(): Promise<void>;\n}\n\n/**\n * @since 8.2.0\n */\nexport interface CheckFeatureStatusResult {\n /**\n * The current availability status of the rewriting feature.\n *\n * @since 8.2.0\n * @example 'AVAILABLE'\n */\n featureStatus: FeatureStatus;\n}\n\n/**\n * @since 8.2.0\n */\nexport interface DownloadProgressEvent {\n /**\n * The total number of bytes downloaded so far.\n *\n * @since 8.2.0\n * @example 1024\n */\n totalBytesDownloaded: number;\n}\n\n/**\n * The feature availability depends on the configured output type\n * and language. Therefore, `checkFeatureStatus(...)` and\n * `downloadFeature(...)` take the same base options as `rewrite(...)`.\n *\n * @since 8.2.0\n */\nexport interface FeatureOptions {\n /**\n * The language of the input text.\n *\n * @since 8.2.0\n * @default Language.English\n */\n language?: Language;\n /**\n * The style in which the input text should be rewritten.\n *\n * @since 8.2.0\n * @default OutputType.Elaborate\n */\n outputType?: OutputType;\n}\n\n/**\n * @since 8.2.0\n */\nexport interface InferenceProgressEvent {\n /**\n * The new text of the partial result.\n *\n * @since 8.2.0\n * @example 'Capacitor is an open source native runtime.'\n */\n text: string;\n}\n\n/**\n * @since 8.2.0\n */\nexport interface RewriteOptions extends FeatureOptions {\n /**\n * The text to rewrite.\n *\n * The input must be under 256 tokens.\n *\n * @since 8.2.0\n * @example 'Capacitor is an open source native runtime for building Web Native apps.'\n */\n text: string;\n}\n\n/**\n * @since 8.2.0\n */\nexport interface RewriteResult {\n /**\n * The rewritten text suggestions, sorted in descending order of confidence.\n *\n * @since 8.2.0\n * @example ['Capacitor is an open source native runtime for building Web Native apps.']\n */\n results: string[];\n}\n\n/**\n * @since 8.2.0\n */\nexport enum FeatureStatus {\n /**\n * The feature is available to use.\n *\n * @since 8.2.0\n */\n Available = 'AVAILABLE',\n /**\n * The feature can be downloaded using `downloadFeature(...)`.\n *\n * @since 8.2.0\n */\n Downloadable = 'DOWNLOADABLE',\n /**\n * The feature is currently being downloaded.\n *\n * @since 8.2.0\n */\n Downloading = 'DOWNLOADING',\n /**\n * The feature is not available on this device.\n *\n * @since 8.2.0\n */\n Unavailable = 'UNAVAILABLE',\n}\n\n/**\n * @since 8.2.0\n */\nexport enum Language {\n /**\n * @since 8.2.0\n */\n English = 'ENGLISH',\n /**\n * @since 8.2.0\n */\n French = 'FRENCH',\n /**\n * @since 8.2.0\n */\n German = 'GERMAN',\n /**\n * @since 8.2.0\n */\n Italian = 'ITALIAN',\n /**\n * @since 8.2.0\n */\n Japanese = 'JAPANESE',\n /**\n * @since 8.2.0\n */\n Korean = 'KOREAN',\n /**\n * @since 8.2.0\n */\n Spanish = 'SPANISH',\n}\n\n/**\n * @since 8.2.0\n */\nexport enum OutputType {\n /**\n * Elaborate the input text.\n *\n * @since 8.2.0\n */\n Elaborate = 'ELABORATE',\n /**\n * Insert appropriate emojis into the input text.\n *\n * @since 8.2.0\n */\n Emojify = 'EMOJIFY',\n /**\n * Shorten the input text.\n *\n * @since 8.2.0\n */\n Shorten = 'SHORTEN',\n /**\n * Make the input text more friendly.\n *\n * @since 8.2.0\n */\n Friendly = 'FRIENDLY',\n /**\n * Make the input text more professional.\n *\n * @since 8.2.0\n */\n Professional = 'PROFESSIONAL',\n /**\n * Rephrase the input text.\n *\n * @since 8.2.0\n */\n Rephrase = 'REPHRASE',\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const GenAiRewriting = registerPlugin('GenAiRewriting', {
|
|
3
|
+
web: () => import('./web').then(m => new m.GenAiRewritingWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { GenAiRewriting };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,cAAc,GAAG,cAAc,CAAuB,gBAAgB,EAAE;IAC5E,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;CAChE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { GenAiRewritingPlugin } from './definitions';\n\nconst GenAiRewriting = registerPlugin<GenAiRewritingPlugin>('GenAiRewriting', {\n web: () => import('./web').then(m => new m.GenAiRewritingWeb()),\n});\n\nexport * from './definitions';\nexport { GenAiRewriting };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { CheckFeatureStatusResult, FeatureOptions, GenAiRewritingPlugin, RewriteOptions, RewriteResult } from './definitions';
|
|
3
|
+
export declare class GenAiRewritingWeb extends WebPlugin implements GenAiRewritingPlugin {
|
|
4
|
+
checkFeatureStatus(_options?: FeatureOptions): Promise<CheckFeatureStatusResult>;
|
|
5
|
+
downloadFeature(_options?: FeatureOptions): Promise<void>;
|
|
6
|
+
rewrite(_options: RewriteOptions): Promise<RewriteResult>;
|
|
7
|
+
private createUnimplementedException;
|
|
8
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CapacitorException, ExceptionCode, WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class GenAiRewritingWeb extends WebPlugin {
|
|
3
|
+
async checkFeatureStatus(_options) {
|
|
4
|
+
throw this.createUnimplementedException();
|
|
5
|
+
}
|
|
6
|
+
async downloadFeature(_options) {
|
|
7
|
+
throw this.createUnimplementedException();
|
|
8
|
+
}
|
|
9
|
+
async rewrite(_options) {
|
|
10
|
+
throw this.createUnimplementedException();
|
|
11
|
+
}
|
|
12
|
+
createUnimplementedException() {
|
|
13
|
+
return new CapacitorException('This plugin method is not implemented on this platform.', ExceptionCode.Unimplemented);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU/E,MAAM,OAAO,iBACX,SAAQ,SAAS;IAGV,KAAK,CAAC,kBAAkB,CAC7B,QAAyB;QAEzB,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,QAAyB;QACpD,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC5C,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,QAAwB;QAC3C,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC5C,CAAC;IAEO,4BAA4B;QAClC,OAAO,IAAI,kBAAkB,CAC3B,yDAAyD,EACzD,aAAa,CAAC,aAAa,CAC5B,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { CapacitorException, ExceptionCode, WebPlugin } from '@capacitor/core';\n\nimport type {\n CheckFeatureStatusResult,\n FeatureOptions,\n GenAiRewritingPlugin,\n RewriteOptions,\n RewriteResult,\n} from './definitions';\n\nexport class GenAiRewritingWeb\n extends WebPlugin\n implements GenAiRewritingPlugin\n{\n public async checkFeatureStatus(\n _options?: FeatureOptions,\n ): Promise<CheckFeatureStatusResult> {\n throw this.createUnimplementedException();\n }\n\n public async downloadFeature(_options?: FeatureOptions): Promise<void> {\n throw this.createUnimplementedException();\n }\n\n public async rewrite(_options: RewriteOptions): Promise<RewriteResult> {\n throw this.createUnimplementedException();\n }\n\n private createUnimplementedException(): CapacitorException {\n return new CapacitorException(\n 'This plugin method is not implemented on this platform.',\n ExceptionCode.Unimplemented,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @since 8.2.0
|
|
7
|
+
*/
|
|
8
|
+
exports.FeatureStatus = void 0;
|
|
9
|
+
(function (FeatureStatus) {
|
|
10
|
+
/**
|
|
11
|
+
* The feature is available to use.
|
|
12
|
+
*
|
|
13
|
+
* @since 8.2.0
|
|
14
|
+
*/
|
|
15
|
+
FeatureStatus["Available"] = "AVAILABLE";
|
|
16
|
+
/**
|
|
17
|
+
* The feature can be downloaded using `downloadFeature(...)`.
|
|
18
|
+
*
|
|
19
|
+
* @since 8.2.0
|
|
20
|
+
*/
|
|
21
|
+
FeatureStatus["Downloadable"] = "DOWNLOADABLE";
|
|
22
|
+
/**
|
|
23
|
+
* The feature is currently being downloaded.
|
|
24
|
+
*
|
|
25
|
+
* @since 8.2.0
|
|
26
|
+
*/
|
|
27
|
+
FeatureStatus["Downloading"] = "DOWNLOADING";
|
|
28
|
+
/**
|
|
29
|
+
* The feature is not available on this device.
|
|
30
|
+
*
|
|
31
|
+
* @since 8.2.0
|
|
32
|
+
*/
|
|
33
|
+
FeatureStatus["Unavailable"] = "UNAVAILABLE";
|
|
34
|
+
})(exports.FeatureStatus || (exports.FeatureStatus = {}));
|
|
35
|
+
/**
|
|
36
|
+
* @since 8.2.0
|
|
37
|
+
*/
|
|
38
|
+
exports.Language = void 0;
|
|
39
|
+
(function (Language) {
|
|
40
|
+
/**
|
|
41
|
+
* @since 8.2.0
|
|
42
|
+
*/
|
|
43
|
+
Language["English"] = "ENGLISH";
|
|
44
|
+
/**
|
|
45
|
+
* @since 8.2.0
|
|
46
|
+
*/
|
|
47
|
+
Language["French"] = "FRENCH";
|
|
48
|
+
/**
|
|
49
|
+
* @since 8.2.0
|
|
50
|
+
*/
|
|
51
|
+
Language["German"] = "GERMAN";
|
|
52
|
+
/**
|
|
53
|
+
* @since 8.2.0
|
|
54
|
+
*/
|
|
55
|
+
Language["Italian"] = "ITALIAN";
|
|
56
|
+
/**
|
|
57
|
+
* @since 8.2.0
|
|
58
|
+
*/
|
|
59
|
+
Language["Japanese"] = "JAPANESE";
|
|
60
|
+
/**
|
|
61
|
+
* @since 8.2.0
|
|
62
|
+
*/
|
|
63
|
+
Language["Korean"] = "KOREAN";
|
|
64
|
+
/**
|
|
65
|
+
* @since 8.2.0
|
|
66
|
+
*/
|
|
67
|
+
Language["Spanish"] = "SPANISH";
|
|
68
|
+
})(exports.Language || (exports.Language = {}));
|
|
69
|
+
/**
|
|
70
|
+
* @since 8.2.0
|
|
71
|
+
*/
|
|
72
|
+
exports.OutputType = void 0;
|
|
73
|
+
(function (OutputType) {
|
|
74
|
+
/**
|
|
75
|
+
* Elaborate the input text.
|
|
76
|
+
*
|
|
77
|
+
* @since 8.2.0
|
|
78
|
+
*/
|
|
79
|
+
OutputType["Elaborate"] = "ELABORATE";
|
|
80
|
+
/**
|
|
81
|
+
* Insert appropriate emojis into the input text.
|
|
82
|
+
*
|
|
83
|
+
* @since 8.2.0
|
|
84
|
+
*/
|
|
85
|
+
OutputType["Emojify"] = "EMOJIFY";
|
|
86
|
+
/**
|
|
87
|
+
* Shorten the input text.
|
|
88
|
+
*
|
|
89
|
+
* @since 8.2.0
|
|
90
|
+
*/
|
|
91
|
+
OutputType["Shorten"] = "SHORTEN";
|
|
92
|
+
/**
|
|
93
|
+
* Make the input text more friendly.
|
|
94
|
+
*
|
|
95
|
+
* @since 8.2.0
|
|
96
|
+
*/
|
|
97
|
+
OutputType["Friendly"] = "FRIENDLY";
|
|
98
|
+
/**
|
|
99
|
+
* Make the input text more professional.
|
|
100
|
+
*
|
|
101
|
+
* @since 8.2.0
|
|
102
|
+
*/
|
|
103
|
+
OutputType["Professional"] = "PROFESSIONAL";
|
|
104
|
+
/**
|
|
105
|
+
* Rephrase the input text.
|
|
106
|
+
*
|
|
107
|
+
* @since 8.2.0
|
|
108
|
+
*/
|
|
109
|
+
OutputType["Rephrase"] = "REPHRASE";
|
|
110
|
+
})(exports.OutputType || (exports.OutputType = {}));
|
|
111
|
+
|
|
112
|
+
const GenAiRewriting = core.registerPlugin('GenAiRewriting', {
|
|
113
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.GenAiRewritingWeb()),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
class GenAiRewritingWeb extends core.WebPlugin {
|
|
117
|
+
async checkFeatureStatus(_options) {
|
|
118
|
+
throw this.createUnimplementedException();
|
|
119
|
+
}
|
|
120
|
+
async downloadFeature(_options) {
|
|
121
|
+
throw this.createUnimplementedException();
|
|
122
|
+
}
|
|
123
|
+
async rewrite(_options) {
|
|
124
|
+
throw this.createUnimplementedException();
|
|
125
|
+
}
|
|
126
|
+
createUnimplementedException() {
|
|
127
|
+
return new core.CapacitorException('This plugin method is not implemented on this platform.', core.ExceptionCode.Unimplemented);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
132
|
+
__proto__: null,
|
|
133
|
+
GenAiRewritingWeb: GenAiRewritingWeb
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
exports.GenAiRewriting = GenAiRewriting;
|
|
137
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 8.2.0\n */\nexport var FeatureStatus;\n(function (FeatureStatus) {\n /**\n * The feature is available to use.\n *\n * @since 8.2.0\n */\n FeatureStatus[\"Available\"] = \"AVAILABLE\";\n /**\n * The feature can be downloaded using `downloadFeature(...)`.\n *\n * @since 8.2.0\n */\n FeatureStatus[\"Downloadable\"] = \"DOWNLOADABLE\";\n /**\n * The feature is currently being downloaded.\n *\n * @since 8.2.0\n */\n FeatureStatus[\"Downloading\"] = \"DOWNLOADING\";\n /**\n * The feature is not available on this device.\n *\n * @since 8.2.0\n */\n FeatureStatus[\"Unavailable\"] = \"UNAVAILABLE\";\n})(FeatureStatus || (FeatureStatus = {}));\n/**\n * @since 8.2.0\n */\nexport var Language;\n(function (Language) {\n /**\n * @since 8.2.0\n */\n Language[\"English\"] = \"ENGLISH\";\n /**\n * @since 8.2.0\n */\n Language[\"French\"] = \"FRENCH\";\n /**\n * @since 8.2.0\n */\n Language[\"German\"] = \"GERMAN\";\n /**\n * @since 8.2.0\n */\n Language[\"Italian\"] = \"ITALIAN\";\n /**\n * @since 8.2.0\n */\n Language[\"Japanese\"] = \"JAPANESE\";\n /**\n * @since 8.2.0\n */\n Language[\"Korean\"] = \"KOREAN\";\n /**\n * @since 8.2.0\n */\n Language[\"Spanish\"] = \"SPANISH\";\n})(Language || (Language = {}));\n/**\n * @since 8.2.0\n */\nexport var OutputType;\n(function (OutputType) {\n /**\n * Elaborate the input text.\n *\n * @since 8.2.0\n */\n OutputType[\"Elaborate\"] = \"ELABORATE\";\n /**\n * Insert appropriate emojis into the input text.\n *\n * @since 8.2.0\n */\n OutputType[\"Emojify\"] = \"EMOJIFY\";\n /**\n * Shorten the input text.\n *\n * @since 8.2.0\n */\n OutputType[\"Shorten\"] = \"SHORTEN\";\n /**\n * Make the input text more friendly.\n *\n * @since 8.2.0\n */\n OutputType[\"Friendly\"] = \"FRIENDLY\";\n /**\n * Make the input text more professional.\n *\n * @since 8.2.0\n */\n OutputType[\"Professional\"] = \"PROFESSIONAL\";\n /**\n * Rephrase the input text.\n *\n * @since 8.2.0\n */\n OutputType[\"Rephrase\"] = \"REPHRASE\";\n})(OutputType || (OutputType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst GenAiRewriting = registerPlugin('GenAiRewriting', {\n web: () => import('./web').then(m => new m.GenAiRewritingWeb()),\n});\nexport * from './definitions';\nexport { GenAiRewriting };\n//# sourceMappingURL=index.js.map","import { CapacitorException, ExceptionCode, WebPlugin } from '@capacitor/core';\nexport class GenAiRewritingWeb extends WebPlugin {\n async checkFeatureStatus(_options) {\n throw this.createUnimplementedException();\n }\n async downloadFeature(_options) {\n throw this.createUnimplementedException();\n }\n async rewrite(_options) {\n throw this.createUnimplementedException();\n }\n createUnimplementedException() {\n return new CapacitorException('This plugin method is not implemented on this platform.', ExceptionCode.Unimplemented);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["FeatureStatus","Language","OutputType","registerPlugin","WebPlugin","CapacitorException","ExceptionCode"],"mappings":";;;;AAAA;AACA;AACA;AACWA;AACX,CAAC,UAAU,aAAa,EAAE;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,WAAW,CAAC,GAAG,WAAW;AAC5C;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,cAAc,CAAC,GAAG,cAAc;AAClD;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,aAAa,CAAC,GAAG,aAAa;AAChD;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,CAAC,aAAa,CAAC,GAAG,aAAa;AAChD,CAAC,EAAEA,qBAAa,KAAKA,qBAAa,GAAG,EAAE,CAAC,CAAC;AACzC;AACA;AACA;AACWC;AACX,CAAC,UAAU,QAAQ,EAAE;AACrB;AACA;AACA;AACA,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,SAAS;AACnC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACjC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACjC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,SAAS;AACnC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;AACrC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,QAAQ;AACjC;AACA;AACA;AACA,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,SAAS;AACnC,CAAC,EAAEA,gBAAQ,KAAKA,gBAAQ,GAAG,EAAE,CAAC,CAAC;AAC/B;AACA;AACA;AACWC;AACX,CAAC,UAAU,UAAU,EAAE;AACvB;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;AACzC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;AACrC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;AACvC;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,cAAc,CAAC,GAAG,cAAc;AAC/C;AACA;AACA;AACA;AACA;AACA,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,UAAU;AACvC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;;ACxG9B,MAAC,cAAc,GAAGC,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;AACvC,QAAQ,MAAM,IAAI,CAAC,4BAA4B,EAAE;AACjD,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC,QAAQ,MAAM,IAAI,CAAC,4BAA4B,EAAE;AACjD,IAAI;AACJ,IAAI,MAAM,OAAO,CAAC,QAAQ,EAAE;AAC5B,QAAQ,MAAM,IAAI,CAAC,4BAA4B,EAAE;AACjD,IAAI;AACJ,IAAI,4BAA4B,GAAG;AACnC,QAAQ,OAAO,IAAIC,uBAAkB,CAAC,yDAAyD,EAAEC,kBAAa,CAAC,aAAa,CAAC;AAC7H,IAAI;AACJ;;;;;;;;;"}
|