npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pariette/sdk

v1.3.0

Published

Pariette Platform SDK — Multi-tenant headless CMS, E-Commerce & SaaS API client for Node.js and browsers

Readme

@pariette/sdk

Pariette Platform için resmi TypeScript/JavaScript SDK. Multi-tenant headless CMS, e-ticaret ve SaaS entegrasyonunu tek pakette sunar.

npm version License: MIT


Kurulum

npm install @pariette/sdk
# veya
pnpm add @pariette/sdk
# veya
yarn add @pariette/sdk

Hızlı Başlangıç

import { Pariette } from '@pariette/sdk'

const pariette = new Pariette({
  mode: 'production',      // 'production' | 'test'
  token: 'ENV_TOKEN',      // Environment (ParietteToken) token
  locale: 'tr',            // Opsiyonel: 'tr' | 'en' | 'de' | 'fr'
})

API URL'leri sabittir:

  • Production: https://live.pariette.com
  • Test: https://dev.pariette.com

Kimlik Doğrulama

// Giriş — JWT token otomatik set edilir
const { access_token, user } = await pariette.auth.login({
  email: '[email protected]',
  password: 'password123',
})

// Token'i manuel set et (örneğin cookie/localStorage'dan restore)
pariette.setAuthToken(access_token)

// Console (panel) işlemleri için environment token gerekir
pariette.setConsoleToken(environment.token)

// Misafir sepet işlemleri için guest session ID
pariette.setGuestId(sessionStorage.getItem('guest_id'))

// Dil değiştir
pariette.setLocale('en')

// Mevcut kullanıcı
const me = await pariette.auth.me()

// Çıkış
await pariette.auth.logout()

2FA

// Kurulum (QR kodu döner)
const setup = await pariette.auth.twoFactorSetup()
// Onay
await pariette.auth.twoFactorConfirm({ code: '123456' })
// Giriş (temp_token akışı)
const result = await pariette.auth.twoFactorVerify({ code: '123456', temp_token: '...' })

Canvas (Headless CMS)

// Sayfa listesi
const pages = await pariette.canvas.list({ page: 1, per_page: 10 })

// Public sayfa (slug ile)
const about = await pariette.canvas.getPublic('about-us')

// Tip filtresi ile
const blogs = await pariette.canvas.listPublic({ type: 'blog', status: 1 })

// Oluştur / güncelle / sil
await pariette.canvas.create({ title: 'Blog', type: 'blog', status: 1 })
await pariette.canvas.update('blog', { title: 'Blog Güncel' })
await pariette.canvas.delete(123)

// Galeri & metrikler
await pariette.canvas.addGallery({ canvas_id: 123, image_id: 456 })
const metrics = await pariette.canvas.getMetrics(123)

Ürünler (Products)

// Public liste / detay
const products = await pariette.products.listPublic({ page: 1, per_page: 20 })
const product  = await pariette.products.get('kirmizi-ayakkabi')

// Oluştur (boyut + stok alanları dahil)
await pariette.products.create({
  title: 'Kırmızı Ayakkabı',
  price: 299.90,
  stock: 50,
  weight: 0.8,   // kg
  width: 30,     // cm — desi: (30×15×20)/3000 = 3 desi
  height: 15,
  depth: 20,
})

// Varyant / fiyat / medya / lokalizasyon
await pariette.products.setVariants(productId, [
  { title: 'S', sku: 'SKU-S', price: 299.90 },
  { title: 'M', sku: 'SKU-M', price: 299.90 },
])

// Stok
const stock = await pariette.stock.getProductStock(productId)
await pariette.stock.updateProductStock(productId, 100)

Sepet & Checkout (E-Ticaret)

// Misafir desteği: setGuestId ile session ID set et
pariette.setGuestId('uuid-session')

// Sepet CRUD
const basket = await pariette.cart.get()
await pariette.cart.add({ product_id: 1, quantity: 2 })
await pariette.cart.updateItem(itemId, 3)
await pariette.cart.removeItem(itemId)
await pariette.cart.clear()

