Skip to content

Commit b973d29

Browse files
authored
feat(sdk): add x-pd-sdk-version, triggerDeploy (1.0.9) (#14836)
1 parent 3ecb4ed commit b973d29

21 files changed

+163
-33
lines changed

.github/workflows/pipedream-sdk-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Set up Node.js
3737
uses: actions/setup-node@v3
3838
with:
39-
node-version: '18'
39+
node-version: '22'
4040

4141
- name: Install dependencies
4242
run: pnpm install

eslint.config.mjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import jsonc from "eslint-plugin-jsonc";
22
import putout from "eslint-plugin-putout";
33
import pipedream from "eslint-plugin-pipedream";
44
import typescriptEslint from "@typescript-eslint/eslint-plugin";
5+
import importPlugin from "eslint-plugin-import";
56
import jest from "eslint-plugin-jest";
67
import globals from "globals";
78
import parser from "jsonc-eslint-parser";
@@ -52,6 +53,7 @@ export default [
5253
pipedream,
5354
"@typescript-eslint": typescriptEslint,
5455
jest,
56+
"import": importPlugin,
5557
},
5658

5759
languageOptions: {
@@ -313,4 +315,17 @@ export default [
313315
"react/react-in-jsx-scope": "off",
314316
},
315317
},
318+
{
319+
files: [
320+
"packages/sdk/src/browser/**/*.ts",
321+
"packages/sdk/src/shared/**/*.ts",
322+
],
323+
324+
rules: {
325+
"import/extensions": [
326+
"error",
327+
"always",
328+
],
329+
},
330+
},
316331
];

jest.config.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ module.exports = {
44
testEnvironment: "node",
55
// See https://kulshekhar.github.io/ts-jest/docs/guides/esm-support
66
extensionsToTreatAsEsm: [
7+
".js",
78
".ts",
89
".mts",
910
],
10-
globals: {
11-
"ts-jest": {
12-
useESM: true,
13-
},
14-
},
1511
moduleNameMapper: {
16-
"^(\\.{1,2}/.*)\\.js$": "$1",
12+
"^(.+)\\.js$": "$1",
1713
},
1814
testPathIgnorePatterns: [
1915
"types/.*.types.test..*$",
2016
],
17+
transform: {
18+
"\\.[jt]s$": [
19+
"ts-jest",
20+
{
21+
"useESM": true,
22+
},
23+
],
24+
},
2125
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@typescript-eslint/parser": "^8",
4747
"eslint": "^8",
4848
"eslint-config-next": "^15",
49+
"eslint-plugin-import": "^2.31.0",
4950
"eslint-plugin-jest": "^28",
5051
"eslint-plugin-jsonc": "^1.6.0",
5152
"eslint-plugin-pipedream": "0.2.4",

packages/sdk/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<!-- markdownlint-disable MD024 -->
22
# Changelog
33

4+
## [1.0.9] - 2024-12-04
5+
6+
### Added
7+
8+
- `triggerDeploy` preview API
9+
- `client.version` and `x-pd-sdk-version` header
10+
411
## [1.0.8] - 2024-11-29
512

613
### Changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
default:
2+
make -j2 server delayed-open
3+
4+
server:
5+
cd ../.. && python -m http.server
6+
7+
delayed-open:
8+
sleep 1 && xdg-open http://localhost:8000/examples/browser/index.html
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<h1>Load SDK in browser</h1>
5+
<script type="importmap">
6+
{
7+
"imports": {
8+
"@rails/actioncable": "/node_modules/@rails/actioncable/app/assets/javascripts/actioncable.esm.js"
9+
}
10+
}
11+
</script>
12+
<script type="module">
13+
import { createFrontendClient } from "/dist/browser/browser/index.js"
14+
const client = createFrontendClient()
15+
const p = document.createElement("p")
16+
p.textContent = "sdk version: " + client.version
17+
document.body.appendChild(p)
18+
</script>
19+
</body>
20+
</html>

packages/sdk/examples/server/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
default:
2+
@node index.mjs
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createBackendClient } from "../../dist/server/server/index.js";
2+
3+
const client = createBackendClient({
4+
environment: "development",
5+
credentials: {
6+
clientId: "not-empty",
7+
clientSecret: "not-empty",
8+
},
9+
});
10+
console.log("sdk version: " + client.version);

packages/sdk/jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ module.exports = {
1515
"ts",
1616
"js",
1717
],
18+
moduleNameMapper: {
19+
"^(.+)\\.js$": "$1",
20+
},
1821
transform: {
1922
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
2023
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
21-
"^.+\\.tsx?$": [
24+
"^.+\\.[jt]sx?$": [
2225
"ts-jest",
2326
{
2427
tsconfig: "tsconfig.node.json",

0 commit comments

Comments
 (0)