@voiceflow/utils-designer 1.3.1 → 1.4.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/build/cjs/entity.util.d.ts.map +1 -1
- package/build/cjs/entity.util.js +1 -1
- package/build/cjs/intent.util.d.ts +32 -0
- package/build/cjs/intent.util.d.ts.map +1 -1
- package/build/cjs/intent.util.js +10 -1
- package/build/esm/entity.util.d.ts.map +1 -1
- package/build/esm/entity.util.js +2 -2
- package/build/esm/intent.util.d.ts +32 -0
- package/build/esm/intent.util.d.ts.map +1 -1
- package/build/esm/intent.util.js +9 -0
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity.util.d.ts","sourceRoot":"","sources":["../../src/entity.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK/E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,wBAAwB,wBAAyB,KAAK,aAAa,EAAE,OAAO,GAAG,UAAU,CAAC,YACxC,CAAC;AAEhE,eAAO,MAAM,2BAA2B,
|
1
|
+
{"version":3,"file":"entity.util.d.ts","sourceRoot":"","sources":["../../src/entity.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK/E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,wBAAwB,wBAAyB,KAAK,aAAa,EAAE,OAAO,GAAG,UAAU,CAAC,YACxC,CAAC;AAEhE,eAAO,MAAM,2BAA2B,8DAA4C,CAAC;AAErF,eAAO,MAAM,+BAA+B;cACS,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;EAGrF,CAAC;AAEF,eAAO,MAAM,gCAAgC;eACA,QAAQ,EAAE;EAGtD,CAAC;AAEF,eAAO,MAAM,8BAA8B;aACF,MAAM,EAAE;EAGhD,CAAC;AAEF,eAAO,MAAM,mBAAmB;cAjBqB,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;;eAMzC,QAAQ,EAAE;;aAMd,MAAM,EAAE;EAUhD,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;gBACoD,MAAM,GAAG,IAAI;EAGpG,CAAC"}
|
package/build/cjs/entity.util.js
CHANGED
@@ -8,7 +8,7 @@ const isDefaultEntityName = (name) => !name || name.toLowerCase().startsWith('en
|
|
8
8
|
exports.isDefaultEntityName = isDefaultEntityName;
|
9
9
|
const isEntityVariantLikeEmpty = ({ value, synonyms }) => !value.trim() && synonyms.every((synonym) => !synonym.trim());
|
10
10
|
exports.isEntityVariantLikeEmpty = isEntityVariantLikeEmpty;
|
11
|
-
exports.entityNameSpellingValidator = (0, validator_util_1.validatorZodFactory)(dtos_1.
|
11
|
+
exports.entityNameSpellingValidator = (0, validator_util_1.validatorZodFactory)(dtos_1.EntityDTO.shape.name);
|
12
12
|
exports.entityNameUniqEntitiesValidator = (0, validator_util_1.validatorFactory)((name, { entities, entityID }) => entities.every((entity) => entity.id === entityID || entity.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `The '${name}' entity already exists.`);
|
13
13
|
exports.entityNameUniqVariablesValidator = (0, validator_util_1.validatorFactory)((name, { variables }) => variables.every((variable) => variable.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have a variable defined with the '${name}' name already. Entity/Variable/Intent name must be unique.`);
|
14
14
|
exports.entityNameUniqIntentsValidator = (0, validator_util_1.validatorFactory)((name, { intents }) => intents.every((intent) => intent.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have an intent defined with the '${name}' name already. Entity/Intent/Variable name must be unique.`);
|
@@ -1,2 +1,34 @@
|
|
1
|
+
import type { Entity, Intent, Variable } from '@voiceflow/dtos';
|
1
2
|
export declare const isDefaultIntentName: (name?: string | null) => boolean;
|
3
|
+
export declare const intentNameSpellingValidator: (value: string) => import("./main").IValidatorResult<string>;
|
4
|
+
export declare const intentNameUniqIntentsValidator: import("./main").IValidatorWithContext<string, {
|
5
|
+
intents: Intent[];
|
6
|
+
intentID: string | null;
|
7
|
+
}>;
|
8
|
+
export declare const intentNameUniqEntitiesValidator: import("./main").IValidatorWithContext<string, {
|
9
|
+
entities: Entity[];
|
10
|
+
}>;
|
11
|
+
export declare const intentNameUniqVariablesValidator: import("./main").IValidatorWithContext<string, {
|
12
|
+
variables: Variable[];
|
13
|
+
}>;
|
14
|
+
export declare const intentNameValidator: import("./main").IValidatorWithContext<string, {
|
15
|
+
intents: Intent[];
|
16
|
+
intentID: string | null;
|
17
|
+
} & {
|
18
|
+
entities: Entity[];
|
19
|
+
} & {
|
20
|
+
variables: Variable[];
|
21
|
+
}>;
|
22
|
+
export declare const intentUtterancesValidator: import("./main").IValidatorWithContext<Pick<{
|
23
|
+
id: string;
|
24
|
+
createdAt: string;
|
25
|
+
updatedAt: string;
|
26
|
+
assistantID: string;
|
27
|
+
environmentID: string;
|
28
|
+
text: import("@voiceflow/dtos").UtteranceText;
|
29
|
+
language: "en-us";
|
30
|
+
intentID: string;
|
31
|
+
}, "id" | "text">[], {
|
32
|
+
isBuiltInIntent?: boolean | undefined;
|
33
|
+
}>;
|
2
34
|
//# sourceMappingURL=intent.util.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"intent.util.d.ts","sourceRoot":"","sources":["../../src/intent.util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC"}
|
1
|
+
{"version":3,"file":"intent.util.d.ts","sourceRoot":"","sources":["../../src/intent.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,2BAA2B,8DAA4C,CAAC;AAErF,eAAO,MAAM,8BAA8B;aACQ,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;EAGnF,CAAC;AAEF,eAAO,MAAM,+BAA+B;cACD,MAAM,EAAE;EAGlD,CAAC;AAEF,eAAO,MAAM,gCAAgC;eACA,QAAQ,EAAE;EAGtD,CAAC;AAEF,eAAO,MAAM,mBAAmB;aAjBmB,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;;cAMzC,MAAM,EAAE;;eAMN,QAAQ,EAAE;EAUtD,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;EAIrC,CAAC"}
|
package/build/cjs/intent.util.js
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isDefaultIntentName = void 0;
|
3
|
+
exports.intentUtterancesValidator = exports.intentNameValidator = exports.intentNameUniqVariablesValidator = exports.intentNameUniqEntitiesValidator = exports.intentNameUniqIntentsValidator = exports.intentNameSpellingValidator = exports.isDefaultIntentName = void 0;
|
4
|
+
const dtos_1 = require("@voiceflow/dtos");
|
5
|
+
const markup_util_1 = require("./markup.util");
|
6
|
+
const validator_util_1 = require("./validator/validator.util");
|
4
7
|
const isDefaultIntentName = (name) => !name || name.toLowerCase().startsWith('intent');
|
5
8
|
exports.isDefaultIntentName = isDefaultIntentName;
|
9
|
+
exports.intentNameSpellingValidator = (0, validator_util_1.validatorZodFactory)(dtos_1.IntentDTO.shape.name);
|
10
|
+
exports.intentNameUniqIntentsValidator = (0, validator_util_1.validatorFactory)((name, { intents, intentID }) => intents.every((intent) => intent.id === intentID || intent.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `The '${name}' intent already exists.`);
|
11
|
+
exports.intentNameUniqEntitiesValidator = (0, validator_util_1.validatorFactory)((name, { entities }) => entities.every((entity) => entity.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have an entity defined with the '${name}' name already. Intent/Entity/Variable name must be unique.`);
|
12
|
+
exports.intentNameUniqVariablesValidator = (0, validator_util_1.validatorFactory)((name, { variables }) => variables.every((variable) => variable.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have a variable defined with the '${name}' name already. Intent/Variable/Entity name must be unique.`);
|
13
|
+
exports.intentNameValidator = (0, validator_util_1.composeValidators)(exports.intentNameSpellingValidator, exports.intentNameUniqIntentsValidator, exports.intentNameUniqEntitiesValidator, exports.intentNameUniqVariablesValidator);
|
14
|
+
exports.intentUtterancesValidator = (0, validator_util_1.validatorFactory)((utterances, { isBuiltInIntent }) => isBuiltInIntent || utterances.some(({ text }) => !(0, markup_util_1.isMarkupEmpty)(text)), 'Intent requires at least 1 sample phrase.');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity.util.d.ts","sourceRoot":"","sources":["../../src/entity.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK/E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,wBAAwB,wBAAyB,KAAK,aAAa,EAAE,OAAO,GAAG,UAAU,CAAC,YACxC,CAAC;AAEhE,eAAO,MAAM,2BAA2B,
|
1
|
+
{"version":3,"file":"entity.util.d.ts","sourceRoot":"","sources":["../../src/entity.util.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK/E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,wBAAwB,wBAAyB,KAAK,aAAa,EAAE,OAAO,GAAG,UAAU,CAAC,YACxC,CAAC;AAEhE,eAAO,MAAM,2BAA2B,8DAA4C,CAAC;AAErF,eAAO,MAAM,+BAA+B;cACS,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;EAGrF,CAAC;AAEF,eAAO,MAAM,gCAAgC;eACA,QAAQ,EAAE;EAGtD,CAAC;AAEF,eAAO,MAAM,8BAA8B;aACF,MAAM,EAAE;EAGhD,CAAC;AAEF,eAAO,MAAM,mBAAmB;cAjBqB,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;;eAMzC,QAAQ,EAAE;;aAMd,MAAM,EAAE;EAUhD,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;gBACoD,MAAM,GAAG,IAAI;EAGpG,CAAC"}
|
package/build/esm/entity.util.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { CUSTOM_SLOT_TYPE } from '@voiceflow/common';
|
2
|
-
import {
|
2
|
+
import { EntityDTO } from '@voiceflow/dtos';
|
3
3
|
import { composeValidators, validatorFactory, validatorZodFactory } from './validator/validator.util.js';
|
4
4
|
export const isDefaultEntityName = (name) => !name || name.toLowerCase().startsWith('entity');
|
5
5
|
export const isEntityVariantLikeEmpty = ({ value, synonyms }) => !value.trim() && synonyms.every((synonym) => !synonym.trim());
|
6
|
-
export const entityNameSpellingValidator = validatorZodFactory(
|
6
|
+
export const entityNameSpellingValidator = validatorZodFactory(EntityDTO.shape.name);
|
7
7
|
export const entityNameUniqEntitiesValidator = validatorFactory((name, { entities, entityID }) => entities.every((entity) => entity.id === entityID || entity.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `The '${name}' entity already exists.`);
|
8
8
|
export const entityNameUniqVariablesValidator = validatorFactory((name, { variables }) => variables.every((variable) => variable.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have a variable defined with the '${name}' name already. Entity/Variable/Intent name must be unique.`);
|
9
9
|
export const entityNameUniqIntentsValidator = validatorFactory((name, { intents }) => intents.every((intent) => intent.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have an intent defined with the '${name}' name already. Entity/Intent/Variable name must be unique.`);
|
@@ -1,2 +1,34 @@
|
|
1
|
+
import type { Entity, Intent, Variable } from '@voiceflow/dtos';
|
1
2
|
export declare const isDefaultIntentName: (name?: string | null) => boolean;
|
3
|
+
export declare const intentNameSpellingValidator: (value: string) => import("./main.js").IValidatorResult<string>;
|
4
|
+
export declare const intentNameUniqIntentsValidator: import("./main.js").IValidatorWithContext<string, {
|
5
|
+
intents: Intent[];
|
6
|
+
intentID: string | null;
|
7
|
+
}>;
|
8
|
+
export declare const intentNameUniqEntitiesValidator: import("./main.js").IValidatorWithContext<string, {
|
9
|
+
entities: Entity[];
|
10
|
+
}>;
|
11
|
+
export declare const intentNameUniqVariablesValidator: import("./main.js").IValidatorWithContext<string, {
|
12
|
+
variables: Variable[];
|
13
|
+
}>;
|
14
|
+
export declare const intentNameValidator: import("./main.js").IValidatorWithContext<string, {
|
15
|
+
intents: Intent[];
|
16
|
+
intentID: string | null;
|
17
|
+
} & {
|
18
|
+
entities: Entity[];
|
19
|
+
} & {
|
20
|
+
variables: Variable[];
|
21
|
+
}>;
|
22
|
+
export declare const intentUtterancesValidator: import("./main.js").IValidatorWithContext<Pick<{
|
23
|
+
id: string;
|
24
|
+
createdAt: string;
|
25
|
+
updatedAt: string;
|
26
|
+
assistantID: string;
|
27
|
+
environmentID: string;
|
28
|
+
text: import("@voiceflow/dtos").UtteranceText;
|
29
|
+
language: "en-us";
|
30
|
+
intentID: string;
|
31
|
+
}, "id" | "text">[], {
|
32
|
+
isBuiltInIntent?: boolean | undefined;
|
33
|
+
}>;
|
2
34
|
//# sourceMappingURL=intent.util.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"intent.util.d.ts","sourceRoot":"","sources":["../../src/intent.util.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC"}
|
1
|
+
{"version":3,"file":"intent.util.d.ts","sourceRoot":"","sources":["../../src/intent.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAM3E,eAAO,MAAM,mBAAmB,UAAW,MAAM,GAAG,IAAI,YAAqD,CAAC;AAE9G,eAAO,MAAM,2BAA2B,8DAA4C,CAAC;AAErF,eAAO,MAAM,8BAA8B;aACQ,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;EAGnF,CAAC;AAEF,eAAO,MAAM,+BAA+B;cACD,MAAM,EAAE;EAGlD,CAAC;AAEF,eAAO,MAAM,gCAAgC;eACA,QAAQ,EAAE;EAGtD,CAAC;AAEF,eAAO,MAAM,mBAAmB;aAjBmB,MAAM,EAAE;cAAY,MAAM,GAAG,IAAI;;cAMzC,MAAM,EAAE;;eAMN,QAAQ,EAAE;EAUtD,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;EAIrC,CAAC"}
|
package/build/esm/intent.util.js
CHANGED
@@ -1 +1,10 @@
|
|
1
|
+
import { IntentDTO } from '@voiceflow/dtos';
|
2
|
+
import { isMarkupEmpty } from './markup.util.js';
|
3
|
+
import { composeValidators, validatorFactory, validatorZodFactory } from './validator/validator.util.js';
|
1
4
|
export const isDefaultIntentName = (name) => !name || name.toLowerCase().startsWith('intent');
|
5
|
+
export const intentNameSpellingValidator = validatorZodFactory(IntentDTO.shape.name);
|
6
|
+
export const intentNameUniqIntentsValidator = validatorFactory((name, { intents, intentID }) => intents.every((intent) => intent.id === intentID || intent.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `The '${name}' intent already exists.`);
|
7
|
+
export const intentNameUniqEntitiesValidator = validatorFactory((name, { entities }) => entities.every((entity) => entity.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have an entity defined with the '${name}' name already. Intent/Entity/Variable name must be unique.`);
|
8
|
+
export const intentNameUniqVariablesValidator = validatorFactory((name, { variables }) => variables.every((variable) => variable.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), (name) => `You have a variable defined with the '${name}' name already. Intent/Variable/Entity name must be unique.`);
|
9
|
+
export const intentNameValidator = composeValidators(intentNameSpellingValidator, intentNameUniqIntentsValidator, intentNameUniqEntitiesValidator, intentNameUniqVariablesValidator);
|
10
|
+
export const intentUtterancesValidator = validatorFactory((utterances, { isBuiltInIntent }) => isBuiltInIntent || utterances.some(({ text }) => !isMarkupEmpty(text)), 'Intent requires at least 1 sample phrase.');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@voiceflow/utils-designer",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.4.0",
|
4
4
|
"exports": {
|
5
5
|
".": {
|
6
6
|
"types": "./build/cjs/main.d.ts",
|
@@ -36,18 +36,18 @@
|
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
38
|
"@voiceflow/common": "8.2.2",
|
39
|
-
"@voiceflow/dtos": "1.
|
39
|
+
"@voiceflow/dtos": "1.13.0",
|
40
40
|
"bidirectional-adapter": "1.2.1",
|
41
41
|
"ts-pattern": "^5.0.5",
|
42
42
|
"zod": "3.22.4"
|
43
43
|
},
|
44
44
|
"devDependencies": {
|
45
|
-
"@voiceflow-meta/eslint-config": "2.
|
45
|
+
"@voiceflow-meta/eslint-config": "2.2.0",
|
46
46
|
"@voiceflow-meta/prettier-config": "2.1.0",
|
47
47
|
"@voiceflow-meta/typescript-config": "2.1.0"
|
48
48
|
},
|
49
49
|
"tsd": {
|
50
50
|
"directory": "src"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "a7cfa3c7b261fab7ca7ce99cb5db169e292628ab"
|
53
53
|
}
|