@superdurable/connector-google-gmail 0.1.2 → 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.
@@ -56,6 +56,29 @@ var import_zod2 = require("zod");
56
56
  // src/generated/models.ts
57
57
  var import_zod = require("zod");
58
58
  var import_connectors_sdk = require("@superdurable/connectors-sdk");
59
+ var goTimeJSONPattern = /^(\d{4})-(\d{2})-(\d{2})T(\d{1,2}):(\d{2}):(\d{2})(?:[.,](\d+))?(Z|([+-])(\d{2}):(\d{2}))$/;
60
+ function isGoTimeJSON(value) {
61
+ const match = goTimeJSONPattern.exec(value);
62
+ if (!match) return false;
63
+ const [, yearText, monthText, dayText, hourText, minuteText, secondText, , zone, , zoneHourText, zoneMinuteText] = match;
64
+ const year = Number(yearText);
65
+ const month = Number(monthText);
66
+ const day = Number(dayText);
67
+ const isLeap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
68
+ const monthDays = [31, isLeap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
69
+ return month >= 1 && month <= 12 && day >= 1 && day <= monthDays[month - 1] && Number(hourText) <= 23 && Number(minuteText) <= 59 && Number(secondText) <= 59 && (zone === "Z" || Number(zoneHourText) <= 24 && Number(zoneMinuteText) <= 60);
70
+ }
71
+ function canonicalGoTimeJSON(value) {
72
+ const match = goTimeJSONPattern.exec(value);
73
+ const [, year, month, day, hour, minute, second, fraction, zone, sign, zoneHour, zoneMinute] = match;
74
+ const clock = year + "-" + month + "-" + day + "T" + hour.padStart(2, "0") + ":" + minute + ":" + second;
75
+ const digits = (fraction ?? "").slice(0, 9).replace(/0+$/, "");
76
+ const offsetMinutes = zone === "Z" ? 0 : (Number(zoneHour) * 60 + Number(zoneMinute)) * (sign === "+" ? 1 : -1);
77
+ if (Math.abs(offsetMinutes) >= 1440) return value;
78
+ const offset = offsetMinutes === 0 ? "Z" : (offsetMinutes > 0 ? "+" : "-") + String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(2, "0") + ":" + String(Math.abs(offsetMinutes) % 60).padStart(2, "0");
79
+ return clock + (digits ? "." + digits : "") + offset;
80
+ }
81
+ var GoTimeJSONSchema = import_zod.z.string().refine(isGoTimeJSON, "invalid Go time.Time JSON timestamp").transform(canonicalGoTimeJSON);
59
82
  var ConfigSchema = import_zod.z.object({
60
83
  "endpoint": import_zod.z.string().optional(),
61
84
  "maxResponseBytes": import_zod.z.number().int().optional(),
@@ -79,7 +102,7 @@ var MessageSchema = import_zod.z.strictObject({
79
102
  "textBody": import_zod.z.string().optional(),
80
103
  "htmlBody": import_zod.z.string().optional(),
81
104
  "snippet": import_zod.z.string().optional(),
82
- "receivedAt": import_zod.z.iso.datetime({ offset: true }),
105
+ "receivedAt": GoTimeJSONSchema,
83
106
  "labelIds": import_zod.z.array(import_zod.z.string()).optional()
84
107
  });
85
108
  var SendMessageInputSchema = import_zod.z.strictObject({
@@ -208,8 +231,6 @@ var SentSearchSchema = import_zod4.z.object({ messages: import_zod4.z.array(Sent
208
231
  // src/refresh.ts
209
232
  var import_connectors_sdk3 = require("@superdurable/connectors-sdk");
210
233
  var import_oauthtoken = require("@superdurable/connectors-sdk/oauthtoken");
211
- var import_zod5 = require("zod");
212
- var ServiceAccountKeySchema = import_zod5.z.object({ client_email: import_zod5.z.string().min(1), private_key: import_zod5.z.string().min(1), token_uri: import_zod5.z.url() });
213
234
 
214
235
  // src/send.ts
215
236
  var import_connectors_sdk4 = require("@superdurable/connectors-sdk");
@@ -240,6 +261,7 @@ var import_connectors_sdk7 = require("@superdurable/connectors-sdk");
240
261
 
241
262
  // src/generated/connection.ts
242
263
  var import_connectors_sdk6 = require("@superdurable/connectors-sdk");
264
+ var import_projectconfig = require("@superdurable/connectors-sdk/projectconfig");
243
265
  var Connection = class {
244
266
  /** Stable provider and connection name. */
245
267
  reference;
@@ -267,30 +289,18 @@ var GmailConnection = class extends Connection {
267
289
 
268
290
  // src/project.ts
269
291
  var import_connectors_sdk9 = require("@superdurable/connectors-sdk");
270
- var import_projectconfig = require("@superdurable/connectors-sdk/projectconfig");
271
- var import_zod7 = require("zod");
292
+ var import_zod5 = require("zod");
272
293
 
273
294
  // src/credential_codec.ts
274
295
  var import_connectors_sdk8 = require("@superdurable/connectors-sdk");
275
- var import_zod6 = require("zod");
276
- var StoredCredentialsSchema = import_zod6.z.object({
277
- auth_method: import_zod6.z.string().optional(),
278
- oauth_client_id: import_zod6.z.string().optional(),
279
- oauth_client_secret: import_zod6.z.string().optional(),
280
- access_token: import_zod6.z.string().optional(),
281
- refresh_token: import_zod6.z.string().optional(),
282
- primary_email: import_zod6.z.string().optional(),
283
- service_account_key: import_zod6.z.string().optional(),
284
- delegated_user: import_zod6.z.string().optional()
285
- });
286
296
 
287
297
  // src/project.ts
288
- var ProjectGmailConfigurationSchema = import_zod7.z.object({
289
- endpoint: import_zod7.z.string().optional(),
290
- maxResponseBytes: import_zod7.z.number().int().safe().optional(),
291
- maxMessageBytes: import_zod7.z.number().int().safe().optional(),
292
- pollInterval: import_zod7.z.number().int().safe().optional(),
293
- pollPageSize: import_zod7.z.number().int().safe().optional()
298
+ var ProjectGmailConfigurationSchema = import_zod5.z.object({
299
+ endpoint: import_zod5.z.string().optional(),
300
+ maxResponseBytes: import_zod5.z.number().int().safe().optional(),
301
+ maxMessageBytes: import_zod5.z.number().int().safe().optional(),
302
+ pollInterval: import_zod5.z.number().int().safe().optional(),
303
+ pollPageSize: import_zod5.z.number().int().safe().optional()
294
304
  });
295
305
 
296
306
  // src/generated/steps.ts
@@ -1,6 +1,6 @@
1
1
  import { Failure } from '@superdurable/connectors-sdk';
2
2
  import { Case, MockQuery, MockMutation } from '@superdurable/connectors-sdk/connectormock';
3
- import { M as Message, e as GmailConnection, G as GetMessageInput, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-NE_da2Az.cjs';
3
+ import { M as Message, e as GmailConnection, G as GetMessageInput, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-D8OV_Hfe.cjs';
4
4
  import 'zod';
5
5
 
6
6
  /** Script a safe retry of getMessage. */
@@ -1,6 +1,6 @@
1
1
  import { Failure } from '@superdurable/connectors-sdk';
2
2
  import { Case, MockQuery, MockMutation } from '@superdurable/connectors-sdk/connectormock';
3
- import { M as Message, e as GmailConnection, G as GetMessageInput, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-NE_da2Az.js';
3
+ import { M as Message, e as GmailConnection, G as GetMessageInput, S as SendMessageInput, c as SendMessageOutput, R as ReplyToMessageInput } from '../connection-D8OV_Hfe.js';
4
4
  import 'zod';
5
5
 
6
6
  /** Script a safe retry of getMessage. */
@@ -10,7 +10,7 @@ import {
10
10
  SendMessageInputSchema,
11
11
  SendMessageOutputSchema,
12
12
  SendMessageOutputSchema2
13
- } from "../chunk-IAO6TPJ3.js";
13
+ } from "../chunk-KVNIQW5Y.js";
14
14
 
15
15
  // src/mock/index.ts
16
16
  import { branchCase as branchCase2, newMutation as newMutation2, newQuery as newQuery2, retryCase as retryCase2, uncertainCase } from "@superdurable/connectors-sdk/connectormock";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdurable/connector-google-gmail",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Dex Gmail connector for TypeScript",
6
6
  "repository": {
@@ -35,7 +35,8 @@
35
35
  "types": "./dist/mock/index.d.cts",
36
36
  "default": "./dist/mock/index.cjs"
37
37
  }
38
- }
38
+ },
39
+ "./dex-connector.json": "./dex-connector.json"
39
40
  },
40
41
  "files": [
41
42
  "dist",
@@ -55,7 +56,7 @@
55
56
  "check": "npm run typecheck && npm run test-d && npm run lint && npm test"
56
57
  },
57
58
  "dependencies": {
58
- "@superdurable/connectors-sdk": "0.1.1",
59
+ "@superdurable/connectors-sdk": "0.6.0",
59
60
  "@superdurable/dex": ">=1.28.0",
60
61
  "zod": "^4.1.0"
61
62
  },