Skip to content

Commit

Permalink
qs -> search
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma4345 committed Apr 2, 2024
1 parent af50c2b commit 55633dd
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 155 deletions.
66 changes: 33 additions & 33 deletions src/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1003,38 +1003,38 @@ export class Analyzer {
Options extends CreateIdentityAnalyzerOptions
? IdentityAnalyzerDescription
: Options extends CreateDelimiterAnalyzerOptions
? DelimiterAnalyzerDescription
: Options extends CreateStemAnalyzerOptions
? StemAnalyzerDescription
: Options extends CreateNormAnalyzerOptions
? NormAnalyzerDescription
: Options extends CreateNgramAnalyzerOptions
? NgramAnalyzerDescription
: Options extends CreateTextAnalyzerOptions
? TextAnalyzerDescription
: Options extends CreateSegmentationAnalyzerOptions
? SegmentationAnalyzerDescription
: Options extends CreateAqlAnalyzerOptions
? AqlAnalyzerDescription
: Options extends CreatePipelineAnalyzerOptions
? PipelineAnalyzerDescription
: Options extends CreateStopwordsAnalyzerOptions
? StopwordsAnalyzerDescription
: Options extends CreateCollationAnalyzerOptions
? CollationAnalyzerDescription
: Options extends CreateMinHashAnalyzerOptions
? MinHashAnalyzerDescription
: Options extends CreateClassificationAnalyzerOptions
? ClassificationAnalyzerDescription
: Options extends CreateNearestNeighborsAnalyzerOptions
? NearestNeighborsAnalyzerDescription
: Options extends CreateGeoJsonAnalyzerOptions
? GeoJsonAnalyzerDescription
: Options extends CreateGeoPointAnalyzerOptions
? GeoPointAnalyzerDescription
: Options extends CreateGeoS2AnalyzerOptions
? GeoS2AnalyzerDescription
: AnalyzerDescription
? DelimiterAnalyzerDescription
: Options extends CreateStemAnalyzerOptions
? StemAnalyzerDescription
: Options extends CreateNormAnalyzerOptions
? NormAnalyzerDescription
: Options extends CreateNgramAnalyzerOptions
? NgramAnalyzerDescription
: Options extends CreateTextAnalyzerOptions
? TextAnalyzerDescription
: Options extends CreateSegmentationAnalyzerOptions
? SegmentationAnalyzerDescription
: Options extends CreateAqlAnalyzerOptions
? AqlAnalyzerDescription
: Options extends CreatePipelineAnalyzerOptions
? PipelineAnalyzerDescription
: Options extends CreateStopwordsAnalyzerOptions
? StopwordsAnalyzerDescription
: Options extends CreateCollationAnalyzerOptions
? CollationAnalyzerDescription
: Options extends CreateMinHashAnalyzerOptions
? MinHashAnalyzerDescription
: Options extends CreateClassificationAnalyzerOptions
? ClassificationAnalyzerDescription
: Options extends CreateNearestNeighborsAnalyzerOptions
? NearestNeighborsAnalyzerDescription
: Options extends CreateGeoJsonAnalyzerOptions
? GeoJsonAnalyzerDescription
: Options extends CreateGeoPointAnalyzerOptions
? GeoPointAnalyzerDescription
: Options extends CreateGeoS2AnalyzerOptions
? GeoS2AnalyzerDescription
: AnalyzerDescription
> {
return this._db.request({
method: "POST",
Expand All @@ -1061,7 +1061,7 @@ export class Analyzer {
return this._db.request({
method: "DELETE",
path: `/_api/analyzer/${encodeURIComponent(this._name)}`,
qs: { force },
search: { force },
});
}
}
44 changes: 22 additions & 22 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3603,17 +3603,17 @@ export class Collection<T extends Record<string, any> = any>
return computedValue;
});
}
const qs: Record<string, any> = {};
const search: Record<string, any> = {};
if (typeof waitForSyncReplication === "boolean") {
qs.waitForSyncReplication = waitForSyncReplication ? 1 : 0;
search.waitForSyncReplication = waitForSyncReplication ? 1 : 0;
}
if (typeof enforceReplicationFactor === "boolean") {
qs.enforceReplicationFactor = enforceReplicationFactor ? 1 : 0;
search.enforceReplicationFactor = enforceReplicationFactor ? 1 : 0;
}
return this._db.request({
method: "POST",
path: "/_api/collection",
qs,
search,
body: {
...opts,
name: this._name,
Expand Down Expand Up @@ -3668,7 +3668,7 @@ export class Collection<T extends Record<string, any> = any>
> {
return this._db.request({
path: `/_api/collection/${encodeURIComponent(this._name)}/figures`,
qs: { details },
search: { details },
});
}

Expand All @@ -3691,7 +3691,7 @@ export class Collection<T extends Record<string, any> = any>
> {
return this._db.request({
path: `/_api/collection/${encodeURIComponent(this._name)}/checksum`,
qs: options,
search: options,
});
}

Expand Down Expand Up @@ -3724,7 +3724,7 @@ export class Collection<T extends Record<string, any> = any>
return this._db.request({
method: "DELETE",
path: `/_api/collection/${encodeURIComponent(this._name)}`,
qs: options,
search: options,
});
}
//#endregion
Expand Down Expand Up @@ -3787,7 +3787,7 @@ export class Collection<T extends Record<string, any> = any>
return this._db.request({
method: "PUT",
path: `/_api/document/${encodeURIComponent(this._name)}`,
qs: { onlyget: true },
search: { onlyget: true },
allowDirtyRead,
body: selectors,
});
Expand Down Expand Up @@ -3841,7 +3841,7 @@ export class Collection<T extends Record<string, any> = any>
method: "POST",
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: data,
qs: options,
search: options,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3853,7 +3853,7 @@ export class Collection<T extends Record<string, any> = any>
method: "POST",
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: data,
qs: options,
search: options,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3875,7 +3875,7 @@ export class Collection<T extends Record<string, any> = any>
)}`,
headers,
body: newData,
qs: opts,
search: opts,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3890,7 +3890,7 @@ export class Collection<T extends Record<string, any> = any>
method: "PUT",
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: newData,
qs: options,
search: options,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3912,7 +3912,7 @@ export class Collection<T extends Record<string, any> = any>
)}`,
headers,
body: newData,
qs: opts,
search: opts,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3929,7 +3929,7 @@ export class Collection<T extends Record<string, any> = any>
method: "PATCH",
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: newData,
qs: options,
search: options,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3946,7 +3946,7 @@ export class Collection<T extends Record<string, any> = any>
_documentHandle(selector, this._name)
)}`,
headers,
qs: opts,
search: opts,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3961,7 +3961,7 @@ export class Collection<T extends Record<string, any> = any>
method: "DELETE",
path: `/_api/document/${encodeURIComponent(this._name)}`,
body: selectors,
qs: options,
search: options,
},
(res) => (options?.silent ? undefined : res.parsedBody)
);
Expand All @@ -3973,9 +3973,9 @@ export class Collection<T extends Record<string, any> = any>
type?: "documents" | "list" | "auto";
} = {}
): Promise<CollectionImportResult> {
const qs = { ...options, collection: this._name };
const search = { ...options, collection: this._name };
if (Array.isArray(data)) {
qs.type = Array.isArray(data[0]) ? undefined : "documents";
search.type = Array.isArray(data[0]) ? undefined : "documents";
const lines = data as any[];
data = lines.map((line) => JSON.stringify(line)).join("\r\n") + "\r\n";
}
Expand All @@ -3984,7 +3984,7 @@ export class Collection<T extends Record<string, any> = any>
path: "/_api/import",
body: data,
isBinary: true,
qs,
search,
});
}
//#endregion
Expand All @@ -3999,7 +3999,7 @@ export class Collection<T extends Record<string, any> = any>
return this._db.request({
path: `/_api/edges/${encodeURIComponent(this._name)}`,
allowDirtyRead,
qs: {
search: {
direction,
vertex: _documentHandle(selector, this._name, false),
},
Expand Down Expand Up @@ -4190,7 +4190,7 @@ export class Collection<T extends Record<string, any> = any>
return this._db.request(
{
path: "/_api/index",
qs: { collection: this._name },
search: { collection: this._name },
},
(res) => res.parsedBody.indexes
);
Expand All @@ -4215,7 +4215,7 @@ export class Collection<T extends Record<string, any> = any>
method: "POST",
path: "/_api/index",
body: options,
qs: { collection: this._name },
search: { collection: this._name },
});
}

Expand Down
14 changes: 4 additions & 10 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ function generateStackTrace() {
return err;
}

/**
* Additional options for intercepting the request/response. These methods
* are primarily intended for tracking network related metrics.
*/
export type RequestInterceptors = {};

/**
* Options for performing a request with arangojs.
*/
Expand Down Expand Up @@ -183,7 +177,7 @@ export type RequestOptions = {
/**
* URL parameters to pass as part of the query string.
*/
qs?: URLSearchParams | Record<string, any>;
search?: URLSearchParams | Record<string, any>;
};

/**
Expand All @@ -203,7 +197,7 @@ type Task = {
expectBinary: boolean;
timeout?: number;
pathname: string;
qs?: URLSearchParams;
search?: URLSearchParams;
headers: Headers;
body: any;
};
Expand Down Expand Up @@ -880,7 +874,7 @@ export class Connection {
headers: requestHeaders,
basePath,
path,
qs: params,
search: params,
}: RequestOptions,
transform?: (res: ArangojsResponse) => T
): Promise<T> {
Expand Down Expand Up @@ -914,7 +908,7 @@ export class Connection {
retryOnConflict,
options: {
pathname: joinPath(basePath || "", path || ""),
qs:
search:
params &&
(params instanceof URLSearchParams
? params
Expand Down
Loading

0 comments on commit 55633dd

Please sign in to comment.