@stigmer/enterprise 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -48,7 +48,7 @@ docker run -d -p 7234:7234 -p 7235:7235 -v stigmer-data:/data \
48
48
 
49
49
  The image reads the variables in the table above, and everything the open-source image reads. A key it cannot verify stops the container with exit code 1 and one `boot failed:` line saying why. An image only trusts the signing keys compiled into its release (`src/license/trusted-keys.ts`): from 0.1.1, Stigmer's own issuer's key, `license-signing:v1`, so a license Stigmer issues verifies, and any other key is refused. With no key the image runs as open source. A licensed server refuses to start without Postgres or without sign-in (`STIGMER_OIDC_ISSUER`). One whose license may hold more than one organization also refuses to start with no sandbox driver that isolates a session (`SANDBOX_PROVISIONER_TYPE` set to `docker`, `agent-sandbox` or `substrate`), because every organization's agents would share one runner, unless `STIGMER_SHARED_RUNNER_ACROSS_ORGANIZATIONS=accepted` says the operator accepts that; the example above sets neither, so add one of them, or use a license with `maxOrgs: 1`.
50
50
 
51
- On Kubernetes, the repository's Helm chart runs this image: a license Secret named in `enterprise.license.existingSecret` switches the chart's server to it, with the settings above as chart values and an outbound network fence on by default (`deploy/helm/stigmer/README.md`, "Stigmer Enterprise").
51
+ On Kubernetes, the Stigmer operator runs this image: a license Secret named in `spec.enterprise.license` switches the server to it, with the settings above as fields of `spec.enterprise` and an outbound network fence on by default (`deploy/operator/config/samples/enterprise.yaml`, and the Stigmer resource's reference in the docs).
52
52
 
53
53
  Its labels say what it holds: `org.opencontainers.image.title` is `stigmer-server-ee`, and `org.opencontainers.image.licenses` is `LicenseRef-Stigmer-Enterprise AND Apache-2.0`, this package under `LICENSE` (which sits beside `main.js` in `/app`) and the open-source server under the Apache License 2.0.
54
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"late-name-table.d.ts","sourceRoot":"","sources":["../../src/extension/late-name-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,oEAAoE;IACpE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CA2BzD"}
1
+ {"version":3,"file":"late-name-table.d.ts","sourceRoot":"","sources":["../../src/extension/late-name-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,oEAAoE;IACpE,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CA4BzD"}
@@ -14,6 +14,7 @@ export function lateNameTable(unit) {
14
14
  currentMany: (holders) => composed().currentMany(holders),
15
15
  claim: (key, id, now) => composed().claim(key, id, now),
16
16
  rename: (move) => composed().rename(move),
17
+ commitRename: (move, undo) => composed().commitRename(move, undo),
17
18
  revertRename: (move, undo) => composed().revertRename(move, undo),
18
19
  release: (kind, org, id) => composed().release(kind, org, id),
19
20
  releaseName: (key, id) => composed().releaseName(key, id),
@@ -1 +1 @@
1
- {"version":3,"file":"late-name-table.js","sourceRoot":"","sources":["../../src/extension/late-name-table.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,IAAmC,CAAC;IACxC,MAAM,QAAQ,GAAG,GAAsB,EAAE;QACvC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,+EA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CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;gBAC7D,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC;aAC1D;SACF;QACD,IAAI,CAAC,KAAK;YACR,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/enterprise",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Stigmer Enterprise: many organizations, federation with the platforms whose tokens it trusts, teams and invitations, on the open-source Stigmer server, turned on by a license key.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -53,10 +53,11 @@
53
53
  "@bufbuild/protobuf": "2.12.0",
54
54
  "@bufbuild/protovalidate": "^1.1.1",
55
55
  "@connectrpc/connect": "^2.0.0",
56
- "@stigmer/apis": "0.2.0",
57
- "@stigmer/outbound": "0.2.0",
58
- "@stigmer/server": "0.2.0",
59
- "pg": "8.23.0"
56
+ "@stigmer/apis": "0.3.0",
57
+ "@stigmer/outbound": "0.3.0",
58
+ "@stigmer/server": "0.3.0",
59
+ "pg": "8.23.0",
60
+ "undici": "8.12.3"
60
61
  },
61
62
  "devDependencies": {
62
63
  "@connectrpc/connect-node": "^2.0.0",
@@ -4,12 +4,14 @@
4
4
  * table (`ComposedServices.resourceNames`) as those lanes meet it. It
5
5
  * claims, resolves and releases as `@stigmer/server`'s store contract pins
6
6
  * for a current name, and renames as it pins a rename: the new name
7
- * current, every other current name of the id previous until the move's
8
- * `fromExpiresAt`, a held name refused, an id's own previous name taken
9
- * back, and a revert restoring the name it took back and, when the id
10
- * then holds no current name, the names it pushed aside that are still as
11
- * it left them, else `from`. An expired previous name resolves to nothing
12
- * and is free. The composed suites run the real table.
7
+ * current, every other current name of the id previous under the move's
8
+ * provisional hold (`provisionalHoldOf`), a held name refused, an id's own
9
+ * previous name taken back, a commit stamping the names it pushed aside
10
+ * that are still as it left them with the move's `fromExpiresAt`, and a
11
+ * revert restoring the name it took back and, when the id then holds no
12
+ * current name, the names it pushed aside that are still as it left them,
13
+ * else `from`. An expired previous name resolves to nothing and is free.
14
+ * The composed suites run the real table.
13
15
  *
14
16
  * `rowsHold`, when given, makes every row a rig stores hold its name, as
15
17
  * the backfill and every create chain make it on a server: a name nobody
@@ -17,6 +19,7 @@
17
19
  * `nameOrganization` gives an organization id its slug, as an
18
20
  * organization's create does, for copy that names the organization.
19
21
  */
22
+ import { provisionalHoldOf } from "@stigmer/server";
20
23
  import type {
21
24
  NameTable,
22
25
  ResourceNameEntry,
@@ -90,13 +93,27 @@ export function inMemoryNames(
90
93
  entry.state === "current" && entry.name !== move.to
91
94
  ) {
92
95
  demoted.push(entry);
93
- entries.set(key, { ...entry, state: "previous", claimedAt: move.now, expiresAt: move.fromExpiresAt });
96
+ entries.set(key, { ...entry, state: "previous", claimedAt: move.now, expiresAt: provisionalHoldOf(move) });
94
97
  }
95
98
  }
96
99
  const entry: ResourceNameEntry = { ...toKey, id: move.id, state: "current", claimedAt: move.now, expiresAt: "" };
97
100
  entries.set(keyOf(toKey), entry);
98
101
  return takenBack === undefined ? { claimed: true, entry, demoted } : { claimed: true, entry, takenBack, demoted };
99
102
  },
103
+ commitRename: (move, undo) => {
104
+ const provisional = provisionalHoldOf(move);
105
+ for (const before of undo.demoted) {
106
+ const name = keyOf(before);
107
+ const now = entries.get(name);
108
+ if (
109
+ now?.id === move.id && now.state === "previous" &&
110
+ now.claimedAt === move.now && now.expiresAt === provisional
111
+ ) {
112
+ entries.set(name, { ...now, expiresAt: move.fromExpiresAt });
113
+ }
114
+ }
115
+ return Promise.resolve();
116
+ },
100
117
  revertRename: (move, undo) => {
101
118
  const toKey = keyOf({ kind: move.kind, org: move.org, name: move.to });
102
119
  if (entries.get(toKey)?.id === move.id) {
@@ -116,7 +133,7 @@ export function inMemoryNames(
116
133
  const now = entries.get(name);
117
134
  if (
118
135
  now?.id === move.id && now.state === "previous" &&
119
- now.claimedAt === move.now && now.expiresAt === move.fromExpiresAt
136
+ now.claimedAt === move.now && now.expiresAt === provisionalHoldOf(move)
120
137
  ) {
121
138
  entries.set(name, before);
122
139
  }
@@ -60,6 +60,7 @@ describe("lateNameTable", () => {
60
60
  currentMany: record("currentMany", [ENTRY]),
61
61
  claim: record("claim", { claimed: true, entry: ENTRY }),
62
62
  rename: record("rename", { claimed: true, entry: ENTRY, demoted: [] }),
63
+ commitRename: record("commitRename", undefined),
63
64
  revertRename: record("revertRename", undefined),
64
65
  release: record("release", undefined),
65
66
  releaseName: record("releaseName", undefined),
@@ -73,6 +74,7 @@ describe("lateNameTable", () => {
73
74
  expect(await names.currentMany([HOLDER])).toEqual([ENTRY]);
74
75
  expect(await names.claim(KEY, "tem_1", "now")).toEqual({ claimed: true, entry: ENTRY });
75
76
  expect(await names.rename(MOVE)).toEqual({ claimed: true, entry: ENTRY, demoted: [] });
77
+ await names.commitRename(MOVE, UNDO);
76
78
  await names.revertRename(MOVE, UNDO);
77
79
  await names.release("team", "org_acme", "tem_1");
78
80
  await names.releaseName(KEY, "tem_1");
@@ -83,6 +85,7 @@ describe("lateNameTable", () => {
83
85
  ["currentMany", [[HOLDER]]],
84
86
  ["claim", [KEY, "tem_1", "now"]],
85
87
  ["rename", [MOVE]],
88
+ ["commitRename", [MOVE, UNDO]],
86
89
  ["revertRename", [MOVE, UNDO]],
87
90
  ["release", ["team", "org_acme", "tem_1"]],
88
91
  ["releaseName", [KEY, "tem_1"]],
@@ -34,6 +34,7 @@ export function lateNameTable(unit: string): LateNameTable {
34
34
  currentMany: (holders) => composed().currentMany(holders),
35
35
  claim: (key, id, now) => composed().claim(key, id, now),
36
36
  rename: (move) => composed().rename(move),
37
+ commitRename: (move, undo) => composed().commitRename(move, undo),
37
38
  revertRename: (move, undo) => composed().revertRename(move, undo),
38
39
  release: (kind, org, id) => composed().release(kind, org, id),
39
40
  releaseName: (key, id) => composed().releaseName(key, id),