gatana-sdk 2.3.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/api/index.cjs +159 -119
  2. package/dist/api/index.d.cts +2 -2
  3. package/dist/api/index.d.mts +2 -2
  4. package/dist/api/index.mjs +2 -2
  5. package/dist/apiv2/index.cjs +14 -11
  6. package/dist/apiv2/index.d.cts +2 -2
  7. package/dist/apiv2/index.d.mts +2 -2
  8. package/dist/apiv2/index.mjs +2 -2
  9. package/dist/index.cjs +14 -13
  10. package/dist/index.d.cts +4 -2
  11. package/dist/index.d.cts.map +1 -1
  12. package/dist/index.d.mts +4 -2
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs +14 -13
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/sdk.gen-C2b2ZNMj.d.mts +9639 -0
  17. package/dist/sdk.gen-C2b2ZNMj.d.mts.map +1 -0
  18. package/dist/{sdk.gen-DUNHa0uM.mjs → sdk.gen-CAAxLIvj.mjs} +85 -28
  19. package/dist/sdk.gen-CAAxLIvj.mjs.map +1 -0
  20. package/dist/{sdk.gen-BMl_z1y-.cjs → sdk.gen-Cdv7MDsj.cjs} +121 -46
  21. package/dist/sdk.gen-Crii0E1f.d.mts +2090 -0
  22. package/dist/sdk.gen-Crii0E1f.d.mts.map +1 -0
  23. package/dist/sdk.gen-CyOAEozT.cjs +4269 -0
  24. package/dist/sdk.gen-Do_HFvZj.d.cts +2090 -0
  25. package/dist/sdk.gen-Do_HFvZj.d.cts.map +1 -0
  26. package/dist/{sdk.gen-DncK4XW4.cjs → sdk.gen-OcCJ7VK7.mjs} +1183 -995
  27. package/dist/sdk.gen-OcCJ7VK7.mjs.map +1 -0
  28. package/dist/sdk.gen-aJw0bLkG.d.cts +9639 -0
  29. package/dist/sdk.gen-aJw0bLkG.d.cts.map +1 -0
  30. package/package.json +1 -1
  31. package/dist/sdk.gen-B9VM8vvh.d.mts +0 -919
  32. package/dist/sdk.gen-B9VM8vvh.d.mts.map +0 -1
  33. package/dist/sdk.gen-Bp6WOiGq.d.cts +0 -4229
  34. package/dist/sdk.gen-Bp6WOiGq.d.cts.map +0 -1
  35. package/dist/sdk.gen-BzFbgKkw.mjs +0 -2357
  36. package/dist/sdk.gen-BzFbgKkw.mjs.map +0 -1
  37. package/dist/sdk.gen-DUNHa0uM.mjs.map +0 -1
  38. package/dist/sdk.gen-DgXGgJek.d.mts +0 -4229
  39. package/dist/sdk.gen-DgXGgJek.d.mts.map +0 -1
  40. package/dist/sdk.gen-DjFHZqZ0.d.cts +0 -919
  41. package/dist/sdk.gen-DjFHZqZ0.d.cts.map +0 -1
