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

@duely/db

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@duely/db - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

2

dist/index.d.ts

@@ -57,3 +57,3 @@ import { ClientBase, Pool, QueryConfig } from 'pg';

queryResourceAccess: import("@duely/core").GenericFunction<Promise<string>, [] | [client: ClientBase, id: string] | [id: string]>;
queryResource<K extends string, R_2 = any, F extends Record<string, any> = Record<string, any>>(id_or_resource_name: K, filter?: F | undefined): Promise<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" ? Resources[K] : R_2>;
queryResource<K extends string, R_2 = any, F extends Record<string, any> = Record<string, any>>(id_or_resource_name: K, filter?: F | undefined): Promise<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" | "order item" ? Resources[K] : R_2>;
queryResourceAll<R_3 = any, F_1 extends Record<string, any> = Record<string, any>>(resource_name: string, filter?: F_1 | undefined): Promise<R_3[]>;

@@ -60,0 +60,0 @@ createResource<R_4 = any, I_2 extends Record<string, any> = Record<string, any>>(resource_name: string, data: I_2): Promise<R_4>;

@@ -23,11 +23,11 @@ declare type FilteredKeys<T, U> = {

name: string;
image_logo_id: ResourceId<'image'>;
image_hero_id: ResourceId<'image'>;
color_primary: string;
color_secondary: string;
color_accent: string;
color_background: string;
color_surface: string;
color_error: string;
color_success: string;
image_logo_id?: ResourceId<'image'>;
image_hero_id?: ResourceId<'image'>;
color_primary?: string;
color_secondary?: string;
color_accent?: string;
color_background?: string;
color_surface?: string;
color_error?: string;
color_success?: string;
agency_id: ResourceId<'agency'>;

@@ -40,3 +40,3 @@ };

color: string;
agency_id: ResourceId<'agency'>;
agency_id?: ResourceId<'agency'>;
access: AccessLevel;

@@ -68,15 +68,15 @@ };

url_name: string;
description: string;
duration: string;
image_logo_id: ResourceId<'image'>;
image_hero_id: ResourceId<'image'>;
default_price_id: ResourceId<'price'>;
markdown_description_id: ResourceId<'markdown'>;
stripe_prod_id_ext_live: string;
stripe_prod_id_ext_test: string;
integration_id: ResourceId<'integration'>;
description?: string;
duration?: string;
image_logo_id?: ResourceId<'image'>;
image_hero_id?: ResourceId<'image'>;
default_price_id?: ResourceId<'price'>;
markdown_description_id?: ResourceId<'markdown'>;
stripe_prod_id_ext_live?: string;
stripe_prod_id_ext_test?: string;
integration_id?: ResourceId<'integration'>;
};
export declare type MarkdownResource = {
id: ResourceId<'markdown'>;
agency_id: ResourceId<'agency'>;
agency_id?: ResourceId<'agency'>;
name: string;

@@ -95,10 +95,10 @@ data: string;

name: string;
description: string;
stripe_event: string;
feed_template: string;
feed_notification_enabled: boolean;
feed_notification_default: boolean;
email_template: string;
email_notifications_enabled: boolean;
email_notifications_default: boolean;
description?: string;
stripe_event?: string;
feed_template?: string;
feed_notification_enabled?: boolean;
feed_notification_default?: boolean;
email_template?: string;
email_notifications_enabled?: boolean;
email_notifications_default?: boolean;
};

@@ -110,4 +110,4 @@ export declare type UserNotificationSettingResource = {

notification_definition_id: ResourceId<'notification definition'>;
feed_notification: boolean;
email_notification: boolean;
feed_notification?: boolean;
email_notification?: boolean;
};

@@ -136,3 +136,3 @@ export declare type AgencyThankYouPageSettingResource = {

label: string;
default: object;
default?: object;
sort_key: number;

@@ -145,3 +145,3 @@ };

data: object;
after_id: ResourceId<'page block'>;
after_id?: ResourceId<'page block'>;
};

