Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Major release: 2.0 #6

Merged
merged 53 commits into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d92bedc
Restructure files
nozzlegear Sep 22, 2016
930ee04
Switch to using @types
nozzlegear Oct 27, 2016
5d86951
Add Yarn
nozzlegear Oct 27, 2016
e59f0da
Ignore dist file on compilation
nozzlegear Oct 27, 2016
9fe14d5
Do not check in built files.
nozzlegear Oct 27, 2016
a722b02
Removed gulp, use tsc and mocha-cli instead.
nozzlegear Oct 27, 2016
330f5ea
Do not distribute test files.
nozzlegear Oct 27, 2016
ab65d28
Use node 6.9
nozzlegear Oct 27, 2016
4ba1dfe
Generate declaration files.
nozzlegear Oct 27, 2016
8ecbe38
Update node-fetch and fix usage bugs.
nozzlegear Oct 27, 2016
22e0e6b
Fix formatting
nozzlegear Oct 27, 2016
dbd0cf5
[Travis-CI] Only build master branch
nozzlegear Oct 27, 2016
4f4cc70
Change exports to export default
nozzlegear Oct 27, 2016
1bdcc22
Add address model.
nozzlegear Oct 27, 2016
c8fc8f4
Restructuring interface declarations
nozzlegear Oct 27, 2016
15328e0
Finalized declaration structure.
nozzlegear Oct 28, 2016
3405b43
Add ClientDetails declarations
nozzlegear Oct 28, 2016
740e460
Add discount code declaration.
nozzlegear Oct 28, 2016
1b2c90d
Add payment details declaration
nozzlegear Oct 28, 2016
cd3b7c0
Completed Order declaration
nozzlegear Oct 28, 2016
08829a3
Added Order service
nozzlegear Oct 28, 2016
cfc8ef9
Adding tests for Orders service
nozzlegear Oct 28, 2016
cf1e478
Add typings distribution script
nozzlegear Oct 28, 2016
b45ffbf
Use installed tsc to build project
nozzlegear Oct 30, 2016
3f85699
Don't export Enums, Models and Options
nozzlegear Oct 30, 2016
7fddbf9
Finalized custom typings export
nozzlegear Oct 30, 2016
0576d93
Add fulfillment status declaration
nozzlegear Oct 31, 2016
a83b15d
Add customer declaration
nozzlegear Oct 31, 2016
edb60d5
Add transaction declaration.
nozzlegear Oct 31, 2016
98d3f68
Allow adding transactions to order creation.
nozzlegear Oct 31, 2016
2c37fa2
Create test order object.
nozzlegear Oct 31, 2016
4730ceb
Change 'fields' to a string, not string array.
nozzlegear Nov 1, 2016
4dc5f35
Add test for orders
nozzlegear Nov 1, 2016
edd9405
2.0.1-0
nozzlegear Nov 1, 2016
68a8b24
2.0.0 prerelease
nozzlegear Nov 1, 2016
024f99e
2.0.0-1
nozzlegear Nov 1, 2016
e7e7ea6
2.0.0-2
nozzlegear Nov 1, 2016
bffa465
Bugfix: increase test timeout to 30 seconds.
nozzlegear Nov 1, 2016
8b73b16
Add a .apiRateLimitReached flag
nozzlegear Nov 1, 2016
ef5cfdd
Add scripts for all test types
nozzlegear Nov 1, 2016
dd0b1c5
Added handling for 'oauth code used' errors.
nozzlegear Nov 1, 2016
9486b3a
Update readme
nozzlegear Nov 1, 2016
8ece2eb
Update readme
nozzlegear Nov 1, 2016
3e92475
Finalized the finalization of typings exports 😛
nozzlegear Nov 8, 2016
caeb77e
Bugfix: webhooks.list should use FieldOptions
nozzlegear Nov 8, 2016
081f133
Add readme when publishing to npm
nozzlegear Nov 8, 2016
8202dc9
Allow building 2.0
nozzlegear Nov 14, 2016
07b83fb
Add pauses to tests to help empty the API rate limit bucket
nozzlegear Nov 14, 2016
310268a
Only create one webhook for list and count tests
nozzlegear Nov 14, 2016
568920f
Fix prepublish command to only run when actually publishing
nozzlegear Nov 14, 2016
575523a
Add test script to travis build
nozzlegear Nov 14, 2016
7473f80
Attempt fixing tests
nozzlegear Nov 14, 2016
d9e89b7
Bump to 2.0.0
nozzlegear Nov 14, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change exports to export default
  • Loading branch information
