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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nodejs-itunes-api

v1.7.2

Published

Support manage app certificate, devices and provisioning-profile by nodejs

Downloads

3

Readme

Installation

  • Using npm:
npm install nodejs-itunes-api

How to use

Create instance

let privateKey = fs.readFileSync(/* file of p8 key */));
let itunes = new iTunes({
	"apiKey": "API_KEY",
	"issuerId": "ISSUER_ID",
	"privateKey": privateKey
});

Get all certificate

itunes.getAllCertificate()
	.then(function(response) {
		/* Query certificate result */
	})
	.catch(error => {
		console.error(error);
	});

Get specific type of certificate

  • Support certificate: IOS_DEVELOPMENT, IOS_DISTRIBUTION, DEVELOPMENT, DISTRIBUTION
const CertificateType = itunes.CertificateType;
itunes.getCertificate(CertificateType.DEVELOPMENT)
	.then(function(response) {
		/* Query certificate result */
	})
	.catch(error => {
		console.error(error);
	});

Register device UDID

const DEVICE_NAME = "DEVICE NAME";
const UDID = "UDID";
const DeviceType = itunes.DeviceType;

itunes.registerDevice(DEVICE_NAME, UDID, DeviceType.IOS)
	.then(function(response) {
		/* register result */
	})
	.catch(error => {
		console.error(error);
	});

Get device list

itunes.getDeviceList()
	.then(function(response) {
		/* Query device list */
	})
	.catch(error => {
		console.error(error);
	});

Create bundle id

const BUNDLE_ID_NAME = "BUNDLE_ID_NAME";
const BUNDLE_ID = "BUNDLE_ID";
const DeviceType = itunes.DeviceType;

itunes.createBundleId(BUNDLE_ID_NAME, BUNDLE_ID, DeviceType.IOS)
	.then(function(response) {
		/* Create bundle id result*/
	})
	.catch(error => {
		console.error(error);
	});

Create bundle id with capability

  • Create bundle id with single capability.
const BUNDLE_ID_NAME = "BUNDLE_ID_NAME";
const BUNDLE_ID = "BUNDLE_ID";
const DeviceType = itunes.DeviceType;
const Capability = itunes.CapabilityType;

itunes.createBundleId(BUNDLE_ID_NAME, BUNDLE_ID, DeviceType.IOS, Capability.PUSH_NOTIFICATIONS)
	.then(function(response) {
		/* Create bundle id result*/
	})
	.catch(error => {
		console.error(error);
	});
  • Create bundle id with multiple capability.
const BUNDLE_ID_NAME = "BUNDLE_ID_NAME";
const BUNDLE_ID = "BUNDLE_ID";
const DeviceType = itunes.DeviceType;
const Capability = itunes.CapabilityType;

itunes.createBundleId(BUNDLE_ID_NAME, BUNDLE_ID, DeviceType.IOS, [Capability.PUSH_NOTIFICATIONS, Capability.ICLOUD])
	.then(function(response) {
		/* Create bundle id result*/
	})
	.catch(error => {
		console.error(error);
	});

Delete bundle id

const BUNDLE_ID = "ID of Bundle-ID";

itunes.deleleBundleId(BUNDLE_ID)
	.then(function() {
		/* delete bundle-id success */
	}).catch(error => {
		console.error(error);
	});

Create profile

  • Support profile type: IOS_APP_DEVELOPMENT, IOS_APP_STORE, IOS_APP_ADHOC, IOS_APP_INHOUSE, MAC_APP_DEVELOPMENT, MAC_APP_STORE, MAC_APP_DIRECT, TVOS_APP_DEVELOPMENT, TVOS_APP_STORE, TVOS_APP_ADHOC, TVOS_APP_INHOUSE, MAC_CATALYST_APP_DEVELOPMENT, MAC_CATALYST_APP_STORE and MAC_CATALYST_APP_DIRECT
const ProfileType = itunes.ProfileType;
const CERT_ID = "CERTIFICATE_ID";
const BUNDLE_ID = "ID of Bundle-ID";
const PROFILE_NAME = "PROFILE_NAME";

itunes.getDeviceList()
	.then(function(response) {
		let deviceIdList = response.data.map(function(info) {
			return info.id;
		});

		return itunes.createProfile(PROFILE_NAME, CERT_ID, BUNDLE_ID, deviceIdList, ProfileType.IOS_APP_DEVELOPMENT)
			.then(function(response) {
				/* create profile result */
			})
			.catch(error => {
				console.error(error);
			});
	})
	.catch(error => {
		console.error(error);
	});

Delete profile

const ProfileType = itunes.ProfileType;
const CERT_ID = "CERTIFICATE_ID";
const BUNDLE_ID = "ID of Bundle-ID";
const PROFILE_NAME = "PROFILE_NAME";
itunes.getDeviceList()
	.then(function(response) {
		let deviceIdList = response.data.map(function(info) {
			return info.id;
		});

		return itunes.createProfile(PROFILE_NAME, CERT_ID, BUNDLE_ID, deviceIdList, ProfileType.IOS_APP_DEVELOPMENT);
	})
	.then(function(response) {
		let profileId = response.data.id;
		return itunes.deleteProfile(profileId);
	})
	.then(function() {
		/* delete profile success */
	})
	.catch(error => {
		console.error(error);
	});

Get Profile

let ProfileType = itunes.ProfileType;
let ProfileState = itunes.ProfileState;

itunes.getProfile(ProfileType.IOS_APP_DEVELOPMENT, ProfileState.ACTIVE)
	.then(function(result) {
		let dirPath = /* directory path */;
		for (let i = 0; i < result.data.length; i += 1) {
			let profile = result.data[i];
			let fileName = `${profile.getName()}.mobileprovision`;
			let filePath = path.join(dirPath, fileName);
			profile.save(filePath);
		}
	})
	.catch(error => {
		console.error(error);
	});

Next

  • ~~Fixed device rename by UDID~~

  • ~~Support create bundle-id~~

  • ~~Support bundle-id capabilities~~

  • ~~Support delete bundle-id~~

  • ~~Support create profile~~

  • ~~Support delete profile~~

  • Support modify profile (delete original profile and create new profile)

  • Support bundle-id filter