Comparing version 0.0.29 to 0.0.30
@@ -39,6 +39,6 @@ import { ClientBase, Pool, QueryConfig } from 'pg'; | ||
export declare function queryResourceAccess(client: ClientBase, id: string): Promise<AccessLevel>; | ||
export declare function queryResource<K extends keyof Resources>(context: Context, resource_name: K, id_or_filter: string | Partial<Resources[K]>): Promise<Resources[K]>; | ||
export declare function queryResource<K extends keyof Resources>(client: ClientBase, resource_name: K, id_or_filter: string | Partial<Resources[K]>): Promise<Resources[K]>; | ||
export declare function queryResourceAll<K extends keyof Resources>(client: ClientBase, resource_name: K, filter?: Partial<Resources[K]>): Promise<Resources[K][]>; | ||
export declare function queryResourceAll<K extends keyof Resources>(context: Context, resource_name: K, filter?: Partial<Resources[K]>): Promise<Resources[K][]>; | ||
export declare function queryResource<K extends keyof Resources>(context: Context, resource_name: K, id_or_filter: string | Partial<Resources[K]>, token?: string): Promise<Resources[K]>; | ||
export declare function queryResource<K extends keyof Resources>(client: ClientBase, resource_name: K, id_or_filter: string | Partial<Resources[K]>, token?: string): Promise<Resources[K]>; | ||
export declare function queryResourceAll<K extends keyof Resources>(client: ClientBase, resource_name: K, filter?: Partial<Resources[K]>, token?: string): Promise<Resources[K][]>; | ||
export declare function queryResourceAll<K extends keyof Resources>(context: Context, resource_name: K, filter?: Partial<Resources[K]>, token?: string): Promise<Resources[K][]>; | ||
export declare function createResource<K extends keyof Resources>(context: Context, resource_name: K, data: Partial<Resources[K]>): Promise<Resources[K]>; | ||
@@ -57,4 +57,4 @@ export declare function createResource<K extends keyof Resources>(client: ClientBase, resource_name: K, data: Partial<Resources[K]>): Promise<Resources[K]>; | ||
queryResourceAccess: import("@duely/core").GenericFunction<Promise<AccessLevel>, [] | [client: ClientBase, id: string] | [id: string]>; | ||
queryResource<K extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K, id_or_filter: string | Partial<Resources[K]>): Promise<Resources[K]>; | ||
queryResourceAll<K_1 extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K_1, filter?: Partial<Resources[K_1]> | undefined): Promise<Resources[K_1][]>; | ||
queryResource<K extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K, id_or_filter: string | Partial<Resources[K]>, token?: string | undefined): Promise<Resources[K]>; | ||
queryResourceAll<K_1 extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K_1, filter?: Partial<Resources[K_1]> | undefined, token?: string | undefined): Promise<Resources[K_1][]>; | ||
createResource<K_2 extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K_2, data: Partial<Resources[K_2]>): Promise<Resources[K_2]>; | ||
@@ -61,0 +61,0 @@ upsertResource<K_3 extends "subdomain" | "agency" | "theme" | "image" | "user" | "sign up" | "password reset" | "product" | "markdown" | "membership" | "notification definition" | "form" | "agency thank you page setting" | "page block definition" | "product thank you page setting" | "form field" | "page block" | "transaction fee" | "page definition" | "page" | "stripe account" | "subscription plan" | "customer" | "webhook event" | "price" | "order" | "credential" | "integration type" | "integration" | "order item">(resource_name: K_3, data: Partial<Resources[K_3]>): Promise<Resources[K_3]>; |
{ | ||
"name": "@duely/db", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"description": "Client for querying duely-postgres database.", | ||
@@ -5,0 +5,0 @@ "repository": "github:uoleevi/duely", |
@@ -250,3 +250,4 @@ import { ClientBase, Pool, PoolClient, QueryConfig } from 'pg'; | ||
resource_name: K, | ||
id_or_filter: string | Partial<Resources[K]> | ||
id_or_filter: string | Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K]>; | ||
@@ -256,3 +257,4 @@ export async function queryResource<K extends keyof Resources>( | ||
resource_name: K, | ||
id_or_filter: string | Partial<Resources[K]> | ||
id_or_filter: string | Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K]>; | ||
@@ -262,13 +264,20 @@ export async function queryResource<K extends keyof Resources>( | ||
resource_name: K, | ||
id_or_filter: string | Partial<Resources[K]> | ||
id_or_filter: string | Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K]> { | ||
if (!arg || !resource_name || !id_or_filter) throw Error('Arguments are required'); | ||
const parameterPgTypes = ['text']; | ||
parameterPgTypes.push(typeof id_or_filter === 'string' ? 'text' : 'jsonb'); | ||
if (token != undefined) parameterPgTypes.push('text'); | ||
const parametersSql = parameterPgTypes.map((t, i) => `$${i}::${t}`).join(', '); | ||
const parameters = [resource_name, id_or_filter, token].slice(0, parameterPgTypes.length); | ||
return await query( | ||
arg as any /* Context | ClientBase */, | ||
`SELECT * FROM operation_.query_resource_($1::text, $2::${ | ||
typeof id_or_filter === 'string' ? 'text' : 'jsonb' | ||
})`, | ||
resource_name, | ||
id_or_filter | ||
`SELECT * FROM operation_.query_resource_(${parametersSql})`, | ||
...parameters | ||
); | ||
@@ -280,3 +289,4 @@ } | ||
resource_name: K, | ||
filter?: Partial<Resources[K]> | ||
filter?: Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K][]>; | ||
@@ -286,3 +296,4 @@ export async function queryResourceAll<K extends keyof Resources>( | ||
resource_name: K, | ||
filter?: Partial<Resources[K]> | ||
filter?: Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K][]>; | ||
@@ -292,9 +303,18 @@ export async function queryResourceAll<K extends keyof Resources>( | ||
resource_name: K, | ||
filter?: Partial<Resources[K]> | ||
filter?: Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K][]> { | ||
if (!arg || !resource_name || !filter) throw Error('Arguments are required'); | ||
const parameterPgTypes = ['text', 'jsonb']; | ||
if (token != undefined) parameterPgTypes.push('text'); | ||
const parametersSql = parameterPgTypes.map((t, i) => `$${i}::${t}`).join(', '); | ||
const parameters = [resource_name, filter, token].slice(0, parameterPgTypes.length); | ||
return await queryAll( | ||
arg as any /* Context | ClientBase */, | ||
'SELECT * FROM operation_.query_resource_($1::text, $2::jsonb)', | ||
resource_name, | ||
filter | ||
`SELECT * FROM operation_.query_resource_(${parametersSql})`, | ||
...parameters | ||
); | ||
@@ -417,11 +437,13 @@ } | ||
resource_name: K, | ||
id_or_filter: string | Partial<Resources[K]> | ||
id_or_filter: string | Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K]> { | ||
return await queryResource(client, resource_name, id_or_filter); | ||
return await queryResource(client, resource_name, id_or_filter, token); | ||
}, | ||
async queryResourceAll<K extends keyof Resources>( | ||
resource_name: K, | ||
filter?: Partial<Resources[K]> | ||
filter?: Partial<Resources[K]>, | ||
token?: string | ||
): Promise<Resources[K][]> { | ||
return await queryResourceAll(client, resource_name, filter); | ||
return await queryResourceAll(client, resource_name, filter, token); | ||
}, | ||
@@ -428,0 +450,0 @@ async createResource<K extends keyof Resources>( |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1117089
12103