@graph-knowledge/api 0.3.2 → 0.9.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.
Files changed (46) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +3 -2
  3. package/src/lib/clients/firebase-auth-client.d.ts +7 -0
  4. package/src/lib/clients/firebase-auth-client.js +20 -2
  5. package/src/lib/clients/firebase-firestore-client.js +83 -29
  6. package/src/lib/constants/element-defaults.js +1 -0
  7. package/src/lib/graph-knowledge-api.d.ts +21 -2
  8. package/src/lib/graph-knowledge-api.js +35 -5
  9. package/src/lib/interfaces/auth-client.interface.d.ts +10 -0
  10. package/src/lib/interfaces/custom-shape-operations.interface.d.ts +82 -0
  11. package/src/lib/interfaces/custom-shape-operations.interface.js +2 -0
  12. package/src/lib/interfaces/node-operations.interface.d.ts +29 -1
  13. package/src/lib/interfaces/template-operations.interface.d.ts +22 -1
  14. package/src/lib/operations/batch-operations.d.ts +3 -15
  15. package/src/lib/operations/batch-operations.js +8 -80
  16. package/src/lib/operations/custom-shape-operations.d.ts +27 -0
  17. package/src/lib/operations/custom-shape-operations.js +175 -0
  18. package/src/lib/operations/document-operations.js +9 -2
  19. package/src/lib/operations/element-operations.d.ts +3 -22
  20. package/src/lib/operations/element-operations.js +6 -119
  21. package/src/lib/operations/node-operations.d.ts +9 -3
  22. package/src/lib/operations/node-operations.js +18 -5
  23. package/src/lib/operations/template-operations.d.ts +3 -1
  24. package/src/lib/operations/template-operations.js +50 -7
  25. package/src/lib/testing/mock-auth-client.d.ts +2 -0
  26. package/src/lib/testing/mock-auth-client.js +7 -0
  27. package/src/lib/types/api-types.d.ts +113 -2
  28. package/src/lib/types/element-input-types.d.ts +67 -11
  29. package/src/lib/utils/element-builder.d.ts +63 -0
  30. package/src/lib/utils/element-builder.js +258 -0
  31. package/src/lib/utils/rotation.d.ts +4 -0
  32. package/src/lib/utils/rotation.js +13 -0
  33. package/src/lib/validators/custom-shape-definition-validator.d.ts +17 -0
  34. package/src/lib/validators/custom-shape-definition-validator.js +135 -0
  35. package/src/lib/validators/element-type-validators/base-element-validator.d.ts +4 -0
  36. package/src/lib/validators/element-type-validators/base-element-validator.js +30 -0
  37. package/src/lib/validators/element-type-validators/basic-shape-validators.js +2 -0
  38. package/src/lib/validators/element-type-validators/bezier-curve-validator.d.ts +12 -0
  39. package/src/lib/validators/element-type-validators/bezier-curve-validator.js +47 -0
  40. package/src/lib/validators/element-type-validators/block-arrow-validator.js +2 -0
  41. package/src/lib/validators/element-type-validators/line-validator.d.ts +1 -0
  42. package/src/lib/validators/element-type-validators/line-validator.js +12 -5
  43. package/src/lib/validators/element-type-validators/rectangle-validator.js +2 -0
  44. package/src/lib/validators/element-validator-registry.js +2 -0
  45. package/src/lib/validators/template-validator.d.ts +7 -1
  46. package/src/lib/validators/template-validator.js +21 -0
@@ -26,6 +26,27 @@ class TemplateValidator {
26
26
  }
27
27
  this.validateCanvasDimensions(input.canvasWidth, input.canvasHeight);
28
28
  }
29
+ /**
30
+ * Validates input for template update.
31
+ * @param input The update input to validate
32
+ * @throws ValidationError if validation fails
33
+ */
34
+ validateUpdate(input) {
35
+ if (input.title !== undefined) {
36
+ if (typeof input.title !== "string") {
37
+ throw new api_errors_1.ValidationError("title must be a string", "title");
38
+ }
39
+ if (input.title.trim().length === 0) {
40
+ throw new api_errors_1.ValidationError("title cannot be empty", "title");
41
+ }
42
+ if (input.title.length > 200) {
43
+ throw new api_errors_1.ValidationError("title must be 200 characters or less", "title");
44
+ }
45
+ }
46
+ if (input.content !== undefined && typeof input.content !== "string") {
47
+ throw new api_errors_1.ValidationError("content must be a string", "content");
48
+ }
49
+ }
29
50
  /**
30
51
  * Validates canvas dimensions.
31
52
  */