@fgv/ts-res 5.0.0-16 → 5.0.0-18

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.
Files changed (32) hide show
  1. package/dist/ts-res.d.ts +461 -0
  2. package/lib/index.d.ts +2 -1
  3. package/lib/index.js +3 -1
  4. package/lib/packlets/zip-archive/convert.d.ts +52 -0
  5. package/lib/packlets/zip-archive/convert.js +104 -0
  6. package/lib/packlets/zip-archive/index.d.ts +23 -0
  7. package/lib/packlets/zip-archive/index.js +95 -0
  8. package/lib/packlets/zip-archive/json.d.ts +64 -0
  9. package/lib/packlets/zip-archive/json.js +24 -0
  10. package/lib/packlets/zip-archive/types.d.ts +98 -0
  11. package/lib/packlets/zip-archive/types.js +39 -0
  12. package/lib/packlets/zip-archive/zipArchiveCreator.d.ts +35 -0
  13. package/lib/packlets/zip-archive/zipArchiveCreator.js +194 -0
  14. package/lib/packlets/zip-archive/zipArchiveFormat.d.ts +70 -0
  15. package/lib/packlets/zip-archive/zipArchiveFormat.js +184 -0
  16. package/lib/packlets/zip-archive/zipArchiveLoader.d.ts +70 -0
  17. package/lib/packlets/zip-archive/zipArchiveLoader.js +285 -0
  18. package/lib/test/unit/zip-archive/convert.test.d.ts +2 -0
  19. package/lib/test/unit/zip-archive/json.test.d.ts +2 -0
  20. package/lib/test/unit/zip-archive/zipArchiveCreator.test.d.ts +2 -0
  21. package/lib/test/unit/zip-archive/zipArchiveFormat.test.d.ts +2 -0
  22. package/lib/test/unit/zip-archive/zipArchiveIdempotency.test.d.ts +2 -0
  23. package/lib/test/unit/zip-archive/zipArchiveLoader.test.d.ts +2 -0
  24. package/package.json +8 -7
  25. package/src/index.ts +3 -1
  26. package/src/packlets/zip-archive/convert.ts +121 -0
  27. package/src/packlets/zip-archive/index.ts +76 -0
  28. package/src/packlets/zip-archive/json.ts +91 -0
  29. package/src/packlets/zip-archive/types.ts +140 -0
  30. package/src/packlets/zip-archive/zipArchiveCreator.ts +229 -0
  31. package/src/packlets/zip-archive/zipArchiveFormat.ts +158 -0
  32. package/src/packlets/zip-archive/zipArchiveLoader.ts +370 -0
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.systemConfiguration = exports.importedDirectory = exports.importedFile = exports.mimeType = exports.zipArchiveManifest = exports.zipArchiveConfigInfo = exports.zipArchiveInputInfo = exports.zipArchiveConfigType = exports.zipArchiveInputType = void 0;
25
+ /* eslint-disable @rushstack/typedef-var */
26
+ const ts_utils_1 = require("@fgv/ts-utils");
27
+ const config_1 = require("../config");
28
+ /**
29
+ * Validator for ZIP archive input type
30
+ * @public
31
+ */
32
+ exports.zipArchiveInputType = ts_utils_1.Validators.enumeratedValue([
33
+ 'file',
34
+ 'directory'
35
+ ]);
36
+ /**
37
+ * Validator for ZIP archive config type
38
+ * @public
39
+ */
40
+ exports.zipArchiveConfigType = ts_utils_1.Validators.enumeratedValue(['file']);
41
+ /**
42
+ * Validator for ZIP archive input information
43
+ * @public
44
+ */
45
+ exports.zipArchiveInputInfo = ts_utils_1.Validators.object({
46
+ type: exports.zipArchiveInputType,
47
+ originalPath: ts_utils_1.Validators.string,
48
+ archivePath: ts_utils_1.Validators.string
49
+ });
50
+ /**
51
+ * Validator for ZIP archive config information
52
+ * @public
53
+ */
54
+ exports.zipArchiveConfigInfo = ts_utils_1.Validators.object({
55
+ type: exports.zipArchiveConfigType,
56
+ originalPath: ts_utils_1.Validators.string,
57
+ archivePath: ts_utils_1.Validators.string
58
+ });
59
+ /**
60
+ * Validator for ZIP archive manifest
61
+ * Compatible with existing tools from ts-res-browser-cli
62
+ * @public
63
+ */
64
+ exports.zipArchiveManifest = ts_utils_1.Validators.object({
65
+ timestamp: ts_utils_1.Validators.string,
66
+ input: exports.zipArchiveInputInfo.optional(),
67
+ config: exports.zipArchiveConfigInfo.optional()
68
+ });
69
+ /**
70
+ * Validator for MIME type strings
71
+ * @public
72
+ */
73
+ exports.mimeType = ts_utils_1.Validators.string;
74
+ /**
75
+ * Converter for imported file
76
+ * @public
77
+ */
78
+ exports.importedFile = ts_utils_1.Converters.strictObject({
79
+ name: ts_utils_1.Converters.string,
80
+ path: ts_utils_1.Converters.string,
81
+ content: ts_utils_1.Converters.string,
82
+ type: ts_utils_1.Converters.string // MIME type as string
83
+ });
84
+ /**
85
+ * Converter for imported directory structure (recursive)
86
+ * Note: Uses Converter pattern because Validators don't support recursion with self parameter
87
+ * @public
88
+ */
89
+ exports.importedDirectory = ts_utils_1.Converters.generic((from, self, context) => {
90
+ return ts_utils_1.Converters.strictObject({
91
+ name: ts_utils_1.Converters.string,
92
+ files: ts_utils_1.Converters.arrayOf(exports.importedFile),
93
+ subdirectories: ts_utils_1.Converters.arrayOf(self)
94
+ }).convert(from, context);
95
+ });
96
+ /**
97
+ * Validator for system configuration (delegates to config packlet)
98
+ * This validates that the parsed JSON conforms to the system configuration schema
99
+ * @public
100
+ */
101
+ exports.systemConfiguration = ts_utils_1.Validators.isA('system configuration', (value) => {
102
+ return config_1.Convert.systemConfiguration.convert(value).isSuccess();
103
+ });
104
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * ZIP archive functionality for ts-res source file archives
3
+ *
4
+ * This packlet provides consolidated ZIP archive creation and loading functionality
5
+ * for source files, compatible with existing tools while using fflate for
6
+ * universal browser compatibility.
7
+ *
8
+ * @remarks
9
+ * ZIP archives contain source files for resource ingestion with directory
10
+ * structure preserved and optional validation but no processing or transformation.
11
+ * This is distinct from ZIP bundles which contain processed resource output.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+ import * as Json from './json';
16
+ import * as Convert from './convert';
17
+ export { Json, Convert };
18
+ export { ZipArchiveCreator } from './zipArchiveCreator';
19
+ export { ZipArchiveLoader } from './zipArchiveLoader';
20
+ export type { IZipArchivePathOptions, IZipArchiveFileTreeOptions, ZipArchiveOptions, IZipArchiveResult, IZipArchiveManifest, IZipArchiveLoadOptions, IZipArchiveLoadResult, IImportedFile, IImportedDirectory, ZipArchiveProgressCallback } from './types';
21
+ export { createZipArchiveManifest, parseZipArchiveManifest, validateZipArchiveManifest, parseZipArchiveConfiguration, generateZipArchiveFilename, normalizePath, getDirectoryName, sanitizeFilename, isZipFile } from './zipArchiveFormat';
22
+ export { ZipArchiveConstants } from './types';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.ZipArchiveConstants = exports.isZipFile = exports.sanitizeFilename = exports.getDirectoryName = exports.normalizePath = exports.generateZipArchiveFilename = exports.parseZipArchiveConfiguration = exports.validateZipArchiveManifest = exports.parseZipArchiveManifest = exports.createZipArchiveManifest = exports.ZipArchiveLoader = exports.ZipArchiveCreator = exports.Convert = exports.Json = void 0;
58
+ /**
59
+ * ZIP archive functionality for ts-res source file archives
60
+ *
61
+ * This packlet provides consolidated ZIP archive creation and loading functionality
62
+ * for source files, compatible with existing tools while using fflate for
63
+ * universal browser compatibility.
64
+ *
65
+ * @remarks
66
+ * ZIP archives contain source files for resource ingestion with directory
67
+ * structure preserved and optional validation but no processing or transformation.
68
+ * This is distinct from ZIP bundles which contain processed resource output.
69
+ *
70
+ * @packageDocumentation
71
+ */
72
+ const Json = __importStar(require("./json"));
73
+ exports.Json = Json;
74
+ const Convert = __importStar(require("./convert"));
75
+ exports.Convert = Convert;
76
+ // Core classes
77
+ var zipArchiveCreator_1 = require("./zipArchiveCreator");
78
+ Object.defineProperty(exports, "ZipArchiveCreator", { enumerable: true, get: function () { return zipArchiveCreator_1.ZipArchiveCreator; } });
79
+ var zipArchiveLoader_1 = require("./zipArchiveLoader");
80
+ Object.defineProperty(exports, "ZipArchiveLoader", { enumerable: true, get: function () { return zipArchiveLoader_1.ZipArchiveLoader; } });
81
+ // Format utilities
82
+ var zipArchiveFormat_1 = require("./zipArchiveFormat");
83
+ Object.defineProperty(exports, "createZipArchiveManifest", { enumerable: true, get: function () { return zipArchiveFormat_1.createZipArchiveManifest; } });
84
+ Object.defineProperty(exports, "parseZipArchiveManifest", { enumerable: true, get: function () { return zipArchiveFormat_1.parseZipArchiveManifest; } });
85
+ Object.defineProperty(exports, "validateZipArchiveManifest", { enumerable: true, get: function () { return zipArchiveFormat_1.validateZipArchiveManifest; } });
86
+ Object.defineProperty(exports, "parseZipArchiveConfiguration", { enumerable: true, get: function () { return zipArchiveFormat_1.parseZipArchiveConfiguration; } });
87
+ Object.defineProperty(exports, "generateZipArchiveFilename", { enumerable: true, get: function () { return zipArchiveFormat_1.generateZipArchiveFilename; } });
88
+ Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return zipArchiveFormat_1.normalizePath; } });
89
+ Object.defineProperty(exports, "getDirectoryName", { enumerable: true, get: function () { return zipArchiveFormat_1.getDirectoryName; } });
90
+ Object.defineProperty(exports, "sanitizeFilename", { enumerable: true, get: function () { return zipArchiveFormat_1.sanitizeFilename; } });
91
+ Object.defineProperty(exports, "isZipFile", { enumerable: true, get: function () { return zipArchiveFormat_1.isZipFile; } });
92
+ // Constants
93
+ var types_1 = require("./types");
94
+ Object.defineProperty(exports, "ZipArchiveConstants", { enumerable: true, get: function () { return types_1.ZipArchiveConstants; } });
95
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * JSON representation of ZIP archive input information
3
+ * @public
4
+ */
5
+ export interface IZipArchiveInputInfo {
6
+ /** Type of input (file or directory) */
7
+ type: 'file' | 'directory';
8
+ /** Original file/directory path */
9
+ originalPath: string;
10
+ /** Path within the archive (e.g., "input/mydir") */
11
+ archivePath: string;
12
+ }
13
+ /**
14
+ * JSON representation of ZIP archive config information
15
+ * @public
16
+ */
17
+ export interface IZipArchiveConfigInfo {
18
+ /** Type of config (always 'file') */
19
+ type: 'file';
20
+ /** Original config file path */
21
+ originalPath: string;
22
+ /** Path within the archive (e.g., "config.json") */
23
+ archivePath: string;
24
+ }
25
+ /**
26
+ * JSON representation of a ZIP archive manifest
27
+ * Compatible with existing tools from ts-res-browser-cli
28
+ * @public
29
+ */
30
+ export interface IZipArchiveManifest {
31
+ /** Archive creation timestamp */
32
+ timestamp: string;
33
+ /** Optional input source information */
34
+ input?: IZipArchiveInputInfo;
35
+ /** Optional configuration file information */
36
+ config?: IZipArchiveConfigInfo;
37
+ }
38
+ /**
39
+ * JSON representation of an imported file
40
+ * @public
41
+ */
42
+ export interface IImportedFile {
43
+ /** File name */
44
+ name: string;
45
+ /** Full path within archive */
46
+ path: string;
47
+ /** File content as string */
48
+ content: string;
49
+ /** MIME type */
50
+ type: string;
51
+ }
52
+ /**
53
+ * JSON representation of an imported directory structure
54
+ * @public
55
+ */
56
+ export interface IImportedDirectory {
57
+ /** Directory name */
58
+ name: string;
59
+ /** Files in this directory */
60
+ files: IImportedFile[];
61
+ /** Subdirectories */
62
+ subdirectories: IImportedDirectory[];
63
+ }
64
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1,98 @@
1
+ import { Model as ConfigModel } from '../config';
2
+ import * as Json from './json';
3
+ import { FileTree } from '@fgv/ts-utils';
4
+ /**
5
+ * Options for creating a ZIP archive buffer
6
+ * @public
7
+ */
8
+ export interface IZipArchivePathOptions {
9
+ /** File or directory path to include in the archive */
10
+ inputPath?: string;
11
+ /** Optional configuration file path */
12
+ configPath?: string;
13
+ }
14
+ /**
15
+ * Options for creating a ZIP archive buffer from a file tree
16
+ * @public
17
+ */
18
+ export interface IZipArchiveFileTreeOptions {
19
+ /** Input file or directory */
20
+ inputItem?: FileTree.FileTreeItem;
21
+ /** Optional configuration file */
22
+ configItem?: FileTree.IFileTreeFileItem;
23
+ }
24
+ /**
25
+ * Options for creating a ZIP archive buffer
26
+ * @public
27
+ */
28
+ export type ZipArchiveOptions = IZipArchivePathOptions | IZipArchiveFileTreeOptions;
29
+ /**
30
+ * Standardized ZIP archive manifest format (compatible with existing tools)
31
+ * @public
32
+ */
33
+ export type IZipArchiveManifest = Json.IZipArchiveManifest;
34
+ /**
35
+ * Result of ZIP archive buffer creation
36
+ * @public
37
+ */
38
+ export interface IZipArchiveResult {
39
+ /** Raw ZIP data buffer */
40
+ zipBuffer: Uint8Array;
41
+ /** Archive manifest with metadata */
42
+ manifest: IZipArchiveManifest;
43
+ /** Total ZIP size in bytes */
44
+ size: number;
45
+ }
46
+ /**
47
+ * Options for loading a ZIP archive
48
+ * @public
49
+ */
50
+ export interface IZipArchiveLoadOptions {
51
+ /** Validate manifest strictly */
52
+ strictManifestValidation?: boolean;
53
+ }
54
+ /**
55
+ * Result of ZIP archive loading
56
+ * @public
57
+ */
58
+ export interface IZipArchiveLoadResult {
59
+ /** Parsed archive manifest */
60
+ manifest: IZipArchiveManifest | undefined;
61
+ /** Loaded configuration */
62
+ config: ConfigModel.ISystemConfiguration | undefined;
63
+ /** All files extracted from the archive */
64
+ files: IImportedFile[];
65
+ /** Directory structure if available */
66
+ directory: IImportedDirectory | undefined;
67
+ }
68
+ /**
69
+ * Imported file representation
70
+ * @public
71
+ */
72
+ export type IImportedFile = Json.IImportedFile;
73
+ /**
74
+ * Imported directory structure
75
+ * @public
76
+ */
77
+ export type IImportedDirectory = Json.IImportedDirectory;
78
+ /**
79
+ * Progress callback for ZIP operations
80
+ * @public
81
+ */
82
+ export type ZipArchiveProgressCallback = (stage: 'reading-file' | 'parsing-zip' | 'loading-manifest' | 'loading-config' | 'extracting-files' | 'processing-resources' | 'creating-zip', progress: number, // 0-100
83
+ details: string) => void;
84
+ /**
85
+ * Constants for ZIP archive structure
86
+ * @public
87
+ */
88
+ export declare const ZipArchiveConstants: {
89
+ /** Manifest file name */
90
+ readonly MANIFEST_FILE: "manifest.json";
91
+ /** Configuration file name */
92
+ readonly CONFIG_FILE: "config.json";
93
+ /** Input files directory */
94
+ readonly INPUT_DIR: "input";
95
+ /** Configuration files directory */
96
+ readonly CONFIG_DIR: "config";
97
+ };
98
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.ZipArchiveConstants = void 0;
25
+ /**
26
+ * Constants for ZIP archive structure
27
+ * @public
28
+ */
29
+ exports.ZipArchiveConstants = {
30
+ /** Manifest file name */
31
+ MANIFEST_FILE: 'manifest.json',
32
+ /** Configuration file name */
33
+ CONFIG_FILE: 'config.json',
34
+ /** Input files directory */
35
+ INPUT_DIR: 'input',
36
+ /** Configuration files directory */
37
+ CONFIG_DIR: 'config'
38
+ };
39
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,35 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import type { IZipArchiveResult, ZipArchiveOptions, ZipArchiveProgressCallback } from './types';
3
+ /**
4
+ * ZIP archive creator using fflate for universal compatibility
5
+ * @public
6
+ */
7
+ export declare class ZipArchiveCreator {
8
+ /**
9
+ * Create a ZIP archive buffer from a supplied buffer
10
+ * @param options - Input paths and configuration
11
+ * @param onProgress - Optional progress callback
12
+ * @returns Result containing ZIP buffer and manifest
13
+ */
14
+ createFromBuffer(options: ZipArchiveOptions, onProgress?: ZipArchiveProgressCallback): Promise<Result<IZipArchiveResult>>;
15
+ /**
16
+ * Add a single FileTree item to the ZIP archive
17
+ * @param files - ZIP files collection
18
+ * @param fileItem - FileTree file item to add
19
+ * @param archivePath - Path within the archive
20
+ * @returns Result indicating success or failure
21
+ */
22
+ private _addFileTreeItemToZip;
23
+ /**
24
+ * Add a directory recursively to the ZIP archive using FileTree
25
+ * @param files - ZIP files collection
26
+ * @param directoryItem - FileTree directory item to add
27
+ * @param archivePrefix - Prefix path within the archive
28
+ * @param onProgress - Optional progress callback
29
+ * @returns Result indicating success or failure
30
+ */
31
+ private _addDirectoryTreeToZip;
32
+ private _getInputFileTreeItem;
33
+ private _getConfigFileTreeItem;
34
+ }
35
+ //# sourceMappingURL=zipArchiveCreator.d.ts.map