@fgv/ts-extras 5.1.0-45 → 5.1.0-46

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 (38) hide show
  1. package/dist/packlets/ai-assist/index.js +1 -1
  2. package/dist/packlets/ai-assist/index.js.map +1 -1
  3. package/dist/packlets/ai-assist/jsonResponse.js +270 -7
  4. package/dist/packlets/ai-assist/jsonResponse.js.map +1 -1
  5. package/dist/packlets/ai-assist/model.js +14 -0
  6. package/dist/packlets/ai-assist/model.js.map +1 -1
  7. package/dist/packlets/ai-assist/registry.js +57 -14
  8. package/dist/packlets/ai-assist/registry.js.map +1 -1
  9. package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js +65 -7
  10. package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -1
  11. package/dist/packlets/zip-file-tree/zipFileTreeWriter.js +16 -1
  12. package/dist/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -1
  13. package/dist/ts-extras.d.ts +253 -13
  14. package/lib/packlets/ai-assist/index.d.ts +1 -1
  15. package/lib/packlets/ai-assist/index.d.ts.map +1 -1
  16. package/lib/packlets/ai-assist/index.js +3 -2
  17. package/lib/packlets/ai-assist/index.js.map +1 -1
  18. package/lib/packlets/ai-assist/jsonResponse.d.ts +96 -0
  19. package/lib/packlets/ai-assist/jsonResponse.d.ts.map +1 -1
  20. package/lib/packlets/ai-assist/jsonResponse.js +271 -7
  21. package/lib/packlets/ai-assist/jsonResponse.js.map +1 -1
  22. package/lib/packlets/ai-assist/model.d.ts +43 -0
  23. package/lib/packlets/ai-assist/model.d.ts.map +1 -1
  24. package/lib/packlets/ai-assist/model.js +14 -0
  25. package/lib/packlets/ai-assist/model.js.map +1 -1
  26. package/lib/packlets/ai-assist/registry.d.ts +26 -6
  27. package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
  28. package/lib/packlets/ai-assist/registry.js +57 -14
  29. package/lib/packlets/ai-assist/registry.js.map +1 -1
  30. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts +54 -6
  31. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts.map +1 -1
  32. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js +65 -7
  33. package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -1
  34. package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts +26 -1
  35. package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts.map +1 -1
  36. package/lib/packlets/zip-file-tree/zipFileTreeWriter.js +17 -1
  37. package/lib/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -1
  38. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"zipFileTreeWriter.d.ts","sourceRoot":"","sources":["../../../src/packlets/zip-file-tree/zipFileTreeWriter.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,EAClC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAAC,UAAU,CAAC,CAUpB"}
