@wix/bex-core 2.43.0 → 2.44.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/dist/cjs/testkit/createCountriesBackend.js +15 -16
- package/dist/cjs/testkit/createCountriesBackend.js.map +1 -1
- package/dist/esm/testkit/createCountriesBackend.js +14 -14
- package/dist/esm/testkit/createCountriesBackend.js.map +1 -1
- package/dist/types/testkit/createCountriesBackend.d.ts +0 -1
- package/dist/types/testkit/createCountriesBackend.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -2,29 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.createCountriesBackend = void 0;
|
|
5
|
-
exports.createCountry = createCountry;
|
|
6
5
|
var _chance = require("chance");
|
|
7
6
|
var _lodash = require("lodash");
|
|
8
7
|
var _InMemoryBackend = require("../InMemoryBackend");
|
|
9
|
-
const chance = new _chance.Chance();
|
|
10
|
-
const countries = chance.unique(chance.country.bind(chance, {
|
|
11
|
-
full: true
|
|
12
|
-
}), 253).sort().map(name => ({
|
|
13
|
-
id: (0, _lodash.snakeCase)(name),
|
|
14
|
-
name
|
|
15
|
-
}));
|
|
16
|
-
function createCountry(index, {
|
|
17
|
-
...rest
|
|
18
|
-
} = {}) {
|
|
19
|
-
return {
|
|
20
|
-
...countries[index],
|
|
21
|
-
...rest
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
8
|
const createCountriesBackend = ({
|
|
25
9
|
createOne,
|
|
26
10
|
...params
|
|
27
11
|
} = {}) => {
|
|
12
|
+
const chance = new _chance.Chance();
|
|
13
|
+
const countries = chance.unique(chance.country.bind(chance, {
|
|
14
|
+
full: true
|
|
15
|
+
}), chance.countries().length).sort().map(name => ({
|
|
16
|
+
id: (0, _lodash.snakeCase)(name),
|
|
17
|
+
name
|
|
18
|
+
}));
|
|
19
|
+
function createCountry(index, {
|
|
20
|
+
...rest
|
|
21
|
+
} = {}) {
|
|
22
|
+
return {
|
|
23
|
+
...countries[index],
|
|
24
|
+
...rest
|
|
25
|
+
};
|
|
26
|
+
}
|
|
28
27
|
return new _InMemoryBackend.InMemoryBackend({
|
|
29
28
|
enableTotal: params == null ? void 0 : params.enableTotal,
|
|
30
29
|
createOne: createOne ?? (index => createCountry(index)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chance","require","_lodash","_InMemoryBackend","chance","Chance","countries","unique","country","bind","full","sort","map","name","id","snakeCase","createCountry","index","rest","
|
|
1
|
+
{"version":3,"names":["_chance","require","_lodash","_InMemoryBackend","createCountriesBackend","createOne","params","chance","Chance","countries","unique","country","bind","full","length","sort","map","name","id","snakeCase","createCountry","index","rest","InMemoryBackend","enableTotal","itemKey","item","total","predicate","search","rgx","RegExp","escapeRegExp","test","exports"],"sources":["../../../src/testkit/createCountriesBackend.ts"],"sourcesContent":["import { Country } from './country';\nimport { Chance } from 'chance';\nimport { snakeCase, escapeRegExp } from 'lodash';\nimport { InMemoryBackend, InMemoryBackendParams } from '../InMemoryBackend';\n\nexport const createCountriesBackend = ({\n createOne,\n ...params\n}: Partial<InMemoryBackendParams<Country>> & {\n enableTotal?: boolean;\n} = {}) => {\n const chance = new Chance() as Chance.Chance & {\n countries(): {}[];\n };\n\n const countries = chance\n .unique(\n chance.country.bind(chance, { full: true }),\n chance.countries().length,\n )\n .sort()\n .map((name) => ({\n id: snakeCase(name),\n name,\n }));\n\n function createCountry(\n index: number,\n { ...rest }: Partial<Country> = {},\n ): Country {\n return {\n ...countries[index],\n ...rest,\n };\n }\n\n return new InMemoryBackend<Country>({\n enableTotal: params?.enableTotal,\n createOne: createOne ?? ((index) => createCountry(index)),\n itemKey: (item) => item.id,\n total: countries.length,\n predicate: ({ search }) => {\n const rgx = new RegExp(escapeRegExp(search), 'i');\n\n return (item) => {\n if (search && !rgx.test(item.name)) {\n return false;\n }\n\n return true;\n };\n },\n ...params,\n });\n};\n"],"mappings":";;;;AACA,IAAAA,OAAA,GAA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,OAAO,KAAK;QACd;QAEA,OAAO,IAAI;MACb,CAAC;IACH,CAAC;IACD,GAAGX;EACL,CAAC,CAAC;AACJ,CAAC;AAAC4B,OAAA,CAAA9B,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Chance } from 'chance';
|
|
2
2
|
import { snakeCase, escapeRegExp } from 'lodash';
|
|
3
3
|
import { InMemoryBackend } from '../InMemoryBackend';
|
|
4
|
-
const chance = new Chance();
|
|
5
|
-
const countries = chance
|
|
6
|
-
.unique(chance.country.bind(chance, { full: true }), 253)
|
|
7
|
-
.sort()
|
|
8
|
-
.map((name) => ({
|
|
9
|
-
id: snakeCase(name),
|
|
10
|
-
name,
|
|
11
|
-
}));
|
|
12
|
-
export function createCountry(index, { ...rest } = {}) {
|
|
13
|
-
return {
|
|
14
|
-
...countries[index],
|
|
15
|
-
...rest,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
4
|
export const createCountriesBackend = ({ createOne, ...params } = {}) => {
|
|
5
|
+
const chance = new Chance();
|
|
6
|
+
const countries = chance
|
|
7
|
+
.unique(chance.country.bind(chance, { full: true }), chance.countries().length)
|
|
8
|
+
.sort()
|
|
9
|
+
.map((name) => ({
|
|
10
|
+
id: snakeCase(name),
|
|
11
|
+
name,
|
|
12
|
+
}));
|
|
13
|
+
function createCountry(index, { ...rest } = {}) {
|
|
14
|
+
return {
|
|
15
|
+
...countries[index],
|
|
16
|
+
...rest,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
19
|
return new InMemoryBackend({
|
|
20
20
|
enableTotal: params?.enableTotal,
|
|
21
21
|
createOne: createOne ?? ((index) => createCountry(index)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCountriesBackend.js","sourceRoot":"","sources":["../../../src/testkit/createCountriesBackend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAE5E,MAAM,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"createCountriesBackend.js","sourceRoot":"","sources":["../../../src/testkit/createCountriesBackend.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAE5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,EACT,GAAG,MAAM,KAGP,EAAE,EAAE,EAAE;IACR,MAAM,MAAM,GAAG,IAAI,MAAM,EAExB,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM;SACrB,MAAM,CACL,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAC3C,MAAM,CAAC,SAAS,EAAE,CAAC,MAAM,CAC1B;SACA,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC;QACnB,IAAI;KACL,CAAC,CAAC,CAAC;IAEN,SAAS,aAAa,CACpB,KAAa,EACb,EAAE,GAAG,IAAI,KAAuB,EAAE;QAElC,OAAO;YACL,GAAG,SAAS,CAAC,KAAK,CAAC;YACnB,GAAG,IAAI;SACR,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,eAAe,CAAU;QAClC,WAAW,EAAE,MAAM,EAAE,WAAW;QAChC,SAAS,EAAE,SAAS,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;QAC1B,KAAK,EAAE,SAAS,CAAC,MAAM;QACvB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACxB,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;YAElD,OAAO,CAAC,IAAI,EAAE,EAAE;gBACd,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;oBAClC,OAAO,KAAK,CAAC;iBACd;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;QACJ,CAAC;QACD,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Country } from './country';
|
|
2
2
|
import { InMemoryBackend, InMemoryBackendParams } from '../InMemoryBackend';
|
|
3
|
-
export declare function createCountry(index: number, { ...rest }?: Partial<Country>): Country;
|
|
4
3
|
export declare const createCountriesBackend: ({ createOne, ...params }?: Partial<InMemoryBackendParams<Country>> & {
|
|
5
4
|
enableTotal?: boolean;
|
|
6
5
|
}) => InMemoryBackend<Country, import("..").FiltersMap>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCountriesBackend.d.ts","sourceRoot":"","sources":["../../../src/testkit/createCountriesBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"createCountriesBackend.d.ts","sourceRoot":"","sources":["../../../src/testkit/createCountriesBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,eAAO,MAAM,sBAAsB,8BAGhC,QAAQ,sBAAsB,OAAO,CAAC,CAAC,GAAG;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,sDA4CA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/bex-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kobi",
|
|
@@ -158,5 +158,5 @@
|
|
|
158
158
|
"wallaby": {
|
|
159
159
|
"autoDetect": true
|
|
160
160
|
},
|
|
161
|
-
"falconPackageHash": "
|
|
161
|
+
"falconPackageHash": "d68a9eac28575135356ae747c912bf20976ece86f1e518e5c63ed0b6"
|
|
162
162
|
}
|