@friggframework/admin-scripts 2.0.0--canary.517.8eaf5df.0 → 2.0.0--canary.517.ff03f2c.0

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/README.md CHANGED
@@ -36,7 +36,6 @@ const Definition = {
36
36
  adminScripts: [AttioHealingScript],
37
37
 
38
38
  admin: {
39
- includeBuiltinScripts: true, // register oauth-token-refresh + integration-health-check
40
39
  enableScheduling: true, // provision EventBridge Scheduler resources
41
40
  },
42
41
  };
@@ -44,7 +43,7 @@ const Definition = {
44
43
  module.exports = { Definition };
45
44
  ```
46
45
 
47
- At deploy time the framework's `AdminScriptBuilder` provisions the SQS queue, the router + worker Lambdas, and (when `enableScheduling` is set) the EventBridge Scheduler group and IAM role. At runtime the router/worker load this app definition and register your scripts (plus the built-ins) into the script registry.
46
+ At deploy time the framework's `AdminScriptBuilder` provisions the SQS queue, the router + worker Lambdas, and (when `enableScheduling` is set) the EventBridge Scheduler group and IAM role. At runtime the router/worker load this app definition and register your scripts into the script registry.
48
47
 
49
48
  ---
50
49
 
@@ -96,9 +95,14 @@ class AttioHealingScript extends AdminScriptBase {
96
95
  throw new Error(`Integration ${integrationId} not found`);
97
96
  }
98
97
 
99
- // Call the live integration/API when you need it
98
+ // Call the live integration when you need to hit an external API.
99
+ // Modules are attached to the instance by their own name (from the
100
+ // module's getName(), e.g. `instance.attio`) and each module's `.api`
101
+ // is its authenticated client. Iterate `instance.modules` if you don't
102
+ // want to hard-code a module name. The methods on `.api` are defined by
103
+ // that specific API module.
100
104
  const instance = await this.context.instantiate(integrationId);
101
- await instance.primary.api.refreshMetadata();
105
+ await instance.attio.api.refreshEntityConfig(); // example — use your module's real method
102
106
 
103
107
  this.context.log('info', 'Healing complete', { integrationId });
104
108
  return { healed: true, integrationId };
@@ -159,10 +163,10 @@ curl -X POST https://<your-app>/admin/scripts/attio-healing \
159
163
  **Sync** — runs inline and returns the result. Only for fast scripts: in a deployed environment, sync is rejected (`400 SYNC_TIMEOUT_TOO_LONG`) when the script's `config.timeout` exceeds the API Lambda budget (~25s). Use `async` for anything longer.
160
164
 
161
165
  ```bash
162
- curl -X POST https://<your-app>/admin/scripts/integration-health-check \
166
+ curl -X POST https://<your-app>/admin/scripts/attio-healing \
163
167
  -H "x-frigg-admin-api-key: $ADMIN_API_KEY" \
164
168
  -H "Content-Type: application/json" \
165
- -d '{ "params": {}, "mode": "sync" }'
169
+ -d '{ "params": { "integrationId": "abc123" }, "mode": "sync" }'
166
170
 
167
171
  # 200 OK
168
172
  # { "executionId": "...", "status": "COMPLETED", "output": { ... }, "metrics": { "durationMs": 812 } }
@@ -203,29 +207,20 @@ A script can ship a default schedule in its `Definition.schedule`, and operators
203
207
 
204
208
  ```bash
205
209
  # Enable a daily 6am UTC run
206
- curl -X PUT https://<your-app>/admin/scripts/integration-health-check/schedule \
210
+ curl -X PUT https://<your-app>/admin/scripts/attio-healing/schedule \
207
211
  -H "x-frigg-admin-api-key: $ADMIN_API_KEY" \
208
212
  -H "Content-Type: application/json" \
209
213
  -d '{ "enabled": true, "cronExpression": "cron(0 6 * * ? *)", "timezone": "UTC" }'
210
214
 
211
215
  # Inspect / remove
212
- curl https://<your-app>/admin/scripts/integration-health-check/schedule -H "x-frigg-admin-api-key: $ADMIN_API_KEY"
213
- curl -X DELETE https://<your-app>/admin/scripts/integration-health-check/schedule -H "x-frigg-admin-api-key: $ADMIN_API_KEY"
216
+ curl https://<your-app>/admin/scripts/attio-healing/schedule -H "x-frigg-admin-api-key: $ADMIN_API_KEY"
217
+ curl -X DELETE https://<your-app>/admin/scripts/attio-healing/schedule -H "x-frigg-admin-api-key: $ADMIN_API_KEY"
214
218
  ```
215
219
 
216
220
  Scheduling requires `admin.enableScheduling: true` in the app definition (so the EventBridge Scheduler group, IAM role, and env vars are provisioned). In a deployed environment the router refuses to fall back to the in-memory local scheduler, returning `503 SCHEDULER_NOT_CONFIGURED` if the provider isn't wired.
217
221
 
218
222
  ---
219
223
 
220
- ## Built-in scripts
221
-
222
- Set `admin.includeBuiltinScripts: true` to register:
223
-
224
- - **`oauth-token-refresh`** — refreshes OAuth tokens for integrations nearing expiry. Params: `integrationIds?`, `expiryThresholdHours` (default 24), `dryRun`.
225
- - **`integration-health-check`** — checks credential validity and API connectivity. Params: `integrationIds?`, `checkCredentials` (default true), `checkConnectivity` (default true), `updateStatus` (default false).
226
-
227
- ---
228
-
229
224
  ## Script chaining
230
225
 
231
226
  Long or fan-out work can enqueue follow-up scripts. Continuations are tracked with `parentExecutionId` so you can trace the lineage:
package/index.js CHANGED
@@ -37,14 +37,6 @@ const {
37
37
  handler: executorHandler,
38
38
  } = require('./src/infrastructure/script-executor-handler');
39
39
 
40
- // Built-in Scripts
41
- const {
42
- OAuthTokenRefreshScript,
43
- IntegrationHealthCheckScript,
44
- builtinScripts,
45
- registerBuiltinScripts,
46
- } = require('./src/builtins');
47
-
48
40
  // Adapters
49
41
  const { SchedulerAdapter } = require('./src/adapters/scheduler-adapter');
50
42
  const { AWSSchedulerAdapter } = require('./src/adapters/aws-scheduler-adapter');
@@ -76,12 +68,6 @@ module.exports = {
76
68
  routerHandler,
77
69
  executorHandler,
78
70
 
79
- // Built-in scripts
80
- OAuthTokenRefreshScript,
81
- IntegrationHealthCheckScript,
82
- builtinScripts,
83
- registerBuiltinScripts,
84
-
85
71
  // Adapters
86
72
  SchedulerAdapter,
87
73
  AWSSchedulerAdapter,
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@friggframework/admin-scripts",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.517.8eaf5df.0",
4
+ "version": "2.0.0--canary.517.ff03f2c.0",
5
5
  "description": "Admin Script Runner for Frigg - Execute maintenance and operational scripts in hosted environments",
6
6
  "dependencies": {
7
7
  "@aws-sdk/client-scheduler": "^3.588.0",
8
- "@friggframework/core": "2.0.0--canary.517.8eaf5df.0",
8
+ "@friggframework/core": "2.0.0--canary.517.ff03f2c.0",
9
9
  "express": "^4.18.2",
10
10
  "serverless-http": "^3.2.0"
11
11
  },
12
12
  "devDependencies": {
13
- "@friggframework/eslint-config": "2.0.0--canary.517.8eaf5df.0",
14
- "@friggframework/prettier-config": "2.0.0--canary.517.8eaf5df.0",
15
- "@friggframework/test": "2.0.0--canary.517.8eaf5df.0",
13
+ "@friggframework/eslint-config": "2.0.0--canary.517.ff03f2c.0",
14
+ "@friggframework/prettier-config": "2.0.0--canary.517.ff03f2c.0",
15
+ "@friggframework/test": "2.0.0--canary.517.ff03f2c.0",
16
16
  "eslint": "^8.22.0",
17
17
  "jest": "^29.7.0",
18
18
  "prettier": "^2.7.1",
@@ -43,5 +43,5 @@
43
43
  "maintenance",
44
44
  "operations"
45
45
  ],
46
- "gitHead": "8eaf5df0746c979fc5cb7877d51a861becd5fbce"
46
+ "gitHead": "ff03f2c9204a318789ed105c09cc9d44deeae6ec"
47
47
  }
@@ -55,15 +55,10 @@ function bootstrapAdminScripts() {
55
55
  const {
56
56
  loadAppDefinition,
57
57
  } = require('@friggframework/core/handlers/app-definition-loader');
58
- const { adminScripts = [], admin = {} } = loadAppDefinition();
58
+ const { adminScripts = [] } = loadAppDefinition();
59
59
 
60
60
  const factory = getScriptFactory();
61
61
  registerScripts(factory, adminScripts);
62
-
63
- if (admin.includeBuiltinScripts) {
64
- const { builtinScripts } = require('../builtins');
65
- registerScripts(factory, builtinScripts);
66
- }
67
62
  } catch (error) {
68
63
  console.error(
69
64
  '[admin-scripts] bootstrap: could not load app definition:',