Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfoxtyler committed Jan 17, 2025
1 parent 4e224d8 commit 1a5016d
Show file tree
Hide file tree
Showing 13 changed files with 396 additions and 76 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export declare class DgraphClient {
debug(msg: string): void
anyClient(): DgraphClientStub
}
export declare function isJwtExpired(err: unknown): boolean
export declare function isJwtExpired(err: any): boolean
export declare function deleteEdges(mu: types.Mutation, uid: string, ...predicates: string[]): void
4 changes: 2 additions & 2 deletions lib/txn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export declare class Txn {
queryWithVars(
q: string,

Check failure on line 19 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 19 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 19 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 19 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 19 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
vars?: {
[k: string]: unknown
[k: string]: any
},
metadata?: grpc.Metadata,

Check failure on line 23 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 23 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 23 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 23 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 23 in lib/txn.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
options?: grpc.CallOptions,
Expand All @@ -27,7 +27,7 @@ export declare class Txn {
queryRDFWithVars(
q: string,
vars?: {
[k: string]: unknown
[k: string]: any
},
metadata?: grpc.Metadata,
options?: grpc.CallOptions,
Expand Down
40 changes: 20 additions & 20 deletions lib/txn.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ var Txn = (function () {
}
Txn.prototype.doRequest = function (req, metadata, options) {
return __awaiter(this, void 0, void 0, function () {
var mutationList, resp, c, operation, _a, _b, e_1, _c, _d, e_2
var mutationList, resp, c, operation, _a, _b, e_1, _c, _d, _e
var _this = this
return __generator(this, function (_e) {
switch (_e.label) {
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
mutationList = req.getMutationsList()
if (this.finished) {
Expand Down Expand Up @@ -289,33 +289,33 @@ var Txn = (function () {
})
})
}
_e.label = 1
_f.label = 1
case 1:
_e.trys.push([1, 3, , 11])
_f.trys.push([1, 3, , 11])
_b = (_a = types).createResponse
return [4, operation()]
case 2:
resp = _b.apply(_a, [_e.sent()])
resp = _b.apply(_a, [_f.sent()])
return [3, 11]
case 3:
e_1 = _e.sent()
e_1 = _f.sent()
if (!((0, client_1.isJwtExpired)(e_1) === true)) return [3, 6]
return [4, c.retryLogin(metadata, options)]
case 4:
_e.sent()
_f.sent()
_d = (_c = types).createResponse
return [4, operation()]
case 5:
resp = _d.apply(_c, [_e.sent()])
resp = _d.apply(_c, [_f.sent()])
return [3, 10]
case 6:
_e.trys.push([6, 8, , 9])
_f.trys.push([6, 8, , 9])
return [4, this.discard(metadata, options)]
case 7:
_e.sent()
_f.sent()
return [3, 9]
case 8:
e_2 = _e.sent()
_e = _f.sent()
return [3, 9]
case 9:
throw (0, util_1.isAbortedError)(e_1) || (0, util_1.isConflictError)(e_1)
Expand All @@ -336,7 +336,7 @@ var Txn = (function () {
}
Txn.prototype.commit = function (metadata, options) {
return __awaiter(this, void 0, void 0, function () {
var c, operation, e_3
var c, operation, e_2
var _this = this
return __generator(this, function (_a) {
switch (_a.label) {
Expand Down Expand Up @@ -364,8 +364,8 @@ var Txn = (function () {
_a.sent()
return [3, 8]
case 3:
e_3 = _a.sent()
if (!((0, client_1.isJwtExpired)(e_3) === true)) return [3, 6]
e_2 = _a.sent()
if (!((0, client_1.isJwtExpired)(e_2) === true)) return [3, 6]
return [4, c.retryLogin(metadata, options)]
case 4:
_a.sent()
Expand All @@ -374,7 +374,7 @@ var Txn = (function () {
_a.sent()
return [3, 7]
case 6:
throw (0, util_1.isAbortedError)(e_3) ? errors_1.ERR_ABORTED : e_3
throw (0, util_1.isAbortedError)(e_2) ? errors_1.ERR_ABORTED : e_2
case 7:
return [3, 8]
case 8:
Expand All @@ -385,7 +385,7 @@ var Txn = (function () {
}
Txn.prototype.discard = function (metadata, options) {
return __awaiter(this, void 0, void 0, function () {
var c, operation, e_4
var c, operation, e_3
var _this = this
return __generator(this, function (_a) {
switch (_a.label) {
Expand Down Expand Up @@ -414,8 +414,8 @@ var Txn = (function () {
_a.sent()
return [3, 8]
case 3:
e_4 = _a.sent()
if (!((0, client_1.isJwtExpired)(e_4) === true)) return [3, 6]
e_3 = _a.sent()
if (!((0, client_1.isJwtExpired)(e_3) === true)) return [3, 6]
return [4, c.retryLogin(metadata, options)]
case 4:
_a.sent()
Expand All @@ -424,7 +424,7 @@ var Txn = (function () {
_a.sent()
return [3, 7]
case 6:
throw (0, util_1.isAbortedError)(e_4) ? errors_1.ERR_ABORTED : e_4
throw (0, util_1.isAbortedError)(e_3) ? errors_1.ERR_ABORTED : e_3
case 7:
return [3, 8]
case 8:
Expand Down
16 changes: 8 additions & 8 deletions lib/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as messages from "../generated/api_pb"
export declare class Payload extends messages.Payload {
getData(): unknown
getData(): string | Uint8Array

Check failure on line 3 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 3 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 3 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 3 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 3 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
getData_asB64(): string
getData_asU8(): Uint8Array
setData(value: unknown): void
setData(value: any): void

Check failure on line 6 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 6 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 6 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 6 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 6 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
}
export declare function createPayload(oldPayload: messages.Payload): Payload
export declare class Response extends messages.Response {
getJson(): unknown
getJson(): string | Uint8Array

Check failure on line 10 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 10 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 10 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 10 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 10 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
getJson_asB64(): string
getJson_asU8(): Uint8Array
setJson(value: unknown): void
setJson(value: any): void

Check failure on line 13 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 13 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 13 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 13 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 13 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
}
export declare function createResponse(oldResponse: messages.Response): Response
export declare class Mutation extends messages.Mutation {
getSetJson(): unknown
getSetJson(): string | Uint8Array

Check failure on line 17 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 17 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 17 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 17 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 17 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
getSetJson_asB64(): string
getSetJson_asU8(): Uint8Array
setSetJson(value: unknown): void
getDeleteJson(): unknown
setSetJson(value: any): void

Check failure on line 20 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 20 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 20 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 20 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 20 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
getDeleteJson(): string | Uint8Array

Check failure on line 21 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (19.x)

Unexpected any. Specify a different type

Check failure on line 21 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (20.x)

Unexpected any. Specify a different type

Check failure on line 21 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (21.x)

Unexpected any. Specify a different type

Check failure on line 21 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (18.x)

Unexpected any. Specify a different type

Check failure on line 21 in lib/types.d.ts

View workflow job for this annotation

GitHub Actions / dgraph-js-tests (22.x)

Unexpected any. Specify a different type
getDeleteJson_asB64(): string
getDeleteJson_asU8(): Uint8Array
setDeleteJson(value: unknown): void
setDeleteJson(value: any): void
getSetNquads(): Uint8Array | string
getSetNquads_asB64(): string
getSetNquads_asU8(): Uint8Array
Expand Down
14 changes: 7 additions & 7 deletions lib/util.d.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import * as jspb from "google-protobuf"
export declare function errorCode(err: unknown): {
export declare function errorCode(err: any): {
valid: boolean
code: number
}
export declare function isAbortedError(err: unknown): boolean
export declare function isConflictError(err: unknown): boolean
export declare function isUnauthenticatedError(err: unknown): boolean
export declare function isAbortedError(err: any): boolean
export declare function isConflictError(err: any): boolean
export declare function isUnauthenticatedError(err: any): boolean
export declare function promisify1<A, T>(
f: (arg: A, cb: (err?: Error, res?: T) => void) => void,
thisContext?: unknown,
thisContext?: any,
): (arg: A) => Promise<T>
export declare function promisify3<A, B, C, T>(
f: (argA: A, argB: B, argC: C, cb: (err?: Error, res?: T) => void) => void,
thisContext?: unknown,
thisContext?: any,
): (argA: A, argB: B, argC: C) => Promise<T>
export declare function stringifyMessage(msg: jspb.Message): string
export { isBase64 } from "is-base64"
export declare function strToB64(str: string): string
export declare function strToU8(str: string): Uint8Array
export declare function b64ToStr(b64Str: string): string
export declare function u8ToStr(arr: Uint8Array): string
export declare function strToJson(jsonStr: string): unknown
export declare function strToJson(jsonStr: string): any
4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function errorCode(err) {
if (
err === undefined ||
typeof err !== "object" ||
!err.hasOwnProperty("code") ||
!Object.prototype.hasOwnProperty.call(err, "code") ||
typeof err.code !== "number"
) {
return {
Expand Down Expand Up @@ -92,7 +92,7 @@ function u8ToStr(arr) {
function strToJson(jsonStr) {
try {
return JSON.parse(jsonStr)
} catch (e) {
} catch (_a) {
return {}
}
}
Loading

0 comments on commit 1a5016d

Please sign in to comment.