Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Export TS typings for ExpoPush* #33

Closed
wants to merge 68 commits into from
Closed

chore: Export TS typings for ExpoPush* #33

wants to merge 68 commits into from

Conversation

amaury1093
Copy link

I actually found the need to these subtypes in my own project, so I would propose to expose them in the package.

expbot and others added 30 commits September 22, 2016 04:47
fbshipit-source-id: 92eb9bd9c43d6350885f257be54a40b56e78d5d4
fbshipit-source-id: b00b625
fbshipit-source-id: 575637c
fbshipit-source-id: 22ce158
.gitignore was blocking the lib files from making their way to npm

fbshipit-source-id: 83d8b12
- Made it class-based, since we'll probably want the constructor to take an auth token one day
- Added support for API v2
- Tested sending single and multiple push notifications

fbshipit-source-id: db08769
fbshipit-source-id: fc123e8
fbshipit-source-id: bd799fc
fbshipit-source-id: c275926
fbshipit-source-id: 45205a2
fbshipit-source-id: 9a7a5ac
Compressed push notification requests larger than 1KiB. The server (via koa-body) already supports decompression!

Added one simple Jest test for good measure.

fbshipit-source-id: d67644e
fbshipit-source-id: 610db8e7
- Exponent.chunkSize can be used
- Update URL to https://expo.io
- Check brackets of exponentPushToken

Closes #2

fbshipit-source-id: b8a9473
fbshipit-source-id: 5a97fe8
fbshipit-source-id: 32b766c
fbshipit-source-id: 4471f45
We get PRs to this repo sometimes. Try adding CircleCI + Codecov support for it.

fbshipit-source-id: 4e5733a
Also fix expo-sdk CircleCI tests

fbshipit-source-id: 12033de
- this was resulting in bad errors being reported and actual errors being swallowed.

Closes #10

fbshipit-source-id: 3beeccd
Un-conflate try-clause contents by splitting the calls out.

fbshipit-source-id: 8b69a18
… CI config

- 2.3.2 has an error-handling fix for clearer errors
- Tidy up package.json
- Update Jest to 21
- Update CircleCI config to use versioned caches and no `--` for Yarn script (no longer needed)

fbshipit-source-id: 9aa626e
nicknovitski and others added 26 commits July 11, 2018 22:41
- Add annotations to two arrays
- Disable no-implicit-any option (the promise-limit package has typescript definitions with implicit anys)

fbshipit-source-id: 6d52c6a
The links are 404s right now.

Closes #19

fbshipit-source-id: 92f3a27
Push tickets may be missing IDs if the notification was not enqueued, in which case there will be no receipt and therefore no receipt ID.

fbshipit-source-id: 7949f72
Support both `import Expo from 'expo-sdk'` (works today) and `import { Expo } from 'expo-sdk'` (makes more sense for legacy require).

fbshipit-source-id: 49871e2
fbshipit-source-id: 31069c8
The following errors occur when using strict type checking:

```
yarn run v1.7.0
$ tsc
node_modules/expo-server-sdk/src/ExpoClient.ts:7:8 - error TS1192: Module '"assert"' has no default export.

7 import assert from 'assert';
         ~~~~~~

node_modules/expo-server-sdk/src/ExpoClient.ts:10:8 - error TS1192: Module '"node_modules/promise-limit/index"' has no default export.

10 import promiseLimit from 'promise-limit';
          ~~~~~~~~~~~~

node_modules/expo-server-sdk/src/ExpoClient.ts:11:8 - error TS1192: Module '"zlib"' has no default export.

11 import zlib from 'zlib';
          ~~~~

node_modules/expo-server-sdk/src/ExpoClient.ts:261:22 - error TS7006: Parameter 'error' implicitly has an 'any' type.

261     zlib.gzip(data, (error, result) => {
                         ~~~~~

node_modules/expo-server-sdk/src/ExpoClient.ts:261:29 - error TS7006: Parameter 'result' implicitly has an 'any' type.

261     zlib.gzip(data, (error, result) => {
```

Closes #20

fbshipit-source-id: 015e9f7
fbshipit-source-id: c06638b
This renames the server SDKs from exponent-server-sdk-* to expo-server-sdk-*, including the shipit configs for the Node and Rust SDKs. The Ruby SDK is community-maintained, so this commit removes Expo's internal copy of it and removes it from the shipit config as well. The docs are all updated with the latest links to the newly renamed GitHub repos.

Before landing this commit, I'll re-deploy the shipit service and apply the Terraform changes.

fbshipit-source-id: a7153cf
Bundled correct type declarations with package as referenced here - https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

Closes #22

fbshipit-source-id: 727194b
fbshipit-source-id: 7349f44
fbshipit-source-id: aa015de
To make it clear to Node n00bs like me that the code above won't work in a plain Node script.

Closes #21

fbshipit-source-id: 3653f5b
These are not required at runtime, typechecking stuff should be in devDependencies

Closes #23

fbshipit-source-id: d6644ec
I'm not sure this is indeed a typo, but I thought opening a PR would be clearer than opening an issue.

Closes #24

fbshipit-source-id: 50d79ee
Also added type for critical sound alerts that the server supports (client does not though, so the feature does not exist in a practical sense, no plans).

fbshipit-source-id: 23aa279
fbshipit-source-id: 15998e0
According to the [documentation](https://docs.expo.io/versions/latest/guides/push-notifications/#response-format), a **Push Ticket** has both an id and status field:

> Upon success, the HTTP response will be a JSON object whose data field is an array of push tickets, each of which corresponds to the message at its respective index in the request. Continuing the above example, this is what a successful response body looks like:
>
> ```
> {
>   "data": [
>     {"status": "ok", "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"},
>     {"status": "ok", "id": "YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY}
>   ]
> }
> ```

However, right now `ExpoPushTicket` only has an `id` field, so typescript throws an error (`Property 'status' does not exist on type 'ExpoPushTicket'.`) if you try to check the status. This PR fixes that.

I found the documentation a little hard to follow\*, so I'm not *sure* that these changes are totally correct, so feel free to implement your own fix or give me feedback to I can change it to be correct, if this isn't merge-able.

\*but that's not the point of this issue.

Closes #25

fbshipit-source-id: 50a9158
fbshipit-source-id: 8846a6f
…e recipients (#3631)

fbshipit-source-id: 0157aaa
fbshipit-source-id: b62f08d
Closes #27

fbshipit-source-id: 3924efd
Closes #28

fbshipit-source-id: 9aaaf4b
@expo-bot expo-bot closed this Mar 31, 2020
expo-bot pushed a commit that referenced this pull request Mar 31, 2020
I actually found the need to these subtypes in my own project, so I would propose to expose them in the package.

Closes #33

fbshipit-source-id: 500f624
@ide
Copy link
Member

ide commented Mar 31, 2020

Published in 3.5.0. Sorry the GH history above became such a mess. The actual Git history is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.