Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional types for Typescript #288

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions sdk/src/cloudevent.jsdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2021 Lightbend Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @classdesc CloudEvent data.
*
* This exposes CloudEvent data from metadata. Changes made to the Cloudevent are reflected in the backing metadata,
* as are changes to the backing metadata reflected in this CloudEvent.
*
* @class module:akkaserverless.Cloudevent
* @param {module:akkaserverless.Metadata} metadata The metadata backing this CloudEvent.
*/

/**
* The metadata backing this CloudEvent.
*
* @name module:akkaserverless.Cloudevent#metadata
* @type {module:akkaserverless.Metadata}
* @readonly
*/

/**
* The spec version
*
* @name module:akkaserverless.Cloudevent#specversion
* @type {string | undefined}
* @readonly
*/

/**
* The id
*
* @name module:akkaserverless.Cloudevent#id
* @type {string | undefined}
*/

/**
* The source
*
* @name module:akkaserverless.Cloudevent#source
* @type {string | undefined}
*/

/**
* The type
*
* @name module:akkaserverless.Cloudevent#type
* @type {string | undefined}
*/

/**
* The datacontenttype
*
* @name module:akkaserverless.Cloudevent#datacontenttype
* @type {string | undefined}
*/

/**
* The dataschema
*
* @name module:akkaserverless.Cloudevent#dataschema
* @type {string | undefined}
*/

/**
* The subject
*
* @name module:akkaserverless.Cloudevent#subject
* @type {string | undefined}
*/

/**
* The time
*
* @name module:akkaserverless.Cloudevent#time
* @type {Date | undefined}
*/

176 changes: 176 additions & 0 deletions sdk/src/jwt-claims.jsdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* Copyright 2021 Lightbend Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @classdesc JWT claims.
*
* This exposes an JWT claims that were extracted from the bearer token.
*
* @class module:akkaserverless.JwtClaims
* @param {module:akkaserverless.Metadata} metadata The metadata that the JWT claims com efrom.
*/

/**
* The metadata backing this JWT claims object.
*
* @name module:akkaserverless.JwtClaims#metadata
* @type {module:akkaserverless.Metadata}
* @readonly
*/

/**
* The issuer
*
* @name module:akkaserverless.JwtClaims#issuer
* @type {string | undefined}
* @readonly
*/

/**
* The subject
*
* @name module:akkaserverless.JwtClaims#subject
* @type {string | undefined}
* @readonly
*/

/**
* The audience
*
* @name module:akkaserverless.JwtClaims#audience
* @type {string | undefined}
* @readonly
*/

/**
* The expiration time
*
* @name module:akkaserverless.JwtClaims#expirationTime
* @type {Date | undefined}
* @readonly
*/

/**
* The not before
*
* @name module:akkaserverless.JwtClaims#notBefore
* @type {Date | undefined}
* @readonly
*/

/**
* The issued at
*
* @name module:akkaserverless.JwtClaims#issuedAt
* @type {Date | undefined}
* @readonly
*/

/**
* The jwt id
*
* @name module:akkaserverless.JwtClaims#jwtId
* @type {string | undefined}
* @readonly
*/

/**
* Get the string claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getString
* @param {string} name The name of the claim.
* @returns {string | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the numeric claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getNumber
* @param {string} name The name of the claim.
* @returns {number | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the numeric date claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getNumericDate
* @param {string} name The name of the claim.
* @returns {Date | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the boolean claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getBoolean
* @param {string} name The name of the claim.
* @returns {boolean | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the object claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getObject
* @param {string} name The name of the claim.
* @returns {object | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the string array claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getStringArray
* @param {string} name The name of the claim.
* @returns {string[] | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the numeric array claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getNumberArray
* @param {string} name The name of the claim.
* @returns {number[] | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the boolean array claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getBooleanArray
* @param {string} name The name of the claim.
* @returns {boolean[] | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the object array claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getObjectArray
* @param {string} name The name of the claim.
* @returns {object[] | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/

/**
* Get the numeric date array claim with the given name.
*
* @function module:akkaserverless.JwtClaims#getNumericDateArray
* @param {string} name The name of the claim.
* @returns {Date[] | undefined} the claim, or undefined if it doesn't exist or is not of the right type.
*/








42 changes: 42 additions & 0 deletions sdk/src/metadata.jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,53 @@
* @param {module:akkaserverless.MetadataEntry[]} [entries=[]] The list of entries
*/

/**
* The entries as a map of keys to single values.
*
* This allows working with the metadata as if it's just a map with single values for each key.
*
* Modifications to the object will be reflected by replacing all values for a given key with a single value for the\
* key.
*
* Keys are also treated case insensitively.
*
* @name module:akkaserverless.Metadata#asMap
* @type {Object.<string,string|Buffer|undefined>}
* @readonly
*/

/**
* The CloudEvent information extracted from the metadata.
*
* @name module:akkaserverless.Metadata#cloudevent
* @type {module:akkaserverless.Cloudevent}
* @readonly
*/


/**
* The JWT claims information extracted from the metadata.
*
* @name module:akkaserverless.Metadata#jwtClaims
* @type {module:akkaserverless.JwtClaims}
* @readonly
*/

/**
* @function module:akkaserverless.Metadata#getSubject
* @returns {module:akkaserverless.MetadataValue|undefined} CloudEvent subject value.
*/

/**
* Set the HTTP status code for the response when sending a successful response using HTTP transcoding.
*
* This will only apply to responses that are being transcoded to plain HTTP from gRPC using the protobuf HTTP
* annotations. When gRPC is being used, calling this has no effect.
*
* @function module:akkaserverless.Metadata#setHttpStatusCode
* @param {number} code The HTTP status code.
*/

/**
* Create a new MetadataEntry.
*
Expand Down