@instantdb/admin
Advanced tools
Comparing version 0.11.1 to 0.11.2
import { tx, lookup, TransactionChunk } from "@instantdb/core"; | ||
import { User, AuthToken } from "@instantdb/core"; | ||
declare type NonEmpty<T> = { | ||
type NonEmpty<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>>; | ||
}[keyof T]; | ||
declare type WhereArgs = { | ||
type WhereArgs = { | ||
in?: (string | number | boolean)[]; | ||
}; | ||
declare type WhereClauseValue = string | number | boolean | NonEmpty<WhereArgs>; | ||
declare type BaseWhereClause = { | ||
type WhereClauseValue = string | number | boolean | NonEmpty<WhereArgs>; | ||
type BaseWhereClause = { | ||
[key: string]: WhereClauseValue; | ||
}; | ||
declare type WhereClauseWithCombinaton = { | ||
type WhereClauseWithCombinaton = { | ||
or?: WhereClause[] | WhereClauseValue; | ||
and?: WhereClause[] | WhereClauseValue; | ||
}; | ||
declare type WhereClause = WhereClauseWithCombinaton | (WhereClauseWithCombinaton & BaseWhereClause); | ||
type WhereClause = WhereClauseWithCombinaton | (WhereClauseWithCombinaton & BaseWhereClause); | ||
/** | ||
@@ -25,8 +25,8 @@ * A tuple representing a cursor. | ||
*/ | ||
declare type Cursor = [string, string, any, number]; | ||
declare type Direction = "asc" | "desc"; | ||
declare type Order = { | ||
type Cursor = [string, string, any, number]; | ||
type Direction = "asc" | "desc"; | ||
type Order = { | ||
serverCreatedAt: Direction; | ||
}; | ||
declare type $Option = { | ||
type $Option = { | ||
$?: { | ||
@@ -43,24 +43,24 @@ where?: WhereClause; | ||
}; | ||
declare type Subquery = { | ||
type Subquery = { | ||
[namespace: string]: NamespaceVal; | ||
}; | ||
declare type NamespaceVal = $Option | ($Option & Subquery); | ||
type NamespaceVal = $Option | ($Option & Subquery); | ||
interface Query { | ||
[namespace: string]: NamespaceVal; | ||
} | ||
declare type InstantObject = { | ||
type InstantObject = { | ||
id: string; | ||
[prop: string]: any; | ||
}; | ||
declare type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
id: string; | ||
} & Schema[K] : InstantObject; | ||
declare type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
declare type ResponseOf<Q, Schema> = { | ||
type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
type ResponseOf<Q, Schema> = { | ||
[K in keyof Q]: IsEmptyObject<Q[K]> extends true ? ResponseObject<K, Schema>[] : (ResponseOf<Q[K], Schema> & ResponseObject<K, Schema>)[]; | ||
}; | ||
declare type Remove$<T> = T extends object ? { | ||
type Remove$<T> = T extends object ? { | ||
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>; | ||
} : T; | ||
declare type QueryResponse<T, Schema> = ResponseOf<{ | ||
type QueryResponse<T, Schema> = ResponseOf<{ | ||
[K in keyof T]: Remove$<T[K]>; | ||
@@ -71,3 +71,3 @@ }, Schema>; | ||
*/ | ||
export declare type DebugCheckResult = { | ||
export type DebugCheckResult = { | ||
/** The ID of the record. */ | ||
@@ -104,6 +104,6 @@ id: string; | ||
* */ | ||
declare type Exactly<Parent, Child extends Parent> = Parent & { | ||
type Exactly<Parent, Child extends Parent> = Parent & { | ||
[K in keyof Child]: K extends keyof Parent ? Child[K] : never; | ||
}; | ||
declare type Config = { | ||
type Config = { | ||
appId: string; | ||
@@ -113,6 +113,6 @@ adminToken: string; | ||
}; | ||
declare type FilledConfig = Config & { | ||
type FilledConfig = Config & { | ||
apiURI: string; | ||
}; | ||
declare type ImpersonationOpts = { | ||
type ImpersonationOpts = { | ||
email: string; | ||
@@ -185,3 +185,3 @@ } | { | ||
*/ | ||
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<ResponseOf<{ [K in keyof Q]: Remove$<Q[K]>; }, Schema>>; | ||
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<QueryResponse<Q, Schema>>; | ||
/** | ||
@@ -235,3 +235,3 @@ * Use this to write data! You can create, update, delete, and link objects | ||
}) => Promise<{ | ||
result: ResponseOf<{ [K in keyof Q]: Remove$<Q[K]>; }, Schema>; | ||
result: QueryResponse<Q, Schema>; | ||
checkResults: DebugCheckResult[]; | ||
@@ -238,0 +238,0 @@ }>; |
@@ -35,3 +35,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lookup = exports.tx = exports.id = exports.init = void 0; | ||
exports.lookup = exports.tx = exports.id = void 0; | ||
exports.init = init; | ||
const core_1 = require("@instantdb/core"); | ||
@@ -123,3 +124,2 @@ Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } }); | ||
} | ||
exports.init = init; | ||
/** | ||
@@ -126,0 +126,0 @@ * |
import { tx, lookup, TransactionChunk } from "@instantdb/core"; | ||
import { User, AuthToken } from "@instantdb/core"; | ||
declare type NonEmpty<T> = { | ||
type NonEmpty<T> = { | ||
[K in keyof T]-?: Required<Pick<T, K>>; | ||
}[keyof T]; | ||
declare type WhereArgs = { | ||
type WhereArgs = { | ||
in?: (string | number | boolean)[]; | ||
}; | ||
declare type WhereClauseValue = string | number | boolean | NonEmpty<WhereArgs>; | ||
declare type BaseWhereClause = { | ||
type WhereClauseValue = string | number | boolean | NonEmpty<WhereArgs>; | ||
type BaseWhereClause = { | ||
[key: string]: WhereClauseValue; | ||
}; | ||
declare type WhereClauseWithCombinaton = { | ||
type WhereClauseWithCombinaton = { | ||
or?: WhereClause[] | WhereClauseValue; | ||
and?: WhereClause[] | WhereClauseValue; | ||
}; | ||
declare type WhereClause = WhereClauseWithCombinaton | (WhereClauseWithCombinaton & BaseWhereClause); | ||
type WhereClause = WhereClauseWithCombinaton | (WhereClauseWithCombinaton & BaseWhereClause); | ||
/** | ||
@@ -25,8 +25,8 @@ * A tuple representing a cursor. | ||
*/ | ||
declare type Cursor = [string, string, any, number]; | ||
declare type Direction = "asc" | "desc"; | ||
declare type Order = { | ||
type Cursor = [string, string, any, number]; | ||
type Direction = "asc" | "desc"; | ||
type Order = { | ||
serverCreatedAt: Direction; | ||
}; | ||
declare type $Option = { | ||
type $Option = { | ||
$?: { | ||
@@ -43,24 +43,24 @@ where?: WhereClause; | ||
}; | ||
declare type Subquery = { | ||
type Subquery = { | ||
[namespace: string]: NamespaceVal; | ||
}; | ||
declare type NamespaceVal = $Option | ($Option & Subquery); | ||
type NamespaceVal = $Option | ($Option & Subquery); | ||
interface Query { | ||
[namespace: string]: NamespaceVal; | ||
} | ||
declare type InstantObject = { | ||
type InstantObject = { | ||
id: string; | ||
[prop: string]: any; | ||
}; | ||
declare type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
type ResponseObject<K, Schema> = K extends keyof Schema ? { | ||
id: string; | ||
} & Schema[K] : InstantObject; | ||
declare type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
declare type ResponseOf<Q, Schema> = { | ||
type IsEmptyObject<T> = T extends Record<string, never> ? true : false; | ||
type ResponseOf<Q, Schema> = { | ||
[K in keyof Q]: IsEmptyObject<Q[K]> extends true ? ResponseObject<K, Schema>[] : (ResponseOf<Q[K], Schema> & ResponseObject<K, Schema>)[]; | ||
}; | ||
declare type Remove$<T> = T extends object ? { | ||
type Remove$<T> = T extends object ? { | ||
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>; | ||
} : T; | ||
declare type QueryResponse<T, Schema> = ResponseOf<{ | ||
type QueryResponse<T, Schema> = ResponseOf<{ | ||
[K in keyof T]: Remove$<T[K]>; | ||
@@ -71,3 +71,3 @@ }, Schema>; | ||
*/ | ||
export declare type DebugCheckResult = { | ||
export type DebugCheckResult = { | ||
/** The ID of the record. */ | ||
@@ -104,6 +104,6 @@ id: string; | ||
* */ | ||
declare type Exactly<Parent, Child extends Parent> = Parent & { | ||
type Exactly<Parent, Child extends Parent> = Parent & { | ||
[K in keyof Child]: K extends keyof Parent ? Child[K] : never; | ||
}; | ||
declare type Config = { | ||
type Config = { | ||
appId: string; | ||
@@ -113,6 +113,6 @@ adminToken: string; | ||
}; | ||
declare type FilledConfig = Config & { | ||
type FilledConfig = Config & { | ||
apiURI: string; | ||
}; | ||
declare type ImpersonationOpts = { | ||
type ImpersonationOpts = { | ||
email: string; | ||
@@ -185,3 +185,3 @@ } | { | ||
*/ | ||
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<ResponseOf<{ [K in keyof Q]: Remove$<Q[K]>; }, Schema>>; | ||
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<QueryResponse<Q, Schema>>; | ||
/** | ||
@@ -235,3 +235,3 @@ * Use this to write data! You can create, update, delete, and link objects | ||
}) => Promise<{ | ||
result: ResponseOf<{ [K in keyof Q]: Remove$<Q[K]>; }, Schema>; | ||
result: QueryResponse<Q, Schema>; | ||
checkResults: DebugCheckResult[]; | ||
@@ -238,0 +238,0 @@ }>; |
{ | ||
"name": "@instantdb/admin", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Admin SDK for Instant DB", | ||
@@ -27,5 +27,5 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@instantdb/core": "0.11.1", | ||
"@instantdb/core": "0.11.2", | ||
"uuid": "^9.0.1" | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
92333
2
+ Added@instantdb/core@0.11.2(transitive)
- Removed@instantdb/core@0.11.1(transitive)
Updated@instantdb/core@0.11.2