@@ -1,2 +1,2 @@
1
- import { $ as Schema102, $n as Schema70, $t as Schema21, A as GetServersBySlugResponse, An as Schema5, Ar as Schema99, At as Schema130, B as PatchServersBySlugResponse, Bn as Schema59, Br as ServerVisibility, Bt as Schema14, C as GetCredentialsByIdSecretData, Cn as Schema43, Cr as Schema92, Ct as Schema124, D as GetCredentialsResponse, Dn as Schema47, Dr as Schema96, Dt as Schema128, E as GetCredentialsData, En as Schema46, Er as Schema95, Et as Schema127, F as HostedTransportConfig, Fn as Schema54, Fr as ServerCredentialsOuth, Ft as Schema135, G as PutServersBySlugData, Gn as Schema63, Gr as V2CreateServerRequest, Gt as Schema144, H as PostServersData, Hn as Schema60, Hr as SseTransportConfigOutput, Ht as Schema141, I as HostedTransportConfigOutput, In as Schema55, Ir as ServerOAuthClientConfiguration, It as Schema136, J as Schema0, Jn as Schema66, Jr as V2ServerDto, Jt as Schema17, K as PutServersBySlugResponse, Kn as Schema64, Kr as V2ListServersResponse, Kt as Schema15, L as HttpStreamingTransportConfig, Ln as Schema56, Lr as ServerOAuthClientConfigurationOutput, Lt as Schema137, M as GetServersData, Mn as Schema51, Mr as ServerAuthorization, Mt as Schema132, N as GetServersResponse, Nn as Schema52, Nr as ServerAuthorizationOutput, Nt as Schema133, O as GetCredentialsResponses, On as Schema48, Or as Schema97, Ot as Schema129, P as GetServersResponses, Pn as Schema53, Pr as ServerCredentialsApiKeys, Pt as Schema134, Q as Schema101, Qn as Schema7, Qt as Schema20, R as HttpStreamingTransportConfigOutput, Rn as Schema57, Rr as ServerOAuthMetadata, Rt as Schema138, S as GetCredentialsByIdResponses, Sn as Schema42, Sr as Schema91, St as Schema123, T as GetCredentialsByIdSecretResponses, Tn as Schema45, Tr as Schema94, Tt as Schema126, U as PostServersResponse, Un as Schema61, Ur as StdioTransportConfig, Ut as Schema142, V as PatchServersBySlugResponses, Vn as Schema6, Vr as SseTransportConfig, Vt as Schema140, W as PostServersResponses, Wn as Schema62, Wr as StdioTransportConfigOutput, Wt as Schema143, X as Schema10, Xn as Schema68, Xt as Schema19, Y as Schema1, Yn as Schema67, Yr as V2UpdateServerRequest, Yt as Schema18, Z as Schema100, Zn as Schema69, Zt as Schema2, _ as DeleteCredentialsByIdResponses, _n as Schema38, _r as Schema87, _t as Schema119, a as getCredentialsById, an as Schema27, ar as Schema76, at as Schema108, b as GetCredentialsByIdData, bn as Schema40, br as Schema9, bt as Schema121, c as getServersBySlug, cn as Schema3, cr as Schema79, ct as Schema110, d as putServersBySlug, dn as Schema32, dr as Schema81, dt as Schema113, en as Schema22, er as Schema71, et as Schema103, fn as Schema33, fr as Schema82, ft as Schema114, g as DeleteCredentialsByIdResponse, gn as Schema37, gr as Schema86, gt as Schema118, h as DeleteCredentialsByIdData, hn as Schema36, hr as Schema85, ht as Schema117, i as getCredentials, in as Schema26, ir as Schema75, it as Schema107, j as GetServersBySlugResponses, jn as Schema50, jr as Server, jt as Schema131, k as GetServersBySlugData, kn as Schema49, kr as Schema98, kt as Schema13, l as patchServersBySlug, ln as Schema30, lr as Schema8, lt as Schema111, m as CredentialDtoV2, mn as Schema35, mr as Schema84, mt as Schema116, n as deleteCredentialsById, nn as Schema24, nr as Schema73, nt as Schema105, o as getCredentialsByIdSecret, on as Schema28, or as Schema77, ot as Schema109, p as ClientOptions, pn as Schema34, pr as Schema83, pt as Schema115, q as PutServersBySlugResponses, qn as Schema65, qr as V2PatchServerRequest, qt as Schema16, r as deleteServersBySlug, rn as Schema25, rr as Schema74, rt as Schema106, s as getServers, sn as Schema29, sr as Schema78, st as Schema11, t as Options, tn as Schema23, tr as Schema72, tt as Schema104, u as postServers, un as Schema31, ur as Schema80, ut as Schema112, v as DeleteServersBySlugData, vn as Schema39, vr as Schema88, vt as Schema12, w as GetCredentialsByIdSecretResponse, wn as Schema44, wr as Schema93, wt as Schema125, x as GetCredentialsByIdResponse, xn as Schema41, xr as Schema90, xt as Schema122, y as DeleteServersBySlugResponses, yn as Schema4, yr as Schema89, yt as Schema120, z as PatchServersBySlugData, zn as Schema58, zr as ServerOAuthMetadataOutput, zt as Schema139 } from "../sdk.gen-B9VM8vvh.mjs";
2
- export { type ClientOptions, type CredentialDtoV2, type DeleteCredentialsByIdData, type DeleteCredentialsByIdResponse, type DeleteCredentialsByIdResponses, type DeleteServersBySlugData, type DeleteServersBySlugResponses, type GetCredentialsByIdData, type GetCredentialsByIdResponse, type GetCredentialsByIdResponses, type GetCredentialsByIdSecretData, type GetCredentialsByIdSecretResponse, type GetCredentialsByIdSecretResponses, type GetCredentialsData, type GetCredentialsResponse, type GetCredentialsResponses, type GetServersBySlugData, type GetServersBySlugResponse, type GetServersBySlugResponses, type GetServersData, type GetServersResponse, type GetServersResponses, type HostedTransportConfig, type HostedTransportConfigOutput, type HttpStreamingTransportConfig, type HttpStreamingTransportConfigOutput, type Options, type PatchServersBySlugData, type PatchServersBySlugResponse, type PatchServersBySlugResponses, type PostServersData, type PostServersResponse, type PostServersResponses, type PutServersBySlugData, type PutServersBySlugResponse, type PutServersBySlugResponses, type Schema0, type Schema1, type Schema10, type Schema100, type Schema101, type Schema102, type Schema103, type Schema104, type Schema105, type Schema106, type Schema107, type Schema108, type Schema109, type Schema11, type Schema110, type Schema111, type Schema112, type Schema113, type Schema114, type Schema115, type Schema116, type Schema117, type Schema118, type Schema119, type Schema12, type Schema120, type Schema121, type Schema122, type Schema123, type Schema124, type Schema125, type Schema126, type Schema127, type Schema128, type Schema129, type Schema13, type Schema130, type Schema131, type Schema132, type Schema133, type Schema134, type Schema135, type Schema136, type Schema137, type Schema138, type Schema139, type Schema14, type Schema140, type Schema141, type Schema142, type Schema143, type Schema144, type Schema15, type Schema16, type Schema17, type Schema18, type Schema19, type Schema2, type Schema20, type Schema21, type Schema22, type Schema23, type Schema24, type Schema25, type Schema26, type Schema27, type Schema28, type Schema29, type Schema3, type Schema30, type Schema31, type Schema32, type Schema33, type Schema34, type Schema35, type Schema36, type Schema37, type Schema38, type Schema39, type Schema4, type Schema40, type Schema41, type Schema42, type Schema43, type Schema44, type Schema45, type Schema46, type Schema47, type Schema48, type Schema49, type Schema5, type Schema50, type Schema51, type Schema52, type Schema53, type Schema54, type Schema55, type Schema56, type Schema57, type Schema58, type Schema59, type Schema6, type Schema60, type Schema61, type Schema62, type Schema63, type Schema64, type Schema65, type Schema66, type Schema67, type Schema68, type Schema69, type Schema7, type Schema70, type Schema71, type Schema72, type Schema73, type Schema74, type Schema75, type Schema76, type Schema77, type Schema78, type Schema79, type Schema8, type Schema80, type Schema81, type Schema82, type Schema83, type Schema84, type Schema85, type Schema86, type Schema87, type Schema88, type Schema89, type Schema9, type Schema90, type Schema91, type Schema92, type Schema93, type Schema94, type Schema95, type Schema96, type Schema97, type Schema98, type Schema99, type Server, type ServerAuthorization, type ServerAuthorizationOutput, type ServerCredentialsApiKeys, type ServerCredentialsOuth, type ServerOAuthClientConfiguration, type ServerOAuthClientConfigurationOutput, type ServerOAuthMetadata, type ServerOAuthMetadataOutput, type ServerVisibility, type SseTransportConfig, type SseTransportConfigOutput, type StdioTransportConfig, type StdioTransportConfigOutput, type V2CreateServerRequest, type V2ListServersResponse, type V2PatchServerRequest, type V2ServerDto, type V2UpdateServerRequest, deleteCredentialsById, deleteServersBySlug, getCredentials, getCredentialsById, getCredentialsByIdSecret, getServers, getServersBySlug, patchServersBySlug, postServers, putServersBySlug };
1
+ import { $ as ListCredentialsV2Responses, $a as Schema329, $i as Schema280, $n as Schema183, $o as Schema6, $r as Schema231, $s as ServerOAuthMetadata, $t as Schema134, A as GetCredentialAuditLogV2Responses, Aa as Schema308, Ai as Schema26, An as Schema162, Ao as Schema39, Ar as Schema210, As as Schema88, At as Schema113, B as HostedTransportConfig, Ba as Schema317, Bi as Schema269, Bn as Schema171, Bo as Schema48, Br as Schema22, Bs as Schema97, Bt as Schema122, C as DeleteCredentialV2Data, Ca as Schema301, Ci as Schema253, Cn as Schema156, Co as Schema350, Cr as Schema204, Cs as Schema81, Ct as Schema107, D as DeleteServerV2Responses, Da as Schema305, Di as Schema257, Dn as Schema16, Do as Schema36, Dr as Schema208, Ds as Schema85, Dt as Schema110, E as DeleteServerV2Data, Ea as Schema304, Ei as Schema256, En as Schema159, Eo as Schema353, Er as Schema207, Es as Schema84, Et as Schema11, F as GetCredentialV2Response, Fa as Schema312, Fi as Schema264, Fn as Schema167, Fo as Schema43, Fr as Schema215, Fs as Schema92, Ft as Schema118, G as HostedTransportTailscaleOutput, Ga as Schema321, Gi as Schema273, Gn as Schema176, Go as Schema52, Gr as Schema224, Gs as ServerAuthorizationOutput, Gt as Schema127, H as HostedTransportStorage, Ha as Schema319, Hi as Schema270, Hn as Schema173, Ho as Schema5, Hr as Schema221, Hs as Schema99, Ht as Schema124, I as GetCredentialV2Responses, Ia as Schema313, Ii as Schema265, In as Schema168, Io as Schema44, Ir as Schema216, Is as Schema93, It as Schema119, J as ListCredentialAuditLogsV2Data, Ja as Schema324, Ji as Schema276, Jn as Schema179, Jo as Schema55, Jr as Schema227, Js as ServerCredentialsOauthClientCredentials, Jt as Schema13, K as HttpStreamingTransportConfig, Ka as Schema322, Ki as Schema274, Kn as Schema177, Ko as Schema53, Kr as Schema225, Ks as ServerCredentialsApiKeys, Kt as Schema128, L as GetServerV2Data, La as Schema314, Li as Schema266, Ln as Schema169, Lo as Schema45, Lr as Schema217, Ls as Schema94, Lt as Schema12, M as GetCredentialSecretV2Response, Ma as Schema31, Mi as Schema261, Mn as Schema164, Mo as Schema40, Mr as Schema212, Ms as Schema9, Mt as Schema115, N as GetCredentialSecretV2Responses, Na as Schema310, Ni as Schema262, Nn as Schema165, No as Schema41, Nr as Schema213, Ns as Schema90, Nt as Schema116, O as GetCredentialAuditLogV2Data, Oa as Schema306, Oi as Schema258, On as Schema160, Oo as Schema37, Or as Schema209, Os as Schema86, Ot as Schema111, P as GetCredentialV2Data, Pa as Schema311, Pi as Schema263, Pn as Schema166, Po as Schema42, Pr as Schema214, Ps as Schema91, Pt as Schema117, Q as ListCredentialsV2Response, Qa as Schema328, Qi as Schema28, Qn as Schema182, Qo as Schema59, Qr as Schema230, Qs as ServerOAuthClientConfigurationOutput, Qt as Schema133, R as GetServerV2Response, Ra as Schema315, Ri as Schema267, Rn as Schema17, Ro as Schema46, Rr as Schema218, Rs as Schema95, Rt as Schema120, S as CredentialRefreshResponse, Sa as Schema300, Si as Schema252, Sn as Schema155, So as Schema35, Sr as Schema203, Ss as Schema80, St as Schema106, T as DeleteCredentialV2Responses, Ta as Schema303, Ti as Schema255, Tn as Schema158, To as Schema352, Tr as Schema206, Ts as Schema83, Tt as Schema109, U as HostedTransportStorageOutput, Ua as Schema32, Ui as Schema271, Un as Schema174, Uo as Schema50, Ur as Schema222, Us as Server, Ut as Schema125, V as HostedTransportConfigOutput, Va as Schema318, Vi as Schema27, Vn as Schema172, Vo as Schema49, Vr as Schema220, Vs as Schema98, Vt as Schema123, W as HostedTransportTailscale, Wa as Schema320, Wi as Schema272, Wn as Schema175, Wo as Schema51, Wr as Schema223, Ws as ServerAuthorization, Wt as Schema126, X as ListCredentialAuditLogsV2Responses, Xa as Schema326, Xi as Schema278, Xn as Schema180, Xo as Schema57, Xr as Schema229, Xs as ServerOAuthClientConfiguration, Xt as Schema131, Y as ListCredentialAuditLogsV2Response, Ya as Schema325, Yi as Schema277, Yn as Schema18, Yo as Schema56, Yr as Schema228, Ys as ServerCredentialsOauthTokens, Yt as Schema130, Z as ListCredentialsV2Data, Za as Schema327, Zi as Schema279, Zn as Schema181, Zo as Schema58, Zr as Schema23, Zs as ServerOAuthClientConfigurationClientCredentials, Zt as Schema132, _ as CreateServerV2Data, _a as Schema297, _c as V2PatchServerRequest, _i as Schema248, _n as Schema150, _o as Schema345, _r as Schema2, _s as Schema76, _t as Schema101, a as getCredentialAuditLogV2, aa as Schema286, ac as StdioTransportConfigOutput, ai as Schema237, an as Schema14, ao as Schema334, ar as Schema189, as as Schema65, at as OpenApiTransportConfigOutput, b as CredentialAuditLog, ba as Schema3, bi as Schema250, bn as Schema153, bo as Schema348, br as Schema201, bs as Schema79, bt as Schema104, c as getServerV2, ca as Schema289, cc as StdioTransportTailscale, ci as Schema24, cn as Schema142, co as Schema337, cr as Schema191, cs as Schema68, ct as PatchServerV2Response, d as listServersV2, da as Schema291, dc as ToolRefreshCredentialPolicyOutput, di as Schema242, dn as Schema145, do as Schema34, dr as Schema194, ds as Schema70, dt as RefreshCredentialV2Response, ea as Schema281, ec as ServerOAuthMetadataOutput, ei as Schema232, en as Schema135, eo as Schema33, er as Schema184, es as Schema60, et as ListServersV2Data, f as patchServerV2, fa as Schema292, fc as UpdateServerV2Data, fi as Schema243, fn as Schema146, fo as Schema340, fr as Schema195, fs as Schema71, ft as RefreshCredentialV2Responses, g as ClientOptions, ga as Schema296, gc as V2ListServersResponse, gi as Schema247, gn as Schema15, go as Schema344, gr as Schema199, gs as Schema75, gt as Schema100, h as updateServerV2, ha as Schema295, hc as V2CreateServerRequest, hi as Schema246, hn as Schema149, ho as Schema343, hr as Schema198, hs as Schema74, ht as Schema10, i as deleteServerV2, ia as Schema285, ic as StdioTransportConfig, ii as Schema236, in as Schema139, io as Schema333, ir as Schema188, is as Schema64, it as OpenApiTransportConfig, j as GetCredentialSecretV2Data, ja as Schema309, ji as Schema260, jn as Schema163, jo as Schema4, jr as Schema211, js as Schema89, jt as Schema114, k as GetCredentialAuditLogV2Response, ka as Schema307, ki as Schema259, kn as Schema161, ko as Schema38, kr as Schema21, ks as Schema87, kt as Schema112, l as listCredentialAuditLogsV2, la as Schema29, lc as StdioTransportTailscaleOutput, li as Schema240, ln as Schema143, lo as Schema338, lr as Schema192, ls as Schema69, lt as PatchServerV2Responses, ma as Schema294, mc as UpdateServerV2Responses, mi as Schema245, mn as Schema148, mo as Schema342, mr as Schema197, ms as Schema73, mt as Schema1, n as createServerV2, na as Schema283, nc as SseTransportConfig, ni as Schema234, nn as Schema137, no as Schema331, nr as Schema186, ns as Schema62, nt as ListServersV2Responses, o as getCredentialSecretV2, oa as Schema287, oc as StdioTransportStorage, oi as Schema238, on as Schema140, oo as Schema335, or as Schema19, os as Schema66, ot as PaginatedCredentialAuditLog, p as refreshCredentialV2, pa as Schema293, pc as UpdateServerV2Response, pi as Schema244, pn as Schema147, po as Schema341, pr as Schema196, ps as Schema72, pt as Schema0, q as HttpStreamingTransportConfigOutput, qa as Schema323, qi as Schema275, qn as Schema178, qo as Schema54, qr as Schema226, qs as ServerCredentialsCredential, qt as Schema129, r as deleteCredentialV2, ra as Schema284, rc as SseTransportConfigOutput, ri as Schema235, rn as Schema138, ro as Schema332, rr as Schema187, rs as Schema63, rt as OAuthGrantType, s as getCredentialV2, sa as Schema288, sc as StdioTransportStorageOutput, si as Schema239, sn as Schema141, so as Schema336, sr as Schema190, ss as Schema67, st as PatchServerV2Data, t as Options, ta as Schema282, tc as ServerVisibility, ti as Schema233, tn as Schema136, to as Schema330, tr as Schema185, ts as Schema61, tt as ListServersV2Response, u as listCredentialsV2, ua as Schema290, uc as ToolRefreshCredentialPolicy, ui as Schema241, un as Schema144, uo as Schema339, ur as Schema193, us as Schema7, ut as RefreshCredentialV2Data, v as CreateServerV2Response, va as Schema298, vc as V2ServerDto, vi as Schema249, vn as Schema151, vo as Schema346, vr as Schema20, vs as Schema77, vt as Schema102, w as DeleteCredentialV2Response, wa as Schema302, wi as Schema254, wn as Schema157, wo as Schema351, wr as Schema205, ws as Schema82, wt as Schema108, x as CredentialDtoV2, xa as Schema30, xi as Schema251, xn as Schema154, xo as Schema349, xr as Schema202, xs as Schema8, xt as Schema105, y as CreateServerV2Responses, ya as Schema299, yc as V2UpdateServerRequest, yi as Schema25, yn as Schema152, yo as Schema347, yr as Schema200, ys as Schema78, yt as Schema103, z as GetServerV2Responses, za as Schema316, zi as Schema268, zn as Schema170, zo as Schema47, zr as Schema219, zs as Schema96, zt as Schema121 } from "../sdk.gen-Crii0E1f.mjs";
2
+ export { type ClientOptions, type CreateServerV2Data, type CreateServerV2Response, type CreateServerV2Responses, type CredentialAuditLog, type CredentialDtoV2, type CredentialRefreshResponse, type DeleteCredentialV2Data, type DeleteCredentialV2Response, type DeleteCredentialV2Responses, type DeleteServerV2Data, type DeleteServerV2Responses, type GetCredentialAuditLogV2Data, type GetCredentialAuditLogV2Response, type GetCredentialAuditLogV2Responses, type GetCredentialSecretV2Data, type GetCredentialSecretV2Response, type GetCredentialSecretV2Responses, type GetCredentialV2Data, type GetCredentialV2Response, type GetCredentialV2Responses, type GetServerV2Data, type GetServerV2Response, type GetServerV2Responses, type HostedTransportConfig, type HostedTransportConfigOutput, type HostedTransportStorage, type HostedTransportStorageOutput, type HostedTransportTailscale, type HostedTransportTailscaleOutput, type HttpStreamingTransportConfig, type HttpStreamingTransportConfigOutput, type ListCredentialAuditLogsV2Data, type ListCredentialAuditLogsV2Response, type ListCredentialAuditLogsV2Responses, type ListCredentialsV2Data, type ListCredentialsV2Response, type ListCredentialsV2Responses, type ListServersV2Data, type ListServersV2Response, type ListServersV2Responses, type OAuthGrantType, type OpenApiTransportConfig, type OpenApiTransportConfigOutput, type Options, type PaginatedCredentialAuditLog, type PatchServerV2Data, type PatchServerV2Response, type PatchServerV2Responses, type RefreshCredentialV2Data, type RefreshCredentialV2Response, type RefreshCredentialV2Responses, type Schema0, type Schema1, type Schema10, type Schema100, type Schema101, type Schema102, type Schema103, type Schema104, type Schema105, type Schema106, type Schema107, type Schema108, type Schema109, type Schema11, type Schema110, type Schema111, type Schema112, type Schema113, type Schema114, type Schema115, type Schema116, type Schema117, type Schema118, type Schema119, type Schema12, type Schema120, type Schema121, type Schema122, type Schema123, type Schema124, type Schema125, type Schema126, type Schema127, type Schema128, type Schema129, type Schema13, type Schema130, type Schema131, type Schema132, type Schema133, type Schema134, type Schema135, type Schema136, type Schema137, type Schema138, type Schema139, type Schema14, type Schema140, type Schema141, type Schema142, type Schema143, type Schema144, type Schema145, type Schema146, type Schema147, type Schema148, type Schema149, type Schema15, type Schema150, type Schema151, type Schema152, type Schema153, type Schema154, type Schema155, type Schema156, type Schema157, type Schema158, type Schema159, type Schema16, type Schema160, type Schema161, type Schema162, type Schema163, type Schema164, type Schema165, type Schema166, type Schema167, type Schema168, type Schema169, type Schema17, type Schema170, type Schema171, type Schema172, type Schema173, type Schema174, type Schema175, type Schema176, type Schema177, type Schema178, type Schema179, type Schema18, type Schema180, type Schema181, type Schema182, type Schema183, type Schema184, type Schema185, type Schema186, type Schema187, type Schema188, type Schema189, type Schema19, type Schema190, type Schema191, type Schema192, type Schema193, type Schema194, type Schema195, type Schema196, type Schema197, type Schema198, type Schema199, type Schema2, type Schema20, type Schema200, type Schema201, type Schema202, type Schema203, type Schema204, type Schema205, type Schema206, type Schema207, type Schema208, type Schema209, type Schema21, type Schema210, type Schema211, type Schema212, type Schema213, type Schema214, type Schema215, type Schema216, type Schema217, type Schema218, type Schema219, type Schema22, type Schema220, type Schema221, type Schema222, type Schema223, type Schema224, type Schema225, type Schema226, type Schema227, type Schema228, type Schema229, type Schema23, type Schema230, type Schema231, type Schema232, type Schema233, type Schema234, type Schema235, type Schema236, type Schema237, type Schema238, type Schema239, type Schema24, type Schema240, type Schema241, type Schema242, type Schema243, type Schema244, type Schema245, type Schema246, type Schema247, type Schema248, type Schema249, type Schema25, type Schema250, type Schema251, type Schema252, type Schema253, type Schema254, type Schema255, type Schema256, type Schema257, type Schema258, type Schema259, type Schema26, type Schema260, type Schema261, type Schema262, type Schema263, type Schema264, type Schema265, type Schema266, type Schema267, type Schema268, type Schema269, type Schema27, type Schema270, type Schema271, type Schema272, type Schema273, type Schema274, type Schema275, type Schema276, type Schema277, type Schema278, type Schema279, type Schema28, type Schema280, type Schema281, type Schema282, type Schema283, type Schema284, type Schema285, type Schema286, type Schema287, type Schema288, type Schema289, type Schema29, type Schema290, type Schema291, type Schema292, type Schema293, type Schema294, type Schema295, type Schema296, type Schema297, type Schema298, type Schema299, type Schema3, type Schema30, type Schema300, type Schema301, type Schema302, type Schema303, type Schema304, type Schema305, type Schema306, type Schema307, type Schema308, type Schema309, type Schema31, type Schema310, type Schema311, type Schema312, type Schema313, type Schema314, type Schema315, type Schema316, type Schema317, type Schema318, type Schema319, type Schema32, type Schema320, type Schema321, type Schema322, type Schema323, type Schema324, type Schema325, type Schema326, type Schema327, type Schema328, type Schema329, type Schema33, type Schema330, type Schema331, type Schema332, type Schema333, type Schema334, type Schema335, type Schema336, type Schema337, type Schema338, type Schema339, type Schema34, type Schema340, type Schema341, type Schema342, type Schema343, type Schema344, type Schema345, type Schema346, type Schema347, type Schema348, type Schema349, type Schema35, type Schema350, type Schema351, type Schema352, type Schema353, type Schema36, type Schema37, type Schema38, type Schema39, type Schema4, type Schema40, type Schema41, type Schema42, type Schema43, type Schema44, type Schema45, type Schema46, type Schema47, type Schema48, type Schema49, type Schema5, type Schema50, type Schema51, type Schema52, type Schema53, type Schema54, type Schema55, type Schema56, type Schema57, type Schema58, type Schema59, type Schema6, type Schema60, type Schema61, type Schema62, type Schema63, type Schema64, type Schema65, type Schema66, type Schema67, type Schema68, type Schema69, type Schema7, type Schema70, type Schema71, type Schema72, type Schema73, type Schema74, type Schema75, type Schema76, type Schema77, type Schema78, type Schema79, type Schema8, type Schema80, type Schema81, type Schema82, type Schema83, type Schema84, type Schema85, type Schema86, type Schema87, type Schema88, type Schema89, type Schema9, type Schema90, type Schema91, type Schema92, type Schema93, type Schema94, type Schema95, type Schema96, type Schema97, type Schema98, type Schema99, type Server, type ServerAuthorization, type ServerAuthorizationOutput, type ServerCredentialsApiKeys, type ServerCredentialsCredential, type ServerCredentialsOauthClientCredentials, type ServerCredentialsOauthTokens, type ServerOAuthClientConfiguration, type ServerOAuthClientConfigurationClientCredentials, type ServerOAuthClientConfigurationOutput, type ServerOAuthMetadata, type ServerOAuthMetadataOutput, type ServerVisibility, type SseTransportConfig, type SseTransportConfigOutput, type StdioTransportConfig, type StdioTransportConfigOutput, type StdioTransportStorage, type StdioTransportStorageOutput, type StdioTransportTailscale, type StdioTransportTailscaleOutput, type ToolRefreshCredentialPolicy, type ToolRefreshCredentialPolicyOutput, type UpdateServerV2Data, type UpdateServerV2Response, type UpdateServerV2Responses, type V2CreateServerRequest, type V2ListServersResponse, type V2PatchServerRequest, type V2ServerDto, type V2UpdateServerRequest, createServerV2, deleteCredentialV2, deleteServerV2, getCredentialAuditLogV2, getCredentialSecretV2, getCredentialV2, getServerV2, listCredentialAuditLogsV2, listCredentialsV2, listServersV2, patchServerV2, refreshCredentialV2, updateServerV2 };
@@ -1,3 +1,3 @@
1
- import { a as getCredentialsByIdSecret, c as patchServersBySlug, i as getCredentialsById, l as postServers, n as deleteServersBySlug, o as getServers, r as getCredentials, s as getServersBySlug, t as deleteCredentialsById, u as putServersBySlug } from "../sdk.gen-DUNHa0uM.mjs";
1
+ import { a as getCredentialSecretV2, c as listCredentialAuditLogsV2, d as patchServerV2, f as refreshCredentialV2, i as getCredentialAuditLogV2, l as listCredentialsV2, m as updateServerV2, n as deleteCredentialV2, o as getCredentialV2, r as deleteServerV2, s as getServerV2, t as createServerV2, u as listServersV2 } from "../sdk.gen-CAAxLIvj.mjs";
2
2
 
