Skip to content

Commit

Permalink
feat(sdk)!: unify JS/TS imports (#926)
Browse files Browse the repository at this point in the history
<!--
Pull requests are squashed and merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog.
-->

<!-- 1. Explain WHAT the change is about -->

Solves
[MET-737](https://linear.app/metatypedev/issue/MET-737/unify-the-import-maps-across-package-registries-and-js-runtimes):
- [x] Unify JS/TS imports
- [ ] ~Add more test for the published packages: test JSR and NPM
packages on Nodejs and Deno, with the same typegraph definitions.~ (*on
a follow-up PR after the next release*)
- [x] Prepare for version 0.5.0-rc.7

<!-- 2. Explain WHY the change cannot be made simpler -->



<!-- 3. Explain HOW users should update their code -->

#### Migration notes

*BREAKING CHANGES*:
- TypeScript SDK imports for should be changed on Deno, removing the
`.ts` extension:
  - `@typegraph/sdk/index.ts` --> `@typegraph/sdk`
  - `@typegraph/sdk/*.ts` --> `@typegraph/sdk/*`

---

- [ ] The change comes with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
  • Loading branch information
Natoandro authored Nov 28, 2024
1 parent 2fbb49a commit 822437b
Show file tree
Hide file tree
Showing 116 changed files with 390 additions and 300 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exclude = [
]

[workspace.package]
version = "0.5.0-rc.6"
version = "0.5.0-rc.7"
edition = "2021"

[workspace.dependencies]
Expand Down
27 changes: 26 additions & 1 deletion examples/deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
{
"imports": {
"@typegraph/sdk/": "../src/typegraph/deno/src/"
"@typegraph/sdk/effects": "../src/typegraph/deno/src/effects.ts",
"@typegraph/sdk/envs/cli": "../src/typegraph/deno/src/envs/cli.ts",
"@typegraph/sdk": "../src/typegraph/deno/src/index.ts",
"@typegraph/sdk/io": "../src/typegraph/deno/src/io.ts",
"@typegraph/sdk/metagen": "../src/typegraph/deno/src/metagen.ts",
"@typegraph/sdk/params": "../src/typegraph/deno/src/params.ts",
"@typegraph/sdk/policy": "../src/typegraph/deno/src/policy.ts",
"@typegraph/sdk/providers/aws": "../src/typegraph/deno/src/providers/aws.ts",
"@typegraph/sdk/providers/prisma": "../src/typegraph/deno/src/providers/prisma.ts",
"@typegraph/sdk/providers/temporal": "../src/typegraph/deno/src/providers/temporal.ts",
"@typegraph/sdk/runtimes/deno": "../src/typegraph/deno/src/runtimes/deno.ts",
"@typegraph/sdk/runtimes/graphql": "../src/typegraph/deno/src/runtimes/graphql.ts",
"@typegraph/sdk/runtimes/grpc": "../src/typegraph/deno/src/runtimes/grpc.ts",
"@typegraph/sdk/runtimes/http": "../src/typegraph/deno/src/runtimes/http.ts",
"@typegraph/sdk/runtimes/kv": "../src/typegraph/deno/src/runtimes/kv.ts",
"@typegraph/sdk/runtimes/mod": "../src/typegraph/deno/src/runtimes/mod.ts",
"@typegraph/sdk/runtimes/python": "../src/typegraph/deno/src/runtimes/python.ts",
"@typegraph/sdk/runtimes/random": "../src/typegraph/deno/src/runtimes/random.ts",
"@typegraph/sdk/runtimes/substantial": "../src/typegraph/deno/src/runtimes/substantial.ts",
"@typegraph/sdk/runtimes/wasm": "../src/typegraph/deno/src/runtimes/wasm.ts",
"@typegraph/sdk/tg_artifact_upload": "../src/typegraph/deno/src/tg_artifact_upload.ts",
"@typegraph/sdk/tg_deploy": "../src/typegraph/deno/src/tg_deploy.ts",
"@typegraph/sdk/tg_manage": "../src/typegraph/deno/src/tg_manage.ts",
"@typegraph/sdk/typegraph": "../src/typegraph/deno/src/typegraph.ts",
"@typegraph/sdk/types": "../src/typegraph/deno/src/types.ts",
"@typegraph/sdk/wit": "../src/typegraph/deno/src/wit.ts"
},
"lint": {
"rules": {
Expand Down
6 changes: 3 additions & 3 deletions examples/templates/deno/api/example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Policy, t, typegraph } from "jsr:@typegraph/[email protected].6/index.ts";
import { PythonRuntime } from "jsr:@typegraph/[email protected].6/runtimes/python.ts";
import { DenoRuntime } from "jsr:@typegraph/[email protected].6/runtimes/deno.ts";
import { Policy, t, typegraph } from "jsr:@typegraph/[email protected].7";
import { PythonRuntime } from "jsr:@typegraph/[email protected].7/runtimes/python";
import { DenoRuntime } from "jsr:@typegraph/[email protected].7/runtimes/deno";

await typegraph("example", (g) => {
const pub = Policy.public();
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/deno/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.6
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.7
restart: always
ports:
- "7890:7890"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/node/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.6
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.7
restart: always
ports:
- "7890:7890"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "MCLI_LOADER_CMD='npm x tsx' meta dev"
},
"dependencies": {
"@typegraph/sdk": "^0.5.0-rc.6"
"@typegraph/sdk": "^0.5.0-rc.7"
},
"devDependencies": {
"tsx": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/python/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.6
image: ghcr.io/metatypedev/typegate:v0.5.0-rc.7
restart: always
ports:
- "7890:7890"
Expand Down
4 changes: 2 additions & 2 deletions examples/templates/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[tool.poetry]
name = "example"
version = "0.5.0-rc.6"
version = "0.5.0-rc.7"
description = ""
authors = []

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
typegraph = "0.5.0-rc.6"
typegraph = "0.5.0-rc.7"

[build-system]
requires = ["poetry-core"]
Expand Down
6 changes: 3 additions & 3 deletions examples/typegraphs/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { Auth } from "@typegraph/sdk/params.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { Auth } from "@typegraph/sdk/params";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

await typegraph(
{
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/backend-for-frontend.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { HttpRuntime } from "@typegraph/sdk/runtimes/http.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { HttpRuntime } from "@typegraph/sdk/runtimes/http";

// skip:end

Expand Down
6 changes: 3 additions & 3 deletions examples/typegraphs/basic.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { Auth } from "@typegraph/sdk/params.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { Auth } from "@typegraph/sdk/params";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

// skip:end

Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/cors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { RandomRuntime } from "@typegraph/sdk/runtimes/random.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { RandomRuntime } from "@typegraph/sdk/runtimes/random";

// skip:end

Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/database.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";

// isort: off
// skip:end
// highlight-next-line
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma";

await typegraph(
{
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/deno.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

// skip:end

Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/example_rest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

await typegraph(
{
Expand Down
10 changes: 5 additions & 5 deletions examples/typegraphs/execute.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts";
import { Auth } from "@typegraph/sdk/params.ts";
import * as effects from "@typegraph/sdk/effects.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma";
import { Auth } from "@typegraph/sdk/params";
import * as effects from "@typegraph/sdk/effects";

await typegraph(
{
Expand Down
6 changes: 3 additions & 3 deletions examples/typegraphs/faas-runner.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";
import { PythonRuntime } from "@typegraph/sdk/runtimes/python";

// skip:end

Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/files-upload.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { S3Runtime } from "@typegraph/sdk/providers/aws.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { S3Runtime } from "@typegraph/sdk/providers/aws";

await typegraph(
{
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/first-typegraph.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { RandomRuntime } from "@typegraph/sdk/runtimes/random.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { RandomRuntime } from "@typegraph/sdk/runtimes/random";

await typegraph(
{
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/func-ctx.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

await typegraph(
{
Expand Down
6 changes: 3 additions & 3 deletions examples/typegraphs/func-gql.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// skip:start
import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { fx, Policy, t, typegraph } from "@typegraph/sdk";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

await typegraph(
{
Expand Down
8 changes: 4 additions & 4 deletions examples/typegraphs/func.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { DenoRuntime } from "@typegraph/sdk/runtimes/deno";

// skip:start
import { Auth } from "@typegraph/sdk/params.ts";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts";
import { Auth } from "@typegraph/sdk/params";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma";
// skip:end

await typegraph(
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/graphql-server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { HttpRuntime } from "@typegraph/sdk/runtimes/http.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { HttpRuntime } from "@typegraph/sdk/runtimes/http";

// skip:end

Expand Down
6 changes: 3 additions & 3 deletions examples/typegraphs/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";
import { PrismaRuntime } from "@typegraph/sdk/providers/prisma";

// isort: off
// skip:end
// highlight-next-line
import { GraphQLRuntime } from "@typegraph/sdk/runtimes/graphql.ts";
import { GraphQLRuntime } from "@typegraph/sdk/runtimes/graphql";

await typegraph(
{
Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/grpc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// skip:start
import { Policy, typegraph } from "@typegraph/sdk/index.ts";
import { GrpcRuntime } from "@typegraph/sdk/runtimes/grpc.ts";
import { Policy, typegraph } from "@typegraph/sdk";
import { GrpcRuntime } from "@typegraph/sdk/runtimes/grpc";

// skip:end

Expand Down
4 changes: 2 additions & 2 deletions examples/typegraphs/http-runtime.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// skip:start
import { Policy, t, typegraph } from "@typegraph/sdk/index.ts";
import { Policy, t, typegraph } from "@typegraph/sdk";

// isort: off
// skip:end
// highlight-next-line
import { HttpRuntime } from "@typegraph/sdk/runtimes/http.ts";
import { HttpRuntime } from "@typegraph/sdk/runtimes/http";

await typegraph(
{
Expand Down
Loading

0 comments on commit 822437b

Please sign in to comment.