diff --git a/components/import-export-sdk/package.json b/components/import-export-sdk/package.json index 124948d7..bf6d7888 100644 --- a/components/import-export-sdk/package.json +++ b/components/import-export-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@crystallize/import-export-sdk", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "type": "module", "exports": { diff --git a/components/import-export-sdk/src/shape/index.ts b/components/import-export-sdk/src/shape/index.ts index 193b641d..358395cb 100644 --- a/components/import-export-sdk/src/shape/index.ts +++ b/components/import-export-sdk/src/shape/index.ts @@ -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'; diff --git a/components/import-export-sdk/src/shape/queries/get.ts b/components/import-export-sdk/src/shape/queries/get.ts index ebbe301d..91b7d22a 100644 --- a/components/import-export-sdk/src/shape/queries/get.ts +++ b/components/import-export-sdk/src/shape/queries/get.ts @@ -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 + } } - } - ` - : '' + ` + : '' + } } } } diff --git a/components/import-export-sdk/src/shape/queries/getMany.ts b/components/import-export-sdk/src/shape/queries/getMany.ts index 4dae0173..fc42470a 100644 --- a/components/import-export-sdk/src/shape/queries/getMany.ts +++ b/components/import-export-sdk/src/shape/queries/getMany.ts @@ -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 + } + } + ` + : '' + } + } } - } }