@valbuild/server 0.62.4 → 0.62.6

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.
@@ -39,12 +39,11 @@ export declare class ValServer {
39
39
  }): Promise<ValServerRedirectResult<VAL_ENABLE_COOKIE_NAME>>;
40
40
  authorize(query: {
41
41
  redirect_to?: string;
42
- }): Promise<ValServerRedirectResult<VAL_STATE_COOKIE>>;
42
+ }): Promise<ValServerRedirectResult<VAL_STATE_COOKIE | VAL_ENABLE_COOKIE_NAME>>;
43
43
  callback(query: {
44
44
  code?: string;
45
45
  state?: string;
46
46
  }, cookies: ValCookies<"val_state">): Promise<ValServerRedirectResult<"val_state" | "val_session" | "val_enable">>;
47
- log(): Promise<ValServerResult<VAL_SESSION_COOKIE | VAL_STATE_COOKIE>>;
48
47
  session(cookies: ValCookies<VAL_SESSION_COOKIE>): Promise<ValServerJsonResult<ValSession>>;
49
48
  private consumeCode;
50
49
  private getAuthorizeUrl;
@@ -1516,7 +1516,6 @@ class ValOps {
1516
1516
 
1517
1517
  // #region getTree
1518
1518
  async getTree(analysis) {
1519
- console.log("analysis", analysis);
1520
1519
  if (!analysis) {
1521
1520
  const {
1522
1521
  sources
@@ -3353,8 +3352,10 @@ class ValServer {
3353
3352
  const token = crypto.randomUUID();
3354
3353
  const redirectUrl = new URL(query.redirect_to);
3355
3354
  const appAuthorizeUrl = this.getAuthorizeUrl(`${redirectUrl.origin}/${this.options.route}`, token);
3355
+ await this.callbacks.onEnable(true);
3356
3356
  return {
3357
3357
  cookies: {
3358
+ [internal.VAL_ENABLE_COOKIE_NAME]: ENABLE_COOKIE_VALUE,
3358
3359
  [internal.VAL_STATE_COOKIE]: {
3359
3360
  value: createStateCookie({
3360
3361
  redirect_to: query.redirect_to,
@@ -3459,19 +3460,6 @@ class ValServer {
3459
3460
  redirectTo: callbackReqSuccess.redirect_uri || "/"
3460
3461
  };
3461
3462
  }
3462
- async log() {
3463
- return {
3464
- status: 200,
3465
- cookies: {
3466
- [internal.VAL_SESSION_COOKIE]: {
3467
- value: null
3468
- },
3469
- [internal.VAL_STATE_COOKIE]: {
3470
- value: null
3471
- }
3472
- }
3473
- };
3474
- }
3475
3463
  async session(cookies) {
3476
3464
  if (this.serverOps instanceof ValOpsFS) {
3477
3465
  return {
@@ -3984,6 +3972,22 @@ class ValServer {
3984
3972
  ...analysis,
3985
3973
  ...patches
3986
3974
  });
3975
+ if (preparedCommit.hasErrors) {
3976
+ console.error("Failed to create commit", {
3977
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3978
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3979
+ });
3980
+ return {
3981
+ status: 400,
3982
+ json: {
3983
+ message: "Failed to create commit",
3984
+ details: {
3985
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3986
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3987
+ }
3988
+ }
3989
+ };
3990
+ }
3987
3991
  if (this.serverOps instanceof ValOpsFS) {
3988
3992
  await this.serverOps.saveFiles(preparedCommit);
3989
3993
  return {
@@ -1516,7 +1516,6 @@ class ValOps {
1516
1516
 
1517
1517
  // #region getTree
1518
1518
  async getTree(analysis) {
1519
- console.log("analysis", analysis);
1520
1519
  if (!analysis) {
1521
1520
  const {
1522
1521
  sources
@@ -3353,8 +3352,10 @@ class ValServer {
3353
3352
  const token = crypto.randomUUID();
3354
3353
  const redirectUrl = new URL(query.redirect_to);
3355
3354
  const appAuthorizeUrl = this.getAuthorizeUrl(`${redirectUrl.origin}/${this.options.route}`, token);
3355
+ await this.callbacks.onEnable(true);
3356
3356
  return {
3357
3357
  cookies: {
3358
+ [internal.VAL_ENABLE_COOKIE_NAME]: ENABLE_COOKIE_VALUE,
3358
3359
  [internal.VAL_STATE_COOKIE]: {
3359
3360
  value: createStateCookie({
3360
3361
  redirect_to: query.redirect_to,
@@ -3459,19 +3460,6 @@ class ValServer {
3459
3460
  redirectTo: callbackReqSuccess.redirect_uri || "/"
3460
3461
  };
3461
3462
  }
3462
- async log() {
3463
- return {
3464
- status: 200,
3465
- cookies: {
3466
- [internal.VAL_SESSION_COOKIE]: {
3467
- value: null
3468
- },
3469
- [internal.VAL_STATE_COOKIE]: {
3470
- value: null
3471
- }
3472
- }
3473
- };
3474
- }
3475
3463
  async session(cookies) {
3476
3464
  if (this.serverOps instanceof ValOpsFS) {
3477
3465
  return {
@@ -3984,6 +3972,22 @@ class ValServer {
3984
3972
  ...analysis,
3985
3973
  ...patches
3986
3974
  });
3975
+ if (preparedCommit.hasErrors) {
3976
+ console.error("Failed to create commit", {
3977
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3978
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3979
+ });
3980
+ return {
3981
+ status: 400,
3982
+ json: {
3983
+ message: "Failed to create commit",
3984
+ details: {
3985
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3986
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3987
+ }
3988
+ }
3989
+ };
3990
+ }
3987
3991
  if (this.serverOps instanceof ValOpsFS) {
3988
3992
  await this.serverOps.saveFiles(preparedCommit);
3989
3993
  return {
@@ -1486,7 +1486,6 @@ class ValOps {
1486
1486
 
1487
1487
  // #region getTree
1488
1488
  async getTree(analysis) {
1489
- console.log("analysis", analysis);
1490
1489
  if (!analysis) {
1491
1490
  const {
1492
1491
  sources
@@ -3323,8 +3322,10 @@ class ValServer {
3323
3322
  const token = crypto.randomUUID();
3324
3323
  const redirectUrl = new URL(query.redirect_to);
3325
3324
  const appAuthorizeUrl = this.getAuthorizeUrl(`${redirectUrl.origin}/${this.options.route}`, token);
3325
+ await this.callbacks.onEnable(true);
3326
3326
  return {
3327
3327
  cookies: {
3328
+ [VAL_ENABLE_COOKIE_NAME]: ENABLE_COOKIE_VALUE,
3328
3329
  [VAL_STATE_COOKIE$1]: {
3329
3330
  value: createStateCookie({
3330
3331
  redirect_to: query.redirect_to,
@@ -3429,19 +3430,6 @@ class ValServer {
3429
3430
  redirectTo: callbackReqSuccess.redirect_uri || "/"
3430
3431
  };
3431
3432
  }
3432
- async log() {
3433
- return {
3434
- status: 200,
3435
- cookies: {
3436
- [VAL_SESSION_COOKIE$1]: {
3437
- value: null
3438
- },
3439
- [VAL_STATE_COOKIE$1]: {
3440
- value: null
3441
- }
3442
- }
3443
- };
3444
- }
3445
3433
  async session(cookies) {
3446
3434
  if (this.serverOps instanceof ValOpsFS) {
3447
3435
  return {
@@ -3954,6 +3942,22 @@ class ValServer {
3954
3942
  ...analysis,
3955
3943
  ...patches
3956
3944
  });
3945
+ if (preparedCommit.hasErrors) {
3946
+ console.error("Failed to create commit", {
3947
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3948
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3949
+ });
3950
+ return {
3951
+ status: 400,
3952
+ json: {
3953
+ message: "Failed to create commit",
3954
+ details: {
3955
+ sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
3956
+ binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
3957
+ }
3958
+ }
3959
+ };
3960
+ }
3957
3961
  if (this.serverOps instanceof ValOpsFS) {
3958
3962
  await this.serverOps.saveFiles(preparedCommit);
3959
3963
  return {
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "./package.json": "./package.json"
13
13
  },
14
14
  "types": "dist/valbuild-server.cjs.d.ts",
15
- "version": "0.62.4",
15
+ "version": "0.62.6",
16
16
  "scripts": {
17
17
  "typecheck": "tsc --noEmit",
18
18
  "test": "jest",
@@ -22,9 +22,9 @@
22
22
  "@types/jest": "^29.2.5"
23
23
  },
24
24
  "dependencies": {
25
- "@valbuild/core": "~0.62.4",
26
- "@valbuild/shared": "~0.62.4",
27
- "@valbuild/ui": "~0.62.4",
25
+ "@valbuild/core": "~0.62.6",
26
+ "@valbuild/shared": "~0.62.6",
27
+ "@valbuild/ui": "~0.62.6",
28
28
  "image-size": "^1.0.2",
29
29
  "minimatch": "^3.0.4",
30
30
  "quickjs-emscripten": "^0.21.1",