@oasislabs/parcel
Advanced tools
@@ -46,3 +46,3 @@ import type { Opaque } from 'type-fest'; | ||
* Generally, you don't need to set this unless you're differentiating | ||
* among multple documents that all require a certain access time. | ||
* among multiple documents that all require a certain access time. | ||
*/ | ||
@@ -49,0 +49,0 @@ accessTime?: Date; |
@@ -14,2 +14,4 @@ import type { Opaque } from 'type-fest'; | ||
submitter?: IdentityId; | ||
/** Selects jobs that used documents owned by this identity. */ | ||
inputOwner?: IdentityId; | ||
}; | ||
@@ -102,6 +104,9 @@ /** | ||
/** | ||
* Documents that were accessed by the job. Includes both the prespecified | ||
* `JobSpec.input_documents` as well as any dynamically accessed documents. | ||
*/ | ||
accessedDocuments: DocumentId[]; | ||
/** | ||
* Documents that were generated by the job and uploaded by the Parcel | ||
* Worker. For a pending or running job, this list will be empty. For a | ||
* successfully completed job, each `outputDocument` entry from the job spec will | ||
* have a corresponding entry in this list. | ||
* Worker. | ||
*/ | ||
@@ -108,0 +113,0 @@ outputDocuments: OutputDocument[]; |
import type { Primitive } from 'type-fest'; | ||
import type { InputDocumentSpec as $InputDocumentSpec, OutputDocumentSpec as $OutputDatsetSpec } from './compute.js'; | ||
import type { InputDocumentSpec as $InputDocumentSpec, OutputDocumentSpec as $OutputDocumentSpec } from './compute.js'; | ||
import type { DatabaseId as $DatabaseId } from './database.js'; | ||
@@ -46,3 +46,3 @@ import type { DocumentId as $DocumentId } from './document.js'; | ||
type JobOutputs = { | ||
'job.spec.outputs': RelationalOp<$OutputDatsetSpec>; | ||
'job.spec.outputs': RelationalOp<$OutputDocumentSpec>; | ||
}; | ||
@@ -49,0 +49,0 @@ type Job = JobImage | JobInputs | JobOutputs; |
@@ -37,4 +37,4 @@ /// <reference types="node" /> | ||
readonly owner: IdentityId; | ||
readonly details: DocumentDetails; | ||
/** Additional, optional information about the document. */ | ||
readonly details: DocumentDetails; | ||
readonly originatingJob?: JobId; | ||
@@ -41,0 +41,0 @@ constructor(client: HttpClient, pod: PODDocument); |
@@ -67,3 +67,3 @@ import type { Opaque } from 'type-fest'; | ||
* `Capabilities` is a collection of bit flags. | ||
* To test if a cability is set, you can do something like | ||
* To test if a capability is set, you can do something like | ||
* ``` | ||
@@ -70,0 +70,0 @@ * const requiredCaps = (Capabilities.Read | Capabilities.Extend); |
@@ -59,3 +59,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
* `Capabilities` is a collection of bit flags. | ||
* To test if a cability is set, you can do something like | ||
* To test if a capability is set, you can do something like | ||
* ``` | ||
@@ -62,0 +62,0 @@ * const requiredCaps = (Capabilities.Read | Capabilities.Extend); |
@@ -6,3 +6,3 @@ var _a, _b, _c, _d, _e, _f; | ||
import { paramCase } from 'param-case'; | ||
import { ReadableStreamPF } from './polyfill.js'; | ||
import { pipeToPolyfill } from './polyfill.js'; | ||
const DEFAULT_API_URL = (_c = (_b = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.PARCEL_API_URL) !== null && _c !== void 0 ? _c : 'https://api.oasislabs.com/parcel/v1'; | ||
@@ -260,4 +260,3 @@ const DEFAULT_STORAGE_URL = (_f = (_e = (_d = globalThis === null || globalThis === void 0 ? void 0 : globalThis.process) === null || _d === void 0 ? void 0 : _d.env) === null || _e === void 0 ? void 0 : _e.PARCEL_STORAGE_URL) !== null && _f !== void 0 ? _f : 'https://storage.oasislabs.com/v1/parcel'; | ||
// Firefox's native ReadableStream is missing pipeTo. | ||
body._readableStreamController = null; // https://github.com/MattiasBuelens/web-streams-polyfill/blob/36c08de/src/lib/readable-stream.ts#L407 | ||
return ReadableStreamPF.prototype.pipeTo.call(body, sink); | ||
return pipeToPolyfill(body, sink); | ||
} | ||
@@ -278,3 +277,3 @@ // eslint-disable-next-line node/no-unsupported-features/es-syntax | ||
*/ | ||
// This funciton returns double promise to make both xo and TS happy. V8 doesn't care. | ||
// This function returns double promise to make both xo and TS happy. V8 doesn't care. | ||
async makeRequest() { | ||
@@ -281,0 +280,0 @@ if (!this.res) { |
@@ -52,3 +52,3 @@ /** | ||
queryDatabase(id: DatabaseId, params: Query): Promise<Row[]>; | ||
listDatabase(params: ListDatabasesFilter & PageParams): Promise<Page<Database>>; | ||
listDatabases(params: ListDatabasesFilter & PageParams): Promise<Page<Database>>; | ||
deleteDatabase(id: DatabaseId): Promise<void>; | ||
@@ -55,0 +55,0 @@ uploadDocument(data: Storable, params: DocumentUploadParams | undefined | null): Upload; |
@@ -61,3 +61,3 @@ import { AppImpl } from './app.js'; | ||
} | ||
async listDatabase(params) { | ||
async listDatabases(params) { | ||
return DatabaseImpl.list(this.client, params); | ||
@@ -64,0 +64,0 @@ } |
@@ -1,6 +0,5 @@ | ||
declare const ReadableStreamPF: { | ||
new <R = any>(underlyingSource?: UnderlyingSource<R> | undefined, strategy?: QueuingStrategy<R> | undefined): ReadableStream<R>; | ||
prototype: ReadableStream<any>; | ||
}; | ||
export { ReadableStreamPF }; | ||
/// <reference types="node" /> | ||
import type { Writable } from 'stream'; | ||
import type { WriteStream } from 'fs'; | ||
export declare function pipeToPolyfill(body: ReadableStream, sink: Writable | WriteStream | WritableStream): Promise<undefined>; | ||
//# sourceMappingURL=polyfill.d.ts.map |
// The following code is inlined from `ky-universal` because it uses ES modules and | ||
// top-level await, which are not currently well supported by tools like Jest. | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
import { createReadableStreamWrapper, createWritableStreamWrapper, } from '@mattiasbuelens/web-streams-adapter'; | ||
import AbortController from 'abort-controller'; | ||
import FormData from 'form-data'; | ||
import fetch, { Headers, Request as RequestPF, Response as ResponsePF } from 'node-fetch'; | ||
// @ts-expect-error: The package isn't ESM-compatible. | ||
import * as webStreams from 'web-streams-polyfill/dist/ponyfill.es2018.js'; | ||
@@ -18,4 +18,9 @@ globalThis.fetch = | ||
globalThis.WritableStream = (_h = globalThis.WritableStream) !== null && _h !== void 0 ? _h : webStreams.WritableStream; | ||
const ReadableStreamPF = webStreams.ReadableStream; | ||
export { ReadableStreamPF }; | ||
const toReadableStreamPF = createReadableStreamWrapper(webStreams.ReadableStream); | ||
const toWritableStreamPF = createWritableStreamWrapper(webStreams.WritableStream); | ||
export async function pipeToPolyfill(body, sink) { | ||
const readablePF = toReadableStreamPF(body); | ||
const writablePF = toWritableStreamPF(sink); | ||
return readablePF.pipeTo(writablePF); | ||
} | ||
//# sourceMappingURL=polyfill.js.map |
{ | ||
"name": "@oasislabs/parcel", | ||
"version": "1.0.0-beta.12", | ||
"version": "1.0.0-beta.13", | ||
"license": "Apache-2.0", | ||
@@ -29,3 +29,5 @@ "author": "Oasis Labs <feedback@oasislabs.com>", | ||
"doc": "typedoc --options docs/typedoc.json", | ||
"prepublishOnly": "yarn build" | ||
"prepublishOnly": "yarn build", | ||
"prepack": "echo 'Normalize permissions for packing...'; find README.md package.json lib src -type f -exec chmod 664 {} \\;", | ||
"consistent-pack": "docker run -v \"${PWD}:${PWD}\" --workdir \"${PWD}\" --user \"${UID}:${GID}\" -it node:14-alpine npm pack" | ||
}, | ||
@@ -96,2 +98,3 @@ "jest": { | ||
"dependencies": { | ||
"@mattiasbuelens/web-streams-adapter": "^0.1.0", | ||
"@types/readable-stream": "^2.3.9", | ||
@@ -98,0 +101,0 @@ "abort-controller": "^3.0.0", |
@@ -65,3 +65,3 @@ import type { Opaque } from 'type-fest'; | ||
* Generally, you don't need to set this unless you're differentiating | ||
* among multple documents that all require a certain access time. | ||
* among multiple documents that all require a certain access time. | ||
*/ | ||
@@ -68,0 +68,0 @@ accessTime?: Date; |
@@ -17,2 +17,5 @@ import type { Opaque } from 'type-fest'; | ||
submitter?: IdentityId; | ||
/** Selects jobs that used documents owned by this identity. */ | ||
inputOwner?: IdentityId; | ||
}; | ||
@@ -119,6 +122,10 @@ | ||
/** | ||
* Documents that were accessed by the job. Includes both the prespecified | ||
* `JobSpec.input_documents` as well as any dynamically accessed documents. | ||
*/ | ||
accessedDocuments: DocumentId[]; | ||
/** | ||
* Documents that were generated by the job and uploaded by the Parcel | ||
* Worker. For a pending or running job, this list will be empty. For a | ||
* successfully completed job, each `outputDocument` entry from the job spec will | ||
* have a corresponding entry in this list. | ||
* Worker. | ||
*/ | ||
@@ -125,0 +132,0 @@ outputDocuments: OutputDocument[]; |
@@ -5,3 +5,3 @@ import type { Primitive } from 'type-fest'; | ||
InputDocumentSpec as $InputDocumentSpec, | ||
OutputDocumentSpec as $OutputDatsetSpec, | ||
OutputDocumentSpec as $OutputDocumentSpec, | ||
} from './compute.js'; | ||
@@ -64,3 +64,3 @@ import type { DatabaseId as $DatabaseId } from './database.js'; | ||
export type JobOutputs = { | ||
'job.spec.outputs': RelationalOp<$OutputDatsetSpec>; | ||
'job.spec.outputs': RelationalOp<$OutputDocumentSpec>; | ||
}; | ||
@@ -67,0 +67,0 @@ export type Job = JobImage | JobInputs | JobOutputs; |
@@ -43,5 +43,5 @@ import type { ReadStream } from 'fs'; | ||
public readonly owner: IdentityId; | ||
public readonly details: DocumentDetails; | ||
/** Additional, optional information about the document. */ | ||
public readonly details: DocumentDetails; | ||
public readonly originatingJob?: JobId; | ||
@@ -48,0 +48,0 @@ |
@@ -117,3 +117,3 @@ import type { Opaque } from 'type-fest'; | ||
* `Capabilities` is a collection of bit flags. | ||
* To test if a cability is set, you can do something like | ||
* To test if a capability is set, you can do something like | ||
* ``` | ||
@@ -120,0 +120,0 @@ * const requiredCaps = (Capabilities.Read | Capabilities.Extend); |
@@ -13,3 +13,3 @@ import type { WriteStream } from 'fs'; | ||
import type { TokenProvider } from './token.js'; | ||
import { ReadableStreamPF } from './polyfill.js'; | ||
import { pipeToPolyfill } from './polyfill.js'; | ||
@@ -333,4 +333,3 @@ const DEFAULT_API_URL = | ||
// Firefox's native ReadableStream is missing pipeTo. | ||
(body as any)._readableStreamController = null; // https://github.com/MattiasBuelens/web-streams-polyfill/blob/36c08de/src/lib/readable-stream.ts#L407 | ||
return ReadableStreamPF.prototype.pipeTo.call(body, sink); | ||
return pipeToPolyfill(body, sink); | ||
} | ||
@@ -353,3 +352,3 @@ | ||
*/ | ||
// This funciton returns double promise to make both xo and TS happy. V8 doesn't care. | ||
// This function returns double promise to make both xo and TS happy. V8 doesn't care. | ||
private async makeRequest(): Promise<Response> { | ||
@@ -356,0 +355,0 @@ if (!this.res) { |
@@ -246,3 +246,3 @@ /** | ||
public async listDatabase(params: ListDatabasesFilter & PageParams): Promise<Page<Database>> { | ||
public async listDatabases(params: ListDatabasesFilter & PageParams): Promise<Page<Database>> { | ||
return DatabaseImpl.list(this.client, params); | ||
@@ -249,0 +249,0 @@ } |
// The following code is inlined from `ky-universal` because it uses ES modules and | ||
// top-level await, which are not currently well supported by tools like Jest. | ||
import type { Writable } from 'stream'; | ||
import type { WriteStream } from 'fs'; | ||
import { | ||
createReadableStreamWrapper, | ||
createWritableStreamWrapper, | ||
} from '@mattiasbuelens/web-streams-adapter'; | ||
import AbortController from 'abort-controller'; | ||
import FormData from 'form-data'; | ||
import fetch, { Headers, Request as RequestPF, Response as ResponsePF } from 'node-fetch'; | ||
// @ts-expect-error: The package isn't ESM-compatible. | ||
import * as webStreams from 'web-streams-polyfill/dist/ponyfill.es2018.js'; | ||
@@ -20,5 +25,17 @@ | ||
globalThis.WritableStream = globalThis.WritableStream ?? webStreams.WritableStream; | ||
const toReadableStreamPF = createReadableStreamWrapper(webStreams.ReadableStream) as unknown as ( | ||
r: globalThis.ReadableStream, | ||
) => webStreams.ReadableStream; | ||
const ReadableStreamPF = webStreams.ReadableStream as typeof globalThis.ReadableStream; | ||
const toWritableStreamPF = createWritableStreamWrapper(webStreams.WritableStream) as unknown as ( | ||
w: globalThis.WritableStream, | ||
) => webStreams.WritableStream; | ||
export { ReadableStreamPF }; | ||
export async function pipeToPolyfill( | ||
body: ReadableStream, | ||
sink: Writable | WriteStream | WritableStream, | ||
) { | ||
const readablePF = toReadableStreamPF(body); | ||
const writablePF = toWritableStreamPF(sink as webStreams.WritableStream); | ||
return readablePF.pipeTo(writablePF); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1415384
1.68%89
1.14%38952
1.54%11
10%