![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@compassdigital/service
Advanced tools
A library for building internal microservices for Compass Digital.
A library for building internal microservices for Compass Digital.
npm install @compassdigital/service --save
The Service class has the following functions available that can be called directly from AWS Lambda via the service instance's "lambda" property. See Usage below.
The function catchall will call back to an appropriate provider with a method based on the query path.
For example, in Serverless you would setup catchall like this.
functions:
get_menu:
handler: lambda.catchall
events:
- http:
path: menu/{id}
method: get
The provider is chosen based on the "provider" params encoded in the (compassdigital.id) id of the request. To learn more about ids, visit the project compassdigital/compassdigital.id.
The query path is parsed to create a provider method based on the HTTP method, HTTP path, and AWS Lambda event path (configured in Serverless) . Examples:
Service request:
Provider request:
Service request:
Provider request:
// commonjs
const Service = require("@compassdigital/service").default;
const MyService = new Service({
type: "menu",
swagger: {...}, // Swagger 2
request_validation: true, // validates request payloads against swagger schema
});
module.exports = MyService;
// esm
import Service from '@compassdigital/service';
const MyService = new Service({
type: "menu",
swagger: {...} // Swagger 2
});
export default MyService;
Request validations can be enabled on per handler basis by providing an object instead.
const Service = require("@compassdigital/service").default;
const MyService = new Service({
type: "mealplan",
swagger: {...},
request_validation: {
post_test_handler: true,
},
});
module.exports = MyService;
// const MyService = require('./lib'); //commonjs
const MyService = require('./lib').default; // esm
module.exports = MyService.lambda;
You can pass the URL of the provider
service.add_provider({
id: 'PROVIDER_NAME',
url: 'https://www.example.com/',
default: true, // Optional: uses this provider for requests without a provider specified
});
or pass a reference to a DataProvider:
service.add_provider({
id: "PROVIDER_NAME",
provider: new DataProvider(...) // compassdigital.provider.data
default: true // Optional: uses this provider for requests without a provider specified
});
Optionally, you can also pass request_validation
at the provider level. This will override request validation configuration from service level.
npm test
Install via npm in the root of your Serverless service:
npm install @compassdigital/serverless-plugin-cdl --save-dev
plugins
array in your Serverless serverless.yml
:plugins:
- '@compassdigital/serverless-plugin-cdl'
That's it!
The service will log all requests and responses. By default, individual property values on objects are truncated to 200 characters. This limit can be controlled with the LOG_MAX_DATA_LENGTH
environment variable.
Note: Unbounded logging has associated costs. The limit should only be lifted temporarily for debugging purposes.
FAQs
A library for building internal microservices for Compass Digital.
The npm package @compassdigital/service receives a total of 12 weekly downloads. As such, @compassdigital/service popularity was classified as not popular.
We found that @compassdigital/service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 56 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.