@datadog/rspack-plugin 3.3.3-dev.2 → 3.3.3-dev.3
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=
|
|
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)}};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ type ServiceVersionSourcemapsOptions = SourcemapsUploadOptions & {
|
|
|
73
73
|
debugId?: false;
|
|
74
74
|
minifiedPathPrefix: MinifiedPathPrefix;
|
|
75
75
|
releaseVersion?: string;
|
|
76
|
-
service
|
|
76
|
+
service: string;
|
|
77
77
|
};
|
|
78
78
|
type SourcemapsOptions = DebugIdSourcemapsOptions | ServiceVersionSourcemapsOptions;
|
|
79
79
|
type ErrorTrackingOptions = {
|
|
@@ -113,8 +113,6 @@ type LiveDebuggerOptions = {
|
|
|
113
113
|
};
|
|
114
114
|
type LiveDebuggerOptionsWithDefaults = {
|
|
115
115
|
version: string | undefined;
|
|
116
|
-
service: string | undefined;
|
|
117
|
-
enableGit: boolean;
|
|
118
116
|
debugId: boolean;
|
|
119
117
|
include: (string | RegExp)[];
|
|
120
118
|
exclude: (string | RegExp)[];
|
|
@@ -5138,7 +5136,7 @@ type DebugIdSourceCodeContextOptions = {
|
|
|
5138
5136
|
};
|
|
5139
5137
|
type ServiceVersionSourceCodeContextOptions = {
|
|
5140
5138
|
debugId?: false;
|
|
5141
|
-
service
|
|
5139
|
+
service: string;
|
|
5142
5140
|
version?: string;
|
|
5143
5141
|
};
|
|
5144
5142
|
type SourceCodeContextOptions = DebugIdSourceCodeContextOptions | ServiceVersionSourceCodeContextOptions;
|
|
@@ -5252,7 +5250,6 @@ type Timer = {
|
|
|
5252
5250
|
};
|
|
5253
5251
|
type BuildMetadata = {
|
|
5254
5252
|
name?: string;
|
|
5255
|
-
service?: string;
|
|
5256
5253
|
version?: string;
|
|
5257
5254
|
};
|
|
5258
5255
|
type BuildReport = {
|
|
@@ -5345,14 +5342,10 @@ type GlobalContext = {
|
|
|
5345
5342
|
env: GlobalData["env"];
|
|
5346
5343
|
getLogger: GetLogger;
|
|
5347
5344
|
git?: RepositoryData;
|
|
5348
|
-
gitPending: boolean;
|
|
5349
|
-
gitReady: Promise<void>;
|
|
5350
5345
|
hook: TriggerHook<void>;
|
|
5351
5346
|
inject: (item: ToInjectItem) => void;
|
|
5352
5347
|
markArtifactsPending: () => void;
|
|
5353
5348
|
markArtifactsReady: (error?: unknown) => void;
|
|
5354
|
-
markGitPending: () => void;
|
|
5355
|
-
markGitReady: () => void;
|
|
5356
5349
|
pluginNames: string[];
|
|
5357
5350
|
plugins: (PluginOptions | CustomPluginOptions)[];
|
|
5358
5351
|
queue: (promise: Promise<any>) => void;
|