@api-client/core 0.14.9 → 0.15.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 (110) hide show
  1. package/RELEASE.md +163 -0
  2. package/RELEASE_SETUP.md +235 -0
  3. package/build/src/events/authorization/AuthorizationEvents.d.ts +1 -1
  4. package/build/src/events/authorization/AuthorizationEvents.d.ts.map +1 -1
  5. package/build/src/events/authorization/AuthorizationEvents.js +1 -1
  6. package/build/src/events/authorization/AuthorizationEvents.js.map +1 -1
  7. package/build/src/events/cookies/CookieEvents.d.ts +1 -1
  8. package/build/src/events/cookies/CookieEvents.d.ts.map +1 -1
  9. package/build/src/events/cookies/CookieEvents.js +1 -1
  10. package/build/src/events/cookies/CookieEvents.js.map +1 -1
  11. package/build/src/modeling/DataDomain.d.ts +45 -3
  12. package/build/src/modeling/DataDomain.d.ts.map +1 -1
  13. package/build/src/modeling/DataDomain.js +81 -3
  14. package/build/src/modeling/DataDomain.js.map +1 -1
  15. package/build/src/modeling/DomainElement.d.ts +7 -0
  16. package/build/src/modeling/DomainElement.d.ts.map +1 -1
  17. package/build/src/modeling/DomainElement.js +14 -0
  18. package/build/src/modeling/DomainElement.js.map +1 -1
  19. package/build/src/modeling/DomainImpactAnalysis.d.ts +22 -119
  20. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  21. package/build/src/modeling/DomainImpactAnalysis.js +49 -155
  22. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  23. package/build/src/modeling/DomainValidation.d.ts +8 -0
  24. package/build/src/modeling/DomainValidation.d.ts.map +1 -0
  25. package/build/src/modeling/DomainValidation.js +99 -0
  26. package/build/src/modeling/DomainValidation.js.map +1 -0
  27. package/build/src/modeling/types.d.ts +70 -0
  28. package/build/src/modeling/types.d.ts.map +1 -1
  29. package/build/src/modeling/types.js.map +1 -1
  30. package/build/src/modeling/validation/entity_validation.js +1 -1
  31. package/build/src/modeling/validation/entity_validation.js.map +1 -1
  32. package/build/src/modeling/validation/rules.d.ts +2 -3
  33. package/build/src/modeling/validation/rules.d.ts.map +1 -1
  34. package/build/src/modeling/validation/rules.js.map +1 -1
  35. package/build/src/modeling/validation/semantic_validation.d.ts +31 -0
  36. package/build/src/modeling/validation/semantic_validation.d.ts.map +1 -0
  37. package/build/src/modeling/validation/semantic_validation.js +126 -0
  38. package/build/src/modeling/validation/semantic_validation.js.map +1 -0
  39. package/build/tsconfig.tsbuildinfo +1 -1
  40. package/data/models/example-generator-api.json +12 -12
  41. package/noop.ts +3 -0
  42. package/package.json +9 -4
  43. package/src/events/authorization/AuthorizationEvents.ts +1 -1
  44. package/src/events/cookies/CookieEvents.ts +1 -1
  45. package/src/modeling/DataDomain.ts +84 -3
  46. package/src/modeling/DomainElement.ts +16 -0
  47. package/src/modeling/DomainImpactAnalysis.ts +54 -239
  48. package/src/modeling/DomainValidation.ts +105 -0
  49. package/src/modeling/types.ts +86 -0
  50. package/src/modeling/validation/entity_validation.ts +1 -1
  51. package/src/modeling/validation/rules.ts +2 -4
  52. package/src/modeling/validation/semantic_validation.ts +145 -0
  53. package/tests/unit/events/EventsTestHelpers.ts +16 -0
  54. package/tests/unit/events/amf.spec.ts +151 -0
  55. package/tests/unit/events/authorization.spec.ts +150 -0
  56. package/tests/unit/events/cookie.spec.ts +274 -0
  57. package/tests/unit/events/encryption.spec.ts +108 -0
  58. package/tests/unit/events/events_polyfills.ts +77 -0
  59. package/tests/unit/events/process.spec.ts +120 -0
  60. package/tests/unit/events/reporting.spec.ts +82 -0
  61. package/tests/unit/events/telemetry.spec.ts +224 -0
  62. package/tests/unit/events/transport.spec.ts +139 -0
  63. package/tests/unit/modeling/data_domain_foreign.spec.ts +244 -0
  64. package/tests/unit/modeling/domain_impact_analysis.spec.ts +0 -110
  65. package/tests/unit/modeling/domain_validation.spec.ts +94 -0
  66. package/tests/unit/modeling/validation/semantic_validation.spec.ts +91 -0
  67. package/tests/unit/models/environment.spec.ts +574 -0
  68. package/tests/unit/models/error_response.spec.ts +183 -0
  69. package/tests/unit/models/headers_array.spec.ts +86 -0
  70. package/tests/unit/models/http-actions/assertion/equal_assertion.spec.ts +103 -0
  71. package/tests/unit/models/http-actions/assertion/greater_than_assertion.spec.ts +91 -0
  72. package/tests/unit/models/http-actions/assertion/includes_assertion.spec.ts +71 -0
  73. package/tests/unit/models/http-actions/assertion/less_than_assertion.spec.ts +91 -0
  74. package/tests/unit/models/http-actions/assertion/matches_assertion.spec.ts +71 -0
  75. package/tests/unit/models/http-actions/assertion/matches_schema_assertion.spec.ts +117 -0
  76. package/tests/unit/models/http-actions/assertion/not_equal_assertion.spec.ts +103 -0
  77. package/tests/unit/models/http-actions/assertion/not_includes_assertion.spec.ts +71 -0
  78. package/tests/unit/models/http-actions/assertion/not_ok_assertion.spec.ts +47 -0
  79. package/tests/unit/models/http-actions/assertion/not_to_be_assertion.spec.ts +72 -0
  80. package/tests/unit/models/http-actions/assertion/ok_assertion.spec.ts +44 -0
  81. package/tests/unit/models/http-actions/assertion/to_be_assertion.spec.ts +71 -0
  82. package/tests/unit/models/http-actions/transformation/as_lower_case_step.spec.ts +47 -0
  83. package/tests/unit/models/http-actions/transformation/as_number_step.spec.ts +47 -0
  84. package/tests/unit/models/http-actions/transformation/as_upper_case_step.spec.ts +47 -0
  85. package/tests/unit/models/http-actions/transformation/round_step.spec.ts +69 -0
  86. package/tests/unit/models/http-actions/transformation/substring_step.spec.ts +85 -0
  87. package/tests/unit/models/http-actions/transformation/trim_step.spec.ts +44 -0
  88. package/tests/unit/models/http_cookie.spec.ts +516 -0
  89. package/tests/unit/models/http_history.spec.ts +443 -0
  90. package/tests/unit/models/project_folder.spec.ts +926 -0
  91. package/tests/unit/models/project_item.spec.ts +137 -0
  92. package/tests/unit/models/project_request.spec.ts +1047 -0
  93. package/tests/unit/models/project_schema.spec.ts +236 -0
  94. package/tests/unit/models/property.spec.ts +625 -0
  95. package/tests/unit/models/provider.spec.ts +102 -0
  96. package/tests/unit/models/request.spec.ts +1206 -0
  97. package/tests/unit/models/request_log.spec.ts +308 -0
  98. package/tests/unit/models/request_time.spec.ts +138 -0
  99. package/tests/unit/models/response_redirect.spec.ts +303 -0
  100. package/tests/unit/models/sent_request.spec.ts +206 -0
  101. package/tests/unit/models/server.spec.ts +195 -0
  102. package/tests/unit/models/thing.spec.ts +154 -0
  103. package/build/oauth-popup.html +0 -33
  104. /package/tests/unit/models/{Certificate.spec.ts → certificate.spec.ts} +0 -0
  105. /package/tests/unit/models/{HostRule.spec.ts → host_rule.spec.ts} +0 -0
  106. /package/tests/unit/models/{HttpProject.spec.ts → http_project.spec.ts} +0 -0
  107. /package/tests/unit/models/{HttpRequest.spec.ts → http_request.spec.ts} +0 -0
  108. /package/tests/unit/models/{HttpResponse.spec.ts → http_response.spec.ts} +0 -0
  109. /package/tests/unit/models/{License.spec.ts → license.spec.ts} +0 -0
  110. /package/tests/unit/models/{Response.spec.ts → response.spec.ts} +0 -0
