@animaapp/anima-sdk 0.4.3 → 0.4.4
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +173 -163
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var xr = Object.defineProperty, kr = Object.defineProperties;
|
|
2
2
|
var Tr = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Pt = Object.getOwnPropertySymbols;
|
|
4
|
-
var Sr = Object.prototype.hasOwnProperty,
|
|
4
|
+
var Sr = Object.prototype.hasOwnProperty, Ar = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Ft = (r) => {
|
|
6
6
|
throw TypeError(r);
|
|
7
7
|
};
|
|
@@ -10,7 +10,7 @@ var $t = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writ
|
|
|
10
10
|
Sr.call(e, t) && $t(r, t, e[t]);
|
|
11
11
|
if (Pt)
|
|
12
12
|
for (var t of Pt(e))
|
|
13
|
-
|
|
13
|
+
Ar.call(e, t) && $t(r, t, e[t]);
|
|
14
14
|
return r;
|
|
15
15
|
}, g = (r, e) => kr(r, Tr(e));
|
|
16
16
|
var lt = (r, e, t) => e.has(r) || Ft("Cannot " + t);
|
|
@@ -42,7 +42,7 @@ class oe extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Xt = "Figma Token Issue";
|
|
45
|
-
class
|
|
45
|
+
class Er extends Error {
|
|
46
46
|
constructor({
|
|
47
47
|
fileKey: e,
|
|
48
48
|
reason: t,
|
|
@@ -64,12 +64,12 @@ class Or extends Error {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
const er = "Not Found";
|
|
67
|
-
class
|
|
67
|
+
class Nr extends Error {
|
|
68
68
|
constructor({ fileKey: e, cause: t }) {
|
|
69
69
|
super(er), this.fileKey = e, this.cause = t;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const Ir = (r) => r.message === er, tr = "Unknown Figma API Exception";
|
|
73
73
|
class jr extends Error {
|
|
74
74
|
constructor({ fileKey: e, cause: t }) {
|
|
75
75
|
super(tr), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
@@ -85,7 +85,7 @@ const Gn = (r) => r.message === tr, Rr = (r) => r.message === Yt, Zr = (r) => [X
|
|
|
85
85
|
if (((s = r == null ? void 0 : r.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
86
86
|
const { err: n, status: a } = r.cause.body;
|
|
87
87
|
if (a === 403)
|
|
88
|
-
return new
|
|
88
|
+
return new Er({
|
|
89
89
|
fileKey: e,
|
|
90
90
|
reason: n,
|
|
91
91
|
cause: r
|
|
@@ -93,22 +93,22 @@ const Gn = (r) => r.message === tr, Rr = (r) => r.message === Yt, Zr = (r) => [X
|
|
|
93
93
|
if (a === 429)
|
|
94
94
|
return new Cr({ fileKey: e, cause: r });
|
|
95
95
|
if (a === 404)
|
|
96
|
-
return new
|
|
96
|
+
return new Nr({ fileKey: e, cause: r });
|
|
97
97
|
if (a === 400 && n.includes("Request too large"))
|
|
98
98
|
return new Or({ fileKey: e, cause: r });
|
|
99
99
|
}
|
|
100
100
|
return new jr({ fileKey: e, cause: r });
|
|
101
|
-
}, Kn = (r) =>
|
|
102
|
-
var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Lt = Object.getOwnPropertySymbols, Lr = Object.prototype.hasOwnProperty,
|
|
101
|
+
}, Kn = (r) => Ir(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
|
|
102
|
+
var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Lt = Object.getOwnPropertySymbols, Lr = Object.prototype.hasOwnProperty, Vr = Object.prototype.propertyIsEnumerable, Vt = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), sr = (r) => {
|
|
103
103
|
throw TypeError(r);
|
|
104
|
-
},
|
|
104
|
+
}, Dt = (r, e, t) => e in r ? Pr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
|
|
105
105
|
for (var t in e || (e = {}))
|
|
106
|
-
Lr.call(e, t) &&
|
|
106
|
+
Lr.call(e, t) && Dt(r, t, e[t]);
|
|
107
107
|
if (Lt)
|
|
108
108
|
for (var t of Lt(e))
|
|
109
|
-
|
|
109
|
+
Vr.call(e, t) && Dt(r, t, e[t]);
|
|
110
110
|
return r;
|
|
111
|
-
},
|
|
111
|
+
}, It = (r, e) => $r(r, Fr(e)), jt = (r, e, t) => e.has(r) || sr("Cannot " + t), T = (r, e, t) => (jt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? sr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), I = (r, e, t, s) => (jt(r, e, "write to private field"), e.set(r, t), t), X = (r, e, t) => (jt(r, e, "access private method"), t), E = (r, e, t) => new Promise((s, n) => {
|
|
112
112
|
var a = (c) => {
|
|
113
113
|
try {
|
|
114
114
|
o(t.next(c));
|
|
@@ -123,7 +123,7 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
|
|
|
123
123
|
}
|
|
124
124
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
125
125
|
o((t = t.apply(r, e)).next());
|
|
126
|
-
}),
|
|
126
|
+
}), Dr = (r, e, t) => (e = r[Vt("asyncIterator")]) ? e.call(r) : (r = r[Vt("iterator")](), e = {}, t = (s, n) => (n = r[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = n.call(r, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Ur = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
127
127
|
function zr(r) {
|
|
128
128
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
129
129
|
}
|
|
@@ -167,8 +167,8 @@ function Br() {
|
|
|
167
167
|
var Mt = v && b[Symbol.toStringTag];
|
|
168
168
|
if (typeof Mt == "string")
|
|
169
169
|
return Mt;
|
|
170
|
-
var
|
|
171
|
-
return
|
|
170
|
+
var D = Object.getPrototypeOf(b);
|
|
171
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : u && D === DataView.prototype ? "DataView" : a && D === W ? "Map Iterator" : i && D === L ? "Set Iterator" : te && D === he ? "Array Iterator" : ie && D === Z ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(b).slice(M, Oe);
|
|
172
172
|
}
|
|
173
173
|
return we;
|
|
174
174
|
});
|
|
@@ -384,7 +384,7 @@ function _t(r, e = null, t = ps) {
|
|
|
384
384
|
}
|
|
385
385
|
return n ? n(r, s) : r;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function Ne(r, e = {}) {
|
|
388
388
|
typeof e == "function" && (e = {
|
|
389
389
|
customizer: e
|
|
390
390
|
});
|
|
@@ -442,14 +442,14 @@ const ms = (r) => new Promise((e) => setTimeout(e, r));
|
|
|
442
442
|
var Qe, pe, et, wt, nr;
|
|
443
443
|
class gs {
|
|
444
444
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
445
|
-
B(this, wt), B(this, Qe), B(this, pe), B(this, et),
|
|
445
|
+
B(this, wt), B(this, Qe), B(this, pe), B(this, et), I(this, Qe, e), I(this, et, t), I(this, pe, 0);
|
|
446
446
|
}
|
|
447
447
|
run() {
|
|
448
|
-
return
|
|
448
|
+
return E(this, null, function* () {
|
|
449
449
|
try {
|
|
450
450
|
return yield T(this, et).call(this);
|
|
451
451
|
} catch (e) {
|
|
452
|
-
if (
|
|
452
|
+
if (I(this, pe, T(this, pe) + 1), T(this, pe) > T(this, Qe))
|
|
453
453
|
throw console.error("Max attempts reached"), e;
|
|
454
454
|
const t = X(this, wt, nr).call(this);
|
|
455
455
|
return yield ms(t), yield this.run();
|
|
@@ -464,10 +464,10 @@ function ys() {
|
|
|
464
464
|
return typeof CompressionStream != "undefined";
|
|
465
465
|
}
|
|
466
466
|
function vs(r) {
|
|
467
|
-
return
|
|
467
|
+
return E(this, null, function* () {
|
|
468
468
|
const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
469
469
|
try {
|
|
470
|
-
for (var s =
|
|
470
|
+
for (var s = Dr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
|
|
471
471
|
const o = a.value;
|
|
472
472
|
t.push(o);
|
|
473
473
|
}
|
|
@@ -485,7 +485,7 @@ function vs(r) {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
function _s(r) {
|
|
488
|
-
return
|
|
488
|
+
return E(this, null, function* () {
|
|
489
489
|
const e = yield new Blob(r).arrayBuffer();
|
|
490
490
|
return new Uint8Array(e);
|
|
491
491
|
});
|
|
@@ -523,7 +523,7 @@ class Bt extends Error {
|
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
class
|
|
526
|
+
class Ie extends Error {
|
|
527
527
|
constructor(e = {}) {
|
|
528
528
|
const { canceled: t = !1 } = e;
|
|
529
529
|
super("Abort Error"), this.name = "Abort Error", this.canceled = t;
|
|
@@ -549,10 +549,10 @@ function xt() {
|
|
|
549
549
|
return Math.floor(Date.now() / 1e3).toString();
|
|
550
550
|
}
|
|
551
551
|
const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
|
|
552
|
-
var me,
|
|
552
|
+
var me, V, G, kt, Tt, je;
|
|
553
553
|
class Ts {
|
|
554
554
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
555
|
-
B(this, G), B(this, me), B(this,
|
|
555
|
+
B(this, G), B(this, me), B(this, V), this.baseAddress = t, I(this, me, e), I(this, V, {}), this.plugins = [];
|
|
556
556
|
}
|
|
557
557
|
get headers() {
|
|
558
558
|
throw new Error("Missing implementation");
|
|
@@ -564,54 +564,54 @@ class Ts {
|
|
|
564
564
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
565
565
|
}
|
|
566
566
|
withOptions(e = {}) {
|
|
567
|
-
return
|
|
567
|
+
return I(this, V, e), this;
|
|
568
568
|
}
|
|
569
569
|
get(e) {
|
|
570
|
-
return
|
|
570
|
+
return E(this, arguments, function* (t, s = {}) {
|
|
571
571
|
const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
|
|
572
572
|
let o = a != null ? a : this.headers;
|
|
573
|
-
const c =
|
|
574
|
-
return
|
|
573
|
+
const c = Ne(T(this, V));
|
|
574
|
+
return I(this, V, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = It(U({}, o), { "X-Request-Nonce": ar(), "X-Request-Timestamp": xt() })), c.async ? yield X(this, G, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield X(this, G, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
575
575
|
});
|
|
576
576
|
}
|
|
577
577
|
post(e, t) {
|
|
578
|
-
return
|
|
579
|
-
const i =
|
|
580
|
-
return
|
|
578
|
+
return E(this, arguments, function* (s, n, a = {}) {
|
|
579
|
+
const i = Ne(T(this, V));
|
|
580
|
+
return I(this, V, {}), X(this, G, je).call(this, s, "POST", n, a, i);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
put(e, t) {
|
|
584
|
-
return
|
|
585
|
-
const i =
|
|
586
|
-
return
|
|
584
|
+
return E(this, arguments, function* (s, n, a = {}) {
|
|
585
|
+
const i = Ne(T(this, V));
|
|
586
|
+
return I(this, V, {}), X(this, G, je).call(this, s, "PUT", n, a, i);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
delete(e, t) {
|
|
590
|
-
return
|
|
591
|
-
const i =
|
|
592
|
-
return
|
|
590
|
+
return E(this, arguments, function* (s, n, a = {}) {
|
|
591
|
+
const i = Ne(T(this, V));
|
|
592
|
+
return I(this, V, {}), X(this, G, je).call(this, s, "DELETE", n, a, i);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
patch(e, t) {
|
|
596
|
-
return
|
|
597
|
-
const i =
|
|
598
|
-
return
|
|
596
|
+
return E(this, arguments, function* (s, n, a = {}) {
|
|
597
|
+
const i = Ne(T(this, V));
|
|
598
|
+
return I(this, V, {}), X(this, G, je).call(this, s, "PATCH", n, a, i);
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
me = /* @__PURE__ */ new WeakMap(),
|
|
603
|
-
return
|
|
604
|
-
const s = () =>
|
|
602
|
+
me = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), kt = function(r, e, t) {
|
|
603
|
+
return E(this, null, function* () {
|
|
604
|
+
const s = () => E(this, null, function* () {
|
|
605
605
|
var c, u;
|
|
606
606
|
try {
|
|
607
607
|
return yield T(this, me).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
608
608
|
} catch (f) {
|
|
609
|
-
throw f instanceof Error && f.name === "AbortError" ? new
|
|
609
|
+
throw f instanceof Error && f.name === "AbortError" ? new Ie({ canceled: (u = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? u : !1 }) : f;
|
|
610
610
|
}
|
|
611
611
|
}), { headers: n } = t != null ? t : {}, a = (c, u) => {
|
|
612
612
|
var f, v;
|
|
613
613
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[u]) || "";
|
|
614
|
-
}, i = (c) =>
|
|
614
|
+
}, i = (c) => E(this, null, function* () {
|
|
615
615
|
var u;
|
|
616
616
|
if (!c.ok) {
|
|
617
617
|
const v = yield c.text().catch();
|
|
@@ -654,7 +654,7 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
654
654
|
return yield i(o);
|
|
655
655
|
});
|
|
656
656
|
}, Tt = function(r, e, t) {
|
|
657
|
-
return
|
|
657
|
+
return E(this, null, function* () {
|
|
658
658
|
var s, n;
|
|
659
659
|
const {
|
|
660
660
|
onProgress: a,
|
|
@@ -666,7 +666,7 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
666
666
|
try {
|
|
667
667
|
v = yield T(this, me).call(this, u, U(U({}, t), i && { signal: i }));
|
|
668
668
|
} catch (L) {
|
|
669
|
-
throw L instanceof Error && L.name === "AbortError" ? new
|
|
669
|
+
throw L instanceof Error && L.name === "AbortError" ? new Ie({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : L;
|
|
670
670
|
}
|
|
671
671
|
if (!v.ok) {
|
|
672
672
|
const L = yield v.text().catch();
|
|
@@ -682,15 +682,15 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
682
682
|
const O = yield v.json(), { job_id: R } = O;
|
|
683
683
|
if (!R)
|
|
684
684
|
throw new Error("Job ID not found in response");
|
|
685
|
-
return new Promise((L, W) =>
|
|
685
|
+
return new Promise((L, W) => E(this, null, function* () {
|
|
686
686
|
const te = setTimeout(() => {
|
|
687
687
|
W(new Error("Job timed out"));
|
|
688
|
-
}, c), he = (ie = 0) =>
|
|
688
|
+
}, c), he = (ie = 0) => E(this, null, function* () {
|
|
689
689
|
if (i != null && i.aborted) {
|
|
690
690
|
clearTimeout(te), T(this, me).call(this, `${f}/${R}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
691
|
-
W(new
|
|
691
|
+
W(new Ie({ canceled: !0 }));
|
|
692
692
|
}).catch((Z) => {
|
|
693
|
-
W(new
|
|
693
|
+
W(new Ie({ canceled: !1 }));
|
|
694
694
|
});
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
@@ -715,10 +715,10 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
715
715
|
}));
|
|
716
716
|
});
|
|
717
717
|
}, je = function(r, e, t, s, n) {
|
|
718
|
-
return
|
|
718
|
+
return E(this, null, function* () {
|
|
719
719
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
720
720
|
let c = i != null ? i : this.headers;
|
|
721
|
-
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c =
|
|
721
|
+
n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = It(U({}, c), { "X-Request-Nonce": ar(), "X-Request-Timestamp": xt() }));
|
|
722
722
|
let u = t;
|
|
723
723
|
return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (u = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", u = yield vs(u))), n.async ? yield X(this, G, Tt).call(this, `${o}${r}`, n.async, {
|
|
724
724
|
method: e,
|
|
@@ -727,7 +727,7 @@ me = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), G = /* @_
|
|
|
727
727
|
}) : yield X(this, G, kt).call(this, `${o}${r}`, n, { method: e, headers: c, body: u });
|
|
728
728
|
});
|
|
729
729
|
};
|
|
730
|
-
const qt = (r, e, t, s) => r instanceof
|
|
730
|
+
const qt = (r, e, t, s) => r instanceof Ie ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), mt = (r, e) => new Proxy(e, {
|
|
731
731
|
get(t, s) {
|
|
732
732
|
return (...n) => {
|
|
733
733
|
var a;
|
|
@@ -751,10 +751,10 @@ const qt = (r, e, t, s) => r instanceof Ne ? r : new bs({ resource: e, api: Stri
|
|
|
751
751
|
var Re;
|
|
752
752
|
class Ss {
|
|
753
753
|
constructor(e) {
|
|
754
|
-
B(this, Re), this.resourceName = "Files",
|
|
754
|
+
B(this, Re), this.resourceName = "Files", I(this, Re, e);
|
|
755
755
|
}
|
|
756
756
|
get(e) {
|
|
757
|
-
return
|
|
757
|
+
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
758
758
|
const n = new URLSearchParams(U({
|
|
759
759
|
plugin_data: "857346721138427857"
|
|
760
760
|
}, s)).toString(), a = `v1/files/${t}?${n}`;
|
|
@@ -762,7 +762,7 @@ class Ss {
|
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
getImageFills(e) {
|
|
765
|
-
return
|
|
765
|
+
return E(this, arguments, function* ({ fileKey: t }) {
|
|
766
766
|
var s, n;
|
|
767
767
|
const a = `v1/files/${t}/images`;
|
|
768
768
|
return (n = (s = (yield T(this, Re).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
|
|
@@ -770,23 +770,23 @@ class Ss {
|
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
772
|
Re = /* @__PURE__ */ new WeakMap();
|
|
773
|
-
const
|
|
773
|
+
const As = (r, e, t) => {
|
|
774
774
|
const s = e.sort();
|
|
775
775
|
return `${r}-${s.join("-")}-${t}`;
|
|
776
|
-
},
|
|
776
|
+
}, Es = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
|
|
777
777
|
var K, St, ir;
|
|
778
778
|
class Cs {
|
|
779
779
|
constructor(e) {
|
|
780
|
-
B(this, St), B(this, K), this.resourceName = "Images",
|
|
780
|
+
B(this, St), B(this, K), this.resourceName = "Images", I(this, K, e);
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
783
783
|
* Return the URL for the _layer_ images for the given nodes.
|
|
784
784
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
785
785
|
*/
|
|
786
786
|
get(e) {
|
|
787
|
-
return
|
|
788
|
-
const i =
|
|
789
|
-
if (
|
|
787
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
|
|
788
|
+
const i = As(t, s, n), o = T(this, K).cache.images.entries.get(i);
|
|
789
|
+
if (Es(o))
|
|
790
790
|
return o.result;
|
|
791
791
|
o && T(this, K).cache.images.entries.delete(i);
|
|
792
792
|
const c = T(this, K).cache.images.pendingRequests.get(i);
|
|
@@ -803,7 +803,7 @@ class Cs {
|
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
805
|
K = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ir = function(r, e, t, s, n) {
|
|
806
|
-
return
|
|
806
|
+
return E(this, null, function* () {
|
|
807
807
|
const a = yield T(this, K).get(
|
|
808
808
|
`v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
|
|
809
809
|
);
|
|
@@ -816,11 +816,11 @@ K = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ir = func
|
|
|
816
816
|
var tt;
|
|
817
817
|
class Os {
|
|
818
818
|
constructor(e) {
|
|
819
|
-
B(this, tt), this.resourceName = "Nodes",
|
|
819
|
+
B(this, tt), this.resourceName = "Nodes", I(this, tt, e);
|
|
820
820
|
}
|
|
821
821
|
get(e) {
|
|
822
|
-
return
|
|
823
|
-
const a =
|
|
822
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
|
|
823
|
+
const a = It(U({}, n), {
|
|
824
824
|
ids: s.join(",")
|
|
825
825
|
}), i = new URLSearchParams(U({
|
|
826
826
|
plugin_data: "857346721138427857"
|
|
@@ -846,7 +846,7 @@ class or extends Ts {
|
|
|
846
846
|
set token(e) {
|
|
847
847
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
848
848
|
throw new Error("Invalid Figma access token");
|
|
849
|
-
|
|
849
|
+
I(this, ce, e);
|
|
850
850
|
}
|
|
851
851
|
get token() {
|
|
852
852
|
return T(this, ce);
|
|
@@ -859,7 +859,7 @@ class or extends Ts {
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
ce = /* @__PURE__ */ new WeakMap();
|
|
862
|
-
const
|
|
862
|
+
const Ns = (n) => C(void 0, [n], function* ({
|
|
863
863
|
fileKey: r,
|
|
864
864
|
authToken: e,
|
|
865
865
|
figmaRestApi: t = new or(),
|
|
@@ -938,10 +938,10 @@ var k;
|
|
|
938
938
|
}
|
|
939
939
|
r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
|
|
940
940
|
})(k || (k = {}));
|
|
941
|
-
var
|
|
941
|
+
var At;
|
|
942
942
|
(function(r) {
|
|
943
943
|
r.mergeShapes = (e, t) => d(d({}, e), t);
|
|
944
|
-
})(
|
|
944
|
+
})(At || (At = {}));
|
|
945
945
|
const p = k.arrayToEnum([
|
|
946
946
|
"string",
|
|
947
947
|
"nan",
|
|
@@ -1001,7 +1001,7 @@ const p = k.arrayToEnum([
|
|
|
1001
1001
|
"invalid_intersection_types",
|
|
1002
1002
|
"not_multiple_of",
|
|
1003
1003
|
"not_finite"
|
|
1004
|
-
]),
|
|
1004
|
+
]), Is = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
1005
1005
|
class z extends Error {
|
|
1006
1006
|
get errors() {
|
|
1007
1007
|
return this.issues;
|
|
@@ -1062,7 +1062,7 @@ class z extends Error {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
1064
|
z.create = (r) => new z(r);
|
|
1065
|
-
const
|
|
1065
|
+
const Ae = (r, e) => {
|
|
1066
1066
|
let t;
|
|
1067
1067
|
switch (r.code) {
|
|
1068
1068
|
case l.invalid_type:
|
|
@@ -1118,7 +1118,7 @@ const Ee = (r, e) => {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
return { message: t };
|
|
1120
1120
|
};
|
|
1121
|
-
let dr =
|
|
1121
|
+
let dr = Ae;
|
|
1122
1122
|
function js(r) {
|
|
1123
1123
|
dr = r;
|
|
1124
1124
|
}
|
|
@@ -1155,7 +1155,7 @@ function h(r, e) {
|
|
|
1155
1155
|
// then schema-bound map if available
|
|
1156
1156
|
t,
|
|
1157
1157
|
// then global override map
|
|
1158
|
-
t ===
|
|
1158
|
+
t === Ae ? void 0 : Ae
|
|
1159
1159
|
// then global default map
|
|
1160
1160
|
].filter((n) => !!n)
|
|
1161
1161
|
});
|
|
@@ -1206,7 +1206,7 @@ class j {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
const _ = Object.freeze({
|
|
1208
1208
|
status: "aborted"
|
|
1209
|
-
}), ke = (r) => ({ status: "dirty", value: r }), F = (r) => ({ status: "valid", value: r }),
|
|
1209
|
+
}), ke = (r) => ({ status: "dirty", value: r }), F = (r) => ({ status: "valid", value: r }), Et = (r) => r.status === "aborted", Ct = (r) => r.status === "dirty", ye = (r) => r.status === "valid", Pe = (r) => typeof Promise != "undefined" && r instanceof Promise;
|
|
1210
1210
|
function nt(r, e, t, s) {
|
|
1211
1211
|
if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1212
1212
|
return e.get(r);
|
|
@@ -1420,10 +1420,10 @@ class x {
|
|
|
1420
1420
|
return Ce.create(this, this._def);
|
|
1421
1421
|
}
|
|
1422
1422
|
or(e) {
|
|
1423
|
-
return
|
|
1423
|
+
return Ve.create([this, e], this._def);
|
|
1424
1424
|
}
|
|
1425
1425
|
and(e) {
|
|
1426
|
-
return
|
|
1426
|
+
return De.create(this, e, this._def);
|
|
1427
1427
|
}
|
|
1428
1428
|
transform(e) {
|
|
1429
1429
|
return new J(g(d({}, w(this._def)), {
|
|
@@ -1473,7 +1473,7 @@ class x {
|
|
|
1473
1473
|
return this.safeParse(null).success;
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
|
-
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
|
|
1476
|
+
const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Vs = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ds = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1477
1477
|
let gt;
|
|
1478
1478
|
const zs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ws = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Bs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, qs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, lr = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Gs = new RegExp(`^${lr}$`);
|
|
1479
1479
|
function fr(r) {
|
|
@@ -1553,7 +1553,7 @@ class q extends x {
|
|
|
1553
1553
|
message: a.message
|
|
1554
1554
|
}), s.dirty());
|
|
1555
1555
|
} else if (a.kind === "email")
|
|
1556
|
-
|
|
1556
|
+
Ds.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1557
1557
|
validation: "email",
|
|
1558
1558
|
code: l.invalid_string,
|
|
1559
1559
|
message: a.message
|
|
@@ -1632,7 +1632,7 @@ class q extends x {
|
|
|
1632
1632
|
code: l.invalid_string,
|
|
1633
1633
|
validation: "time",
|
|
1634
1634
|
message: a.message
|
|
1635
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
1635
|
+
}), s.dirty()) : a.kind === "duration" ? Vs.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
|
|
1636
1636
|
validation: "duration",
|
|
1637
1637
|
code: l.invalid_string,
|
|
1638
1638
|
message: a.message
|
|
@@ -2322,7 +2322,7 @@ class Le extends x {
|
|
|
2322
2322
|
Le.create = (r) => new Le(d({
|
|
2323
2323
|
typeName: y.ZodNull
|
|
2324
2324
|
}, w(r)));
|
|
2325
|
-
class
|
|
2325
|
+
class Ee extends x {
|
|
2326
2326
|
constructor() {
|
|
2327
2327
|
super(...arguments), this._any = !0;
|
|
2328
2328
|
}
|
|
@@ -2330,7 +2330,7 @@ class Ae extends x {
|
|
|
2330
2330
|
return F(e.data);
|
|
2331
2331
|
}
|
|
2332
2332
|
}
|
|
2333
|
-
|
|
2333
|
+
Ee.create = (r) => new Ee(d({
|
|
2334
2334
|
typeName: y.ZodAny
|
|
2335
2335
|
}, w(r)));
|
|
2336
2336
|
class ge extends x {
|
|
@@ -2443,20 +2443,20 @@ H.create = (r, e) => new H(d({
|
|
|
2443
2443
|
typeName: y.ZodArray
|
|
2444
2444
|
}, w(e)));
|
|
2445
2445
|
function xe(r) {
|
|
2446
|
-
if (r instanceof
|
|
2446
|
+
if (r instanceof A) {
|
|
2447
2447
|
const e = {};
|
|
2448
2448
|
for (const t in r.shape) {
|
|
2449
2449
|
const s = r.shape[t];
|
|
2450
2450
|
e[t] = Y.create(xe(s));
|
|
2451
2451
|
}
|
|
2452
|
-
return new
|
|
2452
|
+
return new A(g(d({}, r._def), {
|
|
2453
2453
|
shape: () => e
|
|
2454
2454
|
}));
|
|
2455
2455
|
} else return r instanceof H ? new H(g(d({}, r._def), {
|
|
2456
2456
|
type: xe(r.element)
|
|
2457
2457
|
})) : r instanceof Y ? Y.create(xe(r.unwrap())) : r instanceof fe ? fe.create(xe(r.unwrap())) : r instanceof ee ? ee.create(r.items.map((e) => xe(e))) : r;
|
|
2458
2458
|
}
|
|
2459
|
-
class
|
|
2459
|
+
class A extends x {
|
|
2460
2460
|
constructor() {
|
|
2461
2461
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2462
2462
|
}
|
|
@@ -2533,7 +2533,7 @@ class E extends x {
|
|
|
2533
2533
|
return this._def.shape();
|
|
2534
2534
|
}
|
|
2535
2535
|
strict(e) {
|
|
2536
|
-
return m.errToObj, new
|
|
2536
|
+
return m.errToObj, new A(d(g(d({}, this._def), {
|
|
2537
2537
|
unknownKeys: "strict"
|
|
2538
2538
|
}), e !== void 0 ? {
|
|
2539
2539
|
errorMap: (t, s) => {
|
|
@@ -2548,12 +2548,12 @@ class E extends x {
|
|
|
2548
2548
|
} : {}));
|
|
2549
2549
|
}
|
|
2550
2550
|
strip() {
|
|
2551
|
-
return new
|
|
2551
|
+
return new A(g(d({}, this._def), {
|
|
2552
2552
|
unknownKeys: "strip"
|
|
2553
2553
|
}));
|
|
2554
2554
|
}
|
|
2555
2555
|
passthrough() {
|
|
2556
|
-
return new
|
|
2556
|
+
return new A(g(d({}, this._def), {
|
|
2557
2557
|
unknownKeys: "passthrough"
|
|
2558
2558
|
}));
|
|
2559
2559
|
}
|
|
@@ -2575,7 +2575,7 @@ class E extends x {
|
|
|
2575
2575
|
// }) as any;
|
|
2576
2576
|
// };
|
|
2577
2577
|
extend(e) {
|
|
2578
|
-
return new
|
|
2578
|
+
return new A(g(d({}, this._def), {
|
|
2579
2579
|
shape: () => d(d({}, this._def.shape()), e)
|
|
2580
2580
|
}));
|
|
2581
2581
|
}
|
|
@@ -2585,7 +2585,7 @@ class E extends x {
|
|
|
2585
2585
|
* upgrade if you are experiencing issues.
|
|
2586
2586
|
*/
|
|
2587
2587
|
merge(e) {
|
|
2588
|
-
return new
|
|
2588
|
+
return new A({
|
|
2589
2589
|
unknownKeys: e._def.unknownKeys,
|
|
2590
2590
|
catchall: e._def.catchall,
|
|
2591
2591
|
shape: () => d(d({}, this._def.shape()), e._def.shape()),
|
|
@@ -2652,7 +2652,7 @@ class E extends x {
|
|
|
2652
2652
|
// return merged;
|
|
2653
2653
|
// }
|
|
2654
2654
|
catchall(e) {
|
|
2655
|
-
return new
|
|
2655
|
+
return new A(g(d({}, this._def), {
|
|
2656
2656
|
catchall: e
|
|
2657
2657
|
}));
|
|
2658
2658
|
}
|
|
@@ -2660,7 +2660,7 @@ class E extends x {
|
|
|
2660
2660
|
const t = {};
|
|
2661
2661
|
return k.objectKeys(e).forEach((s) => {
|
|
2662
2662
|
e[s] && this.shape[s] && (t[s] = this.shape[s]);
|
|
2663
|
-
}), new
|
|
2663
|
+
}), new A(g(d({}, this._def), {
|
|
2664
2664
|
shape: () => t
|
|
2665
2665
|
}));
|
|
2666
2666
|
}
|
|
@@ -2668,7 +2668,7 @@ class E extends x {
|
|
|
2668
2668
|
const t = {};
|
|
2669
2669
|
return k.objectKeys(this.shape).forEach((s) => {
|
|
2670
2670
|
e[s] || (t[s] = this.shape[s]);
|
|
2671
|
-
}), new
|
|
2671
|
+
}), new A(g(d({}, this._def), {
|
|
2672
2672
|
shape: () => t
|
|
2673
2673
|
}));
|
|
2674
2674
|
}
|
|
@@ -2683,7 +2683,7 @@ class E extends x {
|
|
|
2683
2683
|
return k.objectKeys(this.shape).forEach((s) => {
|
|
2684
2684
|
const n = this.shape[s];
|
|
2685
2685
|
e && !e[s] ? t[s] = n : t[s] = n.optional();
|
|
2686
|
-
}), new
|
|
2686
|
+
}), new A(g(d({}, this._def), {
|
|
2687
2687
|
shape: () => t
|
|
2688
2688
|
}));
|
|
2689
2689
|
}
|
|
@@ -2698,7 +2698,7 @@ class E extends x {
|
|
|
2698
2698
|
a = a._def.innerType;
|
|
2699
2699
|
t[s] = a;
|
|
2700
2700
|
}
|
|
2701
|
-
}), new
|
|
2701
|
+
}), new A(g(d({}, this._def), {
|
|
2702
2702
|
shape: () => t
|
|
2703
2703
|
}));
|
|
2704
2704
|
}
|
|
@@ -2706,25 +2706,25 @@ class E extends x {
|
|
|
2706
2706
|
return pr(k.objectKeys(this.shape));
|
|
2707
2707
|
}
|
|
2708
2708
|
}
|
|
2709
|
-
|
|
2709
|
+
A.create = (r, e) => new A(d({
|
|
2710
2710
|
shape: () => r,
|
|
2711
2711
|
unknownKeys: "strip",
|
|
2712
2712
|
catchall: ae.create(),
|
|
2713
2713
|
typeName: y.ZodObject
|
|
2714
2714
|
}, w(e)));
|
|
2715
|
-
|
|
2715
|
+
A.strictCreate = (r, e) => new A(d({
|
|
2716
2716
|
shape: () => r,
|
|
2717
2717
|
unknownKeys: "strict",
|
|
2718
2718
|
catchall: ae.create(),
|
|
2719
2719
|
typeName: y.ZodObject
|
|
2720
2720
|
}, w(e)));
|
|
2721
|
-
|
|
2721
|
+
A.lazycreate = (r, e) => new A(d({
|
|
2722
2722
|
shape: r,
|
|
2723
2723
|
unknownKeys: "strip",
|
|
2724
2724
|
catchall: ae.create(),
|
|
2725
2725
|
typeName: y.ZodObject
|
|
2726
2726
|
}, w(e)));
|
|
2727
|
-
class
|
|
2727
|
+
class Ve extends x {
|
|
2728
2728
|
_parse(e) {
|
|
2729
2729
|
const { ctx: t } = this._processInputParams(e), s = this._def.options;
|
|
2730
2730
|
function n(a) {
|
|
@@ -2788,7 +2788,7 @@ class De extends x {
|
|
|
2788
2788
|
return this._def.options;
|
|
2789
2789
|
}
|
|
2790
2790
|
}
|
|
2791
|
-
|
|
2791
|
+
Ve.create = (r, e) => new Ve(d({
|
|
2792
2792
|
options: r,
|
|
2793
2793
|
typeName: y.ZodUnion
|
|
2794
2794
|
}, w(e)));
|
|
@@ -2880,10 +2880,10 @@ function Ot(r, e) {
|
|
|
2880
2880
|
return { valid: !0, data: n };
|
|
2881
2881
|
} else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
2882
2882
|
}
|
|
2883
|
-
class
|
|
2883
|
+
class De extends x {
|
|
2884
2884
|
_parse(e) {
|
|
2885
2885
|
const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
|
|
2886
|
-
if (
|
|
2886
|
+
if (Et(a) || Et(i))
|
|
2887
2887
|
return _;
|
|
2888
2888
|
const o = Ot(a.value, i.value);
|
|
2889
2889
|
return o.valid ? ((Ct(a) || Ct(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
@@ -2912,7 +2912,7 @@ class Ve extends x {
|
|
|
2912
2912
|
}));
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
-
|
|
2915
|
+
De.create = (r, e, t) => new De(d({
|
|
2916
2916
|
left: r,
|
|
2917
2917
|
right: e,
|
|
2918
2918
|
typeName: y.ZodIntersection
|
|
@@ -3132,7 +3132,7 @@ class Te extends x {
|
|
|
3132
3132
|
t.common.contextualErrorMap,
|
|
3133
3133
|
t.schemaErrorMap,
|
|
3134
3134
|
rt(),
|
|
3135
|
-
|
|
3135
|
+
Ae
|
|
3136
3136
|
].filter((u) => !!u),
|
|
3137
3137
|
issueData: {
|
|
3138
3138
|
code: l.invalid_arguments,
|
|
@@ -3148,7 +3148,7 @@ class Te extends x {
|
|
|
3148
3148
|
t.common.contextualErrorMap,
|
|
3149
3149
|
t.schemaErrorMap,
|
|
3150
3150
|
rt(),
|
|
3151
|
-
|
|
3151
|
+
Ae
|
|
3152
3152
|
].filter((u) => !!u),
|
|
3153
3153
|
issueData: {
|
|
3154
3154
|
code: l.invalid_return_type,
|
|
@@ -3616,7 +3616,7 @@ function Jt(r, e) {
|
|
|
3616
3616
|
return typeof t == "string" ? { message: t } : t;
|
|
3617
3617
|
}
|
|
3618
3618
|
function mr(r, e = {}, t) {
|
|
3619
|
-
return r ?
|
|
3619
|
+
return r ? Ee.create().superRefine((s, n) => {
|
|
3620
3620
|
var a, i;
|
|
3621
3621
|
const o = r(s);
|
|
3622
3622
|
if (o instanceof Promise)
|
|
@@ -3631,10 +3631,10 @@ function mr(r, e = {}, t) {
|
|
|
3631
3631
|
const c = Jt(e, s), u = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
|
|
3632
3632
|
n.addIssue(g(d({ code: "custom" }, c), { fatal: u }));
|
|
3633
3633
|
}
|
|
3634
|
-
}) :
|
|
3634
|
+
}) : Ee.create();
|
|
3635
3635
|
}
|
|
3636
3636
|
const rn = {
|
|
3637
|
-
object:
|
|
3637
|
+
object: A.lazycreate
|
|
3638
3638
|
};
|
|
3639
3639
|
var y;
|
|
3640
3640
|
(function(r) {
|
|
@@ -3642,7 +3642,7 @@ var y;
|
|
|
3642
3642
|
})(y || (y = {}));
|
|
3643
3643
|
const sn = (r, e = {
|
|
3644
3644
|
message: `Input not instance of ${r.name}`
|
|
3645
|
-
}) => mr((t) => t instanceof r, e), gr = q.create, yr = de.create, nn = ct.create, an = ue.create, vr = $e.create, on = ve.create, cn = at.create, dn = Fe.create, un = Le.create, ln =
|
|
3645
|
+
}) => mr((t) => t instanceof r, e), gr = q.create, yr = de.create, nn = ct.create, an = ue.create, vr = $e.create, on = ve.create, cn = at.create, dn = Fe.create, un = Le.create, ln = Ee.create, fn = ge.create, hn = ae.create, pn = it.create, mn = H.create, gn = A.create, yn = A.strictCreate, vn = Ve.create, _n = dt.create, bn = De.create, wn = ee.create, xn = Ue.create, kn = ot.create, Tn = _e.create, Sn = Te.create, An = ze.create, En = We.create, Cn = le.create, On = Be.create, Nn = Ce.create, Gt = J.create, In = Y.create, jn = fe.create, Rn = J.createWithPreprocess, Zn = Ke.create, Mn = () => gr().optional(), Pn = () => yr().optional(), $n = () => vr().optional(), Fn = {
|
|
3646
3646
|
string: (r) => q.create(g(d({}, r), { coerce: !0 })),
|
|
3647
3647
|
number: (r) => de.create(g(d({}, r), { coerce: !0 })),
|
|
3648
3648
|
boolean: (r) => $e.create(g(d({}, r), {
|
|
@@ -3653,7 +3653,7 @@ const sn = (r, e = {
|
|
|
3653
3653
|
}, Ln = _;
|
|
3654
3654
|
var S = /* @__PURE__ */ Object.freeze({
|
|
3655
3655
|
__proto__: null,
|
|
3656
|
-
defaultErrorMap:
|
|
3656
|
+
defaultErrorMap: Ae,
|
|
3657
3657
|
setErrorMap: js,
|
|
3658
3658
|
getErrorMap: rt,
|
|
3659
3659
|
makeIssue: st,
|
|
@@ -3663,7 +3663,7 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3663
3663
|
INVALID: _,
|
|
3664
3664
|
DIRTY: ke,
|
|
3665
3665
|
OK: F,
|
|
3666
|
-
isAborted:
|
|
3666
|
+
isAborted: Et,
|
|
3667
3667
|
isDirty: Ct,
|
|
3668
3668
|
isValid: ye,
|
|
3669
3669
|
isAsync: Pe,
|
|
@@ -3671,7 +3671,7 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3671
3671
|
return k;
|
|
3672
3672
|
},
|
|
3673
3673
|
get objectUtil() {
|
|
3674
|
-
return
|
|
3674
|
+
return At;
|
|
3675
3675
|
},
|
|
3676
3676
|
ZodParsedType: p,
|
|
3677
3677
|
getParsedType: ne,
|
|
@@ -3685,15 +3685,15 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3685
3685
|
ZodSymbol: at,
|
|
3686
3686
|
ZodUndefined: Fe,
|
|
3687
3687
|
ZodNull: Le,
|
|
3688
|
-
ZodAny:
|
|
3688
|
+
ZodAny: Ee,
|
|
3689
3689
|
ZodUnknown: ge,
|
|
3690
3690
|
ZodNever: ae,
|
|
3691
3691
|
ZodVoid: it,
|
|
3692
3692
|
ZodArray: H,
|
|
3693
|
-
ZodObject:
|
|
3694
|
-
ZodUnion:
|
|
3693
|
+
ZodObject: A,
|
|
3694
|
+
ZodUnion: Ve,
|
|
3695
3695
|
ZodDiscriminatedUnion: dt,
|
|
3696
|
-
ZodIntersection:
|
|
3696
|
+
ZodIntersection: De,
|
|
3697
3697
|
ZodTuple: ee,
|
|
3698
3698
|
ZodRecord: Ue,
|
|
3699
3699
|
ZodMap: ot,
|
|
@@ -3734,8 +3734,8 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3734
3734
|
function: Sn,
|
|
3735
3735
|
instanceof: sn,
|
|
3736
3736
|
intersection: bn,
|
|
3737
|
-
lazy:
|
|
3738
|
-
literal:
|
|
3737
|
+
lazy: An,
|
|
3738
|
+
literal: En,
|
|
3739
3739
|
map: kn,
|
|
3740
3740
|
nan: nn,
|
|
3741
3741
|
nativeEnum: On,
|
|
@@ -3746,11 +3746,11 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3746
3746
|
object: gn,
|
|
3747
3747
|
oboolean: $n,
|
|
3748
3748
|
onumber: Pn,
|
|
3749
|
-
optional:
|
|
3749
|
+
optional: In,
|
|
3750
3750
|
ostring: Mn,
|
|
3751
3751
|
pipeline: Zn,
|
|
3752
3752
|
preprocess: Rn,
|
|
3753
|
-
promise:
|
|
3753
|
+
promise: Nn,
|
|
3754
3754
|
record: xn,
|
|
3755
3755
|
set: Tn,
|
|
3756
3756
|
strictObject: yn,
|
|
@@ -3764,12 +3764,13 @@ var S = /* @__PURE__ */ Object.freeze({
|
|
|
3764
3764
|
void: pn,
|
|
3765
3765
|
NEVER: Ln,
|
|
3766
3766
|
ZodIssueCode: l,
|
|
3767
|
-
quotelessJson:
|
|
3767
|
+
quotelessJson: Is,
|
|
3768
3768
|
ZodError: z
|
|
3769
3769
|
});
|
|
3770
|
-
const
|
|
3770
|
+
const Vn = S.object({
|
|
3771
3771
|
language: S.enum(["typescript", "javascript"]).optional(),
|
|
3772
|
-
disableMarkedForExport: S.boolean().optional()
|
|
3772
|
+
disableMarkedForExport: S.boolean().optional(),
|
|
3773
|
+
allowAutoSelectFirstNode: S.boolean().optional().default(!0)
|
|
3773
3774
|
}).and(
|
|
3774
3775
|
S.union([
|
|
3775
3776
|
S.object({
|
|
@@ -3804,8 +3805,8 @@ const Dn = S.object({
|
|
|
3804
3805
|
enableTranslation: S.boolean().optional()
|
|
3805
3806
|
})
|
|
3806
3807
|
])
|
|
3807
|
-
),
|
|
3808
|
-
const e =
|
|
3808
|
+
), Dn = (r) => {
|
|
3809
|
+
const e = Vn.safeParse(r);
|
|
3809
3810
|
if (e.success === !1) {
|
|
3810
3811
|
const t = new Error("Invalid codegen settings");
|
|
3811
3812
|
throw t.cause = e.error, t;
|
|
@@ -3817,60 +3818,68 @@ const Dn = S.object({
|
|
|
3817
3818
|
"COMPONENT",
|
|
3818
3819
|
"COMPONENT_SET",
|
|
3819
3820
|
"GROUP"
|
|
3820
|
-
]), Un = (r, e) => {
|
|
3821
|
-
const
|
|
3822
|
-
if (!
|
|
3821
|
+
]), Un = (r, e, t = { allowAutoSelectFirstNode: !0 }) => {
|
|
3822
|
+
const s = cr(r.document, e);
|
|
3823
|
+
if (!s)
|
|
3823
3824
|
return {
|
|
3824
3825
|
isValid: !1,
|
|
3825
3826
|
reason: "There is no node with the given id"
|
|
3826
3827
|
};
|
|
3827
|
-
if (
|
|
3828
|
-
const
|
|
3829
|
-
(
|
|
3828
|
+
if (s.type === "CANVAS") {
|
|
3829
|
+
const n = s.children.filter(
|
|
3830
|
+
(a) => Kt.has(a.type)
|
|
3830
3831
|
);
|
|
3831
|
-
return
|
|
3832
|
+
return n.length === 0 ? {
|
|
3833
|
+
isValid: !1,
|
|
3834
|
+
reason: "Selected node is a page with no valid children"
|
|
3835
|
+
} : n.length === 1 ? {
|
|
3832
3836
|
isValid: !0,
|
|
3833
|
-
node:
|
|
3837
|
+
node: n[0],
|
|
3834
3838
|
note: "Selected node is a page with a single valid children - returning it instead"
|
|
3839
|
+
} : t.allowAutoSelectFirstNode ? {
|
|
3840
|
+
isValid: !0,
|
|
3841
|
+
node: n[0],
|
|
3842
|
+
note: "Selected node is a page with multiple valid children - returning the first one instead"
|
|
3835
3843
|
} : {
|
|
3836
3844
|
isValid: !1,
|
|
3837
3845
|
reason: "Selected node is a page with multiple children"
|
|
3838
3846
|
};
|
|
3839
3847
|
}
|
|
3840
|
-
return Kt.has(
|
|
3848
|
+
return Kt.has(s.type) ? { isValid: !0, node: s } : {
|
|
3841
3849
|
isValid: !1,
|
|
3842
3850
|
reason: "Selected node type is not supported"
|
|
3843
3851
|
};
|
|
3844
3852
|
};
|
|
3845
|
-
var
|
|
3853
|
+
var N, Ge, be, _r, Nt;
|
|
3846
3854
|
class Yn {
|
|
3847
3855
|
constructor({
|
|
3848
3856
|
auth: e,
|
|
3849
3857
|
apiBaseAddress: t = "https://public-api.animaapp.com"
|
|
3850
3858
|
} = {}) {
|
|
3851
3859
|
Xe(this, be);
|
|
3852
|
-
Xe(this,
|
|
3860
|
+
Xe(this, N);
|
|
3853
3861
|
Xe(this, Ge);
|
|
3854
3862
|
ft(this, Ge, t), e && (this.auth = e);
|
|
3855
3863
|
}
|
|
3856
3864
|
hasAuth() {
|
|
3857
|
-
return !!P(this,
|
|
3865
|
+
return !!P(this, N);
|
|
3858
3866
|
}
|
|
3859
3867
|
set auth(e) {
|
|
3860
|
-
ft(this,
|
|
3868
|
+
ft(this, N, e);
|
|
3861
3869
|
}
|
|
3862
3870
|
get headers() {
|
|
3863
3871
|
const e = {
|
|
3864
3872
|
"Content-Type": "application/json"
|
|
3865
3873
|
};
|
|
3866
|
-
return P(this,
|
|
3874
|
+
return P(this, N) && (e.Authorization = `Bearer ${P(this, N).token}`, "teamId" in P(this, N) && (e["X-Team-Id"] = P(this, N).teamId)), e;
|
|
3867
3875
|
}
|
|
3868
3876
|
generateCode(s) {
|
|
3869
3877
|
return C(this, arguments, function* (e, t = {}) {
|
|
3870
|
-
|
|
3871
|
-
const n =
|
|
3878
|
+
var o;
|
|
3879
|
+
const n = Dn(e.settings);
|
|
3880
|
+
e.figmaToken && (yield Ye(this, be, _r).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (o = n.allowAutoSelectFirstNode) != null ? o : !0 }));
|
|
3872
3881
|
let a = e.tracking;
|
|
3873
|
-
P(this,
|
|
3882
|
+
P(this, N) && "userId" in P(this, N) && P(this, N).userId && (a != null && a.externalId || (a = { externalId: P(this, N).userId }));
|
|
3874
3883
|
const i = {
|
|
3875
3884
|
tracking: a,
|
|
3876
3885
|
fileKey: e.fileKey,
|
|
@@ -3888,10 +3897,11 @@ class Yn {
|
|
|
3888
3897
|
enableAutoSplit: n.enableAutoSplit,
|
|
3889
3898
|
autoSplitThreshold: n.autoSplitThreshold,
|
|
3890
3899
|
disableMarkedForExport: n.disableMarkedForExport,
|
|
3900
|
+
allowAutoSelectFirstNode: n.allowAutoSelectFirstNode,
|
|
3891
3901
|
enableDisplayScreenModelId: n.enableDisplayScreenModelId,
|
|
3892
3902
|
enableGeneratePackageLock: n.enableGeneratePackageLock
|
|
3893
3903
|
};
|
|
3894
|
-
return Ye(this, be,
|
|
3904
|
+
return Ye(this, be, Nt).call(this, "/v1/codegen", i, t, "codegen");
|
|
3895
3905
|
});
|
|
3896
3906
|
}
|
|
3897
3907
|
/**
|
|
@@ -3902,42 +3912,42 @@ class Yn {
|
|
|
3902
3912
|
generateLink2Code(s) {
|
|
3903
3913
|
return C(this, arguments, function* (e, t = {}) {
|
|
3904
3914
|
let n = e.tracking;
|
|
3905
|
-
P(this,
|
|
3915
|
+
P(this, N) && "userId" in P(this, N) && P(this, N).userId && (n != null && n.externalId || (n = { externalId: P(this, N).userId }));
|
|
3906
3916
|
const a = {
|
|
3907
3917
|
tracking: n,
|
|
3908
3918
|
assetsStorage: e.assetsStorage,
|
|
3909
3919
|
params: e.params
|
|
3910
3920
|
};
|
|
3911
|
-
return Ye(this, be,
|
|
3921
|
+
return Ye(this, be, Nt).call(this, "/v1/l2c", a, t, "l2c");
|
|
3912
3922
|
});
|
|
3913
3923
|
}
|
|
3914
3924
|
}
|
|
3915
|
-
|
|
3925
|
+
N = new WeakMap(), Ge = new WeakMap(), be = new WeakSet(), _r = function(e, t, s, n) {
|
|
3916
3926
|
return C(this, null, function* () {
|
|
3917
|
-
let
|
|
3927
|
+
let a;
|
|
3918
3928
|
try {
|
|
3919
|
-
|
|
3929
|
+
a = yield Ns({
|
|
3920
3930
|
fileKey: e,
|
|
3921
3931
|
authToken: t,
|
|
3922
3932
|
params: {
|
|
3923
3933
|
geometry: "paths"
|
|
3924
3934
|
}
|
|
3925
3935
|
});
|
|
3926
|
-
} catch (
|
|
3936
|
+
} catch (c) {
|
|
3927
3937
|
return;
|
|
3928
3938
|
}
|
|
3929
|
-
const
|
|
3930
|
-
(
|
|
3939
|
+
const o = s.map(
|
|
3940
|
+
(c) => Un(a, c, n)
|
|
3931
3941
|
).find(
|
|
3932
|
-
(
|
|
3942
|
+
(c) => !c.isValid
|
|
3933
3943
|
);
|
|
3934
|
-
if (
|
|
3944
|
+
if (o)
|
|
3935
3945
|
throw new oe({
|
|
3936
3946
|
name: "Task Crashed",
|
|
3937
|
-
reason:
|
|
3947
|
+
reason: o.reason
|
|
3938
3948
|
});
|
|
3939
3949
|
});
|
|
3940
|
-
},
|
|
3950
|
+
}, Nt = function(e, t, s, n) {
|
|
3941
3951
|
return C(this, null, function* () {
|
|
3942
3952
|
var f, v, O, R, L, W, te, he, ie;
|
|
3943
3953
|
if (this.hasAuth() === !1)
|
|
@@ -4224,8 +4234,8 @@ const sa = (r, e) => C(void 0, null, function* () {
|
|
|
4224
4234
|
export {
|
|
4225
4235
|
Yn as Anima,
|
|
4226
4236
|
oe as CodegenError,
|
|
4227
|
-
|
|
4228
|
-
|
|
4237
|
+
Er as FigmaTokenIssue,
|
|
4238
|
+
Nr as NotFound,
|
|
4229
4239
|
Cr as RateLimitExceeded,
|
|
4230
4240
|
Or as RequestTooLarge,
|
|
4231
4241
|
ta as ResponseError,
|
|
@@ -4237,17 +4247,17 @@ export {
|
|
|
4237
4247
|
cr as findChildrenNode,
|
|
4238
4248
|
ea as formatToFigmaLink,
|
|
4239
4249
|
Kn as getFigmaApiErrorType,
|
|
4240
|
-
|
|
4250
|
+
Ns as getFigmaFile,
|
|
4241
4251
|
Xn as getFileNodes,
|
|
4242
4252
|
ra as getRelatedScreenFiles,
|
|
4243
4253
|
Zr as isFigmaTokenIssue,
|
|
4244
4254
|
Un as isNodeCodegenCompatible,
|
|
4245
|
-
|
|
4255
|
+
Ir as isNotFound,
|
|
4246
4256
|
Rr as isRateLimitExceeded,
|
|
4247
4257
|
Mr as isRequestTooLarge,
|
|
4248
4258
|
Gn as isUnknownFigmaApiException,
|
|
4249
4259
|
Qn as isValidFigmaUrl,
|
|
4250
|
-
|
|
4260
|
+
Dn as validateSettings,
|
|
4251
4261
|
rr as wrapFigmaApiError
|
|
4252
4262
|
};
|
|
4253
4263
|
//# sourceMappingURL=index.js.map
|