@puckeditor/cloud-client 0.7.0 → 0.7.1-canary.57918b6a

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.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  generate,
5
5
  puckHandler,
6
6
  tool
7
- } from "./chunk-4OIQ53M4.mjs";
7
+ } from "./chunk-JXZFCI6X.mjs";
8
8
  import "./chunk-O6DC5HI2.mjs";
9
9
  export {
10
10
  chat,
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  require_token_error,
3
3
  require_token_util
4
- } from "./chunk-IZCHY6MH.mjs";
4
+ } from "./chunk-BQWPP26F.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  init_react_import
8
8
  } from "./chunk-O6DC5HI2.mjs";
9
9
 
10
- // ../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js
10
+ // ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js
11
11
  var require_token = __commonJS({
12
- "../../node_modules/.pnpm/@vercel+oidc@3.1.0/node_modules/@vercel/oidc/dist/token.js"(exports, module) {
12
+ "../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js"(exports, module) {
13
13
  init_react_import();
14
14
  var __defProp = Object.defineProperty;
15
15
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -35,21 +35,28 @@ var require_token = __commonJS({
35
35
  module.exports = __toCommonJS(token_exports);
36
36
  var import_token_error = require_token_error();
37
37
  var import_token_util = require_token_util();
38
- async function refreshToken() {
39
- const { projectId, teamId } = (0, import_token_util.findProjectInfo)();
38
+ async function refreshToken(options) {
39
+ let projectId = options?.project;
40
+ let teamId = options?.team;
41
+ if (!projectId && !teamId) {
42
+ const projectInfo = (0, import_token_util.findProjectInfo)();
43
+ projectId = projectInfo.projectId;
44
+ teamId = projectInfo.teamId;
45
+ } else if (!projectId || !teamId) {
46
+ const projectInfo = (0, import_token_util.findProjectInfo)();
47
+ projectId = projectId ?? projectInfo.projectId;
48
+ teamId = teamId ?? projectInfo.teamId;
49
+ }
50
+ if (!projectId) {
51
+ throw new import_token_error.VercelOidcTokenError(
52
+ "Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`"
53
+ );
54
+ }
40
55
  let maybeToken = (0, import_token_util.loadToken)(projectId);
41
- if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token))) {
42
- const authToken = await (0, import_token_util.getVercelCliToken)();
43
- if (!authToken) {
44
- throw new import_token_error.VercelOidcTokenError(
45
- "Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`"
46
- );
47
- }
48
- if (!projectId) {
49
- throw new import_token_error.VercelOidcTokenError(
50
- "Failed to refresh OIDC token: Try re-linking your project with `vc link`"
51
- );
52
- }
56
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
57
+ const authToken = await (0, import_token_util.getVercelToken)({
58
+ expirationBufferMs: options?.expirationBufferMs
59
+ });
53
60
  maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
54
61
  if (!maybeToken) {
55
62
  throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
@@ -1,5 +1,5 @@
1
1
  import {
2
2
  require_token_util
3
- } from "./chunk-IZCHY6MH.mjs";
3
+ } from "./chunk-BQWPP26F.mjs";
4
4
  import "./chunk-O6DC5HI2.mjs";
5
5
  export default require_token_util();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puckeditor/cloud-client",
3
- "version": "0.7.0",
3
+ "version": "0.7.1-canary.57918b6a",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "puckeditor/puck",
6
6
  "bugs": "https://github.com/puckeditor/puck/issues",
@@ -47,7 +47,7 @@
47
47
  "tsconfig": "workspace:*",
48
48
  "tsup": "^8.2.4",
49
49
  "tsup-config": "workspace:*",
50
- "typescript": "^5.5.4",
50
+ "typescript": "catalog:",
51
51
  "vite-tsconfig-paths": "^5.1.4",
52
52
  "vitest": "^3.2.4",
53
53
  "zod": "^4.1.9"