@@ -42062,10 +42062,10 @@
42062
42062
  "@id": "#209"
42063
42063
  },
42064
42064
  {
42065
- "@id": "#197"
42065
+ "@id": "#191"
42066
42066
  },
42067
42067
  {
42068
- "@id": "#191"
42068
+ "@id": "#197"
42069
42069
  },
42070
42070
  {
42071
42071
  "@id": "#194"
@@ -42813,10 +42813,10 @@
42813
42813
  "@id": "#210"
42814
42814
  },
42815
42815
  {
42816
- "@id": "#216"
42816
+ "@id": "#213"
42817
42817
  },
42818
42818
  {
42819
- "@id": "#213"
42819
+ "@id": "#216"
42820
42820
  },
42821
42821
  {
42822
42822
  "@id": "#219"
@@ -43436,7 +43436,7 @@
43436
43436
  "doc:ExternalDomainElement",
43437
43437
  "doc:DomainElement"
43438
43438
  ],
43439
- "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43439
+ "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43440
43440
  "core:mediaType": "application/yaml",
43441
43441
  "sourcemaps:sources": [
43442
43442
  {
@@ -43478,7 +43478,7 @@
43478
43478
  "doc:ExternalDomainElement",
43479
43479
  "doc:DomainElement"
43480
43480
  ],
43481
- "doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
43481
+ "doc:raw": "addressType: 'REGISTERED-OFFICE-ADDRESS'\nstreetName: 'UITBREIDINGSTRAAT'\nhouseNumber: '84'\nhouseNumberAddition: '/1'\npostalCode: '2600'\ncity: 'BERCHEM (ANTWERPEN)'\ncountry: 'Belgium'\ncountryCode: 'BE'\nfullFormatedAddress: \"UITBREIDINGSTRAAT 84 /1, 2600 BERCHEM (ANTWERPEN), BELIUM\"\n",
43482
43482
  "core:mediaType": "application/yaml",
43483
43483
  "sourcemaps:sources": [
43484
43484
  {
@@ -44253,7 +44253,7 @@
44253
44253
  "doc:ExternalDomainElement",
44254
44254
  "doc:DomainElement"
44255
44255
  ],
44256
- "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
44256
+ "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44257
44257
  "core:mediaType": "application/yaml",
44258
44258
  "sourcemaps:sources": [
44259
44259
  {
@@ -44274,7 +44274,7 @@
44274
44274
  "doc:ExternalDomainElement",
44275
44275
  "doc:DomainElement"
44276
44276
  ],
44277
- "doc:raw": "type: 'GENERAL'\ncountryDialCode : '+32'\nareaCode : '21'\nsubscriberNumber: '12.87.00'\nformatted: '+32-(0)21 302099'\n",
44277
+ "doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
44278
44278
  "core:mediaType": "application/yaml",
44279
44279
  "sourcemaps:sources": [
44280
44280
  {
@@ -44756,7 +44756,7 @@
44756
44756
  {
44757
44757
  "@id": "#193/source-map/lexical/element_0",
44758
44758
  "sourcemaps:element": "amf://id#193",
44759
- "sourcemaps:value": "[(1,0)-(10,0)]"
44759
+ "sourcemaps:value": "[(1,0)-(7,0)]"
44760
44760
  },
44761
44761
  {
44762
44762
  "@id": "#196/source-map/lexical/element_0",
@@ -44766,7 +44766,7 @@
44766
44766
  {
44767
44767
  "@id": "#199/source-map/lexical/element_0",
44768
44768
  "sourcemaps:element": "amf://id#199",
44769
- "sourcemaps:value": "[(1,0)-(7,0)]"
44769
+ "sourcemaps:value": "[(1,0)-(10,0)]"
44770
44770
  },
44771
44771
  {
44772
44772
  "@id": "#202/source-map/lexical/element_0",
@@ -45121,12 +45121,12 @@
45121
45121
  {
45122
45122
  "@id": "#215/source-map/lexical/element_0",
45123
45123
  "sourcemaps:element": "amf://id#215",
45124
- "sourcemaps:value": "[(1,0)-(7,0)]"
45124
+ "sourcemaps:value": "[(1,0)-(6,0)]"
45125
45125
  },
45126
45126
  {
45127
45127
  "@id": "#218/source-map/lexical/element_0",
45128
45128
  "sourcemaps:element": "amf://id#218",
45129
- "sourcemaps:value": "[(1,0)-(6,0)]"
45129
+ "sourcemaps:value": "[(1,0)-(7,0)]"
45130
45130
  },
45131
45131
  {
45132
45132
  "@id": "#221/source-map/lexical/element_0",
package/noop.ts ADDED
@@ -0,0 +1,3 @@
1
+ // Dummy file to satisfy @web/dev-server-rollup plugin requirements
2
+ // This file is used as a placeholder input for rollup configuration
3
+ export default {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@api-client/core",
3
3
  "description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
4
- "version": "0.14.9",
4
+ "version": "0.15.0",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./browser.js": {
@@ -106,6 +106,7 @@
106
106
  "@japa/browser-client": "^2.1.1",
107
107
  "@japa/expect-type": "^2.0.3",
108
108
  "@japa/runner": "^4.2.0",
109
+ "@pawel-up/semver": "^0.1.4",
109
110
  "@rollup/plugin-typescript": "^12.1.2",
110
111
  "@types/cors": "^2.8.12",
111
112
  "@types/express-ntlm": "^2.3.3",
@@ -119,6 +120,7 @@
119
120
  "@web/test-runner-playwright": "^0.11.0",
120
121
  "amf-client-js": "^5.7.0",
121
122
  "c8": "^10.1.3",
123
+ "conventional-changelog-cli": "^5.0.0",
122
124
  "cors": "^2.8.5",
123
125
  "eslint": "^9.20.1",
124
126
  "eslint-config-prettier": "^10.0.1",
@@ -133,7 +135,6 @@
133
135
  "lint-staged": "^16.0.0",
134
136
  "nock": "^14.0.1",
135
137
  "oauth2-mock-server": "^8.0.0",
136
- "playwright": "^1.50.1",
137
138
  "prettier": "^3.5.1",
138
139
  "sinon": "^21.0.0",
139
140
  "ts-lit-plugin": "^2.0.2",
@@ -146,7 +147,7 @@
146
147
  "build:browser": "wireit",
147
148
  "build:ts": "wireit",
148
149
  "build:node": "wireit",
149
- "build": "npm run build:ts && npm run lint && npm run copy:assets",
150
+ "build": "npm run build:ts && npm run copy:assets",
150
151
  "prepare": "husky && npm run fixes && npm run build:ts && npm run build:api-models",
151
152
  "fixes": "node scripts/fix-rollup-plugin.js",
152
153
  "tsc": "wireit",
@@ -165,7 +166,11 @@
165
166
  "lint:prettier": "wireit",
166
167
  "format": "npm run format:prettier && npm run format:prettier",
167
168
  "format:prettier": "wireit",
168
- "format:eslint": "wireit"
169
+ "format:eslint": "wireit",
170
+ "release": "node scripts/release.js",
171
+ "release:patch": "node scripts/release.js patch",
172
+ "release:minor": "node scripts/release.js minor",
173
+ "release:major": "node scripts/release.js major"
169
174
  },
170
175
  "wireit": {
171
176
  "test": {
@@ -66,7 +66,7 @@ class OidcEvents {
66
66
  * @param target A node on which to dispatch the event.
67
67
  * @returns Promise resolved when the token is removed
68
68
  */
69
- static async removeToken(config: ITokenRemoveOptions, target: EventTarget = window): Promise<void> {
69
+ static async removeTokens(config: ITokenRemoveOptions, target: EventTarget = window): Promise<void> {
70
70
  const e = new ContextEvent<ITokenRemoveOptions, void>(AuthorizationEventTypes.Oidc.removeTokens, config)
71
71
  target.dispatchEvent(e)
72
72
  return e.detail.result
@@ -38,7 +38,7 @@ export class CookieEvents {
38
38
  * @param target The target on which to dispatch the event
39
39
  * @returns The list of project index objects.
40
40
  */
41
- static async listAll(target: EventTarget): Promise<IHttpCookie[] | undefined> {
41
+ static async listAll(target: EventTarget = window): Promise<IHttpCookie[] | undefined> {
42
42
  const detail: ContextEventDetailWithResult<IHttpCookie[]> = {}
43
43
  const e = new CustomEvent(CookieEventTypes.listAll, {
44
44
  bubbles: true,
@@ -394,6 +394,33 @@ export class DataDomain extends DependentModel {
394
394
  }
395
395
  }
396
396
 
397
+ /**
398
+ * Lists all namespaces in the graph that are part of specified domain.
399
+ *
400
+ * @param namespace The foreign namespace to search in. When not found, it throws an error.
401
+ * @returns A generator that yields each `DomainNamespace`.
402
+ * @throws Error When the foreign domain is not found.
403
+ * @example
404
+ * ```typescript
405
+ * for (const ns of dataDomain.listForeignNamespaces('foreignDomainKey')) {
406
+ * console.log(ns.key);
407
+ * }
408
+ * ```
409
+ */
410
+ *listForeignNamespaces(namespace: string): Generator<DomainNamespace> {
411
+ const foreignDomain = this.dependencies.get(namespace)
412
+ if (!foreignDomain) {
413
+ throw new Error(`Foreign domain ${namespace} not found`)
414
+ }
415
+ for (const node of foreignDomain.listNamespaces()) {
416
+ const key = `${namespace}:${node.key}`
417
+ const value = this.graph.node(key)
418
+ if (value) {
419
+ yield node
420
+ }
421
+ }
422
+ }
423
+
397
424
  /**
398
425
  * Checks if this data domain has any namespaces.
399
426
  *
@@ -661,8 +688,8 @@ export class DataDomain extends DependentModel {
661
688
  * @returns A generator that yields each `DomainModel`.
662
689
  * @example
663
690
  * ```typescript
664
- * for (const ns of namespace.listModels()) {
665
- * console.log(ns.key);
691
+ * for (const model of namespace.listModels()) {
692
+ * console.log(model.key);
666
693
  * }
667
694
  * ```
668
695
  */
@@ -679,6 +706,33 @@ export class DataDomain extends DependentModel {
679
706
  }
680
707
  }
681
708
 
709
+ /**
710
+ * Lists all models in the graph that are part of specified domain.
711
+ *
712
+ * @param namespace The foreign namespace to search in. When not found, it throws an error.
713
+ * @returns A generator that yields each `DomainModel`.
714
+ * @throws Error When the foreign domain is not found.
715
+ * @example
716
+ * ```typescript
717
+ * for (const model of dataDomain.listForeignModels('foreignDomainKey')) {
718
+ * console.log(model.key);
719
+ * }
720
+ * ```
721
+ */
722
+ *listForeignModels(namespace: string): Generator<DomainModel> {
723
+ const foreignDomain = this.dependencies.get(namespace)
724
+ if (!foreignDomain) {
725
+ throw new Error(`Foreign domain ${namespace} not found`)
726
+ }
727
+ for (const node of foreignDomain.listModels()) {
728
+ const key = `${namespace}:${node.key}`
729
+ const value = this.graph.node(key)
730
+ if (value) {
731
+ yield node
732
+ }
733
+ }
734
+ }
735
+
682
736
  /**
683
737
  * Checks if this data domain has any direct models.
684
738
  *
@@ -893,10 +947,37 @@ export class DataDomain extends DependentModel {
893
947
  }
894
948
  }
895
949
 
950
+ /**
951
+ * Lists all entities in the graph that are part of specified domain.
952
+ *
953
+ * @param namespace The foreign namespace to search in. When not found, it throws an error.
954
+ * @returns A generator that yields each `DomainEntity`.
955
+ * @throws Error When the foreign domain is not found.
956
+ * @example
957
+ * ```typescript
958
+ * for (const model of dataDomain.listForeignEntities('foreignDomainKey')) {
959
+ * console.log(model.key);
960
+ * }
961
+ * ```
962
+ */
963
+ *listForeignEntities(namespace: string): Generator<DomainEntity> {
964
+ const foreignDomain = this.dependencies.get(namespace)
965
+ if (!foreignDomain) {
966
+ throw new Error(`Foreign domain ${namespace} not found`)
967
+ }
968
+ for (const node of foreignDomain.listEntities()) {
969
+ const key = `${namespace}:${node.key}`
970
+ const value = this.graph.node(key)
971
+ if (value) {
972
+ yield node
973
+ }
974
+ }
975
+ }
976
+
896
977
  /**
897
978
  * Lists all entities in the graph that are not part of this domain.
898
979
  */
899
- *listForeignEntities(): Generator<DomainEntity> {
980
+ *listAllForeignEntities(): Generator<DomainEntity> {
900
981
  for (const node of this.graph.nodes()) {
901
982
  const value = this.graph.node(node) as DomainGraphNodeType
902
983
  if (value.kind === DomainEntityKind && value.domain.key !== this.key) {
@@ -39,6 +39,18 @@ export abstract class DomainElement implements DomainElementSchema {
39
39
  return this.#key
40
40
  }
41
41
 
42
+ #namespace: string
43
+
44
+ /**
45
+ * The key of the DataDomain this element belongs to.
46
+ * In a data domain that has foreign namespaces, this is the key of the namespace this element originally belongs to.
47
+ *
48
+ * It might be different from the `domain.key` if the element is a foreign object.
49
+ */
50
+ get namespace(): string {
51
+ return this.#namespace
52
+ }
53
+
42
54
  /**
43
55
  * @param root The root DataDomain instance.
44
56
  * @param key The unique key of the domain element.
@@ -46,5 +58,9 @@ export abstract class DomainElement implements DomainElementSchema {
46
58
  constructor(root: DataDomain, key: string) {
47
59
  this.root = root
48
60
  this.#key = key
61
+ // When dependencies are loaded, they all first belong to the root domain.
62
+ // When the foreign domain is merged, the object is transferred to the other domain,
63
+ // but the namespace is still the root domain key.
64
+ this.#namespace = root.key
49
65
  }
50
66
  }