@ynput/ayon-frontend-shared 0.5.0 → 0.6.1

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.
Files changed (92) hide show
  1. package/dist/ContextMenu.es.js +34 -16
  2. package/dist/DetailsPanel.es.js +307 -311
  3. package/dist/Feed.es.js +179 -50
  4. package/dist/ListTable.es.js +99 -92
  5. package/dist/NewEntity.es.js +1256 -11
  6. package/dist/ProjectTreeTable.es.js +4459 -2959
  7. package/dist/SimpleTable.es.js +8 -7
  8. package/dist/Slicer.es.js +451 -147
  9. package/dist/Views.es.js +918 -310
  10. package/dist/api.es.js +331 -329
  11. package/dist/chunks/Actions.es.js +32 -27
  12. package/dist/chunks/ColumnDropIndicator.es.js +174 -328
  13. package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
  14. package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
  15. package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
  16. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
  17. package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
  18. package/dist/chunks/DetailsDialog.es.js +3 -3
  19. package/dist/chunks/EmptyPlaceholder.es.js +4 -4
  20. package/dist/chunks/EntityPath.es.js +74 -69
  21. package/dist/chunks/EntityPickerDialog.es.js +25 -21
  22. package/dist/chunks/EntityTooltip.es.js +29 -22
  23. package/dist/chunks/EntityUpdatesContext.es.js +38 -96
  24. package/dist/chunks/Feed.es.js +2321 -2668
  25. package/dist/chunks/FilterErrorActions.es.js +25 -229
  26. package/dist/chunks/Menu.es.js +21 -17
  27. package/dist/chunks/MenuContext.es.js +14 -256
  28. package/dist/chunks/MenuItem.es.js +34 -24
  29. package/dist/chunks/MetaWidget.es.js +2895 -4919
  30. package/dist/chunks/NewEntityContextInstance.es.js +11 -0
  31. package/dist/chunks/PlayableIcon.es.js +4215 -1179
  32. package/dist/chunks/ProjectContext.es.js +102 -66
  33. package/dist/chunks/RepresentationsList.es.js +4 -4
  34. package/dist/chunks/ReviewablesSelector.es.js +468 -460
  35. package/dist/chunks/SimpleForm.es.js +18 -18
  36. package/dist/chunks/SimpleTable.es.js +15 -13
  37. package/dist/chunks/Slicer.es.js +109 -98
  38. package/dist/chunks/TableSettingsFallback.es.js +22 -10
  39. package/dist/chunks/ThumbnailSimple.es.js +290 -52
  40. package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
  41. package/dist/chunks/VideoPlayer.es.js +24 -28
  42. package/dist/chunks/Watchers.es.js +669 -644
  43. package/dist/chunks/entityDefinitions.es.js +2 -350
  44. package/dist/chunks/expandRelativeDates.es.js +27 -0
  45. package/dist/chunks/extractVersionFromFilename.es.js +28 -0
  46. package/dist/chunks/getBundleMode.es.js +1 -1
  47. package/dist/chunks/getUris.es.js +737 -710
  48. package/dist/chunks/queryFilterToClientFilter.es.js +11 -10
  49. package/dist/chunks/searchTerms.es.js +179 -174
  50. package/dist/chunks/useAttributeEnums.es.js +9 -9
  51. package/dist/chunks/useCreateContextMenu.es.js +66 -90
  52. package/dist/chunks/useDateRangeFilter.es.js +3 -3
  53. package/dist/chunks/useHierarchySelection.es.js +24 -0
  54. package/dist/chunks/useLoadModule.es.js +74 -0
  55. package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
  56. package/dist/chunks/versionUploadHelpers.es.js +16 -42
  57. package/dist/chunks/viewUpdateHelper.es.js +74 -57
  58. package/dist/components.es.js +1432 -1001
  59. package/dist/context.es.js +791 -78
  60. package/dist/hooks.es.js +95 -94
  61. package/dist/index.es.js +27 -26
  62. package/dist/types/Actions.d.ts +15 -15
  63. package/dist/types/ContextMenu.d.ts +19 -16
  64. package/dist/types/DetailsPanel.d.ts +110 -17
  65. package/dist/types/EntityPickerDialog.d.ts +15 -15
  66. package/dist/types/Feed.d.ts +19 -16
  67. package/dist/types/ListTable.d.ts +15 -15
  68. package/dist/types/NewEntity.d.ts +24 -18
  69. package/dist/types/ProjectTreeTable.d.ts +34 -123
  70. package/dist/types/RepresentationsList.d.ts +15 -15
  71. package/dist/types/SimpleTable.d.ts +19 -16
  72. package/dist/types/Slicer.d.ts +18 -15
  73. package/dist/types/Views.d.ts +19 -16
  74. package/dist/types/api.d.ts +515 -207
  75. package/dist/types/components.d.ts +84 -20
  76. package/dist/types/context.d.ts +108 -25
  77. package/dist/types/hooks.d.ts +15 -15
  78. package/dist/types/index.d.ts +15 -15
  79. package/dist/types/util.d.ts +20 -15
  80. package/dist/util.es.js +117 -105
  81. package/package.json +16 -4
  82. package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
  83. package/dist/chunks/GlobalContext.es.js +0 -52
  84. package/dist/chunks/NewEntityContext.es.js +0 -1242
  85. package/dist/chunks/ProjectFoldersContext.es.js +0 -134
  86. package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
  87. package/dist/chunks/VersionUploadContext.es.js +0 -232
  88. package/dist/chunks/ViewsContext.es.js +0 -878
  89. package/dist/chunks/mentionTypeOptions.es.js +0 -15
  90. package/dist/chunks/useColumnDragRestriction.es.js +0 -148
  91. package/dist/chunks/useLocalStorage.es.js +0 -355
  92. /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { useMemo as g, useRef as w, useEffect as x } from "react";