@@ -151,2 +151,102 @@ export declare type FormResource = {

};
export declare type TransactionFeeResource = {
id: ResourceId<'transaction fee'>;
subscription_plan_id: ResourceId<'subscription plan'>;
numerator: number;
denominator: number;
fixed_amount: number;
currency: string;
transaction_amount_upper_bound?: number;
data: object;
};
export declare type PageDefinitionResource = {
id: ResourceId<'page definition'>;
name: string;
default_block_uuids: string[];
url_path: string;
};
export declare type PageResource = {
id: ResourceId<'page'>;
agency_id: ResourceId<'agency'>;
page_definition_id: ResourceId<'page definition'>;
access: AccessLevel;
product_id?: ResourceId<'product'>;
url_path: string;
};
export declare type StripeAccountResource = {
id: ResourceId<'stripe account'>;
agency_id: ResourceId<'agency'>;
stripe_id_ext: string;
livemode: boolean;
};
export declare type SubscriptionPlanResource = {
id: ResourceId<'subscription plan'>;
name: string;
stripe_prod_id_ext_live?: string;
stripe_prod_id_ext_test?: string;
data: object;
};
export declare type CustomerResource = {
id: ResourceId<'customer'>;
name?: string;
email_address: string;
default_stripe_id_ext: string;
stripe_account_id: ResourceId<'stripe account'>;
user_id?: ResourceId<'user'>;
};
export declare type WebhookEventResource = {
id: ResourceId<'webhook event'>;
id_ext: string;
source: string;
data: object;
state: ProcessingState;
error?: string;
agency_id: ResourceId<'agency'>;
event_at: Date;
livemode: boolean;
};
export declare type PriceResource = {
id: ResourceId<'price'>;
product_id: ResourceId<'product'>;
type: string;
unit_amount: number;
currency: string;
recurring_interal?: string;
recurring_inteval_count?: number;
stripe_price_id_ext_live?: string;
stripe_price_id_ext_test?: string;
};
export declare type OrderResource = {
id: ResourceId<'order'>;
customer_id: ResourceId<'customer'>;
stripe_account_id: ResourceId<'stripe account'>;
stripe_checkout_session_id_ext: string;
state: ProcessingState;
error?: string;
ordered_at: Date;
processed_at: Date;
};
export declare type CredentialResource = {
id: ResourceId<'credential'>;
name: string;
type: string;
agency_id: ResourceId<'agency'>;
data: object;
};
export declare type IntegrationResource = {
id: ResourceId<'integration'>;
name: string;
agency_id: ResourceId<'agency'>;
credential_id?: ResourceId<'credential'>;
data: object;
};
export declare type OrderItemResource = {
id: ResourceId<'order item'>;
order_id: ResourceId<'order'>;
price_id: ResourceId<'price'>;
stripe_line_item_id_ext: string;
state: ProcessingState;
error?: string;
processed_at: Date;
};
export declare type ResourceDefinitions = {

@@ -265,2 +365,3 @@ subdomain: {

table_name: 'transaction_fee';
resource: TransactionFeeResource;
};

@@ -271,2 +372,3 @@ 'page definition': {

table_name: 'page_definition';
resource: PageDefinitionResource;
};

@@ -277,2 +379,3 @@ page: {

table_name: 'page';
resource: PageResource;
};

@@ -283,2 +386,3 @@ 'stripe account': {

table_name: 'stripe_account';
resource: StripeAccountResource;
};

@@ -289,2 +393,3 @@ 'subscription plan': {

table_name: 'subscription_plan';
resource: SubscriptionPlanResource;
};

@@ -295,2 +400,3 @@ customer: {

table_name: 'customer';
resource: CustomerResource;
};

@@ -301,2 +407,3 @@ 'webhook event': {

table_name: 'webhook_event';
resource: WebhookEventResource;
};

@@ -307,2 +414,3 @@ price: {

table_name: 'price';
resource: PriceResource;
};

@@ -313,2 +421,3 @@ order: {

table_name: 'order';
resource: OrderResource;
};

@@ -319,2 +428,3 @@ credential: {

table_name: 'credential';
resource: CredentialResource;
};

@@ -325,2 +435,3 @@ integration: {

table_name: 'integration';
resource: IntegrationResource;
};

@@ -331,2 +442,3 @@ 'order item': {

table_name: 'order_item';
resource: OrderItemResource;
};

@@ -333,0 +445,0 @@ };

