Skip to content

Commit

Permalink
fix(import-export-sdk): using correct queries on core next api
Browse files Browse the repository at this point in the history
  • Loading branch information
Plopix committed Jul 15, 2024
1 parent 1d62b35 commit 1fef6c7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 59 deletions.
2 changes: 1 addition & 1 deletion components/import-export-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crystallize/import-export-sdk",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"type": "module",
"exports": {
Expand Down
1 change: 0 additions & 1 deletion components/import-export-sdk/src/shape/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { updateShapeMutation } from './mutations/update.js';
import { getShapeQuery } from './queries/get.js';

export { getShapeQuery } from './queries/get.js';
export { getManyShapesQuery } from './queries/getMany.js';
export { createShapeMutation } from './mutations/create.js';
export { updateShapeMutation } from './mutations/update.js';

Expand Down
56 changes: 29 additions & 27 deletions components/import-export-sdk/src/shape/queries/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,38 @@ interface GetConfig {
}

const query = (config?: GetConfig) => `
query GET_SHAPE ($tenantId: ID!, $identifier: String!) {
query GET_SHAPE ($identifier: String!) {
shape(identifier: $identifier) {
identifier
name
type
${
config?.includeComponents
? `
components {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
... on Shape {
identifier
name
type
${
config?.includeComponents
? `
components {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
}
variantComponents {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
variantComponents {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
}
`
: ''
`
: ''
}
}
}
}
Expand Down
64 changes: 34 additions & 30 deletions components/import-export-sdk/src/shape/queries/getMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,45 @@ interface GetManyProps {}

interface GetManyConfig {
includeComponents?: boolean;
after?: string;
}

const query = (config?: GetManyConfig) => `
query GET_MANY_SHAPES {
shapes {
identifier
name
type
${
config?.includeComponents
? `
components {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
variantComponents {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
`
: ''
shapes(first: 100, after: "${config?.after}") {
edges {
node {
identifier
name
type
${
config?.includeComponents
? `
components {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
variantComponents {
id
name
description
type
config {
...basicComponentConfig
...structuralComponentConfig
}
}
`
: ''
}
}
}
}
}
Expand Down

0 comments on commit 1fef6c7

Please sign in to comment.