@softwear/latestcollectioncore 1.0.158 → 1.0.160
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/buildPropertyMappingFn.d.ts +2 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +23 -2
- package/package.json +4 -1
- package/scripts/tmp-esbuild-check.mjs +21 -0
- package/scripts/verify-exports.mjs +32 -0
- package/src/buildPropertyMappingFn.ts +2 -1
- package/src/index.ts +33 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,14 @@ export { default as pivotTable } from './pivotTable';
|
|
|
15
15
|
export { default as round2 } from './round2';
|
|
16
16
|
export { default as sizeToMap } from './sizeToMap';
|
|
17
17
|
export { default as transaction } from './transaction';
|
|
18
|
-
export
|
|
18
|
+
export type { AggregateFnI, AggregatorFnI, AttributeI, BrandSettingI, ColorI, dbTransactionI, DocumentItemI, GroupI, HrTimeframeI, ImageI, MarkedSkuI, MatrixI, ProductI, RaGI, RowI, SkuI, StockTransferDataI, StockTransferMatrixI, StockTransferSelectionI, TransactionI, } from './types';
|
|
19
|
+
import * as types from './types';
|
|
20
|
+
export declare const mappingStrategyE: typeof types.mappingStrategyE;
|
|
21
|
+
export declare const subscriptionE: typeof types.subscriptionE;
|
|
22
|
+
export declare const tagTypeE: typeof types.tagTypeE;
|
|
23
|
+
export declare const TimeGranularityE: typeof types.TimeGranularityE;
|
|
24
|
+
export declare const transactionTypeE: typeof types.transactionTypeE;
|
|
25
|
+
export declare const vatCategoryE: typeof types.vatCategoryE;
|
|
19
26
|
export * from './consts';
|
|
20
27
|
export { default as lcAxios, createAxiosInstance, axiosRetry, exponentialDelay, isAxiosError, } from './lcAxios';
|
|
21
28
|
export type { AxiosRequestConfig, AxiosResponse, AxiosPromise, AxiosError, AxiosTransformer, AxiosRetryOptions, AxiosRequestConfigAny, } from './lcAxios';
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
13
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
27
|
};
|
|
@@ -17,7 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
30
|
};
|
|
19
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.isAxiosError = exports.exponentialDelay = exports.axiosRetry = exports.createAxiosInstance = exports.lcAxios = exports.transaction = exports.sizeToMap = exports.round2 = exports.pivotTable = exports.isean13 = exports.imageBinder = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.getBrandName = exports.findSkuByBarcode = exports.ensureArray = exports.edifact = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = exports.articleStatus = void 0;
|
|
32
|
+
exports.isAxiosError = exports.exponentialDelay = exports.axiosRetry = exports.createAxiosInstance = exports.lcAxios = exports.vatCategoryE = exports.transactionTypeE = exports.TimeGranularityE = exports.tagTypeE = exports.subscriptionE = exports.mappingStrategyE = exports.transaction = exports.sizeToMap = exports.round2 = exports.pivotTable = exports.isean13 = exports.imageBinder = exports.hasOnlyDigits = exports.hashBrand = exports.getPreferedPropertyMappings = exports.getBrandName = exports.findSkuByBarcode = exports.ensureArray = exports.edifact = exports.ean13 = exports.deepCopy = exports.buildPropertyMappingFn = exports.articleStatus = void 0;
|
|
21
33
|
var articleStatus_1 = require("./articleStatus");
|
|
22
34
|
Object.defineProperty(exports, "articleStatus", { enumerable: true, get: function () { return __importDefault(articleStatus_1).default; } });
|
|
23
35
|
var buildPropertyMappingFn_1 = require("./buildPropertyMappingFn");
|
|
@@ -52,7 +64,16 @@ var sizeToMap_1 = require("./sizeToMap");
|
|
|
52
64
|
Object.defineProperty(exports, "sizeToMap", { enumerable: true, get: function () { return __importDefault(sizeToMap_1).default; } });
|
|
53
65
|
var transaction_1 = require("./transaction");
|
|
54
66
|
Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return __importDefault(transaction_1).default; } });
|
|
55
|
-
|
|
67
|
+
// Runtime enums: use `export const x = types.x`, not `export { x } from './types'`.
|
|
68
|
+
// TS emits `Object.defineProperty(exports, "x", { get: ... })` for re-exports; Vite/esbuild
|
|
69
|
+
// does not treat those getters as static named exports for ESM interop.
|
|
70
|
+
const types = __importStar(require("./types"));
|
|
71
|
+
exports.mappingStrategyE = types.mappingStrategyE;
|
|
72
|
+
exports.subscriptionE = types.subscriptionE;
|
|
73
|
+
exports.tagTypeE = types.tagTypeE;
|
|
74
|
+
exports.TimeGranularityE = types.TimeGranularityE;
|
|
75
|
+
exports.transactionTypeE = types.transactionTypeE;
|
|
76
|
+
exports.vatCategoryE = types.vatCategoryE;
|
|
56
77
|
__exportStar(require("./consts"), exports);
|
|
57
78
|
var lcAxios_1 = require("./lcAxios");
|
|
58
79
|
Object.defineProperty(exports, "lcAxios", { enumerable: true, get: function () { return __importDefault(lcAxios_1).default; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softwear/latestcollectioncore",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.160",
|
|
4
4
|
"description": "Core functions for LatestCollections applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc -p tsconfig.json",
|
|
19
|
+
"verify": "node scripts/verify-exports.mjs",
|
|
20
|
+
"postbuild": "npm run verify",
|
|
19
21
|
"build:watch": "tsc -p tsconfig.json --watch",
|
|
20
22
|
"test": "vitest run",
|
|
21
23
|
"test:watch": "vitest",
|
|
24
|
+
"prepublishOnly": "npm run build && npm test",
|
|
22
25
|
"dev": "concurrently \"npm:build:watch\" \"npm:test:watch\""
|
|
23
26
|
},
|
|
24
27
|
"repository": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild'
|
|
2
|
+
import { readFileSync } from 'fs'
|
|
3
|
+
import { dirname, join } from 'path'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
|
|
6
|
+
const dir = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
const result = await esbuild.build({
|
|
8
|
+
stdin: {
|
|
9
|
+
contents: `import { TimeGranularityE } from ${JSON.stringify(join(dir, '..', 'dist', 'index.js'))}\nconsole.log(TimeGranularityE.DAY)\n`,
|
|
10
|
+
resolveDir: dir,
|
|
11
|
+
sourcefile: 'entry.mjs',
|
|
12
|
+
loader: 'js',
|
|
13
|
+
},
|
|
14
|
+
bundle: true,
|
|
15
|
+
format: 'esm',
|
|
16
|
+
platform: 'browser',
|
|
17
|
+
write: false,
|
|
18
|
+
})
|
|
19
|
+
const text = result.outputFiles[0].text
|
|
20
|
+
if (!text.includes('day') && !text.includes('TimeGranularityE')) throw new Error('esbuild bundle did not retain enum')
|
|
21
|
+
console.log('esbuild interop check: ok')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures dist/index.js exposes runtime enums for both CJS require() and ESM named imports
|
|
3
|
+
* (same interop Vite/esbuild rely on). Run after `npm run build`.
|
|
4
|
+
*/
|
|
5
|
+
import { createRequire } from 'module'
|
|
6
|
+
import { dirname, join } from 'path'
|
|
7
|
+
import { fileURLToPath, pathToFileURL } from 'url'
|
|
8
|
+
|
|
9
|
+
const root = dirname(fileURLToPath(import.meta.url))
|
|
10
|
+
const indexPath = join(root, '..', 'dist', 'index.js')
|
|
11
|
+
|
|
12
|
+
const ENUMS = [
|
|
13
|
+
'subscriptionE',
|
|
14
|
+
'vatCategoryE',
|
|
15
|
+
'tagTypeE',
|
|
16
|
+
'mappingStrategyE',
|
|
17
|
+
'transactionTypeE',
|
|
18
|
+
'TimeGranularityE',
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const require = createRequire(import.meta.url)
|
|
22
|
+
const cjs = require(indexPath)
|
|
23
|
+
for (const name of ENUMS) {
|
|
24
|
+
if (cjs[name] == null) throw new Error(`CJS: missing export "${name}"`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ns = await import(pathToFileURL(indexPath).href)
|
|
28
|
+
for (const name of ENUMS) {
|
|
29
|
+
if (ns[name] == null) throw new Error(`ESM: missing export "${name}"`)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log('verify-exports: ok (%d enums)', ENUMS.length)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { hashBrand, SkuI, BrandSettingI
|
|
1
|
+
import { hashBrand, SkuI, BrandSettingI } from './index'
|
|
2
|
+
import { mappingStrategyE } from './types'
|
|
2
3
|
|
|
3
4
|
// The order of the following mappingPairs is significant.
|
|
4
5
|
// - If no mapping is available, we prefer colorFamily to be copied from colorSupplier, not colorCodeSupplier.
|
package/src/index.ts
CHANGED
|
@@ -15,7 +15,39 @@ export { default as pivotTable } from './pivotTable'
|
|
|
15
15
|
export { default as round2 } from './round2'
|
|
16
16
|
export { default as sizeToMap } from './sizeToMap'
|
|
17
17
|
export { default as transaction } from './transaction'
|
|
18
|
-
|
|
18
|
+
// Types-only re-exports (no runtime).
|
|
19
|
+
export type {
|
|
20
|
+
AggregateFnI,
|
|
21
|
+
AggregatorFnI,
|
|
22
|
+
AttributeI,
|
|
23
|
+
BrandSettingI,
|
|
24
|
+
ColorI,
|
|
25
|
+
dbTransactionI,
|
|
26
|
+
DocumentItemI,
|
|
27
|
+
GroupI,
|
|
28
|
+
HrTimeframeI,
|
|
29
|
+
ImageI,
|
|
30
|
+
MarkedSkuI,
|
|
31
|
+
MatrixI,
|
|
32
|
+
ProductI,
|
|
33
|
+
RaGI,
|
|
34
|
+
RowI,
|
|
35
|
+
SkuI,
|
|
36
|
+
StockTransferDataI,
|
|
37
|
+
StockTransferMatrixI,
|
|
38
|
+
StockTransferSelectionI,
|
|
39
|
+
TransactionI,
|
|
40
|
+
} from './types'
|
|
41
|
+
// Runtime enums: use `export const x = types.x`, not `export { x } from './types'`.
|
|
42
|
+
// TS emits `Object.defineProperty(exports, "x", { get: ... })` for re-exports; Vite/esbuild
|
|
43
|
+
// does not treat those getters as static named exports for ESM interop.
|
|
44
|
+
import * as types from './types'
|
|
45
|
+
export const mappingStrategyE = types.mappingStrategyE
|
|
46
|
+
export const subscriptionE = types.subscriptionE
|
|
47
|
+
export const tagTypeE = types.tagTypeE
|
|
48
|
+
export const TimeGranularityE = types.TimeGranularityE
|
|
49
|
+
export const transactionTypeE = types.transactionTypeE
|
|
50
|
+
export const vatCategoryE = types.vatCategoryE
|
|
19
51
|
export * from './consts'
|
|
20
52
|
export {
|
|
21
53
|
default as lcAxios,
|