2
- import { b0 as G, bg as M, aw as N, ax as C, aW as I, bh as A, bi as O } from "./searchTerms.es.js";
3
- import { W as B, ch as P, cu as q, ao as F, as as Q } from "./getUris.es.js";
2
+ import { b1 as G, bf as M, aw as N, ax as C, aX as I, bg as A, bh as O } from "./searchTerms.es.js";
3
+ import { W as B, ci as P, cv as q, ao as F, as as Q } from "./getUris.es.js";
4
4
  import "primereact/confirmdialog";
5
5
  import { U } from "./MetaWidget.es.js";
6
6
  const z = [], K = 3, H = (s) => {
@@ -11,17 +11,17 @@ const z = [], K = 3, H = (s) => {
11
11
  if (!n) return;
12
12
  const t = /* @__PURE__ */ new Set([n.field]), y = [];
13
13
  for (const T of E ?? []) {
14
- const v = B(T, i);
15
- v && !t.has(v.field) && (t.add(v.field), y.push(v));
14
+ const S = B(T, i);
15
+ S && !t.has(S.field) && (t.add(S.field), y.push(S));
16
16
  }
17
17
  return [n, ...y];
18
18
  }, [n, E, i]), u = !!p || !n, m = s.args.projectName, k = P(
19
19
  { ...s.entity === "task" ? s.args : { projectName: m }, targets: h },
20
20
  { skip: u || s.entity !== "task" }
21
- ), S = q(
21
+ ), v = q(
22
22
  { ...s.entity === "version" ? s.args : { projectName: m }, targets: h },
23
23
  { skip: u || s.entity !== "version" }
24
- ), e = s.entity === "task" ? k : S, r = e.data ?? z, o = !!e.data, { counts: L, total: a, complete: l } = g(() => {
24
+ ), e = s.entity === "task" ? k : v, r = e.data ?? z, o = !!e.data, { counts: L, total: a, complete: l } = g(() => {
25
25
  const t = F(r, n);
26
26
  return t.ungrouped.count > 0 && t.counts.set(U, t.ungrouped), {
27
27
  counts: o && t.counts.size > 0 ? t.counts : void 0,
@@ -58,7 +58,7 @@ const z = [], K = 3, H = (s) => {
58
58
  )?.acceptedParams, f = N(a.data, { projectName: i }, l), d = C(f);
59
59
  o.set(a.name, d), r.has(d) || r.set(d, f);
60
60
  }), { requests: [...r].sort(([a], [l]) => a.localeCompare(l)).map(([, a]) => a), keyByName: o };
61
- }, [s, E, i, p]), { data: k, isError: S } = I(
61
+ }, [s, E, i, p]), { data: k, isError: v } = I(
62
62
  { requests: u },
63
63
  { skip: !u.length || !h }
64
64
  );
