@listen-fire/attio 0.12.0 → 0.12.1

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 ADDED
@@ -0,0 +1,32 @@
1
+ # @lf/attio
2
+
3
+ Attio as a module: records, lists, files and webhooks. A connection uses one of
4
+ two credentials, and `lf credential add` asks for the name of the one you want.
5
+
6
+ ## Connect with an access token
7
+
8
+ The simplest way in, and the one for a service account. Create a token in Attio
9
+ (Workspace settings, Developers, Access tokens) with read-write access to records
10
+ and webhooks, then:
11
+
12
+ ```
13
+ lf connect @lf/attio # answers the OAuth app questions; leave them empty if you only use tokens
14
+ lf credential add --module attio henry_attio --credential attio_token
15
+ # Access token: <the token> Base URL: <enter, unless you proxy Attio>
16
+ ```
17
+
18
+ The credential `attio_token` holds `accessToken` and an optional `baseUrl`. The token
19
+ is entered once and never refreshed.
20
+
21
+ ## Connect with OAuth
22
+
23
+ For a user who signs in through Attio's authorize page, with your own OAuth app
24
+ (client id and secret, the redirect URI `lf connect` prints):
25
+
26
+ ```
27
+ lf connect @lf/attio
28
+ lf credential add --module attio henry_attio --credential attio
29
+ ```
30
+
31
+ Either way the movement says `connect attio using henry_attio`; Attio receives the
32
+ same bearer header from both.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const attioModule: {
7
7
  kind: "adapter";
8
8
  name: string;
9
9
  manifest: import("@listen-fire/engine-contracts").AdapterManifest;
10
- credentials: {
10
+ credentials: ({
11
11
  name: string;
12
12
  kind: "oauth2";
13
13
  oauth2: {
@@ -24,7 +24,22 @@ export declare const attioModule: {
24
24
  secret: false;
25
25
  optional: true;
26
26
  }[];
27
- }[];
27
+ } | {
28
+ name: string;
29
+ kind: "static";
30
+ fields: ({
31
+ name: string;
32
+ label: string;
33
+ secret?: undefined;
34
+ optional?: undefined;
35
+ } | {
36
+ name: string;
37
+ label: string;
38
+ secret: false;
39
+ optional: true;
40
+ })[];
41
+ oauth2?: undefined;
42
+ })[];
28
43
  inbound: {
29
44
  providerKey: string;
30
45
  scheme: "attio";
package/dist/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  // `@lf/attio`: Attio as a module. The host hands it the install's OAuth
3
3
  // credential (the protocol's access token, optionally a base URL), a fetch and
4
- // its files; the module builds one client per token, so a workspace's cached
4
+ // its files. A connection holds one of two credentials: an OAuth sign-in
5
+ // (`attio`) or a static access token the user created in Attio
6
+ // (`attio_token`); both reach the client as the same bearer token; the module builds one client per token, so a workspace's cached
5
7
  // attributes are shared by every install on that token. Attio's tokens do not
6
8
  // expire. `ctx.config.baseUrlOverride` (the dev loop's fake) wins over the
7
9
  // credential's own base URL. Deliveries are signed with the secret Attio
@@ -33,7 +35,7 @@ const oauth_1 = require("./oauth");
33
35
  function attioClientFrom(ctx) {
34
36
  return async () => {
35
37
  const fields = await ctx.credential.fields();
36
- const token = fields.access_token;
38
+ const token = fields.access_token ?? fields.accessToken;
37
39
  if (token === undefined || token === '') {
38
40
  throw new Error('Attio: the connected credential holds no access token. Connect Attio again.');
39
41
  }
@@ -57,6 +59,17 @@ exports.attioModule = (0, module_kit_1.defineModule)({
57
59
  { name: 'apiTokenId', label: 'API token id', secret: false, optional: true },
58
60
  ],
59
61
  },
62
+ // An access token made in Attio (Workspace settings, Developers), entered
63
+ // once and never refreshed. The field names are the contract with the
64
+ // platform's connect page.
65
+ {
66
+ name: 'attio_token',
67
+ kind: 'static',
68
+ fields: [
69
+ { name: 'accessToken', label: 'Access token' },
70
+ { name: 'baseUrl', label: 'Base URL', secret: false, optional: true },
71
+ ],
72
+ },
60
73
  ],
61
74
  // Today's provider key and header chain, so every registered webhook URL and
62
75
  // every valid signature keeps working.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@listen-fire/attio",
3
3
  "license": "Apache-2.0",
4
- "version": "0.12.0",
4
+ "version": "0.12.1",
5
5
  "description": "Attio (objects, records, lists, notes, tasks, comments, files) as a module: read, written, and signed webhooks. Loaded in process by the platform, served by serve-module everywhere else.",
6
6
  "engines": {
7
7
  "node": ">=22.23.4 <23"
@@ -13,10 +13,10 @@
13
13
  "exponential-backoff": "3.1.1",
14
14
  "lru-cache": "10.4.3",
15
15
  "zod": "4.1.12",
16
- "@listen-fire/engine": "^0.12.0",
17
- "@listen-fire/engine-contracts": "^0.12.0",
18
- "@listen-fire/module-kit": "^0.12.0",
19
- "@listen-fire/movement-lang": "^0.12.0"
16
+ "@listen-fire/engine-contracts": "^0.12.1",
17
+ "@listen-fire/engine": "^0.12.1",
18
+ "@listen-fire/module-kit": "^0.12.1",
19
+ "@listen-fire/movement-lang": "^0.12.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/jest": "29.5.14",