@nangohq/runner-sdk 0.71.4 → 0.71.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,72 +1,10 @@
1
1
  import type { ProxyConfiguration } from './action.js';
2
2
  import type { ZodCheckpoint, ZodMetadata, ZodModel } from './types.js';
3
3
  import type { UncontrolledFetchOptions } from './uncontrolledFetch.js';
4
- import type { AllAuthCredentials, EnvironmentVariable, FunctionCapabilities, FunctionConcurrencyLimit, FunctionRequires, FunctionTriggerDefinition, GetPublicConnection, GetPublicIntegration, HTTP_METHOD, MaybePromise, MergingStrategy, OnEventType, SdkLogger } from '@nangohq/types';
4
+ import type { AllAuthCredentials, EnvironmentVariable, FunctionCapabilities, FunctionConcurrencyLimit, FunctionRequires, FunctionTriggerDefinition, GetPublicConnection, GetPublicIntegration, MaybePromise, MergingStrategy, SdkLogger, Trigger } from '@nangohq/types';
5
5
  import type * as z from 'zod';
6
- export type { DebounceKeySource, DebounceOptions, FunctionRequires, FunctionTriggerDefinition } from '@nangohq/types';
6
+ export type { CoalescedInfo, DebounceKeySource, DebounceOptions, EventTrigger, FunctionRequires, FunctionTriggerDefinition, HttpRequest, HttpTrigger, InvokeTrigger, ScheduleTrigger, Trigger } from '@nangohq/types';
7
7
  type InferZod<T> = T extends z.ZodTypeAny ? z.infer<T> : never;
8
- export interface HttpRequest {
9
- method: HTTP_METHOD;
10
- path: string;
11
- headers: Record<string, string>;
12
- query: Record<string, string>;
13
- body: unknown;
14
- }
15
- export interface CoalescedInfo {
16
- count: number;
17
- firstSeenAt: Date;
18
- lastSeenAt: Date;
19
- }
20
- type HttpPayload<TT, TInput extends z.ZodTypeAny> = TT extends {
21
- debounce: {
22
- take: 'all';
23
- };
24
- } ? z.infer<TInput>[] : z.infer<TInput>;
25
- interface TriggerBase {
26
- /**
27
- * Present when the run carries connection context (invoke calls may pass one;
28
- * http/event may resolve one). Undefined for connection-less runs.
29
- */
30
- connection?: {
31
- connection_id: string;
32
- integrationId: string;
33
- };
34
- }
35
- export type InvokeTrigger<TInput extends z.ZodTypeAny> = TriggerBase & {
36
- kind: 'invoke';
37
- input: z.infer<TInput>;
38
- };
39
- export type ScheduleTrigger = TriggerBase & {
40
- kind: 'schedule';
41
- input: null;
42
- };
43
- export type HttpTrigger<TT, TInput extends z.ZodTypeAny> = TriggerBase & {
44
- kind: 'http';
45
- input: HttpPayload<TT, TInput>;
46
- request: HttpRequest;
47
- subscriptions?: string[];
48
- coalesced: CoalescedInfo;
49
- };
50
- export type EventTrigger = TriggerBase & {
51
- kind: 'event';
52
- input: {
53
- event: OnEventType;
54
- };
55
- };
56
- /**
57
- * The runtime trigger a function `exec` receives. Any function can be invoked by another, but an
58
- * invoke reuses the declared trigger's shape rather than adding a separate arrival — so `exec` only
59
- * ever sees its declared kind and never has to discriminate. On the invoke path the runtime
60
- * synthesizes the envelope (e.g. an http `request`/`coalesced` derived from the invoked input).
61
- * A function with no declared trigger is invoke-only and receives `InvokeTrigger`.
62
- */
63
- export type Trigger<TT extends FunctionTriggerDefinition | undefined, TInput extends z.ZodTypeAny> = TT extends {
64
- kind: 'schedule';
65
- } ? ScheduleTrigger : TT extends {
66
- kind: 'http';
67
- } ? HttpTrigger<TT, TInput> : TT extends {
68
- kind: 'event';
69
- } ? EventTrigger : InvokeTrigger<TInput>;
70
8
  export interface NangoBase {
71
9
  log(message: string, options?: unknown): Promise<void>;
72
10
  setLogger(logger: SdkLogger): void;
@@ -173,7 +111,7 @@ export interface CreateFunctionProps<TModels extends Record<string, ZodModel> =
173
111
  } ? 1 : FunctionConcurrencyLimit;
174
112
  };
175
113
  };
176
- exec: (nango: Nango<TModels, TMetadata, TCheckpoint, TRequires>, trigger: Trigger<TTrigger, TInput>) => MaybePromise<z.infer<TOutput>>;
114
+ exec: (nango: Nango<TModels, TMetadata, TCheckpoint, TRequires>, trigger: Trigger<TTrigger, z.infer<TInput>>) => MaybePromise<z.infer<TOutput>>;
177
115
  }
