@api-client/core 0.7.12 → 0.8.1

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 (125) hide show
  1. package/SECURITY.md +14 -0
  2. package/build/browser.d.ts +8 -1
  3. package/build/browser.js +7 -0
  4. package/build/browser.js.map +1 -1
  5. package/build/index.d.ts +8 -1
  6. package/build/index.js +7 -0
  7. package/build/index.js.map +1 -1
  8. package/build/src/amf/AmfMixin.d.ts +56 -42
  9. package/build/src/amf/AmfMixin.js +9 -3
  10. package/build/src/amf/AmfMixin.js.map +1 -1
  11. package/build/src/amf/AmfSerializer.d.ts +72 -72
  12. package/build/src/amf/AmfSerializer.js +9 -4
  13. package/build/src/amf/AmfSerializer.js.map +1 -1
  14. package/build/src/amf/AmfShapeGenerator.d.ts +17 -17
  15. package/build/src/amf/AmfShapeGenerator.js +3 -3
  16. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  17. package/build/src/amf/AmfTypes.d.ts +16 -16
  18. package/build/src/amf/AmfTypes.js +16 -16
  19. package/build/src/amf/AmfTypes.js.map +1 -1
  20. package/build/src/amf/ApiExampleGenerator.d.ts +3 -3
  21. package/build/src/amf/ApiExampleGenerator.js.map +1 -1
  22. package/build/src/amf/ApiMonacoSchemaGenerator.d.ts +6 -6
  23. package/build/src/amf/ApiMonacoSchemaGenerator.js.map +1 -1
  24. package/build/src/amf/ApiSchemaGenerator.d.ts +2 -2
  25. package/build/src/amf/ApiSchemaGenerator.js.map +1 -1
  26. package/build/src/amf/ApiSchemaValues.d.ts +12 -12
  27. package/build/src/amf/ApiSchemaValues.js.map +1 -1
  28. package/build/src/amf/Parsing.d.ts +5 -5
  29. package/build/src/amf/Utils.d.ts +6 -6
  30. package/build/src/amf/Utils.js.map +1 -1
  31. package/build/src/amf/data-node/DataNodeBase.d.ts +5 -5
  32. package/build/src/amf/data-node/DataNodeBase.js.map +1 -1
  33. package/build/src/amf/data-node/JsonDataNodeGenerator.d.ts +2 -2
  34. package/build/src/amf/data-node/JsonDataNodeGenerator.js.map +1 -1
  35. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.d.ts +2 -2
  36. package/build/src/amf/data-node/UrlEncodedDataNodeGenerator.js.map +1 -1
  37. package/build/src/amf/data-node/XmlDataNodeGenerator.d.ts +2 -2
  38. package/build/src/amf/data-node/XmlDataNodeGenerator.js.map +1 -1
  39. package/build/src/amf/definitions/Amf.d.ts +339 -339
  40. package/build/src/amf/definitions/Api.d.ts +158 -158
  41. package/build/src/amf/definitions/Base.d.ts +5 -5
  42. package/build/src/amf/definitions/Shapes.d.ts +46 -46
  43. package/build/src/amf/definitions/Shapes.js +11 -11
  44. package/build/src/amf/definitions/Shapes.js.map +1 -1
  45. package/build/src/amf/models/AmfDataNode.d.ts +5 -5
  46. package/build/src/amf/models/AmfDataNode.js +4 -4
  47. package/build/src/amf/models/AmfDataNode.js.map +1 -1
  48. package/build/src/amf/shape/ShapeBase.d.ts +13 -13
  49. package/build/src/amf/shape/ShapeBase.js.map +1 -1
  50. package/build/src/amf/shape/ShapeJsonSchemaGenerator.d.ts +13 -13
  51. package/build/src/amf/shape/ShapeJsonSchemaGenerator.js.map +1 -1
  52. package/build/src/amf/shape/ShapeXmlSchemaGenerator.d.ts +16 -16
  53. package/build/src/amf/shape/ShapeXmlSchemaGenerator.js.map +1 -1
  54. package/build/src/events/amf/AmfEvents.d.ts +4 -4
  55. package/build/src/events/amf/AmfEvents.js.map +1 -1
  56. package/build/src/lib/timers/Timers.d.ts +9 -0
  57. package/build/src/lib/timers/Timers.js +13 -0
  58. package/build/src/lib/timers/Timers.js.map +1 -1
  59. package/build/src/models/data/Bindings.d.ts +2 -2
  60. package/build/src/models/data/DataAssociation.d.ts +4 -4
  61. package/build/src/models/data/DataAssociation.js.map +1 -1
  62. package/build/src/models/data/DataEntity.d.ts +2 -2
  63. package/build/src/models/data/DataProperty.d.ts +2 -2
  64. package/data/apis/amf-helper-api/amf-helper-api.raml +1024 -0
  65. package/data/apis/amf-helper-api/examples/comment-example.json +42 -0
  66. package/data/apis/amf-helper-api/examples/commentCreateRequest-example.json +7 -0
  67. package/data/apis/amf-helper-api/examples/commentList-example.json +48 -0
  68. package/data/apis/amf-helper-api/examples/person.json +14 -0
  69. package/data/apis/amf-helper-api/examples/person.raml +13 -0
  70. package/data/apis/amf-helper-api/examples/person.xml +14 -0
  71. package/data/apis/amf-helper-api/libraries/comment-lib.raml +143 -0
  72. package/data/apis/amf-helper-api/library.raml +7 -0
  73. package/data/apis/amf-helper-api/schemas/person.json +104 -0
  74. package/data/apis/amf-helper-api/schemas/person.xsd +26 -0
  75. package/data/apis/amf-helper-api/traits/file.raml +33 -0
  76. package/data/apis/amf-helper-api/traits/pagination.raml +80 -0
  77. package/data/apis/amf-helper-api/traits/results.raml +19 -0
  78. package/data/apis/amf-helper-api/traits/visibility.raml +14 -0
  79. package/data/apis/amf-helper-api/types/app-person.raml +101 -0
  80. package/data/apis/amf-helper-api/types/dimensions.raml +24 -0
  81. package/data/apis/amf-helper-api/types/external-type.raml +7 -0
  82. package/data/apis/amf-helper-api/types/image.raml +23 -0
  83. package/data/apis/amf-helper-api/types/product.raml +52 -0
  84. package/data/apis/amf-helper-api/types/resource.raml +11 -0
  85. package/data/apis/amf-helper-api/types/standard-request.raml +50 -0
  86. package/data/apis/amf-helper-api/types/user.raml +37 -0
  87. package/data/apis/async-api/async-api.yaml +96 -0
  88. package/data/apis/expanded-api/expanded-api.raml +8 -0
  89. package/data/apis/flattened-api/flattened-api.raml +8 -0
  90. package/data/apis/multiple-servers/multiple-servers.yaml +112 -0
  91. package/data/model.js +5 -0
  92. package/data/models/amf-helper-api.json +85908 -0
  93. package/data/models/async-api.json +3108 -0
  94. package/data/models/expanded-api.json +251 -0
  95. package/data/models/flattened-api.json +251 -0
  96. package/data/models/multiple-servers.json +2753 -0
  97. package/package.json +1 -1
  98. package/src/amf/AmfMixin.ts +125 -117
  99. package/src/amf/AmfSerializer.ts +245 -240
  100. package/src/amf/AmfShapeGenerator.ts +23 -23
  101. package/src/amf/AmfTypes.ts +16 -16
  102. package/src/amf/ApiExampleGenerator.ts +4 -4
  103. package/src/amf/ApiMonacoSchemaGenerator.ts +11 -11
  104. package/src/amf/ApiSchemaGenerator.ts +3 -3
  105. package/src/amf/ApiSchemaValues.ts +21 -21
  106. package/src/amf/Parsing.ts +5 -5
  107. package/src/amf/Utils.ts +15 -15
  108. package/src/amf/data-node/DataNodeBase.ts +8 -8
  109. package/src/amf/data-node/JsonDataNodeGenerator.ts +2 -2
  110. package/src/amf/data-node/UrlEncodedDataNodeGenerator.ts +2 -2
  111. package/src/amf/data-node/XmlDataNodeGenerator.ts +2 -2
  112. package/src/amf/definitions/Amf.ts +315 -314
  113. package/src/amf/definitions/Api.ts +158 -157
  114. package/src/amf/definitions/Base.ts +5 -5
  115. package/src/amf/definitions/Shapes.ts +60 -60
  116. package/src/amf/models/AmfDataNode.ts +17 -17
  117. package/src/amf/shape/ShapeBase.ts +16 -16
  118. package/src/amf/shape/ShapeJsonSchemaGenerator.ts +27 -27
  119. package/src/amf/shape/ShapeXmlSchemaGenerator.ts +42 -42
  120. package/src/events/amf/AmfEvents.ts +7 -7
  121. package/src/lib/timers/Timers.ts +14 -0
  122. package/src/models/data/Bindings.ts +2 -2
  123. package/src/models/data/DataAssociation.ts +4 -4
  124. package/src/models/data/DataEntity.ts +2 -2
  125. package/src/models/data/DataProperty.ts +2 -2
