@project-ajax/create 0.0.32 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/template/.gitignore +3 -0
- package/template/AGENTS.md +26 -1
- package/template/CLAUDE.md +26 -1
- package/template/README.md +18 -27
- package/template/package.json +1 -5
- package/template/src/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-ajax/create",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "Initialize a new Notion Project Ajax extensions repo.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-ajax": "dist/index.js"
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist/",
|
|
26
|
-
"template/"
|
|
26
|
+
"template/",
|
|
27
|
+
"template/.gitignore"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@inquirer/prompts": "^8.0.1",
|
package/template/AGENTS.md
CHANGED
|
@@ -55,7 +55,6 @@ Syncs run in a "sync cycle": a back-to-back chain of `execute` calls that starts
|
|
|
55
55
|
- `mode=replace` is simpler, and fine for smaller syncs (<10k)
|
|
56
56
|
- Use `mode=incremental` when the sync could return a lot of data (>10k), eg for SaaS tools like Salesforce or Stripe
|
|
57
57
|
- When using `mode=incremental`, emit delete markers as needed if easy to do (below)
|
|
58
|
-
- Use `Pacer.wait` to respect upstream rate limits during `execute` calls; pick a stable key per API or endpoint.
|
|
59
58
|
|
|
60
59
|
**Sync strategy (`mode`):**
|
|
61
60
|
- `replace`: each sync cycle must return the full dataset. After the final `hasMore: false`, any records not seen during that cycle are deleted.
|
|
@@ -166,6 +165,32 @@ worker.sync("tasksSync", {
|
|
|
166
165
|
- `npx workers auth login [--env=dev]`: connect to a Notion workspace.
|
|
167
166
|
- `npx workers deploy`: build and publish capabilities.
|
|
168
167
|
- `npx workers exec <capability>`: run a sync or tool.
|
|
168
|
+
- `npx workers pack`: create a tarball; uses Git when available (respects `.gitignore`), always skips `node_modules`, `dist`, `workers.json`, `workers.*.json`, `.env`, and `.env.*`, and works in non-git repos.
|
|
169
|
+
|
|
170
|
+
## Debugging & Monitoring Runs
|
|
171
|
+
Use `npx workers runs` to inspect run history and logs.
|
|
172
|
+
|
|
173
|
+
**List recent runs:**
|
|
174
|
+
```shell
|
|
175
|
+
npx workers runs list
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Get logs for a specific run:**
|
|
179
|
+
```shell
|
|
180
|
+
npx workers runs logs <runId>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Get logs for the latest run (any capability):**
|
|
184
|
+
```shell
|
|
185
|
+
npx workers runs list --plain | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Get logs for the latest run of a specific capability:**
|
|
189
|
+
```shell
|
|
190
|
+
npx workers runs list --plain | grep tasksSync | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The `--plain` flag outputs tab-separated values without formatting, making it easy to pipe to other commands.
|
|
169
194
|
|
|
170
195
|
## Coding Style & Naming Conventions
|
|
171
196
|
- TypeScript with `strict` enabled; keep types explicit when shaping I/O.
|
package/template/CLAUDE.md
CHANGED
|
@@ -55,7 +55,6 @@ Syncs run in a "sync cycle": a back-to-back chain of `execute` calls that starts
|
|
|
55
55
|
- `mode=replace` is simpler, and fine for smaller syncs (<10k)
|
|
56
56
|
- Use `mode=incremental` when the sync could return a lot of data (>10k), eg for SaaS tools like Salesforce or Stripe
|
|
57
57
|
- When using `mode=incremental`, emit delete markers as needed if easy to do (below)
|
|
58
|
-
- Use `Pacer.wait` to respect upstream rate limits during `execute` calls; pick a stable key per API or endpoint.
|
|
59
58
|
|
|
60
59
|
**Sync strategy (`mode`):**
|
|
61
60
|
- `replace`: each sync cycle must return the full dataset. After the final `hasMore: false`, any records not seen during that cycle are deleted.
|
|
@@ -166,6 +165,32 @@ worker.sync("tasksSync", {
|
|
|
166
165
|
- `npx workers auth login [--env=dev]`: connect to a Notion workspace.
|
|
167
166
|
- `npx workers deploy`: build and publish capabilities.
|
|
168
167
|
- `npx workers exec <capability>`: run a sync or tool.
|
|
168
|
+
- `npx workers pack`: create a tarball; uses Git when available (respects `.gitignore`), always skips `node_modules`, `dist`, `workers.json`, `workers.*.json`, `.env`, and `.env.*`, and works in non-git repos.
|
|
169
|
+
|
|
170
|
+
## Debugging & Monitoring Runs
|
|
171
|
+
Use `npx workers runs` to inspect run history and logs.
|
|
172
|
+
|
|
173
|
+
**List recent runs:**
|
|
174
|
+
```shell
|
|
175
|
+
npx workers runs list
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Get logs for a specific run:**
|
|
179
|
+
```shell
|
|
180
|
+
npx workers runs logs <runId>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Get logs for the latest run (any capability):**
|
|
184
|
+
```shell
|
|
185
|
+
npx workers runs list --plain | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Get logs for the latest run of a specific capability:**
|
|
189
|
+
```shell
|
|
190
|
+
npx workers runs list --plain | grep tasksSync | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The `--plain` flag outputs tab-separated values without formatting, making it easy to pipe to other commands.
|
|
169
194
|
|
|
170
195
|
## Coding Style & Naming Conventions
|
|
171
196
|
- TypeScript with `strict` enabled; keep types explicit when shaping I/O.
|
package/template/README.md
CHANGED
|
@@ -171,33 +171,6 @@ changes: [
|
|
|
171
171
|
]
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
#### Respect rate limits
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
If the source API has a rate limit, call `Pacer.wait` inside `execute` to pace requests (for example, 10 requests per minute):
|
|
178
|
-
|
|
179
|
-
```ts
|
|
180
|
-
import { Pacer } from "@project-ajax/sdk/pacer";
|
|
181
|
-
|
|
182
|
-
worker.sync("tasksSync", {
|
|
183
|
-
primaryKeyProperty: "ID",
|
|
184
|
-
schema: { defaultName: "Tasks", properties: { Name: Schema.title(), ID: Schema.richText() } },
|
|
185
|
-
execute: async () => {
|
|
186
|
-
const oneMinute = 60 * 1000;
|
|
187
|
-
await Pacer.wait("tasks-api", { requests: 10, intervalMs: oneMinute });
|
|
188
|
-
const items = await fetchTasks();
|
|
189
|
-
return {
|
|
190
|
-
changes: items.map((item) => ({
|
|
191
|
-
type: "upsert",
|
|
192
|
-
key: item.id,
|
|
193
|
-
properties: { Name: Builder.title(item.name), ID: Builder.richText(item.id) },
|
|
194
|
-
})),
|
|
195
|
-
hasMore: false,
|
|
196
|
-
};
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
174
|
### Tool
|
|
202
175
|
|
|
203
176
|
Tools are callable by Notion custom agents.
|
|
@@ -367,6 +340,12 @@ List recent runs:
|
|
|
367
340
|
npx workers runs list
|
|
368
341
|
```
|
|
369
342
|
|
|
343
|
+
Use `--plain` for machine-readable tab-separated output:
|
|
344
|
+
|
|
345
|
+
```shell
|
|
346
|
+
npx workers runs list --plain
|
|
347
|
+
```
|
|
348
|
+
|
|
370
349
|
### `npx workers runs logs`
|
|
371
350
|
Fetch logs for a run:
|
|
372
351
|
|
|
@@ -374,6 +353,18 @@ Fetch logs for a run:
|
|
|
374
353
|
npx workers runs logs <runId>
|
|
375
354
|
```
|
|
376
355
|
|
|
356
|
+
Get logs for the latest run (any capability):
|
|
357
|
+
|
|
358
|
+
```shell
|
|
359
|
+
npx workers runs list --plain | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Get logs for the latest run of a specific capability:
|
|
363
|
+
|
|
364
|
+
```shell
|
|
365
|
+
npx workers runs list --plain | grep tasksSync | head -n1 | cut -f1 | xargs npx workers runs logs
|
|
366
|
+
```
|
|
367
|
+
|
|
377
368
|
### `npx workers bundle download`
|
|
378
369
|
Download the deployed bundle:
|
|
379
370
|
|
package/template/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-ajax/template",
|
|
3
3
|
"version": "0.0.0",
|
|
4
|
-
"main": "dist/index.js",
|
|
5
4
|
"private": true,
|
|
6
5
|
"scripts": {
|
|
7
6
|
"build": "tsc",
|
|
8
|
-
"check": "tsc --noEmit"
|
|
9
|
-
"dev": "tsx --watch src/index.ts",
|
|
10
|
-
"start": "node dist/index.js",
|
|
11
|
-
"bump-sdk": "npm install @project-ajax/sdk@latest"
|
|
7
|
+
"check": "tsc --noEmit"
|
|
12
8
|
},
|
|
13
9
|
"engines": {
|
|
14
10
|
"node": ">=22.0.0",
|
package/template/src/index.ts
CHANGED
|
@@ -67,7 +67,7 @@ worker.sync("tasksSync", {
|
|
|
67
67
|
|
|
68
68
|
// Optional: How often the sync should run. Defaults to "continuous".
|
|
69
69
|
// Use intervals like "30m", "1h", "1d" (min: 1m, max: 7d)
|
|
70
|
-
schedule: "
|
|
70
|
+
schedule: "5m",
|
|
71
71
|
|
|
72
72
|
// Sync mode:
|
|
73
73
|
// - "replace": Each sync cycle returns the complete dataset. After hasMore:false,
|