UNPKG

@commercelayer/sdk-utils

Version:
45 lines (44 loc) 1.03 kB
// src/helpers/include/base.ts var IncludePath = class { #resources = []; clear() { this.#resources = []; return this; } add(resource) { this.#resources.push(resource); return this; } get() { return this.#resources; } }; var ResourceInclude = class { #includePath; constructor(includePath) { this.#includePath = includePath || new IncludePath(); } include(resource) { return this.#includePath.add(resource); } get() { return this.#includePath.get().join("."); } build() { const newInclude = this.get(); this.#includePath.clear(); return newInclude; } addTo(filter) { const newInclude = this.get(); const currentInclude = filter.include || []; if (newInclude && !currentInclude.includes(newInclude)) { currentInclude.push(newInclude); filter.include = currentInclude; } this.#includePath.clear(); } }; export { ResourceInclude }; //# sourceMappingURL=chunk-4TM5LA2E.js.map //# sourceMappingURL=chunk-4TM5LA2E.js.map