Skip to content
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

feat: add User model #466

Merged
merged 18 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/mighty-avengers-strike.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'@commercetools-test-data/user': minor
---

The package provides 2 type of models for Users: one targeting to User of the CoCo API and one targeting the User of the Merchant Center API (prefixed by `Mc`).

```ts
import {
// CoCo
User,
UserDraft,
type TUser,
type TUserDraft,

// MC
McUser,
McUserDraft,
type TMcUser,
type TMcUserDraft,
} from '@commercetools-test-data/user';

const user = User.random().buildRest<TUser>();
const userDraft = UserDraft.random().buildRest<TUserDraft>();

const mcUser = McUser.random().buildGraphql<TMcUser>();
const mcUserDraft = McUserDraft.random().buildGraphql<TMcUserDraft>();
```
5 changes: 5 additions & 0 deletions .changeset/smooth-suits-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-test-data/graphql-types': minor
---

Include Core and MC generated types to the package.
21 changes: 21 additions & 0 deletions codegen.core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
schema:
- '${MC_API_URL}/graphql':
headers:
Cookie: mcAccessToken=${MC_ACCESS_TOKEN}
X-Graphql-Target: administration
extensions:
codegen:
generates:
schemas/core.json:
plugins:
- introspection
graphql-types/src/generated/core.ts:
plugins:
- typescript
- typescript-operations
config:
typesPrefix: TCore
addUnderscoreToArgsType: true
hooks:
afterAllFileWrite:
- prettier --write
20 changes: 20 additions & 0 deletions codegen.mc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
schema:
- '${MC_API_URL}/graphql':
headers:
X-Graphql-Target: mc
extensions:
codegen:
generates:
schemas/mc.json:
plugins:
- introspection
graphql-types/src/generated/mc.ts:
plugins:
- typescript
- typescript-operations
config:
typesPrefix: TMc
addUnderscoreToArgsType: true
hooks:
afterAllFileWrite:
- prettier --write
Loading
Loading