@remnic/core 9.3.532 → 9.3.534

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 (44) hide show
  1. package/dist/access-cli.js +5 -5
  2. package/dist/access-http.d.ts +1 -1
  3. package/dist/access-mcp.d.ts +1 -1
  4. package/dist/access-service.d.ts +1 -1
  5. package/dist/bootstrap.d.ts +1 -1
  6. package/dist/{chunk-CWWMTTQE.js → chunk-6GUG4YNM.js} +44 -1
  7. package/dist/{chunk-CWWMTTQE.js.map → chunk-6GUG4YNM.js.map} +1 -1
  8. package/dist/{chunk-QRMZX3PR.js → chunk-KLZDGMDI.js} +5 -5
  9. package/dist/{chunk-KCLX6LOV.js → chunk-SRAF4TIS.js} +4 -4
  10. package/dist/{chunk-BECQDWBA.js → chunk-TQNRI55H.js} +35 -2
  11. package/dist/chunk-TQNRI55H.js.map +1 -0
  12. package/dist/{chunk-QMYXNM4P.js → chunk-VU3SVYMA.js} +3 -3
  13. package/dist/{cli-CPe_2KB1.d.ts → cli-9pwA_PXm.d.ts} +1 -1
  14. package/dist/cli.d.ts +3 -3
  15. package/dist/cli.js +3 -3
  16. package/dist/{connectors-cli-DbTPNj2H.d.ts → connectors-cli-2iaQ5tX2.d.ts} +1 -1
  17. package/dist/connectors-cli.d.ts +2 -2
  18. package/dist/explicit-capture.d.ts +1 -1
  19. package/dist/{framework-CyHYDcri.d.ts → framework-CNDn2164.d.ts} +24 -7
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +18 -14
  22. package/dist/index.js.map +1 -1
  23. package/dist/live-connectors-runner.d.ts +1 -1
  24. package/dist/live-connectors-runner.js +3 -3
  25. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  26. package/dist/orchestrator.d.ts +1 -1
  27. package/dist/orchestrator.js +5 -5
  28. package/dist/schemas.d.ts +22 -22
  29. package/dist/{state-store-4QZISH3J.js → state-store-Z3EN56O5.js} +2 -2
  30. package/dist/transfer/types.d.ts +12 -12
  31. package/package.json +1 -1
  32. package/src/connectors/live/framework.ts +71 -6
  33. package/src/connectors/live/github.ts +10 -0
  34. package/src/connectors/live/gmail.ts +10 -0
  35. package/src/connectors/live/google-drive.ts +12 -4
  36. package/src/connectors/live/index.ts +2 -0
  37. package/src/connectors/live/live-connectors.test.ts +141 -0
  38. package/src/connectors/live/notion.ts +8 -0
  39. package/src/index.ts +2 -0
  40. package/dist/chunk-BECQDWBA.js.map +0 -1
  41. /package/dist/{chunk-QRMZX3PR.js.map → chunk-KLZDGMDI.js.map} +0 -0
  42. /package/dist/{chunk-KCLX6LOV.js.map → chunk-SRAF4TIS.js.map} +0 -0
  43. /package/dist/{chunk-QMYXNM4P.js.map → chunk-VU3SVYMA.js.map} +0 -0
  44. /package/dist/{state-store-4QZISH3J.js.map → state-store-Z3EN56O5.js.map} +0 -0
@@ -6,6 +6,10 @@ import test from "node:test";
6
6
 
