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

@poap-xyz/drops

Package Overview
Dependencies
Maintainers
5
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poap-xyz/drops - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-beta-v1

dist/cjs/types/dropImage.d.ts

95

dist/cjs/domain/Drop.d.ts
export declare class Drop {
id: number;
fancy_id: string;
fancyId: string;
name: string;

@@ -8,45 +8,72 @@ description: string;

country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
timezone: string;
private: boolean;
startDate: Date;
createdDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
constructor(properties: DropProperties);
getTotalMinted(): number;
toSerializableObject(): SerializableDrop;
}
export interface SerializableDrop {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
startDate: string;
createdDate: string;
poapCount: number;
transferCount: number;
emailReservationCount: number;
expiryDate: string;
endDate: string;
}
export interface DropProperties {
id: number;
fancy_id: string;
fancyId: string;
name: string;
description: string;
created_date: string;
city: string;
country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
timezone: string;
private: boolean;
createdDate: Date;
startDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
}

@@ -6,8 +6,11 @@ import { CompassProvider, DropApiProvider } from '@poap-xyz/providers';

export declare class DropsClient {
private CompassProvider;
private DropApiProvider;
constructor(CompassProvider: CompassProvider, DropApiProvider: DropApiProvider);
private compassProvider;
private dropApiProvider;
constructor(compassProvider: CompassProvider, dropApiProvider: DropApiProvider);
fetch(input: FetchDropsInput): Promise<PaginatedResult<Drop>>;
create(input: CreateDropsInput): Promise<Drop>;
update(input: UpdateDropsInput): Promise<Drop>;
private formatDrop;
private computeDropImages;
private mapDropImage;
}

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

import { DropsClient } from './DropsClient';
export { DropsClient };
export { DropsClient } from './DropsClient';
export { Drop, DropProperties, SerializableDrop } from './domain/Drop';
export { FetchDropsInput, CreateDropsInput, UpdateDropsInput, DropsSortFields, } from './types';

@@ -1,2 +0,10 @@

