@voiceflow/common 7.6.4 → 7.7.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/utils/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * as normalized from './normalized';
|
|
|
9
9
|
export * as number from './number';
|
|
10
10
|
export * as object from './object';
|
|
11
11
|
export * as promise from './promise';
|
|
12
|
+
export * as protocol from './protocol';
|
|
12
13
|
export * as string from './string';
|
|
13
14
|
export * as time from './time';
|
|
14
15
|
export * as timezones from './timezones';
|
package/build/utils/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.variables = exports.timezones = exports.time = exports.string = exports.promise = exports.object = exports.number = exports.normalized = exports.mathjs = exports.intent = exports.id = exports.generate = exports.functional = exports.emails = exports.array = void 0;
|
|
25
|
+
exports.variables = exports.timezones = exports.time = exports.string = exports.protocol = exports.promise = exports.object = exports.number = exports.normalized = exports.mathjs = exports.intent = exports.id = exports.generate = exports.functional = exports.emails = exports.array = void 0;
|
|
26
26
|
exports.array = __importStar(require("./array"));
|
|
27
27
|
exports.emails = __importStar(require("./emails"));
|
|
28
28
|
exports.functional = __importStar(require("./functional"));
|
|
@@ -34,6 +34,7 @@ exports.normalized = __importStar(require("./normalized"));
|
|
|
34
34
|
exports.number = __importStar(require("./number"));
|
|
35
35
|
exports.object = __importStar(require("./object"));
|
|
36
36
|
exports.promise = __importStar(require("./promise"));
|
|
37
|
+
exports.protocol = __importStar(require("./protocol"));
|
|
37
38
|
exports.string = __importStar(require("./string"));
|
|
38
39
|
exports.time = __importStar(require("./time"));
|
|
39
40
|
exports.timezones = __importStar(require("./timezones"));
|
package/build/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiC;AACjC,mDAAmC;AACnC,2DAA2C;AAC3C,uDAAuC;AACvC,2CAA2B;AAC3B,mDAAmC;AACnC,mDAAmC;AACnC,2DAA2C;AAC3C,mDAAmC;AACnC,mDAAmC;AACnC,qDAAqC;AACrC,mDAAmC;AACnC,+CAA+B;AAC/B,yDAAyC;AACzC,yDAAyC;AAEzC,uEAAuE;AACvE,6CAA2B;AAC3B,2CAAyB;AACzB,8CAA4B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAiC;AACjC,mDAAmC;AACnC,2DAA2C;AAC3C,uDAAuC;AACvC,2CAA2B;AAC3B,mDAAmC;AACnC,mDAAmC;AACnC,2DAA2C;AAC3C,mDAAmC;AACnC,mDAAmC;AACnC,qDAAqC;AACrC,uDAAuC;AACvC,mDAAmC;AACnC,+CAA+B;AAC/B,yDAAyC;AACzC,yDAAyC;AAEzC,uEAAuE;AACvE,6CAA2B;AAC3B,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const createAction: import("typescript-fsa").ActionCreatorFactory;
|
|
2
|
+
export declare const typeFactory: (...parts: string[]) => (name: string) => string;
|
|
3
|
+
export declare class Channel<K extends string> {
|
|
4
|
+
variables: K[];
|
|
5
|
+
build: (params: Record<K, string>) => string;
|
|
6
|
+
constructor(variables: K[], build: (params: Record<K, string>) => string);
|
|
7
|
+
buildMatcher(): string;
|
|
8
|
+
extend<L extends string>(variables: L[], build: (params: Record<L, string>) => string): Channel<K | L>;
|
|
9
|
+
}
|
|
10
|
+
export declare type ChannelParams<T extends Channel<string>> = T extends Channel<infer R> ? Record<R, string> : never;
|
|
11
|
+
export declare const createChannel: <K extends string>(variables: K[], build: (params: Record<K, string>) => string) => Channel<K>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createChannel = exports.Channel = exports.typeFactory = exports.createAction = void 0;
|
|
7
|
+
const typescript_fsa_1 = __importDefault(require("typescript-fsa"));
|
|
8
|
+
exports.createAction = typescript_fsa_1.default();
|
|
9
|
+
const typeFactory = (...parts) => (name) => [...parts, name].join('.');
|
|
10
|
+
exports.typeFactory = typeFactory;
|
|
11
|
+
class Channel {
|
|
12
|
+
constructor(variables, build) {
|
|
13
|
+
this.variables = variables;
|
|
14
|
+
this.build = build;
|
|
15
|
+
}
|
|
16
|
+
buildMatcher() {
|
|
17
|
+
return this.build(this.variables.reduce((acc, key) => Object.assign(acc, { [key]: `:${key}` }), {}));
|
|
18
|
+
}
|
|
19
|
+
extend(variables, build) {
|
|
20
|
+
return new Channel([...this.variables, ...variables], (params) => `${this.build(params)}/${build(params)}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.Channel = Channel;
|
|
24
|
+
const createChannel = (variables, build) => new Channel(variables, build);
|
|
25
|
+
exports.createChannel = createChannel;
|
|
26
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/utils/protocol.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAkD;AAErC,QAAA,YAAY,GAAG,wBAAoB,EAAE,CAAC;AAE5C,MAAM,WAAW,GACtB,CAAC,GAAG,KAAe,EAAE,EAAE,CACvB,CAAC,IAAY,EAAU,EAAE,CACvB,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAHlB,QAAA,WAAW,eAGO;AAE/B,MAAa,OAAO;IAClB,YAAmB,SAAc,EAAS,KAA4C;QAAnE,cAAS,GAAT,SAAS,CAAK;QAAS,UAAK,GAAL,KAAK,CAAuC;IAAG,CAAC;IAE1F,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,EAAE,EAAuB,CAAC,CAAC,CAAC;IAC5H,CAAC;IAED,MAAM,CAAmB,SAAc,EAAE,KAA4C;QACnF,OAAO,IAAI,OAAO,CAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrH,CAAC;CACF;AAVD,0BAUC;AAIM,MAAM,aAAa,GAAG,CAAmB,SAAc,EAAE,KAA4C,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAAlI,QAAA,aAAa,iBAAqH"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/common",
|
|
3
3
|
"description": "Junk drawer of utility functions",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"author": "Voiceflow",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/voiceflow/common/issues"
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"cuid": "^2.1.8",
|
|
19
19
|
"dayjs": "^1.10.7",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
|
-
"number-to-words": "^1.2.4"
|
|
21
|
+
"number-to-words": "^1.2.4",
|
|
22
|
+
"typescript-fsa": "3.0.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@commitlint/cli": "^12.1.4",
|