@@ -0,0 +1,24 @@
1
+ #%RAML 1.0 DataType
2
+
3
+ description: |
4
+ A dimmensions of an object like image.
5
+
6
+ type: object
7
+ properties:
8
+ width:
9
+ type: number
10
+ description: |
11
+ Width of the shape.
12
+ height:
13
+ type: number
14
+ description: |
15
+ Height of the shape.
16
+ unit?:
17
+ type: string
18
+ default: px
19
+ description: |
20
+ A unit that describes the dimension. It can be, for example, `px` for
21
+ pixels, `pt` for points, `%` for percentage.
22
+ example:
23
+ width: 200
24
+ height: 160
@@ -0,0 +1,7 @@
1
+ #%RAML 1.0 DataType
2
+ description: |
3
+ An external data-type
4
+ type: object
5
+ properties:
6
+ prop1:
7
+ type: string
@@ -0,0 +1,23 @@
1
+ #%RAML 1.0 DataType
2
+
3
+ description: |
4
+ An image object representing an image object strored in the file store.
5
+ The image can be only included in the response. It has no effect if the Image appear in the
6
+ request. Endpoint handles image creation on it's own and clients can't process images
7
+ except of sending image data.
8
+
9
+ type: object
10
+ properties:
11
+ url:
12
+ type: string
13
+ description: |
14
+ The URL of the image.
15
+ To resize the image and crop it to a square, append the query string **?sz=x**, where x is the dimension in pixels of each side.
16
+ thumb:
17
+ type: string
18
+ displayName: Thumbnail
19
+ description: |
20
+ An URL to the thumbnail of the image. Thumbnails are 60x60px cropped images of the original image.
21
+ example:
22
+ url: https://domain.com/profile/pawel.psztyc/image
23
+ thumb: https://domain.com/profile/pawel.psztyc/image/thumb
@@ -0,0 +1,52 @@
1
+ #%RAML 1.0 DataType
2
+
3
+ displayName: A product resource
4
+ description: A single product representing an item in the store.
5
+ type: !include resource.raml
6
+ properties:
7
+ id:
8
+ description: |
9
+ Product id. It is a UUID of the database record.
10
+ __This property will be ignored when creating an object.__
11
+ It will be available when the product is stored in the datastore.
12
+ pattern: "[0-9a-zA-Z-]+"
13
+ name:
14
+ type: string
15
+ description: Product name
16
+ example: Acme product - mentol flavor, 500 ml.
17
+ required: true
18
+ quantity:
19
+ type: number
20
+ description: |
21
+ The quantity of the product in the one unit of measurement.
22
+ See `unit` property for more information.
23
+ example: 500
24
+ required: true
25
+ unit:
26
+ type: string
27
+ description: The unit of measuremet for the quantity property.
28
+ example: ml
29
+ required: true
30
+ upc:
31
+ type: string
32
+ pattern: "[0-9]{12,12}"
33
+ description: |
34
+ The Universal Produc Code. It consists of 12 numerical digits. However, because of the
35
+ integer precision limitation in JavaScript it is represented as a string.
36
+ example: "042100005264"
37
+ required: true
38
+ available:
39
+ type: boolean
40
+ description: |
41
+ Product current availability in the store.
42
+ Product may be not available but the users still can order it with later delivery date.
43
+ required: true
44
+ example: true
45
+ example:
46
+ id: we2322-4f4f4f-f4f4ff-f4f4ff4
47
+ name: Acme Product
48
+ quantity: 200
49
+ unit: ml
50
+ upc: "123456789101"
51
+ available: true
52
+ etag: "W\\sd3deef3rgrgf4r"
@@ -0,0 +1,11 @@
1
+ #%RAML 1.0 DataType
2
+
3
+ description: |
4
+ Common properties for all resources returned by the API.
5
+ type: object
6
+ properties:
7
+ etag:
8
+ type: string
9
+ description: |
10
+ ETag of this resource for caching purposes.
11
+ __This property will be ignored when creating an object.__
@@ -0,0 +1,50 @@
1
+ #%RAML 1.0 ResourceType
2
+
3
+ get:
4
+ queryParameters:
5
+ access_token:
6
+ type: string
7
+ required: false
8
+ description: |
9
+ OAuth 2.0 token for the current user.
10
+ One possible way to provide an OAuth 2.0 token.
11
+ callback:
12
+ type: string
13
+ required: false
14
+ description: |
15
+ Name of the JavaScript callback function that handles the response.
16
+ Used in JavaScript JSON-P requests.
17
+ fields:
18
+ type: string
19
+ required: false
20
+ description: |
21
+ Selector specifying a subset of fields to include in the response.
22
+ For more information, see the partial response section in the Performance Tips document.
23
+ Use for better performance.
24
+ key:
25
+ type: string
26
+ required: false
27
+ description: |
28
+ Required unless you provide an OAuth 2.0 token.
29
+ Your API key identifies your project and provides you with API access, quota, and reports.
30
+ Obtain your project's API key from the Google API Console.
31
+ prettyPrint:
32
+ type: boolean
33
+ required: false
34
+ description: |
35
+ Returns response with indentations and line breaks.
36
+ When this is false, it can reduce the response payload size, which might lead to better performance in some environments.
37
+ default: true
38
+ quotaUser:
39
+ type: string
40
+ required: false
41
+ description: |
42
+ Alternative to `userIp`.
43
+ Lets you enforce per-user quotas from a server-side application even in cases when the user's IP address is unknown. This can occur, for example, with applications that run cron jobs on App Engine on a user's behalf.
44
+ You can choose any arbitrary string that uniquely identifies a user, but it is limited to 40 characters.
45
+ Overrides userIp if both are provided.
46
+ userIp:
47
+ type: string
48
+ required: false
49
+ description: |
50
+ IP address of the end user for whom the API call is being made. Lets you enforce per-user quotas when calling the API from a server-side application.
@@ -0,0 +1,37 @@
1
+ #%RAML 1.0 DataType
2
+
3
+ displayName: User
4
+ type: object
5
+ description: A representation of a user in Google Drive.
6
+ properties:
7
+ kind:
8
+ type: string
9
+ description: This is always drive#user.
10
+ enum: [drive#user]
11
+ default: drive#user
12
+ displayName:
13
+ type: string
14
+ required: false
15
+ description: A plain text displayable name for this user.
16
+ picture:
17
+ type: object
18
+ description: The user's profile picture.
19
+ required: false
20
+ properties:
21
+ url:
22
+ type: string
23
+ required: false
24
+ description: A URL that points to a profile picture of this user.
25
+ isAuthenticatedUser:
26
+ type: boolean
27
+ required: false
28
+ description: Whether this user is the same as the authenticated user for whom the request was made.
29
+ example: false
30
+ permissionId:
31
+ type: string
32
+ required: false
33
+ description: The user's ID as visible in the permissions collection.
34
+ emailAddress:
35
+ type: string
36
+ required: false
37
+ description: The email address of the user.
@@ -0,0 +1,96 @@
1
+ asyncapi: '2.0.0'
2
+ info:
3
+ title: Hello world application
4
+ version: '0.1.0'
5
+ servers:
6
+ production:
7
+ url: broker.mycompany.com
8
+ protocol: amqp
9
+ protocolVersion: 1.0.0
10
+ description: This is "My Company" broker.
11
+ security:
12
+ - oAuth2: []
13
+ - foo: []
14
+ channels:
15
+ hello:
16
+ publish:
17
+ message:
18
+ $ref: '#/components/messages/hello-msg'
19
+ goodbye:
20
+ subscribe:
21
+ message:
22
+ $ref: '#/components/messages/goodbye-msg'
23
+ components:
24
+ messages:
25
+ hello-msg:
26
+ headers:
27
+ $ref: '#/components/schemas/hello-headers'
28
+ payload:
29
+ type: object
30
+ properties:
31
+ name:
32
+ type: string
33
+ sentAt:
34
+ $ref: '#/components/schemas/sent-at'
35
+ goodbye-msg:
36
+ headers:
37
+ type: object
38
+ oneOf:
39
+ - $ref: '#/components/schemas/goodbye-headers-1'
40
+ - $ref: '#/components/schemas/goodbye-headers-2'
41
+ payload:
42
+ type: object
43
+ properties:
44
+ sentAt:
45
+ $ref: '#/components/schemas/sent-at'
46
+ schemas:
47
+ sent-at:
48
+ type: string
49
+ description: The date and time a message was sent.
50
+ format: datetime
51
+ hello-headers:
52
+ type: object
53
+ properties:
54
+ x-custom-header:
55
+ description: You can put whatever you want here
56
+ type: string
57
+ Accept:
58
+ description: You must specificy accept type for response
59
+ type: string
60
+ x-request-id:
61
+ description: Request id for tracing errors
62
+ type: string
63
+ goodbye-headers-1:
64
+ type: object
65
+ properties:
66
+ x-first-header:
67
+ type: string
68
+ x-second-header:
69
+ type: string
70
+ goodbye-headers-2:
71
+ type: object
72
+ properties:
73
+ x-foo:
74
+ type: string
75
+ x-bar:
76
+ type: string
77
+ x-foo-bar:
78
+ type: string
79
+ securitySchemes:
80
+ foo:
81
+ type: userPassword
82
+ description: This is the Foo scheme with username and password config
83
+ oAuth2:
84
+ type: oauth2
85
+ flows:
86
+ implicit:
87
+ authorizationUrl: https://example.com/api/oauth/dialog
88
+ scopes:
89
+ write:pets: modify pets in your account
90
+ read:pets: read your pets
91
+ authorizationCode:
92
+ authorizationUrl: https://example.com/api/oauth/dialog
93
+ tokenUrl: https://example.com/api/oauth/token
94
+ scopes:
95
+ write:pets: modify pets in your account
96
+ read:pets: read your pets
@@ -0,0 +1,8 @@
1
+ #%RAML 1.0
2
+ title: Simple API
3
+
4
+ /people:
5
+ get:
6
+ post:
7
+ put:
8
+ patch:
@@ -0,0 +1,8 @@
1
+ #%RAML 1.0
2
+ title: Simple API
3
+
4
+ /people:
5
+ get:
6
+ post:
7
+ put:
8
+ patch:
@@ -0,0 +1,112 @@
1
+ openapi: "3.0.0"
2
+ info:
3
+ version: 1.0.0
4
+ title: Swagger Petstore
5
+ license:
6
+ name: MIT
7
+ servers:
8
+ - url: http://petstore.swagger.io/v1
9
+ - url: http://dev.petstore.swagger.io/v1
10
+ paths:
11
+ /pets:
12
+ get:
13
+ summary: List all pets
14
+ operationId: listPets
15
+ tags:
16
+ - pets
17
+ parameters:
18
+ - name: limit
19
+ in: query
20
+ description: How many items to return at one time (max 100)
21
+ required: false
22
+ schema:
23
+ type: integer
24
+ format: int32
25
+ responses:
26
+ '200':
27
+ description: A paged array of pets
28
+ headers:
29
+ x-next:
30
+ description: A link to the next page of responses
31
+ schema:
32
+ type: string
33
+ content:
34
+ application/json:
35
+ schema:
36
+ $ref: "#/components/schemas/Pets"
37
+ default:
38
+ description: unexpected error
39
+ content:
40
+ application/json:
41
+ schema:
42
+ $ref: "#/components/schemas/Error"
43
+ post:
44
+ summary: Create a pet
45
+ operationId: createPets
46
+ tags:
47
+ - pets
48
+ responses:
49
+ '201':
50
+ description: Null response
51
+ default:
52
+ description: unexpected error
53
+ content:
54
+ application/json:
55
+ schema:
56
+ $ref: "#/components/schemas/Error"
57
+ /pets/{petId}:
58
+ get:
59
+ summary: Info for a specific pet
60
+ operationId: showPetById
61
+ tags:
62
+ - pets
63
+ parameters:
64
+ - name: petId
65
+ in: path
66
+ required: true
67
+ description: The id of the pet to retrieve
68
+ schema:
69
+ type: string
70
+ responses:
71
+ '200':
72
+ description: Expected response to a valid request
73
+ content:
74
+ application/json:
75
+ schema:
76
+ $ref: "#/components/schemas/Pet"
77
+ default:
78
+ description: unexpected error
79
+ content:
80
+ application/json:
81
+ schema:
82
+ $ref: "#/components/schemas/Error"
83
+ components:
84
+ schemas:
85
+ Pet:
86
+ type: object
87
+ required:
88
+ - id
89
+ - name
90
+ properties:
91
+ id:
92
+ type: integer
93
+ format: int64
94
+ name:
95
+ type: string
96
+ tag:
97
+ type: string
98
+ Pets:
99
+ type: array
100
+ items:
101
+ $ref: "#/components/schemas/Pet"
102
+ Error:
103
+ type: object
104
+ required:
105
+ - code
106
+ - message
107
+ properties:
108
+ code:
109
+ type: integer
110
+ format: int32
111
+ message:
112
+ type: string
package/data/model.js CHANGED
@@ -27,6 +27,11 @@ config.set('recursive/recursive.raml', { type: "RAML 1.0" });
27
27
  config.set('oas-types/oas-types.yaml', { type: "OAS 3.0" });
28
28
  config.set('oas-date/oas-date.yaml', { type: "OAS 3.0" });
29
29
  config.set('oas-unions/oas-unions.yaml', { type: "OAS 3.0" });
30
+ config.set('amf-helper-api/amf-helper-api.raml', { type: "RAML 1.0" });
31
+ config.set('async-api/async-api.yaml', { type: "ASYNC 2.0" });
32
+ config.set('flattened-api/flattened-api.raml', { type: 'RAML 1.0', mime: 'application/yaml', flattened: true });
33
+ config.set('expanded-api/expanded-api.raml', { type: 'RAML 1.0', mime: 'application/yaml', flattened: false });
34
+ config.set('multiple-servers/multiple-servers.yaml', { type: 'OAS 3.0', mime: 'application/yaml' });
30
35
 
31
36
  const srcFolder = path.join('data', 'apis');
32
37
  const descFolder = path.join('data', 'models');