@provablehq/sdk 0.8.0 → 0.8.2

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,7 +1,8 @@
1
1
  import 'core-js/proposals/json-parse-with-source.js';
2
2
  import { webcrypto } from 'node:crypto';
3
3
  import * as $fs from 'node:fs';
4
- import $mime from 'mime/lite.js';
4
+ import $mime from 'mime/lite';
5
+ import $xmlhttprequest from 'xmlhttprequest-ssl';
5
6
  import $request from 'sync-request';
6
7
  import * as $worker from 'node:worker_threads';
7
8
  import * as $os from 'node:os';
@@ -11,11 +12,27 @@ if (globalThis.crypto == null) {
11
12
  }
12
13
 
13
14
  const oldFetch = globalThis.fetch;
15
+ let supports = null;
16
+ async function checkFetch() {
17
+ try {
18
+ await oldFetch(new URL("file:"));
19
+ return true;
20
+ }
21
+ catch (e) {
22
+ return false;
23
+ }
24
+ }
25
+ async function supportsFetch() {
26
+ if (supports === null) {
27
+ supports = checkFetch();
28
+ }
29
+ return await supports;
30
+ }
14
31
  // We always polyfill fetch because Node's fetch doesn't support file URLs.
15
32
  globalThis.fetch = async function (resource, options) {
16
33
  const request = new Request(resource, options);
17
34
  const url = new URL(request.url);
18
- if (url.protocol === "file:") {
35
+ if (!(await supportsFetch()) && url.protocol === "file:") {
19
36
  const readStream = $fs.createReadStream(url);
20
37
  const headers = {};
21
38
  const type = $mime.getType(url.pathname);
@@ -33,122 +50,60 @@ globalThis.fetch = async function (resource, options) {
33
50
  }
34
51
  };
35
52
 
36
- globalThis.XMLHttpRequest = class extends EventTarget {
37
- static UNSENT = 0;
38
- static OPENED = 1;
39
- static HEADERS_RECEIVED = 2;
40
- static LOADING = 3;
41
- static DONE = 4;
42
- UNSENT = XMLHttpRequest.UNSENT;
43
- OPENED = XMLHttpRequest.OPENED;
44
- HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED;
45
- LOADING = XMLHttpRequest.LOADING;
46
- DONE = XMLHttpRequest.DONE;
47
- responseType;
48
- withCredentials;
49
- timeout;
50
- readyState;
51
- response;
52
- responseText;
53
- responseURL;
54
- responseXML;
55
- status;
56
- statusText;
57
- upload;
58
- _url;
59
- _mime;
60
- constructor() {
61
- super();
62
- this._reset();
63
- this._mime = "text/xml";
64
- }
65
- _reset() {
66
- this.readyState = XMLHttpRequest.UNSENT;
67
- this.response = null;
68
- this.responseText = "";
69
- this.responseType = "";
70
- this.responseURL = "";
71
- this.responseXML = null;
72
- this.status = 0;
73
- this.statusText = "";
74
- this.timeout = 0;
75
- this.upload = null;
76
- this.withCredentials = false;
77
- this._url = null;
78
- }
79
- _success() {
80
- this.readyState = XMLHttpRequest.DONE;
81
- this.status = 200;
82
- this.statusText = "OK";
83
- }
84
- set onabort(value) {
85
- throw new Error("Not implemented");
86
- }
87
- set onerror(value) {
88
- throw new Error("Not implemented");
89
- }
90
- set onreadystatechange(value) {
91
- throw new Error("Not implemented");
92
- }
93
- set onloadstart(value) {
94
- throw new Error("Not implemented");
95
- }
96
- set onload(value) {
97
- throw new Error("Not implemented");
98
- }
99
- set onloadend(value) {
100
- throw new Error("Not implemented");
101
- }
102
- set onprogress(value) {
103
- throw new Error("Not implemented");
104
- }
105
- set ontimeout(value) {
106
- throw new Error("Not implemented");
107
- }
108
- abort() {
109
- throw new Error("Not implemented");
110
- }
111
- overrideMimeType(mime) {
112
- this._mime = mime;
113
- }
114
- getResponseHeader() {
115
- throw new Error("Not implemented");
116
- }
117
- getAllResponseHeaders() {
118
- throw new Error("Not implemented");
119
- }
120
- setRequestHeader() {
121
- throw new Error("Not implemented");
122
- }
123
- open(method, url, async = true, username, password) {
124
- if (async) {
125
- throw new Error("Async XMLHttpRequest is not implemented yet");
126
- }
127
- if (method !== "GET") {
128
- throw new Error("Non-GET requests are not implemented yet");
129
- }
130
- this._reset();
131
- this._url = url;
132
- }
133
- send(body = null) {
134
- if (body !== null) {
135
- throw new Error("XMLHttpRequest send body is not implemented yet");
136
- }
137
- if (!this._url) {
138
- throw new Error("You must call open before you call send");
139
- }
140
- const response = $request("GET", this._url, {
141
- headers: {
142
- "Content-Type": this._mime,
53
+ // @ts-ignore
54
+ if (globalThis.XMLHttpRequest == null) {
55
+ globalThis.XMLHttpRequest = class extends $xmlhttprequest.XMLHttpRequest {
56
+ // We have to override the methods inside of the `constructor`
57
+ // because `xmlhttprequest-ssl` doesn't use a regular class,
58
+ // instead it defines all of the methods inside of the constructor.
59
+ constructor(...args) {
60
+ super(...args);
61
+ const open = this.open;
62
+ const send = this.send;
63
+ let _async = true;
64
+ let _url = null;
65
+ let _mime = "text/xml";
66
+ function reset() {
67
+ _async = true;
68
+ _url = null;
69
+ _mime = "text/xml";
143
70
  }
144
- });
145
- const buffer = response.body.buffer;
146
- const responseText = new TextDecoder("iso-8859-5", { fatal: true }).decode(buffer);
147
- this.response = this.responseText = responseText;
148
- this._url = null;
149
- this._success();
150
- }
151
- };
71
+ this.open = function (method, url, async, user, password) {
72
+ // Special behavior for synchronous requests
73
+ if (method === "GET" && !async && !user && !password) {
74
+ _async = false;
75
+ _url = url;
76
+ // Default to the normal polyfill for async requests
77
+ }
78
+ else {
79
+ reset();
80
+ return open.call(this, method, url, async, user, password);
81
+ }
82
+ };
83
+ this.send = function (data) {
84
+ if (_async) {
85
+ return send.call(this, data);
86
+ // Use `sync-request` for synchronous requests.
87
+ }
88
+ else {
89
+ const response = $request("GET", _url, {
90
+ headers: {
91
+ "Content-Type": _mime,
92
+ }
93
+ });
94
+ const buffer = response.body.buffer;
95
+ const responseText = new TextDecoder("iso-8859-5", { fatal: true }).decode(buffer);
96
+ this.status = 200;
97
+ this.response = this.responseText = responseText;
98
+ reset();
99
+ }
100
+ };
101
+ this.overrideMimeType = function (mime) {
102
+ _mime = mime;
103
+ };
104
+ }
105
+ };
106
+ }
152
107
 
153
108
  // This is technically not a part of the Worker polyfill,
154
109
  // but Workers are used for multi-threading, so this is often
@@ -158,73 +113,75 @@ if (globalThis.navigator == null) {
158
113
  hardwareConcurrency: $os.cpus().length,
159
114
  };
160
115
  }
161
- globalThis.Worker = class Worker extends EventTarget {
162
- _worker;
163
- constructor(url, options) {
164
- super();
165
- if (url instanceof URL) {
166
- if (url.protocol !== "file:") {
167
- throw new Error("Worker only supports file: URLs");
116
+ if (globalThis.Worker == null) {
117
+ globalThis.Worker = class Worker extends EventTarget {
118
+ _worker;
119
+ constructor(url, options) {
120
+ super();
121
+ if (url instanceof URL) {
122
+ if (url.protocol !== "file:") {
123
+ throw new Error("Worker only supports file: URLs");
124
+ }
125
+ url = url.href;
126
+ }
127
+ else {
128
+ throw new Error("Filepaths are unreliable, use `new URL(\"...\", import.meta.url)` instead.");
168
129
  }
169
- url = url.href;
130
+ if (!options || options.type !== "module") {
131
+ throw new Error("Workers must use \`type: \"module\"\`");
132
+ }
133
+ const code = `
134
+ import("node:worker_threads")
135
+ .then(({ workerData }) => {
136
+ return import(workerData.polyfill)
137
+ .then(() => import(workerData.url))
138
+ })
139
+ .catch((e) => {
140
+ // TODO maybe it should send a message to the parent?
141
+ console.error(e.stack);
142
+ });
143
+ `;
144
+ this._worker = new $worker.Worker(code, {
145
+ eval: true,
146
+ workerData: {
147
+ url,
148
+ polyfill: new URL("node-polyfill.js", import.meta.url).href,
149
+ },
150
+ });
151
+ this._worker.on("message", (data) => {
152
+ this.dispatchEvent(new MessageEvent("message", { data }));
153
+ });
154
+ this._worker.on("messageerror", (error) => {
155
+ throw new Error("UNIMPLEMENTED");
156
+ });
157
+ this._worker.on("error", (error) => {
158
+ // TODO attach the error to the event somehow
159
+ const event = new Event("error");
160
+ this.dispatchEvent(event);
161
+ });
170
162
  }
171
- else {
172
- throw new Error("Filepaths are unreliable, use `new URL(\"...\", import.meta.url)` instead.");
163
+ set onmessage(f) {
164
+ throw new Error("UNIMPLEMENTED");
173
165
  }
174
- if (!options || options.type !== "module") {
175
- throw new Error("Workers must use \`type: \"module\"\`");
166
+ set onmessageerror(f) {
167
+ throw new Error("UNIMPLEMENTED");
176
168
  }
177
- const code = `
178
- import("node:worker_threads")
179
- .then(({ workerData }) => {
180
- return import(workerData.polyfill)
181
- .then(() => import(workerData.url))
182
- })
183
- .catch((e) => {
184
- // TODO maybe it should send a message to the parent?
185
- console.error(e.stack);
186
- });
187
- `;
188
- this._worker = new $worker.Worker(code, {
189
- eval: true,
190
- workerData: {
191
- url,
192
- polyfill: new URL("node-polyfill.js", import.meta.url).href,
193
- },
194
- });
195
- this._worker.on("message", (data) => {
196
- this.dispatchEvent(new MessageEvent("message", { data }));
197
- });
198
- this._worker.on("messageerror", (error) => {
169
+ set onerror(f) {
199
170
  throw new Error("UNIMPLEMENTED");
200
- });
201
- this._worker.on("error", (error) => {
202
- // TODO attach the error to the event somehow
203
- const event = new Event("error");
204
- this.dispatchEvent(event);
205
- });
206
- }
207
- set onmessage(f) {
208
- throw new Error("UNIMPLEMENTED");
209
- }
210
- set onmessageerror(f) {
211
- throw new Error("UNIMPLEMENTED");
212
- }
213
- set onerror(f) {
214
- throw new Error("UNIMPLEMENTED");
215
- }
216
- postMessage(value, transfer) {
217
- this._worker.postMessage(value, transfer);
218
- }
219
- terminate() {
220
- this._worker.terminate();
221
- }
222
- // This is Node-specific, it allows the process to exit
223
- // even if the Worker is still running.
224
- unref() {
225
- this._worker.unref();
226
- }
227
- };
171
+ }
172
+ postMessage(value, transfer) {
173
+ this._worker.postMessage(value, transfer);
174
+ }
175
+ terminate() {
176
+ this._worker.terminate();
177
+ }
178
+ // This is Node-specific, it allows the process to exit
179
+ // even if the Worker is still running.
180
+ unref() {
181
+ this._worker.unref();
182
+ }
183
+ };
184
+ }
228
185
  if (!$worker.isMainThread) {
229
186
  const globals = globalThis;
230
187
  // This is used to create the onmessage, onmessageerror, and onerror setters
@@ -1 +1 @@
1
- {"version":3,"file":"node-polyfill.js","sources":["../../src/polyfill/crypto.ts","../../src/polyfill/fetch.ts","../../src/polyfill/xmlhttprequest.ts","../../src/polyfill/worker.ts","../../src/node-polyfill.ts"],"sourcesContent":["import { webcrypto } from \"node:crypto\";\n\nif ((globalThis as any).crypto == null) {\n (globalThis as any).crypto = webcrypto;\n}\n","import * as $fs from \"node:fs\";\nimport $mime from \"mime/lite.js\";\n\n\nconst oldFetch = globalThis.fetch;\n\n// We always polyfill fetch because Node's fetch doesn't support file URLs.\n(globalThis.fetch as any) = async function (resource: URL | RequestInfo, options: RequestInit | undefined): Promise<Response> {\n const request = new Request(resource, options);\n\n const url = new URL(request.url);\n\n if (url.protocol === \"file:\") {\n const readStream = $fs.createReadStream(url);\n\n const headers: HeadersInit = {};\n\n const type = $mime.getType(url.pathname);\n\n if (type) {\n headers[\"Content-Type\"] = type;\n }\n\n return new Response(readStream as any, {\n status: 200,\n statusText: \"OK\",\n headers,\n });\n\n } else {\n return await oldFetch(request);\n }\n};\n","import $request from \"sync-request\";\n\n\nglobalThis.XMLHttpRequest = class extends EventTarget implements XMLHttpRequest {\n public static readonly UNSENT = 0;\n public static readonly OPENED = 1;\n public static readonly HEADERS_RECEIVED = 2;\n public static readonly LOADING = 3;\n public static readonly DONE = 4;\n\n public readonly UNSENT = XMLHttpRequest.UNSENT;\n public readonly OPENED = XMLHttpRequest.OPENED;\n public readonly HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED;\n public readonly LOADING = XMLHttpRequest.LOADING;\n public readonly DONE = XMLHttpRequest.DONE;\n\n public responseType!: XMLHttpRequestResponseType;\n public withCredentials!: boolean;\n public timeout!: number;\n\n public readonly readyState!: number;\n public readonly response!: ArrayBuffer | Blob | Document | string | null;\n public readonly responseText!: string;\n public readonly responseURL!: string;\n public readonly responseXML!: Document | null;\n public readonly status!: number;\n public readonly statusText!: string;\n public readonly upload!: XMLHttpRequestUpload;\n\n private _url!: string | URL | null;\n private _mime!: string;\n\n constructor() {\n super();\n\n this._reset();\n\n this._mime = \"text/xml\";\n }\n\n private _reset() {\n (this as any).readyState = XMLHttpRequest.UNSENT;\n (this as any).response = null;\n (this as any).responseText = \"\";\n (this as any).responseType = \"\";\n (this as any).responseURL = \"\";\n (this as any).responseXML = null;\n (this as any).status = 0;\n (this as any).statusText = \"\";\n (this as any).timeout = 0;\n (this as any).upload = null;\n (this as any).withCredentials = false;\n\n this._url = null;\n }\n\n private _success() {\n (this as any).readyState = XMLHttpRequest.DONE;\n (this as any).status = 200;\n (this as any).statusText = \"OK\";\n }\n\n public set onabort(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onerror(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onreadystatechange(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadstart(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onload(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadend(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onprogress(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set ontimeout(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public abort() {\n throw new Error(\"Not implemented\");\n }\n\n public overrideMimeType(mime: string) {\n this._mime = mime;\n }\n\n public getResponseHeader(): string | null {\n throw new Error(\"Not implemented\");\n }\n\n public getAllResponseHeaders(): string {\n throw new Error(\"Not implemented\");\n }\n\n public setRequestHeader() {\n throw new Error(\"Not implemented\");\n }\n\n public open(method: string, url: string | URL, async: boolean = true, username?: string | null | undefined, password?: string | null | undefined): void {\n if (async) {\n throw new Error(\"Async XMLHttpRequest is not implemented yet\");\n }\n\n if (method !== \"GET\") {\n throw new Error(\"Non-GET requests are not implemented yet\");\n }\n\n this._reset();\n\n this._url = url;\n }\n\n public send(body: null = null) {\n if (body !== null) {\n throw new Error(\"XMLHttpRequest send body is not implemented yet\");\n }\n\n if (!this._url) {\n throw new Error(\"You must call open before you call send\");\n }\n\n const response = $request(\"GET\", this._url, {\n headers: {\n \"Content-Type\": this._mime,\n }\n });\n\n const buffer = (response.body as Buffer).buffer;\n\n const responseText = new TextDecoder(\"iso-8859-5\", { fatal: true }).decode(buffer);\n\n (this as any).response = (this as any).responseText = responseText;\n\n this._url = null;\n\n this._success();\n }\n};","import * as $worker from \"node:worker_threads\";\nimport * as $os from \"node:os\";\n\n// This is technically not a part of the Worker polyfill,\n// but Workers are used for multi-threading, so this is often\n// needed when writing Worker code.\nif (globalThis.navigator == null) {\n globalThis.navigator = {\n hardwareConcurrency: $os.cpus().length,\n } as Navigator;\n}\n\nglobalThis.Worker = class Worker extends EventTarget {\n private _worker: import(\"node:worker_threads\").Worker;\n\n constructor(url: string | URL, options?: WorkerOptions | undefined) {\n super();\n\n if (url instanceof URL) {\n if (url.protocol !== \"file:\") {\n throw new Error(\"Worker only supports file: URLs\");\n }\n\n url = url.href;\n\n } else {\n throw new Error(\"Filepaths are unreliable, use `new URL(\\\"...\\\", import.meta.url)` instead.\");\n }\n\n if (!options || options.type !== \"module\") {\n throw new Error(\"Workers must use \\`type: \\\"module\\\"\\`\");\n }\n\n const code = `\n import(\"node:worker_threads\")\n .then(({ workerData }) => {\n return import(workerData.polyfill)\n .then(() => import(workerData.url))\n })\n .catch((e) => {\n // TODO maybe it should send a message to the parent?\n console.error(e.stack);\n });\n `;\n\n this._worker = new $worker.Worker(code, {\n eval: true,\n workerData: {\n url,\n polyfill: new URL(\"node-polyfill.js\", import.meta.url).href,\n },\n });\n\n this._worker.on(\"message\", (data) => {\n this.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n\n this._worker.on(\"messageerror\", (error) => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n this._worker.on(\"error\", (error) => {\n // TODO attach the error to the event somehow\n const event = new Event(\"error\");\n this.dispatchEvent(event);\n });\n }\n\n set onmessage(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onmessageerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n postMessage(message: any, transfer: Array<Transferable>): void;\n postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n postMessage(value: any, transfer: any) {\n this._worker.postMessage(value, transfer);\n }\n\n terminate() {\n this._worker.terminate();\n }\n\n // This is Node-specific, it allows the process to exit\n // even if the Worker is still running.\n unref() {\n this._worker.unref();\n }\n};\n\n\nif (!$worker.isMainThread) {\n const globals = globalThis as unknown as DedicatedWorkerGlobalScope;\n\n // This is used to create the onmessage, onmessageerror, and onerror setters\n const makeSetter = (prop: string, event: string) => {\n let oldvalue: () => void;\n\n Object.defineProperty(globals, prop, {\n get() {\n return oldvalue;\n },\n set(value) {\n if (oldvalue) {\n globals.removeEventListener(event, oldvalue);\n }\n\n oldvalue = value;\n\n if (oldvalue) {\n globals.addEventListener(event, oldvalue);\n }\n },\n });\n };\n\n // This makes sure that `f` is only run once\n const memoize = (f: () => void) => {\n let run = false;\n\n return () => {\n if (!run) {\n run = true;\n f();\n }\n };\n };\n\n\n // We only start listening for messages / errors when the worker calls addEventListener\n const startOnMessage = memoize(() => {\n $worker.parentPort!.on(\"message\", (data) => {\n workerEvents.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n });\n\n const startOnMessageError = memoize(() => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n const startOnError = memoize(() => {\n $worker.parentPort!.on(\"error\", (data) => {\n workerEvents.dispatchEvent(new Event(\"error\"));\n });\n });\n\n\n // Node workers don't have top-level events, so we have to make our own\n const workerEvents = new EventTarget();\n\n globals.close = () => {\n process.exit();\n };\n\n globals.addEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.addEventListener(type, callback, options);\n\n if (type === \"message\") {\n startOnMessage();\n } else if (type === \"messageerror\") {\n startOnMessageError();\n } else if (type === \"error\") {\n startOnError();\n }\n };\n\n globals.removeEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.removeEventListener(type, callback, options);\n };\n\n function postMessage(message: any, transfer: Transferable[]): void;\n function postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n function postMessage(value: any, transfer: any) {\n $worker.parentPort!.postMessage(value, transfer);\n }\n\n globals.postMessage = postMessage;\n\n makeSetter(\"onmessage\", \"message\");\n makeSetter(\"onmessageerror\", \"messageerror\");\n makeSetter(\"onerror\", \"error\");\n}\n","import \"./polyfill/shared\";\nimport \"./polyfill/crypto\";\nimport \"./polyfill/fetch\";\nimport \"./polyfill/xmlhttprequest\";\nimport \"./polyfill/worker\";\n\nif (!globalThis.self) {\n (globalThis as any).self = globalThis;\n}\n"],"names":[],"mappings":";;;;;;;;AAEA,IAAK,UAAkB,CAAC,MAAM,IAAI,IAAI,EAAE;AACnC,IAAA,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C;;ACAA,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;AAElC;AACC,UAAU,CAAC,KAAa,GAAG,gBAAgB,QAA2B,EAAE,OAAgC,EAAA;IACrG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAEjC,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE;QAC1B,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAgB,EAAE,CAAC;QAEhC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEzC,IAAI,IAAI,EAAE;AACN,YAAA,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;SAClC;AAED,QAAA,OAAO,IAAI,QAAQ,CAAC,UAAiB,EAAE;AACnC,YAAA,MAAM,EAAE,GAAG;AACX,YAAA,UAAU,EAAE,IAAI;YAChB,OAAO;AACV,SAAA,CAAC,CAAC;KAEN;SAAM;AACH,QAAA,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;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E,OAAO,CAAC,CAAC;AAC9D,KAAC,CAAC;AAIF,IAAA,SAAS,WAAW,CAAC,KAAU,EAAE,QAAa,EAAA;QAC1C,OAAO,CAAC,UAAW,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACpD;AAED,IAAA,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAElC,IAAA,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACnC,IAAA,UAAU,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAC7C,IAAA,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACnC;;ACtLA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1C"}
1
+ {"version":3,"file":"node-polyfill.js","sources":["../../src/polyfill/crypto.ts","../../src/polyfill/fetch.ts","../../src/polyfill/xmlhttprequest.ts","../../src/polyfill/worker.ts","../../src/node-polyfill.ts"],"sourcesContent":["import { webcrypto } from \"node:crypto\";\n\nif ((globalThis as any).crypto == null) {\n (globalThis as any).crypto = webcrypto;\n}\n","import * as $fs from \"node:fs\";\nimport $mime from \"mime/lite\";\n\n\nconst oldFetch = globalThis.fetch;\n\n\nlet supports: Promise<boolean> | null = null;\n\nasync function checkFetch() {\n try {\n await oldFetch(new URL(\"file:\"));\n return true;\n\n } catch (e) {\n return false;\n }\n}\n\nasync function supportsFetch(): Promise<boolean> {\n if (supports === null) {\n supports = checkFetch();\n }\n\n return await supports;\n}\n\n\n// We always polyfill fetch because Node's fetch doesn't support file URLs.\n(globalThis.fetch as any) = async function (resource: URL | RequestInfo, options: RequestInit | undefined): Promise<Response> {\n const request = new Request(resource, options);\n\n const url = new URL(request.url);\n\n if (!(await supportsFetch()) && url.protocol === \"file:\") {\n const readStream = $fs.createReadStream(url);\n\n const headers: HeadersInit = {};\n\n const type = $mime.getType(url.pathname);\n\n if (type) {\n headers[\"Content-Type\"] = type;\n }\n\n return new Response(readStream as any, {\n status: 200,\n statusText: \"OK\",\n headers,\n });\n\n } else {\n return await oldFetch(request);\n }\n};\n","// @ts-ignore\nimport $xmlhttprequest from \"xmlhttprequest-ssl\";\nimport $request from \"sync-request\";\n\nif (globalThis.XMLHttpRequest == null) {\n globalThis.XMLHttpRequest = class extends $xmlhttprequest.XMLHttpRequest {\n // We have to override the methods inside of the `constructor`\n // because `xmlhttprequest-ssl` doesn't use a regular class,\n // instead it defines all of the methods inside of the constructor.\n constructor(...args: Array<any>) {\n super(...args);\n\n const open = (this as any).open;\n const send = (this as any).send;\n\n let _async: boolean = true;\n let _url: null | string = null;\n let _mime: string = \"text/xml\";\n\n function reset() {\n _async = true;\n _url = null;\n _mime = \"text/xml\";\n }\n\n (this as any).open = function (method: string, url: string, async: boolean, user?: string, password?: string) {\n // Special behavior for synchronous requests\n if (method === \"GET\" && !async && !user && !password) {\n _async = false;\n _url = url;\n\n // Default to the normal polyfill for async requests\n } else {\n reset();\n return open.call(this, method, url, async, user, password);\n }\n };\n\n (this as any).send = function (data: any) {\n if (_async) {\n return send.call(this, data);\n\n // Use `sync-request` for synchronous requests.\n } else {\n const response = $request(\"GET\", _url!, {\n headers: {\n \"Content-Type\": _mime,\n }\n });\n\n const buffer = (response.body as Buffer).buffer as any;\n\n const responseText = new TextDecoder(\"iso-8859-5\", { fatal: true }).decode(buffer);\n\n (this as any).status = 200;\n (this as any).response = (this as any).responseText = responseText;\n\n reset();\n }\n };\n\n (this as any).overrideMimeType = function (mime: string) {\n _mime = mime;\n };\n }\n } as any;\n}\n","import * as $worker from \"node:worker_threads\";\nimport * as $os from \"node:os\";\n\n// This is technically not a part of the Worker polyfill,\n// but Workers are used for multi-threading, so this is often\n// needed when writing Worker code.\nif (globalThis.navigator == null) {\n globalThis.navigator = {\n hardwareConcurrency: $os.cpus().length,\n } as Navigator;\n}\n\nif (globalThis.Worker == null) {\n globalThis.Worker = class Worker extends EventTarget {\n private _worker: import(\"node:worker_threads\").Worker;\n\n constructor(url: string | URL, options?: WorkerOptions | undefined) {\n super();\n\n if (url instanceof URL) {\n if (url.protocol !== \"file:\") {\n throw new Error(\"Worker only supports file: URLs\");\n }\n\n url = url.href;\n\n } else {\n throw new Error(\"Filepaths are unreliable, use `new URL(\\\"...\\\", import.meta.url)` instead.\");\n }\n\n if (!options || options.type !== \"module\") {\n throw new Error(\"Workers must use \\`type: \\\"module\\\"\\`\");\n }\n\n const code = `\n import(\"node:worker_threads\")\n .then(({ workerData }) => {\n return import(workerData.polyfill)\n .then(() => import(workerData.url))\n })\n .catch((e) => {\n // TODO maybe it should send a message to the parent?\n console.error(e.stack);\n });\n `;\n\n this._worker = new $worker.Worker(code, {\n eval: true,\n workerData: {\n url,\n polyfill: new URL(\"node-polyfill.js\", import.meta.url).href,\n },\n });\n\n this._worker.on(\"message\", (data) => {\n this.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n\n this._worker.on(\"messageerror\", (error) => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n this._worker.on(\"error\", (error) => {\n // TODO attach the error to the event somehow\n const event = new Event(\"error\");\n this.dispatchEvent(event);\n });\n }\n\n set onmessage(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onmessageerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n postMessage(message: any, transfer: Array<Transferable>): void;\n postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n postMessage(value: any, transfer: any) {\n this._worker.postMessage(value, transfer);\n }\n\n terminate() {\n this._worker.terminate();\n }\n\n // This is Node-specific, it allows the process to exit\n // even if the Worker is still running.\n unref() {\n this._worker.unref();\n }\n };\n}\n\n\nif (!$worker.isMainThread) {\n const globals = globalThis as unknown as DedicatedWorkerGlobalScope;\n\n // This is used to create the onmessage, onmessageerror, and onerror setters\n const makeSetter = (prop: string, event: string) => {\n let oldvalue: () => void;\n\n Object.defineProperty(globals, prop, {\n get() {\n return oldvalue;\n },\n set(value) {\n if (oldvalue) {\n globals.removeEventListener(event, oldvalue);\n }\n\n oldvalue = value;\n\n if (oldvalue) {\n globals.addEventListener(event, oldvalue);\n }\n },\n });\n };\n\n // This makes sure that `f` is only run once\n const memoize = (f: () => void) => {\n let run = false;\n\n return () => {\n if (!run) {\n run = true;\n f();\n }\n };\n };\n\n\n // We only start listening for messages / errors when the worker calls addEventListener\n const startOnMessage = memoize(() => {\n $worker.parentPort!.on(\"message\", (data) => {\n workerEvents.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n });\n\n const startOnMessageError = memoize(() => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n const startOnError = memoize(() => {\n $worker.parentPort!.on(\"error\", (data) => {\n workerEvents.dispatchEvent(new Event(\"error\"));\n });\n });\n\n\n // Node workers don't have top-level events, so we have to make our own\n const workerEvents = new EventTarget();\n\n globals.close = () => {\n process.exit();\n };\n\n globals.addEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.addEventListener(type, callback, options);\n\n if (type === \"message\") {\n startOnMessage();\n } else if (type === \"messageerror\") {\n startOnMessageError();\n } else if (type === \"error\") {\n startOnError();\n }\n };\n\n globals.removeEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.removeEventListener(type, callback, options);\n };\n\n function postMessage(message: any, transfer: Transferable[]): void;\n function postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n function postMessage(value: any, transfer: any) {\n $worker.parentPort!.postMessage(value, transfer);\n }\n\n globals.postMessage = postMessage;\n\n makeSetter(\"onmessage\", \"message\");\n makeSetter(\"onmessageerror\", \"messageerror\");\n makeSetter(\"onerror\", \"error\");\n}\n","import \"./polyfill/shared\";\nimport \"./polyfill/crypto\";\nimport \"./polyfill/fetch\";\nimport \"./polyfill/xmlhttprequest\";\nimport \"./polyfill/worker\";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C;AAC5C,IAAA,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC;AAClC;;ACxLA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU;AACzC"}
@@ -1,11 +1,12 @@
1
1
  import './node-polyfill.js';
2
2
  export { Account, BlockHeightSearch, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, createAleoWorker, initializeWasm } from './browser.js';
3
- export { A as AleoKeyProvider, a as AleoKeyProviderParams, b as AleoNetworkClient, C as CREDITS_PROGRAM_KEYS, K as KEY_STORE, d as PRIVATE_TO_PUBLIC_TRANSFER, c as PRIVATE_TRANSFER, e as PRIVATE_TRANSFER_TYPES, h as PUBLIC_TO_PRIVATE_TRANSFER, f as PUBLIC_TRANSFER, g as PUBLIC_TRANSFER_AS_SIGNER, P as ProgramManager, V as VALID_TRANSFER_TYPES, l as logAndThrow } from './program-manager-D6bnpC8Y.js';
3
+ export { A as AleoKeyProvider, a as AleoKeyProviderParams, b as AleoNetworkClient, C as CREDITS_PROGRAM_KEYS, K as KEY_STORE, d as PRIVATE_TO_PUBLIC_TRANSFER, c as PRIVATE_TRANSFER, e as PRIVATE_TRANSFER_TYPES, h as PUBLIC_TO_PRIVATE_TRANSFER, f as PUBLIC_TRANSFER, g as PUBLIC_TRANSFER_AS_SIGNER, P as ProgramManager, V as VALID_TRANSFER_TYPES, l as logAndThrow } from './program-manager-pTXN5gjF.js';
4
4
  export { Address, Ciphertext, ExecutionResponse, Field, Execution as FunctionExecution, Group, OfflineQuery, Plaintext, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
5
5
  import 'core-js/proposals/json-parse-with-source.js';
6
6
  import 'node:crypto';
7
7
  import 'node:fs';
8
- import 'mime/lite.js';
8
+ import 'mime/lite';
9
+ import 'xmlhttprequest-ssl';
9
10
  import 'sync-request';
10
11
  import 'node:worker_threads';
11
12
  import 'node:os';
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -55,7 +55,7 @@ class AleoNetworkClient {
55
55
  else {
56
56
  this.headers = {
57
57
  // This is replaced by the actual version by a Rollup plugin
58
- "X-Aleo-SDK-Version": "0.8.0",
58
+ "X-Aleo-SDK-Version": "0.8.2",
59
59
  };
60
60
  }
61
61
  }
@@ -1347,7 +1347,7 @@ class ProgramManager {
1347
1347
  this.recordProvider = recordProvider;
1348
1348
  }
1349
1349
  /**
1350
- * Deploy an Aleo program to the Aleo network
1350
+ * Builds a deployment transaction for submission to the Aleo network.
1351
1351
  *
1352
1352
  * @param {string} program Program source code
1353
1353
  * @param {number} fee Fee to pay for the transaction
@@ -1371,13 +1371,10 @@ class ProgramManager {
1371
1371
  * // Define a fee in credits
1372
1372
  * const fee = 1.2;
1373
1373
  *
1374
- * // Deploy the program
1375
- * const tx_id = await programManager.deploy(program, fee);
1376
- *
1377
- * // Verify the transaction was successful
1378
- * const transaction = await programManager.networkClient.getTransaction(tx_id);
1374
+ * // Create the deployment transaction.
1375
+ * const tx = await programManager.buildDeploymentTransaction(program, fee, false);
1379
1376
  */
1380
- async deploy(program, fee, privateFee, recordSearchParams, feeRecord, privateKey) {
1377
+ async buildDeploymentTransaction(program, fee, privateFee, recordSearchParams, feeRecord, privateKey) {
1381
1378
  // Ensure the program is valid and does not exist on the network
1382
1379
  try {
1383
1380
  const programObject = Program.fromString(program);
@@ -1429,7 +1426,41 @@ class ProgramManager {
1429
1426
  logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
1430
1427
  }
1431
1428
  // Build a deployment transaction and submit it to the network
1432
- const tx = await ProgramManager$1.buildDeploymentTransaction(deploymentPrivateKey, program, fee, feeRecord, this.host, imports, feeProvingKey, feeVerifyingKey);
1429
+ return await ProgramManager$1.buildDeploymentTransaction(deploymentPrivateKey, program, fee, feeRecord, this.host, imports, feeProvingKey, feeVerifyingKey);
1430
+ }
1431
+ /**
1432
+ * Deploy an Aleo program to the Aleo network
1433
+ *
1434
+ * @param {string} program Program source code
1435
+ * @param {number} fee Fee to pay for the transaction
1436
+ * @param {boolean} privateFee Use a private record to pay the fee. If false this will use the account's public credit balance
1437
+ * @param {RecordSearchParams | undefined} recordSearchParams Optional parameters for searching for a record to use
1438
+ * pay the deployment fee
1439
+ * @param {string | RecordPlaintext | undefined} feeRecord Optional Fee record to use for the transaction
1440
+ * @param {PrivateKey | undefined} privateKey Optional private key to use for the transaction
1441
+ * @returns {string} The transaction id of the deployed program or a failure message from the network
1442
+ *
1443
+ * @example
1444
+ * // Create a new NetworkClient, KeyProvider, and RecordProvider
1445
+ * const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
1446
+ * const keyProvider = new AleoKeyProvider();
1447
+ * const recordProvider = new NetworkRecordProvider(account, networkClient);
1448
+ *
1449
+ * // Initialize a program manager with the key provider to automatically fetch keys for deployments
1450
+ * const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n";
1451
+ * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
1452
+ *
1453
+ * // Define a fee in credits
1454
+ * const fee = 1.2;
1455
+ *
1456
+ * // Deploy the program
1457
+ * const tx_id = await programManager.deploy(program, fee, false);
1458
+ *
1459
+ * // Verify the transaction was successful
1460
+ * const transaction = await programManager.networkClient.getTransaction(tx_id);
1461
+ */
1462
+ async deploy(program, fee, privateFee, recordSearchParams, feeRecord, privateKey) {
1463
+ const tx = await this.buildDeploymentTransaction(program, fee, privateFee, recordSearchParams, feeRecord, privateKey);
1433
1464
  return await this.networkClient.submitTransaction(tx);
1434
1465
  }
1435
1466
  /**
@@ -2335,4 +2366,4 @@ function validateTransferType(transferType) {
2335
2366
  }
2336
2367
 
2337
2368
  export { AleoKeyProvider as A, CREDITS_PROGRAM_KEYS as C, KEY_STORE as K, ProgramManager as P, VALID_TRANSFER_TYPES as V, AleoKeyProviderParams as a, AleoNetworkClient as b, PRIVATE_TRANSFER as c, PRIVATE_TO_PUBLIC_TRANSFER as d, PRIVATE_TRANSFER_TYPES as e, PUBLIC_TRANSFER as f, PUBLIC_TRANSFER_AS_SIGNER as g, PUBLIC_TO_PRIVATE_TRANSFER as h, logAndThrow as l };
2338
- //# sourceMappingURL=program-manager-D6bnpC8Y.js.map
2369
+ //# sourceMappingURL=program-manager-pTXN5gjF.js.map