Skip to content

Commit

Permalink
Prep 1.6.7
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Apr 15, 2022
1 parent 2dd4042 commit a2b5a96
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 53 deletions.
4 changes: 2 additions & 2 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phoenix",
"version": "1.6.6",
"version": "1.6.7",
"description": "The official JavaScript client for the Phoenix web framework.",
"license": "MIT",
"main": "./assets/js/phoenix/index.js",
Expand Down
2 changes: 1 addition & 1 deletion installer/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end
defmodule Phx.New.MixProject do
use Mix.Project

@version "1.6.6"
@version "1.6.7"
@scm_url "https://github.com/phoenixframework/phoenix"

# If the elixir requirement is updated, we need to update:
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Phoenix.MixProject do
end
end

@version "1.6.6"
@version "1.6.7"
@scm_url "https://github.com/phoenixframework/phoenix"

# If the elixir requirement is updated, we need to make the installer
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phoenix",
"version": "1.6.6",
"version": "1.6.7",
"description": "The official JavaScript client for the Phoenix web framework.",
"license": "MIT",
"module": "./priv/static/phoenix.mjs",
Expand Down
47 changes: 32 additions & 15 deletions priv/static/phoenix.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions priv/static/phoenix.cjs.js.map

Large diffs are not rendered by default.

45 changes: 30 additions & 15 deletions priv/static/phoenix.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
var Phoenix = (() => {
var __defProp = Object.defineProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// js/phoenix/index.js
var phoenix_exports = {};
Expand All @@ -32,7 +42,7 @@ var Phoenix = (() => {
// js/phoenix/constants.js
var globalSelf = typeof self !== "undefined" ? self : null;
var phxWindow = typeof window !== "undefined" ? window : null;
var global = globalSelf || phxWindow || void 0;
var global = globalSelf || phxWindow || global;
var DEFAULT_VSN = "2.0.0";
var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
var DEFAULT_TIMEOUT = 1e4;
Expand Down Expand Up @@ -457,13 +467,13 @@ var Phoenix = (() => {
endpointURL() {
return Ajax.appendParams(this.pollEndpoint, { token: this.token });
}
closeAndRetry() {
this.close();
closeAndRetry(code, reason, wasClean) {
this.close(code, reason, wasClean);
this.readyState = SOCKET_STATES.connecting;
}
ontimeout() {
this.onerror("timeout");
this.closeAndRetry();
this.closeAndRetry(1005, "timeout", false);
}
poll() {
if (!(this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting)) {
Expand All @@ -490,17 +500,17 @@ var Phoenix = (() => {
break;
case 410:
this.readyState = SOCKET_STATES.open;
this.onopen();
this.onopen({});
this.poll();
break;
case 403:
this.onerror();
this.close();
this.onerror(403);
this.close(1008, "forbidden", false);
break;
case 0:
case 500:
this.onerror();
this.closeAndRetry();
this.onerror(500);
this.closeAndRetry(1011, "internal server error", 500);
break;
default:
throw new Error(`unhandled poll status ${status}`);
Expand All @@ -511,13 +521,18 @@ var Phoenix = (() => {
Ajax.request("POST", this.endpointURL(), "application/json", body, this.timeout, this.onerror.bind(this, "timeout"), (resp) => {
if (!resp || resp.status !== 200) {
this.onerror(resp && resp.status);
this.closeAndRetry();
this.closeAndRetry(1011, "internal server error", false);
}
});
}
close(_code, _reason) {
close(code, reason, wasClean) {
this.readyState = SOCKET_STATES.closed;
this.onclose();
let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
if (typeof CloseEvent !== "undefined") {
this.onclose(new CloseEvent("close", opts));
} else {
this.onclose(opts);
}
}
};

Expand Down Expand Up @@ -1085,5 +1100,5 @@ var Phoenix = (() => {
}
}
};
return phoenix_exports;
return __toCommonJS(phoenix_exports);
})();
2 changes: 1 addition & 1 deletion priv/static/phoenix.min.js

Large diffs are not rendered by default.

29 changes: 17 additions & 12 deletions priv/static/phoenix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var closure = (value) => {
// js/phoenix/constants.js
var globalSelf = typeof self !== "undefined" ? self : null;
var phxWindow = typeof window !== "undefined" ? window : null;
var global = globalSelf || phxWindow || void 0;
var global = globalSelf || phxWindow || global;
var DEFAULT_VSN = "2.0.0";
var SOCKET_STATES = { connecting: 0, open: 1, closing: 2, closed: 3 };
var DEFAULT_TIMEOUT = 1e4;
Expand Down Expand Up @@ -438,13 +438,13 @@ var LongPoll = class {
endpointURL() {
return Ajax.appendParams(this.pollEndpoint, { token: this.token });
}
closeAndRetry() {
this.close();
closeAndRetry(code, reason, wasClean) {
this.close(code, reason, wasClean);
this.readyState = SOCKET_STATES.connecting;
}
ontimeout() {
this.onerror("timeout");
this.closeAndRetry();
this.closeAndRetry(1005, "timeout", false);
}
poll() {
if (!(this.readyState === SOCKET_STATES.open || this.readyState === SOCKET_STATES.connecting)) {
Expand All @@ -471,17 +471,17 @@ var LongPoll = class {
break;
case 410:
this.readyState = SOCKET_STATES.open;
this.onopen();
this.onopen({});
this.poll();
break;
case 403:
this.onerror();
this.close();
this.onerror(403);
this.close(1008, "forbidden", false);
break;
case 0:
case 500:
this.onerror();
this.closeAndRetry();
this.onerror(500);
this.closeAndRetry(1011, "internal server error", 500);
break;
default:
throw new Error(`unhandled poll status ${status}`);
Expand All @@ -492,13 +492,18 @@ var LongPoll = class {
Ajax.request("POST", this.endpointURL(), "application/json", body, this.timeout, this.onerror.bind(this, "timeout"), (resp) => {
if (!resp || resp.status !== 200) {
this.onerror(resp && resp.status);
this.closeAndRetry();
this.closeAndRetry(1011, "internal server error", false);
}
});
}
close(_code, _reason) {
close(code, reason, wasClean) {
this.readyState = SOCKET_STATES.closed;
this.onclose();
let opts = Object.assign({ code: 1e3, reason: void 0, wasClean: true }, { code, reason, wasClean });
if (typeof CloseEvent !== "undefined") {
this.onclose(new CloseEvent("close", opts));
} else {
this.onclose(opts);
}
}
};

Expand Down
4 changes: 2 additions & 2 deletions priv/static/phoenix.mjs.map

Large diffs are not rendered by default.

0 comments on commit a2b5a96

Please sign in to comment.