@superdurable/connector-aweber 0.1.0 → 0.2.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.
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "connectorId": "aweber",
3
- "releaseTag": "connectors/aweber/go/v0.1.0",
3
+ "releaseTag": "connectors/aweber/go/v0.2.0",
4
4
  "package": {
5
5
  "ecosystem": "npm",
6
6
  "name": "@superdurable/connector-aweber",
7
- "version": "0.1.0"
7
+ "version": "0.2.0"
8
8
  },
9
9
  "factories": [
10
10
  {
@@ -50,13 +50,10 @@
50
50
  "type": "integer"
51
51
  },
52
52
  "offset": {
53
- "description": "Offset is the zero-based number of accounts to skip.",
53
+ "description": "Offset is the zero-based number of accounts to skip; zero starts at the first account.",
54
54
  "type": "integer"
55
55
  }
56
56
  },
57
- "required": [
58
- "offset"
59
- ],
60
57
  "type": "object"
61
58
  }
62
59
  }
@@ -45,7 +45,7 @@ function decodeSharedCredentials(value) {
45
45
  return credentials;
46
46
  }
47
47
  var ListAccountsInputSchema = z.strictObject({
48
- "offset": z.number().int(),
48
+ "offset": z.number().int().optional(),
49
49
  "limit": z.number().int().optional()
50
50
  });
