Skip to content

Commit

Permalink
(fix): burmp template resovler (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Jun 18, 2024
1 parent 0e124c9 commit 7fa2adb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fern-api/sdk",
"version": "0.10.1",
"version": "0.11.0",
"private": false,
"repository": "https://github.com/fern-api/fern-typescript",
"license": "MIT",
Expand All @@ -19,7 +19,7 @@
"node-fetch": "2.7.0",
"qs": "6.11.2",
"js-base64": "3.7.2",
"@fern-api/template-resolver": "0.5.2"
"@fern-api/template-resolver": "0.6.0"
},
"devDependencies": {
"@types/url-join": "4.0.1",
Expand Down
15 changes: 15 additions & 0 deletions src/wrapper/Template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ export class Template implements Fern.templates.EndpointSnippetTemplate {
return _innerResolver.resolve();
}

/**
* Resolves a particular request payload against the template to produce a snippet with
* formatting.
* @param payload the paylod to resolve against
* @returns the snippet
*/
public async resolveFormatted(payload: Fern.snippets.CustomSnippetPayload): Promise<Fern.snippets.Snippet> {
const _innerResolver = new SnippetTemplateResolver({
payload,
endpointSnippetTemplate: this.endpointSnippetTemplate,
});

return await _innerResolver.resolveWithFormatting();
}

public static from(template: Fern.templates.EndpointSnippetTemplate): Template {
return new Template(template.sdk, template.endpointId, template.snippetTemplate);
}
Expand Down
26 changes: 16 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@fern-api/template-resolver@0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@fern-api/template-resolver/-/template-resolver-0.5.2.tgz#da1a0d2ebed6787d200aee2218935f1ad0038e2a"
integrity sha512-YiV9/nsef5dLyMBolzx8SMhH6gdybsLaNabDxbkiT4x1Avizs+Eomui31pEoqGBcaUwI0gywTbeNhnNt+qVzHw==
"@fern-api/template-resolver@0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@fern-api/template-resolver/-/template-resolver-0.6.0.tgz#0b492da1397be3af8776a633cc9525bf5679a056"
integrity sha512-X+SMPlpjGn3ZYPQ/VMnjM4buTDbePFnzKAOr153n0ul2fTMbVt6pVs5y9GOc2wE1WbF4rvyzPF3e4DZnad7SkA==
dependencies:
lodash "^4.17.21"
"@wasm-fmt/ruff_fmt" "^0.5.10"
lodash-es "^4.17.21"

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
Expand Down Expand Up @@ -700,6 +701,11 @@
dependencies:
"@types/yargs-parser" "*"

"@wasm-fmt/ruff_fmt@^0.5.10":
version "0.5.10"
resolved "https://registry.yarnpkg.com/@wasm-fmt/ruff_fmt/-/ruff_fmt-0.5.10.tgz#7b9e788552e336d38971a39ad9a1c748795cdce6"
integrity sha512-PR0uVT1xGBJh9t22b2Hd7smFjlKygwN30DgDQ1QovFmZZiTkS7Y8yHiyMYsPKlbEko3Q2fnfCTJJOCZm8NqWWA==

abab@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"
Expand Down Expand Up @@ -1996,16 +2002,16 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"

lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==

lodash.memoize@4.x:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==

lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

lru-cache@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
Expand Down

0 comments on commit 7fa2adb

Please sign in to comment.