@aiqa/sdk 1.0.0 → 1.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/README.md +35 -4
- package/dist/browser/browser.d.ts +1 -0
- package/dist/browser/browser.js +1 -1
- package/dist/browser/browser.js.map +1 -1
- package/dist/node/node.d.ts +1 -0
- package/dist/node/node.js +1 -1
- package/dist/node/node.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,9 +139,18 @@ Adds a fact to the active application (Promise-based).
|
|
|
139
139
|
id: string;
|
|
140
140
|
question: string;
|
|
141
141
|
expected_answer: any;
|
|
142
|
-
answer_format: {
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
answer_format: { type: "STRING" }
|
|
143
|
+
/**
|
|
144
|
+
* Optional. Use this to attach your own identifiers to a fact so your UI
|
|
145
|
+
* can map the server response back to the right field or component.
|
|
146
|
+
* For example, store a form field ID, a section name, or any internal
|
|
147
|
+
* reference you need — the server stores it as-is and returns it unchanged
|
|
148
|
+
* in getFacts().
|
|
149
|
+
*
|
|
150
|
+
* Constraints: all keys and values must be strings; each value is limited
|
|
151
|
+
* to 1024 characters. Payloads that exceed this limit are rejected.
|
|
152
|
+
*/
|
|
153
|
+
metadata?: Record<string, string>
|
|
145
154
|
}
|
|
146
155
|
```
|
|
147
156
|
|
|
@@ -151,15 +160,19 @@ const isMatched = await sdk.addFact({
|
|
|
151
160
|
question: "Do you agree?",
|
|
152
161
|
expected_answer: "Yes",
|
|
153
162
|
answer_format: { type: "STRING" },
|
|
163
|
+
metadata: { uiFieldId: "policy-agreement", section: "consent" },
|
|
154
164
|
});
|
|
155
165
|
```
|
|
156
166
|
|
|
157
167
|
#### `getFacts()`
|
|
158
168
|
|
|
159
|
-
Retrieves all facts for the application (Promise-based).
|
|
169
|
+
Retrieves all facts for the application (Promise-based). Each fact includes a `metadata` field containing whatever was passed to `addFact()`. Facts added without `metadata` return `{}`.
|
|
160
170
|
|
|
161
171
|
```typescript
|
|
162
172
|
const facts = await sdk.getFacts();
|
|
173
|
+
facts.forEach((fact) => {
|
|
174
|
+
console.log(fact.id, fact.metadata); // e.g. { uiFieldId: "policy-agreement" } or {}
|
|
175
|
+
});
|
|
163
176
|
```
|
|
164
177
|
|
|
165
178
|
### Recording Management
|
|
@@ -242,11 +255,14 @@ type Application = {
|
|
|
242
255
|
|
|
243
256
|
### ApplicationFact
|
|
244
257
|
|
|
258
|
+
Returned by `getFacts()`. Extends `ApplicationFactInput` and adds server-side fields.
|
|
259
|
+
|
|
245
260
|
```typescript
|
|
246
261
|
type ApplicationFact = ApplicationFactInput & {
|
|
247
262
|
ai_answer?: any;
|
|
248
263
|
question_status: "searching" | "asked" | "not_asked";
|
|
249
264
|
verification_status: "processing" | "matched" | "unmatched";
|
|
265
|
+
metadata: Record<string, string>; // always present; {} when not set on addFact
|
|
250
266
|
};
|
|
251
267
|
```
|
|
252
268
|
|
|
@@ -275,6 +291,21 @@ type ApplicationFactInput = {
|
|
|
275
291
|
language?: string;
|
|
276
292
|
critical?: boolean;
|
|
277
293
|
is_skipped?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Optional. Attach your own identifiers to a fact so your UI can map the
|
|
296
|
+
* server response back to the right field or component — for example a form
|
|
297
|
+
* field ID, a section name, or any internal reference you need.
|
|
298
|
+
*
|
|
299
|
+
* The server stores this value encrypted alongside the fact and returns it
|
|
300
|
+
* unchanged in getFacts(). It is never inspected, indexed, or used for
|
|
301
|
+
* verification logic.
|
|
302
|
+
*
|
|
303
|
+
* Constraints:
|
|
304
|
+
* - All keys and values must be strings.
|
|
305
|
+
* - Each individual value is limited to 1024 characters.
|
|
306
|
+
* - Payloads that violate either constraint are rejected by the server.
|
|
307
|
+
*/
|
|
308
|
+
metadata?: Record<string, string>;
|
|
278
309
|
};
|
|
279
310
|
```
|
|
280
311
|
|
|
@@ -61,6 +61,7 @@ type ApplicationFactInput = {
|
|
|
61
61
|
language?: string;
|
|
62
62
|
critical?: boolean;
|
|
63
63
|
is_skipped?: boolean;
|
|
64
|
+
metadata?: Record<string, string>;
|
|
64
65
|
};
|
|
65
66
|
type QuestionStatus = "searching" | "asked" | "not_asked";
|
|
66
67
|
type VerificationStatus = "processing" | "matched" | "unmatched";
|
package/dist/browser/browser.js
CHANGED
|
@@ -3395,7 +3395,7 @@ var compareVersions = (left, right) => {
|
|
|
3395
3395
|
// package.json
|
|
3396
3396
|
var package_default = {
|
|
3397
3397
|
name: "@aiqa/sdk",
|
|
3398
|
-
version: "1.
|
|
3398
|
+
version: "1.1.0-develop.1",
|
|
3399
3399
|
main: "dist/node/node.js",
|
|
3400
3400
|
module: "dist/node/node.js",
|
|
3401
3401
|
types: "dist/node/node.d.ts",
|