Skip to content

Commit 0382115

Browse files
committed
clean up and prune for og commit
0 parents  commit 0382115

30 files changed

+5752
-0
lines changed

.circleci/config.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2.1
2+
jobs:
3+
upload_pdsdk_browser:
4+
docker:
5+
# XXX lol... just use node:10 with aws-cli installed on it
6+
- image: pipedreamhq/cci-build-k8s-java
7+
steps:
8+
- checkout
9+
- run:
10+
command: |
11+
aws s3 sync javascript/dist s3://sdk.pipedream.net/
12+
workflows:
13+
version: 2
14+
default:
15+
jobs:
16+
- upload_pdsdk_browser:
17+
context: pipedream
18+
filters:
19+
branches:
20+
only:
21+
- master

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# sdk (Pipedream SDK - super alpha)
2+
3+
- [ruby](./ruby#readme)
4+
- [node (javascript)](./javascript#readme)
5+
- [browser (javascript)](./javascript/src/integrations/browser#readme)
6+
7+
## SDK behavior
8+
9+
Send events programmatically to pipedream.com.

javascript/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# sdk:node (javascript)
2+
3+
Note: for browser, see [here](./src/integrations/browser#readme).
4+
5+
Basic usage:
6+
7+
```
8+
const pdsdk = require("@pipedreamhq/sdk")
9+
10+
pdsdk.sendEvent(API_KEY, {
11+
timestamp: +new Date(),
12+
})
13+
```
14+
15+
The payload will be exported as event and raw_event. If you would like to add an
16+
export, or override the `event` export:
17+
18+
```
19+
pdsdk.sendEvent(API_KEY, {
20+
timestamp: +new Date(),
21+
raw_event: true
22+
}, {
23+
exports: {
24+
event: {
25+
timestamp: new Date().toString(),
26+
},
27+
other_export: "hello"
28+
},
29+
})
30+
```
31+
32+
If you do not provide an `event` it will be the same as `raw_event` (first argument). `raw_event` and `event` MUST be an object or
33+
the SDK request will be rejected as invalid.

javascript/build-browser-snippet.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# absolutely beautiful script
3+
4+
js=dist/snippet.js
5+
npx uglifyjs src/integrations/browser/snippet.js > $js
6+
sed -i '' 's/})();$//' $js
7+
echo -n $(cat $js) > $js
8+
echo ';' >> $js
9+
echo 'pdsdk.load();' >> $js
10+
echo '})();' >> $js
11+
12+
html=dist/snippet.html
13+
echo '<script type="text/javascript">' > $html
14+
cat $js >> $html
15+
echo '</script>' >> $html

javascript/dist/pdsdk.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascript/dist/snippet.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script type="text/javascript">
2+
(function(){var pdsdk=window.pdsdk=window.pdsdk||[];if(pdsdk.initialized)return;if(pdsdk.invoked){if(window.console&&console.error){console.error("pdsdk snippet included multiple times");return}}pdsdk.invoked=true;pdsdk.methods=["sendEvent"];pdsdk.buffered=[];pdsdk.makeBufferMethod=function(method){return function(){var args=Array.prototype.slice.call(arguments);args.unshift(method);pdsdk.buffered.push(args)}};for(var i=0;i<pdsdk.methods.length;i++){var method=pdsdk.methods[i];pdsdk[method]=pdsdk.makeBufferMethod(method)}pdsdk.load=function(src){var script=document.createElement("script");script.type="text/javascript";script.async=true;script.src=src||"https://sdk.pipedream.net/pdsdk.min.js?n="+Math.random();var first=document.getElementsByTagName("script")[0];first.parentNode.insertBefore(script,first)};pdsdk.SNIPPET_VERSION="0.0.1";
3+
pdsdk.load();
4+
})();
5+
</script>

javascript/dist/snippet.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)