// Kupon önizleme
const preview = await pariette.cart.applyCoupon('YAZA10', basket.data.id)
// preview.data.discount_amount, .free_shipping, .new_total

// Checkout seçenekleri (kargo + ödeme yöntemleri)
const options = await pariette.cart.checkoutOptions()

// Siparişi tamamla
const order = await pariette.cart.checkout({
  basket_id: basket.data.id,
  payment_method: 'stripe',
  carrier_id: 1,
  coupon_code: 'YAZA10',
  shipping_address: {
    name: 'Ahmet', country: 'TR', city: 'İstanbul',
    address_detail: 'Örnek Mah. No:1',
  },
})

Siparişler (Orders)

Satıcı Paneli

pariette.setConsoleToken(env.token)  // zorunlu

const orders = await pariette.orders.list({ status: 'pending' })
const stats  = await pariette.orders.stats()

// Durum güncelle
await pariette.orders.updateStatus(orderId, { status: 'confirmed', note: 'Onaylandı' })

// Kargo bilgisi
await pariette.orders.updateShipping(orderId, {
  carrier_id: 1,
  tracking_number: 'TK123456789',
})

// Mesaj
await pariette.orders.sendMessage(orderId, 'Siparişiniz kargoya verildi.')

// Kısmi iade (ürün bazlı) → sipariş `partially_refunded` olur
await pariette.orders.refund(orderId, {
  items: [{ product_id: 42, quantity: 1, amount: 150 }],
  reason: 'Müşteri talebi',
  restock_item: true,
})

// Tam iade
await pariette.orders.refund(orderId, { amount: 299.90, reason: 'Hasarlı ürün' })

Müşteri

const myOrders = await pariette.myOrders.list()
await pariette.myOrders.cancel(orderId, 'Yanlış beden seçtim')
await pariette.myOrders.sendMessage(orderId, 'Ne zaman gelir?')

Kuponlar (Coupons)

// Liste / Oluştur / Güncelle / Sil (panel)
const coupons = await pariette.coupons.list()

await pariette.coupons.create({
  code: 'YAZA20',
  type: 'percentage',   // 'percentage' | 'fixed' | 'free_shipping'
  value: 20,
  usage_limit: 100,
  expires_at: '2026-08-31T23:59:59',
})

await pariette.coupons.update(couponId, { is_active: false })
await pariette.coupons.delete(couponId)

Kargo Firmaları (Carriers)

const carriers       = await pariette.carriers.list()        // panel
const publicCarriers = await pariette.carriers.publicList()  // checkout için

await pariette.carriers.create({
  name: 'Yurtiçi Kargo',
  pricing_type: 'per_desi',  // 'fixed' | 'per_desi' | 'per_kg'
  base_price: 25,
  per_unit_price: 2.5,
  free_shipping_threshold: 500,
})

Ödeme Yöntemleri (Payment Gateways)

const providers = await pariette.paymentGateways.providers()
const gateways  = await pariette.paymentGateways.list()

await pariette.paymentGateways.create({
  provider: 'stripe',
  label: 'Kredi Kartı',
  is_active: true,
  is_default: true,
})

Abonelikler (Subscriptions)

// Fiyat hesapla (KDV dahil)
const pricing = await pariette.subscriptions.calculatePricing({
  plan_id: 2,
  plan: 'annual',  // 'annual' | 'monthly'
  country: 'TR',
})

// Abone ol
await pariette.subscriptions.subscribe({
  plan_id: 2,
  plan: 'annual',
  payment_method: 'stripe',
})

// Fatura profilleri
await pariette.subscriptions.billingProfiles.create({
  name: 'Ahmet Yılmaz',
  company_name: 'Şirket A.Ş.',
  tax_number: '1234567890',
  country: 'TR',
})

Medya & Depolama (Storage)

// Tek resim
const image = await pariette.storage.uploadImage(file)

