@shipstatic/types 0.4.16 → 0.4.17

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/index.d.ts CHANGED
@@ -758,6 +758,29 @@ export declare function generateDeploymentUrl(deployment: string, platformDomain
758
758
  * Domains are stored as FQDNs, so this just prepends https://
759
759
  */
760
760
  export declare function generateDomainUrl(domain: string): string;
761
+ /**
762
+ * Tag validation constraints shared across UI and API.
763
+ * These rules define the single source of truth for tag validation.
764
+ */
765
+ export declare const TAG_CONSTRAINTS: {
766
+ /** Minimum tag length in characters */
767
+ readonly MIN_LENGTH: 3;
768
+ /** Maximum tag length in characters (concise tags, matches Stack Overflow's original limit) */
769
+ readonly MAX_LENGTH: 25;
770
+ /** Maximum number of tags allowed per resource */
771
+ readonly MAX_COUNT: 10;
772
+ /** Allowed separator characters between tag segments */
773
+ readonly SEPARATORS: "._-";
774
+ };
775
+ /**
776
+ * Tag validation pattern.
777
+ * Must start and end with alphanumeric (a-z, 0-9).
778
+ * Can contain separators (. _ -) between segments, but not consecutive.
779
+ *
780
+ * Valid examples: 'production', 'v1.2.3', 'api_v2', 'us-east-1'
781
+ * Invalid examples: 'ab' (too short), '-prod' (starts with separator), 'foo--bar' (consecutive separators)
782
+ */
783
+ export declare const TAG_PATTERN: RegExp;
761
784
  /**
762
785
  * Serialize tags array to JSON string for database storage.
763
786
  * Returns null for empty or undefined arrays.
package/dist/index.js CHANGED
@@ -351,6 +351,29 @@ export function generateDomainUrl(domain) {
351
351
  // =============================================================================
352
352
  // TAG UTILITIES
353
353
  // =============================================================================
354
+ /**
355
+ * Tag validation constraints shared across UI and API.
356
+ * These rules define the single source of truth for tag validation.
357
+ */
358
+ export const TAG_CONSTRAINTS = {
359
+ /** Minimum tag length in characters */
360
+ MIN_LENGTH: 3,
361
+ /** Maximum tag length in characters (concise tags, matches Stack Overflow's original limit) */
362
+ MAX_LENGTH: 25,
363
+ /** Maximum number of tags allowed per resource */
364
+ MAX_COUNT: 10,
365
+ /** Allowed separator characters between tag segments */
366
+ SEPARATORS: '._-',
367
+ };
368
+ /**
369
+ * Tag validation pattern.
370
+ * Must start and end with alphanumeric (a-z, 0-9).
371
+ * Can contain separators (. _ -) between segments, but not consecutive.
372
+ *
373
+ * Valid examples: 'production', 'v1.2.3', 'api_v2', 'us-east-1'
374
+ * Invalid examples: 'ab' (too short), '-prod' (starts with separator), 'foo--bar' (consecutive separators)
375
+ */
376
+ export const TAG_PATTERN = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;
354
377
  /**
355
378
  * Serialize tags array to JSON string for database storage.
356
379
  * Returns null for empty or undefined arrays.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipstatic/types",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "description": "Shared types for Shipstatic platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -1129,6 +1129,31 @@ export function generateDomainUrl(domain: string): string {
1129
1129
  // TAG UTILITIES
1130
1130
  // =============================================================================
1131
1131
 
1132
+ /**
1133
+ * Tag validation constraints shared across UI and API.
1134
+ * These rules define the single source of truth for tag validation.
1135
+ */
1136
+ export const TAG_CONSTRAINTS = {
1137
+ /** Minimum tag length in characters */
1138
+ MIN_LENGTH: 3,
1139
+ /** Maximum tag length in characters (concise tags, matches Stack Overflow's original limit) */
1140
+ MAX_LENGTH: 25,
1141
+ /** Maximum number of tags allowed per resource */
1142
+ MAX_COUNT: 10,
1143
+ /** Allowed separator characters between tag segments */
1144
+ SEPARATORS: '._-',
1145
+ } as const;
1146
+
1147
+ /**
1148
+ * Tag validation pattern.
1149
+ * Must start and end with alphanumeric (a-z, 0-9).
1150
+ * Can contain separators (. _ -) between segments, but not consecutive.
1151
+ *
1152
+ * Valid examples: 'production', 'v1.2.3', 'api_v2', 'us-east-1'
1153
+ * Invalid examples: 'ab' (too short), '-prod' (starts with separator), 'foo--bar' (consecutive separators)
1154
+ */
1155
+ export const TAG_PATTERN = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;
1156
+
1132
1157
  /**
1133
1158
  * Serialize tags array to JSON string for database storage.
1134
1159
  * Returns null for empty or undefined arrays.