@voltro/plugin-inventory 0.87.0 → 0.88.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/dist/capture.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { inventoryError as e } from "./errors.js";
2
- //#region src/capture.ts
2
+ // src/capture.ts
3
3
  var t = (t, n) => {
4
4
  if (!t || typeof t != "object" || Array.isArray(t)) throw e("invalid_input");
5
5
  let r = Object.getPrototypeOf(t);
@@ -49,5 +49,4 @@ var t = (t, n) => {
49
49
  };
50
50
  return o(n, 0);
51
51
  };
52
- //#endregion
53
52
  export { n as identifier, r as integer, a as jsonData, i as list, t as object };
package/dist/catalog.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Context as e } from "effect";
2
- //#region src/catalog.ts
2
+ // src/catalog.ts
3
3
  var t = class extends e.Service()("@voltro/CatalogSource") {};
4
- //#endregion
5
4
  export { t as CatalogSource };
@@ -4,7 +4,7 @@ import { captureCatalogItem as i, captureItemContracts as a } from "./item.js";
4
4
  import { catalogScope as o, inventoryHash as s, inventoryIo as c } from "./sqlCatalog.js";
5
5
  import { Effect as l } from "effect";
6
6
  import { Schema as u, cmsContext as d, contentTypeToEntities as f, defineContentType as p } from "@voltro/cms";
7
- //#region src/cmsCatalog.ts
7
+ // src/cmsCatalog.ts
8
8
  var m = p({
9
9
  name: "item",
10
10
  displayName: "Game item",
@@ -76,5 +76,4 @@ var m = p({
76
76
  }
77
77
  } });
78
78
  };
79
- //#endregion
80
79
  export { g as cmsCatalogSource, h as inventoryItemContentTables, m as inventoryItemContentType };
@@ -5,7 +5,7 @@ import { inventoryUiCopy as s } from "./inventoryUiCopy.js";
5
5
  import { useId as c, useMemo as l, useRef as u, useState as d } from "react";
6
6
  import { Button as f } from "@voltro/ui-shadcn";
7
7
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
8
- //#region src/components.tsx
8
+ // src/components.tsx
9
9
  var g = (e) => e.copy ?? s[e.locale ?? "en"], _ = "min-h-11 min-w-0 rounded-md border border-input bg-background px-3 text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", v = (e) => {
10
10
  let t = g(e), n = e.item, r = n.content ? e.title(n.content.display.nameKey) : n.instance.itemId;
11
11
  return /* @__PURE__ */ h("article", {
@@ -45,7 +45,7 @@ var g = (e) => e.copy ?? s[e.locale ?? "en"], _ = "min-h-11 min-w-0 rounded-md b
45
45
  "aria-label": `${t.select}: ${r}`,
46
46
  "aria-disabled": e.busy || n.expired || n.instance.locked,
47
47
  onClick: () => {
48
- !e.busy && !n.expired && !n.instance.locked && e.onSelect?.(n.instance.id);
48
+ e.busy || n.expired || n.instance.locked || e.onSelect?.(n.instance.id);
49
49
  },
50
50
  children: t.select
51
51
  }) : null
@@ -317,5 +317,4 @@ var g = (e) => e.copy ?? s[e.locale ?? "en"], _ = "min-h-11 min-w-0 rounded-md b
317
317
  }, `${t.id}:${t.version}`))] })]
318
318
  });
319
319
  };
320
- //#endregion
321
320
  export { S as CraftingPanel, y as InventoryGrid, v as ItemCard, b as LoadoutEditor, i as captureInventoryPresentation, a as inventoryCanEquip, o as inventoryRecipePreview, s as inventoryUiCopy };
package/dist/crafting.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { inventoryError as e } from "./errors.js";
2
2
  import { identifier as t, integer as n, jsonData as r, list as i, object as a } from "./capture.js";
3
3
  import { Context as o } from "effect";
