Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "activitysmith",
"version": "0.1.0",
"version": "0.1.1",
"description": "Official ActivitySmith Node.js SDK",
"keywords": [
"activitysmith",
Expand All @@ -9,17 +9,17 @@
"api"
],
"homepage": "https://github.com/ActivitySmithHQ/activitysmith-node",
"main": "dist/generated/index.js",
"types": "dist/generated/index.d.ts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"exports": {
".": {
"types": "./dist/generated/index.d.ts",
"import": "./dist/generated/index.js",
"require": "./dist/generated/index.js",
"default": "./dist/generated/index.js"
"types": "./dist/src/index.d.ts",
"require": "./dist/src/index.js",
"default": "./dist/src/index.js"
}
},
"files": [
"dist/src",
"dist/generated",
"README.md",
"LICENSE"
Expand All @@ -29,7 +29,8 @@
"node": ">=18"
},
"scripts": {
"build": "tsc -p tsconfig.generated.json",
"clean": "tsc -b --clean",
"build": "npm run clean && tsc -b",
"prepublishOnly": "npm run build",
"test": "npm run build && vitest run"
},
Expand Down
24 changes: 24 additions & 0 deletions src/ActivitySmith.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Configuration, NotificationsApi, LiveActivitiesApi } from "../generated/index";

Check failure on line 1 in src/ActivitySmith.ts

View workflow job for this annotation

GitHub Actions / test

'"../generated/index"' has no exported member named 'NotificationsApi'. Did you mean 'PushNotificationsApi'?

export interface ActivitySmithOptions {
apiKey: string;
}

export class ActivitySmith {
public readonly notifications: NotificationsApi;
public readonly liveActivities: LiveActivitiesApi;

constructor(opts: ActivitySmithOptions) {
if (!opts?.apiKey) {
throw new Error("ActivitySmith: apiKey is required");
}

// basePath omitted on purpose — it will use the default from the generated runtime
const config = new Configuration({
accessToken: opts.apiKey,
});

this.notifications = new NotificationsApi(config);
this.liveActivities = new LiveActivitiesApi(config);
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Public exports live here.
// The generator output is in ../generated and can be wrapped/re-exported as needed.
export {};
import { ActivitySmith } from "./ActivitySmith";
export = ActivitySmith;
9 changes: 0 additions & 9 deletions tsconfig.base.json

This file was deleted.

10 changes: 7 additions & 3 deletions tsconfig.generated.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"rootDir": "generated",
"moduleResolution": "Node",
"declaration": true,
"composite": true,
"outDir": "dist/generated",
"strict": false
"rootDir": "generated",
"strict": false,
"skipLibCheck": true
},
"include": ["generated"]
}
7 changes: 2 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"noEmit": true
},
"include": ["src"]
"files": [],
"references": [{ "path": "./tsconfig.generated.json" }, { "path": "./tsconfig.src.json" }]
}
15 changes: 15 additions & 0 deletions tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "Node",
"declaration": true,
"composite": true,
"outDir": "dist/src",
"rootDir": "src",
"strict": true,
"skipLibCheck": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.generated.json" }]
}
Loading