diff --git a/apis/anthropic/package-lock.json b/apis/anthropic/package-lock.json
index f1a0c25..9dfa98a 100644
--- a/apis/anthropic/package-lock.json
+++ b/apis/anthropic/package-lock.json
@@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2"
},
"devDependencies": {
@@ -20,11 +20,6 @@
"mocha": "^10.7.0"
}
},
- "../../jsonnet-js-ts/dist": {
- "name": "tplfa-jsonnet",
- "version": "1.1.0",
- "license": "MIT"
- },
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@@ -971,8 +966,10 @@
}
},
"node_modules/tplfa-jsonnet": {
- "resolved": "../../jsonnet-js-ts/dist",
- "link": true
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tplfa-jsonnet/-/tplfa-jsonnet-1.2.0.tgz",
+ "integrity": "sha512-WGAUPmohcYY5xxC1IUqNQ0+4D0XWgnesYZG/qd1jtCbNe0CNdRk00gtDEIYzjrFZqH0cIdYeldjkkgmeyvGOBA==",
+ "license": "MIT"
},
"node_modules/ts-node": {
"version": "10.9.2",
diff --git a/apis/anthropic/package.json b/apis/anthropic/package.json
index f7e1254..07b19c7 100644
--- a/apis/anthropic/package.json
+++ b/apis/anthropic/package.json
@@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2"
},
"devDependencies": {
diff --git a/apis/openai/package-lock.json b/apis/openai/package-lock.json
index 04b0ea3..b03607c 100644
--- a/apis/openai/package-lock.json
+++ b/apis/openai/package-lock.json
@@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2"
},
"devDependencies": {
@@ -20,11 +20,6 @@
"mocha": "^10.7.0"
}
},
- "../../jsonnet-js-ts/dist": {
- "name": "tplfa-jsonnet",
- "version": "1.1.0",
- "license": "MIT"
- },
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@@ -971,8 +966,10 @@
}
},
"node_modules/tplfa-jsonnet": {
- "resolved": "../../jsonnet-js-ts/dist",
- "link": true
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tplfa-jsonnet/-/tplfa-jsonnet-1.2.0.tgz",
+ "integrity": "sha512-WGAUPmohcYY5xxC1IUqNQ0+4D0XWgnesYZG/qd1jtCbNe0CNdRk00gtDEIYzjrFZqH0cIdYeldjkkgmeyvGOBA==",
+ "license": "MIT"
},
"node_modules/ts-node": {
"version": "10.9.2",
diff --git a/apis/openai/package.json b/apis/openai/package.json
index 29cae6e..efe6de6 100644
--- a/apis/openai/package.json
+++ b/apis/openai/package.json
@@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2"
},
"devDependencies": {
diff --git a/in-action/nodejs-jsonnet/package-lock.json b/in-action/nodejs-jsonnet/package-lock.json
index 09903b3..e828cd2 100644
--- a/in-action/nodejs-jsonnet/package-lock.json
+++ b/in-action/nodejs-jsonnet/package-lock.json
@@ -6,16 +6,11 @@
"": {
"name": "nodejs-jsonnet",
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
}
},
- "../../jsonnet-js-ts/dist": {
- "name": "tplfa-jsonnet",
- "version": "1.1.0",
- "license": "MIT"
- },
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@@ -124,8 +119,10 @@
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"node_modules/tplfa-jsonnet": {
- "resolved": "../../jsonnet-js-ts/dist",
- "link": true
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tplfa-jsonnet/-/tplfa-jsonnet-1.2.0.tgz",
+ "integrity": "sha512-WGAUPmohcYY5xxC1IUqNQ0+4D0XWgnesYZG/qd1jtCbNe0CNdRk00gtDEIYzjrFZqH0cIdYeldjkkgmeyvGOBA==",
+ "license": "MIT"
},
"node_modules/ts-node": {
"version": "10.9.2",
diff --git a/in-action/nodejs-jsonnet/package.json b/in-action/nodejs-jsonnet/package.json
index 38675b2..97a2701 100644
--- a/in-action/nodejs-jsonnet/package.json
+++ b/in-action/nodejs-jsonnet/package.json
@@ -4,7 +4,7 @@
"start": "ts-node index.ts"
},
"dependencies": {
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.5.4"
}
diff --git a/in-action/nodejs-tplfa/package-lock.json b/in-action/nodejs-tplfa/package-lock.json
index c918a4a..d9fc0bd 100644
--- a/in-action/nodejs-tplfa/package-lock.json
+++ b/in-action/nodejs-tplfa/package-lock.json
@@ -12,7 +12,7 @@
"ajv": "^8.12.0",
"tplfa": "file:../../tplfa-js/dist",
"tplfa-apis": "file:../../apis/dist",
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.3",
"yargs": "^17.7.2"
@@ -27,23 +27,18 @@
},
"../../apis/dist": {
"name": "tplfa-apis",
- "version": "1.1.1",
- "license": "MIT"
- },
- "../../jsonnet-js-ts/dist": {
- "name": "tplfa-jsonnet",
- "version": "1.1.0",
+ "version": "1.1.3",
"license": "MIT"
},
"../../tplfa-js/dist": {
"name": "tplfa",
- "version": "1.1.1",
+ "version": "1.1.2",
"license": "MIT",
"dependencies": {
"ajv": "^8.12.0",
"node-fetch": "^2.6.1",
- "tplfa-apis": "^1.1.1",
- "tplfa-jsonnet": "^1.1.0"
+ "tplfa-apis": "^1.1.3",
+ "tplfa-jsonnet": "^1.2.0"
},
"devDependencies": {
"@types/ajv": "^1.0.0",
@@ -3489,8 +3484,10 @@
"link": true
},
"node_modules/tplfa-jsonnet": {
- "resolved": "../../jsonnet-js-ts/dist",
- "link": true
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tplfa-jsonnet/-/tplfa-jsonnet-1.2.0.tgz",
+ "integrity": "sha512-WGAUPmohcYY5xxC1IUqNQ0+4D0XWgnesYZG/qd1jtCbNe0CNdRk00gtDEIYzjrFZqH0cIdYeldjkkgmeyvGOBA==",
+ "license": "MIT"
},
"node_modules/ts-api-utils": {
"version": "1.3.0",
diff --git a/in-action/nodejs-tplfa/package.json b/in-action/nodejs-tplfa/package.json
index 1529c7c..6930509 100644
--- a/in-action/nodejs-tplfa/package.json
+++ b/in-action/nodejs-tplfa/package.json
@@ -13,7 +13,7 @@
"ajv": "^8.12.0",
"tplfa": "file:../../tplfa-js/dist",
"tplfa-apis": "file:../../apis/dist",
- "tplfa-jsonnet": "file:../../jsonnet-js-ts/dist",
+ "tplfa-jsonnet": "^1.2.0",
"ts-node": "^10.9.2",
"typescript": "^5.4.3",
"yargs": "^17.7.2"
diff --git a/jsonnet-js-ts/README.md b/jsonnet-js-ts/README.md
index 1656071..96e3374 100644
--- a/jsonnet-js-ts/README.md
+++ b/jsonnet-js-ts/README.md
@@ -1,17 +1,22 @@
-# jsonnet for TypeScript and JavaScript
+# Jsonnet for TypeScript and JavaScript
-For sample usage, see
+[Jsonnet](https://jsonnet.org/) is a templating extension of JSON.
-- [../in-action/web-jsonnet/](../in-action/web-jsonnet/)
-- [../in-action/nodejs-jsonnet/](../in-action/nodejs-jsonnet/)
+> The design is influenced by several configuration languages internal to Google, and embodies years of experience configuring some of the world's most complex IT systems. Jsonnet is now used by many companies and projects.
-Installation:
+For the `tplfa-jsonnet` package, Jsonnet is compiled from Go to WASM and wrapped with helper functions.
+
+The letters "tplfa" stay for "[Templating for API](https://github.com/olpa/templating-for-api)", a project to provide a unified interface to generative AI providers. `tplfa-jsonnet` is the foundation part of the larger project.
+
+## Installation
```
-npm install https://github.com/olpa/templating-for-api/releases/download/jsonnet-v1.1.0/jsonnet-v1.1.0.tar.gz
+npm install tplfa-jsonnet
```
-In code:
+## Usage
+
+Load the library in Node.js:
```
import 'tplfa-jsonnet/wasm_exec.js';
@@ -24,11 +29,76 @@ const jsonnetWasm = await fs.promises.readFile(
jsonnet = await getJsonnet(jsonnetWasm);
```
-The object `jsonnet` provides two functions:
+Load the library in the browser:
+
+```
+
+
+
+```
+
+The `jsonnet` object provides two functions:
- `jsonnet_evaluate_snippet`: Wrapper for the corresponding jsonnet library function
- `evaluate`: Simplified interface. Only code, its external variables, and library files
-Compatibility note:
+The function signature:
+
+```
+evaluate: (
+ //
+ // Jsonnet code
+ //
+ code: string,
+
+ //
+ // Optional variables.
+ // The values should be stringified.
+ // For use in the Jsonnet code:
+ //
+ // std.extVar("")
+ // std.parseJson(std.extVar(""))
+ //
+ extrStrs?: Record,
+
+ //
+ // Optional library code. For use in the Jsonnet code:
+ //
+ // import ""
+ //
+ files?: Record
+
+ //
+ // Output: serialized JSON. Use `JSON.parse` to deserialize.
+ //
+) => Promise;
+```
+
+### Full examples
+
+See:
+
+- Browser environment: [../in-action/web-jsonnet/](../in-action/web-jsonnet/)
+- Node.js environment: [../in-action/nodejs-jsonnet/](../in-action/nodejs-jsonnet/)
+
+
+## Compatibility note
+
+For old node versions, you need to edit the file `wasm_exec.js`. After the line `use strict` add line `globalThis.crypto ??= require('crypto');`. Maybe more changes are needed: .
+
+
+## License, contact
+
+MIT
+
+Jsonnet: Apache license 2.0
-For old versions of node you need to edit the file `./dist/wasm_exec.js`. After the line `use strict` add line `globalThis.crypto ??= require('crypto');`. Maybe more changes are needed: .
+Oleg Parashchenko
diff --git a/jsonnet-js-ts/build-dist.sh b/jsonnet-js-ts/build-dist.sh
index 5d51ad9..c3146bc 100755
--- a/jsonnet-js-ts/build-dist.sh
+++ b/jsonnet-js-ts/build-dist.sh
@@ -14,3 +14,4 @@ tsc /src/jsonnet.ts --outDir /dist/ --target es2017 --module commonjs --declarat
"
cp README.md changelog.md ./dist/
+sed --in-place 's#\.\./#https://github.com/olpa/templating-for-api/tree/master/#g' ./dist/README.md
diff --git a/jsonnet-js-ts/changelog.md b/jsonnet-js-ts/changelog.md
index 95d5525..d01b515 100644
--- a/jsonnet-js-ts/changelog.md
+++ b/jsonnet-js-ts/changelog.md
@@ -1,5 +1,10 @@
# Changelog for jsonnet-js-ts
+## [1.2.0] - 2024-10-11
+
+- Pack as a npm package `tplfa-jsonnet`
+
+
## [1.1.0] - 2024-10-02
- Expose the argument for the library files
diff --git a/jsonnet-js-ts/dist/README.md b/jsonnet-js-ts/dist/README.md
index 1656071..b43d12f 100644
--- a/jsonnet-js-ts/dist/README.md
+++ b/jsonnet-js-ts/dist/README.md
@@ -1,17 +1,22 @@
-# jsonnet for TypeScript and JavaScript
+# Jsonnet for TypeScript and JavaScript
-For sample usage, see
+[Jsonnet](https://jsonnet.org/) is a templating extension of JSON.
-- [../in-action/web-jsonnet/](../in-action/web-jsonnet/)
-- [../in-action/nodejs-jsonnet/](../in-action/nodejs-jsonnet/)
+> The design is influenced by several configuration languages internal to Google, and embodies years of experience configuring some of the world's most complex IT systems. Jsonnet is now used by many companies and projects.
-Installation:
+For the `tplfa-jsonnet` package, Jsonnet is compiled from Go to WASM and wrapped with helper functions.
+
+The letters "tplfa" stay for "[Templating for API](https://github.com/olpa/templating-for-api)", a project to provide a unified interface to generative AI providers. `tplfa-jsonnet` is the foundation part of the larger project.
+
+## Installation
```
-npm install https://github.com/olpa/templating-for-api/releases/download/jsonnet-v1.1.0/jsonnet-v1.1.0.tar.gz
+npm install tplfa-jsonnet
```
-In code:
+## Usage
+
+Load the library in Node.js:
```
import 'tplfa-jsonnet/wasm_exec.js';
@@ -24,11 +29,76 @@ const jsonnetWasm = await fs.promises.readFile(
jsonnet = await getJsonnet(jsonnetWasm);
```
-The object `jsonnet` provides two functions:
+Load the library in the browser:
+
+```
+
+
+
+```
+
+The `jsonnet` object provides two functions:
- `jsonnet_evaluate_snippet`: Wrapper for the corresponding jsonnet library function
- `evaluate`: Simplified interface. Only code, its external variables, and library files
-Compatibility note:
+The function signature:
+
+```
+evaluate: (
+ //
+ // Jsonnet code
+ //
+ code: string,
+
+ //
+ // Optional variables.
+ // The values should be stringified.
+ // For use in the Jsonnet code:
+ //
+ // std.extVar("")
+ // std.parseJson(std.extVar(""))
+ //
+ extrStrs?: Record,
+
+ //
+ // Optional library code. For use in the Jsonnet code:
+ //
+ // import ""
+ //
+ files?: Record
+
+ //
+ // Output: serialized JSON. Use `JSON.parse` to deserialize.
+ //
+) => Promise;
+```
+
+### Full examples
+
+See:
+
+- Browser environment: [https://github.com/olpa/templating-for-api/tree/master/in-action/web-jsonnet/](https://github.com/olpa/templating-for-api/tree/master/in-action/web-jsonnet/)
+- Node.js environment: [https://github.com/olpa/templating-for-api/tree/master/in-action/nodejs-jsonnet/](https://github.com/olpa/templating-for-api/tree/master/in-action/nodejs-jsonnet/)
+
+
+## Compatibility note
+
+For old node versions, you need to edit the file `wasm_exec.js`. After the line `use strict` add line `globalThis.crypto ??= require('crypto');`. Maybe more changes are needed: .
+
+
+## License, contact
+
+MIT
+
+Jsonnet: Apache license 2.0
-For old versions of node you need to edit the file `./dist/wasm_exec.js`. After the line `use strict` add line `globalThis.crypto ??= require('crypto');`. Maybe more changes are needed: .
+Oleg Parashchenko
diff --git a/jsonnet-js-ts/dist/changelog.md b/jsonnet-js-ts/dist/changelog.md
index 95d5525..d01b515 100644
--- a/jsonnet-js-ts/dist/changelog.md
+++ b/jsonnet-js-ts/dist/changelog.md
@@ -1,5 +1,10 @@
# Changelog for jsonnet-js-ts
+## [1.2.0] - 2024-10-11
+
+- Pack as a npm package `tplfa-jsonnet`
+
+
## [1.1.0] - 2024-10-02
- Expose the argument for the library files
diff --git a/jsonnet-js-ts/dist/package.json b/jsonnet-js-ts/dist/package.json
index e7adc63..24125f6 100644
--- a/jsonnet-js-ts/dist/package.json
+++ b/jsonnet-js-ts/dist/package.json
@@ -1,10 +1,17 @@
{
"name": "tplfa-jsonnet",
- "version": "1.1.0",
- "description": "TS and JS bindings for Jsonnet",
+ "description": "TS and JS bindings for wasm-compiled-from-go [Jsonnet](https://jsonnet.org/) json templating. Works in Node.js and browser environments.",
+ "version": "1.2.0",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/olpa/templating-for-api.git"
+ },
"keywords": [
- "jsonnet"
+ "jsonnet",
+ "json",
+ "template"
],
- "author": "Oleg Parashchenko",
- "license": "MIT"
+ "author": "Oleg Parashchenko (https://uucode.com/)",
+ "license": "MIT",
+ "homepage": "https://github.com/olpa/templating-for-api/tree/master/jsonnet-js-ts"
}
diff --git a/tplfa-js/README.md b/tplfa-js/README.md
index b7be226..1650ac8 100644
--- a/tplfa-js/README.md
+++ b/tplfa-js/README.md
@@ -3,7 +3,7 @@
Installation:
```
-npm install https://github.com/olpa/templating-for-api/releases/download/tplfa-v1.1.1/tplfa-v1.1.1.tar.gz
+npm install https://github.com/olpa/templating-for-api/releases/download/tplfa-v1.1.2/tplfa-v1.1.2.tar.gz
```
## Client workflow
diff --git a/tplfa-js/changelog.md b/tplfa-js/changelog.md
index 07272e7..cf57027 100644
--- a/tplfa-js/changelog.md
+++ b/tplfa-js/changelog.md
@@ -1,5 +1,11 @@
# Changelog
+## [1.1.2] - 2024-10-14
+
+- Updgrade "apis" to "1.1.3"
+- Switch to npmjs version of "tplfa-jsonnet"
+
+
## [1.1.1] - 2024-10-02
- Loader of "tplfa-api" library files and templates
diff --git a/tplfa-js/dist/README.md b/tplfa-js/dist/README.md
index b7be226..1650ac8 100644
--- a/tplfa-js/dist/README.md
+++ b/tplfa-js/dist/README.md
@@ -3,7 +3,7 @@
Installation:
```
-npm install https://github.com/olpa/templating-for-api/releases/download/tplfa-v1.1.1/tplfa-v1.1.1.tar.gz
+npm install https://github.com/olpa/templating-for-api/releases/download/tplfa-v1.1.2/tplfa-v1.1.2.tar.gz
```
## Client workflow
diff --git a/tplfa-js/dist/changelog.md b/tplfa-js/dist/changelog.md
index 07272e7..cf57027 100644
--- a/tplfa-js/dist/changelog.md
+++ b/tplfa-js/dist/changelog.md
@@ -1,5 +1,11 @@
# Changelog
+## [1.1.2] - 2024-10-14
+
+- Updgrade "apis" to "1.1.3"
+- Switch to npmjs version of "tplfa-jsonnet"
+
+
## [1.1.1] - 2024-10-02
- Loader of "tplfa-api" library files and templates
diff --git a/tplfa-js/dist/package.json b/tplfa-js/dist/package.json
index 1e2b9a7..0546649 100644
--- a/tplfa-js/dist/package.json
+++ b/tplfa-js/dist/package.json
@@ -1,6 +1,6 @@
{
"name": "tplfa",
- "version": "1.1.1",
+ "version": "1.1.2",
"description": "Templating for APIs",
"scripts": {
"test": "jest",
@@ -12,8 +12,8 @@
"dependencies": {
"ajv": "^8.12.0",
"node-fetch": "^2.6.1",
- "tplfa-apis": "^1.1.1",
- "tplfa-jsonnet": "^1.1.0"
+ "tplfa-apis": "^1.1.3",
+ "tplfa-jsonnet": "^1.2.0"
},
"devDependencies": {
"@types/ajv": "^1.0.0",
diff --git a/tplfa-js/package-lock.json b/tplfa-js/package-lock.json
index e31dc58..7bf582a 100644
--- a/tplfa-js/package-lock.json
+++ b/tplfa-js/package-lock.json
@@ -12,7 +12,7 @@
"ajv": "^8.12.0",
"node-fetch": "^2.6.1",
"tplfa-apis": "file:../apis/dist",
- "tplfa-jsonnet": "file:../jsonnet-js-ts/dist"
+ "tplfa-jsonnet": "^1.2.0"
},
"devDependencies": {
"@types/ajv": "^1.0.0",
@@ -32,12 +32,7 @@
},
"../apis/dist": {
"name": "tplfa-apis",
- "version": "1.1.1",
- "license": "MIT"
- },
- "../jsonnet-js-ts/dist": {
- "name": "tplfa-jsonnet",
- "version": "1.1.0",
+ "version": "1.1.3",
"license": "MIT"
},
"node_modules/@ampproject/remapping": {
@@ -6793,8 +6788,10 @@
"link": true
},
"node_modules/tplfa-jsonnet": {
- "resolved": "../jsonnet-js-ts/dist",
- "link": true
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tplfa-jsonnet/-/tplfa-jsonnet-1.2.0.tgz",
+ "integrity": "sha512-WGAUPmohcYY5xxC1IUqNQ0+4D0XWgnesYZG/qd1jtCbNe0CNdRk00gtDEIYzjrFZqH0cIdYeldjkkgmeyvGOBA==",
+ "license": "MIT"
},
"node_modules/tr46": {
"version": "1.0.1",
diff --git a/tplfa-js/package.json b/tplfa-js/package.json
index 1995266..8f95b99 100644
--- a/tplfa-js/package.json
+++ b/tplfa-js/package.json
@@ -1,6 +1,6 @@
{
"name": "tplfa",
- "version": "1.1.1",
+ "version": "1.1.2",
"description": "Templating for APIs",
"scripts": {
"test": "jest",
@@ -13,7 +13,7 @@
"ajv": "^8.12.0",
"node-fetch": "^2.6.1",
"tplfa-apis": "file:../apis/dist",
- "tplfa-jsonnet": "file:../jsonnet-js-ts/dist"
+ "tplfa-jsonnet": "^1.2.0"
},
"devDependencies": {
"@types/ajv": "^1.0.0",