attio 0.0.1-experimental.20241008.1 → 0.0.1-experimental.20241008.3

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.
@@ -7,14 +7,13 @@ const addConnectionSchema = z.object({
7
7
  app_id: z.string(),
8
8
  connection_definition_id: z.string(),
9
9
  });
10
- export async function addConnectionDefinition({ token, devSlug, appId, key, label, description, allowMultiple, global, connectionType, clientId, clientSecret, authorizeUrl, accessTokenUrl, major, scopes, }) {
10
+ export async function addConnectionDefinition({ token, devSlug, appId, key, label, description, global, connectionType, clientId, clientSecret, authorizeUrl, accessTokenUrl, major, scopes, }) {
11
11
  const connectionDefinitionId = uuid();
12
12
  const body = {
13
13
  connection_type: connectionType,
14
14
  slug: key,
15
15
  label,
16
16
  description,
17
- allow_multiple: allowMultiple,
18
17
  global,
19
18
  major,
20
19
  };
@@ -8,7 +8,6 @@ const connectionDefinitionsResponseSchema = z.object({
8
8
  connection_type: z.enum(["oauth2-code", "secret"]),
9
9
  description: z.string().nullable(),
10
10
  global: z.boolean(),
11
- allow_multiple: z.boolean(),
12
11
  })),
13
12
  });
