@forestryio/gql
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -10,3 +10,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _chunkD6JKHO7Xjs = require('./chunk.D6JKHO7X.js'); | ||
var _chunk3M5DZCYMjs = require('./chunk.3M5DZCYM.js'); | ||
@@ -79,5 +79,5 @@ // src/datasources/github-manager.ts | ||
const templates = await this.readDir(fullPath, this.dirLoader); | ||
return await _chunkD6JKHO7Xjs.sequential.call(void 0, templates, async (templateSlug) => await this.getTemplate(templateSlug.replace(".yml", ""))); | ||
return await _chunk3M5DZCYMjs.sequential.call(void 0, templates, async (templateSlug) => await this.getTemplate(templateSlug.replace(".yml", ""))); | ||
}; | ||
this.getTemplates = async (templateSlugs) => await _chunkD6JKHO7Xjs.sequential.call(void 0, templateSlugs, async (templateSlug) => await this.getTemplate(templateSlug)); | ||
this.getTemplates = async (templateSlugs) => await _chunk3M5DZCYMjs.sequential.call(void 0, templateSlugs, async (templateSlug) => await this.getTemplate(templateSlug)); | ||
this.getSettingsData = async () => { | ||
@@ -101,3 +101,3 @@ const {data} = await this.readFile(_path2.default.join(this.rootPath, tinaPath, "settings.yml"), this.loader); | ||
const sections = data.sections.filter((section2) => section2.type === "directory").map((section2) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, section2), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, section2), { | ||
slug: section2.name | ||
@@ -115,3 +115,3 @@ }); | ||
const sections = data.sections.filter((section2) => section2.type === "directory").map((section2) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, section2), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, section2), { | ||
slug: section2.name | ||
@@ -131,3 +131,3 @@ }); | ||
const sections = data.sections.filter((section) => section.type === "directory").map((section) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, section), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, section), { | ||
slug: section.name | ||
@@ -142,13 +142,13 @@ }); | ||
const sections = data.sections.map((section2) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, section2), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, section2), { | ||
slug: section2.name | ||
}); | ||
}); | ||
const templates = section ? (_a = sections.filter(_chunkD6JKHO7Xjs.byTypeWorks.call(void 0, "directory")).find((templateSection) => { | ||
const templates = section ? (_a = sections.filter(_chunk3M5DZCYMjs.byTypeWorks.call(void 0, "directory")).find((templateSection) => { | ||
return templateSection.slug === section; | ||
})) == null ? void 0 : _a.templates : _lodash2.default.flatten(sections.filter(_chunkD6JKHO7Xjs.byTypeWorks.call(void 0, "directory")).map(({templates: templates2}) => templates2)); | ||
})) == null ? void 0 : _a.templates : _lodash2.default.flatten(sections.filter(_chunk3M5DZCYMjs.byTypeWorks.call(void 0, "directory")).map(({templates: templates2}) => templates2)); | ||
if (!templates) { | ||
throw new Error(`No templates found for section`); | ||
} | ||
return await _chunkD6JKHO7Xjs.sequential.call(void 0, templates, async (templateBasename) => { | ||
return await _chunk3M5DZCYMjs.sequential.call(void 0, templates, async (templateBasename) => { | ||
return await this.getTemplate(templateBasename.replace(".yml", "")); | ||
@@ -178,3 +178,3 @@ }); | ||
const templates = await this.readDir(fullPath, this.dirLoader); | ||
const template = (await _chunkD6JKHO7Xjs.sequential.call(void 0, templates, async (template2) => { | ||
const template = (await _chunk3M5DZCYMjs.sequential.call(void 0, templates, async (template2) => { | ||
var _a; | ||
@@ -203,3 +203,3 @@ const data = await this.getTemplate(template2.replace(".yml", "")); | ||
const {data} = await this.readFile(_path2.default.join(fullPath, template), this.loader); | ||
return namespaceFields(_chunkD6JKHO7Xjs.__assign.call(void 0, {name: slug}, data)); | ||
return namespaceFields(_chunk3M5DZCYMjs.__assign.call(void 0, {name: slug}, data)); | ||
}; | ||
@@ -228,3 +228,3 @@ this.getTemplateWithoutName = async (slug, options = {namespace: true}) => { | ||
const path2 = _path2.default.join(sectionData.path, relativePath); | ||
const updatedTemplateData = _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, templateData), { | ||
const updatedTemplateData = _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, templateData), { | ||
pages: [...templateData.pages ? templateData.pages : [], path2] | ||
@@ -265,3 +265,3 @@ }); | ||
}); | ||
const {_body} = params, data = _chunkD6JKHO7Xjs.__rest.call(void 0, params, ["_body"]); | ||
const {_body} = params, data = _chunk3M5DZCYMjs.__rest.call(void 0, params, ["_body"]); | ||
const string = _graymatter2.default.stringify(` | ||
@@ -290,3 +290,3 @@ ${_body || ""}`, data); | ||
results[path2] = await getAndSetFromCache(repoConfig, path2, () => { | ||
return appOctoKit.repos.getContent(_chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, repoConfig), { | ||
return appOctoKit.repos.getContent(_chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, repoConfig), { | ||
path: path2 | ||
@@ -308,3 +308,3 @@ })).then((response) => { | ||
results[path2] = await getAndSetFromCache(repoConfig, path2, () => { | ||
return appOctoKit.repos.getContent(_chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, repoConfig), { | ||
return appOctoKit.repos.getContent(_chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, repoConfig), { | ||
path: path2 | ||
@@ -331,3 +331,3 @@ })).then((dirContents) => { | ||
try { | ||
const fileContent = await this.appOctoKit.repos.getContent(_chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, this.repoConfig), { | ||
const fileContent = await this.appOctoKit.repos.getContent(_chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, this.repoConfig), { | ||
path: path2 | ||
@@ -339,3 +339,3 @@ })); | ||
} | ||
const response = await this.appOctoKit.repos.createOrUpdateFileContents(_chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, this.repoConfig), { | ||
const response = await this.appOctoKit.repos.createOrUpdateFileContents(_chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, this.repoConfig), { | ||
path: path2, | ||
@@ -352,3 +352,3 @@ message: "Update from GraphQL client", | ||
async internalReadDir(path2) { | ||
const dirContents = await this.appOctoKit.repos.getContent(_chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, this.repoConfig), { | ||
const dirContents = await this.appOctoKit.repos.getContent(_chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, this.repoConfig), { | ||
path: path2 | ||
@@ -373,8 +373,8 @@ })); | ||
const namespaceFields = (template) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, template), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, template), { | ||
fields: template.fields.map((f) => { | ||
if (isWithFields(f)) { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, {}, namespaceSubFields(f, template.name)); | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, {}, namespaceSubFields(f, template.name)); | ||
} else { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, f), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, f), { | ||
__namespace: `${template.name}` | ||
@@ -387,10 +387,10 @@ }); | ||
const namespaceSubFields = (template, parentNamespace) => { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, template), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, template), { | ||
fields: template.fields.map((f) => { | ||
if (isWithFields(f)) { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, _chunkD6JKHO7Xjs.__assign.call(void 0, {}, namespaceSubFields(f, template.name)), { | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, _chunk3M5DZCYMjs.__assign.call(void 0, {}, namespaceSubFields(f, template.name)), { | ||
__namespace: `${parentNamespace}_${template.name}` | ||
}); | ||
} else { | ||
return _chunkD6JKHO7Xjs.__assign.call(void 0, {}, f); | ||
return _chunk3M5DZCYMjs.__assign.call(void 0, {}, f); | ||
} | ||
@@ -409,7 +409,7 @@ }), | ||
}) => { | ||
const datasource = new (0, _chunkD6JKHO7Xjs.FileSystemManager)(projectRoot); | ||
const cache3 = _chunkD6JKHO7Xjs.cacheInit.call(void 0, datasource); | ||
const datasource = new (0, _chunk3M5DZCYMjs.FileSystemManager)(projectRoot); | ||
const cache3 = _chunk3M5DZCYMjs.cacheInit.call(void 0, datasource); | ||
try { | ||
const {schema, sectionMap} = await _chunkD6JKHO7Xjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
const result = await _chunkD6JKHO7Xjs.graphqlInit.call(void 0, { | ||
const {schema, sectionMap} = await _chunk3M5DZCYMjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
const result = await _chunk3M5DZCYMjs.graphqlInit.call(void 0, { | ||
schema: _graphql.buildASTSchema.call(void 0, schema), | ||
@@ -428,5 +428,5 @@ source: query, | ||
const buildSchema = async (projectRoot) => { | ||
const datasource = new (0, _chunkD6JKHO7Xjs.FileSystemManager)(projectRoot); | ||
const cache3 = _chunkD6JKHO7Xjs.cacheInit.call(void 0, datasource); | ||
const {schema} = await _chunkD6JKHO7Xjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
const datasource = new (0, _chunk3M5DZCYMjs.FileSystemManager)(projectRoot); | ||
const cache3 = _chunk3M5DZCYMjs.cacheInit.call(void 0, datasource); | ||
const {schema} = await _chunk3M5DZCYMjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
return _graphql.buildASTSchema.call(void 0, schema); | ||
@@ -450,5 +450,5 @@ }; | ||
}); | ||
const cache3 = _chunkD6JKHO7Xjs.cacheInit.call(void 0, datasource); | ||
const {schema, sectionMap} = await _chunkD6JKHO7Xjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
const result = await _chunkD6JKHO7Xjs.graphqlInit.call(void 0, { | ||
const cache3 = _chunk3M5DZCYMjs.cacheInit.call(void 0, datasource); | ||
const {schema, sectionMap} = await _chunk3M5DZCYMjs.schemaBuilder.call(void 0, {cache: cache3}); | ||
const result = await _chunk3M5DZCYMjs.graphqlInit.call(void 0, { | ||
schema: _graphql.buildASTSchema.call(void 0, schema), | ||
@@ -455,0 +455,0 @@ source: query, |
/// <reference types="node" /> | ||
/** | ||
Copyright 2021 Forestry.io Inc | ||
Copyright 2021 Forestry.io Holdings, Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -5,0 +5,0 @@ you may not use this file except in compliance with the License. |
@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _chunkD6JKHO7Xjs = require('./chunk.D6JKHO7X.js'); | ||
var _chunk3M5DZCYMjs = require('./chunk.3M5DZCYM.js'); | ||
@@ -44,7 +44,7 @@ // src/server.ts | ||
let projectRoot = root ? root : _path2.default.join(fixturePath2, req.path); | ||
const datasource = new (0, _chunkD6JKHO7Xjs.FileSystemManager)(projectRoot); | ||
const cache2 = _chunkD6JKHO7Xjs.cacheInit.call(void 0, datasource); | ||
const {schema, sectionMap} = await _chunkD6JKHO7Xjs.schemaBuilder.call(void 0, {cache: cache2}); | ||
const datasource = new (0, _chunk3M5DZCYMjs.FileSystemManager)(projectRoot); | ||
const cache2 = _chunk3M5DZCYMjs.cacheInit.call(void 0, datasource); | ||
const {schema, sectionMap} = await _chunk3M5DZCYMjs.schemaBuilder.call(void 0, {cache: cache2}); | ||
await _fs2.default.writeFileSync(_path2.default.join(projectRoot, "ast-schema.graphql"), _graphql.print.call(void 0, schema)); | ||
const result = await _chunkD6JKHO7Xjs.graphqlInit.call(void 0, { | ||
const result = await _chunk3M5DZCYMjs.graphqlInit.call(void 0, { | ||
schema: _graphql.buildASTSchema.call(void 0, schema), | ||
@@ -51,0 +51,0 @@ source: query, |
{ | ||
"name": "@forestryio/gql", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
124244