1
+ {"version":3,"file":"zipFileTreeWriter.d.ts","sourceRoot":"","sources":["../../../src/packlets/zip-file-tree/zipFileTreeWriter.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM,EAAiB,MAAM,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;CACxC;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,EAClC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAAC,UAAU,CAAC,CAEpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC9B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,MAAM,CAAC,UAAU,CAAC,CAUpB"}
@@ -22,19 +22,35 @@
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.createZipFromTextFiles = createZipFromTextFiles;
25
+ exports.createZipFromFiles = createZipFromFiles;
25
26
  const fflate_1 = require("fflate");
26
27
  const ts_utils_1 = require("@fgv/ts-utils");
27
28
  /**
28
29
  * Creates a zip file from an array of text files.
30
+ *
31
+ * @remarks
32
+ * Contents are encoded as UTF-8. Use `createZipFromFiles` to write entries whose
33
+ * contents are raw bytes.
29
34
  * @public
30
35
  */
31
36
  function createZipFromTextFiles(files, options) {
37
+ return createZipFromFiles(files, options);
38
+ }
39
+ /**
40
+ * Creates a zip file from an array of files whose contents are either text or raw bytes.
41
+ *
42
+ * @remarks
43
+ * String contents are encoded as UTF-8; `Uint8Array` contents are stored verbatim, so
44
+ * arbitrary binary payloads round-trip through the archive unchanged.
45
+ * @public
46
+ */
47
+ function createZipFromFiles(files, options) {
32
48
  return (0, ts_utils_1.captureResult)(() => {
33
49
  var _a;
34
50
  const out = {};
35
51
  for (const f of files) {
36
52
  const normalizedPath = f.path.replace(/^\/+/, '');
37
- out[normalizedPath] = (0, fflate_1.strToU8)(f.contents);
53
+ out[normalizedPath] = typeof f.contents === 'string' ? (0, fflate_1.strToU8)(f.contents) : f.contents;
38
54
  }
39
55
  return (0, fflate_1.zipSync)(out, { level: (_a = options === null || options === void 0 ? void 0 : options.level) !== null && _a !== void 0 ? _a : 6 });
40
56
  /* c8 ignore next - defensive: zipSync only throws on internal library errors */
@@ -1 +1 @@
1
- {"version":3,"file":"zipFileTreeWriter.js","sourceRoot":"","sources":["../../../src/packlets/zip-file-tree/zipFileTreeWriter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAgCH,wDAaC;AA3CD,mCAA0C;AAC1C,4CAAsD;AAyBtD;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,KAAkC,EAClC,OAA2B;IAE3B,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE;;QACxB,MAAM,GAAG,GAA+B,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAClD,GAAG,CAAC,cAAc,CAAC,GAAG,IAAA,gBAAO,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAA,gBAAO,EAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,CAAC,EAAE,CAAC,CAAC;QACpD,gFAAgF;IAClF,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { zipSync, strToU8 } from 'fflate';\nimport { Result, captureResult } from '@fgv/ts-utils';\n\n/**\n * Simple interface for a file to be added to a zip file.\n * @public\n */\nexport interface IZipTextFile {\n readonly path: string;\n readonly contents: string;\n}\n\n/**\n * Supported compression levels for zip files.\n * @public\n */\nexport type ZipCompressionLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;\n\n/**\n * Options for creating a zip file from text files.\n * @public\n */\nexport interface ICreateZipOptions {\n readonly level?: ZipCompressionLevel;\n}\n\n/**\n * Creates a zip file from an array of text files.\n * @public\n */\nexport function createZipFromTextFiles(\n files: ReadonlyArray<IZipTextFile>,\n options?: ICreateZipOptions\n): Result<Uint8Array> {\n return captureResult(() => {\n const out: Record<string, Uint8Array> = {};\n for (const f of files) {\n const normalizedPath = f.path.replace(/^\\/+/, '');\n out[normalizedPath] = strToU8(f.contents);\n }\n return zipSync(out, { level: options?.level ?? 6 });\n /* c8 ignore next - defensive: zipSync only throws on internal library errors */\n }).withErrorFormat((e) => `Failed to create zip: ${e}`);\n}\n"]}
1
+ {"version":3,"file":"zipFileTreeWriter.js","sourceRoot":"","sources":["../../../src/packlets/zip-file-tree/zipFileTreeWriter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAiDH,wDAKC;AAUD,gDAaC;AA3ED,mCAA0C;AAC1C,4CAAsD;AAsCtD;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,KAAkC,EAClC,OAA2B;IAE3B,OAAO,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,KAA8B,EAC9B,OAA2B;IAE3B,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE;;QACxB,MAAM,GAAG,GAA+B,EAAE,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YAClD,GAAG,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,gBAAO,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC1F,CAAC;QACD,OAAO,IAAA,gBAAO,EAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,CAAC,EAAE,CAAC,CAAC;QACpD,gFAAgF;IAClF,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/*\n * Copyright (c) 2026 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { zipSync, strToU8 } from 'fflate';\nimport { Result, captureResult } from '@fgv/ts-utils';\n\n/**\n * Simple interface for a text file to be added to a zip file.\n * @public\n */\nexport interface IZipTextFile {\n readonly path: string;\n readonly contents: string;\n}\n\n/**\n * Interface for a file to be added to a zip file, whose contents are either text or\n * raw bytes.\n *\n * @remarks\n * String contents are encoded as UTF-8; `Uint8Array` contents are stored verbatim.\n * @public\n */\nexport interface IZipFile {\n readonly path: string;\n readonly contents: string | Uint8Array;\n}\n\n/**\n * Supported compression levels for zip files.\n * @public\n */\nexport type ZipCompressionLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;\n\n/**\n * Options for creating a zip file from text files.\n * @public\n */\nexport interface ICreateZipOptions {\n readonly level?: ZipCompressionLevel;\n}\n\n/**\n * Creates a zip file from an array of text files.\n *\n * @remarks\n * Contents are encoded as UTF-8. Use `createZipFromFiles` to write entries whose\n * contents are raw bytes.\n * @public\n */\nexport function createZipFromTextFiles(\n files: ReadonlyArray<IZipTextFile>,\n options?: ICreateZipOptions\n): Result<Uint8Array> {\n return createZipFromFiles(files, options);\n}\n\n/**\n * Creates a zip file from an array of files whose contents are either text or raw bytes.\n *\n * @remarks\n * String contents are encoded as UTF-8; `Uint8Array` contents are stored verbatim, so\n * arbitrary binary payloads round-trip through the archive unchanged.\n * @public\n */\nexport function createZipFromFiles(\n files: ReadonlyArray<IZipFile>,\n options?: ICreateZipOptions\n): Result<Uint8Array> {\n return captureResult(() => {\n const out: Record<string, Uint8Array> = {};\n for (const f of files) {\n const normalizedPath = f.path.replace(/^\\/+/, '');\n out[normalizedPath] = typeof f.contents === 'string' ? strToU8(f.contents) : f.contents;\n }\n return zipSync(out, { level: options?.level ?? 6 });\n /* c8 ignore next - defensive: zipSync only throws on internal library errors */\n }).withErrorFormat((e) => `Failed to create zip: ${e}`);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-extras",
3
- "version": "5.1.0-45",
3
+ "version": "5.1.0-46",
4
4
  "description": "Assorted Typescript Utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "dist/ts-extras.d.ts",
@@ -90,10 +90,10 @@
90
90
  "@types/js-yaml": "~4.0.9",
91
91
  "typedoc": "~0.28.16",
92
92
  "typedoc-plugin-markdown": "~4.9.0",
93
- "@fgv/heft-dual-rig": "5.1.0-45",
94
- "@fgv/typedoc-compact-theme": "5.1.0-45",
95
- "@fgv/ts-utils": "5.1.0-45",
96
- "@fgv/ts-utils-jest": "5.1.0-45"
93
+ "@fgv/typedoc-compact-theme": "5.1.0-46",
94
+ "@fgv/heft-dual-rig": "5.1.0-46",
95
+ "@fgv/ts-utils-jest": "5.1.0-46",
96
+ "@fgv/ts-utils": "5.1.0-46"
97
97
  },
98
98
  "dependencies": {
99
99
  "@types/luxon": "^3.7.1",
@@ -102,10 +102,10 @@
102
102
  "papaparse": "^5.4.1",
103
103
  "fflate": "~0.8.2",
104
104
  "js-yaml": "~4.1.1",
105
- "@fgv/ts-json-base": "5.1.0-45"
105
+ "@fgv/ts-json-base": "5.1.0-46"
106
106
  },
107
107
  "peerDependencies": {
108
- "@fgv/ts-utils": "5.1.0-45"
108
+ "@fgv/ts-utils": "5.1.0-46"
109
109
  },
110
110
  "repository": {
111
111
  "type": "git",