From e5545e729bb7b6c76816800e9d39ccdd21b147fa Mon Sep 17 00:00:00 2001 From: "Andrew Stiegmann (stieg)" Date: Thu, 18 Jan 2018 15:56:13 -1000 Subject: [PATCH 001/180] Add `usePushEach` flag to Mongoose Schema Options In order for devs to be able to work around the issues described in https://github.com/Automattic/mongoose/issues/5574 we need to be able to supply the `usePushEach` flag to the Mongoose SchemaOptions. This options functionality is described in https://github.com/Automattic/mongoose/issues/4455 and is required for anyone who modifies arrays inline who is using Mongoose 4 and MongoDB 3.6+ Testing: Copied changes to local project and verified compilation worked. --- types/mongoose/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 3e676b499f..ee703de783 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -815,6 +815,8 @@ declare module "mongoose" { typeKey?: string; /** defaults to false */ useNestedStrict?: boolean; + /** defaults to false */ + usePushEach?: boolean; /** defaults to true */ validateBeforeSave?: boolean; /** defaults to "__v" */ From deec9e9fe81adc0f2becb83c103cc17efacdd357 Mon Sep 17 00:00:00 2001 From: JounQin Date: Sun, 3 Jun 2018 13:55:20 +0800 Subject: [PATCH 002/180] [zen-observable] add `readonly` modifier https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/index.d.ts#L167 --- types/zen-observable/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/zen-observable/index.d.ts b/types/zen-observable/index.d.ts index f73964d026..bcf02e8f8a 100644 --- a/types/zen-observable/index.d.ts +++ b/types/zen-observable/index.d.ts @@ -1,11 +1,12 @@ // Type definitions for zen-observable 0.5 // Project: https://github.com/zenparsing/zen-observable // Definitions by: Kombu +// JounQin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare global { interface SymbolConstructor { - observable: symbol; + readonly observable: symbol; } namespace ZenObservable { From 770fb31e5672d5961c30f637cdf9e4b839c3a19f Mon Sep 17 00:00:00 2001 From: Triforce Date: Sun, 3 Jun 2018 09:07:41 -0400 Subject: [PATCH 003/180] Updated ShopifyBuy Types to match v1, removed classes that seemed less required now and changed it to reflect only interfaces, and one namespace --- types/shopify-buy/index.d.ts | 758 +++++++++++++++-------------------- 1 file changed, 331 insertions(+), 427 deletions(-) diff --git a/types/shopify-buy/index.d.ts b/types/shopify-buy/index.d.ts index d055cd671f..664b5a38a8 100644 --- a/types/shopify-buy/index.d.ts +++ b/types/shopify-buy/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for shopify-buy 0.4.2 +// Type definitions for shopify-buy v1.0.0 // Project: http://shopify.github.io/js-buy-sdk/api/ -// Definitions by: Martin Köhn +// Definitions for 0.4.2 by: Martin Köhn +// Definitions update by: Stephen Traiforos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.7.* /** * The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. @@ -12,441 +13,344 @@ * website or javascript application. This is helpful if you already have a website and need to add ecommerce * or only need a simple buy button on your site. */ + declare namespace ShopifyBuy { - /** - * Create a ShopClient. This is the main entry point to the SDK. - */ - export function buildClient(configAttrs: Shopify.Config): Shopify.ShopClient + export function buildClient(config: ShopifyBuy.Config): Client; + + export interface Client { + product: ShopifyBuy.ProductAPI; + collection: ShopifyBuy.CollectionAPI; + checkout: ShopifyBuy.CheckoutAPI; + } + export interface Config { + domain: string; + storefrontAccessToken: string; + } + + export interface ProductAPI { + fetch(id: string): Promise; + fetchQuery(id: Query): Promise; + fetchAll(): Promise; + } + + export interface CollectionAPI { + fetch(id: string): Promise; + fetchWithProducts(id: string): Promise; // TODO fix to be a type + } + + export interface CheckoutAPI { + /** + * Remove all line items from cart + */ + clearLineItems(): Promise; + + /** + * Add items to cart. Updates cart's lineItems + */ + addVariants(item: Item, nextItem?: Array): Promise; + + /** + * Add items to the cart. Updates cart's lineItems based on variants passed in. + */ + createLineItemsFromVariants(...items: Item[]): Promise; + + /** + * Remove a line item from cart based on line item id + */ + removeLineItem(id: string): Promise; + + /** + * Update a line item quantity based on line item id + */ + updateLineItem(id: string, quantitiy: number): Promise; + + /** + * Force update of cart model on server. This function will only be used in advanced + * situations and does not need to be called explicitly to update line items. + * It is automatically called after createLineItemsFromVariants, updateLineItem, + * removeLineItem, and removeLineItem + */ + updateModel(): Promise; + } + + export interface Query { + query: string; + sortBy: string; + after?: string; + before?: string; + first?: string; + last?: string; + reverse?: boolean; + } + + export interface Product { + /** + * A product description. + */ + description: string; + + /** + * Product unique ID + */ + id: string | number; + + /** + * An Array of Objects that contain meta data about an image including src of the images. + */ + images: Array; + + /** + * All variants of a product. + */ + variants: Array; + + /** + * Get an array of Product Options. Product Options can be used to define + * the currently selectedVariant from which you can get a checkout url (ProductVariant.checkoutUrl) + * or can be added to a cart (Cart.createLineItemsFromVariants). + */ + options: Array