@@ -71,8 +71,8 @@ const z = [], K = 3, H = (s) => {
71
71
  enumIsLoading: !1,
72
72
  enumError: o.error ? A(o.error) : void 0,
73
73
  data: { ...e.data, enum: O(o.items) }
74
- } : S ? { ...e, enumIsLoading: !1, enumError: A() } : { ...e, enumIsLoading: !0 };
75
- }) : s, [s, m, k, S]);
74
+ } : v ? { ...e, enumIsLoading: !1, enumError: A() } : { ...e, enumIsLoading: !0 };
75
+ }) : s, [s, m, k, v]);
76
76
  };
77
77
  export {
78
78
  H as a,
@@ -1,56 +1,34 @@
1
- import { jsx as i, jsxs as D } from "react/jsx-runtime";
2
- import { createContext as N, useContext as O, useState as M, useRef as S, useCallback as L, useMemo as R } from "react";
3
- import { Icon as p, ShortcutTag as T } from "@ynput/ayon-react-components";
4
- import j from "clsx";
5
- const w = N(void 0);
6
- function A({ children: t }) {
7
- const [l, n] = M(!1), e = S(null), [o, d] = M([]);
8
- function u(s, c) {
9
- !s || !e.current || !c?.length || (s.preventDefault(), d(c), e.current.show(s));
10
- }
11
- function a() {
12
- e.current && e.current.hide();
13
- }
14
- return /* @__PURE__ */ i(
15
- w.Provider,
16
- {
17
- value: { openContext: u, closeContext: a, ref: e, model: o, isContextOpen: l, setIsContextOpen: n },
18
- children: t
19
- }
20
- );
21
- }
22
- function z() {
23
- const t = O(w);
24
- if (t === void 0)
25
- throw new Error("useContextMenu must be used within a ContextMenuProvider");
26
- return t;
27
- }
28
- const P = ({
29
- icon: t,
30
- iconFilled: l,
1
+ import { jsxs as N, jsx as r } from "react/jsx-runtime";
2
+ import { useCallback as b, useMemo as D } from "react";
3
+ import { Icon as d, ShortcutTag as L } from "@ynput/ayon-react-components";
4
+ import { u as P } from "./ContextMenuContextInstance.es.js";
5
+ import S from "clsx";
6
+ const M = ({
7
+ icon: s,
8
+ iconFilled: i,
31
9
  label: n,
32
10
  shortcut: e,
33
11
  command: o,
34
- children: d,
35
- contextMenuRef: u,
36
- disabled: a,
37
- hidden: s,
38
- items: c,
39
- isSave: x,
40
- danger: m,
41
- developer: f,
42
- powerFeature: r,
12
+ children: f,
13
+ contextMenuRef: c,
14
+ disabled: m,
15
+ hidden: u,
16
+ items: p,
17
+ isSave: h,
18
+ danger: l,
19
+ developer: a,
20
+ powerFeature: t,
43
21
  // if the feature requires a Powerpack license
44
- powerLicense: C,
22
+ powerLicense: x,
45
23
  // if the user has a Powerpack license
46
- onPowerClick: h,
24
+ onPowerClick: g,
47
25
  // callback to handle when they do not have a license and click the power feature
48
- ...g
26
+ ...C
49
27
  }) => {
50
- if (s) return null;
51
- const I = (v) => {
52
- if (u.current?.hide(), v.preventDefault(), r && !C && h) {
53
- h(r);
28
+ if (u) return null;
29
+ const w = (v) => {
30
+ if (c.current?.hide(), v.preventDefault(), t && !x && g) {
31
+ g(t);
54
32
  return;
55
33
  }
56
34
  o?.({
@@ -62,26 +40,26 @@ const P = ({
62
40
  shortcut: e
63
41
  }
64
42
  });
65
- }, b = c && c.length === 0, y = r && !C;
66
- return /* @__PURE__ */ D(
43
+ }, y = p && p.length === 0, I = t && !x;
44
+ return /* @__PURE__ */ N(
67
45
  "a",
68
46
  {
69
- className: j("p-menuitem-link", {
70
- "p-disabled": a || b,
71
- danger: m,
72
- developer: f,
73
- save: x
47
+ className: S("p-menuitem-link", {
48
+ "p-disabled": m || y,
49
+ danger: l,
50
+ developer: a,
51
+ save: h
74
52
  }),
75
53
  role: "menuitem",
76
54
  href: "#",
77
- onClick: I,
55
+ onClick: w,
78
56
  style: {
79
- ...g?.style
57
+ ...C?.style
80
58
  },
81
- ...g,
59
+ ...C,
82
60
  children: [
83
- t && /* @__PURE__ */ i(p, { className: "p-menuitem-icon", icon: t, filled: l }),
84
- n && /* @__PURE__ */ i(
61
+ s && /* @__PURE__ */ r(d, { className: "p-menuitem-icon", icon: s, filled: i }),
62
+ n && /* @__PURE__ */ r(
85
63
  "span",
86
64
  {
87
65
  className: "p-menuitem-text",
@@ -91,10 +69,10 @@ const P = ({
91
69
  children: n
92
70
  }
93
71
  ),
94
- d,
95
- e && /* @__PURE__ */ i("div", { className: "p-menuitem-shortcut", children: /* @__PURE__ */ i(T, { children: e }) }),
96
- y && /* @__PURE__ */ i(
97
- p,
72
+ f,
73
+ e && /* @__PURE__ */ r("div", { className: "p-menuitem-shortcut", children: /* @__PURE__ */ r(L, { children: e }) }),
74
+ I && /* @__PURE__ */ r(
75
+ d,
98
76
  {
99
77
  icon: "bolt",
100
78
  style: {
@@ -104,8 +82,8 @@ const P = ({
104
82
  }
105
83
  }
106
84
  ),
107
- !!c?.length && /* @__PURE__ */ i(
108
- p,
85
+ !!p?.length && /* @__PURE__ */ r(
86
+ d,
109
87
  {
110
88
  icon: "chevron_right",
111
89
  style: {
@@ -117,13 +95,13 @@ const P = ({
117
95
  ]
118
96
  }
119
97
  );
120
- }, k = (t, l, n) => t.map((e) => {
98
+ }, k = (s, i, n) => s.map((e) => {
121
99
  const o = {
122
100
  ...e,
123
- template: /* @__PURE__ */ i(
124
- P,
101
+ template: /* @__PURE__ */ r(
102
+ M,
125
103
  {
126
- contextMenuRef: l,
104
+ contextMenuRef: i,
127
105
  ...e,
128
106
  powerLicense: n.powerLicense,
129
107
  onPowerClick: n.setPowerpackDialog
@@ -131,32 +109,30 @@ const P = ({
131
109
  e.label
132
110
  )
133
111
  };
134
- return o.items && (o.items = k(o.items, l, n)), o;
135
- }), G = (t = [], l) => {
136
- const { openContext: n, ref: e, isContextOpen: o, closeContext: d } = z(), { powerLicense: u, setPowerpackDialog: a } = l || {}, s = L(
137
- (m, f) => m.filter(Boolean).map((r) => ({
138
- template: /* @__PURE__ */ i(
139
- P,
112
+ return o.items && (o.items = k(o.items, i, n)), o;
113
+ }), B = (s = [], i) => {
114
+ const { openContext: n, ref: e, isContextOpen: o, closeContext: f } = P(), { powerLicense: c, setPowerpackDialog: m } = i || {}, u = b(
115
+ (l, a) => l.filter(Boolean).map((t) => ({
116
+ template: /* @__PURE__ */ r(
117
+ M,
140
118
  {
141
- contextMenuRef: f,
142
- ...r,
143
- powerLicense: u,
144
- onPowerClick: a
119
+ contextMenuRef: a,
120
+ ...t,
121
+ powerLicense: c,
122
+ onPowerClick: m
145
123
  },
146
- r.label
124
+ t.label
147
125
  ),
148
- items: r.items?.length ? k(r.items, f, { powerLicense: u, setPowerpackDialog: a }) : void 0
126
+ items: t.items?.length ? k(t.items, a, { powerLicense: c, setPowerpackDialog: m }) : void 0
149
127
  })),
150
- [u, a]
151
- ), c = R(() => s(t, e), [t, e, s]);
152
- return [(m, f) => {
153
- if (!m || !e.current) return console.error("No ref or event passed to openContext");
154
- let r;
155
- f && (r = s(f, e)), m.preventDefault(), n(m, r || c);
156
- }, d, o, e];
128
+ [c, m]
129
+ ), p = D(() => u(s, e), [s, e, u]);
130
+ return [(l, a) => {
131
+ if (!l || !e.current) return console.error("No ref or event passed to openContext");
132
+ let t;
133
+ a && (t = u(a, e)), l.preventDefault(), n(l, t || p);
134
+ }, f, o, e];
157
135
  };
158
136
  export {
159
- A as C,
160
- G as a,
161
- z as u
137
+ B as u
162
138
  };
@@ -1,5 +1,5 @@
1
1
  import { useState as h } from "react";
2
- import { C as b, d as F, b as D } from "./PlayableIcon.es.js";
2
+ import { C as F, d as b, a as D } from "./PlayableIcon.es.js";
3
3
  import { startOfDay as v, parse as m, endOfDay as R, format as l } from "date-fns";
4
4
  const V = () => {
5
5
  const [d, y] = h(null), [f, u] = h(""), [g, c] = h(""), p = (r, o) => {
@@ -52,7 +52,7 @@ const V = () => {
52
52
  const s = a.id.replace("custom-", ""), i = s.indexOf("Z");
53
53
  if (i > 0) {
54
54
  const M = s.substring(0, i + 1), S = s.substring(i + 2);
55
- if (F(M, S)) return;
55
+ if (b(M, S)) return;
56
56
  }
57
57
  }
58
58
  r.stopPropagation(), p(t.id, o);
@@ -61,7 +61,7 @@ const V = () => {
61
61
  handleDropdownItemClick: (r, o, e) => {
62
62
  const n = r.target.closest("li");
63
63
  if (!n) return !0;
64
- if (n.querySelector(`span[icon="${b}"]`)) {
64
+ if (n.querySelector(`span[icon="${F}"]`)) {
65
65
  const t = n.getAttribute("data-parent") || I(o, e);
66
66
  return t && p(t, o), !1;
67
67
  }
@@ -0,0 +1,24 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "@module-federation/enhanced/runtime";
4
+ import "./searchTerms.es.js";
5
+ import "./getUris.es.js";
6
+ import "primereact/confirmdialog";
7
+ import { a as o } from "./DeleteEntitiesContextInstance.es.js";
8
+ import "lodash";
9
+ import "react-toastify";
10
+ import "uuid";
11
+ import "semver";
12
+ import "@ynput/ayon-react-components";
13
+ import "./ContextMenuContextInstance.es.js";
14
+ import "clsx";
15
+ import "react-dom";
16
+ import "react-redux";
17
+ import { u as t } from "./MetaWidget.es.js";
18
+ const g = () => {
19
+ const i = t(), { powerLicense: e } = o();
20
+ return i ? (e ? i.slices : i.slices?.slice(0, 1))?.some((r) => r.sliceType === "hierarchy") ? i.getPanelSelection("hierarchy") : i.pinnedSlice?.rowSelection ?? null : null;
21
+ };
22
+ export {
23
+ g as u
24
+ };
@@ -0,0 +1,74 @@
1
+ import "react/jsx-runtime";
2
+ import { useState as f, useRef as R, useEffect as z } from "react";
3
+ import { loadRemote as I } from "@module-federation/enhanced/runtime";
4
+ import "./searchTerms.es.js";
5
+ import "./getUris.es.js";
6
+ import "primereact/confirmdialog";
7
+ import { b as M } from "./DeleteEntitiesContextInstance.es.js";
8
+ import "lodash";
9
+ import "react-toastify";
10
+ import "uuid";
11
+ import q from "semver";
12
+ import "@ynput/ayon-react-components";
13
+ import "./ContextMenuContextInstance.es.js";
14
+ import "clsx";
15
+ import "react-dom";
16
+ import "react-redux";
17
+ const G = ({
18
+ addon: o,
19
+ remote: t,
20
+ module: e,
21
+ fallback: g,
22
+ minVersion: s,
23
+ skip: u = !1
24
+ }) => {
25
+ const { remotesInitialized: l, modules: a } = M(), [L, r] = f(!0), [d, c] = f(!1), [v, m] = f(!1), p = R(g);
26
+ return z(() => {
27
+ if (u) {
28
+ r(!1), c(!0);
29
+ return;
30
+ }
31
+ if (!l || !o || !t || !e) return;
32
+ const i = a.find((n) => n.addonName === o);
33
+ if (!i) {
34
+ console.log("remote not found", { addon: o, remote: t, module: e }), r(!1);
35
+ return;
36
+ }
37
+ if (s && !q.gte(i.addonVersion, s) && s + "-dev" !== i.addonVersion) {
38
+ console.log("remote version does not meet minimum requirement", {
39
+ addon: o,
40
+ remote: t,
41
+ module: e,
42
+ current: i.addonVersion,
43
+ required: s
44
+ }), m(!0), r(!1);
45
+ return;
46
+ }
47
+ if (m(!1), !i.modules[t])
48
+ return r(!1), console.log("module not found", { addon: o, remote: t, module: e });
49
+ if (d === e) {
50
+ r(!1);
51
+ return;
52
+ }
53
+ I(`${t}/${e}`, {
54
+ from: "runtime"
55
+ }).then((n) => {
56
+ c(e), r(!1), n && (p.current = n.default);
57
+ }).catch((n) => {
58
+ r(!1), console.error("error loading remote", t, e, n);
59
+ });
60
+ }, [d, l, a, o, t, e, s, u]), [
61
+ p.current,
62
+ {
63
+ isLoaded: d === e,
64
+ isLoading: L,
65
+ outdated: v ? {
66
+ current: a.find((i) => i.addonName === o)?.addonVersion || "unknown",
67
+ required: s?.replace("-dev", "") || "unknown"
68
+ } : void 0
69
+ }
70
+ ];
71
+ };
72
+ export {
73
+ G as u
74
+ };
@@ -0,0 +1,11 @@
1
+ import { useRef as a, useState as c, useEffect as f } from "react";
2
+ const g = (e, n) => {
3
+ const o = a(null), [u, r] = c(!1);
4
+ return f(() => {
5
+ const t = o.current;
6
+ !t || Object.keys(e).some((s) => t[s] !== e[s]) || Object.keys(t).some((s) => t[s] !== e[s]) ? (o.current = { ...e }, r(n)) : n || r(!1);
7
+ }, [Object.values(e).join(","), n]), u;
8
+ };
9
+ export {
10
+ g as u
11
+ };
@@ -1,37 +1,12 @@
1
1
  import { toast as i } from "react-toastify";
2
2
  import { camelCase as c } from "lodash";
3
- function h(r) {
4
- const t = r.replace(/\.[^/.]+$/, ""), a = [
5
- // Pattern: file_v001, file_v1, file_v01 (with 'v' prefix)
6
- /.*[_\-\s]v(\d+)(?:[_\-\s].*|$)/i,
7
- // Pattern: file_001, file_01, file_1 (at end of filename)
8
- /.*[_\-\s](\d+)$/,
9
- // Pattern: file_001_name, file_1_description (version in middle)
10
- /.*[_\-\s](\d{2,})(?:[_\-\s].*)/,
11
- // Pattern: 001_file, 1_file (at start of filename)
12
- /^(\d+)[_\-\s]/,
13
- // Pattern: fileV1, fileV001 (no separator)
14
- /.*v(\d+)$/i,
15
- // Pattern: file1, file001 (number at end, no separator)
16
- /.*?(\d{2,})$/
17
- ];
18
- for (const e of a) {
19
- const o = t.match(e);
20
- if (o) {
21
- const n = o[1], s = parseInt(n, 10);
22
- if (!isNaN(s) && s > 0)
23
- return s;
24
- }
25
- }
26
- return null;
27
- }
28
- const v = (r) => c(r).replace(/[^a-zA-Z0-9_-]/g, ""), d = (r) => !r || r.trim() === "" ? { isValid: !1, error: "Name is required" } : /^[a-zA-Z0-9_]([a-zA-Z0-9_\\.\\-]*[a-zA-Z0-9_])?$/.test(r) ? { isValid: !0 } : {
3
+ const w = (r) => c(r).replace(/[^a-zA-Z0-9_-]/g, ""), d = (r) => !r || r.trim() === "" ? { isValid: !1, error: "Name is required" } : /^[a-zA-Z0-9_]([a-zA-Z0-9_\\.\\-]*[a-zA-Z0-9_])?$/.test(r) ? { isValid: !0 } : {
29
4
  isValid: !1,
30
5
  error: "Product name can only contain alphanumeric characters, underscores, dots, and dashes, and must not start or end with a dot or dash"
31
6
  }, u = (r, t) => r < 1 ? { isValid: !1, error: "Version must be greater than 0" } : t != null && r <= t ? {
32
7
  isValid: !1,
33
8
  error: `Version must be greater than ${t}`
34
- } : { isValid: !0 }, w = (r, t, a = !0) => {
9
+ } : { isValid: !0 }, f = (r, t, a = !0) => {
35
10
  const e = u(r.version, t);
36
11
  if (!e.isValid)
37
12
  return e;
@@ -66,28 +41,27 @@ const v = (r) => c(r).replace(/[^a-zA-Z0-9_-]/g, ""), d = (r) => !r || r.trim()
66
41
  throw console.error("Error creating version:", e), new Error(e.message || "Failed to create version");
67
42
  }
68
43
  }, V = async (r, t, a, e, o) => {
69
- const n = await l(r, a, e), s = await m(t, a, {
44
+ const s = await l(r, a, e), n = await m(t, a, {
70
45
  ...o,
71
- productId: n.id
46
+ productId: s.id
72
47
  });
73
48
  return {
74
- product: n,
75
- version: s
49
+ product: s,
50
+ version: n
76
51
  };
77
- }, g = (r, t) => {
52
+ }, v = (r, t) => {
78
53
  console.error(`Error ${t}:`, r);
79
54
  const a = r?.message || `Failed to ${t}`;
80
55
  throw i.error(a), r;
81
- }, _ = (r) => r ? r.version + 1 : 1;
56
+ }, g = (r) => r ? r.version + 1 : 1;
82
57
  export {
83
- V as a,
84
- l as b,
85
- m as c,
58
+ l as a,
59
+ m as b,
60
+ V as c,
86
61
  d,
87
- h as e,
88
- u as f,
89
- _ as g,
90
- g as h,
91
- v as s,
92
- w as v
62
+ u as e,
63
+ g,
64
+ v as h,
65
+ w as s,
66
+ f as v
93
67
  };