File tree Expand file tree Collapse file tree 12 files changed +54
-72
lines changed Expand file tree Collapse file tree 12 files changed +54
-72
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,16 @@ This driver uses semantic versioning:
4747 This brings these methods behavior in line with that of the ` beginTransaction `
4848 and ` executeTransaction ` methods of ` Database ` objects.
4949
50+ - Moved ` collectionToString ` helper into ` collection ` module
51+
52+ - Moved ` Dict ` type into ` connection ` module
53+
54+ - Moved ` Patch ` type into ` documents ` module
55+
56+ - Moved ` Errback ` type into library internals
57+
58+ - Renamed ` util/foxx-manifest ` module to ` foxx-manifest `
59+
5060### Added
5161
5262- Added ` precaptureStackTraces ` configuration option ([ #599 ] ( https://github.com/arangodb/arangojs/issues/599 ) )
Original file line number Diff line number Diff line change 1111 * @packageDocumentation
1212 */
1313import { ArangoCollection , isArangoCollection } from "./collection" ;
14- import { Dict } from "./util/types " ;
14+ import { Dict } from "./connection " ;
1515import { isArangoView , View } from "./view" ;
1616
1717/**
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 DocumentSelector ,
2222 Edge ,
2323 EdgeData ,
24+ Patch ,
2425 _documentHandle ,
2526} from "./documents" ;
2627import { isArangoError } from "./error" ;
@@ -43,7 +44,6 @@ import {
4344} from "./indexes" ;
4445import { Blob } from "./lib/blob" ;
4546import { COLLECTION_NOT_FOUND , DOCUMENT_NOT_FOUND } from "./lib/codes" ;
46- import { Patch } from "./util/types" ;
4747
4848/**
4949 * Indicates whether the given value represents an {@link ArangoCollection}.
@@ -56,6 +56,20 @@ export function isArangoCollection(
5656 return Boolean ( collection && collection . isArangoCollection ) ;
5757}
5858
59+ /**
60+ * Coerces the given collection name or {@link ArangoCollection} object to
61+ * a string representing the collection name.
62+ *
63+ * @param collection - Collection name or {@link ArangoCollection} object.
64+ */
65+ export function collectionToString (
66+ collection : string | ArangoCollection
67+ ) : string {
68+ if ( isArangoCollection ( collection ) ) {
69+ return String ( collection . name ) ;
70+ } else return String ( collection ) ;
71+ }
72+
5973/**
6074 * A marker interface identifying objects that can be used in AQL template
6175 * strings to create references to ArangoDB collections.
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ import {
3333const MIME_JSON = / \/ ( j s o n | j a v a s c r i p t ) ( \W | $ ) / ;
3434const LEADER_ENDPOINT_HEADER = "x-arango-endpoint" ;
3535
36+ /**
37+ * Generic type representing an object with values of a given value type.
38+ *
39+ * @param T - Type of the object's property values.
40+ */
41+ export type Dict < T > = { [ key : string ] : T } ;
42+
3643/**
3744 * Determines the behavior when multiple URLs are used:
3845 *
@@ -53,17 +60,13 @@ export type LoadBalancingStrategy = "NONE" | "ROUND_ROBIN" | "ONE_RANDOM";
5360 *
5461 * Header names should always be lowercase.
5562 */
56- export type Headers = {
57- [ key : string ] : string ;
58- } ;
63+ export type Headers = Dict < string > ;
5964
6065/**
6166 * An arbitrary object with scalar values representing query string parameters
6267 * and their values.
6368 */
64- export type Params = {
65- [ key : string ] : any ;
66- } ;
69+ export type Params = Dict < any > ;
6770
6871/**
6972 * Generic properties shared by all ArangoDB HTTP API responses.
Original file line number Diff line number Diff line change 88 * @packageDocumentation
99 */
1010import { LinkedList } from "x3-linkedlist" ;
11+ import { Dict } from "./connection" ;
1112import { Database } from "./database" ;
12- import { Dict } from "./util/types" ;
1313
1414/**
1515 * Additional information about the cursor.
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 ArangoCollection ,
2222 Collection ,
2323 CollectionMetadata ,
24+ collectionToString ,
2425 CollectionType ,
2526 CreateCollectionOptions ,
2627 DocumentCollection ,
@@ -31,11 +32,13 @@ import {
3132 ArangoResponseMetadata ,
3233 Config ,
3334 Connection ,
35+ Dict ,
3436 Headers ,
3537 RequestOptions ,
3638} from "./connection" ;
3739import { ArrayCursor , BatchedArrayCursor } from "./cursor" ;
3840import { isArangoError } from "./error" ;
41+ import { FoxxManifest } from "./foxx-manifest" ;
3942import {
4043 EdgeDefinitionOptions ,
4144 Graph ,
@@ -48,9 +51,6 @@ import { toForm } from "./lib/multipart";
4851import { ArangojsResponse } from "./lib/request" ;
4952import { Route } from "./route" ;
5053import { Transaction } from "./transaction" ;
51- import { collectionToString } from "./util/collectionToString" ;
52- import { FoxxManifest } from "./util/foxx-manifest" ;
53- import { Dict } from "./util/types" ;
5454import {
5555 ArangoSearchView ,
5656 ArangoSearchViewPropertiesOptions ,
Original file line number Diff line number Diff line change @@ -68,6 +68,15 @@ export type Document<T extends object = any> = T &
6868 */
6969export type Edge < T extends object = any > = T & DocumentMetadata & EdgeMetadata ;
7070
71+ /**
72+ * Type representing patch data for a given object type to represent a payload
73+ * ArangoDB can apply in a document PATCH request (i.e. a partial update).
74+ *
75+ * This differs from `Partial` in that it also applies itself to any nested
76+ * objects recursively.
77+ */
78+ export type Patch < T = object > = { [ K in keyof T ] ?: T [ K ] | Patch < T [ K ] > } ;
79+
7180/**
7281 * An object with an ArangoDB document `_id` property.
7382 *
Original file line number Diff line number Diff line change 11/**
22 * ```ts
3- * import type { FoxxManifest } from "arangojs/util/ foxx-manifest";
3+ * import type { FoxxManifest } from "arangojs/foxx-manifest";
44 * ```
55 *
6- * The "util/foxx-manifest" module provides the Foxx manifest type for
7- * TypeScript.
6+ * The "foxx-manifest" module provides the Foxx manifest type for TypeScript.
87 *
98 * Generated from {@link http://json.schemastore.org/foxx-manifest | JSON Schema}
109 * using `json-schema-to-typescript`.
1110 *
1211 * @packageDocumentation
1312 */
1413
15- import { Dict } from "./types " ;
14+ import { Dict } from "./connection " ;
1615
1716/**
1817 * Schema for ArangoDB Foxx service manifests.
Original file line number Diff line number Diff line change 1414 */
1515import {
1616 ArangoCollection ,
17+ collectionToString ,
1718 DocumentCollection ,
1819 EdgeCollection ,
1920 isArangoCollection ,
@@ -28,12 +29,11 @@ import {
2829 DocumentSelector ,
2930 Edge ,
3031 EdgeData ,
32+ Patch ,
3133 _documentHandle ,
3234} from "./documents" ;
3335import { isArangoError } from "./error" ;
3436import { DOCUMENT_NOT_FOUND , GRAPH_NOT_FOUND } from "./lib/codes" ;
35- import { collectionToString } from "./util/collectionToString" ;
36- import { Patch } from "./util/types" ;
3737
3838/**
3939 * @internal
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments