@typegraph/sdk
Advanced tools
Changelog
v0.4.2 - 2024-05-22
Fix fat CLI compilation
Bump to 0.4.2
Bump wasmtime to 21
Bump rust to 1.78.0
[x] The change comes with new or modified tests
[ ] Hard-to-understand functions have explanatory comments
[ ] End-user documentation is updated to reflect the change
Changelog
v0.4.1 - 2024-05-20
BaseError
class for structured messages in responsesNew Features
Updated Docker image versions and dependency versions to ensure compatibility and stability.
Bug Fixes
Enhanced error handling with specific error classes for more detailed error messages.
Refactor
Replaced generic Error
instances with specific error classes for
better error categorization.
Refactored error handling in HTTP response functions to use a
BaseError
class.
Chores
Updated version numbers across multiple configuration files to
0.4.1-0
.
Bug Fixes
Updated Docker image version for the typegate
service to ensure
stability and compatibility.
Documentation
Revised TAGLINE
for better clarity on supported languages: WASM,
Typescript, and Python.
Updated version declarations for improved consistency and functionality across multiple files.
some changes to comparison table(docs)
No Migrations Needed
<!-- 5. Readiness checklist - [ ] The change come with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change --> <!-- This is an auto-generated comment: release notes by coderabbit.ai -->TODO
comment in installation documentation.New Features
Updated platform support for better compatibility with "x86_64-linux".
Bug Fixes
Minor version updates across multiple configurations to enhance stability.
Chores
Updated version numbers from "0.4.0" to "0.4.1-0" across various files and configurations.
Refactor
Adjusted build and test scripts for improved efficiency and compatibility.
Documentation
Enhanced internal documentation to reflect version and platform changes.
Changelog
v0.4.0 - 2024-05-09
Fixes the broken nightly builds. Look at solved results here.
Nightly builds were broken due to oversight during the #571 fixes.
No changes required
Fix the NPM registry config in the Github tests.
<!-- 2. Explain below WHY the change cannot be made simpler --> <!-- 3. Explain below WHY the was made or link an issue number --> <!-- 4. Explain HOW users should update their code or remove that section -->N/A
<!-- 5. Readiness checklist - [ ] The change come with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change --> </details> <details > <summary> Set max log level based on verbose flag (<a href="https://github.com/metatypedev/metatype/pull/664">#664</a>) </summary>Set max log level based on verbose flag
n/a
Fix secret passing in examples and documentation.
Followup to #666.
N/A
Fix the CSS issue introduced by docusaurus 3.2.0 (https://github.com/facebook/docusaurus/issues/10005). 3.2.1 should fix it but the affected version maybe loaded by dependencies, so we will have to wait a bit more.
<!-- Explain WHY the was made or link an issue number --> <!-- Explain HOW users should update their code when required -->Remove log level override by the verbosity flag when no flag is present. It will default to the configured env_logger default level (or env variable).
<!-- 2. Explain below WHY the change cannot be made simpler -->...
<!-- 3. Explain below WHY the was made or link an issue number -->The default log level became "error" after #664, and RUST_LOG
environment variable where ignored.
N/A
<!-- 5. Readiness checklist - [ ] The change come with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change --> </details>Changing the intro.
<!-- Explain WHY the was made or link an issue number -->None.
<!-- Explain HOW users should update their code when required -->Add missing docs for tgDeploy
, tgRemove
None
Getting started with meta
cli should be easy
None
No Migration Needed
Improve /docs/tutorials/metatype-basics
No Migrations Needed
Better documentation
N/A
/guides/external-functions
page.N/A
N/A
Improves docs/reference/types
N/A
N/A
Architecture
section in docs.No Migration Needed
<!-- 5. Readiness checklist - [ ] The change come with new or modified tests - [ ] Hard-to-understand functions have explanatory comments - [ ] End-user documentation is updated to reflect the change --> </details>Delegate serialize, deploy, undeploy, unpack work to SDK.
Remove duplicate logic, thinking of cli as a convenience on top of the SDK.
When meta cli is used, Migration files are unpacked/resolved relative to
the typegraph's path, not the process's workdir
.
Adds a command to meta-cli
to invoke metagen.
MET-424
No changes required
Enable back codegen
on current cli implementation.
None
Make it more clear where failures happen
None
Enable support for wit and facilitate readiness for the upcoming specs.
#[wasmedge_bindgen]
are replaced by wit bindings.
In the old version we were restricted to#[wasmedge_bindgen]
, which was
only available in Rust and unique to WasmEdge.
#[wasmedge_bindgen]
fn add(a: u32, b: u32) -> u32 {
a + b
}
In the new implementation, wasm modules written in any language that
uses the wit
interface are now natively supported within typegate
.
// wit/example.wit
package example:host;
world host {
export add: func(a: u32, b: u32) -> u32;
}
An implementation (eg. in Rust) may look like this..
// src/lib.rs
wit_bindgen::generate!({ world: "host" });
struct MyLib;
impl Guest for MyLib {
fn add(a: u32, b: u32) -> u32 {
a + b
}
}
export!(MyLib);
Enables the DENO_V8_FLAGS
env var for tuning v8.
MET-435 or #621
Implements the general framework for metagen including a generator for rust based wasm mat functions modules.
MET-420
No breaking changes
Set what files/folders should be ignored when using the custom
expand_path
function in an external .tgignore
file.
.tgignore
will behave similarly to most .ignore files with basic glob
syntax support.
expand_glob
has been renamed to expand_path
The mdk codegen and typegraph mutually depends on each other (typegraph
needs a concrete mdk.wasm for hashing, and for the mdk.wasm to be built,
it needs type generation based on the typegraph)
Add a flag to enable processing a partial typegraph when using meta gen
(partial == no artifact resolution).
get_file_hash
has been moved to core sdk (under the name hash_file
)
Upload protocol for wasm files and atrifacts for WasmEdge Runtime
for
single replica mode
No Migrations Needed
Console.
N/A
Store the typegraph on s3 for multiple instance support mode.
Reduce Redis data.
Environment variables:
REDIS_URL
has been removedSYNC_REDIS_URL
, SYNC_S3_HOST
, SYNC_S3_REGION
, SYNC_S3_BUCKET
,
SYNC_S3_ACCESS_KEY
, SYNC_S3_SECRET_KEY
; and the following variables
are optional: SYNC_REDIS_PASSWORD
, SYNC_S3_PATH_STYLE
. Otherwise,
none of them can be set.Remove the ability to define secrets in the env vars of the typegate.
Secrets can now only be defined in the metatype config file and the
--secret
CLI option.
secrets.<tg_name>.key
:# before
typegates:
dev:
env:
TG_CONSOLE_POSTGRES_CONN: postgresql://postgres:password@localhost:5432/db?schema=console
TG_CONSOLE_BASIC_ADMIN: password
#after
typegates:
dev:
secrets:
console:
POSTGRES_CONN: postgresql://postgres:password@localhost:5432/db?schema=console
BASIC_ADMIN: password
# before
meta deploy -f my-tg.py --secret TG_CONSOLE_POSTGRES_CONN=postgresql://postgres:password@localhost:5432/db?schema=console
# after
meta deploy -f my-tg.py --secret POSTGRES_CONN=postgresql://postgres:password@localhost:5432/db?schema=console
# or - with the typegraph name
meta deploy -f my-tg.py --secret console:POSTGRES_CONN=postgresql://postgres:password@localhost:5432/db?schema=console
The queryPrismaModel
function on the typegate typegraph queries rows
from a prisma model.
Console.
N/A
Upload artifacts to S3 when sync-mode is enabled
Sharing artifacts between replicas without including it in the typegraph (and sync through redis)
No changes needed.
Track artifact/module dependencis for PythonRuntime
python.import(...)
and python.import_(...)
accept an optional parameter deps
that accepts list of dependencies for the python module.
Persisting deno runtime artifacts to a local/shared storage.
deno.import(...)
and deno.import_(...)
accept an optional parameter
that accepts list of dependencies for the deno/ts module.
Enable batch prisma queries (and transaction) in the typegate runtime
Console
AsyncDisposable
and
AsyncDisposableStack
Typegate
objectN/A
New Features
Updated artifact storage documentation to clarify management processes.
Bug Fixes
Removed outdated Deno import mapping settings to streamline development environment setup.
Documentation
Expanded documentation on artifact tracking and management, including reference counting and garbage collection mechanisms.
Refactor
Implemented interface changes in QueryEngine
for better async
disposal management.
Code restructuring in artifact management for enhanced performance and maintainability.
Chores
Adjusted settings and configurations in the development environment to align with current best practices.
Tests
Introduced new test cases for artifact upload and management functionalities.
Bumps version to release 0.4.0.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->componentize-py
based
component.Faster build time
Make sure to sync typegate/src/types.ts
when an update is made on the
typegraph schema.
Improve the temporal runtime exposing more parameters and adding more tests.
MET-397. The old implementation was bug-ridden and did not expose necessary params.
API changes to TemporalRuntime
ctor, methods and generated
materializers.
Pass the test options in the first parameter along with the test name/description.
Avoid scrolling to the end of the test function to see/update the test options.
N/A
Use verdaccio local npm registry for tests:
@typegraph/sdk
package is published to the local npm registry,
and can now be consumed like any npm package from Nodejs or Deno....
N/A
Changelog
v0.3.6 - 2024-03-14
add either, enum, struct and union type support in Random Runtime.
generating random values for enums, either and union types was failing.
_No Migrations Needed
Bug fix for typegate throwing vm not initialized
after reload
Bug fix
No Migrations Needed
Fix type validators for apply from context.
Bug.
N/A
.apply
Typegraph is too big sometimes.
Prepare release v0.3.6
N/A
N/A
Changelog
v0.3.5 - 2024-03-05
fix the issue where meta-cli deploy
command exits with code 0 on
failure.
bug fix
No changes needed.
Just a few very minor bugs I'd encountered this week. Tests pending.
Bugs.
No changes required
Check and throw the error for the expose
function when called from the
Python SDK.
We got a finalization failure when there are some unregistered type
referenced with g.ref
.
No changes needed.
Remove injections from generated output types for prisma operations.
Generated types fail validations (injection not allowed in output types).
No changes needed.
Enables v8 snapshots integration for meta typegate
subcommand and the
standalone typegate. Also bumps deno to 1.41.0.
Fixes and enables the broken job.
Job was disabled earlier to mysterious breakages.
No changes required
Add support for function or lambda definition typescript sdk for
deno.func
similarly to how python.from_def
in python sdk works.
Providing a string is a bit impractical and counter-intuitive espcially when the sdk language matches with runtime's language.
No changes needed.
Continuation of #566 , focused on prisma runtime.
N/A
This change includes changes in StringFormats(added some string formats), logic to provide random values for type nodes and tests to validate the changes. The changes are mostly in the typegraph sdk.
This feature enables the user to inject random values for a field(Type Node) when defining a Typegraph.
No changes needed.
<!-- Explain HOW users should update their code when required -->Since v5, where on unique queries exposes all the fields, not just unique fields.
</details> <details > <summary> Parameter transformation (<a href="https://github.com/metatypedev/metatype/pull/587">#587</a>) </summary>Enable parameter transformation with the .apply()
method.
It has more or less the same logic as .reduce()
with the ability to
flatten the input type.
This feature enables simpler APIs (input types) on top of runtimes (e.g.: prisma).
No changes needed.
If you access the context directly in your application (through the
token), access to nested fields shall be updated.
E.g. the expression context["profile.id"]
have to turned to
context.profile.id
.
Ready for release of v0.3.5
Required by console.
No changes required_.
Depends on #579
Compiled wasm
bin size is too large, goal is to reduce it to ~3MB.
N/A
Switch the default meta-cli
release to the fat version (the one that
includes the typegate
subcommand).
Changelog
v0.3.4 - 2024-02-10
The recent update to upload-artifact@v4
has some breaking changes as
described
here.
This PR addresses them. It also fixes the cross-compilation issues with
the meta-cli
job in the release workflow.
Issue in release workflow.
No changes required.
Small typo blocking the job that pushes the images to ghcr.io.
No changes required.
Adds a check step to the typegate
's Dockerfile
and converts the
.dockerignore
to be a whitelist.
The image for 0.3.3 has some files missing.
No changes required
mktmpd
when running in the typegate
images.cross
usage for all but the aarch64-unknown-linux-gnu
target in the meta-cli
release jobs. Deno doesn't like being cross
compiled, doesn't like being built by the cross toolchain in general
(even for the native target). The consequence of all this is that the
aarch64-unknown-linux-gnu
target will temporarily lack the full
version builds.The main TMP_DIR
was not created properly in the typegate
Dockerfile
.
No changes required
Skip fields with policies in findListQueries
.
Console.
N/A
Yes, another one lol. This removes the target
param from the release
builder which will default to the last stage of the Dockerfile, the
epoint
stage. I elected to remove the parameter rather than replacing
the value in order to remove one more place future changes will have to
consider. (convention better than configuration the saying goes (i
think)).
The typegate
images currently have the wrong target and thus the wrong
entrypoint
command.
No changes required
This mainly shuffles around the existing docs for better structure. Still a lot to be done. The following pages are also empty as I lack the info regarding their topics:
Super open to feedback. Bring up any points that you think should be mentioned on each page and I'll add them.
</details> <details > <summary> Getting started guide for the vscode extension (<a href="https://github.com/metatypedev/metatype/pull/578">#578</a>) </summary>Documentation is missing.
No changes needed.
Enable deploying directly from the typegraph instead of always relying on meta-cli.
N/A
Changelog
v0.3.3 - 2024-01-31
jco
output path is wrong.
N/A
Fix small typo. Surprised act
didn't catch this, it must evaluate
expressions lazily.
What it says on the tin can. Also fixes a typo in the vscode-extension
job.
Manual re-release breaks otherwise as seen here.
</details> <details > <summary> (ci) Typos in release.yml (<a href="https://github.com/metatypedev/metatype/pull/550">#550</a>) </summary>Oof, I can't believe I missed these. The publish steps are hard to test
locally with act
so ig they require extra scrutiny.
Bug on manual dispatch of releasae
wflow.
Another minor issue with the release workflow.
Failure in release run here.
</details> <details > <summary> (ci,release) Hack for broken arm64 builds, bump deno to 1.40.1, bump to 0.3.3 (<a href="https://github.com/metatypedev/metatype/pull/565">#565</a>) </summary>This provides a temporary fix for the broken build on arm64. The issue's
related to wasm-opt
builds not being availaible for install by
ghjk/cargo-binstall. This PR uses cargo install
directly instead when
in the dockerfile.
It also:
No changes required
loader_cmd
despite being set in get_loader_cmd
.setup
task in whiz.yaml
The old conditionals were faulty.
node
and bun
loaders are now run with the cwd
set to the
directory of the typegraph as opposed to the metatype.yml
file. This
should resolve settings to the nearest package.json
despite location.When using the dynamic import
function, if you provide it a raw path
like /foo/bar/baz
and deno detects the current module's loaded from a
remote host, it'll convert it to a http url. Reasonable behavior but it
turned out to be the cause of #560.
This pr fixes this issue along with:
main.ts
in a try/catch block for better error
logging.#560
No changes required
Pass the appropriate request URL and headers to the profiler resolver.
It used the provider url instead of the (typegate) request URL, causing internal queries to fail.
N/A
Sync template examples with latest 0.3.2.
Added missing deno.static
and func.rate(...)
on node.
N/A
dev/lock.yml
for automatic versioning.Failure to publish the extension.
Blank
Better organization + typescript examples.
N/A
Easier translation from python to typescript typegraph.
N/A
Adds support for more advanced id fields and unique constraints:
Support these kind of construct:
user = t.struct(
{
"authProvider": t.string().from_context("provider"),
"profileId": t.string().from_context("profile.id"),
# ...
},
config={"id": ["authProvider", "profileId"]},
).rename("User")
project = t.struct(
{
"id": t.uuid(as_id=True, config=["auto"]),
"owner": g.ref("Account"),
"name": t.string(min=3, pattern="^[A-Za-z_-]$"),
},
config={"unique": [["owner", "name"]]}
).rename("Project")
No migration needed.
Create an oauth2 token validation endpoint: /:tgName/auth/validate
.
Extend the typegate runtime with the following queries:
findListQueries
: find all the queries that returns a list of
t.struct
.Console.
N/A
Flatten profile fields in the context.
So instead of
{
provider: 'github',
accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
refreshToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
refreshAt: 1704717676,
profile: { id: '43663718' },
exp: 1707280877,
iat: 1704688876
}
we would have:
{
provider: 'github',
accessToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
refreshToken: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
refreshAt: 1704717676,
'profile.id': '43663718',
exp: 1707280877,
iat: 1704688876
}
It was impossible to get the nested id into a from_context
injection.
Now we can inject .from_context("profile.id")
.
vscode-extension
release jobProvides recovery path for when things break.
Doesn't affect end users.
Changelog
v0.3.2 - 2024-01-12
Configures the checkout
action step in the workflow that generates the
workflow to clone the full git history.
The updates to the release workflow that introduce git cliff based changelogs (back in #487) don't appear to be in effect.
No end user changes required.
iterChildStages
function. It does not yield accurate values
in some edge cases.GraphQLQuery
object.Sibling stages can be falsely registered as children, for example with the following stages:
getUser.id
getUser.identity
getUser.ideas
No migration needed.
Adds a simple LSP implementation for diagnostics.
Better DX, catch potential errors while editing the typegraph module.
Change deno frontend to pure node
Easier integration.
Enable custom profiler for the std (predefined) Oauth2 providers:
We may want for example to add the Github login in the profile in addition to the id.
No migration needed.
Limit the number of parallel loads.
The default max is the number of CPU cores, but it can be set with the
option --max-parallel-loads=N
.
When we have a high number of typegraphs, the loader processes exhaust the CPU load.
No migration needed.
Bump the version of all metatype libs to 0.3.2.
About to tag the next version.
Change their manifests to point at the new version.
Changelog
v0.2.4 - 2023-10-25
Fix lock.yml to set WASM_OPT_VERSION in whiz.yaml
</details> <details > <summary> Fix doc typegraphs deployment (<a href="https://github.com/metatypedev/metatype/pull/462">#462</a>) </summary> </details> <details > <summary> Set metatype version to v0.2.4 (<a href="https://github.com/metatypedev/metatype/pull/467">#467</a>) </summary> </details>The PolicyId for the public policy was cached in a class variable in Policy
.
The cache was not valid in a second typegraph defined in the same module.
Changelog
v0.2.3 - 2023-10-19
Solves MET-268 + fixes an edgecase for "weak validation"
</details>Injected fields are skipped when generating types for prisma.
Additional changes:
disconnect
, update
, upsert
, delete
, updateMany
, deleteMany
on
nested reletionships for create/update operations.