Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
No EOL
1.8 KiB
Text
41 lines
No EOL
1.8 KiB
Text
/*
|
|
* Copyright The OpenTelemetry Authors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const VALID_KEY_CHAR_RANGE = '[_0-9a-z-*/]';
|
|
const VALID_KEY = `[a-z]${VALID_KEY_CHAR_RANGE}{0,255}`;
|
|
const VALID_VENDOR_KEY = `[a-z0-9]${VALID_KEY_CHAR_RANGE}{0,240}@[a-z]${VALID_KEY_CHAR_RANGE}{0,13}`;
|
|
const VALID_KEY_REGEX = new RegExp(`^(?:${VALID_KEY}|${VALID_VENDOR_KEY})$`);
|
|
const VALID_VALUE_BASE_REGEX = /^[ -~]{0,255}[!-~]$/;
|
|
const INVALID_VALUE_COMMA_EQUAL_REGEX = /,|=/;
|
|
/**
|
|
* Key is opaque string up to 256 characters printable. It MUST begin with a
|
|
* lowercase letter, and can only contain lowercase letters a-z, digits 0-9,
|
|
* underscores _, dashes -, asterisks *, and forward slashes /.
|
|
* For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the
|
|
* vendor name. Vendors SHOULD set the tenant ID at the beginning of the key.
|
|
* see https://www.w3.org/TR/trace-context/#key
|
|
*/
|
|
export function validateKey(key) {
|
|
return VALID_KEY_REGEX.test(key);
|
|
}
|
|
/**
|
|
* Value is opaque string up to 256 characters printable ASCII RFC0020
|
|
* characters (i.e., the range 0x20 to 0x7E) except comma , and =.
|
|
*/
|
|
export function validateValue(value) {
|
|
return (VALID_VALUE_BASE_REGEX.test(value) &&
|
|
!INVALID_VALUE_COMMA_EQUAL_REGEX.test(value));
|
|
}
|
|
//# sourceMappingURL=validators.js.map |