@animaapp/anima-sdk 0.2.4 → 0.2.5
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/.turbo/turbo-build.log +14 -12
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +95 -93
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +1 -0
- package/src/settings.ts +2 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -551,7 +551,7 @@ class w {
|
|
|
551
551
|
return J.create(this);
|
|
552
552
|
}
|
|
553
553
|
promise() {
|
|
554
|
-
return
|
|
554
|
+
return Ee.create(this, this._def);
|
|
555
555
|
}
|
|
556
556
|
or(e) {
|
|
557
557
|
return Le.create([this, e], this._def);
|
|
@@ -575,7 +575,7 @@ class w {
|
|
|
575
575
|
}));
|
|
576
576
|
}
|
|
577
577
|
brand() {
|
|
578
|
-
return new
|
|
578
|
+
return new Et(u({
|
|
579
579
|
typeName: g.ZodBranded,
|
|
580
580
|
type: this
|
|
581
581
|
}, b(this._def)));
|
|
@@ -607,7 +607,7 @@ class w {
|
|
|
607
607
|
return this.safeParse(null).success;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,
|
|
610
|
+
const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?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)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
611
611
|
let ut;
|
|
612
612
|
const Cn = /^(?:(?: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])$/, In = /^(?:(?: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])$/, Nn = /^(([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]))$/, jn = /^(([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])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
|
|
613
613
|
function Gt(n) {
|
|
@@ -687,7 +687,7 @@ class H extends w {
|
|
|
687
687
|
message: a.message
|
|
688
688
|
}), s.dirty());
|
|
689
689
|
} else if (a.kind === "email")
|
|
690
|
-
|
|
690
|
+
An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
691
691
|
validation: "email",
|
|
692
692
|
code: l.invalid_string,
|
|
693
693
|
message: a.message
|
|
@@ -766,7 +766,7 @@ class H extends w {
|
|
|
766
766
|
code: l.invalid_string,
|
|
767
767
|
validation: "time",
|
|
768
768
|
message: a.message
|
|
769
|
-
}), s.dirty()) : a.kind === "duration" ?
|
|
769
|
+
}), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
770
770
|
validation: "duration",
|
|
771
771
|
code: l.invalid_string,
|
|
772
772
|
message: a.message
|
|
@@ -1653,10 +1653,10 @@ class S extends w {
|
|
|
1653
1653
|
return r.common.async ? Promise.resolve().then(() => F(this, null, function* () {
|
|
1654
1654
|
const d = [];
|
|
1655
1655
|
for (const f of c) {
|
|
1656
|
-
const _ = yield f.key,
|
|
1656
|
+
const _ = yield f.key, N = yield f.value;
|
|
1657
1657
|
d.push({
|
|
1658
1658
|
key: _,
|
|
1659
|
-
value:
|
|
1659
|
+
value: N,
|
|
1660
1660
|
alwaysSet: f.alwaysSet
|
|
1661
1661
|
});
|
|
1662
1662
|
}
|
|
@@ -1926,7 +1926,7 @@ Le.create = (n, e) => new Le(u({
|
|
|
1926
1926
|
options: n,
|
|
1927
1927
|
typeName: g.ZodUnion
|
|
1928
1928
|
}, b(e)));
|
|
1929
|
-
const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof
|
|
1929
|
+
const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof Et || n instanceof He ? ae(n.unwrap()) : n instanceof qe ? ae(n._def.innerType) : [];
|
|
1930
1930
|
class it extends w {
|
|
1931
1931
|
_parse(e) {
|
|
1932
1932
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2291,15 +2291,15 @@ class ke extends w {
|
|
|
2291
2291
|
});
|
|
2292
2292
|
}
|
|
2293
2293
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2294
|
-
if (this._def.returns instanceof
|
|
2294
|
+
if (this._def.returns instanceof Ee) {
|
|
2295
2295
|
const o = this;
|
|
2296
2296
|
return $(function(...c) {
|
|
2297
2297
|
return F(this, null, function* () {
|
|
2298
|
-
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((
|
|
2299
|
-
throw d.addIssue(s(c,
|
|
2298
|
+
const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
|
|
2299
|
+
throw d.addIssue(s(c, A)), d;
|
|
2300
2300
|
}), _ = yield Reflect.apply(i, this, f);
|
|
2301
|
-
return yield o._def.returns._def.type.parseAsync(_, a).catch((
|
|
2302
|
-
throw d.addIssue(r(_,
|
|
2301
|
+
return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
|
|
2302
|
+
throw d.addIssue(r(_, A)), d;
|
|
2303
2303
|
});
|
|
2304
2304
|
});
|
|
2305
2305
|
});
|
|
@@ -2471,7 +2471,7 @@ We.create = (n, e) => new We(u({
|
|
|
2471
2471
|
values: n,
|
|
2472
2472
|
typeName: g.ZodNativeEnum
|
|
2473
2473
|
}, b(e)));
|
|
2474
|
-
class
|
|
2474
|
+
class Ee extends w {
|
|
2475
2475
|
unwrap() {
|
|
2476
2476
|
return this._def.type;
|
|
2477
2477
|
}
|
|
@@ -2490,7 +2490,7 @@ class Ae extends w {
|
|
|
2490
2490
|
})));
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2493
|
+
Ee.create = (n, e) => new Ee(u({
|
|
2494
2494
|
type: n,
|
|
2495
2495
|
typeName: g.ZodPromise
|
|
2496
2496
|
}, b(e)));
|
|
@@ -2679,7 +2679,7 @@ at.create = (n) => new at(u({
|
|
|
2679
2679
|
typeName: g.ZodNaN
|
|
2680
2680
|
}, b(n)));
|
|
2681
2681
|
const Vn = Symbol("zod_brand");
|
|
2682
|
-
class
|
|
2682
|
+
class Et extends w {
|
|
2683
2683
|
_parse(e) {
|
|
2684
2684
|
const { ctx: t } = this._processInputParams(e), s = t.data;
|
|
2685
2685
|
return this._def.type._parse({
|
|
@@ -2763,7 +2763,7 @@ var g;
|
|
|
2763
2763
|
})(g || (g = {}));
|
|
2764
2764
|
const zn = (n, e = {
|
|
2765
2765
|
message: `Input not instance of ${n.name}`
|
|
2766
|
-
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms =
|
|
2766
|
+
}) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms = Ee.create, Pt = G.create, ys = ee.create, gs = he.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
|
|
2767
2767
|
string: (n) => H.create(y(u({}, n), { coerce: !0 })),
|
|
2768
2768
|
number: (n) => de.create(y(u({}, n), { coerce: !0 })),
|
|
2769
2769
|
boolean: (n) => $e.create(y(u({}, n), {
|
|
@@ -2772,7 +2772,7 @@ const zn = (n, e = {
|
|
|
2772
2772
|
bigint: (n) => le.create(y(u({}, n), { coerce: !0 })),
|
|
2773
2773
|
date: (n) => ve.create(y(u({}, n), { coerce: !0 }))
|
|
2774
2774
|
}, Ts = v;
|
|
2775
|
-
var
|
|
2775
|
+
var I = /* @__PURE__ */ Object.freeze({
|
|
2776
2776
|
__proto__: null,
|
|
2777
2777
|
defaultErrorMap: Te,
|
|
2778
2778
|
setErrorMap: vn,
|
|
@@ -2824,7 +2824,7 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
2824
2824
|
ZodLiteral: ze,
|
|
2825
2825
|
ZodEnum: fe,
|
|
2826
2826
|
ZodNativeEnum: We,
|
|
2827
|
-
ZodPromise:
|
|
2827
|
+
ZodPromise: Ee,
|
|
2828
2828
|
ZodEffects: G,
|
|
2829
2829
|
ZodTransformer: G,
|
|
2830
2830
|
ZodOptional: ee,
|
|
@@ -2833,7 +2833,7 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
2833
2833
|
ZodCatch: qe,
|
|
2834
2834
|
ZodNaN: at,
|
|
2835
2835
|
BRAND: Vn,
|
|
2836
|
-
ZodBranded:
|
|
2836
|
+
ZodBranded: Et,
|
|
2837
2837
|
ZodPipeline: Ge,
|
|
2838
2838
|
ZodReadonly: He,
|
|
2839
2839
|
custom: Yt,
|
|
@@ -2888,14 +2888,15 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
2888
2888
|
quotelessJson: gn,
|
|
2889
2889
|
ZodError: U
|
|
2890
2890
|
});
|
|
2891
|
-
const Ss =
|
|
2892
|
-
language:
|
|
2891
|
+
const Ss = I.object({
|
|
2892
|
+
language: I.enum(["typescript", "javascript"]).optional(),
|
|
2893
|
+
disableMarkedForExport: I.boolean().optional()
|
|
2893
2894
|
}).and(
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
framework:
|
|
2897
|
-
model:
|
|
2898
|
-
styling:
|
|
2895
|
+
I.union([
|
|
2896
|
+
I.object({
|
|
2897
|
+
framework: I.literal("react"),
|
|
2898
|
+
model: I.string().optional(),
|
|
2899
|
+
styling: I.enum([
|
|
2899
2900
|
"plain_css",
|
|
2900
2901
|
"css_modules",
|
|
2901
2902
|
"styled_components",
|
|
@@ -2904,19 +2905,19 @@ const Ss = N.object({
|
|
|
2904
2905
|
"scss",
|
|
2905
2906
|
"inline_styles"
|
|
2906
2907
|
]),
|
|
2907
|
-
uiLibrary:
|
|
2908
|
-
enableUILibraryTheming:
|
|
2909
|
-
enableCompactStructure:
|
|
2910
|
-
enableAutoSplit:
|
|
2911
|
-
autoSplitThreshold:
|
|
2908
|
+
uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
|
|
2909
|
+
enableUILibraryTheming: I.boolean().optional(),
|
|
2910
|
+
enableCompactStructure: I.boolean().optional(),
|
|
2911
|
+
enableAutoSplit: I.boolean().optional(),
|
|
2912
|
+
autoSplitThreshold: I.number().optional()
|
|
2912
2913
|
}),
|
|
2913
|
-
|
|
2914
|
-
framework:
|
|
2915
|
-
styling:
|
|
2916
|
-
enableTranslation:
|
|
2914
|
+
I.object({
|
|
2915
|
+
framework: I.literal("html"),
|
|
2916
|
+
styling: I.enum(["plain_css", "inline_styles"]),
|
|
2917
|
+
enableTranslation: I.boolean().optional()
|
|
2917
2918
|
})
|
|
2918
2919
|
])
|
|
2919
|
-
),
|
|
2920
|
+
), Es = (n) => {
|
|
2920
2921
|
const e = Ss.safeParse(n);
|
|
2921
2922
|
if (e.success === !1) {
|
|
2922
2923
|
const t = new Error("Invalid codegen settings");
|
|
@@ -2948,10 +2949,10 @@ class Zr {
|
|
|
2948
2949
|
}
|
|
2949
2950
|
generateCode(s) {
|
|
2950
2951
|
return F(this, arguments, function* (e, t = {}) {
|
|
2951
|
-
var f, _,
|
|
2952
|
+
var f, _, N, A, O, Z, B, se;
|
|
2952
2953
|
if (this.hasAuth() === !1)
|
|
2953
2954
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
2954
|
-
const r = {}, a =
|
|
2955
|
+
const r = {}, a = Es(e.settings), i = yield fetch(`${K(this, Je)}/v1/codegen`, {
|
|
2955
2956
|
method: "POST",
|
|
2956
2957
|
headers: y(u({}, this.headers), {
|
|
2957
2958
|
Accept: "text/event-stream"
|
|
@@ -2970,7 +2971,8 @@ class Zr {
|
|
|
2970
2971
|
enableUILibraryTheming: a.enableUILibraryTheming,
|
|
2971
2972
|
enableCompactStructure: a.enableCompactStructure,
|
|
2972
2973
|
enableAutoSplit: a.enableAutoSplit,
|
|
2973
|
-
autoSplitThreshold: a.autoSplitThreshold
|
|
2974
|
+
autoSplitThreshold: a.autoSplitThreshold,
|
|
2975
|
+
disableMarkedForExport: a.disableMarkedForExport
|
|
2974
2976
|
})
|
|
2975
2977
|
});
|
|
2976
2978
|
if (!i.ok) {
|
|
@@ -3021,11 +3023,11 @@ class Zr {
|
|
|
3021
3023
|
break;
|
|
3022
3024
|
}
|
|
3023
3025
|
case "pre_codegen": {
|
|
3024
|
-
typeof t == "function" ? t(k) : (
|
|
3026
|
+
typeof t == "function" ? t(k) : (N = t.onPreCodegen) == null || N.call(t, { message: k.message });
|
|
3025
3027
|
break;
|
|
3026
3028
|
}
|
|
3027
3029
|
case "assets_uploaded": {
|
|
3028
|
-
typeof t == "function" ? t(k) : (
|
|
3030
|
+
typeof t == "function" ? t(k) : (A = t.onAssetsUploaded) == null || A.call(t);
|
|
3029
3031
|
break;
|
|
3030
3032
|
}
|
|
3031
3033
|
case "assets_list": {
|
|
@@ -3112,7 +3114,7 @@ const Fr = ({
|
|
|
3112
3114
|
function r(a) {
|
|
3113
3115
|
if (s.has(a) || !n[a])
|
|
3114
3116
|
return;
|
|
3115
|
-
s.add(a), t[a] = n[a],
|
|
3117
|
+
s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
|
|
3116
3118
|
try {
|
|
3117
3119
|
const c = Os(a, o);
|
|
3118
3120
|
if (c.startsWith("src/")) {
|
|
@@ -3133,7 +3135,7 @@ const Fr = ({
|
|
|
3133
3135
|
a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
|
|
3134
3136
|
}), t;
|
|
3135
3137
|
};
|
|
3136
|
-
function
|
|
3138
|
+
function As(n) {
|
|
3137
3139
|
const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
|
|
3138
3140
|
let r;
|
|
3139
3141
|
for (; (r = e.exec(n)) !== null; )
|
|
@@ -3199,7 +3201,7 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
|
|
|
3199
3201
|
for (var t of Ft(e))
|
|
3200
3202
|
Us.call(e, t) && Dt(n, t, e[t]);
|
|
3201
3203
|
return n;
|
|
3202
|
-
},
|
|
3204
|
+
}, At = (n, e) => Ls(n, Ds(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ot(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (Ot(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
|
|
3203
3205
|
var a = (c) => {
|
|
3204
3206
|
try {
|
|
3205
3207
|
o(t.next(c));
|
|
@@ -3224,7 +3226,7 @@ function Hs() {
|
|
|
3224
3226
|
(function(t, s) {
|
|
3225
3227
|
n.exports = s();
|
|
3226
3228
|
})(qs, function() {
|
|
3227
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined",
|
|
3229
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", N = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = N && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), q = f && typeof String.prototype[Symbol.iterator] == "function", P = q && Object.getPrototypeOf(""[Symbol.iterator]()), ce = 8, be = -1;
|
|
3228
3230
|
function k(C) {
|
|
3229
3231
|
var It = typeof C;
|
|
3230
3232
|
if (It !== "object")
|
|
@@ -3322,7 +3324,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct &&
|
|
|
3322
3324
|
return n;
|
|
3323
3325
|
}
|
|
3324
3326
|
);
|
|
3325
|
-
function
|
|
3327
|
+
function Ae(n) {
|
|
3326
3328
|
return Xs(n) ? "Buffer" : Gs(n);
|
|
3327
3329
|
}
|
|
3328
3330
|
const Qs = /* @__PURE__ */ new Set([
|
|
@@ -3333,7 +3335,7 @@ const Qs = /* @__PURE__ */ new Set([
|
|
|
3333
3335
|
"Set"
|
|
3334
3336
|
]);
|
|
3335
3337
|
function er(n, e, t = null) {
|
|
3336
|
-
switch (t ||
|
|
3338
|
+
switch (t || Ae(n)) {
|
|
3337
3339
|
case "Arguments":
|
|
3338
3340
|
case "Array":
|
|
3339
3341
|
case "Object":
|
|
@@ -3348,7 +3350,7 @@ function vt(n) {
|
|
|
3348
3350
|
return Qs.has(n);
|
|
3349
3351
|
}
|
|
3350
3352
|
function Ut(n, e, t, s = null) {
|
|
3351
|
-
switch (s ||
|
|
3353
|
+
switch (s || Ae(n)) {
|
|
3352
3354
|
case "Arguments":
|
|
3353
3355
|
case "Array":
|
|
3354
3356
|
case "Object":
|
|
@@ -3467,7 +3469,7 @@ function yr() {
|
|
|
3467
3469
|
}
|
|
3468
3470
|
function _t(n, e = null, t = yr) {
|
|
3469
3471
|
arguments.length === 2 && typeof e == "function" && (t = e, e = null);
|
|
3470
|
-
const s = e ||
|
|
3472
|
+
const s = e || Ae(n), r = mr.get(s);
|
|
3471
3473
|
if (s === "Object") {
|
|
3472
3474
|
const a = t(n, s);
|
|
3473
3475
|
if (a !== void 0)
|
|
@@ -3484,14 +3486,14 @@ function Ce(n, e = {}) {
|
|
|
3484
3486
|
customizer: t
|
|
3485
3487
|
// TODO: max depth
|
|
3486
3488
|
// depth = Infinity,
|
|
3487
|
-
} = e, s =
|
|
3489
|
+
} = e, s = Ae(n);
|
|
3488
3490
|
if (!vt(s))
|
|
3489
3491
|
return bt(n, null, null, null);
|
|
3490
3492
|
const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
|
|
3491
3493
|
return bt(n, r, a, i);
|
|
3492
3494
|
}
|
|
3493
3495
|
function bt(n, e, t, s, r) {
|
|
3494
|
-
const a =
|
|
3496
|
+
const a = Ae(n), i = _t(n, a);
|
|
3495
3497
|
if (!vt(a))
|
|
3496
3498
|
return i;
|
|
3497
3499
|
let o;
|
|
@@ -3513,7 +3515,7 @@ function bt(n, e, t, s, r) {
|
|
|
3513
3515
|
if (s.has(d))
|
|
3514
3516
|
Ut(e, c, t.get(d), a);
|
|
3515
3517
|
else {
|
|
3516
|
-
const f =
|
|
3518
|
+
const f = Ae(d), _ = _t(d, f);
|
|
3517
3519
|
vt(f) && (t.set(d, _), s.add(d)), Ut(
|
|
3518
3520
|
e,
|
|
3519
3521
|
c,
|
|
@@ -3536,7 +3538,7 @@ class vr {
|
|
|
3536
3538
|
W(this, wt), W(this, Ke), W(this, pe), W(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, pe, 0);
|
|
3537
3539
|
}
|
|
3538
3540
|
run() {
|
|
3539
|
-
return
|
|
3541
|
+
return E(this, null, function* () {
|
|
3540
3542
|
try {
|
|
3541
3543
|
return yield T(this, Xe).call(this);
|
|
3542
3544
|
} catch (e) {
|
|
@@ -3555,7 +3557,7 @@ function _r() {
|
|
|
3555
3557
|
return typeof CompressionStream != "undefined";
|
|
3556
3558
|
}
|
|
3557
3559
|
function br(n) {
|
|
3558
|
-
return
|
|
3560
|
+
return E(this, null, function* () {
|
|
3559
3561
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
3560
3562
|
try {
|
|
3561
3563
|
for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -3576,7 +3578,7 @@ function br(n) {
|
|
|
3576
3578
|
});
|
|
3577
3579
|
}
|
|
3578
3580
|
function wr(n) {
|
|
3579
|
-
return
|
|
3581
|
+
return E(this, null, function* () {
|
|
3580
3582
|
const e = yield new Blob(n).arrayBuffer();
|
|
3581
3583
|
return new Uint8Array(e);
|
|
3582
3584
|
});
|
|
@@ -3641,7 +3643,7 @@ function xt() {
|
|
|
3641
3643
|
}
|
|
3642
3644
|
const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
|
|
3643
3645
|
var me, L, X, kt, Tt, Re;
|
|
3644
|
-
class
|
|
3646
|
+
class Er {
|
|
3645
3647
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
3646
3648
|
W(this, X), W(this, me), W(this, L), this.baseAddress = t, j(this, me, e), j(this, L, {}), this.plugins = [];
|
|
3647
3649
|
}
|
|
@@ -3658,41 +3660,41 @@ class Ar {
|
|
|
3658
3660
|
return j(this, L, e), this;
|
|
3659
3661
|
}
|
|
3660
3662
|
get(e) {
|
|
3661
|
-
return
|
|
3663
|
+
return E(this, arguments, function* (t, s = {}) {
|
|
3662
3664
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
3663
3665
|
let o = a != null ? a : this.headers;
|
|
3664
3666
|
const c = Ce(T(this, L));
|
|
3665
|
-
return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o =
|
|
3667
|
+
return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = At(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() })), c.async ? yield Q(this, X, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
3666
3668
|
});
|
|
3667
3669
|
}
|
|
3668
3670
|
post(e, t) {
|
|
3669
|
-
return
|
|
3671
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3670
3672
|
const i = Ce(T(this, L));
|
|
3671
3673
|
return j(this, L, {}), Q(this, X, Re).call(this, s, "POST", r, a, i);
|
|
3672
3674
|
});
|
|
3673
3675
|
}
|
|
3674
3676
|
put(e, t) {
|
|
3675
|
-
return
|
|
3677
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3676
3678
|
const i = Ce(T(this, L));
|
|
3677
3679
|
return j(this, L, {}), Q(this, X, Re).call(this, s, "PUT", r, a, i);
|
|
3678
3680
|
});
|
|
3679
3681
|
}
|
|
3680
3682
|
delete(e, t) {
|
|
3681
|
-
return
|
|
3683
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3682
3684
|
const i = Ce(T(this, L));
|
|
3683
3685
|
return j(this, L, {}), Q(this, X, Re).call(this, s, "DELETE", r, a, i);
|
|
3684
3686
|
});
|
|
3685
3687
|
}
|
|
3686
3688
|
patch(e, t) {
|
|
3687
|
-
return
|
|
3689
|
+
return E(this, arguments, function* (s, r, a = {}) {
|
|
3688
3690
|
const i = Ce(T(this, L));
|
|
3689
3691
|
return j(this, L, {}), Q(this, X, Re).call(this, s, "PATCH", r, a, i);
|
|
3690
3692
|
});
|
|
3691
3693
|
}
|
|
3692
3694
|
}
|
|
3693
3695
|
me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
|
|
3694
|
-
return
|
|
3695
|
-
const s = () =>
|
|
3696
|
+
return E(this, null, function* () {
|
|
3697
|
+
const s = () => E(this, null, function* () {
|
|
3696
3698
|
var c, d;
|
|
3697
3699
|
try {
|
|
3698
3700
|
return yield T(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
@@ -3702,7 +3704,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3702
3704
|
}), { headers: r } = t != null ? t : {}, a = (c, d) => {
|
|
3703
3705
|
var f, _;
|
|
3704
3706
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[d]) || "";
|
|
3705
|
-
}, i = (c) =>
|
|
3707
|
+
}, i = (c) => E(this, null, function* () {
|
|
3706
3708
|
var d;
|
|
3707
3709
|
if (!c.ok) {
|
|
3708
3710
|
const _ = yield c.text().catch();
|
|
@@ -3717,15 +3719,15 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3717
3719
|
}
|
|
3718
3720
|
if (e.requestValidation && process.env.UI_TESTS !== !0)
|
|
3719
3721
|
try {
|
|
3720
|
-
const _ = a(c, "x-response-nonce"),
|
|
3721
|
-
if (!_ || _ !==
|
|
3722
|
+
const _ = a(c, "x-response-nonce"), N = r == null ? void 0 : r["X-Request-Nonce"];
|
|
3723
|
+
if (!_ || _ !== N)
|
|
3722
3724
|
throw new lt("Response nonce mismatch");
|
|
3723
|
-
const
|
|
3724
|
-
if (isNaN(
|
|
3725
|
+
const A = Number(a(c, "x-response-timestamp")), O = Number(xt()), Z = 60 * 60 * 24;
|
|
3726
|
+
if (isNaN(A) || Math.abs(O - A) > Z)
|
|
3725
3727
|
throw new lt("Invalid response timestamp");
|
|
3726
3728
|
} catch (_) {
|
|
3727
|
-
const
|
|
3728
|
-
throw new lt(
|
|
3729
|
+
const N = _ instanceof Error ? _.message : "Request validation failed";
|
|
3730
|
+
throw new lt(N);
|
|
3729
3731
|
}
|
|
3730
3732
|
let f = yield c.text();
|
|
3731
3733
|
try {
|
|
@@ -3745,7 +3747,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3745
3747
|
return yield i(o);
|
|
3746
3748
|
});
|
|
3747
3749
|
}, Tt = function(n, e, t) {
|
|
3748
|
-
return
|
|
3750
|
+
return E(this, null, function* () {
|
|
3749
3751
|
var s, r;
|
|
3750
3752
|
const {
|
|
3751
3753
|
onProgress: a,
|
|
@@ -3770,15 +3772,15 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3770
3772
|
body: O
|
|
3771
3773
|
});
|
|
3772
3774
|
}
|
|
3773
|
-
const
|
|
3774
|
-
if (!
|
|
3775
|
+
const N = yield _.json(), { job_id: A } = N;
|
|
3776
|
+
if (!A)
|
|
3775
3777
|
throw new Error("Job ID not found in response");
|
|
3776
|
-
return new Promise((O, Z) =>
|
|
3778
|
+
return new Promise((O, Z) => E(this, null, function* () {
|
|
3777
3779
|
const B = setTimeout(() => {
|
|
3778
3780
|
Z(new Error("Job timed out"));
|
|
3779
|
-
}, c), se = (q = 0) =>
|
|
3781
|
+
}, c), se = (q = 0) => E(this, null, function* () {
|
|
3780
3782
|
if (i != null && i.aborted) {
|
|
3781
|
-
clearTimeout(B), T(this, me).call(this, `${f}/${
|
|
3783
|
+
clearTimeout(B), T(this, me).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
3782
3784
|
Z(new je({ canceled: !0 }));
|
|
3783
3785
|
}).catch((P) => {
|
|
3784
3786
|
Z(new je({ canceled: !1 }));
|
|
@@ -3786,7 +3788,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3786
3788
|
return;
|
|
3787
3789
|
}
|
|
3788
3790
|
try {
|
|
3789
|
-
const P = yield (yield T(this, me).call(this, `${f}/${
|
|
3791
|
+
const P = yield (yield T(this, me).call(this, `${f}/${A}`, { headers: this.headers })).json();
|
|
3790
3792
|
if (P.status === "success") {
|
|
3791
3793
|
clearTimeout(B);
|
|
3792
3794
|
const ce = P.response_json;
|
|
@@ -3806,10 +3808,10 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
|
|
|
3806
3808
|
}));
|
|
3807
3809
|
});
|
|
3808
3810
|
}, Re = function(n, e, t, s, r) {
|
|
3809
|
-
return
|
|
3811
|
+
return E(this, null, function* () {
|
|
3810
3812
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
3811
3813
|
let c = i != null ? i : this.headers;
|
|
3812
|
-
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c =
|
|
3814
|
+
r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = At(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() }));
|
|
3813
3815
|
let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
3814
3816
|
return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield Q(this, X, Tt).call(this, `${o}${n}`, r.async, {
|
|
3815
3817
|
method: e,
|
|
@@ -3840,12 +3842,12 @@ const Bt = (n, e, t, s) => n instanceof je ? n : new xr({ resource: e, api: Stri
|
|
|
3840
3842
|
}
|
|
3841
3843
|
});
|
|
3842
3844
|
var Ze;
|
|
3843
|
-
class
|
|
3845
|
+
class Ar {
|
|
3844
3846
|
constructor(e) {
|
|
3845
3847
|
W(this, Ze), this.resourceName = "Files", j(this, Ze, e);
|
|
3846
3848
|
}
|
|
3847
3849
|
get(e) {
|
|
3848
|
-
return
|
|
3850
|
+
return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
3849
3851
|
const r = new URLSearchParams(V({
|
|
3850
3852
|
plugin_data: "857346721138427857"
|
|
3851
3853
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
@@ -3853,7 +3855,7 @@ class Er {
|
|
|
3853
3855
|
});
|
|
3854
3856
|
}
|
|
3855
3857
|
getImageFills(e) {
|
|
3856
|
-
return
|
|
3858
|
+
return E(this, arguments, function* ({ fileKey: t }) {
|
|
3857
3859
|
var s, r;
|
|
3858
3860
|
const a = `v1/files/${t}/images`;
|
|
3859
3861
|
return (r = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
@@ -3875,7 +3877,7 @@ class Ir {
|
|
|
3875
3877
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
3876
3878
|
*/
|
|
3877
3879
|
get(e) {
|
|
3878
|
-
return
|
|
3880
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
3879
3881
|
const i = Or(t, s, r), o = T(this, Y).cache.images.entries.get(i);
|
|
3880
3882
|
if (Cr(o))
|
|
3881
3883
|
return o.result;
|
|
@@ -3894,7 +3896,7 @@ class Ir {
|
|
|
3894
3896
|
}
|
|
3895
3897
|
}
|
|
3896
3898
|
Y = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
|
|
3897
|
-
return
|
|
3899
|
+
return E(this, null, function* () {
|
|
3898
3900
|
const a = yield T(this, Y).get(
|
|
3899
3901
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
3900
3902
|
);
|
|
@@ -3910,8 +3912,8 @@ class Nr {
|
|
|
3910
3912
|
W(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
|
|
3911
3913
|
}
|
|
3912
3914
|
get(e) {
|
|
3913
|
-
return
|
|
3914
|
-
const a =
|
|
3915
|
+
return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
3916
|
+
const a = At(V({}, r), {
|
|
3915
3917
|
ids: s.join(",")
|
|
3916
3918
|
}), i = new URLSearchParams(V({
|
|
3917
3919
|
plugin_data: "857346721138427857"
|
|
@@ -3922,7 +3924,7 @@ class Nr {
|
|
|
3922
3924
|
}
|
|
3923
3925
|
Ye = /* @__PURE__ */ new WeakMap();
|
|
3924
3926
|
var ue;
|
|
3925
|
-
class ln extends
|
|
3927
|
+
class ln extends Er {
|
|
3926
3928
|
constructor({
|
|
3927
3929
|
baseAddress: e = "https://api.figma.com/",
|
|
3928
3930
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -3932,7 +3934,7 @@ class ln extends Ar {
|
|
|
3932
3934
|
entries: /* @__PURE__ */ new Map(),
|
|
3933
3935
|
pendingRequests: /* @__PURE__ */ new Map()
|
|
3934
3936
|
}
|
|
3935
|
-
}, this.files = ft(this, new
|
|
3937
|
+
}, this.files = ft(this, new Ar(this)), this.nodes = ft(this, new Nr(this)), this.images = ft(this, new Ir(this));
|
|
3936
3938
|
}
|
|
3937
3939
|
set token(e) {
|
|
3938
3940
|
if (!e.startsWith("figd_") && !e.startsWith("figu_"))
|
|
@@ -4008,11 +4010,11 @@ const Vr = (r) => F(void 0, [r], function* ({
|
|
|
4008
4010
|
});
|
|
4009
4011
|
}
|
|
4010
4012
|
}), zr = (n, e) => F(void 0, null, function* () {
|
|
4011
|
-
var c, d, f, _,
|
|
4013
|
+
var c, d, f, _, N, A, O;
|
|
4012
4014
|
const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4013
4015
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (d = a.value) == null ? void 0 : d.payload) != null && f.status))
|
|
4014
4016
|
return new Response(JSON.stringify(a.value), {
|
|
4015
|
-
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (
|
|
4017
|
+
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (N = a.value) == null ? void 0 : N.payload) == null ? void 0 : A.status) != null ? O : 500,
|
|
4016
4018
|
headers: {
|
|
4017
4019
|
"Content-Type": "application/json"
|
|
4018
4020
|
}
|
|
@@ -4060,6 +4062,6 @@ export {
|
|
|
4060
4062
|
Ms as isRateLimitExceeded,
|
|
4061
4063
|
Lr as isUnknownFigmaApiException,
|
|
4062
4064
|
Mr as isValidFigmaUrl,
|
|
4063
|
-
|
|
4065
|
+
Es as validateSettings
|
|
4064
4066
|
};
|
|
4065
4067
|
//# sourceMappingURL=index.js.map
|