Giter Club home page Giter Club logo

cloudkit-js's Introduction

CloudKit JS

CloudKit JS aims to make it easy for you to manage your CloudKit container from your Node.js server.

It's as simple as this

import { CloudKitJs } from 'cloudkit-js';

const lib = new CloudKitJs({
    containerName: "iCloud.com.your.container.name",
    keyId: "xxx",
    privateKeyPath: "eckey.pem"
})

lib.createRecord({
    recordType: "MyRecordType",
    fields: {
        name: { value: "My new record" },
        description: { value: "Wow, so easy!" }
    }
})

Getting started

This assumes you've already an active Apple Developer membership and you've got your CloudKit container set up.

1. Create a server-to-server key in CloudKit

Go to CloudKit Dashboard, open your container, and click "Tokens & Keys" on the left menu.

Add a new "Server-to-Server Key" and follow the instructions.

2. Install the library

npm install --save cloudkit-js

3. Initialise the library

import { CloudKitJs } from 'cloudkit-js';

const lib = new CloudKitJs({
    containerName: "iCloud.com.your.container.name", // Update this with your CloudKit container name
    keyId: "xxx", // Put your key ID here
    privateKeyPath: "eckey.pem" // Point to your private key file
})

The keyId and privateKeyPath are the values you got from step 1.

Your Key ID is displayed when viewing the server-to-server key on the CloudKit Dashboard.

⚠️ These are secret, so obvz don't put them in source control.

cloudkit-js's People

Contributors

danjohnson95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cloudkit-js's Issues

Thank you

You just saved me with this repo. Thank you!!

Error building project

I am able to run my project using the package, but unfortunately my code wont compile from typescript to javascript. Instead, I am getting this error message:

node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/index.d.ts:1:123 - error TS2307: Cannot find module '../index' or its corresponding type declarations.

1 import { CreateRecordOptions, DeleteRecordOptions, InitParams, QueryRecordOptions, RecordType, UpdateRecordOptions } from "../index";
                                                                                                                            ~~~~~~~~~~

node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/request.d.ts:1:30 - error TS2307: Cannot find module '../index' or its corresponding type declarations.

1 import { ISignService } from "../index";
                               ~~~~~~~~~~

node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/url.d.ts:1:61 - error TS2307: Cannot find module '../index' or its corresponding type declarations.

1 import { Database, Environment, UrlBuilderInitParams } from "../index";
                                                              ~~~~~~~~~~


Found 3 errors in 3 files.

Errors  Files
     1  node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/index.d.ts:1
     1  node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/request.d.ts:1
     1  node_modules/.pnpm/[email protected]/node_modules/cloudkit-js/dist/url.d.ts:1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.