@lobu/connector-sdk 6.0.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.
Files changed (93) hide show
  1. package/dist/api-paginated.d.ts +79 -0
  2. package/dist/api-paginated.d.ts.map +1 -0
  3. package/dist/api-paginated.js +120 -0
  4. package/dist/api-paginated.js.map +1 -0
  5. package/dist/base.d.ts +66 -0
  6. package/dist/base.d.ts.map +1 -0
  7. package/dist/base.js +122 -0
  8. package/dist/base.js.map +1 -0
  9. package/dist/browser/acquire.d.ts +66 -0
  10. package/dist/browser/acquire.d.ts.map +1 -0
  11. package/dist/browser/acquire.js +109 -0
  12. package/dist/browser/acquire.js.map +1 -0
  13. package/dist/browser/cdp-page.d.ts +48 -0
  14. package/dist/browser/cdp-page.d.ts.map +1 -0
  15. package/dist/browser/cdp-page.js +165 -0
  16. package/dist/browser/cdp-page.js.map +1 -0
  17. package/dist/browser/cdp.d.ts +44 -0
  18. package/dist/browser/cdp.d.ts.map +1 -0
  19. package/dist/browser/cdp.js +252 -0
  20. package/dist/browser/cdp.js.map +1 -0
  21. package/dist/browser/launcher.d.ts +29 -0
  22. package/dist/browser/launcher.d.ts.map +1 -0
  23. package/dist/browser/launcher.js +157 -0
  24. package/dist/browser/launcher.js.map +1 -0
  25. package/dist/browser/stealth.d.ts +55 -0
  26. package/dist/browser/stealth.d.ts.map +1 -0
  27. package/dist/browser/stealth.js +170 -0
  28. package/dist/browser/stealth.js.map +1 -0
  29. package/dist/browser-network.d.ts +51 -0
  30. package/dist/browser-network.d.ts.map +1 -0
  31. package/dist/browser-network.js +175 -0
  32. package/dist/browser-network.js.map +1 -0
  33. package/dist/browser-paginated.d.ts +141 -0
  34. package/dist/browser-paginated.d.ts.map +1 -0
  35. package/dist/browser-paginated.js +269 -0
  36. package/dist/browser-paginated.js.map +1 -0
  37. package/dist/connector-runtime.d.ts +70 -0
  38. package/dist/connector-runtime.d.ts.map +1 -0
  39. package/dist/connector-runtime.js +48 -0
  40. package/dist/connector-runtime.js.map +1 -0
  41. package/dist/connector-types.d.ts +613 -0
  42. package/dist/connector-types.d.ts.map +1 -0
  43. package/dist/connector-types.js +27 -0
  44. package/dist/connector-types.js.map +1 -0
  45. package/dist/event-taxonomy.d.ts +3 -0
  46. package/dist/event-taxonomy.d.ts.map +1 -0
  47. package/dist/event-taxonomy.js +30 -0
  48. package/dist/event-taxonomy.js.map +1 -0
  49. package/dist/http.d.ts +18 -0
  50. package/dist/http.d.ts.map +1 -0
  51. package/dist/http.js +74 -0
  52. package/dist/http.js.map +1 -0
  53. package/dist/identity-normalize.d.ts +53 -0
  54. package/dist/identity-normalize.d.ts.map +1 -0
  55. package/dist/identity-normalize.js +146 -0
  56. package/dist/identity-normalize.js.map +1 -0
  57. package/dist/identity-types.d.ts +214 -0
  58. package/dist/identity-types.d.ts.map +1 -0
  59. package/dist/identity-types.js +217 -0
  60. package/dist/identity-types.js.map +1 -0
  61. package/dist/index.d.ts +37 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +33 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/logger.d.ts +7 -0
  66. package/dist/logger.d.ts.map +1 -0
  67. package/dist/logger.js +10 -0
  68. package/dist/logger.js.map +1 -0
  69. package/dist/paginated.d.ts +93 -0
  70. package/dist/paginated.d.ts.map +1 -0
  71. package/dist/paginated.js +167 -0
  72. package/dist/paginated.js.map +1 -0
  73. package/dist/reaction-sdk.d.ts +43 -0
  74. package/dist/reaction-sdk.d.ts.map +1 -0
  75. package/dist/reaction-sdk.js +9 -0
  76. package/dist/reaction-sdk.js.map +1 -0
  77. package/dist/retry.d.ts +19 -0
  78. package/dist/retry.d.ts.map +1 -0
  79. package/dist/retry.js +131 -0
  80. package/dist/retry.js.map +1 -0
  81. package/dist/scoring.d.ts +17 -0
  82. package/dist/scoring.d.ts.map +1 -0
  83. package/dist/scoring.js +28 -0
  84. package/dist/scoring.js.map +1 -0
  85. package/dist/types.d.ts +280 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +2 -0
  88. package/dist/types.js.map +1 -0
  89. package/dist/watcher-time.d.ts +14 -0
  90. package/dist/watcher-time.d.ts.map +1 -0
  91. package/dist/watcher-time.js +112 -0
  92. package/dist/watcher-time.js.map +1 -0
  93. package/package.json +59 -0
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Identity-engine SDK contracts.
3
+ *
4
+ * Connectors emit `ConnectorFact[]` for the authenticated subject; catalog
5
+ * YAMLs declare `AutoCreateWhenRule[]` on relationship types; the engine
6
+ * matches facts against rules and writes derivations.
7
+ *
8
+ * Schemas are TypeBox so they double as runtime validators at every write
9
+ * boundary (seeder, engine, MCP tools). Validation is mandatory — the
10
+ * collapsed model puts a lot in `metadata jsonb`, so without validation the
11
+ * engine silently corrupts on malformed input.
12
+ */
13
+ import { Type } from '@sinclair/typebox';
14
+ // =============================================================================
15
+ // Assurance levels
16
+ // =============================================================================
17
+ /**
18
+ * How strongly the connector vouches for a fact. Rules require a minimum
19
+ * assurance to fire. The order is total: `oauth_verified_admin_role` >
20
+ * `oauth_verified` > `cookie_session` > `self_attested`.
21
+ */
22
+ export const AssuranceLevel = Type.Union([
23
+ Type.Literal('oauth_verified_admin_role'),
24
+ Type.Literal('oauth_verified'),
25
+ Type.Literal('cookie_session'),
26
+ Type.Literal('self_attested'),
27
+ ], { $id: 'AssuranceLevel' });
28
+ const ASSURANCE_RANK = {
29
+ oauth_verified_admin_role: 4,
30
+ oauth_verified: 3,
31
+ cookie_session: 2,
32
+ self_attested: 1,
33
+ };
34
+ export function assuranceMeets(actual, required) {
35
+ return ASSURANCE_RANK[actual] >= ASSURANCE_RANK[required];
36
+ }
37
+ // =============================================================================
38
+ // ConnectorFact — what a connector emits
39
+ // =============================================================================
40
+ export const ConnectorFact = Type.Object({
41
+ /** The attribute kind. Each connector declares which namespaces it produces. */
42
+ namespace: Type.String({ minLength: 1, maxLength: 64 }),
43
+ /** Raw value as the provider returned it. Audit-friendly. */
44
+ identifier: Type.String({ minLength: 1, maxLength: 1024 }),
45
+ /**
46
+ * Canonicalised form used for index lookups. Connectors run normalize* on
47
+ * the value before emitting; the engine re-normalises defensively.
48
+ */
49
+ normalizedValue: Type.String({ minLength: 1, maxLength: 1024 }),
50
+ /** How the connector verified this fact. */
51
+ assurance: AssuranceLevel,
52
+ /**
53
+ * Provider's immutable account identifier — the primary binding key
54
+ * that survives email changes and account-row reissues.
55
+ */
56
+ providerStableId: Type.String({ minLength: 1, maxLength: 256 }),
57
+ /**
58
+ * Which connector account row produced this fact. Lets the engine diff
59
+ * facts per session for revocation.
60
+ */
61
+ sourceAccountId: Type.String({ minLength: 1, maxLength: 256 }),
62
+ /** ISO-8601 timestamp. Optional; required for high-assurance facts in production. */
63
+ validTo: Type.Optional(Type.String({ minLength: 1, maxLength: 64 })),
64
+ /**
65
+ * Optional human-readable note about trust caveats this fact carries.
66
+ * Surfaced in audit logs and admin UIs; never used by the engine.
67
+ */
68
+ notes: Type.Optional(Type.String({ maxLength: 512 })),
69
+ }, { $id: 'ConnectorFact', additionalProperties: false });
70
+ // =============================================================================
71
+ // ConnectorIdentityCapability — what a connector promises to emit
72
+ // =============================================================================
73
+ /**
74
+ * Each connector exports a static capability declaration. CI lints that the
75
+ * namespaces it actually emits at runtime are a subset of `produces`.
76
+ */
77
+ export const ConnectorIdentityCapability = Type.Object({
78
+ connectorKey: Type.String({ minLength: 1, maxLength: 64 }),
79
+ produces: Type.Array(Type.Object({
80
+ namespace: Type.String({ minLength: 1, maxLength: 64 }),
81
+ assurance: AssuranceLevel,
82
+ notes: Type.Optional(Type.String({ maxLength: 512 })),
83
+ }), { minItems: 0, maxItems: 32 }),
84
+ }, { $id: 'ConnectorIdentityCapability', additionalProperties: false });
85
+ // =============================================================================
86
+ // AutoCreateWhenRule — declared on relationship-type YAMLs, compiled into
87
+ // entity_relationship_types.metadata.auto_create_when[]
88
+ // =============================================================================
89
+ /**
90
+ * `unique_only` rejects ambiguity (writes a collision event for admin
91
+ * resolution); `all_matches` fans out to every match and is only safe for
92
+ * weak relationships. `first_match` is deliberately excluded — silently
93
+ * picking a winner on collision would open adoption-takeover paths.
94
+ */
95
+ export const MatchStrategy = Type.Union([Type.Literal('unique_only'), Type.Literal('all_matches')], { $id: 'MatchStrategy' });
96
+ export const AutoCreateWhenRule = Type.Object({
97
+ /** The fact namespace this rule listens for. */
98
+ sourceNamespace: Type.String({ minLength: 1, maxLength: 64 }),
99
+ /**
100
+ * The metadata field on the target entity-type whose normalized value
101
+ * must equal the fact's normalizedValue.
102
+ */
103
+ targetField: Type.String({ minLength: 1, maxLength: 64 }),
104
+ /**
105
+ * Minimum assurance the fact must carry to fire this rule. The engine
106
+ * enforces `assuranceMeets(fact.assurance, rule.assuranceRequired)`.
107
+ */
108
+ assuranceRequired: AssuranceLevel,
109
+ matchStrategy: MatchStrategy,
110
+ /**
111
+ * Optional notes for review tooling — not consumed by the engine.
112
+ */
113
+ notes: Type.Optional(Type.String({ maxLength: 512 })),
114
+ }, { $id: 'AutoCreateWhenRule', additionalProperties: false });
115
+ /**
116
+ * The shape stored on `entity_relationship_types.metadata`. Includes the
117
+ * declared rules plus a version+hash so derivations can pin to the rule
118
+ * version that fired them and reconciliation can detect drift.
119
+ */
120
+ export const RelationshipTypeIdentityMetadata = Type.Object({
121
+ autoCreateWhen: Type.Array(AutoCreateWhenRule, { maxItems: 16 }),
122
+ /** Monotonically increasing per relationship-type. Bumped by the seeder on every YAML change. */
123
+ ruleVersion: Type.Integer({ minimum: 1 }),
124
+ /** sha256 of the canonicalised auto_create_when array. Drift detection. */
125
+ ruleHash: Type.String({ minLength: 64, maxLength: 64 }),
126
+ }, { $id: 'RelationshipTypeIdentityMetadata', additionalProperties: true });
127
+ // =============================================================================
128
+ // Fact event metadata — written into events.metadata when the engine
129
+ // persists a connector fact as `semantic_type='identity_fact'`
130
+ // =============================================================================
131
+ /**
132
+ * Stored on `events.metadata` for `semantic_type='identity_fact'` rows.
133
+ *
134
+ * Tombstone facts (written when a connector refresh stops emitting a
135
+ * namespace) carry empty `identifier`/`normalizedValue`/`providerStableId`,
136
+ * which is why those fields allow empty strings here even though
137
+ * `ConnectorFact` (the connector-side input) requires non-empty.
138
+ */
139
+ export const FactEventMetadata = Type.Object({
140
+ namespace: Type.String({ minLength: 1, maxLength: 64 }),
141
+ identifier: Type.String({ minLength: 0, maxLength: 1024 }),
142
+ normalizedValue: Type.String({ minLength: 0, maxLength: 1024 }),
143
+ assurance: AssuranceLevel,
144
+ providerStableId: Type.String({ minLength: 0, maxLength: 256 }),
145
+ sourceAccountId: Type.String({ minLength: 1, maxLength: 256 }),
146
+ /** ISO-8601 timestamp string. Optional; required for high-assurance facts in production. */
147
+ validTo: Type.Optional(Type.String({ minLength: 1, maxLength: 64 })),
148
+ notes: Type.Optional(Type.String({ maxLength: 512 })),
149
+ }, { $id: 'FactEventMetadata', additionalProperties: false });
150
+ // =============================================================================
151
+ // DerivedFromProvenance — written into entity_relationships.metadata when
152
+ // the engine auto-creates a relationship
153
+ // =============================================================================
154
+ export const DerivedFromProvenance = Type.Object({
155
+ /** events.id of the fact that produced this derivation. */
156
+ sourceEventId: Type.Integer({ minimum: 1 }),
157
+ /** Which relationship-type rule fired (entity_relationship_types.id). */
158
+ relationshipTypeId: Type.Integer({ minimum: 1 }),
159
+ /** Snapshot of the rule version that fired. Drift signal for reconcile. */
160
+ ruleVersion: Type.Integer({ minimum: 1 }),
161
+ /** Hash matching ruleHash on the relationship-type at fire time. */
162
+ ruleHash: Type.String({ minLength: 64, maxLength: 64 }),
163
+ /** Echoed for fast assurance audits without joining back to the event. */
164
+ factAssurance: AssuranceLevel,
165
+ /** ISO-8601 timestamp. Echoes events.created_at; convenience for relationship-only audits. */
166
+ derivedAt: Type.String({ minLength: 1, maxLength: 64 }),
167
+ }, { $id: 'DerivedFromProvenance', additionalProperties: false });
168
+ /**
169
+ * The metadata blob stored on entity_relationships.metadata for derived
170
+ * rows. Closed shape — extra keys are rejected so the engine can never
171
+ * accidentally land junk alongside the provenance.
172
+ */
173
+ export const DerivedRelationshipMetadata = Type.Object({
174
+ derivedFrom: DerivedFromProvenance,
175
+ }, { $id: 'DerivedRelationshipMetadata', additionalProperties: false });
176
+ // =============================================================================
177
+ // ClaimCollision — pending-approval event payload
178
+ // =============================================================================
179
+ /**
180
+ * When a fact match would adopt a `$member` row that's already bound to a
181
+ * different user (or vice versa), the engine writes a pending-approval event
182
+ * with this shape. Resolution = a privileged user flips
183
+ * `interaction_status='approved'` after merging entities, or 'rejected' to
184
+ * dismiss without action.
185
+ */
186
+ export const ClaimCollisionPayload = Type.Object({
187
+ kind: Type.Literal('identity_match'),
188
+ namespace: Type.String({ minLength: 1, maxLength: 64 }),
189
+ identifier: Type.String({ minLength: 1, maxLength: 1024 }),
190
+ normalizedValue: Type.String({ minLength: 1, maxLength: 1024 }),
191
+ /**
192
+ * Catalog entity ids that all match this fact's normalized value.
193
+ * Despite the historical name suggesting `$member`, these are general
194
+ * catalog entities (founders, companies, etc.) — the resolver picks
195
+ * which one the user intends to claim.
196
+ */
197
+ candidateEntityIds: Type.Array(Type.Integer({ minimum: 1 }), {
198
+ minItems: 2,
199
+ maxItems: 16,
200
+ }),
201
+ /** Total number of matching candidates; candidateEntityIds may be capped for UI payload size. */
202
+ candidateCount: Type.Optional(Type.Integer({ minimum: 2 })),
203
+ /**
204
+ * Which fact (events.id) raised the collision. Lets the resolver replay
205
+ * the binding once the human picks a winner.
206
+ */
207
+ triggeringEventId: Type.Integer({ minimum: 1 }),
208
+ /** Rule that would have fired if the match were unambiguous. */
209
+ relationshipTypeId: Type.Optional(Type.Integer({ minimum: 1 })),
210
+ }, { $id: 'ClaimCollisionPayload', additionalProperties: false });
211
+ // =============================================================================
212
+ // Constants — used by core code AND connector tests so the lint check has
213
+ // a single source of truth.
214
+ // =============================================================================
215
+ export const IDENTITY_FACT_SEMANTIC_TYPE = 'identity_fact';
216
+ export const CLAIM_COLLISION_SEMANTIC_TYPE = 'claim_collision';
217
+ //# sourceMappingURL=identity-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity-types.js","sourceRoot":"","sources":["../src/identity-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAEtD,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CACtC;IACE,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;CAC9B,EACD,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAC1B,CAAC;AAGF,MAAM,cAAc,GAAmC;IACrD,yBAAyB,EAAE,CAAC;IAC5B,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,MAAsB,EAAE,QAAwB;IAC7E,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED,gFAAgF;AAChF,yCAAyC;AACzC,gFAAgF;AAEhF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CACtC;IACE,gFAAgF;IAChF,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACvD,6DAA6D;IAC7D,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC1D;;;OAGG;IACH,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,E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IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC1D,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC/D;;;;;OAKG;IACH,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE;QAC3D,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,iGAAiG;IACjG,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3D;;;OAGG;IACH,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAC/C,gEAAgE;IAChE,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;CAChE,EACD,EAAE,GAAG,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC9D,CAAC;AAGF,gFAAgF;AAChF,0EAA0E;AAC1E,4BAA4B;AAC5B,gFAAgF;AAEhF,MAAM,CAAC,MAAM,2BAA2B,GAAG,eAAwB,CAAC;AACpE,MAAM,CAAC,MAAM,6BAA6B,GAAG,iBAA0B,CAAC"}
@@ -0,0 +1,37 @@
1
+ export type { Static } from '@sinclair/typebox';
2
+ export { Type } from '@sinclair/typebox';
3
+ export type { KyInstance, Options } from 'ky';
4
+ export { default as ky, HTTPError } from 'ky';
5
+ export { ConnectorRuntime } from './connector-runtime.js';
6
+ export type { ActionContext, ActionDefinition, ActionResult, ApprovalStatus, AuthArtifact, AuthContext, AuthResult, Connection, ConnectorAuthBrowser, ConnectorAuthEnvField, ConnectorAuthEnvKeys, ConnectorAuthInteractive, ConnectorAuthMethod, ConnectorAuthNone, ConnectorAuthOAuth, ConnectorAuthSchema, ConnectorDefinition, ContentItem, EntityIdentitySpec, EntityLinkOverride, EntityLinkOverrides, EntityLinkRule, EntityTraitSpec, EventEnvelope, Feed, FeedDefinition, FeedMode, IdentityNamespace, Run, RunStatus, RunType, SyncContext, SyncCredentials, SyncResult, } from './connector-types.js';
7
+ export { IDENTITY } from './connector-types.js';
8
+ export { AssuranceLevel, assuranceMeets, AutoCreateWhenRule, CLAIM_COLLISION_SEMANTIC_TYPE, ClaimCollisionPayload, ConnectorFact, ConnectorIdentityCapability, DerivedFromProvenance, DerivedRelationshipMetadata, FactEventMetadata, IDENTITY_FACT_SEMANTIC_TYPE, MatchStrategy, RelationshipTypeIdentityMetadata, } from './identity-types.js';
9
+ export { isSourceNativeEventType, SOURCE_NATIVE_EVENT_TYPES } from './event-taxonomy.js';
10
+ export { createAuthenticatedClient, createHttpClient, httpClient, jsonHttpClient, } from './http.js';
11
+ export { normalizeAuthUserId, normalizeEmail, normalizeGithubLogin, normalizeGoogleContactId, normalizeIdentifier, normalizePhone, normalizeSlackUserId, normalizeWaJid, } from './identity-normalize.js';
12
+ export { sdkLogger, sdkLogger as logger } from './logger.js';
13
+ export { withHttpRetry } from './retry.js';
14
+ export { calculateEngagementScore } from './scoring.js';
15
+ export type { WatcherTimeGranularity } from './watcher-time.js';
16
+ export { addWatcherPeriod, alignToWatcherWindowStart, getAvailableWatcherGranularities, getFinerWatcherGranularities, getNextWatcherGranularity, getWatcherDateTruncUnit, inferWatcherGranularityFromDays, inferWatcherGranularityFromSchedule, isWatcherTimeGranularity, shiftWatcherPeriod, subtractWatcherPeriod, WATCHER_TIME_GRANULARITIES, } from './watcher-time.js';
17
+ export type { ApiSessionState } from './api-paginated.js';
18
+ export { ApiPaginatedFeed } from './api-paginated.js';
19
+ export { BaseFeed, RateLimitError } from './base.js';
20
+ export type { AcquireBrowserOptions, AcquiredBrowser } from './browser/acquire.js';
21
+ export { acquireBrowser, BrowserAuthCascadeError } from './browser/acquire.js';
22
+ export type { CdpVersionInfo, ResolveCdpOptions } from './browser/cdp.js';
23
+ export { discoverChromeListeningPorts, discoverChromeProcessCdpUrls, fetchCdpVersionInfo, normalizeCdpUrl, resolveCdpUrl, tryWebSocketCdp, } from './browser/cdp.js';
24
+ export { CdpPage } from './browser/cdp-page.js';
25
+ export type { BrowserLaunchOptions, EnhancedBrowser } from './browser/launcher.js';
26
+ export { captureErrorArtifacts, launchBrowser, withErrorCapture, } from './browser/launcher.js';
27
+ export type { StealthBrowser, StealthBrowserOptions } from './browser/stealth.js';
28
+ export { getRandomDelay, humanWait, launchStealthBrowser, randomScroll, testBotDetection, } from './browser/stealth.js';
29
+ export type { BrowserNetworkConfig, BrowserNetworkResult } from './browser-network.js';
30
+ export { browserNetworkSync } from './browser-network.js';
31
+ export type { BrowserFeedConfig, BrowserPaginationConfig, BrowserSessionState, CaptchaConfig, CookieConsentConfig, } from './browser-paginated.js';
32
+ export { BrowserPaginatedFeed } from './browser-paginated.js';
33
+ export type { PageFetchResult, PaginatedCheckpoint, PaginateResult, PaginationConfig, } from './paginated.js';
34
+ export { PaginatedFeed } from './paginated.js';
35
+ export type { ReactionContext, ReactionEntity } from './reaction-sdk.js';
36
+ export type { Checkpoint, Content, Env, FeedAuthBrowserMethod, FeedAuthEnvField, FeedAuthEnvKeysMethod, FeedAuthMethod, FeedAuthNoneMethod, FeedAuthOAuthMethod, FeedAuthSchema, FeedOptions, FeedSyncResult, IFeed, ParentFeedDefinition, ScoringConfig, SearchResult, SessionState, } from './types.js';
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AA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BAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzE,YAAY,EACV,UAAU,EACV,OAAO,EACP,GAAG,EACH,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,cAAc,EACd,KAAK,EACL,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ // =============================================================================
2
+ // V1 Integration Platform — Connector SDK
3
+ // =============================================================================
4
+ export { Type } from '@sinclair/typebox';
5
+ export { default as ky, HTTPError } from 'ky';
6
+ // Connector runtime & types (primary API)
7
+ export { ConnectorRuntime } from './connector-runtime.js';
8
+ export { IDENTITY } from './connector-types.js';
9
+ // Identity-engine SDK contracts. Each schema export is both a TypeBox
10
+ // runtime validator (value) AND a TypeScript type via declaration merging.
11
+ export { AssuranceLevel, assuranceMeets, AutoCreateWhenRule, CLAIM_COLLISION_SEMANTIC_TYPE, ClaimCollisionPayload, ConnectorFact, ConnectorIdentityCapability, DerivedFromProvenance, DerivedRelationshipMetadata, FactEventMetadata, IDENTITY_FACT_SEMANTIC_TYPE, MatchStrategy, RelationshipTypeIdentityMetadata, } from './identity-types.js';
12
+ export { isSourceNativeEventType, SOURCE_NATIVE_EVENT_TYPES } from './event-taxonomy.js';
13
+ // HTTP clients
14
+ export { createAuthenticatedClient, createHttpClient, httpClient, jsonHttpClient, } from './http.js';
15
+ export { normalizeAuthUserId, normalizeEmail, normalizeGithubLogin, normalizeGoogleContactId, normalizeIdentifier, normalizePhone, normalizeSlackUserId, normalizeWaJid, } from './identity-normalize.js';
16
+ // Logger
17
+ export { sdkLogger, sdkLogger as logger } from './logger.js';
18
+ // Retry
19
+ export { withHttpRetry } from './retry.js';
20
+ // Scoring
21
+ export { calculateEngagementScore } from './scoring.js';
22
+ export { addWatcherPeriod, alignToWatcherWindowStart, getAvailableWatcherGranularities, getFinerWatcherGranularities, getNextWatcherGranularity, getWatcherDateTruncUnit, inferWatcherGranularityFromDays, inferWatcherGranularityFromSchedule, isWatcherTimeGranularity, shiftWatcherPeriod, subtractWatcherPeriod, WATCHER_TIME_GRANULARITIES, } from './watcher-time.js';
23
+ export { ApiPaginatedFeed } from './api-paginated.js';
24
+ export { BaseFeed, RateLimitError } from './base.js';
25
+ export { acquireBrowser, BrowserAuthCascadeError } from './browser/acquire.js';
26
+ export { discoverChromeListeningPorts, discoverChromeProcessCdpUrls, fetchCdpVersionInfo, normalizeCdpUrl, resolveCdpUrl, tryWebSocketCdp, } from './browser/cdp.js';
27
+ export { CdpPage } from './browser/cdp-page.js';
28
+ export { captureErrorArtifacts, launchBrowser, withErrorCapture, } from './browser/launcher.js';
29
+ export { getRandomDelay, humanWait, launchStealthBrowser, randomScroll, testBotDetection, } from './browser/stealth.js';
30
+ export { browserNetworkSync } from './browser-network.js';
31
+ export { BrowserPaginatedFeed } from './browser-paginated.js';
32
+ export { PaginatedFeed } from './paginated.js';
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings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,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAO3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAQ1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import pino from 'pino';
2
+ /**
3
+ * SDK logger instance
4
+ * Uses its own pino instance, separate from the main app logger
5
+ */
6
+ export declare const sdkLogger: pino.Logger<never, boolean>;
7
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,SAAS,6BAGpB,CAAC"}
package/dist/logger.js ADDED
@@ -0,0 +1,10 @@
1
+ import pino from 'pino';
2
+ /**
3
+ * SDK logger instance
4
+ * Uses its own pino instance, separate from the main app logger
5
+ */
6
+ export const sdkLogger = pino({
7
+ name: 'connector-sdk',
8
+ level: process.env.LOG_LEVEL || 'info',
9
+ });
10
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;CACvC,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Paginated Feed Base Class
3
+ *
4
+ * Provides a reusable pagination pattern for feeds that fetch data in pages.
5
+ * Uses the template method pattern - subclasses implement specific methods while
6
+ * the base class handles the pagination loop, rate limiting, and checkpoint management.
7
+ */
8
+ import { BaseFeed } from './base.js';
9
+ import type { Checkpoint, Content, Env, FeedOptions } from './types.js';
10
+ /**
11
+ * Configuration for pagination behavior
12
+ */
13
+ export interface PaginationConfig {
14
+ /** Maximum pages to fetch (safety limit). Default: 50 */
15
+ maxPages: number;
16
+ /** Expected items per page (for partial page detection). Default: 100 */
17
+ pageSize: number;
18
+ /** Milliseconds to wait between page requests. Default: 1000 */
19
+ rateLimitMs: number;
20
+ /** Whether to update checkpoint after each page (for resume). Default: false */
21
+ incrementalCheckpoint: boolean;
22
+ }
23
+ /**
24
+ * Result from fetching a single page
25
+ */
26
+ export interface PageFetchResult<TItem> {
27
+ /** Items from this page */
28
+ items: TItem[];
29
+ /** Token/cursor for next page (null = no more pages) */
30
+ nextToken: string | null;
31
+ /** Optional: raw item count before any filtering (for logging) */
32
+ rawCount?: number;
33
+ }
34
+ /**
35
+ * Extended checkpoint interface with pagination token
36
+ */
37
+ export interface PaginatedCheckpoint extends Checkpoint {
38
+ /** Pagination token for resuming sync */
39
+ pagination_token?: string | null;
40
+ /** Whether initial sync completed (used to choose checkpoint boundary) */
41
+ initial_complete?: boolean;
42
+ }
43
+ /**
44
+ * Result from the paginate() method
45
+ */
46
+ export interface PaginateResult<TCheckpoint extends Checkpoint> {
47
+ contents: Content[];
48
+ checkpoint: TCheckpoint;
49
+ parentMap?: Map<string, string>;
50
+ nextSyncRecommendedAt?: Date;
51
+ }
52
+ /**
53
+ * Base class for feeds with cursor/page-based pagination
54
+ */
55
+ export declare abstract class PaginatedFeed<TItem, TCheckpoint extends PaginatedCheckpoint = PaginatedCheckpoint> extends BaseFeed {
56
+ /**
57
+ * Default pagination configuration
58
+ */
59
+ protected getPaginationConfig(): PaginationConfig;
60
+ /**
61
+ * ABSTRACT: Fetch a single page of items from the platform
62
+ */
63
+ protected abstract fetchPage(cursor: string | null, options: FeedOptions, env: Env): Promise<PageFetchResult<TItem>>;
64
+ /**
65
+ * ABSTRACT: Transform a platform item to Content format
66
+ */
67
+ protected abstract transformItem(item: TItem, options: FeedOptions): Content;
68
+ /**
69
+ * ABSTRACT: Extract published date from platform item
70
+ */
71
+ protected abstract getItemDate(item: TItem): Date;
72
+ /**
73
+ * OPTIONAL: Filter items before transformation
74
+ */
75
+ protected filterItem(_item: TItem, _options: FeedOptions): boolean;
76
+ /**
77
+ * OPTIONAL: Extract parent ID for hierarchical content
78
+ */
79
+ protected getParentId(_item: TItem): string | null;
80
+ /**
81
+ * OPTIONAL: Extract pagination token from checkpoint
82
+ */
83
+ protected getPaginationToken(checkpoint: TCheckpoint | null): string | null;
84
+ /**
85
+ * OPTIONAL: Create checkpoint with feed-specific fields
86
+ */
87
+ protected createCheckpoint(existing: TCheckpoint | null, latestContent: Content | null, nextToken: string | null, itemsProcessed: number): TCheckpoint;
88
+ /**
89
+ * Main pagination loop - handles both initial and incremental syncs
90
+ */
91
+ protected paginate(options: FeedOptions, checkpoint: TCheckpoint | null, env: Env, updateCheckpointFn?: (checkpoint: Checkpoint) => Promise<void>): Promise<PaginateResult<TCheckpoint>>;
92
+ }
93
+ //# sourceMappingURL=paginated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginated.d.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IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAElC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO;IAE5E;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI;IAEjD;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO;IAIlE;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI;IAIlD;;OAEG;IACH,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI;IAI3E;;OAEG;IACH,SAAS,CAAC,gBAAgB,CACxB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,aAAa,EAAE,OAAO,GAAG,IAAI,EAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,EAAE,MAAM,GACrB,WAAW;IAUd;;OAEG;cACa,QAAQ,CACtB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,WAAW,GAAG,IAAI,EAC9B,GAAG,EAAE,GAAG,EACR,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAC7D,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;CA6JxC"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Paginated Feed Base Class
3
+ *
4
+ * Provides a reusable pagination pattern for feeds that fetch data in pages.
5
+ * Uses the template method pattern - subclasses implement specific methods while
6
+ * the base class handles the pagination loop, rate limiting, and checkpoint management.
7
+ */
8
+ import { BaseFeed, RateLimitError } from './base.js';
9
+ import { sdkLogger } from './logger.js';
10
+ /**
11
+ * Base class for feeds with cursor/page-based pagination
12
+ */
13
+ export class PaginatedFeed extends BaseFeed {
14
+ /**
15
+ * Default pagination configuration
16
+ */
17
+ getPaginationConfig() {
18
+ return {
19
+ maxPages: 50,
20
+ pageSize: 100,
21
+ rateLimitMs: 1000,
22
+ incrementalCheckpoint: false,
23
+ };
24
+ }
25
+ /**
26
+ * OPTIONAL: Filter items before transformation
27
+ */
28
+ filterItem(_item, _options) {
29
+ return true;
30
+ }
31
+ /**
32
+ * OPTIONAL: Extract parent ID for hierarchical content
33
+ */
34
+ getParentId(_item) {
35
+ return null;
36
+ }
37
+ /**
38
+ * OPTIONAL: Extract pagination token from checkpoint
39
+ */
40
+ getPaginationToken(checkpoint) {
41
+ return checkpoint?.pagination_token ?? null;
42
+ }
43
+ /**
44
+ * OPTIONAL: Create checkpoint with feed-specific fields
45
+ */
46
+ createCheckpoint(existing, latestContent, nextToken, itemsProcessed) {
47
+ return {
48
+ updated_at: new Date(),
49
+ last_timestamp: latestContent?.occurred_at ?? existing?.last_timestamp,
50
+ pagination_token: nextToken,
51
+ total_items_processed: (existing?.total_items_processed || 0) + itemsProcessed,
52
+ initial_complete: existing?.initial_complete ?? false,
53
+ };
54
+ }
55
+ /**
56
+ * Main pagination loop - handles both initial and incremental syncs
57
+ */
58
+ async paginate(options, checkpoint, env, updateCheckpointFn) {
59
+ const config = this.getPaginationConfig();
60
+ const existingToken = this.getPaginationToken(checkpoint);
61
+ const parentMap = new Map();
62
+ const initialComplete = checkpoint?.initial_complete ?? (!!checkpoint?.last_timestamp && !existingToken);
63
+ const isIncremental = initialComplete && !existingToken;
64
+ const lookbackDate = this.getLookbackDate(options);
65
+ const checkpointTimestamp = checkpoint?.last_timestamp ?? null;
66
+ const checkpointDate = checkpointTimestamp
67
+ ? checkpointTimestamp instanceof Date
68
+ ? checkpointTimestamp
69
+ : new Date(checkpointTimestamp)
70
+ : null;
71
+ const boundaryDate = initialComplete && checkpointDate ? checkpointDate : lookbackDate;
72
+ const allContents = [];
73
+ let cursor = isIncremental ? null : existingToken;
74
+ let pageCount = 0;
75
+ let stopReason = null;
76
+ let rateLimitRetryMs;
77
+ const modeLabel = isIncremental ? 'incremental' : cursor ? 'resumed' : 'initial';
78
+ sdkLogger.info(`[${this.type}] Starting ${modeLabel} sync (max ${config.maxPages} pages)`);
79
+ while (pageCount < config.maxPages) {
80
+ if (pageCount > 0) {
81
+ await this.sleep(config.rateLimitMs);
82
+ }
83
+ let result;
84
+ try {
85
+ result = await this.fetchPage(cursor, options, env);
86
+ }
87
+ catch (error) {
88
+ if (error instanceof RateLimitError) {
89
+ sdkLogger.warn({ error: error.message }, `[${this.type}] Rate limit hit after ${pageCount} pages, pausing`);
90
+ stopReason = 'rate_limited';
91
+ rateLimitRetryMs = error.retryAfterMs;
92
+ break;
93
+ }
94
+ throw error;
95
+ }
96
+ const rawCount = result.rawCount ?? result.items.length;
97
+ if (result.items.length === 0) {
98
+ sdkLogger.info(`[${this.type}] Empty page at ${pageCount + 1}, stopping`);
99
+ stopReason = 'empty_page';
100
+ break;
101
+ }
102
+ const pageContents = [];
103
+ for (const item of result.items) {
104
+ if (!this.filterItem(item, options))
105
+ continue;
106
+ const content = this.transformItem(item, options);
107
+ pageContents.push(content);
108
+ const parentId = this.getParentId(item);
109
+ if (parentId) {
110
+ parentMap.set(content.origin_id, parentId);
111
+ if (!content.origin_parent_id) {
112
+ content.origin_parent_id = parentId;
113
+ }
114
+ }
115
+ }
116
+ const boundaryContents = pageContents.filter((c) => c.occurred_at >= boundaryDate);
117
+ allContents.push(...boundaryContents);
118
+ pageCount++;
119
+ sdkLogger.info(`[${this.type}] Page ${pageCount}: raw=${rawCount}, ` +
120
+ `filtered=${pageContents.length}, recent=${boundaryContents.length}, ` +
121
+ `nextToken=${result.nextToken ? 'yes' : 'no'}`);
122
+ if (config.incrementalCheckpoint && updateCheckpointFn && allContents.length > 0) {
123
+ const incrementalCP = this.createCheckpoint(checkpoint, allContents[0], result.nextToken, boundaryContents.length);
124
+ await updateCheckpointFn(incrementalCP);
125
+ sdkLogger.debug(`[${this.type}] Saved incremental checkpoint after page ${pageCount}`);
126
+ }
127
+ if (boundaryContents.length === 0 && pageContents.length > 0) {
128
+ sdkLogger.info(`[${this.type}] Reached boundary after ${pageCount} pages`);
129
+ stopReason = 'boundary';
130
+ break;
131
+ }
132
+ if (result.items.length < config.pageSize) {
133
+ sdkLogger.info(`[${this.type}] Partial page (${result.items.length}/${config.pageSize}), end reached`);
134
+ stopReason = 'partial_page';
135
+ break;
136
+ }
137
+ if (!result.nextToken) {
138
+ sdkLogger.info(`[${this.type}] No next token after page ${pageCount}, end reached`);
139
+ stopReason = 'no_next_token';
140
+ break;
141
+ }
142
+ cursor = result.nextToken;
143
+ }
144
+ if (!stopReason && pageCount >= config.maxPages) {
145
+ stopReason = 'max_pages';
146
+ }
147
+ if (stopReason === 'max_pages') {
148
+ sdkLogger.warn(`[${this.type}] Hit max page limit (${config.maxPages})`);
149
+ }
150
+ sdkLogger.info(`[${this.type}] Pagination complete: ${allContents.length} items from ${pageCount} pages`);
151
+ const resumeToken = stopReason === 'max_pages' || stopReason === 'rate_limited' ? cursor : null;
152
+ const shouldMarkComplete = initialComplete ||
153
+ (!initialComplete && stopReason !== 'max_pages' && stopReason !== 'rate_limited');
154
+ const nextSyncRecommendedAt = stopReason === 'rate_limited'
155
+ ? new Date(Date.now() + (rateLimitRetryMs ?? config.rateLimitMs))
156
+ : undefined;
157
+ const finalCheckpoint = this.createCheckpoint(checkpoint, allContents[0] || null, resumeToken, allContents.length);
158
+ finalCheckpoint.initial_complete = shouldMarkComplete;
159
+ return {
160
+ contents: allContents,
161
+ checkpoint: finalCheckpoint,
162
+ parentMap: parentMap.size > 0 ? parentMap : undefined,
163
+ nextSyncRecommendedAt,
164
+ };
165
+ }
166
+ }
167
+ //# sourceMappingURL=pagin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