3
- export { deleteCredentialsById, deleteServersBySlug, getCredentials, getCredentialsById, getCredentialsByIdSecret, getServers, getServersBySlug, patchServersBySlug, postServers, putServersBySlug };
3
+ export { createServerV2, deleteCredentialV2, deleteServerV2, getCredentialAuditLogV2, getCredentialSecretV2, getCredentialV2, getServerV2, listCredentialAuditLogsV2, listCredentialsV2, listServersV2, patchServerV2, refreshCredentialV2, updateServerV2 };
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-uaV2rQ02.cjs');
3
- const require_sdk_gen = require('./sdk.gen-DncK4XW4.cjs');
3
+ const require_sdk_gen = require('./sdk.gen-CyOAEozT.cjs');
4
4
  const require_config = require('./config.cjs');
5
- const require_sdk_gen$1 = require('./sdk.gen-BMl_z1y-.cjs');
5
+ const require_sdk_gen$1 = require('./sdk.gen-Cdv7MDsj.cjs');
6
6
  let debug = require("debug");
7
7
  debug = require_chunk.__toESM(debug);
8
8
  let openid_client = require("openid-client");
@@ -17,13 +17,13 @@ var Gatana2 = class {
17
17
  api = require_sdk_gen$1.sdk_gen_exports;
18
18
  config;
19
19
  constructor(arg) {
20
- const configLoader = arg?.configLoader || new ConfigLoader([
20
+ const configLoader = !arg?.config && arg?.configLoader || new ConfigLoader([
21
21
  new OptionsConfigStrategy(arg?.options),
22
22
  new EnvConfigStrategy(),
23
23
  new FileConfigStrategy()
24
24
  ]);
25
25
  try {
26
- this.config = configLoader.getConfig();
26
+ this.config = arg?.config || configLoader.getConfig();
27
27
  const clientConfig = {
28
28
  baseUrl: new URL("/api/v2/", this.config.baseUrl).toString(),
29
29
  auth: this.config.token
@@ -31,7 +31,7 @@ var Gatana2 = class {
31
31
  require_sdk_gen$1.client.setConfig(clientConfig);
32
32
  const debugHttp = (0, debug.default)("gatana:http");
33
33
  require_sdk_gen$1.client.interceptors.request.use((request) => {
34
- debugHttp(`→ ${request.method} ${request.url}`);
34
+ debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });
35
35
  return request;
36
36
  });
37
37
  require_sdk_gen$1.client.interceptors.response.use((response, request) => {
@@ -42,7 +42,7 @@ var Gatana2 = class {
42
42
  debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);
43
43
  return error;
44
44
  });
45
- debug$2("Gatana initialized with config", clientConfig);
45
+ debug$2("Gatana v2 initialized with config", clientConfig);
46
46
  } catch (error) {
47
47
  debug$2("Failed to initialize", error);
48
48
  if (arg?.isCli && error.message === "No valid configuration found from any strategy") {
@@ -137,12 +137,13 @@ var FileConfigStrategy = class extends ConfigStrategy {
137
137
  try {
138
138
  const token = await openid_client.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);
139
139
  if (token) {
140
- require_config.setOrganizationConfig(orgId, { tokens: {
140
+ tenantConfig.tokens = {
141
141
  access_token: token.access_token,
142
142
  refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,
143
143
  expires_at: token.expires_in ? Math.floor(Date.now() / 1e3) + token.expires_in : 0
144
- } });
145
- debug$1("Token refreshed successfully");
144
+ };
145
+ require_config.setOrganizationConfig(orgId, { tokens: tenantConfig.tokens });
146
+ debug$1("Token refreshed successfully", { token });
146
147
  return token.access_token;
147
148
  }
148
149
  } catch (error) {
@@ -159,13 +160,13 @@ var Gatana = class {
159
160
  api = require_sdk_gen.sdk_gen_exports;
160
161
  config;
161
162
  constructor(arg) {
162
- const configLoader = arg?.configLoader || new ConfigLoader([
163
+ const configLoader = !arg?.config && arg?.configLoader || new ConfigLoader([
163
164
  new OptionsConfigStrategy(arg?.options),
164
165
  new EnvConfigStrategy(),
165
166
  new FileConfigStrategy()
166
167
  ]);
167
168
  try {
168
- this.config = configLoader.getConfig();
169
+ this.config = arg?.config || configLoader.getConfig();
169
170
  const clientConfig = {
170
171
  baseUrl: new URL("/api/v1/", this.config.baseUrl).toString(),
171
172
  auth: this.config.token
@@ -173,7 +174,7 @@ var Gatana = class {
173
174
  require_sdk_gen.client.setConfig(clientConfig);
174
175
  const debugHttp = (0, debug.default)("gatana:http");
175
176
  require_sdk_gen.client.interceptors.request.use((request) => {
176
- debugHttp(`→ ${request.method} ${request.url}`);
177
+ debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });
177
178
  return request;
178
179
  });
179
180
  require_sdk_gen.client.interceptors.response.use((response, request) => {
@@ -184,7 +185,7 @@ var Gatana = class {
184
185
  debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);
185
186
  return error;
186
187
  });
187
- debug$1("Gatana initialized with config", clientConfig);
188
+ debug$1("Gatana v1 initialized with config", clientConfig);
188
189
  } catch (error) {
189
190
  debug$1("Failed to initialize", error);
190
191
  if (arg?.isCli && error.message === "No valid configuration found from any strategy") {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { gn as sdk_gen_d_exports } from "./sdk.gen-Bp6WOiGq.cjs";
2
- import { f as sdk_gen_d_exports$1 } from "./sdk.gen-DjFHZqZ0.cjs";
1
+ import { Dn as sdk_gen_d_exports } from "./sdk.gen-aJw0bLkG.cjs";
2
+ import { m as sdk_gen_d_exports$1 } from "./sdk.gen-Do_HFvZj.cjs";
3
3
 
4
4
  //#region src/v2.d.ts
5
5
  /**
@@ -10,6 +10,7 @@ declare class Gatana2 {
10
10
  readonly config: GatanaConfig;
11
11
  constructor(arg?: {
12
12
  options?: GatanaOptions;
13
+ config?: GatanaConfig;
13
14
  configLoader?: ConfigLoader;
14
15
  isCli?: boolean;
15
16
  });
@@ -72,6 +73,7 @@ declare class Gatana {
72
73
  config: GatanaConfig;
73
74
  constructor(arg?: {
74
75
  options?: GatanaOptions;
76
+ config?: GatanaConfig;
75
77
  configLoader?: ConfigLoader;
76
78
  isCli?: boolean;
77
79
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/v2.ts","../src/index.ts"],"mappings":";;;;;;AAiBA;cAAa,OAAA;EACJ,GAAA,SAAG,mBAAA;EAAA,SACM,MAAA,EAAQ,YAAA;cACZ,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;EA8C1E,iBAAA,CAAA;AAAA;;;UC1De,aAAA;EACf,MAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,KAGU,YAAA;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AAA,CAAA,GAAa,YAAA;AAAA;AAAA,uBAWO,cAAA;EAAA,SACX,SAAA,CAAA;IAAe,KAAA;IAAe,OAAA;IAAiB,KAAA,QAAa,OAAA;EAAA;EAAA,SAC5D,IAAA;AAAA;AAAA,cAGE,qBAAA,SAA8B,cAAA;EAAA,QACrB,OAAA;cAAA,OAAA,GAAU,aAAA;EAIvB,IAAA;EAIP,SAAA,CAAA;;;;;;cAiBW,iBAAA,SAA0B,cAAA;EAC9B,IAAA;EAKP,SAAA,CAAA;;;iBAN6B,OAAA;EAAA;AAAA;AAAA,cAqBlB,kBAAA,SAA2B,cAAA;EAAA,QAClB,KAAA;cAAA,KAAA;EAIb,IAAA;EAKP,SAAA,CAAA;;;iBAV8B,OAAA;EAAA;AAAA;AAAA,cAiEnB,MAAA;EACJ,GAAA,SAAG,iBAAA;EACH,MAAA,EAAQ,YAAA;cACH,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,MAAA,GAAS,YAAA;IAAc,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;AAAA"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { gn as sdk_gen_d_exports } from "./sdk.gen-DgXGgJek.mjs";
2
- import { f as sdk_gen_d_exports$1 } from "./sdk.gen-B9VM8vvh.mjs";
1
+ import { Dn as sdk_gen_d_exports } from "./sdk.gen-C2b2ZNMj.mjs";
2
+ import { m as sdk_gen_d_exports$1 } from "./sdk.gen-Crii0E1f.mjs";
3
3
 
4
4
  //#region src/v2.d.ts
5
5
  /**
@@ -10,6 +10,7 @@ declare class Gatana2 {
10
10
  readonly config: GatanaConfig;
11
11
  constructor(arg?: {
12
12
  options?: GatanaOptions;
13
+ config?: GatanaConfig;
13
14
  configLoader?: ConfigLoader;
14
15
  isCli?: boolean;
15
16
  });
@@ -72,6 +73,7 @@ declare class Gatana {
72
73
  config: GatanaConfig;
73
74
  constructor(arg?: {
74
75
  options?: GatanaOptions;
76
+ config?: GatanaConfig;
75
77
  configLoader?: ConfigLoader;
76
78
  isCli?: boolean;
77
79
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/v2.ts","../src/index.ts"],"mappings":";;;;;;AAiBA;cAAa,OAAA;EACJ,GAAA,SAAG,mBAAA;EAAA,SACM,MAAA,EAAQ,YAAA;cACZ,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;EA8C1E,iBAAA,CAAA;AAAA;;;UC1De,aAAA;EACf,MAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,KAGU,YAAA;EAAiB,OAAA;EAAiB,KAAA,QAAa,OAAA;AAAA;AAAA,cAC9C,YAAA;EAAA,SACiB,UAAA,EAAY,cAAA;cAAZ,UAAA,EAAY,cAAA;EAExC,SAAA,CAAA,GAAa,YAAA;AAAA;AAAA,uBAWO,cAAA;EAAA,SACX,SAAA,CAAA;IAAe,KAAA;IAAe,OAAA;IAAiB,KAAA,QAAa,OAAA;EAAA;EAAA,SAC5D,IAAA;AAAA;AAAA,cAGE,qBAAA,SAA8B,cAAA;EAAA,QACrB,OAAA;cAAA,OAAA,GAAU,aAAA;EAIvB,IAAA;EAIP,SAAA,CAAA;;;;;;cAiBW,iBAAA,SAA0B,cAAA;EAC9B,IAAA;EAKP,SAAA,CAAA;;;iBAN6B,OAAA;EAAA;AAAA;AAAA,cAqBlB,kBAAA,SAA2B,cAAA;EAAA,QAClB,KAAA;cAAA,KAAA;EAIb,IAAA;EAKP,SAAA,CAAA;;;iBAV8B,OAAA;EAAA;AAAA;AAAA,cAgEnB,MAAA;EACJ,GAAA,SAAG,iBAAA;EACH,MAAA,EAAQ,YAAA;cACH,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/v2.ts","../src/index.ts"],"mappings":";;;;;;AAiBA;cAAa,OAAA;EACJ,GAAA,SAAG,mBAAA;EAAA,SACM,MAAA,EAAQ,YAAA;cACZ,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,MAAA,GAAS,YAAA;IAAc,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;EA8CjG,iBAAA,CAAA;AAAA;;;UC1De,aAAA;EACf,MAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,KAGU,YAAA;EAAiB,OAAA;EAAiB,KAAA,QAAa,OAAA;AAAA;AAAA,cAC9C,YAAA;EAAA,SACiB,UAAA,EAAY,cAAA;cAAZ,UAAA,EAAY,cAAA;EAExC,SAAA,CAAA,GAAa,YAAA;AAAA;AAAA,uBAWO,cAAA;EAAA,SACX,SAAA,CAAA;IAAe,KAAA;IAAe,OAAA;IAAiB,KAAA,QAAa,OAAA;EAAA;EAAA,SAC5D,IAAA;AAAA;AAAA,cAGE,qBAAA,SAA8B,cAAA;EAAA,QACrB,OAAA;cAAA,OAAA,GAAU,aAAA;EAIvB,IAAA;EAIP,SAAA,CAAA;;;;;;cAiBW,iBAAA,SAA0B,cAAA;EAC9B,IAAA;EAKP,SAAA,CAAA;;;iBAN6B,OAAA;EAAA;AAAA;AAAA,cAqBlB,kBAAA,SAA2B,cAAA;EAAA,QAClB,KAAA;cAAA,KAAA;EAIb,IAAA;EAKP,SAAA,CAAA;;;iBAV8B,OAAA;EAAA;AAAA;AAAA,cAiEnB,MAAA;EACJ,GAAA,SAAG,iBAAA;EACH,MAAA,EAAQ,YAAA;cACH,GAAA;IAAQ,OAAA,GAAU,aAAA;IAAe,MAAA,GAAS,YAAA;IAAc,YAAA,GAAe,YAAA;IAAc,KAAA;EAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { gn as client, hn as sdk_gen_exports } from "./sdk.gen-BzFbgKkw.mjs";
1
+ import { En as sdk_gen_exports, nr as client } from "./sdk.gen-OcCJ7VK7.mjs";
2
2
  import { extractTenantFromUrl, getDefaultOrganization, getOrganization, setOrganizationConfig } from "./config.mjs";
3
- import { d as sdk_gen_exports$1, f as client$1 } from "./sdk.gen-DUNHa0uM.mjs";
3
+ import { h as client$1, p as sdk_gen_exports$1 } from "./sdk.gen-CAAxLIvj.mjs";
4
4
  import createDebug from "debug";
5
5
  import * as openidClient from "openid-client";
6
6
 
@@ -13,13 +13,13 @@ var Gatana2 = class {
13
13
  api = sdk_gen_exports$1;
14
14
  config;
15
15
  constructor(arg) {
16
- const configLoader = arg?.configLoader || new ConfigLoader([
16
+ const configLoader = !arg?.config && arg?.configLoader || new ConfigLoader([
17
17
  new OptionsConfigStrategy(arg?.options),
18
18
  new EnvConfigStrategy(),
19
19
  new FileConfigStrategy()
20
20
  ]);
21
21
  try {
22
- this.config = configLoader.getConfig();
22
+ this.config = arg?.config || configLoader.getConfig();
23
23
  const clientConfig = {
24
24
  baseUrl: new URL("/api/v2/", this.config.baseUrl).toString(),
25
25
  auth: this.config.token
@@ -27,7 +27,7 @@ var Gatana2 = class {
27
27
  client$1.setConfig(clientConfig);
28
28
  const debugHttp = createDebug("gatana:http");
29
29
  client$1.interceptors.request.use((request) => {
30
- debugHttp(`→ ${request.method} ${request.url}`);
30
+ debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });
31
31
  return request;
32
32
  });
33
33
  client$1.interceptors.response.use((response, request) => {
@@ -38,7 +38,7 @@ var Gatana2 = class {
38
38
  debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);
39
39
  return error;
40
40
  });
41
- debug$1("Gatana initialized with config", clientConfig);
41
+ debug$1("Gatana v2 initialized with config", clientConfig);
42
42
  } catch (error) {
43
43
  debug$1("Failed to initialize", error);
44
44
  if (arg?.isCli && error.message === "No valid configuration found from any strategy") {
@@ -133,12 +133,13 @@ var FileConfigStrategy = class extends ConfigStrategy {
133
133
  try {
134
134
  const token = await openidClient.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);
135
135
  if (token) {
136
- setOrganizationConfig(orgId, { tokens: {
136
+ tenantConfig.tokens = {
137
137
  access_token: token.access_token,
138
138
  refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,
139
139
  expires_at: token.expires_in ? Math.floor(Date.now() / 1e3) + token.expires_in : 0
140
- } });
141
- debug("Token refreshed successfully");
140
+ };
141
+ setOrganizationConfig(orgId, { tokens: tenantConfig.tokens });
142
+ debug("Token refreshed successfully", { token });
142
143
  return token.access_token;
143
144
  }
144
145
  } catch (error) {
@@ -155,13 +156,13 @@ var Gatana = class {
155
156
  api = sdk_gen_exports;
156
157
  config;
157
158
  constructor(arg) {
158
- const configLoader = arg?.configLoader || new ConfigLoader([
159
+ const configLoader = !arg?.config && arg?.configLoader || new ConfigLoader([
159
160
  new OptionsConfigStrategy(arg?.options),
160
161
  new EnvConfigStrategy(),
161
162
  new FileConfigStrategy()
162
163
  ]);
163
164
  try {
164
- this.config = configLoader.getConfig();
165
+ this.config = arg?.config || configLoader.getConfig();
165
166
  const clientConfig = {
166
167
  baseUrl: new URL("/api/v1/", this.config.baseUrl).toString(),
167
168
  auth: this.config.token
@@ -169,7 +170,7 @@ var Gatana = class {
169
170
  client.setConfig(clientConfig);
170
171
  const debugHttp = createDebug("gatana:http");
171
172
  client.interceptors.request.use((request) => {
172
- debugHttp(`→ ${request.method} ${request.url}`);
173
+ debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });
173
174
  return request;
174
175
  });
175
176
  client.interceptors.response.use((response, request) => {
@@ -180,7 +181,7 @@ var Gatana = class {
180
181
  debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);
181
182
  return error;
182
183
  });
183
- debug("Gatana initialized with config", clientConfig);
184
+ debug("Gatana v1 initialized with config", clientConfig);
184
185
  } catch (error) {
185
186
  debug("Failed to initialize", error);
186
187
  if (arg?.isCli && error.message === "No valid configuration found from any strategy") {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["debug","sdk","sdk"],"sources":["../src/v2.ts","../src/index.ts"],"sourcesContent":["import { client } from './apiv2/client.gen.js';\nimport * as sdk from './apiv2/sdk.gen.js';\nimport createDebug from 'debug';\nimport { Config } from './api/client/types.gen.js';\nimport {\n ConfigLoader,\n EnvConfigStrategy,\n FileConfigStrategy,\n GatanaConfig,\n GatanaOptions,\n OptionsConfigStrategy,\n} from './index.js';\nconst debug = createDebug('gatana');\n\n/**\n * Gatana2 is representing a more REST-ful API where the object returned from GET can be used directly in POST/PUT/PATCH requests.\n */\nexport class Gatana2 {\n public api = sdk;\n public readonly config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v2/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n\n getOpenApiSpecUrl() {\n return new URL('/api/v2/openapi.json', this.config.baseUrl).toString();\n }\n}\n","import { client } from './api/client.gen.js';\nimport * as sdk from './api/sdk.gen.js';\nimport createDebug from 'debug';\nimport { getOrganization, getDefaultOrganization, setOrganizationConfig, extractTenantFromUrl } from './config.js';\nimport * as openidClient from 'openid-client';\nimport { Config } from './api/client/types.gen.js';\nconst debug = createDebug('gatana');\n\nexport interface GatanaOptions {\n apiKey: string;\n orgId?: string;\n baseUrl?: string;\n}\n\nexport type GatanaConfig = { baseUrl: string; token: () => Promise<string> };\nexport class ConfigLoader {\n constructor(public readonly strategies: ConfigStrategy[]) {}\n\n getConfig(): GatanaConfig {\n for (const strategy of this.strategies) {\n const config = strategy.getConfig();\n if (config) {\n return config;\n }\n }\n throw new Error('No valid configuration found from any strategy');\n }\n}\n\nexport abstract class ConfigStrategy {\n abstract getConfig(): { orgId: string; baseUrl: string; token: () => Promise<string> } | null;\n abstract help: string;\n}\n\nexport class OptionsConfigStrategy extends ConfigStrategy {\n constructor(private options?: GatanaOptions) {\n super();\n }\n\n public help =\n `OptionsConfigStrategy: Provide configuration via Gatana constructor options. ` +\n `Example: new Gatana({ options }) where options includes apiKey and orgId or baseUrl.`;\n\n getConfig() {\n if (!this.options) {\n return null;\n }\n if (this.options.apiKey && (this.options.orgId || this.options.baseUrl)) {\n const key = this.options.apiKey;\n const baseUrl = this.options.baseUrl || `https://${this.options.orgId}.gatana.ai`;\n return {\n orgId: this.options.orgId!,\n baseUrl,\n token: async () => key,\n };\n }\n return null;\n }\n}\n\nexport class EnvConfigStrategy extends ConfigStrategy {\n public help =\n `EnvConfigStrategy: Provide configuration via environment variables. ` +\n `Required: GATANA_API_KEY and either GATANA_ORG_ID or GATANA_BASE_URL. ` +\n `Example: export GATANA_API_KEY=your_api_key; export GATANA_ORG_ID=your_org_id`;\n\n getConfig() {\n const apiKey = process.env.GATANA_API_KEY;\n const orgId = process.env.GATANA_ORG_ID;\n const overrideBaseUrl = process.env.GATANA_BASE_URL;\n if (apiKey && (orgId || overrideBaseUrl)) {\n return {\n orgId: orgId || extractTenantFromUrl(overrideBaseUrl!),\n baseUrl: overrideBaseUrl || `https://${orgId}.gatana.ai`,\n token: async () => apiKey,\n };\n }\n return null;\n }\n}\n\nexport class FileConfigStrategy extends ConfigStrategy {\n constructor(private orgId?: string) {\n super();\n }\n\n public help =\n `FileConfigStrategy: Provide configuration via a local config file. Use the ` +\n `\"gatana config\" commands to manage this configuration. The CLI will look for the default ` +\n `organization in the config file or use the org specified by GATANA_ORG_ID env var.`;\n\n getConfig() {\n let orgId = this.orgId || process.env.GATANA_ORG_ID || getDefaultOrganization();\n if (!orgId) {\n return null;\n }\n debug(`FileConfigLoader loading config for orgId=${orgId}`);\n const tenantConfig = getOrganization(orgId);\n debug(tenantConfig);\n if (!tenantConfig) {\n return null;\n }\n return {\n orgId,\n baseUrl: tenantConfig.baseUrl,\n token: async () => {\n if (tenantConfig?.pat) {\n return tenantConfig.pat;\n } else if (\n tenantConfig?.tokens?.access_token &&\n tenantConfig.tokens.expires_at &&\n tenantConfig.tokens.expires_at > Math.floor(Date.now() / 1000) + 60\n ) {\n return tenantConfig.tokens.access_token;\n } else if (tenantConfig.tokens?.refresh_token) {\n debug('Access token expired or about to expire, attempting to refresh');\n // Try to refresh the token\n const config = await openidClient.discovery(\n new URL(`/.well-known/openid-configuration`, tenantConfig.baseUrl),\n `${orgId}-cli`\n );\n try {\n const token = await openidClient.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);\n if (token) {\n setOrganizationConfig(orgId, {\n tokens: {\n access_token: token.access_token,\n refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,\n expires_at: token.expires_in ? Math.floor(Date.now() / 1000) + token.expires_in : 0,\n },\n });\n debug('Token refreshed successfully');\n return token.access_token;\n }\n } catch (error) {\n debug('Failed to refresh token', error);\n throw new Error(`Failed to refresh access token. Please log in again. (${(error as Error).message})`);\n }\n }\n throw new Error('No valid API key, access token or refresh token available.');\n },\n };\n }\n}\n\nexport class Gatana {\n public api = sdk;\n public config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n arg?.configLoader ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v1/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`);\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n}\n\nexport { Gatana2 } from './v2.js';\n"],"mappings":";;;;;;;AAYA,MAAMA,UAAQ,YAAY,SAAS;;;;AAKnC,IAAa,UAAb,MAAqB;CACnB,AAAO,MAAMC;CACb,AAAgB;CAChB,YAAY,KAAiF;EAE3F,MAAM,eACJ,KAAK,gBACL,IAAI,aAAa;GAAC,IAAI,sBAAsB,KAAK,QAAQ;GAAE,IAAI,mBAAmB;GAAE,IAAI,oBAAoB;GAAC,CAAC;AAEhH,MAAI;AACF,QAAK,SAAS,aAAa,WAAW;GAEtC,MAAM,eAAe;IACnB,SAAS,IAAI,IAAI,YAAY,KAAK,OAAO,Q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AAG,QAAQ,OAAO,GAAG,QAAQ,OAAO,MAAM;AAChG,WAAO;KACP;AAEF,SAAM,kCAAkC,aAAa;WAC9C,OAAY;AACnB,SAAM,wBAAwB,MAAM;AACpC,OAAI,KAAK,SAAS,MAAM,YAAY,kDAAkD;AACpF,YAAQ,MAAM,iGAA+F;AAC7G,SAAK,SAAS;KACZ,SAAS;KACT,OAAO,YAAY;KACpB;UACI;AACL,YAAQ,MAAM,8BAA8B,MAAM,QAAQ;AAC1D,YAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"index.mjs","names":["debug","sdk","sdk"],"sources":["../src/v2.ts","../src/index.ts"],"sourcesContent":["import { client } from './apiv2/client.gen.js';\nimport * as sdk from './apiv2/sdk.gen.js';\nimport createDebug from 'debug';\nimport { Config } from './api/client/types.gen.js';\nimport {\n ConfigLoader,\n EnvConfigStrategy,\n FileConfigStrategy,\n GatanaConfig,\n GatanaOptions,\n OptionsConfigStrategy,\n} from './index.js';\nconst debug = createDebug('gatana');\n\n/**\n * Gatana2 is representing a more REST-ful API where the object returned from GET can be used directly in POST/PUT/PATCH requests.\n */\nexport class Gatana2 {\n public api = sdk;\n public readonly config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; config?: GatanaConfig; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n (!arg?.config && arg?.configLoader) ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = arg?.config || configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v2/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana v2 initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n\n getOpenApiSpecUrl() {\n return new URL('/api/v2/openapi.json', this.config.baseUrl).toString();\n }\n}\n","import { client } from './api/client.gen.js';\nimport * as sdk from './api/sdk.gen.js';\nimport createDebug from 'debug';\nimport { getOrganization, getDefaultOrganization, setOrganizationConfig, extractTenantFromUrl } from './config.js';\nimport * as openidClient from 'openid-client';\nimport { Config } from './api/client/types.gen.js';\nconst debug = createDebug('gatana');\n\nexport interface GatanaOptions {\n apiKey: string;\n orgId?: string;\n baseUrl?: string;\n}\n\nexport type GatanaConfig = { baseUrl: string; token: () => Promise<string> };\nexport class ConfigLoader {\n constructor(public readonly strategies: ConfigStrategy[]) {}\n\n getConfig(): GatanaConfig {\n for (const strategy of this.strategies) {\n const config = strategy.getConfig();\n if (config) {\n return config;\n }\n }\n throw new Error('No valid configuration found from any strategy');\n }\n}\n\nexport abstract class ConfigStrategy {\n abstract getConfig(): { orgId: string; baseUrl: string; token: () => Promise<string> } | null;\n abstract help: string;\n}\n\nexport class OptionsConfigStrategy extends ConfigStrategy {\n constructor(private options?: GatanaOptions) {\n super();\n }\n\n public help =\n `OptionsConfigStrategy: Provide configuration via Gatana constructor options. ` +\n `Example: new Gatana({ options }) where options includes apiKey and orgId or baseUrl.`;\n\n getConfig() {\n if (!this.options) {\n return null;\n }\n if (this.options.apiKey && (this.options.orgId || this.options.baseUrl)) {\n const key = this.options.apiKey;\n const baseUrl = this.options.baseUrl || `https://${this.options.orgId}.gatana.ai`;\n return {\n orgId: this.options.orgId!,\n baseUrl,\n token: async () => key,\n };\n }\n return null;\n }\n}\n\nexport class EnvConfigStrategy extends ConfigStrategy {\n public help =\n `EnvConfigStrategy: Provide configuration via environment variables. ` +\n `Required: GATANA_API_KEY and either GATANA_ORG_ID or GATANA_BASE_URL. ` +\n `Example: export GATANA_API_KEY=your_api_key; export GATANA_ORG_ID=your_org_id`;\n\n getConfig() {\n const apiKey = process.env.GATANA_API_KEY;\n const orgId = process.env.GATANA_ORG_ID;\n const overrideBaseUrl = process.env.GATANA_BASE_URL;\n if (apiKey && (orgId || overrideBaseUrl)) {\n return {\n orgId: orgId || extractTenantFromUrl(overrideBaseUrl!),\n baseUrl: overrideBaseUrl || `https://${orgId}.gatana.ai`,\n token: async () => apiKey,\n };\n }\n return null;\n }\n}\n\nexport class FileConfigStrategy extends ConfigStrategy {\n constructor(private orgId?: string) {\n super();\n }\n\n public help =\n `FileConfigStrategy: Provide configuration via a local config file. Use the ` +\n `\"gatana config\" commands to manage this configuration. The CLI will look for the default ` +\n `organization in the config file or use the org specified by GATANA_ORG_ID env var.`;\n\n getConfig() {\n let orgId = this.orgId || process.env.GATANA_ORG_ID || getDefaultOrganization();\n if (!orgId) {\n return null;\n }\n debug(`FileConfigLoader loading config for orgId=${orgId}`);\n const tenantConfig = getOrganization(orgId);\n debug(tenantConfig);\n if (!tenantConfig) {\n return null;\n }\n return {\n orgId,\n baseUrl: tenantConfig.baseUrl,\n token: async () => {\n if (tenantConfig?.pat) {\n return tenantConfig.pat;\n } else if (\n tenantConfig?.tokens?.access_token &&\n tenantConfig.tokens.expires_at &&\n tenantConfig.tokens.expires_at > Math.floor(Date.now() / 1000) + 60\n ) {\n return tenantConfig.tokens.access_token;\n } else if (tenantConfig.tokens?.refresh_token) {\n debug('Access token expired or about to expire, attempting to refresh');\n // Try to refresh the token\n const config = await openidClient.discovery(\n new URL(`/.well-known/openid-configuration`, tenantConfig.baseUrl),\n `${orgId}-cli`\n );\n try {\n const token = await openidClient.refreshTokenGrant(config, tenantConfig.tokens.refresh_token);\n if (token) {\n tenantConfig.tokens = {\n access_token: token.access_token,\n refresh_token: token.refresh_token || tenantConfig.tokens.refresh_token,\n expires_at: token.expires_in ? Math.floor(Date.now() / 1000) + token.expires_in : 0,\n };\n setOrganizationConfig(orgId, {\n tokens: tenantConfig.tokens,\n });\n debug('Token refreshed successfully', { token });\n return token.access_token;\n }\n } catch (error) {\n debug('Failed to refresh token', error);\n throw new Error(`Failed to refresh access token. Please log in again. (${(error as Error).message})`);\n }\n }\n throw new Error('No valid API key, access token or refresh token available.');\n },\n };\n }\n}\n\nexport class Gatana {\n public api = sdk;\n public config: GatanaConfig;\n constructor(arg?: { options?: GatanaOptions; config?: GatanaConfig; configLoader?: ConfigLoader; isCli?: boolean }) {\n // Try to get config from file if not provided via options or env vars\n const configLoader =\n (!arg?.config && arg?.configLoader) ||\n new ConfigLoader([new OptionsConfigStrategy(arg?.options), new EnvConfigStrategy(), new FileConfigStrategy()]);\n\n try {\n this.config = arg?.config || configLoader.getConfig();\n\n const clientConfig = {\n baseUrl: new URL('/api/v1/', this.config.baseUrl).toString(),\n auth: this.config.token,\n } satisfies Config;\n client.setConfig(clientConfig);\n\n // Add verbose request/response logging via debug\n const debugHttp = createDebug('gatana:http');\n client.interceptors.request.use(request => {\n debugHttp(`→ ${request.method} ${request.url}`, { body: request.body });\n return request;\n });\n client.interceptors.response.use((response, request) => {\n debugHttp(`← ${response.status} ${response.statusText} ${request.method} ${request.url}`);\n return response;\n });\n client.interceptors.error.use((error, response, request) => {\n debugHttp(`✗ ${response.status} ${response.statusText} ${request.method} ${request.url}`, error);\n return error;\n });\n\n debug('Gatana v1 initialized with config', clientConfig);\n } catch (error: any) {\n debug('Failed to initialize', error);\n if (arg?.isCli && error.message === 'No valid configuration found from any strategy') {\n console.error('Warning: No valid configuration found. Run \"gatana config login\" to set up your credentials.');\n this.config = {\n baseUrl: 'https://NO_ORGANIZATION_SET.gatana.ai',\n token: async () => 'PLEASE_SET_UP_CONFIGURATION',\n };\n } else {\n console.error('Error initializing Gatana:', error.message);\n process.exit(1);\n }\n }\n }\n}\n\nexport { Gatana2 } from './v2.js';\n"],"mappings":";;;;;;;AAYA,MAAMA,UAAQ,YAAY,SAAS;;;;AAKnC,IAAa,UAAb,MAAqB;CACnB,AAAO,MAAMC;CACb,AAAgB;CAChB,YAAY,KAAwG;EAElH,MAAM,eACH,CAAC,KAAK,UAAU,KAAK,gBACtB,IAAI,aAAa;GAAC,IAAI,sBAAsB,KAAK,QAAQ;GAAE,IAAI,mBAAmB;GAAE,IAAI,oBAAoB;GAAC,CAAC;AAEhH,MAAI;AACF,QAAK,SAAS,KAAK,UAAU,aAAa,WAAW;GAErD,MAAM,eAAe;IACnB,SAAS,IAAI,IAAI,YAAY,KAAK,OAAO,QAAQ,CAAC,UAAU;IAC5D,MAAM,KAAK,OAAO;IACnB;AACD,YAAO,UAAU,aAAa;GAG9B,MAAM,YAAY,YAAY,cAAc;AAC5C,YAAO,aAAa,QAAQ,KAAI,YAAW;AACzC,cAAU,KAAK,QAAQ,OAAO,GAAG,QAAQ,OAAO,EAAE,MAAM,QAAQ,MAAM,CAAC;AACvE,WAAO;KACP;AACF,YAAO,aAAa,SAAS,KAAK,UAAU,YAAY;AACtD,cAAU,KAAK,SAAS,OAAO,GAAG,SAAS,WAAW,GAAG,QAAQ,OAAO,GAAG,QAAQ,MAAM;AACzF,WAAO;KACP;AACF,YAAO,aAAa,MAAM,KAAK,OAAO,UAAU,YAAY;AAC1D,cAAU,KAAK,SAAS,OAAO,GAAG,SAAS,WAAW,GAAG,QAAQ,OAAO,GAAG,QAAQ,OAAO,MAAM;AAChG,WAAO;KACP;AAEF,WAAM,qCAAqC,aAAa;WACjD,OAAY;AACnB,WAAM,wBAAwB,MAAM;AACpC,OAAI,KAAK,SAAS,MAAM,YAAY,kDAAkD;AACpF,YAAQ,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