{
"name": "@duely/db",
"version": "0.0.18",
"version": "0.0.19",
"description": "Client for querying duely-postgres database.",

@@ -21,11 +21,11 @@ "repository": "github:uoleevi/duely",

"@types/jest": "^26.0.20",
"@types/node": "^14.14.32",
"@types/node": "^14.14.34",
"@types/pg": "^7.14.11",
"jest": "^26.6.3",
"ts-jest": "^26.5.3",
"ts-loader": "^8.0.17",
"ts-loader": "^8.0.18",
"typescript": "^4.2.3",
"webpack": "^5.24.3",
"webpack": "^5.25.0",
"webpack-cli": "^4.5.0"
}
}

@@ -5,3 +5,3 @@ import { ClientBase, Pool, PoolClient, QueryConfig } from 'pg';

import { Awaited, ResolvableValue, Util } from '@duely/core';
import { Resources } from './types';
import { AccessLevel, Resources } from './types';

@@ -235,6 +235,9 @@ export * from './errors';

export async function queryResourceAccess(context: Context, id: string): Promise<string>;
export async function queryResourceAccess(client: ClientBase, id: string): Promise<string>;
export async function queryResourceAccess(arg: Context | ClientBase, id: string): Promise<string> {
return await query<string, [string]>(
export async function queryResourceAccess(context: Context, id: string): Promise<AccessLevel>;
export async function queryResourceAccess(client: ClientBase, id: string): Promise<AccessLevel>;
export async function queryResourceAccess(
arg: Context | ClientBase,
id: string
): Promise<AccessLevel> {
return await query<AccessLevel, [string]>(
arg as any /* Context | ClientBase */,

@@ -246,36 +249,24 @@ 'SELECT * FROM operation_.query_resource_access_($1::text)',

export async function queryResource<K extends keyof Resources, F extends Record<string, any> = Record<string, any>>(
export async function queryResource<K extends keyof Resources>(
context: Context,
id_or_resource_name: K,
filter?: F
resource_name: K,
id_or_filter: string | Partial<Resources[K]>
): Promise<Resources[K]>;
export async function queryResource<R = any, F extends Record<string, any> = Record<string, any>>(
context: Context,
id_or_resource_name: string,
filter?: F
): Promise<R>;
export async function queryResource<R = any, F extends Record<string, any> = Record<string, any>>(
export async function queryResource<K extends keyof Resources>(
client: ClientBase,
id_or_resource_name: string,
filter?: F
): Promise<R>;
export async function queryResource<R = any, F extends Record<string, any> = Record<string, any>>(
resource_name: K,
id_or_filter: string | Partial<Resources[K]>
): Promise<Resources[K]>;
export async function queryResource<K extends keyof Resources>(
arg: Context | ClientBase,
id_or_resource_name: string,
filter?: F
): Promise<R> {
if (filter) {
const resources = await queryResourceAll<R, F>(
arg as any /* Context | ClientBase */,
id_or_resource_name,
filter
);
return resources[0];
}
resource_name: K,
id_or_filter: string | Partial<Resources[K]>
): Promise<Resources[K]> {
if (!arg || !resource_name || !id_or_filter) throw Error('Arguments are required');
const id = id_or_resource_name;
return await query(
arg as any /* Context | ClientBase */,
'SELECT * FROM operation_.query_resource_($1::text)',
id
'SELECT * FROM operation_.query_resource_($1::text, $2::jsonb)',
resource_name,
id_or_filter
);

@@ -399,7 +390,7 @@ }

queryResourceAccess: Util.partial(queryResourceAccess, client),
async queryResource<K extends string, R = any, F extends Record<string, any> = Record<string, any>>(
id_or_resource_name: K,
filter?: F
): Promise<K extends keyof Resources ? Resources[K] : R> {
return await queryResource(client, id_or_resource_name, filter);
async queryResource<K extends keyof Resources>(
resource_name: K,
id_or_filter: string | Partial<Resources[K]>
): Promise<Resources[K]> {
return await queryResource(client, resource_name, id_or_filter);
},

@@ -406,0 +397,0 @@ async queryResourceAll<R = any, F extends Record<string, any> = Record<string, any>>(

@@ -32,11 +32,11 @@ type FilteredKeys<T, U> = { [P in keyof T]: T[P] extends U ? P : never }[keyof T];

name: string;
image_logo_id: ResourceId<'image'>;
image_hero_id: ResourceId<'image'>;
color_primary: string;
color_secondary: string;
color_accent: string;
color_background: string;
color_surface: string;
color_error: string;
color_success: string;
image_logo_id?: ResourceId<'image'>;
image_hero_id?: ResourceId<'image'>;
color_primary?: string;
color_secondary?: string;
color_accent?: string;
color_background?: string;
color_surface?: string;
color_error?: string;
color_success?: string;
agency_id: ResourceId<'agency'>;

@@ -50,3 +50,3 @@ };

color: string;
agency_id: ResourceId<'agency'>;
agency_id?: ResourceId<'agency'>;
access: AccessLevel;

@@ -82,11 +82,11 @@ };

url_name: string;
description: string;
duration: string;
image_logo_id: ResourceId<'image'>;
image_hero_id: ResourceId<'image'>;
default_price_id: ResourceId<'price'>;
markdown_description_id: ResourceId<'markdown'>;
stripe_prod_id_ext_live: string;
stripe_prod_id_ext_test: string;
integration_id: ResourceId<'integration'>;
description?: string;
duration?: string;
image_logo_id?: ResourceId<'image'>;
image_hero_id?: ResourceId<'image'>;
default_price_id?: ResourceId<'price'>;
markdown_description_id?: ResourceId<'markdown'>;
stripe_prod_id_ext_live?: string;
stripe_prod_id_ext_test?: string;
integration_id?: ResourceId<'integration'>;
};

@@ -96,3 +96,3 @@

id: ResourceId<'markdown'>;
agency_id: ResourceId<'agency'>;
agency_id?: ResourceId<'agency'>;
name: string;

@@ -113,10 +113,10 @@ data: string;

name: string;
description: string;
stripe_event: string;
feed_template: string;
feed_notification_enabled: boolean;
feed_notification_default: boolean;
email_template: string;
email_notifications_enabled: boolean;
email_notifications_default: boolean;
description?: string;
stripe_event?: string;
feed_template?: string;
feed_notification_enabled?: boolean;
feed_notification_default?: boolean;
email_template?: string;
email_notifications_enabled?: boolean;
email_notifications_default?: boolean;
};

@@ -129,4 +129,4 @@

notification_definition_id: ResourceId<'notification definition'>;
feed_notification: boolean;
email_notification: boolean;
feed_notification?: boolean;
email_notification?: boolean;
};

@@ -159,3 +159,3 @@

label: string;
default: object;
default?: object;
sort_key: number;

@@ -169,3 +169,3 @@ };

data: object;
after_id: ResourceId<'page block'>;
after_id?: ResourceId<'page block'>;
};

@@ -177,2 +177,114 @@

export type TransactionFeeResource = {
id: ResourceId<'transaction fee'>;
subscription_plan_id: ResourceId<'subscription plan'>;
numerator: number;
denominator: number;
fixed_amount: number;
currency: string;
transaction_amount_upper_bound?: number;
data: object;
};
export type PageDefinitionResource = {
id: ResourceId<'page definition'>;
name: string;
default_block_uuids: string[];
url_path: string;
};
export type PageResource = {
id: ResourceId<'page'>;
agency_id: ResourceId<'agency'>;
page_definition_id: ResourceId<'page definition'>;
access: AccessLevel;
product_id?: ResourceId<'product'>;
url_path: string;
};
export type StripeAccountResource = {
id: ResourceId<'stripe account'>;
agency_id: ResourceId<'agency'>;
stripe_id_ext: string;
livemode: boolean;
};
export type SubscriptionPlanResource = {
id: ResourceId<'subscription plan'>;
name: string;
stripe_prod_id_ext_live?: string;
stripe_prod_id_ext_test?: string;
data: object;
};
export type CustomerResource = {
id: ResourceId<'customer'>;
name?: string;
email_address: string;
default_stripe_id_ext: string;
stripe_account_id: ResourceId<'stripe account'>;
user_id?: ResourceId<'user'>;
};
export type WebhookEventResource = {
id: ResourceId<'webhook event'>;
id_ext: string;
source: string;
data: object;
state: ProcessingState;
error?: string;
agency_id: ResourceId<'agency'>;
event_at: Date;
livemode: boolean;
};
export type PriceResource = {
id: ResourceId<'price'>;
product_id: ResourceId<'product'>;
type: string;
unit_amount: number;
currency: string;
recurring_interal?: string;
recurring_inteval_count?: number;
stripe_price_id_ext_live?: string;
stripe_price_id_ext_test?: string;
};
export type OrderResource = {
id: ResourceId<'order'>;
customer_id: ResourceId<'customer'>;
stripe_account_id: ResourceId<'stripe account'>;
stripe_checkout_session_id_ext: string;
state: ProcessingState;
error?: string;
ordered_at: Date;
processed_at: Date;
};
export type CredentialResource = {
id: ResourceId<'credential'>;
name: string;
type: string;
agency_id: ResourceId<'agency'>;
data: object;
};
export type IntegrationResource = {
id: ResourceId<'integration'>;
name: string;
agency_id: ResourceId<'agency'>;
credential_id?: ResourceId<'credential'>;
data: object;
};
export type OrderItemResource = {
id: ResourceId<'order item'>;
order_id: ResourceId<'order'>;
price_id: ResourceId<'price'>;
stripe_line_item_id_ext: string;
state: ProcessingState;
error?: string;
processed_at: Date;
};
export type ResourceDefinitions = {

@@ -261,3 +373,3 @@ subdomain: {

table_name: 'agency_thank_you_page_setting';
resource: AgencyThankYouPageSettingResource
resource: AgencyThankYouPageSettingResource;
};

@@ -292,2 +404,3 @@ 'page block definition': {

table_name: 'transaction_fee';
resource: TransactionFeeResource;
};

@@ -298,2 +411,3 @@ 'page definition': {

table_name: 'page_definition';
resource: PageDefinitionResource;
};

@@ -304,2 +418,3 @@ page: {

table_name: 'page';
resource: PageResource;
};

@@ -310,2 +425,3 @@ 'stripe account': {

table_name: 'stripe_account';
resource: StripeAccountResource;
};

@@ -316,2 +432,3 @@ 'subscription plan': {

table_name: 'subscription_plan';
resource: SubscriptionPlanResource;
};

@@ -322,2 +439,3 @@ customer: {

table_name: 'customer';
resource: CustomerResource;
};

@@ -328,2 +446,3 @@ 'webhook event': {

table_name: 'webhook_event';
resource: WebhookEventResource;
};

@@ -334,2 +453,3 @@ price: {

table_name: 'price';
resource: PriceResource;
};

@@ -340,2 +460,3 @@ order: {

table_name: 'order';
resource: OrderResource;
};

@@ -346,2 +467,3 @@ credential: {

table_name: 'credential';
resource: CredentialResource;
};

@@ -352,2 +474,3 @@ integration: {

table_name: 'integration';
resource: IntegrationResource;
};

@@ -358,2 +481,3 @@ 'order item': {

table_name: 'order_item';
resource: OrderItemResource;
};

@@ -360,0 +484,0 @@ };

Sorry, the diff of this file is too big to display

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