@voiceflow/utils-designer 1.10.0 → 1.12.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.
@@ -0,0 +1,8 @@
1
+ import type { Flow } from '@voiceflow/dtos';
2
+ export declare const flowNameUniqValidator: import("./main").IValidatorWithContext<string, {
3
+ flows: Flow[];
4
+ }>;
5
+ export declare const flowNameValidator: import("./main").IValidatorWithContext<string, {
6
+ flows: Flow[];
7
+ }>;
8
+ //# sourceMappingURL=flow.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.util.d.ts","sourceRoot":"","sources":["../../src/flow.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,eAAO,MAAM,qBAAqB;WACG,IAAI,EAAE;EAG1C,CAAC;AAEF,eAAO,MAAM,iBAAiB;WALO,IAAI,EAAE;EAK8B,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flowNameValidator = exports.flowNameUniqValidator = void 0;
4
+ const validator_util_1 = require("./validator/validator.util");
5
+ exports.flowNameUniqValidator = (0, validator_util_1.validatorFactory)((name, { flows }) => flows.every((flow) => flow.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), () => `flow name already exists.`);
6
+ exports.flowNameValidator = (0, validator_util_1.composeValidators)(exports.flowNameUniqValidator);
@@ -1,4 +1,5 @@
1
1
  export * from './entity.util';
2
+ export * from './flow.util';
2
3
  export * from './intent.util';
3
4
  export * from './markup.util';
4
5
  export * from './request.util';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
package/build/cjs/main.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./entity.util"), exports);
18
+ __exportStar(require("./flow.util"), exports);
18
19
  __exportStar(require("./intent.util"), exports);
19
20
  __exportStar(require("./markup.util"), exports);
20
21
  __exportStar(require("./request.util"), exports);
@@ -26,5 +26,9 @@ export interface VariableDeclaration {
26
26
  datatype?: VariableDatatype;
27
27
  defaultValue: string | null;
28
28
  }
29
- export declare function parseCMSVariableDefaultValue(name: string, { datatype, isSystem, defaultValue }: VariableDeclaration): string | number | boolean | Date | null;
29
+ export declare const parseVariableDefaultValue: (name: string, { datatype, isSystem, defaultValue }: VariableDeclaration) => string | number | boolean | Date | null;
30
+ /**
31
+ * @deprecated use parseVariableDefaultValue instead
32
+ */
33
+ export declare const parseCMSVariableDefaultValue: (name: string, { datatype, isSystem, defaultValue }: VariableDeclaration) => string | number | boolean | Date | null;
30
34
  //# sourceMappingURL=variable.util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable.util.d.ts","sourceRoot":"","sources":["../../src/variable.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAA4B,cAAc,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAI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AC;AAEF,eAAO,MAAM,qBAAqB;eAfuB,QAAQ,EAAE;gBAAc,MAAM,GAAG,IAAI;;cAMnD,MAAM,EAAE;;aAKV,MAAM,EAAE;EAShD,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,SAAU,MAAM,wCAAwC,mBAAmB,4CAmBhH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,SAxBO,MAAM,wCAAwC,mBAAmB,4CAwB5C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseCMSVariableDefaultValue = exports.variableNameValidator = exports.variableNameUniqIntentsValidator = exports.variableNameUniqEntitiesValidator = exports.variableNameUniqVariablesValidator = exports.variableNameSpellingValidator = exports.isSystemVariableName = void 0;
3
+ exports.parseCMSVariableDefaultValue = exports.parseVariableDefaultValue = exports.variableNameValidator = exports.variableNameUniqIntentsValidator = exports.variableNameUniqEntitiesValidator = exports.variableNameUniqVariablesValidator = exports.variableNameSpellingValidator = exports.isSystemVariableName = void 0;
4
4
  const dtos_1 = require("@voiceflow/dtos");
5
5
  const validator_util_1 = require("./validator/validator.util");
6
6
  const isSystemVariableName = (variableName) => Object.values(dtos_1.SystemVariable).includes(variableName);
