-
Notifications
You must be signed in to change notification settings - Fork 27
rewrite to esm and upgrade packages #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b887174
rewrite to esm and upgrade `got`
mifi a3dbce9
fix lint
mifi eca0c4e
upgrade the rest of packages
mifi c6b5f89
update doc
mifi 8ae51c9
export more
mifi e264005
fix ts deprecated syntax
mifi 45af319
fix proxy
mifi e920d7c
fix lint
mifi e849b4c
fix test
mifi ac9e9a3
yarn dedupe
mifi dcac2a7
remove try catch in exacmples
mifi e82d21b
fix exports
mifi 9d74f7d
remove redundant moduleResolution
mifi a351df4
add test for `error` field in GET assembly
mifi d8dbfc0
use tsconfig.build.json for prepack
mifi b30f254
refactor examples and script to ts
mifi b4e9514
require node 20
mifi eeaf6ff
lint
mifi 9781af7
use yarn exec
mifi cbb8f5b
Update test/generate-coverage-badge.ts
mifi 47653a3
use experimental-strip-types
mifi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,7 +58,6 @@ jobs: | |
| strategy: | ||
| matrix: | ||
| node: | ||
| - 18 | ||
| - 20 | ||
| - 22 | ||
| steps: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // Run this file as: | ||
| // | ||
| // env TRANSLOADIT_KEY=xxx TRANSLOADIT_SECRET=yyy node examples/convert_to_webp.js ./examples/fixtures/berkley.jpg | ||
| // | ||
| // You may need to build the project first using: | ||
| // | ||
| // yarn prepack | ||
| // | ||
| import { Transloadit } from 'transloadit' | ||
|
|
||
| const transloadit = new Transloadit({ | ||
| authKey: process.env.TRANSLOADIT_KEY!, | ||
| authSecret: process.env.TRANSLOADIT_SECRET!, | ||
| }) | ||
|
|
||
| const filePath = process.argv[2] | ||
|
|
||
| const status = await transloadit.createAssembly({ | ||
| files: { | ||
| file1: filePath, | ||
| }, | ||
| params: { | ||
| steps: { | ||
| webp: { | ||
| use: ':original', | ||
| robot: '/image/resize', | ||
| result: true, | ||
| imagemagick_stack: 'v2.0.7', | ||
| format: 'webp', | ||
| }, | ||
| }, | ||
| }, | ||
| waitForCompletion: true, | ||
| }) | ||
| console.log('Your WebP file:', status.results.webp[0].url) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| /* eslint-disable max-len */ | ||
| // Run this file as: | ||
| // | ||
| // env TRANSLOADIT_KEY=xxx TRANSLOADIT_SECRET=yyy node template_api.js | ||
| // | ||
| // You may need to build the project first using: | ||
| // | ||
| // yarn prepack | ||
| // | ||
| import { CreateTemplateCredentialParams, Transloadit } from 'transloadit' | ||
|
|
||
| const transloadit = new Transloadit({ | ||
| authKey: process.env.TRANSLOADIT_KEY!, | ||
| authSecret: process.env.TRANSLOADIT_SECRET!, | ||
| }) | ||
|
|
||
| const firstName = 'myProductionS3' | ||
| const secondName = 'myStagingS3' | ||
|
|
||
| const credentialParams: CreateTemplateCredentialParams = { | ||
| name: firstName, | ||
| type: 's3', | ||
| content: { | ||
| key: 'xyxy', | ||
| secret: 'xyxyxyxy', | ||
| bucket: 'mybucket.example.com', | ||
| bucket_region: 'us-east-1', | ||
| }, | ||
| } | ||
|
|
||
| console.log(`==> listTemplateCredentials`) | ||
| const { credentials } = await transloadit.listTemplateCredentials({ | ||
| sort: 'created', | ||
| order: 'asc', | ||
| }) | ||
| console.log('Successfully fetched', credentials.length, 'credential(s)') | ||
|
|
||
| // ^-- with Templates, there is `items` and `count`. | ||
| // with Credentials, there is `ok`, `message`, `credentials` | ||
|
|
||
| for (const credential of credentials) { | ||
| if ([firstName, secondName].includes(credential.name)) { | ||
| console.log(`==> deleteTemplateCredential: ${credential.id} (${credential.name})`) | ||
| const delResult = await transloadit.deleteTemplateCredential(credential.id) | ||
| console.log('Successfully deleted credential', delResult) | ||
| // ^-- identical structure between `Templates` and `Credentials` | ||
| } | ||
| } | ||
|
|
||
| console.log(`==> createTemplateCredential`) | ||
| const createTemplateCredentialResult = await transloadit.createTemplateCredential(credentialParams) | ||
| console.log('TemplateCredential created successfully:', createTemplateCredentialResult) | ||
| // ^-- with Templates, there is `ok`, `message`, `id`, `content`, `name`, `require_signature_auth`. Same is true for: created, updated, fetched | ||
| // with Credentials, there is `ok`, `message`, `credentials` <-- and a single object nested directly under it, which is unexpected with that plural imho. Same is true for created, updated, fetched | ||
|
|
||
| console.log( | ||
| `==> editTemplateCredential: ${createTemplateCredentialResult.credential.id} (${createTemplateCredentialResult.credential.name})` | ||
| ) | ||
| const editResult = await transloadit.editTemplateCredential( | ||
| createTemplateCredentialResult.credential.id, | ||
| { | ||
| ...credentialParams, | ||
| name: secondName, | ||
| } | ||
| ) | ||
| console.log('Successfully edited credential', editResult) | ||
| // ^-- see create | ||
|
|
||
| console.log( | ||
| `==> getTemplateCredential: ${createTemplateCredentialResult.credential.id} (${createTemplateCredentialResult.credential.name})` | ||
| ) | ||
| const getTemplateCredentialResult = await transloadit.getTemplateCredential( | ||
| createTemplateCredentialResult.credential.id | ||
| ) | ||
| console.log('Successfully fetched credential', getTemplateCredentialResult) | ||
| // ^-- not working at al, getting a 404. looking at the API, this is not implemented yet |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.