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

major: ACNA-2584 - add Adobe App Builder State Store #134

Merged
merged 16 commits into from
Jan 8, 2024
Merged
32 changes: 32 additions & 0 deletions lib/StateStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,28 @@ class StateStore {
return this._delete(key)
}

/**
* Deletes all key-values
*
* @returns {Promise<boolean>} true if deleted, false if not
* @memberof StateStore
*/
async deleteAll () {
logger.debug('deleteAll')
return this._deleteAll()
}

/**
* There exists key-values.
*
* @returns {Promise<boolean>} true if exists, false if not
* @memberof StateStore
*/
async any () {
logger.debug('any')
return this._any()
}

/* **************************** PRIVATE METHODS TO IMPLEMENT ***************************** */
/**
* @param {string} key state key identifier
Expand All @@ -165,6 +187,16 @@ class StateStore {
* @protected
*/
async _delete (key) { throwNotImplemented('_delete') }
/**
* @returns {Promise<boolean>} true if deleted, false if not
* @protected
*/
async _deleteAll () { throwNotImplemented('_deleteAll') }
/**
* @returns {Promise<boolean>} true if exists, false if not
* @protected
*/
async _any () { throwNotImplemented('_any') }
}

StateStore.DefaultTTL = 86400 // 24hours
Expand Down
3 changes: 2 additions & 1 deletion lib/StateStoreError.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ const E = ErrorWrapper(
E('ERROR_INTERNAL', '%s')
E('ERROR_BAD_REQUEST', '%s')
E('ERROR_BAD_ARGUMENT', '%s')
E('ERROR_UNKNOWN_PROVIDER', '%s')
E('ERROR_NOT_IMPLEMENTED', 'method `%s` not implemented')
E('ERROR_UNAUTHORIZED', 'you are not authorized to access %s')
E('ERROR_BAD_CREDENTIALS', 'cannot access %s, make sure your credentials are valid')
E('ERROR_PAYLOAD_TOO_LARGE', 'key, value or request payload is too large')
E('ERROR_REQUEST_RATE_TOO_HIGH', 'Request rate too high. Please retry after sometime.')
// this error is specific to Adobe's owned database
E('ERROR_FIREWALL', 'cannot access %s because your IP is blocked by a firewall, please make sure to run in an Adobe I/O Runtime action')

// eslint-disable-next-line jsdoc/require-jsdoc
Expand Down
Loading