@oasislabs/parcel
Advanced tools
Comparing version 1.0.0-beta.10 to 1.0.0-beta.11
import type { Primitive } from 'type-fest'; | ||
import type { InputDocumentSpec as $InputDocumentSpec, OutputDocumentSpec as $OutputDatsetSpec } from './compute.js'; | ||
import type { DatabaseId as $DatabaseId } from './database.js'; | ||
import type { DocumentId as $DocumentId } from './document.js'; | ||
@@ -25,2 +26,15 @@ import type { IdentityId as $IdentityId } from './identity.js'; | ||
type Document = DocumentId | DocumentCreator | DocumentOwner | DocumentTitle | DocumentTags; | ||
type DatabaseId = { | ||
'database.id': RelationalOp<$DatabaseId>; | ||
}; | ||
type DatabaseCreator = { | ||
'database.creator': RelationalOp<$IdentityId>; | ||
}; | ||
type DatabaseOwner = { | ||
'database.owner': RelationalOp<$IdentityId>; | ||
}; | ||
type DatabaseName = { | ||
'database.name': RelationalOp<string>; | ||
}; | ||
type Database = DatabaseId | DatabaseCreator | DatabaseOwner | DatabaseName; | ||
type JobImage = { | ||
@@ -46,3 +60,3 @@ 'job.spec.image': RelationalOp<string>; | ||
} | ||
export declare type Selector = Selectors.IdentityId | Selectors.Document | Selectors.Job | Selectors.AccessTime; | ||
export declare type Selector = Selectors.IdentityId | Selectors.Database | Selectors.Document | Selectors.Job | Selectors.AccessTime; | ||
export declare namespace LogicalOps { | ||
@@ -49,0 +63,0 @@ type And = { |
@@ -76,10 +76,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
async function history(client, id, filter) { | ||
var _a, _b; | ||
const podPage = await client.get(endpointForId(id) + '/history', { | ||
...filter, | ||
// Dates must be string-ified since request parameters are of type JSONObject | ||
// and doesn't support Date. | ||
after: (_a = filter === null || filter === void 0 ? void 0 : filter.after) === null || _a === void 0 ? void 0 : _a.getTime(), | ||
before: (_b = filter === null || filter === void 0 ? void 0 : filter.before) === null || _b === void 0 ? void 0 : _b.getTime(), | ||
}); | ||
const podPage = await client.get(endpointForId(id) + '/history', filter); | ||
const results = podPage.results.map((podAccessEvent) => { | ||
@@ -133,3 +126,3 @@ return { | ||
else { | ||
// If `Blob` eixsts, we're probably in the browser and will pefer to use it. | ||
// If `Blob` exists, we're probably in the browser and will prefer to use it. | ||
if (typeof data === 'string' || data instanceof Uint8Array) { | ||
@@ -136,0 +129,0 @@ data = new Blob([data], { type: contentType }); |
@@ -21,3 +21,3 @@ import type { Opaque } from 'type-fest'; | ||
grantee: IdentityId | 'everyone'; | ||
/** The condition that must be matched to receive access to one or more Documents. */ | ||
/** The condition that must be matched to receive access to one or more Assets - Documents and Databases. */ | ||
condition?: Condition; | ||
@@ -43,3 +43,3 @@ /** The capabilities attached to this grant. The default is `read`. */ | ||
readonly grantee: IdentityId | 'everyone'; | ||
/** The condition that describes Documents to be shared. */ | ||
/** The condition that describes Assets - Documents and Databases to be shared. */ | ||
readonly condition?: Condition; | ||
@@ -61,3 +61,3 @@ /** The permission that created this Grant, if any. */ | ||
} | ||
export declare type ListGrantsFilter = Partial<{ | ||
export declare type ListGrantsFilter = { | ||
/** Only return grants from granter. */ | ||
@@ -67,3 +67,3 @@ granter?: IdentityId; | ||
grantee?: IdentityId; | ||
}>; | ||
}; | ||
/** | ||
@@ -70,0 +70,0 @@ * `Capabilities` is a collection of bit flags. |
@@ -21,3 +21,3 @@ /// <reference types="node" /> | ||
constructor(tokenProvider: TokenProvider, config?: Config); | ||
get<T>(endpoint: string, params?: Record<string, string | number | boolean | undefined>, requestOptions?: KyOptions): Promise<T>; | ||
get<T>(endpoint: string, params?: Record<string, string | number | Date | boolean | undefined>, requestOptions?: KyOptions): Promise<T>; | ||
/** Convenience method for POSTing and expecting a 201 response */ | ||
@@ -24,0 +24,0 @@ create<T>(endpoint: string, data: Record<string, JsonSerializable> | FormData, requestOptions?: KyOptions): Promise<T>; |
@@ -85,3 +85,3 @@ var _a, _b, _c, _d, _e, _f; | ||
hasParams = true; | ||
kebabCaseParams[paramCase(k)] = v; | ||
kebabCaseParams[paramCase(k)] = v instanceof Date ? v.getTime() : v; | ||
} | ||
@@ -88,0 +88,0 @@ } |
@@ -13,2 +13,3 @@ /** | ||
import type { Condition } from './condition.js'; | ||
import type { Database, DatabaseCreateParams, DatabaseId, DatabaseUpdateParams, ListDatabasesFilter, Query, Row } from './database.js'; | ||
import type { AccessEvent, Document, DocumentId, DocumentSearchParams, DocumentUpdateParams, DocumentUploadParams, ListAccessLogFilter, Storable, Upload } from './document.js'; | ||
@@ -20,2 +21,3 @@ import type { Grant, GrantCreateParams, GrantId } from './grant.js'; | ||
import type { GrantedPermission, Identity, IdentityCreateParams, IdentityId, IdentityUpdateParams } from './identity.js'; | ||
import type { GetUsageFilter, MeteringQuota, MeteringReport, QuotaUpdateParams } from './meter.js'; | ||
import type { Page, PageParams } from './model.js'; | ||
@@ -25,3 +27,3 @@ import type { Permission, PermissionCreateParams, PermissionId } from './permission.js'; | ||
import { PARCEL_RUNTIME_AUD } from './token.js'; | ||
export { AccessEvent, ApiError, App, AppCreateParams, AppId, AppUpdateParams, BackendClient, BackendClientCreateParams, BackendClientUpdateParams, Capabilities, Client, ClientCreateParams, ClientCredentials, ClientId, ClientType, Condition, Document, DocumentId, DocumentUpdateParams, DocumentUploadParams, Download, FrontendClient, FrontendClientCreateParams, FrontendClientUpdateParams, Grant, GrantCreateParams, GrantId, GrantedPermission, Identity, IdentityCreateParams, IdentityId, IdentityUpdateParams, InputDocumentSpec, Job, JobId, JobPhase, JobSpec, JobStatus, JobStatusReport, OutputDocument, OutputDocumentSpec, PARCEL_RUNTIME_AUD, Page, PageParams, Permission, PermissionCreateParams, PermissionId, PrivateJWK, PublicJWK, RefreshingTokenProviderParams, RenewingTokenProviderParams, Scope, SelfIssuedTokenProviderParams, ServiceClient, ServiceClientCreateParams, ServiceClientUpdateParams, Storable, TokenSource, }; | ||
export { AccessEvent, ApiError, App, AppCreateParams, AppId, AppUpdateParams, BackendClient, BackendClientCreateParams, BackendClientUpdateParams, Capabilities, Client, ClientCreateParams, ClientCredentials, ClientId, ClientType, Condition, Database, DatabaseCreateParams, DatabaseId, DatabaseUpdateParams, Document, DocumentId, DocumentUpdateParams, DocumentUploadParams, Download, FrontendClient, FrontendClientCreateParams, FrontendClientUpdateParams, GetUsageFilter, Grant, GrantCreateParams, GrantId, GrantedPermission, Identity, IdentityCreateParams, IdentityId, IdentityUpdateParams, InputDocumentSpec, Job, JobId, JobPhase, JobSpec, JobStatus, JobStatusReport, MeteringQuota, MeteringReport, OutputDocument, OutputDocumentSpec, PARCEL_RUNTIME_AUD, Page, PageParams, Permission, PermissionCreateParams, PermissionId, PrivateJWK, PublicJWK, QuotaUpdateParams, RefreshingTokenProviderParams, RenewingTokenProviderParams, Scope, SelfIssuedTokenProviderParams, ServiceClient, ServiceClientCreateParams, ServiceClientUpdateParams, Storable, TokenSource, }; | ||
/** | ||
@@ -47,2 +49,8 @@ * Example: | ||
getCurrentIdentity(): Promise<Identity>; | ||
createDatabase(params: DatabaseCreateParams): Promise<Database>; | ||
getDatabase(id: DatabaseId): Promise<Database>; | ||
updateDatabase(id: DatabaseId, params: DatabaseUpdateParams): Promise<Database>; | ||
queryDatabase(id: DatabaseId, params: Query): Promise<Row[]>; | ||
listDatabase(params: ListDatabasesFilter & PageParams): Promise<Page<Database>>; | ||
deleteDatabase(id: DatabaseId): Promise<void>; | ||
uploadDocument(data: Storable, params: DocumentUploadParams | undefined | null): Upload; | ||
@@ -99,2 +107,16 @@ getDocument(id: DocumentId): Promise<Document>; | ||
terminateJob(jobId: JobId): Promise<void>; | ||
/** | ||
* Gets a metering report for your API usage. | ||
* @param filter Controls API usage window. | ||
*/ | ||
getUsage(filter?: GetUsageFilter): Promise<MeteringReport>; | ||
/** | ||
* Gets your monthly API usage quota limits. | ||
*/ | ||
getQuota(): Promise<MeteringQuota>; | ||
/** | ||
* Updates your monthly API usage quota limits. | ||
* @param params Specifies monthly quota limits to enforce until you change them again. | ||
*/ | ||
setQuota(params: QuotaUpdateParams): Promise<MeteringQuota>; | ||
} | ||
@@ -101,0 +123,0 @@ export default Parcel; |
import { AppImpl } from './app.js'; | ||
import { BackendClient, ClientImpl, ClientType, FrontendClient, ServiceClient } from './client.js'; | ||
import { ComputeImpl, JobPhase, } from './compute.js'; | ||
import { DatabaseImpl } from './database.js'; | ||
import { DocumentImpl } from './document.js'; | ||
@@ -8,2 +9,3 @@ import { Capabilities, GrantImpl } from './grant.js'; | ||
import { IdentityImpl } from './identity.js'; | ||
import { MeterImpl } from './meter.js'; | ||
import { PermissionImpl } from './permission.js'; | ||
@@ -46,2 +48,20 @@ import { TokenProvider, PARCEL_RUNTIME_AUD } from './token.js'; | ||
} | ||
async createDatabase(params) { | ||
return DatabaseImpl.create(this.client, params); | ||
} | ||
async getDatabase(id) { | ||
return DatabaseImpl.get(this.client, id); | ||
} | ||
async updateDatabase(id, params) { | ||
return DatabaseImpl.update(this.client, id, params); | ||
} | ||
async queryDatabase(id, params) { | ||
return DatabaseImpl.query(this.client, id, params); | ||
} | ||
async listDatabase(params) { | ||
return DatabaseImpl.list(this.client, params); | ||
} | ||
async deleteDatabase(id) { | ||
return DatabaseImpl.delete_(this.client, id); | ||
} | ||
uploadDocument(data, params) { | ||
@@ -156,4 +176,24 @@ return DocumentImpl.upload(this.client, data, params); | ||
} | ||
/** | ||
* Gets a metering report for your API usage. | ||
* @param filter Controls API usage window. | ||
*/ | ||
async getUsage(filter) { | ||
return MeterImpl.getUsage(this.client, filter); | ||
} | ||
/** | ||
* Gets your monthly API usage quota limits. | ||
*/ | ||
async getQuota() { | ||
return MeterImpl.getQuota(this.client); | ||
} | ||
/** | ||
* Updates your monthly API usage quota limits. | ||
* @param params Specifies monthly quota limits to enforce until you change them again. | ||
*/ | ||
async setQuota(params) { | ||
return MeterImpl.setQuota(this.client, params); | ||
} | ||
} | ||
export default Parcel; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@oasislabs/parcel", | ||
"version": "1.0.0-beta.10", | ||
"version": "1.0.0-beta.11", | ||
"license": "Apache-2.0", | ||
@@ -21,3 +21,3 @@ "author": "Oasis Labs <feedback@oasislabs.com>", | ||
"fmt": "xo --fix && prettier --write {tsconfig,package}.json", | ||
"lint": "xo && prettier --check {tsconfig,package}.json && tools/update-examples-parcel-version.sh --check", | ||
"lint": "xo && prettier --check {tsconfig,package}.json", | ||
"test": "jest", | ||
@@ -48,3 +48,3 @@ "test:unit": "jest test/jest/unit/", | ||
"^@oasislabs/parcel$": "<rootDir>/src/index", | ||
"^\\./(app|client|compute|condition|document|grant|http|identity|model|permission|polyfill|token).js$": "<rootDir>/src/$1", | ||
"^\\./(app|client|compute|condition|database|document|grant|http|identity|meter|model|permission|polyfill|token).js$": "<rootDir>/src/$1", | ||
"^@oasislabs/parcel/(.*)$": "<rootDir>/src/$1" | ||
@@ -51,0 +51,0 @@ }, |
@@ -7,2 +7,3 @@ import type { Primitive } from 'type-fest'; | ||
} from './compute.js'; | ||
import type { DatabaseId as $DatabaseId } from './database.js'; | ||
import type { DocumentId as $DocumentId } from './document.js'; | ||
@@ -41,2 +42,16 @@ import type { IdentityId as $IdentityId } from './identity.js'; | ||
export type DatabaseId = { | ||
'database.id': RelationalOp<$DatabaseId>; | ||
}; | ||
export type DatabaseCreator = { | ||
'database.creator': RelationalOp<$IdentityId>; | ||
}; | ||
export type DatabaseOwner = { | ||
'database.owner': RelationalOp<$IdentityId>; | ||
}; | ||
export type DatabaseName = { | ||
'database.name': RelationalOp<string>; | ||
}; | ||
export type Database = DatabaseId | DatabaseCreator | DatabaseOwner | DatabaseName; | ||
// Action-based selectors. | ||
@@ -68,2 +83,3 @@ export type JobImage = { | ||
| Selectors.IdentityId | ||
| Selectors.Database | ||
| Selectors.Document | ||
@@ -70,0 +86,0 @@ | Selectors.Job |
@@ -119,9 +119,3 @@ import type { ReadStream } from 'fs'; | ||
): Promise<Page<AccessEvent>> { | ||
const podPage = await client.get<Page<PODAccessEvent>>(endpointForId(id) + '/history', { | ||
...filter, | ||
// Dates must be string-ified since request parameters are of type JSONObject | ||
// and doesn't support Date. | ||
after: filter?.after?.getTime(), | ||
before: filter?.before?.getTime(), | ||
}); | ||
const podPage = await client.get<Page<PODAccessEvent>>(endpointForId(id) + '/history', filter); | ||
@@ -292,3 +286,3 @@ const results = podPage.results.map((podAccessEvent) => { | ||
} else { | ||
// If `Blob` eixsts, we're probably in the browser and will pefer to use it. | ||
// If `Blob` exists, we're probably in the browser and will prefer to use it. | ||
if (typeof data === 'string' || data instanceof Uint8Array) { | ||
@@ -295,0 +289,0 @@ data = new Blob([data], { type: contentType }); |
@@ -29,3 +29,3 @@ import type { Opaque } from 'type-fest'; | ||
/** The condition that must be matched to receive access to one or more Documents. */ | ||
/** The condition that must be matched to receive access to one or more Assets - Documents and Databases. */ | ||
condition?: Condition; | ||
@@ -56,3 +56,3 @@ | ||
public readonly grantee: IdentityId | 'everyone'; | ||
/** The condition that describes Documents to be shared. */ | ||
/** The condition that describes Assets - Documents and Databases to be shared. */ | ||
public readonly condition?: Condition; | ||
@@ -109,3 +109,3 @@ /** The permission that created this Grant, if any. */ | ||
export type ListGrantsFilter = Partial<{ | ||
export type ListGrantsFilter = { | ||
/** Only return grants from granter. */ | ||
@@ -116,3 +116,3 @@ granter?: IdentityId; | ||
grantee?: IdentityId; | ||
}>; | ||
}; | ||
@@ -119,0 +119,0 @@ /** |
@@ -117,3 +117,3 @@ import type { WriteStream } from 'fs'; | ||
endpoint: string, | ||
params: Record<string, string | number | boolean | undefined> = {}, | ||
params: Record<string, string | number | Date | boolean | undefined> = {}, | ||
requestOptions?: KyOptions, | ||
@@ -126,3 +126,3 @@ ): Promise<T> { | ||
hasParams = true; | ||
kebabCaseParams[paramCase(k)] = v; | ||
kebabCaseParams[paramCase(k)] = v instanceof Date ? v.getTime() : v; | ||
} | ||
@@ -129,0 +129,0 @@ } |
@@ -34,2 +34,12 @@ /** | ||
import type { | ||
Database, | ||
DatabaseCreateParams, | ||
DatabaseId, | ||
DatabaseUpdateParams, | ||
ListDatabasesFilter, | ||
Query, | ||
Row, | ||
} from './database.js'; | ||
import { DatabaseImpl } from './database.js'; | ||
import type { | ||
AccessEvent, | ||
@@ -58,2 +68,4 @@ Document, | ||
import { IdentityImpl } from './identity.js'; | ||
import type { GetUsageFilter, MeteringQuota, MeteringReport, QuotaUpdateParams } from './meter.js'; | ||
import { MeterImpl } from './meter.js'; | ||
import type { Page, PageParams } from './model.js'; | ||
@@ -91,2 +103,6 @@ import type { Permission, PermissionCreateParams, PermissionId } from './permission.js'; | ||
Condition, | ||
Database, | ||
DatabaseCreateParams, | ||
DatabaseId, | ||
DatabaseUpdateParams, | ||
Document, | ||
@@ -100,2 +116,3 @@ DocumentId, | ||
FrontendClientUpdateParams, | ||
GetUsageFilter, | ||
Grant, | ||
@@ -116,2 +133,4 @@ GrantCreateParams, | ||
JobStatusReport, | ||
MeteringQuota, | ||
MeteringReport, | ||
OutputDocument, | ||
@@ -127,2 +146,3 @@ OutputDocumentSpec, | ||
PublicJWK, | ||
QuotaUpdateParams, | ||
RefreshingTokenProviderParams, | ||
@@ -181,2 +201,26 @@ RenewingTokenProviderParams, | ||
public async createDatabase(params: DatabaseCreateParams): Promise<Database> { | ||
return DatabaseImpl.create(this.client, params); | ||
} | ||
public async getDatabase(id: DatabaseId): Promise<Database> { | ||
return DatabaseImpl.get(this.client, id); | ||
} | ||
public async updateDatabase(id: DatabaseId, params: DatabaseUpdateParams): Promise<Database> { | ||
return DatabaseImpl.update(this.client, id, params); | ||
} | ||
public async queryDatabase(id: DatabaseId, params: Query): Promise<Row[]> { | ||
return DatabaseImpl.query(this.client, id, params); | ||
} | ||
public async listDatabase(params: ListDatabasesFilter & PageParams): Promise<Page<Database>> { | ||
return DatabaseImpl.list(this.client, params); | ||
} | ||
public async deleteDatabase(id: DatabaseId): Promise<void> { | ||
return DatabaseImpl.delete_(this.client, id); | ||
} | ||
public uploadDocument(data: Storable, params: DocumentUploadParams | undefined | null): Upload { | ||
@@ -331,2 +375,25 @@ return DocumentImpl.upload(this.client, data, params); | ||
} | ||
/** | ||
* Gets a metering report for your API usage. | ||
* @param filter Controls API usage window. | ||
*/ | ||
public async getUsage(filter?: GetUsageFilter): Promise<MeteringReport> { | ||
return MeterImpl.getUsage(this.client, filter); | ||
} | ||
/** | ||
* Gets your monthly API usage quota limits. | ||
*/ | ||
public async getQuota(): Promise<MeteringQuota> { | ||
return MeterImpl.getQuota(this.client); | ||
} | ||
/** | ||
* Updates your monthly API usage quota limits. | ||
* @param params Specifies monthly quota limits to enforce until you change them again. | ||
*/ | ||
public async setQuota(params: QuotaUpdateParams): Promise<MeteringQuota> { | ||
return MeterImpl.setQuota(this.client, params); | ||
} | ||
} | ||
@@ -333,0 +400,0 @@ |
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
1310045
78
37019