@api-client/core 0.14.2 → 0.14.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.
Files changed (86) hide show
  1. package/build/src/browser.d.ts +1 -1
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js +1 -0
  4. package/build/src/browser.js.map +1 -1
  5. package/build/src/events/BaseEvents.d.ts +4 -0
  6. package/build/src/events/BaseEvents.d.ts.map +1 -1
  7. package/build/src/events/BaseEvents.js.map +1 -1
  8. package/build/src/index.d.ts +2 -1
  9. package/build/src/index.d.ts.map +1 -1
  10. package/build/src/index.js +2 -0
  11. package/build/src/index.js.map +1 -1
  12. package/build/src/modeling/ApiFile.d.ts +23 -0
  13. package/build/src/modeling/ApiFile.d.ts.map +1 -0
  14. package/build/src/modeling/ApiFile.js +44 -0
  15. package/build/src/modeling/ApiFile.js.map +1 -0
  16. package/build/src/modeling/ApiModel.d.ts +159 -0
  17. package/build/src/modeling/ApiModel.d.ts.map +1 -0
  18. package/build/src/modeling/ApiModel.js +237 -0
  19. package/build/src/modeling/ApiModel.js.map +1 -0
  20. package/build/src/modeling/DataDomain.d.ts +1 -1
  21. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  22. package/build/src/modeling/DataDomain.js +1 -3
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DomainEntity.js +1 -1
  25. package/build/src/modeling/DomainEntity.js.map +1 -1
  26. package/build/src/modeling/DomainFile.d.ts +1 -2
  27. package/build/src/modeling/DomainFile.d.ts.map +1 -1
  28. package/build/src/modeling/DomainFile.js +3 -41
  29. package/build/src/modeling/DomainFile.js.map +1 -1
  30. package/build/src/modeling/Semantics.d.ts +55 -8
  31. package/build/src/modeling/Semantics.d.ts.map +1 -1
  32. package/build/src/modeling/Semantics.js +62 -8
  33. package/build/src/modeling/Semantics.js.map +1 -1
  34. package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -1
  35. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -1
  36. package/build/src/modeling/types.d.ts +491 -0
  37. package/build/src/modeling/types.d.ts.map +1 -1
  38. package/build/src/modeling/types.js.map +1 -1
  39. package/build/src/models/kinds.d.ts +3 -0
  40. package/build/src/models/kinds.d.ts.map +1 -1
  41. package/build/src/models/kinds.js +3 -0
  42. package/build/src/models/kinds.js.map +1 -1
  43. package/build/src/models/store/File.d.ts +19 -2
  44. package/build/src/models/store/File.d.ts.map +1 -1
  45. package/build/src/models/store/File.js +100 -13
  46. package/build/src/models/store/File.js.map +1 -1
  47. package/build/src/models/store/Group.d.ts +76 -2
  48. package/build/src/models/store/Group.d.ts.map +1 -1
  49. package/build/src/models/store/Group.js +84 -1
  50. package/build/src/models/store/Group.js.map +1 -1
  51. package/build/src/sdk/GroupsSdk.d.ts +41 -0
  52. package/build/src/sdk/GroupsSdk.d.ts.map +1 -0
  53. package/build/src/sdk/GroupsSdk.js +135 -0
  54. package/build/src/sdk/GroupsSdk.js.map +1 -0
  55. package/build/src/sdk/RouteBuilder.d.ts +2 -0
  56. package/build/src/sdk/RouteBuilder.d.ts.map +1 -1
  57. package/build/src/sdk/RouteBuilder.js +6 -0
  58. package/build/src/sdk/RouteBuilder.js.map +1 -1
  59. package/build/src/sdk/Sdk.d.ts +2 -0
  60. package/build/src/sdk/Sdk.d.ts.map +1 -1
  61. package/build/src/sdk/Sdk.js +5 -0
  62. package/build/src/sdk/Sdk.js.map +1 -1
  63. package/build/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +2 -3
  65. package/src/events/BaseEvents.ts +4 -0
  66. package/src/modeling/ApiFile.ts +53 -0
  67. package/src/modeling/ApiModel.ts +327 -0
  68. package/src/modeling/DataDomain.ts +1 -1
  69. package/src/modeling/DomainEntity.ts +1 -1
  70. package/src/modeling/DomainFile.ts +3 -40
  71. package/src/modeling/Semantics.ts +63 -8
  72. package/src/modeling/amf/ShapeGenerator.ts +1 -1
  73. package/src/modeling/types.ts +545 -0
  74. package/src/models/kinds.ts +3 -0
  75. package/src/models/store/File.ts +100 -13
  76. package/src/models/store/Group.ts +148 -2
  77. package/src/sdk/GroupsSdk.ts +150 -0
  78. package/src/sdk/RouteBuilder.ts +8 -0
  79. package/src/sdk/Sdk.ts +6 -0
  80. package/tests/unit/modeling/api_model.spec.ts +291 -0
  81. package/tests/unit/modeling/domain_entity.spec.ts +15 -15
  82. package/tests/unit/modeling/domain_file.spec.ts +1 -11
  83. package/tests/unit/modeling/domain_model_entities.spec.ts +2 -2
  84. package/tests/unit/modeling/semantics.spec.ts +8 -11
  85. package/tests/unit/models/File/constructor.spec.ts +3 -2
  86. package/tests/unit/models/File/shortcutTo.spec.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DomainFile.js","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAc,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMnD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IACzB,IAAI,GAAG,cAAc,CAAA;IAE9B,MAAM,CAAU,QAAQ,CAAC,IAAY;QACnC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAe,CAAA;IAC3D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAoC;QACxD,IAAI,KAAuB,CAAA;QAC3B,IAAI,OAAQ,KAAoB,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACvD,KAAK,GAAI,KAAoB,CAAC,MAAM,EAAE,CAAA;QACxC,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,KAAyB,CAAA;QACnC,CAAC;QACD,MAAM,IAAI,GAAgB;YACxB,IAAI,EAAE,cAAc;YACpB,G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IAAI,GAAG,cAAc,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,MAAM,KAAK,GAAG,KAAoB,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEQ,MAAM;QACb,MAAM,MAAM,GAAgB;YAC1B,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,cAAc;SACrB,CAAA;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { nanoid } from '../nanoid.js'\nimport { File, type IFile } from '../models/store/File.js'\nimport { Thing } from '../models/Thing.js'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport { DomainFileKind } from '../models/kinds.js'\n\nexport interface IDomainFile extends IFile {\n kind: typeof DomainFileKind\n}\n\n/**\n * Used by the store. A file definition for the DataDomain\n */\nexport class DomainFile extends File {\n override kind = DomainFileKind\n\n static override fromName(name: string): DomainFile {\n return super.fromName(name, DomainFileKind) as DomainFile\n }\n\n /**\n * Creates the file definition for a DomainNamespace contents.\n *\n * @param input The data namespace instance or schema.\n */\n static fromDataDomain(input: DataDomain | DataDomainSchema): DomainFile {\n let final: DataDomainSchema\n if (typeof (input as DataDomain).toJSON === 'function') {\n final = (input as DataDomain).toJSON()\n } else {\n final = input as DataDomainSchema\n }\n const init: IDomainFile = {\n kind: DomainFileKind,\n key: final.key,\n info: { ...final.info },\n lastModified: { user: '', time: 0, byMe: false },\n parents: [],\n permissionIds: [],\n permissions: [],\n }\n return new DomainFile(init)\n }\n\n constructor(input?: string | IDomainFile) {\n super()\n let init: IDomainFile\n if (typeof input === 'string') {\n init = JSON.parse(input)\n } else if (typeof input === 'object') {\n init = input\n } else {\n init = {\n kind: DomainFileKind,\n key: nanoid(),\n info: Thing.fromName('').toJSON(),\n parents: [],\n permissionIds: [],\n permissions: [],\n lastModified: { user: '', time: 0, byMe: false },\n }\n }\n this.new(init)\n }\n\n override new(init: IDomainFile): this {\n if (!DomainFile.isDomainFile(init)) {\n throw new Error(`Not a data file.`)\n }\n super.new(init)\n this.kind = DomainFileKind\n return this\n }\n\n static isDomainFile(input: unknown): boolean {\n const typed = input as IDomainFile\n if (!input || typed.kind !== DomainFileKind) {\n return false\n }\n return true\n }\n\n override toJSON(): IDomainFile {\n const result: IDomainFile = {\n ...super.toJSON(),\n kind: DomainFileKind,\n }\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"DomainFile.js","sourceRoot":"","sources":["../../../src/modeling/DomainFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAc,MAAM,yBAAyB,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMnD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAI;IACzB,IAAI,GAAG,cAAc,CAAA;IAE9B,MAAM,CAAU,QAAQ,CAAC,IAAY;QACnC,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAe,CAAA;IAC3D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,KAAoC;QACxD,IAAI,KAAuB,CAAA;QAC3B,IAAI,OAAQ,KAAoB,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YACvD,KAAK,GAAI,KAAoB,CAAC,MAAM,EAAE,CAAA;QACxC,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,KAAyB,CAAA;QACnC,CAAC;QACD,OAAO,IAAI,UAAU,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED,YAAY,QAA8B,EAAE;QAC1C,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,MAAM,KAAK,GAAG,KAAoB,CAAA;QAClC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAA;QACd,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAEQ,MAAM;QACb,MAAM,MAAM,GAAgB;YAC1B,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,cAAc;SACrB,CAAA;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { File, type IFile } from '../models/store/File.js'\nimport type { DataDomain, DataDomainSchema } from './DataDomain.js'\nimport { DomainFileKind } from '../models/kinds.js'\n\nexport interface IDomainFile extends IFile {\n kind: typeof DomainFileKind\n}\n\n/**\n * Used by the store. A file definition for the DataDomain\n */\nexport class DomainFile extends File {\n override kind = DomainFileKind\n\n static override fromName(name: string): DomainFile {\n return super.fromName(name, DomainFileKind) as DomainFile\n }\n\n /**\n * Creates the file definition for a DomainNamespace contents.\n *\n * @param input The data namespace instance or schema.\n */\n static fromDataDomain(input: DataDomain | DataDomainSchema): DomainFile {\n let final: DataDomainSchema\n if (typeof (input as DataDomain).toJSON === 'function') {\n final = (input as DataDomain).toJSON()\n } else {\n final = input as DataDomainSchema\n }\n return new DomainFile({ key: final.key, info: final.info })\n }\n\n constructor(state: Partial<IDomainFile> = {}) {\n super({ ...state, kind: DomainFileKind })\n }\n\n static isDomainFile(input: unknown): boolean {\n const typed = input as IDomainFile\n if (!input || typed.kind !== DomainFileKind) {\n return false\n }\n return true\n }\n\n override toJSON(): IDomainFile {\n const result: IDomainFile = {\n ...super.toJSON(),\n kind: DomainFileKind,\n }\n return result\n }\n}\n"]}
@@ -7,12 +7,42 @@ export declare enum SemanticType {
7
7
  /**
8
8
  * Designates a Data Entity that represents users of the system.
9
9
  */
10
- User = "https://apinow.app/semantics/entities/#User",
11
- CreatedTimestamp = "https://apinow.app/semantics/properties/#CreatedTimestamp",
12
- UpdatedTimestamp = "https://apinow.app/semantics/properties/#UpdatedTimestamp",
13
- DeletedTimestamp = "https://apinow.app/semantics/properties/#DeletedTimestamp",
14
- DeletedFlag = "https://apinow.app/semantics/properties/#DeletedFlag",
15
- PublicUniqueName = "https://apinow.app/semantics/properties/#PublicUniqueName",
10
+ User = "Semantic#User",
11
+ /**
12
+ * Annotates the field as the user password.
13
+ * The runtime should treat this field with special care,
14
+ * ensuring it is encrypted and not exposed in API responses.
15
+ */
16
+ Password = "Semantic#Password",
17
+ /**
18
+ * Designates a Data Property as the `createdAt` timestamp of an entity.
19
+ * This is used to track when the entity was first created.
20
+ */
21
+ CreatedTimestamp = "Semantic#CreatedTimestamp",
22
+ /**
23
+ * Designates a Data Property as the `updatedAt` timestamp of an entity.
24
+ * This is used to track when the entity was last modified.
25
+ */
26
+ UpdatedTimestamp = "Semantic#UpdatedTimestamp",
27
+ /**
28
+ * Designates a Data Property as the `deletedAt` timestamp of an entity.
29
+ * This is used to track when the entity was soft-deleted.
30
+ * Soft-deletion means the entity is not physically removed from the database,
31
+ * but marked as deleted for logical deletion purposes.
32
+ */
33
+ DeletedTimestamp = "Semantic#DeletedTimestamp",
34
+ /**
35
+ * Designates a Data Property as a boolean flag indicating whether the entity is deleted.
36
+ * This is used for soft-deletion, where the entity is not physically removed from the database,
37
+ * but marked as deleted.
38
+ */
39
+ DeletedFlag = "Semantic#DeletedFlag",
40
+ /**
41
+ * Designates a Data Property as a unique public identifier for a resource.
42
+ * This is often used in URLs to provide a user-friendly way to access the resource.
43
+ * For example, a blog post might have a public unique name like "my-first-post".
44
+ */
45
+ PublicUniqueName = "Semantic#PublicUniqueName",
16
46
  /**
17
47
  * Designates a Data Property as the `role` of a user within the system.
18
48
  * This is used to define the user's permissions and access levels.
@@ -20,15 +50,32 @@ export declare enum SemanticType {
20
50
  * compared to a user with the role of "guest".
21
51
  * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.
22
52
  */
23
- UserRole = "https://apinow.app/semantics/entities/#UserRole",
24
- ResourceOwnerIdentifier = "https://apinow.app/semantics/associations/#ResourceOwnerIdentifier"
53
+ UserRole = "Semantic#UserRole",
54
+ /**
55
+ * Designates an association that links a resource to a "User" entity instance.
56
+ * This is used to indicate ownership of the resource for access control purposes.
57
+ * For example, a blog post might have a resource owner identifier that points to the user who created it.
58
+ */
59
+ ResourceOwnerIdentifier = "Semantic#ResourceOwnerIdentifier"
25
60
  }
26
61
  /**
27
62
  * Defines the scope at which a semantic can be applied.
28
63
  */
29
64
  export declare enum SemanticScope {
65
+ /**
66
+ * The semantic applies to an entire Data Entity.
67
+ * This is used for semantics that provide context or constraints at the entity level.
68
+ */
30
69
  Entity = "Entity",
70
+ /**
71
+ * The semantic applies to a single Data Property.
72
+ * This is used for semantics that provide context or constraints at the property level.
73
+ */
31
74
  Property = "Property",
75
+ /**
76
+ * The semantic applies to an Association between Data Entities.
77
+ * This is used for semantics that provide context or constraints at the association level.
78
+ */
32
79
  Association = "Association"
33
80
  }
34
81
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Semantics.d.ts","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD;;;GAGG;AACH,oBAAY,YAAY;IAEtB;;OAEG;IACH,IAAI,gDAAgD;IAGpD,gBAAgB,8DAA8D;IAC9E,gBAAgB,8DAA8D;IAC9E,gBAAgB,8DAA8D;IAC9E,WAAW,yDAAyD;IACpE,gBAAgB,8DAA8D;IAC9E;;;;;;OAMG;IACH,QAAQ,oDAAoD;IAE5D,uBAAuB,uEAAuE;CAC/F;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AAED;;;;;GAKG;AACH,UAAU,gBAAgB;IACxB;;OAEG;IACH,EAA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eAAO,MAAM,kBAAkB,GAAI,UAAU,YAAY,KAAG,QAAQ,IAAI,gBAC7B,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,YAAY,KAAG,QAAQ,IAAI,mBAC7B,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AAElF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,YAAY,CAmE5D,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,EAAE,YAAY,CAAA;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC"}
@@ -8,13 +8,43 @@ export var SemanticType;
8
8
  /**
9
9
  * Designates a Data Entity that represents users of the system.
10
10
  */
11
- SemanticType["User"] = "https://apinow.app/semantics/entities/#User";
11
+ SemanticType["User"] = "Semantic#User";
12
12
  // Property-Level Semantics
13
- SemanticType["CreatedTimestamp"] = "https://apinow.app/semantics/properties/#CreatedTimestamp";
14
- SemanticType["UpdatedTimestamp"] = "https://apinow.app/semantics/properties/#UpdatedTimestamp";
15
- SemanticType["DeletedTimestamp"] = "https://apinow.app/semantics/properties/#DeletedTimestamp";
16
- SemanticType["DeletedFlag"] = "https://apinow.app/semantics/properties/#DeletedFlag";
17
- SemanticType["PublicUniqueName"] = "https://apinow.app/semantics/properties/#PublicUniqueName";
13
+ /**
14
+ * Annotates the field as the user password.
15
+ * The runtime should treat this field with special care,
16
+ * ensuring it is encrypted and not exposed in API responses.
17
+ */
18
+ SemanticType["Password"] = "Semantic#Password";
19
+ /**
20
+ * Designates a Data Property as the `createdAt` timestamp of an entity.
21
+ * This is used to track when the entity was first created.
22
+ */
23
+ SemanticType["CreatedTimestamp"] = "Semantic#CreatedTimestamp";
24
+ /**
25
+ * Designates a Data Property as the `updatedAt` timestamp of an entity.
26
+ * This is used to track when the entity was last modified.
27
+ */
28
+ SemanticType["UpdatedTimestamp"] = "Semantic#UpdatedTimestamp";
29
+ /**
30
+ * Designates a Data Property as the `deletedAt` timestamp of an entity.
31
+ * This is used to track when the entity was soft-deleted.
32
+ * Soft-deletion means the entity is not physically removed from the database,
33
+ * but marked as deleted for logical deletion purposes.
34
+ */
35
+ SemanticType["DeletedTimestamp"] = "Semantic#DeletedTimestamp";
36
+ /**
37
+ * Designates a Data Property as a boolean flag indicating whether the entity is deleted.
38
+ * This is used for soft-deletion, where the entity is not physically removed from the database,
39
+ * but marked as deleted.
40
+ */
41
+ SemanticType["DeletedFlag"] = "Semantic#DeletedFlag";
42
+ /**
43
+ * Designates a Data Property as a unique public identifier for a resource.
44
+ * This is often used in URLs to provide a user-friendly way to access the resource.
45
+ * For example, a blog post might have a public unique name like "my-first-post".
46
+ */
47
+ SemanticType["PublicUniqueName"] = "Semantic#PublicUniqueName";
18
48
  /**
19
49
  * Designates a Data Property as the `role` of a user within the system.
20
50
  * This is used to define the user's permissions and access levels.
@@ -22,17 +52,34 @@ export var SemanticType;
22
52
  * compared to a user with the role of "guest".
23
53
  * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.
24
54
  */
25
- SemanticType["UserRole"] = "https://apinow.app/semantics/entities/#UserRole";
55
+ SemanticType["UserRole"] = "Semantic#UserRole";
26
56
  // Association-Level Semantics
27
- SemanticType["ResourceOwnerIdentifier"] = "https://apinow.app/semantics/associations/#ResourceOwnerIdentifier";
57
+ /**
58
+ * Designates an association that links a resource to a "User" entity instance.
59
+ * This is used to indicate ownership of the resource for access control purposes.
60
+ * For example, a blog post might have a resource owner identifier that points to the user who created it.
61
+ */
62
+ SemanticType["ResourceOwnerIdentifier"] = "Semantic#ResourceOwnerIdentifier";
28
63
  })(SemanticType || (SemanticType = {}));
