@nangohq/runner-sdk 0.71.12 → 0.71.13

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,7 +1,7 @@
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, MaybePromise, MergingStrategy, SdkLogger, Trigger } from '@nangohq/types';
4
+ import type { AllAuthCredentials, EnvironmentVariable, FunctionCapabilities, FunctionConcurrencyLimit, FunctionRequires, FunctionTags, FunctionTriggerDefinition, GetPublicConnection, GetPublicIntegration, MaybePromise, MergingStrategy, SdkLogger, Trigger } from '@nangohq/types';
5
5
  import type * as z from 'zod';
6
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;
@@ -84,6 +84,14 @@ export type Nango<TModels extends Record<string, ZodModel>, TMetadata extends Zo
84
84
  } ? unknown : ProxyCapability) & (TRequires extends {
85
85
  invoke: true;
86
86
  } ? InvokeCapability : unknown) & ([keyof TModels] extends [never] ? unknown : RecordCapability<TModels>) & (TCheckpoint extends undefined ? unknown : CheckpointCapability<InferZod<TCheckpoint>>) & (TMetadata extends undefined ? unknown : MetadataCapability<InferZod<TMetadata>>);
87
+ export declare function deriveFunctionCapabilities(params: {
88
+ data?: {
89
+ models?: Record<string, ZodModel>;
90
+ metadata?: ZodMetadata;
91
+ checkpoint?: ZodCheckpoint;
92
+ } | undefined;
93
+ requires?: FunctionRequires | undefined;
94
+ }): FunctionCapabilities;
87
95
  export interface CreateFunctionProps<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 = {
88
96
  outbound: true;
89
97
  connection: true;
@@ -111,6 +119,7 @@ export interface CreateFunctionProps<TModels extends Record<string, ZodModel> =
111
119
  } ? 1 : FunctionConcurrencyLimit;
112
120
  };
113
121
  };
122
+ tags?: FunctionTags;
114
123
  exec: (nango: Nango<TModels, TMetadata, TCheckpoint, TRequires>, trigger: Trigger<TTrigger, z.infer<TInput>>) => MaybePromise<z.infer<TOutput>>;
115
124
  }
116
125
  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 = {
@@ -143,11 +152,3 @@ export declare function createFunction<TModels extends Record<string, ZodModel>
143
152
  outbound: true;
144
153
  connection: true;
145
154
  }>(params: CreateFunctionProps<TModels, TInput, TOutput, TMetadata, TCheckpoint, TTrigger, TRequires>): CreateFunctionResponse<TModels, TInput, TOutput, TMetadata, TCheckpoint, TTrigger, TRequires>;
146
- export declare function deriveFunctionCapabilities(params: {
147
- data?: {
148
- models?: Record<string, ZodModel>;
149
- metadata?: ZodMetadata;
150
- checkpoint?: ZodCheckpoint;
151
- } | undefined;
152
- requires?: FunctionRequires | undefined;
153
- }): FunctionCapabilities;
package/dist/function.js CHANGED
@@ -1,3 +1,17 @@
1
+ // Function
2
+ // Derives the runtime capabilities from function definition
3
+ export function deriveFunctionCapabilities(params) {
4
+ const models = params.data?.models;
5
+ // A connection-less function has no connection to proxy through, so outbound is always off.
6
+ const connectionLess = params.requires?.connection === false;
7
+ return {
8
+ usesRecords: !!models && Object.keys(models).length > 0,
9
+ usesCheckpoints: !!params.data?.checkpoint,
10
+ usesMetadata: !!params.data?.metadata,
11
+ usesOutbound: !connectionLess && params.requires?.outbound !== false,
12
+ usesInvoke: params.requires?.invoke === true
13
+ };
14
+ }
1
15
  /**
2
16
  * Create a function, a trigger-agnostic primitive with capabilities.
3
17
  *
@@ -20,17 +34,4 @@
20
34
  export function createFunction(params) {
21
35
  return { type: 'function', ...params, capabilities: deriveFunctionCapabilities(params) };
22
36
  }
23
- // Derives the runtime capabilities from function definition
24
- export function deriveFunctionCapabilities(params) {
25
- const models = params.data?.models;
26
- // A connection-less function has no connection to proxy through, so outbound is always off.
27
- const connectionLess = params.requires?.connection === false;
28
- return {
29
- usesRecords: !!models && Object.keys(models).length > 0,
30
- usesCheckpoints: !!params.data?.checkpoint,
31
- usesMetadata: !!params.data?.metadata,
32
- usesOutbound: !connectionLess && params.requires?.outbound !== false,
33
- usesInvoke: params.requires?.invoke === true
34
- };
35
- }
36
37
  //# sourceMappingURL=function.js.map
@@ -1 +1 @@
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,CAA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 +1,6 @@
1
1
  {
2
2
  "name": "@nangohq/runner-sdk",
3
- "version": "0.71.12",
3
+ "version": "0.71.13",
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.12",
14
- "@nangohq/node": "0.71.12",
15
- "@nangohq/providers": "0.71.12",
13
+ "@nangohq/egress": "0.71.13",
14
+ "@nangohq/node": "0.71.13",
15
+ "@nangohq/providers": "0.71.13",
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.29.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@nangohq/types": "0.71.12",
23
+ "@nangohq/types": "0.71.13",
24
24
  "@types/json-schema": "7.0.15",
25
25
  "axios": "1.20.0",
26
26
  "json-schema": "0.4.0",