nozzlegear committed Oct 27, 2016
commit 4f4cc708ab4977db837c42de17732d0d8b87bab5
4 changes: 3 additions & 1 deletion enums/auth_scope.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type AuthScope = (
type AuthScope = (
"read_content" |
"write_content" |
"read_themes" |
Expand All @@ -19,3 +19,5 @@ export type AuthScope = (
"read_users" |
"write_users"
);

export default AuthScope;
9 changes: 7 additions & 2 deletions enums/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
export { AuthScope } from "./auth_scope";
export { WebhookTopic } from "./webhook_topic";
import AuthScope from "./auth_scope";
import WebhookTopic from "./webhook_topic";

export {
AuthScope,
WebhookTopic
}
6 changes: 4 additions & 2 deletions enums/webhook_topic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type WebhookTopic = (
type WebhookTopic = (
"orders/create" |
"orders/delete" |
"orders/updated" |
Expand Down Expand Up @@ -34,4 +34,6 @@ export type WebhookTopic = (
"disputes/update" |
"app/uninstalled" |
"themes/publish"
)
)

export default WebhookTopic;
8 changes: 5 additions & 3 deletions infrastructure/base_service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import uri = require("jsuri");
import fetch from "node-fetch";
import { resolve } from "path";
import { ShopifyError } from "./shopify_error";
import ShopifyError from "./shopify_error";

//Get package.json from 2-levels up as this file will be in dist/infrastructure.
const version = require(resolve(__dirname, "../../package.json")).version;

export class BaseService {
class BaseService {
constructor(private shopDomain: string, private accessToken: string, private resource: string) {
//Ensure resource starts with admin/
if (! /^[\/]?admin\//ig.test(resource)) {
Expand Down Expand Up @@ -74,4 +74,6 @@ export class BaseService {

return rootElement ? json[rootElement] as T : json as T;
}
}
}

export default BaseService;
8 changes: 5 additions & 3 deletions infrastructure/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { BaseService } from "./base_service";
export { ShopifyError } from "./shopify_error";
export { ShopifyObject } from "./shopify_object";
import BaseService from "./base_service";
import ShopifyError from "./shopify_error";
import ShopifyObject from "./shopify_object";

export { BaseService, ShopifyError, ShopifyObject };
8 changes: 5 additions & 3 deletions infrastructure/shopify_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Response as Response } from "node-fetch";
import { Response } from "node-fetch";

export class ShopifyError extends Error {
class ShopifyError extends Error {
constructor(response: Response, public body: { errors: string | { [index: string]: string | string[] } }) {
super();

Expand Down Expand Up @@ -41,4 +41,6 @@ export class ShopifyError extends Error {
public statusText: string;

public errors: { [index: string]: string[] } = {};
}
}

export default ShopifyError;
6 changes: 4 additions & 2 deletions infrastructure/shopify_object.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export interface ShopifyObject {
interface ShopifyObject {
/**
* The object's id.
*/
id?: number;
}
}

export default ShopifyObject;
6 changes: 4 additions & 2 deletions models/charge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ShopifyObject } from "../infrastructure";
/**
* Represents a one-time application charge.
*/
export interface Charge extends ShopifyObject {
interface Charge extends ShopifyObject {
/**
* The URL that the customer should be sent to, to accept or decline the application charge.
*/
Expand Down Expand Up @@ -43,4 +43,6 @@ export interface Charge extends ShopifyObject {
* The date and time when the recurring application charge was last updated.
*/
updated_at?: string;
}
}

export default Charge;
23 changes: 17 additions & 6 deletions models/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
export { Shop } from "./shop";
export { Order } from "./order";
export { Charge } from "./charge";
export { Webhook } from "./webhook";
export { ScriptTag } from "./script_tag";
export { UsageCharge } from "./usage_charge";
import Shop from "./shop";
import Order from "./order";
import Charge from "./charge";
import Address from "./address";
import Webhook from "./webhook";
import ScriptTag from "./script_tag";
import UsageCharge from "./usage_charge";

export {
Shop,
Order,
Charge,
Address,
Webhook,
ScriptTag,
UsageCharge
}
7 changes: 5 additions & 2 deletions models/order.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Address from "./address";
import { ShopifyObject } from "../infrastructure";

export interface Order extends ShopifyObject {
interface Order extends ShopifyObject {
/// The mailing address associated with the payment method. This address is an optional field that will not be available on orders that do not require one.
billing_address?: Address;

Expand Down Expand Up @@ -136,4 +137,6 @@ export interface Order extends ShopifyObject {

/// The date and time when the order was last modified.
updated_at?: string;
}
}

export default Order;
6 changes: 4 additions & 2 deletions models/script_tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ShopifyObject } from "../infrastructure";
/**
* An entity representing a Shopify script tag.
*/
export interface ScriptTag extends ShopifyObject {
interface ScriptTag extends ShopifyObject {
/**
* The date and time the script tag was created.
*/
Expand All @@ -23,4 +23,6 @@ export interface ScriptTag extends ShopifyObject {
* The date and time the script tag was updated.
*/
updated_at?: string;
}
}

export default ScriptTag;
6 changes: 4 additions & 2 deletions models/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ShopifyObject } from "../infrastructure";
/**
* Represents a Shopify shop.
*/
export interface Shop extends ShopifyObject {
interface Shop extends ShopifyObject {
/**
* The shop's street address.
*/
Expand Down Expand Up @@ -193,4 +193,6 @@ export interface Shop extends ShopifyObject {
* Indicates whether the shop has any outstanding setup steps or not.
*/
setup_required?: boolean;
}
}

export default Shop;
6 changes: 4 additions & 2 deletions models/usage_charge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ShopifyObject } from "../infrastructure";
/**
* Represents a usage charge, a variable monthly fee for an app or a service.
*/
export interface UsageCharge extends ShopifyObject {
interface UsageCharge extends ShopifyObject {
/**
* The date and time when the usage charge was created.
*/
Expand All @@ -28,4 +28,6 @@ export interface UsageCharge extends ShopifyObject {
* The date and time when the usage charge was last updated.
*/
updated_at?: string;
}
}

export default UsageCharge;
6 changes: 4 additions & 2 deletions models/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ShopifyObject } from "../infrastructure";
/**
* An entity representing a Shopify webhook.
*/
export interface Webhook extends ShopifyObject {
interface Webhook extends ShopifyObject {
/**
* The URL where the webhook should send the POST request when the event occurs.
*/
Expand Down Expand Up @@ -39,4 +39,6 @@ export interface Webhook extends ShopifyObject {
* The date and time when the webhook was updated.
*/
updated_at?: string;
}
}

export default Webhook;
8 changes: 8 additions & 0 deletions options/field_options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
interface FieldOptions {
/**
* Restricts the result to only the fields specified.
*/
fields?: string[];
}

export default FieldOptions;
55 changes: 10 additions & 45 deletions options/index.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,11 @@
export { WebhookOptions } from "./webhooks";
export { ScriptTagOptions } from "./script_tags";

export interface FieldOptions {
/**
* Restricts the result to only the fields specified.
*/
fields?: string[];
}

export interface ListOptions extends FieldOptions {
/**
* Retrieve only objects that were created after the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
created_at_min?: string;

/**
* Retrieve only objects that were created before the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
created_at_max?: string;

/**
* The maximum number of objects that should be returned, up to 250. Setting this parameter above 250 will result in an error.
*/
limit?: number;

/**
* The page number of the result list to retrieve. Use this in tandem with limit to page through the webhooks in a shop.
*/
page?: number;

/**
* Restricts results to those created after the given id.
*/
since_id?: number;

/**
* Retrieve only objects that were created after the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
updated_at_min?: string;

/**
* Retrieve only objects that were created before the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
updated_at_max?: string;
import WebhookOptions from "./webhooks";
import ListOptions from "./list_options";
import FieldOptions from "./field_options";
import ScriptTagOptions from "./script_tags";

export {
WebhookOptions,
ScriptTagOptions,
FieldOptions,
ListOptions,
}
40 changes: 40 additions & 0 deletions options/list_options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import FieldOptions from "./field_options";

interface ListOptions extends FieldOptions {
/**
* Retrieve only objects that were created after the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
created_at_min?: string;

/**
* Retrieve only objects that were created before the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
created_at_max?: string;

/**
* The maximum number of objects that should be returned, up to 250. Setting this parameter above 250 will result in an error.
*/
limit?: number;

/**
* The page number of the result list to retrieve. Use this in tandem with limit to page through the webhooks in a shop.
*/
page?: number;

/**
* Restricts results to those created after the given id.
*/
since_id?: number;

/**
* Retrieve only objects that were created after the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
updated_at_min?: string;

/**
* Retrieve only objects that were created before the given date and time (format: 2014-04-25T16:15:47-04:00).
*/
updated_at_max?: string;
}

export default ListOptions;
6 changes: 4 additions & 2 deletions options/script_tags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export interface ScriptTagOptions {
interface ScriptTagOptions {
/**
* Filters the result to script tags with the given src.
*/
src?: string;
}
}

export default ScriptTagOptions;
8 changes: 5 additions & 3 deletions options/webhooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { WebhookTopic } from "../enums";
import WebhookTopic from "../enums/webhook_topic";

export interface WebhookOptions {
interface WebhookOptions {
/**
* Retrieve only webhooks that possess the URI where the webhook sends the POST request when the event occurs.
*/
Expand All @@ -10,4 +10,6 @@ export interface WebhookOptions {
* Retrieve only webhooks with a given topic.
*/
topic?: WebhookTopic;
}
}

export default WebhookOptions;
Loading