@phala/cloud 0.2.1-beta.3 → 0.2.1-beta.4

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.
@@ -63,12 +63,29 @@ export declare const CvmIdBaseSchema: z.ZodEffects<z.ZodObject<{
63
63
  }>, any, any>;
64
64
  /**
65
65
  * CVM ID Schema - supports multiple identifier formats
66
- * Automatically transforms to the correct format for API calls
66
+ * Automatically detects and normalizes any CVM ID format
67
+ *
68
+ * Process:
69
+ * 1. Extract raw value from any field (priority: id > uuid > app_id > instance_id)
70
+ * 2. Auto-detect format using regex patterns
71
+ * 3. Apply appropriate normalization:
72
+ * - UUID (with or without dashes) → remove dashes
73
+ * - 40-char hex string → add 'app_' prefix
74
+ * - Already prefixed or custom → use as-is
67
75
  *
68
76
  * @example
69
77
  * ```typescript
70
- * const result1 = CvmIdSchema.parse({ id: "cvm-123" });
71
- * const result2 = CvmIdSchema.parse({ uuid: "550e8400-e29b-41d4-a716-446655440000" });
78
+ * // All these work regardless of which field is used:
79
+ * CvmIdSchema.parse({ id: "550e8400-e29b-41d4-a716-446655440000" });
80
+ * CvmIdSchema.parse({ uuid: "550e8400-e29b-41d4-a716-446655440000" });
81
+ * // → { cvmId: "550e8400e29b41d4a716446655440000" }
82
+ *
83
+ * CvmIdSchema.parse({ id: "50b0e827cc6c53f4010b57e588a18c5ef9388cc1" });
84
+ * CvmIdSchema.parse({ app_id: "50b0e827cc6c53f4010b57e588a18c5ef9388cc1" });
85
+ * // → { cvmId: "app_50b0e827cc6c53f4010b57e588a18c5ef9388cc1" }
86
+ *
87
+ * CvmIdSchema.parse({ id: "app_50b0e827cc6c53f4010b57e588a18c5ef9388cc1" });
88
+ * // → { cvmId: "app_50b0e827cc6c53f4010b57e588a18c5ef9388cc1" }
72
89
  * ```
73
90
  */
74
91
  export declare const CvmIdSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phala/cloud",
3
- "version": "0.2.1-beta.3",
3
+ "version": "0.2.1-beta.4",
4
4
  "description": "TypeScript SDK for Phala Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",