Comparing version 9.0.5 to 9.0.6
@@ -14,7 +14,7 @@ import { type ConfigParams } from './config_parser.js'; | ||
put: (doc: import("../types/nano.js").IdentifiedDocument | import("types/types.js").RecoveredDoc, params?: import("../types/nano.js").DocumentInsertParams) => Promise<import("../types/nano.js").DocumentInsertResponse>; | ||
post: <D extends import("types/types.js").NewDoc>(doc: D, params?: import("../types/nano.js").DocumentInsertParams) => Promise<import("../types/nano.js").DocumentInsertResponse>; | ||
post: <D extends import("../types/nano.js").MaybeDocument>(doc: D, params?: import("../types/nano.js").DocumentInsertParams) => Promise<import("../types/nano.js").DocumentInsertResponse>; | ||
update: <D extends import("../types/nano.js").Document = import("../types/nano.js").Document>(docId: D["_id"], fn: import("types/types.js").DocTranformer<D>, options?: import("types/types.js").UpdateOptions) => Promise<import("../types/nano.js").DocumentInsertResponse>; | ||
delete: <D extends import("../types/nano.js").Document = import("../types/nano.js").Document>(docId: D["_id"], rev: D["_rev"]) => Promise<import("../types/nano.js").DocumentDestroyResponse>; | ||
undelete: <D extends import("../types/nano.js").Document = import("../types/nano.js").Document>(docId: D["_id"]) => Promise<import("../types/nano.js").DocumentInsertResponse>; | ||
bulk: <D extends import("../types/nano.js").Document = import("../types/nano.js").Document>(docs: D[]) => Promise<import("../types/nano.js").DocumentBulkResponse[]>; | ||
bulk: <D extends import("../types/nano.js").MaybeDocument = import("../types/nano.js").MaybeDocument>(docs: D[]) => Promise<import("../types/nano.js").DocumentBulkResponse[]>; | ||
buildQueryString: (query?: import("../types/nano.js").DocumentViewQuery) => string; | ||
@@ -21,0 +21,0 @@ viewQuery: <D extends import("../types/nano.js").Document = import("../types/nano.js").Document, K extends import("types/types.js").ViewKey = import("types/types.js").ViewKey, V = unknown>(path: string, query?: import("../types/nano.js").DocumentViewQuery) => Promise<import("../types/nano.js").DocumentViewResponse<D, K, V>>; |
@@ -1,3 +0,3 @@ | ||
import type { CreateIndexRequest, CreateIndexResponse, DatabaseChangesParams, DatabaseChangesResponse, Document, DocumentBulkResponse, DocumentDestroyResponse, DocumentGetResponse, DocumentInsertParams, DocumentInsertResponse, DocumentLookupFailure, DocumentViewQuery, DocumentViewResponse, IdentifiedDocument, InfoResponse, MangoResponse } from '../types/nano.js'; | ||
import type { DocTranformer, FetchOptions, FindOptions, FindQuery, JsonRequest, NewDoc, TestFunction, RecoveredDoc, UpdateOptions, ViewKey, DocumentDeletedFailure, RevInfo, DocumentViewKeysQuery } from 'types/types.js'; | ||
import type { CreateIndexRequest, CreateIndexResponse, DatabaseChangesParams, DatabaseChangesResponse, Document, DocumentBulkResponse, DocumentDestroyResponse, DocumentGetResponse, DocumentInsertParams, DocumentInsertResponse, DocumentLookupFailure, DocumentViewQuery, DocumentViewResponse, IdentifiedDocument, InfoResponse, MangoResponse, MaybeDocument } from '../types/nano.js'; | ||
import type { DocTranformer, FetchOptions, FindOptions, FindQuery, JsonRequest, TestFunction, RecoveredDoc, UpdateOptions, ViewKey, DocumentDeletedFailure, RevInfo, DocumentViewKeysQuery } from 'types/types.js'; | ||
export default function (jsonRequest: JsonRequest, dbName: string): { | ||
@@ -9,7 +9,7 @@ docUrl: <D extends Document = Document>(docId: D["_id"]) => string; | ||
put: (doc: IdentifiedDocument | RecoveredDoc, params?: DocumentInsertParams) => Promise<DocumentInsertResponse>; | ||
post: <D extends NewDoc>(doc: D, params?: DocumentInsertParams) => Promise<DocumentInsertResponse>; | ||
post: <D extends MaybeDocument>(doc: D, params?: DocumentInsertParams) => Promise<DocumentInsertResponse>; | ||
update: <D extends Document = Document>(docId: D["_id"], fn: DocTranformer<D>, options?: UpdateOptions) => Promise<DocumentInsertResponse>; | ||
delete: <D extends Document = Document>(docId: D["_id"], rev: D["_rev"]) => Promise<DocumentDestroyResponse>; | ||
undelete: <D extends Document = Document>(docId: D["_id"]) => Promise<DocumentInsertResponse>; | ||
bulk: <D extends Document = Document>(docs: D[]) => Promise<DocumentBulkResponse[]>; | ||
bulk: <D extends MaybeDocument = MaybeDocument>(docs: D[]) => Promise<DocumentBulkResponse[]>; | ||
buildQueryString: (query?: DocumentViewQuery) => string; | ||
@@ -16,0 +16,0 @@ viewQuery: <D extends Document = Document, K extends ViewKey = ViewKey, V = unknown>(path: string, query?: DocumentViewQuery) => Promise<DocumentViewResponse<D, K, V>>; |
@@ -7,5 +7,2 @@ import type { Document, DocumentInsertResponse, DocumentViewQuery } from './nano.js'; | ||
export type ViewName = string; | ||
export interface NewDoc { | ||
_id?: DocId; | ||
} | ||
export interface RecoveredDoc { | ||
@@ -12,0 +9,0 @@ _id: DocId; |
@@ -5,4 +5,4 @@ import querystring from 'node:querystring' | ||
import { isPlainObject, validateString, validateArray, validatePlainObject, isIdentifiedDocument } from './utils.js' | ||
import type { CreateIndexRequest, CreateIndexResponse, DatabaseChangesParams, DatabaseChangesResponse, Document, DocumentBulkResponse, DocumentDestroyResponse, DocumentFetchResponse, DocumentGetResponse, DocumentInsertParams, DocumentInsertResponse, DocumentLookupFailure, DocumentViewQuery, DocumentViewResponse, IdentifiedDocument, InfoResponse, MangoResponse } from '../types/nano.js' | ||
import type { DocTranformer, FetchOptions, FindOptions, FindQuery, JsonRequest, NewDoc, TestFunction, RecoveredDoc, UpdateOptions, ViewKey, DocumentDeletedFailure, RevInfo, DocumentRevertResponse, DocumentViewKeysQuery, ViewValue } from 'types/types.js' | ||
import type { CreateIndexRequest, CreateIndexResponse, DatabaseChangesParams, DatabaseChangesResponse, Document, DocumentBulkResponse, DocumentDestroyResponse, DocumentFetchResponse, DocumentGetResponse, DocumentInsertParams, DocumentInsertResponse, DocumentLookupFailure, DocumentViewQuery, DocumentViewResponse, IdentifiedDocument, InfoResponse, MangoResponse, MaybeDocument } from '../types/nano.js' | ||
import type { DocTranformer, FetchOptions, FindOptions, FindQuery, JsonRequest, TestFunction, RecoveredDoc, UpdateOptions, ViewKey, DocumentDeletedFailure, RevInfo, DocumentRevertResponse, DocumentViewKeysQuery, ViewValue } from 'types/types.js' | ||
@@ -54,3 +54,3 @@ export default function (jsonRequest: JsonRequest, dbName: string) { | ||
post: async <D extends NewDoc> (doc: D, params?: DocumentInsertParams) => { | ||
post: async <D extends MaybeDocument> (doc: D, params?: DocumentInsertParams) => { | ||
validatePlainObject(doc, 'doc') | ||
@@ -122,3 +122,3 @@ const url = buildUrl(`/${dbName}`, params) | ||
bulk: async <D extends Document = Document> (docs: D[]) => { | ||
bulk: async <D extends MaybeDocument = MaybeDocument> (docs: D[]) => { | ||
validateArray(docs, 'docs') | ||
@@ -125,0 +125,0 @@ const url = `/${dbName}/_bulk_docs` |
@@ -30,3 +30,3 @@ { | ||
], | ||
"version": "9.0.5", | ||
"version": "9.0.6", | ||
"main": "dist/lib/cot.js", | ||
@@ -33,0 +33,0 @@ "dependencies": { |
@@ -9,7 +9,2 @@ import type { Document, DocumentInsertResponse, DocumentViewQuery } from './nano.js' | ||
export interface NewDoc { | ||
_id?: DocId | ||
// _rev: never // Setting it to never triggers "_rev is declared here." errors | ||
} | ||
export interface RecoveredDoc { | ||
@@ -16,0 +11,0 @@ _id: DocId |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
262148
4061