@@ -10,7 +10,7 @@ exports.variableNameUniqVariablesValidator = (0, validator_util_1.validatorFacto
10
10
  exports.variableNameUniqEntitiesValidator = (0, validator_util_1.validatorFactory)((name, { entities }) => entities.every((entity) => entity.name !== name), () => `Entity name already exists.`);
11
11
  exports.variableNameUniqIntentsValidator = (0, validator_util_1.validatorFactory)((name, { intents }) => intents.every((intent) => intent.name !== name), () => `Intent name already exists.`);
12
12
  exports.variableNameValidator = (0, validator_util_1.composeValidators)(exports.variableNameSpellingValidator, exports.variableNameUniqVariablesValidator, exports.variableNameUniqEntitiesValidator, exports.variableNameUniqIntentsValidator);
13
- function parseCMSVariableDefaultValue(name, { datatype, isSystem, defaultValue }) {
13
+ const parseVariableDefaultValue = (name, { datatype, isSystem, defaultValue }) => {
14
14
  if (!defaultValue)
15
15
  return defaultValue;
16
16
  const type = isSystem && (0, exports.isSystemVariableName)(name) ? dtos_1.SYSTEM_VARIABLE_TYPE_MAP[name] : datatype;
@@ -28,5 +28,9 @@ function parseCMSVariableDefaultValue(name, { datatype, isSystem, defaultValue }
28
28
  default:
29
29
  throw new Error(`Received unexpected variable type '${type}'`);
30
30
  }
31
- }
32
- exports.parseCMSVariableDefaultValue = parseCMSVariableDefaultValue;
31
+ };
32
+ exports.parseVariableDefaultValue = parseVariableDefaultValue;
33
+ /**
34
+ * @deprecated use parseVariableDefaultValue instead
35
+ */
36
+ exports.parseCMSVariableDefaultValue = exports.parseVariableDefaultValue;
@@ -0,0 +1,8 @@
1
+ import type { Flow } from '@voiceflow/dtos';
2
+ export declare const flowNameUniqValidator: import("./main.js").IValidatorWithContext<string, {
3
+ flows: Flow[];
4
+ }>;
5
+ export declare const flowNameValidator: import("./main.js").IValidatorWithContext<string, {
6
+ flows: Flow[];
7
+ }>;
8
+ //# sourceMappingURL=flow.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.util.d.ts","sourceRoot":"","sources":["../../src/flow.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,eAAO,MAAM,qBAAqB;WACG,IAAI,EAAE;EAG1C,CAAC;AAEF,eAAO,MAAM,iBAAiB;WALO,IAAI,EAAE;EAK8B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { composeValidators, validatorFactory } from './validator/validator.util.js';
2
+ export const flowNameUniqValidator = validatorFactory((name, { flows }) => flows.every((flow) => flow.name.toLocaleLowerCase() !== name.toLocaleLowerCase()), () => `flow name already exists.`);
3
+ export const flowNameValidator = composeValidators(flowNameUniqValidator);
@@ -1,4 +1,5 @@
1
1
  export * from './entity.util.js';
2
+ export * from './flow.util.js';
2
3
  export * from './intent.util.js';
3
4
  export * from './markup.util.js';
4
5
  export * from './request.util.js';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
package/build/esm/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './entity.util.js';
2
+ export * from './flow.util.js';
2
3
  export * from './intent.util.js';
3
4
  export * from './markup.util.js';
4
5
  export * from './request.util.js';
@@ -26,5 +26,9 @@ export interface VariableDeclaration {
26
26
  datatype?: VariableDatatype;
27
27
  defaultValue: string | null;
28
28
  }
29
- export declare function parseCMSVariableDefaultValue(name: string, { datatype, isSystem, defaultValue }: VariableDeclaration): string | number | boolean | Date | null;
29
+ export declare const parseVariableDefaultValue: (name: string, { datatype, isSystem, defaultValue }: VariableDeclaration) => string | number | boolean | Date | null;
30
+ /**
31
+ * @deprecated use parseVariableDefaultValue instead
32
+ */
33
+ export declare const parseCMSVariableDefaultValue: (name: string, { datatype, isSystem, defaultValue }: VariableDeclaration) => string | number | boolean | Date | null;
30
34
  //# sourceMappingURL=variable.util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable.util.d.ts","sourceRoot":"","sources":["../../src/variable.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAA4B,cAAc,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAI1G,eAAO,MAAM,oBAAoB,iBAAkB,MAAM,mCACe,CAAC;AAEzE,eAAO,MAAM,6BAA6B,8DAA8C,CAAC;AAEzF,eAAO,MAAM,kCAAkC;eACU,QAAQ,EAAE;gBAAc,MAAM,GAAG,IAAI;EAG7F,CAAC;AAEF,eAAO,MAAM,iCAAiC;cACH,MAAM,EAAE;EAElD,CAAC;AAEF,eAAO,MAAM,gCAAgC;aACJ,MAAM,EAAE;EAEhD,CAAC;AAEF,eAAO,MAAM,qBAAqB;eAfuB,QAAQ,EAAE;gBAAc,MAAM,GAAG,IAAI;;cAMnD,MAAM,EAAE;;aAKV,MAAM,EAAE;EAShD,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,mBAAmB,2CAmBnH"}
1
+ {"version":3,"file":"variable.util.d.ts","sourceRoot":"","sources":["../../src/variable.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAA4B,cAAc,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AAI1G,eAAO,MAAM,oBAAoB,iBAAkB,MAAM,mCACe,CAAC;AAEzE,eAAO,MAAM,6BAA6B,8DAA8C,CAAC;AAEzF,eAAO,MAAM,kCAAkC;eACU,QAAQ,EAAE;gBAAc,MAAM,GAAG,IAAI;EAG7F,CAAC;AAEF,eAAO,MAAM,iCAAiC;cACH,MAAM,EAAE;EAElD,CAAC;AAEF,eAAO,MAAM,gCAAgC;aACJ,MAAM,EAAE;EAEhD,CAAC;AAEF,eAAO,MAAM,qBAAqB;eAfuB,QAAQ,EAAE;gBAAc,MAAM,GAAG,IAAI;;cAMnD,MAAM,EAAE;;aAKV,MAAM,EAAE;EAShD,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,yBAAyB,SAAU,MAAM,wCAAwC,mBAAmB,4CAmBhH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,SAxBO,MAAM,wCAAwC,mBAAmB,4CAwB5C,CAAC"}
@@ -6,7 +6,7 @@ export const variableNameUniqVariablesValidator = validatorFactory((name, { vari
6
6
  export const variableNameUniqEntitiesValidator = validatorFactory((name, { entities }) => entities.every((entity) => entity.name !== name), () => `Entity name already exists.`);
7
7
  export const variableNameUniqIntentsValidator = validatorFactory((name, { intents }) => intents.every((intent) => intent.name !== name), () => `Intent name already exists.`);
8
8
  export const variableNameValidator = composeValidators(variableNameSpellingValidator, variableNameUniqVariablesValidator, variableNameUniqEntitiesValidator, variableNameUniqIntentsValidator);
9
- export function parseCMSVariableDefaultValue(name, { datatype, isSystem, defaultValue }) {
9
+ export const parseVariableDefaultValue = (name, { datatype, isSystem, defaultValue }) => {
10
10
  if (!defaultValue)
11
11
  return defaultValue;
12
12
  const type = isSystem && isSystemVariableName(name) ? SYSTEM_VARIABLE_TYPE_MAP[name] : datatype;
@@ -24,4 +24,8 @@ export function parseCMSVariableDefaultValue(name, { datatype, isSystem, default
24
24
  default:
25
25
  throw new Error(`Received unexpected variable type '${type}'`);
26
26
  }
27
- }
27
+ };
28
+ /**
29
+ * @deprecated use parseVariableDefaultValue instead
30
+ */
31
+ export const parseCMSVariableDefaultValue = parseVariableDefaultValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voiceflow/utils-designer",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./build/cjs/main.d.ts",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@voiceflow/common": "8.2.7",
39
- "@voiceflow/dtos": "1.34.0",
39
+ "@voiceflow/dtos": "1.35.0",
40
40
  "bidirectional-adapter": "1.2.1",
41
41
  "ts-pattern": "^5.0.5",
42
42
  "zod": "3.22.4"
@@ -55,5 +55,5 @@
55
55
  "tsd": {
56
56
  "directory": "src"
57
57
  },
58
- "gitHead": "de95c1b01b454c4f5f249aec37a3918701942342"
58
+ "gitHead": "50ce43dd4d17316a3bb3e15760296162062906a2"
59
59
  }