New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

typed-chrome-webstore-api

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-chrome-webstore-api - npm Package Compare versions

Comparing version 0.3.7 to 0.4.7

dist/itemErrorEntry.d.ts

92

dist/consts.d.ts

@@ -11,2 +11,5 @@ export declare enum PublishTarget {

publishPost: (id: string, target: string) => string;
licensesGet: (appId: string, userId: string) => string;
userLicensesGet: (appId: string) => string;
paymentsGet: (id: string) => string;
};

@@ -73,1 +76,90 @@ export declare enum UploadState {

}
export declare const enum LicenseAccessLevelEnum {
FREE_TRIAL = "FREE_TRIAL",
FULL = "FULL"
}
/**
* @see https://developer.chrome.com/webstore/webstore_api/licenses#resource
*/
export interface ILicensesResponse {
/**
* Identifies this resource as a license. Value: the fixed string
*/
kind: 'chromewebstore#license';
/**
* This value is a concatenation of the appId and userId seperated by a forward slash, for example: ekjjfhlnedeokeakcddlnockkdiacakf/8098347.
*/
id: string;
/**
* Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
*/
appId: string;
/**
* OpenID URL for the user's Google Account.
*/
userId: string;
result: 'YES' | 'NO';
accessLevel: LicenseAccessLevelEnum;
/**
* Once you've got the response, cache is only valid for the max number of seconds.
*/
maxAgeSecs: number;
}
/**
* @see https://developer.chrome.com/webstore/webstore_api/userLicenses#resource
*/
export interface IUserLicensesResponse {
/**
* Identifies this resource as a license. Value: the fixed string
*/
kind: 'chromewebstore#userLicense.';
/**
* The ID of the item to query for in-app products.
*/
itemId: string;
/**
* Creation time of license. Number of milliseconds.
*/
createdTime: number;
/**
* TRUE = User has license. FALSE = User does not have license.
*/
result: boolean;
accessLevel: LicenseAccessLevelEnum;
/**
* Time that results can be cached.
*/
maxAgeSecs: number;
}
export declare const enum PaymentStateEnum {
ACTIVE = "ACTIVE",
PAYMENT_DECLINED = "PAYMENT_DECLINED",
EXPIRED = "EXPIRED",
CANCELLED = "CANCELLED",
REJECTED = "REJECTED",
PENDING = "PENDING",
CANCELLED_BY_DEVELOPER = "CANCELLED_BY_DEVELOPER",
DISABLED = "DISABLED"
}
/**
* @see https://developer.chrome.com/webstore/webstore_api/payments#resource
*/
export interface IPaymentsResponse {
/**
* Static string value is always "chromewebstore#payment".
*/
kind: 'chromewebstore#payment';
/**
* The ID of the item to query for in-app products.
*/
itemId: string;
/**
* The in-app product ID.
*/
sku: string;
/**
* Time of the creation of the payment.
*/
createdTime: number;
state: PaymentStateEnum;
}

@@ -28,2 +28,11 @@ "use strict";

},
licensesGet: (appId, userId) => {
return `${GOOGLE_APIS_URL}/licenses/${encodeURIComponent(appId)}/${encodeURIComponent(userId)}`;
},
userLicensesGet: (appId) => {
return `${GOOGLE_APIS_URL}/${ITEMS_API}/userlicenses/${encodeURIComponent(appId)}`;
},
paymentsGet: (id) => {
return `${GOOGLE_APIS_URL}/${ITEMS_API}/items/${encodeURIComponent(id)}/payments`;
},
};

@@ -30,0 +39,0 @@ var UploadState;

2

dist/downloadCrx.js

@@ -68,3 +68,3 @@ "use strict";

responseType: 'stream',
validateStatus: status => status === 200
validateStatus: status => status === 200,
});

@@ -71,0 +71,0 @@ return response.data;

export { fetchToken } from './authApi';
export { PublishTarget, IWebstoreResource, IPublishResponse, PublishStatus, UploadState, IItemErrorEntry } from './consts';
export { PublishTarget, IWebstoreResource, IPublishResponse, PublishStatus, UploadState, IItemErrorEntry, ILicensesResponse, IPaymentsResponse, IUserLicensesResponse, LicenseAccessLevelEnum, PaymentStateEnum, } from './consts';
export { WebstoreApi } from './webstoreApi';
export * from './downloadCrx';

@@ -5,2 +5,3 @@ /// <reference types="node" />

import * as consts from './consts';
import { ILicensesResponse, IPaymentsResponse, IUserLicensesResponse } from './consts';
export declare class WebstoreApi {

@@ -14,2 +15,18 @@ protected _token: string;

publish(appId: string, target?: consts.PublishTarget | string): Promise<consts.IPublishResponse>;
/**
* Gets the licenses for Chrome hosted apps.
* @param appId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
* @param userId OpenID URL for the user's Google Account.
*/
getLicenses(appId: string, userId: string): Promise<ILicensesResponse>;
/**
* Gets the user licenses for Chrome Apps and Chrome Extensions.
* @param appId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
*/
getUserLicenses(appId: string): Promise<IUserLicensesResponse>;
/**
* Lists the in-app products that the user has purchased.
* @param itemId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
*/
getPayments(itemId: string): Promise<IPaymentsResponse>;
protected getHeaders(): {

@@ -16,0 +33,0 @@ [k: string]: string;

@@ -28,2 +28,3 @@ "use strict";

const consts = __importStar(require("./consts"));
const webstoreResource_1 = require("./webstoreResource");
// noinspection JSUnusedGlobalSymbols

@@ -47,5 +48,5 @@ class WebstoreApi {

responseType: 'json',
data: readStream
data: readStream,
});
return result.data;
return new webstoreResource_1.WebstoreResource(result.data);
}

@@ -58,3 +59,3 @@ // noinspection JSUnusedGlobalSymbols

});
return result.data;
return new webstoreResource_1.WebstoreResource(result.data);
}

@@ -65,9 +66,36 @@ // noinspection JSUnusedGlobalSymbols

responseType: 'json',
headers: this.getHeaders()
headers: this.getHeaders(),
});
return result.data;
}
// noinspection JSUnusedGlobalSymbols
/**
* Gets the licenses for Chrome hosted apps.
* @param appId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
* @param userId OpenID URL for the user's Google Account.
*/
async getLicenses(appId, userId) {
const result = await this._client.get(consts.urls.licensesGet(appId, userId));
return result.data;
}
// noinspection JSUnusedGlobalSymbols
/**
* Gets the user licenses for Chrome Apps and Chrome Extensions.
* @param appId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
*/
async getUserLicenses(appId) {
const result = await this._client.get(consts.urls.userLicensesGet(appId));
return result.data;
}
/**
* Lists the in-app products that the user has purchased.
* @param itemId Chrome Web Store app ID. Get the app ID from the Chrome Developer Dashboard after you upload your app for the first time.
*/
async getPayments(itemId) {
const result = await this._client.get(consts.urls.paymentsGet(itemId));
return result.data;
}
getHeaders() {
return {
'Authorization': `Bearer ${this._token}`,
Authorization: `Bearer ${this._token}`,
'x-goog-api-version': '2',

@@ -74,0 +102,0 @@ };

{
"name": "typed-chrome-webstore-api",
"version": "0.3.7",
"version": "0.4.7",
"description": "Typed Chrome Webstore API to upload/publish extensions",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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