51
51
  var AccountSchema = z.strictObject({
@@ -35,8 +35,8 @@ declare function decodeSharedCredentials(value: unknown): Credentials;
35
35
  type CredentialSource = RefreshingCredentialProvider<Credentials>;
36
36
  /** ListAccountsInput selects an offset-based page of authorized accounts. */
37
37
  interface ListAccountsInput {
38
- /** Offset is the zero-based number of accounts to skip. */
39
- "offset": number;
38
+ /** Offset is the zero-based number of accounts to skip; zero starts at the first account. */
39
+ "offset"?: number | undefined;
40
40
  /** Limit is the maximum account count; zero uses the provider default of 100. */
41
41
  "limit"?: number | undefined;
42
42
  }
@@ -60,7 +60,7 @@ interface AccountsPage {
60
60
  }
61
61
  /** Runtime validator for ListAccountsInput. */
62
62
  declare const ListAccountsInputSchema: z.ZodObject<{
63
- offset: z.ZodNumber;
63
+ offset: z.ZodOptional<z.ZodNumber>;
64
64
  limit: z.ZodOptional<z.ZodNumber>;
65
65
  }, z.core.$strict>;
66
66
  /** Runtime validator for Account. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { L as ListAccountsInput, A as AccountsPage, C as Connection, a as Config, b as Credentials, O as Operations } from './connection-DD87GHHn.js';
2
- export { c as Account, d as AccountSchema, e as AccountsPageSchema, f as ConfigSchema, g as CredentialSource, h as ListAccountsInputSchema, i as decodeCredentials, j as decodeSharedCredentials, n as newConnection, k as newConnectionWithOperations } from './connection-DD87GHHn.js';
1
+ import { L as ListAccountsInput, A as AccountsPage, C as Connection, a as Config, b as Credentials, O as Operations } from './connection-C55dNn1o.js';
2
+ export { c as Account, d as AccountSchema, e as AccountsPageSchema, f as ConfigSchema, g as CredentialSource, h as ListAccountsInputSchema, i as decodeCredentials, j as decodeSharedCredentials, n as newConnection, k as newConnectionWithOperations } from './connection-C55dNn1o.js';
3
3
  import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, Call, QueryAttempt, CredentialProvider, CredentialRefreshDriver } from '@superdurable/connectors-sdk';
4
4
  import { StepTarget } from '@superdurable/dex';
5
5
  import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  newConnection,
19
19
  newConnectionWithOperations,
20
20
  newProjectCredentialProvider
21
- } from "./chunk-4ZPFSYR3.js";
21
+ } from "./chunk-GPA62WB3.js";
22
22
 
23
23
  // src/generated/steps.ts
24
24
  import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
@@ -116,15 +116,16 @@ var ListAccountsOperation = class {
116
116
  }
117
117
  /** Project account IDs and company names from a bounded JSON response. */
118
118
  async invoke(call, input) {
119
- if (!input || !Number.isSafeInteger(input.offset) || input.offset < 0 || input.limit !== void 0 && (!Number.isSafeInteger(input.limit) || input.limit < 0 || input.limit > 100))
119
+ const offset = input?.offset ?? 0;
120
+ if (!input || !Number.isSafeInteger(offset) || offset < 0 || input.limit !== void 0 && (!Number.isSafeInteger(input.limit) || input.limit < 0 || input.limit > 100))
120
121
  return branch("defect", "VALIDATION", "offset or limit is invalid");
121
122
  const limit = input.limit || 100;
122
- const query = new URLSearchParams({ "ws.size": String(limit), "ws.start": String(input.offset) });
123
+ const query = new URLSearchParams({ "ws.size": String(limit), "ws.start": String(offset) });
123
124
  const exchange = await this.client.get(call, `/1.0/accounts?${query.toString()}`);
124
125
  const failed = classifyRead(exchange);
125
126
  if (failed) return failed;
126
127
  const document = parseDocument(exchange.body);
127
- if (!document || !Array.isArray(document.entries) || typeof document.start !== "number" || !Number.isSafeInteger(document.start) || document.start !== input.offset || typeof document.total_size !== "number" || !Number.isSafeInteger(document.total_size) || document.total_size < document.entries.length)
128
+ if (!document || !Array.isArray(document.entries) || typeof document.start !== "number" || !Number.isSafeInteger(document.start) || document.start !== offset || typeof document.total_size !== "number" || !Number.isSafeInteger(document.total_size) || document.total_size < document.entries.length)
128
129
  return branch("invalidResponse", "PROTOCOL", "AWeber returned invalid account JSON");
129
130
  const accounts = [];
130
131
  for (const item of document.entries) {
@@ -132,7 +133,7 @@ var ListAccountsOperation = class {
132
133
  return branch("invalidResponse", "PROTOCOL", "AWeber returned invalid account JSON");
133
134
  accounts.push({ id: String(item.id), company: item.company });
134
135
  }
135
- return newQueryBranch("listed", { accounts, offset: input.offset, limit, total: document.total_size });
136
+ return newQueryBranch("listed", { accounts, offset, limit, total: document.total_size });
136
137
  }
137
138
  };
138
139
  function classifyRead(exchange) {
package/dist/mock.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
2
2
  import { Failure } from '@superdurable/connectors-sdk';
3
- import { O as Operations, C as Connection, L as ListAccountsInput, A as AccountsPage, c as Account } from './connection-DD87GHHn.js';
3
+ import { O as Operations, C as Connection, L as ListAccountsInput, A as AccountsPage, c as Account } from './connection-C55dNn1o.js';
4
4
  import 'zod';
5
5
 
6
6
  /** Go zero value for ListAccountsInput in scripted cases. */
package/dist/mock.js CHANGED
@@ -5,13 +5,11 @@ import {
5
5
  ListAccountsInputSchema,
6
6
  ProviderID,
7
7
  newConnectionWithOperations
8
- } from "./chunk-4ZPFSYR3.js";
8
+ } from "./chunk-GPA62WB3.js";
9
9
 
10
10
  // src/generated/mock.ts
11
11
  import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
12
- var emptyListAccountsInput = ListAccountsInputSchema.parse({
13
- "offset": 0
14
- });
12
+ var emptyListAccountsInput = ListAccountsInputSchema.parse({});
15
13
  var emptyAccount = AccountSchema.parse({
16
14
  "id": "",
17
15
  "company": ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdurable/connector-aweber",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "AWeber connector for Dex TypeScript applications",
6
6
  "repository": {