@revenexx/integrations-node-devkit 0.2.0 → 0.2.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.
@@ -0,0 +1,194 @@
1
+ import { INodeContext, INodeAuthorContext, ICredentialContext, ICredentialResolveResult, ICredential, ICredentialTestResult } from '@revenexx/integrations-node-sdk';
2
+ import { vi } from 'vitest';
3
+
4
+ /**
5
+ * Drop-in replacement for the `createMockContext` helper that was, until this
6
+ * package existed, copy-pasted byte-for-byte into every node repo's
7
+ * `tests/helpers/context.ts`. Builds a full {@link INodeContext} with
8
+ * `vi.fn()`-backed `logger`, `secrets.get`, and `credentials.get` so a node's
9
+ * `execute` can be unit-tested in isolation.
10
+ */
11
+ type MockLogger = {
12
+ info: ReturnType<typeof vi.fn>;
13
+ warn: ReturnType<typeof vi.fn>;
14
+ error: ReturnType<typeof vi.fn>;
15
+ };
16
+ type MockSecrets = {
17
+ get: ReturnType<typeof vi.fn>;
18
+ };
19
+ type MockCredentials = {
20
+ get: ReturnType<typeof vi.fn>;
21
+ };
22
+ type MockContext = INodeContext & {
23
+ logger: MockLogger;
24
+ secrets: MockSecrets;
25
+ credentials: MockCredentials;
26
+ };
27
+ interface CreateMockContextOptions {
28
+ signal?: AbortSignal;
29
+ /** Secret key -> value returned by `secrets.get`. Unknown keys fall back to a deterministic stub. */
30
+ secrets?: Record<string, string>;
31
+ /** When set, `secrets.get` rejects with this error instead of resolving. */
32
+ secretsError?: Error;
33
+ /** Credential instance id -> resolved access data returned by `credentials.get`. */
34
+ credentials?: Record<string, Record<string, unknown>>;
35
+ /** When set, `credentials.get` rejects with this error instead of resolving. */
36
+ credentialsError?: Error;
37
+ }
38
+ declare function createMockContext(options?: CreateMockContextOptions): MockContext;
39
+
40
+ /**
41
+ * Builds an {@link INodeAuthorContext} for unit-testing a node's *author-time*
42
+ * resolvers (`loadOptions`, `resolveConfigSchema`, `resolveOutputs`). Until this
43
+ * package existed, this factory was reinvented inline in each repo's resolver
44
+ * tests. Mirrors {@link createMockContext}: `secrets.get` / `credentials.get`
45
+ * are `vi.fn()`-backed and seedable.
46
+ */
47
+ type MockAuthorLogger = {
48
+ info: ReturnType<typeof vi.fn>;
49
+ warn: ReturnType<typeof vi.fn>;
50
+ error: ReturnType<typeof vi.fn>;
51
+ };
52
+ type MockAuthorContext = INodeAuthorContext & {
53
+ logger: MockAuthorLogger;
54
+ secrets: {
55
+ get: ReturnType<typeof vi.fn>;
56
+ };
57
+ credentials: {
58
+ get: ReturnType<typeof vi.fn>;
59
+ };
60
+ };
61
+ interface CreateAuthorContextOptions {
62
+ signal?: AbortSignal;
63
+ /** Preferred locale for resolved labels. */
64
+ locale?: string;
65
+ secrets?: Record<string, string>;
66
+ secretsError?: Error;
67
+ credentials?: Record<string, Record<string, unknown>>;
68
+ credentialsError?: Error;
69
+ }
70
+ declare function createAuthorContext(config?: Record<string, unknown>, options?: CreateAuthorContextOptions): MockAuthorContext;
71
+
72
+ /**
73
+ * Utilities for stubbing the global `fetch` so a credential's `resolve` /
74
+ * `test` (which reach an OAuth token endpoint via the SDK's `postForm`) or a
75
+ * node's `execute` (which uses `safeFetch` → global `fetch`) can be
76
+ * unit-tested without touching the network. Builds real `Response` objects so
77
+ * `res.ok` / `res.status` / `res.text()` / `res.json()` all behave exactly as
78
+ * in production.
79
+ */
80
+ interface StubResponseInit {
81
+ status?: number;
82
+ headers?: Record<string, string>;
83
+ /** JSON body — serialized and served as `application/json` unless `body` is set. */
84
+ json?: unknown;
85
+ /** Raw string body. Takes precedence over `json`. */
86
+ body?: string;
87
+ }
88
+ interface StubbedRequest {
89
+ url: string;
90
+ method: string;
91
+ init?: RequestInit;
92
+ }
93
+ type FetchHandler = (request: StubbedRequest) => StubResponseInit | Response | Promise<StubResponseInit | Response>;
94
+ /** Builds a real `Response` from a {@link StubResponseInit}. */
95
+ declare function buildResponse(init: StubResponseInit): Response;
96
+ interface StubFetchResult {
97
+ /** The `vi.fn()` installed as `globalThis.fetch` — assert calls on it. */
98
+ fetchMock: ReturnType<typeof vi.fn>;
99
+ /** Restores the previous `globalThis.fetch`. */
100
+ restore(): void;
101
+ }
102
+ /**
103
+ * Replaces `globalThis.fetch` with a `vi.fn()` driven by `handler`. Pass a
104
+ * static {@link StubResponseInit} to answer every request identically, or a
105
+ * {@link FetchHandler} to branch on url/method. Call `restore()` when done
106
+ * (e.g. in `afterEach`).
107
+ */
108
+ declare function stubFetch(handler: FetchHandler | StubResponseInit): StubFetchResult;
109
+ interface FakeTokenEndpointOptions {
110
+ /** Only answer requests to this exact URL; other requests 404. Omit to answer any URL. */
111
+ tokenUrl?: string;
112
+ accessToken?: string;
113
+ tokenType?: string;
114
+ /** Seconds until expiry (OAuth `expires_in`). Set `null` to omit the field. */
115
+ expiresIn?: number | null;
116
+ /** Included as `refresh_token` when set (e.g. to assert rotation). */
117
+ refreshToken?: string;
118
+ /** Extra fields merged into the token response body. */
119
+ extra?: Record<string, unknown>;
120
+ }
121
+ /**
122
+ * A {@link FetchHandler} that emulates an OAuth token endpoint, returning
123
+ * `{ access_token, token_type, expires_in, refresh_token? }`. Compose with
124
+ * {@link stubFetch} to unit-test `oauth2-*` credentials' `resolve` / OAuth
125
+ * `exchangeCode`.
126
+ */
127
+ declare function fakeTokenEndpoint(options?: FakeTokenEndpointOptions): FetchHandler;
128
+
129
+ /**
130
+ * Harness for unit-testing a credential type's `test` / `resolve` / 3-legged
131
+ * OAuth without the credentials broker or a real provider. Combine with
132
+ * {@link stubFetch} / {@link fakeTokenEndpoint} to drive the token endpoint,
133
+ * and inspect the returned `persistDurableCreds` spy to assert refresh-token
134
+ * rotation.
135
+ */
136
+ type MockCredentialLogger = {
137
+ info: ReturnType<typeof vi.fn>;
138
+ warn: ReturnType<typeof vi.fn>;
139
+ error: ReturnType<typeof vi.fn>;
140
+ };
141
+ type MockCredentialContext = ICredentialContext & {
142
+ logger: MockCredentialLogger;
143
+ /** Spy wired to `ctx.persistDurableCreds`; assert `.toHaveBeenCalledWith(...)`. */
144
+ persistDurableCreds: ReturnType<typeof vi.fn>;
145
+ };
146
+ interface CreateCredentialContextOptions {
147
+ signal?: AbortSignal;
148
+ }
149
+ declare function createCredentialContext(options?: CreateCredentialContextOptions): MockCredentialContext;
150
+ interface RunCredentialTestOptions {
151
+ config: Record<string, unknown>;
152
+ signal?: AbortSignal;
153
+ }
154
+ /** Runs a credential's `test(ctx, config)` and returns its result. */
155
+ declare function runCredentialTest(credential: ICredential, options: RunCredentialTestOptions): Promise<ICredentialTestResult>;
156
+ interface RunCredentialResolveOptions {
157
+ config: Record<string, unknown>;
158
+ /** System-managed long-lived secrets (e.g. an OAuth `refresh_token`). */
159
+ durableCreds?: Record<string, unknown> | null;
160
+ signal?: AbortSignal;
161
+ }
162
+ interface RunCredentialResolveResult {
163
+ result: ICredentialResolveResult;
164
+ /** Spy wired to `ctx.persistDurableCreds` — assert rotation happened. */
165
+ persistDurableCreds: ReturnType<typeof vi.fn>;
166
+ /** The context used, for further assertions (logger calls, etc.). */
167
+ ctx: MockCredentialContext;
168
+ }
169
+ /** Runs a credential's `resolve(ctx, config, durableCreds)` and captures rotation. */
170
+ declare function runCredentialResolve(credential: ICredential, options: RunCredentialResolveOptions): Promise<RunCredentialResolveResult>;
171
+ interface RunOAuthAuthorizeUrlOptions {
172
+ config: Record<string, unknown>;
173
+ redirectUri: string;
174
+ state: string;
175
+ signal?: AbortSignal;
176
+ }
177
+ /** Runs `buildAuthorizeUrl` on a 3-legged OAuth credential; throws if unsupported. */
178
+ declare function runOAuthAuthorizeUrl(credential: ICredential, options: RunOAuthAuthorizeUrlOptions): Promise<{
179
+ authorizeUrl: string;
180
+ codeVerifier?: string;
181
+ }>;
182
+ interface RunOAuthExchangeCodeOptions {
183
+ config: Record<string, unknown>;
184
+ code: string;
185
+ redirectUri: string;
186
+ codeVerifier?: string;
187
+ signal?: AbortSignal;
188
+ }
189
+ /** Runs `exchangeCode` on a 3-legged OAuth credential; throws if unsupported. */
190
+ declare function runOAuthExchangeCode(credential: ICredential, options: RunOAuthExchangeCodeOptions): Promise<{
191
+ durableCreds: Record<string, unknown>;
192
+ }>;
193
+
194
+ export { type CreateAuthorContextOptions, type CreateCredentialContextOptions, type CreateMockContextOptions, type FakeTokenEndpointOptions, type FetchHandler, type MockAuthorContext, type MockAuthorLogger, type MockContext, type MockCredentialContext, type MockCredentialLogger, type MockCredentials, type MockLogger, type MockSecrets, type RunCredentialResolveOptions, type RunCredentialResolveResult, type RunCredentialTestOptions, type RunOAuthAuthorizeUrlOptions, type RunOAuthExchangeCodeOptions, type StubFetchResult, type StubResponseInit, type StubbedRequest, buildResponse, createAuthorContext, createCredentialContext, createMockContext, fakeTokenEndpoint, runCredentialResolve, runCredentialTest, runOAuthAuthorizeUrl, runOAuthExchangeCode, stubFetch };
@@ -0,0 +1,194 @@
1
+ import { INodeContext, INodeAuthorContext, ICredentialContext, ICredentialResolveResult, ICredential, ICredentialTestResult } from '@revenexx/integrations-node-sdk';
2
+ import { vi } from 'vitest';
3
+
4
+ /**
5
+ * Drop-in replacement for the `createMockContext` helper that was, until this
6
+ * package existed, copy-pasted byte-for-byte into every node repo's
7
+ * `tests/helpers/context.ts`. Builds a full {@link INodeContext} with
8
+ * `vi.fn()`-backed `logger`, `secrets.get`, and `credentials.get` so a node's
9
+ * `execute` can be unit-tested in isolation.
10
+ */
11
+ type MockLogger = {
12
+ info: ReturnType<typeof vi.fn>;
13
+ warn: ReturnType<typeof vi.fn>;
14
+ error: ReturnType<typeof vi.fn>;
15
+ };
16
+ type MockSecrets = {
17
+ get: ReturnType<typeof vi.fn>;
18
+ };
19
+ type MockCredentials = {
20
+ get: ReturnType<typeof vi.fn>;
21
+ };
22
+ type MockContext = INodeContext & {
23
+ logger: MockLogger;
24
+ secrets: MockSecrets;
25
+ credentials: MockCredentials;
26
+ };
27
+ interface CreateMockContextOptions {
28
+ signal?: AbortSignal;
29
+ /** Secret key -> value returned by `secrets.get`. Unknown keys fall back to a deterministic stub. */
30
+ secrets?: Record<string, string>;
31
+ /** When set, `secrets.get` rejects with this error instead of resolving. */
32
+ secretsError?: Error;
33
+ /** Credential instance id -> resolved access data returned by `credentials.get`. */
34
+ credentials?: Record<string, Record<string, unknown>>;
35
+ /** When set, `credentials.get` rejects with this error instead of resolving. */
36
+ credentialsError?: Error;
37
+ }
38
+ declare function createMockContext(options?: CreateMockContextOptions): MockContext;
39
+
40
+ /**
41
+ * Builds an {@link INodeAuthorContext} for unit-testing a node's *author-time*
42
+ * resolvers (`loadOptions`, `resolveConfigSchema`, `resolveOutputs`). Until this
43
+ * package existed, this factory was reinvented inline in each repo's resolver
44
+ * tests. Mirrors {@link createMockContext}: `secrets.get` / `credentials.get`
45
+ * are `vi.fn()`-backed and seedable.
46
+ */
47
+ type MockAuthorLogger = {
48
+ info: ReturnType<typeof vi.fn>;
49
+ warn: ReturnType<typeof vi.fn>;
50
+ error: ReturnType<typeof vi.fn>;
51
+ };
52
+ type MockAuthorContext = INodeAuthorContext & {
53
+ logger: MockAuthorLogger;
54
+ secrets: {
55
+ get: ReturnType<typeof vi.fn>;
56
+ };
57
+ credentials: {
58
+ get: ReturnType<typeof vi.fn>;
59
+ };
60
+ };
61
+ interface CreateAuthorContextOptions {
62
+ signal?: AbortSignal;
63
+ /** Preferred locale for resolved labels. */
64
+ locale?: string;
65
+ secrets?: Record<string, string>;
66
+ secretsError?: Error;
67
+ credentials?: Record<string, Record<string, unknown>>;
68
+ credentialsError?: Error;
69
+ }
70
+ declare function createAuthorContext(config?: Record<string, unknown>, options?: CreateAuthorContextOptions): MockAuthorContext;
71
+
72
+ /**
73
+ * Utilities for stubbing the global `fetch` so a credential's `resolve` /
74
+ * `test` (which reach an OAuth token endpoint via the SDK's `postForm`) or a
75
+ * node's `execute` (which uses `safeFetch` → global `fetch`) can be
76
+ * unit-tested without touching the network. Builds real `Response` objects so
77
+ * `res.ok` / `res.status` / `res.text()` / `res.json()` all behave exactly as
78
+ * in production.
79
+ */
80
+ interface StubResponseInit {
81
+ status?: number;
82
+ headers?: Record<string, string>;
83
+ /** JSON body — serialized and served as `application/json` unless `body` is set. */
84
+ json?: unknown;
85
+ /** Raw string body. Takes precedence over `json`. */
86
+ body?: string;
87
+ }
88
+ interface StubbedRequest {
89
+ url: string;
90
+ method: string;
91
+ init?: RequestInit;
92
+ }
93
+ type FetchHandler = (request: StubbedRequest) => StubResponseInit | Response | Promise<StubResponseInit | Response>;
94
+ /** Builds a real `Response` from a {@link StubResponseInit}. */
95
+ declare function buildResponse(init: StubResponseInit): Response;
96
+ interface StubFetchResult {
97
+ /** The `vi.fn()` installed as `globalThis.fetch` — assert calls on it. */
98
+ fetchMock: ReturnType<typeof vi.fn>;
99
+ /** Restores the previous `globalThis.fetch`. */
100
+ restore(): void;
101
+ }
102
+ /**
103
+ * Replaces `globalThis.fetch` with a `vi.fn()` driven by `handler`. Pass a
104
+ * static {@link StubResponseInit} to answer every request identically, or a
105
+ * {@link FetchHandler} to branch on url/method. Call `restore()` when done
106
+ * (e.g. in `afterEach`).
107
+ */
108
+ declare function stubFetch(handler: FetchHandler | StubResponseInit): StubFetchResult;
109
+ interface FakeTokenEndpointOptions {
110
+ /** Only answer requests to this exact URL; other requests 404. Omit to answer any URL. */
111
+ tokenUrl?: string;
112
+ accessToken?: string;
113
+ tokenType?: string;
114
+ /** Seconds until expiry (OAuth `expires_in`). Set `null` to omit the field. */
115
+ expiresIn?: number | null;
116
+ /** Included as `refresh_token` when set (e.g. to assert rotation). */
117
+ refreshToken?: string;
118
+ /** Extra fields merged into the token response body. */
119
+ extra?: Record<string, unknown>;
120
+ }
121
+ /**
122
+ * A {@link FetchHandler} that emulates an OAuth token endpoint, returning
123
+ * `{ access_token, token_type, expires_in, refresh_token? }`. Compose with
124
+ * {@link stubFetch} to unit-test `oauth2-*` credentials' `resolve` / OAuth
125
+ * `exchangeCode`.
126
+ */
127
+ declare function fakeTokenEndpoint(options?: FakeTokenEndpointOptions): FetchHandler;
128
+
129
+ /**
130
+ * Harness for unit-testing a credential type's `test` / `resolve` / 3-legged
131
+ * OAuth without the credentials broker or a real provider. Combine with
132
+ * {@link stubFetch} / {@link fakeTokenEndpoint} to drive the token endpoint,
133
+ * and inspect the returned `persistDurableCreds` spy to assert refresh-token
134
+ * rotation.
135
+ */
136
+ type MockCredentialLogger = {
137
+ info: ReturnType<typeof vi.fn>;
138
+ warn: ReturnType<typeof vi.fn>;
139
+ error: ReturnType<typeof vi.fn>;
140
+ };
141
+ type MockCredentialContext = ICredentialContext & {
142
+ logger: MockCredentialLogger;
143
+ /** Spy wired to `ctx.persistDurableCreds`; assert `.toHaveBeenCalledWith(...)`. */
144
+ persistDurableCreds: ReturnType<typeof vi.fn>;
145
+ };
146
+ interface CreateCredentialContextOptions {
147
+ signal?: AbortSignal;
148
+ }
149
+ declare function createCredentialContext(options?: CreateCredentialContextOptions): MockCredentialContext;
150
+ interface RunCredentialTestOptions {
151
+ config: Record<string, unknown>;
152
+ signal?: AbortSignal;
153
+ }
154
+ /** Runs a credential's `test(ctx, config)` and returns its result. */
155
+ declare function runCredentialTest(credential: ICredential, options: RunCredentialTestOptions): Promise<ICredentialTestResult>;
156
+ interface RunCredentialResolveOptions {
157
+ config: Record<string, unknown>;
158
+ /** System-managed long-lived secrets (e.g. an OAuth `refresh_token`). */
159
+ durableCreds?: Record<string, unknown> | null;
160
+ signal?: AbortSignal;
161
+ }
162
+ interface RunCredentialResolveResult {
163
+ result: ICredentialResolveResult;
164
+ /** Spy wired to `ctx.persistDurableCreds` — assert rotation happened. */
165
+ persistDurableCreds: ReturnType<typeof vi.fn>;
166
+ /** The context used, for further assertions (logger calls, etc.). */
167
+ ctx: MockCredentialContext;
168
+ }
169
+ /** Runs a credential's `resolve(ctx, config, durableCreds)` and captures rotation. */
170
+ declare function runCredentialResolve(credential: ICredential, options: RunCredentialResolveOptions): Promise<RunCredentialResolveResult>;
171
+ interface RunOAuthAuthorizeUrlOptions {
172
+ config: Record<string, unknown>;
173
+ redirectUri: string;
174
+ state: string;
175
+ signal?: AbortSignal;
176
+ }
177
+ /** Runs `buildAuthorizeUrl` on a 3-legged OAuth credential; throws if unsupported. */
178
+ declare function runOAuthAuthorizeUrl(credential: ICredential, options: RunOAuthAuthorizeUrlOptions): Promise<{
179
+ authorizeUrl: string;
180
+ codeVerifier?: string;
181
+ }>;
182
+ interface RunOAuthExchangeCodeOptions {
183
+ config: Record<string, unknown>;
184
+ code: string;
185
+ redirectUri: string;
186
+ codeVerifier?: string;
187
+ signal?: AbortSignal;
188
+ }
189
+ /** Runs `exchangeCode` on a 3-legged OAuth credential; throws if unsupported. */
190
+ declare function runOAuthExchangeCode(credential: ICredential, options: RunOAuthExchangeCodeOptions): Promise<{
191
+ durableCreds: Record<string, unknown>;
192
+ }>;
193
+
194
+ export { type CreateAuthorContextOptions, type CreateCredentialContextOptions, type CreateMockContextOptions, type FakeTokenEndpointOptions, type FetchHandler, type MockAuthorContext, type MockAuthorLogger, type MockContext, type MockCredentialContext, type MockCredentialLogger, type MockCredentials, type MockLogger, type MockSecrets, type RunCredentialResolveOptions, type RunCredentialResolveResult, type RunCredentialTestOptions, type RunOAuthAuthorizeUrlOptions, type RunOAuthExchangeCodeOptions, type StubFetchResult, type StubResponseInit, type StubbedRequest, buildResponse, createAuthorContext, createCredentialContext, createMockContext, fakeTokenEndpoint, runCredentialResolve, runCredentialTest, runOAuthAuthorizeUrl, runOAuthExchangeCode, stubFetch };
@@ -0,0 +1,179 @@
1
+ // src/testing/context.ts
2
+ import { vi } from "vitest";
3
+ function createMockContext(options = {}) {
4
+ const signal = options.signal ?? new AbortController().signal;
5
+ const secretsGet = options.secretsError ? vi.fn(async () => {
6
+ throw options.secretsError;
7
+ }) : vi.fn(async (key) => {
8
+ if (options.secrets && key in options.secrets) {
9
+ return options.secrets[key];
10
+ }
11
+ return `secret-value-for-${key}`;
12
+ });
13
+ const credentialsGet = options.credentialsError ? vi.fn(async () => {
14
+ throw options.credentialsError;
15
+ }) : vi.fn(async (id) => {
16
+ if (options.credentials && id in options.credentials) {
17
+ return options.credentials[id];
18
+ }
19
+ return {};
20
+ });
21
+ return {
22
+ signal,
23
+ logger: {
24
+ info: vi.fn(),
25
+ warn: vi.fn(),
26
+ error: vi.fn()
27
+ },
28
+ secrets: {
29
+ get: secretsGet
30
+ },
31
+ credentials: {
32
+ get: credentialsGet
33
+ }
34
+ };
35
+ }
36
+
37
+ // src/testing/author.ts
38
+ import { vi as vi2 } from "vitest";
39
+ function createAuthorContext(config = {}, options = {}) {
40
+ const signal = options.signal ?? new AbortController().signal;
41
+ const secretsGet = options.secretsError ? vi2.fn(async () => {
42
+ throw options.secretsError;
43
+ }) : vi2.fn(async (key) => {
44
+ if (options.secrets && key in options.secrets) {
45
+ return options.secrets[key];
46
+ }
47
+ return `secret-value-for-${key}`;
48
+ });
49
+ const credentialsGet = options.credentialsError ? vi2.fn(async () => {
50
+ throw options.credentialsError;
51
+ }) : vi2.fn(async (id) => {
52
+ if (options.credentials && id in options.credentials) {
53
+ return options.credentials[id];
54
+ }
55
+ return {};
56
+ });
57
+ return {
58
+ signal,
59
+ logger: {
60
+ info: vi2.fn(),
61
+ warn: vi2.fn(),
62
+ error: vi2.fn()
63
+ },
64
+ config,
65
+ secrets: { get: secretsGet },
66
+ credentials: { get: credentialsGet },
67
+ locale: options.locale
68
+ };
69
+ }
70
+
71
+ // src/testing/fetch.ts
72
+ import { vi as vi3 } from "vitest";
73
+ function buildResponse(init) {
74
+ const headers = new Headers(init.headers ?? {});
75
+ let body;
76
+ if (init.body !== void 0) {
77
+ body = init.body;
78
+ } else if (init.json !== void 0) {
79
+ body = JSON.stringify(init.json);
80
+ if (!headers.has("content-type")) {
81
+ headers.set("content-type", "application/json");
82
+ }
83
+ }
84
+ return new Response(body, { status: init.status ?? 200, headers });
85
+ }
86
+ function stubFetch(handler) {
87
+ const previous = globalThis.fetch;
88
+ const resolveInit = typeof handler === "function" ? handler : () => handler;
89
+ const fetchMock = vi3.fn(async (input, init) => {
90
+ const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
91
+ const method = (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
92
+ const out = await resolveInit({ url, method, init });
93
+ return out instanceof Response ? out : buildResponse(out);
94
+ });
95
+ globalThis.fetch = fetchMock;
96
+ return {
97
+ fetchMock,
98
+ restore() {
99
+ globalThis.fetch = previous;
100
+ }
101
+ };
102
+ }
103
+ function fakeTokenEndpoint(options = {}) {
104
+ const { tokenUrl, accessToken = "fake-access-token", tokenType = "Bearer", expiresIn = 3600, refreshToken, extra } = options;
105
+ return ({ url }) => {
106
+ if (tokenUrl && url !== tokenUrl) {
107
+ return { status: 404, json: { error: `no stub for ${url}` } };
108
+ }
109
+ const json = {
110
+ access_token: accessToken,
111
+ token_type: tokenType,
112
+ ...expiresIn !== null ? { expires_in: expiresIn } : {},
113
+ ...refreshToken !== void 0 ? { refresh_token: refreshToken } : {},
114
+ ...extra
115
+ };
116
+ return { status: 200, json };
117
+ };
118
+ }
119
+
120
+ // src/testing/credentials.ts
121
+ import { isOAuthAuthorizeCredential } from "@revenexx/integrations-node-sdk";
122
+ import { vi as vi4 } from "vitest";
123
+ function createCredentialContext(options = {}) {
124
+ const signal = options.signal ?? new AbortController().signal;
125
+ const persistDurableCreds = vi4.fn(async (_durableCreds) => {
126
+ });
127
+ return {
128
+ signal,
129
+ logger: {
130
+ info: vi4.fn(),
131
+ warn: vi4.fn(),
132
+ error: vi4.fn()
133
+ },
134
+ persistDurableCreds
135
+ };
136
+ }
137
+ async function runCredentialTest(credential, options) {
138
+ const ctx = createCredentialContext({ signal: options.signal });
139
+ return credential.test(ctx, options.config);
140
+ }
141
+ async function runCredentialResolve(credential, options) {
142
+ const ctx = createCredentialContext({ signal: options.signal });
143
+ const result = await credential.resolve(ctx, options.config, options.durableCreds ?? null);
144
+ return { result, persistDurableCreds: ctx.persistDurableCreds, ctx };
145
+ }
146
+ async function runOAuthAuthorizeUrl(credential, options) {
147
+ if (!isOAuthAuthorizeCredential(credential)) {
148
+ throw new Error(`${credential.description.slug} is not a 3-legged OAuth credential`);
149
+ }
150
+ const ctx = createCredentialContext({ signal: options.signal });
151
+ return credential.buildAuthorizeUrl(ctx, options.config, {
152
+ redirectUri: options.redirectUri,
153
+ state: options.state
154
+ });
155
+ }
156
+ async function runOAuthExchangeCode(credential, options) {
157
+ if (!isOAuthAuthorizeCredential(credential)) {
158
+ throw new Error(`${credential.description.slug} is not a 3-legged OAuth credential`);
159
+ }
160
+ const ctx = createCredentialContext({ signal: options.signal });
161
+ return credential.exchangeCode(ctx, options.config, {
162
+ code: options.code,
163
+ redirectUri: options.redirectUri,
164
+ codeVerifier: options.codeVerifier
165
+ });
166
+ }
167
+ export {
168
+ buildResponse,
169
+ createAuthorContext,
170
+ createCredentialContext,
171
+ createMockContext,
172
+ fakeTokenEndpoint,
173
+ runCredentialResolve,
174
+ runCredentialTest,
175
+ runOAuthAuthorizeUrl,
176
+ runOAuthExchangeCode,
177
+ stubFetch
178
+ };
179
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/testing/context.ts","../../src/testing/author.ts","../../src/testing/fetch.ts","../../src/testing/credentials.ts"],"sourcesContent":["import type { INodeContext } from '@revenexx/integrations-node-sdk';\nimport { vi } from 'vitest';\n\n/**\n * Drop-in replacement for the `createMockContext` helper that was, until this\n * package existed, copy-pasted byte-for-byte into every node repo's\n * `tests/helpers/context.ts`. Builds a full {@link INodeContext} with\n * `vi.fn()`-backed `logger`, `secrets.get`, and `credentials.get` so a node's\n * `execute` can be unit-tested in isolation.\n */\n\nexport type MockLogger = {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n};\n\nexport type MockSecrets = {\n get: ReturnType<typeof vi.fn>;\n};\n\nexport type MockCredentials = {\n get: ReturnType<typeof vi.fn>;\n};\n\nexport type MockContext = INodeContext & {\n logger: MockLogger;\n secrets: MockSecrets;\n credentials: MockCredentials;\n};\n\nexport interface CreateMockContextOptions {\n signal?: AbortSignal;\n /** Secret key -> value returned by `secrets.get`. Unknown keys fall back to a deterministic stub. */\n secrets?: Record<string, string>;\n /** When set, `secrets.get` rejects with this error instead of resolving. */\n secretsError?: Error;\n /** Credential instance id -> resolved access data returned by `credentials.get`. */\n credentials?: Record<string, Record<string, unknown>>;\n /** When set, `credentials.get` rejects with this error instead of resolving. */\n credentialsError?: Error;\n}\n\nexport function createMockContext(options: CreateMockContextOptions = {}): MockContext {\n const signal = options.signal ?? new AbortController().signal;\n\n const secretsGet = options.secretsError\n ? vi.fn(async () => {\n throw options.secretsError;\n })\n : vi.fn(async (key: string) => {\n if (options.secrets && key in options.secrets) {\n return options.secrets[key];\n }\n return `secret-value-for-${key}`;\n });\n\n const credentialsGet = options.credentialsError\n ? vi.fn(async () => {\n throw options.credentialsError;\n })\n : vi.fn(async (id: string) => {\n if (options.credentials && id in options.credentials) {\n return options.credentials[id];\n }\n return {};\n });\n\n return {\n signal,\n logger: {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n },\n secrets: {\n get: secretsGet,\n },\n credentials: {\n get: credentialsGet,\n },\n };\n}\n","import type { INodeAuthorContext } from '@revenexx/integrations-node-sdk';\nimport { vi } from 'vitest';\n\n/**\n * Builds an {@link INodeAuthorContext} for unit-testing a node's *author-time*\n * resolvers (`loadOptions`, `resolveConfigSchema`, `resolveOutputs`). Until this\n * package existed, this factory was reinvented inline in each repo's resolver\n * tests. Mirrors {@link createMockContext}: `secrets.get` / `credentials.get`\n * are `vi.fn()`-backed and seedable.\n */\n\nexport type MockAuthorLogger = {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n};\n\nexport type MockAuthorContext = INodeAuthorContext & {\n logger: MockAuthorLogger;\n secrets: { get: ReturnType<typeof vi.fn> };\n credentials: { get: ReturnType<typeof vi.fn> };\n};\n\nexport interface CreateAuthorContextOptions {\n signal?: AbortSignal;\n /** Preferred locale for resolved labels. */\n locale?: string;\n secrets?: Record<string, string>;\n secretsError?: Error;\n credentials?: Record<string, Record<string, unknown>>;\n credentialsError?: Error;\n}\n\nexport function createAuthorContext(config: Record<string, unknown> = {}, options: CreateAuthorContextOptions = {}): MockAuthorContext {\n const signal = options.signal ?? new AbortController().signal;\n\n const secretsGet = options.secretsError\n ? vi.fn(async () => {\n throw options.secretsError;\n })\n : vi.fn(async (key: string) => {\n if (options.secrets && key in options.secrets) {\n return options.secrets[key];\n }\n return `secret-value-for-${key}`;\n });\n\n const credentialsGet = options.credentialsError\n ? vi.fn(async () => {\n throw options.credentialsError;\n })\n : vi.fn(async (id: string) => {\n if (options.credentials && id in options.credentials) {\n return options.credentials[id];\n }\n return {};\n });\n\n return {\n signal,\n logger: {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n },\n config,\n secrets: { get: secretsGet },\n credentials: { get: credentialsGet },\n locale: options.locale,\n };\n}\n","import { vi } from 'vitest';\n\n/**\n * Utilities for stubbing the global `fetch` so a credential's `resolve` /\n * `test` (which reach an OAuth token endpoint via the SDK's `postForm`) or a\n * node's `execute` (which uses `safeFetch` → global `fetch`) can be\n * unit-tested without touching the network. Builds real `Response` objects so\n * `res.ok` / `res.status` / `res.text()` / `res.json()` all behave exactly as\n * in production.\n */\n\nexport interface StubResponseInit {\n status?: number;\n headers?: Record<string, string>;\n /** JSON body — serialized and served as `application/json` unless `body` is set. */\n json?: unknown;\n /** Raw string body. Takes precedence over `json`. */\n body?: string;\n}\n\nexport interface StubbedRequest {\n url: string;\n method: string;\n init?: RequestInit;\n}\n\nexport type FetchHandler = (request: StubbedRequest) => StubResponseInit | Response | Promise<StubResponseInit | Response>;\n\n/** Builds a real `Response` from a {@link StubResponseInit}. */\nexport function buildResponse(init: StubResponseInit): Response {\n const headers = new Headers(init.headers ?? {});\n let body: string | undefined;\n if (init.body !== undefined) {\n body = init.body;\n } else if (init.json !== undefined) {\n body = JSON.stringify(init.json);\n if (!headers.has('content-type')) {\n headers.set('content-type', 'application/json');\n }\n }\n return new Response(body, { status: init.status ?? 200, headers });\n}\n\nexport interface StubFetchResult {\n /** The `vi.fn()` installed as `globalThis.fetch` — assert calls on it. */\n fetchMock: ReturnType<typeof vi.fn>;\n /** Restores the previous `globalThis.fetch`. */\n restore(): void;\n}\n\n/**\n * Replaces `globalThis.fetch` with a `vi.fn()` driven by `handler`. Pass a\n * static {@link StubResponseInit} to answer every request identically, or a\n * {@link FetchHandler} to branch on url/method. Call `restore()` when done\n * (e.g. in `afterEach`).\n */\nexport function stubFetch(handler: FetchHandler | StubResponseInit): StubFetchResult {\n const previous = globalThis.fetch;\n const resolveInit: FetchHandler = typeof handler === 'function' ? handler : () => handler;\n\n const fetchMock = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {\n const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;\n const method = (init?.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase();\n const out = await resolveInit({ url, method, init });\n return out instanceof Response ? out : buildResponse(out);\n });\n\n globalThis.fetch = fetchMock as unknown as typeof fetch;\n return {\n fetchMock,\n restore() {\n globalThis.fetch = previous;\n },\n };\n}\n\nexport interface FakeTokenEndpointOptions {\n /** Only answer requests to this exact URL; other requests 404. Omit to answer any URL. */\n tokenUrl?: string;\n accessToken?: string;\n tokenType?: string;\n /** Seconds until expiry (OAuth `expires_in`). Set `null` to omit the field. */\n expiresIn?: number | null;\n /** Included as `refresh_token` when set (e.g. to assert rotation). */\n refreshToken?: string;\n /** Extra fields merged into the token response body. */\n extra?: Record<string, unknown>;\n}\n\n/**\n * A {@link FetchHandler} that emulates an OAuth token endpoint, returning\n * `{ access_token, token_type, expires_in, refresh_token? }`. Compose with\n * {@link stubFetch} to unit-test `oauth2-*` credentials' `resolve` / OAuth\n * `exchangeCode`.\n */\nexport function fakeTokenEndpoint(options: FakeTokenEndpointOptions = {}): FetchHandler {\n const { tokenUrl, accessToken = 'fake-access-token', tokenType = 'Bearer', expiresIn = 3600, refreshToken, extra } = options;\n\n return ({ url }) => {\n if (tokenUrl && url !== tokenUrl) {\n return { status: 404, json: { error: `no stub for ${url}` } };\n }\n const json: Record<string, unknown> = {\n access_token: accessToken,\n token_type: tokenType,\n ...(expiresIn !== null ? { expires_in: expiresIn } : {}),\n ...(refreshToken !== undefined ? { refresh_token: refreshToken } : {}),\n ...extra,\n };\n return { status: 200, json };\n };\n}\n","import type { ICredential, ICredentialContext, ICredentialResolveResult, ICredentialTestResult } from '@revenexx/integrations-node-sdk';\nimport { isOAuthAuthorizeCredential } from '@revenexx/integrations-node-sdk';\nimport { vi } from 'vitest';\n\n/**\n * Harness for unit-testing a credential type's `test` / `resolve` / 3-legged\n * OAuth without the credentials broker or a real provider. Combine with\n * {@link stubFetch} / {@link fakeTokenEndpoint} to drive the token endpoint,\n * and inspect the returned `persistDurableCreds` spy to assert refresh-token\n * rotation.\n */\n\nexport type MockCredentialLogger = {\n info: ReturnType<typeof vi.fn>;\n warn: ReturnType<typeof vi.fn>;\n error: ReturnType<typeof vi.fn>;\n};\n\nexport type MockCredentialContext = ICredentialContext & {\n logger: MockCredentialLogger;\n /** Spy wired to `ctx.persistDurableCreds`; assert `.toHaveBeenCalledWith(...)`. */\n persistDurableCreds: ReturnType<typeof vi.fn>;\n};\n\nexport interface CreateCredentialContextOptions {\n signal?: AbortSignal;\n}\n\nexport function createCredentialContext(options: CreateCredentialContextOptions = {}): MockCredentialContext {\n const signal = options.signal ?? new AbortController().signal;\n const persistDurableCreds = vi.fn(async (_durableCreds: Record<string, unknown>) => {});\n return {\n signal,\n logger: {\n info: vi.fn(),\n warn: vi.fn(),\n error: vi.fn(),\n },\n persistDurableCreds,\n };\n}\n\nexport interface RunCredentialTestOptions {\n config: Record<string, unknown>;\n signal?: AbortSignal;\n}\n\n/** Runs a credential's `test(ctx, config)` and returns its result. */\nexport async function runCredentialTest(credential: ICredential, options: RunCredentialTestOptions): Promise<ICredentialTestResult> {\n const ctx = createCredentialContext({ signal: options.signal });\n return credential.test(ctx, options.config);\n}\n\nexport interface RunCredentialResolveOptions {\n config: Record<string, unknown>;\n /** System-managed long-lived secrets (e.g. an OAuth `refresh_token`). */\n durableCreds?: Record<string, unknown> | null;\n signal?: AbortSignal;\n}\n\nexport interface RunCredentialResolveResult {\n result: ICredentialResolveResult;\n /** Spy wired to `ctx.persistDurableCreds` — assert rotation happened. */\n persistDurableCreds: ReturnType<typeof vi.fn>;\n /** The context used, for further assertions (logger calls, etc.). */\n ctx: MockCredentialContext;\n}\n\n/** Runs a credential's `resolve(ctx, config, durableCreds)` and captures rotation. */\nexport async function runCredentialResolve(credential: ICredential, options: RunCredentialResolveOptions): Promise<RunCredentialResolveResult> {\n const ctx = createCredentialContext({ signal: options.signal });\n const result = await credential.resolve(ctx, options.config, options.durableCreds ?? null);\n return { result, persistDurableCreds: ctx.persistDurableCreds, ctx };\n}\n\nexport interface RunOAuthAuthorizeUrlOptions {\n config: Record<string, unknown>;\n redirectUri: string;\n state: string;\n signal?: AbortSignal;\n}\n\n/** Runs `buildAuthorizeUrl` on a 3-legged OAuth credential; throws if unsupported. */\nexport async function runOAuthAuthorizeUrl(credential: ICredential, options: RunOAuthAuthorizeUrlOptions): Promise<{ authorizeUrl: string; codeVerifier?: string }> {\n if (!isOAuthAuthorizeCredential(credential)) {\n throw new Error(`${credential.description.slug} is not a 3-legged OAuth credential`);\n }\n const ctx = createCredentialContext({ signal: options.signal });\n return credential.buildAuthorizeUrl(ctx, options.config, {\n redirectUri: options.redirectUri,\n state: options.state,\n });\n}\n\nexport interface RunOAuthExchangeCodeOptions {\n config: Record<string, unknown>;\n code: string;\n redirectUri: string;\n codeVerifier?: string;\n signal?: AbortSignal;\n}\n\n/** Runs `exchangeCode` on a 3-legged OAuth credential; throws if unsupported. */\nexport async function runOAuthExchangeCode(credential: ICredential, options: RunOAuthExchangeCodeOptions): Promise<{ durableCreds: Record<string, unknown> }> {\n if (!isOAuthAuthorizeCredential(credential)) {\n throw new Error(`${credential.description.slug} is not a 3-legged OAuth credential`);\n }\n const ctx = createCredentialContext({ signal: options.signal });\n return credential.exchangeCode(ctx, options.config, {\n code: options.code,\n redirectUri: options.redirectUri,\n codeVerifier: options.codeVerifier,\n });\n}\n"],"mappings":";AACA,SAAS,UAAU;AA0CZ,SAAS,kBAAkB,UAAoC,CAAC,GAAgB;AACrF,QAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,EAAE;AAEvD,QAAM,aAAa,QAAQ,eACvB,GAAG,GAAG,YAAY;AAChB,UAAM,QAAQ;AAAA,EAChB,CAAC,IACD,GAAG,GAAG,OAAO,QAAgB;AAC3B,QAAI,QAAQ,WAAW,OAAO,QAAQ,SAAS;AAC7C,aAAO,QAAQ,QAAQ,GAAG;AAAA,IAC5B;AACA,WAAO,oBAAoB,GAAG;AAAA,EAChC,CAAC;AAEL,QAAM,iBAAiB,QAAQ,mBAC3B,GAAG,GAAG,YAAY;AAChB,UAAM,QAAQ;AAAA,EAChB,CAAC,IACD,GAAG,GAAG,OAAO,OAAe;AAC1B,QAAI,QAAQ,eAAe,MAAM,QAAQ,aAAa;AACpD,aAAO,QAAQ,YAAY,EAAE;AAAA,IAC/B;AACA,WAAO,CAAC;AAAA,EACV,CAAC;AAEL,SAAO;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,MACN,MAAM,GAAG,GAAG;AAAA,MACZ,MAAM,GAAG,GAAG;AAAA,MACZ,OAAO,GAAG,GAAG;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACP,KAAK;AAAA,IACP;AAAA,IACA,aAAa;AAAA,MACX,KAAK;AAAA,IACP;AAAA,EACF;AACF;;;ACjFA,SAAS,MAAAA,WAAU;AAgCZ,SAAS,oBAAoB,SAAkC,CAAC,GAAG,UAAsC,CAAC,GAAsB;AACrI,QAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,EAAE;AAEvD,QAAM,aAAa,QAAQ,eACvBA,IAAG,GAAG,YAAY;AAChB,UAAM,QAAQ;AAAA,EAChB,CAAC,IAC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-node-devkit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local development kit for Revenexx integration node packages — a mock Integrations API for previewing nodes/credentials/templates in the Cockpit UI, plus a unit-testing harness. Dev/CI only, never bundled.",
5
5
  "keywords": [
6
6
  "revenexx",
@@ -53,6 +53,7 @@
53
53
  "lint": "biome check src tests",
54
54
  "format": "biome format --write src tests",
55
55
  "typecheck": "tsc --noEmit -p tsconfig.test.json",
56
+ "prepublishOnly": "npm run build",
56
57
  "release": "changeset publish"
57
58
  },
58
59
  "dependencies": {