@botpress/cli 0.4.15 → 0.4.16
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/dist/integration-ref.js +1 -2
- package/dist/integration-ref.js.map +2 -2
- package/dist/integration-ref.test.js +14 -2
- package/dist/integration-ref.test.js.map +2 -2
- package/dist/utils/id-utils.js +55 -0
- package/dist/utils/id-utils.js.map +7 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +2 -2
- package/package.json +2 -1
package/dist/integration-ref.js
CHANGED
|
@@ -29,7 +29,6 @@ __export(integration_ref_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(integration_ref_exports);
|
|
31
31
|
var import_semver = __toESM(require("semver"));
|
|
32
|
-
var uuid = __toESM(require("uuid"));
|
|
33
32
|
var utils = __toESM(require("./utils"));
|
|
34
33
|
const LATEST_TAG = "latest";
|
|
35
34
|
const formatIntegrationRef = (ref) => {
|
|
@@ -45,7 +44,7 @@ const parseIntegrationRef = (ref) => {
|
|
|
45
44
|
if (!ref) {
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
if (
|
|
47
|
+
if (utils.id.isValidID(ref)) {
|
|
49
48
|
return { type: "id", id: ref };
|
|
50
49
|
}
|
|
51
50
|
if (utils.path.isAbsolute(ref)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/integration-ref.ts"],
|
|
4
|
-
"sourcesContent": ["import semver from 'semver'\nimport * as
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,
|
|
4
|
+
"sourcesContent": ["import semver from 'semver'\nimport * as utils from './utils'\n\nexport type UUIDIntegrationRef = {\n type: 'id'\n id: string\n}\n\nexport type NameIntegrationRef = {\n type: 'name'\n name: string\n version: string\n}\n\nexport type LocalPathIntegrationRef = {\n type: 'path'\n path: utils.path.AbsolutePath\n}\n\nexport type ApiIntegrationRef = UUIDIntegrationRef | NameIntegrationRef\nexport type IntegrationRef = ApiIntegrationRef | LocalPathIntegrationRef\n\nconst LATEST_TAG = 'latest'\n\nexport const formatIntegrationRef = (ref: IntegrationRef): string => {\n if (ref.type === 'path') {\n return ref.path\n }\n if (ref.type === 'id') {\n return ref.id\n }\n return `${ref.name}@${ref.version}`\n}\n\nexport const parseIntegrationRef = (ref: string): IntegrationRef | undefined => {\n if (!ref) {\n return\n }\n\n if (utils.id.isValidID(ref)) {\n return { type: 'id', id: ref }\n }\n\n if (utils.path.isAbsolute(ref)) {\n return { type: 'path', path: ref }\n }\n\n if (!ref.includes('@')) {\n return { type: 'name', name: ref, version: LATEST_TAG }\n }\n\n const [name, version] = ref.split('@')\n if (!name || !version) {\n return\n }\n\n const cleanedVersion = version === LATEST_TAG ? version : semver.clean(version)\n if (!cleanedVersion) {\n return\n }\n\n return { type: 'name', name, version: cleanedVersion }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,YAAuB;AAqBvB,MAAM,aAAa;AAEZ,MAAM,uBAAuB,CAAC,QAAgC;AACnE,MAAI,IAAI,SAAS,QAAQ;AACvB,WAAO,IAAI;AAAA,EACb;AACA,MAAI,IAAI,SAAS,MAAM;AACrB,WAAO,IAAI;AAAA,EACb;AACA,SAAO,GAAG,IAAI,QAAQ,IAAI;AAC5B;AAEO,MAAM,sBAAsB,CAAC,QAA4C;AAC9E,MAAI,CAAC,KAAK;AACR;AAAA,EACF;AAEA,MAAI,MAAM,GAAG,UAAU,GAAG,GAAG;AAC3B,WAAO,EAAE,MAAM,MAAM,IAAI,IAAI;AAAA,EAC/B;AAEA,MAAI,MAAM,KAAK,WAAW,GAAG,GAAG;AAC9B,WAAO,EAAE,MAAM,QAAQ,MAAM,IAAI;AAAA,EACnC;AAEA,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACtB,WAAO,EAAE,MAAM,QAAQ,MAAM,KAAK,SAAS,WAAW;AAAA,EACxD;AAEA,QAAM,CAAC,MAAM,OAAO,IAAI,IAAI,MAAM,GAAG;AACrC,MAAI,CAAC,QAAQ,CAAC,SAAS;AACrB;AAAA,EACF;AAEA,QAAM,iBAAiB,YAAY,aAAa,UAAU,cAAAA,QAAO,MAAM,OAAO;AAC9E,MAAI,CAAC,gBAAgB;AACnB;AAAA,EACF;AAEA,SAAO,EAAE,MAAM,QAAQ,MAAM,SAAS,eAAe;AACvD;",
|
|
6
6
|
"names": ["semver"]
|
|
7
7
|
}
|
|
@@ -3,6 +3,7 @@ var import_node_test = require("node:test");
|
|
|
3
3
|
var import_vitest = require("vitest");
|
|
4
4
|
var import_integration_ref = require("./integration-ref");
|
|
5
5
|
const path = "/my/path";
|
|
6
|
+
const prefixedUlid = "intver_01HF58RDKE3M7K5RJ5XZ7GF6HE";
|
|
6
7
|
const uuid = "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11";
|
|
7
8
|
const name = "myintegration";
|
|
8
9
|
(0, import_node_test.describe)("parseIntegrationRef", () => {
|
|
@@ -28,7 +29,13 @@ const name = "myintegration";
|
|
|
28
29
|
const expected = { type: "path", path: ref };
|
|
29
30
|
(0, import_vitest.expect)(result).toEqual(expected);
|
|
30
31
|
});
|
|
31
|
-
(0, import_vitest.test)("parse with a
|
|
32
|
+
(0, import_vitest.test)("parse with a prefixed ULID sets `id` type", () => {
|
|
33
|
+
const ref = prefixedUlid;
|
|
34
|
+
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
35
|
+
const expected = { type: "id", id: ref };
|
|
36
|
+
(0, import_vitest.expect)(result).toEqual(expected);
|
|
37
|
+
});
|
|
38
|
+
(0, import_vitest.test)("parse with a legacy UUID sets `id` type", () => {
|
|
32
39
|
const ref = uuid;
|
|
33
40
|
const result = (0, import_integration_ref.parseIntegrationRef)(ref);
|
|
34
41
|
const expected = { type: "id", id: ref };
|
|
@@ -61,7 +68,12 @@ const name = "myintegration";
|
|
|
61
68
|
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
62
69
|
(0, import_vitest.expect)(result).toEqual(ref.path);
|
|
63
70
|
});
|
|
64
|
-
(0, import_vitest.test)("format with a
|
|
71
|
+
(0, import_vitest.test)("format with a prefixed ULID uses `id` type", () => {
|
|
72
|
+
const ref = { type: "id", id: prefixedUlid };
|
|
73
|
+
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
74
|
+
(0, import_vitest.expect)(result).toEqual(ref.id);
|
|
75
|
+
});
|
|
76
|
+
(0, import_vitest.test)("format with a legacy UUID uses `id` type", () => {
|
|
65
77
|
const ref = { type: "id", id: uuid };
|
|
66
78
|
const result = (0, import_integration_ref.formatIntegrationRef)(ref);
|
|
67
79
|
(0, import_vitest.expect)(result).toEqual(ref.id);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/integration-ref.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { describe } from 'node:test'\nimport { test, expect } from 'vitest'\nimport { formatIntegrationRef, IntegrationRef, parseIntegrationRef } from './integration-ref'\n\nconst path = '/my/path'\nconst uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'\nconst name = 'myintegration'\n\ndescribe('parseIntegrationRef', () => {\n test('parse empty string should return undefined', () => {\n // arrange\n const ref = ''\n // act\n const result = parseIntegrationRef(ref)\n // assert\n expect(result).toBeUndefined()\n })\n\n test('parse with invalid version should return undefined', () => {\n // arrange\n const ref0 = `${name}@lol`\n const ref1 = `${name}@1`\n const ref2 = `${name}@1.0`\n // act\n const result0 = parseIntegrationRef(ref0)\n const result1 = parseIntegrationRef(ref1)\n const result2 = parseIntegrationRef(ref2)\n // assert\n expect(result0).toBeUndefined()\n expect(result1).toBeUndefined()\n expect(result2).toBeUndefined()\n })\n\n test('parse with an absolute path should return path', () => {\n // arrange\n const ref = path\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'path', path: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a
|
|
5
|
-
"mappings": ";AAAA,uBAAyB;AACzB,oBAA6B;AAC7B,6BAA0E;AAE1E,MAAM,OAAO;AACb,MAAM,OAAO;AACb,MAAM,OAAO;AAAA,IAEb,2BAAS,uBAAuB,MAAM;AACpC,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,8BAAO,MAAM,EAAE,cAAc;AAAA,EAC/B,CAAC;AAED,0BAAK,sDAAsD,MAAM;AAE/D,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAEhB,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AAExC,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAAA,EAChC,CAAC;AAED,0BAAK,kDAAkD,MAAM;AAE3D,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,UAAM,WAA2B,EAAE,MAAM,QAAQ,MAAM,IAAI;AAC3D,8BAAO,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AAED,0BAAK,
|
|
4
|
+
"sourcesContent": ["import { describe } from 'node:test'\nimport { test, expect } from 'vitest'\nimport { formatIntegrationRef, IntegrationRef, parseIntegrationRef } from './integration-ref'\n\nconst path = '/my/path'\nconst prefixedUlid = 'intver_01HF58RDKE3M7K5RJ5XZ7GF6HE'\nconst uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'\nconst name = 'myintegration'\n\ndescribe('parseIntegrationRef', () => {\n test('parse empty string should return undefined', () => {\n // arrange\n const ref = ''\n // act\n const result = parseIntegrationRef(ref)\n // assert\n expect(result).toBeUndefined()\n })\n\n test('parse with invalid version should return undefined', () => {\n // arrange\n const ref0 = `${name}@lol`\n const ref1 = `${name}@1`\n const ref2 = `${name}@1.0`\n // act\n const result0 = parseIntegrationRef(ref0)\n const result1 = parseIntegrationRef(ref1)\n const result2 = parseIntegrationRef(ref2)\n // assert\n expect(result0).toBeUndefined()\n expect(result1).toBeUndefined()\n expect(result2).toBeUndefined()\n })\n\n test('parse with an absolute path should return path', () => {\n // arrange\n const ref = path\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'path', path: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a prefixed ULID sets `id` type', () => {\n // arrange\n const ref = prefixedUlid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a legacy UUID sets `id` type', () => {\n // arrange\n const ref = uuid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and latest should return name and latest', () => {\n // arrange\n const version = 'latest'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with only a name should return name and latest', () => {\n // arrange\n const ref = name\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version: 'latest' }\n expect(result).toEqual(expected)\n })\n})\n\ndescribe('formatIntegrationRef', () => {\n test('format with a path should return path', () => {\n // arrange\n const ref: IntegrationRef = { type: 'path', path }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.path)\n })\n\n test('format with a prefixed ULID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: prefixedUlid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a legacy UUID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: uuid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref: IntegrationRef = { type: 'name', name, version }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(`${name}@${version}`)\n })\n})\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var id_utils_exports = {};
|
|
26
|
+
__export(id_utils_exports, {
|
|
27
|
+
isPrefixedULID: () => isPrefixedULID,
|
|
28
|
+
isValidID: () => isValidID
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(id_utils_exports);
|
|
31
|
+
var import_const = require("@bpinternal/const");
|
|
32
|
+
var uuid = __toESM(require("uuid"));
|
|
33
|
+
const ULID_LENGTH = 26;
|
|
34
|
+
function isValidID(id) {
|
|
35
|
+
return isPrefixedULID(id) || uuid.validate(id);
|
|
36
|
+
}
|
|
37
|
+
function isPrefixedULID(id) {
|
|
38
|
+
const [prefix, identifier] = id.split("_");
|
|
39
|
+
if (!(prefix && identifier)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (!Object.keys(import_const.prefixToObjectMap).includes(prefix)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (identifier.length < ULID_LENGTH) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
isPrefixedULID,
|
|
53
|
+
isValidID
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=id-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/id-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import { prefixToObjectMap } from '@bpinternal/const'\nimport * as uuid from 'uuid'\n\nconst ULID_LENGTH = 26 // Reference: https://github.com/ulid/spec#canonical-string-representation\n\nexport function isValidID(id: string) {\n // Note: UUIDs were used first and then prefixed ULIDs were introduced.\n return isPrefixedULID(id) || uuid.validate(id)\n}\n\nexport function isPrefixedULID(id: string) {\n const [prefix, identifier] = id.split('_')\n\n if (!(prefix && identifier)) {\n return false\n }\n\n if (!Object.keys(prefixToObjectMap).includes(prefix)) {\n return false\n }\n\n if (identifier.length < ULID_LENGTH) {\n return false\n }\n\n return true\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAClC,WAAsB;AAEtB,MAAM,cAAc;AAEb,SAAS,UAAU,IAAY;AAEpC,SAAO,eAAe,EAAE,KAAK,KAAK,SAAS,EAAE;AAC/C;AAEO,SAAS,eAAe,IAAY;AACzC,QAAM,CAAC,QAAQ,UAAU,IAAI,GAAG,MAAM,GAAG;AAEzC,MAAI,EAAE,UAAU,aAAa;AAC3B,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,OAAO,KAAK,8BAAiB,EAAE,SAAS,MAAM,GAAG;AACpD,WAAO;AAAA,EACT;AAEA,MAAI,WAAW,SAAS,aAAa;AACnC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/utils/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(utils_exports, {
|
|
|
30
30
|
esbuild: () => esbuild,
|
|
31
31
|
filewatcher: () => filewatcher,
|
|
32
32
|
guards: () => guards,
|
|
33
|
+
id: () => id,
|
|
33
34
|
path: () => path,
|
|
34
35
|
pkgJson: () => pkgJson,
|
|
35
36
|
prompt: () => prompt,
|
|
@@ -48,6 +49,7 @@ var emitter = __toESM(require("./event-emitter"));
|
|
|
48
49
|
var esbuild = __toESM(require("./esbuild-utils"));
|
|
49
50
|
var filewatcher = __toESM(require("./file-watcher"));
|
|
50
51
|
var guards = __toESM(require("./guard-utils"));
|
|
52
|
+
var id = __toESM(require("./id-utils"));
|
|
51
53
|
var path = __toESM(require("./path-utils"));
|
|
52
54
|
var pkgJson = __toESM(require("./pkgjson-utils"));
|
|
53
55
|
var prompt = __toESM(require("./prompt-utils"));
|
|
@@ -66,6 +68,7 @@ var url = __toESM(require("./url-utils"));
|
|
|
66
68
|
esbuild,
|
|
67
69
|
filewatcher,
|
|
68
70
|
guards,
|
|
71
|
+
id,
|
|
69
72
|
path,
|
|
70
73
|
pkgJson,
|
|
71
74
|
prompt,
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * as cache from './cache-utils'\nexport * as casing from './case-utils'\nexport * as emitter from './event-emitter'\nexport * as esbuild from './esbuild-utils'\nexport * as filewatcher from './file-watcher'\nexport * as guards from './guard-utils'\nexport * as path from './path-utils'\nexport * as pkgJson from './pkgjson-utils'\nexport * as prompt from './prompt-utils'\nexport * as records from './record-utils'\nexport * as require from './require-utils'\nexport * as schema from './schema-utils'\nexport * as semver from './semver-utils'\nexport * as tunnel from './tunnel-utils'\nexport * as types from './type-utils'\nexport * as url from './url-utils'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,aAAwB;AACxB,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,aAAwB;AACxB,WAAsB;AACtB,cAAyB;AACzB,aAAwB;AACxB,cAAyB;AACzB,IAAAA,WAAyB;AACzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,UAAqB;",
|
|
4
|
+
"sourcesContent": ["export * as cache from './cache-utils'\nexport * as casing from './case-utils'\nexport * as emitter from './event-emitter'\nexport * as esbuild from './esbuild-utils'\nexport * as filewatcher from './file-watcher'\nexport * as guards from './guard-utils'\nexport * as id from './id-utils'\nexport * as path from './path-utils'\nexport * as pkgJson from './pkgjson-utils'\nexport * as prompt from './prompt-utils'\nexport * as records from './record-utils'\nexport * as require from './require-utils'\nexport * as schema from './schema-utils'\nexport * as semver from './semver-utils'\nexport * as tunnel from './tunnel-utils'\nexport * as types from './type-utils'\nexport * as url from './url-utils'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,aAAwB;AACxB,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,aAAwB;AACxB,SAAoB;AACpB,WAAsB;AACtB,cAAyB;AACzB,aAAwB;AACxB,cAAyB;AACzB,IAAAA,WAAyB;AACzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,YAAuB;AACvB,UAAqB;",
|
|
6
6
|
"names": ["require"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.16",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run bundle && pnpm run template:gen",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@botpress/client": "0.7.0",
|
|
24
|
+
"@bpinternal/const": "^0.0.12",
|
|
24
25
|
"@bpinternal/tunnel": "^0.1.0",
|
|
25
26
|
"@bpinternal/yargs-extra": "^0.0.3",
|
|
26
27
|
"@bpinternal/zod-to-json-schema": "^3.21.4",
|