29
64
  /**
30
65
  * Defines the scope at which a semantic can be applied.
31
66
  */
32
67
  export var SemanticScope;
33
68
  (function (SemanticScope) {
69
+ /**
70
+ * The semantic applies to an entire Data Entity.
71
+ * This is used for semantics that provide context or constraints at the entity level.
72
+ */
34
73
  SemanticScope["Entity"] = "Entity";
74
+ /**
75
+ * The semantic applies to a single Data Property.
76
+ * This is used for semantics that provide context or constraints at the property level.
77
+ */
35
78
  SemanticScope["Property"] = "Property";
79
+ /**
80
+ * The semantic applies to an Association between Data Entities.
81
+ * This is used for semantics that provide context or constraints at the association level.
82
+ */
36
83
  SemanticScope["Association"] = "Association";
37
84
  })(SemanticScope || (SemanticScope = {}));
38
85
  /**
@@ -60,6 +107,13 @@ export const DataSemantics = {
60
107
  description: 'Designates an entity that represents system users, crucial for authentication and authorization.',
61
108
  },
62
109
  // Property-Level Definitions
110
+ [SemanticType.Password]: {
111
+ id: SemanticType.Password,
112
+ displayName: 'User Password',
113
+ scope: SemanticScope.Property,
114
+ description: 'Annotates the field as the user password. The runtime should treat this field with special care, ensuring it is encrypted and not exposed in API responses.',
115
+ applicableDataTypes: ['string'],
116
+ },
63
117
  [SemanticType.CreatedTimestamp]: {
64
118
  id: SemanticType.CreatedTimestamp,
65
119
  displayName: 'Creation Timestamp',
@@ -1 +1 @@
1
- {"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,YAuBX;AAvBD,WAAY,YAAY;IACtB,yBAAyB;IACzB;;OAEG;IACH,oEAAoD,CAAA;IAEpD,2BAA2B;IAC3B,8FAA8E,CAAA;IAC9E,8FAA8E,CAAA;IAC9E,8FAA8E,CAAA;IAC9E,oFAAoE,CAAA;IACpE,8FAA8E,CAAA;IAC9E;;;;;;OAMG;IACH,4EAA4D,CAAA;IAC5D,8BAA8B;IAC9B,8GAA8F,CAAA;AAChG,CAAC,EAvBW,YAAY,KAAZ,YAAY,QAuBvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kCAAiB,CAAA;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C/B,EAAE,EAAE,YAAY,CAAC,gBAAgB;QACjC,WAAW,EAAE,uBAAuB;QACpC,KAAK,EAAE,aAAa,CAAC,QAAQ;QAC7B,WAAW,EAAE,uEAAuE;QACpF,mBAAmB,EAAE,CAAC,UAAU,CAAC;KAClC;IACD,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE;QAC1B,EAAE,EAAE,YAAY,CAAC,WAAW;QAC5B,WAAW,EAAE,kBAAkB;QAC/B,KAAK,EAAE,aAAa,CAAC,QAAQ;QAC7B,WAAW,EAAE,qFAAqF;QAClG,mBAAmB,EAAE,CAAC,SAAS,CAAC;KACjC;IACD,CAAC,YAAY,CAAC,uBAAuB,CAAC,EAAE;QACtC,EAAE,EAAE,YAAY,CAAC,uBAAuB;QACxC,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,aAAa,CAAC,WAAW;QAChC,WAAW,EAAE,wFAAwF;KACtG;IACD,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE;QAC/B,EAAE,EAAE,YAAY,CAAC,gBAAgB;QACjC,WAAW,EAAE,2BAA2B;QACxC,KAAK,EAAE,aAAa,CAAC,QAAQ;QAC7B,WAAW,EAAE,+EAA+E;QAC5F,mBAAmB,EAAE,CAAC,QAAQ,CAAC;KAChC;IACD,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;QACvB,EAAE,EAAE,YAAY,CAAC,QAAQ;QACzB,WAAW,EAAE,iBAAiB;QAC9B,KAAK,EAAE,aAAa,CAAC,QAAQ;QAC7B,WAAW,EACT,iIAAiI;QACnI,mBAAmB,EAAE,CAAC,QAAQ,CAAC;KAChC;CACF,CAAA","sourcesContent":["/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n // Entity-Level Semantics\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'https://apinow.app/semantics/entities/#User',\n\n // Property-Level Semantics\n CreatedTimestamp = 'https://apinow.app/semantics/properties/#CreatedTimestamp',\n UpdatedTimestamp = 'https://apinow.app/semantics/properties/#UpdatedTimestamp',\n DeletedTimestamp = 'https://apinow.app/semantics/properties/#DeletedTimestamp',\n DeletedFlag = 'https://apinow.app/semantics/properties/#DeletedFlag',\n PublicUniqueName = 'https://apinow.app/semantics/properties/#PublicUniqueName',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'https://apinow.app/semantics/entities/#UserRole',\n // Association-Level Semantics\n ResourceOwnerIdentifier = 'https://apinow.app/semantics/associations/#ResourceOwnerIdentifier',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n Entity = 'Entity',\n Property = 'Property',\n Association = 'Association',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n // Entity-Level Definitions\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'Designates an entity that represents system users, crucial for authentication and authorization.',\n },\n\n // Property-Level Definitions\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the one that contains the object's creation timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's last modification timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's deletion timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'A boolean property that marks the object as deleted without physically removing it.',\n applicableDataTypes: ['boolean'],\n },\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links a resource to a \"User\" entity instance, indicating ownership for access control.',\n },\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description:\n 'A text field that is recognized by the runtime as a role of a user in the API. Used with the role-based authorization strategy.',\n applicableDataTypes: ['string'],\n },\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
1
+ {"version":3,"file":"Semantics.js","sourceRoot":"","sources":["../../../src/modeling/Semantics.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAN,IAAY,YA0DX;AA1DD,WAAY,YAAY;IACtB,yBAAyB;IACzB;;OAEG;IACH,sCAAsB,CAAA;IAEtB,2BAA2B;IAC3B;;;;OAIG;IACH,8CAA8B,CAAA;IAC9B;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;OAGG;IACH,8DAA8C,CAAA;IAC9C;;;;;OAKG;IACH,8DAA8C,CAAA;IAC9C;;;;OAIG;IACH,oDAAoC,CAAA;IACpC;;;;OAIG;IACH,8DAA8C,CAAA;IAC9C;;;;;;OAMG;IACH,8CAA8B,CAAA;IAC9B,8BAA8B;IAC9B;;;;OAIG;IACH,4EAA4D,CAAA;AAC9D,CAAC,EA1DW,YAAY,KAAZ,YAAY,QA0DvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAgB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QAC7B,WAAW,EACT,iIAAiI;QACnI,mBAAmB,EAAE,CAAC,QAAQ,CAAC;KAChC;CACF,CAAA","sourcesContent":["/* eslint-disable max-len */\nimport type { DomainPropertyType } from './DataFormat.js'\n\n/**\n * Defines the names for all available data semantics.\n * Using a string enum makes it easy to add or remove semantics in a single place.\n */\nexport enum SemanticType {\n // Entity-Level Semantics\n /**\n * Designates a Data Entity that represents users of the system.\n */\n User = 'Semantic#User',\n\n // Property-Level Semantics\n /**\n * Annotates the field as the user password.\n * The runtime should treat this field with special care,\n * ensuring it is encrypted and not exposed in API responses.\n */\n Password = 'Semantic#Password',\n /**\n * Designates a Data Property as the `createdAt` timestamp of an entity.\n * This is used to track when the entity was first created.\n */\n CreatedTimestamp = 'Semantic#CreatedTimestamp',\n /**\n * Designates a Data Property as the `updatedAt` timestamp of an entity.\n * This is used to track when the entity was last modified.\n */\n UpdatedTimestamp = 'Semantic#UpdatedTimestamp',\n /**\n * Designates a Data Property as the `deletedAt` timestamp of an entity.\n * This is used to track when the entity was soft-deleted.\n * Soft-deletion means the entity is not physically removed from the database,\n * but marked as deleted for logical deletion purposes.\n */\n DeletedTimestamp = 'Semantic#DeletedTimestamp',\n /**\n * Designates a Data Property as a boolean flag indicating whether the entity is deleted.\n * This is used for soft-deletion, where the entity is not physically removed from the database,\n * but marked as deleted.\n */\n DeletedFlag = 'Semantic#DeletedFlag',\n /**\n * Designates a Data Property as a unique public identifier for a resource.\n * This is often used in URLs to provide a user-friendly way to access the resource.\n * For example, a blog post might have a public unique name like \"my-first-post\".\n */\n PublicUniqueName = 'Semantic#PublicUniqueName',\n /**\n * Designates a Data Property as the `role` of a user within the system.\n * This is used to define the user's permissions and access levels.\n * For example, a user with the role of \"admin\" would have elevated permissions\n * compared to a user with the role of \"guest\".\n * Roles are defined on the entity as enums, or as a string property with a controlled vocabulary.\n */\n UserRole = 'Semantic#UserRole',\n // Association-Level Semantics\n /**\n * Designates an association that links a resource to a \"User\" entity instance.\n * This is used to indicate ownership of the resource for access control purposes.\n * For example, a blog post might have a resource owner identifier that points to the user who created it.\n */\n ResourceOwnerIdentifier = 'Semantic#ResourceOwnerIdentifier',\n}\n\n/**\n * Defines the scope at which a semantic can be applied.\n */\nexport enum SemanticScope {\n /**\n * The semantic applies to an entire Data Entity.\n * This is used for semantics that provide context or constraints at the entity level.\n */\n Entity = 'Entity',\n /**\n * The semantic applies to a single Data Property.\n * This is used for semantics that provide context or constraints at the property level.\n */\n Property = 'Property',\n /**\n * The semantic applies to an Association between Data Entities.\n * This is used for semantics that provide context or constraints at the association level.\n */\n Association = 'Association',\n}\n\n/**\n * A base interface for all Data Semantics, containing common properties.\n * A semantic is an annotation applied to a Data Entity, Property, or Association\n * to provide additional context or constraints.\n * This interface is extended by more specific semantic types.\n */\ninterface BaseDataSemantic {\n /**\n * A unique identifier for the semantic definition.\n */\n id: SemanticType\n /**\n * A human-readable name for the semantic.\n */\n displayName: string\n /**\n * A description of the semantic's purpose and impact.\n */\n description: string\n /**\n * Specifies whether the semantic applies to an Entity, Property, or Association.\n */\n scope: SemanticScope\n}\n\n/**\n * Represents a semantic that can be applied to an entire Data Entity.\n */\nexport interface EntitySemantic extends BaseDataSemantic {\n scope: SemanticScope.Entity\n}\n\n/**\n * Represents a semantic that can be applied to a single property.\n */\nexport interface PropertySemantic extends BaseDataSemantic {\n scope: SemanticScope.Property\n /**\n * Optional array of data types this semantic can be applied to.\n * Enforces constraints, e.g., DeletedTimestamp on a DateTime property.\n */\n applicableDataTypes?: DomainPropertyType[]\n}\n\n/**\n * Represents a semantic that can be applied to an association between entities.\n */\nexport interface AssociationSemantic extends BaseDataSemantic {\n scope: SemanticScope.Association\n}\n\n/**\n * A type guard to check if a semantic is an EntitySemantic.\n */\nexport const isEntitySemantic = (semantic: DataSemantic): semantic is EntitySemantic =>\n semantic.scope === SemanticScope.Entity\n\n/**\n * A type guard to check if a semantic is a PropertySemantic.\n */\nexport const isPropertySemantic = (semantic: DataSemantic): semantic is PropertySemantic =>\n semantic.scope === SemanticScope.Property\n\n/**\n * A type guard to check if a semantic is a AssociationSemantic.\n */\nexport const isAssociationSemantic = (semantic: DataSemantic): semantic is AssociationSemantic =>\n semantic.scope === SemanticScope.Association\n\n/**\n * Union type for any kind of data semantic\n */\nexport type DataSemantic = EntitySemantic | PropertySemantic | AssociationSemantic\n\n/**\n * A map to store the definitions of all available data semantics.\n * This acts as a central registry for the application.\n */\nexport const DataSemantics: Record<SemanticType, DataSemantic> = {\n // Entity-Level Definitions\n [SemanticType.User]: {\n id: SemanticType.User,\n displayName: 'User Entity',\n scope: SemanticScope.Entity,\n description: 'Designates an entity that represents system users, crucial for authentication and authorization.',\n },\n\n // Property-Level Definitions\n [SemanticType.Password]: {\n id: SemanticType.Password,\n displayName: 'User Password',\n scope: SemanticScope.Property,\n description:\n 'Annotates the field as the user password. The runtime should treat this field with special care, ensuring it is encrypted and not exposed in API responses.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.CreatedTimestamp]: {\n id: SemanticType.CreatedTimestamp,\n displayName: 'Creation Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the one that contains the object's creation timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.UpdatedTimestamp]: {\n id: SemanticType.UpdatedTimestamp,\n displayName: 'Update Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's last modification timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedTimestamp]: {\n id: SemanticType.DeletedTimestamp,\n displayName: 'Soft Delete Timestamp',\n scope: SemanticScope.Property,\n description: \"Marks a field as the field that contains object's deletion timestamp.\",\n applicableDataTypes: ['datetime'],\n },\n [SemanticType.DeletedFlag]: {\n id: SemanticType.DeletedFlag,\n displayName: 'Soft Delete Flag',\n scope: SemanticScope.Property,\n description: 'A boolean property that marks the object as deleted without physically removing it.',\n applicableDataTypes: ['boolean'],\n },\n [SemanticType.ResourceOwnerIdentifier]: {\n id: SemanticType.ResourceOwnerIdentifier,\n displayName: 'Resource Owner Identifier',\n scope: SemanticScope.Association,\n description: 'Links a resource to a \"User\" entity instance, indicating ownership for access control.',\n },\n [SemanticType.PublicUniqueName]: {\n id: SemanticType.PublicUniqueName,\n displayName: 'Public Unique Name (Slug)',\n scope: SemanticScope.Property,\n description: 'A user-friendly, unique public identifier for a resource, often used in URLs.',\n applicableDataTypes: ['string'],\n },\n [SemanticType.UserRole]: {\n id: SemanticType.UserRole,\n displayName: 'User Role Field',\n scope: SemanticScope.Property,\n description:\n 'A text field that is recognized by the runtime as a role of a user in the API. Used with the role-based authorization strategy.',\n applicableDataTypes: ['string'],\n },\n}\n\n/**\n * Represents the application of a data semantic to a specific\n * entity or property within a user's data model.\n */\nexport interface AppliedDataSemantic {\n /**\n * The unique identifier of the semantic being applied.\n */\n id: SemanticType\n\n /**\n * Optional configuration or values specific to this application.\n */\n config?: Record<string, unknown>\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ShapeGenerator.d.ts","sourceRoot":"","sources":["../../../../src/modeling/amf/ShapeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,EAIL,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,cAAc,EACd,WAAW,EAMZ,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AASjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;A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;IAC7C,CAAC;IAED;;;;;;;OAOG;IACO,oBAAoB,CAAC,EAAU,EAAE,KAAkB;QAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { type AssociationBindings, type PropertyWebBindings } from '../Bindings.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainEntity } from '../DomainEntity.js'\nimport { IAmfExampleTypes, modelTypeToAmfDataType } from '../../amf/AmfTypes.js'\nimport { AmfNamespace } from '../../amf/definitions/Namespace.js'\nimport {\n anyShape,\n arrayShape,\n fileShape,\n IApiAnyShape,\n IApiArrayShape,\n IApiDataExample,\n IApiFileShape,\n IApiNodeShape,\n IApiPropertyShape,\n IApiRecursiveShape,\n IApiScalarShape,\n IApiShape,\n IApiUnionShape,\n IShapeUnion,\n nodeShape,\n propertyShape,\n recursiveShape,\n scalarShape,\n unionShape,\n} from '../../amf/definitions/Shapes.js'\nimport { AmfDataNode } from '../../amf/models/AmfDataNode.js'\nimport { DataValueGenerator } from '../../amf/DataValueGenerator.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DomainEntityKind, DomainPropertyKind } from '../../models/kinds.js'\nimport type { PropertySchema } from '../types.js'\n\nconst UNION_TYPE_ANY_OF = 'anyOf'\nconst UNION_TYPE_ALL_OF = 'allOf'\nconst UNION_TYPE_ONE_OF = 'oneOf'\nconst UNION_TYPE_NOT = 'not'\nconst DATA_TYPE_STRING = 'string'\nconst DATA_TYPE_BINARY = 'binary'\n\n/**\n * Serializes Data Domain elements (DomainEntity, DomainProperty, DomainAssociation)\n * to AMF shapes.\n *\n * This class provides a mechanism to translate a data domain model, defined using\n * custom classes like `DomainEntity`, `DomainProperty`, and `DomainAssociation`,\n * into AMF (API Modeling Framework) shapes. AMF shapes are a standardized way\n * to represent API structures and data models, enabling interoperability and tooling.\n *\n * This is particularly useful when you have a custom data model and need to\n * generate API definitions (e.g., RAML or OAS) from it.\n *\n * **Key Features:**\n *\n * - **Data Domain to AMF Translation:** Converts data domain elements into\n * their corresponding AMF shape representations.\n * - **Recursive Shape Handling:** Detects and handles recursive relationships\n * within the data model to prevent infinite loops during shape generation.\n * - **Union Type Support:** Supports the creation of union types in AMF\n * to represent associations that can point to multiple different entity types.\n * - **Binding Integration:** Leverages binding information (e.g., web bindings)\n * to customize the generated AMF shapes based on the target API format.\n * - **Example and Default Value Generation:** Integrates with a `DataValueGenerator`\n * to automatically generate example values and default values for properties\n * within the AMF shapes.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `ShapeGenerator`.\n * 2. Call the appropriate method (e.g., `entity()`, `property()`, `associationShape()`)\n * to generate the AMF shape for a specific data domain element.\n * 3. The returned AMF shape can then be used with other AMF tools to generate\n * API definitions or perform other API-related tasks.\n */\nexport class ShapeGenerator {\n #valueGenerator?: DataValueGenerator\n\n /**\n * Used with data domain value generation for entity properties.\n * Lazily loaded class only when functions are used.\n * This needs to be a class instances because some functions are incremental\n */\n get valueGenerator(): DataValueGenerator {\n // we need a new instance of the generator for each shape generation\n // as the generator is stateful and we need to reset it for each shape.\n if (!this.#valueGenerator) {\n this.#valueGenerator = new DataValueGenerator()\n }\n return this.#valueGenerator\n }\n\n /**\n * Serializes a `DomainEntity` to an AMF node shape.\n *\n * This method is the entry point for converting a `DomainEntity` into its\n * AMF representation. It handles recursive relationships, property serialization,\n * and inheritance from parent entities.\n *\n * @param input The `DomainEntity` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiNodeShape` or `IApiRecursiveShape` representing the entity in AMF.\n * Returns a `IApiRecursiveShape` if a recursive loop is detected.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.entity(myDomainEntity);\n * ```\n */\n entity(input: DomainEntity, visited: Set<string> = new Set<string>()): IApiNodeShape | IApiRecursiveShape {\n if (visited.has(input.key)) {\n // create a recursive shape.\n return this.createRecursiveShape(input)\n }\n visited.add(input.key)\n const result = nodeShape(input.key)\n result.id = input.key\n this.updateBaseProperties(input, result)\n result.properties = []\n for (const item of input.listProperties()) {\n // we check whether the property is hidden.\n // This is not happening when calling the `property()` because this method\n // always returns the AMF shape.\n const wb = item.readBinding('web') as PropertyWebBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const shape = this.property(item)\n result.properties.push(shape)\n }\n for (const assoc of input.listAssociations()) {\n const wb = assoc.readBinding('web') as AssociationBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const prop = this.associationProperty(assoc, visited)\n result.properties.push(prop)\n }\n for (const parent of input.listParents()) {\n const shape = this.entity(parent, visited)\n result.inherits.push(shape)\n }\n return result\n }\n\n /**\n * Serializes a `DomainProperty` to an AMF property shape.\n *\n * This method converts a `DomainProperty` into an `IApiPropertyShape`,\n * defining its characteristics such as data type, required status, and\n * range (the shape of the property's value).\n *\n * @param input The `DomainProperty` to serialize.\n * @returns An `IApiPropertyShape` representing the property in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.property(myDomainProperty);\n * ```\n */\n property(input: DomainProperty): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.getRange(input)\n\n // for example, Example generator needs to know the name of the property\n // as it does not look into the \"range\" object.\n this.updateBaseProperties(input, result)\n\n // sync the name of the property shape with the range, in case it was changed by the bindings\n if (result.range.name) {\n result.name = result.range.name\n }\n return result\n }\n\n /**\n * Serializes a `DomainAssociation` to an AMF property shape, handling the\n * association's target entity or entities.\n *\n * This method is similar to `property()`, but it specifically handles\n * associations between entities. It determines the range of the property\n * based on the association's target(s) and generates the appropriate\n * AMF shape (e.g., a scalar shape for a linked schema, a union shape for\n * multiple targets).\n *\n * @param input The `DomainAssociation` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiPropertyShape` representing the association in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.associationProperty(myDomainAssociation);\n * ```\n */\n associationProperty(input: DomainAssociation, visited: Set<string> = new Set<string>()): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.associationShape(input, visited)\n\n this.updateBaseProperties(input, result)\n return result\n }\n\n /**\n * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns The range value for the PropertyShape.\n */\n associationShape(input: DomainAssociation, visited: Set<string> = new Set<string>()): IShapeUnion | undefined {\n const schema = input.schema\n if (schema && schema.linked) {\n return this.createLinkedShape(input)\n }\n const items = this.associationUnion(input, visited)\n if (!items) {\n return\n }\n if (Array.isArray(items)) {\n return this.createUnionShape(input, items)\n }\n const unionType = (schema && schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_NOT) {\n // Need to investigate more about \"not\" union type.\n // AMF supports it, but I am not sure how to handle it.\n const wrapper = anyShape(input.key)\n wrapper.id = `not-shape-${input.key}`\n wrapper.not = items\n return wrapper\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, items)\n }\n return items\n }\n\n /**\n * @param input The data association instance.\n * @returns An AMF API scalar shape with the link to the schema.\n */\n protected createLinkedShape(input: DomainAssociation): IApiScalarShape {\n // This is a link to the schema. In an API that would be the id\n // of a resource to request the data from.\n const range = scalarShape(input.key)\n range.id = `link-${input.key}`\n range.dataType = modelTypeToAmfDataType(DATA_TYPE_STRING)\n return range\n }\n\n protected createUnionShape(input: DomainAssociation, items: IShapeUnion[]): IApiUnionShape | IApiArrayShape {\n const range = unionShape(input.key)\n this.updateBaseProperties(input, range)\n range.anyOf = []\n const unionType = (input.schema && input.schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_ANY_OF) {\n range.anyOf = items\n } else if (unionType === UNION_TYPE_ALL_OF) {\n range.and = items\n } else if (unionType === UNION_TYPE_ONE_OF) {\n range.xone = items\n } else {\n // the \"not\" union type only supports a single schema.\n // I am not sure how this should be handled. Will take the first one\n // for now.\n range.not = items[0]\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, range)\n }\n return range\n }\n\n /**\n * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationUnion(\n input: DomainAssociation,\n visited: Set<string> = new Set<string>()\n ): IShapeUnion | IShapeUnion[] | undefined {\n const result: IShapeUnion[] = []\n for (const item of input.listTargets()) {\n result.push(this.entity(item, visited))\n }\n if (!result.length) {\n return undefined\n }\n if (result.length > 1) {\n return result\n }\n return result[0]\n }\n\n /**\n * The DomainProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for\n * default value, examples, and enum values. We also look for the `web`\n * bindings for more detailed definition of a shape.\n *\n * @param input\n */\n protected getRange(input: DomainProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n let schema: PropertySchema | undefined\n if (input.schema) {\n schema = input.schema\n }\n const { multiple, type } = input\n if (multiple) {\n return this.createArrayShape(input, schema, bindings)\n }\n if (type === DATA_TYPE_BINARY) {\n return this.createFileShape(input, bindings)\n }\n return this.createScalarShape(input, schema, bindings)\n }\n\n /**\n * Normally this would be part of generating a scalar schema but the the property is an array this\n * is generated on the array and not on the range.\n *\n * @param result The scalar or array shape.\n * @param schema The property schema\n * @param type The data type of the parent property as set on the `range`\n * @param isArray Whether the DomainProperty is multiple\n */\n protected setShapeSchema(\n input: DomainProperty,\n result: IApiAnyShape,\n schema: PropertySchema,\n type: string,\n isArray?: boolean\n ): void {\n if (schema.defaultValue) {\n const { type: dfFormat } = schema.defaultValue\n const { value } = schema.defaultValue\n if (dfFormat === 'function') {\n const tmp = this.valueGenerator.generate(value, input.type)\n if (tmp !== DataValueGenerator.noValue) {\n const dt = AmfDataNode.scalar(tmp as string, dfFormat)\n result.defaultValue = dt.toJSON()\n }\n } else {\n const dt = AmfDataNode.scalar(value, type)\n result.defaultValue = dt.toJSON()\n }\n }\n if (Array.isArray(schema.enum)) {\n result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())\n }\n if (Array.isArray(schema.examples)) {\n if (isArray) {\n result.examples = this.createArrayExamples(schema.examples, type)\n } else {\n result.examples = this.createExamples(schema.examples, type)\n }\n }\n }\n\n protected createArrayShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape {\n const result = arrayShape(input.key)\n const { type } = input\n if (type === DATA_TYPE_BINARY) {\n // we do not pass schema to the range generator as we set schema's properties on the array shape.\n result.items = this.createFileShape(input, bindings)\n } else {\n result.items = this.createScalarShape(input, undefined, bindings)\n }\n if (schema) {\n const type = (result.items as IApiScalarShape).dataType as string\n this.setShapeSchema(input, result, schema, type, input.multiple)\n }\n return result\n }\n\n protected createScalarShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiScalarShape {\n const result = scalarShape(input.key)\n this.updateBaseProperties(input, result)\n this.setScalarCommonProperties(result, input, bindings)\n if (!result.dataType) {\n result.dataType = modelTypeToAmfDataType(input.type, bindings)\n }\n if (schema) {\n this.setShapeSchema(input, result, schema, result.dataType as string, input.multiple)\n }\n return result\n }\n\n protected createExamples(examples: string[], type: string): IApiDataExample[] {\n const result: IApiDataExample[] = []\n for (const current of examples) {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n structuredValue: AmfDataNode.scalar(current, type).toJSON(),\n }\n result.push(item)\n }\n return result\n }\n\n protected createArrayExamples(examples: string[], type: string): IApiDataExample[] {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n }\n const value = new AmfDataNode('array')\n for (const item of examples) {\n const member = AmfDataNode.scalar(item, type)\n value.addMember(member)\n }\n item.structuredValue = value.toJSON()\n return [item]\n }\n\n protected createFileShape(input: DomainProperty, bindings?: PropertyWebBindings): IApiFileShape {\n const result = fileShape(input.key)\n this.updateBaseProperties(input, result)\n if (bindings) {\n if (Array.isArray(bindings.fileTypes)) {\n result.fileTypes = bindings.fileTypes\n }\n this.setScalarCommonProperties(result, input, bindings)\n if (bindings.format === 'base64') {\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n }\n }\n return result\n }\n\n protected setScalarCommonProperties(\n result: IApiFileShape | IApiScalarShape,\n input: DomainProperty,\n bindings?: PropertyWebBindings\n ): void {\n if (bindings?.name) {\n result.name = bindings.name\n }\n if (bindings?.xml) {\n result.xmlSerialization = bindings.xml\n }\n if (bindings?.pattern) {\n result.pattern = bindings.pattern\n }\n const { schema, type } = input\n if (schema) {\n if (typeof schema.multipleOf === 'number') {\n result.multipleOf = schema.multipleOf\n }\n if (typeof schema.minimum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.minLength = schema.minimum\n } else {\n result.minimum = schema.minimum\n }\n }\n if (typeof schema.maximum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.maxLength = schema.maximum\n } else {\n result.maximum = schema.maximum\n }\n }\n if (typeof schema.exclusiveMinimum === 'boolean') {\n result.exclusiveMinimum = schema.exclusiveMinimum\n }\n if (typeof schema.exclusiveMaximum === 'boolean') {\n result.exclusiveMaximum = schema.exclusiveMaximum\n }\n }\n if (bindings?.format) {\n switch (bindings.format) {\n case 'base64':\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n break\n case 'double':\n result.format = AmfNamespace.w3.xmlSchema.double\n break\n case 'float':\n result.format = AmfNamespace.w3.xmlSchema.float\n break\n case 'int32':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n case 'int64':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n }\n // result.format = bindings.format\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (typeof input.writeOnly === 'boolean') {\n result.writeOnly = input.writeOnly\n }\n }\n\n protected updateBaseProperties(input: DomainProperty | DomainAssociation | DomainEntity, target: IApiShape): void {\n target.name = input.info.name\n target.displayName = input.info.displayName\n target.description = input.info.description\n if (input.kind === DomainPropertyKind) {\n target.deprecated = (input as DomainProperty).deprecated\n } else if (input.kind === DomainEntityKind) {\n target.deprecated = (input as DomainEntity).deprecated\n }\n }\n\n protected createRecursiveShape(input: DomainEntity): IApiRecursiveShape {\n return recursiveShape(input.key, input.key)\n }\n\n /**\n * Translates the shape to an array shape. This happens when data model property\n * is changed from 'multiple' to not-multiple and back.\n *\n * @param id The key of the parameter or an association\n * @param shape The shape to wrap as an array.\n * @returns Array shape.\n */\n protected refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {\n const result = arrayShape(id)\n result.items = shape\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"ShapeGenerator.js","sourceRoot":"","sources":["../../../../src/modeling/amf/ShapeGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,EAYT,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM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O,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACzC,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;QACpC,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,KAAwD,EAAE,MAAiB;QACxG,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;QAC7B,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;QAC3C,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACtC,MAAM,CAAC,UAAU,GAAI,KAAwB,CAAC,UAAU,CAAA;QAC1D,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC3C,MAAM,CAAC,UAAU,GAAI,KAAsB,CAAC,UAAU,CAAA;QACxD,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,KAAmB;QAChD,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;OAOG;IACO,oBAAoB,CAAC,EAAU,EAAE,KAAkB;QAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,OAAO,MAAM,CAAA;IACf,CAAC;CACF","sourcesContent":["import { type AssociationBindings, type PropertyWebBindings } from '../Bindings.js'\nimport type { DomainAssociation } from '../DomainAssociation.js'\nimport type { DomainProperty } from '../DomainProperty.js'\nimport type { DomainEntity } from '../DomainEntity.js'\nimport { IAmfExampleTypes, modelTypeToAmfDataType } from '../../amf/AmfTypes.js'\nimport { AmfNamespace } from '../../amf/definitions/Namespace.js'\nimport {\n anyShape,\n arrayShape,\n fileShape,\n IApiAnyShape,\n IApiArrayShape,\n IApiDataExample,\n IApiFileShape,\n IApiNodeShape,\n IApiPropertyShape,\n IApiRecursiveShape,\n IApiScalarShape,\n IApiShape,\n IApiUnionShape,\n IShapeUnion,\n nodeShape,\n propertyShape,\n recursiveShape,\n scalarShape,\n unionShape,\n} from '../../amf/definitions/Shapes.js'\nimport { AmfDataNode } from '../../amf/models/AmfDataNode.js'\nimport { DataValueGenerator } from '../../amf/DataValueGenerator.js'\nimport { nanoid } from '../../nanoid.js'\nimport { DomainEntityKind, DomainPropertyKind } from '../../models/kinds.js'\nimport type { PropertySchema } from '../types.js'\n\nconst UNION_TYPE_ANY_OF = 'anyOf'\nconst UNION_TYPE_ALL_OF = 'allOf'\nconst UNION_TYPE_ONE_OF = 'oneOf'\nconst UNION_TYPE_NOT = 'not'\nconst DATA_TYPE_STRING = 'string'\nconst DATA_TYPE_BINARY = 'binary'\n\n/**\n * Serializes Data Domain elements (DomainEntity, DomainProperty, DomainAssociation)\n * to AMF shapes.\n *\n * This class provides a mechanism to translate a data domain model, defined using\n * custom classes like `DomainEntity`, `DomainProperty`, and `DomainAssociation`,\n * into AMF (API Modeling Framework) shapes. AMF shapes are a standardized way\n * to represent API structures and data models, enabling interoperability and tooling.\n *\n * This is particularly useful when you have a custom data model and need to\n * generate API definitions (e.g., RAML or OAS) from it.\n *\n * **Key Features:**\n *\n * - **Data Domain to AMF Translation:** Converts data domain elements into\n * their corresponding AMF shape representations.\n * - **Recursive Shape Handling:** Detects and handles recursive relationships\n * within the data model to prevent infinite loops during shape generation.\n * - **Union Type Support:** Supports the creation of union types in AMF\n * to represent associations that can point to multiple different entity types.\n * - **Binding Integration:** Leverages binding information (e.g., web bindings)\n * to customize the generated AMF shapes based on the target API format.\n * - **Example and Default Value Generation:** Integrates with a `DataValueGenerator`\n * to automatically generate example values and default values for properties\n * within the AMF shapes.\n *\n * **Usage:**\n *\n * 1. Create an instance of the `ShapeGenerator`.\n * 2. Call the appropriate method (e.g., `entity()`, `property()`, `associationShape()`)\n * to generate the AMF shape for a specific data domain element.\n * 3. The returned AMF shape can then be used with other AMF tools to generate\n * API definitions or perform other API-related tasks.\n */\nexport class ShapeGenerator {\n #valueGenerator?: DataValueGenerator\n\n /**\n * Used with data domain value generation for entity properties.\n * Lazily loaded class only when functions are used.\n * This needs to be a class instances because some functions are incremental\n */\n get valueGenerator(): DataValueGenerator {\n // we need a new instance of the generator for each shape generation\n // as the generator is stateful and we need to reset it for each shape.\n if (!this.#valueGenerator) {\n this.#valueGenerator = new DataValueGenerator()\n }\n return this.#valueGenerator\n }\n\n /**\n * Serializes a `DomainEntity` to an AMF node shape.\n *\n * This method is the entry point for converting a `DomainEntity` into its\n * AMF representation. It handles recursive relationships, property serialization,\n * and inheritance from parent entities.\n *\n * @param input The `DomainEntity` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiNodeShape` or `IApiRecursiveShape` representing the entity in AMF.\n * Returns a `IApiRecursiveShape` if a recursive loop is detected.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.entity(myDomainEntity);\n * ```\n */\n entity(input: DomainEntity, visited = new Set<string>()): IApiNodeShape | IApiRecursiveShape {\n if (visited.has(input.key)) {\n // create a recursive shape.\n return this.createRecursiveShape(input)\n }\n visited.add(input.key)\n const result = nodeShape(input.key)\n result.id = input.key\n this.updateBaseProperties(input, result)\n result.properties = []\n for (const item of input.listProperties()) {\n // we check whether the property is hidden.\n // This is not happening when calling the `property()` because this method\n // always returns the AMF shape.\n const wb = item.readBinding('web') as PropertyWebBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const shape = this.property(item)\n result.properties.push(shape)\n }\n for (const assoc of input.listAssociations()) {\n const wb = assoc.readBinding('web') as AssociationBindings | undefined\n if (wb && wb.hidden) {\n continue\n }\n const prop = this.associationProperty(assoc, visited)\n result.properties.push(prop)\n }\n for (const parent of input.listParents()) {\n const shape = this.entity(parent, visited)\n result.inherits.push(shape)\n }\n return result\n }\n\n /**\n * Serializes a `DomainProperty` to an AMF property shape.\n *\n * This method converts a `DomainProperty` into an `IApiPropertyShape`,\n * defining its characteristics such as data type, required status, and\n * range (the shape of the property's value).\n *\n * @param input The `DomainProperty` to serialize.\n * @returns An `IApiPropertyShape` representing the property in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.property(myDomainProperty);\n * ```\n */\n property(input: DomainProperty): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.getRange(input)\n\n // for example, Example generator needs to know the name of the property\n // as it does not look into the \"range\" object.\n this.updateBaseProperties(input, result)\n\n // sync the name of the property shape with the range, in case it was changed by the bindings\n if (result.range.name) {\n result.name = result.range.name\n }\n return result\n }\n\n /**\n * Serializes a `DomainAssociation` to an AMF property shape, handling the\n * association's target entity or entities.\n *\n * This method is similar to `property()`, but it specifically handles\n * associations between entities. It determines the range of the property\n * based on the association's target(s) and generates the appropriate\n * AMF shape (e.g., a scalar shape for a linked schema, a union shape for\n * multiple targets).\n *\n * @param input The `DomainAssociation` to serialize.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns An `IApiPropertyShape` representing the association in AMF.\n * @example\n * ```typescript\n * const generator = new ShapeGenerator();\n * const amfShape = generator.associationProperty(myDomainAssociation);\n * ```\n */\n associationProperty(input: DomainAssociation, visited: Set<string> = new Set<string>()): IApiPropertyShape {\n const { required, key } = input\n const result = propertyShape(key)\n result.path = `${AmfNamespace.aml.vocabularies.data.key}${input.info.name}`\n if (required) {\n result.minCount = 1\n }\n result.range = this.associationShape(input, visited)\n\n this.updateBaseProperties(input, result)\n return result\n }\n\n /**\n * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @param visited A `Set` of keys of already generated entities. This prevents\n * recursive shape generation and avoids infinite loops. Defaults to a new empty `Set`.\n * @returns The range value for the PropertyShape.\n */\n associationShape(input: DomainAssociation, visited: Set<string> = new Set<string>()): IShapeUnion | undefined {\n const schema = input.schema\n if (schema && schema.linked) {\n return this.createLinkedShape(input)\n }\n const items = this.associationUnion(input, visited)\n if (!items) {\n return\n }\n if (Array.isArray(items)) {\n return this.createUnionShape(input, items)\n }\n const unionType = (schema && schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_NOT) {\n // Need to investigate more about \"not\" union type.\n // AMF supports it, but I am not sure how to handle it.\n const wrapper = anyShape(input.key)\n wrapper.id = `not-shape-${input.key}`\n wrapper.not = items\n return wrapper\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, items)\n }\n return items\n }\n\n /**\n * @param input The data association instance.\n * @returns An AMF API scalar shape with the link to the schema.\n */\n protected createLinkedShape(input: DomainAssociation): IApiScalarShape {\n // This is a link to the schema. In an API that would be the id\n // of a resource to request the data from.\n const range = scalarShape(input.key)\n range.id = `link-${input.key}`\n range.dataType = modelTypeToAmfDataType(DATA_TYPE_STRING)\n return range\n }\n\n protected createUnionShape(input: DomainAssociation, items: IShapeUnion[]): IApiUnionShape | IApiArrayShape {\n const range = unionShape(input.key)\n this.updateBaseProperties(input, range)\n range.anyOf = []\n const unionType = (input.schema && input.schema.unionType) || UNION_TYPE_ANY_OF\n if (unionType === UNION_TYPE_ANY_OF) {\n range.anyOf = items\n } else if (unionType === UNION_TYPE_ALL_OF) {\n range.and = items\n } else if (unionType === UNION_TYPE_ONE_OF) {\n range.xone = items\n } else {\n // the \"not\" union type only supports a single schema.\n // I am not sure how this should be handled. Will take the first one\n // for now.\n range.not = items[0]\n }\n if (input.multiple) {\n return this.refactorShapeToArray(input.key, range)\n }\n return range\n }\n\n /**\n * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.\n *\n * @param input The data association instance.\n * @returns The range value for the PropertyShape.\n */\n associationUnion(\n input: DomainAssociation,\n visited: Set<string> = new Set<string>()\n ): IShapeUnion | IShapeUnion[] | undefined {\n const result: IShapeUnion[] = []\n for (const item of input.listTargets()) {\n result.push(this.entity(item, visited))\n }\n if (!result.length) {\n return undefined\n }\n if (result.length > 1) {\n return result\n }\n return result[0]\n }\n\n /**\n * The DomainProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for\n * default value, examples, and enum values. We also look for the `web`\n * bindings for more detailed definition of a shape.\n *\n * @param input\n */\n protected getRange(input: DomainProperty): IApiArrayShape | IApiFileShape | IApiScalarShape {\n const bindings = input.readBinding('web') as PropertyWebBindings | undefined\n let schema: PropertySchema | undefined\n if (input.schema) {\n schema = input.schema\n }\n const { multiple, type } = input\n if (multiple) {\n return this.createArrayShape(input, schema, bindings)\n }\n if (type === DATA_TYPE_BINARY) {\n return this.createFileShape(input, bindings)\n }\n return this.createScalarShape(input, schema, bindings)\n }\n\n /**\n * Normally this would be part of generating a scalar schema but the the property is an array this\n * is generated on the array and not on the range.\n *\n * @param result The scalar or array shape.\n * @param schema The property schema\n * @param type The data type of the parent property as set on the `range`\n * @param isArray Whether the DomainProperty is multiple\n */\n protected setShapeSchema(\n input: DomainProperty,\n result: IApiAnyShape,\n schema: PropertySchema,\n type: string,\n isArray?: boolean\n ): void {\n if (schema.defaultValue) {\n const { type: dfFormat } = schema.defaultValue\n const { value } = schema.defaultValue\n if (dfFormat === 'function') {\n const tmp = this.valueGenerator.generate(value, input.type)\n if (tmp !== DataValueGenerator.noValue) {\n const dt = AmfDataNode.scalar(tmp as string, dfFormat)\n result.defaultValue = dt.toJSON()\n }\n } else {\n const dt = AmfDataNode.scalar(value, type)\n result.defaultValue = dt.toJSON()\n }\n }\n if (Array.isArray(schema.enum)) {\n result.values = schema.enum.map((i) => AmfDataNode.scalar(i, type).toJSON())\n }\n if (Array.isArray(schema.examples)) {\n if (isArray) {\n result.examples = this.createArrayExamples(schema.examples, type)\n } else {\n result.examples = this.createExamples(schema.examples, type)\n }\n }\n }\n\n protected createArrayShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiArrayShape {\n const result = arrayShape(input.key)\n const { type } = input\n if (type === DATA_TYPE_BINARY) {\n // we do not pass schema to the range generator as we set schema's properties on the array shape.\n result.items = this.createFileShape(input, bindings)\n } else {\n result.items = this.createScalarShape(input, undefined, bindings)\n }\n if (schema) {\n const type = (result.items as IApiScalarShape).dataType as string\n this.setShapeSchema(input, result, schema, type, input.multiple)\n }\n return result\n }\n\n protected createScalarShape(\n input: DomainProperty,\n schema?: PropertySchema,\n bindings?: PropertyWebBindings\n ): IApiScalarShape {\n const result = scalarShape(input.key)\n this.updateBaseProperties(input, result)\n this.setScalarCommonProperties(result, input, bindings)\n if (!result.dataType) {\n result.dataType = modelTypeToAmfDataType(input.type, bindings)\n }\n if (schema) {\n this.setShapeSchema(input, result, schema, result.dataType as string, input.multiple)\n }\n return result\n }\n\n protected createExamples(examples: string[], type: string): IApiDataExample[] {\n const result: IApiDataExample[] = []\n for (const current of examples) {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n structuredValue: AmfDataNode.scalar(current, type).toJSON(),\n }\n result.push(item)\n }\n return result\n }\n\n protected createArrayExamples(examples: string[], type: string): IApiDataExample[] {\n const item: IApiDataExample = {\n id: nanoid(),\n customDomainProperties: [],\n strict: true,\n types: IAmfExampleTypes,\n }\n const value = new AmfDataNode('array')\n for (const item of examples) {\n const member = AmfDataNode.scalar(item, type)\n value.addMember(member)\n }\n item.structuredValue = value.toJSON()\n return [item]\n }\n\n protected createFileShape(input: DomainProperty, bindings?: PropertyWebBindings): IApiFileShape {\n const result = fileShape(input.key)\n this.updateBaseProperties(input, result)\n if (bindings) {\n if (Array.isArray(bindings.fileTypes)) {\n result.fileTypes = bindings.fileTypes\n }\n this.setScalarCommonProperties(result, input, bindings)\n if (bindings.format === 'base64') {\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n }\n }\n return result\n }\n\n protected setScalarCommonProperties(\n result: IApiFileShape | IApiScalarShape,\n input: DomainProperty,\n bindings?: PropertyWebBindings\n ): void {\n if (bindings?.name) {\n result.name = bindings.name\n }\n if (bindings?.xml) {\n result.xmlSerialization = bindings.xml\n }\n if (bindings?.pattern) {\n result.pattern = bindings.pattern\n }\n const { schema, type } = input\n if (schema) {\n if (typeof schema.multipleOf === 'number') {\n result.multipleOf = schema.multipleOf\n }\n if (typeof schema.minimum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.minLength = schema.minimum\n } else {\n result.minimum = schema.minimum\n }\n }\n if (typeof schema.maximum === 'number') {\n if (type === DATA_TYPE_STRING) {\n result.maxLength = schema.maximum\n } else {\n result.maximum = schema.maximum\n }\n }\n if (typeof schema.exclusiveMinimum === 'boolean') {\n result.exclusiveMinimum = schema.exclusiveMinimum\n }\n if (typeof schema.exclusiveMaximum === 'boolean') {\n result.exclusiveMaximum = schema.exclusiveMaximum\n }\n }\n if (bindings?.format) {\n switch (bindings.format) {\n case 'base64':\n result.format = AmfNamespace.w3.xmlSchema.base64Binary\n break\n case 'double':\n result.format = AmfNamespace.w3.xmlSchema.double\n break\n case 'float':\n result.format = AmfNamespace.w3.xmlSchema.float\n break\n case 'int32':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n case 'int64':\n result.format = AmfNamespace.w3.xmlSchema.integer\n break\n }\n // result.format = bindings.format\n }\n if (typeof input.readOnly === 'boolean') {\n result.readOnly = input.readOnly\n }\n if (typeof input.writeOnly === 'boolean') {\n result.writeOnly = input.writeOnly\n }\n }\n\n protected updateBaseProperties(input: DomainProperty | DomainAssociation | DomainEntity, target: IApiShape): void {\n target.name = input.info.name\n target.displayName = input.info.displayName\n target.description = input.info.description\n if (input.kind === DomainPropertyKind) {\n target.deprecated = (input as DomainProperty).deprecated\n } else if (input.kind === DomainEntityKind) {\n target.deprecated = (input as DomainEntity).deprecated\n }\n }\n\n protected createRecursiveShape(input: DomainEntity): IApiRecursiveShape {\n return recursiveShape(input.key, input.key)\n }\n\n /**\n * Translates the shape to an array shape. This happens when data model property\n * is changed from 'multiple' to not-multiple and back.\n *\n * @param id The key of the parameter or an association\n * @param shape The shape to wrap as an array.\n * @returns Array shape.\n */\n protected refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape {\n const result = arrayShape(id)\n result.items = shape\n return result\n }\n}\n"]}