export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n event_url\n image_url\n animation_url\n year\n start_date\n end_date\n expiry_date\n from_admin\n virtual_event\n supply\n event_template_id\n private_event\n location_type\n channel\n platform\n timezone\n created_date\n attributes_aggregate {\n aggregate {\n count\n }\n }\n }\n drops_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n";
import { DropImageGatewayType } from '../types/dropImage';
export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n channel\n platform\n location_type\n drop_url\n image_url\n animation_url\n year\n start_date\n timezone\n private\n created_date\n expiry_date\n end_date\n stats_by_chain_aggregate {\n aggregate {\n sum {\n transfer_count\n poap_count\n }\n }\n }\n email_claims_stats {\n total\n }\n drop_image {\n gateways {\n type\n url\n }\n }\n }\n }\n";
export interface DropImageGatewayResponse {
type: DropImageGatewayType;
url: string;
}
export interface DropImageResponse {
gateways: Array<DropImageGatewayResponse>;
}
export interface DropResponse {

@@ -9,32 +17,32 @@ id: number;

country: string;
event_url: string;
channel: string;
platform: string;
location_type: string;
drop_url: string;
image_url: string;
animation_url?: string;
animation_url: string;
year: number;
start_date: string;
timezone: string;
private: boolean;
created_date: string;
expiry_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
attributes_aggregate: {
stats_by_chain_aggregate: {
aggregate: {
count: number;
sum: {
transfer_count: number;
poap_count: number;
};
};
};
email_claims_stats: {
total: number;
};
drop_image?: DropImageResponse;
}
export interface PaginatedDropsResponse {
drops: DropResponse[];
drops_aggregate: {
aggregate: {
count: number;
};
data: {
drops: DropResponse[];
};
}

@@ -1,20 +0,35 @@

import { DropProperties } from './../domain/Drop';
export interface FetchDropsInput {
limit: number;
offset: number;
order?: string;
key?: string;
value?: string;
import { Order, PaginationInput } from '@poap-xyz/utils';
export declare enum DropsSortFields {
Name = "name",
Id = "id",
StartDate = "start_date"
}
export interface FetchDropsInput extends PaginationInput {
name?: string;
nameOrder?: string;
idOrder?: string;
withMetadata?: string;
sortField?: DropsSortFields;
sortDir?: Order;
from?: string;
to?: string;
ids?: number[];
isPrivate?: boolean;
}
export interface CreateDropsInput extends DropProperties {
export interface CreateDropsInput {
name: string;
description: string;
city: string;
country: string;
startDate: string;
endDate: string;
expiryDate: string;
eventUrl: string;
virtualEvent: boolean;
image: Blob;
filename: string;
contentType: string;
secretCode: string;
eventTemplateId?: number | null;
email: string;
image: string;
secret_code: string;
requestedCodes?: number;
privateEvent?: boolean;
}
export type UpdateDropsInput = CreateDropsInput;
export declare class Drop {
id: number;
fancy_id: string;
fancyId: string;
name: string;

@@ -8,45 +8,72 @@ description: string;

country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
timezone: string;
private: boolean;
startDate: Date;
createdDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
constructor(properties: DropProperties);
getTotalMinted(): number;
toSerializableObject(): SerializableDrop;
}
export interface SerializableDrop {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
startDate: string;
createdDate: string;
poapCount: number;
transferCount: number;
emailReservationCount: number;
expiryDate: string;
endDate: string;
}
export interface DropProperties {
id: number;
fancy_id: string;
fancyId: string;
name: string;
description: string;
created_date: string;
city: string;
country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
timezone: string;
private: boolean;
createdDate: Date;
startDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
}

@@ -6,8 +6,11 @@ import { CompassProvider, DropApiProvider } from '@poap-xyz/providers';

export declare class DropsClient {
private CompassProvider;
private DropApiProvider;
constructor(CompassProvider: CompassProvider, DropApiProvider: DropApiProvider);
private compassProvider;
private dropApiProvider;
constructor(compassProvider: CompassProvider, dropApiProvider: DropApiProvider);
fetch(input: FetchDropsInput): Promise<PaginatedResult<Drop>>;
create(input: CreateDropsInput): Promise<Drop>;
update(input: UpdateDropsInput): Promise<Drop>;
private formatDrop;
private computeDropImages;
private mapDropImage;
}

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

import { DropsClient } from './DropsClient';
export { DropsClient };
export { DropsClient } from './DropsClient';
export { Drop, DropProperties, SerializableDrop } from './domain/Drop';
export { FetchDropsInput, CreateDropsInput, UpdateDropsInput, DropsSortFields, } from './types';

@@ -1,2 +0,10 @@

export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n event_url\n image_url\n animation_url\n year\n start_date\n end_date\n expiry_date\n from_admin\n virtual_event\n supply\n event_template_id\n private_event\n location_type\n channel\n platform\n timezone\n created_date\n attributes_aggregate {\n aggregate {\n count\n }\n }\n }\n drops_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n";
import { DropImageGatewayType } from '../types/dropImage';
export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n channel\n platform\n location_type\n drop_url\n image_url\n animation_url\n year\n start_date\n timezone\n private\n created_date\n expiry_date\n end_date\n stats_by_chain_aggregate {\n aggregate {\n sum {\n transfer_count\n poap_count\n }\n }\n }\n email_claims_stats {\n total\n }\n drop_image {\n gateways {\n type\n url\n }\n }\n }\n }\n";
export interface DropImageGatewayResponse {
type: DropImageGatewayType;
url: string;
}
export interface DropImageResponse {
gateways: Array<DropImageGatewayResponse>;
}
export interface DropResponse {

@@ -9,32 +17,32 @@ id: number;

country: string;
event_url: string;
channel: string;
platform: string;
location_type: string;
drop_url: string;
image_url: string;
animation_url?: string;
animation_url: string;
year: number;
start_date: string;
timezone: string;
private: boolean;
created_date: string;
expiry_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
attributes_aggregate: {
stats_by_chain_aggregate: {
aggregate: {
count: number;
sum: {
transfer_count: number;
poap_count: number;
};
};
};
email_claims_stats: {
total: number;
};
drop_image?: DropImageResponse;
}
export interface PaginatedDropsResponse {
drops: DropResponse[];
drops_aggregate: {
aggregate: {
count: number;
};
data: {
drops: DropResponse[];
};
}

@@ -1,20 +0,35 @@

import { DropProperties } from './../domain/Drop';
export interface FetchDropsInput {
limit: number;
offset: number;
order?: string;
key?: string;
value?: string;
import { Order, PaginationInput } from '@poap-xyz/utils';
export declare enum DropsSortFields {
Name = "name",
Id = "id",
StartDate = "start_date"
}
export interface FetchDropsInput extends PaginationInput {
name?: string;
nameOrder?: string;
idOrder?: string;
withMetadata?: string;
sortField?: DropsSortFields;
sortDir?: Order;
from?: string;
to?: string;
ids?: number[];
isPrivate?: boolean;
}
export interface CreateDropsInput extends DropProperties {
export interface CreateDropsInput {
name: string;
description: string;
city: string;
country: string;
startDate: string;
endDate: string;
expiryDate: string;
eventUrl: string;
virtualEvent: boolean;
image: Blob;
filename: string;
contentType: string;
secretCode: string;
eventTemplateId?: number | null;
email: string;
image: string;
secret_code: string;
requestedCodes?: number;
privateEvent?: boolean;
}
export type UpdateDropsInput = CreateDropsInput;
export declare class Drop {
id: number;
fancy_id: string;
fancyId: string;
name: string;

@@ -8,45 +8,72 @@ description: string;

country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
timezone: string;
private: boolean;
startDate: Date;
createdDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
constructor(properties: DropProperties);
getTotalMinted(): number;
toSerializableObject(): SerializableDrop;
}
export interface SerializableDrop {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
startDate: string;
createdDate: string;
poapCount: number;
transferCount: number;
emailReservationCount: number;
expiryDate: string;
endDate: string;
}
export interface DropProperties {
id: number;
fancy_id: string;
fancyId: string;
name: string;
description: string;
created_date: string;
city: string;
country: string;
event_url: string;
image_url: string;
animation_url?: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
start_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
timezone: string;
private: boolean;
createdDate: Date;
startDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
}

@@ -6,8 +6,11 @@ import { CompassProvider, DropApiProvider } from '@poap-xyz/providers';

export declare class DropsClient {
private CompassProvider;
private DropApiProvider;
constructor(CompassProvider: CompassProvider, DropApiProvider: DropApiProvider);
private compassProvider;
private dropApiProvider;
constructor(compassProvider: CompassProvider, dropApiProvider: DropApiProvider);
fetch(input: FetchDropsInput): Promise<PaginatedResult<Drop>>;
create(input: CreateDropsInput): Promise<Drop>;
update(input: UpdateDropsInput): Promise<Drop>;
private formatDrop;
private computeDropImages;
private mapDropImage;
}

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

import { DropsClient } from './DropsClient';
export { DropsClient };
export { DropsClient } from './DropsClient';
export { Drop, DropProperties, SerializableDrop } from './domain/Drop';
export { FetchDropsInput, CreateDropsInput, UpdateDropsInput, DropsSortFields, } from './types';
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@poap-xyz/drops"] = {}));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@poap-xyz/drops"] = {}));
})(this, (function (exports) { 'use strict';
/******************************************************************************
Copyright (c) Microsoft Corporation.
class Drop {
constructor(properties) {
this.id = properties.id;
this.fancyId = properties.fancyId;
this.name = properties.name;
this.description = properties.description;
this.city = properties.city;
this.country = properties.country;
this.channel = properties.channel;
this.platform = properties.platform;
this.locationType = properties.locationType;
this.dropUrl = properties.dropUrl;
this.imageUrl = properties.imageUrl;
this.originalImageUrl = properties.originalImageUrl;
this.animationUrl = properties.animationUrl;
this.year = properties.year;
this.startDate = properties.startDate;
this.timezone = properties.timezone;
this.private = properties.private;
this.createdDate = properties.createdDate;
this.poapCount = properties.poapCount;
this.transferCount = properties.transferCount;
this.emailReservationCount = properties.emailReservationCount;
this.expiryDate = properties.expiryDate;
this.endDate = properties.endDate;
}
getTotalMinted() {
return this.poapCount + this.emailReservationCount;
}
toSerializableObject() {
return {
id: this.id,
fancyId: this.fancyId,
name: this.name,
description: this.description,
city: this.city,
country: this.country,
channel: this.channel,
platform: this.platform,
locationType: this.locationType,
dropUrl: this.dropUrl,
imageUrl: this.imageUrl,
originalImageUrl: this.originalImageUrl,
animationUrl: this.animationUrl,
year: this.year,
timezone: this.timezone,
private: this.private,
startDate: this.startDate.toISOString(),
createdDate: this.createdDate.toISOString(),
poapCount: this.poapCount,
transferCount: this.transferCount,
emailReservationCount: this.emailReservationCount,
expiryDate: this.expiryDate.toISOString(),
endDate: this.endDate.toISOString(),
};
}
}
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
const PAGINATED_DROPS_QUERY = `
query PaginatedDrops(
$limit: Int!
$offset: Int!
$orderBy: [drops_order_by!]
$where: drops_bool_exp
) {
drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {
id
fancy_id
name
description
city
country
channel
platform
location_type
drop_url
image_url
animation_url
year
start_date
timezone
private
created_date
expiry_date
end_date
stats_by_chain_aggregate {
aggregate {
sum {
transfer_count
poap_count
}
}
}
email_claims_stats {
total
}
drop_image {
gateways {
type
url
}
}
}
}
`;
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var TransactionRequestStatus;
(function (TransactionRequestStatus) {
TransactionRequestStatus["PENDING"] = "PENDING";
TransactionRequestStatus["IN_PROCESS"] = "IN_PROCESS";
TransactionRequestStatus["FINISH"] = "FINISH";
TransactionRequestStatus["FINISH_WITH_ERROR"] = "FINISH_WITH_ERROR";
})(TransactionRequestStatus || (TransactionRequestStatus = {}));
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var Chain;
(function (Chain) {
Chain["Ethereum"] = "mainnet";
Chain["Gnosis"] = "xdai";
})(Chain || (Chain = {}));
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
var Order;
(function (Order) {
Order["ASC"] = "asc";
Order["DESC"] = "desc";
})(Order || (Order = {}));
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
class PaginatedResult {
constructor(items, nextCursor) {
this.items = items;
this.nextCursor = nextCursor;
}
}
var Drop = (function () {
function Drop(properties) {
this.id = properties.id;
this.fancy_id = properties.fancy_id;
this.name = properties.name;
this.description = properties.description;
this.city = properties.city;
this.country = properties.country;
this.event_url = properties.event_url;
this.image_url = properties.image_url;
this.year = properties.year;
this.start_date = properties.start_date;
this.end_date = properties.end_date;
this.expiry_date = properties.expiry_date;
this.from_admin = properties.from_admin;
this.virtual_event = properties.virtual_event;
this.created_date = properties.created_date;
Object.assign(this, properties);
}
return Drop;
}());
function nextCursor(length, limit, offset) {
const endIndex = offset + length;
return endIndex < offset + limit ? null : endIndex;
}
function createUndefinedOrder(key, value) {
return key && value ? { [key]: value } : {};
}
function createFilter(key, value) {
return value ? { [key]: { _ilike: `%${value}%` } } : {};
}
function creatPrivateFilter(key, value) {
return typeof value === 'boolean'
? { [key]: { _eq: value ? 'true' : 'false' } }
: {};
}
function createInFilter(key, values) {
return values && values.length ? { [key]: { _in: values } } : {};
}
function createBetweenFilter(key, from, to) {
const dateFilter = {};
if (from) {
dateFilter._gte = from;
}
if (to) {
dateFilter._lte = to;
}
return from || to ? { [key]: dateFilter } : {};
}
var PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n event_url\n image_url\n animation_url\n year\n start_date\n end_date\n expiry_date\n from_admin\n virtual_event\n supply\n event_template_id\n private_event\n location_type\n channel\n platform\n timezone\n created_date\n attributes_aggregate {\n aggregate {\n count\n }\n }\n }\n drops_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n";
class DropsClient {
constructor(compassProvider, dropApiProvider) {
this.compassProvider = compassProvider;
this.dropApiProvider = dropApiProvider;
}
async fetch(input) {
const { limit, offset, name, sortField, sortDir, from, to, ids, isPrivate, } = input;
const variables = {
limit,
offset,
orderBy: createUndefinedOrder(sortField, sortDir),
where: {
...creatPrivateFilter('private', isPrivate),
...createFilter('name', name),
...createBetweenFilter('created_date', from, to),
...createInFilter('id', ids),
},
};
const { data } = await this.compassProvider.request(PAGINATED_DROPS_QUERY, variables);
const drops = data.drops.map((drop) => {
const { imageUrl, originalImageUrl } = this.computeDropImages(drop);
return new Drop({
id: Number(drop.id),
fancyId: drop.fancy_id,
name: drop.name,
description: drop.description,
city: drop.city,
country: drop.country,
channel: drop.channel,
platform: drop.platform,
locationType: drop.location_type,
dropUrl: drop.drop_url,
imageUrl,
originalImageUrl,
animationUrl: drop.animation_url,
year: Number(drop.year),
startDate: new Date(drop.start_date),
timezone: drop.timezone,
private: drop.private,
createdDate: new Date(drop.created_date),
poapCount: drop.stats_by_chain_aggregate.aggregate.sum
? Number(drop.stats_by_chain_aggregate.aggregate.sum.poap_count)
: 0,
transferCount: drop.stats_by_chain_aggregate.aggregate.sum
? Number(drop.stats_by_chain_aggregate.aggregate.sum.transfer_count)
: 0,
emailReservationCount: drop.email_claims_stats
? Number(drop.email_claims_stats.total)
: 0,
expiryDate: new Date(drop.expiry_date),
endDate: new Date(drop.end_date),
});
});
return new PaginatedResult(drops, nextCursor(drops.length, limit, offset));
}
async create(input) {
const repsonse = await this.dropApiProvider.createDrop({
name: input.name,
description: input.description,
city: input.city,
country: input.country,
start_date: input.startDate,
end_date: input.endDate,
expiry_date: input.expiryDate,
event_url: input.eventUrl,
virtual_event: input.virtualEvent,
image: input.image,
filename: input.filename,
contentType: input.contentType,
secret_code: input.secretCode,
event_template_id: input.eventTemplateId,
email: input.email,
requested_codes: input.requestedCodes,
private_event: input.privateEvent,
});
return this.formatDrop(repsonse);
}
async update(input) {
const repsonse = await this.dropApiProvider.updateDrop({
name: input.name,
description: input.description,
country: input.country,
city: input.city,
start_date: input.startDate,
end_date: input.endDate,
expiry_date: input.expiryDate,
event_url: input.eventUrl,
virtual_event: input.virtualEvent,
private_event: input.privateEvent,
event_template_id: input.eventTemplateId,
secret_code: input.secretCode,
});
return this.formatDrop(repsonse);
}
formatDrop(drop) {
return new Drop({
id: drop.id,
fancyId: drop.fancy_id,
name: drop.name,
description: drop.description,
city: drop.city,
country: drop.country,
channel: drop.channel,
platform: drop.platform,
locationType: drop.location_type,
dropUrl: drop.event_url,
imageUrl: drop.image_url,
originalImageUrl: drop.image_url,
animationUrl: drop.animation_url,
year: drop.year,
startDate: new Date(drop.start_date),
timezone: drop.timezone,
private: drop.private_event,
createdDate: new Date(drop.created_date),
expiryDate: new Date(drop.expiry_date),
endDate: new Date(drop.end_date),
transferCount: 0,
poapCount: 0,
emailReservationCount: 0,
});
}
computeDropImages(drop) {
const dropImage = this.mapDropImage(drop.drop_image);
return {
imageUrl: (dropImage === null || dropImage === void 0 ? void 0 : dropImage.crop) || drop.image_url,
originalImageUrl: (dropImage === null || dropImage === void 0 ? void 0 : dropImage.original) || drop.image_url,
};
}
mapDropImage(response) {
if (!response)
return response;
const images = response.gateways.reduce((acc, gateway) => ({ ...acc, [gateway.type.toLowerCase()]: gateway.url }), {});
return { ...images };
}
}
function filterUndefinedProperties(obj) {
var filteredObj = {};
for (var key in obj) {
if (obj[key] !== undefined) {
filteredObj[key] = obj[key];
}
}
return filteredObj;
}
function createFilter(key, value) {
var _a;
return value ? (_a = {}, _a[key] = { _ilike: "%".concat(value, "%") }, _a) : {};
}
function createMetadataFilter(withMetadata) {
return withMetadata
? {
attributes_aggregate: {
count: { predicate: { _eq: withMetadata === 'no' ? 0 : { _gt: 0 } } },
},
}
: {};
}
function createBetweenFilter(key, from, to) {
var _a;
var dateFilter = {};
if (from)
dateFilter._gte = from;
if (to)
dateFilter._lte = to;
return from || to ? (_a = {}, _a[key] = dateFilter, _a) : {};
}
exports.DropsSortFields = void 0;
(function (DropsSortFields) {
DropsSortFields["Name"] = "name";
DropsSortFields["Id"] = "id";
DropsSortFields["StartDate"] = "start_date";
})(exports.DropsSortFields || (exports.DropsSortFields = {}));
var PaginatedResult = (function () {
function PaginatedResult(items, nextCursor) {
this.items = items;
this.nextCursor = nextCursor;
}
return PaginatedResult;
}());
exports.Drop = Drop;
exports.DropsClient = DropsClient;
var DropsClient = (function () {
function DropsClient(CompassProvider, DropApiProvider) {
this.CompassProvider = CompassProvider;
this.DropApiProvider = DropApiProvider;
}
DropsClient.prototype.fetch = function (input) {
return __awaiter(this, void 0, void 0, function () {
var limit, offset, order, key, value, name, nameOrder, idOrder, withMetadata, from, to, variables, response, drops;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
limit = input.limit, offset = input.offset, order = input.order, key = input.key, value = input.value, name = input.name, nameOrder = input.nameOrder, idOrder = input.idOrder, withMetadata = input.withMetadata, from = input.from, to = input.to;
variables = {
limit: limit,
offset: offset,
orderBy: filterUndefinedProperties({
start_date: order,
name: nameOrder,
id: idOrder,
}),
where: __assign(__assign(__assign(__assign(__assign({ private: { _eq: false } }, createFilter('name', name)), createFilter('attributes.key', key)), createFilter('attributes.value', value)), createBetweenFilter('created_date', from, to)), createMetadataFilter(withMetadata)),
};
return [4, this.CompassProvider.request(PAGINATED_DROPS_QUERY, variables)];
case 1:
response = _a.sent();
drops = response.drops.map(function (drop) {
return new Drop(__assign(__assign({}, drop), { id: Number(drop.id), year: Number(drop.year) }));
});
return [2, new PaginatedResult(drops, drops.length)];
}
});
});
};
DropsClient.prototype.create = function (input) {
return __awaiter(this, void 0, void 0, function () {
var repsonse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, this.DropApiProvider.createDrop(input)];
case 1:
repsonse = _a.sent();
return [2, new Drop(repsonse)];
}
});
});
};
DropsClient.prototype.update = function (input) {
return __awaiter(this, void 0, void 0, function () {
var repsonse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, this.DropApiProvider.updateDrop(input)];
case 1:
repsonse = _a.sent();
return [2, new Drop(repsonse)];
}
});
});
};
return DropsClient;
}());
exports.DropsClient = DropsClient;
}));
//# sourceMappingURL=index.js.map

@@ -1,2 +0,10 @@

export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n event_url\n image_url\n animation_url\n year\n start_date\n end_date\n expiry_date\n from_admin\n virtual_event\n supply\n event_template_id\n private_event\n location_type\n channel\n platform\n timezone\n created_date\n attributes_aggregate {\n aggregate {\n count\n }\n }\n }\n drops_aggregate(where: $where) {\n aggregate {\n count\n }\n }\n }\n";
import { DropImageGatewayType } from '../types/dropImage';
export declare const PAGINATED_DROPS_QUERY = "\n query PaginatedDrops(\n $limit: Int!\n $offset: Int!\n $orderBy: [drops_order_by!]\n $where: drops_bool_exp\n ) {\n drops(limit: $limit, offset: $offset, order_by: $orderBy, where: $where) {\n id\n fancy_id\n name\n description\n city\n country\n channel\n platform\n location_type\n drop_url\n image_url\n animation_url\n year\n start_date\n timezone\n private\n created_date\n expiry_date\n end_date\n stats_by_chain_aggregate {\n aggregate {\n sum {\n transfer_count\n poap_count\n }\n }\n }\n email_claims_stats {\n total\n }\n drop_image {\n gateways {\n type\n url\n }\n }\n }\n }\n";
export interface DropImageGatewayResponse {
type: DropImageGatewayType;
url: string;
}
export interface DropImageResponse {
gateways: Array<DropImageGatewayResponse>;
}
export interface DropResponse {

@@ -9,32 +17,32 @@ id: number;

country: string;
event_url: string;
channel: string;
platform: string;
location_type: string;
drop_url: string;
image_url: string;
animation_url?: string;
animation_url: string;
year: number;
start_date: string;
timezone: string;
private: boolean;
created_date: string;
expiry_date: string;
end_date: string;
expiry_date: string;
from_admin: boolean;
virtual_event: boolean;
supply?: number | null;
event_template_id?: number | null;
private_event?: boolean;
location_type?: string;
channel?: string;
platform?: string;
timezone?: string;
created_date: string;
attributes_aggregate: {
stats_by_chain_aggregate: {
aggregate: {
count: number;
sum: {
transfer_count: number;
poap_count: number;
};
};
};
email_claims_stats: {
total: number;
};
drop_image?: DropImageResponse;
}
export interface PaginatedDropsResponse {
drops: DropResponse[];
drops_aggregate: {
aggregate: {
count: number;
};
data: {
drops: DropResponse[];
};
}

@@ -1,20 +0,35 @@

import { DropProperties } from './../domain/Drop';
export interface FetchDropsInput {
limit: number;
offset: number;
order?: string;
key?: string;
value?: string;
import { Order, PaginationInput } from '@poap-xyz/utils';
export declare enum DropsSortFields {
Name = "name",
Id = "id",
StartDate = "start_date"
}
export interface FetchDropsInput extends PaginationInput {
name?: string;
nameOrder?: string;
idOrder?: string;
withMetadata?: string;
sortField?: DropsSortFields;
sortDir?: Order;
from?: string;
to?: string;
ids?: number[];
isPrivate?: boolean;
}
export interface CreateDropsInput extends DropProperties {
export interface CreateDropsInput {
name: string;
description: string;
city: string;
country: string;
startDate: string;
endDate: string;
expiryDate: string;
eventUrl: string;
virtualEvent: boolean;
image: Blob;
filename: string;
contentType: string;
secretCode: string;
eventTemplateId?: number | null;
email: string;
image: string;
secret_code: string;
requestedCodes?: number;
privateEvent?: boolean;
}
export type UpdateDropsInput = CreateDropsInput;
{
"name": "@poap-xyz/drops",
"version": "0.0.2",
"version": "0.0.3-beta-v1",
"description": "Drops module for the poap.js library",

@@ -28,9 +28,10 @@ "main": "dist/cjs/index.cjs",

},
"devDependencies": {
"rollup": "^3.20.2"
"engines": {
"node": ">=18"
},
"peerDependencies": {
"@poap-xyz/providers": "*",
"@poap-xyz/utils": "*"
}
"dependencies": {
"@poap-xyz/providers": "0.0.3-beta-v1",
"@poap-xyz/utils": "0.0.3-beta-v1"
},
"stableVersion": "0.1.7"
}

@@ -1,1 +0,54 @@

# poap.js
# @poap-xyz/drops
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
@poap-xyz/drops is a package to interact with POAP Drops.
## Features
- Create a Drop
- Update a Drop attributes
- Fetch a single Drop
- Fetch multiple Drops
## Installation
### NPM
```bash
npm install @poap-xyz/drops @poap-xyz/utils @poap-xyz/providers axios
```
### Yarn
```bash
yarn add @poap-xyz/drops @poap-xyz/utils @poap-xyz/providers axios
```
## Usage
```javascript
import { DropsClient } from '@poap-xyz/drops';
import { PoapCompass, PoapDropApi } from '@poap-xyz/providers';
const client = new DropsClient(
new PoapCompass('you_api_key'),
new PoapDropApi('your_api_key'),
);
```
## Documentation
For more detailed documentation, please visit [this link](https://documentation.poap.tech/docs).
## Examples
For example scripts and usage, please check the [examples](https://github.com/poap-xyz/poap.js/tree/main/examples).
## Contributing
We welcome contributions! Please see the `CONTRIBUTING.md` file for guidelines.
## License
@poap-xyz/drops is released under the [MIT License](https://opensource.org/licenses/MIT).

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