Move vendors in a dedicated package

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-05-01 14:49:32 -07:00
parent f3344f2c87
commit 8b313c2cf4
12 changed files with 5883 additions and 2322 deletions

View File

@@ -12,6 +12,7 @@
},
"dependencies": {
"@probo/react-lazy": "^0.1.0",
"@probo/vendors": "^0.0.1",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-checkbox": "^1.0.4",

File diff suppressed because it is too large Load Diff

View File

@@ -29,24 +29,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
interface VendorData {
name: string;
headquarterAddress: string;
legalName: string;
websiteUrl: string;
privacyPolicyUrl: string;
serviceLevelAgreementUrl?: string;
category: string;
dataProcessingAgreementUrl?: string;
description: string;
categories: string[];
certifications: string[];
securityPageUrl?: string;
trustPageUrl?: string;
statusPageUrl?: string;
termsOfServiceUrl?: string;
}
import { Vendor, Vendors } from "@probo/vendors";
const ITEMS_PER_PAGE = 25;
@@ -214,8 +197,8 @@ function ListVendorContent({
const [, startTransition] = useTransition();
const [searchTerm, setSearchTerm] = useState("");
const [showAddVendorDropdown, setShowAddVendorDropdown] = useState(false);
const [filteredVendors, setFilteredVendors] = useState<VendorData[]>([]);
const [vendorsData, setVendorsData] = useState<VendorData[]>([]);
const [filteredVendors, setFilteredVendors] = useState<Vendors>([]);
const [vendorsData, setVendorsData] = useState<Vendors>([]);
const [isLoadingVendors, setIsLoadingVendors] = useState(false);
const [createVendor] =
useMutation<ListVendorViewCreateVendorMutation>(createVendorMutation);
@@ -227,12 +210,8 @@ function ListVendorContent({
const loadVendorsData = async () => {
try {
setIsLoadingVendors(true);
const response = await fetch("/data/vendors/vendors.json");
if (!response.ok) {
throw new Error("Failed to load vendors data");
}
const data = await response.json();
setVendorsData(data);
const { default: vendors } = await import("@probo/vendors");
setVendorsData(vendors);
} catch (error) {
console.error("Error loading vendors data:", error);
toast({
@@ -265,7 +244,7 @@ function ListVendorContent({
vendorsConnection.vendors.edges.map((edge) => edge.node) ?? [];
const pageInfo = vendorsConnection.vendors.pageInfo;
const fuse = new Fuse<VendorData>(vendorsData, {
const fuse = new Fuse<Vendor>(vendorsData, {
keys: ["name"],
threshold: 0.3,
});

10
package-lock.json generated
View File

@@ -19,6 +19,7 @@
"version": "0.0.1",
"dependencies": {
"@probo/react-lazy": "^0.1.0",
"@probo/vendors": "^0.0.1",
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-checkbox": "^1.0.4",
@@ -2525,6 +2526,10 @@
"resolved": "packages/tsconfig",
"link": true
},
"node_modules/@probo/vendors": {
"resolved": "packages/vendors",
"link": true
},
"node_modules/@radix-ui/colors": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@radix-ui/colors/-/colors-3.0.0.tgz",
@@ -10100,6 +10105,11 @@
"name": "@probo/tsconfig",
"version": "0.0.1",
"license": "MIT"
},
"packages/vendors": {
"name": "@probo/vendors",
"version": "0.0.1",
"license": "CC BY-SA 4.0"
}
}
}

View File

@@ -9,7 +9,7 @@
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,

View File

@@ -1,6 +1,6 @@
# Vendors Data
# Vendors
The [vendors.json](vendors.json) file contains data about various vendors and their security certifications. This data is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
The [vendors.json](vendors.json) file and derived files contains data about various vendors and their security certifications. This data is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
## License Requirements

37
packages/vendors/README.md vendored Normal file
View File

@@ -0,0 +1,37 @@
# Vendors library
A curated collection of software vendor information for use in vendor management and compliance activities.
## Overview
This package provides a structured dataset of software vendors and service providers with comprehensive metadata including:
- Basic vendor information (name, website, description)
- Legal documentation URLs (privacy policy, terms of service, etc.)
- Compliance certifications
- Security information
## Data Structure
Each vendor entry follows the structure defined in `data.d.ts`, including fields for:
- `name`: Display name of the vendor
- `legalName`: Legal business name
- `websiteUrl`: Vendor's website
- `privacyPolicyUrl`: URL to privacy policy
- `termsOfServiceUrl`: URL to terms of service
- And many more compliance-related URLs and metadata
See `data.d.ts` for the complete type definition.
### Building the Markdown Documentation
To generate the VENDORS.md documentation file from the data:
```bash
npm run build:md
```
## License
CC BY-SA 4.0 - See LICENSE.md for details.

3333
packages/vendors/VENDORS.md vendored Normal file

File diff suppressed because it is too large Load Diff

72
packages/vendors/data.d.ts vendored Normal file
View File

@@ -0,0 +1,72 @@
/**
* Type definitions for vendor data
*/
/**
* Represents a software vendor or service provider with associated metadata
*/
export interface Vendor {
/** Display name of the vendor */
name: string;
/** Legal business name of the vendor */
legalName?: string;
/** Physical headquarters address */
headquarterAddress?: string;
/** Vendor's website URL */
websiteUrl: string;
/** URL to vendor's privacy policy */
privacyPolicyUrl?: string;
/** URL to vendor's terms of service */
termsOfServiceUrl?: string;
/** URL to vendor's service level agreement */
serviceLevelAgreementUrl?: string;
/** URL to service software agreement */
serviceSoftwareAgreementUrl?: string;
/** URL to vendor's data processing agreement */
dataProcessingAgreementUrl?: string;
/** URL to vendor's list of subprocessors */
subprocessorsListUrl?: string;
/** URL to vendor's business associate agreement */
businessAssociateAgreementUrl?: string;
/** Short description of the vendor/service */
description?: string;
/** Primary category for the vendor */
category?: string;
/** Security or compliance certifications held by the vendor */
certifications?: string[];
/** URL to vendor's security page */
securityPageUrl?: string;
/** URL to vendor's trust page */
trustPageUrl?: string;
/** URL to vendor's status page */
statusPageUrl?: string;
}
/**
* Array of vendor data
*/
export type Vendors = Vendor[];
/**
* Default export representing the entire vendor dataset
*/
declare const data: Vendors;
export default data;

2293
packages/vendors/data.json vendored Normal file

File diff suppressed because it is too large Load Diff

21
packages/vendors/package.json vendored Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "@probo/vendors",
"version": "0.0.1",
"publishConfig": {
"access": "public"
},
"files": [
"data.json",
"LICENSE.md"
],
"scripts": {
"build:md": "node scripts/build-md.mjs"
},
"exports": {
".": {
"types": "./data.d.ts",
"default": "./data.json"
}
},
"license": "CC BY-SA 4.0"
}

107
packages/vendors/scripts/build-md.mjs vendored Normal file
View File

@@ -0,0 +1,107 @@
import { readFile, writeFile } from "node:fs/promises";
import { createWriteStream } from "node:fs";
import path from "node:path";
const data = await readFile(path.join(import.meta.dirname, '../data.json'), 'utf8');
const vendors = JSON.parse(data);
const output = path.join(import.meta.dirname, '../VENDORS.md')
const file = createWriteStream(output);
const formatAsList = (array) => {
if (!array || array.length === 0) return '';
if (typeof array === 'string') {
return array.split(',').map(item => `- ${item.trim()}`).join('\n');
}
return array.map(item => `- ${item}`).join('\n');
};
file.write('# Vendors\n\n');
for (const vendor of vendors) {
// Vendor name and description
file.write(`## ${vendor.name}\n\n`);
if (vendor.description) {
file.write(`${vendor.description}\n\n`);
}
if (vendor.legalName) {
file.write(`**Legal Name:** ${vendor.legalName}\n\n`);
}
if (vendor.headquarterAddress) {
file.write(`**Headquarters:** ${vendor.headquarterAddress}\n\n`);
}
file.write('### Links\n\n');
file.write('| Resource | Link |\n');
file.write('|----------|------|\n');
if (vendor.websiteUrl) {
file.write(`| Website | [Link](${vendor.websiteUrl}) |\n`);
}
if (vendor.privacyPolicyUrl) {
file.write(`| Privacy Policy | [Link](${vendor.privacyPolicyUrl}) |\n`);
}
if (vendor.termsOfServiceUrl && vendor.termsOfServiceUrl !== 'undefined') {
file.write(`| Terms of Service | [Link](${vendor.termsOfServiceUrl}) |\n`);
}
if (vendor.serviceLevelAgreementUrl && vendor.serviceLevelAgreementUrl !== 'undefined') {
file.write(`| Service Level Agreement | [Link](${vendor.serviceLevelAgreementUrl}) |\n`);
}
if (vendor.securityPageUrl && vendor.securityPageUrl !== 'undefined') {
file.write(`| Security Page | [Link](${vendor.securityPageUrl}) |\n`);
}
if (vendor.trustPageUrl && vendor.trustPageUrl !== 'undefined') {
file.write(`| Trust Page | [Link](${vendor.trustPageUrl}) |\n`);
}
if (vendor.statusPageUrl && vendor.statusPageUrl !== 'undefined') {
file.write(`| Status Page | [Link](${vendor.statusPageUrl}) |\n`);
}
if (vendor.dataProcessingAgreementUrl && vendor.dataProcessingAgreementUrl !== 'undefined') {
file.write(`| Data Processing Agreement | [Link](${vendor.dataProcessingAgreementUrl}) |\n`);
}
if (vendor.businessAssociateAgreementUrl && vendor.businessAssociateAgreementUrl !== 'undefined') {
file.write(`| Business Associate Agreement | [Link](${vendor.businessAssociateAgreementUrl}) |\n`);
}
if (vendor.serviceSoftwareAgreementUrl && vendor.serviceSoftwareAgreementUrl !== 'undefined') {
file.write(`| Service Software Agreement | [Link](${vendor.serviceSoftwareAgreementUrl}) |\n`);
}
if (vendor.subprocessorsListUrl && vendor.subprocessorsListUrl !== 'undefined') {
file.write(`| Subprocessors List | [Link](${vendor.subprocessorsListUrl}) |\n`);
}
file.write('\n');
if (vendor.categories && vendor.categories !== 'undefined') {
file.write(`**Categories:** ${vendor.categories}\n\n`);
} else if (vendor.category && vendor.category !== 'undefined') {
file.write(`**Category:** ${vendor.category}\n\n`);
}
if (vendor.certifications && vendor.certifications !== 'undefined') {
file.write('### Certifications\n\n');
file.write(formatAsList(vendor.certifications));
file.write('\n\n');
}
if (vendor.subprocessors && vendor.subprocessors !== 'undefined') {
file.write('### Subprocessors\n\n');
file.write(formatAsList(vendor.subprocessors));
file.write('\n\n');
}
file.write('---\n\n');
}
file.end();