Update the GraphQL Code Generator version (#291)
* Add missing plugin * Update GraphQL Code Generator
This commit is contained in:
parent
40e2299693
commit
e93a4dc1c8
17 changed files with 429 additions and 1528 deletions
13
.changeset/strange-jeans-fly.md
Normal file
13
.changeset/strange-jeans-fly.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
"saleor-app-emails-and-messages": patch
|
||||
"saleor-app-data-importer": patch
|
||||
"saleor-app-products-feed": patch
|
||||
"saleor-app-monitoring": patch
|
||||
"saleor-app-invoices": patch
|
||||
"saleor-app-klaviyo": patch
|
||||
"saleor-app-search": patch
|
||||
"saleor-app-slack": patch
|
||||
"saleor-app-taxes": patch
|
||||
---
|
||||
|
||||
Updated GraphQL Code Generator package
|
|
@ -42,11 +42,12 @@
|
|||
"zod": "^3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
query FetchAppDetails {
|
||||
app {
|
||||
id
|
||||
privateMetadata {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,14 +55,15 @@
|
|||
"zod": "^3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/html-to-text": "^9.0.0",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { PrivateMetadataAppConfigurator } from "./app-configurator";
|
||||
import { createSettingsManager } from "./metadata-manager";
|
||||
import { Client } from "urql";
|
||||
import { logger as pinoLogger } from "../../lib/logger";
|
||||
import { AppConfig, AppConfigurationPerChannel } from "./app-config";
|
||||
import { getDefaultEmptyAppConfiguration } from "./app-config-container";
|
||||
import { createSettingsManager } from "../../lib/metadata-manager";
|
||||
|
||||
const logger = pinoLogger.child({
|
||||
service: "AppConfigurationService",
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
import { MetadataEntry, EncryptedMetadataManager } from "@saleor/app-sdk/settings-manager";
|
||||
import { Client, gql } from "urql";
|
||||
import {
|
||||
FetchAppDetailsDocument,
|
||||
FetchAppDetailsQuery,
|
||||
UpdateAppMetadataDocument,
|
||||
} from "../../../generated/graphql";
|
||||
|
||||
gql`
|
||||
mutation UpdateAppMetadata($id: ID!, $input: [MetadataInput!]!) {
|
||||
updatePrivateMetadata(id: $id, input: $input) {
|
||||
item {
|
||||
privateMetadata {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
gql`
|
||||
query FetchAppDetails {
|
||||
app {
|
||||
id
|
||||
privateMetadata {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export async function fetchAllMetadata(client: Client): Promise<MetadataEntry[]> {
|
||||
const { error, data } = await client
|
||||
.query<FetchAppDetailsQuery>(FetchAppDetailsDocument, {})
|
||||
.toPromise();
|
||||
|
||||
if (error) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return data?.app?.privateMetadata.map((md) => ({ key: md.key, value: md.value })) || [];
|
||||
}
|
||||
|
||||
export async function mutateMetadata(client: Client, metadata: MetadataEntry[]) {
|
||||
// to update the metadata, ID is required
|
||||
const { error: idQueryError, data: idQueryData } = await client
|
||||
.query(FetchAppDetailsDocument, {})
|
||||
.toPromise();
|
||||
|
||||
if (idQueryError) {
|
||||
throw new Error(
|
||||
"Could not fetch the app id. Please check if auth data for the client are valid."
|
||||
);
|
||||
}
|
||||
|
||||
const appId = idQueryData?.app?.id;
|
||||
|
||||
if (!appId) {
|
||||
throw new Error("Could not fetch the app ID");
|
||||
}
|
||||
|
||||
const { error: mutationError, data: mutationData } = await client
|
||||
.mutation(UpdateAppMetadataDocument, {
|
||||
id: appId,
|
||||
input: metadata,
|
||||
})
|
||||
.toPromise();
|
||||
|
||||
if (mutationError) {
|
||||
throw new Error(`Mutation error: ${mutationError.message}`);
|
||||
}
|
||||
|
||||
return (
|
||||
mutationData?.updatePrivateMetadata?.item?.privateMetadata.map((md) => ({
|
||||
key: md.key,
|
||||
value: md.value,
|
||||
})) || []
|
||||
);
|
||||
}
|
||||
|
||||
export const createSettingsManager = (client: Client) => {
|
||||
// EncryptedMetadataManager gives you interface to manipulate metadata and cache values in memory.
|
||||
// We recommend it for production, because all values are encrypted.
|
||||
// If your use case require plain text values, you can use MetadataManager.
|
||||
return new EncryptedMetadataManager({
|
||||
// Secret key should be randomly created for production and set as environment variable
|
||||
encryptionKey: process.env.SECRET_KEY!,
|
||||
fetchMetadata: () => fetchAllMetadata(client),
|
||||
mutateMetadata: (metadata) => mutateMetadata(client, metadata),
|
||||
});
|
||||
};
|
|
@ -1,9 +1,9 @@
|
|||
import { MjmlConfigurator, PrivateMetadataMjmlConfigurator } from "./mjml-configurator";
|
||||
import { Client } from "urql";
|
||||
import { logger as pinoLogger } from "../../../lib/logger";
|
||||
import { createSettingsManager } from "../../app-configuration/metadata-manager";
|
||||
import { MjmlConfig, MjmlConfiguration } from "./mjml-config";
|
||||
import { FilterConfigurationsArgs, MjmlConfigContainer } from "./mjml-config-container";
|
||||
import { createSettingsManager } from "../../../lib/metadata-manager";
|
||||
|
||||
const logger = pinoLogger.child({
|
||||
service: "MjmlConfigurationService",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { PrivateMetadataSendgridConfigurator } from "./sendgrid-configurator";
|
||||
import { Client } from "urql";
|
||||
import { logger as pinoLogger } from "../../../lib/logger";
|
||||
import { createSettingsManager } from "../../app-configuration/metadata-manager";
|
||||
import { createSettingsManager } from "../../../lib/metadata-manager";
|
||||
|
||||
// todo test
|
||||
export class GetSendgridConfigurationService {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { sendgridConfigInputSchema } from "./sendgrid-config-input-schema";
|
|||
import { GetSendgridConfigurationService } from "./get-sendgrid-configuration.service";
|
||||
import { router } from "../../trpc/trpc-server";
|
||||
import { protectedClientProcedure } from "../../trpc/protected-client-procedure";
|
||||
import { createSettingsManager } from "../../app-configuration/metadata-manager";
|
||||
import { createSettingsManager } from "../../../lib/metadata-manager";
|
||||
|
||||
export const sendgridConfigurationRouter = router({
|
||||
fetch: protectedClientProcedure.query(async ({ ctx, input }) => {
|
||||
|
|
|
@ -48,14 +48,15 @@
|
|||
"zod": "^3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@types/node": "^18.8.1",
|
||||
"@types/react": "^18.0.27",
|
||||
"@types/react-dom": "^18.0.10",
|
||||
|
|
|
@ -34,14 +34,15 @@
|
|||
"urql": "^3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.7.0",
|
||||
"@graphql-codegen/introspection": "2.1.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.2.14",
|
||||
"@graphql-codegen/typescript": "2.6.0",
|
||||
"@graphql-codegen/typescript-operations": "2.4.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.5.13",
|
||||
"@graphql-codegen/urql-introspection": "2.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@types/node": "18.0.1",
|
||||
"@types/react": "18.0.14",
|
||||
"@types/react-dom": "18.0.6",
|
||||
|
|
|
@ -35,14 +35,15 @@
|
|||
"vitest": "^0.27.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18.11.18",
|
||||
|
|
|
@ -48,14 +48,15 @@
|
|||
"zod": "^3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18.11.18",
|
||||
|
|
|
@ -40,14 +40,15 @@
|
|||
"urql": "^3.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.11",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.6",
|
||||
"@graphql-codegen/typescript": "2.8.1",
|
||||
"@graphql-codegen/typescript-operations": "2.5.6",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@types/node": "^18.11.9",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/react-dom": "^18.0.8",
|
||||
|
|
|
@ -34,14 +34,15 @@
|
|||
"usehooks-ts": "^2.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.7.0",
|
||||
"@graphql-codegen/introspection": "2.1.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.2.14",
|
||||
"@graphql-codegen/typescript": "2.6.0",
|
||||
"@graphql-codegen/typescript-operations": "2.4.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.5.13",
|
||||
"@graphql-codegen/urql-introspection": "2.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@types/node": "^18.7.16",
|
||||
"@types/react": "^18.0.19",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
|
|
|
@ -48,14 +48,15 @@
|
|||
"zod": "^3.20.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "2.13.3",
|
||||
"@graphql-codegen/introspection": "2.2.1",
|
||||
"@graphql-codegen/typed-document-node": "^2.3.3",
|
||||
"@graphql-codegen/typescript": "2.7.3",
|
||||
"@graphql-codegen/typescript-operations": "2.5.3",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.0",
|
||||
"@graphql-codegen/cli": "3.2.2",
|
||||
"@graphql-codegen/introspection": "3.0.1",
|
||||
"@graphql-codegen/schema-ast": "^3.0.1",
|
||||
"@graphql-codegen/typed-document-node": "3.0.2",
|
||||
"@graphql-codegen/typescript": "3.0.2",
|
||||
"@graphql-codegen/typescript-operations": "3.0.2",
|
||||
"@graphql-codegen/typescript-urql": "^3.7.3",
|
||||
"@graphql-codegen/urql-introspection": "2.2.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.1",
|
||||
"@graphql-typed-document-node/core": "^3.1.2",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@types/node": "^18.8.1",
|
||||
|
|
1701
pnpm-lock.yaml
1701
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue