Skip to content

Commit

Permalink
multi-auth: deeterministic ids for folders, requests ans responses
Browse files Browse the repository at this point in the history
  • Loading branch information
barduinor committed Sep 10, 2023
1 parent 325829d commit f226e54
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/CollectionMulti.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ class CollectionMulti {

const itemId = this.genID(JSON.stringify(item))
item.id = itemId
item.request = this.requestCreate(verb, path, endpoint)
item.request = this.requestCreate(verb, path, endpoint, item.id)
item.response = this.responseCreate(endpoint, item.request.id)
item.event = this.getItemEvents(endpoint)
item.event = this.getItemEvents(endpoint, item.id)

// RB: only add the endpoint if the parent folder is in the subset
try {
Expand Down Expand Up @@ -274,7 +274,7 @@ class CollectionMulti {
})
}

requestCreate (verb, path, endpoint) {
requestCreate (verb, path, endpoint, folderId) {
const request = {
// id: uuid.v5(verb + '_' + path + '_' + endpoint, NAMESPACE), // RB: use uuid v5 to generate a deterministic uuid
url: this.url(path, endpoint),
Expand All @@ -284,7 +284,7 @@ class CollectionMulti {
header: this.header(endpoint),
body: this.body(endpoint)
}
const requesstId = this.genID(JSON.stringify(request))
const requesstId = this.genID(folderId + JSON.stringify(request))
request.id = requesstId
return request
}
Expand Down Expand Up @@ -576,7 +576,7 @@ class CollectionMulti {
/**
* Adds a pre-request script to an API call
*/
getItemEvents (endpoint) {
getItemEvents (endpoint, itemId) {
// RB: Dont add a script for endpoints if multi collection
return []
// if (this.LOCALE === 'MULTI') { return [] }
Expand Down

0 comments on commit f226e54

Please sign in to comment.