Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
59 lines
2.5 KiB
TypeScript
59 lines
2.5 KiB
TypeScript
import type { Cookie } from './cookie';
|
|
/**
|
|
* A comparison function that can be used with {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort | Array.sort()},
|
|
* which orders a list of cookies into the recommended order given in Step 2 of {@link https://www.rfc-editor.org/rfc/rfc6265.html#section-5.4 | RFC6265 - Section 5.4}.
|
|
*
|
|
* The sort algorithm is, in order of precedence:
|
|
*
|
|
* - Longest {@link Cookie.path}
|
|
*
|
|
* - Oldest {@link Cookie.creation} (which has a 1-ms precision, same as Date)
|
|
*
|
|
* - Lowest {@link Cookie.creationIndex} (to get beyond the 1-ms precision)
|
|
*
|
|
* @remarks
|
|
* ### RFC6265 - Section 5.4 - Step 2
|
|
*
|
|
* The user agent SHOULD sort the cookie-list in the following order:
|
|
*
|
|
* - Cookies with longer paths are listed before cookies with shorter paths.
|
|
*
|
|
* - Among cookies that have equal-length path fields, cookies with
|
|
* earlier creation-times are listed before cookies with later
|
|
* creation-times.
|
|
*
|
|
* NOTE: Not all user agents sort the cookie-list in this order, but
|
|
* this order reflects common practice when this document was
|
|
* written, and, historically, there have been servers that
|
|
* (erroneously) depended on this order.
|
|
*
|
|
* ### Custom Store Implementors
|
|
*
|
|
* Since the JavaScript Date is limited to a 1-ms precision, cookies within the same millisecond are entirely possible.
|
|
* This is especially true when using the `now` option to `CookieJar.setCookie(...)`. The {@link Cookie.creationIndex}
|
|
* property is a per-process global counter, assigned during construction with `new Cookie()`, which preserves the spirit
|
|
* of the RFC sorting: older cookies go first. This works great for {@link MemoryCookieStore} since `Set-Cookie` headers
|
|
* are parsed in order, but is not so great for distributed systems.
|
|
*
|
|
* Sophisticated Stores may wish to set this to some other
|
|
* logical clock so that if cookies `A` and `B` are created in the same millisecond, but cookie `A` is created before
|
|
* cookie `B`, then `A.creationIndex < B.creationIndex`.
|
|
*
|
|
* @example
|
|
* ```
|
|
* const cookies = [
|
|
* new Cookie({ key: 'a', value: '' }),
|
|
* new Cookie({ key: 'b', value: '' }),
|
|
* new Cookie({ key: 'c', value: '', path: '/path' }),
|
|
* new Cookie({ key: 'd', value: '', path: '/path' }),
|
|
* ]
|
|
* cookies.sort(cookieCompare)
|
|
* // cookie sort order would be ['c', 'd', 'a', 'b']
|
|
* ```
|
|
*
|
|
* @param a - the first Cookie for comparison
|
|
* @param b - the second Cookie for comparison
|
|
* @public
|
|
*/
|
|
export declare function cookieCompare(a: Cookie, b: Cookie): number;
|