4
- //#region src/crafting.ts
4
+ // src/crafting.ts
5
5
  var s = (o) => {
6
6
  let s = a(o, [
7
7
  "id",
@@ -189,5 +189,4 @@ var s = (o) => {
189
189
  at: n(s.at, 0, 864e13)
190
190
  });
191
191
  };
192
- //#endregion
193
192
  export { d as CraftingPort, p as captureCraftPayment, u as captureCraftPlan, c as defaultCraftResolver, s as defineRecipe, l as resolveCraftPlan, f as resolveCraftingOptions };
@@ -1,7 +1,7 @@
1
1
  import { defineRecipe as e } from "./crafting.js";
2
2
  import { defineItem as t, itemContent as n } from "./item.js";
3
3
  import { Schema as r } from "effect";
4
- //#region src/declarationFixtures.ts
4
+ // src/declarationFixtures.ts
5
5
  var i = () => {
6
6
  let e = t({
7
7
  id: "test.potion",
@@ -62,5 +62,4 @@ var i = () => {
62
62
  excludedIds: Object.freeze([])
63
63
  });
64
64
  };
65
- //#endregion
66
65
  export { a as craftFixture, i as inventoryFixture };
package/dist/errors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Schema as e } from "effect";
2
- //#region src/errors.ts
2
+ // src/errors.ts
3
3
  var t = class extends e.TaggedError()("InventoryError", { code: e.Literals([
4
4
  "invalid_input",
5
5
  "invalid_record",
@@ -18,5 +18,4 @@ var t = class extends e.TaggedError()("InventoryError", { code: e.Literals([
18
18
  "expired",
19
19
  "invalid_slot"
20
20
  ]) }) {}, n = (e) => new t({ code: e });
21
- //#endregion
22
21
  export { t as InventoryError, n as inventoryError };
@@ -7,7 +7,7 @@ import { Effect as c, Layer as l } from "effect";
7
7
  import { systemSubject as u } from "@voltro/protocol";
8
8
  import { ensureTableRegistered as d } from "@voltro/database";
9
9
  import { InMemoryDataStore as f } from "@voltro/runtime";
10
- //#region src/inventoryPort.fixture.ts
10
+ // src/inventoryPort.fixture.ts
11
11
  function p(p) {
12
12
  let m = r(p, [
13
13
  "tenantId",
@@ -62,5 +62,4 @@ function p(p) {
62
62
  }).pipe(c.orDie))), C = l.effectContext(S.pipe(c.flatMap((e) => l.build(e.services))));
63
63
  return Object.freeze({ layer: C });
64
64
  }
65
- //#endregion
66
65
  export { p as inventoryPortFixture };
@@ -4,7 +4,7 @@ import { defineRecipe as o, resolveCraftPlan as s } from "./crafting.js";
4
4
  import { contractKey as c } from "./item.js";
5
5
  import { CatalogItemSchema as l, InventoryInstanceSchema as u, InventoryLoadoutSchema as d } from "./rpc.js";
6
6
  import { Schema as f } from "effect";
7
- //#region src/inventoryPresentation.ts
7
+ // src/inventoryPresentation.ts
8
8
  var p = (e) => n(e, 0, 864e13), m = (o, s, m, h) => {
9
9
  let g = p(h), _ = a(s, ["revision", "items"]), v = t(_.revision), y = Object.freeze(i(_.items, 1e4).map((o) => {
10
10
  let s = a(o, [
@@ -105,5 +105,4 @@ var p = (e) => n(e, 0, 864e13), m = (o, s, m, h) => {
105
105
  })
106
106
  });
107
107
  };
108
- //#endregion
109
108
  export { m as captureInventoryPresentation, h as inventoryCanEquip, g as inventoryRecipePreview };
@@ -9,7 +9,7 @@ import { defaultExpiryPolicy as O, defaultStackPolicy as k, resolveExpiry as A,
9
9
  import { Effect as j, Result as M } from "effect";
10
10
  import { and as N, eq as P, inSet as F, queryFor as I } from "@voltro/database";
11
11
  import { executeSqlMutations as L, prepareSqlMutation as te, prepareSqlMutationGroup as ne } from "@voltro/database/sql";
12
- //#region src/inventoryStore.ts
12
+ // src/inventoryStore.ts
13
13
  var R = (e) => {
14
14
  let i = o(e, [
15
15
  "items",
@@ -1572,5 +1572,4 @@ var R = (e) => {
1572
1572
  rebuildInventory: (e, t, n) => Se(e, t, n, !0)
1573
1573
  });
1574
1574
  };
1575
- //#endregion
1576
1575
  export { V as dataStoreInventory, z as inventoryOwner, R as resolveInventoryOptions };
@@ -1,4 +1,4 @@
1
- //#region src/inventoryUiCopy.ts
1
+ // src/inventoryUiCopy.ts
2
2
  var e = Object.freeze({
3
3
  en: Object.freeze({
4
4
  inventory: "Inventory",
@@ -59,5 +59,4 @@ var e = Object.freeze({
59
59
  quantity: (e) => `Anzahl: ${e}`
60
60
  })
61
61
  });
62
- //#endregion
63
62
  export { e as inventoryUiCopy };
package/dist/item.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { inventoryError as e } from "./errors.js";
2
2
  import { identifier as t, integer as n, jsonData as r, list as i, object as a } from "./capture.js";
3
3
  import { Schema as o } from "effect";
4
- //#region src/item.ts
4
+ // src/item.ts
5
5
  var s = [
6
6
  "consumable",
7
7
  "equipment",
@@ -101,5 +101,4 @@ var s = [
101
101
  if (!i) throw e("invalid_item");
102
102
  return u(i.instanceAttributes, r);
103
103
  };
104
- //#endregion
105
104
  export { s as ITEM_KINDS, p as captureCatalogItem, d as captureItemContracts, l as contractKey, c as defineItem, f as itemContent, m as validateInstanceAttributes };
package/dist/plugin.js CHANGED
@@ -12,7 +12,7 @@ import { dataStoreInventory as T, resolveInventoryOptions as E } from "./invento
12
12
  import { InventoryPort as D } from "./port.js";
13
13
  import { Effect as O, Layer as k } from "effect";
14
14
  import { defineLicensedGamePlugin as A } from "@voltro/plugin-licensing/gate";
15
- //#region src/plugin.ts
15
+ // src/plugin.ts
16
16
  var j = Object.freeze({
17
17
  slots: {
18
18
  stackPolicy: {
@@ -403,5 +403,4 @@ var j = Object.freeze({
403
403
  })
404
404
  };
405
405
  };
406
- //#endregion
407
406
  export { M as inventoryPlugin, j as inventorySystemContract };
package/dist/port.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Context as e } from "effect";
2
- //#region src/port.ts
2
+ // src/port.ts
3
3
  var t = class extends e.Service()("@voltro/InventoryPort") {};
4
- //#endregion
5
4
  export { t as InventoryPort };
@@ -1,6 +1,6 @@
1
1
  import { inventoryError as e } from "./errors.js";
2
2
  import { identifier as t, integer as n, list as r, object as i } from "./capture.js";
3
- //#region src/reservation.ts
3
+ // src/reservation.ts
4
4
  var a = (a) => {
5
5
  let o = r(a, 32).map((e) => {
6
6
  let r = i(e, ["instanceId", "qty"]);
@@ -81,5 +81,4 @@ var a = (a) => {
81
81
  items: a(t.items)
82
82
  });
83
83
  };
84
- //#endregion
85
84
  export { o as captureInventoryReleaseInput, c as captureInventoryReservationTransferInput, s as captureInventoryReserveInput, l as captureInventoryReserveTransferInput, a as captureReservationItems };
package/dist/rpc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { InventoryError as e } from "./errors.js";
2
2
  import { Schema as t } from "effect";
3
3
  import { defineAction as n, defineQuery as r } from "@voltro/protocol";
4
- //#region src/rpc.ts
4
+ // src/rpc.ts
5
5
  var i = "@voltro/plugin-inventory", a = t.Struct({
6
6
  id: t.String,
7
7
  itemId: t.String,
@@ -131,5 +131,4 @@ var i = "@voltro/plugin-inventory", a = t.Struct({
131
131
  }
132
132
  }
133
133
  ];
134
- //#endregion
135
134
  export { c as CatalogItemSchema, l as CatalogSnapshotSchema, i as INVENTORY_NAME, a as InventoryInstanceSchema, o as InventoryLoadoutSchema, s as InventoryReceiptSchema, p as inventoryCatalogDescriptor, m as inventoryEquipDescriptor, f as inventoryLoadoutDescriptor, d as inventoryMineDescriptor, h as inventoryRpcClientImports };
@@ -5,7 +5,7 @@ import { inventoryCatalogHeadsTable as c, inventoryCatalogLocksTable as l, inven
5
5
  import { Effect as p } from "effect";
6
6
  import { and as m, eq as h, queryFor as g } from "@voltro/database";
7
7
  import { createHash as _ } from "node:crypto";
8
- //#region src/sqlCatalog.ts
8
+ // src/sqlCatalog.ts
9
9
  var v = (e) => {
10
10
  let n = 0, r = (e, o) => {
11
11
  if (++n > 3e6 || o > 32) throw t("limit_exceeded");
@@ -181,5 +181,4 @@ var v = (e) => {
181
181
  }
182
182
  });
183
183
  };
184
- //#endregion
185
184
  export { x as catalogScope, S as dataStoreCatalog, v as inventoryHash, b as inventoryIo, y as inventoryKey };
@@ -1,6 +1,6 @@
1
1
  import { inventoryError as e } from "./errors.js";
2
2
  import { integer as t, list as n, object as r } from "./capture.js";
3
- //#region src/strategies.ts
3
+ // src/strategies.ts
4
4
  var i = (e) => {
5
5
  let n = t(e.quantity, 1, 1e6), r = [], i = [];
6
6
  if (e.item.stackable) for (let t of e.available) {
@@ -43,5 +43,4 @@ var i = (e) => {
43
43
  }));
44
44
  return i === null ? null : t(i, r + 1, 864e13);
45
45
  };
46
- //#endregion
47
46
  export { o as defaultExpiryPolicy, i as defaultStackPolicy, s as resolveExpiry, a as resolveStack };
@@ -6,7 +6,7 @@ import { craftFixture as l, inventoryFixture as u } from "./declarationFixtures.
6
6
  import { inventoryPortFixture as d } from "./inventoryPort.fixture.js";
7
7
  import { Effect as f } from "effect";
8
8
  import { systemSubject as p } from "@voltro/protocol";
9
- //#region src/systemFixtures.ts
9
+ // src/systemFixtures.ts
10
10
  var m = u(), h = l(), g = h.at, _ = [...h.available, {
11
11
  ...h.available[0],
12
12
  id: "fixture.second",
@@ -168,5 +168,4 @@ var m = u(), h = l(), g = h.at, _ = [...h.available, {
168
168
  }
169
169
  }
170
170
  });
171
- //#endregion
172
171
  export { w as catalogFakeLayer, T as catalogSourceSystemFixture, x as craftResolverSystemFixture, C as craftingFakeLayer, j as craftingPortSystemFixture, b as expiryPolicySystemFixture, S as inventoryFakeLayer, A as inventoryPortSystemFixture, y as stackPolicySystemFixture };
@@ -1,5 +1,5 @@
1
1
  import { boolean as e, id as t, integer as n, json as r, table as i, text as a, timestamp as o } from "@voltro/database";
2
- //#region src/tables.entity.ts
2
+ // src/tables.entity.ts
3
3
  var s = () => a().maxLength(120).externalId().sensitive("pii"), c = i("_voltro_inv_catalog_locks", {
4
4
  id: t({ prefix: "icl" }),
5
5
  tenantId: s(),
@@ -160,5 +160,4 @@ var s = () => a().maxLength(120).externalId().sensitive("pii"), c = i("_voltro_i
160
160
  ...y,
161
161
  ...x
162
162
  ];
163
- //#endregion
164
163
  export { l as inventoryCatalogHeadsTable, c as inventoryCatalogLocksTable, f as inventoryCatalogRevisionsTable, u as inventoryCatalogTable, v as inventoryCatalogTables, d as inventoryCatalogVersionsTable, m as inventoryItemsTable, g as inventoryLedgerTable, h as inventoryLoadoutsTable, _ as inventoryOperationsTable, y as inventoryOwnedTables, x as inventoryRecipeTables, b as inventoryRecipesTable, p as inventorySubjectsTable, S as inventoryTables };
package/dist/web.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { INVENTORY_NAME as e } from "./rpc.js";
2
2
  import { pluginTag as t } from "@voltro/protocol";
3
3
  import { useAction as n, useSubscription as r } from "@voltro/client";
4
- //#region src/web.ts
4
+ // src/web.ts
5
5
  var i = (n = "app") => r(n, t(e, "mine"), {}), a = (n, i = "app") => r(i, t(e, "loadout"), { slotSet: n }), o = (n = "app") => r(n, t(e, "catalog"), {}), s = (r = "app") => n(r, t(e, "equip"));
6
- //#endregion
7
6
  export { o as useCatalog, i as useInventory, s as useInventoryEquip, a as useLoadout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-inventory",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "Versioned catalogs, SQL-owned item grants and consumption, bounded stacks, equip intentions and privacy fences.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -88,16 +88,16 @@
88
88
  "node": ">=24.0.0"
89
89
  },
90
90
  "dependencies": {
91
- "@voltro/database": "0.87.0",
92
- "@voltro/protocol": "0.87.0",
93
- "@voltro/client": "0.87.0",
94
- "@voltro/cms": "0.87.0",
95
- "@voltro/ui-shadcn": "0.87.0",
96
- "@voltro/runtime": "0.87.0",
97
- "@voltro/plugin-licensing": "0.87.0"
91
+ "@voltro/database": "0.88.0",
92
+ "@voltro/protocol": "0.88.0",
93
+ "@voltro/client": "0.88.0",
94
+ "@voltro/cms": "0.88.0",
95
+ "@voltro/ui-shadcn": "0.88.0",
96
+ "@voltro/runtime": "0.88.0",
97
+ "@voltro/plugin-licensing": "0.88.0"
98
98
  },
99
99
  "peerDependencies": {
100
- "effect": "4.0.1",
100
+ "effect": "4.1.0",
101
101
  "react": "^19.0.0"
102
102
  },
103
103
  "publishConfig": {