14
13
  export async function fetchConnections({ token, devSlug, appId, major, }) {
@@ -29,7 +29,6 @@ export const options = z.object({
29
29
  .enum(["secret", "oauth2-code"])
30
30
  .optional()
31
31
  .describe(option({ description: "The type of connection to create" })),
32
- allowMultiple: z.boolean().optional().default(false),
33
32
  authorizeUrl: z
34
33
  .string()
35
34
  .url("Invalid URL, e.g. https://authorization-server.com/authorize")
@@ -62,7 +61,7 @@ export const options = z.object({
62
61
  .default(false)
63
62
  .describe(option({ description: "Run in development mode (additional debugging info)" })),
64
63
  });
65
- export default function AddConnection({ options: { key, label, description, type: connectionType, authorizeUrl, accessTokenUrl, allowMultiple, scopes, clientId, clientSecret, dev, }, }) {
64
+ export default function AddConnection({ options: { key, label, description, type: connectionType, authorizeUrl, accessTokenUrl, scopes, clientId, clientSecret, dev, }, }) {
66
65
  const [snapshot, send] = useMachine(addConnectionMachine, {
67
66
  input: {
68
67
  key,
@@ -71,7 +70,6 @@ export default function AddConnection({ options: { key, label, description, type
71
70
  connectionType,
72
71
  authorizeUrl,
73
72
  accessTokenUrl,
74
- allowMultiple,
75
73
  scopes,
76
74
  clientId,
77
75
  clientSecret,
@@ -203,34 +201,6 @@ export default function AddConnection({ options: { key, label, description, type
203
201
  { value: false, label: "An individual user" },
204
202
  { value: true, label: "The entire workspace" },
205
203
  ], onSelect: (global) => send({ type: "Choose Global", global }) })))),
206
- snapshot.matches("Ask for allow multiple") && (React.createElement(React.Fragment, null,
207
- React.createElement(Box, null,
208
- React.createElement(Text, null, snapshot.context.global
209
- ? `${snapshot.context.connectionType === "secret"
210
- ? "Secrets"
211
- : "Tokens"} should be:`
212
- : `A user should be able to:`)),
213
- React.createElement(Box, null,
214
- React.createElement(Select, { items: [
215
- {
216
- value: false,
217
- label: snapshot.context.global
218
- ? "Limited to one per workspace"
219
- : `Create only one ${snapshot.context.connectionType === "secret"
220
- ? "secret"
221
- : "token"} that remains private`,
222
- },
223
- {
224
- value: true,
225
- label: snapshot.context.global
226
- ? `Unlimited; users can add multiple ${snapshot.context.connectionType === "secret"
227
- ? "secrets"
228
- : "token"} to each workspace`
229
- : `Create multiple ${snapshot.context.connectionType === "secret"
230
- ? "secrets"
231
- : "tokens"} and share them with other users`,
232
- },
233
- ], onSelect: (allowMultiple) => send({ type: "Choose Allow Multiple", allowMultiple }) })))),
234
204
  snapshot.matches("Ask for Authorize URL") && (React.createElement(React.Fragment, null,
235
205
  React.createElement(Box, null,
236
206
  React.createElement(Text, null, "e.g. https://authorization-server.com/oauth/authorize")),
@@ -43,10 +43,9 @@ export default function ListConnections({ options: { dev } }) {
43
43
  snapshot.context.connections &&
44
44
  snapshot.context.connections && (React.createElement(Box, null,
45
45
  React.createElement(Table, { rows: Object.entries(snapshot.context.connections).map(([slug, connection]) => ({
46
- "Slug": slug,
47
- "Label": connection.label,
48
- "Global": connection.global ? "Yes" : "No",
49
- "Allow Multiple": connection.allow_multiple ? "Yes" : "No",
50
- "Type": connectionTypeNames[connection.connection_type],
46
+ Slug: slug,
47
+ Label: connection.label,
48
+ Global: connection.global ? "Yes" : "No",
49
+ Type: connectionTypeNames[connection.connection_type],
51
50
  })) })))));
52
51
  }
@@ -17,7 +17,7 @@ export const addConnectionMachine = setup({
17
17
  input: {},
18
18
  },
19
19
  actors: {
20
- "createConnectionDefinition": fromCallback(({ sendBack, input: { developer: { token, slug: devSlug }, config, connectionType: connection_type, key, label, description, allowMultiple, global, authorizeUrl, accessTokenUrl, clientId, clientSecret, scopes, }, }) => {
20
+ "createConnectionDefinition": fromCallback(({ sendBack, input: { developer: { token, slug: devSlug }, config, connectionType: connection_type, key, label, description, global, authorizeUrl, accessTokenUrl, clientId, clientSecret, scopes, }, }) => {
21
21
  const add = async () => {
22
22
  try {
23
23
  await addConnectionDefinition({
@@ -29,7 +29,6 @@ export const addConnectionMachine = setup({
29
29
  key,
30
30
  label,
31
31
  description,
32
- allowMultiple,
33
32
  global,
34
33
  accessTokenUrl,
35
34
  authorizeUrl,
@@ -188,9 +187,6 @@ export const addConnectionMachine = setup({
188
187
  setGlobal: assign({
189
188
  global: (_, params) => params.global,
190
189
  }),
191
- setAllowMultiple: assign({
192
- allowMultiple: (_, params) => params.allowMultiple,
193
- }),
194
190
  setAppConfig: assign({
195
191
  config: (_, params) => params.config,
196
192
  }),
@@ -215,7 +211,6 @@ export const addConnectionMachine = setup({
215
211
  "have client id": (_, params) => params.connectionType === "secret" ||
216
212
  options.shape.clientId.unwrap().safeParse(params.clientId?.trim()).success,
217
213
  "have global": (_, params) => params.global !== undefined,
218
- "have allow multiple": (_, params) => params.allowMultiple !== undefined,
219
214
  "have client secret": (_, params) => params.connectionType === "secret" ||
220
215
  options.shape.clientSecret.unwrap().safeParse(params.clientSecret?.trim()).success,
221
216
  "is oauth": (_, params) => params.connectionType === "oauth2-code",
@@ -277,7 +272,6 @@ export const addConnectionMachine = setup({
277
272
  clientId: context.clientId,
278
273
  clientSecret: context.clientSecret,
279
274
  global: context.global,
280
- allowMultiple: context.allowMultiple,
281
275
  label: context.label,
282
276
  description: context.description,
283
277
  key: context.key,
@@ -310,7 +304,7 @@ export const addConnectionMachine = setup({
310
304
  actions: { type: "setInvalidAuthorizeUrl", params: ({ context }) => context },
311
305
  },
312
306
  ],
313
- "Previous": "Ask for allow multiple",
307
+ "Previous": "Ask for global",
314
308
  "Next": {
315
309
  target: "Ask for Access Token URL",
316
310
  guard: { type: "have authorize url", params: ({ context }) => context },
@@ -564,25 +558,14 @@ export const addConnectionMachine = setup({
564
558
  ],
565
559
  },
566
560
  "Do we have global?": {
567
- always: [
568
- {
569
- target: "Do we have allow multiple?",
570
- guard: { type: "have global", params: ({ context }) => context },
571
- },
572
- {
573
- target: "Ask for global",
574
- },
575
- ],
576
- },
577
- "Do we have allow multiple?": {
578
561
  always: [
579
562
  {
580
563
  target: "Split on connection type",
581
- guard: { type: "have allow multiple", params: ({ context }) => context },
564
+ guard: { type: "have global", params: ({ context }) => context },
582
565
  reenter: true,
583
566
  },
584
567
  {
585
- target: "Ask for allow multiple",
568
+ target: "Ask for global",
586
569
  },
587
570
  ],
588
571
  },
@@ -629,28 +612,16 @@ export const addConnectionMachine = setup({
629
612
  "Ask for global": {
630
613
  on: {
631
614
  "Choose Global": {
632
- target: "Do we have allow multiple?",
615
+ target: "Split on connection type",
633
616
  actions: { type: "setGlobal", params: ({ event }) => event },
617
+ reenter: true,
634
618
  },
635
619
  "Previous": "Ask for description",
636
620
  "Next": {
637
- target: "Ask for allow multiple",
638
- guard: { type: "have global", params: ({ context }) => context },
639
- },
640
- },
641
- },
642
- "Ask for allow multiple": {
643
- on: {
644
- "Choose Allow Multiple": {
645
621
  target: "Split on connection type",
646
- actions: { type: "setAllowMultiple", params: ({ event }) => event },
622
+ guard: { type: "have global", params: ({ context }) => context },
647
623
  reenter: true,
648
624
  },
649
- "Previous": "Ask for global",
650
- "Next": {
651
- target: "Split on connection type",
652
- guard: { type: "have allow multiple", params: ({ context }) => context },
653
- },
654
625
  },
655
626
  },
656
627
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attio",
3
- "version": "0.0.1-experimental.20241008.1",
3
+ "version": "0.0.1-experimental.20241008.3",
4
4
  "bin": "lib/attio.js",
5
5
  "type": "module",
6
6
  "files": [