// Toplu yükle (WebP + sıkıştırma)
const images = await pariette.storage.uploadImages(files, {
  convert: 'webp',
  quality: 85,
  compress: 'tinypng',
  canvas_id: 123,   // Otomatik bağla
})

// Galeriler
await pariette.storage.galleries.create({ title: 'Yaz Koleksiyonu' })
await pariette.storage.galleries.addImage({ gallery_id: 1, image_id: 456 })

Kullanıcı Adresleri

const addresses = await pariette.users.addresses.list()

await pariette.users.addresses.create({
  title: 'Ev', name: 'Ahmet Yılmaz',
  address_line_1: 'Örnek Mah. No:1',
  city: 'İstanbul', postal_code: '34000', country: 'TR',
  is_default: true,
})

Koleksiyonlar (Collections)

// Kategori → içerikler
const cat  = await pariette.collections.getCategory('haberler')
const news = await pariette.collections.getItems(cat.data.id, { type: 'news', paginate: 10 })

// Ürün kategorisi → ürünler
const pcat     = await pariette.collections.getCategory('bebek-arabalari', 'productCategory')
const products = await pariette.collections.getProducts(pcat.data.id, { paginate: 20 })
const featured = await pariette.collections.getFeaturedProducts(pcat.data.id)

// Tüm kategoriler
const allCats = await pariette.collections.listCategories()
const allPCats = await pariette.collections.listProductCategories()

Navigasyon

const navs = await pariette.navigation.list()
await pariette.navigation.links.create({ navigation_id: 1, title: 'Ana Sayfa', url: '/', order: 0 })
await pariette.navigation.links.reorder([
  { id: 1, order: 0 },
  { id: 2, order: 1, parent_id: 1 },
])

Bildirimler (Notifications)

await pariette.notifications.sendEmail({ to: '[email protected]', subject: 'Test', body_html: '<p>Merhaba</p>' })
await pariette.notifications.sendSms({ to: '+905001234567', message: 'Kargoya verildi.' })
await pariette.notifications.sendPush({ title: 'Yeni sipariş', body: '3 bekliyor', user_ids: [42] })

// Destek talebi (public)
await pariette.notifications.tickets.create({
  subject: 'Sorun', message: 'Sipariş gelmedi.', name: 'Ahmet', email: '[email protected]',
})

Hata Yönetimi

import { ParietteError } from '@pariette/sdk'

try {
  await pariette.auth.login({ email: '[email protected]', password: 'wrong' })
} catch (err) {
  if (err instanceof ParietteError) {
    console.log(err.code)    // HTTP status (ör: 401, 422)
    console.log(err.message) // API mesajı
    console.log(err.errors)  // Validation: { field: string[] }
  }
}

TypeScript Tip Referansı

| Tip | Açıklama | |-----|----------| | Product | Ürün (stock, width, height, depth dahil) | | Order | Sipariş (partially_refunded status dahil) | | OrderStatus | pending \| confirmed \| processing \| shipped \| delivered \| cancelled \| refunded \| partially_refunded | | RefundRequest | İade (ürün bazlı items[] veya tutar bazlı amount) | | RefundItem | Kısmi iade kalemi | | Basket / BasketItem | Sepet modeli | | Carrier | Kargo (fixed \| per_desi \| per_kg) | | PaymentGateway | Ödeme yöntemi | | Coupon / CouponType | Kupon modeli | | CouponValidationResult | applyCoupon() dönüş tipi | | CheckoutRequest / CheckoutOptions | Checkout | | Canvas | CMS sayfa modeli | | StorageImage / StorageFile | Medya | | Navigation / NavigationLink | Navigasyon | | UserAddress | Kullanıcı adresi | | CollectionItem | Koleksiyon/kategori öğesi | | ParietteError | Hata sınıfı (code, message, errors) | | ParietteConfig | SDK yapılandırması |


Lisans

MIT © Pariette Inc.