@voiceflow/common
Advanced tools
Comparing version 7.27.3 to 7.28.0
@@ -11,1 +11,2 @@ export var Environment; | ||
})(Environment || (Environment = {})); | ||
//# sourceMappingURL=environment.js.map |
@@ -1,5 +0,6 @@ | ||
export * from './environment'; | ||
export * from './intent'; | ||
export * from './regexp'; | ||
export * from './runtime'; | ||
export * from './slot'; | ||
export * from "./environment.js"; | ||
export * from "./intent.js"; | ||
export * from "./regexp.js"; | ||
export * from "./runtime.js"; | ||
export * from "./slot.js"; | ||
//# sourceMappingURL=index.js.map |
export {}; | ||
//# sourceMappingURL=intent.js.map |
@@ -17,1 +17,2 @@ export const SPACE_REGEXP = / /g; | ||
export const VALID_SAMPLE_UTTERANCE = `[^${VALID_SAMPLE_CHARACTERS}|]`; | ||
//# sourceMappingURL=regexp.js.map |
export const VF_DM_PREFIX = 'dm_'; | ||
//# sourceMappingURL=runtime.js.map |
@@ -7,1 +7,2 @@ export const CUSTOM_SLOT_TYPE = 'Custom'; | ||
}; | ||
//# sourceMappingURL=slot.js.map |
@@ -18,1 +18,2 @@ import CryptoBase64 from 'crypto-js/enc-base64'; | ||
export default Base64; | ||
//# sourceMappingURL=base64.js.map |
@@ -28,1 +28,2 @@ const mapping = { | ||
export const hex2abc = (hex) => Array.prototype.map.call(hex.toLowerCase(), (char) => mapping[char]).join(''); | ||
//# sourceMappingURL=hex2abc.js.map |
@@ -1,3 +0,4 @@ | ||
export { default as Base64 } from './base64'; | ||
export { default as MurmurHash } from './murmurhash'; | ||
export { default as Synchronous } from './synchronous'; | ||
export { default as Base64 } from "./base64.js"; | ||
export { default as MurmurHash } from "./murmurhash.js"; | ||
export { default as Synchronous } from "./synchronous.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { hex2abc } from "./hex2abc"; | ||
import { hex2abc } from "./hex2abc.js"; | ||
import { MurmurHash3 } from 'murmurhash-wasm'; | ||
@@ -12,1 +12,2 @@ export class MurmurHash { | ||
export default MurmurHash; | ||
//# sourceMappingURL=murmurhash.js.map |
@@ -39,1 +39,2 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
export default Synchronous; | ||
//# sourceMappingURL=synchronous.js.map |
@@ -1,6 +0,7 @@ | ||
export * from './constants'; | ||
export * as Crypto from './crypto'; | ||
export * from './types'; | ||
export * as Utils from './utils'; | ||
export * from "./constants.js"; | ||
export * as Crypto from "./crypto.js"; | ||
export * from "./types.js"; | ||
export * as Utils from "./utils.js"; | ||
// TODO: Remove this export once we migrate all utils in other repos. | ||
export * from './utils'; | ||
export * from "./utils.js"; | ||
//# sourceMappingURL=index.js.map |
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -1,2 +0,2 @@ | ||
import { AnyRecord, ArrayUnionToIntersection, PrimitiveMap } from "../types"; | ||
import { AnyRecord, ArrayUnionToIntersection, PrimitiveMap } from '@common/types'; | ||
export declare const unique: <T>(items: T[]) => T[]; | ||
@@ -38,3 +38,3 @@ export declare const without: <T>(items: T[], index: number) => T[]; | ||
export declare const filterAndGetLastRemovedValue: <T>(list: T[], filter: (item: T) => boolean) => [T[], T | null]; | ||
export declare const inferUnion: <T extends ArrayLike<unknown>>(array: T) => import("../types").SafeArray<T[number], T>; | ||
export declare const inferUnion: <T extends ArrayLike<unknown>>(array: T) => import("@common/types").SafeArray<T[number], T>; | ||
export declare const toArray: <T>(valueOrArray: T | T[]) => T[]; | ||
@@ -41,0 +41,0 @@ /** |
@@ -138,1 +138,2 @@ export const unique = (items) => Array.from(new Set(items)); | ||
}; | ||
//# sourceMappingURL=array.js.map |
const FORMAT = /^[\w!#$%&'*+./=?^`{|}~-]+@[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?(?:\.[\dA-Za-z](?:[\dA-Za-z-]{0,61}[\dA-Za-z])?)*$/; | ||
export const isValidEmail = (email) => email.length < 320 && FORMAT.test(email); | ||
export const getEmailDomain = (email) => email.slice(Math.max(0, email.lastIndexOf('@') + 1)); | ||
//# sourceMappingURL=emails.js.map |
@@ -52,1 +52,2 @@ export const isFunction = (value) => typeof value === 'function'; | ||
}; | ||
//# sourceMappingURL=functional.js.map |
@@ -1,2 +0,2 @@ | ||
import { cuid } from './id'; | ||
import { cuid } from "./id.js"; | ||
const CHARACTERS = Array.from({ length: 26 }).map((_, index) => String.fromCharCode(97 + index)); | ||
@@ -31,1 +31,2 @@ export const generateHash = (object) => { | ||
}; | ||
//# sourceMappingURL=generate.js.map |
import ObjectId from 'bson-objectid'; | ||
import cuid from 'cuid'; | ||
import { deepMap, deepMapKeys } from './object'; | ||
import { deepMap, deepMapKeys } from "./object.js"; | ||
export { cuid }; | ||
@@ -16,1 +16,2 @@ export const objectID = () => new ObjectId().toHexString(); | ||
}; | ||
//# sourceMappingURL=id.js.map |
@@ -1,22 +0,23 @@ | ||
export * as array from './array'; | ||
export * as emails from './emails'; | ||
export * as functional from './functional'; | ||
export { generate, generateHash } from './generate'; | ||
export * as id from './id'; | ||
export * as intent from './intent'; | ||
export * as map from './map'; | ||
export * as mathjs from './mathjs'; | ||
export * as normalized from './normalized'; | ||
export * as number from './number'; | ||
export * as object from './object'; | ||
export * as promise from './promise'; | ||
export * as protocol from './protocol'; | ||
export * as slot from './slot'; | ||
export * as string from './string'; | ||
export * as time from './time'; | ||
export * as timezones from './timezones'; | ||
export * as typeguard from './typeguard'; | ||
export * as variables from './variables'; | ||
export * as array from "./array.js"; | ||
export * as emails from "./emails.js"; | ||
export * as functional from "./functional.js"; | ||
export { generate, generateHash } from "./generate.js"; | ||
export * as id from "./id.js"; | ||
export * as intent from "./intent.js"; | ||
export * as map from "./map.js"; | ||
export * as mathjs from "./mathjs.js"; | ||
export * as normalized from "./normalized.js"; | ||
export * as number from "./number.js"; | ||
export * as object from "./object.js"; | ||
export * as promise from "./promise.js"; | ||
export * as protocol from "./protocol.js"; | ||
export * as slot from "./slot.js"; | ||
export * as string from "./string.js"; | ||
export * as time from "./time.js"; | ||
export * as timezones from "./timezones.js"; | ||
export * as typeguard from "./typeguard.js"; | ||
export * as variables from "./variables.js"; | ||
// TODO: Remove these exports once we migrate all utils in other repos. | ||
export * from './intent'; | ||
export * from './variables'; | ||
export * from "./intent.js"; | ||
export * from "./variables.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { BuiltinSlot } from "../constants"; | ||
import { BuiltinSlot } from '@common/constants'; | ||
export declare const formatIntentName: (name: string) => string; | ||
@@ -7,6 +7,6 @@ export declare const getUtterancesWithSlotNames: ({ slots, utterances, }: { | ||
name: string; | ||
}[] | undefined; | ||
}[]; | ||
utterances?: { | ||
text: string; | ||
}[] | undefined; | ||
}[]; | ||
}) => string[]; | ||
@@ -13,0 +13,0 @@ export declare const getSlotType: (slots: BuiltinSlot<string, string>[], slot: { |
@@ -1,4 +0,4 @@ | ||
import { LOWER_CASE_CUSTOM_SLOT_TYPE, SLOT_REGEXP, SPACE_REGEXP } from "../constants"; | ||
import { LOWER_CASE_CUSTOM_SLOT_TYPE, SLOT_REGEXP, SPACE_REGEXP } from "../constants.js"; | ||
import _sample from 'lodash/sample'; | ||
import { getAllSamples } from './slot'; | ||
import { getAllSamples } from "./slot.js"; | ||
export const formatIntentName = (name) => { | ||
@@ -140,1 +140,2 @@ if (!name) { | ||
export const cleanVFIntentName = (intentName) => (intentName.startsWith('VF.') ? intentName.slice(3).toLowerCase() : intentName); | ||
//# sourceMappingURL=intent.js.map |
@@ -1,2 +0,2 @@ | ||
import { isFunction } from './functional'; | ||
import { isFunction } from "./functional.js"; | ||
/** | ||
@@ -14,1 +14,2 @@ * Retrieve the value at the given key inside the map. | ||
} | ||
//# sourceMappingURL=map.js.map |
@@ -59,1 +59,2 @@ const getRegex = (variable) => new RegExp(variable, 'gi'); | ||
}; | ||
//# sourceMappingURL=mathjs.js.map |
@@ -1,2 +0,2 @@ | ||
import { Normalized } from "../types"; | ||
import { Normalized } from '@common/types'; | ||
export interface ObjectWithId { | ||
@@ -3,0 +3,0 @@ id: number | string; |
@@ -12,5 +12,5 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
import { withoutValue } from './array'; | ||
import { stringify } from './functional'; | ||
import { hasProperty } from './object'; | ||
import { withoutValue } from "./array.js"; | ||
import { stringify } from "./functional.js"; | ||
import { hasProperty } from "./object.js"; | ||
export const createEmptyNormalized = () => ({ byKey: {}, allKeys: [] }); | ||
@@ -72,1 +72,2 @@ export const EMPTY = createEmptyNormalized(); | ||
}; | ||
//# sourceMappingURL=normalized.js.map |
@@ -6,1 +6,2 @@ import numberToWords from 'number-to-words/src'; | ||
export const clamp = (value, min, max) => Math.max(Math.min(value, max), min); | ||
//# sourceMappingURL=number.js.map |
@@ -1,2 +0,2 @@ | ||
import { AnyRecord, Struct } from "../../types"; | ||
import { AnyRecord, Struct } from '@common/types'; | ||
export { default as shallowEquals } from 'shallowequal'; | ||
@@ -3,0 +3,0 @@ export declare const selectField: <K extends string | number>(field: K) => <T extends { [key in K]: any; }>(obj: T) => T[K]; |
@@ -57,1 +57,2 @@ export { default as shallowEquals } from 'shallowequal'; | ||
export const shallowPartialEquals = (obj, partial) => Object.entries(partial).every(([key, partialValue]) => hasProperty(obj, key) && partialValue === obj[key]); | ||
//# sourceMappingURL=common.js.map |
@@ -1,2 +0,2 @@ | ||
import { Struct } from "../../types"; | ||
import { Struct } from '@common/types'; | ||
export declare const deepMap: <T = Struct>(object: unknown, mapFunction: (value: unknown, key: string | number) => unknown, options?: { | ||
@@ -3,0 +3,0 @@ inPlace?: boolean; |
@@ -1,2 +0,2 @@ | ||
import { isObject } from './common'; | ||
import { isObject } from "./common.js"; | ||
export const deepMap = (object, mapFunction, options = {}) => { | ||
@@ -72,1 +72,2 @@ const cache = new WeakMap(); | ||
}; | ||
//# sourceMappingURL=deepMap.js.map |
@@ -1,3 +0,3 @@ | ||
import { AnyRecord, DeepPartial } from "../../types"; | ||
import { AnyRecord, DeepPartial } from '@common/types'; | ||
export declare const getDiff: <S extends AnyRecord>(object: S, base: S, compare?: <T>(left: T, right: T) => boolean) => DeepPartial<S>; | ||
export declare const getTopLevelDiff: <S extends AnyRecord>(object: S, base: S, compare?: <T>(left: T, right: T) => boolean) => Partial<S>; |
import _transform from 'lodash/transform'; | ||
import { isObject } from './common'; | ||
import { isObject } from "./common.js"; | ||
const defaultCompare = (left, right) => left === right; | ||
@@ -33,1 +33,2 @@ export const getDiff = (object, base, compare = defaultCompare) => { | ||
}; | ||
//# sourceMappingURL=diff.js.map |
@@ -1,4 +0,5 @@ | ||
export * from './common'; | ||
export * from './deepMap'; | ||
export * from './diff'; | ||
export * from './keys'; | ||
export * from "./common.js"; | ||
export * from "./deepMap.js"; | ||
export * from "./diff.js"; | ||
export * from "./keys.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,4 @@ | ||
import { AnyRecord } from "../../types"; | ||
import { AnyRecord } from '@common/types'; | ||
export declare const getKeys: <T>(obj: T) => (keyof T)[]; | ||
export declare const getIn: <T, K extends string | keyof T>(rawObj: T, key: K | K[], def?: any, index?: number) => rawObj is T & Record<K, unknown>; | ||
export declare const setIn: (obj: AnyRecord, path: unknown, value: unknown) => any; |
@@ -53,1 +53,2 @@ import _cloneDeep from 'lodash/cloneDeep'; | ||
}; | ||
//# sourceMappingURL=keys.js.map |
@@ -20,1 +20,2 @@ export const delay = (timeout, value = true) => new Promise((resolve) => { | ||
}; | ||
//# sourceMappingURL=promise.js.map |
@@ -7,3 +7,3 @@ import { AsyncActionCreators, Meta } from 'typescript-fsa'; | ||
export declare const createAction: import("typescript-fsa").ActionCreatorFactory; | ||
export declare const createAsyncAction: <P, R, E extends AsyncError<number> = AsyncError<never>>(type: string, commonMeta?: Meta | undefined) => AsyncActionCreators<P, R, E>; | ||
export declare const createAsyncAction: <P, R, E extends AsyncError<number> = AsyncError<never>>(type: string, commonMeta?: Meta) => AsyncActionCreators<P, R, E>; | ||
export declare const typeFactory: (...parts: string[]) => (name: string) => string; | ||
@@ -10,0 +10,0 @@ export declare class Channel<K extends string> { |
@@ -18,1 +18,2 @@ import actionCreatorFactory from 'typescript-fsa'; | ||
export const createChannel = (variables, build) => new Channel(variables, build); | ||
//# sourceMappingURL=protocol.js.map |
import _uniqBy from 'lodash/uniqBy'; | ||
import { SLOT_REGEXP } from '../constants'; | ||
import { SLOT_REGEXP } from "../constants.js"; | ||
export const addPrebuiltEntities = (entities, prebuiltEntities) => entities.map((entity) => { | ||
@@ -34,1 +34,2 @@ if (prebuiltEntities[entity.key]) { | ||
}; | ||
//# sourceMappingURL=slot.js.map |
@@ -6,2 +6,2 @@ export declare const capitalizeFirstLetter: (value: string) => string; | ||
export declare const removeTrailingUnderscores: (str: string) => string; | ||
export declare const conditionalReplace: (base: string, pattern: RegExp, value?: string | undefined) => string; | ||
export declare const conditionalReplace: (base: string, pattern: RegExp, value?: string) => string; |
@@ -11,1 +11,2 @@ const TAGS_REGEXP = /(<([^>]+)>)/gi; | ||
}; | ||
//# sourceMappingURL=string.js.map |
@@ -67,1 +67,2 @@ import dayjs from 'dayjs'; | ||
.join(''); | ||
//# sourceMappingURL=time.js.map |
@@ -2030,1 +2030,2 @@ const timezoneGroups = [ | ||
export const TIMEZONES = getTimezones(); | ||
//# sourceMappingURL=timezones.js.map |
export const createTypeguardCreator = () => (values) => (value) => !!value && (Array.isArray(values) ? values.includes(value) : values === value); | ||
export const createTypedTypeguardCreator = () => (values) => (value) => Array.isArray(values) ? values.includes(value.type) : value.type === values; | ||
//# sourceMappingURL=typeguard.js.map |
export declare const variableReplacer: (match: string, inner: string, variables: Record<string, unknown>, modifier?: ((variable: unknown) => unknown) | undefined) => unknown; | ||
export declare const replaceVariables: (phrase: string | undefined | null, variables: Record<string, unknown>, modifier?: ((variable: unknown) => unknown) | undefined, { trim }?: { | ||
trim?: boolean | undefined; | ||
trim?: boolean; | ||
}) => string; | ||
@@ -5,0 +5,0 @@ export declare const sanitizeVariables: (variables: Record<string, unknown>) => Record<string, unknown>; |
@@ -1,2 +0,2 @@ | ||
import { READABLE_VARIABLE_REGEXP } from "../constants"; | ||
import { READABLE_VARIABLE_REGEXP } from "../constants.js"; | ||
export const variableReplacer = (match, inner, variables, modifier) => { | ||
@@ -57,1 +57,2 @@ if (inner in variables) { | ||
}; | ||
//# sourceMappingURL=variables.js.map |
{ | ||
"name": "@voiceflow/common", | ||
"description": "Junk drawer of utility functions", | ||
"version": "7.27.3", | ||
"version": "7.28.0", | ||
"author": "Voiceflow", | ||
@@ -23,27 +23,7 @@ "bugs": { | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@types/chai": "^4.2.19", | ||
"@types/chai-as-promised": "^7.1.4", | ||
"@types/lodash": "^4.14.176", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^15.3.1", | ||
"@types/number-to-words": "1.2.0", | ||
"@types/sinon": "^10.0.0", | ||
"@zerollup/ts-transform-paths": "^1.7.18", | ||
"chai": "^4.3.4", | ||
"chai-as-promised": "^7.1.1", | ||
"depcheck": "^1.4.1", | ||
"lint-staged": "^11.0.0", | ||
"mocha": "9.1.3", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^10.0.0", | ||
"ts-mocha": "^8.0.0", | ||
"ts-node": "10.5.0", | ||
"tsconfig-paths": "3.12.0", | ||
"ttypescript": "1.5.13", | ||
"typescript": "4.4.4" | ||
"@types/number-to-words": "1.2.0" | ||
}, | ||
"files": [ | ||
"build/" | ||
"build" | ||
], | ||
@@ -55,6 +35,7 @@ "homepage": "https://github.com/voiceflow/libs#readme", | ||
"license": "ISC", | ||
"main": "build/common/index.js", | ||
"main": "build/cjs/index.js", | ||
"module": "build/esm/index.js", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"types": "build/cjs/index.d.ts" | ||
}, | ||
@@ -67,10 +48,10 @@ "repository": { | ||
"build": "yarn clean && yarn build:cjs && yarn build:esm", | ||
"build:cjs": "ttsc --project ./tsconfig.build.json", | ||
"build:esm": "ttsc --project ./tsconfig.build.json --module esnext --outDir ./build/esm", | ||
"build:cjs": "ttsc --build tsconfig.build.json", | ||
"build:esm": "ttsc --build tsconfig.esm.json", | ||
"clean": "rimraf build", | ||
"commit": "cz", | ||
"lint": "eslint \"{src,tests}/**/*.{js,ts}\"", | ||
"lint": "eslint '**/*.{js,ts}'", | ||
"lint:fix": "yarn lint --fix", | ||
"lint:quiet": "yarn lint --quiet", | ||
"lint:report": "eslint-output --quiet \"{src,tests}/**/*.{js,ts}\"", | ||
"lint:report": "eslint-output --quiet '**/*.{js,ts}'", | ||
"tdd": "yarn test --watch", | ||
@@ -84,3 +65,4 @@ "test": "yarn test:run", | ||
}, | ||
"gitHead": "aaef6e55ca6d58d392b421df752be011840163c0" | ||
"types": "src/index.ts", | ||
"gitHead": "8e3de656f6f784c2090f15c61f7eb97d3558c572" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
490876
2
226
7536
1