@datadog/rollup-plugin 3.3.3-dev.2 → 3.3.3-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- class n extends Error{constructor(n,t,e){super(n),this.functionName=t,this.statusCode=e,this.name="BackendFunctionError"}}const t=async(t,e)=>{const r={functionName:t,args:e};let o,i;try{o=await fetch("/__dd/executeAction",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(e){throw new n(`Network error while executing backend function "${t}": ${e instanceof Error?e.message:String(e)}`,t)}if(!o.ok){let e=`Backend function "${t}" failed with status ${o.status}`;try{const n=await o.text();n&&(e+=`: ${n}`)}catch{}throw new n(e,t,o.status)}try{i=await o.json()}catch(e){throw new n(`Failed to parse response from backend function "${t}": ${e instanceof Error?e.message:String(e)}`,t,o.status)}if(!i.success)throw new n(`Backend function "${t}" returned an error: ${i.error}`,t,o.status);return i.result.data};function e(n){return null!==n&&"object"==typeof n}function r(n){const t=[];for(let e=0;e<n.length;e++)t.push(n[e]);return t}let o=0;const i=12e4;function c(n){if(!e(n))return;const t="allowedConnectionIds"in n?n.allowedConnectionIds:void 0,o={code:"code"in n?n.code:void 0,allowedConnectionIds:Array.isArray(t)?r(t):void 0};return e(i=o)&&"code"in i&&"string"==typeof i.code&&i.code.length>0&&"allowedConnectionIds"in i&&Array.isArray(i.allowedConnectionIds)&&i.allowedConnectionIds.every((n=>"string"==typeof n))?o:void 0;var i}function s(n){try{if(!e(n))return{};const t="targetOrigin"in n?n.targetOrigin:void 0;if(!function(n){if("string"!=typeof n)return!1;try{return new URL(n).origin===n}catch{return!1}}(t))return{};const r=c("bundle"in n?n.bundle:void 0);return void 0===r?{targetOrigin:t}:{targetOrigin:t,bundle:r}}catch{return{}}}function u(t,r,{targetOrigin:c,bundle:s}){const u=function(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();o+=1;const n=Math.random().toString(36).slice(2);return`req-${Date.now()}-${o}-${n}`}();return new Promise(((o,a)=>{let d;function f(){window.removeEventListener("message",l),clearTimeout(d)}function l(r){const i=r.data;if(!function(n){return n.source===window.parent&&(void 0===c||n.origin===c)}(r)||!function(n,t){return e(n)&&"type"in n&&"app-builder:run-query:response"===n.type&&"requestId"in n&&n.requestId===t}(i,u))return;if(f(),!0===i.success&&e(i.result))return void o(i.result.data);const s="error"in i?i.error:void 0,d=new n("string"==typeof s?s:`Backend function "${t}" failed`,t);a(d)}window.addEventListener("message",l),d=setTimeout((()=>{f(),a(new n(`Backend function "${t}" timed out waiting for response`,t))}),i);const w={type:"app-builder:run-query",requestId:u,queryName:t,args:r,...s&&{bundle:s}};try{window.parent.postMessage(w,c??"*")}catch(n){f(),a(n)}}))}const a=(n,t)=>{const e=function(){try{return Reflect.get(globalThis,"DD_APPS_PREPARE_CALL")}catch{return}}();if("function"!=typeof e)return u(n,t,{});let r;const o=new Promise((n=>{r=setTimeout((()=>n({})),i)})),c=Promise.resolve().then((()=>e(n))).catch((()=>({})));return Promise.race([c,o]).then((e=>{clearTimeout(r);const o=s(e);return u(n,t,o)}))};function d(){return function(){try{return"undefined"!=typeof window&&window.parent!==window}catch{return!0}}()?a:t}globalThis.DD_APPS_RUNTIME={executeBackendFunction:async function(n,t){return d()(n,t)}};
1
+ class n extends Error{constructor(n,t,e){super(n),this.functionName=t,this.statusCode=e,this.name="BackendFunctionError"}}const t=async(t,e)=>{const r={functionName:t,args:e};let o,i;try{o=await fetch("/__dd/executeAction",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(e){throw new n(`Network error while executing backend function "${t}": ${e instanceof Error?e.message:String(e)}`,t)}if(!o.ok){let e=`Backend function "${t}" failed with status ${o.status}`;try{const n=await o.text(),t=function(n){try{const t=JSON.parse(n);if("object"==typeof t&&null!==t&&"success"in t&&!1===t.success&&"error"in t&&"string"==typeof t.error&&""!==t.error)return t.error}catch{return}}(n);void 0!==t?e=t:n&&(e+=`: ${n}`)}catch{}throw new n(e,t,o.status)}try{i=await o.json()}catch(e){throw new n(`Failed to parse response from backend function "${t}": ${e instanceof Error?e.message:String(e)}`,t,o.status)}if(!i.success)throw new n(`Backend function "${t}" returned an error: ${i.error}`,t,o.status);return i.result.data};function e(n){return null!==n&&"object"==typeof n}function r(n){const t=[];for(let e=0;e<n.length;e++)t.push(n[e]);return t}let o=0;const i=33e4;function c(n){if(!e(n))return;const t="allowedConnectionIds"in n?n.allowedConnectionIds:void 0,o={code:"code"in n?n.code:void 0,allowedConnectionIds:Array.isArray(t)?r(t):void 0};return e(i=o)&&"code"in i&&"string"==typeof i.code&&i.code.length>0&&"allowedConnectionIds"in i&&Array.isArray(i.allowedConnectionIds)&&i.allowedConnectionIds.every((n=>"string"==typeof n))?o:void 0;var i}function s(n){try{if(!e(n))return{};const t="targetOrigin"in n?n.targetOrigin:void 0;if(!function(n){if("string"!=typeof n)return!1;try{return new URL(n).origin===n}catch{return!1}}(t))return{};const r=c("bundle"in n?n.bundle:void 0);return void 0===r?{targetOrigin:t}:{targetOrigin:t,bundle:r}}catch{return{}}}function u(t,r,{targetOrigin:c,bundle:s}){const u=function(){if("undefined"!=typeof crypto&&crypto.randomUUID)return crypto.randomUUID();o+=1;const n=Math.random().toString(36).slice(2);return`req-${Date.now()}-${o}-${n}`}();return new Promise(((o,a)=>{let d;function f(){window.removeEventListener("message",l),clearTimeout(d)}function l(r){const i=r.data;if(!function(n){return n.source===window.parent&&(void 0===c||n.origin===c)}(r)||!function(n,t){return e(n)&&"type"in n&&"app-builder:run-query:response"===n.type&&"requestId"in n&&n.requestId===t}(i,u))return;if(f(),!0===i.success&&e(i.result))return void o(i.result.data);const s="error"in i?i.error:void 0,d=new n("string"==typeof s?s:`Backend function "${t}" failed`,t);a(d)}window.addEventListener("message",l),d=setTimeout((()=>{f(),a(new n(`Backend function "${t}" timed out waiting for response`,t))}),i);const w={type:"app-builder:run-query",requestId:u,queryName:t,args:r,...s&&{bundle:s}};try{window.parent.postMessage(w,c??"*")}catch(n){f(),a(n)}}))}const a=(n,t)=>{const e=function(){try{return Reflect.get(globalThis,"DD_APPS_PREPARE_CALL")}catch{return}}();if("function"!=typeof e)return u(n,t,{});let r;const o=new Promise((n=>{r=setTimeout((()=>n({})),i)})),c=Promise.resolve().then((()=>e(n))).catch((()=>({})));return Promise.race([c,o]).then((e=>{clearTimeout(r);const o=s(e);return u(n,t,o)}))};function d(){return function(){try{return"undefined"!=typeof window&&window.parent!==window}catch{return!0}}()?a:t}globalThis.DD_APPS_RUNTIME={executeBackendFunction:async function(n,t){return d()(n,t)}};
@@ -74,7 +74,7 @@ type ServiceVersionSourcemapsOptions = SourcemapsUploadOptions & {
74
74
  debugId?: false;
75
75
  minifiedPathPrefix: MinifiedPathPrefix;
76
76
  releaseVersion?: string;
77
- service?: string;
77
+ service: string;
78
78
  };
79
79
  type SourcemapsOptions = DebugIdSourcemapsOptions | ServiceVersionSourcemapsOptions;
80
80
  type ErrorTrackingOptions = {
@@ -114,8 +114,6 @@ type LiveDebuggerOptions = {
114
114
  };
115
115
  type LiveDebuggerOptionsWithDefaults = {
116
116
  version: string | undefined;
117
- service: string | undefined;
118
- enableGit: boolean;
119
117
  debugId: boolean;
120
118
  include: (string | RegExp)[];
121
119
  exclude: (string | RegExp)[];
@@ -5139,7 +5137,7 @@ type DebugIdSourceCodeContextOptions = {
5139
5137
  };
5140
5138
  type ServiceVersionSourceCodeContextOptions = {
5141
5139
  debugId?: false;
5142
- service?: string;
5140
+ service: string;
5143
5141
  version?: string;
5144
5142
  };
5145
5143
  type SourceCodeContextOptions = DebugIdSourceCodeContextOptions | ServiceVersionSourceCodeContextOptions;
@@ -5253,7 +5251,6 @@ type Timer = {
5253
5251
  };
5254
5252
  type BuildMetadata = {
5255
5253
  name?: string;
5256
- service?: string;
5257
5254
  version?: string;
5258
5255
  };
5259
5256
  type BuildReport = {
@@ -5346,14 +5343,10 @@ type GlobalContext = {
5346
5343
  env: GlobalData["env"];
5347
5344
  getLogger: GetLogger;
5348
5345
  git?: RepositoryData;
5349
- gitPending: boolean;
5350
- gitReady: Promise<void>;
5351
5346
  hook: TriggerHook<void>;
5352
5347
  inject: (item: ToInjectItem) => void;
5353
5348
  markArtifactsPending: () => void;
5354
5349
  markArtifactsReady: (error?: unknown) => void;
5355
- markGitPending: () => void;
5356
- markGitReady: () => void;
5357
5350
  pluginNames: string[];
5358
5351
  plugins: (PluginOptions | CustomPluginOptions)[];
5359
5352
  queue: (promise: Promise<any>) => void;