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

[ULX-1599] feat: add get/update template partials to PromptsManager #981

Closed
wants to merge 1 commit into from

Conversation

joel-hamilton
Copy link

@joel-hamilton joel-hamilton commented Jan 24, 2024

Changes

This PR adds support for get/update template partials to PromptsManager. This is related to our EA Custom Prompts feature.

References

ULX-1599

Testing

  • This change adds unit test coverage
  • This change adds integration test coverage

To test locally,

  • pull these changes and create a node-auth0 link
npm run build && yarn link
  • make another project that requires node-auth0, and link it to the local copy:
mkdir temp && \
cd temp && \
npm init -y && \
npm i auth0 && \
npm link auth0 && \
<<EOF >> index.js
const ManagementClient = require("auth0").ManagementClient;
const assert = require("node:assert/strict");

const data = {
  login: { "form-content-end": "<div>TEST</div>" }
};

var management = new ManagementClient({
  domain: process.env.AUTH0_DOMAIN,
  token: process.env.API2_TOKEN,
});

async function test() {
  const putRes = await management.prompts.updateTemplatePartialsByPrompt(
    { prompt: "login" },
    data
  );
  assert(JSON.stringify(putRes.data) === JSON.stringify(data));

  const getRes = await management.prompts.getTemplatePartialsByPrompt({ prompt: "login" });
  assert(JSON.stringify(getRes.data) === JSON.stringify(data));
}

test();

EOF
  • run it
export AUTH0_DOMAIN="test-tenant.eu.auth0.com"
export API2_TOKEN="ey..."
node ./index.js

Checklist

@joel-hamilton joel-hamilton changed the title [ULX-1599] feat: add get/put partials to PromptsManager [ULX-1599] feat: add get/update template partials to PromptsManager Jan 25, 2024
@joel-hamilton joel-hamilton marked this pull request as ready for review January 25, 2024 14:15
@joel-hamilton joel-hamilton requested a review from a team as a code owner January 25, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants