@last-rev/app-config
Advanced tools
Comparing version
# @last-rev/app-config | ||
## 0.4.4 | ||
### Patch Changes | ||
- 165fc90: Updated apollo server to v4, enable configuration through LR config | ||
- 165fc90: Update dependencies | ||
## 0.4.3 | ||
@@ -4,0 +11,0 @@ |
@@ -52,2 +52,35 @@ /// <reference types="node" /> | ||
}; | ||
get apolloServerOptions(): Partial<import("@apollo/server").ApolloServerOptions<Context<{ | ||
loaders: import("packages/types").ContentfulLoaders; | ||
mappers: import("packages/types").Mappers; | ||
defaultLocale: string; | ||
typeMappings: import("packages/types").TypeMappings; | ||
loadEntriesForPath: import("packages/types").LoadEntriesForPathFunction; | ||
loadPathsForContent: import("packages/types").loadPathsForContentFunction; | ||
locale?: string | undefined; | ||
path?: string | undefined; | ||
locales: string[]; | ||
preview?: boolean | undefined; | ||
contentful: import("packages/types").ContentfulClients; | ||
pathReaders?: import("packages/types").PathReaders | undefined; | ||
displayType?: string | undefined; | ||
pathEntries?: import("packages/types").PathEntries | undefined; | ||
}>>> & { | ||
context?: import("@apollo/server").ContextFunction<any, Context<{ | ||
loaders: import("packages/types").ContentfulLoaders; | ||
mappers: import("packages/types").Mappers; | ||
defaultLocale: string; | ||
typeMappings: import("packages/types").TypeMappings; | ||
loadEntriesForPath: import("packages/types").LoadEntriesForPathFunction; | ||
loadPathsForContent: import("packages/types").loadPathsForContentFunction; | ||
locale?: string | undefined; | ||
path?: string | undefined; | ||
locales: string[]; | ||
preview?: boolean | undefined; | ||
contentful: import("packages/types").ContentfulClients; | ||
pathReaders?: import("packages/types").PathReaders | undefined; | ||
displayType?: string | undefined; | ||
pathEntries?: import("packages/types").PathEntries | undefined; | ||
}>> | undefined; | ||
}; | ||
get sites(): string[]; | ||
@@ -68,4 +101,5 @@ get paths(): { | ||
disableCoreSidekickLookup: boolean | undefined; | ||
disableFederatedSchema: boolean | undefined; | ||
}; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
import{__assign as e}from"tslib";import t from"lodash/merge";import i from"lodash/isNil";var o={cms:"Contentful",strategy:"fs",contentful:{env:"master",usePreview:!1},logLevel:"warn",graphql:{port:5e3,host:"localhost"},sites:[],features:{}},n=function(){function n(e){this.config=t({},o,e),this.validateCmsVars(),this.validateStrategy(),this.validatePaths()}return n.prototype.validateCmsVars=function(){var e,t,i;if("Contentful"!==this.config.cms)throw new Error("Invalid CMS: ".concat(this.config.cms));if(!(null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId))throw new Error("Contentful CMS: contentful.spaceId is required.");if(!(null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken))throw new Error("Contentful CMS: contentful.contentDeliveryToken is required.");if(!(null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken))throw new Error("Contentful CMS: contentful.contentPreviewToken is required.")},n.prototype.validateStrategy=function(){var e,t,i,o,n,r,s,a,c,d,l,f,g,u;if(this.config.contentStrategy)if("fs"===this.config.contentStrategy){if(!(null===(e=this.config.fs)||void 0===e?void 0:e.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else{if("cms"!==this.config.contentStrategy)throw new Error("Invalid contentStrategy: ".concat(this.config.contentStrategy));if("redis"===this.config.cmsCacheStrategy){if(!(null===(t=this.config.redis)||void 0===t?void 0:t.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(i=this.config.redis)||void 0===i?void 0:i.port))throw new Error("Redis strategy: redis.port is required")}else if("dynamodb"===this.config.cmsCacheStrategy){if(!(null===(o=this.config.dynamodb)||void 0===o?void 0:o.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(n=this.config.dynamodb)||void 0===n?void 0:n.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(r=this.config.dynamodb)||void 0===r?void 0:r.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(s=this.config.dynamodb)||void 0===s?void 0:s.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}else{if(!this.config.strategy)throw new Error("Must specify a content stratgy");if("fs"===this.config.strategy){if(!(null===(a=this.config.fs)||void 0===a?void 0:a.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else if("redis"===this.config.strategy){if(!(null===(c=this.config.redis)||void 0===c?void 0:c.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(d=this.config.redis)||void 0===d?void 0:d.port))throw new Error("Redis strategy: redis.port is required")}else{if("dynamodb"!==this.config.strategy)throw new Error("Invalid strategy: ".concat(this.config.strategy));if(!(null===(l=this.config.dynamodb)||void 0===l?void 0:l.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(f=this.config.dynamodb)||void 0===f?void 0:f.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(g=this.config.dynamodb)||void 0===g?void 0:g.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(u=this.config.dynamodb)||void 0===u?void 0:u.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}},n.prototype.validatePaths=function(){var e,t;if("v2"!==(null===(e=this.config.paths)||void 0===e?void 0:e.version)&&!1===(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree))throw new Error("Invalid paths configuration: generateFullPathTree must be true when using paths v1")},n.prototype.clone=function(e){return new n(t({},this.config,e))},Object.defineProperty(n.prototype,"jwtSigningSecret",{get:function(){return this.config.jwtSigningSecret},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentful",{get:function(){var e,t,i,o,n,r,s;return{spaceId:null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId,contentDeliveryToken:null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken,contentPreviewToken:null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken,env:null===(o=this.config.contentful)||void 0===o?void 0:o.env,usePreview:!!(null===(n=this.config.contentful)||void 0===n?void 0:n.usePreview),maxBatchSize:(null===(r=this.config.contentful)||void 0===r?void 0:r.maxBatchSize)||1e3,syncLimit:null===(s=this.config.contentful)||void 0===s?void 0:s.syncLimit}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"algolia",{get:function(){var e,t,i,o;return{applicationId:null===(e=this.config.algolia)||void 0===e?void 0:e.applicationId,adminApiKey:null===(t=this.config.algolia)||void 0===t?void 0:t.adminApiKey,contentTypeIds:null===(i=this.config.algolia)||void 0===i?void 0:i.contentTypeIds,indexDraftContent:!!(null===(o=this.config.algolia)||void 0===o?void 0:o.indexDraftContent)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"logLevel",{get:function(){return this.config.logLevel||"warn"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cms",{get:function(){return this.config.cms},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentStrategy",{get:function(){return this.config.contentStrategy?this.config.contentStrategy:"fs"!==this.config.strategy?"cms":"fs"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cmsCacheStrategy",{get:function(){return this.config.cmsCacheStrategy?this.config.cmsCacheStrategy:"cms"===this.config.contentStrategy?"none":(this.config.strategy,this.config.strategy)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fs",{get:function(){var e;return{contentDir:null===(e=this.config.fs)||void 0===e?void 0:e.contentDir}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"redis",{get:function(){var t,i;return e(e({},this.config.redis),{maxBatchSize:(null===(t=this.config.redis)||void 0===t?void 0:t.maxBatchSize)||1e3,ttlSeconds:(null===(i=this.config.redis)||void 0===i?void 0:i.ttlSeconds)||2592e3})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dynamodb",{get:function(){var e,t,i,o;return{region:null===(e=this.config.dynamodb)||void 0===e?void 0:e.region,accessKeyId:null===(t=this.config.dynamodb)||void 0===t?void 0:t.accessKeyId,secretAccessKey:null===(i=this.config.dynamodb)||void 0===i?void 0:i.secretAccessKey,tableName:null===(o=this.config.dynamodb)||void 0===o?void 0:o.tableName}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extensions",{get:function(){return this.config.extensions||{typeDefs:"",resolvers:{},mappers:{},typeMappings:{},pathsConfigs:{}}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"graphql",{get:function(){var e,t;return{port:null===(e=this.config.graphql)||void 0===e?void 0:e.port,host:null===(t=this.config.graphql)||void 0===t?void 0:t.host}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sites",{get:function(){return this.config.sites},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"paths",{get:function(){var e,t;return{version:(null===(e=this.config.paths)||void 0===e?void 0:e.version)||"v1",generateFullPathTree:(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree)||!0}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"skipReferenceFields",{get:function(){return!!i(this.config.skipReferenceFields)||this.config.skipReferenceFields},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sitemap",{get:function(){var e,t,i,o,n;return{domain:(null===(e=this.config.sitemap)||void 0===e?void 0:e.domain)||"",maxPageSize:(null===(t=this.config.sitemap)||void 0===t?void 0:t.maxPageSize)||1e3,indexRootPath:(null===(i=this.config.sitemap)||void 0===i?void 0:i.indexRootPath)||"/",pagesRootPath:(null===(o=this.config.sitemap)||void 0===o?void 0:o.pagesRootPath)||"/sitemap",excludePages:(null===(n=this.config.sitemap)||void 0===n?void 0:n.excludePages)||[]}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"features",{get:function(){var e,t;return(null===(e=this.config.features)||void 0===e?void 0:e.disableCoreSidekickLookup)||console.warn("The SidekickLookupResolver in the core is being deprecated. See how to migrate: https://lastrev.atlassian.net/wiki/spaces/KB/pages/108167187/Sidekick+Lookup+Migration"),{disableCoreSidekickLookup:null===(t=this.config.features)||void 0===t?void 0:t.disableCoreSidekickLookup}},enumerable:!1,configurable:!0}),n}();export{n as default}; | ||
import{__assign as e}from"tslib";import t from"lodash/merge";import i from"lodash/isNil";var o={cms:"Contentful",strategy:"fs",contentful:{env:"master",usePreview:!1},logLevel:"warn",graphql:{port:5e3,host:"localhost"},apolloServerOptions:{},sites:[],features:{}},n=function(){function n(e){this.config=t({},o,e),this.validateCmsVars(),this.validateStrategy(),this.validatePaths()}return n.prototype.validateCmsVars=function(){var e,t,i;if("Contentful"!==this.config.cms)throw new Error("Invalid CMS: ".concat(this.config.cms));if(!(null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId))throw new Error("Contentful CMS: contentful.spaceId is required.");if(!(null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken))throw new Error("Contentful CMS: contentful.contentDeliveryToken is required.");if(!(null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken))throw new Error("Contentful CMS: contentful.contentPreviewToken is required.")},n.prototype.validateStrategy=function(){var e,t,i,o,n,r,s,a,c,d,l,f,g,u;if(this.config.contentStrategy)if("fs"===this.config.contentStrategy){if(!(null===(e=this.config.fs)||void 0===e?void 0:e.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else{if("cms"!==this.config.contentStrategy)throw new Error("Invalid contentStrategy: ".concat(this.config.contentStrategy));if("redis"===this.config.cmsCacheStrategy){if(!(null===(t=this.config.redis)||void 0===t?void 0:t.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(i=this.config.redis)||void 0===i?void 0:i.port))throw new Error("Redis strategy: redis.port is required")}else if("dynamodb"===this.config.cmsCacheStrategy){if(!(null===(o=this.config.dynamodb)||void 0===o?void 0:o.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(n=this.config.dynamodb)||void 0===n?void 0:n.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(r=this.config.dynamodb)||void 0===r?void 0:r.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(s=this.config.dynamodb)||void 0===s?void 0:s.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}else{if(!this.config.strategy)throw new Error("Must specify a content stratgy");if("fs"===this.config.strategy){if(!(null===(a=this.config.fs)||void 0===a?void 0:a.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else if("redis"===this.config.strategy){if(!(null===(c=this.config.redis)||void 0===c?void 0:c.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(d=this.config.redis)||void 0===d?void 0:d.port))throw new Error("Redis strategy: redis.port is required")}else{if("dynamodb"!==this.config.strategy)throw new Error("Invalid strategy: ".concat(this.config.strategy));if(!(null===(l=this.config.dynamodb)||void 0===l?void 0:l.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(f=this.config.dynamodb)||void 0===f?void 0:f.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(g=this.config.dynamodb)||void 0===g?void 0:g.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(u=this.config.dynamodb)||void 0===u?void 0:u.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}},n.prototype.validatePaths=function(){var e,t;if("v2"!==(null===(e=this.config.paths)||void 0===e?void 0:e.version)&&!1===(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree))throw new Error("Invalid paths configuration: generateFullPathTree must be true when using paths v1")},n.prototype.clone=function(e){return new n(t({},this.config,e))},Object.defineProperty(n.prototype,"jwtSigningSecret",{get:function(){return this.config.jwtSigningSecret},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentful",{get:function(){var e,t,i,o,n,r,s;return{spaceId:null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId,contentDeliveryToken:null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken,contentPreviewToken:null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken,env:null===(o=this.config.contentful)||void 0===o?void 0:o.env,usePreview:!!(null===(n=this.config.contentful)||void 0===n?void 0:n.usePreview),maxBatchSize:(null===(r=this.config.contentful)||void 0===r?void 0:r.maxBatchSize)||1e3,syncLimit:null===(s=this.config.contentful)||void 0===s?void 0:s.syncLimit}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"algolia",{get:function(){var e,t,i,o;return{applicationId:null===(e=this.config.algolia)||void 0===e?void 0:e.applicationId,adminApiKey:null===(t=this.config.algolia)||void 0===t?void 0:t.adminApiKey,contentTypeIds:null===(i=this.config.algolia)||void 0===i?void 0:i.contentTypeIds,indexDraftContent:!!(null===(o=this.config.algolia)||void 0===o?void 0:o.indexDraftContent)}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"logLevel",{get:function(){return this.config.logLevel||"warn"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cms",{get:function(){return this.config.cms},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"contentStrategy",{get:function(){return this.config.contentStrategy?this.config.contentStrategy:"fs"!==this.config.strategy?"cms":"fs"},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cmsCacheStrategy",{get:function(){return this.config.cmsCacheStrategy?this.config.cmsCacheStrategy:"cms"===this.config.contentStrategy?"none":(this.config.strategy,this.config.strategy)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fs",{get:function(){var e;return{contentDir:null===(e=this.config.fs)||void 0===e?void 0:e.contentDir}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"redis",{get:function(){var t,i;return e(e({},this.config.redis),{maxBatchSize:(null===(t=this.config.redis)||void 0===t?void 0:t.maxBatchSize)||1e3,ttlSeconds:(null===(i=this.config.redis)||void 0===i?void 0:i.ttlSeconds)||2592e3})},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"dynamodb",{get:function(){var e,t,i,o;return{region:null===(e=this.config.dynamodb)||void 0===e?void 0:e.region,accessKeyId:null===(t=this.config.dynamodb)||void 0===t?void 0:t.accessKeyId,secretAccessKey:null===(i=this.config.dynamodb)||void 0===i?void 0:i.secretAccessKey,tableName:null===(o=this.config.dynamodb)||void 0===o?void 0:o.tableName}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"extensions",{get:function(){return this.config.extensions||{typeDefs:"",resolvers:{},mappers:{},typeMappings:{},pathsConfigs:{}}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"graphql",{get:function(){var e,t;return{port:null===(e=this.config.graphql)||void 0===e?void 0:e.port,host:null===(t=this.config.graphql)||void 0===t?void 0:t.host}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"apolloServerOptions",{get:function(){return this.config.apolloServerOptions||{}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sites",{get:function(){return this.config.sites},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"paths",{get:function(){var e,t;return{version:(null===(e=this.config.paths)||void 0===e?void 0:e.version)||"v1",generateFullPathTree:(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree)||!0}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"skipReferenceFields",{get:function(){return!!i(this.config.skipReferenceFields)||this.config.skipReferenceFields},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sitemap",{get:function(){var e,t,i,o,n;return{domain:(null===(e=this.config.sitemap)||void 0===e?void 0:e.domain)||"",maxPageSize:(null===(t=this.config.sitemap)||void 0===t?void 0:t.maxPageSize)||1e3,indexRootPath:(null===(i=this.config.sitemap)||void 0===i?void 0:i.indexRootPath)||"/",pagesRootPath:(null===(o=this.config.sitemap)||void 0===o?void 0:o.pagesRootPath)||"/sitemap",excludePages:(null===(n=this.config.sitemap)||void 0===n?void 0:n.excludePages)||[]}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"features",{get:function(){var e,t,i;return(null===(e=this.config.features)||void 0===e?void 0:e.disableCoreSidekickLookup)||console.warn("The SidekickLookupResolver in the core is being deprecated. See how to migrate: https://lastrev.atlassian.net/wiki/spaces/KB/pages/108167187/Sidekick+Lookup+Migration"),{disableCoreSidekickLookup:null===(t=this.config.features)||void 0===t?void 0:t.disableCoreSidekickLookup,disableFederatedSchema:null===(i=this.config.features)||void 0===i?void 0:i.disableFederatedSchema}},enumerable:!1,configurable:!0}),n}();export{n as default}; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("tslib"),t=require("lodash/merge"),i=require("lodash/isNil");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(t),r=o(i),s={cms:"Contentful",strategy:"fs",contentful:{env:"master",usePreview:!1},logLevel:"warn",graphql:{port:5e3,host:"localhost"},sites:[],features:{}},a=function(){function t(e){this.config=n.default({},s,e),this.validateCmsVars(),this.validateStrategy(),this.validatePaths()}return t.prototype.validateCmsVars=function(){var e,t,i;if("Contentful"!==this.config.cms)throw new Error("Invalid CMS: ".concat(this.config.cms));if(!(null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId))throw new Error("Contentful CMS: contentful.spaceId is required.");if(!(null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken))throw new Error("Contentful CMS: contentful.contentDeliveryToken is required.");if(!(null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken))throw new Error("Contentful CMS: contentful.contentPreviewToken is required.")},t.prototype.validateStrategy=function(){var e,t,i,o,n,r,s,a,c,d,l,f,g,u;if(this.config.contentStrategy)if("fs"===this.config.contentStrategy){if(!(null===(e=this.config.fs)||void 0===e?void 0:e.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else{if("cms"!==this.config.contentStrategy)throw new Error("Invalid contentStrategy: ".concat(this.config.contentStrategy));if("redis"===this.config.cmsCacheStrategy){if(!(null===(t=this.config.redis)||void 0===t?void 0:t.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(i=this.config.redis)||void 0===i?void 0:i.port))throw new Error("Redis strategy: redis.port is required")}else if("dynamodb"===this.config.cmsCacheStrategy){if(!(null===(o=this.config.dynamodb)||void 0===o?void 0:o.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(n=this.config.dynamodb)||void 0===n?void 0:n.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(r=this.config.dynamodb)||void 0===r?void 0:r.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(s=this.config.dynamodb)||void 0===s?void 0:s.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}else{if(!this.config.strategy)throw new Error("Must specify a content stratgy");if("fs"===this.config.strategy){if(!(null===(a=this.config.fs)||void 0===a?void 0:a.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else if("redis"===this.config.strategy){if(!(null===(c=this.config.redis)||void 0===c?void 0:c.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(d=this.config.redis)||void 0===d?void 0:d.port))throw new Error("Redis strategy: redis.port is required")}else{if("dynamodb"!==this.config.strategy)throw new Error("Invalid strategy: ".concat(this.config.strategy));if(!(null===(l=this.config.dynamodb)||void 0===l?void 0:l.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(f=this.config.dynamodb)||void 0===f?void 0:f.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(g=this.config.dynamodb)||void 0===g?void 0:g.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(u=this.config.dynamodb)||void 0===u?void 0:u.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}},t.prototype.validatePaths=function(){var e,t;if("v2"!==(null===(e=this.config.paths)||void 0===e?void 0:e.version)&&!1===(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree))throw new Error("Invalid paths configuration: generateFullPathTree must be true when using paths v1")},t.prototype.clone=function(e){return new t(n.default({},this.config,e))},Object.defineProperty(t.prototype,"jwtSigningSecret",{get:function(){return this.config.jwtSigningSecret},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentful",{get:function(){var e,t,i,o,n,r,s;return{spaceId:null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId,contentDeliveryToken:null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken,contentPreviewToken:null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken,env:null===(o=this.config.contentful)||void 0===o?void 0:o.env,usePreview:!!(null===(n=this.config.contentful)||void 0===n?void 0:n.usePreview),maxBatchSize:(null===(r=this.config.contentful)||void 0===r?void 0:r.maxBatchSize)||1e3,syncLimit:null===(s=this.config.contentful)||void 0===s?void 0:s.syncLimit}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"algolia",{get:function(){var e,t,i,o;return{applicationId:null===(e=this.config.algolia)||void 0===e?void 0:e.applicationId,adminApiKey:null===(t=this.config.algolia)||void 0===t?void 0:t.adminApiKey,contentTypeIds:null===(i=this.config.algolia)||void 0===i?void 0:i.contentTypeIds,indexDraftContent:!!(null===(o=this.config.algolia)||void 0===o?void 0:o.indexDraftContent)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"logLevel",{get:function(){return this.config.logLevel||"warn"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cms",{get:function(){return this.config.cms},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentStrategy",{get:function(){return this.config.contentStrategy?this.config.contentStrategy:"fs"!==this.config.strategy?"cms":"fs"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmsCacheStrategy",{get:function(){return this.config.cmsCacheStrategy?this.config.cmsCacheStrategy:"cms"===this.config.contentStrategy?"none":(this.config.strategy,this.config.strategy)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fs",{get:function(){var e;return{contentDir:null===(e=this.config.fs)||void 0===e?void 0:e.contentDir}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redis",{get:function(){var t,i;return e.__assign(e.__assign({},this.config.redis),{maxBatchSize:(null===(t=this.config.redis)||void 0===t?void 0:t.maxBatchSize)||1e3,ttlSeconds:(null===(i=this.config.redis)||void 0===i?void 0:i.ttlSeconds)||2592e3})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dynamodb",{get:function(){var e,t,i,o;return{region:null===(e=this.config.dynamodb)||void 0===e?void 0:e.region,accessKeyId:null===(t=this.config.dynamodb)||void 0===t?void 0:t.accessKeyId,secretAccessKey:null===(i=this.config.dynamodb)||void 0===i?void 0:i.secretAccessKey,tableName:null===(o=this.config.dynamodb)||void 0===o?void 0:o.tableName}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extensions",{get:function(){return this.config.extensions||{typeDefs:"",resolvers:{},mappers:{},typeMappings:{},pathsConfigs:{}}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphql",{get:function(){var e,t;return{port:null===(e=this.config.graphql)||void 0===e?void 0:e.port,host:null===(t=this.config.graphql)||void 0===t?void 0:t.host}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sites",{get:function(){return this.config.sites},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paths",{get:function(){var e,t;return{version:(null===(e=this.config.paths)||void 0===e?void 0:e.version)||"v1",generateFullPathTree:(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree)||!0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipReferenceFields",{get:function(){return!!r.default(this.config.skipReferenceFields)||this.config.skipReferenceFields},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sitemap",{get:function(){var e,t,i,o,n;return{domain:(null===(e=this.config.sitemap)||void 0===e?void 0:e.domain)||"",maxPageSize:(null===(t=this.config.sitemap)||void 0===t?void 0:t.maxPageSize)||1e3,indexRootPath:(null===(i=this.config.sitemap)||void 0===i?void 0:i.indexRootPath)||"/",pagesRootPath:(null===(o=this.config.sitemap)||void 0===o?void 0:o.pagesRootPath)||"/sitemap",excludePages:(null===(n=this.config.sitemap)||void 0===n?void 0:n.excludePages)||[]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"features",{get:function(){var e,t;return(null===(e=this.config.features)||void 0===e?void 0:e.disableCoreSidekickLookup)||console.warn("The SidekickLookupResolver in the core is being deprecated. See how to migrate: https://lastrev.atlassian.net/wiki/spaces/KB/pages/108167187/Sidekick+Lookup+Migration"),{disableCoreSidekickLookup:null===(t=this.config.features)||void 0===t?void 0:t.disableCoreSidekickLookup}},enumerable:!1,configurable:!0}),t}();module.exports=a; | ||
"use strict";var e=require("tslib"),t=require("lodash/merge"),i=require("lodash/isNil");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(t),r=o(i),s={cms:"Contentful",strategy:"fs",contentful:{env:"master",usePreview:!1},logLevel:"warn",graphql:{port:5e3,host:"localhost"},apolloServerOptions:{},sites:[],features:{}},a=function(){function t(e){this.config=n.default({},s,e),this.validateCmsVars(),this.validateStrategy(),this.validatePaths()}return t.prototype.validateCmsVars=function(){var e,t,i;if("Contentful"!==this.config.cms)throw new Error("Invalid CMS: ".concat(this.config.cms));if(!(null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId))throw new Error("Contentful CMS: contentful.spaceId is required.");if(!(null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken))throw new Error("Contentful CMS: contentful.contentDeliveryToken is required.");if(!(null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken))throw new Error("Contentful CMS: contentful.contentPreviewToken is required.")},t.prototype.validateStrategy=function(){var e,t,i,o,n,r,s,a,c,d,l,f,u,g;if(this.config.contentStrategy)if("fs"===this.config.contentStrategy){if(!(null===(e=this.config.fs)||void 0===e?void 0:e.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else{if("cms"!==this.config.contentStrategy)throw new Error("Invalid contentStrategy: ".concat(this.config.contentStrategy));if("redis"===this.config.cmsCacheStrategy){if(!(null===(t=this.config.redis)||void 0===t?void 0:t.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(i=this.config.redis)||void 0===i?void 0:i.port))throw new Error("Redis strategy: redis.port is required")}else if("dynamodb"===this.config.cmsCacheStrategy){if(!(null===(o=this.config.dynamodb)||void 0===o?void 0:o.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(n=this.config.dynamodb)||void 0===n?void 0:n.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(r=this.config.dynamodb)||void 0===r?void 0:r.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(s=this.config.dynamodb)||void 0===s?void 0:s.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}else{if(!this.config.strategy)throw new Error("Must specify a content stratgy");if("fs"===this.config.strategy){if(!(null===(a=this.config.fs)||void 0===a?void 0:a.contentDir))throw new Error("FS strategy: fs.contentDir is required")}else if("redis"===this.config.strategy){if(!(null===(c=this.config.redis)||void 0===c?void 0:c.host))throw new Error("Redis strategy: redis.host is required");if(!(null===(d=this.config.redis)||void 0===d?void 0:d.port))throw new Error("Redis strategy: redis.port is required")}else{if("dynamodb"!==this.config.strategy)throw new Error("Invalid strategy: ".concat(this.config.strategy));if(!(null===(l=this.config.dynamodb)||void 0===l?void 0:l.region))throw new Error("DynamoDB strategy: dynamodb.region is required");if(!(null===(f=this.config.dynamodb)||void 0===f?void 0:f.accessKeyId))throw new Error("DynamoDB strategy: dynamodb.accessKeyId is required");if(!(null===(u=this.config.dynamodb)||void 0===u?void 0:u.secretAccessKey))throw new Error("DynamoDB strategy: dynamodb.secretAccessKey is required");if(!(null===(g=this.config.dynamodb)||void 0===g?void 0:g.tableName))throw new Error("DynamoDB strategy: dynamodb.tableName is required")}}},t.prototype.validatePaths=function(){var e,t;if("v2"!==(null===(e=this.config.paths)||void 0===e?void 0:e.version)&&!1===(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree))throw new Error("Invalid paths configuration: generateFullPathTree must be true when using paths v1")},t.prototype.clone=function(e){return new t(n.default({},this.config,e))},Object.defineProperty(t.prototype,"jwtSigningSecret",{get:function(){return this.config.jwtSigningSecret},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentful",{get:function(){var e,t,i,o,n,r,s;return{spaceId:null===(e=this.config.contentful)||void 0===e?void 0:e.spaceId,contentDeliveryToken:null===(t=this.config.contentful)||void 0===t?void 0:t.contentDeliveryToken,contentPreviewToken:null===(i=this.config.contentful)||void 0===i?void 0:i.contentPreviewToken,env:null===(o=this.config.contentful)||void 0===o?void 0:o.env,usePreview:!!(null===(n=this.config.contentful)||void 0===n?void 0:n.usePreview),maxBatchSize:(null===(r=this.config.contentful)||void 0===r?void 0:r.maxBatchSize)||1e3,syncLimit:null===(s=this.config.contentful)||void 0===s?void 0:s.syncLimit}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"algolia",{get:function(){var e,t,i,o;return{applicationId:null===(e=this.config.algolia)||void 0===e?void 0:e.applicationId,adminApiKey:null===(t=this.config.algolia)||void 0===t?void 0:t.adminApiKey,contentTypeIds:null===(i=this.config.algolia)||void 0===i?void 0:i.contentTypeIds,indexDraftContent:!!(null===(o=this.config.algolia)||void 0===o?void 0:o.indexDraftContent)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"logLevel",{get:function(){return this.config.logLevel||"warn"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cms",{get:function(){return this.config.cms},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"contentStrategy",{get:function(){return this.config.contentStrategy?this.config.contentStrategy:"fs"!==this.config.strategy?"cms":"fs"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmsCacheStrategy",{get:function(){return this.config.cmsCacheStrategy?this.config.cmsCacheStrategy:"cms"===this.config.contentStrategy?"none":(this.config.strategy,this.config.strategy)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fs",{get:function(){var e;return{contentDir:null===(e=this.config.fs)||void 0===e?void 0:e.contentDir}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redis",{get:function(){var t,i;return e.__assign(e.__assign({},this.config.redis),{maxBatchSize:(null===(t=this.config.redis)||void 0===t?void 0:t.maxBatchSize)||1e3,ttlSeconds:(null===(i=this.config.redis)||void 0===i?void 0:i.ttlSeconds)||2592e3})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dynamodb",{get:function(){var e,t,i,o;return{region:null===(e=this.config.dynamodb)||void 0===e?void 0:e.region,accessKeyId:null===(t=this.config.dynamodb)||void 0===t?void 0:t.accessKeyId,secretAccessKey:null===(i=this.config.dynamodb)||void 0===i?void 0:i.secretAccessKey,tableName:null===(o=this.config.dynamodb)||void 0===o?void 0:o.tableName}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"extensions",{get:function(){return this.config.extensions||{typeDefs:"",resolvers:{},mappers:{},typeMappings:{},pathsConfigs:{}}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"graphql",{get:function(){var e,t;return{port:null===(e=this.config.graphql)||void 0===e?void 0:e.port,host:null===(t=this.config.graphql)||void 0===t?void 0:t.host}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"apolloServerOptions",{get:function(){return this.config.apolloServerOptions||{}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sites",{get:function(){return this.config.sites},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paths",{get:function(){var e,t;return{version:(null===(e=this.config.paths)||void 0===e?void 0:e.version)||"v1",generateFullPathTree:(null===(t=this.config.paths)||void 0===t?void 0:t.generateFullPathTree)||!0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"skipReferenceFields",{get:function(){return!!r.default(this.config.skipReferenceFields)||this.config.skipReferenceFields},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sitemap",{get:function(){var e,t,i,o,n;return{domain:(null===(e=this.config.sitemap)||void 0===e?void 0:e.domain)||"",maxPageSize:(null===(t=this.config.sitemap)||void 0===t?void 0:t.maxPageSize)||1e3,indexRootPath:(null===(i=this.config.sitemap)||void 0===i?void 0:i.indexRootPath)||"/",pagesRootPath:(null===(o=this.config.sitemap)||void 0===o?void 0:o.pagesRootPath)||"/sitemap",excludePages:(null===(n=this.config.sitemap)||void 0===n?void 0:n.excludePages)||[]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"features",{get:function(){var e,t,i;return(null===(e=this.config.features)||void 0===e?void 0:e.disableCoreSidekickLookup)||console.warn("The SidekickLookupResolver in the core is being deprecated. See how to migrate: https://lastrev.atlassian.net/wiki/spaces/KB/pages/108167187/Sidekick+Lookup+Migration"),{disableCoreSidekickLookup:null===(t=this.config.features)||void 0===t?void 0:t.disableCoreSidekickLookup,disableFederatedSchema:null===(i=this.config.features)||void 0===i?void 0:i.disableFederatedSchema}},enumerable:!1,configurable:!0}),t}();module.exports=a; |
@@ -1,2 +0,3 @@ | ||
import { Extensions } from '@last-rev/types'; | ||
import { ApolloContext, Extensions } from '@last-rev/types'; | ||
import { ApolloServerOptions, ContextFunction } from '@apollo/server'; | ||
import { LogLevelDesc } from 'loglevel'; | ||
@@ -47,2 +48,3 @@ import { RedisOptions } from 'ioredis'; | ||
}; | ||
apolloServerOptions?: LRApolloServerOptions; | ||
sites: string[]; | ||
@@ -63,4 +65,8 @@ skipReferenceFields: boolean; | ||
disableCoreSidekickLookup?: boolean; | ||
disableFederatedSchema?: boolean; | ||
}; | ||
} | ||
declare type LRApolloServerOptions = Partial<ApolloServerOptions<ApolloContext>> & { | ||
context?: ContextFunction<any, ApolloContext>; | ||
}; | ||
export declare type LastRevAppConfigArgs = { | ||
@@ -106,2 +112,3 @@ cms?: 'Contentful'; | ||
}; | ||
apolloServerOptions?: LRApolloServerOptions; | ||
sites?: string[]; | ||
@@ -122,4 +129,6 @@ skipReferenceFields?: boolean; | ||
disableCoreSidekickLookup?: boolean; | ||
disableFederatedSchema?: boolean; | ||
}; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@last-rev/app-config", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "", | ||
@@ -18,3 +18,3 @@ "main": "dist/index.js", | ||
"@last-rev/testing-library": "^0.1.10", | ||
"@last-rev/types": "^0.3.2", | ||
"@last-rev/types": "^0.3.3", | ||
"ioredis": "^5.0.4", | ||
@@ -21,0 +21,0 @@ "jest": "^26.6.3", |
@@ -17,2 +17,3 @@ import { LastRevAppConfigArgs, LastRevAppConfiguration } from './types'; | ||
}, | ||
apolloServerOptions: {}, | ||
sites: [], | ||
@@ -212,2 +213,5 @@ features: {} | ||
} | ||
get apolloServerOptions() { | ||
return this.config.apolloServerOptions || {}; | ||
} | ||
@@ -247,5 +251,6 @@ get sites() { | ||
return { | ||
disableCoreSidekickLookup: this.config.features?.disableCoreSidekickLookup | ||
disableCoreSidekickLookup: this.config.features?.disableCoreSidekickLookup, | ||
disableFederatedSchema: this.config.features?.disableFederatedSchema | ||
}; | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
import { Extensions } from '@last-rev/types'; | ||
import { ApolloContext, Extensions } from '@last-rev/types'; | ||
import { ApolloServerOptions, ContextFunction } from '@apollo/server'; | ||
import { LogLevelDesc } from 'loglevel'; | ||
@@ -50,2 +51,3 @@ import { RedisOptions } from 'ioredis'; | ||
}; | ||
apolloServerOptions?: LRApolloServerOptions; | ||
sites: string[]; | ||
@@ -66,5 +68,9 @@ skipReferenceFields: boolean; | ||
disableCoreSidekickLookup?: boolean; | ||
disableFederatedSchema?: boolean; | ||
}; | ||
} | ||
type LRApolloServerOptions = Partial<ApolloServerOptions<ApolloContext>> & { | ||
context?: ContextFunction<any, ApolloContext>; | ||
}; | ||
export type LastRevAppConfigArgs = { | ||
@@ -113,2 +119,3 @@ cms?: 'Contentful'; | ||
}; | ||
apolloServerOptions?: LRApolloServerOptions; | ||
sites?: string[]; | ||
@@ -129,3 +136,4 @@ skipReferenceFields?: boolean; | ||
disableCoreSidekickLookup?: boolean; | ||
disableFederatedSchema?: boolean; | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
60620
6.31%1063
5.77%