7
7
  import {
8
8
  CONNECTOR_ID_PATTERN,
9
+ createGitHubConnector,
10
+ createGmailConnector,
11
+ createGoogleDriveConnector,
12
+ createNotionConnector,
9
13
  type ConnectorConfig,
10
14
  type ConnectorCursor,
11
15
  type ConnectorDocument,
@@ -13,6 +17,8 @@ import {
13
17
  type LiveConnector,
14
18
  LiveConnectorRegistry,
15
19
  LiveConnectorRegistryError,
20
+ persistableConnectorConfig,
21
+ redactConnectorConfigSecrets,
16
22
  type SyncIncrementalArgs,
17
23
  type SyncIncrementalResult,
18
24
  isValidConnectorId,
@@ -21,6 +27,10 @@ import {
21
27
  withConnectorStateLock,
22
28
  writeConnectorState,
23
29
  } from "./index.js";
30
+ import {
31
+ persistableConnectorConfig as persistableConnectorConfigFromRoot,
32
+ redactConnectorConfigSecrets as redactConnectorConfigSecretsFromRoot,
33
+ } from "../../index.js";
24
34
  import {
25
35
  _connectorStatePathForTest,
26
36
  _refreshConnectorLockForTest,
@@ -122,6 +132,137 @@ test("CONNECTOR_ID_PATTERN matches isValidConnectorId", () => {
122
132
  assert.ok(!CONNECTOR_ID_PATTERN.test("Drive"));
123
133
  });
124
134
 
135
+ test("redactConnectorConfigSecrets removes nested secret-shaped keys", () => {
136
+ assert.deepEqual(
137
+ redactConnectorConfigSecrets({
138
+ endpoint: "https://example.invalid",
139
+ authorization: "Bearer synthetic-token",
140
+ authHeader: "Basic synthetic-credentials",
141
+ authorName: "kept",
142
+ nested: {
143
+ accessToken: "synthetic-token",
144
+ cookieHeader: "sid=synthetic-session",
145
+ publicLabel: "kept",
146
+ },
147
+ list: [
148
+ { clientSecret: "synthetic-secret", sessionCookie: "synthetic-cookie", label: "kept" },
149
+ ],
150
+ }),
151
+ {
152
+ endpoint: "https://example.invalid",
153
+ authorName: "kept",
154
+ nested: {
155
+ publicLabel: "kept",
156
+ },
157
+ list: [{ label: "kept" }],
158
+ }
159
+ );
160
+ });
161
+
162
+ test("persisted-config helpers are exported from the package root", () => {
163
+ assert.equal(persistableConnectorConfigFromRoot, persistableConnectorConfig);
164
+ assert.equal(redactConnectorConfigSecretsFromRoot, redactConnectorConfigSecrets);
165
+ });
166
+
167
+ test("built-in live connectors expose persistable config without credential material", () => {
168
+ const cases: Array<{
169
+ connector: LiveConnector;
170
+ raw: ConnectorConfig;
171
+ secretKeys: readonly string[];
172
+ secretValues: readonly string[];
173
+ expected: ConnectorConfig;
174
+ }> = [
175
+ {
176
+ connector: createGitHubConnector(),
177
+ raw: {
178
+ token: "synthetic-github-token",
179
+ userLogin: "octocat",
180
+ repos: ["owner/repo"],
181
+ pollIntervalMs: 300_000,
182
+ includeDiscussions: true,
183
+ },
184
+ secretKeys: ["token"],
185
+ secretValues: ["synthetic-github-token"],
186
+ expected: {
187
+ userLogin: "octocat",
188
+ repos: ["owner/repo"],
189
+ pollIntervalMs: 300_000,
190
+ includeDiscussions: true,
191
+ },
192
+ },
193
+ {
194
+ connector: createGmailConnector(),
195
+ raw: {
196
+ clientId: "synthetic-gmail-client-id",
197
+ clientSecret: "synthetic-gmail-client-secret",
198
+ refreshToken: "synthetic-gmail-refresh-token",
199
+ userId: "me",
200
+ query: "in:inbox",
201
+ pollIntervalMs: 300_000,
202
+ },
203
+ secretKeys: ["clientSecret", "refreshToken"],
204
+ secretValues: ["synthetic-gmail-client-secret", "synthetic-gmail-refresh-token"],
205
+ expected: {
206
+ clientId: "synthetic-gmail-client-id",
207
+ userId: "me",
208
+ query: "in:inbox",
209
+ pollIntervalMs: 300_000,
210
+ },
211
+ },
212
+ {
213
+ connector: createGoogleDriveConnector(),
214
+ raw: {
215
+ clientId: "synthetic-drive-client-id",
216
+ clientSecret: "synthetic-drive-client-secret",
217
+ refreshToken: "synthetic-drive-refresh-token",
218
+ folderIds: ["folder_12345678"],
219
+ pollIntervalMs: 300_000,
220
+ },
221
+ secretKeys: ["clientSecret", "refreshToken"],
222
+ secretValues: ["synthetic-drive-client-secret", "synthetic-drive-refresh-token"],
223
+ expected: {
224
+ clientId: "synthetic-drive-client-id",
225
+ folderIds: ["folder_12345678"],
226
+ pollIntervalMs: 300_000,
227
+ },
228
+ },
229
+ {
230
+ connector: createNotionConnector(),
231
+ raw: {
232
+ token: "secret_synthetic-notion-token",
233
+ databaseIds: ["0123456789abcdef0123456789abcdef"],
234
+ pollIntervalMs: 300_000,
235
+ },
236
+ secretKeys: ["token"],
237
+ secretValues: ["secret_synthetic-notion-token"],
238
+ expected: {
239
+ databaseIds: ["0123456789abcdef0123456789abcdef"],
240
+ pollIntervalMs: 300_000,
241
+ },
242
+ },
243
+ ];
244
+
245
+ for (const testCase of cases) {
246
+ const runtimeConfig = testCase.connector.validateConfig(testCase.raw);
247
+ for (const key of testCase.secretKeys) {
248
+ assert.ok(key in runtimeConfig, `${testCase.connector.id} runtime config should keep ${key}`);
249
+ }
250
+
251
+ const persisted = persistableConnectorConfig(testCase.connector, runtimeConfig);
252
+ assert.deepEqual(persisted, testCase.expected);
253
+ const persistedJson = JSON.stringify(persisted);
254
+ for (const key of testCase.secretKeys) {
255
+ assert.ok(!(key in persisted), `${testCase.connector.id} persisted config should omit ${key}`);
256
+ }
257
+ for (const value of testCase.secretValues) {
258
+ assert.ok(
259
+ !persistedJson.includes(value),
260
+ `${testCase.connector.id} persisted config leaked ${value}`,
261
+ );
262
+ }
263
+ }
264
+ });
265
+
125
266
  // ───────────────────────────────────────────────────────────────────────────
126
267
  // Registry
127
268
  // ───────────────────────────────────────────────────────────────────────────
@@ -643,6 +643,14 @@ export function createNotionConnector(
643
643
  return validateNotionConfig(raw) as unknown as ConnectorConfig;
644
644
  },
645
645
 
646
+ persistConfig(validated: ConnectorConfig): ConnectorConfig {
647
+ const config = validateNotionConfig(validated);
648
+ return Object.freeze({
649
+ databaseIds: config.databaseIds,
650
+ pollIntervalMs: config.pollIntervalMs,
651
+ });
652
+ },
653
+
646
654
  async syncIncremental(args: SyncIncrementalArgs): Promise<SyncIncrementalResult> {
647
655
  const config = validateNotionConfig(args.config);
648
656
  throwIfAborted(args.abortSignal);
package/src/index.ts CHANGED
@@ -794,6 +794,8 @@ export { coerceInstallExtension } from "./connectors/coerce.js";
794
794
  export {
795
795
  CONNECTOR_ID_PATTERN,
796
796
  isValidConnectorId,
797
+ persistableConnectorConfig,
798
+ redactConnectorConfigSecrets,
797
799
  LiveConnectorRegistry,
798
800
  LiveConnectorRegistryError,
799
801
  listConnectorStates,