178
116
  export interface CreateFunctionResponse<TModels extends Record<string, ZodModel> = Record<never, ZodModel>, TInput extends z.ZodTypeAny = z.ZodVoid, TOutput extends z.ZodTypeAny = z.ZodVoid, TMetadata extends ZodMetadata = undefined, TCheckpoint extends ZodCheckpoint = undefined, TTrigger extends FunctionTriggerDefinition | undefined = undefined, TRequires extends FunctionRequires = {
179
117
  outbound: true;
@@ -1 +1 @@
1
- {"version":3,"file":"function.js","sourceRoot":"","sources":["../lib/function.ts"],"names":[],"mappings":"AAqOA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAS1B,MAAkG;IAElG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,0BAA0B,CAAC,MAG1C;IACG,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IACnC,4FAA4F;IAC5F,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,UAAU,KAAK,KAAK,CAAC;IAC7D,OAAO;QACH,WAAW,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;QACvD,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU;QAC1C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ;QACrC,YAAY,EAAE,CAAC,cAAc,IAAI,MAAM,CAAC,QAAQ,EAAE,QAAQ,KAAK,KAAK;QACpE,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;KAC/C,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../lib/function.ts"],"names":[],"mappings":"AA2LA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAS1B,MAAkG;IAElG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,0BAA0B,CAAC,MAG1C;IACG,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IACnC,4FAA4F;IAC5F,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,EAAE,UAAU,KAAK,KAAK,CAAC;IAC7D,OAAO;QACH,WAAW,EAAE,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;QACvD,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU;QAC1C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ;QACrC,YAAY,EAAE,CAAC,cAAc,IAAI,MAAM,CAAC,QAAQ,EAAE,QAAQ,KAAK,KAAK;QACpE,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;KAC/C,CAAC;AACN,CAAC"}
package/dist/scripts.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import type { NangoActionBase } from './action.js';
2
+ import type { CreateFunctionResponse, FunctionRequires, FunctionTriggerDefinition } from './function.js';
2
3
  import type { NangoSyncBase } from './sync.js';
3
4
  import type { ZodCheckpoint, ZodMetadata, ZodModel } from './types.js';
4
5
  import type { NangoSyncEndpointV2 } from '@nangohq/types';
5
6
  import type { MaybePromise } from 'rollup';
6
7
  import type * as z from 'zod';
7
- export type CreateAnyResponse = CreateSyncResponse<any, ZodMetadata, ZodCheckpoint> | CreateActionResponse<any, any, ZodMetadata, ZodCheckpoint> | CreateOnEventResponse<ZodMetadata, ZodCheckpoint>;
8
+ type CreateAnyFunctionResponse = CreateFunctionResponse<Record<string, ZodModel>, z.ZodTypeAny, z.ZodTypeAny, ZodMetadata, ZodCheckpoint, FunctionTriggerDefinition | undefined, FunctionRequires>;
9
+ export type CreateAnyResponse = CreateSyncResponse<any, ZodMetadata, ZodCheckpoint> | CreateActionResponse<any, any, ZodMetadata, ZodCheckpoint> | CreateOnEventResponse<ZodMetadata, ZodCheckpoint> | CreateAnyFunctionResponse;
8
10
  export type { ActionError } from './errors.js';
9
11
  export type { NangoActionBase as NangoAction, ProxyConfiguration } from './action.js';
10
12
  export type { NangoSyncBase as NangoSync } from './sync.js';
@@ -1 +1 @@
1
- {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../lib/scripts.ts"],"names":[],"mappings":"AAkLA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CACtB,MAAwD;IAExD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;AACvC,CAAC;AAgID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAK1B,MAAkE;IAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;AAoED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,MAAkD;IAElD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"scripts.js","sourceRoot":"","sources":["../lib/scripts.ts"],"names":[],"mappings":"AA8LA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CACtB,MAAwD;IAExD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;AACvC,CAAC;AAgID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAK1B,MAAkE;IAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;AACzC,CAAC;AAoED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,MAAkD;IAElD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAAC;AAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/runner-sdk",
3
- "version": "0.71.4",
3
+ "version": "0.71.6",
4
4
  "description": "Nango's Runner SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -10,9 +10,9 @@
10
10
  "directory": "packages/runner-sdk"
11
11
  },
12
12
  "dependencies": {
13
- "@nangohq/egress": "0.71.4",
14
- "@nangohq/node": "0.71.4",
15
- "@nangohq/providers": "0.71.4",
13
+ "@nangohq/egress": "0.71.6",
14
+ "@nangohq/node": "0.71.6",
15
+ "@nangohq/providers": "0.71.6",
16
16
  "ajv": "8.18.0",
17
17
  "ajv-formats": "3.0.1",
18
18
  "lodash-es": "4.18.1",
@@ -20,7 +20,7 @@
20
20
  "undici": "6.28.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@nangohq/types": "0.71.4",
23
+ "@nangohq/types": "0.71.6",
24
24
  "@types/json-schema": "7.0.15",
25
25
  "axios": "1.18.0",
26
26
  "json-schema": "0.4.0",