@ucptools/validator 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/config.d.ts +20 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/config.js +114 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +17 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +45 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +170 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/service.d.ts +80 -0
- package/dist/auth/service.d.ts.map +1 -0
- package/dist/auth/service.js +298 -0
- package/dist/auth/service.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +375 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/mock-server.d.ts +20 -0
- package/dist/cli/mock-server.d.ts.map +1 -0
- package/dist/cli/mock-server.js +261 -0
- package/dist/cli/mock-server.js.map +1 -0
- package/dist/compliance/compliance-generator.d.ts +34 -0
- package/dist/compliance/compliance-generator.d.ts.map +1 -0
- package/dist/compliance/compliance-generator.js +320 -0
- package/dist/compliance/compliance-generator.js.map +1 -0
- package/dist/compliance/index.d.ts +8 -0
- package/dist/compliance/index.d.ts.map +1 -0
- package/dist/compliance/index.js +17 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/templates.d.ts +34 -0
- package/dist/compliance/templates.d.ts.map +1 -0
- package/{src/compliance/templates.ts → dist/compliance/templates.js} +117 -155
- package/dist/compliance/templates.js.map +1 -0
- package/dist/compliance/types.d.ts +64 -0
- package/dist/compliance/types.d.ts.map +1 -0
- package/dist/compliance/types.js +64 -0
- package/dist/compliance/types.js.map +1 -0
- package/dist/db/index.d.ts +17 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +80 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +3886 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +425 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/utils.d.ts +252 -0
- package/dist/db/utils.d.ts.map +1 -0
- package/dist/db/utils.js +295 -0
- package/dist/db/utils.js.map +1 -0
- package/dist/feed-analyzer/feed-analyzer.d.ts +26 -0
- package/dist/feed-analyzer/feed-analyzer.d.ts.map +1 -0
- package/{src/feed-analyzer/feed-analyzer.ts → dist/feed-analyzer/feed-analyzer.js} +856 -726
- package/dist/feed-analyzer/feed-analyzer.js.map +1 -0
- package/dist/feed-analyzer/index.d.ts +8 -0
- package/dist/feed-analyzer/index.d.ts.map +1 -0
- package/dist/feed-analyzer/index.js +19 -0
- package/dist/feed-analyzer/index.js.map +1 -0
- package/dist/feed-analyzer/types.d.ts +285 -0
- package/dist/feed-analyzer/types.d.ts.map +1 -0
- package/dist/feed-analyzer/types.js +175 -0
- package/dist/feed-analyzer/types.js.map +1 -0
- package/{src/generator/index.ts → dist/generator/index.d.ts} +1 -1
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +13 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/key-generator.d.ts +24 -0
- package/dist/generator/key-generator.d.ts.map +1 -0
- package/dist/generator/key-generator.js +144 -0
- package/dist/generator/key-generator.js.map +1 -0
- package/dist/generator/profile-builder.d.ts +15 -0
- package/dist/generator/profile-builder.d.ts.map +1 -0
- package/dist/generator/profile-builder.js +338 -0
- package/dist/generator/profile-builder.js.map +1 -0
- package/dist/hosting/artifacts-generator.d.ts +10 -0
- package/dist/hosting/artifacts-generator.d.ts.map +1 -0
- package/{src/hosting/artifacts-generator.ts → dist/hosting/artifacts-generator.js} +191 -241
- package/dist/hosting/artifacts-generator.js.map +1 -0
- package/{src/hosting/index.ts → dist/hosting/index.d.ts} +1 -1
- package/dist/hosting/index.d.ts.map +1 -0
- package/dist/hosting/index.js +10 -0
- package/dist/hosting/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/analytics.d.ts +337 -0
- package/dist/lib/analytics.d.ts.map +1 -0
- package/dist/lib/analytics.js +188 -0
- package/dist/lib/analytics.js.map +1 -0
- package/{src/security/index.ts → dist/security/index.d.ts} +8 -15
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +12 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/security-scanner.d.ts +10 -0
- package/dist/security/security-scanner.d.ts.map +1 -0
- package/dist/security/security-scanner.js +669 -0
- package/dist/security/security-scanner.js.map +1 -0
- package/dist/security/types.d.ts +80 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/types.js +21 -0
- package/dist/security/types.js.map +1 -0
- package/dist/services/analytics.d.ts +114 -0
- package/dist/services/analytics.d.ts.map +1 -0
- package/dist/services/analytics.js +862 -0
- package/dist/services/analytics.js.map +1 -0
- package/dist/services/badge.d.ts +31 -0
- package/dist/services/badge.d.ts.map +1 -0
- package/dist/services/badge.js +152 -0
- package/dist/services/badge.js.map +1 -0
- package/dist/services/cron.d.ts +125 -0
- package/dist/services/cron.d.ts.map +1 -0
- package/dist/services/cron.js +613 -0
- package/dist/services/cron.js.map +1 -0
- package/dist/services/directory.d.ts +106 -0
- package/dist/services/directory.d.ts.map +1 -0
- package/dist/services/directory.js +351 -0
- package/dist/services/directory.js.map +1 -0
- package/dist/services/email.d.ts +112 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/email.js +772 -0
- package/dist/services/email.js.map +1 -0
- package/dist/services/hosted-profiles.d.ts +77 -0
- package/dist/services/hosted-profiles.d.ts.map +1 -0
- package/dist/services/hosted-profiles.js +433 -0
- package/dist/services/hosted-profiles.js.map +1 -0
- package/dist/services/latency.d.ts +67 -0
- package/dist/services/latency.d.ts.map +1 -0
- package/dist/services/latency.js +274 -0
- package/dist/services/latency.js.map +1 -0
- package/dist/services/manifest-compliance.d.ts +64 -0
- package/dist/services/manifest-compliance.d.ts.map +1 -0
- package/dist/services/manifest-compliance.js +271 -0
- package/dist/services/manifest-compliance.js.map +1 -0
- package/dist/services/monitoring-diff.d.ts +31 -0
- package/dist/services/monitoring-diff.d.ts.map +1 -0
- package/dist/services/monitoring-diff.js +189 -0
- package/dist/services/monitoring-diff.js.map +1 -0
- package/dist/services/notifications.d.ts +46 -0
- package/dist/services/notifications.d.ts.map +1 -0
- package/dist/services/notifications.js +88 -0
- package/dist/services/notifications.js.map +1 -0
- package/dist/services/stripe.d.ts +93 -0
- package/dist/services/stripe.d.ts.map +1 -0
- package/dist/services/stripe.js +490 -0
- package/dist/services/stripe.js.map +1 -0
- package/dist/services/validation-history.d.ts +99 -0
- package/dist/services/validation-history.d.ts.map +1 -0
- package/dist/services/validation-history.js +344 -0
- package/dist/services/validation-history.js.map +1 -0
- package/dist/services/validation-logging.d.ts +103 -0
- package/dist/services/validation-logging.d.ts.map +1 -0
- package/dist/services/validation-logging.js +210 -0
- package/dist/services/validation-logging.js.map +1 -0
- package/dist/services/validation.d.ts +119 -0
- package/dist/services/validation.d.ts.map +1 -0
- package/dist/services/validation.js +1185 -0
- package/dist/services/validation.js.map +1 -0
- package/dist/simulator/agent-simulator.d.ts +69 -0
- package/dist/simulator/agent-simulator.d.ts.map +1 -0
- package/dist/simulator/agent-simulator.js +870 -0
- package/dist/simulator/agent-simulator.js.map +1 -0
- package/{src/simulator/index.ts → dist/simulator/index.d.ts} +7 -7
- package/dist/simulator/index.d.ts.map +1 -0
- package/dist/simulator/index.js +23 -0
- package/dist/simulator/index.js.map +1 -0
- package/{src/simulator/types.ts → dist/simulator/types.d.ts} +171 -170
- package/dist/simulator/types.d.ts.map +1 -0
- package/dist/simulator/types.js +18 -0
- package/dist/simulator/types.js.map +1 -0
- package/dist/types/acp-validation.d.ts +87 -0
- package/dist/types/acp-validation.d.ts.map +1 -0
- package/dist/types/acp-validation.js +40 -0
- package/dist/types/acp-validation.js.map +1 -0
- package/dist/types/analytics.d.ts +182 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/analytics.js +7 -0
- package/dist/types/analytics.js.map +1 -0
- package/dist/types/generator.d.ts +106 -0
- package/dist/types/generator.d.ts.map +1 -0
- package/dist/types/generator.js +6 -0
- package/dist/types/generator.js.map +1 -0
- package/{src/types/index.ts → dist/types/index.d.ts} +1 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/ucp-profile.d.ts +111 -0
- package/dist/types/ucp-profile.d.ts.map +1 -0
- package/dist/types/ucp-profile.js +45 -0
- package/dist/types/ucp-profile.js.map +1 -0
- package/dist/types/validation.d.ts +76 -0
- package/dist/types/validation.d.ts.map +1 -0
- package/dist/types/validation.js +42 -0
- package/dist/types/validation.js.map +1 -0
- package/dist/validator/acp/index.d.ts +31 -0
- package/dist/validator/acp/index.d.ts.map +1 -0
- package/dist/validator/acp/index.js +574 -0
- package/dist/validator/acp/index.js.map +1 -0
- package/dist/validator/index.d.ts +26 -0
- package/dist/validator/index.d.ts.map +1 -0
- package/dist/validator/index.js +161 -0
- package/dist/validator/index.js.map +1 -0
- package/dist/validator/network-validator.d.ts +28 -0
- package/dist/validator/network-validator.d.ts.map +1 -0
- package/dist/validator/network-validator.js +319 -0
- package/dist/validator/network-validator.js.map +1 -0
- package/dist/validator/rules-validator.d.ts +19 -0
- package/dist/validator/rules-validator.d.ts.map +1 -0
- package/dist/validator/rules-validator.js +306 -0
- package/dist/validator/rules-validator.js.map +1 -0
- package/dist/validator/sdk-validator.d.ts +58 -0
- package/dist/validator/sdk-validator.d.ts.map +1 -0
- package/{src/validator/sdk-validator.ts → dist/validator/sdk-validator.js} +273 -330
- package/dist/validator/sdk-validator.js.map +1 -0
- package/dist/validator/structural-validator.d.ts +11 -0
- package/dist/validator/structural-validator.d.ts.map +1 -0
- package/dist/validator/structural-validator.js +549 -0
- package/dist/validator/structural-validator.js.map +1 -0
- package/dist/validator/utils.d.ts +51 -0
- package/dist/validator/utils.d.ts.map +1 -0
- package/dist/validator/utils.js +132 -0
- package/dist/validator/utils.js.map +1 -0
- package/package.json +44 -12
- package/CLAUDE.md +0 -109
- package/api/analyze-feed.js +0 -140
- package/api/badge.js +0 -185
- package/api/benchmark.js +0 -177
- package/api/directory-stats.ts +0 -29
- package/api/directory.ts +0 -73
- package/api/generate-compliance.js +0 -143
- package/api/generate-schema.js +0 -457
- package/api/generate.js +0 -132
- package/api/security-scan.js +0 -133
- package/api/simulate.js +0 -187
- package/api/tsconfig.json +0 -10
- package/api/validate.js +0 -1351
- package/apify-actor/.actor/actor.json +0 -68
- package/apify-actor/.actor/input_schema.json +0 -32
- package/apify-actor/APIFY-STORE-LISTING.md +0 -412
- package/apify-actor/Dockerfile +0 -8
- package/apify-actor/README.md +0 -166
- package/apify-actor/main.ts +0 -111
- package/apify-actor/package.json +0 -17
- package/apify-actor/src/main.js +0 -199
- package/docs/BRAND-IDENTITY.md +0 -238
- package/docs/BRAND-STYLE-GUIDE.md +0 -356
- package/drizzle/0000_black_king_cobra.sql +0 -39
- package/drizzle/meta/0000_snapshot.json +0 -309
- package/drizzle/meta/_journal.json +0 -13
- package/drizzle.config.ts +0 -10
- package/public/.well-known/ucp +0 -25
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/brand.css +0 -321
- package/public/directory.html +0 -701
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/guides/bigcommerce.html +0 -743
- package/public/guides/fastucp.html +0 -838
- package/public/guides/magento.html +0 -779
- package/public/guides/shopify.html +0 -726
- package/public/guides/squarespace.html +0 -749
- package/public/guides/wix.html +0 -747
- package/public/guides/woocommerce.html +0 -733
- package/public/index.html +0 -3835
- package/public/learn.html +0 -396
- package/public/logo.jpeg +0 -0
- package/public/og-image-icon.png +0 -0
- package/public/og-image.png +0 -0
- package/public/robots.txt +0 -6
- package/public/site.webmanifest +0 -31
- package/public/sitemap.xml +0 -69
- package/public/social/linkedin-banner-1128x191.png +0 -0
- package/public/social/temp.PNG +0 -0
- package/public/social/x-header-1500x500.png +0 -0
- package/public/verify.html +0 -410
- package/scripts/generate-favicons.js +0 -44
- package/scripts/generate-ico.js +0 -23
- package/scripts/generate-og-image.js +0 -45
- package/scripts/reset-db.ts +0 -77
- package/scripts/seed-db.ts +0 -71
- package/scripts/setup-benchmark-db.js +0 -70
- package/src/api/server.ts +0 -266
- package/src/cli/index.ts +0 -302
- package/src/compliance/compliance-generator.ts +0 -452
- package/src/compliance/index.ts +0 -28
- package/src/compliance/types.ts +0 -170
- package/src/db/index.ts +0 -28
- package/src/db/schema.ts +0 -84
- package/src/feed-analyzer/index.ts +0 -34
- package/src/feed-analyzer/types.ts +0 -354
- package/src/generator/key-generator.ts +0 -124
- package/src/generator/profile-builder.ts +0 -402
- package/src/index.ts +0 -105
- package/src/security/security-scanner.ts +0 -604
- package/src/security/types.ts +0 -55
- package/src/services/directory.ts +0 -434
- package/src/simulator/agent-simulator.ts +0 -941
- package/src/types/generator.ts +0 -140
- package/src/types/ucp-profile.ts +0 -140
- package/src/types/validation.ts +0 -89
- package/src/validator/index.ts +0 -194
- package/src/validator/network-validator.ts +0 -417
- package/src/validator/rules-validator.ts +0 -297
- package/src/validator/structural-validator.ts +0 -476
- package/tests/fixtures/non-compliant-profile.json +0 -25
- package/tests/fixtures/official-sample-profile.json +0 -75
- package/tests/integration/benchmark.test.ts +0 -207
- package/tests/integration/database.test.ts +0 -163
- package/tests/integration/directory-api.test.ts +0 -268
- package/tests/integration/simulate-api.test.ts +0 -230
- package/tests/integration/validate-api.test.ts +0 -269
- package/tests/setup.ts +0 -15
- package/tests/unit/agent-simulator.test.ts +0 -575
- package/tests/unit/compliance-generator.test.ts +0 -374
- package/tests/unit/directory-service.test.ts +0 -272
- package/tests/unit/feed-analyzer.test.ts +0 -517
- package/tests/unit/lint-suggestions.test.ts +0 -423
- package/tests/unit/official-samples.test.ts +0 -211
- package/tests/unit/pdf-report.test.ts +0 -390
- package/tests/unit/sdk-validator.test.ts +0 -531
- package/tests/unit/security-scanner.test.ts +0 -410
- package/tests/unit/validation.test.ts +0 -390
- package/tsconfig.json +0 -20
- package/vercel.json +0 -34
- package/vitest.config.ts +0 -22
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UCP Profile Builder
|
|
3
|
-
* Generates valid UCP Business Profiles from configuration inputs
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
UcpProfile,
|
|
8
|
-
UcpObject,
|
|
9
|
-
UcpService,
|
|
10
|
-
UcpCapability,
|
|
11
|
-
SigningKeys,
|
|
12
|
-
JwkKey,
|
|
13
|
-
} from '../types/ucp-profile.js';
|
|
14
|
-
import type {
|
|
15
|
-
GeneratorInput,
|
|
16
|
-
GeneratorOutput,
|
|
17
|
-
TransportConfig,
|
|
18
|
-
CapabilitySelection,
|
|
19
|
-
} from '../types/generator.js';
|
|
20
|
-
import {
|
|
21
|
-
CURRENT_UCP_VERSION,
|
|
22
|
-
KNOWN_CAPABILITIES,
|
|
23
|
-
KNOWN_SERVICES,
|
|
24
|
-
UCP_DEFAULTS,
|
|
25
|
-
} from '../types/ucp-profile.js';
|
|
26
|
-
import { generateSigningKeyPair } from './key-generator.js';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Build a complete UCP Profile from generator inputs
|
|
30
|
-
*/
|
|
31
|
-
export async function buildProfile(input: GeneratorInput): Promise<GeneratorOutput> {
|
|
32
|
-
const ucpVersion = input.ucpVersion || CURRENT_UCP_VERSION;
|
|
33
|
-
|
|
34
|
-
// Build services
|
|
35
|
-
const services = buildServices(input.transport, ucpVersion);
|
|
36
|
-
|
|
37
|
-
// Build capabilities
|
|
38
|
-
const capabilities = buildCapabilities(input.capabilities, ucpVersion);
|
|
39
|
-
|
|
40
|
-
// Build the UCP object
|
|
41
|
-
const ucpObject: UcpObject = {
|
|
42
|
-
version: ucpVersion,
|
|
43
|
-
services,
|
|
44
|
-
capabilities,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Build the full profile
|
|
48
|
-
const profile: UcpProfile = {
|
|
49
|
-
ucp: ucpObject,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// Handle signing keys if Order capability is enabled
|
|
53
|
-
let signingKeyPair: GeneratorOutput['signingKeyPair'] | undefined;
|
|
54
|
-
|
|
55
|
-
if (input.capabilities.order) {
|
|
56
|
-
if (input.security?.generateSigningKeys !== false) {
|
|
57
|
-
// Generate new signing keys
|
|
58
|
-
const keyPair = await generateSigningKeyPair(
|
|
59
|
-
input.security?.signingKeyAlgorithm || 'ES256'
|
|
60
|
-
);
|
|
61
|
-
profile.signing_keys = [keyPair.publicKey];
|
|
62
|
-
signingKeyPair = keyPair;
|
|
63
|
-
} else if (input.security?.uploadedPublicKey) {
|
|
64
|
-
// Use uploaded public key
|
|
65
|
-
const publicKey = parsePublicKey(input.security.uploadedPublicKey);
|
|
66
|
-
profile.signing_keys = [publicKey];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Format the profile JSON
|
|
71
|
-
const profileJson = JSON.stringify(profile, null, 2);
|
|
72
|
-
|
|
73
|
-
// Generate install instructions
|
|
74
|
-
const installInstructions = generateInstallInstructions(
|
|
75
|
-
input.merchant.primaryDomain,
|
|
76
|
-
input.merchant.merchantId
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
profile,
|
|
81
|
-
profileJson,
|
|
82
|
-
installInstructions,
|
|
83
|
-
signingKeyPair,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Build services configuration
|
|
89
|
-
*/
|
|
90
|
-
function buildServices(
|
|
91
|
-
transport: TransportConfig,
|
|
92
|
-
ucpVersion: string
|
|
93
|
-
): Record<string, UcpService> {
|
|
94
|
-
const services: Record<string, UcpService> = {};
|
|
95
|
-
|
|
96
|
-
// Always include the shopping service for MVP
|
|
97
|
-
const shoppingService: UcpService = {
|
|
98
|
-
version: ucpVersion,
|
|
99
|
-
spec: `${UCP_DEFAULTS.SPEC_BASE}overview/`,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Add REST transport (required for MVP)
|
|
103
|
-
if (transport.rest) {
|
|
104
|
-
shoppingService.rest = {
|
|
105
|
-
schema: transport.rest.schemaUrl || UCP_DEFAULTS.SHOPPING_REST_SCHEMA,
|
|
106
|
-
endpoint: normalizeEndpoint(transport.rest.endpoint),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Add MCP transport (optional)
|
|
111
|
-
if (transport.mcp) {
|
|
112
|
-
shoppingService.mcp = {
|
|
113
|
-
schema: transport.mcp.schemaUrl || `${UCP_DEFAULTS.SERVICE_SCHEMA_BASE}shopping/mcp.json`,
|
|
114
|
-
endpoint: normalizeEndpoint(transport.mcp.endpoint),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Add A2A transport (optional)
|
|
119
|
-
if (transport.a2a) {
|
|
120
|
-
shoppingService.a2a = {
|
|
121
|
-
agentCard: transport.a2a.agentCardUrl,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Add embedded transport (optional)
|
|
126
|
-
if (transport.embedded) {
|
|
127
|
-
shoppingService.embedded = {
|
|
128
|
-
schema: transport.embedded.schemaUrl,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
services[KNOWN_SERVICES.SHOPPING] = shoppingService;
|
|
133
|
-
|
|
134
|
-
return services;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Build capabilities array based on selection
|
|
139
|
-
*/
|
|
140
|
-
function buildCapabilities(
|
|
141
|
-
selection: CapabilitySelection,
|
|
142
|
-
ucpVersion: string
|
|
143
|
-
): UcpCapability[] {
|
|
144
|
-
const capabilities: UcpCapability[] = [];
|
|
145
|
-
|
|
146
|
-
// Checkout capability (default ON)
|
|
147
|
-
if (selection.checkout !== false) {
|
|
148
|
-
capabilities.push({
|
|
149
|
-
name: KNOWN_CAPABILITIES.CHECKOUT,
|
|
150
|
-
version: ucpVersion,
|
|
151
|
-
spec: UCP_DEFAULTS.CHECKOUT_SPEC,
|
|
152
|
-
schema: UCP_DEFAULTS.CHECKOUT_SCHEMA,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Order capability
|
|
157
|
-
if (selection.order) {
|
|
158
|
-
capabilities.push({
|
|
159
|
-
name: KNOWN_CAPABILITIES.ORDER,
|
|
160
|
-
version: ucpVersion,
|
|
161
|
-
spec: UCP_DEFAULTS.ORDER_SPEC,
|
|
162
|
-
schema: UCP_DEFAULTS.ORDER_SCHEMA,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Fulfillment capability (extends Order)
|
|
167
|
-
if (selection.fulfillment) {
|
|
168
|
-
capabilities.push({
|
|
169
|
-
name: KNOWN_CAPABILITIES.FULFILLMENT,
|
|
170
|
-
version: ucpVersion,
|
|
171
|
-
spec: UCP_DEFAULTS.FULFILLMENT_SPEC,
|
|
172
|
-
schema: UCP_DEFAULTS.FULFILLMENT_SCHEMA,
|
|
173
|
-
extends: KNOWN_CAPABILITIES.ORDER,
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Discount capability
|
|
178
|
-
if (selection.discount) {
|
|
179
|
-
capabilities.push({
|
|
180
|
-
name: KNOWN_CAPABILITIES.DISCOUNT,
|
|
181
|
-
version: ucpVersion,
|
|
182
|
-
spec: UCP_DEFAULTS.DISCOUNT_SPEC,
|
|
183
|
-
schema: UCP_DEFAULTS.DISCOUNT_SCHEMA,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Custom capabilities
|
|
188
|
-
if (selection.customCapabilities) {
|
|
189
|
-
for (const custom of selection.customCapabilities) {
|
|
190
|
-
const capability: UcpCapability = {
|
|
191
|
-
name: `${custom.namespace}.${custom.name}`,
|
|
192
|
-
version: custom.version,
|
|
193
|
-
spec: custom.specUrl,
|
|
194
|
-
schema: custom.schemaUrl,
|
|
195
|
-
};
|
|
196
|
-
if (custom.extendsCapability) {
|
|
197
|
-
capability.extends = custom.extendsCapability;
|
|
198
|
-
}
|
|
199
|
-
capabilities.push(capability);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return capabilities;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Normalize endpoint URL (ensure https, no trailing slash)
|
|
208
|
-
*/
|
|
209
|
-
function normalizeEndpoint(endpoint: string): string {
|
|
210
|
-
let normalized = endpoint.trim();
|
|
211
|
-
|
|
212
|
-
// Ensure https
|
|
213
|
-
if (!normalized.startsWith('https://')) {
|
|
214
|
-
if (normalized.startsWith('http://')) {
|
|
215
|
-
normalized = normalized.replace('http://', 'https://');
|
|
216
|
-
} else {
|
|
217
|
-
normalized = `https://${normalized}`;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Remove trailing slash
|
|
222
|
-
if (normalized.endsWith('/')) {
|
|
223
|
-
normalized = normalized.slice(0, -1);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return normalized;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Parse uploaded public key (PEM or JWK format)
|
|
231
|
-
*/
|
|
232
|
-
function parsePublicKey(keyData: string): JwkKey {
|
|
233
|
-
// Try to parse as JSON (JWK)
|
|
234
|
-
try {
|
|
235
|
-
const parsed = JSON.parse(keyData);
|
|
236
|
-
if (parsed.kty) {
|
|
237
|
-
return parsed as JwkKey;
|
|
238
|
-
}
|
|
239
|
-
} catch {
|
|
240
|
-
// Not JSON, assume PEM format
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// For PEM format, we'll need to convert (simplified for now)
|
|
244
|
-
throw new Error(
|
|
245
|
-
'PEM format not yet supported. Please provide the public key in JWK format.'
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Generate installation instructions markdown
|
|
251
|
-
*/
|
|
252
|
-
function generateInstallInstructions(
|
|
253
|
-
merchantDomain: string,
|
|
254
|
-
merchantId: string
|
|
255
|
-
): string {
|
|
256
|
-
return `# UCP Profile Installation Instructions
|
|
257
|
-
|
|
258
|
-
## Profile Location
|
|
259
|
-
|
|
260
|
-
Your UCP Business Profile must be accessible at:
|
|
261
|
-
\`\`\`
|
|
262
|
-
https://${merchantDomain}/.well-known/ucp
|
|
263
|
-
\`\`\`
|
|
264
|
-
|
|
265
|
-
## Installation Options
|
|
266
|
-
|
|
267
|
-
### Option 1: Static File (Recommended for most setups)
|
|
268
|
-
|
|
269
|
-
1. Save the \`ucp.json\` file to your web server
|
|
270
|
-
2. Configure your server to serve it at \`/.well-known/ucp\`
|
|
271
|
-
|
|
272
|
-
#### Nginx Configuration
|
|
273
|
-
\`\`\`nginx
|
|
274
|
-
location = /.well-known/ucp {
|
|
275
|
-
alias /path/to/ucp.json;
|
|
276
|
-
default_type application/json;
|
|
277
|
-
add_header Access-Control-Allow-Origin "*";
|
|
278
|
-
add_header Cache-Control "public, max-age=3600";
|
|
279
|
-
}
|
|
280
|
-
\`\`\`
|
|
281
|
-
|
|
282
|
-
#### Apache Configuration
|
|
283
|
-
\`\`\`apache
|
|
284
|
-
<Directory "/path/to/.well-known">
|
|
285
|
-
Options -Indexes
|
|
286
|
-
AllowOverride None
|
|
287
|
-
Require all granted
|
|
288
|
-
</Directory>
|
|
289
|
-
|
|
290
|
-
<Files "ucp">
|
|
291
|
-
ForceType application/json
|
|
292
|
-
Header set Access-Control-Allow-Origin "*"
|
|
293
|
-
Header set Cache-Control "public, max-age=3600"
|
|
294
|
-
</Files>
|
|
295
|
-
\`\`\`
|
|
296
|
-
|
|
297
|
-
#### Vercel (vercel.json)
|
|
298
|
-
\`\`\`json
|
|
299
|
-
{
|
|
300
|
-
"rewrites": [
|
|
301
|
-
{ "source": "/.well-known/ucp", "destination": "/ucp.json" }
|
|
302
|
-
],
|
|
303
|
-
"headers": [
|
|
304
|
-
{
|
|
305
|
-
"source": "/.well-known/ucp",
|
|
306
|
-
"headers": [
|
|
307
|
-
{ "key": "Content-Type", "value": "application/json" },
|
|
308
|
-
{ "key": "Access-Control-Allow-Origin", "value": "*" }
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
\`\`\`
|
|
314
|
-
|
|
315
|
-
#### Netlify (_redirects)
|
|
316
|
-
\`\`\`
|
|
317
|
-
/.well-known/ucp /ucp.json 200
|
|
318
|
-
\`\`\`
|
|
319
|
-
|
|
320
|
-
### Option 2: Edge Worker (Cloudflare)
|
|
321
|
-
|
|
322
|
-
This approach proxies the profile from our hosted service.
|
|
323
|
-
|
|
324
|
-
\`\`\`javascript
|
|
325
|
-
// Cloudflare Worker
|
|
326
|
-
export default {
|
|
327
|
-
async fetch(request, env) {
|
|
328
|
-
const profileUrl = 'https://profiles.ucp.tools/${merchantId}/ucp.json';
|
|
329
|
-
|
|
330
|
-
const response = await fetch(profileUrl, {
|
|
331
|
-
cf: { cacheTtl: 3600, cacheEverything: true }
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
return new Response(response.body, {
|
|
335
|
-
headers: {
|
|
336
|
-
'Content-Type': 'application/json',
|
|
337
|
-
'Access-Control-Allow-Origin': '*',
|
|
338
|
-
'Cache-Control': 'public, max-age=3600'
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
\`\`\`
|
|
344
|
-
|
|
345
|
-
Route: \`${merchantDomain}/.well-known/ucp*\`
|
|
346
|
-
|
|
347
|
-
### Option 3: Reverse Proxy (Nginx)
|
|
348
|
-
|
|
349
|
-
\`\`\`nginx
|
|
350
|
-
location = /.well-known/ucp {
|
|
351
|
-
proxy_pass https://profiles.ucp.tools/${merchantId}/ucp.json;
|
|
352
|
-
proxy_set_header Host profiles.ucp.tools;
|
|
353
|
-
proxy_cache_valid 200 1h;
|
|
354
|
-
add_header Access-Control-Allow-Origin "*";
|
|
355
|
-
}
|
|
356
|
-
\`\`\`
|
|
357
|
-
|
|
358
|
-
## Verification
|
|
359
|
-
|
|
360
|
-
After installation, verify your profile:
|
|
361
|
-
|
|
362
|
-
1. Open: https://${merchantDomain}/.well-known/ucp
|
|
363
|
-
2. Confirm JSON response with correct structure
|
|
364
|
-
3. Run validation: \`ucp-validate --remote https://${merchantDomain}\`
|
|
365
|
-
|
|
366
|
-
## Support
|
|
367
|
-
|
|
368
|
-
For help, visit: https://ucp.tools
|
|
369
|
-
`;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Generate a minimal starter profile (for quick setup)
|
|
374
|
-
*/
|
|
375
|
-
export function generateMinimalProfile(
|
|
376
|
-
endpoint: string,
|
|
377
|
-
ucpVersion: string = CURRENT_UCP_VERSION
|
|
378
|
-
): UcpProfile {
|
|
379
|
-
return {
|
|
380
|
-
ucp: {
|
|
381
|
-
version: ucpVersion,
|
|
382
|
-
services: {
|
|
383
|
-
[KNOWN_SERVICES.SHOPPING]: {
|
|
384
|
-
version: ucpVersion,
|
|
385
|
-
spec: `${UCP_DEFAULTS.SPEC_BASE}overview/`,
|
|
386
|
-
rest: {
|
|
387
|
-
schema: UCP_DEFAULTS.SHOPPING_REST_SCHEMA,
|
|
388
|
-
endpoint: normalizeEndpoint(endpoint),
|
|
389
|
-
},
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
|
-
capabilities: [
|
|
393
|
-
{
|
|
394
|
-
name: KNOWN_CAPABILITIES.CHECKOUT,
|
|
395
|
-
version: ucpVersion,
|
|
396
|
-
spec: UCP_DEFAULTS.CHECKOUT_SPEC,
|
|
397
|
-
schema: UCP_DEFAULTS.CHECKOUT_SCHEMA,
|
|
398
|
-
},
|
|
399
|
-
],
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UCP Profile Manager
|
|
3
|
-
* Generate, validate, and host UCP Business Profiles
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Types
|
|
9
|
-
export * from './types/index.js';
|
|
10
|
-
|
|
11
|
-
// Generator
|
|
12
|
-
export {
|
|
13
|
-
buildProfile,
|
|
14
|
-
generateMinimalProfile,
|
|
15
|
-
generateSigningKeyPair,
|
|
16
|
-
validatePublicKey,
|
|
17
|
-
} from './generator/index.js';
|
|
18
|
-
|
|
19
|
-
// Validator
|
|
20
|
-
export {
|
|
21
|
-
validateProfile,
|
|
22
|
-
validateRemote,
|
|
23
|
-
validateQuick,
|
|
24
|
-
validateJsonString,
|
|
25
|
-
validateStructure,
|
|
26
|
-
validateRules,
|
|
27
|
-
validateNetwork,
|
|
28
|
-
clearSchemaCache,
|
|
29
|
-
} from './validator/index.js';
|
|
30
|
-
|
|
31
|
-
// Simulator
|
|
32
|
-
export {
|
|
33
|
-
simulateAgentInteraction,
|
|
34
|
-
simulateDiscoveryFlow,
|
|
35
|
-
inspectCapabilities,
|
|
36
|
-
inspectServices,
|
|
37
|
-
simulateRestApi,
|
|
38
|
-
simulateCheckoutFlow,
|
|
39
|
-
simulatePaymentReadiness,
|
|
40
|
-
} from './simulator/index.js';
|
|
41
|
-
|
|
42
|
-
// Hosting
|
|
43
|
-
export { generateHostingArtifacts } from './hosting/index.js';
|
|
44
|
-
|
|
45
|
-
// Security Scanner
|
|
46
|
-
export {
|
|
47
|
-
scanEndpointSecurity,
|
|
48
|
-
SecurityCheckIds,
|
|
49
|
-
} from './security/index.js';
|
|
50
|
-
export type {
|
|
51
|
-
SecurityCheck,
|
|
52
|
-
SecurityScanResult,
|
|
53
|
-
SecurityScanOptions,
|
|
54
|
-
SecuritySeverity,
|
|
55
|
-
SecurityCheckStatus,
|
|
56
|
-
SecurityCheckId,
|
|
57
|
-
} from './security/index.js';
|
|
58
|
-
|
|
59
|
-
// Compliance Generator
|
|
60
|
-
export {
|
|
61
|
-
generateComplianceDocuments,
|
|
62
|
-
getAvailableRegions,
|
|
63
|
-
getLawfulBasisOptions,
|
|
64
|
-
getAiPlatformOptions,
|
|
65
|
-
AI_PLATFORM_PROCESSORS,
|
|
66
|
-
REGION_NAMES,
|
|
67
|
-
LAWFUL_BASIS_DESCRIPTIONS,
|
|
68
|
-
} from './compliance/index.js';
|
|
69
|
-
export type {
|
|
70
|
-
ComplianceRegion,
|
|
71
|
-
LawfulBasis,
|
|
72
|
-
AgentPlatform,
|
|
73
|
-
ComplianceGeneratorInput,
|
|
74
|
-
ComplianceGeneratorOutput,
|
|
75
|
-
ComplianceDocument,
|
|
76
|
-
ComplianceSection,
|
|
77
|
-
DataProcessor,
|
|
78
|
-
} from './compliance/index.js';
|
|
79
|
-
|
|
80
|
-
// Feed Analyzer
|
|
81
|
-
export {
|
|
82
|
-
analyzeProductFeed,
|
|
83
|
-
analyzeProductFeedFromHtml,
|
|
84
|
-
analyzeProduct,
|
|
85
|
-
extractProductsFromHtml,
|
|
86
|
-
validateGtin,
|
|
87
|
-
QUALITY_CHECKS,
|
|
88
|
-
VALID_AVAILABILITY_VALUES,
|
|
89
|
-
CATEGORY_WEIGHTS,
|
|
90
|
-
GRADE_THRESHOLDS,
|
|
91
|
-
} from './feed-analyzer/index.js';
|
|
92
|
-
export type {
|
|
93
|
-
ProductData,
|
|
94
|
-
ProductOffer,
|
|
95
|
-
ProductAnalysis,
|
|
96
|
-
QualityCheck,
|
|
97
|
-
FeedAnalysisResult,
|
|
98
|
-
FeedAnalysisInput,
|
|
99
|
-
CategoryScores,
|
|
100
|
-
Recommendation,
|
|
101
|
-
FeedSummary,
|
|
102
|
-
GtinValidation,
|
|
103
|
-
IssueSeverity,
|
|
104
|
-
CheckCategory,
|
|
105
|
-
} from './feed-analyzer/index.js';
|