Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@instantdb/admin

Package Overview
Dependencies
Maintainers
0
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instantdb/admin - npm Package Compare versions

Comparing version 0.12.19-experimental.0 to 0.12.19

50

dist/index.d.ts

@@ -1,2 +0,3 @@

import { tx, lookup, TransactionChunk, i, User, AuthToken, id } from "@instantdb/core";
import { tx, lookup, TransactionChunk } from "@instantdb/core";
import { User, AuthToken, id } from "@instantdb/core";
type NonEmpty<T> = {

@@ -48,5 +49,2 @@ [K in keyof T]-?: Required<Pick<T, K>>;

}
type Remove$<T> = T extends object ? {
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>;
} : T;
type InstantObject = {

@@ -63,27 +61,8 @@ id: string;

};
type InstaQLQueryEntityAttrsResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities> = {
[AttrName in keyof Entities[EntityName]["attrs"]]: Entities[EntityName]["attrs"][AttrName] extends i.DataAttrDef<infer ValueType, infer IsRequired> ? IsRequired extends true ? ValueType : ValueType | undefined : never;
};
type InstaQLQueryEntityLinksResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities, Query extends {
[LinkAttrName in keyof Entities[EntityName]["links"]]?: any;
}, WithCardinalityInference> = {
[QueryPropName in keyof Query]: Entities[EntityName]["links"][QueryPropName] extends i.LinkAttrDef<infer Cardinality, infer LinkedEntityName> ? LinkedEntityName extends keyof Entities ? WithCardinalityInference extends true ? Cardinality extends "one" ? InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]> | undefined : InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]>[] : InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]>[] : never : never;
};
type InstaQLQueryEntityResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities, Query extends {
[QueryPropName in keyof Entities[EntityName]["links"]]?: any;
}, WithCardinalityInference = false> = {
id: string;
} & InstaQLQueryEntityAttrsResult<Entities, EntityName> & InstaQLQueryEntityLinksResult<Entities, EntityName, Query, WithCardinalityInference>;
type InstaQLQueryResult<Entities extends i.EntitiesDef, Query, WithCardinalityInference = false> = {
[QueryPropName in keyof Query]: QueryPropName extends keyof Entities ? InstaQLQueryEntityResult<Entities, QueryPropName, Query[QueryPropName], WithCardinalityInference>[] : never;
};
type QueryResponse<T, Schema, WithCardinalityInference = false> = Schema extends i.InstantGraph<infer E, any> ? InstaQLQueryResult<E, T, WithCardinalityInference> : ResponseOf<{
type Remove$<T> = T extends object ? {
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>;
} : T;
type QueryResponse<T, Schema> = ResponseOf<{
[K in keyof T]: Remove$<T[K]>;
}, Schema>;
type InstaQLQuerySubqueryParams<S extends i.InstantGraph<any, any>, E extends keyof S["entities"]> = {
[K in keyof S["entities"][E]["links"]]?: $Option | ($Option & InstaQLQuerySubqueryParams<S, S["entities"][E]["links"][K]["entityName"]>);
};
type InstaQLQueryParams<S extends i.InstantGraph<any, any>> = {
[K in keyof S["entities"]]?: $Option | ($Option & InstaQLQuerySubqueryParams<S, K>);
};
/**

@@ -134,4 +113,2 @@ * `debugQuery` returns the results of evaluating the corresponding permissions rules for each record.

apiURI: string;
} & {
schema?: i.InstantGraph<any, any>;
};

@@ -166,6 +143,2 @@ type ImpersonationOpts = {

declare function init<Schema = {}>(config: Config): InstantAdmin<Schema>;
declare function init_experimental<Schema extends i.InstantGraph<any, any, any>, WithCardinalityInference extends boolean = true>(config: Config): InstantAdmin<Schema & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
}>;
/**

@@ -180,3 +153,3 @@ *

*/
declare class InstantAdmin<Schema extends i.InstantGraph<any, any> | {} = {}> {
declare class InstantAdmin<Schema = {}> {
config: FilledConfig;

@@ -186,3 +159,2 @@ auth: Auth;

impersonationOpts?: ImpersonationOpts;
tx: import("@instantdb/core").TxChunk<Schema extends i.InstantGraph<any, any, {}> ? Schema : i.InstantGraph<any, any, {}>>;
constructor(_config: Config);

@@ -214,3 +186,3 @@ /**

*/
query: <Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>>(query: Q) => Promise<QueryResponse<Q, Schema>>;
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<QueryResponse<Q, Schema>>;
/**

@@ -239,3 +211,3 @@ * Use this to write data! You can create, update, delete, and link objects

*/
transact: (inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]) => Promise<any>;
transact: (inputChunks: TransactionChunk | TransactionChunk[]) => Promise<any>;
/**

@@ -286,3 +258,3 @@ * Like `query`, but returns debugging information

*/
debugTransact: (inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[], opts?: {
debugTransact: (inputChunks: TransactionChunk | TransactionChunk[], opts?: {
rules?: any;

@@ -445,3 +417,3 @@ }) => Promise<any>;

}
export { init, init_experimental, id, tx, lookup, i, Config, ImpersonationOpts, TransactionChunk, };
export { init, id, tx, lookup, Config, ImpersonationOpts, TransactionChunk, };
//# sourceMappingURL=index.d.ts.map

@@ -12,10 +12,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.i = exports.lookup = exports.tx = exports.id = void 0;
exports.lookup = exports.tx = exports.id = void 0;
exports.init = init;
exports.init_experimental = init_experimental;
const core_1 = require("@instantdb/core");
Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } });
Object.defineProperty(exports, "lookup", { enumerable: true, get: function () { return core_1.lookup; } });
Object.defineProperty(exports, "i", { enumerable: true, get: function () { return core_1.i; } });
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });
const core_2 = require("@instantdb/core");
Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_2.id; } });
function configWithDefaults(config) {

@@ -101,5 +100,2 @@ const defaultConfig = {

}
function init_experimental(config) {
return new InstantAdmin(config);
}
/**

@@ -116,3 +112,2 @@ *

constructor(_config) {
this.tx = (0, core_1.txInit)();
/**

@@ -151,6 +146,3 @@ * Sometimes you want to scope queries to a specific user.

headers: authorizedHeaders(this.config, this.impersonationOpts),
body: JSON.stringify({
query: query,
"inference?": Boolean(this.config.schema),
}),
body: JSON.stringify({ query: query }),
});

@@ -157,0 +149,0 @@ };

@@ -1,2 +0,3 @@

import { tx, lookup, TransactionChunk, i, User, AuthToken, id } from "@instantdb/core";
import { tx, lookup, TransactionChunk } from "@instantdb/core";
import { User, AuthToken, id } from "@instantdb/core";
type NonEmpty<T> = {

@@ -48,5 +49,2 @@ [K in keyof T]-?: Required<Pick<T, K>>;

}
type Remove$<T> = T extends object ? {
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>;
} : T;
type InstantObject = {

@@ -63,27 +61,8 @@ id: string;

};
type InstaQLQueryEntityAttrsResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities> = {
[AttrName in keyof Entities[EntityName]["attrs"]]: Entities[EntityName]["attrs"][AttrName] extends i.DataAttrDef<infer ValueType, infer IsRequired> ? IsRequired extends true ? ValueType : ValueType | undefined : never;
};
type InstaQLQueryEntityLinksResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities, Query extends {
[LinkAttrName in keyof Entities[EntityName]["links"]]?: any;
}, WithCardinalityInference> = {
[QueryPropName in keyof Query]: Entities[EntityName]["links"][QueryPropName] extends i.LinkAttrDef<infer Cardinality, infer LinkedEntityName> ? LinkedEntityName extends keyof Entities ? WithCardinalityInference extends true ? Cardinality extends "one" ? InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]> | undefined : InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]>[] : InstaQLQueryEntityResult<Entities, LinkedEntityName, Query[QueryPropName]>[] : never : never;
};
type InstaQLQueryEntityResult<Entities extends i.EntitiesDef, EntityName extends keyof Entities, Query extends {
[QueryPropName in keyof Entities[EntityName]["links"]]?: any;
}, WithCardinalityInference = false> = {
id: string;
} & InstaQLQueryEntityAttrsResult<Entities, EntityName> & InstaQLQueryEntityLinksResult<Entities, EntityName, Query, WithCardinalityInference>;
type InstaQLQueryResult<Entities extends i.EntitiesDef, Query, WithCardinalityInference = false> = {
[QueryPropName in keyof Query]: QueryPropName extends keyof Entities ? InstaQLQueryEntityResult<Entities, QueryPropName, Query[QueryPropName], WithCardinalityInference>[] : never;
};
type QueryResponse<T, Schema, WithCardinalityInference = false> = Schema extends i.InstantGraph<infer E, any> ? InstaQLQueryResult<E, T, WithCardinalityInference> : ResponseOf<{
type Remove$<T> = T extends object ? {
[K in keyof T as Exclude<K, "$">]: Remove$<T[K]>;
} : T;
type QueryResponse<T, Schema> = ResponseOf<{
[K in keyof T]: Remove$<T[K]>;
}, Schema>;
type InstaQLQuerySubqueryParams<S extends i.InstantGraph<any, any>, E extends keyof S["entities"]> = {
[K in keyof S["entities"][E]["links"]]?: $Option | ($Option & InstaQLQuerySubqueryParams<S, S["entities"][E]["links"][K]["entityName"]>);
};
type InstaQLQueryParams<S extends i.InstantGraph<any, any>> = {
[K in keyof S["entities"]]?: $Option | ($Option & InstaQLQuerySubqueryParams<S, K>);
};
/**

@@ -134,4 +113,2 @@ * `debugQuery` returns the results of evaluating the corresponding permissions rules for each record.

apiURI: string;
} & {
schema?: i.InstantGraph<any, any>;
};

@@ -166,6 +143,2 @@ type ImpersonationOpts = {

declare function init<Schema = {}>(config: Config): InstantAdmin<Schema>;
declare function init_experimental<Schema extends i.InstantGraph<any, any, any>, WithCardinalityInference extends boolean = true>(config: Config): InstantAdmin<Schema & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
}>;
/**

@@ -180,3 +153,3 @@ *

*/
declare class InstantAdmin<Schema extends i.InstantGraph<any, any> | {} = {}> {
declare class InstantAdmin<Schema = {}> {
config: FilledConfig;

@@ -186,3 +159,2 @@ auth: Auth;

impersonationOpts?: ImpersonationOpts;
tx: import("@instantdb/core").TxChunk<Schema extends i.InstantGraph<any, any, {}> ? Schema : i.InstantGraph<any, any, {}>>;
constructor(_config: Config);

@@ -214,3 +186,3 @@ /**

*/
query: <Q extends Schema extends i.InstantGraph<any, any> ? InstaQLQueryParams<Schema> : Exactly<Query, Q>>(query: Q) => Promise<QueryResponse<Q, Schema>>;
query: <Q extends Query>(query: Exactly<Query, Q>) => Promise<QueryResponse<Q, Schema>>;
/**

@@ -239,3 +211,3 @@ * Use this to write data! You can create, update, delete, and link objects

*/
transact: (inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[]) => Promise<any>;
transact: (inputChunks: TransactionChunk | TransactionChunk[]) => Promise<any>;
/**

@@ -286,3 +258,3 @@ * Like `query`, but returns debugging information

*/
debugTransact: (inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[], opts?: {
debugTransact: (inputChunks: TransactionChunk | TransactionChunk[], opts?: {
rules?: any;

@@ -445,3 +417,3 @@ }) => Promise<any>;

}
export { init, init_experimental, id, tx, lookup, i, Config, ImpersonationOpts, TransactionChunk, };
export { init, id, tx, lookup, Config, ImpersonationOpts, TransactionChunk, };
//# sourceMappingURL=index.d.ts.map

@@ -10,3 +10,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { tx, lookup, getOps, i, id, txInit, } from "@instantdb/core";
import { tx, lookup, getOps } from "@instantdb/core";
import { id } from "@instantdb/core";
function configWithDefaults(config) {

@@ -92,5 +93,2 @@ const defaultConfig = {

}
function init_experimental(config) {
return new InstantAdmin(config);
}
/**

@@ -107,3 +105,2 @@ *

constructor(_config) {
this.tx = txInit();
/**

@@ -142,6 +139,3 @@ * Sometimes you want to scope queries to a specific user.

headers: authorizedHeaders(this.config, this.impersonationOpts),
body: JSON.stringify({
query: query,
"inference?": Boolean(this.config.schema),
}),
body: JSON.stringify({ query: query }),
});

@@ -464,3 +458,3 @@ };

}
export { init, init_experimental, id, tx, lookup, i, };
export { init, id, tx, lookup, };
//# sourceMappingURL=index.js.map
{
"name": "@instantdb/admin",
"version": "v0.12.19-experimental.0",
"version": "v0.12.19",
"description": "Admin SDK for Instant DB",

@@ -27,4 +27,4 @@ "main": "dist/index.js",

"dependencies": {
"@instantdb/core": "v0.12.19-experimental.0"
"@instantdb/core": "v0.12.19"
}
}

@@ -1,12 +0,3 @@

import {
tx,
lookup,
TransactionChunk,
getOps,
i,
User,
AuthToken,
id,
txInit,
} from "@instantdb/core";
import { tx, lookup, TransactionChunk, getOps } from "@instantdb/core";
import { User, AuthToken, id } from "@instantdb/core";

@@ -74,6 +65,2 @@ // Query Types

type Remove$<T> = T extends object
? { [K in keyof T as Exclude<K, "$">]: Remove$<T[K]> }
: T;
type InstantObject = {

@@ -96,109 +83,11 @@ id: string;

// ==========
// InstaQL helpers
type Remove$<T> = T extends object
? { [K in keyof T as Exclude<K, "$">]: Remove$<T[K]> }
: T;
type InstaQLQueryEntityAttrsResult<
Entities extends i.EntitiesDef,
EntityName extends keyof Entities,
> = {
[AttrName in keyof Entities[EntityName]["attrs"]]: Entities[EntityName]["attrs"][AttrName] extends i.DataAttrDef<
infer ValueType,
infer IsRequired
>
? IsRequired extends true
? ValueType
: ValueType | undefined
: never;
};
type QueryResponse<T, Schema> = ResponseOf<
{ [K in keyof T]: Remove$<T[K]> },
Schema
>;
type InstaQLQueryEntityLinksResult<
Entities extends i.EntitiesDef,
EntityName extends keyof Entities,
Query extends {
[LinkAttrName in keyof Entities[EntityName]["links"]]?: any;
},
WithCardinalityInference,
> = {
[QueryPropName in keyof Query]: Entities[EntityName]["links"][QueryPropName] extends i.LinkAttrDef<
infer Cardinality,
infer LinkedEntityName
>
? LinkedEntityName extends keyof Entities
? WithCardinalityInference extends true
? Cardinality extends "one"
?
| InstaQLQueryEntityResult<
Entities,
LinkedEntityName,
Query[QueryPropName]
>
| undefined
: InstaQLQueryEntityResult<
Entities,
LinkedEntityName,
Query[QueryPropName]
>[]
: InstaQLQueryEntityResult<
Entities,
LinkedEntityName,
Query[QueryPropName]
>[]
: never
: never;
};
type InstaQLQueryEntityResult<
Entities extends i.EntitiesDef,
EntityName extends keyof Entities,
Query extends {
[QueryPropName in keyof Entities[EntityName]["links"]]?: any;
},
WithCardinalityInference = false,
> = { id: string } & InstaQLQueryEntityAttrsResult<Entities, EntityName> &
InstaQLQueryEntityLinksResult<
Entities,
EntityName,
Query,
WithCardinalityInference
>;
type InstaQLQueryResult<
Entities extends i.EntitiesDef,
Query,
WithCardinalityInference = false,
> = {
[QueryPropName in keyof Query]: QueryPropName extends keyof Entities
? InstaQLQueryEntityResult<
Entities,
QueryPropName,
Query[QueryPropName],
WithCardinalityInference
>[]
: never;
};
type QueryResponse<T, Schema, WithCardinalityInference = false> =
Schema extends i.InstantGraph<infer E, any>
? InstaQLQueryResult<E, T, WithCardinalityInference>
: ResponseOf<{ [K in keyof T]: Remove$<T[K]> }, Schema>;
type InstaQLQuerySubqueryParams<
S extends i.InstantGraph<any, any>,
E extends keyof S["entities"],
> = {
[K in keyof S["entities"][E]["links"]]?:
| $Option
| ($Option &
InstaQLQuerySubqueryParams<
S,
S["entities"][E]["links"][K]["entityName"]
>);
};
type InstaQLQueryParams<S extends i.InstantGraph<any, any>> = {
[K in keyof S["entities"]]?:
| $Option
| ($Option & InstaQLQuerySubqueryParams<S, K>);
};
/**

@@ -250,5 +139,3 @@ * `debugQuery` returns the results of evaluating the corresponding permissions rules for each record.

type FilledConfig = Config & { apiURI: string } & {
schema?: i.InstantGraph<any, any>;
};
type FilledConfig = Config & { apiURI: string };

@@ -354,14 +241,2 @@ type ImpersonationOpts =

function init_experimental<
Schema extends i.InstantGraph<any, any, any>,
WithCardinalityInference extends boolean = true,
>(config: Config) {
return new InstantAdmin<
Schema & {
schema: Schema;
cardinalityInference?: WithCardinalityInference;
}
>(config);
}
/**

@@ -376,3 +251,3 @@ *

*/
class InstantAdmin<Schema extends i.InstantGraph<any, any> | {} = {}> {
class InstantAdmin<Schema = {}> {
config: FilledConfig;

@@ -383,9 +258,2 @@ auth: Auth;

public tx =
txInit<
Schema extends i.InstantGraph<any, any>
? Schema
: i.InstantGraph<any, any>
>();
constructor(_config: Config) {

@@ -427,8 +295,4 @@ this.config = configWithDefaults(_config);

*/
query = <
Q extends Schema extends i.InstantGraph<any, any>
? InstaQLQueryParams<Schema>
: Exactly<Query, Q>,
>(
query: Q,
query = <Q extends Query>(
query: Exactly<Query, Q>,
): Promise<QueryResponse<Q, Schema>> => {

@@ -438,6 +302,3 @@ return jsonFetch(`${this.config.apiURI}/admin/query`, {

headers: authorizedHeaders(this.config, this.impersonationOpts),
body: JSON.stringify({
query: query,
"inference?": Boolean(this.config.schema),
}),
body: JSON.stringify({ query: query }),
});

@@ -469,5 +330,3 @@ };

*/
transact = (
inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
) => {
transact = (inputChunks: TransactionChunk | TransactionChunk[]) => {
const chunks = Array.isArray(inputChunks) ? inputChunks : [inputChunks];

@@ -544,3 +403,3 @@ const steps = chunks.flatMap((tx) => getOps(tx));

debugTransact = (
inputChunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
inputChunks: TransactionChunk | TransactionChunk[],
opts?: { rules?: any },

@@ -839,7 +698,5 @@ ) => {

init,
init_experimental,
id,
tx,
lookup,
i,

@@ -846,0 +703,0 @@ // types

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc